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

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, rampRailLabel, describeRampAction, rampStepTitle, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampNoRouteText, rampFieldError, rampFieldValid, rampFailureReason, rampLegNote, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampFailureNeedsSupport, rampSupportCopy, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, isKycSettled, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
2
+ import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, rampRailLabel, describeRampAction, rampStepTitle, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampNoRouteText, rampFieldError, rampFieldValid, rampFailureReason, rampLegNote, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampFailureNeedsSupport, rampSupportCopy, rampCountries, rampQuoteFields, isPollarApiError, rampSupportContact, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, isKycSettled, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
3
3
  import { createContext, forwardRef, useState, useCallback, useEffect, useMemo, useRef, useContext, useSyncExternalStore, useId, useLayoutEffect, Component } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { createPortal } from 'react-dom';
@@ -1309,7 +1309,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1309
1309
  /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1310
1310
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1311
1311
  "v",
1312
- "0.12.1-rc.22"
1312
+ "0.12.1-rc.23"
1313
1313
  ] })
1314
1314
  ] });
1315
1315
  };
@@ -3554,6 +3554,21 @@ function useInlineConfirmation(active) {
3554
3554
  useEffect(() => active ? registerConfirmationHost() : void 0, [active, registerConfirmationHost]);
3555
3555
  return active ? confirmations[0] ?? null : null;
3556
3556
  }
3557
+ function useDeclineOnClose(confirmation) {
3558
+ const pending = useRef(0);
3559
+ const track = useCallback(async (call) => {
3560
+ pending.current += 1;
3561
+ try {
3562
+ return await call;
3563
+ } finally {
3564
+ pending.current -= 1;
3565
+ }
3566
+ }, []);
3567
+ const declineOnClose = useCallback(() => {
3568
+ if (pending.current > 0) confirmation?.reject();
3569
+ }, [confirmation]);
3570
+ return { track, declineOnClose };
3571
+ }
3557
3572
  function assetKey2(record) {
3558
3573
  return record.code + (record.issuer ?? "");
3559
3574
  }
