@pollar/react 0.12.1-rc.22 → 0.12.1-rc.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1311,7 +1311,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1311
1311
  /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1312
1312
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
1313
1313
  "v",
1314
- "0.12.1-rc.22"
1314
+ "0.12.1-rc.25"
1315
1315
  ] })
1316
1316
  ] });
1317
1317
  };
@@ -3556,6 +3556,21 @@ function useInlineConfirmation(active) {
3556
3556
  react.useEffect(() => active ? registerConfirmationHost() : void 0, [active, registerConfirmationHost]);
3557
3557
  return active ? confirmations[0] ?? null : null;
3558
3558
  }
3559
+ function useDeclineOnClose(confirmation) {
3560
+ const pending = react.useRef(0);
3561
+ const track = react.useCallback(async (call) => {
3562
+ pending.current += 1;
3563
+ try {
3564
+ return await call;
3565
+ } finally {
3566
+ pending.current -= 1;
3567
+ }
3568
+ }, []);
3569
+ const declineOnClose = react.useCallback(() => {
3570
+ if (pending.current > 0) confirmation?.reject();
3571
+ }, [confirmation]);
3572
+ return { track, declineOnClose };
3573
+ }
3559
3574
  function assetKey2(record) {
3560
3575
  return record.code + (record.issuer ?? "");
3561
3576
  }
@@ -3665,12 +3680,14 @@ var KYC_COPY = {
3665
3680
  en: {
3666
3681
  errors: {
3667
3682
  SDK_KYC_NOT_CONFIGURED: "Identity verification is not available for this app yet.",
3683
+ // The vendor's account ran out of credits: the operator tops it up, the app's setup is fine.
3684
+ "SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "Identity verification is temporarily unavailable. Please try again later.",
3668
3685
  SDK_KYC_PROVIDER_ERROR: "The verification service is not responding right now. Please try again in a moment.",
3669
3686
  SDK_KYC_SESSION_EXPIRED: "Your previous verification session expired. Select the provider to start a new one.",
3670
3687
  SDK_KYC_PROVIDER_NOT_FOUND: "This verification option is no longer available. Refresh to see the current options.",
3671
3688
  SDK_KYC_PROVIDER_NOT_ENABLED: "This verification option is no longer available. Refresh to see the current options.",
3672
3689
  SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "This route is not set up for identity verification yet.",
3673
- VALIDATION_ERROR: "This verification option is not available for your country."
3690
+ VALIDATION_ERROR: "This verification option could not be started. Please try again or choose another option."
3674
3691
  },
3675
3692
  loadFailed: "Could not load verification options. Please refresh to try again.",
3676
3693
  startFailed: "Could not start verification. Please try again.",
@@ -3730,12 +3747,13 @@ var KYC_COPY = {
3730
3747
  es: {
3731
3748
  errors: {
3732
3749
  SDK_KYC_NOT_CONFIGURED: "La verificaci\xF3n de identidad todav\xEDa no est\xE1 disponible para esta app.",
3750
+ "SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "La verificaci\xF3n de identidad no est\xE1 disponible temporalmente. Intenta de nuevo m\xE1s tarde.",
3733
3751
  SDK_KYC_PROVIDER_ERROR: "El servicio de verificaci\xF3n no responde en este momento. Intenta de nuevo en un momento.",
3734
3752
  SDK_KYC_SESSION_EXPIRED: "Tu sesi\xF3n de verificaci\xF3n anterior venci\xF3. Elige el proveedor para iniciar una nueva.",
3735
3753
  SDK_KYC_PROVIDER_NOT_FOUND: "Esta opci\xF3n de verificaci\xF3n ya no est\xE1 disponible. Actualiza para ver las opciones actuales.",
3736
3754
  SDK_KYC_PROVIDER_NOT_ENABLED: "Esta opci\xF3n de verificaci\xF3n ya no est\xE1 disponible. Actualiza para ver las opciones actuales.",
3737
3755
  SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "Esta ruta todav\xEDa no est\xE1 configurada para la verificaci\xF3n de identidad.",
3738
- VALIDATION_ERROR: "Esta opci\xF3n de verificaci\xF3n no est\xE1 disponible para tu pa\xEDs."
3756
+ VALIDATION_ERROR: "No se pudo iniciar esta opci\xF3n de verificaci\xF3n. Intenta de nuevo o elige otra opci\xF3n."
3739
3757
  },
3740
3758
  loadFailed: "No se pudieron cargar las opciones de verificaci\xF3n. Actualiza para intentar de nuevo.",
3741
3759
  startFailed: "No se pudo iniciar la verificaci\xF3n. Intenta de nuevo.",
@@ -3795,12 +3813,13 @@ var KYC_COPY = {
3795
3813
  pt: {
3796
3814
  errors: {
3797
3815
  SDK_KYC_NOT_CONFIGURED: "A verifica\xE7\xE3o de identidade ainda n\xE3o est\xE1 dispon\xEDvel para este app.",
3816
+ "SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "A verifica\xE7\xE3o de identidade est\xE1 temporariamente indispon\xEDvel. Tente de novo mais tarde.",
3798
3817
  SDK_KYC_PROVIDER_ERROR: "O servi\xE7o de verifica\xE7\xE3o n\xE3o est\xE1 respondendo agora. Tente de novo em instantes.",
3799
3818
  SDK_KYC_SESSION_EXPIRED: "Sua sess\xE3o de verifica\xE7\xE3o anterior expirou. Escolha o provedor para iniciar uma nova.",
3800
3819
  SDK_KYC_PROVIDER_NOT_FOUND: "Esta op\xE7\xE3o de verifica\xE7\xE3o n\xE3o est\xE1 mais dispon\xEDvel. Atualize para ver as op\xE7\xF5es atuais.",
3801
3820
  SDK_KYC_PROVIDER_NOT_ENABLED: "Esta op\xE7\xE3o de verifica\xE7\xE3o n\xE3o est\xE1 mais dispon\xEDvel. Atualize para ver as op\xE7\xF5es atuais.",
3802
3821
  SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "Esta rota ainda n\xE3o est\xE1 configurada para a verifica\xE7\xE3o de identidade.",
3803
- VALIDATION_ERROR: "Esta op\xE7\xE3o de verifica\xE7\xE3o n\xE3o est\xE1 dispon\xEDvel para o seu pa\xEDs."
3822
+ VALIDATION_ERROR: "N\xE3o foi poss\xEDvel iniciar esta op\xE7\xE3o de verifica\xE7\xE3o. Tente de novo ou escolha outra op\xE7\xE3o."
3804
3823
  },
3805
3824
  loadFailed: "N\xE3o foi poss\xEDvel carregar as op\xE7\xF5es de verifica\xE7\xE3o. Atualize para tentar de novo.",
3806
3825
  startFailed: "N\xE3o foi poss\xEDvel iniciar a verifica\xE7\xE3o. Tente de novo.",
@@ -3881,12 +3900,11 @@ function KycStatus({ status, label, className, language: languageProp }) {
3881
3900
  }
3882
3901
  );
3883
3902
  }
3884
-
3885
- // src/components/kyc-modal/kyc-messages.ts
3886
3903
  function kycErrorMessage(error, phase, language = "en") {
3887
3904
  const copy = KYC_COPY[language];
3888
3905
  const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
3889
- const known = typeof code === "string" ? copy.errors[code] : void 0;
3906
+ const reason = core.isPollarApiError(error) && typeof error.body.reason === "string" ? error.body.reason : void 0;
3907
+ const known = typeof code === "string" ? reason && copy.errors[`${code}:${reason}`] || copy.errors[code] : void 0;
3890
3908
  if (known) return known;
3891
3909
  return phase === "load" ? copy.loadFailed : copy.startFailed;
3892
3910
  }
@@ -4887,6 +4905,22 @@ function WalletAdapterButtons({
4887
4905
  a.id
4888
4906
  )) });
4889
4907
  }
4908
+ function CloseButton({ onClick, label }) {
4909
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick, "aria-label": label, children: /* @__PURE__ */ jsxRuntime.jsx(
4910
+ "svg",
4911
+ {
4912
+ width: "18",
4913
+ height: "18",
4914
+ viewBox: "0 0 24 24",
4915
+ fill: "none",
4916
+ stroke: "currentColor",
4917
+ strokeWidth: "2.5",
4918
+ strokeLinecap: "round",
4919
+ strokeLinejoin: "round",
4920
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
4921
+ }
4922
+ ) });
4923
+ }
4890
4924
  function authStateToStatus(step) {
4891
4925
  const loading = [
4892
4926
  "creating_session",
@@ -4931,7 +4965,8 @@ function LoginModalTemplate({
4931
4965
  onBack,
4932
4966
  onCancel,
4933
4967
  onRetry,
4934
- language: languageProp
4968
+ language: languageProp,
4969
+ inline = false
4935
4970
  }) {
4936
4971
  const language = useInheritedLanguage(languageProp);
4937
4972
  const copy = LOGIN_COPY[language];
@@ -4967,160 +5002,155 @@ function LoginModalTemplate({
4967
5002
  children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 19l-7-7 7-7" })
4968
5003
  }
4969
5004
  ) });
4970
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
4971
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": copy.close, children: /* @__PURE__ */ jsxRuntime.jsx(
4972
- "svg",
4973
- {
4974
- width: "18",
4975
- height: "18",
4976
- viewBox: "0 0 24 24",
4977
- fill: "none",
4978
- stroke: "currentColor",
4979
- strokeWidth: "2.5",
4980
- strokeLinecap: "round",
4981
- strokeLinejoin: "round",
4982
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
4983
- }
4984
- ) }),
4985
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
4986
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
4987
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
4988
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
4989
- ] }),
4990
- awaitingEmailCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4991
- /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
4992
- /* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
4993
- }), language }, codeInputKey)
4994
- ] }) : activeGroup ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4995
- /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setActiveGroup(null) }),
4996
- /* @__PURE__ */ jsxRuntime.jsx(
4997
- WalletAdapterButtons,
4998
- {
4999
- walletAdapters: activeGroupAdapters,
5000
- onConnect: onWalletConnect ?? (() => {
5001
- }),
5002
- isLoading
5003
- }
5004
- )
5005
- ] }) : showPasskeyChooser ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5006
- /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
5007
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
5008
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: copy.createNewWallet }),
5009
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: copy.loginExistingWallet })
5010
- ] })
5011
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5012
- emailEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
5013
- /* @__PURE__ */ jsxRuntime.jsx(
5014
- "input",
5015
- {
5016
- type: "email",
5017
- placeholder: copy.emailPlaceholder,
5018
- value: email,
5019
- disabled: isLoading,
5020
- className: "pollar-input",
5021
- onChange: (e) => onEmailChange?.(e.target.value),
5022
- onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
5023
- }
5024
- ),
5025
- /* @__PURE__ */ jsxRuntime.jsx(
5026
- "button",
5027
- {
5028
- type: "button",
5029
- disabled: isLoading || !email,
5030
- className: "pollar-btn-primary",
5031
- style: { marginTop: "0.75rem" },
5032
- onClick: onEmailSubmit,
5033
- children: copy.submit
5034
- }
5035
- )
5036
- ] }),
5037
- emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
5038
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
5039
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5040
- ] }),
5041
- enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
5042
- enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
5043
- enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
5044
- ] }),
5045
- (embeddedWallets || smartWallet) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
5046
- embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5047
- walletGroups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs(
5048
- "button",
5049
- {
5050
- type: "button",
5051
- disabled: isLoading,
5052
- className: "pollar-wallet-entry-btn",
5053
- onClick: () => setActiveGroup(g.label),
5054
- children: [
5055
- /* @__PURE__ */ jsxRuntime.jsx(
5056
- "svg",
5057
- {
5058
- width: "18",
5059
- height: "20",
5060
- viewBox: "0 0 24 24",
5061
- fill: "none",
5062
- stroke: "currentColor",
5063
- strokeWidth: "2",
5064
- strokeLinecap: "round",
5065
- strokeLinejoin: "round",
5066
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" })
5067
- }
5068
- ),
5069
- g.label
5070
- ]
5071
- },
5072
- g.label
5073
- )),
5074
- rootAdapters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
5005
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5006
+ "div",
5007
+ {
5008
+ className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
5009
+ style: cssVars,
5010
+ onClick: (e) => e.stopPropagation(),
5011
+ children: [
5012
+ !inline && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onCancel, label: copy.close }),
5013
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
5014
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
5015
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
5016
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
5017
+ ] }),
5018
+ awaitingEmailCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5019
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
5020
+ /* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
5021
+ }), language }, codeInputKey)
5022
+ ] }) : activeGroup ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5023
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setActiveGroup(null) }),
5024
+ /* @__PURE__ */ jsxRuntime.jsx(
5075
5025
  WalletAdapterButtons,
5076
5026
  {
5077
- walletAdapters: rootAdapters,
5027
+ walletAdapters: activeGroupAdapters,
5078
5028
  onConnect: onWalletConnect ?? (() => {
5079
5029
  }),
5080
- isLoading,
5081
- variant: "entry"
5030
+ isLoading
5082
5031
  }
5083
5032
  )
