@superlogic/spree-pay 0.3.3 → 0.3.4

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
@@ -213,18 +213,49 @@ enum LogLevel {
213
213
 
214
214
  ## Theme Customization
215
215
 
216
- The widget uses CSS variables for theming. The `<SpreePay>` component renders with the `sl-spreepay` class, so you can override theme variables by targeting that class in your CSS:
216
+ SpreePay uses CSS variables for theming (see all 58+ variables in `packages/spree-pay/src/styles/globals.css:22-82`). You can override these using CSS or CSS-in-JS.
217
+
218
+ **Important:** To override the theme locally (scoped), you need **more specific CSS** than just `.sl-spreepay`. Use a wrapper class like `.your-class .sl-spreepay` or combine with SpreePay's className prop.
219
+
220
+ ### Global override (affects all SpreePay instances)
217
221
 
218
222
  ```css
219
223
  .sl-spreepay {
220
- --primary: #your-color;
221
- --accent: #your-accent;
222
- --s-default: #your-surface-color;
223
- /* ... see packages/spree-pay/src/styles/globals.css for all 58 variables */
224
+ --primary: #272e32;
225
+ --accent: #439ef4;
226
+ --s-default: #ffffff;
224
227
  }
225
228
  ```
226
229
 
227
- All available CSS variables are documented in `packages/spree-pay/src/styles/globals.css:22-82`.
230
+ ### Local/scoped override
231
+
232
+ **Option A:** Wrap SpreePay in a container with your own class:
233
+
234
+ ```tsx
235
+ <div className="my-checkout">
236
+ <SpreePay {...props} />
237
+ </div>
238
+
239
+ <style>{`
240
+ .my-checkout .sl-spreepay {
241
+ --primary: #your-color;
242
+ --accent: #your-accent;
243
+ }
244
+ `}</style>
245
+ ```
246
+
247
+ **Option B:** Pass className to SpreePay and use combined selector:
248
+
249
+ ```tsx
250
+ <SpreePay className="custom-theme" {...props} />
251
+
252
+ <style>{`
253
+ .sl-spreepay.custom-theme {
254
+ --primary: #your-color;
255
+ --accent: #your-accent;
256
+ }
257
+ `}</style>
258
+ ```
228
259
 
229
260
  ## Keycloak SSO page example (/silent-check-sso.html)
230
261
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Iframe3ds
3
- } from "./chunk-BSDEX662.js";
3
+ } from "./chunk-ER5YKU2O.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-6RZ4XF7B.js";
15
+ } from "./chunk-5FKBVNC4.js";
16
16
 
17
17
  // src/components/CryptoComTab/CryptoComTab.tsx
18
18
  import { useCallback, useEffect } from "react";
@@ -22,7 +22,7 @@ import NiceModal from "@ebay/nice-modal-react";
22
22
  var cryptoComLogger = logger.child("crypto-com-payment");
23
23
  var useCryptoComPayment = () => {
24
24
  const { selectedPaymentMethod } = useSpreePaymentMethod();
25
- const { env } = useSpreePayEnv();
25
+ const { redirect3dsURI } = useSpreePayEnv();
26
26
  const cryptoComPayment = async (params) => {
27
27
  if (selectedPaymentMethod.type !== "CDC" /* CDC */) {
28
28
  throw new Error("Unsupported payment method");
@@ -34,8 +34,8 @@ var useCryptoComPayment = () => {
34
34
  metadata,
35
35
  type: "CDC" /* CDC */,
36
36
  cdc: {
37
- returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}?payment_intent=success`,
38
- cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}?payment_intent=canceled`
37
+ returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}?payment_intent=success`,
38
+ cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}?payment_intent=canceled`
39
39
  }
40
40
  });
41
41
  cryptoComLogger.info("Payment created", {
@@ -2,7 +2,7 @@ import {
2
2
  CheckoutButton,
3
3
  PointsSwitch,
4
4
  cn as cn2
5
- } from "./chunk-ZPFV3WW6.js";
5
+ } from "./chunk-GO3SK2EV.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-6RZ4XF7B.js";
19
+ } from "./chunk-5FKBVNC4.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.3.3";
12
+ var version = "0.3.4";
13
13
 
14
14
  // src/utils/logger.ts