@@ -3663,12 +3678,14 @@ var KYC_COPY = {
3663
3678
  en: {
3664
3679
  errors: {
3665
3680
  SDK_KYC_NOT_CONFIGURED: "Identity verification is not available for this app yet.",
3681
+ // The vendor's account ran out of credits: the operator tops it up, the app's setup is fine.
3682
+ "SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "Identity verification is temporarily unavailable. Please try again later.",
3666
3683
  SDK_KYC_PROVIDER_ERROR: "The verification service is not responding right now. Please try again in a moment.",
3667
3684
  SDK_KYC_SESSION_EXPIRED: "Your previous verification session expired. Select the provider to start a new one.",
3668
3685
  SDK_KYC_PROVIDER_NOT_FOUND: "This verification option is no longer available. Refresh to see the current options.",
3669
3686
  SDK_KYC_PROVIDER_NOT_ENABLED: "This verification option is no longer available. Refresh to see the current options.",
3670
3687
  SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "This route is not set up for identity verification yet.",
3671
- VALIDATION_ERROR: "This verification option is not available for your country."
3688
+ VALIDATION_ERROR: "This verification option could not be started. Please try again or choose another option."
3672
3689
  },
3673
3690
  loadFailed: "Could not load verification options. Please refresh to try again.",
3674
3691
  startFailed: "Could not start verification. Please try again.",
@@ -3728,12 +3745,13 @@ var KYC_COPY = {
3728
3745
  es: {
3729
3746
  errors: {
3730
3747
  SDK_KYC_NOT_CONFIGURED: "La verificaci\xF3n de identidad todav\xEDa no est\xE1 disponible para esta app.",
3748
+ "SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "La verificaci\xF3n de identidad no est\xE1 disponible temporalmente. Intenta de nuevo m\xE1s tarde.",
3731
3749
  SDK_KYC_PROVIDER_ERROR: "El servicio de verificaci\xF3n no responde en este momento. Intenta de nuevo en un momento.",
3732
3750
  SDK_KYC_SESSION_EXPIRED: "Tu sesi\xF3n de verificaci\xF3n anterior venci\xF3. Elige el proveedor para iniciar una nueva.",
3733
3751
  SDK_KYC_PROVIDER_NOT_FOUND: "Esta opci\xF3n de verificaci\xF3n ya no est\xE1 disponible. Actualiza para ver las opciones actuales.",
3734
3752
  SDK_KYC_PROVIDER_NOT_ENABLED: "Esta opci\xF3n de verificaci\xF3n ya no est\xE1 disponible. Actualiza para ver las opciones actuales.",
3735
3753
  SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "Esta ruta todav\xEDa no est\xE1 configurada para la verificaci\xF3n de identidad.",
3736
- VALIDATION_ERROR: "Esta opci\xF3n de verificaci\xF3n no est\xE1 disponible para tu pa\xEDs."
3754
+ VALIDATION_ERROR: "No se pudo iniciar esta opci\xF3n de verificaci\xF3n. Intenta de nuevo o elige otra opci\xF3n."
3737
3755
  },
3738
3756
  loadFailed: "No se pudieron cargar las opciones de verificaci\xF3n. Actualiza para intentar de nuevo.",
3739
3757
  startFailed: "No se pudo iniciar la verificaci\xF3n. Intenta de nuevo.",
@@ -3793,12 +3811,13 @@ var KYC_COPY = {
3793
3811
  pt: {
3794
3812
  errors: {
3795
3813
  SDK_KYC_NOT_CONFIGURED: "A verifica\xE7\xE3o de identidade ainda n\xE3o est\xE1 dispon\xEDvel para este app.",
3814
+ "SDK_KYC_NOT_CONFIGURED:provider_credits_exhausted": "A verifica\xE7\xE3o de identidade est\xE1 temporariamente indispon\xEDvel. Tente de novo mais tarde.",
3796
3815
  SDK_KYC_PROVIDER_ERROR: "O servi\xE7o de verifica\xE7\xE3o n\xE3o est\xE1 respondendo agora. Tente de novo em instantes.",
3797
3816
  SDK_KYC_SESSION_EXPIRED: "Sua sess\xE3o de verifica\xE7\xE3o anterior expirou. Escolha o provedor para iniciar uma nova.",
3798
3817
  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.",
3799
3818
  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.",
3800
3819
  SDK_RAMPS_PROVIDER_NOT_CONFIGURED: "Esta rota ainda n\xE3o est\xE1 configurada para a verifica\xE7\xE3o de identidade.",
3801
- VALIDATION_ERROR: "Esta op\xE7\xE3o de verifica\xE7\xE3o n\xE3o est\xE1 dispon\xEDvel para o seu pa\xEDs."
3820
+ 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."
3802
3821
  },
3803
3822
  loadFailed: "N\xE3o foi poss\xEDvel carregar as op\xE7\xF5es de verifica\xE7\xE3o. Atualize para tentar de novo.",
3804
3823
  startFailed: "N\xE3o foi poss\xEDvel iniciar a verifica\xE7\xE3o. Tente de novo.",
@@ -3879,12 +3898,11 @@ function KycStatus({ status, label, className, language: languageProp }) {
3879
3898
  }
3880
3899
  );
3881
3900
  }
3882
-
3883
- // src/components/kyc-modal/kyc-messages.ts
3884
3901
  function kycErrorMessage(error, phase, language = "en") {
3885
3902
  const copy = KYC_COPY[language];
3886
3903
  const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
3887
- const known = typeof code === "string" ? copy.errors[code] : void 0;
3904
+ const reason = isPollarApiError(error) && typeof error.body.reason === "string" ? error.body.reason : void 0;
3905
+ const known = typeof code === "string" ? reason && copy.errors[`${code}:${reason}`] || copy.errors[code] : void 0;
3888
3906
  if (known) return known;
3889
3907
  return phase === "load" ? copy.loadFailed : copy.startFailed;
3890
3908
  }
@@ -4885,6 +4903,22 @@ function WalletAdapterButtons({
4885
4903
  a.id
4886
4904
  )) });
4887
4905
  }
4906
+ function CloseButton({ onClick, label }) {
4907
+ return /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick, "aria-label": label, children: /* @__PURE__ */ jsx(
4908
+ "svg",
4909
+ {
4910
+ width: "18",
4911
+ height: "18",
4912
+ viewBox: "0 0 24 24",
4913
+ fill: "none",
4914
+ stroke: "currentColor",
4915
+ strokeWidth: "2.5",
4916
+ strokeLinecap: "round",
4917
+ strokeLinejoin: "round",
4918
+ children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
4919
+ }
4920
+ ) });
4921
+ }
4888
4922
  function authStateToStatus(step) {
4889
4923
  const loading = [
4890
4924
  "creating_session",
@@ -4929,7 +4963,8 @@ function LoginModalTemplate({
4929
4963
  onBack,
4930
4964
  onCancel,
4931
4965
  onRetry,
4932
- language: languageProp
4966
+ language: languageProp,
4967
+ inline = false
4933
4968
  }) {
4934
4969
  const language = useInheritedLanguage(languageProp);
4935
4970
  const copy = LOGIN_COPY[language];
@@ -4965,160 +5000,155 @@ function LoginModalTemplate({
4965
5000
  children: /* @__PURE__ */ jsx("path", { d: "M15 19l-7-7 7-7" })
4966
5001
  }
4967
5002
  ) });
4968
- return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
4969
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": copy.close, children: /* @__PURE__ */ jsx(
4970
- "svg",
4971
- {
4972
- width: "18",
4973
- height: "18",
4974
- viewBox: "0 0 24 24",
4975
- fill: "none",
4976
- stroke: "currentColor",
4977
- strokeWidth: "2.5",
4978
- strokeLinecap: "round",
4979
- strokeLinejoin: "round",
4980
- children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
4981
- }
4982
- ) }),
4983
- /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
4984
- /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx(ModalLogo, { logoUrl }) }),
4985
- /* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
4986
- /* @__PURE__ */ jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
4987
- ] }),
4988
- awaitingEmailCode ? /* @__PURE__ */ jsxs(Fragment, { children: [
4989
- /* @__PURE__ */ jsx(BackButton, { onClick: onBack }),
4990
- /* @__PURE__ */ jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
4991
- }), language }, codeInputKey)
4992
- ] }) : activeGroup ? /* @__PURE__ */ jsxs(Fragment, { children: [
4993
- /* @__PURE__ */ jsx(BackButton, { onClick: () => setActiveGroup(null) }),
4994
- /* @__PURE__ */ jsx(
4995
- WalletAdapterButtons,
4996
- {
4997
- walletAdapters: activeGroupAdapters,
4998
- onConnect: onWalletConnect ?? (() => {
4999
- }),
5000
- isLoading
5001
- }
5002
- )
5003
- ] }) : showPasskeyChooser ? /* @__PURE__ */ jsxs(Fragment, { children: [
5004
- /* @__PURE__ */ jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
5005
- /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
5006
- /* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: copy.createNewWallet }),
5007
- /* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: copy.loginExistingWallet })
5008
- ] })
5009
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5010
- emailEnabled && /* @__PURE__ */ jsxs("div", { className: "pollar-email-section", children: [
5011
- /* @__PURE__ */ jsx(
5012
- "input",
5013
- {
5014
- type: "email",
5015
- placeholder: copy.emailPlaceholder,
5016
- value: email,
5017
- disabled: isLoading,
5018
- className: "pollar-input",
5019
- onChange: (e) => onEmailChange?.(e.target.value),
5020
- onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
5021
- }
5022
- ),
5023
- /* @__PURE__ */ jsx(
5024
- "button",
5025
- {
5026
- type: "button",
5027
- disabled: isLoading || !email,
5028
- className: "pollar-btn-primary",
5029
- style: { marginTop: "0.75rem" },
5030
- onClick: onEmailSubmit,
5031
- children: copy.submit
5032
- }
5033
- )
5034
- ] }),
5035
- emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
5036
- /* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
5037
- /* @__PURE__ */ jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5038
- ] }),
5039
- enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-social-list", children: [
5040
- enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
5041
- enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
5042
- ] }),
5043
- (embeddedWallets || smartWallet) && /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
5044
- embeddedWallets && /* @__PURE__ */ jsxs(Fragment, { children: [
5045
- walletGroups.map((g) => /* @__PURE__ */ jsxs(
5046
- "button",
5047
- {
5048
- type: "button",
5049
- disabled: isLoading,
5050
- className: "pollar-wallet-entry-btn",
5051
- onClick: () => setActiveGroup(g.label),
5052
- children: [
5053
- /* @__PURE__ */ jsx(
5054
- "svg",
5055
- {
5056
- width: "18",
5057
- height: "20",
5058
- viewBox: "0 0 24 24",
5059
- fill: "none",
5060
- stroke: "currentColor",
5061
- strokeWidth: "2",
5062
- strokeLinecap: "round",
5063
- strokeLinejoin: "round",
5064
- children: /* @__PURE__ */ 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" })
5065
- }
5066
- ),
5067
- g.label
5068
- ]
5069
- },
5070
- g.label
5071
- )),
5072
- rootAdapters.length > 0 && /* @__PURE__ */ jsx(
5003
+ return /* @__PURE__ */ jsxs(
5004
+ "div",
5005
+ {
5006
+ className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
5007
+ style: cssVars,
5008
+ onClick: (e) => e.stopPropagation(),
5009
+ children: [
5010
+ !inline && /* @__PURE__ */ jsx(CloseButton, { onClick: onCancel, label: copy.close }),
5011
+ /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
5012
+ /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx(ModalLogo, { logoUrl }) }),
5013
+ /* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
5014
+ /* @__PURE__ */ jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
5015
+ ] }),
5016
+ awaitingEmailCode ? /* @__PURE__ */ jsxs(Fragment, { children: [
5017
+ /* @__PURE__ */ jsx(BackButton, { onClick: onBack }),
5018
+ /* @__PURE__ */ jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
5019
+ }), language }, codeInputKey)
5020
+ ] }) : activeGroup ? /* @__PURE__ */ jsxs(Fragment, { children: [
5021
+ /* @__PURE__ */ jsx(BackButton, { onClick: () => setActiveGroup(null) }),
5022
+ /* @__PURE__ */ jsx(
5073
5023
  WalletAdapterButtons,
5074
5024
  {
5075
- walletAdapters: rootAdapters,
5025
+ walletAdapters: activeGroupAdapters,
5076
5026
  onConnect: onWalletConnect ?? (() => {
5077
5027
  }),
5078
- isLoading,
5079
- variant: "entry"
5028
+ isLoading
5080
5029
  }
5081
5030
  )
5082
- ] }),
5083
- smartWallet && /* @__PURE__ */ jsxs(
5084
- "button",
5085
- {
5086
- type: "button",
5087
- disabled: isLoading,
5088
- className: "pollar-wallet-entry-btn",
5089
- onClick: () => setShowPasskeyChooser(true),
5090
- children: [
5091
- /* @__PURE__ */ jsx(
5092
- "svg",
5031
+ ] }) : showPasskeyChooser ? /* @__PURE__ */ jsxs(Fragment, { children: [
5032
+ /* @__PURE__ */ jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
5033
+ /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
5034
+ /* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: copy.createNewWallet }),
5035
+ /* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: copy.loginExistingWallet })
5036
+ ] })
5037
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5038
+ emailEnabled && /* @__PURE__ */ jsxs("div", { className: "pollar-email-section", children: [
5039
+ /* @__PURE__ */ jsx(
5040
+ "input",
5041
+ {
5042
+ type: "email",
5043
+ placeholder: copy.emailPlaceholder,
5044
+ value: email,
5045
+ disabled: isLoading,
5046
+ className: "pollar-input",
5047
+ onChange: (e) => onEmailChange?.(e.target.value),
5048
+ onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
5049
+ }
5050
+ ),
5051
+ /* @__PURE__ */ jsx(
5052
+ "button",
5053
+ {
5054
+ type: "button",
5055
+ disabled: isLoading || !email,
5056
+ className: "pollar-btn-primary",
5057
+ style: { marginTop: "0.75rem" },
5058
+ onClick: onEmailSubmit,
5059
+ children: copy.submit
5060
+ }
5061
+ )
5062
+ ] }),
5063
+ emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
5064
+ /* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
5065
+ /* @__PURE__ */ jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5066
+ ] }),
5067
+ enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-social-list", children: [
5068
+ enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
5069
+ enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
5070
+ ] }),
5071
+ (embeddedWallets || smartWallet) && /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
5072
+ embeddedWallets && /* @__PURE__ */ jsxs(Fragment, { children: [
5073
+ walletGroups.map((g) => /* @__PURE__ */ jsxs(
5074
+ "button",
5093
5075
  {
5094
- width: "18",
5095
- height: "20",
5096
- viewBox: "0 0 24 24",
5097
- fill: "none",
5098
- stroke: "currentColor",
5099
- strokeWidth: "2",
5100
- strokeLinecap: "round",
5101
- strokeLinejoin: "round",
5102
- children: /* @__PURE__ */ 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" })
5076
+ type: "button",
5077
+ disabled: isLoading,
5078
+ className: "pollar-wallet-entry-btn",
5079
+ onClick: () => setActiveGroup(g.label),
5080
+ children: [
5081
+ /* @__PURE__ */ jsx(
5082
+ "svg",
5083
+ {
5084
+ width: "18",
5085
+ height: "20",
5086
+ viewBox: "0 0 24 24",
5087
+ fill: "none",
5088
+ stroke: "currentColor",
5089
+ strokeWidth: "2",
5090
+ strokeLinecap: "round",
5091
+ strokeLinejoin: "round",
5092
+ children: /* @__PURE__ */ 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" })
5093
+ }
5094
+ ),
5095
+ g.label
5096
+ ]
5097
+ },
5098
+ g.label
5099
+ )),
5100
+ rootAdapters.length > 0 && /* @__PURE__ */ jsx(
5101
+ WalletAdapterButtons,
5102
+ {
5103
+ walletAdapters: rootAdapters,
5104
+ onConnect: onWalletConnect ?? (() => {
5105
+ }),
5106
+ isLoading,
5107
+ variant: "entry"
5103
5108
  }
5104
- ),
5105
- "Smart Wallet"
5106
- ]
5109
+ )
5110
+ ] }),
5111
+ smartWallet && /* @__PURE__ */ jsxs(
5112
+ "button",
5113
+ {
5114
+ type: "button",
5115
+ disabled: isLoading,
5116
+ className: "pollar-wallet-entry-btn",
5117
+ onClick: () => setShowPasskeyChooser(true),
5118
+ children: [
5119
+ /* @__PURE__ */ jsx(
5120
+ "svg",
5121
+ {
5122
+ width: "18",
5123
+ height: "20",
5124
+ viewBox: "0 0 24 24",
5125
+ fill: "none",
5126
+ stroke: "currentColor",
5127
+ strokeWidth: "2",
5128
+ strokeLinecap: "round",
5129
+ strokeLinejoin: "round",
5130
+ children: /* @__PURE__ */ 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" })
5131
+ }
5132
+ ),
5133
+ "Smart Wallet"
5134
+ ]
5135
+ }
5136
+ )
5137
+ ] })
5138
+ ] }),
5139
+ /* @__PURE__ */ jsx(
5140
+ ModalStatusBanner,
5141
+ {
5142
+ message: statusMessage,
5143
+ status,
5144
+ onCancel,
5145
+ onRetry: isEmailCodeError ? void 0 : onRetry
5107
5146
  }
5108
- )
5109
- ] })
5110
- ] }),
5111
- /* @__PURE__ */ jsx(
5112
- ModalStatusBanner,
5113
- {
5114
- message: statusMessage,
5115
- status,
5116
- onCancel,
5117
- onRetry: isEmailCodeError ? void 0 : onRetry
5118
- }
5119
- ),
5120
- /* @__PURE__ */ jsx(PollarModalFooter, {})
5121
- ] });
5147
+ ),
5148
+ /* @__PURE__ */ jsx(PollarModalFooter, {})
5149
+ ]
5150
+ }
5151
+ );
5122
5152
  }
