@pollar/react 0.4.5 → 0.5.2

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
@@ -9,7 +9,6 @@ var jsxRuntime = require('react/jsx-runtime');
9
9
 
10
10
  // src/constants.ts
11
11
  var LOGO_POLLAR = "https://pollar.xyz/assets/logo_pollar.png";
12
- var LOGO_GITHUB = "https://pollar.xyz/assets/GitHub_Invertocat_White.png";
13
12
  var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
14
13
  var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
15
14
  var ModalErrorBoundary = class extends react.Component {
@@ -39,40 +38,180 @@ var PollarModalFooter = () => {
39
38
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
40
39
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
41
40
  "v",
42
- "0.4.4"
41
+ "0.5.2"
43
42
  ] })
44
43
  ] })
45
44
  ] });
46
45
  };
47
- var TRANSACTION_CODE_MESSAGES = {
48
- NONE: "",
49
- BUILD_TRANSACTION_START: "Building transaction\u2026",
50
- BUILD_TRANSACTION_SUCCESS: "Transaction built, ready to sign and send",
51
- BUILD_TRANSACTION_ERROR: "Failed to build transaction",
52
- BUILD_TRANSACTION_ERROR_NO_WALLET: "No wallet connected",
53
- SIGN_SEND_TRANSACTION_START: "Signing and sending transaction\u2026",
54
- SIGN_SEND_TRANSACTION_SUCCESS: "Transaction signed",
55
- SIGN_SEND_TRANSACTION_ERROR: "Signing rejected"
56
- };
57
46
  function ModalStatusBanner({ message, status, onCancel, onRetry }) {
58
- if (!message && status === core.StateStatus.NONE) {
47
+ if (!message && status === "NONE") {
59
48
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-status" });
60
49
  }
61
- const isLoading = status === core.StateStatus.LOADING;
50
+ const isLoading = status === "LOADING";
62
51
  const icon = status === "ERROR" ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
63
52
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
64
53
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 4.5l5 5M9.5 4.5l-5 5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round" })
65
54
  ] }) : status === "SUCCESS" ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
66
55
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
67
56
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
68
- ] }) : status === "LOADING" ? /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "5.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeDasharray: "22 10" }) }) : null;
57
+ ] }) : status === "LOADING" ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) : null;
69
58
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-status", "data-kind": status, children: [
70
59
  icon,
71
60
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: message }),
72
61
  isLoading && onCancel && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-status-cancel", onClick: onCancel, children: "Cancel" }),
73
- status === core.StateStatus.ERROR && onRetry && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-status-cancel", onClick: onRetry, children: "Retry" })
62
+ status === "ERROR" && onRetry && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-status-cancel", onClick: onRetry, children: "Retry" })
74
63
  ] });
75
64
  }
65
+ var STATUS_CONFIG = {
66
+ none: { label: "Not started", color: "#6b7280", dot: false },
67
+ pending: { label: "Pending review", color: "#f59e0b", dot: true },
68
+ approved: { label: "Verified", color: "#10b981", dot: false },
69
+ rejected: { label: "Rejected", color: "#ef4444", dot: false }
70
+ };
71
+ function KycStatus({ status, className }) {
72
+ const config = STATUS_CONFIG[status] ?? STATUS_CONFIG.none;
73
+ return /* @__PURE__ */ jsxRuntime.jsxs(
74
+ "span",
75
+ {
76
+ className: `pollar-kyc-badge${className ? ` ${className}` : ""}`,
77
+ style: { "--pollar-kyc-color": config.color },
78
+ children: [
79
+ config.dot && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-badge-dot" }),
80
+ config.label
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ function KycModalTemplate({
86
+ theme,
87
+ accentColor,
88
+ step,
89
+ providers,
90
+ selectedProvider,
91
+ session,
92
+ kycStatus,
93
+ isLoading,
94
+ onSelectProvider,
95
+ onDoneVerifying,
96
+ onClose
97
+ }) {
98
+ const isDark = theme === "dark";
99
+ const cssVars = {
100
+ "--pollar-accent": accentColor,
101
+ "--pollar-buttons-border-radius": "6px",
102
+ "--pollar-buttons-height": "44px",
103
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
104
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
105
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
106
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
107
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
108
+ };
109
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
110
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-header", children: [
111
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
112
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-kyc-subtitle", children: [
113
+ step === "select_provider" && "Choose your verification provider",
114
+ step === "verifying" && `Verifying with ${selectedProvider?.name}`,
115
+ step === "polling" && "Waiting for verification result",
116
+ step === "done" && "Verification complete"
117
+ ] })
118
+ ] }),
119
+ step === "select_provider" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-providers", children: [
120
+ providers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "var(--pollar-muted)", textAlign: "center" }, children: "No providers available for your country." }),
121
+ providers.map((p) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-kyc-provider-btn", disabled: isLoading, onClick: () => onSelectProvider(p), children: [
122
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-name", children: p.name }),
123
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-flow", children: p.flow })
124
+ ] }, p.id))
125
+ ] }),
126
+ step === "verifying" && selectedProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
127
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-kyc-iframe-wrap", children: session?.kycUrl ? /* @__PURE__ */ jsxRuntime.jsx("iframe", { className: "pollar-kyc-iframe", src: session.kycUrl, title: "KYC verification", allow: "camera; microphone" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-iframe-mock", children: [
128
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u{1F512}" }),
129
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedProvider.flow === "form" ? "Form-based KYC \u2014 fields will render here once backend is connected" : "KYC iframe will load here once backend is connected" }),
130
+ /* @__PURE__ */ jsxRuntime.jsxs("code", { style: { fontSize: "0.7rem", opacity: 0.6 }, children: [
131
+ "provider: ",
132
+ selectedProvider.id
133
+ ] })
134
+ ] }) }),
135
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
136
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
137
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onDoneVerifying, children: "I've completed verification" })
138
+ ] })
139
+ ] }),
140
+ step === "polling" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-polling", children: [
141
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
142
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-kyc-polling-text", children: "Checking verification status\u2026" })
143
+ ] }),
144
+ step === "done" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-result", children: [
145
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-result-icon", children: kycStatus === "approved" ? "\u2705" : "\u274C" }),
146
+ /* @__PURE__ */ jsxRuntime.jsx(KycStatus, { status: kycStatus }),
147
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-kyc-result-text", children: kycStatus === "approved" ? "Your identity has been verified successfully." : "Verification was not approved. Please try again." }),
148
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: "Close" }) })
149
+ ] })
150
+ ] });
151
+ }
152
+ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
153
+ const { getClient, styles } = usePollar();
154
+ const [step, setStep] = react.useState("select_provider");
155
+ const [providers, setProviders] = react.useState([]);
156
+ const [selectedProvider, setSelectedProvider] = react.useState(null);
157
+ const [session, setSession] = react.useState(null);
158
+ const [kycStatus, setKycStatus] = react.useState("none");
159
+ const [isLoading, setIsLoading] = react.useState(false);
160
+ const client = getClient();
161
+ const { theme = "light", accentColor = "#005DB4" } = styles;
162
+ react.useEffect(() => {
163
+ setIsLoading(true);
164
+ client.getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
165
+ }, [country]);
166
+ async function handleSelectProvider(provider) {
167
+ setSelectedProvider(provider);
168
+ setIsLoading(true);
169
+ try {
170
+ const result = await client.resolveKyc(provider.id, level);
171
+ if (result.alreadyApproved) {
172
+ setKycStatus("approved");
173
+ setStep("done");
174
+ onApproved?.();
175
+ return;
176
+ }
177
+ setSession(result);
178
+ setStep("verifying");
179
+ } catch {
180
+ setStep("select_provider");
181
+ } finally {
182
+ setIsLoading(false);
183
+ }
184
+ }
185
+ async function handleDoneVerifying() {
186
+ if (!selectedProvider) return;
187
+ setStep("polling");
188
+ try {
189
+ const finalStatus = await client.pollKycStatus(selectedProvider.id, { intervalMs: 3e3, timeoutMs: 12e4 });
190
+ setKycStatus(finalStatus);
191
+ setStep("done");
192
+ if (finalStatus === "approved") onApproved?.();
193
+ } catch {
194
+ setKycStatus("rejected");
195
+ setStep("done");
196
+ }
197
+ }
198
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
199
+ KycModalTemplate,
200
+ {
201
+ theme,
202
+ accentColor,
203
+ step,
204
+ providers,
205
+ selectedProvider,
206
+ session,
207
+ kycStatus,
208
+ isLoading,
209
+ onSelectProvider: handleSelectProvider,
210
+ onDoneVerifying: handleDoneVerifying,
211
+ onClose
212
+ }
213
+ ) });
214
+ }
76
215
  function EmailCodeInput({ email, onSubmit }) {
77
216
  const [digits, setDigits] = react.useState(["", "", "", "", "", ""]);
78
217
  const inputRefs = react.useRef([]);
@@ -126,8 +265,8 @@ function EmailCodeInput({ email, onSubmit }) {
126
265
  }
127
266
  var GithubButton = ({ disabled, onClick }) => {
128
267
  return /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "github-button", disabled, onClick, children: [
129
- /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_GITHUB, alt: "GitHub", className: "github-button-icon" }),
130
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "github-button-contents", children: "Continue with GitHub" })
268
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "github-button-icon", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z", clipRule: "evenodd" }) }),
269
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "github-button-contents", children: "GitHub" })
131
270
  ] });
