@stytch/nextjs 21.3.0 → 21.4.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 +6 -0
- package/dist/{StytchB2BContext-72d99610.js → StytchB2BContext-0ff0e987.js} +1 -1
- package/dist/adminPortal/index.esm.js +1 -1
- package/dist/b2b/index.d.ts +43 -1
- package/dist/b2b/index.esm.d.ts +45 -3
- package/dist/b2b/index.esm.js +59 -3
- package/dist/b2b/index.js +57 -0
- package/dist/index.d.ts +34 -4
- package/dist/index.esm.d.ts +34 -4
- package/dist/index.esm.js +56 -4
- package/dist/index.js +56 -3
- package/package.json +2 -2
- /package/dist/{StytchB2BContext-72d99610.d.ts → StytchB2BContext-0ff0e987.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -255,4 +255,4 @@ const StytchB2BProvider = ({ stytch, children, }) => {
|
|
|
255
255
|
React.createElement(StytchMemberSessionContext.Provider, { value: session }, children)))));
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
-
export { StytchB2BProvider as S, useStytchB2BClient as a,
|
|
258
|
+
export { StytchB2BProvider as S, useStytchB2BClient as a, useStytchMember as b, useStytchMemberSession as c, useStytchIsAuthorized as d, useStytchOrganization as e, withStytchMemberSession as f, withStytchMember as g, withStytchOrganization as h, isUIClient as i, withStytchPermissions as j, useIsMounted__INTERNAL as u, withStytchB2BClient as w };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mountAdminPortalSSO, mountAdminPortalOrgSettings, mountAdminPortalMemberManagement, mountAdminPortalSCIM } from '@stytch/vanilla-js/b2b/adminPortal';
|
|
2
2
|
export { AdminPortalB2BProducts } from '@stytch/vanilla-js/b2b/adminPortal';
|
|
3
3
|
import React, { useRef, useLayoutEffect } from 'react';
|
|
4
|
-
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-
|
|
4
|
+
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient } from '../StytchB2BContext-0ff0e987.js';
|
|
5
5
|
import { n as noProviderError } from '../StytchSSRProxy-14916009.js';
|
|
6
6
|
import { i as invariant } from '../async-b1e10055.js';
|
|
7
7
|
|
package/dist/b2b/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Callbacks, StyleConfig, StytchB2BUIConfig, StytchProjectConfigurationInput } from "@stytch/vanilla-js";
|
|
4
|
+
// We need to import the StytchB2BUIClient type to give the TSDoc parser a hint as to where it is from
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
import { IDPConsentScreenManifest } from "@stytch/vanilla-js/b2b";
|
|
4
7
|
interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
5
8
|
/**
|
|
6
9
|
* An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
@@ -68,6 +71,13 @@ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
68
71
|
*/
|
|
69
72
|
config: StytchB2BUIConfig;
|
|
70
73
|
}
|
|
74
|
+
type B2BIDPConsentManifestGenerator = (input: {
|
|
75
|
+
scopes: string[];
|
|
76
|
+
clientName: string;
|
|
77
|
+
}) => IDPConsentScreenManifest;
|
|
78
|
+
type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
|
|
79
|
+
getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
|
|
80
|
+
};
|
|
71
81
|
/**
|
|
72
82
|
* The Stytch B2B UI component.
|
|
73
83
|
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
@@ -103,6 +113,38 @@ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
103
113
|
* @param props {@link StytchB2BProps}
|
|
104
114
|
*/
|
|
105
115
|
declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ styles, callbacks, config }: StytchB2BProps<TProjectConfiguration>) => React.JSX.Element;
|
|
116
|
+
/**
|
|
117
|
+
* The Stytch B2B IDP component.
|
|
118
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
119
|
+
* Requires the user to be logged in.
|
|
120
|
+
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
121
|
+
* passed into the {@link StytchB2BProvider}
|
|
122
|
+
*
|
|
123
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* const styles = {
|
|
127
|
+
* container: {
|
|
128
|
+
* backgroundColor: '#e11e1e',
|
|
129
|
+
* },
|
|
130
|
+
* colors: {
|
|
131
|
+
* primary: '#ff00f7',
|
|
132
|
+
* secondary: '#5C727D',
|
|
133
|
+
* },
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* <B2BIdentityProvider
|
|
137
|
+
* styles={styles}
|
|
138
|
+
* callbacks={{
|
|
139
|
+
* onEvent: (event) => console.log(event)
|
|
140
|
+
* }}
|
|
141
|
+
* />
|
|
142
|
+
*
|
|
143
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
144
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
145
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
146
|
+
*/
|
|
147
|
+
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
106
148
|
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-8246a922.js";
|
|
107
|
-
export { StytchB2B };
|
|
149
|
+
export { StytchB2B, B2BIdentityProvider };
|
|
108
150
|
export type { StytchB2BProviderProps } from "../StytchB2BContext-8246a922.js";
|
package/dist/b2b/index.esm.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Callbacks, StyleConfig, StytchB2BUIConfig, StytchProjectConfigurationInput } from "@stytch/vanilla-js";
|
|
4
|
+
// We need to import the StytchB2BUIClient type to give the TSDoc parser a hint as to where it is from
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
6
|
+
import { IDPConsentScreenManifest } from "@stytch/vanilla-js/b2b";
|
|
4
7
|
interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> {
|
|
5
8
|
/**
|
|
6
9
|
* An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
@@ -68,6 +71,13 @@ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
68
71
|
*/
|
|
69
72
|
config: StytchB2BUIConfig;
|
|
70
73
|
}
|
|
74
|
+
type B2BIDPConsentManifestGenerator = (input: {
|
|
75
|
+
scopes: string[];
|
|
76
|
+
clientName: string;
|
|
77
|
+
}) => IDPConsentScreenManifest;
|
|
78
|
+
type B2BIdentityProviderProps = Omit<StytchB2BProps, "config"> & {
|
|
79
|
+
getIDPConsentManifest?: B2BIDPConsentManifestGenerator;
|
|
80
|
+
};
|
|
71
81
|
/**
|
|
72
82
|
* The Stytch B2B UI component.
|
|
73
83
|
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
@@ -103,6 +113,38 @@ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
103
113
|
* @param props {@link StytchB2BProps}
|
|
104
114
|
*/
|
|
105
115
|
declare const StytchB2B: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ styles, callbacks, config }: StytchB2BProps<TProjectConfiguration>) => React.JSX.Element;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
/**
|
|
117
|
+
* The Stytch B2B IDP component.
|
|
118
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
119
|
+
* Requires the user to be logged in.
|
|
120
|
+
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
121
|
+
* passed into the {@link StytchB2BProvider}
|
|
122
|
+
*
|
|
123
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* const styles = {
|
|
127
|
+
* container: {
|
|
128
|
+
* backgroundColor: '#e11e1e',
|
|
129
|
+
* },
|
|
130
|
+
* colors: {
|
|
131
|
+
* primary: '#ff00f7',
|
|
132
|
+
* secondary: '#5C727D',
|
|
133
|
+
* },
|
|
134
|
+
* }
|
|
135
|
+
*
|
|
136
|
+
* <B2BIdentityProvider
|
|
137
|
+
* styles={styles}
|
|
138
|
+
* callbacks={{
|
|
139
|
+
* onEvent: (event) => console.log(event)
|
|
140
|
+
* }}
|
|
141
|
+
* />
|
|
142
|
+
*
|
|
143
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
144
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
145
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
146
|
+
*/
|
|
147
|
+
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
148
|
+
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-0ff0e987.js";
|
|
149
|
+
export { StytchB2B, B2BIdentityProvider };
|
|
150
|
+
export type { StytchB2BProviderProps } from "../StytchB2BContext-0ff0e987.js";
|
package/dist/b2b/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient } from '../StytchB2BContext-
|
|
2
|
-
export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized,
|
|
1
|
+
import { u as useIsMounted__INTERNAL, a as useStytchB2BClient, i as isUIClient, b as useStytchMember } from '../StytchB2BContext-0ff0e987.js';
|
|
2
|
+
export { S as StytchB2BProvider, a as useStytchB2BClient, d as useStytchIsAuthorized, b as useStytchMember, c as useStytchMemberSession, e as useStytchOrganization, w as withStytchB2BClient, g as withStytchMember, f as withStytchMemberSession, h as withStytchOrganization, j as withStytchPermissions } from '../StytchB2BContext-0ff0e987.js';
|
|
3
3
|
import React, { useRef, useLayoutEffect } from 'react';
|
|
4
4
|
import { i as invariant } from '../async-b1e10055.js';
|
|
5
5
|
import { a as noHeadlessClientError, n as noProviderError } from '../StytchSSRProxy-14916009.js';
|
|
@@ -63,5 +63,61 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
63
63
|
}, [stytchClient, styles, callbacks]);
|
|
64
64
|
return React.createElement("div", { ref: containerEl });
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* The Stytch B2B IDP component.
|
|
68
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
69
|
+
* Requires the user to be logged in.
|
|
70
|
+
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
71
|
+
* passed into the {@link StytchB2BProvider}
|
|
72
|
+
*
|
|
73
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* const styles = {
|
|
77
|
+
* container: {
|
|
78
|
+
* backgroundColor: '#e11e1e',
|
|
79
|
+
* },
|
|
80
|
+
* colors: {
|
|
81
|
+
* primary: '#ff00f7',
|
|
82
|
+
* secondary: '#5C727D',
|
|
83
|
+
* },
|
|
84
|
+
* }
|
|
85
|
+
*
|
|
86
|
+
* <B2BIdentityProvider
|
|
87
|
+
* styles={styles}
|
|
88
|
+
* callbacks={{
|
|
89
|
+
* onEvent: (event) => console.log(event)
|
|
90
|
+
* }}
|
|
91
|
+
* />
|
|
92
|
+
*
|
|
93
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
94
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
95
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
96
|
+
*/
|
|
97
|
+
const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
|
|
98
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
|
|
99
|
+
const stytchClient = useStytchB2BClient();
|
|
100
|
+
const containerEl = useRef(null);
|
|
101
|
+
const { member } = useStytchMember();
|
|
102
|
+
useLayoutEffect(() => {
|
|
103
|
+
if (!isUIClient(stytchClient)) {
|
|
104
|
+
throw Error(noHeadlessClientError);
|
|
105
|
+
}
|
|
106
|
+
if (!containerEl.current) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (!containerEl.current.id) {
|
|
110
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
111
|
+
containerEl.current.id = `stytch-b2b-idp-${randId}`;
|
|
112
|
+
}
|
|
113
|
+
stytchClient.mountIdentityProvider({
|
|
114
|
+
callbacks,
|
|
115
|
+
elementId: `#${containerEl.current.id}`,
|
|
116
|
+
styles,
|
|
117
|
+
getIDPConsentManifest,
|
|
118
|
+
});
|
|
119
|
+
}, [stytchClient, styles, callbacks, member, getIDPConsentManifest]);
|
|
120
|
+
return React.createElement("div", { ref: containerEl });
|
|
121
|
+
};
|
|
66
122
|
|
|
67
|
-
export { StytchB2B };
|
|
123
|
+
export { B2BIdentityProvider, StytchB2B };
|
package/dist/b2b/index.js
CHANGED
|
@@ -70,6 +70,62 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
70
70
|
}, [stytchClient, styles, callbacks]);
|
|
71
71
|
return React__default["default"].createElement("div", { ref: containerEl });
|
|
72
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* The Stytch B2B IDP component.
|
|
75
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
76
|
+
* Requires the user to be logged in.
|
|
77
|
+
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
78
|
+
* passed into the {@link StytchB2BProvider}
|
|
79
|
+
*
|
|
80
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const styles = {
|
|
84
|
+
* container: {
|
|
85
|
+
* backgroundColor: '#e11e1e',
|
|
86
|
+
* },
|
|
87
|
+
* colors: {
|
|
88
|
+
* primary: '#ff00f7',
|
|
89
|
+
* secondary: '#5C727D',
|
|
90
|
+
* },
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* <B2BIdentityProvider
|
|
94
|
+
* styles={styles}
|
|
95
|
+
* callbacks={{
|
|
96
|
+
* onEvent: (event) => console.log(event)
|
|
97
|
+
* }}
|
|
98
|
+
* />
|
|
99
|
+
*
|
|
100
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
101
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
102
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
103
|
+
*/
|
|
104
|
+
const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
|
|
105
|
+
async.invariant(StytchB2BContext.useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<IdentityProvider />'));
|
|
106
|
+
const stytchClient = StytchB2BContext.useStytchB2BClient();
|
|
107
|
+
const containerEl = React.useRef(null);
|
|
108
|
+
const { member } = StytchB2BContext.useStytchMember();
|
|
109
|
+
React.useLayoutEffect(() => {
|
|
110
|
+
if (!StytchB2BContext.isUIClient(stytchClient)) {
|
|
111
|
+
throw Error(StytchSSRProxy.noHeadlessClientError);
|
|
112
|
+
}
|
|
113
|
+
if (!containerEl.current) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!containerEl.current.id) {
|
|
117
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
118
|
+
containerEl.current.id = `stytch-b2b-idp-${randId}`;
|
|
119
|
+
}
|
|
120
|
+
stytchClient.mountIdentityProvider({
|
|
121
|
+
callbacks,
|
|
122
|
+
elementId: `#${containerEl.current.id}`,
|
|
123
|
+
styles,
|
|
124
|
+
getIDPConsentManifest,
|
|
125
|
+
});
|
|
126
|
+
}, [stytchClient, styles, callbacks, member, getIDPConsentManifest]);
|
|
127
|
+
return React__default["default"].createElement("div", { ref: containerEl });
|
|
128
|
+
};
|
|
73
129
|
|
|
74
130
|
exports.StytchB2BProvider = StytchB2BContext.StytchB2BProvider;
|
|
75
131
|
exports.useStytchB2BClient = StytchB2BContext.useStytchB2BClient;
|
|
@@ -82,4 +138,5 @@ exports.withStytchMember = StytchB2BContext.withStytchMember;
|
|
|
82
138
|
exports.withStytchMemberSession = StytchB2BContext.withStytchMemberSession;
|
|
83
139
|
exports.withStytchOrganization = StytchB2BContext.withStytchOrganization;
|
|
84
140
|
exports.withStytchPermissions = StytchB2BContext.withStytchPermissions;
|
|
141
|
+
exports.B2BIdentityProvider = B2BIdentityProvider;
|
|
85
142
|
exports.StytchB2B = StytchB2B;
|
package/dist/index.d.ts
CHANGED
|
@@ -171,7 +171,6 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
171
171
|
* in your `_app.jsx` file.
|
|
172
172
|
*
|
|
173
173
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
174
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
175
174
|
*
|
|
176
175
|
* @example
|
|
177
176
|
* <StytchLogin
|
|
@@ -203,13 +202,13 @@ declare const StytchLogin: <TProjectConfiguration extends Partial<import("@stytc
|
|
|
203
202
|
interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
|
|
204
203
|
passwordResetToken: string;
|
|
205
204
|
}
|
|
205
|
+
type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
206
206
|
/**
|
|
207
207
|
* The Stytch Reset Password component.
|
|
208
208
|
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
209
209
|
* passed into the {@link StytchProvider}
|
|
210
210
|
*
|
|
211
211
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
212
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
213
212
|
*
|
|
214
213
|
* @example
|
|
215
214
|
* <StytchPasswordReset
|
|
@@ -246,7 +245,6 @@ declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import
|
|
|
246
245
|
* passed into the {@link StytchProvider}
|
|
247
246
|
*
|
|
248
247
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
249
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
250
248
|
*
|
|
251
249
|
* @example
|
|
252
250
|
* const styles = {
|
|
@@ -271,5 +269,37 @@ declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import
|
|
|
271
269
|
* @param callbacks - An optional {@link Callbacks} object
|
|
272
270
|
*/
|
|
273
271
|
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
274
|
-
|
|
272
|
+
/**
|
|
273
|
+
* The Stytch IDP component.
|
|
274
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
275
|
+
* Requires the user to be logged in.
|
|
276
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
277
|
+
* passed into the {@link StytchProvider}
|
|
278
|
+
*
|
|
279
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* const styles = {
|
|
283
|
+
* container: {
|
|
284
|
+
* backgroundColor: '#e11e1e',
|
|
285
|
+
* },
|
|
286
|
+
* colors: {
|
|
287
|
+
* primary: '#ff00f7',
|
|
288
|
+
* secondary: '#5C727D',
|
|
289
|
+
* },
|
|
290
|
+
* }
|
|
291
|
+
*
|
|
292
|
+
* <IdentityProvider
|
|
293
|
+
* styles={styles}
|
|
294
|
+
* callbacks={{
|
|
295
|
+
* onEvent: (event) => console.log(event)
|
|
296
|
+
* }}
|
|
297
|
+
* />
|
|
298
|
+
* />
|
|
299
|
+
*
|
|
300
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
301
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
302
|
+
*/
|
|
303
|
+
declare const IdentityProvider: ({ styles, callbacks }: IdentityProviderProps) => React.JSX.Element;
|
|
304
|
+
export { StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider };
|
|
275
305
|
export type { StytchProviderProps };
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -171,7 +171,6 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
171
171
|
* in your `_app.jsx` file.
|
|
172
172
|
*
|
|
173
173
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
174
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
175
174
|
*
|
|
176
175
|
* @example
|
|
177
176
|
* <StytchLogin
|
|
@@ -203,13 +202,13 @@ declare const StytchLogin: <TProjectConfiguration extends Partial<import("@stytc
|
|
|
203
202
|
interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
|
|
204
203
|
passwordResetToken: string;
|
|
205
204
|
}
|
|
205
|
+
type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
206
206
|
/**
|
|
207
207
|
* The Stytch Reset Password component.
|
|
208
208
|
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
209
209
|
* passed into the {@link StytchProvider}
|
|
210
210
|
*
|
|
211
211
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
212
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
213
212
|
*
|
|
214
213
|
* @example
|
|
215
214
|
* <StytchPasswordReset
|
|
@@ -246,7 +245,6 @@ declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import
|
|
|
246
245
|
* passed into the {@link StytchProvider}
|
|
247
246
|
*
|
|
248
247
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
249
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
250
248
|
*
|
|
251
249
|
* @example
|
|
252
250
|
* const styles = {
|
|
@@ -271,5 +269,37 @@ declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import
|
|
|
271
269
|
* @param callbacks - An optional {@link Callbacks} object
|
|
272
270
|
*/
|
|
273
271
|
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("@stytch/core/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
274
|
-
|
|
272
|
+
/**
|
|
273
|
+
* The Stytch IDP component.
|
|
274
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
275
|
+
* Requires the user to be logged in.
|
|
276
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
277
|
+
* passed into the {@link StytchProvider}
|
|
278
|
+
*
|
|
279
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* const styles = {
|
|
283
|
+
* container: {
|
|
284
|
+
* backgroundColor: '#e11e1e',
|
|
285
|
+
* },
|
|
286
|
+
* colors: {
|
|
287
|
+
* primary: '#ff00f7',
|
|
288
|
+
* secondary: '#5C727D',
|
|
289
|
+
* },
|
|
290
|
+
* }
|
|
291
|
+
*
|
|
292
|
+
* <IdentityProvider
|
|
293
|
+
* styles={styles}
|
|
294
|
+
* callbacks={{
|
|
295
|
+
* onEvent: (event) => console.log(event)
|
|
296
|
+
* }}
|
|
297
|
+
* />
|
|
298
|
+
* />
|
|
299
|
+
*
|
|
300
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
301
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
302
|
+
*/
|
|
303
|
+
declare const IdentityProvider: ({ styles, callbacks }: IdentityProviderProps) => React.JSX.Element;
|
|
304
|
+
export { StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser, StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider };
|
|
275
305
|
export type { StytchProviderProps };
|
package/dist/index.esm.js
CHANGED
|
@@ -147,7 +147,6 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffec
|
|
|
147
147
|
* in your `_app.jsx` file.
|
|
148
148
|
*
|
|
149
149
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
150
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
151
150
|
*
|
|
152
151
|
* @example
|
|
153
152
|
* <StytchLogin
|
|
@@ -205,7 +204,6 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
205
204
|
* passed into the {@link StytchProvider}
|
|
206
205
|
*
|
|
207
206
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
208
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
209
207
|
*
|
|
210
208
|
* @example
|
|
211
209
|
* <StytchPasswordReset
|
|
@@ -268,7 +266,6 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, })
|
|
|
268
266
|
* passed into the {@link StytchProvider}
|
|
269
267
|
*
|
|
270
268
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
271
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
272
269
|
*
|
|
273
270
|
* @example
|
|
274
271
|
* const styles = {
|
|
@@ -317,5 +314,60 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
317
314
|
}, [stytchClient, config, styles, callbacks, user]);
|
|
318
315
|
return React.createElement("div", { ref: containerEl });
|
|
319
316
|
};
|
|
317
|
+
/**
|
|
318
|
+
* The Stytch IDP component.
|
|
319
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
320
|
+
* Requires the user to be logged in.
|
|
321
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
322
|
+
* passed into the {@link StytchProvider}
|
|
323
|
+
*
|
|
324
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* const styles = {
|
|
328
|
+
* container: {
|
|
329
|
+
* backgroundColor: '#e11e1e',
|
|
330
|
+
* },
|
|
331
|
+
* colors: {
|
|
332
|
+
* primary: '#ff00f7',
|
|
333
|
+
* secondary: '#5C727D',
|
|
334
|
+
* },
|
|
335
|
+
* }
|
|
336
|
+
*
|
|
337
|
+
* <IdentityProvider
|
|
338
|
+
* styles={styles}
|
|
339
|
+
* callbacks={{
|
|
340
|
+
* onEvent: (event) => console.log(event)
|
|
341
|
+
* }}
|
|
342
|
+
* />
|
|
343
|
+
* />
|
|
344
|
+
*
|
|
345
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
346
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
347
|
+
*/
|
|
348
|
+
const IdentityProvider = ({ styles, callbacks }) => {
|
|
349
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
|
|
350
|
+
const stytchClient = useStytch();
|
|
351
|
+
const containerEl = useRef(null);
|
|
352
|
+
const user = useStytchUser();
|
|
353
|
+
useIsomorphicLayoutEffect(() => {
|
|
354
|
+
if (!isUIClient(stytchClient)) {
|
|
355
|
+
throw Error(noHeadlessClientError);
|
|
356
|
+
}
|
|
357
|
+
if (!containerEl.current) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (!containerEl.current.id) {
|
|
361
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
362
|
+
containerEl.current.id = `stytch-idp-${randId}`;
|
|
363
|
+
}
|
|
364
|
+
stytchClient.mountIdentityProvider({
|
|
365
|
+
callbacks,
|
|
366
|
+
elementId: `#${containerEl.current.id}`,
|
|
367
|
+
styles,
|
|
368
|
+
});
|
|
369
|
+
}, [stytchClient, styles, callbacks, user]);
|
|
370
|
+
return React.createElement("div", { ref: containerEl });
|
|
371
|
+
};
|
|
320
372
|
|
|
321
|
-
export { StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
373
|
+
export { IdentityProvider, StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
package/dist/index.js
CHANGED
|
@@ -155,7 +155,6 @@ const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayou
|
|
|
155
155
|
* in your `_app.jsx` file.
|
|
156
156
|
*
|
|
157
157
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
158
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
159
158
|
*
|
|
160
159
|
* @example
|
|
161
160
|
* <StytchLogin
|
|
@@ -213,7 +212,6 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
213
212
|
* passed into the {@link StytchProvider}
|
|
214
213
|
*
|
|
215
214
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
216
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
217
215
|
*
|
|
218
216
|
* @example
|
|
219
217
|
* <StytchPasswordReset
|
|
@@ -276,7 +274,6 @@ const StytchPasswordReset = ({ config, styles, callbacks, passwordResetToken, })
|
|
|
276
274
|
* passed into the {@link StytchProvider}
|
|
277
275
|
*
|
|
278
276
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
279
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
280
277
|
*
|
|
281
278
|
* @example
|
|
282
279
|
* const styles = {
|
|
@@ -325,7 +322,63 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
325
322
|
}, [stytchClient, config, styles, callbacks, user]);
|
|
326
323
|
return React__default["default"].createElement("div", { ref: containerEl });
|
|
327
324
|
};
|
|
325
|
+
/**
|
|
326
|
+
* The Stytch IDP component.
|
|
327
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
328
|
+
* Requires the user to be logged in.
|
|
329
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
330
|
+
* passed into the {@link StytchProvider}
|
|
331
|
+
*
|
|
332
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* const styles = {
|
|
336
|
+
* container: {
|
|
337
|
+
* backgroundColor: '#e11e1e',
|
|
338
|
+
* },
|
|
339
|
+
* colors: {
|
|
340
|
+
* primary: '#ff00f7',
|
|
341
|
+
* secondary: '#5C727D',
|
|
342
|
+
* },
|
|
343
|
+
* }
|
|
344
|
+
*
|
|
345
|
+
* <IdentityProvider
|
|
346
|
+
* styles={styles}
|
|
347
|
+
* callbacks={{
|
|
348
|
+
* onEvent: (event) => console.log(event)
|
|
349
|
+
* }}
|
|
350
|
+
* />
|
|
351
|
+
* />
|
|
352
|
+
*
|
|
353
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
354
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
355
|
+
*/
|
|
356
|
+
const IdentityProvider = ({ styles, callbacks }) => {
|
|
357
|
+
async.invariant(useIsMounted__INTERNAL(), StytchSSRProxy.noProviderError('<IdentityProvider />'));
|
|
358
|
+
const stytchClient = useStytch();
|
|
359
|
+
const containerEl = React.useRef(null);
|
|
360
|
+
const user = useStytchUser();
|
|
361
|
+
useIsomorphicLayoutEffect(() => {
|
|
362
|
+
if (!isUIClient(stytchClient)) {
|
|
363
|
+
throw Error(StytchSSRProxy.noHeadlessClientError);
|
|
364
|
+
}
|
|
365
|
+
if (!containerEl.current) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (!containerEl.current.id) {
|
|
369
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
370
|
+
containerEl.current.id = `stytch-idp-${randId}`;
|
|
371
|
+
}
|
|
372
|
+
stytchClient.mountIdentityProvider({
|
|
373
|
+
callbacks,
|
|
374
|
+
elementId: `#${containerEl.current.id}`,
|
|
375
|
+
styles,
|
|
376
|
+
});
|
|
377
|
+
}, [stytchClient, styles, callbacks, user]);
|
|
378
|
+
return React__default["default"].createElement("div", { ref: containerEl });
|
|
379
|
+
};
|
|
328
380
|
|
|
381
|
+
exports.IdentityProvider = IdentityProvider;
|
|
329
382
|
exports.StytchLogin = StytchLogin;
|
|
330
383
|
exports.StytchPasskeyRegistration = StytchPasskeyRegistration;
|
|
331
384
|
exports.StytchPasswordReset = StytchPasswordReset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/nextjs",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.4.0",
|
|
4
4
|
"description": "Stytch's official Next.js Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@babel/runtime": "7.18.6",
|
|
25
25
|
"@stytch/js-utils": "0.0.0",
|
|
26
|
-
"@stytch/vanilla-js": "5.
|
|
26
|
+
"@stytch/vanilla-js": "5.17.0",
|
|
27
27
|
"@testing-library/react": "14.0.0",
|
|
28
28
|
"eslint-config-custom": "0.0.1",
|
|
29
29
|
"react": "18.2.0",
|
|
File without changes
|