5123
5153
  function LoginModalStatus({
5124
5154
  status,
@@ -5129,40 +5159,36 @@ function LoginModalStatus({
5129
5159
  appName,
5130
5160
  onRetry,
5131
5161
  onCancel,
5132
- language: languageProp
5162
+ language: languageProp,
5163
+ inline = false
5133
5164
  }) {
5134
5165
  const language = useInheritedLanguage(languageProp);
5135
5166
  const copy = LOGIN_COPY[language];
5136
5167
  const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
5137
- return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
5138
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": copy.close, children: /* @__PURE__ */ jsx(
5139
- "svg",
5140
- {
5141
- width: "18",
5142
- height: "18",
5143
- viewBox: "0 0 24 24",
5144
- fill: "none",
5145
- stroke: "currentColor",
5146
- strokeWidth: "2.5",
5147
- strokeLinecap: "round",
5148
- strokeLinejoin: "round",
5149
- children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
5150
- }
5151
- ) }),
5152
- /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
5153
- /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx(ModalLogo, { logoUrl }) }),
5154
- /* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
5155
- /* @__PURE__ */ jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
5156
- ] }),
5157
- status === "loading" ? /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
5158
- /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
5159
- /* @__PURE__ */ jsx("span", { children: copy.loading })
5160
- ] }) : /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
5161
- /* @__PURE__ */ jsx("p", { className: "pollar-modal-error", children: copy.loadError }),
5162
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: copy.tryAgain })
5163
- ] }),
5164
- /* @__PURE__ */ jsx(PollarModalFooter, {})
5165
- ] });
5168
+ return /* @__PURE__ */ jsxs(
5169
+ "div",
5170
+ {
5171
+ className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
5172
+ style: cssVars,
5173
+ onClick: (e) => e.stopPropagation(),
5174
+ children: [
5175
+ !inline && /* @__PURE__ */ jsx(CloseButton, { onClick: onCancel, label: copy.close }),
5176
+ /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
5177
+ /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx(ModalLogo, { logoUrl }) }),
5178
+ /* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
5179
+ /* @__PURE__ */ jsx("p", { className: "pollar-subtitle", children: copy.subtitle })
5180
+ ] }),
5181
+ status === "loading" ? /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
5182
+ /* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
5183
+ /* @__PURE__ */ jsx("span", { children: copy.loading })
5184
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
5185
+ /* @__PURE__ */ jsx("p", { className: "pollar-modal-error", children: copy.loadError }),
5186
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: copy.tryAgain })
5187
+ ] }),
5188
+ /* @__PURE__ */ jsx(PollarModalFooter, {})
5189
+ ]
5190
+ }
5191
+ );
5166
5192
  }
