@stytch/react 20.0.0-next.3 → 20.0.0-next.5

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/b2b/index.cjs +15 -8
  3. package/dist/cjs/b2b/index.cjs.map +1 -1
  4. package/dist/cjs/index.cjs +45 -56
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/{shadcn-Z4AvHriT.js → shadcn-aVU6Lm9q.js} +9 -3
  7. package/dist/cjs/shadcn-aVU6Lm9q.js.map +1 -0
  8. package/dist/cjs-dev/b2b/index.cjs +15 -8
  9. package/dist/cjs-dev/b2b/index.cjs.map +1 -1
  10. package/dist/cjs-dev/index.cjs +45 -56
  11. package/dist/cjs-dev/index.cjs.map +1 -1
  12. package/dist/cjs-dev/{shadcn-DnNfms7-.js → shadcn-DMk6ZSoD.js} +9 -3
  13. package/dist/cjs-dev/shadcn-DMk6ZSoD.js.map +1 -0
  14. package/dist/esm/_virtual/index3.mjs +5 -3
  15. package/dist/esm/_virtual/index3.mjs.map +1 -1
  16. package/dist/esm/_virtual/index4.mjs +3 -5
  17. package/dist/esm/_virtual/index4.mjs.map +1 -1
  18. package/dist/esm/packages/web/src/adminPortal/utils/theme.mjs +1 -1
  19. package/dist/esm/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs +6 -3
  20. package/dist/esm/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs.map +1 -1
  21. package/dist/esm/packages/web/src/ui/b2b/components/SSOButton.mjs +5 -3
  22. package/dist/esm/packages/web/src/ui/b2b/components/SSOButton.mjs.map +1 -1
  23. package/dist/esm/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs +6 -3
  24. package/dist/esm/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs.map +1 -1
  25. package/dist/esm/packages/web/src/ui/b2b/types/authMethodKeys.mjs +2 -2
  26. package/dist/esm/packages/web/src/ui/b2b/types/authMethodKeys.mjs.map +1 -1
  27. package/dist/esm/packages/web/src/ui/b2c/components/OAuthButton.mjs +6 -3
  28. package/dist/esm/packages/web/src/ui/b2c/components/OAuthButton.mjs.map +1 -1
  29. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +20 -40
  30. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
  31. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +7 -5
  32. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
  33. package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs +6 -1
  34. package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
  35. package/dist/esm/packages/web/src/ui/components/atoms/Button.mjs.map +1 -1
  36. package/dist/esm/packages/web/src/ui/components/molecules/EmailInput.mjs +1 -1
  37. package/dist/esm/packages/web/src/ui/components/molecules/EmailInput.mjs.map +1 -1
  38. package/dist/esm/packages/web/src/ui/components/molecules/Input.mjs +1 -1
  39. package/dist/esm/packages/web/src/ui/components/molecules/Input.mjs.map +1 -1
  40. package/dist/esm/packages/web/src/utils/crypto.mjs +12 -8
  41. package/dist/esm/packages/web/src/utils/crypto.mjs.map +1 -1
  42. package/dist/esm-dev/_virtual/index3.mjs +3 -5
  43. package/dist/esm-dev/_virtual/index3.mjs.map +1 -1
  44. package/dist/esm-dev/_virtual/index4.mjs +5 -3
  45. package/dist/esm-dev/_virtual/index4.mjs.map +1 -1
  46. package/dist/esm-dev/packages/web/src/adminPortal/utils/theme.mjs +1 -1
  47. package/dist/esm-dev/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs +6 -3
  48. package/dist/esm-dev/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs.map +1 -1
  49. package/dist/esm-dev/packages/web/src/ui/b2b/components/SSOButton.mjs +5 -3
  50. package/dist/esm-dev/packages/web/src/ui/b2b/components/SSOButton.mjs.map +1 -1
  51. package/dist/esm-dev/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs +6 -3
  52. package/dist/esm-dev/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs.map +1 -1
  53. package/dist/esm-dev/packages/web/src/ui/b2b/types/authMethodKeys.mjs +2 -2
  54. package/dist/esm-dev/packages/web/src/ui/b2b/types/authMethodKeys.mjs.map +1 -1
  55. package/dist/esm-dev/packages/web/src/ui/b2c/components/OAuthButton.mjs +6 -3
  56. package/dist/esm-dev/packages/web/src/ui/b2c/components/OAuthButton.mjs.map +1 -1
  57. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +20 -40
  58. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
  59. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +7 -5
  60. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
  61. package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs +6 -1
  62. package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
  63. package/dist/esm-dev/packages/web/src/ui/components/atoms/Button.mjs.map +1 -1
  64. package/dist/esm-dev/packages/web/src/ui/components/molecules/EmailInput.mjs +1 -1
  65. package/dist/esm-dev/packages/web/src/ui/components/molecules/EmailInput.mjs.map +1 -1
  66. package/dist/esm-dev/packages/web/src/ui/components/molecules/Input.mjs +1 -1
  67. package/dist/esm-dev/packages/web/src/ui/components/molecules/Input.mjs.map +1 -1
  68. package/dist/esm-dev/packages/web/src/utils/crypto.mjs +12 -8
  69. package/dist/esm-dev/packages/web/src/utils/crypto.mjs.map +1 -1
  70. package/dist/types/{PresentationConfig-CcNEXkjS.d.ts → PresentationConfig-B2jX85oV.d.ts} +8 -1
  71. package/dist/types/b2b/index.d.ts +3 -3
  72. package/dist/types/compat.d.ts +1 -1
  73. package/dist/types/index.d.ts +3 -3
  74. package/dist/types/{shadcn-B04UXoBD.d.ts → shadcn-CGdmyIUF.d.ts} +1 -1
  75. package/package.json +1 -1
  76. package/dist/cjs/shadcn-Z4AvHriT.js.map +0 -1
  77. package/dist/cjs-dev/shadcn-DnNfms7-.js.map +0 -1
