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

Commit

Permalink
add user management widget (#45)
Browse files Browse the repository at this point in the history
* add user management widget

* bump UMW

* CR fix
  • Loading branch information
nirgur authored Feb 4, 2024
1 parent 3794e02 commit 2c01b28
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ pnpm-debug.log*
*.sln
*.sw?
.history
coverage/
coverage/
.env
2 changes: 1 addition & 1 deletion example/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<header>
<div class="routes">
<router-link to="/">Home</router-link>
<router-link to="/manage-users">Manage Users</router-link>
<router-link to="/login">Login</router-link>
</div>
<button v-if="isAuthenticated" @click="logout()">Logout</button>
Expand All @@ -21,7 +22,6 @@ const { logout } = useDescope();
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
Expand Down
19 changes: 19 additions & 0 deletions example/components/ManageUsers.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<div class="wrapper">
<h1>Manage Users</h1>
<UserManagement :tenant="tenant" />
</div>
</template>

<script setup>
import { UserManagement } from '../../src';

const tenant = process.env.VUE_APP_DESCOPE_TENANT;
</script>

<style>
.wrapper {
margin: 20px;
}
</style>
6 changes: 6 additions & 0 deletions example/router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router';
import Home from './components/Home.vue';
import Login from './components/Login.vue';
import ManageUsers from './components/ManageUsers.vue';
import { routeGuard } from '../src';

const router = createRouter({
Expand Down Expand Up @@ -32,6 +33,11 @@ const router = createRouter({
path: '/login',
name: 'login',
component: Login
},
{
path: '/manage-users',
name: 'manage-users',
component: ManageUsers
}
]
});
Expand Down
182 changes: 182 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
]
},
"dependencies": {
"@descope/user-management-widget": "0.0.7",
"@descope/web-component": "3.7.0"
},
"peerDependencies": {
Expand Down
32 changes: 32 additions & 0 deletions src/UserManagement.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<div>
<descope-user-management-widget
:project-id="projectId"
:base-url="baseUrl"
:theme.attr="theme"
:tenant.attr="tenant"
:debug.attr="debug"
/>
</div>
</template>

<script setup lang="ts">
import '@descope/user-management-widget';
import { useOptions } from './hooks';

defineProps({
tenant: {
type: String,
required: true
},
theme: {
type: String
},
debug: {
type: Boolean
}
});

const { projectId, baseUrl } = useOptions();
</script>
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as Descope } from './Descope.vue';
export { default as UserManagement } from './UserManagement.vue';
export { useDescope, useSession, useUser } from './hooks';
export { default, routeGuard, getSdk } from './plugin';
export {
Expand Down
2 changes: 1 addition & 1 deletion tests/Descope.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shallowMount, mount } from '@vue/test-utils';
import { Descope } from '../src';
import Descope from '../src/Descope.vue';

jest.mock('../src/hooks', () => ({
useOptions: () => ({ projectId: 'project1', baseUrl: 'baseUrl' }),
Expand Down
Loading

0 comments on commit 2c01b28

Please sign in to comment.