5084
- ] }),
5085
- smartWallet && /* @__PURE__ */ jsxRuntime.jsxs(
5086
- "button",
5087
- {
5088
- type: "button",
5089
- disabled: isLoading,
5090
- className: "pollar-wallet-entry-btn",
5091
- onClick: () => setShowPasskeyChooser(true),
5092
- children: [
5093
- /* @__PURE__ */ jsxRuntime.jsx(
5094
- "svg",
5033
+ ] }) : showPasskeyChooser ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5034
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
5035
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
5036
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: copy.createNewWallet }),
5037
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: copy.loginExistingWallet })
5038
+ ] })
5039
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5040
+ emailEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
5041
+ /* @__PURE__ */ jsxRuntime.jsx(
5042
+ "input",
5043
+ {
5044
+ type: "email",
5045
+ placeholder: copy.emailPlaceholder,
5046
+ value: email,
5047
+ disabled: isLoading,
5048
+ className: "pollar-input",
5049
+ onChange: (e) => onEmailChange?.(e.target.value),
5050
+ onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
5051
+ }
5052
+ ),
5053
+ /* @__PURE__ */ jsxRuntime.jsx(
5054
+ "button",
5055
+ {
5056
+ type: "button",
5057
+ disabled: isLoading || !email,
5058
+ className: "pollar-btn-primary",
5059
+ style: { marginTop: "0.75rem" },
5060
+ onClick: onEmailSubmit,
5061
+ children: copy.submit
5062
+ }
5063
+ )
5064
+ ] }),
5065
+ emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
5066
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
5067
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5068
+ ] }),
5069
+ enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
5070
+ enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
5071
+ enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
5072
+ ] }),
5073
+ (embeddedWallets || smartWallet) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
5074
+ embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5075
+ walletGroups.map((g) => /* @__PURE__ */ jsxRuntime.jsxs(
5076
+ "button",
5095
5077
  {
5096
- width: "18",
5097
- height: "20",
5098
- viewBox: "0 0 24 24",
5099
- fill: "none",
5100
- stroke: "currentColor",
5101
- strokeWidth: "2",
5102
- strokeLinecap: "round",
5103
- strokeLinejoin: "round",
5104
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 8V6a4 4 0 00-8 0v2M5 8h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V9a1 1 0 011-1zm7 5v2" })
5078
+ type: "button",
5079
+ disabled: isLoading,
5080
+ className: "pollar-wallet-entry-btn",
5081
+ onClick: () => setActiveGroup(g.label),
5082
+ children: [
5083
+ /* @__PURE__ */ jsxRuntime.jsx(
5084
+ "svg",
5085
+ {
5086
+ width: "18",
5087
+ height: "20",
5088
+ viewBox: "0 0 24 24",
5089
+ fill: "none",
5090
+ stroke: "currentColor",
5091
+ strokeWidth: "2",
5092
+ strokeLinecap: "round",
5093
+ strokeLinejoin: "round",
5094
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" })
5095
+ }
5096
+ ),
5097
+ g.label
5098
+ ]
5099
+ },
5100
+ g.label
5101
+ )),
5102
+ rootAdapters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
5103
+ WalletAdapterButtons,
5104
+ {
5105
+ walletAdapters: rootAdapters,
5106
+ onConnect: onWalletConnect ?? (() => {
5107
+ }),
5108
+ isLoading,
5109
+ variant: "entry"
5105
5110
  }
5106
- ),
5107
- "Smart Wallet"
5108
- ]
5111
+ )
5112
+ ] }),
5113
+ smartWallet && /* @__PURE__ */ jsxRuntime.jsxs(
5114
+ "button",
5115
+ {
5116
+ type: "button",
5117
+ disabled: isLoading,
5118
+ className: "pollar-wallet-entry-btn",
5119
+ onClick: () => setShowPasskeyChooser(true),
5120
+ children: [
5121
+ /* @__PURE__ */ jsxRuntime.jsx(
5122
+ "svg",
5123
+ {
5124
+ width: "18",
5125
+ height: "20",
5126
+ viewBox: "0 0 24 24",
5127
+ fill: "none",
5128
+ stroke: "currentColor",
5129
+ strokeWidth: "2",
5130
+ strokeLinecap: "round",
5131
+ strokeLinejoin: "round",
5132
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 8V6a4 4 0 00-8 0v2M5 8h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V9a1 1 0 011-1zm7 5v2" })
5133
+ }
5134
+ ),
5135
+ "Smart Wallet"
5136
+ ]
5137
+ }
5138
+ )
5139
+ ] })
5140
+ ] }),
5141
+ /* @__PURE__ */ jsxRuntime.jsx(
5142
+ ModalStatusBanner,
5143
+ {
5144
+ message: statusMessage,
5145
+ status,
5146
+ onCancel,
5147
+ onRetry: isEmailCodeError ? void 0 : onRetry
5109
5148
  }
5110
- )
5111
- ] })
5112
- ] }),
5113
- /* @__PURE__ */ jsxRuntime.jsx(
5114
- ModalStatusBanner,
5115
- {
5116
- message: statusMessage,
5117
- status,
5118
- onCancel,
5119
- onRetry: isEmailCodeError ? void 0 : onRetry
5120
- }
5121
- ),
5122
- /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5123
- ] });
5149
+ ),
5150
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5151
+ ]
5152
+ }
5153
+ );
5124
5154
  }
5125
5155
  function LoginModalStatus({
5126
5156
  status,
@@ -5131,40 +5161,36 @@ function LoginModalStatus({
5131
5161
  appName,
5132
5162
  onRetry,
5133
5163
  onCancel,
5134
- language: languageProp
5164
+ language: languageProp,
5165
+ inline = false
5135
5166
  }) {
5136
5167
  const language = useInheritedLanguage(languageProp);
5137
5168
  const copy = LOGIN_COPY[language];
5138
5169
  const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
5139
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
5140
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": copy.close, children: /* @__PURE__ */ jsxRuntime.jsx(
5141
- "svg",
5142
- {
5143
- width: "18",
5144
- height: "18",
5145
- viewBox: "0 0 24 24",
5146
- fill: "none",
5147
- stroke: "currentColor",
5148
- strokeWidth: "2.5",
5149
- strokeLinecap: "round",
5150
- strokeLinejoin: "round",
5151
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
5152
- }
5153
- ) }),
5154
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
5155
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
5156
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
5157
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
5158
- ] }),
5159
- status === "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5160
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5161
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: copy.loading })
5162
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
5163
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-modal-error", children: copy.loadError }),
5164
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: copy.tryAgain })
5165
- ] }),
5166
- /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5167
- ] });
5170
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5171
+ "div",
5172
+ {
5173
+ className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
5174
+ style: cssVars,
5175
+ onClick: (e) => e.stopPropagation(),
5176
+ children: [
5177
+ !inline && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onCancel, label: copy.close }),
5178
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
5179
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
5180
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
5181
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
5182
+ ] }),
5183
+ status === "loading" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
5184
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
5185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: copy.loading })
5186
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
5187
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-modal-error", children: copy.loadError }),
5188
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: copy.tryAgain })
5189
+ ] }),
5190
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5191
+ ]
5192
+ }
5193
+ );
5168
5194
  }
