@moneymq/react 0.3.2 → 0.7.0
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/dist/index.js +506 -193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +509 -193
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -450,6 +450,7 @@ var import_lottie_react = __toESM(require("lottie-react"));
|
|
|
450
450
|
var logo_animation_default = { assets: [{ id: "4", layers: [{ ind: 3, ty: 4, ks: {}, ip: 0, op: 58, st: 0, shapes: [{ ty: "rc", p: { a: 0, k: [40, 40] }, r: { a: 0, k: 0 }, s: { a: 0, k: [80, 80] } }, { ty: "fl", c: { a: 0, k: [0, 0, 0, 0] }, o: { a: 0, k: 0 } }] }, { ind: 0, ty: 4, ks: { s: { a: 0, k: [133.33, 133.33] } }, ip: 0, op: 58, st: 0, shapes: [{ ty: "gr", it: [{ ty: "gr", it: [{ ty: "sh", ks: { a: 0, k: { c: true, i: [[0, 0], [0, 20.55], [20.55, 0], [0, -20.55], [-20.55, 0]], o: [[20.55, 0], [0, -20.55], [-20.55, 0], [0, 20.55], [0, 0]], v: [[39.65, 76.85], [76.85, 39.65], [39.65, 2.43], [2.44, 39.65], [39.65, 76.85]] } } }, { ty: "st", c: { a: 0, k: [0, 0, 0, 1] }, lc: 1, lj: 1, ml: 10, o: { a: 0, k: 100 }, w: { a: 0, k: 4.87 } }, { ty: "fl", c: { a: 0, k: [1, 1, 1, 1] }, o: { a: 0, k: 100 } }, { ty: "tr", o: { a: 0, k: 100 }, s: { a: 0, k: [75, 75] } }] }, { ty: "tr", o: { a: 0, k: 100 } }] }] }] }, { id: "7", layers: [{ ind: 6, ty: 0, ks: {}, w: 80, h: 80, ip: 0, op: 58, st: 0, refId: "4" }] }, { id: "12", layers: [{ ind: 11, ty: 4, ks: {}, ip: 0, op: 58, st: 0, shapes: [{ ty: "rc", p: { a: 0, k: [40, 40] }, r: { a: 0, k: 0 }, s: { a: 0, k: [80, 80] } }, { ty: "fl", c: { a: 0, k: [0, 0, 0, 0] }, o: { a: 0, k: 0 } }] }, { ind: 0, ty: 4, ks: { s: { a: 0, k: [133.33, 133.33] } }, ip: 0, op: 58, st: 0, shapes: [{ ty: "gr", it: [{ ty: "gr", it: [{ ty: "sh", ks: { a: 0, k: { c: true, i: [[0, 0], [0, 20.55], [20.55, 0], [0, -20.55], [-20.55, 0]], o: [[20.55, 0], [0, -20.55], [-20.55, 0], [0, 20.55], [0, 0]], v: [[39.65, 76.85], [76.85, 39.65], [39.65, 2.43], [2.44, 39.65], [39.65, 76.85]] } } }, { ty: "st", c: { a: 0, k: [0, 0, 0, 1] }, lc: 1, lj: 1, ml: 10, o: { a: 0, k: 100 }, w: { a: 0, k: 4.87 } }, { ty: "fl", c: { a: 0, k: [1, 1, 1, 1] }, o: { a: 0, k: 100 } }, { ty: "tr", o: { a: 0, k: 100 }, s: { a: 0, k: [75, 75] } }] }, { ty: "tr", o: { a: 0, k: 100 } }] }] }] }, { id: "17", layers: [{ ind: 16, ty: 4, ks: {}, ip: 0, op: 58, st: 0, shapes: [{ ty: "rc", p: { a: 0, k: [40, 40] }, r: { a: 0, k: 0 }, s: { a: 0, k: [80, 80] } }, { ty: "fl", c: { a: 0, k: [0, 0, 0, 0] }, o: { a: 0, k: 0 } }] }, { ind: 0, ty: 4, ks: { s: { a: 0, k: [133.33, 133.33] } }, ip: 0, op: 58, st: 0, shapes: [{ ty: "gr", it: [{ ty: "gr", it: [{ ty: "sh", ks: { a: 0, k: { c: true, i: [[0, 0], [0, 20.55], [20.55, 0], [0, -20.55], [-20.55, 0]], o: [[20.55, 0], [0, -20.55], [-20.55, 0], [0, 20.55], [0, 0]], v: [[39.65, 76.85], [76.85, 39.65], [39.65, 2.43], [2.44, 39.65], [39.65, 76.85]] } } }, { ty: "st", c: { a: 0, k: [0, 0, 0, 1] }, lc: 1, lj: 1, ml: 10, o: { a: 0, k: 100 }, w: { a: 0, k: 4.87 } }, { ty: "fl", c: { a: 0, k: [1, 1, 1, 1] }, o: { a: 0, k: 100 } }, { ty: "tr", o: { a: 0, k: 100 }, s: { a: 0, k: [75, 75] } }] }, { ty: "tr", o: { a: 0, k: 100 } }] }] }] }, { id: "22", layers: [{ ind: 21, ty: 4, ks: {}, ip: 0, op: 58, st: 0, shapes: [{ ty: "rc", p: { a: 0, k: [40, 40] }, r: { a: 0, k: 0 }, s: { a: 0, k: [80, 80] } }, { ty: "fl", c: { a: 0, k: [0, 0, 0, 0] }, o: { a: 0, k: 0 } }] }, { ind: 0, ty: 4, ks: { s: { a: 0, k: [133.33, 133.33] } }, ip: 0, op: 58, st: 0, shapes: [{ ty: "gr", it: [{ ty: "gr", it: [{ ty: "sh", ks: { a: 0, k: { c: true, i: [[0, 0], [0, 20.55], [20.55, 0], [0, -20.55], [-20.55, 0]], o: [[20.55, 0], [0, -20.55], [-20.55, 0], [0, 20.55], [0, 0]], v: [[39.65, 76.85], [76.85, 39.65], [39.65, 2.43], [2.44, 39.65], [39.65, 76.85]] } } }, { ty: "st", c: { a: 0, k: [0, 0, 0, 1] }, lc: 1, lj: 1, ml: 10, o: { a: 0, k: 100 }, w: { a: 0, k: 4.87 } }, { ty: "fl", c: { a: 0, k: [1, 1, 1, 1] }, o: { a: 0, k: 100 } }, { ty: "tr", o: { a: 0, k: 100 }, s: { a: 0, k: [75, 75] } }] }, { ty: "tr", o: { a: 0, k: 100 } }] }] }] }], fr: 60, h: 200, ip: 0, layers: [{ ind: 9, ty: 0, parent: 2, ks: { a: { a: 0, k: [40, 40] }, o: { a: 1, k: [{ t: 0, s: [100], h: 1 }, { t: 7.2, s: [100], h: 1 }, { t: 7.2, s: [0], h: 1 }, { t: 57, s: [0], h: 1 }] }, p: { a: 1, k: [{ t: 0, s: [119, 40], i: { x: [0, 1], y: [1, 1] }, o: { x: [0.384, 0], y: [0, 0] } }, { t: 48, s: [219, 40], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 57, s: [219, 40], h: 1 }] }, s: { a: 1, k: [{ t: 0, s: [100, 100], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 5.4, s: [100, 100], i: { x: [0, 0], y: [1, 1] }, o: { x: [0.5, 0.5], y: [0, 0] } }, { t: 7.2, s: [103, 103], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 57, s: [103, 103], h: 1 }] } }, w: 80, h: 80, ip: 0, op: 58, st: 0, refId: "7" }, { ind: 14, ty: 0, parent: 10, ks: {}, w: 80, h: 80, ip: 0, op: 58, st: 0, refId: "12" }, { ind: 10, ty: 3, parent: 2, ks: { p: { a: 1, k: [{ t: 0, s: [39, 0], i: { x: [0, 1], y: [1, 1] }, o: { x: [0.384, 0], y: [0, 0] } }, { t: 48, s: [79, 0], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 57, s: [79, 0], h: 1 }] } }, ip: 0, op: 58, st: 0 }, { ind: 19, ty: 0, parent: 15, ks: {}, w: 80, h: 80, ip: 0, op: 58, st: 0, refId: "17" }, { ind: 15, ty: 3, parent: 2, ks: { p: { a: 1, k: [{ t: 0, s: [0, 0], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 7.2, s: [0, 0], i: { x: [0, 1], y: [1, 1] }, o: { x: [0.384, 0], y: [0, 0] } }, { t: 55.2, s: [39, 0], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 57, s: [39, 0], h: 1 }] } }, ip: 0, op: 58, st: 0 }, { ind: 24, ty: 0, parent: 20, ks: {}, w: 80, h: 80, ip: 0, op: 58, st: 0, refId: "22" }, { ind: 20, ty: 3, parent: 2, ks: { a: { a: 0, k: [40, 40] }, p: { a: 0, k: [40, 40] }, s: { a: 1, k: [{ t: 0, s: [70, 70], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 13.8, s: [70, 70], i: { x: [0, 0], y: [1, 1] }, o: { x: [0.5, 0.5], y: [0, 0] } }, { t: 37.2, s: [100, 100], i: { x: [1, 1], y: [1, 1] }, o: { x: [0, 0], y: [0, 0] } }, { t: 57, s: [100, 100], h: 1 }] } }, ip: 0, op: 58, st: 0 }, { ind: 2, ty: 3, parent: 1, ks: { p: { a: 0, k: [21, 61] } }, ip: 0, op: 58, st: 0 }, { ind: 1, ty: 3, parent: 0, ks: {}, ip: 0, op: 58, st: 0 }, { ind: 0, ty: 3, ks: {}, ip: 0, op: 58, st: 0 }], meta: { g: "https://jitter.video" }, op: 57, v: "5.7.4", w: 200 };
|
|
451
451
|
|
|
452
452
|
// src/checkout-modal.tsx
|
|
453
|
+
var import_sdk = require("@moneymq/sdk");
|
|
453
454
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
454
455
|
function encodeFormData(data) {
|
|
455
456
|
const params = new URLSearchParams();
|
|
@@ -471,22 +472,22 @@ function encodeFormData(data) {
|
|
|
471
472
|
function normalizeRpcUrl2(url) {
|
|
472
473
|
return url.replace("0.0.0.0", "localhost").replace("127.0.0.1", "localhost");
|
|
473
474
|
}
|
|
474
|
-
async function makeRequestWith402Handling(url, method, body, secretKeyHex, rpcUrl, headers = {}) {
|
|
475
|
+
async function makeRequestWith402Handling(url, method, body, secretKeyHex, rpcUrl, headers = {}, useJson = false) {
|
|
475
476
|
console.log(`[MoneyMQ] Making ${method} request to ${url}`);
|
|
476
|
-
const
|
|
477
|
+
const contentType = useJson ? "application/json" : "application/x-www-form-urlencoded";
|
|
478
|
+
const requestBody = body ? useJson ? JSON.stringify(body) : encodeFormData(body) : void 0;
|
|
477
479
|
let response = await fetch(url, {
|
|
478
480
|
method,
|
|
479
481
|
headers: {
|
|
480
|
-
"Content-Type":
|
|
482
|
+
"Content-Type": contentType,
|
|
481
483
|
...headers
|
|
482
484
|
},
|
|
483
|
-
body:
|
|
485
|
+
body: requestBody
|
|
484
486
|
});
|
|
485
487
|
let data = await response.json();
|
|
486
488
|
console.log(`[MoneyMQ] Response status: ${response.status}`, data);
|
|
487
489
|
if (response.status === 402) {
|
|
488
|
-
|
|
489
|
-
const paymentRequirements = data?.payment_requirements || data?.error?.payment_requirements || [];
|
|
490
|
+
const paymentRequirements = data?.accepts || data?.payment_requirements || data?.error?.payment_requirements || [];
|
|
490
491
|
if (paymentRequirements.length === 0) {
|
|
491
492
|
console.warn("[MoneyMQ] \u26A0\uFE0F No payment requirements found in 402 response");
|
|
492
493
|
throw new Error("Payment required but no payment requirements provided");
|
|
@@ -497,8 +498,11 @@ async function makeRequestWith402Handling(url, method, body, secretKeyHex, rpcUr
|
|
|
497
498
|
const signer = await createSigner("solana", secretKeyHex, {
|
|
498
499
|
svmConfig: rpcUrl
|
|
499
500
|
});
|
|
500
|
-
const selectedPaymentRequirement = selectPaymentRequirements(
|
|
501
|
-
|
|
501
|
+
const selectedPaymentRequirement = selectPaymentRequirements(
|
|
502
|
+
paymentRequirements,
|
|
503
|
+
"solana",
|
|
504
|
+
"exact"
|
|
505
|
+
);
|
|
502
506
|
const paymentHeaderValue = await createPaymentHeader(
|
|
503
507
|
signer,
|
|
504
508
|
1,
|
|
@@ -510,15 +514,14 @@ async function makeRequestWith402Handling(url, method, body, secretKeyHex, rpcUr
|
|
|
510
514
|
}
|
|
511
515
|
}
|
|
512
516
|
);
|
|
513
|
-
console.log("[MoneyMQ] \u2705 Payment header created, retrying request...");
|
|
514
517
|
response = await fetch(url, {
|
|
515
518
|
method,
|
|
516
519
|
headers: {
|
|
517
|
-
"Content-Type":
|
|
520
|
+
"Content-Type": contentType,
|
|
518
521
|
"X-Payment": paymentHeaderValue,
|
|
519
522
|
...headers
|
|
520
523
|
},
|
|
521
|
-
body:
|
|
524
|
+
body: requestBody
|
|
522
525
|
});
|
|
523
526
|
data = await response.json();
|
|
524
527
|
console.log(`[MoneyMQ] Retry response status: ${response.status}`, data);
|
|
@@ -531,29 +534,49 @@ async function makeRequestWith402Handling(url, method, body, secretKeyHex, rpcUr
|
|
|
531
534
|
return data;
|
|
532
535
|
}
|
|
533
536
|
async function createSandboxPayment(apiUrl, rpcUrl, amount, currency, recipient, senderAddress, secretKeyHex, lineItems) {
|
|
534
|
-
console.log("[MoneyMQ] Creating
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
537
|
+
console.log("[MoneyMQ] Creating checkout session...", {
|
|
538
|
+
amount,
|
|
539
|
+
currency,
|
|
540
|
+
recipient,
|
|
541
|
+
senderAddress
|
|
542
|
+
});
|
|
543
|
+
const checkoutLineItems = lineItems?.map((item) => ({
|
|
544
|
+
price_data: {
|
|
545
|
+
currency: item.price.currency.toLowerCase(),
|
|
546
|
+
unit_amount: item.price.unit_amount,
|
|
547
|
+
product_data: {
|
|
548
|
+
name: item.product.name,
|
|
549
|
+
description: item.product.description || void 0,
|
|
550
|
+
metadata: {
|
|
551
|
+
product_id: item.product.id
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
quantity: item.quantity
|
|
556
|
+
})) || [];
|
|
557
|
+
const checkoutSession = await makeRequestWith402Handling(
|
|
558
|
+
`${apiUrl}/catalog/v1/checkout/sessions`,
|
|
538
559
|
"POST",
|
|
539
560
|
{
|
|
540
|
-
|
|
541
|
-
// Convert to cents (Stripe-style)
|
|
542
|
-
currency: currency.toLowerCase(),
|
|
561
|
+
line_items: checkoutLineItems,
|
|
543
562
|
customer: senderAddress,
|
|
544
|
-
description,
|
|
545
563
|
metadata: {
|
|
546
564
|
sender_address: senderAddress,
|
|
547
565
|
recipient_address: recipient
|
|
548
|
-
}
|
|
566
|
+
},
|
|
567
|
+
mode: "payment"
|
|
549
568
|
},
|
|
550
569
|
secretKeyHex,
|
|
551
|
-
rpcUrl
|
|
570
|
+
rpcUrl,
|
|
571
|
+
{},
|
|
572
|
+
true
|
|
573
|
+
// useJson
|
|
552
574
|
);
|
|
553
|
-
console.log("[MoneyMQ]
|
|
554
|
-
|
|
575
|
+
console.log("[MoneyMQ] Checkout session created:", checkoutSession);
|
|
576
|
+
const paymentIntentId = checkoutSession.payment_intent;
|
|
577
|
+
console.log("[MoneyMQ] Confirming payment intent:", paymentIntentId);
|
|
555
578
|
const confirmedIntent = await makeRequestWith402Handling(
|
|
556
|
-
`${apiUrl}/catalog/v1/payment_intents/${
|
|
579
|
+
`${apiUrl}/catalog/v1/payment_intents/${paymentIntentId}/confirm`,
|
|
557
580
|
"POST",
|
|
558
581
|
{},
|
|
559
582
|
secretKeyHex,
|
|
@@ -562,6 +585,39 @@ async function createSandboxPayment(apiUrl, rpcUrl, amount, currency, recipient,
|
|
|
562
585
|
console.log("[MoneyMQ] Payment intent confirmed:", confirmedIntent);
|
|
563
586
|
return confirmedIntent.id;
|
|
564
587
|
}
|
|
588
|
+
function waitForSettlementEvent(apiUrl, paymentIntentId, timeoutMs = 3e4) {
|
|
589
|
+
return new Promise((resolve, reject) => {
|
|
590
|
+
console.log("[MoneyMQ] Waiting for settlement event for intent:", paymentIntentId);
|
|
591
|
+
const stream = new import_sdk.EventStream(apiUrl, { last: 5 });
|
|
592
|
+
let settled = false;
|
|
593
|
+
const cleanup = () => {
|
|
594
|
+
if (!settled) {
|
|
595
|
+
stream.disconnect();
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
const timeout = setTimeout(() => {
|
|
599
|
+
cleanup();
|
|
600
|
+
reject(new Error("Settlement event timeout"));
|
|
601
|
+
}, timeoutMs);
|
|
602
|
+
stream.on("payment", (event) => {
|
|
603
|
+
console.log("[MoneyMQ] Received payment event:", event.type);
|
|
604
|
+
if ((0, import_sdk.isPaymentSettlementSucceeded)(event)) {
|
|
605
|
+
const { payment_flow } = event.data;
|
|
606
|
+
if (payment_flow.type === "checkout" && payment_flow.intent_id === paymentIntentId) {
|
|
607
|
+
console.log("[MoneyMQ] Settlement event matched for intent:", paymentIntentId);
|
|
608
|
+
settled = true;
|
|
609
|
+
clearTimeout(timeout);
|
|
610
|
+
stream.disconnect();
|
|
611
|
+
resolve(event);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
stream.on("error", (error) => {
|
|
616
|
+
console.error("[MoneyMQ] Stream error:", error);
|
|
617
|
+
});
|
|
618
|
+
stream.connect();
|
|
619
|
+
});
|
|
620
|
+
}
|
|
565
621
|
var truncateAddress = (address) => {
|
|
566
622
|
if (address.length <= 12) return address;
|
|
567
623
|
return `${address.slice(0, 4)}...${address.slice(-4)}`;
|
|
@@ -585,14 +641,25 @@ function CheckoutModal({
|
|
|
585
641
|
const [showDebug, setShowDebug] = (0, import_react4.useState)(false);
|
|
586
642
|
const [accountBalance, setAccountBalance] = (0, import_react4.useState)(null);
|
|
587
643
|
const [selectedWallet, setSelectedWallet] = (0, import_react4.useState)(null);
|
|
588
|
-
const [selectedPaymentMethod, setSelectedPaymentMethod] = (0, import_react4.useState)(
|
|
589
|
-
|
|
644
|
+
const [selectedPaymentMethod, setSelectedPaymentMethod] = (0, import_react4.useState)(
|
|
645
|
+
null
|
|
646
|
+
);
|
|
647
|
+
const {
|
|
648
|
+
publicKey,
|
|
649
|
+
connected,
|
|
650
|
+
disconnect,
|
|
651
|
+
wallets,
|
|
652
|
+
select,
|
|
653
|
+
wallet: connectedWallet
|
|
654
|
+
} = (0, import_wallet_adapter_react3.useWallet)();
|
|
590
655
|
const branding = useBranding();
|
|
591
656
|
const { isSandboxMode, sandboxAccounts } = useSandbox();
|
|
592
657
|
const client = useMoneyMQ();
|
|
593
658
|
const lottieRef = (0, import_react4.useRef)(null);
|
|
594
659
|
const [shouldRender, setShouldRender] = (0, import_react4.useState)(false);
|
|
595
|
-
const [animationPhase, setAnimationPhase] = (0, import_react4.useState)(
|
|
660
|
+
const [animationPhase, setAnimationPhase] = (0, import_react4.useState)(
|
|
661
|
+
"closed"
|
|
662
|
+
);
|
|
596
663
|
(0, import_react4.useEffect)(() => {
|
|
597
664
|
if (visible && !shouldRender) {
|
|
598
665
|
setShouldRender(true);
|
|
@@ -686,7 +753,9 @@ function CheckoutModal({
|
|
|
686
753
|
try {
|
|
687
754
|
const configResponse = await fetch(`${apiUrl}/config`);
|
|
688
755
|
const config = await configResponse.json();
|
|
689
|
-
const rpcUrl = normalizeRpcUrl2(
|
|
756
|
+
const rpcUrl = normalizeRpcUrl2(
|
|
757
|
+
config.x402?.validator?.rpcUrl || "http://localhost:8899"
|
|
758
|
+
);
|
|
690
759
|
const response = await fetch(rpcUrl, {
|
|
691
760
|
method: "POST",
|
|
692
761
|
headers: { "Content-Type": "application/json" },
|
|
@@ -746,7 +815,7 @@ function CheckoutModal({
|
|
|
746
815
|
} catch {
|
|
747
816
|
console.log("[MoneyMQ] Using default RPC URL");
|
|
748
817
|
}
|
|
749
|
-
const
|
|
818
|
+
const paymentIntentId = await createSandboxPayment(
|
|
750
819
|
apiUrl,
|
|
751
820
|
rpcUrl,
|
|
752
821
|
amount,
|
|
@@ -756,8 +825,11 @@ function CheckoutModal({
|
|
|
756
825
|
secretKeyHex,
|
|
757
826
|
lineItems
|
|
758
827
|
);
|
|
828
|
+
console.log("[MoneyMQ] Payment confirmed, waiting for settlement event...");
|
|
829
|
+
const settlementEvent = await waitForSettlementEvent(apiUrl, paymentIntentId);
|
|
830
|
+
const signature2 = settlementEvent.data.transaction_signature || paymentIntentId;
|
|
759
831
|
setIsSending(false);
|
|
760
|
-
onSuccess?.(
|
|
832
|
+
onSuccess?.(signature2);
|
|
761
833
|
onClose();
|
|
762
834
|
return;
|
|
763
835
|
}
|
|
@@ -802,7 +874,18 @@ function CheckoutModal({
|
|
|
802
874
|
setIsSending(false);
|
|
803
875
|
onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
804
876
|
}
|
|
805
|
-
}, [
|
|
877
|
+
}, [
|
|
878
|
+
publicKey,
|
|
879
|
+
recipient,
|
|
880
|
+
amount,
|
|
881
|
+
currency,
|
|
882
|
+
onSuccess,
|
|
883
|
+
onError,
|
|
884
|
+
onClose,
|
|
885
|
+
selectedPaymentMethod,
|
|
886
|
+
client.config.endpoint,
|
|
887
|
+
lineItems
|
|
888
|
+
]);
|
|
806
889
|
const canPay = (connected && publicKey || selectedPaymentMethod?.type === "sandbox_account") && recipient && !isSending;
|
|
807
890
|
(0, import_react4.useEffect)(() => {
|
|
808
891
|
if (!canPay || !visible) return;
|
|
@@ -813,21 +896,110 @@ function CheckoutModal({
|
|
|
813
896
|
return () => clearInterval(interval);
|
|
814
897
|
}, [canPay, visible]);
|
|
815
898
|
if (!shouldRender) return null;
|
|
816
|
-
const WalletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
899
|
+
const WalletIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
900
|
+
"svg",
|
|
901
|
+
{
|
|
902
|
+
width: "24",
|
|
903
|
+
height: "24",
|
|
904
|
+
viewBox: "0 0 24 24",
|
|
905
|
+
fill: "none",
|
|
906
|
+
stroke: "currentColor",
|
|
907
|
+
strokeWidth: "1.5",
|
|
908
|
+
children: [
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 12V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2h14a2 2 0 002-2v-5z" }),
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M16 12h.01", strokeWidth: "2", strokeLinecap: "round" })
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
const SandboxIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
915
|
+
"svg",
|
|
916
|
+
{
|
|
917
|
+
width: "24",
|
|
918
|
+
height: "24",
|
|
919
|
+
viewBox: "0 0 24 24",
|
|
920
|
+
fill: "none",
|
|
921
|
+
stroke: "currentColor",
|
|
922
|
+
strokeWidth: "1.5",
|
|
923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
924
|
+
"path",
|
|
925
|
+
{
|
|
926
|
+
d: "M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 1-6.23.693L5 15.5m14.8-.2a2.25 2.25 0 0 1 .775 2.646l-.972 2.916a2.25 2.25 0 0 1-2.134 1.538H6.532a2.25 2.25 0 0 1-2.135-1.538l-.971-2.916A2.25 2.25 0 0 1 4.2 15.3",
|
|
927
|
+
strokeLinecap: "round",
|
|
928
|
+
strokeLinejoin: "round"
|
|
929
|
+
}
|
|
930
|
+
)
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
const WrenchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
934
|
+
"svg",
|
|
935
|
+
{
|
|
936
|
+
width: "16",
|
|
937
|
+
height: "16",
|
|
938
|
+
viewBox: "0 0 24 24",
|
|
939
|
+
fill: "none",
|
|
940
|
+
stroke: "currentColor",
|
|
941
|
+
strokeWidth: "1.5",
|
|
942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
943
|
+
"path",
|
|
944
|
+
{
|
|
945
|
+
d: "M11.42 15.17L17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z",
|
|
946
|
+
strokeLinecap: "round",
|
|
947
|
+
strokeLinejoin: "round"
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
}
|
|
951
|
+
);
|
|
822
952
|
const MoneyMQLogo = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "80", height: "17", viewBox: "0 0 471 99", fill: "none", children: [
|
|
823
953
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("g", { clipPath: "url(#clip0_524_7)", children: [
|
|
824
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
954
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
955
|
+
"path",
|
|
956
|
+
{
|
|
957
|
+
d: "M12.8892 77.1417H0V0.637573H14.3415L40.0291 60.1104L65.8075 0.637573H80.149V77.1417H67.169V25.5014L44.9306 77.2327H35.0368L12.8892 25.5014V77.2327V77.1417Z",
|
|
958
|
+
fill: "white"
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
962
|
+
"path",
|
|
963
|
+
{
|
|
964
|
+
d: "M113.28 77.9614C108.015 77.9614 103.295 76.7774 99.2104 74.5005C95.1257 72.2235 91.8581 68.9448 89.5888 64.7553C87.2289 60.5658 86.1396 55.6476 86.1396 49.9098C86.1396 44.172 87.3196 39.1628 89.7704 34.9733C92.2211 30.7838 95.4888 27.5051 99.6642 25.2281C103.84 22.9512 108.56 21.7673 113.733 21.7673C118.907 21.7673 123.627 22.9512 127.803 25.2281C131.978 27.5051 135.336 30.7838 137.787 34.9733C140.238 39.1628 141.509 44.081 141.509 49.8188C141.509 55.5566 140.238 60.5658 137.787 64.7553C135.246 68.9448 131.887 72.2235 127.621 74.5005C123.355 76.7774 118.635 77.9614 113.37 77.9614H113.28ZM113.189 66.9411C115.73 66.9411 118.181 66.3036 120.45 65.1196C122.72 63.8445 124.626 62.023 126.078 59.4729C127.53 56.9227 128.257 53.735 128.257 49.8188C128.257 45.9025 127.53 42.897 126.169 40.3468C124.807 37.7967 122.992 35.9752 120.723 34.7001C118.453 33.425 116.003 32.8786 113.461 32.8786C110.92 32.8786 108.56 33.5161 106.381 34.7001C104.203 35.9752 102.478 37.7967 101.207 40.3468C99.9365 42.897 99.3011 46.0846 99.3011 50.0009C99.3011 53.9172 99.9365 56.9227 101.117 59.4729C102.387 62.023 104.021 63.8445 106.2 65.1196C108.378 66.3947 110.647 66.9411 113.189 66.9411Z",
|
|
965
|
+
fill: "white"
|
|
966
|
+
}
|
|
967
|
+
),
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
969
|
+
"path",
|
|
970
|
+
{
|
|
971
|
+
d: "M146.41 22.4959H157.484L158.392 27.8694C160.207 25.9568 162.386 24.4995 164.927 23.4066C167.469 22.3137 170.192 21.7673 173.096 21.7673C177.272 21.7673 180.993 22.678 184.079 24.4085C187.166 26.23 189.526 28.7801 191.25 32.241C192.884 35.7019 193.792 39.9825 193.792 45.1739V77.0506H181.356V46.9043C181.356 42.2594 180.449 38.7075 178.633 36.4305C176.818 34.1536 174.095 32.9696 170.373 32.9696C166.652 32.9696 163.747 34.1536 161.75 36.5216C159.753 38.8896 158.846 42.4416 158.846 47.0865V77.1417H146.501V22.4959H146.41Z",
|
|
972
|
+
fill: "white"
|
|
973
|
+
}
|
|
974
|
+
),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
976
|
+
"path",
|
|
977
|
+
{
|
|
978
|
+
d: "M225.107 77.9614C219.661 77.9614 214.85 76.7774 210.765 74.3183C206.681 71.8592 203.504 68.5805 201.144 64.2999C198.875 60.0193 197.695 55.0101 197.695 49.4545C197.695 44.172 198.784 39.4361 201.053 35.2466C203.322 31.057 206.409 27.7783 210.402 25.4103C214.396 23.0423 218.935 21.7673 223.927 21.7673C228.919 21.7673 233.73 22.8602 237.633 25.1371C241.536 27.414 244.622 30.5106 246.892 34.609C249.161 38.6164 250.25 43.3523 250.25 48.6348C250.25 49.5455 250.25 50.4563 250.068 51.4581C249.978 52.46 249.796 53.4618 249.705 54.5547H211.038C211.31 57.1959 212.127 59.3818 213.398 61.2033C214.669 63.0248 216.302 64.4821 218.209 65.4839C220.205 66.4857 222.475 67.0322 225.107 67.0322C228.102 67.0322 230.825 66.3947 233.185 65.1196C235.636 63.8445 237.27 62.2051 238.268 60.2925L249.07 63.9356C246.892 68.3073 243.715 71.7682 239.448 74.2272C235.182 76.6863 230.372 77.9614 225.016 77.9614H225.107ZM236.816 44.5363C236.816 42.2594 236.272 40.2557 235.092 38.4342C233.912 36.6127 232.368 35.1555 230.553 34.1536C228.647 33.0607 226.559 32.6053 224.199 32.6053C222.112 32.6053 220.115 33.1518 218.39 34.1536C216.575 35.1555 215.122 36.6127 213.852 38.3431C212.581 40.1647 211.764 42.2594 211.31 44.6274H236.816V44.5363Z",
|
|
979
|
+
fill: "white"
|
|
980
|
+
}
|
|
981
|
+
),
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
983
|
+
"path",
|
|
984
|
+
{
|
|
985
|
+
d: "M291.368 22.4958H304.439L272.398 99H260.235L270.038 75.5022L248.707 22.4958H262.413L276.754 61.2033L291.368 22.4958Z",
|
|
986
|
+
fill: "white"
|
|
987
|
+
}
|
|
988
|
+
),
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
990
|
+
"path",
|
|
991
|
+
{
|
|
992
|
+
d: "M320.687 77.1417H307.797V0.637573H322.139L347.827 60.1104L373.605 0.637573H387.946V77.1417H374.966V25.5014L352.728 77.2327H342.834L320.596 25.5014V77.2327L320.687 77.1417Z",
|
|
993
|
+
fill: "white"
|
|
994
|
+
}
|
|
995
|
+
),
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
997
|
+
"path",
|
|
998
|
+
{
|
|
999
|
+
d: "M432.332 77.9614C426.977 77.9614 421.894 77.0506 417.174 75.138C412.454 73.2254 408.369 70.5842 404.829 67.1233C401.289 63.6624 398.566 59.5639 396.569 54.7369C394.573 50.0009 393.574 44.7185 393.574 38.9807C393.574 33.2429 394.573 28.0515 396.569 23.3155C398.566 18.5796 401.289 14.3901 404.829 10.9292C408.369 7.46826 412.454 4.73597 417.174 2.82337C421.894 0.910764 426.886 0 432.332 0C437.779 0 442.771 0.910764 447.4 2.82337C452.029 4.73597 456.205 7.37719 459.745 10.9292C463.285 14.3901 466.008 18.5796 468.005 23.3155C470.002 28.0515 471 33.3339 471 38.9807C471 44.6274 470.002 50.0009 468.095 54.7369C466.098 59.4729 463.375 63.6624 459.835 67.1233C456.295 70.5842 452.12 73.2254 447.491 75.138C442.862 77.0506 437.779 77.9614 432.423 77.9614H432.332ZM432.242 66.9411C437.143 66.9411 441.591 65.7571 445.403 63.4802C449.215 61.2033 452.302 57.9246 454.571 53.735C456.84 49.5455 457.929 44.6274 457.929 38.8896C457.929 33.1518 456.84 28.1426 454.571 24.0442C452.302 19.9457 449.306 16.667 445.403 14.3901C441.591 12.1132 437.143 10.9292 432.242 10.9292C427.34 10.9292 422.892 12.1132 419.08 14.3901C415.268 16.667 412.182 19.9457 410.003 24.0442C407.825 28.1426 406.736 33.1518 406.736 38.8896C406.736 44.6274 407.825 49.5455 410.094 53.735C412.273 57.9246 415.359 61.2033 419.171 63.4802C422.983 65.7571 427.34 66.9411 432.332 66.9411H432.242ZM426.251 55.0101H438.868V87.9798H426.251V55.0101Z",
|
|
1000
|
+
fill: "white"
|
|
1001
|
+
}
|
|
1002
|
+
)
|
|
831
1003
|
] }),
|
|
832
1004
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("clipPath", { id: "clip0_524_7", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { width: "471", height: "99", fill: "white" }) }) })
|
|
833
1005
|
] });
|
|
@@ -905,7 +1077,19 @@ function CheckoutModal({
|
|
|
905
1077
|
style: { height: "24px", width: "auto", filter: "invert(1)" }
|
|
906
1078
|
}
|
|
907
1079
|
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MoneyMQLogo, {}),
|
|
908
|
-
isSandboxMode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1080
|
+
isSandboxMode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1081
|
+
"span",
|
|
1082
|
+
{
|
|
1083
|
+
style: {
|
|
1084
|
+
fontSize: "0.75rem",
|
|
1085
|
+
fontWeight: 600,
|
|
1086
|
+
color: "#ff9f0a",
|
|
1087
|
+
position: "relative",
|
|
1088
|
+
top: "-1px"
|
|
1089
|
+
},
|
|
1090
|
+
children: "{ sandbox }"
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
909
1093
|
] }),
|
|
910
1094
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
|
|
911
1095
|
debug && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -986,31 +1170,53 @@ function CheckoutModal({
|
|
|
986
1170
|
}
|
|
987
1171
|
),
|
|
988
1172
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
989
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1174
|
+
"div",
|
|
1175
|
+
{
|
|
1176
|
+
style: {
|
|
1177
|
+
display: "flex",
|
|
1178
|
+
alignItems: "center",
|
|
1179
|
+
gap: "0.375rem",
|
|
1180
|
+
marginBottom: "0.125rem"
|
|
1181
|
+
},
|
|
1182
|
+
children: [
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: "0.75rem", color: "#8e8e93" }, children: [
|
|
1184
|
+
"From ",
|
|
1185
|
+
truncateAddress(currentSelection.address)
|
|
1186
|
+
] }),
|
|
1187
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1188
|
+
"button",
|
|
1189
|
+
{
|
|
1190
|
+
onClick: () => copyToClipboard(currentSelection.address, "sender"),
|
|
1191
|
+
style: {
|
|
1192
|
+
padding: 0,
|
|
1193
|
+
background: "none",
|
|
1194
|
+
border: "none",
|
|
1195
|
+
cursor: "pointer",
|
|
1196
|
+
color: copiedSender ? "#30d158" : "#8e8e93",
|
|
1197
|
+
display: "flex",
|
|
1198
|
+
alignItems: "center"
|
|
1199
|
+
},
|
|
1200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1201
|
+
"svg",
|
|
1202
|
+
{
|
|
1203
|
+
width: "12",
|
|
1204
|
+
height: "12",
|
|
1205
|
+
viewBox: "0 0 24 24",
|
|
1206
|
+
fill: "none",
|
|
1207
|
+
stroke: "currentColor",
|
|
1208
|
+
strokeWidth: "2",
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
1212
|
+
]
|
|
1213
|
+
}
|
|
1214
|
+
)
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
),
|
|
1014
1220
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1015
1221
|
"span",
|
|
1016
1222
|
{
|
|
@@ -1085,7 +1291,13 @@ function CheckoutModal({
|
|
|
1085
1291
|
}
|
|
1086
1292
|
),
|
|
1087
1293
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1088
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1295
|
+
"div",
|
|
1296
|
+
{
|
|
1297
|
+
style: { fontSize: "0.75rem", color: "#8e8e93", marginBottom: "0.125rem" },
|
|
1298
|
+
children: "From"
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
1089
1301
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1090
1302
|
"span",
|
|
1091
1303
|
{
|
|
@@ -1106,7 +1318,14 @@ function CheckoutModal({
|
|
|
1106
1318
|
viewBox: "0 0 16 16",
|
|
1107
1319
|
fill: "#8e8e93",
|
|
1108
1320
|
style: { flexShrink: 0 },
|
|
1109
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1322
|
+
"path",
|
|
1323
|
+
{
|
|
1324
|
+
fillRule: "evenodd",
|
|
1325
|
+
d: "M5.22 10.22a.75.75 0 0 1 1.06 0L8 11.94l1.72-1.72a.75.75 0 1 1 1.06 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 0 1 0-1.06ZM10.78 5.78a.75.75 0 0 1-1.06 0L8 4.06 6.28 5.78a.75.75 0 0 1-1.06-1.06l2.25-2.25a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1 0 1.06Z",
|
|
1326
|
+
clipRule: "evenodd"
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1110
1329
|
}
|
|
1111
1330
|
)
|
|
1112
1331
|
]
|
|
@@ -1168,42 +1387,64 @@ function CheckoutModal({
|
|
|
1168
1387
|
}
|
|
1169
1388
|
),
|
|
1170
1389
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1171
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
},
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1391
|
+
"div",
|
|
1392
|
+
{
|
|
1393
|
+
style: {
|
|
1394
|
+
display: "flex",
|
|
1395
|
+
alignItems: "center",
|
|
1396
|
+
gap: "0.375rem",
|
|
1397
|
+
marginBottom: "0.125rem"
|
|
1398
|
+
},
|
|
1399
|
+
children: [
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: "0.75rem", color: "#8e8e93" }, children: [
|
|
1401
|
+
"From ",
|
|
1402
|
+
truncateAddress(account.address)
|
|
1403
|
+
] }),
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1405
|
+
"span",
|
|
1406
|
+
{
|
|
1407
|
+
role: "button",
|
|
1408
|
+
tabIndex: 0,
|
|
1409
|
+
onClick: (e) => {
|
|
1410
|
+
e.stopPropagation();
|
|
1411
|
+
navigator.clipboard.writeText(account.address);
|
|
1412
|
+
},
|
|
1413
|
+
onKeyDown: (e) => {
|
|
1414
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1415
|
+
e.stopPropagation();
|
|
1416
|
+
navigator.clipboard.writeText(account.address);
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
style: {
|
|
1420
|
+
padding: 0,
|
|
1421
|
+
background: "none",
|
|
1422
|
+
border: "none",
|
|
1423
|
+
cursor: "pointer",
|
|
1424
|
+
color: "#8e8e93",
|
|
1425
|
+
display: "flex",
|
|
1426
|
+
alignItems: "center"
|
|
1427
|
+
},
|
|
1428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1429
|
+
"svg",
|
|
1430
|
+
{
|
|
1431
|
+
width: "12",
|
|
1432
|
+
height: "12",
|
|
1433
|
+
viewBox: "0 0 24 24",
|
|
1434
|
+
fill: "none",
|
|
1435
|
+
stroke: "currentColor",
|
|
1436
|
+
strokeWidth: "2",
|
|
1437
|
+
children: [
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
1440
|
+
]
|
|
1441
|
+
}
|
|
1442
|
+
)
|
|
1189
1443
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
border: "none",
|
|
1195
|
-
cursor: "pointer",
|
|
1196
|
-
color: "#8e8e93",
|
|
1197
|
-
display: "flex",
|
|
1198
|
-
alignItems: "center"
|
|
1199
|
-
},
|
|
1200
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1201
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
1202
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
1203
|
-
] })
|
|
1204
|
-
}
|
|
1205
|
-
)
|
|
1206
|
-
] }),
|
|
1444
|
+
)
|
|
1445
|
+
]
|
|
1446
|
+
}
|
|
1447
|
+
),
|
|
1207
1448
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1208
1449
|
"span",
|
|
1209
1450
|
{
|
|
@@ -1236,7 +1477,12 @@ function CheckoutModal({
|
|
|
1236
1477
|
]
|
|
1237
1478
|
}
|
|
1238
1479
|
) }, account.id)),
|
|
1239
|
-
availableWallets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1480
|
+
availableWallets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1481
|
+
"div",
|
|
1482
|
+
{
|
|
1483
|
+
style: { height: "1px", backgroundColor: "#48484a", margin: "0.25rem 0" }
|
|
1484
|
+
}
|
|
1485
|
+
)
|
|
1240
1486
|
] }),
|
|
1241
1487
|
availableWallets.length > 0 ? availableWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react5.MenuItem, { children: ({ focus }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1242
1488
|
"button",
|
|
@@ -1285,7 +1531,17 @@ function CheckoutModal({
|
|
|
1285
1531
|
}
|
|
1286
1532
|
),
|
|
1287
1533
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1288
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1535
|
+
"div",
|
|
1536
|
+
{
|
|
1537
|
+
style: {
|
|
1538
|
+
fontSize: "0.75rem",
|
|
1539
|
+
color: "#8e8e93",
|
|
1540
|
+
marginBottom: "0.125rem"
|
|
1541
|
+
},
|
|
1542
|
+
children: "Browser Extension"
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1289
1545
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1290
1546
|
"span",
|
|
1291
1547
|
{
|
|
@@ -1355,14 +1611,21 @@ function CheckoutModal({
|
|
|
1355
1611
|
item.quantity > 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "0.75rem", color: "#8e8e93" }, children: [
|
|
1356
1612
|
"Qty: ",
|
|
1357
1613
|
item.quantity,
|
|
1358
|
-
" \xD7
|
|
1359
|
-
|
|
1614
|
+
" \xD7",
|
|
1615
|
+
" ",
|
|
1616
|
+
(item.price.unit_amount / 100).toLocaleString(void 0, {
|
|
1617
|
+
minimumFractionDigits: 2,
|
|
1618
|
+
maximumFractionDigits: 2
|
|
1619
|
+
}),
|
|
1360
1620
|
" ",
|
|
1361
1621
|
item.price.currency.toUpperCase()
|
|
1362
1622
|
] })
|
|
1363
1623
|
] }),
|
|
1364
1624
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: "0.875rem", color: "#fff", fontWeight: 500 }, children: [
|
|
1365
|
-
item.subtotal.toLocaleString(void 0, {
|
|
1625
|
+
item.subtotal.toLocaleString(void 0, {
|
|
1626
|
+
minimumFractionDigits: 2,
|
|
1627
|
+
maximumFractionDigits: 2
|
|
1628
|
+
}),
|
|
1366
1629
|
" ",
|
|
1367
1630
|
item.price.currency.toUpperCase()
|
|
1368
1631
|
] })
|
|
@@ -1371,38 +1634,47 @@ function CheckoutModal({
|
|
|
1371
1634
|
item.product.id + "-" + index
|
|
1372
1635
|
)) }),
|
|
1373
1636
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "0.875rem", color: "#8e8e93", marginBottom: "0.25rem" }, children: "Total" }),
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1638
|
+
"div",
|
|
1639
|
+
{
|
|
1640
|
+
style: { display: "flex", alignItems: "center", justifyContent: "space-between" },
|
|
1641
|
+
children: [
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "baseline", gap: "0.375rem" }, children: [
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: "2rem", fontWeight: 600, color: "#fff" }, children: amount.toLocaleString(void 0, {
|
|
1644
|
+
minimumFractionDigits: 2,
|
|
1645
|
+
maximumFractionDigits: 2
|
|
1646
|
+
}) }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: "1rem", fontWeight: 500, color: "#8e8e93" }, children: currency })
|
|
1648
|
+
] }),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1650
|
+
"button",
|
|
1651
|
+
{
|
|
1652
|
+
onClick: () => setShowDetails(!showDetails),
|
|
1653
|
+
style: {
|
|
1654
|
+
width: "22px",
|
|
1655
|
+
height: "22px",
|
|
1656
|
+
borderRadius: "50%",
|
|
1657
|
+
border: "1.5px solid #8e8e93",
|
|
1658
|
+
background: "none",
|
|
1659
|
+
color: "#8e8e93",
|
|
1660
|
+
fontSize: "0.8125rem",
|
|
1661
|
+
fontWeight: 600,
|
|
1662
|
+
fontStyle: "italic",
|
|
1663
|
+
fontFamily: "Georgia, serif",
|
|
1664
|
+
cursor: "pointer",
|
|
1665
|
+
display: "flex",
|
|
1666
|
+
alignItems: "center",
|
|
1667
|
+
justifyContent: "center",
|
|
1668
|
+
padding: 0,
|
|
1669
|
+
transition: "all 150ms"
|
|
1670
|
+
},
|
|
1671
|
+
title: "Show payment details",
|
|
1672
|
+
children: "i"
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
]
|
|
1676
|
+
}
|
|
1677
|
+
),
|
|
1406
1678
|
showDetails && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1407
1679
|
"div",
|
|
1408
1680
|
{
|
|
@@ -1413,41 +1685,62 @@ function CheckoutModal({
|
|
|
1413
1685
|
borderRadius: "0.5rem",
|
|
1414
1686
|
fontSize: "0.8125rem"
|
|
1415
1687
|
},
|
|
1416
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
"
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1689
|
+
"div",
|
|
1690
|
+
{
|
|
1691
|
+
style: {
|
|
1692
|
+
display: "flex",
|
|
1693
|
+
alignItems: "center",
|
|
1694
|
+
justifyContent: "space-between"
|
|
1695
|
+
},
|
|
1696
|
+
children: [
|
|
1697
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#8e8e93" }, children: "Recipient" }),
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "0.375rem" }, children: [
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1700
|
+
"span",
|
|
1701
|
+
{
|
|
1702
|
+
style: {
|
|
1703
|
+
color: "#fff",
|
|
1704
|
+
fontFamily: "ui-monospace, monospace",
|
|
1705
|
+
fontSize: "0.75rem"
|
|
1706
|
+
},
|
|
1707
|
+
children: truncateAddress(recipient)
|
|
1708
|
+
}
|
|
1709
|
+
),
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1711
|
+
"button",
|
|
1712
|
+
{
|
|
1713
|
+
onClick: () => copyToClipboard(recipient, "recipient"),
|
|
1714
|
+
style: {
|
|
1715
|
+
padding: 0,
|
|
1716
|
+
background: "none",
|
|
1717
|
+
border: "none",
|
|
1718
|
+
cursor: "pointer",
|
|
1719
|
+
color: copiedRecipient ? "#30d158" : "#8e8e93",
|
|
1720
|
+
display: "flex",
|
|
1721
|
+
alignItems: "center"
|
|
1722
|
+
},
|
|
1723
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1724
|
+
"svg",
|
|
1725
|
+
{
|
|
1726
|
+
width: "12",
|
|
1727
|
+
height: "12",
|
|
1728
|
+
viewBox: "0 0 24 24",
|
|
1729
|
+
fill: "none",
|
|
1730
|
+
stroke: "currentColor",
|
|
1731
|
+
strokeWidth: "2",
|
|
1732
|
+
children: [
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
|
|
1735
|
+
]
|
|
1736
|
+
}
|
|
1737
|
+
)
|
|
1738
|
+
}
|
|
1739
|
+
)
|
|
1740
|
+
] })
|
|
1741
|
+
]
|
|
1742
|
+
}
|
|
1743
|
+
)
|
|
1451
1744
|
}
|
|
1452
1745
|
),
|
|
1453
1746
|
showDebug && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
@@ -1462,18 +1755,34 @@ function CheckoutModal({
|
|
|
1462
1755
|
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace'
|
|
1463
1756
|
},
|
|
1464
1757
|
children: [
|
|
1465
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1759
|
+
"div",
|
|
1760
|
+
{
|
|
1761
|
+
style: {
|
|
1762
|
+
display: "flex",
|
|
1763
|
+
alignItems: "center",
|
|
1764
|
+
gap: "0.5rem",
|
|
1765
|
+
marginBottom: "0.5rem",
|
|
1766
|
+
paddingBottom: "0.5rem",
|
|
1767
|
+
borderBottom: "1px solid #2c2c2e"
|
|
1768
|
+
},
|
|
1769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#8e8e93" }, children: "DEBUG" })
|
|
1770
|
+
}
|
|
1771
|
+
),
|
|
1772
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1773
|
+
"div",
|
|
1774
|
+
{
|
|
1775
|
+
style: {
|
|
1776
|
+
display: "flex",
|
|
1777
|
+
alignItems: "center",
|
|
1778
|
+
justifyContent: "space-between"
|
|
1779
|
+
},
|
|
1780
|
+
children: [
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#8e8e93" }, children: "balance" }),
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#30d158" }, children: accountBalance !== null ? `${accountBalance.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${currency}` : currentSelection ? "..." : "null" })
|
|
1783
|
+
]
|
|
1784
|
+
}
|
|
1785
|
+
)
|
|
1477
1786
|
]
|
|
1478
1787
|
}
|
|
1479
1788
|
)
|
|
@@ -1535,8 +1844,12 @@ function CheckoutModal({
|
|
|
1535
1844
|
}
|
|
1536
1845
|
),
|
|
1537
1846
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
1538
|
-
"Pay
|
|
1539
|
-
|
|
1847
|
+
"Pay",
|
|
1848
|
+
" ",
|
|
1849
|
+
amount.toLocaleString(void 0, {
|
|
1850
|
+
minimumFractionDigits: 2,
|
|
1851
|
+
maximumFractionDigits: 2
|
|
1852
|
+
}),
|
|
1540
1853
|
" ",
|
|
1541
1854
|
currency
|
|
1542
1855
|
] })
|