@superlogic/spree-pay 0.1.26 → 0.1.28

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/build/index.cjs CHANGED
@@ -44,7 +44,7 @@ var import_nice_modal_react7 = __toESM(require("@ebay/nice-modal-react"), 1);
44
44
  var import_swr5 = require("swr");
45
45
 
46
46
  // package.json
47
- var version = "0.1.26";
47
+ var version = "0.1.28";
48
48
 
49
49
  // src/context/SpreePayActionsContext.tsx
50
50
  var import_react = require("react");
@@ -1308,24 +1308,43 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
1308
1308
  var PointsSwitch = (props) => {
1309
1309
  const { disabled = false, value, onChange, message } = props;
1310
1310
  const { spreePayConfig } = useSpreePayConfig();
1311
+ const { appProps } = useStaticConfig();
1311
1312
  const { balance } = useSlapiBalance();
1312
1313
  const id = (0, import_react7.useId)();
1313
1314
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-col gap-6", children: [
1314
1315
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
1315
1316
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-3", children: [
1316
1317
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
1317
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Label, { className: "text-md items-baseline leading-[1.3] font-semibold text-black md:text-xl", htmlFor: id, children: [
1318
- "Use Points ",
1319
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-xs font-medium", children: "Optional" })
1320
- ] })
1318
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1319
+ Label,
1320
+ {
1321
+ htmlFor: id,
1322
+ className: "text-md flex-col items-baseline gap-0 leading-[1.3] font-semibold text-black sm:flex-row sm:gap-2 md:text-lg",
1323
+ children: [
1324
+ "Use Points ",
1325
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-xs font-medium", children: "Optional" })
1326
+ ]
1327
+ }
1328
+ )
1321
1329
  ] }),
1322
- balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
1323
- formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
1324
- " ",
1325
- !!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-black/50", children: formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio) })
1326
- ] }) : null
1330
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2.5", children: [
1331
+ balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
1332
+ formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
1333
+ !!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-black/50", children: ` ${formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio)}` })
1334
+ ] }) : null,
1335
+ Boolean(appProps.topUpLink) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1336
+ "a",
1337
+ {
1338
+ className: "bg-primary cursor-pointer rounded-full px-2 py-1.5 text-xs font-medium text-white",
1339
+ rel: "noreferrer",
1340
+ target: "_blank",
1341
+ href: appProps.topUpLink,
1342
+ children: "Top Up"
1343
+ }
1344
+ )
1345
+ ] })
1327
1346
  ] }),
1328
- message && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-start gap-1 rounded-sm border-1 border-[#006FD533] bg-[#006FD50D] p-1.5", children: [
1347
+ message && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1 rounded-sm border-1 border-[#006FD533] bg-[#006FD50D] p-1.5", children: [
1329
1348
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "size-5 shrink-0", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1330
1349
  "path",
1331
1350
  {
@@ -2371,16 +2390,17 @@ var PointsSelector = (props) => {
2371
2390
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) })
2372
2391
  }
2373
2392
  ),
2374
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-full w-full items-center justify-between gap-3 px-3", children })
2393
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex h-full w-full items-center justify-between gap-2 px-2 sm:gap-3 sm:px-3", children })
2375
2394
  ] }),
2376
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "px-3 pt-6 pb-2 md:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex justify-between gap-3", children: [
2395
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "px-2 pt-6 pb-2 sm:px-3 md:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex justify-between gap-2 sm:gap-3", children: [
2377
2396
  /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex max-w-[100px] flex-col gap-1", children: [
2378
2397
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2379
2398
  Input,
2380
2399
  {
2381
2400
  readOnly: true,
2401
+ name: "points amount",
2382
2402
  value: Math.round(splitTokens),
2383
- className: "bg-white text-center font-medium",
2403
+ className: "sm:text-md min-w-[75px] bg-white px-1 text-center text-xs font-medium sm:px-3",
2384
2404
  onClick: (e) => e.stopPropagation()
2385
2405
  }
2386
2406
  ),
@@ -2403,8 +2423,9 @@ var PointsSelector = (props) => {
2403
2423
  Input,
2404
2424
  {
2405
2425
  readOnly: true,
2426
+ name: "usd amount",
2406
2427
  value: formatUSD(usdAmount + getTransactionFee(usdAmount, appProps.transactionFeePercentage)),
2407
- className: "bg-white text-center font-medium",
2428
+ className: "sm:text-md min-w-[75px] bg-white px-1 text-center text-xs font-medium sm:px-3",
2408
2429
  onClick: (e) => e.stopPropagation()
2409
2430
  }
2410
2431
  ),
@@ -2452,7 +2473,7 @@ var SplitBlock = (props) => {
2452
2473
  initWallet(spreePayConfig?.pointsChain);
2453
2474
  }, [spreePayConfig?.pointsChain, initWallet]);
