@stytch/nextjs 21.7.0 → 21.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,17 @@
1
1
  # @stytch/nextjs
2
2
 
3
+ ## 21.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2fc35e7: Export parseOAuthParams function for passing to OAuthAuthorize endpoints
8
+
9
+ ## 21.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d27e450: feat: add device history support to all authentication methods
14
+
3
15
  ## 21.7.0
4
16
 
5
17
  ### Minor Changes
@@ -73,11 +73,19 @@ type B2BIDPConsentManifestGenerator = (input: {
73
73
  scopes: string[];
74
74
  clientName: string;
75
75
  }) => IDPConsentScreenManifest;
76
+ type B2BAuthTokenParams = {
77
+ trustedAuthToken: string;
78
+ tokenProfileID: string;
79
+ };
76
80
  type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
77
81
  /**
78
82
  * Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
79
83
  */
80
84
  getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
85
+ /**
86
+ * Optional trusted auth token parameters to attest before the OAuth flow.
87
+ */
88
+ trustedAuthTokenParams?: B2BAuthTokenParams;
81
89
  };
82
90
  /**
83
91
  * The Stytch B2B UI component.
@@ -140,7 +148,9 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
140
148
  * }}
141
149
  * />
142
150
  */
143
- declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
151
+ declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest, trustedAuthTokenParams }: B2BIdentityProviderProps) => React.JSX.Element;
144
152
  export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-f7acf57f.js";
145
153
  export { StytchB2B, B2BIdentityProvider };
146
154
  export type { StytchB2BProviderProps } from "../StytchB2BContext-f7acf57f.js";
155
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
156
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
@@ -73,11 +73,19 @@ type B2BIDPConsentManifestGenerator = (input: {
73
73
  scopes: string[];
74
74
  clientName: string;
75
75
  }) => IDPConsentScreenManifest;
76
+ type B2BAuthTokenParams = {
77
+ trustedAuthToken: string;
78
+ tokenProfileID: string;
79
+ };
76
80
  type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
77
81
  /**
78
82
  * Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
79
83
  */
80
84
  getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
85
+ /**
86
+ * Optional trusted auth token parameters to attest before the OAuth flow.
87
+ */
88
+ trustedAuthTokenParams?: B2BAuthTokenParams;
81
89
  };
82
90
  /**
83
91
  * The Stytch B2B UI component.
@@ -140,7 +148,9 @@ declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/
140
148
  * }}
141
149
  * />
142
150
  */
143
- declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
151
+ declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest, trustedAuthTokenParams }: B2BIdentityProviderProps) => React.JSX.Element;
144
152
  export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-1cabb03b.js";
145
153
  export { StytchB2B, B2BIdentityProvider };
146
154
  export type { StytchB2BProviderProps } from "../StytchB2BContext-1cabb03b.js";
155
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
156
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
@@ -3,6 +3,7 @@ export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthor
3
3
  import React, { useRef } from 'react';
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();
@@ -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 StytchB2BContext = require('../StytchB2BContext-f7acf57f.js');
6
6
  var React = require('react');
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
 
@@ -133,5 +135,13 @@ exports.withStytchMember = StytchB2BContext.withStytchMember;
133
135
  exports.withStytchMemberSession = StytchB2BContext.withStytchMemberSession;
134
136
  exports.withStytchOrganization = StytchB2BContext.withStytchOrganization;
135
137
  exports.withStytchPermissions = StytchB2BContext.withStytchPermissions;
138
+ Object.defineProperty(exports, 'parseOAuthAuthorizeParams', {
139
+ enumerable: true,
140
+ get: function () { return vanillaJs.parseOAuthAuthorizeParams; }
141
+ });
142
+ Object.defineProperty(exports, 'parseOAuthLogoutParams', {
143
+ enumerable: true,
144
+ get: function () { return vanillaJs.parseOAuthLogoutParams; }
145
+ });
136
146
  exports.B2BIdentityProvider = B2BIdentityProvider;
137
147
  exports.StytchB2B = StytchB2B;
package/dist/index.d.ts CHANGED
@@ -323,11 +323,25 @@ type IDPConsentScreenManifestGenerator = (input: {
323
323
  scopes: string[];
324
324
  clientName: string;
325
325
  }) => IDPConsentScreenManifest;
