@miden-npm/react 0.0.12 → 0.0.14
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.cjs +16 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1660,6 +1660,7 @@ var BaseInput = ({
|
|
|
1660
1660
|
disabled = false,
|
|
1661
1661
|
loading = false,
|
|
1662
1662
|
showCopyIcon = false,
|
|
1663
|
+
preventPaste = false,
|
|
1663
1664
|
value,
|
|
1664
1665
|
defaultValue,
|
|
1665
1666
|
onChange,
|
|
@@ -1687,17 +1688,18 @@ var BaseInput = ({
|
|
|
1687
1688
|
el.selectionStart = el.selectionEnd = el.value.length;
|
|
1688
1689
|
});
|
|
1689
1690
|
};
|
|
1690
|
-
const handleStringChange = (e) => {
|
|
1691
|
-
const incoming = e.replace(/,/g, "");
|
|
1692
|
-
if (!isControlled) setRawValue(incoming);
|
|
1693
|
-
onChange?.(incoming);
|
|
1694
|
-
};
|
|
1695
1691
|
const handleBlur = () => {
|
|
1696
1692
|
onBlur?.(rawValue);
|
|
1697
1693
|
};
|
|
1698
1694
|
const handleKeyDown = (e) => {
|
|
1699
1695
|
if (rules.includes("numeric")) restrictToNumericKeys(e);
|
|
1700
1696
|
};
|
|
1697
|
+
const handlePaste = (e) => {
|
|
1698
|
+
if (preventPaste) {
|
|
1699
|
+
e.preventDefault();
|
|
1700
|
+
setLocalError("Pasting is disabled for this input");
|
|
1701
|
+
}
|
|
1702
|
+
};
|
|
1701
1703
|
const containerBg = disabled ? "bg-grey-50 cursor-not-allowed" : "bg-white";
|
|
1702
1704
|
const containerBorder = validationError || localError ? "border-red-300 bg-red-50" : "border-grey-100";
|
|
1703
1705
|
const copyToClipboard = (text) => {
|
|
@@ -1706,7 +1708,7 @@ var BaseInput = ({
|
|
|
1706
1708
|
const copyHandler = () => {
|
|
1707
1709
|
copyToClipboard(rawValue).then(() => {
|
|
1708
1710
|
setLocalHint("Text copied to clipboard");
|
|
1709
|
-
}).catch((
|
|
1711
|
+
}).catch(() => {
|
|
1710
1712
|
setLocalError("Failed to copy text to clipboard");
|
|
1711
1713
|
});
|
|
1712
1714
|
};
|
|
@@ -1730,6 +1732,7 @@ var BaseInput = ({
|
|
|
1730
1732
|
onChange: handleChange,
|
|
1731
1733
|
onBlur: handleBlur,
|
|
1732
1734
|
onKeyDown: handleKeyDown,
|
|
1735
|
+
onPaste: handlePaste,
|
|
1733
1736
|
disabled,
|
|
1734
1737
|
placeholder: placeholder ?? (label ? `Enter ${label.toLowerCase()}` : void 0),
|
|
1735
1738
|
inputMode: isAmountInput ? "decimal" : void 0,
|
|
@@ -1749,10 +1752,7 @@ var BaseInput = ({
|
|
|
1749
1752
|
onClick: copyHandler
|
|
1750
1753
|
}
|
|
1751
1754
|
)
|
|
1752
|
-
] }) : (
|
|
1753
|
-
// Simple loader placeholder; swap for your icon component if desired
|
|
1754
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "animate-spin h-4 w-4 border-2 border-current border-t-transparent rounded-full" })
|
|
1755
|
-
)
|
|
1755
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "animate-spin h-4 w-4 border-2 border-current border-t-transparent rounded-full" })
|
|
1756
1756
|
]
|
|
1757
1757
|
}
|
|
1758
1758
|
),
|
|
@@ -1829,7 +1829,7 @@ function BzpCheckoutIframe({
|
|
|
1829
1829
|
setMessage("Payment link created successfully");
|
|
1830
1830
|
if (response.launchUrl) {
|
|
1831
1831
|
setLoading(false);
|
|
1832
|
-
launchIframe(response.launchUrl);
|
|
1832
|
+
launchIframe(`${response.launchUrl}&merchantId=${btoa(secretKey)}`);
|
|
1833
1833
|
}
|
|
1834
1834
|
} else {
|
|
1835
1835
|
setLoading(false);
|
|
@@ -1864,6 +1864,7 @@ function BzpCheckoutButton({
|
|
|
1864
1864
|
}) {
|
|
1865
1865
|
const [message, setMessage] = (0, import_react7.useState)("");
|
|
1866
1866
|
const [launchUrl, setLaunchUrl] = (0, import_react7.useState)("");
|
|
1867
|
+
const [urlLaunchUrl, setUrlLaunchUrl] = (0, import_react7.useState)("");
|
|
1867
1868
|
const [loading, setLoading] = (0, import_react7.useState)(false);
|
|
1868
1869
|
const generatePaymentLinkHandler = async () => {
|
|
1869
1870
|
if (!secretKey) {
|
|
@@ -1884,6 +1885,7 @@ function BzpCheckoutButton({
|
|
|
1884
1885
|
);
|
|
1885
1886
|
if (response?.isSuccessful && response.launchUrl) {
|
|
1886
1887
|
setLaunchUrl(response.launchUrl);
|
|
1888
|
+
setUrlLaunchUrl(`${response.launchUrl}&merchantId=${btoa(secretKey)}`);
|
|
1887
1889
|
setMessage("Payment link created successfully");
|
|
1888
1890
|
if (mode === "redirect") {
|
|
1889
1891
|
window.open(response.launchUrl, "_blank", "noopener,noreferrer");
|
|
@@ -1897,10 +1899,10 @@ function BzpCheckoutButton({
|
|
|
1897
1899
|
setLoading(false);
|
|
1898
1900
|
}
|
|
1899
1901
|
};
|
|
1900
|
-
return
|
|
1902
|
+
return urlLaunchUrl && mode === "iframe" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1901
1903
|
BzpCheckoutIframe,
|
|
1902
1904
|
{
|
|
1903
|
-
url:
|
|
1905
|
+
url: urlLaunchUrl,
|
|
1904
1906
|
secretKey,
|
|
1905
1907
|
environment
|
|
1906
1908
|
}
|
|
@@ -2380,6 +2382,7 @@ function PayByCard({
|
|
|
2380
2382
|
mask: "0000 0000 0000 0000",
|
|
2381
2383
|
placeholder: "0000 0000 0000 0000",
|
|
2382
2384
|
value: payForm.cardNo,
|
|
2385
|
+
preventPaste: true,
|
|
2383
2386
|
onChange: (e) => {
|
|
2384
2387
|
setPayForm({ ...payForm, cardNo: e });
|
|
2385
2388
|
if (payErrors.cardNo)
|