@dynamic-labs/sdk-react-core 4.57.1 → 4.58.0
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 +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -0
- package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.cjs +127 -0
- package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.d.ts +1 -1
- package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.js +123 -0
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +6 -0
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +6 -0
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.cjs +1 -1
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.js +1 -1
- package/src/lib/shared/assets/check-circle-filled.cjs +60 -0
- package/src/lib/shared/assets/check-circle-filled.js +36 -0
- package/src/lib/shared/assets/index.d.ts +16 -12
- package/src/lib/shared/assets/knowledge-check-icon.cjs +57 -0
- package/src/lib/shared/assets/knowledge-check-icon.js +33 -0
- package/src/lib/shared/assets/password-lock-icon.cjs +54 -0
- package/src/lib/shared/assets/password-lock-icon.js +30 -0
- package/src/lib/shared/assets/secure-action.cjs +54 -0
- package/src/lib/shared/assets/secure-action.js +30 -0
- package/src/lib/shared/assets/warning-circle-orange.cjs +57 -0
- package/src/lib/shared/assets/warning-circle-orange.js +33 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +4 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.d.ts +5 -1
- package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +4 -1
- package/src/lib/utils/functions/reconcilePrimaryWallet/index.d.ts +1 -0
- package/src/lib/utils/functions/reconcilePrimaryWallet/reconcilePrimaryWallet.cjs +26 -0
- package/src/lib/utils/functions/reconcilePrimaryWallet/reconcilePrimaryWallet.d.ts +2 -0
- package/src/lib/utils/functions/reconcilePrimaryWallet/reconcilePrimaryWallet.js +22 -0
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.cjs +30 -17
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.d.ts +0 -1
- package/src/lib/utils/hooks/useClientSessionKeys/useClientSessionKeys.js +32 -19
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +21 -12
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +2 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +21 -12
- package/src/lib/utils/hooks/useRefreshAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/useRefreshAuth/useRefreshAuth.cjs +49 -0
- package/src/lib/utils/hooks/useRefreshAuth/useRefreshAuth.d.ts +8 -0
- package/src/lib/utils/hooks/useRefreshAuth/useRefreshAuth.js +45 -0
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.cjs +13 -23
- package/src/lib/utils/hooks/useRefreshUser/useRefreshUser.js +12 -22
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +12 -10
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +13 -11
- package/src/lib/utils/hooks/useWalletBackup/cloudProviders.cjs +2 -2
- package/src/lib/utils/hooks/useWalletBackup/cloudProviders.js +2 -2
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.cjs +2 -2
- package/src/lib/utils/hooks/useWalletBackup/useWalletBackup.js +2 -2
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.cjs +2 -2
- package/src/lib/utils/hooks/useWalletDelegation/useWalletDelegation.js +2 -2
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.cjs +1 -1
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.js +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.cjs +1 -1
- package/src/lib/views/CollectUserDataViewNoWallet/CollectUserDataViewNoWallet.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
- package/src/lib/views/ExportSharesView/ExportSharesView.cjs +1 -1
- package/src/lib/views/ExportSharesView/ExportSharesView.js +1 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +1 -1
- package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +1 -1
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.cjs +1 -1
- package/src/lib/views/MfaSecureDeviceView/MfaSecureDeviceView.js +1 -1
- package/src/lib/views/MfaVerificationView/MfaVerificationView.cjs +1 -1
- package/src/lib/views/MfaVerificationView/MfaVerificationView.js +1 -1
- package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.cjs +1 -1
- package/src/lib/views/Passkey/ConfirmPasskeyView/ConfirmPasskeyView.js +1 -1
- package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.cjs +1 -1
- package/src/lib/views/Passkey/SetupPasskeyView/SetupPasskeyView.js +1 -1
- package/src/lib/views/SmsVerification/SmsVerification.cjs +1 -1
- package/src/lib/views/SmsVerification/SmsVerification.js +1 -1
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +6 -5
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +6 -5
- package/src/lib/views/WaasUpgradeView/WaasUpgradeView.cjs +1 -1
- package/src/lib/views/WaasUpgradeView/WaasUpgradeView.js +1 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +1 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.js +1 -1
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.cjs +2 -2
- package/src/lib/views/WalletUpgradeFlowView/WalletUpgradeFlowView.js +2 -2
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.cjs +15 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetViews/mapViewToComponent.js +15 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/EmbeddedWalletExportSection/EmbeddedWalletExportSection.js +2 -2
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.cjs +31 -10
- package/src/lib/widgets/DynamicWidget/views/AccountAndSecuritySettingsView/MfaSection/MfaSection.js +31 -10
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.cjs +54 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/SetupPasswordConfirmView.js +50 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordConfirmView/index.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/PasswordRequirement.cjs +15 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/PasswordRequirement.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/PasswordRequirement.js +11 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.cjs +57 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/SetupPasswordEnterView.js +53 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordEnterView/index.d.ts +4 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs +83 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.d.ts +7 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js +79 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordKnowledgeCheckView/index.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs +27 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.d.ts +5 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.js +23 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/index.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.cjs +37 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/SetupPasswordTermsView.js +33 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordTermsView/index.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.cjs +76 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/SetupPasswordView.js +72 -0
- package/src/lib/widgets/DynamicWidget/views/SetupPasswordView/index.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupInfoView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupSuccessView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/WaasBackupView/WaasBackupView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/index.d.ts +6 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var Alert = require('../../../../components/Alert/Alert.cjs');
|
|
10
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
11
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
12
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
13
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
14
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
15
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
16
|
+
var exclamationCircle = require('../../../../shared/assets/exclamation-circle.cjs');
|
|
17
|
+
var knowledgeCheckIcon = require('../../../../shared/assets/knowledge-check-icon.cjs');
|
|
18
|
+
require('@dynamic-labs/iconic');
|
|
19
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
20
|
+
|
|
21
|
+
const CORRECT_ANSWER = 'c';
|
|
22
|
+
const OPTIONS = [
|
|
23
|
+
{
|
|
24
|
+
label: 'A',
|
|
25
|
+
translationKey: 'dyn_setup_password.knowledge_check.option_a',
|
|
26
|
+
value: 'a',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: 'B',
|
|
30
|
+
translationKey: 'dyn_setup_password.knowledge_check.option_b',
|
|
31
|
+
value: 'b',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'C',
|
|
35
|
+
translationKey: 'dyn_setup_password.knowledge_check.option_c',
|
|
36
|
+
value: 'c',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
const SetupPasswordKnowledgeCheckView = ({ onContinue, onBack, onReviewTerms }) => {
|
|
40
|
+
const { t } = reactI18next.useTranslation();
|
|
41
|
+
const [selectedAnswer, setSelectedAnswer] = React.useState('');
|
|
42
|
+
const [showError, setShowError] = React.useState(false);
|
|
43
|
+
const handleAnswerChange = React.useCallback((e) => {
|
|
44
|
+
setSelectedAnswer(e.target.value);
|
|
45
|
+
setShowError(false);
|
|
46
|
+
}, []);
|
|
47
|
+
const handleContinue = React.useCallback(() => {
|
|
48
|
+
if (selectedAnswer === CORRECT_ANSWER) {
|
|
49
|
+
onContinue();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
setShowError(true);
|
|
53
|
+
}
|
|
54
|
+
}, [selectedAnswer, onContinue]);
|
|
55
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-knowledge-check-back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
56
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.knowledge_check.title', children: t('dyn_setup_password.knowledge_check.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__body', children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__content', children: [jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(knowledgeCheckIcon.ReactComponent, { width: 56, height: 56 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', copykey: 'dyn_setup_password.knowledge_check.description', className: 'setup-password-knowledge-check-view__description', children: t('dyn_setup_password.knowledge_check.description') })] }), jsxRuntime.jsxs("div", { className: 'setup-password-knowledge-check-view__alert', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', weight: 'semibold', copykey: 'dyn_setup_password.knowledge_check.question', className: 'setup-password-knowledge-check-view__question', children: t('dyn_setup_password.knowledge_check.question') }), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__options', children: OPTIONS.map((option) => {
|
|
57
|
+
const isSelected = selectedAnswer === option.value;
|
|
58
|
+
const hasError = showError && isSelected;
|
|
59
|
+
return (jsxRuntime.jsxs("div", { className: `setup-password-knowledge-check-view__option ${isSelected
|
|
60
|
+
? 'setup-password-knowledge-check-view__option--selected'
|
|
61
|
+
: ''} ${hasError
|
|
62
|
+
? 'setup-password-knowledge-check-view__option--error'
|
|
63
|
+
: ''} ${showError
|
|
64
|
+
? 'setup-password-knowledge-check-view__option--disabled'
|
|
65
|
+
: ''}`, onClick: () => {
|
|
66
|
+
if (!showError) {
|
|
67
|
+
handleAnswerChange({
|
|
68
|
+
target: { value: option.value },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}, children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: hasError
|
|
72
|
+
? 'error-1'
|
|
73
|
+
: isSelected
|
|
74
|
+
? 'brand-primary'
|
|
75
|
+
: 'tertiary', weight: 'bold', className: 'setup-password-knowledge-check-view__option-label', children: option.label }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'primary', children: t(option.translationKey) })] }, option.value));
|
|
76
|
+
}) })] })] }), jsxRuntime.jsxs("div", { children: [showError && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Alert.Alert, { variant: 'error', icon: jsxRuntime.jsx(exclamationCircle.ReactComponent, {}), className: 'setup-password-knowledge-check-view__error', children: t('dyn_setup_password.knowledge_check.error') }), jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__review-button', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: onReviewTerms, copykey: 'dyn_setup_password.knowledge_check.review_terms', dataTestId: 'setup-password-knowledge-check-review-button', buttonVariant: 'brand-primary', className: 'setup-password-knowledge-check-view__alert-button', typographyProps: {
|
|
77
|
+
color: 'inherit',
|
|
78
|
+
}, expanded: true, children: t('dyn_setup_password.knowledge_check.review_terms') }) })] })), !showError && (jsxRuntime.jsx("div", { className: 'setup-password-knowledge-check-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-knowledge-check-continue-button', onClick: handleContinue, disabled: !selectedAnswer, copykey: 'dyn_setup_password.button.confirm', buttonVariant: 'brand-primary', typographyProps: {
|
|
79
|
+
color: 'inherit',
|
|
80
|
+
}, expanded: true, children: t('dyn_setup_password.button.confirm') }) }))] })] }) })] }));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.SetupPasswordKnowledgeCheckView = SetupPasswordKnowledgeCheckView;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Alert } from '../../../../components/Alert/Alert.js';
|
|
6
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
7
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
8
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
9
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
10
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
11
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
12
|
+
import { ReactComponent as SvgExclamationCircle } from '../../../../shared/assets/exclamation-circle.js';
|
|
13
|
+
import { ReactComponent as SvgKnowledgeCheckIcon } from '../../../../shared/assets/knowledge-check-icon.js';
|
|
14
|
+
import '@dynamic-labs/iconic';
|
|
15
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
16
|
+
|
|
17
|
+
const CORRECT_ANSWER = 'c';
|
|
18
|
+
const OPTIONS = [
|
|
19
|
+
{
|
|
20
|
+
label: 'A',
|
|
21
|
+
translationKey: 'dyn_setup_password.knowledge_check.option_a',
|
|
22
|
+
value: 'a',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: 'B',
|
|
26
|
+
translationKey: 'dyn_setup_password.knowledge_check.option_b',
|
|
27
|
+
value: 'b',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: 'C',
|
|
31
|
+
translationKey: 'dyn_setup_password.knowledge_check.option_c',
|
|
32
|
+
value: 'c',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
const SetupPasswordKnowledgeCheckView = ({ onContinue, onBack, onReviewTerms }) => {
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
const [selectedAnswer, setSelectedAnswer] = useState('');
|
|
38
|
+
const [showError, setShowError] = useState(false);
|
|
39
|
+
const handleAnswerChange = useCallback((e) => {
|
|
40
|
+
setSelectedAnswer(e.target.value);
|
|
41
|
+
setShowError(false);
|
|
42
|
+
}, []);
|
|
43
|
+
const handleContinue = useCallback(() => {
|
|
44
|
+
if (selectedAnswer === CORRECT_ANSWER) {
|
|
45
|
+
onContinue();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
setShowError(true);
|
|
49
|
+
}
|
|
50
|
+
}, [selectedAnswer, onContinue]);
|
|
51
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-knowledge-check-back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
52
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.knowledge_check.title', children: t('dyn_setup_password.knowledge_check.title') }) }), jsx("div", { className: 'setup-password-knowledge-check-view', children: jsxs("div", { className: 'setup-password-knowledge-check-view__body', children: [jsxs("div", { children: [jsxs("div", { className: 'setup-password-knowledge-check-view__content', children: [jsx("div", { className: 'setup-password-knowledge-check-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgKnowledgeCheckIcon, { width: 56, height: 56 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'medium', copykey: 'dyn_setup_password.knowledge_check.description', className: 'setup-password-knowledge-check-view__description', children: t('dyn_setup_password.knowledge_check.description') })] }), jsxs("div", { className: 'setup-password-knowledge-check-view__alert', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', weight: 'semibold', copykey: 'dyn_setup_password.knowledge_check.question', className: 'setup-password-knowledge-check-view__question', children: t('dyn_setup_password.knowledge_check.question') }), jsx("div", { className: 'setup-password-knowledge-check-view__options', children: OPTIONS.map((option) => {
|
|
53
|
+
const isSelected = selectedAnswer === option.value;
|
|
54
|
+
const hasError = showError && isSelected;
|
|
55
|
+
return (jsxs("div", { className: `setup-password-knowledge-check-view__option ${isSelected
|
|
56
|
+
? 'setup-password-knowledge-check-view__option--selected'
|
|
57
|
+
: ''} ${hasError
|
|
58
|
+
? 'setup-password-knowledge-check-view__option--error'
|
|
59
|
+
: ''} ${showError
|
|
60
|
+
? 'setup-password-knowledge-check-view__option--disabled'
|
|
61
|
+
: ''}`, onClick: () => {
|
|
62
|
+
if (!showError) {
|
|
63
|
+
handleAnswerChange({
|
|
64
|
+
target: { value: option.value },
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}, children: [jsx(Typography, { variant: 'body_normal', color: hasError
|
|
68
|
+
? 'error-1'
|
|
69
|
+
: isSelected
|
|
70
|
+
? 'brand-primary'
|
|
71
|
+
: 'tertiary', weight: 'bold', className: 'setup-password-knowledge-check-view__option-label', children: option.label }), jsx(Typography, { variant: 'body_small', color: 'primary', children: t(option.translationKey) })] }, option.value));
|
|
72
|
+
}) })] })] }), jsxs("div", { children: [showError && (jsxs(Fragment, { children: [jsx(Alert, { variant: 'error', icon: jsx(SvgExclamationCircle, {}), className: 'setup-password-knowledge-check-view__error', children: t('dyn_setup_password.knowledge_check.error') }), jsx("div", { className: 'setup-password-knowledge-check-view__review-button', children: jsx(TypographyButton, { onClick: onReviewTerms, copykey: 'dyn_setup_password.knowledge_check.review_terms', dataTestId: 'setup-password-knowledge-check-review-button', buttonVariant: 'brand-primary', className: 'setup-password-knowledge-check-view__alert-button', typographyProps: {
|
|
73
|
+
color: 'inherit',
|
|
74
|
+
}, expanded: true, children: t('dyn_setup_password.knowledge_check.review_terms') }) })] })), !showError && (jsx("div", { className: 'setup-password-knowledge-check-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-knowledge-check-continue-button', onClick: handleContinue, disabled: !selectedAnswer, copykey: 'dyn_setup_password.button.confirm', buttonVariant: 'brand-primary', typographyProps: {
|
|
75
|
+
color: 'inherit',
|
|
76
|
+
}, expanded: true, children: t('dyn_setup_password.button.confirm') }) }))] })] }) })] }));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { SetupPasswordKnowledgeCheckView };
|
package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
10
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
11
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
12
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
13
|
+
var checkCircleFilled = require('../../../../shared/assets/check-circle-filled.cjs');
|
|
14
|
+
require('@dynamic-labs/iconic');
|
|
15
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
16
|
+
|
|
17
|
+
const SetupPasswordSuccessView = ({ onDone, }) => {
|
|
18
|
+
const { t } = reactI18next.useTranslation();
|
|
19
|
+
const handleDone = React.useCallback(() => {
|
|
20
|
+
onDone();
|
|
21
|
+
}, [onDone]);
|
|
22
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.success.title', children: t('dyn_setup_password.success.title') }) }), jsxRuntime.jsxs("div", { className: 'setup-password-success-view', children: [jsxRuntime.jsx("div", { className: 'setup-password-success-view__content', children: jsxRuntime.jsxs("div", { className: 'setup-password-success-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-success-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(checkCircleFilled.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.success.description', className: 'setup-password-success-view__description', children: t('dyn_setup_password.success.description') })] }) }), jsxRuntime.jsx("div", { className: 'setup-password-success-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-success-done-button', onClick: handleDone, copykey: 'dyn_setup_password.button.done', buttonVariant: 'brand-primary', typographyProps: {
|
|
23
|
+
color: 'inherit',
|
|
24
|
+
}, expanded: true, children: t('dyn_setup_password.button.done') }) })] })] }));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.SetupPasswordSuccessView = SetupPasswordSuccessView;
|
package/src/lib/widgets/DynamicWidget/views/SetupPasswordSuccessView/SetupPasswordSuccessView.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
6
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
7
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
8
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
9
|
+
import { ReactComponent as SvgCheckCircleFilled } from '../../../../shared/assets/check-circle-filled.js';
|
|
10
|
+
import '@dynamic-labs/iconic';
|
|
11
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
12
|
+
|
|
13
|
+
const SetupPasswordSuccessView = ({ onDone, }) => {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const handleDone = useCallback(() => {
|
|
16
|
+
onDone();
|
|
17
|
+
}, [onDone]);
|
|
18
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.success.title', children: t('dyn_setup_password.success.title') }) }), jsxs("div", { className: 'setup-password-success-view', children: [jsx("div", { className: 'setup-password-success-view__content', children: jsxs("div", { className: 'setup-password-success-view__body', children: [jsx("div", { className: 'setup-password-success-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgCheckCircleFilled, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.success.description', className: 'setup-password-success-view__description', children: t('dyn_setup_password.success.description') })] }) }), jsx("div", { className: 'setup-password-success-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-success-done-button', onClick: handleDone, copykey: 'dyn_setup_password.button.done', buttonVariant: 'brand-primary', typographyProps: {
|
|
19
|
+
color: 'inherit',
|
|
20
|
+
}, expanded: true, children: t('dyn_setup_password.button.done') }) })] })] }));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { SetupPasswordSuccessView };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
var Checkbox = require('../../../../components/Checkbox/Checkbox.cjs');
|
|
10
|
+
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
11
|
+
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
12
|
+
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
13
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
14
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
15
|
+
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
16
|
+
require('@dynamic-labs/iconic');
|
|
17
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
18
|
+
var warningCircleOrange = require('../../../../shared/assets/warning-circle-orange.cjs');
|
|
19
|
+
|
|
20
|
+
const SetupPasswordTermsView = ({ onContinue, onBack, }) => {
|
|
21
|
+
const { t } = reactI18next.useTranslation();
|
|
22
|
+
const [checkedItems, setCheckedItems] = React.useState({
|
|
23
|
+
term1: false,
|
|
24
|
+
term2: false,
|
|
25
|
+
term3: false,
|
|
26
|
+
});
|
|
27
|
+
const handleCheckboxChange = React.useCallback((termKey) => {
|
|
28
|
+
setCheckedItems((prev) => (Object.assign(Object.assign({}, prev), { [termKey]: !prev[termKey] })));
|
|
29
|
+
}, []);
|
|
30
|
+
const allChecked = Object.values(checkedItems).every(Boolean);
|
|
31
|
+
const backButton = (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-terms-back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
|
|
32
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.terms.title', children: t('dyn_setup_password.terms.title') }) }), jsxRuntime.jsx("div", { className: 'setup-password-terms-view', children: jsxRuntime.jsxs("div", { className: 'setup-password-terms-view__body', children: [jsxRuntime.jsx("div", { className: 'setup-password-terms-view__icon-container', children: jsxRuntime.jsx(Icon.Icon, { color: 'brand-primary', children: jsxRuntime.jsx(warningCircleOrange.ReactComponent, { width: 64, height: 64 }) }) }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.terms.description', className: 'setup-password-terms-view__description', children: t('dyn_setup_password.terms.description') }), jsxRuntime.jsxs("div", { className: 'setup-password-terms-view__checkboxes', children: [jsxRuntime.jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: checkedItems.term1, onChange: () => handleCheckboxChange('term1'), ariaLabel: t('dyn_setup_password.terms.checkbox_1') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_1', children: t('dyn_setup_password.terms.checkbox_1') })] }), jsxRuntime.jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: checkedItems.term2, onChange: () => handleCheckboxChange('term2'), ariaLabel: t('dyn_setup_password.terms.checkbox_2') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_2', children: t('dyn_setup_password.terms.checkbox_2') })] }), jsxRuntime.jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsxRuntime.jsx(Checkbox.Checkbox, { checked: checkedItems.term3, onChange: () => handleCheckboxChange('term3'), ariaLabel: t('dyn_setup_password.terms.checkbox_3') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_3', children: t('dyn_setup_password.terms.checkbox_3') })] })] }), jsxRuntime.jsx("div", { className: 'setup-password-terms-view__actions', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'setup-password-terms-continue-button', onClick: onContinue, disabled: !allChecked, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
|
|
33
|
+
color: 'inherit',
|
|
34
|
+
}, expanded: true, children: t('dyn_setup_password.button.continue') }) })] }) })] }));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.SetupPasswordTermsView = SetupPasswordTermsView;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Checkbox } from '../../../../components/Checkbox/Checkbox.js';
|
|
6
|
+
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
7
|
+
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
8
|
+
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|
|
9
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
10
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
11
|
+
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
12
|
+
import '@dynamic-labs/iconic';
|
|
13
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
14
|
+
import { ReactComponent as SvgWarningCircleOrange } from '../../../../shared/assets/warning-circle-orange.js';
|
|
15
|
+
|
|
16
|
+
const SetupPasswordTermsView = ({ onContinue, onBack, }) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const [checkedItems, setCheckedItems] = useState({
|
|
19
|
+
term1: false,
|
|
20
|
+
term2: false,
|
|
21
|
+
term3: false,
|
|
22
|
+
});
|
|
23
|
+
const handleCheckboxChange = useCallback((termKey) => {
|
|
24
|
+
setCheckedItems((prev) => (Object.assign(Object.assign({}, prev), { [termKey]: !prev[termKey] })));
|
|
25
|
+
}, []);
|
|
26
|
+
const allChecked = Object.values(checkedItems).every(Boolean);
|
|
27
|
+
const backButton = (jsx(IconButton, { type: 'button', onClick: onBack, "data-testid": 'setup-password-terms-back-button', children: jsx(SvgChevronLeft, {}) }));
|
|
28
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_setup_password.terms.title', children: t('dyn_setup_password.terms.title') }) }), jsx("div", { className: 'setup-password-terms-view', children: jsxs("div", { className: 'setup-password-terms-view__body', children: [jsx("div", { className: 'setup-password-terms-view__icon-container', children: jsx(Icon, { color: 'brand-primary', children: jsx(SvgWarningCircleOrange, { width: 64, height: 64 }) }) }), jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_setup_password.terms.description', className: 'setup-password-terms-view__description', children: t('dyn_setup_password.terms.description') }), jsxs("div", { className: 'setup-password-terms-view__checkboxes', children: [jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsx(Checkbox, { checked: checkedItems.term1, onChange: () => handleCheckboxChange('term1'), ariaLabel: t('dyn_setup_password.terms.checkbox_1') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_1', children: t('dyn_setup_password.terms.checkbox_1') })] }), jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsx(Checkbox, { checked: checkedItems.term2, onChange: () => handleCheckboxChange('term2'), ariaLabel: t('dyn_setup_password.terms.checkbox_2') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_2', children: t('dyn_setup_password.terms.checkbox_2') })] }), jsxs("label", { className: 'setup-password-terms-view__checkbox-item', children: [jsx(Checkbox, { checked: checkedItems.term3, onChange: () => handleCheckboxChange('term3'), ariaLabel: t('dyn_setup_password.terms.checkbox_3') }), jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_setup_password.terms.checkbox_3', children: t('dyn_setup_password.terms.checkbox_3') })] })] }), jsx("div", { className: 'setup-password-terms-view__actions', children: jsx(TypographyButton, { dataTestId: 'setup-password-terms-continue-button', onClick: onContinue, disabled: !allChecked, copykey: 'dyn_setup_password.button.continue', buttonVariant: 'brand-primary', typographyProps: {
|
|
29
|
+
color: 'inherit',
|
|
30
|
+
}, expanded: true, children: t('dyn_setup_password.button.continue') }) })] }) })] }));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { SetupPasswordTermsView };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var DynamicWidgetContext = require('../../context/DynamicWidgetContext.cjs');
|
|
9
|
+
var SetupPasswordTermsView = require('../SetupPasswordTermsView/SetupPasswordTermsView.cjs');
|
|
10
|
+
var SetupPasswordEnterView = require('../SetupPasswordEnterView/SetupPasswordEnterView.cjs');
|
|
11
|
+
require('../../../../../../_virtual/_tslib.cjs');
|
|
12
|
+
require('@dynamic-labs/utils');
|
|
13
|
+
require('@dynamic-labs/iconic');
|
|
14
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
var SetupPasswordConfirmView = require('../SetupPasswordConfirmView/SetupPasswordConfirmView.cjs');
|
|
16
|
+
var SetupPasswordKnowledgeCheckView = require('../SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.cjs');
|
|
17
|
+
var SetupPasswordSuccessView = require('../SetupPasswordSuccessView/SetupPasswordSuccessView.cjs');
|
|
18
|
+
|
|
19
|
+
const SetupPasswordView = ({ onComplete, skipKnowledgeCheck = false, }) => {
|
|
20
|
+
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
21
|
+
const [currentStep, setCurrentStep] = React.useState('terms');
|
|
22
|
+
const [password, setPassword] = React.useState('');
|
|
23
|
+
const goToAccountAndSecurity = React.useCallback(() => {
|
|
24
|
+
setDynamicWidgetView('account-and-security-settings');
|
|
25
|
+
}, [setDynamicWidgetView]);
|
|
26
|
+
const handleTermsContinue = React.useCallback(() => {
|
|
27
|
+
setCurrentStep('enter');
|
|
28
|
+
}, []);
|
|
29
|
+
const handleEnterContinue = React.useCallback((newPassword) => {
|
|
30
|
+
setPassword(newPassword);
|
|
31
|
+
setCurrentStep('confirm');
|
|
32
|
+
}, []);
|
|
33
|
+
const handleEnterBack = React.useCallback(() => {
|
|
34
|
+
setCurrentStep('terms');
|
|
35
|
+
}, []);
|
|
36
|
+
const handleConfirmContinue = React.useCallback(() => {
|
|
37
|
+
if (skipKnowledgeCheck) {
|
|
38
|
+
setCurrentStep('success');
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
setCurrentStep('knowledge-check');
|
|
42
|
+
}
|
|
43
|
+
}, [skipKnowledgeCheck]);
|
|
44
|
+
const handleConfirmBack = React.useCallback(() => {
|
|
45
|
+
setCurrentStep('enter');
|
|
46
|
+
}, []);
|
|
47
|
+
const handleKnowledgeCheckContinue = React.useCallback(() => {
|
|
48
|
+
setCurrentStep('success');
|
|
49
|
+
}, []);
|
|
50
|
+
const handleKnowledgeCheckBack = React.useCallback(() => {
|
|
51
|
+
setCurrentStep('confirm');
|
|
52
|
+
}, []);
|
|
53
|
+
const handleKnowledgeCheckReviewTerms = React.useCallback(() => {
|
|
54
|
+
setCurrentStep('terms');
|
|
55
|
+
}, []);
|
|
56
|
+
const handleSuccess = React.useCallback(() => {
|
|
57
|
+
onComplete(password);
|
|
58
|
+
goToAccountAndSecurity();
|
|
59
|
+
}, [onComplete, password, goToAccountAndSecurity]);
|
|
60
|
+
switch (currentStep) {
|
|
61
|
+
case 'terms':
|
|
62
|
+
return (jsxRuntime.jsx(SetupPasswordTermsView.SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: goToAccountAndSecurity }));
|
|
63
|
+
case 'enter':
|
|
64
|
+
return (jsxRuntime.jsx(SetupPasswordEnterView.SetupPasswordEnterView, { onContinue: handleEnterContinue, onBack: handleEnterBack }));
|
|
65
|
+
case 'confirm':
|
|
66
|
+
return (jsxRuntime.jsx(SetupPasswordConfirmView.SetupPasswordConfirmView, { password: password, onContinue: handleConfirmContinue, onBack: handleConfirmBack }));
|
|
67
|
+
case 'knowledge-check':
|
|
68
|
+
return (jsxRuntime.jsx(SetupPasswordKnowledgeCheckView.SetupPasswordKnowledgeCheckView, { onContinue: handleKnowledgeCheckContinue, onBack: handleKnowledgeCheckBack, onReviewTerms: handleKnowledgeCheckReviewTerms }));
|
|
69
|
+
case 'success':
|
|
70
|
+
return jsxRuntime.jsx(SetupPasswordSuccessView.SetupPasswordSuccessView, { onDone: handleSuccess });
|
|
71
|
+
default:
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
exports.SetupPasswordView = SetupPasswordView;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
|
+
import { useWidgetContext } from '../../context/DynamicWidgetContext.js';
|
|
5
|
+
import { SetupPasswordTermsView } from '../SetupPasswordTermsView/SetupPasswordTermsView.js';
|
|
6
|
+
import { SetupPasswordEnterView } from '../SetupPasswordEnterView/SetupPasswordEnterView.js';
|
|
7
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
8
|
+
import '@dynamic-labs/utils';
|
|
9
|
+
import '@dynamic-labs/iconic';
|
|
10
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
11
|
+
import { SetupPasswordConfirmView } from '../SetupPasswordConfirmView/SetupPasswordConfirmView.js';
|
|
12
|
+
import { SetupPasswordKnowledgeCheckView } from '../SetupPasswordKnowledgeCheckView/SetupPasswordKnowledgeCheckView.js';
|
|
13
|
+
import { SetupPasswordSuccessView } from '../SetupPasswordSuccessView/SetupPasswordSuccessView.js';
|
|
14
|
+
|
|
15
|
+
const SetupPasswordView = ({ onComplete, skipKnowledgeCheck = false, }) => {
|
|
16
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
17
|
+
const [currentStep, setCurrentStep] = useState('terms');
|
|
18
|
+
const [password, setPassword] = useState('');
|
|
19
|
+
const goToAccountAndSecurity = useCallback(() => {
|
|
20
|
+
setDynamicWidgetView('account-and-security-settings');
|
|
21
|
+
}, [setDynamicWidgetView]);
|
|
22
|
+
const handleTermsContinue = useCallback(() => {
|
|
23
|
+
setCurrentStep('enter');
|
|
24
|
+
}, []);
|
|
25
|
+
const handleEnterContinue = useCallback((newPassword) => {
|
|
26
|
+
setPassword(newPassword);
|
|
27
|
+
setCurrentStep('confirm');
|
|
28
|
+
}, []);
|
|
29
|
+
const handleEnterBack = useCallback(() => {
|
|
30
|
+
setCurrentStep('terms');
|
|
31
|
+
}, []);
|
|
32
|
+
const handleConfirmContinue = useCallback(() => {
|
|
33
|
+
if (skipKnowledgeCheck) {
|
|
34
|
+
setCurrentStep('success');
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setCurrentStep('knowledge-check');
|
|
38
|
+
}
|
|
39
|
+
}, [skipKnowledgeCheck]);
|
|
40
|
+
const handleConfirmBack = useCallback(() => {
|
|
41
|
+
setCurrentStep('enter');
|
|
42
|
+
}, []);
|
|
43
|
+
const handleKnowledgeCheckContinue = useCallback(() => {
|
|
44
|
+
setCurrentStep('success');
|
|
45
|
+
}, []);
|
|
46
|
+
const handleKnowledgeCheckBack = useCallback(() => {
|
|
47
|
+
setCurrentStep('confirm');
|
|
48
|
+
}, []);
|
|
49
|
+
const handleKnowledgeCheckReviewTerms = useCallback(() => {
|
|
50
|
+
setCurrentStep('terms');
|
|
51
|
+
}, []);
|
|
52
|
+
const handleSuccess = useCallback(() => {
|
|
53
|
+
onComplete(password);
|
|
54
|
+
goToAccountAndSecurity();
|
|
55
|
+
}, [onComplete, password, goToAccountAndSecurity]);
|
|
56
|
+
switch (currentStep) {
|
|
57
|
+
case 'terms':
|
|
58
|
+
return (jsx(SetupPasswordTermsView, { onContinue: handleTermsContinue, onBack: goToAccountAndSecurity }));
|
|
59
|
+
case 'enter':
|
|
60
|
+
return (jsx(SetupPasswordEnterView, { onContinue: handleEnterContinue, onBack: handleEnterBack }));
|
|
61
|
+
case 'confirm':
|
|
62
|
+
return (jsx(SetupPasswordConfirmView, { password: password, onContinue: handleConfirmContinue, onBack: handleConfirmBack }));
|
|
63
|
+
case 'knowledge-check':
|
|
64
|
+
return (jsx(SetupPasswordKnowledgeCheckView, { onContinue: handleKnowledgeCheckContinue, onBack: handleKnowledgeCheckBack, onReviewTerms: handleKnowledgeCheckReviewTerms }));
|
|
65
|
+
case 'success':
|
|
66
|
+
return jsx(SetupPasswordSuccessView, { onDone: handleSuccess });
|
|
67
|
+
default:
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export { SetupPasswordView };
|
|
@@ -13,8 +13,8 @@ var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
|
13
13
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
var cautionTriangle = require('../../../../shared/assets/caution-triangle.cjs');
|
|
15
15
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
16
|
-
require('@dynamic-labs/iconic');
|
|
17
16
|
var filledQuestionMark = require('../../../../shared/assets/filled-question-mark.cjs');
|
|
17
|
+
require('@dynamic-labs/iconic');
|
|
18
18
|
|
|
19
19
|
const WaasBackupInfoView = () => {
|
|
20
20
|
const { goBack } = ViewContext.useViewContext();
|
|
@@ -9,8 +9,8 @@ import { Typography } from '../../../../components/Typography/Typography.js';
|
|
|
9
9
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import { ReactComponent as SvgCautionTriangle } from '../../../../shared/assets/caution-triangle.js';
|
|
11
11
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
12
|
-
import '@dynamic-labs/iconic';
|
|
13
12
|
import { ReactComponent as SvgFilledQuestionMark } from '../../../../shared/assets/filled-question-mark.js';
|
|
13
|
+
import '@dynamic-labs/iconic';
|
|
14
14
|
|
|
15
15
|
const WaasBackupInfoView = () => {
|
|
16
16
|
const { goBack } = useViewContext();
|
|
@@ -15,10 +15,10 @@ require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
|
15
15
|
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
16
16
|
require('@dynamic-labs/iconic');
|
|
17
17
|
require('@dynamic-labs/wallet-connector-core');
|
|
18
|
+
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
18
19
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
19
20
|
var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
20
21
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
21
|
-
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
22
22
|
require('../../../../shared/logger.cjs');
|
|
23
23
|
require('@dynamic-labs/wallet-book');
|
|
24
24
|
require('@dynamic-labs/utils');
|
|
@@ -11,10 +11,10 @@ import '../../../../context/DynamicContext/DynamicContext.js';
|
|
|
11
11
|
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
12
12
|
import '@dynamic-labs/iconic';
|
|
13
13
|
import '@dynamic-labs/wallet-connector-core';
|
|
14
|
+
import { ReactComponent as SvgBackupWaas } from '../../../../shared/assets/backup-waas.js';
|
|
14
15
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
15
16
|
import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
|
|
16
17
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
17
|
-
import { ReactComponent as SvgBackupWaas } from '../../../../shared/assets/backup-waas.js';
|
|
18
18
|
import '../../../../shared/logger.js';
|
|
19
19
|
import '@dynamic-labs/wallet-book';
|
|
20
20
|
import '@dynamic-labs/utils';
|
|
@@ -16,10 +16,10 @@ require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
|
16
16
|
require('../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
17
17
|
require('@dynamic-labs/iconic');
|
|
18
18
|
require('@dynamic-labs/wallet-connector-core');
|
|
19
|
+
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
19
20
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
20
21
|
var questionMark = require('../../../../shared/assets/question-mark.cjs');
|
|
21
22
|
var ViewContext = require('../../../../context/ViewContext/ViewContext.cjs');
|
|
22
|
-
var backupWaas = require('../../../../shared/assets/backup-waas.cjs');
|
|
23
23
|
require('../../../../shared/logger.cjs');
|
|
24
24
|
require('@dynamic-labs/wallet-book');
|
|
25
25
|
require('@dynamic-labs/utils');
|
|
@@ -12,10 +12,10 @@ import '../../../../context/DynamicContext/DynamicContext.js';
|
|
|
12
12
|
import '../../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
13
13
|
import '@dynamic-labs/iconic';
|
|
14
14
|
import '@dynamic-labs/wallet-connector-core';
|
|
15
|
+
import { ReactComponent as SvgBackupWaas } from '../../../../shared/assets/backup-waas.js';
|
|
15
16
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
16
17
|
import { ReactComponent as SvgQuestionMark } from '../../../../shared/assets/question-mark.js';
|
|
17
18
|
import { useViewContext } from '../../../../context/ViewContext/ViewContext.js';
|
|
18
|
-
import { ReactComponent as SvgBackupWaas } from '../../../../shared/assets/backup-waas.js';
|
|
19
19
|
import '../../../../shared/logger.js';
|
|
20
20
|
import '@dynamic-labs/wallet-book';
|
|
21
21
|
import '@dynamic-labs/utils';
|
|
@@ -6,6 +6,12 @@ export { ManagePasskeysWidgetView } from './ManagePasskeysWidgetView';
|
|
|
6
6
|
export { SettingsView } from './SettingsView';
|
|
7
7
|
export { AccountAndSecuritySettingsView } from './AccountAndSecuritySettingsView';
|
|
8
8
|
export { SessionManagementView } from './SessionManagementView';
|
|
9
|
+
export { SetupPasswordView } from './SetupPasswordView';
|
|
10
|
+
export { SetupPasswordTermsView } from './SetupPasswordTermsView';
|
|
11
|
+
export { SetupPasswordEnterView } from './SetupPasswordEnterView';
|
|
12
|
+
export { SetupPasswordConfirmView } from './SetupPasswordConfirmView';
|
|
13
|
+
export { SetupPasswordKnowledgeCheckView } from './SetupPasswordKnowledgeCheckView';
|
|
14
|
+
export { SetupPasswordSuccessView } from './SetupPasswordSuccessView';
|
|
9
15
|
export { WalletsDelegatedSettingsView } from './WalletsDelegatedSettingsView';
|
|
10
16
|
export { WaasBackupView } from './WaasBackupView';
|
|
11
17
|
export { WaasBackupInfoView } from './WaasBackupView';
|