132
271
  };
133
272
  var GoogleButton = ({ disabled, onClick }) => {
@@ -174,8 +313,8 @@ var GoogleButton = ({ disabled, onClick }) => {
174
313
  ]
175
314
  }
176
315
  ) }),
177
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gsi-material-button-contents", children: "Continue with Google" }),
178
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: "Continue with Google" })
316
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gsi-material-button-contents", children: "Google" }),
317
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { display: "none" }, children: "Google" })
179
318
  ] })
180
319
  ] });
181
320
  };
@@ -206,10 +345,10 @@ function authStateToStatus(step) {
206
345
  ];
207
346
  const success = ["authenticated", "entering_code"];
208
347
  const error = ["error", "wallet_not_installed"];
209
- if (loading.includes(step)) return core.StateStatus.LOADING;
210
- if (success.includes(step)) return core.StateStatus.SUCCESS;
211
- if (error.includes(step)) return core.StateStatus.ERROR;
212
- return core.StateStatus.NONE;
348
+ if (loading.includes(step)) return "LOADING";
349
+ if (success.includes(step)) return "SUCCESS";
350
+ if (error.includes(step)) return "ERROR";
351
+ return "NONE";
213
352
  }
214
353
  function LoginModalTemplate({
215
354
  theme,
@@ -232,6 +371,7 @@ function LoginModalTemplate({
232
371
  onCancel,
233
372
  onRetry
234
373
  }) {
374
+ const [showWalletPicker, setShowWalletPicker] = react.useState(false);
235
375
  const isDark = theme === "dark";
236
376
  const enabledSocial = Object.entries(providers).filter(([, enabled]) => enabled);
237
377
  const cssVars = {
@@ -248,20 +388,52 @@ function LoginModalTemplate({
248
388
  "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
249
389
  };
250
390
  const status = authStateToStatus(authState.step);
251
- const isLoading = status === core.StateStatus.LOADING;
391
+ const isLoading = status === "LOADING";
252
392
  const isEmailCodeError = authState.step === "error" && (authState.errorCode === core.AUTH_ERROR_CODES.EMAIL_CODE_EXPIRED || authState.errorCode === core.AUTH_ERROR_CODES.EMAIL_CODE_INVALID);
253
393
  const awaitingEmailCode = authState.step === "entering_code" || authState.step === "verifying_email_code" || isEmailCodeError;
254
394
  const statusMessage = authState.step === "error" ? authState.message : AUTH_STATE_MESSAGES[authState.step];
395
+ const BackButton = ({ onClick }) => /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 19l-7-7 7-7" }) }) });
255
396
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
397
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) }),
256
398
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
257
399
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoUrl ?? LOGO_POLLAR, alt: "Logo", className: "pollar-logo" }) }),
258
400
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
259
401
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: "Log in or sign up" })
260
402
  ] }),
261
403
  awaitingEmailCode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
262
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-back-btn", onClick: onBack, children: "\u2190 Back" }),
404
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: onBack }),
263
405
  /* @__PURE__ */ jsxRuntime.jsx(EmailCodeInput, { email, onSubmit: onCodeSubmit ?? (() => {
264
406
  }) }, codeInputKey)
407
+ ] }) : showWalletPicker ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
408
+ /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowWalletPicker(false) }),
409
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-list", children: [
410
+ /* @__PURE__ */ jsxRuntime.jsxs(
411
+ "button",
412
+ {
413
+ type: "button",
414
+ disabled: isLoading,
415
+ className: "pollar-wallet-list-btn",
416
+ onClick: onFreighterConnect,
417
+ children: [
418
+ /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_FREIGHTER, alt: "Freighter", className: "pollar-wallet-list-icon" }),
419
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: "Freighter" })
420
+ ]
421
+ }
422
+ ),
423
+ /* @__PURE__ */ jsxRuntime.jsxs(
424
+ "button",
425
+ {
426
+ type: "button",
427
+ disabled: isLoading,
428
+ className: "pollar-wallet-list-btn",
429
+ onClick: onAlbedoConnect,
430
+ children: [
431
+ /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_ALBEDO, alt: "Albedo", className: "pollar-wallet-list-icon" }),
432
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: "Albedo" })
433
+ ]
434
+ }
435
+ )
436
+ ] })
265
437
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
266
438
  emailEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
267
439
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -286,17 +458,19 @@ function LoginModalTemplate({
286
458
  enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsxRuntime.jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
287
459
  enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsxRuntime.jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
288
460
  ] }),
289
- embeddedWallets && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
290
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-wallet-label", children: "Continue with a wallet" }),
291
- /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", disabled: isLoading, className: "pollar-wallet-btn", onClick: onFreighterConnect, children: [
292
- /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_FREIGHTER, alt: "Freighter", className: "pollar-wallet-icon" }),
293
- "Freighter"
294
- ] }),
295
- /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", disabled: isLoading, className: "pollar-wallet-btn", onClick: onAlbedoConnect, children: [
296
- /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_ALBEDO, alt: "Albedo", className: "pollar-wallet-icon" }),
297
- "Albedo"
298
- ] })
299
- ] })
461
+ embeddedWallets && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-section", children: /* @__PURE__ */ jsxRuntime.jsxs(
462
+ "button",
463
+ {
464
+ type: "button",
465
+ disabled: isLoading,
466
+ className: "pollar-wallet-entry-btn",
467
+ onClick: () => setShowWalletPicker(true),
468
+ children: [
469
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", 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" }) }),
470
+ "Wallet"
471
+ ]
472
+ }
473
+ ) })
300
474
  ] }),
301
475
  /* @__PURE__ */ jsxRuntime.jsx(
302
476
  ModalStatusBanner,
@@ -343,7 +517,7 @@ function LoginModal({ onClose }) {
343
517
  getClient().beginEmailLogin();
344
518
  }
345
519
  function handleSocialLogin(provider) {
346
- getClient().loginOAuth(provider);
520
+ getClient().login({ provider });
347
521
  }
348
522
  function handleWalletConnect(type) {
349
523
  getClient().loginWallet(type);
@@ -387,21 +561,336 @@ function LoginModal({ onClose }) {
387
561
  codeInputKey,
388
562
  onCodeSubmit: handleVerifyCode,
389
563
  onBack: handleBack,
390
- onCancel: () => getClient().cancelLogin(),
564
+ onCancel: handleClose,
391
565
  onRetry: handleRetry
392
566
  }
393
567
  ) });
394
568
  }
