@asteby/storefront 0.17.0 → 0.18.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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { b4 as ProductSort, bH as TokenIntrospection, bx as Shop, be as Region, bi as RegionPostalCode, b2 as ProductConnection, a$ as Product, z as Connection, y as Collection, an as LocationListParams, ak as Location, at as NearestLocation, bB as StockLevel, bj as RestockSubscriptionInput, bk as RestockSubscriptionResult, n as CartLineInput, C as Cart, q as CartLineUpdateInput, g as CartBuyerInput, b as AddressInput, U as DeliveryOptions, aR as PaymentMethods, S as DeliveryInput, af as InvoiceRequest, bc as RecommendationPlacement, t as CartRecommendations, v as CheckoutInput, x as CheckoutResult, b9 as PromotionsList, aN as PaymentConfig, aW as PaymentSubmitInput, aJ as PaymentAttemptResult, E as CustomerIdentifier, M as CustomerSessionInput, K as CustomerSession, D as CustomerCapabilities, H as CustomerRegisterInput, I as CustomerRegisterResult, P as CustomerVerifyRegistrationInput, F as CustomerPasswordLoginInput, N as CustomerSetPasswordInput, J as CustomerResetPasswordInput, B as Customer, O as CustomerUpdateInput, L as CustomerSessionInfo, ba as ReauthInput, bb as ReauthResult, Q as DataExportFile, A as AccountDeleteInput, aw as Order, bm as ReturnRequestInput, bl as ReturnRequest, ag as InvoiceResult, aY as PendingPayment, ae as InvoiceFileKind, ad as InvoiceFile, $ as FiscalProfile, a0 as FiscalProfileInput, a as Address, bG as Theme, aG as Page, ap as Menu, c as Article, ar as Money, e as AvailabilityStatus, p as CartLineProblem, d as Availability, aa as InsufficientStockLine, b5 as ProductVariant, R as DeclineCode, aX as PaymentVoucher, aS as PaymentNextStep, r as CartPromotions, b7 as PromotionReward, ac as InvoiceDoc, bq as Shipment, au as NextAction, aA as OrderProgress, bu as ShipmentStatus, br as ShipmentEvent, T as DeliveryMethod, bI as UnavailableRateProvider } from './account-settings-H6zuI7iG.cjs';
2
- export { f as CartBuyer, h as CartCost, i as CartDelivery, j as CartDiscountCode, k as CartDiscountLine, l as CartInvoice, m as CartLine, o as CartLineMerchandise, s as CartRecommendation, u as CheckoutInfo, w as CheckoutPayment, G as CustomerPreferences, V as Facet, W as FacetValue, X as FiscalDocumentEvidence, Y as FiscalDocumentSource, Z as FiscalIdentity, _ as FiscalIdentityInput, a1 as FiscalVerification, a2 as GeoHint, a3 as IdentityCapture, a4 as IdentityDocumentSpec, a5 as IdentityFieldRule, a6 as IdentityRulesV1, a7 as IdentityStrategy, a8 as Image, a9 as InsufficientStockDetails, ab as InvoiceAction, ah as InvoiceStage, ai as InvoiceSummary, aj as InvoicingCapabilities, al as LocationContacts, am as LocationKind, ao as LocationPickup, aq as MenuItem, as as MoneyRange, av as NextActionKind, ax as OrderLine, ay as OrderPickup, az as OrderProblem, aB as OrderProgressStep, aC as OrderSection, aD as OrderStage, aE as OrderStepKey, aF as OrderStepState, aH as PageInfo, aI as PaymentAction, aK as PaymentAttemptStatus, aL as PaymentClient, aM as PaymentClientCsp, aO as PaymentFlow, aP as PaymentInfo, aQ as PaymentMethod, aT as PaymentOption, aU as PaymentOptionKey, aV as PaymentPoint, aZ as PendingPaymentVoucher, a_ as PickupOption, b0 as ProductAttributeValue, b1 as ProductCategory, b3 as ProductOption, b6 as PromotionAnnouncement, b8 as PromotionTier, bd as Refund, bf as RegionFiscalEntry, bg as RegionFiscalId, bh as RegionPaymentMethod, bn as SEO, bo as Section, bp as SelectedOption, bs as ShipmentKind, bt as ShipmentMap, bv as ShipmentsSummary, bw as ShippingRate, by as ShopBranch, bz as ShopContact, bA as ShopPolicies, bC as StorefrontError, bD as StorefrontErrorBody, bE as StorefrontErrorCode, bF as StorefrontErrorInit, bJ as dataExportBytes, bK as isAccountDeleteBlocked, bL as isReauthRequired, bM as isStorefrontError, bN as safeExportFilename } from './account-settings-H6zuI7iG.cjs';
1
+ import { b4 as ProductSort, bQ as TokenIntrospection, bx as Shop, be as Region, bi as RegionPostalCode, b2 as ProductConnection, a$ as Product, z as Connection, y as Collection, an as LocationListParams, ak as Location, at as NearestLocation, bB as StockLevel, bj as RestockSubscriptionInput, bk as RestockSubscriptionResult, n as CartLineInput, C as Cart, q as CartLineUpdateInput, g as CartBuyerInput, b as AddressInput, U as DeliveryOptions, aR as PaymentMethods, S as DeliveryInput, af as InvoiceRequest, bc as RecommendationPlacement, t as CartRecommendations, v as CheckoutInput, x as CheckoutResult, b9 as PromotionsList, aN as PaymentConfig, aW as PaymentSubmitInput, aJ as PaymentAttemptResult, E as CustomerIdentifier, M as CustomerSessionInput, K as CustomerSession, D as CustomerCapabilities, H as CustomerRegisterInput, I as CustomerRegisterResult, P as CustomerVerifyRegistrationInput, F as CustomerPasswordLoginInput, N as CustomerSetPasswordInput, J as CustomerResetPasswordInput, B as Customer, O as CustomerUpdateInput, L as CustomerSessionInfo, ba as ReauthInput, bb as ReauthResult, Q as DataExportFile, A as AccountDeleteInput, aw as Order, bm as ReturnRequestInput, bl as ReturnRequest, ag as InvoiceResult, aY as PendingPayment, ae as InvoiceFileKind, ad as InvoiceFile, $ as FiscalProfile, a0 as FiscalProfileInput, bG as Subject, bL as SubjectInput, bN as SubjectPatch, a as Address, bM as SubjectKind, bP as Theme, aG as Page, ap as Menu, c as Article, ar as Money, e as AvailabilityStatus, p as CartLineProblem, d as Availability, aa as InsufficientStockLine, b5 as ProductVariant, R as DeclineCode, aX as PaymentVoucher, aS as PaymentNextStep, r as CartPromotions, b7 as PromotionReward, ac as InvoiceDoc, bq as Shipment, au as NextAction, aA as OrderProgress, bu as ShipmentStatus, br as ShipmentEvent, bI as SubjectCatalogNode, bJ as SubjectField, T as DeliveryMethod, bR as UnavailableRateProvider } from './account-settings-DAzmXHIn.cjs';
2
+ export { f as CartBuyer, h as CartCost, i as CartDelivery, j as CartDiscountCode, k as CartDiscountLine, l as CartInvoice, m as CartLine, o as CartLineMerchandise, s as CartRecommendation, u as CheckoutInfo, w as CheckoutPayment, G as CustomerPreferences, V as Facet, W as FacetValue, X as FiscalDocumentEvidence, Y as FiscalDocumentSource, Z as FiscalIdentity, _ as FiscalIdentityInput, a1 as FiscalVerification, a2 as GeoHint, a3 as IdentityCapture, a4 as IdentityDocumentSpec, a5 as IdentityFieldRule, a6 as IdentityRulesV1, a7 as IdentityStrategy, a8 as Image, a9 as InsufficientStockDetails, ab as InvoiceAction, ah as InvoiceStage, ai as InvoiceSummary, aj as InvoicingCapabilities, al as LocationContacts, am as LocationKind, ao as LocationPickup, aq as MenuItem, as as MoneyRange, av as NextActionKind, ax as OrderLine, ay as OrderPickup, az as OrderProblem, aB as OrderProgressStep, aC as OrderSection, aD as OrderStage, aE as OrderStepKey, aF as OrderStepState, aH as PageInfo, aI as PaymentAction, aK as PaymentAttemptStatus, aL as PaymentClient, aM as PaymentClientCsp, aO as PaymentFlow, aP as PaymentInfo, aQ as PaymentMethod, aT as PaymentOption, aU as PaymentOptionKey, aV as PaymentPoint, aZ as PendingPaymentVoucher, a_ as PickupOption, b0 as ProductAttributeValue, b1 as ProductCategory, b3 as ProductOption, b6 as PromotionAnnouncement, b8 as PromotionTier, bd as Refund, bf as RegionFiscalEntry, bg as RegionFiscalId, bh as RegionPaymentMethod, bn as SEO, bo as Section, bp as SelectedOption, bs as ShipmentKind, bt as ShipmentMap, bv as ShipmentsSummary, bw as ShippingRate, by as ShopBranch, bz as ShopContact, bA as ShopPolicies, bC as StorefrontError, bD as StorefrontErrorBody, bE as StorefrontErrorCode, bF as StorefrontErrorInit, bH as SubjectCatalog, bK as SubjectFieldType, bO as SubjectRef, bS as dataExportBytes, bT as isAccountDeleteBlocked, bU as isReauthRequired, bV as isStorefrontError, bW as safeExportFilename } from './account-settings-DAzmXHIn.cjs';
3
3
  import { GeoPoint } from './geo.cjs';
