@dynamic-labs/sdk-react-core 2.1.2-alpha.1 → 2.1.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 (82) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +13 -13
  5. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +1 -1
  6. package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +1 -1
  7. package/src/lib/components/PhoneNumberField/PhoneNumberField.cjs +3 -0
  8. package/src/lib/components/PhoneNumberField/PhoneNumberField.js +3 -0
  9. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.cjs +10 -19
  10. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.d.ts +3 -2
  11. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.js +12 -21
  12. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/index.d.ts +1 -0
  13. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.cjs +57 -0
  14. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.d.ts +8 -0
  15. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.js +53 -0
  16. package/src/lib/components/SignMessagePreview/SignMessagePreview.cjs +13 -5
  17. package/src/lib/components/SignMessagePreview/SignMessagePreview.js +13 -5
  18. package/src/lib/components/SignMessagePreview/SignMessagePreview.types.d.ts +3 -0
  19. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/containsSpecialCharacters.cjs +12 -0
  20. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/containsSpecialCharacters.d.ts +1 -0
  21. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/containsSpecialCharacters.js +8 -0
  22. package/src/lib/components/SignMessagePreview/utils/containsSpecialCharacters/index.d.ts +1 -0
  23. package/src/lib/components/SignMessagePreview/utils/index.d.ts +1 -0
  24. package/src/lib/components/SignMessagePreview/utils/isRawMessage/index.d.ts +1 -0
  25. package/src/lib/components/SignMessagePreview/utils/isRawMessage/isRawMessage.cjs +13 -0
  26. package/src/lib/components/SignMessagePreview/utils/isRawMessage/isRawMessage.d.ts +2 -0
  27. package/src/lib/components/SignMessagePreview/utils/isRawMessage/isRawMessage.js +9 -0
  28. package/src/lib/context/DynamicContext/DynamicContext.cjs +6 -4
  29. package/src/lib/context/DynamicContext/DynamicContext.d.ts +5 -0
  30. package/src/lib/context/DynamicContext/DynamicContext.js +6 -4
  31. package/src/lib/context/DynamicContext/types/index.d.ts +2 -0
  32. package/src/lib/shared/types/wallets.d.ts +1 -0
  33. package/src/lib/styles/index.shadow.cjs +1 -1
  34. package/src/lib/styles/index.shadow.js +1 -1
  35. package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.cjs +1 -0
  36. package/src/lib/utils/functions/createOwnerWallet/createOwnerWallet.js +1 -0
  37. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +0 -1
  38. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +0 -1
  39. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.cjs +24 -0
  40. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.d.ts +6 -0
  41. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/applyMultiWalletFilters.js +20 -0
  42. package/src/lib/utils/functions/walletListBuilder/utils/applyMultiWalletFilters/index.d.ts +1 -0
  43. package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.cjs +2 -2
  44. package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.d.ts +2 -2
  45. package/src/lib/utils/functions/walletListBuilder/utils/filterConnectedWallets/filterConnectedWallets.js +2 -2
  46. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/filterWalletConnectWallets.cjs +20 -0
  47. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/filterWalletConnectWallets.d.ts +9 -0
  48. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/filterWalletConnectWallets.js +16 -0
  49. package/src/lib/utils/functions/walletListBuilder/utils/filterWalletConnectWallets/index.d.ts +1 -0
  50. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/index.d.ts +1 -0
  51. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.cjs +30 -0
  52. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.d.ts +6 -0
  53. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.js +26 -0
  54. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +6 -5
  55. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +2 -2
  56. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +6 -5
  57. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +1 -0
  58. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -0
  59. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -0
  60. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -0
  61. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +7 -3
  62. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +7 -3
  63. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +5 -1
  64. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +5 -1
  65. package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.cjs +14 -8
  66. package/src/lib/utils/hooks/useNetworkNotSupported/useNetworkNotSupported.js +14 -8
  67. package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.cjs +1 -1
  68. package/src/lib/utils/hooks/useSwitchWallet/useSwitchWallet.js +1 -1
  69. package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +2 -0
  70. package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +2 -0
  71. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.cjs +4 -1
  72. package/src/lib/utils/hooks/useWalletConnectors/utils/findWallet/findWallet.js +4 -1
  73. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +1 -1
  74. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +1 -1
  75. package/src/lib/views/EmailVerification/EmailVerification.cjs +35 -42
  76. package/src/lib/views/EmailVerification/EmailVerification.js +35 -42
  77. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +4 -3
  78. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +4 -3
  79. package/src/lib/views/WalletList/WalletList.cjs +4 -3
  80. package/src/lib/views/WalletList/WalletList.js +4 -3
  81. package/src/lib/widgets/DynamicMultiWalletPromptsWidget/DynamicMultiWalletPromptsWidget.cjs +9 -2
  82. package/src/lib/widgets/DynamicMultiWalletPromptsWidget/DynamicMultiWalletPromptsWidget.js +9 -2
@@ -1,4 +1,5 @@
1
1
  import { FC, ReactNode } from 'react';
2
+ import { CountryIso2 } from 'react-international-phone';
2
3
  import { LogLevel } from '@dynamic-labs/logger';
3
4
  import { type CoinbaseWalletPreference, type SocialProviderFilter } from '@dynamic-labs/types';
4
5
  import { DeepLinkVariant, WalletConnectorExtension, WalletConnectorsMethod } from '@dynamic-labs/wallet-connector-core';
