@stytch/react 19.3.0 → 19.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-b356bcf6.js → StytchB2BContext-081081ee.js} +1 -1
- package/dist/adminPortal/index.esm.js +1 -1
- package/dist/b2b/index.d.ts +42 -1
- package/dist/b2b/index.esm.d.ts +44 -3
- package/dist/b2b/index.esm.js +58 -3
- package/dist/b2b/index.js +56 -0
- package/dist/index.d.ts +33 -3
- package/dist/index.esm.d.ts +33 -3
- package/dist/index.esm.js +55 -3
- package/dist/index.js +55 -2
- package/package.json +2 -2
- /package/dist/{StytchB2BContext-b356bcf6.d.ts → StytchB2BContext-081081ee.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -214,4 +214,4 @@ const StytchB2BProvider = ({ stytch, children, }) => {
|
|
|
214
214
|
React.createElement(StytchMemberSessionContext.Provider, { value: session }, children)))));
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
export { StytchB2BProvider as S, useStytchB2BClient as a,
|
|
217
|
+
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-081081ee.js';
|
|
5
5
|
import { i as invariant, n as noProviderError } from '../invariant-568a7633.js';
|
|
6
6
|
|
|
7
7
|
const makeAdminPortalComponent = (mountFn, componentName) => {
|
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,37 @@ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
103
113
|
* @param props {@link StytchB2BProps}
|
|
104
114
|
*/
|
|
105
115
|
declare const StytchB2B: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration>>({ 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
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
143
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
144
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
145
|
+
*/
|
|
146
|
+
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
106
147
|
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-865b6947.js";
|
|
107
|
-
export { StytchB2B };
|
|
148
|
+
export { StytchB2B, B2BIdentityProvider };
|
|
108
149
|
export type { StytchB2BProviderProps } from "../StytchB2BContext-865b6947.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,37 @@ interface StytchB2BProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
103
113
|
* @param props {@link StytchB2BProps}
|
|
104
114
|
*/
|
|
105
115
|
declare const StytchB2B: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration>>({ 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
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
143
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
144
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
145
|
+
*/
|
|
146
|
+
declare const B2BIdentityProvider: ({ styles, callbacks, getIDPConsentManifest }: B2BIdentityProviderProps) => React.JSX.Element;
|
|
147
|
+
export { StytchB2BProvider, useStytchB2BClient, useStytchMemberSession, useStytchMember, useStytchIsAuthorized, useStytchOrganization, withStytchB2BClient, withStytchMemberSession, withStytchMember, withStytchOrganization, withStytchPermissions } from "../StytchB2BContext-081081ee.js";
|
|
148
|
+
export { StytchB2B, B2BIdentityProvider };
|
|
149
|
+
export type { StytchB2BProviderProps } from "../StytchB2BContext-081081ee.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-081081ee.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-081081ee.js';
|
|
3
3
|
import React, { useRef, useLayoutEffect } from 'react';
|
|
4
4
|
import { i as invariant, b as noHeadlessClientError, n as noProviderError } from '../invariant-568a7633.js';
|
|
5
5
|
|
|
@@ -62,5 +62,60 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
62
62
|
}, [stytchClient, styles, callbacks]);
|
|
63
63
|
return React.createElement("div", { ref: containerEl });
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* The Stytch B2B IDP component.
|
|
67
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
68
|
+
* Requires the user to be logged in.
|
|
69
|
+
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
70
|
+
* passed into the {@link StytchB2BProvider}
|
|
71
|
+
*
|
|
72
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* const styles = {
|
|
76
|
+
* container: {
|
|
77
|
+
* backgroundColor: '#e11e1e',
|
|
78
|
+
* },
|
|
79
|
+
* colors: {
|
|
80
|
+
* primary: '#ff00f7',
|
|
81
|
+
* secondary: '#5C727D',
|
|
82
|
+
* },
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* <B2BIdentityProvider
|
|
86
|
+
* styles={styles}
|
|
87
|
+
* callbacks={{
|
|
88
|
+
* onEvent: (event) => console.log(event)
|
|
89
|
+
* }}
|
|
90
|
+
* />
|
|
91
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
92
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
93
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
94
|
+
*/
|
|
95
|
+
const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
|
|
96
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
|
|
97
|
+
const stytchClient = useStytchB2BClient();
|
|
98
|
+
const { member } = useStytchMember();
|
|
99
|
+
const containerEl = useRef(null);
|
|
100
|
+
useLayoutEffect(() => {
|
|
101
|
+
if (!isUIClient(stytchClient)) {
|
|
102
|
+
throw Error(noHeadlessClientError);
|
|
103
|
+
}
|
|
104
|
+
if (!containerEl.current) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (!containerEl.current.id) {
|
|
108
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
109
|
+
containerEl.current.id = `stytch-b2b-idp-${randId}`;
|
|
110
|
+
}
|
|
111
|
+
stytchClient.mountIdentityProvider({
|
|
112
|
+
callbacks,
|
|
113
|
+
elementId: `#${containerEl.current.id}`,
|
|
114
|
+
styles,
|
|
115
|
+
getIDPConsentManifest,
|
|
116
|
+
});
|
|
117
|
+
}, [stytchClient, styles, callbacks, member, getIDPConsentManifest]);
|
|
118
|
+
return React.createElement("div", { ref: containerEl });
|
|
119
|
+
};
|
|
65
120
|
|
|
66
|
-
export { StytchB2B };
|
|
121
|
+
export { B2BIdentityProvider, StytchB2B };
|
package/dist/b2b/index.js
CHANGED
|
@@ -69,6 +69,61 @@ const StytchB2B = ({ styles, callbacks, config, }) => {
|
|
|
69
69
|
}, [stytchClient, styles, callbacks]);
|
|
70
70
|
return React__default["default"].createElement("div", { ref: containerEl });
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* The Stytch B2B IDP component.
|
|
74
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
75
|
+
* Requires the user to be logged in.
|
|
76
|
+
* This component can only be used with a {@link StytchB2BUIClient} client constructor
|
|
77
|
+
* passed into the {@link StytchB2BProvider}
|
|
78
|
+
*
|
|
79
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* const styles = {
|
|
83
|
+
* container: {
|
|
84
|
+
* backgroundColor: '#e11e1e',
|
|
85
|
+
* },
|
|
86
|
+
* colors: {
|
|
87
|
+
* primary: '#ff00f7',
|
|
88
|
+
* secondary: '#5C727D',
|
|
89
|
+
* },
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* <B2BIdentityProvider
|
|
93
|
+
* styles={styles}
|
|
94
|
+
* callbacks={{
|
|
95
|
+
* onEvent: (event) => console.log(event)
|
|
96
|
+
* }}
|
|
97
|
+
* />
|
|
98
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
99
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
100
|
+
* @param getIDPConsentManifest - Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.
|
|
101
|
+
*/
|
|
102
|
+
const B2BIdentityProvider = ({ styles, callbacks, getIDPConsentManifest }) => {
|
|
103
|
+
invariant.invariant(StytchB2BContext.useIsMounted__INTERNAL(), invariant.noProviderError('<IdentityProvider />'));
|
|
104
|
+
const stytchClient = StytchB2BContext.useStytchB2BClient();
|
|
105
|
+
const { member } = StytchB2BContext.useStytchMember();
|
|
106
|
+
const containerEl = React.useRef(null);
|
|
107
|
+
React.useLayoutEffect(() => {
|
|
108
|
+
if (!StytchB2BContext.isUIClient(stytchClient)) {
|
|
109
|
+
throw Error(invariant.noHeadlessClientError);
|
|
110
|
+
}
|
|
111
|
+
if (!containerEl.current) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!containerEl.current.id) {
|
|
115
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
116
|
+
containerEl.current.id = `stytch-b2b-idp-${randId}`;
|
|
117
|
+
}
|
|
118
|
+
stytchClient.mountIdentityProvider({
|
|
119
|
+
callbacks,
|
|
120
|
+
elementId: `#${containerEl.current.id}`,
|
|
121
|
+
styles,
|
|
122
|
+
getIDPConsentManifest,
|
|
123
|
+
});
|
|
124
|
+
}, [stytchClient, styles, callbacks, member, getIDPConsentManifest]);
|
|
125
|
+
return React__default["default"].createElement("div", { ref: containerEl });
|
|
126
|
+
};
|
|
72
127
|
|
|
73
128
|
exports.StytchB2BProvider = StytchB2BContext.StytchB2BProvider;
|
|
74
129
|
exports.useStytchB2BClient = StytchB2BContext.useStytchB2BClient;
|
|
@@ -81,4 +136,5 @@ exports.withStytchMember = StytchB2BContext.withStytchMember;
|
|
|
81
136
|
exports.withStytchMemberSession = StytchB2BContext.withStytchMemberSession;
|
|
82
137
|
exports.withStytchOrganization = StytchB2BContext.withStytchOrganization;
|
|
83
138
|
exports.withStytchPermissions = StytchB2BContext.withStytchPermissions;
|
|
139
|
+
exports.B2BIdentityProvider = B2BIdentityProvider;
|
|
84
140
|
exports.StytchB2B = StytchB2B;
|
package/dist/index.d.ts
CHANGED
|
@@ -74,7 +74,6 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
74
74
|
* passed into the {@link StytchProvider}
|
|
75
75
|
*
|
|
76
76
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
77
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
78
77
|
*
|
|
79
78
|
* @example
|
|
80
79
|
* <StytchLogin
|
|
@@ -103,13 +102,13 @@ declare const StytchLogin: <TProjectConfiguration extends Partial<import("core/d
|
|
|
103
102
|
interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
|
|
104
103
|
passwordResetToken: string;
|
|
105
104
|
}
|
|
105
|
+
type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
106
106
|
/**
|
|
107
107
|
* The Stytch Reset Password component.
|
|
108
108
|
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
109
109
|
* passed into the {@link StytchProvider}
|
|
110
110
|
*
|
|
111
111
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
112
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
113
112
|
*
|
|
114
113
|
* @example
|
|
115
114
|
* <StytchPasswordReset
|
|
@@ -141,6 +140,37 @@ interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectCo
|
|
|
141
140
|
*/
|
|
142
141
|
declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps<TProjectConfiguration>) => React.JSX.Element;
|
|
143
142
|
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
143
|
+
/**
|
|
144
|
+
* The Stytch IDP component.
|
|
145
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
146
|
+
* Requires the user to be logged in.
|
|
147
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
148
|
+
* passed into the {@link StytchProvider}
|
|
149
|
+
*
|
|
150
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
151
|
+
*
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* const styles = {
|
|
155
|
+
* container: {
|
|
156
|
+
* backgroundColor: '#e11e1e',
|
|
157
|
+
* },
|
|
158
|
+
* colors: {
|
|
159
|
+
* primary: '#ff00f7',
|
|
160
|
+
* secondary: '#5C727D',
|
|
161
|
+
* },
|
|
162
|
+
* }
|
|
163
|
+
*
|
|
164
|
+
* <IdentityProvider
|
|
165
|
+
* styles={styles}
|
|
166
|
+
* callbacks={{
|
|
167
|
+
* onEvent: (event) => console.log(event)
|
|
168
|
+
* }}
|
|
169
|
+
* />
|
|
170
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
171
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
172
|
+
*/
|
|
173
|
+
declare const IdentityProvider: ({ styles, callbacks }: IdentityProviderProps) => React.JSX.Element;
|
|
144
174
|
/**
|
|
145
175
|
* The Stytch Client object passed in to <StytchProvider /> in your application root.
|
|
146
176
|
* Either a StytchUIClient or StytchHeadlessClient.
|
|
@@ -229,5 +259,5 @@ type StytchProviderProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
229
259
|
* )
|
|
230
260
|
*/
|
|
231
261
|
declare const StytchProvider: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children }: StytchProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
232
|
-
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
262
|
+
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
233
263
|
export type { StytchProviderProps };
|
package/dist/index.esm.d.ts
CHANGED
|
@@ -74,7 +74,6 @@ interface StytchProps<TProjectConfiguration extends StytchProjectConfigurationIn
|
|
|
74
74
|
* passed into the {@link StytchProvider}
|
|
75
75
|
*
|
|
76
76
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
77
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
78
77
|
*
|
|
79
78
|
* @example
|
|
80
79
|
* <StytchLogin
|
|
@@ -103,13 +102,13 @@ declare const StytchLogin: <TProjectConfiguration extends Partial<import("core/d
|
|
|
103
102
|
interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration> extends StytchProps<TProjectConfiguration> {
|
|
104
103
|
passwordResetToken: string;
|
|
105
104
|
}
|
|
105
|
+
type IdentityProviderProps = Omit<StytchProps, "config">;
|
|
106
106
|
/**
|
|
107
107
|
* The Stytch Reset Password component.
|
|
108
108
|
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
109
109
|
* passed into the {@link StytchProvider}
|
|
110
110
|
*
|
|
111
111
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
112
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
113
112
|
*
|
|
114
113
|
* @example
|
|
115
114
|
* <StytchPasswordReset
|
|
@@ -141,6 +140,37 @@ interface StytchResetPasswordProps<TProjectConfiguration extends StytchProjectCo
|
|
|
141
140
|
*/
|
|
142
141
|
declare const StytchPasswordReset: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks, passwordResetToken }: StytchResetPasswordProps<TProjectConfiguration>) => React.JSX.Element;
|
|
143
142
|
declare const StytchPasskeyRegistration: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ config, styles, callbacks }: StytchProps<TProjectConfiguration>) => React.JSX.Element;
|
|
143
|
+
/**
|
|
144
|
+
* The Stytch IDP component.
|
|
145
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
146
|
+
* Requires the user to be logged in.
|
|
147
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
148
|
+
* passed into the {@link StytchProvider}
|
|
149
|
+
*
|
|
150
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
151
|
+
*
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* const styles = {
|
|
155
|
+
* container: {
|
|
156
|
+
* backgroundColor: '#e11e1e',
|
|
157
|
+
* },
|
|
158
|
+
* colors: {
|
|
159
|
+
* primary: '#ff00f7',
|
|
160
|
+
* secondary: '#5C727D',
|
|
161
|
+
* },
|
|
162
|
+
* }
|
|
163
|
+
*
|
|
164
|
+
* <IdentityProvider
|
|
165
|
+
* styles={styles}
|
|
166
|
+
* callbacks={{
|
|
167
|
+
* onEvent: (event) => console.log(event)
|
|
168
|
+
* }}
|
|
169
|
+
* />
|
|
170
|
+
* @param styles - An optional {@link StyleConfig} to customize the look and feel of the screen.
|
|
171
|
+
* @param callbacks - An optional {@link Callbacks} object
|
|
172
|
+
*/
|
|
173
|
+
declare const IdentityProvider: ({ styles, callbacks }: IdentityProviderProps) => React.JSX.Element;
|
|
144
174
|
/**
|
|
145
175
|
* The Stytch Client object passed in to <StytchProvider /> in your application root.
|
|
146
176
|
* Either a StytchUIClient or StytchHeadlessClient.
|
|
@@ -229,5 +259,5 @@ type StytchProviderProps<TProjectConfiguration extends StytchProjectConfiguratio
|
|
|
229
259
|
* )
|
|
230
260
|
*/
|
|
231
261
|
declare const StytchProvider: <TProjectConfiguration extends Partial<import("core/dist/public").StytchProjectConfiguration> = Stytch.DefaultProjectConfiguration>({ stytch, children }: StytchProviderProps<TProjectConfiguration>) => JSX.Element;
|
|
232
|
-
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
262
|
+
export { StytchLogin, StytchPasswordReset, StytchPasskeyRegistration, IdentityProvider, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
233
263
|
export type { StytchProviderProps };
|
package/dist/index.esm.js
CHANGED
|
@@ -124,7 +124,6 @@ const StytchProvider = ({ stytch, children, }) => {
|
|
|
124
124
|
* passed into the {@link StytchProvider}
|
|
125
125
|
*
|
|
126
126
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
127
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
128
127
|
*
|
|
129
128
|
* @example
|
|
130
129
|
* <StytchLogin
|
|
@@ -179,7 +178,6 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
179
178
|
* passed into the {@link StytchProvider}
|
|
180
179
|
*
|
|
181
180
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
182
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
183
181
|
*
|
|
184
182
|
* @example
|
|
185
183
|
* <StytchPasswordReset
|
|
@@ -293,5 +291,59 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
293
291
|
}, [stytchClient, config, styles, callbacks, user]);
|
|
294
292
|
return React.createElement("div", { ref: containerEl });
|
|
295
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* The Stytch IDP component.
|
|
296
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
297
|
+
* Requires the user to be logged in.
|
|
298
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
299
|
+
* passed into the {@link StytchProvider}
|
|
300
|
+
*
|
|
301
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
302
|
+
*
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* const styles = {
|
|
306
|
+
* container: {
|
|
307
|
+
* backgroundColor: '#e11e1e',
|
|
308
|
+
* },
|
|
309
|
+
* colors: {
|
|
310
|
+
* primary: '#ff00f7',
|
|
311
|
+
* secondary: '#5C727D',
|
|
312
|
+
* },
|
|
313
|
+
* }
|
|
314
|
+
*
|
|
315
|
+
* <IdentityProvider
|
|
316
|
+
* styles={styles}
|
|
317
|
+
* callbacks={{
|
|
318
|
+
* onEvent: (event) => console.log(event)
|
|
319
|
+
* }}
|
|
320
|
+
* />
|
|
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
|
+
const IdentityProvider = ({ styles, callbacks }) => {
|
|
325
|
+
invariant(useIsMounted__INTERNAL(), noProviderError('<IdentityProvider />'));
|
|
326
|
+
const stytchClient = useStytch();
|
|
327
|
+
const user = useStytchUser();
|
|
328
|
+
const containerEl = useRef(null);
|
|
329
|
+
useLayoutEffect(() => {
|
|
330
|
+
if (!isUIClient(stytchClient)) {
|
|
331
|
+
throw Error(noHeadlessClientError);
|
|
332
|
+
}
|
|
333
|
+
if (!containerEl.current) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (!containerEl.current.id) {
|
|
337
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
338
|
+
containerEl.current.id = `stytch-idp-${randId}`;
|
|
339
|
+
}
|
|
340
|
+
stytchClient.mountIdentityProvider({
|
|
341
|
+
callbacks,
|
|
342
|
+
elementId: `#${containerEl.current.id}`,
|
|
343
|
+
styles,
|
|
344
|
+
});
|
|
345
|
+
}, [stytchClient, styles, callbacks, user]);
|
|
346
|
+
return React.createElement("div", { ref: containerEl });
|
|
347
|
+
};
|
|
296
348
|
|
|
297
|
-
export { StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
|
349
|
+
export { IdentityProvider, StytchLogin, StytchPasskeyRegistration, StytchPasswordReset, StytchProvider, useStytch, useStytchSession, useStytchUser, withStytch, withStytchSession, withStytchUser };
|
package/dist/index.js
CHANGED
|
@@ -132,7 +132,6 @@ const StytchProvider = ({ stytch, children, }) => {
|
|
|
132
132
|
* passed into the {@link StytchProvider}
|
|
133
133
|
*
|
|
134
134
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
135
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
136
135
|
*
|
|
137
136
|
* @example
|
|
138
137
|
* <StytchLogin
|
|
@@ -187,7 +186,6 @@ const StytchLogin = ({ config, styles, callbacks, }) => {
|
|
|
187
186
|
* passed into the {@link StytchProvider}
|
|
188
187
|
*
|
|
189
188
|
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
190
|
-
* and {@link https://storybook.stytch.com interactive examples} for more.
|
|
191
189
|
*
|
|
192
190
|
* @example
|
|
193
191
|
* <StytchPasswordReset
|
|
@@ -301,7 +299,62 @@ const StytchPasskeyRegistration = ({ config, styles, callbacks, }) => {
|
|
|
301
299
|
}, [stytchClient, config, styles, callbacks, user]);
|
|
302
300
|
return React__default["default"].createElement("div", { ref: containerEl });
|
|
303
301
|
};
|
|
302
|
+
/**
|
|
303
|
+
* The Stytch IDP component.
|
|
304
|
+
* Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.
|
|
305
|
+
* Requires the user to be logged in.
|
|
306
|
+
* This component can only be used with a {@link StytchUIClient} client constructor
|
|
307
|
+
* passed into the {@link StytchProvider}
|
|
308
|
+
*
|
|
309
|
+
* See the {@link https://stytch.com/docs/sdks/javascript-sdk online reference}
|
|
310
|
+
*
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* const styles = {
|
|
314
|
+
* container: {
|
|
315
|
+
* backgroundColor: '#e11e1e',
|
|
316
|
+
* },
|
|
317
|
+
* colors: {
|
|
318
|
+
* primary: '#ff00f7',
|
|
319
|
+
* secondary: '#5C727D',
|
|
320
|
+
* },
|
|
321
|
+
* }
|
|
322
|
+
*
|
|
323
|
+
* <IdentityProvider
|
|
324
|
+
* styles={styles}
|
|
325
|
+
* callbacks={{
|
|
326
|
+
* onEvent: (event) => console.log(event)
|
|
327
|
+
* }}
|
|
328
|
+
* />
|
|
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
|
+
*/
|
|
332
|
+
const IdentityProvider = ({ styles, callbacks }) => {
|
|
333
|
+
invariant.invariant(useIsMounted__INTERNAL(), invariant.noProviderError('<IdentityProvider />'));
|
|
334
|
+
const stytchClient = useStytch();
|
|
335
|
+
const user = useStytchUser();
|
|
336
|
+
const containerEl = React.useRef(null);
|
|
337
|
+
React.useLayoutEffect(() => {
|
|
338
|
+
if (!isUIClient(stytchClient)) {
|
|
339
|
+
throw Error(invariant.noHeadlessClientError);
|
|
340
|
+
}
|
|
341
|
+
if (!containerEl.current) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (!containerEl.current.id) {
|
|
345
|
+
const randId = Math.floor(Math.random() * 1e6);
|
|
346
|
+
containerEl.current.id = `stytch-idp-${randId}`;
|
|
347
|
+
}
|
|
348
|
+
stytchClient.mountIdentityProvider({
|
|
349
|
+
callbacks,
|
|
350
|
+
elementId: `#${containerEl.current.id}`,
|
|
351
|
+
styles,
|
|
352
|
+
});
|
|
353
|
+
}, [stytchClient, styles, callbacks, user]);
|
|
354
|
+
return React__default["default"].createElement("div", { ref: containerEl });
|
|
355
|
+
};
|
|
304
356
|
|
|
357
|
+
exports.IdentityProvider = IdentityProvider;
|
|
305
358
|
exports.StytchLogin = StytchLogin;
|
|
306
359
|
exports.StytchPasskeyRegistration = StytchPasskeyRegistration;
|
|
307
360
|
exports.StytchPasswordReset = StytchPasswordReset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stytch/react",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.4.0",
|
|
4
4
|
"description": "Stytch's official React Library",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/runtime": "7.18.6",
|
|
36
36
|
"@stytch/js-utils": "0.0.0",
|
|
37
|
-
"@stytch/vanilla-js": "5.
|
|
37
|
+
"@stytch/vanilla-js": "5.17.0",
|
|
38
38
|
"@testing-library/react": "14.0.0",
|
|
39
39
|
"eslint-config-custom": "0.0.1",
|
|
40
40
|
"react": "18.2.0",
|
|
File without changes
|