@descope/vue-sdk 2.0.12 → 2.0.13
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 +57 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +342 -6
- package/dist/index.mjs +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -224,6 +224,24 @@ Descope SDK is automatically refreshes the session token when it is about to exp
|
|
|
224
224
|
If the Descope project settings are configured to manage tokens in cookies.
|
|
225
225
|
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.
|
|
226
226
|
|
|
227
|
+
### Token Persistence
|
|
228
|
+
|
|
229
|
+
Descope stores two tokens: the session token and the refresh token.
|
|
230
|
+
|
|
231
|
+
- The refresh token is either stored in local storage or an `httpOnly` cookie. This is configurable in the Descope console.
|
|
232
|
+
- The session token is stored in either local storage or a JS cookie. This behavior is configurable via the `sessionTokenViaCookie` prop in the Descope plugin.
|
|
233
|
+
|
|
234
|
+
However, for security reasons, you may choose not to store tokens in the browser. In this case, you can pass `persistTokens: false` to the Descope plugin. This prevents the SDK from storing the tokens in the browser.
|
|
235
|
+
|
|
236
|
+
Notes:
|
|
237
|
+
|
|
238
|
+
- You must configure the refresh token to be stored in an `httpOnly` cookie in the Descope console. Otherwise, the refresh token will not be stored, and when the page is refreshed, the user will be logged out.
|
|
239
|
+
- You can still retrieve the session token using the `useSession` hook.
|
|
240
|
+
|
|
241
|
+
### Last User Persistence
|
|
242
|
+
|
|
243
|
+
Descope stores the last user information in local storage. If you wish to disable this feature, you can pass `storeLastAuthenticatedUser: false` to the Descope plugin. Please note that some features related to the last authenticated user may not function as expected if this behavior is disabled.
|
|
244
|
+
|
|
227
245
|
### Widgets
|
|
228
246
|
|
|
229
247
|
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.
|
|
@@ -234,7 +252,7 @@ Important Note:
|
|
|
234
252
|
|
|
235
253
|
#### User Management
|
|
236
254
|
|
|
237
|
-
The `UserManagement` widget
|
|
255
|
+
The `UserManagement` widget lets you embed a user table in your site to view and take action.
|
|
238
256
|
|
|
239
257
|
The widget lets you:
|
|
240
258
|
|
|
@@ -266,7 +284,7 @@ Example:
|
|
|
266
284
|
|
|
267
285
|
#### Role Management
|
|
268
286
|
|
|
269
|
-
The `RoleManagement` widget
|
|
287
|
+
The `RoleManagement` widget lets you embed a role table in your site to view and take action.
|
|
270
288
|
|
|
271
289
|
The widget lets you:
|
|
272
290
|
|
|
@@ -296,7 +314,7 @@ Example:
|
|
|
296
314
|
|
|
297
315
|
#### Access Key Management
|
|
298
316
|
|
|
299
|
-
The `AccessKeyManagement` widget
|
|
317
|
+
The `AccessKeyManagement` widget lets you embed an access key table in your site to view and take action.
|
|
300
318
|
|
|
301
319
|
The widget lets you:
|
|
302
320
|
|
|
@@ -308,10 +326,17 @@ The widget lets you:
|
|
|
308
326
|
|
|
309
327
|
```vue
|
|
310
328
|
<template>
|
|
329
|
+
<!-- admin view: manage all tenant users' access keys -->
|
|
311
330
|
<AccessKeyManagement
|
|
312
331
|
tenant="tenant-id"
|
|
313
332
|
widget-id="access-key-management-widget"
|
|
314
333
|
/>
|
|
334
|
+
|
|
335
|
+
<!-- user view: mange access key for the logged-in tenant's user -->
|
|
336
|
+
<AccessKeyManagement
|
|
337
|
+
tenant="tenant-id"
|
|
338
|
+
widget-id="user-access-key-management-widget"
|
|
339
|
+
/>
|
|
315
340
|
</template>
|
|
316
341
|
|
|
317
342
|
<script setup>
|
|
@@ -324,7 +349,7 @@ Example:
|
|
|
324
349
|
|
|
325
350
|
#### Audit Management
|
|
326
351
|
|
|
327
|
-
The `AuditManagement` widget
|
|
352
|
+
The `AuditManagement` widget lets you embed an audit table in your site.
|
|
328
353
|
|
|
329
354
|
###### Usage
|
|
330
355
|
|
|
@@ -341,6 +366,34 @@ import { AuditManagement } from '@descope/vue-sdk';
|
|
|
341
366
|
Example:
|
|
342
367
|
[Manage Audit](./example/components/ManageAudit.vue)
|
|
343
368
|
|
|
369
|
+
#### User Profile
|
|
370
|
+
|
|
371
|
+
The `UserProfile` widget lets you embed a user profile component in your app and let the logged in user update his profile.
|
|
372
|
+
|
|
373
|
+
The widget lets you:
|
|
374
|
+
|
|
375
|
+
- Update user profile picture
|
|
376
|
+
- Update user personal information
|
|
377
|
+
- Update authentication methods
|
|
378
|
+
- Logout
|
|
379
|
+
|
|
380
|
+
###### Usage
|
|
381
|
+
|
|
382
|
+
```vue
|
|
383
|
+
<template>
|
|
384
|
+
<UserProfile widget-id="user-profile-widget" @logout="onLogout" />
|
|
385
|
+
</template>
|
|
386
|
+
|
|
387
|
+
<script setup>
|
|
388
|
+
import { UserProfile } from '@descope/vue-sdk';
|
|
389
|
+
|
|
390
|
+
const onLogout = () => (window.location.href = '/login');
|
|
391
|
+
</script>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Example:
|
|
395
|
+
[User Profile](./example/components/MyUserProfile.vue)
|
|
396
|
+
|
|
344
397
|
## Code Example
|
|
345
398
|
|
|
346
399
|
You can find an example Vue app in the [example folder](./example).
|
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"),require("@descope/audit-management-widget"),require("@descope/user-profile-widget");var s=n(t),o=n(r);const i=Symbol("$descope"),a={"x-descope-sdk-name":"vue","x-descope-sdk-version":"2.0.13"},d="undefined"!=typeof window,u=()=>{const t=e.inject(i);if(!t)throw Error("Missing Descope context, make sure you are using the Descope plugin");return t},l=()=>u().options,c=()=>u().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({persistTokens:d,storeLastAuthenticatedUser:d,...e,autoRefresh:d});return g=t,t};g=m({projectId:"temp pid"});const f=()=>d?g?.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),y=()=>d?g?.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),h=p(((e=f(),t)=>g?.getJwtPermissions(e,t))),w=p(((e=f(),t)=>g?.getJwtRoles(e,t))),b=["project-id","base-url","flow-id","^theme","^locale","^tenant","^debug","^telemetryKey","redirect-url","auto-focus","store-last-authenticated-user",".errorTransformer","^form","^client"];var v=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:a,persistTokens:!1,hooks:{get beforeRequest(){return g.httpClient.hooks.beforeRequest},set beforeRequest(e){}}};const{projectId:o,baseUrl:i,storeLastAuthenticatedUser:d}=l(),u=c(),p=e.computed((()=>n.form?JSON.stringify(n.form):"")),m=e.computed((()=>n.client?JSON.stringify(n.client):"")),f=async e=>{await(u.httpClient.hooks?.afterRequest?.({},new Response(JSON.stringify(e.detail)))),r("success",e)},y=e=>r("error",e),h=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(i),"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,"store-last-authenticated-user":e.unref(d),".errorTransformer":t.errorTransformer,"^form":e.unref(p),"^client":e.unref(m),onSuccess:f,onError:y,onReady:h},null,40,b)]))}});v.__file="src/Descope.vue";const S=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var k=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}=l();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,S)]))}});k.__file="src/UserManagement.vue";const x=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var _=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}=l();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,x)]))}});_.__file="src/RoleManagement.vue";const j=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var q=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}=l();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,j)]))}});q.__file="src/AccessKeyManagement.vue";const U=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var B=e.defineComponent({__name:"AuditManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(t){const{projectId:r,baseUrl:n}=l();return(s,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("descope-audit-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,U)]))}});B.__file="src/AuditManagement.vue";const I=["project-id","base-url","^theme","^debug","widget-id"];var E=e.defineComponent({__name:"UserProfile",props:{widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},emits:["logout"],setup(t,{emit:r}){const n=e=>r("logout",e),{projectId:s,baseUrl:o}=l();return(r,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("descope-user-profile-widget",{"project-id":e.unref(s),"base-url":e.unref(o),"^theme":t.theme,"^debug":t.debug,"widget-id":t.widgetId,onLogout:n},null,40,I)]))}});E.__file="src/UserProfile.vue";const R=e.ref(null);let C;var T={install:function(t,r){const n=m({persistTokens:!0,...r,autoRefresh:!0,baseHeaders:a});C=n;const s=e.ref(null),o=e.ref(""),d=e.ref(null),u=e.ref(null);n.onSessionTokenChange((e=>{o.value=e})),n.onUserChange((e=>{u.value=e}));const l=async()=>{s.value=!0,await n.refresh(),s.value=!1},c=e.computed((()=>null===s.value)),p=e.computed((()=>null===d.value));R.value=()=>new Promise(((t,r)=>{!o.value&&c.value&&l().catch(r),e.watch((()=>s.value),(()=>!s.value&&t(!!e.unref(o))),{immediate:!0})})),t.provide(i,{session:{fetchSession:l,isLoading:e.readonly(s),session:e.readonly(o),isFetchSessionWasNeverCalled:c},user:{fetchUser:async()=>{d.value=!0,await n.me(),d.value=!1},isLoading:e.readonly(d),user:e.readonly(u),isFetchUserWasNeverCalled:p},sdk:n,options:r})}};exports.AccessKeyManagement=q,exports.AuditManagement=B,exports.Descope=v,exports.RoleManagement=_,exports.UserManagement=k,exports.UserProfile=E,exports.default=T,exports.getJwtPermissions=h,exports.getJwtRoles=w,exports.getRefreshToken=y,exports.getSdk=()=>C,exports.getSessionToken=f,exports.isRefreshTokenExpired=(e=y())=>g?.isJwtExpired(e),exports.isSessionTokenExpired=(e=f())=>g?.isJwtExpired(e),exports.routeGuard=()=>e.unref(R)?.(),exports.useDescope=c,exports.useSession=()=>{const{session:t}=u();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}=u(),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
|
@@ -3,7 +3,7 @@ import { App } from 'vue';
|
|
|
3
3
|
import * as _descope_web_js_sdk from '@descope/web-js-sdk';
|
|
4
4
|
import * as _descope_core_js_sdk from '@descope/core-js-sdk';
|
|
5
5
|
|
|
6
|
-
declare const _default$
|
|
6
|
+
declare const _default$6: vue.DefineComponent<{
|
|
7
7
|
flowId: {
|
|
8
8
|
type: StringConstructor;
|
|
9
9
|
required: true;
|
|
@@ -84,7 +84,7 @@ declare const _default$5: vue.DefineComponent<{
|
|
|
84
84
|
autoFocus: boolean;
|
|
85
85
|
}>;
|
|
86
86
|
|
|
87
|
-
declare const _default$
|
|
87
|
+
declare const _default$5: vue.DefineComponent<{
|
|
88
88
|
tenant: {
|
|
89
89
|
type: StringConstructor;
|
|
90
90
|
required: true;
|
|
@@ -120,7 +120,7 @@ declare const _default$4: vue.DefineComponent<{
|
|
|
120
120
|
debug: boolean;
|
|
121
121
|
}>;
|
|
122
122
|
|
|
123
|
-
declare const _default$
|
|
123
|
+
declare const _default$4: vue.DefineComponent<{
|
|
124
124
|
tenant: {
|
|
125
125
|
type: StringConstructor;
|
|
126
126
|
required: true;
|
|
@@ -156,7 +156,7 @@ declare const _default$3: vue.DefineComponent<{
|
|
|
156
156
|
debug: boolean;
|
|
157
157
|
}>;
|
|
158
158
|
|
|
159
|
-
declare const _default$
|
|
159
|
+
declare const _default$3: vue.DefineComponent<{
|
|
160
160
|
tenant: {
|
|
161
161
|
type: StringConstructor;
|
|
162
162
|
required: true;
|
|
@@ -192,7 +192,7 @@ declare const _default$2: vue.DefineComponent<{
|
|
|
192
192
|
debug: boolean;
|
|
193
193
|
}>;
|
|
194
194
|
|
|
195
|
-
declare const _default$
|
|
195
|
+
declare const _default$2: vue.DefineComponent<{
|
|
196
196
|
tenant: {
|
|
197
197
|
type: StringConstructor;
|
|
198
198
|
required: true;
|
|
@@ -228,10 +228,42 @@ declare const _default$1: vue.DefineComponent<{
|
|
|
228
228
|
debug: boolean;
|
|
229
229
|
}>;
|
|
230
230
|
|
|
231
|
+
declare const _default$1: vue.DefineComponent<{
|
|
232
|
+
widgetId: {
|
|
233
|
+
type: StringConstructor;
|
|
234
|
+
required: true;
|
|
235
|
+
};
|
|
236
|
+
theme: {
|
|
237
|
+
type: StringConstructor;
|
|
238
|
+
};
|
|
239
|
+
debug: {
|
|
240
|
+
type: BooleanConstructor;
|
|
241
|
+
};
|
|
242
|
+
}, (_ctx: any, _cache: any) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
243
|
+
[key: string]: any;
|
|
244
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "logout"[], "logout", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
245
|
+
widgetId: {
|
|
246
|
+
type: StringConstructor;
|
|
247
|
+
required: true;
|
|
248
|
+
};
|
|
249
|
+
theme: {
|
|
250
|
+
type: StringConstructor;
|
|
251
|
+
};
|
|
252
|
+
debug: {
|
|
253
|
+
type: BooleanConstructor;
|
|
254
|
+
};
|
|
255
|
+
}>> & {
|
|
256
|
+
onLogout?: (...args: any[]) => any;
|
|
257
|
+
}, {
|
|
258
|
+
debug: boolean;
|
|
259
|
+
}>;
|
|
260
|
+
|
|
231
261
|
type Options = {
|
|
232
262
|
projectId: string;
|
|
233
263
|
baseUrl?: string;
|
|
264
|
+
persistTokens?: boolean;
|
|
234
265
|
sessionTokenViaCookie?: boolean;
|
|
266
|
+
storeLastAuthenticatedUser?: boolean;
|
|
235
267
|
};
|
|
236
268
|
|
|
237
269
|
declare const useDescope: () => ((({
|
|
@@ -680,6 +712,44 @@ declare const useDescope: () => ((({
|
|
|
680
712
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
681
713
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
682
714
|
};
|
|
715
|
+
notp: {
|
|
716
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
717
|
+
customClaims?: Record<string, any>;
|
|
718
|
+
templateOptions?: {
|
|
719
|
+
[x: string]: string;
|
|
720
|
+
};
|
|
721
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
722
|
+
pendingRef: string;
|
|
723
|
+
redirectUrl: string;
|
|
724
|
+
image: string;
|
|
725
|
+
}>>;
|
|
726
|
+
signUp: (loginId?: string, user?: {
|
|
727
|
+
email?: string;
|
|
728
|
+
name?: string;
|
|
729
|
+
givenName?: string;
|
|
730
|
+
middleName?: string;
|
|
731
|
+
familyName?: string;
|
|
732
|
+
phone?: string;
|
|
733
|
+
}, signUpOptions?: {
|
|
734
|
+
customClaims?: Record<string, any>;
|
|
735
|
+
templateOptions?: {
|
|
736
|
+
[x: string]: string;
|
|
737
|
+
};
|
|
738
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
739
|
+
pendingRef: string;
|
|
740
|
+
redirectUrl: string;
|
|
741
|
+
image: string;
|
|
742
|
+
}>>;
|
|
743
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
744
|
+
pendingRef: string;
|
|
745
|
+
redirectUrl: string;
|
|
746
|
+
image: string;
|
|
747
|
+
}>>;
|
|
748
|
+
waitForSession: (pendingRef: string, config?: {
|
|
749
|
+
pollingIntervalMs: number;
|
|
750
|
+
timeoutMs: number;
|
|
751
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
752
|
+
};
|
|
683
753
|
password: {
|
|
684
754
|
signUp: (loginId: string, password: string, user?: {
|
|
685
755
|
email?: string;
|
|
@@ -1198,6 +1268,44 @@ declare const useDescope: () => ((({
|
|
|
1198
1268
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
1199
1269
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
1200
1270
|
};
|
|
1271
|
+
notp: {
|
|
1272
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
1273
|
+
customClaims?: Record<string, any>;
|
|
1274
|
+
templateOptions?: {
|
|
1275
|
+
[x: string]: string;
|
|
1276
|
+
};
|
|
1277
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
1278
|
+
pendingRef: string;
|
|
1279
|
+
redirectUrl: string;
|
|
1280
|
+
image: string;
|
|
1281
|
+
}>>;
|
|
1282
|
+
signUp: (loginId?: string, user?: {
|
|
1283
|
+
email?: string;
|
|
1284
|
+
name?: string;
|
|
1285
|
+
givenName?: string;
|
|
1286
|
+
middleName?: string;
|
|
1287
|
+
familyName?: string;
|
|
1288
|
+
phone?: string;
|
|
1289
|
+
}, signUpOptions?: {
|
|
1290
|
+
customClaims?: Record<string, any>;
|
|
1291
|
+
templateOptions?: {
|
|
1292
|
+
[x: string]: string;
|
|
1293
|
+
};
|
|
1294
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
1295
|
+
pendingRef: string;
|
|
1296
|
+
redirectUrl: string;
|
|
1297
|
+
image: string;
|
|
1298
|
+
}>>;
|
|
1299
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
1300
|
+
pendingRef: string;
|
|
1301
|
+
redirectUrl: string;
|
|
1302
|
+
image: string;
|
|
1303
|
+
}>>;
|
|
1304
|
+
waitForSession: (pendingRef: string, config?: {
|
|
1305
|
+
pollingIntervalMs: number;
|
|
1306
|
+
timeoutMs: number;
|
|
1307
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
1308
|
+
};
|
|
1201
1309
|
password: {
|
|
1202
1310
|
signUp: (loginId: string, password: string, user?: {
|
|
1203
1311
|
email?: string;
|
|
@@ -1722,6 +1830,44 @@ declare const useDescope: () => ((({
|
|
|
1722
1830
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
1723
1831
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
1724
1832
|
};
|
|
1833
|
+
notp: {
|
|
1834
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
1835
|
+
customClaims?: Record<string, any>;
|
|
1836
|
+
templateOptions?: {
|
|
1837
|
+
[x: string]: string;
|
|
1838
|
+
};
|
|
1839
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
1840
|
+
pendingRef: string;
|
|
1841
|
+
redirectUrl: string;
|
|
1842
|
+
image: string;
|
|
1843
|
+
}>>;
|
|
1844
|
+
signUp: (loginId?: string, user?: {
|
|
1845
|
+
email?: string;
|
|
1846
|
+
name?: string;
|
|
1847
|
+
givenName?: string;
|
|
1848
|
+
middleName?: string;
|
|
1849
|
+
familyName?: string;
|
|
1850
|
+
phone?: string;
|
|
1851
|
+
}, signUpOptions?: {
|
|
1852
|
+
customClaims?: Record<string, any>;
|
|
1853
|
+
templateOptions?: {
|
|
1854
|
+
[x: string]: string;
|
|
1855
|
+
};
|
|
1856
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
1857
|
+
pendingRef: string;
|
|
1858
|
+
redirectUrl: string;
|
|
1859
|
+
image: string;
|
|
1860
|
+
}>>;
|
|
1861
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
1862
|
+
pendingRef: string;
|
|
1863
|
+
redirectUrl: string;
|
|
1864
|
+
image: string;
|
|
1865
|
+
}>>;
|
|
1866
|
+
waitForSession: (pendingRef: string, config?: {
|
|
1867
|
+
pollingIntervalMs: number;
|
|
1868
|
+
timeoutMs: number;
|
|
1869
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
1870
|
+
};
|
|
1725
1871
|
password: {
|
|
1726
1872
|
signUp: (loginId: string, password: string, user?: {
|
|
1727
1873
|
email?: string;
|
|
@@ -2240,6 +2386,44 @@ declare const useDescope: () => ((({
|
|
|
2240
2386
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
2241
2387
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
2242
2388
|
};
|
|
2389
|
+
notp: {
|
|
2390
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
2391
|
+
customClaims?: Record<string, any>;
|
|
2392
|
+
templateOptions?: {
|
|
2393
|
+
[x: string]: string;
|
|
2394
|
+
};
|
|
2395
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
2396
|
+
pendingRef: string;
|
|
2397
|
+
redirectUrl: string;
|
|
2398
|
+
image: string;
|
|
2399
|
+
}>>;
|
|
2400
|
+
signUp: (loginId?: string, user?: {
|
|
2401
|
+
email?: string;
|
|
2402
|
+
name?: string;
|
|
2403
|
+
givenName?: string;
|
|
2404
|
+
middleName?: string;
|
|
2405
|
+
familyName?: string;
|
|
2406
|
+
phone?: string;
|
|
2407
|
+
}, signUpOptions?: {
|
|
2408
|
+
customClaims?: Record<string, any>;
|
|
2409
|
+
templateOptions?: {
|
|
2410
|
+
[x: string]: string;
|
|
2411
|
+
};
|
|
2412
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
2413
|
+
pendingRef: string;
|
|
2414
|
+
redirectUrl: string;
|
|
2415
|
+
image: string;
|
|
2416
|
+
}>>;
|
|
2417
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
2418
|
+
pendingRef: string;
|
|
2419
|
+
redirectUrl: string;
|
|
2420
|
+
image: string;
|
|
2421
|
+
}>>;
|
|
2422
|
+
waitForSession: (pendingRef: string, config?: {
|
|
2423
|
+
pollingIntervalMs: number;
|
|
2424
|
+
timeoutMs: number;
|
|
2425
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
2426
|
+
};
|
|
2243
2427
|
password: {
|
|
2244
2428
|
signUp: (loginId: string, password: string, user?: {
|
|
2245
2429
|
email?: string;
|
|
@@ -2784,6 +2968,44 @@ declare const getSdk: () => ((({
|
|
|
2784
2968
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
2785
2969
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
2786
2970
|
};
|
|
2971
|
+
notp: {
|
|
2972
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
2973
|
+
customClaims?: Record<string, any>;
|
|
2974
|
+
templateOptions?: {
|
|
2975
|
+
[x: string]: string;
|
|
2976
|
+
};
|
|
2977
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
2978
|
+
pendingRef: string;
|
|
2979
|
+
redirectUrl: string;
|
|
2980
|
+
image: string;
|
|
2981
|
+
}>>;
|
|
2982
|
+
signUp: (loginId?: string, user?: {
|
|
2983
|
+
email?: string;
|
|
2984
|
+
name?: string;
|
|
2985
|
+
givenName?: string;
|
|
2986
|
+
middleName?: string;
|
|
2987
|
+
familyName?: string;
|
|
2988
|
+
phone?: string;
|
|
2989
|
+
}, signUpOptions?: {
|
|
2990
|
+
customClaims?: Record<string, any>;
|
|
2991
|
+
templateOptions?: {
|
|
2992
|
+
[x: string]: string;
|
|
2993
|
+
};
|
|
2994
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
2995
|
+
pendingRef: string;
|
|
2996
|
+
redirectUrl: string;
|
|
2997
|
+
image: string;
|
|
2998
|
+
}>>;
|
|
2999
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
3000
|
+
pendingRef: string;
|
|
3001
|
+
redirectUrl: string;
|
|
3002
|
+
image: string;
|
|
3003
|
+
}>>;
|
|
3004
|
+
waitForSession: (pendingRef: string, config?: {
|
|
3005
|
+
pollingIntervalMs: number;
|
|
3006
|
+
timeoutMs: number;
|
|
3007
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
3008
|
+
};
|
|
2787
3009
|
password: {
|
|
2788
3010
|
signUp: (loginId: string, password: string, user?: {
|
|
2789
3011
|
email?: string;
|
|
@@ -3302,6 +3524,44 @@ declare const getSdk: () => ((({
|
|
|
3302
3524
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
3303
3525
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
3304
3526
|
};
|
|
3527
|
+
notp: {
|
|
3528
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
3529
|
+
customClaims?: Record<string, any>;
|
|
3530
|
+
templateOptions?: {
|
|
3531
|
+
[x: string]: string;
|
|
3532
|
+
};
|
|
3533
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
3534
|
+
pendingRef: string;
|
|
3535
|
+
redirectUrl: string;
|
|
3536
|
+
image: string;
|
|
3537
|
+
}>>;
|
|
3538
|
+
signUp: (loginId?: string, user?: {
|
|
3539
|
+
email?: string;
|
|
3540
|
+
name?: string;
|
|
3541
|
+
givenName?: string;
|
|
3542
|
+
middleName?: string;
|
|
3543
|
+
familyName?: string;
|
|
3544
|
+
phone?: string;
|
|
3545
|
+
}, signUpOptions?: {
|
|
3546
|
+
customClaims?: Record<string, any>;
|
|
3547
|
+
templateOptions?: {
|
|
3548
|
+
[x: string]: string;
|
|
3549
|
+
};
|
|
3550
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
3551
|
+
pendingRef: string;
|
|
3552
|
+
redirectUrl: string;
|
|
3553
|
+
image: string;
|
|
3554
|
+
}>>;
|
|
3555
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
3556
|
+
pendingRef: string;
|
|
3557
|
+
redirectUrl: string;
|
|
3558
|
+
image: string;
|
|
3559
|
+
}>>;
|
|
3560
|
+
waitForSession: (pendingRef: string, config?: {
|
|
3561
|
+
pollingIntervalMs: number;
|
|
3562
|
+
timeoutMs: number;
|
|
3563
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
3564
|
+
};
|
|
3305
3565
|
password: {
|
|
3306
3566
|
signUp: (loginId: string, password: string, user?: {
|
|
3307
3567
|
email?: string;
|
|
@@ -3826,6 +4086,44 @@ declare const getSdk: () => ((({
|
|
|
3826
4086
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
3827
4087
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
3828
4088
|
};
|
|
4089
|
+
notp: {
|
|
4090
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
4091
|
+
customClaims?: Record<string, any>;
|
|
4092
|
+
templateOptions?: {
|
|
4093
|
+
[x: string]: string;
|
|
4094
|
+
};
|
|
4095
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
4096
|
+
pendingRef: string;
|
|
4097
|
+
redirectUrl: string;
|
|
4098
|
+
image: string;
|
|
4099
|
+
}>>;
|
|
4100
|
+
signUp: (loginId?: string, user?: {
|
|
4101
|
+
email?: string;
|
|
4102
|
+
name?: string;
|
|
4103
|
+
givenName?: string;
|
|
4104
|
+
middleName?: string;
|
|
4105
|
+
familyName?: string;
|
|
4106
|
+
phone?: string;
|
|
4107
|
+
}, signUpOptions?: {
|
|
4108
|
+
customClaims?: Record<string, any>;
|
|
4109
|
+
templateOptions?: {
|
|
4110
|
+
[x: string]: string;
|
|
4111
|
+
};
|
|
4112
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
4113
|
+
pendingRef: string;
|
|
4114
|
+
redirectUrl: string;
|
|
4115
|
+
image: string;
|
|
4116
|
+
}>>;
|
|
4117
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
4118
|
+
pendingRef: string;
|
|
4119
|
+
redirectUrl: string;
|
|
4120
|
+
image: string;
|
|
4121
|
+
}>>;
|
|
4122
|
+
waitForSession: (pendingRef: string, config?: {
|
|
4123
|
+
pollingIntervalMs: number;
|
|
4124
|
+
timeoutMs: number;
|
|
4125
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
4126
|
+
};
|
|
3829
4127
|
password: {
|
|
3830
4128
|
signUp: (loginId: string, password: string, user?: {
|
|
3831
4129
|
email?: string;
|
|
@@ -4344,6 +4642,44 @@ declare const getSdk: () => ((({
|
|
|
4344
4642
|
verify: (loginId: string, code: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
4345
4643
|
update: (loginId: string, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.TOTPResponse>>;
|
|
4346
4644
|
};
|
|
4645
|
+
notp: {
|
|
4646
|
+
signUpOrIn: (loginId?: string, signUpOptions?: {
|
|
4647
|
+
customClaims?: Record<string, any>;
|
|
4648
|
+
templateOptions?: {
|
|
4649
|
+
[x: string]: string;
|
|
4650
|
+
};
|
|
4651
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
4652
|
+
pendingRef: string;
|
|
4653
|
+
redirectUrl: string;
|
|
4654
|
+
image: string;
|
|
4655
|
+
}>>;
|
|
4656
|
+
signUp: (loginId?: string, user?: {
|
|
4657
|
+
email?: string;
|
|
4658
|
+
name?: string;
|
|
4659
|
+
givenName?: string;
|
|
4660
|
+
middleName?: string;
|
|
4661
|
+
familyName?: string;
|
|
4662
|
+
phone?: string;
|
|
4663
|
+
}, signUpOptions?: {
|
|
4664
|
+
customClaims?: Record<string, any>;
|
|
4665
|
+
templateOptions?: {
|
|
4666
|
+
[x: string]: string;
|
|
4667
|
+
};
|
|
4668
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
4669
|
+
pendingRef: string;
|
|
4670
|
+
redirectUrl: string;
|
|
4671
|
+
image: string;
|
|
4672
|
+
}>>;
|
|
4673
|
+
signIn: (loginId?: string, loginOptions?: _descope_core_js_sdk.LoginOptions, token?: string) => Promise<_descope_core_js_sdk.SdkResponse<{
|
|
4674
|
+
pendingRef: string;
|
|
4675
|
+
redirectUrl: string;
|
|
4676
|
+
image: string;
|
|
4677
|
+
}>>;
|
|
4678
|
+
waitForSession: (pendingRef: string, config?: {
|
|
4679
|
+
pollingIntervalMs: number;
|
|
4680
|
+
timeoutMs: number;
|
|
4681
|
+
}) => Promise<_descope_core_js_sdk.SdkResponse<_descope_core_js_sdk.JWTResponse>>;
|
|
4682
|
+
};
|
|
4347
4683
|
password: {
|
|
4348
4684
|
signUp: (loginId: string, password: string, user?: {
|
|
4349
4685
|
email?: string;
|
|
@@ -4437,5 +4773,5 @@ declare const isRefreshTokenExpired: (token?: string) => boolean;
|
|
|
4437
4773
|
declare const getJwtPermissions: (token?: any, tenant?: string) => string[];
|
|
4438
4774
|
declare const getJwtRoles: (token?: any, tenant?: string) => string[];
|
|
4439
4775
|
|
|
4440
|
-
export { _default$
|
|
4776
|
+
export { _default$3 as AccessKeyManagement, _default$2 as AuditManagement, _default$6 as Descope, _default$4 as RoleManagement, _default$5 as UserManagement, _default$1 as UserProfile, _default as default, getJwtPermissions, getJwtRoles, getRefreshToken, getSdk, getSessionToken, isRefreshTokenExpired, isSessionTokenExpired, routeGuard, useDescope, useSession, useUser };
|
|
4441
4777
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{computed as e,watch as t,inject as
|
|
1
|
+
import{computed as e,watch as t,inject as s,defineComponent as r,openBlock as n,createElementBlock as o,createElementVNode as i,unref as a,ref as d,readonly as u}from"vue";import l 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";import"@descope/audit-management-widget";import"@descope/user-profile-widget";const p=Symbol("$descope"),g={"x-descope-sdk-name":"vue","x-descope-sdk-version":"2.0.13"},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},h=()=>y().options,b=()=>y().sdk,f=()=>{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))}},w=()=>{const{user:s,session:r}=y(),n=()=>{!s.user.value&&r.session.value&&s.fetchUser()};return n(),t(r.session,n),{isLoading:e((()=>s.isLoading.value||s.isFetchUserWasNeverCalled.value)),user:s.user}},v=e=>(...t)=>{let s;try{s=e(...t)}catch(e){console.error(e)}return s};let S;const _=e=>{const t=c({persistTokens:m,storeLastAuthenticatedUser:m,...e,autoRefresh:m});return S=t,t};S=_({projectId:"temp pid"});const j=()=>m?S?.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),k=()=>m?S?.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),U=(e=j())=>S?.isJwtExpired(e),I=(e=k())=>S?.isJwtExpired(e),R=v(((e=j(),t)=>S?.getJwtPermissions(e,t))),q=v(((e=j(),t)=>S?.getJwtRoles(e,t))),M=["project-id","base-url","flow-id","^theme","^locale","^tenant","^debug","^telemetryKey","redirect-url","auto-focus","store-last-authenticated-user",".errorTransformer","^form","^client"];var T=r({__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 r=t;l.sdkConfigOverrides={baseHeaders:g,persistTokens:!1,hooks:{get beforeRequest(){return S.httpClient.hooks.beforeRequest},set beforeRequest(e){}}};const{projectId:d,baseUrl:u,storeLastAuthenticatedUser:c}=h(),p=b(),m=e((()=>r.form?JSON.stringify(r.form):"")),y=e((()=>r.client?JSON.stringify(r.client):"")),f=async e=>{await(p.httpClient.hooks?.afterRequest?.({},new Response(JSON.stringify(e.detail)))),s("success",e)},w=e=>s("error",e),v=e=>s("ready",e);return(e,s)=>(n(),o("div",null,[i("descope-wc",{"project-id":a(d),"base-url":a(u),"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,"store-last-authenticated-user":a(c),".errorTransformer":t.errorTransformer,"^form":a(m),"^client":a(y),onSuccess:f,onError:w,onReady:v},null,40,M)]))}});T.__file="src/Descope.vue";const C=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var A=r({__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}=h();return(r,d)=>(n(),o("div",null,[i("descope-user-management-widget",{"project-id":a(t),"base-url":a(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,C)]))}});A.__file="src/UserManagement.vue";const L=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var F=r({__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}=h();return(r,d)=>(n(),o("div",null,[i("descope-role-management-widget",{"project-id":a(t),"base-url":a(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,L)]))}});F.__file="src/RoleManagement.vue";const N=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var B=r({__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}=h();return(r,d)=>(n(),o("div",null,[i("descope-access-key-management-widget",{"project-id":a(t),"base-url":a(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,N)]))}});B.__file="src/AccessKeyManagement.vue";const J=["project-id","base-url","^theme","^tenant","^debug","widget-id"];var K=r({__name:"AuditManagement",props:{tenant:{type:String,required:!0},widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},setup(e){const{projectId:t,baseUrl:s}=h();return(r,d)=>(n(),o("div",null,[i("descope-audit-management-widget",{"project-id":a(t),"base-url":a(s),"^theme":e.theme,"^tenant":e.tenant,"^debug":e.debug,"widget-id":e.widgetId},null,8,J)]))}});K.__file="src/AuditManagement.vue";const x=["project-id","base-url","^theme","^debug","widget-id"];var O=r({__name:"UserProfile",props:{widgetId:{type:String,required:!0},theme:{type:String},debug:{type:Boolean}},emits:["logout"],setup(e,{emit:t}){const s=e=>t("logout",e),{projectId:r,baseUrl:d}=h();return(t,u)=>(n(),o("div",null,[i("descope-user-profile-widget",{"project-id":a(r),"base-url":a(d),"^theme":e.theme,"^debug":e.debug,"widget-id":e.widgetId,onLogout:s},null,40,x)]))}});O.__file="src/UserProfile.vue";const D=d(null),P=()=>a(D)?.();let W;const E=()=>W;var G={install:function(s,r){const n=_({persistTokens:!0,...r,autoRefresh:!0,baseHeaders:g});W=n;const o=d(null),i=d(""),l=d(null),c=d(null);n.onSessionTokenChange((e=>{i.value=e})),n.onUserChange((e=>{c.value=e}));const m=async()=>{o.value=!0,await n.refresh(),o.value=!1},y=e((()=>null===o.value)),h=e((()=>null===l.value));D.value=()=>new Promise(((e,s)=>{!i.value&&y.value&&m().catch(s),t((()=>o.value),(()=>!o.value&&e(!!a(i))),{immediate:!0})})),s.provide(p,{session:{fetchSession:m,isLoading:u(o),session:u(i),isFetchSessionWasNeverCalled:y},user:{fetchUser:async()=>{l.value=!0,await n.me(),l.value=!1},isLoading:u(l),user:u(c),isFetchUserWasNeverCalled:h},sdk:n,options:r})}};export{B as AccessKeyManagement,K as AuditManagement,T as Descope,F as RoleManagement,A as UserManagement,O as UserProfile,G as default,R as getJwtPermissions,q as getJwtRoles,k as getRefreshToken,E as getSdk,j as getSessionToken,I as isRefreshTokenExpired,U as isSessionTokenExpired,P as routeGuard,b as useDescope,f as useSession,w 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.13",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -37,11 +37,12 @@
|
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@descope/access-key-management-widget": "0.1.
|
|
41
|
-
"@descope/audit-management-widget": "0.1.
|
|
42
|
-
"@descope/role-management-widget": "0.1.
|
|
43
|
-
"@descope/user-management-widget": "0.4.
|
|
44
|
-
"@descope/
|
|
40
|
+
"@descope/access-key-management-widget": "0.1.47",
|
|
41
|
+
"@descope/audit-management-widget": "0.1.10",
|
|
42
|
+
"@descope/role-management-widget": "0.1.45",
|
|
43
|
+
"@descope/user-management-widget": "0.4.47",
|
|
44
|
+
"@descope/user-profile-widget": "0.0.11",
|
|
45
|
+
"@descope/web-component": "3.11.5"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"vue": ">=3"
|