@dynamic-labs/sdk-react-core 0.19.4 → 0.19.6

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 (125) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +9 -9
  5. package/src/index.cjs +6 -2
  6. package/src/index.d.ts +2 -2
  7. package/src/index.js +3 -1
  8. package/src/lib/Main.cjs +1 -0
  9. package/src/lib/Main.js +1 -0
  10. package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -1
  11. package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +1 -1
  12. package/src/lib/components/AnimatePresence/AnimatePresence.cjs +1 -1
  13. package/src/lib/components/AnimatePresence/AnimatePresence.js +1 -1
  14. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +1 -1
  15. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +1 -1
  16. package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +1 -1
  17. package/src/lib/components/MenuList/Dropdown/Dropdown.js +1 -1
  18. package/src/lib/components/Modal/Modal.cjs +1 -1
  19. package/src/lib/components/Modal/Modal.js +1 -1
  20. package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +85 -5
  21. package/src/lib/components/NeedHelpSection/NeedHelpSection.js +86 -6
  22. package/src/lib/components/NetworkPicker/NetworkPicker.cjs +11 -9
  23. package/src/lib/components/NetworkPicker/NetworkPicker.d.ts +2 -1
  24. package/src/lib/components/NetworkPicker/NetworkPicker.js +11 -9
  25. package/src/lib/components/OverlayCard/OverlayCard.cjs +1 -1
  26. package/src/lib/components/OverlayCard/OverlayCard.js +1 -1
  27. package/src/lib/components/Portal/Portal.cjs +1 -1
  28. package/src/lib/components/Portal/Portal.js +1 -1
  29. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.cjs +2 -1
  30. package/src/lib/components/SendBalancePageLayout/components/TokenBalanceCard/TokenBalanceCard.js +2 -1
  31. package/src/lib/components/SocialSignIn/SocialSignIn.cjs +1 -1
  32. package/src/lib/components/SocialSignIn/SocialSignIn.js +1 -1
  33. package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.cjs +1 -1
  34. package/src/lib/components/SyncPasskeyFlow/SyncPasskeyFlow.js +1 -1
  35. package/src/lib/components/Tooltip/Tooltip.cjs +1 -1
  36. package/src/lib/components/Tooltip/Tooltip.js +1 -1
  37. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
  38. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
  39. package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.cjs +1 -1
  40. package/src/lib/components/Transition/VerticalDrawerTransition/VerticalDrawerTransition.js +1 -1
  41. package/src/lib/components/UserAddress/UserAddress.cjs +1 -1
  42. package/src/lib/components/UserAddress/UserAddress.js +1 -1
  43. package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -1
  44. package/src/lib/context/DynamicContext/DynamicContext.js +1 -1
  45. package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +1 -1
  46. package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +1 -1
  47. package/src/lib/context/MockContext/MockContext.cjs +1 -0
  48. package/src/lib/context/MockContext/MockContext.js +1 -0
  49. package/src/lib/context/QrCodeContext/QrCodeContext.cjs +1 -1
  50. package/src/lib/context/QrCodeContext/QrCodeContext.js +1 -1
  51. package/src/lib/context/SendBalanceContext/SendBalanceContext.cjs +1 -1
  52. package/src/lib/context/SendBalanceContext/SendBalanceContext.js +1 -1
  53. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +16 -2
  54. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +17 -3
  55. package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.cjs +1 -1
  56. package/src/lib/context/UserFieldEditorContext/UserFieldEditorContext.js +1 -1
  57. package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +9 -11
  58. package/src/lib/layout/DynamicAuthLayout/Header/header.js +10 -12
  59. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +1 -0
  60. package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +1 -0
  61. package/src/lib/locale/en/translation.cjs +7 -3
  62. package/src/lib/locale/en/translation.d.ts +6 -2
  63. package/src/lib/locale/en/translation.js +7 -3
  64. package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.cjs +1 -1
  65. package/src/lib/modals/SignMessageConfirmationModal/getProperErrorMessage.js +1 -1
  66. package/src/lib/styles/index.shadow.cjs +1 -1
  67. package/src/lib/styles/index.shadow.js +1 -1
  68. package/src/lib/utils/hooks/index.d.ts +1 -0
  69. package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +8 -9
  70. package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +8 -9
  71. package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +8 -1
  72. package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +9 -2
  73. package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.cjs +34 -5
  74. package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.d.ts +33 -1
  75. package/src/lib/utils/hooks/useWalletConnectorEvent/useWalletConnectorEvent.js +34 -5
  76. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +8 -0
  77. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +9 -1
  78. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +19 -18
  79. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +2 -1
  80. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +19 -18
  81. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
  82. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
  83. package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.cjs +32 -8
  84. package/src/lib/utils/hooks/useWalletsConnectionState/useWalletsConnectionState.js +33 -9
  85. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
  86. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
  87. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -1
  88. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -1
  89. package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +2 -5
  90. package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +2 -5
  91. package/src/lib/views/LoginView/useLoginView.cjs +106 -84
  92. package/src/lib/views/LoginView/useLoginView.js +107 -85
  93. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +6 -3
  94. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +6 -3
  95. package/src/lib/views/QrCodeView/QRCode.cjs +1 -1
  96. package/src/lib/views/QrCodeView/QRCode.js +1 -1
  97. package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -1
  98. package/src/lib/views/QrCodeView/QrCodeView.js +1 -1
  99. package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +1 -1
  100. package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +1 -1
  101. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +1 -1
  102. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +1 -1
  103. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs +1 -1
  104. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +1 -1
  105. package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +1 -0
  106. package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +1 -0
  107. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +1 -1
  108. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +1 -1
  109. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -2
  110. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -2
  111. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -0
  112. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -0
  113. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +1 -1
  114. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +1 -1
  115. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.cjs +1 -1
  116. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetDropdown/DynamicWidgetDropdown.js +1 -1
  117. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +1 -1
  118. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -1
  119. package/src/lib/widgets/DynamicWidget/helpers/helpers.cjs +7 -7
  120. package/src/lib/widgets/DynamicWidget/helpers/helpers.d.ts +1 -1
  121. package/src/lib/widgets/DynamicWidget/helpers/helpers.js +7 -7
  122. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +16 -6
  123. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +16 -6
  124. package/src/lib/utils/functions/getEnabledProviders/index.cjs +0 -7
  125. package/src/lib/utils/functions/getEnabledProviders/index.js +0 -3
