@stytch/nextjs 21.1.0 → 21.2.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @stytch/nextjs
2
2
 
3
+ ## 21.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6daadc7: Add support for TypeScript-based Stytch project configurations
8
+
9
+ ### Patch Changes
10
+
11
+ - ac0778e: Fix error message when mounting Admin Portal components without a StytchB2BProvider
12
+
13
+ ## 21.1.1
14
+
15
+ ### Patch Changes
16
+
17
+ - 26a2e95: Fixed <StytchB2B /> error message
18
+
3
19
  ## 21.1.0
4
20
 
5
21
  ### Minor Changes
@@ -8,6 +24,12 @@
8
24
 
9
25
  ## 21.0.0
10
26
 
27
+ ### Major Changes
28
+
29
+ - Updated API routes to use api.stytch.com for live and test.stytch.com for test, replacing web.stytch.com.
30
+ If you use Content Security Policy (CSP) headers, ensure the URL is updated.
31
+ This was done to reduce the number of network calls and simplify internal routing, resulting in faster API response times—improving request speeds by up to 40 milliseconds roundtrip.
32
+
11
33
  ### Patch Changes
12
34
 
13
35
  - Updated dependencies [3c39a997]
@@ -86,7 +108,6 @@
86
108
  ### Patch Changes
87
109
 
88
110
  - 50de202: Fix B2B headless entrypoint to import `@stytch/vanilla-js` rather than bundle it
89
- - @stytch/vanilla-js@4.4.3
90
111
 
91
112
  ## 17.0.0
92
113
 
@@ -2,13 +2,13 @@
2
2
  import React from 'react';
3
3
  import { ReactNode } from "react";
4
4
  import { Member, MemberSession, Organization, StytchB2BUIClient } from '@stytch/vanilla-js/b2b';
5
- import { StytchB2BHeadlessClient } from '@stytch/vanilla-js/b2b/headless';
5
+ import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from '@stytch/vanilla-js/b2b/headless';
6
6
  import { PermissionsMap } from '@stytch/core/public';
7
7
  /**
8
8
  * The Stytch Client object passed in to <StytchProvider /> in your `_app.js`.
9
9
  * Either a StytchUIClient or StytchHeadlessClient.
10
10
  */
