@unifold/ui-web 0.1.76 → 0.1.78

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 (3) hide show
  1. package/dist/index.js +298 -92
  2. package/dist/index.mjs +298 -92
  3. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -39598,7 +39598,7 @@ var require_modern2 = __commonJS({
39598
39598
  });
39599
39599
 
39600
39600
  // src/unifold.tsx
39601
- var import_react49 = __toESM(require_react());
39601
+ var import_react48 = __toESM(require_react());
39602
39602
  var import_client = __toESM(require_client());
39603
39603
 
39604
39604
  // ../connect-react/dist/index.mjs
@@ -39756,7 +39756,7 @@ function generateKSUID() {
39756
39756
  function generatePrefixedKSUID(prefix) {
39757
39757
  return `${prefix}_${generateKSUID()}`;
39758
39758
  }
39759
- var SDK_VERSION = true ? "0.1.76" : "0.0.0-dev";
39759
+ var SDK_VERSION = true ? "0.1.78" : "0.0.0-dev";
39760
39760
  var CLIENT_VERSION_HEADER = "x-unifold-client-version";
39761
39761
  var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
39762
39762
  function detectRuntime() {
@@ -41582,8 +41582,8 @@ var OnrampSessionEventType = ((OnrampSessionEventType2) => {
41582
41582
  })(OnrampSessionEventType || {});
41583
41583
 
41584
41584
  // ../connect-react/dist/index.mjs
41585
- var import_react8 = __toESM(require_react(), 1);
41586
41585
  var import_react_query3 = __toESM(require_modern2(), 1);
41586
+ var import_react8 = __toESM(require_react(), 1);
41587
41587
  var React52 = __toESM(require_react(), 1);
41588
41588
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
41589
41589
  var import_react9 = __toESM(require_react(), 1);
@@ -41769,14 +41769,13 @@ var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1);
41769
41769
  var import_react44 = __toESM(require_react(), 1);
41770
41770
  var import_react_query26 = __toESM(require_modern2(), 1);
41771
41771
  var import_react45 = __toESM(require_react(), 1);
41772
- var import_react46 = __toESM(require_react(), 1);
41773
41772
  var import_react_query27 = __toESM(require_modern2(), 1);
41774
41773
  var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1);
41775
41774
  var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1);
41776
- var import_react47 = __toESM(require_react(), 1);
41775
+ var import_react46 = __toESM(require_react(), 1);
41777
41776
  var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1);
41778
41777
  var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1);
41779
- var import_react48 = __toESM(require_react(), 1);
41778
+ var import_react47 = __toESM(require_react(), 1);
41780
41779
  var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
41781
41780
  var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1);
41782
41781
  var __create2 = Object.create;
