@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/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.14.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.14.0" : "dev";
|
|
15
15
|
function createFileTokenSource(file, options = {}) {
|
|
16
16
|
const ttl = options.ttlMs ?? 3e4;
|
|
17
17
|
const now = options.now ?? Date.now;
|
|
@@ -576,16 +576,224 @@ type OrderLine = {
|
|
|
576
576
|
total: Money;
|
|
577
577
|
image: Image | null;
|
|
578
578
|
};
|
|
579
|
+
/**
|
|
580
|
+
* Enums the server may grow (contract 1.8): every union here keeps `(string & {})`, so a value this SDK does not know
|
|
581
|
+
* type-checks and the UI shows a safe fallback instead of breaking.
|
|
582
|
+
*/
|
|
583
|
+
type OrderStage = 'pending_payment' | 'paid' | 'preparing' | 'ready_for_pickup' | 'shipped' | 'in_transit' | 'out_for_delivery' | 'delivered' | 'cancelled' | 'refunded' | (string & {});
|
|
584
|
+
type OrderStepKey = 'paid' | 'preparing' | 'ready_for_pickup' | 'shipped' | 'in_transit' | 'delivered' | (string & {});
|
|
585
|
+
type OrderStepState = 'done' | 'current' | 'pending' | 'problem' | (string & {});
|
|
586
|
+
type OrderProgressStep = {
|
|
587
|
+
key: OrderStepKey;
|
|
588
|
+
state: OrderStepState;
|
|
589
|
+
at?: string | null;
|
|
590
|
+
};
|
|
591
|
+
/** What stops the order. `code` is open: `delivery_exception`, `returned`, `lost`, `payment_failed`, ... */
|
|
592
|
+
type OrderProblem = {
|
|
593
|
+
code: string;
|
|
594
|
+
at?: string | null;
|
|
595
|
+
};
|
|
596
|
+
/** Unified timeline of the order (payment, preparation, shipping, delivery). */
|
|
597
|
+
type OrderProgress = {
|
|
598
|
+
stage: OrderStage;
|
|
599
|
+
problem?: OrderProblem | null;
|
|
600
|
+
steps: OrderProgressStep[];
|
|
601
|
+
};
|
|
602
|
+
type NextActionKind = 'pay' | 'track' | 'pickup' | 'download_invoice' | 'request_invoice' | 'correct_invoice_data' | 'contact_store' | 'none' | (string & {});
|
|
603
|
+
/** The one thing the store should offer the buyer on this order. `href` is `https` only (tracking or voucher). */
|
|
604
|
+
type NextAction = {
|
|
605
|
+
kind: NextActionKind;
|
|
606
|
+
href?: string | null;
|
|
607
|
+
/** Id of the shipment or invoice the action points at. */
|
|
608
|
+
ref?: string | null;
|
|
609
|
+
};
|
|
610
|
+
type ShipmentStatus = 'pending' | 'label_created' | 'in_transit' | 'out_for_delivery' | 'delivered' | 'exception' | 'returned' | 'lost' | 'cancelled' | (string & {});
|
|
611
|
+
type ShipmentKind = 'outbound' | 'return' | 'pickup' | 'local' | (string & {});
|
|
612
|
+
type ShipmentEvent = {
|
|
613
|
+
id: string;
|
|
614
|
+
status: ShipmentStatus;
|
|
615
|
+
description?: string | null;
|
|
616
|
+
/** City / state text; never an address. */
|
|
617
|
+
location?: string | null;
|
|
618
|
+
occurred_at: string;
|
|
619
|
+
source?: 'carrier' | 'store' | null | (string & {});
|
|
620
|
+
};
|
|
621
|
+
/** Approximate point (city or state), rounded by the server. Never an address. */
|
|
622
|
+
type GeoHint = {
|
|
623
|
+
label: string;
|
|
624
|
+
lat: number;
|
|
625
|
+
lng: number;
|
|
626
|
+
precision: 'city' | 'state' | (string & {});
|
|
627
|
+
};
|
|
628
|
+
type ShipmentMap = {
|
|
629
|
+
origin?: GeoHint | null;
|
|
630
|
+
destination?: GeoHint | null;
|
|
631
|
+
path?: GeoHint[];
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* A shipment as the buyer sees it. A `test_mode` shipment (sandbox) is never shown as real: hide it or mark it
|
|
635
|
+
* "test". `label_url` exists only on `kind: 'return'`.
|
|
636
|
+
*/
|
|
637
|
+
type Shipment = {
|
|
638
|
+
id: string;
|
|
639
|
+
number?: string | null;
|
|
640
|
+
kind: ShipmentKind;
|
|
641
|
+
status: ShipmentStatus;
|
|
642
|
+
environment?: 'production' | 'sandbox' | (string & {});
|
|
643
|
+
test_mode?: boolean;
|
|
644
|
+
carrier?: string | null;
|
|
645
|
+
/** Key of the carrier logo in the SDK brand set (`dhl`, `estafeta`...). */
|
|
646
|
+
carrier_logo_key?: string | null;
|
|
647
|
+
service?: string | null;
|
|
648
|
+
tracking_number?: string | null;
|
|
649
|
+
/** `https` only. */
|
|
650
|
+
tracking_url?: string | null;
|
|
651
|
+
shipped_at?: string | null;
|
|
652
|
+
delivered_at?: string | null;
|
|
653
|
+
/** `YYYY-MM-DD`. */
|
|
654
|
+
promised_by?: string | null;
|
|
655
|
+
label_url?: string | null;
|
|
656
|
+
/** At most 50, newest first. */
|
|
657
|
+
events: ShipmentEvent[];
|
|
658
|
+
map?: ShipmentMap | null;
|
|
659
|
+
};
|
|
660
|
+
/** List-view summary of the shipments of an order. */
|
|
661
|
+
type ShipmentsSummary = {
|
|
662
|
+
count: number;
|
|
663
|
+
status: ShipmentStatus;
|
|
664
|
+
carrier?: string | null;
|
|
665
|
+
tracking_url?: string | null;
|
|
666
|
+
};
|
|
667
|
+
/** An invoice or credit note of an order (extends `InvoiceSummary`). Links, when present, are short-lived and never the PAC's. */
|
|
668
|
+
type InvoiceDoc = InvoiceSummary & {
|
|
669
|
+
id: string;
|
|
670
|
+
/** `issued | pending | cancelled | error` (open). */
|
|
671
|
+
status: 'issued' | 'pending' | 'cancelled' | 'error' | (string & {});
|
|
672
|
+
kind: 'invoice' | 'credit_note' | (string & {});
|
|
673
|
+
total?: Money | null;
|
|
674
|
+
issued_at?: string | null;
|
|
675
|
+
cancelled_at?: string | null;
|
|
676
|
+
series?: string | null;
|
|
677
|
+
folio_number?: string | null;
|
|
678
|
+
/** Id of the invoice a credit note corrects. */
|
|
679
|
+
related_to?: string | null;
|
|
680
|
+
links_expire_at?: string | null;
|
|
681
|
+
/** Invoice from a sandbox PAC: hide it or mark it "test, no fiscal validity". */
|
|
682
|
+
test_mode?: boolean;
|
|
683
|
+
environment?: 'production' | 'sandbox' | (string & {});
|
|
684
|
+
};
|
|
685
|
+
type PaymentInfo = {
|
|
686
|
+
method_label: string;
|
|
687
|
+
family?: 'card' | 'cash_voucher' | 'transfer' | 'wallet' | 'other' | null | (string & {});
|
|
688
|
+
status: 'paid' | 'pending' | 'failed' | 'refunded' | 'partially_refunded' | (string & {});
|
|
689
|
+
amount: Money;
|
|
690
|
+
paid_at?: string | null;
|
|
691
|
+
};
|
|
692
|
+
type Refund = {
|
|
693
|
+
id: string;
|
|
694
|
+
amount: Money;
|
|
695
|
+
status: 'requested' | 'processing' | 'completed' | 'failed' | (string & {});
|
|
696
|
+
method_label?: string | null;
|
|
697
|
+
created_at: string;
|
|
698
|
+
completed_at?: string | null;
|
|
699
|
+
return_id?: string | null;
|
|
700
|
+
};
|
|
701
|
+
/** A section of the order the server could not read; the rest of the order is still valid. */
|
|
702
|
+
type OrderSection = 'shipments' | 'invoices' | 'payments' | 'refunds' | (string & {});
|
|
703
|
+
type OrderPickup = {
|
|
704
|
+
location_id?: string | null;
|
|
705
|
+
name?: string | null;
|
|
706
|
+
address?: string | null;
|
|
707
|
+
city?: string | null;
|
|
708
|
+
phone?: string | null;
|
|
709
|
+
ready_at?: string | null;
|
|
710
|
+
delivered_at?: string | null;
|
|
711
|
+
};
|
|
579
712
|
type Order = {
|
|
580
713
|
id: string;
|
|
581
714
|
number: string;
|
|
715
|
+
/** Open: `placed`, `paid`, `shipped`, `fulfilled`... Prefer `progress`. */
|
|
582
716
|
status: string;
|
|
583
717
|
created_at: string;
|
|
584
718
|
total: Money;
|
|
585
719
|
lines: OrderLine[];
|
|
586
720
|
/** Invoice state; absent on older servers. */
|
|
587
721
|
invoice?: InvoiceSummary;
|
|
722
|
+
delivery_method?: 'shipping' | 'pickup' | null | (string & {});
|
|
723
|
+
pickup?: OrderPickup | null;
|
|
724
|
+
payment_status?: string | null;
|
|
725
|
+
subtotal?: Money;
|
|
726
|
+
tax?: Money;
|
|
727
|
+
shipping?: Money;
|
|
728
|
+
discount?: Money;
|
|
729
|
+
tax_included?: boolean;
|
|
730
|
+
shipping_method?: string | null;
|
|
731
|
+
/** Detail only: the address as the checkout captured it (the buyer's own). */
|
|
732
|
+
shipping_address?: Record<string, unknown> | null;
|
|
733
|
+
/** @deprecated Use `shipments[0].tracking_number`: it does not say if it is a sandbox guide. */
|
|
734
|
+
tracking?: string | null;
|
|
735
|
+
/** @deprecated Use `shipments`. */
|
|
736
|
+
fulfillments?: {
|
|
737
|
+
status: string;
|
|
738
|
+
tracking?: string | null;
|
|
739
|
+
shipped_at?: string | null;
|
|
740
|
+
}[];
|
|
741
|
+
returns?: {
|
|
742
|
+
id: string;
|
|
743
|
+
status: string;
|
|
744
|
+
created_at?: string | null;
|
|
745
|
+
}[];
|
|
746
|
+
/** Servers older than contract 1.8 omit it: use `orderProgress(order)`. */
|
|
747
|
+
progress?: OrderProgress;
|
|
748
|
+
/** Servers older than contract 1.8 omit it: use `nextAction(order)`. */
|
|
749
|
+
next_action?: NextAction | null;
|
|
750
|
+
/** Detail only. */
|
|
751
|
+
shipments?: Shipment[];
|
|
752
|
+
/** List only (the detail carries `shipments`). */
|
|
753
|
+
shipments_summary?: ShipmentsSummary;
|
|
754
|
+
/** Detail only: invoices and credit notes. */
|
|
755
|
+
invoices?: InvoiceDoc[];
|
|
756
|
+
/** Detail only. */
|
|
757
|
+
payments?: PaymentInfo[];
|
|
758
|
+
/** Detail only. */
|
|
759
|
+
refunds?: Refund[];
|
|
760
|
+
/** Sections that could not be read (`shipments`, `invoices`...): show a retry there, the rest is fine. */
|
|
761
|
+
degraded?: OrderSection[];
|
|
762
|
+
};
|
|
763
|
+
/** Cash voucher of a payment still waiting (OXXO, SPEI...). */
|
|
764
|
+
type PendingPaymentVoucher = {
|
|
765
|
+
provider?: string | null;
|
|
766
|
+
method?: string | null;
|
|
767
|
+
reference: string | null;
|
|
768
|
+
barcode: string | null;
|
|
769
|
+
clabe: string | null;
|
|
770
|
+
/** `https` only. */
|
|
771
|
+
voucher_url?: string | null;
|
|
772
|
+
instructions?: string | null;
|
|
773
|
+
expires_at: string | null;
|
|
774
|
+
amount: Money;
|
|
775
|
+
};
|
|
776
|
+
/** A checkout waiting for its payment: there is no order yet (the order exists once the payment confirms). */
|
|
777
|
+
type PendingPayment = {
|
|
778
|
+
/** Checkout id. */
|
|
779
|
+
id: string;
|
|
780
|
+
number: null;
|
|
781
|
+
status: 'pending_payment' | 'expired' | (string & {});
|
|
782
|
+
created_at: string;
|
|
783
|
+
total: Money;
|
|
784
|
+
expires_at: string | null;
|
|
785
|
+
payment: PendingPaymentVoucher;
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* A file of an invoice (`pdf` or `xml`), already read on the server so the browser never sees the buyer token nor a URL
|
|
789
|
+
* of the PAC. Serve it from your own route: `invoiceFileBytes(file)` gives the bytes.
|
|
790
|
+
*/
|
|
791
|
+
type InvoiceFile = {
|
|
792
|
+
filename: string;
|
|
793
|
+
content_type: string;
|
|
794
|
+
content_base64: string;
|
|
588
795
|
};
|
|
796
|
+
type InvoiceFileKind = 'pdf' | 'xml';
|
|
589
797
|
type ReturnRequestInput = {
|
|
590
798
|
lines: {
|
|
591
799
|
sku: string;
|
|
@@ -1180,4 +1388,4 @@ type IdentityRulesV1 = {
|
|
|
1180
1388
|
fields: IdentityFieldRule[];
|
|
1181
1389
|
};
|
|
1182
1390
|
|
|
1183
|
-
export type {
|
|
1391
|
+
export type { IdentityFieldRule as $, Address as A, CustomerCapabilities as B, Cart as C, CustomerIdentifier as D, CustomerPasswordLoginInput as E, CustomerRegisterInput as F, CustomerRegisterResult as G, CustomerResetPasswordInput as H, CustomerSession as I, CustomerSessionInput as J, CustomerSetPasswordInput as K, CustomerUpdateInput as L, CustomerVerifyRegistrationInput as M, DeclineCode as N, DeliveryInput as O, DeliveryMethod as P, DeliveryOptions as Q, Facet as R, FacetValue as S, FiscalDocumentEvidence as T, FiscalDocumentSource as U, FiscalIdentity as V, FiscalIdentityInput as W, FiscalVerification as X, GeoHint as Y, IdentityCapture as Z, IdentityDocumentSpec as _, AddressInput as a, ProductVariant as a$, IdentityRulesV1 as a0, IdentityStrategy as a1, Image as a2, InsufficientStockDetails as a3, InsufficientStockLine as a4, InvoiceAction as a5, InvoiceDoc as a6, InvoiceFile as a7, InvoiceFileKind as a8, InvoiceRequest as a9, Page as aA, PageInfo as aB, PaymentAction as aC, PaymentAttemptResult as aD, PaymentAttemptStatus as aE, PaymentClient as aF, PaymentClientCsp as aG, PaymentConfig as aH, PaymentFlow as aI, PaymentInfo as aJ, PaymentMethod as aK, PaymentMethods as aL, PaymentNextStep as aM, PaymentOption as aN, PaymentOptionKey as aO, PaymentPoint as aP, PaymentSubmitInput as aQ, PaymentVoucher as aR, PendingPayment as aS, PendingPaymentVoucher as aT, PickupOption as aU, Product as aV, ProductAttributeValue as aW, ProductCategory as aX, ProductConnection as aY, ProductOption as aZ, ProductSort as a_, InvoiceResult as aa, InvoiceStage as ab, InvoiceSummary as ac, InvoicingCapabilities as ad, Location as ae, LocationContacts as af, LocationKind as ag, LocationListParams as ah, LocationPickup as ai, Menu as aj, MenuItem as ak, Money as al, MoneyRange as am, NearestLocation as an, NextAction as ao, NextActionKind as ap, Order as aq, OrderLine as ar, OrderPickup as as, OrderProblem as at, OrderProgress as au, OrderProgressStep as av, OrderSection as aw, OrderStage as ax, OrderStepKey as ay, OrderStepState as az, Article as b, PromotionAnnouncement as b0, PromotionReward as b1, PromotionTier as b2, PromotionsList as b3, RecommendationPlacement as b4, Refund as b5, Region as b6, RegionFiscalEntry as b7, RegionFiscalId as b8, RegionPaymentMethod as b9, RestockSubscriptionInput as ba, RestockSubscriptionResult as bb, ReturnRequest as bc, ReturnRequestInput as bd, SEO as be, Section as bf, SelectedOption as bg, Shipment as bh, ShipmentEvent as bi, ShipmentKind as bj, ShipmentMap as bk, ShipmentStatus as bl, ShipmentsSummary as bm, ShippingRate as bn, Shop as bo, ShopBranch as bp, ShopContact as bq, ShopPolicies as br, StockLevel as bs, StorefrontErrorBody as bt, StorefrontErrorCode as bu, Theme as bv, TokenIntrospection as bw, UnavailableRateProvider as bx, Availability as c, AvailabilityStatus as d, CartBuyer as e, CartBuyerInput as f, CartCost as g, CartDelivery as h, CartDiscountCode as i, CartDiscountLine as j, CartInvoice as k, CartLine as l, CartLineInput as m, CartLineMerchandise as n, CartLineProblem as o, CartLineUpdateInput as p, CartPromotions as q, CartRecommendation as r, CartRecommendations as s, CheckoutInfo as t, CheckoutInput as u, CheckoutPayment as v, CheckoutResult as w, Collection as x, Connection as y, Customer as z };
|
|
@@ -576,16 +576,224 @@ type OrderLine = {
|
|
|
576
576
|
total: Money;
|
|
577
577
|
image: Image | null;
|
|
578
578
|
};
|
|
579
|
+
/**
|
|
580
|
+
* Enums the server may grow (contract 1.8): every union here keeps `(string & {})`, so a value this SDK does not know
|
|
581
|
+
* type-checks and the UI shows a safe fallback instead of breaking.
|
|
582
|
+
*/
|
|
583
|
+
type OrderStage = 'pending_payment' | 'paid' | 'preparing' | 'ready_for_pickup' | 'shipped' | 'in_transit' | 'out_for_delivery' | 'delivered' | 'cancelled' | 'refunded' | (string & {});
|
|
584
|
+
type OrderStepKey = 'paid' | 'preparing' | 'ready_for_pickup' | 'shipped' | 'in_transit' | 'delivered' | (string & {});
|
|
585
|
+
type OrderStepState = 'done' | 'current' | 'pending' | 'problem' | (string & {});
|
|
586
|
+
type OrderProgressStep = {
|
|
587
|
+
key: OrderStepKey;
|
|
588
|
+
state: OrderStepState;
|
|
589
|
+
at?: string | null;
|
|
590
|
+
};
|
|
591
|
+
/** What stops the order. `code` is open: `delivery_exception`, `returned`, `lost`, `payment_failed`, ... */
|
|
592
|
+
type OrderProblem = {
|
|
593
|
+
code: string;
|
|
594
|
+
at?: string | null;
|
|
595
|
+
};
|
|
596
|
+
/** Unified timeline of the order (payment, preparation, shipping, delivery). */
|
|
597
|
+
type OrderProgress = {
|
|
598
|
+
stage: OrderStage;
|
|
599
|
+
problem?: OrderProblem | null;
|
|
600
|
+
steps: OrderProgressStep[];
|
|
601
|
+
};
|
|
602
|
+
type NextActionKind = 'pay' | 'track' | 'pickup' | 'download_invoice' | 'request_invoice' | 'correct_invoice_data' | 'contact_store' | 'none' | (string & {});
|
|
603
|
+
/** The one thing the store should offer the buyer on this order. `href` is `https` only (tracking or voucher). */
|
|
604
|
+
type NextAction = {
|
|
605
|
+
kind: NextActionKind;
|
|
606
|
+
href?: string | null;
|
|
607
|
+
/** Id of the shipment or invoice the action points at. */
|
|
608
|
+
ref?: string | null;
|
|
609
|
+
};
|
|
610
|
+
type ShipmentStatus = 'pending' | 'label_created' | 'in_transit' | 'out_for_delivery' | 'delivered' | 'exception' | 'returned' | 'lost' | 'cancelled' | (string & {});
|
|
611
|
+
type ShipmentKind = 'outbound' | 'return' | 'pickup' | 'local' | (string & {});
|
|
612
|
+
type ShipmentEvent = {
|
|
613
|
+
id: string;
|
|
614
|
+
status: ShipmentStatus;
|
|
615
|
+
description?: string | null;
|
|
616
|
+
/** City / state text; never an address. */
|
|
617
|
+
location?: string | null;
|
|
618
|
+
occurred_at: string;
|
|
619
|
+
source?: 'carrier' | 'store' | null | (string & {});
|
|
620
|
+
};
|
|
621
|
+
/** Approximate point (city or state), rounded by the server. Never an address. */
|
|
622
|
+
type GeoHint = {
|
|
623
|
+
label: string;
|
|
624
|
+
lat: number;
|
|
625
|
+
lng: number;
|
|
626
|
+
precision: 'city' | 'state' | (string & {});
|
|
627
|
+
};
|
|
628
|
+
type ShipmentMap = {
|
|
629
|
+
origin?: GeoHint | null;
|
|
630
|
+
destination?: GeoHint | null;
|
|
631
|
+
path?: GeoHint[];
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* A shipment as the buyer sees it. A `test_mode` shipment (sandbox) is never shown as real: hide it or mark it
|
|
635
|
+
* "test". `label_url` exists only on `kind: 'return'`.
|
|
636
|
+
*/
|
|
637
|
+
type Shipment = {
|
|
638
|
+
id: string;
|
|
639
|
+
number?: string | null;
|
|
640
|
+
kind: ShipmentKind;
|
|
641
|
+
status: ShipmentStatus;
|
|
642
|
+
environment?: 'production' | 'sandbox' | (string & {});
|
|
643
|
+
test_mode?: boolean;
|
|
644
|
+
carrier?: string | null;
|
|
645
|
+
/** Key of the carrier logo in the SDK brand set (`dhl`, `estafeta`...). */
|
|
646
|
+
carrier_logo_key?: string | null;
|
|
647
|
+
service?: string | null;
|
|
648
|
+
tracking_number?: string | null;
|
|
649
|
+
/** `https` only. */
|
|
650
|
+
tracking_url?: string | null;
|
|
651
|
+
shipped_at?: string | null;
|
|
652
|
+
delivered_at?: string | null;
|
|
653
|
+
/** `YYYY-MM-DD`. */
|
|
654
|
+
promised_by?: string | null;
|
|
655
|
+
label_url?: string | null;
|
|
656
|
+
/** At most 50, newest first. */
|
|
657
|
+
events: ShipmentEvent[];
|
|
658
|
+
map?: ShipmentMap | null;
|
|
659
|
+
};
|
|
660
|
+
/** List-view summary of the shipments of an order. */
|
|
661
|
+
type ShipmentsSummary = {
|
|
662
|
+
count: number;
|
|
663
|
+
status: ShipmentStatus;
|
|
664
|
+
carrier?: string | null;
|
|
665
|
+
tracking_url?: string | null;
|
|
666
|
+
};
|
|
667
|
+
/** An invoice or credit note of an order (extends `InvoiceSummary`). Links, when present, are short-lived and never the PAC's. */
|
|
668
|
+
type InvoiceDoc = InvoiceSummary & {
|
|
669
|
+
id: string;
|
|
670
|
+
/** `issued | pending | cancelled | error` (open). */
|
|
671
|
+
status: 'issued' | 'pending' | 'cancelled' | 'error' | (string & {});
|
|
672
|
+
kind: 'invoice' | 'credit_note' | (string & {});
|
|
673
|
+
total?: Money | null;
|
|
674
|
+
issued_at?: string | null;
|
|
675
|
+
cancelled_at?: string | null;
|
|
676
|
+
series?: string | null;
|
|
677
|
+
folio_number?: string | null;
|
|
678
|
+
/** Id of the invoice a credit note corrects. */
|
|
679
|
+
related_to?: string | null;
|
|
680
|
+
links_expire_at?: string | null;
|
|
681
|
+
/** Invoice from a sandbox PAC: hide it or mark it "test, no fiscal validity". */
|
|
682
|
+
test_mode?: boolean;
|
|
683
|
+
environment?: 'production' | 'sandbox' | (string & {});
|
|
684
|
+
};
|
|
685
|
+
type PaymentInfo = {
|
|
686
|
+
method_label: string;
|
|
687
|
+
family?: 'card' | 'cash_voucher' | 'transfer' | 'wallet' | 'other' | null | (string & {});
|
|
688
|
+
status: 'paid' | 'pending' | 'failed' | 'refunded' | 'partially_refunded' | (string & {});
|
|
689
|
+
amount: Money;
|
|
690
|
+
paid_at?: string | null;
|
|
691
|
+
};
|
|
692
|
+
type Refund = {
|
|
693
|
+
id: string;
|
|
694
|
+
amount: Money;
|
|
695
|
+
status: 'requested' | 'processing' | 'completed' | 'failed' | (string & {});
|
|
696
|
+
method_label?: string | null;
|
|
697
|
+
created_at: string;
|
|
698
|
+
completed_at?: string | null;
|
|
699
|
+
return_id?: string | null;
|
|
700
|
+
};
|
|
701
|
+
/** A section of the order the server could not read; the rest of the order is still valid. */
|
|
702
|
+
type OrderSection = 'shipments' | 'invoices' | 'payments' | 'refunds' | (string & {});
|
|
703
|
+
type OrderPickup = {
|
|
704
|
+
location_id?: string | null;
|
|
705
|
+
name?: string | null;
|
|
706
|
+
address?: string | null;
|
|
707
|
+
city?: string | null;
|
|
708
|
+
phone?: string | null;
|
|
709
|
+
ready_at?: string | null;
|
|
710
|
+
delivered_at?: string | null;
|
|
711
|
+
};
|
|
579
712
|
type Order = {
|
|
580
713
|
id: string;
|
|
581
714
|
number: string;
|
|
715
|
+
/** Open: `placed`, `paid`, `shipped`, `fulfilled`... Prefer `progress`. */
|
|
582
716
|
status: string;
|
|
583
717
|
created_at: string;
|
|
584
718
|
total: Money;
|
|
585
719
|
lines: OrderLine[];
|
|
586
720
|
/** Invoice state; absent on older servers. */
|
|
587
721
|
invoice?: InvoiceSummary;
|
|
722
|
+
delivery_method?: 'shipping' | 'pickup' | null | (string & {});
|
|
723
|
+
pickup?: OrderPickup | null;
|
|
724
|
+
payment_status?: string | null;
|
|
725
|
+
subtotal?: Money;
|
|
726
|
+
tax?: Money;
|
|
727
|
+
shipping?: Money;
|
|
728
|
+
discount?: Money;
|
|
729
|
+
tax_included?: boolean;
|
|
730
|
+
shipping_method?: string | null;
|
|
731
|
+
/** Detail only: the address as the checkout captured it (the buyer's own). */
|
|
732
|
+
shipping_address?: Record<string, unknown> | null;
|
|
733
|
+
/** @deprecated Use `shipments[0].tracking_number`: it does not say if it is a sandbox guide. */
|
|
734
|
+
tracking?: string | null;
|
|
735
|
+
/** @deprecated Use `shipments`. */
|
|
736
|
+
fulfillments?: {
|
|
737
|
+
status: string;
|
|
738
|
+
tracking?: string | null;
|
|
739
|
+
shipped_at?: string | null;
|
|
740
|
+
}[];
|
|
741
|
+
returns?: {
|
|
742
|
+
id: string;
|
|
743
|
+
status: string;
|
|
744
|
+
created_at?: string | null;
|
|
745
|
+
}[];
|
|
746
|
+
/** Servers older than contract 1.8 omit it: use `orderProgress(order)`. */
|
|
747
|
+
progress?: OrderProgress;
|
|
748
|
+
/** Servers older than contract 1.8 omit it: use `nextAction(order)`. */
|
|
749
|
+
next_action?: NextAction | null;
|
|
750
|
+
/** Detail only. */
|
|
751
|
+
shipments?: Shipment[];
|
|
752
|
+
/** List only (the detail carries `shipments`). */
|
|
753
|
+
shipments_summary?: ShipmentsSummary;
|
|
754
|
+
/** Detail only: invoices and credit notes. */
|
|
755
|
+
invoices?: InvoiceDoc[];
|
|
756
|
+
/** Detail only. */
|
|
757
|
+
payments?: PaymentInfo[];
|
|
758
|
+
/** Detail only. */
|
|
759
|
+
refunds?: Refund[];
|
|
760
|
+
/** Sections that could not be read (`shipments`, `invoices`...): show a retry there, the rest is fine. */
|
|
761
|
+
degraded?: OrderSection[];
|
|
762
|
+
};
|
|
763
|
+
/** Cash voucher of a payment still waiting (OXXO, SPEI...). */
|
|
764
|
+
type PendingPaymentVoucher = {
|
|
765
|
+
provider?: string | null;
|
|
766
|
+
method?: string | null;
|
|
767
|
+
reference: string | null;
|
|
768
|
+
barcode: string | null;
|
|
769
|
+
clabe: string | null;
|
|
770
|
+
/** `https` only. */
|
|
771
|
+
voucher_url?: string | null;
|
|
772
|
+
instructions?: string | null;
|
|
773
|
+
expires_at: string | null;
|
|
774
|
+
amount: Money;
|
|
775
|
+
};
|
|
776
|
+
/** A checkout waiting for its payment: there is no order yet (the order exists once the payment confirms). */
|
|
777
|
+
type PendingPayment = {
|
|
778
|
+
/** Checkout id. */
|
|
779
|
+
id: string;
|
|
780
|
+
number: null;
|
|
781
|
+
status: 'pending_payment' | 'expired' | (string & {});
|
|
782
|
+
created_at: string;
|
|
783
|
+
total: Money;
|
|
784
|
+
expires_at: string | null;
|
|
785
|
+
payment: PendingPaymentVoucher;
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* A file of an invoice (`pdf` or `xml`), already read on the server so the browser never sees the buyer token nor a URL
|
|
789
|
+
* of the PAC. Serve it from your own route: `invoiceFileBytes(file)` gives the bytes.
|
|
790
|
+
*/
|
|
791
|
+
type InvoiceFile = {
|
|
792
|
+
filename: string;
|
|
793
|
+
content_type: string;
|
|
794
|
+
content_base64: string;
|
|
588
795
|
};
|
|
796
|
+
type InvoiceFileKind = 'pdf' | 'xml';
|
|
589
797
|
type ReturnRequestInput = {
|
|
590
798
|
lines: {
|
|
591
799
|
sku: string;
|
|
@@ -1180,4 +1388,4 @@ type IdentityRulesV1 = {
|
|
|
1180
1388
|
fields: IdentityFieldRule[];
|
|
1181
1389
|
};
|
|
1182
1390
|
|
|
1183
|
-
export type {
|
|
1391
|
+
export type { IdentityFieldRule as $, Address as A, CustomerCapabilities as B, Cart as C, CustomerIdentifier as D, CustomerPasswordLoginInput as E, CustomerRegisterInput as F, CustomerRegisterResult as G, CustomerResetPasswordInput as H, CustomerSession as I, CustomerSessionInput as J, CustomerSetPasswordInput as K, CustomerUpdateInput as L, CustomerVerifyRegistrationInput as M, DeclineCode as N, DeliveryInput as O, DeliveryMethod as P, DeliveryOptions as Q, Facet as R, FacetValue as S, FiscalDocumentEvidence as T, FiscalDocumentSource as U, FiscalIdentity as V, FiscalIdentityInput as W, FiscalVerification as X, GeoHint as Y, IdentityCapture as Z, IdentityDocumentSpec as _, AddressInput as a, ProductVariant as a$, IdentityRulesV1 as a0, IdentityStrategy as a1, Image as a2, InsufficientStockDetails as a3, InsufficientStockLine as a4, InvoiceAction as a5, InvoiceDoc as a6, InvoiceFile as a7, InvoiceFileKind as a8, InvoiceRequest as a9, Page as aA, PageInfo as aB, PaymentAction as aC, PaymentAttemptResult as aD, PaymentAttemptStatus as aE, PaymentClient as aF, PaymentClientCsp as aG, PaymentConfig as aH, PaymentFlow as aI, PaymentInfo as aJ, PaymentMethod as aK, PaymentMethods as aL, PaymentNextStep as aM, PaymentOption as aN, PaymentOptionKey as aO, PaymentPoint as aP, PaymentSubmitInput as aQ, PaymentVoucher as aR, PendingPayment as aS, PendingPaymentVoucher as aT, PickupOption as aU, Product as aV, ProductAttributeValue as aW, ProductCategory as aX, ProductConnection as aY, ProductOption as aZ, ProductSort as a_, InvoiceResult as aa, InvoiceStage as ab, InvoiceSummary as ac, InvoicingCapabilities as ad, Location as ae, LocationContacts as af, LocationKind as ag, LocationListParams as ah, LocationPickup as ai, Menu as aj, MenuItem as ak, Money as al, MoneyRange as am, NearestLocation as an, NextAction as ao, NextActionKind as ap, Order as aq, OrderLine as ar, OrderPickup as as, OrderProblem as at, OrderProgress as au, OrderProgressStep as av, OrderSection as aw, OrderStage as ax, OrderStepKey as ay, OrderStepState as az, Article as b, PromotionAnnouncement as b0, PromotionReward as b1, PromotionTier as b2, PromotionsList as b3, RecommendationPlacement as b4, Refund as b5, Region as b6, RegionFiscalEntry as b7, RegionFiscalId as b8, RegionPaymentMethod as b9, RestockSubscriptionInput as ba, RestockSubscriptionResult as bb, ReturnRequest as bc, ReturnRequestInput as bd, SEO as be, Section as bf, SelectedOption as bg, Shipment as bh, ShipmentEvent as bi, ShipmentKind as bj, ShipmentMap as bk, ShipmentStatus as bl, ShipmentsSummary as bm, ShippingRate as bn, Shop as bo, ShopBranch as bp, ShopContact as bq, ShopPolicies as br, StockLevel as bs, StorefrontErrorBody as bt, StorefrontErrorCode as bu, Theme as bv, TokenIntrospection as bw, UnavailableRateProvider as bx, Availability as c, AvailabilityStatus as d, CartBuyer as e, CartBuyerInput as f, CartCost as g, CartDelivery as h, CartDiscountCode as i, CartDiscountLine as j, CartInvoice as k, CartLine as l, CartLineInput as m, CartLineMerchandise as n, CartLineProblem as o, CartLineUpdateInput as p, CartPromotions as q, CartRecommendation as r, CartRecommendations as s, CheckoutInfo as t, CheckoutInput as u, CheckoutPayment as v, CheckoutResult as w, Collection as x, Connection as y, Customer as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asteby/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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": {
|