@stytch/react 19.7.0 → 19.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @stytch/react
2
2
 
3
+ ## 19.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2fc35e7: Export parseOAuthParams function for passing to OAuthAuthorize endpoints
8
+
9
+ ### Patch Changes
10
+
11
+ - 2fc35e7: Add parseOAuthParams util function for parsing OAuth parameters
12
+
13
+ ## 19.8.0
14
+
15
+ ### Minor Changes
16
+
17
+ - d27e450: feat: add device history support to all authentication methods
18
+
3
19
  ## 19.7.0
4
20
 
5
21
  ### Minor Changes
@@ -76,11 +76,19 @@ type B2BIDPConsentManifestGenerator = (input: {
76
76
  scopes: string[];
77
77
  clientName: string;
78
78
  }) => IDPConsentScreenManifest;
79
+ type B2BAuthTokenParams = {
80
+ trustedAuthToken: string;
81
+ tokenProfileID: string;
82
+ };
79
83
  type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
80
84
  /**
81
85
  * Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
82
86
  */
83
87
  getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
88
+ /**
89
+ * Optional trusted auth token parameters to attest before the OAuth flow.
90
+ */
91
+ trustedAuthTokenParams?: B2BAuthTokenParams;
84
92
  };
85
93
  /**
86
94
  * The Stytch B2B UI component.
@@ -143,7 +151,7 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
143
151
  * }}
144
152
  * />
145
153
  */
146
- declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
154
+ declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest, trustedAuthTokenParams }: B2BIdentityProviderProps) => React.JSX.Element;
147
155
  /**
148
156
  * The Stytch Client object passed in to <StytchB2BProvider /> in your application root.
149
157
  * Either a StytchB2BUIClient or StytchB2BHeadlessClient.
@@ -309,3 +317,5 @@ declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("
309
317
  export { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from "../StytchB2BContext-f7acf57f.js";
310
318
  export { StytchB2BProvider, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchMemberSession, withStytchMember, withStytchOrganization, StytchB2B, B2BIdentityProvider };
311
319
  export type { StytchB2BProviderProps, StytchB2BProps, B2BIdentityProviderProps };
320
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
321
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
@@ -76,11 +76,19 @@ type B2BIDPConsentManifestGenerator = (input: {
76
76
  scopes: string[];
77
77
  clientName: string;
78
78
  }) => IDPConsentScreenManifest;
79
+ type B2BAuthTokenParams = {
80
+ trustedAuthToken: string;
81
+ tokenProfileID: string;
82
+ };
79
83
  type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
80
84
  /**
81
85
  * Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
82
86
  */
83
87
  getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
88
+ /**
89
+ * Optional trusted auth token parameters to attest before the OAuth flow.
90
+ */
91
+ trustedAuthTokenParams?: B2BAuthTokenParams;
84
92
  };
85
93
  /**
86
94
  * The Stytch B2B UI component.
@@ -143,7 +151,7 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
143
151
  * }}
144
152
  * />
145
153
  */
146
- declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
154
+ declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest, trustedAuthTokenParams }: B2BIdentityProviderProps) => React.JSX.Element;
147
155
  /**
148
156
  * The Stytch Client object passed in to <StytchB2BProvider /> in your application root.
149
157
  * Either a StytchB2BUIClient or StytchB2BHeadlessClient.
@@ -309,3 +317,5 @@ declare const StytchB2BProvider: <TProjectConfiguration extends Partial<import("
309
317
  export { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from "../StytchB2BContext-4afdf6a8.js";
310
318
  export { StytchB2BProvider, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchMemberSession, withStytchMember, withStytchOrganization, StytchB2B, B2BIdentityProvider };
311
319
  export type { StytchB2BProviderProps, StytchB2BProps, B2BIdentityProviderProps };
320
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
321
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
@@ -3,6 +3,7 @@ import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient,
3
3
  export { a as useStytchB2BClient, h as withStytchB2BClient, j as withStytchPermissions } from '../StytchB2BContext-4afdf6a8.js';
4
4
  import { i as invariant, a as useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect-681e2138.js';
5
5
  import { a as noHeadlessClientError, n as noProviderError } from '../StytchSSRProxy-34c789b5.js';
6
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
6
7
 
7
8
  /**
8
9
  * The Stytch B2B UI component.
@@ -89,7 +90,7 @@ const StytchB2B = ({ styles, callbacks, config, strings, }) => {
89
90
  * }}
90
91
  * />
91
92
  */
