@dynamic-labs/sdk-react-core 2.1.0-alpha.27 → 2.1.0-alpha.29
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 +27 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/{SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.cjs → SyncAuthFlow/SyncAuthFlow.cjs} +12 -65
- package/src/lib/components/SyncAuthFlow/SyncAuthFlow.d.ts +1 -0
- package/src/lib/components/{SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.js → SyncAuthFlow/SyncAuthFlow.js} +12 -65
- package/src/lib/components/SyncAuthFlow/index.d.ts +1 -0
- package/src/lib/components/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -5
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -5
- package/src/lib/context/DynamicContext/types/index.d.ts +3 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +1 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +1 -0
- package/src/lib/store/hooks/useProjectSettings/useProjectSettings.cjs +5 -2
- package/src/lib/store/hooks/useProjectSettings/useProjectSettings.js +5 -2
- package/src/lib/store/utils/clearExpiredData/clearExpiredData.cjs +23 -3
- package/src/lib/store/utils/clearExpiredData/clearExpiredData.js +23 -3
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +2 -2
- package/src/lib/utils/constants/localStorage.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.js +2 -2
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +0 -28
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -28
- package/src/lib/utils/functions/index.d.ts +0 -2
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.cjs +14 -6
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.d.ts +1 -1
- package/src/lib/utils/functions/isCookieEnabled/isCookieEnabled.js +14 -6
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +0 -16
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +0 -16
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +2 -10
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +2 -10
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs +139 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.d.ts +1 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js +135 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/index.d.ts +1 -0
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.cjs +85 -3
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.js +85 -3
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +7 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +8 -2
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.d.ts +0 -1
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/index.d.ts +0 -1
- package/src/lib/utils/functions/getProjectSettingsFromLs/getProjectSettingsFromLs.cjs +0 -28
- package/src/lib/utils/functions/getProjectSettingsFromLs/getProjectSettingsFromLs.d.ts +0 -2
- package/src/lib/utils/functions/getProjectSettingsFromLs/getProjectSettingsFromLs.js +0 -24
- package/src/lib/utils/functions/getProjectSettingsFromLs/index.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/index.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs +0 -20
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js +0 -16
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/index.d.ts +0 -1
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.28...v2.1.0-alpha.29) (2024-05-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add account and chain to coinbase walletClient ([#5776](https://github.com/dynamic-labs/DynamicAuth/issues/5776)) ([557091c](https://github.com/dynamic-labs/DynamicAuth/commit/557091c0efaec11273bd40b53c8bcd633c1bf48d))
|
|
8
|
+
* add support for phantom btc ([#5717](https://github.com/dynamic-labs/DynamicAuth/issues/5717)) ([c61ca4f](https://github.com/dynamic-labs/DynamicAuth/commit/c61ca4f437796be2b420902de7e7de730725d122))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add phantom btc mobile redirect ([#5789](https://github.com/dynamic-labs/DynamicAuth/issues/5789)) ([aaa2654](https://github.com/dynamic-labs/DynamicAuth/commit/aaa26548668b0733e7930c1d7f5cc3937b3dfb50))
|
|
14
|
+
* clear settings and configurations when logged out on page load ([#5787](https://github.com/dynamic-labs/DynamicAuth/issues/5787)) ([53c4d0b](https://github.com/dynamic-labs/DynamicAuth/commit/53c4d0b4686debdb43b1ab1b8b9e296ed4dd74b6))
|
|
15
|
+
* lookup projectSettings from store to check if cookie enabled ([#5790](https://github.com/dynamic-labs/DynamicAuth/issues/5790)) ([6f2314b](https://github.com/dynamic-labs/DynamicAuth/commit/6f2314b0afef984e6caea79ead73d12c5c6d83f0))
|
|
16
|
+
|
|
17
|
+
## [2.1.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.27...v2.1.0-alpha.28) (2024-05-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* adds solana standard wallet connector ([#5752](https://github.com/dynamic-labs/DynamicAuth/issues/5752)) ([0040940](https://github.com/dynamic-labs/DynamicAuth/commit/0040940fd1adb37ab3106bb0e4dfe79403bc41f2))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* farcaster fetch url fix ([#5767](https://github.com/dynamic-labs/DynamicAuth/issues/5767)) ([1408ba9](https://github.com/dynamic-labs/DynamicAuth/commit/1408ba92680363b9db7820a63d5e3d15dc26ad22))
|
|
28
|
+
|
|
2
29
|
## [2.1.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.26...v2.1.0-alpha.27) (2024-05-29)
|
|
3
30
|
|
|
4
31
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.29",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -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.1.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "2.1.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.1.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.1.0-alpha.
|
|
26
|
-
"@dynamic-labs/store": "2.1.0-alpha.
|
|
27
|
-
"@dynamic-labs/types": "2.1.0-alpha.
|
|
28
|
-
"@dynamic-labs/utils": "2.1.0-alpha.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.1.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.1.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "2.1.0-alpha.29",
|
|
21
|
+
"@dynamic-labs/logger": "2.1.0-alpha.29",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.1.0-alpha.29",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.29",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.29",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.1.0-alpha.29",
|
|
26
|
+
"@dynamic-labs/store": "2.1.0-alpha.29",
|
|
27
|
+
"@dynamic-labs/types": "2.1.0-alpha.29",
|
|
28
|
+
"@dynamic-labs/utils": "2.1.0-alpha.29",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.1.0-alpha.29",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.29",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.29",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
require('react');
|
|
7
|
+
require('../../events/dynamicEvents.cjs');
|
|
8
|
+
require('../../../../_virtual/_tslib.cjs');
|
|
9
|
+
require('@dynamic-labs/utils');
|
|
9
10
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
10
11
|
require('@dynamic-labs/sdk-api-core');
|
|
11
|
-
|
|
12
|
+
require('../../shared/logger.cjs');
|
|
12
13
|
require('@dynamic-labs/iconic');
|
|
13
14
|
require('@dynamic-labs/wallet-connector-core');
|
|
14
15
|
require('react/jsx-runtime');
|
|
@@ -18,7 +19,6 @@ require('../../utils/constants/colors.cjs');
|
|
|
18
19
|
require('../../utils/constants/values.cjs');
|
|
19
20
|
require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
20
21
|
require('../../shared/consts/index.cjs');
|
|
21
|
-
var useDynamicEvents = require('../../utils/hooks/events/useDynamicEvents/useDynamicEvents.cjs');
|
|
22
22
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
23
23
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
24
24
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -31,15 +31,13 @@ require('../../locale/locale.cjs');
|
|
|
31
31
|
require('../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
32
32
|
require('../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
33
33
|
require('../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
34
|
-
require('../../events/dynamicEvents.cjs');
|
|
35
34
|
require('../../context/VerificationContext/VerificationContext.cjs');
|
|
36
35
|
require('react-dom');
|
|
37
|
-
|
|
38
|
-
var WalletContext = require('../../context/WalletContext/WalletContext.cjs');
|
|
36
|
+
require('../../context/WalletContext/WalletContext.cjs');
|
|
39
37
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
40
38
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
41
39
|
require('@dynamic-labs/types');
|
|
42
|
-
|
|
40
|
+
require('../../context/LoadingContext/LoadingContext.cjs');
|
|
43
41
|
require('yup');
|
|
44
42
|
require('../../context/MockContext/MockContext.cjs');
|
|
45
43
|
require('../../views/CollectUserDataView/useFields.cjs');
|
|
@@ -78,63 +76,12 @@ require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidge
|
|
|
78
76
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
79
77
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
80
78
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
81
|
-
var
|
|
79
|
+
var useSyncEmbeddedWalletFlow = require('../../utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs');
|
|
82
80
|
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const { loading: globalLoading } = LoadingContext.useLoadingContext();
|
|
87
|
-
const { createEmbeddedWallet, shouldAutoCreateEmbeddedWallet } = useEmbeddedWallet.useEmbeddedWallet();
|
|
88
|
-
const triggeredCreate = React.useRef(false);
|
|
89
|
-
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
90
|
-
triggeredCreate.current = false;
|
|
91
|
-
});
|
|
92
|
-
// this is used to trigger createEmbeddedWallet
|
|
93
|
-
// when user didn't create a passkey after login,
|
|
94
|
-
// we force them to created it before they can use the app
|
|
95
|
-
// ** It must be an useEffect because some of the dependencies are async
|
|
96
|
-
React.useEffect(() => {
|
|
97
|
-
const createWallet = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
-
triggeredCreate.current = true;
|
|
99
|
-
try {
|
|
100
|
-
yield createEmbeddedWallet();
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
if (error instanceof utils.EmbeddedWalletException) {
|
|
104
|
-
logger.logger.debug('Error creating embedded wallet', error);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
logger.logger.error('Error creating embedded wallet', error);
|
|
108
|
-
}
|
|
109
|
-
setShowAuthFlow(false);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const shouldCreateWallet = shouldAutoCreateEmbeddedWallet();
|
|
113
|
-
if (!shouldCreateWallet ||
|
|
114
|
-
!user ||
|
|
115
|
-
isProjectSettingsLoading ||
|
|
116
|
-
!projectSettings ||
|
|
117
|
-
!walletConnectorOptions.length || // no connectors to use for the embedded wallet
|
|
118
|
-
isLoadingEmbeddedWallet || // already has a wallet
|
|
119
|
-
globalLoading || // this will be true if auth is in progress
|
|
120
|
-
triggeredCreate.current // already triggered
|
|
121
|
-
) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
createWallet();
|
|
125
|
-
}, [
|
|
126
|
-
user,
|
|
127
|
-
isProjectSettingsLoading,
|
|
128
|
-
projectSettings,
|
|
129
|
-
primaryWalletId,
|
|
130
|
-
createEmbeddedWallet,
|
|
131
|
-
isLoadingEmbeddedWallet,
|
|
132
|
-
walletConnectorOptions,
|
|
133
|
-
globalLoading,
|
|
134
|
-
shouldAutoCreateEmbeddedWallet,
|
|
135
|
-
setShowAuthFlow,
|
|
136
|
-
]);
|
|
81
|
+
const SyncAuthFlow = () => {
|
|
82
|
+
useSyncEmbeddedWalletFlow.useSyncEmbeddedWalletFlow();
|
|
83
|
+
// TODO: add useSyncOnboardingFlow here
|
|
137
84
|
return null;
|
|
138
85
|
};
|
|
139
86
|
|
|
140
|
-
exports.
|
|
87
|
+
exports.SyncAuthFlow = SyncAuthFlow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SyncAuthFlow: () => null;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../events/dynamicEvents.js';
|
|
4
|
+
import '../../../../_virtual/_tslib.js';
|
|
5
|
+
import '@dynamic-labs/utils';
|
|
5
6
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
6
7
|
import '@dynamic-labs/sdk-api-core';
|
|
7
|
-
import
|
|
8
|
+
import '../../shared/logger.js';
|
|
8
9
|
import '@dynamic-labs/iconic';
|
|
9
10
|
import '@dynamic-labs/wallet-connector-core';
|
|
10
11
|
import 'react/jsx-runtime';
|
|
@@ -14,7 +15,6 @@ import '../../utils/constants/colors.js';
|
|
|
14
15
|
import '../../utils/constants/values.js';
|
|
15
16
|
import '../../shared/utils/classes/storage/localStorage.js';
|
|
16
17
|
import '../../shared/consts/index.js';
|
|
17
|
-
import { useInternalDynamicEvents } from '../../utils/hooks/events/useDynamicEvents/useDynamicEvents.js';
|
|
18
18
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
19
19
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
20
20
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -27,15 +27,13 @@ import '../../locale/locale.js';
|
|
|
27
27
|
import '../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
28
28
|
import '../../context/AccountExistsContext/AccountExistsContext.js';
|
|
29
29
|
import '../../context/UserWalletsContext/UserWalletsContext.js';
|
|
30
|
-
import '../../events/dynamicEvents.js';
|
|
31
30
|
import '../../context/VerificationContext/VerificationContext.js';
|
|
32
31
|
import 'react-dom';
|
|
33
|
-
import
|
|
34
|
-
import { useWalletContext } from '../../context/WalletContext/WalletContext.js';
|
|
32
|
+
import '../../context/WalletContext/WalletContext.js';
|
|
35
33
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
36
34
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
37
35
|
import '@dynamic-labs/types';
|
|
38
|
-
import
|
|
36
|
+
import '../../context/LoadingContext/LoadingContext.js';
|
|
39
37
|
import 'yup';
|
|
40
38
|
import '../../context/MockContext/MockContext.js';
|
|
41
39
|
import '../../views/CollectUserDataView/useFields.js';
|
|
@@ -74,63 +72,12 @@ import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidget
|
|
|
74
72
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
75
73
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
76
74
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
77
|
-
import {
|
|
75
|
+
import { useSyncEmbeddedWalletFlow } from '../../utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js';
|
|
78
76
|
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const { loading: globalLoading } = useLoadingContext();
|
|
83
|
-
const { createEmbeddedWallet, shouldAutoCreateEmbeddedWallet } = useEmbeddedWallet();
|
|
84
|
-
const triggeredCreate = useRef(false);
|
|
85
|
-
useInternalDynamicEvents('logout', () => {
|
|
86
|
-
triggeredCreate.current = false;
|
|
87
|
-
});
|
|
88
|
-
// this is used to trigger createEmbeddedWallet
|
|
89
|
-
// when user didn't create a passkey after login,
|
|
90
|
-
// we force them to created it before they can use the app
|
|
91
|
-
// ** It must be an useEffect because some of the dependencies are async
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
const createWallet = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
-
triggeredCreate.current = true;
|
|
95
|
-
try {
|
|
96
|
-
yield createEmbeddedWallet();
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
if (error instanceof EmbeddedWalletException) {
|
|
100
|
-
logger.debug('Error creating embedded wallet', error);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
logger.error('Error creating embedded wallet', error);
|
|
104
|
-
}
|
|
105
|
-
setShowAuthFlow(false);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const shouldCreateWallet = shouldAutoCreateEmbeddedWallet();
|
|
109
|
-
if (!shouldCreateWallet ||
|
|
110
|
-
!user ||
|
|
111
|
-
isProjectSettingsLoading ||
|
|
112
|
-
!projectSettings ||
|
|
113
|
-
!walletConnectorOptions.length || // no connectors to use for the embedded wallet
|
|
114
|
-
isLoadingEmbeddedWallet || // already has a wallet
|
|
115
|
-
globalLoading || // this will be true if auth is in progress
|
|
116
|
-
triggeredCreate.current // already triggered
|
|
117
|
-
) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
createWallet();
|
|
121
|
-
}, [
|
|
122
|
-
user,
|
|
123
|
-
isProjectSettingsLoading,
|
|
124
|
-
projectSettings,
|
|
125
|
-
primaryWalletId,
|
|
126
|
-
createEmbeddedWallet,
|
|
127
|
-
isLoadingEmbeddedWallet,
|
|
128
|
-
walletConnectorOptions,
|
|
129
|
-
globalLoading,
|
|
130
|
-
shouldAutoCreateEmbeddedWallet,
|
|
131
|
-
setShowAuthFlow,
|
|
132
|
-
]);
|
|
77
|
+
const SyncAuthFlow = () => {
|
|
78
|
+
useSyncEmbeddedWalletFlow();
|
|
79
|
+
// TODO: add useSyncOnboardingFlow here
|
|
133
80
|
return null;
|
|
134
81
|
};
|
|
135
82
|
|
|
136
|
-
export {
|
|
83
|
+
export { SyncAuthFlow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SyncAuthFlow } from './SyncAuthFlow';
|
|
@@ -58,7 +58,7 @@ export * from './Spinner';
|
|
|
58
58
|
export * from './Step';
|
|
59
59
|
export * from './Stepper';
|
|
60
60
|
export * from './Switch';
|
|
61
|
-
export * from './
|
|
61
|
+
export * from './SyncAuthFlow';
|
|
62
62
|
export * from './TextButton';
|
|
63
63
|
export * from './ToggleVisibilityButton';
|
|
64
64
|
export * from './Toolkit';
|
|
@@ -87,7 +87,7 @@ require('../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSign
|
|
|
87
87
|
var WalletGroupContext = require('../WalletGroupContext/WalletGroupContext.cjs');
|
|
88
88
|
var IpConfigurationContext = require('../IpConfigurationContext/IpConfigurationContext.cjs');
|
|
89
89
|
var PasskeyContext = require('../PasskeyContext/PasskeyContext.cjs');
|
|
90
|
-
var
|
|
90
|
+
var SyncAuthFlow = require('../../components/SyncAuthFlow/SyncAuthFlow.cjs');
|
|
91
91
|
var Toolkit = require('../../components/Toolkit/Toolkit.cjs');
|
|
92
92
|
var getMissingChains = require('../../utils/functions/getMissingChains/getMissingChains.cjs');
|
|
93
93
|
var parseTheme = require('../../utils/functions/parseTheme/parseTheme.cjs');
|
|
@@ -247,6 +247,9 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
247
247
|
const [requiredWalletsConnected, setRequiredWalletsConnected] = React.useState(false);
|
|
248
248
|
const isUserAuthenticated = Boolean(authMode === 'connect-and-sign' ? user : requiredWalletsConnected);
|
|
249
249
|
const isRenderingEmbeddedAuthFlow = React.useRef(false);
|
|
250
|
+
// we need to know when the widget has finished loadingbefore calling the auth flow
|
|
251
|
+
// or it may cause issues with the embedded widget version showing a modal twice
|
|
252
|
+
const [dynamicWidgetHasLoaded, setDynamicWidgetHasLoaded] = React.useState(false);
|
|
250
253
|
const [showAuthFlow, setShowAuthFlow] = useShowAuthFlow.useShowAuthFlow({
|
|
251
254
|
isAuthenticated: isUserAuthenticated,
|
|
252
255
|
isMultiWalletEnabled: multiWallet,
|
|
@@ -446,6 +449,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
446
449
|
desktopUri,
|
|
447
450
|
disconnectWallet,
|
|
448
451
|
displaySiweStatement,
|
|
452
|
+
dynamicWidgetHasLoaded,
|
|
449
453
|
enableConnectOnlyFallback,
|
|
450
454
|
environmentId,
|
|
451
455
|
events,
|
|
@@ -500,6 +504,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
500
504
|
setCallback,
|
|
501
505
|
setDefaultTabIndex,
|
|
502
506
|
setDesktopUri,
|
|
507
|
+
setDynamicWidgetHasLoaded,
|
|
503
508
|
setIsSingleWalletAccount,
|
|
504
509
|
setLegacyIsVerifying,
|
|
505
510
|
setLogInWithEmail,
|
|
@@ -544,10 +549,8 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
544
549
|
accessDeniedMessagePrimary,
|
|
545
550
|
accessDeniedMessageSecondary,
|
|
546
551
|
accountSwitchState,
|
|
547
|
-
handlers,
|
|
548
552
|
appLogoUrl,
|
|
549
553
|
appName,
|
|
550
|
-
defaultTabIndex,
|
|
551
554
|
authMode,
|
|
552
555
|
authorizationViewDisplayOrder,
|
|
553
556
|
awaitingSignatureState,
|
|
@@ -563,9 +566,11 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
563
566
|
customTermsOfServices,
|
|
564
567
|
debugError,
|
|
565
568
|
defaultNumberOfWalletsToShow,
|
|
569
|
+
defaultTabIndex,
|
|
566
570
|
desktopUri,
|
|
567
571
|
disconnectWallet,
|
|
568
572
|
displaySiweStatement,
|
|
573
|
+
dynamicWidgetHasLoaded,
|
|
569
574
|
enableConnectOnlyFallback,
|
|
570
575
|
environmentId,
|
|
571
576
|
events,
|
|
@@ -573,6 +578,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
573
578
|
getNameService,
|
|
574
579
|
handleLogOut,
|
|
575
580
|
handleUnlinkWallet,
|
|
581
|
+
handlers,
|
|
576
582
|
i18nSDKInstance,
|
|
577
583
|
isAuthenticated,
|
|
578
584
|
isBridgeFlow,
|
|
@@ -580,7 +586,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
580
586
|
isSingleWalletAccount,
|
|
581
587
|
legacyIsVerifying,
|
|
582
588
|
user,
|
|
583
|
-
unauthenticatedUser,
|
|
584
589
|
linkedOrConnectedWallets,
|
|
585
590
|
loadingNetwork,
|
|
586
591
|
loginWithEmail,
|
|
@@ -640,6 +645,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
640
645
|
termsOfServiceUrl,
|
|
641
646
|
theme,
|
|
642
647
|
toolkitEnabled,
|
|
648
|
+
unauthenticatedUser,
|
|
643
649
|
walletConnectorOptions,
|
|
644
650
|
walletUiUtils,
|
|
645
651
|
walletsFilter,
|
|
@@ -687,7 +693,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
687
693
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
688
694
|
isBridgeFlow,
|
|
689
695
|
isMultiWalletEnabled: multiWallet,
|
|
690
|
-
}), children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { canSync: didConnectedStateLoad, children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(VerificationContext.VerificationProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithOtpProvider.ConnectWithOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(
|
|
696
|
+
}), children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { canSync: didConnectedStateLoad, children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(VerificationContext.VerificationProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithOtpProvider.ConnectWithOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(SyncAuthFlow.SyncAuthFlow, {}), confirmationModal, jsxRuntime.jsx(ErrorBoundaryExclude.ErrorBoundaryExclude, { children: children })] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
|
|
691
697
|
};
|
|
692
698
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
693
699
|
const DynamicContextProvider = (props) => {
|
|
@@ -83,7 +83,7 @@ import '../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignI
|
|
|
83
83
|
import { WalletGroupContextProvider } from '../WalletGroupContext/WalletGroupContext.js';
|
|
84
84
|
import { IpConfigurationContextProvider } from '../IpConfigurationContext/IpConfigurationContext.js';
|
|
85
85
|
import { PasskeyContextProvider } from '../PasskeyContext/PasskeyContext.js';
|
|
86
|
-
import {
|
|
86
|
+
import { SyncAuthFlow } from '../../components/SyncAuthFlow/SyncAuthFlow.js';
|
|
87
87
|
import { Toolkit } from '../../components/Toolkit/Toolkit.js';
|
|
88
88
|
import { getMissingChains } from '../../utils/functions/getMissingChains/getMissingChains.js';
|
|
89
89
|
import { parseTheme } from '../../utils/functions/parseTheme/parseTheme.js';
|
|
@@ -243,6 +243,9 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
243
243
|
const [requiredWalletsConnected, setRequiredWalletsConnected] = useState(false);
|
|
244
244
|
const isUserAuthenticated = Boolean(authMode === 'connect-and-sign' ? user : requiredWalletsConnected);
|
|
245
245
|
const isRenderingEmbeddedAuthFlow = useRef(false);
|
|
246
|
+
// we need to know when the widget has finished loadingbefore calling the auth flow
|
|
247
|
+
// or it may cause issues with the embedded widget version showing a modal twice
|
|
248
|
+
const [dynamicWidgetHasLoaded, setDynamicWidgetHasLoaded] = useState(false);
|
|
246
249
|
const [showAuthFlow, setShowAuthFlow] = useShowAuthFlow({
|
|
247
250
|
isAuthenticated: isUserAuthenticated,
|
|
248
251
|
isMultiWalletEnabled: multiWallet,
|
|
@@ -442,6 +445,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
442
445
|
desktopUri,
|
|
443
446
|
disconnectWallet,
|
|
444
447
|
displaySiweStatement,
|
|
448
|
+
dynamicWidgetHasLoaded,
|
|
445
449
|
enableConnectOnlyFallback,
|
|
446
450
|
environmentId,
|
|
447
451
|
events,
|
|
@@ -496,6 +500,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
496
500
|
setCallback,
|
|
497
501
|
setDefaultTabIndex,
|
|
498
502
|
setDesktopUri,
|
|
503
|
+
setDynamicWidgetHasLoaded,
|
|
499
504
|
setIsSingleWalletAccount,
|
|
500
505
|
setLegacyIsVerifying,
|
|
501
506
|
setLogInWithEmail,
|
|
@@ -540,10 +545,8 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
540
545
|
accessDeniedMessagePrimary,
|
|
541
546
|
accessDeniedMessageSecondary,
|
|
542
547
|
accountSwitchState,
|
|
543
|
-
handlers,
|
|
544
548
|
appLogoUrl,
|
|
545
549
|
appName,
|
|
546
|
-
defaultTabIndex,
|
|
547
550
|
authMode,
|
|
548
551
|
authorizationViewDisplayOrder,
|
|
549
552
|
awaitingSignatureState,
|
|
@@ -559,9 +562,11 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
559
562
|
customTermsOfServices,
|
|
560
563
|
debugError,
|
|
561
564
|
defaultNumberOfWalletsToShow,
|
|
565
|
+
defaultTabIndex,
|
|
562
566
|
desktopUri,
|
|
563
567
|
disconnectWallet,
|
|
564
568
|
displaySiweStatement,
|
|
569
|
+
dynamicWidgetHasLoaded,
|
|
565
570
|
enableConnectOnlyFallback,
|
|
566
571
|
environmentId,
|
|
567
572
|
events,
|
|
@@ -569,6 +574,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
569
574
|
getNameService,
|
|
570
575
|
handleLogOut,
|
|
571
576
|
handleUnlinkWallet,
|
|
577
|
+
handlers,
|
|
572
578
|
i18nSDKInstance,
|
|
573
579
|
isAuthenticated,
|
|
574
580
|
isBridgeFlow,
|
|
@@ -576,7 +582,6 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
576
582
|
isSingleWalletAccount,
|
|
577
583
|
legacyIsVerifying,
|
|
578
584
|
user,
|
|
579
|
-
unauthenticatedUser,
|
|
580
585
|
linkedOrConnectedWallets,
|
|
581
586
|
loadingNetwork,
|
|
582
587
|
loginWithEmail,
|
|
@@ -636,6 +641,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
636
641
|
termsOfServiceUrl,
|
|
637
642
|
theme,
|
|
638
643
|
toolkitEnabled,
|
|
644
|
+
unauthenticatedUser,
|
|
639
645
|
walletConnectorOptions,
|
|
640
646
|
walletUiUtils,
|
|
641
647
|
walletsFilter,
|
|
@@ -683,7 +689,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
683
689
|
isAuthenticated: isAuthenticated || Boolean(primaryWallet),
|
|
684
690
|
isBridgeFlow,
|
|
685
691
|
isMultiWalletEnabled: multiWallet,
|
|
686
|
-
}), children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { canSync: didConnectedStateLoad, children: jsx(PasskeyContextProvider, { children: jsx(VerificationProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(
|
|
692
|
+
}), children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { canSync: didConnectedStateLoad, children: jsx(PasskeyContextProvider, { children: jsx(VerificationProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(SyncAuthFlow, {}), confirmationModal, jsx(ErrorBoundaryExclude, { children: children })] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
|
|
687
693
|
};
|
|
688
694
|
/** The context provider you need to have access too all of Dynamic's hooks */
|
|
689
695
|
const DynamicContextProvider = (props) => {
|
|
@@ -83,6 +83,8 @@ export interface IDynamicContext {
|
|
|
83
83
|
desktopUri: string;
|
|
84
84
|
disconnectWallet: (walletId: string) => void;
|
|
85
85
|
displaySiweStatement: boolean;
|
|
86
|
+
/** Tracks wether the dynamic widget or embedded widget has rendered */
|
|
87
|
+
dynamicWidgetHasLoaded: boolean;
|
|
86
88
|
enableConnectOnlyFallback?: boolean;
|
|
87
89
|
environmentId: string;
|
|
88
90
|
events?: DynamicEventsCallbacks;
|
|
@@ -143,6 +145,7 @@ export interface IDynamicContext {
|
|
|
143
145
|
setBridgeOnboardingCompleted: (value: boolean | ((val: boolean) => boolean)) => void;
|
|
144
146
|
setCallback: SetCallbackType;
|
|
145
147
|
setDesktopUri: Dispatch<SetStateAction<string>>;
|
|
148
|
+
setDynamicWidgetHasLoaded: Dispatch<SetStateAction<boolean>>;
|
|
146
149
|
setIsSingleWalletAccount: Dispatch<SetStateAction<boolean>>;
|
|
147
150
|
/** Legacy setter for legacyIsVerifying
|
|
148
151
|
* @deprecated Should be removed asap.
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
require('@dynamic-labs/sdk-api-core');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
9
|
require('../../../shared/logger.cjs');
|
|
10
10
|
require('@dynamic-labs/iconic');
|
|
11
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -13,9 +13,10 @@ require('react/jsx-runtime');
|
|
|
13
13
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
require('react');
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
16
|
+
var localStorage$1 = require('../../../utils/constants/localStorage.cjs');
|
|
16
17
|
require('../../../utils/constants/colors.cjs');
|
|
17
18
|
require('../../../utils/constants/values.cjs');
|
|
18
|
-
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
var localStorage = require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
20
|
require('../../../shared/consts/index.cjs');
|
|
20
21
|
require('../../../config/ApiEndpoint.cjs');
|
|
21
22
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -93,7 +94,9 @@ const useProjectSettings = ({ environmentId, retries = 2, }) => {
|
|
|
93
94
|
deps: [environmentId],
|
|
94
95
|
enabled: !lsSettingsExists,
|
|
95
96
|
onResolve: (projectSettings) => {
|
|
97
|
+
var _a, _b;
|
|
96
98
|
const expiry = new Date().getTime() + 60000 * 5;
|
|
99
|
+
localStorage.LocalStorage.setToLS(localStorage$1.COOKIE_ENABLED_KEY, ((_b = (_a = projectSettings.security.auth) === null || _a === void 0 ? void 0 : _a.storage) !== null && _b !== void 0 ? _b : []).includes(sdkApiCore.AuthStorageEnum.Cookie));
|
|
97
100
|
projectSettingsActions.setProjectSettings({
|
|
98
101
|
expiresAt: expiry,
|
|
99
102
|
settings: projectSettings,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
-
import '@dynamic-labs/sdk-api-core';
|
|
4
|
+
import { AuthStorageEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import '../../../shared/logger.js';
|
|
6
6
|
import '@dynamic-labs/iconic';
|
|
7
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -9,9 +9,10 @@ import 'react/jsx-runtime';
|
|
|
9
9
|
import '../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import 'react';
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
|
+
import { COOKIE_ENABLED_KEY } from '../../../utils/constants/localStorage.js';
|
|
12
13
|
import '../../../utils/constants/colors.js';
|
|
13
14
|
import '../../../utils/constants/values.js';
|
|
14
|
-
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import { LocalStorage } from '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
16
|
import '../../../shared/consts/index.js';
|
|
16
17
|
import '../../../config/ApiEndpoint.js';
|
|
17
18
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -89,7 +90,9 @@ const useProjectSettings = ({ environmentId, retries = 2, }) => {
|
|
|
89
90
|
deps: [environmentId],
|
|
90
91
|
enabled: !lsSettingsExists,
|
|
91
92
|
onResolve: (projectSettings) => {
|
|
93
|
+
var _a, _b;
|
|
92
94
|
const expiry = new Date().getTime() + 60000 * 5;
|
|
95
|
+
LocalStorage.setToLS(COOKIE_ENABLED_KEY, ((_b = (_a = projectSettings.security.auth) === null || _a === void 0 ? void 0 : _a.storage) !== null && _b !== void 0 ? _b : []).includes(AuthStorageEnum.Cookie));
|
|
93
96
|
setProjectSettings({
|
|
94
97
|
expiresAt: expiry,
|
|
95
98
|
settings: projectSettings,
|