@dynamic-labs/sdk-react-core 2.1.0-alpha.2 → 2.1.0-alpha.3
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 +13 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +14 -14
- package/src/lib/Main.cjs +5 -0
- package/src/lib/Main.js +5 -0
- package/src/lib/components/Alert/Alert.cjs +2 -2
- package/src/lib/components/Alert/Alert.js +2 -2
- package/src/lib/components/Alert/Alert.types.d.ts +1 -0
- package/src/lib/components/EmailForm/EmailForm.cjs +1 -1
- package/src/lib/components/EmailForm/EmailForm.js +1 -1
- package/src/lib/components/PhoneNumberField/PhoneNumberField.cjs +1 -1
- package/src/lib/components/PhoneNumberField/PhoneNumberField.js +1 -1
- package/src/lib/components/RadioButton/RadioButton.cjs +14 -0
- package/src/lib/components/RadioButton/RadioButton.d.ts +5 -0
- package/src/lib/components/RadioButton/RadioButton.js +10 -0
- package/src/lib/components/RadioButton/index.d.ts +1 -0
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.d.ts +2 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +1 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +1 -0
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +2 -2
- package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +2 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.cjs +5 -2
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerCallbacks.js +5 -2
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/ViewContext/ViewContext.cjs +2 -2
- package/src/lib/context/ViewContext/ViewContext.js +2 -2
- package/src/lib/context/ViewContext/types/index.d.ts +7 -2
- package/src/lib/data/api/user/user.cjs +16 -0
- package/src/lib/data/api/user/user.js +16 -1
- package/src/lib/events/dynamicEvents.d.ts +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +6 -0
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +6 -0
- package/src/lib/locale/en/translation.cjs +42 -1
- package/src/lib/locale/en/translation.d.ts +42 -1
- package/src/lib/locale/en/translation.js +42 -1
- package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +4 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +4 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +1 -1
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +1 -1
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +8 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +8 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +1 -1
- package/src/lib/utils/hooks/useMergeUserAccounts/index.d.ts +1 -0
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.cjs +99 -0
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.d.ts +4 -0
- package/src/lib/utils/hooks/useMergeUserAccounts/useMergeUserAccounts.js +95 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +5 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +6 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +2 -4
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +2 -4
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.cjs +3 -3
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.js +3 -3
- package/src/lib/views/CollectUserDataView/useFields.cjs +1 -0
- package/src/lib/views/CollectUserDataView/useFields.d.ts +2 -0
- package/src/lib/views/CollectUserDataView/useFields.js +1 -0
- package/src/lib/views/MergeUserAccountsConflictsView/MergeUserAccountsConflictsView.cjs +126 -0
- package/src/lib/views/MergeUserAccountsConflictsView/MergeUserAccountsConflictsView.d.ts +6 -0
- package/src/lib/views/MergeUserAccountsConflictsView/MergeUserAccountsConflictsView.js +122 -0
- package/src/lib/views/MergeUserAccountsConflictsView/index.d.ts +1 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +123 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.d.ts +4 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +119 -0
- package/src/lib/views/MergeUserAccountsView/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +4 -0
- package/src/lib/views/viewToComponentMap.d.ts +2 -0
- package/src/lib/views/viewToComponentMap.js +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.2...v2.1.0-alpha.3) (2024-04-23)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add merge user accounts flow ([#5429](https://github.com/dynamic-labs/DynamicAuth/issues/5429)) ([41d4239](https://github.com/dynamic-labs/DynamicAuth/commit/41d423906625e28004ba8f20baf57847ed8bf5d0))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* disconnect wallet on lock in connect-only ([#5422](https://github.com/dynamic-labs/DynamicAuth/issues/5422)) ([a26f9fe](https://github.com/dynamic-labs/DynamicAuth/commit/a26f9fe93cf8568f1482e10b831de98c77fb2a2d))
|
|
13
|
+
* useReactiveProxy to stop proxing when it finds a reactive value ([#5428](https://github.com/dynamic-labs/DynamicAuth/issues/5428)) ([838dce9](https://github.com/dynamic-labs/DynamicAuth/commit/838dce9ee953361e41772239a91adb1dd8d40234))
|
|
14
|
+
|
|
2
15
|
## [2.1.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.1...v2.1.0-alpha.2) (2024-04-19)
|
|
3
16
|
|
|
4
17
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "2.1.0-alpha.
|
|
6
|
+
var version = "2.1.0-alpha.3";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.425",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"country-list": "2.3.0",
|
|
11
11
|
formik: "2.2.9",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "2.1.0-alpha.
|
|
2
|
+
var version = "2.1.0-alpha.3";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.425",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"country-list": "2.3.0",
|
|
7
7
|
formik: "2.2.9",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.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.425",
|
|
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/ethereum": "2.1.0-alpha.
|
|
21
|
-
"@dynamic-labs/iconic": "2.1.0-alpha.
|
|
22
|
-
"@dynamic-labs/logger": "2.1.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "2.1.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.
|
|
25
|
-
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "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/ethereum": "2.1.0-alpha.3",
|
|
21
|
+
"@dynamic-labs/iconic": "2.1.0-alpha.3",
|
|
22
|
+
"@dynamic-labs/logger": "2.1.0-alpha.3",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "2.1.0-alpha.3",
|
|
24
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.1.0-alpha.3",
|
|
25
|
+
"@dynamic-labs/rpc-provider-solana": "2.1.0-alpha.3",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "2.1.0-alpha.3",
|
|
27
|
+
"@dynamic-labs/types": "2.1.0-alpha.3",
|
|
28
|
+
"@dynamic-labs/utils": "2.1.0-alpha.3",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.1.0-alpha.3",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.1.0-alpha.3",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.1.0-alpha.3",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
package/src/lib/Main.cjs
CHANGED
|
@@ -105,8 +105,13 @@ const Main = () => {
|
|
|
105
105
|
usePreventPageScroll.usePreventPageScroll(showAuthFlow);
|
|
106
106
|
const userWallets = UserWalletsContext.useUserWallets();
|
|
107
107
|
const handleClose = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
var _a;
|
|
108
109
|
if (viewsToDisableCloseOnOverlayClick.includes(view.type))
|
|
109
110
|
return;
|
|
111
|
+
if ((_a = view.events) === null || _a === void 0 ? void 0 : _a.onClose) {
|
|
112
|
+
view.events.onClose();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
110
115
|
if ((view.type === 'network-not-supported' ||
|
|
111
116
|
view.type === 'network-not-supported-manual') &&
|
|
112
117
|
userWallets.length === 1) {
|
package/src/lib/Main.js
CHANGED
|
@@ -101,8 +101,13 @@ const Main = () => {
|
|
|
101
101
|
usePreventPageScroll(showAuthFlow);
|
|
102
102
|
const userWallets = useUserWallets();
|
|
103
103
|
const handleClose = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
+
var _a;
|
|
104
105
|
if (viewsToDisableCloseOnOverlayClick.includes(view.type))
|
|
105
106
|
return;
|
|
107
|
+
if ((_a = view.events) === null || _a === void 0 ? void 0 : _a.onClose) {
|
|
108
|
+
view.events.onClose();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
106
111
|
if ((view.type === 'network-not-supported' ||
|
|
107
112
|
view.type === 'network-not-supported-manual') &&
|
|
108
113
|
userWallets.length === 1) {
|
|
@@ -24,10 +24,10 @@ var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
|
24
24
|
const errorIconMap = {
|
|
25
25
|
error: jsxRuntime.jsx(error.ReactComponent, {}),
|
|
26
26
|
};
|
|
27
|
-
const Alert = ({ children, icon, variant = 'error', contentDataTestId, }) => (jsxRuntime.jsxs("div", { className: classNames.classNames('alert', {
|
|
27
|
+
const Alert = ({ children, icon, variant = 'error', contentDataTestId, className = '', }) => (jsxRuntime.jsxs("div", { className: classNames.classNames('alert', {
|
|
28
28
|
'alert--error': variant === 'error',
|
|
29
29
|
'alert--info': variant === 'info',
|
|
30
30
|
'alert--warning': variant === 'warning',
|
|
31
|
-
}), children: [icon && (jsxRuntime.jsx(Icon.Icon, { size: 'small', className: 'alert__icon', children: typeof icon === 'string' ? errorIconMap[icon] : icon })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', "data-testid": contentDataTestId, children: children })] }));
|
|
31
|
+
}, className), children: [icon && (jsxRuntime.jsx(Icon.Icon, { size: 'small', className: 'alert__icon', children: typeof icon === 'string' ? errorIconMap[icon] : icon })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', "data-testid": contentDataTestId, children: children })] }));
|
|
32
32
|
|
|
33
33
|
exports.Alert = Alert;
|
|
@@ -20,10 +20,10 @@ import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
|
20
20
|
const errorIconMap = {
|
|
21
21
|
error: jsx(SvgError, {}),
|
|
22
22
|
};
|
|
23
|
-
const Alert = ({ children, icon, variant = 'error', contentDataTestId, }) => (jsxs("div", { className: classNames('alert', {
|
|
23
|
+
const Alert = ({ children, icon, variant = 'error', contentDataTestId, className = '', }) => (jsxs("div", { className: classNames('alert', {
|
|
24
24
|
'alert--error': variant === 'error',
|
|
25
25
|
'alert--info': variant === 'info',
|
|
26
26
|
'alert--warning': variant === 'warning',
|
|
27
|
-
}), children: [icon && (jsx(Icon, { size: 'small', className: 'alert__icon', children: typeof icon === 'string' ? errorIconMap[icon] : icon })), jsx(Typography, { variant: 'body_small', "data-testid": contentDataTestId, children: children })] }));
|
|
27
|
+
}, className), children: [icon && (jsx(Icon, { size: 'small', className: 'alert__icon', children: typeof icon === 'string' ? errorIconMap[icon] : icon })), jsx(Typography, { variant: 'body_small', "data-testid": contentDataTestId, children: children })] }));
|
|
28
28
|
|
|
29
29
|
export { Alert };
|
|
@@ -96,7 +96,7 @@ const EmailForm = ({ isLoading, onSubmit, isEmailInvalid = false, currentEmail,
|
|
|
96
96
|
}
|
|
97
97
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(emailInput);
|
|
98
98
|
});
|
|
99
|
-
return (jsxRuntime.jsxs("form", { className: classNames.classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: jsxRuntime.jsx(InlineSubmitButton.InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false) }), !emailSubmitButtonInsideInput && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
|
|
99
|
+
return (jsxRuntime.jsxs("form", { className: classNames.classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: jsxRuntime.jsx(InlineSubmitButton.InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), autoComplete: 'email' }), !emailSubmitButtonInsideInput && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
|
|
100
100
|
color: 'inherit',
|
|
101
101
|
}, children: t(buttonCopyKey) }))] }));
|
|
102
102
|
};
|
|
@@ -92,7 +92,7 @@ const EmailForm = ({ isLoading, onSubmit, isEmailInvalid = false, currentEmail,
|
|
|
92
92
|
}
|
|
93
93
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(emailInput);
|
|
94
94
|
});
|
|
95
|
-
return (jsxs("form", { className: classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: jsx(InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false) }), !emailSubmitButtonInsideInput && (jsx(TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
|
|
95
|
+
return (jsxs("form", { className: classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: jsx(InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), autoComplete: 'email' }), !emailSubmitButtonInsideInput && (jsx(TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
|
|
96
96
|
color: 'inherit',
|
|
97
97
|
}, children: t(buttonCopyKey) }))] }));
|
|
98
98
|
};
|
|
@@ -98,7 +98,7 @@ const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendR
|
|
|
98
98
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
99
99
|
}, ref: anchorRef, children: [jsxRuntime.jsxs("div", { className: classNames.classNames('phone-number-field__fields__country-code', {
|
|
100
100
|
'phone-number-field__fields__country-code--disabled': isLoading || disabled,
|
|
101
|
-
}), onClick: openDropdown, "data-testid": 'country-code', children: [jsxRuntime.jsx(reactInternationalPhone.FlagImage, { iso2: currentCountry.iso2, size: '24px', className: 'phone-number-field__fields__country-code__flag' }), jsxRuntime.jsx(Typography.Typography, { className: 'phone-number-field__fields__country-code__plus', variant: 'body_normal', weight: 'regular', style: { fontSize: countryFontSize }, color: 'primary', children: "+" }), jsxRuntime.jsx(Input.Input, { label: '', id: 'country_code_field', value: countryInput, onChange: handleCountryInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__country-code__container', className: 'phone-number-field__fields__country-code__container__input', onBlur: onBlurCountry, ref: countryInputRef, onKeyDown: handleCountryKeyDown, onFocus: onFocusCountry, style: { fontSize: countryFontSize }, "data-testid": 'country-code-input', inputMode: 'numeric' }), jsxRuntime.jsx(Icon.Icon, { className: 'phone-number-field__fields__country-code__chevron', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) })] }), jsxRuntime.jsx(Input.Input, { label: '', id: 'phoneNumber', value: formattedPhone, onChange: handlePhoneInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__phone-number', className: 'phone-number-field__fields__phone-number__input', ref: inputRef, error: Boolean(invalidNumberMessage || error), inputMode: 'numeric', "data-testid": 'phone_number_input' }), !hasInput && (jsxRuntime.jsx(Typography.Typography, { className: 'phone-number-field__fields__placeholder', variant: 'body_normal', weight: 'regular', copykey: 'dyn_collect_user_data.fields.phone_number.label', children: label !== null && label !== void 0 ? label : t('dyn_collect_user_data.fields.phone_number.label') })), appendRight] }), jsxRuntime.jsx(MenuList.MenuList, { isOpen: countryDropdownOpen, onClickClose: closeDropdown, popperProps: {
|
|
101
|
+
}), onClick: openDropdown, "data-testid": 'country-code', children: [jsxRuntime.jsx(reactInternationalPhone.FlagImage, { iso2: currentCountry.iso2, size: '24px', className: 'phone-number-field__fields__country-code__flag' }), jsxRuntime.jsx(Typography.Typography, { className: 'phone-number-field__fields__country-code__plus', variant: 'body_normal', weight: 'regular', style: { fontSize: countryFontSize }, color: 'primary', children: "+" }), jsxRuntime.jsx(Input.Input, { label: '', id: 'country_code_field', value: countryInput, onChange: handleCountryInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__country-code__container', className: 'phone-number-field__fields__country-code__container__input', onBlur: onBlurCountry, ref: countryInputRef, onKeyDown: handleCountryKeyDown, onFocus: onFocusCountry, style: { fontSize: countryFontSize }, "data-testid": 'country-code-input', inputMode: 'numeric', autoComplete: 'tel-country-code' }), jsxRuntime.jsx(Icon.Icon, { className: 'phone-number-field__fields__country-code__chevron', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) })] }), jsxRuntime.jsx(Input.Input, { label: '', id: 'phoneNumber', value: formattedPhone, onChange: handlePhoneInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__phone-number', className: 'phone-number-field__fields__phone-number__input', ref: inputRef, error: Boolean(invalidNumberMessage || error), inputMode: 'numeric', "data-testid": 'phone_number_input', autoComplete: 'tel-national' }), !hasInput && (jsxRuntime.jsx(Typography.Typography, { className: 'phone-number-field__fields__placeholder', variant: 'body_normal', weight: 'regular', copykey: 'dyn_collect_user_data.fields.phone_number.label', children: label !== null && label !== void 0 ? label : t('dyn_collect_user_data.fields.phone_number.label') })), appendRight] }), jsxRuntime.jsx(MenuList.MenuList, { isOpen: countryDropdownOpen, onClickClose: closeDropdown, popperProps: {
|
|
102
102
|
anchorOrigin: 'bottom-left',
|
|
103
103
|
anchorRef,
|
|
104
104
|
}, mobileTitle: 'Select country', dropdownClassName: 'phone-number-field__dropdown', children: jsxRuntime.jsx("div", { className: 'phone-number-field__dropdown__items', ref: onMenuDisplayToggle, children: filteredCountries.map((countryData) => {
|
|
@@ -94,7 +94,7 @@ const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendR
|
|
|
94
94
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
95
95
|
}, ref: anchorRef, children: [jsxs("div", { className: classNames('phone-number-field__fields__country-code', {
|
|
96
96
|
'phone-number-field__fields__country-code--disabled': isLoading || disabled,
|
|
97
|
-
}), onClick: openDropdown, "data-testid": 'country-code', children: [jsx(FlagImage, { iso2: currentCountry.iso2, size: '24px', className: 'phone-number-field__fields__country-code__flag' }), jsx(Typography, { className: 'phone-number-field__fields__country-code__plus', variant: 'body_normal', weight: 'regular', style: { fontSize: countryFontSize }, color: 'primary', children: "+" }), jsx(Input, { label: '', id: 'country_code_field', value: countryInput, onChange: handleCountryInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__country-code__container', className: 'phone-number-field__fields__country-code__container__input', onBlur: onBlurCountry, ref: countryInputRef, onKeyDown: handleCountryKeyDown, onFocus: onFocusCountry, style: { fontSize: countryFontSize }, "data-testid": 'country-code-input', inputMode: 'numeric' }), jsx(Icon, { className: 'phone-number-field__fields__country-code__chevron', children: jsx(SvgChevronDown, {}) })] }), jsx(Input, { label: '', id: 'phoneNumber', value: formattedPhone, onChange: handlePhoneInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__phone-number', className: 'phone-number-field__fields__phone-number__input', ref: inputRef, error: Boolean(invalidNumberMessage || error), inputMode: 'numeric', "data-testid": 'phone_number_input' }), !hasInput && (jsx(Typography, { className: 'phone-number-field__fields__placeholder', variant: 'body_normal', weight: 'regular', copykey: 'dyn_collect_user_data.fields.phone_number.label', children: label !== null && label !== void 0 ? label : t('dyn_collect_user_data.fields.phone_number.label') })), appendRight] }), jsx(MenuList, { isOpen: countryDropdownOpen, onClickClose: closeDropdown, popperProps: {
|
|
97
|
+
}), onClick: openDropdown, "data-testid": 'country-code', children: [jsx(FlagImage, { iso2: currentCountry.iso2, size: '24px', className: 'phone-number-field__fields__country-code__flag' }), jsx(Typography, { className: 'phone-number-field__fields__country-code__plus', variant: 'body_normal', weight: 'regular', style: { fontSize: countryFontSize }, color: 'primary', children: "+" }), jsx(Input, { label: '', id: 'country_code_field', value: countryInput, onChange: handleCountryInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__country-code__container', className: 'phone-number-field__fields__country-code__container__input', onBlur: onBlurCountry, ref: countryInputRef, onKeyDown: handleCountryKeyDown, onFocus: onFocusCountry, style: { fontSize: countryFontSize }, "data-testid": 'country-code-input', inputMode: 'numeric', autoComplete: 'tel-country-code' }), jsx(Icon, { className: 'phone-number-field__fields__country-code__chevron', children: jsx(SvgChevronDown, {}) })] }), jsx(Input, { label: '', id: 'phoneNumber', value: formattedPhone, onChange: handlePhoneInput, disabled: isLoading || disabled, containerClassName: 'phone-number-field__fields__phone-number', className: 'phone-number-field__fields__phone-number__input', ref: inputRef, error: Boolean(invalidNumberMessage || error), inputMode: 'numeric', "data-testid": 'phone_number_input', autoComplete: 'tel-national' }), !hasInput && (jsx(Typography, { className: 'phone-number-field__fields__placeholder', variant: 'body_normal', weight: 'regular', copykey: 'dyn_collect_user_data.fields.phone_number.label', children: label !== null && label !== void 0 ? label : t('dyn_collect_user_data.fields.phone_number.label') })), appendRight] }), jsx(MenuList, { isOpen: countryDropdownOpen, onClickClose: closeDropdown, popperProps: {
|
|
98
98
|
anchorOrigin: 'bottom-left',
|
|
99
99
|
anchorRef,
|
|
100
100
|
}, mobileTitle: 'Select country', dropdownClassName: 'phone-number-field__dropdown', children: jsx("div", { className: 'phone-number-field__dropdown__items', ref: onMenuDisplayToggle, children: filteredCountries.map((countryData) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
8
|
+
|
|
9
|
+
const RadioButton = ({ children, checked, value, name, disabled = false, className = '', onChange, }) => {
|
|
10
|
+
const radioId = `${name}_${value}`;
|
|
11
|
+
return (jsxRuntime.jsxs("div", { className: classNames.classNames('radio-button', className), children: [jsxRuntime.jsx("input", { type: 'radio', id: radioId, name: name, value: value, disabled: disabled, defaultChecked: checked, onChange: onChange }), jsxRuntime.jsx("label", { htmlFor: radioId, children: children })] }));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.RadioButton = RadioButton;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
4
|
+
|
|
5
|
+
const RadioButton = ({ children, checked, value, name, disabled = false, className = '', onChange, }) => {
|
|
6
|
+
const radioId = `${name}_${value}`;
|
|
7
|
+
return (jsxs("div", { className: classNames('radio-button', className), children: [jsx("input", { type: 'radio', id: radioId, name: name, value: value, disabled: disabled, defaultChecked: checked, onChange: onChange }), jsx("label", { htmlFor: radioId, children: children })] }));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { RadioButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioButton } from './RadioButton';
|
|
@@ -77,7 +77,7 @@ require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/Se
|
|
|
77
77
|
require('@hcaptcha/react-hcaptcha');
|
|
78
78
|
require('../../../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs');
|
|
79
79
|
|
|
80
|
-
const UserProfileField = ({ name, label, value, copykey, }) => {
|
|
80
|
+
const UserProfileField = ({ name, label, value, copykey, autoComplete, }) => {
|
|
81
81
|
var _a, _b;
|
|
82
82
|
const { user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
83
83
|
const { t } = reactI18next.useTranslation();
|
|
@@ -5,5 +5,6 @@ export type UserProfileFieldProps = {
|
|
|
5
5
|
label?: string;
|
|
6
6
|
name: string;
|
|
7
7
|
value?: string | boolean | null;
|
|
8
|
+
autoComplete?: string;
|
|
8
9
|
} & CopyKey;
|
|
9
|
-
export declare const UserProfileField: ({ name, label, value, copykey, }: UserProfileFieldProps) => JSX.Element;
|
|
10
|
+
export declare const UserProfileField: ({ name, label, value, copykey, autoComplete, }: UserProfileFieldProps) => JSX.Element;
|
|
@@ -73,7 +73,7 @@ import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/Sec
|
|
|
73
73
|
import '@hcaptcha/react-hcaptcha';
|
|
74
74
|
import '../../../../views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js';
|
|
75
75
|
|
|
76
|
-
const UserProfileField = ({ name, label, value, copykey, }) => {
|
|
76
|
+
const UserProfileField = ({ name, label, value, copykey, autoComplete, }) => {
|
|
77
77
|
var _a, _b;
|
|
78
78
|
const { user } = useInternalDynamicContext();
|
|
79
79
|
const { t } = useTranslation();
|
|
@@ -42,6 +42,7 @@ export * from './Portal';
|
|
|
42
42
|
export * from './PoweredByDynamic';
|
|
43
43
|
export * from './QRCode';
|
|
44
44
|
export * from './QrCodeWrapper';
|
|
45
|
+
export * from './RadioButton';
|
|
45
46
|
export * from './RenderView';
|
|
46
47
|
export * from './SandboxIndicatorWrapper';
|
|
47
48
|
export * from './SecureEmbeddedWalletCard';
|
|
@@ -334,6 +334,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
334
334
|
const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork.useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
335
335
|
useWalletEventListeners.useWalletEventListeners({
|
|
336
336
|
authMode,
|
|
337
|
+
disconnectWallet,
|
|
337
338
|
handleLogOut,
|
|
338
339
|
multiWallet,
|
|
339
340
|
multiWalletWidgetState,
|
|
@@ -330,6 +330,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
|
|
|
330
330
|
const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
331
331
|
useWalletEventListeners({
|
|
332
332
|
authMode,
|
|
333
|
+
disconnectWallet,
|
|
333
334
|
handleLogOut,
|
|
334
335
|
multiWallet,
|
|
335
336
|
multiWalletWidgetState,
|
package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs
CHANGED
|
@@ -108,9 +108,9 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
108
108
|
var _a;
|
|
109
109
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletRemoved) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
110
110
|
});
|
|
111
|
-
useDynamicEvents.useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential) => {
|
|
111
|
+
useDynamicEvents.useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential, authToken) => {
|
|
112
112
|
var _a;
|
|
113
|
-
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential);
|
|
113
|
+
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential, authToken);
|
|
114
114
|
});
|
|
115
115
|
useDynamicEvents.useInternalDynamicEvents('logout', () => {
|
|
116
116
|
var _a;
|
package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js
CHANGED
|
@@ -104,9 +104,9 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, setHasLoggedOut, }) =>
|
|
|
104
104
|
var _a;
|
|
105
105
|
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletRemoved) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, { userWallets, wallet });
|
|
106
106
|
});
|
|
107
|
-
useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential) => {
|
|
107
|
+
useInternalDynamicEvents('embeddedWalletCreated', (_wallet, jwtVerifiedCredential, authToken) => {
|
|
108
108
|
var _a;
|
|
109
|
-
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential);
|
|
109
|
+
(_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onEmbeddedWalletCreated) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, jwtVerifiedCredential, authToken);
|
|
110
110
|
});
|
|
111
111
|
useInternalDynamicEvents('logout', () => {
|
|
112
112
|
var _a;
|
|
@@ -19,6 +19,7 @@ require('../../../shared/consts/index.cjs');
|
|
|
19
19
|
require('../../../../../_virtual/_tslib.cjs');
|
|
20
20
|
require('@dynamic-labs/multi-wallet');
|
|
21
21
|
var getAuthToken = require('../../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
22
|
+
var getMinAuthToken = require('../../../utils/functions/getMinAuthToken/getMinAuthToken.cjs');
|
|
22
23
|
require('react-international-phone');
|
|
23
24
|
require('viem');
|
|
24
25
|
require('viem/chains');
|
|
@@ -27,7 +28,7 @@ require('../../../locale/locale.cjs');
|
|
|
27
28
|
|
|
28
29
|
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate }, handleLogOut, primaryWallet, user, isAuthenticated, setHasLoggedOut, }) => {
|
|
29
30
|
const [callbackQueue, setCallbackQueue] = React.useState([]);
|
|
30
|
-
const handleNextCallback = React.useCallback((next, authToken, user) => {
|
|
31
|
+
const handleNextCallback = React.useCallback((next, authToken, user, minAuthToken) => {
|
|
31
32
|
switch (next === null || next === void 0 ? void 0 : next.callback) {
|
|
32
33
|
case 'authSuccess': {
|
|
33
34
|
try {
|
|
@@ -35,6 +36,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
35
36
|
authToken,
|
|
36
37
|
handleLogOut,
|
|
37
38
|
isAuthenticated,
|
|
39
|
+
minAuthToken,
|
|
38
40
|
primaryWallet,
|
|
39
41
|
user,
|
|
40
42
|
});
|
|
@@ -67,6 +69,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
67
69
|
if (!callbackQueue.length || !user)
|
|
68
70
|
return;
|
|
69
71
|
const authToken = getAuthToken.getAuthToken();
|
|
72
|
+
const minAuthToken = getMinAuthToken.getMinAuthToken();
|
|
70
73
|
// checks if user logged in with a wallet, so we need to wait
|
|
71
74
|
// for the primary wallet state to be set
|
|
72
75
|
// if user logged in with email without embedded wallet, then
|
|
@@ -74,7 +77,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
74
77
|
if (!authToken || (user.isAuthenticatedWithAWallet && !primaryWallet)) {
|
|
75
78
|
return;
|
|
76
79
|
}
|
|
77
|
-
handleNextCallback(callbackQueue[0], authToken, user);
|
|
80
|
+
handleNextCallback(callbackQueue[0], authToken, user, minAuthToken);
|
|
78
81
|
setCallbackQueue((prev) => {
|
|
79
82
|
const [resolvedCallback, ...updatedQueue] = prev;
|
|
80
83
|
if (resolvedCallback) {
|
|
@@ -15,6 +15,7 @@ import '../../../shared/consts/index.js';
|
|
|
15
15
|
import '../../../../../_virtual/_tslib.js';
|
|
16
16
|
import '@dynamic-labs/multi-wallet';
|
|
17
17
|
import { getAuthToken } from '../../../utils/functions/getAuthToken/getAuthToken.js';
|
|
18
|
+
import { getMinAuthToken } from '../../../utils/functions/getMinAuthToken/getMinAuthToken.js';
|
|
18
19
|
import 'react-international-phone';
|
|
19
20
|
import 'viem';
|
|
20
21
|
import 'viem/chains';
|
|
@@ -23,7 +24,7 @@ import '../../../locale/locale.js';
|
|
|
23
24
|
|
|
24
25
|
const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate }, handleLogOut, primaryWallet, user, isAuthenticated, setHasLoggedOut, }) => {
|
|
25
26
|
const [callbackQueue, setCallbackQueue] = useState([]);
|
|
26
|
-
const handleNextCallback = useCallback((next, authToken, user) => {
|
|
27
|
+
const handleNextCallback = useCallback((next, authToken, user, minAuthToken) => {
|
|
27
28
|
switch (next === null || next === void 0 ? void 0 : next.callback) {
|
|
28
29
|
case 'authSuccess': {
|
|
29
30
|
try {
|
|
@@ -31,6 +32,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
31
32
|
authToken,
|
|
32
33
|
handleLogOut,
|
|
33
34
|
isAuthenticated,
|
|
35
|
+
minAuthToken,
|
|
34
36
|
primaryWallet,
|
|
35
37
|
user,
|
|
36
38
|
});
|
|
@@ -63,6 +65,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
63
65
|
if (!callbackQueue.length || !user)
|
|
64
66
|
return;
|
|
65
67
|
const authToken = getAuthToken();
|
|
68
|
+
const minAuthToken = getMinAuthToken();
|
|
66
69
|
// checks if user logged in with a wallet, so we need to wait
|
|
67
70
|
// for the primary wallet state to be set
|
|
68
71
|
// if user logged in with email without embedded wallet, then
|
|
@@ -70,7 +73,7 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
|
|
|
70
73
|
if (!authToken || (user.isAuthenticatedWithAWallet && !primaryWallet)) {
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
73
|
-
handleNextCallback(callbackQueue[0], authToken, user);
|
|
76
|
+
handleNextCallback(callbackQueue[0], authToken, user, minAuthToken);
|
|
74
77
|
setCallbackQueue((prev) => {
|
|
75
78
|
const [resolvedCallback, ...updatedQueue] = prev;
|
|
76
79
|
if (resolvedCallback) {
|
|
@@ -13,7 +13,7 @@ const useDynamicContext = () => {
|
|
|
13
13
|
if (context === undefined) {
|
|
14
14
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
15
15
|
}
|
|
16
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, } = context;
|
|
16
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, } = context;
|
|
17
17
|
const { setAuthMode } = useOverrides.useOverrides(context);
|
|
18
18
|
return {
|
|
19
19
|
accountSwitchState,
|
|
@@ -29,6 +29,7 @@ const useDynamicContext = () => {
|
|
|
29
29
|
loadingNetwork,
|
|
30
30
|
locale,
|
|
31
31
|
loginWithEmail,
|
|
32
|
+
minAuthToken,
|
|
32
33
|
multiWalletWidgetState,
|
|
33
34
|
network,
|
|
34
35
|
networkConfigurations,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { IDynamicContext } from '../types';
|
|
3
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setPrimaryWallet' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode'> & {
|
|
3
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'authMode' | 'authToken' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'handleUnlinkWallet' | 'isAuthenticated' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'rpcProviders' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setPrimaryWallet' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'walletConnector' | 'walletConnectorOptions' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'setAuthMode' | 'minAuthToken'> & {
|
|
4
4
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
5
5
|
};
|
|
6
6
|
export declare const useDynamicContext: () => UseDynamicContext;
|
|
@@ -9,7 +9,7 @@ const useDynamicContext = () => {
|
|
|
9
9
|
if (context === undefined) {
|
|
10
10
|
throw new Error('useDynamicContext must be used within a DynamicContextProvider');
|
|
11
11
|
}
|
|
12
|
-
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, } = context;
|
|
12
|
+
const { accountSwitchState, authMode, authToken, awaitingSignatureState, getNameService, handleLogOut, handleUnlinkWallet, isAuthenticated, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, rpcProviders, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setPrimaryWallet, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, showAuthFlow, showQrcodeModal, user, walletConnector, walletConnectorOptions, bridgeChains, bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, minAuthToken, } = context;
|
|
13
13
|
const { setAuthMode } = useOverrides(context);
|
|
14
14
|
return {
|
|
15
15
|
accountSwitchState,
|
|
@@ -25,6 +25,7 @@ const useDynamicContext = () => {
|
|
|
25
25
|
loadingNetwork,
|
|
26
26
|
locale,
|
|
27
27
|
loginWithEmail,
|
|
28
|
+
minAuthToken,
|
|
28
29
|
multiWalletWidgetState,
|
|
29
30
|
network,
|
|
30
31
|
networkConfigurations,
|
|
@@ -16,13 +16,13 @@ const ViewContextProvider = ({ children, initialView = { props: { isWalletConnec
|
|
|
16
16
|
const goToInitialView = React.useCallback(() => {
|
|
17
17
|
_setView(null);
|
|
18
18
|
}, []);
|
|
19
|
-
const setView = React.useCallback((type, props) => {
|
|
19
|
+
const setView = React.useCallback((type, props, events) => {
|
|
20
20
|
// we need to clear errors before proceeding to the next view
|
|
21
21
|
// but only if the next view is different from the current view
|
|
22
22
|
// this is to prevent the error from being cleared when the same view is re-rendered
|
|
23
23
|
if (view.type !== type)
|
|
24
24
|
clearError();
|
|
25
|
-
_setView({ props, type });
|
|
25
|
+
_setView({ events, props, type });
|
|
26
26
|
}, []);
|
|
27
27
|
useDynamicEvents.useInternalDynamicEvents('logout', () => goToInitialView());
|
|
28
28
|
const value = React.useMemo(() => ({
|
|
@@ -12,13 +12,13 @@ const ViewContextProvider = ({ children, initialView = { props: { isWalletConnec
|
|
|
12
12
|
const goToInitialView = useCallback(() => {
|
|
13
13
|
_setView(null);
|
|
14
14
|
}, []);
|
|
15
|
-
const setView = useCallback((type, props) => {
|
|
15
|
+
const setView = useCallback((type, props, events) => {
|
|
16
16
|
// we need to clear errors before proceeding to the next view
|
|
17
17
|
// but only if the next view is different from the current view
|
|
18
18
|
// this is to prevent the error from being cleared when the same view is re-rendered
|
|
19
19
|
if (view.type !== type)
|
|
20
20
|
clearError();
|
|
21
|
-
_setView({ props, type });
|
|
21
|
+
_setView({ events, props, type });
|
|
22
22
|
}, []);
|
|
23
23
|
useInternalDynamicEvents('logout', () => goToInitialView());
|
|
24
24
|
const value = useMemo(() => ({
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { viewToComponentMap } from '../../../views/viewToComponentMap';
|
|
3
|
-
export type ViewType = 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-secure-device' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro' | 'farcaster-connect-view';
|
|
3
|
+
export type ViewType = 'select-hardware-wallet' | 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'multi-wallet-wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-secure-device' | 'wallet-cannot-be-transferred' | 'passkey-intro' | 'passkey-recovery-add-email' | 'passkey-recovery-start' | 'passkey-recovery-bundle' | 'passkey-recovery-complete' | 'passkey-new-domain-detected' | 'embedded-reveal-view' | 'embedded-reveal-account-view' | 'embedded-wallet-auth-choice' | 'rename-passkey' | 'wallet-redirect-view' | 'create-password-view' | 'wallet-claim-intro' | 'farcaster-connect-view';
|
|
4
4
|
export type ViewMapConstraint = Record<ViewType, FC<any>>;
|
|
5
5
|
type ComponentProps<T extends FC<any>> = T extends FC<infer P> ? P : never;
|
|
6
6
|
export type ViewMap = typeof viewToComponentMap;
|
|
7
7
|
export type ViewState<T extends ViewType> = {
|
|
8
8
|
type: T;
|
|
9
9
|
props?: ComponentProps<ViewMap[T]>;
|
|
10
|
+
events?: ViewEvents;
|
|
10
11
|
};
|
|
11
|
-
export type
|
|
12
|
+
export type ViewEvents = {
|
|
13
|
+
onBackClick?: () => void;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export type SetView = <T extends ViewType>(view: T, props?: ViewState<T>['props'], events?: ViewEvents) => void;
|
|
12
17
|
export {};
|
|
@@ -61,6 +61,21 @@ const mergeUserAccounts = (userJwt, environmentId) => _tslib.__awaiter(void 0, v
|
|
|
61
61
|
throw e;
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
+
const verifyMergeUsers = (userJwt, environmentId, mergeConflictResolutions) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
+
try {
|
|
66
|
+
const response = yield api.sdkApi(userJwt).verifyMergeUsers({
|
|
67
|
+
environmentId,
|
|
68
|
+
mergeUserConflictResolutions: {
|
|
69
|
+
mergeUserResolutions: mergeConflictResolutions,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
return response;
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
logger.logger.error(e);
|
|
76
|
+
throw e;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
64
79
|
const refreshUserJwt = (_a, userJwt_1) => _tslib.__awaiter(void 0, [_a, userJwt_1], void 0, function* ({ environmentId, }, userJwt) {
|
|
65
80
|
try {
|
|
66
81
|
const { jwt, minifiedJwt } = yield api.sdkApi(userJwt).refreshAuth({
|
|
@@ -76,3 +91,4 @@ const refreshUserJwt = (_a, userJwt_1) => _tslib.__awaiter(void 0, [_a, userJwt_
|
|
|
76
91
|
exports.mergeUserAccounts = mergeUserAccounts;
|
|
77
92
|
exports.refreshUserJwt = refreshUserJwt;
|
|
78
93
|
exports.updateUserProfileFields = updateUserProfileFields;
|
|
94
|
+
exports.verifyMergeUsers = verifyMergeUsers;
|
|
@@ -57,6 +57,21 @@ const mergeUserAccounts = (userJwt, environmentId) => __awaiter(void 0, void 0,
|
|
|
57
57
|
throw e;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
const verifyMergeUsers = (userJwt, environmentId, mergeConflictResolutions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
try {
|
|
62
|
+
const response = yield sdkApi(userJwt).verifyMergeUsers({
|
|
63
|
+
environmentId,
|
|
64
|
+
mergeUserConflictResolutions: {
|
|
65
|
+
mergeUserResolutions: mergeConflictResolutions,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
logger.error(e);
|
|
72
|
+
throw e;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
60
75
|
const refreshUserJwt = (_a, userJwt_1) => __awaiter(void 0, [_a, userJwt_1], void 0, function* ({ environmentId, }, userJwt) {
|
|
61
76
|
try {
|
|
62
77
|
const { jwt, minifiedJwt } = yield sdkApi(userJwt).refreshAuth({
|
|
@@ -69,4 +84,4 @@ const refreshUserJwt = (_a, userJwt_1) => __awaiter(void 0, [_a, userJwt_1], voi
|
|
|
69
84
|
}
|
|
70
85
|
});
|
|
71
86
|
|
|
72
|
-
export { mergeUserAccounts, refreshUserJwt, updateUserProfileFields };
|
|
87
|
+
export { mergeUserAccounts, refreshUserJwt, updateUserProfileFields, verifyMergeUsers };
|
|
@@ -11,7 +11,7 @@ export type DynamicEvents = {
|
|
|
11
11
|
authFlowCancelled: () => void;
|
|
12
12
|
emailVerificationResult: (param: boolean, email: string) => void;
|
|
13
13
|
smsVerificationResult: (param: boolean, phone: PhoneData) => void;
|
|
14
|
-
embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined) => void;
|
|
14
|
+
embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined, authToken: string | undefined) => void;
|
|
15
15
|
embeddedWalletFailed: (error: unknown) => void;
|
|
16
16
|
passkeyRecoveryCompleted: (wallet: Wallet) => void;
|
|
17
17
|
passkeyRecoveryFailed: (error: unknown) => void;
|