5169
5195
  function PrivyLoginSubmodal({
5170
5196
  adapter,
@@ -5176,7 +5202,8 @@ function PrivyLoginSubmodal({
5176
5202
  onBack,
5177
5203
  onCancel,
5178
5204
  onAuthenticated,
5179
- language
5205
+ language,
5206
+ inline = false
5180
5207
  }) {
5181
5208
  const copy = LOGIN_COPY[language];
5182
5209
  const options = react.useMemo(() => adapter.getAuthOptions(), [adapter]);
@@ -5240,70 +5267,65 @@ function PrivyLoginSubmodal({
5240
5267
  const showEmail = options.includes("email");
5241
5268
  const showGoogle = options.includes("google");
5242
5269
  const showGithub = options.includes("github");
5243
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
5244
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": copy.close, children: /* @__PURE__ */ jsxRuntime.jsx(
5245
- "svg",
5246
- {
5247
- width: "18",
5248
- height: "18",
5249
- viewBox: "0 0 24 24",
5250
- fill: "none",
5251
- stroke: "currentColor",
5252
- strokeWidth: "2.5",
5253
- strokeLinecap: "round",
5254
- strokeLinejoin: "round",
5255
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
5256
- }
5257
- ) }),
5258
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
5259
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
5260
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
5261
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: adapter.meta.label })
5262
- ] }),
5263
- view === "email-code" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5264
- /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setView("root") }),
5265
- /* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: handleCodeSubmit, language })
5266
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5267
- /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
5268
- showEmail && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
5269
- /* @__PURE__ */ jsxRuntime.jsx(
5270
- "input",
5271
- {
5272
- type: "email",
5273
- placeholder: copy.emailPlaceholder,
5274
- value: email,
5275
- disabled: isLoading,
5276
- className: "pollar-input",
5277
- onChange: (e) => setEmail(e.target.value),
5278
- onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
5279
- }
5280
- ),
5281
- /* @__PURE__ */ jsxRuntime.jsx(
5282
- "button",
5283
- {
5284
- type: "button",
5285
- disabled: isLoading || !email,
5286
- className: "pollar-btn-primary",
5287
- style: { marginTop: "0.75rem" },
5288
- onClick: handleEmailSubmit,
5289
- children: copy.submit
5290
- }
5291
- )
5292
- ] }),
5293
- showEmail && (showGoogle || showGithub) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
5294
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
5295
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5296
- ] }),
5297
- (showGoogle || showGithub) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
5298
- showGoogle && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => handleOAuth("google") }),
5299
- showGithub && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => handleOAuth("github") })
5300
- ] })
5301
- ] }),
5302
- /* @__PURE__ */ jsxRuntime.jsx(ModalStatusBanner, { message, status, onCancel, onRetry: void 0 }),
5303
- /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5304
- ] });
5270
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5271
+ "div",
5272
+ {
5273
+ className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
5274
+ style: cssVars,
5275
+ onClick: (e) => e.stopPropagation(),
5276
+ children: [
5277
+ !inline && /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onCancel, label: copy.close }),
5278
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
5279
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
5280
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
5281
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: adapter.meta.label })
5282
+ ] }),
5283
+ view === "email-code" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5284
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setView("root") }),
5285
+ /* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: handleCodeSubmit, language })
5286
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5287
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
5288
+ showEmail && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
5289
+ /* @__PURE__ */ jsxRuntime.jsx(
5290
+ "input",
5291
+ {
5292
+ type: "email",
5293
+ placeholder: copy.emailPlaceholder,
5294
+ value: email,
5295
+ disabled: isLoading,
5296
+ className: "pollar-input",
5297
+ onChange: (e) => setEmail(e.target.value),
5298
+ onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
5299
+ }
5300
+ ),
5301
+ /* @__PURE__ */ jsxRuntime.jsx(
5302
+ "button",
5303
+ {
5304
+ type: "button",
5305
+ disabled: isLoading || !email,
5306
+ className: "pollar-btn-primary",
5307
+ style: { marginTop: "0.75rem" },
5308
+ onClick: handleEmailSubmit,
5309
+ children: copy.submit
5310
+ }
5311
+ )
5312
+ ] }),
5313
+ showEmail && (showGoogle || showGithub) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
5314
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
5315
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5316
+ ] }),
5317
+ (showGoogle || showGithub) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-social-list", children: [
5318
+ showGoogle && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => handleOAuth("google") }),
5319
+ showGithub && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => handleOAuth("github") })
5320
+ ] })
5321
+ ] }),
5322
+ /* @__PURE__ */ jsxRuntime.jsx(ModalStatusBanner, { message, status, onCancel, onRetry: void 0 }),
5323
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
5324
+ ]
5325
+ }
5326
+ );
5305
5327
  }