92
- const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
93
+ const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest, trustedAuthTokenParams, }) => {
93
94
  invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
94
95
  const stytchClient = useStytchB2BClient();
95
96
  const { member } = useStytchMember$1();
@@ -110,8 +111,9 @@ const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
110
111
  elementId: `#${containerEl.current.id}`,
111
112
  styles,
112
113
  getIDPConsentManifest,
114
+ trustedAuthTokenParams,
113
115
  });
114
- }, [stytchClient, styles, callbacks, member, getIDPConsentManifest]);
116
+ }, [stytchClient, styles, callbacks, member, getIDPConsentManifest, trustedAuthTokenParams]);
115
117
  return React.createElement("div", { ref: containerEl });
116
118
  };
117
119
 
package/dist/b2b/index.js CHANGED
@@ -6,6 +6,7 @@ var React = require('react');
6
6
  var StytchB2BContext = require('../StytchB2BContext-f7acf57f.js');
7
7
  var useIsomorphicLayoutEffect = require('../useIsomorphicLayoutEffect-672e4b66.js');
8
8
  var StytchSSRProxy = require('../StytchSSRProxy-86bc42b3.js');
9
+ var vanillaJs = require('@stytch/vanilla-js');
9
10
 
10
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
12
 
@@ -96,7 +97,7 @@ const StytchB2B = ({ styles, callbacks, config, strings, }) => {
96
97
  * }}
97
98
  * />
98
99
  */
99
- const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
100
+ const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest, trustedAuthTokenParams, }) => {
100
101
  useIsomorphicLayoutEffect.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<IdentityProvider />'));
101
102
  const stytchClient = StytchB2BContext.useStytchB2BClient();
102
103
  const { member } = StytchB2BContext.useStytchMember();
@@ -117,8 +118,9 @@ const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
117
118
  elementId: `#${containerEl.current.id}`,
118
119
  styles,
119
120
  getIDPConsentManifest,
121
+ trustedAuthTokenParams,
120
122
  });
121
- }, [stytchClient, styles, callbacks, member, getIDPConsentManifest]);
123
+ }, [stytchClient, styles, callbacks, member, getIDPConsentManifest, trustedAuthTokenParams]);
122
124
  return React__default["default"].createElement("div", { ref: containerEl });
123
125
  };
124
126
 
