@pollar/react 0.10.1-rc.1 → 0.10.1-rc.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.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +144 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -308,7 +308,7 @@ interface KycModalTemplateProps {
|
|
|
308
308
|
}
|
|
309
309
|
declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
310
310
|
|
|
311
|
-
type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
|
|
311
|
+
type RampStep = 'input' | 'loading_quote' | 'select_route' | 'contact' | 'status' | 'error';
|
|
312
312
|
interface RampWidgetTemplateProps {
|
|
313
313
|
theme: string;
|
|
314
314
|
accentColor: string;
|
|
@@ -317,6 +317,8 @@ interface RampWidgetTemplateProps {
|
|
|
317
317
|
amount: string;
|
|
318
318
|
currency: string;
|
|
319
319
|
country: string;
|
|
320
|
+
email: string;
|
|
321
|
+
fullName: string;
|
|
320
322
|
countries: RampCountry[];
|
|
321
323
|
countriesLoading: boolean;
|
|
322
324
|
refreshing: boolean;
|
|
@@ -326,22 +328,25 @@ interface RampWidgetTemplateProps {
|
|
|
326
328
|
txStatus: RampTxStatus | null;
|
|
327
329
|
kycUrl: string | null;
|
|
328
330
|
stellarTxHash: string | null;
|
|
331
|
+
depositInstructions: Record<string, unknown> | null;
|
|
329
332
|
canComplete: boolean;
|
|
330
333
|
completing: boolean;
|
|
331
334
|
errorMsg: string | null;
|
|
332
335
|
onDirectionChange: (d: RampDirection) => void;
|
|
333
336
|
onAmountChange: (v: string) => void;
|
|
334
|
-
|
|
337
|
+
onEmailChange: (v: string) => void;
|
|
338
|
+
onFullNameChange: (v: string) => void;
|
|
335
339
|
onCountryChange: (v: string) => void;
|
|
336
340
|
onFindRoute: () => void;
|
|
337
341
|
onSelectQuote: (q: RampQuote) => void;
|
|
342
|
+
onContactContinue: () => void;
|
|
338
343
|
onOpenKyc: () => void;
|
|
339
344
|
onCompleteWithdraw: () => void;
|
|
340
345
|
onRetry: () => void;
|
|
341
346
|
onRefresh: () => void;
|
|
342
347
|
onClose: () => void;
|
|
343
348
|
}
|
|
344
|
-
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange,
|
|
349
|
+
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, email, fullName, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onEmailChange, onFullNameChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
345
350
|
|
|
346
351
|
interface TransactionModalTemplateProps {
|
|
347
352
|
theme: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -308,7 +308,7 @@ interface KycModalTemplateProps {
|
|
|
308
308
|
}
|
|
309
309
|
declare function KycModalTemplate({ theme, accentColor, step, providers, selectedProvider, session, kycStatus, isLoading, onSelectProvider, onDoneVerifying, onClose, }: KycModalTemplateProps): react_jsx_runtime.JSX.Element;
|
|
310
310
|
|
|
311
|
-
type RampStep = 'input' | 'loading_quote' | 'select_route' | 'status' | 'error';
|
|
311
|
+
type RampStep = 'input' | 'loading_quote' | 'select_route' | 'contact' | 'status' | 'error';
|
|
312
312
|
interface RampWidgetTemplateProps {
|
|
313
313
|
theme: string;
|
|
314
314
|
accentColor: string;
|
|
@@ -317,6 +317,8 @@ interface RampWidgetTemplateProps {
|
|
|
317
317
|
amount: string;
|
|
318
318
|
currency: string;
|
|
319
319
|
country: string;
|
|
320
|
+
email: string;
|
|
321
|
+
fullName: string;
|
|
320
322
|
countries: RampCountry[];
|
|
321
323
|
countriesLoading: boolean;
|
|
322
324
|
refreshing: boolean;
|
|
@@ -326,22 +328,25 @@ interface RampWidgetTemplateProps {
|
|
|
326
328
|
txStatus: RampTxStatus | null;
|
|
327
329
|
kycUrl: string | null;
|
|
328
330
|
stellarTxHash: string | null;
|
|
331
|
+
depositInstructions: Record<string, unknown> | null;
|
|
329
332
|
canComplete: boolean;
|
|
330
333
|
completing: boolean;
|
|
331
334
|
errorMsg: string | null;
|
|
332
335
|
onDirectionChange: (d: RampDirection) => void;
|
|
333
336
|
onAmountChange: (v: string) => void;
|
|
334
|
-
|
|
337
|
+
onEmailChange: (v: string) => void;
|
|
338
|
+
onFullNameChange: (v: string) => void;
|
|
335
339
|
onCountryChange: (v: string) => void;
|
|
336
340
|
onFindRoute: () => void;
|
|
337
341
|
onSelectQuote: (q: RampQuote) => void;
|
|
342
|
+
onContactContinue: () => void;
|
|
338
343
|
onOpenKyc: () => void;
|
|
339
344
|
onCompleteWithdraw: () => void;
|
|
340
345
|
onRetry: () => void;
|
|
341
346
|
onRefresh: () => void;
|
|
342
347
|
onClose: () => void;
|
|
343
348
|
}
|
|
344
|
-
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, canComplete, completing, errorMsg, onDirectionChange, onAmountChange,
|
|
349
|
+
declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, email, fullName, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, stellarTxHash, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onEmailChange, onFullNameChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
|
|
345
350
|
|
|
346
351
|
interface TransactionModalTemplateProps {
|
|
347
352
|
theme: string;
|
package/dist/index.js
CHANGED
|
@@ -1035,7 +1035,7 @@ var PollarModalFooter = () => {
|
|
|
1035
1035
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1036
1036
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1037
1037
|
"v",
|
|
1038
|
-
"0.10.1-rc.
|
|
1038
|
+
"0.10.1-rc.2"
|
|
1039
1039
|
] })
|
|
1040
1040
|
] })
|
|
1041
1041
|
] });
|
|
@@ -2471,6 +2471,33 @@ var STATUS_LABEL = {
|
|
|
2471
2471
|
completed: "Completed",
|
|
2472
2472
|
failed: "Failed"
|
|
2473
2473
|
};
|
|
2474
|
+
var INSTRUCTION_LABELS = {
|
|
2475
|
+
br_code: "Pix code",
|
|
2476
|
+
account_holder_name: "Account holder",
|
|
2477
|
+
bank_name: "Bank",
|
|
2478
|
+
bank_address: "Bank address",
|
|
2479
|
+
bank_account_number: "Account number",
|
|
2480
|
+
bank_routing_number: "Routing number",
|
|
2481
|
+
iban: "IBAN",
|
|
2482
|
+
bic: "BIC",
|
|
2483
|
+
clabe: "CLABE",
|
|
2484
|
+
amount: "Amount",
|
|
2485
|
+
currency: "Currency",
|
|
2486
|
+
payment_rails: "Rails"
|
|
2487
|
+
};
|
|
2488
|
+
function flattenInstructions(instr) {
|
|
2489
|
+
const out = [];
|
|
2490
|
+
for (const [k, v] of Object.entries(instr)) {
|
|
2491
|
+
let value = "";
|
|
2492
|
+
if (typeof v === "string" || typeof v === "number") value = String(v);
|
|
2493
|
+
else if (Array.isArray(v))
|
|
2494
|
+
value = v.filter((x) => typeof x === "string" || typeof x === "number").join(", ");
|
|
2495
|
+
else continue;
|
|
2496
|
+
if (!value) continue;
|
|
2497
|
+
out.push({ key: k, label: INSTRUCTION_LABELS[k] ?? k, value });
|
|
2498
|
+
}
|
|
2499
|
+
return out;
|
|
2500
|
+
}
|
|
2474
2501
|
function RampWidgetTemplate({
|
|
2475
2502
|
theme,
|
|
2476
2503
|
accentColor,
|
|
@@ -2479,6 +2506,8 @@ function RampWidgetTemplate({
|
|
|
2479
2506
|
amount,
|
|
2480
2507
|
currency,
|
|
2481
2508
|
country,
|
|
2509
|
+
email,
|
|
2510
|
+
fullName,
|
|
2482
2511
|
countries,
|
|
2483
2512
|
countriesLoading,
|
|
2484
2513
|
refreshing,
|
|
@@ -2488,15 +2517,18 @@ function RampWidgetTemplate({
|
|
|
2488
2517
|
txStatus,
|
|
2489
2518
|
kycUrl,
|
|
2490
2519
|
stellarTxHash,
|
|
2520
|
+
depositInstructions,
|
|
2491
2521
|
canComplete,
|
|
2492
2522
|
completing,
|
|
2493
2523
|
errorMsg,
|
|
2494
2524
|
onDirectionChange,
|
|
2495
2525
|
onAmountChange,
|
|
2496
|
-
|
|
2526
|
+
onEmailChange,
|
|
2527
|
+
onFullNameChange,
|
|
2497
2528
|
onCountryChange,
|
|
2498
2529
|
onFindRoute,
|
|
2499
2530
|
onSelectQuote,
|
|
2531
|
+
onContactContinue,
|
|
2500
2532
|
onOpenKyc,
|
|
2501
2533
|
onCompleteWithdraw,
|
|
2502
2534
|
onRetry,
|
|
@@ -2528,6 +2560,7 @@ function RampWidgetTemplate({
|
|
|
2528
2560
|
input: direction === "onramp" ? "Buy crypto" : "Sell crypto",
|
|
2529
2561
|
loading_quote: "Finding best route",
|
|
2530
2562
|
select_route: "Select provider",
|
|
2563
|
+
contact: "Your details",
|
|
2531
2564
|
status: direction === "onramp" ? "Complete your deposit" : "Complete your withdrawal",
|
|
2532
2565
|
error: "Something went wrong"
|
|
2533
2566
|
};
|
|
@@ -2535,6 +2568,7 @@ function RampWidgetTemplate({
|
|
|
2535
2568
|
input: direction === "onramp" ? "Enter the amount you want to deposit" : "Enter the amount you want to withdraw",
|
|
2536
2569
|
loading_quote: "Comparing providers in real time\u2026",
|
|
2537
2570
|
select_route: "All prices include fees",
|
|
2571
|
+
contact: `${provider || "This provider"} needs your name and email to verify you`,
|
|
2538
2572
|
status: `Finish the flow at ${provider || "the provider"} to continue`,
|
|
2539
2573
|
error: "Please try again"
|
|
2540
2574
|
};
|
|
@@ -2592,36 +2626,6 @@ function RampWidgetTemplate({
|
|
|
2592
2626
|
}
|
|
2593
2627
|
)
|
|
2594
2628
|
] }),
|
|
2595
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input-row", children: [
|
|
2596
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2597
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Amount" }),
|
|
2598
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2599
|
-
"input",
|
|
2600
|
-
{
|
|
2601
|
-
type: "number",
|
|
2602
|
-
className: "pollar-ramp-input",
|
|
2603
|
-
placeholder: "0.00",
|
|
2604
|
-
value: amount,
|
|
2605
|
-
min: "0",
|
|
2606
|
-
onChange: (e) => onAmountChange(e.target.value)
|
|
2607
|
-
}
|
|
2608
|
-
)
|
|
2609
|
-
] }),
|
|
2610
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", style: { maxWidth: 90 }, children: [
|
|
2611
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Currency" }),
|
|
2612
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2613
|
-
"input",
|
|
2614
|
-
{
|
|
2615
|
-
type: "text",
|
|
2616
|
-
className: "pollar-ramp-input",
|
|
2617
|
-
placeholder: "MXN",
|
|
2618
|
-
value: currency,
|
|
2619
|
-
maxLength: 5,
|
|
2620
|
-
onChange: (e) => onCurrencyChange(e.target.value.toUpperCase())
|
|
2621
|
-
}
|
|
2622
|
-
)
|
|
2623
|
-
] })
|
|
2624
|
-
] }),
|
|
2625
2629
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2626
2630
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Country" }),
|
|
2627
2631
|
countriesLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-input pollar-ramp-input-loading", children: "Loading countries\u2026" }) : countries.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsxRuntime.jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: c.code, children: [
|
|
@@ -2631,6 +2635,23 @@ function RampWidgetTemplate({
|
|
|
2631
2635
|
c.currency ? ` \u2014 ${c.currency}` : ""
|
|
2632
2636
|
] }, c.code)) })
|
|
2633
2637
|
] }),
|
|
2638
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2639
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-ramp-label", children: [
|
|
2640
|
+
"Amount",
|
|
2641
|
+
currency ? ` (${currency})` : ""
|
|
2642
|
+
] }),
|
|
2643
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2644
|
+
"input",
|
|
2645
|
+
{
|
|
2646
|
+
type: "number",
|
|
2647
|
+
className: "pollar-ramp-input",
|
|
2648
|
+
placeholder: "0.00",
|
|
2649
|
+
value: amount,
|
|
2650
|
+
min: "0",
|
|
2651
|
+
onChange: (e) => onAmountChange(e.target.value)
|
|
2652
|
+
}
|
|
2653
|
+
)
|
|
2654
|
+
] }),
|
|
2634
2655
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
|
|
2635
2656
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" }),
|
|
2636
2657
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2653,6 +2674,48 @@ function RampWidgetTemplate({
|
|
|
2653
2674
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-list", children: quotes.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx(RouteDisplay, { quote: q, onSelect: onSelectQuote }, i)) }),
|
|
2654
2675
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Cancel" })
|
|
2655
2676
|
] }),
|
|
2677
|
+
step === "contact" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2678
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2679
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Full name" }),
|
|
2680
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2681
|
+
"input",
|
|
2682
|
+
{
|
|
2683
|
+
type: "text",
|
|
2684
|
+
className: "pollar-ramp-input",
|
|
2685
|
+
placeholder: "Jane Doe",
|
|
2686
|
+
value: fullName,
|
|
2687
|
+
onChange: (e) => onFullNameChange(e.target.value)
|
|
2688
|
+
}
|
|
2689
|
+
)
|
|
2690
|
+
] }),
|
|
2691
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2692
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Email" }),
|
|
2693
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2694
|
+
"input",
|
|
2695
|
+
{
|
|
2696
|
+
type: "email",
|
|
2697
|
+
className: "pollar-ramp-input",
|
|
2698
|
+
placeholder: "jane@example.com",
|
|
2699
|
+
value: email,
|
|
2700
|
+
autoComplete: "email",
|
|
2701
|
+
onChange: (e) => onEmailChange(e.target.value)
|
|
2702
|
+
}
|
|
2703
|
+
)
|
|
2704
|
+
] }),
|
|
2705
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
|
|
2706
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onRetry, children: "Back" }),
|
|
2707
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2708
|
+
"button",
|
|
2709
|
+
{
|
|
2710
|
+
type: "button",
|
|
2711
|
+
className: "pollar-btn-primary",
|
|
2712
|
+
disabled: !fullName.trim() || !email.trim() || isLoading,
|
|
2713
|
+
onClick: onContactContinue,
|
|
2714
|
+
children: isLoading ? "Starting\u2026" : "Continue"
|
|
2715
|
+
}
|
|
2716
|
+
)
|
|
2717
|
+
] })
|
|
2718
|
+
] }),
|
|
2656
2719
|
step === "status" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment", children: [
|
|
2657
2720
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
2658
2721
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Provider" }),
|
|
@@ -2670,6 +2733,10 @@ function RampWidgetTemplate({
|
|
|
2670
2733
|
stellarTxHash.slice(-8)
|
|
2671
2734
|
] }) })
|
|
2672
2735
|
] }),
|
|
2736
|
+
depositInstructions && txStatus !== "completed" && flattenInstructions(depositInstructions).map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
2737
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: label }),
|
|
2738
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsx("code", { style: { wordBreak: "break-all" }, children: value }) })
|
|
2739
|
+
] }, key)),
|
|
2673
2740
|
kycUrl && txStatus !== "completed" && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-btn-primary", onClick: onOpenKyc, children: [
|
|
2674
2741
|
"Continue at ",
|
|
2675
2742
|
provider
|
|
@@ -2698,16 +2765,20 @@ function RampWidget({ onClose }) {
|
|
|
2698
2765
|
const [amount, setAmount] = react.useState("");
|
|
2699
2766
|
const [currency, setCurrency] = react.useState("");
|
|
2700
2767
|
const [country, setCountry] = react.useState("");
|
|
2768
|
+
const [email, setEmail] = react.useState("");
|
|
2769
|
+
const [fullName, setFullName] = react.useState("");
|
|
2701
2770
|
const [countries, setCountries] = react.useState([]);
|
|
2702
2771
|
const [countriesLoading, setCountriesLoading] = react.useState(true);
|
|
2703
2772
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
2704
2773
|
const [quotes, setQuotes] = react.useState([]);
|
|
2774
|
+
const [selectedQuote, setSelectedQuote] = react.useState(null);
|
|
2705
2775
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
2706
2776
|
const [txId, setTxId] = react.useState(null);
|
|
2707
2777
|
const [provider, setProvider] = react.useState("");
|
|
2708
2778
|
const [kycUrl, setKycUrl] = react.useState(null);
|
|
2709
2779
|
const [txStatus, setTxStatus] = react.useState(null);
|
|
2710
2780
|
const [stellarTxHash, setStellarTxHash] = react.useState(null);
|
|
2781
|
+
const [depositInstructions, setDepositInstructions] = react.useState(null);
|
|
2711
2782
|
const [completing, setCompleting] = react.useState(false);
|
|
2712
2783
|
const [errorMsg, setErrorMsg] = react.useState(null);
|
|
2713
2784
|
const directionRef = react.useRef(direction);
|
|
@@ -2723,6 +2794,8 @@ function RampWidget({ onClose }) {
|
|
|
2723
2794
|
setTxStatus(tx.status);
|
|
2724
2795
|
if (tx.stellarTxHash) setStellarTxHash(tx.stellarTxHash);
|
|
2725
2796
|
if (tx.kycUrl) setKycUrl(tx.kycUrl);
|
|
2797
|
+
const di = tx.depositInstructions;
|
|
2798
|
+
if (di) setDepositInstructions(di);
|
|
2726
2799
|
if (TERMINAL.includes(tx.status)) clearInterval(id);
|
|
2727
2800
|
} catch {
|
|
2728
2801
|
}
|
|
@@ -2770,6 +2843,8 @@ function RampWidget({ onClose }) {
|
|
|
2770
2843
|
setTxStatus(tx.status);
|
|
2771
2844
|
if (tx.stellarTxHash) setStellarTxHash(tx.stellarTxHash);
|
|
2772
2845
|
if (tx.kycUrl) setKycUrl(tx.kycUrl);
|
|
2846
|
+
const di = tx.depositInstructions;
|
|
2847
|
+
if (di) setDepositInstructions(di);
|
|
2773
2848
|
}
|
|
2774
2849
|
} catch {
|
|
2775
2850
|
} finally {
|
|
@@ -2779,11 +2854,13 @@ function RampWidget({ onClose }) {
|
|
|
2779
2854
|
function resetToInput() {
|
|
2780
2855
|
setStep("input");
|
|
2781
2856
|
setQuotes([]);
|
|
2857
|
+
setSelectedQuote(null);
|
|
2782
2858
|
setTxId(null);
|
|
2783
2859
|
setProvider("");
|
|
2784
2860
|
setKycUrl(null);
|
|
2785
2861
|
setTxStatus(null);
|
|
2786
2862
|
setStellarTxHash(null);
|
|
2863
|
+
setDepositInstructions(null);
|
|
2787
2864
|
setErrorMsg(null);
|
|
2788
2865
|
}
|
|
2789
2866
|
async function resumeWithSignature(id, ps) {
|
|
@@ -2809,6 +2886,7 @@ function RampWidget({ onClose }) {
|
|
|
2809
2886
|
setKycUrl(result.kycUrl ?? null);
|
|
2810
2887
|
setTxStatus(result.status);
|
|
2811
2888
|
setStellarTxHash(result.stellarTxHash ?? null);
|
|
2889
|
+
setDepositInstructions(result.depositInstructions ?? null);
|
|
2812
2890
|
setStep("status");
|
|
2813
2891
|
}
|
|
2814
2892
|
async function handleFindRoute() {
|
|
@@ -2832,12 +2910,33 @@ function RampWidget({ onClose }) {
|
|
|
2832
2910
|
setIsLoading(false);
|
|
2833
2911
|
}
|
|
2834
2912
|
}
|
|
2835
|
-
|
|
2913
|
+
function handleSelectQuote(quote) {
|
|
2914
|
+
setSelectedQuote(quote);
|
|
2915
|
+
setErrorMsg(null);
|
|
2916
|
+
const requiresContact = quote.requiresContact ?? false;
|
|
2917
|
+
if (requiresContact && (!email.trim() || !fullName.trim())) {
|
|
2918
|
+
setStep("contact");
|
|
2919
|
+
return;
|
|
2920
|
+
}
|
|
2921
|
+
void startRamp(quote);
|
|
2922
|
+
}
|
|
2923
|
+
function handleContactContinue() {
|
|
2924
|
+
if (selectedQuote) void startRamp(selectedQuote);
|
|
2925
|
+
}
|
|
2926
|
+
async function startRamp(quote) {
|
|
2836
2927
|
setIsLoading(true);
|
|
2837
2928
|
setErrorMsg(null);
|
|
2838
2929
|
try {
|
|
2839
|
-
const base = {
|
|
2840
|
-
|
|
2930
|
+
const base = {
|
|
2931
|
+
quoteId: quote.quoteId,
|
|
2932
|
+
amount: Number(amount),
|
|
2933
|
+
currency,
|
|
2934
|
+
country,
|
|
2935
|
+
...email.trim() ? { email: email.trim() } : {},
|
|
2936
|
+
...fullName.trim() ? { fullName: fullName.trim() } : {},
|
|
2937
|
+
...walletAddress ? { walletAddress } : {}
|
|
2938
|
+
};
|
|
2939
|
+
const result = direction === "onramp" ? await client.createOnRamp(base) : await client.createOffRamp(base);
|
|
2841
2940
|
await applyResult(result);
|
|
2842
2941
|
} catch (e) {
|
|
2843
2942
|
setErrorMsg(e instanceof Error ? e.message : "Failed to start the ramp.");
|
|
@@ -2881,6 +2980,8 @@ function RampWidget({ onClose }) {
|
|
|
2881
2980
|
amount,
|
|
2882
2981
|
currency,
|
|
2883
2982
|
country,
|
|
2983
|
+
email,
|
|
2984
|
+
fullName,
|
|
2884
2985
|
countries,
|
|
2885
2986
|
countriesLoading,
|
|
2886
2987
|
refreshing,
|
|
@@ -2890,15 +2991,18 @@ function RampWidget({ onClose }) {
|
|
|
2890
2991
|
txStatus,
|
|
2891
2992
|
kycUrl,
|
|
2892
2993
|
stellarTxHash,
|
|
2994
|
+
depositInstructions,
|
|
2893
2995
|
canComplete,
|
|
2894
2996
|
completing,
|
|
2895
2997
|
errorMsg,
|
|
2896
2998
|
onDirectionChange: setDirection,
|
|
2897
2999
|
onAmountChange: setAmount,
|
|
2898
|
-
|
|
3000
|
+
onEmailChange: setEmail,
|
|
3001
|
+
onFullNameChange: setFullName,
|
|
2899
3002
|
onCountryChange: handleCountryChange,
|
|
2900
3003
|
onFindRoute: handleFindRoute,
|
|
2901
3004
|
onSelectQuote: handleSelectQuote,
|
|
3005
|
+
onContactContinue: handleContactContinue,
|
|
2902
3006
|
onOpenKyc: handleOpenKyc,
|
|
2903
3007
|
onCompleteWithdraw: handleCompleteWithdraw,
|
|
2904
3008
|
onRetry: resetToInput,
|
|
@@ -4551,6 +4655,10 @@ function TxHistoryModalTemplate({
|
|
|
4551
4655
|
/* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: record.status }),
|
|
4552
4656
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-item-meta", children: [
|
|
4553
4657
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: record.operation }),
|
|
4658
|
+
typeof record.details?.sponsored === "boolean" && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4659
|
+
"\xB7 ",
|
|
4660
|
+
record.details.sponsored ? "Sponsored" : "Self-paid"
|
|
4661
|
+
] }),
|
|
4554
4662
|
record.feeXlm && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4555
4663
|
"\xB7 ",
|
|
4556
4664
|
record.feeXlm,
|