@@ -23,6 +24,7 @@ export interface DynamicContextProps {
23
24
  coinbaseWalletPreference?: CoinbaseWalletPreference;
24
25
  cssOverrides?: string | JSX.Element;
25
26
  customPrivacyPolicy?: ReactNode;
27
+ defaultPhoneInputIso2?: CountryIso2;
26
28
  customTermsOfServices?: ReactNode;
27
29
  debugError?: boolean;
28
30
  /**
@@ -50,6 +52,9 @@ export interface DynamicContextProps {
50
52
  flowNetwork?: 'testnet' | 'mainnet';
51
53
  handlers?: DynamicHandlers;
52
54
  headless?: boolean;
55
+ /**
56
+ * @deprecated Set this property in the dashboard instead
57
+ */
53
58
  hideEmbeddedWalletTransactionUIs?: boolean;
54
59
  initialAuthenticationMode?: AuthModeType;
55
60
  localStorageSuffix?: string;
@@ -132,8 +132,8 @@ const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = '2762a57b-faa4-41ce-9f16-abff9300e2c9
132
132
  const DynamicContext = createContext(undefined);
133
133
  /** The context provider itself we only use internally */
134
134
  const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) => {
135
- var _a, _b, _c, _d, _e, _f;
136
- const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, headless = false, } = settings;
135
+ var _a, _b, _c, _d, _e, _f, _g, _h;
136
+ const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, flowNetwork, initialAuthenticationMode = 'connect-and-sign', debugError = false, displaySiweStatement = true, newToWeb3WalletChainMap, enableVisitTrackingOnConnectOnly = true, environmentId, walletsFilter, logLevel = 'WARN', mobileExperience = 'in-app-browser', notInTheListImageUrl, onboardingImageUrl, policiesConsentInnerComponent, customPrivacyPolicy, privacyPolicyUrl, signWithEmailWalletName, socialMediaLinkText, socialMediaIconUrl, socialMediaUrl, customTermsOfServices, termsOfServiceUrl, toolkitEnabled, siweStatement, shadowDOMEnabled = true, walletConnectors: walletConnectorsProp, socialProvidersFilter, showLockedWalletView = false, walletConnectPreferredChains, walletConnectorExtensions, recommendedWallets, hideEmbeddedWalletTransactionUIs, handlers, headless = false, } = settings;
137
137
  LocalStorage.setSuffix(settings.localStorageSuffix);
138
138
  /**
139
139
  * initialize global store
@@ -215,7 +215,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
215
215
  appLogoUrl,
216
216
  appName,
217
217
  getAppOrigin: () => window.location.origin,
218
- hideEmbeddedWalletTransactionUIs,
218
+ hideEmbeddedWalletTransactionUIs: hideEmbeddedWalletTransactionUIs !== null && hideEmbeddedWalletTransactionUIs !== void 0 ? hideEmbeddedWalletTransactionUIs : !((_g = (_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _f === void 0 ? void 0 : _f.embeddedWallets) === null || _g === void 0 ? void 0 : _g.showEmbeddedWalletActionsUI),
219
219
  });
220
220
  const { walletConnectorOptions } = useWalletConnectorOptions({
221
221
  appLogoUrl,
@@ -437,6 +437,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
437
437
  customTermsOfServices,
438
438
  debugError,
439
439
  defaultNumberOfWalletsToShow,
440
+ defaultPhoneInputIso2,
440
441
  defaultTabIndex,
441
442
  desktopUri,
442
443
  disconnectWallet,
@@ -541,6 +542,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
541
542
  accessDeniedMessageSecondary,
542
543
  accountSwitchState,
543
544
  handlers,
545
+ defaultPhoneInputIso2,
544
546
  appLogoUrl,
545
547
  appName,
546
548
  defaultTabIndex,
@@ -679,7 +681,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
679
681
  }
680
682
  // eslint-disable-next-line react-hooks/exhaustive-deps
681
683
  }, [multiWallet, multiWalletWidgetState, showDynamicUserProfile]);
682
- return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((_f = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _f === void 0 ? void 0 : _f.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialView: getInitialView({
684
+ return (jsx(I18nextProvider, { i18n: i18nSDKInstance, children: jsx(DynamicContext.Provider, { value: value, children: jsx(WalletBookContextProvider, { walletBook: walletBook, children: jsx(ThemeContextProvider, { customerTheme: parseTheme(theme, ((_h = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _h === void 0 ? void 0 : _h.modal) || undefined), designSettings: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design, children: jsx(LoadingContextProvider, { children: jsxs(ViewContextProvider, { initialView: getInitialView({
683
685
  bridgeOnboardingCompleted,
684
686
  connectedWallets,
685
687
  isAuthenticated: isAuthenticated || Boolean(primaryWallet),
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, MutableRefObject, ReactElement, ReactNode, SetStateAction } from 'react';
2
2
  import { changeLanguage } from 'i18next';
3
+ import { CountryIso2 } from 'react-international-phone';
3
4
  import { NameServiceData, ProjectSettings, SdkView } from '@dynamic-labs/sdk-api-core';
4
5
  import { GenericNetwork, NetworkConfigurationMap, SocialProviderFilter, UserProfile, WalletUiUtils } from '@dynamic-labs/types';
5
6
  import { Chain, GetAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
@@ -64,6 +65,7 @@ export interface IDynamicContext {
64
65
  accountSwitchState: AccountSwitchState;
65
66
  appLogoUrl?: string;
66
67
  appName?: string;
68
+ defaultPhoneInputIso2?: CountryIso2;
67
69
  authMode: AuthModeType;
68
70
  authToken: string | undefined;
69
71
  authorizationViewDisplayOrder: DisplayOrder;
@@ -10,6 +10,7 @@ export type Wallet = BaseWallet & {
10
10
  * like ordinals and payment addresses for bitcoin wallets
11
11
  */
12
12
  additionalAddresses?: WalletAdditionalAddress[];
13
+ key: string;
13
14
  };
14
15
  export type WalletAction = 'select' | 'unlink';
15
16
  export type WalletWithAction = {