@stokr/components-library 2.3.65-beta.9 → 2.3.66
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/dist/analytics/index.js +162 -0
- package/dist/components/2FA/login-with-otp-flow.js +1 -1
- package/dist/components/2FA/main-flow.js +40 -12
- package/dist/components/Chips/Chip.js +1 -2
- package/dist/components/Chips/Chip.styles.js +3 -2
- package/dist/components/ConfirmModal/ConfirmModal.js +240 -0
- package/dist/components/ConfirmModal/ConfirmModal.styles.js +26 -0
- package/dist/components/CryptoAddress/CryptoAddress.js +10 -4
- package/dist/components/CryptoAddress/CryptoAddress.styles.js +1 -1
- package/dist/components/Footer/FooterLayout.js +13 -4
- package/dist/components/Footer/FooterMenu.js +19 -3
- package/dist/components/Footer/FooterMenu.styles.js +14 -2
- package/dist/components/Header/Header.styles.js +1 -1
- package/dist/components/Input/DatePickerInput.js +134 -30
- package/dist/components/Input/DatePickerInput.styles.js +16 -3
- package/dist/components/Input/MultiSelect.js +10 -8
- package/dist/components/Input/TableFilterDropdown.js +228 -0
- package/dist/components/Input/Textarea.js +59 -0
- package/dist/components/Input/Textarea.styles.js +18 -0
- package/dist/components/Modal/Modal.js +39 -6
- package/dist/components/Modal/Modal.styles.js +2 -2
- package/dist/components/Modal/SideModal.js +44 -2
- package/dist/components/Modal/SuccessModal/SuccessModal.js +173 -0
- package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +29 -0
- package/dist/components/Modal/SuccessModal/index.js +37 -0
- package/dist/components/Payment/PaymentDetailsCard.js +14 -11
- package/dist/components/Payment/PaymentDisplay.js +2 -12
- package/dist/components/Snackbar/Snackbar.js +3 -0
- package/dist/components/Snackbar/Snackbar.styles.js +18 -9
- package/dist/components/StatusTag/StatusTag.js +38 -71
- package/dist/components/StatusTag/StatusTag.styles.js +4 -16
- package/dist/components/Timeline/Timeline.styles.js +1 -1
- package/dist/components/Timeline/TimelineStep.js +0 -1
- package/dist/context/AuthContext.js +5 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.css +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +10371 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/logo192.png +0 -0
- package/dist/logo512.png +0 -0
- package/dist/manifest.json +25 -0
- package/dist/robots.txt +3 -0
- package/dist/static/animations/checked.lottie +0 -0
- package/dist/static/animations/progress.lottie +0 -0
- package/dist/static/images/add-folder-icon.svg +5 -0
- package/dist/static/images/background3.png +0 -0
- package/dist/static/images/bmn2-logo.svg +9 -9
- package/dist/static/images/checkmark-circle-icon.svg +4 -0
- package/dist/static/images/close-circle-icon.svg +3 -0
- package/dist/static/images/doc-icon.svg +4 -0
- package/dist/static/images/filter-icon.svg +6 -0
- package/dist/styles/colors.js +2 -1
- package/dist/styles/global.js +1 -1
- package/dist/utils/customHooks.js +24 -2
- package/dist/utils/formatCurrencyValue.js +9 -2
- package/package.json +5 -2
- package/dist/components/2FA/EnterCode.stories.js +0 -35
- package/dist/components/2FA/disable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/enable-2fa-flow.stories.js +0 -31
- package/dist/components/2FA/login-with-otp-flow.stories.js +0 -31
- package/dist/components/2FA/main-flow.stories.js +0 -162
- package/dist/components/AccountBalance/AccountBalance.stories.js +0 -83
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +0 -913
- package/dist/components/AgreementItem/AgreementItem.stories.js +0 -105
- package/dist/components/AnalyticGraphs/Analytic.js +0 -541
- package/dist/components/AnalyticGraphs/Analytic.styles.js +0 -25
- package/dist/components/BackButton/BackButton.stories.js +0 -32
- package/dist/components/Background/Background.stories.js +0 -75
- package/dist/components/BarChart/BarChart.js +0 -263
- package/dist/components/BarChart/BarChart.stories.js +0 -66
- package/dist/components/BarChart/BarChart.styles.js +0 -26
- package/dist/components/BarChartLegend/BarChartLegend.js +0 -79
- package/dist/components/BarChartLegend/BarChartLegend.styles.js +0 -21
- package/dist/components/BasicTable/BasicTable.stories.js +0 -59
- package/dist/components/BlogPost/BlogPost.stories.js +0 -160
- package/dist/components/Button/Button.stories.js +0 -146
- package/dist/components/Button/GlareButton.stories.js +0 -132
- package/dist/components/CapitalRaisedSummary/CapitalRaisedSummery.stories.js +0 -42
- package/dist/components/ChartBox/ChartBox.js +0 -41
- package/dist/components/ChartBox/ChartBox.stories.js +0 -17
- package/dist/components/ChartBox/ChartBox.styles.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.js +0 -27
- package/dist/components/ChartBox/ChartBoxDistribution.stories.js +0 -18
- package/dist/components/ChartLegend/ChartLegend.stories.js +0 -90
- package/dist/components/Checkbox/Checkbox.stories.js +0 -88
- package/dist/components/Checklist/ChecklistCard.stories.js +0 -102
- package/dist/components/Checklist/UserChecklist.js +0 -184
- package/dist/components/Checklist/UserChecklist.stories.js +0 -317
- package/dist/components/Chips/Chip.stories.js +0 -36
- package/dist/components/Chips/ChipsWrapper.stories.js +0 -47
- package/dist/components/ComponentScroll/ComponentScroll.stories.js +0 -111
- package/dist/components/CryptoAddress/CryptoAddress.stories.js +0 -205
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.stories.js +0 -70
- package/dist/components/DonutChart/DonutChart.stories.js +0 -54
- package/dist/components/FAQ/FAQ.stories.js +0 -76
- package/dist/components/Footer/Footer.stories.js +0 -49
- package/dist/components/Footer/FooterLayout.stories.js +0 -26
- package/dist/components/Footer/FooterMenu.stories.js +0 -113
- package/dist/components/Footer/mangopay.png +0 -0
- package/dist/components/Footer/mangopay.svg +0 -20
- package/dist/components/ForgotPasswordModal/ForgotPasswordModal.stories.js +0 -69
- package/dist/components/Form/Form.stories.js +0 -32
- package/dist/components/FullscreenCard/FullscreenCard.styles.js +0 -27
- package/dist/components/Header/Header.stories.js +0 -192
- package/dist/components/Icon/Icon.stories.js +0 -108
- package/dist/components/InfoIcon/InfoIcon.stories.js +0 -299
- package/dist/components/InfoPanel/InfoPanel.js +0 -124
- package/dist/components/Input/DatePickerInput.stories.js +0 -87
- package/dist/components/Input/Input.stories.js +0 -217
- package/dist/components/Input/InputPassword.stories.js +0 -80
- package/dist/components/Input/InputWithButton.stories.js +0 -75
- package/dist/components/Input/MultiSelect.stories.js +0 -264
- package/dist/components/Input/OtpInput.stories.js +0 -57
- package/dist/components/Input/RangeInput.stories.js +0 -58
- package/dist/components/Input/SearchInput.stories.js +0 -366
- package/dist/components/Input/Select.stories.js +0 -478
- package/dist/components/InvestCalculator/InvestCalculator.stories.js +0 -135
- package/dist/components/InvestmentStat/InvestmentStat.stories.js +0 -52
- package/dist/components/KYCFlow/BasicInfo.js +0 -448
- package/dist/components/KYCFlow/Confirmation.js +0 -46
- package/dist/components/KYCFlow/DocumentFileUpload.js +0 -263
- package/dist/components/KYCFlow/DocumentScan.js +0 -75
- package/dist/components/KYCFlow/DocumentScanUpload.js +0 -251
- package/dist/components/KYCFlow/DocumentSelect.js +0 -118
- package/dist/components/KYCFlow/DocumentSuccess.js +0 -63
- package/dist/components/KYCFlow/DocumentUpload.js +0 -53
- package/dist/components/KYCFlow/DocumentVerificationType.js +0 -131
- package/dist/components/KYCFlow/FaceScan.js +0 -54
- package/dist/components/KYCFlow/FaceScanRecognition.js +0 -61
- package/dist/components/KYCFlow/FaceScanSuccess.js +0 -56
- package/dist/components/KYCFlow/Terms.js +0 -119
- package/dist/components/KYCFlow/_styles.js +0 -111
- package/dist/components/KYCFlow/index.js +0 -97
- package/dist/components/KYCSelectBox/KYCSelectBox.styles.js +0 -29
- package/dist/components/LatestUpdate/LatestUpdate.stories.js +0 -58
- package/dist/components/Layout/Layout.stories.js +0 -60
- package/dist/components/LearnMoreCarousel/LearnMoreCarousel.stories.js +0 -66
- package/dist/components/LearnMorePage/LearnMore.stories.js +0 -48
- package/dist/components/LearnMorePage/LearnMoreItem.stories.js +0 -62
- package/dist/components/LearnMoreSection/LearnMore.stories.js +0 -30
- package/dist/components/LearnMoreSection/LearnMoreItem.stories.js +0 -59
- package/dist/components/LoginModal/LoginModal.stories.js +0 -74
- package/dist/components/MatomoConnect/Matomo.js +0 -228
- package/dist/components/MatomoConnect/Matomo_fuckup.js +0 -387
- package/dist/components/Modal/Modal.stories.js +0 -75
- package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +0 -150
- package/dist/components/Modal/PaymentModal.stories.js +0 -57
- package/dist/components/Modal/SideModal.stories.js +0 -342
- package/dist/components/MultiProgressBar/MultiProgressBar.stories.js +0 -67
- package/dist/components/Newsletter/Newsletter.stories.js +0 -16
- package/dist/components/NotificationContext/NotificationContext.js +0 -141
- package/dist/components/Number/Number.stories.js +0 -92
- package/dist/components/Pagination/Pagination.stories.js +0 -83
- package/dist/components/Pagination/PaginationControls.stories.js +0 -112
- package/dist/components/Payment/PaymentDetailsCard.stories.js +0 -198
- package/dist/components/Payment/PaymentDisplay.stories.js +0 -302
- package/dist/components/Payment/TimerComponent.stories.js +0 -236
- package/dist/components/Process/Process.stories.js +0 -42
- package/dist/components/ProfileBadge/ProfileBadge.stories.js +0 -45
- package/dist/components/ProfileBox/ProfileBox.stories.js +0 -35
- package/dist/components/ProfileHeader/ProfileHeader.js +0 -252
- package/dist/components/ProfileHeader/ProfileHeader.styles.js +0 -65
- package/dist/components/ProfileStat/ProfileStat.stories.js +0 -66
- package/dist/components/ProofOfAddress/ProofOfAddress.styles.js +0 -53
- package/dist/components/QRCode/QRCode.stories.js +0 -104
- package/dist/components/Radio/Radio.stories.js +0 -73
- package/dist/components/RefreshButton/RefreshButton.stories.js +0 -38
- package/dist/components/RegisterAlgorand/AlgoAddressName.js +0 -138
- package/dist/components/RegisterAlgorand/AlgoAdressSelect.js +0 -443
- package/dist/components/RegisterAlgorand/AlgoConnectWallet.js +0 -47
- package/dist/components/RegisterAlgorand/AlgoSuccess.js +0 -38
- package/dist/components/RegisterAlgorand/Algorand.stories.js +0 -80
- package/dist/components/RegisterAlgorand/ChooseWallet.js +0 -97
- package/dist/components/RegisterAlgorand/SelectProject.js +0 -89
- package/dist/components/RegisterAlgorand/_styles.js +0 -28
- package/dist/components/RegisterAlgorand/flow.js +0 -409
- package/dist/components/RegisterAlgorand/flowWithMemo.js +0 -410
- package/dist/components/RegisterAlgorand/index.js +0 -48
- package/dist/components/RegisterConfirmModal/RegisterConfirmModal.stories.js +0 -41
- package/dist/components/RegisterEthereum/EthAddressLedger.js +0 -226
- package/dist/components/RegisterEthereum/EthAddressMetamask.js +0 -204
- package/dist/components/RegisterEthereum/EthAddressName.js +0 -135
- package/dist/components/RegisterEthereum/EthConnectLedger.js +0 -194
- package/dist/components/RegisterEthereum/EthConnectMetamask.js +0 -35
- package/dist/components/RegisterEthereum/EthFinish.js +0 -41
- package/dist/components/RegisterEthereum/EthIntro.js +0 -95
- package/dist/components/RegisterEthereum/_styles.js +0 -28
- package/dist/components/RegisterEthereum/index.js +0 -68
- package/dist/components/RegisterModal/RegisterModal.stories.js +0 -49
- package/dist/components/RequestDataBox/RequestDataBox.stories.js +0 -37
- package/dist/components/RiskQuestionnaire/RiskQuestionnaireContext.js +0 -185
- package/dist/components/RiskQuestionnaire/_styles.js +0 -15
- package/dist/components/SEO/SEO.stories.js +0 -60
- package/dist/components/SideLine/SideLine.stories.js +0 -28
- package/dist/components/SigningSubflow/SignSubAddressMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubConnectLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubConnectMetamask.js +0 -137
- package/dist/components/SigningSubflow/SignSubIntro.js +0 -55
- package/dist/components/SigningSubflow/SignSubSendLedger.js +0 -150
- package/dist/components/SigningSubflow/SignSubSendMetamask.js +0 -62
- package/dist/components/SigningSubflow/SignSubTransactionLedger.js +0 -161
- package/dist/components/SigningSubflow/SignSubTransactionMetamask.js +0 -166
- package/dist/components/SigningSubflow/_styles.js +0 -34
- package/dist/components/SigningSubflow/index.js +0 -32
- package/dist/components/Slider/Slider.stories.js +0 -68
- package/dist/components/Snackbar/Snackbar.stories.js +0 -292
- package/dist/components/StatusTag/StatusTag.stories.js +0 -262
- package/dist/components/StepController/StepController.stories.js +0 -60
- package/dist/components/StepController/StepControllerProgress.stories.js +0 -49
- package/dist/components/StepsProgress/StepIndicator.stories.js +0 -153
- package/dist/components/StepsProgress/StepsProgress.stories.js +0 -49
- package/dist/components/Switch/Switch.stories.js +0 -81
- package/dist/components/Tabs/Tabs.stories.js +0 -36
- package/dist/components/TabsNav/TabNav.stories.js +0 -40
- package/dist/components/TabsNav/TabsNav.stories.js +0 -37
- package/dist/components/TeamOverview/TeamOverview.stories.js +0 -76
- package/dist/components/TermsModal/TermsModal.stories.js +0 -31
- package/dist/components/Text/Headline.stories.js +0 -48
- package/dist/components/Text/Text.stories.js +0 -70
- package/dist/components/TextLink/TextLink.stories.js +0 -35
- package/dist/components/Timeline/Timeline.stories.js +0 -393
- package/dist/components/ToDoList/ToDoList.stories.js +0 -133
- package/dist/components/ToDoList/ToDoListTask.stories.js +0 -70
- package/dist/components/TransactionDetails/TransactionDetails.stories.js +0 -55
- package/dist/components/TransactionDetails/TransactionDetailsTable.stories.js +0 -305
- package/dist/components/TransactionInfo/TransactionInfo.stories.js +0 -61
- package/dist/components/TwoFactorModal/TwoFactorModal.js +0 -100
- package/dist/components/VerifyEmailModal/VerifyEmailModal.stories.js +0 -59
- package/dist/components/headerHo/HeaderHo.stories.js +0 -35
- package/dist/components/icons/Arrow.stories.js +0 -42
- package/dist/components/icons/ArrowSimple.stories.js +0 -48
- package/dist/components/icons/Check.stories.js +0 -22
- package/dist/components/icons/Facebook.stories.js +0 -21
- package/dist/components/icons/Facebook_Logo.png +0 -0
- package/dist/components/icons/Info.stories.js +0 -16
- package/dist/components/icons/Instagram.stories.js +0 -21
- package/dist/components/icons/LI-In-Bug.png +0 -0
- package/dist/components/icons/LinkIcon.stories.js +0 -21
- package/dist/components/icons/LinkedIn.stories.js +0 -16
- package/dist/components/icons/Medium.stories.js +0 -16
- package/dist/components/icons/Reddit.stories.js +0 -21
- package/dist/components/icons/Share.stories.js +0 -16
- package/dist/components/icons/Telegram-Logo.png +0 -0
- package/dist/components/icons/Telegram.stories.js +0 -16
- package/dist/components/icons/Twitter.stories.js +0 -21
- package/dist/components/icons/X-logo-black.png +0 -0
- package/dist/components/icons/X.stories.js +0 -16
- package/dist/components/icons/Youtube.stories.js +0 -21
- package/dist/components/icons/youtube_social_circle_red.png +0 -0
- package/dist/components/logo/Logo.stories.js +0 -260
- package/dist/components/taxId/TaxId.stories.js +0 -50
- package/dist/components/video/Video.stories.js +0 -52
- package/dist/static/images/document-icon.svg +0 -3
- package/dist/static/images/sent-icon.svg +0 -10
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.alias = alias;
|
|
7
|
+
exports.hasOptedIn = hasOptedIn;
|
|
8
|
+
exports.identify = identify;
|
|
9
|
+
exports.initAnalytics = initAnalytics;
|
|
10
|
+
exports.optIn = optIn;
|
|
11
|
+
exports.optOut = optOut;
|
|
12
|
+
exports.reset = reset;
|
|
13
|
+
exports.timeEvent = timeEvent;
|
|
14
|
+
exports.track = track;
|
|
15
|
+
var _mixpanelBrowser = _interopRequireDefault(require("mixpanel-browser"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const BLOCKED_FIELDS = new Set([
|
|
18
|
+
// PII
|
|
19
|
+
'email', 'first_name', 'last_name', 'full_name', 'name', 'phone', 'date_of_birth', 'address', 'nationality', 'passport_number',
|
|
20
|
+
// Blockchain
|
|
21
|
+
'wallet_address', 'tx_hash', 'transaction_hash', 'block_hash', 'contract_address', 'signing_address',
|
|
22
|
+
// Financial precision — server sends bucketed values only
|
|
23
|
+
'amount', 'exact_amount', 'investment_amount', 'token_quantity', 'token_price', 'token_value', 'price', 'value', 'balance', 'nav', 'net_asset_value',
|
|
24
|
+
// Banking
|
|
25
|
+
'iban', 'bic', 'swift', 'bank_account', 'routing_number',
|
|
26
|
+
// KYC
|
|
27
|
+
'kyc_data', 'kyb_data', 'document_id', 'tax_id', 'ssn']);
|
|
28
|
+
const BLOCKED_PATTERNS = [/address$/i,
|
|
29
|
+
// wallet_address, contract_address, billing_address
|
|
30
|
+
/hash$/i,
|
|
31
|
+
// tx_hash, block_hash
|
|
32
|
+
/^raw_/i, /password/i, /secret/i, /private.*key/i, /\bprice\b/i, /exact/i];
|
|
33
|
+
function sanitize(props) {
|
|
34
|
+
if (!props || typeof props !== 'object' || Array.isArray(props)) {
|
|
35
|
+
return props !== null && props !== void 0 ? props : {};
|
|
36
|
+
}
|
|
37
|
+
const cleaned = {};
|
|
38
|
+
for (const [key, val] of Object.entries(props)) {
|
|
39
|
+
const isBlocked = BLOCKED_FIELDS.has(key.toLowerCase()) || BLOCKED_PATTERNS.some(re => re.test(key));
|
|
40
|
+
if (isBlocked) {
|
|
41
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
42
|
+
console.warn("[analytics] Blocked field stripped before sending: \"".concat(key, "\""));
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
cleaned[key] = val && typeof val === 'object' && !Array.isArray(val) ? sanitize(val) : val;
|
|
47
|
+
}
|
|
48
|
+
return cleaned;
|
|
49
|
+
}
|
|
50
|
+
let initialized = false;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Call once at app root.
|
|
54
|
+
*
|
|
55
|
+
* No token → all calls are silent no-ops.
|
|
56
|
+
* Add `.mp-sensitive` CSS class to elements that should be masked in session recordings.
|
|
57
|
+
*
|
|
58
|
+
* @param {{ token: string, app?: string, requireConsent?: boolean }} config
|
|
59
|
+
* requireConsent — true only for apps with a cookie banner (e.g. homepage).
|
|
60
|
+
* Nothing is tracked until optIn() is called.
|
|
61
|
+
* Default false — authenticated apps track immediately.
|
|
62
|
+
*/
|
|
63
|
+
function initAnalytics() {
|
|
64
|
+
let {
|
|
65
|
+
token,
|
|
66
|
+
app,
|
|
67
|
+
requireConsent = false
|
|
68
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
69
|
+
if (initialized) return;
|
|
70
|
+
if (!token) return;
|
|
71
|
+
_mixpanelBrowser.default.init(token, {
|
|
72
|
+
api_host: 'https://api-eu.mixpanel.com',
|
|
73
|
+
autocapture: {
|
|
74
|
+
pageview: 'full-url',
|
|
75
|
+
click: true,
|
|
76
|
+
dead_click: true,
|
|
77
|
+
input: true,
|
|
78
|
+
rage_click: true,
|
|
79
|
+
scroll: true,
|
|
80
|
+
submit: true,
|
|
81
|
+
capture_text_content: false // never capture visible text
|
|
82
|
+
},
|
|
83
|
+
record_sessions_percent: 100,
|
|
84
|
+
record_heatmap_data: true,
|
|
85
|
+
opt_out_tracking_by_default: requireConsent,
|
|
86
|
+
persistence: 'localStorage',
|
|
87
|
+
debug: process.env.NODE_ENV !== 'production'
|
|
88
|
+
});
|
|
89
|
+
if (app) {
|
|
90
|
+
_mixpanelBrowser.default.register({
|
|
91
|
+
app
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
initialized = true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Call when user accepts the cookie/consent banner. */
|
|
98
|
+
function optIn() {
|
|
99
|
+
if (!initialized) return;
|
|
100
|
+
_mixpanelBrowser.default.opt_in_tracking();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Call when user declines the cookie/consent banner. */
|
|
104
|
+
function optOut() {
|
|
105
|
+
if (!initialized) return;
|
|
106
|
+
_mixpanelBrowser.default.opt_out_tracking();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Use to set the initial state of the cookie banner UI. */
|
|
110
|
+
function hasOptedIn() {
|
|
111
|
+
if (!initialized) return false;
|
|
112
|
+
return _mixpanelBrowser.default.has_opted_in_tracking();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Track a custom event. Props are sanitized before sending. */
|
|
116
|
+
function track(eventName) {
|
|
117
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
118
|
+
if (!initialized) return;
|
|
119
|
+
_mixpanelBrowser.default.track(eventName, sanitize(props));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Start a duration timer. When track() is called with the same event name,
|
|
124
|
+
* Mixpanel automatically appends a Duration property.
|
|
125
|
+
*
|
|
126
|
+
* timeEvent('kyc.completed')
|
|
127
|
+
* // ... user goes through flow ...
|
|
128
|
+
* track('kyc.completed') // → { Duration: 142.3 }
|
|
129
|
+
*/
|
|
130
|
+
function timeEvent(eventName) {
|
|
131
|
+
if (!initialized) return;
|
|
132
|
+
_mixpanelBrowser.default.time_event(eventName);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Called automatically by AuthContext on login — no need to call from consuming apps.
|
|
137
|
+
* @param {string} userId — internal UUID (_id), never email
|
|
138
|
+
*/
|
|
139
|
+
function identify(userId) {
|
|
140
|
+
let traits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
141
|
+
if (!initialized) return;
|
|
142
|
+
_mixpanelBrowser.default.identify(userId);
|
|
143
|
+
const sanitizedTraits = sanitize(traits);
|
|
144
|
+
if (Object.keys(sanitizedTraits).length > 0) {
|
|
145
|
+
_mixpanelBrowser.default.people.set(sanitizedTraits);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Only needed for legacy Mixpanel projects (Original ID Merge).
|
|
151
|
+
* New projects (post-2023) handle merging automatically via identify().
|
|
152
|
+
*/
|
|
153
|
+
function alias(userId) {
|
|
154
|
+
if (!initialized) return;
|
|
155
|
+
_mixpanelBrowser.default.alias(userId);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Called automatically by AuthContext on logout — no need to call from consuming apps. */
|
|
159
|
+
function reset() {
|
|
160
|
+
if (!initialized) return;
|
|
161
|
+
_mixpanelBrowser.default.reset();
|
|
162
|
+
}
|
|
@@ -86,7 +86,7 @@ const LoginWithOTP = _ref => {
|
|
|
86
86
|
message: undefined
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
const backgroundProp = "url(".concat(_background.default, ") left
|
|
89
|
+
const backgroundProp = "url(".concat(_background.default, ") left top no-repeat");
|
|
90
90
|
return /*#__PURE__*/_react.default.createElement(_Layout.Layout, {
|
|
91
91
|
noHeader: true,
|
|
92
92
|
noFooter: true
|
|
@@ -17,7 +17,7 @@ var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
|
17
17
|
var _InfoIcon = _interopRequireDefault(require("../InfoIcon/InfoIcon"));
|
|
18
18
|
var _Modal = require("../Modal/Modal");
|
|
19
19
|
var _Sucess2FA = _interopRequireDefault(require("./Sucess2FA"));
|
|
20
|
-
const _excluded = ["onRequiresRecentLoginError", "open2faflow", "onLoginAgainClick", "openDisable2faflow", "title", "subtitle", "showSwitch", "customComponent"];
|
|
20
|
+
const _excluded = ["onRequiresRecentLoginError", "open2faflow", "onLoginAgainClick", "openDisable2faflow", "title", "subtitle", "showSwitch", "customComponent", "onFlowClose"];
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -36,7 +36,8 @@ const Main2FAFlow = _ref => {
|
|
|
36
36
|
title = 'SET UP YOUR LOG IN TWO FACTOR AUTHENTICATION',
|
|
37
37
|
subtitle = 'Protect your account with an additional layer of security to log in',
|
|
38
38
|
showSwitch = true,
|
|
39
|
-
customComponent
|
|
39
|
+
customComponent,
|
|
40
|
+
onFlowClose
|
|
40
41
|
} = _ref,
|
|
41
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
43
|
const {
|
|
@@ -79,6 +80,9 @@ const Main2FAFlow = _ref => {
|
|
|
79
80
|
} catch (error) {
|
|
80
81
|
if (error.code === 'auth/requires-recent-login' || error.code === 'auth/unsupported-first-factor') {
|
|
81
82
|
setisLoginRequired(true);
|
|
83
|
+
if (isFlowopen.enable2fa && !isFlowopen.requiresRecentLogin) {
|
|
84
|
+
onRequiresRecentLoginErrorHandler();
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
};
|
|
@@ -88,6 +92,14 @@ const Main2FAFlow = _ref => {
|
|
|
88
92
|
[nextFlowId]: true
|
|
89
93
|
}));
|
|
90
94
|
};
|
|
95
|
+
|
|
96
|
+
// Helper to close a flow and call the custom onFlowClose handler
|
|
97
|
+
const handleFlowClose = flowId => {
|
|
98
|
+
setIsFlowOpen(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
99
|
+
[flowId]: false
|
|
100
|
+
}));
|
|
101
|
+
onFlowClose && onFlowClose(flowId);
|
|
102
|
+
};
|
|
91
103
|
const onEnable2FASuccess = async () => {
|
|
92
104
|
setis2FAEnabled(true);
|
|
93
105
|
checkMfaEnrollment();
|
|
@@ -112,11 +124,15 @@ const Main2FAFlow = _ref => {
|
|
|
112
124
|
openEnable2FA: () => switchOpenFlow('disable2fa', 'enable2fa'),
|
|
113
125
|
openDisable2FA: () => switchOpenFlow('enable2fa', 'disable2fa'),
|
|
114
126
|
closeFlows: () => {
|
|
127
|
+
const wasOpen = Object.keys(isFlowopen).find(key => isFlowopen[key]);
|
|
115
128
|
setIsFlowOpen({
|
|
116
129
|
enable2fa: false,
|
|
117
130
|
disable2fa: false,
|
|
118
131
|
requiresRecentLogin: false
|
|
119
132
|
});
|
|
133
|
+
if (wasOpen) {
|
|
134
|
+
onFlowClose && onFlowClose(wasOpen);
|
|
135
|
+
}
|
|
120
136
|
},
|
|
121
137
|
is2FAEnabled,
|
|
122
138
|
isFlowOpen: isFlowopen
|
|
@@ -169,24 +185,34 @@ const Main2FAFlow = _ref => {
|
|
|
169
185
|
flowActions
|
|
170
186
|
}) : customComponent), isFlowopen.enable2fa && /*#__PURE__*/_react.default.createElement(_enable2faFlow.default, {
|
|
171
187
|
showFlow: isFlowopen.enable2fa,
|
|
172
|
-
setShowFlow: value =>
|
|
173
|
-
|
|
174
|
-
|
|
188
|
+
setShowFlow: value => {
|
|
189
|
+
if (!value) {
|
|
190
|
+
handleFlowClose('enable2fa');
|
|
191
|
+
} else {
|
|
192
|
+
setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
|
|
193
|
+
enable2fa: value
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
},
|
|
175
197
|
totpData: totpData,
|
|
176
198
|
onRequiresRecentLoginError: onRequiresRecentLoginErrorHandler,
|
|
177
199
|
onSuccess: onEnable2FASuccess
|
|
178
200
|
}), isFlowopen.disable2fa && /*#__PURE__*/_react.default.createElement(_disable2faFlow.default, {
|
|
179
201
|
showFlow: isFlowopen.disable2fa,
|
|
180
|
-
setShowFlow: value =>
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
setShowFlow: value => {
|
|
203
|
+
if (!value) {
|
|
204
|
+
handleFlowClose('disable2fa');
|
|
205
|
+
} else {
|
|
206
|
+
setIsFlowOpen(_objectSpread(_objectSpread({}, isFlowopen), {}, {
|
|
207
|
+
disable2fa: value
|
|
208
|
+
}));
|
|
209
|
+
}
|
|
210
|
+
},
|
|
183
211
|
onRequiresRecentLoginError: onRequiresRecentLoginErrorHandler,
|
|
184
212
|
onSuccess: onDisable2FASuccess
|
|
185
213
|
}), isFlowopen.requiresRecentLogin && /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
186
214
|
isOpen: isFlowopen.requiresRecentLogin,
|
|
187
|
-
onClose: () =>
|
|
188
|
-
requiresRecentLogin: false
|
|
189
|
-
}))
|
|
215
|
+
onClose: () => handleFlowClose('requiresRecentLogin')
|
|
190
216
|
}, /*#__PURE__*/_react.default.createElement(_Modal.ModalInner, {
|
|
191
217
|
noPadding: true
|
|
192
218
|
}, /*#__PURE__*/_react.default.createElement(_Sucess2FA.default, {
|
|
@@ -200,6 +226,8 @@ const Main2FAFlow = _ref => {
|
|
|
200
226
|
};
|
|
201
227
|
exports.Main2FAFlow = Main2FAFlow;
|
|
202
228
|
Main2FAFlow.propTypes = {
|
|
203
|
-
onRequiresRecentLoginError: _propTypes.default.func
|
|
229
|
+
onRequiresRecentLoginError: _propTypes.default.func,
|
|
230
|
+
/** Called when any flow/modal is closed. Receives the flowId: 'enable2fa' | 'disable2fa' | 'requiresRecentLogin' */
|
|
231
|
+
onFlowClose: _propTypes.default.func
|
|
204
232
|
};
|
|
205
233
|
var _default = exports.default = Main2FAFlow;
|
|
@@ -28,10 +28,9 @@ const Chip = _ref => {
|
|
|
28
28
|
}, props), /*#__PURE__*/_react.default.createElement(_ChipStyles.ChipText, null, children), tooltip && /*#__PURE__*/_react.default.createElement(_InfoIcon.default, _extends({
|
|
29
29
|
title: tooltip,
|
|
30
30
|
position: "top",
|
|
31
|
-
noIcon: true,
|
|
32
31
|
noMarginLeft: true,
|
|
33
32
|
noMarginRight: true
|
|
34
|
-
}, tooltipProps)
|
|
33
|
+
}, tooltipProps)));
|
|
35
34
|
};
|
|
36
35
|
exports.Chip = Chip;
|
|
37
36
|
Chip.propTypes = {
|
|
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Wrapper = exports.TooltipChipIcon = exports.StyledChip = exports.ChipText = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
8
|
var _theme = _interopRequireDefault(require("../../styles/theme"));
|
|
9
|
+
var _InfoIcon = require("../InfoIcon/InfoIcon.styles");
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
const StyledChip = exports.StyledChip = _styledComponents.default.div.withConfig({
|
|
11
12
|
displayName: "Chipstyles__StyledChip",
|
|
12
13
|
componentId: "sc-pcmyil-0"
|
|
13
|
-
})(["display:inline-flex;gap:4px;align-items:center;padding:8px 16px;border-radius:20px;background-color:transparent;color:black;cursor:pointer;transition:background-color 0.3s;font-size:11px;font-weight:400;line-height:20px;letter-spacing:3px;font-weight:600;min-height:40px;&:hover,&:active{background-color:red;color:white;}", ""], _ref => {
|
|
14
|
+
})(["display:inline-flex;gap:4px;align-items:center;padding:8px 16px;border-radius:20px;background-color:transparent;color:black;cursor:pointer;transition:background-color 0.3s;font-size:11px;font-weight:400;line-height:20px;letter-spacing:3px;font-weight:600;min-height:40px;&:hover,&:active{background-color:red;color:white;", "{color:", ";}}", ""], _InfoIcon.Icon, _theme.default.cWhite, _ref => {
|
|
14
15
|
let {
|
|
15
16
|
isActive
|
|
16
17
|
} = _ref;
|
|
17
|
-
return isActive && "\n background-color: red;\n color: white;\n font-weight: 800;\n\n ".concat(
|
|
18
|
+
return isActive && "\n background-color: red;\n color: white;\n font-weight: 800;\n\n ".concat(_InfoIcon.Icon, " {\n color: ").concat(_theme.default.cWhite, " ;\n }\n ");
|
|
18
19
|
});
|
|
19
20
|
const Wrapper = exports.Wrapper = _styledComponents.default.div.withConfig({
|
|
20
21
|
displayName: "Chipstyles__Wrapper",
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.confirm = exports.ConfirmModal = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _client = require("react-dom/client");
|
|
9
|
+
var _Modal = require("../Modal/Modal");
|
|
10
|
+
var _Grid = require("../Grid/Grid.styles");
|
|
11
|
+
var _ComponentWrapper = require("../ComponentWrapper/ComponentWrapper.styles");
|
|
12
|
+
var _Button = require("../Button/Button.styles");
|
|
13
|
+
var _Text = require("../Text/Text.styles");
|
|
14
|
+
var _ConfirmModal = require("./ConfirmModal.styles");
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
// Container for the modal - created once
|
|
18
|
+
let confirmContainer = null;
|
|
19
|
+
let confirmRoot = null;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal ConfirmModal component
|
|
23
|
+
*/
|
|
24
|
+
const ConfirmModalComponent = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
isOpen,
|
|
27
|
+
onClose,
|
|
28
|
+
onConfirm,
|
|
29
|
+
onCancel,
|
|
30
|
+
title,
|
|
31
|
+
message,
|
|
32
|
+
content,
|
|
33
|
+
confirmText,
|
|
34
|
+
cancelText,
|
|
35
|
+
showCancel,
|
|
36
|
+
showRedBar,
|
|
37
|
+
lineColor,
|
|
38
|
+
barColor,
|
|
39
|
+
renderFooter,
|
|
40
|
+
modalProps,
|
|
41
|
+
buttonProps,
|
|
42
|
+
cancelButtonProps,
|
|
43
|
+
contentFullWidth,
|
|
44
|
+
barStyle
|
|
45
|
+
} = _ref;
|
|
46
|
+
const [titleHeight, setTitleHeight] = (0, _react.useState)(0);
|
|
47
|
+
const observerRef = (0, _react.useRef)(null);
|
|
48
|
+
|
|
49
|
+
// Callback ref - guaranteed to run when element is attached to DOM
|
|
50
|
+
const titleRef = (0, _react.useCallback)(node => {
|
|
51
|
+
// Cleanup previous observer
|
|
52
|
+
if (observerRef.current) {
|
|
53
|
+
observerRef.current.disconnect();
|
|
54
|
+
observerRef.current = null;
|
|
55
|
+
}
|
|
56
|
+
if (node) {
|
|
57
|
+
// Set initial height immediately
|
|
58
|
+
setTitleHeight(node.offsetHeight);
|
|
59
|
+
|
|
60
|
+
// Watch for size changes
|
|
61
|
+
observerRef.current = new ResizeObserver(() => {
|
|
62
|
+
setTitleHeight(node.offsetHeight);
|
|
63
|
+
});
|
|
64
|
+
observerRef.current.observe(node);
|
|
65
|
+
}
|
|
66
|
+
}, []);
|
|
67
|
+
const handleConfirm = (0, _react.useCallback)(function () {
|
|
68
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
69
|
+
onConfirm === null || onConfirm === void 0 || onConfirm(value);
|
|
70
|
+
onClose === null || onClose === void 0 || onClose();
|
|
71
|
+
}, [onConfirm, onClose]);
|
|
72
|
+
const handleCancel = (0, _react.useCallback)(() => {
|
|
73
|
+
onCancel === null || onCancel === void 0 || onCancel();
|
|
74
|
+
onClose === null || onClose === void 0 || onClose();
|
|
75
|
+
}, [onCancel, onClose]);
|
|
76
|
+
|
|
77
|
+
// Handle Escape key
|
|
78
|
+
(0, _react.useEffect)(() => {
|
|
79
|
+
if (!isOpen) return;
|
|
80
|
+
const handleKeyDown = e => {
|
|
81
|
+
if (e.key === 'Escape') {
|
|
82
|
+
handleCancel();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
86
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
87
|
+
}, [isOpen, handleCancel]);
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement(_Modal.Modal, _extends({
|
|
89
|
+
isOpen: isOpen,
|
|
90
|
+
onClose: handleCancel,
|
|
91
|
+
maxHeight: "90vh",
|
|
92
|
+
boxStyles: {
|
|
93
|
+
minHeight: 'unset'
|
|
94
|
+
}
|
|
95
|
+
// maxWidth="1500px"
|
|
96
|
+
}, modalProps), /*#__PURE__*/_react.default.createElement(_Grid.Row, null, /*#__PURE__*/_react.default.createElement(_Grid.Column, {
|
|
97
|
+
relative: true,
|
|
98
|
+
part: contentFullWidth ? null : 14
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(_Modal.ModalInner, null, /*#__PURE__*/_react.default.createElement(_ConfirmModal.ContainerWithLine, {
|
|
100
|
+
height: titleHeight,
|
|
101
|
+
lineColor: lineColor
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement(_Text.Text, null, /*#__PURE__*/_react.default.createElement("div", null, title && /*#__PURE__*/_react.default.createElement("h3", {
|
|
103
|
+
ref: titleRef,
|
|
104
|
+
style: {
|
|
105
|
+
margin: 0
|
|
106
|
+
}
|
|
107
|
+
}, title), message && /*#__PURE__*/_react.default.createElement("p", null, message)), content && /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
style: {
|
|
109
|
+
marginTop: '16px'
|
|
110
|
+
}
|
|
111
|
+
}, content)), renderFooter ? /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, renderFooter({
|
|
112
|
+
onConfirm: handleConfirm,
|
|
113
|
+
onCancel: handleCancel
|
|
114
|
+
})) : /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, {
|
|
115
|
+
noPaddingHorizontal: true,
|
|
116
|
+
flex: true,
|
|
117
|
+
style: {
|
|
118
|
+
gap: 16
|
|
119
|
+
}
|
|
120
|
+
}, showCancel && /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({
|
|
121
|
+
outlineBlack: true,
|
|
122
|
+
minWidth: "120px",
|
|
123
|
+
onClick: handleCancel
|
|
124
|
+
}, cancelButtonProps), cancelText), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({
|
|
125
|
+
minWidth: "120px",
|
|
126
|
+
onClick: () => handleConfirm(true)
|
|
127
|
+
}, buttonProps), confirmText))))), showRedBar && /*#__PURE__*/_react.default.createElement(_ConfirmModal.RedBar, {
|
|
128
|
+
barColor: barColor,
|
|
129
|
+
style: barStyle
|
|
130
|
+
})));
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Imperative confirm function
|
|
135
|
+
*
|
|
136
|
+
* @param {Object} options - Confirm options
|
|
137
|
+
* @param {string} options.title - Modal title
|
|
138
|
+
* @param {string} options.message - Modal message text
|
|
139
|
+
* @param {React.ReactNode} options.content - Custom content (React components)
|
|
140
|
+
* @param {string} options.confirmText - Confirm button text (default: 'Confirm')
|
|
141
|
+
* @param {string} options.cancelText - Cancel button text (default: 'Cancel')
|
|
142
|
+
* @param {boolean} options.showCancel - Show cancel button (default: true)
|
|
143
|
+
* @param {boolean} options.showRedBar - Show red bar decoration (default: true)
|
|
144
|
+
* @param {string} options.lineColor - Color of the left line (default: blue)
|
|
145
|
+
* @param {string} options.barColor - Color of the bottom bar (default: orangishRed)
|
|
146
|
+
* @param {Function} options.renderFooter - Custom footer renderer: ({ onConfirm, onCancel }) => React.ReactNode
|
|
147
|
+
* @param {Object} options.modalProps - Additional props to pass to Modal component
|
|
148
|
+
* @param {Object} options.buttonProps - Props for the confirm button
|
|
149
|
+
* @param {Object} options.cancelButtonProps - Props for the cancel button
|
|
150
|
+
* @returns {Promise<boolean|any>} - Resolves with true/false or custom value from renderFooter
|
|
151
|
+
*/
|
|
152
|
+
exports.ConfirmModal = ConfirmModalComponent;
|
|
153
|
+
const confirm = function () {
|
|
154
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
155
|
+
const {
|
|
156
|
+
title = 'Confirm',
|
|
157
|
+
message = '',
|
|
158
|
+
content = null,
|
|
159
|
+
confirmText = 'Confirm',
|
|
160
|
+
cancelText = 'Cancel',
|
|
161
|
+
showCancel = true,
|
|
162
|
+
showRedBar = true,
|
|
163
|
+
lineColor,
|
|
164
|
+
barColor,
|
|
165
|
+
renderFooter = null,
|
|
166
|
+
modalProps = {},
|
|
167
|
+
buttonProps = {},
|
|
168
|
+
cancelButtonProps = {}
|
|
169
|
+
} = options;
|
|
170
|
+
return new Promise(resolve => {
|
|
171
|
+
// Create container if it doesn't exist
|
|
172
|
+
if (!confirmContainer) {
|
|
173
|
+
confirmContainer = document.createElement('div');
|
|
174
|
+
confirmContainer.id = 'confirm-modal-root';
|
|
175
|
+
document.body.appendChild(confirmContainer);
|
|
176
|
+
confirmRoot = (0, _client.createRoot)(confirmContainer);
|
|
177
|
+
}
|
|
178
|
+
let isResolved = false;
|
|
179
|
+
const handleConfirm = value => {
|
|
180
|
+
if (!isResolved) {
|
|
181
|
+
isResolved = true;
|
|
182
|
+
resolve(value);
|
|
183
|
+
// Render closed state to trigger animation
|
|
184
|
+
renderModal(false);
|
|
185
|
+
// Cleanup after animation
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
renderModal(null);
|
|
188
|
+
}, 350);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const handleCancel = () => {
|
|
192
|
+
if (!isResolved) {
|
|
193
|
+
isResolved = true;
|
|
194
|
+
resolve(false);
|
|
195
|
+
renderModal(false);
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
renderModal(null);
|
|
198
|
+
}, 350);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const handleClose = () => {
|
|
202
|
+
if (!isResolved) {
|
|
203
|
+
handleCancel();
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const renderModal = isOpen => {
|
|
207
|
+
if (isOpen === null) {
|
|
208
|
+
// Cleanup
|
|
209
|
+
confirmRoot.render(null);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
confirmRoot.render(/*#__PURE__*/_react.default.createElement(ConfirmModalComponent, {
|
|
213
|
+
isOpen: isOpen,
|
|
214
|
+
onClose: handleClose,
|
|
215
|
+
onConfirm: handleConfirm,
|
|
216
|
+
onCancel: handleCancel,
|
|
217
|
+
title: title,
|
|
218
|
+
message: message,
|
|
219
|
+
content: content,
|
|
220
|
+
confirmText: confirmText,
|
|
221
|
+
cancelText: cancelText,
|
|
222
|
+
showCancel: showCancel,
|
|
223
|
+
showRedBar: showRedBar,
|
|
224
|
+
lineColor: lineColor,
|
|
225
|
+
barColor: barColor,
|
|
226
|
+
renderFooter: renderFooter,
|
|
227
|
+
modalProps: modalProps,
|
|
228
|
+
buttonProps: buttonProps,
|
|
229
|
+
cancelButtonProps: cancelButtonProps
|
|
230
|
+
}));
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// Render open modal
|
|
234
|
+
renderModal(true);
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// Also export the component for controlled usage if needed
|
|
239
|
+
exports.confirm = confirm;
|
|
240
|
+
var _default = exports.default = confirm;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RedBar = exports.ContainerWithLine = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
9
|
+
var _rwd = _interopRequireDefault(require("../../styles/rwd"));
|
|
10
|
+
var _Text = _interopRequireDefault(require("../Text/Text.styles"));
|
|
11
|
+
var _templateObject;
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
14
|
+
const ContainerWithLine = exports.ContainerWithLine = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
15
|
+
displayName: "ConfirmModalstyles__ContainerWithLine",
|
|
16
|
+
componentId: "sc-u85j89-0"
|
|
17
|
+
})(["position:relative;padding-left:48px;&::before{content:'';width:11px;height:", "px;background:", ";position:absolute;left:0;top:6px;}"], _ref => {
|
|
18
|
+
let {
|
|
19
|
+
height
|
|
20
|
+
} = _ref;
|
|
21
|
+
return height ? height - 15 : 50;
|
|
22
|
+
}, props => props.lineColor || _colors.default.blue);
|
|
23
|
+
const RedBar = exports.RedBar = _styledComponents.default.div.withConfig({
|
|
24
|
+
displayName: "ConfirmModalstyles__RedBar",
|
|
25
|
+
componentId: "sc-u85j89-1"
|
|
26
|
+
})(["background:", ";bottom:0;height:20%;position:absolute;right:0;width:50%;max-height:85px;max-width:400px;", " @media (max-width:767px){display:none;}"], props => props.barColor || _colors.default.orangishRed, _rwd.default.Medium(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: block;\n "]))));
|
|
@@ -43,7 +43,8 @@ const CryptoAddress = _ref => {
|
|
|
43
43
|
wrapperStyle,
|
|
44
44
|
bodyStyle,
|
|
45
45
|
containerStyle,
|
|
46
|
-
dataValueStyle
|
|
46
|
+
dataValueStyle,
|
|
47
|
+
valueChildMarginLeft
|
|
47
48
|
} = _ref;
|
|
48
49
|
const [copiedAddressToClipboard, setCopiedAddressToClipboard] = (0, _react.useState)(false);
|
|
49
50
|
return /*#__PURE__*/_react.default.createElement(_CryptoAddress.Container, {
|
|
@@ -88,7 +89,8 @@ const CryptoAddress = _ref => {
|
|
|
88
89
|
style: dataBoxStyle
|
|
89
90
|
}, data.value && /*#__PURE__*/_react.default.createElement(_CryptoAddress.Value, {
|
|
90
91
|
fontSize: fontSize,
|
|
91
|
-
style: dataValueStyle
|
|
92
|
+
style: dataValueStyle,
|
|
93
|
+
childMarginLeft: valueChildMarginLeft
|
|
92
94
|
}, data.unit && "".concat(data.unit, " "), data.shortAddress ? /*#__PURE__*/_react.default.createElement(_reactTippy.Tooltip, {
|
|
93
95
|
position: "top",
|
|
94
96
|
title: data.value,
|
|
@@ -105,7 +107,9 @@ const CryptoAddress = _ref => {
|
|
|
105
107
|
}
|
|
106
108
|
}, '= ', data.eqUnit && "".concat(data.eqUnit, " "), data.eqValue)), /*#__PURE__*/_react.default.createElement(_CryptoAddress.InfoBox, {
|
|
107
109
|
style: infoBoxStyle
|
|
108
|
-
}, /*#__PURE__*/_react.default.createElement(_CryptoAddress.Value,
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_CryptoAddress.Value, {
|
|
111
|
+
childMarginLeft: valueChildMarginLeft
|
|
112
|
+
}, info.unit && /*#__PURE__*/_react.default.createElement("strong", null, info.unit), info.value), info.eqValue && /*#__PURE__*/_react.default.createElement(_CryptoAddress.Equal, {
|
|
109
113
|
fontSize: eqValueFontSize,
|
|
110
114
|
style: eqValueStyle
|
|
111
115
|
}, info.noEqualsToSign ? ' ' : '= ', info.eqUnit && /*#__PURE__*/_react.default.createElement("strong", null, info.eqUnit), " ".concat(info.eqValue)))), sideOptions && /*#__PURE__*/_react.default.createElement(_CryptoAddress.OptionsWrapper, null, sideOptions)))));
|
|
@@ -149,7 +153,9 @@ CryptoAddress.propTypes = {
|
|
|
149
153
|
headStyle: _propTypes.default.object,
|
|
150
154
|
infoBoxStyle: _propTypes.default.object,
|
|
151
155
|
wrapperStyle: _propTypes.default.object,
|
|
152
|
-
dataValueStyle: _propTypes.default.object
|
|
156
|
+
dataValueStyle: _propTypes.default.object,
|
|
157
|
+
/** Margin-left for child divs inside Value (default: '30px') */
|
|
158
|
+
valueChildMarginLeft: _propTypes.default.string
|
|
153
159
|
};
|
|
154
160
|
//address not required in IIS, instead wrapping {address &&( .. now doing both which is redundant
|
|
155
161
|
|
|
@@ -89,7 +89,7 @@ const InfoBox = exports.InfoBox = _styledComponents.default.div.withConfig({
|
|
|
89
89
|
const Value = exports.Value = _styledComponents.default.div.withConfig({
|
|
90
90
|
displayName: "CryptoAddressstyles__Value",
|
|
91
91
|
componentId: "sc-1wjvdgu-12"
|
|
92
|
-
})(["position:relative;font-weight:300;font-size:22px;font-size:", "px;line-height:28px;letter-spacing:0.4px;strong{font-weight:normal;&:after{content:' ';}}& > div{display:inline-block;margin-left:
|
|
92
|
+
})(["position:relative;font-weight:300;font-size:22px;font-size:", "px;line-height:28px;letter-spacing:0.4px;strong{font-weight:normal;&:after{content:' ';}}& > div{display:inline-block;margin-left:", ";& svg{max-width:16px;max-height:16px;}}"], props => props.fontSize, props => props.childMarginLeft !== undefined ? props.childMarginLeft : '30px');
|
|
93
93
|
const Equal = exports.Equal = _styledComponents.default.div.withConfig({
|
|
94
94
|
displayName: "CryptoAddressstyles__Equal",
|
|
95
95
|
componentId: "sc-1wjvdgu-13"
|