2454
2475
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(PointsSelector, { isDisabled: !walletReady, onSelect: () => onSelect("air"), isSelected, children: [
2455
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-sm font-medium text-black", children: [
2476
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-left text-xs font-medium text-black sm:text-sm", children: [
2456
2477
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-black/50", children: "Available" }),
2457
2478
  " ",
2458
2479
  formatPoints(balance.availablePoints, pointsTitle),
@@ -2471,6 +2492,7 @@ var Points = () => {
2471
2492
  const [selectedPointsType, setSelectedPointsType] = (0, import_react12.useState)(null);
2472
2493
  const { setSelectedPaymentMethod, selectedPaymentMethod } = useSpreePaymentMethod();
2473
2494
  const { spreePayConfig } = useSpreePayConfig();
2495
+ const { appProps } = useStaticConfig();
2474
2496
  const handleTogglePoints = (enabled) => {
2475
2497
  setUsePoints(enabled);
2476
2498
  if (!enabled) {
@@ -2485,7 +2507,7 @@ var Points = () => {
2485
2507
  value: usePoints,
2486
2508
  onChange: handleTogglePoints,
2487
2509
  message: spreePayConfig?.creditCard.pointsInfoMessage,
2488
- disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points
2510
+ disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points || appProps.disabledPoints
2489
2511
  }
2490
2512
  ),
2491
2513
  usePoints && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
@@ -3254,19 +3276,27 @@ var Crypto = () => {
3254
3276
  // src/components/CryptoTab/Crypto/CryptoWrapper.tsx
3255
3277
  var import_jsx_runtime38 = require("react/jsx-runtime");
3256
3278
  var queryClient = new import_react_query.QueryClient();
3279
+ var CHAINS = [import_chains.base];
3280
+ var wagmiConfigCache = /* @__PURE__ */ new Map();
3281
+ function getCachedWagmiConfig(projectId, appName) {
3282
+ const key = `${projectId}::${appName}`;
3283
+ let cfg2 = wagmiConfigCache.get(key);
3284
+ if (!cfg2) {
3285
+ cfg2 = (0, import_rainbowkit2.getDefaultConfig)({ appName, projectId, chains: CHAINS, ssr: true });
3286
+ wagmiConfigCache.set(key, cfg2);
3287
+ }
3288
+ return cfg2;
3289
+ }
3257
3290
  var CryptoWrapper = () => {
3258
- const { spreePayConfig } = useSpreePayConfig();
3259
- const config = (0, import_react16.useMemo)(() => {
3260
- if (!spreePayConfig) return null;
3261
- return (0, import_rainbowkit2.getDefaultConfig)({
3262
- appName: spreePayConfig.rainbowAppName,
3263
- projectId: spreePayConfig.rainbowProjectId,
3264
- chains: [import_chains.base],
3265
- ssr: false
3266
- });
3291
+ const { spreePayConfig, configIsLoading } = useSpreePayConfig();
3292
+ const [wagmiConfig, setWagmiConfig] = (0, import_react16.useState)(null);
3293
+ (0, import_react16.useEffect)(() => {
3294
+ if (!spreePayConfig) return;
3295
+ const cfg2 = getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
3296
+ setWagmiConfig((prev) => prev ? prev : cfg2);
3267
3297
  }, [spreePayConfig]);
3268
- if (!config) return null;
3269
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_wagmi5.WagmiProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_rainbowkit2.RainbowKitProvider, { theme: (0, import_rainbowkit2.lightTheme)({ borderRadius: "large" }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_nice_modal_react6.default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Crypto, {}) }) }) }) });
3298
+ if (configIsLoading || !wagmiConfig) return null;
3299
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_wagmi5.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_rainbowkit2.RainbowKitProvider, { theme: (0, import_rainbowkit2.lightTheme)({ borderRadius: "large" }), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_nice_modal_react6.default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Crypto, {}) }) }) }) });
3270
3300
  };