4
4
  export { OpenStatus, OpeningHours } from './geo.cjs';
5
5
 
@@ -29,6 +29,11 @@ type ProductListParams = PaginationParams & {
29
29
  filters?: Record<string, QueryValue | QueryValue[]>;
30
30
  /** Restrict to these handles (max 100). Serialized comma-separated. */
31
31
  handles?: string[];
32
+ /**
33
+ * Only products carrying at least one of these tags (OR, at most 5 of 120 characters; contract 1.9). Serialized
34
+ * comma-separated. A parts store passes `fitTagsAny(fitKey)` (`fit:<key>`, `fit:universal`); any tag works.
35
+ */
36
+ tags_any?: string[];
32
37
  };
33
38
  type CollectionListParams = PaginationParams;
34
39
  type ArticleListParams = Omit<PaginationParams, 'first'> & {
@@ -383,6 +388,21 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
383
388
  /** Physical delete (a profile leaves nothing behind). A saved default passes to another profile. */
384
389
  delete: (id: string, options?: WriteOptions) => Promise<void>;
385
390
  };
391
+ /**
392
+ * Saved items of the buyer («My items», «My garage»; contract 1.9, `capabilities().subjects`). Personal data:
393
+ * private, never cached, never logged. `422` with `field: 'attributes.<field>'` when the kind refuses a value
394
+ * (it never echoes it); `409` for an item already saved or past the limit; `429` for too many saves; `404` for
395
+ * an item that is not the buyer's. The server builds `label` and `fit_key`; private fields come back masked.
396
+ */
397
+ subjects: {
398
+ list: (params?: {
399
+ kind?: string;
400
+ }, options?: RequestOptions) => Promise<Subject[]>;
401
+ create: (input: SubjectInput, options?: WriteOptions) => Promise<Subject>;
402
+ update: (id: string, patch: SubjectPatch, options?: WriteOptions) => Promise<Subject>;
403
+ /** Physical delete (the item leaves nothing behind). The default of its kind passes to another item. */
404
+ delete: (id: string, options?: WriteOptions) => Promise<void>;
405
+ };
386
406
  addresses: {
387
407
  list: (options?: RequestOptions) => Promise<{
388
408
  nodes: Address[];
@@ -393,6 +413,11 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
393
413
  };
394
414
  };
