@dynamic-labs/sdk-react-core 2.2.0-alpha.5 → 3.0.0-alpha.1

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 (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +14 -14
  5. package/src/lib/components/PhoneNumberField/PhoneNumberField.cjs +3 -0
  6. package/src/lib/components/PhoneNumberField/PhoneNumberField.js +3 -0
  7. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.cjs +10 -19
  8. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.d.ts +3 -2
  9. package/src/lib/components/PhoneNumberField/usePhoneInputLogic/usePhoneInputLogic.js +12 -21
  10. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/index.d.ts +1 -0
  11. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.cjs +57 -0
  12. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.d.ts +8 -0
  13. package/src/lib/components/PhoneNumberField/utils/parseDefaultCountry/parseDefaultCountry.js +53 -0
  14. package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -1
  15. package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -0
  16. package/src/lib/context/DynamicContext/DynamicContext.js +3 -1
  17. package/src/lib/context/DynamicContext/types/index.d.ts +2 -0
  18. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/index.d.ts +1 -0
  19. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.cjs +30 -0
  20. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.d.ts +6 -0
  21. package/src/lib/utils/functions/walletListBuilder/utils/staticLinkedWalletFilter/staticLinkedWalletFilter.js +26 -0
  22. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +5 -1
  23. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.d.ts +2 -1
  24. package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +5 -1
  25. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
  26. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
  27. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.cjs +2 -1
  28. package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSimpleSignIn/WalletSimpleSignIn.js +2 -1
  29. package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +14 -4
  30. package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +14 -4
  31. package/src/lib/views/WalletList/WalletList.cjs +2 -1
  32. package/src/lib/views/WalletList/WalletList.js +2 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## [3.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.0...v3.0.0-alpha.1) (2024-06-10)
3
+
4
+
5
+ ### Features
6
+
7
+ * hide wallets from wallet list that can't have multiple accounts linked ([#5892](https://github.com/dynamic-labs/DynamicAuth/issues/5892)) ([41f0114](https://github.com/dynamic-labs/DynamicAuth/commit/41f0114633dfdc3f0c27e1859da122e5c96e297d))
8
+ * update mfa backup code acknowledgement ([#5874](https://github.com/dynamic-labs/DynamicAuth/issues/5874)) ([4dea5e4](https://github.com/dynamic-labs/DynamicAuth/commit/4dea5e401c468d830f881bf5268055160a9cfa83))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * init coinbase provider adhoc ([#5907](https://github.com/dynamic-labs/DynamicAuth/issues/5907)) ([f778d97](https://github.com/dynamic-labs/DynamicAuth/commit/f778d974d5e70ac72abe70030cad2b76583e1581))
14
+ * versioned tx needs address lookup table ([#5909](https://github.com/dynamic-labs/DynamicAuth/issues/5909)) ([3daf0bc](https://github.com/dynamic-labs/DynamicAuth/commit/3daf0bc45c19c532a519031a813942df0e929107))
15
+
16
+ ## [3.0.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.5...v3.0.0-alpha.0) (2024-06-10)
17
+
2
18
  ## [2.2.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.4...v2.2.0-alpha.5) (2024-06-08)
3
19
 
4
20
 
package/package.cjs CHANGED
@@ -3,9 +3,9 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "2.2.0-alpha.5";
6
+ var version = "3.0.0-alpha.1";
7
7
  var dependencies = {
8
- "@dynamic-labs/sdk-api-core": "0.0.460",
8
+ "@dynamic-labs/sdk-api-core": "0.0.461",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
10
10
  "country-list": "2.3.0",
11
11
  formik: "2.2.9",
package/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client'
2
- var version = "2.2.0-alpha.5";
2
+ var version = "3.0.0-alpha.1";
3
3
  var dependencies = {
4
- "@dynamic-labs/sdk-api-core": "0.0.460",
4
+ "@dynamic-labs/sdk-api-core": "0.0.461",
5
5
  "@hcaptcha/react-hcaptcha": "1.4.4",
6
6
  "country-list": "2.3.0",
7
7
  formik: "2.2.9",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "2.2.0-alpha.5",
3
+ "version": "3.0.0-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
7
7
  "directory": "packages/sdk-react-core"
8
8
  },
9
9
  "dependencies": {
10
- "@dynamic-labs/sdk-api-core": "0.0.460",
10
+ "@dynamic-labs/sdk-api-core": "0.0.461",
11
11
  "@hcaptcha/react-hcaptcha": "1.4.4",
12
12
  "country-list": "2.3.0",
13
13
  "formik": "2.2.9",
@@ -17,18 +17,18 @@
17
17
  "react-i18next": "13.5.0",
18
18
  "yup": "0.32.11",
19
19
  "react-international-phone": "4.2.5",
20
- "@dynamic-labs/iconic": "2.2.0-alpha.5",
21
- "@dynamic-labs/logger": "2.2.0-alpha.5",
22
- "@dynamic-labs/multi-wallet": "2.2.0-alpha.5",
23
- "@dynamic-labs/rpc-provider-ethereum": "2.2.0-alpha.5",
24
- "@dynamic-labs/rpc-provider-solana": "2.2.0-alpha.5",
25
- "@dynamic-labs/rpc-providers": "2.2.0-alpha.5",
26
- "@dynamic-labs/store": "2.2.0-alpha.5",
27
- "@dynamic-labs/types": "2.2.0-alpha.5",
28
- "@dynamic-labs/utils": "2.2.0-alpha.5",
29
- "@dynamic-labs/viem-utils": "2.2.0-alpha.5",
30
- "@dynamic-labs/wallet-book": "2.2.0-alpha.5",
31
- "@dynamic-labs/wallet-connector-core": "2.2.0-alpha.5",
20
+ "@dynamic-labs/iconic": "3.0.0-alpha.1",
21
+ "@dynamic-labs/logger": "3.0.0-alpha.1",
22
+ "@dynamic-labs/multi-wallet": "3.0.0-alpha.1",
23
+ "@dynamic-labs/rpc-provider-ethereum": "3.0.0-alpha.1",
24
+ "@dynamic-labs/rpc-provider-solana": "3.0.0-alpha.1",
25
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.1",
26
+ "@dynamic-labs/store": "3.0.0-alpha.1",
27
+ "@dynamic-labs/types": "3.0.0-alpha.1",
28
+ "@dynamic-labs/utils": "3.0.0-alpha.1",
29
+ "@dynamic-labs/viem-utils": "3.0.0-alpha.1",
30
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.1",
31
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.1",
32
32
  "eventemitter3": "5.0.1"
33
33
  },
34
34
  "devDependencies": {
@@ -25,6 +25,7 @@ require('../../utils/constants/colors.cjs');
25
25
  require('../../utils/constants/values.cjs');
26
26
  require('../../shared/utils/classes/storage/localStorage.cjs');
27
27
  require('../../shared/consts/index.cjs');
28
+ var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
28
29
  require('../../context/CaptchaContext/CaptchaContext.cjs');
29
30
  require('../../context/ErrorContext/ErrorContext.cjs');
30
31
  require('@dynamic-labs/multi-wallet');
@@ -88,10 +89,12 @@ const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendR
88
89
  const countryInputRef = React.useRef(null);
89
90
  const [countryDropdownOpen, setCountryDropdownOpen] = React.useState(false);
90
91
  const anchorRef = React.useRef(null);
92
+ const { defaultPhoneInputIso2 } = useInternalDynamicContext.useInternalDynamicContext();
91
93
  const [invalidNumberMessage, setInvalidNumberMessage] = React.useState(undefined);
92
94
  const { formattedPhone, currentCountry, handleCountryInput, handlePhoneInput, hasInput, inputRef, countryInput, onBlurCountry, filteredCountries, openDropdown, handleCountryKeyDown, closeDropdown, setCountry, onMenuDisplayToggle, onFocusCountry, countryFontSize, } = usePhoneInputLogic.usePhoneInputLogic({
93
95
  countries,
94
96
  countryInputRef,
97
+ defaultIso2: defaultPhoneInputIso2,
95
98
  initialPhone,
96
99
  onUpdate,
97
100
  setCountryDropdownOpen,
@@ -21,6 +21,7 @@ import '../../utils/constants/colors.js';
21
21
  import '../../utils/constants/values.js';
22
22
  import '../../shared/utils/classes/storage/localStorage.js';
23
23
  import '../../shared/consts/index.js';
24
+ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
24
25
  import '../../context/CaptchaContext/CaptchaContext.js';
25
26
  import '../../context/ErrorContext/ErrorContext.js';
26
27
  import '@dynamic-labs/multi-wallet';
@@ -84,10 +85,12 @@ const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendR
84
85
  const countryInputRef = useRef(null);
85
86
  const [countryDropdownOpen, setCountryDropdownOpen] = useState(false);
86
87
  const anchorRef = useRef(null);
88
+ const { defaultPhoneInputIso2 } = useInternalDynamicContext();
87
89
  const [invalidNumberMessage, setInvalidNumberMessage] = useState(undefined);
88
90
  const { formattedPhone, currentCountry, handleCountryInput, handlePhoneInput, hasInput, inputRef, countryInput, onBlurCountry, filteredCountries, openDropdown, handleCountryKeyDown, closeDropdown, setCountry, onMenuDisplayToggle, onFocusCountry, countryFontSize, } = usePhoneInputLogic({
89
91
  countries,
90
92
  countryInputRef,
93
+ defaultIso2: defaultPhoneInputIso2,
91
94
  initialPhone,
92
95
  onUpdate,
93
96
  setCountryDropdownOpen,
@@ -9,33 +9,24 @@ var localStorage = require('../../../shared/utils/classes/storage/localStorage.c
9
9
  var useThrottle = require('../../../shared/utils/hooks/useThrottle/useThrottle.cjs');
10
10
  var localStorage$1 = require('../../../utils/constants/localStorage.cjs');
11
11
  var modulo = require('../../../utils/functions/modulo/modulo.cjs');
12
+ var parseDefaultCountry = require('../utils/parseDefaultCountry/parseDefaultCountry.cjs');
12
13
 
13
14
  const MENU_DISPLAY_THROTTLE = 50;
14
15
  const COUNTRY_INPUT_SCROLL_DELAY = 20;
15
- const usePhoneInputLogic = ({ countryInputRef, setCountryDropdownOpen, setInvalidNumberMessage, onUpdate, initialPhone, countries, }) => {
16
- var _a, _b, _c, _d, _e, _f;
17
- /** The default country we want to use */
18
- const getDefaultCountry = () => {
19
- var _a;
20
- const defaultCountryIso2 = (_a = localStorage.LocalStorage.getFromLS(localStorage$1.PHONE_INPUT_DEFAULT_COUNTRY)) !== null && _a !== void 0 ? _a : 'us';
21
- return countries
22
- .map(reactInternationalPhone.parseCountry)
23
- .find(({ iso2 }) => iso2 === defaultCountryIso2);
24
- };
25
- const { country: initialCountry } = initialPhone
26
- ? reactInternationalPhone.guessCountryByPartialPhoneNumber({
27
- countries,
28
- phone: initialPhone,
29
- })
30
- : { country: undefined };
16
+ const usePhoneInputLogic = ({ countryInputRef, setCountryDropdownOpen, setInvalidNumberMessage, onUpdate, initialPhone, countries, defaultIso2, }) => {
17
+ const defaultCountry = React.useMemo(() => parseDefaultCountry.parseDefaultCountry({
18
+ countries,
19
+ defaultIso2,
20
+ initialPhone,
21
+ }), [countries, defaultIso2, initialPhone]);
31
22
  const { inputValue: formattedPhone, phone, country: currentCountry, setCountry: setSelectedCountry, handlePhoneValueChange: handlePhoneInput, inputRef, } = reactInternationalPhone.usePhoneInput({
32
23
  countries,
33
- defaultCountry: (_c = (_a = initialCountry === null || initialCountry === void 0 ? void 0 : initialCountry.iso2) !== null && _a !== void 0 ? _a : (_b = getDefaultCountry()) === null || _b === void 0 ? void 0 : _b.iso2) !== null && _c !== void 0 ? _c : 'us',
24
+ defaultCountry: defaultCountry.iso2,
34
25
  disableDialCodeAndPrefix: true,
35
26
  value: initialPhone,
36
27
  });
37
28
  /** What is currently displayed on the country input */
38
- const [countryInput, setCountryInput] = React.useState((_f = (_d = initialCountry === null || initialCountry === void 0 ? void 0 : initialCountry.dialCode) !== null && _d !== void 0 ? _d : (_e = getDefaultCountry()) === null || _e === void 0 ? void 0 : _e.dialCode) !== null && _f !== void 0 ? _f : '1');
29
+ const [countryInput, setCountryInput] = React.useState(defaultCountry.dialCode);
39
30
  /**
40
31
  * This is the same value as phone, except for the following scenario:
41
32
  * Since the phone number field hides the "+" char and the country code, when the field
@@ -93,7 +84,7 @@ const usePhoneInputLogic = ({ countryInputRef, setCountryDropdownOpen, setInvali
93
84
  // COUNTRY INPUT
94
85
  // =================================================================
95
86
  /** The last inputted value for country that was valid */
96
- const lastValidCountry = React.useRef(initialCountry !== null && initialCountry !== void 0 ? initialCountry : getDefaultCountry());
87
+ const lastValidCountry = React.useRef(defaultCountry);
97
88
  const handleCountryInput = ({ target, }) => {
98
89
  const value = target.value.slice(0, 4);
99
90
  setCountryInput(value);
@@ -1,5 +1,5 @@
1
1
  import { ChangeEventHandler, Dispatch, KeyboardEventHandler, RefObject, SetStateAction } from 'react';
2
- import { CountryData, ParsedCountry } from 'react-international-phone';
2
+ import { CountryData, CountryIso2, ParsedCountry } from 'react-international-phone';
3
3
  export type OnUpdatePhoneData = (values: {
4
4
  phone: string;
5
5
  formattedPhone: string;
@@ -12,8 +12,9 @@ type UsePhoneLogicProps = {
12
12
  countries: CountryData[];
13
13
  onUpdate?: OnUpdatePhoneData;
14
14
  initialPhone?: string;
15
+ defaultIso2?: CountryIso2;
15
16
  };
16
- export declare const usePhoneInputLogic: ({ countryInputRef, setCountryDropdownOpen, setInvalidNumberMessage, onUpdate, initialPhone, countries, }: UsePhoneLogicProps) => {
17
+ export declare const usePhoneInputLogic: ({ countryInputRef, setCountryDropdownOpen, setInvalidNumberMessage, onUpdate, initialPhone, countries, defaultIso2, }: UsePhoneLogicProps) => {
17
18
  closeDropdown: () => void;
18
19
  countryFontSize: string;
19
20
  countryInput: string;
@@ -1,37 +1,28 @@
1
1
  'use client'
2
- import { useState, useMemo, useEffect, useCallback, useRef } from 'react';
3
- import { guessCountryByPartialPhoneNumber, usePhoneInput, parseCountry, removeDialCode } from 'react-international-phone';
2
+ import { useMemo, useState, useEffect, useCallback, useRef } from 'react';
3
+ import { usePhoneInput, parseCountry, removeDialCode, guessCountryByPartialPhoneNumber } from 'react-international-phone';
4
4
  import { LocalStorage } from '../../../shared/utils/classes/storage/localStorage.js';
5
5
  import { useThrottle } from '../../../shared/utils/hooks/useThrottle/useThrottle.js';
6
6
  import { PHONE_INPUT_DEFAULT_COUNTRY } from '../../../utils/constants/localStorage.js';
7
7
  import { modulo } from '../../../utils/functions/modulo/modulo.js';
8
+ import { parseDefaultCountry } from '../utils/parseDefaultCountry/parseDefaultCountry.js';
8
9
 
9
10
  const MENU_DISPLAY_THROTTLE = 50;
10
11
  const COUNTRY_INPUT_SCROLL_DELAY = 20;
11
- const usePhoneInputLogic = ({ countryInputRef, setCountryDropdownOpen, setInvalidNumberMessage, onUpdate, initialPhone, countries, }) => {
12
- var _a, _b, _c, _d, _e, _f;
13
- /** The default country we want to use */
14
- const getDefaultCountry = () => {
15
- var _a;
16
- const defaultCountryIso2 = (_a = LocalStorage.getFromLS(PHONE_INPUT_DEFAULT_COUNTRY)) !== null && _a !== void 0 ? _a : 'us';
17
- return countries
18
- .map(parseCountry)
19
- .find(({ iso2 }) => iso2 === defaultCountryIso2);
20
- };
21
- const { country: initialCountry } = initialPhone
22
- ? guessCountryByPartialPhoneNumber({
23
- countries,
24
- phone: initialPhone,
25
- })
26
- : { country: undefined };
12
+ const usePhoneInputLogic = ({ countryInputRef, setCountryDropdownOpen, setInvalidNumberMessage, onUpdate, initialPhone, countries, defaultIso2, }) => {
13
+ const defaultCountry = useMemo(() => parseDefaultCountry({
14
+ countries,
15
+ defaultIso2,
16
+ initialPhone,
17
+ }), [countries, defaultIso2, initialPhone]);
27
18
  const { inputValue: formattedPhone, phone, country: currentCountry, setCountry: setSelectedCountry, handlePhoneValueChange: handlePhoneInput, inputRef, } = usePhoneInput({
28
19
  countries,
29
- defaultCountry: (_c = (_a = initialCountry === null || initialCountry === void 0 ? void 0 : initialCountry.iso2) !== null && _a !== void 0 ? _a : (_b = getDefaultCountry()) === null || _b === void 0 ? void 0 : _b.iso2) !== null && _c !== void 0 ? _c : 'us',
20
+ defaultCountry: defaultCountry.iso2,
30
21
  disableDialCodeAndPrefix: true,
31
22
  value: initialPhone,
32
23
  });
33
24
  /** What is currently displayed on the country input */
34
- const [countryInput, setCountryInput] = useState((_f = (_d = initialCountry === null || initialCountry === void 0 ? void 0 : initialCountry.dialCode) !== null && _d !== void 0 ? _d : (_e = getDefaultCountry()) === null || _e === void 0 ? void 0 : _e.dialCode) !== null && _f !== void 0 ? _f : '1');
25
+ const [countryInput, setCountryInput] = useState(defaultCountry.dialCode);
35
26
  /**
36
27
  * This is the same value as phone, except for the following scenario:
37
28
  * Since the phone number field hides the "+" char and the country code, when the field
@@ -89,7 +80,7 @@ const usePhoneInputLogic = ({ countryInputRef, setCountryDropdownOpen, setInvali
89
80
  // COUNTRY INPUT
90
81
  // =================================================================
91
82
  /** The last inputted value for country that was valid */
92
- const lastValidCountry = useRef(initialCountry !== null && initialCountry !== void 0 ? initialCountry : getDefaultCountry());
83
+ const lastValidCountry = useRef(defaultCountry);
93
84
  const handleCountryInput = ({ target, }) => {
94
85
  const value = target.value.slice(0, 4);
95
86
  setCountryInput(value);
@@ -0,0 +1 @@
1
+ export { parseDefaultCountry } from './parseDefaultCountry';
@@ -0,0 +1,57 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var reactInternationalPhone = require('react-international-phone');
7
+ require('@dynamic-labs/sdk-api-core');
8
+ require('../../../../shared/logger.cjs');
9
+ require('@dynamic-labs/iconic');
10
+ require('@dynamic-labs/wallet-connector-core');
11
+ require('react/jsx-runtime');
12
+ require('../../../../context/ViewContext/ViewContext.cjs');
13
+ require('react');
14
+ require('@dynamic-labs/wallet-book');
15
+ var localStorage$1 = require('../../../../utils/constants/localStorage.cjs');
16
+ require('../../../../utils/constants/colors.cjs');
17
+ require('../../../../utils/constants/values.cjs');
18
+ var localStorage = require('../../../../shared/utils/classes/storage/localStorage.cjs');
19
+ require('@dynamic-labs/utils');
20
+ require('../../../../shared/consts/index.cjs');
21
+
22
+ const parseDefaultCountry = ({ defaultIso2, countries, initialPhone, }) => {
23
+ // Return the country inferred from the phone number if possible
24
+ if (initialPhone) {
25
+ const { country } = reactInternationalPhone.guessCountryByPartialPhoneNumber({
26
+ countries,
27
+ phone: initialPhone,
28
+ });
29
+ if (country) {
30
+ return country;
31
+ }
32
+ }
33
+ const parsedCountries = countries.map(reactInternationalPhone.parseCountry);
34
+ // If the user has previously selected a country, use that as the default
35
+ const lastUsedCountryIso2 = localStorage.LocalStorage.getFromLS(localStorage$1.PHONE_INPUT_DEFAULT_COUNTRY);
36
+ const lastUsedCountry = parsedCountries.find(({ iso2 }) => iso2 === lastUsedCountryIso2);
37
+ if (lastUsedCountry) {
38
+ return lastUsedCountry;
39
+ }
40
+ // Use default country setting if found in enabled countries
41
+ const defaultCountry = parsedCountries.find(({ iso2 }) => iso2 === defaultIso2);
42
+ if (defaultCountry) {
43
+ return defaultCountry;
44
+ }
45
+ // Return US if it is enabled
46
+ const countryUS = parsedCountries.find(({ iso2 }) => iso2 === 'us');
47
+ if (countryUS) {
48
+ return countryUS;
49
+ }
50
+ // Return the first country in the list as a last resort
51
+ if (parsedCountries[0]) {
52
+ return parsedCountries[0];
53
+ }
54
+ throw new Error('No country list was provided');
55
+ };
56
+
57
+ exports.parseDefaultCountry = parseDefaultCountry;
@@ -0,0 +1,8 @@
1
+ import { CountryData, CountryIso2, ParsedCountry } from 'react-international-phone';
2
+ type ParseDefaultCountryProps = {
3
+ initialPhone: string | undefined;
4
+ defaultIso2: CountryIso2 | undefined;
5
+ countries: CountryData[];
6
+ };
7
+ export declare const parseDefaultCountry: ({ defaultIso2, countries, initialPhone, }: ParseDefaultCountryProps) => ParsedCountry;
8
+ export {};
@@ -0,0 +1,53 @@
1
+ 'use client'
2
+ import { guessCountryByPartialPhoneNumber, parseCountry } from 'react-international-phone';
3
+ import '@dynamic-labs/sdk-api-core';
4
+ import '../../../../shared/logger.js';
5
+ import '@dynamic-labs/iconic';
6
+ import '@dynamic-labs/wallet-connector-core';
7
+ import 'react/jsx-runtime';
8
+ import '../../../../context/ViewContext/ViewContext.js';
9
+ import 'react';
10
+ import '@dynamic-labs/wallet-book';
11
+ import { PHONE_INPUT_DEFAULT_COUNTRY } from '../../../../utils/constants/localStorage.js';
12
+ import '../../../../utils/constants/colors.js';
13
+ import '../../../../utils/constants/values.js';
14
+ import { LocalStorage } from '../../../../shared/utils/classes/storage/localStorage.js';
15
+ import '@dynamic-labs/utils';
16
+ import '../../../../shared/consts/index.js';
17
+
18
+ const parseDefaultCountry = ({ defaultIso2, countries, initialPhone, }) => {
19
+ // Return the country inferred from the phone number if possible
20
+ if (initialPhone) {
21
+ const { country } = guessCountryByPartialPhoneNumber({
22
+ countries,
23
+ phone: initialPhone,
24
+ });
25
+ if (country) {
26
+ return country;
27
+ }
28
+ }
29
+ const parsedCountries = countries.map(parseCountry);
30
+ // If the user has previously selected a country, use that as the default
31
+ const lastUsedCountryIso2 = LocalStorage.getFromLS(PHONE_INPUT_DEFAULT_COUNTRY);
32
+ const lastUsedCountry = parsedCountries.find(({ iso2 }) => iso2 === lastUsedCountryIso2);
33
+ if (lastUsedCountry) {
34
+ return lastUsedCountry;
35
+ }
36
+ // Use default country setting if found in enabled countries
37
+ const defaultCountry = parsedCountries.find(({ iso2 }) => iso2 === defaultIso2);
38
+ if (defaultCountry) {
39
+ return defaultCountry;
40
+ }
41
+ // Return US if it is enabled
42
+ const countryUS = parsedCountries.find(({ iso2 }) => iso2 === 'us');
43
+ if (countryUS) {
44
+ return countryUS;
45
+ }
46
+ // Return the first country in the list as a last resort
47
+ if (parsedCountries[0]) {
48
+ return parsedCountries[0];
49
+ }
50
+ throw new Error('No country list was provided');
51
+ };
52
+
53
+ export { parseDefaultCountry };
@@ -138,7 +138,7 @@ const DynamicContext = React.createContext(undefined);
138
138
  /** The context provider itself we only use internally */
139
139
  const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, locale: locale$1, }) => {
140
140
  var _a, _b, _c, _d, _e, _f;
141
- const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.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$1;
141
+ const { accessDeniedMessagePrimary, accessDeniedMessageSecondary, accessDeniedButton, defaultPhoneInputIso2, apiBaseUrl, coinbaseWalletPreference, enableConnectOnlyFallback = false, deepLinkPreference: deepLinkPreferenceProp = 'native', bridgeChains, cssOverrides, defaultNumberOfWalletsToShow = values.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$1;
142
142
  localStorage.LocalStorage.setSuffix(settings$1.localStorageSuffix);
143
143
  /**
144
144
  * initialize global store
@@ -442,6 +442,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
442
442
  customTermsOfServices,
443
443
  debugError,
444
444
  defaultNumberOfWalletsToShow,
445
+ defaultPhoneInputIso2,
445
446
  defaultTabIndex,
446
447
  desktopUri,
447
448
  disconnectWallet,
@@ -546,6 +547,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
546
547
  accessDeniedMessageSecondary,
547
548
  accountSwitchState,
548
549
  handlers,
550
+ defaultPhoneInputIso2,
549
551
  appLogoUrl,
550
552
  appName,
551
553
  defaultTabIndex,
@@ -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
  /**
@@ -134,7 +134,7 @@ const DynamicContext = createContext(undefined);
134
134
  /** The context provider itself we only use internally */
135
135
  const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) => {
136
136
  var _a, _b, _c, _d, _e, _f;
137
- 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;
137
+ 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;
138
138
  LocalStorage.setSuffix(settings.localStorageSuffix);
139
139
  /**
140
140
  * initialize global store
@@ -438,6 +438,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
438
438
  customTermsOfServices,
439
439
  debugError,
440
440
  defaultNumberOfWalletsToShow,
441
+ defaultPhoneInputIso2,
441
442
  defaultTabIndex,
442
443
  desktopUri,
443
444
  disconnectWallet,
@@ -542,6 +543,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
542
543
  accessDeniedMessageSecondary,
543
544
  accountSwitchState,
544
545
  handlers,
546
+ defaultPhoneInputIso2,
545
547
  appLogoUrl,
546
548
  appName,
547
549
  defaultTabIndex,
@@ -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;
@@ -0,0 +1 @@
1
+ export * from './staticLinkedWalletFilter';
@@ -0,0 +1,30 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * These wallets do not fire events when switching accounts, so we should filter
8
+ * them out of the wallet list if they are already linked to the user profile.
9
+ */
10
+ const staticListToFilter = [
11
+ 'xverse',
12
+ 'magiceden',
13
+ 'magicedenbtc',
14
+ 'magicedensol',
15
+ ];
16
+ /**
17
+ * This function is a helper to filter out wallets that should not appear in the wallet list
18
+ * if they are already linked to the user profile.
19
+ */
20
+ const staticWalletFilter = (linkedWallets, walletOptions) => walletOptions.filter((walletOption) => {
21
+ if (!staticListToFilter.includes(walletOption.key)) {
22
+ return true;
23
+ }
24
+ if (linkedWallets.some((wallet) => wallet.connector.key === walletOption.key)) {
25
+ return false;
26
+ }
27
+ return true;
28
+ });
29
+
30
+ exports.staticWalletFilter = staticWalletFilter;
@@ -0,0 +1,6 @@
1
+ import { Wallet, WalletOption } from '../../../../../shared';
2
+ /**
3
+ * This function is a helper to filter out wallets that should not appear in the wallet list
4
+ * if they are already linked to the user profile.
5
+ */
6
+ export declare const staticWalletFilter: (linkedWallets: Wallet[], walletOptions: WalletOption[]) => WalletOption[];
@@ -0,0 +1,26 @@
1
+ 'use client'
2
+ /**
3
+ * These wallets do not fire events when switching accounts, so we should filter
4
+ * them out of the wallet list if they are already linked to the user profile.
5
+ */
6
+ const staticListToFilter = [
7
+ 'xverse',
8
+ 'magiceden',
9
+ 'magicedenbtc',
10
+ 'magicedensol',
11
+ ];
12
+ /**
13
+ * This function is a helper to filter out wallets that should not appear in the wallet list
14
+ * if they are already linked to the user profile.
15
+ */
16
+ const staticWalletFilter = (linkedWallets, walletOptions) => walletOptions.filter((walletOption) => {
17
+ if (!staticListToFilter.includes(walletOption.key)) {
18
+ return true;
19
+ }
20
+ if (linkedWallets.some((wallet) => wallet.connector.key === walletOption.key)) {
21
+ return false;
22
+ }
23
+ return true;
24
+ });
25
+
26
+ export { staticWalletFilter };
@@ -7,6 +7,7 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
7
7
  var getCalculatedOffset = require('./utils/getCalculatedOffset/getCalculatedOffset.cjs');
8
8
  var groupWalletOptions = require('./utils/groupWalletOptions/groupWalletOptions.cjs');
9
9
  var filterConnectedWallets = require('./utils/filterConnectedWallets/filterConnectedWallets.cjs');
10
+ var staticLinkedWalletFilter = require('./utils/staticLinkedWalletFilter/staticLinkedWalletFilter.cjs');
10
11
 
11
12
  const PRIORITY_WALLET_LIST = [
12
13
  'metamask',
@@ -56,7 +57,7 @@ const sortedInputList = (inputList, recommendedWalletKeys) => {
56
57
  ...unsortedOtherWallets,
57
58
  ];
58
59
  };
59
- const walletListBuilder = ({ authMode, connectedWallets, multiWallet, numberOfWalletsToShow, inputList, isWalletConnectList, lastUsedWalletKey, signWithEmailWalletName, searchFilter, walletsFilter, loginWithEmail, groupWallets, walletBook, showMoreWalletsWithFilter, recommendedWallets, }) => {
60
+ const walletListBuilder = ({ authMode, connectedWallets, linkedWallets, multiWallet, numberOfWalletsToShow, inputList, isWalletConnectList, lastUsedWalletKey, signWithEmailWalletName, searchFilter, walletsFilter, loginWithEmail, groupWallets, walletBook, showMoreWalletsWithFilter, recommendedWallets, }) => {
60
61
  let walletList = inputList;
61
62
  if (isWalletConnectList) {
62
63
  walletList = inputList.filter((wallet) => wallet.walletConnector.isWalletConnect &&
@@ -68,6 +69,9 @@ const walletListBuilder = ({ authMode, connectedWallets, multiWallet, numberOfWa
68
69
  walletOptions: walletList,
69
70
  });
70
71
  }
72
+ if (authMode === 'connect-and-sign' && multiWallet) {
73
+ walletList = staticLinkedWalletFilter.staticWalletFilter(linkedWallets, walletList);
74
+ }
71
75
  let lastUsedWallet;
72
76
  const hasWalletFilter = Boolean(walletsFilter);
73
77
  const signWithEmailWallet = getSignWithEmailWallet(signWithEmailWalletName, walletList);
@@ -3,6 +3,7 @@ import { AuthModeType, RecommendedWallet, Wallet, WalletOption } from '../../../
3
3
  type BuilderParams = {
4
4
  authMode: AuthModeType;
5
5
  connectedWallets: Wallet[];
6
+ linkedWallets: Wallet[];
6
7
  multiWallet: boolean;
7
8
  inputList: WalletOption[];
8
9
  isWalletConnectList: boolean;
@@ -23,7 +24,7 @@ type BuilderResult = {
23
24
  };
24
25
  export declare const PRIORITY_WALLET_LIST: string[];
25
26
  export declare const SIGN_IN_WITH_EMAIL_WALLET_NAME = "Sign In With Email";
26
- export declare const walletListBuilder: ({ authMode, connectedWallets, multiWallet, numberOfWalletsToShow, inputList, isWalletConnectList, lastUsedWalletKey, signWithEmailWalletName, searchFilter, walletsFilter, loginWithEmail, groupWallets, walletBook, showMoreWalletsWithFilter, recommendedWallets, }: BuilderParams) => BuilderResult;
27
+ export declare const walletListBuilder: ({ authMode, connectedWallets, linkedWallets, multiWallet, numberOfWalletsToShow, inputList, isWalletConnectList, lastUsedWalletKey, signWithEmailWalletName, searchFilter, walletsFilter, loginWithEmail, groupWallets, walletBook, showMoreWalletsWithFilter, recommendedWallets, }: BuilderParams) => BuilderResult;
27
28
  /**
28
29
  * This calculation adds an offset to numberOfWalletsToShow so we will show the
29
30
  * intended wallets + installed and last used.
@@ -3,6 +3,7 @@ import { isEmbeddedConnector } from '@dynamic-labs/wallet-connector-core';
3
3
  import { getCalculatedOffset } from './utils/getCalculatedOffset/getCalculatedOffset.js';
4
4
  import { groupWalletOptions } from './utils/groupWalletOptions/groupWalletOptions.js';
5
5
  import { filterConnectedWallets } from './utils/filterConnectedWallets/filterConnectedWallets.js';
6
+ import { staticWalletFilter } from './utils/staticLinkedWalletFilter/staticLinkedWalletFilter.js';
6
7
 
7
8
  const PRIORITY_WALLET_LIST = [
8
9
  'metamask',
@@ -52,7 +53,7 @@ const sortedInputList = (inputList, recommendedWalletKeys) => {
52
53
  ...unsortedOtherWallets,
53
54
  ];
54
55
  };
55
- const walletListBuilder = ({ authMode, connectedWallets, multiWallet, numberOfWalletsToShow, inputList, isWalletConnectList, lastUsedWalletKey, signWithEmailWalletName, searchFilter, walletsFilter, loginWithEmail, groupWallets, walletBook, showMoreWalletsWithFilter, recommendedWallets, }) => {
56
+ const walletListBuilder = ({ authMode, connectedWallets, linkedWallets, multiWallet, numberOfWalletsToShow, inputList, isWalletConnectList, lastUsedWalletKey, signWithEmailWalletName, searchFilter, walletsFilter, loginWithEmail, groupWallets, walletBook, showMoreWalletsWithFilter, recommendedWallets, }) => {
56
57
  let walletList = inputList;
57
58
  if (isWalletConnectList) {
58
59
  walletList = inputList.filter((wallet) => wallet.walletConnector.isWalletConnect &&
@@ -64,6 +65,9 @@ const walletListBuilder = ({ authMode, connectedWallets, multiWallet, numberOfWa
64
65
  walletOptions: walletList,
65
66
  });
66
67
  }
68
+ if (authMode === 'connect-and-sign' && multiWallet) {
69
+ walletList = staticWalletFilter(linkedWallets, walletList);
70
+ }
67
71
  let lastUsedWallet;
68
72
  const hasWalletFilter = Boolean(walletsFilter);
69
73
  const signWithEmailWallet = getSignWithEmailWallet(signWithEmailWalletName, walletList);
@@ -108,7 +108,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
108
108
  }, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
109
109
  const checkValidOAuthLinking = React.useCallback((provider) => {
110
110
  if (!isSocialKycEnabled.isSocialKycEnabled(projectSettings)) {
111
- handleError(provider, types.SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled on the dashboard', { raiseAuthFailure: false });
111
+ handleError(provider, types.SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled in Information Capture on the dashboard', { raiseAuthFailure: false });
112
112
  return false;
113
113
  }
114
114
  const verifiedCredential = verifiedOAuthCredentialsMap[provider];
@@ -119,7 +119,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
119
119
  const oauthProviders = index.getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
120
120
  const oauthProvider = oauthProviders.find((p) => p.provider === provider);
121
121
  if (!oauthProvider) {
122
- handleError(provider, types.SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `Provider is not enabled on the dashboard: ${provider}`, { raiseAuthFailure: false });
122
+ handleError(provider, types.SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `Social linking provider is not enabled in Information Capture on the dashboard: ${provider}`, { raiseAuthFailure: false });
123
123
  return false;
124
124
  }
125
125
  return true;
@@ -104,7 +104,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
104
104
  }, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
105
105
  const checkValidOAuthLinking = useCallback((provider) => {
106
106
  if (!isSocialKycEnabled(projectSettings)) {
107
- handleError(provider, SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled on the dashboard', { raiseAuthFailure: false });
107
+ handleError(provider, SocialOAuthErrorCode.SOCIAL_LINKING_NOT_ENABLED, 'Social linking is not enabled in Information Capture on the dashboard', { raiseAuthFailure: false });
108
108
  return false;
109
109
  }
110
110
  const verifiedCredential = verifiedOAuthCredentialsMap[provider];
@@ -115,7 +115,7 @@ const useSocialAccounts = ({ sessionTimeout } = {
115
115
  const oauthProviders = getEnabledOAuthProviders(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers);
116
116
  const oauthProvider = oauthProviders.find((p) => p.provider === provider);
117
117
  if (!oauthProvider) {
118
- handleError(provider, SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `Provider is not enabled on the dashboard: ${provider}`, { raiseAuthFailure: false });
118
+ handleError(provider, SocialOAuthErrorCode.PROVIDER_NOT_ENABLED, `Social linking provider is not enabled in Information Capture on the dashboard: ${provider}`, { raiseAuthFailure: false });
119
119
  return false;
120
120
  }
121
121
  return true;
@@ -85,7 +85,7 @@ var useInternalDynamicContext = require('../../../../../context/DynamicContext/u
85
85
 
86
86
  const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllWallets, }) => {
87
87
  const { t } = reactI18next.useTranslation();
88
- const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, connectedWallets, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
88
+ const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, connectedWallets, linkedWallets, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
89
89
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
90
90
  const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
91
91
  authMode,
@@ -94,6 +94,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
94
94
  inputList: walletConnectorOptions,
95
95
  isWalletConnectList: false,
96
96
  lastUsedWalletKey: localStorage.LocalStorage.getFromLS(localStorage$1.LAST_USED_WALLET),
97
+ linkedWallets,
97
98
  loginWithEmail: true,
98
99
  multiWallet,
99
100
  numberOfWalletsToShow: previewWalletsNumber,
@@ -81,7 +81,7 @@ import { useInternalDynamicContext } from '../../../../../context/DynamicContext
81
81
 
82
82
  const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllWallets, }) => {
83
83
  const { t } = useTranslation();
84
- const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, connectedWallets, recommendedWallets, } = useInternalDynamicContext();
84
+ const { walletConnectorOptions, projectSettings, walletsFilter, signWithEmailWalletName, authMode, multiWallet, connectedWallets, linkedWallets, recommendedWallets, } = useInternalDynamicContext();
85
85
  const { walletBook } = useWalletBookContext();
86
86
  const { numberOfWallets, walletsList } = walletListBuilder({
87
87
  authMode,
@@ -90,6 +90,7 @@ const WalletSimpleSignIn = ({ previewWalletsNumber, disabled = false, onshowAllW
90
90
  inputList: walletConnectorOptions,
91
91
  isWalletConnectList: false,
92
92
  lastUsedWalletKey: LocalStorage.getFromLS(LAST_USED_WALLET),
93
+ linkedWallets,
93
94
  loginWithEmail: true,
94
95
  multiWallet,
95
96
  numberOfWalletsToShow: previewWalletsNumber,
@@ -3,16 +3,16 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
6
7
  var jsxRuntime = require('react/jsx-runtime');
7
8
  var React = require('react');
8
9
  var reactI18next = require('react-i18next');
10
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
11
  require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
10
12
  var Alert = require('../../components/Alert/Alert.cjs');
11
13
  require('../../events/dynamicEvents.cjs');
12
- require('../../../../_virtual/_tslib.cjs');
13
14
  require('@dynamic-labs/utils');
14
15
  require('../../context/DynamicContext/DynamicContext.cjs');
15
- require('@dynamic-labs/sdk-api-core');
16
16
  require('../../shared/logger.cjs');
17
17
  require('@dynamic-labs/iconic');
18
18
  require('@dynamic-labs/wallet-connector-core');
@@ -49,8 +49,9 @@ require('../../context/LoadingContext/LoadingContext.cjs');
49
49
  require('yup');
50
50
  require('../../context/MockContext/MockContext.cjs');
51
51
  require('../CollectUserDataView/useFields.cjs');
52
- require('../../context/FieldsStateContext/FieldsStateContext.cjs');
52
+ var useUserUpdateRequest = require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
53
53
  require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
54
+ require('../../context/FieldsStateContext/FieldsStateContext.cjs');
54
55
  require('@dynamic-labs/rpc-providers');
55
56
  var Typography = require('../../components/Typography/Typography.cjs');
56
57
  require('../../context/FooterAnimationContext/index.cjs');
@@ -92,10 +93,19 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
92
93
  const MfaDisplayBackupCodesView = () => {
93
94
  const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
94
95
  const [acknowledgement, setAcknowledgement] = React.useState(false);
96
+ const { updateUser } = useUserUpdateRequest.useUserUpdateRequestInternal({
97
+ validationSchemaStripUnknown: false,
98
+ });
95
99
  const { t } = reactI18next.useTranslation();
96
100
  const { getRecoveryCodes } = useMfa.useMfa();
97
101
  const { data: codes, isLoading } = usePromise.usePromise(() => getRecoveryCodes());
98
102
  const codesAsString = (codes || []).join('\n');
103
+ const completeAcknowledgement = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
104
+ setShowAuthFlow(false);
105
+ yield updateUser({
106
+ mfaBackupCodeAcknowledgement: sdkApiCore.MfaBackupCodeAcknowledgement.Complete,
107
+ });
108
+ });
99
109
  return (jsxRuntime.jsxs("div", { className: 'mfa-display-backup-codes-view__body', "data-testid": 'mfa-display-backup-codes-view', children: [jsxRuntime.jsx(Typography.Typography, { className: 'mfa-display-backup-codes-view__copy', variant: 'body_normal', weight: 'regular', color: 'secondary', children: t('dyn_mfa.display_backup_codes_view.body') }), jsxRuntime.jsx(Alert.Alert, { variant: 'warning', copykey: 'dyn_mfa.display_backup_codes_view.warning', className: 'mfa-display-backup-codes-view__warning', children: t('dyn_mfa.display_backup_codes_view.warning') }), isLoading ? (jsxRuntime.jsx(spinner.Spinner, { className: 'mfa-display-backup-codes-view__loading-spinner' })) : (jsxRuntime.jsxs("div", { className: 'mfa-display-backup-codes-view__codes', children: [codes === null || codes === void 0 ? void 0 : codes.map((code, index) => (jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'mfa-display-backup-codes-view__code', children: code }, index))), jsxRuntime.jsxs("div", { className: 'mfa-display-backup-codes-view__actions', children: [jsxRuntime.jsx(CopyButton.CopyButton, { variant: 'button', textToCopy: codesAsString, copykey: 'dyn_mfa.display_backup_codes_view.copy_all', startSlot:
100
110
  // eslint-disable-next-line react/jsx-wrap-multilines
101
111
  jsxRuntime.jsx(Icon.Icon, { size: 'mini', color: 'text-tertiary', children: jsxRuntime.jsx(copy.ReactComponent, {}) }), children: t('dyn_mfa.display_backup_codes_view.copy_all') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'download-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: (e) => {
@@ -109,7 +119,7 @@ const MfaDisplayBackupCodesView = () => {
109
119
  color: 'secondary',
110
120
  }, copykey: 'dyn_mfa.display_backup_codes_view.checkbox', children: t('dyn_mfa.display_backup_codes_view.checkbox') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'complete-button', buttonPadding: 'large', buttonVariant: 'brand-primary', typographyProps: {
111
121
  color: 'inherit',
112
- }, disabled: !acknowledgement, expanded: true, copykey: 'dyn_mfa.display_backup_codes_view.complete', onClick: () => setShowAuthFlow(false), children: t('dyn_mfa.display_backup_codes_view.complete') })] })] }));
122
+ }, disabled: !acknowledgement, expanded: true, copykey: 'dyn_mfa.display_backup_codes_view.complete', onClick: completeAcknowledgement, children: t('dyn_mfa.display_backup_codes_view.complete') })] })] }));
113
123
  };
114
124
 
115
125
  exports.MfaDisplayBackupCodesView = MfaDisplayBackupCodesView;
@@ -1,14 +1,14 @@
1
1
  'use client'
2
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
2
3
  import { jsxs, jsx } from 'react/jsx-runtime';
3
4
  import { useState } from 'react';
4
5
  import { useTranslation } from 'react-i18next';
6
+ import { MfaBackupCodeAcknowledgement } from '@dynamic-labs/sdk-api-core';
5
7
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
6
8
  import { Alert } from '../../components/Alert/Alert.js';
7
9
  import '../../events/dynamicEvents.js';
8
- import '../../../../_virtual/_tslib.js';
9
10
  import '@dynamic-labs/utils';
10
11
  import '../../context/DynamicContext/DynamicContext.js';
11
- import '@dynamic-labs/sdk-api-core';
12
12
  import '../../shared/logger.js';
13
13
  import '@dynamic-labs/iconic';
14
14
  import '@dynamic-labs/wallet-connector-core';
@@ -45,8 +45,9 @@ import '../../context/LoadingContext/LoadingContext.js';
45
45
  import 'yup';
46
46
  import '../../context/MockContext/MockContext.js';
47
47
  import '../CollectUserDataView/useFields.js';
48
- import '../../context/FieldsStateContext/FieldsStateContext.js';
48
+ import { useUserUpdateRequestInternal } from '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
49
49
  import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
50
+ import '../../context/FieldsStateContext/FieldsStateContext.js';
50
51
  import '@dynamic-labs/rpc-providers';
51
52
  import { Typography } from '../../components/Typography/Typography.js';
52
53
  import '../../context/FooterAnimationContext/index.js';
@@ -88,10 +89,19 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
88
89
  const MfaDisplayBackupCodesView = () => {
89
90
  const { setShowAuthFlow } = useInternalDynamicContext();
90
91
  const [acknowledgement, setAcknowledgement] = useState(false);
92
+ const { updateUser } = useUserUpdateRequestInternal({
93
+ validationSchemaStripUnknown: false,
94
+ });
91
95
  const { t } = useTranslation();
92
96
  const { getRecoveryCodes } = useMfa();
93
97
  const { data: codes, isLoading } = usePromise(() => getRecoveryCodes());
94
98
  const codesAsString = (codes || []).join('\n');
99
+ const completeAcknowledgement = () => __awaiter(void 0, void 0, void 0, function* () {
100
+ setShowAuthFlow(false);
101
+ yield updateUser({
102
+ mfaBackupCodeAcknowledgement: MfaBackupCodeAcknowledgement.Complete,
103
+ });
104
+ });
95
105
  return (jsxs("div", { className: 'mfa-display-backup-codes-view__body', "data-testid": 'mfa-display-backup-codes-view', children: [jsx(Typography, { className: 'mfa-display-backup-codes-view__copy', variant: 'body_normal', weight: 'regular', color: 'secondary', children: t('dyn_mfa.display_backup_codes_view.body') }), jsx(Alert, { variant: 'warning', copykey: 'dyn_mfa.display_backup_codes_view.warning', className: 'mfa-display-backup-codes-view__warning', children: t('dyn_mfa.display_backup_codes_view.warning') }), isLoading ? (jsx(Spinner, { className: 'mfa-display-backup-codes-view__loading-spinner' })) : (jsxs("div", { className: 'mfa-display-backup-codes-view__codes', children: [codes === null || codes === void 0 ? void 0 : codes.map((code, index) => (jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'mfa-display-backup-codes-view__code', children: code }, index))), jsxs("div", { className: 'mfa-display-backup-codes-view__actions', children: [jsx(CopyButton, { variant: 'button', textToCopy: codesAsString, copykey: 'dyn_mfa.display_backup_codes_view.copy_all', startSlot:
96
106
  // eslint-disable-next-line react/jsx-wrap-multilines
97
107
  jsx(Icon, { size: 'mini', color: 'text-tertiary', children: jsx(SvgCopy, {}) }), children: t('dyn_mfa.display_backup_codes_view.copy_all') }), jsx(TypographyButton, { dataTestId: 'download-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: (e) => {
@@ -105,7 +115,7 @@ const MfaDisplayBackupCodesView = () => {
105
115
  color: 'secondary',
106
116
  }, copykey: 'dyn_mfa.display_backup_codes_view.checkbox', children: t('dyn_mfa.display_backup_codes_view.checkbox') }), jsx(TypographyButton, { dataTestId: 'complete-button', buttonPadding: 'large', buttonVariant: 'brand-primary', typographyProps: {
107
117
  color: 'inherit',
108
- }, disabled: !acknowledgement, expanded: true, copykey: 'dyn_mfa.display_backup_codes_view.complete', onClick: () => setShowAuthFlow(false), children: t('dyn_mfa.display_backup_codes_view.complete') })] })] }));
118
+ }, disabled: !acknowledgement, expanded: true, copykey: 'dyn_mfa.display_backup_codes_view.complete', onClick: completeAcknowledgement, children: t('dyn_mfa.display_backup_codes_view.complete') })] })] }));
109
119
  };
110
120
 
111
121
  export { MfaDisplayBackupCodesView };
@@ -96,7 +96,7 @@ var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWal
96
96
  localStorage.LocalStorage.setToLS(localStorage$1.WALLET_PICKER_SEARCH_KEY, '');
97
97
  const WalletList = ({ isWalletConnectList = false, }) => {
98
98
  var _a;
99
- const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
99
+ const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, linkedWallets, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
100
100
  const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState.useTabState();
101
101
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
102
102
  const { error } = ErrorContext.useErrorContext();
@@ -115,6 +115,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
115
115
  inputList: filteredBridgeChains || walletConnectorOptions,
116
116
  isWalletConnectList,
117
117
  lastUsedWalletKey: localStorage.LocalStorage.getFromLS(localStorage$1.LAST_USED_WALLET),
118
+ linkedWallets,
118
119
  multiWallet,
119
120
  numberOfWalletsToShow: defaultNumberOfWalletsToShow,
120
121
  recommendedWallets: effectiveRecommendedWallets,
@@ -92,7 +92,7 @@ import { getEffectiveRecommendedWallets } from './utils/getEffectiveRecommendedW
92
92
  LocalStorage.setToLS(WALLET_PICKER_SEARCH_KEY, '');
93
93
  const WalletList = ({ isWalletConnectList = false, }) => {
94
94
  var _a;
95
- const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext();
95
+ const { walletsFilter, signWithEmailWalletName, walletConnectorOptions, projectSettings, defaultNumberOfWalletsToShow, bridgeChainsToConnect, connectedWallets, linkedWallets, authMode, multiWallet, recommendedWallets, } = useInternalDynamicContext();
96
96
  const { selectedTabIndex, setSelectedTabIndex, selectedTabSettings, tabsItems, } = useTabState();
97
97
  const { walletBook } = useWalletBookContext();
98
98
  const { error } = useErrorContext();
@@ -111,6 +111,7 @@ const WalletList = ({ isWalletConnectList = false, }) => {
111
111
  inputList: filteredBridgeChains || walletConnectorOptions,
112
112
  isWalletConnectList,
113
113
  lastUsedWalletKey: LocalStorage.getFromLS(LAST_USED_WALLET),
114
+ linkedWallets,
114
115
  multiWallet,
115
116
  numberOfWalletsToShow: defaultNumberOfWalletsToShow,
116
117
  recommendedWallets: effectiveRecommendedWallets,