@rhinestone/deposit-modal 0.0.0-dev-20261007123232 → 0.0.0-dev-20261007142713

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.
Files changed (38) hide show
  1. package/dist/{BankOnrampStep-37WGJIO4.cjs → BankOnrampStep-5WDZUARD.cjs} +11 -11
  2. package/dist/{BankOnrampStep-JUFVAVIS.mjs → BankOnrampStep-HLNRQ7T5.mjs} +4 -4
  3. package/dist/{DepositModalReown-6GHQQNMW.mjs → DepositModalReown-SKSORQUM.mjs} +3 -3
  4. package/dist/{DepositModalReown-UBVBTDF3.cjs → DepositModalReown-SSR5CLK7.cjs} +16 -16
  5. package/dist/WithdrawModal-RCPEI6RF.cjs +12 -0
  6. package/dist/{WithdrawModal-A3IW3SXX.mjs → WithdrawModal-W4XTHXB3.mjs} +3 -3
  7. package/dist/{chunk-ITLGT5C5.mjs → chunk-3T5HP5NY.mjs} +1 -1
  8. package/dist/{chunk-UUGROFL6.mjs → chunk-3Y3VX6HJ.mjs} +68 -104
  9. package/dist/{chunk-E6LUVX6Q.cjs → chunk-5YWOJNGJ.cjs} +1 -1
  10. package/dist/{chunk-FYNIS26C.mjs → chunk-637CUDYR.mjs} +1 -1
  11. package/dist/{chunk-B4THBLY7.mjs → chunk-B2G6SKD2.mjs} +1 -1
  12. package/dist/{chunk-MD6EFUBO.cjs → chunk-EROOO5Q5.cjs} +311 -258
  13. package/dist/{chunk-GCXBWEVD.mjs → chunk-IEVRAF7C.mjs} +67 -14
  14. package/dist/{chunk-HKWTABVW.cjs → chunk-L3IDZIBA.cjs} +420 -456
  15. package/dist/{chunk-WVSX6PLI.mjs → chunk-MVZPFHRU.mjs} +1 -1
  16. package/dist/{chunk-5PS2QNOU.cjs → chunk-OTXF4QSV.cjs} +2 -2
  17. package/dist/{chunk-UGIKPKMY.mjs → chunk-RFSIVTXV.mjs} +1 -1
  18. package/dist/{chunk-3VTLHPMC.cjs → chunk-RJSHSKS5.cjs} +2 -2
  19. package/dist/{chunk-GDOFONYI.cjs → chunk-UPPAHPYR.cjs} +58 -58
  20. package/dist/{chunk-INWUGACR.cjs → chunk-UZUZWBA2.cjs} +3 -3
  21. package/dist/compliance.cjs +4 -4
  22. package/dist/compliance.mjs +3 -3
  23. package/dist/constants.cjs +2 -2
  24. package/dist/constants.d.cts +1 -1
  25. package/dist/constants.d.ts +1 -1
  26. package/dist/constants.mjs +1 -1
  27. package/dist/deposit.cjs +4 -4
  28. package/dist/deposit.mjs +3 -3
  29. package/dist/embed.cjs +14 -14
  30. package/dist/embed.mjs +4 -4
  31. package/dist/index.cjs +5 -5
  32. package/dist/index.mjs +4 -4
  33. package/dist/onramp.cjs +4 -4
  34. package/dist/onramp.mjs +3 -3
  35. package/dist/withdraw.cjs +4 -4
  36. package/dist/withdraw.mjs +3 -3
  37. package/package.json +5 -5
  38. package/dist/WithdrawModal-3AAAZV34.cjs +0 -12
@@ -8,15 +8,15 @@
8
8
  var _chunkG264OM23cjs = require('./chunk-G264OM23.cjs');
9
9
 
10
10
 
11
- var _chunk5PS2QNOUcjs = require('./chunk-5PS2QNOU.cjs');
11
+ var _chunkOTXF4QSVcjs = require('./chunk-OTXF4QSV.cjs');
12
12
 
13
13
 
14
14
 
15
- var _chunkINWUGACRcjs = require('./chunk-INWUGACR.cjs');
15
+ var _chunkUZUZWBA2cjs = require('./chunk-UZUZWBA2.cjs');
16
16
 
17
17
 
18
- var _chunk3VTLHPMCcjs = require('./chunk-3VTLHPMC.cjs');
19
- require('./chunk-E6LUVX6Q.cjs');
18
+ var _chunkRJSHSKS5cjs = require('./chunk-RJSHSKS5.cjs');
19
+ require('./chunk-5YWOJNGJ.cjs');
20
20
 
21
21
  // src/components/steps/BankOnrampStep.tsx
22
22
  var _react = require('react');
