@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.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.
|
|
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",
|