@asteby/storefront 0.11.2 → 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/dist/mock.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-BQ7k6DwG.cjs';
1
+ import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-BQ3S6VjF.cjs';
2
2
  import './geo.cjs';
3
3
 
4
4
  /**
package/dist/mock.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-D8nLoKyk.js';
1
+ import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-C_rsJRCl.js';
2
2
  import './geo.js';
3
3
 
4
4
  /**
package/dist/mockup.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { aE as Product, aK as ProductVariant } from './types-BQ7k6DwG.cjs';
1
+ import { aE as Product, aK as ProductVariant } from './types-BQ3S6VjF.cjs';
2
2
  import './geo.cjs';
3
3
 
4
4
  /**
package/dist/mockup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { aE as Product, aK as ProductVariant } from './types-D8nLoKyk.js';
1
+ import { aE as Product, aK as ProductVariant } from './types-C_rsJRCl.js';
2
2
  import './geo.js';
3
3
 
4
4
  /**
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.11.2" : "dev";
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.11.2" : "dev";
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;
@@ -666,6 +666,16 @@ type StorefrontErrorBody = {
666
666
  field?: string;
667
667
  details?: unknown;
668
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;
669
679
  };
670
680
  };
671
681
  type RestockSubscriptionInput = {
@@ -750,7 +760,9 @@ type PaymentAction = {
750
760
  voucher?: PaymentVoucher | null;
751
761
  redirect_url?: string | null;
752
762
  };
753
- 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';
754
766
  /** What the buyer should do next after a rejection (stable enum from the cart). */
755
767
  type PaymentNextStep = 'retry' | 'fix_card_data' | 'use_other_card' | 'pay_cash' | 'contact_issuer' | 'check_email' | 'rebuild_cart';
756
768
  /** `POST /storefront/checkouts/:id/payment`. The amount is the server's; the browser only brings `provider_data`. */
@@ -785,6 +797,8 @@ type PaymentAttemptResult = {
785
797
  n: number;
786
798
  };
787
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;
788
802
  };
789
803
  /** `GET /storefront/checkouts/:id/payment-config`: what to mount for an embedded checkout. */
790
804
  type PaymentConfig = {
@@ -666,6 +666,16 @@ type StorefrontErrorBody = {
666
666
  field?: string;
667
667
  details?: unknown;
668
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;
669
679
  };
670
680
  };
671
681
  type RestockSubscriptionInput = {
@@ -750,7 +760,9 @@ type PaymentAction = {
750
760
  voucher?: PaymentVoucher | null;
751
761
  redirect_url?: string | null;
752
762
  };
753
- 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';
754
766
  /** What the buyer should do next after a rejection (stable enum from the cart). */
755
767
  type PaymentNextStep = 'retry' | 'fix_card_data' | 'use_other_card' | 'pay_cash' | 'contact_issuer' | 'check_email' | 'rebuild_cart';
756
768
  /** `POST /storefront/checkouts/:id/payment`. The amount is the server's; the browser only brings `provider_data`. */
@@ -785,6 +797,8 @@ type PaymentAttemptResult = {
785
797
  n: number;
786
798
  };
787
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;
788
802
  };
789
803
  /** `GET /storefront/checkouts/:id/payment-config`: what to mount for an embedded checkout. */
790
804
  type PaymentConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/storefront",
3
- "version": "0.11.2",
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": {