569
+ var RAIL_LABELS = {
570
+ SPEI: "SPEI (Mexico)",
571
+ PIX: "PIX (Brazil)",
572
+ PSE: "PSE (Colombia)",
573
+ ACH: "ACH (US)"
574
+ };
575
+ function RouteDisplay({ quote, onSelect }) {
576
+ return /* @__PURE__ */ jsxRuntime.jsxs(
577
+ "div",
578
+ {
579
+ className: "pollar-ramp-route-card",
580
+ "data-recommended": quote.recommended,
581
+ role: "button",
582
+ tabIndex: 0,
583
+ onClick: () => onSelect(quote),
584
+ onKeyDown: (e) => e.key === "Enter" && onSelect(quote),
585
+ children: [
586
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-left", children: [
587
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-provider", children: quote.provider }),
588
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-route-meta", children: [
589
+ RAIL_LABELS[quote.rail] ?? quote.rail,
590
+ " \xB7 ",
591
+ quote.protocol,
592
+ " \xB7 ",
593
+ quote.estimatedTime
594
+ ] })
595
+ ] }),
596
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-right", children: [
597
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-route-fee", children: [
598
+ quote.fee,
599
+ "% fee"
600
+ ] }),
601
+ quote.recommended && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-badge", children: "Best rate" })
602
+ ] })
603
+ ]
604
+ }
605
+ );
606
+ }
607
+ var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
608
+ var COUNTRY_CURRENCIES = {
609
+ MX: "MXN",
610
+ BR: "BRL",
611
+ CO: "COP",
612
+ CL: "CLP",
613
+ PE: "PEN",
614
+ AR: "ARS"
615
+ };
616
+ function RampWidgetTemplate({
617
+ theme,
618
+ accentColor,
619
+ step,
620
+ direction,
621
+ amount,
622
+ currency,
623
+ country,
624
+ quotes,
625
+ paymentInstructions,
626
+ isLoading,
627
+ onDirectionChange,
628
+ onAmountChange,
629
+ onCurrencyChange,
630
+ onCountryChange,
631
+ onFindRoute,
632
+ onSelectQuote,
633
+ onCopy,
634
+ onClose
635
+ }) {
636
+ const isDark = theme === "dark";
637
+ const cssVars = {
638
+ "--pollar-accent": accentColor,
639
+ "--pollar-buttons-border-radius": "6px",
640
+ "--pollar-buttons-height": "44px",
641
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
642
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
643
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
644
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
645
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
646
+ };
647
+ const stepTitle = {
648
+ input: direction === "onramp" ? "Buy crypto" : "Sell crypto",
649
+ loading_quote: "Finding best route",
650
+ select_route: "Select provider",
651
+ payment_instructions: "Payment instructions"
652
+ };
653
+ const stepSubtitle = {
654
+ input: direction === "onramp" ? "Enter the amount you want to deposit" : "Enter the amount you want to withdraw",
655
+ loading_quote: "Comparing providers in real time\u2026",
656
+ select_route: "All prices include fees",
657
+ payment_instructions: "Send the exact amount to complete your transaction"
658
+ };
659
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
660
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-header", children: [
661
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-ramp-title", children: stepTitle[step] }),
662
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
663
+ ] }),
664
+ step === "input" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
665
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-tabs", children: [
666
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-ramp-tab", "data-active": direction === "onramp", onClick: () => onDirectionChange("onramp"), children: "Buy" }),
667
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-ramp-tab", "data-active": direction === "offramp", onClick: () => onDirectionChange("offramp"), children: "Sell" })
668
+ ] }),
669
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input-row", children: [
670
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
671
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Amount" }),
672
+ /* @__PURE__ */ jsxRuntime.jsx(
673
+ "input",
674
+ {
675
+ type: "number",
676
+ className: "pollar-ramp-input",
677
+ placeholder: "0.00",
678
+ value: amount,
679
+ min: "0",
680
+ onChange: (e) => onAmountChange(e.target.value)
681
+ }
682
+ )
683
+ ] }),
684
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", style: { maxWidth: 90 }, children: [
685
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Currency" }),
686
+ /* @__PURE__ */ jsxRuntime.jsx(
687
+ "input",
688
+ {
689
+ type: "text",
690
+ className: "pollar-ramp-input",
691
+ placeholder: "MXN",
692
+ value: currency,
693
+ maxLength: 5,
694
+ onChange: (e) => onCurrencyChange(e.target.value.toUpperCase())
695
+ }
696
+ )
697
+ ] })
698
+ ] }),
699
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
700
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Country" }),
701
+ /* @__PURE__ */ jsxRuntime.jsxs(
702
+ "select",
703
+ {
704
+ className: "pollar-ramp-input",
705
+ value: country,
706
+ onChange: (e) => {
707
+ const c = e.target.value;
708
+ onCountryChange(c);
709
+ if (COUNTRY_CURRENCIES[c]) onCurrencyChange(COUNTRY_CURRENCIES[c]);
710
+ },
711
+ children: [
712
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "MX", children: "\u{1F1F2}\u{1F1FD} Mexico" }),
713
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "BR", children: "\u{1F1E7}\u{1F1F7} Brazil" }),
714
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "CO", children: "\u{1F1E8}\u{1F1F4} Colombia" }),
715
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "CL", children: "\u{1F1E8}\u{1F1F1} Chile" }),
716
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "PE", children: "\u{1F1F5}\u{1F1EA} Peru" }),
717
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "AR", children: "\u{1F1E6}\u{1F1F7} Argentina" })
718
+ ]
719
+ }
720
+ )
721
+ ] }),
722
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
723
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
724
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: !amount || isLoading, onClick: onFindRoute, children: "Find best route" })
725
+ ] })
726
+ ] }),
727
+ step === "loading_quote" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading", children: LOADING_STEPS.map((text, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-loading-row", children: [
728
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading-dot" }),
729
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: text })
730
+ ] }, i)) }),
731
+ step === "select_route" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
732
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-list", children: quotes.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx(RouteDisplay, { quote: q, onSelect: onSelectQuote }, i)) }),
733
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" })
734
+ ] }),
735
+ step === "payment_instructions" && paymentInstructions && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment", children: [
736
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-title", children: paymentInstructions.type }),
737
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
738
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: paymentInstructions.type === "CLABE" ? "CLABE number" : paymentInstructions.type === "PIX" ? "PIX key" : "Account number" }),
739
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
740
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: paymentInstructions.value }),
741
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-ramp-copy-btn", onClick: () => onCopy(paymentInstructions.value), children: "Copy" })
742
+ ] })
743
+ ] }),
744
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
745
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Amount to send" }),
746
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
747
+ /* @__PURE__ */ jsxRuntime.jsxs("code", { children: [
748
+ paymentInstructions.amount.toLocaleString(),
749
+ " ",
750
+ paymentInstructions.currency
751
+ ] }),
752
+ /* @__PURE__ */ jsxRuntime.jsx(
753
+ "button",
754
+ {
755
+ type: "button",
756
+ className: "pollar-ramp-copy-btn",
757
+ onClick: () => onCopy(`${paymentInstructions.amount} ${paymentInstructions.currency}`),
758
+ children: "Copy"
759
+ }
760
+ )
761
+ ] })
762
+ ] }),
763
+ paymentInstructions.expiresAt && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-payment-note", children: [
764
+ "Instructions expire at ",
765
+ new Date(paymentInstructions.expiresAt).toLocaleTimeString()
766
+ ] }),
767
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: "Done" })
768
+ ] })
769
+ ] });
770
+ }
771
+ var MOCK_DEFAULT_QUOTES = [
772
+ { quoteId: "meld-default", provider: "Meld", fee: 1.2, feeCurrency: "USD", rate: 1, rail: "ACH", protocol: "REST", estimatedTime: "~20 min", recommended: true }
773
+ ];
774
+ var MOCK_QUOTES = {
775
+ MX: [
776
+ { quoteId: "etherfuse-mx", provider: "Etherfuse", fee: 0.5, feeCurrency: "MXN", rate: 17.2, rail: "SPEI", protocol: "SEP-24", estimatedTime: "~10 min", recommended: true },
777
+ { quoteId: "alfredpay-mx", provider: "AlfredPay", fee: 0.8, feeCurrency: "MXN", rate: 17.1, rail: "SPEI", protocol: "REST", estimatedTime: "~15 min", recommended: false }
778
+ ],
779
+ BR: [{ quoteId: "abroad-br", provider: "Abroad", fee: 0.6, feeCurrency: "BRL", rate: 5.1, rail: "PIX", protocol: "REST", estimatedTime: "~5 min", recommended: true }],
780
+ CO: [
781
+ { quoteId: "abroad-co", provider: "Abroad", fee: 0.7, feeCurrency: "COP", rate: 4100, rail: "PSE", protocol: "REST", estimatedTime: "~10 min", recommended: true },
782
+ { quoteId: "koywe-co", provider: "Koywe", fee: 0.9, feeCurrency: "COP", rate: 4095, rail: "PSE", protocol: "REST", estimatedTime: "~15 min", recommended: false }
783
+ ],
784
+ DEFAULT: MOCK_DEFAULT_QUOTES
785
+ };
786
+ var MOCK_PAYMENT = {
787
+ type: "CLABE",
788
+ value: "646180157088723456",
789
+ amount: 1e3,
790
+ currency: "MXN",
791
+ expiresAt: new Date(Date.now() + 30 * 60 * 1e3).toISOString()
792
+ };
793
+ function RampWidget({ onClose }) {
794
+ const { getClient, walletAddress, styles } = usePollar();
795
+ const [step, setStep] = react.useState("input");
796
+ const [direction, setDirection] = react.useState("onramp");
797
+ const [amount, setAmount] = react.useState("");
798
+ const [currency, setCurrency] = react.useState("MXN");
799
+ const [country, setCountry] = react.useState("MX");
800
+ const [quotes, setQuotes] = react.useState([]);
801
+ const [paymentInstructions, setPaymentInstructions] = react.useState(null);
802
+ const [isLoading, setIsLoading] = react.useState(false);
803
+ const client = getClient();
804
+ const { theme = "light", accentColor = "#005DB4" } = styles;
805
+ async function handleFindRoute() {
806
+ setStep("loading_quote");
807
+ setIsLoading(true);
808
+ try {
809
+ const result = await client.getRampsQuote({
810
+ country,
811
+ amount: Number(amount),
812
+ currency,
813
+ direction
814
+ });
815
+ if (result.quotes) setQuotes(result.quotes);
816
+ } catch {
817
+ await new Promise((r) => setTimeout(r, 1500));
818
+ setQuotes(MOCK_QUOTES[country] ?? MOCK_DEFAULT_QUOTES);
819
+ } finally {
820
+ setIsLoading(false);
821
+ setStep("select_route");
822
+ }
823
+ }
824
+ async function handleSelectQuote(quote) {
825
+ if (!walletAddress) return;
826
+ setIsLoading(true);
827
+ const body = {
828
+ quoteId: `${quote.provider}-${Date.now()}`,
829
+ amount: Number(amount),
830
+ currency,
831
+ country,
832
+ walletAddress
833
+ };
834
+ try {
835
+ const result = await client.createOnRamp(body);
836
+ setPaymentInstructions(result.paymentInstructions);
837
+ } catch {
838
+ await new Promise((r) => setTimeout(r, 800));
839
+ setPaymentInstructions({ ...MOCK_PAYMENT, currency });
840
+ } finally {
841
+ setIsLoading(false);
842
+ setStep("payment_instructions");
843
+ }
844
+ }
845
+ function handleCopy(value) {
846
+ navigator.clipboard.writeText(value).catch(() => {
847
+ });
848
+ }
849
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
850
+ RampWidgetTemplate,
851
+ {
852
+ theme,
853
+ accentColor,
854
+ step,
855
+ direction,
856
+ amount,
857
+ currency,
858
+ country,
859
+ quotes,
860
+ paymentInstructions,
861
+ isLoading,
862
+ onDirectionChange: setDirection,
863
+ onAmountChange: setAmount,
864
+ onCurrencyChange: setCurrency,
865
+ onCountryChange: setCountry,
866
+ onFindRoute: handleFindRoute,
867
+ onSelectQuote: handleSelectQuote,
868
+ onCopy: handleCopy,
869
+ onClose
870
+ }
871
+ ) });
872
+ }
873
+ var STATUS_MESSAGES = {
874
+ idle: "",
875
+ building: "Building transaction\u2026",
876
+ built: "Ready to sign and send",
877
+ signing: "Signing and sending transaction\u2026",
878
+ success: "Transaction sent successfully",
879
+ error: "Transaction failed"
880
+ };
395
881
  function TransactionModalTemplate({
396
882
  theme,
397
883
  accentColor,
398
- transactionStateCode,
399
- status,
400
- buildResult,
401
- submitResult,
884
+ transaction,
885
+ showXdr,
886
+ copied,
887
+ explorerUrl,
888
+ walletType,
402
889
  onClose,
403
890
  onSignAndSend,
404
- onRetrySignAndSend
891
+ onToggleXdr,
892
+ onCopyHash,
893
+ onRetry
405
894
  }) {
406
895
  const isDark = theme === "dark";
407
896
  const cssVars = {
@@ -416,43 +905,48 @@ function TransactionModalTemplate({
416
905
  "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
417
906
  "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
418
907
  };
419
- const [showXdr, setShowXdr] = react.useState(false);
420
- const [copied, setCopied] = react.useState(false);
421
- function handleCopyHash() {
422
- if (!submitResult) return;
423
- navigator.clipboard.writeText(submitResult.hash).then(() => {
424
- setCopied(true);
425
- setTimeout(() => setCopied(false), 2e3);
426
- });
427
- }
428
- const explorerNetwork = buildResult?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : "public";
429
- const explorerUrl = submitResult ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${submitResult.hash}` : null;
430
- transactionStateCode.includes("ERROR");
431
- transactionStateCode.includes("SUCCESS");
432
- const isBuilt = buildResult && transactionStateCode === "BUILD_TRANSACTION_SUCCESS";
433
- const isDone = submitResult && transactionStateCode === "SIGN_SEND_TRANSACTION_START";
908
+ const buildData = "buildData" in transaction ? transaction.buildData : null;
909
+ const hash = transaction.step === "success" ? transaction.hash : null;
910
+ const errorDetails = transaction.step === "error" ? transaction.details ?? null : null;
911
+ const isBuilt = transaction.step === "built";
912
+ const isSigning = transaction.step === "signing";
913
+ const isSuccess = transaction.step === "success";
914
+ const isError = transaction.step === "error";
915
+ const showDetails = buildData !== null && (isBuilt || isSigning || isSuccess);
434
916
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
435
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-header", children: [
436
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-tx-title", children: "Transaction" }),
437
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-close", onClick: onClose, "aria-label": "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" }) }) })
438
- ] }),
439
- isBuilt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
917
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction" }) }),
918
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx(
919
+ "svg",
920
+ {
921
+ width: "18",
922
+ height: "18",
923
+ viewBox: "0 0 24 24",
924
+ fill: "none",
925
+ stroke: "currentColor",
926
+ strokeWidth: "2.5",
927
+ strokeLinecap: "round",
928
+ strokeLinejoin: "round",
929
+ "aria-hidden": true,
930
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
931
+ }
932
+ ) }),
933
+ showDetails && buildData && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
440
934
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-summary", children: [
441
935
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-summary-title", children: "Details" }),
442
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pollar-tx-summary-lines", children: buildResult.summary.lines.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "pollar-tx-summary-line", children: line }, i)) })
936
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pollar-tx-summary-lines", children: buildData.summary.lines.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "pollar-tx-summary-line", children: line }, i)) })
443
937
  ] }),
444
938
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta", children: [
445
939
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
446
940
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-label", children: "Network" }),
447
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildResult.summary.network })
941
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.network })
448
942
  ] }),
449
943
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
450
944
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-label", children: "Fee" }),
451
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildResult.summary.fee })
945
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.fee })
452
946
  ] })
453
947
  ] }),
454
948
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-xdr", children: [
455
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-tx-xdr-toggle", onClick: () => setShowXdr((v) => !v), children: [
949
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-tx-xdr-toggle", onClick: onToggleXdr, children: [
456
950
  /* @__PURE__ */ jsxRuntime.jsx(
457
951
  "svg",
458
952
  {
@@ -467,14 +961,61 @@ function TransactionModalTemplate({
467
961
  ),
468
962
  "Raw transaction (XDR)"
469
963
  ] }),
470
- showXdr && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-xdr-content", children: buildResult.unsignedXdr })
964
+ showXdr && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-xdr-content", children: buildData.unsignedXdr })
471
965
  ] })
472
966
  ] }),
473
- submitResult && transactionStateCode === "SIGN_SEND_TRANSACTION_SUCCESS" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result", children: [
967
+ isError && errorDetails && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-error-details", children: [
968
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-error-details-label", children: "Error details" }),
969
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-error-details-content", children: errorDetails })
970
+ ] }),
971
+ isBuilt && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onSignAndSend, children: "Sign & Send" }),
972
+ (isSigning || isSuccess || isError) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-wallet-spinner", children: [
973
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-spinner-ring", children: [
974
+ /* @__PURE__ */ jsxRuntime.jsxs(
975
+ "svg",
976
+ {
977
+ viewBox: "0 0 88 88",
978
+ width: "88",
979
+ height: "88",
980
+ className: `pollar-tx-spinner-svg${isSigning ? " pollar-tx-spinner-rotating" : ""}`,
981
+ "aria-hidden": true,
982
+ children: [
983
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "44", cy: "44", r: "36", fill: "none", stroke: "var(--pollar-border)", strokeWidth: "3" }),
984
+ /* @__PURE__ */ jsxRuntime.jsx(
985
+ "circle",
986
+ {
987
+ cx: "44",
988
+ cy: "44",
989
+ r: "36",
990
+ fill: "none",
991
+ stroke: isSuccess ? "var(--pollar-success-text)" : isError ? "var(--pollar-error-text)" : "var(--pollar-accent)",
992
+ strokeWidth: "3",
993
+ strokeLinecap: "round",
994
+ strokeDasharray: isSigning ? "169.6 56.6" : "999 0",
995
+ transform: "rotate(-90 44 44)",
996
+ style: { transition: isSigning ? "none" : "stroke 400ms, stroke-dasharray 400ms" }
997
+ }
998
+ )
999
+ ]
1000
+ }
1001
+ ),
1002
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-tx-wallet-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
1003
+ "img",
1004
+ {
1005
+ src: walletType === core.WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === core.WalletType.ALBEDO ? LOGO_ALBEDO : LOGO_POLLAR,
1006
+ alt: walletType === core.WalletType.FREIGHTER ? "Freighter" : walletType === core.WalletType.ALBEDO ? "Albedo" : "Pollar",
1007
+ className: "pollar-tx-wallet-img"
1008
+ }
1009
+ ) })
1010
+ ] }),
1011
+ isSigning && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-spinner-label", children: walletType === core.WalletType.FREIGHTER ? "Waiting for Freighter\u2026" : walletType === core.WalletType.ALBEDO ? "Waiting for Albedo\u2026" : "Signing and sending\u2026" }),
1012
+ isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: "Try again" })
1013
+ ] }),
1014
+ isSuccess && hash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result", children: [
474
1015
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-label", children: "Transaction hash" }),
475
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-hash", children: submitResult.hash }),
1016
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-hash", children: hash }),
476
1017
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result-actions", children: [
477
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-result-btn", onClick: handleCopyHash, children: copied ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1018
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-result-btn", onClick: onCopyHash, children: copied ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
478
1019
  /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
479
1020
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
480
1021
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -530,48 +1071,41 @@ function TransactionModalTemplate({
530
1071
  ] })
531
1072
  ] })
532
1073
  ] }),
533
- isBuilt && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-sign-btn", onClick: onSignAndSend, children: "Sign & Send" }),
534
- isDone && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-sign-btn", onClick: onClose, children: "Done" }),
1074
+ isSuccess && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onClose, children: "Done" }),
535
1075
  /* @__PURE__ */ jsxRuntime.jsx(
536
1076
  ModalStatusBanner,
537
1077
  {
538
- message: TRANSACTION_CODE_MESSAGES[transactionStateCode] ?? "",
539
- status
1078
+ message: STATUS_MESSAGES[transaction.step],
1079
+ status: isError ? "ERROR" : isSigning || transaction.step === "building" ? "LOADING" : isSuccess ? "SUCCESS" : "NONE"
540
1080
  }
541
1081
  ),
542
1082
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
543
1083
  ] });
544
1084
  }
545
- var isTxBuildResponseContent = (data) => {
546
- if (!data || typeof data !== "object") return false;
547
- const d = data;
548
- return typeof d.unsignedXdr === "string" && typeof d.networkPassphrase === "string" && typeof d.estimatedFee === "string" && d.summary !== null && typeof d.summary === "object";
549
- };
550
- var isTxSignSendResponseContent = (data) => {
551
- if (!data || typeof data !== "object") return false;
552
- const d = data;
553
- return typeof d.hash === "string" && (d.status === "PENDING" || d.status === "SUCCESS" || d.status === "FAILED");
554
- };
555
1085
  function TransactionModal({ onClose }) {
556
- const {
557
- getClient,
558
- styles,
559
- state: { transaction }
560
- } = usePollar();
1086
+ const { getClient, styles, transaction, network, walletType } = usePollar();
561
1087
  const { theme = "light", accentColor = "#005DB4" } = styles;
562
- let buildResult = null;
563
- const transactionStateCode = transaction.code;
564
- const content = transaction.data?.content;
565
- if (isTxBuildResponseContent(content)) {
566
- buildResult = content;
1088
+ const [showXdr, setShowXdr] = react.useState(false);
1089
+ const [copied, setCopied] = react.useState(false);
1090
+ const hash = transaction.step === "success" ? transaction.hash : null;
1091
+ const buildData = "buildData" in transaction ? transaction.buildData : null;
1092
+ const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : "public";
1093
+ const explorerUrl = hash ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}` : null;
1094
+ function handleSignAndSend() {
1095
+ if (transaction.step === "built") {
1096
+ void getClient().signAndSubmitTx(transaction.buildData.unsignedXdr);
1097
+ }
567
1098
  }
568
- let submitResult = null;
569
- if (isTxSignSendResponseContent(content)) {
570
- submitResult = content;
1099
+ function handleCopyHash() {
1100
+ if (!hash) return;
1101
+ navigator.clipboard.writeText(hash).then(() => {
1102
+ setCopied(true);
1103
+ setTimeout(() => setCopied(false), 2e3);
1104
+ });
571
1105
  }
572
- async function handleSignAndSend() {
573
- if (buildResult) {
574
- await getClient().submitTx(buildResult.unsignedXdr);
1106
+ async function handleRetry() {
1107
+ if (transaction.step === "error" && transaction.buildData) {
1108
+ await getClient().signAndSubmitTx(transaction.buildData.unsignedXdr);
575
1109
  }
576
1110
  }
577
1111
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -579,13 +1113,243 @@ function TransactionModal({ onClose }) {
579
1113
  {
580
1114
  theme,
581
1115
  accentColor,
582
- transactionStateCode,
583
- status: transaction.status,
584
- buildResult,
585
- submitResult,
1116
+ transaction,
1117
+ showXdr,
1118
+ copied,
1119
+ explorerUrl,
1120
+ walletType,
586
1121
  onClose,
587
1122
  onSignAndSend: handleSignAndSend,
588
- onRetrySignAndSend: handleSignAndSend
1123
+ onToggleXdr: () => setShowXdr((v) => !v),
1124
+ onCopyHash: handleCopyHash,
1125
+ onRetry: handleRetry
1126
+ }
1127
+ ) });
1128
+ }
1129
+ var PAGE_SIZE = 10;
1130
+ function StatusBadge({ status }) {
1131
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-badge", "data-status": status, children: status });
1132
+ }
1133
+ function formatDate(iso) {
1134
+ return new Date(iso).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
1135
+ }
1136
+ function TxHistoryModalTemplate({
1137
+ theme,
1138
+ accentColor,
1139
+ txHistory,
1140
+ offset,
1141
+ onRefresh,
1142
+ onPrev,
1143
+ onNext,
1144
+ onClose
1145
+ }) {
1146
+ const isDark = theme === "dark";
1147
+ const cssVars = {
1148
+ "--pollar-accent": accentColor,
1149
+ "--pollar-buttons-border-radius": "8px",
1150
+ "--pollar-buttons-height": "44px",
1151
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1152
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1153
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
1154
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1155
+ "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1156
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1157
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
1158
+ };
1159
+ const isLoading = txHistory.step === "loading";
1160
+ const records = txHistory.step === "loaded" ? txHistory.data.records : [];
1161
+ const total = txHistory.step === "loaded" ? txHistory.data.total : 0;
1162
+ const hasPrev = offset > 0;
1163
+ const hasNext = offset + PAGE_SIZE < total;
1164
+ const showPagination = txHistory.step === "loaded" && total > PAGE_SIZE;
1165
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1166
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1167
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
1168
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1169
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
1170
+ /* @__PURE__ */ jsxRuntime.jsxs(
1171
+ "svg",
1172
+ {
1173
+ className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1174
+ width: "13",
1175
+ height: "13",
1176
+ viewBox: "0 0 13 13",
1177
+ fill: "none",
1178
+ "aria-hidden": true,
1179
+ children: [
1180
+ /* @__PURE__ */ jsxRuntime.jsx(
1181
+ "path",
1182
+ {
1183
+ d: "M11.5 6.5a5 5 0 11-1.5-3.536",
1184
+ stroke: "currentColor",
1185
+ strokeWidth: "1.5",
1186
+ strokeLinecap: "round"
1187
+ }
1188
+ ),
1189
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1190
+ ]
1191
+ }
1192
+ ),
1193
+ "Refresh"
1194
+ ] }),
1195
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "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" }) }) })
1196
+ ] })
1197
+ ] }),
1198
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-list", children: [
1199
+ txHistory.step === "idle" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Click Refresh to load transactions." }),
1200
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1201
+ txHistory.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
1202
+ txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
1203
+ records.map((record) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-item", children: [
1204
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
1205
+ /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: record.status }),
1206
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-item-meta", children: [
1207
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: record.operation }),
1208
+ record.feeXlm && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1209
+ "\xB7 ",
1210
+ record.feeXlm,
1211
+ " XLM"
1212
+ ] }),
1213
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1214
+ "\xB7 ",
1215
+ formatDate(record.createdAt)
1216
+ ] })
1217
+ ] })
1218
+ ] }, record.id))
1219
+ ] }),
1220
+ showPagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-pagination", children: [
1221
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-pagination-info", children: [
1222
+ offset + 1,
1223
+ "\u2013",
1224
+ Math.min(offset + PAGE_SIZE, total),
1225
+ " of ",
1226
+ total
1227
+ ] }),
1228
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-pagination-btns", children: [
1229
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-hist-page-btn", onClick: onPrev, disabled: !hasPrev, children: "\u2190 Prev" }),
1230
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-hist-page-btn", onClick: onNext, disabled: !hasNext, children: "Next \u2192" })
1231
+ ] })
1232
+ ] }),
1233
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
1234
+ ] });
1235
+ }
1236
+ var PAGE_SIZE2 = 10;
1237
+ function TxHistoryModal({ onClose }) {
1238
+ const { getClient, styles, txHistory } = usePollar();
1239
+ const { theme = "light", accentColor = "#005DB4" } = styles;
1240
+ const [offset, setOffset] = react.useState(0);
1241
+ function load(nextOffset) {
1242
+ setOffset(nextOffset);
1243
+ void getClient().fetchTxHistory({ limit: PAGE_SIZE2, offset: nextOffset });
1244
+ }
1245
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
1246
+ TxHistoryModalTemplate,
1247
+ {
1248
+ theme,
1249
+ accentColor,
1250
+ txHistory,
1251
+ offset,
1252
+ onRefresh: () => load(offset),
1253
+ onPrev: () => load(Math.max(0, offset - PAGE_SIZE2)),
1254
+ onNext: () => load(offset + PAGE_SIZE2),
1255
+ onClose
1256
+ }
1257
+ ) });
1258
+ }
1259
+ function formatBalance(balance) {
1260
+ const n = parseFloat(balance);
1261
+ return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
1262
+ }
1263
+ function cropAddress(address) {
1264
+ if (address.length <= 16) return address;
1265
+ return `${address.slice(0, 8)}...${address.slice(-8)}`;
1266
+ }
1267
+ function BalanceItem({ record }) {
1268
+ const balanceDiffers = record.balance !== record.available;
1269
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-item", children: [
1270
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-asset", children: record.code }),
1271
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-amounts", children: [
1272
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-amount", children: formatBalance(record.balance) }),
1273
+ balanceDiffers && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-bal-available", children: [
1274
+ formatBalance(record.available),
1275
+ " available"
1276
+ ] })
1277
+ ] })
1278
+ ] });
1279
+ }
1280
+ function WalletBalanceModalTemplate({
1281
+ theme,
1282
+ accentColor,
1283
+ walletBalance,
1284
+ walletAddress,
1285
+ onRefresh,
1286
+ onClose
1287
+ }) {
1288
+ const isDark = theme === "dark";
1289
+ const cssVars = {
1290
+ "--pollar-accent": accentColor,
1291
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1292
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1293
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
1294
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1295
+ "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1296
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
1297
+ };
1298
+ const isLoading = walletBalance.step === "loading";
1299
+ const data = walletBalance.step === "loaded" ? walletBalance.data : null;
1300
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1301
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1302
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
1303
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1304
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
1305
+ /* @__PURE__ */ jsxRuntime.jsxs(
1306
+ "svg",
1307
+ {
1308
+ className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1309
+ width: "13",
1310
+ height: "13",
1311
+ viewBox: "0 0 13 13",
1312
+ fill: "none",
1313
+ "aria-hidden": true,
1314
+ children: [
1315
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
1316
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1317
+ ]
1318
+ }
1319
+ ),
1320
+ "Refresh"
1321
+ ] }),
1322
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "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" }) }) })
1323
+ ] })
1324
+ ] }),
1325
+ walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-address", children: cropAddress(walletAddress) }),
1326
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1327
+ walletBalance.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: walletBalance.message }),
1328
+ data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
1329
+ "Account not found on ",
1330
+ data.network,
1331
+ "."
1332
+ ] }),
1333
+ data?.exists && data.balances.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No balances found." }),
1334
+ data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsxRuntime.jsx(BalanceItem, { record: b }, b.code + (b.issuer ?? ""))) }),
1335
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
1336
+ ] });
1337
+ }
1338
+ function WalletBalanceModal({ onClose }) {
1339
+ const { walletBalance, refreshBalance, walletAddress, styles } = usePollar();
1340
+ const { theme = "light", accentColor = "#005DB4" } = styles;
1341
+ react.useEffect(() => {
1342
+ void refreshBalance();
1343
+ }, []);
1344
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
1345
+ WalletBalanceModalTemplate,
1346
+ {
1347
+ theme,
1348
+ accentColor,
1349
+ walletBalance,
1350
+ walletAddress,
1351
+ onRefresh: () => refreshBalance(),
1352
+ onClose
589
1353
  }
590
1354
  ) });
