@dynamic-labs/sdk-react-core 2.3.4 → 2.3.5
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/UserProfile/UserProfile.cjs +5 -6
- package/src/lib/components/UserProfile/UserProfile.js +5 -6
- package/src/lib/context/DynamicContext/DynamicContext.cjs +25 -20
- package/src/lib/context/DynamicContext/DynamicContext.js +25 -20
- package/src/lib/shared/utils/hooks/index.d.ts +1 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.cjs +1 -1
- package/src/lib/views/CollectUserDataView/UserDataFields/UserField/UserField.js +1 -1
- package/src/lib/shared/utils/hooks/usePrefetch/index.d.ts +0 -1
- package/src/lib/shared/utils/hooks/usePrefetch/usePrefetch.cjs +0 -51
- package/src/lib/shared/utils/hooks/usePrefetch/usePrefetch.d.ts +0 -23
- package/src/lib/shared/utils/hooks/usePrefetch/usePrefetch.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [2.3.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.3.4...v2.3.5) (2024-07-22)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* show custom labels in the sdk ([#6352](https://github.com/dynamic-labs/DynamicAuth/issues/6352)) ([#6383](https://github.com/dynamic-labs/DynamicAuth/issues/6383)) ([287484b](https://github.com/dynamic-labs/DynamicAuth/commit/287484b252d69300a5003a88c26daf380621d3b5))
|
|
8
|
+
|
|
2
9
|
### [2.3.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.3.3...v2.3.4) (2024-07-19)
|
|
3
10
|
|
|
4
11
|
|
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.3.
|
|
3
|
+
"version": "2.3.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "2.3.
|
|
21
|
-
"@dynamic-labs/logger": "2.3.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.3.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.3.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.3.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.3.
|
|
26
|
-
"@dynamic-labs/store": "2.3.
|
|
27
|
-
"@dynamic-labs/types": "2.3.
|
|
28
|
-
"@dynamic-labs/utils": "2.3.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.3.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.3.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.3.
|
|
20
|
+
"@dynamic-labs/iconic": "2.3.5",
|
|
21
|
+
"@dynamic-labs/logger": "2.3.5",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.3.5",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.3.5",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.3.5",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.3.5",
|
|
26
|
+
"@dynamic-labs/store": "2.3.5",
|
|
27
|
+
"@dynamic-labs/types": "2.3.5",
|
|
28
|
+
"@dynamic-labs/utils": "2.3.5",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.3.5",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.3.5",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.3.5",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -128,7 +128,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
128
128
|
// if it's multiwallet, the wallet should appear in the wallets tab
|
|
129
129
|
// if there's a primary wallet, it will be displayed in the header
|
|
130
130
|
const wallet = !multiWallet && !primaryWallet && userWallets[0];
|
|
131
|
-
return (jsxRuntime.jsxs("div", { "data-testid": 'userProfile', className: classNames.classNames('user-profile', rootClassName), ref: containerRef, children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), wallet && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, { title: t('dyn_user_profile.my_wallet.title'), children: jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id) })), (allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, { title: t('dyn_user_profile.my_information.title'), children: jsxRuntime.jsx("div", { className: 'user-profile__fields', children: allUserFields.map(({ name, validationType, type }) => {
|
|
131
|
+
return (jsxRuntime.jsxs("div", { "data-testid": 'userProfile', className: classNames.classNames('user-profile', rootClassName), ref: containerRef, children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), wallet && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, { title: t('dyn_user_profile.my_wallet.title'), children: jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id) })), (allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, { title: t('dyn_user_profile.my_information.title'), children: jsxRuntime.jsx("div", { className: 'user-profile__fields', children: allUserFields.map(({ name, validationType, type, label }) => {
|
|
132
132
|
var _a, _b;
|
|
133
133
|
if (type === sdkApiCore.KycFieldType.Custom) {
|
|
134
134
|
const value = (_b = (_a = user.metadata) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : '';
|
|
@@ -137,11 +137,10 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
137
137
|
fieldValue = value.length > 0 ? 'Checked' : 'Unchecked';
|
|
138
138
|
return (jsxRuntime.jsx(UserProfileField.UserProfileField, { name: name, label: name, value: fieldValue }, name));
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
140
|
+
const { label: defaultLabel, key } = index$1.getValueByKey(fieldsConfig, name);
|
|
141
|
+
label !== null && label !== void 0 ? label : (label = defaultLabel);
|
|
142
|
+
const value = mapFieldKeyToValue(name);
|
|
143
|
+
return (jsxRuntime.jsx(UserProfileField.UserProfileField, { copykey: key, name: name, label: label, value: value }, name));
|
|
145
144
|
}) }) })), canLink && !multiWallet && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, { title: t('dyn_user_profile.wallets.title'), children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'link-wallet-button', onClick: addNewWallet, startSlot: jsxRuntime.jsx(add.ReactComponent, {}), showInternalLoading: false, children: jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_user_profile.wallets.link_wallet_button', children: t('dyn_user_profile.wallets.link_wallet_button') }) }) })), (providers === null || providers === void 0 ? void 0 : providers.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, { title: t('dyn_user_profile.social_accounts.title'), children: jsxRuntime.jsx("div", { className: 'user-profile__social-accounts', children: providers.map(({ provider }) => (jsxRuntime.jsx(UserProfileSocialAccount.UserProfileSocialAccount, { provider: provider }, provider))) }) }))] }));
|
|
146
145
|
};
|
|
147
146
|
|
|
@@ -124,7 +124,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
124
124
|
// if it's multiwallet, the wallet should appear in the wallets tab
|
|
125
125
|
// if there's a primary wallet, it will be displayed in the header
|
|
126
126
|
const wallet = !multiWallet && !primaryWallet && userWallets[0];
|
|
127
|
-
return (jsxs("div", { "data-testid": 'userProfile', className: classNames('user-profile', rootClassName), ref: containerRef, children: [error && jsx(ErrorContainer, { children: error }), wallet && (jsx(UserProfileSection, { title: t('dyn_user_profile.my_wallet.title'), children: jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id) })), (allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsx(UserProfileSection, { title: t('dyn_user_profile.my_information.title'), children: jsx("div", { className: 'user-profile__fields', children: allUserFields.map(({ name, validationType, type }) => {
|
|
127
|
+
return (jsxs("div", { "data-testid": 'userProfile', className: classNames('user-profile', rootClassName), ref: containerRef, children: [error && jsx(ErrorContainer, { children: error }), wallet && (jsx(UserProfileSection, { title: t('dyn_user_profile.my_wallet.title'), children: jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id) })), (allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsx(UserProfileSection, { title: t('dyn_user_profile.my_information.title'), children: jsx("div", { className: 'user-profile__fields', children: allUserFields.map(({ name, validationType, type, label }) => {
|
|
128
128
|
var _a, _b;
|
|
129
129
|
if (type === KycFieldType.Custom) {
|
|
130
130
|
const value = (_b = (_a = user.metadata) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : '';
|
|
@@ -133,11 +133,10 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
133
133
|
fieldValue = value.length > 0 ? 'Checked' : 'Unchecked';
|
|
134
134
|
return (jsx(UserProfileField, { name: name, label: name, value: fieldValue }, name));
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
136
|
+
const { label: defaultLabel, key } = getValueByKey(fieldsConfig, name);
|
|
137
|
+
label !== null && label !== void 0 ? label : (label = defaultLabel);
|
|
138
|
+
const value = mapFieldKeyToValue(name);
|
|
139
|
+
return (jsx(UserProfileField, { copykey: key, name: name, label: label, value: value }, name));
|
|
141
140
|
}) }) })), canLink && !multiWallet && (jsx(UserProfileSection, { title: t('dyn_user_profile.wallets.title'), children: jsx(TypographyButton, { dataTestId: 'link-wallet-button', onClick: addNewWallet, startSlot: jsx(SvgAdd, {}), showInternalLoading: false, children: jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_user_profile.wallets.link_wallet_button', children: t('dyn_user_profile.wallets.link_wallet_button') }) }) })), (providers === null || providers === void 0 ? void 0 : providers.length) > 0 && (jsx(UserProfileSection, { title: t('dyn_user_profile.social_accounts.title'), children: jsx("div", { className: 'user-profile__social-accounts', children: providers.map(({ provider }) => (jsx(UserProfileSocialAccount, { provider: provider }, provider))) }) }))] }));
|
|
142
141
|
};
|
|
143
142
|
|
|
@@ -25,7 +25,6 @@ var values = require('../../utils/constants/values.cjs');
|
|
|
25
25
|
var localStorage = require('../../shared/utils/classes/storage/localStorage.cjs');
|
|
26
26
|
var useGlobalLoading = require('../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs');
|
|
27
27
|
var useLocalStorage = require('../../shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
28
|
-
var usePrefetch = require('../../shared/utils/hooks/usePrefetch/usePrefetch.cjs');
|
|
29
28
|
require('../../shared/consts/index.cjs');
|
|
30
29
|
var CaptchaContext = require('../CaptchaContext/CaptchaContext.cjs');
|
|
31
30
|
var ErrorContext = require('../ErrorContext/ErrorContext.cjs');
|
|
@@ -35,7 +34,6 @@ var getMinAuthToken = require('../../utils/functions/getMinAuthToken/getMinAuthT
|
|
|
35
34
|
require('react-international-phone');
|
|
36
35
|
require('viem');
|
|
37
36
|
require('viem/chains');
|
|
38
|
-
var version = require('../../../version.cjs');
|
|
39
37
|
var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
|
|
40
38
|
var userActions = require('../../store/actions/userActions/userActions.cjs');
|
|
41
39
|
var settings = require('../../data/api/settings/settings.cjs');
|
|
@@ -676,24 +674,31 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
676
674
|
walletUiUtils,
|
|
677
675
|
walletsFilter,
|
|
678
676
|
]);
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
677
|
+
React.useEffect(() => {
|
|
678
|
+
const addPrefetch = (attr) => {
|
|
679
|
+
if (!document.head.querySelector(`#${attr.id}`)) {
|
|
680
|
+
const element = document.createElement('link');
|
|
681
|
+
element.setAttribute('id', attr.id);
|
|
682
|
+
element.setAttribute('rel', 'prefetch');
|
|
683
|
+
element.setAttribute('href', attr.href);
|
|
684
|
+
element.setAttribute('as', attr.as);
|
|
685
|
+
element.setAttribute('type', attr.type);
|
|
686
|
+
document.head.insertAdjacentElement('beforeend', element);
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
addPrefetch({
|
|
690
|
+
as: 'image',
|
|
691
|
+
href: iconic.getIconicSpriteUrl(),
|
|
692
|
+
id: 'sprite',
|
|
693
|
+
type: 'image/svg+xml',
|
|
694
|
+
});
|
|
695
|
+
addPrefetch({
|
|
696
|
+
as: 'fetch',
|
|
697
|
+
href: walletBook.getWalletBookCdnUrl(),
|
|
698
|
+
id: 'wallet-book',
|
|
699
|
+
type: 'application/json',
|
|
700
|
+
});
|
|
701
|
+
}, []);
|
|
697
702
|
// DYN-1140 - Opens Widget when multiWalletWidgetState changes
|
|
698
703
|
React.useEffect(() => {
|
|
699
704
|
// If statement to secure SingleWallet widget
|
|
@@ -21,7 +21,6 @@ import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.
|
|
|
21
21
|
import { LocalStorage } from '../../shared/utils/classes/storage/localStorage.js';
|
|
22
22
|
import { useGlobalLoading } from '../../shared/utils/hooks/useGlobalLoading/useGlobalLoading.js';
|
|
23
23
|
import { useLocalStorage } from '../../shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
24
|
-
import { usePrefetch } from '../../shared/utils/hooks/usePrefetch/usePrefetch.js';
|
|
25
24
|
import '../../shared/consts/index.js';
|
|
26
25
|
import { CaptchaContextProvider } from '../CaptchaContext/CaptchaContext.js';
|
|
27
26
|
import { ErrorContextProvider } from '../ErrorContext/ErrorContext.js';
|
|
@@ -31,7 +30,6 @@ import { getMinAuthToken } from '../../utils/functions/getMinAuthToken/getMinAut
|
|
|
31
30
|
import 'react-international-phone';
|
|
32
31
|
import 'viem';
|
|
33
32
|
import 'viem/chains';
|
|
34
|
-
import { VERSION } from '../../../version.js';
|
|
35
33
|
import ApiEndpoint from '../../config/ApiEndpoint.js';
|
|
36
34
|
import { setUser } from '../../store/actions/userActions/userActions.js';
|
|
37
35
|
import { sendDynamicProps } from '../../data/api/settings/settings.js';
|
|
@@ -672,24 +670,31 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
672
670
|
walletUiUtils,
|
|
673
671
|
walletsFilter,
|
|
674
672
|
]);
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
673
|
+
useEffect(() => {
|
|
674
|
+
const addPrefetch = (attr) => {
|
|
675
|
+
if (!document.head.querySelector(`#${attr.id}`)) {
|
|
676
|
+
const element = document.createElement('link');
|
|
677
|
+
element.setAttribute('id', attr.id);
|
|
678
|
+
element.setAttribute('rel', 'prefetch');
|
|
679
|
+
element.setAttribute('href', attr.href);
|
|
680
|
+
element.setAttribute('as', attr.as);
|
|
681
|
+
element.setAttribute('type', attr.type);
|
|
682
|
+
document.head.insertAdjacentElement('beforeend', element);
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
addPrefetch({
|
|
686
|
+
as: 'image',
|
|
687
|
+
href: getIconicSpriteUrl(),
|
|
688
|
+
id: 'sprite',
|
|
689
|
+
type: 'image/svg+xml',
|
|
690
|
+
});
|
|
691
|
+
addPrefetch({
|
|
692
|
+
as: 'fetch',
|
|
693
|
+
href: getWalletBookCdnUrl(),
|
|
694
|
+
id: 'wallet-book',
|
|
695
|
+
type: 'application/json',
|
|
696
|
+
});
|
|
697
|
+
}, []);
|
|
693
698
|
// DYN-1140 - Opens Widget when multiWalletWidgetState changes
|
|
694
699
|
useEffect(() => {
|
|
695
700
|
// If statement to secure SingleWallet widget
|
|
@@ -5,5 +5,4 @@ export { useLocalStorage } from './useLocalStorage';
|
|
|
5
5
|
export { useMediaQuery } from './useMediaQuery';
|
|
6
6
|
export { useOnClickOutside } from './useOnClickOutside';
|
|
7
7
|
export { usePreventPageScroll } from './usePreventPageScroll';
|
|
8
|
-
export
|
|
9
|
-
export { usePrefetch } from './usePrefetch';
|
|
8
|
+
export * from './useThrottle';
|
|
@@ -88,7 +88,7 @@ const renderCheckboxGroup = (key, name, label, validationRules, errors, touched,
|
|
|
88
88
|
? 'user-field__checkbox-container--error'
|
|
89
89
|
: ''}`, children: (validationRules === null || validationRules === void 0 ? void 0 : validationRules.checkboxText) && (jsxRuntime.jsxs("div", { className: 'user-field__consent-checkbox', children: [jsxRuntime.jsx(formik.Field, { as: Checkbox.Checkbox, id: key, name: name, type: 'checkbox', value: '0', disabled: disabled, selectDataTestId: 'customFieldCheckbox' }, key), jsxRuntime.jsx("label", { htmlFor: key, className: 'user-field__checkbox-label', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: validationRules.checkboxText }) })] }, key)) }, 'customConsentGroup'), touched[name] && getDisplayErrorMessage.getDisplayErrorMessage(label, errors[name]) && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_mini', className: 'user-field__error-message', children: `${name.charAt(0).toUpperCase() + name.slice(1)} is required` }))] }));
|
|
90
90
|
const renderPoliciesConsentGroup = (key, policiesConsentInnerComponentArray, disabled) => (jsxRuntime.jsx("div", { role: 'group', "aria-labelledby": 'checkbox-group', className: 'user-field__checkbox-container', children: policiesConsentInnerComponentArray === null || policiesConsentInnerComponentArray === void 0 ? void 0 : policiesConsentInnerComponentArray.map((component, index) => (jsxRuntime.jsxs("div", { className: 'user-field__consent-checkbox', children: [jsxRuntime.jsx(formik.Field, { copykey: key, as: Checkbox.Checkbox, id: `policiesConsent_${index}`, name: 'policiesConsentArray', type: 'checkbox', value: `${index}`, disabled: disabled }, `policiesConsent_${index}`), jsxRuntime.jsx("label", { htmlFor: `policiesConsent_${index}`, className: 'user-field__checkbox-label', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', children: component }) })] }, `policiesConsent_${index}`))) }, 'policiesConsentGroup'));
|
|
91
|
-
const UserField = ({ fieldData: { validationRules, isCustom, key, label, type, autoComplete }, fieldSettings: { enabled, name, required, verify }, errors, touched, disabled, policiesConsentInnerComponentArray, }) => {
|
|
91
|
+
const UserField = ({ fieldData: { validationRules, isCustom, key, label: defaultLabel, type, autoComplete, }, fieldSettings: { enabled, name, required, verify, label = defaultLabel }, errors, touched, disabled, policiesConsentInnerComponentArray, }) => {
|
|
92
92
|
if (isCustom) {
|
|
93
93
|
if (type === sdkApiCore.CustomFieldType.Select && (validationRules === null || validationRules === void 0 ? void 0 : validationRules.validOptions)) {
|
|
94
94
|
const options = validationRules.validOptions.map((opt) => opt.label);
|
|
@@ -84,7 +84,7 @@ const renderCheckboxGroup = (key, name, label, validationRules, errors, touched,
|
|
|
84
84
|
? 'user-field__checkbox-container--error'
|
|
85
85
|
: ''}`, children: (validationRules === null || validationRules === void 0 ? void 0 : validationRules.checkboxText) && (jsxs("div", { className: 'user-field__consent-checkbox', children: [jsx(Field, { as: Checkbox, id: key, name: name, type: 'checkbox', value: '0', disabled: disabled, selectDataTestId: 'customFieldCheckbox' }, key), jsx("label", { htmlFor: key, className: 'user-field__checkbox-label', children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: validationRules.checkboxText }) })] }, key)) }, 'customConsentGroup'), touched[name] && getDisplayErrorMessage(label, errors[name]) && (jsx(Typography, { variant: 'body_mini', className: 'user-field__error-message', children: `${name.charAt(0).toUpperCase() + name.slice(1)} is required` }))] }));
|
|
86
86
|
const renderPoliciesConsentGroup = (key, policiesConsentInnerComponentArray, disabled) => (jsx("div", { role: 'group', "aria-labelledby": 'checkbox-group', className: 'user-field__checkbox-container', children: policiesConsentInnerComponentArray === null || policiesConsentInnerComponentArray === void 0 ? void 0 : policiesConsentInnerComponentArray.map((component, index) => (jsxs("div", { className: 'user-field__consent-checkbox', children: [jsx(Field, { copykey: key, as: Checkbox, id: `policiesConsent_${index}`, name: 'policiesConsentArray', type: 'checkbox', value: `${index}`, disabled: disabled }, `policiesConsent_${index}`), jsx("label", { htmlFor: `policiesConsent_${index}`, className: 'user-field__checkbox-label', children: jsx(Typography, { variant: 'body_small', color: 'secondary', children: component }) })] }, `policiesConsent_${index}`))) }, 'policiesConsentGroup'));
|
|
87
|
-
const UserField = ({ fieldData: { validationRules, isCustom, key, label, type, autoComplete }, fieldSettings: { enabled, name, required, verify }, errors, touched, disabled, policiesConsentInnerComponentArray, }) => {
|
|
87
|
+
const UserField = ({ fieldData: { validationRules, isCustom, key, label: defaultLabel, type, autoComplete, }, fieldSettings: { enabled, name, required, verify, label = defaultLabel }, errors, touched, disabled, policiesConsentInnerComponentArray, }) => {
|
|
88
88
|
if (isCustom) {
|
|
89
89
|
if (type === CustomFieldType.Select && (validationRules === null || validationRules === void 0 ? void 0 : validationRules.validOptions)) {
|
|
90
90
|
const options = validationRules.validOptions.map((opt) => opt.label);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { usePrefetch } from './usePrefetch';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
require('@dynamic-labs/sdk-api-core');
|
|
7
|
-
require('../../../logger.cjs');
|
|
8
|
-
require('@dynamic-labs/iconic');
|
|
9
|
-
require('@dynamic-labs/wallet-connector-core');
|
|
10
|
-
require('react/jsx-runtime');
|
|
11
|
-
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
12
|
-
require('react');
|
|
13
|
-
require('@dynamic-labs/wallet-book');
|
|
14
|
-
var isSSR = require('../../functions/isSSR/isSSR.cjs');
|
|
15
|
-
require('../../../../utils/constants/colors.cjs');
|
|
16
|
-
require('../../../../utils/constants/values.cjs');
|
|
17
|
-
require('../../classes/storage/localStorage.cjs');
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Prefetches a resource
|
|
21
|
-
* Adds a link element to the head of the document with the provided attributes
|
|
22
|
-
* when the element is not already present
|
|
23
|
-
* @param {PrefetchProps} prefetchProps
|
|
24
|
-
* @returns {void}
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* usePrefetch({
|
|
28
|
-
* href: 'https://example.com/image.jpg',
|
|
29
|
-
* as: 'image',
|
|
30
|
-
* type: 'image/jpeg',
|
|
31
|
-
* id: 'image-prefetch',
|
|
32
|
-
* });
|
|
33
|
-
*/
|
|
34
|
-
const usePrefetch = ({ as, href, id, type }) => {
|
|
35
|
-
// Do not run on server side
|
|
36
|
-
if (isSSR.isSSR())
|
|
37
|
-
return;
|
|
38
|
-
const predefinedElement = document.head.querySelector(`#${id}`);
|
|
39
|
-
// Do not add the element if it already exists
|
|
40
|
-
if (predefinedElement)
|
|
41
|
-
return;
|
|
42
|
-
const element = document.createElement('link');
|
|
43
|
-
element.setAttribute('id', id);
|
|
44
|
-
element.setAttribute('rel', 'prefetch');
|
|
45
|
-
element.setAttribute('href', href);
|
|
46
|
-
element.setAttribute('as', as);
|
|
47
|
-
element.setAttribute('type', type);
|
|
48
|
-
document.head.insertAdjacentElement('beforeend', element);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
exports.usePrefetch = usePrefetch;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type PrefetchProps = {
|
|
2
|
-
href: string;
|
|
3
|
-
as: string;
|
|
4
|
-
type: string;
|
|
5
|
-
id: string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Prefetches a resource
|
|
9
|
-
* Adds a link element to the head of the document with the provided attributes
|
|
10
|
-
* when the element is not already present
|
|
11
|
-
* @param {PrefetchProps} prefetchProps
|
|
12
|
-
* @returns {void}
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* usePrefetch({
|
|
16
|
-
* href: 'https://example.com/image.jpg',
|
|
17
|
-
* as: 'image',
|
|
18
|
-
* type: 'image/jpeg',
|
|
19
|
-
* id: 'image-prefetch',
|
|
20
|
-
* });
|
|
21
|
-
*/
|
|
22
|
-
export declare const usePrefetch: ({ as, href, id, type }: PrefetchProps) => void;
|
|
23
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import '@dynamic-labs/sdk-api-core';
|
|
3
|
-
import '../../../logger.js';
|
|
4
|
-
import '@dynamic-labs/iconic';
|
|
5
|
-
import '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import 'react/jsx-runtime';
|
|
7
|
-
import '../../../../context/ViewContext/ViewContext.js';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '@dynamic-labs/wallet-book';
|
|
10
|
-
import { isSSR } from '../../functions/isSSR/isSSR.js';
|
|
11
|
-
import '../../../../utils/constants/colors.js';
|
|
12
|
-
import '../../../../utils/constants/values.js';
|
|
13
|
-
import '../../classes/storage/localStorage.js';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Prefetches a resource
|
|
17
|
-
* Adds a link element to the head of the document with the provided attributes
|
|
18
|
-
* when the element is not already present
|
|
19
|
-
* @param {PrefetchProps} prefetchProps
|
|
20
|
-
* @returns {void}
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* usePrefetch({
|
|
24
|
-
* href: 'https://example.com/image.jpg',
|
|
25
|
-
* as: 'image',
|
|
26
|
-
* type: 'image/jpeg',
|
|
27
|
-
* id: 'image-prefetch',
|
|
28
|
-
* });
|
|
29
|
-
*/
|
|
30
|
-
const usePrefetch = ({ as, href, id, type }) => {
|
|
31
|
-
// Do not run on server side
|
|
32
|
-
if (isSSR())
|
|
33
|
-
return;
|
|
34
|
-
const predefinedElement = document.head.querySelector(`#${id}`);
|
|
35
|
-
// Do not add the element if it already exists
|
|
36
|
-
if (predefinedElement)
|
|
37
|
-
return;
|
|
38
|
-
const element = document.createElement('link');
|
|
39
|
-
element.setAttribute('id', id);
|
|
40
|
-
element.setAttribute('rel', 'prefetch');
|
|
41
|
-
element.setAttribute('href', href);
|
|
42
|
-
element.setAttribute('as', as);
|
|
43
|
-
element.setAttribute('type', type);
|
|
44
|
-
document.head.insertAdjacentElement('beforeend', element);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export { usePrefetch };
|