326
+ type AuthTokenParams = {
327
+ /**
328
+ * The auth token to provide for attestation prior to running OAuth flow.
329
+ */
330
+ trustedAuthToken: string;
331
+ /**
332
+ * The profile ID of the token.
333
+ */
334
+ tokenProfileID: string;
335
+ };
326
336
  type IdentityProviderProps = Omit<StytchProps, "config"> & {
327
337
  /**
328
338
  * Optional {@link IDPConsentScreenManifestGenerator} to customize the consent screen.
329
339
  */
330
340
  getIDPConsentManifest?: IDPConsentScreenManifestGenerator;
341
+ /**
342
+ * Optional {@link AuthTokenParams} to provide a trusted auth token to provide for attestation prior to running OAuth flow.
343
+ */
344
+ authTokenParams?: AuthTokenParams;
331
345
  };
332
346
  /**
333
347
  * The Stytch Reset Password component.
@@ -413,6 +427,8 @@ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<
413
427
  * }}
414
428
  * />
415
429
  */
416
- declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest }: IdentityProviderProps) => React.JSX.Element;
430
+ declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest, authTokenParams }: IdentityProviderProps) => React.JSX.Element;
417
431
  export { IdentityProvider, StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchIsAuthorized, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, withStytchPermissions };
418
432
  export type { StytchProviderProps, IdentityProviderProps, StytchProps, StytchResetPasswordProps };
433
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
434
+ export { parseOAuthAuthorizeParams, parseOAuthLogoutParams } from '@stytch/vanilla-js';
@@ -323,11 +323,25 @@ type IDPConsentScreenManifestGenerator = (input: {
323
323
  scopes: string[];
324
324
  clientName: string;
325
325
  }) => IDPConsentScreenManifest;
326
+ type AuthTokenParams = {
327
+ /**
328
+ * The auth token to provide for attestation prior to running OAuth flow.
329
+ */
330
+ trustedAuthToken: string;
331
+ /**
332
+ * The profile ID of the token.
333
+ */
334
+ tokenProfileID: string;
335
+ };
326
336
  type IdentityProviderProps = Omit<StytchProps, "config"> & {
327
337
  /**
328
338
  * Optional {@link IDPConsentScreenManifestGenerator} to customize the consent screen.
329
339
  */
330
340
  getIDPConsentManifest?: IDPConsentScreenManifestGenerator;
341
+ /**
342
+ * Optional {@link AuthTokenParams} to provide a trusted auth token to provide for attestation prior to running OAuth flow.
343
+ */
344
+ authTokenParams?: AuthTokenParams;
331
345
  };
332
346
  /**
333
347
  * The Stytch Reset Password component.
@@ -413,6 +427,8 @@ declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<
413
427
  * }}
414
428
  * />
415
429
  */
416
- declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest }: IdentityProviderProps) => React.JSX.Element;
430
+ declare const IdentityProvider: ({ styles, callbacks, strings, getIDPConsentManifest, authTokenParams }: IdentityProviderProps) => React.JSX.Element;
417
431
  export { IdentityProvider, StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchIsAuthorized, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, withStytchPermissions };
418
432
  export type { StytchProviderProps, IdentityProviderProps, StytchProps, StytchResetPasswordProps };
433
+ export type { OAuthAuthorizeParams, OAuthLogoutParams } from '@stytch/vanilla-js';
434
+ 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 { i as isStytchSSRProxy, n as noProviderError, 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();
@@ -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();
@@ -445,11 +446,20 @@ 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
 
455
+ Object.defineProperty(exports, 'parseOAuthAuthorizeParams', {
456
+ enumerable: true,
457
+ get: function () { return vanillaJs.parseOAuthAuthorizeParams; }
458
+ });
459
+ Object.defineProperty(exports, 'parseOAuthLogoutParams', {
460
+ enumerable: true,
461
+ get: function () { return vanillaJs.parseOAuthLogoutParams; }
462
+ });
453
463
  exports.IdentityProvider = IdentityProvider;
454
464
  exports.StytchLogin = StytchLogin;
455
465
  exports.StytchPasskeyRegistration = StytchPasskeyRegistration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stytch/nextjs",
3
- "version": "21.7.0",
3
+ "version": "21.9.0",
4
4
  "description": "Stytch's official Next.js Library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -24,7 +24,7 @@
24
24
  "@babel/runtime": "7.27.1",
25
25
  "@stytch/internal-tsconfigs": "0.0.0",
26
26
  "@stytch/js-utils": "0.0.1",
27
- "@stytch/vanilla-js": "5.29.0",
27
+ "@stytch/vanilla-js": "5.33.0",
28
28
  "@testing-library/react": "14.0.0",
29
29
  "@types/jest": "29.5.14",
30
30
  "eslint-config-custom": "0.0.1",