591
1355
  }
@@ -595,48 +1359,32 @@ var emptyResponse = {
595
1359
  },
596
1360
  styles: {}
597
1361
  };
598
- async function fetchRemoteConfig(api) {
599
- try {
600
- const { data, error } = await api.GET(`/applications/config`);
601
- if (!data || error) {
602
- return emptyResponse;
603
- }
604
- return data.content;
605
- } catch {
606
- return emptyResponse;
607
- }
1362
+ async function fetchRemoteConfig(client) {
1363
+ const content = await client.getAppConfig();
1364
+ return content ?? emptyResponse;
608
1365
  }
609
1366
  var PollarContext = react.createContext(null);
610
1367
  function PollarProvider({ config, styles: propStyles, children }) {
611
1368
  const [pollarClient] = react.useState(() => new core.PollarClient(config));
612
- const [stellarClient] = react.useState(() => new core.StellarClient(config.stellarNetwork || "testnet"));
1369
+ const [networkState, setNetworkState] = react.useState(() => pollarClient.getNetworkState());
613
1370
  const [sessionState, setSessionState] = react.useState(null);
614
- const [state, setState] = react.useState({
615
- network: {
616
- var: "network",
617
- code: core.STATE_VAR_CODES.network.NONE,
618
- status: core.StateStatus.NONE,
619
- level: "info",
620
- ts: 0
621
- },
622
- transaction: {
623
- var: "transaction",
624
- code: core.STATE_VAR_CODES.transaction.NONE,
625
- status: core.StateStatus.NONE,
626
- level: "info",
627
- ts: 0
628
- }
629
- });
1371
+ const [transaction, setTransaction] = react.useState({ step: "idle" });
1372
+ const [txHistory, setTxHistory] = react.useState({ step: "idle" });
1373
+ const [walletBalance, setWalletBalance] = react.useState({ step: "idle" });
630
1374
  const [remoteConfig, setRemoteConfig] = react.useState(emptyResponse);
631
1375
  const [styles, setStyles] = react.useState(propStyles ?? {});
632
1376
  react.useEffect(() => {
633
- return pollarClient.onStateChange((stateEntry) => {
634
- setState((prevState) => {
635
- if (JSON.stringify(prevState[stateEntry.var]) !== JSON.stringify(stateEntry)) {
636
- return { ...prevState, [stateEntry.var]: stateEntry };
637
- }
638
- return prevState;
639
- });
1377
+ return pollarClient.onTransactionStateChange(setTransaction);
1378
+ }, [pollarClient]);
1379
+ react.useEffect(() => {
1380
+ return pollarClient.onTxHistoryStateChange(setTxHistory);
1381
+ }, [pollarClient]);
1382
+ react.useEffect(() => {
1383
+ return pollarClient.onWalletBalanceStateChange(setWalletBalance);
1384
+ }, [pollarClient]);
1385
+ react.useEffect(() => {
1386
+ return pollarClient.onNetworkStateChange((state) => {
1387
+ setNetworkState(state);
640
1388
  });
641
1389
  }, [pollarClient]);
642
1390
  react.useEffect(() => {
@@ -649,7 +1397,7 @@ function PollarProvider({ config, styles: propStyles, children }) {
649
1397
  });
650
1398
  }, [pollarClient]);
651
1399
  react.useEffect(() => {
652
- fetchRemoteConfig(pollarClient.getApi()).then((fetched) => {
1400
+ fetchRemoteConfig(pollarClient).then((fetched) => {
653
1401
  setRemoteConfig(fetched);
654
1402
  setStyles({
655
1403
  ...fetched.styles,
@@ -660,40 +1408,64 @@ function PollarProvider({ config, styles: propStyles, children }) {
660
1408
  setStyles(propStyles ?? {});
661
1409
  });
662
1410
  }, [pollarClient]);
1411
+ react.useEffect(() => {
1412
+ if (transaction.step !== "idle") {
1413
+ setTransactionModalOpen(true);
1414
+ }
1415
+ }, [transaction.step]);
663
1416
  const [loginModalOpen, setLoginModalOpen] = react.useState(false);
664
1417
  const [transactionModalOpen, setTransactionModalOpen] = react.useState(false);
1418
+ const [kycModalOpen, setKycModalOpen] = react.useState(false);
1419
+ const [kycModalOptions, setKycModalOptions] = react.useState({});
1420
+ const [rampWidgetOpen, setRampWidgetOpen] = react.useState(false);
1421
+ const [txHistoryModalOpen, setTxHistoryModalOpen] = react.useState(false);
1422
+ const [walletBalanceModalOpen, setWalletBalanceModalOpen] = react.useState(false);
665
1423
  const contextValue = react.useMemo(
666
1424
  () => ({
667
- walletAddress: sessionState?.wallet?.publicKey || "",
1425
+ walletAddress: sessionState?.data?.providers?.wallet?.address || sessionState?.wallet?.publicKey || "",
668
1426
  getClient: () => pollarClient,
669
- state,
1427
+ transaction,
670
1428
  login: (options) => pollarClient.login(options),
671
1429
  logout: () => pollarClient.logout(),
672
- isAuthenticated: pollarClient.isAuthenticated(),
1430
+ isAuthenticated: !!sessionState?.wallet?.publicKey,
673
1431
  buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
674
- submitTx: (signedXdr) => pollarClient.submitTx(signedXdr),
675
- sendTransaction: (operation, params, options) => {
676
- void pollarClient.buildTx(operation, params, options);
677
- setTransactionModalOpen(true);
678
- },
1432
+ signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
1433
+ walletType: pollarClient.getWalletType(),
679
1434
  openTransactionModal: () => setTransactionModalOpen(true),
680
1435
  openLoginModal: () => setLoginModalOpen(true),
1436
+ openKycModal: (options = {}) => {
1437
+ setKycModalOptions(options);
1438
+ setKycModalOpen(true);
1439
+ },
1440
+ openRampWidget: () => setRampWidgetOpen(true),
1441
+ txHistory,
1442
+ openTxHistoryModal: () => setTxHistoryModalOpen(true),
1443
+ openWalletBalanceModal: () => setWalletBalanceModalOpen(true),
1444
+ walletBalance,
1445
+ refreshBalance: (publicKey) => pollarClient.refreshBalance(publicKey),
1446
+ network: networkState.step === "connected" ? networkState.network : "testnet",
1447
+ setNetwork: (network) => pollarClient.setNetwork(network),
681
1448
  config: remoteConfig,
682
- styles,
683
- async getBalance(publicKey) {
684
- const pk = publicKey || sessionState?.wallet?.publicKey;
685
- if (pk) {
686
- return await stellarClient.getBalances(pk);
687
- }
688
- return { success: false, errorCode: "NO_WALLET_FOUND", balances: [] };
689
- }
1449
+ styles
690
1450
  }),
691
- [sessionState, remoteConfig, styles, pollarClient, state]
1451
+ [sessionState, remoteConfig, styles, pollarClient, transaction, txHistory, networkState, walletBalance]
692
1452
  );
693
1453
  return /* @__PURE__ */ jsxRuntime.jsxs(PollarContext.Provider, { value: contextValue, children: [
694
1454
  children,
695
1455
  loginModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setLoginModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(LoginModal, { onClose: () => setLoginModalOpen(false) }) }),
696
- transactionModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTransactionModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TransactionModal, { onClose: () => setTransactionModalOpen(false) }) })
1456
+ transactionModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTransactionModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TransactionModal, { onClose: () => setTransactionModalOpen(false) }) }),
1457
+ kycModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setKycModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
1458
+ KycModal,
1459
+ {
1460
+ onClose: () => setKycModalOpen(false),
1461
+ ...kycModalOptions.country !== void 0 && { country: kycModalOptions.country },
1462
+ ...kycModalOptions.level !== void 0 && { level: kycModalOptions.level },
1463
+ ...kycModalOptions.onApproved !== void 0 && { onApproved: kycModalOptions.onApproved }
1464
+ }
1465
+ ) }),
1466
+ rampWidgetOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setRampWidgetOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(RampWidget, { onClose: () => setRampWidgetOpen(false) }) }),
1467
+ txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
1468
+ walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) })
697
1469
  ] });