@@ -32,16 +32,13 @@ const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
32
32
  numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
33
33
  };
34
34
  const isMagicEnabled = isProviderEnabled.isProviderEnabled(providers, sdkApi.ProviderEnum.MagicLink);
35
- const isDynamicEnabled = isProviderEnabled.isProviderEnabled(providers, sdkApi.ProviderEnum.Dynamic) ||
36
- isProviderEnabled.isProviderEnabled(providers, sdkApi.ProviderEnum.EmailOnly);
37
35
  if (isMagicEnabled &&
38
36
  ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
39
37
  sdkApi.SignInProviderEnum.MagicLink) {
40
38
  return jsxRuntime.jsx(MagicSocialSignIn.MagicSocialSignIn, Object.assign({}, componentProps));
41
39
  }
42
- if (isDynamicEnabled &&
43
- ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
44
- sdkApi.SignInProviderEnum.Dynamic) {
40
+ if (((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
41
+ sdkApi.SignInProviderEnum.Dynamic) {
45
42
  return jsxRuntime.jsx(DynamicSocialSignIn.DynamicSocialSignIn, Object.assign({}, componentProps));
46
43
  }
47
44
  return null;
@@ -28,16 +28,13 @@ const SocialSignInSection = ({ sectionData, collapsedLayout, }) => {
28
28
  numOfItemsToDisplay: sectionData.numOfItemsToDisplay,
29
29
  };
30
30
  const isMagicEnabled = isProviderEnabled(providers, ProviderEnum.MagicLink);
31
- const isDynamicEnabled = isProviderEnabled(providers, ProviderEnum.Dynamic) ||
32
- isProviderEnabled(providers, ProviderEnum.EmailOnly);
33
31
  if (isMagicEnabled &&
34
32
  ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _b === void 0 ? void 0 : _b.signInProvider) ===
35
33
  SignInProviderEnum.MagicLink) {
36
34
  return jsx(MagicSocialSignIn, Object.assign({}, componentProps));
37
35
  }
38
- if (isDynamicEnabled &&
39
- ((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
40
- SignInProviderEnum.Dynamic) {
36
+ if (((_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _c === void 0 ? void 0 : _c.signInProvider) ===
37
+ SignInProviderEnum.Dynamic) {
41
38
  return jsx(DynamicSocialSignIn, Object.assign({}, componentProps));
42
39
  }
43
40
  return null;
@@ -20,14 +20,19 @@ require('@dynamic-labs/utils');
20
20
  require('../../shared/consts/index.cjs');
21
21
  require('@dynamic-labs/multi-wallet');
22
22
  var isEmailProviderEnabled = require('../../utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.cjs');
23
- var index = require('../../utils/functions/getEnabledProviders/index.cjs');
24
23
 
25
24
  /* eslint-disable multiline-comment-style */
26
25
  const NUMBER_OF_WALLETS = 3;
27
26
  const useLoginView = () => {
28
- var _a, _b, _c, _d;
27
+ var _a, _b, _c, _d, _e, _f;
29
28
  const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, walletsFilter, } = useInternalDynamicContext.useInternalDynamicContext();
29
+ const { t } = reactI18next.useTranslation();
30
30
  const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
31
+ const hasSocialProvidersEnabled = Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length);
32
+ const hasEmailProviderEnabled = ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length) &&
33
+ isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
34
+ // is email only is set in the project settings when the "Email (Web2) only" is toggled on in the dashboard
35
+ const isEmailOnly = (_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _b === void 0 ? void 0 : _b.modal) === null || _c === void 0 ? void 0 : _c.emailOnly;
31
36
  /** Takes from wallets only those that can be selected in the wallet list by the user.
32
37
  * Should filter out embedded wallets
33
38
  * WHY: when we decide whether to show wallets or not, we need to know how many wallets
@@ -35,61 +40,91 @@ const useLoginView = () => {
35
40
  * wallets and then display an empty wallet list (since turnkey doesn't render)
36
41
  */
37
42
  const selectableWallets = (walletsFilter ? walletsFilter(wallets) : wallets).filter(({ key }) => key !== 'turnkey');
38
- const { t } = reactI18next.useTranslation();
39
- const hasEnabledProviders = Boolean(index.getEnabledProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers).length);
43
+ const separator = React.useMemo(() => ({
44
+ label: t('dyn_login.separators.default'),
45
+ type: sdkApi.SdkViewSectionType.Separator,
46
+ }), [t]);
40
47
  const isWalletOnly = React.useMemo(() => {
41
- var _a, _b, _c, _d;
48
+ var _a, _b, _c;
42
49
  if (!projectSettings) {
43
50
  return false;
44
51
  }
45
- // toolkit functionality overrides whatever is defined
46
- if (!loginWithEmail) {
52
+ // if both loginWithEmail AND hasSocialProvidersEnabled are false, it's wallet only
53
+ if (!loginWithEmail && !hasSocialProvidersEnabled) {
47
54
  return true;
48
55
  }
49
56
  const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === sdkApi.SdkViewType.Login);
50
- // backwards compatibility for those that didn't set up login view sessions
57
+ // backwards compatibility for those that didn't set up login view sections
51
58
  if (!((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length)) {
52
- return (!((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _d === void 0 ? void 0 : _d.length) ||
53
- !isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers));
59
+ return !hasEmailProviderEnabled && !hasSocialProvidersEnabled;
54
60
  }
55
61
  return (loginView.sections.length === 1 && loginView.sections[0].type === 'wallet');
56
- }, [projectSettings, loginWithEmail]);
62
+ }, [
63
+ projectSettings,
64
+ loginWithEmail,
65
+ hasSocialProvidersEnabled,
66
+ hasEmailProviderEnabled,
67
+ enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length,
68
+ ]);
57
69
  /**
58
- * build email and social view sections from project settings design.modal props - backwards compatibility
70
+ * build email from project settings design.modal props
59
71
  * @returns SdkViewSection[]
60
72
  */
61
73
  const getEmailViewSectionDefinition = React.useCallback(() => {
62
- var _a, _b;
63
- const loginViewSections = [
74
+ if (!hasEmailProviderEnabled)
75
+ return [];
76
+ return [
64
77
  {
65
78
  type: sdkApi.SdkViewSectionType.Email,
66
79
  },
67
80
  ];
68
- if (enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length) {
69
- const socialSection = {
81
+ }, [hasEmailProviderEnabled]);
82
+ /**
83
+ * build social from project settings design.modal props
84
+ * @returns SdkViewSection[]
85
+ */
86
+ const getSocialViewSectionDefinition = React.useCallback(() => {
87
+ if (!(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length))
88
+ return [];
89
+ return [
90
+ {
70
91
  numOfItemsToDisplay: 5,
71
92
  type: sdkApi.SdkViewSectionType.Social,
72
- };
73
- loginViewSections.push(socialSection);
74
- if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.splitEmailAndSocial) {
75
- loginViewSections.splice(1, 0, {
76
- label: t('dyn_login.separators.default'),
77
- type: sdkApi.SdkViewSectionType.Separator,
78
- });
79
- // eslint-disable-next-line prefer-destructuring
80
- socialSection.defaultItem = enabledSocialProviders[0];
81
- }
82
- }
83
- if ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.socialAboveEmail) {
84
- loginViewSections.reverse();
85
- }
86
- return loginViewSections;
93
+ },
94
+ ];
95
+ }, [enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length]);
96
+ const getWalletViewSectionDefinition = React.useCallback(() => {
97
+ var _a, _b;
98
+ if (!(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length))
99
+ return [];
100
+ const numOfItemsToDisplay = ((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _a === void 0 ? void 0 : _a.modal) === null || _b === void 0 ? void 0 : _b.showWalletsButton)
101
+ ? 0
102
+ : NUMBER_OF_WALLETS;
103
+ return [
104
+ {
105
+ numOfItemsToDisplay,
106
+ type: sdkApi.SdkViewSectionType.Wallet,
107
+ },
108
+ ];
87
109
  }, [
88
- enabledSocialProviders,
89
- (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.socialAboveEmail,
90
- (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.splitEmailAndSocial,
91
- t,
110
+ (_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.showWalletsButton,
111
+ selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
92
112
  ]);
113
+ const applyLoginModalSettings = React.useCallback((emailAndSocialSections) => {
114
+ if (emailAndSocialSections.length < 2) {
115
+ return emailAndSocialSections;
116
+ }
117
+ const { splitEmailAndSocial, socialAboveEmail } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) || {};
118
+ if (splitEmailAndSocial) {
119
+ emailAndSocialSections.splice(1, 0, separator);
120
+ // eslint-disable-next-line prefer-destructuring
121
+ emailAndSocialSections[2].defaultItem = enabledSocialProviders[0];
122
+ }
123
+ if (socialAboveEmail) {
124
+ emailAndSocialSections.reverse();
125
+ }
126
+ return emailAndSocialSections;
127
+ }, [enabledSocialProviders, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal, separator]);
93
128
  // TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
94
129
  /**
95
130
  * remove wallet view section from projectSettings?.sdk?.views if no wallet defined
@@ -102,78 +137,65 @@ const useLoginView = () => {
102
137
  }
103
138
  return sections.filter((section) => section.type !== 'wallet');
104
139
  }, [selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length]);
105
- const addSeparator = React.useCallback((index) => {
106
- // if not the first index, no separator is needed
107
- // if the first index but does not have wallets or providers,
108
- // it'll show only one view section - no separator is needed
109
- if (index !== 0 || !(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) || !hasEnabledProviders) {
110
- return [];
111
- }
112
- return [
113
- {
114
- label: t('dyn_login.separators.default'),
115
- type: sdkApi.SdkViewSectionType.Separator,
116
- },
117
- ];
118
- }, [hasEnabledProviders, selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length, t]);
119
140
  /**
120
141
  * build login view sections array from project settings design.modal props - backwards compatibility
121
142
  * @returns SdkViewSection[]
122
143
  */
123
- const buildLoginSections = React.useCallback(() => {
124
- let loginViewSections = [];
125
- authorizationViewDisplayOrder === null || authorizationViewDisplayOrder === void 0 ? void 0 : authorizationViewDisplayOrder.forEach((loginItem, index) => {
126
- var _a, _b;
127
- if (loginItem === 'email' &&
128
- (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) &&
129
- isEmailProviderEnabled.isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)) {
130
- loginViewSections = loginViewSections.concat(getEmailViewSectionDefinition(),
131
- // add separator if wallets defined
132
- addSeparator(index));
144
+ const buildLoginSections = React.useCallback((buildOrder) => {
145
+ var _a;
146
+ const loginViewSections = [];
147
+ buildOrder === null || buildOrder === void 0 ? void 0 : buildOrder.forEach((loginItem) => {
148
+ // Add a separator if there are sections already
149
+ if (loginViewSections.length)
150
+ loginViewSections.push(separator);
151
+ if (loginItem === 'email') {
152
+ // In the past, the email and social sections were combined into one section,
153
+ // so we need to check for that case and add the social section if needed for backwards compatibility
154
+ // if email was just pushed to the loginViewSections array and social is not defined in the buildOrder,
155
+ // then we need to add social (if social is enabled)
156
+ const emailAndSocialSections = [
157
+ ...getEmailViewSectionDefinition(),
158
+ ...getSocialViewSectionDefinition(),
159
+ ];
160
+ loginViewSections.push(...applyLoginModalSettings(emailAndSocialSections));
133
161
  }
134
- if (loginItem === 'wallet' && (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length)) {
135
- // if showWalletsButton is true, it should show "Connec with Wallet" button
136
- const numOfItemsToDisplay = ((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _a === void 0 ? void 0 : _a.modal) === null || _b === void 0 ? void 0 : _b.showWalletsButton)
137
- ? 0
138
- : NUMBER_OF_WALLETS;
139
- loginViewSections = loginViewSections.concat([
140
- {
141
- numOfItemsToDisplay,
142
- type: sdkApi.SdkViewSectionType.Wallet,
143
- },
144
- ],
145
- // add separator if email providers defined
146
- addSeparator(index));
162
+ if (loginItem === 'wallet') {
163
+ loginViewSections.push(...getWalletViewSectionDefinition());
147
164
  }
148
165
  });
166
+ // remove last separator
167
+ if (((_a = loginViewSections[loginViewSections.length - 1]) === null || _a === void 0 ? void 0 : _a.type) === 'separator') {
168
+ loginViewSections.pop();
169
+ }
149
170
  return loginViewSections;
150
171
  }, [
151
- addSeparator,
152
- authorizationViewDisplayOrder,
172
+ applyLoginModalSettings,
153
173
  getEmailViewSectionDefinition,
154
- (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _c === void 0 ? void 0 : _c.modal) === null || _d === void 0 ? void 0 : _d.showWalletsButton,
155
- projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers,
156
- selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
174
+ getSocialViewSectionDefinition,
175
+ getWalletViewSectionDefinition,
176
+ separator,
157
177
  ]);
158
178
  /**
159
179
  * returns the login view sections to be displayed in order from projectSettings?.sdk?.views
160
180
  * and has backwards compatibility with project settings design.modal props
161
181
  */
162
182
  const logingViewSections = React.useMemo(() => {
163
- var _a, _b, _c, _d, _e;
183
+ var _a, _b, _c;
164
184
  const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === sdkApi.SdkViewType.Login);
165
185
  if ((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length) {
166
186
  return filterLoginViewSections(loginView === null || loginView === void 0 ? void 0 : loginView.sections);
167
187
  }
168
- if ((_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.emailOnly) {
169
- return getEmailViewSectionDefinition();
188
+ let viewOrder = authorizationViewDisplayOrder;
189
+ if (isEmailOnly) {
190
+ viewOrder = ['email'];
170
191
  }
171
- return buildLoginSections();
192
+ return buildLoginSections(viewOrder);
172
193
  }, [
173
- projectSettings,
174
- getEmailViewSectionDefinition,
175
- filterLoginViewSections,
194
+ (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.views,
195
+ authorizationViewDisplayOrder,
196
+ isEmailOnly,
176
197
  buildLoginSections,
198
+ filterLoginViewSections,
177
199
  ]);
178
200
  return {
179
201
  isWalletOnly,
@@ -1,6 +1,6 @@
1
1
  import { useMemo, useCallback } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { SdkViewType, SdkViewSectionType } from '@dynamic-labs/sdk-api';
3
+ import { SdkViewSectionType, SdkViewType } from '@dynamic-labs/sdk-api';
4
4
  import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
5
5
  import { useSocialRedirectContext } from '../../context/SocialRedirectContext/SocialRedirectContext.js';
6
6
  import '../../shared/logger.js';
@@ -16,14 +16,19 @@ import '@dynamic-labs/utils';
16
16
  import '../../shared/consts/index.js';
17
17
  import '@dynamic-labs/multi-wallet';
18
18
  import { isEmailProviderEnabled } from '../../utils/functions/isEmailProviderEnabled/isEmailProviderEnabled.js';
19
- import { getEnabledProviders } from '../../utils/functions/getEnabledProviders/index.js';
20
19
 
21
20
  /* eslint-disable multiline-comment-style */
22
21
  const NUMBER_OF_WALLETS = 3;
23
22
  const useLoginView = () => {
24
- var _a, _b, _c, _d;
23
+ var _a, _b, _c, _d, _e, _f;
25
24
  const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, walletsFilter, } = useInternalDynamicContext();
25
+ const { t } = useTranslation();
26
26
  const { enabledSocialProviders } = useSocialRedirectContext();
27
+ const hasSocialProvidersEnabled = Boolean(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length);
28
+ const hasEmailProviderEnabled = ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _a === void 0 ? void 0 : _a.length) &&
29
+ isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
30
+ // is email only is set in the project settings when the "Email (Web2) only" is toggled on in the dashboard
31
+ const isEmailOnly = (_c = (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _b === void 0 ? void 0 : _b.modal) === null || _c === void 0 ? void 0 : _c.emailOnly;
27
32
  /** Takes from wallets only those that can be selected in the wallet list by the user.
28
33
  * Should filter out embedded wallets
29
34
  * WHY: when we decide whether to show wallets or not, we need to know how many wallets
@@ -31,61 +36,91 @@ const useLoginView = () => {
31
36
  * wallets and then display an empty wallet list (since turnkey doesn't render)
32
37
  */
33
38
  const selectableWallets = (walletsFilter ? walletsFilter(wallets) : wallets).filter(({ key }) => key !== 'turnkey');
34
- const { t } = useTranslation();
35
- const hasEnabledProviders = Boolean(getEnabledProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers).length);
39
+ const separator = useMemo(() => ({
40
+ label: t('dyn_login.separators.default'),
41
+ type: SdkViewSectionType.Separator,
42
+ }), [t]);
36
43
  const isWalletOnly = useMemo(() => {
37
- var _a, _b, _c, _d;
44
+ var _a, _b, _c;
38
45
  if (!projectSettings) {
39
46
  return false;
40
47
  }
41
- // toolkit functionality overrides whatever is defined
42
- if (!loginWithEmail) {
48
+ // if both loginWithEmail AND hasSocialProvidersEnabled are false, it's wallet only
49
+ if (!loginWithEmail && !hasSocialProvidersEnabled) {
43
50
  return true;
44
51
  }
45
52
  const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === SdkViewType.Login);
46
- // backwards compatibility for those that didn't set up login view sessions
53
+ // backwards compatibility for those that didn't set up login view sections
47
54
  if (!((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length)) {
48
- return (!((_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) === null || _d === void 0 ? void 0 : _d.length) ||
49
- !isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers));
55
+ return !hasEmailProviderEnabled && !hasSocialProvidersEnabled;
50
56
  }
51
57
  return (loginView.sections.length === 1 && loginView.sections[0].type === 'wallet');
52
- }, [projectSettings, loginWithEmail]);
58
+ }, [
59
+ projectSettings,
60
+ loginWithEmail,
61
+ hasSocialProvidersEnabled,
62
+ hasEmailProviderEnabled,
63
+ enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length,
64
+ ]);
53
65
  /**
54
- * build email and social view sections from project settings design.modal props - backwards compatibility
66
+ * build email from project settings design.modal props
55
67
  * @returns SdkViewSection[]
56
68
  */
57
69
  const getEmailViewSectionDefinition = useCallback(() => {
58
- var _a, _b;
59
- const loginViewSections = [
70
+ if (!hasEmailProviderEnabled)
71
+ return [];
72
+ return [
60
73
  {
61
74
  type: SdkViewSectionType.Email,
62
75
  },
63
76
  ];
64
- if (enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length) {
65
- const socialSection = {
77
+ }, [hasEmailProviderEnabled]);
78
+ /**
79
+ * build social from project settings design.modal props
80
+ * @returns SdkViewSection[]
81
+ */
82
+ const getSocialViewSectionDefinition = useCallback(() => {
83
+ if (!(enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length))
84
+ return [];
85
+ return [
86
+ {
66
87
  numOfItemsToDisplay: 5,
67
88
  type: SdkViewSectionType.Social,
68
- };
69
- loginViewSections.push(socialSection);
70
- if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.splitEmailAndSocial) {
71
- loginViewSections.splice(1, 0, {
72
- label: t('dyn_login.separators.default'),
73
- type: SdkViewSectionType.Separator,
74
- });
75
- // eslint-disable-next-line prefer-destructuring
76
- socialSection.defaultItem = enabledSocialProviders[0];
77
- }
78
- }
79
- if ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.socialAboveEmail) {
80
- loginViewSections.reverse();
81
- }
82
- return loginViewSections;
89
+ },
90
+ ];
91
+ }, [enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length]);
92
+ const getWalletViewSectionDefinition = useCallback(() => {
93
+ var _a, _b;
94
+ if (!(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length))
95
+ return [];
96
+ const numOfItemsToDisplay = ((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _a === void 0 ? void 0 : _a.modal) === null || _b === void 0 ? void 0 : _b.showWalletsButton)
97
+ ? 0
98
+ : NUMBER_OF_WALLETS;
99
+ return [
100
+ {
101
+ numOfItemsToDisplay,
102
+ type: SdkViewSectionType.Wallet,
103
+ },
104
+ ];
83
105
  }, [
84
- enabledSocialProviders,
85
- (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.socialAboveEmail,
86
- (_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.splitEmailAndSocial,
87
- t,
106
+ (_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.showWalletsButton,
107
+ selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
88
108
  ]);
109
+ const applyLoginModalSettings = useCallback((emailAndSocialSections) => {
110
+ if (emailAndSocialSections.length < 2) {
111
+ return emailAndSocialSections;
112
+ }
113
+ const { splitEmailAndSocial, socialAboveEmail } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) || {};
114
+ if (splitEmailAndSocial) {
115
+ emailAndSocialSections.splice(1, 0, separator);
116
+ // eslint-disable-next-line prefer-destructuring
117
+ emailAndSocialSections[2].defaultItem = enabledSocialProviders[0];
118
+ }
119
+ if (socialAboveEmail) {
120
+ emailAndSocialSections.reverse();
121
+ }
122
+ return emailAndSocialSections;
123
+ }, [enabledSocialProviders, projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal, separator]);
89
124
  // TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
90
125
  /**
91
126
  * remove wallet view section from projectSettings?.sdk?.views if no wallet defined
@@ -98,78 +133,65 @@ const useLoginView = () => {
98
133
  }
99
134
  return sections.filter((section) => section.type !== 'wallet');
100
135
  }, [selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length]);
101
- const addSeparator = useCallback((index) => {
102
- // if not the first index, no separator is needed
103
- // if the first index but does not have wallets or providers,
104
- // it'll show only one view section - no separator is needed
105
- if (index !== 0 || !(selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) || !hasEnabledProviders) {
106
- return [];
107
- }
108
- return [
109
- {
110
- label: t('dyn_login.separators.default'),
111
- type: SdkViewSectionType.Separator,
112
- },
113
- ];
114
- }, [hasEnabledProviders, selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length, t]);
115
136
  /**
116
137
  * build login view sections array from project settings design.modal props - backwards compatibility
117
138
  * @returns SdkViewSection[]
118
139
  */
119
- const buildLoginSections = useCallback(() => {
120
- let loginViewSections = [];
121
- authorizationViewDisplayOrder === null || authorizationViewDisplayOrder === void 0 ? void 0 : authorizationViewDisplayOrder.forEach((loginItem, index) => {
122
- var _a, _b;
123
- if (loginItem === 'email' &&
124
- (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers) &&
125
- isEmailProviderEnabled(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers)) {
126
- loginViewSections = loginViewSections.concat(getEmailViewSectionDefinition(),
127
- // add separator if wallets defined
128
- addSeparator(index));
140
+ const buildLoginSections = useCallback((buildOrder) => {
141
+ var _a;
142
+ const loginViewSections = [];
143
+ buildOrder === null || buildOrder === void 0 ? void 0 : buildOrder.forEach((loginItem) => {
144
+ // Add a separator if there are sections already
145
+ if (loginViewSections.length)
146
+ loginViewSections.push(separator);
147
+ if (loginItem === 'email') {
148
+ // In the past, the email and social sections were combined into one section,
149
+ // so we need to check for that case and add the social section if needed for backwards compatibility
150
+ // if email was just pushed to the loginViewSections array and social is not defined in the buildOrder,
151
+ // then we need to add social (if social is enabled)
152
+ const emailAndSocialSections = [
153
+ ...getEmailViewSectionDefinition(),
154
+ ...getSocialViewSectionDefinition(),
155
+ ];
156
+ loginViewSections.push(...applyLoginModalSettings(emailAndSocialSections));
129
157
  }
130
- if (loginItem === 'wallet' && (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length)) {
131
- // if showWalletsButton is true, it should show "Connec with Wallet" button
132
- const numOfItemsToDisplay = ((_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _a === void 0 ? void 0 : _a.modal) === null || _b === void 0 ? void 0 : _b.showWalletsButton)
133
- ? 0
134
- : NUMBER_OF_WALLETS;
135
- loginViewSections = loginViewSections.concat([
136
- {
137
- numOfItemsToDisplay,
138
- type: SdkViewSectionType.Wallet,
139
- },
140
- ],
141
- // add separator if email providers defined
142
- addSeparator(index));
158
+ if (loginItem === 'wallet') {
159
+ loginViewSections.push(...getWalletViewSectionDefinition());
143
160
  }
144
161
  });
162
+ // remove last separator
163
+ if (((_a = loginViewSections[loginViewSections.length - 1]) === null || _a === void 0 ? void 0 : _a.type) === 'separator') {
164
+ loginViewSections.pop();
165
+ }
145
166
  return loginViewSections;
146
167
  }, [
147
- addSeparator,
148
- authorizationViewDisplayOrder,
168
+ applyLoginModalSettings,
149
169
  getEmailViewSectionDefinition,
150
- (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _c === void 0 ? void 0 : _c.modal) === null || _d === void 0 ? void 0 : _d.showWalletsButton,
151
- projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers,
152
- selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
170
+ getSocialViewSectionDefinition,
171
+ getWalletViewSectionDefinition,
172
+ separator,
153
173
  ]);
154
174
  /**
155
175
  * returns the login view sections to be displayed in order from projectSettings?.sdk?.views
156
176
  * and has backwards compatibility with project settings design.modal props
157
177
  */
158
178
  const logingViewSections = useMemo(() => {
159
- var _a, _b, _c, _d, _e;
179
+ var _a, _b, _c;
160
180
  const loginView = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.views) === null || _b === void 0 ? void 0 : _b.find((view) => view.type === SdkViewType.Login);
161
181
  if ((_c = loginView === null || loginView === void 0 ? void 0 : loginView.sections) === null || _c === void 0 ? void 0 : _c.length) {
162
182
  return filterLoginViewSections(loginView === null || loginView === void 0 ? void 0 : loginView.sections);
163
183
  }
164
- if ((_e = (_d = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _d === void 0 ? void 0 : _d.modal) === null || _e === void 0 ? void 0 : _e.emailOnly) {
165
- return getEmailViewSectionDefinition();
184
+ let viewOrder = authorizationViewDisplayOrder;
185
+ if (isEmailOnly) {
186
+ viewOrder = ['email'];
166
187
  }
167
- return buildLoginSections();
188
+ return buildLoginSections(viewOrder);
168
189
  }, [
169
- projectSettings,
170
- getEmailViewSectionDefinition,
171
- filterLoginViewSections,
190
+ (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.views,
191
+ authorizationViewDisplayOrder,
192
+ isEmailOnly,
172
193
  buildLoginSections,
194
+ filterLoginViewSections,
173
195
  ]);
174
196
  return {
175
197
  isWalletOnly,
@@ -68,7 +68,7 @@ var UserAddress = require('../../components/UserAddress/UserAddress.cjs');
68
68
  var SelectNetworkButton = require('../../components/SelectNetworkButton/SelectNetworkButton.cjs');
69
69
 
70
70
  const NetworkNotSupported = () => {
71
- const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, isFullyConnected, setShowAuthFlow, walletsToConnectByChain, } = useInternalDynamicContext.useInternalDynamicContext();
71
+ const { onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, isFullyConnected, setShowAuthFlow, walletsToConnectByChain, } = useInternalDynamicContext.useInternalDynamicContext();
72
72
  const { t } = reactI18next.useTranslation();
73
73
  // Refresh selectedWalletConnector network when primaryWallet or connectedWallets updates
74
74
  const { data: walletConnectorNetwork } = usePromise.usePromise(() => walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(), { deps: [primaryWallet, walletConnector, connectedWallets] });
@@ -108,10 +108,13 @@ const NetworkNotSupported = () => {
108
108
  }
109
109
  });
110
110
  const evmNetworks = walletConnector.evmNetworks || [];
111
- const _isSupportedNetwork = isSupportedNetwork.isSupportedNetwork({ network, walletConnector });
111
+ const _isSupportedNetwork = isSupportedNetwork.isSupportedNetwork({
112
+ network: walletConnectorNetwork,
113
+ walletConnector,
114
+ });
112
115
  return (jsxRuntime.jsxs("div", { className: 'network-not-supported', "data-testid": 'network-not-supported', children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'network-not-supported__main-img', src: onboardingImageUrl, alt: 'onboarding' })), !_isSupportedNetwork && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { variant: 'info', withIcon: false, className: 'network-not-supported__error--not-supported', children: t('dyn_network_not_supported.warning_message') })), jsxRuntime.jsxs("div", { className: classNames.classNames('network-not-supported__content-container', {
113
116
  'network-not-supported__content-container--error': !_isSupportedNetwork,
114
- }), children: [jsxRuntime.jsx("div", { className: 'network-not-supported__img-container', children: jsxRuntime.jsx(walletBook.WalletIcon, { style: { height: 64, width: 64 }, walletKey: walletConnector.key }) }), jsxRuntime.jsx(UserAddress.UserAddress, { walletConnector: walletConnector }), jsxRuntime.jsx("div", { className: 'network-not-supported__network-container', children: evmNetworks.length > 1 && (jsxRuntime.jsx(NetworkPicker.NetworkPicker, { evmNetworks: evmNetworks, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker' })) }), jsxRuntime.jsx("div", { className: 'network-not-supported__welcome-container', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', children: t('dyn_network_not_supported.subtitle') }) }), evmNetworks.length === 1 && (jsxRuntime.jsx(SelectNetworkButton.SelectNetworkButton, { onClick: onSelectNetworkButtonClick, networkId: evmNetworks[0].networkId, networkName: evmNetworks[0].vanityName || evmNetworks[0].name, networkIconUrl: evmNetworks[0].iconUrls[0] }))] })] }));
117
+ }), children: [jsxRuntime.jsx("div", { className: 'network-not-supported__img-container', children: jsxRuntime.jsx(walletBook.WalletIcon, { style: { height: 64, width: 64 }, walletKey: walletConnector.key }) }), jsxRuntime.jsx(UserAddress.UserAddress, { walletConnector: walletConnector }), jsxRuntime.jsx("div", { className: 'network-not-supported__network-container', children: evmNetworks.length > 1 && (jsxRuntime.jsx(NetworkPicker.NetworkPicker, { evmNetworks: evmNetworks, currentNetwork: walletConnectorNetwork, connector: walletConnector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, showNetworkName: true, buttonClassName: 'network-not-supported__network-picker-button', mainClassName: 'network-not-supported__network-picker' })) }), jsxRuntime.jsx("div", { className: 'network-not-supported__welcome-container', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', children: t('dyn_network_not_supported.subtitle') }) }), evmNetworks.length === 1 && (jsxRuntime.jsx(SelectNetworkButton.SelectNetworkButton, { onClick: onSelectNetworkButtonClick, networkId: evmNetworks[0].networkId, networkName: evmNetworks[0].vanityName || evmNetworks[0].name, networkIconUrl: evmNetworks[0].iconUrls[0] }))] })] }));
115
118
  };
116
119
 
117
120
  exports.NetworkNotSupported = NetworkNotSupported;