5306
- function LoginModal({ onClose }) {
5328
+ function LoginModal({ onClose, inline = false }) {
5307
5329
  const [email, setEmail] = react.useState("");
5308
5330
  const { getClient, styles, appConfig: config, configStatus, retryConfig } = usePollar();
5309
5331
  const [authState, setAuthState] = react.useState(() => getClient().getAuthState());
@@ -5398,7 +5420,7 @@ function LoginModal({ onClose }) {
5398
5420
  getClient().login({ provider });
5399
5421
  }
5400
5422
  }
5401
- return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: handleClose, children: configStatus !== "ready" ? /* @__PURE__ */ jsxRuntime.jsx(
5423
+ return /* @__PURE__ */ jsxRuntime.jsx(ModalFrame, { inline, overlayStyle, onClose: handleClose, children: configStatus !== "ready" ? /* @__PURE__ */ jsxRuntime.jsx(
5402
5424
  LoginModalStatus,
5403
5425
  {
5404
5426
  status: configStatus === "error" ? "error" : "loading",
@@ -5409,7 +5431,8 @@ function LoginModal({ onClose }) {
5409
5431
  appName: modalTitle,
5410
5432
  onRetry: retryConfig,
5411
5433
  onCancel: handleClose,
5412
- language
5434
+ language,
5435
+ inline
5413
5436
  }
5414
5437
  ) : interactiveAdapter ? /* @__PURE__ */ jsxRuntime.jsx(
5415
5438
  PrivyLoginSubmodal,
@@ -5423,7 +5446,8 @@ function LoginModal({ onClose }) {
5423
5446
  onBack: () => setInteractiveAdapter(null),
5424
5447
  onCancel: handleClose,
5425
5448
  onAuthenticated: handleInteractiveAuthenticated,
5426
- language
5449
+ language,
5450
+ inline
5427
5451
  }
5428
5452
  ) : /* @__PURE__ */ jsxRuntime.jsx(
5429
5453
  LoginModalTemplate,
@@ -5457,7 +5481,8 @@ function LoginModal({ onClose }) {
5457
5481
  onBack: handleBack,
5458
5482
  onCancel: handleClose,
5459
5483
  onRetry: handleRetry,
5460
- language
5484
+ language,
5485
+ inline
5461
5486
  }
5462
5487
  ) });
5463
5488
  }
@@ -5605,6 +5630,21 @@ var RAMP_COPY = {
5605
5630
  startAnother: "Start another operation",
5606
5631
  newQuote: "Get a new quote",
5607
5632
  keepsGoing: "This one keeps going; you can resume it later.",
5633
+ screens: {
5634
+ pay: (amount, currency) => `Pay ${amount} ${currency}`,
5635
+ send: (amount, code) => `Send ${amount} ${code}`,
5636
+ delivering: (code) => `Your ${code} is on its way`,
5637
+ payingOut: (currency) => `Your ${currency} is on its way to your account`,
5638
+ done: "Done",
5639
+ toCurrent: "Go to the current step",
5640
+ updatesItself: "This screen updates on its own.",
5641
+ preparing: "Preparing your payment\u2026",
5642
+ received: (amount) => `+${amount}`,
5643
+ arrived: (chain) => `It reached your wallet on ${chain}.`,
5644
+ paidOut: "It was sent to your account.",
5645
+ finish: "Done",
5646
+ details: "Details"
5647
+ },
5608
5648
  somethingWrong: "Something went wrong.",
5609
5649
  routeSteps: (count) => count === 1 ? "1 step" : `${count} steps`,
5610
5650
  feesIncluded: "fees included",
@@ -5736,6 +5776,21 @@ var RAMP_COPY = {
5736
5776
  startAnother: "Iniciar otra operaci\xF3n",
5737
5777
  newQuote: "Pedir nueva cotizaci\xF3n",
5738
5778
  keepsGoing: "Esta sigue en curso; puedes retomarla m\xE1s tarde.",
5779
+ screens: {
5780
+ pay: (amount, currency) => `Paga ${amount} ${currency}`,
5781
+ send: (amount, code) => `Env\xEDa ${amount} ${code}`,
5782
+ delivering: (code) => `Tu ${code} est\xE1 en camino`,
5783
+ payingOut: (currency) => `Tus ${currency} van en camino a tu cuenta`,
5784
+ done: "Hecho",
5785
+ toCurrent: "Ir al paso actual",
5786
+ updatesItself: "Esta pantalla se actualiza sola.",
5787
+ preparing: "Preparando tu pago\u2026",
5788
+ received: (amount) => `+${amount}`,
5789
+ arrived: (chain) => `Lleg\xF3 a tu wallet en ${chain}.`,
5790
+ paidOut: "Se envi\xF3 a tu cuenta.",
5791
+ finish: "Listo",
5792
+ details: "Detalles"
5793
+ },
5739
5794
  somethingWrong: "Algo sali\xF3 mal.",
5740
5795
  routeSteps: (count) => count === 1 ? "1 paso" : `${count} pasos`,
5741
5796
  feesIncluded: "comisiones incluidas",
@@ -5867,6 +5922,21 @@ var RAMP_COPY = {
5867
5922
  startAnother: "Iniciar outra opera\xE7\xE3o",
5868
5923
  newQuote: "Pedir nova cota\xE7\xE3o",
5869
5924
  keepsGoing: "Esta continua em andamento; voc\xEA pode retom\xE1-la depois.",
5925
+ screens: {
5926
+ pay: (amount, currency) => `Pague ${amount} ${currency}`,
5927
+ send: (amount, code) => `Envie ${amount} ${code}`,
5928
+ delivering: (code) => `Seu ${code} est\xE1 a caminho`,
5929
+ payingOut: (currency) => `Seus ${currency} est\xE3o a caminho da sua conta`,
5930
+ done: "Conclu\xEDdo",
5931
+ toCurrent: "Ir para a etapa atual",
5932
+ updatesItself: "Esta tela se atualiza sozinha.",
5933
+ preparing: "Preparando o seu pagamento\u2026",
5934
+ received: (amount) => `+${amount}`,
5935
+ arrived: (chain) => `Chegou \xE0 sua carteira na ${chain}.`,
5936
+ paidOut: "Foi enviado para a sua conta.",
5937
+ finish: "Pronto",
5938
+ details: "Detalhes"
5939
+ },
5870
5940
  somethingWrong: "Algo deu errado.",
5871
5941
  routeSteps: (count) => count === 1 ? "1 etapa" : `${count} etapas`,
5872
5942
  feesIncluded: "taxas inclu\xEDdas",
@@ -6015,6 +6085,93 @@ function routeKey(quote) {
6015
6085
  const node = (n) => n.kind === "asset" ? `${n.code}:${n.chain}` : `${n.currency}:${n.rail}`;
6016
6086
  return quote.legs.map((leg) => `${leg.kind}:${node(leg.from)}>${node(leg.to)}`).join("|");
6017
6087
  }
6088
+ var amountText = (value, language) => {
6089
+ const n = Number(value);
6090
+ return Number.isFinite(n) ? n.toLocaleString(language, { maximumFractionDigits: 7 }) : value;
6091
+ };
6092
+ function rampOrderScreens(order, language) {
6093
+ const copy = RAMP_COPY[language].screens;
6094
+ const parts = [];
6095
+ const waitsOn = (leg) => order.pendingAction?.legIndex === leg.index && order.pendingAction.kind !== "NONE";
6096
+ for (const leg of order.legs) {
6097
+ const legStatus = core.rampLegStatus(leg);
6098
+ const legDone = legStatus === "done";
6099
+ if (leg.steps?.length) {
6100
+ let running = [];
6101
+ const flush = () => {
6102
+ if (!running.length) return;
6103
+ parts.push({
6104
+ key: `${leg.index}:${running[0].kind}`,
6105
+ kind: "wait",
6106
+ leg,
6107
+ steps: running,
6108
+ title: core.rampLegTitle(leg, language),
6109
+ done: legDone || running.every((s) => s.status === "done")
6110
+ });
6111
+ running = [];
6112
+ };
6113
+ for (const step of leg.steps) {
6114
+ if (!step.signs) {
6115
+ running.push(step);
6116
+ continue;
6117
+ }
6118
+ flush();
6119
+ parts.push({
6120
+ key: `${leg.index}:${step.kind}`,
6121
+ kind: "action",
6122
+ leg,
6123
+ steps: [step],
6124
+ title: core.rampStepTitle(step, leg, language),
6125
+ done: legDone || step.status === "done"
6126
+ });
6127
+ }
6128
+ flush();
6129
+ continue;
6130
+ }
6131
+ if (leg.kind === "PROVIDER_ONRAMP" || leg.kind === "PROVIDER_OFFRAMP") {
6132
+ const onramp = leg.kind === "PROVIDER_ONRAMP";
6133
+ const unitIn = leg.from.kind === "fiat" ? leg.from.currency : leg.from.code;
6134
+ const unitOut = leg.to.kind === "fiat" ? leg.to.currency : leg.to.code;
6135
+ const payment = leg.paymentStatus;
6136
+ const paid = payment === void 0 ? legStatus === "active" && !waitsOn(leg) : payment === "received";
6137
+ const amount = amountText(leg.amountInPlanned, language);
6138
+ parts.push({
6139
+ key: `${leg.index}:pay`,
6140
+ kind: "action",
6141
+ leg,
6142
+ steps: [],
6143
+ title: onramp ? copy.pay(amount, unitIn) : copy.send(amount, unitIn),
6144
+ done: legDone || paid,
6145
+ preparing: payment === "not_requested" && !waitsOn(leg)
6146
+ });
6147
+ parts.push({
6148
+ key: `${leg.index}:deliver`,
6149
+ kind: "wait",
6150
+ leg,
6151
+ steps: [],
6152
+ title: onramp ? copy.delivering(unitOut) : copy.payingOut(unitOut),
6153
+ done: legDone
6154
+ });
6155
+ continue;
6156
+ }
6157
+ parts.push({
6158
+ key: `${leg.index}`,
6159
+ kind: leg.signingMode ? "action" : "wait",
6160
+ leg,
6161
+ steps: [],
6162
+ title: core.rampLegTitle(leg, language),
6163
+ done: legDone
6164
+ });
6165
+ }
6166
+ const stopped = ["failed", "refunded"].includes(order.state);
6167
+ let currentFound = false;
6168
+ return parts.map(({ done, ...screen }) => {
6169
+ if (done) return { ...screen, status: "done" };
6170
+ if (currentFound) return { ...screen, status: "upcoming" };
6171
+ currentFound = true;
6172
+ return { ...screen, status: stopped || core.rampLegStatus(screen.leg) === "failed" ? "failed" : "current" };
6173
+ });
6174
+ }
6018
6175
  function scannableImageSrc(image) {
6019
6176
  return image.encoding === "base64" ? `data:${image.mediaType};base64,${image.data}` : `data:${image.mediaType};charset=utf-8,${encodeURIComponent(image.data)}`;
6020
6177
  }
@@ -6154,6 +6311,8 @@ function RampWidgetTemplate({
6154
6311
  const onramp = direction === "ONRAMP";
6155
6312
  const sendUnit = onramp ? fiat?.currency : asset?.code;
6156
6313
  const [detailsOpen, setDetailsOpen] = react.useState(false);
6314
+ const [viewing, setViewing] = react.useState(null);
6315
+ react.useEffect(() => setViewing(null), [order?.id]);
6157
6316
  const routeName = (quote) => quote.legs.map((leg) => core.rampLegTitle(leg, language)).join(" \xB7 ");
6158
6317
  const rate = (() => {
6159
6318
  if (!chosenQuote) return null;
@@ -6225,7 +6384,6 @@ function RampWidgetTemplate({
6225
6384
  ] : [];
6226
6385
  const running = order?.legs.find((leg) => core.rampLegStatus(leg) === "active" && order.pendingAction?.legIndex !== leg.index);
6227
6386
  const now = useNowEverySecond(step === "status" && !settled && !!running && running.etaSeconds !== null);
6228
- const nextApproval = order && !settled ? core.rampNextApproval(order, language) : null;
6229
6387
  const stopped = order ? core.rampOrderStopped(order) : false;
6230
6388
  const receive = order ? core.rampOrderReceive(order) : null;
6231
6389
  const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
@@ -6233,12 +6391,41 @@ function RampWidgetTemplate({
6233
6391
  const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
6234
6392
  useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
6235
6393
  const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
6394
+ const screens = order ? rampOrderScreens(order, language) : [];
6395
+ const completed = order?.state === "completed";
6396
+ const firstOpen = screens.findIndex((s) => s.status !== "done");
6397
+ const currentScreen = completed ? screens.length : firstOpen === -1 ? Math.max(0, screens.length - 1) : firstOpen;
6398
+ const shownScreen = viewing !== null && viewing < currentScreen ? viewing : currentScreen;
6399
+ const shown = screens[shownScreen];
6400
+ const askedInstead = order?.pendingAction?.kind === "KYC" || !!shown?.key.endsWith(":pay") && order?.pendingAction?.legIndex === shown.leg.index && !["FIAT_PAYMENT", "NONE"].includes(order.pendingAction.kind);
6401
+ const firstLeg = order?.legs[0];
6402
+ const orderSummary = firstLeg && receive ? `${amountText(firstLeg.amountInPlanned, language)} ${firstLeg.from.kind === "fiat" ? firstLeg.from.currency : firstLeg.from.code} \u2192 ${receive.estimated ? "~" : ""}${amountText(receive.amount, language)} ${receive.unit}` : null;
6403
+ const lastLeg = order?.legs[order.legs.length - 1];
6404
+ const arrivedText = lastLeg?.to.kind === "asset" ? copy.screens.arrived(CHAIN_NAME[lastLeg.to.chain] ?? lastLeg.to.chain) : copy.screens.paidOut;
6405
+ const finalNote = order?.legs.map((leg) => core.rampLegNote(leg, language)).find((note) => note !== null) ?? null;
6406
+ const screenRows = (screen) => screen.steps.length ? screen.steps.flatMap(
6407
+ (st) => st.hash ? [
6408
+ {
6409
+ label: core.rampStepTitle(st, screen.leg, language),
6410
+ value: shortHash(st.hash),
6411
+ href: explorerTxUrl2(stepChain(st.kind, screen.leg), st.hash, network),
6412
+ copyValue: st.hash
6413
+ }
6414
+ ] : []
6415
+ ) : screen.leg.onchainTxHash && !screen.key.endsWith(":pay") ? [
6416
+ {
6417
+ label: core.rampLegTitle(screen.leg, language),
6418
+ value: shortHash(screen.leg.onchainTxHash),
6419
+ href: explorerTxUrl2(legChain(screen.leg), screen.leg.onchainTxHash, network),
6420
+ copyValue: screen.leg.onchainTxHash
6421
+ }
6422
+ ] : [];
6236
6423
  const stepTitle = {
6237
6424
  input: onramp ? copy.title.buy : copy.title.sell,
6238
6425
  loading_quote: copy.title.finding,
6239
6426
  select_route: copy.title.chooseRoute,
6240
6427
  contact: copy.title.details,
6241
- status: order?.state === "completed" ? copy.title.completed : onramp ? copy.title.purchase : copy.title.sale,
6428
+ status: onramp ? copy.title.purchase : copy.title.sale,
6242
6429
  error: copy.title.error
6243
6430
  };
6244
6431
  const stepSubtitle = {
@@ -6251,7 +6438,7 @@ function RampWidgetTemplate({
6251
6438
  copy
6252
6439
  )
6253
6440
  ),
6254
- status: view?.title ?? copy.subtitle.processing,
6441
+ status: orderSummary ?? copy.subtitle.processing,
6255
6442
  error: copy.subtitle.error
6256
6443
  };
6257
6444
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
@@ -6266,6 +6453,16 @@ function RampWidgetTemplate({
6266
6453
  children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 3 5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
6267
6454
  }
6268
6455
  ),
6456
+ step === "status" && shownScreen > 0 && shownScreen <= currentScreen && /* @__PURE__ */ jsxRuntime.jsx(
6457
+ "button",
6458
+ {
6459
+ type: "button",
6460
+ className: "pollar-back-btn pollar-ramp-back",
6461
+ onClick: () => setViewing(shownScreen - 1),
6462
+ "aria-label": copy.back,
6463
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 3 5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
6464
+ }
6465
+ ),
6269
6466
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-header-text", children: [
6270
6467
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: stepTitle[step] }),
6271
6468
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
@@ -6322,6 +6519,15 @@ function RampWidgetTemplate({
6322
6519
  }
6323
6520
  ) }, label)) })
6324
6521
  ] }),
6522
+ step === "status" && screens.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-screens-bar", "aria-label": copy.progress, children: [...screens.map((s) => s.key), "final"].map((key, i) => /* @__PURE__ */ jsxRuntime.jsx(
6523
+ "li",
6524
+ {
6525
+ "data-done": i < currentScreen || completed && i === screens.length || void 0,
6526
+ "data-shown": i === shownScreen || void 0,
6527
+ "data-failed": screens[i]?.status === "failed" || void 0
6528
+ },
6529
+ key
6530
+ )) }),
6325
6531
  step === "input" && pendingOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "pollar-ramp-payment pollar-ramp-saved", "aria-label": copy.pendingAria, children: [
6326
6532
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.pendingNote }),
6327
6533
  pendingOrders.map((pending) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-saved-row", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -6609,37 +6815,62 @@ function RampWidgetTemplate({
6609
6815
  }
6610
6816
  ) })
6611
6817
  ] }),
