@asteby/storefront 0.12.0 → 0.14.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 +27 -1
- package/dist/chunk-IPUAZ3LQ.js +646 -0
- package/dist/chunk-IPUAZ3LQ.js.map +1 -0
- package/dist/cli.js +40 -1
- package/dist/fiscal-document.d.cts +2 -2
- package/dist/fiscal-document.d.ts +2 -2
- package/dist/index.cjs +204 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +68 -4
- package/dist/index.d.ts +68 -4
- package/dist/index.js +73 -310
- package/dist/index.js.map +1 -1
- package/dist/mock.cjs +417 -39
- package/dist/mock.cjs.map +1 -1
- package/dist/mock.d.cts +3 -1
- package/dist/mock.d.ts +3 -1
- package/dist/mock.js +272 -23
- 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-C_rsJRCl.d.ts → types-BeTemDg6.d.ts} +209 -1
- package/dist/{types-BQ3S6VjF.d.cts → types-BuKb-zbi.d.cts} +209 -1
- package/package.json +1 -1
- package/dist/chunk-HBSB7XS2.js +0 -220
- package/dist/chunk-HBSB7XS2.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeoPoint } from './geo.cjs';
|
|
2
2
|
export { OpenStatus, OpeningHours } from './geo.cjs';
|
|
3
|
-
import {
|
|
4
|
-
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartInvoice, l as CartLine, n as CartLineMerchandise, r as CartRecommendation, t as CheckoutInfo, v as CheckoutPayment, R as Facet, S as FacetValue, T as FiscalDocumentEvidence, U as FiscalDocumentSource, V as FiscalIdentity, W as FiscalIdentityInput, X as FiscalVerification, Y as
|
|
3
|
+
import { a_ as ProductSort, bw as TokenIntrospection, bo as Shop, b6 as Region, aY as ProductConnection, aV as Product, y as Connection, x as Collection, ah as LocationListParams, ae as Location, an as NearestLocation, bs as StockLevel, ba as RestockSubscriptionInput, bb as RestockSubscriptionResult, m as CartLineInput, C as Cart, p as CartLineUpdateInput, f as CartBuyerInput, a as AddressInput, Q as DeliveryOptions, aL as PaymentMethods, O as DeliveryInput, a9 as InvoiceRequest, b4 as RecommendationPlacement, s as CartRecommendations, u as CheckoutInput, w as CheckoutResult, b3 as PromotionsList, aH as PaymentConfig, aQ as PaymentSubmitInput, aD as PaymentAttemptResult, D as CustomerIdentifier, J as CustomerSessionInput, I as CustomerSession, B as CustomerCapabilities, F as CustomerRegisterInput, G as CustomerRegisterResult, M as CustomerVerifyRegistrationInput, E as CustomerPasswordLoginInput, K as CustomerSetPasswordInput, H as CustomerResetPasswordInput, z as Customer, L as CustomerUpdateInput, aq as Order, bd as ReturnRequestInput, bc as ReturnRequest, aa as InvoiceResult, aS as PendingPayment, a8 as InvoiceFileKind, a7 as InvoiceFile, A as Address, bv as Theme, aA as Page, aj as Menu, b as Article, bu as StorefrontErrorCode, a4 as InsufficientStockLine, al as Money, d as AvailabilityStatus, o as CartLineProblem, c as Availability, a$ as ProductVariant, N as DeclineCode, aR as PaymentVoucher, aM as PaymentNextStep, q as CartPromotions, b1 as PromotionReward, a6 as InvoiceDoc, bh as Shipment, ao as NextAction, au as OrderProgress, bl as ShipmentStatus, bi as ShipmentEvent, P as DeliveryMethod, bx as UnavailableRateProvider } from './types-BuKb-zbi.cjs';
|
|
4
|
+
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartInvoice, l as CartLine, n as CartLineMerchandise, r as CartRecommendation, t as CheckoutInfo, v as CheckoutPayment, R as Facet, S as FacetValue, T as FiscalDocumentEvidence, U as FiscalDocumentSource, V as FiscalIdentity, W as FiscalIdentityInput, X as FiscalVerification, Y as GeoHint, Z as IdentityCapture, _ as IdentityDocumentSpec, $ as IdentityFieldRule, a0 as IdentityRulesV1, a1 as IdentityStrategy, a2 as Image, a3 as InsufficientStockDetails, a5 as InvoiceAction, ab as InvoiceStage, ac as InvoiceSummary, ad as InvoicingCapabilities, af as LocationContacts, ag as LocationKind, ai as LocationPickup, ak as MenuItem, am as MoneyRange, ap as NextActionKind, ar as OrderLine, as as OrderPickup, at as OrderProblem, av as OrderProgressStep, aw as OrderSection, ax as OrderStage, ay as OrderStepKey, az as OrderStepState, aB as PageInfo, aC as PaymentAction, aE as PaymentAttemptStatus, aF as PaymentClient, aG as PaymentClientCsp, aI as PaymentFlow, aJ as PaymentInfo, aK as PaymentMethod, aN as PaymentOption, aO as PaymentOptionKey, aP as PaymentPoint, aT as PendingPaymentVoucher, aU as PickupOption, aW as ProductAttributeValue, aX as ProductCategory, aZ as ProductOption, b0 as PromotionAnnouncement, b2 as PromotionTier, b5 as Refund, b7 as RegionFiscalEntry, b8 as RegionFiscalId, b9 as RegionPaymentMethod, be as SEO, bf as Section, bg as SelectedOption, bj as ShipmentKind, bk as ShipmentMap, bm as ShipmentsSummary, bn as ShippingRate, bp as ShopBranch, bq as ShopContact, br as ShopPolicies, bt as StorefrontErrorBody } from './types-BuKb-zbi.cjs';
|
|
5
5
|
|
|
6
6
|
type QueryValue = string | number | boolean | null | undefined;
|
|
7
7
|
type QueryParams = Record<string, QueryValue | QueryValue[]>;
|
|
@@ -145,6 +145,11 @@ type RequestSpec = {
|
|
|
145
145
|
options?: WriteOptions;
|
|
146
146
|
/** Resolve `null` instead of throwing on 404. */
|
|
147
147
|
nullOn404?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Never follow a redirect (`redirect: 'error'`, and a redirected answer is refused): for answers that carry the
|
|
150
|
+
* buyer's documents, so neither the customer token nor the request ever travels to another host.
|
|
151
|
+
*/
|
|
152
|
+
noRedirect?: boolean;
|
|
148
153
|
};
|
|
149
154
|
/** Header the gateway reads (only for tokens with `trust_client_ip`). */
|
|
150
155
|
declare const CLIENT_IP_HEADER = "X-Storefront-Client-IP";
|
|
@@ -317,6 +322,18 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
|
|
|
317
322
|
order: (id: string, options?: RequestOptions) => Promise<Order | null>;
|
|
318
323
|
requestReturn: (orderId: string, input: ReturnRequestInput, options?: WriteOptions) => Promise<ReturnRequest>;
|
|
319
324
|
requestInvoice: (orderId: string, input: InvoiceRequest, options?: WriteOptions) => Promise<InvoiceResult>;
|
|
325
|
+
/**
|
|
326
|
+
* Checkouts waiting for their payment (cash voucher: OXXO, SPEI). They are not orders yet; once the payment
|
|
327
|
+
* confirms they leave this list and show up in `orders`.
|
|
328
|
+
*/
|
|
329
|
+
pendingPayments: (params?: PaginationParams, options?: RequestOptions) => Promise<Connection<PendingPayment>>;
|
|
330
|
+
/**
|
|
331
|
+
* Reads one file (`pdf` | `xml`) of an invoice or credit note of the buyer's order, through the authenticated
|
|
332
|
+
* route (`order_invoice_file`): the answer is the file itself (base64), never a URL, so neither the buyer token
|
|
333
|
+
* nor a link of the PAC reaches the browser. Call it from YOUR server and stream the bytes
|
|
334
|
+
* (`invoiceFileBytes`). `null` when the order, the document or the file does not exist or is not the buyer's.
|
|
335
|
+
*/
|
|
336
|
+
invoiceFile: (orderId: string, invoiceId: string, kind: InvoiceFileKind, options?: RequestOptions) => Promise<InvoiceFile | null>;
|
|
320
337
|
addresses: {
|
|
321
338
|
list: (options?: RequestOptions) => Promise<{
|
|
322
339
|
nodes: Address[];
|
|
@@ -605,7 +622,7 @@ declare function productAvailability(product: Pick<Product, 'variants' | 'availa
|
|
|
605
622
|
*/
|
|
606
623
|
|
|
607
624
|
type PaymentLocale = AvailabilityLocale;
|
|
608
|
-
type PaymentMessageKey = `decline.${DeclineCode}` | 'state.loading' | 'state.processing' | 'state.approved' | 'state.in_review' | 'state.voucher' | 'state.challenge' | 'state.expired' | 'state.cancelled' | 'state.redirect' | 'state.fallback' | 'error.network' | 'error.card_data' | 'error.price_mismatch' | 'error.payment_in_progress' | 'error.expired' | 'error.too_many_attempts' | 'error.generic' | 'action.retry' | 'action.try_again' | 'action.pay' | 'action.cancel' | 'voucher.title' | 'voucher.point' | 'voucher.reference' | 'voucher.amount' | 'voucher.expires' | 'voucher.clabe' | 'voucher.barcode' | 'voucher.open' | 'voucher.email' | 'form.label' | 'challenge.title';
|
|
625
|
+
type PaymentMessageKey = `decline.${DeclineCode}` | 'state.loading' | 'state.processing' | 'state.approved' | 'state.in_review' | 'state.voucher' | 'state.challenge' | 'state.expired' | 'state.cancelled' | 'state.redirect' | 'state.fallback' | 'error.network' | 'error.card_data' | 'error.price_mismatch' | 'error.payment_in_progress' | 'error.expired' | 'error.too_many_attempts' | 'error.generic' | 'action.retry' | 'action.try_again' | 'action.pay' | 'action.cancel' | 'voucher.title' | 'voucher.point' | 'voucher.reference' | 'voucher.amount' | 'voucher.expires' | 'voucher.clabe' | 'voucher.barcode' | 'voucher.open' | 'voucher.email' | 'form.label' | 'challenge.title' | 'challenge.escape' | 'challenge.escape_hint' | 'challenge.left';
|
|
609
626
|
type PaymentMessages = Record<PaymentMessageKey, string>;
|
|
610
627
|
/** Catalog for a locale (`es-MX` -> es, `en-US` -> en) with the shop's per-key overrides applied. */
|
|
611
628
|
declare function paymentMessages(locale: string | null | undefined, overrides?: Partial<PaymentMessages> | null): PaymentMessages;
|
|
@@ -786,6 +803,53 @@ declare function hreflangLinks(markets: MarketInfo[], path: string, defaultMarke
|
|
|
786
803
|
href: string;
|
|
787
804
|
}[];
|
|
788
805
|
|
|
806
|
+
/** Steps of an order that ships, in order. */
|
|
807
|
+
declare const SHIPPING_STEPS: readonly ["paid", "preparing", "shipped", "in_transit", "delivered"];
|
|
808
|
+
/** Steps of an order the buyer picks up. */
|
|
809
|
+
declare const PICKUP_STEPS: readonly ["paid", "preparing", "ready_for_pickup", "delivered"];
|
|
810
|
+
/** A shipment the buyer can be told about as real: not a sandbox one. */
|
|
811
|
+
declare function isTestShipment(s: Pick<Shipment, 'test_mode' | 'environment'> | null | undefined): boolean;
|
|
812
|
+
/** An invoice or credit note from a sandbox PAC. */
|
|
813
|
+
declare function isTestInvoice(d: Pick<InvoiceDoc, 'test_mode' | 'environment'> | null | undefined): boolean;
|
|
814
|
+
/** `https` URL with no credentials, or `null`. The only kind of link a tracking or voucher button may carry. */
|
|
815
|
+
declare function safeTrackingUrl(value: unknown): string | null;
|
|
816
|
+
/** Newest first, invalid dates last, ties keep the server's order; at most `limit` (default 50, the contract's cap). */
|
|
817
|
+
declare function sortTrackingEvents(events: readonly ShipmentEvent[] | null | undefined, limit?: number): ShipmentEvent[];
|
|
818
|
+
/** The shipments of the order that count: outbound/pickup/local first, returns after; stable otherwise. */
|
|
819
|
+
declare function orderShipments(order: Pick<Order, 'shipments'> | null | undefined): Shipment[];
|
|
820
|
+
/**
|
|
821
|
+
* The unified progress. The server's `order.progress` wins when it is well formed; otherwise it is derived, so a store
|
|
822
|
+
* on an older OPS still gets a timeline. Pending payment, cancelled and refunded orders have no steps to walk: `steps`
|
|
823
|
+
* lists them as `pending` (or `[]` when cancelled/refunded) and the stage says why.
|
|
824
|
+
*/
|
|
825
|
+
declare function orderProgress(order: Order): OrderProgress;
|
|
826
|
+
/**
|
|
827
|
+
* The action to put first. The server's `next_action` wins (its `href` is re-checked: only `https`); an older server
|
|
828
|
+
* gets one derived from the order and its invoice. Never `null`: `{ kind: 'none' }` means "nothing to offer".
|
|
829
|
+
*/
|
|
830
|
+
declare function nextAction(order: Order): NextAction;
|
|
831
|
+
/** Latest known status among the live (non-sandbox, non-return) shipments, or `null`. */
|
|
832
|
+
declare function shipmentsStatus(order: Order): ShipmentStatus | null;
|
|
833
|
+
|
|
834
|
+
/** Invoices and credit notes of an order, and the bytes of a downloaded file. Pure; no URL of the PAC ever passes here. */
|
|
835
|
+
|
|
836
|
+
type InvoiceGroup = {
|
|
837
|
+
invoice: InvoiceDoc;
|
|
838
|
+
creditNotes: InvoiceDoc[];
|
|
839
|
+
};
|
|
840
|
+
/**
|
|
841
|
+
* Groups credit notes under the invoice they correct (`related_to`), keeping the server's order. A credit note whose
|
|
842
|
+
* invoice is not in the list (or has no `related_to`) is returned in `orphans`, never dropped.
|
|
843
|
+
*/
|
|
844
|
+
declare function groupInvoiceDocs(docs: readonly InvoiceDoc[] | null | undefined): {
|
|
845
|
+
groups: InvoiceGroup[];
|
|
846
|
+
orphans: InvoiceDoc[];
|
|
847
|
+
};
|
|
848
|
+
/** Decodes `content_base64` of a downloaded invoice file. Throws `TypeError` when it is not valid base64. */
|
|
849
|
+
declare function invoiceFileBytes(file: Pick<InvoiceFile, 'content_base64'>): Uint8Array;
|
|
850
|
+
/** A download filename that is safe in a `Content-Disposition` header: no path, quotes, control characters or spaces. */
|
|
851
|
+
declare function safeInvoiceFilename(name: unknown, fallback?: string): string;
|
|
852
|
+
|
|
789
853
|
/** Kind of a delivery radio: `ship` (address only, quote later), `rate` (a quoted rate) or `pickup` (a branch). */
|
|
790
854
|
type DeliveryChoiceKind = 'ship' | 'rate' | 'pickup';
|
|
791
855
|
type DeliveryChoice = {
|
|
@@ -817,4 +881,4 @@ type DeliveryNotices = {
|
|
|
817
881
|
/** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
|
|
818
882
|
declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
|
|
819
883
|
|
|
820
|
-
export { Address, AddressInput, Article, type ArticleListParams, Availability, type AvailabilityLocale, type AvailabilityMessageKey, type AvailabilityMessages, AvailabilityStatus, type AvailabilityTone, type AvailabilityView, type AvailabilityViewOptions, CLIENT_IP_HEADER, COUNTRY_HEADERS, Cart, CartBuyerInput, CartLineInput, CartLineProblem, type CartLineProblemView, CartLineUpdateInput, CartPromotions, CartRecommendations, CheckoutInput, CheckoutResult, Collection, type CollectionListParams, Connection, Customer, CustomerCapabilities, CustomerIdentifier, CustomerPasswordLoginInput, CustomerRegisterInput, CustomerRegisterResult, CustomerResetPasswordInput, CustomerSession, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, Order, PAYMENT_CHOICE_REFUSED_FIELD, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorClass, type PaymentErrorClassKind, type PaymentErrorKind, type PaymentErrorLike, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, Region, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, TokenIntrospection, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, classifyPaymentError, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, diagnose, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, hreflangLinks, isStorefrontError, isTokenPublishable, maskToken, negotiateLocale, normalizeClientIp, normalizeNote, opsSaysNotRetryable, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, repairPath, resolveAvailability, rewardLabel, safeHttpsUrl, schemaAvailability, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
|
884
|
+
export { Address, AddressInput, Article, type ArticleListParams, Availability, type AvailabilityLocale, type AvailabilityMessageKey, type AvailabilityMessages, AvailabilityStatus, type AvailabilityTone, type AvailabilityView, type AvailabilityViewOptions, CLIENT_IP_HEADER, COUNTRY_HEADERS, Cart, CartBuyerInput, CartLineInput, CartLineProblem, type CartLineProblemView, CartLineUpdateInput, CartPromotions, CartRecommendations, CheckoutInput, CheckoutResult, Collection, type CollectionListParams, Connection, Customer, CustomerCapabilities, CustomerIdentifier, CustomerPasswordLoginInput, CustomerRegisterInput, CustomerRegisterResult, CustomerResetPasswordInput, CustomerSession, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceDoc, InvoiceFile, InvoiceFileKind, type InvoiceGroup, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, NextAction, Order, OrderProgress, PAYMENT_CHOICE_REFUSED_FIELD, PICKUP_STEPS, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorClass, type PaymentErrorClassKind, type PaymentErrorKind, type PaymentErrorLike, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, PendingPayment, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, Region, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, SHIPPING_STEPS, Shipment, ShipmentEvent, ShipmentStatus, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, TokenIntrospection, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, classifyPaymentError, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, diagnose, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, groupInvoiceDocs, hreflangLinks, invoiceFileBytes, isStorefrontError, isTestInvoice, isTestShipment, isTokenPublishable, maskToken, negotiateLocale, nextAction, normalizeClientIp, normalizeNote, opsSaysNotRetryable, orderProgress, orderShipments, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, repairPath, resolveAvailability, rewardLabel, safeHttpsUrl, safeInvoiceFilename, safeTrackingUrl, schemaAvailability, shipmentsStatus, sortTrackingEvents, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeoPoint } from './geo.js';
|
|
2
2
|
export { OpenStatus, OpeningHours } from './geo.js';
|
|
3
|
-
import {
|
|
4
|
-
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartInvoice, l as CartLine, n as CartLineMerchandise, r as CartRecommendation, t as CheckoutInfo, v as CheckoutPayment, R as Facet, S as FacetValue, T as FiscalDocumentEvidence, U as FiscalDocumentSource, V as FiscalIdentity, W as FiscalIdentityInput, X as FiscalVerification, Y as
|
|
3
|
+
import { a_ as ProductSort, bw as TokenIntrospection, bo as Shop, b6 as Region, aY as ProductConnection, aV as Product, y as Connection, x as Collection, ah as LocationListParams, ae as Location, an as NearestLocation, bs as StockLevel, ba as RestockSubscriptionInput, bb as RestockSubscriptionResult, m as CartLineInput, C as Cart, p as CartLineUpdateInput, f as CartBuyerInput, a as AddressInput, Q as DeliveryOptions, aL as PaymentMethods, O as DeliveryInput, a9 as InvoiceRequest, b4 as RecommendationPlacement, s as CartRecommendations, u as CheckoutInput, w as CheckoutResult, b3 as PromotionsList, aH as PaymentConfig, aQ as PaymentSubmitInput, aD as PaymentAttemptResult, D as CustomerIdentifier, J as CustomerSessionInput, I as CustomerSession, B as CustomerCapabilities, F as CustomerRegisterInput, G as CustomerRegisterResult, M as CustomerVerifyRegistrationInput, E as CustomerPasswordLoginInput, K as CustomerSetPasswordInput, H as CustomerResetPasswordInput, z as Customer, L as CustomerUpdateInput, aq as Order, bd as ReturnRequestInput, bc as ReturnRequest, aa as InvoiceResult, aS as PendingPayment, a8 as InvoiceFileKind, a7 as InvoiceFile, A as Address, bv as Theme, aA as Page, aj as Menu, b as Article, bu as StorefrontErrorCode, a4 as InsufficientStockLine, al as Money, d as AvailabilityStatus, o as CartLineProblem, c as Availability, a$ as ProductVariant, N as DeclineCode, aR as PaymentVoucher, aM as PaymentNextStep, q as CartPromotions, b1 as PromotionReward, a6 as InvoiceDoc, bh as Shipment, ao as NextAction, au as OrderProgress, bl as ShipmentStatus, bi as ShipmentEvent, P as DeliveryMethod, bx as UnavailableRateProvider } from './types-BeTemDg6.js';
|
|
4
|
+
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartInvoice, l as CartLine, n as CartLineMerchandise, r as CartRecommendation, t as CheckoutInfo, v as CheckoutPayment, R as Facet, S as FacetValue, T as FiscalDocumentEvidence, U as FiscalDocumentSource, V as FiscalIdentity, W as FiscalIdentityInput, X as FiscalVerification, Y as GeoHint, Z as IdentityCapture, _ as IdentityDocumentSpec, $ as IdentityFieldRule, a0 as IdentityRulesV1, a1 as IdentityStrategy, a2 as Image, a3 as InsufficientStockDetails, a5 as InvoiceAction, ab as InvoiceStage, ac as InvoiceSummary, ad as InvoicingCapabilities, af as LocationContacts, ag as LocationKind, ai as LocationPickup, ak as MenuItem, am as MoneyRange, ap as NextActionKind, ar as OrderLine, as as OrderPickup, at as OrderProblem, av as OrderProgressStep, aw as OrderSection, ax as OrderStage, ay as OrderStepKey, az as OrderStepState, aB as PageInfo, aC as PaymentAction, aE as PaymentAttemptStatus, aF as PaymentClient, aG as PaymentClientCsp, aI as PaymentFlow, aJ as PaymentInfo, aK as PaymentMethod, aN as PaymentOption, aO as PaymentOptionKey, aP as PaymentPoint, aT as PendingPaymentVoucher, aU as PickupOption, aW as ProductAttributeValue, aX as ProductCategory, aZ as ProductOption, b0 as PromotionAnnouncement, b2 as PromotionTier, b5 as Refund, b7 as RegionFiscalEntry, b8 as RegionFiscalId, b9 as RegionPaymentMethod, be as SEO, bf as Section, bg as SelectedOption, bj as ShipmentKind, bk as ShipmentMap, bm as ShipmentsSummary, bn as ShippingRate, bp as ShopBranch, bq as ShopContact, br as ShopPolicies, bt as StorefrontErrorBody } from './types-BeTemDg6.js';
|
|
5
5
|
|
|
6
6
|
type QueryValue = string | number | boolean | null | undefined;
|
|
7
7
|
type QueryParams = Record<string, QueryValue | QueryValue[]>;
|
|
@@ -145,6 +145,11 @@ type RequestSpec = {
|
|
|
145
145
|
options?: WriteOptions;
|
|
146
146
|
/** Resolve `null` instead of throwing on 404. */
|
|
147
147
|
nullOn404?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Never follow a redirect (`redirect: 'error'`, and a redirected answer is refused): for answers that carry the
|
|
150
|
+
* buyer's documents, so neither the customer token nor the request ever travels to another host.
|
|
151
|
+
*/
|
|
152
|
+
noRedirect?: boolean;
|
|
148
153
|
};
|
|
149
154
|
/** Header the gateway reads (only for tokens with `trust_client_ip`). */
|
|
150
155
|
declare const CLIENT_IP_HEADER = "X-Storefront-Client-IP";
|
|
@@ -317,6 +322,18 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
|
|
|
317
322
|
order: (id: string, options?: RequestOptions) => Promise<Order | null>;
|
|
318
323
|
requestReturn: (orderId: string, input: ReturnRequestInput, options?: WriteOptions) => Promise<ReturnRequest>;
|
|
319
324
|
requestInvoice: (orderId: string, input: InvoiceRequest, options?: WriteOptions) => Promise<InvoiceResult>;
|
|
325
|
+
/**
|
|
326
|
+
* Checkouts waiting for their payment (cash voucher: OXXO, SPEI). They are not orders yet; once the payment
|
|
327
|
+
* confirms they leave this list and show up in `orders`.
|
|
328
|
+
*/
|
|
329
|
+
pendingPayments: (params?: PaginationParams, options?: RequestOptions) => Promise<Connection<PendingPayment>>;
|
|
330
|
+
/**
|
|
331
|
+
* Reads one file (`pdf` | `xml`) of an invoice or credit note of the buyer's order, through the authenticated
|
|
332
|
+
* route (`order_invoice_file`): the answer is the file itself (base64), never a URL, so neither the buyer token
|
|
333
|
+
* nor a link of the PAC reaches the browser. Call it from YOUR server and stream the bytes
|
|
334
|
+
* (`invoiceFileBytes`). `null` when the order, the document or the file does not exist or is not the buyer's.
|
|
335
|
+
*/
|
|
336
|
+
invoiceFile: (orderId: string, invoiceId: string, kind: InvoiceFileKind, options?: RequestOptions) => Promise<InvoiceFile | null>;
|
|
320
337
|
addresses: {
|
|
321
338
|
list: (options?: RequestOptions) => Promise<{
|
|
322
339
|
nodes: Address[];
|
|
@@ -605,7 +622,7 @@ declare function productAvailability(product: Pick<Product, 'variants' | 'availa
|
|
|
605
622
|
*/
|
|
606
623
|
|
|
607
624
|
type PaymentLocale = AvailabilityLocale;
|
|
608
|
-
type PaymentMessageKey = `decline.${DeclineCode}` | 'state.loading' | 'state.processing' | 'state.approved' | 'state.in_review' | 'state.voucher' | 'state.challenge' | 'state.expired' | 'state.cancelled' | 'state.redirect' | 'state.fallback' | 'error.network' | 'error.card_data' | 'error.price_mismatch' | 'error.payment_in_progress' | 'error.expired' | 'error.too_many_attempts' | 'error.generic' | 'action.retry' | 'action.try_again' | 'action.pay' | 'action.cancel' | 'voucher.title' | 'voucher.point' | 'voucher.reference' | 'voucher.amount' | 'voucher.expires' | 'voucher.clabe' | 'voucher.barcode' | 'voucher.open' | 'voucher.email' | 'form.label' | 'challenge.title';
|
|
625
|
+
type PaymentMessageKey = `decline.${DeclineCode}` | 'state.loading' | 'state.processing' | 'state.approved' | 'state.in_review' | 'state.voucher' | 'state.challenge' | 'state.expired' | 'state.cancelled' | 'state.redirect' | 'state.fallback' | 'error.network' | 'error.card_data' | 'error.price_mismatch' | 'error.payment_in_progress' | 'error.expired' | 'error.too_many_attempts' | 'error.generic' | 'action.retry' | 'action.try_again' | 'action.pay' | 'action.cancel' | 'voucher.title' | 'voucher.point' | 'voucher.reference' | 'voucher.amount' | 'voucher.expires' | 'voucher.clabe' | 'voucher.barcode' | 'voucher.open' | 'voucher.email' | 'form.label' | 'challenge.title' | 'challenge.escape' | 'challenge.escape_hint' | 'challenge.left';
|
|
609
626
|
type PaymentMessages = Record<PaymentMessageKey, string>;
|
|
610
627
|
/** Catalog for a locale (`es-MX` -> es, `en-US` -> en) with the shop's per-key overrides applied. */
|
|
611
628
|
declare function paymentMessages(locale: string | null | undefined, overrides?: Partial<PaymentMessages> | null): PaymentMessages;
|
|
@@ -786,6 +803,53 @@ declare function hreflangLinks(markets: MarketInfo[], path: string, defaultMarke
|
|
|
786
803
|
href: string;
|
|
787
804
|
}[];
|
|
788
805
|
|
|
806
|
+
/** Steps of an order that ships, in order. */
|
|
807
|
+
declare const SHIPPING_STEPS: readonly ["paid", "preparing", "shipped", "in_transit", "delivered"];
|
|
808
|
+
/** Steps of an order the buyer picks up. */
|
|
809
|
+
declare const PICKUP_STEPS: readonly ["paid", "preparing", "ready_for_pickup", "delivered"];
|
|
810
|
+
/** A shipment the buyer can be told about as real: not a sandbox one. */
|
|
811
|
+
declare function isTestShipment(s: Pick<Shipment, 'test_mode' | 'environment'> | null | undefined): boolean;
|
|
812
|
+
/** An invoice or credit note from a sandbox PAC. */
|
|
813
|
+
declare function isTestInvoice(d: Pick<InvoiceDoc, 'test_mode' | 'environment'> | null | undefined): boolean;
|
|
814
|
+
/** `https` URL with no credentials, or `null`. The only kind of link a tracking or voucher button may carry. */
|
|
815
|
+
declare function safeTrackingUrl(value: unknown): string | null;
|
|
816
|
+
/** Newest first, invalid dates last, ties keep the server's order; at most `limit` (default 50, the contract's cap). */
|
|
817
|
+
declare function sortTrackingEvents(events: readonly ShipmentEvent[] | null | undefined, limit?: number): ShipmentEvent[];
|
|
818
|
+
/** The shipments of the order that count: outbound/pickup/local first, returns after; stable otherwise. */
|
|
819
|
+
declare function orderShipments(order: Pick<Order, 'shipments'> | null | undefined): Shipment[];
|
|
820
|
+
/**
|
|
821
|
+
* The unified progress. The server's `order.progress` wins when it is well formed; otherwise it is derived, so a store
|
|
822
|
+
* on an older OPS still gets a timeline. Pending payment, cancelled and refunded orders have no steps to walk: `steps`
|
|
823
|
+
* lists them as `pending` (or `[]` when cancelled/refunded) and the stage says why.
|
|
824
|
+
*/
|
|
825
|
+
declare function orderProgress(order: Order): OrderProgress;
|
|
826
|
+
/**
|
|
827
|
+
* The action to put first. The server's `next_action` wins (its `href` is re-checked: only `https`); an older server
|
|
828
|
+
* gets one derived from the order and its invoice. Never `null`: `{ kind: 'none' }` means "nothing to offer".
|
|
829
|
+
*/
|
|
830
|
+
declare function nextAction(order: Order): NextAction;
|
|
831
|
+
/** Latest known status among the live (non-sandbox, non-return) shipments, or `null`. */
|
|
832
|
+
declare function shipmentsStatus(order: Order): ShipmentStatus | null;
|
|
833
|
+
|
|
834
|
+
/** Invoices and credit notes of an order, and the bytes of a downloaded file. Pure; no URL of the PAC ever passes here. */
|
|
835
|
+
|
|
836
|
+
type InvoiceGroup = {
|
|
837
|
+
invoice: InvoiceDoc;
|
|
838
|
+
creditNotes: InvoiceDoc[];
|
|
839
|
+
};
|
|
840
|
+
/**
|
|
841
|
+
* Groups credit notes under the invoice they correct (`related_to`), keeping the server's order. A credit note whose
|
|
842
|
+
* invoice is not in the list (or has no `related_to`) is returned in `orphans`, never dropped.
|
|
843
|
+
*/
|
|
844
|
+
declare function groupInvoiceDocs(docs: readonly InvoiceDoc[] | null | undefined): {
|
|
845
|
+
groups: InvoiceGroup[];
|
|
846
|
+
orphans: InvoiceDoc[];
|
|
847
|
+
};
|
|
848
|
+
/** Decodes `content_base64` of a downloaded invoice file. Throws `TypeError` when it is not valid base64. */
|
|
849
|
+
declare function invoiceFileBytes(file: Pick<InvoiceFile, 'content_base64'>): Uint8Array;
|
|
850
|
+
/** A download filename that is safe in a `Content-Disposition` header: no path, quotes, control characters or spaces. */
|
|
851
|
+
declare function safeInvoiceFilename(name: unknown, fallback?: string): string;
|
|
852
|
+
|
|
789
853
|
/** Kind of a delivery radio: `ship` (address only, quote later), `rate` (a quoted rate) or `pickup` (a branch). */
|
|
790
854
|
type DeliveryChoiceKind = 'ship' | 'rate' | 'pickup';
|
|
791
855
|
type DeliveryChoice = {
|
|
@@ -817,4 +881,4 @@ type DeliveryNotices = {
|
|
|
817
881
|
/** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
|
|
818
882
|
declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
|
|
819
883
|
|
|
820
|
-
export { Address, AddressInput, Article, type ArticleListParams, Availability, type AvailabilityLocale, type AvailabilityMessageKey, type AvailabilityMessages, AvailabilityStatus, type AvailabilityTone, type AvailabilityView, type AvailabilityViewOptions, CLIENT_IP_HEADER, COUNTRY_HEADERS, Cart, CartBuyerInput, CartLineInput, CartLineProblem, type CartLineProblemView, CartLineUpdateInput, CartPromotions, CartRecommendations, CheckoutInput, CheckoutResult, Collection, type CollectionListParams, Connection, Customer, CustomerCapabilities, CustomerIdentifier, CustomerPasswordLoginInput, CustomerRegisterInput, CustomerRegisterResult, CustomerResetPasswordInput, CustomerSession, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, Order, PAYMENT_CHOICE_REFUSED_FIELD, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorClass, type PaymentErrorClassKind, type PaymentErrorKind, type PaymentErrorLike, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, Region, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, TokenIntrospection, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, classifyPaymentError, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, diagnose, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, hreflangLinks, isStorefrontError, isTokenPublishable, maskToken, negotiateLocale, normalizeClientIp, normalizeNote, opsSaysNotRetryable, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, repairPath, resolveAvailability, rewardLabel, safeHttpsUrl, schemaAvailability, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
|
884
|
+
export { Address, AddressInput, Article, type ArticleListParams, Availability, type AvailabilityLocale, type AvailabilityMessageKey, type AvailabilityMessages, AvailabilityStatus, type AvailabilityTone, type AvailabilityView, type AvailabilityViewOptions, CLIENT_IP_HEADER, COUNTRY_HEADERS, Cart, CartBuyerInput, CartLineInput, CartLineProblem, type CartLineProblemView, CartLineUpdateInput, CartPromotions, CartRecommendations, CheckoutInput, CheckoutResult, Collection, type CollectionListParams, Connection, Customer, CustomerCapabilities, CustomerIdentifier, CustomerPasswordLoginInput, CustomerRegisterInput, CustomerRegisterResult, CustomerResetPasswordInput, CustomerSession, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceDoc, InvoiceFile, InvoiceFileKind, type InvoiceGroup, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, NextAction, Order, OrderProgress, PAYMENT_CHOICE_REFUSED_FIELD, PICKUP_STEPS, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorClass, type PaymentErrorClassKind, type PaymentErrorKind, type PaymentErrorLike, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, PendingPayment, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, Region, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, SHIPPING_STEPS, Shipment, ShipmentEvent, ShipmentStatus, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, TokenIntrospection, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, classifyPaymentError, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, diagnose, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, groupInvoiceDocs, hreflangLinks, invoiceFileBytes, isStorefrontError, isTestInvoice, isTestShipment, isTokenPublishable, maskToken, negotiateLocale, nextAction, normalizeClientIp, normalizeNote, opsSaysNotRetryable, orderProgress, orderShipments, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, repairPath, resolveAvailability, rewardLabel, safeHttpsUrl, safeInvoiceFilename, safeTrackingUrl, schemaAvailability, shipmentsStatus, sortTrackingEvents, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|