coinley-checkout 1.0.6 → 1.0.7
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) => {
|
|
@@ -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) {
|
|
@@ -21156,9 +21180,14 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
|
|
|
21156
21180
|
const getPaymentMethodsForNetwork = (networkShortName) => {
|
|
21157
21181
|
if (!networkShortName)
|
|
21158
21182
|
return [];
|
|
21159
|
-
|
|
21183
|
+
const tokensForNetwork = merchantTokens.filter(
|
|
21160
21184
|
(token) => token.Network && token.Network.shortName === networkShortName
|
|
21161
21185
|
);
|
|
21186
|
+
const uniqueTokens = tokensForNetwork.filter(
|
|
21187
|
+
(token, index, self2) => index === self2.findIndex((t) => t.symbol === token.symbol)
|
|
21188
|
+
);
|
|
21189
|
+
console.log(`Tokens for ${networkShortName} (after deduplication):`, uniqueTokens);
|
|
21190
|
+
return uniqueTokens;
|
|
21162
21191
|
};
|
|
21163
21192
|
const handleNetworkChange = (networkShortName) => {
|
|
21164
21193
|
setSelectedNetwork(networkShortName);
|