6612
- step === "status" && order && view && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment", children: [
6613
- /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-legs", "aria-label": copy.progress, children: order.legs.map((leg) => {
6614
- const status = core.rampLegStatus(leg);
6615
- const note = (status === "failed" && leg.failure ? core.rampFailureReason(leg.failure, language) : null) ?? core.rampLegNote(leg, language);
6616
- return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pollar-ramp-leg", "data-status": status, children: [
6617
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-dot", "aria-hidden": true }),
6618
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-title", children: core.rampLegTitle(leg, language) }),
6619
- status === "active" && !settled && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": copy.inProgress }),
6620
- note && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-note", children: note }),
6621
- status === "active" && !settled && !!leg.steps?.length && /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-steps", children: leg.steps.map((s) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pollar-ramp-step", "data-status": s.status, children: [
6622
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-step-title", children: core.rampStepTitle(s, leg, language) }),
6623
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-step-state", children: [
6624
- s.status === "confirming" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
6625
- core.rampStepStatusText(s, language)
6626
- ] })
6627
- ] }, s.kind)) }),
6628
- running === leg && !settled && core.rampLegTimeLeft(leg, now) !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-eta", children: copy.timeLeft(core.rampLegTimeLeft(leg, now)) })
6629
- ] }, leg.index);
6630
- }) }),
6631
- confirmation && /* @__PURE__ */ jsxRuntime.jsx(InlineConfirm, { confirmation, language, network }),
6632
- /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: { title: "", kind: "other", rows: orderRows }, language }),
6633
- nextApproval && !order.pendingAction && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-next", children: copy.next(nextApproval) }),
6634
- receive && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
6635
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: order.state === "completed" ? copy.youReceived : copy.youReceive }),
6636
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
6637
- receive.estimated && "~",
6638
- receive.amount,
6639
- " ",
6640
- receive.unit
6641
- ] })
6818
+ step === "status" && order && view && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment", children: shownScreen === screens.length ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6819
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-final", children: [
6820
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-final-mark", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "28", height: "28", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
6821
+ "path",
6822
+ {
6823
+ d: "M3 8.5 6.5 12 13 4.5",
6824
+ stroke: "currentColor",
6825
+ strokeWidth: "2",
6826
+ strokeLinecap: "round",
6827
+ strokeLinejoin: "round"
6828
+ }
6829
+ ) }) }),
6830
+ receive && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-final-amount", children: copy.screens.received(`${amountText(receive.amount, language)} ${receive.unit}`) }),
6831
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: arrivedText }),
6832
+ finalNote && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: finalNote })
6642
6833
  ] }),
6834
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: copy.screens.finish }),
6835
+ /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: { title: "", kind: "other", rows: orderRows }, language })
6836
+ ] }) : shownScreen < currentScreen ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6837
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "pollar-ramp-screen-title", children: screens[shownScreen].title }),
6838
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-screen-state", children: [
6839
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(
6840
+ "path",
6841
+ {
6842
+ d: "M3 8.5 6.5 12 13 4.5",
6843
+ stroke: "currentColor",
6844
+ strokeWidth: "2",
6845
+ strokeLinecap: "round",
6846
+ strokeLinejoin: "round"
6847
+ }
6848
+ ) }),
6849
+ copy.screens.done
6850
+ ] }),
6851
+ screenRows(screens[shownScreen]).length > 0 && /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: { title: "", kind: "other", rows: screenRows(screens[shownScreen]) }, language }),
6852
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: () => setViewing(null), children: copy.screens.toCurrent })
6853
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6854
+ shown && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "pollar-ramp-screen-title", "data-status": shown.status, children: askedInstead ? view.title : shown.title }),
6855
+ shown?.status === "failed" && shown.leg.failure && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-field-error", children: core.rampFailureReason(shown.leg.failure, language) }),
6856
+ shown?.preparing && !settled && !order.failure && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-wait", children: [
6857
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner", "aria-label": copy.inProgress }),
6858
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.screens.preparing })
6859
+ ] }),
6860
+ shown?.kind === "wait" && !settled && !order.failure && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-wait", children: [
6861
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner", "aria-label": copy.inProgress }),
6862
+ core.rampLegTimeLeft(shown.leg, now) !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-eta", children: copy.timeLeft(core.rampLegTimeLeft(shown.leg, now)) }),
6863
+ core.rampLegNote(shown.leg, language) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: core.rampLegNote(shown.leg, language) }),
6864
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.screens.updatesItself })
6865
+ ] }),
6866
+ shown && shown.steps.length > 1 && !settled && /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-screen-steps", children: shown.steps.map((s) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pollar-ramp-step", "data-status": s.status, children: [
6867
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-step-title", children: core.rampStepTitle(s, shown.leg, language) }),
6868
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-step-state", children: [
6869
+ s.status === "confirming" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
6870
+ core.rampStepStatusText(s, language)
6871
+ ] })
6872
+ ] }, s.kind)) }),
6873
+ confirmation && /* @__PURE__ */ jsxRuntime.jsx(InlineConfirm, { confirmation, language, network }),
6643
6874
  order.failure && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
6644
6875
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: copy.whatToDo }),
6645
6876
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: core.rampOrderResolutionText(order, language) }),
@@ -6700,7 +6931,14 @@ function RampWidgetTemplate({
6700
6931
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: view.pasteCode.label }),
6701
6932
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6702
6933
  /* @__PURE__ */ jsxRuntime.jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children: view.pasteCode.value }),
6703
- /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: view.pasteCode.value, label: copy.copyLabel(view.pasteCode.label), language })
6934
+ /* @__PURE__ */ jsxRuntime.jsx(
6935
+ CopyButton,
6936
+ {
6937
+ value: view.pasteCode.value,
6938
+ label: copy.copyLabel(view.pasteCode.label),
6939
+ language
6940
+ }
6941
+ )
6704
6942
  ] }) })
6705
6943
  ] }),
6706
6944
  !settled && view.details.map((d) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
@@ -6732,11 +6970,8 @@ function RampWidgetTemplate({
6732
6970
  !settled && order.pendingAction?.kind === "KYC" && !view.link && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: view.note ?? copy.providerReviewing }),
6733
6971
  pollTrouble && !settled && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.serverTrouble }),
6734
6972
  errorMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-field-error", children: errorMsg }),
6735
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-explore", children: [
6736
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onNewOrder, children: copy.startAnother }),
6737
- !stopped && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.keepsGoing })
6738
- ] })
6739
- ] }),
6973
+ !settled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-explore", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onNewOrder, children: copy.startAnother }) })
6974
+ ] }) }),
6740
6975
  step === "error" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6741
6976
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: errorMsg ?? copy.somethingWrong }),
6742
6977
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
@@ -6790,6 +7025,7 @@ var REGISTRY_COPY = {
6790
7025
  rejected: "The registry did not confirm: {fields}. Check how they are written and try again.",
6791
7026
  loadError: "Could not load your details. Please try again.",
6792
7027
  submitError: "Could not check your details. Please try again.",
7028
+ registryDown: "The civil registry is not responding right now. Please try again in a few minutes.",
6793
7029
  step: "Step {n} of {total}"
6794
7030
  },