@@ -47901,7 +47900,7 @@ function generateKSUID2() {
47901
47900
  function generatePrefixedKSUID2(prefix) {
47902
47901
  return `${prefix}_${generateKSUID2()}`;
47903
47902
  }
47904
- var PACKAGE_VERSION = "0.1.76";
47903
+ var PACKAGE_VERSION = "0.1.78";
47905
47904
  var LIBRARY_NAME = "@unifold/analytics";
47906
47905
  var DEFAULT_DEDUP_MS = 500;
47907
47906
  var SESSION_PREFIX = "asess";
@@ -47991,8 +47990,12 @@ var EventTracker = class {
47991
47990
  }
47992
47991
  /**
47993
47992
  * Associate subsequent events with an internal Unifold user.id
47994
- * (`user_<ksuid>`). Pass `null` to clear. Usually called once the
47995
- * deposit-addresses response returns the id.
47993
+ * (`user_<ksuid>`). Pass `null` to clear.
47994
+ *
47995
+ * The tracker is shared across flows and outlives any one journey, so a
47996
+ * journey stamps its own user at the start — with the id if it already
47997
+ * knows one, `null` if it doesn't — rather than inheriting whatever the
47998
+ * previous journey left here.
47996
47999
  */
47997
48000
  setUserId(userId) {
47998
48001
  this.userId = userId || void 0;
@@ -48003,8 +48006,8 @@ var EventTracker = class {
48003
48006
  * {@link EventTracker.endSession} carries it.
48004
48007
  *
48005
48008
  * Does not touch `userId`: the internal `user_<ksuid>` is attached separately
48006
- * via {@link EventTracker.setUserId} once the deposit-addresses response
48007
- * returns, and persists until the host replaces it.
48009
+ * via {@link EventTracker.setUserId}, and persists until the host replaces
48010
+ * it which the SDK's modals do on every journey start.
48008
48011
  */
48009
48012
  startSession() {
48010
48013
  this.sessionId = generatePrefixedKSUID2(SESSION_PREFIX);
@@ -54349,6 +54352,9 @@ var en_default = {
54349
54352
  transactionBreakdown: "Transaction breakdown",
54350
54353
  networkFee: "Network fee",
54351
54354
  confirmOrder: "Confirm Order",
54355
+ mfaEnrollmentTitle: "Enable SMS or Authy 2FA",
54356
+ mfaEnrollmentMessage: "Please make sure you enable SMS or Authy 2FA in your Coinbase account. Press Continue after you enable it.",
54357
+ mfaEnrollmentSettingsLink: "Open Coinbase security settings",
54352
54358
  termsNoticePrefix: "By clicking on Confirm Order, you agree to our ",
54353
54359
  termsNoticeLink: "terms",
54354
54360
  termsNoticeSuffix: "."
@@ -54479,7 +54485,12 @@ var en_default = {
54479
54485
  prefix: "By continuing, you agree to Coinbase's ",
54480
54486
  separator: ", ",
54481
54487
  lastSeparator: ", and ",
54482
- suffix: ". Coinbase is the regulated provider of this fiat-to-crypto onramp."
54488
+ suffix: ".",
54489
+ agreements: {
54490
+ guest_checkout_terms: "Terms of Service",
54491
+ user_agreement: "User Agreement",
54492
+ privacy_policy: "Privacy Policy"
54493
+ }
54483
54494
  },
54484
54495
  errors: {
54485
54496
  rateLimited: "Too many attempts. Please wait a few minutes and try again.",
@@ -55138,6 +55149,9 @@ var zh_default = {
55138
55149
  transactionBreakdown: "\u4EA4\u6613\u660E\u7EC6",
55139
55150
  networkFee: "\u7F51\u7EDC\u624B\u7EED\u8D39",
55140
55151
  confirmOrder: "\u786E\u8BA4\u8BA2\u5355",
55152
+ mfaEnrollmentTitle: "\u8BF7\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1",
55153
+ mfaEnrollmentMessage: "\u8BF7\u786E\u8BA4\u60A8\u5DF2\u5728 Coinbase \u8D26\u6237\u4E2D\u542F\u7528\u77ED\u4FE1\u6216 Authy \u53CC\u91CD\u9A8C\u8BC1\u3002\u542F\u7528\u540E\u8BF7\u6309\u7EE7\u7EED\u3002",
55154
+ mfaEnrollmentSettingsLink: "\u6253\u5F00 Coinbase \u5B89\u5168\u8BBE\u7F6E",
55141
55155
  termsNoticePrefix: "\u70B9\u51FB\u201C\u786E\u8BA4\u8BA2\u5355\u201D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u4EEC\u7684",
55142
55156
  termsNoticeLink: "\u6761\u6B3E",
55143
55157
  termsNoticeSuffix: "\u3002"
@@ -55268,7 +55282,12 @@ var zh_default = {
55268
55282
  prefix: "\u7EE7\u7EED\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
55269
55283
  separator: "\u3001",
55270
55284
  lastSeparator: "\u548C",
55271
- suffix: "\u3002Coinbase \u662F\u672C\u6CD5\u5E01\u5151\u52A0\u5BC6\u8D27\u5E01\u5145\u503C\u670D\u52A1\u7684\u53D7\u76D1\u7BA1\u63D0\u4F9B\u65B9\u3002"
55285
+ suffix: "\u3002",
55286
+ agreements: {
55287
+ guest_checkout_terms: "\u670D\u52A1\u6761\u6B3E",
55288
+ user_agreement: "\u7528\u6237\u534F\u8BAE",
55289
+ privacy_policy: "\u9690\u79C1\u653F\u7B56"
55290
+ }
55272
55291
  },
55273
55292
  errors: {
55274
55293
  rateLimited: "\u5C1D\u8BD5\u6B21\u6570\u8FC7\u591A\u3002\u8BF7\u7A0D\u7B49\u51E0\u5206\u949F\u540E\u91CD\u8BD5\u3002",
@@ -55927,6 +55946,9 @@ var zh_TW_default = {
55927
55946
  transactionBreakdown: "\u4EA4\u6613\u660E\u7D30",
55928
55947
  networkFee: "\u7DB2\u8DEF\u624B\u7E8C\u8CBB",
55929
55948
  confirmOrder: "\u78BA\u8A8D\u8A02\u55AE",
55949
+ mfaEnrollmentTitle: "\u8ACB\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49",
55950
+ mfaEnrollmentMessage: "\u8ACB\u78BA\u8A8D\u60A8\u5DF2\u5728 Coinbase \u5E33\u6236\u4E2D\u555F\u7528\u7C21\u8A0A\u6216 Authy \u96D9\u91CD\u9A57\u8B49\u3002\u555F\u7528\u5F8C\u8ACB\u6309\u7E7C\u7E8C\u3002",
55951
+ mfaEnrollmentSettingsLink: "\u958B\u555F Coinbase \u5B89\u5168\u8A2D\u5B9A",
55930
55952
  termsNoticePrefix: "\u9EDE\u64CA\u300C\u78BA\u8A8D\u8A02\u55AE\u300D\u5373\u8868\u793A\u60A8\u540C\u610F\u6211\u5011\u7684",
55931
55953
  termsNoticeLink: "\u689D\u6B3E",
55932
55954
  termsNoticeSuffix: "\u3002"
@@ -56057,7 +56079,12 @@ var zh_TW_default = {
56057
56079
  prefix: "\u7E7C\u7E8C\u5373\u8868\u793A\u60A8\u540C\u610F Coinbase \u7684",
56058
56080
  separator: "\u3001",
56059
56081
  lastSeparator: "\u548C",
56060
- suffix: "\u3002Coinbase \u662F\u672C\u6CD5\u5E63\u514C\u52A0\u5BC6\u8CA8\u5E63\u5132\u503C\u670D\u52D9\u7684\u53D7\u76E3\u7BA1\u63D0\u4F9B\u65B9\u3002"
56082
+ suffix: "\u3002",
56083
+ agreements: {
56084
+ guest_checkout_terms: "\u670D\u52D9\u689D\u6B3E",
56085
+ user_agreement: "\u4F7F\u7528\u8005\u5354\u8B70",
56086
+ privacy_policy: "\u96B1\u79C1\u6B0A\u653F\u7B56"
56087
+ }
56061
56088
  },
56062
56089
  errors: {
56063
56090
  rateLimited: "\u5617\u8A66\u6B21\u6578\u904E\u591A\u3002\u8ACB\u7A0D\u7B49\u5E7E\u5206\u9418\u5F8C\u91CD\u8A66\u3002",
@@ -56972,6 +56999,13 @@ function useAnalytics() {
56972
56999
  );
56973
57000
  return { track, startSession, endSession, getSessionId, setUserId, subscribe };
56974
57001
  }
57002
+ function useStampInternalUserId({ internalUserId }) {
57003
+ const { setUserId } = useAnalytics();
57004
+ (0, import_react8.useEffect)(() => {
57005
+ if (!internalUserId) return;
57006
+ setUserId(internalUserId);
57007
+ }, [internalUserId, setUserId]);
57008
+ }
56975
57009
  function useDepositAddress(params) {
56976
57010
  const {
56977
57011
  userId,
@@ -56984,7 +57018,6 @@ function useDepositAddress(params) {
56984
57018
  contractCalls,
56985
57019
  enabled = true
56986
57020
  } = params;
56987
- const { setUserId } = useAnalytics();
56988
57021
  const query = (0, import_react_query3.useQuery)({
56989
57022
  queryKey: [
56990
57023
  "unifold",
@@ -57027,11 +57060,7 @@ function useDepositAddress(params) {
57027
57060
  retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 1e4)
57028
57061
  // 1s, 2s, 4s (max 10s)
57029
57062
  });
57030
- (0, import_react8.useEffect)(() => {
57031
- if (query.data?.user_id) {
57032
- setUserId(query.data.user_id);
57033
- }
57034
- }, [query.data?.user_id, setUserId]);
57063
+ useStampInternalUserId({ internalUserId: query.data?.user_id });
57035
57064
  return query;
57036
57065
  }
57037
57066
  function useDebounce(value, delay) {
@@ -59233,6 +59262,10 @@ function BuyWithCard({
59233
59262
  wallet_address: wallet.address,
59234
59263
  subdivision_code: userIpInfo?.subdivisionCode || void 0,
59235
59264
  external_id: externalId,
59265
+ // The rail this quote was priced for, so the provider opens on it. Most
59266
+ // are `card`, which is also the server default, but a local rail (e.g.
59267
+ // `upi` in India) is the whole reason its provider was quoted.
59268
+ payment_method_type: selectedProvider.payment_method_type,
59236
59269
  // Exactly one of source_amount / destination_amount (mutually exclusive):
59237
59270
  // destination mode starts the session by the fixed crypto amount (fees on
59238
59271
  // top); otherwise by the entered fiat amount.
@@ -59250,7 +59283,11 @@ function BuyWithCard({
59250
59283
  method: "card",
59251
59284
  flow_type: "deposit",
59252
59285
  provider: selectedProvider.service_provider,
59253
- amount_usd: amount
59286
+ amount_usd: amount,
59287
+ // The execution only exists once the provider's payout lands on this
59288
+ // wallet, and it carries this id — so it's the join key for a purchase
59289
+ // that starts here and never reaches flow_completed.
59290
+ deposit_wallet_id: depositWalletId
59254
59291
  });
59255
59292
  onEvent?.({
59256
59293
  id: generatePrefixedKSUID("sevt"),
@@ -60687,6 +60724,8 @@ var BuyWithWalletPay = React82.forwardRef(
60687
60724
  const [limitUpgradeError, setLimitUpgradeError] = (0, import_react16.useState)(null);
60688
60725
  const [upgradeSubmitting, setUpgradeSubmitting] = (0, import_react16.useState)(false);
60689
60726
  const upgradeFlowAbortRef = (0, import_react16.useRef)(null);
60727
+ const applyLimitRoutingRef = (0, import_react16.useRef)(() => {
60728
+ });
60690
60729
  const [amount, setAmount] = (0, import_react16.useState)(amountUsd ?? "");
60691
60730
  const [preparedOrder, setPreparedOrder] = (0, import_react16.useState)(null);
60692
60731
  const sessionAbortRef = (0, import_react16.useRef)(null);
@@ -60821,6 +60860,14 @@ var BuyWithWalletPay = React82.forwardRef(
60821
60860
  },
60822
60861
  [email, normalizedPhone, userId]
60823
60862
  );
60863
+ const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
60864
+ userId,
60865
+ publishableKey,
60866
+ normalizedPhone,
60867
+ userEmail,
60868
+ sessionPhoneVerified: verificationSession?.phone?.status === "verified",
60869
+ isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
60870
+ });
60824
60871
  const createSessionAndSendOtp = (0, import_react16.useCallback)(async () => {
60825
60872
  setView("submitting_session");
60826
60873
  setErrorMessage("");
@@ -60830,7 +60877,12 @@ var BuyWithWalletPay = React82.forwardRef(
60830
60877
  email,
60831
60878
  phone: normalizedPhone,
60832
60879
  terms_accepted: true,
60833
- email_already_verified: true
60880
+ // TODO: when the API honors `false`, this will trigger email OTP.
60881
+ // Today `false` still skips email (we don't verify it) and JWT ev
60882
+ // is null. Don't send `true` — that was a fake attest.
60883
+ email_already_verified: false
60884
+ // Coinbase stays Redis-only + JWT until bank-transfer identity
60885
+ // is live. Do not persist from this path yet.
60834
60886
  },
60835
60887
  publishableKey
60836
60888
  );
@@ -60840,6 +60892,34 @@ var BuyWithWalletPay = React82.forwardRef(
60840
60892
  }
60841
60893
  setClientSecret(session.client_secret);
60842
60894
  storeWalletPaySession();
60895
+ if (session.status === "verified") {
60896
+ const tokenRes = await exchangeOnrampVerificationToken(
60897
+ session.id,
60898
+ session.client_secret,
60899
+ publishableKey
60900
+ );
60901
+ setOnrampToken(tokenRes);
60902
+ storeWalletPaySession({
60903
+ emailVerifiedAt: session.email.verified_at,
60904
+ phoneVerifiedAt: session.phone.verified_at,
60905
+ onrampToken: tokenRes.token,
60906
+ onrampTokenExpiresAtMs: Date.now() + tokenRes.expires_in * 1e3
60907
+ });
60908
+ if (amountUsd) setAmount(amountUsd);
60909
+ try {
60910
+ const result = await refetchWalletPayLimits();
60911
+ if (result.data) {
60912
+ const nextView = getViewForLimitStatus(result.data);
60913
+ if (nextView) {
60914
+ applyLimitRoutingRef.current(nextView, result.data.upgrade_status);
60915
+ return;
60916
+ }
60917
+ }
60918
+ } catch {
60919
+ }
60920
+ setView("amount");
60921
+ return;
60922
+ }
60843
60923
  await sendOnrampVerificationOtp(session.id, "phone", session.client_secret, publishableKey);
60844
60924
  setResendCooldown(30);
60845
60925
  setView("phone_otp");
@@ -60848,19 +60928,19 @@ var BuyWithWalletPay = React82.forwardRef(
60848
60928
  setErrorMessage(prettifyVerificationError(raw));
60849
60929
  setView("phone_input");
60850
60930
  }
60851
- }, [email, normalizedPhone, publishableKey, storeWalletPaySession]);
60931
+ }, [
60932
+ email,
60933
+ normalizedPhone,
60934
+ publishableKey,
60935
+ storeWalletPaySession,
60936
+ userId,
60937
+ amountUsd,
60938
+ refetchWalletPayLimits
60939
+ ]);
60852
60940
  const clearUpgradeFields = (0, import_react16.useCallback)(() => {
60853
60941
  setSsnLast4("");
60854
60942
  setDobInput("");
60855
60943
  }, []);
60856
- const { action: initialAction, refetchWalletPayLimits } = useWalletPayInitialScreen({
60857
- userId,
60858
- publishableKey,
60859
- normalizedPhone,
60860
- userEmail,
60861
- sessionPhoneVerified: verificationSession?.phone?.status === "verified",
60862
- isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
60863
- });
60864
60944
  const pollLimitUpgradeStatus = (0, import_react16.useCallback)(
60865
60945
  async (signal) => {
60866
60946
  const POLL_INTERVAL_MS5 = 1500;
@@ -60971,6 +61051,7 @@ var BuyWithWalletPay = React82.forwardRef(
60971
61051
  },
60972
61052
  [startUpgradePolling]
60973
61053
  );
61054
+ applyLimitRoutingRef.current = applyLimitRouting;
60974
61055
  const hasInitializedRef = (0, import_react16.useRef)(false);
60975
61056
  (0, import_react16.useEffect)(() => {
60976
61057
  if (hasInitializedRef.current) return;
@@ -61200,7 +61281,10 @@ var BuyWithWalletPay = React82.forwardRef(
61200
61281
  track("flow_started", {
61201
61282
  method,
61202
61283
  flow_type: "deposit",
61203
- amount_usd: walletPayAmountUsd
61284
+ amount_usd: walletPayAmountUsd,
61285
+ // No execution yet — one appears when the payout lands on this
61286
+ // wallet, carrying the same id.
61287
+ deposit_wallet_id: depositWalletId
61204
61288
  });
61205
61289
  onEvent?.({
61206
61290
  id: generatePrefixedKSUID("sevt"),
@@ -61250,6 +61334,7 @@ var BuyWithWalletPay = React82.forwardRef(
61250
61334
  defaultTokenLoading,
61251
61335
  defaultTokenError,
61252
61336
  depositWallet?.address,
61337
+ depositWalletId,
61253
61338
  userEmail,
61254
61339
  publishableKey,
61255
61340
  onEvent,
@@ -62224,7 +62309,7 @@ var FALLBACK_AGREEMENTS = [
62224
62309
  {
62225
62310
  key: "guest_checkout_terms",
62226
62311
  name: "Guest Checkout Terms of Service",
62227
- url: "https://www.coinbase.com/legal/cb-pay/onramp-guest-checkout-terms"
62312
+ url: "https://www.coinbase.com/legal/guest-checkout/us"
62228
62313
  },
62229
62314
  {
62230
62315
  key: "user_agreement",
@@ -62244,22 +62329,24 @@ function LegalDisclaimer({ legalAgreements, loading }) {
62244
62329
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
62245
62330
  "div",
62246
62331
  {
62247
- className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse",
62332
+ className: "uf-mt-3 uf-mb-3 uf-px-1 uf-space-y-1.5 uf-animate-pulse uf-opacity-50",
62248
62333
  "aria-hidden": true,
62249
62334
  "aria-busy": "true",
62250
62335
  children: [
62251
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2.5 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
62252
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2.5 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
62253
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2.5 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
62336
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-full", style: { backgroundColor: colors2.card } }),
62337
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-11/12", style: { backgroundColor: colors2.card } }),
62338
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uf-h-2 uf-rounded uf-w-3/4", style: { backgroundColor: colors2.card } })
62254
62339
  ]
62255
62340
  }
62256
62341
  );
62257
62342
  }
62258
62343
  const agreements = legalAgreements?.agreements ?? FALLBACK_AGREEMENTS;
62344
+ const shortLabels = t.agreements;
62345
+ const lastSeparator = t.lastSeparator.replace(/\s+$/, "\xA0");
62259
62346
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
62260
62347
  "p",
62261
62348
  {
62262
- className: "uf-text-[11px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-px-1",
62349
+ className: "uf-text-[10px] uf-leading-relaxed uf-mt-3 uf-mb-3 uf-opacity-60 uf-text-center",
62263
62350
  style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
62264
62351
  children: [
62265
62352
  t.prefix,
@@ -62270,12 +62357,12 @@ function LegalDisclaimer({ legalAgreements, loading }) {
62270
62357
  href: a.url,
62271
62358
  target: "_blank",
62272
62359
  rel: "noopener noreferrer",
62273
- className: "uf-underline",
62274
- style: { color: colors2.foreground },
62275
- children: a.name
62360
+ className: "uf-no-underline",
62361
+ style: { color: "inherit", textDecoration: "none", whiteSpace: "nowrap" },
62362
+ children: shortLabels[a.key] ?? a.name
62276
62363
  }
62277
62364
  ),
62278
- idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? t.lastSeparator : ""
62365
+ idx < arr.length - 2 ? t.separator : idx === arr.length - 2 ? lastSeparator : ""
62279
62366
  ] }, a.key)),
62280
62367
  t.suffix
62281
62368
  ]
@@ -62918,6 +63005,7 @@ function PayWithCashApp({
62918
63005
  destinationChainType,
62919
63006
  destinationChainId,
62920
63007
  destinationTokenAddress,
63008
+ contractCalls,
62921
63009
  cashAppIconUrl,
62922
63010
  view: controlledView,
62923
63011
  onViewChange,
@@ -63010,7 +63098,8 @@ function PayWithCashApp({
63010
63098
  destination_token_address: destinationTokenAddress,
63011
63099
  recipient_address: recipientAddress,
63012
63100
  source_amount: amount,
63013
- external_id: externalId
63101
+ external_id: externalId,
63102
+ ...contractCalls?.length ? { contract_calls: contractCalls } : {}
63014
63103
  },
63015
63104
  publishableKey
63016
63105
  );
@@ -63023,7 +63112,10 @@ function PayWithCashApp({
63023
63112
  track("flow_started", {
63024
63113
  method: "cashapp",
63025
63114
  flow_type: "deposit",
63026
- amount_usd: amount
63115
+ amount_usd: amount,
63116
+ // No execution yet — one appears when the payout lands on this
63117
+ // wallet, carrying the same id.
63118
+ deposit_wallet_id: depositWalletId
63027
63119
  });
63028
63120
  onEvent?.({
63029
63121
  id: generatePrefixedKSUID("sevt"),
@@ -63048,6 +63140,8 @@ function PayWithCashApp({
63048
63140
  destinationChainType,
63049
63141
  destinationChainId,
63050
63142
  destinationTokenAddress,
63143
+ contractCalls,
63144
+ depositWalletId,
63051
63145
  onEvent,
63052
63146
  onDepositError,
63053
63147
  track,
@@ -63649,7 +63743,10 @@ function BankTransfer({
63649
63743
  method: "bank_transfer",
63650
63744
  flow_type: "deposit",
63651
63745
  provider: request.service_provider,
63652
- amount_usd: request.source_amount
63746
+ amount_usd: request.source_amount,
63747
+ // No execution yet — one appears when the provider's payout lands on
63748
+ // this wallet, carrying the same id.
63749
+ deposit_wallet_id: pollingWalletId
63653
63750
  });
63654
63751
  onEvent?.({
63655
63752
  id: generatePrefixedKSUID("sevt"),
@@ -69730,7 +69827,11 @@ function PayWithStripeLink({
69730
69827
  if (checkoutResult.successful) {
69731
69828
  handledTerminalSessionRef.current = null;
69732
69829
  executionReconciledSessionRef.current = null;
69733
- track("flow_started", { method: "stripe_link", flow_type: "deposit" });
69830
+ track("flow_started", {
69831
+ method: "stripe_link",
69832
+ flow_type: "deposit",
69833
+ deposit_wallet_id: depositWalletId
69834
+ });
69734
69835
  setConfirmedSessionId(activeSessionId);
69735
69836
  setSessionStatus(STRIPE_SESSION_STATUS.FULFILLMENT_PROCESSING);
69736
69837
  if (selectedTokenSingleUseRef.current) clearSelectedPaymentToken();
@@ -71227,7 +71328,14 @@ function PayWithStripeLink({
71227
71328
  ]
71228
71329
  }
71229
71330
  ),
71230
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref: authMountRef, className: "uf-w-full uf-min-h-[200px]" })
71331
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
71332
+ "div",
71333
+ {
71334
+ ref: authMountRef,
71335
+ className: "uf-w-full uf-min-h-[200px]",
71336
+ style: { colorScheme: "only light" }
71337
+ }
71338
+ )
71231
71339
  ]
71232
71340
  }
71233
71341
  );
@@ -72490,6 +72598,9 @@ function CoinbaseConnect({
72490
72598
  flow_type: "deposit",
72491
72599
  method: "exchange_connect",
72492
72600
  provider: IntegrationProvider.COINBASE,
72601
+ // No execution yet — one appears when the exchange's transfer lands on
72602
+ // this wallet, carrying the same id.
72603
+ deposit_wallet_id: transferDepositWalletId,
72493
72604
  amount_usd: sendAmount || void 0,
72494
72605
  currency: selectedAsset?.currency.toLowerCase().replace(/[^a-z0-9]+/g, "_"),
72495
72606
  chain: sourceChain?.chain_id,
@@ -72497,6 +72608,34 @@ function CoinbaseConnect({
72497
72608
  network: sourceChain?.network
72498
72609
  });
72499
72610
  };
72611
+ const applyConfirmResult = (result) => {
72612
+ if (result.status === "mfa_required") {
72613
+ track("verification_started", {
72614
+ flow_type: "deposit",
72615
+ method: "exchange_connect",
72616
+ provider: IntegrationProvider.COINBASE,
72617
+ verification_type: "mfa",
72618
+ verification_status: result.status
72619
+ });
72620
+ transitionTo("mfa");
72621
+ setMfaCode("");
72622
+ setMfaError(false);
72623
+ } else if (result.status === "mfa_enrollment_required") {
72624
+ transitionTo("mfa_enrollment");
72625
+ } else if (result.status === "completed") {
72626
+ trackTransferStarted();
72627
+ setConfirmResult(result);
72628
+ transitionTo("success");
72629
+ onTransferSuccess?.(result);
72630
+ } else {
72631
+ setErrorMessage(result.message || t.errors.transferFailed);
72632
+ transitionTo("error");
72633
+ onTransferError?.({
72634
+ message: result.message || t.errors.transferFailed,
72635
+ code: result.status
72636
+ });
72637
+ }
72638
+ };
72500
72639
  const handleConfirmTransfer = async () => {
72501
72640
  if (!transferIntent || !accessToken) return;
72502
72641
  setIsLoading(true);
@@ -72531,30 +72670,7 @@ function CoinbaseConnect({
72531
72670
  });
72532
72671
  throw err;
72533
72672
  });
72534
- if (result.status === "mfa_required") {
72535
- track("verification_started", {
72536
- flow_type: "deposit",
72537
- method: "exchange_connect",
72538
- provider: IntegrationProvider.COINBASE,
72539
- verification_type: "mfa",
72540
- verification_status: result.status
72541
- });
72542
- transitionTo("mfa");
72543
- setMfaCode("");
72544
- setMfaError(false);
72545
- } else if (result.status === "completed") {
72546
- trackTransferStarted();
72547
- setConfirmResult(result);
72548
- transitionTo("success");
72549
- onTransferSuccess?.(result);
72550
- } else {
72551
- setErrorMessage(result.message || t.errors.transferFailed);
72552
- transitionTo("error");
72553
- onTransferError?.({
72554
- message: result.message || t.errors.transferFailed,
72555
- code: result.status
72556
- });
72557
- }
72673
+ applyConfirmResult(result);
72558
72674
  } catch (err) {
72559
72675
  const message = err instanceof Error ? err.message : t.errors.transferFailed;
72560
72676
  setErrorMessage(message);
@@ -72711,6 +72827,9 @@ function CoinbaseConnect({
72711
72827
  setShowTransferDetails(false);
72712
72828
  transitionTo("enter_amount");
72713
72829
  break;
72830
+ case "mfa_enrollment":
72831
+ transitionTo("transfer_confirm");
72832
+ break;
72714
72833
  case "mfa":
72715
72834
  transitionTo("transfer_confirm");
72716
72835
  break;
@@ -74267,6 +74386,55 @@ function CoinbaseConnect({
74267
74386
  ] })
74268
74387
  ] });
74269
74388
  }
74389
+ if (view === "mfa_enrollment") {
74390
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
74391
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
74392
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
74393
+ "div",
74394
+ {
74395
+ className: "uf-flex uf-flex-col uf-items-center uf-px-4 uf-pb-4",
74396
+ style: viewTransitionStyle,
74397
+ children: [
74398
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
74399
+ DepositErrorState,
74400
+ {
74401
+ title: t.transfer.mfaEnrollmentTitle,
74402
+ message: t.transfer.mfaEnrollmentMessage
74403
+ }
74404
+ ),
74405
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
74406
+ "a",
74407
+ {
74408
+ href: "https://www.coinbase.com/settings/security",
74409
+ target: "_blank",
74410
+ rel: "noopener noreferrer",
74411
+ className: "uf-text-sm uf-underline uf-mb-8 uf-inline-flex uf-items-center uf-gap-1",
74412
+ style: { color: colors2.primary, fontFamily: fonts.medium },
74413
+ children: [
74414
+ t.transfer.mfaEnrollmentSettingsLink,
74415
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ExternalLink, { className: "uf-w-3.5 uf-h-3.5" })
74416
+ ]
74417
+ }
74418
+ ),
74419
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
74420
+ "button",
74421
+ {
74422
+ onClick: handleConfirmTransfer,
74423
+ disabled: isLoading,
74424
+ className: "uf-w-full uf-rounded-xl uf-py-3.5 uf-text-sm uf-font-medium uf-transition-all hover:uf-opacity-90 disabled:uf-opacity-50 uf-flex uf-items-center uf-justify-center uf-gap-2",
74425
+ style: {
74426
+ backgroundColor: colors2.primary,
74427
+ color: "#fff",
74428
+ fontFamily: fonts.medium
74429
+ },
74430
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin" }) : t.continue
74431
+ }
74432
+ )
74433
+ ]
74434
+ }
74435
+ )
74436
+ ] });
74437
+ }
74270
74438
  if (view === "mfa") {
74271
74439
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
74272
74440
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DepositHeader, { title: t.title, showBack: true, onBack: handleBack, onClose }),
@@ -80194,7 +80362,11 @@ function WalletConnect({
80194
80362
  chain: String(token.chain_id),
80195
80363
  network: token.network,
80196
80364
  token: token.symbol ?? token.token_address,
80197
- currency: token.currency
80365
+ currency: token.currency,
80366
+ // No execution exists yet — it's created when this send lands on the
80367
+ // wallet. The wallet id is what that execution will carry, so it's
80368
+ // how a send that never completes is matched to what followed.
80369
+ deposit_wallet_id: activeDepositWallet?.id
80198
80370
  });
80199
80371
  setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
80200
80372
  setHasSignedTransaction(true);
@@ -80781,7 +80953,7 @@ function DepositModal({
80781
80953
  const applePaySubTitle = applePaySubTitleProp ?? t.applePayMenu.subtitle;
80782
80954
  const googlePayTitle = googlePayTitleProp ?? t.googlePayMenu.title;
80783
80955
  const googlePaySubTitle = googlePaySubTitleProp ?? t.googlePayMenu.subtitle;
80784
- const { track, startSession, endSession, getSessionId, subscribe } = useAnalytics();
80956
+ const { track, startSession, endSession, getSessionId, setUserId, subscribe } = useAnalytics();
80785
80957
  const normalizedPrefilledAmountUsd = (0, import_react3.useMemo)(
80786
80958
  () => normalizePrefilledUsdAmount(prefilledAmountUsd),
80787
80959
  [prefilledAmountUsd]
@@ -80789,6 +80961,7 @@ function DepositModal({
80789
80961
  const analyticsMethod = (method) => method === "transfer" ? "transfer_crypto" : method;
80790
80962
  const journeyActiveRef = (0, import_react3.useRef)(false);
80791
80963
  const journeySessionIdRef = (0, import_react3.useRef)(void 0);
80964
+ const journeyExternalUserIdRef = (0, import_react3.useRef)(void 0);
80792
80965
  const externalUserId = userId || void 0;
80793
80966
  const emitEvent = (0, import_react3.useCallback)(
80794
80967
  (event) => onEvent?.({ ...event, externalUserId }),
@@ -80816,6 +80989,9 @@ function DepositModal({
80816
80989
  method: analyticsMethod(method),
80817
80990
  flow_type: "deposit",
80818
80991
  amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
80992
+ // The one high-cardinality field we do send: the join key from a
80993
+ // funnel session back to the execution row it produced.
80994
+ execution_id: data.executionId ?? execution?.id,
80819
80995
  // Flat, low-cardinality execution dimensions for PostHog breakdowns
80820
80996
  // (precise/opaque fields like base units, addresses, tx hashes live in
80821
80997
  // the onEvent DirectExecution instead).
@@ -80843,6 +81019,7 @@ function DepositModal({
80843
81019
  method: analyticsMethod(method),
80844
81020
  flow_type: "deposit",
80845
81021
  error_code: error.code,
81022
+ execution_id: execution?.id,
80846
81023
  failure_reason: execution?.failureReason ?? void 0,
80847
81024
  status: execution?.status,
80848
81025
  source_chain_type: execution?.sourceChainType,
@@ -81271,8 +81448,10 @@ function DepositModal({
81271
81448
  const beginJourney = (0, import_react3.useCallback)(() => {
81272
81449
  journeySessionIdRef.current = startSession();
81273
81450
  journeyActiveRef.current = true;
81451
+ journeyExternalUserIdRef.current = userId;
81452
+ setUserId(null);
81274
81453
  track("widget_opened", { flow_type: "deposit" });
81275
- }, [startSession, track]);
81454
+ }, [startSession, track, setUserId, userId]);
81276
81455
  const handleClose = () => {
81277
81456
  finalizeJourney();
81278
81457
  onOpenChange(false);
@@ -81297,6 +81476,11 @@ function DepositModal({
81297
81476
  }
81298
81477
  beginJourney();
81299
81478
  }, [open]);
81479
+ (0, import_react3.useLayoutEffect)(() => {
81480
+ if (!open || journeyExternalUserIdRef.current === userId) return;
81481
+ journeyExternalUserIdRef.current = userId;
81482
+ setUserId(null);
81483
+ }, [open, userId, setUserId]);
81300
81484
  (0, import_react3.useLayoutEffect)(() => {
81301
81485
  if (!open) return;
81302
81486
  if (resetViewTimeoutRef.current) {
@@ -82208,6 +82392,7 @@ function DepositModal({
82208
82392
  destinationChainType,
82209
82393
  destinationChainId,
82210
82394
  destinationTokenAddress,
82395
+ contractCalls,
82211
82396
  cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
82212
82397
  view: cashAppView,
82213
82398
  onViewChange: setCashAppView,
@@ -82543,6 +82728,9 @@ function CheckoutModal({
82543
82728
  flowCompletedRef.current = true;
82544
82729
  track("flow_completed", {
82545
82730
  flow_type: "checkout",
82731
+ // Checkout has no direct execution; the intent is what a funnel
82732
+ // session joins back to.
82733
+ payment_intent_id: data.paymentIntentId,
82546
82734
  ...method ? { method: method === "transfer" ? "transfer_crypto" : method } : {}
82547
82735
  });
82548
82736
  }
@@ -82763,7 +82951,7 @@ function CheckoutModal({
82763
82951
  journeySessionIdRef.current = startSession();
82764
82952
  journeyActiveRef.current = true;
82765
82953
  flowCompletedRef.current = false;
82766
- setUserId(null);
82954
+ setUserId(paymentIntentUserId ?? null);
82767
82955
  track("widget_opened", { flow_type: "checkout" });
82768
82956
  if (resetViewTimeoutRef.current) {
82769
82957
  clearTimeout(resetViewTimeoutRef.current);
@@ -83348,7 +83536,7 @@ function useAddressBalance(params) {
83348
83536
  }
83349
83537
  function useExecutions(userId, publishableKey, options2) {
83350
83538
  const actionType = options2?.actionType ?? ActionType.Deposit;
83351
- return (0, import_react_query25.useQuery)({
83539
+ const query = (0, import_react_query25.useQuery)({
83352
83540
  queryKey: ["unifold", "executions", actionType, userId, publishableKey],
83353
83541
  queryFn: () => queryExecutions(userId, publishableKey, actionType),
83354
83542
  enabled: (options2?.enabled ?? true) && !!userId,
@@ -83357,6 +83545,8 @@ function useExecutions(userId, publishableKey, options2) {
83357
83545
  gcTime: 1e3 * 60 * 5,
83358
83546
  refetchOnWindowFocus: false
83359
83547
  });
83548
+ useStampInternalUserId({ internalUserId: query.data?.data[0]?.user_id });
83549
+ return query;
83360
83550
  }
83361
83551
  var POLL_INTERVAL_MS4 = 2500;
83362
83552
  var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
@@ -83731,7 +83921,6 @@ function useGetDepositAddress(params) {
83731
83921
  actionType,
83732
83922
  enabled = true
83733
83923
  } = params;
83734
- const { setUserId } = useAnalytics();
83735
83924
  const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
83736
83925
  const query = (0, import_react_query27.useQuery)({
83737
83926
  queryKey: [
@@ -83763,11 +83952,7 @@ function useGetDepositAddress(params) {
83763
83952
  refetchOnWindowFocus: false,
83764
83953
  retry: 1
83765
83954
  });
83766
- (0, import_react46.useEffect)(() => {
83767
- if (query.data?.user_id) {
83768
- setUserId(query.data.user_id);
83769
- }
83770
- }, [query.data?.user_id, setUserId]);
83955
+ useStampInternalUserId({ internalUserId: query.data?.user_id });
83771
83956
  return query;
83772
83957
  }
83773
83958
  var isHypercore = (chainId) => chainId === HYPERCORE_CHAIN_ID;
@@ -84717,9 +84902,9 @@ function WithdrawConfirmingView({
84717
84902
  const { colors: colors2, fonts, components } = useTheme();
84718
84903
  const { t: strings } = useI18n();
84719
84904
  const t = strings.withdrawModal.details;
84720
- const [showButton, setShowButton] = (0, import_react47.useState)(false);
84905
+ const [showButton, setShowButton] = (0, import_react46.useState)(false);
84721
84906
  const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
84722
- (0, import_react47.useEffect)(() => {
84907
+ (0, import_react46.useEffect)(() => {
84723
84908
  if (latestExecution) return;
84724
84909
  const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
84725
84910
  return () => clearTimeout(timer);
@@ -84888,12 +85073,16 @@ function WithdrawModal({
84888
85073
  );
84889
85074
  const journeyActiveRef = (0, import_react42.useRef)(false);
84890
85075
  const journeySessionIdRef = (0, import_react42.useRef)(void 0);
85076
+ const journeyExternalUserIdRef = (0, import_react42.useRef)(void 0);
84891
85077
  const onWithdrawSuccessFor = (0, import_react42.useCallback)(
84892
85078
  (data) => {
84893
85079
  const execution = data.execution?.data.object;
84894
85080
  track("flow_completed", {
84895
85081
  flow_type: "withdraw",
84896
85082
  amount_usd: execution?.destinationAmountUsd ?? execution?.sourceAmountUsd,
85083
+ // The one high-cardinality field we do send: the join key from a
85084
+ // funnel session back to the execution row it produced.
85085
+ execution_id: data.executionId ?? execution?.id,
84897
85086
  // Flat, low-cardinality execution dimensions for PostHog breakdowns.
84898
85087
  status: execution?.status,
84899
85088
  source_chain_type: execution?.sourceChainType,
@@ -84914,6 +85103,7 @@ function WithdrawModal({
84914
85103
  track("flow_failed", {
84915
85104
  flow_type: "withdraw",
84916
85105
  error_code: error.code,
85106
+ execution_id: execution?.id,
84917
85107
  failure_reason: execution?.failureReason ?? void 0,
84918
85108
  status: execution?.status,
84919
85109
  source_chain_type: execution?.sourceChainType,
@@ -84987,6 +85177,7 @@ function WithdrawModal({
84987
85177
  ) ?? null : null;
84988
85178
  const [view, setView] = (0, import_react42.useState)("form");
84989
85179
  const [withdrawDepositWalletId, setWithdrawDepositWalletId] = (0, import_react42.useState)();
85180
+ const withdrawDepositWalletIdRef = (0, import_react42.useRef)(void 0);
84990
85181
  const [selectedExecution, setSelectedExecution] = (0, import_react42.useState)(null);
84991
85182
  const [submittedTxInfo, setSubmittedTxInfo] = (0, import_react42.useState)(null);
84992
85183
  const { executions: realtimeExecutions } = useWithdrawPolling({
@@ -85024,6 +85215,7 @@ function WithdrawModal({
85024
85215
  if (!depositWallet) {
85025
85216
  throw new Error(`No deposit wallet available for ${sourceChainType}`);
85026
85217
  }
85218
+ withdrawDepositWalletIdRef.current = depositWallet.id;
85027
85219
  setWithdrawDepositWalletId(depositWallet.id);
85028
85220
  return depositWallet;
85029
85221
  },
@@ -85043,7 +85235,12 @@ function WithdrawModal({
85043
85235
  currency: tokenData?.currency,
85044
85236
  amount: txInfo.amount,
85045
85237
  amount_base_unit: txInfo.amountBaseUnit,
85046
- ...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {}
85238
+ ...txInfo.amountUsd ? { amount_usd: txInfo.amountUsd } : {},
85239
+ // The execution doesn't exist yet — it's created when the user's send
85240
+ // lands on the withdraw deposit wallet, and carries this id. So a
85241
+ // withdrawal confirmed but never completed still joins to whatever
85242
+ // did (or didn't) follow on that wallet.
85243
+ deposit_wallet_id: withdrawDepositWalletIdRef.current
85047
85244
  });
85048
85245
  emitEvent({
85049
85246
  id: generatePrefixedKSUID("sevt"),
@@ -85077,8 +85274,10 @@ function WithdrawModal({
85077
85274
  const beginJourney = (0, import_react42.useCallback)(() => {
85078
85275
  journeySessionIdRef.current = startSession();
85079
85276
  journeyActiveRef.current = true;
85277
+ journeyExternalUserIdRef.current = externalUserId;
85278
+ setUserId(null);
85080
85279
  track("widget_opened", { flow_type: "withdraw" });
85081
- }, [startSession, track]);
85280
+ }, [startSession, track, setUserId, externalUserId]);
85082
85281
  const handleClose = (0, import_react42.useCallback)(() => {
85083
85282
  finalizeJourney();
85084
85283
  onOpenChange(false);
@@ -85087,6 +85286,7 @@ function WithdrawModal({
85087
85286
  setView("form");
85088
85287
  setSelectedExecution(null);
85089
85288
  setSubmittedTxInfo(null);
85289
+ withdrawDepositWalletIdRef.current = void 0;
85090
85290
  setWithdrawDepositWalletId(void 0);
85091
85291
  resetViewTimeoutRef.current = null;
85092
85292
  }, 200);
@@ -85104,8 +85304,14 @@ function WithdrawModal({
85104
85304
  setView("form");
85105
85305
  setSelectedExecution(null);
85106
85306
  setSubmittedTxInfo(null);
85307
+ withdrawDepositWalletIdRef.current = void 0;
85107
85308
  setWithdrawDepositWalletId(void 0);
85108
85309
  }, [open]);
85310
+ (0, import_react42.useLayoutEffect)(() => {
85311
+ if (!open || journeyExternalUserIdRef.current === externalUserId) return;
85312
+ journeyExternalUserIdRef.current = externalUserId;
85313
+ setUserId(null);
85314
+ }, [open, externalUserId, setUserId]);
85109
85315
  (0, import_react42.useEffect)(
85110
85316
  () => () => {
85111
85317
  if (journeyActiveRef.current) {
@@ -85791,9 +85997,9 @@ function useUnifold2() {
85791
85997
  }
85792
85998
 
85793
85999
  // src/unifold.tsx
85794
- var UnifoldBridge = (0, import_react49.forwardRef)((_, ref) => {
86000
+ var UnifoldBridge = (0, import_react48.forwardRef)((_, ref) => {
85795
86001
  const { beginDeposit, closeDeposit, beginWithdraw, closeWithdraw } = useUnifold2();
85796
- (0, import_react49.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
86002
+ (0, import_react48.useImperativeHandle)(ref, () => ({ beginDeposit, closeDeposit, beginWithdraw, closeWithdraw }), [
85797
86003
  beginDeposit,
85798
86004
  closeDeposit,
85799
86005
  beginWithdraw,
@@ -85802,7 +86008,7 @@ var UnifoldBridge = (0, import_react49.forwardRef)((_, ref) => {
85802
86008
  return null;
85803
86009
  });
85804
86010
  UnifoldBridge.displayName = "UnifoldBridge";
85805
- var RenderErrorBoundary = class extends import_react49.Component {
86011
+ var RenderErrorBoundary = class extends import_react48.Component {
85806
86012
  constructor() {
85807
86013
  super(...arguments);
85808
86014
  this.state = { hasError: false };
@@ -85874,13 +86080,13 @@ function createUnifold(publishableKey, config) {
85874
86080
  };
85875
86081
  try {
85876
86082
  root.render(
85877
- import_react49.default.createElement(
86083
+ import_react48.default.createElement(
85878
86084
  RenderErrorBoundary,
85879
86085
  { onError: handleRenderError },
85880
- import_react49.default.createElement(
86086
+ import_react48.default.createElement(
85881
86087
  UnifoldProvider2,
85882
86088
  { publishableKey, config },
85883
- import_react49.default.createElement(UnifoldBridge, { ref: refCallback })
86089
+ import_react48.default.createElement(UnifoldBridge, { ref: refCallback })
85884
86090
  )
85885
86091
  )
85886
86092
  );