698
1470
  }
699
1471
  function usePollar() {
@@ -703,50 +1475,37 @@ function usePollar() {
703
1475
  }
704
1476
  return ctx;
705
1477
  }
1478
+ function ButtonLogo() {
1479
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
1480
+ }
706
1481
  function cropWallet(address) {
707
1482
  if (address.length <= 12) return address;
708
1483
  return `${address.slice(0, 6)}...${address.slice(-4)}`;
709
1484
  }
710
- function ButtonLogo() {
711
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
712
- }
713
- function WalletButton() {
714
- const { getClient, walletAddress, styles, openLoginModal } = usePollar();
715
- const [open, setOpen] = react.useState(false);
716
- const [copied, setCopied] = react.useState(false);
717
- const wrapperRef = react.useRef(null);
718
- const { theme = "light", accentColor = "#005DB4" } = styles;
719
- const isDark = theme === "dark";
720
- const dropdownBg = isDark ? "#18181b" : "#fff";
721
- const dropdownBorder = isDark ? "#3f3f46" : "#e4e4e7";
722
- const itemColor = isDark ? "#fafafa" : "#18181b";
723
- react.useEffect(() => {
724
- function handleClickOutside(e) {
725
- if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
726
- setOpen(false);
727
- }
728
- }
729
- document.addEventListener("mousedown", handleClickOutside);
730
- return () => document.removeEventListener("mousedown", handleClickOutside);
731
- }, []);
732
- async function handleCopy() {
733
- if (!walletAddress) return;
734
- await navigator.clipboard.writeText(walletAddress);
735
- setCopied(true);
736
- setTimeout(() => setCopied(false), 1500);
737
- }
738
- function handleLogout() {
739
- setOpen(false);
740
- getClient().logout();
741
- }
1485
+ function WalletButtonTemplate({
1486
+ walletAddress,
1487
+ accentColor,
1488
+ open,
1489
+ copied,
1490
+ dropdownBg,
1491
+ dropdownBorder,
1492
+ itemColor,
1493
+ wrapperRef,
1494
+ onToggleOpen,
1495
+ onCopy,
1496
+ onWalletBalance,
1497
+ onTxHistory,
1498
+ onLogout,
1499
+ onLogin
1500
+ }) {
742
1501
  if (!walletAddress) {
743
- return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "wallet-login-btn", style: { backgroundColor: accentColor }, onClick: openLoginModal, children: [
1502
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "wallet-login-btn", style: { backgroundColor: accentColor }, onClick: onLogin, children: [
744
1503
  /* @__PURE__ */ jsxRuntime.jsx(ButtonLogo, {}),
745
1504
  "Login with Pollar"
746
1505
  ] });
747
1506
  }