6795
7031
  es: {
@@ -6812,6 +7048,7 @@ var REGISTRY_COPY = {
6812
7048
  rejected: "El registro no confirm\xF3: {fields}. Revisa c\xF3mo est\xE1n escritos e intenta de nuevo.",
6813
7049
  loadError: "No se pudieron cargar tus datos. Intenta de nuevo.",
6814
7050
  submitError: "No se pudieron validar tus datos. Intenta de nuevo.",
7051
+ registryDown: "El registro civil no responde en este momento. Intenta de nuevo en unos minutos.",
6815
7052
  step: "Paso {n} de {total}"
6816
7053
  },
6817
7054
  pt: {
@@ -6834,6 +7071,7 @@ var REGISTRY_COPY = {
6834
7071
  rejected: "O registro n\xE3o confirmou: {fields}. Verifique como est\xE3o escritos e tente novamente.",
6835
7072
  loadError: "N\xE3o foi poss\xEDvel carregar seus dados. Tente novamente.",
6836
7073
  submitError: "N\xE3o foi poss\xEDvel validar seus dados. Tente novamente.",
7074
+ registryDown: "O registro civil n\xE3o est\xE1 respondendo agora. Tente novamente em alguns minutos.",
6837
7075
  step: "Passo {n} de {total}"
6838
7076
  }
6839
7077
  };
@@ -6996,6 +7234,10 @@ var errorBody = (error) => {
6996
7234
  const body = typeof error === "object" && error !== null && "body" in error ? error.body : void 0;
6997
7235
  return typeof body === "object" && body !== null ? body : void 0;
6998
7236
  };
7237
+ var isRegistryDown = (error) => {
7238
+ const body = errorBody(error);
7239
+ return errorCode(error) === "SDK_KYC_PROVIDER_ERROR" && !!body && "retryable" in body && body.retryable === true;
7240
+ };
6999
7241
  function missingFieldsOf(error) {
7000
7242
  const body = errorBody(error);
7001
7243
  const missing = body && "missing" in body ? body.missing : void 0;
@@ -7090,6 +7332,7 @@ function RegistryCheckModal({
7090
7332
  if (code === "KYC_REGISTRY_NAME_MISMATCH") {
7091
7333
  setError(copy.nameMismatch.replace("{full}", [prefill.surname1, prefill.surname2].filter(Boolean).join(" ")));
7092
7334
  } else if (code === "SDK_KYC_UNDER_REVIEW") setReview(true);
7335
+ else if (isRegistryDown(e)) setError(copy.registryDown);
7093
7336
  else setError(copy.submitError);
7094
7337
  } finally {
7095
7338
  if (mounted.current) setSubmitting(false);
@@ -7893,8 +8136,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
7893
8136
  const flowSteps = fields.length || quotes.some((q) => core.rampQuoteFields(q).length) ? [copy.steps.route, copy.steps.details, copy.steps.complete] : [copy.steps.route, copy.steps.complete];
7894
8137
  const stepLabel = {
7895
8138
  select_route: copy.steps.route,
7896
- contact: copy.steps.details,
7897
- status: copy.steps.complete
8139
+ contact: copy.steps.details
7898
8140
  };
7899
8141
  const label = stepLabel[step];
7900
8142
  if (verifying) {
@@ -8018,7 +8260,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
8018
8260
  onRequote: () => void handleRequote(),
8019
8261
  onSetUpRecovery: openRecoveryModal,
8020
8262
  recoveryMissing: recovery === null ? null : recoveryLocked,
8021
- support: client.getSupportContact(),
8263
+ support: core.rampSupportContact(client.getSupportContact(), appConfig.application?.support),
8022
8264
  pollTrouble,
8023
8265
  checkingPayment: paymentCheckUntil !== null,
8024
8266
  onCheckPayment: () => void handleCheckPayment(),
@@ -9215,6 +9457,7 @@ function SendModal({ onClose, initial }) {
9215
9457
  const copy = SEND_COPY[language];
9216
9458
  const [step, setStep] = react.useState("form");
9217
9459
  const confirmation = useInlineConfirmation(step === "tx");
9460
+ const { track, declineOnClose } = useDeclineOnClose(confirmation);
9218
9461
  const [createsAccount, setCreatesAccount] = react.useState(false);
9219
9462
  const [checkingDestination, setCheckingDestination] = react.useState(false);
9220
9463
  const [amount, setAmount] = react.useState(() => seededAmount(initial?.amount));
@@ -9346,14 +9589,16 @@ function SendModal({ onClose, initial }) {
9346
9589
  setCreatesAccount(false);
9347
9590
  setStep("tx");
9348
9591
  if (selectedChain === "SOLANA" || selectedChain === "POLYGON") {
9349
- await sendPayment({
9350
- chain: selectedChain,
9351
- destination: destination.trim(),
9352
- amount: sendAmount,
9353
- // A native coin carries no token id; an SPL mint or ERC-20 contract rides
9354
- // in `issuer`, which the guard above proved is present.
9355
- ...isNativeAsset ? {} : { mint: selectedAsset.issuer }
9356
- });
9592
+ await track(
9593
+ sendPayment({
9594
+ chain: selectedChain,
9595
+ destination: destination.trim(),
9596
+ amount: sendAmount,
9597
+ // A native coin carries no token id; an SPL mint or ERC-20 contract rides
9598
+ // in `issuer`, which the guard above proved is present.
9599
+ ...isNativeAsset ? {} : { mint: selectedAsset.issuer }
9600
+ })
9601
+ );
9357
9602
  return;
9358
9603
  }
9359
9604
  await buildTx(
@@ -9375,7 +9620,7 @@ function SendModal({ onClose, initial }) {
9375
9620
  }
9376
9621
  function handleSignAndSend() {
9377
9622
  if (transaction.step === "built") {
9378
- void signAndSubmitTx(transaction.buildData.unsignedXdr);
9623
+ void track(signAndSubmitTx(transaction.buildData.unsignedXdr));
9379
9624
  }
9380
9625
  }
9381
9626
  function handleMax() {
@@ -9422,16 +9667,20 @@ function SendModal({ onClose, initial }) {
9422
9667
  }
9423
9668
  async function handleRetry() {
9424
9669
  if (transaction.step === "error" && transaction.buildData) {
9425
- await signAndSubmitTx(transaction.buildData.unsignedXdr);
9670
+ await track(signAndSubmitTx(transaction.buildData.unsignedXdr));
9426
9671
  }
9427
9672
  }
9673
+ function handleClose() {
9674
+ declineOnClose();
9675
+ onClose();
9676
+ }
9428
9677
  function handleBack() {
9429
9678
  setStep("form");
9430
9679
  setCreatesAccount(false);
9431
9680
  setShowXdr(false);
9432
9681
  setCopied(false);
9433
9682
  }
9434
- return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
9683
+ return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
9435
9684
  SendModalTemplate,
9436
9685
  {
9437
9686
  theme,
@@ -9460,7 +9709,7 @@ function SendModal({ onClose, initial }) {
9460
9709
  walletType,
9461
9710
  showBack,
9462
9711
  isInProgress,
9463
- onClose,
9712
+ onClose: handleClose,
9464
9713
  onBack: handleBack,
9465
9714
  onRefresh: () => void refreshWalletBalance(),
9466
9715
  onSelectAsset: setSelectedAsset,
@@ -10262,6 +10511,7 @@ function SwapModal({ onClose, initial }) {
10262
10511
  const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
10263
10512
  const [step, setStep] = react.useState("form");
10264
10513
  const confirmation = useInlineConfirmation(step === "tx");
10514
+ const { track, declineOnClose } = useDeclineOnClose(confirmation);
10265
10515
  const [selectedSell, setSelectedSell] = react.useState(null);
10266
10516
  const [selectedBuy, setSelectedBuy] = react.useState(null);
10267
10517
  const [amount, setAmount] = react.useState(() => seededAmount(initial?.amount));
@@ -10291,8 +10541,6 @@ function SwapModal({ onClose, initial }) {
10291
10541
  void refreshAssets();
10292
10542
  }, [refreshWalletBalance, refreshAssets]);
10293
10543
  const loadConfig = react.useCallback(() => {
10294
- setVenues(null);
10295
- setSolanaVenues(null);
10296
10544
  return Promise.all([
10297
10545
  getSwapConfig().then(setVenues).catch(() => setVenues([])),
10298
10546
  // treat a failed config as "unavailable"
@@ -10430,10 +10678,12 @@ function SwapModal({ onClose, initial }) {
10430
10678
  setSelectedBuy(seeded);
10431
10679
  return;
10432
10680
  }
10433
- if (!selectedBuy || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
10434
- setSelectedBuy(buyOptions[0]);
10681
+ const sellKey = selectedSell ? optKey(selectedSell) : "";
10682
+ if (!selectedBuy || optKey(selectedBuy) === sellKey || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
10683
+ const next = buyOptions.find((o) => optKey(o) !== sellKey) ?? null;
10684
+ if (next !== selectedBuy) setSelectedBuy(next);
10435
10685
  }
10436
- }, [buyOptions, selectedBuy, isLoadingData]);
10686
+ }, [buyOptions, selectedBuy, selectedSell, isLoadingData]);
10437
10687
  function addCustomToken(code, issuer) {
10438
10688
  const c = code.trim().toUpperCase();
10439
10689
  const i = issuer.trim();
@@ -10493,8 +10743,13 @@ function SwapModal({ onClose, initial }) {
10493
10743
  };
10494
10744
  }, [quotedSolana, step]);
10495
10745
  react.useEffect(() => {
10496
- if (chains.length > 0 && !chains.includes(chain)) setChain(chains[0]);
10497
- }, [chains, chain]);
10746
+ if (configLoading) return;
10747
+ if (chains.length === 0 || chains.includes(chain)) return;
10748
+ setChain(chains[0]);
10749
+ setProvider("auto");
10750
+ setQuotes([]);
10751
+ setSolanaQuotes([]);
10752
+ }, [chains, chain, configLoading]);
10498
10753
  function handleChainChange(next) {
10499
10754
  sellSeed.current = void 0;
10500
10755
  buySeed.current = void 0;
@@ -10687,7 +10942,7 @@ function SwapModal({ onClose, initial }) {
10687
10942
  setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
10688
10943
  setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
10689
10944
  setStep("tx");
10690
- await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
10945
+ await track(swapSolana(solanaQuote, { slippageBps, idempotencyKey: key }));
10691
10946
  return;
10692
10947
  }
10693
10948
  if (!quote) {
@@ -10696,7 +10951,7 @@ function SwapModal({ onClose, initial }) {
10696
10951
  }
10697
10952
  setSentSolana(null);
10698
10953
  setStep("tx");
10699
- await swap(quote);
10954
+ await track(swap(quote));
10700
10955
  }
10701
10956
  async function handleRetry() {
10702
10957
  if (transaction.step !== "error") return;
@@ -10706,10 +10961,10 @@ function SwapModal({ onClose, initial }) {
10706
10961
  const toward = solanaQuote.destinationChain;
10707
10962
  setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
10708
10963
  if (selectedSell && selectedBuy) setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
10709
- await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
10964
+ await track(swapSolana(solanaQuote, { slippageBps, idempotencyKey: key }));
10710
10965
  return;
10711
10966
  }
10712
- if (quote) await swap(quote);
10967
+ if (quote) await track(swap(quote));
10713
10968
  }
10714
10969
  function handleMax() {
10715
10970
  if (selectedSell?.available !== void 0) setAmount(selectedSell.available);
@@ -10733,6 +10988,10 @@ function SwapModal({ onClose, initial }) {
10733
10988
  }, 2e3);
10734
10989
  });
10735
10990
  }
10991
+ function handleClose() {
10992
+ declineOnClose();
10993
+ onClose();
10994
+ }
10736
10995
  function handleBack() {
10737
10996
  setSettlement(null);
10738
10997
  setSentSolana(null);
@@ -10740,7 +10999,7 @@ function SwapModal({ onClose, initial }) {
10740
10999
  setShowXdr(false);
10741
11000
  setCopied(false);
10742
11001
  }
10743
- return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
11002
+ return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
10744
11003
  SwapModalTemplate,
10745
11004
  {
10746
11005
  theme,
@@ -10781,7 +11040,7 @@ function SwapModal({ onClose, initial }) {
10781
11040
  showBack,
10782
11041
  isInProgress,
10783
11042
  language,
10784
- onClose,
11043
+ onClose: handleClose,
10785
11044
  onBack: handleBack,
10786
11045
  onRefresh: handleRefresh,
10787
11046
  onSelectSell: (option) => {
@@ -11683,6 +11942,7 @@ function EarnModal({ onClose, initial }) {
11683
11942
  const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
11684
11943
  const [step, setStep] = react.useState("form");
11685
11944
  const confirmation = useInlineConfirmation(step === "tx");
11945
+ const { track, declineOnClose } = useDeclineOnClose(confirmation);
11686
11946
  const [tab, setTab] = react.useState(
11687
11947
  () => oneOf(["deposit", "withdraw"], initial?.tab) ?? "deposit"
11688
11948
  );
@@ -11855,7 +12115,7 @@ function EarnModal({ onClose, initial }) {
11855
12115
  });
11856
12116
  setStep("tx");
11857
12117
  if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
11858
- const tl = await setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer });
12118
+ const tl = await track(setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer }));
11859
12119
  if (tl.status === "error") {
11860
12120
  setFormError(copy.trustlineFailed(assetCode, tl.details ?? copy.unknownError));
11861
12121
  setStep("form");
@@ -11874,11 +12134,15 @@ function EarnModal({ onClose, initial }) {
11874
12134
  function runEarn() {
11875
12135
  if (onSolana) {
11876
12136
  const params2 = { opportunity: opportunityId, amount };
11877
- return tab === "deposit" ? earnSolanaDeposit(params2) : earnSolanaWithdraw(params2);
12137
+ return track(tab === "deposit" ? earnSolanaDeposit(params2) : earnSolanaWithdraw(params2));
11878
12138
  }
11879
12139
  if (!provider) return null;
11880
12140
  const params = { provider, opportunity: opportunityId, amount };
11881
- return tab === "deposit" ? earnDeposit(params) : earnWithdraw(params);
12141
+ return track(tab === "deposit" ? earnDeposit(params) : earnWithdraw(params));
12142
+ }
12143
+ function handleClose() {
12144
+ declineOnClose();
12145
+ onClose();
11882
12146
  }
11883
12147
  async function handleRetry() {
11884
12148
  if (transaction.step !== "error" || !opportunityId) return;
@@ -11960,7 +12224,7 @@ function EarnModal({ onClose, initial }) {
11960
12224
  rows: [{ label: copy.yourPosition, value: position.balance }]
11961
12225
  }
11962
12226
  ) : null;
11963
- return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
12227
+ return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
11964
12228
  "div",
11965
12229
  {
11966
12230
  className: "pollar-modal-card pollar-send-modal",
@@ -12034,7 +12298,7 @@ function EarnModal({ onClose, initial }) {
12034
12298
  )
12035
12299
  }
12036
12300
  ),
12037
- !isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
12301
+ !isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleClose, "aria-label": copy.close, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
12038
12302
  ] })
12039
12303
  ] }),
12040
12304
  step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: copy.unavailable }),
