@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.
Files changed (190) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/StytchSSRProxy-Bz6LNYdq.js.map +1 -1
  3. package/dist/cjs/adminPortal/index.cjs +1 -1
  4. package/dist/cjs/b2b/index.cjs +28 -20
  5. package/dist/cjs/b2b/index.cjs.map +1 -1
  6. package/dist/cjs/compat.cjs +2 -0
  7. package/dist/cjs/compat.cjs.map +1 -1
  8. package/dist/cjs/{index-Ni_dyEsz.js → index-BIjXBvf_.js} +2 -2
  9. package/dist/cjs/index-BIjXBvf_.js.map +1 -0
  10. package/dist/cjs/index.cjs +521 -542
  11. package/dist/cjs/index.cjs.map +1 -1
  12. package/dist/cjs/{shadcn-B8TEzQMT.js → shadcn-aVU6Lm9q.js} +255 -235
  13. package/dist/cjs/shadcn-aVU6Lm9q.js.map +1 -0
  14. package/dist/cjs-dev/StytchSSRProxy-d553KgcY.js +438 -0
  15. package/dist/cjs-dev/StytchSSRProxy-d553KgcY.js.map +1 -0
  16. package/dist/cjs-dev/adminPortal/index.cjs +54 -53
  17. package/dist/cjs-dev/adminPortal/index.cjs.map +1 -1
  18. package/dist/cjs-dev/b2b/index.cjs +94 -75
  19. package/dist/cjs-dev/b2b/index.cjs.map +1 -1
  20. package/dist/cjs-dev/b2b/index.headless.cjs +89 -88
  21. package/dist/cjs-dev/b2b/index.headless.cjs.map +1 -1
  22. package/dist/cjs-dev/compat.cjs +15 -14
  23. package/dist/cjs-dev/compat.cjs.map +1 -1
  24. package/dist/cjs-dev/{StytchSSRProxy-CxXsyme4.js → dev-DaCGDI6V.js} +60 -426
  25. package/dist/cjs-dev/dev-DaCGDI6V.js.map +1 -0
  26. package/dist/cjs-dev/{idpHelpers-BVMUYvt1.js → idpHelpers-DOYYSxsX.js} +45 -102
  27. package/dist/cjs-dev/idpHelpers-DOYYSxsX.js.map +1 -0
  28. package/dist/cjs-dev/{index-DdK3Jt4u.js → index-rquGmIlv.js} +4 -4
  29. package/dist/cjs-dev/index-rquGmIlv.js.map +1 -0
  30. package/dist/cjs-dev/index.cjs +667 -667
  31. package/dist/cjs-dev/index.cjs.map +1 -1
  32. package/dist/cjs-dev/index.headless.cjs +70 -69
  33. package/dist/cjs-dev/index.headless.cjs.map +1 -1
  34. package/dist/cjs-dev/{passwordManagerDisableAutofillProps-D70WyvIu.js → passwordManagerDisableAutofillProps-CgiK2M_U.js} +2 -2
  35. package/dist/cjs-dev/{passwordManagerDisableAutofillProps-D70WyvIu.js.map → passwordManagerDisableAutofillProps-CgiK2M_U.js.map} +1 -1
  36. package/dist/cjs-dev/{shadcn-C9ClUju1.js → shadcn-DMk6ZSoD.js} +265 -244
  37. package/dist/cjs-dev/shadcn-DMk6ZSoD.js.map +1 -0
  38. package/dist/esm/_virtual/index3.mjs +5 -3
  39. package/dist/esm/_virtual/index3.mjs.map +1 -1
  40. package/dist/esm/_virtual/index4.mjs +3 -5
  41. package/dist/esm/_virtual/index4.mjs.map +1 -1
  42. package/dist/esm/b2b/StytchB2BContext.mjs +5 -5
  43. package/dist/esm/b2b/StytchB2BContext.mjs.map +1 -1
  44. package/dist/esm/packages/core/src/public/b2b/ui.mjs.map +1 -1
  45. package/dist/esm/packages/web/src/adminPortal/utils/theme.mjs +1 -1
  46. package/dist/esm/packages/web/src/ui/b2b/App.mjs +2 -2
  47. package/dist/esm/packages/web/src/ui/b2b/App.mjs.map +1 -1
  48. package/dist/esm/packages/web/src/ui/b2b/components/Icons.mjs +3 -1
  49. package/dist/esm/packages/web/src/ui/b2b/components/Icons.mjs.map +1 -1
  50. package/dist/esm/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs +6 -3
  51. package/dist/esm/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs.map +1 -1
  52. package/dist/esm/packages/web/src/ui/b2b/components/SSOButton.mjs +5 -3
  53. package/dist/esm/packages/web/src/ui/b2b/components/SSOButton.mjs.map +1 -1
  54. package/dist/esm/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs +6 -3
  55. package/dist/esm/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs.map +1 -1
  56. package/dist/esm/packages/web/src/ui/b2b/types/authMethodKeys.mjs +2 -2
  57. package/dist/esm/packages/web/src/ui/b2b/types/authMethodKeys.mjs.map +1 -1
  58. package/dist/esm/packages/web/src/ui/b2c/AppContainer.mjs +1 -1
  59. package/dist/esm/packages/web/src/ui/b2c/AppContainer.mjs.map +1 -1
  60. package/dist/esm/packages/web/src/ui/b2c/IDPContainer.mjs +1 -1
  61. package/dist/esm/packages/web/src/ui/b2c/IDPContainer.mjs.map +1 -1
  62. package/dist/esm/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs +1 -1
  63. package/dist/esm/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs.map +1 -1
  64. package/dist/esm/packages/web/src/ui/b2c/ResetPasswordContainer.mjs +1 -1
  65. package/dist/esm/packages/web/src/ui/b2c/ResetPasswordContainer.mjs.map +1 -1
  66. package/dist/esm/packages/web/src/ui/b2c/components/OAuthButton.mjs +6 -3
  67. package/dist/esm/packages/web/src/ui/b2c/components/OAuthButton.mjs.map +1 -1
  68. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +20 -39
  69. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
  70. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +15 -15
  71. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
  72. package/dist/esm/packages/web/src/ui/compat/styleToTheme.mjs +2 -0
  73. package/dist/esm/packages/web/src/ui/compat/styleToTheme.mjs.map +1 -1
  74. package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs +6 -1
  75. package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
  76. package/dist/esm/packages/web/src/ui/components/atoms/Button.mjs.map +1 -1
  77. package/dist/esm/packages/web/src/ui/components/atoms/Typography.module.css.mjs +2 -2
  78. package/dist/esm/packages/web/src/ui/components/molecules/EmailInput.mjs +1 -1
  79. package/dist/esm/packages/web/src/ui/components/molecules/EmailInput.mjs.map +1 -1
  80. package/dist/esm/packages/web/src/ui/components/molecules/Input.mjs +1 -1
  81. package/dist/esm/packages/web/src/ui/components/molecules/Input.mjs.map +1 -1
  82. package/dist/esm/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs +1 -1
  83. package/dist/esm/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs.map +1 -1
  84. package/dist/esm/packages/web/src/ui/react/b2b/Stytch.mjs +1 -1
  85. package/dist/esm/packages/web/src/ui/react/b2b/Stytch.mjs.map +1 -1
  86. package/dist/esm/packages/web/src/ui/react/b2b/StytchB2BContext.mjs +1 -1
  87. package/dist/esm/packages/web/src/ui/react/b2b/StytchB2BContext.mjs.map +1 -1
  88. package/dist/esm/packages/web/src/ui/react/b2c/IdentityProvider.mjs +1 -1
  89. package/dist/esm/packages/web/src/ui/react/b2c/IdentityProvider.mjs.map +1 -1
  90. package/dist/esm/packages/web/src/ui/react/b2c/StytchContext.mjs +1 -1
  91. package/dist/esm/packages/web/src/ui/react/b2c/StytchContext.mjs.map +1 -1
  92. package/dist/esm/packages/web/src/ui/react/b2c/StytchLogin.mjs +1 -1
  93. package/dist/esm/packages/web/src/ui/react/b2c/StytchLogin.mjs.map +1 -1
  94. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs +1 -1
  95. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs.map +1 -1
  96. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs +1 -1
  97. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs.map +1 -1
  98. package/dist/esm/packages/web/src/ui/react/utils/errors.mjs.map +1 -1
  99. package/dist/esm/packages/web/src/utils/crypto.mjs +19 -14
  100. package/dist/esm/packages/web/src/utils/crypto.mjs.map +1 -1
  101. package/dist/esm/packages/web/src/utils/oauthProviderType.mjs +1 -1
  102. package/dist/esm/packages/web/src/utils/oauthProviderType.mjs.map +1 -1
  103. package/dist/esm-dev/_virtual/index3.mjs +3 -5
  104. package/dist/esm-dev/_virtual/index3.mjs.map +1 -1
  105. package/dist/esm-dev/_virtual/index4.mjs +5 -3
  106. package/dist/esm-dev/_virtual/index4.mjs.map +1 -1
  107. package/dist/esm-dev/b2b/StytchB2BContext.mjs +5 -5
  108. package/dist/esm-dev/b2b/StytchB2BContext.mjs.map +1 -1
  109. package/dist/esm-dev/packages/core/src/public/b2b/ui.mjs.map +1 -1
  110. package/dist/esm-dev/packages/core/src/utils/dev.mjs +7 -1
  111. package/dist/esm-dev/packages/core/src/utils/dev.mjs.map +1 -1
  112. package/dist/esm-dev/packages/web/src/adminPortal/utils/theme.mjs +1 -1
  113. package/dist/esm-dev/packages/web/src/ui/b2b/App.mjs +14 -2
  114. package/dist/esm-dev/packages/web/src/ui/b2b/App.mjs.map +1 -1
  115. package/dist/esm-dev/packages/web/src/ui/b2b/components/Icons.mjs +3 -1
  116. package/dist/esm-dev/packages/web/src/ui/b2b/components/Icons.mjs.map +1 -1
  117. package/dist/esm-dev/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs +6 -3
  118. package/dist/esm-dev/packages/web/src/ui/b2b/components/OAuthB2BButton.mjs.map +1 -1
  119. package/dist/esm-dev/packages/web/src/ui/b2b/components/SSOButton.mjs +5 -3
  120. package/dist/esm-dev/packages/web/src/ui/b2b/components/SSOButton.mjs.map +1 -1
  121. package/dist/esm-dev/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs +6 -3
  122. package/dist/esm-dev/packages/web/src/ui/b2b/screens/SsoAndOAuthButtons.mjs.map +1 -1
  123. package/dist/esm-dev/packages/web/src/ui/b2b/types/authMethodKeys.mjs +2 -2
  124. package/dist/esm-dev/packages/web/src/ui/b2b/types/authMethodKeys.mjs.map +1 -1
  125. package/dist/esm-dev/packages/web/src/ui/b2c/AppContainer.mjs +8 -1
  126. package/dist/esm-dev/packages/web/src/ui/b2c/AppContainer.mjs.map +1 -1
  127. package/dist/esm-dev/packages/web/src/ui/b2c/IDPContainer.mjs +8 -1
  128. package/dist/esm-dev/packages/web/src/ui/b2c/IDPContainer.mjs.map +1 -1
  129. package/dist/esm-dev/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs +8 -1
  130. package/dist/esm-dev/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs.map +1 -1
  131. package/dist/esm-dev/packages/web/src/ui/b2c/ResetPasswordContainer.mjs +8 -1
  132. package/dist/esm-dev/packages/web/src/ui/b2c/ResetPasswordContainer.mjs.map +1 -1
  133. package/dist/esm-dev/packages/web/src/ui/b2c/components/OAuthButton.mjs +6 -3
  134. package/dist/esm-dev/packages/web/src/ui/b2c/components/OAuthButton.mjs.map +1 -1
  135. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +20 -39
  136. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
  137. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +15 -15
  138. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
  139. package/dist/esm-dev/packages/web/src/ui/compat/styleToTheme.mjs +15 -14
  140. package/dist/esm-dev/packages/web/src/ui/compat/styleToTheme.mjs.map +1 -1
  141. package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs +9 -3
  142. package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
  143. package/dist/esm-dev/packages/web/src/ui/components/atoms/Button.mjs.map +1 -1
  144. package/dist/esm-dev/packages/web/src/ui/components/atoms/Typography.module.css.mjs +2 -2
  145. package/dist/esm-dev/packages/web/src/ui/components/molecules/EmailInput.mjs +1 -1
  146. package/dist/esm-dev/packages/web/src/ui/components/molecules/EmailInput.mjs.map +1 -1
  147. package/dist/esm-dev/packages/web/src/ui/components/molecules/Input.mjs +1 -1
  148. package/dist/esm-dev/packages/web/src/ui/components/molecules/Input.mjs.map +1 -1
  149. package/dist/esm-dev/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs +1 -1
  150. package/dist/esm-dev/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs.map +1 -1
  151. package/dist/esm-dev/packages/web/src/ui/react/b2b/Stytch.mjs +1 -1
  152. package/dist/esm-dev/packages/web/src/ui/react/b2b/Stytch.mjs.map +1 -1
  153. package/dist/esm-dev/packages/web/src/ui/react/b2b/StytchB2BContext.mjs +1 -1
  154. package/dist/esm-dev/packages/web/src/ui/react/b2b/StytchB2BContext.mjs.map +1 -1
  155. package/dist/esm-dev/packages/web/src/ui/react/b2c/IdentityProvider.mjs +1 -1
  156. package/dist/esm-dev/packages/web/src/ui/react/b2c/IdentityProvider.mjs.map +1 -1
  157. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchContext.mjs +1 -1
  158. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchContext.mjs.map +1 -1
  159. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchLogin.mjs +1 -1
  160. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchLogin.mjs.map +1 -1
  161. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs +1 -1
  162. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs.map +1 -1
  163. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs +1 -1
  164. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs.map +1 -1
  165. package/dist/esm-dev/packages/web/src/ui/react/utils/errors.mjs +8 -4
  166. package/dist/esm-dev/packages/web/src/ui/react/utils/errors.mjs.map +1 -1
  167. package/dist/esm-dev/packages/web/src/utils/crypto.mjs +19 -14
  168. package/dist/esm-dev/packages/web/src/utils/crypto.mjs.map +1 -1
  169. package/dist/esm-dev/packages/web/src/utils/oauthProviderType.mjs +1 -1
  170. package/dist/esm-dev/packages/web/src/utils/oauthProviderType.mjs.map +1 -1
  171. package/dist/types/{PresentationConfig-Bqzf8zr3.d.ts → PresentationConfig-B2jX85oV.d.ts} +13 -2
  172. package/dist/types/{StytchB2BClient-CsY7ZNKh.d.ts → StytchB2BClient-D16e_lp1.d.ts} +2 -2
  173. package/dist/types/{StytchClient-DZRM_fM4.d.ts → StytchClient-BwQdJzdj.d.ts} +2 -2
  174. package/dist/types/adminPortal/index.d.ts +5 -5
  175. package/dist/types/b2b/index.d.ts +27 -19
  176. package/dist/types/b2b/index.headless.d.ts +5 -5
  177. package/dist/types/compat.d.ts +2 -2
  178. package/dist/types/{createAuthUrlHandler-BZoD2LDF.d.ts → createAuthUrlHandler-R1kNNQD_.d.ts} +2 -2
  179. package/dist/types/{idpHelpers-CD5sSDzA.d.ts → idpHelpers-BQP76WgZ.d.ts} +1 -1
  180. package/dist/types/index.d.ts +36 -16
  181. package/dist/types/index.headless.d.ts +5 -5
  182. package/dist/types/{shadcn-4-5byj93.d.ts → shadcn-CGdmyIUF.d.ts} +9 -6
  183. package/dist/types/{ui-DXrQ-gA8.d.ts → ui-B7IvSGQf.d.ts} +1 -1
  184. package/package.json +1 -1
  185. package/dist/cjs/index-Ni_dyEsz.js.map +0 -1
  186. package/dist/cjs/shadcn-B8TEzQMT.js.map +0 -1
  187. package/dist/cjs-dev/StytchSSRProxy-CxXsyme4.js.map +0 -1
  188. package/dist/cjs-dev/idpHelpers-BVMUYvt1.js.map +0 -1
  189. package/dist/cjs-dev/index-DdK3Jt4u.js.map +0 -1
  190. package/dist/cjs-dev/shadcn-C9ClUju1.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"crypto.mjs","sources":["../../../../../../../web/src/utils/crypto.tsx"],"sourcesContent":["import { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport * as React from 'react';\nimport { Wallets } from '@stytch/core/public';\nimport { encode } from 'bs58';\n\nimport { GenericWalletIcon } from '../assets';\nimport { PhantomIcon, MetamaskIcon, BinanceIcon, CoinbaseIcon } from '../assets/logo-color';\n\ntype ProviderRequest = ({\n method,\n params,\n}: {\n method: 'eth_requestAccounts' | 'personal_sign';\n params?: string[];\n}) => string[] | string;\n\ntype ETHProvider = {\n isMetaMask?: boolean;\n isCoinbaseWallet?: boolean;\n request: ProviderRequest;\n};\n\ndeclare global {\n interface Window {\n solana: {\n isPhantom?: boolean;\n connect: () => { publicKey: { toString: () => string } };\n request: ({\n method,\n params,\n }: {\n method: 'signMessage';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params: Record<string, any>;\n }) => { signature: Uint8Array };\n };\n\n ethereum: {\n isMetaMask?: boolean;\n isCoinbaseWallet?: boolean;\n request?: ({ method, params }: { method: string; params?: string[] }) => string[] | string;\n providers?: ETHProvider[];\n };\n\n BinanceChain: { request: ProviderRequest };\n }\n}\n\nconst hasMultipleEthereumWallets = () => !!window.ethereum?.providers;\n\nconst hasMetaMask = () =>\n !!(hasMultipleEthereumWallets()\n ? window.ethereum.providers?.find((wallet) => wallet.isMetaMask)\n : window.ethereum.isMetaMask);\n\nconst hasCoinbaseWallet = () =>\n !!(hasMultipleEthereumWallets()\n ? window.ethereum.providers?.find((wallet) => wallet.isCoinbaseWallet)\n : window.ethereum?.isCoinbaseWallet);\n\nconst hasOtherEthereumWallet = () => !hasMetaMask() && !hasCoinbaseWallet() && !!window.ethereum;\n\nconst getMetaMaskProvider = () =>\n hasMultipleEthereumWallets() ? window.ethereum.providers?.find((wallet) => wallet.isMetaMask) : window.ethereum;\n\nconst getCoinbaseProvider = () =>\n hasMultipleEthereumWallets() ? window.ethereum.providers?.find((wallet) => wallet.isCoinbaseWallet) : window.ethereum;\n\nconst getOtherInjectedProvider = () =>\n window.ethereum.providers?.find((wallet) => !wallet.isCoinbaseWallet && !wallet.isMetaMask);\n\nexport const WalletToIcon: Record<Wallets, React.FC> = {\n [Wallets.Phantom]: PhantomIcon,\n [Wallets.Binance]: BinanceIcon,\n [Wallets.Coinbase]: CoinbaseIcon,\n [Wallets.Metamask]: MetamaskIcon,\n [Wallets.GenericEthereumWallet]: GenericWalletIcon,\n [Wallets.GenericSolanaWallet]: GenericWalletIcon,\n};\n\nexport const WalletToText: Record<Wallets, MessageDescriptor> = {\n [Wallets.Phantom]: msg({ id: 'crypto.wallet.phantom', message: 'Phantom' }),\n [Wallets.Binance]: msg({ id: 'crypto.wallet.binance', message: 'Binance' }),\n [Wallets.Coinbase]: msg({ id: 'crypto.wallet.coinbase', message: 'Coinbase' }),\n [Wallets.Metamask]: msg({ id: 'crypto.wallet.metamask', message: 'Metamask' }),\n [Wallets.GenericEthereumWallet]: msg({ id: 'crypto.wallet.otherEthereum', message: 'Other Ethereum Wallet' }),\n [Wallets.GenericSolanaWallet]: msg({ id: 'crypto.wallet.otherSolana', message: 'Other Solana Wallet' }),\n};\n\nexport const isWalletVisible = (wallet: Wallets): boolean => {\n switch (wallet) {\n case Wallets.Metamask:\n return !!window.ethereum && hasMetaMask();\n case Wallets.Phantom:\n return (!!window.solana && window.solana?.isPhantom) ?? false;\n case Wallets.Binance:\n return !!window.BinanceChain;\n case Wallets.Coinbase:\n return !!window.ethereum && hasCoinbaseWallet();\n case Wallets.GenericEthereumWallet:\n return !!window.ethereum && hasOtherEthereumWallet();\n case Wallets.GenericSolanaWallet:\n return !!window.solana && !window.solana.isPhantom;\n default:\n return false;\n }\n};\n\nconst connectWithEthereumProvider = async (request: ProviderRequest): Promise<string> => {\n const [address] = await request({\n method: 'eth_requestAccounts',\n });\n return address;\n};\n\nexport const connectWithWallet = async ({ wallet }: { wallet: Wallets }): Promise<string> => {\n switch (wallet) {\n case Wallets.Metamask: {\n const provider = getMetaMaskProvider();\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.Phantom: {\n const connectResp = await window.solana.connect();\n return connectResp.publicKey.toString();\n }\n case Wallets.Binance: {\n const provider = window.BinanceChain;\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.Coinbase: {\n const provider = getCoinbaseProvider();\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.GenericEthereumWallet: {\n const provider = getOtherInjectedProvider();\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.GenericSolanaWallet: {\n const connectResp = await window.solana.connect();\n return connectResp.publicKey.toString();\n }\n default:\n return '';\n }\n};\n\nconst signMessageWithSolanaProvider = async (message: string): Promise<string> => {\n const encodedMessage = new TextEncoder().encode(message);\n const signResp = await window.solana.request({\n method: 'signMessage',\n params: {\n message: encodedMessage,\n display: 'utf8',\n },\n });\n return encode(signResp.signature);\n};\n\nconst signMessageWithEthereumProvider = async (\n request: ProviderRequest,\n message: string,\n address: string,\n): Promise<string> => {\n const signature = await request({\n method: 'personal_sign',\n params: [message, address],\n });\n return signature as string;\n};\n\nexport const signMessageWithWallet = async ({\n wallet,\n message,\n address,\n}: {\n wallet: Wallets;\n message: string;\n address: string;\n}): Promise<string> => {\n switch (wallet) {\n case Wallets.Phantom:\n case Wallets.GenericSolanaWallet:\n return signMessageWithSolanaProvider(message);\n case Wallets.Metamask: {\n const provider = getMetaMaskProvider();\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n case Wallets.Binance: {\n const provider = window.BinanceChain;\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n case Wallets.Coinbase: {\n const provider = getCoinbaseProvider();\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n case Wallets.GenericEthereumWallet: {\n const provider = getOtherInjectedProvider();\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n default:\n return '';\n }\n};\n\nexport const isSolanaWallet = (wallet: Wallets) => {\n const solanaWallets: Wallets[] = [Wallets.Phantom, Wallets.GenericSolanaWallet];\n return solanaWallets.includes(wallet);\n};\n\nexport const isEthereumWallet = (wallet: Wallets) => {\n const ethWallets: Wallets[] = [Wallets.Binance, Wallets.GenericEthereumWallet, Wallets.Coinbase, Wallets.Metamask];\n return ethWallets.includes(wallet);\n};\n"],"names":["hasMultipleEthereumWallets","window","ethereum","providers","hasMetaMask","find","wallet","isMetaMask","hasCoinbaseWallet","isCoinbaseWallet","hasOtherEthereumWallet","getMetaMaskProvider","getCoinbaseProvider","getOtherInjectedProvider","WalletToIcon","Wallets","Phantom","PhantomIcon","Binance","BinanceIcon","Coinbase","CoinbaseIcon","Metamask","MetamaskIcon","GenericEthereumWallet","GenericWalletIcon","GenericSolanaWallet","WalletToText","isWalletVisible","solana","isPhantom","BinanceChain","connectWithEthereumProvider","request","address","method","connectWithWallet","provider","connectResp","connect","publicKey","toString","signMessageWithSolanaProvider","message","encodedMessage","TextEncoder","encode","signResp","params","display","signature","signMessageWithEthereumProvider","signMessageWithWallet","isSolanaWallet","solanaWallets","includes"],"mappings":";;;;;;;;;;AAiDA,MAAMA,6BAA6B,IAAM,CAAC,CAACC,MAAAA,CAAOC,QAAQ,EAAEC,SAAAA;AAE5D,MAAMC,WAAAA,GAAc,IAClB,CAAC,EAAEJ,0BAAAA,EAAAA,GACCC,MAAAA,CAAOC,QAAQ,CAACC,SAAS,EAAEE,IAAAA,CAAK,CAACC,SAAWA,MAAAA,CAAOC,UAAU,IAC7DN,MAAAA,CAAOC,QAAQ,CAACK,UAAU,CAAD;AAE/B,MAAMC,iBAAAA,GAAoB,IACxB,CAAC,EAAER,0BAAAA,EAAAA,GACCC,MAAAA,CAAOC,QAAQ,CAACC,SAAS,EAAEE,IAAAA,CAAK,CAACC,SAAWA,MAAAA,CAAOG,gBAAgB,IACnER,MAAAA,CAAOC,QAAQ,EAAEO,gBAAe,CAAA;AAEtC,MAAMC,sBAAAA,GAAyB,IAAM,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AAA,KAAKnB,QAAQK,QAAQ;AAAE,YAAA;AACrB,gBAAA,MAAMiB,QAAAA,GAAWzB,mBAAAA,EAAAA;AACjB,gBAAA,OAAOyB,UAAUJ,OAAAA,GAAUkB,+BAAAA,CAAgCd,QAAAA,EAAUJ,OAAAA,EAASU,SAAST,OAAAA,CAAAA,GAAW,EAAA;AACpG,YAAA;AACA,QAAA,KAAKnB,QAAQS,qBAAqB;AAAE,YAAA;AAClC,gBAAA,MAAMa,QAAAA,GAAWxB,wBAAAA,EAAAA;AACjB,gBAAA,OAAOwB,UAAUJ,OAAAA,GAAUkB,+BAAAA,CAAgCd,QAAAA,EAAUJ,OAAAA,EAASU,SAAST,OAAAA,CAAAA,GAAW,EAAA;AACpG,YAAA;AACA,QAAA;YACE,OAAO,EAAA;AACX;AACF;AAEO,MAAMmB,iBAAiB,CAAC/C,MAAAA,GAAAA;AAC7B,IAAA,MAAMgD,aAAAA,GAA2B;AAACvC,QAAAA,OAAAA,CAAQC,OAAO;AAAED,QAAAA,OAAAA,CAAQW;AAAoB,KAAA;IAC/E,OAAO4B,aAAAA,CAAcC,QAAQ,CAACjD,MAAAA,CAAAA;AAChC;;;;"}