@@ -1,6 +1,8 @@
1
- import { __require as requireBs58 } from '../node_modules/bs58/index.mjs';
1
+ import { getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
2
+ import { __require as requireLodash_merge } from '../node_modules/lodash.merge/index.mjs';
2
3
 
3
- var bs58Exports = requireBs58();
4
+ var lodash_mergeExports = requireLodash_merge();
5
+ var merge = /*@__PURE__*/getDefaultExportFromCjs(lodash_mergeExports);
4
6
 
5
- export { bs58Exports as b };
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 { getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
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 lodash_mergeExports = requireLodash_merge();
5
- var merge = /*@__PURE__*/getDefaultExportFromCjs(lodash_mergeExports);
3
+ var bs58Exports = requireBs58();
6
4
 
7
- export { merge as default };
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":";;;;;;"}
@@ -1,4 +1,4 @@
1
- import merge from '../../../../../_virtual/index4.mjs';
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';
@@ -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 iconRegistry = usePresentation().iconRegistry;
44
+ const presentation = usePresentation();
45
+ const iconRegistry = presentation.iconRegistry;
46
+ const id = getButtonId(`oauth-${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> = usePresentation().iconRegistry;\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}>\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","iconRegistry","usePresentation","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,iBAAAA,CAAkBM,MAAM,GAAG;QAC1BJ,iBAAiB,EAAA;;;;AACnB;AACF,CAAA;MAYaK,cAAAA,GAAiB,CAAC,EAC7BC,YAAY,EACZC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,YAAY,EACZC,cAAc,EACdC,SAAS,EACW,GAAA;AACpB,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GA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A;AAEAC,QAAAA,SAAAA,IAAAA;AACF,IAAA,CAAA;AAEA,IAAA,qBACEY,cAAA,CAAA,aAAA,CAACc,MAAAA,EAAAA;QAAOC,OAAAA,EAASd,aAAAA;QAAee,OAAAA,EAAQ,SAAA;QAAUlB,IAAAA,EAAMA;AACrDD,KAAAA,EAAAA,KAAAA,CAAAA;AAGP;;;;"}
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(`oauth-${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,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0B,QAAAA,IAAAA,iBAAOE,cAAA,CAAA,aAAA,CAACD,IAAAA,EAAAA,IAAAA,CAAAA;AACV,IAAA;AAEA,IAAA,MAAME,aAAAA,GAAgB,UAAA;AACpB,QAAA,MAAMC,cAAAA,GAAiBhB,YAAAA,CAAaiB,KAAK,CAACzB,YAAAA,CAAa;AAEvD,QAAA,IAAIU,KAAAA,CAAMgB,SAAS,CAACC,YAAY,EAAE;YAChC,MAAMH,cAAAA,CAAeI,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;IACvB,MAAM,EAAEC,YAAY,EAAE,GAAGC,eAAAA,EAAAA;AAEzB,IAAA,MAAM,EAAEC,aAAa,EAAEC,YAAY,EAAEC,iBAAiB,EAAE,GAAGX,UAAAA;AAE3D,IAAA,MAAMY,gBAAgB,IACpBT,YAAAA,CAAaU,GAAG,CACbC,KAAK,CAAC;AACLL,YAAAA,aAAAA;AACAM,YAAAA,mBAAAA,EAAqBV,UAAAA,EAAYW,iBAAAA;AACjCC,YAAAA,kBAAAA,EAAoBZ,UAAAA,EAAYa;AAClC,SAAA,CAAA,CACCC,IAAI,CAAC,IAAA;YACJlB,OAAAA,GAAUD,UAAAA,CAAAA;AACZ,QAAA,CAAA,CAAA;IAEJ,MAAMoB,QAAAA,GAAWvB,OAAO,CAACc,iBAAAA,CAAkB;AAC3C,IAAA,MAAMU,IAAAA,GAAOd,YAAY,CAACa,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;;;;;AACKX,YAAAA,YAAAA,EAAAA;;;AAGlE;;;;"}
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 { getButtonId, getSsoMethodKey } from '../types/authMethodKeys.mjs';
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)=>getButtonId(button) === lastUsedMethod);
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: getButtonId(button)
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,EAAC;AACzD,IAAA;AAEA,IAAA,IACEC,UACCT,aAAAA,CAAcY,IAAI,KAAKC,iBAAAA,CAAkBC,MAAM,IAAId,aAAAA,CAAcY,IAAI,KAAKC,iBAAAA,CAAkBE,SAAS,CAAD,IACrG,EAAE,YAAA,IAAgBL,qBAAoB,CAAA,EACtC;QACAA,qBAAAA,GAAwB;AACtB,YAAA,GAAGA,qBAAqB;YACxBM,UAAAA,EAAYP;AACd,SAAA;AACF,IAAA;IAEA,OAAOC,qBAAAA;AACT;AAEO,MAAMO,kBAAAA,GAAqB,CAAC,EAAEC,OAAO,EAAkC,GAAA;AAC5E,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;IACd,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,gBAAAA,EAAAA;AAC1B,IAAA,MAAM,EAAEC,qBAAAA,GAAwB,EAAE,EAAE,GAAG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;gBACjB,KAAK,OAAA;oBACH,OAAO+C,iBAAAA,CAAkBf,OAAOI,QAAQ,CAAA;gBAE1C,KAAK,KAAA;AACH,oBAAA,qBACEe,cAAA,CAAA,aAAA,CAAC3B,SAAAA,EAAAA;wBACC4B,GAAAA,EAAKpB,MAAAA,CAAOQ,UAAU,CAACuB,YAAY;AACnCvB,wBAAAA,UAAAA,EAAYR,OAAOQ,UAAU;AAC7BwB,wBAAAA,OAAAA,EAAS,IAAMlD,iBAAAA,CAAkBmD,eAAAA,CAAgBjC,MAAAA,CAAOQ,UAAU,CAAA;;gBAIxE,KAAK,eAAA;AACH,oBAAA,qBACEW,cAAA,CAAA,aAAA,CAACe,MAAAA,EAAAA;wBACCd,GAAAA,EAAI,eAAA;wBACJe,OAAAA,EAAQ,SAAA;wBACRC,OAAAA,EAAS,IAAA;4BACP3D,QAAAA,CAAS;gCAAET,IAAAA,EAAM,YAAA;AAAcqE,gCAAAA,MAAAA,EAAQC,WAAWC,iBAAiB;gCAAEC,OAAAA,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":";;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BAAAA,CAAkBf,OAAOI,QAAQ,CAAA;gBAE1C,KAAK,KAAA;AACH,oBAAA,qBACEe,cAAA,CAAA,aAAA,CAAC3B,SAAAA,EAAAA;wBACC4B,GAAAA,EAAKpB,MAAAA,CAAOQ,UAAU,CAACuB,YAAY;AACnCvB,wBAAAA,UAAAA,EAAYR,OAAOQ,UAAU;AAC7BwB,wBAAAA,OAAAA,EAAS,IAAMlD,iBAAAA,CAAkBmD,eAAAA,CAAgBjC,MAAAA,CAAOQ,UAAU,CAAA;;gBAIxE,KAAK,eAAA;AACH,oBAAA,qBACEW,cAAA,CAAA,aAAA,CAACe,MAAAA,EAAAA;wBACCd,GAAAA,EAAI,eAAA;wBACJe,OAAAA,EAAQ,SAAA;wBACRC,EAAAA,EAAIC,WAAAA,CAAY,eAAA,EAAiB1D,YAAAA,CAAa2D,OAAO,CAAA;wBACrDC,OAAAA,EAAS,IAAA;4BACPhE,QAAAA,CAAS;gCAAET,IAAAA,EAAM,YAAA;AAAc0E,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 getButtonId(button) {
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, getButtonId, getSsoMethodKey };
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 getButtonId(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","getButtonId","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,YAAYC,MAAkB,EAAA;IAC5C,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;;;;"}
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;;;;"}
@@ -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 } 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 { OAuthProviders } from '../../../../../core/src/public/ui.mjs';
7
7
 
8
8
  const providerInfo = {
@@ -124,7 +124,9 @@ const providerInfo = {
124
124
  const OAuthButton = ({ providerType, loginRedirectUrl, signupRedirectUrl, customScopes, providerParams, onSuccess })=>{
125
125
  const { i18n: $__i18n, _: $__ } = useLingui();
126
126
  const stytchClient = useStytch();
127
- const iconRegistry = usePresentation().iconRegistry;
127
+ const presentation = usePresentation();
128
+ const iconRegistry = presentation.iconRegistry;
129
+ const id = getButtonId(`oauth-${providerType}`, presentation.options);
128
130
  const provider = providerInfo[providerType];
129
131
  let label = providerType;
130
132
  let icon = null;
@@ -147,7 +149,8 @@ const OAuthButton = ({ providerType, loginRedirectUrl, signupRedirectUrl, custom
147
149
  return /*#__PURE__*/ React__default.createElement(Button, {
148
150
  onClick: onButtonClick,
149
151
  variant: "outline",
150
- icon: icon
152
+ icon: icon,
153
+ id: id
151
154
  }, label);
152
155
  };
153
156
 
@@ -1 +1 @@
1
- {"version":3,"file":"OAuthButton.mjs","sources":["../../../../../../../../../web/src/ui/b2c/components/OAuthButton.tsx"],"sourcesContent":["import React from 'react';\nimport { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { StringLiteralFromEnum } from '@stytch/core';\nimport { OAuthProviders } from '@stytch/core/public';\nimport { useStytch } from '../GlobalContextProvider';\nimport Button from '../../components/atoms/Button';\nimport { usePresentation } from '../../components/PresentationConfig';\nimport type { oauthIcons } from './Icons';\nimport { IconRegistry } from '../../components/IconRegistry';\n\ninterface ProviderInfo {\n messageDescriptor: MessageDescriptor;\n}\n\nconst providerInfo = {\n [OAuthProviders.Google]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGoogle', message: 'Continue with Google' }),\n },\n [OAuthProviders.Microsoft]: {\n messageDescriptor: msg({ id: 'oauth.continueWithMicrosoft', message: 'Continue with Microsoft' }),\n },\n [OAuthProviders.Apple]: {\n messageDescriptor: msg({ id: 'oauth.continueWithApple', message: 'Continue with Apple' }),\n },\n [OAuthProviders.Github]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGitHub', message: 'Continue with GitHub' }),\n },\n [OAuthProviders.GitLab]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGitLab', message: 'Continue with GitLab' }),\n },\n [OAuthProviders.Facebook]: {\n messageDescriptor: msg({ id: 'oauth.continueWithFacebook', message: 'Continue with Facebook' }),\n },\n [OAuthProviders.Discord]: {\n messageDescriptor: msg({ id: 'oauth.continueWithDiscord', message: 'Continue with Discord' }),\n },\n [OAuthProviders.Salesforce]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSalesforce', message: 'Continue with Salesforce' }),\n },\n [OAuthProviders.Slack]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSlack', message: 'Continue with Slack' }),\n },\n [OAuthProviders.Amazon]: {\n messageDescriptor: msg({ id: 'oauth.continueWithAmazon', message: 'Continue with Amazon' }),\n },\n [OAuthProviders.Bitbucket]: {\n messageDescriptor: msg({ id: 'oauth.continueWithBitbucket', message: 'Continue with Bitbucket' }),\n },\n [OAuthProviders.LinkedIn]: {\n messageDescriptor: msg({ id: 'oauth.continueWithLinkedIn', message: 'Continue with LinkedIn' }),\n },\n [OAuthProviders.Coinbase]: {\n messageDescriptor: msg({ id: 'oauth.continueWithCoinbase', message: 'Continue with Coinbase' }),\n },\n [OAuthProviders.Twitch]: {\n messageDescriptor: msg({ id: 'oauth.continueWithTwitch', message: 'Continue with Twitch' }),\n },\n [OAuthProviders.Twitter]: {\n messageDescriptor: msg({ id: 'oauth.continueWithX', message: 'Continue with X' }),\n },\n [OAuthProviders.TikTok]: {\n messageDescriptor: msg({ id: 'oauth.continueWithTikTok', message: 'Continue with TikTok' }),\n },\n [OAuthProviders.Snapchat]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSnapchat', message: 'Continue with Snapchat' }),\n },\n [OAuthProviders.Figma]: {\n messageDescriptor: msg({ id: 'oauth.continueWithFigma', message: 'Continue with Figma' }),\n },\n [OAuthProviders.Yahoo]: {\n messageDescriptor: msg({ id: 'oauth.continueWithYahoo', message: 'Continue with Yahoo' }),\n },\n} satisfies Record<OAuthProviders, ProviderInfo>;\n\ntype Props = {\n providerType: StringLiteralFromEnum<OAuthProviders>;\n loginRedirectUrl?: string;\n signupRedirectUrl?: string;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n onSuccess?: () => void;\n};\n\nexport const OAuthButton = ({\n providerType,\n loginRedirectUrl,\n signupRedirectUrl,\n customScopes,\n providerParams,\n onSuccess,\n}: Props) => {\n const { t } = useLingui();\n const stytchClient = useStytch();\n const iconRegistry: IconRegistry<keyof typeof oauthIcons> = usePresentation().iconRegistry;\n\n const provider = providerInfo[providerType];\n let label: string = providerType;\n let icon = null;\n if (provider) {\n const { messageDescriptor } = provider;\n\n const iconName = providerType === 'twitter' ? 'xTwitter' : providerType;\n const Icon = iconRegistry[iconName];\n\n label = t(messageDescriptor);\n icon = <Icon />;\n }\n\n const onButtonClick = async () => {\n await stytchClient.oauth[providerType].start({\n login_redirect_url: loginRedirectUrl,\n signup_redirect_url: signupRedirectUrl,\n custom_scopes: customScopes,\n provider_params: providerParams,\n });\n onSuccess?.();\n };\n\n return (\n <Button onClick={onButtonClick} variant=\"outline\" icon={icon}>\n {label}\n </Button>\n );\n};\n"],"names":["providerInfo","OAuthProviders","Google","messageDescriptor","Microsoft","Apple","Github","GitLab","Facebook","Discord","Salesforce","Slack","Amazon","Bitbucket","LinkedIn","Coinbase","Twitch","Twitter","TikTok","Snapchat","Figma","Yahoo","OAuthButton","providerType","loginRedirectUrl","signupRedirectUrl","customScopes","providerParams","onSuccess","useLingui","stytchClient","useStytch","iconRegistry","usePresentation","provider","label","icon","iconName","Icon","React","onButtonClick","oauth","start","login_redirect_url","signup_redirect_url","custom_scopes","provider_params","Button","onClick","variant"],"mappings":";;;;;;;AAgBA,MAAMA,YAAAA,GAAe;IACnB,CAACC,cAAAA,CAAeC,MAAM,GAAG;QACvBC,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeG,SAAS,GAAG;QAC1BD,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeI,KAAK,GAAG;QACtBF,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeK,MAAM,GAAG;QACvBH,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeM,MAAM,GAAG;QACvBJ,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeO,QAAQ,GAAG;QACzBL,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeQ,OAAO,GAAG;QACxBN,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeS,UAAU,GAAG;QAC3BP,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,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;AACpB,IAAA,IAAIa,IAAAA,GAAO,IAAA;AACX,IAAA,IAAIF,QAAAA,EAAU;QACZ,MAAM,EAAE/B,iBAAiB,EAAE,GAAG+B,QAAAA;QAE9B,MAAMG,QAAAA,GAAWd,YAAAA,KAAiB,SAAA,GAAY,UAAA,GAAaA,YAAAA;QAC3D,MAAMe,IAAAA,GAAON,YAAY,CAACK,QAAAA,CAAS;QAEnCF,KAAAA,GAAAA,OAAAA,CAAAA,CAAAA,CAAUhC,iBAAAA,CAAAA;AACViC,QAAAA,IAAAA,iBAAOG,cAAA,CAAA,aAAA,CAACD,IAAAA,EAAAA,IAAAA,CAAAA;AACV,IAAA;AAEA,IAAA,MAAME,aAAAA,GAAgB,UAAA;AACpB,QAAA,MAAMV,aAAaW,KAAK,CAAClB,YAAAA,CAAa,CAACmB,KAAK,CAAC;YAC3CC,kBAAAA,EAAoBnB,gBAAAA;YACpBoB,mBAAAA,EAAqBnB,iBAAAA;YACrBoB,aAAAA,EAAenB,YAAAA;YACfoB,eAAAA,EAAiBnB;AACnB,SAAA,CAAA;AACAC,QAAAA,SAAAA,IAAAA;AACF,IAAA,CAAA;AAEA,IAAA,qBACEW,cAAA,CAAA,aAAA,CAACQ,MAAAA,EAAAA;QAAOC,OAAAA,EAASR,aAAAA;QAAeS,OAAAA,EAAQ,SAAA;QAAUb,IAAAA,EAAMA;AACrDD,KAAAA,EAAAA,KAAAA,CAAAA;AAGP;;;;"}
1
+ {"version":3,"file":"OAuthButton.mjs","sources":["../../../../../../../../../web/src/ui/b2c/components/OAuthButton.tsx"],"sourcesContent":["import React from 'react';\nimport { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { StringLiteralFromEnum } from '@stytch/core';\nimport { OAuthProviders } from '@stytch/core/public';\nimport { useStytch } from '../GlobalContextProvider';\nimport Button from '../../components/atoms/Button';\nimport { getButtonId, usePresentation } from '../../components/PresentationConfig';\nimport type { oauthIcons } from './Icons';\nimport { IconRegistry } from '../../components/IconRegistry';\n\ninterface ProviderInfo {\n messageDescriptor: MessageDescriptor;\n}\n\nconst providerInfo = {\n [OAuthProviders.Google]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGoogle', message: 'Continue with Google' }),\n },\n [OAuthProviders.Microsoft]: {\n messageDescriptor: msg({ id: 'oauth.continueWithMicrosoft', message: 'Continue with Microsoft' }),\n },\n [OAuthProviders.Apple]: {\n messageDescriptor: msg({ id: 'oauth.continueWithApple', message: 'Continue with Apple' }),\n },\n [OAuthProviders.Github]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGitHub', message: 'Continue with GitHub' }),\n },\n [OAuthProviders.GitLab]: {\n messageDescriptor: msg({ id: 'oauth.continueWithGitLab', message: 'Continue with GitLab' }),\n },\n [OAuthProviders.Facebook]: {\n messageDescriptor: msg({ id: 'oauth.continueWithFacebook', message: 'Continue with Facebook' }),\n },\n [OAuthProviders.Discord]: {\n messageDescriptor: msg({ id: 'oauth.continueWithDiscord', message: 'Continue with Discord' }),\n },\n [OAuthProviders.Salesforce]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSalesforce', message: 'Continue with Salesforce' }),\n },\n [OAuthProviders.Slack]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSlack', message: 'Continue with Slack' }),\n },\n [OAuthProviders.Amazon]: {\n messageDescriptor: msg({ id: 'oauth.continueWithAmazon', message: 'Continue with Amazon' }),\n },\n [OAuthProviders.Bitbucket]: {\n messageDescriptor: msg({ id: 'oauth.continueWithBitbucket', message: 'Continue with Bitbucket' }),\n },\n [OAuthProviders.LinkedIn]: {\n messageDescriptor: msg({ id: 'oauth.continueWithLinkedIn', message: 'Continue with LinkedIn' }),\n },\n [OAuthProviders.Coinbase]: {\n messageDescriptor: msg({ id: 'oauth.continueWithCoinbase', message: 'Continue with Coinbase' }),\n },\n [OAuthProviders.Twitch]: {\n messageDescriptor: msg({ id: 'oauth.continueWithTwitch', message: 'Continue with Twitch' }),\n },\n [OAuthProviders.Twitter]: {\n messageDescriptor: msg({ id: 'oauth.continueWithX', message: 'Continue with X' }),\n },\n [OAuthProviders.TikTok]: {\n messageDescriptor: msg({ id: 'oauth.continueWithTikTok', message: 'Continue with TikTok' }),\n },\n [OAuthProviders.Snapchat]: {\n messageDescriptor: msg({ id: 'oauth.continueWithSnapchat', message: 'Continue with Snapchat' }),\n },\n [OAuthProviders.Figma]: {\n messageDescriptor: msg({ id: 'oauth.continueWithFigma', message: 'Continue with Figma' }),\n },\n [OAuthProviders.Yahoo]: {\n messageDescriptor: msg({ id: 'oauth.continueWithYahoo', message: 'Continue with Yahoo' }),\n },\n} satisfies Record<OAuthProviders, ProviderInfo>;\n\ntype Props = {\n providerType: StringLiteralFromEnum<OAuthProviders>;\n loginRedirectUrl?: string;\n signupRedirectUrl?: string;\n customScopes?: string[];\n providerParams?: Record<string, string>;\n onSuccess?: () => void;\n};\n\nexport const OAuthButton = ({\n providerType,\n loginRedirectUrl,\n signupRedirectUrl,\n customScopes,\n providerParams,\n onSuccess,\n}: Props) => {\n const { t } = useLingui();\n const stytchClient = useStytch();\n const presentation = usePresentation();\n const iconRegistry: IconRegistry<keyof typeof oauthIcons> = presentation.iconRegistry;\n const id = getButtonId(`oauth-${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\n const iconName = providerType === 'twitter' ? 'xTwitter' : providerType;\n const Icon = iconRegistry[iconName];\n\n label = t(messageDescriptor);\n icon = <Icon />;\n }\n\n const onButtonClick = async () => {\n await stytchClient.oauth[providerType].start({\n login_redirect_url: loginRedirectUrl,\n signup_redirect_url: signupRedirectUrl,\n custom_scopes: customScopes,\n provider_params: providerParams,\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","OAuthProviders","Google","messageDescriptor","Microsoft","Apple","Github","GitLab","Facebook","Discord","Salesforce","Slack","Amazon","Bitbucket","LinkedIn","Coinbase","Twitch","Twitter","TikTok","Snapchat","Figma","Yahoo","OAuthButton","providerType","loginRedirectUrl","signupRedirectUrl","customScopes","providerParams","onSuccess","useLingui","stytchClient","useStytch","presentation","usePresentation","iconRegistry","id","getButtonId","options","provider","label","icon","iconName","Icon","React","onButtonClick","oauth","start","login_redirect_url","signup_redirect_url","custom_scopes","provider_params","Button","onClick","variant"],"mappings":";;;;;;;AAgBA,MAAMA,YAAAA,GAAe;IACnB,CAACC,cAAAA,CAAeC,MAAM,GAAG;QACvBC,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeG,SAAS,GAAG;QAC1BD,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeI,KAAK,GAAG;QACtBF,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeK,MAAM,GAAG;QACvBH,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeM,MAAM,GAAG;QACvBJ,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeO,QAAQ,GAAG;QACzBL,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeQ,OAAO,GAAG;QACxBN,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeS,UAAU,GAAG;QAC3BP,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeU,KAAK,GAAG;QACtBR,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeW,MAAM,GAAG;QACvBT,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAeY,SAAS,GAAG;QAC1BV,iBAAiB,EAAA;;;;AACnB,KAAA;IACA,CAACF,cAAAA,CAAea,QAAQ,GAAG;QACzBX,iBAAiB,EAAA;;;;AACnB,KAAA;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A,GAAWlB,YAAAA,KAAiB,SAAA,GAAY,UAAA,GAAaA,YAAAA;QAC3D,MAAMmB,IAAAA,GAAOR,YAAY,CAACO,QAAAA,CAAS;QAEnCF,KAAAA,GAAAA,OAAAA,CAAAA,CAAAA,CAAUpC,iBAAAA,CAAAA;AACVqC,QAAAA,IAAAA,iBAAOG,cAAA,CAAA,aAAA,CAACD,IAAAA,EAAAA,IAAAA,CAAAA;AACV,IAAA;AAEA,IAAA,MAAME,aAAAA,GAAgB,UAAA;AACpB,QAAA,MAAMd,aAAae,KAAK,CAACtB,YAAAA,CAAa,CAACuB,KAAK,CAAC;YAC3CC,kBAAAA,EAAoBvB,gBAAAA;YACpBwB,mBAAAA,EAAqBvB,iBAAAA;YACrBwB,aAAAA,EAAevB,YAAAA;YACfwB,eAAAA,EAAiBvB;AACnB,SAAA,CAAA;AACAC,QAAAA,SAAAA,IAAAA;AACF,IAAA,CAAA;AAEA,IAAA,qBACEe,cAAA,CAAA,aAAA,CAACQ,MAAAA,EAAAA;QAAOC,OAAAA,EAASR,aAAAA;QAAeS,OAAAA,EAAQ,SAAA;QAAUb,IAAAA,EAAMA,IAAAA;QAAML,EAAAA,EAAIA;AAC/DI,KAAAA,EAAAA,KAAAA,CAAAA;AAGP;;;;"}
@@ -5,22 +5,19 @@ import Column from '../../../components/atoms/Column.mjs';
5
5
  import TextColumn from '../../../components/molecules/TextColumn.mjs';
6
6
  import Button, { ButtonAnchor } from '../../../components/atoms/Button.mjs';
7
7
  import ButtonColumn from '../../../components/molecules/ButtonColumn.mjs';
8
- import { useCryptoIcon } from '../../../../utils/crypto.mjs';
8
+ import { useCryptoButtonProps, WalletToText } from '../../../../utils/crypto.mjs';
9
9
  import { Wallets } from '../../../../../../core/src/public/ui.mjs';
10
10
 
11
- const commonButtonProps = {
12
- variant: 'outline',
13
- target: '_blank',
14
- rel: 'noreferrer'
15
- };
16
11
  const SetupNewWallet = ()=>{
17
12
  const { i18n: $__i18n, _: $__ } = useLingui();
18
13
  const [, dispatch] = useGlobalReducer();
19
- const getCryptoIcon = useCryptoIcon();
20
- const MetamaskIcon = getCryptoIcon(Wallets.Metamask);
21
- const PhantomIcon = getCryptoIcon(Wallets.Phantom);
22
- const CoinbaseIcon = getCryptoIcon(Wallets.Coinbase);
23
- const BinanceIcon = getCryptoIcon(Wallets.Binance);
14
+ const { getIcon, getId } = useCryptoButtonProps();
15
+ const walletsToRender = [
16
+ Wallets.Metamask,
17
+ Wallets.Phantom,
18
+ Wallets.Coinbase,
19
+ Wallets.Binance
20
+ ];
24
21
  return /*#__PURE__*/ React__default.createElement(Column, {
25
22
  gap: 6
26
23
  }, /*#__PURE__*/ React__default.createElement(TextColumn, {
@@ -36,35 +33,18 @@ const SetupNewWallet = ()=>{
36
33
  id: "crypto.setupNewWallet.instruction",
37
34
  message: "We’ve included a few examples of wallet extensions you can find below. Once you’ve set up your wallet, click “Go back” to use it and sign in."
38
35
  })
39
- }), /*#__PURE__*/ React__default.createElement(ButtonColumn, null, /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
40
- ...commonButtonProps,
41
- icon: /*#__PURE__*/ React__default.createElement(MetamaskIcon, null),
42
- href: "https://metamask.io/"
43
- }, $__i18n._({
44
- id: "crypto.wallet.metamask",
45
- message: "Metamask"
46
- })), /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
47
- ...commonButtonProps,
48
- icon: /*#__PURE__*/ React__default.createElement(PhantomIcon, null),
49
- href: "https://phantom.com/"
50
- }, $__i18n._({
51
- id: "crypto.wallet.phantom",
52
- message: "Phantom"
53
- })), /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
54
- ...commonButtonProps,
55
- icon: /*#__PURE__*/ React__default.createElement(CoinbaseIcon, null),
56
- href: "https://www.coinbase.com/wallet"
57
- }, $__i18n._({
58
- id: "crypto.wallet.coinbase",
59
- message: "Coinbase"
60
- })), /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
61
- ...commonButtonProps,
62
- icon: /*#__PURE__*/ React__default.createElement(BinanceIcon, null),
63
- href: "https://web3.binance.com/en/about"
64
- }, $__i18n._({
65
- id: "crypto.wallet.binance",
66
- message: "Binance"
67
- })), /*#__PURE__*/ React__default.createElement(Button, {
36
+ }), /*#__PURE__*/ React__default.createElement(ButtonColumn, null, walletsToRender.map((wallet)=>{
37
+ const Icon = getIcon(wallet);
38
+ return /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
39
+ key: wallet,
40
+ variant: "outline",
41
+ target: "_blank",
42
+ rel: "noreferrer",
43
+ icon: /*#__PURE__*/ React__default.createElement(Icon, null),
44
+ href: "https://metamask.io/",
45
+ id: getId(wallet)
46
+ }, $__i18n._(WalletToText[wallet]));
47
+ }), /*#__PURE__*/ React__default.createElement(Button, {
68
48
  variant: "primary",
69
49
  onClick: ()=>dispatch({
70
50
  type: 'transition',
@@ -1 +1 @@
1
- {"version":3,"file":"SetupNewWallet.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/SetupNewWallet.tsx"],"sourcesContent":["import React from 'react';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\nimport { AppScreens, useGlobalReducer } from '../../GlobalContextProvider';\nimport Column from '../../../components/atoms/Column';\nimport TextColumn from '../../../components/molecules/TextColumn';\nimport Button, { ButtonAnchor } from '../../../components/atoms/Button';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport { useCryptoIcon } from '../../../../utils/crypto';\n\nconst commonButtonProps = {\n variant: 'outline',\n target: '_blank',\n rel: 'noreferrer',\n} as const;\n\nexport const SetupNewWallet = () => {\n const { t } = useLingui();\n const [, dispatch] = useGlobalReducer();\n\n const getCryptoIcon = useCryptoIcon();\n const MetamaskIcon = getCryptoIcon(Wallets.Metamask);\n const PhantomIcon = getCryptoIcon(Wallets.Phantom);\n const CoinbaseIcon = getCryptoIcon(Wallets.Coinbase);\n const BinanceIcon = getCryptoIcon(Wallets.Binance);\n\n return (\n <Column gap={6}>\n <TextColumn\n header={t({ id: 'crypto.setupNewWallet.title', message: 'Set up a new crypto wallet' })}\n body={t({\n id: 'crypto.setupNewWallet.content',\n message: 'Get started by downloading any Ethereum or Solana wallet.',\n })}\n helper={t({\n id: 'crypto.setupNewWallet.instruction',\n message:\n 'We’ve included a few examples of wallet extensions you can find below. Once you’ve set up your wallet, click “Go back” to use it and sign in.',\n })}\n />\n\n <ButtonColumn>\n <ButtonAnchor {...commonButtonProps} icon={<MetamaskIcon />} href=\"https://metamask.io/\">\n {t({ id: 'crypto.wallet.metamask', message: 'Metamask' })}\n </ButtonAnchor>\n <ButtonAnchor {...commonButtonProps} icon={<PhantomIcon />} href=\"https://phantom.com/\">\n {t({ id: 'crypto.wallet.phantom', message: 'Phantom' })}\n </ButtonAnchor>\n\n <ButtonAnchor {...commonButtonProps} icon={<CoinbaseIcon />} href=\"https://www.coinbase.com/wallet\">\n {t({ id: 'crypto.wallet.coinbase', message: 'Coinbase' })}\n </ButtonAnchor>\n\n <ButtonAnchor {...commonButtonProps} icon={<BinanceIcon />} href=\"https://web3.binance.com/en/about\">\n {t({ id: 'crypto.wallet.binance', message: 'Binance' })}\n </ButtonAnchor>\n\n <Button variant=\"primary\" onClick={() => dispatch({ type: 'transition', screen: AppScreens.Main })}>\n {t({ id: 'button.goBack', message: 'Go back' })}\n </Button>\n </ButtonColumn>\n </Column>\n );\n};\n"],"names":["commonButtonProps","variant","target","rel","SetupNewWallet","useLingui","dispatch","useGlobalReducer","getCryptoIcon","useCryptoIcon","MetamaskIcon","Wallets","Metamask","PhantomIcon","Phantom","CoinbaseIcon","Coinbase","BinanceIcon","Binance","React","Column","gap","TextColumn","header","body","helper","ButtonColumn","ButtonAnchor","icon","href","Button","onClick","type","screen","AppScreens","Main"],"mappings":";;;;;;;;;;AAUA,MAAMA,iBAAAA,GAAoB;IACxBC,OAAAA,EAAS,SAAA;IACTC,MAAAA,EAAQ,QAAA;IACRC,GAAAA,EAAK;AACP,CAAA;MAEaC,cAAAA,GAAiB,IAAA;AAC5B,IAA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,QAAAA,IAAAA,gBAAMT,cAAA,CAAA,aAAA,CAACJ,YAAAA,EAAAA,IAAAA,CAAAA;QAAiBc,IAAAA,EAAK;;;;uBAIlEV,cAAA,CAAA,aAAA,CAACQ,YAAAA,EAAAA;AAAc,QAAA,GAAG3B,iBAAiB;AAAE4B,QAAAA,IAAAA,gBAAMT,cAAA,CAAA,aAAA,CAACF,WAAAA,EAAAA,IAAAA,CAAAA;QAAgBY,IAAAA,EAAK;;;;uBAIjEV,cAAA,CAAA,aAAA,CAACW,MAAAA,EAAAA;QAAO7B,OAAAA,EAAQ,SAAA;AAAU8B,QAAAA,OAAAA,EAAS,IAAMzB,QAAAA,CAAS;gBAAE0B,IAAAA,EAAM,YAAA;AAAcC,gBAAAA,MAAAA,EAAQC,WAAWC;AAAK,aAAA;;;;;AAMxG;;;;"}
1
+ {"version":3,"file":"SetupNewWallet.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/SetupNewWallet.tsx"],"sourcesContent":["import React from 'react';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\nimport { AppScreens, useGlobalReducer } from '../../GlobalContextProvider';\nimport Column from '../../../components/atoms/Column';\nimport TextColumn from '../../../components/molecules/TextColumn';\nimport Button, { ButtonAnchor } from '../../../components/atoms/Button';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport { useCryptoButtonProps, WalletToText } from '../../../../utils/crypto';\n\nexport const SetupNewWallet = () => {\n const { t } = useLingui();\n const [, dispatch] = useGlobalReducer();\n\n const { getIcon, getId } = useCryptoButtonProps();\n const walletsToRender = [Wallets.Metamask, Wallets.Phantom, Wallets.Coinbase, Wallets.Binance];\n\n return (\n <Column gap={6}>\n <TextColumn\n header={t({ id: 'crypto.setupNewWallet.title', message: 'Set up a new crypto wallet' })}\n body={t({\n id: 'crypto.setupNewWallet.content',\n message: 'Get started by downloading any Ethereum or Solana wallet.',\n })}\n helper={t({\n id: 'crypto.setupNewWallet.instruction',\n message:\n 'We’ve included a few examples of wallet extensions you can find below. Once you’ve set up your wallet, click “Go back” to use it and sign in.',\n })}\n />\n\n <ButtonColumn>\n {walletsToRender.map((wallet) => {\n const Icon = getIcon(wallet);\n return (\n <ButtonAnchor\n key={wallet}\n variant=\"outline\"\n target=\"_blank\"\n rel=\"noreferrer\"\n icon={<Icon />}\n href=\"https://metamask.io/\"\n id={getId(wallet)}\n >\n {t(WalletToText[wallet])}\n </ButtonAnchor>\n );\n })}\n\n <Button variant=\"primary\" onClick={() => dispatch({ type: 'transition', screen: AppScreens.Main })}>\n {t({ id: 'button.goBack', message: 'Go back' })}\n </Button>\n </ButtonColumn>\n </Column>\n );\n};\n"],"names":["SetupNewWallet","useLingui","dispatch","useGlobalReducer","getIcon","getId","useCryptoButtonProps","walletsToRender","Wallets","Metamask","Phantom","Coinbase","Binance","React","Column","gap","TextColumn","header","body","helper","ButtonColumn","map","wallet","Icon","ButtonAnchor","key","variant","target","rel","icon","href","id","WalletToText","Button","onClick","type","screen","AppScreens","Main"],"mappings":";;;;;;;;;;MAUaA,cAAAA,GAAiB,IAAA;AAC5B,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;IACd,MAAM,GAAGC,SAAS,GAAGC,gBAAAA,EAAAA;AAErB,IAAA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAE,GAAGC,oBAAAA,EAAAA;AAC3B,IAAA,MAAMC,eAAAA,GAAkB;AAACC,QAAAA,OAAAA,CAAQC,QAAQ;AAAED,QAAAA,OAAAA,CAAQE,OAAO;AAAEF,QAAAA,OAAAA,CAAQG,QAAQ;AAAEH,QAAAA,OAAAA,CAAQI;AAAQ,KAAA;AAE9F,IAAA,qBACEC,cAAA,CAAA,aAAA,CAACC,MAAAA,EAAAA;QAAOC,GAAAA,EAAK;qBACXF,cAAA,CAAA,aAAA,CAACG,UAAAA,EAAAA;QACCC,MAAM,EAAA,OAAA,CAAA,CAAA,CAAA;;;;QACNC,IAAI,EAAA,OAAA,CAAA,CAAA,CAAA;;;;QAIJC,MAAM,EAAA,OAAA,CAAA,CAAA,CAAA;;;;AAOR,KAAA,CAAA,gBAAAN,cAAA,CAAA,aAAA,CAACO,YAAAA,EAAAA,IAAAA,EACEb,eAAAA,CAAgBc,GAAG,CAAC,CAACC,MAAAA,GAAAA;AACpB,QAAA,MAAMC,OAAOnB,OAAAA,CAAQkB,MAAAA,CAAAA;AACrB,QAAA,qBACET,cAAA,CAAA,aAAA,CAACW,YAAAA,EAAAA;YACCC,GAAAA,EAAKH,MAAAA;YACLI,OAAAA,EAAQ,SAAA;YACRC,MAAAA,EAAO,QAAA;YACPC,GAAAA,EAAI,YAAA;AACJC,YAAAA,IAAAA,gBAAMhB,cAAA,CAAA,aAAA,CAACU,IAAAA,EAAAA,IAAAA,CAAAA;YACPO,IAAAA,EAAK,sBAAA;AACLC,YAAAA,EAAAA,EAAI1B,KAAAA,CAAMiB,MAAAA;AAEPU,SAAAA,EAAAA,OAAAA,CAAAA,CAAAA,CAAAA,YAAY,CAACV,MAAAA,CAAO,CAAA,CAAA;AAG7B,IAAA,CAAA,CAAA,gBAEAT,cAAA,CAAA,aAAA,CAACoB,MAAAA,EAAAA;QAAOP,OAAAA,EAAQ,SAAA;AAAUQ,QAAAA,OAAAA,EAAS,IAAMhC,QAAAA,CAAS;gBAAEiC,IAAAA,EAAM,YAAA;AAAcC,gBAAAA,MAAAA,EAAQC,WAAWC;AAAK,aAAA;;;;;AAMxG;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useLingui } from '../../../../../../../node_modules/@lingui/react/dist/index.mjs';
3
3
  import { useGlobalReducer, useConfig, AppScreens } from '../../GlobalContextProvider.mjs';
4
- import { useCryptoIcon, isWalletVisible, WalletToText } from '../../../../utils/crypto.mjs';
4
+ import { useCryptoButtonProps, isWalletVisible, WalletToText } from '../../../../utils/crypto.mjs';
5
5
  import ButtonColumn from '../../../components/molecules/ButtonColumn.mjs';
6
6
  import Button from '../../../components/atoms/Button.mjs';
7
7
  import { GenericWalletIcon } from '../../../../assets/genericWallet.mjs';
@@ -38,7 +38,7 @@ const CryptoWalletButtons = ({ type })=>{
38
38
  const { i18n: $__i18n, _: $__ } = useLingui();
39
39
  const [state, dispatch] = useGlobalReducer();
40
40
  const config = useConfig();
41
- const getCryptoIcon = useCryptoIcon();
41
+ const { getIcon, getId } = useCryptoButtonProps();
42
42
  const oAuthOptions = config.oauthOptions?.providers.length ?? 0;
43
43
  // Crypto Buttons on screen = Maximum Buttons - OAuth Buttons - 1 (Other crypto or set up new wallet)
44
44
  const cryptoButtonsOnMainScreen = MAX_BUTTONS - oAuthOptions - 1;
@@ -62,12 +62,13 @@ const CryptoWalletButtons = ({ type })=>{
62
62
  const walletsToRender = type === 'main' ? mainWallets : otherWallet;
63
63
  return /*#__PURE__*/ React.createElement(ButtonColumn, null, walletsToRender.map((wallet)=>{
64
64
  const walletEnum = Wallets[wallet];
65
- const Icon = getCryptoIcon(walletEnum);
65
+ const Icon = getIcon(walletEnum);
66
66
  return /*#__PURE__*/ React.createElement(Button, {
67
67
  key: wallet,
68
68
  variant: "outline",
69
69
  icon: /*#__PURE__*/ React.createElement(Icon, null),
70
- onClick: ()=>onWalletStart(walletEnum)
70
+ onClick: ()=>onWalletStart(walletEnum),
71
+ id: getId(walletEnum)
71
72
  }, type === 'main' ? $__i18n._(walletMessages[walletEnum]) : $__i18n._(WalletToText[walletEnum]));
72
73
  }), renderOtherScreenButton && type === 'main' ? /*#__PURE__*/ React.createElement(Button, {
73
74
  variant: "outline",
@@ -75,7 +76,8 @@ const CryptoWalletButtons = ({ type })=>{
75
76
  onClick: ()=>dispatch({
76
77
  type: 'transition',
77
78
  screen: AppScreens.CryptoOtherScreen
78
- })
79
+ }),
80
+ id: getId(Wallets.GenericEthereumWallet)
79
81
  }, $__i18n._({
80
82
  id: "crypto.wallet.continueWithOtherWallet",
81
83
  message: "Continue with other Crypto Wallet"
@@ -1 +1 @@
1
- {"version":3,"file":"WalletButtons.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/WalletButtons.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\n\nimport { useConfig, useGlobalReducer, AppScreens } from '../../GlobalContextProvider';\nimport { WalletToText, isWalletVisible, useCryptoIcon } from '../../../../utils/crypto';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport Button from '../../../components/atoms/Button';\nimport { GenericWalletIcon } from '../../../../assets';\n\nconst MAX_BUTTONS = 6;\n\nconst walletMessages = {\n [Wallets.Phantom]: msg({ id: 'crypto.wallet.continueWithPhantom', message: 'Continue with Phantom' }),\n [Wallets.Binance]: msg({ id: 'crypto.wallet.continueWithBinance', message: 'Continue with Binance' }),\n [Wallets.Coinbase]: msg({ id: 'crypto.wallet.continueWithCoinbase', message: 'Continue with Coinbase' }),\n [Wallets.Metamask]: msg({ id: 'crypto.wallet.continueWithMetamask', message: 'Continue with Metamask' }),\n [Wallets.GenericEthereumWallet]: msg({\n id: 'crypto.wallet.continueWithEthereum',\n message: 'Continue with Other Ethereum Wallet',\n }),\n [Wallets.GenericSolanaWallet]: msg({\n id: 'crypto.wallet.continueWithSolana',\n message: 'Continue with Other Solana Wallet',\n }),\n} satisfies Record<Wallets, MessageDescriptor>;\n\nexport const CryptoWalletButtons = ({ type }: { type: 'main' | 'other' }) => {\n const { t } = useLingui();\n const [state, dispatch] = useGlobalReducer();\n const config = useConfig();\n\n const getCryptoIcon = useCryptoIcon();\n\n const oAuthOptions = config.oauthOptions?.providers.length ?? 0;\n\n // Crypto Buttons on screen = Maximum Buttons - OAuth Buttons - 1 (Other crypto or set up new wallet)\n const cryptoButtonsOnMainScreen = MAX_BUTTONS - oAuthOptions - 1;\n const onWalletStart = (wallet: Wallets) => {\n dispatch({\n type: 'update_crypto_state',\n cryptoState: {\n ...state.formState.cryptoState,\n walletOption: wallet,\n },\n });\n dispatch({ type: 'transition', screen: AppScreens.CryptoConnect });\n };\n\n const allDetectedWallets = (Object.keys(Wallets) as (keyof typeof Wallets)[]).filter((wallet) =>\n isWalletVisible(Wallets[wallet]),\n );\n\n const renderOtherScreenButton = allDetectedWallets.length > cryptoButtonsOnMainScreen;\n\n const mainWallets = allDetectedWallets.slice(0, cryptoButtonsOnMainScreen);\n const otherWallet = allDetectedWallets.slice(cryptoButtonsOnMainScreen);\n\n const walletsToRender = type === 'main' ? mainWallets : otherWallet;\n\n return (\n <ButtonColumn>\n {walletsToRender.map((wallet) => {\n const walletEnum = Wallets[wallet];\n const Icon = getCryptoIcon(walletEnum);\n return (\n <Button key={wallet} variant=\"outline\" icon={<Icon />} onClick={() => onWalletStart(walletEnum)}>\n {type === 'main' ? t(walletMessages[walletEnum]) : t(WalletToText[walletEnum])}\n </Button>\n );\n })}\n\n {renderOtherScreenButton && type === 'main' ? (\n <Button\n variant=\"outline\"\n icon={<GenericWalletIcon />}\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoOtherScreen })}\n >\n {t(msg({ id: 'crypto.wallet.continueWithOtherWallet', message: 'Continue with other Crypto Wallet' }))}\n </Button>\n ) : (\n <Button\n variant=\"outline\"\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoSetupWallet })}\n >\n {t(msg({ id: 'crypto.wallet.setupNewWallet', message: 'Set up a new crypto wallet' }))}\n </Button>\n )}\n </ButtonColumn>\n );\n};\n"],"names":["MAX_BUTTONS","walletMessages","Wallets","Phantom","Binance","Coinbase","Metamask","GenericEthereumWallet","GenericSolanaWallet","CryptoWalletButtons","type","useLingui","state","dispatch","useGlobalReducer","config","useConfig","getCryptoIcon","useCryptoIcon","oAuthOptions","oauthOptions","providers","length","cryptoButtonsOnMainScreen","onWalletStart","wallet","cryptoState","formState","walletOption","screen","AppScreens","CryptoConnect","allDetectedWallets","Object","keys","filter","isWalletVisible","renderOtherScreenButton","mainWallets","slice","otherWallet","walletsToRender","ButtonColumn","map","walletEnum","Icon","Button","key","variant","icon","onClick","WalletToText","GenericWalletIcon","CryptoOtherScreen","CryptoSetupWallet"],"mappings":";;;;;;;;;AAYA,MAAMA,WAAAA,GAAc,CAAA;AAEpB,MAAMC,cAAAA,GAAiB;IACrB,CAACC,OAAAA,CAAQC,OAAO,GAAC;;;;IACjB,CAACD,OAAAA,CAAQE,OAAO,GAAC;;;;IACjB,CAACF,OAAAA,CAAQG,QAAQ,GAAC;;;;IAClB,CAACH,OAAAA,CAAQI,QAAQ,GAAC;;;;IAClB,CAACJ,OAAAA,CAAQK,qBAAqB,GAAC;;;;IAI/B,CAACL,OAAAA,CAAQM,mBAAmB,GAAC;;;;AAI/B,CAAA;AAEO,MAAMC,mBAAAA,GAAsB,CAAC,EAAEC,IAAI,EAA8B,GAAA;AACtE,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;IACd,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,gBAAAA,EAAAA;AAC1B,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;AAEf,IAAA,MAAMC,aAAAA,GAAgBC,aAAAA,EAAAA;AAEtB,IAAA,MAAMC,YAAAA,GAAeJ,MAAAA,CAAOK,YAAY,EAAEC,UAAUC,MAAAA,IAAU,CAAA;;IAG9D,MAAMC,yBAAAA,GAA4BvB,cAAcmB,YAAAA,GAAe,CAAA;AAC/D,IAAA,MAAMK,gBAAgB,CAACC,MAAAA,GAAAA;QACrBZ,QAAAA,CAAS;YACPH,IAAAA,EAAM,qBAAA;YACNgB,WAAAA,EAAa;gBACX,GAAGd,KAAAA,CAAMe,SAAS,CAACD,WAAW;gBAC9BE,YAAAA,EAAcH;AAChB;AACF,SAAA,CAAA;QACAZ,QAAAA,CAAS;YAAEH,IAAAA,EAAM,YAAA;AA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AA2B3B,IAAAA,KAAS,MAAA,iBACnC,KAAA,CAAA,aAAA,CAACoC,MAAAA,EAAAA;QACCE,OAAAA,EAAQ,SAAA;AACRC,QAAAA,IAAAA,gBAAM,KAAA,CAAA,aAAA,CAACG,iBAAAA,EAAAA,IAAAA,CAAAA;AACPF,QAAAA,OAAAA,EAAS,IAAMrC,QAAAA,CAAS;gBAAEH,IAAAA,EAAM,YAAA;AAAcmB,gBAAAA,MAAAA,EAAQC,WAAWuB;AAAkB,aAAA;;;;wBAKrF,KAAA,CAAA,aAAA,CAACP,MAAAA,EAAAA;QACCE,OAAAA,EAAQ,SAAA;AACRE,QAAAA,OAAAA,EAAS,IAAMrC,QAAAA,CAAS;gBAAEH,IAAAA,EAAM,YAAA;AAAcmB,gBAAAA,MAAAA,EAAQC,WAAWwB;AAAkB,aAAA;;;;;AAO7F;;;;"}
1
+ {"version":3,"file":"WalletButtons.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/WalletButtons.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\n\nimport { useConfig, useGlobalReducer, AppScreens } from '../../GlobalContextProvider';\nimport { WalletToText, isWalletVisible, useCryptoButtonProps } from '../../../../utils/crypto';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport Button from '../../../components/atoms/Button';\nimport { GenericWalletIcon } from '../../../../assets';\n\nconst MAX_BUTTONS = 6;\n\nconst walletMessages = {\n [Wallets.Phantom]: msg({ id: 'crypto.wallet.continueWithPhantom', message: 'Continue with Phantom' }),\n [Wallets.Binance]: msg({ id: 'crypto.wallet.continueWithBinance', message: 'Continue with Binance' }),\n [Wallets.Coinbase]: msg({ id: 'crypto.wallet.continueWithCoinbase', message: 'Continue with Coinbase' }),\n [Wallets.Metamask]: msg({ id: 'crypto.wallet.continueWithMetamask', message: 'Continue with Metamask' }),\n [Wallets.GenericEthereumWallet]: msg({\n id: 'crypto.wallet.continueWithEthereum',\n message: 'Continue with Other Ethereum Wallet',\n }),\n [Wallets.GenericSolanaWallet]: msg({\n id: 'crypto.wallet.continueWithSolana',\n message: 'Continue with Other Solana Wallet',\n }),\n} satisfies Record<Wallets, MessageDescriptor>;\n\nexport const CryptoWalletButtons = ({ type }: { type: 'main' | 'other' }) => {\n const { t } = useLingui();\n const [state, dispatch] = useGlobalReducer();\n const config = useConfig();\n\n const { getIcon, getId } = useCryptoButtonProps();\n\n const oAuthOptions = config.oauthOptions?.providers.length ?? 0;\n\n // Crypto Buttons on screen = Maximum Buttons - OAuth Buttons - 1 (Other crypto or set up new wallet)\n const cryptoButtonsOnMainScreen = MAX_BUTTONS - oAuthOptions - 1;\n const onWalletStart = (wallet: Wallets) => {\n dispatch({\n type: 'update_crypto_state',\n cryptoState: {\n ...state.formState.cryptoState,\n walletOption: wallet,\n },\n });\n dispatch({ type: 'transition', screen: AppScreens.CryptoConnect });\n };\n\n const allDetectedWallets = (Object.keys(Wallets) as (keyof typeof Wallets)[]).filter((wallet) =>\n isWalletVisible(Wallets[wallet]),\n );\n\n const renderOtherScreenButton = allDetectedWallets.length > cryptoButtonsOnMainScreen;\n\n const mainWallets = allDetectedWallets.slice(0, cryptoButtonsOnMainScreen);\n const otherWallet = allDetectedWallets.slice(cryptoButtonsOnMainScreen);\n\n const walletsToRender = type === 'main' ? mainWallets : otherWallet;\n\n return (\n <ButtonColumn>\n {walletsToRender.map((wallet) => {\n const walletEnum = Wallets[wallet];\n const Icon = getIcon(walletEnum);\n return (\n <Button\n key={wallet}\n variant=\"outline\"\n icon={<Icon />}\n onClick={() => onWalletStart(walletEnum)}\n id={getId(walletEnum)}\n >\n {type === 'main' ? t(walletMessages[walletEnum]) : t(WalletToText[walletEnum])}\n </Button>\n );\n })}\n\n {renderOtherScreenButton && type === 'main' ? (\n <Button\n variant=\"outline\"\n icon={<GenericWalletIcon />}\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoOtherScreen })}\n id={getId(Wallets.GenericEthereumWallet)}\n >\n {t(msg({ id: 'crypto.wallet.continueWithOtherWallet', message: 'Continue with other Crypto Wallet' }))}\n </Button>\n ) : (\n <Button\n variant=\"outline\"\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoSetupWallet })}\n >\n {t(msg({ id: 'crypto.wallet.setupNewWallet', message: 'Set up a new crypto wallet' }))}\n </Button>\n )}\n </ButtonColumn>\n );\n};\n"],"names":["MAX_BUTTONS","walletMessages","Wallets","Phantom","Binance","Coinbase","Metamask","GenericEthereumWallet","GenericSolanaWallet","CryptoWalletButtons","type","useLingui","state","dispatch","useGlobalReducer","config","useConfig","getIcon","getId","useCryptoButtonProps","oAuthOptions","oauthOptions","providers","length","cryptoButtonsOnMainScreen","onWalletStart","wallet","cryptoState","formState","walletOption","screen","AppScreens","CryptoConnect","allDetectedWallets","Object","keys","filter","isWalletVisible","renderOtherScreenButton","mainWallets","slice","otherWallet","walletsToRender","ButtonColumn","map","walletEnum","Icon","Button","key","variant","icon","onClick","id","WalletToText","GenericWalletIcon","CryptoOtherScreen","CryptoSetupWallet"],"mappings":";;;;;;;;;AAYA,MAAMA,WAAAA,GAAc,CAAA;AAEpB,MAAMC,cAAAA,GAAiB;IACrB,CAACC,OAAAA,CAAQC,OAAO,GAAC;;;;IACjB,CAACD,OAAAA,CAAQE,OAAO,GAAC;;;;IACjB,CAACF,OAAAA,CAAQG,QAAQ,GAAC;;;;IAClB,CAACH,OAAAA,CAAQI,QAAQ,GAAC;;;;IAClB,CAACJ,OAAAA,CAAQK,qBAAqB,GAAC;;;;IAI/B,CAACL,OAAAA,CAAQM,mBAAmB,GAAC;;;;AAI/B,CAAA;AAEO,MAAMC,mBAAAA,GAAsB,CAAC,EAAEC,IAAI,EAA8B,GAAA;AACtE,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAA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AAA;;;;;AAO7F;;;;"}
@@ -46,6 +46,11 @@ function isDynamicTheme(theme) {
46
46
  }
47
47
  const PresentationContext = createContext(undefined);
48
48
  const usePresentation = ()=>useContext(PresentationContext);
49
+ function getButtonId(base, options) {
50
+ if (options.buttonId == null || options.buttonId === false) return undefined;
51
+ if (typeof options.buttonId === 'string') return base + options.buttonId;
52
+ return base;
53
+ }
49
54
 
50
- export { PresentationContext, isDynamicTheme, usePresentation, usePresentationWithDefault };
55
+ export { PresentationContext, getButtonId, isDynamicTheme, usePresentation, usePresentationWithDefault };
51
56
  //# sourceMappingURL=PresentationConfig.mjs.map