@pollar/react 0.10.1-rc.6 → 0.10.1-rc.8

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 CHANGED
@@ -349,8 +349,13 @@ type RampStep = 'input' | 'loading_quote' | 'select_route' | 'contact' | 'status
349
349
  interface RampFieldSpec {
350
350
  key: string;
351
351
  label: string;
352
- type: 'text' | 'email' | 'tel';
353
- bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH';
352
+ type: 'text' | 'email' | 'tel' | 'select';
353
+ bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH' | 'BREB';
354
+ /** For `type: 'select'` — dropdown choices (e.g. Stereum's Bolivian banks). */
355
+ options?: {
356
+ value: string;
357
+ label: string;
358
+ }[];
354
359
  }
355
360
  interface RampWidgetTemplateProps {
356
361
  theme: string;
@@ -372,6 +377,8 @@ interface RampWidgetTemplateProps {
372
377
  kycUrl: string | null;
373
378
  tosUrl: string | null;
374
379
  stellarTxHash: string | null;
380
+ /** Stellar Expert URL for `stellarTxHash` (network-aware); null when unknown. */
381
+ explorerUrl: string | null;
375
382
  depositInstructions: Record<string, unknown> | null;
376
383
  canComplete: boolean;
377
384
  completing: boolean;
@@ -390,7 +397,7 @@ interface RampWidgetTemplateProps {
390
397
  onRefresh: () => void;
391
398
  onClose: () => void;
392
399
  }
393
- declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, tosUrl, stellarTxHash, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
400
+ declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, tosUrl, stellarTxHash, explorerUrl, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
394
401
 
395
402
  interface TransactionModalTemplateProps {
396
403
  theme: string;
package/dist/index.d.ts CHANGED
@@ -349,8 +349,13 @@ type RampStep = 'input' | 'loading_quote' | 'select_route' | 'contact' | 'status
349
349
  interface RampFieldSpec {
350
350
  key: string;
351
351
  label: string;
352
- type: 'text' | 'email' | 'tel';
353
- bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH';
352
+ type: 'text' | 'email' | 'tel' | 'select';
353
+ bankType?: 'CLABE' | 'PIX' | 'PSE' | 'ACH' | 'BREB';
354
+ /** For `type: 'select'` — dropdown choices (e.g. Stereum's Bolivian banks). */
355
+ options?: {
356
+ value: string;
357
+ label: string;
358
+ }[];
354
359
  }
355
360
  interface RampWidgetTemplateProps {
356
361
  theme: string;
@@ -372,6 +377,8 @@ interface RampWidgetTemplateProps {
372
377
  kycUrl: string | null;
373
378
  tosUrl: string | null;
374
379
  stellarTxHash: string | null;
380
+ /** Stellar Expert URL for `stellarTxHash` (network-aware); null when unknown. */
381
+ explorerUrl: string | null;
375
382
  depositInstructions: Record<string, unknown> | null;
376
383
  canComplete: boolean;
377
384
  completing: boolean;
@@ -390,7 +397,7 @@ interface RampWidgetTemplateProps {
390
397
  onRefresh: () => void;
391
398
  onClose: () => void;
392
399
  }
393
- declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, tosUrl, stellarTxHash, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
400
+ declare function RampWidgetTemplate({ theme, accentColor, step, direction, amount, currency, country, requiredFields, fieldValues, countries, countriesLoading, refreshing, quotes, isLoading, provider, txStatus, kycUrl, tosUrl, stellarTxHash, explorerUrl, depositInstructions, canComplete, completing, errorMsg, onDirectionChange, onAmountChange, onFieldChange, onCountryChange, onFindRoute, onSelectQuote, onContactContinue, onOpenKyc, onOpenTos, onCompleteWithdraw, onRetry, onRefresh, onClose, }: RampWidgetTemplateProps): react_jsx_runtime.JSX.Element;
394
401
 
395
402
  interface TransactionModalTemplateProps {
396
403
  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.6"
1038
+ "0.10.1-rc.8"
1039
1039
  ] })
1040
1040
  ] })
1041
1041
  ] });
