@dynamic-labs/sdk-react-core 2.3.5 → 2.3.7
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.
- package/CHANGELOG.md +15 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +14 -14
- package/src/lib/components/HardwareWalletToggle/HardwareWalletToggle.cjs +1 -1
- package/src/lib/components/HardwareWalletToggle/HardwareWalletToggle.js +1 -1
- package/src/lib/config/ApiEndpoint.cjs +18 -1
- package/src/lib/config/ApiEndpoint.js +18 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +20 -25
- package/src/lib/context/DynamicContext/DynamicContext.js +20 -25
- package/src/lib/data/api/settings/settings.cjs +4 -0
- package/src/lib/data/api/settings/settings.js +4 -0
- package/src/lib/shared/utils/hooks/index.d.ts +2 -1
- package/src/lib/shared/utils/hooks/usePrefetch/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/usePrefetch/usePrefetch.cjs +51 -0
- package/src/lib/shared/utils/hooks/usePrefetch/usePrefetch.d.ts +23 -0
- package/src/lib/shared/utils/hooks/usePrefetch/usePrefetch.js +47 -0
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.cjs +1 -1
- package/src/lib/utils/functions/walletListBuilder/walletListBuilder.js +1 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.3.7](https://github.com/dynamic-labs/DynamicAuth/compare/v2.3.6...v2.3.7) (2024-07-26)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* cherrypick ledger toggle works on safari ([#6429](https://github.com/dynamic-labs/DynamicAuth/issues/6429)) ([e58f687](https://github.com/dynamic-labs/DynamicAuth/commit/e58f687d569ab3ea51f6026c481d41e70bd0e7f6))
|
|
8
|
+
|
|
9
|
+
### [2.3.6](https://github.com/dynamic-labs/DynamicAuth/compare/v2.3.5...v2.3.6) (2024-07-26)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* add settings prefetch ([#6403](https://github.com/dynamic-labs/DynamicAuth/issues/6403)) ([dcf9e95](https://github.com/dynamic-labs/DynamicAuth/commit/dcf9e950943e9347ab01159772c4de18dd8abd9a)), closes [#6368](https://github.com/dynamic-labs/DynamicAuth/issues/6368)
|
|
15
|
+
* don't filter out bitcoin.com when searching for bitcoin ([#6409](https://github.com/dynamic-labs/DynamicAuth/issues/6409)) ([13121f6](https://github.com/dynamic-labs/DynamicAuth/commit/13121f6b4ad4529fc9691c4504e383caeb5dd294))
|
|
16
|
+
|
|
2
17
|
### [2.3.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.3.4...v2.3.5) (2024-07-22)
|
|
3
18
|
|
|
4
19
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "2.3.
|
|
6
|
+
var version = "2.3.7";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.497",
|
|
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
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
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.
|
|
10
|
+
"@dynamic-labs/sdk-api-core": "0.0.497",
|
|
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.3.
|
|
21
|
-
"@dynamic-labs/logger": "2.3.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.3.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.3.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.3.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.3.
|
|
26
|
-
"@dynamic-labs/store": "2.3.
|
|
27
|
-
"@dynamic-labs/types": "2.3.
|
|
28
|
-
"@dynamic-labs/utils": "2.3.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.3.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.3.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.3.
|
|
20
|
+
"@dynamic-labs/iconic": "2.3.7",
|
|
21
|
+
"@dynamic-labs/logger": "2.3.7",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.3.7",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.3.7",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.3.7",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.3.7",
|
|
26
|
+
"@dynamic-labs/store": "2.3.7",
|
|
27
|
+
"@dynamic-labs/types": "2.3.7",
|
|
28
|
+
"@dynamic-labs/utils": "2.3.7",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.3.7",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.3.7",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.3.7",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -30,7 +30,7 @@ const HardwareWalletToggle = ({ connectors, label, copykey, }) => {
|
|
|
30
30
|
}, "data-testid": 'hardware-wallet-toggle', icon:
|
|
31
31
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
32
32
|
jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(check.ReactComponent, {}) }) }));
|
|
33
|
-
return (jsxRuntime.jsx(ListTile.ListTile, {
|
|
33
|
+
return (jsxRuntime.jsx(ListTile.ListTile, { trailing: toggle, children: jsxRuntime.jsx("span", { copykey, children: label }) }));
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
exports.HardwareWalletToggle = HardwareWalletToggle;
|
|
@@ -26,7 +26,7 @@ const HardwareWalletToggle = ({ connectors, label, copykey, }) => {
|
|
|
26
26
|
}, "data-testid": 'hardware-wallet-toggle', icon:
|
|
27
27
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
28
28
|
jsx(Icon, { size: 'small', children: jsx(SvgCheck, {}) }) }));
|
|
29
|
-
return (jsx(ListTile, {
|
|
29
|
+
return (jsx(ListTile, { trailing: toggle, children: jsx("span", { copykey, children: label }) }));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export { HardwareWalletToggle };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
5
|
+
|
|
4
6
|
/* eslint-disable no-underscore-dangle */
|
|
5
7
|
class ApiEndpoint {
|
|
6
8
|
}
|
|
@@ -12,9 +14,24 @@ ApiEndpoint.getBaseUrl = () => {
|
|
|
12
14
|
};
|
|
13
15
|
ApiEndpoint.setBaseUrl = (baseUrlInput) => {
|
|
14
16
|
if (!ApiEndpoint.__defined__) {
|
|
15
|
-
|
|
17
|
+
if (!baseUrlInput) {
|
|
18
|
+
/**
|
|
19
|
+
* If the baseUrl is not provided, use the default baseUrl from the sdk-api package
|
|
20
|
+
*/
|
|
21
|
+
ApiEndpoint.__baseUrl__ = new sdkApiCore.Configuration().basePath;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ApiEndpoint.__baseUrl__ = baseUrlInput;
|
|
25
|
+
}
|
|
16
26
|
ApiEndpoint.__defined__ = true;
|
|
17
27
|
}
|
|
28
|
+
else if (!baseUrlInput && ApiEndpoint.__defined__) {
|
|
29
|
+
/**
|
|
30
|
+
* If for some reason (usually in local development), the setBaseUrl is called multiple times with undefined
|
|
31
|
+
* And we already have it defined, let's just assume it's a no-op
|
|
32
|
+
*/
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
18
35
|
else if (ApiEndpoint.__baseUrl__ !== baseUrlInput) {
|
|
19
36
|
throw new Error(`ApiEndpoint baseUrl is already set to ${ApiEndpoint.__baseUrl__}, cannot change it to ${baseUrlInput}`);
|
|
20
37
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { Configuration } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
|
|
2
4
|
/* eslint-disable no-underscore-dangle */
|
|
3
5
|
class ApiEndpoint {
|
|
4
6
|
}
|
|
@@ -10,9 +12,24 @@ ApiEndpoint.getBaseUrl = () => {
|
|
|
10
12
|
};
|
|
11
13
|
ApiEndpoint.setBaseUrl = (baseUrlInput) => {
|
|
12
14
|
if (!ApiEndpoint.__defined__) {
|
|
13
|
-
|
|
15
|
+
if (!baseUrlInput) {
|
|
16
|
+
/**
|
|
17
|
+
* If the baseUrl is not provided, use the default baseUrl from the sdk-api package
|
|
18
|
+
*/
|
|
19
|
+
ApiEndpoint.__baseUrl__ = new Configuration().basePath;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
ApiEndpoint.__baseUrl__ = baseUrlInput;
|
|
23
|
+
}
|
|
14
24
|
ApiEndpoint.__defined__ = true;
|
|
15
25
|
}
|
|
26
|
+
else if (!baseUrlInput && ApiEndpoint.__defined__) {
|
|
27
|
+
/**
|
|
28
|
+
* If for some reason (usually in local development), the setBaseUrl is called multiple times with undefined
|
|
29
|
+
* And we already have it defined, let's just assume it's a no-op
|
|
30
|
+
*/
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
16
33
|
else if (ApiEndpoint.__baseUrl__ !== baseUrlInput) {
|
|
17
34
|
throw new Error(`ApiEndpoint baseUrl is already set to ${ApiEndpoint.__baseUrl__}, cannot change it to ${baseUrlInput}`);
|
|
18
35
|
}
|
|
@@ -25,6 +25,7 @@ var values = require('../../utils/constants/values.cjs');
|
|
|
25
25
|
var localStorage = require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
26
26
|
var useGlobalLoading = require('../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs');
|
|
27
27
|
var useLocalStorage = require('../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
28
|
+
var usePrefetch = require('../../shared/utils/hooks/usePrefetch/usePrefetch.cjs');
|
|
28
29
|
require('../../shared/consts/index.cjs');
|
|
29
30
|
var CaptchaContext = require('../CaptchaContext/CaptchaContext.cjs');
|
|
30
31
|
var ErrorContext = require('../ErrorContext/ErrorContext.cjs');
|
|
@@ -34,6 +35,7 @@ var getMinAuthToken = require('../../utils/functions/getMinAuthToken/getMinAuthT
|
|
|
34
35
|
require('react-international-phone');
|
|
35
36
|
require('viem');
|
|
36
37
|
require('viem/chains');
|
|
38
|
+
var version = require('../../../version.cjs');
|
|
37
39
|
var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
|
|
38
40
|
var userActions = require('../../store/actions/userActions/userActions.cjs');
|
|
39
41
|
var settings = require('../../data/api/settings/settings.cjs');
|
|
@@ -674,31 +676,24 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
674
676
|
walletUiUtils,
|
|
675
677
|
walletsFilter,
|
|
676
678
|
]);
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
addPrefetch({
|
|
696
|
-
as: 'fetch',
|
|
697
|
-
href: walletBook.getWalletBookCdnUrl(),
|
|
698
|
-
id: 'wallet-book',
|
|
699
|
-
type: 'application/json',
|
|
700
|
-
});
|
|
701
|
-
}, []);
|
|
679
|
+
usePrefetch.usePrefetch({
|
|
680
|
+
as: 'image',
|
|
681
|
+
href: iconic.getIconicSpriteUrl(),
|
|
682
|
+
id: 'sprite',
|
|
683
|
+
type: 'image/svg+xml',
|
|
684
|
+
});
|
|
685
|
+
usePrefetch.usePrefetch({
|
|
686
|
+
as: 'fetch',
|
|
687
|
+
href: walletBook.getWalletBookCdnUrl(),
|
|
688
|
+
id: 'wallet-book',
|
|
689
|
+
type: 'application/json',
|
|
690
|
+
});
|
|
691
|
+
usePrefetch.usePrefetch({
|
|
692
|
+
as: 'fetch',
|
|
693
|
+
href: `${ApiEndpoint.getBaseUrl()}/sdk/${environmentId}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${version.VERSION}`)}`,
|
|
694
|
+
id: `project-settings-${environmentId}`,
|
|
695
|
+
type: 'application/json',
|
|
696
|
+
});
|
|
702
697
|
// DYN-1140 - Opens Widget when multiWalletWidgetState changes
|
|
703
698
|
React.useEffect(() => {
|
|
704
699
|
// If statement to secure SingleWallet widget
|
|
@@ -21,6 +21,7 @@ import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.
|
|
|
21
21
|
import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
|
|
22
22
|
import { useGlobalLoading } from '../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.js';
|
|
23
23
|
import { useLocalStorage } from '../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
24
|
+
import { usePrefetch } from '../../shared/utils/hooks/usePrefetch/usePrefetch.js';
|
|
24
25
|
import '../../shared/consts/index.js';
|
|
25
26
|
import { CaptchaContextProvider } from '../CaptchaContext/CaptchaContext.js';
|
|
26
27
|
import { ErrorContextProvider } from '../ErrorContext/ErrorContext.js';
|
|
@@ -30,6 +31,7 @@ import { getMinAuthToken } from '../../utils/functions/getMinAuthToken/getMinAut
|
|
|
30
31
|
import 'react-international-phone';
|
|
31
32
|
import 'viem';
|
|
32
33
|
import 'viem/chains';
|
|
34
|
+
import { VERSION } from '../../../version.js';
|
|
33
35
|
import ApiEndpoint from '../../config/ApiEndpoint.js';
|
|
34
36
|
import { setUser } from '../../store/actions/userActions/userActions.js';
|
|
35
37
|
import { sendDynamicProps } from '../../data/api/settings/settings.js';
|
|
@@ -670,31 +672,24 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
670
672
|
walletUiUtils,
|
|
671
673
|
walletsFilter,
|
|
672
674
|
]);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
addPrefetch({
|
|
692
|
-
as: 'fetch',
|
|
693
|
-
href: getWalletBookCdnUrl(),
|
|
694
|
-
id: 'wallet-book',
|
|
695
|
-
type: 'application/json',
|
|
696
|
-
});
|
|
697
|
-
}, []);
|
|
675
|
+
usePrefetch({
|
|
676
|
+
as: 'image',
|
|
677
|
+
href: getIconicSpriteUrl(),
|
|
678
|
+
id: 'sprite',
|
|
679
|
+
type: 'image/svg+xml',
|
|
680
|
+
});
|
|
681
|
+
usePrefetch({
|
|
682
|
+
as: 'fetch',
|
|
683
|
+
href: getWalletBookCdnUrl(),
|
|
684
|
+
id: 'wallet-book',
|
|
685
|
+
type: 'application/json',
|
|
686
|
+
});
|
|
687
|
+
usePrefetch({
|
|
688
|
+
as: 'fetch',
|
|
689
|
+
href: `${ApiEndpoint.getBaseUrl()}/sdk/${environmentId}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${VERSION}`)}`,
|
|
690
|
+
id: `project-settings-${environmentId}`,
|
|
691
|
+
type: 'application/json',
|
|
692
|
+
});
|
|
698
693
|
// DYN-1140 - Opens Widget when multiWalletWidgetState changes
|
|
699
694
|
useEffect(() => {
|
|
700
695
|
// If statement to secure SingleWallet widget
|
|
@@ -20,11 +20,15 @@ require('@dynamic-labs/utils');
|
|
|
20
20
|
require('../../../shared/consts/index.cjs');
|
|
21
21
|
var api = require('../api.cjs');
|
|
22
22
|
var helpers = require('../../../context/DynamicContext/helpers/helpers.cjs');
|
|
23
|
+
var version = require('../../../../version.cjs');
|
|
23
24
|
|
|
24
25
|
const fetchProjectSettings = (environmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
26
|
try {
|
|
26
27
|
const res = yield api.sdkApi().getEnvironmentSettings({
|
|
27
28
|
environmentId,
|
|
29
|
+
sdkVersion: `WalletKit/${version.VERSION}`,
|
|
30
|
+
}, {
|
|
31
|
+
credentials: 'omit',
|
|
28
32
|
});
|
|
29
33
|
return res;
|
|
30
34
|
}
|
|
@@ -16,11 +16,15 @@ import '@dynamic-labs/utils';
|
|
|
16
16
|
import '../../../shared/consts/index.js';
|
|
17
17
|
import { sdkApi } from '../api.js';
|
|
18
18
|
import { isDynamicContextSessionSettingExpired, setDynamicContextSessionSettings, isWagmiSessionSettingExpired, setWagmiSessionSettings } from '../../../context/DynamicContext/helpers/helpers.js';
|
|
19
|
+
import { VERSION } from '../../../../version.js';
|
|
19
20
|
|
|
20
21
|
const fetchProjectSettings = (environmentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
22
|
try {
|
|
22
23
|
const res = yield sdkApi().getEnvironmentSettings({
|
|
23
24
|
environmentId,
|
|
25
|
+
sdkVersion: `WalletKit/${VERSION}`,
|
|
26
|
+
}, {
|
|
27
|
+
credentials: 'omit',
|
|
24
28
|
});
|
|
25
29
|
return res;
|
|
26
30
|
}
|
|
@@ -5,4 +5,5 @@ export { useLocalStorage } from './useLocalStorage';
|
|
|
5
5
|
export { useMediaQuery } from './useMediaQuery';
|
|
6
6
|
export { useOnClickOutside } from './useOnClickOutside';
|
|
7
7
|
export { usePreventPageScroll } from './usePreventPageScroll';
|
|
8
|
-
export
|
|
8
|
+
export { useThrottle } from './useThrottle';
|
|
9
|
+
export { usePrefetch } from './usePrefetch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePrefetch } from './usePrefetch';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
require('@dynamic-labs/sdk-api-core');
|
|
7
|
+
require('../../../logger.cjs');
|
|
8
|
+
require('@dynamic-labs/iconic');
|
|
9
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
+
require('react/jsx-runtime');
|
|
11
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
+
require('react');
|
|
13
|
+
require('@dynamic-labs/wallet-book');
|
|
14
|
+
var isSSR = require('../../functions/isSSR/isSSR.cjs');
|
|
15
|
+
require('../../../../utils/constants/colors.cjs');
|
|
16
|
+
require('../../../../utils/constants/values.cjs');
|
|
17
|
+
require('../../classes/storage/localStorage.cjs');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Prefetches a resource
|
|
21
|
+
* Adds a link element to the head of the document with the provided attributes
|
|
22
|
+
* when the element is not already present
|
|
23
|
+
* @param {PrefetchProps} prefetchProps
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* usePrefetch({
|
|
28
|
+
* href: 'https://example.com/image.jpg',
|
|
29
|
+
* as: 'image',
|
|
30
|
+
* type: 'image/jpeg',
|
|
31
|
+
* id: 'image-prefetch',
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
const usePrefetch = ({ as, href, id, type }) => {
|
|
35
|
+
// Do not run on server side
|
|
36
|
+
if (isSSR.isSSR())
|
|
37
|
+
return;
|
|
38
|
+
const predefinedElement = document.head.querySelector(`#${id}`);
|
|
39
|
+
// Do not add the element if it already exists
|
|
40
|
+
if (predefinedElement)
|
|
41
|
+
return;
|
|
42
|
+
const element = document.createElement('link');
|
|
43
|
+
element.setAttribute('id', id);
|
|
44
|
+
element.setAttribute('rel', 'prefetch');
|
|
45
|
+
element.setAttribute('href', href);
|
|
46
|
+
element.setAttribute('as', as);
|
|
47
|
+
element.setAttribute('type', type);
|
|
48
|
+
document.head.insertAdjacentElement('beforeend', element);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.usePrefetch = usePrefetch;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type PrefetchProps = {
|
|
2
|
+
href: string;
|
|
3
|
+
as: string;
|
|
4
|
+
type: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Prefetches a resource
|
|
9
|
+
* Adds a link element to the head of the document with the provided attributes
|
|
10
|
+
* when the element is not already present
|
|
11
|
+
* @param {PrefetchProps} prefetchProps
|
|
12
|
+
* @returns {void}
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* usePrefetch({
|
|
16
|
+
* href: 'https://example.com/image.jpg',
|
|
17
|
+
* as: 'image',
|
|
18
|
+
* type: 'image/jpeg',
|
|
19
|
+
* id: 'image-prefetch',
|
|
20
|
+
* });
|
|
21
|
+
*/
|
|
22
|
+
export declare const usePrefetch: ({ as, href, id, type }: PrefetchProps) => void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import '../../../logger.js';
|
|
4
|
+
import '@dynamic-labs/iconic';
|
|
5
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
8
|
+
import 'react';
|
|
9
|
+
import '@dynamic-labs/wallet-book';
|
|
10
|
+
import { isSSR } from '../../functions/isSSR/isSSR.js';
|
|
11
|
+
import '../../../../utils/constants/colors.js';
|
|
12
|
+
import '../../../../utils/constants/values.js';
|
|
13
|
+
import '../../classes/storage/localStorage.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Prefetches a resource
|
|
17
|
+
* Adds a link element to the head of the document with the provided attributes
|
|
18
|
+
* when the element is not already present
|
|
19
|
+
* @param {PrefetchProps} prefetchProps
|
|
20
|
+
* @returns {void}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* usePrefetch({
|
|
24
|
+
* href: 'https://example.com/image.jpg',
|
|
25
|
+
* as: 'image',
|
|
26
|
+
* type: 'image/jpeg',
|
|
27
|
+
* id: 'image-prefetch',
|
|
28
|
+
* });
|
|
29
|
+
*/
|
|
30
|
+
const usePrefetch = ({ as, href, id, type }) => {
|
|
31
|
+
// Do not run on server side
|
|
32
|
+
if (isSSR())
|
|
33
|
+
return;
|
|
34
|
+
const predefinedElement = document.head.querySelector(`#${id}`);
|
|
35
|
+
// Do not add the element if it already exists
|
|
36
|
+
if (predefinedElement)
|
|
37
|
+
return;
|
|
38
|
+
const element = document.createElement('link');
|
|
39
|
+
element.setAttribute('id', id);
|
|
40
|
+
element.setAttribute('rel', 'prefetch');
|
|
41
|
+
element.setAttribute('href', href);
|
|
42
|
+
element.setAttribute('as', as);
|
|
43
|
+
element.setAttribute('type', type);
|
|
44
|
+
document.head.insertAdjacentElement('beforeend', element);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { usePrefetch };
|
|
@@ -134,7 +134,7 @@ const orderAndFilterList = (walletList, walletsFilter, isWalletConnectList, reco
|
|
|
134
134
|
return sortedWalletList;
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
const KEEP_WALLETS_NAME_LIST = ['wallet connect'];
|
|
137
|
+
const KEEP_WALLETS_NAME_LIST = ['wallet connect', 'bitcoin.com wallet'];
|
|
138
138
|
const applySearchFilterToWalletOptionList = (rawSearchFilter, walletOptionList) => {
|
|
139
139
|
const searchFilter = rawSearchFilter.trim().toLowerCase();
|
|
140
140
|
const cleanName = (name) => {
|
|
@@ -130,7 +130,7 @@ const orderAndFilterList = (walletList, walletsFilter, isWalletConnectList, reco
|
|
|
130
130
|
return sortedWalletList;
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
const KEEP_WALLETS_NAME_LIST = ['wallet connect'];
|
|
133
|
+
const KEEP_WALLETS_NAME_LIST = ['wallet connect', 'bitcoin.com wallet'];
|
|
134
134
|
const applySearchFilterToWalletOptionList = (rawSearchFilter, walletOptionList) => {
|
|
135
135
|
const searchFilter = rawSearchFilter.trim().toLowerCase();
|
|
136
136
|
const cleanName = (name) => {
|
|
@@ -176,9 +176,9 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
176
176
|
}
|
|
177
177
|
const { id, oauthAccountId, oauthAccountPhotos, oauthDisplayName, oauthEmails, oauthProvider, oauthUsername, publicIdentifier, } = verifiedCredential;
|
|
178
178
|
return {
|
|
179
|
-
accountId: oauthAccountId,
|
|
179
|
+
accountId: oauthAccountId !== null && oauthAccountId !== void 0 ? oauthAccountId : undefined,
|
|
180
180
|
avatar: oauthAccountPhotos === null || oauthAccountPhotos === void 0 ? void 0 : oauthAccountPhotos[0],
|
|
181
|
-
displayName: oauthDisplayName,
|
|
181
|
+
displayName: oauthDisplayName !== null && oauthDisplayName !== void 0 ? oauthDisplayName : undefined,
|
|
182
182
|
email: oauthEmails === null || oauthEmails === void 0 ? void 0 : oauthEmails[0],
|
|
183
183
|
id,
|
|
184
184
|
provider: oauthProvider,
|
|
@@ -172,9 +172,9 @@ const useSocialAccounts = ({ sessionTimeout } = {
|
|
|
172
172
|
}
|
|
173
173
|
const { id, oauthAccountId, oauthAccountPhotos, oauthDisplayName, oauthEmails, oauthProvider, oauthUsername, publicIdentifier, } = verifiedCredential;
|
|
174
174
|
return {
|
|
175
|
-
accountId: oauthAccountId,
|
|
175
|
+
accountId: oauthAccountId !== null && oauthAccountId !== void 0 ? oauthAccountId : undefined,
|
|
176
176
|
avatar: oauthAccountPhotos === null || oauthAccountPhotos === void 0 ? void 0 : oauthAccountPhotos[0],
|
|
177
|
-
displayName: oauthDisplayName,
|
|
177
|
+
displayName: oauthDisplayName !== null && oauthDisplayName !== void 0 ? oauthDisplayName : undefined,
|
|
178
178
|
email: oauthEmails === null || oauthEmails === void 0 ? void 0 : oauthEmails[0],
|
|
179
179
|
id,
|
|
180
180
|
provider: oauthProvider,
|