@superlogic/spree-pay 0.1.34 → 0.1.36
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 +1 -1
- package/build/index.cjs +434 -373
- package/build/index.css +133 -131
- package/build/index.d.cts +5 -2
- package/build/index.d.ts +5 -2
- package/build/index.js +478 -417
- package/package.json +19 -19
package/build/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/SpreePay.tsx
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo10, useState as useState14 } from "react";
|
|
3
|
+
import NiceModal8 from "@ebay/nice-modal-react";
|
|
4
4
|
import { SWRConfig } from "swr";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
|
-
var version = "0.1.
|
|
7
|
+
var version = "0.1.36";
|
|
8
8
|
|
|
9
9
|
// src/context/SpreePayActionsContext.tsx
|
|
10
10
|
import { createContext, useCallback, useContext, useRef, useState } from "react";
|
|
@@ -99,8 +99,9 @@ var useSpreePayRegister = () => {
|
|
|
99
99
|
|
|
100
100
|
// src/context/StaticConfigContext.tsx
|
|
101
101
|
import { createContext as createContext2, useContext as useContext2, useEffect, useMemo, useState as useState2 } from "react";
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
|
|
103
|
+
// src/context/config.ts
|
|
104
|
+
var config = {
|
|
104
105
|
dev: {
|
|
105
106
|
bookit: {
|
|
106
107
|
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
@@ -116,6 +117,16 @@ var CONFIG = {
|
|
|
116
117
|
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
117
118
|
keycloakUrl: "https://sso.dev.tickets.qiibeefoundation.org",
|
|
118
119
|
keycloakClientId: "oneof-next"
|
|
120
|
+
},
|
|
121
|
+
umhp: {
|
|
122
|
+
slapiUrl: "https://slapi.dev.umusicpassport.com",
|
|
123
|
+
keycloakUrl: "https://auth.dev.umusicpassport.com",
|
|
124
|
+
keycloakClientId: "oneof-next"
|
|
125
|
+
},
|
|
126
|
+
cdc: {
|
|
127
|
+
slapiUrl: "https://slapi.dev.superlogic.com",
|
|
128
|
+
keycloakUrl: "https://auth.dev02.superlogic.com",
|
|
129
|
+
keycloakClientId: "oneof-next"
|
|
119
130
|
}
|
|
120
131
|
},
|
|
121
132
|
stg: {
|
|
@@ -133,6 +144,16 @@ var CONFIG = {
|
|
|
133
144
|
slapiUrl: "https://slapi.stg.tickets.qiibeefoundation.org",
|
|
134
145
|
keycloakUrl: "https://sso.stg.tickets.qiibeefoundation.org",
|
|
135
146
|
keycloakClientId: "oneof-next"
|
|
147
|
+
},
|
|
148
|
+
umhp: {
|
|
149
|
+
slapiUrl: "https://slapi.stg.umusicpassport.com",
|
|
150
|
+
keycloakUrl: "https://auth.stg.umusicpassport.com",
|
|
151
|
+
keycloakClientId: "oneof-next"
|
|
152
|
+
},
|
|
153
|
+
cdc: {
|
|
154
|
+
slapiUrl: "https://slapi.stg.superlogic.com",
|
|
155
|
+
keycloakUrl: "https://auth.stg02.superlogic.com",
|
|
156
|
+
keycloakClientId: "oneof-next"
|
|
136
157
|
}
|
|
137
158
|
},
|
|
138
159
|
prod: {
|
|
@@ -150,9 +171,22 @@ var CONFIG = {
|
|
|
150
171
|
slapiUrl: "https://slapi.tickets.qiibeefoundation.org",
|
|
151
172
|
keycloakUrl: "https://sso.tickets.qiibeefoundation.org",
|
|
152
173
|
keycloakClientId: "oneof-next"
|
|
174
|
+
},
|
|
175
|
+
umhp: {
|
|
176
|
+
slapiUrl: "https://slapi.umusicpassport.com",
|
|
177
|
+
keycloakUrl: "https://auth.umusicpassport.com",
|
|
178
|
+
keycloakClientId: "oneof-next"
|
|
179
|
+
},
|
|
180
|
+
cdc: {
|
|
181
|
+
slapiUrl: "https://slapi.superlogic.com",
|
|
182
|
+
keycloakUrl: "https://auth.superlogic.com",
|
|
183
|
+
keycloakClientId: "oneof-next"
|
|
153
184
|
}
|
|
154
185
|
}
|
|
155
186
|
};
|
|
187
|
+
|
|
188
|
+
// src/context/StaticConfigContext.tsx
|
|
189
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
156
190
|
var StaticConfigContext = createContext2(null);
|
|
157
191
|
var StaticConfigProvider = ({ children, props }) => {
|
|
158
192
|
const { env } = useSpreePayEnv();
|
|
@@ -161,8 +195,12 @@ var StaticConfigProvider = ({ children, props }) => {
|
|
|
161
195
|
setAppProps(props);
|
|
162
196
|
}, [props]);
|
|
163
197
|
const staticConfig = useMemo(() => {
|
|
164
|
-
const envConfig =
|
|
165
|
-
const
|
|
198
|
+
const envConfig = config[env.environment];
|
|
199
|
+
const isKnownTenant = env.tenantId in envConfig;
|
|
200
|
+
if (!isKnownTenant) {
|
|
201
|
+
console.warn(`[spree-pay] Unknown tenantId "${env.tenantId}", falling back to "moca"`);
|
|
202
|
+
}
|
|
203
|
+
const appKey = isKnownTenant ? env.tenantId : "moca";
|
|
166
204
|
return envConfig[appKey];
|
|
167
205
|
}, [env.environment, env.tenantId]);
|
|
168
206
|
return /* @__PURE__ */ jsx2(StaticConfigContext.Provider, { value: { staticConfig, appProps }, children });
|
|
@@ -330,50 +368,38 @@ var CheckoutButton = ({ isLoggedIn }) => {
|
|
|
330
368
|
}
|
|
331
369
|
return "Checkout";
|
|
332
370
|
};
|
|
333
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col
|
|
334
|
-
/* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col gap-4 bg-white p-6 text-xs font-medium text-[#45505B] md:px-7", children: [
|
|
372
|
+
/* @__PURE__ */ jsxs2("p", { className: "text-center", children: [
|
|
335
373
|
"By clicking on the button below I acknowledge that I have read and accepted the",
|
|
336
374
|
" ",
|
|
337
375
|
/* @__PURE__ */ jsx4("a", { className: "underline", href: spreePayConfig?.termsConditionsUrl, target: "_blank", rel: "noreferrer", children: "Terms and Conditions" }),
|
|
338
376
|
"."
|
|
339
|
-
] })
|
|
377
|
+
] }),
|
|
340
378
|
isLoggedIn ? /* @__PURE__ */ jsx4(Fragment, { children: onProcess && /* @__PURE__ */ jsx4(
|
|
341
379
|
"button",
|
|
342
380
|
{
|
|
343
381
|
disabled: isDisabled,
|
|
344
382
|
onClick: onProcess,
|
|
345
|
-
className: "bg-primary
|
|
383
|
+
className: "bg-primary w-full cursor-pointer rounded-4xl p-4 text-xl leading-6 font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
346
384
|
children: getCheckoutContent()
|
|
347
385
|
}
|
|
348
386
|
) }) : /* @__PURE__ */ jsx4(
|
|
349
387
|
"a",
|
|
350
388
|
{
|
|
351
389
|
href: `${staticConfig.keycloakUrl}/realms/${env.tenantId}/protocol/openid-connect/auth?client_id=${staticConfig.keycloakClientId}&response_type=code&redirect_uri=${window.location.href}`,
|
|
352
|
-
className: "bg-primary
|
|
390
|
+
className: "bg-primary w-full cursor-pointer rounded-4xl p-4 text-center text-xl leading-6 font-medium text-white disabled:cursor-not-allowed disabled:opacity-50",
|
|
353
391
|
children: "Log in / Sign up for an AIR account"
|
|
354
392
|
}
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
{
|
|
366
|
-
fill: "#000",
|
|
367
|
-
fillOpacity: ".5",
|
|
368
|
-
d: "M57.79 25.48a4.82 4.82 0 0 1-1.55-.25l.55-1.86c.34.1.65.15.92.15s.51-.1.72-.26c.21-.16.39-.43.53-.81l.2-.55-3.65-10.3h2.52l2.32 7.62h.1l2.34-7.62h2.53l-4.04 11.31c-.19.54-.44 1-.75 1.38-.31.38-.7.68-1.14.88-.45.2-.98.3-1.6.3ZM48.95 21.9a4.2 4.2 0 0 1-1.73-.35c-.5-.23-.9-.57-1.2-1.02a3 3 0 0 1-.44-1.67 2.44 2.44 0 0 1 1.18-2.3c.35-.23.76-.4 1.22-.5.46-.13.93-.21 1.42-.27l1.44-.16c.37-.05.64-.13.8-.24.18-.1.26-.27.26-.5v-.04c0-.5-.15-.88-.44-1.15-.3-.27-.72-.4-1.27-.4-.58 0-1.04.12-1.38.37-.34.26-.57.56-.69.9l-2.22-.31a3.54 3.54 0 0 1 2.35-2.47 6.29 6.29 0 0 1 3.38-.14c.48.1.92.3 1.32.56.4.26.72.6.96 1.06.25.44.37 1 .37 1.67v6.75h-2.29v-1.38h-.08a2.9 2.9 0 0 1-1.59 1.37c-.39.14-.84.22-1.37.22Zm.62-1.75c.48 0 .89-.1 1.24-.28.35-.2.62-.45.8-.77.2-.31.3-.65.3-1.03V16.9c-.08.06-.2.11-.38.17a18.34 18.34 0 0 1-1.8.32c-.36.05-.68.12-.96.23-.28.11-.5.27-.66.46-.16.2-.24.45-.24.75 0 .44.16.77.48 1 .32.22.72.33 1.22.33ZM34.43 21.7V8.23h5.05c1.03 0 1.9.2 2.6.58.7.38 1.23.91 1.6 1.59.36.67.54 1.43.54 2.28 0 .87-.18 1.63-.55 2.3a3.9 3.9 0 0 1-1.6 1.59c-.72.38-1.59.57-2.63.57H36.1v-2h3.01c.6 0 1.1-.11 1.49-.32.38-.21.67-.5.85-.87.2-.37.29-.79.29-1.27 0-.47-.1-.9-.29-1.26a1.92 1.92 0 0 0-.86-.84c-.38-.2-.88-.31-1.49-.31h-2.23v11.41h-2.44ZM14.54.46a14.54 14.54 0 1 1 0 29.08 14.54 14.54 0 0 1 0-29.08ZM5.59 18.12l-.84 3.35h.83l.84-3.35h-.83Zm1.66 0-.83 3.35h1.66l.84-3.35H7.25Zm3.35-9.58c-1.03 0-2.08.84-2.34 1.87l-1.1 4.4c-.26 1.03.37 1.87 1.4 1.87h9.64l-.34 1.44h-8.1l-.85 3.35h9.6c1.04 0 2.1-.85 2.35-1.89l1.05-4.4c.25-1.03-.38-1.85-1.4-1.85h-9.63l.36-1.44h8.13l.84-3.35H10.6Zm10.44 0-.84 3.35h1.67l.83-3.35h-1.66Zm2.5 0-.84 3.35h.83l.84-3.35h-.83Z"
|
|
369
|
-
}
|
|
370
|
-
) }),
|
|
371
|
-
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-black/50", children: [
|
|
372
|
-
"Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
|
|
373
|
-
" ",
|
|
374
|
-
/* @__PURE__ */ jsx5("a", { className: "underline", href: "https://www.spree.finance/", target: "_blank", rel: "noreferrer", children: "Learn more" }),
|
|
375
|
-
" ",
|
|
376
|
-
"about Spree."
|
|
393
|
+
),
|
|
394
|
+
/* @__PURE__ */ jsxs2("a", { href: "https://www.spree.finance/", className: "flex items-center justify-center gap-2 hover:underline", children: [
|
|
395
|
+
/* @__PURE__ */ jsx4("p", { children: "Powered by" }),
|
|
396
|
+
/* @__PURE__ */ jsx4("svg", { className: "shrink-0", xmlns: "http://www.w3.org/2000/svg", width: "66", height: "30", fill: "none", children: /* @__PURE__ */ jsx4(
|
|
397
|
+
"path",
|
|
398
|
+
{
|
|
399
|
+
fill: "currentColor",
|
|
400
|
+
d: "M57.79 25.48a4.82 4.82 0 0 1-1.55-.25l.55-1.86c.34.1.65.15.92.15s.51-.1.72-.26c.21-.16.39-.43.53-.81l.2-.55-3.65-10.3h2.52l2.32 7.62h.1l2.34-7.62h2.53l-4.04 11.31c-.19.54-.44 1-.75 1.38-.31.38-.7.68-1.14.88-.45.2-.98.3-1.6.3ZM48.95 21.9a4.2 4.2 0 0 1-1.73-.35c-.5-.23-.9-.57-1.2-1.02a3 3 0 0 1-.44-1.67 2.44 2.44 0 0 1 1.18-2.3c.35-.23.76-.4 1.22-.5.46-.13.93-.21 1.42-.27l1.44-.16c.37-.05.64-.13.8-.24.18-.1.26-.27.26-.5v-.04c0-.5-.15-.88-.44-1.15-.3-.27-.72-.4-1.27-.4-.58 0-1.04.12-1.38.37-.34.26-.57.56-.69.9l-2.22-.31a3.54 3.54 0 0 1 2.35-2.47 6.29 6.29 0 0 1 3.38-.14c.48.1.92.3 1.32.56.4.26.72.6.96 1.06.25.44.37 1 .37 1.67v6.75h-2.29v-1.38h-.08a2.9 2.9 0 0 1-1.59 1.37c-.39.14-.84.22-1.37.22Zm.62-1.75c.48 0 .89-.1 1.24-.28.35-.2.62-.45.8-.77.2-.31.3-.65.3-1.03V16.9c-.08.06-.2.11-.38.17a18.34 18.34 0 0 1-1.8.32c-.36.05-.68.12-.96.23-.28.11-.5.27-.66.46-.16.2-.24.45-.24.75 0 .44.16.77.48 1 .32.22.72.33 1.22.33ZM34.43 21.7V8.23h5.05c1.03 0 1.9.2 2.6.58.7.38 1.23.91 1.6 1.59.36.67.54 1.43.54 2.28 0 .87-.18 1.63-.55 2.3a3.9 3.9 0 0 1-1.6 1.59c-.72.38-1.59.57-2.63.57H36.1v-2h3.01c.6 0 1.1-.11 1.49-.32.38-.21.67-.5.85-.87.2-.37.29-.79.29-1.27 0-.47-.1-.9-.29-1.26a1.92 1.92 0 0 0-.86-.84c-.38-.2-.88-.31-1.49-.31h-2.23v11.41h-2.44ZM14.54.46a14.54 14.54 0 1 1 0 29.08 14.54 14.54 0 0 1 0-29.08ZM5.59 18.12l-.84 3.35h.83l.84-3.35h-.83Zm1.66 0-.83 3.35h1.66l.84-3.35H7.25Zm3.35-9.58c-1.03 0-2.08.84-2.34 1.87l-1.1 4.4c-.26 1.03.37 1.87 1.4 1.87h9.64l-.34 1.44h-8.1l-.85 3.35h9.6c1.04 0 2.1-.85 2.35-1.89l1.05-4.4c.25-1.03-.38-1.85-1.4-1.85h-9.63l.36-1.44h8.13l.84-3.35H10.6Zm10.44 0-.84 3.35h1.67l.83-3.35h-1.66Zm2.5 0-.84 3.35h.83l.84-3.35h-.83Z"
|
|
401
|
+
}
|
|
402
|
+
) })
|
|
377
403
|
] })
|
|
378
404
|
] });
|
|
379
405
|
};
|
|
@@ -420,17 +446,17 @@ function usePortalContainer() {
|
|
|
420
446
|
}
|
|
421
447
|
|
|
422
448
|
// src/ui/dialog.tsx
|
|
423
|
-
import { jsx as
|
|
449
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
424
450
|
function Dialog({ ...props }) {
|
|
425
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
426
452
|
}
|
|
427
453
|
function DialogPortal({ ...props }) {
|
|
428
454
|
const container = usePortalContainer();
|
|
429
455
|
const safeContainer = container && document.body.contains(container) ? container : void 0;
|
|
430
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Portal, { container: safeContainer, "data-slot": "dialog-portal", ...props });
|
|
431
457
|
}
|
|
432
458
|
function DialogOverlay({ className, ...props }) {
|
|
433
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ jsx5(
|
|
434
460
|
DialogPrimitive.Overlay,
|
|
435
461
|
{
|
|
436
462
|
"data-slot": "dialog-overlay",
|
|
@@ -448,9 +474,9 @@ function DialogContent({
|
|
|
448
474
|
showCloseButton = true,
|
|
449
475
|
...props
|
|
450
476
|
}) {
|
|
451
|
-
return /* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
/* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ jsxs3(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
478
|
+
/* @__PURE__ */ jsx5(DialogOverlay, {}),
|
|
479
|
+
/* @__PURE__ */ jsxs3(
|
|
454
480
|
DialogPrimitive.Content,
|
|
455
481
|
{
|
|
456
482
|
"data-slot": "dialog-content",
|
|
@@ -461,14 +487,14 @@ function DialogContent({
|
|
|
461
487
|
...props,
|
|
462
488
|
children: [
|
|
463
489
|
children,
|
|
464
|
-
showCloseButton && /* @__PURE__ */
|
|
490
|
+
showCloseButton && /* @__PURE__ */ jsxs3(
|
|
465
491
|
DialogPrimitive.Close,
|
|
466
492
|
{
|
|
467
493
|
"data-slot": "dialog-close",
|
|
468
494
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
469
495
|
children: [
|
|
470
|
-
/* @__PURE__ */
|
|
471
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsx5(XIcon, {}),
|
|
497
|
+
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Close" })
|
|
472
498
|
]
|
|
473
499
|
}
|
|
474
500
|
)
|
|
@@ -478,7 +504,7 @@ function DialogContent({
|
|
|
478
504
|
] });
|
|
479
505
|
}
|
|
480
506
|
function DialogTitle({ className, ...props }) {
|
|
481
|
-
return /* @__PURE__ */
|
|
507
|
+
return /* @__PURE__ */ jsx5(
|
|
482
508
|
DialogPrimitive.Title,
|
|
483
509
|
{
|
|
484
510
|
"data-slot": "dialog-title",
|
|
@@ -488,7 +514,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
488
514
|
);
|
|
489
515
|
}
|
|
490
516
|
function DialogDescription({ className, ...props }) {
|
|
491
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ jsx5(
|
|
492
518
|
DialogPrimitive.Description,
|
|
493
519
|
{
|
|
494
520
|
"data-slot": "dialog-description",
|
|
@@ -499,7 +525,7 @@ function DialogDescription({ className, ...props }) {
|
|
|
499
525
|
}
|
|
500
526
|
|
|
501
527
|
// src/modals/Iframe3ds.tsx
|
|
502
|
-
import { jsx as
|
|
528
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
503
529
|
var Iframe3ds = NiceModal.create(({ url }) => {
|
|
504
530
|
const modal = useModal();
|
|
505
531
|
useEffect2(() => {
|
|
@@ -512,9 +538,9 @@ var Iframe3ds = NiceModal.create(({ url }) => {
|
|
|
512
538
|
modal.reject();
|
|
513
539
|
modal.remove();
|
|
514
540
|
};
|
|
515
|
-
return /* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
541
|
+
return /* @__PURE__ */ jsx6(Dialog, { open: modal.visible, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs4(DialogContent, { className: "max-h-[600px] w-full max-w-[680px] p-0", children: [
|
|
542
|
+
/* @__PURE__ */ jsx6(DialogTitle, { className: "hidden", children: "3D Secure Verification" }),
|
|
543
|
+
/* @__PURE__ */ jsx6("iframe", { src: url, id: "3ds-iframe", title: "3D Secure Checkout", className: "h-[500px] w-full rounded-lg border-0" })
|
|
518
544
|
] }) });
|
|
519
545
|
});
|
|
520
546
|
Iframe3ds.displayName = "Iframe3ds";
|
|
@@ -585,10 +611,10 @@ var slapiApi = {
|
|
|
585
611
|
throw new Error("slapiApi is not configured. Call registerApi(...) first.");
|
|
586
612
|
}
|
|
587
613
|
};
|
|
588
|
-
var registerApi = (
|
|
589
|
-
cfg.baseUrl =
|
|
590
|
-
cfg.accessToken =
|
|
591
|
-
cfg.tenantId =
|
|
614
|
+
var registerApi = (config2) => {
|
|
615
|
+
cfg.baseUrl = config2.baseUrl;
|
|
616
|
+
cfg.accessToken = config2.accessToken;
|
|
617
|
+
cfg.tenantId = config2.tenantId;
|
|
592
618
|
slapiApi = {
|
|
593
619
|
get: async (key) => {
|
|
594
620
|
const url = buildUrl(key);
|
|
@@ -878,6 +904,7 @@ var usePointsPayment = (mode = "web2") => {
|
|
|
878
904
|
};
|
|
879
905
|
|
|
880
906
|
// src/hooks/payments/useSplitCardPayments.ts
|
|
907
|
+
import NiceModal4 from "@ebay/nice-modal-react";
|
|
881
908
|
var useSplitCardPayments = (mode = "web2") => {
|
|
882
909
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
883
910
|
const { env } = useSpreePayEnv();
|
|
@@ -912,6 +939,12 @@ var useSplitCardPayments = (mode = "web2") => {
|
|
|
912
939
|
amount: points
|
|
913
940
|
}
|
|
914
941
|
});
|
|
942
|
+
if (paymentResData.redirectUrl) {
|
|
943
|
+
const paymentIntent = await NiceModal4.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
944
|
+
if (paymentIntent) {
|
|
945
|
+
await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
946
|
+
}
|
|
947
|
+
}
|
|
915
948
|
const cardStatus = await longPollCardStatus(paymentResData.id);
|
|
916
949
|
if (mode === "web3") {
|
|
917
950
|
const wallet = peekAirWallet();
|
|
@@ -974,7 +1007,7 @@ import { Elements } from "@stripe/react-stripe-js";
|
|
|
974
1007
|
import { loadStripe } from "@stripe/stripe-js";
|
|
975
1008
|
|
|
976
1009
|
// src/components/CreditCardTab/CreditCard/CardsList.tsx
|
|
977
|
-
import { jsx as
|
|
1010
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
978
1011
|
var isRemoveDisabled = true;
|
|
979
1012
|
var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
980
1013
|
const handleSelect = () => {
|
|
@@ -984,30 +1017,33 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
984
1017
|
e.stopPropagation();
|
|
985
1018
|
if (isSelected || isRemoveDisabled) return;
|
|
986
1019
|
};
|
|
987
|
-
return /* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
1020
|
+
return /* @__PURE__ */ jsxs5("button", { type: "button", onClick: handleSelect, className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-sm", children: [
|
|
1021
|
+
/* @__PURE__ */ jsx7(
|
|
989
1022
|
"div",
|
|
990
1023
|
{
|
|
991
1024
|
className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
|
|
992
1025
|
"bg-primary": isSelected
|
|
993
1026
|
}),
|
|
994
|
-
children: /* @__PURE__ */
|
|
1027
|
+
children: /* @__PURE__ */ jsx7("div", { className: "flex size-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ jsx7("div", { className: "bg-primary size-2.5 rounded-full" }) })
|
|
995
1028
|
}
|
|
996
1029
|
),
|
|
997
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ jsxs5(
|
|
998
1031
|
"div",
|
|
999
1032
|
{
|
|
1000
|
-
className: cn(
|
|
1001
|
-
"border-
|
|
1002
|
-
|
|
1033
|
+
className: cn(
|
|
1034
|
+
"flex h-full w-full items-center justify-between rounded-r-sm border border-l-0! border-transparent px-3",
|
|
1035
|
+
{
|
|
1036
|
+
"border-primary": isSelected
|
|
1037
|
+
}
|
|
1038
|
+
),
|
|
1003
1039
|
children: [
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ jsx7("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx7("p", { className: "text-sm font-medium text-black", children: card.schema }) }),
|
|
1041
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
1042
|
+
/* @__PURE__ */ jsxs5("p", { className: "text-sm font-medium text-black/50", children: [
|
|
1007
1043
|
"Ending in ",
|
|
1008
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx7("span", { className: "text-black", children: card.lastFourNumbers })
|
|
1009
1045
|
] }),
|
|
1010
|
-
/* @__PURE__ */
|
|
1046
|
+
/* @__PURE__ */ jsx7(
|
|
1011
1047
|
"div",
|
|
1012
1048
|
{
|
|
1013
1049
|
onClick: handleRemoveCard,
|
|
@@ -1015,9 +1051,9 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
1015
1051
|
"cursor-not-allowed opacity-50": isSelected || isRemoveDisabled
|
|
1016
1052
|
// 'cursor-pointer': !isSelected || !isRemoveDisabled,
|
|
1017
1053
|
}),
|
|
1018
|
-
children: /* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1054
|
+
children: /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "none", children: [
|
|
1055
|
+
/* @__PURE__ */ jsx7("mask", { id: "mask0_188_5407", width: "20", height: "21", x: "0", y: "-1", maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ jsx7("path", { fill: "#D9D9D9", d: "M0-.5h20v20H0z" }) }),
|
|
1056
|
+
/* @__PURE__ */ jsx7("g", { mask: "url(#mask0_188_5407)", children: /* @__PURE__ */ jsx7(
|
|
1021
1057
|
"path",
|
|
1022
1058
|
{
|
|
1023
1059
|
fill: "#000",
|
|
@@ -1037,13 +1073,13 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
1037
1073
|
var CardsList = ({ selectedCard, setCard }) => {
|
|
1038
1074
|
const { cards, cardsIsLoading } = useCards();
|
|
1039
1075
|
if (cardsIsLoading) {
|
|
1040
|
-
return /* @__PURE__ */
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1076
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex w-full flex-col gap-1", children: [
|
|
1077
|
+
/* @__PURE__ */ jsx7("div", { className: "bg-primary/8 h-11 animate-pulse rounded-sm" }),
|
|
1078
|
+
/* @__PURE__ */ jsx7("div", { className: "bg-primary/8 h-11 animate-pulse rounded-sm" })
|
|
1043
1079
|
] });
|
|
1044
1080
|
}
|
|
1045
1081
|
if (cards.length === 0) return null;
|
|
1046
|
-
return /* @__PURE__ */
|
|
1082
|
+
return /* @__PURE__ */ jsx7("div", { className: "flex w-full flex-col gap-1", children: cards.map((card) => /* @__PURE__ */ jsx7(CardListItem, { isSelected: selectedCard?.id === card.id, onSelect: setCard, card }, card.id)) });
|
|
1047
1083
|
};
|
|
1048
1084
|
|
|
1049
1085
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
@@ -1053,7 +1089,7 @@ import { CardCvcElement, CardExpiryElement, CardNumberElement, useElements, useS
|
|
|
1053
1089
|
// src/ui/button.tsx
|
|
1054
1090
|
import { Slot } from "@radix-ui/react-slot";
|
|
1055
1091
|
import { cva } from "class-variance-authority";
|
|
1056
|
-
import { jsx as
|
|
1092
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1057
1093
|
var buttonVariants = cva(
|
|
1058
1094
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
1059
1095
|
{
|
|
@@ -1088,15 +1124,15 @@ function Button({
|
|
|
1088
1124
|
...props
|
|
1089
1125
|
}) {
|
|
1090
1126
|
const Comp = asChild ? Slot : "button";
|
|
1091
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ jsx8(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props });
|
|
1092
1128
|
}
|
|
1093
1129
|
|
|
1094
1130
|
// src/ui/checkbox.tsx
|
|
1095
1131
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
1096
1132
|
import { CheckIcon } from "lucide-react";
|
|
1097
|
-
import { jsx as
|
|
1133
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1098
1134
|
function Checkbox({ className, ...props }) {
|
|
1099
|
-
return /* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ jsx9(
|
|
1100
1136
|
CheckboxPrimitive.Root,
|
|
1101
1137
|
{
|
|
1102
1138
|
"data-slot": "checkbox",
|
|
@@ -1105,12 +1141,12 @@ function Checkbox({ className, ...props }) {
|
|
|
1105
1141
|
className
|
|
1106
1142
|
),
|
|
1107
1143
|
...props,
|
|
1108
|
-
children: /* @__PURE__ */
|
|
1144
|
+
children: /* @__PURE__ */ jsx9(
|
|
1109
1145
|
CheckboxPrimitive.Indicator,
|
|
1110
1146
|
{
|
|
1111
1147
|
"data-slot": "checkbox-indicator",
|
|
1112
1148
|
className: "flex items-center justify-center text-current transition-none",
|
|
1113
|
-
children: /* @__PURE__ */
|
|
1149
|
+
children: /* @__PURE__ */ jsx9(CheckIcon, { className: "size-3.5 text-white" })
|
|
1114
1150
|
}
|
|
1115
1151
|
)
|
|
1116
1152
|
}
|
|
@@ -1119,9 +1155,9 @@ function Checkbox({ className, ...props }) {
|
|
|
1119
1155
|
|
|
1120
1156
|
// src/ui/label.tsx
|
|
1121
1157
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
1122
|
-
import { jsx as
|
|
1158
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1123
1159
|
function Label({ className, ...props }) {
|
|
1124
|
-
return /* @__PURE__ */
|
|
1160
|
+
return /* @__PURE__ */ jsx10(
|
|
1125
1161
|
LabelPrimitive.Root,
|
|
1126
1162
|
{
|
|
1127
1163
|
"data-slot": "label",
|
|
@@ -1135,7 +1171,7 @@ function Label({ className, ...props }) {
|
|
|
1135
1171
|
}
|
|
1136
1172
|
|
|
1137
1173
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
1138
|
-
import { Fragment as Fragment2, jsx as
|
|
1174
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1139
1175
|
var style = {
|
|
1140
1176
|
base: {
|
|
1141
1177
|
fontSize: "16px",
|
|
@@ -1193,9 +1229,9 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1193
1229
|
setCardError("An error occurred while processing your card. Please try again.");
|
|
1194
1230
|
}
|
|
1195
1231
|
};
|
|
1196
|
-
return /* @__PURE__ */
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1233
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col gap-1", children: [
|
|
1234
|
+
/* @__PURE__ */ jsx11(
|
|
1199
1235
|
CardNumberElement,
|
|
1200
1236
|
{
|
|
1201
1237
|
options: {
|
|
@@ -1205,8 +1241,8 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1205
1241
|
}
|
|
1206
1242
|
}
|
|
1207
1243
|
),
|
|
1208
|
-
/* @__PURE__ */
|
|
1209
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full gap-1", children: [
|
|
1245
|
+
/* @__PURE__ */ jsx11(
|
|
1210
1246
|
CardExpiryElement,
|
|
1211
1247
|
{
|
|
1212
1248
|
options: {
|
|
@@ -1216,7 +1252,7 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1216
1252
|
}
|
|
1217
1253
|
}
|
|
1218
1254
|
),
|
|
1219
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ jsx11(
|
|
1220
1256
|
CardCvcElement,
|
|
1221
1257
|
{
|
|
1222
1258
|
options: {
|
|
@@ -1227,24 +1263,24 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1227
1263
|
}
|
|
1228
1264
|
)
|
|
1229
1265
|
] }),
|
|
1230
|
-
cardError && /* @__PURE__ */
|
|
1266
|
+
cardError && /* @__PURE__ */ jsx11("p", { className: "text-destructive mt-1 text-sm", children: cardError })
|
|
1231
1267
|
] }),
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__PURE__ */
|
|
1268
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
1269
|
+
/* @__PURE__ */ jsx11(Checkbox, { disabled: true, checked: true, id: "saveCard" }),
|
|
1270
|
+
/* @__PURE__ */ jsx11(Label, { className: "text-sm font-medium", htmlFor: "saveCard", children: "Save card for future purchases" })
|
|
1235
1271
|
] }),
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full justify-end gap-2", children: [
|
|
1273
|
+
/* @__PURE__ */ jsx11(Button, { variant: "outline", className: "hover:bg-gray-100", onClick: cancel, children: "Cancel" }),
|
|
1274
|
+
/* @__PURE__ */ jsx11(Button, { onClick: handleSaveCard, children: "Add Card" })
|
|
1239
1275
|
] })
|
|
1240
1276
|
] });
|
|
1241
1277
|
};
|
|
1242
1278
|
|
|
1243
1279
|
// src/components/CreditCardTab/CreditCard/CreditCard.tsx
|
|
1244
|
-
import { Fragment as Fragment3, jsx as
|
|
1280
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1245
1281
|
var StripeWrapper = (props) => {
|
|
1246
1282
|
const stripePromise = useMemo2(() => loadStripe(props.publicKey), [props.publicKey]);
|
|
1247
|
-
return /* @__PURE__ */
|
|
1283
|
+
return /* @__PURE__ */ jsx12(Elements, { stripe: stripePromise, children: /* @__PURE__ */ jsx12(CreditCardForm, { cancel: props.onCancel, saveCard: props.saveNewCard }) });
|
|
1248
1284
|
};
|
|
1249
1285
|
var CreditCard = () => {
|
|
1250
1286
|
const [showForm, setShowForm] = useState4(false);
|
|
@@ -1262,19 +1298,19 @@ var CreditCard = () => {
|
|
|
1262
1298
|
const handleCancel = () => {
|
|
1263
1299
|
setShowForm(false);
|
|
1264
1300
|
};
|
|
1265
|
-
return /* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
!showForm && /* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
1301
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-baseline gap-4", children: [
|
|
1302
|
+
/* @__PURE__ */ jsx12("h3", { className: "text-primary text-xl leading-[34px] font-semibold", children: "Your Cards" }),
|
|
1303
|
+
!showForm && /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1304
|
+
/* @__PURE__ */ jsx12(
|
|
1269
1305
|
CardsList,
|
|
1270
1306
|
{
|
|
1271
1307
|
selectedCard: selectedPaymentMethod?.type === "CREDIT_CARD" /* CREDIT_CARD */ ? selectedPaymentMethod.method : null,
|
|
1272
1308
|
setCard
|
|
1273
1309
|
}
|
|
1274
1310
|
),
|
|
1275
|
-
spreePayConfig?.stripePublicKey && /* @__PURE__ */
|
|
1311
|
+
spreePayConfig?.stripePublicKey && /* @__PURE__ */ jsx12("button", { onClick: () => setShowForm(true), className: "text-sm font-medium text-black hover:underline", children: "Add new card" })
|
|
1276
1312
|
] }),
|
|
1277
|
-
spreePayConfig?.stripePublicKey && showForm && /* @__PURE__ */
|
|
1313
|
+
spreePayConfig?.stripePublicKey && showForm && /* @__PURE__ */ jsx12(StripeWrapper, { onCancel: handleCancel, saveNewCard, publicKey: spreePayConfig.stripePublicKey })
|
|
1278
1314
|
] });
|
|
1279
1315
|
};
|
|
1280
1316
|
|
|
@@ -1286,9 +1322,9 @@ import { useId as useId2 } from "react";
|
|
|
1286
1322
|
|
|
1287
1323
|
// src/ui/switch.tsx
|
|
1288
1324
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
1289
|
-
import { jsx as
|
|
1325
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1290
1326
|
function Switch({ className, ...props }) {
|
|
1291
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx13(
|
|
1292
1328
|
SwitchPrimitive.Root,
|
|
1293
1329
|
{
|
|
1294
1330
|
"data-slot": "switch",
|
|
@@ -1297,7 +1333,7 @@ function Switch({ className, ...props }) {
|
|
|
1297
1333
|
className
|
|
1298
1334
|
),
|
|
1299
1335
|
...props,
|
|
1300
|
-
children: /* @__PURE__ */
|
|
1336
|
+
children: /* @__PURE__ */ jsx13(
|
|
1301
1337
|
SwitchPrimitive.Thumb,
|
|
1302
1338
|
{
|
|
1303
1339
|
"data-slot": "switch-thumb",
|
|
@@ -1309,35 +1345,35 @@ function Switch({ className, ...props }) {
|
|
|
1309
1345
|
}
|
|
1310
1346
|
|
|
1311
1347
|
// src/components/common/PointsSwitch.tsx
|
|
1312
|
-
import { jsx as
|
|
1348
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1313
1349
|
var PointsSwitch = (props) => {
|
|
1314
1350
|
const { disabled = false, value, onChange, message } = props;
|
|
1315
1351
|
const { spreePayConfig } = useSpreePayConfig();
|
|
1316
1352
|
const { appProps } = useStaticConfig();
|
|
1317
1353
|
const { balance } = useSlapiBalance();
|
|
1318
1354
|
const id = useId2();
|
|
1319
|
-
return /* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-6", children: [
|
|
1356
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1357
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
|
|
1358
|
+
/* @__PURE__ */ jsx14(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
|
|
1359
|
+
/* @__PURE__ */ jsxs8(
|
|
1324
1360
|
Label,
|
|
1325
1361
|
{
|
|
1326
1362
|
htmlFor: id,
|
|
1327
1363
|
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",
|
|
1328
1364
|
children: [
|
|
1329
1365
|
"Use Points ",
|
|
1330
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs font-medium", children: "Optional" })
|
|
1331
1367
|
]
|
|
1332
1368
|
}
|
|
1333
1369
|
)
|
|
1334
1370
|
] }),
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
balance?.availablePoints ? /* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2.5", children: [
|
|
1372
|
+
balance?.availablePoints ? /* @__PURE__ */ jsxs8("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
|
|
1337
1373
|
formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
|
|
1338
|
-
!!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */
|
|
1374
|
+
!!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ jsx14("span", { className: "text-black/50", children: ` ${formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio)}` })
|
|
1339
1375
|
] }) : null,
|
|
1340
|
-
Boolean(appProps.topUpLink) && /* @__PURE__ */
|
|
1376
|
+
Boolean(appProps.topUpLink) && /* @__PURE__ */ jsx14(
|
|
1341
1377
|
"a",
|
|
1342
1378
|
{
|
|
1343
1379
|
className: "bg-primary cursor-pointer rounded-full px-2 py-1.5 text-xs font-medium text-white",
|
|
@@ -1349,30 +1385,30 @@ var PointsSwitch = (props) => {
|
|
|
1349
1385
|
)
|
|
1350
1386
|
] })
|
|
1351
1387
|
] }),
|
|
1352
|
-
message && /* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1388
|
+
message && /* @__PURE__ */ jsxs8("div", { className: "flex gap-1 rounded-sm border border-[#006FD533] bg-[#006FD50D] p-1.5", children: [
|
|
1389
|
+
/* @__PURE__ */ jsx14("svg", { className: "size-5 shrink-0", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx14(
|
|
1354
1390
|
"path",
|
|
1355
1391
|
{
|
|
1356
1392
|
fill: "#000",
|
|
1357
1393
|
d: "M9.6 13.8h.8V9.2h-.8zM10 8q.2 0 .4-.2l.1-.3-.1-.4L10 7l-.4.1-.1.4.1.3zm0 9.5a7 7 0 0 1-5.3-2.2 8 8 0 0 1-1.6-8.2 8 8 0 0 1 4-4q1.4-.6 2.9-.6a7 7 0 0 1 5.3 2.2 8 8 0 0 1 1.6 8.2 8 8 0 0 1-4 4q-1.4.6-2.9.6m0-.8q2.8 0 4.7-2 2-1.9 2-4.7t-2-4.7a6 6 0 0 0-4.7-2q-2.8 0-4.7 2a6 6 0 0 0-2 4.7q0 2.8 2 4.7 1.9 2 4.7 2"
|
|
1358
1394
|
}
|
|
1359
1395
|
) }),
|
|
1360
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs font-medium text-black", children: message })
|
|
1361
1397
|
] })
|
|
1362
1398
|
] });
|
|
1363
1399
|
};
|
|
1364
1400
|
|
|
1365
1401
|
// src/components/CreditCardTab/Points/SplitBlock.tsx
|
|
1366
|
-
import { useCallback as useCallback4, useEffect as useEffect6, useState as useState9 } from "react";
|
|
1402
|
+
import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
|
|
1367
1403
|
import { BUILD_ENV as BUILD_ENV2 } from "@mocanetwork/airkit";
|
|
1368
1404
|
|
|
1369
1405
|
// src/components/CreditCardTab/Points/PointsSelector.tsx
|
|
1370
1406
|
import { useState as useState8 } from "react";
|
|
1371
1407
|
|
|
1372
1408
|
// src/ui/input.tsx
|
|
1373
|
-
import { jsx as
|
|
1409
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1374
1410
|
function Input({ className, type, ...props }) {
|
|
1375
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx15(
|
|
1376
1412
|
"input",
|
|
1377
1413
|
{
|
|
1378
1414
|
type,
|
|
@@ -1399,7 +1435,7 @@ function clamp(value, [min, max]) {
|
|
|
1399
1435
|
return Math.min(max, Math.max(min, value));
|
|
1400
1436
|
}
|
|
1401
1437
|
|
|
1402
|
-
// ../../node_modules/@radix-ui/
|
|
1438
|
+
// ../../node_modules/@radix-ui/primitive/dist/index.mjs
|
|
1403
1439
|
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
1404
1440
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
1405
1441
|
return function handleEvent(event) {
|
|
@@ -1449,7 +1485,7 @@ function useComposedRefs(...refs) {
|
|
|
1449
1485
|
|
|
1450
1486
|
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
1451
1487
|
import * as React3 from "react";
|
|
1452
|
-
import { jsx as
|
|
1488
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1453
1489
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1454
1490
|
let defaultContexts = [];
|
|
1455
1491
|
function createContext32(rootComponentName, defaultContext) {
|
|
@@ -1460,7 +1496,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
1460
1496
|
const { scope, children, ...context } = props;
|
|
1461
1497
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1462
1498
|
const value = React3.useMemo(() => context, Object.values(context));
|
|
1463
|
-
return /* @__PURE__ */
|
|
1499
|
+
return /* @__PURE__ */ jsx16(Context.Provider, { value, children });
|
|
1464
1500
|
};
|
|
1465
1501
|
Provider.displayName = rootComponentName + "Provider";
|
|
1466
1502
|
function useContext22(consumerName, scope) {
|
|
@@ -1582,11 +1618,10 @@ function useUncontrolledState({
|
|
|
1582
1618
|
function isFunction(value) {
|
|
1583
1619
|
return typeof value === "function";
|
|
1584
1620
|
}
|
|
1585
|
-
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
1586
1621
|
|
|
1587
1622
|
// ../../node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
1588
1623
|
import * as React6 from "react";
|
|
1589
|
-
import { jsx as
|
|
1624
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1590
1625
|
var DirectionContext = React6.createContext(void 0);
|
|
1591
1626
|
function useDirection(localDir) {
|
|
1592
1627
|
const globalDir = React6.useContext(DirectionContext);
|
|
@@ -1647,7 +1682,7 @@ function useSize(element) {
|
|
|
1647
1682
|
import * as React9 from "react";
|
|
1648
1683
|
import * as ReactDOM from "react-dom";
|
|
1649
1684
|
import { createSlot } from "@radix-ui/react-slot";
|
|
1650
|
-
import { jsx as
|
|
1685
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1651
1686
|
var NODES = [
|
|
1652
1687
|
"a",
|
|
1653
1688
|
"button",
|
|
@@ -1673,9 +1708,9 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
1673
1708
|
const { asChild, ...primitiveProps } = props;
|
|
1674
1709
|
const Comp = asChild ? Slot2 : node;
|
|
1675
1710
|
if (typeof window !== "undefined") {
|
|
1676
|
-
window[Symbol.for("radix-ui")] = true;
|
|
1711
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
1677
1712
|
}
|
|
1678
|
-
return /* @__PURE__ */
|
|
1713
|
+
return /* @__PURE__ */ jsx18(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
1679
1714
|
});
|
|
1680
1715
|
Node2.displayName = `Primitive.${node}`;
|
|
1681
1716
|
return { ...primitive, [node]: Node2 };
|
|
@@ -1684,7 +1719,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
1684
1719
|
// ../../node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
1685
1720
|
import React10 from "react";
|
|
1686
1721
|
import { createSlot as createSlot2 } from "@radix-ui/react-slot";
|
|
1687
|
-
import { jsx as
|
|
1722
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1688
1723
|
import React23 from "react";
|
|
1689
1724
|
import { createSlot as createSlot22 } from "@radix-ui/react-slot";
|
|
1690
1725
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
@@ -1699,7 +1734,7 @@ function createCollection(name) {
|
|
|
1699
1734
|
const { scope, children } = props;
|
|
1700
1735
|
const ref = React10.useRef(null);
|
|
1701
1736
|
const itemMap = React10.useRef(/* @__PURE__ */ new Map()).current;
|
|
1702
|
-
return /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ jsx19(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
1703
1738
|
};
|
|
1704
1739
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
1705
1740
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
@@ -1709,7 +1744,7 @@ function createCollection(name) {
|
|
|
1709
1744
|
const { scope, children } = props;
|
|
1710
1745
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
1711
1746
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
1712
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsx19(CollectionSlotImpl, { ref: composedRefs, children });
|
|
1713
1748
|
}
|
|
1714
1749
|
);
|
|
1715
1750
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
@@ -1726,7 +1761,7 @@ function createCollection(name) {
|
|
|
1726
1761
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
1727
1762
|
return () => void context.itemMap.delete(ref);
|
|
1728
1763
|
});
|
|
1729
|
-
return /* @__PURE__ */
|
|
1764
|
+
return /* @__PURE__ */ jsx19(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
1730
1765
|
}
|
|
1731
1766
|
);
|
|
1732
1767
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
@@ -1752,7 +1787,7 @@ function createCollection(name) {
|
|
|
1752
1787
|
}
|
|
1753
1788
|
|
|
1754
1789
|
// ../../node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
1755
|
-
import { jsx as
|
|
1790
|
+
import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1756
1791
|
var PAGE_KEYS = ["PageUp", "PageDown"];
|
|
1757
1792
|
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
1758
1793
|
var BACK_KEYS = {
|
|
@@ -1830,7 +1865,7 @@ var Slider = React11.forwardRef(
|
|
|
1830
1865
|
}
|
|
1831
1866
|
});
|
|
1832
1867
|
}
|
|
1833
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsx20(
|
|
1834
1869
|
SliderProvider,
|
|
1835
1870
|
{
|
|
1836
1871
|
scope: props.__scopeSlider,
|
|
@@ -1843,7 +1878,7 @@ var Slider = React11.forwardRef(
|
|
|
1843
1878
|
values,
|
|
1844
1879
|
orientation,
|
|
1845
1880
|
form,
|
|
1846
|
-
children: /* @__PURE__ */
|
|
1881
|
+
children: /* @__PURE__ */ jsx20(Collection.Provider, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsx20(Collection.Slot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsx20(
|
|
1847
1882
|
SliderOrientation,
|
|
1848
1883
|
{
|
|
1849
1884
|
"aria-disabled": disabled,
|
|
@@ -1912,7 +1947,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
1912
1947
|
rectRef.current = rect;
|
|
1913
1948
|
return value(pointerPosition - rect.left);
|
|
1914
1949
|
}
|
|
1915
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ jsx20(
|
|
1916
1951
|
SliderOrientationProvider,
|
|
1917
1952
|
{
|
|
1918
1953
|
scope: props.__scopeSlider,
|
|
@@ -1920,7 +1955,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
1920
1955
|
endEdge: isSlidingFromLeft ? "right" : "left",
|
|
1921
1956
|
direction: isSlidingFromLeft ? 1 : -1,
|
|
1922
1957
|
size: "width",
|
|
1923
|
-
children: /* @__PURE__ */
|
|
1958
|
+
children: /* @__PURE__ */ jsx20(
|
|
1924
1959
|
SliderImpl,
|
|
1925
1960
|
{
|
|
1926
1961
|
dir: direction,
|
|
@@ -1978,7 +2013,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
1978
2013
|
rectRef.current = rect;
|
|
1979
2014
|
return value(pointerPosition - rect.top);
|
|
1980
2015
|
}
|
|
1981
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ jsx20(
|
|
1982
2017
|
SliderOrientationProvider,
|
|
1983
2018
|
{
|
|
1984
2019
|
scope: props.__scopeSlider,
|
|
@@ -1986,7 +2021,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
1986
2021
|
endEdge: isSlidingFromBottom ? "top" : "bottom",
|
|
1987
2022
|
size: "height",
|
|
1988
2023
|
direction: isSlidingFromBottom ? 1 : -1,
|
|
1989
|
-
children: /* @__PURE__ */
|
|
2024
|
+
children: /* @__PURE__ */ jsx20(
|
|
1990
2025
|
SliderImpl,
|
|
1991
2026
|
{
|
|
1992
2027
|
"data-orientation": "vertical",
|
|
@@ -2032,7 +2067,7 @@ var SliderImpl = React11.forwardRef(
|
|
|
2032
2067
|
...sliderProps
|
|
2033
2068
|
} = props;
|
|
2034
2069
|
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
2035
|
-
return /* @__PURE__ */
|
|
2070
|
+
return /* @__PURE__ */ jsx20(
|
|
2036
2071
|
Primitive.span,
|
|
2037
2072
|
{
|
|
2038
2073
|
...sliderProps,
|
|
@@ -2079,7 +2114,7 @@ var SliderTrack = React11.forwardRef(
|
|
|
2079
2114
|
(props, forwardedRef) => {
|
|
2080
2115
|
const { __scopeSlider, ...trackProps } = props;
|
|
2081
2116
|
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
2082
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ jsx20(
|
|
2083
2118
|
Primitive.span,
|
|
2084
2119
|
{
|
|
2085
2120
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -2105,7 +2140,7 @@ var SliderRange = React11.forwardRef(
|
|
|
2105
2140
|
);
|
|
2106
2141
|
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
2107
2142
|
const offsetEnd = 100 - Math.max(...percentages);
|
|
2108
|
-
return /* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsx20(
|
|
2109
2144
|
Primitive.span,
|
|
2110
2145
|
{
|
|
2111
2146
|
"data-orientation": context.orientation,
|
|
@@ -2132,7 +2167,7 @@ var SliderThumb = React11.forwardRef(
|
|
|
2132
2167
|
() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1,
|
|
2133
2168
|
[getItems, thumb]
|
|
2134
2169
|
);
|
|
2135
|
-
return /* @__PURE__ */
|
|
2170
|
+
return /* @__PURE__ */ jsx20(SliderThumbImpl, { ...props, ref: composedRefs, index });
|
|
2136
2171
|
}
|
|
2137
2172
|
);
|
|
2138
2173
|
var SliderThumbImpl = React11.forwardRef(
|
|
@@ -2157,7 +2192,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2157
2192
|
};
|
|
2158
2193
|
}
|
|
2159
2194
|
}, [thumb, context.thumbs]);
|
|
2160
|
-
return /* @__PURE__ */
|
|
2195
|
+
return /* @__PURE__ */ jsxs9(
|
|
2161
2196
|
"span",
|
|
2162
2197
|
{
|
|
2163
2198
|
style: {
|
|
@@ -2166,7 +2201,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2166
2201
|
[orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
|
|
2167
2202
|
},
|
|
2168
2203
|
children: [
|
|
2169
|
-
/* @__PURE__ */
|
|
2204
|
+
/* @__PURE__ */ jsx20(Collection.ItemSlot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsx20(
|
|
2170
2205
|
Primitive.span,
|
|
2171
2206
|
{
|
|
2172
2207
|
role: "slider",
|
|
@@ -2186,7 +2221,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2186
2221
|
})
|
|
2187
2222
|
}
|
|
2188
2223
|
) }),
|
|
2189
|
-
isFormControl && /* @__PURE__ */
|
|
2224
|
+
isFormControl && /* @__PURE__ */ jsx20(
|
|
2190
2225
|
SliderBubbleInput,
|
|
2191
2226
|
{
|
|
2192
2227
|
name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
|
|
@@ -2219,7 +2254,7 @@ var SliderBubbleInput = React11.forwardRef(
|
|
|
2219
2254
|
input.dispatchEvent(event);
|
|
2220
2255
|
}
|
|
2221
2256
|
}, [prevValue, value]);
|
|
2222
|
-
return /* @__PURE__ */
|
|
2257
|
+
return /* @__PURE__ */ jsx20(
|
|
2223
2258
|
Primitive.input,
|
|
2224
2259
|
{
|
|
2225
2260
|
style: { display: "none" },
|
|
@@ -2301,14 +2336,14 @@ function cn2(...inputs) {
|
|
|
2301
2336
|
}
|
|
2302
2337
|
|
|
2303
2338
|
// src/ui/slider.tsx
|
|
2304
|
-
import { jsx as
|
|
2339
|
+
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2305
2340
|
function Slider2(props) {
|
|
2306
2341
|
const { className, defaultValue, value, min = 0, max = 100, ...rest } = props;
|
|
2307
2342
|
const _values = React12.useMemo(
|
|
2308
2343
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
2309
2344
|
[value, defaultValue, min, max]
|
|
2310
2345
|
);
|
|
2311
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ jsxs10(
|
|
2312
2347
|
Root5,
|
|
2313
2348
|
{
|
|
2314
2349
|
"data-slot": "slider",
|
|
@@ -2322,14 +2357,14 @@ function Slider2(props) {
|
|
|
2322
2357
|
),
|
|
2323
2358
|
...rest,
|
|
2324
2359
|
children: [
|
|
2325
|
-
/* @__PURE__ */
|
|
2360
|
+
/* @__PURE__ */ jsx21(
|
|
2326
2361
|
Track,
|
|
2327
2362
|
{
|
|
2328
2363
|
"data-slot": "slider-track",
|
|
2329
2364
|
className: cn2(
|
|
2330
2365
|
"relative grow overflow-hidden rounded-full bg-black/15 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
2331
2366
|
),
|
|
2332
|
-
children: /* @__PURE__ */
|
|
2367
|
+
children: /* @__PURE__ */ jsx21(
|
|
2333
2368
|
Range,
|
|
2334
2369
|
{
|
|
2335
2370
|
"data-slot": "slider-range",
|
|
@@ -2338,11 +2373,11 @@ function Slider2(props) {
|
|
|
2338
2373
|
)
|
|
2339
2374
|
}
|
|
2340
2375
|
),
|
|
2341
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */
|
|
2376
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx21(
|
|
2342
2377
|
Thumb2,
|
|
2343
2378
|
{
|
|
2344
2379
|
"data-slot": "slider-thumb",
|
|
2345
|
-
className: "ring-ring/50 block size-5 shrink-0 rounded-full border
|
|
2380
|
+
className: "ring-ring/50 block size-5 shrink-0 rounded-full border border-white bg-black shadow-sm shadow-[#00000033] transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
2346
2381
|
},
|
|
2347
2382
|
index
|
|
2348
2383
|
))
|
|
@@ -2352,7 +2387,7 @@ function Slider2(props) {
|
|
|
2352
2387
|
}
|
|
2353
2388
|
|
|
2354
2389
|
// src/components/CreditCardTab/Points/PointsSelector.tsx
|
|
2355
|
-
import { jsx as
|
|
2390
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2356
2391
|
var PointsSelector = (props) => {
|
|
2357
2392
|
const { isDisabled, isSelected, onSelect, children } = props;
|
|
2358
2393
|
const { balance } = useSlapiBalance();
|
|
@@ -2371,31 +2406,31 @@ var PointsSelector = (props) => {
|
|
|
2371
2406
|
};
|
|
2372
2407
|
const pointsValue = String(Math.round(splitTokens));
|
|
2373
2408
|
const usdValue = formatUSD(usdAmount + getTransactionFee(usdAmount, appProps.transactionFeePercentage));
|
|
2374
|
-
return /* @__PURE__ */
|
|
2409
|
+
return /* @__PURE__ */ jsxs11(
|
|
2375
2410
|
"button",
|
|
2376
2411
|
{
|
|
2377
2412
|
disabled: isDisabled,
|
|
2378
2413
|
onClick: onSelect,
|
|
2379
|
-
className: cn("bg-primary/8 cursor-pointer overflow-hidden rounded-sm border
|
|
2414
|
+
className: cn("bg-primary/8 cursor-pointer overflow-hidden rounded-sm border border-transparent", {
|
|
2380
2415
|
"border-primary": isSelected,
|
|
2381
2416
|
"cursor-not-allowed opacity-50": isDisabled
|
|
2382
2417
|
}),
|
|
2383
2418
|
children: [
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2419
|
+
/* @__PURE__ */ jsxs11("div", { className: cn("flex h-11 w-full", { "bg-black/4": isSelected }), children: [
|
|
2420
|
+
/* @__PURE__ */ jsx23(
|
|
2386
2421
|
"div",
|
|
2387
2422
|
{
|
|
2388
2423
|
className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
|
|
2389
2424
|
"bg-primary": isSelected
|
|
2390
2425
|
}),
|
|
2391
|
-
children: /* @__PURE__ */
|
|
2426
|
+
children: /* @__PURE__ */ jsx23("div", { className: "flex size-5 items-center justify-center rounded-full bg-white", children: isSelected && /* @__PURE__ */ jsx23("div", { className: "bg-primary size-2.5 rounded-full" }) })
|
|
2392
2427
|
}
|
|
2393
2428
|
),
|
|
2394
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ jsx23("div", { className: "flex h-full w-full items-center justify-between gap-2 px-2 sm:gap-3 sm:px-3", children })
|
|
2395
2430
|
] }),
|
|
2396
|
-
isSelected && /* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2431
|
+
isSelected && /* @__PURE__ */ jsx23("div", { className: "px-2 pt-6 pb-2 sm:px-3 md:px-4", children: /* @__PURE__ */ jsxs11("div", { className: "flex justify-between gap-2 sm:gap-3", children: [
|
|
2432
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", children: [
|
|
2433
|
+
/* @__PURE__ */ jsx23(
|
|
2399
2434
|
Input,
|
|
2400
2435
|
{
|
|
2401
2436
|
readOnly: true,
|
|
@@ -2406,9 +2441,9 @@ var PointsSelector = (props) => {
|
|
|
2406
2441
|
onClick: (e) => e.stopPropagation()
|
|
2407
2442
|
}
|
|
2408
2443
|
),
|
|
2409
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx23("p", { className: "text-left text-xs leading-[20px] text-black/45", children: "Points" })
|
|
2410
2445
|
] }),
|
|
2411
|
-
/* @__PURE__ */
|
|
2446
|
+
/* @__PURE__ */ jsx23("div", { className: "flex w-full items-center pb-6", children: /* @__PURE__ */ jsx23(
|
|
2412
2447
|
Slider2,
|
|
2413
2448
|
{
|
|
2414
2449
|
value: [splitTokens],
|
|
@@ -2420,8 +2455,8 @@ var PointsSelector = (props) => {
|
|
|
2420
2455
|
step
|
|
2421
2456
|
}
|
|
2422
2457
|
) }),
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", children: [
|
|
2459
|
+
/* @__PURE__ */ jsx23(
|
|
2425
2460
|
Input,
|
|
2426
2461
|
{
|
|
2427
2462
|
readOnly: true,
|
|
@@ -2432,7 +2467,7 @@ var PointsSelector = (props) => {
|
|
|
2432
2467
|
onClick: (e) => e.stopPropagation()
|
|
2433
2468
|
}
|
|
2434
2469
|
),
|
|
2435
|
-
/* @__PURE__ */
|
|
2470
|
+
/* @__PURE__ */ jsx23("p", { className: "text-left text-xs leading-[20px] text-black/45", children: "Card" })
|
|
2436
2471
|
] })
|
|
2437
2472
|
] }) })
|
|
2438
2473
|
]
|
|
@@ -2441,7 +2476,7 @@ var PointsSelector = (props) => {
|
|
|
2441
2476
|
};
|
|
2442
2477
|
|
|
2443
2478
|
// src/components/CreditCardTab/Points/SplitBlock.tsx
|
|
2444
|
-
import { jsx as
|
|
2479
|
+
import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2445
2480
|
var SplitBlock = (props) => {
|
|
2446
2481
|
const { onToggle, isSelected, onSelect } = props;
|
|
2447
2482
|
const { balance, isBalanceLoading } = useSlapiBalance();
|
|
@@ -2450,6 +2485,7 @@ var SplitBlock = (props) => {
|
|
|
2450
2485
|
const [walletReady, setWalletReady] = useState9(false);
|
|
2451
2486
|
const { pointsConversionRatio, pointsTitle } = spreePayConfig || {};
|
|
2452
2487
|
const { env } = useSpreePayEnv();
|
|
2488
|
+
const prevPointsChainRef = useRef6(spreePayConfig?.pointsChain);
|
|
2453
2489
|
const initWallet = useCallback4(
|
|
2454
2490
|
async (pointsChain) => {
|
|
2455
2491
|
if (!pointsChain) return;
|
|
@@ -2471,28 +2507,34 @@ var SplitBlock = (props) => {
|
|
|
2471
2507
|
[onToggle, env.environment]
|
|
2472
2508
|
);
|
|
2473
2509
|
useEffect6(() => {
|
|
2474
|
-
if (env.useWeb3Points)
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2510
|
+
if (!env.useWeb3Points) return;
|
|
2511
|
+
const pointsChainChanged = prevPointsChainRef.current !== spreePayConfig?.pointsChain;
|
|
2512
|
+
prevPointsChainRef.current = spreePayConfig?.pointsChain;
|
|
2513
|
+
const doInit = async () => {
|
|
2514
|
+
if (pointsChainChanged) {
|
|
2515
|
+
setAddress(null);
|
|
2516
|
+
setWalletReady(false);
|
|
2517
|
+
}
|
|
2518
|
+
await initWallet(spreePayConfig?.pointsChain);
|
|
2519
|
+
};
|
|
2520
|
+
doInit();
|
|
2479
2521
|
}, [spreePayConfig?.pointsChain, initWallet, env.useWeb3Points]);
|
|
2480
2522
|
const isPointsSelectorDisabled = env.useWeb3Points ? !walletReady : false;
|
|
2481
|
-
return /* @__PURE__ */
|
|
2482
|
-
/* @__PURE__ */
|
|
2483
|
-
/* @__PURE__ */
|
|
2523
|
+
return /* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxs12(PointsSelector, { isDisabled: isPointsSelectorDisabled, onSelect: () => onSelect("air"), isSelected, children: [
|
|
2524
|
+
/* @__PURE__ */ jsx24("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ jsxs12("p", { className: "text-left text-xs font-medium text-black sm:text-sm", children: [
|
|
2525
|
+
/* @__PURE__ */ jsx24("span", { className: "text-black/50", children: "Available" }),
|
|
2484
2526
|
" ",
|
|
2485
2527
|
formatPoints(balance.availablePoints, pointsTitle),
|
|
2486
2528
|
" ",
|
|
2487
|
-
pointsConversionRatio && /* @__PURE__ */
|
|
2529
|
+
pointsConversionRatio && /* @__PURE__ */ jsx24("span", { className: "text-black/50", children: formatUSD(balance.availablePoints * pointsConversionRatio) })
|
|
2488
2530
|
] }) : null }),
|
|
2489
|
-
isBalanceLoading ? /* @__PURE__ */
|
|
2490
|
-
address && /* @__PURE__ */
|
|
2531
|
+
isBalanceLoading ? /* @__PURE__ */ jsx24("div", { className: "h-4 w-6 animate-pulse bg-gray-200" }) : !balance?.availablePoints && /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium text-black", children: "No points available" }),
|
|
2532
|
+
address && /* @__PURE__ */ jsx24("div", { className: "text-sm font-medium text-black", children: address.length > 8 ? `${address.slice(0, 4)}...${address.slice(-4)}` : address })
|
|
2491
2533
|
] }) });
|
|
2492
2534
|
};
|
|
2493
2535
|
|
|
2494
2536
|
// src/components/CreditCardTab/Points/Points.tsx
|
|
2495
|
-
import { Fragment as Fragment4, jsx as
|
|
2537
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2496
2538
|
var Points = () => {
|
|
2497
2539
|
const [usePoints, setUsePoints] = useState10(false);
|
|
2498
2540
|
const [selectedPointsType, setSelectedPointsType] = useState10(null);
|
|
@@ -2506,8 +2548,8 @@ var Points = () => {
|
|
|
2506
2548
|
setSelectedPaymentMethod({ ...selectedPaymentMethod, splitAmount: void 0 });
|
|
2507
2549
|
}
|
|
2508
2550
|
};
|
|
2509
|
-
return /* @__PURE__ */
|
|
2510
|
-
/* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2552
|
+
/* @__PURE__ */ jsx25(
|
|
2511
2553
|
PointsSwitch,
|
|
2512
2554
|
{
|
|
2513
2555
|
value: usePoints,
|
|
@@ -2516,7 +2558,7 @@ var Points = () => {
|
|
|
2516
2558
|
disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points || appProps.disabledPoints
|
|
2517
2559
|
}
|
|
2518
2560
|
),
|
|
2519
|
-
usePoints && /* @__PURE__ */
|
|
2561
|
+
usePoints && /* @__PURE__ */ jsx25(
|
|
2520
2562
|
SplitBlock,
|
|
2521
2563
|
{
|
|
2522
2564
|
onToggle: handleTogglePoints,
|
|
@@ -2528,7 +2570,7 @@ var Points = () => {
|
|
|
2528
2570
|
};
|
|
2529
2571
|
|
|
2530
2572
|
// src/components/CreditCardTab/CreditCardTab.tsx
|
|
2531
|
-
import { jsx as
|
|
2573
|
+
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2532
2574
|
var CreditCardTab = () => {
|
|
2533
2575
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
2534
2576
|
const { env } = useSpreePayEnv();
|
|
@@ -2583,16 +2625,16 @@ var CreditCardTab = () => {
|
|
|
2583
2625
|
useEffect7(() => {
|
|
2584
2626
|
register(handlePay);
|
|
2585
2627
|
}, [register, handlePay]);
|
|
2586
|
-
return /* @__PURE__ */
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
/* @__PURE__ */
|
|
2628
|
+
return /* @__PURE__ */ jsxs14("div", { children: [
|
|
2629
|
+
/* @__PURE__ */ jsx26("div", { className: "border-b border-black/7 px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsx26(CreditCard, {}) }),
|
|
2630
|
+
/* @__PURE__ */ jsx26("div", { className: "flex flex-col gap-6 border-b border-black/7 px-5 pt-5 pb-5 md:px-7 md:pt-6 md:pb-7", children: /* @__PURE__ */ jsx26(Points, {}) })
|
|
2589
2631
|
] });
|
|
2590
2632
|
};
|
|
2591
2633
|
|
|
2592
2634
|
// src/components/CryptoTab/Crypto/CryptoWrapper.tsx
|
|
2593
|
-
import {
|
|
2635
|
+
import { useMemo as useMemo9 } from "react";
|
|
2594
2636
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
2595
|
-
import
|
|
2637
|
+
import NiceModal7 from "@ebay/nice-modal-react";
|
|
2596
2638
|
import { RainbowKitProvider, getDefaultConfig, lightTheme } from "@rainbow-me/rainbowkit";
|
|
2597
2639
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
2598
2640
|
import { WagmiProvider } from "wagmi";
|
|
@@ -2615,9 +2657,9 @@ function getAction(client, actionFn, name) {
|
|
|
2615
2657
|
|
|
2616
2658
|
// ../../node_modules/@wagmi/core/dist/esm/actions/readContract.js
|
|
2617
2659
|
import { readContract as viem_readContract } from "viem/actions";
|
|
2618
|
-
function readContract(
|
|
2660
|
+
function readContract(config2, parameters) {
|
|
2619
2661
|
const { chainId, ...rest } = parameters;
|
|
2620
|
-
const client =
|
|
2662
|
+
const client = config2.getClient({ chainId });
|
|
2621
2663
|
const action = getAction(client, viem_readContract, "readContract");
|
|
2622
2664
|
return action(rest);
|
|
2623
2665
|
}
|
|
@@ -2625,17 +2667,20 @@ function readContract(config, parameters) {
|
|
|
2625
2667
|
// ../../node_modules/@wagmi/core/dist/esm/actions/waitForTransactionReceipt.js
|
|
2626
2668
|
import { hexToString } from "viem";
|
|
2627
2669
|
import { call, getTransaction, waitForTransactionReceipt as viem_waitForTransactionReceipt } from "viem/actions";
|
|
2628
|
-
async function waitForTransactionReceipt(
|
|
2670
|
+
async function waitForTransactionReceipt(config2, parameters) {
|
|
2629
2671
|
const { chainId, timeout = 0, ...rest } = parameters;
|
|
2630
|
-
const client =
|
|
2672
|
+
const client = config2.getClient({ chainId });
|
|
2631
2673
|
const action = getAction(client, viem_waitForTransactionReceipt, "waitForTransactionReceipt");
|
|
2632
2674
|
const receipt = await action({ ...rest, timeout });
|
|
2633
2675
|
if (receipt.status === "reverted") {
|
|
2634
2676
|
const action_getTransaction = getAction(client, getTransaction, "getTransaction");
|
|
2635
|
-
const txn = await action_getTransaction({
|
|
2677
|
+
const { from: account, ...txn } = await action_getTransaction({
|
|
2678
|
+
hash: receipt.transactionHash
|
|
2679
|
+
});
|
|
2636
2680
|
const action_call = getAction(client, call, "call");
|
|
2637
2681
|
const code = await action_call({
|
|
2638
2682
|
...txn,
|
|
2683
|
+
account,
|
|
2639
2684
|
data: txn.input,
|
|
2640
2685
|
gasPrice: txn.type !== "eip1559" ? txn.gasPrice : void 0,
|
|
2641
2686
|
maxFeePerGas: txn.type === "eip1559" ? txn.maxFeePerGas : void 0,
|
|
@@ -2699,7 +2744,7 @@ var MAX_UINT256 = BigInt(2) ** BigInt(256) - BigInt(1);
|
|
|
2699
2744
|
var useCryptoPayment = () => {
|
|
2700
2745
|
const { data: walletClient } = useWalletClient();
|
|
2701
2746
|
const { spreePayConfig } = useSpreePayConfig();
|
|
2702
|
-
const
|
|
2747
|
+
const config2 = useConfig();
|
|
2703
2748
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
2704
2749
|
const cryptoPayment = async (params) => {
|
|
2705
2750
|
if (!walletClient) {
|
|
@@ -2718,7 +2763,7 @@ var useCryptoPayment = () => {
|
|
|
2718
2763
|
if (!tokenAddress) {
|
|
2719
2764
|
throw new Error("Token address not found");
|
|
2720
2765
|
}
|
|
2721
|
-
const allowance = await readContract(
|
|
2766
|
+
const allowance = await readContract(config2, {
|
|
2722
2767
|
address: tokenAddress,
|
|
2723
2768
|
abi: erc20Abi2,
|
|
2724
2769
|
functionName: "allowance",
|
|
@@ -2731,7 +2776,7 @@ var useCryptoPayment = () => {
|
|
|
2731
2776
|
functionName: "approve",
|
|
2732
2777
|
args: [spreePayConfig.crypto.oneInchAggregationRouter, MAX_UINT256]
|
|
2733
2778
|
});
|
|
2734
|
-
await waitForTransactionReceipt(
|
|
2779
|
+
await waitForTransactionReceipt(config2, {
|
|
2735
2780
|
hash: result,
|
|
2736
2781
|
confirmations: 1
|
|
2737
2782
|
// You can change the number of block confirmations as per your requirement
|
|
@@ -2771,38 +2816,38 @@ var useCryptoPayment = () => {
|
|
|
2771
2816
|
|
|
2772
2817
|
// src/components/CryptoTab/Crypto/ConnectButton.tsx
|
|
2773
2818
|
import { ConnectButton as RainbowButton } from "@rainbow-me/rainbowkit";
|
|
2774
|
-
import { Fragment as Fragment5, jsx as
|
|
2819
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2775
2820
|
var ConnectButton = () => {
|
|
2776
|
-
return /* @__PURE__ */
|
|
2821
|
+
return /* @__PURE__ */ jsx27(RainbowButton.Custom, { children: ({ mounted, chain, account, openAccountModal, openChainModal, openConnectModal }) => {
|
|
2777
2822
|
if (!mounted) return null;
|
|
2778
|
-
return /* @__PURE__ */
|
|
2823
|
+
return /* @__PURE__ */ jsx27(Fragment5, { children: (() => {
|
|
2779
2824
|
if (!mounted || !account || !chain) {
|
|
2780
|
-
return /* @__PURE__ */
|
|
2825
|
+
return /* @__PURE__ */ jsx27(
|
|
2781
2826
|
"button",
|
|
2782
2827
|
{
|
|
2783
|
-
className: "h-[34px] rounded-md border
|
|
2828
|
+
className: "h-[34px] rounded-md border border-black px-3 text-sm font-medium text-black",
|
|
2784
2829
|
onClick: openConnectModal,
|
|
2785
2830
|
children: "Connect a Wallet"
|
|
2786
2831
|
}
|
|
2787
2832
|
);
|
|
2788
2833
|
}
|
|
2789
2834
|
if (chain.unsupported) {
|
|
2790
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ jsx27(
|
|
2791
2836
|
"button",
|
|
2792
2837
|
{
|
|
2793
|
-
className: "h-[34px] rounded-md border
|
|
2838
|
+
className: "h-[34px] rounded-md border border-black px-3 text-sm font-medium text-black",
|
|
2794
2839
|
onClick: openChainModal,
|
|
2795
2840
|
children: "Select a Network"
|
|
2796
2841
|
}
|
|
2797
2842
|
);
|
|
2798
2843
|
}
|
|
2799
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ jsxs15(
|
|
2800
2845
|
"button",
|
|
2801
2846
|
{
|
|
2802
|
-
className: "flex h-[34px] items-center gap-2 rounded-md border
|
|
2847
|
+
className: "flex h-[34px] items-center gap-2 rounded-md border border-black px-1.5 text-sm font-medium text-black",
|
|
2803
2848
|
onClick: openAccountModal,
|
|
2804
2849
|
children: [
|
|
2805
|
-
chain.hasIcon && /* @__PURE__ */
|
|
2850
|
+
chain.hasIcon && /* @__PURE__ */ jsx27("div", { className: "size-6 overflow-hidden rounded-full", style: { background: chain.iconBackground }, children: chain.iconUrl && /* @__PURE__ */ jsx27("img", { alt: chain.name ?? "Chain icon", src: chain.iconUrl }) }),
|
|
2806
2851
|
account.displayName
|
|
2807
2852
|
]
|
|
2808
2853
|
}
|
|
@@ -2812,29 +2857,29 @@ var ConnectButton = () => {
|
|
|
2812
2857
|
};
|
|
2813
2858
|
|
|
2814
2859
|
// src/config/symbolLogos.tsx
|
|
2815
|
-
import { jsx as
|
|
2816
|
-
var MOCA_SVG = /* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
/* @__PURE__ */
|
|
2860
|
+
import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2861
|
+
var MOCA_SVG = /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", fill: "none", children: [
|
|
2862
|
+
/* @__PURE__ */ jsx28("circle", { cx: "14", cy: "14", r: "13.5", fill: "#C15F97" }),
|
|
2863
|
+
/* @__PURE__ */ jsx28(
|
|
2819
2864
|
"path",
|
|
2820
2865
|
{
|
|
2821
2866
|
fill: "#fff",
|
|
2822
2867
|
d: "M16.06 6.65c.3 0 .59.16.74.43l6.06 10.5a.85.85 0 1 1-1.47.84L16.06 9.2l-1.51 2.62-.02.03-3.8 6.57a.85.85 0 0 1-1.47-.84l3.57-6.18-1.27-2.2-5.32 9.22a.85.85 0 0 1-1.48-.84l6.07-10.5.06-.1a.85.85 0 0 1 1.4.1l1.52 2.62 1.52-2.62.06-.1c.16-.2.4-.33.67-.33Z"
|
|
2823
2868
|
}
|
|
2824
2869
|
),
|
|
2825
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ jsx28("circle", { cx: "16", cy: "14", r: "1.5", fill: "#fff" })
|
|
2826
2871
|
] });
|
|
2827
|
-
var USDC_SVG = /* @__PURE__ */
|
|
2828
|
-
/* @__PURE__ */
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
2872
|
+
var USDC_SVG = /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", fill: "none", children: [
|
|
2873
|
+
/* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_528_9163)", children: [
|
|
2874
|
+
/* @__PURE__ */ jsx28("path", { fill: "#2775CA", d: "M14 28c7.76 0 14-6.24 14-14S21.76 0 14 0 0 6.24 0 14s6.24 14 14 14Z" }),
|
|
2875
|
+
/* @__PURE__ */ jsx28(
|
|
2831
2876
|
"path",
|
|
2832
2877
|
{
|
|
2833
2878
|
fill: "#fff",
|
|
2834
2879
|
d: "M17.85 16.22c0-2.04-1.23-2.74-3.68-3.04-1.75-.23-2.1-.7-2.1-1.51 0-.82.59-1.34 1.75-1.34 1.05 0 1.64.35 1.93 1.22.06.18.23.3.4.3h.94a.4.4 0 0 0 .41-.42v-.05a2.91 2.91 0 0 0-2.63-2.4v-1.4c0-.23-.17-.4-.46-.46h-.88c-.23 0-.4.17-.46.46v1.35c-1.75.23-2.86 1.4-2.86 2.85 0 1.93 1.16 2.69 3.61 2.98 1.64.29 2.16.64 2.16 1.57 0 .94-.81 1.58-1.92 1.58-1.52 0-2.04-.64-2.22-1.52-.06-.23-.23-.35-.4-.35h-1a.4.4 0 0 0-.4.41v.06c.23 1.46 1.16 2.5 3.08 2.8v1.4c0 .23.18.4.47.47h.88c.23 0 .4-.18.46-.47v-1.4c1.75-.3 2.92-1.52 2.92-3.1Z"
|
|
2835
2880
|
}
|
|
2836
2881
|
),
|
|
2837
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsx28(
|
|
2838
2883
|
"path",
|
|
2839
2884
|
{
|
|
2840
2885
|
fill: "#fff",
|
|
@@ -2842,11 +2887,11 @@ var USDC_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2842
2887
|
}
|
|
2843
2888
|
)
|
|
2844
2889
|
] }),
|
|
2845
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsx28("defs", { children: /* @__PURE__ */ jsx28("clipPath", { id: "clip0_528_9163", children: /* @__PURE__ */ jsx28("path", { fill: "#fff", d: "M0 0h28v28H0z" }) }) })
|
|
2846
2891
|
] });
|
|
2847
|
-
var USDT_SVG = /* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
2849
|
-
/* @__PURE__ */
|
|
2892
|
+
var USDT_SVG = /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", fill: "none", children: [
|
|
2893
|
+
/* @__PURE__ */ jsx28("path", { fill: "#26A17B", d: "M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28Z" }),
|
|
2894
|
+
/* @__PURE__ */ jsx28(
|
|
2850
2895
|
"path",
|
|
2851
2896
|
{
|
|
2852
2897
|
fill: "#fff",
|
|
@@ -2854,23 +2899,23 @@ var USDT_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2854
2899
|
}
|
|
2855
2900
|
)
|
|
2856
2901
|
] });
|
|
2857
|
-
var WETH_SVG = /* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2902
|
+
var WETH_SVG = /* @__PURE__ */ jsxs16("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", width: "28", height: "28", viewBox: "0 0 24 24", children: [
|
|
2903
|
+
/* @__PURE__ */ jsxs16("g", { clipPath: "url(#clip0_528_9173)", children: [
|
|
2904
|
+
/* @__PURE__ */ jsx28(
|
|
2860
2905
|
"path",
|
|
2861
2906
|
{
|
|
2862
2907
|
fill: "#000",
|
|
2863
2908
|
d: "M17.14 20.57c0 .95-1.31 2.01-3.39 2.4h-2.59c-4.65 0-8.42-1.07-8.42-2.4 0-1.32 3.77-2.4 8.42-2.4s5.98 1.08 5.98 2.4Z"
|
|
2864
2909
|
}
|
|
2865
2910
|
),
|
|
2866
|
-
/* @__PURE__ */
|
|
2911
|
+
/* @__PURE__ */ jsx28(
|
|
2867
2912
|
"path",
|
|
2868
2913
|
{
|
|
2869
2914
|
fill: "#F61F7D",
|
|
2870
2915
|
d: "M23.31 11c0 5.86-5.18 11.63-11.07 11.63-5.9 0-11.9-6.17-11.9-12.03C.34 4.75 5.12 0 11.01 0s12.3 5.15 12.3 11Z"
|
|
2871
2916
|
}
|
|
2872
2917
|
),
|
|
2873
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsx28(
|
|
2874
2919
|
"path",
|
|
2875
2920
|
{
|
|
2876
2921
|
fill: "#000",
|
|
@@ -2879,8 +2924,8 @@ var WETH_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2879
2924
|
clipRule: "evenodd"
|
|
2880
2925
|
}
|
|
2881
2926
|
),
|
|
2882
|
-
/* @__PURE__ */
|
|
2883
|
-
/* @__PURE__ */
|
|
2927
|
+
/* @__PURE__ */ jsx28("path", { fill: "#fff", d: "M24 12.17a10.8 10.8 0 1 1-21.6 0 10.8 10.8 0 0 1 21.6 0Z" }),
|
|
2928
|
+
/* @__PURE__ */ jsx28(
|
|
2884
2929
|
"path",
|
|
2885
2930
|
{
|
|
2886
2931
|
fill: "#000",
|
|
@@ -2889,8 +2934,8 @@ var WETH_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2889
2934
|
clipRule: "evenodd"
|
|
2890
2935
|
}
|
|
2891
2936
|
),
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx28("path", { fill: "#000", fillRule: "evenodd", d: "M3.02 10.63.7 8.75l.74-.86 2.34 1.87-.75.87Z", clipRule: "evenodd" }),
|
|
2938
|
+
/* @__PURE__ */ jsx28(
|
|
2894
2939
|
"path",
|
|
2895
2940
|
{
|
|
2896
2941
|
fill: "#000",
|
|
@@ -2898,7 +2943,7 @@ var WETH_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2898
2943
|
}
|
|
2899
2944
|
)
|
|
2900
2945
|
] }),
|
|
2901
|
-
/* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsx28("defs", { children: /* @__PURE__ */ jsx28("clipPath", { id: "clip0_528_9173", children: /* @__PURE__ */ jsx28("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
2902
2947
|
] });
|
|
2903
2948
|
var symbolLogos = {
|
|
2904
2949
|
MOCA: MOCA_SVG,
|
|
@@ -2911,33 +2956,33 @@ function getSymbolLogo(symbol) {
|
|
|
2911
2956
|
}
|
|
2912
2957
|
|
|
2913
2958
|
// src/components/CryptoTab/Crypto/Logos.tsx
|
|
2914
|
-
import { jsx as
|
|
2959
|
+
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2915
2960
|
var Logos = () => {
|
|
2916
|
-
return /* @__PURE__ */
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__PURE__ */
|
|
2961
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex", children: [
|
|
2962
|
+
/* @__PURE__ */ jsx29("div", { className: "rounded-full border border-[#F5F7FA]", children: getSymbolLogo("MOCA") }),
|
|
2963
|
+
/* @__PURE__ */ jsx29("div", { className: "-ml-2.5 rounded-full border border-[#F5F7FA]", children: getSymbolLogo("USDC") }),
|
|
2964
|
+
/* @__PURE__ */ jsx29("div", { className: "-ml-2.5 rounded-full border border-[#F5F7FA]", children: getSymbolLogo("USDT") }),
|
|
2965
|
+
/* @__PURE__ */ jsx29("div", { className: "-ml-2.5 rounded-full border border-[#F5F7FA] bg-[#F5F7FA]", children: getSymbolLogo("WETH") })
|
|
2921
2966
|
] });
|
|
2922
2967
|
};
|
|
2923
2968
|
|
|
2924
2969
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
2925
|
-
import
|
|
2970
|
+
import NiceModal6 from "@ebay/nice-modal-react";
|
|
2926
2971
|
|
|
2927
2972
|
// src/modals/CryptoSelectModal.tsx
|
|
2928
2973
|
import { useMemo as useMemo8, useState as useState12 } from "react";
|
|
2929
|
-
import
|
|
2974
|
+
import NiceModal5, { useModal as useModal2 } from "@ebay/nice-modal-react";
|
|
2930
2975
|
|
|
2931
2976
|
// ../ui/src/components/input.tsx
|
|
2932
|
-
import { jsx as
|
|
2977
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2933
2978
|
function Input2({ className, type, ...props }) {
|
|
2934
|
-
return /* @__PURE__ */
|
|
2979
|
+
return /* @__PURE__ */ jsx30(
|
|
2935
2980
|
"input",
|
|
2936
2981
|
{
|
|
2937
2982
|
type,
|
|
2938
2983
|
"data-slot": "input",
|
|
2939
2984
|
className: cn2(
|
|
2940
|
-
"file:text-foreground
|
|
2985
|
+
"file:text-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base text-(--primary) shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-(--tertiary) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
2941
2986
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
2942
2987
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
2943
2988
|
className
|
|
@@ -2948,18 +2993,58 @@ function Input2({ className, type, ...props }) {
|
|
|
2948
2993
|
}
|
|
2949
2994
|
|
|
2950
2995
|
// ../../node_modules/@radix-ui/react-separator/dist/index.mjs
|
|
2996
|
+
import * as React14 from "react";
|
|
2997
|
+
|
|
2998
|
+
// ../../node_modules/@radix-ui/react-separator/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
2951
2999
|
import * as React13 from "react";
|
|
3000
|
+
import * as ReactDOM2 from "react-dom";
|
|
3001
|
+
import { createSlot as createSlot3 } from "@radix-ui/react-slot";
|
|
3002
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3003
|
+
var NODES2 = [
|
|
3004
|
+
"a",
|
|
3005
|
+
"button",
|
|
3006
|
+
"div",
|
|
3007
|
+
"form",
|
|
3008
|
+
"h2",
|
|
3009
|
+
"h3",
|
|
3010
|
+
"img",
|
|
3011
|
+
"input",
|
|
3012
|
+
"label",
|
|
3013
|
+
"li",
|
|
3014
|
+
"nav",
|
|
3015
|
+
"ol",
|
|
3016
|
+
"p",
|
|
3017
|
+
"select",
|
|
3018
|
+
"span",
|
|
3019
|
+
"svg",
|
|
3020
|
+
"ul"
|
|
3021
|
+
];
|
|
3022
|
+
var Primitive2 = NODES2.reduce((primitive, node) => {
|
|
3023
|
+
const Slot2 = createSlot3(`Primitive.${node}`);
|
|
3024
|
+
const Node2 = React13.forwardRef((props, forwardedRef) => {
|
|
3025
|
+
const { asChild, ...primitiveProps } = props;
|
|
3026
|
+
const Comp = asChild ? Slot2 : node;
|
|
3027
|
+
if (typeof window !== "undefined") {
|
|
3028
|
+
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
3029
|
+
}
|
|
3030
|
+
return /* @__PURE__ */ jsx31(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
3031
|
+
});
|
|
3032
|
+
Node2.displayName = `Primitive.${node}`;
|
|
3033
|
+
return { ...primitive, [node]: Node2 };
|
|
3034
|
+
}, {});
|
|
3035
|
+
|
|
3036
|
+
// ../../node_modules/@radix-ui/react-separator/dist/index.mjs
|
|
2952
3037
|
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2953
3038
|
var NAME = "Separator";
|
|
2954
3039
|
var DEFAULT_ORIENTATION = "horizontal";
|
|
2955
3040
|
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
2956
|
-
var Separator =
|
|
3041
|
+
var Separator = React14.forwardRef((props, forwardedRef) => {
|
|
2957
3042
|
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
|
|
2958
3043
|
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
2959
3044
|
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
2960
3045
|
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
2961
3046
|
return /* @__PURE__ */ jsx32(
|
|
2962
|
-
|
|
3047
|
+
Primitive2.div,
|
|
2963
3048
|
{
|
|
2964
3049
|
"data-orientation": orientation,
|
|
2965
3050
|
...semanticProps,
|
|
@@ -2989,7 +3074,7 @@ function Separator2({
|
|
|
2989
3074
|
decorative,
|
|
2990
3075
|
orientation,
|
|
2991
3076
|
className: cn2(
|
|
2992
|
-
"
|
|
3077
|
+
"shrink-0 bg-(--b-secondary) data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
2993
3078
|
className
|
|
2994
3079
|
),
|
|
2995
3080
|
...props
|
|
@@ -2998,17 +3083,17 @@ function Separator2({
|
|
|
2998
3083
|
}
|
|
2999
3084
|
|
|
3000
3085
|
// src/hooks/useBaseERC20Token.ts
|
|
3001
|
-
import * as
|
|
3086
|
+
import * as React15 from "react";
|
|
3002
3087
|
import { erc20Abi as erc20Abi3, formatUnits, getAddress } from "viem";
|
|
3003
3088
|
import { useAccount, usePublicClient } from "wagmi";
|
|
3004
3089
|
function useBaseERC20Token() {
|
|
3005
3090
|
const { address } = useAccount();
|
|
3006
3091
|
const baseClient = usePublicClient({ chainId: BASE_CHAIN_ID });
|
|
3007
3092
|
const defaultClient = usePublicClient();
|
|
3008
|
-
const [rows, setRows] =
|
|
3009
|
-
const [isLoading, setLoading] =
|
|
3010
|
-
const [error, setError] =
|
|
3011
|
-
|
|
3093
|
+
const [rows, setRows] = React15.useState([]);
|
|
3094
|
+
const [isLoading, setLoading] = React15.useState(false);
|
|
3095
|
+
const [error, setError] = React15.useState(null);
|
|
3096
|
+
React15.useEffect(() => {
|
|
3012
3097
|
let cancelled = false;
|
|
3013
3098
|
async function run() {
|
|
3014
3099
|
const client = baseClient ?? defaultClient;
|
|
@@ -3089,8 +3174,8 @@ var useBaseTokens = () => {
|
|
|
3089
3174
|
};
|
|
3090
3175
|
|
|
3091
3176
|
// src/modals/CryptoSelectModal.tsx
|
|
3092
|
-
import { Fragment as Fragment6, jsx as jsx34, jsxs as
|
|
3093
|
-
var CryptoSelectModal =
|
|
3177
|
+
import { Fragment as Fragment6, jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3178
|
+
var CryptoSelectModal = NiceModal5.create(() => {
|
|
3094
3179
|
const modal = useModal2();
|
|
3095
3180
|
const { isLoading, error, erc20Balances } = useBaseERC20Token();
|
|
3096
3181
|
const { isLoadingNative, nativeError, nativeBalance } = useBaseNativeToken();
|
|
@@ -3107,12 +3192,11 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3107
3192
|
setSelectedPaymentMethod({ type: "CRYPTO" /* CRYPTO */, method: coin });
|
|
3108
3193
|
};
|
|
3109
3194
|
const userCoins = [nativeBalance, ...erc20Balances].filter(Boolean);
|
|
3110
|
-
|
|
3111
|
-
return /* @__PURE__ */ jsxs19(Dialog, { open: modal.visible, onOpenChange: modal.remove, children: [
|
|
3195
|
+
return /* @__PURE__ */ jsxs18(Dialog, { open: modal.visible, onOpenChange: modal.remove, children: [
|
|
3112
3196
|
/* @__PURE__ */ jsx34(DialogDescription, { className: "hidden", children: "Crypto Select Modal" }),
|
|
3113
|
-
/* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ jsxs18(DialogContent, { showCloseButton: false, className: "max-h-[90vh] gap-0 p-0", children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7", children: [
|
|
3199
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3116
3200
|
/* @__PURE__ */ jsx34("button", { className: "rounded-md hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ jsx34("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", fill: "none", children: /* @__PURE__ */ jsx34("path", { stroke: "#000", d: "m15 6.5-6 6 6 6" }) }) }),
|
|
3117
3201
|
/* @__PURE__ */ jsx34(DialogTitle, { className: "text-primary text-2xl font-semibold", children: "Select a token" }),
|
|
3118
3202
|
/* @__PURE__ */ jsx34("button", { className: "rounded-md p-1 hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ jsx34("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "17", fill: "none", children: /* @__PURE__ */ jsx34(
|
|
@@ -3126,26 +3210,19 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3126
3210
|
/* @__PURE__ */ jsx34(Input2, { onChange: (e) => setSearch(e.target.value), placeholder: "Search by token name", value: search })
|
|
3127
3211
|
] }),
|
|
3128
3212
|
/* @__PURE__ */ jsx34(Separator2, { className: "hidden md:block" }),
|
|
3129
|
-
/* @__PURE__ */
|
|
3213
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7", children: [
|
|
3130
3214
|
/* @__PURE__ */ jsx34("h3", { className: "text-primary text-xl font-semibold", children: "Tokens with wallet balance" }),
|
|
3131
3215
|
(error || nativeError) && /* @__PURE__ */ jsx34("p", { className: "text-center text-sm text-red-500", children: "Something wrong" }),
|
|
3132
|
-
/* @__PURE__ */
|
|
3216
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex w-full flex-col gap-1", children: [
|
|
3133
3217
|
isLoadingNative && /* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3134
|
-
nativeBalance && /* @__PURE__ */
|
|
3218
|
+
nativeBalance && /* @__PURE__ */ jsxs18(
|
|
3135
3219
|
"button",
|
|
3136
3220
|
{
|
|
3137
3221
|
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100",
|
|
3138
3222
|
onClick: () => handleSelect(nativeBalance),
|
|
3139
3223
|
children: [
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
nativeBalance.logoURI && /* @__PURE__ */ jsx34(
|
|
3142
|
-
"img",
|
|
3143
|
-
{
|
|
3144
|
-
className: "h-8 w-8 shrink-0",
|
|
3145
|
-
src: nativeBalance.logoURI,
|
|
3146
|
-
alt: `${nativeBalance.symbol} logo`
|
|
3147
|
-
}
|
|
3148
|
-
),
|
|
3224
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3225
|
+
nativeBalance.logoURI && /* @__PURE__ */ jsx34("img", { className: "size-8 shrink-0", src: nativeBalance.logoURI, alt: `${nativeBalance.symbol} logo` }),
|
|
3149
3226
|
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: nativeBalance.symbol })
|
|
3150
3227
|
] }),
|
|
3151
3228
|
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: nativeBalance.formatted })
|
|
@@ -3153,20 +3230,20 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3153
3230
|
},
|
|
3154
3231
|
nativeBalance.symbol
|
|
3155
3232
|
),
|
|
3156
|
-
isLoading && /* @__PURE__ */
|
|
3233
|
+
isLoading && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3157
3234
|
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3158
3235
|
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3159
3236
|
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" })
|
|
3160
3237
|
] }),
|
|
3161
3238
|
erc20Balances.map((coin) => {
|
|
3162
3239
|
const Icon = getSymbolLogo(coin.symbol);
|
|
3163
|
-
return /* @__PURE__ */
|
|
3240
|
+
return /* @__PURE__ */ jsxs18(
|
|
3164
3241
|
"button",
|
|
3165
3242
|
{
|
|
3166
3243
|
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
3167
3244
|
onClick: () => handleSelect(coin),
|
|
3168
3245
|
children: [
|
|
3169
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3170
3247
|
Boolean(Icon) && Icon,
|
|
3171
3248
|
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: coin.symbol })
|
|
3172
3249
|
] }),
|
|
@@ -3178,25 +3255,28 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3178
3255
|
})
|
|
3179
3256
|
] }),
|
|
3180
3257
|
/* @__PURE__ */ jsx34("h3", { className: "text-primary text-xl font-semibold", children: "All Tokens" }),
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
tokensIsLoading && /* @__PURE__ */
|
|
3258
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex max-h-[40vh] w-full flex-col gap-1 overflow-y-auto", children: [
|
|
3259
|
+
tokensIsLoading && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3183
3260
|
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3184
3261
|
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3185
3262
|
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" })
|
|
3186
3263
|
] }),
|
|
3187
|
-
filteredCoins.map((token) =>
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3264
|
+
filteredCoins.map((token) => {
|
|
3265
|
+
const userCoin = userCoins.find((c) => c.symbol === token.symbol);
|
|
3266
|
+
return /* @__PURE__ */ jsx34(
|
|
3267
|
+
"button",
|
|
3268
|
+
{
|
|
3269
|
+
disabled: !userCoin,
|
|
3270
|
+
onClick: () => userCoin && handleSelect(userCoin),
|
|
3271
|
+
className: "flex min-h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
3272
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3273
|
+
token.logoURI ? /* @__PURE__ */ jsx34("img", { className: "size-8 shrink-0", src: token.logoURI, alt: `${token.name} logo` }) : /* @__PURE__ */ jsx34("div", { className: "size-8 shrink-0 rounded-full bg-gray-400" }),
|
|
3274
|
+
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: token.symbol })
|
|
3275
|
+
] })
|
|
3276
|
+
},
|
|
3277
|
+
token.symbol
|
|
3278
|
+
);
|
|
3279
|
+
})
|
|
3200
3280
|
] })
|
|
3201
3281
|
] })
|
|
3202
3282
|
] })
|
|
@@ -3205,14 +3285,14 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3205
3285
|
CryptoSelectModal.displayName = "CryptoSelectModal";
|
|
3206
3286
|
|
|
3207
3287
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
3208
|
-
import { jsx as jsx35, jsxs as
|
|
3288
|
+
import { jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3209
3289
|
var SelectCoinButton = () => {
|
|
3210
3290
|
const openModal = () => {
|
|
3211
|
-
|
|
3291
|
+
NiceModal6.show(CryptoSelectModal);
|
|
3212
3292
|
};
|
|
3213
|
-
return /* @__PURE__ */
|
|
3214
|
-
/* @__PURE__ */ jsx35("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ jsx35("div", { className: "flex
|
|
3215
|
-
/* @__PURE__ */
|
|
3293
|
+
return /* @__PURE__ */ jsxs19("button", { onClick: openModal, type: "button", className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
|
|
3294
|
+
/* @__PURE__ */ jsx35("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ jsx35("div", { className: "flex size-5 items-center justify-center rounded-full bg-white" }) }),
|
|
3295
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex h-full w-full items-center justify-between px-3", children: [
|
|
3216
3296
|
/* @__PURE__ */ jsx35("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx35("p", { className: "font-medium text-black/50", children: "Select a token" }) }),
|
|
3217
3297
|
/* @__PURE__ */ jsx35("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none", children: /* @__PURE__ */ jsx35("path", { stroke: "#000", strokeLinecap: "round", d: "m6 12.43 4-4-4-4" }) })
|
|
3218
3298
|
] })
|
|
@@ -3220,20 +3300,20 @@ var SelectCoinButton = () => {
|
|
|
3220
3300
|
};
|
|
3221
3301
|
|
|
3222
3302
|
// src/components/CryptoTab/Crypto/SelectedCoin.tsx
|
|
3223
|
-
import { jsx as jsx36, jsxs as
|
|
3303
|
+
import { jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3224
3304
|
var SelectedCoin = (props) => {
|
|
3225
3305
|
const { coin, balance, logoURI } = props;
|
|
3226
3306
|
const Icon = getSymbolLogo(coin);
|
|
3227
|
-
return /* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */ jsx36("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ jsx36("div", { className: "flex
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3307
|
+
return /* @__PURE__ */ jsxs20("div", { className: "bg-primary/8 flex h-11 w-full overflow-hidden rounded-md", children: [
|
|
3308
|
+
/* @__PURE__ */ jsx36("div", { className: "bg-primary flex h-full w-11 items-center justify-center", children: /* @__PURE__ */ jsx36("div", { className: "flex size-5 items-center justify-center rounded-full bg-white", children: /* @__PURE__ */ jsx36("div", { className: "bg-primary size-2.5 rounded-full" }) }) }),
|
|
3309
|
+
/* @__PURE__ */ jsxs20("div", { className: "border-primary flex h-full w-full items-center justify-between rounded-r-md border border-l-0! px-3", children: [
|
|
3310
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1", children: [
|
|
3231
3311
|
Icon,
|
|
3232
|
-
!Icon && logoURI && /* @__PURE__ */ jsx36("img", { className: "mr-1
|
|
3312
|
+
!Icon && logoURI && /* @__PURE__ */ jsx36("img", { className: "mr-1 size-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
|
|
3233
3313
|
/* @__PURE__ */ jsx36("p", { className: "font-semibold text-black", children: coin }),
|
|
3234
3314
|
/* @__PURE__ */ jsx36("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx36("path", { d: "M6 12.4341L10 8.43408L6 4.43408", stroke: "black", strokeLinecap: "round" }) })
|
|
3235
3315
|
] }),
|
|
3236
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsxs20("p", { className: "text-xs font-medium text-black/50", children: [
|
|
3237
3317
|
"Wallet balance ",
|
|
3238
3318
|
/* @__PURE__ */ jsx36("span", { className: "text-black", children: balance })
|
|
3239
3319
|
] })
|
|
@@ -3242,7 +3322,7 @@ var SelectedCoin = (props) => {
|
|
|
3242
3322
|
};
|
|
3243
3323
|
|
|
3244
3324
|
// src/components/CryptoTab/Crypto/Crypto.tsx
|
|
3245
|
-
import { jsx as jsx37, jsxs as
|
|
3325
|
+
import { jsx as jsx37, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3246
3326
|
var Crypto = () => {
|
|
3247
3327
|
const { address } = useAccount3();
|
|
3248
3328
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
@@ -3266,13 +3346,13 @@ var Crypto = () => {
|
|
|
3266
3346
|
useEffect9(() => {
|
|
3267
3347
|
register(handlePay);
|
|
3268
3348
|
}, [register, handlePay]);
|
|
3269
|
-
return /* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3349
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-baseline gap-4", children: [
|
|
3350
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
3271
3351
|
/* @__PURE__ */ jsx37("h3", { className: "text-primary text-xl leading-[1.7] font-semibold", children: "Pay with Crypto" }),
|
|
3272
3352
|
/* @__PURE__ */ jsx37(ConnectButton, {})
|
|
3273
3353
|
] }),
|
|
3274
3354
|
!isWalletConnected && /* @__PURE__ */ jsx37(Logos, {}),
|
|
3275
|
-
isWalletConnected && /* @__PURE__ */
|
|
3355
|
+
isWalletConnected && /* @__PURE__ */ jsxs21("div", { className: "flex w-full flex-col gap-1", children: [
|
|
3276
3356
|
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && selectedPaymentMethod.method && /* @__PURE__ */ jsx37(
|
|
3277
3357
|
SelectedCoin,
|
|
3278
3358
|
{
|
|
@@ -3302,36 +3382,34 @@ function getCachedWagmiConfig(projectId, appName) {
|
|
|
3302
3382
|
}
|
|
3303
3383
|
var CryptoWrapper = () => {
|
|
3304
3384
|
const { spreePayConfig, configIsLoading } = useSpreePayConfig();
|
|
3305
|
-
const
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
const cfg2 = getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
|
|
3309
|
-
setWagmiConfig((prev) => prev ? prev : cfg2);
|
|
3385
|
+
const wagmiConfig = useMemo9(() => {
|
|
3386
|
+
if (!spreePayConfig) return null;
|
|
3387
|
+
return getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
|
|
3310
3388
|
}, [spreePayConfig]);
|
|
3311
3389
|
if (configIsLoading || !wagmiConfig) return null;
|
|
3312
|
-
return /* @__PURE__ */ jsx38(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx38(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx38(RainbowKitProvider, { theme: lightTheme({ borderRadius: "large" }), children: /* @__PURE__ */ jsx38(
|
|
3390
|
+
return /* @__PURE__ */ jsx38(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx38(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx38(RainbowKitProvider, { theme: lightTheme({ borderRadius: "large" }), children: /* @__PURE__ */ jsx38(NiceModal7.Provider, { children: /* @__PURE__ */ jsx38(Crypto, {}) }) }) }) });
|
|
3313
3391
|
};
|
|
3314
3392
|
|
|
3315
3393
|
// src/components/CryptoTab/CryptoTab.tsx
|
|
3316
|
-
import { jsx as jsx39, jsxs as
|
|
3394
|
+
import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3317
3395
|
var CryptoTab = () => {
|
|
3318
3396
|
const { spreePayConfig } = useSpreePayConfig();
|
|
3319
|
-
return /* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */ jsx39("div", { className: "border-b
|
|
3397
|
+
return /* @__PURE__ */ jsxs22("div", { children: [
|
|
3398
|
+
/* @__PURE__ */ jsx39("div", { className: "border-b border-black/7 px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsx39(CryptoWrapper, {}) }),
|
|
3321
3399
|
/* @__PURE__ */ jsx39("div", { className: "px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ jsx39(PointsSwitch, { disabled: true, message: spreePayConfig?.crypto.pointsInfoMessage }) })
|
|
3322
3400
|
] });
|
|
3323
3401
|
};
|
|
3324
3402
|
|
|
3325
3403
|
// src/components/TabButtons.tsx
|
|
3326
|
-
import { jsx as jsx40, jsxs as
|
|
3327
|
-
var TabButton = ({ isDisabled =
|
|
3404
|
+
import { Fragment as Fragment7, jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3405
|
+
var TabButton = ({ isDisabled = false, isActive, children, onClick }) => {
|
|
3328
3406
|
return /* @__PURE__ */ jsx40(
|
|
3329
3407
|
"button",
|
|
3330
3408
|
{
|
|
3331
3409
|
disabled: isDisabled,
|
|
3332
3410
|
onClick,
|
|
3333
3411
|
className: cn(
|
|
3334
|
-
"flex w-[132px] flex-col items-baseline rounded-sm border
|
|
3412
|
+
"flex w-[132px] flex-col items-baseline rounded-sm border border-black/50 px-2.5 py-1.5 text-sm text-black",
|
|
3335
3413
|
{ "opacity-50": !isActive || isDisabled },
|
|
3336
3414
|
{ "cursor-not-allowed": isDisabled },
|
|
3337
3415
|
{ "bg-primary/7 border-primary text-primary": isActive }
|
|
@@ -3342,98 +3420,79 @@ var TabButton = ({ isDisabled = true, isActive, children, onClick }) => {
|
|
|
3342
3420
|
};
|
|
3343
3421
|
var TabButtons = (props) => {
|
|
3344
3422
|
const { value, onChange } = props;
|
|
3345
|
-
const { spreePayConfig } = useSpreePayConfig();
|
|
3423
|
+
const { spreePayConfig, configIsLoading } = useSpreePayConfig();
|
|
3346
3424
|
const handleChange = (type) => () => {
|
|
3347
3425
|
if (value !== type) {
|
|
3348
3426
|
onChange({ type, method: null });
|
|
3349
3427
|
}
|
|
3350
3428
|
};
|
|
3351
|
-
return /* @__PURE__ */
|
|
3352
|
-
/* @__PURE__ */
|
|
3353
|
-
|
|
3354
|
-
{
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
"path",
|
|
3387
|
-
{
|
|
3388
|
-
fill: "currentColor",
|
|
3389
|
-
d: "M21.15 0c4.7 0 8.5 3.58 8.5 8s-3.8 8-8.5 8a8.93 8.93 0 0 1-3.35-.65 8 8 0 0 0 2.24-1.44c.36.06.73.09 1.1.09 3.71 0 6.5-2.8 6.5-6s-2.79-6-6.5-6c-.37 0-.74.03-1.1.09A8 8 0 0 0 17.8.65 8.93 8.93 0 0 1 21.15 0Z"
|
|
3390
|
-
}
|
|
3391
|
-
),
|
|
3392
|
-
/* @__PURE__ */ jsx40("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "2" })
|
|
3393
|
-
] }),
|
|
3394
|
-
/* @__PURE__ */ jsx40("p", { className: "text-sm font-medium", children: "Crypto" })
|
|
3395
|
-
]
|
|
3396
|
-
}
|
|
3397
|
-
)
|
|
3429
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
|
|
3430
|
+
configIsLoading && /* @__PURE__ */ jsxs23(Fragment7, { children: [
|
|
3431
|
+
/* @__PURE__ */ jsx40("div", { className: "bg-primary/7 h-[58px] w-[132px] animate-pulse rounded-sm" }),
|
|
3432
|
+
/* @__PURE__ */ jsx40("div", { className: "bg-primary/7 h-[58px] w-[132px] animate-pulse rounded-sm" })
|
|
3433
|
+
] }),
|
|
3434
|
+
spreePayConfig?.creditCard.enabled && /* @__PURE__ */ jsxs23(TabButton, { onClick: handleChange("CREDIT_CARD" /* CREDIT_CARD */), isActive: value === "CREDIT_CARD" /* CREDIT_CARD */, children: [
|
|
3435
|
+
/* @__PURE__ */ jsx40("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", children: /* @__PURE__ */ jsx40(
|
|
3436
|
+
"path",
|
|
3437
|
+
{
|
|
3438
|
+
fill: "currentColor",
|
|
3439
|
+
d: "M22 6v12c0 .55-.2 1.02-.59 1.41-.39.4-.86.59-1.41.59H4c-.55 0-1.02-.2-1.41-.59-.4-.39-.59-.86-.59-1.41V6c0-.55.2-1.02.59-1.41C2.98 4.19 3.45 4 4 4h16c.55 0 1.02.2 1.41.59.4.39.59.86.59 1.41ZM4 8h16V6H4v2Zm0 4v6h16v-6H4Z"
|
|
3440
|
+
}
|
|
3441
|
+
) }),
|
|
3442
|
+
/* @__PURE__ */ jsx40("p", { className: "text-sm font-medium", children: "Card" })
|
|
3443
|
+
] }),
|
|
3444
|
+
spreePayConfig?.crypto.enabled && /* @__PURE__ */ jsxs23(TabButton, { onClick: handleChange("CRYPTO" /* CRYPTO */), isActive: value === "CRYPTO" /* CRYPTO */, children: [
|
|
3445
|
+
/* @__PURE__ */ jsxs23("svg", { className: "my-1", xmlns: "http://www.w3.org/2000/svg", width: "30", height: "16", fill: "none", children: [
|
|
3446
|
+
/* @__PURE__ */ jsx40(
|
|
3447
|
+
"path",
|
|
3448
|
+
{
|
|
3449
|
+
fill: "currentColor",
|
|
3450
|
+
d: "M14.5 0C19.2 0 23 3.58 23 8s-3.8 8-8.5 8a8.93 8.93 0 0 1-3.35-.65 8 8 0 0 0 2.24-1.44c.36.06.73.09 1.11.09 3.7 0 6.5-2.8 6.5-6s-2.8-6-6.5-6c-.38 0-.75.03-1.11.09A8 8 0 0 0 11.15.65 8.93 8.93 0 0 1 14.5 0Z"
|
|
3451
|
+
}
|
|
3452
|
+
),
|
|
3453
|
+
/* @__PURE__ */ jsx40(
|
|
3454
|
+
"path",
|
|
3455
|
+
{
|
|
3456
|
+
fill: "currentColor",
|
|
3457
|
+
d: "M21.15 0c4.7 0 8.5 3.58 8.5 8s-3.8 8-8.5 8a8.93 8.93 0 0 1-3.35-.65 8 8 0 0 0 2.24-1.44c.36.06.73.09 1.1.09 3.71 0 6.5-2.8 6.5-6s-2.79-6-6.5-6c-.37 0-.74.03-1.1.09A8 8 0 0 0 17.8.65 8.93 8.93 0 0 1 21.15 0Z"
|
|
3458
|
+
}
|
|
3459
|
+
),
|
|
3460
|
+
/* @__PURE__ */ jsx40("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "2" })
|
|
3461
|
+
] }),
|
|
3462
|
+
/* @__PURE__ */ jsx40("p", { className: "text-sm font-medium", children: "Crypto" })
|
|
3463
|
+
] })
|
|
3398
3464
|
] });
|
|
3399
3465
|
};
|
|
3400
3466
|
|
|
3401
|
-
// src/
|
|
3402
|
-
import { jsx as jsx41, jsxs as
|
|
3403
|
-
var
|
|
3467
|
+
// src/SpreePayContent.tsx
|
|
3468
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3469
|
+
var SpreePayContent = ({ isLoggedIn }) => {
|
|
3404
3470
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
3405
|
-
return /* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3471
|
+
return /* @__PURE__ */ jsxs24("div", { className: "w-full overflow-hidden rounded-3xl border border-black/25 bg-white", children: [
|
|
3472
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex w-full flex-col gap-4 border-b border-black/7 px-5 py-5 md:px-7 md:py-6", children: [
|
|
3407
3473
|
/* @__PURE__ */ jsx41("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
|
|
3408
3474
|
/* @__PURE__ */ jsx41(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
3409
3475
|
] }),
|
|
3410
3476
|
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ jsx41(CreditCardTab, {}),
|
|
3411
|
-
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ jsx41(CryptoTab, {})
|
|
3412
|
-
|
|
3413
|
-
};
|
|
3414
|
-
|
|
3415
|
-
// src/SpreePayContent.tsx
|
|
3416
|
-
import { jsx as jsx42, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3417
|
-
var SpreePayContent = ({ isLoggedIn }) => {
|
|
3418
|
-
return /* @__PURE__ */ jsxs26("div", { className: "w-full", children: [
|
|
3419
|
-
/* @__PURE__ */ jsx42(Tabs, {}),
|
|
3420
|
-
/* @__PURE__ */ jsx42(CheckoutButton, { isLoggedIn }),
|
|
3421
|
-
/* @__PURE__ */ jsx42(SpreeLegal, {})
|
|
3477
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ jsx41(CryptoTab, {}),
|
|
3478
|
+
/* @__PURE__ */ jsx41(CheckoutButton, { isLoggedIn })
|
|
3422
3479
|
] });
|
|
3423
3480
|
};
|
|
3424
3481
|
|
|
3425
3482
|
// src/hooks/useKeycloakSSO.ts
|
|
3426
|
-
import { useCallback as useCallback7, useEffect as
|
|
3483
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef7, useState as useState13 } from "react";
|
|
3427
3484
|
import Keycloak from "keycloak-js";
|
|
3428
3485
|
var refreshAheadSeconds = 60;
|
|
3429
|
-
function useKeycloakSSO(
|
|
3430
|
-
const { url, realm, clientId, ssoPageURI, enabled } =
|
|
3431
|
-
const initRef =
|
|
3432
|
-
const kcRef =
|
|
3433
|
-
const refreshTimerRef =
|
|
3434
|
-
const
|
|
3435
|
-
|
|
3436
|
-
const [
|
|
3486
|
+
function useKeycloakSSO(config2) {
|
|
3487
|
+
const { url, realm, clientId, ssoPageURI, enabled } = config2;
|
|
3488
|
+
const initRef = useRef7(false);
|
|
3489
|
+
const kcRef = useRef7(null);
|
|
3490
|
+
const refreshTimerRef = useRef7(null);
|
|
3491
|
+
const scheduleRefreshRef = useRef7(() => {
|
|
3492
|
+
});
|
|
3493
|
+
const [error, setError] = useState13(null);
|
|
3494
|
+
const [isChecking, setIsChecking] = useState13(enabled);
|
|
3495
|
+
const [accessToken, setAccessToken] = useState13(null);
|
|
3437
3496
|
const scheduleRefresh = useCallback7(() => {
|
|
3438
3497
|
const kc = kcRef.current;
|
|
3439
3498
|
if (!kc || !kc.tokenParsed || !kc.tokenParsed.exp) {
|
|
@@ -3448,17 +3507,19 @@ function useKeycloakSSO(config) {
|
|
|
3448
3507
|
kc.updateToken(refreshAheadSeconds).then((refreshed) => {
|
|
3449
3508
|
if (refreshed) {
|
|
3450
3509
|
setAccessToken(kc.token ?? null);
|
|
3451
|
-
|
|
3510
|
+
scheduleRefreshRef.current();
|
|
3452
3511
|
}
|
|
3453
3512
|
}).catch((_) => {
|
|
3454
3513
|
kc.login().catch(console.error);
|
|
3455
3514
|
});
|
|
3456
3515
|
}, delayMs);
|
|
3457
3516
|
}, []);
|
|
3458
|
-
|
|
3517
|
+
useEffect10(() => {
|
|
3518
|
+
scheduleRefreshRef.current = scheduleRefresh;
|
|
3519
|
+
}, [scheduleRefresh]);
|
|
3520
|
+
useEffect10(() => {
|
|
3459
3521
|
if (initRef.current || !enabled) return;
|
|
3460
3522
|
initRef.current = true;
|
|
3461
|
-
setIsChecking(true);
|
|
3462
3523
|
const kc = new Keycloak({ url, realm, clientId });
|
|
3463
3524
|
kcRef.current = kc;
|
|
3464
3525
|
kc.onTokenExpired = () => {
|
|
@@ -3490,21 +3551,20 @@ function useKeycloakSSO(config) {
|
|
|
3490
3551
|
}
|
|
3491
3552
|
|
|
3492
3553
|
// src/SpreePay.tsx
|
|
3493
|
-
import { jsx as
|
|
3554
|
+
import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3494
3555
|
var SpreePayInner = () => {
|
|
3495
|
-
const
|
|
3496
|
-
const
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
const el = rootRef.current.querySelector(":scope > .sl-spreepay__portal");
|
|
3556
|
+
const [portalEl, setPortalEl] = useState14(null);
|
|
3557
|
+
const rootRef = useCallback8((node) => {
|
|
3558
|
+
if (!node) return;
|
|
3559
|
+
const el = node.querySelector(":scope > .sl-spreepay__portal");
|
|
3500
3560
|
setPortalEl(el ?? null);
|
|
3501
3561
|
}, []);
|
|
3502
|
-
|
|
3562
|
+
useEffect11(() => {
|
|
3503
3563
|
console.log(`[spree-pay] v${version}`);
|
|
3504
3564
|
}, []);
|
|
3505
3565
|
const { env } = useSpreePayEnv();
|
|
3506
3566
|
const { staticConfig, appProps } = useStaticConfig();
|
|
3507
|
-
const tenantId = env?.tenantId
|
|
3567
|
+
const tenantId = env?.tenantId;
|
|
3508
3568
|
const { isChecking, accessToken } = useKeycloakSSO({
|
|
3509
3569
|
realm: tenantId,
|
|
3510
3570
|
url: staticConfig.keycloakUrl,
|
|
@@ -3513,7 +3573,8 @@ var SpreePayInner = () => {
|
|
|
3513
3573
|
enabled: !env?.accessToken
|
|
3514
3574
|
});
|
|
3515
3575
|
const _accessToken = env.accessToken ?? accessToken;
|
|
3516
|
-
const
|
|
3576
|
+
const unauthenticatedFetcher = useCallback8(() => Promise.resolve(null), []);
|
|
3577
|
+
const slapiFetcher = useMemo10(() => {
|
|
3517
3578
|
if (_accessToken) {
|
|
3518
3579
|
return registerApi({
|
|
3519
3580
|
accessToken: _accessToken,
|
|
@@ -3521,16 +3582,16 @@ var SpreePayInner = () => {
|
|
|
3521
3582
|
baseUrl: staticConfig.slapiUrl
|
|
3522
3583
|
});
|
|
3523
3584
|
}
|
|
3524
|
-
|
|
3585
|
+
return unauthenticatedFetcher;
|
|
3586
|
+
}, [_accessToken, staticConfig, tenantId, unauthenticatedFetcher]);
|
|
3525
3587
|
const getContent = () => {
|
|
3526
3588
|
if (isChecking) {
|
|
3527
|
-
return /* @__PURE__ */
|
|
3528
|
-
/* @__PURE__ */
|
|
3529
|
-
/* @__PURE__ */
|
|
3530
|
-
/* @__PURE__ */ jsx43(SpreeLegal, {})
|
|
3589
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex w-full flex-col", children: [
|
|
3590
|
+
/* @__PURE__ */ jsx42("div", { className: "bg-primary/8 mb-4 h-[315px] animate-pulse rounded-3xl" }),
|
|
3591
|
+
/* @__PURE__ */ jsx42("div", { className: "bg-primary/8 h-[135px] animate-pulse rounded-3xl" })
|
|
3531
3592
|
] });
|
|
3532
3593
|
}
|
|
3533
|
-
return /* @__PURE__ */
|
|
3594
|
+
return /* @__PURE__ */ jsx42(
|
|
3534
3595
|
SWRConfig,
|
|
3535
3596
|
{
|
|
3536
3597
|
value: {
|
|
@@ -3539,23 +3600,23 @@ var SpreePayInner = () => {
|
|
|
3539
3600
|
revalidateOnFocus: false,
|
|
3540
3601
|
revalidateIfStale: false
|
|
3541
3602
|
},
|
|
3542
|
-
children: /* @__PURE__ */
|
|
3603
|
+
children: /* @__PURE__ */ jsx42(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx42(NiceModal8.Provider, { children: /* @__PURE__ */ jsx42(SpreePayContent, { isLoggedIn: Boolean(_accessToken) }) }) })
|
|
3543
3604
|
}
|
|
3544
3605
|
);
|
|
3545
3606
|
};
|
|
3546
|
-
return /* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3607
|
+
return /* @__PURE__ */ jsxs25("div", { ref: rootRef, className: cn("sl-spreepay", appProps.className), children: [
|
|
3608
|
+
/* @__PURE__ */ jsx42("div", { className: "sl-spreepay__portal" }),
|
|
3548
3609
|
getContent()
|
|
3549
3610
|
] });
|
|
3550
3611
|
};
|
|
3551
3612
|
var SpreePay = (props) => {
|
|
3552
|
-
return /* @__PURE__ */
|
|
3613
|
+
return /* @__PURE__ */ jsx42(StaticConfigProvider, { props, children: /* @__PURE__ */ jsx42(SpreePayInner, {}) });
|
|
3553
3614
|
};
|
|
3554
3615
|
|
|
3555
3616
|
// src/hooks/useCapture3DS.ts
|
|
3556
|
-
import { useEffect as
|
|
3617
|
+
import { useEffect as useEffect12 } from "react";
|
|
3557
3618
|
var useCapture3DS = (searchParams) => {
|
|
3558
|
-
|
|
3619
|
+
useEffect12(() => {
|
|
3559
3620
|
if (typeof window !== "undefined" && window.parent && searchParams?.paymentIntent) {
|
|
3560
3621
|
window.parent.SP_EVENT_BUS?.emit("paymentIntent", { paymentIntent: searchParams.paymentIntent });
|
|
3561
3622
|
}
|