@dynamic-labs/sdk-react-core 4.18.6 → 4.18.8
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 +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/components/Button/Button.d.ts +1 -1
- package/src/lib/components/ModalHeader/ModalHeader.cjs +2 -1
- package/src/lib/components/ModalHeader/ModalHeader.js +2 -1
- package/src/lib/components/ModalHeader/ModalHeader.types.d.ts +3 -1
- package/src/lib/components/TypographyButton/TypographyButton.cjs +2 -0
- package/src/lib/components/TypographyButton/TypographyButton.js +2 -0
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +7 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +8 -2
- package/src/lib/context/UserWalletsContext/UserWalletsContext.cjs +26 -3
- package/src/lib/context/UserWalletsContext/UserWalletsContext.js +27 -4
- package/src/lib/locale/en/translation.cjs +92 -0
- package/src/lib/locale/en/translation.d.ts +92 -0
- package/src/lib/locale/en/translation.js +92 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/assets/session.cjs +54 -0
- package/src/lib/shared/assets/session.js +30 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/isZKSyncEnabled/index.d.ts +1 -0
- package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.cjs +11 -0
- package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.d.ts +2 -0
- package/src/lib/utils/functions/isZKSyncEnabled/isZKSyncEnabled.js +7 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.cjs +92 -4
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAllowClose/useAllowClose.js +92 -4
- package/src/lib/utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs +3 -90
- package/src/lib/utils/hooks/useSubdomainCheck/useSubdomainCheck.js +3 -90
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.cjs +1 -3
- package/src/lib/views/UserDeleteAccountView/UserDeleteAccountView.js +1 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +6 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +3 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +6 -0
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +3 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.cjs +5 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/AccountAndSecuritySettingsView.js +6 -2
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.cjs +15 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/EmptySessionsView.js +11 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/EmptySessionsView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.cjs +37 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.js +33 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.cjs +30 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.d.ts +10 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/SessionListItem.js +26 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionListItem/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.cjs +28 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/SessionManagementInfoView.js +24 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementInfoView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.cjs +56 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/SessionManagementView.js +52 -0
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +5 -1
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +5 -1
- package/src/lib/widgets/DynamicWidget/views/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.18.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.7...v4.18.8) (2025-05-22)
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* allow closing widget right after login ([#8760](https://github.com/dynamic-labs/dynamic-auth/issues/8760)) ([a9afff0](https://github.com/dynamic-labs/dynamic-auth/commit/a9afff0ab2a685853b39aed88e10bf1e700e4c8c))
|
|
7
|
+
* user wallets turning empty when linking new wallets ([#8775](https://github.com/dynamic-labs/dynamic-auth/issues/8775)) ([04215f5](https://github.com/dynamic-labs/dynamic-auth/commit/04215f5307e16ec4e1a7ff235a0d7df2340c3447))
|
|
8
|
+
|
|
9
|
+
### [4.18.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.6...v4.18.7) (2025-05-21)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add zero dev kernel migration to v3.3 ([#8747](https://github.com/dynamic-labs/dynamic-auth/issues/8747)) ([ce10ef8](https://github.com/dynamic-labs/dynamic-auth/commit/ce10ef85d12452c2c21758c909f1e28f9fa5fbae))
|
|
15
|
+
* bump [@dynamic-labs-wallet](https://github.com/dynamic-labs-wallet) to v0.0.74 ([#8746](https://github.com/dynamic-labs/dynamic-auth/issues/8746)) ([98e3a0b](https://github.com/dynamic-labs/dynamic-auth/commit/98e3a0b845e7d6c34a2c748597198825713f4bcf))
|
|
16
|
+
* support kernel versio 0.3.2 and 0.3.3 ([#8738](https://github.com/dynamic-labs/dynamic-auth/issues/8738)) ([1115830](https://github.com/dynamic-labs/dynamic-auth/commit/1115830966318960d39a497c8b29188d9d9a447f))
|
|
17
|
+
* v3 solana confirmation ui ([#8731](https://github.com/dynamic-labs/dynamic-auth/issues/8731)) ([cfa5ba0](https://github.com/dynamic-labs/dynamic-auth/commit/cfa5ba07a946b847e60388c80afbd8aa233e9ebf))
|
|
18
|
+
* v3 svm send balance ([#8726](https://github.com/dynamic-labs/dynamic-auth/issues/8726)) ([236ec48](https://github.com/dynamic-labs/dynamic-auth/commit/236ec4843152f4b720aa7332e650db68c2d111b2))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **alex/qntm-3201:** send empty data field when using zksync sendbalance ([#8733](https://github.com/dynamic-labs/dynamic-auth/issues/8733)) ([4c42035](https://github.com/dynamic-labs/dynamic-auth/commit/4c420350cf7404ac80db8b552594233a3de9fb57))
|
|
24
|
+
* allow for continuing signing if zksync account exists while attempting to deploy ([#8736](https://github.com/dynamic-labs/dynamic-auth/issues/8736)) ([1ff82e4](https://github.com/dynamic-labs/dynamic-auth/commit/1ff82e418e14300b9dec662fba517c5533c1caac))
|
|
25
|
+
* api kernel version on react native extension ([#8754](https://github.com/dynamic-labs/dynamic-auth/issues/8754)) ([c2f0bb4](https://github.com/dynamic-labs/dynamic-auth/commit/c2f0bb4ac86214f4e3bbdac5cf4b481a7a304449))
|
|
26
|
+
* CTRL wallet eip6963 detection ([#8727](https://github.com/dynamic-labs/dynamic-auth/issues/8727)) ([194334f](https://github.com/dynamic-labs/dynamic-auth/commit/194334f7fd541917d9a7f6b452145a47cf7ae853))
|
|
27
|
+
* **QNTM-3249:** fix mobile layout alignment in send view ([#8740](https://github.com/dynamic-labs/dynamic-auth/issues/8740)) ([7d8e02c](https://github.com/dynamic-labs/dynamic-auth/commit/7d8e02c11830f547b6fcfbc7b518ee3f045df41a))
|
|
28
|
+
|
|
2
29
|
### [4.18.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.18.5...v4.18.6) (2025-05-16)
|
|
3
30
|
|
|
4
31
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.18.
|
|
6
|
+
var version = "4.18.8";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.672",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
11
11
|
"country-list": "2.3.0",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.18.
|
|
2
|
+
var version = "4.18.8";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.672",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
7
7
|
"country-list": "2.3.0",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.8",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
5
|
+
"@dynamic-labs/sdk-api-core": "0.0.672",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
7
7
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
8
8
|
"country-list": "2.3.0",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
16
|
"bs58": "5.0.0",
|
|
17
|
-
"@dynamic-labs/assert-package-version": "4.18.
|
|
18
|
-
"@dynamic-labs/iconic": "4.18.
|
|
19
|
-
"@dynamic-labs/logger": "4.18.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "4.18.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "4.18.
|
|
22
|
-
"@dynamic-labs/store": "4.18.
|
|
23
|
-
"@dynamic-labs/types": "4.18.
|
|
24
|
-
"@dynamic-labs/utils": "4.18.
|
|
25
|
-
"@dynamic-labs/wallet-book": "4.18.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "4.18.
|
|
17
|
+
"@dynamic-labs/assert-package-version": "4.18.8",
|
|
18
|
+
"@dynamic-labs/iconic": "4.18.8",
|
|
19
|
+
"@dynamic-labs/logger": "4.18.8",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "4.18.8",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "4.18.8",
|
|
22
|
+
"@dynamic-labs/store": "4.18.8",
|
|
23
|
+
"@dynamic-labs/types": "4.18.8",
|
|
24
|
+
"@dynamic-labs/utils": "4.18.8",
|
|
25
|
+
"@dynamic-labs/wallet-book": "4.18.8",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "4.18.8",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC, MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
import { BaseButtonProps } from '../BaseButton';
|
|
3
|
-
type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'brand-primary' | 'card';
|
|
3
|
+
type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'brand-primary' | 'card' | 'danger';
|
|
4
4
|
type ButtonPadding = 'small' | 'medium' | 'large' | 'none' | 'default' | 'login-screen-height';
|
|
5
5
|
export declare const defaultButtonVariant: ButtonVariant;
|
|
6
6
|
export type ButtonProps = BaseButtonProps & {
|
|
@@ -8,7 +8,7 @@ var React = require('react');
|
|
|
8
8
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
9
9
|
var isGlobalWalletPopup = require('../../shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.cjs');
|
|
10
10
|
|
|
11
|
-
const ModalHeader = ({ alignContent, children, leading, displayLeading = true, trailing, displayTrailing = true, style, displayBorder, description, }) => {
|
|
11
|
+
const ModalHeader = ({ alignContent, children, leading, displayLeading = true, trailing, displayTrailing = true, style, displayBorder, description, variant = 'default', }) => {
|
|
12
12
|
const hasLeading = displayLeading && leading && React.Children.count(leading);
|
|
13
13
|
const hasTrailing = displayTrailing && trailing && React.Children.count(trailing);
|
|
14
14
|
const trailingClassName = classNames.classNames('modal-header__content__trailing', {
|
|
@@ -17,6 +17,7 @@ const ModalHeader = ({ alignContent, children, leading, displayLeading = true, t
|
|
|
17
17
|
return (jsxRuntime.jsxs("div", { className: classNames.classNames('modal-header', {
|
|
18
18
|
'modal-header--border': displayBorder,
|
|
19
19
|
'modal-header--empty': !hasLeading && !children && !hasTrailing,
|
|
20
|
+
'modal-header--filled': variant === 'filled',
|
|
20
21
|
}), style: style, children: [jsxRuntime.jsxs("div", { className: classNames.classNames('modal-header__content', alignContent &&
|
|
21
22
|
`modal-header__content--align-content-${alignContent}`), children: [displayLeading && (jsxRuntime.jsx("div", { className: classNames.classNames('modal-header__content__leading', {
|
|
22
23
|
'modal-header__content__leading--empty': !hasLeading,
|
|
@@ -4,7 +4,7 @@ import { Children } from 'react';
|
|
|
4
4
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
5
5
|
import { isGlobalWalletPopup } from '../../shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.js';
|
|
6
6
|
|
|
7
|
-
const ModalHeader = ({ alignContent, children, leading, displayLeading = true, trailing, displayTrailing = true, style, displayBorder, description, }) => {
|
|
7
|
+
const ModalHeader = ({ alignContent, children, leading, displayLeading = true, trailing, displayTrailing = true, style, displayBorder, description, variant = 'default', }) => {
|
|
8
8
|
const hasLeading = displayLeading && leading && Children.count(leading);
|
|
9
9
|
const hasTrailing = displayTrailing && trailing && Children.count(trailing);
|
|
10
10
|
const trailingClassName = classNames('modal-header__content__trailing', {
|
|
@@ -13,6 +13,7 @@ const ModalHeader = ({ alignContent, children, leading, displayLeading = true, t
|
|
|
13
13
|
return (jsxs("div", { className: classNames('modal-header', {
|
|
14
14
|
'modal-header--border': displayBorder,
|
|
15
15
|
'modal-header--empty': !hasLeading && !children && !hasTrailing,
|
|
16
|
+
'modal-header--filled': variant === 'filled',
|
|
16
17
|
}), style: style, children: [jsxs("div", { className: classNames('modal-header__content', alignContent &&
|
|
17
18
|
`modal-header__content--align-content-${alignContent}`), children: [displayLeading && (jsx("div", { className: classNames('modal-header__content__leading', {
|
|
18
19
|
'modal-header__content__leading--empty': !hasLeading,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
2
|
+
export type ModalHeaderVariant = 'default' | 'filled';
|
|
2
3
|
export type ModalHeaderProps = {
|
|
3
4
|
alignContent?: 'bottom';
|
|
4
5
|
children?: ReactNode;
|
|
5
|
-
leading?:
|
|
6
|
+
leading?: ReactNode;
|
|
6
7
|
displayLeading?: boolean;
|
|
7
8
|
positionAbsolute?: boolean;
|
|
8
9
|
trailing?: ReactNode;
|
|
@@ -10,5 +11,6 @@ export type ModalHeaderProps = {
|
|
|
10
11
|
style?: CSSProperties;
|
|
11
12
|
displayBorder?: boolean;
|
|
12
13
|
description?: ReactNode;
|
|
14
|
+
variant?: ModalHeaderVariant;
|
|
13
15
|
};
|
|
14
16
|
export type ModalHeaderComponent = (props: ModalHeaderProps) => ReactElement;
|
|
@@ -12,6 +12,7 @@ var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
|
12
12
|
const defaultTypographyVariantMap = {
|
|
13
13
|
'brand-primary': 'button_primary',
|
|
14
14
|
card: 'body_normal',
|
|
15
|
+
danger: 'button_primary',
|
|
15
16
|
primary: 'button_primary',
|
|
16
17
|
secondary: 'button_secondary',
|
|
17
18
|
tertiary: 'button_tertiary',
|
|
@@ -19,6 +20,7 @@ const defaultTypographyVariantMap = {
|
|
|
19
20
|
const defaultTypographyColorMap = {
|
|
20
21
|
'brand-primary': 'primary',
|
|
21
22
|
card: 'primary',
|
|
23
|
+
danger: 'white',
|
|
22
24
|
primary: 'primary',
|
|
23
25
|
secondary: 'primary',
|
|
24
26
|
tertiary: 'secondary',
|
|
@@ -8,6 +8,7 @@ import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
|
8
8
|
const defaultTypographyVariantMap = {
|
|
9
9
|
'brand-primary': 'button_primary',
|
|
10
10
|
card: 'body_normal',
|
|
11
|
+
danger: 'button_primary',
|
|
11
12
|
primary: 'button_primary',
|
|
12
13
|
secondary: 'button_secondary',
|
|
13
14
|
tertiary: 'button_tertiary',
|
|
@@ -15,6 +16,7 @@ const defaultTypographyVariantMap = {
|
|
|
15
16
|
const defaultTypographyColorMap = {
|
|
16
17
|
'brand-primary': 'primary',
|
|
17
18
|
card: 'primary',
|
|
19
|
+
danger: 'white',
|
|
18
20
|
primary: 'primary',
|
|
19
21
|
secondary: 'primary',
|
|
20
22
|
tertiary: 'secondary',
|
|
@@ -26,6 +26,12 @@ const useDynamicContext = () => {
|
|
|
26
26
|
});
|
|
27
27
|
}, [setShowAuthFlow]);
|
|
28
28
|
const { initialWalletVerificationInProgress } = loadingAndLifecycle.useLoadingAndLifecycle();
|
|
29
|
+
// This ref ensures we don't return a value for primary wallet until useConnectAndSign has completely finished running
|
|
30
|
+
// Read UserWalletsContext.tsx explanation for more context
|
|
31
|
+
const verifiedPrimaryWallet = React.useRef(null);
|
|
32
|
+
if (!initialWalletVerificationInProgress || !primaryWallet) {
|
|
33
|
+
verifiedPrimaryWallet.current = primaryWallet;
|
|
34
|
+
}
|
|
29
35
|
return {
|
|
30
36
|
accountSwitchState,
|
|
31
37
|
authMode,
|
|
@@ -41,7 +47,7 @@ const useDynamicContext = () => {
|
|
|
41
47
|
multiWalletWidgetState,
|
|
42
48
|
network,
|
|
43
49
|
networkConfigurations,
|
|
44
|
-
primaryWallet:
|
|
50
|
+
primaryWallet: verifiedPrimaryWallet.current,
|
|
45
51
|
qrcodeUri,
|
|
46
52
|
refetchProjectSettings,
|
|
47
53
|
removeWallet,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { useContext, useCallback } from 'react';
|
|
2
|
+
import { useContext, useCallback, useRef } from 'react';
|
|
3
3
|
import { DynamicContext } from '../DynamicContext.js';
|
|
4
4
|
import { useLoadingAndLifecycle } from '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
5
5
|
import { useOverrides } from './useOverrides/useOverrides.js';
|
|
@@ -22,6 +22,12 @@ const useDynamicContext = () => {
|
|
|
22
22
|
});
|
|
23
23
|
}, [setShowAuthFlow]);
|
|
24
24
|
const { initialWalletVerificationInProgress } = useLoadingAndLifecycle();
|
|
25
|
+
// This ref ensures we don't return a value for primary wallet until useConnectAndSign has completely finished running
|
|
26
|
+
// Read UserWalletsContext.tsx explanation for more context
|
|
27
|
+
const verifiedPrimaryWallet = useRef(null);
|
|
28
|
+
if (!initialWalletVerificationInProgress || !primaryWallet) {
|
|
29
|
+
verifiedPrimaryWallet.current = primaryWallet;
|
|
30
|
+
}
|
|
25
31
|
return {
|
|
26
32
|
accountSwitchState,
|
|
27
33
|
authMode,
|
|
@@ -37,7 +43,7 @@ const useDynamicContext = () => {
|
|
|
37
43
|
multiWalletWidgetState,
|
|
38
44
|
network,
|
|
39
45
|
networkConfigurations,
|
|
40
|
-
primaryWallet:
|
|
46
|
+
primaryWallet: verifiedPrimaryWallet.current,
|
|
41
47
|
qrcodeUri,
|
|
42
48
|
refetchProjectSettings,
|
|
43
49
|
removeWallet,
|
|
@@ -65,13 +65,36 @@ const useInternalUserWallets = () => {
|
|
|
65
65
|
};
|
|
66
66
|
/** Provides access to the current user/session wallets */
|
|
67
67
|
const useUserWallets = () => {
|
|
68
|
+
var _a;
|
|
68
69
|
const context = React.useContext(UserWalletsContext);
|
|
70
|
+
// EXPLANATION:
|
|
71
|
+
//
|
|
72
|
+
// The problem:
|
|
73
|
+
// When we call useConnectAndSign, the wallet that is then added remains in an incomplete state until
|
|
74
|
+
// all tasks initiated by useConnectAndSign have completely finished running.
|
|
75
|
+
// If, say, a customer calls switchNetwork() on it in this meantime, the SDK will enter a broken state.
|
|
76
|
+
// Can be checked by attempting signMessage with wagmi after entering this broken state.
|
|
77
|
+
//
|
|
78
|
+
// The Solution:
|
|
79
|
+
// In order to prevent customers from accessing these wallets while they are incomplete,
|
|
80
|
+
// we return the old value of userWallets until useConnectAndSign has completely finished running.
|
|
81
|
+
//
|
|
82
|
+
// This is done by setting this "initialWalletVerificationInProgress" flag to true while it runs,
|
|
83
|
+
// and storing the previous value of userWallets in verifiedUserWallets.
|
|
84
|
+
// We then return this ref instead of the current userWallets.
|
|
85
|
+
//
|
|
86
|
+
// This ref is only updated when initialWalletVerificationInProgress is false, i.e. when
|
|
87
|
+
// there is no wallet being added at the moment.
|
|
88
|
+
//
|
|
89
|
+
// FYI this same logic is used in useDynamicContext for primaryWallet
|
|
90
|
+
const verifiedUserWallets = React.useRef([]);
|
|
69
91
|
const { initialWalletVerificationInProgress } = loadingAndLifecycle.useLoadingAndLifecycle();
|
|
70
92
|
if (!context)
|
|
71
93
|
throw new Error('Can only call useUserWallets inside UserWalletsProvider');
|
|
72
|
-
if (initialWalletVerificationInProgress)
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
if (!initialWalletVerificationInProgress) {
|
|
95
|
+
verifiedUserWallets.current = (_a = context === null || context === void 0 ? void 0 : context.userWallets) !== null && _a !== void 0 ? _a : [];
|
|
96
|
+
}
|
|
97
|
+
return verifiedUserWallets.current;
|
|
75
98
|
};
|
|
76
99
|
|
|
77
100
|
exports.UserWalletsContext = UserWalletsContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useContext,
|
|
3
|
+
import { createContext, useContext, useRef, useState, useCallback, useEffect } from 'react';
|
|
4
4
|
import { dynamicEvents } from '../../events/dynamicEvents.js';
|
|
5
5
|
import { useLoadingAndLifecycle } from '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
6
6
|
|
|
@@ -61,13 +61,36 @@ const useInternalUserWallets = () => {
|
|
|
61
61
|
};
|
|
62
62
|
/** Provides access to the current user/session wallets */
|
|
63
63
|
const useUserWallets = () => {
|
|
64
|
+
var _a;
|
|
64
65
|
const context = useContext(UserWalletsContext);
|
|
66
|
+
// EXPLANATION:
|
|
67
|
+
//
|
|
68
|
+
// The problem:
|
|
69
|
+
// When we call useConnectAndSign, the wallet that is then added remains in an incomplete state until
|
|
70
|
+
// all tasks initiated by useConnectAndSign have completely finished running.
|
|
71
|
+
// If, say, a customer calls switchNetwork() on it in this meantime, the SDK will enter a broken state.
|
|
72
|
+
// Can be checked by attempting signMessage with wagmi after entering this broken state.
|
|
73
|
+
//
|
|
74
|
+
// The Solution:
|
|
75
|
+
// In order to prevent customers from accessing these wallets while they are incomplete,
|
|
76
|
+
// we return the old value of userWallets until useConnectAndSign has completely finished running.
|
|
77
|
+
//
|
|
78
|
+
// This is done by setting this "initialWalletVerificationInProgress" flag to true while it runs,
|
|
79
|
+
// and storing the previous value of userWallets in verifiedUserWallets.
|
|
80
|
+
// We then return this ref instead of the current userWallets.
|
|
81
|
+
//
|
|
82
|
+
// This ref is only updated when initialWalletVerificationInProgress is false, i.e. when
|
|
83
|
+
// there is no wallet being added at the moment.
|
|
84
|
+
//
|
|
85
|
+
// FYI this same logic is used in useDynamicContext for primaryWallet
|
|
86
|
+
const verifiedUserWallets = useRef([]);
|
|
65
87
|
const { initialWalletVerificationInProgress } = useLoadingAndLifecycle();
|
|
66
88
|
if (!context)
|
|
67
89
|
throw new Error('Can only call useUserWallets inside UserWalletsProvider');
|
|
68
|
-
if (initialWalletVerificationInProgress)
|
|
69
|
-
|
|
70
|
-
|
|
90
|
+
if (!initialWalletVerificationInProgress) {
|
|
91
|
+
verifiedUserWallets.current = (_a = context === null || context === void 0 ? void 0 : context.userWallets) !== null && _a !== void 0 ? _a : [];
|
|
92
|
+
}
|
|
93
|
+
return verifiedUserWallets.current;
|
|
71
94
|
};
|
|
72
95
|
|
|
73
96
|
export { UserWalletsContext, UserWalletsProvider, useInternalUserWallets, useUserWallets };
|
|
@@ -960,6 +960,24 @@ const translation = {
|
|
|
960
960
|
empty_screen: {
|
|
961
961
|
title: 'Nothing to see here yet!',
|
|
962
962
|
},
|
|
963
|
+
delete_account: {
|
|
964
|
+
title: 'Delete My Account',
|
|
965
|
+
description:
|
|
966
|
+
'Deleting your account will permanently remove all data, including wallet details and linked smart contract wallets. This action cannot be undone.',
|
|
967
|
+
backup_confirmation_embedded:
|
|
968
|
+
"I confirm I've backed up my wallet keys. If I proceed, a new wallet will be created. Any wallets or assets not backed up will be lost permanently.",
|
|
969
|
+
backup_confirmation_no_embedded:
|
|
970
|
+
'I confirm that all of my information will be deleted. If I return, a new user profile will be created. These changes cannot be undone.',
|
|
971
|
+
type_delete: 'Enter DELETE in the box below to confirm this action.',
|
|
972
|
+
cancel: 'Cancel',
|
|
973
|
+
confirm: 'Delete Account',
|
|
974
|
+
deleting: 'Deleting...',
|
|
975
|
+
type_delete_label: 'Type to confirm',
|
|
976
|
+
},
|
|
977
|
+
session_management: {
|
|
978
|
+
title: 'Security Settings',
|
|
979
|
+
session_management_button: 'Session Management',
|
|
980
|
+
},
|
|
963
981
|
}
|
|
964
982
|
*/
|
|
965
983
|
dyn_settings: {
|
|
@@ -1003,6 +1021,10 @@ const translation = {
|
|
|
1003
1021
|
deleting: 'Deleting...',
|
|
1004
1022
|
type_delete_label: 'Type to confirm',
|
|
1005
1023
|
},
|
|
1024
|
+
session_management: {
|
|
1025
|
+
title: 'Security Settings',
|
|
1026
|
+
session_management_button: 'Session Management',
|
|
1027
|
+
},
|
|
1006
1028
|
},
|
|
1007
1029
|
/**
|
|
1008
1030
|
* @description copy keys for global wallet view
|
|
@@ -1984,6 +2006,76 @@ const translation = {
|
|
|
1984
2006
|
using_hardware_wallet_toggle_label: 'Using Ledger with {{chainName}}',
|
|
1985
2007
|
button: 'Connect',
|
|
1986
2008
|
},
|
|
2009
|
+
/**
|
|
2010
|
+
* @description copy keys for session management view
|
|
2011
|
+
* @default
|
|
2012
|
+
* {
|
|
2013
|
+
aria: {
|
|
2014
|
+
back_button_label: 'Back',
|
|
2015
|
+
info_button_label: 'Info',
|
|
2016
|
+
},
|
|
2017
|
+
title: 'Session Management',
|
|
2018
|
+
empty_sessions_view: {
|
|
2019
|
+
title: 'No active sessions found',
|
|
2020
|
+
},
|
|
2021
|
+
info_view: {
|
|
2022
|
+
title: 'Connected App Sessions',
|
|
2023
|
+
description_bold: 'Easily manage which apps have access to your wallet. ',
|
|
2024
|
+
description_2:
|
|
2025
|
+
"Each session represents a connection you've made with a site or app.",
|
|
2026
|
+
description_3:
|
|
2027
|
+
'You can revoke access anytime to stay in control of where and how your wallet is used.',
|
|
2028
|
+
continue_button: 'Continue',
|
|
2029
|
+
},
|
|
2030
|
+
revoke_access_view: {
|
|
2031
|
+
title: 'Revoke Access',
|
|
2032
|
+
description:
|
|
2033
|
+
"You're removing this site's permissions. Confirm to revoke access.",
|
|
2034
|
+
cancel_button: 'Cancel',
|
|
2035
|
+
revoke_button: 'Revoke',
|
|
2036
|
+
},
|
|
2037
|
+
session_component: {
|
|
2038
|
+
aria: {
|
|
2039
|
+
collapse_permissions: 'Collapse',
|
|
2040
|
+
expand_permissions: 'Expand',
|
|
2041
|
+
},
|
|
2042
|
+
permission_details: 'Permission details',
|
|
2043
|
+
revoke_button: 'Revoke',
|
|
2044
|
+
},
|
|
2045
|
+
}
|
|
2046
|
+
*/
|
|
2047
|
+
dyn_session_management: {
|
|
2048
|
+
aria: {
|
|
2049
|
+
back_button_label: 'Back',
|
|
2050
|
+
info_button_label: 'Info',
|
|
2051
|
+
close_button_label: 'Close',
|
|
2052
|
+
},
|
|
2053
|
+
title: 'Session Management',
|
|
2054
|
+
empty_sessions_view: {
|
|
2055
|
+
title: 'No active sessions found',
|
|
2056
|
+
},
|
|
2057
|
+
info_view: {
|
|
2058
|
+
title: 'Connected App Sessions',
|
|
2059
|
+
description_bold: 'Easily manage which apps have access to your wallet. ',
|
|
2060
|
+
description_2: "Each session represents a connection you've made with a site or app.",
|
|
2061
|
+
description_3: 'You can revoke access anytime to stay in control of where and how your wallet is used.',
|
|
2062
|
+
continue_button: 'Continue',
|
|
2063
|
+
},
|
|
2064
|
+
revoke_access_view: {
|
|
2065
|
+
title: 'Revoke Access',
|
|
2066
|
+
description: "You're removing this site's permissions. Confirm to revoke access.",
|
|
2067
|
+
cancel_button: 'Cancel',
|
|
2068
|
+
revoke_button: 'Revoke',
|
|
2069
|
+
},
|
|
2070
|
+
session_component: {
|
|
2071
|
+
aria: {
|
|
2072
|
+
collapse_permissions: 'Collapse',
|
|
2073
|
+
expand_permissions: 'Expand',
|
|
2074
|
+
},
|
|
2075
|
+
permission_details: 'Permission details',
|
|
2076
|
+
revoke_button: 'Revoke',
|
|
2077
|
+
},
|
|
2078
|
+
},
|
|
1987
2079
|
/**
|
|
1988
2080
|
* @description copy keys for sign message flow views
|
|
1989
2081
|
* @default
|
|
@@ -954,6 +954,24 @@ export declare const translation: {
|
|
|
954
954
|
empty_screen: {
|
|
955
955
|
title: 'Nothing to see here yet!',
|
|
956
956
|
},
|
|
957
|
+
delete_account: {
|
|
958
|
+
title: 'Delete My Account',
|
|
959
|
+
description:
|
|
960
|
+
'Deleting your account will permanently remove all data, including wallet details and linked smart contract wallets. This action cannot be undone.',
|
|
961
|
+
backup_confirmation_embedded:
|
|
962
|
+
"I confirm I've backed up my wallet keys. If I proceed, a new wallet will be created. Any wallets or assets not backed up will be lost permanently.",
|
|
963
|
+
backup_confirmation_no_embedded:
|
|
964
|
+
'I confirm that all of my information will be deleted. If I return, a new user profile will be created. These changes cannot be undone.',
|
|
965
|
+
type_delete: 'Enter DELETE in the box below to confirm this action.',
|
|
966
|
+
cancel: 'Cancel',
|
|
967
|
+
confirm: 'Delete Account',
|
|
968
|
+
deleting: 'Deleting...',
|
|
969
|
+
type_delete_label: 'Type to confirm',
|
|
970
|
+
},
|
|
971
|
+
session_management: {
|
|
972
|
+
title: 'Security Settings',
|
|
973
|
+
session_management_button: 'Session Management',
|
|
974
|
+
},
|
|
957
975
|
}
|
|
958
976
|
*/
|
|
959
977
|
dyn_settings: {
|
|
@@ -999,6 +1017,10 @@ export declare const translation: {
|
|
|
999
1017
|
deleting: string;
|
|
1000
1018
|
type_delete_label: string;
|
|
1001
1019
|
};
|
|
1020
|
+
session_management: {
|
|
1021
|
+
title: string;
|
|
1022
|
+
session_management_button: string;
|
|
1023
|
+
};
|
|
1002
1024
|
};
|
|
1003
1025
|
/**
|
|
1004
1026
|
* @description copy keys for global wallet view
|
|
@@ -1980,6 +2002,76 @@ export declare const translation: {
|
|
|
1980
2002
|
using_hardware_wallet_toggle_label: string;
|
|
1981
2003
|
button: string;
|
|
1982
2004
|
};
|
|
2005
|
+
/**
|
|
2006
|
+
* @description copy keys for session management view
|
|
2007
|
+
* @default
|
|
2008
|
+
* {
|
|
2009
|
+
aria: {
|
|
2010
|
+
back_button_label: 'Back',
|
|
2011
|
+
info_button_label: 'Info',
|
|
2012
|
+
},
|
|
2013
|
+
title: 'Session Management',
|
|
2014
|
+
empty_sessions_view: {
|
|
2015
|
+
title: 'No active sessions found',
|
|
2016
|
+
},
|
|
2017
|
+
info_view: {
|
|
2018
|
+
title: 'Connected App Sessions',
|
|
2019
|
+
description_bold: 'Easily manage which apps have access to your wallet. ',
|
|
2020
|
+
description_2:
|
|
2021
|
+
"Each session represents a connection you've made with a site or app.",
|
|
2022
|
+
description_3:
|
|
2023
|
+
'You can revoke access anytime to stay in control of where and how your wallet is used.',
|
|
2024
|
+
continue_button: 'Continue',
|
|
2025
|
+
},
|
|
2026
|
+
revoke_access_view: {
|
|
2027
|
+
title: 'Revoke Access',
|
|
2028
|
+
description:
|
|
2029
|
+
"You're removing this site's permissions. Confirm to revoke access.",
|
|
2030
|
+
cancel_button: 'Cancel',
|
|
2031
|
+
revoke_button: 'Revoke',
|
|
2032
|
+
},
|
|
2033
|
+
session_component: {
|
|
2034
|
+
aria: {
|
|
2035
|
+
collapse_permissions: 'Collapse',
|
|
2036
|
+
expand_permissions: 'Expand',
|
|
2037
|
+
},
|
|
2038
|
+
permission_details: 'Permission details',
|
|
2039
|
+
revoke_button: 'Revoke',
|
|
2040
|
+
},
|
|
2041
|
+
}
|
|
2042
|
+
*/
|
|
2043
|
+
dyn_session_management: {
|
|
2044
|
+
aria: {
|
|
2045
|
+
back_button_label: string;
|
|
2046
|
+
info_button_label: string;
|
|
2047
|
+
close_button_label: string;
|
|
2048
|
+
};
|
|
2049
|
+
title: string;
|
|
2050
|
+
empty_sessions_view: {
|
|
2051
|
+
title: string;
|
|
2052
|
+
};
|
|
2053
|
+
info_view: {
|
|
2054
|
+
title: string;
|
|
2055
|
+
description_bold: string;
|
|
2056
|
+
description_2: string;
|
|
2057
|
+
description_3: string;
|
|
2058
|
+
continue_button: string;
|
|
2059
|
+
};
|
|
2060
|
+
revoke_access_view: {
|
|
2061
|
+
title: string;
|
|
2062
|
+
description: string;
|
|
2063
|
+
cancel_button: string;
|
|
2064
|
+
revoke_button: string;
|
|
2065
|
+
};
|
|
2066
|
+
session_component: {
|
|
2067
|
+
aria: {
|
|
2068
|
+
collapse_permissions: string;
|
|
2069
|
+
expand_permissions: string;
|
|
2070
|
+
};
|
|
2071
|
+
permission_details: string;
|
|
2072
|
+
revoke_button: string;
|
|
2073
|
+
};
|
|
2074
|
+
};
|
|
1983
2075
|
/**
|
|
1984
2076
|
* @description copy keys for sign message flow views
|
|
1985
2077
|
* @default
|