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

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 (149) hide show
  1. package/CHANGELOG.md +6 -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 +14 -13
  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 +508 -518
  11. package/dist/cjs/index.cjs.map +1 -1
  12. package/dist/cjs/{shadcn-B8TEzQMT.js → shadcn-Z4AvHriT.js} +247 -233
  13. package/dist/cjs/shadcn-Z4AvHriT.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 +80 -68
  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 +738 -727
  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-DnNfms7-.js} +257 -242
  37. package/dist/cjs-dev/shadcn-DnNfms7-.js.map +1 -0
  38. package/dist/esm/b2b/StytchB2BContext.mjs +5 -5
  39. package/dist/esm/b2b/StytchB2BContext.mjs.map +1 -1
  40. package/dist/esm/packages/core/src/public/b2b/ui.mjs.map +1 -1
  41. package/dist/esm/packages/web/src/ui/b2b/App.mjs +2 -2
  42. package/dist/esm/packages/web/src/ui/b2b/App.mjs.map +1 -1
  43. package/dist/esm/packages/web/src/ui/b2b/components/Icons.mjs +3 -1
  44. package/dist/esm/packages/web/src/ui/b2b/components/Icons.mjs.map +1 -1
  45. package/dist/esm/packages/web/src/ui/b2c/AppContainer.mjs +1 -1
  46. package/dist/esm/packages/web/src/ui/b2c/AppContainer.mjs.map +1 -1
  47. package/dist/esm/packages/web/src/ui/b2c/IDPContainer.mjs +1 -1
  48. package/dist/esm/packages/web/src/ui/b2c/IDPContainer.mjs.map +1 -1
  49. package/dist/esm/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs +1 -1
  50. package/dist/esm/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs.map +1 -1
  51. package/dist/esm/packages/web/src/ui/b2c/ResetPasswordContainer.mjs +1 -1
  52. package/dist/esm/packages/web/src/ui/b2c/ResetPasswordContainer.mjs.map +1 -1
  53. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +12 -11
  54. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
  55. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +12 -14
  56. package/dist/esm/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
  57. package/dist/esm/packages/web/src/ui/compat/styleToTheme.mjs +2 -0
  58. package/dist/esm/packages/web/src/ui/compat/styleToTheme.mjs.map +1 -1
  59. package/dist/esm/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
  60. package/dist/esm/packages/web/src/ui/components/atoms/Typography.module.css.mjs +2 -2
  61. package/dist/esm/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs +1 -1
  62. package/dist/esm/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs.map +1 -1
  63. package/dist/esm/packages/web/src/ui/react/b2b/Stytch.mjs +1 -1
  64. package/dist/esm/packages/web/src/ui/react/b2b/Stytch.mjs.map +1 -1
  65. package/dist/esm/packages/web/src/ui/react/b2b/StytchB2BContext.mjs +1 -1
  66. package/dist/esm/packages/web/src/ui/react/b2b/StytchB2BContext.mjs.map +1 -1
  67. package/dist/esm/packages/web/src/ui/react/b2c/IdentityProvider.mjs +1 -1
  68. package/dist/esm/packages/web/src/ui/react/b2c/IdentityProvider.mjs.map +1 -1
  69. package/dist/esm/packages/web/src/ui/react/b2c/StytchContext.mjs +1 -1
  70. package/dist/esm/packages/web/src/ui/react/b2c/StytchContext.mjs.map +1 -1
  71. package/dist/esm/packages/web/src/ui/react/b2c/StytchLogin.mjs +1 -1
  72. package/dist/esm/packages/web/src/ui/react/b2c/StytchLogin.mjs.map +1 -1
  73. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs +1 -1
  74. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs.map +1 -1
  75. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs +1 -1
  76. package/dist/esm/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs.map +1 -1
  77. package/dist/esm/packages/web/src/ui/react/utils/errors.mjs.map +1 -1
  78. package/dist/esm/packages/web/src/utils/crypto.mjs +15 -14
  79. package/dist/esm/packages/web/src/utils/crypto.mjs.map +1 -1
  80. package/dist/esm/packages/web/src/utils/oauthProviderType.mjs +1 -1
  81. package/dist/esm/packages/web/src/utils/oauthProviderType.mjs.map +1 -1
  82. package/dist/esm-dev/b2b/StytchB2BContext.mjs +5 -5
  83. package/dist/esm-dev/b2b/StytchB2BContext.mjs.map +1 -1
  84. package/dist/esm-dev/packages/core/src/public/b2b/ui.mjs.map +1 -1
  85. package/dist/esm-dev/packages/core/src/utils/dev.mjs +7 -1
  86. package/dist/esm-dev/packages/core/src/utils/dev.mjs.map +1 -1
  87. package/dist/esm-dev/packages/web/src/ui/b2b/App.mjs +14 -2
  88. package/dist/esm-dev/packages/web/src/ui/b2b/App.mjs.map +1 -1
  89. package/dist/esm-dev/packages/web/src/ui/b2b/components/Icons.mjs +3 -1
  90. package/dist/esm-dev/packages/web/src/ui/b2b/components/Icons.mjs.map +1 -1
  91. package/dist/esm-dev/packages/web/src/ui/b2c/AppContainer.mjs +8 -1
  92. package/dist/esm-dev/packages/web/src/ui/b2c/AppContainer.mjs.map +1 -1
  93. package/dist/esm-dev/packages/web/src/ui/b2c/IDPContainer.mjs +8 -1
  94. package/dist/esm-dev/packages/web/src/ui/b2c/IDPContainer.mjs.map +1 -1
  95. package/dist/esm-dev/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs +8 -1
  96. package/dist/esm-dev/packages/web/src/ui/b2c/PasskeyRegistrationContainer.mjs.map +1 -1
  97. package/dist/esm-dev/packages/web/src/ui/b2c/ResetPasswordContainer.mjs +8 -1
  98. package/dist/esm-dev/packages/web/src/ui/b2c/ResetPasswordContainer.mjs.map +1 -1
  99. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs +12 -11
  100. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/SetupNewWallet.mjs.map +1 -1
  101. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs +12 -14
  102. package/dist/esm-dev/packages/web/src/ui/b2c/screens/Crypto/WalletButtons.mjs.map +1 -1
  103. package/dist/esm-dev/packages/web/src/ui/compat/styleToTheme.mjs +15 -14
  104. package/dist/esm-dev/packages/web/src/ui/compat/styleToTheme.mjs.map +1 -1
  105. package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs +3 -2
  106. package/dist/esm-dev/packages/web/src/ui/components/PresentationConfig.mjs.map +1 -1
  107. package/dist/esm-dev/packages/web/src/ui/components/atoms/Typography.module.css.mjs +2 -2
  108. package/dist/esm-dev/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs +1 -1
  109. package/dist/esm-dev/packages/web/src/ui/react/b2b/B2BIdentityProvider.mjs.map +1 -1
  110. package/dist/esm-dev/packages/web/src/ui/react/b2b/Stytch.mjs +1 -1
  111. package/dist/esm-dev/packages/web/src/ui/react/b2b/Stytch.mjs.map +1 -1
  112. package/dist/esm-dev/packages/web/src/ui/react/b2b/StytchB2BContext.mjs +1 -1
  113. package/dist/esm-dev/packages/web/src/ui/react/b2b/StytchB2BContext.mjs.map +1 -1
  114. package/dist/esm-dev/packages/web/src/ui/react/b2c/IdentityProvider.mjs +1 -1
  115. package/dist/esm-dev/packages/web/src/ui/react/b2c/IdentityProvider.mjs.map +1 -1
  116. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchContext.mjs +1 -1
  117. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchContext.mjs.map +1 -1
  118. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchLogin.mjs +1 -1
  119. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchLogin.mjs.map +1 -1
  120. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs +1 -1
  121. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasskeyRegistration.mjs.map +1 -1
  122. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs +1 -1
  123. package/dist/esm-dev/packages/web/src/ui/react/b2c/StytchPasswordReset.mjs.map +1 -1
  124. package/dist/esm-dev/packages/web/src/ui/react/utils/errors.mjs +8 -4
  125. package/dist/esm-dev/packages/web/src/ui/react/utils/errors.mjs.map +1 -1
  126. package/dist/esm-dev/packages/web/src/utils/crypto.mjs +15 -14
  127. package/dist/esm-dev/packages/web/src/utils/crypto.mjs.map +1 -1
  128. package/dist/esm-dev/packages/web/src/utils/oauthProviderType.mjs +1 -1
  129. package/dist/esm-dev/packages/web/src/utils/oauthProviderType.mjs.map +1 -1
  130. package/dist/types/{PresentationConfig-Bqzf8zr3.d.ts → PresentationConfig-CcNEXkjS.d.ts} +5 -1
  131. package/dist/types/{StytchB2BClient-CsY7ZNKh.d.ts → StytchB2BClient-D16e_lp1.d.ts} +2 -2
  132. package/dist/types/{StytchClient-DZRM_fM4.d.ts → StytchClient-BwQdJzdj.d.ts} +2 -2
  133. package/dist/types/adminPortal/index.d.ts +5 -5
  134. package/dist/types/b2b/index.d.ts +27 -19
  135. package/dist/types/b2b/index.headless.d.ts +5 -5
  136. package/dist/types/compat.d.ts +2 -2
  137. package/dist/types/{createAuthUrlHandler-BZoD2LDF.d.ts → createAuthUrlHandler-R1kNNQD_.d.ts} +2 -2
  138. package/dist/types/{idpHelpers-CD5sSDzA.d.ts → idpHelpers-BQP76WgZ.d.ts} +1 -1
  139. package/dist/types/index.d.ts +36 -16
  140. package/dist/types/index.headless.d.ts +5 -5
  141. package/dist/types/{shadcn-4-5byj93.d.ts → shadcn-B04UXoBD.d.ts} +9 -6
  142. package/dist/types/{ui-DXrQ-gA8.d.ts → ui-B7IvSGQf.d.ts} +1 -1
  143. package/package.json +1 -1
  144. package/dist/cjs/index-Ni_dyEsz.js.map +0 -1
  145. package/dist/cjs/shadcn-B8TEzQMT.js.map +0 -1
  146. package/dist/cjs-dev/StytchSSRProxy-CxXsyme4.js.map +0 -1
  147. package/dist/cjs-dev/idpHelpers-BVMUYvt1.js.map +0 -1
  148. package/dist/cjs-dev/index-DdK3Jt4u.js.map +0 -1
  149. package/dist/cjs-dev/shadcn-C9ClUju1.js.map +0 -1