3271
3301
 
3272
3302
  // src/components/CryptoTab/CryptoTab.tsx
package/build/index.css CHANGED
@@ -464,6 +464,9 @@
464
464
  .sl-spreepay .min-w-0 {
465
465
  min-width: calc(var(--spacing) * 0);
466
466
  }
467
+ .sl-spreepay .min-w-\[75px\] {
468
+ min-width: 75px;
469
+ }
467
470
  .sl-spreepay .flex-1 {
468
471
  flex: 1;
469
472
  }
@@ -511,9 +514,6 @@
511
514
  .sl-spreepay .items-center {
512
515
  align-items: center;
513
516
  }
514
- .sl-spreepay .items-start {
515
- align-items: flex-start;
516
- }
517
517
  .sl-spreepay .justify-between {
518
518
  justify-content: space-between;
519
519
  }
@@ -535,6 +535,9 @@
535
535
  .sl-spreepay .gap-2 {
536
536
  gap: calc(var(--spacing) * 2);
537
537
  }
538
+ .sl-spreepay .gap-2\.5 {
539
+ gap: calc(var(--spacing) * 2.5);
540
+ }
538
541
  .sl-spreepay .gap-3 {
539
542
  gap: calc(var(--spacing) * 3);
540
543
  }
@@ -718,9 +721,15 @@
718
721
  .sl-spreepay .p-6 {
719
722
  padding: calc(var(--spacing) * 6);
720
723
  }
724
+ .sl-spreepay .px-1 {
725
+ padding-inline: calc(var(--spacing) * 1);
726
+ }
721
727
  .sl-spreepay .px-1\.5 {
722
728
  padding-inline: calc(var(--spacing) * 1.5);
723
729
  }
730
+ .sl-spreepay .px-2 {
731
+ padding-inline: calc(var(--spacing) * 2);
732
+ }
724
733
  .sl-spreepay .px-2\.5 {
725
734
  padding-inline: calc(var(--spacing) * 2.5);
726
735
  }
@@ -1463,11 +1472,32 @@
1463
1472
  justify-content: flex-end;
1464
1473
  }
1465
1474
  }
1475
+ .sl-spreepay .sm\:gap-2 {
1476
+ @media (width >= 40rem) {
1477
+ gap: calc(var(--spacing) * 2);
1478
+ }
1479
+ }
1480
+ .sl-spreepay .sm\:gap-3 {
1481
+ @media (width >= 40rem) {
1482
+ gap: calc(var(--spacing) * 3);
1483
+ }
1484
+ }
1485
+ .sl-spreepay .sm\:px-3 {
1486
+ @media (width >= 40rem) {
1487
+ padding-inline: calc(var(--spacing) * 3);
1488
+ }
1489
+ }
1466
1490
  .sl-spreepay .sm\:text-left {
1467
1491
  @media (width >= 40rem) {
1468
1492
  text-align: left;
1469
1493
  }
1470
1494
  }
1495
+ .sl-spreepay .sm\:text-sm {
1496
+ @media (width >= 40rem) {
1497
+ font-size: var(--text-sm);
1498
+ line-height: var(--tw-leading, var(--text-sm--line-height));
1499
+ }
1500
+ }
1471
1501
  .sl-spreepay .md\:block {
1472
1502
  @media (width >= 48rem) {
1473
1503
  display: block;
@@ -1498,16 +1528,16 @@
1498
1528
  padding-bottom: calc(var(--spacing) * 7);
1499
1529
  }
1500
1530
  }
