@aurora-is-near/intents-swap-widget 3.14.0-redesign.2 → 3.14.0-redesign.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/dist/components/BlockingError.js +15 -9
- package/dist/components/BlockingError.js.map +1 -1
- package/dist/components/CloseButton.js +1 -1
- package/dist/components/CloseButton.js.map +1 -1
- package/dist/{config-Bmc4hOIl.js → config-Behl5hcc.js} +1179 -952
- package/dist/config-Behl5hcc.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -6
- package/dist/config.js.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +26 -29
- package/dist/features/DepositMethodSwitcher.js.map +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +27 -28
- package/dist/features/ExternalDeposit.js.map +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/SummaryItem.js +2 -2
- package/dist/features/SuccessScreen/SummaryItem.js.map +1 -1
- package/dist/features/SuccessScreen/index.js +20 -20
- package/dist/features/SuccessScreen/index.js.map +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +13 -191
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js.map +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +21 -26
- package/dist/features/WalletCompatibilityCheck/index.js.map +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.d.ts +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +2 -2
- package/dist/hooks/useIsCompatibilityCheckRequired.js.map +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useToggleTheme.js +20 -17
- package/dist/hooks/useToggleTheme.js.map +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/index.js +1 -1
- package/dist/machine/computed/getIsDirectNearTokenWithdrawal.js +1 -1
- package/dist/machine/computed/getIsDirectNearTokenWithdrawal.js.map +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearDeposit.js +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearDeposit.js.map +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearTransfer.js +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearTransfer.js.map +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/ThemeProvider.js +7 -24
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/localisation.d.ts +1 -1
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/localstorage.js +41 -28
- package/dist/utils/localstorage.js.map +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +11 -12
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +27 -26
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +5 -6
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +3 -2
- package/src/components/BlockingError.tsx +7 -4
- package/src/components/CloseButton.tsx +1 -1
- package/src/features/DepositMethodSwitcher.tsx +5 -17
- package/src/features/ExternalDeposit.tsx +8 -7
- package/src/features/SubmitButton/index.tsx +40 -0
- package/src/features/SuccessScreen/SummaryItem.tsx +2 -2
- package/src/features/SuccessScreen/index.tsx +5 -3
- package/src/features/SwapQuote/SwapQuote.tsx +1 -1
- package/src/features/WalletCompatibilityCheck/WalletCompatibilityModal.tsx +3 -0
- package/src/features/WalletCompatibilityCheck/index.tsx +4 -8
- package/src/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.ts +2 -1
- package/src/hooks/useIsCompatibilityCheckRequired.ts +1 -1
- package/src/hooks/useToggleTheme.ts +11 -4
- package/src/machine/computed/getIsDirectNearTokenWithdrawal.ts +2 -1
- package/src/machine/computed/getIsDirectTokenOnNearDeposit.ts +2 -1
- package/src/machine/computed/getIsDirectTokenOnNearTransfer.ts +2 -1
- package/src/theme/ThemeProvider.tsx +33 -14
- package/src/types/config.ts +1 -0
- package/src/types/localisation.ts +4 -0
- package/src/utils/localstorage.ts +35 -10
- package/src/widgets/WidgetDeposit/WidgetDepositContent.tsx +3 -3
- package/src/widgets/WidgetSwap/WidgetSwapContent.tsx +5 -3
- package/src/widgets/WidgetWithdraw/WidgetWithdrawContent.tsx +3 -3
- package/dist/config-Bmc4hOIl.js.map +0 -1
- package/dist/features/SuccessScreen/CloseButton.d.ts +0 -5
- package/dist/features/SuccessScreen/CloseButton.js +0 -15
- package/dist/features/SuccessScreen/CloseButton.js.map +0 -1
- package/src/features/SuccessScreen/CloseButton.tsx +0 -14
|
@@ -14,11 +14,14 @@ const defaultValues: LocalStorage = {
|
|
|
14
14
|
|
|
15
15
|
const isBrowser = typeof window !== 'undefined' && !!window.localStorage;
|
|
16
16
|
|
|
17
|
+
const KEY_PREFIX = 'sw';
|
|
18
|
+
const getStorageKey = (key: string) => `${KEY_PREFIX}.${key}`;
|
|
19
|
+
|
|
17
20
|
const getItem = <T extends keyof LocalStorage>(key: T): LocalStorage[T] => {
|
|
18
21
|
if (!isBrowser) {
|
|
19
22
|
if (process.env.NODE_ENV === 'development') {
|
|
20
23
|
logger.debug(
|
|
21
|
-
`[WIDGET] Attempted to read ${key} on server; returning default`,
|
|
24
|
+
`[WIDGET] Attempted to read ${getStorageKey(key)} from localstorage on server; returning default`,
|
|
22
25
|
);
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -26,13 +29,25 @@ const getItem = <T extends keyof LocalStorage>(key: T): LocalStorage[T] => {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
try {
|
|
32
|
+
const storedValueLegacy = window.localStorage.getItem(key);
|
|
33
|
+
let storedValue = window.localStorage.getItem(getStorageKey(key));
|
|
34
|
+
|
|
35
|
+
// Migrate legacy key to new namespaced key
|
|
36
|
+
if (storedValueLegacy && !storedValue) {
|
|
37
|
+
storedValue = storedValueLegacy;
|
|
38
|
+
window.localStorage.setItem(getStorageKey(key), storedValueLegacy);
|
|
39
|
+
window.localStorage.removeItem(key);
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
return (
|
|
30
43
|
// @ts-expect-error It's ok to pass null to JSON.parse
|
|
31
|
-
(JSON.parse(
|
|
32
|
-
defaultValues[key]
|
|
44
|
+
(JSON.parse(storedValue) as LocalStorage[T]) ?? defaultValues[key]
|
|
33
45
|
);
|
|
34
46
|
} catch (error) {
|
|
35
|
-
logger.warn(
|
|
47
|
+
logger.warn(
|
|
48
|
+
`[WIDGET] Failed to parse ${getStorageKey(key)} from localStorage:`,
|
|
49
|
+
error,
|
|
50
|
+
);
|
|
36
51
|
|
|
37
52
|
return defaultValues[key];
|
|
38
53
|
}
|
|
@@ -44,7 +59,9 @@ const setItem = <T extends keyof LocalStorage>(
|
|
|
44
59
|
) => {
|
|
45
60
|
if (!isBrowser) {
|
|
46
61
|
if (process.env.NODE_ENV === 'development') {
|
|
47
|
-
logger.debug(
|
|
62
|
+
logger.debug(
|
|
63
|
+
`[WIDGET] Attempted to set ${getStorageKey(key)} on server; skipping`,
|
|
64
|
+
);
|
|
48
65
|
}
|
|
49
66
|
|
|
50
67
|
return;
|
|
@@ -58,25 +75,33 @@ const setItem = <T extends keyof LocalStorage>(
|
|
|
58
75
|
? String(value)
|
|
59
76
|
: JSON.stringify(value);
|
|
60
77
|
|
|
61
|
-
window.localStorage.setItem(key, serialized);
|
|
78
|
+
window.localStorage.setItem(getStorageKey(key), serialized);
|
|
62
79
|
} catch (error) {
|
|
63
|
-
logger.warn(
|
|
80
|
+
logger.warn(
|
|
81
|
+
`[WIDGET] Failed to set ${getStorageKey(key)} in localStorage:`,
|
|
82
|
+
error,
|
|
83
|
+
);
|
|
64
84
|
}
|
|
65
85
|
};
|
|
66
86
|
|
|
67
87
|
const removeItem = (key: keyof LocalStorage) => {
|
|
68
88
|
if (!isBrowser) {
|
|
69
89
|
if (process.env.NODE_ENV === 'development') {
|
|
70
|
-
logger.debug(
|
|
90
|
+
logger.debug(
|
|
91
|
+
`[WIDGET] Attempted to remove ${getStorageKey(key)} from localstorage on server; skipping`,
|
|
92
|
+
);
|
|
71
93
|
}
|
|
72
94
|
|
|
73
95
|
return;
|
|
74
96
|
}
|
|
75
97
|
|
|
76
98
|
try {
|
|
77
|
-
window.localStorage.removeItem(key);
|
|
99
|
+
window.localStorage.removeItem(getStorageKey(key));
|
|
78
100
|
} catch (error) {
|
|
79
|
-
logger.warn(
|
|
101
|
+
logger.warn(
|
|
102
|
+
`[WIDGET] Failed to remove ${getStorageKey(key)} from localStorage:`,
|
|
103
|
+
error,
|
|
104
|
+
);
|
|
80
105
|
}
|
|
81
106
|
};
|
|
82
107
|
|
|
@@ -62,11 +62,11 @@ export const WidgetDepositContent = ({
|
|
|
62
62
|
const { tokenModalOpen, updateTokenModalState } = useTokenModal({ onMsg });
|
|
63
63
|
|
|
64
64
|
const isCompatibilityCheckRequired = useIsCompatibilityCheckRequired();
|
|
65
|
-
const [isCompatibilityOpen, setIsCompatibilityOpen] = useState(
|
|
65
|
+
const [isCompatibilityOpen, setIsCompatibilityOpen] = useState(false);
|
|
66
66
|
|
|
67
67
|
useEffect(() => {
|
|
68
|
-
if (
|
|
69
|
-
setIsCompatibilityOpen(
|
|
68
|
+
if (isCompatibilityCheckRequired) {
|
|
69
|
+
setIsCompatibilityOpen(true);
|
|
70
70
|
}
|
|
71
71
|
}, [isCompatibilityCheckRequired]);
|
|
72
72
|
|
|
@@ -65,11 +65,13 @@ export const WidgetSwapContent = ({
|
|
|
65
65
|
useTokenInputPair();
|
|
66
66
|
|
|
67
67
|
const isCompatibilityCheckRequired = useIsCompatibilityCheckRequired();
|
|
68
|
-
const [isCompatibilityOpen, setIsCompatibilityOpen] = useState(
|
|
68
|
+
const [isCompatibilityOpen, setIsCompatibilityOpen] = useState(
|
|
69
|
+
isCompatibilityCheckRequired,
|
|
70
|
+
);
|
|
69
71
|
|
|
70
72
|
useEffect(() => {
|
|
71
|
-
if (
|
|
72
|
-
setIsCompatibilityOpen(
|
|
73
|
+
if (isCompatibilityCheckRequired) {
|
|
74
|
+
setIsCompatibilityOpen(isCompatibilityCheckRequired);
|
|
73
75
|
}
|
|
74
76
|
}, [isCompatibilityCheckRequired]);
|
|
75
77
|
|
|
@@ -61,11 +61,11 @@ export const WidgetWithdrawContent = ({
|
|
|
61
61
|
useTokenInputPair();
|
|
62
62
|
|
|
63
63
|
const isCompatibilityCheckRequired = useIsCompatibilityCheckRequired();
|
|
64
|
-
const [isCompatibilityOpen, setIsCompatibilityOpen] = useState(
|
|
64
|
+
const [isCompatibilityOpen, setIsCompatibilityOpen] = useState(false);
|
|
65
65
|
|
|
66
66
|
useEffect(() => {
|
|
67
|
-
if (
|
|
68
|
-
setIsCompatibilityOpen(
|
|
67
|
+
if (isCompatibilityCheckRequired) {
|
|
68
|
+
setIsCompatibilityOpen(true);
|
|
69
69
|
}
|
|
70
70
|
}, [isCompatibilityCheckRequired]);
|
|
71
71
|
|