@dynamic-labs/sdk-react-core 2.0.0-alpha.19 → 2.0.0-alpha.20
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 +9 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/PhoneNumberField/PhoneNumberField.cjs +3 -2
- package/src/lib/components/PhoneNumberField/PhoneNumberField.js +3 -2
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +5 -4
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +5 -4
- package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedUserFieldIcon/VerifiedUserFieldIcon.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedUserFieldIcon/VerifiedUserFieldIcon.d.ts +2 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/components/VerifiedUserFieldIcon/VerifiedUserFieldIcon.js +1 -1
- package/src/lib/locale/en/translation.cjs +20 -0
- package/src/lib/locale/en/translation.d.ts +20 -0
- package/src/lib/locale/en/translation.js +20 -0
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +2 -1
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +2 -1
- package/src/lib/views/LoginView/LoginView.cjs +11 -6
- package/src/lib/views/LoginView/LoginView.js +11 -6
- package/src/lib/views/LoginView/sections/ToggleableSection/ToggleableSection.cjs +1 -1
- package/src/lib/views/LoginView/sections/ToggleableSection/ToggleableSection.d.ts +2 -0
- package/src/lib/views/LoginView/sections/ToggleableSection/ToggleableSection.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2024-03-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* prevent solflare connect popping up on page refresh when connected ([#5032](https://github.com/dynamic-labs/DynamicAuth/issues/5032)) ([28175a9](https://github.com/dynamic-labs/DynamicAuth/commit/28175a9af43f3e7f2cab30148563eaf5573477d1))
|
|
8
|
+
* show correct user identifier in onboarding view ([#5021](https://github.com/dynamic-labs/DynamicAuth/issues/5021)) ([c84747f](https://github.com/dynamic-labs/DynamicAuth/commit/c84747f01eb2a0a827ca48e62f03739d4e6df136))
|
|
9
|
+
* use address as the wallet client account ([#5037](https://github.com/dynamic-labs/DynamicAuth/issues/5037)) ([287631e](https://github.com/dynamic-labs/DynamicAuth/commit/287631e9a027e3a39ee2ad6b45ca404febd03929))
|
|
10
|
+
|
|
2
11
|
## [2.0.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2024-03-19)
|
|
3
12
|
|
|
4
13
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.20",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/ethereum": "2.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/iconic": "2.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/logger": "2.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "2.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/rpc-provider-solana": "2.0.0-alpha.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "2.0.0-alpha.
|
|
27
|
-
"@dynamic-labs/types": "2.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/utils": "2.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.
|
|
20
|
+
"@dynamic-labs/ethereum": "2.0.0-alpha.20",
|
|
21
|
+
"@dynamic-labs/iconic": "2.0.0-alpha.20",
|
|
22
|
+
"@dynamic-labs/logger": "2.0.0-alpha.20",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "2.0.0-alpha.20",
|
|
24
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.20",
|
|
25
|
+
"@dynamic-labs/rpc-provider-solana": "2.0.0-alpha.20",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "2.0.0-alpha.20",
|
|
27
|
+
"@dynamic-labs/types": "2.0.0-alpha.20",
|
|
28
|
+
"@dynamic-labs/utils": "2.0.0-alpha.20",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.0.0-alpha.20",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.0.0-alpha.20",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.0.0-alpha.20",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactInternationalPhone = require('react-international-phone');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
8
9
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
9
10
|
require('../../events/dynamicEvents.cjs');
|
|
10
11
|
require('../../../../_virtual/_tslib.cjs');
|
|
@@ -35,7 +36,6 @@ require('../../context/WalletContext/WalletContext.cjs');
|
|
|
35
36
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
36
37
|
require('@dynamic-labs/types');
|
|
37
38
|
require('yup');
|
|
38
|
-
require('react-i18next');
|
|
39
39
|
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
40
40
|
require('../../context/MockContext/MockContext.cjs');
|
|
41
41
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
@@ -79,6 +79,7 @@ require('@hcaptcha/react-hcaptcha');
|
|
|
79
79
|
require('../../locale/locale.cjs');
|
|
80
80
|
|
|
81
81
|
const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendRight, setIsFocused, setIsHovered, initialPhone, onBlur, }) => {
|
|
82
|
+
const { t } = reactI18next.useTranslation();
|
|
82
83
|
const countryInputRef = React.useRef(null);
|
|
83
84
|
const [countryDropdownOpen, setCountryDropdownOpen] = React.useState(false);
|
|
84
85
|
const anchorRef = React.useRef(null);
|
|
@@ -95,7 +96,7 @@ const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendR
|
|
|
95
96
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
96
97
|
}, ref: anchorRef, children: [jsxRuntime.jsxs("div", { className: classNames.classNames('phone-number-field__fields__country-code', {
|
|
97
98
|
'phone-number-field__fields__country-code--disabled': isLoading || disabled,
|
|
98
|
-
}), 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', children: label !== null && label !== void 0 ? label : '
|
|
99
|
+
}), 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: {
|
|
99
100
|
anchorOrigin: 'bottom-left',
|
|
100
101
|
anchorRef,
|
|
101
102
|
}, mobileTitle: 'Select country', dropdownClassName: 'phone-number-field__dropdown', children: jsxRuntime.jsx("div", { className: 'phone-number-field__dropdown__items', ref: onMenuDisplayToggle, children: filteredCountries.map((countryData) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useRef, useState } from 'react';
|
|
3
3
|
import { FlagImage, parseCountry } from 'react-international-phone';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
5
6
|
import '../../events/dynamicEvents.js';
|
|
6
7
|
import '../../../../_virtual/_tslib.js';
|
|
@@ -31,7 +32,6 @@ import '../../context/WalletContext/WalletContext.js';
|
|
|
31
32
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
32
33
|
import '@dynamic-labs/types';
|
|
33
34
|
import 'yup';
|
|
34
|
-
import 'react-i18next';
|
|
35
35
|
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
36
36
|
import '../../context/MockContext/MockContext.js';
|
|
37
37
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
@@ -75,6 +75,7 @@ import '@hcaptcha/react-hcaptcha';
|
|
|
75
75
|
import '../../locale/locale.js';
|
|
76
76
|
|
|
77
77
|
const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendRight, setIsFocused, setIsHovered, initialPhone, onBlur, }) => {
|
|
78
|
+
const { t } = useTranslation();
|
|
78
79
|
const countryInputRef = useRef(null);
|
|
79
80
|
const [countryDropdownOpen, setCountryDropdownOpen] = useState(false);
|
|
80
81
|
const anchorRef = useRef(null);
|
|
@@ -91,7 +92,7 @@ const PhoneNumberField = ({ isLoading, disabled, error, label, onUpdate, appendR
|
|
|
91
92
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
92
93
|
}, ref: anchorRef, children: [jsxs("div", { className: classNames('phone-number-field__fields__country-code', {
|
|
93
94
|
'phone-number-field__fields__country-code--disabled': isLoading || disabled,
|
|
94
|
-
}), 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', children: label !== null && label !== void 0 ? label : '
|
|
95
|
+
}), 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: {
|
|
95
96
|
anchorOrigin: 'bottom-left',
|
|
96
97
|
anchorRef,
|
|
97
98
|
}, mobileTitle: 'Select country', dropdownClassName: 'phone-number-field__dropdown', children: jsx("div", { className: 'phone-number-field__dropdown__items', ref: onMenuDisplayToggle, children: filteredCountries.map((countryData) => {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var reactI18next = require('react-i18next');
|
|
6
7
|
require('react');
|
|
7
8
|
require('../../../../events/dynamicEvents.cjs');
|
|
8
9
|
require('../../../../../../_virtual/_tslib.cjs');
|
|
@@ -35,7 +36,6 @@ require('../../../../context/WalletContext/WalletContext.cjs');
|
|
|
35
36
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
36
37
|
require('@dynamic-labs/types');
|
|
37
38
|
require('yup');
|
|
38
|
-
require('react-i18next');
|
|
39
39
|
require('../../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
40
40
|
require('../../../../context/MockContext/MockContext.cjs');
|
|
41
41
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
@@ -80,6 +80,7 @@ require('../../../../locale/locale.cjs');
|
|
|
80
80
|
const UserProfileField = ({ name, label, value, copykey, }) => {
|
|
81
81
|
var _a, _b;
|
|
82
82
|
const { user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
83
|
+
const { t } = reactI18next.useTranslation();
|
|
83
84
|
const isEmpty = value === '';
|
|
84
85
|
const isPhoneNumber = name === 'phoneNumber' && typeof value === 'string';
|
|
85
86
|
const isVerifiedEmail = name === 'email' &&
|
|
@@ -89,9 +90,9 @@ const UserProfileField = ({ name, label, value, copykey, }) => {
|
|
|
89
90
|
(user === null || user === void 0 ? void 0 : user.phoneNumber) &&
|
|
90
91
|
((_b = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.some((cred) => `+${cred.phoneCountryCode}${cred.phoneNumber}` === value));
|
|
91
92
|
const toolTipContent = isVerifiedEmail
|
|
92
|
-
? '
|
|
93
|
-
: '
|
|
94
|
-
return (jsxRuntime.jsxs("div", { className: 'user-profile-field', children: [label && (jsxRuntime.jsx(Typography.Typography, { as: 'h6', color: 'secondary', weight: 'regular', variant: 'body_small', copykey: copykey, children: label })), jsxRuntime.jsxs("div", { className: 'user-profile-field__value', children: [jsxRuntime.jsx(Typography.Typography, { color: isEmpty ? 'tertiary' : 'primary', as: 'p', weight: 'regular', variant: 'body_normal', children: isPhoneNumber ? formatPhone.formatPhone(value) : value }), (isVerifiedEmail || isVerifiedPhoneNumber) && (jsxRuntime.jsx(VerifiedUserFieldIcon.VerifiedUserFieldIcon, { className: 'user-profile-field__verify-icon', overwriteTooltipProps: { as: 'div' }, tooltipContent: toolTipContent }))] })] }));
|
|
93
|
+
? t('dyn_user_profile.tooltips.verified_email')
|
|
94
|
+
: t('dyn_user_profile.tooltips.verified_phone');
|
|
95
|
+
return (jsxRuntime.jsxs("div", { className: 'user-profile-field', children: [label && (jsxRuntime.jsx(Typography.Typography, { as: 'h6', color: 'secondary', weight: 'regular', variant: 'body_small', copykey: copykey, children: label })), jsxRuntime.jsxs("div", { className: 'user-profile-field__value', children: [jsxRuntime.jsx(Typography.Typography, { color: isEmpty ? 'tertiary' : 'primary', as: 'p', weight: 'regular', variant: 'body_normal', children: isPhoneNumber ? formatPhone.formatPhone(value) : value }), (isVerifiedEmail || isVerifiedPhoneNumber) && (jsxRuntime.jsx(VerifiedUserFieldIcon.VerifiedUserFieldIcon, { className: 'user-profile-field__verify-icon', overwriteTooltipProps: { as: 'div' }, tooltipContent: toolTipContent, copykey: 'dyn_user_profile.tooltips' }))] })] }));
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
exports.UserProfileField = UserProfileField;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
2
3
|
import 'react';
|
|
3
4
|
import '../../../../events/dynamicEvents.js';
|
|
4
5
|
import '../../../../../../_virtual/_tslib.js';
|
|
@@ -31,7 +32,6 @@ import '../../../../context/WalletContext/WalletContext.js';
|
|
|
31
32
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
32
33
|
import '@dynamic-labs/types';
|
|
33
34
|
import 'yup';
|
|
34
|
-
import 'react-i18next';
|
|
35
35
|
import '../../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
36
36
|
import '../../../../context/MockContext/MockContext.js';
|
|
37
37
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
@@ -76,6 +76,7 @@ import '../../../../locale/locale.js';
|
|
|
76
76
|
const UserProfileField = ({ name, label, value, copykey, }) => {
|
|
77
77
|
var _a, _b;
|
|
78
78
|
const { user } = useInternalDynamicContext();
|
|
79
|
+
const { t } = useTranslation();
|
|
79
80
|
const isEmpty = value === '';
|
|
80
81
|
const isPhoneNumber = name === 'phoneNumber' && typeof value === 'string';
|
|
81
82
|
const isVerifiedEmail = name === 'email' &&
|
|
@@ -85,9 +86,9 @@ const UserProfileField = ({ name, label, value, copykey, }) => {
|
|
|
85
86
|
(user === null || user === void 0 ? void 0 : user.phoneNumber) &&
|
|
86
87
|
((_b = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.some((cred) => `+${cred.phoneCountryCode}${cred.phoneNumber}` === value));
|
|
87
88
|
const toolTipContent = isVerifiedEmail
|
|
88
|
-
? '
|
|
89
|
-
: '
|
|
90
|
-
return (jsxs("div", { className: 'user-profile-field', children: [label && (jsx(Typography, { as: 'h6', color: 'secondary', weight: 'regular', variant: 'body_small', copykey: copykey, children: label })), jsxs("div", { className: 'user-profile-field__value', children: [jsx(Typography, { color: isEmpty ? 'tertiary' : 'primary', as: 'p', weight: 'regular', variant: 'body_normal', children: isPhoneNumber ? formatPhone(value) : value }), (isVerifiedEmail || isVerifiedPhoneNumber) && (jsx(VerifiedUserFieldIcon, { className: 'user-profile-field__verify-icon', overwriteTooltipProps: { as: 'div' }, tooltipContent: toolTipContent }))] })] }));
|
|
89
|
+
? t('dyn_user_profile.tooltips.verified_email')
|
|
90
|
+
: t('dyn_user_profile.tooltips.verified_phone');
|
|
91
|
+
return (jsxs("div", { className: 'user-profile-field', children: [label && (jsx(Typography, { as: 'h6', color: 'secondary', weight: 'regular', variant: 'body_small', copykey: copykey, children: label })), jsxs("div", { className: 'user-profile-field__value', children: [jsx(Typography, { color: isEmpty ? 'tertiary' : 'primary', as: 'p', weight: 'regular', variant: 'body_normal', children: isPhoneNumber ? formatPhone(value) : value }), (isVerifiedEmail || isVerifiedPhoneNumber) && (jsx(VerifiedUserFieldIcon, { className: 'user-profile-field__verify-icon', overwriteTooltipProps: { as: 'div' }, tooltipContent: toolTipContent, copykey: 'dyn_user_profile.tooltips' }))] })] }));
|
|
91
92
|
};
|
|
92
93
|
|
|
93
94
|
export { UserProfileField };
|
|
@@ -21,6 +21,6 @@ var Tooltip = require('../../../../../Tooltip/Tooltip.cjs');
|
|
|
21
21
|
var Typography = require('../../../../../Typography/Typography.cjs');
|
|
22
22
|
|
|
23
23
|
const VerifiedFieldTooltip = (content) => (jsxRuntime.jsx(Typography.Typography, { variant: 'numbers_medium', color: 'tooltip', children: content }));
|
|
24
|
-
const VerifiedUserFieldIcon = ({ className, overwriteTooltipProps, tooltipContent, }) => (jsxRuntime.jsx(Tooltip.Tooltip, Object.assign({ content: VerifiedFieldTooltip(tooltipContent) }, overwriteTooltipProps, { children: jsxRuntime.jsx(checkCircle.ReactComponent, { className: classNames.classNames('dynamic-verified-icon', className) }) })));
|
|
24
|
+
const VerifiedUserFieldIcon = ({ className, overwriteTooltipProps, tooltipContent, copykey, }) => (jsxRuntime.jsx(Tooltip.Tooltip, Object.assign({ content: VerifiedFieldTooltip(tooltipContent) }, overwriteTooltipProps, { copykey: copykey, children: jsxRuntime.jsx(checkCircle.ReactComponent, { className: classNames.classNames('dynamic-verified-icon', className) }) })));
|
|
25
25
|
|
|
26
26
|
exports.VerifiedUserFieldIcon = VerifiedUserFieldIcon;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { CopyKey } from '../../../../../../shared';
|
|
2
3
|
import { TooltipProps } from '../../../../../Tooltip/Tooltip';
|
|
3
4
|
export type VerifiedUserFieldIconProps = {
|
|
4
5
|
className?: string;
|
|
5
6
|
overwriteTooltipProps?: Partial<TooltipProps>;
|
|
6
7
|
tooltipContent: string;
|
|
7
|
-
};
|
|
8
|
+
} & CopyKey;
|
|
8
9
|
export declare const VerifiedUserFieldIcon: FC<VerifiedUserFieldIconProps>;
|
|
@@ -17,6 +17,6 @@ import { Tooltip } from '../../../../../Tooltip/Tooltip.js';
|
|
|
17
17
|
import { Typography } from '../../../../../Typography/Typography.js';
|
|
18
18
|
|
|
19
19
|
const VerifiedFieldTooltip = (content) => (jsx(Typography, { variant: 'numbers_medium', color: 'tooltip', children: content }));
|
|
20
|
-
const VerifiedUserFieldIcon = ({ className, overwriteTooltipProps, tooltipContent, }) => (jsx(Tooltip, Object.assign({ content: VerifiedFieldTooltip(tooltipContent) }, overwriteTooltipProps, { children: jsx(SvgCheckCircle, { className: classNames('dynamic-verified-icon', className) }) })));
|
|
20
|
+
const VerifiedUserFieldIcon = ({ className, overwriteTooltipProps, tooltipContent, copykey, }) => (jsx(Tooltip, Object.assign({ content: VerifiedFieldTooltip(tooltipContent) }, overwriteTooltipProps, { copykey: copykey, children: jsx(SvgCheckCircle, { className: classNames('dynamic-verified-icon', className) }) })));
|
|
21
21
|
|
|
22
22
|
export { VerifiedUserFieldIcon };
|
|
@@ -531,6 +531,12 @@ const translation = {
|
|
|
531
531
|
label: 'Continue'
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
|
+
email_or_phone: {
|
|
535
|
+
use_email: 'Use email',
|
|
536
|
+
use_phone: 'Use phone',
|
|
537
|
+
prefer_email: 'Prefer email sign up?',
|
|
538
|
+
prefer_phone: 'Prefer phone number sign up?',
|
|
539
|
+
},
|
|
534
540
|
helper: {
|
|
535
541
|
all_wallet_list: 'Get your first wallet',
|
|
536
542
|
email_form: {
|
|
@@ -598,6 +604,12 @@ const translation = {
|
|
|
598
604
|
label: 'Continue',
|
|
599
605
|
},
|
|
600
606
|
},
|
|
607
|
+
email_or_phone: {
|
|
608
|
+
use_email: 'Use email',
|
|
609
|
+
use_phone: 'Use phone',
|
|
610
|
+
prefer_email: 'Prefer email sign up?',
|
|
611
|
+
prefer_phone: 'Prefer phone number sign up?',
|
|
612
|
+
},
|
|
601
613
|
helper: {
|
|
602
614
|
all_wallet_list: 'Get your first wallet',
|
|
603
615
|
email_form: {
|
|
@@ -1648,6 +1660,10 @@ const translation = {
|
|
|
1648
1660
|
social_accounts: {
|
|
1649
1661
|
title: 'Social accounts',
|
|
1650
1662
|
},
|
|
1663
|
+
tooltips: {
|
|
1664
|
+
verified_email: 'This email is verified',
|
|
1665
|
+
verified_phone: 'This phone number is verified',
|
|
1666
|
+
},
|
|
1651
1667
|
wallets: {
|
|
1652
1668
|
link_wallet_button: 'Link wallet',
|
|
1653
1669
|
title: 'Wallets',
|
|
@@ -1661,6 +1677,10 @@ const translation = {
|
|
|
1661
1677
|
social_accounts: {
|
|
1662
1678
|
title: 'Social accounts',
|
|
1663
1679
|
},
|
|
1680
|
+
tooltips: {
|
|
1681
|
+
verified_email: 'This email is verified',
|
|
1682
|
+
verified_phone: 'This phone number is verified',
|
|
1683
|
+
},
|
|
1664
1684
|
wallets: {
|
|
1665
1685
|
link_wallet_button: 'Link wallet',
|
|
1666
1686
|
title: 'Want to add a wallet?',
|
|
@@ -526,6 +526,12 @@ export declare const translation: {
|
|
|
526
526
|
label: 'Continue'
|
|
527
527
|
}
|
|
528
528
|
},
|
|
529
|
+
email_or_phone: {
|
|
530
|
+
use_email: 'Use email',
|
|
531
|
+
use_phone: 'Use phone',
|
|
532
|
+
prefer_email: 'Prefer email sign up?',
|
|
533
|
+
prefer_phone: 'Prefer phone number sign up?',
|
|
534
|
+
},
|
|
529
535
|
helper: {
|
|
530
536
|
all_wallet_list: 'Get your first wallet',
|
|
531
537
|
email_form: {
|
|
@@ -593,6 +599,12 @@ export declare const translation: {
|
|
|
593
599
|
label: string;
|
|
594
600
|
};
|
|
595
601
|
};
|
|
602
|
+
email_or_phone: {
|
|
603
|
+
use_email: string;
|
|
604
|
+
use_phone: string;
|
|
605
|
+
prefer_email: string;
|
|
606
|
+
prefer_phone: string;
|
|
607
|
+
};
|
|
596
608
|
helper: {
|
|
597
609
|
all_wallet_list: string;
|
|
598
610
|
email_form: {
|
|
@@ -1643,6 +1655,10 @@ export declare const translation: {
|
|
|
1643
1655
|
social_accounts: {
|
|
1644
1656
|
title: 'Social accounts',
|
|
1645
1657
|
},
|
|
1658
|
+
tooltips: {
|
|
1659
|
+
verified_email: 'This email is verified',
|
|
1660
|
+
verified_phone: 'This phone number is verified',
|
|
1661
|
+
},
|
|
1646
1662
|
wallets: {
|
|
1647
1663
|
link_wallet_button: 'Link wallet',
|
|
1648
1664
|
title: 'Wallets',
|
|
@@ -1656,6 +1672,10 @@ export declare const translation: {
|
|
|
1656
1672
|
social_accounts: {
|
|
1657
1673
|
title: string;
|
|
1658
1674
|
};
|
|
1675
|
+
tooltips: {
|
|
1676
|
+
verified_email: string;
|
|
1677
|
+
verified_phone: string;
|
|
1678
|
+
};
|
|
1659
1679
|
wallets: {
|
|
1660
1680
|
link_wallet_button: string;
|
|
1661
1681
|
title: string;
|
|
@@ -527,6 +527,12 @@ const translation = {
|
|
|
527
527
|
label: 'Continue'
|
|
528
528
|
}
|
|
529
529
|
},
|
|
530
|
+
email_or_phone: {
|
|
531
|
+
use_email: 'Use email',
|
|
532
|
+
use_phone: 'Use phone',
|
|
533
|
+
prefer_email: 'Prefer email sign up?',
|
|
534
|
+
prefer_phone: 'Prefer phone number sign up?',
|
|
535
|
+
},
|
|
530
536
|
helper: {
|
|
531
537
|
all_wallet_list: 'Get your first wallet',
|
|
532
538
|
email_form: {
|
|
@@ -594,6 +600,12 @@ const translation = {
|
|
|
594
600
|
label: 'Continue',
|
|
595
601
|
},
|
|
596
602
|
},
|
|
603
|
+
email_or_phone: {
|
|
604
|
+
use_email: 'Use email',
|
|
605
|
+
use_phone: 'Use phone',
|
|
606
|
+
prefer_email: 'Prefer email sign up?',
|
|
607
|
+
prefer_phone: 'Prefer phone number sign up?',
|
|
608
|
+
},
|
|
597
609
|
helper: {
|
|
598
610
|
all_wallet_list: 'Get your first wallet',
|
|
599
611
|
email_form: {
|
|
@@ -1644,6 +1656,10 @@ const translation = {
|
|
|
1644
1656
|
social_accounts: {
|
|
1645
1657
|
title: 'Social accounts',
|
|
1646
1658
|
},
|
|
1659
|
+
tooltips: {
|
|
1660
|
+
verified_email: 'This email is verified',
|
|
1661
|
+
verified_phone: 'This phone number is verified',
|
|
1662
|
+
},
|
|
1647
1663
|
wallets: {
|
|
1648
1664
|
link_wallet_button: 'Link wallet',
|
|
1649
1665
|
title: 'Wallets',
|
|
@@ -1657,6 +1673,10 @@ const translation = {
|
|
|
1657
1673
|
social_accounts: {
|
|
1658
1674
|
title: 'Social accounts',
|
|
1659
1675
|
},
|
|
1676
|
+
tooltips: {
|
|
1677
|
+
verified_email: 'This email is verified',
|
|
1678
|
+
verified_phone: 'This phone number is verified',
|
|
1679
|
+
},
|
|
1660
1680
|
wallets: {
|
|
1661
1681
|
link_wallet_button: 'Link wallet',
|
|
1662
1682
|
title: 'Want to add a wallet?',
|
|
@@ -26,6 +26,7 @@ require('../../context/ErrorContext/ErrorContext.cjs');
|
|
|
26
26
|
var createUserProfile = require('../../utils/functions/createUserProfile/createUserProfile.cjs');
|
|
27
27
|
require('@dynamic-labs/multi-wallet');
|
|
28
28
|
require('react-international-phone');
|
|
29
|
+
var getUserIdentifier = require('../../utils/functions/getUserIdentifier/getUserIdentifier.cjs');
|
|
29
30
|
require('viem');
|
|
30
31
|
require('viem/chains');
|
|
31
32
|
require('../../config/ApiEndpoint.cjs');
|
|
@@ -89,7 +90,7 @@ const CollectUserDataViewNoWallet = ({ userIdentification, userIdentificationOve
|
|
|
89
90
|
return null;
|
|
90
91
|
}
|
|
91
92
|
const userProfile = createUserProfile.createUserProfile(decodedOnboardingOnlyToken);
|
|
92
|
-
return (jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet', "data-testid": 'collect-user-data-login-no-wallet', children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'collect-user-data-login-no-wallet__main-img', src: onboardingImageUrl, alt: 'onboarding' })), jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__user-info-container', children: [jsxRuntime.jsx("div", { className: 'collect-user-data-login-no-wallet__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: userProfile }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data-login-no-wallet__user-identification', children: (_a = userIdentificationOverride !== null && userIdentificationOverride !== void 0 ? userIdentificationOverride : userProfile[userIdentification]) !== null && _a !== void 0 ? _a :
|
|
93
|
+
return (jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet', "data-testid": 'collect-user-data-login-no-wallet', children: [onboardingImageUrl && (jsxRuntime.jsx("img", { className: 'collect-user-data-login-no-wallet__main-img', src: onboardingImageUrl, alt: 'onboarding' })), jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__user-info-container', children: [jsxRuntime.jsx("div", { className: 'collect-user-data-login-no-wallet__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: userProfile }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data-login-no-wallet__user-identification', children: (_a = userIdentificationOverride !== null && userIdentificationOverride !== void 0 ? userIdentificationOverride : userProfile[userIdentification]) !== null && _a !== void 0 ? _a : getUserIdentifier.getUserIdentifier(userProfile) })] }), jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__form', children: [jsxRuntime.jsx("div", { className: 'collect-user-data-login-no-wallet__success-icon', children: jsxRuntime.jsx(Icon.Icon, { color: 'text-primary', size: 'large', children: jsxRuntime.jsx(checkConnection.ReactComponent, {}) }) }), jsxRuntime.jsx(OnboardingUserDataForm.OnboardingUserDataForm, { userProfile: userProfile, children: jsxRuntime.jsxs("div", { className: 'collect-user-data-login-no-wallet__welcome-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', className: 'collect-user-data-login-no-wallet__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
93
94
|
t('dyn_collect_user_data.greeting', { appName }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.description', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeMessage) ||
|
|
94
95
|
t('dyn_collect_user_data.description') })] }) }), jsxRuntime.jsx(TextButton.TextButton, { className: 'collect-user-data-login-no-wallet__log-out', onClick: handleLogOut, copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
95
96
|
};
|
|
@@ -22,6 +22,7 @@ import '../../context/ErrorContext/ErrorContext.js';
|
|
|
22
22
|
import { createUserProfile } from '../../utils/functions/createUserProfile/createUserProfile.js';
|
|
23
23
|
import '@dynamic-labs/multi-wallet';
|
|
24
24
|
import 'react-international-phone';
|
|
25
|
+
import { getUserIdentifier } from '../../utils/functions/getUserIdentifier/getUserIdentifier.js';
|
|
25
26
|
import 'viem';
|
|
26
27
|
import 'viem/chains';
|
|
27
28
|
import '../../config/ApiEndpoint.js';
|
|
@@ -85,7 +86,7 @@ const CollectUserDataViewNoWallet = ({ userIdentification, userIdentificationOve
|
|
|
85
86
|
return null;
|
|
86
87
|
}
|
|
87
88
|
const userProfile = createUserProfile(decodedOnboardingOnlyToken);
|
|
88
|
-
return (jsxs("div", { className: 'collect-user-data-login-no-wallet', "data-testid": 'collect-user-data-login-no-wallet', children: [onboardingImageUrl && (jsx("img", { className: 'collect-user-data-login-no-wallet__main-img', src: onboardingImageUrl, alt: 'onboarding' })), jsxs("div", { className: 'collect-user-data-login-no-wallet__user-info-container', children: [jsx("div", { className: 'collect-user-data-login-no-wallet__icon-container', children: jsx(UserAvatar, { user: userProfile }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data-login-no-wallet__user-identification', children: (_a = userIdentificationOverride !== null && userIdentificationOverride !== void 0 ? userIdentificationOverride : userProfile[userIdentification]) !== null && _a !== void 0 ? _a :
|
|
89
|
+
return (jsxs("div", { className: 'collect-user-data-login-no-wallet', "data-testid": 'collect-user-data-login-no-wallet', children: [onboardingImageUrl && (jsx("img", { className: 'collect-user-data-login-no-wallet__main-img', src: onboardingImageUrl, alt: 'onboarding' })), jsxs("div", { className: 'collect-user-data-login-no-wallet__user-info-container', children: [jsx("div", { className: 'collect-user-data-login-no-wallet__icon-container', children: jsx(UserAvatar, { user: userProfile }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', className: 'collect-user-data-login-no-wallet__user-identification', children: (_a = userIdentificationOverride !== null && userIdentificationOverride !== void 0 ? userIdentificationOverride : userProfile[userIdentification]) !== null && _a !== void 0 ? _a : getUserIdentifier(userProfile) })] }), jsxs("div", { className: 'collect-user-data-login-no-wallet__form', children: [jsx("div", { className: 'collect-user-data-login-no-wallet__success-icon', children: jsx(Icon, { color: 'text-primary', size: 'large', children: jsx(SvgCheckConnection, {}) }) }), jsx(OnboardingUserDataForm, { userProfile: userProfile, children: jsxs("div", { className: 'collect-user-data-login-no-wallet__welcome-container', children: [jsx(Typography, { variant: 'title', color: 'primary', className: 'collect-user-data-login-no-wallet__welcome-title', copykey: 'dyn_collect_user_data.greeting', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeHeader) ||
|
|
89
90
|
t('dyn_collect_user_data.greeting', { appName }) }), jsx(Typography, { variant: 'body_normal', weight: 'regular', color: 'secondary', copykey: 'dyn_collect_user_data.description', children: (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general.collectUserDataWelcomeMessage) ||
|
|
90
91
|
t('dyn_collect_user_data.description') })] }) }), jsx(TextButton, { className: 'collect-user-data-login-no-wallet__log-out', onClick: handleLogOut, copykey: 'dyn_collect_user_data.log_out_button', children: t('dyn_collect_user_data.log_out_button') })] })] }));
|
|
91
92
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
7
8
|
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
8
9
|
var utils = require('@dynamic-labs/utils');
|
|
9
10
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
@@ -34,7 +35,6 @@ require('../../context/WalletContext/WalletContext.cjs');
|
|
|
34
35
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
35
36
|
require('@dynamic-labs/types');
|
|
36
37
|
require('yup');
|
|
37
|
-
require('react-i18next');
|
|
38
38
|
require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
39
39
|
require('../../context/MockContext/MockContext.cjs');
|
|
40
40
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
@@ -90,6 +90,7 @@ const LoginView = () => {
|
|
|
90
90
|
const { loading } = LoadingContext.useLoadingContext();
|
|
91
91
|
const { view, setView } = ViewContext.useViewContext();
|
|
92
92
|
const { isWalletOnly, loginViewSections } = useLoginView.useLoginView();
|
|
93
|
+
const { t } = reactI18next.useTranslation();
|
|
93
94
|
const [showWalletList, setShowWalletList] = React.useState(isWalletOnly);
|
|
94
95
|
const [isLoading, setIsLoading] = React.useState(loading);
|
|
95
96
|
React.useEffect(() => {
|
|
@@ -122,14 +123,18 @@ const LoginView = () => {
|
|
|
122
123
|
case sdkApi.SdkViewSectionType.EmailAndPhone:
|
|
123
124
|
return (jsxRuntime.jsx(ToggleableSection.ToggleableSection, { sections: [
|
|
124
125
|
{
|
|
125
|
-
button: '
|
|
126
|
+
button: t('dyn_login.email_or_phone.use_phone'),
|
|
127
|
+
buttonCopyKey: 'dyn_login.email_or_phone.use_phone',
|
|
126
128
|
component: (jsxRuntime.jsx(LoginEmailForm.LoginEmailForm, { onSubmit: () => setIsLoading(true), onSubmitError: () => setIsLoading(false), isLoading: isLoading })),
|
|
127
|
-
label: '
|
|
129
|
+
label: t('dyn_login.email_or_phone.prefer_phone'),
|
|
130
|
+
labelCopyKey: 'dyn_login.email_or_phone.prefer_phone',
|
|
128
131
|
},
|
|
129
132
|
{
|
|
130
|
-
button: '
|
|
133
|
+
button: t('dyn_login.email_or_phone.use_email'),
|
|
134
|
+
buttonCopyKey: 'dyn_login.email_or_phone.use_email',
|
|
131
135
|
component: (jsxRuntime.jsx(PhoneNumberSignInSection.PhoneNumberSignInSection, { onSubmit: () => setIsLoading(true), onSubmitError: () => setIsLoading(false), isLoading: isLoading })),
|
|
132
|
-
label: '
|
|
136
|
+
label: t('dyn_login.email_or_phone.prefer_email'),
|
|
137
|
+
labelCopyKey: 'dyn_login.email_or_phone.prefer_email',
|
|
133
138
|
},
|
|
134
139
|
] }, `${viewSection.type}_${index}`));
|
|
135
140
|
case sdkApi.SdkViewSectionType.Wallet:
|
|
@@ -144,7 +149,7 @@ const LoginView = () => {
|
|
|
144
149
|
default:
|
|
145
150
|
return null;
|
|
146
151
|
}
|
|
147
|
-
}), [loginViewSections, isLoading, numOfWallets, setView]);
|
|
152
|
+
}), [loginViewSections, isLoading, t, numOfWallets, setView]);
|
|
148
153
|
if (showWalletList) {
|
|
149
154
|
return jsxRuntime.jsx(WalletList.WalletList, {});
|
|
150
155
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useState, useEffect, useMemo } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
3
4
|
import { SdkViewSectionType } from '@dynamic-labs/sdk-api';
|
|
4
5
|
import { isMobile } from '@dynamic-labs/utils';
|
|
5
6
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
@@ -30,7 +31,6 @@ import '../../context/WalletContext/WalletContext.js';
|
|
|
30
31
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
31
32
|
import '@dynamic-labs/types';
|
|
32
33
|
import 'yup';
|
|
33
|
-
import 'react-i18next';
|
|
34
34
|
import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
35
35
|
import '../../context/MockContext/MockContext.js';
|
|
36
36
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
@@ -86,6 +86,7 @@ const LoginView = () => {
|
|
|
86
86
|
const { loading } = useLoadingContext();
|
|
87
87
|
const { view, setView } = useViewContext();
|
|
88
88
|
const { isWalletOnly, loginViewSections } = useLoginView();
|
|
89
|
+
const { t } = useTranslation();
|
|
89
90
|
const [showWalletList, setShowWalletList] = useState(isWalletOnly);
|
|
90
91
|
const [isLoading, setIsLoading] = useState(loading);
|
|
91
92
|
useEffect(() => {
|
|
@@ -118,14 +119,18 @@ const LoginView = () => {
|
|
|
118
119
|
case SdkViewSectionType.EmailAndPhone:
|
|
119
120
|
return (jsx(ToggleableSection, { sections: [
|
|
120
121
|
{
|
|
121
|
-
button: '
|
|
122
|
+
button: t('dyn_login.email_or_phone.use_phone'),
|
|
123
|
+
buttonCopyKey: 'dyn_login.email_or_phone.use_phone',
|
|
122
124
|
component: (jsx(LoginEmailForm, { onSubmit: () => setIsLoading(true), onSubmitError: () => setIsLoading(false), isLoading: isLoading })),
|
|
123
|
-
label: '
|
|
125
|
+
label: t('dyn_login.email_or_phone.prefer_phone'),
|
|
126
|
+
labelCopyKey: 'dyn_login.email_or_phone.prefer_phone',
|
|
124
127
|
},
|
|
125
128
|
{
|
|
126
|
-
button: '
|
|
129
|
+
button: t('dyn_login.email_or_phone.use_email'),
|
|
130
|
+
buttonCopyKey: 'dyn_login.email_or_phone.use_email',
|
|
127
131
|
component: (jsx(PhoneNumberSignInSection, { onSubmit: () => setIsLoading(true), onSubmitError: () => setIsLoading(false), isLoading: isLoading })),
|
|
128
|
-
label: '
|
|
132
|
+
label: t('dyn_login.email_or_phone.prefer_email'),
|
|
133
|
+
labelCopyKey: 'dyn_login.email_or_phone.prefer_email',
|
|
129
134
|
},
|
|
130
135
|
] }, `${viewSection.type}_${index}`));
|
|
131
136
|
case SdkViewSectionType.Wallet:
|
|
@@ -140,7 +145,7 @@ const LoginView = () => {
|
|
|
140
145
|
default:
|
|
141
146
|
return null;
|
|
142
147
|
}
|
|
143
|
-
}), [loginViewSections, isLoading, numOfWallets, setView]);
|
|
148
|
+
}), [loginViewSections, isLoading, t, numOfWallets, setView]);
|
|
144
149
|
if (showWalletList) {
|
|
145
150
|
return jsx(WalletList, {});
|
|
146
151
|
}
|
|
@@ -78,7 +78,7 @@ const ToggleableSection = ({ sections }) => {
|
|
|
78
78
|
/** When true, shows first section. When false, shows second */
|
|
79
79
|
const [showFirst, setShowFirst] = React.useState(true);
|
|
80
80
|
const section = showFirst ? sections[0] : sections[1];
|
|
81
|
-
return (jsxRuntime.jsxs("div", { className: 'toggleable-section', children: [section.component, jsxRuntime.jsxs("div", { className: 'toggleable-section__toggle-prompt', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', children: section.label }), jsxRuntime.jsx("button", { className: 'toggleable-section__toggle-prompt__button', onClick: () => setShowFirst(!showFirst), children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'brand-primary', className: 'toggleable-section__toggle-prompt__button__text', children: section.button }) })] })] }));
|
|
81
|
+
return (jsxRuntime.jsxs("div", { className: 'toggleable-section', children: [section.component, jsxRuntime.jsxs("div", { className: 'toggleable-section__toggle-prompt', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', copykey: section.labelCopyKey, children: section.label }), jsxRuntime.jsx("button", { className: 'toggleable-section__toggle-prompt__button', onClick: () => setShowFirst(!showFirst), children: jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'brand-primary', className: 'toggleable-section__toggle-prompt__button__text', copykey: section.buttonCopyKey, children: section.button }) })] })] }));
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
exports.ToggleableSection = ToggleableSection;
|
|
@@ -74,7 +74,7 @@ const ToggleableSection = ({ sections }) => {
|
|
|
74
74
|
/** When true, shows first section. When false, shows second */
|
|
75
75
|
const [showFirst, setShowFirst] = useState(true);
|
|
76
76
|
const section = showFirst ? sections[0] : sections[1];
|
|
77
|
-
return (jsxs("div", { className: 'toggleable-section', children: [section.component, jsxs("div", { className: 'toggleable-section__toggle-prompt', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', children: section.label }), jsx("button", { className: 'toggleable-section__toggle-prompt__button', onClick: () => setShowFirst(!showFirst), children: jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'brand-primary', className: 'toggleable-section__toggle-prompt__button__text', children: section.button }) })] })] }));
|
|
77
|
+
return (jsxs("div", { className: 'toggleable-section', children: [section.component, jsxs("div", { className: 'toggleable-section__toggle-prompt', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', copykey: section.labelCopyKey, children: section.label }), jsx("button", { className: 'toggleable-section__toggle-prompt__button', onClick: () => setShowFirst(!showFirst), children: jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'brand-primary', className: 'toggleable-section__toggle-prompt__button__text', copykey: section.buttonCopyKey, children: section.button }) })] })] }));
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export { ToggleableSection };
|