15
15
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
@@ -225,7 +225,7 @@ var useSpreePaymentMethod = () => {
225
225
  var useSpreePayEnv = () => {
226
226
  const ctx = useContext(SpreePayActionsContext);
227
227
  if (!ctx) throw new Error("useSpreePay must be used within a SpreePayProvider");
228
- return { env: ctx.env };
228
+ return ctx.env;
229
229
  };
230
230
  var useSpreePayRegister = () => {
231
231
  const ctx = useContext(SpreePayActionsContext);
@@ -322,23 +322,23 @@ var config = {
322
322
  import { jsx as jsx2 } from "react/jsx-runtime";
323
323
  var StaticConfigContext = createContext2(null);
324
324
  var StaticConfigProvider = ({ children, props }) => {
325
- const { env } = useSpreePayEnv();
325
+ const { environment, tenantId } = useSpreePayEnv();
326
326
  const [appProps, setAppProps] = useState2(props);
327
327
  useEffect(() => {
328
328
  setAppProps(props);
329
329
  }, [props]);
330
330
  const staticConfig = useMemo(() => {
331
- const envConfig = config[env.environment];
332
- const isKnownTenant = env.tenantId in envConfig;
331
+ const envConfig = config[environment];
332
+ const isKnownTenant = tenantId in envConfig;
333
333
  if (!isKnownTenant) {
334
- logger.warn(`Unknown tenantId "${env.tenantId}", falling back to "moca"`, {
335
- tenantId: env.tenantId,
336
- environment: env.environment
334
+ logger.warn(`Unknown tenantId "${tenantId}", falling back to "moca"`, {
335
+ tenantId,
336
+ environment
337
337
  });
338
338
  }
339
- const appKey = isKnownTenant ? env.tenantId : "moca";
339
+ const appKey = isKnownTenant ? tenantId : "moca";
340
340
  return envConfig[appKey];
341
- }, [env.environment, env.tenantId]);
341
+ }, [environment, tenantId]);
342
342
  return /* @__PURE__ */ jsx2(StaticConfigContext.Provider, { value: { staticConfig, appProps }, children });
343
343
  };
344
344
  var useStaticConfig = () => {
@@ -464,22 +464,11 @@ var registerApi = (config2) => {
464
464
 
465
465
  // src/hooks/useSpreePayConfig.ts
466
466
  import useSWR from "swr";
467
+ var URL = "/v1/tenants/configs/spree-pay";
467
468
  var useSpreePayConfig = () => {
468
- const { data, isLoading } = useSWR("/v1/tenants/configs/spree-pay");
469
- return {
470
- spreePayConfig: data ? {
471
- ...data,
472
- rainbowProjectId: data.rainbowProjectId ?? "3fdcd5ff50cb84917cd05e40146975d8",
473
- rainbowAppName: data.rainbowAppName ?? "AIR Shop",
474
- pointsTitle: data.pointsTitle ?? "AIR SP",
475
- pointsConversionRatio: data.pointsConversionRatio ?? 0.01,
476
- crypto: {
477
- ...data.crypto,
478
- oneInchAggregationRouter: data.crypto?.oneInchAggregationRouter || "0x111111125421ca6dc452d289314280a0f8842a65"
479
- }
480
- } : null,
481
- configIsLoading: isLoading
482
- };
469
+ const { origin } = useSpreePayEnv();
470
+ const { data, isLoading } = useSWR(origin ? `${URL}?origin=${origin}` : URL);
471
+ return { spreePayConfig: data ?? null, configIsLoading: isLoading };
483
472
  };
484
473
 
485
474
  // src/components/common/InfoBanner.tsx
@@ -2,7 +2,7 @@ import {
2
2
  Dialog,
3
3
  DialogContent,
4
4
  DialogTitle
5
- } from "./chunk-6RZ4XF7B.js";
5
+ } from "./chunk-5FKBVNC4.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-6RZ4XF7B.js";
9
+ } from "./chunk-5FKBVNC4.js";
10
10
 
11
11
  // src/components/common/PointsSwitch.tsx
12
12
  import { useId } from "react";
@@ -206,7 +206,7 @@ var CheckoutButton = ({ isLoggedIn }) => {
206
206
  const { appProps, staticConfig } = useStaticConfig();
207
207
  const { amount, onProcess, isProcessing, transactionFeePercentage } = appProps;
208
208
  const { spreePayConfig } = useSpreePayConfig();
209
- const { env } = useSpreePayEnv();
209
+ const { tenantId, keycloakClientId } = useSpreePayEnv();
210
210
  const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
211
211
  const { splitAmount, type, method } = selectedPaymentMethod;
212
212
  const usdAmount = getSplitAmount(amount ?? 0, splitAmount ?? 0, spreePayConfig?.pointsConversionRatio);
@@ -240,11 +240,11 @@ var CheckoutButton = ({ isLoggedIn }) => {
240
240
  isLoggedIn ? /* @__PURE__ */ jsx5(Fragment, { children: onProcess && /* @__PURE__ */ jsx5("button", { disabled: isDisabled, onClick: onProcess, className: checkoutClass, children: getCheckoutContent() }) }) : /* @__PURE__ */ jsxs3(
241
241
  "a",
242
242
  {
243
- href: `${staticConfig.keycloakUrl}/realms/${env.tenantId}/protocol/openid-connect/auth?client_id=${env.keycloakClientId ?? "oneof-next"}&response_type=code&redirect_uri=${window.location.href}`,
243
+ href: `${staticConfig.keycloakUrl}/realms/${tenantId}/protocol/openid-connect/auth?client_id=${keycloakClientId ?? "oneof-next"}&response_type=code&redirect_uri=${window.location.href}`,
244
244
  className: checkoutClass,
245
245
  children: [
246
246
  "Log in / Sign up",
247
- env.tenantId === "moca" ? " for an AIR account" : ""
247
+ tenantId === "moca" ? " for an AIR account" : ""
248
248
  ]
249
249
  }
250
250
  ),
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.3.3";
71
+ version = "0.3.4";
72
72
  }
73
73
  });
74
74
 
@@ -285,7 +285,7 @@ var init_SpreePayActionsContext = __esm({
285
285
  useSpreePayEnv = () => {
286
286
  const ctx = (0, import_react.useContext)(SpreePayActionsContext);
287
287
  if (!ctx) throw new Error("useSpreePay must be used within a SpreePayProvider");
288
- return { env: ctx.env };
288
+ return ctx.env;
289
289
  };
290
290
  useSpreePayRegister = () => {
291
291
  const ctx = (0, import_react.useContext)(SpreePayActionsContext);
@@ -396,23 +396,23 @@ var init_StaticConfigContext = __esm({
396
396
  import_jsx_runtime2 = require("react/jsx-runtime");
397
397
  StaticConfigContext = (0, import_react2.createContext)(null);
398
398
  StaticConfigProvider = ({ children, props }) => {
399
- const { env } = useSpreePayEnv();
399
+ const { environment, tenantId } = useSpreePayEnv();
400
400
  const [appProps, setAppProps] = (0, import_react2.useState)(props);
401
401
  (0, import_react2.useEffect)(() => {
402
402
  setAppProps(props);
403
403
  }, [props]);
404
404
  const staticConfig = (0, import_react2.useMemo)(() => {
405
- const envConfig = config[env.environment];
406
- const isKnownTenant = env.tenantId in envConfig;
405
+ const envConfig = config[environment];
406
+ const isKnownTenant = tenantId in envConfig;
407
407
  if (!isKnownTenant) {
408
- logger.warn(`Unknown tenantId "${env.tenantId}", falling back to "moca"`, {
409
- tenantId: env.tenantId,
410
- environment: env.environment
408
+ logger.warn(`Unknown tenantId "${tenantId}", falling back to "moca"`, {
409
+ tenantId,
410
+ environment
411
411
  });
412
412
  }
413
- const appKey = isKnownTenant ? env.tenantId : "moca";
413
+ const appKey = isKnownTenant ? tenantId : "moca";
414
414
  return envConfig[appKey];
415
- }, [env.environment, env.tenantId]);
415
+ }, [environment, tenantId]);
416
416
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StaticConfigContext.Provider, { value: { staticConfig, appProps }, children });
417
417
  };
418
418
  useStaticConfig = () => {
@@ -862,27 +862,17 @@ var init_transactionFee = __esm({
862
862
  });
863
863
 
864
864
  // src/hooks/useSpreePayConfig.ts
865
- var import_swr, useSpreePayConfig;
865
+ var import_swr, URL, useSpreePayConfig;
866
866
  var init_useSpreePayConfig = __esm({
867
867
  "src/hooks/useSpreePayConfig.ts"() {
868
868
  "use strict";
869
869
  import_swr = __toESM(require("swr"), 1);
870
+ init_SpreePayActionsContext();
871
+ URL = "/v1/tenants/configs/spree-pay";
870
872
  useSpreePayConfig = () => {
871
- const { data, isLoading } = (0, import_swr.default)("/v1/tenants/configs/spree-pay");
872
- return {
873
- spreePayConfig: data ? {
874
- ...data,
875
- rainbowProjectId: data.rainbowProjectId ?? "3fdcd5ff50cb84917cd05e40146975d8",
876
- rainbowAppName: data.rainbowAppName ?? "AIR Shop",
877
- pointsTitle: data.pointsTitle ?? "AIR SP",
878
- pointsConversionRatio: data.pointsConversionRatio ?? 0.01,
879
- crypto: {
880
- ...data.crypto,
881
- oneInchAggregationRouter: data.crypto?.oneInchAggregationRouter || "0x111111125421ca6dc452d289314280a0f8842a65"
882
- }
883
- } : null,
884
- configIsLoading: isLoading
885
- };
873
+ const { origin } = useSpreePayEnv();
874
+ const { data, isLoading } = (0, import_swr.default)(origin ? `${URL}?origin=${origin}` : URL);
875
+ return { spreePayConfig: data ?? null, configIsLoading: isLoading };
886
876
  };
887
877
  }
888
878
  });
@@ -1233,7 +1223,7 @@ var init_CheckoutButton = __esm({
1233
1223
  const { appProps, staticConfig } = useStaticConfig();
1234
1224
  const { amount, onProcess, isProcessing, transactionFeePercentage } = appProps;
1235
1225
  const { spreePayConfig } = useSpreePayConfig();
1236
- const { env } = useSpreePayEnv();
1226
+ const { tenantId, keycloakClientId } = useSpreePayEnv();
1237
1227
  const { selectedPaymentMethod, isInternalProcessing } = useSpreePaymentMethod();
1238
1228
  const { splitAmount, type, method } = selectedPaymentMethod;
1239
1229
  const usdAmount = getSplitAmount(amount ?? 0, splitAmount ?? 0, spreePayConfig?.pointsConversionRatio);
@@ -1267,11 +1257,11 @@ var init_CheckoutButton = __esm({
1267
1257
  isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: onProcess && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { disabled: isDisabled, onClick: onProcess, className: checkoutClass, children: getCheckoutContent() }) }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1268
1258
  "a",
1269
1259
  {
1270
- href: `${staticConfig.keycloakUrl}/realms/${env.tenantId}/protocol/openid-connect/auth?client_id=${env.keycloakClientId ?? "oneof-next"}&response_type=code&redirect_uri=${window.location.href}`,
1260
+ href: `${staticConfig.keycloakUrl}/realms/${tenantId}/protocol/openid-connect/auth?client_id=${keycloakClientId ?? "oneof-next"}&response_type=code&redirect_uri=${window.location.href}`,
1271
1261
  className: checkoutClass,
1272
1262
  children: [
1273
1263
  "Log in / Sign up",
1274
- env.tenantId === "moca" ? " for an AIR account" : ""
1264
+ tenantId === "moca" ? " for an AIR account" : ""
1275
1265
  ]
1276
1266
  }
1277
1267
  ),
@@ -2314,7 +2304,7 @@ var init_useCryptoComPayment = __esm({
2314
2304
  cryptoComLogger = logger.child("crypto-com-payment");
2315
2305
  useCryptoComPayment = () => {
2316
2306
  const { selectedPaymentMethod } = useSpreePaymentMethod();
2317
- const { env } = useSpreePayEnv();
2307
+ const { redirect3dsURI } = useSpreePayEnv();
2318
2308
  const cryptoComPayment = async (params) => {
2319
2309
  if (selectedPaymentMethod.type !== "CDC" /* CDC */) {
2320
2310
  throw new Error("Unsupported payment method");
@@ -2326,8 +2316,8 @@ var init_useCryptoComPayment = __esm({
2326
2316
  metadata,
2327
2317
  type: "CDC" /* CDC */,
2328
2318
  cdc: {
2329
- returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}?payment_intent=success`,
2330
- cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}?payment_intent=canceled`
2319
+ returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}?payment_intent=success`,
2320
+ cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}?payment_intent=canceled`
2331
2321
  }
2332
2322
  });
2333
2323
  cryptoComLogger.info("Payment created", {
@@ -2529,7 +2519,7 @@ init_transactionFee();
2529
2519
  var cardPaymentLogger = logger.child("card-payment");
2530
2520
  var useCardPayment = () => {
2531
2521
  const { selectedPaymentMethod } = useSpreePaymentMethod();
2532
- const { env } = useSpreePayEnv();
2522
+ const { redirect3dsURI } = useSpreePayEnv();
2533
2523
  const { appProps } = useStaticConfig();
2534
2524
  const cardPayment = async (params) => {
2535
2525
  if (selectedPaymentMethod.type !== "CREDIT_CARD" /* CREDIT_CARD */ || !selectedPaymentMethod.method) {
@@ -2577,7 +2567,7 @@ var useCardPayment = () => {
2577
2567
  card: {
2578
2568
  cardId,
2579
2569
  transactionFee,
2580
- returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}`
2570
+ returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}`
2581
2571
  }
2582
2572
  });
2583
2573
  let { status } = paymentResData;
@@ -2907,7 +2897,7 @@ init_useSpreePayConfig();
2907
2897
  var splitPaymentLogger = logger.child("split-card-payment");
2908
2898
  var useSplitCardPayments = (mode = "web2") => {
2909
2899
  const { selectedPaymentMethod } = useSpreePaymentMethod();
2910
- const { env } = useSpreePayEnv();
2900
+ const { redirect3dsURI } = useSpreePayEnv();
2911
2901
  const { appProps } = useStaticConfig();
2912
2902
  const { spreePayConfig } = useSpreePayConfig();
2913
2903
  const splitPayment = async (params) => {
@@ -2947,7 +2937,7 @@ var useSplitCardPayments = (mode = "web2") => {
2947
2937
  card: {
2948
2938
  cardId,
2949
2939
  transactionFee,
2950
- returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}`
2940
+ returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}`
2951
2941
  },
2952
2942
  points: {
2953
2943
  amount: points
@@ -4500,7 +4490,7 @@ var SplitBlock = (props) => {
4500
4490
  const [address, setAddress] = (0, import_react11.useState)(null);
4501
4491
  const [walletReady, setWalletReady] = (0, import_react11.useState)(false);
4502
4492
  const { pointsConversionRatio, pointsTitle } = spreePayConfig || {};
4503
- const { env } = useSpreePayEnv();
4493
+ const { useWeb3Points, environment } = useSpreePayEnv();
4504
4494
  const prevPointsChainRef = (0, import_react11.useRef)(spreePayConfig?.pointsChain);
4505
4495
  const initWallet = (0, import_react11.useCallback)(
4506
4496
  async (pointsChain) => {
@@ -4509,7 +4499,7 @@ var SplitBlock = (props) => {
4509
4499
  const res = await getAirWallet({
4510
4500
  mocaChain: pointsChain.mocaChain,
4511
4501
  partnerId: pointsChain.partnerId,
4512
- buildEnv: env.environment === "prod" ? import_airkit2.BUILD_ENV.PRODUCTION : import_airkit2.BUILD_ENV.SANDBOX
4502
+ buildEnv: environment === "prod" ? import_airkit2.BUILD_ENV.PRODUCTION : import_airkit2.BUILD_ENV.SANDBOX
4513
4503
  });
4514
4504
  setAddress(res.address ?? null);
4515
4505
  setWalletReady(res.walletReady);
@@ -4519,14 +4509,14 @@ var SplitBlock = (props) => {
4519
4509
  } catch (e) {
4520
4510
  splitBlockLogger.error("Air Wallet initialization failed", e, {
4521
4511
  partnerId: pointsChain?.partnerId,
4522
- environment: env.environment
4512
+ environment
4523
4513
  });
4524
4514
  }
4525
4515
  },
4526
- [onToggle, env.environment]
4516
+ [onToggle, environment]
4527
4517
  );
4528
4518
  (0, import_react11.useEffect)(() => {
4529
- if (!env.useWeb3Points) return;
4519
+ if (!useWeb3Points) return;
4530
4520
  const pointsChainChanged = prevPointsChainRef.current !== spreePayConfig?.pointsChain;
4531
4521
  prevPointsChainRef.current = spreePayConfig?.pointsChain;
4532
4522
  const doInit = async () => {
@@ -4537,8 +4527,8 @@ var SplitBlock = (props) => {
4537
4527
  await initWallet(spreePayConfig?.pointsChain);
4538
4528
  };
4539
4529
  doInit();
4540
- }, [spreePayConfig?.pointsChain, initWallet, env.useWeb3Points]);
4541
- const isPointsSelectorDisabled = env.useWeb3Points ? !walletReady : false;
4530
+ }, [spreePayConfig?.pointsChain, initWallet, useWeb3Points]);
4531
+ const isPointsSelectorDisabled = useWeb3Points ? !walletReady : false;
4542
4532
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(PointsSelector, { isDisabled: isPointsSelectorDisabled, onSelect: () => onSelect("air"), isSelected, children: [
4543
4533
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-left text-xs font-medium text-(--brand-primary) sm:text-sm", children: [
4544
4534
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-(--secondary)", children: "Available" }),
@@ -4592,13 +4582,13 @@ var Points = () => {
4592
4582
  var import_jsx_runtime28 = require("react/jsx-runtime");
4593
4583
  var CreditCardTab = ({ isLoggedIn }) => {
4594
4584
  const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
4595
- const { env } = useSpreePayEnv();
4585
+ const { useWeb3Points } = useSpreePayEnv();
4596
4586
  const { appProps } = useStaticConfig();
4597
4587
  const { spreePayConfig } = useSpreePayConfig();
4598
4588
  const { register } = useSpreePayRegister();
4599
4589
  const { mutateCards } = useCards();
4600
4590
  const { mutateBalance } = useSlapiBalance();
4601
- const isWeb3Enabled = Boolean(env.useWeb3Points);
4591
+ const isWeb3Enabled = Boolean(useWeb3Points);
4602
4592
  const { cardPayment } = useCardPayment();
4603
4593
  const { splitPayment } = useSplitCardPayments(isWeb3Enabled ? "web3" : "web2");
4604
4594
  const { pointsPayment } = usePointsPayment(isWeb3Enabled ? "web3" : "web2");
@@ -4891,21 +4881,20 @@ var SpreePayInner = () => {
4891
4881
  const el = node.querySelector(":scope > .sl-spreepay__portal");
4892
4882
  setPortalEl(el ?? null);
4893
4883
  }, []);
4894
- const { env } = useSpreePayEnv();
4884
+ const { environment, tenantId, keycloakClientId, accessToken: envAccessToken, ssoPageURI } = useSpreePayEnv();
4895
4885
  (0, import_react21.useEffect)(() => {
4896
- configureLogger({ environment: env.environment });
4886
+ configureLogger({ environment });
4897
4887
  logger.logVersion();
4898
- }, [env.environment]);
4888
+ }, [environment]);
4899
4889
  const { staticConfig, appProps } = useStaticConfig();
4900
- const tenantId = env?.tenantId;
4901
4890
  const { isChecking, accessToken } = useKeycloakSSO({
4902
4891
  realm: tenantId,
4903
4892
  url: staticConfig.keycloakUrl,
4904
- clientId: env.keycloakClientId ?? "oneof-next",
4905
- ssoPageURI: env?.ssoPageURI,
4906
- enabled: !env?.accessToken
4893
+ clientId: keycloakClientId ?? "oneof-next",
4894
+ ssoPageURI,
4895
+ enabled: !envAccessToken
4907
4896
  });
4908
- const _accessToken = env.accessToken ?? accessToken;
4897
+ const _accessToken = envAccessToken ?? accessToken;
4909
4898
  const unauthenticatedFetcher = (0, import_react21.useCallback)(() => Promise.resolve(null), []);
4910
4899
  const slapiFetcher = (0, import_react21.useMemo)(() => {
4911
4900
  if (_accessToken) {
package/build/index.d.cts CHANGED
@@ -23,6 +23,7 @@ type ENV = {
23
23
  accessToken?: string;
24
24
  useWeb3Points?: boolean;
25
25
  keycloakClientId?: string;
26
+ origin?: string;
26
27
  };
27
28
 
28
29
  declare enum BASE_SYMBOLS {
package/build/index.d.ts CHANGED
@@ -23,6 +23,7 @@ type ENV = {
23
23
  accessToken?: string;
24
24
  useWeb3Points?: boolean;
25
25
  keycloakClientId?: string;
26
+ origin?: string;
26
27
  };
27
28
 
28
29
  declare enum BASE_SYMBOLS {
package/build/index.js CHANGED
@@ -8,10 +8,10 @@ import {
8
8
  getSplitAmount,
9
9
  getTransactionFee,
10
10
  useSlapiBalance
11
- } from "./chunk-ZPFV3WW6.js";
11
+ } from "./chunk-GO3SK2EV.js";
12
12
  import {
13
13
  Iframe3ds
14
- } from "./chunk-BSDEX662.js";
14
+ } from "./chunk-ER5YKU2O.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-6RZ4XF7B.js";
34
+ } from "./chunk-5FKBVNC4.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";
@@ -49,7 +49,7 @@ import NiceModal from "@ebay/nice-modal-react";
49
49
  var cardPaymentLogger = logger.child("card-payment");
50
50
  var useCardPayment = () => {
51
51
  const { selectedPaymentMethod } = useSpreePaymentMethod();
52
- const { env } = useSpreePayEnv();
52
+ const { redirect3dsURI } = useSpreePayEnv();
53
53
  const { appProps } = useStaticConfig();
54
54
  const cardPayment = async (params) => {
55
55
  if (selectedPaymentMethod.type !== "CREDIT_CARD" /* CREDIT_CARD */ || !selectedPaymentMethod.method) {
@@ -97,7 +97,7 @@ var useCardPayment = () => {
97
97
  card: {
98
98
  cardId,
99
99
  transactionFee,
100
- returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}`
100
+ returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}`
101
101
  }
102
102
  });
103
103
  let { status } = paymentResData;
@@ -408,7 +408,7 @@ import NiceModal3 from "@ebay/nice-modal-react";
408
408
  var splitPaymentLogger = logger.child("split-card-payment");
409
409
  var useSplitCardPayments = (mode = "web2") => {
410
410
  const { selectedPaymentMethod } = useSpreePaymentMethod();
411
- const { env } = useSpreePayEnv();
411
+ const { redirect3dsURI } = useSpreePayEnv();
412
412
  const { appProps } = useStaticConfig();
413
413
  const { spreePayConfig } = useSpreePayConfig();
414
414
  const splitPayment = async (params) => {
@@ -448,7 +448,7 @@ var useSplitCardPayments = (mode = "web2") => {
448
448
  card: {
449
449
  cardId,
450
450
  transactionFee,
451
- returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}`
451
+ returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}`
452
452
  },
453
453
  points: {
454
454
  amount: points
@@ -1967,7 +1967,7 @@ var SplitBlock = (props) => {
1967
1967
  const [address, setAddress] = useState7(null);
1968
1968
  const [walletReady, setWalletReady] = useState7(false);
1969
1969
  const { pointsConversionRatio, pointsTitle } = spreePayConfig || {};
1970
- const { env } = useSpreePayEnv();
1970
+ const { useWeb3Points, environment } = useSpreePayEnv();
1971
1971
  const prevPointsChainRef = useRef6(spreePayConfig?.pointsChain);
1972
1972
  const initWallet = useCallback4(
1973
1973
  async (pointsChain) => {
@@ -1976,7 +1976,7 @@ var SplitBlock = (props) => {
1976
1976
  const res = await getAirWallet({
1977
1977
  mocaChain: pointsChain.mocaChain,
1978
1978
  partnerId: pointsChain.partnerId,
1979
- buildEnv: env.environment === "prod" ? BUILD_ENV2.PRODUCTION : BUILD_ENV2.SANDBOX
1979
+ buildEnv: environment === "prod" ? BUILD_ENV2.PRODUCTION : BUILD_ENV2.SANDBOX
1980
1980
  });
1981
1981
  setAddress(res.address ?? null);
1982
1982
  setWalletReady(res.walletReady);
@@ -1986,14 +1986,14 @@ var SplitBlock = (props) => {
1986
1986
  } catch (e) {
1987
1987
  splitBlockLogger.error("Air Wallet initialization failed", e, {
1988
1988
  partnerId: pointsChain?.partnerId,
1989
- environment: env.environment
1989
+ environment
1990
1990
  });
1991
1991
  }
1992
1992
  },
1993
- [onToggle, env.environment]
1993
+ [onToggle, environment]
1994
1994
  );
1995
1995
  useEffect5(() => {
1996
- if (!env.useWeb3Points) return;
1996
+ if (!useWeb3Points) return;
1997
1997
  const pointsChainChanged = prevPointsChainRef.current !== spreePayConfig?.pointsChain;
1998
1998
  prevPointsChainRef.current = spreePayConfig?.pointsChain;
1999
1999
  const doInit = async () => {
@@ -2004,8 +2004,8 @@ var SplitBlock = (props) => {
2004
2004
  await initWallet(spreePayConfig?.pointsChain);
2005
2005
  };
2006
2006
  doInit();
2007
- }, [spreePayConfig?.pointsChain, initWallet, env.useWeb3Points]);
2008
- const isPointsSelectorDisabled = env.useWeb3Points ? !walletReady : false;
2007
+ }, [spreePayConfig?.pointsChain, initWallet, useWeb3Points]);
2008
+ const isPointsSelectorDisabled = useWeb3Points ? !walletReady : false;
2009
2009
  return /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxs7(PointsSelector, { isDisabled: isPointsSelectorDisabled, onSelect: () => onSelect("air"), isSelected, children: [
2010
2010
  /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ jsxs7("p", { className: "text-left text-xs font-medium text-(--brand-primary) sm:text-sm", children: [
2011
2011
  /* @__PURE__ */ jsx14("span", { className: "text-(--secondary)", children: "Available" }),
@@ -2059,13 +2059,13 @@ var Points = () => {
2059
2059
  import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
2060
2060
  var CreditCardTab = ({ isLoggedIn }) => {
2061
2061
  const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
2062
- const { env } = useSpreePayEnv();
2062
+ const { useWeb3Points } = useSpreePayEnv();
2063
2063
  const { appProps } = useStaticConfig();
2064
2064
  const { spreePayConfig } = useSpreePayConfig();
2065
2065
  const { register } = useSpreePayRegister();
2066
2066
  const { mutateCards } = useCards();
2067
2067
  const { mutateBalance } = useSlapiBalance();
2068
- const isWeb3Enabled = Boolean(env.useWeb3Points);
2068
+ const isWeb3Enabled = Boolean(useWeb3Points);
2069
2069
  const { cardPayment } = useCardPayment();
2070
2070
  const { splitPayment } = useSplitCardPayments(isWeb3Enabled ? "web3" : "web2");
2071
2071
  const { pointsPayment } = usePointsPayment(isWeb3Enabled ? "web3" : "web2");
@@ -2190,9 +2190,9 @@ var TabButtons = (props) => {
2190
2190
 
2191
2191
  // src/SpreePayContent.tsx
2192
2192
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
2193
- var CryptoTab = lazy(() => import("./CryptoTab-NTHHA7YO.js").then((module) => ({ default: module.CryptoTab })));
2193
+ var CryptoTab = lazy(() => import("./CryptoTab-PJIZU5AQ.js").then((module) => ({ default: module.CryptoTab })));
2194
2194
  var CryptoComTab = lazy(
2195
- () => import("./CryptoComTab-OW42JVO5.js").then((module) => ({ default: module.CryptoComTab }))
2195
+ () => import("./CryptoComTab-BZZUG4BL.js").then((module) => ({ default: module.CryptoComTab }))
2196
2196
  );
2197
2197
  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: [
2198
2198
  /* @__PURE__ */ jsx18("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-(--border-component-specific-card) border-t-(--brand-primary)" }),
@@ -2345,21 +2345,20 @@ var SpreePayInner = () => {
2345
2345
  const el = node.querySelector(":scope > .sl-spreepay__portal");
2346
2346
  setPortalEl(el ?? null);
2347
2347
  }, []);
2348
- const { env } = useSpreePayEnv();
2348
+ const { environment, tenantId, keycloakClientId, accessToken: envAccessToken, ssoPageURI } = useSpreePayEnv();
2349
2349
  useEffect8(() => {
2350
- configureLogger({ environment: env.environment });
2350
+ configureLogger({ environment });
2351
2351
  logger.logVersion();
2352
- }, [env.environment]);
2352
+ }, [environment]);
2353
2353
  const { staticConfig, appProps } = useStaticConfig();
2354
- const tenantId = env?.tenantId;
2355
2354
  const { isChecking, accessToken } = useKeycloakSSO({
2356
2355
  realm: tenantId,
2357
2356
  url: staticConfig.keycloakUrl,
2358
- clientId: env.keycloakClientId ?? "oneof-next",
2359
- ssoPageURI: env?.ssoPageURI,
2360
- enabled: !env?.accessToken
2357
+ clientId: keycloakClientId ?? "oneof-next",
2358
+ ssoPageURI,
2359
+ enabled: !envAccessToken
2361
2360
  });
2362
- const _accessToken = env.accessToken ?? accessToken;
2361
+ const _accessToken = envAccessToken ?? accessToken;
2363
2362
  const unauthenticatedFetcher = useCallback7(() => Promise.resolve(null), []);
2364
2363
  const slapiFetcher = useMemo7(() => {
2365
2364
  if (_accessToken) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superlogic/spree-pay",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Spree-pay React component and utilities",
5
5
  "private": false,
6
6
  "type": "module",