@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
|
@@ -1273,6 +1273,23 @@ type InvoiceSummary = {
|
|
|
1273
1273
|
* after the XML: a missing kind is "still being prepared", not an error. Absent/null = the server does not say.
|
|
1274
1274
|
*/
|
|
1275
1275
|
available_files?: ('pdf' | 'xml')[] | null;
|
|
1276
|
+
/**
|
|
1277
|
+
* Plain-words reason the invoice could not be issued, ready to show (contract 1.18): "No pudimos emitir tu factura: el nombre o
|
|
1278
|
+
* razón social no coincide con el SAT. Revisa tus datos y vuelve a intentarlo." Never the provider's text.
|
|
1279
|
+
*/
|
|
1280
|
+
reason_message?: string | null;
|
|
1281
|
+
/** Form field the authority refused (`tax_id`, `legal_name`, `tax_regime`, `postal_code`, `invoice_use`), to mark it. */
|
|
1282
|
+
reason_field?: 'tax_id' | 'legal_name' | 'tax_regime' | 'postal_code' | 'invoice_use' | (string & {}) | null;
|
|
1283
|
+
/** The data the buyer sent in the refused attempt, to prefill the form for the correction. */
|
|
1284
|
+
submitted?: {
|
|
1285
|
+
tax_id?: string;
|
|
1286
|
+
legal_name?: string;
|
|
1287
|
+
tax_regime?: string;
|
|
1288
|
+
postal_code?: string;
|
|
1289
|
+
invoice_use?: string;
|
|
1290
|
+
} | null;
|
|
1291
|
+
/** Attempts left today for this order (0: `needs_review` until tomorrow). */
|
|
1292
|
+
retries_left?: number | null;
|
|
1276
1293
|
};
|
|
1277
1294
|
/** The invoice request of a cart (`Cart.invoice`). The tax id is masked: the full value is never echoed back. */
|
|
1278
1295
|
type CartInvoice = {
|
|
@@ -1402,6 +1419,36 @@ type RegionPostalCode = {
|
|
|
1402
1419
|
/** Every municipality the code covers, only when more than one (the form leaves the city editable and offers them). */
|
|
1403
1420
|
cities?: string[];
|
|
1404
1421
|
};
|
|
1422
|
+
/**
|
|
1423
|
+
* One candidate of `GET /storefront/address/suggest`. A SUGGESTION: only the postal-code catalog of the region pack is
|
|
1424
|
+
* authoritative for state, city and colonia, so a form uses `street` / `house_number` and treats the rest as hints.
|
|
1425
|
+
*/
|
|
1426
|
+
type AddressSuggestion = {
|
|
1427
|
+
/** Opaque id of the candidate at its provider. */
|
|
1428
|
+
id?: string;
|
|
1429
|
+
/** The address as shown in the list. */
|
|
1430
|
+
label: string;
|
|
1431
|
+
street?: string;
|
|
1432
|
+
house_number?: string;
|
|
1433
|
+
neighborhood?: string;
|
|
1434
|
+
city?: string;
|
|
1435
|
+
province?: string;
|
|
1436
|
+
zip?: string;
|
|
1437
|
+
country?: string;
|
|
1438
|
+
lat?: number;
|
|
1439
|
+
lng?: number;
|
|
1440
|
+
precision?: 'rooftop' | 'street' | 'neighborhood' | 'postal_centroid' | 'locality' | 'region' | 'country';
|
|
1441
|
+
/** Key of the provider addon (`geo_photon`, ...). */
|
|
1442
|
+
source?: string;
|
|
1443
|
+
};
|
|
1444
|
+
/** `GET /storefront/address/suggest`. Never an error because the provider is missing or down. */
|
|
1445
|
+
type AddressSuggestions = {
|
|
1446
|
+
suggestions: AddressSuggestion[];
|
|
1447
|
+
/** `false`: the market has no suggestion provider; a form stops asking and stays manual. */
|
|
1448
|
+
available: boolean;
|
|
1449
|
+
/** `true`: there is a provider but it did not answer this time (timeout, outage). */
|
|
1450
|
+
degraded?: boolean;
|
|
1451
|
+
};
|
|
1405
1452
|
/** `GET /storefront/region`: how the market formats, taxes, addresses and invoices. */
|
|
1406
1453
|
type Region = {
|
|
1407
1454
|
country_code: string;
|
|
@@ -1769,4 +1816,4 @@ declare function dataExportBytes(file: Pick<DataExportFile, 'content_base64'>):
|
|
|
1769
1816
|
/** A download filename that is safe in a `Content-Disposition` header: no path, quotes, control characters or spaces. */
|
|
1770
1817
|
declare function safeExportFilename(name: unknown, fallback?: string): string;
|
|
1771
1818
|
|
|
1772
|
-
export { type
|
|
1819
|
+
export { type Facet as $, type AccountDeleteInput as A, type Collection as B, type Cart as C, type Connection as D, type Customer as E, type CustomerCapabilities as F, type CustomerEmailChangeConfirmInput as G, type CustomerEmailChangeInput as H, type CustomerEmailChangeRequested as I, type CustomerEmailCodeInput as J, type CustomerIdentifier as K, type CustomerPasswordLoginInput as L, type CustomerPreferences as M, type CustomerRegisterInput as N, type CustomerRegisterResult as O, type CustomerResetPasswordInput as P, type CustomerSession as Q, type CustomerSessionInfo as R, type CustomerSessionInput as S, type CustomerSetPasswordInput as T, type CustomerUpdateInput as U, type CustomerVerifyRegistrationInput as V, type DataExportFile as W, type DeclineCode as X, type DeliveryInput as Y, type DeliveryMethod as Z, type DeliveryOptions as _, type Address as a, type PaymentOption as a$, type FacetValue as a0, type FiscalDocumentEvidence as a1, type FiscalDocumentSource as a2, type FiscalIdentity as a3, type FiscalIdentityInput as a4, type FiscalProfile as a5, type FiscalProfileInput as a6, type FiscalVerification as a7, type GeoHint as a8, type IdentityCapture as a9, type NearestLocation as aA, type NextAction as aB, type NextActionKind as aC, type Order as aD, type OrderLine as aE, type OrderPickup as aF, type OrderProblem as aG, type OrderProgress as aH, type OrderProgressStep as aI, type OrderSection as aJ, type OrderShippingService as aK, type OrderStage as aL, type OrderStepKey as aM, type OrderStepState as aN, type Page as aO, type PageInfo as aP, type PaymentAction as aQ, type PaymentAttemptResult as aR, type PaymentAttemptStatus as aS, type PaymentClient as aT, type PaymentClientCsp as aU, type PaymentConfig as aV, type PaymentFlow as aW, type PaymentInfo as aX, type PaymentMethod as aY, type PaymentMethods as aZ, type PaymentNextStep as a_, type IdentityDocumentSpec as aa, type IdentityFieldRule as ab, type IdentityRulesV1 as ac, type IdentityStrategy as ad, type Image as ae, type InsufficientStockDetails as af, type InsufficientStockLine as ag, type InvoiceAction as ah, type InvoiceDoc as ai, type InvoiceFile as aj, type InvoiceFileKind as ak, type InvoiceReceiver as al, type InvoiceRequest as am, type InvoiceResult as an, type InvoiceStage as ao, type InvoiceSummary as ap, type InvoicingCapabilities as aq, type Location as ar, type LocationContacts as as, type LocationKind as at, type LocationListParams as au, type LocationPickup as av, type Menu as aw, type MenuItem as ax, type Money as ay, type MoneyRange as az, type AddressInput as b, isAccountDeleteBlocked as b$, type PaymentOptionKey as b0, type PaymentPoint as b1, type PaymentSubmitInput as b2, type PaymentVoucher as b3, type PendingPayment as b4, type PendingPaymentVoucher as b5, type PickupOption as b6, type Product as b7, type ProductAttributeValue as b8, type ProductCategory as b9, type ShipmentKind as bA, type ShipmentMap as bB, type ShipmentStatus as bC, type ShipmentsSummary as bD, type ShippingRate as bE, type Shop as bF, type ShopBranch as bG, type ShopContact as bH, type ShopPolicies as bI, type StockLevel as bJ, StorefrontError as bK, type StorefrontErrorBody as bL, type StorefrontErrorCode as bM, type StorefrontErrorInit as bN, type Subject as bO, type SubjectCatalog as bP, type SubjectCatalogNode as bQ, type SubjectField as bR, type SubjectFieldType as bS, type SubjectInput as bT, type SubjectKind as bU, type SubjectPatch as bV, type SubjectRef as bW, type Theme as bX, type TokenIntrospection as bY, type UnavailableRateProvider as bZ, dataExportBytes as b_, type ProductConnection as ba, type ProductOption as bb, type ProductSort as bc, type ProductVariant as bd, type PromotionAnnouncement as be, type PromotionReward as bf, type PromotionTier as bg, type PromotionsList as bh, type ReauthInput as bi, type ReauthResult as bj, type RecommendationPlacement as bk, type Refund as bl, type Region as bm, type RegionFiscalEntry as bn, type RegionFiscalId as bo, type RegionPaymentMethod as bp, type RegionPostalCode as bq, type RestockSubscriptionInput as br, type RestockSubscriptionResult as bs, type ReturnRequest as bt, type ReturnRequestInput as bu, type SEO as bv, type Section as bw, type SelectedOption as bx, type Shipment as by, type ShipmentEvent as bz, type AddressSuggestion as c, isReauthRequired as c0, isStorefrontError as c1, safeExportFilename as c2, type AddressSuggestions as d, type Article as e, type Availability as f, type AvailabilityStatus as g, type CartBuyer as h, type CartBuyerInput as i, type CartCost as j, type CartDelivery as k, type CartDiscountCode as l, type CartDiscountLine as m, type CartInvoice as n, type CartLine as o, type CartLineInput as p, type CartLineMerchandise as q, type CartLineProblem as r, type CartLineUpdateInput as s, type CartPromotions as t, type CartRecommendation as u, type CartRecommendations as v, type CheckoutInfo as w, type CheckoutInput as x, type CheckoutPayment as y, type CheckoutResult as z };
|
|
@@ -1273,6 +1273,23 @@ type InvoiceSummary = {
|
|
|
1273
1273
|
* after the XML: a missing kind is "still being prepared", not an error. Absent/null = the server does not say.
|
|
1274
1274
|
*/
|
|
1275
1275
|
available_files?: ('pdf' | 'xml')[] | null;
|
|
1276
|
+
/**
|
|
1277
|
+
* Plain-words reason the invoice could not be issued, ready to show (contract 1.18): "No pudimos emitir tu factura: el nombre o
|
|
1278
|
+
* razón social no coincide con el SAT. Revisa tus datos y vuelve a intentarlo." Never the provider's text.
|
|
1279
|
+
*/
|
|
1280
|
+
reason_message?: string | null;
|
|
1281
|
+
/** Form field the authority refused (`tax_id`, `legal_name`, `tax_regime`, `postal_code`, `invoice_use`), to mark it. */
|
|
1282
|
+
reason_field?: 'tax_id' | 'legal_name' | 'tax_regime' | 'postal_code' | 'invoice_use' | (string & {}) | null;
|
|
1283
|
+
/** The data the buyer sent in the refused attempt, to prefill the form for the correction. */
|
|
1284
|
+
submitted?: {
|
|
1285
|
+
tax_id?: string;
|
|
1286
|
+
legal_name?: string;
|
|
1287
|
+
tax_regime?: string;
|
|
1288
|
+
postal_code?: string;
|
|
1289
|
+
invoice_use?: string;
|
|
1290
|
+
} | null;
|
|
1291
|
+
/** Attempts left today for this order (0: `needs_review` until tomorrow). */
|
|
1292
|
+
retries_left?: number | null;
|
|
1276
1293
|
};
|
|
1277
1294
|
/** The invoice request of a cart (`Cart.invoice`). The tax id is masked: the full value is never echoed back. */
|
|
1278
1295
|
type CartInvoice = {
|
|
@@ -1402,6 +1419,36 @@ type RegionPostalCode = {
|
|
|
1402
1419
|
/** Every municipality the code covers, only when more than one (the form leaves the city editable and offers them). */
|
|
1403
1420
|
cities?: string[];
|
|
1404
1421
|
};
|
|
1422
|
+
/**
|
|
1423
|
+
* One candidate of `GET /storefront/address/suggest`. A SUGGESTION: only the postal-code catalog of the region pack is
|
|
1424
|
+
* authoritative for state, city and colonia, so a form uses `street` / `house_number` and treats the rest as hints.
|
|
1425
|
+
*/
|
|
1426
|
+
type AddressSuggestion = {
|
|
1427
|
+
/** Opaque id of the candidate at its provider. */
|
|
1428
|
+
id?: string;
|
|
1429
|
+
/** The address as shown in the list. */
|
|
1430
|
+
label: string;
|
|
1431
|
+
street?: string;
|
|
1432
|
+
house_number?: string;
|
|
1433
|
+
neighborhood?: string;
|
|
1434
|
+
city?: string;
|
|
1435
|
+
province?: string;
|
|
1436
|
+
zip?: string;
|
|
1437
|
+
country?: string;
|
|
1438
|
+
lat?: number;
|
|
1439
|
+
lng?: number;
|
|
1440
|
+
precision?: 'rooftop' | 'street' | 'neighborhood' | 'postal_centroid' | 'locality' | 'region' | 'country';
|
|
1441
|
+
/** Key of the provider addon (`geo_photon`, ...). */
|
|
1442
|
+
source?: string;
|
|
1443
|
+
};
|
|
1444
|
+
/** `GET /storefront/address/suggest`. Never an error because the provider is missing or down. */
|
|
1445
|
+
type AddressSuggestions = {
|
|
1446
|
+
suggestions: AddressSuggestion[];
|
|
1447
|
+
/** `false`: the market has no suggestion provider; a form stops asking and stays manual. */
|
|
1448
|
+
available: boolean;
|
|
1449
|
+
/** `true`: there is a provider but it did not answer this time (timeout, outage). */
|
|
1450
|
+
degraded?: boolean;
|
|
1451
|
+
};
|
|
1405
1452
|
/** `GET /storefront/region`: how the market formats, taxes, addresses and invoices. */
|
|
1406
1453
|
type Region = {
|
|
1407
1454
|
country_code: string;
|
|
@@ -1769,4 +1816,4 @@ declare function dataExportBytes(file: Pick<DataExportFile, 'content_base64'>):
|
|
|
1769
1816
|
/** A download filename that is safe in a `Content-Disposition` header: no path, quotes, control characters or spaces. */
|
|
1770
1817
|
declare function safeExportFilename(name: unknown, fallback?: string): string;
|
|
1771
1818
|
|
|
1772
|
-
export { type
|
|
1819
|
+
export { type Facet as $, type AccountDeleteInput as A, type Collection as B, type Cart as C, type Connection as D, type Customer as E, type CustomerCapabilities as F, type CustomerEmailChangeConfirmInput as G, type CustomerEmailChangeInput as H, type CustomerEmailChangeRequested as I, type CustomerEmailCodeInput as J, type CustomerIdentifier as K, type CustomerPasswordLoginInput as L, type CustomerPreferences as M, type CustomerRegisterInput as N, type CustomerRegisterResult as O, type CustomerResetPasswordInput as P, type CustomerSession as Q, type CustomerSessionInfo as R, type CustomerSessionInput as S, type CustomerSetPasswordInput as T, type CustomerUpdateInput as U, type CustomerVerifyRegistrationInput as V, type DataExportFile as W, type DeclineCode as X, type DeliveryInput as Y, type DeliveryMethod as Z, type DeliveryOptions as _, type Address as a, type PaymentOption as a$, type FacetValue as a0, type FiscalDocumentEvidence as a1, type FiscalDocumentSource as a2, type FiscalIdentity as a3, type FiscalIdentityInput as a4, type FiscalProfile as a5, type FiscalProfileInput as a6, type FiscalVerification as a7, type GeoHint as a8, type IdentityCapture as a9, type NearestLocation as aA, type NextAction as aB, type NextActionKind as aC, type Order as aD, type OrderLine as aE, type OrderPickup as aF, type OrderProblem as aG, type OrderProgress as aH, type OrderProgressStep as aI, type OrderSection as aJ, type OrderShippingService as aK, type OrderStage as aL, type OrderStepKey as aM, type OrderStepState as aN, type Page as aO, type PageInfo as aP, type PaymentAction as aQ, type PaymentAttemptResult as aR, type PaymentAttemptStatus as aS, type PaymentClient as aT, type PaymentClientCsp as aU, type PaymentConfig as aV, type PaymentFlow as aW, type PaymentInfo as aX, type PaymentMethod as aY, type PaymentMethods as aZ, type PaymentNextStep as a_, type IdentityDocumentSpec as aa, type IdentityFieldRule as ab, type IdentityRulesV1 as ac, type IdentityStrategy as ad, type Image as ae, type InsufficientStockDetails as af, type InsufficientStockLine as ag, type InvoiceAction as ah, type InvoiceDoc as ai, type InvoiceFile as aj, type InvoiceFileKind as ak, type InvoiceReceiver as al, type InvoiceRequest as am, type InvoiceResult as an, type InvoiceStage as ao, type InvoiceSummary as ap, type InvoicingCapabilities as aq, type Location as ar, type LocationContacts as as, type LocationKind as at, type LocationListParams as au, type LocationPickup as av, type Menu as aw, type MenuItem as ax, type Money as ay, type MoneyRange as az, type AddressInput as b, isAccountDeleteBlocked as b$, type PaymentOptionKey as b0, type PaymentPoint as b1, type PaymentSubmitInput as b2, type PaymentVoucher as b3, type PendingPayment as b4, type PendingPaymentVoucher as b5, type PickupOption as b6, type Product as b7, type ProductAttributeValue as b8, type ProductCategory as b9, type ShipmentKind as bA, type ShipmentMap as bB, type ShipmentStatus as bC, type ShipmentsSummary as bD, type ShippingRate as bE, type Shop as bF, type ShopBranch as bG, type ShopContact as bH, type ShopPolicies as bI, type StockLevel as bJ, StorefrontError as bK, type StorefrontErrorBody as bL, type StorefrontErrorCode as bM, type StorefrontErrorInit as bN, type Subject as bO, type SubjectCatalog as bP, type SubjectCatalogNode as bQ, type SubjectField as bR, type SubjectFieldType as bS, type SubjectInput as bT, type SubjectKind as bU, type SubjectPatch as bV, type SubjectRef as bW, type Theme as bX, type TokenIntrospection as bY, type UnavailableRateProvider as bZ, dataExportBytes as b_, type ProductConnection as ba, type ProductOption as bb, type ProductSort as bc, type ProductVariant as bd, type PromotionAnnouncement as be, type PromotionReward as bf, type PromotionTier as bg, type PromotionsList as bh, type ReauthInput as bi, type ReauthResult as bj, type RecommendationPlacement as bk, type Refund as bl, type Region as bm, type RegionFiscalEntry as bn, type RegionFiscalId as bo, type RegionPaymentMethod as bp, type RegionPostalCode as bq, type RestockSubscriptionInput as br, type RestockSubscriptionResult as bs, type ReturnRequest as bt, type ReturnRequestInput as bu, type SEO as bv, type Section as bw, type SelectedOption as bx, type Shipment as by, type ShipmentEvent as bz, type AddressSuggestion as c, isReauthRequired as c0, isStorefrontError as c1, safeExportFilename as c2, type AddressSuggestions as d, type Article as e, type Availability as f, type AvailabilityStatus as g, type CartBuyer as h, type CartBuyerInput as i, type CartCost as j, type CartDelivery as k, type CartDiscountCode as l, type CartDiscountLine as m, type CartInvoice as n, type CartLine as o, type CartLineInput as p, type CartLineMerchandise as q, type CartLineProblem as r, type CartLineUpdateInput as s, type CartPromotions as t, type CartRecommendation as u, type CartRecommendations as v, type CheckoutInfo as w, type CheckoutInput as x, type CheckoutPayment as y, type CheckoutResult as z };
|
package/dist/cli.js
CHANGED
|
@@ -334,6 +334,22 @@ function createStorefrontClient(config) {
|
|
|
334
334
|
* the server checks the address against.
|
|
335
335
|
*/
|
|
336
336
|
postalCode: (zip, options) => getOrNull("/storefront/region/postal-code", { zip: zip.trim() }, options),
|
|
337
|
+
/**
|
|
338
|
+
* Street and number suggestions for the address form (`GET /storefront/address/suggest`), from the geocoding
|
|
339
|
+
* provider the market is assigned (a self-hosted Photon, ...). The server drops candidates of another country, postal
|
|
340
|
+
* code or state than the catalog's, and answers `{ suggestions: [], available: false }` when there is no provider:
|
|
341
|
+
* it never fails because of one. `q` needs at least 3 characters (the call rejects shorter ones without a request).
|
|
342
|
+
* Browser forms call it through `AddressFields.suggestAddress`; do not call it per keystroke without a debounce.
|
|
343
|
+
*/
|
|
344
|
+
addressSuggest: (params, options) => {
|
|
345
|
+
const q = params.q.trim().replace(/\s+/g, " ");
|
|
346
|
+
if ([...q].length < 3) return Promise.reject(new RangeError("addressSuggest: q needs at least 3 characters"));
|
|
347
|
+
return get(
|
|
348
|
+
"/storefront/address/suggest",
|
|
349
|
+
{ q, country: params.country?.toUpperCase(), zip: params.zip?.trim(), limit: params.limit, lat: params.lat, lng: params.lng, locale: params.locale },
|
|
350
|
+
options
|
|
351
|
+
);
|
|
352
|
+
},
|
|
337
353
|
products: {
|
|
338
354
|
list: (params, options) => get("/storefront/products", productListQuery(params), options),
|
|
339
355
|
/** `null` when the product does not exist or is unpublished. */
|
|
@@ -629,7 +645,7 @@ function repairPath(connectionName) {
|
|
|
629
645
|
import { chmodSync, closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, statSync, unlinkSync, writeSync } from "fs";
|
|
630
646
|
import { dirname, join, resolve } from "path";
|
|
631
647
|
import { hostname } from "os";
|
|
632
|
-
var SDK_VERSION = true ? "0.
|
|
648
|
+
var SDK_VERSION = true ? "0.24.0" : "dev";
|
|
633
649
|
function writeFileAtomic(file, content, mode = 384) {
|
|
634
650
|
const dir = dirname(file);
|
|
635
651
|
mkdirSync(dir, { recursive: true });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a2 as FiscalDocumentSource, bn as RegionFiscalEntry, aa as IdentityDocumentSpec, a1 as FiscalDocumentEvidence, bo as RegionFiscalId, ac as IdentityRulesV1 } from './account-settings-BZKux56f.cjs';
|
|
2
|
+
export { a9 as IdentityCapture, ab as IdentityFieldRule, ad as IdentityStrategy } from './account-settings-BZKux56f.cjs';
|
|
3
3
|
import './geo.cjs';
|
|
4
4
|
|
|
5
5
|
/** A value read from a document: text, or the codes of a catalog (`multiple` fields). */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a2 as FiscalDocumentSource, bn as RegionFiscalEntry, aa as IdentityDocumentSpec, a1 as FiscalDocumentEvidence, bo as RegionFiscalId, ac as IdentityRulesV1 } from './account-settings-CrQV1rPU.js';
|
|
2
|
+
export { a9 as IdentityCapture, ab as IdentityFieldRule, ad as IdentityStrategy } from './account-settings-CrQV1rPU.js';
|
|
3
3
|
import './geo.js';
|
|
4
4
|
|
|
5
5
|
/** A value read from a document: text, or the codes of a catalog (`multiple` fields). */
|
package/dist/index.cjs
CHANGED
|
@@ -366,6 +366,22 @@ function createStorefrontClient(config) {
|
|
|
366
366
|
* the server checks the address against.
|
|
367
367
|
*/
|
|
368
368
|
postalCode: (zip, options) => getOrNull("/storefront/region/postal-code", { zip: zip.trim() }, options),
|
|
369
|
+
/**
|
|
370
|
+
* Street and number suggestions for the address form (`GET /storefront/address/suggest`), from the geocoding
|
|
371
|
+
* provider the market is assigned (a self-hosted Photon, ...). The server drops candidates of another country, postal
|
|
372
|
+
* code or state than the catalog's, and answers `{ suggestions: [], available: false }` when there is no provider:
|
|
373
|
+
* it never fails because of one. `q` needs at least 3 characters (the call rejects shorter ones without a request).
|
|
374
|
+
* Browser forms call it through `AddressFields.suggestAddress`; do not call it per keystroke without a debounce.
|
|
375
|
+
*/
|
|
376
|
+
addressSuggest: (params, options) => {
|
|
377
|
+
const q = params.q.trim().replace(/\s+/g, " ");
|
|
378
|
+
if ([...q].length < 3) return Promise.reject(new RangeError("addressSuggest: q needs at least 3 characters"));
|
|
379
|
+
return get(
|
|
380
|
+
"/storefront/address/suggest",
|
|
381
|
+
{ q, country: params.country?.toUpperCase(), zip: params.zip?.trim(), limit: params.limit, lat: params.lat, lng: params.lng, locale: params.locale },
|
|
382
|
+
options
|
|
383
|
+
);
|
|
384
|
+
},
|
|
369
385
|
products: {
|
|
370
386
|
list: (params, options) => get("/storefront/products", productListQuery(params), options),
|
|
371
387
|
/** `null` when the product does not exist or is unpublished. */
|