@superlogic/spree-pay 0.3.2 → 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 +37 -12
- package/build/{CryptoComTab-XPQRAAD5.js → CryptoComTab-BZZUG4BL.js} +5 -5
- package/build/{CryptoTab-VDQLJRGP.js → CryptoTab-PJIZU5AQ.js} +2 -2
- package/build/{chunk-QNXCPSL7.js → chunk-5FKBVNC4.js} +22 -33
- package/build/{chunk-256NJIJQ.js → chunk-ER5YKU2O.js} +1 -1
- package/build/{chunk-STFEOIP4.js → chunk-GO3SK2EV.js} +9 -6
- package/build/index.cjs +55 -63
- package/build/index.css +4 -0
- package/build/index.d.cts +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +25 -26
- package/package.json +1 -1
- package/src/styles/globals.css +0 -1
package/README.md
CHANGED
|
@@ -213,24 +213,49 @@ enum LogLevel {
|
|
|
213
213
|
|
|
214
214
|
## Theme Customization
|
|
215
215
|
|
|
216
|
-
|
|
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)
|
|
221
|
+
|
|
222
|
+
```css
|
|
223
|
+
.sl-spreepay {
|
|
224
|
+
--primary: #272e32;
|
|
225
|
+
--accent: #439ef4;
|
|
226
|
+
--s-default: #ffffff;
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Local/scoped override
|
|
231
|
+
|
|
232
|
+
**Option A:** Wrap SpreePay in a container with your own class:
|
|
217
233
|
|
|
218
234
|
```tsx
|
|
219
|
-
<div
|
|
220
|
-
style={
|
|
221
|
-
{
|
|
222
|
-
'--primary': '#your-color',
|
|
223
|
-
'--accent': '#your-accent',
|
|
224
|
-
'--s-default': '#your-surface-color',
|
|
225
|
-
// ... see packages/spree-pay/src/styles/globals.css for all 54 variables
|
|
226
|
-
} as React.CSSProperties
|
|
227
|
-
}
|
|
228
|
-
>
|
|
235
|
+
<div className="my-checkout">
|
|
229
236
|
<SpreePay {...props} />
|
|
230
237
|
</div>
|
|
238
|
+
|
|
239
|
+
<style>{`
|
|
240
|
+
.my-checkout .sl-spreepay {
|
|
241
|
+
--primary: #your-color;
|
|
242
|
+
--accent: #your-accent;
|
|
243
|
+
}
|
|
244
|
+
`}</style>
|
|
231
245
|
```
|
|
232
246
|
|
|
233
|
-
|
|
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
|
+
```
|
|
234
259
|
|
|
235
260
|
## Keycloak SSO page example (/silent-check-sso.html)
|
|
236
261
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Iframe3ds
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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 {
|
|
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 : ""}${
|
|
38
|
-
cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${
|
|
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-
|
|
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-
|
|
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.
|
|
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
|
|
228
|
+
return ctx.env;
|
|
229
229
|
};
|
|
230
230
|
var useSpreePayRegister = () => {
|
|
231
231
|
const ctx = useContext(SpreePayActionsContext);
|
|
@@ -256,8 +256,8 @@ var config = {
|
|
|
256
256
|
keycloakUrl: "https://auth.dev.umusicpassport.com"
|
|
257
257
|
},
|
|
258
258
|
cdc: {
|
|
259
|
-
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
260
|
-
keycloakUrl: "https://auth.
|
|
259
|
+
slapiUrl: "https://slapi.dev.travel.crypto.superlogic.com",
|
|
260
|
+
keycloakUrl: "https://auth.dev.travel.crypto.superlogic.com"
|
|
261
261
|
},
|
|
262
262
|
tria: {
|
|
263
263
|
slapiUrl: "https://slapi.dev.tria.superlogic.com",
|
|
@@ -282,8 +282,8 @@ var config = {
|
|
|
282
282
|
keycloakUrl: "https://auth.stg.umusicpassport.com"
|
|
283
283
|
},
|
|
284
284
|
cdc: {
|
|
285
|
-
slapiUrl: "https://slapi.stg.superlogic.com",
|
|
286
|
-
keycloakUrl: "https://auth.
|
|
285
|
+
slapiUrl: "https://slapi.stg.travel.crypto.superlogic.com",
|
|
286
|
+
keycloakUrl: "https://auth.stg.travel.crypto.superlogic.com"
|
|
287
287
|
},
|
|
288
288
|
tria: {
|
|
289
289
|
slapiUrl: "https://slapi.stg.tria.superlogic.com",
|
|
@@ -308,12 +308,12 @@ var config = {
|
|
|
308
308
|
keycloakUrl: "https://auth.umusicpassport.com"
|
|
309
309
|
},
|
|
310
310
|
cdc: {
|
|
311
|
-
slapiUrl: "https://slapi.
|
|
312
|
-
keycloakUrl: "https://auth.
|
|
311
|
+
slapiUrl: "https://slapi.travel.crypto.com",
|
|
312
|
+
keycloakUrl: "https://auth.travel.crypto.com"
|
|
313
313
|
},
|
|
314
314
|
tria: {
|
|
315
|
-
slapiUrl: "https://
|
|
316
|
-
keycloakUrl: "https://
|
|
315
|
+
slapiUrl: "https://slapi.travel.tria.so",
|
|
316
|
+
keycloakUrl: "https://auth.travel.tria.so"
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
};
|
|
@@ -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 {
|
|
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[
|
|
332
|
-
const isKnownTenant =
|
|
331
|
+
const envConfig = config[environment];
|
|
332
|
+
const isKnownTenant = tenantId in envConfig;
|
|
333
333
|
if (!isKnownTenant) {
|
|
334
|
-
logger.warn(`Unknown tenantId "${
|
|
335
|
-
tenantId
|
|
336
|
-
environment
|
|
334
|
+
logger.warn(`Unknown tenantId "${tenantId}", falling back to "moca"`, {
|
|
335
|
+
tenantId,
|
|
336
|
+
environment
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
|
-
const appKey = isKnownTenant ?
|
|
339
|
+
const appKey = isKnownTenant ? tenantId : "moca";
|
|
340
340
|
return envConfig[appKey];
|
|
341
|
-
}, [
|
|
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 {
|
|
469
|
-
|
|
470
|
-
|
|
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
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useSpreePayEnv,
|
|
7
7
|
useSpreePaymentMethod,
|
|
8
8
|
useStaticConfig
|
|
9
|
-
} from "./chunk-
|
|
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 {
|
|
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);
|
|
@@ -234,15 +234,18 @@ var CheckoutButton = ({ isLoggedIn }) => {
|
|
|
234
234
|
}
|
|
235
235
|
return "Checkout";
|
|
236
236
|
};
|
|
237
|
-
const checkoutClass = "text-(--inverse) h-14 w-full cursor-pointer rounded-4xl bg-(--s-brand) hover:bg-(--s-brand-hover) px-4 text-center text-xl leading-6 font-medium disabled:cursor-not-allowed disabled:bg-(--s-disabled) disabled:text-(--disabled)";
|
|
237
|
+
const checkoutClass = "text-(--inverse) h-14 leading-14 w-full cursor-pointer rounded-4xl bg-(--s-brand) hover:bg-(--s-brand-hover) px-4 text-center text-xl leading-6 font-medium disabled:cursor-not-allowed disabled:bg-(--s-disabled) disabled:text-(--disabled)";
|
|
238
238
|
return /* @__PURE__ */ jsxs3("div", { className: "flex w-full flex-col gap-4 p-6 text-xs leading-5 font-medium text-(--secondary) md:px-7", children: [
|
|
239
239
|
/* @__PURE__ */ jsx5(Legal, {}),
|
|
240
|
-
isLoggedIn ? /* @__PURE__ */ jsx5(Fragment, { children: onProcess && /* @__PURE__ */ jsx5("button", { disabled: isDisabled, onClick: onProcess, className: checkoutClass, children: getCheckoutContent() }) }) : /* @__PURE__ */
|
|
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/${
|
|
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
|
-
children:
|
|
245
|
+
children: [
|
|
246
|
+
"Log in / Sign up",
|
|
247
|
+
tenantId === "moca" ? " for an AIR account" : ""
|
|
248
|
+
]
|
|
246
249
|
}
|
|
247
250
|
),
|
|
248
251
|
/* @__PURE__ */ jsxs3("a", { href: "https://www.spree.finance/", className: "flex items-center justify-center gap-2 hover:underline", children: [
|
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.
|
|
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
|
|
288
|
+
return ctx.env;
|
|
289
289
|
};
|
|
290
290
|
useSpreePayRegister = () => {
|
|
291
291
|
const ctx = (0, import_react.useContext)(SpreePayActionsContext);
|
|
@@ -319,8 +319,8 @@ var init_config = __esm({
|
|
|
319
319
|
keycloakUrl: "https://auth.dev.umusicpassport.com"
|
|
320
320
|
},
|
|
321
321
|
cdc: {
|
|
322
|
-
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
323
|
-
keycloakUrl: "https://auth.
|
|
322
|
+
slapiUrl: "https://slapi.dev.travel.crypto.superlogic.com",
|
|
323
|
+
keycloakUrl: "https://auth.dev.travel.crypto.superlogic.com"
|
|
324
324
|
},
|
|
325
325
|
tria: {
|
|
326
326
|
slapiUrl: "https://slapi.dev.tria.superlogic.com",
|
|
@@ -345,8 +345,8 @@ var init_config = __esm({
|
|
|
345
345
|
keycloakUrl: "https://auth.stg.umusicpassport.com"
|
|
346
346
|
},
|
|
347
347
|
cdc: {
|
|
348
|
-
slapiUrl: "https://slapi.stg.superlogic.com",
|
|
349
|
-
keycloakUrl: "https://auth.
|
|
348
|
+
slapiUrl: "https://slapi.stg.travel.crypto.superlogic.com",
|
|
349
|
+
keycloakUrl: "https://auth.stg.travel.crypto.superlogic.com"
|
|
350
350
|
},
|
|
351
351
|
tria: {
|
|
352
352
|
slapiUrl: "https://slapi.stg.tria.superlogic.com",
|
|
@@ -371,12 +371,12 @@ var init_config = __esm({
|
|
|
371
371
|
keycloakUrl: "https://auth.umusicpassport.com"
|
|
372
372
|
},
|
|
373
373
|
cdc: {
|
|
374
|
-
slapiUrl: "https://slapi.
|
|
375
|
-
keycloakUrl: "https://auth.
|
|
374
|
+
slapiUrl: "https://slapi.travel.crypto.com",
|
|
375
|
+
keycloakUrl: "https://auth.travel.crypto.com"
|
|
376
376
|
},
|
|
377
377
|
tria: {
|
|
378
|
-
slapiUrl: "https://
|
|
379
|
-
keycloakUrl: "https://
|
|
378
|
+
slapiUrl: "https://slapi.travel.tria.so",
|
|
379
|
+
keycloakUrl: "https://auth.travel.tria.so"
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
};
|
|
@@ -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 {
|
|
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[
|
|
406
|
-
const isKnownTenant =
|
|
405
|
+
const envConfig = config[environment];
|
|
406
|
+
const isKnownTenant = tenantId in envConfig;
|
|
407
407
|
if (!isKnownTenant) {
|
|
408
|
-
logger.warn(`Unknown tenantId "${
|
|
409
|
-
tenantId
|
|
410
|
-
environment
|
|
408
|
+
logger.warn(`Unknown tenantId "${tenantId}", falling back to "moca"`, {
|
|
409
|
+
tenantId,
|
|
410
|
+
environment
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
|
-
const appKey = isKnownTenant ?
|
|
413
|
+
const appKey = isKnownTenant ? tenantId : "moca";
|
|
414
414
|
return envConfig[appKey];
|
|
415
|
-
}, [
|
|
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 {
|
|
872
|
-
|
|
873
|
-
|
|
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 {
|
|
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);
|
|
@@ -1261,15 +1251,18 @@ var init_CheckoutButton = __esm({
|
|
|
1261
1251
|
}
|
|
1262
1252
|
return "Checkout";
|
|
1263
1253
|
};
|
|
1264
|
-
const checkoutClass = "text-(--inverse) h-14 w-full cursor-pointer rounded-4xl bg-(--s-brand) hover:bg-(--s-brand-hover) px-4 text-center text-xl leading-6 font-medium disabled:cursor-not-allowed disabled:bg-(--s-disabled) disabled:text-(--disabled)";
|
|
1254
|
+
const checkoutClass = "text-(--inverse) h-14 leading-14 w-full cursor-pointer rounded-4xl bg-(--s-brand) hover:bg-(--s-brand-hover) px-4 text-center text-xl leading-6 font-medium disabled:cursor-not-allowed disabled:bg-(--s-disabled) disabled:text-(--disabled)";
|
|
1265
1255
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex w-full flex-col gap-4 p-6 text-xs leading-5 font-medium text-(--secondary) md:px-7", children: [
|
|
1266
1256
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Legal, {}),
|
|
1267
|
-
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.
|
|
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/${
|
|
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
|
-
children:
|
|
1262
|
+
children: [
|
|
1263
|
+
"Log in / Sign up",
|
|
1264
|
+
tenantId === "moca" ? " for an AIR account" : ""
|
|
1265
|
+
]
|
|
1273
1266
|
}
|
|
1274
1267
|
),
|
|
1275
1268
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("a", { href: "https://www.spree.finance/", className: "flex items-center justify-center gap-2 hover:underline", children: [
|
|
@@ -2311,7 +2304,7 @@ var init_useCryptoComPayment = __esm({
|
|
|
2311
2304
|
cryptoComLogger = logger.child("crypto-com-payment");
|
|
2312
2305
|
useCryptoComPayment = () => {
|
|
2313
2306
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
2314
|
-
const {
|
|
2307
|
+
const { redirect3dsURI } = useSpreePayEnv();
|
|
2315
2308
|
const cryptoComPayment = async (params) => {
|
|
2316
2309
|
if (selectedPaymentMethod.type !== "CDC" /* CDC */) {
|
|
2317
2310
|
throw new Error("Unsupported payment method");
|
|
@@ -2323,8 +2316,8 @@ var init_useCryptoComPayment = __esm({
|
|
|
2323
2316
|
metadata,
|
|
2324
2317
|
type: "CDC" /* CDC */,
|
|
2325
2318
|
cdc: {
|
|
2326
|
-
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${
|
|
2327
|
-
cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${
|
|
2319
|
+
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}?payment_intent=success`,
|
|
2320
|
+
cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}?payment_intent=canceled`
|
|
2328
2321
|
}
|
|
2329
2322
|
});
|
|
2330
2323
|
cryptoComLogger.info("Payment created", {
|
|
@@ -2526,7 +2519,7 @@ init_transactionFee();
|
|
|
2526
2519
|
var cardPaymentLogger = logger.child("card-payment");
|
|
2527
2520
|
var useCardPayment = () => {
|
|
2528
2521
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
2529
|
-
const {
|
|
2522
|
+
const { redirect3dsURI } = useSpreePayEnv();
|
|
2530
2523
|
const { appProps } = useStaticConfig();
|
|
2531
2524
|
const cardPayment = async (params) => {
|
|
2532
2525
|
if (selectedPaymentMethod.type !== "CREDIT_CARD" /* CREDIT_CARD */ || !selectedPaymentMethod.method) {
|
|
@@ -2574,7 +2567,7 @@ var useCardPayment = () => {
|
|
|
2574
2567
|
card: {
|
|
2575
2568
|
cardId,
|
|
2576
2569
|
transactionFee,
|
|
2577
|
-
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${
|
|
2570
|
+
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}`
|
|
2578
2571
|
}
|
|
2579
2572
|
});
|
|
2580
2573
|
let { status } = paymentResData;
|
|
@@ -2904,7 +2897,7 @@ init_useSpreePayConfig();
|
|
|
2904
2897
|
var splitPaymentLogger = logger.child("split-card-payment");
|
|
2905
2898
|
var useSplitCardPayments = (mode = "web2") => {
|
|
2906
2899
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
2907
|
-
const {
|
|
2900
|
+
const { redirect3dsURI } = useSpreePayEnv();
|
|
2908
2901
|
const { appProps } = useStaticConfig();
|
|
2909
2902
|
const { spreePayConfig } = useSpreePayConfig();
|
|
2910
2903
|
const splitPayment = async (params) => {
|
|
@@ -2944,7 +2937,7 @@ var useSplitCardPayments = (mode = "web2") => {
|
|
|
2944
2937
|
card: {
|
|
2945
2938
|
cardId,
|
|
2946
2939
|
transactionFee,
|
|
2947
|
-
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${
|
|
2940
|
+
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${redirect3dsURI}`
|
|
2948
2941
|
},
|
|
2949
2942
|
points: {
|
|
2950
2943
|
amount: points
|
|
@@ -4497,7 +4490,7 @@ var SplitBlock = (props) => {
|
|
|
4497
4490
|
const [address, setAddress] = (0, import_react11.useState)(null);
|
|
4498
4491
|
const [walletReady, setWalletReady] = (0, import_react11.useState)(false);
|
|
4499
4492
|
const { pointsConversionRatio, pointsTitle } = spreePayConfig || {};
|
|
4500
|
-
const {
|
|
4493
|
+
const { useWeb3Points, environment } = useSpreePayEnv();
|
|
4501
4494
|
const prevPointsChainRef = (0, import_react11.useRef)(spreePayConfig?.pointsChain);
|
|
4502
4495
|
const initWallet = (0, import_react11.useCallback)(
|
|
4503
4496
|
async (pointsChain) => {
|
|
@@ -4506,7 +4499,7 @@ var SplitBlock = (props) => {
|
|
|
4506
4499
|
const res = await getAirWallet({
|
|
4507
4500
|
mocaChain: pointsChain.mocaChain,
|
|
4508
4501
|
partnerId: pointsChain.partnerId,
|
|
4509
|
-
buildEnv:
|
|
4502
|
+
buildEnv: environment === "prod" ? import_airkit2.BUILD_ENV.PRODUCTION : import_airkit2.BUILD_ENV.SANDBOX
|
|
4510
4503
|
});
|
|
4511
4504
|
setAddress(res.address ?? null);
|
|
4512
4505
|
setWalletReady(res.walletReady);
|
|
@@ -4516,14 +4509,14 @@ var SplitBlock = (props) => {
|
|
|
4516
4509
|
} catch (e) {
|
|
4517
4510
|
splitBlockLogger.error("Air Wallet initialization failed", e, {
|
|
4518
4511
|
partnerId: pointsChain?.partnerId,
|
|
4519
|
-
environment
|
|
4512
|
+
environment
|
|
4520
4513
|
});
|
|
4521
4514
|
}
|
|
4522
4515
|
},
|
|
4523
|
-
[onToggle,
|
|
4516
|
+
[onToggle, environment]
|
|
4524
4517
|
);
|
|
4525
4518
|
(0, import_react11.useEffect)(() => {
|
|
4526
|
-
if (!
|
|
4519
|
+
if (!useWeb3Points) return;
|
|
4527
4520
|
const pointsChainChanged = prevPointsChainRef.current !== spreePayConfig?.pointsChain;
|
|
4528
4521
|
prevPointsChainRef.current = spreePayConfig?.pointsChain;
|
|
4529
4522
|
const doInit = async () => {
|
|
@@ -4534,8 +4527,8 @@ var SplitBlock = (props) => {
|
|
|
4534
4527
|
await initWallet(spreePayConfig?.pointsChain);
|
|
4535
4528
|
};
|
|
4536
4529
|
doInit();
|
|
4537
|
-
}, [spreePayConfig?.pointsChain, initWallet,
|
|
4538
|
-
const isPointsSelectorDisabled =
|
|
4530
|
+
}, [spreePayConfig?.pointsChain, initWallet, useWeb3Points]);
|
|
4531
|
+
const isPointsSelectorDisabled = useWeb3Points ? !walletReady : false;
|
|
4539
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: [
|
|
4540
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: [
|
|
4541
4534
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-(--secondary)", children: "Available" }),
|
|
@@ -4589,13 +4582,13 @@ var Points = () => {
|
|
|
4589
4582
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4590
4583
|
var CreditCardTab = ({ isLoggedIn }) => {
|
|
4591
4584
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
4592
|
-
const {
|
|
4585
|
+
const { useWeb3Points } = useSpreePayEnv();
|
|
4593
4586
|
const { appProps } = useStaticConfig();
|
|
4594
4587
|
const { spreePayConfig } = useSpreePayConfig();
|
|
4595
4588
|
const { register } = useSpreePayRegister();
|
|
4596
4589
|
const { mutateCards } = useCards();
|
|
4597
4590
|
const { mutateBalance } = useSlapiBalance();
|
|
4598
|
-
const isWeb3Enabled = Boolean(
|
|
4591
|
+
const isWeb3Enabled = Boolean(useWeb3Points);
|
|
4599
4592
|
const { cardPayment } = useCardPayment();
|
|
4600
4593
|
const { splitPayment } = useSplitCardPayments(isWeb3Enabled ? "web3" : "web2");
|
|
4601
4594
|
const { pointsPayment } = usePointsPayment(isWeb3Enabled ? "web3" : "web2");
|
|
@@ -4888,21 +4881,20 @@ var SpreePayInner = () => {
|
|
|
4888
4881
|
const el = node.querySelector(":scope > .sl-spreepay__portal");
|
|
4889
4882
|
setPortalEl(el ?? null);
|
|
4890
4883
|
}, []);
|
|
4891
|
-
const {
|
|
4884
|
+
const { environment, tenantId, keycloakClientId, accessToken: envAccessToken, ssoPageURI } = useSpreePayEnv();
|
|
4892
4885
|
(0, import_react21.useEffect)(() => {
|
|
4893
|
-
configureLogger({ environment
|
|
4886
|
+
configureLogger({ environment });
|
|
4894
4887
|
logger.logVersion();
|
|
4895
|
-
}, [
|
|
4888
|
+
}, [environment]);
|
|
4896
4889
|
const { staticConfig, appProps } = useStaticConfig();
|
|
4897
|
-
const tenantId = env?.tenantId;
|
|
4898
4890
|
const { isChecking, accessToken } = useKeycloakSSO({
|
|
4899
4891
|
realm: tenantId,
|
|
4900
4892
|
url: staticConfig.keycloakUrl,
|
|
4901
|
-
clientId:
|
|
4902
|
-
ssoPageURI
|
|
4903
|
-
enabled: !
|
|
4893
|
+
clientId: keycloakClientId ?? "oneof-next",
|
|
4894
|
+
ssoPageURI,
|
|
4895
|
+
enabled: !envAccessToken
|
|
4904
4896
|
});
|
|
4905
|
-
const _accessToken =
|
|
4897
|
+
const _accessToken = envAccessToken ?? accessToken;
|
|
4906
4898
|
const unauthenticatedFetcher = (0, import_react21.useCallback)(() => Promise.resolve(null), []);
|
|
4907
4899
|
const slapiFetcher = (0, import_react21.useMemo)(() => {
|
|
4908
4900
|
if (_accessToken) {
|
package/build/index.css
CHANGED
|
@@ -844,6 +844,10 @@
|
|
|
844
844
|
--tw-leading: calc(var(--spacing) * 9);
|
|
845
845
|
line-height: calc(var(--spacing) * 9);
|
|
846
846
|
}
|
|
847
|
+
.sl-spreepay .leading-14 {
|
|
848
|
+
--tw-leading: calc(var(--spacing) * 14);
|
|
849
|
+
line-height: calc(var(--spacing) * 14);
|
|
850
|
+
}
|
|
847
851
|
.sl-spreepay .leading-\[1\.3\] {
|
|
848
852
|
--tw-leading: 1.3;
|
|
849
853
|
line-height: 1.3;
|
package/build/index.d.cts
CHANGED
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
getSplitAmount,
|
|
9
9
|
getTransactionFee,
|
|
10
10
|
useSlapiBalance
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GO3SK2EV.js";
|
|
12
12
|
import {
|
|
13
13
|
Iframe3ds
|
|
14
|
-
} from "./chunk-
|
|
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-
|
|
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 {
|
|
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 : ""}${
|
|
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 {
|
|
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 : ""}${
|
|
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 {
|
|
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:
|
|
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
|
|
1989
|
+
environment
|
|
1990
1990
|
});
|
|
1991
1991
|
}
|
|
1992
1992
|
},
|
|
1993
|
-
[onToggle,
|
|
1993
|
+
[onToggle, environment]
|
|
1994
1994
|
);
|
|
1995
1995
|
useEffect5(() => {
|
|
1996
|
-
if (!
|
|
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,
|
|
2008
|
-
const isPointsSelectorDisabled =
|
|
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 {
|
|
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(
|
|
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-
|
|
2193
|
+
var CryptoTab = lazy(() => import("./CryptoTab-PJIZU5AQ.js").then((module) => ({ default: module.CryptoTab })));
|
|
2194
2194
|
var CryptoComTab = lazy(
|
|
2195
|
-
() => import("./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 {
|
|
2348
|
+
const { environment, tenantId, keycloakClientId, accessToken: envAccessToken, ssoPageURI } = useSpreePayEnv();
|
|
2349
2349
|
useEffect8(() => {
|
|
2350
|
-
configureLogger({ environment
|
|
2350
|
+
configureLogger({ environment });
|
|
2351
2351
|
logger.logVersion();
|
|
2352
|
-
}, [
|
|
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:
|
|
2359
|
-
ssoPageURI
|
|
2360
|
-
enabled: !
|
|
2357
|
+
clientId: keycloakClientId ?? "oneof-next",
|
|
2358
|
+
ssoPageURI,
|
|
2359
|
+
enabled: !envAccessToken
|
|
2361
2360
|
});
|
|
2362
|
-
const _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
package/src/styles/globals.css
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
@custom-variant dark (&:is(.dark *));
|
|
17
17
|
|
|
18
18
|
/* Default theme values in :root for standalone use.
|
|
19
|
-
These match the moca/bookit theme from live-tickets.
|
|
20
19
|
When used inside live-tickets, these are overridden by the host's :root variables. */
|
|
21
20
|
:root {
|
|
22
21
|
/* color / text-icons */
|