@descope/vue-sdk 2.0.5 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +82 -2
- package/dist/index.mjs +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -222,6 +222,104 @@ Descope SDK is automatically refreshes the session token when it is about to exp
|
|
|
222
222
|
If the Descope project settings are configured to manage tokens in cookies.
|
|
223
223
|
you must also configure a custom domain, and set it as the `baseUrl` to the `descope` plugin. See the above [`plugin` usage](#add-descope-plugin-to-your-application) for usage example.
|
|
224
224
|
|
|
225
|
+
### Widgets
|
|
226
|
+
|
|
227
|
+
Widgets are components that allow you to expose management features for tenant-based implementation. In certain scenarios, your customers may require the capability to perform managerial actions independently, alleviating the necessity to contact you. Widgets serve as a feature enabling you to delegate these capabilities to your customers in a modular manner.
|
|
228
|
+
|
|
229
|
+
Important Note:
|
|
230
|
+
|
|
231
|
+
- For the user to be able to use the widget, they need to be assigned the `Tenant Admin` Role.
|
|
232
|
+
|
|
233
|
+
#### User Management
|
|
234
|
+
|
|
235
|
+
The `UserManagement` widget will let you embed a user table in your site to view and take action.
|
|
236
|
+
|
|
237
|
+
The widget lets you:
|
|
238
|
+
|
|
239
|
+
- Create a new user
|
|
240
|
+
- Edit an existing user
|
|
241
|
+
- Activate / disable an existing user
|
|
242
|
+
- Reset an existing user's password
|
|
243
|
+
- Remove an existing user's passkey
|
|
244
|
+
- Delete an existing user
|
|
245
|
+
|
|
246
|
+
Note:
|
|
247
|
+
|
|
248
|
+
- Custom fields also appear in the table.
|
|
249
|
+
|
|
250
|
+
###### Usage
|
|
251
|
+
|
|
252
|
+
```vue
|
|
253
|
+
<template>
|
|
254
|
+
<UserManagement tenant="tenant-id" widget-id="user-management-widget" />
|
|
255
|
+
</template>
|
|
256
|
+
|
|
257
|
+
<script setup>
|
|
258
|
+
import { UserManagement } from '@descope/vue-sdk';
|
|
259
|
+
</script>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Example:
|
|
263
|
+
[Manage Users](./example/components/ManageUsers.vue)
|
|
264
|
+
|
|
265
|
+
#### Role Management
|
|
266
|
+
|
|
267
|
+
The `RoleManagement` widget will let you embed a role table in your site to view and take action.
|
|
268
|
+
|
|
269
|
+
The widget lets you:
|
|
270
|
+
|
|
271
|
+
- Create a new role
|
|
272
|
+
- Change an existing role's fields
|
|
273
|
+
- Delete an existing role
|
|
274
|
+
|
|
275
|
+
Note:
|
|
276
|
+
|
|
277
|
+
- The `Editable` field is determined by the user's access to the role - meaning that project-level roles are not editable by tenant level users.
|
|
278
|
+
- You need to pre-define the permissions that the user can use, which are not editable in the widget.
|
|
279
|
+
|
|
280
|
+
###### Usage
|
|
281
|
+
|
|
282
|
+
```vue
|
|
283
|
+
<template>
|
|
284
|
+
<RoleManagement tenant="tenant-id" widget-id="role-management-widget" />
|
|
285
|
+
</template>
|
|
286
|
+
|
|
287
|
+
<script setup>
|
|
288
|
+
import { RoleManagement } from '@descope/vue-sdk';
|
|
289
|
+
</script>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Example:
|
|
293
|
+
[Manage Roles](./example/components/ManageRoles.vue)
|
|
294
|
+
|
|
295
|
+
#### Access Key Management
|
|
296
|
+
|
|
297
|
+
The `AccessKeyManagement` widget will let you embed an access key table in your site to view and take action.
|
|
298
|
+
|
|
299
|
+
The widget lets you:
|
|
300
|
+
|
|
301
|
+
- Create a new access key
|
|
302
|
+
- Activate / deactivate an existing access key
|
|
303
|
+
- Delete an exising access key
|
|
304
|
+
|
|
305
|
+
###### Usage
|
|
306
|
+
|
|
307
|
+
```vue
|
|
308
|
+
<template>
|
|
309
|
+
<AccessKeyManagement
|
|
310
|
+
tenant="tenant-id"
|
|
311
|
+
widget-id="access-key-management-widget"
|
|
312
|
+
/>
|
|
313
|
+
</template>
|
|
314
|
+
|
|
315
|
+
<script setup>
|
|
316
|
+
import { AccessKeyManagement } from '@descope/vue-sdk';
|
|
317
|
+
</script>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Example:
|
|
321
|
+
[Manage Access Keys](./example/components/ManageAccessKeys.vue)
|
|
322
|
+
|
|
225
323
|
## Code Example
|
|
226
324
|
|
|
227
325
|
You can find an example Vue app in the [example folder](./example).
|
|
@@ -247,6 +345,8 @@ Run the following command in the root of the project to build and run the exampl
|
|
|
247
345
|
npm i && npm start
|
|
248
346
|
```
|
|
249
347
|
|
|
348
|
+
Open your browser and navigate to [http://localhost:3000](http://localhost:3000).
|
|
349
|
+
|
|
250
350
|
### Example Optional Env Variables
|
|
251
351
|
|
|
252
352
|
See the following table for customization environment variables for the example app:
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@descope/web-component"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@descope/web-component"),r=require("@descope/web-js-sdk");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@descope/user-management-widget"),require("@descope/role-management-widget"),require("@descope/access-key-management-widget");var s=n(t),o=n(r);const a=Symbol("$descope"),i={"x-descope-sdk-name":"vue","x-descope-sdk-version":"2.0.8"},u="undefined"!=typeof window,l=()=>{const t=e.inject(a);if(!t)throw Error("Missing Descope context, make sure you are using the Descope plugin");return t},d=()=>l().options,c=()=>l().sdk,p=e=>(...t)=>{let r;try{r=e(...t)}catch(e){console.error(e)}return r};let g;const m=e=>{const t=o.default({...e,persistTokens:u,autoRefresh:u});return g=t,t};g=m({projectId:"temp pid"});const f=()=>u?g?.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),y=p(((e=f(),t)=>g?.getJwtPermissions(e,t))),v=p(((e=f(),t)=>g?.getJwtRoles(e,t))),h=["project-id","base-url","flow-id","^theme","^locale","^tenant","^debug","^telemetryKey","redirect-url","auto-focus",".errorTransformer","^form","^client"];var w=e.defineComponent({__name:"Descope",props:{flowId:{type:String,required:!0},tenant:{type:String},theme:{type:String},locale:{type:String},debug:{type:Boolean},telemetryKey:{type:String},redirectUrl:{type:String},autoFocus:{type:Boolean},errorTransformer:{type:Function},form:{type:Object},client:{type:Object}},emits:["success","error","ready"],setup(t,{emit:r}){const n=t;s.default.sdkConfigOverrides={baseHeaders:i,persistTokens:!1,hooks:{get beforeRequest(){return g.httpClient.hooks.beforeRequest},set beforeRequest(e){}}};const{projectId:o,baseUrl:a}=d(),u=c(),l=e.computed((()=>n.form?JSON.stringify(n.form):"")),p=e.computed((()=>n.client?JSON.stringify(n.client):"")),m=async e=>{await(u.httpClient.hooks?.afterRequest?.({},new Response(JSON.stringify(e.detail)))),r("success",e)},f=e=>r("error",e),y=e=>r("ready",e);return(r,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("descope-wc",{"project-id":e.unref(o),"base-url":e.unref(a),"flow-id":t.flowId,"^theme":t.theme,"^locale":t.locale,"^tenant":t.tenant,"^debug":t.debug,"^telemetryKey":t.telemetryKey,"redirect-url":t.redirectUrl,"auto-focus":t.autoFocus,".errorTransformer":t.errorTransformer,"^form":e.unref(l),"^client":e.unref(p),onSuccess:m,onError:f,onReady:y},null,40,h)]))}});w.__file="src/Descope.vue";const b=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var S=e.defineComponent({__name:"UserManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(t){const{projectId:r,baseUrl:n}=d();return(s,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("descope-user-management-widget",{"project-id":e.unref(r),"base-url":e.unref(n),"^theme":t.theme,"^tenant":t.tenant,"^debug":t.debug,"widget-id":t.widgetId},null,8,b)]))}});S.__file="src/UserManagement.vue";const k=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var j=e.defineComponent({__name:"RoleManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(t){const{projectId:r,baseUrl:n}=d();return(s,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("descope-role-management-widget",{"project-id":e.unref(r),"base-url":e.unref(n),"^theme":t.theme,"^tenant":t.tenant,"^debug":t.debug,"widget-id":t.widgetId},null,8,k)]))}});j.__file="src/RoleManagement.vue";const x=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var _=e.defineComponent({__name:"AccessKeyManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(t){const{projectId:r,baseUrl:n}=d();return(s,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("descope-access-key-management-widget",{"project-id":e.unref(r),"base-url":e.unref(n),"^theme":t.theme,"^tenant":t.tenant,"^debug":t.debug,"widget-id":t.widgetId},null,8,x)]))}});_.__file="src/AccessKeyManagement.vue";const q=e.ref(null);let R;var U={install:function(t,r){const n=m({...r,persistTokens:!0,autoRefresh:!0,baseHeaders:i});R=n;const s=e.ref(null),o=e.ref(""),u=e.ref(null),l=e.ref(null);n.onSessionTokenChange((e=>{o.value=e})),n.onUserChange((e=>{l.value=e}));const d=async()=>{s.value=!0,await n.refresh(),s.value=!1},c=e.computed((()=>null===s.value)),p=e.computed((()=>null===u.value));q.value=()=>new Promise(((t,r)=>{!o.value&&c.value&&d().catch(r),e.watch((()=>s.value),(()=>!s.value&&t(!!e.unref(o))),{immediate:!0})})),t.provide(a,{session:{fetchSession:d,isLoading:e.readonly(s),session:e.readonly(o),isFetchSessionWasNeverCalled:c},user:{fetchUser:async()=>{u.value=!0,await n.me(),u.value=!1},isLoading:e.readonly(u),user:e.readonly(l),isFetchUserWasNeverCalled:p},sdk:n,options:r})}};exports.AccessKeyManagement=_,exports.Descope=w,exports.RoleManagement=j,exports.UserManagement=S,exports.default=U,exports.getJwtPermissions=y,exports.getJwtRoles=v,exports.getRefreshToken=()=>u?g?.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),exports.getSdk=()=>R,exports.getSessionToken=f,exports.routeGuard=()=>e.unref(q)?.(),exports.useDescope=c,exports.useSession=()=>{const{session:t}=l();return t.isFetchSessionWasNeverCalled.value&&t.fetchSession(),{isLoading:e.computed((()=>t.isLoading.value||t.isFetchSessionWasNeverCalled.value)),sessionToken:t.session,isAuthenticated:e.computed((()=>!!t.session.value))}},exports.useUser=()=>{const{user:t,session:r}=l(),n=()=>{!t.user.value&&r.session.value&&t.fetchUser()};return n(),e.watch(r.session,n),{isLoading:e.computed((()=>t.isLoading.value||t.isFetchUserWasNeverCalled.value)),user:t.user}};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as vue from 'vue';
|
|
|
2
2
|
import { App } from 'vue';
|
|
3
3
|
import * as _descope_core_js_sdk from '@descope/core-js-sdk';
|
|
4
4
|
|
|
5
|
-
declare const _default$
|
|
5
|
+
declare const _default$4: vue.DefineComponent<{
|
|
6
6
|
flowId: {
|
|
7
7
|
type: StringConstructor;
|
|
8
8
|
required: true;
|
|
@@ -83,11 +83,87 @@ declare const _default$2: vue.DefineComponent<{
|
|
|
83
83
|
autoFocus: boolean;
|
|
84
84
|
}>;
|
|
85
85
|
|
|
86
|
+
declare const _default$3: vue.DefineComponent<{
|
|
87
|
+
tenant: {
|
|
88
|
+
type: StringConstructor;
|
|
89
|
+
required: true;
|
|
90
|
+
};
|
|
91
|
+
widgetId: {
|
|
92
|
+
type: StringConstructor;
|
|
93
|
+
required: true;
|
|
94
|
+
};
|
|
95
|
+
theme: {
|
|
96
|
+
type: StringConstructor;
|
|
97
|
+
};
|
|
98
|
+
debug: {
|
|
99
|
+
type: BooleanConstructor;
|
|
100
|
+
};
|
|
101
|
+
}, (_ctx: any, _cache: any) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
104
|
+
tenant: {
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
required: true;
|
|
107
|
+
};
|
|
108
|
+
widgetId: {
|
|
109
|
+
type: StringConstructor;
|
|
110
|
+
required: true;
|
|
111
|
+
};
|
|
112
|
+
theme: {
|
|
113
|
+
type: StringConstructor;
|
|
114
|
+
};
|
|
115
|
+
debug: {
|
|
116
|
+
type: BooleanConstructor;
|
|
117
|
+
};
|
|
118
|
+
}>>, {
|
|
119
|
+
debug: boolean;
|
|
120
|
+
}>;
|
|
121
|
+
|
|
122
|
+
declare const _default$2: vue.DefineComponent<{
|
|
123
|
+
tenant: {
|
|
124
|
+
type: StringConstructor;
|
|
125
|
+
required: true;
|
|
126
|
+
};
|
|
127
|
+
widgetId: {
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
required: true;
|
|
130
|
+
};
|
|
131
|
+
theme: {
|
|
132
|
+
type: StringConstructor;
|
|
133
|
+
};
|
|
134
|
+
debug: {
|
|
135
|
+
type: BooleanConstructor;
|
|
136
|
+
};
|
|
137
|
+
}, (_ctx: any, _cache: any) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
138
|
+
[key: string]: any;
|
|
139
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
140
|
+
tenant: {
|
|
141
|
+
type: StringConstructor;
|
|
142
|
+
required: true;
|
|
143
|
+
};
|
|
144
|
+
widgetId: {
|
|
145
|
+
type: StringConstructor;
|
|
146
|
+
required: true;
|
|
147
|
+
};
|
|
148
|
+
theme: {
|
|
149
|
+
type: StringConstructor;
|
|
150
|
+
};
|
|
151
|
+
debug: {
|
|
152
|
+
type: BooleanConstructor;
|
|
153
|
+
};
|
|
154
|
+
}>>, {
|
|
155
|
+
debug: boolean;
|
|
156
|
+
}>;
|
|
157
|
+
|
|
86
158
|
declare const _default$1: vue.DefineComponent<{
|
|
87
159
|
tenant: {
|
|
88
160
|
type: StringConstructor;
|
|
89
161
|
required: true;
|
|
90
162
|
};
|
|
163
|
+
widgetId: {
|
|
164
|
+
type: StringConstructor;
|
|
165
|
+
required: true;
|
|
166
|
+
};
|
|
91
167
|
theme: {
|
|
92
168
|
type: StringConstructor;
|
|
93
169
|
};
|
|
@@ -101,6 +177,10 @@ declare const _default$1: vue.DefineComponent<{
|
|
|
101
177
|
type: StringConstructor;
|
|
102
178
|
required: true;
|
|
103
179
|
};
|
|
180
|
+
widgetId: {
|
|
181
|
+
type: StringConstructor;
|
|
182
|
+
required: true;
|
|
183
|
+
};
|
|
104
184
|
theme: {
|
|
105
185
|
type: StringConstructor;
|
|
106
186
|
};
|
|
@@ -2950,5 +3030,5 @@ declare const getRefreshToken: () => string;
|
|
|
2950
3030
|
declare const getJwtPermissions: (token?: any, tenant?: string) => string[];
|
|
2951
3031
|
declare const getJwtRoles: (token?: any, tenant?: string) => string[];
|
|
2952
3032
|
|
|
2953
|
-
export { _default$
|
|
3033
|
+
export { _default$1 as AccessKeyManagement, _default$4 as Descope, _default$2 as RoleManagement, _default$3 as UserManagement, _default as default, getJwtPermissions, getJwtRoles, getRefreshToken, getSdk, getSessionToken, routeGuard, useDescope, useSession, useUser };
|
|
2954
3034
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{computed as e,watch as
|
|
1
|
+
import{computed as e,watch as t,inject as s,defineComponent as n,openBlock as r,createElementBlock as o,createElementVNode as a,unref as i,ref as l,readonly as d}from"vue";import u from"@descope/web-component";import c from"@descope/web-js-sdk";import"@descope/user-management-widget";import"@descope/role-management-widget";import"@descope/access-key-management-widget";const p=Symbol("$descope"),g={"x-descope-sdk-name":"vue","x-descope-sdk-version":"2.0.8"},m="undefined"!=typeof window,y=()=>{const e=s(p);if(!e)throw Error("Missing Descope context, make sure you are using the Descope plugin");return e},f=()=>y().options,v=()=>y().sdk,h=()=>{const{session:t}=y();return t.isFetchSessionWasNeverCalled.value&&t.fetchSession(),{isLoading:e((()=>t.isLoading.value||t.isFetchSessionWasNeverCalled.value)),sessionToken:t.session,isAuthenticated:e((()=>!!t.session.value))}},b=()=>{const{user:s,session:n}=y(),r=()=>{!s.user.value&&n.session.value&&s.fetchUser()};return r(),t(n.session,r),{isLoading:e((()=>s.isLoading.value||s.isFetchUserWasNeverCalled.value)),user:s.user}},w=e=>(...t)=>{let s;try{s=e(...t)}catch(e){console.error(e)}return s};let S;const k=e=>{const t=c({...e,persistTokens:m,autoRefresh:m});return S=t,t};S=k({projectId:"temp pid"});const j=()=>m?S?.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),_=()=>m?S?.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),R=w(((e=j(),t)=>S?.getJwtPermissions(e,t))),U=w(((e=j(),t)=>S?.getJwtRoles(e,t))),I=["project-id","base-url","flow-id","^theme","^locale","^tenant","^debug","^telemetryKey","redirect-url","auto-focus",".errorTransformer","^form","^client"];var q=n({__name:"Descope",props:{flowId:{type:String,required:!0},tenant:{type:String},theme:{type:String},locale:{type:String},debug:{type:Boolean},telemetryKey:{type:String},redirectUrl:{type:String},autoFocus:{type:Boolean},errorTransformer:{type:Function},form:{type:Object},client:{type:Object}},emits:["success","error","ready"],setup(t,{emit:s}){const n=t;u.sdkConfigOverrides={baseHeaders:g,persistTokens:!1,hooks:{get beforeRequest(){return S.httpClient.hooks.beforeRequest},set beforeRequest(e){}}};const{projectId:l,baseUrl:d}=f(),c=v(),p=e((()=>n.form?JSON.stringify(n.form):"")),m=e((()=>n.client?JSON.stringify(n.client):"")),y=async e=>{await(c.httpClient.hooks?.afterRequest?.({},new Response(JSON.stringify(e.detail)))),s("success",e)},h=e=>s("error",e),b=e=>s("ready",e);return(e,s)=>(r(),o("div",null,[a("descope-wc",{"project-id":i(l),"base-url":i(d),"flow-id":t.flowId,"^theme":t.theme,"^locale":t.locale,"^tenant":t.tenant,"^debug":t.debug,"^telemetryKey":t.telemetryKey,"redirect-url":t.redirectUrl,"auto-focus":t.autoFocus,".errorTransformer":t.errorTransformer,"^form":i(p),"^client":i(m),onSuccess:y,onError:h,onReady:b},null,40,I)]))}});q.__file="src/Descope.vue";const T=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var C=n({__name:"UserManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(e){const{projectId:t,baseUrl:s}=f();return(n,l)=>(r(),o("div",null,[a("descope-user-management-widget",{"project-id":i(t),"base-url":i(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,T)]))}});C.__file="src/UserManagement.vue";const M=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var F=n({__name:"RoleManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(e){const{projectId:t,baseUrl:s}=f();return(n,l)=>(r(),o("div",null,[a("descope-role-management-widget",{"project-id":i(t),"base-url":i(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,M)]))}});F.__file="src/RoleManagement.vue";const N=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var K=n({__name:"AccessKeyManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(e){const{projectId:t,baseUrl:s}=f();return(n,l)=>(r(),o("div",null,[a("descope-access-key-management-widget",{"project-id":i(t),"base-url":i(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,N)]))}});K.__file="src/AccessKeyManagement.vue";const L=l(null),O=()=>i(L)?.();let B;const D=()=>B;var J={install:function(s,n){const r=k({...n,persistTokens:!0,autoRefresh:!0,baseHeaders:g});B=r;const o=l(null),a=l(""),u=l(null),c=l(null);r.onSessionTokenChange((e=>{a.value=e})),r.onUserChange((e=>{c.value=e}));const m=async()=>{o.value=!0,await r.refresh(),o.value=!1},y=e((()=>null===o.value)),f=e((()=>null===u.value));L.value=()=>new Promise(((e,s)=>{!a.value&&y.value&&m().catch(s),t((()=>o.value),(()=>!o.value&&e(!!i(a))),{immediate:!0})})),s.provide(p,{session:{fetchSession:m,isLoading:d(o),session:d(a),isFetchSessionWasNeverCalled:y},user:{fetchUser:async()=>{u.value=!0,await r.me(),u.value=!1},isLoading:d(u),user:d(c),isFetchUserWasNeverCalled:f},sdk:r,options:n})}};export{K as AccessKeyManagement,q as Descope,F as RoleManagement,C as UserManagement,J as default,R as getJwtPermissions,U as getJwtRoles,_ as getRefreshToken,D as getSdk,j as getSessionToken,O as routeGuard,v as useDescope,h as useSession,b as useUser};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope/vue-sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"scripts": {
|
|
23
|
-
"start": "vue-cli-service serve",
|
|
23
|
+
"start": "vue-cli-service serve --port 3000",
|
|
24
24
|
"build": "rollup -m -c rollup.config.js",
|
|
25
25
|
"test": "vue-cli-service test:unit",
|
|
26
26
|
"lint": "vue-cli-service lint",
|
|
@@ -37,8 +37,10 @@
|
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@descope/user-management-widget": "0.
|
|
41
|
-
"@descope/
|
|
40
|
+
"@descope/user-management-widget": "0.4.24",
|
|
41
|
+
"@descope/role-management-widget": "0.1.23",
|
|
42
|
+
"@descope/access-key-management-widget": "0.1.23",
|
|
43
|
+
"@descope/web-component": "3.8.31"
|
|
42
44
|
},
|
|
43
45
|
"peerDependencies": {
|
|
44
46
|
"vue": ">=3"
|