agentmall 0.1.7 → 0.1.8
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/cli.js +20 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -303,6 +303,7 @@ function displayProduct(product, quantity = 1) {
|
|
|
303
303
|
const linePrice = product.price * quantityClamped;
|
|
304
304
|
const lineListPrice = typeof product.listPrice === "number" ? product.listPrice * quantityClamped : void 0;
|
|
305
305
|
console.log();
|
|
306
|
+
console.log(" \x1B[1m\u{1F4E6} Product\x1B[0m");
|
|
306
307
|
console.log(` \x1B[1m${product.title}\x1B[0m`);
|
|
307
308
|
console.log(` ${product.retailer} \u2014 ${product.availability}`);
|
|
308
309
|
console.log();
|
|
@@ -325,6 +326,7 @@ function displayProduct(product, quantity = 1) {
|
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
console.log();
|
|
329
|
+
console.log(" \x1B[1m\u{1F4B8} Checkout Estimate\x1B[0m");
|
|
328
330
|
console.log(
|
|
329
331
|
` Suggested budget: \x1B[1m${formatCents(suggestedBudget)}\x1B[0m (includes 15% buffer for tax and an $8 minimum shipping buffer)`
|
|
330
332
|
);
|
|
@@ -347,7 +349,7 @@ function displayProduct(product, quantity = 1) {
|
|
|
347
349
|
}
|
|
348
350
|
function displayOrderSummary(body) {
|
|
349
351
|
console.log();
|
|
350
|
-
console.log(" \x1B[
|
|
352
|
+
console.log(" \x1B[1m\u{1F9FE} Order Summary\x1B[0m");
|
|
351
353
|
for (const item of body.items) {
|
|
352
354
|
const url = item.product_url;
|
|
353
355
|
const qty = item.quantity ?? 1;
|
|
@@ -360,6 +362,7 @@ function displayOrderSummary(body) {
|
|
|
360
362
|
}
|
|
361
363
|
const addr = body.delivery_address;
|
|
362
364
|
console.log();
|
|
365
|
+
console.log(" \x1B[1m\u{1F4CD} Shipping\x1B[0m");
|
|
363
366
|
console.log(` Ship to: ${addr.first_name} ${addr.last_name}`);
|
|
364
367
|
console.log(` ${addr.address_line1}${addr.address_line2 ? `, ${addr.address_line2}` : ""}`);
|
|
365
368
|
console.log(` ${addr.city}, ${addr.state ?? ""} ${addr.postal_code} ${addr.country}`);
|
|
@@ -370,16 +373,16 @@ function displayOrderSummary(body) {
|
|
|
370
373
|
function displayOrderResult(order) {
|
|
371
374
|
console.log();
|
|
372
375
|
if (order.status === "failed") {
|
|
373
|
-
console.log(` \x1B[31m\
|
|
376
|
+
console.log(` \x1B[31m\u274C Order failed during submission.\x1B[0m`);
|
|
374
377
|
} else if (order.deduplicated) {
|
|
375
|
-
console.log(` \x1B[33m\
|
|
378
|
+
console.log(` \x1B[33m\u267B\uFE0F Reused existing order.\x1B[0m`);
|
|
376
379
|
} else {
|
|
377
|
-
console.log(` \x1B[32m\
|
|
380
|
+
console.log(` \x1B[32m\u2705 Order placed!\x1B[0m`);
|
|
378
381
|
}
|
|
379
382
|
console.log(` ID: \x1B[1m${order.id}\x1B[0m`);
|
|
380
383
|
console.log(` Status: ${order.status}`);
|
|
381
384
|
if (order.buyerToken) {
|
|
382
|
-
console.log(" Saved local access token for status and refund checks.");
|
|
385
|
+
console.log(" \u{1F510} Saved local access token for status and refund checks.");
|
|
383
386
|
}
|
|
384
387
|
console.log();
|
|
385
388
|
console.log(
|
|
@@ -390,7 +393,7 @@ function displayOrderResult(order) {
|
|
|
390
393
|
}
|
|
391
394
|
function displayStatus(purchase) {
|
|
392
395
|
console.log();
|
|
393
|
-
console.log(` \x1B[
|
|
396
|
+
console.log(` \x1B[1m\u{1F4E6} Order ${purchase.id}\x1B[0m`);
|
|
394
397
|
console.log(` Status: ${purchase.status}`);
|
|
395
398
|
if (purchase.items?.length) {
|
|
396
399
|
for (const item of purchase.items) {
|
|
@@ -414,7 +417,7 @@ function displayStatus(purchase) {
|
|
|
414
417
|
}
|
|
415
418
|
function displayRefund(refund2) {
|
|
416
419
|
console.log();
|
|
417
|
-
console.log(` \x1B[
|
|
420
|
+
console.log(` \x1B[1m\u{1F4B8} Refund ${refund2.id}\x1B[0m`);
|
|
418
421
|
console.log(` Status: ${refund2.status}`);
|
|
419
422
|
console.log(` Amount: ${formatCents(refund2.amountCents)}`);
|
|
420
423
|
console.log(` Reason: ${refund2.reason}`);
|
|
@@ -686,6 +689,7 @@ async function ensureSufficientBalance(requiredCents, wallet) {
|
|
|
686
689
|
return wallet;
|
|
687
690
|
}
|
|
688
691
|
console.log();
|
|
692
|
+
console.log(" \x1B[1m\u{1F4B3} Balance Check\x1B[0m");
|
|
689
693
|
console.log(
|
|
690
694
|
` Tempo wallet balance is too low for this order: have ${formatUsdcNumber(available)} USDC, need ${formatUsdAmount(requiredCents)} USDC.`
|
|
691
695
|
);
|
|
@@ -750,7 +754,7 @@ async function createPurchaseWithTempo(body) {
|
|
|
750
754
|
async function buy(urlArg) {
|
|
751
755
|
try {
|
|
752
756
|
console.log();
|
|
753
|
-
console.log(" \x1B[
|
|
757
|
+
console.log(" \x1B[1m\u{1F6D2} agentmall\x1B[0m \u2014 Buy anything with a URL");
|
|
754
758
|
console.log();
|
|
755
759
|
const url = urlArg ?? await promptProductUrl();
|
|
756
760
|
const client = new AgentMall();
|
|
@@ -861,7 +865,7 @@ async function refund(purchaseId) {
|
|
|
861
865
|
}
|
|
862
866
|
async function onboard() {
|
|
863
867
|
console.log();
|
|
864
|
-
console.log(" \x1B[
|
|
868
|
+
console.log(" \x1B[1m\u{1F511} agentmall onboarding\x1B[0m");
|
|
865
869
|
console.log();
|
|
866
870
|
const wallet = await ensureTempoReady();
|
|
867
871
|
console.log();
|
|
@@ -927,15 +931,15 @@ async function main() {
|
|
|
927
931
|
}
|
|
928
932
|
function printHelp() {
|
|
929
933
|
console.log(`
|
|
930
|
-
\x1B[
|
|
934
|
+
\x1B[1m\u{1F6D2} agentmall\x1B[0m \u2014 Buy anything with a URL
|
|
931
935
|
|
|
932
936
|
Usage:
|
|
933
|
-
agentmall onboard
|
|
934
|
-
agentmall [url]
|
|
935
|
-
agentmall buy <url>
|
|
936
|
-
agentmall status <id>
|
|
937
|
-
agentmall refund <id>
|
|
938
|
-
agentmall help
|
|
937
|
+
\u{1F511} agentmall onboard Log in to Tempo and show wallet funding steps
|
|
938
|
+
\u{1F6CD}\uFE0F agentmall [url] Buy a product (interactive)
|
|
939
|
+
\u{1F6CD}\uFE0F agentmall buy <url> Buy a product
|
|
940
|
+
\u{1F4E6} agentmall status <id> Check order status using the saved buyer token
|
|
941
|
+
\u{1F4B8} agentmall refund <id> Check refund status using the saved buyer token
|
|
942
|
+
\u2753 agentmall help Show this help
|
|
939
943
|
`);
|
|
940
944
|
}
|
|
941
945
|
main();
|