@superlogic/spree-pay 0.4.0 → 0.4.1

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/README.md CHANGED
@@ -110,6 +110,7 @@ type SpreePayProps = {
110
110
  currencyCode?: string; // ISO 4217 display currency (e.g. "AUD").
111
111
  foreignCurrencyAmount?: number; // Pre-fee order total in the display currency (e.g. 1280.46). Used directly as Pay button base; transaction fee is added on top.
112
112
  exchangeRate?: number; // 1 unit of currencyCode in USD (e.g. 0.65 for AUD→USD). Used to convert USD remainder when points are applied.
113
+ origin?: string; // Optional source identifier (e.g. ONE_PLATFORM)
113
114
  };
114
115
  ```
115
116
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Iframe3ds
3
- } from "./chunk-BGLP7QYP.js";
3
+ } from "./chunk-IDYBXJWP.js";
4
4
  import {
5
5
  InfoBanner,
6
6
  Legal,
@@ -12,7 +12,7 @@ import {
12
12
  useSpreePayRegister,
13
13
  useSpreePaymentMethod,
14
14
  useStaticConfig
15
- } from "./chunk-JUAE4572.js";
15
+ } from "./chunk-5GHGAP6Z.js";
16
16
 
17
17
  // src/components/CryptoComTab/CryptoComTab.tsx
18
18
  import { useCallback, useEffect } from "react";
@@ -2,7 +2,7 @@ import {
2
2
  CheckoutButton,
3
3
  PointsSwitch,
4
4
  cn as cn2
5
- } from "./chunk-STM24EZ3.js";
5
+ } from "./chunk-W43ZCY4N.js";
6
6
  import {
7
7
  Dialog,
8
8
  DialogContent,
@@ -16,7 +16,7 @@ import {
16
16
  useSpreePayConfig,
17
17
  useSpreePayRegister,
18
18
  useSpreePaymentMethod
19
- } from "./chunk-JUAE4572.js";
19
+ } from "./chunk-5GHGAP6Z.js";
20
20
 
21
21
  // src/components/CryptoTab/Crypto/CryptoWrapper.tsx
22
22
  import { useMemo as useMemo2 } from "react";
@@ -9,7 +9,7 @@ var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
9
9
  })(PaymentType || {});
10
10
 
11
11
  // package.json
12
- var version = "0.4.0";
12
+ var version = "0.4.1";
13
13
 
14
14
  // src/utils/logger.ts
15
15
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
@@ -2,7 +2,7 @@ import {
2
2
  Dialog,
3
3
  DialogContent,
4
4
  DialogTitle
5
- } from "./chunk-JUAE4572.js";
5
+ } from "./chunk-5GHGAP6Z.js";
6
6
 
7
7
  // src/modals/Iframe3ds.tsx
8
8
  import { useEffect } from "react";
@@ -6,7 +6,7 @@ import {
6
6
  useSpreePayEnv,
7
7
  useSpreePaymentMethod,
8
8
  useStaticConfig
9
- } from "./chunk-JUAE4572.js";
9
+ } from "./chunk-5GHGAP6Z.js";
10
10
 
11
11
  // src/components/common/PointsSwitch.tsx
12
12
  import { useId } from "react";
package/build/index.cjs CHANGED
@@ -68,7 +68,7 @@ var init_payments = __esm({
68
68
  var version;
69
69
  var init_package = __esm({
70
70
  "package.json"() {
71
- version = "0.4.0";
71
+ version = "0.4.1";
72
72
  }
73
73
  });
74
74
 
@@ -3056,9 +3056,10 @@ var useSplitCardPayments = (mode = "web2") => {
3056
3056
  // src/hooks/useCards.ts
3057
3057
  var import_swr2 = __toESM(require("swr"), 1);
3058
3058
  init_SpreePayActionsContext();
3059
+ var URL2 = "/v1/payments/cards";
3059
3060
  var useCards = () => {
3060
3061
  const { origin } = useSpreePayEnv();
3061
- const { data, isLoading, mutate } = (0, import_swr2.default)(`/v1/payments/cards?origin=${origin}`);
3062
+ const { data, isLoading, mutate } = (0, import_swr2.default)(origin ? `${URL2}?origin=${origin}` : URL2);
3062
3063
  return {
3063
3064
  cards: data?.data.filter((c) => c.active) || [],
3064
3065
  cardsIsLoading: isLoading,
package/build/index.js CHANGED
@@ -8,10 +8,10 @@ import {
8
8
  getSplitAmount,
9
9
  getTransactionFee,
10
10
  useSlapiBalance
11
- } from "./chunk-STM24EZ3.js";
11
+ } from "./chunk-W43ZCY4N.js";
12
12
  import {
13
13
  Iframe3ds
14
- } from "./chunk-BGLP7QYP.js";
14
+ } from "./chunk-IDYBXJWP.js";
15
15
  import {
16
16
  InfoBanner,
17
17
  LogLevel,
@@ -31,7 +31,7 @@ import {
31
31
  useSpreePayRegister,
32
32
  useSpreePaymentMethod,
33
33
  useStaticConfig
34
- } from "./chunk-JUAE4572.js";
34
+ } from "./chunk-5GHGAP6Z.js";
35
35
 
36
36
  // src/SpreePay.tsx
37
37
  import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo7, useState as useState10 } from "react";
@@ -537,9 +537,10 @@ var useSplitCardPayments = (mode = "web2") => {
537
537
 
538
538
  // src/hooks/useCards.ts
539
539
  import useSWR from "swr";
540
+ var URL = "/v1/payments/cards";
540
541
  var useCards = () => {
541
542
  const { origin } = useSpreePayEnv();
542
- const { data, isLoading, mutate } = useSWR(`/v1/payments/cards?origin=${origin}`);
543
+ const { data, isLoading, mutate } = useSWR(origin ? `${URL}?origin=${origin}` : URL);
543
544
  return {
544
545
  cards: data?.data.filter((c) => c.active) || [],
545
546
  cardsIsLoading: isLoading,
@@ -2205,9 +2206,9 @@ var TabButtons = (props) => {
2205
2206
 
2206
2207
  // src/SpreePayContent.tsx
2207
2208
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
2208
- var CryptoTab = lazy(() => import("./CryptoTab-AK7WPMBJ.js").then((module) => ({ default: module.CryptoTab })));
2209
+ var CryptoTab = lazy(() => import("./CryptoTab-ZABUPHVT.js").then((module) => ({ default: module.CryptoTab })));
2209
2210
  var CryptoComTab = lazy(
2210
- () => import("./CryptoComTab-QOGLM3EB.js").then((module) => ({ default: module.CryptoComTab }))
2211
+ () => import("./CryptoComTab-PW3NRWJL.js").then((module) => ({ default: module.CryptoComTab }))
2211
2212
  );
2212
2213
  var TabLoadingFallback = () => /* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center px-5 py-8 md:px-7", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-3", children: [
2213
2214
  /* @__PURE__ */ jsx18("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-(--border-component-specific-card) border-t-(--brand-primary)" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superlogic/spree-pay",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Spree-pay React component and utilities",
5
5
  "private": false,
6
6
  "type": "module",