@superlogic/spree-pay 0.1.35 → 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/build/index.cjs +382 -377
- package/build/index.css +114 -136
- package/build/index.d.cts +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +380 -375
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/SpreePay.tsx
|
|
2
2
|
import { useCallback as useCallback8, useEffect as useEffect11, useMemo as useMemo10, useState as useState14 } from "react";
|
|
3
|
-
import
|
|
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",
|
|
@@ -121,6 +122,11 @@ var CONFIG = {
|
|
|
121
122
|
slapiUrl: "https://slapi.dev.umusicpassport.com",
|
|
122
123
|
keycloakUrl: "https://auth.dev.umusicpassport.com",
|
|
123
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"
|
|
124
130
|
}
|
|
125
131
|
},
|
|
126
132
|
stg: {
|
|
@@ -143,6 +149,11 @@ var CONFIG = {
|
|
|
143
149
|
slapiUrl: "https://slapi.stg.umusicpassport.com",
|
|
144
150
|
keycloakUrl: "https://auth.stg.umusicpassport.com",
|
|
145
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"
|
|
146
157
|
}
|
|
147
158
|
},
|
|
148
159
|
prod: {
|
|
@@ -165,9 +176,17 @@ var CONFIG = {
|
|
|
165
176
|
slapiUrl: "https://slapi.umusicpassport.com",
|
|
166
177
|
keycloakUrl: "https://auth.umusicpassport.com",
|
|
167
178
|
keycloakClientId: "oneof-next"
|
|
179
|
+
},
|
|
180
|
+
cdc: {
|
|
181
|
+
slapiUrl: "https://slapi.superlogic.com",
|
|
182
|
+
keycloakUrl: "https://auth.superlogic.com",
|
|
183
|
+
keycloakClientId: "oneof-next"
|
|
168
184
|
}
|
|
169
185
|
}
|
|
170
186
|
};
|
|
187
|
+
|
|
188
|
+
// src/context/StaticConfigContext.tsx
|
|
189
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
171
190
|
var StaticConfigContext = createContext2(null);
|
|
172
191
|
var StaticConfigProvider = ({ children, props }) => {
|
|
173
192
|
const { env } = useSpreePayEnv();
|
|
@@ -176,8 +195,12 @@ var StaticConfigProvider = ({ children, props }) => {
|
|
|
176
195
|
setAppProps(props);
|
|
177
196
|
}, [props]);
|
|
178
197
|
const staticConfig = useMemo(() => {
|
|
179
|
-
const envConfig =
|
|
180
|
-
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";
|
|
181
204
|
return envConfig[appKey];
|
|
182
205
|
}, [env.environment, env.tenantId]);
|
|
183
206
|
return /* @__PURE__ */ jsx2(StaticConfigContext.Provider, { value: { staticConfig, appProps }, children });
|
|
@@ -345,50 +368,38 @@ var CheckoutButton = ({ isLoggedIn }) => {
|
|
|
345
368
|
}
|
|
346
369
|
return "Checkout";
|
|
347
370
|
};
|
|
348
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-col
|
|
349
|
-
/* @__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: [
|
|
350
373
|
"By clicking on the button below I acknowledge that I have read and accepted the",
|
|
351
374
|
" ",
|
|
352
375
|
/* @__PURE__ */ jsx4("a", { className: "underline", href: spreePayConfig?.termsConditionsUrl, target: "_blank", rel: "noreferrer", children: "Terms and Conditions" }),
|
|
353
376
|
"."
|
|
354
|
-
] })
|
|
377
|
+
] }),
|
|
355
378
|
isLoggedIn ? /* @__PURE__ */ jsx4(Fragment, { children: onProcess && /* @__PURE__ */ jsx4(
|
|
356
379
|
"button",
|
|
357
380
|
{
|
|
358
381
|
disabled: isDisabled,
|
|
359
382
|
onClick: onProcess,
|
|
360
|
-
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",
|
|
361
384
|
children: getCheckoutContent()
|
|
362
385
|
}
|
|
363
386
|
) }) : /* @__PURE__ */ jsx4(
|
|
364
387
|
"a",
|
|
365
388
|
{
|
|
366
389
|
href: `${staticConfig.keycloakUrl}/realms/${env.tenantId}/protocol/openid-connect/auth?client_id=${staticConfig.keycloakClientId}&response_type=code&redirect_uri=${window.location.href}`,
|
|
367
|
-
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",
|
|
368
391
|
children: "Log in / Sign up for an AIR account"
|
|
369
392
|
}
|
|
370
|
-
)
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
{
|
|
381
|
-
fill: "#000",
|
|
382
|
-
fillOpacity: ".5",
|
|
383
|
-
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"
|
|
384
|
-
}
|
|
385
|
-
) }),
|
|
386
|
-
/* @__PURE__ */ jsxs3("p", { className: "text-xs text-black/50", children: [
|
|
387
|
-
"Spree enables seamless crypto payments for real-world goods, travel, and experiences. Enjoy secure, fast transactions and earn rewards.",
|
|
388
|
-
" ",
|
|
389
|
-
/* @__PURE__ */ jsx5("a", { className: "underline", href: "https://www.spree.finance/", target: "_blank", rel: "noreferrer", children: "Learn more" }),
|
|
390
|
-
" ",
|
|
391
|
-
"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
|
+
) })
|
|
392
403
|
] })
|
|
393
404
|
] });
|
|
394
405
|
};
|
|
@@ -435,17 +446,17 @@ function usePortalContainer() {
|
|
|
435
446
|
}
|
|
436
447
|
|
|
437
448
|
// src/ui/dialog.tsx
|
|
438
|
-
import { jsx as
|
|
449
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
439
450
|
function Dialog({ ...props }) {
|
|
440
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
441
452
|
}
|
|
442
453
|
function DialogPortal({ ...props }) {
|
|
443
454
|
const container = usePortalContainer();
|
|
444
455
|
const safeContainer = container && document.body.contains(container) ? container : void 0;
|
|
445
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ jsx5(DialogPrimitive.Portal, { container: safeContainer, "data-slot": "dialog-portal", ...props });
|
|
446
457
|
}
|
|
447
458
|
function DialogOverlay({ className, ...props }) {
|
|
448
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ jsx5(
|
|
449
460
|
DialogPrimitive.Overlay,
|
|
450
461
|
{
|
|
451
462
|
"data-slot": "dialog-overlay",
|
|
@@ -463,9 +474,9 @@ function DialogContent({
|
|
|
463
474
|
showCloseButton = true,
|
|
464
475
|
...props
|
|
465
476
|
}) {
|
|
466
|
-
return /* @__PURE__ */
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
/* @__PURE__ */
|
|
477
|
+
return /* @__PURE__ */ jsxs3(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
478
|
+
/* @__PURE__ */ jsx5(DialogOverlay, {}),
|
|
479
|
+
/* @__PURE__ */ jsxs3(
|
|
469
480
|
DialogPrimitive.Content,
|
|
470
481
|
{
|
|
471
482
|
"data-slot": "dialog-content",
|
|
@@ -476,14 +487,14 @@ function DialogContent({
|
|
|
476
487
|
...props,
|
|
477
488
|
children: [
|
|
478
489
|
children,
|
|
479
|
-
showCloseButton && /* @__PURE__ */
|
|
490
|
+
showCloseButton && /* @__PURE__ */ jsxs3(
|
|
480
491
|
DialogPrimitive.Close,
|
|
481
492
|
{
|
|
482
493
|
"data-slot": "dialog-close",
|
|
483
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",
|
|
484
495
|
children: [
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsx5(XIcon, {}),
|
|
497
|
+
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Close" })
|
|
487
498
|
]
|
|
488
499
|
}
|
|
489
500
|
)
|
|
@@ -493,7 +504,7 @@ function DialogContent({
|
|
|
493
504
|
] });
|
|
494
505
|
}
|
|
495
506
|
function DialogTitle({ className, ...props }) {
|
|
496
|
-
return /* @__PURE__ */
|
|
507
|
+
return /* @__PURE__ */ jsx5(
|
|
497
508
|
DialogPrimitive.Title,
|
|
498
509
|
{
|
|
499
510
|
"data-slot": "dialog-title",
|
|
@@ -503,7 +514,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
503
514
|
);
|
|
504
515
|
}
|
|
505
516
|
function DialogDescription({ className, ...props }) {
|
|
506
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ jsx5(
|
|
507
518
|
DialogPrimitive.Description,
|
|
508
519
|
{
|
|
509
520
|
"data-slot": "dialog-description",
|
|
@@ -514,7 +525,7 @@ function DialogDescription({ className, ...props }) {
|
|
|
514
525
|
}
|
|
515
526
|
|
|
516
527
|
// src/modals/Iframe3ds.tsx
|
|
517
|
-
import { jsx as
|
|
528
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
518
529
|
var Iframe3ds = NiceModal.create(({ url }) => {
|
|
519
530
|
const modal = useModal();
|
|
520
531
|
useEffect2(() => {
|
|
@@ -527,9 +538,9 @@ var Iframe3ds = NiceModal.create(({ url }) => {
|
|
|
527
538
|
modal.reject();
|
|
528
539
|
modal.remove();
|
|
529
540
|
};
|
|
530
|
-
return /* @__PURE__ */
|
|
531
|
-
/* @__PURE__ */
|
|
532
|
-
/* @__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" })
|
|
533
544
|
] }) });
|
|
534
545
|
});
|
|
535
546
|
Iframe3ds.displayName = "Iframe3ds";
|
|
@@ -600,10 +611,10 @@ var slapiApi = {
|
|
|
600
611
|
throw new Error("slapiApi is not configured. Call registerApi(...) first.");
|
|
601
612
|
}
|
|
602
613
|
};
|
|
603
|
-
var registerApi = (
|
|
604
|
-
cfg.baseUrl =
|
|
605
|
-
cfg.accessToken =
|
|
606
|
-
cfg.tenantId =
|
|
614
|
+
var registerApi = (config2) => {
|
|
615
|
+
cfg.baseUrl = config2.baseUrl;
|
|
616
|
+
cfg.accessToken = config2.accessToken;
|
|
617
|
+
cfg.tenantId = config2.tenantId;
|
|
607
618
|
slapiApi = {
|
|
608
619
|
get: async (key) => {
|
|
609
620
|
const url = buildUrl(key);
|
|
@@ -893,6 +904,7 @@ var usePointsPayment = (mode = "web2") => {
|
|
|
893
904
|
};
|
|
894
905
|
|
|
895
906
|
// src/hooks/payments/useSplitCardPayments.ts
|
|
907
|
+
import NiceModal4 from "@ebay/nice-modal-react";
|
|
896
908
|
var useSplitCardPayments = (mode = "web2") => {
|
|
897
909
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
898
910
|
const { env } = useSpreePayEnv();
|
|
@@ -927,6 +939,12 @@ var useSplitCardPayments = (mode = "web2") => {
|
|
|
927
939
|
amount: points
|
|
928
940
|
}
|
|
929
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
|
+
}
|
|
930
948
|
const cardStatus = await longPollCardStatus(paymentResData.id);
|
|
931
949
|
if (mode === "web3") {
|
|
932
950
|
const wallet = peekAirWallet();
|
|
@@ -989,7 +1007,7 @@ import { Elements } from "@stripe/react-stripe-js";
|
|
|
989
1007
|
import { loadStripe } from "@stripe/stripe-js";
|
|
990
1008
|
|
|
991
1009
|
// src/components/CreditCardTab/CreditCard/CardsList.tsx
|
|
992
|
-
import { jsx as
|
|
1010
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
993
1011
|
var isRemoveDisabled = true;
|
|
994
1012
|
var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
995
1013
|
const handleSelect = () => {
|
|
@@ -999,17 +1017,17 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
999
1017
|
e.stopPropagation();
|
|
1000
1018
|
if (isSelected || isRemoveDisabled) return;
|
|
1001
1019
|
};
|
|
1002
|
-
return /* @__PURE__ */
|
|
1003
|
-
/* @__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(
|
|
1004
1022
|
"div",
|
|
1005
1023
|
{
|
|
1006
1024
|
className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
|
|
1007
1025
|
"bg-primary": isSelected
|
|
1008
1026
|
}),
|
|
1009
|
-
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" }) })
|
|
1010
1028
|
}
|
|
1011
1029
|
),
|
|
1012
|
-
/* @__PURE__ */
|
|
1030
|
+
/* @__PURE__ */ jsxs5(
|
|
1013
1031
|
"div",
|
|
1014
1032
|
{
|
|
1015
1033
|
className: cn(
|
|
@@ -1019,13 +1037,13 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
1019
1037
|
}
|
|
1020
1038
|
),
|
|
1021
1039
|
children: [
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__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: [
|
|
1025
1043
|
"Ending in ",
|
|
1026
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx7("span", { className: "text-black", children: card.lastFourNumbers })
|
|
1027
1045
|
] }),
|
|
1028
|
-
/* @__PURE__ */
|
|
1046
|
+
/* @__PURE__ */ jsx7(
|
|
1029
1047
|
"div",
|
|
1030
1048
|
{
|
|
1031
1049
|
onClick: handleRemoveCard,
|
|
@@ -1033,9 +1051,9 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
1033
1051
|
"cursor-not-allowed opacity-50": isSelected || isRemoveDisabled
|
|
1034
1052
|
// 'cursor-pointer': !isSelected || !isRemoveDisabled,
|
|
1035
1053
|
}),
|
|
1036
|
-
children: /* @__PURE__ */
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__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(
|
|
1039
1057
|
"path",
|
|
1040
1058
|
{
|
|
1041
1059
|
fill: "#000",
|
|
@@ -1055,13 +1073,13 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
1055
1073
|
var CardsList = ({ selectedCard, setCard }) => {
|
|
1056
1074
|
const { cards, cardsIsLoading } = useCards();
|
|
1057
1075
|
if (cardsIsLoading) {
|
|
1058
|
-
return /* @__PURE__ */
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
/* @__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" })
|
|
1061
1079
|
] });
|
|
1062
1080
|
}
|
|
1063
1081
|
if (cards.length === 0) return null;
|
|
1064
|
-
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)) });
|
|
1065
1083
|
};
|
|
1066
1084
|
|
|
1067
1085
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
@@ -1071,7 +1089,7 @@ import { CardCvcElement, CardExpiryElement, CardNumberElement, useElements, useS
|
|
|
1071
1089
|
// src/ui/button.tsx
|
|
1072
1090
|
import { Slot } from "@radix-ui/react-slot";
|
|
1073
1091
|
import { cva } from "class-variance-authority";
|
|
1074
|
-
import { jsx as
|
|
1092
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1075
1093
|
var buttonVariants = cva(
|
|
1076
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",
|
|
1077
1095
|
{
|
|
@@ -1106,15 +1124,15 @@ function Button({
|
|
|
1106
1124
|
...props
|
|
1107
1125
|
}) {
|
|
1108
1126
|
const Comp = asChild ? Slot : "button";
|
|
1109
|
-
return /* @__PURE__ */
|
|
1127
|
+
return /* @__PURE__ */ jsx8(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props });
|
|
1110
1128
|
}
|
|
1111
1129
|
|
|
1112
1130
|
// src/ui/checkbox.tsx
|
|
1113
1131
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
1114
1132
|
import { CheckIcon } from "lucide-react";
|
|
1115
|
-
import { jsx as
|
|
1133
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1116
1134
|
function Checkbox({ className, ...props }) {
|
|
1117
|
-
return /* @__PURE__ */
|
|
1135
|
+
return /* @__PURE__ */ jsx9(
|
|
1118
1136
|
CheckboxPrimitive.Root,
|
|
1119
1137
|
{
|
|
1120
1138
|
"data-slot": "checkbox",
|
|
@@ -1123,12 +1141,12 @@ function Checkbox({ className, ...props }) {
|
|
|
1123
1141
|
className
|
|
1124
1142
|
),
|
|
1125
1143
|
...props,
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1144
|
+
children: /* @__PURE__ */ jsx9(
|
|
1127
1145
|
CheckboxPrimitive.Indicator,
|
|
1128
1146
|
{
|
|
1129
1147
|
"data-slot": "checkbox-indicator",
|
|
1130
1148
|
className: "flex items-center justify-center text-current transition-none",
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1149
|
+
children: /* @__PURE__ */ jsx9(CheckIcon, { className: "size-3.5 text-white" })
|
|
1132
1150
|
}
|
|
1133
1151
|
)
|
|
1134
1152
|
}
|
|
@@ -1137,9 +1155,9 @@ function Checkbox({ className, ...props }) {
|
|
|
1137
1155
|
|
|
1138
1156
|
// src/ui/label.tsx
|
|
1139
1157
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
1140
|
-
import { jsx as
|
|
1158
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1141
1159
|
function Label({ className, ...props }) {
|
|
1142
|
-
return /* @__PURE__ */
|
|
1160
|
+
return /* @__PURE__ */ jsx10(
|
|
1143
1161
|
LabelPrimitive.Root,
|
|
1144
1162
|
{
|
|
1145
1163
|
"data-slot": "label",
|
|
@@ -1153,7 +1171,7 @@ function Label({ className, ...props }) {
|
|
|
1153
1171
|
}
|
|
1154
1172
|
|
|
1155
1173
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
1156
|
-
import { Fragment as Fragment2, jsx as
|
|
1174
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1157
1175
|
var style = {
|
|
1158
1176
|
base: {
|
|
1159
1177
|
fontSize: "16px",
|
|
@@ -1211,9 +1229,9 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1211
1229
|
setCardError("An error occurred while processing your card. Please try again.");
|
|
1212
1230
|
}
|
|
1213
1231
|
};
|
|
1214
|
-
return /* @__PURE__ */
|
|
1215
|
-
/* @__PURE__ */
|
|
1216
|
-
/* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1233
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col gap-1", children: [
|
|
1234
|
+
/* @__PURE__ */ jsx11(
|
|
1217
1235
|
CardNumberElement,
|
|
1218
1236
|
{
|
|
1219
1237
|
options: {
|
|
@@ -1223,8 +1241,8 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1223
1241
|
}
|
|
1224
1242
|
}
|
|
1225
1243
|
),
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex w-full gap-1", children: [
|
|
1245
|
+
/* @__PURE__ */ jsx11(
|
|
1228
1246
|
CardExpiryElement,
|
|
1229
1247
|
{
|
|
1230
1248
|
options: {
|
|
@@ -1234,7 +1252,7 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1234
1252
|
}
|
|
1235
1253
|
}
|
|
1236
1254
|
),
|
|
1237
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ jsx11(
|
|
1238
1256
|
CardCvcElement,
|
|
1239
1257
|
{
|
|
1240
1258
|
options: {
|
|
@@ -1245,24 +1263,24 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1245
1263
|
}
|
|
1246
1264
|
)
|
|
1247
1265
|
] }),
|
|
1248
|
-
cardError && /* @__PURE__ */
|
|
1266
|
+
cardError && /* @__PURE__ */ jsx11("p", { className: "text-destructive mt-1 text-sm", children: cardError })
|
|
1249
1267
|
] }),
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
/* @__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" })
|
|
1253
1271
|
] }),
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
/* @__PURE__ */
|
|
1256
|
-
/* @__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" })
|
|
1257
1275
|
] })
|
|
1258
1276
|
] });
|
|
1259
1277
|
};
|
|
1260
1278
|
|
|
1261
1279
|
// src/components/CreditCardTab/CreditCard/CreditCard.tsx
|
|
1262
|
-
import { Fragment as Fragment3, jsx as
|
|
1280
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1263
1281
|
var StripeWrapper = (props) => {
|
|
1264
1282
|
const stripePromise = useMemo2(() => loadStripe(props.publicKey), [props.publicKey]);
|
|
1265
|
-
return /* @__PURE__ */
|
|
1283
|
+
return /* @__PURE__ */ jsx12(Elements, { stripe: stripePromise, children: /* @__PURE__ */ jsx12(CreditCardForm, { cancel: props.onCancel, saveCard: props.saveNewCard }) });
|
|
1266
1284
|
};
|
|
1267
1285
|
var CreditCard = () => {
|
|
1268
1286
|
const [showForm, setShowForm] = useState4(false);
|
|
@@ -1280,19 +1298,19 @@ var CreditCard = () => {
|
|
|
1280
1298
|
const handleCancel = () => {
|
|
1281
1299
|
setShowForm(false);
|
|
1282
1300
|
};
|
|
1283
|
-
return /* @__PURE__ */
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
!showForm && /* @__PURE__ */
|
|
1286
|
-
/* @__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(
|
|
1287
1305
|
CardsList,
|
|
1288
1306
|
{
|
|
1289
1307
|
selectedCard: selectedPaymentMethod?.type === "CREDIT_CARD" /* CREDIT_CARD */ ? selectedPaymentMethod.method : null,
|
|
1290
1308
|
setCard
|
|
1291
1309
|
}
|
|
1292
1310
|
),
|
|
1293
|
-
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" })
|
|
1294
1312
|
] }),
|
|
1295
|
-
spreePayConfig?.stripePublicKey && showForm && /* @__PURE__ */
|
|
1313
|
+
spreePayConfig?.stripePublicKey && showForm && /* @__PURE__ */ jsx12(StripeWrapper, { onCancel: handleCancel, saveNewCard, publicKey: spreePayConfig.stripePublicKey })
|
|
1296
1314
|
] });
|
|
1297
1315
|
};
|
|
1298
1316
|
|
|
@@ -1304,9 +1322,9 @@ import { useId as useId2 } from "react";
|
|
|
1304
1322
|
|
|
1305
1323
|
// src/ui/switch.tsx
|
|
1306
1324
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
1307
|
-
import { jsx as
|
|
1325
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1308
1326
|
function Switch({ className, ...props }) {
|
|
1309
|
-
return /* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ jsx13(
|
|
1310
1328
|
SwitchPrimitive.Root,
|
|
1311
1329
|
{
|
|
1312
1330
|
"data-slot": "switch",
|
|
@@ -1315,7 +1333,7 @@ function Switch({ className, ...props }) {
|
|
|
1315
1333
|
className
|
|
1316
1334
|
),
|
|
1317
1335
|
...props,
|
|
1318
|
-
children: /* @__PURE__ */
|
|
1336
|
+
children: /* @__PURE__ */ jsx13(
|
|
1319
1337
|
SwitchPrimitive.Thumb,
|
|
1320
1338
|
{
|
|
1321
1339
|
"data-slot": "switch-thumb",
|
|
@@ -1327,35 +1345,35 @@ function Switch({ className, ...props }) {
|
|
|
1327
1345
|
}
|
|
1328
1346
|
|
|
1329
1347
|
// src/components/common/PointsSwitch.tsx
|
|
1330
|
-
import { jsx as
|
|
1348
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1331
1349
|
var PointsSwitch = (props) => {
|
|
1332
1350
|
const { disabled = false, value, onChange, message } = props;
|
|
1333
1351
|
const { spreePayConfig } = useSpreePayConfig();
|
|
1334
1352
|
const { appProps } = useStaticConfig();
|
|
1335
1353
|
const { balance } = useSlapiBalance();
|
|
1336
1354
|
const id = useId2();
|
|
1337
|
-
return /* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1339
|
-
/* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__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(
|
|
1342
1360
|
Label,
|
|
1343
1361
|
{
|
|
1344
1362
|
htmlFor: id,
|
|
1345
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",
|
|
1346
1364
|
children: [
|
|
1347
1365
|
"Use Points ",
|
|
1348
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs font-medium", children: "Optional" })
|
|
1349
1367
|
]
|
|
1350
1368
|
}
|
|
1351
1369
|
)
|
|
1352
1370
|
] }),
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
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: [
|
|
1355
1373
|
formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
|
|
1356
|
-
!!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */
|
|
1374
|
+
!!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ jsx14("span", { className: "text-black/50", children: ` ${formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio)}` })
|
|
1357
1375
|
] }) : null,
|
|
1358
|
-
Boolean(appProps.topUpLink) && /* @__PURE__ */
|
|
1376
|
+
Boolean(appProps.topUpLink) && /* @__PURE__ */ jsx14(
|
|
1359
1377
|
"a",
|
|
1360
1378
|
{
|
|
1361
1379
|
className: "bg-primary cursor-pointer rounded-full px-2 py-1.5 text-xs font-medium text-white",
|
|
@@ -1367,15 +1385,15 @@ var PointsSwitch = (props) => {
|
|
|
1367
1385
|
)
|
|
1368
1386
|
] })
|
|
1369
1387
|
] }),
|
|
1370
|
-
message && /* @__PURE__ */
|
|
1371
|
-
/* @__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(
|
|
1372
1390
|
"path",
|
|
1373
1391
|
{
|
|
1374
1392
|
fill: "#000",
|
|
1375
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"
|
|
1376
1394
|
}
|
|
1377
1395
|
) }),
|
|
1378
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs font-medium text-black", children: message })
|
|
1379
1397
|
] })
|
|
1380
1398
|
] });
|
|
1381
1399
|
};
|
|
@@ -1388,9 +1406,9 @@ import { BUILD_ENV as BUILD_ENV2 } from "@mocanetwork/airkit";
|
|
|
1388
1406
|
import { useState as useState8 } from "react";
|
|
1389
1407
|
|
|
1390
1408
|
// src/ui/input.tsx
|
|
1391
|
-
import { jsx as
|
|
1409
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1392
1410
|
function Input({ className, type, ...props }) {
|
|
1393
|
-
return /* @__PURE__ */
|
|
1411
|
+
return /* @__PURE__ */ jsx15(
|
|
1394
1412
|
"input",
|
|
1395
1413
|
{
|
|
1396
1414
|
type,
|
|
@@ -1467,7 +1485,7 @@ function useComposedRefs(...refs) {
|
|
|
1467
1485
|
|
|
1468
1486
|
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
1469
1487
|
import * as React3 from "react";
|
|
1470
|
-
import { jsx as
|
|
1488
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1471
1489
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1472
1490
|
let defaultContexts = [];
|
|
1473
1491
|
function createContext32(rootComponentName, defaultContext) {
|
|
@@ -1478,7 +1496,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
1478
1496
|
const { scope, children, ...context } = props;
|
|
1479
1497
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1480
1498
|
const value = React3.useMemo(() => context, Object.values(context));
|
|
1481
|
-
return /* @__PURE__ */
|
|
1499
|
+
return /* @__PURE__ */ jsx16(Context.Provider, { value, children });
|
|
1482
1500
|
};
|
|
1483
1501
|
Provider.displayName = rootComponentName + "Provider";
|
|
1484
1502
|
function useContext22(consumerName, scope) {
|
|
@@ -1603,7 +1621,7 @@ function isFunction(value) {
|
|
|
1603
1621
|
|
|
1604
1622
|
// ../../node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
1605
1623
|
import * as React6 from "react";
|
|
1606
|
-
import { jsx as
|
|
1624
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1607
1625
|
var DirectionContext = React6.createContext(void 0);
|
|
1608
1626
|
function useDirection(localDir) {
|
|
1609
1627
|
const globalDir = React6.useContext(DirectionContext);
|
|
@@ -1664,7 +1682,7 @@ function useSize(element) {
|
|
|
1664
1682
|
import * as React9 from "react";
|
|
1665
1683
|
import * as ReactDOM from "react-dom";
|
|
1666
1684
|
import { createSlot } from "@radix-ui/react-slot";
|
|
1667
|
-
import { jsx as
|
|
1685
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1668
1686
|
var NODES = [
|
|
1669
1687
|
"a",
|
|
1670
1688
|
"button",
|
|
@@ -1692,7 +1710,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
1692
1710
|
if (typeof window !== "undefined") {
|
|
1693
1711
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
1694
1712
|
}
|
|
1695
|
-
return /* @__PURE__ */
|
|
1713
|
+
return /* @__PURE__ */ jsx18(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
1696
1714
|
});
|
|
1697
1715
|
Node2.displayName = `Primitive.${node}`;
|
|
1698
1716
|
return { ...primitive, [node]: Node2 };
|
|
@@ -1701,7 +1719,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
1701
1719
|
// ../../node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
1702
1720
|
import React10 from "react";
|
|
1703
1721
|
import { createSlot as createSlot2 } from "@radix-ui/react-slot";
|
|
1704
|
-
import { jsx as
|
|
1722
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1705
1723
|
import React23 from "react";
|
|
1706
1724
|
import { createSlot as createSlot22 } from "@radix-ui/react-slot";
|
|
1707
1725
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
@@ -1716,7 +1734,7 @@ function createCollection(name) {
|
|
|
1716
1734
|
const { scope, children } = props;
|
|
1717
1735
|
const ref = React10.useRef(null);
|
|
1718
1736
|
const itemMap = React10.useRef(/* @__PURE__ */ new Map()).current;
|
|
1719
|
-
return /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ jsx19(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
1720
1738
|
};
|
|
1721
1739
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
1722
1740
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
@@ -1726,7 +1744,7 @@ function createCollection(name) {
|
|
|
1726
1744
|
const { scope, children } = props;
|
|
1727
1745
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
1728
1746
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
1729
|
-
return /* @__PURE__ */
|
|
1747
|
+
return /* @__PURE__ */ jsx19(CollectionSlotImpl, { ref: composedRefs, children });
|
|
1730
1748
|
}
|
|
1731
1749
|
);
|
|
1732
1750
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
@@ -1743,7 +1761,7 @@ function createCollection(name) {
|
|
|
1743
1761
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
1744
1762
|
return () => void context.itemMap.delete(ref);
|
|
1745
1763
|
});
|
|
1746
|
-
return /* @__PURE__ */
|
|
1764
|
+
return /* @__PURE__ */ jsx19(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
1747
1765
|
}
|
|
1748
1766
|
);
|
|
1749
1767
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
@@ -1769,7 +1787,7 @@ function createCollection(name) {
|
|
|
1769
1787
|
}
|
|
1770
1788
|
|
|
1771
1789
|
// ../../node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
1772
|
-
import { jsx as
|
|
1790
|
+
import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1773
1791
|
var PAGE_KEYS = ["PageUp", "PageDown"];
|
|
1774
1792
|
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
1775
1793
|
var BACK_KEYS = {
|
|
@@ -1847,7 +1865,7 @@ var Slider = React11.forwardRef(
|
|
|
1847
1865
|
}
|
|
1848
1866
|
});
|
|
1849
1867
|
}
|
|
1850
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsx20(
|
|
1851
1869
|
SliderProvider,
|
|
1852
1870
|
{
|
|
1853
1871
|
scope: props.__scopeSlider,
|
|
@@ -1860,7 +1878,7 @@ var Slider = React11.forwardRef(
|
|
|
1860
1878
|
values,
|
|
1861
1879
|
orientation,
|
|
1862
1880
|
form,
|
|
1863
|
-
children: /* @__PURE__ */
|
|
1881
|
+
children: /* @__PURE__ */ jsx20(Collection.Provider, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsx20(Collection.Slot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsx20(
|
|
1864
1882
|
SliderOrientation,
|
|
1865
1883
|
{
|
|
1866
1884
|
"aria-disabled": disabled,
|
|
@@ -1929,7 +1947,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
1929
1947
|
rectRef.current = rect;
|
|
1930
1948
|
return value(pointerPosition - rect.left);
|
|
1931
1949
|
}
|
|
1932
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ jsx20(
|
|
1933
1951
|
SliderOrientationProvider,
|
|
1934
1952
|
{
|
|
1935
1953
|
scope: props.__scopeSlider,
|
|
@@ -1937,7 +1955,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
1937
1955
|
endEdge: isSlidingFromLeft ? "right" : "left",
|
|
1938
1956
|
direction: isSlidingFromLeft ? 1 : -1,
|
|
1939
1957
|
size: "width",
|
|
1940
|
-
children: /* @__PURE__ */
|
|
1958
|
+
children: /* @__PURE__ */ jsx20(
|
|
1941
1959
|
SliderImpl,
|
|
1942
1960
|
{
|
|
1943
1961
|
dir: direction,
|
|
@@ -1995,7 +2013,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
1995
2013
|
rectRef.current = rect;
|
|
1996
2014
|
return value(pointerPosition - rect.top);
|
|
1997
2015
|
}
|
|
1998
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ jsx20(
|
|
1999
2017
|
SliderOrientationProvider,
|
|
2000
2018
|
{
|
|
2001
2019
|
scope: props.__scopeSlider,
|
|
@@ -2003,7 +2021,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
2003
2021
|
endEdge: isSlidingFromBottom ? "top" : "bottom",
|
|
2004
2022
|
size: "height",
|
|
2005
2023
|
direction: isSlidingFromBottom ? 1 : -1,
|
|
2006
|
-
children: /* @__PURE__ */
|
|
2024
|
+
children: /* @__PURE__ */ jsx20(
|
|
2007
2025
|
SliderImpl,
|
|
2008
2026
|
{
|
|
2009
2027
|
"data-orientation": "vertical",
|
|
@@ -2049,7 +2067,7 @@ var SliderImpl = React11.forwardRef(
|
|
|
2049
2067
|
...sliderProps
|
|
2050
2068
|
} = props;
|
|
2051
2069
|
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
2052
|
-
return /* @__PURE__ */
|
|
2070
|
+
return /* @__PURE__ */ jsx20(
|
|
2053
2071
|
Primitive.span,
|
|
2054
2072
|
{
|
|
2055
2073
|
...sliderProps,
|
|
@@ -2096,7 +2114,7 @@ var SliderTrack = React11.forwardRef(
|
|
|
2096
2114
|
(props, forwardedRef) => {
|
|
2097
2115
|
const { __scopeSlider, ...trackProps } = props;
|
|
2098
2116
|
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
2099
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ jsx20(
|
|
2100
2118
|
Primitive.span,
|
|
2101
2119
|
{
|
|
2102
2120
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -2122,7 +2140,7 @@ var SliderRange = React11.forwardRef(
|
|
|
2122
2140
|
);
|
|
2123
2141
|
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
2124
2142
|
const offsetEnd = 100 - Math.max(...percentages);
|
|
2125
|
-
return /* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsx20(
|
|
2126
2144
|
Primitive.span,
|
|
2127
2145
|
{
|
|
2128
2146
|
"data-orientation": context.orientation,
|
|
@@ -2149,7 +2167,7 @@ var SliderThumb = React11.forwardRef(
|
|
|
2149
2167
|
() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1,
|
|
2150
2168
|
[getItems, thumb]
|
|
2151
2169
|
);
|
|
2152
|
-
return /* @__PURE__ */
|
|
2170
|
+
return /* @__PURE__ */ jsx20(SliderThumbImpl, { ...props, ref: composedRefs, index });
|
|
2153
2171
|
}
|
|
2154
2172
|
);
|
|
2155
2173
|
var SliderThumbImpl = React11.forwardRef(
|
|
@@ -2174,7 +2192,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2174
2192
|
};
|
|
2175
2193
|
}
|
|
2176
2194
|
}, [thumb, context.thumbs]);
|
|
2177
|
-
return /* @__PURE__ */
|
|
2195
|
+
return /* @__PURE__ */ jsxs9(
|
|
2178
2196
|
"span",
|
|
2179
2197
|
{
|
|
2180
2198
|
style: {
|
|
@@ -2183,7 +2201,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2183
2201
|
[orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
|
|
2184
2202
|
},
|
|
2185
2203
|
children: [
|
|
2186
|
-
/* @__PURE__ */
|
|
2204
|
+
/* @__PURE__ */ jsx20(Collection.ItemSlot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsx20(
|
|
2187
2205
|
Primitive.span,
|
|
2188
2206
|
{
|
|
2189
2207
|
role: "slider",
|
|
@@ -2203,7 +2221,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2203
2221
|
})
|
|
2204
2222
|
}
|
|
2205
2223
|
) }),
|
|
2206
|
-
isFormControl && /* @__PURE__ */
|
|
2224
|
+
isFormControl && /* @__PURE__ */ jsx20(
|
|
2207
2225
|
SliderBubbleInput,
|
|
2208
2226
|
{
|
|
2209
2227
|
name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
|
|
@@ -2236,7 +2254,7 @@ var SliderBubbleInput = React11.forwardRef(
|
|
|
2236
2254
|
input.dispatchEvent(event);
|
|
2237
2255
|
}
|
|
2238
2256
|
}, [prevValue, value]);
|
|
2239
|
-
return /* @__PURE__ */
|
|
2257
|
+
return /* @__PURE__ */ jsx20(
|
|
2240
2258
|
Primitive.input,
|
|
2241
2259
|
{
|
|
2242
2260
|
style: { display: "none" },
|
|
@@ -2318,14 +2336,14 @@ function cn2(...inputs) {
|
|
|
2318
2336
|
}
|
|
2319
2337
|
|
|
2320
2338
|
// src/ui/slider.tsx
|
|
2321
|
-
import { jsx as
|
|
2339
|
+
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2322
2340
|
function Slider2(props) {
|
|
2323
2341
|
const { className, defaultValue, value, min = 0, max = 100, ...rest } = props;
|
|
2324
2342
|
const _values = React12.useMemo(
|
|
2325
2343
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
2326
2344
|
[value, defaultValue, min, max]
|
|
2327
2345
|
);
|
|
2328
|
-
return /* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ jsxs10(
|
|
2329
2347
|
Root5,
|
|
2330
2348
|
{
|
|
2331
2349
|
"data-slot": "slider",
|
|
@@ -2339,14 +2357,14 @@ function Slider2(props) {
|
|
|
2339
2357
|
),
|
|
2340
2358
|
...rest,
|
|
2341
2359
|
children: [
|
|
2342
|
-
/* @__PURE__ */
|
|
2360
|
+
/* @__PURE__ */ jsx21(
|
|
2343
2361
|
Track,
|
|
2344
2362
|
{
|
|
2345
2363
|
"data-slot": "slider-track",
|
|
2346
2364
|
className: cn2(
|
|
2347
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"
|
|
2348
2366
|
),
|
|
2349
|
-
children: /* @__PURE__ */
|
|
2367
|
+
children: /* @__PURE__ */ jsx21(
|
|
2350
2368
|
Range,
|
|
2351
2369
|
{
|
|
2352
2370
|
"data-slot": "slider-range",
|
|
@@ -2355,11 +2373,11 @@ function Slider2(props) {
|
|
|
2355
2373
|
)
|
|
2356
2374
|
}
|
|
2357
2375
|
),
|
|
2358
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */
|
|
2376
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsx21(
|
|
2359
2377
|
Thumb2,
|
|
2360
2378
|
{
|
|
2361
2379
|
"data-slot": "slider-thumb",
|
|
2362
|
-
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"
|
|
2363
2381
|
},
|
|
2364
2382
|
index
|
|
2365
2383
|
))
|
|
@@ -2369,7 +2387,7 @@ function Slider2(props) {
|
|
|
2369
2387
|
}
|
|
2370
2388
|
|
|
2371
2389
|
// src/components/CreditCardTab/Points/PointsSelector.tsx
|
|
2372
|
-
import { jsx as
|
|
2390
|
+
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2373
2391
|
var PointsSelector = (props) => {
|
|
2374
2392
|
const { isDisabled, isSelected, onSelect, children } = props;
|
|
2375
2393
|
const { balance } = useSlapiBalance();
|
|
@@ -2388,31 +2406,31 @@ var PointsSelector = (props) => {
|
|
|
2388
2406
|
};
|
|
2389
2407
|
const pointsValue = String(Math.round(splitTokens));
|
|
2390
2408
|
const usdValue = formatUSD(usdAmount + getTransactionFee(usdAmount, appProps.transactionFeePercentage));
|
|
2391
|
-
return /* @__PURE__ */
|
|
2409
|
+
return /* @__PURE__ */ jsxs11(
|
|
2392
2410
|
"button",
|
|
2393
2411
|
{
|
|
2394
2412
|
disabled: isDisabled,
|
|
2395
2413
|
onClick: onSelect,
|
|
2396
|
-
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", {
|
|
2397
2415
|
"border-primary": isSelected,
|
|
2398
2416
|
"cursor-not-allowed opacity-50": isDisabled
|
|
2399
2417
|
}),
|
|
2400
2418
|
children: [
|
|
2401
|
-
/* @__PURE__ */
|
|
2402
|
-
/* @__PURE__ */
|
|
2419
|
+
/* @__PURE__ */ jsxs11("div", { className: cn("flex h-11 w-full", { "bg-black/4": isSelected }), children: [
|
|
2420
|
+
/* @__PURE__ */ jsx23(
|
|
2403
2421
|
"div",
|
|
2404
2422
|
{
|
|
2405
2423
|
className: cn("flex h-full w-11 items-center justify-center bg-black/10", {
|
|
2406
2424
|
"bg-primary": isSelected
|
|
2407
2425
|
}),
|
|
2408
|
-
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" }) })
|
|
2409
2427
|
}
|
|
2410
2428
|
),
|
|
2411
|
-
/* @__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 })
|
|
2412
2430
|
] }),
|
|
2413
|
-
isSelected && /* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__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(
|
|
2416
2434
|
Input,
|
|
2417
2435
|
{
|
|
2418
2436
|
readOnly: true,
|
|
@@ -2423,9 +2441,9 @@ var PointsSelector = (props) => {
|
|
|
2423
2441
|
onClick: (e) => e.stopPropagation()
|
|
2424
2442
|
}
|
|
2425
2443
|
),
|
|
2426
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx23("p", { className: "text-left text-xs leading-[20px] text-black/45", children: "Points" })
|
|
2427
2445
|
] }),
|
|
2428
|
-
/* @__PURE__ */
|
|
2446
|
+
/* @__PURE__ */ jsx23("div", { className: "flex w-full items-center pb-6", children: /* @__PURE__ */ jsx23(
|
|
2429
2447
|
Slider2,
|
|
2430
2448
|
{
|
|
2431
2449
|
value: [splitTokens],
|
|
@@ -2437,8 +2455,8 @@ var PointsSelector = (props) => {
|
|
|
2437
2455
|
step
|
|
2438
2456
|
}
|
|
2439
2457
|
) }),
|
|
2440
|
-
/* @__PURE__ */
|
|
2441
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1", children: [
|
|
2459
|
+
/* @__PURE__ */ jsx23(
|
|
2442
2460
|
Input,
|
|
2443
2461
|
{
|
|
2444
2462
|
readOnly: true,
|
|
@@ -2449,7 +2467,7 @@ var PointsSelector = (props) => {
|
|
|
2449
2467
|
onClick: (e) => e.stopPropagation()
|
|
2450
2468
|
}
|
|
2451
2469
|
),
|
|
2452
|
-
/* @__PURE__ */
|
|
2470
|
+
/* @__PURE__ */ jsx23("p", { className: "text-left text-xs leading-[20px] text-black/45", children: "Card" })
|
|
2453
2471
|
] })
|
|
2454
2472
|
] }) })
|
|
2455
2473
|
]
|
|
@@ -2458,7 +2476,7 @@ var PointsSelector = (props) => {
|
|
|
2458
2476
|
};
|
|
2459
2477
|
|
|
2460
2478
|
// src/components/CreditCardTab/Points/SplitBlock.tsx
|
|
2461
|
-
import { jsx as
|
|
2479
|
+
import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2462
2480
|
var SplitBlock = (props) => {
|
|
2463
2481
|
const { onToggle, isSelected, onSelect } = props;
|
|
2464
2482
|
const { balance, isBalanceLoading } = useSlapiBalance();
|
|
@@ -2502,21 +2520,21 @@ var SplitBlock = (props) => {
|
|
|
2502
2520
|
doInit();
|
|
2503
2521
|
}, [spreePayConfig?.pointsChain, initWallet, env.useWeb3Points]);
|
|
2504
2522
|
const isPointsSelectorDisabled = env.useWeb3Points ? !walletReady : false;
|
|
2505
|
-
return /* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2507
|
-
/* @__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" }),
|
|
2508
2526
|
" ",
|
|
2509
2527
|
formatPoints(balance.availablePoints, pointsTitle),
|
|
2510
2528
|
" ",
|
|
2511
|
-
pointsConversionRatio && /* @__PURE__ */
|
|
2529
|
+
pointsConversionRatio && /* @__PURE__ */ jsx24("span", { className: "text-black/50", children: formatUSD(balance.availablePoints * pointsConversionRatio) })
|
|
2512
2530
|
] }) : null }),
|
|
2513
|
-
isBalanceLoading ? /* @__PURE__ */
|
|
2514
|
-
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 })
|
|
2515
2533
|
] }) });
|
|
2516
2534
|
};
|
|
2517
2535
|
|
|
2518
2536
|
// src/components/CreditCardTab/Points/Points.tsx
|
|
2519
|
-
import { Fragment as Fragment4, jsx as
|
|
2537
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2520
2538
|
var Points = () => {
|
|
2521
2539
|
const [usePoints, setUsePoints] = useState10(false);
|
|
2522
2540
|
const [selectedPointsType, setSelectedPointsType] = useState10(null);
|
|
@@ -2530,8 +2548,8 @@ var Points = () => {
|
|
|
2530
2548
|
setSelectedPaymentMethod({ ...selectedPaymentMethod, splitAmount: void 0 });
|
|
2531
2549
|
}
|
|
2532
2550
|
};
|
|
2533
|
-
return /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2552
|
+
/* @__PURE__ */ jsx25(
|
|
2535
2553
|
PointsSwitch,
|
|
2536
2554
|
{
|
|
2537
2555
|
value: usePoints,
|
|
@@ -2540,7 +2558,7 @@ var Points = () => {
|
|
|
2540
2558
|
disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points || appProps.disabledPoints
|
|
2541
2559
|
}
|
|
2542
2560
|
),
|
|
2543
|
-
usePoints && /* @__PURE__ */
|
|
2561
|
+
usePoints && /* @__PURE__ */ jsx25(
|
|
2544
2562
|
SplitBlock,
|
|
2545
2563
|
{
|
|
2546
2564
|
onToggle: handleTogglePoints,
|
|
@@ -2552,7 +2570,7 @@ var Points = () => {
|
|
|
2552
2570
|
};
|
|
2553
2571
|
|
|
2554
2572
|
// src/components/CreditCardTab/CreditCardTab.tsx
|
|
2555
|
-
import { jsx as
|
|
2573
|
+
import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2556
2574
|
var CreditCardTab = () => {
|
|
2557
2575
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
2558
2576
|
const { env } = useSpreePayEnv();
|
|
@@ -2607,16 +2625,16 @@ var CreditCardTab = () => {
|
|
|
2607
2625
|
useEffect7(() => {
|
|
2608
2626
|
register(handlePay);
|
|
2609
2627
|
}, [register, handlePay]);
|
|
2610
|
-
return /* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2612
|
-
/* @__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, {}) })
|
|
2613
2631
|
] });
|
|
2614
2632
|
};
|
|
2615
2633
|
|
|
2616
2634
|
// src/components/CryptoTab/Crypto/CryptoWrapper.tsx
|
|
2617
2635
|
import { useMemo as useMemo9 } from "react";
|
|
2618
2636
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
2619
|
-
import
|
|
2637
|
+
import NiceModal7 from "@ebay/nice-modal-react";
|
|
2620
2638
|
import { RainbowKitProvider, getDefaultConfig, lightTheme } from "@rainbow-me/rainbowkit";
|
|
2621
2639
|
import "@rainbow-me/rainbowkit/styles.css";
|
|
2622
2640
|
import { WagmiProvider } from "wagmi";
|
|
@@ -2639,9 +2657,9 @@ function getAction(client, actionFn, name) {
|
|
|
2639
2657
|
|
|
2640
2658
|
// ../../node_modules/@wagmi/core/dist/esm/actions/readContract.js
|
|
2641
2659
|
import { readContract as viem_readContract } from "viem/actions";
|
|
2642
|
-
function readContract(
|
|
2660
|
+
function readContract(config2, parameters) {
|
|
2643
2661
|
const { chainId, ...rest } = parameters;
|
|
2644
|
-
const client =
|
|
2662
|
+
const client = config2.getClient({ chainId });
|
|
2645
2663
|
const action = getAction(client, viem_readContract, "readContract");
|
|
2646
2664
|
return action(rest);
|
|
2647
2665
|
}
|
|
@@ -2649,9 +2667,9 @@ function readContract(config, parameters) {
|
|
|
2649
2667
|
// ../../node_modules/@wagmi/core/dist/esm/actions/waitForTransactionReceipt.js
|
|
2650
2668
|
import { hexToString } from "viem";
|
|
2651
2669
|
import { call, getTransaction, waitForTransactionReceipt as viem_waitForTransactionReceipt } from "viem/actions";
|
|
2652
|
-
async function waitForTransactionReceipt(
|
|
2670
|
+
async function waitForTransactionReceipt(config2, parameters) {
|
|
2653
2671
|
const { chainId, timeout = 0, ...rest } = parameters;
|
|
2654
|
-
const client =
|
|
2672
|
+
const client = config2.getClient({ chainId });
|
|
2655
2673
|
const action = getAction(client, viem_waitForTransactionReceipt, "waitForTransactionReceipt");
|
|
2656
2674
|
const receipt = await action({ ...rest, timeout });
|
|
2657
2675
|
if (receipt.status === "reverted") {
|
|
@@ -2726,7 +2744,7 @@ var MAX_UINT256 = BigInt(2) ** BigInt(256) - BigInt(1);
|
|
|
2726
2744
|
var useCryptoPayment = () => {
|
|
2727
2745
|
const { data: walletClient } = useWalletClient();
|
|
2728
2746
|
const { spreePayConfig } = useSpreePayConfig();
|
|
2729
|
-
const
|
|
2747
|
+
const config2 = useConfig();
|
|
2730
2748
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
2731
2749
|
const cryptoPayment = async (params) => {
|
|
2732
2750
|
if (!walletClient) {
|
|
@@ -2745,7 +2763,7 @@ var useCryptoPayment = () => {
|
|
|
2745
2763
|
if (!tokenAddress) {
|
|
2746
2764
|
throw new Error("Token address not found");
|
|
2747
2765
|
}
|
|
2748
|
-
const allowance = await readContract(
|
|
2766
|
+
const allowance = await readContract(config2, {
|
|
2749
2767
|
address: tokenAddress,
|
|
2750
2768
|
abi: erc20Abi2,
|
|
2751
2769
|
functionName: "allowance",
|
|
@@ -2758,7 +2776,7 @@ var useCryptoPayment = () => {
|
|
|
2758
2776
|
functionName: "approve",
|
|
2759
2777
|
args: [spreePayConfig.crypto.oneInchAggregationRouter, MAX_UINT256]
|
|
2760
2778
|
});
|
|
2761
|
-
await waitForTransactionReceipt(
|
|
2779
|
+
await waitForTransactionReceipt(config2, {
|
|
2762
2780
|
hash: result,
|
|
2763
2781
|
confirmations: 1
|
|
2764
2782
|
// You can change the number of block confirmations as per your requirement
|
|
@@ -2798,38 +2816,38 @@ var useCryptoPayment = () => {
|
|
|
2798
2816
|
|
|
2799
2817
|
// src/components/CryptoTab/Crypto/ConnectButton.tsx
|
|
2800
2818
|
import { ConnectButton as RainbowButton } from "@rainbow-me/rainbowkit";
|
|
2801
|
-
import { Fragment as Fragment5, jsx as
|
|
2819
|
+
import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2802
2820
|
var ConnectButton = () => {
|
|
2803
|
-
return /* @__PURE__ */
|
|
2821
|
+
return /* @__PURE__ */ jsx27(RainbowButton.Custom, { children: ({ mounted, chain, account, openAccountModal, openChainModal, openConnectModal }) => {
|
|
2804
2822
|
if (!mounted) return null;
|
|
2805
|
-
return /* @__PURE__ */
|
|
2823
|
+
return /* @__PURE__ */ jsx27(Fragment5, { children: (() => {
|
|
2806
2824
|
if (!mounted || !account || !chain) {
|
|
2807
|
-
return /* @__PURE__ */
|
|
2825
|
+
return /* @__PURE__ */ jsx27(
|
|
2808
2826
|
"button",
|
|
2809
2827
|
{
|
|
2810
|
-
className: "h-[34px] rounded-md border
|
|
2828
|
+
className: "h-[34px] rounded-md border border-black px-3 text-sm font-medium text-black",
|
|
2811
2829
|
onClick: openConnectModal,
|
|
2812
2830
|
children: "Connect a Wallet"
|
|
2813
2831
|
}
|
|
2814
2832
|
);
|
|
2815
2833
|
}
|
|
2816
2834
|
if (chain.unsupported) {
|
|
2817
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ jsx27(
|
|
2818
2836
|
"button",
|
|
2819
2837
|
{
|
|
2820
|
-
className: "h-[34px] rounded-md border
|
|
2838
|
+
className: "h-[34px] rounded-md border border-black px-3 text-sm font-medium text-black",
|
|
2821
2839
|
onClick: openChainModal,
|
|
2822
2840
|
children: "Select a Network"
|
|
2823
2841
|
}
|
|
2824
2842
|
);
|
|
2825
2843
|
}
|
|
2826
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ jsxs15(
|
|
2827
2845
|
"button",
|
|
2828
2846
|
{
|
|
2829
|
-
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",
|
|
2830
2848
|
onClick: openAccountModal,
|
|
2831
2849
|
children: [
|
|
2832
|
-
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 }) }),
|
|
2833
2851
|
account.displayName
|
|
2834
2852
|
]
|
|
2835
2853
|
}
|
|
@@ -2839,29 +2857,29 @@ var ConnectButton = () => {
|
|
|
2839
2857
|
};
|
|
2840
2858
|
|
|
2841
2859
|
// src/config/symbolLogos.tsx
|
|
2842
|
-
import { jsx as
|
|
2843
|
-
var MOCA_SVG = /* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__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(
|
|
2846
2864
|
"path",
|
|
2847
2865
|
{
|
|
2848
2866
|
fill: "#fff",
|
|
2849
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"
|
|
2850
2868
|
}
|
|
2851
2869
|
),
|
|
2852
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ jsx28("circle", { cx: "16", cy: "14", r: "1.5", fill: "#fff" })
|
|
2853
2871
|
] });
|
|
2854
|
-
var USDC_SVG = /* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__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(
|
|
2858
2876
|
"path",
|
|
2859
2877
|
{
|
|
2860
2878
|
fill: "#fff",
|
|
2861
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"
|
|
2862
2880
|
}
|
|
2863
2881
|
),
|
|
2864
|
-
/* @__PURE__ */
|
|
2882
|
+
/* @__PURE__ */ jsx28(
|
|
2865
2883
|
"path",
|
|
2866
2884
|
{
|
|
2867
2885
|
fill: "#fff",
|
|
@@ -2869,11 +2887,11 @@ var USDC_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2869
2887
|
}
|
|
2870
2888
|
)
|
|
2871
2889
|
] }),
|
|
2872
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ jsx28("defs", { children: /* @__PURE__ */ jsx28("clipPath", { id: "clip0_528_9163", children: /* @__PURE__ */ jsx28("path", { fill: "#fff", d: "M0 0h28v28H0z" }) }) })
|
|
2873
2891
|
] });
|
|
2874
|
-
var USDT_SVG = /* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__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(
|
|
2877
2895
|
"path",
|
|
2878
2896
|
{
|
|
2879
2897
|
fill: "#fff",
|
|
@@ -2881,23 +2899,23 @@ var USDT_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2881
2899
|
}
|
|
2882
2900
|
)
|
|
2883
2901
|
] });
|
|
2884
|
-
var WETH_SVG = /* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
/* @__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(
|
|
2887
2905
|
"path",
|
|
2888
2906
|
{
|
|
2889
2907
|
fill: "#000",
|
|
2890
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"
|
|
2891
2909
|
}
|
|
2892
2910
|
),
|
|
2893
|
-
/* @__PURE__ */
|
|
2911
|
+
/* @__PURE__ */ jsx28(
|
|
2894
2912
|
"path",
|
|
2895
2913
|
{
|
|
2896
2914
|
fill: "#F61F7D",
|
|
2897
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"
|
|
2898
2916
|
}
|
|
2899
2917
|
),
|
|
2900
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ jsx28(
|
|
2901
2919
|
"path",
|
|
2902
2920
|
{
|
|
2903
2921
|
fill: "#000",
|
|
@@ -2906,8 +2924,8 @@ var WETH_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2906
2924
|
clipRule: "evenodd"
|
|
2907
2925
|
}
|
|
2908
2926
|
),
|
|
2909
|
-
/* @__PURE__ */
|
|
2910
|
-
/* @__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(
|
|
2911
2929
|
"path",
|
|
2912
2930
|
{
|
|
2913
2931
|
fill: "#000",
|
|
@@ -2916,8 +2934,8 @@ var WETH_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2916
2934
|
clipRule: "evenodd"
|
|
2917
2935
|
}
|
|
2918
2936
|
),
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
/* @__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(
|
|
2921
2939
|
"path",
|
|
2922
2940
|
{
|
|
2923
2941
|
fill: "#000",
|
|
@@ -2925,7 +2943,7 @@ var WETH_SVG = /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/sv
|
|
|
2925
2943
|
}
|
|
2926
2944
|
)
|
|
2927
2945
|
] }),
|
|
2928
|
-
/* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsx28("defs", { children: /* @__PURE__ */ jsx28("clipPath", { id: "clip0_528_9173", children: /* @__PURE__ */ jsx28("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
2929
2947
|
] });
|
|
2930
2948
|
var symbolLogos = {
|
|
2931
2949
|
MOCA: MOCA_SVG,
|
|
@@ -2938,33 +2956,33 @@ function getSymbolLogo(symbol) {
|
|
|
2938
2956
|
}
|
|
2939
2957
|
|
|
2940
2958
|
// src/components/CryptoTab/Crypto/Logos.tsx
|
|
2941
|
-
import { jsx as
|
|
2959
|
+
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2942
2960
|
var Logos = () => {
|
|
2943
|
-
return /* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__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") })
|
|
2948
2966
|
] });
|
|
2949
2967
|
};
|
|
2950
2968
|
|
|
2951
2969
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
2952
|
-
import
|
|
2970
|
+
import NiceModal6 from "@ebay/nice-modal-react";
|
|
2953
2971
|
|
|
2954
2972
|
// src/modals/CryptoSelectModal.tsx
|
|
2955
2973
|
import { useMemo as useMemo8, useState as useState12 } from "react";
|
|
2956
|
-
import
|
|
2974
|
+
import NiceModal5, { useModal as useModal2 } from "@ebay/nice-modal-react";
|
|
2957
2975
|
|
|
2958
2976
|
// ../ui/src/components/input.tsx
|
|
2959
|
-
import { jsx as
|
|
2977
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2960
2978
|
function Input2({ className, type, ...props }) {
|
|
2961
|
-
return /* @__PURE__ */
|
|
2979
|
+
return /* @__PURE__ */ jsx30(
|
|
2962
2980
|
"input",
|
|
2963
2981
|
{
|
|
2964
2982
|
type,
|
|
2965
2983
|
"data-slot": "input",
|
|
2966
2984
|
className: cn2(
|
|
2967
|
-
"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",
|
|
2968
2986
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
2969
2987
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
2970
2988
|
className
|
|
@@ -2981,7 +2999,7 @@ import * as React14 from "react";
|
|
|
2981
2999
|
import * as React13 from "react";
|
|
2982
3000
|
import * as ReactDOM2 from "react-dom";
|
|
2983
3001
|
import { createSlot as createSlot3 } from "@radix-ui/react-slot";
|
|
2984
|
-
import { jsx as
|
|
3002
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2985
3003
|
var NODES2 = [
|
|
2986
3004
|
"a",
|
|
2987
3005
|
"button",
|
|
@@ -3009,14 +3027,14 @@ var Primitive2 = NODES2.reduce((primitive, node) => {
|
|
|
3009
3027
|
if (typeof window !== "undefined") {
|
|
3010
3028
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
3011
3029
|
}
|
|
3012
|
-
return /* @__PURE__ */
|
|
3030
|
+
return /* @__PURE__ */ jsx31(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
3013
3031
|
});
|
|
3014
3032
|
Node2.displayName = `Primitive.${node}`;
|
|
3015
3033
|
return { ...primitive, [node]: Node2 };
|
|
3016
3034
|
}, {});
|
|
3017
3035
|
|
|
3018
3036
|
// ../../node_modules/@radix-ui/react-separator/dist/index.mjs
|
|
3019
|
-
import { jsx as
|
|
3037
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
3020
3038
|
var NAME = "Separator";
|
|
3021
3039
|
var DEFAULT_ORIENTATION = "horizontal";
|
|
3022
3040
|
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
@@ -3025,7 +3043,7 @@ var Separator = React14.forwardRef((props, forwardedRef) => {
|
|
|
3025
3043
|
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
3026
3044
|
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
3027
3045
|
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
3028
|
-
return /* @__PURE__ */
|
|
3046
|
+
return /* @__PURE__ */ jsx32(
|
|
3029
3047
|
Primitive2.div,
|
|
3030
3048
|
{
|
|
3031
3049
|
"data-orientation": orientation,
|
|
@@ -3042,21 +3060,21 @@ function isValidOrientation(orientation) {
|
|
|
3042
3060
|
var Root6 = Separator;
|
|
3043
3061
|
|
|
3044
3062
|
// ../ui/src/components/separator.tsx
|
|
3045
|
-
import { jsx as
|
|
3063
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
3046
3064
|
function Separator2({
|
|
3047
3065
|
className,
|
|
3048
3066
|
orientation = "horizontal",
|
|
3049
3067
|
decorative = true,
|
|
3050
3068
|
...props
|
|
3051
3069
|
}) {
|
|
3052
|
-
return /* @__PURE__ */
|
|
3070
|
+
return /* @__PURE__ */ jsx33(
|
|
3053
3071
|
Root6,
|
|
3054
3072
|
{
|
|
3055
3073
|
"data-slot": "separator",
|
|
3056
3074
|
decorative,
|
|
3057
3075
|
orientation,
|
|
3058
3076
|
className: cn2(
|
|
3059
|
-
"
|
|
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",
|
|
3060
3078
|
className
|
|
3061
3079
|
),
|
|
3062
3080
|
...props
|
|
@@ -3156,8 +3174,8 @@ var useBaseTokens = () => {
|
|
|
3156
3174
|
};
|
|
3157
3175
|
|
|
3158
3176
|
// src/modals/CryptoSelectModal.tsx
|
|
3159
|
-
import { Fragment as Fragment6, jsx as
|
|
3160
|
-
var CryptoSelectModal =
|
|
3177
|
+
import { Fragment as Fragment6, jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3178
|
+
var CryptoSelectModal = NiceModal5.create(() => {
|
|
3161
3179
|
const modal = useModal2();
|
|
3162
3180
|
const { isLoading, error, erc20Balances } = useBaseERC20Token();
|
|
3163
3181
|
const { isLoadingNative, nativeError, nativeBalance } = useBaseNativeToken();
|
|
@@ -3174,15 +3192,14 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3174
3192
|
setSelectedPaymentMethod({ type: "CRYPTO" /* CRYPTO */, method: coin });
|
|
3175
3193
|
};
|
|
3176
3194
|
const userCoins = [nativeBalance, ...erc20Balances].filter(Boolean);
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
/* @__PURE__ */
|
|
3184
|
-
/* @__PURE__ */
|
|
3185
|
-
/* @__PURE__ */ jsx35("button", { className: "rounded-md p-1 hover:bg-gray-100", onClick: modal.remove, children: /* @__PURE__ */ jsx35("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "17", fill: "none", children: /* @__PURE__ */ jsx35(
|
|
3195
|
+
return /* @__PURE__ */ jsxs18(Dialog, { open: modal.visible, onOpenChange: modal.remove, children: [
|
|
3196
|
+
/* @__PURE__ */ jsx34(DialogDescription, { className: "hidden", children: "Crypto Select Modal" }),
|
|
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: [
|
|
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" }) }) }),
|
|
3201
|
+
/* @__PURE__ */ jsx34(DialogTitle, { className: "text-primary text-2xl font-semibold", children: "Select a token" }),
|
|
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(
|
|
3186
3203
|
"path",
|
|
3187
3204
|
{
|
|
3188
3205
|
fill: "#000",
|
|
@@ -3190,80 +3207,76 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3190
3207
|
}
|
|
3191
3208
|
) }) })
|
|
3192
3209
|
] }),
|
|
3193
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx34(Input2, { onChange: (e) => setSearch(e.target.value), placeholder: "Search by token name", value: search })
|
|
3194
3211
|
] }),
|
|
3195
|
-
/* @__PURE__ */
|
|
3196
|
-
/* @__PURE__ */
|
|
3197
|
-
/* @__PURE__ */
|
|
3198
|
-
(error || nativeError) && /* @__PURE__ */
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
isLoadingNative && /* @__PURE__ */
|
|
3201
|
-
nativeBalance && /* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsx34(Separator2, { className: "hidden md:block" }),
|
|
3213
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7", children: [
|
|
3214
|
+
/* @__PURE__ */ jsx34("h3", { className: "text-primary text-xl font-semibold", children: "Tokens with wallet balance" }),
|
|
3215
|
+
(error || nativeError) && /* @__PURE__ */ jsx34("p", { className: "text-center text-sm text-red-500", children: "Something wrong" }),
|
|
3216
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex w-full flex-col gap-1", children: [
|
|
3217
|
+
isLoadingNative && /* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3218
|
+
nativeBalance && /* @__PURE__ */ jsxs18(
|
|
3202
3219
|
"button",
|
|
3203
3220
|
{
|
|
3204
3221
|
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-black hover:bg-gray-100",
|
|
3205
3222
|
onClick: () => handleSelect(nativeBalance),
|
|
3206
3223
|
children: [
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
nativeBalance.logoURI && /* @__PURE__ */
|
|
3209
|
-
|
|
3210
|
-
{
|
|
3211
|
-
className: "h-8 w-8 shrink-0",
|
|
3212
|
-
src: nativeBalance.logoURI,
|
|
3213
|
-
alt: `${nativeBalance.symbol} logo`
|
|
3214
|
-
}
|
|
3215
|
-
),
|
|
3216
|
-
/* @__PURE__ */ jsx35("p", { className: "text-sm font-medium", children: nativeBalance.symbol })
|
|
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` }),
|
|
3226
|
+
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: nativeBalance.symbol })
|
|
3217
3227
|
] }),
|
|
3218
|
-
/* @__PURE__ */
|
|
3228
|
+
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: nativeBalance.formatted })
|
|
3219
3229
|
]
|
|
3220
3230
|
},
|
|
3221
3231
|
nativeBalance.symbol
|
|
3222
3232
|
),
|
|
3223
|
-
isLoading && /* @__PURE__ */
|
|
3224
|
-
/* @__PURE__ */
|
|
3225
|
-
/* @__PURE__ */
|
|
3226
|
-
/* @__PURE__ */
|
|
3233
|
+
isLoading && /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
3234
|
+
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3235
|
+
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3236
|
+
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" })
|
|
3227
3237
|
] }),
|
|
3228
3238
|
erc20Balances.map((coin) => {
|
|
3229
3239
|
const Icon = getSymbolLogo(coin.symbol);
|
|
3230
|
-
return /* @__PURE__ */
|
|
3240
|
+
return /* @__PURE__ */ jsxs18(
|
|
3231
3241
|
"button",
|
|
3232
3242
|
{
|
|
3233
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",
|
|
3234
3244
|
onClick: () => handleSelect(coin),
|
|
3235
3245
|
children: [
|
|
3236
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
3237
3247
|
Boolean(Icon) && Icon,
|
|
3238
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: coin.symbol })
|
|
3239
3249
|
] }),
|
|
3240
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsx34("p", { className: "text-sm font-medium", children: coin.formatted })
|
|
3241
3251
|
]
|
|
3242
3252
|
},
|
|
3243
3253
|
coin.symbol
|
|
3244
3254
|
);
|
|
3245
3255
|
})
|
|
3246
3256
|
] }),
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
tokensIsLoading && /* @__PURE__ */
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3252
|
-
/* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsx34("h3", { className: "text-primary text-xl font-semibold", children: "All Tokens" }),
|
|
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: [
|
|
3260
|
+
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3261
|
+
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" }),
|
|
3262
|
+
/* @__PURE__ */ jsx34("div", { className: "h-11 animate-pulse rounded-md bg-gray-100" })
|
|
3253
3263
|
] }),
|
|
3254
|
-
filteredCoins.map((token) =>
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
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
|
+
})
|
|
3267
3280
|
] })
|
|
3268
3281
|
] })
|
|
3269
3282
|
] })
|
|
@@ -3272,44 +3285,44 @@ var CryptoSelectModal = NiceModal4.create(() => {
|
|
|
3272
3285
|
CryptoSelectModal.displayName = "CryptoSelectModal";
|
|
3273
3286
|
|
|
3274
3287
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
3275
|
-
import { jsx as
|
|
3288
|
+
import { jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3276
3289
|
var SelectCoinButton = () => {
|
|
3277
3290
|
const openModal = () => {
|
|
3278
|
-
|
|
3291
|
+
NiceModal6.show(CryptoSelectModal);
|
|
3279
3292
|
};
|
|
3280
|
-
return /* @__PURE__ */
|
|
3281
|
-
/* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3284
|
-
/* @__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: [
|
|
3296
|
+
/* @__PURE__ */ jsx35("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx35("p", { className: "font-medium text-black/50", children: "Select a token" }) }),
|
|
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" }) })
|
|
3285
3298
|
] })
|
|
3286
3299
|
] });
|
|
3287
3300
|
};
|
|
3288
3301
|
|
|
3289
3302
|
// src/components/CryptoTab/Crypto/SelectedCoin.tsx
|
|
3290
|
-
import { jsx as
|
|
3303
|
+
import { jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3291
3304
|
var SelectedCoin = (props) => {
|
|
3292
3305
|
const { coin, balance, logoURI } = props;
|
|
3293
3306
|
const Icon = getSymbolLogo(coin);
|
|
3294
|
-
return /* @__PURE__ */
|
|
3295
|
-
/* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__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: [
|
|
3298
3311
|
Icon,
|
|
3299
|
-
!Icon && logoURI && /* @__PURE__ */
|
|
3300
|
-
/* @__PURE__ */
|
|
3301
|
-
/* @__PURE__ */
|
|
3312
|
+
!Icon && logoURI && /* @__PURE__ */ jsx36("img", { className: "mr-1 size-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
|
|
3313
|
+
/* @__PURE__ */ jsx36("p", { className: "font-semibold text-black", children: coin }),
|
|
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" }) })
|
|
3302
3315
|
] }),
|
|
3303
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsxs20("p", { className: "text-xs font-medium text-black/50", children: [
|
|
3304
3317
|
"Wallet balance ",
|
|
3305
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsx36("span", { className: "text-black", children: balance })
|
|
3306
3319
|
] })
|
|
3307
3320
|
] })
|
|
3308
3321
|
] });
|
|
3309
3322
|
};
|
|
3310
3323
|
|
|
3311
3324
|
// src/components/CryptoTab/Crypto/Crypto.tsx
|
|
3312
|
-
import { jsx as
|
|
3325
|
+
import { jsx as jsx37, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3313
3326
|
var Crypto = () => {
|
|
3314
3327
|
const { address } = useAccount3();
|
|
3315
3328
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
@@ -3333,14 +3346,14 @@ var Crypto = () => {
|
|
|
3333
3346
|
useEffect9(() => {
|
|
3334
3347
|
register(handlePay);
|
|
3335
3348
|
}, [register, handlePay]);
|
|
3336
|
-
return /* @__PURE__ */
|
|
3337
|
-
/* @__PURE__ */
|
|
3338
|
-
/* @__PURE__ */
|
|
3339
|
-
/* @__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: [
|
|
3351
|
+
/* @__PURE__ */ jsx37("h3", { className: "text-primary text-xl leading-[1.7] font-semibold", children: "Pay with Crypto" }),
|
|
3352
|
+
/* @__PURE__ */ jsx37(ConnectButton, {})
|
|
3340
3353
|
] }),
|
|
3341
|
-
!isWalletConnected && /* @__PURE__ */
|
|
3342
|
-
isWalletConnected && /* @__PURE__ */
|
|
3343
|
-
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && selectedPaymentMethod.method && /* @__PURE__ */
|
|
3354
|
+
!isWalletConnected && /* @__PURE__ */ jsx37(Logos, {}),
|
|
3355
|
+
isWalletConnected && /* @__PURE__ */ jsxs21("div", { className: "flex w-full flex-col gap-1", children: [
|
|
3356
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && selectedPaymentMethod.method && /* @__PURE__ */ jsx37(
|
|
3344
3357
|
SelectedCoin,
|
|
3345
3358
|
{
|
|
3346
3359
|
coin: selectedPaymentMethod.method.symbol,
|
|
@@ -3348,13 +3361,13 @@ var Crypto = () => {
|
|
|
3348
3361
|
logoURI: selectedPaymentMethod.method.logoURI
|
|
3349
3362
|
}
|
|
3350
3363
|
),
|
|
3351
|
-
/* @__PURE__ */
|
|
3364
|
+
/* @__PURE__ */ jsx37(SelectCoinButton, {})
|
|
3352
3365
|
] })
|
|
3353
3366
|
] });
|
|
3354
3367
|
};
|
|
3355
3368
|
|
|
3356
3369
|
// src/components/CryptoTab/Crypto/CryptoWrapper.tsx
|
|
3357
|
-
import { jsx as
|
|
3370
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3358
3371
|
var queryClient = new QueryClient();
|
|
3359
3372
|
var CHAINS = [base];
|
|
3360
3373
|
var wagmiConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -3374,23 +3387,23 @@ var CryptoWrapper = () => {
|
|
|
3374
3387
|
return getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
|
|
3375
3388
|
}, [spreePayConfig]);
|
|
3376
3389
|
if (configIsLoading || !wagmiConfig) return null;
|
|
3377
|
-
return /* @__PURE__ */
|
|
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, {}) }) }) }) });
|
|
3378
3391
|
};
|
|
3379
3392
|
|
|
3380
3393
|
// src/components/CryptoTab/CryptoTab.tsx
|
|
3381
|
-
import { jsx as
|
|
3394
|
+
import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3382
3395
|
var CryptoTab = () => {
|
|
3383
3396
|
const { spreePayConfig } = useSpreePayConfig();
|
|
3384
|
-
return /* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3386
|
-
/* @__PURE__ */
|
|
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, {}) }),
|
|
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 }) })
|
|
3387
3400
|
] });
|
|
3388
3401
|
};
|
|
3389
3402
|
|
|
3390
3403
|
// src/components/TabButtons.tsx
|
|
3391
|
-
import { Fragment as Fragment7, jsx as
|
|
3404
|
+
import { Fragment as Fragment7, jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3392
3405
|
var TabButton = ({ isDisabled = false, isActive, children, onClick }) => {
|
|
3393
|
-
return /* @__PURE__ */
|
|
3406
|
+
return /* @__PURE__ */ jsx40(
|
|
3394
3407
|
"button",
|
|
3395
3408
|
{
|
|
3396
3409
|
disabled: isDisabled,
|
|
@@ -3413,65 +3426,56 @@ var TabButtons = (props) => {
|
|
|
3413
3426
|
onChange({ type, method: null });
|
|
3414
3427
|
}
|
|
3415
3428
|
};
|
|
3416
|
-
return /* @__PURE__ */
|
|
3417
|
-
configIsLoading && /* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3419
|
-
/* @__PURE__ */
|
|
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" })
|
|
3420
3433
|
] }),
|
|
3421
|
-
spreePayConfig?.creditCard.enabled && /* @__PURE__ */
|
|
3422
|
-
/* @__PURE__ */
|
|
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(
|
|
3423
3436
|
"path",
|
|
3424
3437
|
{
|
|
3425
3438
|
fill: "currentColor",
|
|
3426
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"
|
|
3427
3440
|
}
|
|
3428
3441
|
) }),
|
|
3429
|
-
/* @__PURE__ */
|
|
3442
|
+
/* @__PURE__ */ jsx40("p", { className: "text-sm font-medium", children: "Card" })
|
|
3430
3443
|
] }),
|
|
3431
|
-
spreePayConfig?.crypto.enabled && /* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
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(
|
|
3434
3447
|
"path",
|
|
3435
3448
|
{
|
|
3436
3449
|
fill: "currentColor",
|
|
3437
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"
|
|
3438
3451
|
}
|
|
3439
3452
|
),
|
|
3440
|
-
/* @__PURE__ */
|
|
3453
|
+
/* @__PURE__ */ jsx40(
|
|
3441
3454
|
"path",
|
|
3442
3455
|
{
|
|
3443
3456
|
fill: "currentColor",
|
|
3444
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"
|
|
3445
3458
|
}
|
|
3446
3459
|
),
|
|
3447
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsx40("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "2" })
|
|
3448
3461
|
] }),
|
|
3449
|
-
/* @__PURE__ */
|
|
3462
|
+
/* @__PURE__ */ jsx40("p", { className: "text-sm font-medium", children: "Crypto" })
|
|
3450
3463
|
] })
|
|
3451
3464
|
] });
|
|
3452
3465
|
};
|
|
3453
3466
|
|
|
3454
|
-
// src/components/Tabs.tsx
|
|
3455
|
-
import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3456
|
-
var Tabs = () => {
|
|
3457
|
-
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
3458
|
-
return /* @__PURE__ */ jsxs25("div", { className: "mb-4 rounded-3xl border border-black/25 bg-white", children: [
|
|
3459
|
-
/* @__PURE__ */ jsxs25("div", { className: "flex w-full flex-col gap-4 border-b-1 border-black/7 px-5 py-5 md:px-7 md:py-6", children: [
|
|
3460
|
-
/* @__PURE__ */ jsx42("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
|
|
3461
|
-
/* @__PURE__ */ jsx42(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
3462
|
-
] }),
|
|
3463
|
-
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ jsx42(CreditCardTab, {}),
|
|
3464
|
-
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ jsx42(CryptoTab, {})
|
|
3465
|
-
] });
|
|
3466
|
-
};
|
|
3467
|
-
|
|
3468
3467
|
// src/SpreePayContent.tsx
|
|
3469
|
-
import { jsx as
|
|
3468
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3470
3469
|
var SpreePayContent = ({ isLoggedIn }) => {
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
|
|
3470
|
+
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
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: [
|
|
3473
|
+
/* @__PURE__ */ jsx41("h2", { className: "text-primary text-2xl font-semibold", children: "Choose a Payment Method" }),
|
|
3474
|
+
/* @__PURE__ */ jsx41(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
3475
|
+
] }),
|
|
3476
|
+
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ jsx41(CreditCardTab, {}),
|
|
3477
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ jsx41(CryptoTab, {}),
|
|
3478
|
+
/* @__PURE__ */ jsx41(CheckoutButton, { isLoggedIn })
|
|
3475
3479
|
] });
|
|
3476
3480
|
};
|
|
3477
3481
|
|
|
@@ -3479,8 +3483,8 @@ var SpreePayContent = ({ isLoggedIn }) => {
|
|
|
3479
3483
|
import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef7, useState as useState13 } from "react";
|
|
3480
3484
|
import Keycloak from "keycloak-js";
|
|
3481
3485
|
var refreshAheadSeconds = 60;
|
|
3482
|
-
function useKeycloakSSO(
|
|
3483
|
-
const { url, realm, clientId, ssoPageURI, enabled } =
|
|
3486
|
+
function useKeycloakSSO(config2) {
|
|
3487
|
+
const { url, realm, clientId, ssoPageURI, enabled } = config2;
|
|
3484
3488
|
const initRef = useRef7(false);
|
|
3485
3489
|
const kcRef = useRef7(null);
|
|
3486
3490
|
const refreshTimerRef = useRef7(null);
|
|
@@ -3547,7 +3551,7 @@ function useKeycloakSSO(config) {
|
|
|
3547
3551
|
}
|
|
3548
3552
|
|
|
3549
3553
|
// src/SpreePay.tsx
|
|
3550
|
-
import { jsx as
|
|
3554
|
+
import { jsx as jsx42, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3551
3555
|
var SpreePayInner = () => {
|
|
3552
3556
|
const [portalEl, setPortalEl] = useState14(null);
|
|
3553
3557
|
const rootRef = useCallback8((node) => {
|
|
@@ -3569,6 +3573,7 @@ var SpreePayInner = () => {
|
|
|
3569
3573
|
enabled: !env?.accessToken
|
|
3570
3574
|
});
|
|
3571
3575
|
const _accessToken = env.accessToken ?? accessToken;
|
|
3576
|
+
const unauthenticatedFetcher = useCallback8(() => Promise.resolve(null), []);
|
|
3572
3577
|
const slapiFetcher = useMemo10(() => {
|
|
3573
3578
|
if (_accessToken) {
|
|
3574
3579
|
return registerApi({
|
|
@@ -3577,16 +3582,16 @@ var SpreePayInner = () => {
|
|
|
3577
3582
|
baseUrl: staticConfig.slapiUrl
|
|
3578
3583
|
});
|
|
3579
3584
|
}
|
|
3580
|
-
|
|
3585
|
+
return unauthenticatedFetcher;
|
|
3586
|
+
}, [_accessToken, staticConfig, tenantId, unauthenticatedFetcher]);
|
|
3581
3587
|
const getContent = () => {
|
|
3582
3588
|
if (isChecking) {
|
|
3583
|
-
return /* @__PURE__ */
|
|
3584
|
-
/* @__PURE__ */
|
|
3585
|
-
/* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */ jsx44(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" })
|
|
3587
3592
|
] });
|
|
3588
3593
|
}
|
|
3589
|
-
return /* @__PURE__ */
|
|
3594
|
+
return /* @__PURE__ */ jsx42(
|
|
3590
3595
|
SWRConfig,
|
|
3591
3596
|
{
|
|
3592
3597
|
value: {
|
|
@@ -3595,17 +3600,17 @@ var SpreePayInner = () => {
|
|
|
3595
3600
|
revalidateOnFocus: false,
|
|
3596
3601
|
revalidateIfStale: false
|
|
3597
3602
|
},
|
|
3598
|
-
children: /* @__PURE__ */
|
|
3603
|
+
children: /* @__PURE__ */ jsx42(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ jsx42(NiceModal8.Provider, { children: /* @__PURE__ */ jsx42(SpreePayContent, { isLoggedIn: Boolean(_accessToken) }) }) })
|
|
3599
3604
|
}
|
|
3600
3605
|
);
|
|
3601
3606
|
};
|
|
3602
|
-
return /* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */
|
|
3607
|
+
return /* @__PURE__ */ jsxs25("div", { ref: rootRef, className: cn("sl-spreepay", appProps.className), children: [
|
|
3608
|
+
/* @__PURE__ */ jsx42("div", { className: "sl-spreepay__portal" }),
|
|
3604
3609
|
getContent()
|
|
3605
3610
|
] });
|
|
3606
3611
|
};
|
|
3607
3612
|
var SpreePay = (props) => {
|
|
3608
|
-
return /* @__PURE__ */
|
|
3613
|
+
return /* @__PURE__ */ jsx42(StaticConfigProvider, { props, children: /* @__PURE__ */ jsx42(SpreePayInner, {}) });
|
|
3609
3614
|
};
|
|
3610
3615
|
|
|
3611
3616
|
// src/hooks/useCapture3DS.ts
|