coinley-checkout 1.1.2 → 1.1.3

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.
@@ -21258,11 +21258,11 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21258
21258
  };
21259
21259
  const getTokenIcon = (token) => {
21260
21260
  if (token.symbol === "PYUSD")
21261
- return PyusdIcon;
21261
+ return { type: "component", value: PyusdIcon };
21262
21262
  if (token.symbol === "USDP")
21263
- return UsdpIcon;
21263
+ return { type: "component", value: UsdpIcon };
21264
21264
  if (token.logo && token.logo !== "" && !token.logo.includes("placeholder")) {
21265
- return token.logo;
21265
+ return { type: "image", value: token.logo };
21266
21266
  }
21267
21267
  const fallbackImages = {
21268
21268
  "USDT": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/gzrp8dpuddqwnfchmf8v.png",
@@ -21274,15 +21274,35 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21274
21274
  "FRAX": "https://cryptologos.cc/logos/frax-frax-logo.png",
21275
21275
  "USDJ": "https://s2.coinmarketcap.com/static/img/coins/64x64/5446.png",
21276
21276
  "TUSD": "https://cryptologos.cc/logos/trueusd-tusd-logo.png",
21277
- "ETH": " https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/liznxm8l7iouudtrxdpi.png",
21277
+ "ETH": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/liznxm8l7iouudtrxdpi.png",
21278
21278
  "BNB": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/eoavfddfqmt7qgajjxvb.png",
21279
21279
  "TRX": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/mpxxns6gtfiws4rlouxc.png",
21280
- "ALGO": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/x2lugizoduiphuqn0dej.png ",
21280
+ "ALGO": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962844/coinley/x2lugizoduiphuqn0dej.png",
21281
21281
  "SOL": "https://res.cloudinary.com/do3tlu1ph/image/upload/v1748962845/coinley/hmex6qxnlid1gboh4cwc.png",
21282
21282
  "AVAX": "https://cryptologos.cc/logos/avalanche-avax-logo.png",
21283
21283
  "MATIC": "https://cryptologos.cc/logos/polygon-matic-logo.png"
21284
21284
  };
21285
- return fallbackImages[token.symbol] || `https://via.placeholder.com/64x64/6366f1/ffffff?text=${token.symbol}`;
21285
+ const fallbackUrl = fallbackImages[token.symbol] || `https://via.placeholder.com/64x64/6366f1/ffffff?text=${token.symbol}`;
21286
+ return { type: "image", value: fallbackUrl };
21287
+ };
21288
+ const renderTokenIcon = (tokenIconData, size = 32, className = "rounded-full") => {
21289
+ if (tokenIconData.type === "component") {
21290
+ const IconComponent = tokenIconData.value;
21291
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { size });
21292
+ } else {
21293
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
21294
+ "img",
21295
+ {
21296
+ src: tokenIconData.value,
21297
+ alt: "Token",
21298
+ className: `h-${size / 4} w-${size / 4} ${className}`,
21299
+ style: { height: `${size}px`, width: `${size}px` },
21300
+ onError: (e) => {
21301
+ e.target.src = `https://via.placeholder.com/${size}x${size}/6366f1/ffffff?text=?`;
21302
+ }
21303
+ }
21304
+ );
21305
+ }
21286
21306
  };
21287
21307
  const getPaymentMethodsForNetwork = (networkShortName) => {
21288
21308
  if (!networkShortName)
@@ -21301,6 +21321,7 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21301
21321
  setSelectedPaymentMethod(null);
21302
21322
  };
21303
21323
  const handleSelectPaymentMethod = (token) => {
21324
+ const tokenIconData = getTokenIcon(token);
21304
21325
  const paymentMethodData = {
21305
21326
  currency: token.symbol,
21306
21327
  network: selectedNetwork,
@@ -21313,7 +21334,8 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21313
21334
  id: token.symbol,
21314
21335
  name: token.symbol,
21315
21336
  description: token.name,
21316
- logo: getTokenIcon(token),
21337
+ logo: tokenIconData,
21338
+ // Store the icon data object
21317
21339
  network: selectedNetwork,
21318
21340
  isStablecoin: token.isStablecoin
21319
21341
  }
@@ -21428,17 +21450,7 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21428
21450
  style: { minHeight: "56px" },
21429
21451
  children: [
21430
21452
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex items-center gap-3", children: selectedPaymentMethod ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
21431
- typeof selectedPaymentMethod.method.logo === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx(selectedPaymentMethod.method.logo, { size: 32 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
21432
- "img",
21433
- {
21434
- src: selectedPaymentMethod.method.logo,
21435
- alt: selectedPaymentMethod.method.name,
21436
- className: "h-8 w-8 rounded-full",
21437
- onError: (e) => {
21438
- e.target.src = `https://via.placeholder.com/32x32/6366f1/ffffff?text=${selectedPaymentMethod.method.name}`;
21439
- }
21440
- }
21441
- ),
21453
+ renderTokenIcon(selectedPaymentMethod.method.logo, 32),
21442
21454
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-base font-normal", children: [
21443
21455
  selectedPaymentMethod.method.description,
21444
21456
  " (",
@@ -21466,7 +21478,7 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21466
21478
  availableTokensForNetwork.filter(
21467
21479
  (token) => token.name.toLowerCase().includes(searchQuery.toLowerCase()) || token.symbol.toLowerCase().includes(searchQuery.toLowerCase())
21468
21480
  ).map((token) => {
21469
- const tokenIcon = getTokenIcon(token);
21481
+ const tokenIconData = getTokenIcon(token);
21470
21482
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
21471
21483
  "button",
21472
21484
  {
@@ -21478,17 +21490,7 @@ const PaymentMethods = ({ onSelect, selected, theme: theme2 = "light", supported
21478
21490
  },
21479
21491
  style: { minHeight: "48px" },
21480
21492
  children: [
21481
- typeof tokenIcon === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("tokenIcon", { size: 32 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
21482
- "img",
21483
- {
21484
- src: tokenIcon,
21485
- alt: token.symbol,
21486
- className: "h-8 w-8 rounded-full",
21487
- onError: (e) => {
21488
- e.target.src = `https://via.placeholder.com/32x32/6366f1/ffffff?text=${token.symbol}`;
21489
- }
21490
- }
21491
- ),
21493
+ renderTokenIcon(tokenIconData, 32),
21492
21494
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
21493
21495
  token.name,
21494
21496
  " (",