1501
- .sl-spreepay .md\:text-sm {
1531
+ .sl-spreepay .md\:text-lg {
1502
1532
  @media (width >= 48rem) {
1503
- font-size: var(--text-sm);
1504
- line-height: var(--tw-leading, var(--text-sm--line-height));
1533
+ font-size: var(--text-lg);
1534
+ line-height: var(--tw-leading, var(--text-lg--line-height));
1505
1535
  }
1506
1536
  }
1507
- .sl-spreepay .md\:text-xl {
1537
+ .sl-spreepay .md\:text-sm {
1508
1538
  @media (width >= 48rem) {
1509
- font-size: var(--text-xl);
1510
- line-height: var(--tw-leading, var(--text-xl--line-height));
1539
+ font-size: var(--text-sm);
1540
+ line-height: var(--tw-leading, var(--text-sm--line-height));
1511
1541
  }
1512
1542
  }
1513
1543
  .sl-spreepay .dark\:border-input {
package/build/index.d.cts CHANGED
@@ -6,6 +6,8 @@ type SpreePayProps = {
6
6
  className?: string;
7
7
  isProcessing?: boolean;
8
8
  transactionFeePercentage?: number;
9
+ disabledPoints?: boolean;
10
+ topUpLink?: string;
9
11
  };
10
12
 
11
13
  declare const SpreePay: FC<SpreePayProps>;
package/build/index.d.ts CHANGED
@@ -6,6 +6,8 @@ type SpreePayProps = {
6
6
  className?: string;
7
7
  isProcessing?: boolean;
8
8
  transactionFeePercentage?: number;
9
+ disabledPoints?: boolean;
10
+ topUpLink?: string;
9
11
  };
10
12
 
11
13
  declare const SpreePay: FC<SpreePayProps>;
package/build/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // src/SpreePay.tsx
2
- import { useEffect as useEffect11, useLayoutEffect as useLayoutEffect3, useMemo as useMemo10, useRef as useRef7, useState as useState14 } from "react";
2
+ import { useEffect as useEffect12, useLayoutEffect as useLayoutEffect3, useMemo as useMemo9, useRef as useRef7, useState as useState15 } from "react";
3
3
  import NiceModal7 from "@ebay/nice-modal-react";
4
4
  import { SWRConfig } from "swr";
5
5
 
6
6
  // package.json
7
- var version = "0.1.26";
7
+ var version = "0.1.28";
8
8
 
9
9
  // src/context/SpreePayActionsContext.tsx
10
10
  import { createContext, useCallback, useContext, useRef, useState } from "react";
@@ -1268,24 +1268,43 @@ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1268
1268
  var PointsSwitch = (props) => {
1269
1269
  const { disabled = false, value, onChange, message } = props;
1270
1270
  const { spreePayConfig } = useSpreePayConfig();
1271
+ const { appProps } = useStaticConfig();
1271
1272
  const { balance } = useSlapiBalance();
1272
1273
  const id = useId2();
1273
1274
  return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-6", children: [
1274
1275
  /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between gap-3", children: [
1275
1276
  /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3", children: [
1276
1277
  /* @__PURE__ */ jsx15(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
1277
- /* @__PURE__ */ jsxs9(Label, { className: "text-md items-baseline leading-[1.3] font-semibold text-black md:text-xl", htmlFor: id, children: [
1278
- "Use Points ",
1279
- /* @__PURE__ */ jsx15("span", { className: "text-xs font-medium", children: "Optional" })
1280
- ] })
1278
+ /* @__PURE__ */ jsxs9(
1279
+ Label,
1280
+ {
1281
+ htmlFor: id,
1282
+ className: "text-md flex-col items-baseline gap-0 leading-[1.3] font-semibold text-black sm:flex-row sm:gap-2 md:text-lg",
1283
+ children: [
1284
+ "Use Points ",
1285
+ /* @__PURE__ */ jsx15("span", { className: "text-xs font-medium", children: "Optional" })
1286
+ ]
1287
+ }
1288
+ )
1281
1289
  ] }),
1282
- balance?.availablePoints ? /* @__PURE__ */ jsxs9("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
1283
- formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
1284
- " ",
1285
- !!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ jsx15("span", { className: "text-black/50", children: formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio) })
1286
- ] }) : null
1290
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2.5", children: [
1291
+ balance?.availablePoints ? /* @__PURE__ */ jsxs9("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
1292
+ formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
1293
+ !!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ jsx15("span", { className: "text-black/50", children: ` ${formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio)}` })
1294
+ ] }) : null,
1295
+ Boolean(appProps.topUpLink) && /* @__PURE__ */ jsx15(
1296
+ "a",
1297
+ {
1298
+ className: "bg-primary cursor-pointer rounded-full px-2 py-1.5 text-xs font-medium text-white",
1299
+ rel: "noreferrer",
1300
+ target: "_blank",
1301
+ href: appProps.topUpLink,
1302
+ children: "Top Up"
1303
+ }
1304
+ )
1305
+ ] })
1287
1306
  ] }),