@@ -2596,6 +2596,7 @@ function RampWidgetTemplate({
2596
2596
  kycUrl,
2597
2597
  tosUrl,
2598
2598
  stellarTxHash,
2599
+ explorerUrl,
2599
2600
  depositInstructions,
2600
2601
  canComplete,
2601
2602
  completing,
@@ -2756,7 +2757,18 @@ function RampWidgetTemplate({
2756
2757
  step === "contact" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2757
2758
  requiredFields.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
2758
2759
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: f.label }),
2759
- /* @__PURE__ */ jsxRuntime.jsx(
2760
+ f.type === "select" ? /* @__PURE__ */ jsxRuntime.jsxs(
2761
+ "select",
2762
+ {
2763
+ className: "pollar-ramp-input",
2764
+ value: fieldValues[f.key] ?? "",
2765
+ onChange: (e) => onFieldChange(f.key, e.target.value),
2766
+ children: [
2767
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: "Select\u2026" }),
2768
+ (f.options ?? []).map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
2769
+ ]
2770
+ }
2771
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2760
2772
  "input",
2761
2773
  {
2762
2774
  type: f.type,
@@ -2792,11 +2804,29 @@ function RampWidgetTemplate({
2792
2804
  ] }),
2793
2805
  stellarTxHash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
2794
2806
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Stellar tx" }),
2795
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsxs("code", { children: [
2796
- stellarTxHash.slice(0, 8),
2797
- "\u2026",
2798
- stellarTxHash.slice(-8)
2799
- ] }) })
2807
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2808
+ /* @__PURE__ */ jsxRuntime.jsxs("code", { style: { flex: 1, wordBreak: "break-all" }, children: [
2809
+ stellarTxHash.slice(0, 8),
2810
+ "\u2026",
2811
+ stellarTxHash.slice(-8)
2812
+ ] }),
2813
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: stellarTxHash, label: "Copy transaction hash" }),
2814
+ explorerUrl && /* @__PURE__ */ jsxRuntime.jsx(
2815
+ "a",
2816
+ {
2817
+ href: explorerUrl,
2818
+ target: "_blank",
2819
+ rel: "noopener noreferrer",
2820
+ className: "pollar-copy-btn",
2821
+ "aria-label": "View on Stellar Expert",
2822
+ title: "View on Stellar Expert",
2823
+ children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
2824
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 3H3v8h8V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2825
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 2.5h3v3M11 3L6.5 7.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2826
+ ] })
2827
+ }
2828
+ )
2829
+ ] })
2800
2830
  ] }),
2801
2831
  depositInstructions && txStatus !== "completed" && flattenInstructions(depositInstructions).map(({ key, label, value, kind }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
2802
2832
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: label }),
@@ -2835,7 +2865,7 @@ function requiredFieldsOf(quote) {
2835
2865
  return quote.requiredFields ?? [];
2836
2866
  }
2837
2867
  function RampWidget({ onClose }) {
2838
- const { getClient, signTx, wallet, styles } = usePollar();
2868
+ const { getClient, signTx, wallet, styles, network } = usePollar();
2839
2869
  const walletAddress = wallet?.address ?? "";
2840
2870
  const client = getClient();
2841
2871
  const { theme = "light", accentColor = "#005DB4" } = styles;
@@ -3010,12 +3040,16 @@ function RampWidget({ onClose }) {
3010
3040
  try {
3011
3041
  const base = { quoteId: quote.quoteId, amount: Number(amount), currency, country };
3012
3042
  if (walletAddress) base.walletAddress = walletAddress;
3043
+ const STANDARD_BODY_KEYS = /* @__PURE__ */ new Set(["email", "fullName", "taxId", "qrCode"]);
3044
+ const extraFields = {};
3013
3045
  for (const f of requiredFieldsOf(quote)) {
3014
3046
  const val = (fieldValues[f.key] ?? "").trim();
3015
3047
  if (!val) continue;
3016
3048
  if (f.bankType) base.bankDetails = { type: f.bankType, value: val };
3017
- else base[f.key] = val;
3049
+ else if (STANDARD_BODY_KEYS.has(f.key)) base[f.key] = val;
3050
+ else extraFields[f.key] = val;
3018
3051
  }
3052
+ if (Object.keys(extraFields).length > 0) base.fields = extraFields;
3019
3053
  const result = direction === "onramp" ? await client.createOnRamp(base) : await client.createOffRamp(base);
3020
3054
  await applyResult(result);
3021
3055
  } catch (e) {
@@ -3075,6 +3109,7 @@ function RampWidget({ onClose }) {
3075
3109
  kycUrl,
3076
3110
  tosUrl,
3077
3111
  stellarTxHash,
3112
+ explorerUrl: stellarTxHash ? `https://stellar.expert/explorer/${network === "mainnet" ? "public" : "testnet"}/tx/${stellarTxHash}` : null,
3078
3113
  depositInstructions,
3079
3114
  canComplete,
3080
3115
  completing,