@pollar/react 0.10.1-rc.7 → 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.mjs CHANGED
@@ -1033,7 +1033,7 @@ var PollarModalFooter = () => {
1033
1033
  /* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
1034
1034
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1035
1035
  "v",
1036
- "0.10.1-rc.7"
1036
+ "0.10.1-rc.8"
1037
1037
  ] })
1038
1038
  ] })
1039
1039
  ] });
@@ -2594,6 +2594,7 @@ function RampWidgetTemplate({
2594
2594
  kycUrl,
2595
2595
  tosUrl,
2596
2596
  stellarTxHash,
2597
+ explorerUrl,
2597
2598
  depositInstructions,
2598
2599
  canComplete,
2599
2600
  completing,
@@ -2754,7 +2755,18 @@ function RampWidgetTemplate({
2754
2755
  step === "contact" && /* @__PURE__ */ jsxs(Fragment, { children: [
2755
2756
  requiredFields.map((f) => /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-field", children: [
2756
2757
  /* @__PURE__ */ jsx("label", { className: "pollar-ramp-label", children: f.label }),
2757
- /* @__PURE__ */ jsx(
2758
+ f.type === "select" ? /* @__PURE__ */ jsxs(
2759
+ "select",
2760
+ {
2761
+ className: "pollar-ramp-input",
2762
+ value: fieldValues[f.key] ?? "",
2763
+ onChange: (e) => onFieldChange(f.key, e.target.value),
2764
+ children: [
2765
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select\u2026" }),
2766
+ (f.options ?? []).map((o) => /* @__PURE__ */ jsx("option", { value: o.value, children: o.label }, o.value))
2767
+ ]
2768
+ }
2769
+ ) : /* @__PURE__ */ jsx(
2758
2770
  "input",
2759
2771
  {
2760
2772
  type: f.type,
@@ -2790,11 +2802,29 @@ function RampWidgetTemplate({
2790
2802
  ] }),
2791
2803
  stellarTxHash && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
2792
2804
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: "Stellar tx" }),
2793
- /* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxs("code", { children: [
2794
- stellarTxHash.slice(0, 8),
2795
- "\u2026",
2796
- stellarTxHash.slice(-8)
2797
- ] }) })
2805
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-value", style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2806
+ /* @__PURE__ */ jsxs("code", { style: { flex: 1, wordBreak: "break-all" }, children: [
2807
+ stellarTxHash.slice(0, 8),
2808
+ "\u2026",
2809
+ stellarTxHash.slice(-8)
2810
+ ] }),
2811
+ /* @__PURE__ */ jsx(CopyButton, { value: stellarTxHash, label: "Copy transaction hash" }),
2812
+ explorerUrl && /* @__PURE__ */ jsx(
2813
+ "a",
2814
+ {
2815
+ href: explorerUrl,
2816
+ target: "_blank",
2817
+ rel: "noopener noreferrer",
2818
+ className: "pollar-copy-btn",
2819
+ "aria-label": "View on Stellar Expert",
2820
+ title: "View on Stellar Expert",
2821
+ children: /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
2822
+ /* @__PURE__ */ jsx("path", { d: "M6 3H3v8h8V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
2823
+ /* @__PURE__ */ jsx("path", { d: "M8.5 2.5h3v3M11 3L6.5 7.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2824
+ ] })
2825
+ }
2826
+ )
2827
+ ] })
2798
2828
  ] }),
2799
2829
  depositInstructions && txStatus !== "completed" && flattenInstructions(depositInstructions).map(({ key, label, value, kind }) => /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
2800
2830
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: label }),
@@ -2833,7 +2863,7 @@ function requiredFieldsOf(quote) {
2833
2863
  return quote.requiredFields ?? [];
2834
2864
  }
2835
2865
  function RampWidget({ onClose }) {
2836
- const { getClient, signTx, wallet, styles } = usePollar();
2866
+ const { getClient, signTx, wallet, styles, network } = usePollar();
2837
2867
  const walletAddress = wallet?.address ?? "";
2838
2868
  const client = getClient();
2839
2869
  const { theme = "light", accentColor = "#005DB4" } = styles;
@@ -3008,12 +3038,16 @@ function RampWidget({ onClose }) {
3008
3038
  try {
3009
3039
  const base = { quoteId: quote.quoteId, amount: Number(amount), currency, country };
3010
3040
  if (walletAddress) base.walletAddress = walletAddress;
3041
+ const STANDARD_BODY_KEYS = /* @__PURE__ */ new Set(["email", "fullName", "taxId", "qrCode"]);
3042
+ const extraFields = {};
3011
3043
  for (const f of requiredFieldsOf(quote)) {
3012
3044
  const val = (fieldValues[f.key] ?? "").trim();
3013
3045
  if (!val) continue;
3014
3046
  if (f.bankType) base.bankDetails = { type: f.bankType, value: val };
3015
- else base[f.key] = val;
3047
+ else if (STANDARD_BODY_KEYS.has(f.key)) base[f.key] = val;
3048
+ else extraFields[f.key] = val;
3016
3049
  }
3050
+ if (Object.keys(extraFields).length > 0) base.fields = extraFields;
3017
3051
  const result = direction === "onramp" ? await client.createOnRamp(base) : await client.createOffRamp(base);
3018
3052
  await applyResult(result);
3019
3053
  } catch (e) {
@@ -3073,6 +3107,7 @@ function RampWidget({ onClose }) {
3073
3107
  kycUrl,
3074
3108
  tosUrl,
3075
3109
  stellarTxHash,
3110
+ explorerUrl: stellarTxHash ? `https://stellar.expert/explorer/${network === "mainnet" ? "public" : "testnet"}/tx/${stellarTxHash}` : null,
3076
3111
  depositInstructions,
3077
3112
  canComplete,
3078
3113
  completing,