@stytch/nextjs 2.0.1 → 2.0.2
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/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/dist/b2b/index.d.ts +0 -119
- package/dist/b2b/index.esm.d.ts +0 -119
- package/dist/b2b/index.esm.js +0 -949
- package/dist/b2b/index.js +0 -964
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/nextjs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Stytch's official Next.js Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"author": "Stytch",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/runtime": "7.18.6",
|
|
24
|
-
"@stytch/vanilla-js": "0.10.
|
|
24
|
+
"@stytch/vanilla-js": "0.10.6",
|
|
25
25
|
"@testing-library/react": "12.1.3",
|
|
26
26
|
"eslint-config-custom": "0.0.0",
|
|
27
27
|
"rollup": "2.56.3",
|
|
28
28
|
"typescript": "4.7.4"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@stytch/vanilla-js": "^0.10.
|
|
31
|
+
"@stytch/vanilla-js": "^0.10.6",
|
|
32
32
|
"react": ">= 17.0.2",
|
|
33
33
|
"react-dom": ">= 17.0.2"
|
|
34
34
|
},
|
package/dist/b2b/index.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import { StytchB2BHeadlessClient, Member, MemberSession } from "@stytch/vanilla-js/b2b/";
|
|
5
|
-
import { StytchB2BHeadlessClient as StytchB2BHeadlessClient$0 } from "@stytch/vanilla-js/b2b";
|
|
6
|
-
/**
|
|
7
|
-
* The Stytch Client object passed in to <StytchProvider /> in your `_app.js`.
|
|
8
|
-
* Either a StytchUIClient or StytchHeadlessClient.
|
|
9
|
-
*/
|
|
10
|
-
type StytchB2BClient = StytchB2BHeadlessClient;
|
|
11
|
-
type SWRMember = {
|
|
12
|
-
member: null;
|
|
13
|
-
fromCache: false;
|
|
14
|
-
isInitialized: false;
|
|
15
|
-
} | {
|
|
16
|
-
member: Member | null;
|
|
17
|
-
fromCache: boolean;
|
|
18
|
-
isInitialized: true;
|
|
19
|
-
};
|
|
20
|
-
type SWRMemberSession = {
|
|
21
|
-
session: null;
|
|
22
|
-
fromCache: false;
|
|
23
|
-
isInitialized: false;
|
|
24
|
-
} | {
|
|
25
|
-
session: MemberSession | null;
|
|
26
|
-
fromCache: boolean;
|
|
27
|
-
isInitialized: true;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Returns the active member.
|
|
31
|
-
* The Stytch SDKs are used for client-side authentication and session management.
|
|
32
|
-
* Check the isInitialized property to determine if the SDK has completed initialization.
|
|
33
|
-
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
34
|
-
* See Next's {@link https://nextjs.org/docs/authentication#authenticating-statically-generated-pages documentation} for more.
|
|
35
|
-
* @example
|
|
36
|
-
* const {member, isInitialized, fromCache} = useStytchMember();
|
|
37
|
-
* if (!isInitialized) {
|
|
38
|
-
* return <p>Loading...</p>;
|
|
39
|
-
* }
|
|
40
|
-
* return (<h1>Welcome, {member.name}</h1>);
|
|
41
|
-
*/
|
|
42
|
-
declare const useStytchMember: () => SWRMember;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the member's active Stytch member session.
|
|
45
|
-
* The Stytch SDKs are used for client-side authentication and session management.
|
|
46
|
-
* Check the isInitialized property to determine if the SDK has completed initialization.
|
|
47
|
-
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
48
|
-
* See Next's {@link https://nextjs.org/docs/authentication#authenticating-statically-generated-pages documentation} for more.
|
|
49
|
-
* @example
|
|
50
|
-
* const {session, isInitialized, fromCache} = useStytchMemberSession();
|
|
51
|
-
* useEffect(() => {
|
|
52
|
-
* if (!isInitialized) {
|
|
53
|
-
* return;
|
|
54
|
-
* }
|
|
55
|
-
* if (!session) {
|
|
56
|
-
* router.replace('/login')
|
|
57
|
-
* }
|
|
58
|
-
* }, [session, isInitialized]);
|
|
59
|
-
*/
|
|
60
|
-
declare const useStytchMemberSession: () => SWRMemberSession;
|
|
61
|
-
/**
|
|
62
|
-
* Returns the Stytch client stored in the Stytch context.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* const stytch = useStytch();
|
|
66
|
-
* useEffect(() => {
|
|
67
|
-
* stytch.magicLinks.authenticate('...')
|
|
68
|
-
* }, [stytch]);
|
|
69
|
-
*/
|
|
70
|
-
declare const useStytchB2BClient: () => StytchB2BClient;
|
|
71
|
-
declare const withStytchB2BClient: <T extends object>(Component: React.ComponentType<T & {
|
|
72
|
-
stytch: StytchB2BClient;
|
|
73
|
-
}>) => React.ComponentType<T>;
|
|
74
|
-
declare const withStytchMember: <T extends object>(Component: React.ComponentType<T & {
|
|
75
|
-
stytchMember: Member | null;
|
|
76
|
-
stytchMemberIsInitialized: boolean;
|
|
77
|
-
stytchMemberIsFromCache: boolean;
|
|
78
|
-
}>) => React.ComponentType<T>;
|
|
79
|
-
declare const withStytchMemberSession: <T extends object>(Component: React.ComponentType<T & {
|
|
80
|
-
stytchMemberSession: MemberSession | null;
|
|
81
|
-
stytchMemberSessionIsInitialized: boolean;
|
|
82
|
-
stytchMemberSessionIsFromCache: boolean;
|
|
83
|
-
}>) => React.ComponentType<T>;
|
|
84
|
-
interface StytchB2BProviderProps {
|
|
85
|
-
/**
|
|
86
|
-
* A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
|
|
87
|
-
*/
|
|
88
|
-
stytch: StytchB2BClient;
|
|
89
|
-
children?: ReactNode;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* The Stytch Context Provider.
|
|
93
|
-
* Wrap your application with this component in `_app.js` in order to use Stytch everywhere in your app.
|
|
94
|
-
* @example
|
|
95
|
-
* const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
96
|
-
*
|
|
97
|
-
* return (
|
|
98
|
-
* <StytchB2BProvider stytch={stytch}>
|
|
99
|
-
* <App />
|
|
100
|
-
* </StytchB2BProvider>
|
|
101
|
-
* )
|
|
102
|
-
*/
|
|
103
|
-
declare const StytchB2BProvider: ({ stytch, children }: StytchB2BProviderProps) => JSX.Element;
|
|
104
|
-
/**
|
|
105
|
-
* Creates a Headless Stytch client object to call the stytch B2B APIs.
|
|
106
|
-
* The Stytch client is not available serverside.
|
|
107
|
-
* @example
|
|
108
|
-
* const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
109
|
-
*
|
|
110
|
-
* return (
|
|
111
|
-
* <StytchB2BProvider stytch={stytch}>
|
|
112
|
-
* <App />
|
|
113
|
-
* </StytchB2BProvider>
|
|
114
|
-
* )
|
|
115
|
-
* @returns A {@link StytchHeadlessClient}
|
|
116
|
-
*/
|
|
117
|
-
declare const createStytchB2BHeadlessClient: (_PUBLIC_TOKEN: string, options?: import("core/dist/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient$0;
|
|
118
|
-
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, withStytchB2BClient, withStytchMemberSession, withStytchMember, createStytchB2BHeadlessClient };
|
|
119
|
-
export type { StytchB2BProviderProps };
|
package/dist/b2b/index.esm.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import { StytchB2BHeadlessClient, Member, MemberSession } from "@stytch/vanilla-js/b2b/";
|
|
5
|
-
import { StytchB2BHeadlessClient as StytchB2BHeadlessClient$0 } from "@stytch/vanilla-js/b2b";
|
|
6
|
-
/**
|
|
7
|
-
* The Stytch Client object passed in to <StytchProvider /> in your `_app.js`.
|
|
8
|
-
* Either a StytchUIClient or StytchHeadlessClient.
|
|
9
|
-
*/
|
|
10
|
-
type StytchB2BClient = StytchB2BHeadlessClient;
|
|
11
|
-
type SWRMember = {
|
|
12
|
-
member: null;
|
|
13
|
-
fromCache: false;
|
|
14
|
-
isInitialized: false;
|
|
15
|
-
} | {
|
|
16
|
-
member: Member | null;
|
|
17
|
-
fromCache: boolean;
|
|
18
|
-
isInitialized: true;
|
|
19
|
-
};
|
|
20
|
-
type SWRMemberSession = {
|
|
21
|
-
session: null;
|
|
22
|
-
fromCache: false;
|
|
23
|
-
isInitialized: false;
|
|
24
|
-
} | {
|
|
25
|
-
session: MemberSession | null;
|
|
26
|
-
fromCache: boolean;
|
|
27
|
-
isInitialized: true;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Returns the active member.
|
|
31
|
-
* The Stytch SDKs are used for client-side authentication and session management.
|
|
32
|
-
* Check the isInitialized property to determine if the SDK has completed initialization.
|
|
33
|
-
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
34
|
-
* See Next's {@link https://nextjs.org/docs/authentication#authenticating-statically-generated-pages documentation} for more.
|
|
35
|
-
* @example
|
|
36
|
-
* const {member, isInitialized, fromCache} = useStytchMember();
|
|
37
|
-
* if (!isInitialized) {
|
|
38
|
-
* return <p>Loading...</p>;
|
|
39
|
-
* }
|
|
40
|
-
* return (<h1>Welcome, {member.name}</h1>);
|
|
41
|
-
*/
|
|
42
|
-
declare const useStytchMember: () => SWRMember;
|
|
43
|
-
/**
|
|
44
|
-
* Returns the member's active Stytch member session.
|
|
45
|
-
* The Stytch SDKs are used for client-side authentication and session management.
|
|
46
|
-
* Check the isInitialized property to determine if the SDK has completed initialization.
|
|
47
|
-
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
48
|
-
* See Next's {@link https://nextjs.org/docs/authentication#authenticating-statically-generated-pages documentation} for more.
|
|
49
|
-
* @example
|
|
50
|
-
* const {session, isInitialized, fromCache} = useStytchMemberSession();
|
|
51
|
-
* useEffect(() => {
|
|
52
|
-
* if (!isInitialized) {
|
|
53
|
-
* return;
|
|
54
|
-
* }
|
|
55
|
-
* if (!session) {
|
|
56
|
-
* router.replace('/login')
|
|
57
|
-
* }
|
|
58
|
-
* }, [session, isInitialized]);
|
|
59
|
-
*/
|
|
60
|
-
declare const useStytchMemberSession: () => SWRMemberSession;
|
|
61
|
-
/**
|
|
62
|
-
* Returns the Stytch client stored in the Stytch context.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* const stytch = useStytch();
|
|
66
|
-
* useEffect(() => {
|
|
67
|
-
* stytch.magicLinks.authenticate('...')
|
|
68
|
-
* }, [stytch]);
|
|
69
|
-
*/
|
|
70
|
-
declare const useStytchB2BClient: () => StytchB2BClient;
|
|
71
|
-
declare const withStytchB2BClient: <T extends object>(Component: React.ComponentType<T & {
|
|
72
|
-
stytch: StytchB2BClient;
|
|
73
|
-
}>) => React.ComponentType<T>;
|
|
74
|
-
declare const withStytchMember: <T extends object>(Component: React.ComponentType<T & {
|
|
75
|
-
stytchMember: Member | null;
|
|
76
|
-
stytchMemberIsInitialized: boolean;
|
|
77
|
-
stytchMemberIsFromCache: boolean;
|
|
78
|
-
}>) => React.ComponentType<T>;
|
|
79
|
-
declare const withStytchMemberSession: <T extends object>(Component: React.ComponentType<T & {
|
|
80
|
-
stytchMemberSession: MemberSession | null;
|
|
81
|
-
stytchMemberSessionIsInitialized: boolean;
|
|
82
|
-
stytchMemberSessionIsFromCache: boolean;
|
|
83
|
-
}>) => React.ComponentType<T>;
|
|
84
|
-
interface StytchB2BProviderProps {
|
|
85
|
-
/**
|
|
86
|
-
* A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
|
|
87
|
-
*/
|
|
88
|
-
stytch: StytchB2BClient;
|
|
89
|
-
children?: ReactNode;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* The Stytch Context Provider.
|
|
93
|
-
* Wrap your application with this component in `_app.js` in order to use Stytch everywhere in your app.
|
|
94
|
-
* @example
|
|
95
|
-
* const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
96
|
-
*
|
|
97
|
-
* return (
|
|
98
|
-
* <StytchB2BProvider stytch={stytch}>
|
|
99
|
-
* <App />
|
|
100
|
-
* </StytchB2BProvider>
|
|
101
|
-
* )
|
|
102
|
-
*/
|
|
103
|
-
declare const StytchB2BProvider: ({ stytch, children }: StytchB2BProviderProps) => JSX.Element;
|
|
104
|
-
/**
|
|
105
|
-
* Creates a Headless Stytch client object to call the stytch B2B APIs.
|
|
106
|
-
* The Stytch client is not available serverside.
|
|
107
|
-
* @example
|
|
108
|
-
* const stytch = createStytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
109
|
-
*
|
|
110
|
-
* return (
|
|
111
|
-
* <StytchB2BProvider stytch={stytch}>
|
|
112
|
-
* <App />
|
|
113
|
-
* </StytchB2BProvider>
|
|
114
|
-
* )
|
|
115
|
-
* @returns A {@link StytchHeadlessClient}
|
|
116
|
-
*/
|
|
117
|
-
declare const createStytchB2BHeadlessClient: (_PUBLIC_TOKEN: string, options?: import("core/dist/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient$0;
|
|
118
|
-
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, withStytchB2BClient, withStytchMemberSession, withStytchMember, createStytchB2BHeadlessClient };
|
|
119
|
-
export type { StytchB2BProviderProps };
|