Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 2c01b28

Browse files
authored
add user management widget (#45)
* add user management widget * bump UMW * CR fix
1 parent 3794e02 commit 2c01b28

12 files changed

+289
-6
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ pnpm-debug.log*
2222
*.sln
2323
*.sw?
2424
.history
25-
coverage/
25+
coverage/
26+
.env

example/components/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<header>
33
<div class="routes">
44
<router-link to="/">Home</router-link>
5+
<router-link to="/manage-users">Manage Users</router-link>
56
<router-link to="/login">Login</router-link>
67
</div>
78
<button v-if="isAuthenticated" @click="logout()">Logout</button>
@@ -21,7 +22,6 @@ const { logout } = useDescope();
2122
font-family: Avenir, Helvetica, Arial, sans-serif;
2223
-webkit-font-smoothing: antialiased;
2324
-moz-osx-font-smoothing: grayscale;
24-
text-align: center;
2525
color: #2c3e50;
2626
}
2727

example/components/ManageUsers.vue

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- eslint-disable vue/multi-word-component-names -->
2+
<template>
3+
<div class="wrapper">
4+
<h1>Manage Users</h1>
5+
<UserManagement :tenant="tenant" />
6+
</div>
7+
</template>
8+
9+
<script setup>
10+
import { UserManagement } from '../../src';
11+
12+
const tenant = process.env.VUE_APP_DESCOPE_TENANT;
13+
</script>
14+
15+
<style>
16+
.wrapper {
17+
margin: 20px;
18+
}
19+
</style>

example/router.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createRouter, createWebHistory } from 'vue-router';
22
import Home from './components/Home.vue';
33
import Login from './components/Login.vue';
4+
import ManageUsers from './components/ManageUsers.vue';
45
import { routeGuard } from '../src';
56

67
const router = createRouter({
@@ -32,6 +33,11 @@ const router = createRouter({
3233
path: '/login',
3334
name: 'login',
3435
component: Login
36+
},
37+
{
38+
path: '/manage-users',
39+
name: 'manage-users',
40+
component: ManageUsers
3541
}
3642
]
3743
});

package-lock.json

+182
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
]
3838
},
3939
"dependencies": {
40+
"@descope/user-management-widget": "0.0.7",
4041
"@descope/web-component": "3.7.0"
4142
},
4243
"peerDependencies": {

src/UserManagement.vue

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- eslint-disable vue/multi-word-component-names -->
2+
<template>
3+
<div>
4+
<descope-user-management-widget
5+
:project-id="projectId"
6+
:base-url="baseUrl"
7+
:theme.attr="theme"
8+
:tenant.attr="tenant"
9+
:debug.attr="debug"
10+
/>
11+
</div>
12+
</template>
13+
14+
<script setup lang="ts">
15+
import '@descope/user-management-widget';
16+
import { useOptions } from './hooks';
17+
18+
defineProps({
19+
tenant: {
20+
type: String,
21+
required: true
22+
},
23+
theme: {
24+
type: String
25+
},
26+
debug: {
27+
type: Boolean
28+
}
29+
});
30+
31+
const { projectId, baseUrl } = useOptions();
32+
</script>

src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { default as Descope } from './Descope.vue';
2+
export { default as UserManagement } from './UserManagement.vue';
23
export { useDescope, useSession, useUser } from './hooks';
34
export { default, routeGuard, getSdk } from './plugin';
45
export {

tests/Descope.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { shallowMount, mount } from '@vue/test-utils';
2-
import { Descope } from '../src';
2+
import Descope from '../src/Descope.vue';
33

44
jest.mock('../src/hooks', () => ({
55
useOptions: () => ({ projectId: 'project1', baseUrl: 'baseUrl' }),

0 commit comments

Comments
 (0)