748
1507
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-wrapper", ref: wrapperRef, children: [
749
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-btn", style: { backgroundColor: accentColor }, onClick: () => setOpen((v) => !v), children: [
1508
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-btn", style: { backgroundColor: accentColor }, onClick: onToggleOpen, children: [
750
1509
  cropWallet(walletAddress),
751
1510
  /* @__PURE__ */ jsxRuntime.jsx(
752
1511
  "svg",
@@ -763,7 +1522,7 @@ function WalletButton() {
763
1522
  )
764
1523
  ] }),
765
1524
  open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
766
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: handleCopy, children: [
1525
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
767
1526
  /* @__PURE__ */ jsxRuntime.jsxs(
768
1527
  "svg",
769
1528
  {
@@ -783,7 +1542,67 @@ function WalletButton() {
783
1542
  ),
784
1543
  copied ? "Copied!" : "Copy address"
785
1544
  ] }),
786
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item danger", onClick: handleLogout, children: [
1545
+ /* @__PURE__ */ jsxRuntime.jsxs(
1546
+ "button",
1547
+ {
1548
+ className: "wallet-dropdown-item",
1549
+ style: { color: itemColor },
1550
+ onClick: onWalletBalance,
1551
+ children: [
1552
+ /* @__PURE__ */ jsxRuntime.jsxs(
1553
+ "svg",
1554
+ {
1555
+ width: "14",
1556
+ height: "14",
1557
+ viewBox: "0 0 24 24",
1558
+ fill: "none",
1559
+ stroke: "currentColor",
1560
+ strokeWidth: "2",
1561
+ strokeLinecap: "round",
1562
+ strokeLinejoin: "round",
1563
+ children: [
1564
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "4", width: "22", height: "16", rx: "2", ry: "2" }),
1565
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "16", cy: "12", r: "2" }),
1566
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22 8H12" })
1567
+ ]
1568
+ }
1569
+ ),
1570
+ "Wallet balance"
1571
+ ]
1572
+ }
1573
+ ),
1574
+ /* @__PURE__ */ jsxRuntime.jsxs(
1575
+ "button",
1576
+ {
1577
+ className: "wallet-dropdown-item",
1578
+ style: { color: itemColor },
1579
+ onClick: onTxHistory,
1580
+ children: [
1581
+ /* @__PURE__ */ jsxRuntime.jsxs(
1582
+ "svg",
1583
+ {
1584
+ width: "14",
1585
+ height: "14",
1586
+ viewBox: "0 0 24 24",
1587
+ fill: "none",
1588
+ stroke: "currentColor",
1589
+ strokeWidth: "2",
1590
+ strokeLinecap: "round",
1591
+ strokeLinejoin: "round",
1592
+ children: [
1593
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1594
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "14,2 14,8 20,8" }),
1595
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1596
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1597
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "10,9 9,9 8,9" })
1598
+ ]
1599
+ }
1600
+ ),
1601
+ "Transaction history"
1602
+ ]
1603
+ }
1604
+ ),
1605
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
787
1606
  /* @__PURE__ */ jsxRuntime.jsxs(
788
1607
  "svg",
789
1608
  {
@@ -807,8 +1626,76 @@ function WalletButton() {
807
1626
  ] })
