@pollar/react 0.10.1-rc.8 → 0.10.1-rc.9
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.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
1036
|
+
"0.10.1-rc.9"
|
|
1037
1037
|
] })
|
|
1038
1038
|
] })
|
|
1039
1039
|
] });
|
|
@@ -2524,6 +2524,13 @@ function RouteDisplay({ quote, onSelect }) {
|
|
|
2524
2524
|
}
|
|
2525
2525
|
);
|
|
2526
2526
|
}
|
|
2527
|
+
var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
2528
|
+
function isFieldValid(spec, raw) {
|
|
2529
|
+
const value = (raw ?? "").trim();
|
|
2530
|
+
if (!value) return false;
|
|
2531
|
+
if (spec.type === "email") return EMAIL_RE.test(value);
|
|
2532
|
+
return true;
|
|
2533
|
+
}
|
|
2527
2534
|
var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
|
|
2528
2535
|
function flagEmoji(code) {
|
|
2529
2536
|
const cc = code.trim().toUpperCase();
|
|
@@ -2775,7 +2782,8 @@ function RampWidgetTemplate({
|
|
|
2775
2782
|
autoComplete: f.type === "email" ? "email" : "off",
|
|
2776
2783
|
onChange: (e) => onFieldChange(f.key, e.target.value)
|
|
2777
2784
|
}
|
|
2778
|
-
)
|
|
2785
|
+
),
|
|
2786
|
+
f.type === "email" && (fieldValues[f.key] ?? "").trim() !== "" && !isFieldValid(f, fieldValues[f.key]) && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-field-error", children: "Enter a valid email address." })
|
|
2779
2787
|
] }, f.key)),
|
|
2780
2788
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
|
|
2781
2789
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onRetry, children: "Back" }),
|
|
@@ -2784,7 +2792,7 @@ function RampWidgetTemplate({
|
|
|
2784
2792
|
{
|
|
2785
2793
|
type: "button",
|
|
2786
2794
|
className: "pollar-btn-primary",
|
|
2787
|
-
disabled: requiredFields.some((f) => !(fieldValues[f.key]
|
|
2795
|
+
disabled: requiredFields.some((f) => !isFieldValid(f, fieldValues[f.key])) || isLoading,
|
|
2788
2796
|
onClick: onContactContinue,
|
|
2789
2797
|
children: isLoading ? "Starting\u2026" : "Continue"
|
|
2790
2798
|
}
|
|
@@ -2835,7 +2843,10 @@ function RampWidgetTemplate({
|
|
|
2835
2843
|
alt: label,
|
|
2836
2844
|
style: { width: "100%", maxWidth: 220, height: "auto", display: "block", margin: "0 auto" }
|
|
2837
2845
|
}
|
|
2838
|
-
) : kind === "datetime" ? /* @__PURE__ */ jsx("span", { children: value }) : /* @__PURE__ */
|
|
2846
|
+
) : kind === "datetime" ? /* @__PURE__ */ jsx("span", { children: value }) : /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
2847
|
+
/* @__PURE__ */ jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children: value }),
|
|
2848
|
+
/* @__PURE__ */ jsx(CopyButton, { value, label: `Copy ${label}` })
|
|
2849
|
+
] }) })
|
|
2839
2850
|
] }, key)),
|
|
2840
2851
|
tosUrl && !depositInstructions && txStatus !== "completed" && /* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-btn-primary", onClick: onOpenTos, children: [
|
|
2841
2852
|
"Accept terms at ",
|
|
@@ -2961,6 +2972,7 @@ function RampWidget({ onClose }) {
|
|
|
2961
2972
|
setStep("input");
|
|
2962
2973
|
setQuotes([]);
|
|
2963
2974
|
setSelectedQuote(null);
|
|
2975
|
+
setFieldValues({});
|
|
2964
2976
|
setTxId(null);
|
|
2965
2977
|
setProvider("");
|
|
2966
2978
|
setKycUrl(null);
|