1288
- message && /* @__PURE__ */ jsxs9("div", { className: "flex items-start gap-1 rounded-sm border-1 border-[#006FD533] bg-[#006FD50D] p-1.5", children: [
1307
+ message && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 rounded-sm border-1 border-[#006FD533] bg-[#006FD50D] p-1.5", children: [
1289
1308
  /* @__PURE__ */ jsx15("svg", { className: "size-5 shrink-0", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx15(
1290
1309
  "path",
1291
1310
  {
@@ -2331,16 +2350,17 @@ var PointsSelector = (props) => {
2331
2350
  children: /* @__PURE__ */ jsx24("div", { className: "flex h-5 w-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ jsx24("div", { className: "bg-primary h-2.5 w-2.5 rounded-full" }) })
2332
2351
  }
2333
2352
  ),
2334
- /* @__PURE__ */ jsx24("div", { className: "flex h-full w-full items-center justify-between gap-3 px-3", children })
2353
+ /* @__PURE__ */ jsx24("div", { className: "flex h-full w-full items-center justify-between gap-2 px-2 sm:gap-3 sm:px-3", children })
2335
2354
  ] }),
2336
- isSelected && /* @__PURE__ */ jsx24("div", { className: "px-3 pt-6 pb-2 md:px-4", children: /* @__PURE__ */ jsxs12("div", { className: "flex justify-between gap-3", children: [
2355
+ isSelected && /* @__PURE__ */ jsx24("div", { className: "px-2 pt-6 pb-2 sm:px-3 md:px-4", children: /* @__PURE__ */ jsxs12("div", { className: "flex justify-between gap-2 sm:gap-3", children: [
2337
2356
  /* @__PURE__ */ jsxs12("div", { className: "flex max-w-[100px] flex-col gap-1", children: [
2338
2357
  /* @__PURE__ */ jsx24(
2339
2358
  Input,
2340
2359
  {
2341
2360
  readOnly: true,
2361
+ name: "points amount",
2342
2362
  value: Math.round(splitTokens),
2343
- className: "bg-white text-center font-medium",
2363
+ className: "sm:text-md min-w-[75px] bg-white px-1 text-center text-xs font-medium sm:px-3",
2344
2364
  onClick: (e) => e.stopPropagation()
2345
2365
  }
2346
2366
  ),
@@ -2363,8 +2383,9 @@ var PointsSelector = (props) => {
2363
2383
  Input,
2364
2384
  {
2365
2385
  readOnly: true,
2386
+ name: "usd amount",
2366
2387
  value: formatUSD(usdAmount + getTransactionFee(usdAmount, appProps.transactionFeePercentage)),
2367
- className: "bg-white text-center font-medium",
2388
+ className: "sm:text-md min-w-[75px] bg-white px-1 text-center text-xs font-medium sm:px-3",
2368
2389
  onClick: (e) => e.stopPropagation()
2369
2390
  }
2370
2391
  ),
@@ -2412,7 +2433,7 @@ var SplitBlock = (props) => {
2412
2433
  initWallet(spreePayConfig?.pointsChain);
2413
2434
  }, [spreePayConfig?.pointsChain, initWallet]);
2414
2435
  return /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxs13(PointsSelector, { isDisabled: !walletReady, onSelect: () => onSelect("air"), isSelected, children: [
2415
- /* @__PURE__ */ jsx25("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ jsxs13("p", { className: "text-sm font-medium text-black", children: [
2436
+ /* @__PURE__ */ jsx25("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ jsxs13("p", { className: "text-left text-xs font-medium text-black sm:text-sm", children: [
2416
2437
  /* @__PURE__ */ jsx25("span", { className: "text-black/50", children: "Available" }),
2417
2438
  " ",
2418
2439
  formatPoints(balance.availablePoints, pointsTitle),
@@ -2431,6 +2452,7 @@ var Points = () => {
2431
2452
  const [selectedPointsType, setSelectedPointsType] = useState10(null);
2432
2453
  const { setSelectedPaymentMethod, selectedPaymentMethod } = useSpreePaymentMethod();
2433
2454
  const { spreePayConfig } = useSpreePayConfig();
2455
+ const { appProps } = useStaticConfig();
2434
2456
  const handleTogglePoints = (enabled) => {
2435
2457
  setUsePoints(enabled);
2436
2458
  if (!enabled) {
@@ -2445,7 +2467,7 @@ var Points = () => {
2445
2467
  value: usePoints,
2446
2468
  onChange: handleTogglePoints,
2447
2469
  message: spreePayConfig?.creditCard.pointsInfoMessage,
2448
- disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points
2470
+ disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points || appProps.disabledPoints
2449
2471
  }
2450
2472
  ),
2451
2473
  usePoints && /* @__PURE__ */ jsx26(
@@ -2515,7 +2537,7 @@ var CreditCardTab = () => {
2515
2537
  };
2516
2538
 
2517
2539
  // src/components/CryptoTab/Crypto/CryptoWrapper.tsx
2518
- import { useMemo as useMemo9 } from "react";
2540
+ import { useEffect as useEffect10, useState as useState13 } from "react";
2519
2541
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2520
2542
  import NiceModal6 from "@ebay/nice-modal-react";
2521
2543
  import { RainbowKitProvider, getDefaultConfig, lightTheme } from "@rainbow-me/rainbowkit";
@@ -3214,19 +3236,27 @@ var Crypto = () => {
3214
3236
  // src/components/CryptoTab/Crypto/CryptoWrapper.tsx
3215
3237
  import { jsx as jsx38 } from "react/jsx-runtime";
3216
3238
  var queryClient = new QueryClient();
3239
+ var CHAINS = [base];
3240
+ var wagmiConfigCache = /* @__PURE__ */ new Map();
3241
+ function getCachedWagmiConfig(projectId, appName) {
3242
+ const key = `${projectId}::${appName}`;
3243
+ let cfg2 = wagmiConfigCache.get(key);
3244
+ if (!cfg2) {
3245
+ cfg2 = getDefaultConfig({ appName, projectId, chains: CHAINS, ssr: true });
3246
+ wagmiConfigCache.set(key, cfg2);
3247
+ }
3248
+ return cfg2;
3249
+ }
3217
3250
  var CryptoWrapper = () => {
3218
- const { spreePayConfig } = useSpreePayConfig();
3219
- const config = useMemo9(() => {
3220
- if (!spreePayConfig) return null;
3221
- return getDefaultConfig({
3222
- appName: spreePayConfig.rainbowAppName,
3223
- projectId: spreePayConfig.rainbowProjectId,
3224
- chains: [base],
3225
- ssr: false
3226
- });
3251
+ const { spreePayConfig, configIsLoading } = useSpreePayConfig();
3252
+ const [wagmiConfig, setWagmiConfig] = useState13(null);
3253
+ useEffect10(() => {
3254
+ if (!spreePayConfig) return;
3255
+ const cfg2 = getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
3256
+ setWagmiConfig((prev) => prev ? prev : cfg2);
3227
3257
  }, [spreePayConfig]);
3228
- if (!config) return null;
3229
- return /* @__PURE__ */ jsx38(WagmiProvider, { config, children: /* @__PURE__ */ jsx38(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx38(RainbowKitProvider, { theme: lightTheme({ borderRadius: "large" }), children: /* @__PURE__ */ jsx38(NiceModal6.Provider, { children: /* @__PURE__ */ jsx38(Crypto, {}) }) }) }) });
3258
+ if (configIsLoading || !wagmiConfig) return null;
3259
+ return /* @__PURE__ */ jsx38(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx38(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx38(RainbowKitProvider, { theme: lightTheme({ borderRadius: "large" }), children: /* @__PURE__ */ jsx38(NiceModal6.Provider, { children: /* @__PURE__ */ jsx38(Crypto, {}) }) }) }) });
3230
3260
  };
3231
3261
 
3232
3262
  // src/components/CryptoTab/CryptoTab.tsx
@@ -3340,7 +3370,7 @@ var SpreePayContent = ({ isLoggedIn }) => {
3340
3370
  };
3341
3371
 
3342
3372
  // src/hooks/useKeycloakSSO.ts
3343
- import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef6, useState as useState13 } from "react";
3373
+ import { useCallback as useCallback7, useEffect as useEffect11, useRef as useRef6, useState as useState14 } from "react";
3344
3374
  import Keycloak from "keycloak-js";
3345
3375
  var refreshAheadSeconds = 60;
3346
3376
  function useKeycloakSSO(config) {
@@ -3348,9 +3378,9 @@ function useKeycloakSSO(config) {
3348
3378
  const initRef = useRef6(false);
3349
3379
  const kcRef = useRef6(null);
3350
3380
  const refreshTimerRef = useRef6(null);
3351
- const [error, setError] = useState13(null);
3352
- const [isChecking, setIsChecking] = useState13(enabled);
3353
- const [accessToken, setAccessToken] = useState13(null);
3381
+ const [error, setError] = useState14(null);
3382
+ const [isChecking, setIsChecking] = useState14(enabled);
3383
+ const [accessToken, setAccessToken] = useState14(null);
3354
3384
  const scheduleRefresh = useCallback7(() => {
3355
3385
  const kc = kcRef.current;
3356
3386
  if (!kc || !kc.tokenParsed || !kc.tokenParsed.exp) {
@@ -3372,7 +3402,7 @@ function useKeycloakSSO(config) {
3372
3402
  });
3373
3403
  }, delayMs);
3374
3404
  }, []);
3375
- useEffect10(() => {
3405
+ useEffect11(() => {
3376
3406
  if (initRef.current || !enabled) return;
3377
3407
  initRef.current = true;
3378
3408
  setIsChecking(true);
@@ -3410,13 +3440,13 @@ function useKeycloakSSO(config) {
3410
3440
  import { jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
3411
3441
  var SpreePayInner = () => {
3412
3442
  const rootRef = useRef7(null);
3413
- const [portalEl, setPortalEl] = useState14(null);
3443
+ const [portalEl, setPortalEl] = useState15(null);
3414
3444
  useLayoutEffect3(() => {
3415
3445
  if (!rootRef.current) return;
3416
3446
  const el = rootRef.current.querySelector(":scope > .sl-spreepay__portal");
3417
3447
  setPortalEl(el ?? null);
3418
3448
  }, []);
3419
- useEffect11(() => {
3449
+ useEffect12(() => {
3420
3450
  console.log(`[spree-pay] v${version}`);
3421
3451
  }, []);
3422
3452
  const { env } = useSpreePayEnv();
@@ -3429,7 +3459,7 @@ var SpreePayInner = () => {
3429
3459
  ssoPageURI: env?.ssoPageURI,
3430
3460
  enabled: !env?.accessToken
3431
3461
  });
3432
- const slapiFetcher = useMemo10(() => {
3462
+ const slapiFetcher = useMemo9(() => {
3433
3463
  if (accessToken || env.accessToken) {
3434
3464
  return registerApi({
3435
3465
  accessToken: env.accessToken || accessToken,
@@ -3469,9 +3499,9 @@ var SpreePay = (props) => {
3469
3499
  };
3470
3500
 
3471
3501
  // src/hooks/useCapture3DS.ts
3472
- import { useEffect as useEffect12 } from "react";
3502
+ import { useEffect as useEffect13 } from "react";
3473
3503
  var useCapture3DS = (searchParams) => {
3474
- useEffect12(() => {
3504
+ useEffect13(() => {
3475
3505
  if (typeof window !== "undefined" && window.parent && searchParams?.paymentIntent) {
3476
3506
  window.parent.SP_EVENT_BUS?.emit("paymentIntent", { paymentIntent: searchParams.paymentIntent });
3477
3507
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superlogic/spree-pay",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Spree-pay React component and utilities",
5
5
  "private": false,
6
6
  "type": "module",