@rhinestone/deposit-modal 0.14.1 → 0.15.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/README.md +6 -0
- package/bridge-transcript.json +14 -0
- package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
- package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
- package/dist/{DepositModalReown-2EVV64OA.mjs → DepositModalReown-KOJ7VEY7.mjs} +6 -7
- package/dist/{DepositModalReown-GAD45GIC.cjs → DepositModalReown-R37SSHUF.cjs} +21 -22
- package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
- package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
- package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
- package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
- package/dist/{chunk-HAQOFI3D.cjs → chunk-3OOY67VJ.cjs} +1046 -226
- package/dist/{chunk-AQVJUXSG.cjs → chunk-5P2PVLS4.cjs} +1 -1
- package/dist/{chunk-UX35GYLM.mjs → chunk-5VONFVQN.mjs} +918 -98
- package/dist/chunk-6HUHVXCY.cjs +704 -0
- package/dist/{chunk-GZ4GQ5MC.mjs → chunk-7UQ6OUEE.mjs} +166 -45
- package/dist/{chunk-LMG46EP2.mjs → chunk-CXBMIZUF.mjs} +1 -1
- package/dist/{chunk-A6JPBMYY.cjs → chunk-DTVZUBHI.cjs} +236 -115
- package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
- package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
- package/dist/{chunk-5Q5CSVKF.mjs → chunk-IKUYZA7A.mjs} +195 -495
- package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
- package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
- package/dist/chunk-QJ7RCCU7.mjs +704 -0
- package/dist/{chunk-XCTRKCNM.mjs → chunk-UCBUCX2W.mjs} +1515 -194
- package/dist/{chunk-NQMC5VKQ.cjs → chunk-VPDCGD2D.cjs} +552 -852
- package/dist/{chunk-4J5ADVIN.cjs → chunk-X4D52IZK.cjs} +1496 -175
- package/dist/claim.cjs +5 -7
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +4 -6
- package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
- package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +7 -8
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +6 -7
- package/dist/embed.cjs +135 -44
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.mjs +116 -25
- package/dist/index.cjs +13 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +12 -10
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/styles.css +132 -100
- package/dist/{types-DP_3KwlD.d.cts → types-CQ0NHqCy.d.ts} +146 -11
- package/dist/{types-Bho4OA03.d.ts → types-CxiLX5sv.d.cts} +146 -11
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +4 -4
- package/dist/withdraw.d.ts +4 -4
- package/dist/withdraw.mjs +5 -5
- package/package.json +6 -6
- package/dist/ClaimModal-GDFENSLV.mjs +0 -13
- package/dist/ClaimModal-L3FUBI5U.cjs +0 -13
- package/dist/WithdrawModal-FAQH35NG.cjs +0 -12
- package/dist/WithdrawModal-IKUHF5CF.mjs +0 -12
- package/dist/chunk-62UCV2LG.cjs +0 -81
- package/dist/chunk-7AZFT2MV.cjs +0 -163
- package/dist/chunk-QACOOLOE.mjs +0 -1062
- package/dist/chunk-R5UQ3TN4.mjs +0 -81
- package/dist/chunk-VALXN5IO.mjs +0 -163
- package/dist/chunk-YP7QVKQ6.cjs +0 -1062
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
+
HistoryEntryButton,
|
|
3
|
+
HistoryOverlay,
|
|
2
4
|
ProcessingStep,
|
|
3
5
|
analyticsTargetProperties,
|
|
6
|
+
createHistoryAnalytics,
|
|
4
7
|
deriveAccountSalt,
|
|
8
|
+
isHistoryEntryVisible,
|
|
5
9
|
isSubmissionUncertain,
|
|
10
|
+
useHistoryPanel,
|
|
6
11
|
useTokenPrices,
|
|
7
12
|
warnRemovedProps
|
|
8
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UCBUCX2W.mjs";
|
|
9
14
|
import {
|
|
10
15
|
AnalyticsSession,
|
|
11
16
|
BodyHeader,
|
|
@@ -41,7 +46,7 @@ import {
|
|
|
41
46
|
useStableRpcUrls,
|
|
42
47
|
useTargetTokens,
|
|
43
48
|
useWithdrawAnalyticsEmitter
|
|
44
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-5VONFVQN.mjs";
|
|
45
50
|
import {
|
|
46
51
|
NATIVE_TOKEN_ADDRESS,
|
|
47
52
|
getChainIcon,
|
|
@@ -50,13 +55,13 @@ import {
|
|
|
50
55
|
getTokenDecimalsByAddress,
|
|
51
56
|
getTokenSymbol,
|
|
52
57
|
targetChainToCaip2
|
|
53
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-EAGMY3QE.mjs";
|
|
54
59
|
|
|
55
60
|
// src/WithdrawModal.tsx
|
|
56
|
-
import { useCallback as useCallback3, useEffect as
|
|
61
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo4, useRef as useRef4, useState as useState4 } from "react";
|
|
57
62
|
|
|
58
63
|
// src/WithdrawFlow.tsx
|
|
59
|
-
import { useCallback as useCallback2, useEffect as
|
|
64
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef3, useState as useState3 } from "react";
|
|
60
65
|
|
|
61
66
|
// src/store/withdraw.ts
|
|
62
67
|
import { createContext, createElement, useContext } from "react";
|
|
@@ -622,7 +627,7 @@ function WithdrawFormStep({
|
|
|
622
627
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
623
628
|
|
|
624
629
|
// src/components/steps/WithdrawReviewStep.tsx
|
|
625
|
-
import { useState as useState2 } from "react";
|
|
630
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
626
631
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
627
632
|
function shortenAddress(addr) {
|
|
628
633
|
return addr.length > 12 ? `${addr.slice(0, 6)}\u2026${addr.slice(-4)}` : addr;
|
|
@@ -639,11 +644,18 @@ function WithdrawReviewStep({
|
|
|
639
644
|
registrationPending = false,
|
|
640
645
|
registrationError = null,
|
|
641
646
|
service,
|
|
647
|
+
onSubmittingChange,
|
|
642
648
|
onConfirm,
|
|
643
649
|
onError
|
|
644
650
|
}) {
|
|
645
651
|
const [isSubmitting, setIsSubmitting] = useState2(false);
|
|
646
652
|
const [error, setError] = useState2(null);
|
|
653
|
+
const onSubmittingChangeRef = useRef2(onSubmittingChange);
|
|
654
|
+
onSubmittingChangeRef.current = onSubmittingChange;
|
|
655
|
+
useEffect2(() => {
|
|
656
|
+
onSubmittingChangeRef.current?.(isSubmitting);
|
|
657
|
+
return () => onSubmittingChangeRef.current?.(false);
|
|
658
|
+
}, [isSubmitting]);
|
|
647
659
|
const sourceChainName = getChainName(sourceChain);
|
|
648
660
|
const sourceChainIcon = getChainIcon(sourceChain);
|
|
649
661
|
const targetSymbol = getTokenSymbol(targetToken, targetChain);
|
|
@@ -798,6 +810,23 @@ function createWithdrawAnalyticsController(emit) {
|
|
|
798
810
|
opened = true;
|
|
799
811
|
emit({ type: "withdraw_modal_open" });
|
|
800
812
|
},
|
|
813
|
+
// Never deduplicated: the visit id and the per-visit dedupe belong to the
|
|
814
|
+
// history adapter, which knows what a visit is.
|
|
815
|
+
historyOpened(detail) {
|
|
816
|
+
send({ type: "withdraw_modal_history_open", ...detail });
|
|
817
|
+
},
|
|
818
|
+
historyRowViewed(detail) {
|
|
819
|
+
send({ type: "withdraw_modal_history_row_view", ...detail });
|
|
820
|
+
},
|
|
821
|
+
historyLoadMore(detail) {
|
|
822
|
+
send({ type: "withdraw_modal_history_load_more", ...detail });
|
|
823
|
+
},
|
|
824
|
+
historyFallbackOpened(detail) {
|
|
825
|
+
send({ type: "withdraw_modal_history_fallback_open", ...detail });
|
|
826
|
+
},
|
|
827
|
+
historyRecoveryStarted(detail) {
|
|
828
|
+
send({ type: "withdraw_modal_history_recovery_start", ...detail });
|
|
829
|
+
},
|
|
801
830
|
openStep(nextStep) {
|
|
802
831
|
controller.openSession();
|
|
803
832
|
if (step === nextStep) return;
|
|
@@ -938,6 +967,8 @@ function WithdrawFlow({
|
|
|
938
967
|
onSendTransaction,
|
|
939
968
|
onStepChange,
|
|
940
969
|
onClose,
|
|
970
|
+
onDestinationChange,
|
|
971
|
+
onSubmittingChange,
|
|
941
972
|
onLifecycle,
|
|
942
973
|
onError,
|
|
943
974
|
debug
|
|
@@ -947,12 +978,12 @@ function WithdrawFlow({
|
|
|
947
978
|
const analytics = useWithdrawAnalyticsController();
|
|
948
979
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
949
980
|
const onErrorRef = useLatestRef(onError);
|
|
950
|
-
const isFlowActiveRef =
|
|
951
|
-
const submitGenerationRef =
|
|
952
|
-
const lastSubmitFailureRef =
|
|
981
|
+
const isFlowActiveRef = useRef3(true);
|
|
982
|
+
const submitGenerationRef = useRef3(0);
|
|
983
|
+
const lastSubmitFailureRef = useRef3(
|
|
953
984
|
null
|
|
954
985
|
);
|
|
955
|
-
|
|
986
|
+
useEffect3(() => {
|
|
956
987
|
isFlowActiveRef.current = true;
|
|
957
988
|
return () => {
|
|
958
989
|
isFlowActiveRef.current = false;
|
|
@@ -975,13 +1006,13 @@ function WithdrawFlow({
|
|
|
975
1006
|
const [recipientInput, setRecipientInput] = useState3(
|
|
976
1007
|
defaultRecipient ?? ""
|
|
977
1008
|
);
|
|
978
|
-
|
|
1009
|
+
useEffect3(() => {
|
|
979
1010
|
setTargetChain(targetChainProp);
|
|
980
1011
|
}, [targetChainProp]);
|
|
981
|
-
|
|
1012
|
+
useEffect3(() => {
|
|
982
1013
|
setTargetToken(targetTokenProp);
|
|
983
1014
|
}, [targetTokenProp]);
|
|
984
|
-
|
|
1015
|
+
useEffect3(() => {
|
|
985
1016
|
if (defaultRecipient) setRecipientInput(defaultRecipient);
|
|
986
1017
|
}, [defaultRecipient]);
|
|
987
1018
|
const storeApi = useWithdrawStoreApi();
|
|
@@ -993,7 +1024,22 @@ function WithdrawFlow({
|
|
|
993
1024
|
if (!recipientInput) return void 0;
|
|
994
1025
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
995
1026
|
}, [recipientInput]);
|
|
996
|
-
|
|
1027
|
+
const onDestinationChangeRef = useLatestRef(onDestinationChange);
|
|
1028
|
+
const reportedDestinationRef = useRef3(void 0);
|
|
1029
|
+
useEffect3(() => {
|
|
1030
|
+
if (reportedDestinationRef.current === recipientForRegistration) return;
|
|
1031
|
+
const report = () => {
|
|
1032
|
+
reportedDestinationRef.current = recipientForRegistration;
|
|
1033
|
+
onDestinationChangeRef.current?.(recipientForRegistration);
|
|
1034
|
+
};
|
|
1035
|
+
if (!reportedDestinationRef.current) {
|
|
1036
|
+
report();
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
const timeout = setTimeout(report, REGISTRATION_DEBOUNCE_MS);
|
|
1040
|
+
return () => clearTimeout(timeout);
|
|
1041
|
+
}, [recipientForRegistration, onDestinationChangeRef]);
|
|
1042
|
+
useEffect3(() => {
|
|
997
1043
|
if (!recipientForRegistration) return;
|
|
998
1044
|
const desiredTarget = {
|
|
999
1045
|
chain: targetChain,
|
|
@@ -1094,7 +1140,7 @@ function WithdrawFlow({
|
|
|
1094
1140
|
recipient: reviewedRecipient
|
|
1095
1141
|
} : null;
|
|
1096
1142
|
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1097
|
-
|
|
1143
|
+
useEffect3(() => {
|
|
1098
1144
|
if (flowStep !== "review") return;
|
|
1099
1145
|
if (registration.kind !== "ready" || isReviewedTargetReady) return;
|
|
1100
1146
|
analytics.friction("registration_stale", "review");
|
|
@@ -1104,17 +1150,17 @@ function WithdrawFlow({
|
|
|
1104
1150
|
analytics.abandon("back");
|
|
1105
1151
|
storeApi.dispatch({ type: "review/back" });
|
|
1106
1152
|
}, [analytics, storeApi]);
|
|
1107
|
-
|
|
1153
|
+
useEffect3(() => {
|
|
1108
1154
|
onStepChangeRef.current?.(
|
|
1109
1155
|
flowStep === "review" ? reviewBackHandler : void 0,
|
|
1110
1156
|
flowStep
|
|
1111
1157
|
);
|
|
1112
1158
|
}, [flowStep, reviewBackHandler, onStepChangeRef]);
|
|
1113
|
-
|
|
1159
|
+
useEffect3(() => {
|
|
1114
1160
|
analytics.openSession();
|
|
1115
1161
|
analytics.openStep(analyticsStepForFlowStep(flowStep));
|
|
1116
1162
|
}, [analytics, flowStep]);
|
|
1117
|
-
|
|
1163
|
+
useEffect3(() => {
|
|
1118
1164
|
if (registration.kind === "pending") {
|
|
1119
1165
|
analytics.friction("registration_pending");
|
|
1120
1166
|
} else if (registration.kind === "stale") {
|
|
@@ -1123,7 +1169,7 @@ function WithdrawFlow({
|
|
|
1123
1169
|
analytics.failure("registration_failed", true);
|
|
1124
1170
|
}
|
|
1125
1171
|
}, [analytics, registration.kind]);
|
|
1126
|
-
|
|
1172
|
+
useEffect3(() => {
|
|
1127
1173
|
logFlow("state:changed", {
|
|
1128
1174
|
step: flowStep,
|
|
1129
1175
|
sourceChain,
|
|
@@ -1341,7 +1387,7 @@ function WithdrawFlow({
|
|
|
1341
1387
|
() => targetTokensFor(targetChain),
|
|
1342
1388
|
[targetChain, targetTokensFor]
|
|
1343
1389
|
);
|
|
1344
|
-
|
|
1390
|
+
useEffect3(() => {
|
|
1345
1391
|
if (targetTokenOptions.length === 0) return;
|
|
1346
1392
|
const matches = targetTokenOptions.some(
|
|
1347
1393
|
(option) => option.address.toLowerCase() === targetToken.toLowerCase()
|
|
@@ -1409,6 +1455,7 @@ function WithdrawFlow({
|
|
|
1409
1455
|
service,
|
|
1410
1456
|
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1411
1457
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1458
|
+
onSubmittingChange,
|
|
1412
1459
|
onConfirm: handleReviewConfirm,
|
|
1413
1460
|
onError: handleError
|
|
1414
1461
|
}
|
|
@@ -1515,6 +1562,7 @@ function WithdrawModal({
|
|
|
1515
1562
|
onError,
|
|
1516
1563
|
enableAnalyticsIngest,
|
|
1517
1564
|
analyticsIngestUrl,
|
|
1565
|
+
signRecovery,
|
|
1518
1566
|
debug,
|
|
1519
1567
|
// Every prop 0.9.0 removed lands here, since none of them is named above.
|
|
1520
1568
|
// `uiConfig` is destructured, so its removed nested key isn't scanned — that
|
|
@@ -1526,16 +1574,21 @@ function WithdrawModal({
|
|
|
1526
1574
|
}) {
|
|
1527
1575
|
warnRemovedProps("WithdrawModal", removedProps);
|
|
1528
1576
|
checkBackendUrl("WithdrawModal", backendUrl);
|
|
1529
|
-
const modalRef =
|
|
1577
|
+
const modalRef = useRef4(null);
|
|
1530
1578
|
const onReadyRef = useLatestRef(onReady);
|
|
1531
|
-
const analyticsControllerRef =
|
|
1579
|
+
const analyticsControllerRef = useRef4(
|
|
1532
1580
|
null
|
|
1533
1581
|
);
|
|
1534
|
-
const
|
|
1582
|
+
const analyticsSessionIdRef = useRef4(null);
|
|
1583
|
+
const previousOpenRef = useRef4(isOpen);
|
|
1535
1584
|
const [backHandler, setBackHandler] = useState4(
|
|
1536
1585
|
void 0
|
|
1537
1586
|
);
|
|
1538
1587
|
const [screen, setScreen] = useState4("form");
|
|
1588
|
+
const [submitting, setSubmitting] = useState4(false);
|
|
1589
|
+
const [historyRecipient, setHistoryRecipient] = useState4(
|
|
1590
|
+
recipient
|
|
1591
|
+
);
|
|
1539
1592
|
const onUiStateRef = useLatestRef(onUiState);
|
|
1540
1593
|
const targetChain = getChainId(targetChainProp ?? sourceChainProp);
|
|
1541
1594
|
const sourceChain = getChainId(sourceChainProp);
|
|
@@ -1544,9 +1597,30 @@ function WithdrawModal({
|
|
|
1544
1597
|
() => createDepositService(backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1545
1598
|
[backendUrl, debug]
|
|
1546
1599
|
);
|
|
1600
|
+
const historyAnalytics = useMemo4(
|
|
1601
|
+
() => createHistoryAnalytics({
|
|
1602
|
+
modal: "withdraw",
|
|
1603
|
+
controllerRef: analyticsControllerRef,
|
|
1604
|
+
sessionIdRef: analyticsSessionIdRef
|
|
1605
|
+
}),
|
|
1606
|
+
[]
|
|
1607
|
+
);
|
|
1608
|
+
const history = useHistoryPanel({
|
|
1609
|
+
isOpen,
|
|
1610
|
+
recipient: historyRecipient,
|
|
1611
|
+
service,
|
|
1612
|
+
canRecover: Boolean(signRecovery),
|
|
1613
|
+
analytics: historyAnalytics
|
|
1614
|
+
});
|
|
1615
|
+
const { markStale: markHistoryStale, recoverySubmitting } = history;
|
|
1616
|
+
const historyButtonVisible = isHistoryEntryVisible({
|
|
1617
|
+
screen,
|
|
1618
|
+
submitting,
|
|
1619
|
+
settled: false
|
|
1620
|
+
});
|
|
1547
1621
|
const store = useMemo4(() => createWithdrawStore(), []);
|
|
1548
1622
|
const onErrorRef = useLatestRef(onError);
|
|
1549
|
-
|
|
1623
|
+
useEffect4(() => {
|
|
1550
1624
|
if (isOpen && typeof onSendTransaction !== "function") {
|
|
1551
1625
|
onErrorRef.current?.({
|
|
1552
1626
|
message: "WithdrawModal requires an `onSendTransaction` function.",
|
|
@@ -1561,12 +1635,13 @@ function WithdrawModal({
|
|
|
1561
1635
|
}, [isOpen, onSendTransaction, onErrorRef]);
|
|
1562
1636
|
const closeWithSource = useCallback3(
|
|
1563
1637
|
(source) => {
|
|
1638
|
+
if (submitting || recoverySubmitting) return;
|
|
1564
1639
|
const analytics = analyticsControllerRef.current;
|
|
1565
1640
|
analytics?.abandon("modal_close");
|
|
1566
1641
|
analytics?.close(source);
|
|
1567
1642
|
onClose();
|
|
1568
1643
|
},
|
|
1569
|
-
[onClose]
|
|
1644
|
+
[onClose, submitting, recoverySubmitting]
|
|
1570
1645
|
);
|
|
1571
1646
|
const handleModalDismiss = useCallback3(
|
|
1572
1647
|
(reason) => {
|
|
@@ -1576,7 +1651,7 @@ function WithdrawModal({
|
|
|
1576
1651
|
},
|
|
1577
1652
|
[closeWithSource]
|
|
1578
1653
|
);
|
|
1579
|
-
|
|
1654
|
+
useEffect4(() => {
|
|
1580
1655
|
if (previousOpenRef.current && !isOpen) {
|
|
1581
1656
|
const analytics = analyticsControllerRef.current;
|
|
1582
1657
|
analytics?.abandon("modal_close");
|
|
@@ -1584,31 +1659,44 @@ function WithdrawModal({
|
|
|
1584
1659
|
}
|
|
1585
1660
|
previousOpenRef.current = isOpen;
|
|
1586
1661
|
}, [isOpen]);
|
|
1587
|
-
|
|
1662
|
+
useEffect4(() => {
|
|
1588
1663
|
if (!isOpen || !modalRef.current) return;
|
|
1589
1664
|
return applyTheme(modalRef.current, theme);
|
|
1590
1665
|
}, [isOpen, theme]);
|
|
1591
|
-
|
|
1666
|
+
useEffect4(() => {
|
|
1592
1667
|
if (isOpen) {
|
|
1593
1668
|
onReadyRef.current?.();
|
|
1594
1669
|
}
|
|
1595
1670
|
}, [isOpen, onReadyRef]);
|
|
1596
|
-
|
|
1671
|
+
useEffect4(() => {
|
|
1597
1672
|
if (!isOpen) {
|
|
1598
1673
|
store.dispatch({ type: "modal/reset" });
|
|
1674
|
+
setHistoryRecipient(recipient);
|
|
1599
1675
|
}
|
|
1600
|
-
}, [isOpen, store]);
|
|
1676
|
+
}, [isOpen, store, recipient]);
|
|
1601
1677
|
const handleStepChange = useCallback3((onBack, next) => {
|
|
1602
1678
|
setBackHandler(() => onBack);
|
|
1603
1679
|
if (next) setScreen(next);
|
|
1604
1680
|
}, []);
|
|
1605
|
-
|
|
1681
|
+
useEffect4(() => {
|
|
1606
1682
|
onUiStateRef.current?.({
|
|
1607
1683
|
screen,
|
|
1608
1684
|
back: backHandler,
|
|
1609
|
-
|
|
1685
|
+
// A transfer or a recovery in flight is a submission whose outcome is
|
|
1686
|
+
// unknown, so a native host's dismissal lock has to hold through it.
|
|
1687
|
+
submitting: submitting || recoverySubmitting
|
|
1610
1688
|
});
|
|
1611
|
-
}, [screen, backHandler, onUiStateRef]);
|
|
1689
|
+
}, [screen, backHandler, submitting, recoverySubmitting, onUiStateRef]);
|
|
1690
|
+
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
1691
|
+
const handleLifecycle = useCallback3(
|
|
1692
|
+
(event) => {
|
|
1693
|
+
onLifecycleRef.current?.(event);
|
|
1694
|
+
if (event.type === "submitted" || event.type === "complete" || event.type === "failed") {
|
|
1695
|
+
markHistoryStale();
|
|
1696
|
+
}
|
|
1697
|
+
},
|
|
1698
|
+
[onLifecycleRef, markHistoryStale]
|
|
1699
|
+
);
|
|
1612
1700
|
const analyticsSessionProperties = buildWithdrawAnalyticsSessionProperties({
|
|
1613
1701
|
inline,
|
|
1614
1702
|
closeOnOverlayClick,
|
|
@@ -1620,7 +1708,7 @@ function WithdrawModal({
|
|
|
1620
1708
|
seedTargetToken: targetToken ?? sourceToken
|
|
1621
1709
|
});
|
|
1622
1710
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
1623
|
-
const canGoBack = backHandler !== void 0;
|
|
1711
|
+
const canGoBack = backHandler !== void 0 && !submitting;
|
|
1624
1712
|
return /* @__PURE__ */ jsx5(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx5(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx5(WithdrawStoreProvider, { store, children: /* @__PURE__ */ jsx5(
|
|
1625
1713
|
Modal,
|
|
1626
1714
|
{
|
|
@@ -1629,6 +1717,7 @@ function WithdrawModal({
|
|
|
1629
1717
|
className,
|
|
1630
1718
|
inline,
|
|
1631
1719
|
closeOnOverlayClick,
|
|
1720
|
+
ariaLabel: "Withdraw",
|
|
1632
1721
|
children: /* @__PURE__ */ jsx5(
|
|
1633
1722
|
AnalyticsSession,
|
|
1634
1723
|
{
|
|
@@ -1638,6 +1727,7 @@ function WithdrawModal({
|
|
|
1638
1727
|
backendUrl,
|
|
1639
1728
|
enableIngest: enableAnalyticsIngest,
|
|
1640
1729
|
ingestUrl: analyticsIngestUrl,
|
|
1730
|
+
sessionIdRef: analyticsSessionIdRef,
|
|
1641
1731
|
children: /* @__PURE__ */ jsx5(
|
|
1642
1732
|
WithdrawAnalyticsControllerProvider,
|
|
1643
1733
|
{
|
|
@@ -1654,16 +1744,25 @@ function WithdrawModal({
|
|
|
1654
1744
|
children: /* @__PURE__ */ jsx5(ChevronLeftIcon, {})
|
|
1655
1745
|
}
|
|
1656
1746
|
) }),
|
|
1657
|
-
/* @__PURE__ */
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1747
|
+
/* @__PURE__ */ jsxs4("div", { className: "rs-modal-header-nav-right", children: [
|
|
1748
|
+
historyButtonVisible && historyRecipient && /* @__PURE__ */ jsx5(
|
|
1749
|
+
HistoryEntryButton,
|
|
1750
|
+
{
|
|
1751
|
+
badge: history.badge,
|
|
1752
|
+
onClick: history.openPanel
|
|
1753
|
+
}
|
|
1754
|
+
),
|
|
1755
|
+
/* @__PURE__ */ jsx5(
|
|
1756
|
+
"button",
|
|
1757
|
+
{
|
|
1758
|
+
type: "button",
|
|
1759
|
+
onClick: () => closeWithSource("header_button"),
|
|
1760
|
+
className: "rs-modal-close",
|
|
1761
|
+
"aria-label": "Close",
|
|
1762
|
+
children: /* @__PURE__ */ jsx5(CloseIcon, {})
|
|
1763
|
+
}
|
|
1764
|
+
)
|
|
1765
|
+
] })
|
|
1667
1766
|
] }),
|
|
1668
1767
|
/* @__PURE__ */ jsx5(
|
|
1669
1768
|
WithdrawFlow,
|
|
@@ -1680,10 +1779,32 @@ function WithdrawModal({
|
|
|
1680
1779
|
onSendTransaction,
|
|
1681
1780
|
onStepChange: handleStepChange,
|
|
1682
1781
|
onClose: closeWithSource,
|
|
1683
|
-
|
|
1782
|
+
onDestinationChange: setHistoryRecipient,
|
|
1783
|
+
onSubmittingChange: setSubmitting,
|
|
1784
|
+
onLifecycle: handleLifecycle,
|
|
1684
1785
|
onError,
|
|
1685
1786
|
debug
|
|
1686
1787
|
}
|
|
1788
|
+
),
|
|
1789
|
+
history.isPanelOpen && /* @__PURE__ */ jsx5(
|
|
1790
|
+
HistoryOverlay,
|
|
1791
|
+
{
|
|
1792
|
+
controller: history,
|
|
1793
|
+
backLabel: "Withdraw",
|
|
1794
|
+
title: "Deposit history",
|
|
1795
|
+
recipient: historyRecipient,
|
|
1796
|
+
backendUrl,
|
|
1797
|
+
service,
|
|
1798
|
+
signRecovery,
|
|
1799
|
+
debug,
|
|
1800
|
+
onCloseModal: () => closeWithSource("header_button"),
|
|
1801
|
+
analytics: historyAnalytics,
|
|
1802
|
+
inline,
|
|
1803
|
+
closeOnOverlayClick,
|
|
1804
|
+
enableAnalyticsIngest,
|
|
1805
|
+
analyticsIngestUrl,
|
|
1806
|
+
onEvent
|
|
1807
|
+
}
|
|
1687
1808
|
)
|
|
1688
1809
|
] })
|
|
1689
1810
|
}
|