@stytch/react 19.4.3 → 19.4.4
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 +7 -0
- package/dist/{StytchB2BContext-081081ee.d.ts → StytchB2BContext-09d376ba.d.ts} +12 -9
- package/dist/{StytchB2BContext-081081ee.js → StytchB2BContext-09d376ba.js} +9 -7
- package/dist/{StytchB2BContext-865b6947.d.ts → StytchB2BContext-a8d57249.d.ts} +12 -9
- package/dist/{StytchB2BContext-865b6947.js → StytchB2BContext-a8d57249.js} +9 -7
- package/dist/adminPortal/index.esm.js +1 -1
- package/dist/adminPortal/index.js +1 -1
- package/dist/b2b/index.d.ts +12 -15
- package/dist/b2b/index.esm.d.ts +12 -15
- package/dist/b2b/index.esm.js +8 -12
- package/dist/b2b/index.js +7 -11
- package/dist/index.d.ts +43 -24
- package/dist/index.esm.d.ts +43 -24
- package/dist/index.esm.js +41 -56
- package/dist/index.js +41 -56
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,8 @@ import { Member, MemberSession, Organization, StytchB2BUIClient } from '@stytch/
|
|
|
5
5
|
import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from '@stytch/vanilla-js/b2b/headless';
|
|
6
6
|
import { PermissionsMap } from '@stytch/core/public';
|
|
7
7
|
/**
|
|
8
|
-
* The Stytch Client object passed in to <
|
|
8
|
+
* The Stytch Client object passed in to <StytchB2BProvider /> in your application root.
|
|
9
|
+
* Either a StytchB2BUIClient or StytchB2BHeadlessClient.
|
|
9
10
|
*/
|
|
10
11
|
type StytchB2BClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchB2BHeadlessClient<TProjectConfiguration> | StytchB2BUIClient<TProjectConfiguration>;
|
|
11
12
|
type SWRMember = {
|
|
@@ -42,15 +43,17 @@ declare const useIsMounted__INTERNAL: () => boolean;
|
|
|
42
43
|
declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(client: StytchB2BClient<TProjectConfiguration>) => client is StytchB2BUIClient<TProjectConfiguration>;
|
|
43
44
|
/**
|
|
44
45
|
* Returns the active Member.
|
|
46
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
45
47
|
* Check the fromCache property to determine if the member data is from persistent storage.
|
|
46
48
|
* @example
|
|
47
49
|
* const {member} = useStytchMember();
|
|
48
50
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
49
|
-
* @returns A {@link SWRUser}
|
|
50
51
|
*/
|
|
51
52
|
declare const useStytchMember: () => SWRMember;
|
|
52
53
|
/**
|
|
53
54
|
* Returns the active member's Stytch member session.
|
|
55
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
56
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
54
57
|
* @example
|
|
55
58
|
* const { session } = useStytchMemberSession();
|
|
56
59
|
* useEffect(() => {
|
|
@@ -58,15 +61,15 @@ declare const useStytchMember: () => SWRMember;
|
|
|
58
61
|
* router.replace('/login')
|
|
59
62
|
* }
|
|
60
63
|
* }, [session]);
|
|
61
|
-
* @returns A {@link SWRMemberSession}
|
|
62
64
|
*/
|
|
63
65
|
declare const useStytchMemberSession: () => SWRMemberSession;
|
|
64
66
|
/**
|
|
65
67
|
* Returns the active Stytch organization.
|
|
68
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
69
|
+
* Check the fromCache property to determine if the organization data is from persistent storage.
|
|
66
70
|
* @example
|
|
67
71
|
* const { organization } = useStytchOrganization();
|
|
68
|
-
* return
|
|
69
|
-
* @returns A {@link SWROrganization}
|
|
72
|
+
* return (<p>Welcome to {organization.organization_name}</p>);
|
|
70
73
|
*/
|
|
71
74
|
declare const useStytchOrganization: () => SWROrganization;
|
|
72
75
|
type SWRIsAuthorized = {
|
|
@@ -141,16 +144,16 @@ declare const withStytchOrganization: <T extends object>(Component: React.Compon
|
|
|
141
144
|
declare const withStytchPermissions: <Permissions_1 extends Record<string, string>, T extends object>(Component: React.ComponentType<T & {
|
|
142
145
|
stytchPermissions: PermissionsMap<Permissions_1>;
|
|
143
146
|
}>) => React.ComponentType<T>;
|
|
144
|
-
|
|
147
|
+
interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
145
148
|
/**
|
|
146
|
-
* A Stytch client instance {@link StytchB2BHeadlessClient}
|
|
149
|
+
* A Stytch client instance, either a {@link StytchB2BUIClient} or {@link StytchB2BHeadlessClient}
|
|
147
150
|
*/
|
|
148
151
|
stytch: StytchB2BClient<TProjectConfiguration>;
|
|
149
152
|
children?: ReactNode;
|
|
150
|
-
}
|
|
153
|
+
}
|
|
151
154
|
/**
|
|
152
155
|
* The Stytch Context Provider.
|
|
153
|
-
* Wrap your application with this component in
|
|
156
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
154
157
|
* @example
|
|
155
158
|
* const stytch = new StytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
156
159
|
*
|
|
@@ -23,11 +23,11 @@ const isUIClient = (client) => {
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* Returns the active Member.
|
|
26
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
26
27
|
* Check the fromCache property to determine if the member data is from persistent storage.
|
|
27
28
|
* @example
|
|
28
29
|
* const {member} = useStytchMember();
|
|
29
30
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
30
|
-
* @returns A {@link SWRUser}
|
|
31
31
|
*/
|
|
32
32
|
const useStytchMember = () => {
|
|
33
33
|
invariant(useIsMounted__INTERNAL(), noProviderError('useStytchMember', 'StytchB2BProvider'));
|
|
@@ -35,6 +35,8 @@ const useStytchMember = () => {
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* Returns the active member's Stytch member session.
|
|
38
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
39
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
38
40
|
* @example
|
|
39
41
|
* const { session } = useStytchMemberSession();
|
|
40
42
|
* useEffect(() => {
|
|
@@ -42,7 +44,6 @@ const useStytchMember = () => {
|
|
|
42
44
|
* router.replace('/login')
|
|
43
45
|
* }
|
|
44
46
|
* }, [session]);
|
|
45
|
-
* @returns A {@link SWRMemberSession}
|
|
46
47
|
*/
|
|
47
48
|
const useStytchMemberSession = () => {
|
|
48
49
|
invariant(useIsMounted__INTERNAL(), noProviderError('useStytchMemberSession', 'StytchB2BProvider'));
|
|
@@ -50,10 +51,11 @@ const useStytchMemberSession = () => {
|
|
|
50
51
|
};
|
|
51
52
|
/**
|
|
52
53
|
* Returns the active Stytch organization.
|
|
54
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
55
|
+
* Check the fromCache property to determine if the organization data is from persistent storage.
|
|
53
56
|
* @example
|
|
54
57
|
* const { organization } = useStytchOrganization();
|
|
55
|
-
* return
|
|
56
|
-
* @returns A {@link SWROrganization}
|
|
58
|
+
* return (<p>Welcome to {organization.organization_name}</p>);
|
|
57
59
|
*/
|
|
58
60
|
const useStytchOrganization = () => {
|
|
59
61
|
invariant(useIsMounted__INTERNAL(), noProviderError('useStytchOrganization', 'StytchB2BProvider'));
|
|
@@ -115,7 +117,7 @@ const withStytchMember = (Component) => {
|
|
|
115
117
|
const { member, fromCache } = useStytchMember();
|
|
116
118
|
return React.createElement(Component, Object.assign({}, props, { stytchMember: member, stytchMemberIsFromCache: fromCache }));
|
|
117
119
|
};
|
|
118
|
-
WithStytchUser.displayName = `
|
|
120
|
+
WithStytchUser.displayName = `withStytchMember(${Component.displayName || Component.name || 'Component'})`;
|
|
119
121
|
return WithStytchUser;
|
|
120
122
|
};
|
|
121
123
|
const withStytchMemberSession = (Component) => {
|
|
@@ -124,7 +126,7 @@ const withStytchMemberSession = (Component) => {
|
|
|
124
126
|
const { session, fromCache } = useStytchMemberSession();
|
|
125
127
|
return React.createElement(Component, Object.assign({}, props, { stytchMemberSession: session, stytchMemberSessionIsFromCache: fromCache }));
|
|
126
128
|
};
|
|
127
|
-
WithStytchSession.displayName = `
|
|
129
|
+
WithStytchSession.displayName = `withStytchMemberSession(${Component.displayName || Component.name || 'Component'})`;
|
|
128
130
|
return WithStytchSession;
|
|
129
131
|
};
|
|
130
132
|
const withStytchOrganization = (Component) => {
|
|
@@ -178,7 +180,7 @@ const withStytchPermissions = (Component) => {
|
|
|
178
180
|
};
|
|
179
181
|
/**
|
|
180
182
|
* The Stytch Context Provider.
|
|
181
|
-
* Wrap your application with this component in
|
|
183
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
182
184
|
* @example
|
|
183
185
|
* const stytch = new StytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
184
186
|
*
|
|
@@ -5,7 +5,8 @@ import { Member, MemberSession, Organization, StytchB2BUIClient } from '@stytch/
|
|
|
5
5
|
import { StytchB2BHeadlessClient, StytchProjectConfigurationInput } from '@stytch/vanilla-js/b2b/headless';
|
|
6
6
|
import { PermissionsMap } from '@stytch/core/public';
|
|
7
7
|
/**
|
|
8
|
-
* The Stytch Client object passed in to <
|
|
8
|
+
* The Stytch Client object passed in to <StytchB2BProvider /> in your application root.
|
|
9
|
+
* Either a StytchB2BUIClient or StytchB2BHeadlessClient.
|
|
9
10
|
*/
|
|
10
11
|
type StytchB2BClient<TProjectConfiguration extends StytchProjectConfigurationInput> = StytchB2BHeadlessClient<TProjectConfiguration> | StytchB2BUIClient<TProjectConfiguration>;
|
|
11
12
|
type SWRMember = {
|
|
@@ -42,15 +43,17 @@ declare const useIsMounted__INTERNAL: () => boolean;
|
|
|
42
43
|
declare const isUIClient: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration>>(client: StytchB2BClient<TProjectConfiguration>) => client is StytchB2BUIClient<TProjectConfiguration>;
|
|
43
44
|
/**
|
|
44
45
|
* Returns the active Member.
|
|
46
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
45
47
|
* Check the fromCache property to determine if the member data is from persistent storage.
|
|
46
48
|
* @example
|
|
47
49
|
* const {member} = useStytchMember();
|
|
48
50
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
49
|
-
* @returns A {@link SWRUser}
|
|
50
51
|
*/
|
|
51
52
|
declare const useStytchMember: () => SWRMember;
|
|
52
53
|
/**
|
|
53
54
|
* Returns the active member's Stytch member session.
|
|
55
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
56
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
54
57
|
* @example
|
|
55
58
|
* const { session } = useStytchMemberSession();
|
|
56
59
|
* useEffect(() => {
|
|
@@ -58,15 +61,15 @@ declare const useStytchMember: () => SWRMember;
|
|
|
58
61
|
* router.replace('/login')
|
|
59
62
|
* }
|
|
60
63
|
* }, [session]);
|
|
61
|
-
* @returns A {@link SWRMemberSession}
|
|
62
64
|
*/
|
|
63
65
|
declare const useStytchMemberSession: () => SWRMemberSession;
|
|
64
66
|
/**
|
|
65
67
|
* Returns the active Stytch organization.
|
|
68
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
69
|
+
* Check the fromCache property to determine if the organization data is from persistent storage.
|
|
66
70
|
* @example
|
|
67
71
|
* const { organization } = useStytchOrganization();
|
|
68
|
-
* return
|
|
69
|
-
* @returns A {@link SWROrganization}
|
|
72
|
+
* return (<p>Welcome to {organization.organization_name}</p>);
|
|
70
73
|
*/
|
|
71
74
|
declare const useStytchOrganization: () => SWROrganization;
|
|
72
75
|
type SWRIsAuthorized = {
|
|
@@ -141,16 +144,16 @@ declare const withStytchOrganization: <T extends object>(Component: React.Compon
|
|
|
141
144
|
declare const withStytchPermissions: <Permissions_1 extends Record<string, string>, T extends object>(Component: React.ComponentType<T & {
|
|
142
145
|
stytchPermissions: PermissionsMap<Permissions_1>;
|
|
143
146
|
}>) => React.ComponentType<T>;
|
|
144
|
-
|
|
147
|
+
interface StytchB2BProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
145
148
|
/**
|
|
146
|
-
* A Stytch client instance {@link StytchB2BHeadlessClient}
|
|
149
|
+
* A Stytch client instance, either a {@link StytchB2BUIClient} or {@link StytchB2BHeadlessClient}
|
|
147
150
|
*/
|
|
148
151
|
stytch: StytchB2BClient<TProjectConfiguration>;
|
|
149
152
|
children?: ReactNode;
|
|
150
|
-
}
|
|
153
|
+
}
|
|
151
154
|
/**
|
|
152
155
|
* The Stytch Context Provider.
|
|
153
|
-
* Wrap your application with this component in
|
|
156
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
154
157
|
* @example
|
|
155
158
|
* const stytch = new StytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
156
159
|
*
|
|
@@ -29,11 +29,11 @@ const isUIClient = (client) => {
|
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Returns the active Member.
|
|
32
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
32
33
|
* Check the fromCache property to determine if the member data is from persistent storage.
|
|
33
34
|
* @example
|
|
34
35
|
* const {member} = useStytchMember();
|
|
35
36
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
36
|
-
* @returns A {@link SWRUser}
|
|
37
37
|
*/
|
|
38
38
|
const useStytchMember = () => {
|
|
39
39
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('useStytchMember', 'StytchB2BProvider'));
|
|
@@ -41,6 +41,8 @@ const useStytchMember = () => {
|
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Returns the active member's Stytch member session.
|
|
44
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
45
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
44
46
|
* @example
|
|
45
47
|
* const { session } = useStytchMemberSession();
|
|
46
48
|
* useEffect(() => {
|
|
@@ -48,7 +50,6 @@ const useStytchMember = () => {
|
|
|
48
50
|
* router.replace('/login')
|
|
49
51
|
* }
|
|
50
52
|
* }, [session]);
|
|
51
|
-
* @returns A {@link SWRMemberSession}
|
|
52
53
|
*/
|
|
53
54
|
const useStytchMemberSession = () => {
|
|
54
55
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('useStytchMemberSession', 'StytchB2BProvider'));
|
|
@@ -56,10 +57,11 @@ const useStytchMemberSession = () => {
|
|
|
56
57
|
};
|
|
57
58
|
/**
|
|
58
59
|
* Returns the active Stytch organization.
|
|
60
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
61
|
+
* Check the fromCache property to determine if the organization data is from persistent storage.
|
|
59
62
|
* @example
|
|
60
63
|
* const { organization } = useStytchOrganization();
|
|
61
|
-
* return
|
|
62
|
-
* @returns A {@link SWROrganization}
|
|
64
|
+
* return (<p>Welcome to {organization.organization_name}</p>);
|
|
63
65
|
*/
|
|
64
66
|
const useStytchOrganization = () => {
|
|
65
67
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('useStytchOrganization', 'StytchB2BProvider'));
|
|
@@ -121,7 +123,7 @@ const withStytchMember = (Component) => {
|
|
|
121
123
|
const { member, fromCache } = useStytchMember();
|
|
122
124
|
return React__default["default"].createElement(Component, Object.assign({}, props, { stytchMember: member, stytchMemberIsFromCache: fromCache }));
|
|
123
125
|
};
|
|
124
|
-
WithStytchUser.displayName = `
|
|
126
|
+
WithStytchUser.displayName = `withStytchMember(${Component.displayName || Component.name || 'Component'})`;
|
|
125
127
|
return WithStytchUser;
|
|
126
128
|
};
|
|
127
129
|
const withStytchMemberSession = (Component) => {
|
|
@@ -130,7 +132,7 @@ const withStytchMemberSession = (Component) => {
|
|
|
130
132
|
const { session, fromCache } = useStytchMemberSession();
|
|
131
133
|
return React__default["default"].createElement(Component, Object.assign({}, props, { stytchMemberSession: session, stytchMemberSessionIsFromCache: fromCache }));
|
|
132
134
|
};
|
|
133
|
-
WithStytchSession.displayName = `
|
|
135
|
+
WithStytchSession.displayName = `withStytchMemberSession(${Component.displayName || Component.name || 'Component'})`;
|
|
134
136
|
return WithStytchSession;
|
|
135
137
|
};
|
|
136
138
|
const withStytchOrganization = (Component) => {
|
|
@@ -184,7 +186,7 @@ const withStytchPermissions = (Component) => {
|
|
|
184
186
|
};
|
|
185
187
|
/**
|
|
186
188
|
* The Stytch Context Provider.
|
|
187
|
-
* Wrap your application with this component in
|
|
189
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
188
190
|
* @example
|
|
189
191
|
* const stytch = new StytchB2BHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
190
192
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
4
|
+
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-09d376ba.js';
|
|
5
5
|
import { i as invariant, n as noProviderError } from '../invariant-568a7633.js';
|
|
6
6
|
|
|
7
7
|
const makeAdminPortalComponent = (mountFn, componentName) => {
|
|
@@ -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-
|
|
7
|
+
var StytchB2BContext = require('../StytchB2BContext-a8d57249.js');
|
|
8
8
|
var invariant = require('../invariant-ae5a5bce.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/dist/b2b/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Callbacks, StyleConfig, StytchB2BUIConfig, StytchProjectConfigurationInput } from "@stytch/vanilla-js";
|
|
4
|
-
// We need to import the StytchB2BUIClient type to give the TSDoc parser a hint as to where it is from
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
4
|
import { IDPConsentScreenManifest } from "@stytch/vanilla-js/b2b";
|
|
7
5
|
interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
8
6
|
/**
|
|
@@ -76,14 +74,17 @@ type B2BIDPConsentManifestGenerator = (input: {
|
|
|
76
74
|
clientName: string;
|
|
77
75
|
}) => IDPConsentScreenManifest;
|
|
78
76
|
type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
|
|
77
|
+
/**
|
|
78
|
+
* Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
79
|
+
*/
|
|
79
80
|
getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
|
|
80
81
|
};
|
|
81
82
|
/**
|
|
82
83
|
* The Stytch B2B UI component.
|
|
83
|
-
* This component can only be used with a
|
|
84
|
-
* passed into the
|
|
84
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
85
|
+
* passed into the StytchB2BProvider.
|
|
85
86
|
*
|
|
86
|
-
* See the {@link https://stytch.com/docs/b2b/sdks
|
|
87
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
87
88
|
*
|
|
88
89
|
* @example
|
|
89
90
|
* <StytchB2B
|
|
@@ -110,17 +111,16 @@ type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
|
|
|
110
111
|
* onEvent: (event) => console.log(event)
|
|
111
112
|
* }}
|
|
112
113
|
* />
|
|
113
|
-
* @param props {@link StytchB2BProps}
|
|
114
114
|
*/
|
|
115
|
-
declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration
|
|
115
|
+
declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ styles, callbacks, config }: StytchB2BProps<TProjectConfiguration>) => React.JSX.Element;
|
|
116
116
|
/**
|
|
117
117
|
* The Stytch B2B IDP component.
|
|
118
118
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
119
119
|
* Requires the user to be logged in.
|
|
120
|
-
* This component can only be used with a
|
|
121
|
-
* passed into the
|
|
120
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
121
|
+
* passed into the StytchB2BProvider.
|
|
122
122
|
*
|
|
123
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
123
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
* const styles = {
|
|
@@ -139,11 +139,8 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
|
|
|
139
139
|
* onEvent: (event) => console.log(event)
|
|
140
140
|
* }}
|
|
141
141
|
* />
|
|
142
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
143
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
144
|
-
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
145
142
|
*/
|
|
146
143
|
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
147
|
-
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-a8d57249.js";
|
|
148
145
|
export { StytchB2B, B2BIdentityProvider };
|
|
149
|
-
export type { StytchB2BProviderProps } from "../StytchB2BContext-
|
|
146
|
+
export type { StytchB2BProviderProps } from "../StytchB2BContext-a8d57249.js";
|
package/dist/b2b/index.esm.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Callbacks, StyleConfig, StytchB2BUIConfig, StytchProjectConfigurationInput } from "@stytch/vanilla-js";
|
|
4
|
-
// We need to import the StytchB2BUIClient type to give the TSDoc parser a hint as to where it is from
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
4
|
import { IDPConsentScreenManifest } from "@stytch/vanilla-js/b2b";
|
|
7
5
|
interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
8
6
|
/**
|
|
@@ -76,14 +74,17 @@ type B2BIDPConsentManifestGenerator = (input: {
|
|
|
76
74
|
clientName: string;
|
|
77
75
|
}) => IDPConsentScreenManifest;
|
|
78
76
|
type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
|
|
77
|
+
/**
|
|
78
|
+
* Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
79
|
+
*/
|
|
79
80
|
getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
|
|
80
81
|
};
|
|
81
82
|
/**
|
|
82
83
|
* The Stytch B2B UI component.
|
|
83
|
-
* This component can only be used with a
|
|
84
|
-
* passed into the
|
|
84
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
85
|
+
* passed into the StytchB2BProvider.
|
|
85
86
|
*
|
|
86
|
-
* See the {@link https://stytch.com/docs/b2b/sdks
|
|
87
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
87
88
|
*
|
|
88
89
|
* @example
|
|
89
90
|
* <StytchB2B
|
|
@@ -110,17 +111,16 @@ type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
|
|
|
110
111
|
* onEvent: (event) => console.log(event)
|
|
111
112
|
* }}
|
|
112
113
|
* />
|
|
113
|
-
* @param props {@link StytchB2BProps}
|
|
114
114
|
*/
|
|
115
|
-
declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration
|
|
115
|
+
declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ styles, callbacks, config }: StytchB2BProps<TProjectConfiguration>) => React.JSX.Element;
|
|
116
116
|
/**
|
|
117
117
|
* The Stytch B2B IDP component.
|
|
118
118
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
119
119
|
* Requires the user to be logged in.
|
|
120
|
-
* This component can only be used with a
|
|
121
|
-
* passed into the
|
|
120
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
121
|
+
* passed into the StytchB2BProvider.
|
|
122
122
|
*
|
|
123
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
123
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
124
124
|
*
|
|
125
125
|
* @example
|
|
126
126
|
* const styles = {
|
|
@@ -139,11 +139,8 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
|
|
|
139
139
|
* onEvent: (event) => console.log(event)
|
|
140
140
|
* }}
|
|
141
141
|
* />
|
|
142
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
143
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
144
|
-
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
145
142
|
*/
|
|
146
143
|
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
147
|
-
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-09d376ba.js";
|
|
148
145
|
export { StytchB2B, B2BIdentityProvider };
|
|
149
|
-
export type { StytchB2BProviderProps } from "../StytchB2BContext-
|
|
146
|
+
export type { StytchB2BProviderProps } from "../StytchB2BContext-09d376ba.js";
|
package/dist/b2b/index.esm.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient, b as useStytchMember } from '../StytchB2BContext-
|
|
2
|
-
export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized, b as useStytchMember, c as useStytchMemberSession, e as useStytchOrganization, w as withStytchB2BClient, g as withStytchMember, f as withStytchMemberSession, h as withStytchOrganization, j as withStytchPermissions } from '../StytchB2BContext-
|
|
1
|
+
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient, b as useStytchMember } from '../StytchB2BContext-09d376ba.js';
|
|
2
|
+
export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized, b as useStytchMember, c as useStytchMemberSession, e as useStytchOrganization, w as withStytchB2BClient, g as withStytchMember, f as withStytchMemberSession, h as withStytchOrganization, j as withStytchPermissions } from '../StytchB2BContext-09d376ba.js';
|
|
3
3
|
import React, { useRef, useLayoutEffect } from 'react';
|
|
4
4
|
import { i as invariant, b as noHeadlessClientError, n as noProviderError } from '../invariant-568a7633.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The Stytch B2B UI component.
|
|
8
|
-
* This component can only be used with a
|
|
9
|
-
* passed into the
|
|
8
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
9
|
+
* passed into the StytchB2BProvider.
|
|
10
10
|
*
|
|
11
|
-
* See the {@link https://stytch.com/docs/b2b/sdks
|
|
11
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* <StytchB2B
|
|
@@ -35,7 +35,6 @@ import { i as invariant, b as noHeadlessClientError, n as noProviderError } from
|
|
|
35
35
|
* onEvent: (event) => console.log(event)
|
|
36
36
|
* }}
|
|
37
37
|
* />
|
|
38
|
-
* @param props {@link StytchB2BProps}
|
|
39
38
|
*/
|
|
40
39
|
const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
41
40
|
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchB2B />', 'StytchB2BProvider'));
|
|
@@ -66,10 +65,10 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
66
65
|
* The Stytch B2B IDP component.
|
|
67
66
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
68
67
|
* Requires the user to be logged in.
|
|
69
|
-
* This component can only be used with a
|
|
70
|
-
* passed into the
|
|
68
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
69
|
+
* passed into the StytchB2BProvider.
|
|
71
70
|
*
|
|
72
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
71
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
73
72
|
*
|
|
74
73
|
* @example
|
|
75
74
|
* const styles = {
|
|
@@ -88,9 +87,6 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
88
87
|
* onEvent: (event) => console.log(event)
|
|
89
88
|
* }}
|
|
90
89
|
* />
|
|
91
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
92
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
93
|
-
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
94
90
|
*/
|
|
95
91
|
const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
|
|
96
92
|
invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
|
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-
|
|
5
|
+
var StytchB2BContext = require('../StytchB2BContext-a8d57249.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var invariant = require('../invariant-ae5a5bce.js');
|
|
8
8
|
|
|
@@ -12,10 +12,10 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The Stytch B2B UI component.
|
|
15
|
-
* This component can only be used with a
|
|
16
|
-
* passed into the
|
|
15
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
16
|
+
* passed into the StytchB2BProvider.
|
|
17
17
|
*
|
|
18
|
-
* See the {@link https://stytch.com/docs/b2b/sdks
|
|
18
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* <StytchB2B
|
|
@@ -42,7 +42,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
42
42
|
* onEvent: (event) => console.log(event)
|
|
43
43
|
* }}
|
|
44
44
|
* />
|
|
45
|
-
* @param props {@link StytchB2BProps}
|
|
46
45
|
*/
|
|
47
46
|
const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
48
47
|
invariant.invariant(StytchB2BContext.useIsMounted__INTERNAL(), invariant.noProviderError('<StytchB2B />', 'StytchB2BProvider'));
|
|
@@ -73,10 +72,10 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
73
72
|
* The Stytch B2B IDP component.
|
|
74
73
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
75
74
|
* Requires the user to be logged in.
|
|
76
|
-
* This component can only be used with a
|
|
77
|
-
* passed into the
|
|
75
|
+
* This component can only be used with a Stytch B2B UI Client
|
|
76
|
+
* passed into the StytchB2BProvider.
|
|
78
77
|
*
|
|
79
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
78
|
+
* See the {@link https://stytch.com/docs/b2b/sdks online reference}
|
|
80
79
|
*
|
|
81
80
|
* @example
|
|
82
81
|
* const styles = {
|
|
@@ -95,9 +94,6 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
95
94
|
* onEvent: (event) => console.log(event)
|
|
96
95
|
* }}
|
|
97
96
|
* />
|
|
98
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
99
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
100
|
-
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
101
97
|
*/
|
|
102
98
|
const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
|
|
103
99
|
invariant.invariant(StytchB2BContext.useIsMounted__INTERNAL(), invariant.noProviderError('<IdentityProvider />'));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
// We need to import the StytchUIClient type to give the TSDoc parser a hint as to where it is from
|
|
5
4
|
import { Callbacks, StytchLoginConfig, StyleConfig, StytchProjectConfigurationInput, Session, StytchUIClient, User } from "@stytch/vanilla-js";
|
|
6
5
|
import { StytchHeadlessClient } from "@stytch/vanilla-js/headless";
|
|
7
6
|
interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
@@ -70,10 +69,10 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
72
71
|
* The Stytch Login Screen component.
|
|
73
|
-
* This component can only be used with a
|
|
74
|
-
* passed into the
|
|
72
|
+
* This component can only be used with a Stytch UI Client
|
|
73
|
+
* passed into the StytchProvider.
|
|
75
74
|
*
|
|
76
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
75
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
77
76
|
*
|
|
78
77
|
* @example
|
|
79
78
|
* <StytchLogin
|
|
@@ -96,19 +95,21 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
96
95
|
* onEvent: (event) => console.log(event)
|
|
97
96
|
* }}
|
|
98
97
|
* />
|
|
99
|
-
* @param props {@link StytchProps}
|
|
100
98
|
*/
|
|
101
99
|
declare const StytchLogin: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
102
100
|
interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
|
|
101
|
+
/**
|
|
102
|
+
* A Stytch password reset token.
|
|
103
|
+
*/
|
|
103
104
|
passwordResetToken: string;
|
|
104
105
|
}
|
|
105
106
|
type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
106
107
|
/**
|
|
107
108
|
* The Stytch Reset Password component.
|
|
108
|
-
* This component can only be used with a
|
|
109
|
-
* passed into the
|
|
109
|
+
* This component can only be used with a Stytch UI Client
|
|
110
|
+
* passed into the StytchProvider.
|
|
110
111
|
*
|
|
111
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
112
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
112
113
|
*
|
|
113
114
|
* @example
|
|
114
115
|
* <StytchPasswordReset
|
|
@@ -132,23 +133,42 @@ type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
|
132
133
|
* onEvent: (event) => console.log(event)
|
|
133
134
|
* }}
|
|
134
135
|
* />
|
|
135
|
-
*
|
|
136
|
-
* @param config - A {@link StytchLoginConfig} object
|
|
137
|
-
* @param passwordResetToken - A Stytch password reset token
|
|
138
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
139
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
140
136
|
*/
|
|
141
137
|
declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps<TProjectConfiguration>) => React.JSX.Element;
|
|
138
|
+
/**
|
|
139
|
+
* The Stytch Passkey Registration component.
|
|
140
|
+
* This component can only be used with a Stytch UI Client
|
|
141
|
+
* passed into the StytchProvider.
|
|
142
|
+
*
|
|
143
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* const styles = {
|
|
147
|
+
* container: {
|
|
148
|
+
* backgroundColor: '#e11e1e',
|
|
149
|
+
* },
|
|
150
|
+
* colors: {
|
|
151
|
+
* primary: '#ff00f7',
|
|
152
|
+
* secondary: '#5C727D',
|
|
153
|
+
* },
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* <StytchPasskeyRegistration
|
|
157
|
+
* styles={styles}
|
|
158
|
+
* callbacks={{
|
|
159
|
+
* onEvent: (event) => console.log(event)
|
|
160
|
+
* }}
|
|
161
|
+
* />
|
|
162
|
+
*/
|
|
142
163
|
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
143
164
|
/**
|
|
144
165
|
* The Stytch IDP component.
|
|
145
166
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
146
167
|
* Requires the user to be logged in.
|
|
147
|
-
* This component can only be used with a
|
|
148
|
-
* passed into the
|
|
149
|
-
*
|
|
150
|
-
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
168
|
+
* This component can only be used with a Stytch UI Client
|
|
169
|
+
* passed into the StytchProvider.
|
|
151
170
|
*
|
|
171
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
152
172
|
*
|
|
153
173
|
* @example
|
|
154
174
|
* const styles = {
|
|
@@ -167,8 +187,6 @@ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<
|
|
|
167
187
|
* onEvent: (event) => console.log(event)
|
|
168
188
|
* }}
|
|
169
189
|
* />
|
|
170
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
171
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
172
190
|
*/
|
|
173
191
|
declare const IdentityProvider: ({ styles, callbacks }: IdentityProviderProps) => React.JSX.Element;
|
|
174
192
|
/**
|
|
@@ -198,15 +216,17 @@ type SWRSession = {
|
|
|
198
216
|
};
|
|
199
217
|
/**
|
|
200
218
|
* Returns the active User.
|
|
219
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
201
220
|
* Check the fromCache property to determine if the user data is from persistent storage.
|
|
202
221
|
* @example
|
|
203
222
|
* const {user} = useStytchUser();
|
|
204
223
|
* return (<h1>Welcome, {user.name.first_name}</h1>);
|
|
205
|
-
* @returns A {@link SWRUser}
|
|
206
224
|
*/
|
|
207
225
|
declare const useStytchUser: () => SWRUser;
|
|
208
226
|
/**
|
|
209
227
|
* Returns the active user's Stytch session.
|
|
228
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
229
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
210
230
|
* @example
|
|
211
231
|
* const {session} = useStytchSession();
|
|
212
232
|
* useEffect(() => {
|
|
@@ -214,7 +234,6 @@ declare const useStytchUser: () => SWRUser;
|
|
|
214
234
|
* router.replace('/login')
|
|
215
235
|
* }
|
|
216
236
|
* }, [session]);
|
|
217
|
-
* @returns A {@link SWRSession}
|
|
218
237
|
*/
|
|
219
238
|
declare const useStytchSession: () => SWRSession;
|
|
220
239
|
/**
|
|
@@ -238,16 +257,16 @@ declare const withStytchSession: <T extends object>(Component: React.ComponentTy
|
|
|
238
257
|
stytchSession: Session | null;
|
|
239
258
|
stytchSessionIsFromCache: boolean;
|
|
240
259
|
}>) => React.ComponentType<T>;
|
|
241
|
-
|
|
260
|
+
interface StytchProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
242
261
|
/**
|
|
243
262
|
* A Stytch client instance, either a {@link StytchUIClient} or {@link StytchHeadlessClient}
|
|
244
263
|
*/
|
|
245
264
|
stytch: StytchClient<TProjectConfiguration>;
|
|
246
265
|
children?: ReactNode;
|
|
247
|
-
}
|
|
266
|
+
}
|
|
248
267
|
/**
|
|
249
268
|
* The Stytch Context Provider.
|
|
250
|
-
* Wrap your application with this component in
|
|
269
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
251
270
|
* @example
|
|
252
271
|
* const stytch = new StytchHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
253
272
|
*
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
// We need to import the StytchUIClient type to give the TSDoc parser a hint as to where it is from
|
|
5
4
|
import { Callbacks, StytchLoginConfig, StyleConfig, StytchProjectConfigurationInput, Session, StytchUIClient, User } from "@stytch/vanilla-js";
|
|
6
5
|
import { StytchHeadlessClient } from "@stytch/vanilla-js/headless";
|
|
7
6
|
interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
@@ -70,10 +69,10 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
72
71
|
* The Stytch Login Screen component.
|
|
73
|
-
* This component can only be used with a
|
|
74
|
-
* passed into the
|
|
72
|
+
* This component can only be used with a Stytch UI Client
|
|
73
|
+
* passed into the StytchProvider.
|
|
75
74
|
*
|
|
76
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
75
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
77
76
|
*
|
|
78
77
|
* @example
|
|
79
78
|
* <StytchLogin
|
|
@@ -96,19 +95,21 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
96
95
|
* onEvent: (event) => console.log(event)
|
|
97
96
|
* }}
|
|
98
97
|
* />
|
|
99
|
-
* @param props {@link StytchProps}
|
|
100
98
|
*/
|
|
101
99
|
declare const StytchLogin: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
102
100
|
interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
|
|
101
|
+
/**
|
|
102
|
+
* A Stytch password reset token.
|
|
103
|
+
*/
|
|
103
104
|
passwordResetToken: string;
|
|
104
105
|
}
|
|
105
106
|
type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
106
107
|
/**
|
|
107
108
|
* The Stytch Reset Password component.
|
|
108
|
-
* This component can only be used with a
|
|
109
|
-
* passed into the
|
|
109
|
+
* This component can only be used with a Stytch UI Client
|
|
110
|
+
* passed into the StytchProvider.
|
|
110
111
|
*
|
|
111
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
112
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
112
113
|
*
|
|
113
114
|
* @example
|
|
114
115
|
* <StytchPasswordReset
|
|
@@ -132,23 +133,42 @@ type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
|
132
133
|
* onEvent: (event) => console.log(event)
|
|
133
134
|
* }}
|
|
134
135
|
* />
|
|
135
|
-
*
|
|
136
|
-
* @param config - A {@link StytchLoginConfig} object
|
|
137
|
-
* @param passwordResetToken - A Stytch password reset token
|
|
138
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
139
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
140
136
|
*/
|
|
141
137
|
declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps<TProjectConfiguration>) => React.JSX.Element;
|
|
138
|
+
/**
|
|
139
|
+
* The Stytch Passkey Registration component.
|
|
140
|
+
* This component can only be used with a Stytch UI Client
|
|
141
|
+
* passed into the StytchProvider.
|
|
142
|
+
*
|
|
143
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* const styles = {
|
|
147
|
+
* container: {
|
|
148
|
+
* backgroundColor: '#e11e1e',
|
|
149
|
+
* },
|
|
150
|
+
* colors: {
|
|
151
|
+
* primary: '#ff00f7',
|
|
152
|
+
* secondary: '#5C727D',
|
|
153
|
+
* },
|
|
154
|
+
* }
|
|
155
|
+
*
|
|
156
|
+
* <StytchPasskeyRegistration
|
|
157
|
+
* styles={styles}
|
|
158
|
+
* callbacks={{
|
|
159
|
+
* onEvent: (event) => console.log(event)
|
|
160
|
+
* }}
|
|
161
|
+
* />
|
|
162
|
+
*/
|
|
142
163
|
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
143
164
|
/**
|
|
144
165
|
* The Stytch IDP component.
|
|
145
166
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
146
167
|
* Requires the user to be logged in.
|
|
147
|
-
* This component can only be used with a
|
|
148
|
-
* passed into the
|
|
149
|
-
*
|
|
150
|
-
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
168
|
+
* This component can only be used with a Stytch UI Client
|
|
169
|
+
* passed into the StytchProvider.
|
|
151
170
|
*
|
|
171
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
152
172
|
*
|
|
153
173
|
* @example
|
|
154
174
|
* const styles = {
|
|
@@ -167,8 +187,6 @@ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<
|
|
|
167
187
|
* onEvent: (event) => console.log(event)
|
|
168
188
|
* }}
|
|
169
189
|
* />
|
|
170
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
171
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
172
190
|
*/
|
|
173
191
|
declare const IdentityProvider: ({ styles, callbacks }: IdentityProviderProps) => React.JSX.Element;
|
|
174
192
|
/**
|
|
@@ -198,15 +216,17 @@ type SWRSession = {
|
|
|
198
216
|
};
|
|
199
217
|
/**
|
|
200
218
|
* Returns the active User.
|
|
219
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
201
220
|
* Check the fromCache property to determine if the user data is from persistent storage.
|
|
202
221
|
* @example
|
|
203
222
|
* const {user} = useStytchUser();
|
|
204
223
|
* return (<h1>Welcome, {user.name.first_name}</h1>);
|
|
205
|
-
* @returns A {@link SWRUser}
|
|
206
224
|
*/
|
|
207
225
|
declare const useStytchUser: () => SWRUser;
|
|
208
226
|
/**
|
|
209
227
|
* Returns the active user's Stytch session.
|
|
228
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
229
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
210
230
|
* @example
|
|
211
231
|
* const {session} = useStytchSession();
|
|
212
232
|
* useEffect(() => {
|
|
@@ -214,7 +234,6 @@ declare const useStytchUser: () => SWRUser;
|
|
|
214
234
|
* router.replace('/login')
|
|
215
235
|
* }
|
|
216
236
|
* }, [session]);
|
|
217
|
-
* @returns A {@link SWRSession}
|
|
218
237
|
*/
|
|
219
238
|
declare const useStytchSession: () => SWRSession;
|
|
220
239
|
/**
|
|
@@ -238,16 +257,16 @@ declare const withStytchSession: <T extends object>(Component: React.ComponentTy
|
|
|
238
257
|
stytchSession: Session | null;
|
|
239
258
|
stytchSessionIsFromCache: boolean;
|
|
240
259
|
}>) => React.ComponentType<T>;
|
|
241
|
-
|
|
260
|
+
interface StytchProviderProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
242
261
|
/**
|
|
243
262
|
* A Stytch client instance, either a {@link StytchUIClient} or {@link StytchHeadlessClient}
|
|
244
263
|
*/
|
|
245
264
|
stytch: StytchClient<TProjectConfiguration>;
|
|
246
265
|
children?: ReactNode;
|
|
247
|
-
}
|
|
266
|
+
}
|
|
248
267
|
/**
|
|
249
268
|
* The Stytch Context Provider.
|
|
250
|
-
* Wrap your application with this component in
|
|
269
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
251
270
|
* @example
|
|
252
271
|
* const stytch = new StytchHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
253
272
|
*
|
package/dist/index.esm.js
CHANGED
|
@@ -18,11 +18,11 @@ const isUIClient = (client) => {
|
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Returns the active User.
|
|
21
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
21
22
|
* Check the fromCache property to determine if the user data is from persistent storage.
|
|
22
23
|
* @example
|
|
23
24
|
* const {user} = useStytchUser();
|
|
24
25
|
* return (<h1>Welcome, {user.name.first_name}</h1>);
|
|
25
|
-
* @returns A {@link SWRUser}
|
|
26
26
|
*/
|
|
27
27
|
const useStytchUser = () => {
|
|
28
28
|
invariant(useIsMounted__INTERNAL(), noProviderError('useStytchUser'));
|
|
@@ -30,6 +30,8 @@ const useStytchUser = () => {
|
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Returns the active user's Stytch session.
|
|
33
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
34
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
33
35
|
* @example
|
|
34
36
|
* const {session} = useStytchSession();
|
|
35
37
|
* useEffect(() => {
|
|
@@ -37,7 +39,6 @@ const useStytchUser = () => {
|
|
|
37
39
|
* router.replace('/login')
|
|
38
40
|
* }
|
|
39
41
|
* }, [session]);
|
|
40
|
-
* @returns A {@link SWRSession}
|
|
41
42
|
*/
|
|
42
43
|
const useStytchSession = () => {
|
|
43
44
|
invariant(useIsMounted__INTERNAL(), noProviderError('useStytchSession'));
|
|
@@ -85,7 +86,7 @@ const withStytchSession = (Component) => {
|
|
|
85
86
|
};
|
|
86
87
|
/**
|
|
87
88
|
* The Stytch Context Provider.
|
|
88
|
-
* Wrap your application with this component in
|
|
89
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
89
90
|
* @example
|
|
90
91
|
* const stytch = new StytchHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
91
92
|
*
|
|
@@ -120,10 +121,10 @@ const StytchProvider = ({ stytch, children, }) => {
|
|
|
120
121
|
|
|
121
122
|
/**
|
|
122
123
|
* The Stytch Login Screen component.
|
|
123
|
-
* This component can only be used with a
|
|
124
|
-
* passed into the
|
|
124
|
+
* This component can only be used with a Stytch UI Client
|
|
125
|
+
* passed into the StytchProvider.
|
|
125
126
|
*
|
|
126
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
127
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
127
128
|
*
|
|
128
129
|
* @example
|
|
129
130
|
* <StytchLogin
|
|
@@ -146,7 +147,6 @@ const StytchProvider = ({ stytch, children, }) => {
|
|
|
146
147
|
* onEvent: (event) => console.log(event)
|
|
147
148
|
* }}
|
|
148
149
|
* />
|
|
149
|
-
* @param props {@link StytchProps}
|
|
150
150
|
*/
|
|
151
151
|
const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
152
152
|
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchLogin />'));
|
|
@@ -164,7 +164,7 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
164
164
|
containerEl.current.id = `stytch-magic-link-${randId}`;
|
|
165
165
|
}
|
|
166
166
|
stytchClient.mountLogin({
|
|
167
|
-
config
|
|
167
|
+
config,
|
|
168
168
|
callbacks,
|
|
169
169
|
elementId: `#${containerEl.current.id}`,
|
|
170
170
|
styles,
|
|
@@ -174,10 +174,10 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
174
174
|
};
|
|
175
175
|
/**
|
|
176
176
|
* The Stytch Reset Password component.
|
|
177
|
-
* This component can only be used with a
|
|
178
|
-
* passed into the
|
|
177
|
+
* This component can only be used with a Stytch UI Client
|
|
178
|
+
* passed into the StytchProvider.
|
|
179
179
|
*
|
|
180
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
180
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
181
181
|
*
|
|
182
182
|
* @example
|
|
183
183
|
* <StytchPasswordReset
|
|
@@ -201,11 +201,6 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
201
201
|
* onEvent: (event) => console.log(event)
|
|
202
202
|
* }}
|
|
203
203
|
* />
|
|
204
|
-
*
|
|
205
|
-
* @param config - A {@link StytchLoginConfig} object
|
|
206
|
-
* @param passwordResetToken - A Stytch password reset token
|
|
207
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
208
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
209
204
|
*/
|
|
210
205
|
const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, }) => {
|
|
211
206
|
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchResetPassword />'));
|
|
@@ -224,7 +219,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, })
|
|
|
224
219
|
}
|
|
225
220
|
if (passwordResetToken) {
|
|
226
221
|
stytchClient.mountResetPassword({
|
|
227
|
-
config
|
|
222
|
+
config,
|
|
228
223
|
callbacks,
|
|
229
224
|
elementId: `#${containerEl.current.id}`,
|
|
230
225
|
styles,
|
|
@@ -234,39 +229,32 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, })
|
|
|
234
229
|
}, [stytchClient, config, styles, callbacks, passwordResetToken]);
|
|
235
230
|
return React.createElement("div", { ref: containerEl });
|
|
236
231
|
};
|
|
232
|
+
/**
|
|
233
|
+
* The Stytch Passkey Registration component.
|
|
234
|
+
* This component can only be used with a Stytch UI Client
|
|
235
|
+
* passed into the StytchProvider.
|
|
236
|
+
*
|
|
237
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* const styles = {
|
|
241
|
+
* container: {
|
|
242
|
+
* backgroundColor: '#e11e1e',
|
|
243
|
+
* },
|
|
244
|
+
* colors: {
|
|
245
|
+
* primary: '#ff00f7',
|
|
246
|
+
* secondary: '#5C727D',
|
|
247
|
+
* },
|
|
248
|
+
* }
|
|
249
|
+
*
|
|
250
|
+
* <StytchPasskeyRegistration
|
|
251
|
+
* styles={styles}
|
|
252
|
+
* callbacks={{
|
|
253
|
+
* onEvent: (event) => console.log(event)
|
|
254
|
+
* }}
|
|
255
|
+
* />
|
|
256
|
+
*/
|
|
237
257
|
const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
238
|
-
/**
|
|
239
|
-
* The Stytch Passkey Registration component.
|
|
240
|
-
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
241
|
-
* passed into the {@link StytchProvider}
|
|
242
|
-
*
|
|
243
|
-
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* @example
|
|
247
|
-
* const styles = {
|
|
248
|
-
* container: {
|
|
249
|
-
* backgroundColor: '#e11e1e',
|
|
250
|
-
* },
|
|
251
|
-
* colors: {
|
|
252
|
-
* primary: '#ff00f7',
|
|
253
|
-
* secondary: '#5C727D',
|
|
254
|
-
* },
|
|
255
|
-
* }
|
|
256
|
-
*
|
|
257
|
-
* <StytchPasskeyRegistration
|
|
258
|
-
* config={{
|
|
259
|
-
* products: ['passkey'],
|
|
260
|
-
* }}
|
|
261
|
-
* styles={styles}
|
|
262
|
-
* callbacks={{
|
|
263
|
-
* onEvent: (event) => console.log(event)
|
|
264
|
-
* }}
|
|
265
|
-
* />
|
|
266
|
-
* @param config - A {@link StytchLoginConfig} object
|
|
267
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
268
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
269
|
-
*/
|
|
270
258
|
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchPasskeyRegistration />'));
|
|
271
259
|
const stytchClient = useStytch();
|
|
272
260
|
const user = useStytchUser();
|
|
@@ -280,7 +268,7 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
280
268
|
}
|
|
281
269
|
if (!containerEl.current.id) {
|
|
282
270
|
const randId = Math.floor(Math.random() * 1e6);
|
|
283
|
-
containerEl.current.id = `stytch-
|
|
271
|
+
containerEl.current.id = `stytch-passkey-registration-${randId}`;
|
|
284
272
|
}
|
|
285
273
|
stytchClient.mountPasskeyRegistration({
|
|
286
274
|
config,
|
|
@@ -295,11 +283,10 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
295
283
|
* The Stytch IDP component.
|
|
296
284
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
297
285
|
* Requires the user to be logged in.
|
|
298
|
-
* This component can only be used with a
|
|
299
|
-
* passed into the
|
|
300
|
-
*
|
|
301
|
-
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
286
|
+
* This component can only be used with a Stytch UI Client
|
|
287
|
+
* passed into the StytchProvider.
|
|
302
288
|
*
|
|
289
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
303
290
|
*
|
|
304
291
|
* @example
|
|
305
292
|
* const styles = {
|
|
@@ -318,8 +305,6 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
318
305
|
* onEvent: (event) => console.log(event)
|
|
319
306
|
* }}
|
|
320
307
|
* />
|
|
321
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
322
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
323
308
|
*/
|
|
324
309
|
const IdentityProvider = ({ styles, callbacks }) => {
|
|
325
310
|
invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
|
package/dist/index.js
CHANGED
|
@@ -26,11 +26,11 @@ const isUIClient = (client) => {
|
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* Returns the active User.
|
|
29
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
29
30
|
* Check the fromCache property to determine if the user data is from persistent storage.
|
|
30
31
|
* @example
|
|
31
32
|
* const {user} = useStytchUser();
|
|
32
33
|
* return (<h1>Welcome, {user.name.first_name}</h1>);
|
|
33
|
-
* @returns A {@link SWRUser}
|
|
34
34
|
*/
|
|
35
35
|
const useStytchUser = () => {
|
|
36
36
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('useStytchUser'));
|
|
@@ -38,6 +38,8 @@ const useStytchUser = () => {
|
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Returns the active user's Stytch session.
|
|
41
|
+
* The Stytch SDKs are used for client-side authentication and session management.
|
|
42
|
+
* Check the fromCache property to determine if the session data is from persistent storage.
|
|
41
43
|
* @example
|
|
42
44
|
* const {session} = useStytchSession();
|
|
43
45
|
* useEffect(() => {
|
|
@@ -45,7 +47,6 @@ const useStytchUser = () => {
|
|
|
45
47
|
* router.replace('/login')
|
|
46
48
|
* }
|
|
47
49
|
* }, [session]);
|
|
48
|
-
* @returns A {@link SWRSession}
|
|
49
50
|
*/
|
|
50
51
|
const useStytchSession = () => {
|
|
51
52
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('useStytchSession'));
|
|
@@ -93,7 +94,7 @@ const withStytchSession = (Component) => {
|
|
|
93
94
|
};
|
|
94
95
|
/**
|
|
95
96
|
* The Stytch Context Provider.
|
|
96
|
-
* Wrap your application with this component in
|
|
97
|
+
* Wrap your application with this component in order to use Stytch everywhere in your app.
|
|
97
98
|
* @example
|
|
98
99
|
* const stytch = new StytchHeadlessClient('public-token-<find yours in the stytch dashboard>')
|
|
99
100
|
*
|
|
@@ -128,10 +129,10 @@ const StytchProvider = ({ stytch, children, }) => {
|
|
|
128
129
|
|
|
129
130
|
/**
|
|
130
131
|
* The Stytch Login Screen component.
|
|
131
|
-
* This component can only be used with a
|
|
132
|
-
* passed into the
|
|
132
|
+
* This component can only be used with a Stytch UI Client
|
|
133
|
+
* passed into the StytchProvider.
|
|
133
134
|
*
|
|
134
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
135
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
135
136
|
*
|
|
136
137
|
* @example
|
|
137
138
|
* <StytchLogin
|
|
@@ -154,7 +155,6 @@ const StytchProvider = ({ stytch, children, }) => {
|
|
|
154
155
|
* onEvent: (event) => console.log(event)
|
|
155
156
|
* }}
|
|
156
157
|
* />
|
|
157
|
-
* @param props {@link StytchProps}
|
|
158
158
|
*/
|
|
159
159
|
const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
160
160
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('<StytchLogin />'));
|
|
@@ -172,7 +172,7 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
172
172
|
containerEl.current.id = `stytch-magic-link-${randId}`;
|
|
173
173
|
}
|
|
174
174
|
stytchClient.mountLogin({
|
|
175
|
-
config
|
|
175
|
+
config,
|
|
176
176
|
callbacks,
|
|
177
177
|
elementId: `#${containerEl.current.id}`,
|
|
178
178
|
styles,
|
|
@@ -182,10 +182,10 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
182
182
|
};
|
|
183
183
|
/**
|
|
184
184
|
* The Stytch Reset Password component.
|
|
185
|
-
* This component can only be used with a
|
|
186
|
-
* passed into the
|
|
185
|
+
* This component can only be used with a Stytch UI Client
|
|
186
|
+
* passed into the StytchProvider.
|
|
187
187
|
*
|
|
188
|
-
* See the {@link https://stytch.com/docs/sdks
|
|
188
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
189
189
|
*
|
|
190
190
|
* @example
|
|
191
191
|
* <StytchPasswordReset
|
|
@@ -209,11 +209,6 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
209
209
|
* onEvent: (event) => console.log(event)
|
|
210
210
|
* }}
|
|
211
211
|
* />
|
|
212
|
-
*
|
|
213
|
-
* @param config - A {@link StytchLoginConfig} object
|
|
214
|
-
* @param passwordResetToken - A Stytch password reset token
|
|
215
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
216
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
217
212
|
*/
|
|
218
213
|
const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, }) => {
|
|
219
214
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('<StytchResetPassword />'));
|
|
@@ -232,7 +227,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, })
|
|
|
232
227
|
}
|
|
233
228
|
if (passwordResetToken) {
|
|
234
229
|
stytchClient.mountResetPassword({
|
|
235
|
-
config
|
|
230
|
+
config,
|
|
236
231
|
callbacks,
|
|
237
232
|
elementId: `#${containerEl.current.id}`,
|
|
238
233
|
styles,
|
|
@@ -242,39 +237,32 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, })
|
|
|
242
237
|
}, [stytchClient, config, styles, callbacks, passwordResetToken]);
|
|
243
238
|
return React__default["default"].createElement("div", { ref: containerEl });
|
|
244
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* The Stytch Passkey Registration component.
|
|
242
|
+
* This component can only be used with a Stytch UI Client
|
|
243
|
+
* passed into the StytchProvider.
|
|
244
|
+
*
|
|
245
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* const styles = {
|
|
249
|
+
* container: {
|
|
250
|
+
* backgroundColor: '#e11e1e',
|
|
251
|
+
* },
|
|
252
|
+
* colors: {
|
|
253
|
+
* primary: '#ff00f7',
|
|
254
|
+
* secondary: '#5C727D',
|
|
255
|
+
* },
|
|
256
|
+
* }
|
|
257
|
+
*
|
|
258
|
+
* <StytchPasskeyRegistration
|
|
259
|
+
* styles={styles}
|
|
260
|
+
* callbacks={{
|
|
261
|
+
* onEvent: (event) => console.log(event)
|
|
262
|
+
* }}
|
|
263
|
+
* />
|
|
264
|
+
*/
|
|
245
265
|
const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
246
|
-
/**
|
|
247
|
-
* The Stytch Passkey Registration component.
|
|
248
|
-
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
249
|
-
* passed into the {@link StytchProvider}
|
|
250
|
-
*
|
|
251
|
-
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* @example
|
|
255
|
-
* const styles = {
|
|
256
|
-
* container: {
|
|
257
|
-
* backgroundColor: '#e11e1e',
|
|
258
|
-
* },
|
|
259
|
-
* colors: {
|
|
260
|
-
* primary: '#ff00f7',
|
|
261
|
-
* secondary: '#5C727D',
|
|
262
|
-
* },
|
|
263
|
-
* }
|
|
264
|
-
*
|
|
265
|
-
* <StytchPasskeyRegistration
|
|
266
|
-
* config={{
|
|
267
|
-
* products: ['passkey'],
|
|
268
|
-
* }}
|
|
269
|
-
* styles={styles}
|
|
270
|
-
* callbacks={{
|
|
271
|
-
* onEvent: (event) => console.log(event)
|
|
272
|
-
* }}
|
|
273
|
-
* />
|
|
274
|
-
* @param config - A {@link StytchLoginConfig} object
|
|
275
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
276
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
277
|
-
*/
|
|
278
266
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('<StytchPasskeyRegistration />'));
|
|
279
267
|
const stytchClient = useStytch();
|
|
280
268
|
const user = useStytchUser();
|
|
@@ -288,7 +276,7 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
288
276
|
}
|
|
289
277
|
if (!containerEl.current.id) {
|
|
290
278
|
const randId = Math.floor(Math.random() * 1e6);
|
|
291
|
-
containerEl.current.id = `stytch-
|
|
279
|
+
containerEl.current.id = `stytch-passkey-registration-${randId}`;
|
|
292
280
|
}
|
|
293
281
|
stytchClient.mountPasskeyRegistration({
|
|
294
282
|
config,
|
|
@@ -303,11 +291,10 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
303
291
|
* The Stytch IDP component.
|
|
304
292
|
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
305
293
|
* Requires the user to be logged in.
|
|
306
|
-
* This component can only be used with a
|
|
307
|
-
* passed into the
|
|
308
|
-
*
|
|
309
|
-
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
294
|
+
* This component can only be used with a Stytch UI Client
|
|
295
|
+
* passed into the StytchProvider.
|
|
310
296
|
*
|
|
297
|
+
* See the {@link https://stytch.com/docs/sdks online reference}
|
|
311
298
|
*
|
|
312
299
|
* @example
|
|
313
300
|
* const styles = {
|
|
@@ -326,8 +313,6 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
326
313
|
* onEvent: (event) => console.log(event)
|
|
327
314
|
* }}
|
|
328
315
|
* />
|
|
329
|
-
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
330
|
-
* @param callbacks - An optional {@link Callbacks} object
|
|
331
316
|
*/
|
|
332
317
|
const IdentityProvider = ({ styles, callbacks }) => {
|
|
333
318
|
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('<IdentityProvider />'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/react",
|
|
3
|
-
"version": "19.4.
|
|
3
|
+
"version": "19.4.4",
|
|
4
4
|
"description": "Stytch's official React Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -33,9 +33,10 @@
|
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/runtime": "7.26.10",
|
|
36
|
+
"@stytch/internal-test-utils": "0.0.0",
|
|
36
37
|
"@stytch/internal-tsconfigs": "0.0.0",
|
|
37
38
|
"@stytch/js-utils": "0.0.1",
|
|
38
|
-
"@stytch/vanilla-js": "5.22.
|
|
39
|
+
"@stytch/vanilla-js": "5.22.3",
|
|
39
40
|
"@testing-library/react": "14.0.0",
|
|
40
41
|
"@types/jest": "29.5.14",
|
|
41
42
|
"eslint-config-custom": "0.0.1",
|