coinley-checkout 1.0.6 → 1.0.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.
|
@@ -19126,8 +19126,22 @@ const authenticateAndFetchMerchantData = () => __async(void 0, null, function* (
|
|
|
19126
19126
|
const networksData = yield networksResponse.json();
|
|
19127
19127
|
console.log("Merchant networks and tokens received:", networksData);
|
|
19128
19128
|
if (networksData.success) {
|
|
19129
|
-
|
|
19130
|
-
|
|
19129
|
+
const rawNetworks = networksData.networks || [];
|
|
19130
|
+
const rawTokens = networksData.tokens || [];
|
|
19131
|
+
console.log("Raw networks from backend:", rawNetworks);
|
|
19132
|
+
console.log("Raw tokens from backend:", rawTokens);
|
|
19133
|
+
const uniqueNetworks = rawNetworks.filter(
|
|
19134
|
+
(network, index, self2) => index === self2.findIndex((n2) => n2.shortName === network.shortName)
|
|
19135
|
+
);
|
|
19136
|
+
const uniqueTokens = rawTokens.filter(
|
|
19137
|
+
(token, index, self2) => index === self2.findIndex(
|
|
19138
|
+
(t) => t.symbol === token.symbol && t.networkId === token.networkId
|
|
19139
|
+
)
|
|
19140
|
+
);
|
|
19141
|
+
console.log("Deduplicated networks:", uniqueNetworks);
|
|
19142
|
+
console.log("Deduplicated tokens:", uniqueTokens);
|
|
19143
|
+
apiConfig.merchantNetworks = uniqueNetworks;
|
|
19144
|
+
apiConfig.merchantTokens = uniqueTokens;
|
|
19131
19145
|
apiConfig.merchantWalletAddresses = networksData.merchantWallets || {};
|
|
19132
19146
|
console.log("Merchant configured networks:", apiConfig.merchantNetworks.map((n2) => n2.name));
|
|
19133
19147
|
console.log("Merchant supported tokens:", apiConfig.merchantTokens.map((t) => {
|
|
@@ -20972,7 +20986,7 @@ const PaymentStatus = ({
|
|
|
20972
20986
|
}
|
|
20973
20987
|
};
|
|
20974
20988
|
if (status === "success") {
|
|
20975
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6", children: [
|
|
20989
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-6 px-4", children: [
|
|
20976
20990
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: renderIcon() }),
|
|
20977
20991
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: `text-2xl font-bold mb-3 ${theme2 === "dark" ? "text-white" : "text-gray-900"}`, children: "Payment Successful!" }),
|
|
20978
20992
|
payment && selectedPaymentMethod && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: `text-center max-w-[235px] mb-6 ${theme2 === "dark" ? "text-gray-300" : "text-gray-600"}`, children: [
|
|
@@ -20991,7 +21005,7 @@ const PaymentStatus = ({
|
|
|
20991
21005
|
] }),
|
|
20992
21006
|
"Verifying on blockchain"
|
|
20993
21007
|
] }),
|
|
20994
|
-
transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full mb-6", children: [
|
|
21008
|
+
transactionHash && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full mb-6 px-4", children: [
|
|
20995
21009
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `text-sm font-medium mb-2 ${theme2 === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Transaction Hash:" }),
|
|
20996
21010
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
20997
21011
|
"div",
|
|
@@ -21100,12 +21114,22 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
|
21100
21114
|
getMerchantNetworks(),
|
|
21101
21115
|
getMerchantTokens()
|
|
21102
21116
|
]);
|
|
21103
|
-
console.log("
|
|
21104
|
-
console.log("
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21117
|
+
console.log("Raw merchant networks from API:", networks);
|
|
21118
|
+
console.log("Raw merchant tokens from API:", tokens);
|
|
21119
|
+
const uniqueNetworks = networks.filter(
|
|
21120
|
+
(network, index, self2) => index === self2.findIndex((n2) => n2.shortName === network.shortName)
|
|
21121
|
+
);
|
|
21122
|
+
const uniqueTokens = tokens.filter(
|
|
21123
|
+
(token, index, self2) => index === self2.findIndex(
|
|
21124
|
+
(t) => t.symbol === token.symbol && t.networkId === token.networkId
|
|
21125
|
+
)
|
|
21126
|
+
);
|
|
21127
|
+
console.log("Unique merchant networks after deduplication:", uniqueNetworks);
|
|
21128
|
+
console.log("Unique merchant tokens after deduplication:", uniqueTokens);
|
|
21129
|
+
setMerchantNetworks(uniqueNetworks);
|
|
21130
|
+
setMerchantTokens(uniqueTokens);
|
|
21131
|
+
if (uniqueNetworks.length > 0 && !selectedNetwork) {
|
|
21132
|
+
setSelectedNetwork(uniqueNetworks[0].shortName);
|
|
21109
21133
|
}
|
|
21110
21134
|
setError(null);
|
|
21111
21135
|
} catch (err) {
|
|
@@ -21151,14 +21175,40 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
|
21151
21175
|
return PyusdIcon;
|
|
21152
21176
|
if (token.symbol === "USDP")
|
|
21153
21177
|
return UsdpIcon;
|
|
21154
|
-
|
|
21178
|
+
if (token.logo && token.logo !== "" && !token.logo.includes("placeholder")) {
|
|
21179
|
+
return token.logo;
|
|
21180
|
+
}
|
|
21181
|
+
const fallbackImages = {
|
|
21182
|
+
"USDT": "https://cryptologos.cc/logos/tether-usdt-logo.png",
|
|
21183
|
+
"USDC": "https://cryptologos.cc/logos/usd-coin-usdc-logo.png",
|
|
21184
|
+
"DAI": "https://cryptologos.cc/logos/multi-collateral-dai-dai-logo.png",
|
|
21185
|
+
"BUSD": "https://cryptologos.cc/logos/binance-usd-busd-logo.png",
|
|
21186
|
+
"USDP": "https://cryptologos.cc/logos/paxos-standard-pax-logo.png",
|
|
21187
|
+
"PYUSD": "https://s2.coinmarketcap.com/static/img/coins/64x64/28492.png",
|
|
21188
|
+
"FRAX": "https://cryptologos.cc/logos/frax-frax-logo.png",
|
|
21189
|
+
"USDJ": "https://s2.coinmarketcap.com/static/img/coins/64x64/5446.png",
|
|
21190
|
+
"TUSD": "https://cryptologos.cc/logos/trueusd-tusd-logo.png",
|
|
21191
|
+
"ETH": "https://cryptologos.cc/logos/ethereum-eth-logo.png",
|
|
21192
|
+
"BNB": "https://cryptologos.cc/logos/bnb-bnb-logo.png",
|
|
21193
|
+
"TRX": "https://cryptologos.cc/logos/tron-trx-logo.png",
|
|
21194
|
+
"ALGO": "https://cryptologos.cc/logos/algorand-algo-logo.png",
|
|
21195
|
+
"SOL": "https://cryptologos.cc/logos/solana-sol-logo.png",
|
|
21196
|
+
"AVAX": "https://cryptologos.cc/logos/avalanche-avax-logo.png",
|
|
21197
|
+
"MATIC": "https://cryptologos.cc/logos/polygon-matic-logo.png"
|
|
21198
|
+
};
|
|
21199
|
+
return fallbackImages[token.symbol] || `https://via.placeholder.com/64x64/6366f1/ffffff?text=${token.symbol}`;
|
|
21155
21200
|
};
|
|
21156
21201
|
const getPaymentMethodsForNetwork = (networkShortName) => {
|
|
21157
21202
|
if (!networkShortName)
|
|
21158
21203
|
return [];
|
|
21159
|
-
|
|
21204
|
+
const tokensForNetwork = merchantTokens.filter(
|
|
21160
21205
|
(token) => token.Network && token.Network.shortName === networkShortName
|
|
21161
21206
|
);
|
|
21207
|
+
const uniqueTokens = tokensForNetwork.filter(
|
|
21208
|
+
(token, index, self2) => index === self2.findIndex((t) => t.symbol === token.symbol)
|
|
21209
|
+
);
|
|
21210
|
+
console.log(`Tokens for ${networkShortName} (after deduplication):`, uniqueTokens);
|
|
21211
|
+
return uniqueTokens;
|
|
21162
21212
|
};
|
|
21163
21213
|
const handleNetworkChange = (networkShortName) => {
|
|
21164
21214
|
setSelectedNetwork(networkShortName);
|
|
@@ -21292,7 +21342,17 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
|
21292
21342
|
style: { minHeight: "56px" },
|
|
21293
21343
|
children: [
|
|
21294
21344
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex items-center gap-3", children: selectedPaymentMethod ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
21295
|
-
typeof selectedPaymentMethod.method.logo === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx(selectedPaymentMethod.method.logo, { size: 32 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21345
|
+
typeof selectedPaymentMethod.method.logo === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx(selectedPaymentMethod.method.logo, { size: 32 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21346
|
+
"img",
|
|
21347
|
+
{
|
|
21348
|
+
src: selectedPaymentMethod.method.logo,
|
|
21349
|
+
alt: selectedPaymentMethod.method.name,
|
|
21350
|
+
className: "h-8 w-8 rounded-full",
|
|
21351
|
+
onError: (e) => {
|
|
21352
|
+
e.target.src = `https://via.placeholder.com/32x32/6366f1/ffffff?text=${selectedPaymentMethod.method.name}`;
|
|
21353
|
+
}
|
|
21354
|
+
}
|
|
21355
|
+
),
|
|
21296
21356
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-base font-normal", children: [
|
|
21297
21357
|
selectedPaymentMethod.method.description,
|
|
21298
21358
|
" (",
|
|
@@ -21332,7 +21392,17 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
|
21332
21392
|
},
|
|
21333
21393
|
style: { minHeight: "48px" },
|
|
21334
21394
|
children: [
|
|
21335
|
-
typeof tokenIcon === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("tokenIcon", { size: 32 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21395
|
+
typeof tokenIcon === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("tokenIcon", { size: 32 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
21396
|
+
"img",
|
|
21397
|
+
{
|
|
21398
|
+
src: tokenIcon,
|
|
21399
|
+
alt: token.symbol,
|
|
21400
|
+
className: "h-8 w-8 rounded-full",
|
|
21401
|
+
onError: (e) => {
|
|
21402
|
+
e.target.src = `https://via.placeholder.com/32x32/6366f1/ffffff?text=${token.symbol}`;
|
|
21403
|
+
}
|
|
21404
|
+
}
|
|
21405
|
+
),
|
|
21336
21406
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
21337
21407
|
token.name,
|
|
21338
21408
|
" (",
|