@stytch/react 20.0.0-next.2 → 20.0.0-next.4
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 +12 -0
- package/dist/cjs/StytchSSRProxy-Bz6LNYdq.js.map +1 -1
- package/dist/cjs/adminPortal/index.cjs +1 -1
- package/dist/cjs/b2b/index.cjs +28 -20
- package/dist/cjs/b2b/index.cjs.map +1 -1
- package/dist/cjs/compat.cjs +2 -0
- package/dist/cjs/compat.cjs.map +1 -1
- package/dist/cjs/{index-Ni_dyEsz.js → index-BIjXBvf_.js} +2 -2
- package/dist/cjs/index-BIjXBvf_.js.map +1 -0
- package/dist/cjs/index.cjs +521 -542
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/{shadcn-B8TEzQMT.js → shadcn-aVU6Lm9q.js} +255 -235
- package/dist/cjs/shadcn-aVU6Lm9q.js.map +1 -0
- package/dist/cjs-dev/StytchSSRProxy-d553KgcY.js +438 -0
- package/dist/cjs-dev/StytchSSRProxy-d553KgcY.js.map +1 -0
- package/dist/cjs-dev/adminPortal/index.cjs +54 -53
- package/dist/cjs-dev/adminPortal/index.cjs.map +1 -1
- package/dist/cjs-dev/b2b/index.cjs +94 -75
- package/dist/cjs-dev/b2b/index.cjs.map +1 -1
- package/dist/cjs-dev/b2b/index.headless.cjs +89 -88
- package/dist/cjs-dev/b2b/index.headless.cjs.map +1 -1
- package/dist/cjs-dev/compat.cjs +15 -14
- package/dist/cjs-dev/compat.cjs.map +1 -1
- package/dist/cjs-dev/{StytchSSRProxy-CxXsyme4.js → dev-DaCGDI6V.js} +60 -426
- package/dist/cjs-dev/dev-DaCGDI6V.js.map +1 -0
- package/dist/cjs-dev/{idpHelpers-BVMUYvt1.js → idpHelpers-DOYYSxsX.js} +45 -102
- package/dist/cjs-dev/idpHelpers-DOYYSxsX.js.map +1 -0
- package/dist/cjs-dev/{index-DdK3Jt4u.js → index-rquGmIlv.js} +4 -4
- package/dist/cjs-dev/index-rquGmIlv.js.map +1 -0
- package/dist/cjs-dev/index.cjs +667 -667
- package/dist/cjs-dev/index.cjs.map +1 -1
- package/dist/cjs-dev/index.headless.cjs +70 -69
- package/dist/cjs-dev/index.headless.cjs.map +1 -1
- package/dist/cjs-dev/{passwordManagerDisableAutofillProps-D70WyvIu.js → passwordManagerDisableAutofillProps-CgiK2M_U.js} +2 -2
- package/dist/cjs-dev/{passwordManagerDisableAutofillProps-D70WyvIu.js.map → passwordManagerDisableAutofillProps-CgiK2M_U.js.map} +1 -1
- package/dist/cjs-dev/{shadcn-C9ClUju1.js → shadcn-DMk6ZSoD.js} +265 -244
- package/dist/cjs-dev/shadcn-DMk6ZSoD.js.map +1 -0
- package/dist/esm/_virtual/index3.mjs +5 -3
- package/dist/esm/_virtual/index3.mjs.map +1 -1
- package/dist/esm/_virtual/index4.mjs +3 -5
- package/dist/esm/_virtual/index4.mjs.map +1 -1
- package/dist/esm/b2b/StytchB2BContext.mjs +5 -5
- package/dist/esm/b2b/StytchB2BContext.mjs.map +1 -1
- package/dist/esm/packages/core/src/public/b2b/ui.mjs.map +1 -1
- package/dist/esm/packages/web/src/adminPortal/utils/theme.mjs +1 -1
- package/dist/esm/packages/web/src/ui/b2b/App.mjs +2 -2
- package/dist/esm/packages/web/src/ui/b2b/App.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2b/components/Icons.mjs +3 -1
- package/dist/esm/packages/web/src/ui/b2b/components/Icons.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs +6 -3
- package/dist/esm/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2b/components/SSOButton.mjs +5 -3
- package/dist/esm/packages/web/src/ui/b2b/components/SSOButton.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs +6 -3
- package/dist/esm/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2b/types/authMethodKeys.mjs +2 -2
- package/dist/esm/packages/web/src/ui/b2b/types/authMethodKeys.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/AppContainer.mjs +1 -1
- package/dist/esm/packages/web/src/ui/b2c/AppContainer.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/IDPContainer.mjs +1 -1
- package/dist/esm/packages/web/src/ui/b2c/IDPContainer.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs +1 -1
- package/dist/esm/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/ResetPasswordContainer.mjs +1 -1
- package/dist/esm/packages/web/src/ui/b2c/ResetPasswordContainer.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/components/OAuthButton.mjs +6 -3
- package/dist/esm/packages/web/src/ui/b2c/components/OAuthButton.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +20 -39
- package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +15 -15
- package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/compat/styleToTheme.mjs +2 -0
- package/dist/esm/packages/web/src/ui/compat/styleToTheme.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs +6 -1
- package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/components/atoms/Button.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/components/atoms/Typography.module.css.mjs +2 -2
- package/dist/esm/packages/web/src/ui/components/molecules/EmailInput.mjs +1 -1
- package/dist/esm/packages/web/src/ui/components/molecules/EmailInput.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/components/molecules/Input.mjs +1 -1
- package/dist/esm/packages/web/src/ui/components/molecules/Input.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2b/Stytch.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2b/Stytch.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2b/StytchB2BContext.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2b/StytchB2BContext.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/IdentityProvider.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/IdentityProvider.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchContext.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchContext.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchLogin.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchLogin.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs +1 -1
- package/dist/esm/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs.map +1 -1
- package/dist/esm/packages/web/src/ui/react/utils/errors.mjs.map +1 -1
- package/dist/esm/packages/web/src/utils/crypto.mjs +19 -14
- package/dist/esm/packages/web/src/utils/crypto.mjs.map +1 -1
- package/dist/esm/packages/web/src/utils/oauthProviderType.mjs +1 -1
- package/dist/esm/packages/web/src/utils/oauthProviderType.mjs.map +1 -1
- package/dist/esm-dev/_virtual/index3.mjs +3 -5
- package/dist/esm-dev/_virtual/index3.mjs.map +1 -1
- package/dist/esm-dev/_virtual/index4.mjs +5 -3
- package/dist/esm-dev/_virtual/index4.mjs.map +1 -1
- package/dist/esm-dev/b2b/StytchB2BContext.mjs +5 -5
- package/dist/esm-dev/b2b/StytchB2BContext.mjs.map +1 -1
- package/dist/esm-dev/packages/core/src/public/b2b/ui.mjs.map +1 -1
- package/dist/esm-dev/packages/core/src/utils/dev.mjs +7 -1
- package/dist/esm-dev/packages/core/src/utils/dev.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/adminPortal/utils/theme.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/App.mjs +14 -2
- package/dist/esm-dev/packages/web/src/ui/b2b/App.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/components/Icons.mjs +3 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/components/Icons.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs +6 -3
- package/dist/esm-dev/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/components/SSOButton.mjs +5 -3
- package/dist/esm-dev/packages/web/src/ui/b2b/components/SSOButton.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs +6 -3
- package/dist/esm-dev/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2b/types/authMethodKeys.mjs +2 -2
- package/dist/esm-dev/packages/web/src/ui/b2b/types/authMethodKeys.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/AppContainer.mjs +8 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/AppContainer.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/IDPContainer.mjs +8 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/IDPContainer.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs +8 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/ResetPasswordContainer.mjs +8 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/ResetPasswordContainer.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/components/OAuthButton.mjs +6 -3
- package/dist/esm-dev/packages/web/src/ui/b2c/components/OAuthButton.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +20 -39
- package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +15 -15
- package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/compat/styleToTheme.mjs +15 -14
- package/dist/esm-dev/packages/web/src/ui/compat/styleToTheme.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs +9 -3
- package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/components/atoms/Button.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/components/atoms/Typography.module.css.mjs +2 -2
- package/dist/esm-dev/packages/web/src/ui/components/molecules/EmailInput.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/components/molecules/EmailInput.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/components/molecules/Input.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/components/molecules/Input.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2b/Stytch.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2b/Stytch.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2b/StytchB2BContext.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2b/StytchB2BContext.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/IdentityProvider.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/IdentityProvider.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchContext.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchContext.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchLogin.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchLogin.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/ui/react/utils/errors.mjs +8 -4
- package/dist/esm-dev/packages/web/src/ui/react/utils/errors.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/utils/crypto.mjs +19 -14
- package/dist/esm-dev/packages/web/src/utils/crypto.mjs.map +1 -1
- package/dist/esm-dev/packages/web/src/utils/oauthProviderType.mjs +1 -1
- package/dist/esm-dev/packages/web/src/utils/oauthProviderType.mjs.map +1 -1
- package/dist/types/{PresentationConfig-Bqzf8zr3.d.ts → PresentationConfig-B2jX85oV.d.ts} +13 -2
- package/dist/types/{StytchB2BClient-CsY7ZNKh.d.ts → StytchB2BClient-D16e_lp1.d.ts} +2 -2
- package/dist/types/{StytchClient-DZRM_fM4.d.ts → StytchClient-BwQdJzdj.d.ts} +2 -2
- package/dist/types/adminPortal/index.d.ts +5 -5
- package/dist/types/b2b/index.d.ts +27 -19
- package/dist/types/b2b/index.headless.d.ts +5 -5
- package/dist/types/compat.d.ts +2 -2
- package/dist/types/{createAuthUrlHandler-BZoD2LDF.d.ts → createAuthUrlHandler-R1kNNQD_.d.ts} +2 -2
- package/dist/types/{idpHelpers-CD5sSDzA.d.ts → idpHelpers-BQP76WgZ.d.ts} +1 -1
- package/dist/types/index.d.ts +36 -16
- package/dist/types/index.headless.d.ts +5 -5
- package/dist/types/{shadcn-4-5byj93.d.ts → shadcn-CGdmyIUF.d.ts} +9 -6
- package/dist/types/{ui-DXrQ-gA8.d.ts → ui-B7IvSGQf.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/cjs/index-Ni_dyEsz.js.map +0 -1
- package/dist/cjs/shadcn-B8TEzQMT.js.map +0 -1
- package/dist/cjs-dev/StytchSSRProxy-CxXsyme4.js.map +0 -1
- package/dist/cjs-dev/idpHelpers-BVMUYvt1.js.map +0 -1
- package/dist/cjs-dev/index-DdK3Jt4u.js.map +0 -1
- package/dist/cjs-dev/shadcn-C9ClUju1.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
|
|
2
|
+
import { __require as requireLodash_merge } from '../node_modules/lodash.merge/index.mjs';
|
|
2
3
|
|
|
3
|
-
var
|
|
4
|
+
var lodash_mergeExports = requireLodash_merge();
|
|
5
|
+
var merge = /*@__PURE__*/getDefaultExportFromCjs(lodash_mergeExports);
|
|
4
6
|
|
|
5
|
-
export {
|
|
7
|
+
export { merge as default };
|
|
6
8
|
//# sourceMappingURL=index3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { __require as requireLodash_merge } from '../node_modules/lodash.merge/index.mjs';
|
|
1
|
+
import { __require as requireBs58 } from '../node_modules/bs58/index.mjs';
|
|
3
2
|
|
|
4
|
-
var
|
|
5
|
-
var merge = /*@__PURE__*/getDefaultExportFromCjs(lodash_mergeExports);
|
|
3
|
+
var bs58Exports = requireBs58();
|
|
6
4
|
|
|
7
|
-
export {
|
|
5
|
+
export { bs58Exports as b };
|
|
8
6
|
//# sourceMappingURL=index4.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -10,7 +10,7 @@ export { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from '
|
|
|
10
10
|
* @example
|
|
11
11
|
* const {member, isInitialized, fromCache} = useStytchMember();
|
|
12
12
|
* if (!isInitialized) {
|
|
13
|
-
*
|
|
13
|
+
* return <p>Loading...</p>;
|
|
14
14
|
* }
|
|
15
15
|
* return (<h1>Welcome, {member.name}</h1>);
|
|
16
16
|
*/ const useStytchMember = useStytchMember$1;
|
|
@@ -26,7 +26,7 @@ export { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from '
|
|
|
26
26
|
* return;
|
|
27
27
|
* }
|
|
28
28
|
* if (!session) {
|
|
29
|
-
* router.replace('/login')
|
|
29
|
+
* router.replace('/login');
|
|
30
30
|
* }
|
|
31
31
|
* }, [session, isInitialized]);
|
|
32
32
|
*/ const useStytchMemberSession = useStytchMemberSession$1;
|
|
@@ -38,9 +38,9 @@ export { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from '
|
|
|
38
38
|
* @example
|
|
39
39
|
* const {organization, isInitialized, fromCache} = useStytchOrganization();
|
|
40
40
|
* if (!isInitialized) {
|
|
41
|
-
*
|
|
41
|
+
* return <p>Loading...</p>;
|
|
42
42
|
* }
|
|
43
|
-
* return
|
|
43
|
+
* return <p>Welcome to {organization.organization_name}</p>;
|
|
44
44
|
*/ const useStytchOrganization = useStytchOrganization$1;
|
|
45
45
|
/**
|
|
46
46
|
* Determines whether the logged-in member is allowed to perform the specified action on the specified resource.
|
|
@@ -51,7 +51,7 @@ export { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from '
|
|
|
51
51
|
*
|
|
52
52
|
* Remember - authorization checks for sensitive actions should always occur on the backend as well.
|
|
53
53
|
* @example
|
|
54
|
-
* const { isAuthorized } = useStytchIsAuthorized
|
|
54
|
+
* const { isAuthorized } = useStytchIsAuthorized('documents', 'edit');
|
|
55
55
|
* return <button disabled={!isAuthorized}>Edit</button>
|
|
56
56
|
*/ const useStytchIsAuthorized = useStytchIsAuthorized$1;
|
|
57
57
|
const withStytchMember = withStytchMember$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StytchB2BContext.mjs","sources":["../../../src/b2b/StytchB2BContext.tsx"],"sourcesContent":["'use client';\n\nimport React, { ComponentType, ReactNode } from 'react';\n\nimport type { Member, MemberSession, Organization, StytchProjectConfigurationInput } from '@stytch/web/b2b';\nimport { StytchB2BClient } from '@stytch/web/b2b/headless';\n\nexport { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from '@stytch/web/react/b2b';\n\nimport {\n StytchB2BProvider as StytchB2BProviderShared,\n useStytchIsAuthorized as useStytchIsAuthorizedShared,\n useStytchMemberSession as useStytchMemberSessionShared,\n useStytchMember as useStytchMemberShared,\n useStytchOrganization as useStytchOrganizationShared,\n withStytchMemberSession as withStytchMemberSessionShared,\n withStytchMember as withStytchMemberShared,\n withStytchOrganization as withStytchOrganizationShared,\n} from '@stytch/web/react/b2b';\n\n/**\n * Returns the active Member.\n * The Stytch SDKs are used for client-side authentication and session management.\n * Check the isInitialized property to determine if the SDK has completed initialization.\n * Check the fromCache property to determine if the member data is from persistent storage.\n * @example\n * const {member, isInitialized, fromCache} = useStytchMember();\n * if (!isInitialized) {\n *
|
|
1
|
+
{"version":3,"file":"StytchB2BContext.mjs","sources":["../../../src/b2b/StytchB2BContext.tsx"],"sourcesContent":["'use client';\n\nimport React, { ComponentType, ReactNode } from 'react';\n\nimport type { Member, MemberSession, Organization, StytchProjectConfigurationInput } from '@stytch/web/b2b';\nimport { StytchB2BClient } from '@stytch/web/b2b/headless';\n\nexport { useStytchB2BClient, withStytchB2BClient, withStytchPermissions } from '@stytch/web/react/b2b';\n\nimport {\n StytchB2BProvider as StytchB2BProviderShared,\n useStytchIsAuthorized as useStytchIsAuthorizedShared,\n useStytchMemberSession as useStytchMemberSessionShared,\n useStytchMember as useStytchMemberShared,\n useStytchOrganization as useStytchOrganizationShared,\n withStytchMemberSession as withStytchMemberSessionShared,\n withStytchMember as withStytchMemberShared,\n withStytchOrganization as withStytchOrganizationShared,\n} from '@stytch/web/react/b2b';\n\n/**\n * Returns the active Member.\n * The Stytch SDKs are used for client-side authentication and session management.\n * Check the isInitialized property to determine if the SDK has completed initialization.\n * Check the fromCache property to determine if the member data is from persistent storage.\n * @example\n * const {member, isInitialized, fromCache} = useStytchMember();\n * if (!isInitialized) {\n * return <p>Loading...</p>;\n * }\n * return (<h1>Welcome, {member.name}</h1>);\n */\nexport const useStytchMember = useStytchMemberShared as <TAssumeHydrated extends boolean = true>() => ReturnType<\n typeof useStytchMemberShared<TAssumeHydrated>\n>;\n\n/**\n * Returns the active member's Stytch member session.\n * The Stytch SDKs are used for client-side authentication and session management.\n * Check the isInitialized property to determine if the SDK has completed initialization.\n * Check the fromCache property to determine if the session data is from persistent storage.\n * @example\n * const {session, isInitialized, fromCache} = useStytchMemberSession();\n * useEffect(() => {\n * if (!isInitialized) {\n * return;\n * }\n * if (!session) {\n * router.replace('/login');\n * }\n * }, [session, isInitialized]);\n */\nexport const useStytchMemberSession = useStytchMemberSessionShared as <\n TAssumeHydrated extends boolean = true,\n>() => ReturnType<typeof useStytchMemberSessionShared<TAssumeHydrated>>;\n\n/**\n * Returns the active Stytch organization.\n * The Stytch SDKs are used for client-side authentication and session management.\n * Check the isInitialized property to determine if the SDK has completed initialization.\n * Check the fromCache property to determine if the organization data is from persistent storage.\n * @example\n * const {organization, isInitialized, fromCache} = useStytchOrganization();\n * if (!isInitialized) {\n * return <p>Loading...</p>;\n * }\n * return <p>Welcome to {organization.organization_name}</p>;\n */\nexport const useStytchOrganization = useStytchOrganizationShared as <\n TAssumeHydrated extends boolean = true,\n>() => ReturnType<typeof useStytchOrganizationShared<TAssumeHydrated>>;\n\n/**\n * Determines whether the logged-in member is allowed to perform the specified action on the specified resource.\n * Returns `true` if the member can perform the action, `false` otherwise.\n *\n * If the member is not logged in, this method will always return false.\n * If the resource or action provided are not valid for the configured RBAC policy, this method will return false.\n *\n * Remember - authorization checks for sensitive actions should always occur on the backend as well.\n * @example\n * const { isAuthorized } = useStytchIsAuthorized('documents', 'edit');\n * return <button disabled={!isAuthorized}>Edit</button>\n */\nexport const useStytchIsAuthorized = useStytchIsAuthorizedShared as <TAssumeHydrated extends boolean = false>(\n resourceId: string,\n action: string,\n) => ReturnType<typeof useStytchIsAuthorizedShared<TAssumeHydrated>>;\n\nexport const withStytchMember = withStytchMemberShared as <T extends object, TAssumeHydrated extends boolean = false>(\n Component: ComponentType<\n T & { stytchMember: Member | null; stytchMemberIsInitialized: boolean; stytchMemberIsFromCache: boolean }\n >,\n) => ReturnType<typeof withStytchMemberShared<T, TAssumeHydrated>>;\n\nexport const withStytchMemberSession = withStytchMemberSessionShared as <\n T extends object,\n TAssumeHydrated extends boolean = false,\n>(\n Component: ComponentType<\n T & {\n stytchMemberSession: MemberSession | null;\n stytchMemberSessionIsInitialized: boolean;\n stytchMemberSessionIsFromCache: boolean;\n }\n >,\n) => ReturnType<typeof withStytchMemberSessionShared<T, TAssumeHydrated>>;\n\nexport const withStytchOrganization = withStytchOrganizationShared as <\n T extends object,\n TAssumeHydrated extends boolean = false,\n>(\n Component: ComponentType<\n T & {\n stytchOrganization: Organization | null;\n stytchOrganizationIsInitialized: boolean;\n stytchOrganizationIsFromCache: boolean;\n }\n >,\n) => ReturnType<typeof withStytchOrganizationShared<T, TAssumeHydrated>>;\n\nexport interface StytchB2BProviderProps<\n TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration,\n> {\n /**\n * A Stytch client instance, a {@link StytchB2BClient}\n */\n stytch: StytchB2BClient<TProjectConfiguration>;\n /**\n * When true, the provider will assume that the component will only be\n * rendered in a browser environment, either in a single-page application or\n * after completing hydration of a server-rendered application. This allows\n * cached values to be retrieved from the browser on the first render, meaning\n * that the `isInitialized` value returned from Stytch hooks will be `true`\n * starting from the first render.\n *\n * When `false`, the provider will defer initialization until after the first\n * render, and `isInitialized` will initially be `false`.\n *\n * If you encounter hydration errors relating to the use of this component,\n * set this to `false`.\n *\n * This value defaults to `true` in `@stytch/react`.\n */\n assumeHydrated?: boolean;\n children?: ReactNode;\n}\n\n/**\n * The Stytch Context Provider.\n * Wrap your application with this component in order to use Stytch everywhere in your app.\n * @example\n * const stytch = createStytchB2BClient('public-token-<find yours in the stytch dashboard>')\n *\n * ReactDOM.render(\n * <StytchB2BProvider stytch={stytch}>\n * <App />\n * </StytchProvider>,\n * document.getElementById('root'),\n * )\n */\nexport const StytchB2BProvider = <\n TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration,\n>({\n stytch,\n children,\n assumeHydrated = true,\n}: StytchB2BProviderProps<TProjectConfiguration>): JSX.Element => (\n <StytchB2BProviderShared stytch={stytch} assumeHydrated={assumeHydrated}>\n {children}\n </StytchB2BProviderShared>\n);\n"],"names":["useStytchMember","useStytchMemberShared","useStytchMemberSession","useStytchMemberSessionShared","useStytchOrganization","useStytchOrganizationShared","useStytchIsAuthorized","useStytchIsAuthorizedShared","withStytchMember","withStytchMemberShared","withStytchMemberSession","withStytchMemberSessionShared","withStytchOrganization","withStytchOrganizationShared","StytchB2BProvider","stytch","children","assumeHydrated","React","StytchB2BProviderShared"],"mappings":";;;;AAoBA;;;;;;;;;;;IAYO,MAAMA,eAAAA,GAAkBC;AAI/B;;;;;;;;;;;;;;;IAgBO,MAAMC,sBAAAA,GAAyBC;AAItC;;;;;;;;;;;IAYO,MAAMC,qBAAAA,GAAwBC;AAIrC;;;;;;;;;;;IAYO,MAAMC,qBAAAA,GAAwBC;AAK9B,MAAMC,mBAAmBC;AAMzB,MAAMC,0BAA0BC;AAahC,MAAMC,yBAAyBC;AAwCtC;;;;;;;;;;;;AAYC,IACM,MAAMC,iBAAAA,GAAoB,CAE/B,EACAC,MAAM,EACNC,QAAQ,EACRC,cAAAA,GAAiB,IAAI,EACyB,iBAC9CC,cAAA,CAAA,aAAA,CAACC,mBAAAA,EAAAA;QAAwBJ,MAAAA,EAAQA,MAAAA;QAAQE,cAAAA,EAAgBA;OACtDD,QAAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.mjs","sources":["../../../../../../../../core/src/public/b2b/ui.ts"],"sourcesContent":["import { Values } from '../../utils';\n\n/**\n * The authentication methods we support through our UI.\n * Currently we support `emailMagicLinks`, `emailOtp`, `sso`, `passwords`, and `oauth`.\n */\n\nexport const AuthFlowType = {\n Discovery: 'Discovery',\n Organization: 'Organization',\n PasswordReset: 'PasswordReset',\n} as const;\n\nexport type AuthFlowType = Values<typeof AuthFlowType>;\n\nexport const RedirectURLType = {\n ResetPassword: 'reset_password',\n} as const;\n\nexport type RedirectURLType = Values<typeof RedirectURLType>;\n\n/**\n * The OAuth providers we support in our B2B OAuth product.\n */\nexport const B2BOAuthProviders = {\n Google: 'google',\n Microsoft: 'microsoft',\n HubSpot: 'hubspot',\n Slack: 'slack',\n GitHub: 'github',\n} as const;\nexport type B2BOAuthProviders = Values<typeof B2BOAuthProviders>;\n\n/**\n * The options for email magic links. This is used if you've enabled the `emailMagicLinks` product\n * in your configuration.\n */\n\nexport type B2BEmailMagicLinksOptions = {\n loginRedirectURL?: string;\n signupRedirectURL?: string;\n discoveryRedirectURL?: string;\n loginTemplateId?: string;\n signupTemplateId?: string;\n /**\n * @param domainHint - An optional hint indicating what domain the email will be sent from.\n * This field is only required if your project uses more than one custom domain to send emails.\n */\n domainHint?: string;\n locale?: string;\n};\n\n/**\n * The options for SSO. This is used if you've enabled the `sso` product\n * in your configuration.\n */\n\nexport type B2BSSOOptions = {\n loginRedirectURL?: string;\n signupRedirectURL?: string;\n};\n\n/**\n * The options for OAuth. This is required if you've enabled the `oauth` product\n * in your configuration.\n */\n\nexport type B2BOAuthOptions = {\n loginRedirectURL?: string;\n signupRedirectURL?: string;\n discoveryRedirectURL?: string;\n /** @deprecated Use customScopes in B2BOAuthProviderConfig instead */\n customScopes?: string[];\n providers: B2BOAuthProviderConfig[];\n /** @deprecated Use providerParams in B2BOAuthProviderConfig instead */\n providerParams?: Record<string, string>;\n locale?: string;\n};\n\n/**\n * Details about the OAuth provider you wish to use. Each B2BOAuthProviderConfig object can be either a plain\n * B2BOAuthProviders string (e.g. 'google'), or an object with a type key that determines the type of provider. For\n * Google OAuth, you can optionally specify the one_tap property to display Google One Tap.\n */\nexport type B2BOAuthProviderConfig =\n | B2BOAuthProviders\n | {\n type: typeof B2BOAuthProviders.Google;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n\n one_tap
|
|
1
|
+
{"version":3,"file":"ui.mjs","sources":["../../../../../../../../core/src/public/b2b/ui.ts"],"sourcesContent":["import { Values } from '../../utils';\n\n/**\n * The authentication methods we support through our UI.\n * Currently we support `emailMagicLinks`, `emailOtp`, `sso`, `passwords`, and `oauth`.\n */\n\nexport const AuthFlowType = {\n Discovery: 'Discovery',\n Organization: 'Organization',\n PasswordReset: 'PasswordReset',\n} as const;\n\nexport type AuthFlowType = Values<typeof AuthFlowType>;\n\nexport const RedirectURLType = {\n ResetPassword: 'reset_password',\n} as const;\n\nexport type RedirectURLType = Values<typeof RedirectURLType>;\n\n/**\n * The OAuth providers we support in our B2B OAuth product.\n */\nexport const B2BOAuthProviders = {\n Google: 'google',\n Microsoft: 'microsoft',\n HubSpot: 'hubspot',\n Slack: 'slack',\n GitHub: 'github',\n} as const;\nexport type B2BOAuthProviders = Values<typeof B2BOAuthProviders>;\n\n/**\n * The options for email magic links. This is used if you've enabled the `emailMagicLinks` product\n * in your configuration.\n */\n\nexport type B2BEmailMagicLinksOptions = {\n loginRedirectURL?: string;\n signupRedirectURL?: string;\n discoveryRedirectURL?: string;\n loginTemplateId?: string;\n signupTemplateId?: string;\n /**\n * @param domainHint - An optional hint indicating what domain the email will be sent from.\n * This field is only required if your project uses more than one custom domain to send emails.\n */\n domainHint?: string;\n locale?: string;\n};\n\n/**\n * The options for SSO. This is used if you've enabled the `sso` product\n * in your configuration.\n */\n\nexport type B2BSSOOptions = {\n loginRedirectURL?: string;\n signupRedirectURL?: string;\n};\n\n/**\n * The options for OAuth. This is required if you've enabled the `oauth` product\n * in your configuration.\n */\n\nexport type B2BOAuthOptions = {\n loginRedirectURL?: string;\n signupRedirectURL?: string;\n discoveryRedirectURL?: string;\n /** @deprecated Use customScopes in B2BOAuthProviderConfig instead */\n customScopes?: string[];\n providers: B2BOAuthProviderConfig[];\n /** @deprecated Use providerParams in B2BOAuthProviderConfig instead */\n providerParams?: Record<string, string>;\n locale?: string;\n};\n\n/**\n * Details about the OAuth provider you wish to use. Each B2BOAuthProviderConfig object can be either a plain\n * B2BOAuthProviders string (e.g. 'google'), or an object with a type key that determines the type of provider. For\n * Google OAuth, you can optionally specify the one_tap property to display Google One Tap.\n */\nexport type B2BOAuthProviderConfig =\n | B2BOAuthProviders\n | {\n type: typeof B2BOAuthProviders.Google;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n\n one_tap?: boolean;\n /**\n * Whether to cancel the One Tap prompt when the user taps outside of it.\n * This is only applicable if one_tap is true.\n */\n cancel_on_tap_outside?: boolean;\n }\n | {\n type: Exclude<B2BOAuthProviders, typeof B2BOAuthProviders.Google>;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n };\n\n/**\n * The options for Passwords. This is used if you've enabled the `passwords` product\n * in your configuration.\n */\n\nexport type B2BPasswordOptions = {\n loginRedirectURL?: string;\n resetPasswordRedirectURL?: string;\n resetPasswordExpirationMinutes?: number;\n resetPasswordTemplateId?: string;\n discoveryRedirectURL?: string;\n verifyEmailTemplateId?: string;\n locale?: string;\n};\n\nexport type B2BEmailOTPOptions = {\n loginTemplateId?: string;\n signupTemplateId?: string;\n locale?: string;\n};\n\nexport type B2BSMSOTPOptions = {\n locale?: string;\n};\n\nexport type DirectLoginForSingleMembershipConfig = {\n /**\n * Whether or not direct login for single membership is enabled.\n */\n status: boolean;\n /**\n * If enabled, logs user in directly even if they have pending invite to a different organization\n */\n ignoreInvites: boolean;\n /**\n * If enabled, logs user in directly even if they have organizations they could join via JIT provisioning\n */\n ignoreJitProvisioning: boolean;\n};\n\nexport const B2BMFAProducts = {\n smsOtp: 'smsOtp',\n totp: 'totp',\n} as const;\nexport type B2BMFAProducts = Values<typeof B2BMFAProducts>;\n"],"names":["AuthFlowType","Discovery","Organization","PasswordReset","RedirectURLType","ResetPassword","B2BOAuthProviders","Google","Microsoft","HubSpot","Slack","GitHub","B2BMFAProducts","smsOtp","totp"],"mappings":"AAEA;;;UAKaA,YAAAA,GAAe;IAC1BC,SAAAA,EAAW,WAAA;IACXC,YAAAA,EAAc,cAAA;IACdC,aAAAA,EAAe;AACjB;MAIaC,eAAAA,GAAkB;IAC7BC,aAAAA,EAAe;AACjB;AAIA;;UAGaC,iBAAAA,GAAoB;IAC/BC,MAAAA,EAAQ,QAAA;IACRC,SAAAA,EAAW,WAAA;IACXC,OAAAA,EAAS,SAAA;IACTC,KAAAA,EAAO,OAAA;IACPC,MAAAA,EAAQ;AACV;MAkHaC,cAAAA,GAAiB;IAC5BC,MAAAA,EAAQ,QAAA;IACRC,IAAAA,EAAM;AACR;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import merge from '../../../../../_virtual/
|
|
1
|
+
import merge from '../../../../../_virtual/index3.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import createTheme from '../../../../../node_modules/@mui/material/styles/createTheme.mjs';
|
|
4
4
|
import selectClasses from '../../../../../node_modules/@mui/material/Select/selectClasses.mjs';
|
|
@@ -13,7 +13,7 @@ import { IDPConsentScreen } from './screens/IDPConsent.mjs';
|
|
|
13
13
|
* Wrapper to add default organizationProducts value. This is done to preserve the ability for a future
|
|
14
14
|
* component that doesn't do this, allowing B2B products to be properly tree-shaken (which is also why this is currently
|
|
15
15
|
* in a completely different file)
|
|
16
|
-
*/ const AppContainer = ({ config, ...props })=>{
|
|
16
|
+
*/ const AppContainer = ({ config, styles, ...props })=>{
|
|
17
17
|
const internalConfig = {
|
|
18
18
|
...config,
|
|
19
19
|
organizationProducts: Object.values(B2BProducts)
|
|
@@ -23,7 +23,7 @@ import { IDPConsentScreen } from './screens/IDPConsent.mjs';
|
|
|
23
23
|
...props
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
const B2BIDPContainer = ({ client, presentation, callbacks, strings, getIDPConsentManifest, trustedAuthTokenParams })=>{
|
|
26
|
+
const B2BIDPContainer = ({ client, presentation, callbacks, strings, getIDPConsentManifest, trustedAuthTokenParams, styles })=>{
|
|
27
27
|
const presentationValue = usePresentationWithDefault(presentation, false, []);
|
|
28
28
|
useEffect(()=>{
|
|
29
29
|
readB2BInternals(client).bootstrap.getAsync().then((data)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.mjs","sources":["../../../../../../../../web/src/ui/b2b/App.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { B2BIDPSDKConfig, B2BSDKConfig, StytchB2BExtendedLoginConfig } from '../../types';\nimport { InternalAppContainer } from './InternalAppContainer';\nimport * as B2BProducts from './B2BProducts';\nimport { PresentationContext, usePresentationWithDefault } from '../components/PresentationConfig';\nimport { readB2BInternals } from '../../utils/internal';\nimport { DEFAULT_STATE, GlobalContextProvider } from './GlobalContextProvider';\nimport { IDPContextProvider } from '../components/organisms/IDPContextProvider';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { messages } from '../../messages/b2b/en';\nimport { IDPConsentScreen } from './screens/IDPConsent';\n\n/**\n * Wrapper to add default organizationProducts value. This is done to preserve the ability for a future\n * component that doesn't do this, allowing B2B products to be properly tree-shaken (which is also why this is currently\n * in a completely different file)\n */\nexport const AppContainer = ({
|
|
1
|
+
{"version":3,"file":"App.mjs","sources":["../../../../../../../../web/src/ui/b2b/App.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { B2BIDPSDKConfig, B2BSDKConfig, DeprecatedSDKConfig, StytchB2BExtendedLoginConfig } from '../../types';\nimport { InternalAppContainer } from './InternalAppContainer';\nimport * as B2BProducts from './B2BProducts';\nimport { PresentationContext, usePresentationWithDefault } from '../components/PresentationConfig';\nimport { readB2BInternals } from '../../utils/internal';\nimport { DEFAULT_STATE, GlobalContextProvider } from './GlobalContextProvider';\nimport { IDPContextProvider } from '../components/organisms/IDPContextProvider';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { messages } from '../../messages/b2b/en';\nimport { IDPConsentScreen } from './screens/IDPConsent';\nimport { logger, RUN_IN_DEV } from '@stytch/core';\n\n/**\n * Wrapper to add default organizationProducts value. This is done to preserve the ability for a future\n * component that doesn't do this, allowing B2B products to be properly tree-shaken (which is also why this is currently\n * in a completely different file)\n */\nexport const AppContainer = ({\n config,\n styles,\n ...props\n}: B2BSDKConfig<StytchProjectConfigurationInput> & DeprecatedSDKConfig) => {\n RUN_IN_DEV(() => {\n if (styles) {\n logger.error(\n 'styles is deprecated and has no effect. Use the presentation prop instead.\\n' +\n 'See https://staging.stytch.com/docs/api-reference/b2b/frontend-sdks/react/upgrade-guide',\n );\n }\n });\n\n const internalConfig = {\n ...config,\n organizationProducts: Object.values(B2BProducts),\n };\n\n return <InternalAppContainer config={internalConfig} {...props}></InternalAppContainer>;\n};\n\nexport const B2BIDPContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n presentation,\n callbacks,\n strings,\n getIDPConsentManifest,\n trustedAuthTokenParams,\n styles,\n}: B2BIDPSDKConfig<TProjectConfiguration> & DeprecatedSDKConfig) => {\n const presentationValue = usePresentationWithDefault(presentation, false, []);\n\n useEffect(() => {\n readB2BInternals(client)\n .bootstrap.getAsync()\n .then((data) => {\n readB2BInternals(client).networkClient.logEvent({\n name: 'render_b2b_idp_screen',\n details: { bootstrap: data },\n });\n });\n }, [client]);\n\n RUN_IN_DEV(() => {\n if (styles) {\n logger.error(\n 'styles is deprecated and has no effect. Use the presentation prop instead.\\n' +\n 'See https://staging.stytch.com/docs/api-reference/b2b/frontend-sdks/react/upgrade-guide',\n );\n }\n });\n\n return (\n <GlobalContextProvider\n client={client}\n config={{} as StytchB2BExtendedLoginConfig}\n callbacks={callbacks}\n initialState={DEFAULT_STATE}\n >\n <IDPContextProvider consentManifestGenerator={getIDPConsentManifest} authTokenParams={trustedAuthTokenParams}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <IDPConsentScreen />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </IDPContextProvider>\n </GlobalContextProvider>\n );\n};\n"],"names":["AppContainer","config","styles","props","internalConfig","organizationProducts","Object","values","B2BProducts","React","InternalAppContainer","B2BIDPContainer","client","presentation","callbacks","strings","getIDPConsentManifest","trustedAuthTokenParams","presentationValue","usePresentationWithDefault","useEffect","readB2BInternals","bootstrap","getAsync","then","data","networkClient","logEvent","name","details","GlobalContextProvider","initialState","DEFAULT_STATE","IDPContextProvider","consentManifestGenerator","authTokenParams","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","IDPConsentScreen"],"mappings":";;;;;;;;;;;AAcA;;;;IAKO,MAAMA,YAAAA,GAAe,CAAC,EAC3BC,MAAM,EACNC,MAAM,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QAACC,KAAAA,EAAOpB;qBACnCT,cAAA,CAAA,aAAA,CAAC8B,mBAAAA,EAAAA;QAAoBC,QAAAA,EAAUA,QAAAA;QAAUC,SAAAA,EAAW1B;qBAClDN,cAAA,CAAA,aAAA,CAACiC,gBAAAA,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMb;;;;"}
|
|
@@ -8,6 +8,7 @@ import { MicrosoftIcon } from '../../../assets/logo-color/Microsoft.mjs';
|
|
|
8
8
|
import { OktaIcon } from '../../../assets/logo-color/Okta.mjs';
|
|
9
9
|
import { OutlookIcon } from '../../../assets/logo-color/Outlook.mjs';
|
|
10
10
|
import { SlackIcon } from '../../../assets/logo-color/Slack.mjs';
|
|
11
|
+
import { YahooIcon } from '../../../assets/logo-color/Yahoo.mjs';
|
|
11
12
|
|
|
12
13
|
const oauthIcons = {
|
|
13
14
|
google: GoogleIcon,
|
|
@@ -23,7 +24,8 @@ const ssoIcons = {
|
|
|
23
24
|
};
|
|
24
25
|
const emailIcons = {
|
|
25
26
|
gmail: GmailIcon,
|
|
26
|
-
outlook: OutlookIcon
|
|
27
|
+
outlook: OutlookIcon,
|
|
28
|
+
yahoo: YahooIcon
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export { emailIcons, oauthIcons, ssoIcons };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icons.mjs","sources":["../../../../../../../../../web/src/ui/b2b/components/Icons.ts"],"sourcesContent":["import {\n GithubIcon,\n HubspotIcon,\n SlackIcon,\n GmailIcon,\n GoogleIcon,\n MicrosoftIcon,\n OktaIcon,\n OutlookIcon,\n} from '../../../assets/logo-color';\n\nexport const oauthIcons = {\n google: GoogleIcon,\n microsoft: MicrosoftIcon,\n hubspot: HubspotIcon,\n slack: SlackIcon,\n github: GithubIcon,\n};\n\nexport const ssoIcons = {\n google: GoogleIcon,\n microsoft: MicrosoftIcon,\n okta: OktaIcon,\n};\n\nexport const emailIcons = {\n gmail: GmailIcon,\n outlook: OutlookIcon,\n};\n\nexport type IconNames =\n | keyof typeof oauthIcons //\n | keyof typeof ssoIcons\n | keyof typeof emailIcons;\n"],"names":["oauthIcons","google","GoogleIcon","microsoft","MicrosoftIcon","hubspot","HubspotIcon","slack","SlackIcon","github","GithubIcon","ssoIcons","okta","OktaIcon","emailIcons","gmail","GmailIcon","outlook","OutlookIcon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Icons.mjs","sources":["../../../../../../../../../web/src/ui/b2b/components/Icons.ts"],"sourcesContent":["import {\n GithubIcon,\n HubspotIcon,\n SlackIcon,\n GmailIcon,\n GoogleIcon,\n MicrosoftIcon,\n OktaIcon,\n OutlookIcon,\n YahooIcon,\n} from '../../../assets/logo-color';\n\nexport const oauthIcons = {\n google: GoogleIcon,\n microsoft: MicrosoftIcon,\n hubspot: HubspotIcon,\n slack: SlackIcon,\n github: GithubIcon,\n};\n\nexport const ssoIcons = {\n google: GoogleIcon,\n microsoft: MicrosoftIcon,\n okta: OktaIcon,\n};\n\nexport const emailIcons = {\n gmail: GmailIcon,\n outlook: OutlookIcon,\n yahoo: YahooIcon,\n};\n\nexport type IconNames =\n | keyof typeof oauthIcons //\n | keyof typeof ssoIcons\n | keyof typeof emailIcons;\n"],"names":["oauthIcons","google","GoogleIcon","microsoft","MicrosoftIcon","hubspot","HubspotIcon","slack","SlackIcon","github","GithubIcon","ssoIcons","okta","OktaIcon","emailIcons","gmail","GmailIcon","outlook","OutlookIcon","yahoo","YahooIcon"],"mappings":";;;;;;;;;;;;MAYaA,UAAAA,GAAa;IACxBC,MAAAA,EAAQC,UAAAA;IACRC,SAAAA,EAAWC,aAAAA;IACXC,OAAAA,EAASC,WAAAA;IACTC,KAAAA,EAAOC,SAAAA;IACPC,MAAAA,EAAQC;AACV;MAEaC,QAAAA,GAAW;IACtBV,MAAAA,EAAQC,UAAAA;IACRC,SAAAA,EAAWC,aAAAA;IACXQ,IAAAA,EAAMC;AACR;MAEaC,UAAAA,GAAa;IACxBC,KAAAA,EAAOC,SAAAA;IACPC,OAAAA,EAASC,WAAAA;IACTC,KAAAA,EAAOC;AACT;;;;"}
|
|
@@ -2,7 +2,7 @@ import React__default from 'react';
|
|
|
2
2
|
import { useLingui } from '../../../../../../node_modules/@lingui/react/dist/index.mjs';
|
|
3
3
|
import { useStytch, useGlobalReducer } from '../GlobalContextProvider.mjs';
|
|
4
4
|
import Button from '../../components/atoms/Button.mjs';
|
|
5
|
-
import { usePresentation } from '../../components/PresentationConfig.mjs';
|
|
5
|
+
import { usePresentation, getButtonId } from '../../components/PresentationConfig.mjs';
|
|
6
6
|
import { B2BOAuthProviders } from '../../../../../core/src/public/b2b/ui.mjs';
|
|
7
7
|
|
|
8
8
|
const providerInfo = {
|
|
@@ -41,7 +41,9 @@ const OAuthB2BButton = ({ providerType, loginRedirectUrl, signupRedirectUrl, dis
|
|
|
41
41
|
const { i18n: $__i18n, _: $__ } = useLingui();
|
|
42
42
|
const stytchClient = useStytch();
|
|
43
43
|
const [state] = useGlobalReducer();
|
|
44
|
-
const
|
|
44
|
+
const presentation = usePresentation();
|
|
45
|
+
const iconRegistry = presentation.iconRegistry;
|
|
46
|
+
const id = getButtonId(`sso-${providerType}`, presentation.options);
|
|
45
47
|
const provider = providerInfo[providerType];
|
|
46
48
|
let label = providerType;
|
|
47
49
|
let icon = null;
|
|
@@ -73,7 +75,8 @@ const OAuthB2BButton = ({ providerType, loginRedirectUrl, signupRedirectUrl, dis
|
|
|
73
75
|
return /*#__PURE__*/ React__default.createElement(Button, {
|
|
74
76
|
onClick: onButtonClick,
|
|
75
77
|
variant: "outline",
|
|
76
|
-
icon: icon
|
|
78
|
+
icon: icon,
|
|
79
|
+
id: id
|
|
77
80
|
}, label);
|
|
78
81
|
};
|
|
79
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthB2BButton.mjs","sources":["../../../../../../../../../web/src/ui/b2b/components/OAuthB2BButton.tsx"],"sourcesContent":["import React from 'react';\nimport { B2BOAuthProviders } from '@stytch/core/public';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { MessageDescriptor } from '@lingui/core';\nimport { useGlobalReducer, useStytch } from '../GlobalContextProvider';\nimport Button from '../../components/atoms/Button';\nimport { usePresentation } from '../../components/PresentationConfig';\nimport { IconRegistry } from '../../components/IconRegistry';\nimport type { oauthIcons } from './Icons';\n\ntype OauthIconName = keyof typeof oauthIcons;\n\ninterface OAuthProviderInfo {\n messageDescriptor: MessageDescriptor;\n}\n\nconst providerInfo: Record<B2BOAuthProviders, OAuthProviderInfo> = {\n [B2BOAuthProviders.Google]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGoogle', message: 'Continue with Google' }),\n },\n [B2BOAuthProviders.Microsoft]: {\n messageDescriptor: msg({ id: 'oauth.continueWithMicrosoft', message: 'Continue with Microsoft' }),\n },\n [B2BOAuthProviders.HubSpot]: {\n messageDescriptor: msg({ id: 'oauth.continueWithHubSpot', message: 'Continue with HubSpot' }),\n },\n [B2BOAuthProviders.Slack]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSlack', message: 'Continue with Slack' }),\n },\n [B2BOAuthProviders.GitHub]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGitHub', message: 'Continue with GitHub' }),\n },\n};\n\nexport type OauthB2BButtonProps = {\n providerType: B2BOAuthProviders;\n loginRedirectUrl?: string;\n signupRedirectUrl?: string;\n discoveryRedirectUrl?: string;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n onSuccess?: () => void;\n};\n\nexport const OAuthB2BButton = ({\n providerType,\n loginRedirectUrl,\n signupRedirectUrl,\n discoveryRedirectUrl,\n customScopes,\n providerParams,\n onSuccess,\n}: OauthB2BButtonProps) => {\n const { t } = useLingui();\n const stytchClient = useStytch();\n const [state] = useGlobalReducer();\n const iconRegistry: IconRegistry<OauthIconName> =
|
|
1
|
+
{"version":3,"file":"OAuthB2BButton.mjs","sources":["../../../../../../../../../web/src/ui/b2b/components/OAuthB2BButton.tsx"],"sourcesContent":["import React from 'react';\nimport { B2BOAuthProviders } from '@stytch/core/public';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { MessageDescriptor } from '@lingui/core';\nimport { useGlobalReducer, useStytch } from '../GlobalContextProvider';\nimport Button from '../../components/atoms/Button';\nimport { getButtonId, usePresentation } from '../../components/PresentationConfig';\nimport { IconRegistry } from '../../components/IconRegistry';\nimport type { oauthIcons } from './Icons';\n\ntype OauthIconName = keyof typeof oauthIcons;\n\ninterface OAuthProviderInfo {\n messageDescriptor: MessageDescriptor;\n}\n\nconst providerInfo: Record<B2BOAuthProviders, OAuthProviderInfo> = {\n [B2BOAuthProviders.Google]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGoogle', message: 'Continue with Google' }),\n },\n [B2BOAuthProviders.Microsoft]: {\n messageDescriptor: msg({ id: 'oauth.continueWithMicrosoft', message: 'Continue with Microsoft' }),\n },\n [B2BOAuthProviders.HubSpot]: {\n messageDescriptor: msg({ id: 'oauth.continueWithHubSpot', message: 'Continue with HubSpot' }),\n },\n [B2BOAuthProviders.Slack]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSlack', message: 'Continue with Slack' }),\n },\n [B2BOAuthProviders.GitHub]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGitHub', message: 'Continue with GitHub' }),\n },\n};\n\nexport type OauthB2BButtonProps = {\n providerType: B2BOAuthProviders;\n loginRedirectUrl?: string;\n signupRedirectUrl?: string;\n discoveryRedirectUrl?: string;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n onSuccess?: () => void;\n};\n\nexport const OAuthB2BButton = ({\n providerType,\n loginRedirectUrl,\n signupRedirectUrl,\n discoveryRedirectUrl,\n customScopes,\n providerParams,\n onSuccess,\n}: OauthB2BButtonProps) => {\n const { t } = useLingui();\n const stytchClient = useStytch();\n const [state] = useGlobalReducer();\n\n const presentation = usePresentation();\n const iconRegistry: IconRegistry<OauthIconName> = presentation.iconRegistry;\n const id = getButtonId(`sso-${providerType}`, presentation.options);\n\n const provider = providerInfo[providerType];\n let label: string = providerType;\n let icon = null;\n if (provider) {\n const { messageDescriptor } = provider;\n const Icon = iconRegistry[providerType];\n label = t(messageDescriptor);\n icon = <Icon />;\n }\n\n const onButtonClick = async () => {\n const providerClient = stytchClient.oauth[providerType];\n\n if (state.flowState.organization) {\n await providerClient.start({\n login_redirect_url: loginRedirectUrl,\n signup_redirect_url: signupRedirectUrl,\n custom_scopes: customScopes,\n organization_id: state.flowState.organization.organization_id,\n provider_params: providerParams,\n });\n } else {\n await providerClient.discovery.start({\n discovery_redirect_url: discoveryRedirectUrl,\n custom_scopes: customScopes,\n provider_params: providerParams,\n });\n }\n\n onSuccess?.();\n };\n\n return (\n <Button onClick={onButtonClick} variant=\"outline\" icon={icon} id={id}>\n {label}\n </Button>\n );\n};\n"],"names":["providerInfo","B2BOAuthProviders","Google","messageDescriptor","Microsoft","HubSpot","Slack","GitHub","OAuthB2BButton","providerType","loginRedirectUrl","signupRedirectUrl","discoveryRedirectUrl","customScopes","providerParams","onSuccess","useLingui","stytchClient","useStytch","state","useGlobalReducer","presentation","usePresentation","iconRegistry","id","getButtonId","options","provider","label","icon","Icon","React","onButtonClick","providerClient","oauth","flowState","organization","start","login_redirect_url","signup_redirect_url","custom_scopes","organization_id","provider_params","discovery","discovery_redirect_url","Button","onClick","variant"],"mappings":";;;;;;;AAiBA,MAAMA,YAAAA,GAA6D;IACjE,CAACC,iBAAAA,CAAkBC,MAAM,GAAG;QAC1BC,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,iBAAAA,CAAkBG,SAAS,GAAG;QAC7BD,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,iBAAAA,CAAkBI,OAAO,GAAG;QAC3BF,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,iBAAAA,CAAkBK,KAAK,GAAG;QACzBH,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF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KAAK,CAAC;gBACzBC,kBAAAA,EAAoB5B,gBAAAA;gBACpB6B,mBAAAA,EAAqB5B,iBAAAA;gBACrB6B,aAAAA,EAAe3B,YAAAA;AACf4B,gBAAAA,eAAAA,EAAiBtB,KAAAA,CAAMgB,SAAS,CAACC,YAAY,CAACK,eAAe;gBAC7DC,eAAAA,EAAiB5B;AACnB,aAAA,CAAA;QACF,CAAA,MAAO;AACL,YAAA,MAAMmB,cAAAA,CAAeU,SAAS,CAACN,KAAK,CAAC;gBACnCO,sBAAAA,EAAwBhC,oBAAAA;gBACxB4B,aAAAA,EAAe3B,YAAAA;gBACf6B,eAAAA,EAAiB5B;AACnB,aAAA,CAAA;AACF,QAAA;AAEAC,QAAAA,SAAAA,IAAAA;AACF,IAAA,CAAA;AAEA,IAAA,qBACEgB,cAAA,CAAA,aAAA,CAACc,MAAAA,EAAAA;QAAOC,OAAAA,EAASd,aAAAA;QAAee,OAAAA,EAAQ,SAAA;QAAUlB,IAAAA,EAAMA,IAAAA;QAAML,EAAAA,EAAIA;AAC/DI,KAAAA,EAAAA,KAAAA,CAAAA;AAGP;;;;"}
|
|
@@ -3,7 +3,7 @@ import { useLingui } from '../../../../../../node_modules/@lingui/react/dist/ind
|
|
|
3
3
|
import { useStytch, useConfig } from '../GlobalContextProvider.mjs';
|
|
4
4
|
import { SSOIcon } from '../../../assets/sso.mjs';
|
|
5
5
|
import Button from '../../components/atoms/Button.mjs';
|
|
6
|
-
import { usePresentation } from '../../components/PresentationConfig.mjs';
|
|
6
|
+
import { usePresentation, getButtonId } from '../../components/PresentationConfig.mjs';
|
|
7
7
|
|
|
8
8
|
const iconMap = {
|
|
9
9
|
'google-workspace': 'google',
|
|
@@ -14,8 +14,9 @@ const SSOButton = ({ connection, onStart })=>{
|
|
|
14
14
|
const { i18n: $__i18n, _: $__ } = useLingui();
|
|
15
15
|
const stytchClient = useStytch();
|
|
16
16
|
const { ssoOptions } = useConfig();
|
|
17
|
-
const { iconRegistry } = usePresentation();
|
|
17
|
+
const { iconRegistry, options } = usePresentation();
|
|
18
18
|
const { connection_id, display_name, identity_provider } = connection;
|
|
19
|
+
const id = getButtonId(`sso-${display_name}`, options);
|
|
19
20
|
const onButtonClick = ()=>stytchClient.sso.start({
|
|
20
21
|
connection_id,
|
|
21
22
|
signup_redirect_url: ssoOptions?.signupRedirectURL,
|
|
@@ -28,7 +29,8 @@ const SSOButton = ({ connection, onStart })=>{
|
|
|
28
29
|
return /*#__PURE__*/ React__default.createElement(Button, {
|
|
29
30
|
variant: "outline",
|
|
30
31
|
onClick: onButtonClick,
|
|
31
|
-
icon: /*#__PURE__*/ React__default.createElement(Icon, null)
|
|
32
|
+
icon: /*#__PURE__*/ React__default.createElement(Icon, null),
|
|
33
|
+
id: id
|
|
32
34
|
}, $__i18n._({
|
|
33
35
|
id: "provider.continueWith",
|
|
34
36
|
message: "Continue with {display_name}",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SSOButton.mjs","sources":["../../../../../../../../../web/src/ui/b2b/components/SSOButton.tsx"],"sourcesContent":["import React from 'react';\nimport { SSOActiveConnection } from '@stytch/core/public';\nimport { useLingui } from '@lingui/react/macro';\nimport { useConfig, useStytch } from '../GlobalContextProvider';\nimport { SsoKnownIdp } from '../../../utils/KnownIdp';\n\nimport { SSOIcon } from '../../../assets';\nimport Button from '../../components/atoms/Button';\nimport { usePresentation } from '../../components/PresentationConfig';\nimport type { ssoIcons } from './Icons';\n\ntype SsoIconNames = keyof typeof ssoIcons;\n\nconst iconMap: Record<string, SsoIconNames> = {\n 'google-workspace': 'google',\n 'microsoft-entra': 'microsoft',\n okta: 'okta',\n} satisfies Record<Exclude<SsoKnownIdp, 'generic'>, SsoIconNames>;\n\nexport interface SSOButtonProps {\n connection: SSOActiveConnection;\n onStart?: (connection: SSOActiveConnection) => void;\n}\n\nexport const SSOButton = ({ connection, onStart }: SSOButtonProps) => {\n const { t } = useLingui();\n const stytchClient = useStytch();\n const { ssoOptions } = useConfig();\n const { iconRegistry } = usePresentation();\n\n const { connection_id, display_name, identity_provider } = connection;\n\n const onButtonClick = () =>\n stytchClient.sso\n .start({\n connection_id,\n signup_redirect_url: ssoOptions?.signupRedirectURL,\n login_redirect_url: ssoOptions?.loginRedirectURL,\n })\n .then(() => {\n onStart?.(connection);\n });\n\n const iconName = iconMap[identity_provider];\n const Icon = iconRegistry[iconName] ?? SSOIcon;\n\n return (\n <Button variant=\"outline\" onClick={onButtonClick} icon={<Icon />}>\n {t({ id: 'provider.continueWith', message: `Continue with ${display_name}` })}\n </Button>\n );\n};\n"],"names":["iconMap","okta","SSOButton","connection","onStart","useLingui","stytchClient","useStytch","ssoOptions","useConfig","iconRegistry","usePresentation","connection_id","display_name","identity_provider","onButtonClick","sso","start","signup_redirect_url","signupRedirectURL","login_redirect_url","loginRedirectURL","then","iconName","Icon","SSOIcon","React","Button","variant","onClick","icon"],"mappings":";;;;;;;AAaA,MAAMA,OAAAA,GAAwC;IAC5C,kBAAA,EAAoB,QAAA;IACpB,iBAAA,EAAmB,WAAA;IACnBC,IAAAA,EAAM;AACR,CAAA;MAOaC,SAAAA,GAAY,CAAC,EAAEC,UAAU,EAAEC,OAAO,EAAkB,GAAA;AAC/D,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;AACd,IAAA,MAAMC,YAAAA,GAAeC,SAAAA,EAAAA;IACrB,MAAM,EAAEC,UAAU,EAAE,GAAGC,SAAAA,EAAAA;
|
|
1
|
+
{"version":3,"file":"SSOButton.mjs","sources":["../../../../../../../../../web/src/ui/b2b/components/SSOButton.tsx"],"sourcesContent":["import React from 'react';\nimport { SSOActiveConnection } from '@stytch/core/public';\nimport { useLingui } from '@lingui/react/macro';\nimport { useConfig, useStytch } from '../GlobalContextProvider';\nimport { SsoKnownIdp } from '../../../utils/KnownIdp';\n\nimport { SSOIcon } from '../../../assets';\nimport Button from '../../components/atoms/Button';\nimport { getButtonId, usePresentation } from '../../components/PresentationConfig';\nimport type { ssoIcons } from './Icons';\n\ntype SsoIconNames = keyof typeof ssoIcons;\n\nconst iconMap: Record<string, SsoIconNames> = {\n 'google-workspace': 'google',\n 'microsoft-entra': 'microsoft',\n okta: 'okta',\n} satisfies Record<Exclude<SsoKnownIdp, 'generic'>, SsoIconNames>;\n\nexport interface SSOButtonProps {\n connection: SSOActiveConnection;\n onStart?: (connection: SSOActiveConnection) => void;\n}\n\nexport const SSOButton = ({ connection, onStart }: SSOButtonProps) => {\n const { t } = useLingui();\n const stytchClient = useStytch();\n const { ssoOptions } = useConfig();\n const { iconRegistry, options } = usePresentation();\n\n const { connection_id, display_name, identity_provider } = connection;\n\n const id = getButtonId(`sso-${display_name}`, options);\n\n const onButtonClick = () =>\n stytchClient.sso\n .start({\n connection_id,\n signup_redirect_url: ssoOptions?.signupRedirectURL,\n login_redirect_url: ssoOptions?.loginRedirectURL,\n })\n .then(() => {\n onStart?.(connection);\n });\n\n const iconName = iconMap[identity_provider];\n const Icon = iconRegistry[iconName] ?? SSOIcon;\n\n return (\n <Button variant=\"outline\" onClick={onButtonClick} icon={<Icon />} id={id}>\n {t({ id: 'provider.continueWith', message: `Continue with ${display_name}` })}\n </Button>\n );\n};\n"],"names":["iconMap","okta","SSOButton","connection","onStart","useLingui","stytchClient","useStytch","ssoOptions","useConfig","iconRegistry","options","usePresentation","connection_id","display_name","identity_provider","id","getButtonId","onButtonClick","sso","start","signup_redirect_url","signupRedirectURL","login_redirect_url","loginRedirectURL","then","iconName","Icon","SSOIcon","React","Button","variant","onClick","icon"],"mappings":";;;;;;;AAaA,MAAMA,OAAAA,GAAwC;IAC5C,kBAAA,EAAoB,QAAA;IACpB,iBAAA,EAAmB,WAAA;IACnBC,IAAAA,EAAM;AACR,CAAA;MAOaC,SAAAA,GAAY,CAAC,EAAEC,UAAU,EAAEC,OAAO,EAAkB,GAAA;AAC/D,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;AACd,IAAA,MAAMC,YAAAA,GAAeC,SAAAA,EAAAA;IACrB,MAAM,EAAEC,UAAU,EAAE,GAAGC,SAAAA,EAAAA;AACvB,IAAA,MAAM,EAAEC,YAAY,EAAEC,OAAO,EAAE,GAAGC,eAAAA,EAAAA;AAElC,IAAA,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEC,iBAAiB,EAAE,GAAGZ,UAAAA;AAE3D,IAAA,MAAMa,KAAKC,WAAAA,CAAY,CAAC,IAAI,EAAEH,cAAc,EAAEH,OAAAA,CAAAA;AAE9C,IAAA,MAAMO,gBAAgB,IACpBZ,YAAAA,CAAaa,GAAG,CACbC,KAAK,CAAC;AACLP,YAAAA,aAAAA;AACAQ,YAAAA,mBAAAA,EAAqBb,UAAAA,EAAYc,iBAAAA;AACjCC,YAAAA,kBAAAA,EAAoBf,UAAAA,EAAYgB;AAClC,SAAA,CAAA,CACCC,IAAI,CAAC,IAAA;YACJrB,OAAAA,GAAUD,UAAAA,CAAAA;AACZ,QAAA,CAAA,CAAA;IAEJ,MAAMuB,QAAAA,GAAW1B,OAAO,CAACe,iBAAAA,CAAkB;AAC3C,IAAA,MAAMY,IAAAA,GAAOjB,YAAY,CAACgB,QAAAA,CAAS,IAAIE,OAAAA;AAEvC,IAAA,qBACEC,cAAA,CAAA,aAAA,CAACC,MAAAA,EAAAA;QAAOC,OAAAA,EAAQ,SAAA;QAAUC,OAAAA,EAASd,aAAAA;AAAee,QAAAA,IAAAA,gBAAMJ,cAAA,CAAA,aAAA,CAACF,IAAAA,EAAAA,IAAAA,CAAAA;QAASX,EAAAA,EAAIA;;;;;AACRF,YAAAA,YAAAA,EAAAA;;;AAGlE;;;;"}
|
|
@@ -5,11 +5,12 @@ import { MainScreenComponent, AppScreens } from '../types/AppScreens.mjs';
|
|
|
5
5
|
import { useEffectiveAuthConfig } from '../hooks/useEffectiveAuthConfig.mjs';
|
|
6
6
|
import { useProductComponents } from '../utils.mjs';
|
|
7
7
|
import { assertUnreachable } from '../../../utils/assertUnreachable.mjs';
|
|
8
|
-
import {
|
|
8
|
+
import { getButtonKey, getSsoMethodKey } from '../types/authMethodKeys.mjs';
|
|
9
9
|
import { useLastUsedAuthMethod } from '../hooks/useLastUsedAuthMethod.mjs';
|
|
10
10
|
import Button from '../../components/atoms/Button.mjs';
|
|
11
11
|
import LastUsed from '../../components/molecules/LastUsed.mjs';
|
|
12
12
|
import ButtonColumn from '../../components/molecules/ButtonColumn.mjs';
|
|
13
|
+
import { usePresentation, getButtonId } from '../../components/PresentationConfig.mjs';
|
|
13
14
|
import { AuthFlowType, B2BOAuthProviders } from '../../../../../core/src/public/b2b/ui.mjs';
|
|
14
15
|
import { arrayUtils } from '../../../../../core/src/utils/arrayUtils.mjs';
|
|
15
16
|
|
|
@@ -38,6 +39,7 @@ const SsoAndOAuthButtons = ({ buttons })=>{
|
|
|
38
39
|
const { i18n: $__i18n, _: $__ } = useLingui();
|
|
39
40
|
const [state, dispatch] = useGlobalReducer();
|
|
40
41
|
const { oauthProviderSettings = [] } = useEffectiveAuthConfig();
|
|
42
|
+
const presentation = usePresentation();
|
|
41
43
|
const [lastUsedMethod, setLastUsedMethod] = useLastUsedAuthMethod();
|
|
42
44
|
const config = useConfig();
|
|
43
45
|
const { loginRedirectURL, signupRedirectURL, discoveryRedirectURL, customScopes, providerParams } = config.oauthOptions ?? {};
|
|
@@ -65,7 +67,7 @@ const SsoAndOAuthButtons = ({ buttons })=>{
|
|
|
65
67
|
return null;
|
|
66
68
|
}
|
|
67
69
|
// Reorder providers based on last used
|
|
68
|
-
const [reorderedButtons, foundLastUsedOAuth] = arrayUtils.moveToFront(authButtons, (button)=>
|
|
70
|
+
const [reorderedButtons, foundLastUsedOAuth] = arrayUtils.moveToFront(authButtons, (button)=>getButtonKey(button) === lastUsedMethod);
|
|
69
71
|
// Helper function to create OAuth button component
|
|
70
72
|
const createOAuthButton = (oauthProvider)=>{
|
|
71
73
|
const providerProps = {
|
|
@@ -104,6 +106,7 @@ const SsoAndOAuthButtons = ({ buttons })=>{
|
|
|
104
106
|
return /*#__PURE__*/ React__default.createElement(Button, {
|
|
105
107
|
key: "sso-discovery",
|
|
106
108
|
variant: "outline",
|
|
109
|
+
id: getButtonId('sso-discovery', presentation.options),
|
|
107
110
|
onClick: ()=>{
|
|
108
111
|
dispatch({
|
|
109
112
|
type: 'transition',
|
|
@@ -120,7 +123,7 @@ const SsoAndOAuthButtons = ({ buttons })=>{
|
|
|
120
123
|
}
|
|
121
124
|
})();
|
|
122
125
|
return foundLastUsedOAuth && index === 0 ? /*#__PURE__*/ React__default.createElement(LastUsed, {
|
|
123
|
-
key:
|
|
126
|
+
key: getButtonKey(button)
|
|
124
127
|
}, buttonComponent) : buttonComponent;
|
|
125
128
|
}));
|
|
126
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsoAndOAuthButtons.mjs","sources":["../../../../../../../../../web/src/ui/b2b/screens/SsoAndOAuthButtons.tsx"],"sourcesContent":["import React from 'react';\nimport { B2BOAuthProviders, AuthFlowType } from '@stytch/core/public';\nimport { arrayUtils } from '@stytch/core';\nimport { useLingui } from '@lingui/react/macro';\n\nimport { useConfig, useGlobalReducer } from '../GlobalContextProvider';\nimport { AppScreens, ButtonComponent, MainScreenComponent } from '../types/AppScreens';\nimport { OauthProviderParams, useEffectiveAuthConfig } from '../hooks/useEffectiveAuthConfig';\nimport { useProductComponents } from '../utils';\nimport { assertUnreachable } from '../../../utils/assertUnreachable';\nimport { AuthButton as AuthButtonType, getButtonId, getSsoMethodKey } from '../types/authMethodKeys';\nimport { useLastUsedAuthMethod } from '../hooks/useLastUsedAuthMethod';\nimport Button from '../../components/atoms/Button';\nimport LastUsed from '../../components/molecules/LastUsed';\nimport ButtonColumn from '../../components/molecules/ButtonColumn';\n\n// OAuth helper functions\nexport const getCustomScopesForProvider = (\n oauthProvider: {\n type: B2BOAuthProviders;\n one_tap: boolean;\n customScopes: string[];\n providerParams: Record<string, string>;\n cancel_on_tap_outside?: boolean;\n },\n oauthOptionsCustomScopes: string[] | undefined,\n) => {\n let currentCustomScopes = oauthProvider.customScopes;\n if (Object.keys(currentCustomScopes).length == 0) {\n currentCustomScopes = oauthOptionsCustomScopes as string[];\n }\n return currentCustomScopes;\n};\n\nexport const getProviderParamsForProvider = (\n oauthProvider: {\n type: B2BOAuthProviders;\n one_tap: boolean;\n customScopes: string[];\n providerParams: Record<string, string>;\n cancel_on_tap_outside?: boolean;\n },\n oauthOptionsProviderParams: Record<string, string> | undefined,\n email: string | undefined,\n) => {\n let currentProviderParams = oauthProvider.providerParams;\n if (Object.keys(currentProviderParams).length == 0) {\n currentProviderParams = oauthOptionsProviderParams ?? {};\n }\n\n if (\n email &&\n (oauthProvider.type === B2BOAuthProviders.Google || oauthProvider.type === B2BOAuthProviders.Microsoft) &&\n !('login_hint' in currentProviderParams)\n ) {\n currentProviderParams = {\n ...currentProviderParams,\n login_hint: email,\n };\n }\n\n return currentProviderParams;\n};\n\nexport const SsoAndOAuthButtons = ({ buttons }: { buttons: ButtonComponent[] }) => {\n const { t } = useLingui();\n const [state, dispatch] = useGlobalReducer();\n const { oauthProviderSettings = [] } = useEffectiveAuthConfig();\n\n const [lastUsedMethod, setLastUsedMethod] = useLastUsedAuthMethod();\n\n const config = useConfig();\n const { loginRedirectURL, signupRedirectURL, discoveryRedirectURL, customScopes, providerParams } =\n config.oauthOptions ?? {};\n\n const { B2BGoogleOneTap, OAuthB2BButton, SSOButton } = useProductComponents(config, 'ssoAndOAuthButtons')!;\n\n // Determine which buttons need to be displayed\n const isDiscoveryFlow = state.flowState.type === AuthFlowType.Discovery;\n const authButtons = buttons.flatMap<AuthButtonType>((button) => {\n if (button === MainScreenComponent.OAuthButtons) {\n return oauthProviderSettings.map((provider) => ({ type: 'oauth', provider }));\n } else if (button === MainScreenComponent.SSOButtons) {\n return isDiscoveryFlow\n ? { type: 'sso-discovery' }\n : (state.flowState.organization?.sso_active_connections?.map((connection) => ({ type: 'sso', connection })) ??\n []);\n } else {\n assertUnreachable(button);\n }\n });\n\n if (authButtons.length === 0) {\n return null;\n }\n\n // Reorder providers based on last used\n const [reorderedButtons, foundLastUsedOAuth] = arrayUtils.moveToFront(\n authButtons,\n (button) => getButtonId(button) === lastUsedMethod,\n );\n\n // Helper function to create OAuth button component\n const createOAuthButton = (oauthProvider: OauthProviderParams) => {\n const providerProps = {\n customScopes: getCustomScopesForProvider(oauthProvider, customScopes),\n providerParams: getProviderParamsForProvider(oauthProvider, providerParams, state.primary.email),\n };\n\n if (oauthProvider.one_tap) {\n return (\n <B2BGoogleOneTap\n key={oauthProvider.type}\n {...providerProps}\n cancelOnTapOutside={oauthProvider.cancel_on_tap_outside}\n />\n );\n }\n\n return (\n <OAuthB2BButton\n key={oauthProvider.type}\n providerType={oauthProvider.type}\n loginRedirectUrl={loginRedirectURL}\n signupRedirectUrl={signupRedirectURL}\n discoveryRedirectUrl={discoveryRedirectURL}\n onSuccess={() => setLastUsedMethod(oauthProvider.type)}\n {...providerProps}\n />\n );\n };\n\n return (\n <ButtonColumn>\n {reorderedButtons.map((button, index) => {\n const buttonComponent = (() => {\n switch (button.type) {\n case 'oauth':\n return createOAuthButton(button.provider);\n\n case 'sso':\n return (\n <SSOButton\n key={button.connection.display_name}\n connection={button.connection}\n onStart={() => setLastUsedMethod(getSsoMethodKey(button.connection))}\n />\n );\n\n case 'sso-discovery':\n return (\n <Button\n key=\"sso-discovery\"\n variant=\"outline\"\n onClick={() => {\n dispatch({ type: 'transition', screen: AppScreens.SSODiscoveryEmail, history: 'push' });\n }}\n >\n {t({ id: 'provider.continueWithSSO', message: 'Use single sign-on' })}\n </Button>\n );\n\n default:\n assertUnreachable(button);\n }\n })();\n\n return foundLastUsedOAuth && index === 0 ? (\n <LastUsed key={getButtonId(button)}>{buttonComponent}</LastUsed>\n ) : (\n buttonComponent\n );\n })}\n </ButtonColumn>\n );\n};\n"],"names":["getCustomScopesForProvider","oauthProvider","oauthOptionsCustomScopes","currentCustomScopes","customScopes","Object","keys","length","getProviderParamsForProvider","oauthOptionsProviderParams","email","currentProviderParams","providerParams","type","B2BOAuthProviders","Google","Microsoft","login_hint","SsoAndOAuthButtons","buttons","useLingui","state","dispatch","useGlobalReducer","oauthProviderSettings","useEffectiveAuthConfig","lastUsedMethod","setLastUsedMethod","useLastUsedAuthMethod","config","useConfig","loginRedirectURL","signupRedirectURL","discoveryRedirectURL","oauthOptions","B2BGoogleOneTap","OAuthB2BButton","SSOButton","useProductComponents","isDiscoveryFlow","flowState","AuthFlowType","Discovery","authButtons","flatMap","button","MainScreenComponent","OAuthButtons","map","provider","SSOButtons","organization","sso_active_connections","connection","assertUnreachable","reorderedButtons","foundLastUsedOAuth","arrayUtils","moveToFront","getButtonId","createOAuthButton","providerProps","primary","one_tap","React","key","cancelOnTapOutside","cancel_on_tap_outside","providerType","loginRedirectUrl","signupRedirectUrl","discoveryRedirectUrl","onSuccess","ButtonColumn","index","buttonComponent","display_name","onStart","getSsoMethodKey","Button","variant","onClick","screen","AppScreens","SSODiscoveryEmail","history","LastUsed"],"mappings":";;;;;;;;;;;;;;;AAgBA;AACO,MAAMA,0BAAAA,GAA6B,CACxCC,aAAAA,EAOAC,wBAAAA,GAAAA;IAEA,IAAIC,mBAAAA,GAAsBF,cAAcG,YAAY;AACpD,IAAA,IAAIC,OAAOC,IAAI,CAACH,mBAAAA,CAAAA,CAAqBI,MAAM,IAAI,CAAA,EAAG;QAChDJ,mBAAAA,GAAsBD,wBAAAA;AACxB,IAAA;IACA,OAAOC,mBAAAA;AACT;AAEO,MAAMK,4BAAAA,GAA+B,CAC1CP,aAAAA,EAOAQ,0BAAAA,EACAC,KAAAA,GAAAA;IAEA,IAAIC,qBAAAA,GAAwBV,cAAcW,cAAc;AACxD,IAAA,IAAIP,OAAOC,IAAI,CAACK,qBAAAA,CAAAA,CAAuBJ,MAAM,IAAI,CAAA,EAAG;AAClDI,QAAAA,qBAAAA,GAAwBF,8BAA8B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AA,EAAS;AAAO,6BAAA,CAAA;AACvF,wBAAA;;;;;AAMN,gBAAA;oBACE/B,iBAAAA,CAAkBT,CAAAA;AACtB;QACF,CAAA,GAAA;QAEA,OAAOW,kBAAAA,IAAsBkB,KAAAA,KAAU,CAAA,iBACrCV,cAAA,CAAA,aAAA,CAACsB,QAAAA,EAAAA;AAASrB,YAAAA,GAAAA,EAAKN,WAAAA,CAAYd,MAAAA;WAAU8B,eAAAA,CAAAA,GAErCA,eAAAA;AAEJ,IAAA,CAAA,CAAA,CAAA;AAGN;;;;"}
|
|
1
|
+
{"version":3,"file":"SsoAndOAuthButtons.mjs","sources":["../../../../../../../../../web/src/ui/b2b/screens/SsoAndOAuthButtons.tsx"],"sourcesContent":["import React from 'react';\nimport { B2BOAuthProviders, AuthFlowType } from '@stytch/core/public';\nimport { arrayUtils } from '@stytch/core';\nimport { useLingui } from '@lingui/react/macro';\n\nimport { useConfig, useGlobalReducer } from '../GlobalContextProvider';\nimport { AppScreens, ButtonComponent, MainScreenComponent } from '../types/AppScreens';\nimport { OauthProviderParams, useEffectiveAuthConfig } from '../hooks/useEffectiveAuthConfig';\nimport { useProductComponents } from '../utils';\nimport { assertUnreachable } from '../../../utils/assertUnreachable';\nimport { AuthButton as AuthButtonType, getButtonKey, getSsoMethodKey } from '../types/authMethodKeys';\nimport { useLastUsedAuthMethod } from '../hooks/useLastUsedAuthMethod';\nimport Button from '../../components/atoms/Button';\nimport LastUsed from '../../components/molecules/LastUsed';\nimport ButtonColumn from '../../components/molecules/ButtonColumn';\nimport { getButtonId, usePresentation } from '../../components/PresentationConfig';\n\n// OAuth helper functions\nexport const getCustomScopesForProvider = (\n oauthProvider: {\n type: B2BOAuthProviders;\n one_tap: boolean;\n customScopes: string[];\n providerParams: Record<string, string>;\n cancel_on_tap_outside?: boolean;\n },\n oauthOptionsCustomScopes: string[] | undefined,\n) => {\n let currentCustomScopes = oauthProvider.customScopes;\n if (Object.keys(currentCustomScopes).length == 0) {\n currentCustomScopes = oauthOptionsCustomScopes as string[];\n }\n return currentCustomScopes;\n};\n\nexport const getProviderParamsForProvider = (\n oauthProvider: {\n type: B2BOAuthProviders;\n one_tap: boolean;\n customScopes: string[];\n providerParams: Record<string, string>;\n cancel_on_tap_outside?: boolean;\n },\n oauthOptionsProviderParams: Record<string, string> | undefined,\n email: string | undefined,\n) => {\n let currentProviderParams = oauthProvider.providerParams;\n if (Object.keys(currentProviderParams).length == 0) {\n currentProviderParams = oauthOptionsProviderParams ?? {};\n }\n\n if (\n email &&\n (oauthProvider.type === B2BOAuthProviders.Google || oauthProvider.type === B2BOAuthProviders.Microsoft) &&\n !('login_hint' in currentProviderParams)\n ) {\n currentProviderParams = {\n ...currentProviderParams,\n login_hint: email,\n };\n }\n\n return currentProviderParams;\n};\n\nexport const SsoAndOAuthButtons = ({ buttons }: { buttons: ButtonComponent[] }) => {\n const { t } = useLingui();\n const [state, dispatch] = useGlobalReducer();\n const { oauthProviderSettings = [] } = useEffectiveAuthConfig();\n const presentation = usePresentation();\n\n const [lastUsedMethod, setLastUsedMethod] = useLastUsedAuthMethod();\n\n const config = useConfig();\n const { loginRedirectURL, signupRedirectURL, discoveryRedirectURL, customScopes, providerParams } =\n config.oauthOptions ?? {};\n\n const { B2BGoogleOneTap, OAuthB2BButton, SSOButton } = useProductComponents(config, 'ssoAndOAuthButtons')!;\n\n // Determine which buttons need to be displayed\n const isDiscoveryFlow = state.flowState.type === AuthFlowType.Discovery;\n const authButtons = buttons.flatMap<AuthButtonType>((button) => {\n if (button === MainScreenComponent.OAuthButtons) {\n return oauthProviderSettings.map((provider) => ({ type: 'oauth', provider }));\n } else if (button === MainScreenComponent.SSOButtons) {\n return isDiscoveryFlow\n ? { type: 'sso-discovery' }\n : (state.flowState.organization?.sso_active_connections?.map((connection) => ({ type: 'sso', connection })) ??\n []);\n } else {\n assertUnreachable(button);\n }\n });\n\n if (authButtons.length === 0) {\n return null;\n }\n\n // Reorder providers based on last used\n const [reorderedButtons, foundLastUsedOAuth] = arrayUtils.moveToFront(\n authButtons,\n (button) => getButtonKey(button) === lastUsedMethod,\n );\n\n // Helper function to create OAuth button component\n const createOAuthButton = (oauthProvider: OauthProviderParams) => {\n const providerProps = {\n customScopes: getCustomScopesForProvider(oauthProvider, customScopes),\n providerParams: getProviderParamsForProvider(oauthProvider, providerParams, state.primary.email),\n };\n\n if (oauthProvider.one_tap) {\n return (\n <B2BGoogleOneTap\n key={oauthProvider.type}\n {...providerProps}\n cancelOnTapOutside={oauthProvider.cancel_on_tap_outside}\n />\n );\n }\n\n return (\n <OAuthB2BButton\n key={oauthProvider.type}\n providerType={oauthProvider.type}\n loginRedirectUrl={loginRedirectURL}\n signupRedirectUrl={signupRedirectURL}\n discoveryRedirectUrl={discoveryRedirectURL}\n onSuccess={() => setLastUsedMethod(oauthProvider.type)}\n {...providerProps}\n />\n );\n };\n\n return (\n <ButtonColumn>\n {reorderedButtons.map((button, index) => {\n const buttonComponent = (() => {\n switch (button.type) {\n case 'oauth':\n return createOAuthButton(button.provider);\n\n case 'sso':\n return (\n <SSOButton\n key={button.connection.display_name}\n connection={button.connection}\n onStart={() => setLastUsedMethod(getSsoMethodKey(button.connection))}\n />\n );\n\n case 'sso-discovery':\n return (\n <Button\n key=\"sso-discovery\"\n variant=\"outline\"\n id={getButtonId('sso-discovery', presentation.options)}\n onClick={() => {\n dispatch({ type: 'transition', screen: AppScreens.SSODiscoveryEmail, history: 'push' });\n }}\n >\n {t({ id: 'provider.continueWithSSO', message: 'Use single sign-on' })}\n </Button>\n );\n\n default:\n assertUnreachable(button);\n }\n })();\n\n return foundLastUsedOAuth && index === 0 ? (\n <LastUsed key={getButtonKey(button)}>{buttonComponent}</LastUsed>\n ) : (\n buttonComponent\n );\n })}\n </ButtonColumn>\n );\n};\n"],"names":["getCustomScopesForProvider","oauthProvider","oauthOptionsCustomScopes","currentCustomScopes","customScopes","Object","keys","length","getProviderParamsForProvider","oauthOptionsProviderParams","email","currentProviderParams","providerParams","type","B2BOAuthProviders","Google","Microsoft","login_hint","SsoAndOAuthButtons","buttons","useLingui","state","dispatch","useGlobalReducer","oauthProviderSettings","useEffectiveAuthConfig","presentation","usePresentation","lastUsedMethod","setLastUsedMethod","useLastUsedAuthMethod","config","useConfig","loginRedirectURL","signupRedirectURL","discoveryRedirectURL","oauthOptions","B2BGoogleOneTap","OAuthB2BButton","SSOButton","useProductComponents","isDiscoveryFlow","flowState","AuthFlowType","Discovery","authButtons","flatMap","button","MainScreenComponent","OAuthButtons","map","provider","SSOButtons","organization","sso_active_connections","connection","assertUnreachable","reorderedButtons","foundLastUsedOAuth","arrayUtils","moveToFront","getButtonKey","createOAuthButton","providerProps","primary","one_tap","React","key","cancelOnTapOutside","cancel_on_tap_outside","providerType","loginRedirectUrl","signupRedirectUrl","discoveryRedirectUrl","onSuccess","ButtonColumn","index","buttonComponent","display_name","onStart","getSsoMethodKey","Button","variant","id","getButtonId","options","onClick","screen","AppScreens","SSODiscoveryEmail","history","LastUsed"],"mappings":";;;;;;;;;;;;;;;;AAiBA;AACO,MAAMA,0BAAAA,GAA6B,CACxCC,aAAAA,EAOAC,wBAAAA,GAAAA;IAEA,IAAIC,mBAAAA,GAAsBF,cAAcG,YAAY;AACpD,IAAA,IAAIC,OAAOC,IAAI,CAACH,mBAAAA,CAAAA,CAAqBI,MAAM,IAAI,CAAA,EAAG;QAChDJ,mBAAAA,GAAsBD,wBAAAA;AACxB,IAAA;IACA,OAAOC,mBAAAA;AACT;AAEO,MAAMK,4BAAAA,GAA+B,CAC1CP,aAAAA,EAOAQ,0BAAAA,EACAC,KAAAA,GAAAA;IAEA,IAAIC,qBAAAA,GAAwBV,cAAcW,cAAc;AACxD,IAAA,IAAIP,OAAOC,IAAI,CAACK,qBAAAA,CAAAA,CAAuBJ,MAAM,IAAI,CAAA,EAAG;AAClDI,QAAAA,qBAAAA,GAAwBF,8BAA8B,EAAC;AACzD,IAAA;AAEA,IAAA,IACEC,UACCT,aAAAA,CAAcY,IAAI,KAAKC,iBAAAA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gCAAAA,MAAAA,EAAQC,WAAWC,iBAAiB;gCAAEC,OAAAA,EAAS;AAAO,6BAAA,CAAA;AACvF,wBAAA;;;;;AAMN,gBAAA;oBACElC,iBAAAA,CAAkBT,CAAAA;AACtB;QACF,CAAA,GAAA;QAEA,OAAOW,kBAAAA,IAAsBkB,KAAAA,KAAU,CAAA,iBACrCV,cAAA,CAAA,aAAA,CAACyB,QAAAA,EAAAA;AAASxB,YAAAA,GAAAA,EAAKN,YAAAA,CAAad,MAAAA;WAAU8B,eAAAA,CAAAA,GAEtCA,eAAAA;AAEJ,IAAA,CAAA,CAAA,CAAA;AAGN;;;;"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
function extractConnectionId(method) {
|
|
5
5
|
return method?.startsWith('sso:') ? method.slice(4) : undefined;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function getButtonKey(button) {
|
|
8
8
|
if (button.type === 'oauth') {
|
|
9
9
|
return button.provider.type;
|
|
10
10
|
} else if (button.type === 'sso') {
|
|
@@ -14,5 +14,5 @@ function getButtonId(button) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export { extractConnectionId,
|
|
17
|
+
export { extractConnectionId, getButtonKey, getSsoMethodKey };
|
|
18
18
|
//# sourceMappingURL=authMethodKeys.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authMethodKeys.mjs","sources":["../../../../../../../../../web/src/ui/b2b/types/authMethodKeys.ts"],"sourcesContent":["import { B2BOAuthProviders, SSOActiveConnection } from '@stytch/core/public';\nimport { OauthProviderParams } from '../hooks/useEffectiveAuthConfig';\n\n// This file contains a combined type to identify OAuth providers and SSO connections,\n// used to help with rendering these buttons and storing the last used method.\n// Extracting the logic for generating the key helps make it more consistent\n\nexport type LastUsedMethod = B2BOAuthProviders | `sso:${string}`;\n\n/* eslint-disable lingui/no-unlocalized-strings */\n\nexport function getSsoMethodKey(method: SSOActiveConnection): LastUsedMethod {\n return `sso:${method.connection_id}`;\n}\n\nexport function extractConnectionId(method: string | null): string | undefined {\n return method?.startsWith('sso:') ? method.slice(4) : undefined;\n}\n\nexport type AuthButton =\n | { type: 'oauth'; provider: OauthProviderParams }\n | { type: 'sso'; connection: SSOActiveConnection }\n | { type: 'sso-discovery' };\n\nexport function
|
|
1
|
+
{"version":3,"file":"authMethodKeys.mjs","sources":["../../../../../../../../../web/src/ui/b2b/types/authMethodKeys.ts"],"sourcesContent":["import { B2BOAuthProviders, SSOActiveConnection } from '@stytch/core/public';\nimport { OauthProviderParams } from '../hooks/useEffectiveAuthConfig';\n\n// This file contains a combined type to identify OAuth providers and SSO connections,\n// used to help with rendering these buttons and storing the last used method.\n// Extracting the logic for generating the key helps make it more consistent\n\nexport type LastUsedMethod = B2BOAuthProviders | `sso:${string}`;\n\n/* eslint-disable lingui/no-unlocalized-strings */\n\nexport function getSsoMethodKey(method: SSOActiveConnection): LastUsedMethod {\n return `sso:${method.connection_id}`;\n}\n\nexport function extractConnectionId(method: string | null): string | undefined {\n return method?.startsWith('sso:') ? method.slice(4) : undefined;\n}\n\nexport type AuthButton =\n | { type: 'oauth'; provider: OauthProviderParams }\n | { type: 'sso'; connection: SSOActiveConnection }\n | { type: 'sso-discovery' };\n\nexport function getButtonKey(button: AuthButton) {\n if (button.type === 'oauth') {\n return button.provider.type;\n } else if (button.type === 'sso') {\n return getSsoMethodKey(button.connection);\n } else {\n return 'sso-discovery';\n }\n}\n"],"names":["getSsoMethodKey","method","connection_id","extractConnectionId","startsWith","slice","undefined","getButtonKey","button","type","provider","connection"],"mappings":"AASA,mDAEO,SAASA,eAAAA,CAAgBC,MAA2B,EAAA;AACzD,IAAA,OAAO,CAAC,IAAI,EAAEA,MAAAA,CAAOC,aAAa,CAAA,CAAE;AACtC;AAEO,SAASC,oBAAoBF,MAAqB,EAAA;AACvD,IAAA,OAAOA,QAAQG,UAAAA,CAAW,MAAA,CAAA,GAAUH,MAAAA,CAAOI,KAAK,CAAC,CAAA,CAAA,GAAKC,SAAAA;AACxD;AAOO,SAASC,aAAaC,MAAkB,EAAA;IAC7C,IAAIA,MAAAA,CAAOC,IAAI,KAAK,OAAA,EAAS;QAC3B,OAAOD,MAAAA,CAAOE,QAAQ,CAACD,IAAI;AAC7B,IAAA,CAAA,MAAO,IAAID,MAAAA,CAAOC,IAAI,KAAK,KAAA,EAAO;QAChC,OAAOT,eAAAA,CAAgBQ,OAAOG,UAAU,CAAA;IAC1C,CAAA,MAAO;QACL,OAAO,eAAA;AACT,IAAA;AACF;;;;"}
|
|
@@ -6,7 +6,7 @@ import AppContainer$1 from './Container.mjs';
|
|
|
6
6
|
import { readB2CInternals } from '../../utils/internal.mjs';
|
|
7
7
|
import { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig.mjs';
|
|
8
8
|
|
|
9
|
-
const AppContainer = ({ client, config, presentation, callbacks, strings })=>{
|
|
9
|
+
const AppContainer = ({ client, config, presentation, callbacks, strings, styles })=>{
|
|
10
10
|
// Read the watermark out of sync storage, then read it out of async storage
|
|
11
11
|
const [displayWatermark, setDisplayWatermark] = useState(()=>{
|
|
12
12
|
const { displayWatermark } = readB2CInternals(client).bootstrap.getSync();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/AppContainer.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { messages } from '../../messages/en';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { GlobalContextProvider } from './GlobalContextProvider';\nimport Container from './Container';\nimport { SDKConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig';\n\nexport const AppContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n config,\n presentation,\n callbacks,\n strings,\n}: SDKConfig<TProjectConfiguration>) => {\n // Read the watermark out of sync storage, then read it out of async storage\n const [displayWatermark, setDisplayWatermark] = useState(() => {\n const { displayWatermark } = readB2CInternals(client).bootstrap.getSync();\n return displayWatermark;\n });\n useEffect(() => {\n readB2CInternals(client)\n .bootstrap.getAsync()\n .then((data) => {\n readB2CInternals(client).networkClient.logEvent({\n name: 'render_login_screen',\n details: { options: config, bootstrap: data },\n });\n setDisplayWatermark(data.displayWatermark);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- SDK-1354\n }, [client]);\n\n const presentationValue = usePresentationWithDefault(presentation, displayWatermark, config.products, 'Products');\n\n return (\n <GlobalContextProvider client={client} config={config} callbacks={callbacks}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <Container />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </GlobalContextProvider>\n );\n};\n"],"names":["AppContainer","client","config","presentation","callbacks","strings","displayWatermark","setDisplayWatermark","useState","readB2CInternals","bootstrap","getSync","useEffect","getAsync","then","data","networkClient","logEvent","name","details","options","presentationValue","usePresentationWithDefault","products","React","GlobalContextProvider","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","Container"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"AppContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/AppContainer.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { messages } from '../../messages/en';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { GlobalContextProvider } from './GlobalContextProvider';\nimport Container from './Container';\nimport { DeprecatedSDKConfig, SDKConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig';\nimport { logger, RUN_IN_DEV } from '@stytch/core';\n\nexport const AppContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n config,\n presentation,\n callbacks,\n strings,\n styles,\n}: SDKConfig<TProjectConfiguration> & DeprecatedSDKConfig) => {\n // Read the watermark out of sync storage, then read it out of async storage\n const [displayWatermark, setDisplayWatermark] = useState(() => {\n const { displayWatermark } = readB2CInternals(client).bootstrap.getSync();\n return displayWatermark;\n });\n\n useEffect(() => {\n readB2CInternals(client)\n .bootstrap.getAsync()\n .then((data) => {\n readB2CInternals(client).networkClient.logEvent({\n name: 'render_login_screen',\n details: { options: config, bootstrap: data },\n });\n setDisplayWatermark(data.displayWatermark);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- SDK-1354\n }, [client]);\n\n RUN_IN_DEV(() => {\n if (styles) {\n logger.error(\n 'styles is deprecated and has no effect. Use the presentation prop instead.\\n' +\n 'See https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/upgrade-guide#step-by-step-guide',\n );\n }\n });\n\n const presentationValue = usePresentationWithDefault(presentation, displayWatermark, config.products, 'Products');\n\n return (\n <GlobalContextProvider client={client} config={config} callbacks={callbacks}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <Container />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </GlobalContextProvider>\n );\n};\n"],"names":["AppContainer","client","config","presentation","callbacks","strings","styles","displayWatermark","setDisplayWatermark","useState","readB2CInternals","bootstrap","getSync","useEffect","getAsync","then","data","networkClient","logEvent","name","details","options","presentationValue","usePresentationWithDefault","products","React","GlobalContextProvider","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","Container"],"mappings":";;;;;;;;MAWaA,YAAAA,GAAe,CAAgE,EAC1FC,MAAM,EACNC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,MAAM,EACiD,GAAA;;AAEvD,IAAA,MAAM,CAACC,gBAAAA,EAAkBC,mBAAAA,CAAoB,GAAGC,QAAAA,CAAS,IAAA;QACvD,MAAM,EAAEF,gBAAgB,EAAE,GAAGG,iBAAiBT,MAAAA,CAAAA,CAAQU,SAAS,CAACC,OAAO,EAAA;QACvE,OAAOL,gBAAAA;AACT,IAAA,CAAA,CAAA;IAEAM,SAAAA,CAAU,IAAA;AACRH,QAAAA,gBAAAA,CAAiBT,QACdU,SAAS,CAACG,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAACC,IAAAA,GAAAA;AACLN,YAAAA,gBAAAA,CAAiBT,MAAAA,CAAAA,CAAQgB,aAAa,CAACC,QAAQ,CAAC;gBAC9CC,IAAAA,EAAM,qBAAA;gBACNC,OAAAA,EAAS;oBAAEC,OAAAA,EAASnB,MAAAA;oBAAQS,SAAAA,EAAWK;AAAK;AAC9C,aAAA,CAAA;AACAR,YAAAA,mBAAAA,CAAoBQ,KAAKT,gBAAgB,CAAA;AAC3C,QAAA,CAAA,CAAA;;KAEJ,EAAG;AAACN,QAAAA;AAAO,KAAA,CAAA;AAWX,IAAA,MAAMqB,oBAAoBC,0BAAAA,CAA2BpB,YAAAA,EAAcI,gBAAAA,EAAkBL,MAAAA,CAAOsB,QAAU,CAAA;AAEtG,IAAA,qBACEC,cAAA,CAAA,aAAA,CAACC,qBAAAA,EAAAA;QAAsBzB,MAAAA,EAAQA,MAAAA;QAAQC,MAAAA,EAAQA,MAAAA;QAAQE,SAAAA,EAAWA;AAChE,KAAA,gBAAAqB,cAAA,CAAA,aAAA,CAACE,oBAAoBC,QAAQ,EAAA;QAACC,KAAAA,EAAOP;qBACnCG,cAAA,CAAA,aAAA,CAACK,mBAAAA,EAAAA;QAAoBC,QAAAA,EAAUA,QAAAA;QAAUC,SAAAA,EAAW3B;qBAClDoB,cAAA,CAAA,aAAA,CAACQ,cAAAA,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAKX;;;;"}
|
|
@@ -7,7 +7,7 @@ import { IDPContextProvider } from '../components/organisms/IDPContextProvider.m
|
|
|
7
7
|
import { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig.mjs';
|
|
8
8
|
import { IDPConsentScreen } from './screens/IdentityProvider/IDPConsent.mjs';
|
|
9
9
|
|
|
10
|
-
const IDPContainer = ({ client, presentation, callbacks, strings, getIDPConsentManifest, authTokenParams })=>{
|
|
10
|
+
const IDPContainer = ({ client, presentation, callbacks, strings, styles, getIDPConsentManifest, authTokenParams })=>{
|
|
11
11
|
const presentationValue = usePresentationWithDefault(presentation, false, []);
|
|
12
12
|
useEffect(()=>{
|
|
13
13
|
readB2CInternals(client).bootstrap.getAsync().then((data)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDPContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/IDPContainer.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { messages } from '../../messages/en';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { GlobalContextProvider, DEFAULT_STATE } from './GlobalContextProvider';\nimport { IDPSDKConfig, StytchLoginConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { IDPContextProvider } from '../components/organisms/IDPContextProvider';\nimport { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig';\nimport { IDPConsentScreen } from './screens/IdentityProvider/IDPConsent';\n\nexport const IDPContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n presentation,\n callbacks,\n strings,\n getIDPConsentManifest,\n authTokenParams,\n}: IDPSDKConfig<TProjectConfiguration>) => {\n const presentationValue = usePresentationWithDefault(presentation, false, []);\n\n useEffect(() => {\n readB2CInternals(client)\n .bootstrap.getAsync()\n .then((data) => {\n readB2CInternals(client).networkClient.logEvent({\n name: 'render_idp_screen',\n details: { bootstrap: data },\n });\n });\n }, [client]);\n\n return (\n <GlobalContextProvider\n client={client}\n config={{} as StytchLoginConfig}\n callbacks={callbacks}\n initialState={DEFAULT_STATE}\n >\n <IDPContextProvider consentManifestGenerator={getIDPConsentManifest} authTokenParams={authTokenParams}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <IDPConsentScreen />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </IDPContextProvider>\n </GlobalContextProvider>\n );\n};\n"],"names":["IDPContainer","client","presentation","callbacks","strings","getIDPConsentManifest","authTokenParams","presentationValue","usePresentationWithDefault","useEffect","readB2CInternals","bootstrap","getAsync","then","data","networkClient","logEvent","name","details","React","GlobalContextProvider","config","initialState","DEFAULT_STATE","IDPContextProvider","consentManifestGenerator","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","IDPConsentScreen"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"IDPContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/IDPContainer.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { messages } from '../../messages/en';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { GlobalContextProvider, DEFAULT_STATE } from './GlobalContextProvider';\nimport { IDPSDKConfig, StytchLoginConfig, DeprecatedSDKConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { IDPContextProvider } from '../components/organisms/IDPContextProvider';\nimport { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig';\nimport { IDPConsentScreen } from './screens/IdentityProvider/IDPConsent';\nimport { logger, RUN_IN_DEV } from '@stytch/core';\n\nexport const IDPContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n presentation,\n callbacks,\n strings,\n styles,\n getIDPConsentManifest,\n authTokenParams,\n}: IDPSDKConfig<TProjectConfiguration> & DeprecatedSDKConfig) => {\n const presentationValue = usePresentationWithDefault(presentation, false, []);\n\n useEffect(() => {\n readB2CInternals(client)\n .bootstrap.getAsync()\n .then((data) => {\n readB2CInternals(client).networkClient.logEvent({\n name: 'render_idp_screen',\n details: { bootstrap: data },\n });\n });\n }, [client]);\n\n RUN_IN_DEV(() => {\n if (styles) {\n logger.error(\n 'styles is deprecated and has no effect. Use the presentation prop instead.\\n' +\n 'See https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/upgrade-guide#step-by-step-guide',\n );\n }\n });\n\n return (\n <GlobalContextProvider\n client={client}\n config={{} as StytchLoginConfig}\n callbacks={callbacks}\n initialState={DEFAULT_STATE}\n >\n <IDPContextProvider consentManifestGenerator={getIDPConsentManifest} authTokenParams={authTokenParams}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <IDPConsentScreen />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </IDPContextProvider>\n </GlobalContextProvider>\n );\n};\n"],"names":["IDPContainer","client","presentation","callbacks","strings","styles","getIDPConsentManifest","authTokenParams","presentationValue","usePresentationWithDefault","useEffect","readB2CInternals","bootstrap","getAsync","then","data","networkClient","logEvent","name","details","React","GlobalContextProvider","config","initialState","DEFAULT_STATE","IDPContextProvider","consentManifestGenerator","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","IDPConsentScreen"],"mappings":";;;;;;;;;MAYaA,YAAAA,GAAe,CAAgE,EAC1FC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,qBAAqB,EACrBC,eAAe,EAC2C,GAAA;AAC1D,IAAA,MAAMC,iBAAAA,GAAoBC,0BAAAA,CAA2BP,YAAAA,EAAc,KAAA,EAAO,EAAE,CAAA;IAE5EQ,SAAAA,CAAU,IAAA;AACRC,QAAAA,gBAAAA,CAAiBV,QACdW,SAAS,CAACC,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAACC,IAAAA,GAAAA;AACLJ,YAAAA,gBAAAA,CAAiBV,MAAAA,CAAAA,CAAQe,aAAa,CAACC,QAAQ,CAAC;gBAC9CC,IAAAA,EAAM,mBAAA;gBACNC,OAAAA,EAAS;oBAAEP,SAAAA,EAAWG;AAAK;AAC7B,aAAA,CAAA;AACF,QAAA,CAAA,CAAA;KACJ,EAAG;AAACd,QAAAA;AAAO,KAAA,CAAA;AAWX,IAAA,qBACEmB,cAAA,CAAA,aAAA,CAACC,qBAAAA,EAAAA;QACCpB,MAAAA,EAAQA,MAAAA;AACRqB,QAAAA,MAAAA,EAAQ,EAAC;QACTnB,SAAAA,EAAWA,SAAAA;QACXoB,YAAAA,EAAcC;qBAEdJ,cAAA,CAAA,aAAA,CAACK,kBAAAA,EAAAA;QAAmBC,wBAAAA,EAA0BpB,qBAAAA;QAAuBC,eAAAA,EAAiBA;AACpF,KAAA,gBAAAa,cAAA,CAAA,aAAA,CAACO,oBAAoBC,QAAQ,EAAA;QAACC,KAAAA,EAAOrB;qBACnCY,cAAA,CAAA,aAAA,CAACU,mBAAAA,EAAAA;QAAoBC,QAAAA,EAAUA,QAAAA;QAAUC,SAAAA,EAAW5B;qBAClDgB,cAAA,CAAA,aAAA,CAACa,gBAAAA,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAMb;;;;"}
|
|
@@ -8,7 +8,7 @@ import { usePresentationWithDefault, PresentationContext } from '../components/P
|
|
|
8
8
|
import { passkeyRegistration } from './Products.mjs';
|
|
9
9
|
import { addProduct } from './utils.mjs';
|
|
10
10
|
|
|
11
|
-
const PasskeyRegistrationContainer = ({ client, config: rawConfig, presentation, callbacks, strings })=>{
|
|
11
|
+
const PasskeyRegistrationContainer = ({ client, config: rawConfig, presentation, callbacks, strings, styles })=>{
|
|
12
12
|
const config = addProduct(rawConfig, passkeyRegistration);
|
|
13
13
|
/**
|
|
14
14
|
* Read the watermark out of sync storage, then read it out of async storage
|