@@ -7,8 +7,10 @@ import { readB2CInternals } from '../../utils/internal.mjs';
7
7
  import { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig.mjs';
8
8
  import { passwords } from './Products.mjs';
9
9
  import { addProduct } from './utils.mjs';
10
+ import { RUN_IN_DEV } from '../../../../core/src/utils/dev.mjs';
11
+ import { logger } from '../../../../core/src/utils/logger.mjs';
10
12
 
11
- const ResetPasswordContainer = ({ client, config: rawConfig, presentation, callbacks, strings, passwordResetToken: rawToken })=>{
13
+ const ResetPasswordContainer = ({ client, config: rawConfig, presentation, callbacks, strings, styles, passwordResetToken: rawToken })=>{
12
14
  const config = addProduct(rawConfig, passwords);
13
15
  // Default to reading token from URL if not provided
14
16
  let token = rawToken;
@@ -30,6 +32,11 @@ const ResetPasswordContainer = ({ client, config: rawConfig, presentation, callb
30
32
  }, [
31
33
  client
32
34
  ]);
35
+ RUN_IN_DEV(()=>{
36
+ if (styles) {
37
+ logger.error('styles is deprecated and has no effect. Use the presentation prop instead.\n' + 'See https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/upgrade-guide#step-by-step-guide');
38
+ }
39
+ });
33
40
  const initialState = {
34
41
  ...DEFAULT_STATE,
35
42
  screen: AppScreens.PasswordResetForm,
@@ -1 +1 @@
1
- {"version":3,"file":"ResetPasswordContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/ResetPasswordContainer.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { messages } from '../../messages/en';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { GlobalContextProvider, DEFAULT_STATE, AppState, AppScreens } from './GlobalContextProvider';\nimport Container from './Container';\nimport { ResetPasswordSDKConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig';\nimport { passwords } from './Products';\nimport { addProduct } from './utils';\n\nexport const ResetPasswordContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n config: rawConfig,\n presentation,\n callbacks,\n strings,\n passwordResetToken: rawToken,\n}: ResetPasswordSDKConfig<TProjectConfiguration>) => {\n const config = addProduct(rawConfig, passwords);\n\n // Default to reading token from URL if not provided\n let token = rawToken;\n if (!token) {\n const result = client.parseAuthenticateUrl();\n if (result?.tokenType === 'reset_password' || result?.tokenType === 'login') {\n token = result.token;\n }\n }\n\n // Read the watermark out of sync storage, then read it out of async storage\n const [displayWatermark, setDisplayWatermark] = useState(() => {\n const { displayWatermark } = readB2CInternals(client).bootstrap.getSync();\n return displayWatermark;\n });\n useEffect(() => {\n readB2CInternals(client)\n .bootstrap.getAsync()\n .then(({ displayWatermark }) => {\n setDisplayWatermark(displayWatermark);\n });\n }, [client]);\n\n const initialState: AppState = {\n ...DEFAULT_STATE,\n screen: AppScreens.PasswordResetForm,\n formState: {\n ...DEFAULT_STATE.formState,\n resetPasswordState: {\n token: token!,\n },\n },\n };\n\n const presentationValue = usePresentationWithDefault(presentation, displayWatermark, config.products, 'Products');\n\n return (\n <GlobalContextProvider client={client} config={config} callbacks={callbacks} initialState={initialState}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <Container />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </GlobalContextProvider>\n );\n};\n"],"names":["ResetPasswordContainer","client","config","rawConfig","presentation","callbacks","strings","passwordResetToken","rawToken","addProduct","passwords","token","result","parseAuthenticateUrl","tokenType","displayWatermark","setDisplayWatermark","useState","readB2CInternals","bootstrap","getSync","useEffect","getAsync","then","initialState","DEFAULT_STATE","screen","AppScreens","PasswordResetForm","formState","resetPasswordState","presentationValue","usePresentationWithDefault","products","React","GlobalContextProvider","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","Container"],"mappings":";;;;;;;;;;MAYaA,sBAAAA,GAAyB,CAAgE,EACpGC,MAAM,EACNC,MAAAA,EAAQC,SAAS,EACjBC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,kBAAAA,EAAoBC,QAAQ,EACkB,GAAA;IAC9C,MAAMN,MAAAA,GAASO,WAAWN,SAAAA,EAAWO,SAAAA,CAAAA;;AAGrC,IAAA,IAAIC,KAAAA,GAAQH,QAAAA;AACZ,IAAA,IAAI,CAACG,KAAAA,EAAO;QACV,MAAMC,MAAAA,GAASX,OAAOY,oBAAoB,EAAA;AAC1C,QAAA,IAAID,MAAAA,EAAQE,SAAAA,KAAc,gBAAA,IAAoBF,MAAAA,EAAQE,cAAc,OAAA,EAAS;AAC3EH,YAAAA,KAAAA,GAAQC,OAAOD,KAAK;AACtB,QAAA;AACF,IAAA;;AAGA,IAAA,MAAM,CAACI,gBAAAA,EAAkBC,mBAAAA,CAAoB,GAAGC,QAAAA,CAAS,IAAA;QACvD,MAAM,EAAEF,gBAAgB,EAAE,GAAGG,iBAAiBjB,MAAAA,CAAAA,CAAQkB,SAAS,CAACC,OAAO,EAAA;QACvE,OAAOL,gBAAAA;AACT,IAAA,CAAA,CAAA;IACAM,SAAAA,CAAU,IAAA;QACRH,gBAAAA,CAAiBjB,MAAAA,CAAAA,CACdkB,SAAS,CAACG,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAAC,EAAER,gBAAgB,EAAE,GAAA;YACzBC,mBAAAA,CAAoBD,gBAAAA,CAAAA;AACtB,QAAA,CAAA,CAAA;IACJ,CAAA,EAAG;AAACd,QAAAA;AAAO,KAAA,CAAA;AAEX,IAAA,MAAMuB,YAAAA,GAAyB;AAC7B,QAAA,GAAGC,aAAa;AAChBC,QAAAA,MAAAA,EAAQC,WAAWC,iBAAiB;QACpCC,SAAAA,EAAW;AACT,YAAA,GAAGJ,cAAcI,SAAS;YAC1BC,kBAAAA,EAAoB;gBAClBnB,KAAAA,EAAOA;AACT;AACF;AACF,KAAA;AAEA,IAAA,MAAMoB,oBAAoBC,0BAAAA,CAA2B5B,YAAAA,EAAcW,gBAAAA,EAAkBb,MAAAA,CAAO+B,QAAQ,EAAE,UAAA,CAAA;AAEtG,IAAA,qBACEC,cAAA,CAAA,aAAA,CAACC,qBAAAA,EAAAA;QAAsBlC,MAAAA,EAAQA,MAAAA;QAAQC,MAAAA,EAAQA,MAAAA;QAAQG,SAAAA,EAAWA,SAAAA;QAAWmB,YAAAA,EAAcA;AACzF,KAAA,gBAAAU,cAAA,CAAA,aAAA,CAACE,oBAAoBC,QAAQ,EAAA;QAACC,KAAAA,EAAOP;qBACnCG,cAAA,CAAA,aAAA,CAACK,mBAAAA,EAAAA;QAAoBC,QAAAA,EAAUA,QAAAA;QAAUC,SAAAA,EAAWnC;qBAClD4B,cAAA,CAAA,aAAA,CAACQ,YAAAA,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAKX;;;;"}
1
+ {"version":3,"file":"ResetPasswordContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/ResetPasswordContainer.tsx"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { messages } from '../../messages/en';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { GlobalContextProvider, DEFAULT_STATE, AppState, AppScreens } from './GlobalContextProvider';\nimport Container from './Container';\nimport { ResetPasswordSDKConfig, DeprecatedSDKConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { usePresentationWithDefault, PresentationContext } from '../components/PresentationConfig';\nimport { passwords } from './Products';\nimport { addProduct } from './utils';\nimport { logger, RUN_IN_DEV } from '@stytch/core';\n\nexport const ResetPasswordContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n client,\n config: rawConfig,\n presentation,\n callbacks,\n strings,\n styles,\n passwordResetToken: rawToken,\n}: ResetPasswordSDKConfig<TProjectConfiguration> & DeprecatedSDKConfig) => {\n const config = addProduct(rawConfig, passwords);\n\n // Default to reading token from URL if not provided\n let token = rawToken;\n if (!token) {\n const result = client.parseAuthenticateUrl();\n if (result?.tokenType === 'reset_password' || result?.tokenType === 'login') {\n token = result.token;\n }\n }\n\n // Read the watermark out of sync storage, then read it out of async storage\n const [displayWatermark, setDisplayWatermark] = useState(() => {\n const { displayWatermark } = readB2CInternals(client).bootstrap.getSync();\n return displayWatermark;\n });\n useEffect(() => {\n readB2CInternals(client)\n .bootstrap.getAsync()\n .then(({ displayWatermark }) => {\n setDisplayWatermark(displayWatermark);\n });\n }, [client]);\n\n RUN_IN_DEV(() => {\n if (styles) {\n logger.error(\n 'styles is deprecated and has no effect. Use the presentation prop instead.\\n' +\n 'See https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/upgrade-guide#step-by-step-guide',\n );\n }\n });\n\n const initialState: AppState = {\n ...DEFAULT_STATE,\n screen: AppScreens.PasswordResetForm,\n formState: {\n ...DEFAULT_STATE.formState,\n resetPasswordState: {\n token: token!,\n },\n },\n };\n\n const presentationValue = usePresentationWithDefault(presentation, displayWatermark, config.products, 'Products');\n\n return (\n <GlobalContextProvider client={client} config={config} callbacks={callbacks} initialState={initialState}>\n <PresentationContext.Provider value={presentationValue}>\n <I18nProviderWrapper messages={messages} overrides={strings}>\n <Container />\n </I18nProviderWrapper>\n </PresentationContext.Provider>\n </GlobalContextProvider>\n );\n};\n"],"names":["ResetPasswordContainer","client","config","rawConfig","presentation","callbacks","strings","styles","passwordResetToken","rawToken","addProduct","passwords","token","result","parseAuthenticateUrl","tokenType","displayWatermark","setDisplayWatermark","useState","readB2CInternals","bootstrap","getSync","useEffect","getAsync","then","RUN_IN_DEV","logger","error","initialState","DEFAULT_STATE","screen","AppScreens","PasswordResetForm","formState","resetPasswordState","presentationValue","usePresentationWithDefault","products","React","GlobalContextProvider","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","Container"],"mappings":";;;;;;;;;;;;MAaaA,sBAAAA,GAAyB,CAAgE,EACpGC,MAAM,EACNC,QAAQC,SAAS,EACjBC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,kBAAAA,EAAoBC,QAAQ,EACwC,GAAA;IACpE,MAAMP,MAAAA,GAASQ,WAAWP,SAAAA,EAAWQ,SAAAA,CAAAA;;AAGrC,IAAA,IAAIC,KAAAA,GAAQH,QAAAA;AACZ,IAAA,IAAI,CAACG,KAAAA,EAAO;QACV,MAAMC,MAAAA,GAASZ,OAAOa,oBAAoB,EAAA;AAC1C,QAAA,IAAID,MAAAA,EAAQE,SAAAA,KAAc,gBAAA,IAAoBF,MAAAA,EAAQE,cAAc,OAAA,EAAS;AAC3EH,YAAAA,KAAAA,GAAQC,OAAOD,KAAK;AACtB,QAAA;AACF,IAAA;;AAGA,IAAA,MAAM,CAACI,gBAAAA,EAAkBC,mBAAAA,CAAoB,GAAGC,QAAAA,CAAS,IAAA;QACvD,MAAM,EAAEF,gBAAgB,EAAE,GAAGG,iBAAiBlB,MAAAA,CAAAA,CAAQmB,SAAS,CAACC,OAAO,EAAA;QACvE,OAAOL,gBAAAA;AACT,IAAA,CAAA,CAAA;IACAM,SAAAA,CAAU,IAAA;QACRH,gBAAAA,CAAiBlB,MAAAA,CAAAA,CACdmB,SAAS,CAACG,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAAC,EAAER,gBAAgB,EAAE,GAAA;YACzBC,mBAAAA,CAAoBD,gBAAAA,CAAAA;AACtB,QAAA,CAAA,CAAA;IACJ,CAAA,EAAG;AAACf,QAAAA;AAAO,KAAA,CAAA;IAEXwB,UAAAA,CAAW,IAAA;AACT,QAAA,IAAIlB,MAAAA,EAAQ;YACVmB,MAAAA,CAAOC,KAAK,CACV,8EAAA,GACE,yGAAA,CAAA;AAEN,QAAA;AACF,IAAA,CAAA,CAAA;AAEA,IAAA,MAAMC,YAAAA,GAAyB;AAC7B,QAAA,GAAGC,aAAa;AAChBC,QAAAA,MAAAA,EAAQC,WAAWC,iBAAiB;QACpCC,SAAAA,EAAW;AACT,YAAA,GAAGJ,cAAcI,SAAS;YAC1BC,kBAAAA,EAAoB;gBAClBtB,KAAAA,EAAOA;AACT;AACF;AACF,KAAA;AAEA,IAAA,MAAMuB,oBAAoBC,0BAAAA,CAA2BhC,YAAAA,EAAcY,gBAAAA,EAAkBd,MAAAA,CAAOmC,QAAQ,EAAE,UAAA,CAAA;AAEtG,IAAA,qBACEC,cAAA,CAAA,aAAA,CAACC,qBAAAA,EAAAA;QAAsBtC,MAAAA,EAAQA,MAAAA;QAAQC,MAAAA,EAAQA,MAAAA;QAAQG,SAAAA,EAAWA,SAAAA;QAAWuB,YAAAA,EAAcA;AACzF,KAAA,gBAAAU,cAAA,CAAA,aAAA,CAACE,oBAAoBC,QAAQ,EAAA;QAACC,KAAAA,EAAOP;qBACnCG,cAAA,CAAA,aAAA,CAACK,mBAAAA,EAAAA;QAAoBC,QAAAA,EAAUA,QAAAA;QAAUC,SAAAA,EAAWvC;qBAClDgC,cAAA,CAAA,aAAA,CAACQ,YAAAA,EAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAKX;;;;"}
@@ -1,11 +1,11 @@
1
1
  import React__default from 'react';
2
2
  import { useLingui } from '../../../../../../../node_modules/@lingui/react/dist/index.mjs';
3
3
  import { useGlobalReducer, AppScreens } from '../../GlobalContextProvider.mjs';
4
- import { WalletToIcon } from '../../../../utils/crypto.mjs';
5
4
  import Column from '../../../components/atoms/Column.mjs';
6
5
  import TextColumn from '../../../components/molecules/TextColumn.mjs';
7
6
  import Button, { ButtonAnchor } from '../../../components/atoms/Button.mjs';
8
7
  import ButtonColumn from '../../../components/molecules/ButtonColumn.mjs';
8
+ import { useCryptoIcon } from '../../../../utils/crypto.mjs';
9
9
  import { Wallets } from '../../../../../../core/src/public/ui.mjs';
10
10
 
11
11
  const commonButtonProps = {
@@ -13,13 +13,14 @@ const commonButtonProps = {
13
13
  target: '_blank',
14
14
  rel: 'noreferrer'
15
15
  };
16
- const walletIcon = (wallet)=>{
17
- const Icon = WalletToIcon[wallet];
18
- return /*#__PURE__*/ React__default.createElement(Icon, null);
19
- };
20
16
  const SetupNewWallet = ()=>{
21
17
  const { i18n: $__i18n, _: $__ } = useLingui();
22
18
  const [, dispatch] = useGlobalReducer();
19
+ const getCryptoIcon = useCryptoIcon();
20
+ const MetamaskIcon = getCryptoIcon(Wallets.Metamask);
21
+ const PhantomIcon = getCryptoIcon(Wallets.Phantom);
22
+ const CoinbaseIcon = getCryptoIcon(Wallets.Coinbase);
23
+ const BinanceIcon = getCryptoIcon(Wallets.Binance);
23
24
  return /*#__PURE__*/ React__default.createElement(Column, {
24
25
  gap: 6
25
26
  }, /*#__PURE__*/ React__default.createElement(TextColumn, {
@@ -37,29 +38,29 @@ const SetupNewWallet = ()=>{
37
38
  })
38
39
  }), /*#__PURE__*/ React__default.createElement(ButtonColumn, null, /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
39
40
  ...commonButtonProps,
40
- icon: walletIcon(Wallets.Metamask),
41
+ icon: /*#__PURE__*/ React__default.createElement(MetamaskIcon, null),
41
42
  href: "https://metamask.io/"
42
43
  }, $__i18n._({
43
44
  id: "crypto.wallet.metamask",
44
45
  message: "Metamask"
45
46
  })), /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
46
47
  ...commonButtonProps,
47
- icon: walletIcon(Wallets.Phantom),
48
- href: "https://phantom.app/"
48
+ icon: /*#__PURE__*/ React__default.createElement(PhantomIcon, null),
49
+ href: "https://phantom.com/"
49
50
  }, $__i18n._({
50
51
  id: "crypto.wallet.phantom",
51
52
  message: "Phantom"
52
53
  })), /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
53
54
  ...commonButtonProps,
54
- icon: walletIcon(Wallets.Coinbase),
55
+ icon: /*#__PURE__*/ React__default.createElement(CoinbaseIcon, null),
55
56
  href: "https://www.coinbase.com/wallet"
56
57
  }, $__i18n._({
57
58
  id: "crypto.wallet.coinbase",
58
59
  message: "Coinbase"
59
60
  })), /*#__PURE__*/ React__default.createElement(ButtonAnchor, {
60
61
  ...commonButtonProps,
61
- icon: walletIcon(Wallets.Binance),
62
- href: "https://www.bnbchain.world/en/binance-wallet"
62
+ icon: /*#__PURE__*/ React__default.createElement(BinanceIcon, null),
63
+ href: "https://web3.binance.com/en/about"
63
64
  }, $__i18n._({
64
65
  id: "crypto.wallet.binance",
65
66
  message: "Binance"
@@ -1 +1 @@
1
- {"version":3,"file":"SetupNewWallet.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/SetupNewWallet.tsx"],"sourcesContent":["import React from 'react';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\nimport { AppScreens, useGlobalReducer } from '../../GlobalContextProvider';\nimport { WalletToIcon } from '../../../../utils/crypto';\nimport Column from '../../../components/atoms/Column';\nimport TextColumn from '../../../components/molecules/TextColumn';\nimport Button, { ButtonAnchor } from '../../../components/atoms/Button';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\n\nconst commonButtonProps = {\n variant: 'outline',\n target: '_blank',\n rel: 'noreferrer',\n} as const;\n\nconst walletIcon = (wallet: Wallets) => {\n const Icon = WalletToIcon[wallet];\n return <Icon />;\n};\n\nexport const SetupNewWallet = () => {\n const { t } = useLingui();\n const [, dispatch] = useGlobalReducer();\n\n return (\n <Column gap={6}>\n <TextColumn\n header={t({ id: 'crypto.setupNewWallet.title', message: 'Set up a new crypto wallet' })}\n body={t({\n id: 'crypto.setupNewWallet.content',\n message: 'Get started by downloading any Ethereum or Solana wallet.',\n })}\n helper={t({\n id: 'crypto.setupNewWallet.instruction',\n message:\n 'We’ve included a few examples of wallet extensions you can find below. Once you’ve set up your wallet, click “Go back” to use it and sign in.',\n })}\n />\n\n <ButtonColumn>\n <ButtonAnchor {...commonButtonProps} icon={walletIcon(Wallets.Metamask)} href=\"https://metamask.io/\">\n {t({ id: 'crypto.wallet.metamask', message: 'Metamask' })}\n </ButtonAnchor>\n <ButtonAnchor {...commonButtonProps} icon={walletIcon(Wallets.Phantom)} href=\"https://phantom.app/\">\n {t({ id: 'crypto.wallet.phantom', message: 'Phantom' })}\n </ButtonAnchor>\n\n <ButtonAnchor {...commonButtonProps} icon={walletIcon(Wallets.Coinbase)} href=\"https://www.coinbase.com/wallet\">\n {t({ id: 'crypto.wallet.coinbase', message: 'Coinbase' })}\n </ButtonAnchor>\n\n <ButtonAnchor\n {...commonButtonProps}\n icon={walletIcon(Wallets.Binance)}\n href=\"https://www.bnbchain.world/en/binance-wallet\"\n >\n {t({ id: 'crypto.wallet.binance', message: 'Binance' })}\n </ButtonAnchor>\n\n <Button variant=\"primary\" onClick={() => dispatch({ type: 'transition', screen: AppScreens.Main })}>\n {t({ id: 'button.goBack', message: 'Go back' })}\n </Button>\n </ButtonColumn>\n </Column>\n );\n};\n"],"names":["commonButtonProps","variant","target","rel","walletIcon","wallet","Icon","WalletToIcon","React","SetupNewWallet","useLingui","dispatch","useGlobalReducer","Column","gap","TextColumn","header","body","helper","ButtonColumn","ButtonAnchor","icon","Wallets","Metamask","href","Phantom","Coinbase","Binance","Button","onClick","type","screen","AppScreens","Main"],"mappings":";;;;;;;;;;AAUA,MAAMA,iBAAAA,GAAoB;IACxBC,OAAAA,EAAS,SAAA;IACTC,MAAAA,EAAQ,QAAA;IACRC,GAAAA,EAAK;AACP,CAAA;AAEA,MAAMC,aAAa,CAACC,MAAAA,GAAAA;IAClB,MAAMC,IAAAA,GAAOC,YAAY,CAACF,MAAAA,CAAO;AACjC,IAAA,qBAAOG,cAAA,CAAA,aAAA,CAACF,IAAAA,EAAAA,IAAAA,CAAAA;AACV,CAAA;MAEaG,cAAAA,GAAiB,IAAA;AAC5B,IAAA,MAAM,EAAA,IAAA,EAAA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AA,MAAAA,EAAQC,WAAWC;AAAK,aAAA;;;;;AAMxG;;;;"}
1
+ {"version":3,"file":"SetupNewWallet.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/SetupNewWallet.tsx"],"sourcesContent":["import React from 'react';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\nimport { AppScreens, useGlobalReducer } from '../../GlobalContextProvider';\nimport Column from '../../../components/atoms/Column';\nimport TextColumn from '../../../components/molecules/TextColumn';\nimport Button, { ButtonAnchor } from '../../../components/atoms/Button';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport { useCryptoIcon } from '../../../../utils/crypto';\n\nconst commonButtonProps = {\n variant: 'outline',\n target: '_blank',\n rel: 'noreferrer',\n} as const;\n\nexport const SetupNewWallet = () => {\n const { t } = useLingui();\n const [, dispatch] = useGlobalReducer();\n\n const getCryptoIcon = useCryptoIcon();\n const MetamaskIcon = getCryptoIcon(Wallets.Metamask);\n const PhantomIcon = getCryptoIcon(Wallets.Phantom);\n const CoinbaseIcon = getCryptoIcon(Wallets.Coinbase);\n const BinanceIcon = getCryptoIcon(Wallets.Binance);\n\n return (\n <Column gap={6}>\n <TextColumn\n header={t({ id: 'crypto.setupNewWallet.title', message: 'Set up a new crypto wallet' })}\n body={t({\n id: 'crypto.setupNewWallet.content',\n message: 'Get started by downloading any Ethereum or Solana wallet.',\n })}\n helper={t({\n id: 'crypto.setupNewWallet.instruction',\n message:\n 'We’ve included a few examples of wallet extensions you can find below. Once you’ve set up your wallet, click “Go back” to use it and sign in.',\n })}\n />\n\n <ButtonColumn>\n <ButtonAnchor {...commonButtonProps} icon={<MetamaskIcon />} href=\"https://metamask.io/\">\n {t({ id: 'crypto.wallet.metamask', message: 'Metamask' })}\n </ButtonAnchor>\n <ButtonAnchor {...commonButtonProps} icon={<PhantomIcon />} href=\"https://phantom.com/\">\n {t({ id: 'crypto.wallet.phantom', message: 'Phantom' })}\n </ButtonAnchor>\n\n <ButtonAnchor {...commonButtonProps} icon={<CoinbaseIcon />} href=\"https://www.coinbase.com/wallet\">\n {t({ id: 'crypto.wallet.coinbase', message: 'Coinbase' })}\n </ButtonAnchor>\n\n <ButtonAnchor {...commonButtonProps} icon={<BinanceIcon />} href=\"https://web3.binance.com/en/about\">\n {t({ id: 'crypto.wallet.binance', message: 'Binance' })}\n </ButtonAnchor>\n\n <Button variant=\"primary\" onClick={() => dispatch({ type: 'transition', screen: AppScreens.Main })}>\n {t({ id: 'button.goBack', message: 'Go back' })}\n </Button>\n </ButtonColumn>\n </Column>\n );\n};\n"],"names":["commonButtonProps","variant","target","rel","SetupNewWallet","useLingui","dispatch","useGlobalReducer","getCryptoIcon","useCryptoIcon","MetamaskIcon","Wallets","Metamask","PhantomIcon","Phantom","CoinbaseIcon","Coinbase","BinanceIcon","Binance","React","Column","gap","TextColumn","header","body","helper","ButtonColumn","ButtonAnchor","icon","href","Button","onClick","type","screen","AppScreens","Main"],"mappings":";;;;;;;;;;AAUA,MAAMA,iBAAAA,GAAoB;IACxBC,OAAAA,EAAS,SAAA;IACTC,MAAAA,EAAQ,QAAA;IACRC,GAAAA,EAAK;AACP,CAAA;MAEaC,cAAAA,GAAiB,IAAA;AAC5B,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;IACd,MAAM,GAAGC,SAAS,GAAGC,gBAAAA,EAAAA;AAErB,IAAA,MAAMC,aAAAA,GAAgBC,aAAAA,EAAAA;IACtB,MAAMC,YAAAA,GAAeF,aAAAA,CAAcG,OAAAA,CAAQC,QAAQ,CAAA;IACnD,MAAMC,WAAAA,GAAcL,aAAAA,CAAcG,OAAAA,CAAQG,OAAO,CAAA;IACjD,MAAMC,YAAAA,GAAeP,aAAAA,CAAcG,OAAAA,CAAQK,QAAQ,CAAA;IACnD,MAAMC,WAAAA,GAAcT,aAAAA,CAAcG,OAAAA,CAAQO,OAAO,CAAA;AAEjD,IAA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A,EAAQC,WAAWC;AAAK,aAAA;;;;;AAMxG;;;;"}
@@ -1,16 +1,13 @@
1
1
  import * as React from 'react';
2
2
  import { useLingui } from '../../../../../../../node_modules/@lingui/react/dist/index.mjs';
3
3
  import { useGlobalReducer, useConfig, AppScreens } from '../../GlobalContextProvider.mjs';
4
- import { isWalletVisible, WalletToText, WalletToIcon } from '../../../../utils/crypto.mjs';
4
+ import { useCryptoIcon, isWalletVisible, WalletToText } from '../../../../utils/crypto.mjs';
5
5
  import ButtonColumn from '../../../components/molecules/ButtonColumn.mjs';
6
6
  import Button from '../../../components/atoms/Button.mjs';
7
+ import { GenericWalletIcon } from '../../../../assets/genericWallet.mjs';
7
8
  import { Wallets } from '../../../../../../core/src/public/ui.mjs';
8
9
 
9
10
  const MAX_BUTTONS = 6;
10
- const WalletIconComponent = ({ wallet })=>{
11
- const Icon = WalletToIcon[wallet];
12
- return /*#__PURE__*/ React.createElement(Icon, null);
13
- };
14
11
  const walletMessages = {
15
12
  [Wallets.Phantom]: {
16
13
  id: "crypto.wallet.continueWithPhantom",
@@ -41,6 +38,7 @@ const CryptoWalletButtons = ({ type })=>{
41
38
  const { i18n: $__i18n, _: $__ } = useLingui();
42
39
  const [state, dispatch] = useGlobalReducer();
43
40
  const config = useConfig();
41
+ const getCryptoIcon = useCryptoIcon();
44
42
  const oAuthOptions = config.oauthOptions?.providers.length ?? 0;
45
43
  // Crypto Buttons on screen = Maximum Buttons - OAuth Buttons - 1 (Other crypto or set up new wallet)
46
44
  const cryptoButtonsOnMainScreen = MAX_BUTTONS - oAuthOptions - 1;
@@ -62,18 +60,18 @@ const CryptoWalletButtons = ({ type })=>{
62
60
  const mainWallets = allDetectedWallets.slice(0, cryptoButtonsOnMainScreen);
63
61
  const otherWallet = allDetectedWallets.slice(cryptoButtonsOnMainScreen);
64
62
  const walletsToRender = type === 'main' ? mainWallets : otherWallet;
65
- return /*#__PURE__*/ React.createElement(ButtonColumn, null, walletsToRender.map((wallet)=>/*#__PURE__*/ React.createElement(Button, {
63
+ return /*#__PURE__*/ React.createElement(ButtonColumn, null, walletsToRender.map((wallet)=>{
64
+ const walletEnum = Wallets[wallet];
65
+ const Icon = getCryptoIcon(walletEnum);
66
+ return /*#__PURE__*/ React.createElement(Button, {
66
67
  key: wallet,
67
68
  variant: "outline",
68
- icon: /*#__PURE__*/ React.createElement(WalletIconComponent, {
69
- wallet: Wallets[wallet]
70
- }),
71
- onClick: ()=>onWalletStart(Wallets[wallet])
72
- }, type === 'main' ? $__i18n._(walletMessages[Wallets[wallet]]) : $__i18n._(WalletToText[Wallets[wallet]]))), renderOtherScreenButton && type === 'main' ? /*#__PURE__*/ React.createElement(Button, {
69
+ icon: /*#__PURE__*/ React.createElement(Icon, null),
70
+ onClick: ()=>onWalletStart(walletEnum)
71
+ }, type === 'main' ? $__i18n._(walletMessages[walletEnum]) : $__i18n._(WalletToText[walletEnum]));
72
+ }), renderOtherScreenButton && type === 'main' ? /*#__PURE__*/ React.createElement(Button, {
73
73
  variant: "outline",
74
- icon: /*#__PURE__*/ React.createElement(WalletIconComponent, {
75
- wallet: Wallets.GenericEthereumWallet
76
- }),
74
+ icon: /*#__PURE__*/ React.createElement(GenericWalletIcon, null),
77
75
  onClick: ()=>dispatch({
78
76
  type: 'transition',
79
77
  screen: AppScreens.CryptoOtherScreen
@@ -1 +1 @@
1
- {"version":3,"file":"WalletButtons.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/WalletButtons.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\n\nimport { useConfig, useGlobalReducer, AppScreens } from '../../GlobalContextProvider';\nimport { WalletToIcon, WalletToText, isWalletVisible } from '../../../../utils/crypto';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport Button from '../../../components/atoms/Button';\n\nconst MAX_BUTTONS = 6;\n\nconst WalletIconComponent = ({ wallet }: { wallet: Wallets }) => {\n const Icon = WalletToIcon[wallet];\n return <Icon />;\n};\n\nconst walletMessages = {\n [Wallets.Phantom]: msg({ id: 'crypto.wallet.continueWithPhantom', message: 'Continue with Phantom' }),\n [Wallets.Binance]: msg({ id: 'crypto.wallet.continueWithBinance', message: 'Continue with Binance' }),\n [Wallets.Coinbase]: msg({ id: 'crypto.wallet.continueWithCoinbase', message: 'Continue with Coinbase' }),\n [Wallets.Metamask]: msg({ id: 'crypto.wallet.continueWithMetamask', message: 'Continue with Metamask' }),\n [Wallets.GenericEthereumWallet]: msg({\n id: 'crypto.wallet.continueWithEthereum',\n message: 'Continue with Other Ethereum Wallet',\n }),\n [Wallets.GenericSolanaWallet]: msg({\n id: 'crypto.wallet.continueWithSolana',\n message: 'Continue with Other Solana Wallet',\n }),\n} satisfies Record<Wallets, MessageDescriptor>;\n\nexport const CryptoWalletButtons = ({ type }: { type: 'main' | 'other' }) => {\n const { t } = useLingui();\n const [state, dispatch] = useGlobalReducer();\n const config = useConfig();\n const oAuthOptions = config.oauthOptions?.providers.length ?? 0;\n\n // Crypto Buttons on screen = Maximum Buttons - OAuth Buttons - 1 (Other crypto or set up new wallet)\n const cryptoButtonsOnMainScreen = MAX_BUTTONS - oAuthOptions - 1;\n const onWalletStart = (wallet: Wallets) => {\n dispatch({\n type: 'update_crypto_state',\n cryptoState: {\n ...state.formState.cryptoState,\n walletOption: wallet,\n },\n });\n dispatch({ type: 'transition', screen: AppScreens.CryptoConnect });\n };\n\n const allDetectedWallets = (Object.keys(Wallets) as (keyof typeof Wallets)[]).filter((wallet) =>\n isWalletVisible(Wallets[wallet]),\n );\n\n const renderOtherScreenButton = allDetectedWallets.length > cryptoButtonsOnMainScreen;\n\n const mainWallets = allDetectedWallets.slice(0, cryptoButtonsOnMainScreen);\n const otherWallet = allDetectedWallets.slice(cryptoButtonsOnMainScreen);\n\n const walletsToRender = type === 'main' ? mainWallets : otherWallet;\n\n return (\n <ButtonColumn>\n {walletsToRender.map((wallet) => (\n <Button\n key={wallet}\n variant=\"outline\"\n icon={<WalletIconComponent wallet={Wallets[wallet]} />}\n onClick={() => onWalletStart(Wallets[wallet])}\n >\n {type === 'main' ? t(walletMessages[Wallets[wallet]]) : t(WalletToText[Wallets[wallet]])}\n </Button>\n ))}\n {renderOtherScreenButton && type === 'main' ? (\n <Button\n variant=\"outline\"\n icon={<WalletIconComponent wallet={Wallets.GenericEthereumWallet} />}\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoOtherScreen })}\n >\n {t(msg({ id: 'crypto.wallet.continueWithOtherWallet', message: 'Continue with other Crypto Wallet' }))}\n </Button>\n ) : (\n <Button\n variant=\"outline\"\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoSetupWallet })}\n >\n {t(msg({ id: 'crypto.wallet.setupNewWallet', message: 'Set up a new crypto wallet' }))}\n </Button>\n )}\n </ButtonColumn>\n );\n};\n"],"names":["MAX_BUTTONS","WalletIconComponent","wallet","Icon","WalletToIcon","walletMessages","Wallets","Phantom","Binance","Coinbase","Metamask","GenericEthereumWallet","GenericSolanaWallet","CryptoWalletButtons","type","useLingui","state","dispatch","useGlobalReducer","config","useConfig","oAuthOptions","oauthOptions","providers","length","cryptoButtonsOnMainScreen","onWalletStart","cryptoState","formState","walletOption","screen","AppScreens","CryptoConnect","allDetectedWallets","Object","keys","filter","isWalletVisible","renderOtherScreenButton","mainWallets","slice","otherWallet","walletsToRender","ButtonColumn","map","Button","key","variant","icon","onClick","WalletToText","CryptoOtherScreen","CryptoSetupWallet"],"mappings":";;;;;;;;AAWA,MAAMA,WAAAA,GAAc,CAAA;AAEpB,MAAMC,mBAAAA,GAAsB,CAAC,EAAEC,MAAM,EAAuB,GAAA;IAC1D,MAAMC,IAAAA,GAAOC,YAAY,CAACF,MAAAA,CAAO;AACjC,IAAA,qBAAO,KAAA,CAAA,aAAA,CAACC,IAAAA,EAAAA,IAAAA,CAAAA;AACV,CAAA;AAEA,MAAME,cA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KAAA,CAAA,aAAA,CAACN,MAAAA,EAAAA;QACCE,OAAAA,EAAQ,SAAA;AACRE,QAAAA,OAAAA,EAAS,IAAMhC,QAAAA,CAAS;gBAAEH,IAAAA,EAAM,YAAA;AAAcgB,gBAAAA,MAAAA,EAAQC,WAAWqB;AAAkB,aAAA;;;;;AAO7F;;;;"}
1
+ {"version":3,"file":"WalletButtons.mjs","sources":["../../../../../../../../../../web/src/ui/b2c/screens/Crypto/WalletButtons.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MessageDescriptor } from '@lingui/core';\nimport { msg } from '@lingui/core/macro';\nimport { useLingui } from '@lingui/react/macro';\nimport { Wallets } from '@stytch/core/public';\n\nimport { useConfig, useGlobalReducer, AppScreens } from '../../GlobalContextProvider';\nimport { WalletToText, isWalletVisible, useCryptoIcon } from '../../../../utils/crypto';\nimport ButtonColumn from '../../../components/molecules/ButtonColumn';\nimport Button from '../../../components/atoms/Button';\nimport { GenericWalletIcon } from '../../../../assets';\n\nconst MAX_BUTTONS = 6;\n\nconst walletMessages = {\n [Wallets.Phantom]: msg({ id: 'crypto.wallet.continueWithPhantom', message: 'Continue with Phantom' }),\n [Wallets.Binance]: msg({ id: 'crypto.wallet.continueWithBinance', message: 'Continue with Binance' }),\n [Wallets.Coinbase]: msg({ id: 'crypto.wallet.continueWithCoinbase', message: 'Continue with Coinbase' }),\n [Wallets.Metamask]: msg({ id: 'crypto.wallet.continueWithMetamask', message: 'Continue with Metamask' }),\n [Wallets.GenericEthereumWallet]: msg({\n id: 'crypto.wallet.continueWithEthereum',\n message: 'Continue with Other Ethereum Wallet',\n }),\n [Wallets.GenericSolanaWallet]: msg({\n id: 'crypto.wallet.continueWithSolana',\n message: 'Continue with Other Solana Wallet',\n }),\n} satisfies Record<Wallets, MessageDescriptor>;\n\nexport const CryptoWalletButtons = ({ type }: { type: 'main' | 'other' }) => {\n const { t } = useLingui();\n const [state, dispatch] = useGlobalReducer();\n const config = useConfig();\n\n const getCryptoIcon = useCryptoIcon();\n\n const oAuthOptions = config.oauthOptions?.providers.length ?? 0;\n\n // Crypto Buttons on screen = Maximum Buttons - OAuth Buttons - 1 (Other crypto or set up new wallet)\n const cryptoButtonsOnMainScreen = MAX_BUTTONS - oAuthOptions - 1;\n const onWalletStart = (wallet: Wallets) => {\n dispatch({\n type: 'update_crypto_state',\n cryptoState: {\n ...state.formState.cryptoState,\n walletOption: wallet,\n },\n });\n dispatch({ type: 'transition', screen: AppScreens.CryptoConnect });\n };\n\n const allDetectedWallets = (Object.keys(Wallets) as (keyof typeof Wallets)[]).filter((wallet) =>\n isWalletVisible(Wallets[wallet]),\n );\n\n const renderOtherScreenButton = allDetectedWallets.length > cryptoButtonsOnMainScreen;\n\n const mainWallets = allDetectedWallets.slice(0, cryptoButtonsOnMainScreen);\n const otherWallet = allDetectedWallets.slice(cryptoButtonsOnMainScreen);\n\n const walletsToRender = type === 'main' ? mainWallets : otherWallet;\n\n return (\n <ButtonColumn>\n {walletsToRender.map((wallet) => {\n const walletEnum = Wallets[wallet];\n const Icon = getCryptoIcon(walletEnum);\n return (\n <Button key={wallet} variant=\"outline\" icon={<Icon />} onClick={() => onWalletStart(walletEnum)}>\n {type === 'main' ? t(walletMessages[walletEnum]) : t(WalletToText[walletEnum])}\n </Button>\n );\n })}\n\n {renderOtherScreenButton && type === 'main' ? (\n <Button\n variant=\"outline\"\n icon={<GenericWalletIcon />}\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoOtherScreen })}\n >\n {t(msg({ id: 'crypto.wallet.continueWithOtherWallet', message: 'Continue with other Crypto Wallet' }))}\n </Button>\n ) : (\n <Button\n variant=\"outline\"\n onClick={() => dispatch({ type: 'transition', screen: AppScreens.CryptoSetupWallet })}\n >\n {t(msg({ id: 'crypto.wallet.setupNewWallet', message: 'Set up a new crypto wallet' }))}\n </Button>\n )}\n </ButtonColumn>\n );\n};\n"],"names":["MAX_BUTTONS","walletMessages","Wallets","Phantom","Binance","Coinbase","Metamask","GenericEthereumWallet","GenericSolanaWallet","CryptoWalletButtons","type","useLingui","state","dispatch","useGlobalReducer","config","useConfig","getCryptoIcon","useCryptoIcon","oAuthOptions","oauthOptions","providers","length","cryptoButtonsOnMainScreen","onWalletStart","wallet","cryptoState","formState","walletOption","screen","AppScreens","CryptoConnect","allDetectedWallets","Object","keys","filter","isWalletVisible","renderOtherScreenButton","mainWallets","slice","otherWallet","walletsToRender","ButtonColumn","map","walletEnum","Icon","Button","key","variant","icon","onClick","WalletToText","GenericWalletIcon","CryptoOtherScreen","CryptoSetupWallet"],"mappings":";;;;;;;;;AAYA,MAAMA,WAAAA,GAAc,CAAA;AAEpB,MAAMC,cAAAA,GAAiB;IACrB,CAACC,OAAAA,CAAQC,OAAO,GAAC;;;;IACjB,CAACD,OAAAA,CAAQE,OAAO,GAAC;;;;IACjB,CAACF,OAAAA,CAAQG,QAAQ,GAAC;;;;IAClB,CAACH,OAAAA,CAAQI,QAAQ,GAAC;;;;IAClB,CAACJ,OAAAA,CAAQK,qBAAqB,GAAC;;;;IAI/B,CAACL,OAAAA,CAAQM,mBAAmB,GAAC;;;;AAI/B,CAAA;AAEO,MAAMC,mBAAAA,GAAsB,CAAC,EAAEC,IAAI,EAA8B,GAAA;AACtE,IAAA,MAAM,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,GAAA,EAAA,GAAQC,SAAAA,EAAAA;IACd,MAAM,CAACC,KAAAA,EAAOC,QAAAA,CAAS,GAAGC,gBAAAA,EAAAA;AAC1B,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;AAEf,IAAA,MAAMC,aAAAA,GAAgBC,aAAAA,EAAAA;AAEtB,IAAA,MAAMC,YAAAA,GAAeJ,MAAAA,CAAOK,YAAY,EAAEC,UAAUC,MAAAA,IAAU,CAAA;;IAG9D,MAAMC,yBAAAA,GAA4BvB,cAAcmB,YAAAA,GAAe,CAAA;AAC/D,IAAA,MAAMK,gBAAgB,CAACC,MAAAA,GAAAA;QACrBZ,QAAAA,CA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A,CAAcoB,UAAAA;AACjFlC,SAAAA,EAAAA,IAAAA,KAAS,mBAAWT,cAAc,CAAC2C,WAAW,CAAA,GAAA,OAAA,CAAA,CAAA,CAAMO,YAAY,CAACP,UAAAA,CAAW,CAAA,CAAA;IAGnF,CAAA,CAAA,EAECP,uBAAAA,IAA2B3B,IAAAA,KAAS,MAAA,iBACnC,KAAA,CAAA,aAAA,CAACoC,MAAAA,EAAAA;QACCE,OAAAA,EAAQ,SAAA;AACRC,QAAAA,IAAAA,gBAAM,KAAA,CAAA,aAAA,CAACG,iBAAAA,EAAAA,IAAAA,CAAAA;AACPF,QAAAA,OAAAA,EAAS,IAAMrC,QAAAA,CAAS;gBAAEH,IAAAA,EAAM,YAAA;AAAcmB,gBAAAA,MAAAA,EAAQC,WAAWuB;AAAkB,aAAA;;;;wBAKrF,KAAA,CAAA,aAAA,CAACP,MAAAA,EAAAA;QACCE,OAAAA,EAAQ,SAAA;AACRE,QAAAA,OAAAA,EAAS,IAAMrC,QAAAA,CAAS;gBAAEH,IAAAA,EAAM,YAAA;AAAcmB,gBAAAA,MAAAA,EAAQC,WAAWwB;AAAkB,aAAA;;;;;AAO7F;;;;"}
@@ -1,3 +1,4 @@
1
+ import { RUN_IN_DEV } from '../../../../core/src/utils/dev.mjs';
1
2
  import { logger } from '../../../../core/src/utils/logger.mjs';
2
3
 
3
4
  /* eslint-disable lingui/no-unlocalized-strings */ /**
@@ -38,16 +39,16 @@ import { logger } from '../../../../core/src/utils/logger.mjs';
38
39
  const { colors, container, inputs, hideHeaderText, buttons, logo, fontFamily, ...outerEmpty } = styleConfig;
39
40
  // presentation.theme mapping
40
41
  // ------------------------------------------------
41
- {
42
- warn("styleToTheme: We recommend setting theme['color-scheme'] to either 'light' or 'dark' explicitly depending on whether this is a light or dark theme. This enables icons to automatically automatically apply contrasting colors.");
42
+ RUN_IN_DEV(()=>{
43
+ warn("styleToTheme: We recommend setting theme['color-scheme'] to either 'light' or 'dark' explicitly " + 'depending on whether this is a light or dark theme. This enables icons to automatically automatically ' + 'apply contrasting colors.');
43
44
  if (Object.keys(outerEmpty).length > 0) warn('styleToTheme: Unrecognized style properties', outerEmpty);
44
- }
45
+ });
45
46
  theme['font-family'] = fontFamily;
46
47
  if (colors) {
47
48
  const { primary, secondary, success, warning, accent, error, ...expectEmpty } = colors;
48
- {
49
+ RUN_IN_DEV(()=>{
49
50
  if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.colors properties', expectEmpty);
50
- }
51
+ });
51
52
  Object.assign(theme, {
52
53
  primary,
53
54
  secondary,
@@ -59,9 +60,9 @@ import { logger } from '../../../../core/src/utils/logger.mjs';
59
60
  }
60
61
  if (container) {
61
62
  const { backgroundColor, borderColor, width, borderRadius, ...expectEmpty } = container;
62
- {
63
+ RUN_IN_DEV(()=>{
63
64
  if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.container properties', expectEmpty);
64
- }
65
+ });
65
66
  Object.assign(theme, {
66
67
  background: backgroundColor,
67
68
  border: borderColor,
@@ -72,12 +73,12 @@ import { logger } from '../../../../core/src/utils/logger.mjs';
72
73
  }
73
74
  if (buttons) {
74
75
  const { primary, secondary, disabled, ...expectEmpty } = buttons;
75
- {
76
+ RUN_IN_DEV(()=>{
76
77
  if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.buttons properties', expectEmpty);
77
78
  if (disabled && Object.keys(disabled).length > 0) warn('styleToTheme: buttons.disabled is no longer supported', {
78
79
  disabled
79
80
  });
80
- if (primary?.borderColor && primary?.backgroundColor && primary.borderColor !== primary.backgroundColor) error("styleToTheme: primary button's border color is now always equal to background color, having distinct colors is no longer supported", {
81
+ if (primary?.borderColor && primary?.backgroundColor && primary.borderColor !== primary.backgroundColor) error("styleToTheme: primary button's border color is now always equal to background color; " + 'having distinct colors is no longer supported', {
81
82
  borderColor: primary.borderColor,
82
83
  backgroundColor: primary.backgroundColor
83
84
  });
@@ -89,7 +90,7 @@ import { logger } from '../../../../core/src/utils/logger.mjs';
89
90
  primaryRadius: primary?.borderRadius,
90
91
  secondaryRadius: secondary?.borderRadius
91
92
  });
92
- }
93
+ });
93
94
  // Set background and text colors
94
95
  Object.assign(theme, {
95
96
  primary: primary?.backgroundColor,
@@ -112,13 +113,13 @@ import { logger } from '../../../../core/src/utils/logger.mjs';
112
113
  }
113
114
  if (inputs) {
114
115
  const { backgroundColor, textColor, placeholderColor, borderColor, borderRadius, ...expectEmpty } = inputs;
115
- {
116
+ RUN_IN_DEV(()=>{
116
117
  if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.buttons properties', expectEmpty);
117
118
  if (backgroundColor && theme.background && theme.background !== backgroundColor) error('styleToTheme: Input now always use the container background', {
118
119
  inputBackground: backgroundColor,
119
120
  containerBackground: theme.background
120
121
  });
121
- }
122
+ });
122
123
  Object.assign(theme, {
123
124
  foreground: textColor,
124
125
  input: borderColor,
@@ -141,9 +142,9 @@ import { logger } from '../../../../core/src/utils/logger.mjs';
141
142
  url: logo.logoImageUrl,
142
143
  alt: ''
143
144
  };
144
- {
145
+ RUN_IN_DEV(()=>{
145
146
  logger.warn('styleToTheme: Please set options.logo.alt for the logo alt text for accessibility');
146
- }
147
+ });
147
148
  }
148
149
  return {
149
150
  theme: removeEmptyValues(theme),
@@ -1 +1 @@
1
- {"version":3,"file":"styleToTheme.mjs","sources":["../../../../../../../../web/src/ui/compat/styleToTheme.ts"],"sourcesContent":["import type { StyleConfig } from '@stytch/core/public';\nimport type { Theme } from '../components/themes/ThemeConfig';\nimport type { PresentationOptions } from '../components/PresentationConfig';\nimport { logger } from '@stytch/core';\n\n/* eslint-disable lingui/no-unlocalized-strings */\n\n/**\n * Maps a legacy StyleConfig to the new Theme format.\n *\n * This is a best-effort mapping - some StyleConfig properties don't have\n * direct equivalents in Theme, and some Theme properties don't have\n * StyleConfig equivalents.\n *\n * StyleConfig properties that don't have good mappings to Theme:\n * - inputs.placeholderColor - No equivalent (could potentially map to muted-foreground)\n * - inputs.textColor - Mapped to foreground as approximation, but is input-specific\n * - buttons.primary.borderColor - No specific mapping (could use border but loses specificity)\n * - buttons.primary.borderRadius - Mapped to button-radius but loses primary-specific control\n * - buttons.secondary.borderColor - No specific mapping (could use border but loses specificity)\n * - buttons.secondary.borderRadius - Mapped to button-radius but loses secondary-specific control\n * - buttons.disabled.* - No equivalents (disabled state styling not in Theme)\n *\n * Theme properties that don't have StyleConfig equivalents:\n * - 'transition-duration' - defaulted to 0 instead of 0.15s in our new default theme\n * - 'font-family-mono' - defaults to theme default which is system UI monospace\n * - 'text-base' - defaults to 1rem which is close to the old font sizes\n * - spacing - defaults to new theme default which is close but not equivalent to old spacing\n * - shadow, 'shadow-button', 'shadow-input' - no default in new theme\n * - foreground - Approximated from inputs.textColor but not exact\n * - muted, 'muted-foreground'\n * - 'accent-foreground'\n * - ring - previously defaults to OS default focus outline color\n */\nexport function styleToTheme(\n styleConfig: StyleConfig,\n { silent }: { silent?: boolean } = {},\n): {\n theme: Partial<Theme>;\n options: Partial<PresentationOptions>;\n} {\n const warn = silent\n ? () => {\n // noop\n }\n : logger.warn;\n const error = silent\n ? () => {\n // noop\n }\n : logger.error;\n\n const theme: Partial<Theme> = {};\n const options: Partial<PresentationOptions> = {};\n\n const { colors, container, inputs, hideHeaderText, buttons, logo, fontFamily, ...outerEmpty } = styleConfig;\n\n // presentation.theme mapping\n // ------------------------------------------------\n if (process.env.NODE_ENV !== 'production') {\n warn(\n \"styleToTheme: We recommend setting theme['color-scheme'] to either 'light' or 'dark' explicitly depending on whether this is a light or dark theme. This enables icons to automatically automatically apply contrasting colors.\",\n );\n\n if (Object.keys(outerEmpty).length > 0) warn('styleToTheme: Unrecognized style properties', outerEmpty);\n }\n\n theme['font-family'] = fontFamily;\n\n if (colors) {\n const { primary, secondary, success, warning, accent, error, ...expectEmpty } = colors;\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.colors properties', expectEmpty);\n }\n\n Object.assign(theme, {\n primary,\n secondary,\n success,\n warning,\n accent,\n destructive: error,\n } satisfies Partial<Theme>);\n }\n\n if (container) {\n const { backgroundColor, borderColor, width, borderRadius, ...expectEmpty } = container;\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(expectEmpty).length > 0)\n warn('styleToTheme: Unrecognized style.container properties', expectEmpty);\n }\n\n Object.assign(theme, {\n background: backgroundColor,\n border: borderColor,\n 'container-width': width,\n // 1/4 because the new base is quite small and most components use a 2x or 4x multiplier\n 'rounded-base': updateLength(borderRadius, 0.25),\n } satisfies Partial<Theme>);\n }\n\n if (buttons) {\n const { primary, secondary, disabled, ...expectEmpty } = buttons;\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.buttons properties', expectEmpty);\n\n if (disabled && Object.keys(disabled).length > 0)\n warn('styleToTheme: buttons.disabled is no longer supported', { disabled });\n\n if (primary?.borderColor && primary?.backgroundColor && primary.borderColor !== primary.backgroundColor)\n error(\n \"styleToTheme: primary button's border color is now always equal to background color, having distinct colors is no longer supported\",\n {\n borderColor: primary.borderColor,\n backgroundColor: primary.backgroundColor,\n },\n );\n\n if (secondary?.borderColor && secondary.textColor && secondary.borderColor !== secondary.textColor)\n error(\"styleToTheme: secondary button's border color is now always equal to text color\", {\n borderColor: secondary.borderColor,\n textColor: secondary.textColor,\n });\n\n if (primary?.borderRadius !== secondary?.borderRadius)\n error('styleToTheme: All buttons must use the same border-radius', {\n primaryRadius: primary?.borderRadius,\n secondaryRadius: secondary?.borderRadius,\n });\n }\n\n // Set background and text colors\n Object.assign(theme, {\n primary: primary?.backgroundColor,\n 'primary-foreground': primary?.textColor,\n\n secondary: secondary?.backgroundColor,\n 'secondary-foreground': secondary?.textColor,\n } satisfies Partial<Theme>);\n\n // Set border radius\n if (primary?.borderRadius || secondary?.borderRadius) {\n // Conflicts between primary and secondary border radius is handled above\n const baseRadius = updateLength(primary?.borderRadius, 0.5) ?? updateLength(secondary?.borderRadius, 0.5);\n\n if (theme['rounded-base']) {\n if (theme['rounded-base'] !== baseRadius) {\n theme['button-radius'] = primary?.borderRadius;\n }\n } else {\n theme['rounded-base'] = baseRadius;\n }\n }\n }\n\n if (inputs) {\n const { backgroundColor, textColor, placeholderColor, borderColor, borderRadius, ...expectEmpty } = inputs;\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.buttons properties', expectEmpty);\n\n if (backgroundColor && theme.background && theme.background !== backgroundColor)\n error('styleToTheme: Input now always use the container background', {\n inputBackground: backgroundColor,\n containerBackground: theme.background,\n });\n }\n\n Object.assign(theme, {\n foreground: textColor,\n input: borderColor,\n 'muted-foreground': placeholderColor,\n } satisfies Partial<Theme>);\n\n // Set border radius\n if (theme['rounded-base']) {\n if (theme['rounded-base'] !== borderRadius) {\n theme['input-radius'] = borderRadius;\n }\n } else {\n theme['rounded-base'] = borderRadius;\n }\n }\n\n // presentation.options mapping\n // ------------------------------------------------\n\n options.hideHeaderText = hideHeaderText;\n if (logo?.logoImageUrl) {\n options.logo = {\n url: logo.logoImageUrl,\n alt: '',\n };\n\n if (process.env.NODE_ENV !== 'production') {\n logger.warn('styleToTheme: Please set options.logo.alt for the logo alt text for accessibility');\n }\n }\n\n return { theme: removeEmptyValues(theme), options: removeEmptyValues(options) };\n}\n\nfunction removeEmptyValues<T extends Record<string, unknown>>(obj: T): T {\n return Object.fromEntries(Object.entries(obj).filter(([, value]) => value != null && value !== '')) as T;\n}\n\nfunction updateLength(length: string | undefined, factor: number): string | undefined {\n if (!length) return length;\n\n // Loose check that this is a numeric and not keyword value\n const value = parseFloat(length);\n if (Number.isNaN(value)) return length;\n\n return `calc(${length} * ${factor})`;\n}\n"],"names":["styleToTheme","styleConfig","silent","warn","logger","error","theme","options","colors","container","inputs","hideHeaderText","buttons","logo","fontFamily","outerEmpty","Object","keys","length","primary","secondary","success","warning","accent","expectEmpty","assign","destructive","backgroundColor","borderColor","width","borderRadius","background","border","updateLength","disabled","textColor","primaryRadius","secondaryRadius","baseRadius","placeholderColor","inputBackground","containerBackground","foreground","input","logoImageUrl","url","alt","removeEmptyValues","obj","fromEntries","entries","filter","value","factor","parseFloat","Number","isNaN"],"mappings":";;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BO,SAASA,YAAAA,CACdC,WAAwB,EACxB,EAAEC,MAAM,EAAwB,GAAG,EAAE,EAAA;AAKrC,IAAA,MAAMC,OAAOD,MAAAA,GACT,IAAA;;AAEA,IAAA,CAAA,GACAE,OAAOD,IAAI;AACf,IAAA,MAAME,QAAQH,MAAAA,GACV,IAAA;;AAEA,IAAA,CAAA,GACAE,OAAOC,KAAK;AAEhB,IAAA,MAAMC,QAAwB,EAAC;AAC/B,IAAA,MAAMC,UAAwC,EAAC;AAE/C,IAAA,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,cAAc,EAAEC,OAAO,EAAEC,IAAI,EAAEC,UAAU,EAAE,GAAGC,YAAY,GAAGd,WAAAA;;;AAIhG,IAA2C;QACzCE,IAAAA,CACE,iOAAA,CAAA;QAGF,IAAIa,MAAAA,CAAOC,IAAI,CAACF,UAAAA,CAAAA,CAAYG,MAAM,GAAG,CAAA,EAAGf,KAAK,6CAAA,EAA+CY,UAAAA,CAAAA;AAC9F,IAAA;IAEAT,KAAK,CAAC,cAAc,GAAGQ,UAAAA;AAEvB,IAAA,IAAIN,MAAAA,EAAQ;AACV,QAAA,MAAM,EAAEW,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAElB,KAAK,EAAE,GAAGmB,aAAa,GAAGhB,MAAAA;AAChF,QAA2C;YACzC,IAAIQ,MAAAA,CAAOC,IAAI,CAACO,WAAAA,CAAAA,CAAaN,MAAM,GAAG,CAAA,EAAGf,KAAK,oDAAA,EAAsDqB,WAAAA,CAAAA;AACtG,QAAA;QAEAR,MAAAA,CAAOS,MA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,EAAK;AACP,SAAA;AAEA,QAA2C;AACzC1C,YAAAA,MAAAA,CAAOD,IAAI,CAAC,mFAAA,CAAA;AACd,QAAA;AACF,IAAA;IAEA,OAAO;AAAEG,QAAAA,KAAAA,EAAOyC,iBAAAA,CAAkBzC,KAAAA,CAAAA;AAAQC,QAAAA,OAAAA,EAASwC,iBAAAA,CAAkBxC,OAAAA;AAAS,KAAA;AAChF;AAEA,SAASwC,kBAAqDC,GAAM,EAAA;AAClE,IAAA,OAAOhC,MAAAA,CAAOiC,WAAW,CAACjC,MAAAA,CAAOkC,OAAO,CAACF,GAAAA,CAAAA,CAAKG,MAAM,CAAC,CAAC,GAAGC,KAAAA,CAAM,GAAKA,KAAAA,IAAS,QAAQA,KAAAA,KAAU,EAAA,CAAA,CAAA;AACjG;AAEA,SAASnB,YAAAA,CAAaf,MAA0B,EAAEmC,MAAc,EAAA;IAC9D,IAAI,CAACnC,QAAQ,OAAOA,MAAAA;;AAGpB,IAAA,MAAMkC,QAAQE,UAAAA,CAAWpC,MAAAA,CAAAA;AACzB,IAAA,IAAIqC,MAAAA,CAAOC,KAAK,CAACJ,KAAAA,CAAAA,EAAQ,OAAOlC,MAAAA;IAEhC,OAAO,CAAC,KAAK,EAAEA,MAAAA,CAAO,GAAG,EAAEmC,MAAAA,CAAO,CAAC,CAAC;AACtC;;;;"}
1
+ {"version":3,"file":"styleToTheme.mjs","sources":["../../../../../../../../web/src/ui/compat/styleToTheme.ts"],"sourcesContent":["import type { StyleConfig } from '@stytch/core/public';\nimport type { Theme } from '../components/themes/ThemeConfig';\nimport type { PresentationOptions } from '../components/PresentationConfig';\nimport { logger, RUN_IN_DEV } from '@stytch/core';\n\n/* eslint-disable lingui/no-unlocalized-strings */\n\n/**\n * Maps a legacy StyleConfig to the new Theme format.\n *\n * This is a best-effort mapping - some StyleConfig properties don't have\n * direct equivalents in Theme, and some Theme properties don't have\n * StyleConfig equivalents.\n *\n * StyleConfig properties that don't have good mappings to Theme:\n * - inputs.placeholderColor - No equivalent (could potentially map to muted-foreground)\n * - inputs.textColor - Mapped to foreground as approximation, but is input-specific\n * - buttons.primary.borderColor - No specific mapping (could use border but loses specificity)\n * - buttons.primary.borderRadius - Mapped to button-radius but loses primary-specific control\n * - buttons.secondary.borderColor - No specific mapping (could use border but loses specificity)\n * - buttons.secondary.borderRadius - Mapped to button-radius but loses secondary-specific control\n * - buttons.disabled.* - No equivalents (disabled state styling not in Theme)\n *\n * Theme properties that don't have StyleConfig equivalents:\n * - 'transition-duration' - defaulted to 0 instead of 0.15s in our new default theme\n * - 'font-family-mono' - defaults to theme default which is system UI monospace\n * - 'text-base' - defaults to 1rem which is close to the old font sizes\n * - spacing - defaults to new theme default which is close but not equivalent to old spacing\n * - shadow, 'shadow-button', 'shadow-input' - no default in new theme\n * - foreground - Approximated from inputs.textColor but not exact\n * - muted, 'muted-foreground'\n * - 'accent-foreground'\n * - ring - previously defaults to OS default focus outline color\n */\nexport function styleToTheme(\n styleConfig: StyleConfig,\n { silent }: { silent?: boolean } = {},\n): {\n theme: Partial<Theme>;\n options: Partial<PresentationOptions>;\n} {\n const warn = silent\n ? () => {\n // noop\n }\n : logger.warn;\n const error = silent\n ? () => {\n // noop\n }\n : logger.error;\n\n const theme: Partial<Theme> = {};\n const options: Partial<PresentationOptions> = {};\n\n const { colors, container, inputs, hideHeaderText, buttons, logo, fontFamily, ...outerEmpty } = styleConfig;\n\n // presentation.theme mapping\n // ------------------------------------------------\n RUN_IN_DEV(() => {\n warn(\n \"styleToTheme: We recommend setting theme['color-scheme'] to either 'light' or 'dark' explicitly \" +\n 'depending on whether this is a light or dark theme. This enables icons to automatically automatically ' +\n 'apply contrasting colors.',\n );\n\n if (Object.keys(outerEmpty).length > 0) warn('styleToTheme: Unrecognized style properties', outerEmpty);\n });\n\n theme['font-family'] = fontFamily;\n\n if (colors) {\n const { primary, secondary, success, warning, accent, error, ...expectEmpty } = colors;\n RUN_IN_DEV(() => {\n if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.colors properties', expectEmpty);\n });\n\n Object.assign(theme, {\n primary,\n secondary,\n success,\n warning,\n accent,\n destructive: error,\n } satisfies Partial<Theme>);\n }\n\n if (container) {\n const { backgroundColor, borderColor, width, borderRadius, ...expectEmpty } = container;\n\n RUN_IN_DEV(() => {\n if (Object.keys(expectEmpty).length > 0)\n warn('styleToTheme: Unrecognized style.container properties', expectEmpty);\n });\n\n Object.assign(theme, {\n background: backgroundColor,\n border: borderColor,\n 'container-width': width,\n // 1/4 because the new base is quite small and most components use a 2x or 4x multiplier\n 'rounded-base': updateLength(borderRadius, 0.25),\n } satisfies Partial<Theme>);\n }\n\n if (buttons) {\n const { primary, secondary, disabled, ...expectEmpty } = buttons;\n\n RUN_IN_DEV(() => {\n if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.buttons properties', expectEmpty);\n\n if (disabled && Object.keys(disabled).length > 0)\n warn('styleToTheme: buttons.disabled is no longer supported', { disabled });\n\n if (primary?.borderColor && primary?.backgroundColor && primary.borderColor !== primary.backgroundColor)\n error(\n \"styleToTheme: primary button's border color is now always equal to background color; \" +\n 'having distinct colors is no longer supported',\n {\n borderColor: primary.borderColor,\n backgroundColor: primary.backgroundColor,\n },\n );\n\n if (secondary?.borderColor && secondary.textColor && secondary.borderColor !== secondary.textColor)\n error(\"styleToTheme: secondary button's border color is now always equal to text color\", {\n borderColor: secondary.borderColor,\n textColor: secondary.textColor,\n });\n\n if (primary?.borderRadius !== secondary?.borderRadius)\n error('styleToTheme: All buttons must use the same border-radius', {\n primaryRadius: primary?.borderRadius,\n secondaryRadius: secondary?.borderRadius,\n });\n });\n\n // Set background and text colors\n Object.assign(theme, {\n primary: primary?.backgroundColor,\n 'primary-foreground': primary?.textColor,\n\n secondary: secondary?.backgroundColor,\n 'secondary-foreground': secondary?.textColor,\n } satisfies Partial<Theme>);\n\n // Set border radius\n if (primary?.borderRadius || secondary?.borderRadius) {\n // Conflicts between primary and secondary border radius is handled above\n const baseRadius = updateLength(primary?.borderRadius, 0.5) ?? updateLength(secondary?.borderRadius, 0.5);\n\n if (theme['rounded-base']) {\n if (theme['rounded-base'] !== baseRadius) {\n theme['button-radius'] = primary?.borderRadius;\n }\n } else {\n theme['rounded-base'] = baseRadius;\n }\n }\n }\n\n if (inputs) {\n const { backgroundColor, textColor, placeholderColor, borderColor, borderRadius, ...expectEmpty } = inputs;\n RUN_IN_DEV(() => {\n if (Object.keys(expectEmpty).length > 0) warn('styleToTheme: Unrecognized style.buttons properties', expectEmpty);\n\n if (backgroundColor && theme.background && theme.background !== backgroundColor)\n error('styleToTheme: Input now always use the container background', {\n inputBackground: backgroundColor,\n containerBackground: theme.background,\n });\n });\n\n Object.assign(theme, {\n foreground: textColor,\n input: borderColor,\n 'muted-foreground': placeholderColor,\n } satisfies Partial<Theme>);\n\n // Set border radius\n if (theme['rounded-base']) {\n if (theme['rounded-base'] !== borderRadius) {\n theme['input-radius'] = borderRadius;\n }\n } else {\n theme['rounded-base'] = borderRadius;\n }\n }\n\n // presentation.options mapping\n // ------------------------------------------------\n\n options.hideHeaderText = hideHeaderText;\n if (logo?.logoImageUrl) {\n options.logo = {\n url: logo.logoImageUrl,\n alt: '',\n };\n\n RUN_IN_DEV(() => {\n logger.warn('styleToTheme: Please set options.logo.alt for the logo alt text for accessibility');\n });\n }\n\n return { theme: removeEmptyValues(theme), options: removeEmptyValues(options) };\n}\n\nfunction removeEmptyValues<T extends Record<string, unknown>>(obj: T): T {\n return Object.fromEntries(Object.entries(obj).filter(([, value]) => value != null && value !== '')) as T;\n}\n\nfunction updateLength(length: string | undefined, factor: number): string | undefined {\n if (!length) return length;\n\n // Loose check that this is a numeric and not keyword value\n const value = parseFloat(length);\n if (Number.isNaN(value)) return length;\n\n return `calc(${length} * ${factor})`;\n}\n"],"names":["styleToTheme","styleConfig","silent","warn","logger","error","theme","options","colors","container","inputs","hideHeaderText","buttons","logo","fontFamily","outerEmpty","RUN_IN_DEV","Object","keys","length","primary","secondary","success","warning","accent","expectEmpty","assign","destructive","backgroundColor","borderColor","width","borderRadius","background","border","updateLength","disabled","textColor","primaryRadius","secondaryRadius","baseRadius","placeholderColor","inputBackground","containerBackground","foreground","input","logoImageUrl","url","alt","removeEmptyValues","obj","fromEntries","entries","filter","value","factor","parseFloat","Number","isNaN"],"mappings":";;;AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BO,SAASA,YAAAA,CACdC,WAAwB,EACxB,EAAEC,MAAM,EAAwB,GAAG,EAAE,EAAA;AAKrC,IAAA,MAAMC,OAAOD,MAAAA,GACT,IAAA;;AAEA,IAAA,CAAA,GACAE,OAAOD,IAAI;AACf,IAAA,MAAME,QAAQH,MAAAA,GACV,IAAA;;AAEA,IAAA,CAAA,GACAE,OAAOC,KAAK;AAEhB,IAAA,MAAMC,QAAwB,EAAC;AAC/B,IAAA,MAAMC,UAAwC,EAAC;AAE/C,IAAA,MAAM,EAAEC,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,cAAc,EAAEC,OAAO,EAAEC,IAAI,EAAEC,UAAU,EAAE,GAAGC,YAAY,GAAGd,WAAAA;;;IAIhGe,UAAAA,CAAW,IAAA;AACTb,QAAAA,IAAAA,CACE,qGACE,wGAAA,GACA,2BAAA,CAAA;QAGJ,IAAIc,MAAAA,CAAOC,IAAI,CAACH,UAAAA,CAAAA,CAAYI,MAAM,GAAG,CAAA,EAAGhB,KAAK,6CAAA,EAA+CY,UAAAA,CAAAA;AAC9F,IAAA,CAAA,CAAA;IAEAT,KAAK,CAAC,cAAc,GAAGQ,UAAAA;AAEvB,IAAA,IAAIN,MAAAA,EAAQ;AACV,QAAA,MAAM,EAAEY,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAEnB,KAAK,EAAE,GAAGoB,aAAa,GAAGjB,MAAAA;QAChFQ,UAAAA,CAAW,IAAA;YACT,IAAIC,MAAAA,CAAOC,IAAI,CAACO,WAAAA,CAAAA,CAAaN,MAAM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ACF,IAAA;;;AAKAxB,IAAAA,OAAAA,CAAQI,cAAc,GAAGA,cAAAA;AACzB,IAAA,IAAIE,MAAMgC,YAAAA,EAAc;AACtBtC,QAAAA,OAAAA,CAAQM,IAAI,GAAG;AACbiC,YAAAA,GAAAA,EAAKjC,KAAKgC,YAAY;YACtBE,GAAAA,EAAK;AACP,SAAA;QAEA/B,UAAAA,CAAW,IAAA;AACTZ,YAAAA,MAAAA,CAAOD,IAAI,CAAC,mFAAA,CAAA;AACd,QAAA,CAAA,CAAA;AACF,IAAA;IAEA,OAAO;AAAEG,QAAAA,KAAAA,EAAO0C,iBAAAA,CAAkB1C,KAAAA,CAAAA;AAAQC,QAAAA,OAAAA,EAASyC,iBAAAA,CAAkBzC,OAAAA;AAAS,KAAA;AAChF;AAEA,SAASyC,kBAAqDC,GAAM,EAAA;AAClE,IAAA,OAAOhC,MAAAA,CAAOiC,WAAW,CAACjC,MAAAA,CAAOkC,OAAO,CAACF,GAAAA,CAAAA,CAAKG,MAAM,CAAC,CAAC,GAAGC,KAAAA,CAAM,GAAKA,KAAAA,IAAS,QAAQA,KAAAA,KAAU,EAAA,CAAA,CAAA;AACjG;AAEA,SAASnB,YAAAA,CAAaf,MAA0B,EAAEmC,MAAc,EAAA;IAC9D,IAAI,CAACnC,QAAQ,OAAOA,MAAAA;;AAGpB,IAAA,MAAMkC,QAAQE,UAAAA,CAAWpC,MAAAA,CAAAA;AACzB,IAAA,IAAIqC,MAAAA,CAAOC,KAAK,CAACJ,KAAAA,CAAAA,EAAQ,OAAOlC,MAAAA;IAEhC,OAAO,CAAC,KAAK,EAAEA,MAAAA,CAAO,GAAG,EAAEmC,MAAAA,CAAO,CAAC,CAAC;AACtC;;;;"}
@@ -1,6 +1,7 @@
1
1
  import { defaultTheme } from './themes/themes.mjs';
2
2
  import { useContext, createContext, useMemo } from 'react';
3
3
  import { useMediaQuery } from '../hooks/useMediaQuery.mjs';
4
+ import { RUN_IN_DEV } from '../../../../core/src/utils/dev.mjs';
4
5
  import { logger } from '../../../../core/src/utils/logger.mjs';
5
6
 
6
7
  const defaultOptions = {
@@ -8,13 +9,13 @@ const defaultOptions = {
8
9
  };
9
10
  function usePresentationWithDefault(maybeConfig, displayWatermark, products, productsName) {
10
11
  const { theme, options } = maybeConfig ?? {};
11
- {
12
+ RUN_IN_DEV(()=>{
12
13
  const stringProducts = products.filter((p)=>typeof p === 'string');
13
14
  if (stringProducts.length > 0) {
14
15
  logger.error(`Please add an import for ${productsName} and update config.products to\n` + 'products: [' + products.map((p)=>`${productsName}.${typeof p === 'string' ? p : p.id}`).join(', ') + ']');
15
16
  throw new Error("'config.products' should not include strings anymore");
16
17
  }
17
- }
18
+ });
18
19
  // Switch theme automatically depending on color scheme
19
20
  const isDynamic = isDynamicTheme(theme);
20
21
  const darkMode = useMediaQuery(isDynamic ? '(prefers-color-scheme: dark)' : undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"PresentationConfig.mjs","sources":["../../../../../../../../web/src/ui/components/PresentationConfig.ts"],"sourcesContent":["import { defaultTheme } from './themes/themes';\nimport { createContext, useContext, useMemo } from 'react';\nimport { PresentationConfig } from '../../types';\nimport { Theme } from './themes/ThemeConfig';\nimport { useMediaQuery } from '../hooks/useMediaQuery';\nimport { IconRegistry } from './IconRegistry';\nimport { IconNames } from '../b2c/components/Icons';\nimport { logger } from '@stytch/core';\n\nexport type PresentationOptions = {\n /**\n * When this value is false, the title and description text will not show in the SDK.\n */\n hideHeaderText: boolean;\n\n /**\n * Optional suffix for <input> id attribute so input IDs are unique.\n */\n inputIdSuffix?: string;\n\n /**\n * The configuration object for your custom logo.\n */\n logo?: {\n /**\n * The URL of your custom logo.\n */\n url: string;\n\n /**\n * Alt text for the logo. This would usually be the name of the website or your company,\n * unless this is already repeated nearby in which case this should be left empty.\n */\n alt: string;\n };\n\n /**\n * Override our icons. Currently, this only supports logos, such as those that appear in Oauth buttons.\n * This should be an object where the key is the icon name and the value is a React component\n * (not React element) with a size prop and the rest spread onto the root element.\n *\n * Note that custom logos not imported from our packages is not yet available in @stytch/vanilla-js.\n * We are looking at provide alternatives in the future.\n *\n * @example\n *\n * // Using a solid black or white icon\n * import { whiteIcons } from '@stytch/react';\n *\n * const presentation = {\n * options: {\n * icons: {\n * outlook: whiteIcons.outlook,\n * },\n * },\n * };\n *\n * // Using a custom icon\n * const presentation = {\n * icons: {\n * outlook: ({ size, ...props }) => (\n * <svg width={size} height={size} {...props}>...</svg>\n * ),\n * },\n * };\n */\n icons?: IconRegistry<string>;\n};\n\nconst defaultOptions: PresentationOptions = {\n hideHeaderText: false,\n};\n\n/**\n * Internal type -\n * @see {PresentationConfig} is the public one\n */\nexport type Presentation = {\n theme: Theme;\n options: PresentationOptions;\n\n // Internal properties\n displayWatermark: boolean;\n iconRegistry: IconRegistry<string>;\n};\n\nexport function usePresentationWithDefault(\n maybeConfig: PresentationConfig | undefined,\n displayWatermark: boolean,\n products: { id: string; icons?: Partial<IconRegistry<IconNames>> }[],\n productsName?: string,\n): Presentation {\n const { theme, options } = maybeConfig ?? {};\n\n if (process.env.NODE_ENV !== 'production') {\n const stringProducts = products.filter((p) => typeof p === 'string');\n if (stringProducts.length > 0) {\n logger.error(\n `Please add an import for ${productsName} and update config.products to\\n` +\n 'products: [' +\n products.map((p) => `${productsName}.${typeof p === 'string' ? p : p.id}`).join(', ') +\n ']',\n );\n\n throw new Error(\"'config.products' should not include strings anymore\");\n }\n }\n\n // Switch theme automatically depending on color scheme\n const isDynamic = isDynamicTheme(theme);\n const darkMode = useMediaQuery(isDynamic ? '(prefers-color-scheme: dark)' : undefined);\n\n let effectiveTheme: Partial<Theme> | undefined;\n if (isDynamic) {\n effectiveTheme = darkMode ? theme[1] : theme[0];\n } else {\n effectiveTheme = theme;\n }\n\n // Memoize the icon registry so it only need to be constructed once\n const iconRegistry = useMemo(() => {\n const registry: IconRegistry<string> = {};\n for (const product of products) {\n Object.assign(registry, product.icons);\n }\n Object.assign(registry, options?.icons);\n return registry;\n }, [products, options]);\n\n return {\n theme: {\n ...defaultTheme,\n ...effectiveTheme,\n },\n options: {\n ...defaultOptions,\n ...options,\n },\n displayWatermark,\n iconRegistry,\n };\n}\n\nexport function isDynamicTheme(\n theme: PresentationConfig['theme'],\n): theme is readonly [light: Partial<Theme>, dark: Partial<Theme>] {\n return Array.isArray(theme);\n}\n\nexport const PresentationContext = createContext<Presentation>(undefined!);\nexport const usePresentation = () => useContext(PresentationContext);\n"],"names":["defaultOptions","hideHeaderText","usePresentationWithDefault","maybeConfig","displayWatermark","products","productsName","theme","options","stringProducts","filter","p","length","logger","error","map","id","join","Error","isDynamic","isDynamicTheme","darkMode","useMediaQuery","undefined","effectiveTheme","iconRegistry","useMemo","registry","product","Object","assign","icons","defaultTheme","Array","isArray","PresentationContext","createContext","usePresentation","useContext"],"mappings":";;;;;AAqEA,MAAMA,cAAAA,GAAsC;IAC1CC,cAAAA,EAAgB;AAClB,CAAA;AAeO,SAASC,2BACdC,WAA2C,EAC3CC,gBAAyB,EACzBC,QAAoE,EACpEC,YAAqB,EAAA;AAErB,IAAA,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGL,eAAe,EAAC;AAE3C,IAA2C;AACzC,QAAA,MAAMM,iBAAiBJ,QAAAA,CAASK,MAAM,CAAC,CAACC,CAAAA,GAAM,OAAOA,CAAAA,KAAM,QAAA,CAAA;QAC3D,IAAIF,cAAAA,CAAeG,MAAM,GAAG,CAAA,EAAG;AAC7BC,YAAAA,MAAAA,CAAOC,KAAK,CACV,CAAC,yBAAyB,EAAER,YAAAA,CAAa,gCAAgC,CAAC,GACxE,aAAA,GACAD,QAAAA,CAASU,GAAG,CAAC,CAACJ,CAAAA,GAAM,CAAA,EAAGL,YAAAA,CAAa,CAAC,EAAE,OAAOK,CAAAA,KAAM,QAAA,GAAWA,CAAAA,GAAIA,CAAAA,CAAEK,EAAE,CAAA,CAAE,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA,GAChF,GAAA,CAAA;AAGJ,YAAA,MAAM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3,"file":"PresentationConfig.mjs","sources":["../../../../../../../../web/src/ui/components/PresentationConfig.ts"],"sourcesContent":["import { defaultTheme } from './themes/themes';\nimport { createContext, useContext, useMemo } from 'react';\nimport { PresentationConfig } from '../../types';\nimport { Theme } from './themes/ThemeConfig';\nimport { useMediaQuery } from '../hooks/useMediaQuery';\nimport { IconRegistry } from './IconRegistry';\nimport { IconNames } from '../b2c/components/Icons';\nimport { logger, RUN_IN_DEV } from '@stytch/core';\n\nexport type PresentationOptions = {\n /**\n * When this value is false, the title and description text will not show in the SDK.\n */\n hideHeaderText: boolean;\n\n /**\n * Optional suffix for <input> id attribute so input IDs are unique.\n */\n inputIdSuffix?: string;\n\n /**\n * The configuration object for your custom logo.\n */\n logo?: {\n /**\n * The URL of your custom logo.\n */\n url: string;\n\n /**\n * Alt text for the logo. This would usually be the name of the website or your company,\n * unless this is already repeated nearby in which case this should be left empty.\n */\n alt: string;\n };\n\n /**\n * Override our icons. Currently, this only supports logos, such as those that appear in Oauth buttons.\n * This should be an object where the key is the icon name and the value is a React component\n * (not React element) with a size prop and the rest spread onto the root element.\n *\n * Note that custom logos not imported from our packages is not yet available in @stytch/vanilla-js.\n * We are looking at provide alternatives in the future.\n *\n * @example\n *\n * // Using a solid black or white icon\n * import { whiteIcons } from '@stytch/react';\n *\n * const presentation = {\n * options: {\n * icons: {\n * outlook: whiteIcons.outlook,\n * },\n * },\n * };\n *\n * // Using a custom icon\n * const presentation = {\n * icons: {\n * outlook: ({ size, ...props }) => (\n * <svg width={size} height={size} {...props}>...</svg>\n * ),\n * },\n * };\n */\n icons?: IconRegistry<string>;\n};\n\nconst defaultOptions: PresentationOptions = {\n hideHeaderText: false,\n};\n\n/**\n * Internal type -\n * @see {PresentationConfig} is the public one\n */\nexport type Presentation = {\n theme: Theme;\n options: PresentationOptions;\n\n // Internal properties\n displayWatermark: boolean;\n iconRegistry: IconRegistry<string>;\n};\n\nexport function usePresentationWithDefault(\n maybeConfig: PresentationConfig | undefined,\n displayWatermark: boolean,\n products: { id: string; icons?: Partial<IconRegistry<IconNames>> }[],\n productsName?: string,\n): Presentation {\n const { theme, options } = maybeConfig ?? {};\n\n RUN_IN_DEV(() => {\n const stringProducts = products.filter((p) => typeof p === 'string');\n if (stringProducts.length > 0) {\n logger.error(\n `Please add an import for ${productsName} and update config.products to\\n` +\n 'products: [' +\n products.map((p) => `${productsName}.${typeof p === 'string' ? p : p.id}`).join(', ') +\n ']',\n );\n\n throw new Error(\"'config.products' should not include strings anymore\");\n }\n });\n\n // Switch theme automatically depending on color scheme\n const isDynamic = isDynamicTheme(theme);\n const darkMode = useMediaQuery(isDynamic ? '(prefers-color-scheme: dark)' : undefined);\n\n let effectiveTheme: Partial<Theme> | undefined;\n if (isDynamic) {\n effectiveTheme = darkMode ? theme[1] : theme[0];\n } else {\n effectiveTheme = theme;\n }\n\n // Memoize the icon registry so it only need to be constructed once\n const iconRegistry = useMemo(() => {\n const registry: IconRegistry<string> = {};\n for (const product of products) {\n Object.assign(registry, product.icons);\n }\n Object.assign(registry, options?.icons);\n return registry;\n }, [products, options]);\n\n return {\n theme: {\n ...defaultTheme,\n ...effectiveTheme,\n },\n options: {\n ...defaultOptions,\n ...options,\n },\n displayWatermark,\n iconRegistry,\n };\n}\n\nexport function isDynamicTheme(\n theme: PresentationConfig['theme'],\n): theme is readonly [light: Partial<Theme>, dark: Partial<Theme>] {\n return Array.isArray(theme);\n}\n\nexport const PresentationContext = createContext<Presentation>(undefined!);\nexport const usePresentation = () => useContext(PresentationContext);\n"],"names":["defaultOptions","hideHeaderText","usePresentationWithDefault","maybeConfig","displayWatermark","products","productsName","theme","options","RUN_IN_DEV","stringProducts","filter","p","length","logger","error","map","id","join","Error","isDynamic","isDynamicTheme","darkMode","useMediaQuery","undefined","effectiveTheme","iconRegistry","useMemo","registry","product","Object","assign","icons","defaultTheme","Array","isArray","PresentationContext","createContext","usePresentation","useContext"],"mappings":";;;;;;AAqEA,MAAMA,cAAAA,GAAsC;IAC1CC,cAAAA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U;AAC9ByB,YAAAA,MAAAA,CAAOC,MAAM,CAACH,QAAAA,EAAUC,OAAAA,CAAQG,KAAK,CAAA;AACvC,QAAA;QACAF,MAAAA,CAAOC,MAAM,CAACH,QAAAA,EAAUpB,OAAAA,EAASwB,KAAAA,CAAAA;QACjC,OAAOJ,QAAAA;IACT,CAAA,EAAG;AAACvB,QAAAA,QAAAA;AAAUG,QAAAA;AAAQ,KAAA,CAAA;IAEtB,OAAO;QACLD,KAAAA,EAAO;AACL,YAAA,GAAG0B,YAAY;AACf,YAAA,GAAGR;AACL,SAAA;QACAjB,OAAAA,EAAS;AACP,YAAA,GAAGR,cAAc;AACjB,YAAA,GAAGQ;AACL,SAAA;AACAJ,QAAAA,gBAAAA;AACAsB,QAAAA;AACF,KAAA;AACF;AAEO,SAASL,eACdd,KAAkC,EAAA;IAElC,OAAO2B,KAAAA,CAAMC,OAAO,CAAC5B,KAAAA,CAAAA;AACvB;AAEO,MAAM6B,mBAAAA,GAAsBC,aAAAA,CAA4Bb,SAAAA;AACxD,MAAMc,eAAAA,GAAkB,IAAMC,UAAAA,CAAWH,mBAAAA;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { collectCss } from '../../../../../../internal/style-injector/src/index.mjs';
2
2
 
3
- var css = ".Typography_module_typography__d307cb57{font-family:var(--st-font-family)}.Typography_module_header__d307cb57{color:var(--st-foreground);font-size:var(--st-text-2xl);font-weight:var(--st-font-weight-semibold);line-height:var(--st-line-height-2xl)}.Typography_module_body__d307cb57{color:var(--st-foreground);font-size:var(--st-text-base)}.Typography_module_body__d307cb57,.Typography_module_helper__d307cb57{font-weight:var(--st-font-weight-normal);line-height:var(--st-line-height-base)}.Typography_module_helper__d307cb57{color:var(--st-muted-foreground);font-size:var(--st-text-xs)}.Typography_module_start__d307cb57{text-align:start}.Typography_module_center__d307cb57{text-align:center}.Typography_module_end__d307cb57{text-align:end}.Typography_module_foreground__d307cb57{color:var(--st-foreground)}.Typography_module_muted__d307cb57{color:var(--st-muted-foreground)}.Typography_module_destructive__d307cb57{color:var(--st-destructive)}.Typography_module_warning__d307cb57{color:var(--st-warning)}.Typography_module_success__d307cb57{color:var(--st-success)}.Typography_module_regular__d307cb57{font-weight:var(--st-font-weight-normal)}.Typography_module_medium__d307cb57{font-weight:var(--st-font-weight-medium)}.Typography_module_semibold__d307cb57{font-weight:var(--st-font-weight-semibold)}.Typography_module_bold__d307cb57{font-weight:var(--st-font-weight-bold)}.Typography_module_defaultFont__d307cb57{font-family:var(--st-font-family)}.Typography_module_monoFont__d307cb57{font-family:var(--st-font-family-mono)}";
3
+ var css = ".Typography_module_typography__74817c74{font-family:var(--st-font-family)}.Typography_module_header__74817c74{color:var(--st-foreground);font-family:var(--st-header-font);font-size:var(--st-text-2xl);font-weight:var(--st-font-weight-semibold);line-height:var(--st-line-height-2xl)}.Typography_module_body__74817c74{color:var(--st-foreground);font-size:var(--st-text-base)}.Typography_module_body__74817c74,.Typography_module_helper__74817c74{font-weight:var(--st-font-weight-normal);line-height:var(--st-line-height-base)}.Typography_module_helper__74817c74{color:var(--st-muted-foreground);font-size:var(--st-text-xs)}.Typography_module_start__74817c74{text-align:start}.Typography_module_center__74817c74{text-align:center}.Typography_module_end__74817c74{text-align:end}.Typography_module_foreground__74817c74{color:var(--st-foreground)}.Typography_module_muted__74817c74{color:var(--st-muted-foreground)}.Typography_module_destructive__74817c74{color:var(--st-destructive)}.Typography_module_warning__74817c74{color:var(--st-warning)}.Typography_module_success__74817c74{color:var(--st-success)}.Typography_module_regular__74817c74{font-weight:var(--st-font-weight-normal)}.Typography_module_medium__74817c74{font-weight:var(--st-font-weight-medium)}.Typography_module_semibold__74817c74{font-weight:var(--st-font-weight-semibold)}.Typography_module_bold__74817c74{font-weight:var(--st-font-weight-bold)}.Typography_module_defaultFont__74817c74{font-family:var(--st-font-family)}.Typography_module_monoFont__74817c74{font-family:var(--st-font-family-mono)}";
4
4
  collectCss(css);
5
- var modules_1d7499fc = {"typography":"Typography_module_typography__d307cb57","header":"Typography_module_header__d307cb57","body":"Typography_module_body__d307cb57","helper":"Typography_module_helper__d307cb57","start":"Typography_module_start__d307cb57","center":"Typography_module_center__d307cb57","end":"Typography_module_end__d307cb57","foreground":"Typography_module_foreground__d307cb57","muted":"Typography_module_muted__d307cb57","destructive":"Typography_module_destructive__d307cb57","warning":"Typography_module_warning__d307cb57","success":"Typography_module_success__d307cb57","regular":"Typography_module_regular__d307cb57","medium":"Typography_module_medium__d307cb57","semibold":"Typography_module_semibold__d307cb57","bold":"Typography_module_bold__d307cb57","defaultFont":"Typography_module_defaultFont__d307cb57","monoFont":"Typography_module_monoFont__d307cb57"};
5
+ var modules_1d7499fc = {"typography":"Typography_module_typography__74817c74","header":"Typography_module_header__74817c74","body":"Typography_module_body__74817c74","helper":"Typography_module_helper__74817c74","start":"Typography_module_start__74817c74","center":"Typography_module_center__74817c74","end":"Typography_module_end__74817c74","foreground":"Typography_module_foreground__74817c74","muted":"Typography_module_muted__74817c74","destructive":"Typography_module_destructive__74817c74","warning":"Typography_module_warning__74817c74","success":"Typography_module_success__74817c74","regular":"Typography_module_regular__74817c74","medium":"Typography_module_medium__74817c74","semibold":"Typography_module_semibold__74817c74","bold":"Typography_module_bold__74817c74","defaultFont":"Typography_module_defaultFont__74817c74","monoFont":"Typography_module_monoFont__74817c74"};
6
6
 
7
7
  export { css, modules_1d7499fc as default };
8
8
  //# sourceMappingURL=Typography.module.css.mjs.map
@@ -20,7 +20,7 @@ import { createB2BComponent } from '../bindings/createB2BComponent.mjs';
20
20
  * onEvent: (event) => console.log(event)
21
21
  * }}
22
22
  * />
23
- */ const B2BIdentityProvider = createB2BComponent('B2BIdentityProvider', B2BIDPContainer);
23
+ */ const B2BIdentityProvider = /* @__PURE__ */ createB2BComponent('B2BIdentityProvider', B2BIDPContainer);
24
24
 
25
25
  export { B2BIdentityProvider };
26
26
  //# sourceMappingURL=B2BIdentityProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"B2BIdentityProvider.mjs","sources":["../../../../../../../../../web/src/ui/react/b2b/B2BIdentityProvider.tsx"],"sourcesContent":["import { StytchB2BProps } from './Stytch';\nimport { B2BIDPContainer } from '../../b2b/App';\nimport { createB2BComponent } from '../bindings/createB2BComponent';\nimport { AuthTokenParams, B2BIDPConsentManifestGenerator } from '../../../types';\n\nexport type B2BIdentityProviderProps = Omit<StytchB2BProps, 'config'> & {\n /**\n * Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.\n */\n getIDPConsentManifest?: B2BIDPConsentManifestGenerator;\n /**\n * Optional trusted auth token parameters to attest before the OAuth flow.\n */\n trustedAuthTokenParams?: AuthTokenParams;\n};\n\n/**\n * The Stytch B2B IDP component.\n * Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.\n * Requires the user to be logged in.\n * This component can only be used with a Stytch B2B UI Client\n * passed into the StytchB2BProvider.\n *\n * See the {@link https://stytch.com/docs/b2b/sdks online reference}\n *\n * @example\n * <B2BIdentityProvider\n * presentation={{\n * theme: { primary: '#ff00f7' },\n * options: {},\n * }}\n * callbacks={{\n * onEvent: (event) => console.log(event)\n * }}\n * />\n */\nexport const B2BIdentityProvider = createB2BComponent('B2BIdentityProvider', B2BIDPContainer);\n"],"names":["B2BIdentityProvider","createB2BComponent","B2BIDPContainer"],"mappings":";;;AAgBA;;;;;;;;;;;;;;;;;;;AAmBC,IACM,MAAMA,mBAAAA,GAAsBC,kBAAAA,CAAmB,uBAAuBC,eAAAA;;;;"}
1
+ {"version":3,"file":"B2BIdentityProvider.mjs","sources":["../../../../../../../../../web/src/ui/react/b2b/B2BIdentityProvider.tsx"],"sourcesContent":["import { StytchB2BProps } from './Stytch';\nimport { B2BIDPContainer } from '../../b2b/App';\nimport { createB2BComponent } from '../bindings/createB2BComponent';\nimport { AuthTokenParams, B2BIDPConsentManifestGenerator } from '../../../types';\n\nexport type B2BIdentityProviderProps = Omit<StytchB2BProps, 'config'> & {\n /**\n * Optional {@link B2BIDPConsentManifestGenerator} to customize the consent screen.\n */\n getIDPConsentManifest?: B2BIDPConsentManifestGenerator;\n /**\n * Optional trusted auth token parameters to attest before the OAuth flow.\n */\n trustedAuthTokenParams?: AuthTokenParams;\n};\n\n/**\n * The Stytch B2B IDP component.\n * Parses OAuth Authorization params (client_id, scope, nonce, etc.) out of the page URL.\n * Requires the user to be logged in.\n * This component can only be used with a Stytch B2B UI Client\n * passed into the StytchB2BProvider.\n *\n * See the {@link https://stytch.com/docs/b2b/sdks online reference}\n *\n * @example\n * <B2BIdentityProvider\n * presentation={{\n * theme: { primary: '#ff00f7' },\n * options: {},\n * }}\n * callbacks={{\n * onEvent: (event) => console.log(event)\n * }}\n * />\n */\nexport const B2BIdentityProvider = /* @__PURE__ */ createB2BComponent('B2BIdentityProvider', B2BIDPContainer);\n"],"names":["B2BIdentityProvider","createB2BComponent","B2BIDPContainer"],"mappings":";;;AAgBA;;;;;;;;;;;;;;;;;;;AAmBC,IACM,MAAMA,mBAAAA,mBAAsCC,kBAAAA,CAAmB,uBAAuBC,eAAAA;;;;"}
@@ -32,7 +32,7 @@ import { createB2BComponent } from '../bindings/createB2BComponent.mjs';
32
32
  * onEvent: (event) => console.log(event)
33
33
  * }}
34
34
  * />
35
- */ const StytchB2B = createB2BComponent('StytchB2B', AppContainer);
35
+ */ const StytchB2B = /* @__PURE__ */ createB2BComponent('StytchB2B', AppContainer);
36
36
 
37
37
  export { StytchB2B };
38
38
  //# sourceMappingURL=Stytch.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stytch.mjs","sources":["../../../../../../../../../web/src/ui/react/b2b/Stytch.tsx"],"sourcesContent":["import { Callbacks, StringsOptions, StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { PresentationConfig, StytchB2BUIConfig } from '../../../types';\nimport { AppContainer } from '../../b2b/App';\nimport { createB2BComponent } from '../bindings/createB2BComponent';\n\nexport interface StytchB2BProps<\n TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration,\n> extends StringsOptions {\n /**\n * An optional {@link PresentationConfig} to customize the UI presentation.\n */\n presentation?: PresentationConfig;\n /**\n * An optional {@link Callbacks} object.\n *\n * @example\n * {\n * onError: ({message}) => {\n * console.error('Stytch error', message)\n * }\n * }\n *\n * @example\n * {\n * onEvent: ({type, data}) => {\n * if(type === StytchEventType.B2BMagicLinkAuthenticate) {\n * console.log('Logged in with', data);\n * }\n * }\n * }\n */\n callbacks?: Callbacks<TProjectConfiguration>;\n /**\n * A {@link StytchB2BUIConfig} object. Add products and product-specific config to this object to change the login methods shown.\n *\n *\n * @example\n * {\n * products: [B2BProducts.emailMagicLinks],\n * authFlowType: \"Discovery\",\n * emailMagicLinksOptions: {\n * discoveryRedirectURL: 'https://example.com/authenticate',\n * },\n * sessionOptions: {\n * sessionDurationMinutes: 60,\n * },\n * }\n *\n * @example\n * {\n * products: [B2BProducts.emailMagicLinks, B2BProducts.sso],\n * authFlowType: \"Organization\",\n * emailMagicLinksOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * ssoOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * sessionOptions: {\n * sessionDurationMinutes: 60,\n * },\n * }\n */\n config: StytchB2BUIConfig;\n}\n\n/**\n * The Stytch B2B UI component.\n * This component can only be used with a Stytch B2B UI Client\n * passed into the StytchB2BProvider.\n *\n * See the {@link https://stytch.com/docs/b2b/sdks online reference}\n *\n * @example\n * <StytchB2B\n * config={{\n * authFlowType: \"Organization\",\n * emailMagicLinksOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * ssoOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * sessionOptions: {\n * sessionDurationMinutes: 60,\n * }\n * }}\n * presentation={{\n * theme: { primary: '#0577CA' },\n * options: {},\n * }}\n * callbacks={{\n * onEvent: (event) => console.log(event)\n * }}\n * />\n */\nexport const StytchB2B = createB2BComponent('StytchB2B', AppContainer);\n"],"names":["StytchB2B","createB2BComponent","AppContainer"],"mappings":";;;AAoEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BC,IACM,MAAMA,SAAAA,GAAYC,kBAAAA,CAAmB,aAAaC,YAAAA;;;;"}
1
+ {"version":3,"file":"Stytch.mjs","sources":["../../../../../../../../../web/src/ui/react/b2b/Stytch.tsx"],"sourcesContent":["import { Callbacks, StringsOptions, StytchProjectConfigurationInput } from '@stytch/core/public';\nimport { PresentationConfig, StytchB2BUIConfig } from '../../../types';\nimport { AppContainer } from '../../b2b/App';\nimport { createB2BComponent } from '../bindings/createB2BComponent';\n\nexport interface StytchB2BProps<\n TProjectConfiguration extends StytchProjectConfigurationInput = Stytch.DefaultProjectConfiguration,\n> extends StringsOptions {\n /**\n * An optional {@link PresentationConfig} to customize the UI presentation.\n */\n presentation?: PresentationConfig;\n /**\n * An optional {@link Callbacks} object.\n *\n * @example\n * {\n * onError: ({message}) => {\n * console.error('Stytch error', message)\n * }\n * }\n *\n * @example\n * {\n * onEvent: ({type, data}) => {\n * if(type === StytchEventType.B2BMagicLinkAuthenticate) {\n * console.log('Logged in with', data);\n * }\n * }\n * }\n */\n callbacks?: Callbacks<TProjectConfiguration>;\n /**\n * A {@link StytchB2BUIConfig} object. Add products and product-specific config to this object to change the login methods shown.\n *\n *\n * @example\n * {\n * products: [B2BProducts.emailMagicLinks],\n * authFlowType: \"Discovery\",\n * emailMagicLinksOptions: {\n * discoveryRedirectURL: 'https://example.com/authenticate',\n * },\n * sessionOptions: {\n * sessionDurationMinutes: 60,\n * },\n * }\n *\n * @example\n * {\n * products: [B2BProducts.emailMagicLinks, B2BProducts.sso],\n * authFlowType: \"Organization\",\n * emailMagicLinksOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * ssoOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * sessionOptions: {\n * sessionDurationMinutes: 60,\n * },\n * }\n */\n config: StytchB2BUIConfig;\n}\n\n/**\n * The Stytch B2B UI component.\n * This component can only be used with a Stytch B2B UI Client\n * passed into the StytchB2BProvider.\n *\n * See the {@link https://stytch.com/docs/b2b/sdks online reference}\n *\n * @example\n * <StytchB2B\n * config={{\n * authFlowType: \"Organization\",\n * emailMagicLinksOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * ssoOptions: {\n * loginRedirectURL: 'https://example.com/authenticate',\n * signupRedirectURL: 'https://example.com/authenticate',\n * },\n * sessionOptions: {\n * sessionDurationMinutes: 60,\n * }\n * }}\n * presentation={{\n * theme: { primary: '#0577CA' },\n * options: {},\n * }}\n * callbacks={{\n * onEvent: (event) => console.log(event)\n * }}\n * />\n */\nexport const StytchB2B = /* @__PURE__ */ createB2BComponent('StytchB2B', AppContainer);\n"],"names":["StytchB2B","createB2BComponent","AppContainer"],"mappings":";;;AAoEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BC,IACM,MAAMA,SAAAA,mBAA4BC,kBAAAA,CAAmB,aAAaC,YAAAA;;;;"}
@@ -85,7 +85,7 @@ const useIsMounted__INTERNAL = ()=>useContext(StytchB2BContext).isMounted;
85
85
  *
86
86
  * Remember - authorization checks for sensitive actions should always occur on the backend as well.
87
87
  * @example
88
- * const { isAuthorized } = useStytchIsAuthorized<Permissions>('documents', 'edit');
88
+ * const { isAuthorized } = useStytchIsAuthorized('documents', 'edit');
89
89
  * return <button disabled={!isAuthorized}>Edit</button>
90
90
  */ const useStytchIsAuthorized = (resourceId, action)=>{
91
91
  invariant(useIsMounted__INTERNAL(), noProviderError('useStytchIsAuthorized', 'StytchB2BProvider'));