5167
5193
  function PrivyLoginSubmodal({
5168
5194
  adapter,
@@ -5174,7 +5200,8 @@ function PrivyLoginSubmodal({
5174
5200
  onBack,
5175
5201
  onCancel,
5176
5202
  onAuthenticated,
5177
- language
5203
+ language,
5204
+ inline = false
5178
5205
  }) {
5179
5206
  const copy = LOGIN_COPY[language];
5180
5207
  const options = useMemo(() => adapter.getAuthOptions(), [adapter]);
@@ -5238,70 +5265,65 @@ function PrivyLoginSubmodal({
5238
5265
  const showEmail = options.includes("email");
5239
5266
  const showGoogle = options.includes("google");
5240
5267
  const showGithub = options.includes("github");
5241
- return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
5242
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": copy.close, children: /* @__PURE__ */ jsx(
5243
- "svg",
5244
- {
5245
- width: "18",
5246
- height: "18",
5247
- viewBox: "0 0 24 24",
5248
- fill: "none",
5249
- stroke: "currentColor",
5250
- strokeWidth: "2.5",
5251
- strokeLinecap: "round",
5252
- strokeLinejoin: "round",
5253
- children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
5254
- }
5255
- ) }),
5256
- /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
5257
- /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx(ModalLogo, { logoUrl }) }),
5258
- /* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
5259
- /* @__PURE__ */ jsx("p", { className: "pollar-subtitle", children: adapter.meta.label })
5260
- ] }),
5261
- view === "email-code" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5262
- /* @__PURE__ */ jsx(BackButton, { onClick: () => setView("root") }),
5263
- /* @__PURE__ */ jsx(EmailCodeInput, { email, onSubmit: handleCodeSubmit, language })
5264
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5265
- /* @__PURE__ */ jsx(BackButton, { onClick: onBack }),
5266
- showEmail && /* @__PURE__ */ jsxs("div", { className: "pollar-email-section", children: [
5267
- /* @__PURE__ */ jsx(
5268
- "input",
5269
- {
5270
- type: "email",
5271
- placeholder: copy.emailPlaceholder,
5272
- value: email,
5273
- disabled: isLoading,
5274
- className: "pollar-input",
5275
- onChange: (e) => setEmail(e.target.value),
5276
- onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
5277
- }
5278
- ),
5279
- /* @__PURE__ */ jsx(
5280
- "button",
5281
- {
5282
- type: "button",
5283
- disabled: isLoading || !email,
5284
- className: "pollar-btn-primary",
5285
- style: { marginTop: "0.75rem" },
5286
- onClick: handleEmailSubmit,
5287
- children: copy.submit
5288
- }
5289
- )
5290
- ] }),
5291
- showEmail && (showGoogle || showGithub) && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
5292
- /* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
5293
- /* @__PURE__ */ jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5294
- ] }),
5295
- (showGoogle || showGithub) && /* @__PURE__ */ jsxs("div", { className: "pollar-social-list", children: [
5296
- showGoogle && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => handleOAuth("google") }),
5297
- showGithub && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => handleOAuth("github") })
5298
- ] })
5299
- ] }),
5300
- /* @__PURE__ */ jsx(ModalStatusBanner, { message, status, onCancel, onRetry: void 0 }),
5301
- /* @__PURE__ */ jsx(PollarModalFooter, {})
5302
- ] });
5268
+ return /* @__PURE__ */ jsxs(
5269
+ "div",
5270
+ {
5271
+ className: `pollar-modal-card pollar-modal ${inline ? "pollar-modal-card--inline" : ""}`,
5272
+ style: cssVars,
5273
+ onClick: (e) => e.stopPropagation(),
5274
+ children: [
5275
+ !inline && /* @__PURE__ */ jsx(CloseButton, { onClick: onCancel, label: copy.close }),
5276
+ /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
5277
+ /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx(ModalLogo, { logoUrl }) }),
5278
+ /* @__PURE__ */ jsx("h2", { className: "pollar-title", children: appName }),
5279
+ /* @__PURE__ */ jsx("p", { className: "pollar-subtitle", children: adapter.meta.label })
5280
+ ] }),
5281
+ view === "email-code" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5282
+ /* @__PURE__ */ jsx(BackButton, { onClick: () => setView("root") }),
5283
+ /* @__PURE__ */ jsx(EmailCodeInput, { email, onSubmit: handleCodeSubmit, language })
5284
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5285
+ /* @__PURE__ */ jsx(BackButton, { onClick: onBack }),
5286
+ showEmail && /* @__PURE__ */ jsxs("div", { className: "pollar-email-section", children: [
5287
+ /* @__PURE__ */ jsx(
5288
+ "input",
5289
+ {
5290
+ type: "email",
5291
+ placeholder: copy.emailPlaceholder,
5292
+ value: email,
5293
+ disabled: isLoading,
5294
+ className: "pollar-input",
5295
+ onChange: (e) => setEmail(e.target.value),
5296
+ onKeyDown: (e) => e.key === "Enter" && handleEmailSubmit()
5297
+ }
5298
+ ),
5299
+ /* @__PURE__ */ jsx(
5300
+ "button",
5301
+ {
5302
+ type: "button",
5303
+ disabled: isLoading || !email,
5304
+ className: "pollar-btn-primary",
5305
+ style: { marginTop: "0.75rem" },
5306
+ onClick: handleEmailSubmit,
5307
+ children: copy.submit
5308
+ }
5309
+ )
5310
+ ] }),
5311
+ showEmail && (showGoogle || showGithub) && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
5312
+ /* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
5313
+ /* @__PURE__ */ jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsx("span", { className: "pollar-divider-text", children: copy.orContinueWith }) })
5314
+ ] }),
5315
+ (showGoogle || showGithub) && /* @__PURE__ */ jsxs("div", { className: "pollar-social-list", children: [
5316
+ showGoogle && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => handleOAuth("google") }),
5317
+ showGithub && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => handleOAuth("github") })
5318
+ ] })
5319
+ ] }),
5320
+ /* @__PURE__ */ jsx(ModalStatusBanner, { message, status, onCancel, onRetry: void 0 }),
5321
+ /* @__PURE__ */ jsx(PollarModalFooter, {})
5322
+ ]
5323
+ }
5324
+ );
5303
5325
  }