@@ -13947,6 +14211,7 @@ var COSIGN_COPY = {
13947
14211
  approve: "Approve",
13948
14212
  approving: "Approving...",
13949
14213
  genericError: "Something went wrong. Please try again.",
14214
+ unreachable: "We could not reach Pollar, so nothing was approved. Check your connection and approve again.",
13950
14215
  deviceNotLinked: "This device isn't linked to your wallet yet, so it can't approve. Add it with a device that already is, your passkey or your email.",
13951
14216
  linkDevice: "Link this device",
13952
14217
  transaction: "Transaction",
@@ -14000,6 +14265,7 @@ var COSIGN_COPY = {
14000
14265
  approve: "Aprobar",
14001
14266
  approving: "Aprobando...",
14002
14267
  genericError: "Algo sali\xF3 mal. Intenta de nuevo.",
14268
+ unreachable: "No pudimos conectar con Pollar, as\xED que no se aprob\xF3 nada. Revisa tu conexi\xF3n y aprueba de nuevo.",
14003
14269
  deviceNotLinked: "Este dispositivo a\xFAn no est\xE1 vinculado a tu billetera, as\xED que no puede aprobar. Agr\xE9galo con un dispositivo que ya lo est\xE9, tu passkey o tu email.",
14004
14270
  linkDevice: "Vincular este dispositivo",
14005
14271
  transaction: "Transacci\xF3n",
@@ -14053,6 +14319,7 @@ var COSIGN_COPY = {
14053
14319
  approve: "Aprovar",
14054
14320
  approving: "Aprovando...",
14055
14321
  genericError: "Algo deu errado. Tente novamente.",
14322
+ unreachable: "N\xE3o conseguimos conectar \xE0 Pollar, ent\xE3o nada foi aprovado. Verifique sua conex\xE3o e aprove novamente.",
14056
14323
  deviceNotLinked: "Este dispositivo ainda n\xE3o est\xE1 vinculado \xE0 sua carteira, ent\xE3o n\xE3o pode aprovar. Adicione-o com um dispositivo que j\xE1 esteja, sua passkey ou seu email.",
14057
14324
  linkDevice: "Vincular este dispositivo",
14058
14325
  transaction: "Transa\xE7\xE3o",
@@ -14406,6 +14673,11 @@ function CosignModal({ nextStep = null, onClose }) {
14406
14673
  try {
14407
14674
  await action(request);
14408
14675
  } catch (err) {
14676
+ if (core.isPollarNetworkError(err) || err instanceof TypeError) {
14677
+ setError(COSIGN_COPY[language].unreachable);
14678
+ void refresh().catch(() => void 0);
14679
+ return;
14680
+ }
14409
14681
  setError(
14410
14682
  core.transactionErrorMessage(core.isPollarApiError(err) ? err.code : null, err instanceof Error ? err.message : null, language)
14411
14683
  );
@@ -14415,7 +14687,7 @@ function CosignModal({ nextStep = null, onClose }) {
14415
14687
  setBusy(null);
14416
14688
  }
14417
14689
  },
14418
- []
14690
+ [language, refresh]
14419
14691
  );
14420
14692
  return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
14421
14693
  CosignModalTemplate,
@@ -14646,6 +14918,9 @@ var RECOVERY_COPY = {
14646
14918
  acceptRisks: "I understand and accept these risks",
14647
14919
  recoverEmailIntro: (address) => `We'll email a code to ${address}. The code goes straight to the wallet provider, encrypted on this device.`,
14648
14920
  sendCode: "Send code",
14921
+ sendCodeIn: (seconds) => `Send code in ${seconds}s`,
14922
+ resendCode: "Send a new code",
14923
+ resendCodeIn: (seconds) => `Send a new code in ${seconds}s`,
14649
14924
  recover: "Recover",
14650
14925
  back: "Back",
14651
14926
  emailIntro: "Confirm an email you control. If you lose this device, a code sent there lets you add a new one. Anyone who controls this inbox could do the same, so use one that is well protected.",
@@ -14698,6 +14973,9 @@ var RECOVERY_COPY = {
14698
14973
  acceptRisks: "Entiendo y acepto estos riesgos",
14699
14974
  recoverEmailIntro: (address) => `Te enviaremos un c\xF3digo a ${address}. El c\xF3digo va directo al proveedor de la billetera, cifrado en este dispositivo.`,
14700
14975
  sendCode: "Enviar c\xF3digo",
14976
+ sendCodeIn: (seconds) => `Enviar c\xF3digo en ${seconds} s`,
14977
+ resendCode: "Enviar otro c\xF3digo",
14978
+ resendCodeIn: (seconds) => `Enviar otro c\xF3digo en ${seconds} s`,
14701
14979
  recover: "Recuperar",
14702
14980
  back: "Atr\xE1s",
14703
14981
  emailIntro: "Confirma un correo que controles. Si pierdes este dispositivo, un c\xF3digo enviado ah\xED te permite agregar uno nuevo. Cualquiera que controle esa bandeja de entrada podr\xEDa hacer lo mismo, as\xED que usa una que est\xE9 bien protegida.",
@@ -14750,6 +15028,9 @@ var RECOVERY_COPY = {
14750
15028
  acceptRisks: "Entendo e aceito esses riscos",
14751
15029
  recoverEmailIntro: (address) => `Vamos enviar um c\xF3digo para ${address}. O c\xF3digo vai direto para o provedor da carteira, criptografado neste dispositivo.`,
14752
15030
  sendCode: "Enviar c\xF3digo",
15031
+ sendCodeIn: (seconds) => `Enviar c\xF3digo em ${seconds} s`,
15032
+ resendCode: "Enviar outro c\xF3digo",
15033
+ resendCodeIn: (seconds) => `Enviar outro c\xF3digo em ${seconds} s`,
14753
15034
  recover: "Recuperar",
14754
15035
  back: "Voltar",
14755
15036
  emailIntro: "Confirme um e-mail que voc\xEA controla. Se voc\xEA perder este dispositivo, um c\xF3digo enviado para ele permite adicionar um novo. Qualquer pessoa que controle essa caixa de entrada poderia fazer o mesmo, ent\xE3o use uma que esteja bem protegida.",
@@ -14905,11 +15186,25 @@ function RecoveryModalTemplate(p) {
14905
15186
  copy,
14906
15187
  busy: p.busy,
14907
15188
  id: "recover-send",
14908
- label: copy.sendCode,
15189
+ label: p.sendWaitSeconds ? copy.sendCodeIn(p.sendWaitSeconds) : copy.sendCode,
14909
15190
  kind: "primary",
14910
- onClick: p.onSendRecoveryCode
15191
+ onClick: p.onSendRecoveryCode,
15192
+ disabled: p.sendWaitSeconds > 0
14911
15193
  }
14912
- ) : /* @__PURE__ */ jsxRuntime.jsx(CodeForm, { copy, busy: p.busy, id: "recover-code", label: copy.recover, onSubmit: p.onRecoverWithCode }),
15194
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15195
+ /* @__PURE__ */ jsxRuntime.jsx(CodeForm, { copy, busy: p.busy, id: "recover-code", label: copy.recover, onSubmit: p.onRecoverWithCode }),
15196
+ /* @__PURE__ */ jsxRuntime.jsx(
15197
+ Button,
15198
+ {
15199
+ copy,
15200
+ busy: p.busy,
15201
+ id: "recover-send",
15202
+ label: p.sendWaitSeconds ? copy.resendCodeIn(p.sendWaitSeconds) : copy.resendCode,
15203
+ onClick: p.onSendRecoveryCode,
15204
+ disabled: p.sendWaitSeconds > 0
15205
+ }
15206
+ )
15207
+ ] }),
14913
15208
  /* @__PURE__ */ jsxRuntime.jsx(Button, { copy, busy: p.busy, id: "back", label: copy.back, onClick: () => p.onView("overview") })
14914
15209
  ] });
14915
15210
  } else if (p.view === "email") {
@@ -14921,7 +15216,7 @@ function RecoveryModalTemplate(p) {
14921
15216
  className: "pollar-recovery-row",
14922
15217
  onSubmit: (e) => {
14923
15218
  e.preventDefault();
14924
- p.onSendEmailCode();
15219
+ if (!p.sendWaitSeconds) p.onSendEmailCode();
14925
15220
  },
14926
15221
  children: [
14927
15222
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -14941,15 +15236,28 @@ function RecoveryModalTemplate(p) {
14941
15236
  copy,
14942
15237
  busy: p.busy,
14943
15238
  id: "email-send",
14944
- label: copy.sendCode,
15239
+ label: p.sendWaitSeconds ? copy.sendCodeIn(p.sendWaitSeconds) : copy.sendCode,
14945
15240
  kind: "primary",
14946
15241
  onClick: p.onSendEmailCode,
14947
- disabled: !p.emailDraft.trim()
15242
+ disabled: !p.emailDraft.trim() || p.sendWaitSeconds > 0
14948
15243
  }
14949
15244
  )
14950
15245
  ]
14951
15246
  }
14952
- ) : /* @__PURE__ */ jsxRuntime.jsx(CodeForm, { copy, busy: p.busy, id: "email-confirm", label: copy.confirm, onSubmit: p.onConfirmEmail }),
15247
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
15248
+ /* @__PURE__ */ jsxRuntime.jsx(CodeForm, { copy, busy: p.busy, id: "email-confirm", label: copy.confirm, onSubmit: p.onConfirmEmail }),
15249
+ /* @__PURE__ */ jsxRuntime.jsx(
15250
+ Button,
15251
+ {
15252
+ copy,
15253
+ busy: p.busy,
15254
+ id: "email-send",
15255
+ label: p.sendWaitSeconds ? copy.resendCodeIn(p.sendWaitSeconds) : copy.resendCode,
15256
+ onClick: p.onSendEmailCode,
15257
+ disabled: p.sendWaitSeconds > 0
15258
+ }
15259
+ )
15260
+ ] }),
14953
15261
  /* @__PURE__ */ jsxRuntime.jsx(Button, { copy, busy: p.busy, id: "back", label: copy.back, onClick: () => p.onView("overview") })
14954
15262
  ] });