1
+ {"version":3,"file":"crypto.mjs","sources":["../../../../../../../web/src/utils/crypto.tsx"],"sourcesContent":["import { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { Wallets } from '@stytch/core/public';\nimport { encode } from 'bs58';\n\nimport { GenericWalletIcon } from '../assets';\nimport { cryptoIcons } from '../ui/b2c/components/Icons';\nimport { IconRegistry } from '../ui/components/IconRegistry';\nimport { getButtonId, usePresentation } from '../ui/components/PresentationConfig';\n\ntype ProviderRequest = ({\n method,\n params,\n}: {\n method: 'eth_requestAccounts' | 'personal_sign';\n params?: string[];\n}) => string[] | string;\n\ntype ETHProvider = {\n isMetaMask?: boolean;\n isCoinbaseWallet?: boolean;\n request: ProviderRequest;\n};\n\ndeclare global {\n interface Window {\n solana: {\n isPhantom?: boolean;\n connect: () => { publicKey: { toString: () => string } };\n request: ({\n method,\n params,\n }: {\n method: 'signMessage';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params: Record<string, any>;\n }) => { signature: Uint8Array };\n };\n\n ethereum: {\n isMetaMask?: boolean;\n isCoinbaseWallet?: boolean;\n request?: ({ method, params }: { method: string; params?: string[] }) => string[] | string;\n providers?: ETHProvider[];\n };\n\n BinanceChain: { request: ProviderRequest };\n }\n}\n\nconst hasMultipleEthereumWallets = () => !!window.ethereum?.providers;\n\nconst hasMetaMask = () =>\n !!(hasMultipleEthereumWallets()\n ? window.ethereum.providers?.find((wallet) => wallet.isMetaMask)\n : window.ethereum.isMetaMask);\n\nconst hasCoinbaseWallet = () =>\n !!(hasMultipleEthereumWallets()\n ? window.ethereum.providers?.find((wallet) => wallet.isCoinbaseWallet)\n : window.ethereum?.isCoinbaseWallet);\n\nconst hasOtherEthereumWallet = () => !hasMetaMask() && !hasCoinbaseWallet() && !!window.ethereum;\n\nconst getMetaMaskProvider = () =>\n hasMultipleEthereumWallets() ? window.ethereum.providers?.find((wallet) => wallet.isMetaMask) : window.ethereum;\n\nconst getCoinbaseProvider = () =>\n hasMultipleEthereumWallets() ? window.ethereum.providers?.find((wallet) => wallet.isCoinbaseWallet) : window.ethereum;\n\nconst getOtherInjectedProvider = () =>\n window.ethereum.providers?.find((wallet) => !wallet.isCoinbaseWallet && !wallet.isMetaMask);\n\ntype CryptoIcon = keyof typeof cryptoIcons;\nexport const walletIcons: Partial<Record<Wallets, CryptoIcon>> = {\n [Wallets.Phantom]: 'phantom',\n [Wallets.Binance]: 'binance',\n [Wallets.Coinbase]: 'coinbase',\n [Wallets.Metamask]: 'metamask',\n};\n\nexport const useCryptoButtonProps = () => {\n const presentation = usePresentation();\n const iconRegistry: IconRegistry<CryptoIcon> = presentation.iconRegistry;\n\n return {\n getIcon: (wallet: Wallets) => {\n const iconName = walletIcons[wallet];\n return iconName ? iconRegistry[iconName] : GenericWalletIcon;\n },\n getId: (wallet: Wallets) => getButtonId(`wallet-${wallet}`, presentation.options),\n };\n};\n\nexport const WalletToText: Record<Wallets, MessageDescriptor> = {\n [Wallets.Phantom]: msg({ id: 'crypto.wallet.phantom', message: 'Phantom' }),\n [Wallets.Binance]: msg({ id: 'crypto.wallet.binance', message: 'Binance' }),\n [Wallets.Coinbase]: msg({ id: 'crypto.wallet.coinbase', message: 'Coinbase' }),\n [Wallets.Metamask]: msg({ id: 'crypto.wallet.metamask', message: 'Metamask' }),\n [Wallets.GenericEthereumWallet]: msg({ id: 'crypto.wallet.otherEthereum', message: 'Other Ethereum Wallet' }),\n [Wallets.GenericSolanaWallet]: msg({ id: 'crypto.wallet.otherSolana', message: 'Other Solana Wallet' }),\n};\n\nexport const isWalletVisible = (wallet: Wallets): boolean => {\n switch (wallet) {\n case Wallets.Metamask:\n return !!window.ethereum && hasMetaMask();\n case Wallets.Phantom:\n return (!!window.solana && window.solana?.isPhantom) ?? false;\n case Wallets.Binance:\n return !!window.BinanceChain;\n case Wallets.Coinbase:\n return !!window.ethereum && hasCoinbaseWallet();\n case Wallets.GenericEthereumWallet:\n return !!window.ethereum && hasOtherEthereumWallet();\n case Wallets.GenericSolanaWallet:\n return !!window.solana && !window.solana.isPhantom;\n default:\n return false;\n }\n};\n\nconst connectWithEthereumProvider = async (request: ProviderRequest): Promise<string> => {\n const [address] = await request({\n method: 'eth_requestAccounts',\n });\n return address;\n};\n\nexport const connectWithWallet = async ({ wallet }: { wallet: Wallets }): Promise<string> => {\n switch (wallet) {\n case Wallets.Metamask: {\n const provider = getMetaMaskProvider();\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.Phantom: {\n const connectResp = await window.solana.connect();\n return connectResp.publicKey.toString();\n }\n case Wallets.Binance: {\n const provider = window.BinanceChain;\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.Coinbase: {\n const provider = getCoinbaseProvider();\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.GenericEthereumWallet: {\n const provider = getOtherInjectedProvider();\n return provider?.request ? connectWithEthereumProvider(provider?.request) : '';\n }\n case Wallets.GenericSolanaWallet: {\n const connectResp = await window.solana.connect();\n return connectResp.publicKey.toString();\n }\n default:\n return '';\n }\n};\n\nconst signMessageWithSolanaProvider = async (message: string): Promise<string> => {\n const encodedMessage = new TextEncoder().encode(message);\n const signResp = await window.solana.request({\n method: 'signMessage',\n params: {\n message: encodedMessage,\n display: 'utf8',\n },\n });\n return encode(signResp.signature);\n};\n\nconst signMessageWithEthereumProvider = async (\n request: ProviderRequest,\n message: string,\n address: string,\n): Promise<string> => {\n const signature = await request({\n method: 'personal_sign',\n params: [message, address],\n });\n return signature as string;\n};\n\nexport const signMessageWithWallet = async ({\n wallet,\n message,\n address,\n}: {\n wallet: Wallets;\n message: string;\n address: string;\n}): Promise<string> => {\n switch (wallet) {\n case Wallets.Phantom:\n case Wallets.GenericSolanaWallet:\n return signMessageWithSolanaProvider(message);\n case Wallets.Metamask: {\n const provider = getMetaMaskProvider();\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n case Wallets.Binance: {\n const provider = window.BinanceChain;\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n case Wallets.Coinbase: {\n const provider = getCoinbaseProvider();\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n case Wallets.GenericEthereumWallet: {\n const provider = getOtherInjectedProvider();\n return provider?.request ? signMessageWithEthereumProvider(provider?.request, message, address) : '';\n }\n default:\n return '';\n }\n};\n\nexport const isSolanaWallet = (wallet: Wallets) => {\n const solanaWallets: Wallets[] = [Wallets.Phantom, Wallets.GenericSolanaWallet];\n return solanaWallets.includes(wallet);\n};\n\nexport const isEthereumWallet = (wallet: Wallets) => {\n const ethWallets: Wallets[] = [Wallets.Binance, Wallets.GenericEthereumWallet, Wallets.Coinbase, Wallets.Metamask];\n return ethWallets.includes(wallet);\n};\n"],"names":["hasMultipleEthereumWallets","window","ethereum","providers","hasMetaMask","find","wallet","isMetaMask","hasCoinbaseWallet","isCoinbaseWallet","hasOtherEthereumWallet","getMetaMaskProvider","getCoinbaseProvider","getOtherInjectedProvider","walletIcons","Wallets","Phantom","Binance","Coinbase","Metamask","useCryptoButtonProps","presentation","usePresentation","iconRegistry","getIcon","iconName","GenericWalletIcon","getId","getButtonId","options","WalletToText","GenericEthereumWallet","GenericSolanaWallet","isWalletVisible","solana","isPhantom","BinanceChain","connectWithEthereumProvider","request","address","method","connectWithWallet","provider","connectResp","connect","publicKey","toString","signMessageWithSolanaProvider","message","encodedMessage","TextEncoder","encode","signResp","params","display","signature","signMessageWithEthereumProvider","signMessageWithWallet","isSolanaWallet","solanaWallets","includes"],"mappings":";;;;;;AAkDA,MAAMA,6BAA6B,IAAM,CAAC,CAACC,MAAAA,CAAOC,QAAQ,EAAEC,SAAAA;AAE5D,MAAMC,WAAAA,GAAc,IAClB,CAAC,EAAEJ,0BAAAA,EAAAA,GACCC,MAAAA,CAAOC,QAAQ,CAACC,SAAS,EAAEE,IAAAA,CAAK,CAACC,SAAWA,MAAAA,CAAOC,UAAU,IAC7DN,MAAAA,CAAOC,QAAQ,CAACK,UAAU,CAAD;AAE/B,MAAMC,iBAAAA,GAAoB,IACxB,CAAC,EAAER,0BAAAA,EAAAA,GACCC,MAAAA,CAAOC,QAAQ,CAACC,SAAS,EAAEE,IAAAA,CAAK,CAACC,SAAWA,MAAAA,CAAOG,gBAAgB,IACnER,MAAAA,CAAOC,QAAQ,EAAEO,gBAAe,CAAA;AAEtC,MAAMC,sBAAAA,GAAyB,IAAM,CAACN,WAAAA,EAAAA,IAAiB,CAACI,iBAAAA,EAAAA,IAAuB,CAAC,CAACP,MAAAA,CAAOC,QAAQ;AAEhG,MAAMS,mBAAAA,GAAsB,IAC1BX,0BAAAA,EAAAA,GAA+BC,MAAAA,CAAOC,QAAQ,CAACC,SAAS,EAAEE,IAAAA,CAAK,CAACC,MAAAA,GAA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YAAY;AACpC,gBAAA,OAAOM,UAAUJ,OAAAA,GAAUkB,+BAAAA,CAAgCd,QAAAA,EAAUJ,OAAAA,EAASU,SAAST,OAAAA,CAAAA,GAAW,EAAA;AACpG,YAAA;AACA,QAAA,KAAKxB,QAAQG,QAAQ;AAAE,YAAA;AACrB,gBAAA,MAAMwB,QAAAA,GAAW9B,mBAAAA,EAAAA;AACjB,gBAAA,OAAO8B,UAAUJ,OAAAA,GAAUkB,+BAAAA,CAAgCd,QAAAA,EAAUJ,OAAAA,EAASU,SAAST,OAAAA,CAAAA,GAAW,EAAA;AACpG,YAAA;AACA,QAAA,KAAKxB,QAAQgB,qBAAqB;AAAE,YAAA;AAClC,gBAAA,MAAMW,QAAAA,GAAW7B,wBAAAA,EAAAA;AACjB,gBAAA,OAAO6B,UAAUJ,OAAAA,GAAUkB,+BAAAA,CAAgCd,QAAAA,EAAUJ,OAAAA,EAASU,SAAST,OAAAA,CAAAA,GAAW,EAAA;AACpG,YAAA;AACA,QAAA;YACE,OAAO,EAAA;AACX;AACF;AAEO,MAAMmB,iBAAiB,CAACpD,MAAAA,GAAAA;AAC7B,IAAA,MAAMqD,aAAAA,GAA2B;AAAC5C,QAAAA,OAAAA,CAAQC,OAAO;AAAED,QAAAA,OAAAA,CAAQiB;AAAoB,KAAA;IAC/E,OAAO2B,aAAAA,CAAcC,QAAQ,CAACtD,MAAAA,CAAAA;AAChC;;;;"}
@@ -10,7 +10,7 @@ const getParamsFromB2BOAuthProviderConfig = (provider)=>{
10
10
  providerType = provider;
11
11
  } else {
12
12
  providerType = provider.type;
13
- if (provider.type === B2BOAuthProviders.Google && 'one_tap' in provider) {
13
+ if (provider.type === B2BOAuthProviders.Google && provider.one_tap) {
14
14
  oneTap = provider.one_tap;
15
15
  cancelOnTapOutside = provider.cancel_on_tap_outside;
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oauthProviderType.mjs","sources":["../../../../../../../web/src/utils/oauthProviderType.ts"],"sourcesContent":["import { B2BOAuthProviderConfig, B2BOAuthProviders } from '@stytch/core/public';\n\nexport const getParamsFromB2BOAuthProviderConfig = (provider: B2BOAuthProviderConfig) => {\n let providerType: B2BOAuthProviders;\n let oneTap = false;\n let customScopes: string[] = [];\n let providerParams: Record<string, string> = {};\n let cancelOnTapOutside: boolean | undefined = undefined;\n if (typeof provider === 'string') {\n providerType = provider;\n } else {\n providerType = provider.type;\n if (provider.type === B2BOAuthProviders.Google && 'one_tap' in provider) {\n oneTap = provider.one_tap;\n cancelOnTapOutside = provider.cancel_on_tap_outside;\n }\n customScopes = provider.customScopes || [];\n providerParams = provider.providerParams || {};\n }\n return {\n type: providerType,\n one_tap: oneTap,\n customScopes,\n providerParams,\n cancel_on_tap_outside: cancelOnTapOutside,\n };\n};\n"],"names":["getParamsFromB2BOAuthProviderConfig","provider","providerType","oneTap","customScopes","providerParams","cancelOnTapOutside","undefined","type","B2BOAuthProviders","Google","one_tap","cancel_on_tap_outside"],"mappings":";;AAEO,MAAMA,sCAAsC,CAACC,QAAAA,GAAAA;IAClD,IAAIC,YAAAA;AACJ,IAAA,IAAIC,MAAAA,GAAS,KAAA;AACb,IAAA,IAAIC,eAAyB,EAAE;AAC/B,IAAA,IAAIC,iBAAyC,EAAC;AAC9C,IAAA,IAAIC,kBAAAA,GAA0CC,SAAAA;IAC9C,IAAI,OAAON,aAAa,QAAA,EAAU;QAChCC,YAAAA,GAAeD,QAAAA;IACjB,CAAA,MAAO;AACLC,QAAAA,YAAAA,GAAeD,SAASO,IAAI;AAC5B,QAAA,IAAIP,SAASO,IAAI,KAAKC,kBAAkBC,MAAM,IAAI,aAAaT,QAAAA,EAAU;AACvEE,YAAAA,MAAAA,GAASF,SAASU,OAAO;AACzBL,YAAAA,kBAAAA,GAAqBL,SAASW,qBAAqB;AACrD,QAAA;QACAR,YAAAA,GAAeH,QAAAA,CAASG,YAAY,IAAI,EAAE;QAC1CC,cAAAA,GAAiBJ,QAAAA,CAASI,cAAc,IAAI,EAAC;AAC/C,IAAA;IACA,OAAO;QACLG,IAAAA,EAAMN,YAAAA;QACNS,OAAAA,EAASR,MAAAA;AACTC,QAAAA,YAAAA;AACAC,QAAAA,cAAAA;QACAO,qBAAAA,EAAuBN;AACzB,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"oauthProviderType.mjs","sources":["../../../../../../../web/src/utils/oauthProviderType.ts"],"sourcesContent":["import { B2BOAuthProviderConfig, B2BOAuthProviders } from '@stytch/core/public';\n\nexport const getParamsFromB2BOAuthProviderConfig = (provider: B2BOAuthProviderConfig) => {\n let providerType: B2BOAuthProviders;\n let oneTap = false;\n let customScopes: string[] = [];\n let providerParams: Record<string, string> = {};\n let cancelOnTapOutside: boolean | undefined = undefined;\n if (typeof provider === 'string') {\n providerType = provider;\n } else {\n providerType = provider.type;\n if (provider.type === B2BOAuthProviders.Google && provider.one_tap) {\n oneTap = provider.one_tap;\n cancelOnTapOutside = provider.cancel_on_tap_outside;\n }\n customScopes = provider.customScopes || [];\n providerParams = provider.providerParams || {};\n }\n return {\n type: providerType,\n one_tap: oneTap,\n customScopes,\n providerParams,\n cancel_on_tap_outside: cancelOnTapOutside,\n };\n};\n"],"names":["getParamsFromB2BOAuthProviderConfig","provider","providerType","oneTap","customScopes","providerParams","cancelOnTapOutside","undefined","type","B2BOAuthProviders","Google","one_tap","cancel_on_tap_outside"],"mappings":";;AAEO,MAAMA,sCAAsC,CAACC,QAAAA,GAAAA;IAClD,IAAIC,YAAAA;AACJ,IAAA,IAAIC,MAAAA,GAAS,KAAA;AACb,IAAA,IAAIC,eAAyB,EAAE;AAC/B,IAAA,IAAIC,iBAAyC,EAAC;AAC9C,IAAA,IAAIC,kBAAAA,GAA0CC,SAAAA;IAC9C,IAAI,OAAON,aAAa,QAAA,EAAU;QAChCC,YAAAA,GAAeD,QAAAA;IACjB,CAAA,MAAO;AACLC,QAAAA,YAAAA,GAAeD,SAASO,IAAI;QAC5B,IAAIP,QAAAA,CAASO,IAAI,KAAKC,iBAAAA,CAAkBC,MAAM,IAAIT,QAAAA,CAASU,OAAO,EAAE;AAClER,YAAAA,MAAAA,GAASF,SAASU,OAAO;AACzBL,YAAAA,kBAAAA,GAAqBL,SAASW,qBAAqB;AACrD,QAAA;QACAR,YAAAA,GAAeH,QAAAA,CAASG,YAAY,IAAI,EAAE;QAC1CC,cAAAA,GAAiBJ,QAAAA,CAASI,cAAc,IAAI,EAAC;AAC/C,IAAA;IACA,OAAO;QACLG,IAAAA,EAAMN,YAAAA;QACNS,OAAAA,EAASR,MAAAA;AACTC,QAAAA,YAAAA;AACAC,QAAAA,cAAAA;QACAO,qBAAAA,EAAuBN;AACzB,KAAA;AACF;;;;"}
@@ -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=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,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=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
- * return <p>Loading...</p>;
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
- * return <p>Loading...</p>;
41
+ * return <p>Loading...</p>;
42
42
  * }
43
- * return (<p>Welcome to {organization.organization_name}</p>);
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<Permissions>('documents', 'edit');
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 * 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<Permissions>('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
+ {"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: 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
+ {"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;;;;"}
@@ -5,6 +5,12 @@ import { StytchSDKUsageError } from '../public/SDKErrors.mjs';
5
5
  * NOTE: Be careful when wrapping render function return values. React before v18 do not allow undefined
6
6
  * to be returned, so wrapping the entire return value will crash those runtimes.
7
7
  */ const DEV = (input)=>input;
8
+ /**
9
+ * This function is stripped in production builds using rollup plugin. Useful for adding
10
+ * logging or validation in dev only
11
+ */ function RUN_IN_DEV(callback) {
12
+ callback();
13
+ }
8
14
  const validateInDev = (methodName, obj, rules)=>{
9
15
  const errors = [];
10
16
  for (const [key, rule] of Object.entries(rules)){
@@ -56,5 +62,5 @@ const validateInDev = (methodName, obj, rules)=>{
56
62
  }
57
63
  };
58
64
 
59
- export { DEV, validateInDev };
65
+ export { DEV, RUN_IN_DEV, validateInDev };
60
66
  //# sourceMappingURL=dev.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev.mjs","sources":["../../../../../../../core/src/utils/dev.ts"],"sourcesContent":["import { StytchSDKUsageError } from '../public';\n\n/**\n * This function and its parameter is stripped in production builds using rollup plugin.\n * NOTE: Be careful when wrapping render function return values. React before v18 do not allow undefined\n * to be returned, so wrapping the entire return value will crash those runtimes.\n */\nexport const DEV = <T>(input: T): T | undefined => input;\n\nexport type ValidateRule =\n | 'object'\n | 'optionalObject'\n | 'string'\n | 'optionalString'\n | 'number'\n | 'optionalNumber'\n | 'stringArray'\n | 'optionalStringArray'\n | 'boolean'\n | 'optionalBoolean';\n\nexport const validateInDev = <T extends Record<string, unknown>>(\n methodName: string,\n obj: T,\n rules: Partial<Record<keyof T, ValidateRule>>,\n) => {\n const errors: StytchSDKUsageError[] = [];\n for (const [key, rule] of Object.entries(rules)) {\n if (rule == null) continue;\n\n const val = obj[key];\n if (rule.startsWith('optional') && val == null) continue;\n\n switch (rule) {\n case 'object':\n case 'optionalObject': {\n const isObject = typeof val === 'object' && !Array.isArray(val) && val !== null;\n if (!isObject) {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be an object.`));\n }\n break;\n }\n\n case 'string':\n case 'optionalString':\n if (typeof val !== 'string') {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be a string.`));\n }\n break;\n\n case 'number':\n case 'optionalNumber':\n if (typeof val !== 'number') {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be a number.`));\n }\n break;\n\n case 'stringArray':\n case 'optionalStringArray':\n if (!Array.isArray(val) || !val.every((str) => typeof str === 'string')) {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be an array of strings.`));\n }\n break;\n\n case 'boolean':\n case 'optionalBoolean':\n if (typeof val !== 'boolean') {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be a boolean.`));\n }\n break;\n }\n }\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n throw new AggregateError(errors);\n }\n }\n};\n"],"names":["DEV","input","validateInDev","methodName","obj","rules","errors","key","rule","Object","entries","val","startsWith","isObject","Array","isArray","push","StytchSDKUsageError","every","str","length","AggregateError"],"mappings":";;AAEA;;;;AAIC,IACM,MAAMA,GAAAA,GAAM,CAAIC,QAA4BA;AAc5C,MAAMC,aAAAA,GAAgB,CAC3BC,UAAAA,EACAC,GAAAA,EACAC,KAAAA,GAAAA;AAEA,IAAA,MAAMC,SAAgC,EAAE;IAC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,CAACA,GAAAA,CAAIO,KAAK,CAAC,CAACC,GAAAA,GAAQ,OAAOA,QAAQ,QAAA,CAAA,EAAW;oBACvEb,MAAAA,CAAOU,IAAI,CAAC,IAAIC,mBAAAA,CAAoBd,YAAY,CAAA,EAAGI,GAAAA,CAAI,6BAA6B,CAAC,CAAA,CAAA;AACvF,gBAAA;AACA,gBAAA;YAEF,KAAK,SAAA;YACL,KAAK,iBAAA;gBACH,IAAI,OAAOI,QAAQ,SAAA,EAAW;oBAC5BL,MAAAA,CAAOU,IAAI,CAAC,IAAIC,mBAAAA,CAAoBd,YAAY,CAAA,EAAGI,GAAAA,CAAI,mBAAmB,CAAC,CAAA,CAAA;AAC7E,gBAAA;AACA,gBAAA;AACJ;AACF,IAAA;IAEA,IAAID,MAAAA,CAAOc,MAAM,GAAG,CAAA,EAAG;QACrB,IAAId,MAAAA,CAAOc,MAAM,KAAK,CAAA,EAAG;YACvB,MAAMd,MAAM,CAAC,CAAA,CAAE;QACjB,CAAA,MAAO;AACL,YAAA,MAAM,IAAIe,cAAAA,CAAef,MAAAA,CAAAA;AAC3B,QAAA;AACF,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"dev.mjs","sources":["../../../../../../../core/src/utils/dev.ts"],"sourcesContent":["import { StytchSDKUsageError } from '../public';\n\n/**\n * This function and its parameter is stripped in production builds using rollup plugin.\n * NOTE: Be careful when wrapping render function return values. React before v18 do not allow undefined\n * to be returned, so wrapping the entire return value will crash those runtimes.\n */\nexport const DEV = <T>(input: T): T | undefined => input;\n\n/**\n * This function is stripped in production builds using rollup plugin. Useful for adding\n * logging or validation in dev only\n */\nexport function RUN_IN_DEV(callback: () => void) {\n callback();\n}\n\nexport type ValidateRule =\n | 'object'\n | 'optionalObject'\n | 'string'\n | 'optionalString'\n | 'number'\n | 'optionalNumber'\n | 'stringArray'\n | 'optionalStringArray'\n | 'boolean'\n | 'optionalBoolean';\n\nexport const validateInDev = <T extends Record<string, unknown>>(\n methodName: string,\n obj: T,\n rules: Partial<Record<keyof T, ValidateRule>>,\n) => {\n const errors: StytchSDKUsageError[] = [];\n for (const [key, rule] of Object.entries(rules)) {\n if (rule == null) continue;\n\n const val = obj[key];\n if (rule.startsWith('optional') && val == null) continue;\n\n switch (rule) {\n case 'object':\n case 'optionalObject': {\n const isObject = typeof val === 'object' && !Array.isArray(val) && val !== null;\n if (!isObject) {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be an object.`));\n }\n break;\n }\n\n case 'string':\n case 'optionalString':\n if (typeof val !== 'string') {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be a string.`));\n }\n break;\n\n case 'number':\n case 'optionalNumber':\n if (typeof val !== 'number') {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be a number.`));\n }\n break;\n\n case 'stringArray':\n case 'optionalStringArray':\n if (!Array.isArray(val) || !val.every((str) => typeof str === 'string')) {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be an array of strings.`));\n }\n break;\n\n case 'boolean':\n case 'optionalBoolean':\n if (typeof val !== 'boolean') {\n errors.push(new StytchSDKUsageError(methodName, `${key} must be a boolean.`));\n }\n break;\n }\n }\n\n if (errors.length > 0) {\n if (errors.length === 1) {\n throw errors[0];\n } else {\n throw new AggregateError(errors);\n }\n }\n};\n"],"names":["DEV","input","RUN_IN_DEV","callback","validateInDev","methodName","obj","rules","errors","key","rule","Object","entries","val","startsWith","isObject","Array","isArray","push","StytchSDKUsageError","every","str","length","AggregateError"],"mappings":";;AAEA;;;;AAIC,IACM,MAAMA,GAAAA,GAAM,CAAIC,QAA4BA;AAEnD;;;IAIO,SAASC,UAAAA,CAAWC,QAAoB,EAAA;AAC7CA,IAAAA,QAAAA,EAAAA;AACF;AAcO,MAAMC,aAAAA,GAAgB,CAC3BC,UAAAA,EACAC,GAAAA,EACAC,KAAAA,GAAAA;AAEA,IAAA,MAAMC,SAAgC,EAAE;IACxC,KAAK,MAAM,CAACC,GAAAA,EAAKC,IAAAA,CAAK,IAAIC,MAAAA,CAAOC,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AA,CAAA,EAAW;oBACvEb,MAAAA,CAAOU,IAAI,CAAC,IAAIC,mBAAAA,CAAoBd,YAAY,CAAA,EAAGI,GAAAA,CAAI,6BAA6B,CAAC,CAAA,CAAA;AACvF,gBAAA;AACA,gBAAA;YAEF,KAAK,SAAA;YACL,KAAK,iBAAA;gBACH,IAAI,OAAOI,QAAQ,SAAA,EAAW;oBAC5BL,MAAAA,CAAOU,IAAI,CAAC,IAAIC,mBAAAA,CAAoBd,YAAY,CAAA,EAAGI,GAAAA,CAAI,mBAAmB,CAAC,CAAA,CAAA;AAC7E,gBAAA;AACA,gBAAA;AACJ;AACF,IAAA;IAEA,IAAID,MAAAA,CAAOc,MAAM,GAAG,CAAA,EAAG;QACrB,IAAId,MAAAA,CAAOc,MAAM,KAAK,CAAA,EAAG;YACvB,MAAMd,MAAM,CAAC,CAAA,CAAE;QACjB,CAAA,MAAO;AACL,YAAA,MAAM,IAAIe,cAAAA,CAAef,MAAAA,CAAAA;AAC3B,QAAA;AACF,IAAA;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- import merge from '../../../../../_virtual/index3.mjs';
1
+ import merge from '../../../../../_virtual/index4.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';
@@ -8,12 +8,19 @@ import { IDPContextProvider } from '../components/organisms/IDPContextProvider.m
8
8
  import { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper.mjs';
9
9
  import { messages } from '../../messages/b2b/en.mjs';
10
10
  import { IDPConsentScreen } from './screens/IDPConsent.mjs';
11
+ import { RUN_IN_DEV } from '../../../../core/src/utils/dev.mjs';
12
+ import { logger } from '../../../../core/src/utils/logger.mjs';
11
13
 
12
14
  /**
13
15
  * Wrapper to add default organizationProducts value. This is done to preserve the ability for a future
14
16
  * component that doesn't do this, allowing B2B products to be properly tree-shaken (which is also why this is currently
15
17
  * in a completely different file)
16
- */ const AppContainer = ({ config, ...props })=>{
18
+ */ const AppContainer = ({ config, styles, ...props })=>{
19
+ RUN_IN_DEV(()=>{
20
+ if (styles) {
21
+ logger.error('styles is deprecated and has no effect. Use the presentation prop instead.\n' + 'See https://staging.stytch.com/docs/api-reference/b2b/frontend-sdks/react/upgrade-guide');
22
+ }
23
+ });
17
24
  const internalConfig = {
18
25
  ...config,
19
26
  organizationProducts: Object.values(B2BProducts)
@@ -23,7 +30,7 @@ import { IDPConsentScreen } from './screens/IDPConsent.mjs';
23
30
  ...props
24
31
  });
25
32
  };
26
- const B2BIDPContainer = ({ client, presentation, callbacks, strings, getIDPConsentManifest, trustedAuthTokenParams })=>{
33
+ const B2BIDPContainer = ({ client, presentation, callbacks, strings, getIDPConsentManifest, trustedAuthTokenParams, styles })=>{
27
34
  const presentationValue = usePresentationWithDefault(presentation, false, []);
28
35
  useEffect(()=>{
29
36
  readB2BInternals(client).bootstrap.getAsync().then((data)=>{
@@ -37,6 +44,11 @@ const B2BIDPContainer = ({ client, presentation, callbacks, strings, getIDPConse
37
44
  }, [
38
45
  client
39
46
  ]);
47
+ RUN_IN_DEV(()=>{
48
+ if (styles) {
49
+ logger.error('styles is deprecated and has no effect. Use the presentation prop instead.\n' + 'See https://staging.stytch.com/docs/api-reference/b2b/frontend-sdks/react/upgrade-guide');
50
+ }
51
+ });
40
52
  return /*#__PURE__*/ React__default.createElement(GlobalContextProvider, {
41
53
  client: client,
42
54
  config: {},
@@ -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 = ({ config, ...props }: B2BSDKConfig<StytchProjectConfigurationInput>) => {\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}: B2BIDPSDKConfig<TProjectConfiguration>) => {\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 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","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":";;;;;;;;;;;AAaA;;;;UAKaA,YAAAA,GAAe,CAAC,EAAEC,MAAM,EAAE,GAAGC,KAAAA,EAAsD,GAAA;AAC9F,IAAA,MAAMC,cAAAA,GAAiB;AACrB,QAAA,GAAGF,MAAM;QACTG,oBAAAA,EAAsBC,MAAAA,CAAOC,MAAM,CAACC,WAAAA;AACtC,KAAA;AAEA,IAAA,qBAAOC,cAAA,CAAA,aAAA,CAACC,oBAAAA,EAAAA;QAAqBR,MAAAA,EAAQE,cAAAA;AAAiB,QAAA,GAAGD;;AAC3D;AAEO,MAAMQ,eAAAA,GAAkB,CAAgE,EAC7FC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,qBAAqB,EACrBC,sBAAsB,EACiB,GAAA;AACvC,IAAA,MAAMC,iBAAAA,GAAoBC,0BAAAA,CAA2BN,YAAAA,EAAc,KAAA,EAAO,EAAE,CAAA;IAE5EO,SAAAA,CAAU,IAAA;AACRC,QAAAA,gBAAAA,CAAiBT,QACdU,SAAS,CAACC,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAACC,IAAAA,GAAAA;AACLJ,YAAAA,gBAAAA,CAAiBT,MAAAA,CAAAA,CAAQc,aAAa,CAACC,QAAQ,CAAC;gBAC9CC,IAAAA,EAAM,uBAAA;gBACNC,OAAAA,EAAS;oBAAEP,SAAAA,EAAWG;AAAK;AAC7B,aAAA,CAAA;AACF,QAAA,CAAA,CAAA;IACJ,CAAA,EAAG;AAACb,QAAAA;AAAO,KAAA,CAAA;AAEX,IAAA,qBACEH,cAAA,CAAA,aAAA,CAACqB,qBAAAA,EAAAA;QACClB,MAAAA,EAAQA,MAAAA;AACRV,QAAAA,MAAAA,EAAQ,EAAC;QACTY,SAAAA,EAAWA,SAAAA;QACXiB,YAAAA,EAAcC;qBAEdvB,cAAA,CAAA,aAAA,CAACwB,kBAAAA,EAAAA;QAAmBC,wBAAAA,EAA0BlB,qBAAAA;QAAuBmB,eAAAA,EAAiBlB;AACpF,KAAA,gBAAAR,cAAA,CAAA,aAAA,CAAC2B,oBAAoBC,QAAQ,EAAA;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;;;;"}
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","RUN_IN_DEV","logger","error","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,EACN,GAAGC,KAAAA,EACiE,GAAA;IACpEC,UAAAA,CAAW,IAAA;AACT,QAAA,IAAIF,MAAAA,EAAQ;YACVG,MAAAA,CAAOC,KAAK,CACV,8EAAA,GACE,yFAAA,CAAA;AAEN,QAAA;AACF,IAAA,CAAA,CAAA;AAEA,IAAA,MAAMC,cAAAA,GAAiB;AACrB,QAAA,GAAGN,MAAM;QACTO,oBAAAA,EAAsBC,MAAAA,CAAOC,MAAM,CAACC,WAAAA;AACtC,KAAA;AAEA,IAAA,qBAAOC,cAAA,CAAA,aAAA,CAACC,oBAAAA,EAAAA;QAAqBZ,MAAAA,EAAQM,cAAAA;AAAiB,QAAA,GAAGJ;;AAC3D;MAEaW,eAAAA,GAAkB,CAAgE,EAC7FC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,qBAAqB,EACrBC,sBAAsB,EACtBlB,MAAM,EACuD,GAAA;AAC7D,IAAA,MAAMmB,iBAAAA,GAAoBC,0BAAAA,CAA2BN,YAAAA,EAAc,KAAA,EAAO,EAAE,CAAA;IAE5EO,SAAAA,CAAU,IAAA;AACRC,QAAAA,gBAAAA,CAAiBT,QACdU,SAAS,CAACC,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAACC,IAAAA,GAAAA;AACLJ,YAAAA,gBAAAA,CAAiBT,MAAAA,CAAAA,CAAQc,aAAa,CAACC,QAAQ,CAAC;gBAC9CC,IAAAA,EAAM,uBAAA;gBACNC,OAAAA,EAAS;oBAAEP,SAAAA,EAAWG;AAAK;AAC7B,aAAA,CAAA;AACF,QAAA,CAAA,CAAA;IACJ,CAAA,EAAG;AAACb,QAAAA;AAAO,KAAA,CAAA;IAEXX,UAAAA,CAAW,IAAA;AACT,QAAA,IAAIF,MAAAA,EAAQ;YACVG,MAAAA,CAAOC,KAAK,CACV,8EAAA,GACE,yFAAA,CAAA;AAEN,QAAA;AACF,IAAA,CAAA,CAAA;AAEA,IAAA,qBACEM,cAAA,CAAA,aAAA,CAACqB,qBAAAA,EAAAA;QACClB,MAAAA,EAAQA,MAAAA;AACRd,QAAAA,MAAAA,EAAQ,EAAC;QACTgB,SAAAA,EAAWA,SAAAA;QACXiB,YAAAA,EAAcC;qBAEdvB,cAAA,CAAA,aAAA,CAACwB,kBAAAA,EAAAA;QAAmBC,wBAAAA,EAA0BlB,qBAAAA;QAAuBmB,eAAAA,EAAiBlB;AACpF,KAAA,gBAAAR,cAAA,CAAA,aAAA,CAAC2B,oBAAoBC,QAAQ,EAAA;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":";;;;;;;;;;;MAWaA,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;AACX;;;;"}
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 iconRegistry = usePresentation().iconRegistry;
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> = 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","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IAAAA,CAAAA;AACV,IAAA;AAEA,IAAA,MAAME,aAAAA,GAAgB,UAAA;AACpB,QAAA,MAAMC,cAAAA,GAAiBZ,YAAAA,CAAaa,KAAK,CAACrB,YAAAA,CAAa;AAEvD,QAAA,IAAIU,KAAAA,CAAMY,SAAS,CAACC,YAAY,EAAE;YAChC,MAAMH,cAAAA,CAAeI,KAAK,CAAC;gBACzBC,kBAAAA,EAAoBxB,gBAAAA;gBACpByB,mBAAAA,EAAqBxB,iBAAAA;gBACrByB,aAAAA,EAAevB,YAAAA;AACfwB,gBAAAA,eAAAA,EAAiBlB,KAAAA,CAAMY,SAAS,CAACC,YAAY,CAACK,eAAe;gBAC7DC,eAAAA,EAAiBxB;AACnB,aAAA,CAAA;QACF,CAAA,MAAO;AACL,YAAA,MAAMe,cAAAA,CAAeU,SAAS,CAACN,KAAK,CAAC;gBACnCO,sBAAAA,EAAwB5B,oBAAAA;gBACxBwB,aAAAA,EAAevB,YAAAA;gBACfyB,eAAAA,EAAiBxB;AACnB,aAAA,CAAA;AACF,QAAA;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(`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,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,GAAA,EAAA,GAAQ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,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","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GlE;;;;"}
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","loginRedirect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AAA,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
  };