coinley-checkout 0.5.6 → 0.5.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/algo.png +0 -0
- package/dist/bnb.png +0 -0
- package/dist/coinley-checkout.es.js +445 -346
- package/dist/coinley-checkout.es.js.map +1 -1
- package/dist/coinley-checkout.umd.js +8 -8
- package/dist/coinley-checkout.umd.js.map +1 -1
- package/dist/eth.png +0 -0
- package/dist/pyusd.png +0 -0
- package/dist/solana.png +0 -0
- package/dist/style.css +1 -1
- package/dist/tron.png +0 -0
- package/dist/usdc.png +0 -0
- package/dist/usdp.png +0 -0
- package/dist/usdt.png +0 -0
- package/package.json +62 -62
@@ -76,7 +76,7 @@ var __async = (__this, __arguments, generator) => {
|
|
76
76
|
});
|
77
77
|
};
|
78
78
|
var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _format, _val, _tens, _checkFormat, checkFormat_fn, _checkValue, checkValue_fn, _add, add_fn, _sub, sub_fn, _mul, mul_fn, _div, div_fn, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _getSerialized, getSerialized_fn, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter, _a, _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn, _url2, _processFunc, _name, _chainId2, _plugins, _provider, _poller, _interval, _blockNumber, _poll, poll_fn, _provider2, _poll2, _running, _tag, _lastBlock, _filter2, _hash, _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2, _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _options2, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn, _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn, _event, _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn, _pollingInterval, _request2, _providerInfo;
|
79
|
-
import React, { createContext, useContext, useState, useEffect, forwardRef, useImperativeHandle } from "react";
|
79
|
+
import React, { createContext, useContext, useState, useEffect, useRef, forwardRef, useImperativeHandle } from "react";
|
80
80
|
const styles = "";
|
81
81
|
const version = "6.14.3";
|
82
82
|
function checkType(value, type, name) {
|
@@ -20587,21 +20587,65 @@ const QRCode = ({
|
|
20587
20587
|
] }) })
|
20588
20588
|
] });
|
20589
20589
|
};
|
20590
|
-
const PaymentStatus = ({
|
20590
|
+
const PaymentStatus = ({
|
20591
|
+
status,
|
20592
|
+
message,
|
20593
|
+
theme: theme2 = "light",
|
20594
|
+
// New props for success screen
|
20595
|
+
payment = null,
|
20596
|
+
transactionHash = null,
|
20597
|
+
selectedPaymentMethod = null,
|
20598
|
+
merchantName = "Merchant"
|
20599
|
+
}) => {
|
20600
|
+
const [copiedHash, setCopiedHash] = useState(false);
|
20601
|
+
const copyTransactionHash = () => __async(void 0, null, function* () {
|
20602
|
+
if (transactionHash) {
|
20603
|
+
try {
|
20604
|
+
yield navigator.clipboard.writeText(transactionHash);
|
20605
|
+
setCopiedHash(true);
|
20606
|
+
setTimeout(() => setCopiedHash(false), 2e3);
|
20607
|
+
} catch (err) {
|
20608
|
+
console.error("Failed to copy transaction hash:", err);
|
20609
|
+
}
|
20610
|
+
}
|
20611
|
+
});
|
20612
|
+
const formatTransactionHash = (hash2) => {
|
20613
|
+
if (!hash2)
|
20614
|
+
return "";
|
20615
|
+
if (hash2.length <= 16)
|
20616
|
+
return hash2;
|
20617
|
+
return `${hash2.slice(0, 8)}...${hash2.slice(-8)}`;
|
20618
|
+
};
|
20619
|
+
const getNetworkDisplayName = (network) => {
|
20620
|
+
const names2 = {
|
20621
|
+
ethereum: "Ethereum",
|
20622
|
+
bsc: "BSC",
|
20623
|
+
tron: "TRON",
|
20624
|
+
algorand: "Algorand"
|
20625
|
+
};
|
20626
|
+
return names2[network] || network;
|
20627
|
+
};
|
20628
|
+
const formatRecipientAddress = (address) => {
|
20629
|
+
if (!address)
|
20630
|
+
return "N/A";
|
20631
|
+
if (address.length <= 16)
|
20632
|
+
return address;
|
20633
|
+
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
20634
|
+
};
|
20591
20635
|
const renderIcon = () => {
|
20592
20636
|
switch (status) {
|
20593
20637
|
case "processing":
|
20594
20638
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-4 border-t-blue-500 border-blue-500/20" });
|
20595
20639
|
case "success":
|
20596
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-full h-
|
20640
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-full h-16 w-16 bg-green-500 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
20597
20641
|
"svg",
|
20598
20642
|
{
|
20599
20643
|
xmlns: "http://www.w3.org/2000/svg",
|
20600
|
-
className: "h-
|
20644
|
+
className: "h-10 w-10 text-white",
|
20601
20645
|
fill: "none",
|
20602
20646
|
viewBox: "0 0 24 24",
|
20603
20647
|
stroke: "currentColor",
|
20604
|
-
strokeWidth:
|
20648
|
+
strokeWidth: 3,
|
20605
20649
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
20606
20650
|
}
|
20607
20651
|
) });
|
@@ -20646,43 +20690,119 @@ const PaymentStatus = ({ status, message, theme: theme2 = "light" }) => {
|
|
20646
20690
|
return theme2 === "dark" ? "text-gray-300" : "text-gray-600";
|
20647
20691
|
}
|
20648
20692
|
};
|
20693
|
+
if (status === "success") {
|
20694
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
20695
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: renderIcon() }),
|
20696
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-2xl font-bold mb-3 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: "Payment Successful" }),
|
20697
|
+
payment && selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `text-center mb-6 ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
|
20698
|
+
"Your payment of ",
|
20699
|
+
payment.totalAmount || payment.amount,
|
20700
|
+
" ",
|
20701
|
+
selectedPaymentMethod.currency,
|
20702
|
+
" has been completed."
|
20703
|
+
] }),
|
20704
|
+
transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full mb-6", children: [
|
20705
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-medium mb-2 ${theme2 === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Transaction Hash:" }),
|
20706
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
20707
|
+
"div",
|
20708
|
+
{
|
20709
|
+
className: `flex items-center justify-between p-3 rounded-lg border cursor-pointer transition-colors ${theme2 === "dark" ? "bg-gray-700 border-gray-600 hover:bg-gray-600" : "bg-gray-50 border-gray-200 hover:bg-gray-100"}`,
|
20710
|
+
onClick: copyTransactionHash,
|
20711
|
+
children: [
|
20712
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `font-mono text-sm ${theme2 === "dark" ? "text-gray-300" : "text-gray-700"}`, children: formatTransactionHash(transactionHash) }),
|
20713
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
20714
|
+
copiedHash ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-green-500 text-xs font-medium mr-2", children: "Copied!" }) : null,
|
20715
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
20716
|
+
"svg",
|
20717
|
+
{
|
20718
|
+
xmlns: "http://www.w3.org/2000/svg",
|
20719
|
+
className: `h-4 w-4 ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`,
|
20720
|
+
fill: "none",
|
20721
|
+
viewBox: "0 0 24 24",
|
20722
|
+
stroke: "currentColor",
|
20723
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" })
|
20724
|
+
}
|
20725
|
+
)
|
20726
|
+
] })
|
20727
|
+
]
|
20728
|
+
}
|
20729
|
+
)
|
20730
|
+
] }),
|
20731
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-full p-4 rounded-lg border ${theme2 === "dark" ? "bg-gray-700 border-gray-600" : "bg-gray-50 border-gray-200"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
20732
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
20733
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs font-medium mb-1 ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "Merchant ID:" }),
|
20734
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-medium ${theme2 === "dark" ? "text-gray-300" : "text-gray-700"}`, children: merchantName })
|
20735
|
+
] }),
|
20736
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
20737
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs font-medium mb-1 ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "Network:" }),
|
20738
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-medium ${theme2 === "dark" ? "text-gray-300" : "text-gray-700"}`, children: selectedPaymentMethod ? getNetworkDisplayName(selectedPaymentMethod.network) : "N/A" })
|
20739
|
+
] }),
|
20740
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "col-span-2", children: [
|
20741
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs font-medium mb-1 ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "Recipient:" }),
|
20742
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-mono ${theme2 === "dark" ? "text-gray-300" : "text-gray-700"}`, children: (payment == null ? void 0 : payment.recipientWallet) ? formatRecipientAddress(payment.recipientWallet) : "N/A" })
|
20743
|
+
] })
|
20744
|
+
] }) })
|
20745
|
+
] });
|
20746
|
+
}
|
20649
20747
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
20650
20748
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: renderIcon() }),
|
20651
20749
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-xl font-bold mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: getStatusTitle() }),
|
20652
20750
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-center ${getMessageClasses()}`, children: message }),
|
20653
20751
|
status === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 text-xs ${theme2 === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "This may take a few moments. Please do not close this window." }),
|
20654
|
-
status === "
|
20752
|
+
status === "error" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mt-4 p-2 rounded ${theme2 === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-xs ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "Please try again or contact support if the problem persists." }) })
|
20655
20753
|
] });
|
20656
20754
|
};
|
20657
20755
|
const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supportedNetworks = [] }) => {
|
20756
|
+
var _a2, _b, _c;
|
20658
20757
|
const [selectedNetwork, setSelectedNetwork] = useState(NETWORK_TYPES.ETHEREUM);
|
20758
|
+
const [selectedPaymentMethod, setSelectedPaymentMethod] = useState(null);
|
20659
20759
|
const [availableWallets, setAvailableWallets] = useState({});
|
20660
20760
|
const [showMore, setShowMore] = useState(false);
|
20661
|
-
useEffect(() => {
|
20662
|
-
setAvailableWallets(detectWallets());
|
20663
|
-
}, []);
|
20664
20761
|
const networks = [
|
20665
20762
|
{
|
20666
20763
|
id: NETWORK_TYPES.ETHEREUM,
|
20667
20764
|
name: "Ethereum",
|
20668
|
-
|
20669
|
-
},
|
20670
|
-
{
|
20671
|
-
id: NETWORK_TYPES.BSC,
|
20672
|
-
name: "BSC",
|
20673
|
-
description: "BEP-20"
|
20765
|
+
icon: "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/liznxm8l7iouudtrxdpi.png"
|
20674
20766
|
},
|
20675
20767
|
{
|
20676
20768
|
id: NETWORK_TYPES.TRON,
|
20677
20769
|
name: "Tron",
|
20678
|
-
|
20770
|
+
icon: "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/mpxxns6gtfiws4rlouxc.png"
|
20679
20771
|
},
|
20680
20772
|
{
|
20681
20773
|
id: NETWORK_TYPES.ALGORAND,
|
20682
20774
|
name: "Algorand",
|
20683
|
-
|
20775
|
+
icon: "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/x2lugizoduiphuqn0dej.png"
|
20776
|
+
},
|
20777
|
+
{
|
20778
|
+
id: "solana",
|
20779
|
+
name: "Solana",
|
20780
|
+
icon: " https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962845/coinley/hmex6qxnlid1gboh4cwc.png"
|
20781
|
+
},
|
20782
|
+
{
|
20783
|
+
id: NETWORK_TYPES.BSC,
|
20784
|
+
name: "Binance Smart Chain",
|
20785
|
+
icon: "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/eoavfddfqmt7qgajjxvb.png"
|
20684
20786
|
}
|
20685
20787
|
];
|
20788
|
+
const [dropdownOpen, setDropdownOpen] = useState(false);
|
20789
|
+
const dropdownRef = useRef(null);
|
20790
|
+
useEffect(() => {
|
20791
|
+
function handleClickOutside(event) {
|
20792
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
20793
|
+
setDropdownOpen(false);
|
20794
|
+
}
|
20795
|
+
}
|
20796
|
+
if (dropdownOpen) {
|
20797
|
+
document.addEventListener("mousedown", handleClickOutside);
|
20798
|
+
} else {
|
20799
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
20800
|
+
}
|
20801
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
20802
|
+
}, [dropdownOpen]);
|
20803
|
+
useEffect(() => {
|
20804
|
+
setAvailableWallets(detectWallets());
|
20805
|
+
}, []);
|
20686
20806
|
const getPaymentMethodsForNetwork = (network) => {
|
20687
20807
|
const methods = [];
|
20688
20808
|
switch (network) {
|
@@ -20734,7 +20854,7 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
20734
20854
|
id: "ETH",
|
20735
20855
|
name: "ETH",
|
20736
20856
|
description: "Ethereum",
|
20737
|
-
logo: "
|
20857
|
+
logo: "/eth.png",
|
20738
20858
|
network: NETWORK_TYPES.ETHEREUM
|
20739
20859
|
}
|
20740
20860
|
);
|
@@ -20773,7 +20893,7 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
20773
20893
|
id: "BNB",
|
20774
20894
|
name: "BNB",
|
20775
20895
|
description: "Binance Coin",
|
20776
|
-
logo: "
|
20896
|
+
logo: "/bnb.png",
|
20777
20897
|
network: NETWORK_TYPES.BSC
|
20778
20898
|
}
|
20779
20899
|
);
|
@@ -20841,18 +20961,22 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
20841
20961
|
const handleNetworkChange = (networkId) => {
|
20842
20962
|
setSelectedNetwork(networkId);
|
20843
20963
|
setShowMore(false);
|
20844
|
-
|
20845
|
-
onSelect(null);
|
20846
|
-
}
|
20964
|
+
setSelectedPaymentMethod(null);
|
20847
20965
|
};
|
20848
20966
|
const handleSelectPaymentMethod = (method) => {
|
20849
|
-
var
|
20850
|
-
|
20967
|
+
var _a3;
|
20968
|
+
const paymentMethodData = {
|
20851
20969
|
currency: method.id,
|
20852
20970
|
network: selectedNetwork,
|
20853
|
-
tokenConfig: (
|
20971
|
+
tokenConfig: (_a3 = TOKEN_CONFIG[method.id]) == null ? void 0 : _a3[selectedNetwork],
|
20854
20972
|
method
|
20855
|
-
}
|
20973
|
+
};
|
20974
|
+
setSelectedPaymentMethod(paymentMethodData);
|
20975
|
+
};
|
20976
|
+
const handleProceed = () => {
|
20977
|
+
if (selectedPaymentMethod) {
|
20978
|
+
onSelect(selectedPaymentMethod);
|
20979
|
+
}
|
20856
20980
|
};
|
20857
20981
|
const availableMethods = getPaymentMethodsForNetwork(selectedNetwork);
|
20858
20982
|
const visibleMethods = showMore ? availableMethods : availableMethods.slice(0, 4);
|
@@ -20880,57 +21004,80 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
20880
21004
|
};
|
20881
21005
|
return isAvailable ? `${walletNames[wallet]} detected - Ready to pay` : `${walletNames[wallet]} required - Please install to continue`;
|
20882
21006
|
}
|
20883
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
|
21007
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
|
20884
21008
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [
|
20885
21009
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: `block text-sm font-medium mb-2 ${theme2 === "dark" ? "text-white" : "text-gray-700"}`, children: "Blockchain Network" }),
|
20886
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
20887
|
-
|
20888
|
-
|
20889
|
-
|
20890
|
-
|
20891
|
-
|
20892
|
-
|
20893
|
-
|
20894
|
-
|
20895
|
-
|
20896
|
-
|
20897
|
-
|
20898
|
-
|
21010
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", ref: dropdownRef, children: [
|
21011
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
21012
|
+
"button",
|
21013
|
+
{
|
21014
|
+
type: "button",
|
21015
|
+
className: "w-full flex items-center justify-between px-5 py-4 bg-white rounded-2xl shadow border border-gray-200 text-gray-900 text-base font-normal focus:outline-none focus:ring-2 focus:ring-[#7042D2] focus:ring-opacity-50 transition",
|
21016
|
+
onClick: () => setDropdownOpen((open) => !open),
|
21017
|
+
style: { minHeight: "56px" },
|
21018
|
+
children: [
|
21019
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-3", children: [
|
21020
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21021
|
+
"img",
|
21022
|
+
{
|
21023
|
+
src: (_a2 = networks.find((n2) => n2.id === selectedNetwork)) == null ? void 0 : _a2.icon,
|
21024
|
+
alt: (_b = networks.find((n2) => n2.id === selectedNetwork)) == null ? void 0 : _b.name,
|
21025
|
+
className: "w-6 h-6"
|
21026
|
+
}
|
21027
|
+
),
|
21028
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-base font-normal", children: (_c = networks.find((n2) => n2.id === selectedNetwork)) == null ? void 0 : _c.name })
|
21029
|
+
] }),
|
21030
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { className: `w-5 h-5 ml-2 transition-transform ${dropdownOpen ? "rotate-180" : ""}`, fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
21031
|
+
]
|
21032
|
+
}
|
21033
|
+
),
|
21034
|
+
dropdownOpen && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-0 mt-2 w-full bg-white rounded-2xl shadow-lg border border-gray-100 z-20", style: { minWidth: "100%" }, children: networks.filter((network) => supportedNetworks.length === 0 || supportedNetworks.includes(network.id)).map((network) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
21035
|
+
"button",
|
21036
|
+
{
|
21037
|
+
type: "button",
|
21038
|
+
className: `w-full flex items-center gap-3 px-5 py-3 text-gray-900 text-base font-normal rounded-2xl transition hover:bg-gray-100 ${selectedNetwork === network.id ? "bg-gray-50" : ""}`,
|
21039
|
+
onClick: () => {
|
21040
|
+
setDropdownOpen(false);
|
21041
|
+
handleNetworkChange(network.id);
|
21042
|
+
},
|
21043
|
+
style: { minHeight: "48px" },
|
21044
|
+
children: [
|
21045
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: network.icon, alt: network.name, className: "w-6 h-6" }),
|
21046
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: network.name })
|
21047
|
+
]
|
21048
|
+
},
|
21049
|
+
network.id
|
21050
|
+
)) })
|
21051
|
+
] })
|
20899
21052
|
] }),
|
20900
21053
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
|
20901
21054
|
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: `block text-sm font-medium mb-3 ${theme2 === "dark" ? "text-white" : "text-gray-700"}`, children: "Select Stablecoin" }),
|
20902
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 mb-4", children: visibleMethods.map((method) =>
|
20903
|
-
|
20904
|
-
|
20905
|
-
|
20906
|
-
|
20907
|
-
|
20908
|
-
|
20909
|
-
|
20910
|
-
|
20911
|
-
|
20912
|
-
|
20913
|
-
|
20914
|
-
|
20915
|
-
|
20916
|
-
|
20917
|
-
|
20918
|
-
|
20919
|
-
|
20920
|
-
|
20921
|
-
|
20922
|
-
|
20923
|
-
|
20924
|
-
|
20925
|
-
|
20926
|
-
|
20927
|
-
|
20928
|
-
}
|
20929
|
-
) })
|
20930
|
-
] })
|
20931
|
-
},
|
20932
|
-
`${method.id}-${method.network}`
|
20933
|
-
)) }),
|
21055
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 mb-4", children: visibleMethods.map((method) => {
|
21056
|
+
const isSelected = (selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.currency) === method.id && (selectedPaymentMethod == null ? void 0 : selectedPaymentMethod.network) === selectedNetwork;
|
21057
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
21058
|
+
"button",
|
21059
|
+
{
|
21060
|
+
onClick: () => handleSelectPaymentMethod(method),
|
21061
|
+
className: `group flex items-center justify-between w-full px-5 py-4 rounded-2xl border text-left transition-all duration-200 font-medium text-base
|
21062
|
+
${isSelected ? "bg-[#E9DDFC] border-transparent shadow-none" : "bg-white border-gray-200 hover:bg-[#F6F2FF] hover:border-[#E9DDFC]"}
|
21063
|
+
`,
|
21064
|
+
style: { minHeight: "56px" },
|
21065
|
+
children: [
|
21066
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-3", children: [
|
21067
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: method.logo, alt: method.name, className: "h-6 w-6" }),
|
21068
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-medium text-base text-gray-900", children: [
|
21069
|
+
method.description,
|
21070
|
+
" (",
|
21071
|
+
method.name,
|
21072
|
+
")"
|
21073
|
+
] })
|
21074
|
+
] }),
|
21075
|
+
isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2 flex items-center justify-center w-6 h-6 rounded-full bg-[#7042D2]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M4 8.5L7 11.5L12 6.5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
|
21076
|
+
]
|
21077
|
+
},
|
21078
|
+
`${method.id}-${method.network}`
|
21079
|
+
);
|
21080
|
+
}) }),
|
20934
21081
|
availableMethods.length > 4 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
20935
21082
|
"button",
|
20936
21083
|
{
|
@@ -20940,13 +21087,23 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
20940
21087
|
}
|
20941
21088
|
)
|
20942
21089
|
] }),
|
20943
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-3 rounded-lg text-sm ${theme2 === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-50 text-gray-600"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21090
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-3 rounded-lg text-sm mb-6 ${theme2 === "dark" ? "bg-gray-800 text-gray-300" : "bg-gray-50 text-gray-600"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
20944
21091
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-2 h-2 rounded-full mr-2 ${availableWallets[getRequiredWallet(selectedNetwork)] ? "bg-green-500" : "bg-red-500"}` }),
|
20945
21092
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs", children: getNetworkRequirement(selectedNetwork) })
|
20946
|
-
] }) })
|
21093
|
+
] }) }),
|
21094
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21095
|
+
"button",
|
21096
|
+
{
|
21097
|
+
onClick: handleProceed,
|
21098
|
+
disabled: !selectedPaymentMethod,
|
21099
|
+
className: `w-full py-3 px-4 font-medium rounded-2xl text-lg shadow-md transition-colors ${selectedPaymentMethod ? "bg-[#7042D2] text-white hover:bg-[#5b34b1]" : "bg-gray-300 text-gray-500 cursor-not-allowed"}`,
|
21100
|
+
style: { borderRadius: "1.5rem" },
|
21101
|
+
children: "Proceed"
|
21102
|
+
}
|
21103
|
+
)
|
20947
21104
|
] });
|
20948
21105
|
};
|
20949
|
-
const logo = "data:image/png;base64,
|
21106
|
+
const logo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAbCAYAAABm409WAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMFSURBVHgBpVZBVtswEJXk7JsjmAM0hF13dWDTHeEEhF13MScgOQHmBIQT1Oy6KXFPACEHIDdouux7WNM/kuxIdvJeXpj3iOSR9P9oRjODFHtIevp6y2P21LsO9MlzLFQ0x3SKtdm2s0rsJ0PGS08XaXg6usFvjL+vuw7uS+BE3sDqLs/cOLJ6+rvrRMf/sFdWQ6F1nhUnqw2uXAmiGLMurObbzEQUJYLqHasGDvZ1xkK/P4Y3kGqCn1uAvKWny5taT3rh7bLuIEpqjdYv1fQ6WY75PDYAK4pDAtIz72OC4N47gHyjpr4z5thp1rhtYSyHUaQoMzclWmVFLw8IzEYpC081YpJAL2XXEcVuT16BW6stKYwd8KQd5PL9gtkbJCPopw547YjsqMupid0GHDpxXcWwRYAFy05U+xVgY+eGK0HyzhkyBfjAAEWd+9pyKS7gmll9lIMCv6XGb+ZqeBGSHo3flRrh+9IQz4+PxA5JB4tnQOFseRW8PibA9f848C0iJ9nTZ3ZB19zsAIm+HH3/B6BvO9YTrMts3v8pDhSVPR1n8OURfP4g2EVN0UiyD4hsKtJkmQjlnqAu80NdExDY1OaAynNoEm8dAceT+9XLxYHS8Upu3L4PdLYkHEyg8IZ/CFty28K5oP3ycQgB6d9tYFEIrpj8tlX0jKf8VpXpbcINKT17HW5bq2LABawCWKHUXgapz6LLEzNGUcwxwZkE866b99mQKm9aBL64zM7CG6E2cfngWBEtkNVDZO8MJeSciTl7bbeT3Fozv7UGtYgDDvCJaN/zwTQiEyv5yVvh12faqMknQWx96veSRrEzIN2G9S84PAHw2JLRwpG6/JCXVXzsPibhXmJJGh1N9ENwBBuucTGKjU5LV2WrkQ1C+3RiSHSJkq9HHKdmR8vM02RgLsXz3sBksoo84rKwROUmN5TXPoUp+blrOOtOY4GtOhEt4TYpzY2qcszE6dmysIkYxKXCMvv2+7eFXFxIPAT6usvtSNS9CUw/pju/Uzkrba+uAr9F/gPbu3s2LSnvkAAAAABJRU5ErkJggg==";
|
20950
21107
|
const CoinleyModal = ({
|
20951
21108
|
isOpen,
|
20952
21109
|
onClose,
|
@@ -20986,13 +21143,6 @@ const CoinleyModal = ({
|
|
20986
21143
|
const formatAmount = (amount) => {
|
20987
21144
|
return parseFloat(amount).toFixed(2);
|
20988
21145
|
};
|
20989
|
-
const formatTransactionHash = (hash2) => {
|
20990
|
-
if (!hash2)
|
20991
|
-
return "";
|
20992
|
-
if (hash2.length <= 14)
|
20993
|
-
return hash2;
|
20994
|
-
return `${hash2.slice(0, 8)}...${hash2.slice(-6)}`;
|
20995
|
-
};
|
20996
21146
|
const getNetworkDisplayName = (network) => {
|
20997
21147
|
const names2 = {
|
20998
21148
|
ethereum: "Ethereum",
|
@@ -21022,50 +21172,40 @@ const CoinleyModal = ({
|
|
21022
21172
|
};
|
21023
21173
|
if (!isOpen)
|
21024
21174
|
return null;
|
21025
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
21026
|
-
|
21027
|
-
|
21028
|
-
|
21029
|
-
|
21030
|
-
|
21031
|
-
|
21032
|
-
|
21033
|
-
|
21034
|
-
|
21035
|
-
|
21036
|
-
|
21037
|
-
|
21038
|
-
|
21039
|
-
|
21040
|
-
|
21041
|
-
|
21042
|
-
|
21043
|
-
|
21044
|
-
|
21045
|
-
|
21046
|
-
|
21047
|
-
|
21048
|
-
] }),
|
21049
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center gap-4 text-sm", children: [
|
21050
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-3 py-2 rounded-lg", children: [
|
21051
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-600 text-xs", children: "Original Amount" }),
|
21052
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-semibold", children: [
|
21053
|
-
"$",
|
21054
|
-
formatAmount(payment.amount)
|
21055
|
-
] })
|
21175
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex min-h-screen items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
21176
|
+
"div",
|
21177
|
+
{
|
21178
|
+
className: "coinley-modal relative p-6 w-full max-w-[490px] mx-auto rounded-3xl shadow-xl bg-gray-100",
|
21179
|
+
style: {
|
21180
|
+
maxWidth: "490px !important",
|
21181
|
+
width: "100% !important",
|
21182
|
+
minWidth: "320px !important"
|
21183
|
+
},
|
21184
|
+
children: [
|
21185
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-white flex justify-between items-center mb-6 py-4 px-2 rounded-full", children: [
|
21186
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex items-center gap-2 px-4", children: [
|
21187
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: logo, className: "w-auto h-auto", alt: "Coinley Logo" }),
|
21188
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-semibold text-gray-800", children: "Payment Details" })
|
21189
|
+
] }),
|
21190
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21191
|
+
"button",
|
21192
|
+
{
|
21193
|
+
onClick: onClose,
|
21194
|
+
className: "text-gray-500 hover:text-gray-700 focus:outline-none",
|
21195
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
21196
|
+
}
|
21197
|
+
)
|
21056
21198
|
] }),
|
21057
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
21058
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-600
|
21059
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-
|
21199
|
+
payment && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center", children: [
|
21200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600", children: "Total amount" }),
|
21201
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "coinley-amount-display text-5xl font-bold text-[#7042D2] mt-2", children: [
|
21060
21202
|
"$",
|
21061
|
-
formatAmount(
|
21062
|
-
] })
|
21063
|
-
|
21064
|
-
|
21065
|
-
|
21066
|
-
|
21067
|
-
step === "select-currency" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21068
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21203
|
+
formatAmount(payment.totalAmount || payment.amount)
|
21204
|
+
] }),
|
21205
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600 mt-4", children: "Payment to:" }),
|
21206
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "coinley-merchant-name text-base font-semibold mt-1", children: merchantName })
|
21207
|
+
] }) }),
|
21208
|
+
step === "select-currency" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21069
21209
|
PaymentMethods,
|
21070
21210
|
{
|
21071
21211
|
onSelect: onPaymentMethodSelect,
|
@@ -21073,248 +21213,207 @@ const CoinleyModal = ({
|
|
21073
21213
|
theme: theme2,
|
21074
21214
|
supportedNetworks
|
21075
21215
|
}
|
21076
|
-
),
|
21077
|
-
selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.
|
21078
|
-
"
|
21079
|
-
|
21080
|
-
|
21081
|
-
|
21082
|
-
|
21083
|
-
|
21084
|
-
|
21085
|
-
|
21086
|
-
|
21087
|
-
|
21088
|
-
|
21089
|
-
"
|
21090
|
-
|
21091
|
-
|
21092
|
-
|
21093
|
-
) })
|
21094
|
-
] }),
|
21095
|
-
step === "confirm" && selectedPaymentMethod && payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21096
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-gray-100", children: [
|
21097
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
|
21098
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
21099
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21100
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Currency:" }),
|
21101
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedPaymentMethod.currency })
|
21102
|
-
] }),
|
21103
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21104
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Network:" }),
|
21105
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: getNetworkDisplayName(selectedPaymentMethod.network) })
|
21106
|
-
] }),
|
21107
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21108
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Fee:" }),
|
21109
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
|
21110
|
-
] })
|
21111
|
-
] })
|
21112
|
-
] }),
|
21113
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex border-b border-gray-200", children: [
|
21114
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21115
|
-
"button",
|
21116
|
-
{
|
21117
|
-
onClick: () => setPaymentType("wallet"),
|
21118
|
-
className: `py-2 px-4 text-sm font-medium ${paymentType === "wallet" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21119
|
-
children: "Connect Wallet"
|
21120
|
-
}
|
21121
|
-
),
|
21122
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21123
|
-
"button",
|
21124
|
-
{
|
21125
|
-
onClick: () => setPaymentType("qrcode"),
|
21126
|
-
className: `py-2 px-4 text-sm font-medium ${paymentType === "qrcode" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21127
|
-
children: "QR Code"
|
21128
|
-
}
|
21129
|
-
)
|
21130
|
-
] }) }),
|
21131
|
-
testMode ? (
|
21132
|
-
// Test mode payment option
|
21133
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21134
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-purple-600 rounded-full p-2 mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
21135
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21136
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "Test Mode Payment" }),
|
21137
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: 'Click "Pay Now" to simulate a successful payment' })
|
21216
|
+
) }),
|
21217
|
+
step === "confirm" && selectedPaymentMethod && payment && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21218
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-lg mb-4 bg-gray-100", children: [
|
21219
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-medium mb-2 text-gray-800", children: "Payment Details" }),
|
21220
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
21221
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21222
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Currency:" }),
|
21223
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: selectedPaymentMethod.currency })
|
21224
|
+
] }),
|
21225
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21226
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Network:" }),
|
21227
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: getNetworkDisplayName(selectedPaymentMethod.network) })
|
21228
|
+
] }),
|
21229
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between", children: [
|
21230
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600 font-semibold", children: "Fee:" }),
|
21231
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "1.75%" })
|
21232
|
+
] })
|
21138
21233
|
] })
|
21139
|
-
] })
|
21140
|
-
|
21141
|
-
|
21142
|
-
|
21143
|
-
|
21144
|
-
|
21145
|
-
|
21146
|
-
|
21147
|
-
|
21148
|
-
|
21149
|
-
|
21150
|
-
|
21151
|
-
|
21152
|
-
|
21153
|
-
|
21154
|
-
|
21155
|
-
|
21156
|
-
|
21234
|
+
] }),
|
21235
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex border-b border-gray-200", children: [
|
21236
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21237
|
+
"button",
|
21238
|
+
{
|
21239
|
+
onClick: () => setPaymentType("wallet"),
|
21240
|
+
className: `py-2 px-4 text-sm font-medium ${paymentType === "wallet" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21241
|
+
children: "Connect Wallet"
|
21242
|
+
}
|
21243
|
+
),
|
21244
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21245
|
+
"button",
|
21246
|
+
{
|
21247
|
+
onClick: () => setPaymentType("qrcode"),
|
21248
|
+
className: `py-2 px-4 text-sm font-medium ${paymentType === "qrcode" ? "border-b-2 border-purple-600 text-purple-600" : "text-gray-500 hover:text-gray-700"}`,
|
21249
|
+
children: "QR Code"
|
21250
|
+
}
|
21251
|
+
)
|
21252
|
+
] }) }),
|
21253
|
+
testMode ? (
|
21254
|
+
// Test mode payment option
|
21255
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg mb-4 bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21256
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-purple-600 rounded-full p-2 mr-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-white", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) }),
|
21157
21257
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21158
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "
|
21159
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
21160
|
-
"No wallets detected for ",
|
21161
|
-
getNetworkDisplayName(selectedPaymentMethod.network),
|
21162
|
-
" network"
|
21163
|
-
] })
|
21258
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "Test Mode Payment" }),
|
21259
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600", children: 'Click "Pay Now" to simulate a successful payment' })
|
21164
21260
|
] })
|
21165
|
-
] }) })
|
21166
|
-
|
21167
|
-
|
21168
|
-
|
21169
|
-
|
21170
|
-
|
21171
|
-
|
21172
|
-
|
21173
|
-
|
21174
|
-
|
21175
|
-
|
21176
|
-
|
21177
|
-
|
21261
|
+
] }) })
|
21262
|
+
) : paymentType === "qrcode" ? (
|
21263
|
+
// QR Code payment option
|
21264
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21265
|
+
QRCode,
|
21266
|
+
{
|
21267
|
+
walletAddress: getWalletAddressForNetwork(),
|
21268
|
+
amount: payment.totalAmount || payment.amount,
|
21269
|
+
currency: selectedPaymentMethod.currency,
|
21270
|
+
network: selectedPaymentMethod.network,
|
21271
|
+
theme: theme2
|
21272
|
+
}
|
21273
|
+
) })
|
21274
|
+
) : (
|
21275
|
+
// Wallet connection option
|
21276
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3 mb-4", children: [
|
21277
|
+
supportedWallets.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-yellow-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21278
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-6 w-6 text-yellow-500 mr-2", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
21178
21279
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21179
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children:
|
21280
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: "No Compatible Wallets" }),
|
21180
21281
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-gray-600", children: [
|
21181
|
-
"
|
21182
|
-
|
21282
|
+
"No wallets detected for ",
|
21283
|
+
getNetworkDisplayName(selectedPaymentMethod.network),
|
21284
|
+
" network"
|
21183
21285
|
] })
|
21184
21286
|
] })
|
21185
|
-
] }),
|
21186
|
-
|
21187
|
-
|
21188
|
-
|
21189
|
-
|
21190
|
-
|
21191
|
-
|
21192
|
-
|
21193
|
-
|
21194
|
-
|
21195
|
-
|
21196
|
-
|
21197
|
-
|
21198
|
-
|
21199
|
-
|
21200
|
-
|
21201
|
-
|
21202
|
-
|
21203
|
-
|
21204
|
-
|
21205
|
-
|
21206
|
-
|
21207
|
-
|
21208
|
-
|
21209
|
-
|
21210
|
-
|
21211
|
-
|
21212
|
-
|
21213
|
-
|
21214
|
-
|
21215
|
-
|
21216
|
-
|
21287
|
+
] }) }) : supportedWallets.map((walletType) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 rounded-lg bg-blue-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
21288
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
|
21289
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21290
|
+
"img",
|
21291
|
+
{
|
21292
|
+
src: getWalletIcon(walletType),
|
21293
|
+
alt: getWalletDisplayName(walletType),
|
21294
|
+
className: "w-8 h-8 mr-3",
|
21295
|
+
onError: (e) => {
|
21296
|
+
e.target.style.display = "none";
|
21297
|
+
}
|
21298
|
+
}
|
21299
|
+
),
|
21300
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21301
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium text-gray-800", children: getWalletDisplayName(walletType) }),
|
21302
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-gray-600", children: [
|
21303
|
+
"Pay with ",
|
21304
|
+
getWalletDisplayName(walletType)
|
21305
|
+
] })
|
21306
|
+
] })
|
21307
|
+
] }),
|
21308
|
+
(walletConnection == null ? void 0 : walletConnection.walletType) === walletType ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-2", children: [
|
21309
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-2 h-2 bg-green-500 rounded-full" }),
|
21310
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-green-600", children: "Connected" })
|
21311
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21312
|
+
"button",
|
21313
|
+
{
|
21314
|
+
onClick: () => {
|
21315
|
+
console.log("Connect wallet button clicked for:", walletType);
|
21316
|
+
onConnectWallet(walletType);
|
21317
|
+
},
|
21318
|
+
className: "coinley-button-primary py-2 px-4 font-medium rounded-md text-sm",
|
21319
|
+
children: "Connect"
|
21320
|
+
}
|
21321
|
+
)
|
21322
|
+
] }) }, walletType)),
|
21323
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: Object.entries(availableWallets).filter(([walletType, isAvailable]) => !isAvailable).map(([walletType]) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg bg-gray-50", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
21324
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
|
21325
|
+
getWalletDisplayName(walletType),
|
21326
|
+
" not detected"
|
21327
|
+
] }),
|
21328
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21329
|
+
"a",
|
21330
|
+
{
|
21331
|
+
href: getWalletInstallUrl(walletType),
|
21332
|
+
target: "_blank",
|
21333
|
+
rel: "noopener noreferrer",
|
21334
|
+
className: "text-sm text-purple-600 hover:underline",
|
21335
|
+
children: "Install"
|
21336
|
+
}
|
21337
|
+
)
|
21338
|
+
] }) }, walletType)) })
|
21339
|
+
] })
|
21340
|
+
),
|
21341
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg bg-red-50 mb-4 text-red-600 text-sm", children: error }),
|
21342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
21343
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21344
|
+
"button",
|
21345
|
+
{
|
21346
|
+
type: "button",
|
21347
|
+
onClick: onBack,
|
21348
|
+
className: "w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-purple-600 font-medium rounded-md",
|
21349
|
+
children: "Back"
|
21350
|
+
}
|
21351
|
+
),
|
21352
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21353
|
+
"button",
|
21354
|
+
{
|
21355
|
+
type: "button",
|
21356
|
+
onClick: () => onPayment(paymentType === "qrcode"),
|
21357
|
+
className: "coinley-button-primary w-full py-2 px-4 font-medium rounded-md",
|
21358
|
+
disabled: !testMode && paymentType === "wallet" && !walletConnection,
|
21359
|
+
children: paymentType === "qrcode" ? "I have sent the payment" : "Pay Now"
|
21360
|
+
}
|
21361
|
+
)
|
21217
21362
|
] })
|
21363
|
+
] }),
|
21364
|
+
step === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21365
|
+
PaymentStatus,
|
21366
|
+
{
|
21367
|
+
status: "processing",
|
21368
|
+
theme: theme2,
|
21369
|
+
message: "Processing your payment..."
|
21370
|
+
}
|
21371
|
+
),
|
21372
|
+
step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21373
|
+
PaymentStatus,
|
21374
|
+
{
|
21375
|
+
status: "success",
|
21376
|
+
theme: theme2,
|
21377
|
+
message: "Payment successful!",
|
21378
|
+
payment,
|
21379
|
+
transactionHash,
|
21380
|
+
selectedPaymentMethod,
|
21381
|
+
merchantName
|
21382
|
+
}
|
21218
21383
|
),
|
21219
|
-
error && /* @__PURE__ */ jsxRuntimeExports.
|
21220
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-3", children: [
|
21384
|
+
step === "error" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21221
21385
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21222
|
-
|
21386
|
+
PaymentStatus,
|
21223
21387
|
{
|
21224
|
-
|
21225
|
-
|
21226
|
-
|
21227
|
-
children: "Back"
|
21388
|
+
status: "error",
|
21389
|
+
theme: theme2,
|
21390
|
+
message: error || "An error occurred while processing your payment."
|
21228
21391
|
}
|
21229
21392
|
),
|
21230
21393
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21231
21394
|
"button",
|
21232
21395
|
{
|
21233
21396
|
type: "button",
|
21234
|
-
onClick:
|
21235
|
-
className: "
|
21236
|
-
|
21237
|
-
children: paymentType === "qrcode" ? "I have sent the payment" : "Pay Now"
|
21238
|
-
}
|
21239
|
-
)
|
21240
|
-
] })
|
21241
|
-
] }),
|
21242
|
-
step === "processing" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21243
|
-
PaymentStatus,
|
21244
|
-
{
|
21245
|
-
status: "processing",
|
21246
|
-
theme: theme2,
|
21247
|
-
message: "Processing your payment..."
|
21248
|
-
}
|
21249
|
-
),
|
21250
|
-
step === "success" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
21251
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21252
|
-
PaymentStatus,
|
21253
|
-
{
|
21254
|
-
status: "success",
|
21255
|
-
theme: theme2,
|
21256
|
-
message: "Payment successful!"
|
21257
|
-
}
|
21258
|
-
),
|
21259
|
-
transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 p-3 rounded-lg bg-gray-100", children: [
|
21260
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-gray-600 mb-1", children: "Transaction Hash:" }),
|
21261
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-mono break-all text-gray-800", children: formatTransactionHash(transactionHash) }),
|
21262
|
-
selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
21263
|
-
"a",
|
21264
|
-
{
|
21265
|
-
href: `${getExplorerUrl(selectedPaymentMethod.network)}/${getExplorerPath(selectedPaymentMethod.network)}/${transactionHash}`,
|
21266
|
-
target: "_blank",
|
21267
|
-
rel: "noopener noreferrer",
|
21268
|
-
className: "text-xs text-purple-600 mt-2 inline-block",
|
21269
|
-
children: "View on Explorer →"
|
21397
|
+
onClick: onBack,
|
21398
|
+
className: "mt-4 w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium rounded-md",
|
21399
|
+
children: "Try Again"
|
21270
21400
|
}
|
21271
21401
|
)
|
21402
|
+
] }),
|
21403
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center text-xs text-gray-500 flex items-center justify-center gap-1 mt-6", children: [
|
21404
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
|
21405
|
+
"Powered by ",
|
21406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600", children: "Coinley" }),
|
21407
|
+
" - Secure Cryptocurrency Payments"
|
21408
|
+
] }),
|
21409
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { className: "inline w-4 h-4 text-green-500 ml-1", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: [
|
21410
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "2", fill: "none" }),
|
21411
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M9 12l2 2 4-4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
21412
|
+
] })
|
21272
21413
|
] })
|
21273
|
-
]
|
21274
|
-
|
21275
|
-
|
21276
|
-
PaymentStatus,
|
21277
|
-
{
|
21278
|
-
status: "error",
|
21279
|
-
theme: theme2,
|
21280
|
-
message: error || "An error occurred while processing your payment."
|
21281
|
-
}
|
21282
|
-
),
|
21283
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
21284
|
-
"button",
|
21285
|
-
{
|
21286
|
-
type: "button",
|
21287
|
-
onClick: onBack,
|
21288
|
-
className: "mt-4 w-full py-2 px-4 bg-gray-200 hover:bg-gray-300 text-gray-800 font-medium rounded-md",
|
21289
|
-
children: "Try Again"
|
21290
|
-
}
|
21291
|
-
)
|
21292
|
-
] })
|
21293
|
-
] }),
|
21294
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-xs text-gray-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
|
21295
|
-
"Powered by ",
|
21296
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-purple-600", children: "Coinley" }),
|
21297
|
-
" - Secure Cryptocurrency Payments"
|
21298
|
-
] }) })
|
21299
|
-
] }) }) });
|
21300
|
-
};
|
21301
|
-
const getExplorerUrl = (network) => {
|
21302
|
-
const explorers = {
|
21303
|
-
ethereum: "https://etherscan.io",
|
21304
|
-
bsc: "https://bscscan.com",
|
21305
|
-
tron: "https://tronscan.org",
|
21306
|
-
algorand: "https://algoexplorer.io"
|
21307
|
-
};
|
21308
|
-
return explorers[network] || "https://etherscan.io";
|
21309
|
-
};
|
21310
|
-
const getExplorerPath = (network) => {
|
21311
|
-
const paths = {
|
21312
|
-
ethereum: "tx",
|
21313
|
-
bsc: "tx",
|
21314
|
-
tron: "transaction",
|
21315
|
-
algorand: "tx"
|
21316
|
-
};
|
21317
|
-
return paths[network] || "tx";
|
21414
|
+
]
|
21415
|
+
}
|
21416
|
+
) }) });
|
21318
21417
|
};
|
21319
21418
|
const CoinleyCheckout = forwardRef(({
|
21320
21419
|
apiKey,
|