@stytch/nextjs 1.2.0 → 2.0.0
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 +11 -0
- package/dist/b2b/index.d.ts +119 -0
- package/dist/b2b/index.esm.d.ts +119 -0
- package/dist/b2b/index.esm.js +946 -0
- package/dist/b2b/index.js +961 -0
- package/dist/index.esm.js +2 -1
- package/dist/index.headless.d.ts +1 -1
- package/dist/index.headless.esm.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.ui.d.ts +1 -1
- package/dist/index.ui.esm.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect, useCallback, createContext, useContext, useMemo, useLayoutEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
const noProviderError = (item) => `${item} can only be used inside
|
|
3
|
+
const noProviderError = (item, provider = 'StytchProvider') => `${item} can only be used inside <${provider}>.`;
|
|
4
4
|
const noHeadlessClientError = `Tried to create a Stytch Login UI element using the Stytch Headless SDK.
|
|
5
5
|
You must use the UI SDK to use UI elements.
|
|
6
6
|
Please make sure you are importing createStytchHeadlessClient from @stytch/nextjs/ui and not from @stytch/nextjs/headless.`;
|
|
@@ -166,6 +166,7 @@ const StytchProvider = ({ stytch, children }) => {
|
|
|
166
166
|
unsubscribeSession();
|
|
167
167
|
};
|
|
168
168
|
}, [stytch, setUser, setSession]);
|
|
169
|
+
// TODO (SDK-813): Remove this when we have a single top-level onChange handler
|
|
169
170
|
const finalSess = !!session.session === !!user.user ? session : initialSession;
|
|
170
171
|
const finalUser = !!session.session === !!user.user ? user : initialUser;
|
|
171
172
|
return (React.createElement(StytchContext.Provider, { value: ctx },
|
package/dist/index.headless.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ import { StytchHeadlessClient } from "@stytch/vanilla-js/headless";
|
|
|
12
12
|
* )
|
|
13
13
|
* @returns A {@link StytchHeadlessClient}
|
|
14
14
|
*/
|
|
15
|
-
declare const createStytchHeadlessClient: (_PUBLIC_TOKEN: string) => StytchHeadlessClient;
|
|
15
|
+
declare const createStytchHeadlessClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/dist/public").StytchClientOptions | undefined) => StytchHeadlessClient;
|
|
16
16
|
export { createStytchHeadlessClient };
|
|
@@ -12,5 +12,5 @@ import { StytchHeadlessClient } from "@stytch/vanilla-js/headless";
|
|
|
12
12
|
* )
|
|
13
13
|
* @returns A {@link StytchHeadlessClient}
|
|
14
14
|
*/
|
|
15
|
-
declare const createStytchHeadlessClient: (_PUBLIC_TOKEN: string) => StytchHeadlessClient;
|
|
15
|
+
declare const createStytchHeadlessClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/dist/public").StytchClientOptions | undefined) => StytchHeadlessClient;
|
|
16
16
|
export { createStytchHeadlessClient };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
const noProviderError = (item) => `${item} can only be used inside
|
|
11
|
+
const noProviderError = (item, provider = 'StytchProvider') => `${item} can only be used inside <${provider}>.`;
|
|
12
12
|
const noHeadlessClientError = `Tried to create a Stytch Login UI element using the Stytch Headless SDK.
|
|
13
13
|
You must use the UI SDK to use UI elements.
|
|
14
14
|
Please make sure you are importing createStytchHeadlessClient from @stytch/nextjs/ui and not from @stytch/nextjs/headless.`;
|
|
@@ -174,6 +174,7 @@ const StytchProvider = ({ stytch, children }) => {
|
|
|
174
174
|
unsubscribeSession();
|
|
175
175
|
};
|
|
176
176
|
}, [stytch, setUser, setSession]);
|
|
177
|
+
// TODO (SDK-813): Remove this when we have a single top-level onChange handler
|
|
177
178
|
const finalSess = !!session.session === !!user.user ? session : initialSession;
|
|
178
179
|
const finalUser = !!session.session === !!user.user ? user : initialUser;
|
|
179
180
|
return (React__default['default'].createElement(StytchContext.Provider, { value: ctx },
|
package/dist/index.ui.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ import { StytchUIClient } from "@stytch/vanilla-js";
|
|
|
13
13
|
* )
|
|
14
14
|
* @returns A {@link StytchUIClient}
|
|
15
15
|
*/
|
|
16
|
-
declare const createStytchUIClient: (_PUBLIC_TOKEN: string) => StytchUIClient;
|
|
16
|
+
declare const createStytchUIClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/dist/public").StytchClientOptions | undefined) => StytchUIClient;
|
|
17
17
|
export { createStytchUIClient };
|
package/dist/index.ui.esm.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ import { StytchUIClient } from "@stytch/vanilla-js";
|
|
|
13
13
|
* )
|
|
14
14
|
* @returns A {@link StytchUIClient}
|
|
15
15
|
*/
|
|
16
|
-
declare const createStytchUIClient: (_PUBLIC_TOKEN: string) => StytchUIClient;
|
|
16
|
+
declare const createStytchUIClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/dist/public").StytchClientOptions | undefined) => StytchUIClient;
|
|
17
17
|
export { createStytchUIClient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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.
|
|
24
|
+
"@stytch/vanilla-js": "0.10.0",
|
|
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.
|
|
31
|
+
"@stytch/vanilla-js": "^0.10.0",
|
|
32
32
|
"react": ">= 17.0.2",
|
|
33
33
|
"react-dom": ">= 17.0.2"
|
|
34
34
|
},
|