agentmall 0.1.14 → 0.1.16
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 +15 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -406,7 +406,7 @@ function formatCents(cents) {
|
|
|
406
406
|
return `$${(cents / 100).toFixed(2)}`;
|
|
407
407
|
}
|
|
408
408
|
function getBudgetBasePrice(product) {
|
|
409
|
-
return product.
|
|
409
|
+
return product.price;
|
|
410
410
|
}
|
|
411
411
|
function calculateSuggestedBudget(product, quantity = 1, variantUnitPriceCents) {
|
|
412
412
|
const quantityClamped = Math.max(1, quantity);
|
|
@@ -456,14 +456,16 @@ function displayCheckoutEstimate(product, quantity = 1, variantSelections, varia
|
|
|
456
456
|
const linePrice = unitPriceCents * quantityClamped;
|
|
457
457
|
const listBaseUnitPrice = typeof product.listPrice === "number" ? Math.max(product.listPrice, variantUnitPriceCents ?? 0) : void 0;
|
|
458
458
|
const lineListPrice = typeof listBaseUnitPrice === "number" ? listBaseUnitPrice * quantityClamped : void 0;
|
|
459
|
+
const taxAndPriceBufferCents = Math.round(linePrice * 0.15);
|
|
460
|
+
const shippingBufferCents = 800;
|
|
459
461
|
section("Checkout Estimate");
|
|
460
462
|
if (lineListPrice && product.discountPercent) {
|
|
461
463
|
kv(
|
|
462
|
-
"
|
|
464
|
+
"Current price",
|
|
463
465
|
`${c.green}${formatCents(linePrice)}${c.reset} ${c.dim}${c.strike}${formatCents(lineListPrice)}${c.reset} ${c.yellow}-${product.discountPercent}%${c.reset}`
|
|
464
466
|
);
|
|
465
467
|
} else {
|
|
466
|
-
kv("
|
|
468
|
+
kv("Current price", formatCents(linePrice), { color: c.green });
|
|
467
469
|
}
|
|
468
470
|
kv("Quantity", `${quantityClamped}`);
|
|
469
471
|
if (quantityClamped > 1) {
|
|
@@ -474,17 +476,20 @@ function displayCheckoutEstimate(product, quantity = 1, variantSelections, varia
|
|
|
474
476
|
kv(variant.label, variant.value);
|
|
475
477
|
}
|
|
476
478
|
}
|
|
477
|
-
kv("
|
|
478
|
-
kv("
|
|
479
|
+
kv("Tax/price buffer", formatCents(taxAndPriceBufferCents), { dim: true });
|
|
480
|
+
kv("Shipping buffer", formatCents(shippingBufferCents), { dim: true });
|
|
481
|
+
kv(
|
|
482
|
+
"Budget cap",
|
|
483
|
+
`${c.bold}${formatCents(suggestedBudget)}${c.reset} ${c.dim}(suggested)${c.reset}`
|
|
484
|
+
);
|
|
485
|
+
kv("AgentMall fee", formatCents(SERVICE_FEE_CENTS), { dim: true });
|
|
479
486
|
kv(
|
|
480
|
-
"
|
|
487
|
+
"Charged today",
|
|
481
488
|
`${c.bold}${formatCents(suggestedBudget + SERVICE_FEE_CENTS)}${c.reset} USDC`
|
|
482
489
|
);
|
|
483
490
|
gap();
|
|
484
|
-
hint(
|
|
485
|
-
|
|
486
|
-
);
|
|
487
|
-
hint("Unused amount is refunded automatically after checkout.");
|
|
491
|
+
hint("You pay the budget cap plus the AgentMall fee upfront.");
|
|
492
|
+
hint("If the retailer's final total is lower, the difference is refunded automatically.");
|
|
488
493
|
if (product.cached) {
|
|
489
494
|
gap();
|
|
490
495
|
line(
|
package/dist/index.d.cts
CHANGED
|
@@ -31,7 +31,7 @@ type ProductLookup = {
|
|
|
31
31
|
availability: string;
|
|
32
32
|
imageUrl?: string;
|
|
33
33
|
retailer: string;
|
|
34
|
-
/** Suggested max_budget in cents (
|
|
34
|
+
/** Suggested max_budget in cents (current price + 15% buffer + $8 shipping buffer). */
|
|
35
35
|
suggestedMaxBudget: number;
|
|
36
36
|
variants?: ProductVariant[];
|
|
37
37
|
/** True if served from cache. Price may not reflect current listing. */
|
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ type ProductLookup = {
|
|
|
31
31
|
availability: string;
|
|
32
32
|
imageUrl?: string;
|
|
33
33
|
retailer: string;
|
|
34
|
-
/** Suggested max_budget in cents (
|
|
34
|
+
/** Suggested max_budget in cents (current price + 15% buffer + $8 shipping buffer). */
|
|
35
35
|
suggestedMaxBudget: number;
|
|
36
36
|
variants?: ProductVariant[];
|
|
37
37
|
/** True if served from cache. Price may not reflect current listing. */
|