@stytch/nextjs 21.4.4 → 21.5.1
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 +16 -0
- package/dist/{StytchB2BContext-a27d4ac7.d.ts → StytchB2BContext-1cabb03b.d.ts} +52 -17
- package/dist/{StytchB2BContext-c11ed503.js → StytchB2BContext-1cabb03b.js} +33 -26
- package/dist/{StytchB2BContext-c11ed503.d.ts → StytchB2BContext-f7acf57f.d.ts} +52 -17
- package/dist/{StytchB2BContext-a27d4ac7.js → StytchB2BContext-f7acf57f.js} +32 -25
- package/dist/{StytchSSRProxy-4e34fb34.js → StytchSSRProxy-34c789b5.js} +3 -2
- package/dist/{StytchSSRProxy-c9d3bc41.js → StytchSSRProxy-86bc42b3.js} +3 -1
- package/dist/adminPortal/index.esm.js +3 -3
- package/dist/adminPortal/index.js +3 -3
- package/dist/b2b/index.d.ts +2 -2
- package/dist/b2b/index.esm.d.ts +2 -2
- package/dist/b2b/index.esm.js +4 -5
- package/dist/b2b/index.headless.d.ts +1 -1
- package/dist/b2b/index.headless.esm.d.ts +1 -1
- package/dist/b2b/index.headless.esm.js +1 -1
- package/dist/b2b/index.headless.js +1 -1
- package/dist/b2b/index.js +3 -4
- package/dist/b2b/index.ui.d.ts +1 -1
- package/dist/b2b/index.ui.esm.d.ts +1 -1
- package/dist/b2b/index.ui.esm.js +1 -1
- package/dist/b2b/index.ui.js +1 -1
- package/dist/errors-d9d5fbc8.d.ts +5 -0
- package/dist/index-b14d4efe.d.ts +1 -1
- package/dist/index.d.ts +29 -11
- package/dist/index.esm.d.ts +29 -11
- package/dist/index.esm.js +30 -22
- package/dist/index.headless.d.ts +1 -1
- package/dist/index.headless.esm.d.ts +1 -1
- package/dist/index.headless.esm.js +1 -1
- package/dist/index.headless.js +1 -1
- package/dist/index.js +29 -21
- package/dist/index.ui.d.ts +1 -1
- package/dist/index.ui.esm.d.ts +1 -1
- package/dist/index.ui.esm.js +1 -1
- package/dist/index.ui.js +1 -1
- package/dist/{useIsomorphicLayoutEffect-1babb81e.d.ts → useIsomorphicLayoutEffect-672e4b66.d.ts} +1 -2
- package/dist/{useIsomorphicLayoutEffect-65746ef3.js → useIsomorphicLayoutEffect-672e4b66.js} +0 -1
- package/dist/{useIsomorphicLayoutEffect-65746ef3.d.ts → useIsomorphicLayoutEffect-681e2138.d.ts} +1 -2
- package/dist/{useIsomorphicLayoutEffect-1babb81e.js → useIsomorphicLayoutEffect-681e2138.js} +0 -1
- package/package.json +5 -4
- package/dist/errors-d9d48ed4.d.ts +0 -4
- /package/dist/{StytchSSRProxy-4e34fb34.d.ts → StytchSSRProxy-34c789b5.d.ts} +0 -0
- /package/dist/{StytchSSRProxy-c9d3bc41.d.ts → StytchSSRProxy-86bc42b3.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @stytch/nextjs
|
|
2
2
|
|
|
3
|
+
## 21.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9349a6b: Add error handling for claimed domains in the Discovery flow when no valid organizations are found
|
|
8
|
+
|
|
9
|
+
## 21.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 1e9ab0e: Add a new `assumeHydrated` prop to the `StytchProvider` and `StytchB2BProvider` components. This prop allows the provider to assume whether or not the app might be hydrated in a browser environment after initially being rendered in a server environment. When `true`, the provider eagerly reads from the browser's local cache to retrieve cached session and related data. When `false`, the provider defers this initialization until after the first render, to avoid hydration errors. This prop defaults to `false` in `@stytch/nextjs`, which preserves the behavior from previous versions.
|
|
14
|
+
|
|
15
|
+
We recommend setting `assumeHydrated={false}` if your app hydrates server-rendered content on the client. Otherwise, it is safe to set `assumeHydrated={true}`. If you're unsure or notice hydration errors in your app, set `assumeHydrated={false}`.
|
|
16
|
+
|
|
17
|
+
Unless you set `assumeHydrated={true}`, you should continue to check the initialized state of the provider by checking the `isInitialized` value (returned from hooks like `useStytchUser`, `useStytchSession`, `useStytchMember`, `useStytchMemberSession`, `useStytchOrganization`, and `useStytchIsAuthorized`) or `*IsInitialized` prop (injected by HOCs like `withStytchUser`, `withStytchSession`, `withStytchMember`, `withStytchMemberSession`, and `withStytchOrganization`) before relying on any other values.
|
|
18
|
+
|
|
3
19
|
## 21.4.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
+
import { PermissionsMap } from '@stytch/core/public';
|
|
4
5
|
import { Member, MemberSession, Organization, StytchB2BUIClient } from '@stytch/vanilla-js/b2b';
|
|
5
6
|
import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from '@stytch/vanilla-js/b2b/headless';
|
|
6
|
-
import { PermissionsMap } from '@stytch/core/public';
|
|
7
7
|
/**
|
|
8
8
|
* The Stytch Client object passed in to <StytchB2BProvider /> in your application root.
|
|
9
9
|
* Either a StytchB2BUIClient or StytchB2BHeadlessClient.
|
|
10
10
|
*/
|
|
11
11
|
type StytchB2BClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchB2BHeadlessClient<TProjectConfiguration> | StytchB2BUIClient<TProjectConfiguration>;
|
|
12
|
-
type
|
|
12
|
+
type SWRMemberUninitialized = {
|
|
13
13
|
/**
|
|
14
14
|
* Either the active {@link Member} object, or null if the member is not logged in.
|
|
15
15
|
*/
|
|
@@ -22,7 +22,8 @@ type SWRMember = {
|
|
|
22
22
|
* If true, indicates that the SDK has completed initialization.
|
|
23
23
|
*/
|
|
24
24
|
isInitialized: false;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
|
+
type SWRMemberInitialized = {
|
|
26
27
|
/**
|
|
27
28
|
* Either the active {@link Member} object, or null if the member is not logged in.
|
|
28
29
|
*/
|
|
@@ -36,7 +37,8 @@ type SWRMember = {
|
|
|
36
37
|
*/
|
|
37
38
|
isInitialized: true;
|
|
38
39
|
};
|
|
39
|
-
type
|
|
40
|
+
type SWRMember<TAlwaysInitialized extends boolean = boolean> = TAlwaysInitialized extends true ? SWRMemberInitialized : SWRMemberInitialized | SWRMemberUninitialized;
|
|
41
|
+
type SWRMemberSessionUninitialized = {
|
|
40
42
|
/**
|
|
41
43
|
* Either the active {@link MemberSession} object, or null if the member is not logged in.
|
|
42
44
|
*/
|
|
@@ -49,7 +51,8 @@ type SWRMemberSession = {
|
|
|
49
51
|
* If true, indicates that the SDK has completed initialization.
|
|
50
52
|
*/
|
|
51
53
|
isInitialized: false;
|
|
52
|
-
}
|
|
54
|
+
};
|
|
55
|
+
type SWRMemberSessionInitialized = {
|
|
53
56
|
/**
|
|
54
57
|
* Either the active {@link MemberSession} object, or null if the member is not logged in.
|
|
55
58
|
*/
|
|
@@ -63,7 +66,8 @@ type SWRMemberSession = {
|
|
|
63
66
|
*/
|
|
64
67
|
isInitialized: true;
|
|
65
68
|
};
|
|
66
|
-
type
|
|
69
|
+
type SWRMemberSession<TAlwaysInitialized extends boolean = boolean> = TAlwaysInitialized extends true ? SWRMemberSessionInitialized : SWRMemberSessionInitialized | SWRMemberSessionUninitialized;
|
|
70
|
+
type SWROrganizationUninitialized = {
|
|
67
71
|
/**
|
|
68
72
|
* Either the active {@link Organization} object, or null if the member is not logged in.
|
|
69
73
|
*/
|
|
@@ -76,7 +80,8 @@ type SWROrganization = {
|
|
|
76
80
|
* If true, indicates that the SDK has completed initialization.
|
|
77
81
|
*/
|
|
78
82
|
isInitialized: false;
|
|
79
|
-
}
|
|
83
|
+
};
|
|
84
|
+
type SWROrganizationInitialized = {
|
|
80
85
|
/**
|
|
81
86
|
* Either the active {@link Organization} object, or null if the member is not logged in.
|
|
82
87
|
*/
|
|
@@ -90,6 +95,7 @@ type SWROrganization = {
|
|
|
90
95
|
*/
|
|
91
96
|
isInitialized: true;
|
|
92
97
|
};
|
|
98
|
+
type SWROrganization<TAlwaysInitialized extends boolean = boolean> = TAlwaysInitialized extends true ? SWROrganizationInitialized : SWROrganizationInitialized | SWROrganizationUninitialized;
|
|
93
99
|
declare const useIsMounted__INTERNAL: () => boolean;
|
|
94
100
|
declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(client: StytchB2BClient<TProjectConfiguration>) => client is StytchB2BUIClient<TProjectConfiguration>;
|
|
95
101
|
/**
|
|
@@ -104,7 +110,7 @@ declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch
|
|
|
104
110
|
* }
|
|
105
111
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
106
112
|
*/
|
|
107
|
-
declare const useStytchMember: () => SWRMember
|
|
113
|
+
declare const useStytchMember: <TAssumeHydrated extends boolean = false>() => SWRMember<TAssumeHydrated>;
|
|
108
114
|
/**
|
|
109
115
|
* Returns the active member's Stytch member session.
|
|
110
116
|
* The Stytch SDKs are used for client-side authentication and session management.
|
|
@@ -121,7 +127,7 @@ declare const useStytchMember: () => SWRMember;
|
|
|
121
127
|
* }
|
|
122
128
|
* }, [session, isInitialized]);
|
|
123
129
|
*/
|
|
124
|
-
declare const useStytchMemberSession: () => SWRMemberSession
|
|
130
|
+
declare const useStytchMemberSession: <TAssumeHydrated extends boolean = false>() => SWRMemberSession<TAssumeHydrated>;
|
|
125
131
|
/**
|
|
126
132
|
* Returns the active Stytch organization.
|
|
127
133
|
* The Stytch SDKs are used for client-side authentication and session management.
|
|
@@ -134,8 +140,22 @@ declare const useStytchMemberSession: () => SWRMemberSession;
|
|
|
134
140
|
* }
|
|
135
141
|
* return (<p>Welcome to {organization.organization_name}</p>);
|
|
136
142
|
*/
|
|
137
|
-
declare const useStytchOrganization: () => SWROrganization
|
|
138
|
-
type
|
|
143
|
+
declare const useStytchOrganization: <TAssumeHydrated extends boolean = false>() => SWROrganization<TAssumeHydrated>;
|
|
144
|
+
type SWRIsAuthorizedUninitialized = {
|
|
145
|
+
/**
|
|
146
|
+
* Whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
147
|
+
*/
|
|
148
|
+
isAuthorized: false;
|
|
149
|
+
/**
|
|
150
|
+
* If true, indicates that the value returned is from the application cache and a state refresh is in progress.
|
|
151
|
+
*/
|
|
152
|
+
fromCache: false;
|
|
153
|
+
/**
|
|
154
|
+
* If true, indicates that the SDK has completed initialization.
|
|
155
|
+
*/
|
|
156
|
+
isInitialized: false;
|
|
157
|
+
};
|
|
158
|
+
type SWRIsAuthorizedInitialized = {
|
|
139
159
|
/**
|
|
140
160
|
* Whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
141
161
|
*/
|
|
@@ -149,6 +169,7 @@ type SWRIsAuthorized = {
|
|
|
149
169
|
*/
|
|
150
170
|
isInitialized: boolean;
|
|
151
171
|
};
|
|
172
|
+
type SWRIsAuthorized<TAlwaysInitialized extends boolean> = TAlwaysInitialized extends true ? SWRIsAuthorizedInitialized : SWRIsAuthorizedInitialized | SWRIsAuthorizedUninitialized;
|
|
152
173
|
/**
|
|
153
174
|
* Determines whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
154
175
|
* Returns `true` if the member can perform the action, `false` otherwise.
|
|
@@ -158,10 +179,10 @@ type SWRIsAuthorized = {
|
|
|
158
179
|
*
|
|
159
180
|
* Remember - authorization checks for sensitive actions should always occur on the backend as well.
|
|
160
181
|
* @example
|
|
161
|
-
* const isAuthorized = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
182
|
+
* const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
162
183
|
* return <button disabled={!isAuthorized}>Edit</button>
|
|
163
184
|
*/
|
|
164
|
-
declare const useStytchIsAuthorized: (resourceId: string, action: string) => SWRIsAuthorized
|
|
185
|
+
declare const useStytchIsAuthorized: <TAssumeHydrated extends boolean = false>(resourceId: string, action: string) => SWRIsAuthorized<TAssumeHydrated>;
|
|
165
186
|
/**
|
|
166
187
|
* Returns the Stytch B2B client stored in the Stytch context.
|
|
167
188
|
*
|
|
@@ -175,17 +196,17 @@ declare const useStytchB2BClient: <TProjectConfiguration extends Partial<import(
|
|
|
175
196
|
declare const withStytchB2BClient: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(Component: React.ComponentType<T & {
|
|
176
197
|
stytch: StytchB2BHeadlessClient<TProjectConfiguration>;
|
|
177
198
|
}>) => React.ComponentType<T>;
|
|
178
|
-
declare const withStytchMember: <T extends object>(Component: React.ComponentType<T & {
|
|
199
|
+
declare const withStytchMember: <T extends object, TAssumeHydrated extends boolean = false>(Component: React.ComponentType<T & {
|
|
179
200
|
stytchMember: Member | null;
|
|
180
201
|
stytchMemberIsInitialized: boolean;
|
|
181
202
|
stytchMemberIsFromCache: boolean;
|
|
182
203
|
}>) => React.ComponentType<T>;
|
|
183
|
-
declare const withStytchMemberSession: <T extends object>(Component: React.ComponentType<T & {
|
|
204
|
+
declare const withStytchMemberSession: <T extends object, TAssumeHydrated extends boolean = false>(Component: React.ComponentType<T & {
|
|
184
205
|
stytchMemberSession: MemberSession | null;
|
|
185
206
|
stytchMemberSessionIsInitialized: boolean;
|
|
186
207
|
stytchMemberSessionIsFromCache: boolean;
|
|
187
208
|
}>) => React.ComponentType<T>;
|
|
188
|
-
declare const withStytchOrganization: <T extends object>(Component: React.ComponentType<T & {
|
|
209
|
+
declare const withStytchOrganization: <T extends object, TAssumeHydrated extends boolean = false>(Component: React.ComponentType<T & {
|
|
189
210
|
stytchOrganization: Organization | null;
|
|
190
211
|
stytchOrganizationIsInitialized: boolean;
|
|
191
212
|
stytchOrganizationIsFromCache: boolean;
|
|
@@ -219,6 +240,20 @@ interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConf
|
|
|
219
240
|
* A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
|
|
220
241
|
*/
|
|
221
242
|
stytch: StytchB2BClient<TProjectConfiguration>;
|
|
243
|
+
/**
|
|
244
|
+
* When true, the provider will assume that the component will only be
|
|
245
|
+
* rendered in a browser environment, either in a single-page application or
|
|
246
|
+
* after completing hydration of a server-rendered application. This allows
|
|
247
|
+
* cached values to be retrieved from the browser on the first render, meaning
|
|
248
|
+
* that the `isInitialized` value returned from Stytch hooks will be `true`
|
|
249
|
+
* starting from the first render.
|
|
250
|
+
*
|
|
251
|
+
* When `false`, the provider will defer initialization until after the first
|
|
252
|
+
* render, and `isInitialized` will initially be `false`.
|
|
253
|
+
*
|
|
254
|
+
* This value defaults to `false` in `@stytch/nextjs`.
|
|
255
|
+
*/
|
|
256
|
+
assumeHydrated?: boolean;
|
|
222
257
|
children?: ReactNode;
|
|
223
258
|
}
|
|
224
259
|
/**
|
|
@@ -233,5 +268,5 @@ interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConf
|
|
|
233
268
|
* </StytchB2BProvider>
|
|
234
269
|
* )
|
|
235
270
|
*/
|
|
236
|
-
declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children, }: StytchB2BProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
271
|
+
declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children, assumeHydrated, }: StytchB2BProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
237
272
|
export { useIsMounted__INTERNAL, isUIClient, useStytchMember, useStytchMemberSession, useStytchOrganization, useStytchIsAuthorized, useStytchB2BClient, withStytchB2BClient, withStytchMember, withStytchMemberSession, withStytchOrganization, withStytchPermissions, StytchB2BProviderProps, StytchB2BProvider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { createContext, useContext, useEffect, useMemo } from 'react';
|
|
2
|
-
import { i as invariant, u as useAsyncState, m as mergeWithStableProps } from './useIsomorphicLayoutEffect-
|
|
3
|
-
import { i as isStytchSSRProxy, n as noProviderError } from './StytchSSRProxy-
|
|
1
|
+
import React, { createContext, useContext, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
2
|
+
import { i as invariant, u as useAsyncState, m as mergeWithStableProps } from './useIsomorphicLayoutEffect-681e2138.js';
|
|
3
|
+
import { i as isStytchSSRProxy, n as noProviderError } from './StytchSSRProxy-34c789b5.js';
|
|
4
4
|
|
|
5
5
|
const initialMember = {
|
|
6
6
|
member: null,
|
|
@@ -86,7 +86,7 @@ const useStytchOrganization = () => {
|
|
|
86
86
|
*
|
|
87
87
|
* Remember - authorization checks for sensitive actions should always occur on the backend as well.
|
|
88
88
|
* @example
|
|
89
|
-
* const isAuthorized = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
89
|
+
* const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
90
90
|
* return <button disabled={!isAuthorized}>Edit</button>
|
|
91
91
|
*/
|
|
92
92
|
const useStytchIsAuthorized = (resourceId, action) => {
|
|
@@ -219,33 +219,40 @@ const withStytchPermissions = (Component) => {
|
|
|
219
219
|
* </StytchB2BProvider>
|
|
220
220
|
* )
|
|
221
221
|
*/
|
|
222
|
-
const StytchB2BProvider = ({ stytch, children, }) => {
|
|
222
|
+
const StytchB2BProvider = ({ stytch, children, assumeHydrated = false, }) => {
|
|
223
|
+
invariant(!useIsMounted__INTERNAL(), 'You cannot render a <StytchB2BProvider> inside another <StytchB2BProvider>.');
|
|
224
|
+
invariant(!assumeHydrated || typeof window !== 'undefined', 'The `assumeHydrated` prop must be set to `false` when using StytchB2BProvider in a server environment.');
|
|
223
225
|
const ctx = useMemo(() => ({ client: stytch, isMounted: true }), [stytch]);
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
const getHydratedState = useCallback(() => {
|
|
227
|
+
return {
|
|
228
|
+
member: Object.assign(Object.assign({}, stytch.self.getInfo()), { isInitialized: true }),
|
|
229
|
+
session: Object.assign(Object.assign({}, stytch.session.getInfo()), { isInitialized: true }),
|
|
230
|
+
organization: Object.assign(Object.assign({}, stytch.organization.getInfo()), { isInitialized: true }),
|
|
231
|
+
};
|
|
232
|
+
}, [stytch]);
|
|
233
|
+
const getInitialState = () => {
|
|
234
|
+
return {
|
|
235
|
+
member: initialMember,
|
|
236
|
+
session: initialMemberSession,
|
|
237
|
+
organization: initialOrganization,
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
const [{ member, session, organization }, setClientState] = useAsyncState(() => assumeHydrated ? getHydratedState() : getInitialState());
|
|
241
|
+
// Store the initial value of `assumeHydrated` in a ref, because it is
|
|
242
|
+
// logically only relevant for the first render
|
|
243
|
+
const assumeHydratedRef = useRef(assumeHydrated);
|
|
229
244
|
useEffect(() => {
|
|
230
245
|
if (isStytchSSRProxy(stytch)) {
|
|
231
246
|
return;
|
|
232
247
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
member: Object.assign(Object.assign({}, stytch.self.getInfo()), { isInitialized: true }),
|
|
242
|
-
session: Object.assign(Object.assign({}, stytch.session.getInfo()), { isInitialized: true }),
|
|
243
|
-
organization: Object.assign(Object.assign({}, stytch.organization.getInfo()), { isInitialized: true }),
|
|
244
|
-
};
|
|
245
|
-
return mergeWithStableProps(oldState, newState);
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
}, [setClientState, stytch]);
|
|
248
|
+
const updateState = () => {
|
|
249
|
+
setClientState((oldState) => mergeWithStableProps(oldState, getHydratedState()));
|
|
250
|
+
};
|
|
251
|
+
if (!assumeHydratedRef.current) {
|
|
252
|
+
updateState();
|
|
253
|
+
}
|
|
254
|
+
return stytch.onStateChange(updateState);
|
|
255
|
+
}, [getHydratedState, setClientState, stytch]);
|
|
249
256
|
return (React.createElement(StytchB2BContext.Provider, { value: ctx },
|
|
250
257
|
React.createElement(StytchOrganizationContext.Provider, { value: organization },
|
|
251
258
|
React.createElement(StytchMemberContext.Provider, { value: member },
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
+
import { PermissionsMap } from '@stytch/core/public';
|
|
4
5
|
import { Member, MemberSession, Organization, StytchB2BUIClient } from '@stytch/vanilla-js/b2b';
|
|
5
6
|
import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from '@stytch/vanilla-js/b2b/headless';
|
|
6
|
-
import { PermissionsMap } from '@stytch/core/public';
|
|
7
7
|
/**
|
|
8
8
|
* The Stytch Client object passed in to <StytchB2BProvider /> in your application root.
|
|
9
9
|
* Either a StytchB2BUIClient or StytchB2BHeadlessClient.
|
|
10
10
|
*/
|
|
11
11
|
type StytchB2BClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchB2BHeadlessClient<TProjectConfiguration> | StytchB2BUIClient<TProjectConfiguration>;
|
|
12
|
-
type
|
|
12
|
+
type SWRMemberUninitialized = {
|
|
13
13
|
/**
|
|
14
14
|
* Either the active {@link Member} object, or null if the member is not logged in.
|
|
15
15
|
*/
|
|
@@ -22,7 +22,8 @@ type SWRMember = {
|
|
|
22
22
|
* If true, indicates that the SDK has completed initialization.
|
|
23
23
|
*/
|
|
24
24
|
isInitialized: false;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
|
+
type SWRMemberInitialized = {
|
|
26
27
|
/**
|
|
27
28
|
* Either the active {@link Member} object, or null if the member is not logged in.
|
|
28
29
|
*/
|
|
@@ -36,7 +37,8 @@ type SWRMember = {
|
|
|
36
37
|
*/
|
|
37
38
|
isInitialized: true;
|
|
38
39
|
};
|
|
39
|
-
type
|
|
40
|
+
type SWRMember<TAlwaysInitialized extends boolean = boolean> = TAlwaysInitialized extends true ? SWRMemberInitialized : SWRMemberInitialized | SWRMemberUninitialized;
|
|
41
|
+
type SWRMemberSessionUninitialized = {
|
|
40
42
|
/**
|
|
41
43
|
* Either the active {@link MemberSession} object, or null if the member is not logged in.
|
|
42
44
|
*/
|
|
@@ -49,7 +51,8 @@ type SWRMemberSession = {
|
|
|
49
51
|
* If true, indicates that the SDK has completed initialization.
|
|
50
52
|
*/
|
|
51
53
|
isInitialized: false;
|
|
52
|
-
}
|
|
54
|
+
};
|
|
55
|
+
type SWRMemberSessionInitialized = {
|
|
53
56
|
/**
|
|
54
57
|
* Either the active {@link MemberSession} object, or null if the member is not logged in.
|
|
55
58
|
*/
|
|
@@ -63,7 +66,8 @@ type SWRMemberSession = {
|
|
|
63
66
|
*/
|
|
64
67
|
isInitialized: true;
|
|
65
68
|
};
|
|
66
|
-
type
|
|
69
|
+
type SWRMemberSession<TAlwaysInitialized extends boolean = boolean> = TAlwaysInitialized extends true ? SWRMemberSessionInitialized : SWRMemberSessionInitialized | SWRMemberSessionUninitialized;
|
|
70
|
+
type SWROrganizationUninitialized = {
|
|
67
71
|
/**
|
|
68
72
|
* Either the active {@link Organization} object, or null if the member is not logged in.
|
|
69
73
|
*/
|
|
@@ -76,7 +80,8 @@ type SWROrganization = {
|
|
|
76
80
|
* If true, indicates that the SDK has completed initialization.
|
|
77
81
|
*/
|
|
78
82
|
isInitialized: false;
|
|
79
|
-
}
|
|
83
|
+
};
|
|
84
|
+
type SWROrganizationInitialized = {
|
|
80
85
|
/**
|
|
81
86
|
* Either the active {@link Organization} object, or null if the member is not logged in.
|
|
82
87
|
*/
|
|
@@ -90,6 +95,7 @@ type SWROrganization = {
|
|
|
90
95
|
*/
|
|
91
96
|
isInitialized: true;
|
|
92
97
|
};
|
|
98
|
+
type SWROrganization<TAlwaysInitialized extends boolean = boolean> = TAlwaysInitialized extends true ? SWROrganizationInitialized : SWROrganizationInitialized | SWROrganizationUninitialized;
|
|
93
99
|
declare const useIsMounted__INTERNAL: () => boolean;
|
|
94
100
|
declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(client: StytchB2BClient<TProjectConfiguration>) => client is StytchB2BUIClient<TProjectConfiguration>;
|
|
95
101
|
/**
|
|
@@ -104,7 +110,7 @@ declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch
|
|
|
104
110
|
* }
|
|
105
111
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
106
112
|
*/
|
|
107
|
-
declare const useStytchMember: () => SWRMember
|
|
113
|
+
declare const useStytchMember: <TAssumeHydrated extends boolean = false>() => SWRMember<TAssumeHydrated>;
|
|
108
114
|
/**
|
|
109
115
|
* Returns the active member's Stytch member session.
|
|
110
116
|
* The Stytch SDKs are used for client-side authentication and session management.
|
|
@@ -121,7 +127,7 @@ declare const useStytchMember: () => SWRMember;
|
|
|
121
127
|
* }
|
|
122
128
|
* }, [session, isInitialized]);
|
|
123
129
|
*/
|
|
124
|
-
declare const useStytchMemberSession: () => SWRMemberSession
|
|
130
|
+
declare const useStytchMemberSession: <TAssumeHydrated extends boolean = false>() => SWRMemberSession<TAssumeHydrated>;
|
|
125
131
|
/**
|
|
126
132
|
* Returns the active Stytch organization.
|
|
127
133
|
* The Stytch SDKs are used for client-side authentication and session management.
|
|
@@ -134,8 +140,22 @@ declare const useStytchMemberSession: () => SWRMemberSession;
|
|
|
134
140
|
* }
|
|
135
141
|
* return (<p>Welcome to {organization.organization_name}</p>);
|
|
136
142
|
*/
|
|
137
|
-
declare const useStytchOrganization: () => SWROrganization
|
|
138
|
-
type
|
|
143
|
+
declare const useStytchOrganization: <TAssumeHydrated extends boolean = false>() => SWROrganization<TAssumeHydrated>;
|
|
144
|
+
type SWRIsAuthorizedUninitialized = {
|
|
145
|
+
/**
|
|
146
|
+
* Whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
147
|
+
*/
|
|
148
|
+
isAuthorized: false;
|
|
149
|
+
/**
|
|
150
|
+
* If true, indicates that the value returned is from the application cache and a state refresh is in progress.
|
|
151
|
+
*/
|
|
152
|
+
fromCache: false;
|
|
153
|
+
/**
|
|
154
|
+
* If true, indicates that the SDK has completed initialization.
|
|
155
|
+
*/
|
|
156
|
+
isInitialized: false;
|
|
157
|
+
};
|
|
158
|
+
type SWRIsAuthorizedInitialized = {
|
|
139
159
|
/**
|
|
140
160
|
* Whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
141
161
|
*/
|
|
@@ -149,6 +169,7 @@ type SWRIsAuthorized = {
|
|
|
149
169
|
*/
|
|
150
170
|
isInitialized: boolean;
|
|
151
171
|
};
|
|
172
|
+
type SWRIsAuthorized<TAlwaysInitialized extends boolean> = TAlwaysInitialized extends true ? SWRIsAuthorizedInitialized : SWRIsAuthorizedInitialized | SWRIsAuthorizedUninitialized;
|
|
152
173
|
/**
|
|
153
174
|
* Determines whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
154
175
|
* Returns `true` if the member can perform the action, `false` otherwise.
|
|
@@ -158,10 +179,10 @@ type SWRIsAuthorized = {
|
|
|
158
179
|
*
|
|
159
180
|
* Remember - authorization checks for sensitive actions should always occur on the backend as well.
|
|
160
181
|
* @example
|
|
161
|
-
* const isAuthorized = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
182
|
+
* const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
162
183
|
* return <button disabled={!isAuthorized}>Edit</button>
|
|
163
184
|
*/
|
|
164
|
-
declare const useStytchIsAuthorized: (resourceId: string, action: string) => SWRIsAuthorized
|
|
185
|
+
declare const useStytchIsAuthorized: <TAssumeHydrated extends boolean = false>(resourceId: string, action: string) => SWRIsAuthorized<TAssumeHydrated>;
|
|
165
186
|
/**
|
|
166
187
|
* Returns the Stytch B2B client stored in the Stytch context.
|
|
167
188
|
*
|
|
@@ -175,17 +196,17 @@ declare const useStytchB2BClient: <TProjectConfiguration extends Partial<import(
|
|
|
175
196
|
declare const withStytchB2BClient: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(Component: React.ComponentType<T & {
|
|
176
197
|
stytch: StytchB2BHeadlessClient<TProjectConfiguration>;
|
|
177
198
|
}>) => React.ComponentType<T>;
|
|
178
|
-
declare const withStytchMember: <T extends object>(Component: React.ComponentType<T & {
|
|
199
|
+
declare const withStytchMember: <T extends object, TAssumeHydrated extends boolean = false>(Component: React.ComponentType<T & {
|
|
179
200
|
stytchMember: Member | null;
|
|
180
201
|
stytchMemberIsInitialized: boolean;
|
|
181
202
|
stytchMemberIsFromCache: boolean;
|
|
182
203
|
}>) => React.ComponentType<T>;
|
|
183
|
-
declare const withStytchMemberSession: <T extends object>(Component: React.ComponentType<T & {
|
|
204
|
+
declare const withStytchMemberSession: <T extends object, TAssumeHydrated extends boolean = false>(Component: React.ComponentType<T & {
|
|
184
205
|
stytchMemberSession: MemberSession | null;
|
|
185
206
|
stytchMemberSessionIsInitialized: boolean;
|
|
186
207
|
stytchMemberSessionIsFromCache: boolean;
|
|
187
208
|
}>) => React.ComponentType<T>;
|
|
188
|
-
declare const withStytchOrganization: <T extends object>(Component: React.ComponentType<T & {
|
|
209
|
+
declare const withStytchOrganization: <T extends object, TAssumeHydrated extends boolean = false>(Component: React.ComponentType<T & {
|
|
189
210
|
stytchOrganization: Organization | null;
|
|
190
211
|
stytchOrganizationIsInitialized: boolean;
|
|
191
212
|
stytchOrganizationIsFromCache: boolean;
|
|
@@ -219,6 +240,20 @@ interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConf
|
|
|
219
240
|
* A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
|
|
220
241
|
*/
|
|
221
242
|
stytch: StytchB2BClient<TProjectConfiguration>;
|
|
243
|
+
/**
|
|
244
|
+
* When true, the provider will assume that the component will only be
|
|
245
|
+
* rendered in a browser environment, either in a single-page application or
|
|
246
|
+
* after completing hydration of a server-rendered application. This allows
|
|
247
|
+
* cached values to be retrieved from the browser on the first render, meaning
|
|
248
|
+
* that the `isInitialized` value returned from Stytch hooks will be `true`
|
|
249
|
+
* starting from the first render.
|
|
250
|
+
*
|
|
251
|
+
* When `false`, the provider will defer initialization until after the first
|
|
252
|
+
* render, and `isInitialized` will initially be `false`.
|
|
253
|
+
*
|
|
254
|
+
* This value defaults to `false` in `@stytch/nextjs`.
|
|
255
|
+
*/
|
|
256
|
+
assumeHydrated?: boolean;
|
|
222
257
|
children?: ReactNode;
|
|
223
258
|
}
|
|
224
259
|
/**
|
|
@@ -233,5 +268,5 @@ interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConf
|
|
|
233
268
|
* </StytchB2BProvider>
|
|
234
269
|
* )
|
|
235
270
|
*/
|
|
236
|
-
declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children, }: StytchB2BProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
271
|
+
declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children, assumeHydrated, }: StytchB2BProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
237
272
|
export { useIsMounted__INTERNAL, isUIClient, useStytchMember, useStytchMemberSession, useStytchOrganization, useStytchIsAuthorized, useStytchB2BClient, withStytchB2BClient, withStytchMember, withStytchMemberSession, withStytchOrganization, withStytchPermissions, StytchB2BProviderProps, StytchB2BProvider };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var useIsomorphicLayoutEffect = require('./useIsomorphicLayoutEffect-
|
|
5
|
-
var StytchSSRProxy = require('./StytchSSRProxy-
|
|
4
|
+
var useIsomorphicLayoutEffect = require('./useIsomorphicLayoutEffect-672e4b66.js');
|
|
5
|
+
var StytchSSRProxy = require('./StytchSSRProxy-86bc42b3.js');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -92,7 +92,7 @@ const useStytchOrganization = () => {
|
|
|
92
92
|
*
|
|
93
93
|
* Remember - authorization checks for sensitive actions should always occur on the backend as well.
|
|
94
94
|
* @example
|
|
95
|
-
* const isAuthorized = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
95
|
+
* const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
|
|
96
96
|
* return <button disabled={!isAuthorized}>Edit</button>
|
|
97
97
|
*/
|
|
98
98
|
const useStytchIsAuthorized = (resourceId, action) => {
|
|
@@ -225,33 +225,40 @@ const withStytchPermissions = (Component) => {
|
|
|
225
225
|
* </StytchB2BProvider>
|
|
226
226
|
* )
|
|
227
227
|
*/
|
|
228
|
-
const StytchB2BProvider = ({ stytch, children, }) => {
|
|
228
|
+
const StytchB2BProvider = ({ stytch, children, assumeHydrated = false, }) => {
|
|
229
|
+
useIsomorphicLayoutEffect.invariant(!useIsMounted__INTERNAL(), 'You cannot render a <StytchB2BProvider> inside another <StytchB2BProvider>.');
|
|
230
|
+
useIsomorphicLayoutEffect.invariant(!assumeHydrated || typeof window !== 'undefined', 'The `assumeHydrated` prop must be set to `false` when using StytchB2BProvider in a server environment.');
|
|
229
231
|
const ctx = React.useMemo(() => ({ client: stytch, isMounted: true }), [stytch]);
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
const getHydratedState = React.useCallback(() => {
|
|
233
|
+
return {
|
|
234
|
+
member: Object.assign(Object.assign({}, stytch.self.getInfo()), { isInitialized: true }),
|
|
235
|
+
session: Object.assign(Object.assign({}, stytch.session.getInfo()), { isInitialized: true }),
|
|
236
|
+
organization: Object.assign(Object.assign({}, stytch.organization.getInfo()), { isInitialized: true }),
|
|
237
|
+
};
|
|
238
|
+
}, [stytch]);
|
|
239
|
+
const getInitialState = () => {
|
|
240
|
+
return {
|
|
241
|
+
member: initialMember,
|
|
242
|
+
session: initialMemberSession,
|
|
243
|
+
organization: initialOrganization,
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
const [{ member, session, organization }, setClientState] = useIsomorphicLayoutEffect.useAsyncState(() => assumeHydrated ? getHydratedState() : getInitialState());
|
|
247
|
+
// Store the initial value of `assumeHydrated` in a ref, because it is
|
|
248
|
+
// logically only relevant for the first render
|
|
249
|
+
const assumeHydratedRef = React.useRef(assumeHydrated);
|
|
235
250
|
React.useEffect(() => {
|
|
236
251
|
if (StytchSSRProxy.isStytchSSRProxy(stytch)) {
|
|
237
252
|
return;
|
|
238
253
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
member: Object.assign(Object.assign({}, stytch.self.getInfo()), { isInitialized: true }),
|
|
248
|
-
session: Object.assign(Object.assign({}, stytch.session.getInfo()), { isInitialized: true }),
|
|
249
|
-
organization: Object.assign(Object.assign({}, stytch.organization.getInfo()), { isInitialized: true }),
|
|
250
|
-
};
|
|
251
|
-
return useIsomorphicLayoutEffect.mergeWithStableProps(oldState, newState);
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
}, [setClientState, stytch]);
|
|
254
|
+
const updateState = () => {
|
|
255
|
+
setClientState((oldState) => useIsomorphicLayoutEffect.mergeWithStableProps(oldState, getHydratedState()));
|
|
256
|
+
};
|
|
257
|
+
if (!assumeHydratedRef.current) {
|
|
258
|
+
updateState();
|
|
259
|
+
}
|
|
260
|
+
return stytch.onStateChange(updateState);
|
|
261
|
+
}, [getHydratedState, setClientState, stytch]);
|
|
255
262
|
return (React__default["default"].createElement(StytchB2BContext.Provider, { value: ctx },
|
|
256
263
|
React__default["default"].createElement(StytchOrganizationContext.Provider, { value: organization },
|
|
257
264
|
React__default["default"].createElement(StytchMemberContext.Provider, { value: member },
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const noProviderError = (item, provider = 'StytchProvider') => `${item} can only be used inside <${provider}>.`;
|
|
2
|
+
const providerMustBeUniqueError = 'You cannot render a <StytchProvider> inside another <StytchProvider>.';
|
|
2
3
|
const noHeadlessClientError = `Tried to create a Stytch Login UI element using the Stytch Headless SDK.
|
|
3
4
|
You must use the UI SDK to use UI elements.
|
|
4
|
-
Please make sure you are
|
|
5
|
+
Please make sure you are using a Stytch UI client, not a Stytch Headless client.`;
|
|
5
6
|
const cannotInvokeMethodOnServerError = (path) => `[Stytch] Invalid serverside function call to ${path}.
|
|
6
7
|
The Stytch Javascript SDK is intended to ony be used on the client side.
|
|
7
8
|
Make sure to wrap your API calls in a hook to ensure they are executed on the client.
|
|
@@ -44,4 +45,4 @@ const createProxy = (path) => {
|
|
|
44
45
|
};
|
|
45
46
|
const createStytchSSRProxy = () => createProxy('stytch');
|
|
46
47
|
|
|
47
|
-
export { noHeadlessClientError as a, createStytchSSRProxy as c, isStytchSSRProxy as i, noProviderError as n };
|
|
48
|
+
export { noHeadlessClientError as a, createStytchSSRProxy as c, isStytchSSRProxy as i, noProviderError as n, providerMustBeUniqueError as p };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const noProviderError = (item, provider = 'StytchProvider') => `${item} can only be used inside <${provider}>.`;
|
|
4
|
+
const providerMustBeUniqueError = 'You cannot render a <StytchProvider> inside another <StytchProvider>.';
|
|
4
5
|
const noHeadlessClientError = `Tried to create a Stytch Login UI element using the Stytch Headless SDK.
|
|
5
6
|
You must use the UI SDK to use UI elements.
|
|
6
|
-
Please make sure you are
|
|
7
|
+
Please make sure you are using a Stytch UI client, not a Stytch Headless client.`;
|
|
7
8
|
const cannotInvokeMethodOnServerError = (path) => `[Stytch] Invalid serverside function call to ${path}.
|
|
8
9
|
The Stytch Javascript SDK is intended to ony be used on the client side.
|
|
9
10
|
Make sure to wrap your API calls in a hook to ensure they are executed on the client.
|
|
@@ -50,3 +51,4 @@ exports.createStytchSSRProxy = createStytchSSRProxy;
|
|
|
50
51
|
exports.isStytchSSRProxy = isStytchSSRProxy;
|
|
51
52
|
exports.noHeadlessClientError = noHeadlessClientError;
|
|
52
53
|
exports.noProviderError = noProviderError;
|
|
54
|
+
exports.providerMustBeUniqueError = providerMustBeUniqueError;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { mountAdminPortalSSO, mountAdminPortalOrgSettings, mountAdminPortalMemberManagement, mountAdminPortalSCIM } from '@stytch/vanilla-js/b2b/adminPortal';
|
|
2
2
|
export { AdminPortalB2BProducts } from '@stytch/vanilla-js/b2b/adminPortal';
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
|
-
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-
|
|
5
|
-
import { n as noProviderError } from '../StytchSSRProxy-
|
|
6
|
-
import { i as invariant, a as useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect-
|
|
4
|
+
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-1cabb03b.js';
|
|
5
|
+
import { n as noProviderError } from '../StytchSSRProxy-34c789b5.js';
|
|
6
|
+
import { i as invariant, a as useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect-681e2138.js';
|
|
7
7
|
|
|
8
8
|
const makeAdminPortalComponent = (mountFn, componentName) => {
|
|
9
9
|
const Component = (props) => {
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var adminPortal = require('@stytch/vanilla-js/b2b/adminPortal');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var StytchB2BContext = require('../StytchB2BContext-
|
|
8
|
-
var StytchSSRProxy = require('../StytchSSRProxy-
|
|
9
|
-
var useIsomorphicLayoutEffect = require('../useIsomorphicLayoutEffect-
|
|
7
|
+
var StytchB2BContext = require('../StytchB2BContext-f7acf57f.js');
|
|
8
|
+
var StytchSSRProxy = require('../StytchSSRProxy-86bc42b3.js');
|
|
9
|
+
var useIsomorphicLayoutEffect = require('../useIsomorphicLayoutEffect-672e4b66.js');
|
|
10
10
|
|
|
11
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
12
|
|
package/dist/b2b/index.d.ts
CHANGED
|
@@ -141,6 +141,6 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
|
|
|
141
141
|
* />
|
|
142
142
|
*/
|
|
143
143
|
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
144
|
-
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-
|
|
144
|
+
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-f7acf57f.js";
|
|
145
145
|
export { StytchB2B, B2BIdentityProvider };
|
|
146
|
-
export type { StytchB2BProviderProps } from "../StytchB2BContext-
|
|
146
|
+
export type { StytchB2BProviderProps } from "../StytchB2BContext-f7acf57f.js";
|
package/dist/b2b/index.esm.d.ts
CHANGED
|
@@ -141,6 +141,6 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
|
|
|
141
141
|
* />
|
|
142
142
|
*/
|
|
143
143
|
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
144
|
-
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-
|
|
144
|
+
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-1cabb03b.js";
|
|
145
145
|
export { StytchB2B, B2BIdentityProvider };
|
|
146
|
-
export type { StytchB2BProviderProps } from "../StytchB2BContext-
|
|
146
|
+
export type { StytchB2BProviderProps } from "../StytchB2BContext-1cabb03b.js";
|