@stytch/react 19.4.2 → 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 +13 -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.d.ts +4 -4
- package/dist/adminPortal/index.esm.d.ts +4 -4
- 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 +48 -29
- package/dist/index.esm.d.ts +48 -29
- package/dist/index.esm.js +41 -56
- package/dist/index.js +41 -56
- package/package.json +3 -2
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
|
-
declare const StytchLogin: <TProjectConfiguration extends Partial<import("core/
|
|
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
|
* />
|
|
136
|
+
*/
|
|
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
|
+
* }
|
|
135
155
|
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
156
|
+
* <StytchPasskeyRegistration
|
|
157
|
+
* styles={styles}
|
|
158
|
+
* callbacks={{
|
|
159
|
+
* onEvent: (event) => console.log(event)
|
|
160
|
+
* }}
|
|
161
|
+
* />
|
|
140
162
|
*/
|
|
141
|
-
declare const
|
|
142
|
-
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
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
|
/**
|
|
@@ -226,8 +245,8 @@ declare const useStytchSession: () => SWRSession;
|
|
|
226
245
|
* stytch.magicLinks.authenticate('...')
|
|
227
246
|
* }, [stytch]);
|
|
228
247
|
*/
|
|
229
|
-
declare const useStytch: <TProjectConfiguration extends Partial<import("core/
|
|
230
|
-
declare const withStytch: <T extends object, TProjectConfiguration extends Partial<import("core/
|
|
248
|
+
declare const useStytch: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>() => StytchClient<TProjectConfiguration>;
|
|
249
|
+
declare const withStytch: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(Component: React.ComponentType<T & {
|
|
231
250
|
stytch: StytchClient<TProjectConfiguration>;
|
|
232
251
|
}>) => React.ComponentType<T>;
|
|
233
252
|
declare const withStytchUser: <T extends object>(Component: React.ComponentType<T & {
|
|
@@ -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
|
*
|
|
@@ -258,6 +277,6 @@ type StytchProviderProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
258
277
|
* document.getElementById('root'),
|
|
259
278
|
* )
|
|
260
279
|
*/
|
|
261
|
-
declare const StytchProvider: <TProjectConfiguration extends Partial<import("core/
|
|
280
|
+
declare const StytchProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children }: StytchProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
262
281
|
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
263
282
|
export type { StytchProviderProps };
|
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
|
-
declare const StytchLogin: <TProjectConfiguration extends Partial<import("core/
|
|
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
|
* />
|
|
136
|
+
*/
|
|
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
|
+
* }
|
|
135
155
|
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
156
|
+
* <StytchPasskeyRegistration
|
|
157
|
+
* styles={styles}
|
|
158
|
+
* callbacks={{
|
|
159
|
+
* onEvent: (event) => console.log(event)
|
|
160
|
+
* }}
|
|
161
|
+
* />
|
|
140
162
|
*/
|
|
141
|
-
declare const
|
|
142
|
-
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
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
|
/**
|
|
@@ -226,8 +245,8 @@ declare const useStytchSession: () => SWRSession;
|
|
|
226
245
|
* stytch.magicLinks.authenticate('...')
|
|
227
246
|
* }, [stytch]);
|
|
228
247
|
*/
|
|
229
|
-
declare const useStytch: <TProjectConfiguration extends Partial<import("core/
|
|
230
|
-
declare const withStytch: <T extends object, TProjectConfiguration extends Partial<import("core/
|
|
248
|
+
declare const useStytch: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>() => StytchClient<TProjectConfiguration>;
|
|
249
|
+
declare const withStytch: <T extends object, TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>(Component: React.ComponentType<T & {
|
|
231
250
|
stytch: StytchClient<TProjectConfiguration>;
|
|
232
251
|
}>) => React.ComponentType<T>;
|
|
233
252
|
declare const withStytchUser: <T extends object>(Component: React.ComponentType<T & {
|
|
@@ -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
|
*
|
|
@@ -258,6 +277,6 @@ type StytchProviderProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
258
277
|
* document.getElementById('root'),
|
|
259
278
|
* )
|
|
260
279
|
*/
|
|
261
|
-
declare const StytchProvider: <TProjectConfiguration extends Partial<import("core/
|
|
280
|
+
declare const StytchProvider: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children }: StytchProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
262
281
|
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
263
282
|
export type { StytchProviderProps };
|
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 />'));
|