@@ -201,6 +203,14 @@ const StytchB2BProvider = ({ stytch, children, assumeHydrated = true, }) => {
201
203
  exports.useStytchB2BClient = StytchB2BContext.useStytchB2BClient;
202
204
  exports.withStytchB2BClient = StytchB2BContext.withStytchB2BClient;
203
205
  exports.withStytchPermissions = StytchB2BContext.withStytchPermissions;
206
+ Object.defineProperty(exports, 'parseOAuthAuthorizeParams', {
207
+ enumerable: true,
208
+ get: function () { return vanillaJs.parseOAuthAuthorizeParams; }
209
+ });
210
+ Object.defineProperty(exports, 'parseOAuthLogoutParams', {
211
+ enumerable: true,
212
+ get: function () { return vanillaJs.parseOAuthLogoutParams; }
213
+ });
204
214
  exports.B2BIdentityProvider = B2BIdentityProvider;
205
215
  exports.StytchB2B = StytchB2B;
206
216
  exports.StytchB2BProvider = StytchB2BProvider;
package/dist/index.d.ts CHANGED
@@ -127,11 +127,25 @@ type IDPConsentScreenManifestGenerator = (input: {
127
127
  scopes: string[];
128
128
  clientName: string;
129
129
  }) => IDPConsentScreenManifest;
130
+ type AuthTokenParams = {
131
+ /**
132
+ * The auth token to provide for attestation prior to running OAuth flow.
133
+ */
134
+ trustedAuthToken: string;
135
+ /**
136
+ * The profile ID of the token.
137
+ */
138
+ tokenProfileID: string;
139
+ };
130
140
  type IdentityProviderProps = Omit<StytchProps, "config"> & {
131
141
  /**
132
142
  * Optional {@link IDPConsentScreenManifestGenerator} to customize the consent screen.
133
143
  */
134
144
  getIDPConsentManifest?: IDPConsentScreenManifestGenerator;
145
+ /**
146
+ * Optional {@link AuthTokenParams} to provide a trusted auth token to provide for attestation prior to running OAuth flow.
147
+ */
148
+ authTokenParams?: AuthTokenParams;
135
149
  };
136
150
  /**
137
151
  * The Stytch Reset Password component.
@@ -217,7 +231,7 @@ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<
217
231
  * }}
218
232
  * />
219
233
  */
220
- declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest }: IdentityProviderProps) => React.JSX.Element;
234
+ declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest, authTokenParams }: IdentityProviderProps) => React.JSX.Element;
221
235
  /**
222
236
  * Returns the active User.
223
237
  * The Stytch SDKs are used for client-side authentication and session management.
@@ -343,3 +357,5 @@ interface StytchProviderProps$0<TProjectConfiguration extends StytchProjectConfi
343
357
  declare const StytchProvider$0: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children, assumeHydrated }: StytchProviderProps$0<TProjectConfiguration>) => JSX.Element;
344
358
  export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider, StytchProvider$0 as StytchProvider, useStytch, useStytchSession$0 as useStytchSession, useStytchUser$0 as useStytchUser, withStytch, withStytchSession$0 as withStytchSession, withStytchUser$0 as withStytchUser, useStytchIsAuthorized$0 as useStytchIsAuthorized, withStytchPermissions$0 as withStytchPermissions };
345
359
  export type { StytchProviderProps$0 as StytchProviderProps, StytchProps, StytchResetPasswordProps, IdentityProviderProps };
360
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
361
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
@@ -127,11 +127,25 @@ type IDPConsentScreenManifestGenerator = (input: {
127
127
  scopes: string[];
128
128
  clientName: string;
129
129
  }) => IDPConsentScreenManifest;
130
+ type AuthTokenParams = {
131
+ /**
132
+ * The auth token to provide for attestation prior to running OAuth flow.
133
+ */
134
+ trustedAuthToken: string;
135
+ /**
136
+ * The profile ID of the token.
137
+ */
138
+ tokenProfileID: string;
139
+ };
130
140
  type IdentityProviderProps = Omit<StytchProps, "config"> & {
131
141
  /**
132
142
  * Optional {@link IDPConsentScreenManifestGenerator} to customize the consent screen.
133
143
  */
134
144
  getIDPConsentManifest?: IDPConsentScreenManifestGenerator;
145
+ /**
146
+ * Optional {@link AuthTokenParams} to provide a trusted auth token to provide for attestation prior to running OAuth flow.
147
+ */
148
+ authTokenParams?: AuthTokenParams;
135
149
  };
136
150
  /**
137
151
  * The Stytch Reset Password component.
@@ -217,7 +231,7 @@ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<
217
231
  * }}
218
232
  * />
219
233
  */
220
- declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest }: IdentityProviderProps) => React.JSX.Element;
234
+ declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest, authTokenParams }: IdentityProviderProps) => React.JSX.Element;
221
235
  /**
222
236
  * Returns the active User.
223
237
  * The Stytch SDKs are used for client-side authentication and session management.
@@ -343,3 +357,5 @@ interface StytchProviderProps$0<TProjectConfiguration extends StytchProjectConfi
343
357
  declare const StytchProvider$0: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children, assumeHydrated }: StytchProviderProps$0<TProjectConfiguration>) => JSX.Element;
344
358
  export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider, StytchProvider$0 as StytchProvider, useStytch, useStytchSession$0 as useStytchSession, useStytchUser$0 as useStytchUser, withStytch, withStytchSession$0 as withStytchSession, withStytchUser$0 as withStytchUser, useStytchIsAuthorized$0 as useStytchIsAuthorized, withStytchPermissions$0 as withStytchPermissions };
345
359
  export type { StytchProviderProps$0 as StytchProviderProps, StytchProps, StytchResetPasswordProps, IdentityProviderProps };
360
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
361
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
package/dist/index.esm.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import React, { createContext, useContext, useEffect, useMemo, useCallback, useRef } from 'react';
2
2
  import { i as invariant, u as useAsyncState, m as mergeWithStableProps, a as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect-681e2138.js';
3
3
  import { n as noProviderError, i as isStytchSSRProxy, p as providerMustBeUniqueError, a as noHeadlessClientError } from './StytchSSRProxy-34c789b5.js';
4
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
4
5
 
5
6
  const initialUser = {
6
7
  user: null,
@@ -415,7 +416,7 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, strings, }) => {
415
416
  * }}
416
417
  * />
417
418
  */