395
415
  content: {
416
+ /**
417
+ * The kinds of buyer item the organization declares («My garage») and their catalogs (contract 1.9; public,
418
+ * cacheable). `[]` when it declares none or the server predates the route: the store has no such section.
419
+ */
420
+ subjectKinds: (options?: RequestOptions) => Promise<SubjectKind[]>;
396
421
  theme: (options?: RequestOptions) => Promise<Theme>;
397
422
  /** `null` when the page does not exist. */
398
423
  page: (handle: string, options?: PreviewOptions) => Promise<Page | null>;
@@ -832,6 +857,82 @@ declare function invoiceFileBytes(file: Pick<InvoiceFile, 'content_base64'>): Ui
832
857
  /** A download filename that is safe in a `Content-Disposition` header: no path, quotes, control characters or spaces. */
833
858
  declare function safeInvoiceFilename(name: unknown, fallback?: string): string;
834
859
 
860
+ declare const MIN_SUBJECT_YEAR = 1900;
861
+ declare const MAX_SUBJECT_YEAR = 2100;
862
+ type SubjectOption = {
863
+ value: string;
864
+ label: string;
865
+ };
866
+ type SubjectValues = Record<string, string | number | null | undefined>;
867
+ /** Why a value was refused (the server answers `422` with the field `attributes.<key>` and never the value). */
868
+ type SubjectProblemCode = 'required' | 'unknown' | 'invalid' | 'not_in_catalog' | 'year_range' | 'catalog_unavailable';
869
+ type SubjectProblems = Record<string, SubjectProblemCode>;
870
+ type ResolvedSubject = {
871
+ /** Built from the labels of the catalog and the public values, in field order. */
872
+ label: string;
873
+ /** `''` when a placeholder of the template has no value (the item then never matches a product). */
874
+ fit_key: string;
875
+ /** Public values, as the server stores them in `attributes`. */
876
+ attributes: Record<string, string | number>;
877
+ /** Private values: never in the label, the key or a tag. */
878
+ private: Record<string, string>;
879
+ };
880
+ /** Does the option cover the model year? Declared `ranges` win; else `from`/`to`; an option with none covers any year. */
881
+ declare function coversYear(node: Pick<SubjectCatalogNode, 'from' | 'to' | 'ranges'>, year: number): boolean;
882
+ /** The catalog fields that make the tree's levels, in order: `source: catalog` and not a year. */
883
+ declare function subjectLevels(kind: Pick<SubjectKind, 'fields'>): SubjectField[];
884
+ /** The visible fields of a form: everything the buyer fills in, in the order of the kind. */
885
+ declare function subjectFields(kind: Pick<SubjectKind, 'fields'>): SubjectField[];
886
+ /**
887
+ * The options a catalog field offers given what is already chosen (a cascade: a level shows nothing until the previous
888
+ * one is chosen). A level narrows by the chosen year when the option declares years; a year field offers the model
889
+ * years the chosen options cover (newest first), or nothing when no option declares years (a free number then).
890
+ */
891
+ declare function subjectOptions(kind: SubjectKind, fieldKey: string, values: SubjectValues): SubjectOption[];
892
+ /**
893
+ * Drops what was chosen and is no longer valid after a change (a new make clears the model; a year the model does not
894
+ * cover is cleared), in field order. Free values are never touched.
895
+ */
896
+ declare function reconcileSubjectValues(kind: SubjectKind, values: SubjectValues): SubjectValues;
897
+ /**
898
+ * Validates and resolves the values the way the server does: unknown field, wrong type, a value missing from the
899
+ * catalog and a year outside the chosen options' years are refused, naming the field only.
900
+ */
901
+ declare function resolveSubject(kind: SubjectKind, values: SubjectValues): {
902
+ ok: true;
903
+ subject: ResolvedSubject;
904
+ } | {
905
+ ok: false;
906
+ problems: SubjectProblems;
907
+ };
908
+ /** The mask the server puts in place of a private value («••34»). */
909
+ declare const PRIVATE_MASK = "\u2022\u2022";
910
+ declare const isMasked: (v: unknown) => boolean;
911
+ /** Prefix of the tag that publishes compatibility (`<prefix><fit_key>`), as in `FitmentConfig.tagPrefix`. */
912
+ declare const DEFAULT_FIT_TAG_PREFIX = "fit:";
913
+ /** The product tag that marks a part as fitting the item with this key. */
914
+ declare const fitTag: (fitKey: string, prefix?: string) => string;
915
+ /**
916
+ * The `tags_any` of a listing "only what fits my item": its own tag plus the universal one (`<prefix>universal`).
917
+ * `[]` when the item has no key (it does not resolve completely): ask for nothing rather than for the wrong thing.
918
+ */
919
+ declare function fitTagsAny(fitKey: string | null | undefined, opts?: {
920
+ prefix?: string;
921
+ universal?: boolean;
922
+ }): string[];
923
+ /**
924
+ * Budget of one catalog page, in bytes of the `tree` prop as OPS stores it (text, so every quote is escaped). Publishing
925
+ * a page is ONE write of at most 64 KiB that carries the draft and the published copy: ~28 KB of tree per page.
926
+ */
927
+ declare const SUBJECT_CATALOG_PAGE_BYTES: number;
928
+ /**
929
+ * Splits a catalog tree by its first level into parts that each fit one page (`subject_catalog` section, prop `tree`).
930
+ * Publish part `i` on its own page and name them all in the kind's `catalog_ref` (`["page:x-1", "page:x-2", …]`); the
931
+ * server joins them back. A real parts catalog (make → model → engine) does not fit in one page. Throws `RangeError`
932
+ * when a single first-level option is larger than the budget on its own (split that level by hand, or trim labels).
933
+ */
934
+ declare function splitSubjectTree(tree: Record<string, SubjectCatalogNode>, maxBytes?: number): Record<string, SubjectCatalogNode>[];
935
+
835
936
  /** Kind of a delivery radio: `ship` (address only, quote later), `rate` (a quoted rate) or `pickup` (a branch). */
836
937
  type DeliveryChoiceKind = 'ship' | 'rate' | 'pickup';
837
938
  type DeliveryChoice = {
@@ -863,4 +964,4 @@ type DeliveryNotices = {
863
964
  /** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
864
965
  declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
865
966
 
866
- export { AccountDeleteInput, 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, CustomerSessionInfo, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DataExportFile, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, FiscalProfile, FiscalProfileInput, 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, ReauthInput, ReauthResult, RecommendationPlacement, Region, RegionPostalCode, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, SHIPPING_STEPS, Shipment, ShipmentEvent, ShipmentStatus, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, 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, 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 };
967
+ export { AccountDeleteInput, 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, CustomerSessionInfo, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DEFAULT_FIT_TAG_PREFIX, DataExportFile, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, FiscalProfile, FiscalProfileInput, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceDoc, InvoiceFile, InvoiceFileKind, type InvoiceGroup, InvoiceRequest, InvoiceResult, Location, LocationListParams, MAX_SUBJECT_YEAR, MIN_SUBJECT_YEAR, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, NextAction, Order, OrderProgress, PAYMENT_CHOICE_REFUSED_FIELD, PICKUP_STEPS, PRIVATE_MASK, 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, ReauthInput, ReauthResult, RecommendationPlacement, Region, RegionPostalCode, type RequestOptions, type ResolveAvailabilityOptions, type ResolvedSubject, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, SHIPPING_STEPS, SUBJECT_CATALOG_PAGE_BYTES, Shipment, ShipmentEvent, ShipmentStatus, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, type StorefrontRequestContext, type StorefrontResponseContext, Subject, SubjectCatalogNode, SubjectField, SubjectInput, SubjectKind, type SubjectOption, SubjectPatch, type SubjectProblemCode, type SubjectProblems, type SubjectValues, Theme, TokenIntrospection, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, classifyPaymentError, coversYear, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, diagnose, fitTag, fitTagsAny, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, groupInvoiceDocs, hreflangLinks, invoiceFileBytes, isMasked, isTestInvoice, isTestShipment, isTokenPublishable, maskToken, negotiateLocale, nextAction, normalizeClientIp, normalizeNote, opsSaysNotRetryable, orderProgress, orderShipments, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, reconcileSubjectValues, repairPath, resolveAvailability, resolveSubject, rewardLabel, safeHttpsUrl, safeInvoiceFilename, safeTrackingUrl, schemaAvailability, shipmentsStatus, sortTrackingEvents, splitSubjectTree, storefrontDomainHeader, subjectFields, subjectLevels, subjectOptions, suggestMarket, toMoney, visitorCountry };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b4 as ProductSort, bH as TokenIntrospection, bx as Shop, be as Region, bi as RegionPostalCode, b2 as ProductConnection, a$ as Product, z as Connection, y as Collection, an as LocationListParams, ak as Location, at as NearestLocation, bB as StockLevel, bj as RestockSubscriptionInput, bk as RestockSubscriptionResult, n as CartLineInput, C as Cart, q as CartLineUpdateInput, g as CartBuyerInput, b as AddressInput, U as DeliveryOptions, aR as PaymentMethods, S as DeliveryInput, af as InvoiceRequest, bc as RecommendationPlacement, t as CartRecommendations, v as CheckoutInput, x as CheckoutResult, b9 as PromotionsList, aN as PaymentConfig, aW as PaymentSubmitInput, aJ as PaymentAttemptResult, E as CustomerIdentifier, M as CustomerSessionInput, K as CustomerSession, D as CustomerCapabilities, H as CustomerRegisterInput, I as CustomerRegisterResult, P as CustomerVerifyRegistrationInput, F as CustomerPasswordLoginInput, N as CustomerSetPasswordInput, J as CustomerResetPasswordInput, B as Customer, O as CustomerUpdateInput, L as CustomerSessionInfo, ba as ReauthInput, bb as ReauthResult, Q as DataExportFile, A as AccountDeleteInput, aw as Order, bm as ReturnRequestInput, bl as ReturnRequest, ag as InvoiceResult, aY as PendingPayment, ae as InvoiceFileKind, ad as InvoiceFile, $ as FiscalProfile, a0 as FiscalProfileInput, a as Address, bG as Theme, aG as Page, ap as Menu, c as Article, ar as Money, e as AvailabilityStatus, p as CartLineProblem, d as Availability, aa as InsufficientStockLine, b5 as ProductVariant, R as DeclineCode, aX as PaymentVoucher, aS as PaymentNextStep, r as CartPromotions, b7 as PromotionReward, ac as InvoiceDoc, bq as Shipment, au as NextAction, aA as OrderProgress, bu as ShipmentStatus, br as ShipmentEvent, T as DeliveryMethod, bI as UnavailableRateProvider } from './account-settings-DNcJKOQl.js';
2
- export { f as CartBuyer, h as CartCost, i as CartDelivery, j as CartDiscountCode, k as CartDiscountLine, l as CartInvoice, m as CartLine, o as CartLineMerchandise, s as CartRecommendation, u as CheckoutInfo, w as CheckoutPayment, G as CustomerPreferences, V as Facet, W as FacetValue, X as FiscalDocumentEvidence, Y as FiscalDocumentSource, Z as FiscalIdentity, _ as FiscalIdentityInput, a1 as FiscalVerification, a2 as GeoHint, a3 as IdentityCapture, a4 as IdentityDocumentSpec, a5 as IdentityFieldRule, a6 as IdentityRulesV1, a7 as IdentityStrategy, a8 as Image, a9 as InsufficientStockDetails, ab as InvoiceAction, ah as InvoiceStage, ai as InvoiceSummary, aj as InvoicingCapabilities, al as LocationContacts, am as LocationKind, ao as LocationPickup, aq as MenuItem, as as MoneyRange, av as NextActionKind, ax as OrderLine, ay as OrderPickup, az as OrderProblem, aB as OrderProgressStep, aC as OrderSection, aD as OrderStage, aE as OrderStepKey, aF as OrderStepState, aH as PageInfo, aI as PaymentAction, aK as PaymentAttemptStatus, aL as PaymentClient, aM as PaymentClientCsp, aO as PaymentFlow, aP as PaymentInfo, aQ as PaymentMethod, aT as PaymentOption, aU as PaymentOptionKey, aV as PaymentPoint, aZ as PendingPaymentVoucher, a_ as PickupOption, b0 as ProductAttributeValue, b1 as ProductCategory, b3 as ProductOption, b6 as PromotionAnnouncement, b8 as PromotionTier, bd as Refund, bf as RegionFiscalEntry, bg as RegionFiscalId, bh as RegionPaymentMethod, bn as SEO, bo as Section, bp as SelectedOption, bs as ShipmentKind, bt as ShipmentMap, bv as ShipmentsSummary, bw as ShippingRate, by as ShopBranch, bz as ShopContact, bA as ShopPolicies, bC as StorefrontError, bD as StorefrontErrorBody, bE as StorefrontErrorCode, bF as StorefrontErrorInit, bJ as dataExportBytes, bK as isAccountDeleteBlocked, bL as isReauthRequired, bM as isStorefrontError, bN as safeExportFilename } from './account-settings-DNcJKOQl.js';
1
+ import { b4 as ProductSort, bQ as TokenIntrospection, bx as Shop, be as Region, bi as RegionPostalCode, b2 as ProductConnection, a$ as Product, z as Connection, y as Collection, an as LocationListParams, ak as Location, at as NearestLocation, bB as StockLevel, bj as RestockSubscriptionInput, bk as RestockSubscriptionResult, n as CartLineInput, C as Cart, q as CartLineUpdateInput, g as CartBuyerInput, b as AddressInput, U as DeliveryOptions, aR as PaymentMethods, S as DeliveryInput, af as InvoiceRequest, bc as RecommendationPlacement, t as CartRecommendations, v as CheckoutInput, x as CheckoutResult, b9 as PromotionsList, aN as PaymentConfig, aW as PaymentSubmitInput, aJ as PaymentAttemptResult, E as CustomerIdentifier, M as CustomerSessionInput, K as CustomerSession, D as CustomerCapabilities, H as CustomerRegisterInput, I as CustomerRegisterResult, P as CustomerVerifyRegistrationInput, F as CustomerPasswordLoginInput, N as CustomerSetPasswordInput, J as CustomerResetPasswordInput, B as Customer, O as CustomerUpdateInput, L as CustomerSessionInfo, ba as ReauthInput, bb as ReauthResult, Q as DataExportFile, A as AccountDeleteInput, aw as Order, bm as ReturnRequestInput, bl as ReturnRequest, ag as InvoiceResult, aY as PendingPayment, ae as InvoiceFileKind, ad as InvoiceFile, $ as FiscalProfile, a0 as FiscalProfileInput, bG as Subject, bL as SubjectInput, bN as SubjectPatch, a as Address, bM as SubjectKind, bP as Theme, aG as Page, ap as Menu, c as Article, ar as Money, e as AvailabilityStatus, p as CartLineProblem, d as Availability, aa as InsufficientStockLine, b5 as ProductVariant, R as DeclineCode, aX as PaymentVoucher, aS as PaymentNextStep, r as CartPromotions, b7 as PromotionReward, ac as InvoiceDoc, bq as Shipment, au as NextAction, aA as OrderProgress, bu as ShipmentStatus, br as ShipmentEvent, bI as SubjectCatalogNode, bJ as SubjectField, T as DeliveryMethod, bR as UnavailableRateProvider } from './account-settings-Cw3PamUA.js';
2
+ export { f as CartBuyer, h as CartCost, i as CartDelivery, j as CartDiscountCode, k as CartDiscountLine, l as CartInvoice, m as CartLine, o as CartLineMerchandise, s as CartRecommendation, u as CheckoutInfo, w as CheckoutPayment, G as CustomerPreferences, V as Facet, W as FacetValue, X as FiscalDocumentEvidence, Y as FiscalDocumentSource, Z as FiscalIdentity, _ as FiscalIdentityInput, a1 as FiscalVerification, a2 as GeoHint, a3 as IdentityCapture, a4 as IdentityDocumentSpec, a5 as IdentityFieldRule, a6 as IdentityRulesV1, a7 as IdentityStrategy, a8 as Image, a9 as InsufficientStockDetails, ab as InvoiceAction, ah as InvoiceStage, ai as InvoiceSummary, aj as InvoicingCapabilities, al as LocationContacts, am as LocationKind, ao as LocationPickup, aq as MenuItem, as as MoneyRange, av as NextActionKind, ax as OrderLine, ay as OrderPickup, az as OrderProblem, aB as OrderProgressStep, aC as OrderSection, aD as OrderStage, aE as OrderStepKey, aF as OrderStepState, aH as PageInfo, aI as PaymentAction, aK as PaymentAttemptStatus, aL as PaymentClient, aM as PaymentClientCsp, aO as PaymentFlow, aP as PaymentInfo, aQ as PaymentMethod, aT as PaymentOption, aU as PaymentOptionKey, aV as PaymentPoint, aZ as PendingPaymentVoucher, a_ as PickupOption, b0 as ProductAttributeValue, b1 as ProductCategory, b3 as ProductOption, b6 as PromotionAnnouncement, b8 as PromotionTier, bd as Refund, bf as RegionFiscalEntry, bg as RegionFiscalId, bh as RegionPaymentMethod, bn as SEO, bo as Section, bp as SelectedOption, bs as ShipmentKind, bt as ShipmentMap, bv as ShipmentsSummary, bw as ShippingRate, by as ShopBranch, bz as ShopContact, bA as ShopPolicies, bC as StorefrontError, bD as StorefrontErrorBody, bE as StorefrontErrorCode, bF as StorefrontErrorInit, bH as SubjectCatalog, bK as SubjectFieldType, bO as SubjectRef, bS as dataExportBytes, bT as isAccountDeleteBlocked, bU as isReauthRequired, bV as isStorefrontError, bW as safeExportFilename } from './account-settings-Cw3PamUA.js';
3
3
  import { GeoPoint } from './geo.js';
4
4
  export { OpenStatus, OpeningHours } from './geo.js';
5
5
 
@@ -29,6 +29,11 @@ type ProductListParams = PaginationParams & {
29
29
  filters?: Record<string, QueryValue | QueryValue[]>;
30
30
  /** Restrict to these handles (max 100). Serialized comma-separated. */
31
31
  handles?: string[];
32
+ /**
33
+ * Only products carrying at least one of these tags (OR, at most 5 of 120 characters; contract 1.9). Serialized
34
+ * comma-separated. A parts store passes `fitTagsAny(fitKey)` (`fit:<key>`, `fit:universal`); any tag works.
35
+ */
36
+ tags_any?: string[];
32
37
  };
33
38
  type CollectionListParams = PaginationParams;
34
39
  type ArticleListParams = Omit<PaginationParams, 'first'> & {
@@ -383,6 +388,21 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
383
388
  /** Physical delete (a profile leaves nothing behind). A saved default passes to another profile. */
384
389
  delete: (id: string, options?: WriteOptions) => Promise<void>;
385
390
  };
391
+ /**
392
+ * Saved items of the buyer («My items», «My garage»; contract 1.9, `capabilities().subjects`). Personal data:
393
+ * private, never cached, never logged. `422` with `field: 'attributes.<field>'` when the kind refuses a value
394
+ * (it never echoes it); `409` for an item already saved or past the limit; `429` for too many saves; `404` for
395
+ * an item that is not the buyer's. The server builds `label` and `fit_key`; private fields come back masked.
396
+ */
397
+ subjects: {
398
+ list: (params?: {
399
+ kind?: string;
400
+ }, options?: RequestOptions) => Promise<Subject[]>;
401
+ create: (input: SubjectInput, options?: WriteOptions) => Promise<Subject>;
402
+ update: (id: string, patch: SubjectPatch, options?: WriteOptions) => Promise<Subject>;
403
+ /** Physical delete (the item leaves nothing behind). The default of its kind passes to another item. */
404
+ delete: (id: string, options?: WriteOptions) => Promise<void>;
405
+ };
386
406
  addresses: {
387
407
  list: (options?: RequestOptions) => Promise<{
388
408
  nodes: Address[];
@@ -393,6 +413,11 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
393
413
  };
394
414
  };
395
415
  content: {
416
+ /**
417
+ * The kinds of buyer item the organization declares («My garage») and their catalogs (contract 1.9; public,
418
+ * cacheable). `[]` when it declares none or the server predates the route: the store has no such section.
419
+ */
420
+ subjectKinds: (options?: RequestOptions) => Promise<SubjectKind[]>;
396
421
  theme: (options?: RequestOptions) => Promise<Theme>;
397
422
  /** `null` when the page does not exist. */
398
423
  page: (handle: string, options?: PreviewOptions) => Promise<Page | null>;
@@ -832,6 +857,82 @@ declare function invoiceFileBytes(file: Pick<InvoiceFile, 'content_base64'>): Ui
832
857
  /** A download filename that is safe in a `Content-Disposition` header: no path, quotes, control characters or spaces. */
833
858
  declare function safeInvoiceFilename(name: unknown, fallback?: string): string;
834
859
 
860
+ declare const MIN_SUBJECT_YEAR = 1900;
861
+ declare const MAX_SUBJECT_YEAR = 2100;
862
+ type SubjectOption = {
863
+ value: string;
864
+ label: string;
865
+ };
866
+ type SubjectValues = Record<string, string | number | null | undefined>;
867
+ /** Why a value was refused (the server answers `422` with the field `attributes.<key>` and never the value). */
868
+ type SubjectProblemCode = 'required' | 'unknown' | 'invalid' | 'not_in_catalog' | 'year_range' | 'catalog_unavailable';
869
+ type SubjectProblems = Record<string, SubjectProblemCode>;
870
+ type ResolvedSubject = {
871
+ /** Built from the labels of the catalog and the public values, in field order. */
872
+ label: string;
873
+ /** `''` when a placeholder of the template has no value (the item then never matches a product). */
874
+ fit_key: string;
875
+ /** Public values, as the server stores them in `attributes`. */
876
+ attributes: Record<string, string | number>;
877
+ /** Private values: never in the label, the key or a tag. */
878
+ private: Record<string, string>;
879
+ };
880
+ /** Does the option cover the model year? Declared `ranges` win; else `from`/`to`; an option with none covers any year. */
881
+ declare function coversYear(node: Pick<SubjectCatalogNode, 'from' | 'to' | 'ranges'>, year: number): boolean;
882
+ /** The catalog fields that make the tree's levels, in order: `source: catalog` and not a year. */
883
+ declare function subjectLevels(kind: Pick<SubjectKind, 'fields'>): SubjectField[];
884
+ /** The visible fields of a form: everything the buyer fills in, in the order of the kind. */
885
+ declare function subjectFields(kind: Pick<SubjectKind, 'fields'>): SubjectField[];
886
+ /**
887
+ * The options a catalog field offers given what is already chosen (a cascade: a level shows nothing until the previous
888
+ * one is chosen). A level narrows by the chosen year when the option declares years; a year field offers the model
889
+ * years the chosen options cover (newest first), or nothing when no option declares years (a free number then).
890
+ */
891
+ declare function subjectOptions(kind: SubjectKind, fieldKey: string, values: SubjectValues): SubjectOption[];
892
+ /**
893
+ * Drops what was chosen and is no longer valid after a change (a new make clears the model; a year the model does not
894
+ * cover is cleared), in field order. Free values are never touched.
895
+ */
896
+ declare function reconcileSubjectValues(kind: SubjectKind, values: SubjectValues): SubjectValues;
897
+ /**
898
+ * Validates and resolves the values the way the server does: unknown field, wrong type, a value missing from the
899
+ * catalog and a year outside the chosen options' years are refused, naming the field only.
900
+ */
901
+ declare function resolveSubject(kind: SubjectKind, values: SubjectValues): {
902
+ ok: true;
903
+ subject: ResolvedSubject;
904
+ } | {
905
+ ok: false;
906
+ problems: SubjectProblems;
907
+ };
908
+ /** The mask the server puts in place of a private value («••34»). */
909
+ declare const PRIVATE_MASK = "\u2022\u2022";
910
+ declare const isMasked: (v: unknown) => boolean;
911
+ /** Prefix of the tag that publishes compatibility (`<prefix><fit_key>`), as in `FitmentConfig.tagPrefix`. */
912
+ declare const DEFAULT_FIT_TAG_PREFIX = "fit:";
913
+ /** The product tag that marks a part as fitting the item with this key. */
914
+ declare const fitTag: (fitKey: string, prefix?: string) => string;
915
+ /**
916
+ * The `tags_any` of a listing "only what fits my item": its own tag plus the universal one (`<prefix>universal`).
917
+ * `[]` when the item has no key (it does not resolve completely): ask for nothing rather than for the wrong thing.
918
+ */
919
+ declare function fitTagsAny(fitKey: string | null | undefined, opts?: {
920
+ prefix?: string;
921
+ universal?: boolean;
922
+ }): string[];
923
+ /**
924
+ * Budget of one catalog page, in bytes of the `tree` prop as OPS stores it (text, so every quote is escaped). Publishing
925
+ * a page is ONE write of at most 64 KiB that carries the draft and the published copy: ~28 KB of tree per page.
926
+ */
927
+ declare const SUBJECT_CATALOG_PAGE_BYTES: number;
928
+ /**
929
+ * Splits a catalog tree by its first level into parts that each fit one page (`subject_catalog` section, prop `tree`).
930
+ * Publish part `i` on its own page and name them all in the kind's `catalog_ref` (`["page:x-1", "page:x-2", …]`); the
931
+ * server joins them back. A real parts catalog (make → model → engine) does not fit in one page. Throws `RangeError`
932
+ * when a single first-level option is larger than the budget on its own (split that level by hand, or trim labels).
933
+ */
934
+ declare function splitSubjectTree(tree: Record<string, SubjectCatalogNode>, maxBytes?: number): Record<string, SubjectCatalogNode>[];
935
+
835
936
  /** Kind of a delivery radio: `ship` (address only, quote later), `rate` (a quoted rate) or `pickup` (a branch). */
836
937
  type DeliveryChoiceKind = 'ship' | 'rate' | 'pickup';
837
938
  type DeliveryChoice = {
@@ -863,4 +964,4 @@ type DeliveryNotices = {
863
964
  /** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
864
965
  declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
865
966
 
866
- export { AccountDeleteInput, 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, CustomerSessionInfo, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DataExportFile, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, FiscalProfile, FiscalProfileInput, 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, ReauthInput, ReauthResult, RecommendationPlacement, Region, RegionPostalCode, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, SHIPPING_STEPS, Shipment, ShipmentEvent, ShipmentStatus, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, 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, 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 };
967
+ export { AccountDeleteInput, 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, CustomerSessionInfo, CustomerSessionInput, CustomerSetPasswordInput, CustomerUpdateInput, CustomerVerifyRegistrationInput, DEFAULT_FIT_TAG_PREFIX, DataExportFile, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiagnoseOptions, type DiscountBarState, type DiscountBarView, type FetchLike, FiscalProfile, FiscalProfileInput, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceDoc, InvoiceFile, InvoiceFileKind, type InvoiceGroup, InvoiceRequest, InvoiceResult, Location, LocationListParams, MAX_SUBJECT_YEAR, MIN_SUBJECT_YEAR, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, NextAction, Order, OrderProgress, PAYMENT_CHOICE_REFUSED_FIELD, PICKUP_STEPS, PRIVATE_MASK, 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, ReauthInput, ReauthResult, RecommendationPlacement, Region, RegionPostalCode, type RequestOptions, type ResolveAvailabilityOptions, type ResolvedSubject, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, SHIPPING_STEPS, SUBJECT_CATALOG_PAGE_BYTES, Shipment, ShipmentEvent, ShipmentStatus, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, type StorefrontRequestContext, type StorefrontResponseContext, Subject, SubjectCatalogNode, SubjectField, SubjectInput, SubjectKind, type SubjectOption, SubjectPatch, type SubjectProblemCode, type SubjectProblems, type SubjectValues, Theme, TokenIntrospection, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, classifyPaymentError, coversYear, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, diagnose, fitTag, fitTagsAny, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, groupInvoiceDocs, hreflangLinks, invoiceFileBytes, isMasked, isTestInvoice, isTestShipment, isTokenPublishable, maskToken, negotiateLocale, nextAction, normalizeClientIp, normalizeNote, opsSaysNotRetryable, orderProgress, orderShipments, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, reconcileSubjectValues, repairPath, resolveAvailability, resolveSubject, rewardLabel, safeHttpsUrl, safeInvoiceFilename, safeTrackingUrl, schemaAvailability, shipmentsStatus, sortTrackingEvents, splitSubjectTree, storefrontDomainHeader, subjectFields, subjectLevels, subjectOptions, suggestMarket, toMoney, visitorCountry };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { isStorefrontError, availabilityLocale, StorefrontError, formatAvailabilityMessage, defaultCodeForStatus } from './chunk-IPUAZ3LQ.js';
2
- export { PICKUP_STEPS, SHIPPING_STEPS, StorefrontError, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, declineMessage, declineMessageKey, formatAvailabilityMessage, formatVoucherExpiry, isStorefrontError, isTestInvoice, isTestShipment, nextAction, orderProgress, orderShipments, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, productAvailability, resolveAvailability, safeHttpsUrl, safeTrackingUrl, schemaAvailability, shipmentsStatus, sortTrackingEvents } from './chunk-IPUAZ3LQ.js';
1
+ import { isStorefrontError, availabilityLocale, StorefrontError, formatAvailabilityMessage, defaultCodeForStatus } from './chunk-5BJRZIS3.js';
2
+ export { DEFAULT_FIT_TAG_PREFIX, MAX_SUBJECT_YEAR, MIN_SUBJECT_YEAR, PICKUP_STEPS, PRIVATE_MASK, SHIPPING_STEPS, SUBJECT_CATALOG_PAGE_BYTES, StorefrontError, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, coversYear, declineMessage, declineMessageKey, fitTag, fitTagsAny, formatAvailabilityMessage, formatVoucherExpiry, isMasked, isStorefrontError, isTestInvoice, isTestShipment, nextAction, orderProgress, orderShipments, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, productAvailability, reconcileSubjectValues, resolveAvailability, resolveSubject, safeHttpsUrl, safeTrackingUrl, schemaAvailability, shipmentsStatus, sortTrackingEvents, splitSubjectTree, subjectFields, subjectLevels, subjectOptions } from './chunk-5BJRZIS3.js';
3
3
  import { isValidPoint } from './chunk-45R47HYO.js';
4
4
 
5
5
  // src/money.ts
@@ -48,9 +48,14 @@ function appendParams(search, params) {
48
48
  return search;
49
49
  }
50
50
  function productListQuery(params = {}) {
51
- const { filters, handles, ...rest } = params;
51
+ const { filters, handles, tags_any, ...rest } = params;
52
52
  const search = appendParams(new URLSearchParams(), rest);
53
53
  if (handles && handles.length > 0) search.set("handles", handles.join(","));
54
+ if (tags_any && tags_any.length > 0) {
55
+ if (tags_any.length > 5) throw new RangeError("tags_any takes at most 5 tags");
56
+ if (tags_any.some((t) => t.includes(",") || t.length > 120)) throw new TypeError("tags_any: a tag has at most 120 characters and no comma");
57
+ search.set("tags_any", tags_any.join(","));
58
+ }
54
59
  if (filters) {
55
60
  for (const [key, raw] of Object.entries(filters)) {
56
61
  const name = key.startsWith("filter.") ? key : `filter.${key}`;
@@ -497,6 +502,19 @@ function createStorefrontClient(config) {
497
502
  /** Physical delete (a profile leaves nothing behind). A saved default passes to another profile. */
498
503
  delete: (id, options) => write("DELETE", `/storefront/customer/fiscal-profiles/${enc(id)}`, void 0, options)
499
504
  },
505
+ /**
506
+ * Saved items of the buyer («My items», «My garage»; contract 1.9, `capabilities().subjects`). Personal data:
507
+ * private, never cached, never logged. `422` with `field: 'attributes.<field>'` when the kind refuses a value
508
+ * (it never echoes it); `409` for an item already saved or past the limit; `429` for too many saves; `404` for
509
+ * an item that is not the buyer's. The server builds `label` and `fit_key`; private fields come back masked.
510
+ */
511
+ subjects: {
512
+ list: async (params, options) => (await get("/storefront/customer/subjects", params, { ...options, cache: "no-store" })).nodes,
513
+ create: (input, options) => write("POST", "/storefront/customer/subjects", input, options),
514
+ update: (id, patch, options) => write("PATCH", `/storefront/customer/subjects/${enc(id)}`, patch, options),
515
+ /** Physical delete (the item leaves nothing behind). The default of its kind passes to another item. */
516
+ delete: (id, options) => write("DELETE", `/storefront/customer/subjects/${enc(id)}`, void 0, options)
517
+ },
500
518
  addresses: {
501
519
  list: (options) => get("/storefront/customer/addresses", void 0, options),
502
520
  create: (address, options) => write("POST", "/storefront/customer/addresses", address, options),
@@ -505,6 +523,11 @@ function createStorefrontClient(config) {
505
523
  }
506
524
  },
507
525
  content: {
526
+ /**
527
+ * The kinds of buyer item the organization declares («My garage») and their catalogs (contract 1.9; public,
528
+ * cacheable). `[]` when it declares none or the server predates the route: the store has no such section.
529
+ */
530
+ subjectKinds: async (options) => (await getOrNull("/storefront/subject-kinds", void 0, options))?.nodes ?? [],
508
531
  theme: (options) => get("/storefront/content/theme", void 0, options),
509
532
  /** `null` when the page does not exist. */
510
533
  page: (handle, options) => getOrNull(`/storefront/content/pages/${enc(handle)}`, previewQuery(options), options),