@asteby/storefront 0.22.1 → 0.24.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 { ba as ProductSort, bW as TokenIntrospection, bD as Shop, bk as Region, bo as RegionPostalCode, b8 as ProductConnection, b5 as Product, z as Connection, y as Collection, as as LocationListParams, ap as Location, ay as NearestLocation, bH as StockLevel, bp as RestockSubscriptionInput, bq as RestockSubscriptionResult, n as CartLineInput, C as Cart, q as CartLineUpdateInput, g as CartBuyerInput, b as AddressInput, Y as DeliveryOptions, aX as PaymentMethods, W as DeliveryInput, ak as InvoiceRequest, bi as RecommendationPlacement, t as CartRecommendations, v as CheckoutInput, x as CheckoutResult, bf as PromotionsList, aT as PaymentConfig, b0 as PaymentSubmitInput, aP as PaymentAttemptResult, I as CustomerIdentifier, Q as CustomerSessionInput, O as CustomerSession, D as CustomerCapabilities, L as CustomerRegisterInput, M as CustomerRegisterResult, T as CustomerVerifyRegistrationInput, J as CustomerPasswordLoginInput, R as CustomerSetPasswordInput, N as CustomerResetPasswordInput, B as Customer, S as CustomerUpdateInput, P as CustomerSessionInfo, bg as ReauthInput, bh as ReauthResult, H as CustomerEmailCodeInput, F as CustomerEmailChangeInput, G as CustomerEmailChangeRequested, E as CustomerEmailChangeConfirmInput, U as DataExportFile, A as AccountDeleteInput, aB as Order, bs as ReturnRequestInput, br as ReturnRequest, al as InvoiceResult, b2 as PendingPayment, ai as InvoiceFileKind, ah as InvoiceFile, a3 as FiscalProfile, a4 as FiscalProfileInput, bM as Subject, bR as SubjectInput, bT as SubjectPatch, a as Address, bS as SubjectKind, bV as Theme, aM as Page, au as Menu, c as Article, aw as Money, e as AvailabilityStatus, p as CartLineProblem, d as Availability, ae as InsufficientStockLine, bb as ProductVariant, V as DeclineCode, b1 as PaymentVoucher, aY as PaymentNextStep, r as CartPromotions, bd as PromotionReward, ag as InvoiceDoc, bw as Shipment, az as NextAction, aF as OrderProgress, bA as ShipmentStatus, bx as ShipmentEvent, bO as SubjectCatalogNode, bP as SubjectField, X as DeliveryMethod, bX as UnavailableRateProvider } from './account-settings-DZGcveuu.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, K as CustomerPreferences, Z as Facet, _ as FacetValue, $ as FiscalDocumentEvidence, a0 as FiscalDocumentSource, a1 as FiscalIdentity, a2 as FiscalIdentityInput, a5 as FiscalVerification, a6 as GeoHint, a7 as IdentityCapture, a8 as IdentityDocumentSpec, a9 as IdentityFieldRule, aa as IdentityRulesV1, ab as IdentityStrategy, ac as Image, ad as InsufficientStockDetails, af as InvoiceAction, aj as InvoiceReceiver, am as InvoiceStage, an as InvoiceSummary, ao as InvoicingCapabilities, aq as LocationContacts, ar as LocationKind, at as LocationPickup, av as MenuItem, ax as MoneyRange, aA as NextActionKind, aC as OrderLine, aD as OrderPickup, aE as OrderProblem, aG as OrderProgressStep, aH as OrderSection, aI as OrderShippingService, aJ as OrderStage, aK as OrderStepKey, aL as OrderStepState, aN as PageInfo, aO as PaymentAction, aQ as PaymentAttemptStatus, aR as PaymentClient, aS as PaymentClientCsp, aU as PaymentFlow, aV as PaymentInfo, aW as PaymentMethod, aZ as PaymentOption, a_ as PaymentOptionKey, a$ as PaymentPoint, b3 as PendingPaymentVoucher, b4 as PickupOption, b6 as ProductAttributeValue, b7 as ProductCategory, b9 as ProductOption, bc as PromotionAnnouncement, be as PromotionTier, bj as Refund, bl as RegionFiscalEntry, bm as RegionFiscalId, bn as RegionPaymentMethod, bt as SEO, bu as Section, bv as SelectedOption, by as ShipmentKind, bz as ShipmentMap, bB as ShipmentsSummary, bC as ShippingRate, bE as ShopBranch, bF as ShopContact, bG as ShopPolicies, bI as StorefrontError, bJ as StorefrontErrorBody, bK as StorefrontErrorCode, bL as StorefrontErrorInit, bN as SubjectCatalog, bQ as SubjectFieldType, bU as SubjectRef, bY as dataExportBytes, bZ as isAccountDeleteBlocked, b_ as isReauthRequired, b$ as isStorefrontError, c0 as safeExportFilename } from './account-settings-DZGcveuu.cjs';
1
+ import { bc as ProductSort, bY as TokenIntrospection, bF as Shop, bm as Region, bq as RegionPostalCode, d as AddressSuggestions, ba as ProductConnection, b7 as Product, D as Connection, B as Collection, au as LocationListParams, ar as Location, aA as NearestLocation, bJ as StockLevel, br as RestockSubscriptionInput, bs as RestockSubscriptionResult, p as CartLineInput, C as Cart, s as CartLineUpdateInput, i as CartBuyerInput, b as AddressInput, _ as DeliveryOptions, aZ as PaymentMethods, Y as DeliveryInput, am as InvoiceRequest, bk as RecommendationPlacement, v as CartRecommendations, x as CheckoutInput, z as CheckoutResult, bh as PromotionsList, aV as PaymentConfig, b2 as PaymentSubmitInput, aR as PaymentAttemptResult, K as CustomerIdentifier, S as CustomerSessionInput, Q as CustomerSession, F as CustomerCapabilities, N as CustomerRegisterInput, O as CustomerRegisterResult, V as CustomerVerifyRegistrationInput, L as CustomerPasswordLoginInput, T as CustomerSetPasswordInput, P as CustomerResetPasswordInput, E as Customer, U as CustomerUpdateInput, R as CustomerSessionInfo, bi as ReauthInput, bj as ReauthResult, J as CustomerEmailCodeInput, H as CustomerEmailChangeInput, I as CustomerEmailChangeRequested, G as CustomerEmailChangeConfirmInput, W as DataExportFile, A as AccountDeleteInput, aD as Order, bu as ReturnRequestInput, bt as ReturnRequest, an as InvoiceResult, b4 as PendingPayment, ak as InvoiceFileKind, aj as InvoiceFile, a5 as FiscalProfile, a6 as FiscalProfileInput, bO as Subject, bT as SubjectInput, bV as SubjectPatch, a as Address, bU as SubjectKind, bX as Theme, aO as Page, aw as Menu, e as Article, ay as Money, g as AvailabilityStatus, r as CartLineProblem, f as Availability, ag as InsufficientStockLine, bd as ProductVariant, X as DeclineCode, b3 as PaymentVoucher, a_ as PaymentNextStep, t as CartPromotions, bf as PromotionReward, ai as InvoiceDoc, by as Shipment, aB as NextAction, aH as OrderProgress, bC as ShipmentStatus, bz as ShipmentEvent, bQ as SubjectCatalogNode, bR as SubjectField, Z as DeliveryMethod, bZ as UnavailableRateProvider } from './account-settings-BZKux56f.cjs';
2
+ export { c as AddressSuggestion, h as CartBuyer, j as CartCost, k as CartDelivery, l as CartDiscountCode, m as CartDiscountLine, n as CartInvoice, o as CartLine, q as CartLineMerchandise, u as CartRecommendation, w as CheckoutInfo, y as CheckoutPayment, M as CustomerPreferences, $ as Facet, a0 as FacetValue, a1 as FiscalDocumentEvidence, a2 as FiscalDocumentSource, a3 as FiscalIdentity, a4 as FiscalIdentityInput, a7 as FiscalVerification, a8 as GeoHint, a9 as IdentityCapture, aa as IdentityDocumentSpec, ab as IdentityFieldRule, ac as IdentityRulesV1, ad as IdentityStrategy, ae as Image, af as InsufficientStockDetails, ah as InvoiceAction, al as InvoiceReceiver, ao as InvoiceStage, ap as InvoiceSummary, aq as InvoicingCapabilities, as as LocationContacts, at as LocationKind, av as LocationPickup, ax as MenuItem, az as MoneyRange, aC as NextActionKind, aE as OrderLine, aF as OrderPickup, aG as OrderProblem, aI as OrderProgressStep, aJ as OrderSection, aK as OrderShippingService, aL as OrderStage, aM as OrderStepKey, aN as OrderStepState, aP as PageInfo, aQ as PaymentAction, aS as PaymentAttemptStatus, aT as PaymentClient, aU as PaymentClientCsp, aW as PaymentFlow, aX as PaymentInfo, aY as PaymentMethod, a$ as PaymentOption, b0 as PaymentOptionKey, b1 as PaymentPoint, b5 as PendingPaymentVoucher, b6 as PickupOption, b8 as ProductAttributeValue, b9 as ProductCategory, bb as ProductOption, be as PromotionAnnouncement, bg as PromotionTier, bl as Refund, bn as RegionFiscalEntry, bo as RegionFiscalId, bp as RegionPaymentMethod, bv as SEO, bw as Section, bx as SelectedOption, bA as ShipmentKind, bB as ShipmentMap, bD as ShipmentsSummary, bE as ShippingRate, bG as ShopBranch, bH as ShopContact, bI as ShopPolicies, bK as StorefrontError, bL as StorefrontErrorBody, bM as StorefrontErrorCode, bN as StorefrontErrorInit, bP as SubjectCatalog, bS as SubjectFieldType, bW as SubjectRef, b_ as dataExportBytes, b$ as isAccountDeleteBlocked, c0 as isReauthRequired, c1 as isStorefrontError, c2 as safeExportFilename } from './account-settings-BZKux56f.cjs';
3
3
  import { GeoPoint } from './geo.cjs';
