@superlogic/spree-pay 0.1.36 → 0.1.39
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 +806 -554
- package/build/index.css +293 -450
- package/build/index.d.cts +7 -1
- package/build/index.d.ts +7 -1
- package/build/index.js +780 -528
- package/package.json +5 -3
- package/src/styles/globals.css +149 -0
package/build/index.cjs
CHANGED
|
@@ -39,12 +39,12 @@ __export(index_exports, {
|
|
|
39
39
|
module.exports = __toCommonJS(index_exports);
|
|
40
40
|
|
|
41
41
|
// src/SpreePay.tsx
|
|
42
|
-
var
|
|
43
|
-
var
|
|
42
|
+
var import_react19 = require("react");
|
|
43
|
+
var import_nice_modal_react9 = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
44
44
|
var import_swr5 = require("swr");
|
|
45
45
|
|
|
46
46
|
// package.json
|
|
47
|
-
var version = "0.1.
|
|
47
|
+
var version = "0.1.39";
|
|
48
48
|
|
|
49
49
|
// src/context/SpreePayActionsContext.tsx
|
|
50
50
|
var import_react = require("react");
|
|
@@ -65,6 +65,7 @@ var PaymentError = class extends Error {
|
|
|
65
65
|
var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
|
|
66
66
|
PaymentType2["CREDIT_CARD"] = "CREDIT_CARD";
|
|
67
67
|
PaymentType2["CRYPTO"] = "CRYPTO";
|
|
68
|
+
PaymentType2["CDC"] = "CDC";
|
|
68
69
|
PaymentType2["CREDIT_CARD_SPLIT"] = "SPLIT";
|
|
69
70
|
PaymentType2["POINTS"] = "POINTS";
|
|
70
71
|
return PaymentType2;
|
|
@@ -292,7 +293,7 @@ var Spinner = (props) => {
|
|
|
292
293
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
293
294
|
"svg",
|
|
294
295
|
{
|
|
295
|
-
className: cn(`${sizeClasses[size]} animate-spin text-
|
|
296
|
+
className: cn(`${sizeClasses[size]} animate-spin text-(--tertiary)`, className),
|
|
296
297
|
viewBox: "0 0 64 64",
|
|
297
298
|
fill: "none",
|
|
298
299
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -317,7 +318,7 @@ var Spinner = (props) => {
|
|
|
317
318
|
strokeWidth: "5",
|
|
318
319
|
strokeLinecap: "round",
|
|
319
320
|
strokeLinejoin: "round",
|
|
320
|
-
className: "text-
|
|
321
|
+
className: "text-(--brand-primary)"
|
|
321
322
|
}
|
|
322
323
|
)
|
|
323
324
|
]
|
|
@@ -374,8 +375,174 @@ var getTransactionFee = (amount = 0, transactionFeePercentage) => {
|
|
|
374
375
|
return Math.round((fee + Number.EPSILON) * 100) / 100;
|
|
375
376
|
};
|
|
376
377
|
|
|
377
|
-
// src/components/
|
|
378
|
+
// src/components/common/PointsSwitch.tsx
|
|
379
|
+
var import_react3 = require("react");
|
|
380
|
+
|
|
381
|
+
// src/hooks/useSlapiBalance.ts
|
|
382
|
+
var import_swr2 = __toESM(require("swr"), 1);
|
|
383
|
+
var useSlapiBalance = () => {
|
|
384
|
+
const { data, isLoading, mutate } = (0, import_swr2.default)(`/v1/loyalty/accounts`);
|
|
385
|
+
return { balance: data?.detail, isBalanceLoading: isLoading, mutateBalance: mutate };
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/ui/label.tsx
|
|
389
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
378
390
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
391
|
+
function Label({ className, ...props }) {
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
393
|
+
LabelPrimitive.Root,
|
|
394
|
+
{
|
|
395
|
+
"data-slot": "label",
|
|
396
|
+
className: cn(
|
|
397
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
398
|
+
className
|
|
399
|
+
),
|
|
400
|
+
...props
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// src/ui/switch.tsx
|
|
406
|
+
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"), 1);
|
|
407
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
408
|
+
function Switch({ className, ...props }) {
|
|
409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
410
|
+
SwitchPrimitive.Root,
|
|
411
|
+
{
|
|
412
|
+
"data-slot": "switch",
|
|
413
|
+
className: cn(
|
|
414
|
+
"peer focus-visible:border-ring focus-visible:ring-ring/50 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-(--s-brand) data-[state=unchecked]:bg-(--s-tertiary)",
|
|
415
|
+
className
|
|
416
|
+
),
|
|
417
|
+
...props,
|
|
418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
419
|
+
SwitchPrimitive.Thumb,
|
|
420
|
+
{
|
|
421
|
+
"data-slot": "switch-thumb",
|
|
422
|
+
className: "pointer-events-none block size-4 rounded-full bg-(--s-default) ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/components/common/InfoBanner.tsx
|
|
430
|
+
var import_xss = __toESM(require("xss"), 1);
|
|
431
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
432
|
+
var InfoBanner = (props) => {
|
|
433
|
+
const { type = "info", message } = props;
|
|
434
|
+
if (!message) return null;
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
className: cn("flex w-full gap-1.5 rounded-md p-2", {
|
|
439
|
+
"border border-(--b-secondary)": type === "info",
|
|
440
|
+
"bg-(--s-warning)/10": type === "warning"
|
|
441
|
+
}),
|
|
442
|
+
children: [
|
|
443
|
+
type === "info" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
444
|
+
"svg",
|
|
445
|
+
{
|
|
446
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
447
|
+
fill: "none",
|
|
448
|
+
viewBox: "0 0 20 20",
|
|
449
|
+
className: "size-5 shrink-0 text-(--positive)",
|
|
450
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
451
|
+
"path",
|
|
452
|
+
{
|
|
453
|
+
fill: "currentColor",
|
|
454
|
+
d: "M10 17.92a2.2 2.2 0 0 1-1.59-.66 4 4 0 0 0-1.07-.81q-.45-.2-1.35-.2-.94 0-1.6-.65a2.2 2.2 0 0 1-.65-1.59q0-.9-.19-1.34a4 4 0 0 0-.8-1.08 2.2 2.2 0 0 1-.5-2.44q.17-.41.5-.74.6-.62.8-1.07t.2-1.35q0-.94.65-1.6.65-.65 1.59-.65.9 0 1.34-.19.46-.2 1.08-.81A2.2 2.2 0 0 1 10 2.08a2.3 2.3 0 0 1 1.59.66q.62.62 1.07.81t1.35.2q.94 0 1.6.65.65.64.65 1.59 0 .9.19 1.34.2.46.81 1.08a2.2 2.2 0 0 1 .66 1.59 2.2 2.2 0 0 1-.66 1.59q-.61.63-.81 1.07t-.2 1.35q0 .94-.65 1.6-.64.65-1.59.65-.9 0-1.34.19-.45.2-1.08.8a2.2 2.2 0 0 1-1.59.67m0-1.25q.2 0 .39-.08a1 1 0 0 0 .31-.21q.8-.8 1.5-1.09.7-.28 1.81-.28.42 0 .71-.29.3-.29.29-.7 0-1.13.28-1.82.3-.7 1.08-1.5.3-.3.3-.7t-.3-.7a5 5 0 0 1-1.08-1.5 5 5 0 0 1-.28-1.8q0-.42-.29-.71a1 1 0 0 0-.7-.29q-1.14 0-1.83-.28a5 5 0 0 1-1.5-1.08 1 1 0 0 0-.69-.3 1 1 0 0 0-.7.3q-.8.8-1.5 1.08T6 4.99q-.42 0-.71.29a1 1 0 0 0-.29.7q0 1.14-.28 1.83t-1.09 1.5q-.29.28-.29.69t.3.7q.8.8 1.08 1.5T5 14.01q0 .42.29.71.29.3.7.29 1.14 0 1.83.28t1.5 1.09a1 1 0 0 0 .7.29m2.03-3.62q.43 0 .73-.3t.3-.72a1 1 0 0 0-.3-.73 1 1 0 0 0-.73-.3 1 1 0 0 0-.73.3 1 1 0 0 0-.3.73q0 .43.3.73t.73.3m-4.53-.54q.18.18.43.18a.6.6 0 0 0 .43-.18l4.14-4.12a.6.6 0 0 0 .2-.44.6.6 0 0 0-.2-.45.6.6 0 0 0-.44-.2.6.6 0 0 0-.45.2l-4.12 4.14a.6.6 0 0 0-.18.43q0 .25.19.44M7.97 9a1 1 0 0 0 .74-.3 1 1 0 0 0 .3-.74q0-.43-.3-.73a1 1 0 0 0-.74-.3q-.43 0-.73.3t-.3.73.3.73.73.3"
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
),
|
|
459
|
+
type === "warning" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
460
|
+
"svg",
|
|
461
|
+
{
|
|
462
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
463
|
+
fill: "none",
|
|
464
|
+
viewBox: "0 0 20 20",
|
|
465
|
+
className: "size-5 shrink-0 text-(--warning)",
|
|
466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
467
|
+
"path",
|
|
468
|
+
{
|
|
469
|
+
fill: "currentColor",
|
|
470
|
+
d: "M10 13.96a.6.6 0 0 0 .44-.18.6.6 0 0 0 .18-.45V9.8a.6.6 0 0 0-.18-.44.6.6 0 0 0-.44-.18.6.6 0 0 0-.45.18.6.6 0 0 0-.18.44v3.54q0 .27.18.45a.6.6 0 0 0 .45.18m0-6.22q.29 0 .48-.2.2-.18.2-.47 0-.3-.2-.48a.7.7 0 0 0-.48-.2q-.3 0-.48.2a.7.7 0 0 0-.2.48q0 .29.2.48.2.2.48.19m0 10.18q-1.64 0-3.09-.63a8 8 0 0 1-4.2-4.2 8 8 0 0 1-.63-3.1q0-1.64.63-3.09a8 8 0 0 1 4.2-4.2q1.45-.63 3.09-.63 1.65 0 3.08.63a8 8 0 0 1 4.21 4.2q.63 1.45.63 3.09t-.63 3.09a8 8 0 0 1-4.2 4.2q-1.46.63-3.09.63m0-1.25q2.8 0 4.73-1.94A6.4 6.4 0 0 0 16.67 10q0-2.8-1.94-4.73A6.4 6.4 0 0 0 10 3.33q-2.8 0-4.73 1.94A6.4 6.4 0 0 0 3.33 10q0 2.8 1.94 4.73A6.4 6.4 0 0 0 10 16.67"
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
476
|
+
"p",
|
|
477
|
+
{
|
|
478
|
+
className: "text-[14px] leading-5 text-(--primary) [&_a]:underline",
|
|
479
|
+
dangerouslySetInnerHTML: { __html: (0, import_xss.default)(message) }
|
|
480
|
+
}
|
|
481
|
+
)
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// src/components/common/PointsSwitch.tsx
|
|
488
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
489
|
+
var PointsSwitch = (props) => {
|
|
490
|
+
const { disabled = false, value, onChange, message } = props;
|
|
491
|
+
const { spreePayConfig } = useSpreePayConfig();
|
|
492
|
+
const { appProps } = useStaticConfig();
|
|
493
|
+
const { balance } = useSlapiBalance();
|
|
494
|
+
const id = (0, import_react3.useId)();
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
500
|
+
Label,
|
|
501
|
+
{
|
|
502
|
+
htmlFor: id,
|
|
503
|
+
className: "text-md flex-col items-baseline gap-0 leading-[1.3] font-medium text-(--brand-primary) sm:flex-row sm:gap-2 md:text-[22px]",
|
|
504
|
+
children: [
|
|
505
|
+
"Use Points ",
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-xs font-medium text-(--tertiary)", children: "Optional" })
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
] }),
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
512
|
+
balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "flex-1 text-right text-sm font-medium text-(--brand-primary)", children: [
|
|
513
|
+
formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
|
|
514
|
+
!!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-(--secondary)", children: ` \xB7 ${formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio)}` })
|
|
515
|
+
] }) : null,
|
|
516
|
+
Boolean(appProps.topUpLink) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
517
|
+
"a",
|
|
518
|
+
{
|
|
519
|
+
className: "cursor-pointer rounded-full bg-(--primary) px-2 py-1.5 text-xs font-medium text-(--inverse)",
|
|
520
|
+
rel: "noreferrer",
|
|
521
|
+
target: "_blank",
|
|
522
|
+
href: appProps.topUpLink,
|
|
523
|
+
children: "Top Up"
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
] })
|
|
527
|
+
] }),
|
|
528
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InfoBanner, { type: "warning", message })
|
|
529
|
+
] });
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
// src/components/common/Legal.tsx
|
|
533
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
534
|
+
var Legal = () => {
|
|
535
|
+
const { spreePayConfig } = useSpreePayConfig();
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "text-center text-xs leading-5 font-medium text-(--secondary)", children: [
|
|
537
|
+
"By clicking on the button below I acknowledge that I have read and accepted the",
|
|
538
|
+
" ",
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { className: "underline", href: spreePayConfig?.termsConditionsUrl, target: "_blank", rel: "noreferrer", children: "Terms and Conditions" }),
|
|
540
|
+
"."
|
|
541
|
+
] });
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
// src/components/CheckoutButton.tsx
|
|
545
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
379
546
|
var CheckoutButton = ({ isLoggedIn }) => {
|
|
380
547
|
const { appProps, staticConfig } = useStaticConfig();
|
|
381
548
|
const { amount, onProcess, isProcessing, transactionFeePercentage } = appProps;
|
|
@@ -389,7 +556,7 @@ var CheckoutButton = ({ isLoggedIn }) => {
|
|
|
389
556
|
const isCrypto = type === "CRYPTO" /* CRYPTO */;
|
|
390
557
|
const getCheckoutContent = () => {
|
|
391
558
|
if (!!isProcessing || isInternalProcessing) {
|
|
392
|
-
return /* @__PURE__ */ (0,
|
|
559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner, { className: "inline", size: "sm" });
|
|
393
560
|
}
|
|
394
561
|
if (isCC && amount) {
|
|
395
562
|
if (splitAmount && usdAmount) {
|
|
@@ -408,32 +575,20 @@ var CheckoutButton = ({ isLoggedIn }) => {
|
|
|
408
575
|
}
|
|
409
576
|
return "Checkout";
|
|
410
577
|
};
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { className: "underline", href: spreePayConfig?.termsConditionsUrl, target: "_blank", rel: "noreferrer", children: "Terms and Conditions" }),
|
|
416
|
-
"."
|
|
417
|
-
] }),
|
|
418
|
-
isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: onProcess && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
419
|
-
"button",
|
|
420
|
-
{
|
|
421
|
-
disabled: isDisabled,
|
|
422
|
-
onClick: onProcess,
|
|
423
|
-
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",
|
|
424
|
-
children: getCheckoutContent()
|
|
425
|
-
}
|
|
426
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
578
|
+
const checkoutClass = "text-(--inverse) h-14 w-full cursor-pointer rounded-4xl bg-(--s-brand) hover:bg-(--s-brand-hover) px-4 text-center text-xl leading-6 font-medium disabled:cursor-not-allowed disabled:bg-(--s-disabled) disabled:text-(--disabled)";
|
|
579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full flex-col gap-4 bg-(--s-default) p-6 text-xs leading-5 font-medium text-(--secondary) md:px-7", children: [
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Legal, {}),
|
|
581
|
+
isLoggedIn ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: onProcess && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { disabled: isDisabled, onClick: onProcess, className: checkoutClass, children: getCheckoutContent() }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
427
582
|
"a",
|
|
428
583
|
{
|
|
429
584
|
href: `${staticConfig.keycloakUrl}/realms/${env.tenantId}/protocol/openid-connect/auth?client_id=${staticConfig.keycloakClientId}&response_type=code&redirect_uri=${window.location.href}`,
|
|
430
|
-
className:
|
|
585
|
+
className: checkoutClass,
|
|
431
586
|
children: "Log in / Sign up for an AIR account"
|
|
432
587
|
}
|
|
433
588
|
),
|
|
434
|
-
/* @__PURE__ */ (0,
|
|
435
|
-
/* @__PURE__ */ (0,
|
|
436
|
-
/* @__PURE__ */ (0,
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("a", { href: "https://www.spree.finance/", className: "flex items-center justify-center gap-2 hover:underline", children: [
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Powered by" }),
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { className: "shrink-0", xmlns: "http://www.w3.org/2000/svg", width: "66", height: "30", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
437
592
|
"path",
|
|
438
593
|
{
|
|
439
594
|
fill: "currentColor",
|
|
@@ -451,7 +606,7 @@ var import_react13 = require("react");
|
|
|
451
606
|
var import_nice_modal_react2 = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
452
607
|
|
|
453
608
|
// src/modals/Iframe3ds.tsx
|
|
454
|
-
var
|
|
609
|
+
var import_react5 = require("react");
|
|
455
610
|
var import_nice_modal_react = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
456
611
|
|
|
457
612
|
// src/services/eventBus.ts
|
|
@@ -473,30 +628,30 @@ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
|
473
628
|
var import_lucide_react = require("lucide-react");
|
|
474
629
|
|
|
475
630
|
// src/ui/portal.ts
|
|
476
|
-
var
|
|
477
|
-
var PortalContainerContext =
|
|
631
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
632
|
+
var PortalContainerContext = import_react4.default.createContext({ container: null });
|
|
478
633
|
function PortalContainerProvider({
|
|
479
634
|
container,
|
|
480
635
|
children
|
|
481
636
|
}) {
|
|
482
|
-
return
|
|
637
|
+
return import_react4.default.createElement(PortalContainerContext.Provider, { value: { container } }, children);
|
|
483
638
|
}
|
|
484
639
|
function usePortalContainer() {
|
|
485
|
-
return
|
|
640
|
+
return import_react4.default.useContext(PortalContainerContext).container;
|
|
486
641
|
}
|
|
487
642
|
|
|
488
643
|
// src/ui/dialog.tsx
|
|
489
|
-
var
|
|
644
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
490
645
|
function Dialog({ ...props }) {
|
|
491
|
-
return /* @__PURE__ */ (0,
|
|
646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
492
647
|
}
|
|
493
648
|
function DialogPortal({ ...props }) {
|
|
494
649
|
const container = usePortalContainer();
|
|
495
650
|
const safeContainer = container && document.body.contains(container) ? container : void 0;
|
|
496
|
-
return /* @__PURE__ */ (0,
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPrimitive.Portal, { container: safeContainer, "data-slot": "dialog-portal", ...props });
|
|
497
652
|
}
|
|
498
653
|
function DialogOverlay({ className, ...props }) {
|
|
499
|
-
return /* @__PURE__ */ (0,
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
500
655
|
DialogPrimitive.Overlay,
|
|
501
656
|
{
|
|
502
657
|
"data-slot": "dialog-overlay",
|
|
@@ -514,27 +669,27 @@ function DialogContent({
|
|
|
514
669
|
showCloseButton = true,
|
|
515
670
|
...props
|
|
516
671
|
}) {
|
|
517
|
-
return /* @__PURE__ */ (0,
|
|
518
|
-
/* @__PURE__ */ (0,
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogOverlay, {}),
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
520
675
|
DialogPrimitive.Content,
|
|
521
676
|
{
|
|
522
677
|
"data-slot": "dialog-content",
|
|
523
678
|
className: cn(
|
|
524
|
-
"
|
|
679
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-(--border-component-specific-card) bg-(--surface-component-specific-card-default-card) p-6 shadow-lg duration-200 sm:max-w-lg",
|
|
525
680
|
className
|
|
526
681
|
),
|
|
527
682
|
...props,
|
|
528
683
|
children: [
|
|
529
684
|
children,
|
|
530
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
685
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
531
686
|
DialogPrimitive.Close,
|
|
532
687
|
{
|
|
533
688
|
"data-slot": "dialog-close",
|
|
534
|
-
className: "ring-offset-background focus:ring-ring data-[state=open]:
|
|
689
|
+
className: "ring-offset-background focus:ring-ring 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 data-[state=open]:bg-(--accent) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
535
690
|
children: [
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
691
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.XIcon, {}),
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Close" })
|
|
538
693
|
]
|
|
539
694
|
}
|
|
540
695
|
)
|
|
@@ -544,7 +699,7 @@ function DialogContent({
|
|
|
544
699
|
] });
|
|
545
700
|
}
|
|
546
701
|
function DialogTitle({ className, ...props }) {
|
|
547
|
-
return /* @__PURE__ */ (0,
|
|
702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
548
703
|
DialogPrimitive.Title,
|
|
549
704
|
{
|
|
550
705
|
"data-slot": "dialog-title",
|
|
@@ -554,7 +709,7 @@ function DialogTitle({ className, ...props }) {
|
|
|
554
709
|
);
|
|
555
710
|
}
|
|
556
711
|
function DialogDescription({ className, ...props }) {
|
|
557
|
-
return /* @__PURE__ */ (0,
|
|
712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
558
713
|
DialogPrimitive.Description,
|
|
559
714
|
{
|
|
560
715
|
"data-slot": "dialog-description",
|
|
@@ -565,10 +720,10 @@ function DialogDescription({ className, ...props }) {
|
|
|
565
720
|
}
|
|
566
721
|
|
|
567
722
|
// src/modals/Iframe3ds.tsx
|
|
568
|
-
var
|
|
723
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
569
724
|
var Iframe3ds = import_nice_modal_react.default.create(({ url }) => {
|
|
570
725
|
const modal = (0, import_nice_modal_react.useModal)();
|
|
571
|
-
(0,
|
|
726
|
+
(0, import_react5.useEffect)(() => {
|
|
572
727
|
return bus.on("paymentIntent", (data) => {
|
|
573
728
|
modal.resolve(data.paymentIntent);
|
|
574
729
|
modal.remove();
|
|
@@ -578,9 +733,17 @@ var Iframe3ds = import_nice_modal_react.default.create(({ url }) => {
|
|
|
578
733
|
modal.reject();
|
|
579
734
|
modal.remove();
|
|
580
735
|
};
|
|
581
|
-
return /* @__PURE__ */ (0,
|
|
582
|
-
/* @__PURE__ */ (0,
|
|
583
|
-
/* @__PURE__ */ (0,
|
|
736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Dialog, { open: modal.visible, onOpenChange: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogContent, { className: "max-h-[600px] w-full max-w-[680px] p-0", children: [
|
|
737
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogTitle, { className: "hidden", children: "Payment Verification" }),
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
739
|
+
"iframe",
|
|
740
|
+
{
|
|
741
|
+
src: url,
|
|
742
|
+
id: "3ds-iframe",
|
|
743
|
+
title: "Payment Verificatio",
|
|
744
|
+
className: "h-[731px] w-full rounded-lg border-0"
|
|
745
|
+
}
|
|
746
|
+
)
|
|
584
747
|
] }) });
|
|
585
748
|
});
|
|
586
749
|
Iframe3ds.displayName = "Iframe3ds";
|
|
@@ -694,6 +857,9 @@ var SlapiPaymentService = {
|
|
|
694
857
|
validate3DS: ({ paymentId }) => {
|
|
695
858
|
return slapiApi.post("/v1/payments/validate", { paymentId, type: "CREDIT_CARD" /* CREDIT_CARD */ }).then((data) => ({ data }));
|
|
696
859
|
},
|
|
860
|
+
validateCDC: ({ paymentId }) => {
|
|
861
|
+
return slapiApi.post("/v1/payments/validate", { paymentId, type: "CDC" /* CDC */ }).then((data) => ({ data }));
|
|
862
|
+
},
|
|
697
863
|
validatePoints: ({ paymentId, txHash }) => {
|
|
698
864
|
return slapiApi.post("/v1/payments/validate", { txHash, paymentId, type: "POINTS" /* POINTS */ }).then((data) => ({ data }));
|
|
699
865
|
},
|
|
@@ -1024,9 +1190,9 @@ var useSplitCardPayments = (mode = "web2") => {
|
|
|
1024
1190
|
};
|
|
1025
1191
|
|
|
1026
1192
|
// src/hooks/useCards.ts
|
|
1027
|
-
var
|
|
1193
|
+
var import_swr3 = __toESM(require("swr"), 1);
|
|
1028
1194
|
var useCards = () => {
|
|
1029
|
-
const { data, isLoading, mutate } = (0,
|
|
1195
|
+
const { data, isLoading, mutate } = (0, import_swr3.default)(`/v1/payments/cards`);
|
|
1030
1196
|
return {
|
|
1031
1197
|
cards: data?.data.filter((c) => c.active) || [],
|
|
1032
1198
|
cardsIsLoading: isLoading,
|
|
@@ -1034,20 +1200,13 @@ var useCards = () => {
|
|
|
1034
1200
|
};
|
|
1035
1201
|
};
|
|
1036
1202
|
|
|
1037
|
-
// src/hooks/useSlapiBalance.ts
|
|
1038
|
-
var import_swr3 = __toESM(require("swr"), 1);
|
|
1039
|
-
var useSlapiBalance = () => {
|
|
1040
|
-
const { data, isLoading, mutate } = (0, import_swr3.default)(`/v1/loyalty/accounts`);
|
|
1041
|
-
return { balance: data?.detail, isBalanceLoading: isLoading, mutateBalance: mutate };
|
|
1042
|
-
};
|
|
1043
|
-
|
|
1044
1203
|
// src/components/CreditCardTab/CreditCard/CreditCard.tsx
|
|
1045
|
-
var
|
|
1204
|
+
var import_react7 = require("react");
|
|
1046
1205
|
var import_react_stripe_js2 = require("@stripe/react-stripe-js");
|
|
1047
1206
|
var import_stripe_js = require("@stripe/stripe-js");
|
|
1048
1207
|
|
|
1049
1208
|
// src/components/CreditCardTab/CreditCard/CardsList.tsx
|
|
1050
|
-
var
|
|
1209
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1051
1210
|
var isRemoveDisabled = true;
|
|
1052
1211
|
var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
1053
1212
|
const handleSelect = () => {
|
|
@@ -1057,90 +1216,93 @@ var CardListItem = ({ card, isSelected, onSelect }) => {
|
|
|
1057
1216
|
e.stopPropagation();
|
|
1058
1217
|
if (isSelected || isRemoveDisabled) return;
|
|
1059
1218
|
};
|
|
1060
|
-
return /* @__PURE__ */ (0,
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
"flex h-full w-full items-center justify-between rounded-r-sm border border-l-0! border-transparent px-3",
|
|
1219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1220
|
+
"button",
|
|
1221
|
+
{
|
|
1222
|
+
type: "button",
|
|
1223
|
+
onClick: handleSelect,
|
|
1224
|
+
className: cn(
|
|
1225
|
+
"flex h-12 w-full overflow-hidden rounded-md border-2 border-(--b-inverse) bg-(--s-primary) hover:bg-(--s-primary-hover)",
|
|
1226
|
+
{
|
|
1227
|
+
"border-(--b-brand)": isSelected
|
|
1228
|
+
}
|
|
1229
|
+
),
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1232
|
+
"div",
|
|
1075
1233
|
{
|
|
1076
|
-
"border-
|
|
1234
|
+
className: cn("flex h-full w-11 shrink-0 items-center justify-center border-r border-(--b-inverse)", {
|
|
1235
|
+
"border-(--b-brand)": isSelected
|
|
1236
|
+
}),
|
|
1237
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex size-5 items-center justify-center rounded-full border-2 border-(--brand-primary)", children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "size-2 rounded-full bg-(--brand-primary)" }) })
|
|
1077
1238
|
}
|
|
1078
1239
|
),
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
"
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
"div",
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1241
|
+
"div",
|
|
1242
|
+
{
|
|
1243
|
+
className: cn("flex h-full w-full items-center justify-between rounded-r-sm px-3", {
|
|
1244
|
+
"border-(--primary)": isSelected
|
|
1245
|
+
}),
|
|
1246
|
+
children: [
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm font-medium text-(--brand-primary)", children: card.schema }) }),
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-sm font-medium text-(--secondary)", children: [
|
|
1250
|
+
"Ending in ",
|
|
1251
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-(--brand-primary)", children: card.lastFourNumbers })
|
|
1252
|
+
] }),
|
|
1253
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1254
|
+
"div",
|
|
1255
|
+
{
|
|
1256
|
+
onClick: handleRemoveCard,
|
|
1257
|
+
className: cn("rounded-md p-1 text-(--tertiary) transition-all hover:bg-(--s-secondary)", {
|
|
1258
|
+
"cursor-not-allowed opacity-50": isSelected || isRemoveDisabled
|
|
1259
|
+
// 'cursor-pointer': !isSelected || !isRemoveDisabled,
|
|
1260
|
+
}),
|
|
1261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1262
|
+
"path",
|
|
1263
|
+
{
|
|
1264
|
+
fill: "currentColor",
|
|
1265
|
+
d: "M6.35 16.17c-.38 0-.7-.13-.96-.4a1.3 1.3 0 0 1-.39-.95V4.5h-.83v-.83H7.5v-.64h5v.64h3.33v.83H15v10.32c0 .39-.13.7-.39.96a1.3 1.3 0 0 1-.96.39h-7.3ZM14.17 4.5H5.83v10.32c0 .15.05.28.15.37.1.1.22.15.37.15h7.3c.13 0 .25-.06.36-.16.1-.11.16-.23.16-.36V4.5Zm-6 9.17h.84v-7.5h-.84v7.5Zm2.82 0h.84v-7.5h-.84v7.5Z"
|
|
1266
|
+
}
|
|
1267
|
+
) })
|
|
1268
|
+
}
|
|
1269
|
+
)
|
|
1270
|
+
] })
|
|
1271
|
+
]
|
|
1272
|
+
}
|
|
1273
|
+
)
|
|
1274
|
+
]
|
|
1275
|
+
}
|
|
1276
|
+
);
|
|
1112
1277
|
};
|
|
1113
1278
|
var CardsList = ({ selectedCard, setCard }) => {
|
|
1114
1279
|
const { cards, cardsIsLoading } = useCards();
|
|
1115
1280
|
if (cardsIsLoading) {
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1117
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-primary/8 h-11 animate-pulse rounded-sm" }),
|
|
1118
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-primary/8 h-11 animate-pulse rounded-sm" })
|
|
1119
|
-
] });
|
|
1281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "h-11 animate-pulse rounded-sm bg-(--s-primary)" }) });
|
|
1120
1282
|
}
|
|
1121
1283
|
if (cards.length === 0) return null;
|
|
1122
|
-
return /* @__PURE__ */ (0,
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex w-full flex-col gap-4", children: cards.map((card) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardListItem, { isSelected: selectedCard?.id === card.id, onSelect: setCard, card }, card.id)) });
|
|
1123
1285
|
};
|
|
1124
1286
|
|
|
1125
1287
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
1126
|
-
var
|
|
1288
|
+
var import_react6 = require("react");
|
|
1127
1289
|
var import_react_stripe_js = require("@stripe/react-stripe-js");
|
|
1128
1290
|
|
|
1129
1291
|
// src/ui/button.tsx
|
|
1130
1292
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
1131
1293
|
var import_class_variance_authority = require("class-variance-authority");
|
|
1132
|
-
var
|
|
1294
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1133
1295
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
1134
1296
|
"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",
|
|
1135
1297
|
{
|
|
1136
1298
|
variants: {
|
|
1137
1299
|
variant: {
|
|
1138
|
-
default: "bg-primary text-
|
|
1139
|
-
destructive: "bg-destructive text-
|
|
1140
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
1141
|
-
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
1142
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
1143
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
1300
|
+
default: "bg-(--primary) text-(--inverse) shadow-xs hover:bg-(--primary)/90 ",
|
|
1301
|
+
destructive: "bg-destructive text-(--inverse) shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
1302
|
+
outline: "border bg-background shadow-xs hover:bg-(--accent) hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
1303
|
+
secondary: "bg-(--secondary) text-secondary-foreground shadow-xs hover:bg-(--secondary)/80",
|
|
1304
|
+
ghost: "hover:bg-(--accent) hover:text-accent-foreground dark:hover:bg-(--accent)/50",
|
|
1305
|
+
link: "text-(--brand-primary) underline-offset-4 hover:underline"
|
|
1144
1306
|
},
|
|
1145
1307
|
size: {
|
|
1146
1308
|
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
@@ -1164,58 +1326,54 @@ function Button({
|
|
|
1164
1326
|
...props
|
|
1165
1327
|
}) {
|
|
1166
1328
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
1167
|
-
return /* @__PURE__ */ (0,
|
|
1329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props });
|
|
1168
1330
|
}
|
|
1169
1331
|
|
|
1170
1332
|
// src/ui/checkbox.tsx
|
|
1171
1333
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
1172
1334
|
var import_lucide_react2 = require("lucide-react");
|
|
1173
|
-
var
|
|
1335
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1174
1336
|
function Checkbox({ className, ...props }) {
|
|
1175
|
-
return /* @__PURE__ */ (0,
|
|
1337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1176
1338
|
CheckboxPrimitive.Root,
|
|
1177
1339
|
{
|
|
1178
1340
|
"data-slot": "checkbox",
|
|
1179
1341
|
className: cn(
|
|
1180
|
-
"peer border-input dark:bg-input/30
|
|
1342
|
+
"peer border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-sm border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-(--primary) data-[state=checked]:bg-(--primary) data-[state=checked]:text-(--inverse) dark:data-[state=checked]:bg-(--primary)",
|
|
1181
1343
|
className
|
|
1182
1344
|
),
|
|
1183
1345
|
...props,
|
|
1184
|
-
children: /* @__PURE__ */ (0,
|
|
1346
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1185
1347
|
CheckboxPrimitive.Indicator,
|
|
1186
1348
|
{
|
|
1187
1349
|
"data-slot": "checkbox-indicator",
|
|
1188
1350
|
className: "flex items-center justify-center text-current transition-none",
|
|
1189
|
-
children: /* @__PURE__ */ (0,
|
|
1351
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react2.CheckIcon, { className: "size-3.5 text-(--inverse)" })
|
|
1190
1352
|
}
|
|
1191
1353
|
)
|
|
1192
1354
|
}
|
|
1193
1355
|
);
|
|
1194
1356
|
}
|
|
1195
1357
|
|
|
1196
|
-
// src/ui/label.tsx
|
|
1197
|
-
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
1198
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1199
|
-
function Label({ className, ...props }) {
|
|
1200
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1201
|
-
LabelPrimitive.Root,
|
|
1202
|
-
{
|
|
1203
|
-
"data-slot": "label",
|
|
1204
|
-
className: cn(
|
|
1205
|
-
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
1206
|
-
className
|
|
1207
|
-
),
|
|
1208
|
-
...props
|
|
1209
|
-
}
|
|
1210
|
-
);
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
1358
|
// src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
|
|
1214
|
-
var
|
|
1215
|
-
var
|
|
1359
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1360
|
+
var styleDark = {
|
|
1361
|
+
base: {
|
|
1362
|
+
fontSize: "16px",
|
|
1363
|
+
fontWeight: "500",
|
|
1364
|
+
color: "rgba(255, 255, 255, 0.70)",
|
|
1365
|
+
"::placeholder": {
|
|
1366
|
+
color: "rgba(255, 255, 255, 0.5)"
|
|
1367
|
+
}
|
|
1368
|
+
},
|
|
1369
|
+
invalid: {
|
|
1370
|
+
color: "rgba(255, 255, 255, 0.70)"
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
var styleLight = {
|
|
1216
1374
|
base: {
|
|
1217
1375
|
fontSize: "16px",
|
|
1218
|
-
fontWeight: "
|
|
1376
|
+
fontWeight: "500",
|
|
1219
1377
|
color: "#000",
|
|
1220
1378
|
"::placeholder": {
|
|
1221
1379
|
color: "rgba(0, 0, 0, 0.5)"
|
|
@@ -1226,15 +1384,16 @@ var style = {
|
|
|
1226
1384
|
}
|
|
1227
1385
|
};
|
|
1228
1386
|
var stripeElementClasses = {
|
|
1229
|
-
base: "w-full
|
|
1230
|
-
invalid: "
|
|
1387
|
+
base: "w-full rounded-[12px] bg-(--s-primary) px-5 py-4 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1388
|
+
invalid: "focus-visible:ring-destructive",
|
|
1231
1389
|
focus: "border-ring ring-ring/50 ring-2"
|
|
1232
1390
|
};
|
|
1233
1391
|
var CreditCardForm = ({ cancel, saveCard }) => {
|
|
1234
|
-
const [cardError, setCardError] = (0,
|
|
1392
|
+
const [cardError, setCardError] = (0, import_react6.useState)(void 0);
|
|
1393
|
+
const { env } = useSpreePayEnv();
|
|
1235
1394
|
const elements = (0, import_react_stripe_js.useElements)();
|
|
1236
1395
|
const stripe = (0, import_react_stripe_js.useStripe)();
|
|
1237
|
-
const id = (0,
|
|
1396
|
+
const id = (0, import_react6.useId)();
|
|
1238
1397
|
const handleSaveCard = async () => {
|
|
1239
1398
|
if (!elements || !stripe) return;
|
|
1240
1399
|
setCardError(void 0);
|
|
@@ -1269,61 +1428,77 @@ var CreditCardForm = ({ cancel, saveCard }) => {
|
|
|
1269
1428
|
setCardError("An error occurred while processing your card. Please try again.");
|
|
1270
1429
|
}
|
|
1271
1430
|
};
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1431
|
+
const isDarkMode = env.tenantId === "cdc";
|
|
1432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1275
1435
|
import_react_stripe_js.CardNumberElement,
|
|
1276
1436
|
{
|
|
1277
1437
|
options: {
|
|
1278
|
-
style,
|
|
1438
|
+
style: isDarkMode ? styleDark : styleLight,
|
|
1279
1439
|
placeholder: "Card Number",
|
|
1280
1440
|
classes: stripeElementClasses
|
|
1281
1441
|
}
|
|
1282
1442
|
}
|
|
1283
1443
|
),
|
|
1284
|
-
/* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex w-full gap-4", children: [
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1286
1446
|
import_react_stripe_js.CardExpiryElement,
|
|
1287
1447
|
{
|
|
1288
1448
|
options: {
|
|
1289
|
-
style,
|
|
1449
|
+
style: isDarkMode ? styleDark : styleLight,
|
|
1290
1450
|
placeholder: "MM / YY",
|
|
1291
1451
|
classes: stripeElementClasses
|
|
1292
1452
|
}
|
|
1293
1453
|
}
|
|
1294
1454
|
),
|
|
1295
|
-
/* @__PURE__ */ (0,
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1296
1456
|
import_react_stripe_js.CardCvcElement,
|
|
1297
1457
|
{
|
|
1298
1458
|
options: {
|
|
1299
|
-
style,
|
|
1459
|
+
style: isDarkMode ? styleDark : styleLight,
|
|
1300
1460
|
placeholder: "CVV",
|
|
1301
1461
|
classes: stripeElementClasses
|
|
1302
1462
|
}
|
|
1303
1463
|
}
|
|
1304
1464
|
)
|
|
1305
1465
|
] }),
|
|
1306
|
-
cardError && /* @__PURE__ */ (0,
|
|
1466
|
+
cardError && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-destructive mt-1 text-sm", children: cardError })
|
|
1307
1467
|
] }),
|
|
1308
|
-
/* @__PURE__ */ (0,
|
|
1309
|
-
/* @__PURE__ */ (0,
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Checkbox, { disabled: true, checked: true, id: "saveCard" }),
|
|
1470
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label, { className: "text-sm font-medium", htmlFor: "saveCard", children: "Save card for future purchases" })
|
|
1311
1471
|
] }),
|
|
1312
|
-
/* @__PURE__ */ (0,
|
|
1313
|
-
/* @__PURE__ */ (0,
|
|
1314
|
-
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex w-full justify-end gap-2", children: [
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1474
|
+
Button,
|
|
1475
|
+
{
|
|
1476
|
+
variant: "outline",
|
|
1477
|
+
className: "border-(--b-brand) bg-transparent font-medium text-(--brand-primary) hover:bg-(--s-primary-hover) hover:text-(--brand-primary)",
|
|
1478
|
+
onClick: cancel,
|
|
1479
|
+
children: "Cancel"
|
|
1480
|
+
}
|
|
1481
|
+
),
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1483
|
+
Button,
|
|
1484
|
+
{
|
|
1485
|
+
className: "bg-(--s-brand) font-medium text-(--inverse) hover:bg-(--s-brand-hover)",
|
|
1486
|
+
onClick: handleSaveCard,
|
|
1487
|
+
children: "Add Card"
|
|
1488
|
+
}
|
|
1489
|
+
)
|
|
1315
1490
|
] })
|
|
1316
1491
|
] });
|
|
1317
1492
|
};
|
|
1318
1493
|
|
|
1319
1494
|
// src/components/CreditCardTab/CreditCard/CreditCard.tsx
|
|
1320
|
-
var
|
|
1495
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1321
1496
|
var StripeWrapper = (props) => {
|
|
1322
|
-
const stripePromise = (0,
|
|
1323
|
-
return /* @__PURE__ */ (0,
|
|
1497
|
+
const stripePromise = (0, import_react7.useMemo)(() => (0, import_stripe_js.loadStripe)(props.publicKey), [props.publicKey]);
|
|
1498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_stripe_js2.Elements, { stripe: stripePromise, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CreditCardForm, { cancel: props.onCancel, saveCard: props.saveNewCard }) });
|
|
1324
1499
|
};
|
|
1325
1500
|
var CreditCard = () => {
|
|
1326
|
-
const [showForm, setShowForm] = (0,
|
|
1501
|
+
const [showForm, setShowForm] = (0, import_react7.useState)(false);
|
|
1327
1502
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
1328
1503
|
const { mutateCards } = useCards();
|
|
1329
1504
|
const { spreePayConfig } = useSpreePayConfig();
|
|
@@ -1338,106 +1513,34 @@ var CreditCard = () => {
|
|
|
1338
1513
|
const handleCancel = () => {
|
|
1339
1514
|
setShowForm(false);
|
|
1340
1515
|
};
|
|
1341
|
-
return /* @__PURE__ */ (0,
|
|
1342
|
-
/* @__PURE__ */ (0,
|
|
1343
|
-
!showForm && /* @__PURE__ */ (0,
|
|
1344
|
-
/* @__PURE__ */ (0,
|
|
1516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-col items-baseline gap-4", children: [
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "text-[22px] leading-9 font-medium text-(--brand-primary)", children: "Your Cards" }),
|
|
1518
|
+
!showForm && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1345
1520
|
CardsList,
|
|
1346
1521
|
{
|
|
1347
1522
|
selectedCard: selectedPaymentMethod?.type === "CREDIT_CARD" /* CREDIT_CARD */ ? selectedPaymentMethod.method : null,
|
|
1348
1523
|
setCard
|
|
1349
1524
|
}
|
|
1350
1525
|
),
|
|
1351
|
-
spreePayConfig?.
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
] });
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
// src/components/CreditCardTab/Points/Points.tsx
|
|
1358
|
-
var import_react12 = require("react");
|
|
1359
|
-
|
|
1360
|
-
// src/components/common/PointsSwitch.tsx
|
|
1361
|
-
var import_react7 = require("react");
|
|
1362
|
-
|
|
1363
|
-
// src/ui/switch.tsx
|
|
1364
|
-
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"), 1);
|
|
1365
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1366
|
-
function Switch({ className, ...props }) {
|
|
1367
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1368
|
-
SwitchPrimitive.Root,
|
|
1369
|
-
{
|
|
1370
|
-
"data-slot": "switch",
|
|
1371
|
-
className: cn(
|
|
1372
|
-
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
1373
|
-
className
|
|
1374
|
-
),
|
|
1375
|
-
...props,
|
|
1376
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1377
|
-
SwitchPrimitive.Thumb,
|
|
1526
|
+
spreePayConfig?.creditCard.infoMessage && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(InfoBanner, { message: spreePayConfig.creditCard.infoMessage }),
|
|
1527
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1528
|
+
"button",
|
|
1378
1529
|
{
|
|
1379
|
-
|
|
1380
|
-
|
|
1530
|
+
onClick: () => setShowForm(true),
|
|
1531
|
+
disabled: !spreePayConfig?.stripePublicKey,
|
|
1532
|
+
className: "text-md text-(--brand-primary) hover:underline",
|
|
1533
|
+
children: "Add new card"
|
|
1381
1534
|
}
|
|
1382
1535
|
)
|
|
1383
|
-
}
|
|
1384
|
-
);
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
// src/components/common/PointsSwitch.tsx
|
|
1388
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1389
|
-
var PointsSwitch = (props) => {
|
|
1390
|
-
const { disabled = false, value, onChange, message } = props;
|
|
1391
|
-
const { spreePayConfig } = useSpreePayConfig();
|
|
1392
|
-
const { appProps } = useStaticConfig();
|
|
1393
|
-
const { balance } = useSlapiBalance();
|
|
1394
|
-
const id = (0, import_react7.useId)();
|
|
1395
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
1396
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1397
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
1398
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Switch, { checked: value, onCheckedChange: onChange, disabled, id }),
|
|
1399
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1400
|
-
Label,
|
|
1401
|
-
{
|
|
1402
|
-
htmlFor: id,
|
|
1403
|
-
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",
|
|
1404
|
-
children: [
|
|
1405
|
-
"Use Points ",
|
|
1406
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-xs font-medium", children: "Optional" })
|
|
1407
|
-
]
|
|
1408
|
-
}
|
|
1409
|
-
)
|
|
1410
|
-
] }),
|
|
1411
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
1412
|
-
balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "flex-1 text-right text-sm font-medium text-black", children: [
|
|
1413
|
-
formatPoints(balance.availablePoints, spreePayConfig?.pointsTitle),
|
|
1414
|
-
!!spreePayConfig?.pointsConversionRatio && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-black/50", children: ` ${formatUSD(balance.availablePoints * spreePayConfig.pointsConversionRatio)}` })
|
|
1415
|
-
] }) : null,
|
|
1416
|
-
Boolean(appProps.topUpLink) && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1417
|
-
"a",
|
|
1418
|
-
{
|
|
1419
|
-
className: "bg-primary cursor-pointer rounded-full px-2 py-1.5 text-xs font-medium text-white",
|
|
1420
|
-
rel: "noreferrer",
|
|
1421
|
-
target: "_blank",
|
|
1422
|
-
href: appProps.topUpLink,
|
|
1423
|
-
children: "Top Up"
|
|
1424
|
-
}
|
|
1425
|
-
)
|
|
1426
|
-
] })
|
|
1427
1536
|
] }),
|
|
1428
|
-
|
|
1429
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { className: "size-5 shrink-0", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1430
|
-
"path",
|
|
1431
|
-
{
|
|
1432
|
-
fill: "#000",
|
|
1433
|
-
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"
|
|
1434
|
-
}
|
|
1435
|
-
) }),
|
|
1436
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs font-medium text-black", children: message })
|
|
1437
|
-
] })
|
|
1537
|
+
spreePayConfig?.stripePublicKey && showForm && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StripeWrapper, { onCancel: handleCancel, saveNewCard, publicKey: spreePayConfig.stripePublicKey })
|
|
1438
1538
|
] });
|
|
1439
1539
|
};
|
|
1440
1540
|
|
|
1541
|
+
// src/components/CreditCardTab/Points/Points.tsx
|
|
1542
|
+
var import_react12 = require("react");
|
|
1543
|
+
|
|
1441
1544
|
// src/components/CreditCardTab/Points/SplitBlock.tsx
|
|
1442
1545
|
var import_react11 = require("react");
|
|
1443
1546
|
var import_airkit2 = require("@mocanetwork/airkit");
|
|
@@ -1446,15 +1549,15 @@ var import_airkit2 = require("@mocanetwork/airkit");
|
|
|
1446
1549
|
var import_react10 = require("react");
|
|
1447
1550
|
|
|
1448
1551
|
// src/ui/input.tsx
|
|
1449
|
-
var
|
|
1552
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1450
1553
|
function Input({ className, type, ...props }) {
|
|
1451
|
-
return /* @__PURE__ */ (0,
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1452
1555
|
"input",
|
|
1453
1556
|
{
|
|
1454
1557
|
type,
|
|
1455
1558
|
"data-slot": "input",
|
|
1456
1559
|
className: cn(
|
|
1457
|
-
"file:text-foreground
|
|
1560
|
+
"file:text-foreground dark:bg-input/30 border-input placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-(--primary) selection:text-(--inverse) file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
1458
1561
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
1459
1562
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
1460
1563
|
className
|
|
@@ -1525,7 +1628,7 @@ function useComposedRefs(...refs) {
|
|
|
1525
1628
|
|
|
1526
1629
|
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
1527
1630
|
var React3 = __toESM(require("react"), 1);
|
|
1528
|
-
var
|
|
1631
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1529
1632
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1530
1633
|
let defaultContexts = [];
|
|
1531
1634
|
function createContext32(rootComponentName, defaultContext) {
|
|
@@ -1536,7 +1639,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
1536
1639
|
const { scope, children, ...context } = props;
|
|
1537
1640
|
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
1538
1641
|
const value = React3.useMemo(() => context, Object.values(context));
|
|
1539
|
-
return /* @__PURE__ */ (0,
|
|
1642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Context.Provider, { value, children });
|
|
1540
1643
|
};
|
|
1541
1644
|
Provider.displayName = rootComponentName + "Provider";
|
|
1542
1645
|
function useContext22(consumerName, scope) {
|
|
@@ -1661,7 +1764,7 @@ function isFunction(value) {
|
|
|
1661
1764
|
|
|
1662
1765
|
// ../../node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
1663
1766
|
var React6 = __toESM(require("react"), 1);
|
|
1664
|
-
var
|
|
1767
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1665
1768
|
var DirectionContext = React6.createContext(void 0);
|
|
1666
1769
|
function useDirection(localDir) {
|
|
1667
1770
|
const globalDir = React6.useContext(DirectionContext);
|
|
@@ -1722,7 +1825,7 @@ function useSize(element) {
|
|
|
1722
1825
|
var React9 = __toESM(require("react"), 1);
|
|
1723
1826
|
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1724
1827
|
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
1725
|
-
var
|
|
1828
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1726
1829
|
var NODES = [
|
|
1727
1830
|
"a",
|
|
1728
1831
|
"button",
|
|
@@ -1750,7 +1853,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
1750
1853
|
if (typeof window !== "undefined") {
|
|
1751
1854
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
1752
1855
|
}
|
|
1753
|
-
return /* @__PURE__ */ (0,
|
|
1856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
1754
1857
|
});
|
|
1755
1858
|
Node2.displayName = `Primitive.${node}`;
|
|
1756
1859
|
return { ...primitive, [node]: Node2 };
|
|
@@ -1759,10 +1862,10 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
1759
1862
|
// ../../node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
1760
1863
|
var import_react8 = __toESM(require("react"), 1);
|
|
1761
1864
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
1762
|
-
var
|
|
1865
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1763
1866
|
var import_react9 = __toESM(require("react"), 1);
|
|
1764
1867
|
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
1765
|
-
var
|
|
1868
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1766
1869
|
function createCollection(name) {
|
|
1767
1870
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
1768
1871
|
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
@@ -1774,7 +1877,7 @@ function createCollection(name) {
|
|
|
1774
1877
|
const { scope, children } = props;
|
|
1775
1878
|
const ref = import_react8.default.useRef(null);
|
|
1776
1879
|
const itemMap = import_react8.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
1777
|
-
return /* @__PURE__ */ (0,
|
|
1880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
1778
1881
|
};
|
|
1779
1882
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
1780
1883
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
@@ -1784,7 +1887,7 @@ function createCollection(name) {
|
|
|
1784
1887
|
const { scope, children } = props;
|
|
1785
1888
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
1786
1889
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
1787
|
-
return /* @__PURE__ */ (0,
|
|
1890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CollectionSlotImpl, { ref: composedRefs, children });
|
|
1788
1891
|
}
|
|
1789
1892
|
);
|
|
1790
1893
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
@@ -1801,7 +1904,7 @@ function createCollection(name) {
|
|
|
1801
1904
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
1802
1905
|
return () => void context.itemMap.delete(ref);
|
|
1803
1906
|
});
|
|
1804
|
-
return /* @__PURE__ */ (0,
|
|
1907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
1805
1908
|
}
|
|
1806
1909
|
);
|
|
1807
1910
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
@@ -1827,7 +1930,7 @@ function createCollection(name) {
|
|
|
1827
1930
|
}
|
|
1828
1931
|
|
|
1829
1932
|
// ../../node_modules/@radix-ui/react-slider/dist/index.mjs
|
|
1830
|
-
var
|
|
1933
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1831
1934
|
var PAGE_KEYS = ["PageUp", "PageDown"];
|
|
1832
1935
|
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
1833
1936
|
var BACK_KEYS = {
|
|
@@ -1905,7 +2008,7 @@ var Slider = React11.forwardRef(
|
|
|
1905
2008
|
}
|
|
1906
2009
|
});
|
|
1907
2010
|
}
|
|
1908
|
-
return /* @__PURE__ */ (0,
|
|
2011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1909
2012
|
SliderProvider,
|
|
1910
2013
|
{
|
|
1911
2014
|
scope: props.__scopeSlider,
|
|
@@ -1918,7 +2021,7 @@ var Slider = React11.forwardRef(
|
|
|
1918
2021
|
values,
|
|
1919
2022
|
orientation,
|
|
1920
2023
|
form,
|
|
1921
|
-
children: /* @__PURE__ */ (0,
|
|
2024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Collection.Provider, { scope: props.__scopeSlider, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Collection.Slot, { scope: props.__scopeSlider, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1922
2025
|
SliderOrientation,
|
|
1923
2026
|
{
|
|
1924
2027
|
"aria-disabled": disabled,
|
|
@@ -1987,7 +2090,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
1987
2090
|
rectRef.current = rect;
|
|
1988
2091
|
return value(pointerPosition - rect.left);
|
|
1989
2092
|
}
|
|
1990
|
-
return /* @__PURE__ */ (0,
|
|
2093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1991
2094
|
SliderOrientationProvider,
|
|
1992
2095
|
{
|
|
1993
2096
|
scope: props.__scopeSlider,
|
|
@@ -1995,7 +2098,7 @@ var SliderHorizontal = React11.forwardRef(
|
|
|
1995
2098
|
endEdge: isSlidingFromLeft ? "right" : "left",
|
|
1996
2099
|
direction: isSlidingFromLeft ? 1 : -1,
|
|
1997
2100
|
size: "width",
|
|
1998
|
-
children: /* @__PURE__ */ (0,
|
|
2101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1999
2102
|
SliderImpl,
|
|
2000
2103
|
{
|
|
2001
2104
|
dir: direction,
|
|
@@ -2053,7 +2156,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
2053
2156
|
rectRef.current = rect;
|
|
2054
2157
|
return value(pointerPosition - rect.top);
|
|
2055
2158
|
}
|
|
2056
|
-
return /* @__PURE__ */ (0,
|
|
2159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2057
2160
|
SliderOrientationProvider,
|
|
2058
2161
|
{
|
|
2059
2162
|
scope: props.__scopeSlider,
|
|
@@ -2061,7 +2164,7 @@ var SliderVertical = React11.forwardRef(
|
|
|
2061
2164
|
endEdge: isSlidingFromBottom ? "top" : "bottom",
|
|
2062
2165
|
size: "height",
|
|
2063
2166
|
direction: isSlidingFromBottom ? 1 : -1,
|
|
2064
|
-
children: /* @__PURE__ */ (0,
|
|
2167
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2065
2168
|
SliderImpl,
|
|
2066
2169
|
{
|
|
2067
2170
|
"data-orientation": "vertical",
|
|
@@ -2107,7 +2210,7 @@ var SliderImpl = React11.forwardRef(
|
|
|
2107
2210
|
...sliderProps
|
|
2108
2211
|
} = props;
|
|
2109
2212
|
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
2110
|
-
return /* @__PURE__ */ (0,
|
|
2213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2111
2214
|
Primitive.span,
|
|
2112
2215
|
{
|
|
2113
2216
|
...sliderProps,
|
|
@@ -2154,7 +2257,7 @@ var SliderTrack = React11.forwardRef(
|
|
|
2154
2257
|
(props, forwardedRef) => {
|
|
2155
2258
|
const { __scopeSlider, ...trackProps } = props;
|
|
2156
2259
|
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
2157
|
-
return /* @__PURE__ */ (0,
|
|
2260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2158
2261
|
Primitive.span,
|
|
2159
2262
|
{
|
|
2160
2263
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -2180,7 +2283,7 @@ var SliderRange = React11.forwardRef(
|
|
|
2180
2283
|
);
|
|
2181
2284
|
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
2182
2285
|
const offsetEnd = 100 - Math.max(...percentages);
|
|
2183
|
-
return /* @__PURE__ */ (0,
|
|
2286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2184
2287
|
Primitive.span,
|
|
2185
2288
|
{
|
|
2186
2289
|
"data-orientation": context.orientation,
|
|
@@ -2207,7 +2310,7 @@ var SliderThumb = React11.forwardRef(
|
|
|
2207
2310
|
() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1,
|
|
2208
2311
|
[getItems, thumb]
|
|
2209
2312
|
);
|
|
2210
|
-
return /* @__PURE__ */ (0,
|
|
2313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SliderThumbImpl, { ...props, ref: composedRefs, index });
|
|
2211
2314
|
}
|
|
2212
2315
|
);
|
|
2213
2316
|
var SliderThumbImpl = React11.forwardRef(
|
|
@@ -2232,7 +2335,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2232
2335
|
};
|
|
2233
2336
|
}
|
|
2234
2337
|
}, [thumb, context.thumbs]);
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2236
2339
|
"span",
|
|
2237
2340
|
{
|
|
2238
2341
|
style: {
|
|
@@ -2241,7 +2344,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2241
2344
|
[orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
|
|
2242
2345
|
},
|
|
2243
2346
|
children: [
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Collection.ItemSlot, { scope: props.__scopeSlider, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2245
2348
|
Primitive.span,
|
|
2246
2349
|
{
|
|
2247
2350
|
role: "slider",
|
|
@@ -2261,7 +2364,7 @@ var SliderThumbImpl = React11.forwardRef(
|
|
|
2261
2364
|
})
|
|
2262
2365
|
}
|
|
2263
2366
|
) }),
|
|
2264
|
-
isFormControl && /* @__PURE__ */ (0,
|
|
2367
|
+
isFormControl && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2265
2368
|
SliderBubbleInput,
|
|
2266
2369
|
{
|
|
2267
2370
|
name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
|
|
@@ -2294,7 +2397,7 @@ var SliderBubbleInput = React11.forwardRef(
|
|
|
2294
2397
|
input.dispatchEvent(event);
|
|
2295
2398
|
}
|
|
2296
2399
|
}, [prevValue, value]);
|
|
2297
|
-
return /* @__PURE__ */ (0,
|
|
2400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2298
2401
|
Primitive.input,
|
|
2299
2402
|
{
|
|
2300
2403
|
style: { display: "none" },
|
|
@@ -2376,14 +2479,14 @@ function cn2(...inputs) {
|
|
|
2376
2479
|
}
|
|
2377
2480
|
|
|
2378
2481
|
// src/ui/slider.tsx
|
|
2379
|
-
var
|
|
2482
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2380
2483
|
function Slider2(props) {
|
|
2381
2484
|
const { className, defaultValue, value, min = 0, max = 100, ...rest } = props;
|
|
2382
2485
|
const _values = React12.useMemo(
|
|
2383
2486
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
2384
2487
|
[value, defaultValue, min, max]
|
|
2385
2488
|
);
|
|
2386
|
-
return /* @__PURE__ */ (0,
|
|
2489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2387
2490
|
Root5,
|
|
2388
2491
|
{
|
|
2389
2492
|
"data-slot": "slider",
|
|
@@ -2392,32 +2495,34 @@ function Slider2(props) {
|
|
|
2392
2495
|
min,
|
|
2393
2496
|
max,
|
|
2394
2497
|
className: cn2(
|
|
2395
|
-
"relative flex w-full touch-none items-center select-none data-
|
|
2498
|
+
"relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
|
|
2396
2499
|
className
|
|
2397
2500
|
),
|
|
2398
2501
|
...rest,
|
|
2399
2502
|
children: [
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2401
2504
|
Track,
|
|
2402
2505
|
{
|
|
2403
2506
|
"data-slot": "slider-track",
|
|
2404
2507
|
className: cn2(
|
|
2405
|
-
"relative grow overflow-hidden rounded-full bg-
|
|
2508
|
+
"relative grow overflow-hidden rounded-full bg-(--primary)/15 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
|
|
2406
2509
|
),
|
|
2407
|
-
children: /* @__PURE__ */ (0,
|
|
2510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2408
2511
|
Range,
|
|
2409
2512
|
{
|
|
2410
2513
|
"data-slot": "slider-range",
|
|
2411
|
-
className: cn2(
|
|
2514
|
+
className: cn2(
|
|
2515
|
+
"absolute bg-(--primary) data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
|
|
2516
|
+
)
|
|
2412
2517
|
}
|
|
2413
2518
|
)
|
|
2414
2519
|
}
|
|
2415
2520
|
),
|
|
2416
|
-
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0,
|
|
2521
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2417
2522
|
Thumb2,
|
|
2418
2523
|
{
|
|
2419
2524
|
"data-slot": "slider-thumb",
|
|
2420
|
-
className: "ring-ring/50 block size-5 shrink-0 rounded-full border border-
|
|
2525
|
+
className: "ring-ring/50 block size-5 shrink-0 rounded-full border border-(--b-inverse) bg-(--primary) shadow-(--primary)/20 shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
2421
2526
|
},
|
|
2422
2527
|
index
|
|
2423
2528
|
))
|
|
@@ -2427,7 +2532,7 @@ function Slider2(props) {
|
|
|
2427
2532
|
}
|
|
2428
2533
|
|
|
2429
2534
|
// src/components/CreditCardTab/Points/PointsSelector.tsx
|
|
2430
|
-
var
|
|
2535
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2431
2536
|
var PointsSelector = (props) => {
|
|
2432
2537
|
const { isDisabled, isSelected, onSelect, children } = props;
|
|
2433
2538
|
const { balance } = useSlapiBalance();
|
|
@@ -2446,44 +2551,49 @@ var PointsSelector = (props) => {
|
|
|
2446
2551
|
};
|
|
2447
2552
|
const pointsValue = String(Math.round(splitTokens));
|
|
2448
2553
|
const usdValue = formatUSD(usdAmount + getTransactionFee(usdAmount, appProps.transactionFeePercentage));
|
|
2449
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2450
2555
|
"button",
|
|
2451
2556
|
{
|
|
2452
2557
|
disabled: isDisabled,
|
|
2453
2558
|
onClick: onSelect,
|
|
2454
|
-
className: cn(
|
|
2455
|
-
"border-
|
|
2456
|
-
|
|
2457
|
-
|
|
2559
|
+
className: cn(
|
|
2560
|
+
"cursor-pointer overflow-hidden rounded-md border-2 border-transparent opacity-50 disabled:cursor-not-allowed",
|
|
2561
|
+
{
|
|
2562
|
+
"border-(--b-brand)": isSelected
|
|
2563
|
+
}
|
|
2564
|
+
),
|
|
2458
2565
|
children: [
|
|
2459
|
-
/* @__PURE__ */ (0,
|
|
2460
|
-
/* @__PURE__ */ (0,
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex h-11 w-full bg-(--s-primary) hover:bg-(--s-primary-hover)", children: [
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2461
2568
|
"div",
|
|
2462
2569
|
{
|
|
2463
|
-
className: cn(
|
|
2464
|
-
"
|
|
2465
|
-
|
|
2466
|
-
|
|
2570
|
+
className: cn(
|
|
2571
|
+
"flex h-full w-11 shrink-0 items-center justify-center border-r border-b border-(--b-inverse)",
|
|
2572
|
+
{
|
|
2573
|
+
"border-(--b-brand)": isSelected
|
|
2574
|
+
}
|
|
2575
|
+
),
|
|
2576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex size-5 items-center justify-center rounded-full border-2 border-(--brand-primary)", children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "size-2 rounded-full bg-(--brand-primary)" }) })
|
|
2467
2577
|
}
|
|
2468
2578
|
),
|
|
2469
|
-
/* @__PURE__ */ (0,
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex h-full w-full items-center justify-between gap-2 px-2 sm:gap-3 sm:px-3", children })
|
|
2470
2580
|
] }),
|
|
2471
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2473
|
-
/* @__PURE__ */ (0,
|
|
2581
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "px-2 pt-5 pb-2 sm:px-3 md:px-4", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between gap-2 sm:gap-3", children: [
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2474
2584
|
Input,
|
|
2475
2585
|
{
|
|
2476
2586
|
readOnly: true,
|
|
2477
2587
|
name: "points amount",
|
|
2478
2588
|
value: pointsValue,
|
|
2479
|
-
className: "sm:text-md min-w-[50px] bg-
|
|
2589
|
+
className: "sm:text-md min-w-[50px] bg-(--s-default) px-1 text-center text-xs font-medium sm:min-w-[100px] sm:px-2",
|
|
2480
2590
|
style: { width: `${pointsValue.length}ch` },
|
|
2481
2591
|
onClick: (e) => e.stopPropagation()
|
|
2482
2592
|
}
|
|
2483
2593
|
),
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2594
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-left text-xs leading-5 text-(--tertiary)", children: "Points" })
|
|
2485
2595
|
] }),
|
|
2486
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex w-full items-center pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2487
2597
|
Slider2,
|
|
2488
2598
|
{
|
|
2489
2599
|
value: [splitTokens],
|
|
@@ -2495,19 +2605,19 @@ var PointsSelector = (props) => {
|
|
|
2495
2605
|
step
|
|
2496
2606
|
}
|
|
2497
2607
|
) }),
|
|
2498
|
-
/* @__PURE__ */ (0,
|
|
2499
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2500
2610
|
Input,
|
|
2501
2611
|
{
|
|
2502
2612
|
readOnly: true,
|
|
2503
2613
|
name: "usd amount",
|
|
2504
2614
|
value: usdValue,
|
|
2505
|
-
className: "sm:text-md min-w-[50px] bg-
|
|
2615
|
+
className: "sm:text-md min-w-[50px] bg-(--s-default) px-1 text-center text-xs font-medium sm:min-w-[100px] sm:px-2",
|
|
2506
2616
|
style: { width: `${usdValue.length}ch` },
|
|
2507
2617
|
onClick: (e) => e.stopPropagation()
|
|
2508
2618
|
}
|
|
2509
2619
|
),
|
|
2510
|
-
/* @__PURE__ */ (0,
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-left text-xs leading-5 text-(--tertiary)", children: "Card" })
|
|
2511
2621
|
] })
|
|
2512
2622
|
] }) })
|
|
2513
2623
|
]
|
|
@@ -2516,7 +2626,7 @@ var PointsSelector = (props) => {
|
|
|
2516
2626
|
};
|
|
2517
2627
|
|
|
2518
2628
|
// src/components/CreditCardTab/Points/SplitBlock.tsx
|
|
2519
|
-
var
|
|
2629
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2520
2630
|
var SplitBlock = (props) => {
|
|
2521
2631
|
const { onToggle, isSelected, onSelect } = props;
|
|
2522
2632
|
const { balance, isBalanceLoading } = useSlapiBalance();
|
|
@@ -2560,21 +2670,21 @@ var SplitBlock = (props) => {
|
|
|
2560
2670
|
doInit();
|
|
2561
2671
|
}, [spreePayConfig?.pointsChain, initWallet, env.useWeb3Points]);
|
|
2562
2672
|
const isPointsSelectorDisabled = env.useWeb3Points ? !walletReady : false;
|
|
2563
|
-
return /* @__PURE__ */ (0,
|
|
2564
|
-
/* @__PURE__ */ (0,
|
|
2565
|
-
/* @__PURE__ */ (0,
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(PointsSelector, { isDisabled: isPointsSelectorDisabled, onSelect: () => onSelect("air"), isSelected, children: [
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex items-center gap-2", children: balance?.availablePoints ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("p", { className: "text-left text-xs font-medium text-(--brand-primary) sm:text-sm", children: [
|
|
2675
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-(--secondary)", children: "Available" }),
|
|
2566
2676
|
" ",
|
|
2567
2677
|
formatPoints(balance.availablePoints, pointsTitle),
|
|
2568
2678
|
" ",
|
|
2569
|
-
pointsConversionRatio && /* @__PURE__ */ (0,
|
|
2679
|
+
pointsConversionRatio && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-(--secondary)", children: formatUSD(balance.availablePoints * pointsConversionRatio) })
|
|
2570
2680
|
] }) : null }),
|
|
2571
|
-
isBalanceLoading ? /* @__PURE__ */ (0,
|
|
2572
|
-
address && /* @__PURE__ */ (0,
|
|
2681
|
+
isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "h-4 w-6 animate-pulse bg-(--s-secondary)" }) : !balance?.availablePoints && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-medium text-(--brand-primary)", children: "No points available" }),
|
|
2682
|
+
address && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-sm font-medium text-(--brand-primary)", children: address.length > 8 ? `${address.slice(0, 4)}...${address.slice(-4)}` : address })
|
|
2573
2683
|
] }) });
|
|
2574
2684
|
};
|
|
2575
2685
|
|
|
2576
2686
|
// src/components/CreditCardTab/Points/Points.tsx
|
|
2577
|
-
var
|
|
2687
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2578
2688
|
var Points = () => {
|
|
2579
2689
|
const [usePoints, setUsePoints] = (0, import_react12.useState)(false);
|
|
2580
2690
|
const [selectedPointsType, setSelectedPointsType] = (0, import_react12.useState)(null);
|
|
@@ -2588,8 +2698,8 @@ var Points = () => {
|
|
|
2588
2698
|
setSelectedPaymentMethod({ ...selectedPaymentMethod, splitAmount: void 0 });
|
|
2589
2699
|
}
|
|
2590
2700
|
};
|
|
2591
|
-
return /* @__PURE__ */ (0,
|
|
2592
|
-
/* @__PURE__ */ (0,
|
|
2701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2593
2703
|
PointsSwitch,
|
|
2594
2704
|
{
|
|
2595
2705
|
value: usePoints,
|
|
@@ -2598,7 +2708,7 @@ var Points = () => {
|
|
|
2598
2708
|
disabled: !spreePayConfig?.creditCard.enabled || !spreePayConfig?.creditCard.points || appProps.disabledPoints
|
|
2599
2709
|
}
|
|
2600
2710
|
),
|
|
2601
|
-
usePoints && /* @__PURE__ */ (0,
|
|
2711
|
+
usePoints && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2602
2712
|
SplitBlock,
|
|
2603
2713
|
{
|
|
2604
2714
|
onToggle: handleTogglePoints,
|
|
@@ -2610,7 +2720,7 @@ var Points = () => {
|
|
|
2610
2720
|
};
|
|
2611
2721
|
|
|
2612
2722
|
// src/components/CreditCardTab/CreditCardTab.tsx
|
|
2613
|
-
var
|
|
2723
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2614
2724
|
var CreditCardTab = () => {
|
|
2615
2725
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
2616
2726
|
const { env } = useSpreePayEnv();
|
|
@@ -2665,23 +2775,157 @@ var CreditCardTab = () => {
|
|
|
2665
2775
|
(0, import_react13.useEffect)(() => {
|
|
2666
2776
|
register(handlePay);
|
|
2667
2777
|
}, [register, handlePay]);
|
|
2668
|
-
return /* @__PURE__ */ (0,
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2670
|
-
/* @__PURE__ */ (0,
|
|
2778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { children: [
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "border-b border-b-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CreditCard, {}) }),
|
|
2780
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-4 border-b border-b-(--border-component-specific-card) px-5 pt-5 pb-5 md:px-7 md:pt-6 md:pb-7", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Points, {}) })
|
|
2781
|
+
] });
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
// src/components/CryptoComTab/CryptoComTab.tsx
|
|
2785
|
+
var import_react14 = require("react");
|
|
2786
|
+
|
|
2787
|
+
// src/hooks/payments/useCryptoComPayment.ts
|
|
2788
|
+
var import_nice_modal_react5 = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
2789
|
+
var useCryptoComPayment = () => {
|
|
2790
|
+
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
2791
|
+
const { env } = useSpreePayEnv();
|
|
2792
|
+
const cryptoComPayment = async (params) => {
|
|
2793
|
+
if (selectedPaymentMethod.type !== "CDC" /* CDC */) {
|
|
2794
|
+
throw new Error("Unsupported payment method");
|
|
2795
|
+
}
|
|
2796
|
+
const { hash, metadata } = params;
|
|
2797
|
+
const { data: paymentResData } = await SlapiPaymentService.createPayment({
|
|
2798
|
+
hash,
|
|
2799
|
+
metadata,
|
|
2800
|
+
type: "CDC" /* CDC */,
|
|
2801
|
+
cdc: {
|
|
2802
|
+
returnUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}?payment_intent=success`,
|
|
2803
|
+
cancelUrl: `${typeof window !== "undefined" ? window.location.origin : ""}${env.redirect3dsURI}?payment_intent=canceled`
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
let { status } = paymentResData;
|
|
2807
|
+
if (paymentResData.redirectUrl) {
|
|
2808
|
+
const paymentIntent = await import_nice_modal_react5.default.show(Iframe3ds, { url: paymentResData.redirectUrl });
|
|
2809
|
+
if (paymentIntent === "success") {
|
|
2810
|
+
const { data: validateData } = await SlapiPaymentService.validateCDC({ paymentId: paymentResData.id });
|
|
2811
|
+
({ status } = validateData);
|
|
2812
|
+
} else {
|
|
2813
|
+
status = "FAILED" /* FAILED */;
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
return {
|
|
2817
|
+
status,
|
|
2818
|
+
paymentType: "CDC" /* CDC */,
|
|
2819
|
+
paymentId: paymentResData.id,
|
|
2820
|
+
txId: paymentResData.txId,
|
|
2821
|
+
txHash: null
|
|
2822
|
+
};
|
|
2823
|
+
};
|
|
2824
|
+
return { cryptoComPayment };
|
|
2825
|
+
};
|
|
2826
|
+
|
|
2827
|
+
// src/components/CryptoComTab/Checkout.tsx
|
|
2828
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2829
|
+
var Checkout = () => {
|
|
2830
|
+
const { appProps } = useStaticConfig();
|
|
2831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2832
|
+
"button",
|
|
2833
|
+
{
|
|
2834
|
+
onClick: appProps.onProcess,
|
|
2835
|
+
disabled: appProps.isProcessing,
|
|
2836
|
+
className: "flex flex-col items-center rounded-md bg-[#00307D] p-2 text-(--brand-primary) hover:bg-[#002655] disabled:cursor-not-allowed disabled:bg-[#002655] disabled:text-(--disabled)",
|
|
2837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "76", height: "28", fill: "none", viewBox: "0 0 76 28", children: [
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2839
|
+
"path",
|
|
2840
|
+
{
|
|
2841
|
+
fill: "currentColor",
|
|
2842
|
+
fillRule: "evenodd",
|
|
2843
|
+
d: "M47.42 9.06c0 4.02-3.25 6.09-7.1 6.09h-4.38v6.53h-2.03V3.16h6.75c4.08 0 6.76 2.22 6.76 5.9m-2.06.08c0-2.68-1.94-4.05-4.85-4.05h-4.57v8.15h4.47c2.99 0 4.95-1.64 4.95-4.1m9.28.47c-1.57 0-2.81.43-4.05 1.01L50 8.95a11 11 0 0 1 4.86-1.14c3.63 0 5.67 1.9 5.67 5.5v8.37h-1.9v-2.06a5.8 5.8 0 0 1-4.83 2.35c-2.48 0-4.98-1.43-4.98-4.28 0-2.92 2.32-4.45 5.7-4.45 1.7 0 2.92.24 4.1.58v-.47c0-2.47-1.47-3.74-3.97-3.74m.08 5.14c1.62 0 2.94.29 3.92.58v1.32c0 2.17-2.01 3.71-4.46 3.71-1.8 0-3.36-1-3.36-2.75s1.4-2.86 3.9-2.86m12.23 11.8 1.75-4.7-6.14-13.8h2.2l4.84 11.4 4.28-11.4H76l-7.32 18.5z",
|
|
2844
|
+
clipRule: "evenodd"
|
|
2845
|
+
}
|
|
2846
|
+
),
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2848
|
+
"path",
|
|
2849
|
+
{
|
|
2850
|
+
fill: "currentColor",
|
|
2851
|
+
fillRule: "evenodd",
|
|
2852
|
+
d: "M0 6.77V20.3l11.66 6.77 11.66-6.77V6.77L11.66 0zM1.03 19.7V7.36L11.66 1.2 22.3 7.36v12.35l-10.64 6.17z",
|
|
2853
|
+
clipRule: "evenodd"
|
|
2854
|
+
}
|
|
2855
|
+
),
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2857
|
+
"path",
|
|
2858
|
+
{
|
|
2859
|
+
fill: "currentColor",
|
|
2860
|
+
fillRule: "evenodd",
|
|
2861
|
+
d: "M16.23 5.84H7.07L6 10.54h11.33zM8.7 17v-3.12l-2.72-1.73-3.07 2.3 4.19 7.31h1.67l1.98-1.85v-.93z",
|
|
2862
|
+
clipRule: "evenodd"
|
|
2863
|
+
}
|
|
2864
|
+
),
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2866
|
+
"path",
|
|
2867
|
+
{
|
|
2868
|
+
fill: "currentColor",
|
|
2869
|
+
fillRule: "evenodd",
|
|
2870
|
+
d: "M14.64 11.25H8.7l1 2.62-.3 2.94h4.54l-.28-2.94z",
|
|
2871
|
+
clipRule: "evenodd"
|
|
2872
|
+
}
|
|
2873
|
+
),
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2875
|
+
"path",
|
|
2876
|
+
{
|
|
2877
|
+
fill: "currentColor",
|
|
2878
|
+
fillRule: "evenodd",
|
|
2879
|
+
d: "m17.35 12.13-2.68 1.75V17l-2.05 1.98v.93l1.98 1.83h1.65l4.16-7.3z",
|
|
2880
|
+
clipRule: "evenodd"
|
|
2881
|
+
}
|
|
2882
|
+
)
|
|
2883
|
+
] })
|
|
2884
|
+
}
|
|
2885
|
+
);
|
|
2886
|
+
};
|
|
2887
|
+
|
|
2888
|
+
// src/components/CryptoComTab/CryptoComTab.tsx
|
|
2889
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2890
|
+
var CryptoComTab = () => {
|
|
2891
|
+
const { register } = useSpreePayRegister();
|
|
2892
|
+
const { cryptoComPayment } = useCryptoComPayment();
|
|
2893
|
+
const { spreePayConfig } = useSpreePayConfig();
|
|
2894
|
+
const handlePay = (0, import_react14.useCallback)(
|
|
2895
|
+
async (data) => {
|
|
2896
|
+
try {
|
|
2897
|
+
const res = await cryptoComPayment(data);
|
|
2898
|
+
if (["AUTHORIZED" /* AUTHORIZED */, "CAPTURED" /* CAPTURED */].includes(res.status)) {
|
|
2899
|
+
return Promise.resolve(res);
|
|
2900
|
+
}
|
|
2901
|
+
return Promise.reject(new PaymentError("Crypto payment failed", res.status));
|
|
2902
|
+
} catch (_) {
|
|
2903
|
+
return Promise.reject(new PaymentError("Payment failed", "FAILED" /* FAILED */));
|
|
2904
|
+
}
|
|
2905
|
+
},
|
|
2906
|
+
[cryptoComPayment]
|
|
2907
|
+
);
|
|
2908
|
+
(0, import_react14.useEffect)(() => {
|
|
2909
|
+
register(handlePay);
|
|
2910
|
+
}, [register, handlePay]);
|
|
2911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex w-full flex-col gap-4 border-b border-b-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: [
|
|
2912
|
+
spreePayConfig?.cryptoCom.infoMessage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoBanner, { message: spreePayConfig.cryptoCom.infoMessage }),
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Legal, {}),
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Checkout, {})
|
|
2671
2915
|
] });
|
|
2672
2916
|
};
|
|
2673
2917
|
|
|
2674
2918
|
// src/components/CryptoTab/Crypto/CryptoWrapper.tsx
|
|
2675
|
-
var
|
|
2919
|
+
var import_react17 = require("react");
|
|
2676
2920
|
var import_react_query = require("@tanstack/react-query");
|
|
2677
|
-
var
|
|
2921
|
+
var import_nice_modal_react8 = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
2678
2922
|
var import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
2679
2923
|
var import_styles = require("@rainbow-me/rainbowkit/styles.css");
|
|
2680
2924
|
var import_wagmi5 = require("wagmi");
|
|
2681
2925
|
var import_chains = require("wagmi/chains");
|
|
2682
2926
|
|
|
2683
2927
|
// src/components/CryptoTab/Crypto/Crypto.tsx
|
|
2684
|
-
var
|
|
2928
|
+
var import_react16 = require("react");
|
|
2685
2929
|
var import_wagmi4 = require("wagmi");
|
|
2686
2930
|
|
|
2687
2931
|
// ../../node_modules/@wagmi/core/dist/esm/utils/getAction.js
|
|
@@ -2856,70 +3100,50 @@ var useCryptoPayment = () => {
|
|
|
2856
3100
|
|
|
2857
3101
|
// src/components/CryptoTab/Crypto/ConnectButton.tsx
|
|
2858
3102
|
var import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
2859
|
-
var
|
|
3103
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2860
3104
|
var ConnectButton = () => {
|
|
2861
|
-
|
|
3105
|
+
const buttonCN = "h-9 rounded-full border border-(--b-brand) px-4 text-sm font-medium text-(--brand-primary)";
|
|
3106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_rainbowkit.ConnectButton.Custom, { children: ({ mounted, chain, account, openAccountModal, openChainModal, openConnectModal }) => {
|
|
2862
3107
|
if (!mounted) return null;
|
|
2863
|
-
return /* @__PURE__ */ (0,
|
|
3108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: (() => {
|
|
2864
3109
|
if (!mounted || !account || !chain) {
|
|
2865
|
-
return /* @__PURE__ */ (0,
|
|
2866
|
-
"button",
|
|
2867
|
-
{
|
|
2868
|
-
className: "h-[34px] rounded-md border border-black px-3 text-sm font-medium text-black",
|
|
2869
|
-
onClick: openConnectModal,
|
|
2870
|
-
children: "Connect a Wallet"
|
|
2871
|
-
}
|
|
2872
|
-
);
|
|
3110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { className: buttonCN, onClick: openConnectModal, children: "Connect wallet" });
|
|
2873
3111
|
}
|
|
2874
3112
|
if (chain.unsupported) {
|
|
2875
|
-
return /* @__PURE__ */ (0,
|
|
2876
|
-
"button",
|
|
2877
|
-
{
|
|
2878
|
-
className: "h-[34px] rounded-md border border-black px-3 text-sm font-medium text-black",
|
|
2879
|
-
onClick: openChainModal,
|
|
2880
|
-
children: "Select a Network"
|
|
2881
|
-
}
|
|
2882
|
-
);
|
|
3113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { className: buttonCN, onClick: openChainModal, children: "Select a Network" });
|
|
2883
3114
|
}
|
|
2884
|
-
return /* @__PURE__ */ (0,
|
|
2885
|
-
"
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
onClick: openAccountModal,
|
|
2889
|
-
children: [
|
|
2890
|
-
chain.hasIcon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "size-6 overflow-hidden rounded-full", style: { background: chain.iconBackground }, children: chain.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { alt: chain.name ?? "Chain icon", src: chain.iconUrl }) }),
|
|
2891
|
-
account.displayName
|
|
2892
|
-
]
|
|
2893
|
-
}
|
|
2894
|
-
);
|
|
3115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("button", { className: cn(buttonCN, "flex items-center gap-2 pl-1.5"), onClick: openAccountModal, children: [
|
|
3116
|
+
chain.hasIcon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "size-6 overflow-hidden rounded-full", style: { background: chain.iconBackground }, children: chain.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { alt: chain.name ?? "Chain icon", src: chain.iconUrl }) }),
|
|
3117
|
+
account.displayName
|
|
3118
|
+
] });
|
|
2895
3119
|
})() });
|
|
2896
3120
|
} });
|
|
2897
3121
|
};
|
|
2898
3122
|
|
|
2899
3123
|
// src/config/symbolLogos.tsx
|
|
2900
|
-
var
|
|
2901
|
-
var MOCA_SVG = /* @__PURE__ */ (0,
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
3124
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3125
|
+
var MOCA_SVG = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", fill: "none", children: [
|
|
3126
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: "14", cy: "14", r: "13.5", fill: "#C15F97" }),
|
|
3127
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2904
3128
|
"path",
|
|
2905
3129
|
{
|
|
2906
3130
|
fill: "#fff",
|
|
2907
3131
|
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"
|
|
2908
3132
|
}
|
|
2909
3133
|
),
|
|
2910
|
-
/* @__PURE__ */ (0,
|
|
3134
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("circle", { cx: "16", cy: "14", r: "1.5", fill: "#fff" })
|
|
2911
3135
|
] });
|
|
2912
|
-
var USDC_SVG = /* @__PURE__ */ (0,
|
|
2913
|
-
/* @__PURE__ */ (0,
|
|
2914
|
-
/* @__PURE__ */ (0,
|
|
2915
|
-
/* @__PURE__ */ (0,
|
|
3136
|
+
var USDC_SVG = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", fill: "none", children: [
|
|
3137
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { clipPath: "url(#clip0_528_9163)", children: [
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }),
|
|
3139
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2916
3140
|
"path",
|
|
2917
3141
|
{
|
|
2918
3142
|
fill: "#fff",
|
|
2919
3143
|
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"
|
|
2920
3144
|
}
|
|
2921
3145
|
),
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2923
3147
|
"path",
|
|
2924
3148
|
{
|
|
2925
3149
|
fill: "#fff",
|
|
@@ -2927,11 +3151,11 @@ var USDC_SVG = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { xmlns: "h
|
|
|
2927
3151
|
}
|
|
2928
3152
|
)
|
|
2929
3153
|
] }),
|
|
2930
|
-
/* @__PURE__ */ (0,
|
|
3154
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("clipPath", { id: "clip0_528_9163", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { fill: "#fff", d: "M0 0h28v28H0z" }) }) })
|
|
2931
3155
|
] });
|
|
2932
|
-
var USDT_SVG = /* @__PURE__ */ (0,
|
|
2933
|
-
/* @__PURE__ */ (0,
|
|
2934
|
-
/* @__PURE__ */ (0,
|
|
3156
|
+
var USDT_SVG = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "28", height: "28", fill: "none", children: [
|
|
3157
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { fill: "#26A17B", d: "M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28Z" }),
|
|
3158
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2935
3159
|
"path",
|
|
2936
3160
|
{
|
|
2937
3161
|
fill: "#fff",
|
|
@@ -2939,23 +3163,23 @@ var USDT_SVG = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { xmlns: "h
|
|
|
2939
3163
|
}
|
|
2940
3164
|
)
|
|
2941
3165
|
] });
|
|
2942
|
-
var WETH_SVG = /* @__PURE__ */ (0,
|
|
2943
|
-
/* @__PURE__ */ (0,
|
|
2944
|
-
/* @__PURE__ */ (0,
|
|
3166
|
+
var WETH_SVG = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", width: "28", height: "28", viewBox: "0 0 24 24", children: [
|
|
3167
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { clipPath: "url(#clip0_528_9173)", children: [
|
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2945
3169
|
"path",
|
|
2946
3170
|
{
|
|
2947
3171
|
fill: "#000",
|
|
2948
3172
|
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"
|
|
2949
3173
|
}
|
|
2950
3174
|
),
|
|
2951
|
-
/* @__PURE__ */ (0,
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2952
3176
|
"path",
|
|
2953
3177
|
{
|
|
2954
3178
|
fill: "#F61F7D",
|
|
2955
3179
|
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"
|
|
2956
3180
|
}
|
|
2957
3181
|
),
|
|
2958
|
-
/* @__PURE__ */ (0,
|
|
3182
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2959
3183
|
"path",
|
|
2960
3184
|
{
|
|
2961
3185
|
fill: "#000",
|
|
@@ -2964,8 +3188,8 @@ var WETH_SVG = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { xmlns: "h
|
|
|
2964
3188
|
clipRule: "evenodd"
|
|
2965
3189
|
}
|
|
2966
3190
|
),
|
|
2967
|
-
/* @__PURE__ */ (0,
|
|
2968
|
-
/* @__PURE__ */ (0,
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("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" }),
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2969
3193
|
"path",
|
|
2970
3194
|
{
|
|
2971
3195
|
fill: "#000",
|
|
@@ -2974,8 +3198,8 @@ var WETH_SVG = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { xmlns: "h
|
|
|
2974
3198
|
clipRule: "evenodd"
|
|
2975
3199
|
}
|
|
2976
3200
|
),
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
2978
|
-
/* @__PURE__ */ (0,
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { fill: "#000", fillRule: "evenodd", d: "M3.02 10.63.7 8.75l.74-.86 2.34 1.87-.75.87Z", clipRule: "evenodd" }),
|
|
3202
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2979
3203
|
"path",
|
|
2980
3204
|
{
|
|
2981
3205
|
fill: "#000",
|
|
@@ -2983,7 +3207,7 @@ var WETH_SVG = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { xmlns: "h
|
|
|
2983
3207
|
}
|
|
2984
3208
|
)
|
|
2985
3209
|
] }),
|
|
2986
|
-
/* @__PURE__ */ (0,
|
|
3210
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("clipPath", { id: "clip0_528_9173", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
|
|
2987
3211
|
] });
|
|
2988
3212
|
var symbolLogos = {
|
|
2989
3213
|
MOCA: MOCA_SVG,
|
|
@@ -2996,27 +3220,27 @@ function getSymbolLogo(symbol) {
|
|
|
2996
3220
|
}
|
|
2997
3221
|
|
|
2998
3222
|
// src/components/CryptoTab/Crypto/Logos.tsx
|
|
2999
|
-
var
|
|
3223
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3000
3224
|
var Logos = () => {
|
|
3001
|
-
return /* @__PURE__ */ (0,
|
|
3002
|
-
/* @__PURE__ */ (0,
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
3004
|
-
/* @__PURE__ */ (0,
|
|
3005
|
-
/* @__PURE__ */ (0,
|
|
3225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex", children: [
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "rounded-full border border-(--b-primary)", children: getSymbolLogo("MOCA") }),
|
|
3227
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "-ml-2.5 rounded-full border border-(--b-primary)", children: getSymbolLogo("USDC") }),
|
|
3228
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "-ml-2.5 rounded-full border border-(--b-primary)", children: getSymbolLogo("USDT") }),
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "-ml-2.5 rounded-full border border-(--b-primary) bg-(--s-primary)", children: getSymbolLogo("WETH") })
|
|
3006
3230
|
] });
|
|
3007
3231
|
};
|
|
3008
3232
|
|
|
3009
3233
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
3010
|
-
var
|
|
3234
|
+
var import_nice_modal_react7 = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
3011
3235
|
|
|
3012
3236
|
// src/modals/CryptoSelectModal.tsx
|
|
3013
|
-
var
|
|
3014
|
-
var
|
|
3237
|
+
var import_react15 = require("react");
|
|
3238
|
+
var import_nice_modal_react6 = __toESM(require("@ebay/nice-modal-react"), 1);
|
|
3015
3239
|
|
|
3016
3240
|
// ../ui/src/components/input.tsx
|
|
3017
|
-
var
|
|
3241
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3018
3242
|
function Input2({ className, type, ...props }) {
|
|
3019
|
-
return /* @__PURE__ */ (0,
|
|
3243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3020
3244
|
"input",
|
|
3021
3245
|
{
|
|
3022
3246
|
type,
|
|
@@ -3039,7 +3263,7 @@ var React14 = __toESM(require("react"), 1);
|
|
|
3039
3263
|
var React13 = __toESM(require("react"), 1);
|
|
3040
3264
|
var ReactDOM2 = __toESM(require("react-dom"), 1);
|
|
3041
3265
|
var import_react_slot5 = require("@radix-ui/react-slot");
|
|
3042
|
-
var
|
|
3266
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3043
3267
|
var NODES2 = [
|
|
3044
3268
|
"a",
|
|
3045
3269
|
"button",
|
|
@@ -3067,14 +3291,14 @@ var Primitive2 = NODES2.reduce((primitive, node) => {
|
|
|
3067
3291
|
if (typeof window !== "undefined") {
|
|
3068
3292
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
3069
3293
|
}
|
|
3070
|
-
return /* @__PURE__ */ (0,
|
|
3294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
3071
3295
|
});
|
|
3072
3296
|
Node2.displayName = `Primitive.${node}`;
|
|
3073
3297
|
return { ...primitive, [node]: Node2 };
|
|
3074
3298
|
}, {});
|
|
3075
3299
|
|
|
3076
3300
|
// ../../node_modules/@radix-ui/react-separator/dist/index.mjs
|
|
3077
|
-
var
|
|
3301
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3078
3302
|
var NAME = "Separator";
|
|
3079
3303
|
var DEFAULT_ORIENTATION = "horizontal";
|
|
3080
3304
|
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
@@ -3083,7 +3307,7 @@ var Separator = React14.forwardRef((props, forwardedRef) => {
|
|
|
3083
3307
|
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
3084
3308
|
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
3085
3309
|
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
3086
|
-
return /* @__PURE__ */ (0,
|
|
3310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3087
3311
|
Primitive2.div,
|
|
3088
3312
|
{
|
|
3089
3313
|
"data-orientation": orientation,
|
|
@@ -3100,14 +3324,14 @@ function isValidOrientation(orientation) {
|
|
|
3100
3324
|
var Root6 = Separator;
|
|
3101
3325
|
|
|
3102
3326
|
// ../ui/src/components/separator.tsx
|
|
3103
|
-
var
|
|
3327
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3104
3328
|
function Separator2({
|
|
3105
3329
|
className,
|
|
3106
3330
|
orientation = "horizontal",
|
|
3107
3331
|
decorative = true,
|
|
3108
3332
|
...props
|
|
3109
3333
|
}) {
|
|
3110
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3111
3335
|
Root6,
|
|
3112
3336
|
{
|
|
3113
3337
|
"data-slot": "separator",
|
|
@@ -3214,14 +3438,14 @@ var useBaseTokens = () => {
|
|
|
3214
3438
|
};
|
|
3215
3439
|
|
|
3216
3440
|
// src/modals/CryptoSelectModal.tsx
|
|
3217
|
-
var
|
|
3218
|
-
var CryptoSelectModal =
|
|
3219
|
-
const modal = (0,
|
|
3441
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3442
|
+
var CryptoSelectModal = import_nice_modal_react6.default.create(() => {
|
|
3443
|
+
const modal = (0, import_nice_modal_react6.useModal)();
|
|
3220
3444
|
const { isLoading, error, erc20Balances } = useBaseERC20Token();
|
|
3221
3445
|
const { isLoadingNative, nativeError, nativeBalance } = useBaseNativeToken();
|
|
3222
3446
|
const { tokens, tokensIsLoading } = useBaseTokens();
|
|
3223
|
-
const [search, setSearch] = (0,
|
|
3224
|
-
const filteredCoins = (0,
|
|
3447
|
+
const [search, setSearch] = (0, import_react15.useState)("");
|
|
3448
|
+
const filteredCoins = (0, import_react15.useMemo)(() => {
|
|
3225
3449
|
return tokens.filter(
|
|
3226
3450
|
(coin) => coin.name.toLowerCase().includes(search.toLowerCase()) || coin.symbol.toLowerCase().includes(search.toLowerCase())
|
|
3227
3451
|
);
|
|
@@ -3232,86 +3456,86 @@ var CryptoSelectModal = import_nice_modal_react5.default.create(() => {
|
|
|
3232
3456
|
setSelectedPaymentMethod({ type: "CRYPTO" /* CRYPTO */, method: coin });
|
|
3233
3457
|
};
|
|
3234
3458
|
const userCoins = [nativeBalance, ...erc20Balances].filter(Boolean);
|
|
3235
|
-
return /* @__PURE__ */ (0,
|
|
3236
|
-
/* @__PURE__ */ (0,
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Dialog, { open: modal.visible, onOpenChange: modal.remove, children: [
|
|
3460
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DialogDescription, { className: "hidden", children: "Crypto Select Modal" }),
|
|
3461
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(DialogContent, { showCloseButton: false, className: "max-h-[90vh] gap-0 p-0", children: [
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7", children: [
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3464
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { className: "rounded-md hover:bg-(--s-primary-hover)", onClick: modal.remove, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { stroke: "currentColor", d: "m15 6.5-6 6 6 6" }) }) }),
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DialogTitle, { className: "text-2xl font-medium text-(--brand-primary)", children: "Select a token" }),
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { className: "rounded-md p-1 hover:bg-(--s-primary-hover)", onClick: modal.remove, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "17", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3243
3467
|
"path",
|
|
3244
3468
|
{
|
|
3245
|
-
fill: "
|
|
3469
|
+
fill: "currentColor",
|
|
3246
3470
|
d: "M12.6 3.9c.2.2.2.52 0 .71L8.7 8.5l3.9 3.89a.5.5 0 1 1-.71.7L8 9.22 4.11 13.1a.5.5 0 1 1-.7-.71L7.28 8.5 3.4 4.61a.5.5 0 1 1 .71-.7L8 7.78l3.89-3.89c.2-.2.51-.2.7 0Z"
|
|
3247
3471
|
}
|
|
3248
3472
|
) }) })
|
|
3249
3473
|
] }),
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3474
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Input2, { onChange: (e) => setSearch(e.target.value), placeholder: "Search by token name", value: search })
|
|
3251
3475
|
] }),
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3253
|
-
/* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3255
|
-
(error || nativeError) && /* @__PURE__ */ (0,
|
|
3256
|
-
/* @__PURE__ */ (0,
|
|
3257
|
-
isLoadingNative && /* @__PURE__ */ (0,
|
|
3258
|
-
nativeBalance && /* @__PURE__ */ (0,
|
|
3476
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Separator2, { className: "hidden md:block" }),
|
|
3477
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-4 px-5 py-5 md:px-7", children: [
|
|
3478
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { className: "text-md font-medium text-(--brand-primary)", children: "Tokens with wallet balance" }),
|
|
3479
|
+
(error || nativeError) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-center text-sm text-(--negative)", children: "Something wrong" }),
|
|
3480
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
|
|
3481
|
+
isLoadingNative && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" }),
|
|
3482
|
+
nativeBalance && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3259
3483
|
"button",
|
|
3260
3484
|
{
|
|
3261
|
-
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-
|
|
3485
|
+
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-(--brand-primary) hover:bg-(--s-primary-hover)",
|
|
3262
3486
|
onClick: () => handleSelect(nativeBalance),
|
|
3263
3487
|
children: [
|
|
3264
|
-
/* @__PURE__ */ (0,
|
|
3265
|
-
nativeBalance.logoURI && /* @__PURE__ */ (0,
|
|
3266
|
-
/* @__PURE__ */ (0,
|
|
3488
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3489
|
+
nativeBalance.logoURI && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { className: "size-8 shrink-0", src: nativeBalance.logoURI, alt: `${nativeBalance.symbol} logo` }),
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-sm font-medium", children: nativeBalance.symbol })
|
|
3267
3491
|
] }),
|
|
3268
|
-
/* @__PURE__ */ (0,
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-sm font-medium", children: nativeBalance.formatted })
|
|
3269
3493
|
]
|
|
3270
3494
|
},
|
|
3271
3495
|
nativeBalance.symbol
|
|
3272
3496
|
),
|
|
3273
|
-
isLoading && /* @__PURE__ */ (0,
|
|
3274
|
-
/* @__PURE__ */ (0,
|
|
3275
|
-
/* @__PURE__ */ (0,
|
|
3276
|
-
/* @__PURE__ */ (0,
|
|
3497
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" }),
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" }),
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" })
|
|
3277
3501
|
] }),
|
|
3278
3502
|
erc20Balances.map((coin) => {
|
|
3279
3503
|
const Icon = getSymbolLogo(coin.symbol);
|
|
3280
|
-
return /* @__PURE__ */ (0,
|
|
3504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3281
3505
|
"button",
|
|
3282
3506
|
{
|
|
3283
|
-
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-
|
|
3507
|
+
className: "flex h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-(--brand-primary) hover:bg-(--s-primary-hover) disabled:cursor-not-allowed disabled:opacity-50",
|
|
3284
3508
|
onClick: () => handleSelect(coin),
|
|
3285
3509
|
children: [
|
|
3286
|
-
/* @__PURE__ */ (0,
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3287
3511
|
Boolean(Icon) && Icon,
|
|
3288
|
-
/* @__PURE__ */ (0,
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-sm font-medium", children: coin.symbol })
|
|
3289
3513
|
] }),
|
|
3290
|
-
/* @__PURE__ */ (0,
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-sm font-medium", children: coin.formatted })
|
|
3291
3515
|
]
|
|
3292
3516
|
},
|
|
3293
3517
|
coin.symbol
|
|
3294
3518
|
);
|
|
3295
3519
|
})
|
|
3296
3520
|
] }),
|
|
3297
|
-
/* @__PURE__ */ (0,
|
|
3298
|
-
/* @__PURE__ */ (0,
|
|
3299
|
-
tokensIsLoading && /* @__PURE__ */ (0,
|
|
3300
|
-
/* @__PURE__ */ (0,
|
|
3301
|
-
/* @__PURE__ */ (0,
|
|
3302
|
-
/* @__PURE__ */ (0,
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { className: "text-md font-medium text-(--brand-primary)", children: "All Tokens" }),
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex max-h-[40vh] w-full flex-col gap-1 overflow-y-auto", children: [
|
|
3523
|
+
tokensIsLoading && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" }),
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "h-11 animate-pulse rounded-md bg-(--s-primary)" })
|
|
3303
3527
|
] }),
|
|
3304
3528
|
filteredCoins.map((token) => {
|
|
3305
3529
|
const userCoin = userCoins.find((c) => c.symbol === token.symbol);
|
|
3306
|
-
return /* @__PURE__ */ (0,
|
|
3530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3307
3531
|
"button",
|
|
3308
3532
|
{
|
|
3309
3533
|
disabled: !userCoin,
|
|
3310
3534
|
onClick: () => userCoin && handleSelect(userCoin),
|
|
3311
|
-
className: "flex min-h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-
|
|
3312
|
-
children: /* @__PURE__ */ (0,
|
|
3313
|
-
token.logoURI ? /* @__PURE__ */ (0,
|
|
3314
|
-
/* @__PURE__ */ (0,
|
|
3535
|
+
className: "flex min-h-11 w-full items-center justify-between gap-4 rounded-sm px-1.5 text-(--brand-primary) hover:bg-(--s-primary-hover) disabled:cursor-not-allowed disabled:opacity-50",
|
|
3536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3537
|
+
token.logoURI ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("img", { className: "size-8 shrink-0", src: token.logoURI, alt: `${token.name} logo` }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "size-8 shrink-0 rounded-full bg-(--s-tertiary)" }),
|
|
3538
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-sm font-medium", children: token.symbol })
|
|
3315
3539
|
] })
|
|
3316
3540
|
},
|
|
3317
3541
|
token.symbol
|
|
@@ -3325,51 +3549,56 @@ var CryptoSelectModal = import_nice_modal_react5.default.create(() => {
|
|
|
3325
3549
|
CryptoSelectModal.displayName = "CryptoSelectModal";
|
|
3326
3550
|
|
|
3327
3551
|
// src/components/CryptoTab/Crypto/SelectCoinButton.tsx
|
|
3328
|
-
var
|
|
3552
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3329
3553
|
var SelectCoinButton = () => {
|
|
3330
3554
|
const openModal = () => {
|
|
3331
|
-
|
|
3555
|
+
import_nice_modal_react7.default.show(CryptoSelectModal);
|
|
3332
3556
|
};
|
|
3333
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3558
|
+
"button",
|
|
3559
|
+
{
|
|
3560
|
+
onClick: openModal,
|
|
3561
|
+
className: "flex h-11 w-full overflow-hidden rounded-md bg-(--s-primary) hover:bg-(--s-primary-hover)",
|
|
3562
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex h-full w-full items-center justify-between px-3", children: [
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "font-medium text-(--secondary)", children: "Select a token" }) }),
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("path", { stroke: "currentColor", strokeLinecap: "round", d: "m6 12.43 4-4-4-4" }) })
|
|
3565
|
+
] })
|
|
3566
|
+
}
|
|
3567
|
+
);
|
|
3340
3568
|
};
|
|
3341
3569
|
|
|
3342
3570
|
// src/components/CryptoTab/Crypto/SelectedCoin.tsx
|
|
3343
|
-
var
|
|
3571
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3344
3572
|
var SelectedCoin = (props) => {
|
|
3345
3573
|
const { coin, balance, logoURI } = props;
|
|
3346
3574
|
const Icon = getSymbolLogo(coin);
|
|
3347
|
-
return /* @__PURE__ */ (0,
|
|
3348
|
-
/* @__PURE__ */ (0,
|
|
3349
|
-
/* @__PURE__ */ (0,
|
|
3350
|
-
/* @__PURE__ */ (0,
|
|
3575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex h-12 w-full overflow-hidden rounded-md border-2 border-(--b-brand) bg-(--s-primary)", children: [
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex h-full w-11 shrink-0 items-center justify-center border-r border-(--b-brand) bg-(--s-primary)", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex size-5 items-center justify-center rounded-full border-2 border-(--brand-primary)", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "size-2 rounded-full bg-(--brand-primary)" }) }) }),
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex h-full w-full items-center justify-between rounded-r-md px-3", children: [
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3351
3579
|
Icon,
|
|
3352
|
-
!Icon && logoURI && /* @__PURE__ */ (0,
|
|
3353
|
-
/* @__PURE__ */ (0,
|
|
3354
|
-
/* @__PURE__ */ (0,
|
|
3580
|
+
!Icon && logoURI && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { className: "mr-1 size-8 shrink-0", src: logoURI, alt: `${coin} logo` }),
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "font-semibold text-(--brand-primary)", children: coin }),
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("path", { d: "M6 12.4341L10 8.43408L6 4.43408", stroke: "currentColor", strokeLinecap: "round" }) })
|
|
3355
3583
|
] }),
|
|
3356
|
-
/* @__PURE__ */ (0,
|
|
3584
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("p", { className: "text-xs font-medium text-(--secondary)", children: [
|
|
3357
3585
|
"Wallet balance ",
|
|
3358
|
-
/* @__PURE__ */ (0,
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-(--brand-primary)", children: balance })
|
|
3359
3587
|
] })
|
|
3360
3588
|
] })
|
|
3361
3589
|
] });
|
|
3362
3590
|
};
|
|
3363
3591
|
|
|
3364
3592
|
// src/components/CryptoTab/Crypto/Crypto.tsx
|
|
3365
|
-
var
|
|
3593
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3366
3594
|
var Crypto = () => {
|
|
3367
3595
|
const { address } = (0, import_wagmi4.useAccount)();
|
|
3368
3596
|
const { selectedPaymentMethod } = useSpreePaymentMethod();
|
|
3369
3597
|
const { cryptoPayment } = useCryptoPayment();
|
|
3598
|
+
const { spreePayConfig } = useSpreePayConfig();
|
|
3370
3599
|
const isWalletConnected = Boolean(address);
|
|
3371
3600
|
const { register } = useSpreePayRegister();
|
|
3372
|
-
const handlePay = (0,
|
|
3601
|
+
const handlePay = (0, import_react16.useCallback)(
|
|
3373
3602
|
async (data) => {
|
|
3374
3603
|
try {
|
|
3375
3604
|
const res = await cryptoPayment(data);
|
|
@@ -3383,17 +3612,17 @@ var Crypto = () => {
|
|
|
3383
3612
|
},
|
|
3384
3613
|
[cryptoPayment]
|
|
3385
3614
|
);
|
|
3386
|
-
(0,
|
|
3615
|
+
(0, import_react16.useEffect)(() => {
|
|
3387
3616
|
register(handlePay);
|
|
3388
3617
|
}, [register, handlePay]);
|
|
3389
|
-
return /* @__PURE__ */ (0,
|
|
3390
|
-
/* @__PURE__ */ (0,
|
|
3391
|
-
/* @__PURE__ */ (0,
|
|
3392
|
-
/* @__PURE__ */ (0,
|
|
3618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col items-baseline gap-4", children: [
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("h3", { className: "text-[22px] leading-7 font-medium text-(--brand-primary)", children: "Pay with Crypto" }),
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ConnectButton, {})
|
|
3393
3622
|
] }),
|
|
3394
|
-
!isWalletConnected && /* @__PURE__ */ (0,
|
|
3395
|
-
isWalletConnected && /* @__PURE__ */ (0,
|
|
3396
|
-
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && selectedPaymentMethod.method && /* @__PURE__ */ (0,
|
|
3623
|
+
!isWalletConnected && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Logos, {}),
|
|
3624
|
+
isWalletConnected && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
3625
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && selectedPaymentMethod.method && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3397
3626
|
SelectedCoin,
|
|
3398
3627
|
{
|
|
3399
3628
|
coin: selectedPaymentMethod.method.symbol,
|
|
@@ -3401,13 +3630,14 @@ var Crypto = () => {
|
|
|
3401
3630
|
logoURI: selectedPaymentMethod.method.logoURI
|
|
3402
3631
|
}
|
|
3403
3632
|
),
|
|
3404
|
-
/* @__PURE__ */ (0,
|
|
3405
|
-
] })
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SelectCoinButton, {})
|
|
3634
|
+
] }),
|
|
3635
|
+
spreePayConfig?.crypto.infoMessage && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(InfoBanner, { message: spreePayConfig.crypto.infoMessage })
|
|
3406
3636
|
] });
|
|
3407
3637
|
};
|
|
3408
3638
|
|
|
3409
3639
|
// src/components/CryptoTab/Crypto/CryptoWrapper.tsx
|
|
3410
|
-
var
|
|
3640
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3411
3641
|
var queryClient = new import_react_query.QueryClient();
|
|
3412
3642
|
var CHAINS = [import_chains.base];
|
|
3413
3643
|
var wagmiConfigCache = /* @__PURE__ */ new Map();
|
|
@@ -3422,37 +3652,37 @@ function getCachedWagmiConfig(projectId, appName) {
|
|
|
3422
3652
|
}
|
|
3423
3653
|
var CryptoWrapper = () => {
|
|
3424
3654
|
const { spreePayConfig, configIsLoading } = useSpreePayConfig();
|
|
3425
|
-
const wagmiConfig = (0,
|
|
3655
|
+
const wagmiConfig = (0, import_react17.useMemo)(() => {
|
|
3426
3656
|
if (!spreePayConfig) return null;
|
|
3427
3657
|
return getCachedWagmiConfig(spreePayConfig.rainbowProjectId, spreePayConfig.rainbowAppName);
|
|
3428
3658
|
}, [spreePayConfig]);
|
|
3429
3659
|
if (configIsLoading || !wagmiConfig) return null;
|
|
3430
|
-
return /* @__PURE__ */ (0,
|
|
3660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_wagmi5.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_rainbowkit2.RainbowKitProvider, { theme: (0, import_rainbowkit2.lightTheme)({ borderRadius: "large" }), children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_nice_modal_react8.default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Crypto, {}) }) }) }) });
|
|
3431
3661
|
};
|
|
3432
3662
|
|
|
3433
3663
|
// src/components/CryptoTab/CryptoTab.tsx
|
|
3434
|
-
var
|
|
3664
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3435
3665
|
var CryptoTab = () => {
|
|
3436
3666
|
const { spreePayConfig } = useSpreePayConfig();
|
|
3437
|
-
return /* @__PURE__ */ (0,
|
|
3438
|
-
/* @__PURE__ */ (0,
|
|
3439
|
-
/* @__PURE__ */ (0,
|
|
3667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "border-b border-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CryptoWrapper, {}) }),
|
|
3669
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "border-b border-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PointsSwitch, { disabled: true, message: spreePayConfig?.crypto.pointsInfoMessage }) })
|
|
3440
3670
|
] });
|
|
3441
3671
|
};
|
|
3442
3672
|
|
|
3443
3673
|
// src/components/TabButtons.tsx
|
|
3444
|
-
var
|
|
3674
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3445
3675
|
var TabButton = ({ isDisabled = false, isActive, children, onClick }) => {
|
|
3446
|
-
return /* @__PURE__ */ (0,
|
|
3676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3447
3677
|
"button",
|
|
3448
3678
|
{
|
|
3449
3679
|
disabled: isDisabled,
|
|
3450
3680
|
onClick,
|
|
3451
3681
|
className: cn(
|
|
3452
|
-
"flex w-[
|
|
3453
|
-
{
|
|
3454
|
-
|
|
3455
|
-
|
|
3682
|
+
"flex w-[180px] flex-col items-baseline justify-between gap-0.5 rounded-md border border-(--b-tertiary) px-3 py-1.5 text-(--tertiary) shadow-[0_6.25px_25px_0_rgba(0,0,0,0.05)] hover:bg-(--s-primary) disabled:cursor-not-allowed",
|
|
3683
|
+
{
|
|
3684
|
+
"border-(--b-brand) bg-(--s-primary) text-(--brand-primary) ring ring-(--b-brand)": isActive
|
|
3685
|
+
}
|
|
3456
3686
|
),
|
|
3457
3687
|
children
|
|
3458
3688
|
}
|
|
@@ -3466,74 +3696,96 @@ var TabButtons = (props) => {
|
|
|
3466
3696
|
onChange({ type, method: null });
|
|
3467
3697
|
}
|
|
3468
3698
|
};
|
|
3469
|
-
return /* @__PURE__ */ (0,
|
|
3470
|
-
configIsLoading && /* @__PURE__ */ (0,
|
|
3471
|
-
|
|
3472
|
-
/* @__PURE__ */ (0,
|
|
3699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex gap-4", children: [
|
|
3700
|
+
configIsLoading && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "h-[74px] w-[180px] animate-pulse rounded-md bg-(--s-primary)" }),
|
|
3701
|
+
spreePayConfig?.creditCard.enabled && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(TabButton, { onClick: handleChange("CREDIT_CARD" /* CREDIT_CARD */), isActive: value === "CREDIT_CARD" /* CREDIT_CARD */, children: [
|
|
3702
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", fill: "none", viewBox: "0 0 32 32", children: [
|
|
3703
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("mask", { id: "a", width: "32", height: "32", x: "0", y: "0", maskUnits: "userSpaceOnUse", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { fill: "#d9d9d9", d: "M0 0h32v32H0z" }) }),
|
|
3704
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("g", { mask: "url(#a)", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3705
|
+
"path",
|
|
3706
|
+
{
|
|
3707
|
+
fill: "currentColor",
|
|
3708
|
+
d: "M28 8.82v14.36q0 .92-.62 1.54-.6.6-1.53.61H6.15q-.91 0-1.53-.61A2 2 0 0 1 4 23.18V8.82q0-.92.62-1.54.6-.6 1.53-.61h19.7q.91 0 1.53.61.62.62.62 1.54M5.33 11.74h21.34V8.82q0-.31-.26-.56a.8.8 0 0 0-.56-.26H6.15q-.3 0-.56.26a.8.8 0 0 0-.26.56zm0 3.18v8.26q0 .31.26.56t.56.26h19.7q.3 0 .56-.26a.8.8 0 0 0 .26-.56v-8.26z"
|
|
3709
|
+
}
|
|
3710
|
+
) })
|
|
3711
|
+
] }),
|
|
3712
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-md font-medium", children: "Card" })
|
|
3473
3713
|
] }),
|
|
3474
|
-
spreePayConfig?.
|
|
3475
|
-
/* @__PURE__ */ (0,
|
|
3714
|
+
spreePayConfig?.crypto.enabled && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(TabButton, { onClick: handleChange("CRYPTO" /* CRYPTO */), isActive: value === "CRYPTO" /* CRYPTO */, children: [
|
|
3715
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", fill: "none", viewBox: "0 0 32 32", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3476
3716
|
"path",
|
|
3477
3717
|
{
|
|
3478
3718
|
fill: "currentColor",
|
|
3479
|
-
|
|
3719
|
+
fillRule: "evenodd",
|
|
3720
|
+
d: "M21 9.86a8 8 0 0 1 3 5.43l-2.85-.71a5.4 5.4 0 0 0-3.86-3.67 5.3 5.3 0 0 0-6.46 3.8 5.3 5.3 0 0 0 3.91 6.4 5.4 5.4 0 0 0 5.14-1.43l2.85.7a8 8 0 0 1-5.2 3.39L16.72 27l-2.6-.65.64-2.57a8 8 0 0 1-1.3-.32l-.64 2.57-2.6-.65.82-3.24a7.9 7.9 0 0 1-2.8-8.08 7.9 7.9 0 0 1 6.27-5.82L15.32 5l2.6.64-.65 2.58q.67.1 1.3.32l.65-2.57 2.6.64z",
|
|
3721
|
+
clipRule: "evenodd"
|
|
3480
3722
|
}
|
|
3481
3723
|
) }),
|
|
3482
|
-
/* @__PURE__ */ (0,
|
|
3724
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-md font-medium", children: "Crypto" })
|
|
3483
3725
|
] }),
|
|
3484
|
-
spreePayConfig?.
|
|
3485
|
-
/* @__PURE__ */ (0,
|
|
3486
|
-
/* @__PURE__ */ (0,
|
|
3726
|
+
spreePayConfig?.cryptoCom.enabled && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(TabButton, { onClick: handleChange("CDC" /* CDC */), isActive: value === "CDC" /* CDC */, children: [
|
|
3727
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "44", height: "32", fill: "none", viewBox: "0 0 44 32", children: [
|
|
3728
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3487
3729
|
"path",
|
|
3488
3730
|
{
|
|
3489
3731
|
fill: "currentColor",
|
|
3490
|
-
|
|
3732
|
+
fillRule: "evenodd",
|
|
3733
|
+
d: "M17.6 11v10l-8.8 5L0 21V11l8.8-5zM2.2 16.69l3.15 5.42h1.26l1.5-1.37v-.7L6.56 18.6v-2.32L4.51 15zm8.87-.42v2.32l-1.55 1.46v.69l1.5 1.35h1.24l3.15-5.4-2.32-1.72zm-4.5-1.95.75 1.95-.23 2.17H8.8l1.72-.01-.21-2.17.74-1.94zm-1.25-4-.8 3.48h8.56l-.83-3.47z",
|
|
3734
|
+
clipRule: "evenodd"
|
|
3491
3735
|
}
|
|
3492
3736
|
),
|
|
3493
|
-
/* @__PURE__ */ (0,
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("path", { fill: "#009fff", d: "m39.84 18.25 1.94-4.64h1.42l-4.05 9.17H37.7l1.4-3.1-2.64-6.07h1.5z" }),
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3494
3739
|
"path",
|
|
3495
3740
|
{
|
|
3496
|
-
fill: "
|
|
3497
|
-
|
|
3741
|
+
fill: "#009fff",
|
|
3742
|
+
fillRule: "evenodd",
|
|
3743
|
+
d: "M32.91 13.46q.92 0 1.52.34.62.34.91.94t.31 1.37v1.94q0 .37.15.55.15.17.54.2v1.16q-.51 0-.9-.11-.37-.12-.61-.35a2 2 0 0 1-.38-.61 2.6 2.6 0 0 1-2.24 1.22q-.62 0-1.13-.21a2 2 0 0 1-.82-.67q-.3-.44-.3-1.05 0-.73.35-1.16.38-.45.99-.66.63-.21 1.37-.21h1.61q0-.56-.18-.89a1 1 0 0 0-.49-.5q-.3-.15-.71-.16-.54 0-.95.25a1.1 1.1 0 0 0-.5.78h-1.37q.06-.69.46-1.17.41-.5 1.04-.75t1.33-.25m-.14 3.63q-.37 0-.7.1-.33.07-.53.3a.8.8 0 0 0-.2.58q0 .48.35.71t.84.22a1.7 1.7 0 0 0 1.53-.95q.22-.44.22-.93v-.03zM26.34 11q.94 0 1.63.3.69.29 1.08.88.4.57.4 1.43t-.4 1.45-1.1.88q-.7.28-1.61.28h-1.78v3.74H23.2V11zm-1.78 4.07h1.75q.97 0 1.36-.38.4-.4.4-1.08 0-.7-.4-1.07-.4-.4-1.36-.4h-1.75z",
|
|
3744
|
+
clipRule: "evenodd"
|
|
3498
3745
|
}
|
|
3499
|
-
)
|
|
3500
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("circle", { cx: "8", cy: "8", r: "7", stroke: "currentColor", strokeWidth: "2" })
|
|
3746
|
+
)
|
|
3501
3747
|
] }),
|
|
3502
|
-
/* @__PURE__ */ (0,
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-md font-medium", children: "Crypto.com Pay" })
|
|
3503
3749
|
] })
|
|
3504
3750
|
] });
|
|
3505
3751
|
};
|
|
3506
3752
|
|
|
3507
3753
|
// src/SpreePayContent.tsx
|
|
3508
|
-
var
|
|
3754
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3509
3755
|
var SpreePayContent = ({ isLoggedIn }) => {
|
|
3510
3756
|
const { selectedPaymentMethod, setSelectedPaymentMethod } = useSpreePaymentMethod();
|
|
3511
|
-
return /* @__PURE__ */ (0,
|
|
3512
|
-
/* @__PURE__ */ (0,
|
|
3513
|
-
/* @__PURE__ */ (0,
|
|
3514
|
-
/* @__PURE__ */ (0,
|
|
3757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "w-full overflow-hidden rounded-3xl border border-(--border-component-specific-card) bg-(--surface-component-specific-card-default-card) shadow-[0_6.25px_25px_0_var(--shadow-component-specific-card)]", children: [
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex w-full flex-col gap-4 border-b border-b-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: [
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "text-[28px] leading-8 font-medium text-(--brand-primary)", children: "Choose a Payment Method" }),
|
|
3760
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TabButtons, { value: selectedPaymentMethod.type, onChange: setSelectedPaymentMethod })
|
|
3761
|
+
] }),
|
|
3762
|
+
selectedPaymentMethod.type === "CREDIT_CARD" /* CREDIT_CARD */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CreditCardTab, {}),
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CheckoutButton, { isLoggedIn })
|
|
3515
3765
|
] }),
|
|
3516
|
-
selectedPaymentMethod.type === "
|
|
3517
|
-
|
|
3518
|
-
|
|
3766
|
+
selectedPaymentMethod.type === "CRYPTO" /* CRYPTO */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CryptoTab, {}),
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CheckoutButton, { isLoggedIn })
|
|
3769
|
+
] }),
|
|
3770
|
+
selectedPaymentMethod.type === "CDC" /* CDC */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CryptoComTab, {})
|
|
3519
3771
|
] });
|
|
3520
3772
|
};
|
|
3521
3773
|
|
|
3522
3774
|
// src/hooks/useKeycloakSSO.ts
|
|
3523
|
-
var
|
|
3775
|
+
var import_react18 = require("react");
|
|
3524
3776
|
var import_keycloak_js = __toESM(require("keycloak-js"), 1);
|
|
3525
3777
|
var refreshAheadSeconds = 60;
|
|
3526
3778
|
function useKeycloakSSO(config2) {
|
|
3527
3779
|
const { url, realm, clientId, ssoPageURI, enabled } = config2;
|
|
3528
|
-
const initRef = (0,
|
|
3529
|
-
const kcRef = (0,
|
|
3530
|
-
const refreshTimerRef = (0,
|
|
3531
|
-
const scheduleRefreshRef = (0,
|
|
3780
|
+
const initRef = (0, import_react18.useRef)(false);
|
|
3781
|
+
const kcRef = (0, import_react18.useRef)(null);
|
|
3782
|
+
const refreshTimerRef = (0, import_react18.useRef)(null);
|
|
3783
|
+
const scheduleRefreshRef = (0, import_react18.useRef)(() => {
|
|
3532
3784
|
});
|
|
3533
|
-
const [error, setError] = (0,
|
|
3534
|
-
const [isChecking, setIsChecking] = (0,
|
|
3535
|
-
const [accessToken, setAccessToken] = (0,
|
|
3536
|
-
const scheduleRefresh = (0,
|
|
3785
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
3786
|
+
const [isChecking, setIsChecking] = (0, import_react18.useState)(enabled);
|
|
3787
|
+
const [accessToken, setAccessToken] = (0, import_react18.useState)(null);
|
|
3788
|
+
const scheduleRefresh = (0, import_react18.useCallback)(() => {
|
|
3537
3789
|
const kc = kcRef.current;
|
|
3538
3790
|
if (!kc || !kc.tokenParsed || !kc.tokenParsed.exp) {
|
|
3539
3791
|
return;
|
|
@@ -3554,10 +3806,10 @@ function useKeycloakSSO(config2) {
|
|
|
3554
3806
|
});
|
|
3555
3807
|
}, delayMs);
|
|
3556
3808
|
}, []);
|
|
3557
|
-
(0,
|
|
3809
|
+
(0, import_react18.useEffect)(() => {
|
|
3558
3810
|
scheduleRefreshRef.current = scheduleRefresh;
|
|
3559
3811
|
}, [scheduleRefresh]);
|
|
3560
|
-
(0,
|
|
3812
|
+
(0, import_react18.useEffect)(() => {
|
|
3561
3813
|
if (initRef.current || !enabled) return;
|
|
3562
3814
|
initRef.current = true;
|
|
3563
3815
|
const kc = new import_keycloak_js.default({ url, realm, clientId });
|
|
@@ -3591,15 +3843,15 @@ function useKeycloakSSO(config2) {
|
|
|
3591
3843
|
}
|
|
3592
3844
|
|
|
3593
3845
|
// src/SpreePay.tsx
|
|
3594
|
-
var
|
|
3846
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3595
3847
|
var SpreePayInner = () => {
|
|
3596
|
-
const [portalEl, setPortalEl] = (0,
|
|
3597
|
-
const rootRef = (0,
|
|
3848
|
+
const [portalEl, setPortalEl] = (0, import_react19.useState)(null);
|
|
3849
|
+
const rootRef = (0, import_react19.useCallback)((node) => {
|
|
3598
3850
|
if (!node) return;
|
|
3599
3851
|
const el = node.querySelector(":scope > .sl-spreepay__portal");
|
|
3600
3852
|
setPortalEl(el ?? null);
|
|
3601
3853
|
}, []);
|
|
3602
|
-
(0,
|
|
3854
|
+
(0, import_react19.useEffect)(() => {
|
|
3603
3855
|
console.log(`[spree-pay] v${version}`);
|
|
3604
3856
|
}, []);
|
|
3605
3857
|
const { env } = useSpreePayEnv();
|
|
@@ -3613,8 +3865,8 @@ var SpreePayInner = () => {
|
|
|
3613
3865
|
enabled: !env?.accessToken
|
|
3614
3866
|
});
|
|
3615
3867
|
const _accessToken = env.accessToken ?? accessToken;
|
|
3616
|
-
const unauthenticatedFetcher = (0,
|
|
3617
|
-
const slapiFetcher = (0,
|
|
3868
|
+
const unauthenticatedFetcher = (0, import_react19.useCallback)(() => Promise.resolve(null), []);
|
|
3869
|
+
const slapiFetcher = (0, import_react19.useMemo)(() => {
|
|
3618
3870
|
if (_accessToken) {
|
|
3619
3871
|
return registerApi({
|
|
3620
3872
|
accessToken: _accessToken,
|
|
@@ -3626,12 +3878,12 @@ var SpreePayInner = () => {
|
|
|
3626
3878
|
}, [_accessToken, staticConfig, tenantId, unauthenticatedFetcher]);
|
|
3627
3879
|
const getContent = () => {
|
|
3628
3880
|
if (isChecking) {
|
|
3629
|
-
return /* @__PURE__ */ (0,
|
|
3630
|
-
/* @__PURE__ */ (0,
|
|
3631
|
-
/* @__PURE__ */ (0,
|
|
3881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex w-full flex-col", children: [
|
|
3882
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "mb-4 h-[315px] animate-pulse rounded-3xl bg-(--s-primary)" }),
|
|
3883
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "h-[135px] animate-pulse rounded-3xl bg-(--s-primary)" })
|
|
3632
3884
|
] });
|
|
3633
3885
|
}
|
|
3634
|
-
return /* @__PURE__ */ (0,
|
|
3886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3635
3887
|
import_swr5.SWRConfig,
|
|
3636
3888
|
{
|
|
3637
3889
|
value: {
|
|
@@ -3640,23 +3892,23 @@ var SpreePayInner = () => {
|
|
|
3640
3892
|
revalidateOnFocus: false,
|
|
3641
3893
|
revalidateIfStale: false
|
|
3642
3894
|
},
|
|
3643
|
-
children: /* @__PURE__ */ (0,
|
|
3895
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(PortalContainerProvider, { container: portalEl, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_nice_modal_react9.default.Provider, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SpreePayContent, { isLoggedIn: Boolean(_accessToken) }) }) })
|
|
3644
3896
|
}
|
|
3645
3897
|
);
|
|
3646
3898
|
};
|
|
3647
|
-
return /* @__PURE__ */ (0,
|
|
3648
|
-
/* @__PURE__ */ (0,
|
|
3899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { ref: rootRef, className: cn("sl-spreepay", appProps.className), children: [
|
|
3900
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "sl-spreepay__portal" }),
|
|
3649
3901
|
getContent()
|
|
3650
3902
|
] });
|
|
3651
3903
|
};
|
|
3652
3904
|
var SpreePay = (props) => {
|
|
3653
|
-
return /* @__PURE__ */ (0,
|
|
3905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(StaticConfigProvider, { props, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SpreePayInner, {}) });
|
|
3654
3906
|
};
|
|
3655
3907
|
|
|
3656
3908
|
// src/hooks/useCapture3DS.ts
|
|
3657
|
-
var
|
|
3909
|
+
var import_react20 = require("react");
|
|
3658
3910
|
var useCapture3DS = (searchParams) => {
|
|
3659
|
-
(0,
|
|
3911
|
+
(0, import_react20.useEffect)(() => {
|
|
3660
3912
|
if (typeof window !== "undefined" && window.parent && searchParams?.paymentIntent) {
|
|
3661
3913
|
window.parent.SP_EVENT_BUS?.emit("paymentIntent", { paymentIntent: searchParams.paymentIntent });
|
|
3662
3914
|
}
|