5304
- function LoginModal({ onClose }) {
5326
+ function LoginModal({ onClose, inline = false }) {
5305
5327
  const [email, setEmail] = useState("");
5306
5328
  const { getClient, styles, appConfig: config, configStatus, retryConfig } = usePollar();
5307
5329
  const [authState, setAuthState] = useState(() => getClient().getAuthState());
@@ -5396,7 +5418,7 @@ function LoginModal({ onClose }) {
5396
5418
  getClient().login({ provider });
5397
5419
  }
5398
5420
  }
5399
- return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: handleClose, children: configStatus !== "ready" ? /* @__PURE__ */ jsx(
5421
+ return /* @__PURE__ */ jsx(ModalFrame, { inline, overlayStyle, onClose: handleClose, children: configStatus !== "ready" ? /* @__PURE__ */ jsx(
5400
5422
  LoginModalStatus,
5401
5423
  {
5402
5424
  status: configStatus === "error" ? "error" : "loading",
@@ -5407,7 +5429,8 @@ function LoginModal({ onClose }) {
5407
5429
  appName: modalTitle,
5408
5430
  onRetry: retryConfig,
5409
5431
  onCancel: handleClose,
5410
- language
5432
+ language,
5433
+ inline
5411
5434
  }
5412
5435
  ) : interactiveAdapter ? /* @__PURE__ */ jsx(
5413
5436
  PrivyLoginSubmodal,
@@ -5421,7 +5444,8 @@ function LoginModal({ onClose }) {
5421
5444
  onBack: () => setInteractiveAdapter(null),
5422
5445
  onCancel: handleClose,
5423
5446
  onAuthenticated: handleInteractiveAuthenticated,
5424
- language
5447
+ language,
5448
+ inline
5425
5449
  }
5426
5450
  ) : /* @__PURE__ */ jsx(
5427
5451
  LoginModalTemplate,
@@ -5455,7 +5479,8 @@ function LoginModal({ onClose }) {
5455
5479
  onBack: handleBack,
5456
5480
  onCancel: handleClose,
5457
5481
  onRetry: handleRetry,
5458
- language
5482
+ language,
5483
+ inline
5459
5484
  }
5460
5485
  ) });
5461
5486
  }
@@ -6788,6 +6813,7 @@ var REGISTRY_COPY = {
6788
6813
  rejected: "The registry did not confirm: {fields}. Check how they are written and try again.",
6789
6814
  loadError: "Could not load your details. Please try again.",
6790
6815
  submitError: "Could not check your details. Please try again.",
6816
+ registryDown: "The civil registry is not responding right now. Please try again in a few minutes.",
6791
6817
  step: "Step {n} of {total}"
6792
6818
  },
6793
6819
  es: {
@@ -6810,6 +6836,7 @@ var REGISTRY_COPY = {
6810
6836
  rejected: "El registro no confirm\xF3: {fields}. Revisa c\xF3mo est\xE1n escritos e intenta de nuevo.",
6811
6837
  loadError: "No se pudieron cargar tus datos. Intenta de nuevo.",
6812
6838
  submitError: "No se pudieron validar tus datos. Intenta de nuevo.",
6839
+ registryDown: "El registro civil no responde en este momento. Intenta de nuevo en unos minutos.",
6813
6840
  step: "Paso {n} de {total}"
6814
6841
  },
6815
6842
  pt: {
@@ -6832,6 +6859,7 @@ var REGISTRY_COPY = {
6832
6859
  rejected: "O registro n\xE3o confirmou: {fields}. Verifique como est\xE3o escritos e tente novamente.",
6833
6860
  loadError: "N\xE3o foi poss\xEDvel carregar seus dados. Tente novamente.",
6834
6861
  submitError: "N\xE3o foi poss\xEDvel validar seus dados. Tente novamente.",
6862
+ registryDown: "O registro civil n\xE3o est\xE1 respondendo agora. Tente novamente em alguns minutos.",
6835
6863
  step: "Passo {n} de {total}"
6836
6864
  }
6837
6865
  };
@@ -6994,6 +7022,10 @@ var errorBody = (error) => {
6994
7022
  const body = typeof error === "object" && error !== null && "body" in error ? error.body : void 0;
6995
7023
  return typeof body === "object" && body !== null ? body : void 0;
6996
7024
  };
7025
+ var isRegistryDown = (error) => {
7026
+ const body = errorBody(error);
7027
+ return errorCode(error) === "SDK_KYC_PROVIDER_ERROR" && !!body && "retryable" in body && body.retryable === true;
7028
+ };
6997
7029
  function missingFieldsOf(error) {
6998
7030
  const body = errorBody(error);
6999
7031
  const missing = body && "missing" in body ? body.missing : void 0;
@@ -7088,6 +7120,7 @@ function RegistryCheckModal({
7088
7120
  if (code === "KYC_REGISTRY_NAME_MISMATCH") {
7089
7121
  setError(copy.nameMismatch.replace("{full}", [prefill.surname1, prefill.surname2].filter(Boolean).join(" ")));
7090
7122
  } else if (code === "SDK_KYC_UNDER_REVIEW") setReview(true);
7123
+ else if (isRegistryDown(e)) setError(copy.registryDown);
7091
7124
  else setError(copy.submitError);
7092
7125
  } finally {
7093
7126
  if (mounted.current) setSubmitting(false);
@@ -8016,7 +8049,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
8016
8049
  onRequote: () => void handleRequote(),
8017
8050
  onSetUpRecovery: openRecoveryModal,
8018
8051
  recoveryMissing: recovery === null ? null : recoveryLocked,
8019
- support: client.getSupportContact(),
8052
+ support: rampSupportContact(client.getSupportContact(), appConfig.application?.support),
8020
8053
  pollTrouble,
8021
8054
  checkingPayment: paymentCheckUntil !== null,
8022
8055
  onCheckPayment: () => void handleCheckPayment(),
@@ -9213,6 +9246,7 @@ function SendModal({ onClose, initial }) {
9213
9246
  const copy = SEND_COPY[language];
9214
9247
  const [step, setStep] = useState("form");
9215
9248
  const confirmation = useInlineConfirmation(step === "tx");
9249
+ const { track, declineOnClose } = useDeclineOnClose(confirmation);
9216
9250
  const [createsAccount, setCreatesAccount] = useState(false);
9217
9251
  const [checkingDestination, setCheckingDestination] = useState(false);
9218
9252
  const [amount, setAmount] = useState(() => seededAmount(initial?.amount));
@@ -9344,14 +9378,16 @@ function SendModal({ onClose, initial }) {
9344
9378
  setCreatesAccount(false);
9345
9379
  setStep("tx");
9346
9380
  if (selectedChain === "SOLANA" || selectedChain === "POLYGON") {
9347
- await sendPayment({
9348
- chain: selectedChain,
9349
- destination: destination.trim(),
9350
- amount: sendAmount,
9351
- // A native coin carries no token id; an SPL mint or ERC-20 contract rides
9352
- // in `issuer`, which the guard above proved is present.
9353
- ...isNativeAsset ? {} : { mint: selectedAsset.issuer }
9354
- });
9381
+ await track(
9382
+ sendPayment({
9383
+ chain: selectedChain,
9384
+ destination: destination.trim(),
9385
+ amount: sendAmount,
9386
+ // A native coin carries no token id; an SPL mint or ERC-20 contract rides
9387
+ // in `issuer`, which the guard above proved is present.
9388
+ ...isNativeAsset ? {} : { mint: selectedAsset.issuer }
9389
+ })
9390
+ );
9355
9391
  return;
9356
9392
  }
9357
9393
  await buildTx(
@@ -9373,7 +9409,7 @@ function SendModal({ onClose, initial }) {
9373
9409
  }
9374
9410
  function handleSignAndSend() {
9375
9411
  if (transaction.step === "built") {
9376
- void signAndSubmitTx(transaction.buildData.unsignedXdr);
9412
+ void track(signAndSubmitTx(transaction.buildData.unsignedXdr));
9377
9413
  }
9378
9414
  }
9379
9415
  function handleMax() {
@@ -9420,16 +9456,20 @@ function SendModal({ onClose, initial }) {
9420
9456
  }
9421
9457
  async function handleRetry() {
9422
9458
  if (transaction.step === "error" && transaction.buildData) {
9423
- await signAndSubmitTx(transaction.buildData.unsignedXdr);
9459
+ await track(signAndSubmitTx(transaction.buildData.unsignedXdr));
9424
9460
  }
9425
9461
  }
9462
+ function handleClose() {
9463
+ declineOnClose();
9464
+ onClose();
9465
+ }
9426
9466
  function handleBack() {
9427
9467
  setStep("form");
9428
9468
  setCreatesAccount(false);
9429
9469
  setShowXdr(false);
9430
9470
  setCopied(false);
9431
9471
  }
9432
- return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
9472
+ return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsx(
9433
9473
  SendModalTemplate,
9434
9474
  {
9435
9475
  theme,
@@ -9458,7 +9498,7 @@ function SendModal({ onClose, initial }) {
9458
9498
  walletType,
9459
9499
  showBack,
9460
9500
  isInProgress,
9461
- onClose,
9501
+ onClose: handleClose,
9462
9502
  onBack: handleBack,
9463
9503
  onRefresh: () => void refreshWalletBalance(),
9464
9504
  onSelectAsset: setSelectedAsset,
@@ -10260,6 +10300,7 @@ function SwapModal({ onClose, initial }) {
10260
10300
  const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
10261
10301
  const [step, setStep] = useState("form");
10262
10302
  const confirmation = useInlineConfirmation(step === "tx");
10303
+ const { track, declineOnClose } = useDeclineOnClose(confirmation);
10263
10304
  const [selectedSell, setSelectedSell] = useState(null);
10264
10305
  const [selectedBuy, setSelectedBuy] = useState(null);
10265
10306
  const [amount, setAmount] = useState(() => seededAmount(initial?.amount));
@@ -10685,7 +10726,7 @@ function SwapModal({ onClose, initial }) {
10685
10726
  setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
10686
10727
  setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
10687
10728
  setStep("tx");
10688
- await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
10729
+ await track(swapSolana(solanaQuote, { slippageBps, idempotencyKey: key }));
10689
10730
  return;
10690
10731
  }
10691
10732
  if (!quote) {
@@ -10694,7 +10735,7 @@ function SwapModal({ onClose, initial }) {
10694
10735
  }
10695
10736
  setSentSolana(null);
10696
10737
  setStep("tx");
10697
- await swap(quote);
10738
+ await track(swap(quote));
10698
10739
  }
10699
10740
  async function handleRetry() {
10700
10741
  if (transaction.step !== "error") return;
@@ -10704,10 +10745,10 @@ function SwapModal({ onClose, initial }) {
10704
10745
  const toward = solanaQuote.destinationChain;
10705
10746
  setSettlement(toward && toward !== "SOLANA" ? { key, chain: toward, value: null } : null);
10706
10747
  if (selectedSell && selectedBuy) setSentSolana({ quote: solanaQuote, sell: selectedSell, buy: selectedBuy });
10707
- await swapSolana(solanaQuote, { slippageBps, idempotencyKey: key });
10748
+ await track(swapSolana(solanaQuote, { slippageBps, idempotencyKey: key }));
10708
10749
  return;
10709
10750
  }
10710
- if (quote) await swap(quote);
10751
+ if (quote) await track(swap(quote));
10711
10752
  }
10712
10753
  function handleMax() {
10713
10754
  if (selectedSell?.available !== void 0) setAmount(selectedSell.available);
@@ -10731,6 +10772,10 @@ function SwapModal({ onClose, initial }) {
10731
10772
  }, 2e3);
10732
10773
  });
10733
10774
  }
10775
+ function handleClose() {
10776
+ declineOnClose();
10777
+ onClose();
10778
+ }
10734
10779
  function handleBack() {
10735
10780
  setSettlement(null);
10736
10781
  setSentSolana(null);
@@ -10738,7 +10783,7 @@ function SwapModal({ onClose, initial }) {
10738
10783
  setShowXdr(false);
10739
10784
  setCopied(false);
10740
10785
  }
10741
- return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
10786
+ return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsx(
10742
10787
  SwapModalTemplate,
10743
10788
  {
10744
10789
  theme,
@@ -10779,7 +10824,7 @@ function SwapModal({ onClose, initial }) {
10779
10824
  showBack,
10780
10825
  isInProgress,
10781
10826
  language,
10782
- onClose,
10827
+ onClose: handleClose,
10783
10828
  onBack: handleBack,
10784
10829
  onRefresh: handleRefresh,
10785
10830
  onSelectSell: (option) => {
@@ -11681,6 +11726,7 @@ function EarnModal({ onClose, initial }) {
11681
11726
  const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
11682
11727
  const [step, setStep] = useState("form");
11683
11728
  const confirmation = useInlineConfirmation(step === "tx");
11729
+ const { track, declineOnClose } = useDeclineOnClose(confirmation);
11684
11730
  const [tab, setTab] = useState(
11685
11731
  () => oneOf(["deposit", "withdraw"], initial?.tab) ?? "deposit"
11686
11732
  );
@@ -11853,7 +11899,7 @@ function EarnModal({ onClose, initial }) {
11853
11899
  });
11854
11900
  setStep("tx");
11855
11901
  if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
11856
- const tl = await setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer });
11902
+ const tl = await track(setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer }));
11857
11903
  if (tl.status === "error") {
11858
11904
  setFormError(copy.trustlineFailed(assetCode, tl.details ?? copy.unknownError));
11859
11905
  setStep("form");
@@ -11872,11 +11918,15 @@ function EarnModal({ onClose, initial }) {
11872
11918
  function runEarn() {
11873
11919
  if (onSolana) {
11874
11920
  const params2 = { opportunity: opportunityId, amount };
11875
- return tab === "deposit" ? earnSolanaDeposit(params2) : earnSolanaWithdraw(params2);
11921
+ return track(tab === "deposit" ? earnSolanaDeposit(params2) : earnSolanaWithdraw(params2));
11876
11922
  }
11877
11923
  if (!provider) return null;
11878
11924
  const params = { provider, opportunity: opportunityId, amount };
11879
- return tab === "deposit" ? earnDeposit(params) : earnWithdraw(params);
11925
+ return track(tab === "deposit" ? earnDeposit(params) : earnWithdraw(params));
11926
+ }
11927
+ function handleClose() {
11928
+ declineOnClose();
11929
+ onClose();
11880
11930
  }
11881
11931
  async function handleRetry() {
11882
11932
  if (transaction.step !== "error" || !opportunityId) return;
@@ -11958,7 +12008,7 @@ function EarnModal({ onClose, initial }) {
11958
12008
  rows: [{ label: copy.yourPosition, value: position.balance }]
11959
12009
  }
11960
12010
  ) : null;
11961
- return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxs(
12011
+ return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? handleClose : void 0, children: /* @__PURE__ */ jsxs(
11962
12012
  "div",
11963
12013
  {
11964
12014
  className: "pollar-modal-card pollar-send-modal",
@@ -12032,7 +12082,7 @@ function EarnModal({ onClose, initial }) {
12032
12082
  )
12033
12083
  }
12034
12084
  ),
12035
- !isInProgress && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
12085
+ !isInProgress && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
12036
12086
  ] })
12037
12087
  ] }),
12038
12088
  step === "form" && earnUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: copy.unavailable }),
@@ -17445,7 +17495,12 @@ function KycFlow({ onApproved, country, level }) {
17445
17495
  }
17446
17496
  );
17447
17497
  }
17498
+ var stay2 = () => {
17499
+ };
17500
+ function LoginFlow() {
17501
+ return /* @__PURE__ */ jsx(LoginModal, { inline: true, onClose: stay2 });
17502
+ }
17448
17503
 
17449
- export { BridgeModal, BridgeModalTemplate, CardModal, ChainSelect, CosignModal, CosignModalTemplate, CustodyMigrationModal, CustodyMigrationModalTemplate, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, KycFlow, KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, ProviderRegistrationModal, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RecoveryModal, RecoveryModalTemplate, RegistryCheckModal, RejectedRouteDisplay, RequirementFormModal, RouteDisplay, SendModal, SendModalTemplate, SessionsModal, SessionsModalTemplate, SwapModal, SwapModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, WalletButtonTemplate, addressForChain, browserPasskeyCeremony, browserPasskeySigner, browserRecoveryPasskey, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
17504
+ export { BridgeModal, BridgeModalTemplate, CardModal, ChainSelect, CosignModal, CosignModalTemplate, CustodyMigrationModal, CustodyMigrationModalTemplate, DistributionRulesModal, DistributionRulesModalTemplate, EarnModal, EnabledAssetsModal, EnabledAssetsModalTemplate, KycFlow, KycModal, KycModalTemplate, KycStatus, LoginFlow, LoginModalTemplate, PollarProvider, ProviderRegistrationModal, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RecoveryModal, RecoveryModalTemplate, RegistryCheckModal, RejectedRouteDisplay, RequirementFormModal, RouteDisplay, SendModal, SendModalTemplate, SessionsModal, SessionsModalTemplate, SwapModal, SwapModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, WalletButtonTemplate, addressForChain, browserPasskeyCeremony, browserPasskeySigner, browserRecoveryPasskey, buildModalCssVars, chainsOf, createPollarAdapterHook, modalChrome, readableTextOn, resolveChain, useChains, useCosign, usePollar, walletNotReadyReason };
17450
17505
  //# sourceMappingURL=index.mjs.map
17451
17506
  //# sourceMappingURL=index.mjs.map