@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/{account-settings-DZGcveuu.d.cts → account-settings-BZKux56f.d.cts} +48 -1
- package/dist/{account-settings-CwEnn5sR.d.ts → account-settings-CrQV1rPU.d.ts} +48 -1
- package/dist/cli.js +17 -1
- package/dist/fiscal-document.d.cts +2 -2
- package/dist/fiscal-document.d.ts +2 -2
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/mock.cjs +12 -0
- package/dist/mock.cjs.map +1 -1
- package/dist/mock.d.cts +7 -1
- package/dist/mock.d.ts +7 -1
- package/dist/mock.js +12 -0
- package/dist/mock.js.map +1 -1
- package/dist/mockup.d.cts +1 -1
- package/dist/mockup.d.ts +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.js +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
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 {
|
|
2
|
-
export {
|
|
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. */
|