4
4
  export { OpenStatus, OpeningHours } from './geo.cjs';
5
5
 
@@ -119,6 +119,22 @@ type StorefrontClientOptions = {
119
119
  onResponse?: (ctx: StorefrontResponseContext) => void | Promise<void>;
120
120
  };
121
121
  /** Per-call options. Unknown keys (e.g. Next.js `next`) are forwarded to `fetch` as-is. */
122
+ /** Query of `client.addressSuggest`. */
123
+ type AddressSuggestParams = {
124
+ /** What the shopper typed so far (at least 3 characters). */
125
+ q: string;
126
+ /** ISO 3166-1 alpha-2 of the address: candidates of another country are dropped. */
127
+ country?: string;
128
+ /** Postal code already chosen: candidates of another code or state are dropped. */
129
+ zip?: string;
130
+ /** 1 to 8 (server default 5). */
131
+ limit?: number;
132
+ /** Bias point (with `lng`): ranks nearby first, never filters. */
133
+ lat?: number;
134
+ lng?: number;
135
+ /** Language of the labels (`es`, `en`). Default: `Accept-Language`. */
136
+ locale?: string;
137
+ };
122
138
  type RequestOptions = {
123
139
  cache?: RequestCache;
124
140
  signal?: AbortSignal;
@@ -202,6 +218,14 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
202
218
  * the server checks the address against.
203
219
  */
204
220
  postalCode: (zip: string, options?: RequestOptions) => Promise<RegionPostalCode | null>;
221
+ /**
222
+ * Street and number suggestions for the address form (`GET /storefront/address/suggest`), from the geocoding
223
+ * provider the market is assigned (a self-hosted Photon, ...). The server drops candidates of another country, postal
224
+ * code or state than the catalog's, and answers `{ suggestions: [], available: false }` when there is no provider:
225
+ * it never fails because of one. `q` needs at least 3 characters (the call rejects shorter ones without a request).
226
+ * Browser forms call it through `AddressFields.suggestAddress`; do not call it per keystroke without a debounce.
227
+ */
228
+ addressSuggest: (params: AddressSuggestParams, options?: RequestOptions) => Promise<AddressSuggestions>;
205
229
  products: {
206
230
  list: (params?: ProductListParams, options?: RequestOptions) => Promise<ProductConnection>;
207
231
  /** `null` when the product does not exist or is unpublished. */
@@ -989,4 +1013,4 @@ type DeliveryNotices = {
989
1013
  /** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
990
1014
  declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
991
1015
 
992
- 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, CustomerEmailChangeConfirmInput, CustomerEmailChangeInput, CustomerEmailChangeRequested, CustomerEmailCodeInput, 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 };
1016
+ export { AccountDeleteInput, Address, AddressInput, type AddressSuggestParams, AddressSuggestions, 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, CustomerEmailChangeConfirmInput, CustomerEmailChangeInput, CustomerEmailChangeRequested, CustomerEmailCodeInput, 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 { ba as ProductSort, bW as TokenIntrospection, bD as Shop, bk as Region, bo as RegionPostalCode, b8 as ProductConnection, b5 as Product, z as Connection, y as Collection, as as LocationListParams, ap as Location, ay as NearestLocation, bH as StockLevel, bp as RestockSubscriptionInput, bq as RestockSubscriptionResult, n as CartLineInput, C as Cart, q as CartLineUpdateInput, g as CartBuyerInput, b as AddressInput, Y as DeliveryOptions, aX as PaymentMethods, W as DeliveryInput, ak as InvoiceRequest, bi as RecommendationPlacement, t as CartRecommendations, v as CheckoutInput, x as CheckoutResult, bf as PromotionsList, aT as PaymentConfig, b0 as PaymentSubmitInput, aP as PaymentAttemptResult, I as CustomerIdentifier, Q as CustomerSessionInput, O as CustomerSession, D as CustomerCapabilities, L as CustomerRegisterInput, M as CustomerRegisterResult, T as CustomerVerifyRegistrationInput, J as CustomerPasswordLoginInput, R as CustomerSetPasswordInput, N as CustomerResetPasswordInput, B as Customer, S as CustomerUpdateInput, P as CustomerSessionInfo, bg as ReauthInput, bh as ReauthResult, H as CustomerEmailCodeInput, F as CustomerEmailChangeInput, G as CustomerEmailChangeRequested, E as CustomerEmailChangeConfirmInput, U as DataExportFile, A as AccountDeleteInput, aB as Order, bs as ReturnRequestInput, br as ReturnRequest, al as InvoiceResult, b2 as PendingPayment, ai as InvoiceFileKind, ah as InvoiceFile, a3 as FiscalProfile, a4 as FiscalProfileInput, bM as Subject, bR as SubjectInput, bT as SubjectPatch, a as Address, bS as SubjectKind, bV as Theme, aM as Page, au as Menu, c as Article, aw as Money, e as AvailabilityStatus, p as CartLineProblem, d as Availability, ae as InsufficientStockLine, bb as ProductVariant, V as DeclineCode, b1 as PaymentVoucher, aY as PaymentNextStep, r as CartPromotions, bd as PromotionReward, ag as InvoiceDoc, bw as Shipment, az as NextAction, aF as OrderProgress, bA as ShipmentStatus, bx as ShipmentEvent, bO as SubjectCatalogNode, bP as SubjectField, X as DeliveryMethod, bX as UnavailableRateProvider } from './account-settings-CwEnn5sR.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, K as CustomerPreferences, Z as Facet, _ as FacetValue, $ as FiscalDocumentEvidence, a0 as FiscalDocumentSource, a1 as FiscalIdentity, a2 as FiscalIdentityInput, a5 as FiscalVerification, a6 as GeoHint, a7 as IdentityCapture, a8 as IdentityDocumentSpec, a9 as IdentityFieldRule, aa as IdentityRulesV1, ab as IdentityStrategy, ac as Image, ad as InsufficientStockDetails, af as InvoiceAction, aj as InvoiceReceiver, am as InvoiceStage, an as InvoiceSummary, ao as InvoicingCapabilities, aq as LocationContacts, ar as LocationKind, at as LocationPickup, av as MenuItem, ax as MoneyRange, aA as NextActionKind, aC as OrderLine, aD as OrderPickup, aE as OrderProblem, aG as OrderProgressStep, aH as OrderSection, aI as OrderShippingService, aJ as OrderStage, aK as OrderStepKey, aL as OrderStepState, aN as PageInfo, aO as PaymentAction, aQ as PaymentAttemptStatus, aR as PaymentClient, aS as PaymentClientCsp, aU as PaymentFlow, aV as PaymentInfo, aW as PaymentMethod, aZ as PaymentOption, a_ as PaymentOptionKey, a$ as PaymentPoint, b3 as PendingPaymentVoucher, b4 as PickupOption, b6 as ProductAttributeValue, b7 as ProductCategory, b9 as ProductOption, bc as PromotionAnnouncement, be as PromotionTier, bj as Refund, bl as RegionFiscalEntry, bm as RegionFiscalId, bn as RegionPaymentMethod, bt as SEO, bu as Section, bv as SelectedOption, by as ShipmentKind, bz as ShipmentMap, bB as ShipmentsSummary, bC as ShippingRate, bE as ShopBranch, bF as ShopContact, bG as ShopPolicies, bI as StorefrontError, bJ as StorefrontErrorBody, bK as StorefrontErrorCode, bL as StorefrontErrorInit, bN as SubjectCatalog, bQ as SubjectFieldType, bU as SubjectRef, bY as dataExportBytes, bZ as isAccountDeleteBlocked, b_ as isReauthRequired, b$ as isStorefrontError, c0 as safeExportFilename } from './account-settings-CwEnn5sR.js';
1
+ import { bc as ProductSort, bY as TokenIntrospection, bF as Shop, bm as Region, bq as RegionPostalCode, d as AddressSuggestions, ba as ProductConnection, b7 as Product, D as Connection, B as Collection, au as LocationListParams, ar as Location, aA as NearestLocation, bJ as StockLevel, br as RestockSubscriptionInput, bs as RestockSubscriptionResult, p as CartLineInput, C as Cart, s as CartLineUpdateInput, i as CartBuyerInput, b as AddressInput, _ as DeliveryOptions, aZ as PaymentMethods, Y as DeliveryInput, am as InvoiceRequest, bk as RecommendationPlacement, v as CartRecommendations, x as CheckoutInput, z as CheckoutResult, bh as PromotionsList, aV as PaymentConfig, b2 as PaymentSubmitInput, aR as PaymentAttemptResult, K as CustomerIdentifier, S as CustomerSessionInput, Q as CustomerSession, F as CustomerCapabilities, N as CustomerRegisterInput, O as CustomerRegisterResult, V as CustomerVerifyRegistrationInput, L as CustomerPasswordLoginInput, T as CustomerSetPasswordInput, P as CustomerResetPasswordInput, E as Customer, U as CustomerUpdateInput, R as CustomerSessionInfo, bi as ReauthInput, bj as ReauthResult, J as CustomerEmailCodeInput, H as CustomerEmailChangeInput, I as CustomerEmailChangeRequested, G as CustomerEmailChangeConfirmInput, W as DataExportFile, A as AccountDeleteInput, aD as Order, bu as ReturnRequestInput, bt as ReturnRequest, an as InvoiceResult, b4 as PendingPayment, ak as InvoiceFileKind, aj as InvoiceFile, a5 as FiscalProfile, a6 as FiscalProfileInput, bO as Subject, bT as SubjectInput, bV as SubjectPatch, a as Address, bU as SubjectKind, bX as Theme, aO as Page, aw as Menu, e as Article, ay as Money, g as AvailabilityStatus, r as CartLineProblem, f as Availability, ag as InsufficientStockLine, bd as ProductVariant, X as DeclineCode, b3 as PaymentVoucher, a_ as PaymentNextStep, t as CartPromotions, bf as PromotionReward, ai as InvoiceDoc, by as Shipment, aB as NextAction, aH as OrderProgress, bC as ShipmentStatus, bz as ShipmentEvent, bQ as SubjectCatalogNode, bR as SubjectField, Z as DeliveryMethod, bZ as UnavailableRateProvider } from './account-settings-CrQV1rPU.js';
2
+ export { c as AddressSuggestion, h as CartBuyer, j as CartCost, k as CartDelivery, l as CartDiscountCode, m as CartDiscountLine, n as CartInvoice, o as CartLine, q as CartLineMerchandise, u as CartRecommendation, w as CheckoutInfo, y as CheckoutPayment, M as CustomerPreferences, $ as Facet, a0 as FacetValue, a1 as FiscalDocumentEvidence, a2 as FiscalDocumentSource, a3 as FiscalIdentity, a4 as FiscalIdentityInput, a7 as FiscalVerification, a8 as GeoHint, a9 as IdentityCapture, aa as IdentityDocumentSpec, ab as IdentityFieldRule, ac as IdentityRulesV1, ad as IdentityStrategy, ae as Image, af as InsufficientStockDetails, ah as InvoiceAction, al as InvoiceReceiver, ao as InvoiceStage, ap as InvoiceSummary, aq as InvoicingCapabilities, as as LocationContacts, at as LocationKind, av as LocationPickup, ax as MenuItem, az as MoneyRange, aC as NextActionKind, aE as OrderLine, aF as OrderPickup, aG as OrderProblem, aI as OrderProgressStep, aJ as OrderSection, aK as OrderShippingService, aL as OrderStage, aM as OrderStepKey, aN as OrderStepState, aP as PageInfo, aQ as PaymentAction, aS as PaymentAttemptStatus, aT as PaymentClient, aU as PaymentClientCsp, aW as PaymentFlow, aX as PaymentInfo, aY as PaymentMethod, a$ as PaymentOption, b0 as PaymentOptionKey, b1 as PaymentPoint, b5 as PendingPaymentVoucher, b6 as PickupOption, b8 as ProductAttributeValue, b9 as ProductCategory, bb as ProductOption, be as PromotionAnnouncement, bg as PromotionTier, bl as Refund, bn as RegionFiscalEntry, bo as RegionFiscalId, bp as RegionPaymentMethod, bv as SEO, bw as Section, bx as SelectedOption, bA as ShipmentKind, bB as ShipmentMap, bD as ShipmentsSummary, bE as ShippingRate, bG as ShopBranch, bH as ShopContact, bI as ShopPolicies, bK as StorefrontError, bL as StorefrontErrorBody, bM as StorefrontErrorCode, bN as StorefrontErrorInit, bP as SubjectCatalog, bS as SubjectFieldType, bW as SubjectRef, b_ as dataExportBytes, b$ as isAccountDeleteBlocked, c0 as isReauthRequired, c1 as isStorefrontError, c2 as safeExportFilename } from './account-settings-CrQV1rPU.js';
3
3
  import { GeoPoint } from './geo.js';
4
4
  export { OpenStatus, OpeningHours } from './geo.js';
5
5
 
@@ -119,6 +119,22 @@ type StorefrontClientOptions = {
119
119
  onResponse?: (ctx: StorefrontResponseContext) => void | Promise<void>;
120
120
  };
121
121
  /** Per-call options. Unknown keys (e.g. Next.js `next`) are forwarded to `fetch` as-is. */
122
+ /** Query of `client.addressSuggest`. */
123
+ type AddressSuggestParams = {
124
+ /** What the shopper typed so far (at least 3 characters). */
125
+ q: string;
126
+ /** ISO 3166-1 alpha-2 of the address: candidates of another country are dropped. */
127
+ country?: string;
128
+ /** Postal code already chosen: candidates of another code or state are dropped. */
129
+ zip?: string;
130
+ /** 1 to 8 (server default 5). */
131
+ limit?: number;
132
+ /** Bias point (with `lng`): ranks nearby first, never filters. */
133
+ lat?: number;
134
+ lng?: number;
135
+ /** Language of the labels (`es`, `en`). Default: `Accept-Language`. */
136
+ locale?: string;
137
+ };
122
138
  type RequestOptions = {
123
139
  cache?: RequestCache;
124
140
  signal?: AbortSignal;
@@ -202,6 +218,14 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
202
218
  * the server checks the address against.
203
219
  */
204
220
  postalCode: (zip: string, options?: RequestOptions) => Promise<RegionPostalCode | null>;
221
+ /**
222
+ * Street and number suggestions for the address form (`GET /storefront/address/suggest`), from the geocoding
223
+ * provider the market is assigned (a self-hosted Photon, ...). The server drops candidates of another country, postal
224
+ * code or state than the catalog's, and answers `{ suggestions: [], available: false }` when there is no provider:
225
+ * it never fails because of one. `q` needs at least 3 characters (the call rejects shorter ones without a request).
226
+ * Browser forms call it through `AddressFields.suggestAddress`; do not call it per keystroke without a debounce.
227
+ */
228
+ addressSuggest: (params: AddressSuggestParams, options?: RequestOptions) => Promise<AddressSuggestions>;
205
229
  products: {
206
230
  list: (params?: ProductListParams, options?: RequestOptions) => Promise<ProductConnection>;
207
231
  /** `null` when the product does not exist or is unpublished. */
@@ -989,4 +1013,4 @@ type DeliveryNotices = {
989
1013
  /** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
990
1014
  declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
991
1015
 
992
- 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, CustomerEmailChangeConfirmInput, CustomerEmailChangeInput, CustomerEmailChangeRequested, CustomerEmailCodeInput, 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 };
1016
+ export { AccountDeleteInput, Address, AddressInput, type AddressSuggestParams, AddressSuggestions, 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, CustomerEmailChangeConfirmInput, CustomerEmailChangeInput, CustomerEmailChangeRequested, CustomerEmailCodeInput, 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
@@ -290,6 +290,22 @@ function createStorefrontClient(config) {
290
290
  * the server checks the address against.
291
291
  */
292
292
  postalCode: (zip, options) => getOrNull("/storefront/region/postal-code", { zip: zip.trim() }, options),
293
+ /**
294
+ * Street and number suggestions for the address form (`GET /storefront/address/suggest`), from the geocoding
295
+ * provider the market is assigned (a self-hosted Photon, ...). The server drops candidates of another country, postal
296
+ * code or state than the catalog's, and answers `{ suggestions: [], available: false }` when there is no provider:
297
+ * it never fails because of one. `q` needs at least 3 characters (the call rejects shorter ones without a request).
298
+ * Browser forms call it through `AddressFields.suggestAddress`; do not call it per keystroke without a debounce.
299
+ */
300
+ addressSuggest: (params, options) => {
301
+ const q = params.q.trim().replace(/\s+/g, " ");
302
+ if ([...q].length < 3) return Promise.reject(new RangeError("addressSuggest: q needs at least 3 characters"));
303
+ return get(
304
+ "/storefront/address/suggest",
305
+ { q, country: params.country?.toUpperCase(), zip: params.zip?.trim(), limit: params.limit, lat: params.lat, lng: params.lng, locale: params.locale },
306
+ options
307
+ );
308
+ },
293
309
  products: {
294
310
  list: (params, options) => get("/storefront/products", productListQuery(params), options),
295
311
  /** `null` when the product does not exist or is unpublished. */