@stytch/react 9.0.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/b2b/index.d.ts +2 -1
- package/dist/b2b/index.esm.d.ts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.d.ts +2 -1
- package/dist/index.esm.js +60 -3
- package/dist/index.js +60 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @stytch/react
|
|
2
2
|
|
|
3
|
+
## 11.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8cff174: B2C Passkeys Headless Support & UI components
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [8cff174]
|
|
12
|
+
- @stytch/vanilla-js@3.1.0
|
|
13
|
+
|
|
14
|
+
## 10.0.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [5dd9d24]
|
|
19
|
+
- @stytch/vanilla-js@3.0.0
|
|
20
|
+
|
|
3
21
|
## 9.0.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/b2b/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
import { Member, MemberSession,
|
|
4
|
+
import { Member, MemberSession, StytchB2BUIClient } from "@stytch/vanilla-js/b2b";
|
|
5
|
+
import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
|
|
5
6
|
import { Callbacks, StyleConfig, StytchB2BUIConfig } from "@stytch/vanilla-js";
|
|
6
7
|
/**
|
|
7
8
|
* The Stytch Client object passed in to <StytchProvider /> in your application root.
|
package/dist/b2b/index.esm.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
import { Member, MemberSession,
|
|
4
|
+
import { Member, MemberSession, StytchB2BUIClient } from "@stytch/vanilla-js/b2b";
|
|
5
|
+
import { StytchB2BHeadlessClient } from "@stytch/vanilla-js/b2b/headless";
|
|
5
6
|
import { Callbacks, StyleConfig, StytchB2BUIConfig } from "@stytch/vanilla-js";
|
|
6
7
|
/**
|
|
7
8
|
* The Stytch Client object passed in to <StytchProvider /> in your application root.
|
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ interface StytchResetPasswordProps extends StytchProps {
|
|
|
141
141
|
* @param callbacks - An optional {@link Callbacks} object
|
|
142
142
|
*/
|
|
143
143
|
declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps) => React.JSX.Element;
|
|
144
|
+
declare const StytchPasskeyRegistration: ({ config, styles, callbacks }: StytchProps) => React.JSX.Element;
|
|
144
145
|
/**
|
|
145
146
|
* The Stytch Client object passed in to <StytchProvider /> in your application root.
|
|
146
147
|
* Either a StytchUIClient or StytchHeadlessClient.
|
|
@@ -229,5 +230,5 @@ type StytchProviderProps = {
|
|
|
229
230
|
* )
|
|
230
231
|
*/
|
|
231
232
|
declare const StytchProvider: ({ stytch, children }: StytchProviderProps) => JSX.Element;
|
|
232
|
-
export { StytchLogin, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
233
|
+
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
233
234
|
export type { StytchProviderProps };
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ interface StytchResetPasswordProps extends StytchProps {
|
|
|
141
141
|
* @param callbacks - An optional {@link Callbacks} object
|
|
142
142
|
*/
|
|
143
143
|
declare const StytchPasswordReset: ({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps) => React.JSX.Element;
|
|
144
|
+
declare const StytchPasskeyRegistration: ({ config, styles, callbacks }: StytchProps) => React.JSX.Element;
|
|
144
145
|
/**
|
|
145
146
|
* The Stytch Client object passed in to <StytchProvider /> in your application root.
|
|
146
147
|
* Either a StytchUIClient or StytchHeadlessClient.
|
|
@@ -229,5 +230,5 @@ type StytchProviderProps = {
|
|
|
229
230
|
* )
|
|
230
231
|
*/
|
|
231
232
|
declare const StytchProvider: ({ stytch, children }: StytchProviderProps) => JSX.Element;
|
|
232
|
-
export { StytchLogin, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
233
|
+
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
233
234
|
export type { StytchProviderProps };
|
package/dist/index.esm.js
CHANGED
|
@@ -209,7 +209,7 @@ const StytchLogin = ({ config, styles, callbacks }) => {
|
|
|
209
209
|
containerEl.current.id = `stytch-magic-link-${randId}`;
|
|
210
210
|
}
|
|
211
211
|
stytchClient.mountLogin({
|
|
212
|
-
config,
|
|
212
|
+
config: config,
|
|
213
213
|
callbacks,
|
|
214
214
|
elementId: `#${containerEl.current.id}`,
|
|
215
215
|
styles,
|
|
@@ -270,7 +270,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
|
|
|
270
270
|
}
|
|
271
271
|
if (passwordResetToken) {
|
|
272
272
|
stytchClient.mountResetPassword({
|
|
273
|
-
config,
|
|
273
|
+
config: config,
|
|
274
274
|
callbacks,
|
|
275
275
|
elementId: `#${containerEl.current.id}`,
|
|
276
276
|
styles,
|
|
@@ -280,5 +280,62 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
|
|
|
280
280
|
}, [stytchClient, config, styles, callbacks, passwordResetToken]);
|
|
281
281
|
return React.createElement("div", { ref: containerEl });
|
|
282
282
|
};
|
|
283
|
+
const StytchPasskeyRegistration = ({ config, styles, callbacks }) => {
|
|
284
|
+
/**
|
|
285
|
+
* The Stytch Passkey Registration component.
|
|
286
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
287
|
+
* passed into the {@link StytchProvider}
|
|
288
|
+
*
|
|
289
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
290
|
+
*
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* const styles = {
|
|
294
|
+
* container: {
|
|
295
|
+
* backgroundColor: '#e11e1e',
|
|
296
|
+
* },
|
|
297
|
+
* colors: {
|
|
298
|
+
* primary: '#ff00f7',
|
|
299
|
+
* secondary: '#5C727D',
|
|
300
|
+
* },
|
|
301
|
+
* }
|
|
302
|
+
*
|
|
303
|
+
* <StytchPasskeyRegistration
|
|
304
|
+
* config={{
|
|
305
|
+
* products: ['passkey'],
|
|
306
|
+
* }}
|
|
307
|
+
* styles={styles}
|
|
308
|
+
* callbacks={{
|
|
309
|
+
* onEvent: (event) => console.log(event)
|
|
310
|
+
* }}
|
|
311
|
+
* />
|
|
312
|
+
* @param config - A {@link StytchLoginConfig} object
|
|
313
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
314
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
315
|
+
*/
|
|
316
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchPasskeyRegistration />'));
|
|
317
|
+
const stytchClient = useStytch();
|
|
318
|
+
const user = useStytchUser();
|
|
319
|
+
const containerEl = useRef(null);
|
|
320
|
+
useLayoutEffect(() => {
|
|
321
|
+
if (!isUIClient(stytchClient)) {
|
|
322
|
+
throw Error(noHeadlessClientError);
|
|
323
|
+
}
|
|
324
|
+
if (!containerEl.current) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (!containerEl.current.id) {
|
|
328
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
329
|
+
containerEl.current.id = `stytch-reset-passkey-${randId}`;
|
|
330
|
+
}
|
|
331
|
+
stytchClient.mountPasskeyRegistration({
|
|
332
|
+
config,
|
|
333
|
+
callbacks,
|
|
334
|
+
elementId: `#${containerEl.current.id}`,
|
|
335
|
+
styles,
|
|
336
|
+
});
|
|
337
|
+
}, [stytchClient, config, styles, callbacks, user]);
|
|
338
|
+
return React.createElement("div", { ref: containerEl });
|
|
339
|
+
};
|
|
283
340
|
|
|
284
|
-
export { StytchLogin, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
341
|
+
export { StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
package/dist/index.js
CHANGED
|
@@ -217,7 +217,7 @@ const StytchLogin = ({ config, styles, callbacks }) => {
|
|
|
217
217
|
containerEl.current.id = `stytch-magic-link-${randId}`;
|
|
218
218
|
}
|
|
219
219
|
stytchClient.mountLogin({
|
|
220
|
-
config,
|
|
220
|
+
config: config,
|
|
221
221
|
callbacks,
|
|
222
222
|
elementId: `#${containerEl.current.id}`,
|
|
223
223
|
styles,
|
|
@@ -278,7 +278,7 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
|
|
|
278
278
|
}
|
|
279
279
|
if (passwordResetToken) {
|
|
280
280
|
stytchClient.mountResetPassword({
|
|
281
|
-
config,
|
|
281
|
+
config: config,
|
|
282
282
|
callbacks,
|
|
283
283
|
elementId: `#${containerEl.current.id}`,
|
|
284
284
|
styles,
|
|
@@ -288,8 +288,66 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken })
|
|
|
288
288
|
}, [stytchClient, config, styles, callbacks, passwordResetToken]);
|
|
289
289
|
return React__default['default'].createElement("div", { ref: containerEl });
|
|
290
290
|
};
|
|
291
|
+
const StytchPasskeyRegistration = ({ config, styles, callbacks }) => {
|
|
292
|
+
/**
|
|
293
|
+
* The Stytch Passkey Registration component.
|
|
294
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
295
|
+
* passed into the {@link StytchProvider}
|
|
296
|
+
*
|
|
297
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
298
|
+
*
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* const styles = {
|
|
302
|
+
* container: {
|
|
303
|
+
* backgroundColor: '#e11e1e',
|
|
304
|
+
* },
|
|
305
|
+
* colors: {
|
|
306
|
+
* primary: '#ff00f7',
|
|
307
|
+
* secondary: '#5C727D',
|
|
308
|
+
* },
|
|
309
|
+
* }
|
|
310
|
+
*
|
|
311
|
+
* <StytchPasskeyRegistration
|
|
312
|
+
* config={{
|
|
313
|
+
* products: ['passkey'],
|
|
314
|
+
* }}
|
|
315
|
+
* styles={styles}
|
|
316
|
+
* callbacks={{
|
|
317
|
+
* onEvent: (event) => console.log(event)
|
|
318
|
+
* }}
|
|
319
|
+
* />
|
|
320
|
+
* @param config - A {@link StytchLoginConfig} object
|
|
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
|
+
*/
|
|
324
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<StytchPasskeyRegistration />'));
|
|
325
|
+
const stytchClient = useStytch();
|
|
326
|
+
const user = useStytchUser();
|
|
327
|
+
const containerEl = React.useRef(null);
|
|
328
|
+
React.useLayoutEffect(() => {
|
|
329
|
+
if (!isUIClient(stytchClient)) {
|
|
330
|
+
throw Error(noHeadlessClientError);
|
|
331
|
+
}
|
|
332
|
+
if (!containerEl.current) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (!containerEl.current.id) {
|
|
336
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
337
|
+
containerEl.current.id = `stytch-reset-passkey-${randId}`;
|
|
338
|
+
}
|
|
339
|
+
stytchClient.mountPasskeyRegistration({
|
|
340
|
+
config,
|
|
341
|
+
callbacks,
|
|
342
|
+
elementId: `#${containerEl.current.id}`,
|
|
343
|
+
styles,
|
|
344
|
+
});
|
|
345
|
+
}, [stytchClient, config, styles, callbacks, user]);
|
|
346
|
+
return React__default['default'].createElement("div", { ref: containerEl });
|
|
347
|
+
};
|
|
291
348
|
|
|
292
349
|
exports.StytchLogin = StytchLogin;
|
|
350
|
+
exports.StytchPasskeyRegistration = StytchPasskeyRegistration;
|
|
293
351
|
exports.StytchPasswordReset = StytchPasswordReset;
|
|
294
352
|
exports.StytchProvider = StytchProvider;
|
|
295
353
|
exports.useStytch = useStytch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "Stytch's official React Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/runtime": "7.18.6",
|
|
36
|
-
"@stytch/vanilla-js": "
|
|
36
|
+
"@stytch/vanilla-js": "3.1.0",
|
|
37
37
|
"@testing-library/react": "14.0.0",
|
|
38
38
|
"eslint-config-custom": "0.0.1",
|
|
39
39
|
"react-test-renderer": "18.0.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "4.7.4"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@stytch/vanilla-js": "^
|
|
44
|
+
"@stytch/vanilla-js": "^3.1.0",
|
|
45
45
|
"react": ">= 17.0.2",
|
|
46
46
|
"react-dom": ">= 17.0.2"
|
|
47
47
|
}
|