@pollar/react 0.4.5 → 0.5.0

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
@@ -39,26 +39,16 @@ var PollarModalFooter = () => {
39
39
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
40
40
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
41
41
  "v",
42
- "0.4.4"
42
+ "0.4.5"
43
43
  ] })
44
44
  ] })
45
45
  ] });
46
46
  };
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
47
  function ModalStatusBanner({ message, status, onCancel, onRetry }) {
58
- if (!message && status === core.StateStatus.NONE) {
48
+ if (!message && status === "NONE") {
59
49
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-status" });
60
50
  }
61
- const isLoading = status === core.StateStatus.LOADING;
51
+ const isLoading = status === "LOADING";
62
52
  const icon = status === "ERROR" ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
63
53
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
64
54
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 4.5l5 5M9.5 4.5l-5 5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round" })
@@ -70,9 +60,159 @@ function ModalStatusBanner({ message, status, onCancel, onRetry }) {
70
60
  icon,
71
61
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: message }),
72
62
  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" })
63
+ status === "ERROR" && onRetry && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-status-cancel", onClick: onRetry, children: "Retry" })
74
64
  ] });
75
65
  }
66
+ var STATUS_CONFIG = {
67
+ none: { label: "Not started", color: "#6b7280", dot: false },
68
+ pending: { label: "Pending review", color: "#f59e0b", dot: true },
69
+ approved: { label: "Verified", color: "#10b981", dot: false },
70
+ rejected: { label: "Rejected", color: "#ef4444", dot: false }
71
+ };
72
+ function KycStatus({ status, className }) {
73
+ const config = STATUS_CONFIG[status] ?? STATUS_CONFIG.none;
74
+ return /* @__PURE__ */ jsxRuntime.jsxs(
75
+ "span",
76
+ {
77
+ className: `pollar-kyc-badge${className ? ` ${className}` : ""}`,
78
+ style: { "--pollar-kyc-color": config.color },
79
+ children: [
80
+ config.dot && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-badge-dot" }),
81
+ config.label
82
+ ]
83
+ }
84
+ );
85
+ }
86
+ function KycModalTemplate({
87
+ theme,
88
+ accentColor,
89
+ step,
90
+ providers,
91
+ selectedProvider,
92
+ session,
93
+ kycStatus,
94
+ isLoading,
95
+ onSelectProvider,
96
+ onDoneVerifying,
97
+ onClose
98
+ }) {
99
+ const isDark = theme === "dark";
100
+ const cssVars = {
101
+ "--pollar-accent": accentColor,
102
+ "--pollar-buttons-border-radius": "6px",
103
+ "--pollar-buttons-height": "44px",
104
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
105
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
106
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
107
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
108
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
109
+ };
110
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
111
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-header", children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
113
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-kyc-subtitle", children: [
114
+ step === "select_provider" && "Choose your verification provider",
115
+ step === "verifying" && `Verifying with ${selectedProvider?.name}`,
116
+ step === "polling" && "Waiting for verification result",
117
+ step === "done" && "Verification complete"
118
+ ] })
119
+ ] }),
120
+ step === "select_provider" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-providers", children: [
121
+ providers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "var(--pollar-muted)", textAlign: "center" }, children: "No providers available for your country." }),
122
+ providers.map((p) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-kyc-provider-btn", disabled: isLoading, onClick: () => onSelectProvider(p), children: [
123
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-name", children: p.name }),
124
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-flow", children: p.flow })
125
+ ] }, p.id))
126
+ ] }),
127
+ step === "verifying" && selectedProvider && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
128
+ /* @__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: [
129
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u{1F512}" }),
130
+ /* @__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" }),
131
+ /* @__PURE__ */ jsxRuntime.jsxs("code", { style: { fontSize: "0.7rem", opacity: 0.6 }, children: [
132
+ "provider: ",
133
+ selectedProvider.id
134
+ ] })
135
+ ] }) }),
136
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
137
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
138
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onDoneVerifying, children: "I've completed verification" })
139
+ ] })
140
+ ] }),
141
+ step === "polling" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-polling", children: [
142
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
143
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-kyc-polling-text", children: "Checking verification status\u2026" })
144
+ ] }),
145
+ step === "done" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-result", children: [
146
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-result-icon", children: kycStatus === "approved" ? "\u2705" : "\u274C" }),
147
+ /* @__PURE__ */ jsxRuntime.jsx(KycStatus, { status: kycStatus }),
148
+ /* @__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." }),
149
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: "Close" }) })
150
+ ] })
151
+ ] });
152
+ }
153
+ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
154
+ const { getClient, styles } = usePollar();
155
+ const [step, setStep] = react.useState("select_provider");
156
+ const [providers, setProviders] = react.useState([]);
157
+ const [selectedProvider, setSelectedProvider] = react.useState(null);
158
+ const [session, setSession] = react.useState(null);
159
+ const [kycStatus, setKycStatus] = react.useState("none");
160
+ const [isLoading, setIsLoading] = react.useState(false);
161
+ const client = getClient();
162
+ const { theme = "light", accentColor = "#005DB4" } = styles;
163
+ react.useEffect(() => {
164
+ setIsLoading(true);
165
+ client.getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
166
+ }, [country]);
167
+ async function handleSelectProvider(provider) {
168
+ setSelectedProvider(provider);
169
+ setIsLoading(true);
170
+ try {
171
+ const result = await client.resolveKyc(provider.id, level);
172
+ if (result.alreadyApproved) {
173
+ setKycStatus("approved");
174
+ setStep("done");
175
+ onApproved?.();
176
+ return;
177
+ }
178
+ setSession(result);
179
+ setStep("verifying");
180
+ } catch {
181
+ setStep("select_provider");
182
+ } finally {
183
+ setIsLoading(false);
184
+ }
185
+ }
186
+ async function handleDoneVerifying() {
187
+ if (!selectedProvider) return;
188
+ setStep("polling");
189
+ try {
190
+ const finalStatus = await client.pollKycStatus(selectedProvider.id, { intervalMs: 3e3, timeoutMs: 12e4 });
191
+ setKycStatus(finalStatus);
192
+ setStep("done");
193
+ if (finalStatus === "approved") onApproved?.();
194
+ } catch {
195
+ setKycStatus("rejected");
196
+ setStep("done");
197
+ }
198
+ }
199
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
200
+ KycModalTemplate,
201
+ {
202
+ theme,
203
+ accentColor,
204
+ step,
205
+ providers,
206
+ selectedProvider,
207
+ session,
208
+ kycStatus,
209
+ isLoading,
210
+ onSelectProvider: handleSelectProvider,
211
+ onDoneVerifying: handleDoneVerifying,
212
+ onClose
213
+ }
214
+ ) });
215
+ }
76
216
  function EmailCodeInput({ email, onSubmit }) {
77
217
  const [digits, setDigits] = react.useState(["", "", "", "", "", ""]);
78
218
  const inputRefs = react.useRef([]);
@@ -206,10 +346,10 @@ function authStateToStatus(step) {
206
346
  ];
207
347
  const success = ["authenticated", "entering_code"];
208
348
  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;
349
+ if (loading.includes(step)) return "LOADING";
350
+ if (success.includes(step)) return "SUCCESS";
351
+ if (error.includes(step)) return "ERROR";
352
+ return "NONE";
213
353
  }
214
354
  function LoginModalTemplate({
215
355
  theme,
@@ -248,7 +388,7 @@ 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];
@@ -343,7 +483,7 @@ function LoginModal({ onClose }) {
343
483
  getClient().beginEmailLogin();
344
484
  }
345
485
  function handleSocialLogin(provider) {
346
- getClient().loginOAuth(provider);
486
+ getClient().login({ provider });
347
487
  }
348
488
  function handleWalletConnect(type) {
349
489
  getClient().loginWallet(type);
@@ -392,16 +532,316 @@ function LoginModal({ onClose }) {
392
532
  }
393
533
  ) });
394
534
  }
535
+ var RAIL_LABELS = {
536
+ SPEI: "SPEI (Mexico)",
537
+ PIX: "PIX (Brazil)",
538
+ PSE: "PSE (Colombia)",
539
+ ACH: "ACH (US)"
540
+ };
541
+ function RouteDisplay({ quote, onSelect }) {
542
+ return /* @__PURE__ */ jsxRuntime.jsxs(
543
+ "div",
544
+ {
545
+ className: "pollar-ramp-route-card",
546
+ "data-recommended": quote.recommended,
547
+ role: "button",
548
+ tabIndex: 0,
549
+ onClick: () => onSelect(quote),
550
+ onKeyDown: (e) => e.key === "Enter" && onSelect(quote),
551
+ children: [
552
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-left", children: [
553
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-provider", children: quote.provider }),
554
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-route-meta", children: [
555
+ RAIL_LABELS[quote.rail] ?? quote.rail,
556
+ " \xB7 ",
557
+ quote.protocol,
558
+ " \xB7 ",
559
+ quote.estimatedTime
560
+ ] })
561
+ ] }),
562
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-right", children: [
563
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-route-fee", children: [
564
+ quote.fee,
565
+ "% fee"
566
+ ] }),
567
+ quote.recommended && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-badge", children: "Best rate" })
568
+ ] })
569
+ ]
570
+ }
571
+ );
572
+ }
573
+ var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
574
+ var COUNTRY_CURRENCIES = {
575
+ MX: "MXN",
576
+ BR: "BRL",
577
+ CO: "COP",
578
+ CL: "CLP",
579
+ PE: "PEN",
580
+ AR: "ARS"
581
+ };
582
+ function RampWidgetTemplate({
583
+ theme,
584
+ accentColor,
585
+ step,
586
+ direction,
587
+ amount,
588
+ currency,
589
+ country,
590
+ quotes,
591
+ paymentInstructions,
592
+ isLoading,
593
+ onDirectionChange,
594
+ onAmountChange,
595
+ onCurrencyChange,
596
+ onCountryChange,
597
+ onFindRoute,
598
+ onSelectQuote,
599
+ onCopy,
600
+ onClose
601
+ }) {
602
+ const isDark = theme === "dark";
603
+ const cssVars = {
604
+ "--pollar-accent": accentColor,
605
+ "--pollar-buttons-border-radius": "6px",
606
+ "--pollar-buttons-height": "44px",
607
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
608
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
609
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
610
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
611
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
612
+ };
613
+ const stepTitle = {
614
+ input: direction === "onramp" ? "Buy crypto" : "Sell crypto",
615
+ loading_quote: "Finding best route",
616
+ select_route: "Select provider",
617
+ payment_instructions: "Payment instructions"
618
+ };
619
+ const stepSubtitle = {
620
+ input: direction === "onramp" ? "Enter the amount you want to deposit" : "Enter the amount you want to withdraw",
621
+ loading_quote: "Comparing providers in real time\u2026",
622
+ select_route: "All prices include fees",
623
+ payment_instructions: "Send the exact amount to complete your transaction"
624
+ };
625
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
626
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-header", children: [
627
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-ramp-title", children: stepTitle[step] }),
628
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
629
+ ] }),
630
+ step === "input" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
631
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-tabs", children: [
632
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-ramp-tab", "data-active": direction === "onramp", onClick: () => onDirectionChange("onramp"), children: "Buy" }),
633
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-ramp-tab", "data-active": direction === "offramp", onClick: () => onDirectionChange("offramp"), children: "Sell" })
634
+ ] }),
635
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input-row", children: [
636
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
637
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Amount" }),
638
+ /* @__PURE__ */ jsxRuntime.jsx(
639
+ "input",
640
+ {
641
+ type: "number",
642
+ className: "pollar-ramp-input",
643
+ placeholder: "0.00",
644
+ value: amount,
645
+ min: "0",
646
+ onChange: (e) => onAmountChange(e.target.value)
647
+ }
648
+ )
649
+ ] }),
650
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", style: { maxWidth: 90 }, children: [
651
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Currency" }),
652
+ /* @__PURE__ */ jsxRuntime.jsx(
653
+ "input",
654
+ {
655
+ type: "text",
656
+ className: "pollar-ramp-input",
657
+ placeholder: "MXN",
658
+ value: currency,
659
+ maxLength: 5,
660
+ onChange: (e) => onCurrencyChange(e.target.value.toUpperCase())
661
+ }
662
+ )
663
+ ] })
664
+ ] }),
665
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
666
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Country" }),
667
+ /* @__PURE__ */ jsxRuntime.jsxs(
668
+ "select",
669
+ {
670
+ className: "pollar-ramp-input",
671
+ value: country,
672
+ onChange: (e) => {
673
+ const c = e.target.value;
674
+ onCountryChange(c);
675
+ if (COUNTRY_CURRENCIES[c]) onCurrencyChange(COUNTRY_CURRENCIES[c]);
676
+ },
677
+ children: [
678
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "MX", children: "\u{1F1F2}\u{1F1FD} Mexico" }),
679
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "BR", children: "\u{1F1E7}\u{1F1F7} Brazil" }),
680
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "CO", children: "\u{1F1E8}\u{1F1F4} Colombia" }),
681
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "CL", children: "\u{1F1E8}\u{1F1F1} Chile" }),
682
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "PE", children: "\u{1F1F5}\u{1F1EA} Peru" }),
683
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "AR", children: "\u{1F1E6}\u{1F1F7} Argentina" })
684
+ ]
685
+ }
686
+ )
687
+ ] }),
688
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
689
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
690
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: !amount || isLoading, onClick: onFindRoute, children: "Find best route" })
691
+ ] })
692
+ ] }),
693
+ 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: [
694
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-loading-dot" }),
695
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: text })
696
+ ] }, i)) }),
697
+ step === "select_route" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
698
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-list", children: quotes.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx(RouteDisplay, { quote: q, onSelect: onSelectQuote }, i)) }),
699
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" })
700
+ ] }),
701
+ step === "payment_instructions" && paymentInstructions && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment", children: [
702
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-title", children: paymentInstructions.type }),
703
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
704
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: paymentInstructions.type === "CLABE" ? "CLABE number" : paymentInstructions.type === "PIX" ? "PIX key" : "Account number" }),
705
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
706
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: paymentInstructions.value }),
707
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-ramp-copy-btn", onClick: () => onCopy(paymentInstructions.value), children: "Copy" })
708
+ ] })
709
+ ] }),
710
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
711
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Amount to send" }),
712
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
713
+ /* @__PURE__ */ jsxRuntime.jsxs("code", { children: [
714
+ paymentInstructions.amount.toLocaleString(),
715
+ " ",
716
+ paymentInstructions.currency
717
+ ] }),
718
+ /* @__PURE__ */ jsxRuntime.jsx(
719
+ "button",
720
+ {
721
+ type: "button",
722
+ className: "pollar-ramp-copy-btn",
723
+ onClick: () => onCopy(`${paymentInstructions.amount} ${paymentInstructions.currency}`),
724
+ children: "Copy"
725
+ }
726
+ )
727
+ ] })
728
+ ] }),
729
+ paymentInstructions.expiresAt && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-payment-note", children: [
730
+ "Instructions expire at ",
731
+ new Date(paymentInstructions.expiresAt).toLocaleTimeString()
732
+ ] }),
733
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: "Done" })
734
+ ] })
735
+ ] });
736
+ }
737
+ var MOCK_DEFAULT_QUOTES = [
738
+ { quoteId: "meld-default", provider: "Meld", fee: 1.2, feeCurrency: "USD", rate: 1, rail: "ACH", protocol: "REST", estimatedTime: "~20 min", recommended: true }
739
+ ];
740
+ var MOCK_QUOTES = {
741
+ MX: [
742
+ { quoteId: "etherfuse-mx", provider: "Etherfuse", fee: 0.5, feeCurrency: "MXN", rate: 17.2, rail: "SPEI", protocol: "SEP-24", estimatedTime: "~10 min", recommended: true },
743
+ { quoteId: "alfredpay-mx", provider: "AlfredPay", fee: 0.8, feeCurrency: "MXN", rate: 17.1, rail: "SPEI", protocol: "REST", estimatedTime: "~15 min", recommended: false }
744
+ ],
745
+ BR: [{ quoteId: "abroad-br", provider: "Abroad", fee: 0.6, feeCurrency: "BRL", rate: 5.1, rail: "PIX", protocol: "REST", estimatedTime: "~5 min", recommended: true }],
746
+ CO: [
747
+ { quoteId: "abroad-co", provider: "Abroad", fee: 0.7, feeCurrency: "COP", rate: 4100, rail: "PSE", protocol: "REST", estimatedTime: "~10 min", recommended: true },
748
+ { quoteId: "koywe-co", provider: "Koywe", fee: 0.9, feeCurrency: "COP", rate: 4095, rail: "PSE", protocol: "REST", estimatedTime: "~15 min", recommended: false }
749
+ ],
750
+ DEFAULT: MOCK_DEFAULT_QUOTES
751
+ };
752
+ var MOCK_PAYMENT = {
753
+ type: "CLABE",
754
+ value: "646180157088723456",
755
+ amount: 1e3,
756
+ currency: "MXN",
757
+ expiresAt: new Date(Date.now() + 30 * 60 * 1e3).toISOString()
758
+ };
759
+ function RampWidget({ onClose }) {
760
+ const { getClient, walletAddress, styles } = usePollar();
761
+ const [step, setStep] = react.useState("input");
762
+ const [direction, setDirection] = react.useState("onramp");
763
+ const [amount, setAmount] = react.useState("");
764
+ const [currency, setCurrency] = react.useState("MXN");
765
+ const [country, setCountry] = react.useState("MX");
766
+ const [quotes, setQuotes] = react.useState([]);
767
+ const [paymentInstructions, setPaymentInstructions] = react.useState(null);
768
+ const [isLoading, setIsLoading] = react.useState(false);
769
+ const client = getClient();
770
+ const { theme = "light", accentColor = "#005DB4" } = styles;
771
+ async function handleFindRoute() {
772
+ setStep("loading_quote");
773
+ setIsLoading(true);
774
+ try {
775
+ const result = await client.getRampsQuote({
776
+ country,
777
+ amount: Number(amount),
778
+ currency,
779
+ direction
780
+ });
781
+ if (result.quotes) setQuotes(result.quotes);
782
+ } catch {
783
+ await new Promise((r) => setTimeout(r, 1500));
784
+ setQuotes(MOCK_QUOTES[country] ?? MOCK_DEFAULT_QUOTES);
785
+ } finally {
786
+ setIsLoading(false);
787
+ setStep("select_route");
788
+ }
789
+ }
790
+ async function handleSelectQuote(quote) {
791
+ if (!walletAddress) return;
792
+ setIsLoading(true);
793
+ const body = {
794
+ quoteId: `${quote.provider}-${Date.now()}`,
795
+ amount: Number(amount),
796
+ currency,
797
+ country,
798
+ walletAddress
799
+ };
800
+ try {
801
+ const result = await client.createOnRamp(body);
802
+ setPaymentInstructions(result.paymentInstructions);
803
+ } catch {
804
+ await new Promise((r) => setTimeout(r, 800));
805
+ setPaymentInstructions({ ...MOCK_PAYMENT, currency });
806
+ } finally {
807
+ setIsLoading(false);
808
+ setStep("payment_instructions");
809
+ }
810
+ }
811
+ function handleCopy(value) {
812
+ navigator.clipboard.writeText(value).catch(() => {
813
+ });
814
+ }
815
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
816
+ RampWidgetTemplate,
817
+ {
818
+ theme,
819
+ accentColor,
820
+ step,
821
+ direction,
822
+ amount,
823
+ currency,
824
+ country,
825
+ quotes,
826
+ paymentInstructions,
827
+ isLoading,
828
+ onDirectionChange: setDirection,
829
+ onAmountChange: setAmount,
830
+ onCurrencyChange: setCurrency,
831
+ onCountryChange: setCountry,
832
+ onFindRoute: handleFindRoute,
833
+ onSelectQuote: handleSelectQuote,
834
+ onCopy: handleCopy,
835
+ onClose
836
+ }
837
+ ) });
838
+ }
395
839
  function TransactionModalTemplate({
396
840
  theme,
397
841
  accentColor,
398
- transactionStateCode,
399
- status,
400
- buildResult,
401
- submitResult,
842
+ transaction,
402
843
  onClose,
403
- onSignAndSend,
404
- onRetrySignAndSend
844
+ onSignAndSend
405
845
  }) {
406
846
  const isDark = theme === "dark";
407
847
  const cssVars = {
@@ -418,37 +858,49 @@ function TransactionModalTemplate({
418
858
  };
419
859
  const [showXdr, setShowXdr] = react.useState(false);
420
860
  const [copied, setCopied] = react.useState(false);
861
+ const buildData = "buildData" in transaction ? transaction.buildData : null;
862
+ const hash = transaction.step === "success" ? transaction.hash : null;
863
+ const errorDetails = transaction.step === "error" ? transaction.details ?? null : null;
864
+ const isBuilt = transaction.step === "built";
865
+ const isSigning = transaction.step === "signing";
866
+ const isSuccess = transaction.step === "success";
867
+ const isError = transaction.step === "error";
868
+ const showDetails = buildData !== null && (isBuilt || isSigning || isSuccess);
869
+ const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : "public";
870
+ const explorerUrl = hash ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}` : null;
421
871
  function handleCopyHash() {
422
- if (!submitResult) return;
423
- navigator.clipboard.writeText(submitResult.hash).then(() => {
872
+ if (!hash) return;
873
+ navigator.clipboard.writeText(hash).then(() => {
424
874
  setCopied(true);
425
875
  setTimeout(() => setCopied(false), 2e3);
426
876
  });
427
877
  }
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";
878
+ const statusMessage = {
879
+ idle: "",
880
+ building: "Building transaction\u2026",
881
+ built: "Ready to sign and send",
882
+ signing: "Signing and sending transaction\u2026",
883
+ success: "Transaction sent successfully",
884
+ error: "Transaction failed"
885
+ };
434
886
  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" }) }) })
887
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
888
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction" }),
889
+ /* @__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" }) }) })
438
890
  ] }),
439
- isBuilt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
891
+ showDetails && buildData && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
440
892
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-summary", children: [
441
893
  /* @__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)) })
894
+ /* @__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
895
  ] }),
444
896
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta", children: [
445
897
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
446
898
  /* @__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 })
899
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.network })
448
900
  ] }),
449
901
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
450
902
  /* @__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 })
903
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.fee })
452
904
  ] })
453
905
  ] }),
454
906
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-xdr", children: [
@@ -467,111 +919,52 @@ function TransactionModalTemplate({
467
919
  ),
468
920
  "Raw transaction (XDR)"
469
921
  ] }),
470
- showXdr && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-xdr-content", children: buildResult.unsignedXdr })
922
+ showXdr && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-xdr-content", children: buildData.unsignedXdr })
471
923
  ] })
472
924
  ] }),
473
- submitResult && transactionStateCode === "SIGN_SEND_TRANSACTION_SUCCESS" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result", children: [
925
+ isSuccess && hash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result", children: [
474
926
  /* @__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 }),
927
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-hash", children: hash }),
476
928
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result-actions", children: [
477
929
  /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-result-btn", onClick: handleCopyHash, children: copied ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
478
930
  /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
479
931
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
480
- /* @__PURE__ */ jsxRuntime.jsx(
481
- "path",
482
- {
483
- d: "M3.5 7l2.5 2.5 4.5-5",
484
- stroke: "white",
485
- strokeWidth: "1.5",
486
- strokeLinecap: "round",
487
- strokeLinejoin: "round"
488
- }
489
- )
932
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "white", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
490
933
  ] }),
491
934
  "Copied!"
492
935
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
493
936
  /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
494
937
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
495
- /* @__PURE__ */ jsxRuntime.jsx(
496
- "path",
497
- {
498
- d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1",
499
- stroke: "currentColor",
500
- strokeWidth: "1.5",
501
- strokeLinecap: "round"
502
- }
503
- )
938
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
504
939
  ] }),
505
940
  "Copy hash"
506
941
  ] }) }),
507
942
  explorerUrl && /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "pollar-tx-result-btn", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", children: [
508
943
  /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
509
- /* @__PURE__ */ jsxRuntime.jsx(
510
- "path",
511
- {
512
- d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8",
513
- stroke: "currentColor",
514
- strokeWidth: "1.5",
515
- strokeLinecap: "round"
516
- }
517
- ),
518
- /* @__PURE__ */ jsxRuntime.jsx(
519
- "path",
520
- {
521
- d: "M8 1h4m0 0v4m0-4L6 7",
522
- stroke: "currentColor",
523
- strokeWidth: "1.5",
524
- strokeLinecap: "round",
525
- strokeLinejoin: "round"
526
- }
527
- )
944
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
945
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 1h4m0 0v4m0-4L6 7", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
528
946
  ] }),
529
947
  "View on Explorer"
530
948
  ] })
531
949
  ] })
532
950
  ] }),
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" }),
535
- /* @__PURE__ */ jsxRuntime.jsx(
536
- ModalStatusBanner,
537
- {
538
- message: TRANSACTION_CODE_MESSAGES[transactionStateCode] ?? "",
539
- status
540
- }
541
- ),
951
+ isError && errorDetails && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-error-details", children: [
952
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-error-details-label", children: "Error details" }),
953
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-error-details-content", children: errorDetails })
954
+ ] }),
955
+ isBuilt && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onSignAndSend, children: "Sign & Send" }),
956
+ isSigning && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", disabled: true, children: "Signing & sending\u2026" }),
957
+ isSuccess && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onClose, children: "Done" }),
958
+ /* @__PURE__ */ jsxRuntime.jsx(ModalStatusBanner, { message: statusMessage[transaction.step], status: isError ? "ERROR" : isSigning || transaction.step === "building" ? "LOADING" : isSuccess ? "SUCCESS" : "NONE" }),
542
959
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
543
960
  ] });
544
961
  }
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
962
  function TransactionModal({ onClose }) {
556
- const {
557
- getClient,
558
- styles,
559
- state: { transaction }
560
- } = usePollar();
963
+ const { getClient, styles, transaction } = usePollar();
561
964
  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;
567
- }
568
- let submitResult = null;
569
- if (isTxSignSendResponseContent(content)) {
570
- submitResult = content;
571
- }
572
965
  async function handleSignAndSend() {
573
- if (buildResult) {
574
- await getClient().submitTx(buildResult.unsignedXdr);
966
+ if (transaction.step === "built") {
967
+ await getClient().signAndSubmitTx(transaction.buildData.unsignedXdr);
575
968
  }
576
969
  }
577
970
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -579,64 +972,262 @@ function TransactionModal({ onClose }) {
579
972
  {
580
973
  theme,
581
974
  accentColor,
582
- transactionStateCode,
583
- status: transaction.status,
584
- buildResult,
585
- submitResult,
975
+ transaction,
586
976
  onClose,
587
- onSignAndSend: handleSignAndSend,
588
- onRetrySignAndSend: handleSignAndSend
977
+ onSignAndSend: handleSignAndSend
978
+ }
979
+ ) });
980
+ }
981
+ var PAGE_SIZE = 10;
982
+ function StatusBadge({ status }) {
983
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-badge", "data-status": status, children: status });
984
+ }
985
+ function formatDate(iso) {
986
+ return new Date(iso).toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
987
+ }
988
+ function TxHistoryModalTemplate({
989
+ theme,
990
+ accentColor,
991
+ txHistory,
992
+ offset,
993
+ onRefresh,
994
+ onPrev,
995
+ onNext,
996
+ onClose
997
+ }) {
998
+ const isDark = theme === "dark";
999
+ const cssVars = {
1000
+ "--pollar-accent": accentColor,
1001
+ "--pollar-buttons-border-radius": "8px",
1002
+ "--pollar-buttons-height": "44px",
1003
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1004
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1005
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
1006
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1007
+ "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1008
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1009
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
1010
+ };
1011
+ const isLoading = txHistory.step === "loading";
1012
+ const records = txHistory.step === "loaded" ? txHistory.data.records : [];
1013
+ const total = txHistory.step === "loaded" ? txHistory.data.total : 0;
1014
+ const hasPrev = offset > 0;
1015
+ const hasNext = offset + PAGE_SIZE < total;
1016
+ const showPagination = txHistory.step === "loaded" && total > PAGE_SIZE;
1017
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1018
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1019
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
1020
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1021
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading, children: [
1022
+ /* @__PURE__ */ jsxRuntime.jsxs(
1023
+ "svg",
1024
+ {
1025
+ className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1026
+ width: "13",
1027
+ height: "13",
1028
+ viewBox: "0 0 13 13",
1029
+ fill: "none",
1030
+ "aria-hidden": true,
1031
+ children: [
1032
+ /* @__PURE__ */ jsxRuntime.jsx(
1033
+ "path",
1034
+ {
1035
+ d: "M11.5 6.5a5 5 0 11-1.5-3.536",
1036
+ stroke: "currentColor",
1037
+ strokeWidth: "1.5",
1038
+ strokeLinecap: "round"
1039
+ }
1040
+ ),
1041
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1042
+ ]
1043
+ }
1044
+ ),
1045
+ "Refresh"
1046
+ ] }),
1047
+ /* @__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" }) }) })
1048
+ ] })
1049
+ ] }),
1050
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-list", children: [
1051
+ txHistory.step === "idle" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Click Refresh to load transactions." }),
1052
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1053
+ txHistory.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
1054
+ txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
1055
+ records.map((record) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-item", children: [
1056
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
1057
+ /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: record.status }),
1058
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-item-meta", children: [
1059
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: record.operation }),
1060
+ record.feeXlm && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1061
+ "\xB7 ",
1062
+ record.feeXlm,
1063
+ " XLM"
1064
+ ] }),
1065
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1066
+ "\xB7 ",
1067
+ formatDate(record.createdAt)
1068
+ ] })
1069
+ ] })
1070
+ ] }, record.id))
1071
+ ] }),
1072
+ showPagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-pagination", children: [
1073
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-pagination-info", children: [
1074
+ offset + 1,
1075
+ "\u2013",
1076
+ Math.min(offset + PAGE_SIZE, total),
1077
+ " of ",
1078
+ total
1079
+ ] }),
1080
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-pagination-btns", children: [
1081
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-hist-page-btn", onClick: onPrev, disabled: !hasPrev, children: "\u2190 Prev" }),
1082
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-hist-page-btn", onClick: onNext, disabled: !hasNext, children: "Next \u2192" })
1083
+ ] })
1084
+ ] }),
1085
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
1086
+ ] });
1087
+ }
1088
+ var PAGE_SIZE2 = 10;
1089
+ function TxHistoryModal({ onClose }) {
1090
+ const { getClient, styles, txHistory } = usePollar();
1091
+ const { theme = "light", accentColor = "#005DB4" } = styles;
1092
+ const [offset, setOffset] = react.useState(0);
1093
+ function load(nextOffset) {
1094
+ setOffset(nextOffset);
1095
+ void getClient().fetchTxHistory({ limit: PAGE_SIZE2, offset: nextOffset });
1096
+ }
1097
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
1098
+ TxHistoryModalTemplate,
1099
+ {
1100
+ theme,
1101
+ accentColor,
1102
+ txHistory,
1103
+ offset,
1104
+ onRefresh: () => load(offset),
1105
+ onPrev: () => load(Math.max(0, offset - PAGE_SIZE2)),
1106
+ onNext: () => load(offset + PAGE_SIZE2),
1107
+ onClose
589
1108
  }
590
1109
  ) });
591
1110
  }
1111
+ function formatBalance(balance) {
1112
+ const n = parseFloat(balance);
1113
+ return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
1114
+ }
1115
+ function cropAddress(address) {
1116
+ if (address.length <= 16) return address;
1117
+ return `${address.slice(0, 8)}...${address.slice(-8)}`;
1118
+ }
1119
+ function BalanceItem({ record }) {
1120
+ const balanceDiffers = record.balance !== record.available;
1121
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-item", children: [
1122
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-asset", children: record.code }),
1123
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-amounts", children: [
1124
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-bal-amount", children: formatBalance(record.balance) }),
1125
+ balanceDiffers && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-bal-available", children: [
1126
+ formatBalance(record.available),
1127
+ " available"
1128
+ ] })
1129
+ ] })
1130
+ ] });
1131
+ }
1132
+ function WalletBalanceModal({ onClose }) {
1133
+ const { getBalance, walletAddress, styles } = usePollar();
1134
+ const { theme = "light", accentColor = "#005DB4" } = styles;
1135
+ const isDark = theme === "dark";
1136
+ const cssVars = {
1137
+ "--pollar-accent": accentColor,
1138
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1139
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1140
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
1141
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1142
+ "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1143
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
1144
+ };
1145
+ const [status, setStatus] = react.useState("loading");
1146
+ const [data, setData] = react.useState(null);
1147
+ async function load() {
1148
+ setStatus("loading");
1149
+ const result = await getBalance();
1150
+ if (result) {
1151
+ setData(result);
1152
+ setStatus("loaded");
1153
+ } else {
1154
+ setStatus("error");
1155
+ }
1156
+ }
1157
+ react.useEffect(() => {
1158
+ void load();
1159
+ }, []);
1160
+ const isLoading = status === "loading";
1161
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1162
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1163
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
1164
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
1165
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: load, disabled: isLoading, children: [
1166
+ /* @__PURE__ */ jsxRuntime.jsxs(
1167
+ "svg",
1168
+ {
1169
+ className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
1170
+ width: "13",
1171
+ height: "13",
1172
+ viewBox: "0 0 13 13",
1173
+ fill: "none",
1174
+ "aria-hidden": true,
1175
+ children: [
1176
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
1177
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1178
+ ]
1179
+ }
1180
+ ),
1181
+ "Refresh"
1182
+ ] }),
1183
+ /* @__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" }) }) })
1184
+ ] })
1185
+ ] }),
1186
+ walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-bal-address", children: cropAddress(walletAddress) }),
1187
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1188
+ status === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Failed to load balances. Check your connection." }),
1189
+ status === "loaded" && data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
1190
+ "Account not found on ",
1191
+ data.network,
1192
+ "."
1193
+ ] }),
1194
+ status === "loaded" && data?.exists && data.balances.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No balances found." }),
1195
+ status === "loaded" && 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 ?? ""))) }),
1196
+ /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
1197
+ ] }) });
1198
+ }
592
1199
  var emptyResponse = {
593
1200
  application: {
594
1201
  name: ""
595
1202
  },
596
1203
  styles: {}
597
1204
  };
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
- }
1205
+ async function fetchRemoteConfig(client) {
1206
+ const content = await client.getAppConfig();
1207
+ return content ?? emptyResponse;
608
1208
  }
609
1209
  var PollarContext = react.createContext(null);
610
1210
  function PollarProvider({ config, styles: propStyles, children }) {
611
1211
  const [pollarClient] = react.useState(() => new core.PollarClient(config));
612
- const [stellarClient] = react.useState(() => new core.StellarClient(config.stellarNetwork || "testnet"));
1212
+ const [networkState, setNetworkState] = react.useState(() => pollarClient.getNetworkState());
1213
+ const stellarClient = react.useMemo(() => {
1214
+ const network = networkState.step === "connected" ? networkState.network : "testnet";
1215
+ return new core.StellarClient(network);
1216
+ }, [networkState]);
613
1217
  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
- });
1218
+ const [transaction, setTransaction] = react.useState({ step: "idle" });
1219
+ const [txHistory, setTxHistory] = react.useState({ step: "idle" });
630
1220
  const [remoteConfig, setRemoteConfig] = react.useState(emptyResponse);
631
1221
  const [styles, setStyles] = react.useState(propStyles ?? {});
632
1222
  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
- });
1223
+ return pollarClient.onTransactionStateChange(setTransaction);
1224
+ }, [pollarClient]);
1225
+ react.useEffect(() => {
1226
+ return pollarClient.onTxHistoryStateChange(setTxHistory);
1227
+ }, [pollarClient]);
1228
+ react.useEffect(() => {
1229
+ return pollarClient.onNetworkStateChange((state) => {
1230
+ setNetworkState(state);
640
1231
  });
641
1232
  }, [pollarClient]);
642
1233
  react.useEffect(() => {
@@ -649,7 +1240,7 @@ function PollarProvider({ config, styles: propStyles, children }) {
649
1240
  });
650
1241
  }, [pollarClient]);
651
1242
  react.useEffect(() => {
652
- fetchRemoteConfig(pollarClient.getApi()).then((fetched) => {
1243
+ fetchRemoteConfig(pollarClient).then((fetched) => {
653
1244
  setRemoteConfig(fetched);
654
1245
  setStyles({
655
1246
  ...fetched.styles,
@@ -660,40 +1251,62 @@ function PollarProvider({ config, styles: propStyles, children }) {
660
1251
  setStyles(propStyles ?? {});
661
1252
  });
662
1253
  }, [pollarClient]);
1254
+ react.useEffect(() => {
1255
+ if (transaction.step !== "idle") {
1256
+ setTransactionModalOpen(true);
1257
+ }
1258
+ }, [transaction.step]);
663
1259
  const [loginModalOpen, setLoginModalOpen] = react.useState(false);
664
1260
  const [transactionModalOpen, setTransactionModalOpen] = react.useState(false);
1261
+ const [kycModalOpen, setKycModalOpen] = react.useState(false);
1262
+ const [kycModalOptions, setKycModalOptions] = react.useState({});
1263
+ const [rampWidgetOpen, setRampWidgetOpen] = react.useState(false);
1264
+ const [txHistoryModalOpen, setTxHistoryModalOpen] = react.useState(false);
1265
+ const [walletBalanceModalOpen, setWalletBalanceModalOpen] = react.useState(false);
665
1266
  const contextValue = react.useMemo(
666
1267
  () => ({
667
1268
  walletAddress: sessionState?.wallet?.publicKey || "",
668
1269
  getClient: () => pollarClient,
669
- state,
1270
+ transaction,
670
1271
  login: (options) => pollarClient.login(options),
671
1272
  logout: () => pollarClient.logout(),
672
- isAuthenticated: pollarClient.isAuthenticated(),
1273
+ isAuthenticated: !!sessionState?.wallet?.publicKey,
673
1274
  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
- },
1275
+ signAndSubmitTx: (signedXdr) => pollarClient.signAndSubmitTx(signedXdr),
679
1276
  openTransactionModal: () => setTransactionModalOpen(true),
680
1277
  openLoginModal: () => setLoginModalOpen(true),
1278
+ openKycModal: (options = {}) => {
1279
+ setKycModalOptions(options);
1280
+ setKycModalOpen(true);
1281
+ },
1282
+ openRampWidget: () => setRampWidgetOpen(true),
1283
+ txHistory,
1284
+ openTxHistoryModal: () => setTxHistoryModalOpen(true),
1285
+ openWalletBalanceModal: () => setWalletBalanceModalOpen(true),
1286
+ network: networkState.step === "connected" ? networkState.network : "testnet",
1287
+ setNetwork: (network) => pollarClient.setNetwork(network),
681
1288
  config: remoteConfig,
682
1289
  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
- }
1290
+ getBalance: (publicKey) => pollarClient.getWalletBalance(publicKey)
690
1291
  }),
691
- [sessionState, remoteConfig, styles, pollarClient, state]
1292
+ [sessionState, remoteConfig, styles, pollarClient, transaction, txHistory, networkState, stellarClient]
692
1293
  );
693
1294
  return /* @__PURE__ */ jsxRuntime.jsxs(PollarContext.Provider, { value: contextValue, children: [
694
1295
  children,
695
1296
  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) }) })
1297
+ transactionModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTransactionModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TransactionModal, { onClose: () => setTransactionModalOpen(false) }) }),
1298
+ kycModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setKycModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
1299
+ KycModal,
1300
+ {
1301
+ onClose: () => setKycModalOpen(false),
1302
+ ...kycModalOptions.country !== void 0 && { country: kycModalOptions.country },
1303
+ ...kycModalOptions.level !== void 0 && { level: kycModalOptions.level },
1304
+ ...kycModalOptions.onApproved !== void 0 && { onApproved: kycModalOptions.onApproved }
1305
+ }
1306
+ ) }),
1307
+ rampWidgetOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setRampWidgetOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(RampWidget, { onClose: () => setRampWidgetOpen(false) }) }),
1308
+ txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
1309
+ walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) })
697
1310
  ] });
698
1311
  }
699
1312
  function usePollar() {
@@ -711,7 +1324,7 @@ function ButtonLogo() {
711
1324
  return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
712
1325
  }
713
1326
  function WalletButton() {
714
- const { getClient, walletAddress, styles, openLoginModal } = usePollar();
1327
+ const { getClient, walletAddress, styles, openLoginModal, openTxHistoryModal, openWalletBalanceModal } = usePollar();
715
1328
  const [open, setOpen] = react.useState(false);
716
1329
  const [copied, setCopied] = react.useState(false);
717
1330
  const wrapperRef = react.useRef(null);
@@ -783,6 +1396,72 @@ function WalletButton() {
783
1396
  ),
784
1397
  copied ? "Copied!" : "Copy address"
785
1398
  ] }),
1399
+ /* @__PURE__ */ jsxRuntime.jsxs(
1400
+ "button",
1401
+ {
1402
+ className: "wallet-dropdown-item",
1403
+ style: { color: itemColor },
1404
+ onClick: () => {
1405
+ setOpen(false);
1406
+ openWalletBalanceModal();
1407
+ },
1408
+ children: [
1409
+ /* @__PURE__ */ jsxRuntime.jsxs(
1410
+ "svg",
1411
+ {
1412
+ width: "14",
1413
+ height: "14",
1414
+ viewBox: "0 0 24 24",
1415
+ fill: "none",
1416
+ stroke: "currentColor",
1417
+ strokeWidth: "2",
1418
+ strokeLinecap: "round",
1419
+ strokeLinejoin: "round",
1420
+ children: [
1421
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "4", width: "22", height: "16", rx: "2", ry: "2" }),
1422
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "16", cy: "12", r: "2" }),
1423
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22 8H12" })
1424
+ ]
1425
+ }
1426
+ ),
1427
+ "Wallet balance"
1428
+ ]
1429
+ }
1430
+ ),
1431
+ /* @__PURE__ */ jsxRuntime.jsxs(
1432
+ "button",
1433
+ {
1434
+ className: "wallet-dropdown-item",
1435
+ style: { color: itemColor },
1436
+ onClick: () => {
1437
+ setOpen(false);
1438
+ openTxHistoryModal();
1439
+ },
1440
+ children: [
1441
+ /* @__PURE__ */ jsxRuntime.jsxs(
1442
+ "svg",
1443
+ {
1444
+ width: "14",
1445
+ height: "14",
1446
+ viewBox: "0 0 24 24",
1447
+ fill: "none",
1448
+ stroke: "currentColor",
1449
+ strokeWidth: "2",
1450
+ strokeLinecap: "round",
1451
+ strokeLinejoin: "round",
1452
+ children: [
1453
+ /* @__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" }),
1454
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "14,2 14,8 20,8" }),
1455
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1456
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1457
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "10,9 9,9 8,9" })
1458
+ ]
1459
+ }
1460
+ ),
1461
+ "Transaction history"
1462
+ ]
1463
+ }
1464
+ ),
786
1465
  /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "wallet-dropdown-item danger", onClick: handleLogout, children: [
787
1466
  /* @__PURE__ */ jsxRuntime.jsxs(
788
1467
  "svg",
@@ -808,7 +1487,11 @@ function WalletButton() {
808
1487
  ] });
809
1488
  }
810
1489
 
1490
+ exports.KycModal = KycModal;
1491
+ exports.KycStatus = KycStatus;
811
1492
  exports.PollarProvider = PollarProvider;
1493
+ exports.RampWidget = RampWidget;
1494
+ exports.RouteDisplay = RouteDisplay;
812
1495
  exports.WalletButton = WalletButton;
813
1496
  exports.usePollar = usePollar;
814
1497
  //# sourceMappingURL=index.js.map