11
- type StytchB2BClient = StytchB2BHeadlessClient | StytchB2BUIClient;
11
+ type StytchB2BClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchB2BHeadlessClient<TProjectConfiguration> | StytchB2BUIClient<TProjectConfiguration>;
12
12
  type SWRMember = {
13
13
  member: null;
14
14
  fromCache: false;
@@ -37,7 +37,7 @@ type SWROrganization = {
37
37
  isInitialized: true;
38
38
  };
39
39
  declare const useIsMounted__INTERNAL: () => boolean;
40
- declare const isUIClient: (client: StytchB2BClient) => client is StytchB2BUIClient;
40
+ declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(client: StytchB2BClient<TProjectConfiguration>) => client is StytchB2BUIClient<TProjectConfiguration>;
41
41
  /**
42
42
  * Returns the active member.
43
43
  * The Stytch SDKs are used for client-side authentication and session management.
@@ -111,9 +111,9 @@ declare const useStytchIsAuthorized: (resourceId: string, action: string) => SWR
111
111
  * stytch.magicLinks.authenticate('...')
112
112
  * }, [stytch]);
113
113
  */
114
- declare const useStytchB2BClient: () => StytchB2BHeadlessClient;
115
- declare const withStytchB2BClient: <T extends object>(Component: React.ComponentType<T & {
116
- stytch: StytchB2BHeadlessClient;
114
+ declare const useStytchB2BClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>() => StytchB2BHeadlessClient<TProjectConfiguration>;
115
+ declare const withStytchB2BClient: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(Component: React.ComponentType<T & {
116
+ stytch: StytchB2BHeadlessClient<TProjectConfiguration>;
117
117
  }>) => React.ComponentType<T>;
118
118
  declare const withStytchMember: <T extends object>(Component: React.ComponentType<T & {
119
119
  stytchMember: Member | null;
@@ -154,11 +154,11 @@ declare const withStytchOrganization: <T extends object>(Component: React.Compon
154
154
  declare const withStytchPermissions: <Permissions_1 extends Record<string, string>, T extends object>(Component: React.ComponentType<T & {
155
155
  stytchPermissions: PermissionsMap<Permissions_1>;
156
156
  }>) => React.ComponentType<T>;
157
- interface StytchB2BProviderProps {
157
+ interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput> {
158
158
  /**
159
159
  * A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
160
160
  */
161
- stytch: StytchB2BClient;
161
+ stytch: StytchB2BClient<TProjectConfiguration>;
162
162
  children?: ReactNode;
163
163
  }
164
164
  /**
@@ -173,5 +173,5 @@ interface StytchB2BProviderProps {
173
173
  * </StytchB2BProvider>
174
174
  * )
175
175
  */
176
- declare const StytchB2BProvider: ({ stytch, children }: StytchB2BProviderProps) => JSX.Element;
176
+ declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>({ stytch, children, }: StytchB2BProviderProps<TProjectConfiguration>) => JSX.Element;
177
177
  export { useIsMounted__INTERNAL, isUIClient, useStytchMember, useStytchMemberSession, useStytchOrganization, useStytchIsAuthorized, useStytchB2BClient, withStytchB2BClient, withStytchMember, withStytchMemberSession, withStytchOrganization, withStytchPermissions, StytchB2BProviderProps, StytchB2BProvider };
@@ -222,7 +222,7 @@ const withStytchPermissions = (Component) => {
222
222
  * </StytchB2BProvider>
223
223
  * )
224
224
  */
225
- const StytchB2BProvider = ({ stytch, children }) => {
225
+ const StytchB2BProvider = ({ stytch, children, }) => {
226
226
  const ctx = useMemo(() => ({ client: stytch, isMounted: true }), [stytch]);
227
227
  const [{ member, session, organization }, setClientState] = useAsyncState({
228
228
  member: initialMember,
@@ -2,13 +2,13 @@
2
2
  import React from 'react';
3
3
  import { ReactNode } from "react";
4
4
  import { Member, MemberSession, Organization, StytchB2BUIClient } from '@stytch/vanilla-js/b2b';
5
- import { StytchB2BHeadlessClient } from '@stytch/vanilla-js/b2b/headless';
5
+ import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from '@stytch/vanilla-js/b2b/headless';
6
6
  import { PermissionsMap } from '@stytch/core/public';
7
7
  /**
8
8
  * The Stytch Client object passed in to <StytchProvider /> in your `_app.js`.
9
9
  * Either a StytchUIClient or StytchHeadlessClient.
10
10
  */
11
- type StytchB2BClient = StytchB2BHeadlessClient | StytchB2BUIClient;
11
+ type StytchB2BClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchB2BHeadlessClient<TProjectConfiguration> | StytchB2BUIClient<TProjectConfiguration>;
12
12
  type SWRMember = {
13
13
  member: null;
14
14
  fromCache: false;
@@ -37,7 +37,7 @@ type SWROrganization = {
37
37
  isInitialized: true;
38
38
  };
39
39
  declare const useIsMounted__INTERNAL: () => boolean;
40
- declare const isUIClient: (client: StytchB2BClient) => client is StytchB2BUIClient;
40
+ declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(client: StytchB2BClient<TProjectConfiguration>) => client is StytchB2BUIClient<TProjectConfiguration>;
41
41
  /**
42
42
  * Returns the active member.
43
43
  * The Stytch SDKs are used for client-side authentication and session management.
@@ -111,9 +111,9 @@ declare const useStytchIsAuthorized: (resourceId: string, action: string) => SWR
111
111
  * stytch.magicLinks.authenticate('...')
112
112
  * }, [stytch]);
113
113
  */
114
- declare const useStytchB2BClient: () => StytchB2BHeadlessClient;
115
- declare const withStytchB2BClient: <T extends object>(Component: React.ComponentType<T & {
116
- stytch: StytchB2BHeadlessClient;
114
+ declare const useStytchB2BClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>() => StytchB2BHeadlessClient<TProjectConfiguration>;
115
+ declare const withStytchB2BClient: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(Component: React.ComponentType<T & {
116
+ stytch: StytchB2BHeadlessClient<TProjectConfiguration>;
117
117
  }>) => React.ComponentType<T>;
118
118
  declare const withStytchMember: <T extends object>(Component: React.ComponentType<T & {
119
119
  stytchMember: Member | null;
@@ -154,11 +154,11 @@ declare const withStytchOrganization: <T extends object>(Component: React.Compon
154
154
  declare const withStytchPermissions: <Permissions_1 extends Record<string, string>, T extends object>(Component: React.ComponentType<T & {
155
155
  stytchPermissions: PermissionsMap<Permissions_1>;
156
156
  }>) => React.ComponentType<T>;
157
- interface StytchB2BProviderProps {
157
+ interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput> {
158
158
  /**
159
159
  * A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
160
160
  */
161
- stytch: StytchB2BClient;
161
+ stytch: StytchB2BClient<TProjectConfiguration>;
162
162
  children?: ReactNode;
163
163
  }
164
164
  /**
@@ -173,5 +173,5 @@ interface StytchB2BProviderProps {
173
173
  * </StytchB2BProvider>
174
174
  * )
175
175
  */
176
- declare const StytchB2BProvider: ({ stytch, children }: StytchB2BProviderProps) => JSX.Element;
176
+ declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>({ stytch, children, }: StytchB2BProviderProps<TProjectConfiguration>) => JSX.Element;
177
177
  export { useIsMounted__INTERNAL, isUIClient, useStytchMember, useStytchMemberSession, useStytchOrganization, useStytchIsAuthorized, useStytchB2BClient, withStytchB2BClient, withStytchMember, withStytchMemberSession, withStytchOrganization, withStytchPermissions, StytchB2BProviderProps, StytchB2BProvider };
@@ -144,7 +144,7 @@ const useStytchB2BClient = () => {
144
144
  const withStytchB2BClient = (Component) => {
145
145
  const WithStytch = (props) => {
146
146
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytchB2BClient', 'StytchB2BProvider'));
147
- return React__default['default'].createElement(Component, Object.assign({}, props, { stytch: useStytchB2BClient() }));
147
+ return React__default["default"].createElement(Component, Object.assign({}, props, { stytch: useStytchB2BClient() }));
148
148
  };
149
149
  WithStytch.displayName = `withStytch(${Component.displayName || Component.name || 'Component'})`;
150
150
  return WithStytch;
@@ -153,7 +153,7 @@ const withStytchMember = (Component) => {
153
153
  const WithStytchUser = (props) => {
154
154
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytchMember', 'StytchB2BProvider'));
155
155
  const { member, isInitialized, fromCache } = useStytchMember();
156
- return (React__default['default'].createElement(Component, Object.assign({}, props, { stytchMember: member, stytchMemberIsInitialized: isInitialized, stytchMemberIsFromCache: fromCache })));
156
+ return (React__default["default"].createElement(Component, Object.assign({}, props, { stytchMember: member, stytchMemberIsInitialized: isInitialized, stytchMemberIsFromCache: fromCache })));
157
157
  };
158
158
  WithStytchUser.displayName = `withStytchMember(${Component.displayName || Component.name || 'Component'})`;
159
159
  return WithStytchUser;
@@ -162,7 +162,7 @@ const withStytchMemberSession = (Component) => {
162
162
  const WithStytchSession = (props) => {
163
163
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytchMemberSession', 'StytchB2BProvider'));
164
164
  const { session, isInitialized, fromCache } = useStytchMemberSession();
165
- return (React__default['default'].createElement(Component, Object.assign({}, props, { stytchMemberSession: session, stytchMemberSessionIsInitialized: isInitialized, stytchMemberSessionIsFromCache: fromCache })));
165
+ return (React__default["default"].createElement(Component, Object.assign({}, props, { stytchMemberSession: session, stytchMemberSessionIsInitialized: isInitialized, stytchMemberSessionIsFromCache: fromCache })));
166
166
  };
167
167
  WithStytchSession.displayName = `withStytchMemberSession(${Component.displayName || Component.name || 'Component'})`;
168
168
  return WithStytchSession;
@@ -171,7 +171,7 @@ const withStytchOrganization = (Component) => {
171
171
  const WithStytchOrganization = (props) => {
172
172
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytchOrganization', 'StytchB2BProvider'));
173
173
  const { organization, isInitialized, fromCache } = useStytchOrganization();
174
- return (React__default['default'].createElement(Component, Object.assign({}, props, { stytchOrganization: organization, stytchOrganizationIsInitialized: isInitialized, stytchOrganizationIsFromCache: fromCache })));
174
+ return (React__default["default"].createElement(Component, Object.assign({}, props, { stytchOrganization: organization, stytchOrganizationIsInitialized: isInitialized, stytchOrganizationIsFromCache: fromCache })));
175
175
  };
176
176
  WithStytchOrganization.displayName = `withStytchOrganization(${Component.displayName || Component.name || 'Component'})`;
177
177
  return WithStytchOrganization;
@@ -211,7 +211,7 @@ const withStytchPermissions = (Component) => {
211
211
  if (!permissions.loaded) {
212
212
  return null;
213
213
  }
214
- return React__default['default'].createElement(Component, Object.assign({}, props, { stytchPermissions: permissions.value }));
214
+ return React__default["default"].createElement(Component, Object.assign({}, props, { stytchPermissions: permissions.value }));
215
215
  };
216
216
  WithStytchPermissions.displayName = `withStytchPermissions(${Component.displayName || Component.name || 'Component'})`;
217
217
  return WithStytchPermissions;
@@ -228,7 +228,7 @@ const withStytchPermissions = (Component) => {
228
228
  * </StytchB2BProvider>
229
229
  * )
230
230
  */
231
- const StytchB2BProvider = ({ stytch, children }) => {
231
+ const StytchB2BProvider = ({ stytch, children, }) => {
232
232
  const ctx = React.useMemo(() => ({ client: stytch, isMounted: true }), [stytch]);
233
233
  const [{ member, session, organization }, setClientState] = async.useAsyncState({
234
234
  member: initialMember,
@@ -255,10 +255,10 @@ const StytchB2BProvider = ({ stytch, children }) => {
255
255
  });
256
256
  });
257
257
  }, [setClientState, stytch]);
258
- return (React__default['default'].createElement(StytchContext.Provider, { value: ctx },
259
- React__default['default'].createElement(StytchOrganizationContext.Provider, { value: organization },
260
- React__default['default'].createElement(StytchMemberContext.Provider, { value: member },
261
- React__default['default'].createElement(StytchMemberSessionContext.Provider, { value: session }, children)))));
258
+ return (React__default["default"].createElement(StytchContext.Provider, { value: ctx },
259
+ React__default["default"].createElement(StytchOrganizationContext.Provider, { value: organization },
260
+ React__default["default"].createElement(StytchMemberContext.Provider, { value: member },
261
+ React__default["default"].createElement(StytchMemberSessionContext.Provider, { value: session }, children)))));
262
262
  };
263
263
 
264
264
  exports.StytchB2BProvider = StytchB2BProvider;
@@ -1,43 +1,44 @@
1
1
  /// <reference types="react" />
2
2
  import { AdminPortalSSOMountOptions, AdminPortalOrgSettingsMountOptions, AdminPortalMemberManagementMountOptions, AdminPortalSCIMMountOptions } from "@stytch/vanilla-js/b2b/adminPortal";
3
- import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
4
- interface InjectedOptions {
5
- client: StytchB2BHeadlessClient;
3
+ import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from "@stytch/vanilla-js/b2b/headless";
4
+ import { StytchProjectConfigurationInput as StytchProjectConfigurationInput$0 } from "@stytch/vanilla-js";
5
+ interface InjectedOptions<TProjectConfiguration extends StytchProjectConfigurationInput> {
6
+ client: StytchB2BHeadlessClient<TProjectConfiguration>;
6
7
  element: HTMLElement;
7
8
  }
8
- type ExcludeInjectedOptions<T> = Omit<T, keyof InjectedOptions>;
9
- type AdminPortalSSOProps = ExcludeInjectedOptions<AdminPortalSSOMountOptions>;
9
+ type ExcludeInjectedOptions<T> = Omit<T, keyof InjectedOptions<StytchProjectConfigurationInput>>;
10
+ type AdminPortalSSOProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalSSOMountOptions<TProjectConfiguration>>;
10
11
  /**
11
12
  * The Admin Portal SSO UI component.
12
13
  * This component must be rendered within a {@link StytchB2BProvider}.
13
14
  *
14
15
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
15
16
  */
16
- declare const AdminPortalSSO: (props: ExcludeInjectedOptions<AdminPortalSSOMountOptions>) => JSX.Element;
17
- type AdminPortalOrgSettingsProps = ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions>;
17
+ declare const AdminPortalSSO: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalSSOMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
18
+ type AdminPortalOrgSettingsProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions<TProjectConfiguration>>;
18
19
  /**
19
20
  * The Admin Portal Organization Settings UI component.
20
21
  * This component must be rendered within a {@link StytchB2BProvider}.
21
22
  *
22
23
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
23
24
  */
24
- declare const AdminPortalOrgSettings: (props: ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions>) => JSX.Element;
25
- type AdminPortalMemberManagementProps = ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions>;
25
+ declare const AdminPortalOrgSettings: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
26
+ type AdminPortalMemberManagementProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions<TProjectConfiguration>>;
26
27
  /**
27
28
  * The Admin Portal member management UI component.
28
29
  * This component must be rendered within a {@link StytchB2BProvider}.
29
30
  *
30
31
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
31
32
  */
32
- declare const AdminPortalMemberManagement: (props: ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions>) => JSX.Element;
33
- type AdminPortalSCIMProps = ExcludeInjectedOptions<AdminPortalSCIMMountOptions>;
33
+ declare const AdminPortalMemberManagement: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
34
+ type AdminPortalSCIMProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalSCIMMountOptions<TProjectConfiguration>>;
34
35
  /**
35
36
  * The Admin Portal SCIM UI component.
36
37
  * This component must be rendered within a {@link StytchB2BProvider}.
37
38
  *
38
39
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
39
40
  */
40
- declare const AdminPortalSCIM: (props: ExcludeInjectedOptions<import("vanilla-js/dist/adminPortal/makeAdminPortalComponentMountFn").AdminPortalComponentMountOptions>) => JSX.Element;
41
+ declare const AdminPortalSCIM: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalSCIMMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
41
42
  export { AdminPortalSSO, AdminPortalOrgSettings, AdminPortalMemberManagement, AdminPortalSCIM };
42
43
  export { AdminPortalB2BProducts } from "@stytch/vanilla-js/b2b/adminPortal";
43
44
  export type { AdminPortalSSOProps, AdminPortalOrgSettingsProps, AdminPortalMemberManagementProps, AdminPortalSCIMProps };
@@ -1,43 +1,44 @@
1
1
  /// <reference types="react" />
2
2
  import { AdminPortalSSOMountOptions, AdminPortalOrgSettingsMountOptions, AdminPortalMemberManagementMountOptions, AdminPortalSCIMMountOptions } from "@stytch/vanilla-js/b2b/adminPortal";
3
- import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
4
- interface InjectedOptions {
5
- client: StytchB2BHeadlessClient;
3
+ import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from "@stytch/vanilla-js/b2b/headless";
4
+ import { StytchProjectConfigurationInput as StytchProjectConfigurationInput$0 } from "@stytch/vanilla-js";
5
+ interface InjectedOptions<TProjectConfiguration extends StytchProjectConfigurationInput> {
6
+ client: StytchB2BHeadlessClient<TProjectConfiguration>;
6
7
  element: HTMLElement;
7
8
  }
8
- type ExcludeInjectedOptions<T> = Omit<T, keyof InjectedOptions>;
9
- type AdminPortalSSOProps = ExcludeInjectedOptions<AdminPortalSSOMountOptions>;
9
+ type ExcludeInjectedOptions<T> = Omit<T, keyof InjectedOptions<StytchProjectConfigurationInput>>;
10
+ type AdminPortalSSOProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalSSOMountOptions<TProjectConfiguration>>;
10
11
  /**
11
12
  * The Admin Portal SSO UI component.
12
13
  * This component must be rendered within a {@link StytchB2BProvider}.
13
14
  *
14
15
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
15
16
  */
16
- declare const AdminPortalSSO: (props: ExcludeInjectedOptions<AdminPortalSSOMountOptions>) => JSX.Element;
17
- type AdminPortalOrgSettingsProps = ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions>;
17
+ declare const AdminPortalSSO: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalSSOMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
18
+ type AdminPortalOrgSettingsProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions<TProjectConfiguration>>;
18
19
  /**
19
20
  * The Admin Portal Organization Settings UI component.
20
21
  * This component must be rendered within a {@link StytchB2BProvider}.
21
22
  *
22
23
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
23
24
  */
24
- declare const AdminPortalOrgSettings: (props: ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions>) => JSX.Element;
25
- type AdminPortalMemberManagementProps = ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions>;
25
+ declare const AdminPortalOrgSettings: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalOrgSettingsMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
26
+ type AdminPortalMemberManagementProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions<TProjectConfiguration>>;
26
27
  /**
27
28
  * The Admin Portal member management UI component.
28
29
  * This component must be rendered within a {@link StytchB2BProvider}.
29
30
  *
30
31
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
31
32
  */
32
- declare const AdminPortalMemberManagement: (props: ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions>) => JSX.Element;
33
- type AdminPortalSCIMProps = ExcludeInjectedOptions<AdminPortalSCIMMountOptions>;
33
+ declare const AdminPortalMemberManagement: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalMemberManagementMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
34
+ type AdminPortalSCIMProps<TProjectConfiguration extends StytchProjectConfigurationInput$0 = Stytch.DefaultProjectConfiguration> = ExcludeInjectedOptions<AdminPortalSCIMMountOptions<TProjectConfiguration>>;
34
35
  /**
35
36
  * The Admin Portal SCIM UI component.
36
37
  * This component must be rendered within a {@link StytchB2BProvider}.
37
38
  *
38
39
  * See the {@link https://stytch.com/docs/b2b/sdks/javascript-sdk online reference}
39
40
  */
40
- declare const AdminPortalSCIM: (props: ExcludeInjectedOptions<import("vanilla-js/dist/adminPortal/makeAdminPortalComponentMountFn").AdminPortalComponentMountOptions>) => JSX.Element;
41
+ declare const AdminPortalSCIM: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(props: ExcludeInjectedOptions<AdminPortalSCIMMountOptions<Partial<import("@stytch/core/public").StytchProjectConfiguration>>>) => JSX.Element;
41
42
  export { AdminPortalSSO, AdminPortalOrgSettings, AdminPortalMemberManagement, AdminPortalSCIM };
42
43
  export { AdminPortalB2BProducts } from "@stytch/vanilla-js/b2b/adminPortal";
43
44
  export type { AdminPortalSSOProps, AdminPortalOrgSettingsProps, AdminPortalMemberManagementProps, AdminPortalSCIMProps };
@@ -1,13 +1,13 @@
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, useLayoutEffect } from 'react';
4
- import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-162fadb4.js';
4
+ import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-72d99610.js';
5
5
  import { n as noProviderError } from '../StytchSSRProxy-14916009.js';
6
6
  import { i as invariant } from '../async-b1e10055.js';
7
7
 
8
8
  const makeAdminPortalComponent = (mountFn, componentName) => {
9
9
  const Component = (props) => {
10
- invariant(useIsMounted__INTERNAL(), noProviderError(`<${componentName} />`));
10
+ invariant(useIsMounted__INTERNAL(), noProviderError(`<${componentName} />`, 'StytchB2BProvider'));
11
11
  const stytchClient = useStytchB2BClient();
12
12
  const containerEl = useRef(null);
13
13
  useLayoutEffect(() => {
@@ -4,7 +4,7 @@ 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-82437b10.js');
7
+ var StytchB2BContext = require('../StytchB2BContext-8246a922.js');
8
8
  var StytchSSRProxy = require('../StytchSSRProxy-63bc6323.js');
9
9
  var async = require('../async-86a7f0d6.js');
10
10
 
@@ -14,7 +14,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
14
 
15
15
  const makeAdminPortalComponent = (mountFn, componentName) => {
16
16
  const Component = (props) => {
17
- async.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError(`<${componentName} />`));
17
+ async.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError(`<${componentName} />`, 'StytchB2BProvider'));
18
18
  const stytchClient = StytchB2BContext.useStytchB2BClient();
19
19
  const containerEl = React.useRef(null);
20
20
  React.useLayoutEffect(() => {
@@ -23,7 +23,7 @@ const makeAdminPortalComponent = (mountFn, componentName) => {
23
23
  }
24
24
  mountFn(Object.assign(Object.assign({}, props), { client: stytchClient, element: containerEl.current }));
25
25
  }, [stytchClient, props]);
26
- return React__default['default'].createElement("div", { ref: containerEl });
26
+ return React__default["default"].createElement("div", { ref: containerEl });
27
27
  };
28
28
  return Component;
29
29
  };
@@ -62,9 +62,7 @@ const AdminPortalSCIM = makeAdminPortalComponent(adminPortal.mountAdminPortalSCI
62
62
 
63
63
  Object.defineProperty(exports, 'AdminPortalB2BProducts', {
64
64
  enumerable: true,
65
- get: function () {
66
- return adminPortal.AdminPortalB2BProducts;
67
- }
65
+ get: function () { return adminPortal.AdminPortalB2BProducts; }
68
66
  });
69
67
  exports.AdminPortalMemberManagement = AdminPortalMemberManagement;
70
68
  exports.AdminPortalOrgSettings = AdminPortalOrgSettings;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import React from "react";
3
- import { Callbacks, StyleConfig, StytchB2BUIConfig } from "@stytch/vanilla-js";
4
- interface StytchB2BProps {
3
+ import { Callbacks, StyleConfig, StytchB2BUIConfig, StytchProjectConfigurationInput } from "@stytch/vanilla-js";
4
+ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
5
5
  /**
6
6
  * An optional {@link StyleConfig} to customize the look and feel of the screen.
7
7
  *
@@ -32,7 +32,7 @@ interface StytchB2BProps {
32
32
  * }
33
33
  * }
34
34
  */
35
- callbacks?: Callbacks;
35
+ callbacks?: Callbacks<TProjectConfiguration>;
36
36
  /**
37
37
  * A {@link StytchB2BUIConfig} object. Add products and product-specific config to this object to change the login methods shown.
38
38
  *
@@ -102,7 +102,7 @@ interface StytchB2BProps {
102
102
  * />
103
103
  * @param props {@link StytchB2BProps}
104
104
  */
105
- declare const StytchB2B: ({ styles, callbacks, config }: StytchB2BProps) => React.JSX.Element;
106
- export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-82437b10.js";
105
+ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ styles, callbacks, config }: StytchB2BProps<TProjectConfiguration>) => React.JSX.Element;
106
+ export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-8246a922.js";
107
107
  export { StytchB2B };
108
- export type { StytchB2BProviderProps } from "../StytchB2BContext-82437b10.js";
108
+ export type { StytchB2BProviderProps } from "../StytchB2BContext-8246a922.js";
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import React from "react";
3
- import { Callbacks, StyleConfig, StytchB2BUIConfig } from "@stytch/vanilla-js";
4
- interface StytchB2BProps {
3
+ import { Callbacks, StyleConfig, StytchB2BUIConfig, StytchProjectConfigurationInput } from "@stytch/vanilla-js";
4
+ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
5
5
  /**
6
6
  * An optional {@link StyleConfig} to customize the look and feel of the screen.
7
7
  *
@@ -32,7 +32,7 @@ interface StytchB2BProps {
32
32
  * }
33
33
  * }
34
34
  */
35
- callbacks?: Callbacks;
35
+ callbacks?: Callbacks<TProjectConfiguration>;
36
36
  /**
37
37
  * A {@link StytchB2BUIConfig} object. Add products and product-specific config to this object to change the login methods shown.
38
38
  *
@@ -102,7 +102,7 @@ interface StytchB2BProps {
102
102
  * />
103
103
  * @param props {@link StytchB2BProps}
104
104
  */
105
- declare const StytchB2B: ({ styles, callbacks, config }: StytchB2BProps) => React.JSX.Element;
106
- export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-162fadb4.js";
105
+ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ styles, callbacks, config }: StytchB2BProps<TProjectConfiguration>) => React.JSX.Element;
106
+ export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-72d99610.js";
107
107
  export { StytchB2B };
108
- export type { StytchB2BProviderProps } from "../StytchB2BContext-162fadb4.js";
108
+ export type { StytchB2BProviderProps } from "../StytchB2BContext-72d99610.js";
@@ -1,5 +1,5 @@
1
- import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient } from '../StytchB2BContext-162fadb4.js';
2
- export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized, c as useStytchMember, b as useStytchMemberSession, e as useStytchOrganization, w as withStytchB2BClient, g as withStytchMember, f as withStytchMemberSession, h as withStytchOrganization, j as withStytchPermissions } from '../StytchB2BContext-162fadb4.js';
1
+ import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient } from '../StytchB2BContext-72d99610.js';
2
+ export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized, c as useStytchMember, b as useStytchMemberSession, e as useStytchOrganization, w as withStytchB2BClient, g as withStytchMember, f as withStytchMemberSession, h as withStytchOrganization, j as withStytchPermissions } from '../StytchB2BContext-72d99610.js';
3
3
  import React, { useRef, useLayoutEffect } from 'react';
4
4
  import { i as invariant } from '../async-b1e10055.js';
5
5
  import { a as noHeadlessClientError, n as noProviderError } from '../StytchSSRProxy-14916009.js';
@@ -38,8 +38,8 @@ import { a as noHeadlessClientError, n as noProviderError } from '../StytchSSRPr
38
38
  * />
39
39
  * @param props {@link StytchB2BProps}
40
40
  */
41
- const StytchB2B = ({ styles, callbacks, config }) => {
42
- invariant(useIsMounted__INTERNAL(), noProviderError('<StytchB2B />'));
41
+ const StytchB2B = ({ styles, callbacks, config, }) => {
42
+ invariant(useIsMounted__INTERNAL(), noProviderError('<StytchB2B />', 'StytchB2BProvider'));
43
43
  const stytchClient = useStytchB2BClient();
44
44
  const containerEl = useRef(null);
45
45
  useLayoutEffect(() => {
@@ -12,5 +12,5 @@ import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
12
12
  * )
13
13
  * @returns A {@link StytchB2BHeadlessClient}
14
14
  */
15
- declare const createStytchB2BHeadlessClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient;
15
+ declare const createStytchB2BHeadlessClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient<TProjectConfiguration>;
16
16
  export { createStytchB2BHeadlessClient };
@@ -12,5 +12,5 @@ import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
12
12
  * )
13
13
  * @returns A {@link StytchB2BHeadlessClient}
14
14
  */
15
- declare const createStytchB2BHeadlessClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient;
15
+ declare const createStytchB2BHeadlessClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BHeadlessClient<TProjectConfiguration>;
16
16
  export { createStytchB2BHeadlessClient };
package/dist/b2b/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var StytchB2BContext = require('../StytchB2BContext-82437b10.js');
5
+ var StytchB2BContext = require('../StytchB2BContext-8246a922.js');
6
6
  var React = require('react');
7
7
  var async = require('../async-86a7f0d6.js');
8
8
  var StytchSSRProxy = require('../StytchSSRProxy-63bc6323.js');
@@ -45,8 +45,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
45
45
  * />
46
46
  * @param props {@link StytchB2BProps}
47
47
  */
48
- const StytchB2B = ({ styles, callbacks, config }) => {
49
- async.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<StytchB2B />'));
48
+ const StytchB2B = ({ styles, callbacks, config, }) => {
49
+ async.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<StytchB2B />', 'StytchB2BProvider'));
50
50
  const stytchClient = StytchB2BContext.useStytchB2BClient();
51
51
  const containerEl = React.useRef(null);
52
52
  React.useLayoutEffect(() => {
@@ -68,7 +68,7 @@ const StytchB2B = ({ styles, callbacks, config }) => {
68
68
  });
69
69
  // eslint-disable-next-line react-hooks/exhaustive-deps -- SDK-1354
70
70
  }, [stytchClient, styles, callbacks]);
71
- return React__default['default'].createElement("div", { ref: containerEl });
71
+ return React__default["default"].createElement("div", { ref: containerEl });
72
72
  };
73
73
 
74
74
  exports.StytchB2BProvider = StytchB2BContext.StytchB2BProvider;
@@ -13,5 +13,5 @@ import { StytchB2BUIClient } from "@stytch/vanilla-js/b2b";
13
13
  * )
14
14
  * @returns A {@link StytchB2BUIClient}
15
15
  */
16
- declare const createStytchB2BUIClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BUIClient;
16
+ declare const createStytchB2BUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BUIClient<TProjectConfiguration>;
17
17
  export { createStytchB2BUIClient };
@@ -13,5 +13,5 @@ import { StytchB2BUIClient } from "@stytch/vanilla-js/b2b";
13
13
  * )
14
14
  * @returns A {@link StytchB2BUIClient}
15
15
  */
16
- declare const createStytchB2BUIClient: (_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BUIClient;
16
+ declare const createStytchB2BUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchB2BUIClient<TProjectConfiguration>;
17
17
  export { createStytchB2BUIClient };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import React from "react";
3
3
  import { ReactNode } from "react";
4
- import { User, Session, StytchUIClient, Callbacks, StytchLoginConfig, StyleConfig } from "@stytch/vanilla-js";
4
+ import { User, Session, StytchUIClient, StytchProjectConfigurationInput, Callbacks, StytchLoginConfig, StyleConfig } from "@stytch/vanilla-js";
5
5
  import { StytchHeadlessClient } from "@stytch/vanilla-js/headless";
6
6
  /**
7
7
  * The Stytch Client object passed in to <StytchProvider /> in your `_app.js`.
8
8
  * Either a StytchUIClient or StytchHeadlessClient.
9
9
  */
10
- type StytchClient = StytchUIClient | StytchHeadlessClient;
10
+ type StytchClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchUIClient<TProjectConfiguration> | StytchHeadlessClient<TProjectConfiguration>;
11
11
  type SWRUser = {
12
12
  user: null;
13
13
  fromCache: false;
@@ -67,9 +67,9 @@ declare const useStytchSession: () => SWRSession;
67
67
  * stytch.magicLinks.authenticate('...')
68
68
  * }, [stytch]);
69
69
  */
70
- declare const useStytch: () => StytchClient;
71
- declare const withStytch: <T extends object>(Component: React.ComponentType<T & {
72
- stytch: StytchClient;
70
+ declare const useStytch: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>() => StytchClient<TProjectConfiguration>;
71
+ declare const withStytch: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(Component: React.ComponentType<T & {
72
+ stytch: StytchClient<TProjectConfiguration>;
73
73
  }>) => React.ComponentType<T>;
74
74
  declare const withStytchUser: <T extends object>(Component: React.ComponentType<T & {
75
75
  stytchUser: User | null;
@@ -81,11 +81,11 @@ declare const withStytchSession: <T extends object>(Component: React.ComponentTy
81
81
  stytchSessionIsInitialized: boolean;
82
82
  stytchSessionIsFromCache: boolean;
83
83
  }>) => React.ComponentType<T>;
84
- interface StytchProviderProps {
84
+ interface StytchProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
85
85
  /**
86
86
  * A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
87
87
  */
88
- stytch: StytchClient;
88
+ stytch: StytchClient<TProjectConfiguration>;
89
89
  children?: ReactNode;
90
90
  }
91
91
  /**
@@ -100,8 +100,8 @@ interface StytchProviderProps {
100
100
  * </StytchProvider>
101
101
  * )
102
102
  */
103
- declare const StytchProvider: ({ stytch, children }: StytchProviderProps) => JSX.Element;
104
- interface StytchProps {
103
+ declare const StytchProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children }: StytchProviderProps<TProjectConfiguration>) => JSX.Element;
104
+ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
105
105
  /**
106
106
  * A {@link StytchLoginConfig} object. Add products and product-specific config to this object to change the login methods shown.
107
107
  *
@@ -163,7 +163,7 @@ interface StytchProps {
163
163
  * }
164
164
  * }
165
165
  */
166
- callbacks?: Callbacks;
166
+ callbacks?: Callbacks<TProjectConfiguration>;
167
167
  }
168
168
  /**
169
169
  * The Stytch Login Screen component.
@@ -199,8 +199,8 @@ interface StytchProps {
199
199
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
200
200
  * @param callbacks - An optional {@link Callbacks} object
201
201
  */
202
- declare const StytchLogin: ({ config, styles, callbacks }: StytchProps) => React.JSX.Element;
203
- interface StytchResetPasswordProps extends StytchProps {
202
+ declare const StytchLogin: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
203
+ interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
204
204
  passwordResetToken: string;
205
205
  }
206
206
  /**
@@ -239,7 +239,7 @@ interface StytchResetPasswordProps extends StytchProps {
239
239
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
240
240
  * @param callbacks - An optional {@link Callbacks} object
241
241
  */
242
- declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps) => React.JSX.Element;
242
+ declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps<TProjectConfiguration>) => React.JSX.Element;
243
243
  /**
244
244
  * The Stytch Passkey Registration component.
245
245
  * This component can only be used with a {@link StytchUIClient} client constructor
@@ -270,6 +270,6 @@ declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetTo
270
270
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
271
271
  * @param callbacks - An optional {@link Callbacks} object
272
272
  */
273
- declare const StytchPasskeyRegistration: ({ config, styles, callbacks }: StytchProps) => React.JSX.Element;
273
+ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
274
274
  export { StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, StytchLogin, StytchPasswordReset, StytchPasskeyRegistration };
275
275
  export type { StytchProviderProps };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import React from "react";
3
3
  import { ReactNode } from "react";
4
- import { User, Session, StytchUIClient, Callbacks, StytchLoginConfig, StyleConfig } from "@stytch/vanilla-js";
4
+ import { User, Session, StytchUIClient, StytchProjectConfigurationInput, Callbacks, StytchLoginConfig, StyleConfig } from "@stytch/vanilla-js";
5
5
  import { StytchHeadlessClient } from "@stytch/vanilla-js/headless";
6
6
  /**
7
7
  * The Stytch Client object passed in to <StytchProvider /> in your `_app.js`.
8
8
  * Either a StytchUIClient or StytchHeadlessClient.
9
9
  */
10
- type StytchClient = StytchUIClient | StytchHeadlessClient;
10
+ type StytchClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchUIClient<TProjectConfiguration> | StytchHeadlessClient<TProjectConfiguration>;
11
11
  type SWRUser = {
12
12
  user: null;
13
13
  fromCache: false;
@@ -67,9 +67,9 @@ declare const useStytchSession: () => SWRSession;
67
67
  * stytch.magicLinks.authenticate('...')
68
68
  * }, [stytch]);
69
69
  */
70
- declare const useStytch: () => StytchClient;
71
- declare const withStytch: <T extends object>(Component: React.ComponentType<T & {
72
- stytch: StytchClient;
70
+ declare const useStytch: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>() => StytchClient<TProjectConfiguration>;
71
+ declare const withStytch: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(Component: React.ComponentType<T & {
72
+ stytch: StytchClient<TProjectConfiguration>;
73
73
  }>) => React.ComponentType<T>;
74
74
  declare const withStytchUser: <T extends object>(Component: React.ComponentType<T & {
75
75
  stytchUser: User | null;
@@ -81,11 +81,11 @@ declare const withStytchSession: <T extends object>(Component: React.ComponentTy
81
81
  stytchSessionIsInitialized: boolean;
82
82
  stytchSessionIsFromCache: boolean;
83
83
  }>) => React.ComponentType<T>;
84
- interface StytchProviderProps {
84
+ interface StytchProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
85
85
  /**
86
86
  * A Stytch client instance, created using either {@link createStytchHeadlessClient} or {@link createStytchUIClient}
87
87
  */
88
- stytch: StytchClient;
88
+ stytch: StytchClient<TProjectConfiguration>;
89
89
  children?: ReactNode;
90
90
  }
91
91
  /**
@@ -100,8 +100,8 @@ interface StytchProviderProps {
100
100
  * </StytchProvider>
101
101
  * )
102
102
  */
103
- declare const StytchProvider: ({ stytch, children }: StytchProviderProps) => JSX.Element;
104
- interface StytchProps {
103
+ declare const StytchProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children }: StytchProviderProps<TProjectConfiguration>) => JSX.Element;
104
+ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
105
105
  /**
106
106
  * A {@link StytchLoginConfig} object. Add products and product-specific config to this object to change the login methods shown.
107
107
  *
@@ -163,7 +163,7 @@ interface StytchProps {
163
163
  * }
164
164
  * }
165
165
  */
166
- callbacks?: Callbacks;
166
+ callbacks?: Callbacks<TProjectConfiguration>;
167
167
  }
168
168
  /**
169
169
  * The Stytch Login Screen component.
@@ -199,8 +199,8 @@ interface StytchProps {
199
199
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
200
200
  * @param callbacks - An optional {@link Callbacks} object
201
201
  */
202
- declare const StytchLogin: ({ config, styles, callbacks }: StytchProps) => React.JSX.Element;
203
- interface StytchResetPasswordProps extends StytchProps {
202
+ declare const StytchLogin: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
203
+ interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
204
204
  passwordResetToken: string;
205
205
  }
206
206
  /**
@@ -239,7 +239,7 @@ interface StytchResetPasswordProps extends StytchProps {
239
239
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
240
240
  * @param callbacks - An optional {@link Callbacks} object
241
241
  */
242
- declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps) => React.JSX.Element;
242
+ declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps<TProjectConfiguration>) => React.JSX.Element;
243
243
  /**
244
244
  * The Stytch Passkey Registration component.
245
245
  * This component can only be used with a {@link StytchUIClient} client constructor
@@ -270,6 +270,6 @@ declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetTo
270
270
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
271
271
  * @param callbacks - An optional {@link Callbacks} object
272
272
  */
273
- declare const StytchPasskeyRegistration: ({ config, styles, callbacks }: StytchProps) => React.JSX.Element;
273
+ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
274
274
  export { StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, StytchLogin, StytchPasswordReset, StytchPasskeyRegistration };
275
275
  export type { StytchProviderProps };
package/dist/index.esm.js CHANGED
@@ -109,7 +109,7 @@ const withStytchSession = (Component) => {
109
109
  * </StytchProvider>
110
110
  * )
111
111
  */
112
- const StytchProvider = ({ stytch, children }) => {
112
+ const StytchProvider = ({ stytch, children, }) => {
113
113
  const ctx = useMemo(() => ({ client: stytch, isMounted: true }), [stytch]);
114
114
  const [{ user, session }, setClientState] = useAsyncState({
115
115
  session: initialSession,
@@ -175,7 +175,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffec
175
175
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
176
176
  * @param callbacks - An optional {@link Callbacks} object
177
177
  */
178
- const StytchLogin = ({ config, styles, callbacks }) => {
178
+ const StytchLogin = ({ config, styles, callbacks, }) => {
179
179
  invariant(useIsMounted__INTERNAL(), noProviderError('<StytchLogin />'));
180
180
  const stytchClient = useStytch();
181
181
  const containerEl = useRef(null);
@@ -235,7 +235,7 @@ const StytchLogin = ({ config, styles, callbacks }) => {
235
235
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
236
236
  * @param callbacks - An optional {@link Callbacks} object
237
237
  */
238
- const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken }) => {
238
+ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, }) => {
239
239
  invariant(useIsMounted__INTERNAL(), noProviderError('<StytchResetPassword />'));
240
240
  const stytchClient = useStytch();
241
241
  const containerEl = useRef(null);
@@ -292,7 +292,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
292
292
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
293
293
  * @param callbacks - An optional {@link Callbacks} object
294
294
  */
295
- const StytchPasskeyRegistration = ({ config, styles, callbacks }) => {
295
+ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
296
296
  invariant(useIsMounted__INTERNAL(), noProviderError('<StytchPasskeyRegistration />'));
297
297
  const stytchClient = useStytch();
298
298
  const containerEl = useRef(null);
@@ -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, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchHeadlessClient;
15
+ declare const createStytchHeadlessClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchHeadlessClient<TProjectConfiguration>;
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, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchHeadlessClient;
15
+ declare const createStytchHeadlessClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchHeadlessClient<TProjectConfiguration>;
16
16
  export { createStytchHeadlessClient };
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ const useStytch = () => {
82
82
  const withStytch = (Component) => {
83
83
  const WithStytch = (props) => {
84
84
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytch'));
85
- return React__default['default'].createElement(Component, Object.assign({}, props, { stytch: useStytch() }));
85
+ return React__default["default"].createElement(Component, Object.assign({}, props, { stytch: useStytch() }));
86
86
  };
87
87
  WithStytch.displayName = `withStytch(${Component.displayName || Component.name || 'Component'})`;
88
88
  return WithStytch;
@@ -91,7 +91,7 @@ const withStytchUser = (Component) => {
91
91
  const WithStytchUser = (props) => {
92
92
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytchUser'));
93
93
  const { user, isInitialized, fromCache } = useStytchUser();
94
- return (React__default['default'].createElement(Component, Object.assign({}, props, { stytchUser: user, stytchUserIsInitialized: isInitialized, stytchUserIsFromCache: fromCache })));
94
+ return (React__default["default"].createElement(Component, Object.assign({}, props, { stytchUser: user, stytchUserIsInitialized: isInitialized, stytchUserIsFromCache: fromCache })));
95
95
  };
96
96
  WithStytchUser.displayName = `withStytchUser(${Component.displayName || Component.name || 'Component'})`;
97
97
  return WithStytchUser;
@@ -100,7 +100,7 @@ const withStytchSession = (Component) => {
100
100
  const WithStytchSession = (props) => {
101
101
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('withStytchSession'));
102
102
  const { session, isInitialized, fromCache } = useStytchSession();
103
- return (React__default['default'].createElement(Component, Object.assign({}, props, { stytchSession: session, stytchSessionIsInitialized: isInitialized, stytchSessionIsFromCache: fromCache })));
103
+ return (React__default["default"].createElement(Component, Object.assign({}, props, { stytchSession: session, stytchSessionIsInitialized: isInitialized, stytchSessionIsFromCache: fromCache })));
104
104
  };
105
105
  WithStytchSession.displayName = `withStytchSession(${Component.displayName || Component.name || 'Component'})`;
106
106
  return WithStytchSession;
@@ -117,7 +117,7 @@ const withStytchSession = (Component) => {
117
117
  * </StytchProvider>
118
118
  * )
119
119
  */
120
- const StytchProvider = ({ stytch, children }) => {
120
+ const StytchProvider = ({ stytch, children, }) => {
121
121
  const ctx = React.useMemo(() => ({ client: stytch, isMounted: true }), [stytch]);
122
122
  const [{ user, session }, setClientState] = async.useAsyncState({
123
123
  session: initialSession,
@@ -141,9 +141,9 @@ const StytchProvider = ({ stytch, children }) => {
141
141
  });
142
142
  });
143
143
  }, [setClientState, stytch]);
144
- return (React__default['default'].createElement(StytchContext.Provider, { value: ctx },
145
- React__default['default'].createElement(StytchUserContext.Provider, { value: user },
146
- React__default['default'].createElement(StytchSessionContext.Provider, { value: session }, children))));
144
+ return (React__default["default"].createElement(StytchContext.Provider, { value: ctx },
145
+ React__default["default"].createElement(StytchUserContext.Provider, { value: user },
146
+ React__default["default"].createElement(StytchSessionContext.Provider, { value: session }, children))));
147
147
  };
148
148
 
149
149
  // cc https://medium.com/@alexandereardon/uselayouteffect-and-ssr-192986cdcf7a
@@ -183,7 +183,7 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayou
183
183
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
184
184
  * @param callbacks - An optional {@link Callbacks} object
185
185
  */
186
- const StytchLogin = ({ config, styles, callbacks }) => {
186
+ const StytchLogin = ({ config, styles, callbacks, }) => {
187
187
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<StytchLogin />'));
188
188
  const stytchClient = useStytch();
189
189
  const containerEl = React.useRef(null);
@@ -205,7 +205,7 @@ const StytchLogin = ({ config, styles, callbacks }) => {
205
205
  styles,
206
206
  });
207
207
  }, [stytchClient, config, styles, callbacks]);
208
- return React__default['default'].createElement("div", { ref: containerEl });
208
+ return React__default["default"].createElement("div", { ref: containerEl });
209
209
  };
210
210
  /**
211
211
  * The Stytch Reset Password component.
@@ -243,7 +243,7 @@ const StytchLogin = ({ config, styles, callbacks }) => {
243
243
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
244
244
  * @param callbacks - An optional {@link Callbacks} object
245
245
  */
246
- const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken }) => {
246
+ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, }) => {
247
247
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<StytchResetPassword />'));
248
248
  const stytchClient = useStytch();
249
249
  const containerEl = React.useRef(null);
@@ -268,7 +268,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
268
268
  });
269
269
  }
270
270
  }, [stytchClient, config, styles, callbacks, passwordResetToken]);
271
- return React__default['default'].createElement("div", { ref: containerEl });
271
+ return React__default["default"].createElement("div", { ref: containerEl });
272
272
  };
273
273
  /**
274
274
  * The Stytch Passkey Registration component.
@@ -300,7 +300,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
300
300
  * @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
301
301
  * @param callbacks - An optional {@link Callbacks} object
302
302
  */
303
- const StytchPasskeyRegistration = ({ config, styles, callbacks }) => {
303
+ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
304
304
  async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<StytchPasskeyRegistration />'));
305
305
  const stytchClient = useStytch();
306
306
  const containerEl = React.useRef(null);
@@ -323,7 +323,7 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks }) => {
323
323
  styles,
324
324
  });
325
325
  }, [stytchClient, config, styles, callbacks, user]);
326
- return React__default['default'].createElement("div", { ref: containerEl });
326
+ return React__default["default"].createElement("div", { ref: containerEl });
327
327
  };
328
328
 
329
329
  exports.StytchLogin = StytchLogin;
@@ -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, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchUIClient;
16
+ declare const createStytchUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchUIClient<TProjectConfiguration>;
17
17
  export { createStytchUIClient };
@@ -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, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchUIClient;
16
+ declare const createStytchUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(_PUBLIC_TOKEN: string, options?: import("@stytch/core/public").StytchClientOptions | undefined) => StytchUIClient<TProjectConfiguration>;
17
17
  export { createStytchUIClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stytch/nextjs",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "description": "Stytch's official Next.js Library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -23,13 +23,13 @@
23
23
  "devDependencies": {
24
24
  "@babel/runtime": "7.18.6",
25
25
  "@stytch/js-utils": "0.0.0",
26
- "@stytch/vanilla-js": "5.3.0",
26
+ "@stytch/vanilla-js": "5.11.0",
27
27
  "@testing-library/react": "14.0.0",
28
28
  "eslint-config-custom": "0.0.1",
29
29
  "react": "18.2.0",
30
30
  "react-dom": "18.2.0",
31
31
  "react-test-renderer": "18.0.0",
32
- "rollup": "2.56.3",
32
+ "rollup": "2.79.2",
33
33
  "typescript": "5.3.3"
34
34
  },
35
35
  "peerDependencies": {