418
- const IdentityProvider = ({ styles, callbacks, strings, getIDPConsentManifest }) => {
419
+ const IdentityProvider = ({ styles, callbacks, strings, getIDPConsentManifest, authTokenParams, }) => {
419
420
  invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
420
421
  const stytchClient = useStytch();
421
422
  const user = useStytchUser$1();
@@ -437,8 +438,9 @@ const IdentityProvider = ({ styles, callbacks, strings, getIDPConsentManifest })
437
438
  styles,
438
439
  strings,
439
440
  getIDPConsentManifest,
441
+ authTokenParams,
440
442
  });
441
- }, [stytchClient, styles, callbacks, user, strings, getIDPConsentManifest]);
443
+ }, [stytchClient, styles, callbacks, user, strings, getIDPConsentManifest, authTokenParams]);
442
444
  return React.createElement("div", { ref: containerEl });
443
445
  };
444
446
 
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var useIsomorphicLayoutEffect = require('./useIsomorphicLayoutEffect-672e4b66.js');
7
7
  var StytchSSRProxy = require('./StytchSSRProxy-86bc42b3.js');
8
+ var vanillaJs = require('@stytch/vanilla-js');
8
9
 
9
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
11
 
@@ -423,7 +424,7 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, strings, }) => {
423
424
  * }}
424
425
  * />
425
426
  */
426
- const IdentityProvider = ({ styles, callbacks, strings, getIDPConsentManifest }) => {
427
+ const IdentityProvider = ({ styles, callbacks, strings, getIDPConsentManifest, authTokenParams, }) => {
427
428
  useIsomorphicLayoutEffect.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<IdentityProvider />'));
428
429
  const stytchClient = useStytch();
429
430
  const user = useStytchUser$1();
@@ -445,8 +446,9 @@ const IdentityProvider = ({ styles, callbacks, strings, getIDPConsentManifest })
445
446
  styles,
446
447
  strings,
447
448
  getIDPConsentManifest,
449
+ authTokenParams,
448
450
  });
449
- }, [stytchClient, styles, callbacks, user, strings, getIDPConsentManifest]);
451
+ }, [stytchClient, styles, callbacks, user, strings, getIDPConsentManifest, authTokenParams]);
450
452
  return React__default["default"].createElement("div", { ref: containerEl });
451
453
  };
452
454
 
@@ -501,6 +503,14 @@ const StytchProvider = ({ stytch, children, assumeHydrated = true, }) => {
501
503
  return (React__default["default"].createElement(StytchProvider$1, { stytch: stytch, assumeHydrated: assumeHydrated }, children));
502
504
  };
503
505
 
506
+ Object.defineProperty(exports, 'parseOAuthAuthorizeParams', {
507
+ enumerable: true,
508
+ get: function () { return vanillaJs.parseOAuthAuthorizeParams; }
509
+ });
510
+ Object.defineProperty(exports, 'parseOAuthLogoutParams', {
511
+ enumerable: true,
512
+ get: function () { return vanillaJs.parseOAuthLogoutParams; }
513
+ });
504
514
  exports.IdentityProvider = IdentityProvider;
505
515
  exports.StytchLogin = StytchLogin;
506
516
  exports.StytchPasskeyRegistration = StytchPasskeyRegistration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stytch/react",
3
- "version": "19.7.0",
3
+ "version": "19.9.0",
4
4
  "description": "Stytch's official React Library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -39,7 +39,7 @@
39
39
  "@stytch/internal-test-utils": "0.0.0",
40
40
  "@stytch/internal-tsconfigs": "0.0.0",
41
41
  "@stytch/js-utils": "0.0.1",
42
- "@stytch/vanilla-js": "5.29.0",
42
+ "@stytch/vanilla-js": "5.33.0",
43
43
  "@testing-library/react": "14.0.0",
44
44
  "@types/jest": "29.5.14",
45
45
  "eslint-config-custom": "0.0.1",