@asteby/storefront 0.11.1 → 0.12.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/README.md +5 -0
- package/dist/cli.js +25 -2
- package/dist/fiscal-document.d.cts +2 -2
- package/dist/fiscal-document.d.ts +2 -2
- package/dist/index.cjs +59 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -3
- package/dist/index.d.ts +72 -3
- package/dist/index.js +57 -3
- package/dist/index.js.map +1 -1
- package/dist/mock.cjs +2 -2
- package/dist/mock.cjs.map +1 -1
- package/dist/mock.d.cts +1 -1
- package/dist/mock.d.ts +1 -1
- package/dist/mock.js +2 -2
- package/dist/mock.js.map +1 -1
- package/dist/mockup.d.cts +1 -1
- package/dist/mockup.d.ts +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.js +1 -1
- package/dist/{types-bsdlAumU.d.cts → types-BQ3S6VjF.d.cts} +19 -1
- package/dist/{types-B1E3GySa.d.ts → types-C_rsJRCl.d.ts} +19 -1
- package/package.json +1 -1
package/dist/mockup.d.cts
CHANGED
package/dist/mockup.d.ts
CHANGED
package/dist/node.cjs
CHANGED
|
@@ -47,7 +47,7 @@ function maskToken(token) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// src/node.ts
|
|
50
|
-
var SDK_VERSION = true ? "0.
|
|
50
|
+
var SDK_VERSION = true ? "0.12.0" : "dev";
|
|
51
51
|
function createFileTokenSource(file, options = {}) {
|
|
52
52
|
const ttl = options.ttlMs ?? 3e4;
|
|
53
53
|
const now = options.now ?? Date.now;
|
package/dist/node.js
CHANGED
|
@@ -11,7 +11,7 @@ function maskToken(token) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// src/node.ts
|
|
14
|
-
var SDK_VERSION = true ? "0.
|
|
14
|
+
var SDK_VERSION = true ? "0.12.0" : "dev";
|
|
15
15
|
function createFileTokenSource(file, options = {}) {
|
|
16
16
|
const ttl = options.ttlMs ?? 3e4;
|
|
17
17
|
const now = options.now ?? Date.now;
|
|
@@ -418,6 +418,10 @@ type InvoiceRequest = {
|
|
|
418
418
|
regimen?: string;
|
|
419
419
|
uso_cfdi?: string;
|
|
420
420
|
cp?: string;
|
|
421
|
+
/** Alias of `postal_code`, already in production use by some storefronts. */
|
|
422
|
+
zip?: string;
|
|
423
|
+
/** Alias of `use`, already in production use by some storefronts. */
|
|
424
|
+
cfdi_use?: string;
|
|
421
425
|
/** Alias of `use`. */
|
|
422
426
|
invoice_use?: string;
|
|
423
427
|
/** Also save the data to the buyer's account (needs a session). */
|
|
@@ -662,6 +666,16 @@ type StorefrontErrorBody = {
|
|
|
662
666
|
field?: string;
|
|
663
667
|
details?: unknown;
|
|
664
668
|
required_scopes?: string[];
|
|
669
|
+
/** Payment failures only: `true` = repeating the request can succeed; `false` = not until someone fixes something. */
|
|
670
|
+
retryable?: boolean;
|
|
671
|
+
/** Seconds to wait before retrying (`too_many_attempts`, `payment_in_progress`). */
|
|
672
|
+
retry_after?: number;
|
|
673
|
+
/** A cart write refused because the cart already became a checkout that can still be paid. */
|
|
674
|
+
checkout_id?: string;
|
|
675
|
+
/** The cart's current cost, sent with `price_mismatch`. */
|
|
676
|
+
cost?: unknown;
|
|
677
|
+
/** The same message in English, when the server provides it. */
|
|
678
|
+
message_en?: string;
|
|
665
679
|
};
|
|
666
680
|
};
|
|
667
681
|
type RestockSubscriptionInput = {
|
|
@@ -746,7 +760,9 @@ type PaymentAction = {
|
|
|
746
760
|
voucher?: PaymentVoucher | null;
|
|
747
761
|
redirect_url?: string | null;
|
|
748
762
|
};
|
|
749
|
-
type PaymentAttemptStatus = 'paid' | 'pending' | 'requires_action' | 'failed' | 'expired' | 'cancelled'
|
|
763
|
+
type PaymentAttemptStatus = 'paid' | 'pending' | 'requires_action' | 'failed' | 'expired' | 'cancelled'
|
|
764
|
+
/** Only from the shop's status route: there is no payment session in this browser (cookie gone). It is NOT a result. */
|
|
765
|
+
| 'none';
|
|
750
766
|
/** What the buyer should do next after a rejection (stable enum from the cart). */
|
|
751
767
|
type PaymentNextStep = 'retry' | 'fix_card_data' | 'use_other_card' | 'pay_cash' | 'contact_issuer' | 'check_email' | 'rebuild_cart';
|
|
752
768
|
/** `POST /storefront/checkouts/:id/payment`. The amount is the server's; the browser only brings `provider_data`. */
|
|
@@ -781,6 +797,8 @@ type PaymentAttemptResult = {
|
|
|
781
797
|
n: number;
|
|
782
798
|
};
|
|
783
799
|
attempts_left?: number;
|
|
800
|
+
/** Only with `payment.status: 'none'`: the shop still has the buyer's cart, so repeating the SAME attempt can proceed. */
|
|
801
|
+
recoverable?: boolean;
|
|
784
802
|
};
|
|
785
803
|
/** `GET /storefront/checkouts/:id/payment-config`: what to mount for an embedded checkout. */
|
|
786
804
|
type PaymentConfig = {
|
|
@@ -418,6 +418,10 @@ type InvoiceRequest = {
|
|
|
418
418
|
regimen?: string;
|
|
419
419
|
uso_cfdi?: string;
|
|
420
420
|
cp?: string;
|
|
421
|
+
/** Alias of `postal_code`, already in production use by some storefronts. */
|
|
422
|
+
zip?: string;
|
|
423
|
+
/** Alias of `use`, already in production use by some storefronts. */
|
|
424
|
+
cfdi_use?: string;
|
|
421
425
|
/** Alias of `use`. */
|
|
422
426
|
invoice_use?: string;
|
|
423
427
|
/** Also save the data to the buyer's account (needs a session). */
|
|
@@ -662,6 +666,16 @@ type StorefrontErrorBody = {
|
|
|
662
666
|
field?: string;
|
|
663
667
|
details?: unknown;
|
|
664
668
|
required_scopes?: string[];
|
|
669
|
+
/** Payment failures only: `true` = repeating the request can succeed; `false` = not until someone fixes something. */
|
|
670
|
+
retryable?: boolean;
|
|
671
|
+
/** Seconds to wait before retrying (`too_many_attempts`, `payment_in_progress`). */
|
|
672
|
+
retry_after?: number;
|
|
673
|
+
/** A cart write refused because the cart already became a checkout that can still be paid. */
|
|
674
|
+
checkout_id?: string;
|
|
675
|
+
/** The cart's current cost, sent with `price_mismatch`. */
|
|
676
|
+
cost?: unknown;
|
|
677
|
+
/** The same message in English, when the server provides it. */
|
|
678
|
+
message_en?: string;
|
|
665
679
|
};
|
|
666
680
|
};
|
|
667
681
|
type RestockSubscriptionInput = {
|
|
@@ -746,7 +760,9 @@ type PaymentAction = {
|
|
|
746
760
|
voucher?: PaymentVoucher | null;
|
|
747
761
|
redirect_url?: string | null;
|
|
748
762
|
};
|
|
749
|
-
type PaymentAttemptStatus = 'paid' | 'pending' | 'requires_action' | 'failed' | 'expired' | 'cancelled'
|
|
763
|
+
type PaymentAttemptStatus = 'paid' | 'pending' | 'requires_action' | 'failed' | 'expired' | 'cancelled'
|
|
764
|
+
/** Only from the shop's status route: there is no payment session in this browser (cookie gone). It is NOT a result. */
|
|
765
|
+
| 'none';
|
|
750
766
|
/** What the buyer should do next after a rejection (stable enum from the cart). */
|
|
751
767
|
type PaymentNextStep = 'retry' | 'fix_card_data' | 'use_other_card' | 'pay_cash' | 'contact_issuer' | 'check_email' | 'rebuild_cart';
|
|
752
768
|
/** `POST /storefront/checkouts/:id/payment`. The amount is the server's; the browser only brings `provider_data`. */
|
|
@@ -781,6 +797,8 @@ type PaymentAttemptResult = {
|
|
|
781
797
|
n: number;
|
|
782
798
|
};
|
|
783
799
|
attempts_left?: number;
|
|
800
|
+
/** Only with `payment.status: 'none'`: the shop still has the buyer's cart, so repeating the SAME attempt can proceed. */
|
|
801
|
+
recoverable?: boolean;
|
|
784
802
|
};
|
|
785
803
|
/** `GET /storefront/checkouts/:id/payment-config`: what to mount for an embedded checkout. */
|
|
786
804
|
type PaymentConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Typed client for the Storefront API v1 (catalog, cart, checkout, customer, content) using only global fetch — Node 20+, edge runtimes and browsers — plus an in-memory mock of the whole contract and, in `@asteby/storefront/fiscal-document`, a country-agnostic engine that reads a buyer's fiscal document (PDF) in the browser or Node.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|