@@ -145,7 +145,7 @@ function BankOnrampStep({
145
145
  [backendUrl, getSessionRef, smartAccount]
146
146
  );
147
147
  const service = _react.useMemo.call(void 0,
148
- () => _chunk5PS2QNOUcjs.createOnrampService.call(void 0, sessionOptions),
148
+ () => _chunkOTXF4QSVcjs.createOnrampService.call(void 0, sessionOptions),
149
149
  [sessionOptions]
150
150
  );
151
151
  const [availableForHistory, setAvailableForHistory] = _react.useState.call(void 0, false);
@@ -175,7 +175,7 @@ function BankOnrampStep({
175
175
  []
176
176
  );
177
177
  const startVerification = _react.useCallback.call(void 0, async () => {
178
- const session = await _chunkINWUGACRcjs.startComplianceVerification.call(void 0, sessionOptions);
178
+ const session = await _chunkUZUZWBA2cjs.startComplianceVerification.call(void 0, sessionOptions);
179
179
  if (session.status === "failed") return "declined";
180
180
  if (!session.nextAction) return "reviewing";
181
181
  if (!isTrustedNoahHostedUrl(session.nextAction.url)) return "reviewing";
@@ -191,7 +191,7 @@ function BankOnrampStep({
191
191
  return "action_required";
192
192
  }, [openExternally, sessionOptions]);
193
193
  const ensureVerified = _react.useCallback.call(void 0, async () => {
194
- const current = await _chunkINWUGACRcjs.getComplianceStatus.call(void 0, sessionOptions);
194
+ const current = await _chunkUZUZWBA2cjs.getComplianceStatus.call(void 0, sessionOptions);
195
195
  if (current.status === "approved") return "approved";
196
196
  if (current.status === "declined") return "declined";
197
197
  return startVerification();
@@ -203,7 +203,7 @@ function BankOnrampStep({
203
203
  setNoOptions(false);
204
204
  try {
205
205
  const discover = () => service.getOptions().catch((error2) => {
206
- if (error2 instanceof _chunk3VTLHPMCcjs.ScopedRequestError && error2.status === 404 && onUnavailable) {
206
+ if (error2 instanceof _chunkRJSHSKS5cjs.ScopedRequestError && error2.status === 404 && onUnavailable) {
207
207
  if (isCurrentRequest(generation)) onUnavailable();
208
208
  return null;
209
209
  }
@@ -270,7 +270,7 @@ function BankOnrampStep({
270
270
  setBankDetails(details);
271
271
  } catch (error2) {
272
272
  if (!isCurrentRequest(generation)) return;
273
- const pending = error2 instanceof _chunk3VTLHPMCcjs.ScopedRequestError && error2.status === 409;
273
+ const pending = error2 instanceof _chunkRJSHSKS5cjs.ScopedRequestError && error2.status === 409;
274
274
  const message = pending ? PENDING_ERROR : SAFE_ERROR;
275
275
  setError(message);
276
276
  _optionalChain([onError, 'optionalCall', _4 => _4(
@@ -304,7 +304,7 @@ function BankOnrampStep({
304
304
  await openDetails(nextAccount);
305
305
  } catch (error2) {
306
306
  if (!isCurrentRequest(generation)) return;
307
- if (error2 instanceof _chunk3VTLHPMCcjs.ScopedRequestError && error2.status === 409 && error2.code === "VERIFICATION_REQUIRED" && !verificationResumedRef.current) {
307
+ if (error2 instanceof _chunkRJSHSKS5cjs.ScopedRequestError && error2.status === 409 && error2.code === "VERIFICATION_REQUIRED" && !verificationResumedRef.current) {
308
308
  verificationResumedRef.current = true;
309
309
  try {
310
310
  const verification = await startVerification();
@@ -340,7 +340,7 @@ function BankOnrampStep({
340
340
  const timer = setInterval(() => {
341
341
  void (async () => {
342
342
  try {
343
- const status = await _chunkINWUGACRcjs.getComplianceStatus.call(void 0, sessionOptions);
343
+ const status = await _chunkUZUZWBA2cjs.getComplianceStatus.call(void 0, sessionOptions);
344
344
  if (!active) return;
345
345
  if (status.status === "approved") {
346
346
  setHostedUrl(null);
@@ -8,15 +8,15 @@ import {
8
8
  } from "./chunk-YY4ZOAH5.mjs";
9
9
  import {
10
10
  createOnrampService
11
- } from "./chunk-B4THBLY7.mjs";
11
+ } from "./chunk-B2G6SKD2.mjs";
12
12
  import {
13
13
  getComplianceStatus,
14
14
  startComplianceVerification
15
- } from "./chunk-FYNIS26C.mjs";
15
+ } from "./chunk-637CUDYR.mjs";
16
16
  import {
17
17
  ScopedRequestError
18
- } from "./chunk-UGIKPKMY.mjs";
19
- import "./chunk-WVSX6PLI.mjs";
18
+ } from "./chunk-RFSIVTXV.mjs";
19
+ import "./chunk-MVZPFHRU.mjs";
20
20
 
21
21
  // src/components/steps/BankOnrampStep.tsx
22
22
  import { useCallback, useEffect, useMemo, useRef, useState as useState2 } from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DepositModalInner,
3
3
  getReownDependencies
4
- } from "./chunk-UUGROFL6.mjs";
4
+ } from "./chunk-3Y3VX6HJ.mjs";
5
5
  import "./chunk-2FOPO4N5.mjs";
6
6
  import {
7
7
  followSystemAppearance,
@@ -11,13 +11,13 @@ import {
11
11
  resolveThemeMode,
12
12
  rpcUrlFor,
13
13
  useStableRpcUrls
14
- } from "./chunk-GCXBWEVD.mjs";
14
+ } from "./chunk-IEVRAF7C.mjs";
15
15
  import "./chunk-YY4ZOAH5.mjs";
16
16
  import {
17
17
  SUPPORTED_CHAIN_IDS,
18
18
  getChainName
19
19
  } from "./chunk-E7IMWVMN.mjs";
20
- import "./chunk-WVSX6PLI.mjs";
20
+ import "./chunk-MVZPFHRU.mjs";
21
21
 
22
22
  // src/DepositModalReown.tsx
23
23
  import { useCallback, useMemo as useMemo2 } from "react";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkHKWTABVWcjs = require('./chunk-HKWTABVW.cjs');
4
+ var _chunkL3IDZIBAcjs = require('./chunk-L3IDZIBA.cjs');
5
5
  require('./chunk-FVJKUTHF.cjs');
6
6
 
7
7
 
@@ -11,13 +11,13 @@ require('./chunk-FVJKUTHF.cjs');
11
11
 
12
12
 
13
13
 
14
- var _chunkMD6EFUBOcjs = require('./chunk-MD6EFUBO.cjs');
14
+ var _chunkEROOO5Q5cjs = require('./chunk-EROOO5Q5.cjs');
15
15
  require('./chunk-G264OM23.cjs');
16
16
 
17
17
 
18
18
 
19
19
  var _chunkFKJ6EJHHcjs = require('./chunk-FKJ6EJHH.cjs');
20
- require('./chunk-E6LUVX6Q.cjs');
20
+ require('./chunk-5YWOJNGJ.cjs');
21
21
 
22
22
  // src/DepositModalReown.tsx
23
23
  var _react = require('react');
@@ -45,7 +45,7 @@ var {
45
45
  unichain,
46
46
  katana,
47
47
  hyperEvm
48
- } = _chunkHKWTABVWcjs.getReownDependencies.call(void 0, )[1];
48
+ } = _chunkL3IDZIBAcjs.getReownDependencies.call(void 0, )[1];
49
49
  var APPKIT_NETWORK_BY_ID = {
50
50
  [mainnet.id]: mainnet,
51
51
  [optimism.id]: optimism,
@@ -77,7 +77,7 @@ function getAppKitNetwork(chainId) {
77
77
 
78
78
  // src/core/reown-theme.ts
79
79
  function mapTheme(theme) {
80
- const themeMode = _chunkMD6EFUBOcjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
80
+ const themeMode = _chunkEROOO5Q5cjs.resolveThemeMode.call(void 0, _optionalChain([theme, 'optionalAccess', _ => _.mode])) === "light" ? "light" : "dark";
81
81
  const themeVariables = {
82
82
  "--apkt-accent": _optionalChain([theme, 'optionalAccess', _2 => _2.ctaColor])
83
83
  };
@@ -94,7 +94,7 @@ function setAppKitTheme(appKit, theme) {
94
94
 
95
95
  // src/core/reown.tsx
96
96
  var _jsxruntime = require('react/jsx-runtime');
97
- var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkHKWTABVWcjs.getReownDependencies.call(void 0, );
97
+ var [appKitReact, appKitNetworks, wagmiAdapter, solanaAdapter] = _chunkL3IDZIBAcjs.getReownDependencies.call(void 0, );
98
98
  var {
99
99
  createAppKit,
100
100
  useAppKit,
@@ -110,14 +110,14 @@ function buildTransports(rpcUrls, networks = EVM_NETWORKS) {
110
110
  const transports = {};
111
111
  for (const network of networks) {
112
112
  const id = Number(network.id);
113
- transports[id] = _viem.http.call(void 0, _chunkMD6EFUBOcjs.rpcUrlFor.call(void 0, rpcUrls, id));
113
+ transports[id] = _viem.http.call(void 0, _chunkEROOO5Q5cjs.rpcUrlFor.call(void 0, rpcUrls, id));
114
114
  }
115
115
  return transports;
116
116
  }
117
117
  function getEvmRpcFingerprint(rpcUrls, networks) {
118
118
  return networks.map((network) => {
119
119
  const id = Number(network.id);
120
- return `${id}=${_nullishCoalesce(_chunkMD6EFUBOcjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
120
+ return `${id}=${_nullishCoalesce(_chunkEROOO5Q5cjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
121
121
  }).join("|");
122
122
  }
123
123
  var cachedAdapter = null;
@@ -188,7 +188,7 @@ function ReownWalletProvider({
188
188
  backendUrl,
189
189
  children
190
190
  }) {
191
- const rpcUrls = _chunkMD6EFUBOcjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
191
+ const rpcUrls = _chunkEROOO5Q5cjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
192
192
  const [queryClient] = _react.useState.call(void 0, () => new (0, _reactquery.QueryClient)());
193
193
  const overrides = _react.useMemo.call(void 0, () => {
194
194
  if (!rpcUrls) return void 0;
@@ -200,14 +200,14 @@ function ReownWalletProvider({
200
200
  return out;
201
201
  }, [rpcUrls]);
202
202
  const [state, setState] = _react.useState.call(void 0, () => {
203
- const primed = _chunkMD6EFUBOcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
203
+ const primed = _chunkEROOO5Q5cjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
204
204
  return { ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) };
205
205
  });
206
206
  _react.useEffect.call(void 0, () => {
207
207
  let active = true;
208
- const primed = _chunkMD6EFUBOcjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
208
+ const primed = _chunkEROOO5Q5cjs.peekRuntimeChains.call(void 0, backendUrl, overrides);
209
209
  setState({ ready: primed !== null, chains: _nullishCoalesce(primed, () => ( [])) });
210
- _chunkMD6EFUBOcjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
210
+ _chunkEROOO5Q5cjs.primeRuntimeChains.call(void 0, backendUrl, overrides).then((chains) => {
211
211
  if (active) setState({ ready: true, chains });
212
212
  });
213
213
  return () => {
@@ -216,7 +216,7 @@ function ReownWalletProvider({
216
216
  }, [backendUrl, overrides]);
217
217
  _react.useEffect.call(void 0, () => {
218
218
  setAppKitTheme(appKitReact.modal, theme);
219
- return _chunkMD6EFUBOcjs.followSystemAppearance.call(void 0,
219
+ return _chunkEROOO5Q5cjs.followSystemAppearance.call(void 0,
220
220
  _optionalChain([theme, 'optionalAccess', _7 => _7.mode]),
221
221
  () => setAppKitTheme(appKitReact.modal, theme)
222
222
  );
@@ -280,7 +280,7 @@ function useReownWalletSession() {
280
280
  await switchChainAsync({ chainId });
281
281
  }
282
282
  } catch (err) {
283
- if (_chunkMD6EFUBOcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
283
+ if (_chunkEROOO5Q5cjs.isUnsupportedChainSwitchError.call(void 0, err)) {
284
284
  throw new Error(
285
285
  `Switch to ${chainDisplayName(chainId)} in your wallet to continue`
286
286
  );
@@ -293,7 +293,7 @@ function useReownWalletSession() {
293
293
 
294
294
  // src/DepositModalReown.tsx
295
295
 
296
- var [appKitReact2, , , , solanaAdapterReact] = _chunkHKWTABVWcjs.getReownDependencies.call(void 0, );
296
+ var [appKitReact2, , , , solanaAdapterReact] = _chunkL3IDZIBAcjs.getReownDependencies.call(void 0, );
297
297
  var { useAppKitProvider } = appKitReact2;
298
298
  var { useAppKitConnection } = solanaAdapterReact;
299
299
  function DepositModalWithReown(props) {
@@ -315,7 +315,7 @@ function DepositModalWithReown(props) {
315
315
  reown.disconnect();
316
316
  }, [reown.disconnect]);
317
317
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
318
- _chunkHKWTABVWcjs.DepositModalInner,
318
+ _chunkL3IDZIBAcjs.DepositModalInner,
319
319
  {
320
320
  ...props,
321
321
  walletSession: reownWithSolana,
@@ -0,0 +1,12 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _chunkUPPAHPYRcjs = require('./chunk-UPPAHPYR.cjs');
5
+ require('./chunk-EROOO5Q5.cjs');
6
+ require('./chunk-G264OM23.cjs');
7
+ require('./chunk-FKJ6EJHH.cjs');
8
+ require('./chunk-5YWOJNGJ.cjs');
9
+
10
+
11
+
12
+ exports.WithdrawModal = _chunkUPPAHPYRcjs.WithdrawModal; exports.buildWithdrawAnalyticsSessionProperties = _chunkUPPAHPYRcjs.buildWithdrawAnalyticsSessionProperties;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WithdrawModal,
3
3
  buildWithdrawAnalyticsSessionProperties
4
- } from "./chunk-ITLGT5C5.mjs";
5
- import "./chunk-GCXBWEVD.mjs";
4
+ } from "./chunk-3T5HP5NY.mjs";
5
+ import "./chunk-IEVRAF7C.mjs";
6
6
  import "./chunk-YY4ZOAH5.mjs";
7
7
  import "./chunk-E7IMWVMN.mjs";
8
- import "./chunk-WVSX6PLI.mjs";
8
+ import "./chunk-MVZPFHRU.mjs";
9
9
  export {
10
10
  WithdrawModal,
11
11
  buildWithdrawAnalyticsSessionProperties
@@ -40,7 +40,7 @@ import {
40
40
  useTokenPrices,
41
41
  useWithdrawAnalyticsEmitter,
42
42
  warnRemovedProps
43
- } from "./chunk-GCXBWEVD.mjs";
43
+ } from "./chunk-IEVRAF7C.mjs";
44
44
  import {
45
45
  BodyHeader,
46
46
  ChevronDownIcon,
@@ -58,6 +58,8 @@ import {
58
58
  getExchangeLogo,
59
59
  getExchangeLogoSrc,
60
60
  getPublicClient,
61
+ hasReached,
62
+ hostedOrderStateFromSwapped,
61
63
  isDepositEvent,
62
64
  isDepositPolicyRefusal,
63
65
  isDisplayStablecoinSymbol,
@@ -66,6 +68,7 @@ import {
66
68
  isNativeAsset,
67
69
  isNativeSol,
68
70
  isSubmissionUncertain,
71
+ mergeHostedOrderState,
69
72
  portfolioToAssets,
70
73
  quoteFeeRow,
71
74
  readDedupedAccountSetupResult,
@@ -94,7 +97,7 @@ import {
94
97
  useTokenDisplay,
95
98
  useTokenDisplays,
96
99
  warnRemovedProps
97
- } from "./chunk-GCXBWEVD.mjs";
100
+ } from "./chunk-IEVRAF7C.mjs";
98
101
  import {
99
102
  AppleIcon,
100
103
  BankIcon,
@@ -3626,16 +3629,10 @@ var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
3626
3629
  var IFRAME_LOAD_TIMEOUT_MS = 15e3;
3627
3630
  var SWAPPED_SUCCESS_HANDOFF_DELAY_MS = 1400;
3628
3631
  var SWAPPED_IFRAME_ORIGINS = new Set(SWAPPED_ORIGINS);
3629
- var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
3630
- "order_completed",
3631
- "order_broadcasted"
3632
- ]);
3633
- var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
3634
- "payment_pending",
3635
- "order_completed",
3636
- "order_broadcasted",
3637
- "order_cancelled"
3638
- ]);
3632
+ var OUTCOME_MESSAGES = {
3633
+ failed: "Swapped could not complete this order. Any charge is refunded.",
3634
+ refunded: "Swapped refunded this order."
3635
+ };
3639
3636
  var SWAPPED_GO_BACK_KEY = "SWAPPED_GO_BACK";
3640
3637
  var OPEN_FAILED_MESSAGE = "We could not open your browser.";
3641
3638
  var OPEN_FAILED_CODE = "SWAPPED_BROWSER_UNAVAILABLE";
@@ -3681,19 +3678,20 @@ function parseSwappedIframeMessage(raw) {
3681
3678
  const obj = data;
3682
3679
  const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
3683
3680
  const rawStatus = inner.order_status ?? inner.status ?? obj.status;
3684
- if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
3685
- return null;
3686
- }
3687
3681
  const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
3682
+ const state = typeof rawStatus === "string" ? hostedOrderStateFromSwapped(
3683
+ rawStatus,
3684
+ asString2(inner.transaction_id) ?? asString2(obj.transactionId)
3685
+ ) : null;
3686
+ if (!state) return null;
3688
3687
  return {
3689
- status: rawStatus,
3688
+ state,
3690
3689
  orderId: asString2(inner.order_id) ?? asString2(obj.orderId),
3691
3690
  externalCustomerId: asString2(inner.external_customer_id) ?? asString2(obj.external_customer_id) ?? asString2(inner.externalCustomerId) ?? asString2(obj.externalCustomerId),
3692
3691
  orderCrypto: assetSymbol(
3693
3692
  asString2(inner.order_crypto) ?? asString2(obj.orderCrypto)
3694
3693
  ),
3695
- orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount),
3696
- transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
3694
+ orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount)
3697
3695
  };
3698
3696
  }
3699
3697
  function SwappedProviderStep({
@@ -3704,7 +3702,7 @@ function SwappedProviderStep({
3704
3702
  iframeTitle,
3705
3703
  loadErrorCode,
3706
3704
  loadErrorFallback,
3707
- bannerForStatus,
3705
+ cancelledMessage,
3708
3706
  onSwappedComplete,
3709
3707
  onSwappedFailed,
3710
3708
  onClose,
@@ -3737,6 +3735,8 @@ function SwappedProviderStep({
3737
3735
  const expectedExternalCustomerIdRef = useRef6(null);
3738
3736
  const baselineDepositTxHashRef = useRef6(void 0);
3739
3737
  const currentDepositTxHashRef = useRef6(null);
3738
+ const deliveryTxHashRef = useRef6(null);
3739
+ deliveryTxHashRef.current = orderState?.deliveryTxHash ?? null;
3740
3740
  const fastDepositPollEnabledRef = useRef6(false);
3741
3741
  const rescheduleDepositPollRef = useRef6(
3742
3742
  null
@@ -3860,7 +3860,10 @@ function SwappedProviderStep({
3860
3860
  if (cancelled) return;
3861
3861
  const isCurrentOrder = res !== null && res.orderId === expectedOrderUuidRef.current;
3862
3862
  if (isCurrentOrder) {
3863
- setOrderState(res);
3863
+ setOrderState((prev) => ({
3864
+ ...res,
3865
+ ...mergeHostedOrderState(prev, res)
3866
+ }));
3864
3867
  }
3865
3868
  } catch {
3866
3869
  }
@@ -3897,15 +3900,29 @@ function SwappedProviderStep({
3897
3900
  async function pollDeposit() {
3898
3901
  if (cancelled) return;
3899
3902
  try {
3900
- const status = await service.fetchLatestStatus(smartAccount);
3901
- if (cancelled) return;
3902
- const event = status.lastEvent;
3903
- const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
3904
- if (baselineDepositTxHashRef.current === void 0) {
3905
- baselineDepositTxHashRef.current = eventTxHash;
3906
- } else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
3907
- currentDepositTxHashRef.current = eventTxHash;
3908
- setLatestEvent(event ?? null);
3903
+ const deliveryTxHash = deliveryTxHashRef.current;
3904
+ if (deliveryTxHash) {
3905
+ const { lastEvent } = await service.fetchStatus(
3906
+ smartAccount,
3907
+ deliveryTxHash
3908
+ );
3909
+ if (cancelled) return;
3910
+ const txHash = isDepositEvent(lastEvent) ? getEventTxHash(lastEvent) : void 0;
3911
+ if (lastEvent && txHash && txRefsMatch(txHash, deliveryTxHash)) {
3912
+ currentDepositTxHashRef.current = txHash;
3913
+ setLatestEvent(lastEvent);
3914
+ }
3915
+ } else {
3916
+ const status = await service.fetchLatestStatus(smartAccount);
3917
+ if (cancelled) return;
3918
+ const event = status.lastEvent;
3919
+ const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
3920
+ if (baselineDepositTxHashRef.current === void 0) {
3921
+ baselineDepositTxHashRef.current = eventTxHash;
3922
+ } else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
3923
+ currentDepositTxHashRef.current = eventTxHash;
3924
+ setLatestEvent(event ?? null);
3925
+ }
3909
3926
  }
3910
3927
  } catch {
3911
3928
  }
@@ -3928,8 +3945,7 @@ function SwappedProviderStep({
3928
3945
  }, [service, smartAccount]);
3929
3946
  useEffect8(() => {
3930
3947
  if (fastDepositPollEnabledRef.current) return;
3931
- const status = orderState?.status;
3932
- if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
3948
+ if (!hasReached(orderState, "paid")) return;
3933
3949
  fastDepositPollEnabledRef.current = true;
3934
3950
  rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
3935
3951
  }, [orderState]);
@@ -3953,10 +3969,9 @@ function SwappedProviderStep({
3953
3969
  // Normalise to the uuid the backend poll also keys on, so orderState
3954
3970
  // is consistent regardless of which path set it.
3955
3971
  orderId: expectedOrderUuidRef.current ?? prev?.orderId ?? ext,
3956
- status: parsed.status,
3972
+ ...mergeHostedOrderState(prev, parsed.state),
3957
3973
  orderCrypto: parsed.orderCrypto ?? prev?.orderCrypto ?? null,
3958
3974
  orderCryptoAmount: parsed.orderCryptoAmount ?? prev?.orderCryptoAmount ?? null,
3959
- transactionId: parsed.transactionId ?? prev?.transactionId ?? null,
3960
3975
  receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
3961
3976
  paidAmountUsd: prev?.paidAmountUsd ?? null,
3962
3977
  paidAmountEur: prev?.paidAmountEur ?? null,
@@ -3968,13 +3983,13 @@ function SwappedProviderStep({
3968
3983
  return () => window.removeEventListener("message", onMessage);
3969
3984
  }, [openExternally]);
3970
3985
  useEffect8(() => {
3971
- const swappedProvesLive = orderState !== null && !(variant === "fiat" && orderState.status === "payment_pending");
3986
+ const swappedProvesLive = orderState !== null && (variant !== "fiat" || hasReached(orderState, "paying") || orderState.outcome !== null);
3972
3987
  if (phase === "provider" && (swappedProvesLive || latestEvent !== null)) {
3973
3988
  setPhase("tracker");
3974
3989
  }
3975
3990
  }, [phase, orderState, latestEvent, variant]);
3976
3991
  const stepStates = useMemo4(
3977
- () => deriveStepStates(orderState?.status ?? null, latestEvent),
3992
+ () => deriveStepStates(orderState, latestEvent),
3978
3993
  [orderState, latestEvent]
3979
3994
  );
3980
3995
  const terminalState = useMemo4(() => {
@@ -3984,15 +3999,18 @@ function SwappedProviderStep({
3984
3999
  message: failureMessageForEvent(latestEvent ?? void 0)
3985
4000
  };
3986
4001
  }
3987
- if (orderState?.status === "order_cancelled") {
3988
- const banner = bannerForStatus("order_cancelled", {});
3989
- return { kind: "cancelled", message: banner.detail ?? banner.title };
4002
+ const outcome = orderState?.outcome;
4003
+ if (outcome) {
4004
+ return {
4005
+ kind: "cancelled",
4006
+ message: outcome === "cancelled" ? cancelledMessage : OUTCOME_MESSAGES[outcome]
4007
+ };
3990
4008
  }
3991
4009
  return null;
3992
- }, [latestEvent, orderState, bannerForStatus]);
4010
+ }, [latestEvent, orderState, cancelledMessage]);
3993
4011
  useEffect8(() => {
3994
- if (orderState?.status === "order_cancelled") onCancelled?.();
3995
- }, [onCancelled, orderState?.status]);
4012
+ if (orderState?.outcome === "cancelled") onCancelled?.();
4013
+ }, [onCancelled, orderState?.outcome]);
3996
4014
  useEffect8(() => {
3997
4015
  if (completeFiredRef.current || failedFiredRef.current) return;
3998
4016
  const t = latestEvent?.type;
@@ -4142,15 +4160,14 @@ function SwappedProviderStep({
4142
4160
  loadError && /* @__PURE__ */ jsx17(PoweredBy, {})
4143
4161
  ] });
4144
4162
  }
4145
- function deriveStepStates(swappedStatus, latestEvent) {
4163
+ function deriveStepStates(order, latestEvent) {
4146
4164
  if (isFailedEvent(latestEvent ?? void 0)) {
4147
4165
  return ["complete", "complete", "failed", "pending"];
4148
4166
  }
4149
- if (swappedStatus === "order_cancelled") {
4167
+ if (order?.outcome) {
4150
4168
  return ["failed", "pending", "pending", "pending"];
4151
4169
  }
4152
- const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
4153
- const step2Complete = latestEvent !== null || swappedStatus === "order_broadcasted";
4170
+ const step2Complete = latestEvent !== null || hasReached(order, "sent");
4154
4171
  const step3Complete = latestEvent?.type === "bridge-complete";
4155
4172
  if (step3Complete) {
4156
4173
  return ["complete", "complete", "complete", "complete"];
@@ -4158,7 +4175,7 @@ function deriveStepStates(swappedStatus, latestEvent) {
4158
4175
  if (step2Complete) {
4159
4176
  return ["complete", "complete", "active", "pending"];
4160
4177
  }
4161
- if (step1Complete) {
4178
+ if (hasReached(order, "paid")) {
4162
4179
  return ["complete", "active", "pending", "pending"];
4163
4180
  }
4164
4181
  return ["active", "pending", "pending", "pending"];
@@ -4167,32 +4184,7 @@ SwappedProviderStep.displayName = "SwappedProviderStep";
4167
4184
 
4168
4185
  // src/components/steps/FiatOnrampStep.tsx
4169
4186
  import { jsx as jsx18 } from "react/jsx-runtime";
4170
- function fiatBannerForStatus(status, context) {
4171
- if (context.currencyMismatch) {
4172
- return {
4173
- level: "warning",
4174
- title: "Currency mismatch",
4175
- detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
4176
- };
4177
- }
4178
- switch (status) {
4179
- case "payment_pending":
4180
- return { level: "info", title: "Verifying payment\u2026" };
4181
- case "order_completed":
4182
- return { level: "success", title: "Payment received \u2014 sending crypto" };
4183
- case "order_broadcasted":
4184
- return {
4185
- level: "success",
4186
- title: "Crypto sent \u2014 confirming on-chain"
4187
- };
4188
- case "order_cancelled":
4189
- return {
4190
- level: "warning",
4191
- title: "Order cancelled",
4192
- detail: "If you were charged, Swapped will refund within 5 business days."
4193
- };
4194
- }
4195
- }
4187
+ var CANCELLED_MESSAGE = "If you were charged, Swapped will refund within 5 business days.";
4196
4188
  function FiatOnrampStep({
4197
4189
  smartAccount,
4198
4190
  service,
@@ -4246,7 +4238,7 @@ function FiatOnrampStep({
4246
4238
  iframeTitle: "Buy crypto with Swapped",
4247
4239
  loadErrorCode: "SWAPPED_URL_FAILED",
4248
4240
  loadErrorFallback: "Failed to load on-ramp",
4249
- bannerForStatus: fiatBannerForStatus,
4241
+ cancelledMessage: CANCELLED_MESSAGE,
4250
4242
  onSwappedComplete,
4251
4243
  onSwappedFailed,
4252
4244
  onClose,
@@ -4266,35 +4258,7 @@ FiatOnrampStep.displayName = "FiatOnrampStep";
4266
4258
  // src/components/steps/ExchangeConnectStep.tsx
4267
4259
  import { useCallback as useCallback4 } from "react";
4268
4260
  import { jsx as jsx19 } from "react/jsx-runtime";
4269
- function connectBannerForStatus(status, context) {
4270
- if (context.currencyMismatch) {
4271
- return {
4272
- level: "warning",
4273
- title: "Currency mismatch",
4274
- detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
4275
- };
4276
- }
4277
- switch (status) {
4278
- case "payment_pending":
4279
- return { level: "info", title: "Waiting for exchange transfer\u2026" };
4280
- case "order_completed":
4281
- return {
4282
- level: "success",
4283
- title: "Exchange transfer received \u2014 sending crypto"
4284
- };
4285
- case "order_broadcasted":
4286
- return {
4287
- level: "success",
4288
- title: "Crypto sent \u2014 confirming on-chain"
4289
- };
4290
- case "order_cancelled":
4291
- return {
4292
- level: "warning",
4293
- title: "Order cancelled",
4294
- detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
4295
- };
4296
- }
4297
- }
4261
+ var CANCELLED_MESSAGE2 = "If your exchange already debited the funds, Swapped will refund within 5 business days.";
4298
4262
  function ExchangeConnectStep({
4299
4263
  smartAccount,
4300
4264
  service,
@@ -4330,7 +4294,7 @@ function ExchangeConnectStep({
4330
4294
  iframeTitle: "Fund from exchange via Swapped",
4331
4295
  loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
4332
4296
  loadErrorFallback: "Failed to load Connect",
4333
- bannerForStatus: connectBannerForStatus,
4297
+ cancelledMessage: CANCELLED_MESSAGE2,
4334
4298
  onSwappedComplete,
4335
4299
  onSwappedFailed,
4336
4300
  onClose,
@@ -7451,7 +7415,7 @@ function useDepositStore(selector) {
7451
7415
  // src/DepositFlow.tsx
7452
7416
  import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
7453
7417
  var BankOnrampStep = lazy2(async () => {
7454
- const module = await import("./BankOnrampStep-JUFVAVIS.mjs");
7418
+ const module = await import("./BankOnrampStep-HLNRQ7T5.mjs");
7455
7419
  return { default: module.BankOnrampStep };
7456
7420
  });
7457
7421
  function swappedWidgetPrefetchKey(method, methodSelectionSource) {
@@ -10104,7 +10068,7 @@ function useBankHistory(source, open, panelOpen) {
10104
10068
  import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
10105
10069
  var ReownDepositInner = lazy3(async () => {
10106
10070
  await loadReownDependencies();
10107
- const module = await import("./DepositModalReown-6GHQQNMW.mjs");
10071
+ const module = await import("./DepositModalReown-SKSORQUM.mjs");
10108
10072
  return { default: module.DepositModalReown };
10109
10073
  });
10110
10074
  function buildDepositAnalyticsSessionProperties({
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/core/version.ts
2
- var MODAL_VERSION = "0.0.0-dev-20261007123232";
2
+ var MODAL_VERSION = "0.0.0-dev-20261007142713";
3
3
  var SERVICE_HEADERS = {
4
4
  "Content-Type": "application/json",
5
5
  "x-deposit-modal-version": MODAL_VERSION
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createBearerTransport
3
- } from "./chunk-UGIKPKMY.mjs";
3
+ } from "./chunk-RFSIVTXV.mjs";
4
4
 
5
5
  // src/core/compliance-service.ts
6
6
  function getComplianceStatus(options) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createBearerTransport
3
- } from "./chunk-UGIKPKMY.mjs";
3
+ } from "./chunk-RFSIVTXV.mjs";
4
4
 
5
5
  // src/core/ramp-utils.ts
6
6
  function rampQuery(value) {