14955
15263
  } else if (p.view === "export") {
@@ -15092,6 +15400,7 @@ function RecoveryModal({ onClose }) {
15092
15400
  const [emailDraft, setEmailDraft] = react.useState("");
15093
15401
  const [codeSent, setCodeSent] = react.useState(false);
15094
15402
  const [phrase, setPhrase] = react.useState(null);
15403
+ const [now, setNow] = react.useState(() => Date.now());
15095
15404
  const load = react.useCallback(async () => {
15096
15405
  const client = getClient();
15097
15406
  const [nextState, nextDevices, key] = await Promise.all([
@@ -15134,6 +15443,14 @@ function RecoveryModal({ onClose }) {
15134
15443
  },
15135
15444
  [load]
15136
15445
  );
15446
+ const codeEmail = view === "recover-email" ? state?.email.address ?? "" : emailDraft.trim();
15447
+ const codeAvailableAt = codeEmail ? recovery.codeAvailableAt(codeEmail) : 0;
15448
+ const sendWaitSeconds = codeAvailableAt > now ? Math.ceil((codeAvailableAt - now) / 1e3) : 0;
15449
+ react.useEffect(() => {
15450
+ if (!codeAvailableAt) return;
15451
+ const timer = setInterval(() => setNow(Date.now()), 1e3);
15452
+ return () => clearInterval(timer);
15453
+ }, [codeAvailableAt]);
15137
15454
  const enrolled = !!thisDeviceKey && !!devices?.devices.some((d) => d.publicKey.toLowerCase() === thisDeviceKey);
15138
15455
  const [awaitingApproval, setAwaitingApproval] = react.useState(false);
15139
15456
  react.useEffect(() => {
@@ -15168,6 +15485,7 @@ function RecoveryModal({ onClose }) {
15168
15485
  notice,
15169
15486
  emailDraft,
15170
15487
  codeSent,
15488
+ sendWaitSeconds,
15171
15489
  phrase,
15172
15490
  onView: (next) => {
15173
15491
  setError(null);
@@ -15180,8 +15498,12 @@ function RecoveryModal({ onClose }) {
15180
15498
  onAddPasskey: () => void run("passkey", () => recovery.addPasskey(), { notice: copy.passkeyAdded }),
15181
15499
  onRemovePasskey: (id) => void run(`passkey:${id}`, () => recovery.removePasskey(id)),
15182
15500
  onSendEmailCode: () => void run("email-send", async () => {
15183
- await recovery.startEmail(emailDraft.trim());
15184
- setCodeSent(true);
15501
+ try {
15502
+ await recovery.startEmail(emailDraft.trim());
15503
+ setCodeSent(true);
15504
+ } finally {
15505
+ setNow(Date.now());
15506
+ }
15185
15507
  }),
15186
15508
  onConfirmEmail: (code) => void run("email-confirm", () => recovery.confirmEmail(code.trim()), { notice: copy.emailConfirmed, view: "overview" }),
15187
15509
  onApproveDevice: (id) => void run(`approve:${id}`, () => recovery.approveDevice(id), { notice: copy.deviceAdded }),
@@ -15198,8 +15520,12 @@ function RecoveryModal({ onClose }) {
15198
15520
  notice: copy.recovered
15199
15521
  }),
15200
15522
  onSendRecoveryCode: () => void run("recover-send", async () => {
15201
- await recovery.startEmailRecovery();
15202
- setCodeSent(true);
15523
+ try {
15524
+ await recovery.startEmailRecovery();
15525
+ setCodeSent(true);
15526
+ } finally {
15527
+ setNow(Date.now());
15528
+ }
15203
15529
  }),
15204
15530
  onRecoverWithCode: (code) => void run("recover-code", () => recovery.recoverWithEmailCode(code.trim()), {
15205
15531
  notice: copy.recovered,
@@ -16422,31 +16748,58 @@ function PollarProvider({
16422
16748
  }, [pollarClient, hasSession, walletAddress, custodyMigrationTick]);
16423
16749
  const refreshWalletBalance = react.useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
16424
16750
  const refreshAssets = react.useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
16751
+ const clientMethods = react.useMemo(
16752
+ () => ({
16753
+ createWallet: (options) => pollarClient.createWallet(options),
16754
+ login: (options) => pollarClient.login(options),
16755
+ logout: () => pollarClient.logout(),
16756
+ buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
16757
+ signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
16758
+ signTx: (unsignedXdr) => pollarClient.signTx(unsignedXdr),
16759
+ submitTx: (signedXdr) => pollarClient.submitTx(signedXdr),
16760
+ buildAndSignAndSubmitTx: (operation, params, options) => pollarClient.buildAndSignAndSubmitTx(operation, params, options),
16761
+ runTx: (operation, params, options) => pollarClient.runTx(operation, params, options),
16762
+ sendPayment: (params) => pollarClient.sendPayment(params),
16763
+ setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
16764
+ getSwapConfig: () => pollarClient.getSwapConfig(),
16765
+ getSwapTokens: () => pollarClient.getSwapTokens(),
16766
+ getSwapQuote: (params) => pollarClient.getSwapQuote(params),
16767
+ swap: (quote, opts) => pollarClient.swap(quote, opts),
16768
+ getSolanaSwapConfig: () => pollarClient.getSolanaSwapConfig(),
16769
+ getSolanaSwapQuote: (params) => pollarClient.getSolanaSwapQuote(params),
16770
+ swapSolana: (quote, opts) => pollarClient.swapSolana(quote, opts),
16771
+ getSolanaSwapOptions: () => pollarClient.getSolanaSwapOptions(),
16772
+ getSwapStatus: (idempotencyKey) => pollarClient.getSwapStatus(idempotencyKey),
16773
+ getEarnProviders: () => pollarClient.getEarnProviders(),
16774
+ getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
16775
+ getEarnPosition: (params) => pollarClient.getEarnPosition(params),
16776
+ earnDeposit: (params) => pollarClient.earnDeposit(params),
16777
+ earnWithdraw: (params) => pollarClient.earnWithdraw(params),
16778
+ getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
16779
+ getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
16780
+ getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
16781
+ earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
16782
+ earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),
16783
+ setNetwork: (network) => pollarClient.setNetwork(network)
16784
+ }),
16785
+ [pollarClient]
16786
+ );
16425
16787
  const contextValue = react.useMemo(() => {
16426
16788
  const styles = resolvedConfig.styles ?? {};
16427
16789
  return {
16790
+ ...clientMethods,
16428
16791
  // session
16429
16792
  wallet: pollarClient.getWallet(),
16430
16793
  wallets: pollarClient.getWallets(),
16431
16794
  isAuthenticated: hasSession,
16432
16795
  hasWallet: pollarClient.hasWallet(),
16433
- createWallet: (options) => pollarClient.createWallet(options),
16434
16796
  verified,
16435
16797
  // client
16436
16798
  getClient,
16437
16799
  // auth
16438
- login: (options) => pollarClient.login(options),
16439
- logout: () => pollarClient.logout(),
16440
16800
  openLoginModal: () => setLoginModalOpen(true),
16441
16801
  // transactions
16442
16802
  tx: transaction,
16443
- buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
16444
- signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
16445
- signTx: (unsignedXdr) => pollarClient.signTx(unsignedXdr),
16446
- submitTx: (signedXdr) => pollarClient.submitTx(signedXdr),
16447
- buildAndSignAndSubmitTx: (operation, params, options) => pollarClient.buildAndSignAndSubmitTx(operation, params, options),
16448
- runTx: (operation, params, options) => pollarClient.runTx(operation, params, options),
16449
- sendPayment: (params) => pollarClient.sendPayment(params),
16450
16803
  openTxModal: () => setTransactionModalOpen(true),
16451
16804
  // tx history
16452
16805
  txHistory,
@@ -16461,7 +16814,6 @@ function PollarProvider({
16461
16814
  // enabled assets
16462
16815
  enabledAssets,
16463
16816
  refreshAssets,
16464
- setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
16465
16817
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
16466
16818
  // send / receive
16467
16819
  openSendModal: (options) => {
@@ -16475,15 +16827,6 @@ function PollarProvider({
16475
16827
  setReceiveModalOpen(true);
16476
16828
  },
16477
16829
  // swap
16478
- getSwapConfig: () => pollarClient.getSwapConfig(),
16479
- getSwapTokens: () => pollarClient.getSwapTokens(),
16480
- getSwapQuote: (params) => pollarClient.getSwapQuote(params),
16481
- swap: (quote, opts) => pollarClient.swap(quote, opts),
16482
- getSolanaSwapConfig: () => pollarClient.getSolanaSwapConfig(),
16483
- getSolanaSwapQuote: (params) => pollarClient.getSolanaSwapQuote(params),
16484
- swapSolana: (quote, opts) => pollarClient.swapSolana(quote, opts),
16485
- getSolanaSwapOptions: () => pollarClient.getSolanaSwapOptions(),
16486
- getSwapStatus: (idempotencyKey) => pollarClient.getSwapStatus(idempotencyKey),
16487
16830
  openSwapModal: (options) => {
16488
16831
  setSwapModalOptions(options);
16489
16832
  pollarClient.resetTransactionState();
@@ -16496,16 +16839,6 @@ function PollarProvider({
16496
16839
  setBridgeModalOpen(true);
16497
16840
  },
16498
16841
  // earn
16499
- getEarnProviders: () => pollarClient.getEarnProviders(),
16500
- getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
16501
- getEarnPosition: (params) => pollarClient.getEarnPosition(params),
16502
- earnDeposit: (params) => pollarClient.earnDeposit(params),
16503
- earnWithdraw: (params) => pollarClient.earnWithdraw(params),
16504
- getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
16505
- getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
16506
- getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
16507
- earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
16508
- earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),
16509
16842
  openEarnModal: (options) => {
16510
16843
  setEarnModalOptions(options);
16511
16844
  pollarClient.resetTransactionState();
@@ -16537,7 +16870,6 @@ function PollarProvider({
16537
16870
  openDistributionRulesModal: () => setDistributionRulesModalOpen(true),
16538
16871
  // network
16539
16872
  network: networkState.step === "connected" ? networkState.network : "testnet",
16540
- setNetwork: (network) => pollarClient.setNetwork(network),
16541
16873
  // kyc
16542
16874
  openKycModal: (options = {}) => {
16543
16875
  setKycModalOptions(options);
@@ -16556,6 +16888,7 @@ function PollarProvider({
16556
16888
  adapters
16557
16889
  };
16558
16890
  }, [
16891
+ clientMethods,
16559
16892
  walletAddress,
16560
16893
  walletProvisioning,
16561
16894
  recovery,
@@ -17447,6 +17780,11 @@ function KycFlow({ onApproved, country, level }) {
17447
17780
  }
17448
17781
  );
17449
17782
  }
17783
+ var stay2 = () => {
17784
+ };
17785
+ function LoginFlow() {
17786
+ return /* @__PURE__ */ jsxRuntime.jsx(LoginModal, { inline: true, onClose: stay2 });
17787
+ }
17450
17788
 
17451
17789
  exports.BridgeModal = BridgeModal;
17452
17790
  exports.BridgeModalTemplate = BridgeModalTemplate;
@@ -17465,6 +17803,7 @@ exports.KycFlow = KycFlow;
17465
17803
  exports.KycModal = KycModal;
17466
17804
  exports.KycModalTemplate = KycModalTemplate;
17467
17805
  exports.KycStatus = KycStatus;
17806
+ exports.LoginFlow = LoginFlow;
17468
17807
  exports.LoginModalTemplate = LoginModalTemplate;
17469
17808
  exports.PollarProvider = PollarProvider;
17470
17809
  exports.ProviderRegistrationModal = ProviderRegistrationModal;