808
1627
  ] });
809
1628
  }
1629
+ function WalletButton() {
1630
+ const { getClient, walletAddress, styles, openLoginModal, openTxHistoryModal, openWalletBalanceModal } = usePollar();
1631
+ const [open, setOpen] = react.useState(false);
1632
+ const [copied, setCopied] = react.useState(false);
1633
+ const wrapperRef = react.useRef(null);
1634
+ const { theme = "light", accentColor = "#005DB4" } = styles;
1635
+ const isDark = theme === "dark";
1636
+ const dropdownBg = isDark ? "#18181b" : "#fff";
1637
+ const dropdownBorder = isDark ? "#3f3f46" : "#e4e4e7";
1638
+ const itemColor = isDark ? "#fafafa" : "#18181b";
1639
+ react.useEffect(() => {
1640
+ function handleClickOutside(e) {
1641
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
1642
+ setOpen(false);
1643
+ }
1644
+ }
1645
+ document.addEventListener("mousedown", handleClickOutside);
1646
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1647
+ }, []);
1648
+ async function handleCopy() {
1649
+ if (!walletAddress) return;
1650
+ await navigator.clipboard.writeText(walletAddress);
1651
+ setCopied(true);
1652
+ setTimeout(() => setCopied(false), 1500);
1653
+ }
1654
+ function handleLogout() {
1655
+ setOpen(false);
1656
+ getClient().logout();
1657
+ }
1658
+ function handleWalletBalance() {
1659
+ setOpen(false);
1660
+ openWalletBalanceModal();
1661
+ }
1662
+ function handleTxHistory() {
1663
+ setOpen(false);
1664
+ openTxHistoryModal();
1665
+ }
1666
+ return /* @__PURE__ */ jsxRuntime.jsx(
1667
+ WalletButtonTemplate,
1668
+ {
1669
+ walletAddress: walletAddress ?? null,
1670
+ accentColor,
1671
+ open,
1672
+ copied,
1673
+ dropdownBg,
1674
+ dropdownBorder,
1675
+ itemColor,
1676
+ wrapperRef,
1677
+ onToggleOpen: () => setOpen((v) => !v),
1678
+ onCopy: handleCopy,
1679
+ onWalletBalance: handleWalletBalance,
1680
+ onTxHistory: handleTxHistory,
1681
+ onLogout: handleLogout,
1682
+ onLogin: openLoginModal
1683
+ }
1684
+ );
1685
+ }
810
1686
 
1687
+ exports.KycModal = KycModal;
1688
+ exports.KycModalTemplate = KycModalTemplate;
1689
+ exports.KycStatus = KycStatus;
1690
+ exports.LoginModalTemplate = LoginModalTemplate;
811
1691
  exports.PollarProvider = PollarProvider;
1692
+ exports.RampWidget = RampWidget;
1693
+ exports.RampWidgetTemplate = RampWidgetTemplate;
1694
+ exports.RouteDisplay = RouteDisplay;
1695
+ exports.TransactionModalTemplate = TransactionModalTemplate;
1696
+ exports.TxHistoryModalTemplate = TxHistoryModalTemplate;
1697
+ exports.WalletBalanceModal = WalletBalanceModal;
1698
+ exports.WalletBalanceModalTemplate = WalletBalanceModalTemplate;
812
1699
  exports.WalletButton = WalletButton;
813
1700
  exports.usePollar = usePollar;
814
1701
  //# sourceMappingURL=index.js.map