@descope/nextjs-sdk 0.0.6 → 0.0.9
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 +59 -3
- package/dist/client/dts/src/client/index.d.ts +1 -1
- package/dist/client/dts/src/shared/DescopeWidgets.d.ts +16 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/dts/src/client/index.d.ts +1 -1
- package/dist/dts/src/shared/DescopeWidgets.d.ts +16 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +1 -1
- package/dist/server/constants.js +1 -1
- package/dist/server/dts/src/client/index.d.ts +1 -1
- package/dist/server/dts/src/shared/DescopeWidgets.d.ts +16 -0
- package/dist/shared/DescopeWidgets.js +4 -2
- package/dist/shared/DescopeWidgets.js.map +1 -1
- package/dist/shared/constants.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -322,15 +322,71 @@ The widget lets you:
|
|
|
322
322
|
|
|
323
323
|
```js
|
|
324
324
|
import { AccessKeyManagement } from '@descope/nextjs-sdk';
|
|
325
|
+
{
|
|
326
|
+
/* admin view: manage all tenant users' access keys */
|
|
327
|
+
}
|
|
328
|
+
<AccessKeyManagement
|
|
329
|
+
widgetId="access-key-management-widget"
|
|
330
|
+
tenant="tenant-id"
|
|
331
|
+
/>;
|
|
332
|
+
|
|
333
|
+
{
|
|
334
|
+
/* user view: mange access key for the logged-in tenant's user */
|
|
335
|
+
}
|
|
336
|
+
<AccessKeyManagement
|
|
337
|
+
widgetId="user-access-key-management-widget"
|
|
338
|
+
tenant="tenant-id"
|
|
339
|
+
/>;
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Example:
|
|
343
|
+
[Manage Access Keys](./examples/app-router/app/manage-access-keys/page.tsx)
|
|
344
|
+
|
|
345
|
+
#### Audit Management
|
|
346
|
+
|
|
347
|
+
The `AuditManagement` widget will let you embed an audit table in your site.
|
|
348
|
+
|
|
349
|
+
###### Usage
|
|
350
|
+
|
|
351
|
+
```js
|
|
352
|
+
import { AuditManagement } from '@descope/nextjs-sdk';
|
|
325
353
|
...
|
|
326
|
-
<
|
|
327
|
-
widgetId="
|
|
354
|
+
<AuditManagement
|
|
355
|
+
widgetId="audit-management-widget"
|
|
328
356
|
tenant="tenant-id"
|
|
329
357
|
/>
|
|
330
358
|
```
|
|
331
359
|
|
|
332
360
|
Example:
|
|
333
|
-
[Manage
|
|
361
|
+
[Manage Audit](./examples/app-router/app/manage-audit/page.tsx)
|
|
362
|
+
|
|
363
|
+
#### User Profile
|
|
364
|
+
|
|
365
|
+
The `UserProfile` widget lets you embed a user profile component in your app and let the logged in user update his profile.
|
|
366
|
+
|
|
367
|
+
The widget lets you:
|
|
368
|
+
|
|
369
|
+
- Update user profile picture
|
|
370
|
+
- Update user personal information
|
|
371
|
+
- Update authentication methods
|
|
372
|
+
- Logout
|
|
373
|
+
|
|
374
|
+
###### Usage
|
|
375
|
+
|
|
376
|
+
```js
|
|
377
|
+
import { UserProfile } from '@descope/nextjs-sdk';
|
|
378
|
+
...
|
|
379
|
+
<UserProfile
|
|
380
|
+
widgetId="user-profile-widget"
|
|
381
|
+
onLogout={() => {
|
|
382
|
+
// add here you own logout callback
|
|
383
|
+
window.location.href = '/login';
|
|
384
|
+
}}
|
|
385
|
+
/>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Example:
|
|
389
|
+
[User Profile](./examples/app-router/app/my-user-profile/page.tsx)
|
|
334
390
|
|
|
335
391
|
## Code Example
|
|
336
392
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
1
|
+
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, isSessionTokenExpired, isRefreshTokenExpired, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
@@ -20,3 +20,19 @@ export declare const AccessKeyManagement: ComponentType<{
|
|
|
20
20
|
theme?: import("@descope/web-component").ThemeOptions;
|
|
21
21
|
debug?: boolean;
|
|
22
22
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
23
|
+
export declare const AuditManagement: ComponentType<{
|
|
24
|
+
logger?: import("@descope/web-component").ILogger;
|
|
25
|
+
tenant: string;
|
|
26
|
+
widgetId: string;
|
|
27
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
28
|
+
debug?: boolean;
|
|
29
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
30
|
+
export declare const UserProfile: ComponentType<Omit<{
|
|
31
|
+
logger?: import("@descope/web-component").ILogger;
|
|
32
|
+
tenant: string;
|
|
33
|
+
widgetId: string;
|
|
34
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
35
|
+
debug?: boolean;
|
|
36
|
+
}, "tenant"> & {
|
|
37
|
+
onLogout?: (e: CustomEvent<any>) => void;
|
|
38
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getJwtPermissions, getJwtRoles, getRefreshToken, getSessionToken, refresh, useDescope, useSession, useUser } from '@descope/react-sdk';
|
|
1
|
+
export { getJwtPermissions, getJwtRoles, getRefreshToken, getSessionToken, isRefreshTokenExpired, isSessionTokenExpired, refresh, useDescope, useSession, useUser } from '@descope/react-sdk';
|
package/dist/client/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { getJwtPermissions, getJwtRoles, getRefreshToken, getSessionToken, refresh, useDescope, useSession, useUser } from '@descope/react-sdk';
|
|
2
|
+
export { getJwtPermissions, getJwtRoles, getRefreshToken, getSessionToken, isRefreshTokenExpired, isSessionTokenExpired, refresh, useDescope, useSession, useUser } from '@descope/react-sdk';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
1
|
+
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, isSessionTokenExpired, isRefreshTokenExpired, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
@@ -20,3 +20,19 @@ export declare const AccessKeyManagement: ComponentType<{
|
|
|
20
20
|
theme?: import("@descope/web-component").ThemeOptions;
|
|
21
21
|
debug?: boolean;
|
|
22
22
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
23
|
+
export declare const AuditManagement: ComponentType<{
|
|
24
|
+
logger?: import("@descope/web-component").ILogger;
|
|
25
|
+
tenant: string;
|
|
26
|
+
widgetId: string;
|
|
27
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
28
|
+
debug?: boolean;
|
|
29
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
30
|
+
export declare const UserProfile: ComponentType<Omit<{
|
|
31
|
+
logger?: import("@descope/web-component").ILogger;
|
|
32
|
+
tenant: string;
|
|
33
|
+
widgetId: string;
|
|
34
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
35
|
+
debug?: boolean;
|
|
36
|
+
}, "tenant"> & {
|
|
37
|
+
onLogout?: (e: CustomEvent<any>) => void;
|
|
38
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -189,5 +189,21 @@ declare const AccessKeyManagement: ComponentType<{
|
|
|
189
189
|
theme?: _descope_web_component.ThemeOptions;
|
|
190
190
|
debug?: boolean;
|
|
191
191
|
} & React.RefAttributes<HTMLElement>>;
|
|
192
|
+
declare const AuditManagement: ComponentType<{
|
|
193
|
+
logger?: _descope_web_component.ILogger;
|
|
194
|
+
tenant: string;
|
|
195
|
+
widgetId: string;
|
|
196
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
197
|
+
debug?: boolean;
|
|
198
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
199
|
+
declare const UserProfile: ComponentType<Omit<{
|
|
200
|
+
logger?: _descope_web_component.ILogger;
|
|
201
|
+
tenant: string;
|
|
202
|
+
widgetId: string;
|
|
203
|
+
theme?: _descope_web_component.ThemeOptions;
|
|
204
|
+
debug?: boolean;
|
|
205
|
+
}, "tenant"> & {
|
|
206
|
+
onLogout?: (e: CustomEvent<any>) => void;
|
|
207
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
192
208
|
|
|
193
|
-
export { AccessKeyManagement, AuthProvider, Descope, RoleManagement, SignInFlow, SignUpFlow, SignUpOrInFlow, UserManagement };
|
|
209
|
+
export { AccessKeyManagement, AuditManagement, AuthProvider, Descope, RoleManagement, SignInFlow, SignUpFlow, SignUpOrInFlow, UserManagement, UserProfile };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as AuthProvider } from './shared/AuthProvider.js';
|
|
2
2
|
export { Descope, SignInFlow, SignUpFlow, SignUpOrInFlow } from './shared/DescopeFlows.js';
|
|
3
|
-
export { AccessKeyManagement, RoleManagement, UserManagement } from './shared/DescopeWidgets.js';
|
|
3
|
+
export { AccessKeyManagement, AuditManagement, RoleManagement, UserManagement, UserProfile } from './shared/DescopeWidgets.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/server/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const DESCOPE_SESSION_HEADER = 'x-descope-session';
|
|
2
2
|
const baseHeaders = {
|
|
3
3
|
'x-descope-sdk-name': 'nextjs',
|
|
4
|
-
'x-descope-sdk-version': "0.0.
|
|
4
|
+
'x-descope-sdk-version': "0.0.9"
|
|
5
5
|
};
|
|
6
6
|
const DEFAULT_PUBLIC_ROUTES = {
|
|
7
7
|
signIn: process.env.SIGN_IN_ROUTE || '/sign-in',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
1
|
+
export { useDescope, useSession, useUser, getSessionToken, getRefreshToken, isSessionTokenExpired, isRefreshTokenExpired, getJwtPermissions, getJwtRoles, refresh } from '@descope/react-sdk';
|
|
@@ -20,3 +20,19 @@ export declare const AccessKeyManagement: ComponentType<{
|
|
|
20
20
|
theme?: import("@descope/web-component").ThemeOptions;
|
|
21
21
|
debug?: boolean;
|
|
22
22
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
23
|
+
export declare const AuditManagement: ComponentType<{
|
|
24
|
+
logger?: import("@descope/web-component").ILogger;
|
|
25
|
+
tenant: string;
|
|
26
|
+
widgetId: string;
|
|
27
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
28
|
+
debug?: boolean;
|
|
29
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
30
|
+
export declare const UserProfile: ComponentType<Omit<{
|
|
31
|
+
logger?: import("@descope/web-component").ILogger;
|
|
32
|
+
tenant: string;
|
|
33
|
+
widgetId: string;
|
|
34
|
+
theme?: import("@descope/web-component").ThemeOptions;
|
|
35
|
+
debug?: boolean;
|
|
36
|
+
}, "tenant"> & {
|
|
37
|
+
onLogout?: (e: CustomEvent<any>) => void;
|
|
38
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import dynamic from 'next/dynamic';
|
|
3
|
-
import { UserManagement as UserManagement$1, RoleManagement as RoleManagement$1, AccessKeyManagement as AccessKeyManagement$1 } from '@descope/react-sdk';
|
|
3
|
+
import { UserManagement as UserManagement$1, RoleManagement as RoleManagement$1, AccessKeyManagement as AccessKeyManagement$1, AuditManagement as AuditManagement$1, UserProfile as UserProfile$1 } from '@descope/react-sdk';
|
|
4
4
|
|
|
5
5
|
// a helper function to dynamically load the components
|
|
6
6
|
// This function prevents Next.js from trying to server-side render these components
|
|
@@ -12,6 +12,8 @@ const dynamicWidgetComponent = (Component) => dynamic(() => Promise.resolve(Comp
|
|
|
12
12
|
const UserManagement = dynamicWidgetComponent(UserManagement$1);
|
|
13
13
|
const RoleManagement = dynamicWidgetComponent(RoleManagement$1);
|
|
14
14
|
const AccessKeyManagement = dynamicWidgetComponent(AccessKeyManagement$1);
|
|
15
|
+
const AuditManagement = dynamicWidgetComponent(AuditManagement$1);
|
|
16
|
+
const UserProfile = dynamicWidgetComponent(UserProfile$1);
|
|
15
17
|
|
|
16
|
-
export { AccessKeyManagement, RoleManagement, UserManagement };
|
|
18
|
+
export { AccessKeyManagement, AuditManagement, RoleManagement, UserManagement, UserProfile };
|
|
17
19
|
//# sourceMappingURL=DescopeWidgets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescopeWidgets.js","sources":["../../src/shared/DescopeWidgets.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentType } from 'react';\nimport dynamic from 'next/dynamic';\nimport {\n\tUserManagement as UserManagementWC,\n\tRoleManagement as RoleManagementWC,\n\tAccessKeyManagement as AccessKeyManagementWC\n} from '@descope/react-sdk';\n\n// a helper function to dynamically load the components\n// This function prevents Next.js from trying to server-side render these components\n// Update the helper function to use generics for preserving component prop types\nconst dynamicWidgetComponent = <P extends {}>(Component: ComponentType<P>) =>\n\tdynamic<P>(() => Promise.resolve(Component), {\n\t\tssr: false // Disable server-side rendering for this component\n\t});\n\n// Use the helper function to create dynamically loaded components\nexport const UserManagement = dynamicWidgetComponent(UserManagementWC);\nexport const RoleManagement = dynamicWidgetComponent(RoleManagementWC);\nexport const AccessKeyManagement = dynamicWidgetComponent(\n\tAccessKeyManagementWC\n);\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"DescopeWidgets.js","sources":["../../src/shared/DescopeWidgets.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentType } from 'react';\nimport dynamic from 'next/dynamic';\nimport {\n\tUserManagement as UserManagementWC,\n\tRoleManagement as RoleManagementWC,\n\tAccessKeyManagement as AccessKeyManagementWC,\n\tAuditManagement as AuditManagementWC,\n\tUserProfile as UserProfileWc\n} from '@descope/react-sdk';\n\n// a helper function to dynamically load the components\n// This function prevents Next.js from trying to server-side render these components\n// Update the helper function to use generics for preserving component prop types\nconst dynamicWidgetComponent = <P extends {}>(Component: ComponentType<P>) =>\n\tdynamic<P>(() => Promise.resolve(Component), {\n\t\tssr: false // Disable server-side rendering for this component\n\t});\n\n// Use the helper function to create dynamically loaded components\nexport const UserManagement = dynamicWidgetComponent(UserManagementWC);\nexport const RoleManagement = dynamicWidgetComponent(RoleManagementWC);\nexport const AccessKeyManagement = dynamicWidgetComponent(\n\tAccessKeyManagementWC\n);\nexport const AuditManagement = dynamicWidgetComponent(AuditManagementWC);\nexport const UserProfile = dynamicWidgetComponent(UserProfileWc);\n"],"names":[],"mappings":";;;;AAYA;AACA;AACA;AACA;;AAGE;AAEF;;;;;;;"}
|
package/dist/shared/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope/nextjs-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Descope NextJS SDK",
|
|
5
5
|
"author": "Descope Team <info@descope.com>",
|
|
6
6
|
"homepage": "https://github.com/descope/nextjs-sdk",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
]
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@descope/node-sdk": "1.6.
|
|
77
|
-
"@descope/react-sdk": "2.0.
|
|
76
|
+
"@descope/node-sdk": "1.6.8",
|
|
77
|
+
"@descope/react-sdk": "2.0.25"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/core": "7.23.9",
|