@asteby/storefront 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/mock.cjs +113 -0
- package/dist/mock.cjs.map +1 -1
- package/dist/mock.d.cts +19 -1
- package/dist/mock.d.ts +19 -1
- package/dist/mock.js +113 -0
- package/dist/mock.js.map +1 -1
- package/dist/mockup.d.cts +1 -1
- package/dist/mockup.d.ts +1 -1
- package/dist/{types-iGGZ9EiC.d.ts → types-COSwo4ND.d.ts} +41 -1
- package/dist/{types-CSMuPSQA.d.cts → types-DdLzlxw4.d.cts} +41 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeoPoint } from './geo.cjs';
|
|
2
2
|
export { OpenStatus, OpeningHours } from './geo.cjs';
|
|
3
|
-
import {
|
|
4
|
-
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartLine, m as CartLineMerchandise, q as CartRecommendation, s as CheckoutInfo, u as CheckoutPayment,
|
|
3
|
+
import { at as ProductSort, aI as Shop, ar as ProductConnection, ao as Product, x as Connection, w as Collection, Z as LocationListParams, W as Location, a3 as NearestLocation, aM as StockLevel, aA as RestockSubscriptionInput, aB as RestockSubscriptionResult, l as CartLineInput, C as Cart, o as CartLineUpdateInput, f as CartBuyerInput, a as AddressInput, O as DeliveryOptions, ag as PaymentMethods, M as DeliveryInput, az as RecommendationPlacement, r as CartRecommendations, t as CheckoutInput, v as CheckoutResult, ay as PromotionsList, ad as PaymentConfig, al as PaymentSubmitInput, a9 as PaymentAttemptResult, B as CustomerIdentifier, I as CustomerSessionInput, H as CustomerSession, z as CustomerCapabilities, E as CustomerRegisterInput, F as CustomerRegisterResult, K as CustomerVerifyRegistrationInput, D as CustomerPasswordLoginInput, J as CustomerSetPasswordInput, G as CustomerResetPasswordInput, y as Customer, a4 as Order, aD as ReturnRequestInput, aC as ReturnRequest, U as InvoiceRequest, V as InvoiceResult, A as Address, aP as Theme, a6 as Page, $ as Menu, b as Article, aO as StorefrontErrorCode, T as InsufficientStockLine, a1 as Money, d as AvailabilityStatus, n as CartLineProblem, c as Availability, au as ProductVariant, L as DeclineCode, am as PaymentVoucher, ah as PaymentNextStep, p as CartPromotions, aw as PromotionReward, N as DeliveryMethod, aQ as UnavailableRateProvider } from './types-DdLzlxw4.cjs';
|
|
4
|
+
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartLine, m as CartLineMerchandise, q as CartRecommendation, s as CheckoutInfo, u as CheckoutPayment, P as Facet, Q as FacetValue, R as Image, S as InsufficientStockDetails, X as LocationContacts, Y as LocationKind, _ as LocationPickup, a0 as MenuItem, a2 as MoneyRange, a5 as OrderLine, a7 as PageInfo, a8 as PaymentAction, aa as PaymentAttemptStatus, ab as PaymentClient, ac as PaymentClientCsp, ae as PaymentFlow, af as PaymentMethod, ai as PaymentOption, aj as PaymentOptionKey, ak as PaymentPoint, an as PickupOption, ap as ProductAttributeValue, aq as ProductCategory, as as ProductOption, av as PromotionAnnouncement, ax as PromotionTier, aE as SEO, aF as Section, aG as SelectedOption, aH as ShippingRate, aJ as ShopBranch, aK as ShopContact, aL as ShopPolicies, aN as StorefrontErrorBody } from './types-DdLzlxw4.cjs';
|
|
5
5
|
|
|
6
6
|
type QueryValue = string | number | boolean | null | undefined;
|
|
7
7
|
type QueryParams = Record<string, QueryValue | QueryValue[]>;
|
|
@@ -270,6 +270,21 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
|
|
|
270
270
|
requestOtp: (identifier: CustomerIdentifier, options?: WriteOptions) => Promise<void>;
|
|
271
271
|
/** Exchanges the code for a buyer session (`token` goes in `customerToken`). */
|
|
272
272
|
createSession: (input: CustomerSessionInput, options?: WriteOptions) => Promise<CustomerSession>;
|
|
273
|
+
/** What the store supports (password login, email verification, OTP channels). Drives which forms to show. */
|
|
274
|
+
capabilities: (options?: RequestOptions) => Promise<CustomerCapabilities>;
|
|
275
|
+
/**
|
|
276
|
+
* Creates an account with email + password. `verification_required` (202): a code was emailed, finish with
|
|
277
|
+
* `verifyRegistration`. `created` (201): the account exists and `session` is ready. `409` when the email is taken.
|
|
278
|
+
*/
|
|
279
|
+
register: (input: CustomerRegisterInput, options?: WriteOptions) => Promise<CustomerRegisterResult>;
|
|
280
|
+
/** Confirms the emailed registration code and returns the new buyer session. */
|
|
281
|
+
verifyRegistration: (input: CustomerVerifyRegistrationInput, options?: WriteOptions) => Promise<CustomerSession>;
|
|
282
|
+
/** Email + password login. `401` for wrong credentials. */
|
|
283
|
+
loginWithPassword: (input: CustomerPasswordLoginInput, options?: WriteOptions) => Promise<CustomerSession>;
|
|
284
|
+
/** Sets or changes the password of the signed-in buyer (`options.customerToken`, or a `withCustomerToken` client). */
|
|
285
|
+
setPassword: (input: CustomerSetPasswordInput, options?: WriteOptions) => Promise<void>;
|
|
286
|
+
/** Resets a forgotten password with the code from `requestOtp({ email })`. */
|
|
287
|
+
resetPassword: (input: CustomerResetPasswordInput, options?: WriteOptions) => Promise<void>;
|
|
273
288
|
get: (options?: RequestOptions) => Promise<Customer>;
|
|
274
289
|
orders: (params?: PaginationParams, options?: RequestOptions) => Promise<Connection<Order>>;
|
|
275
290
|
/** `null` when the order does not exist or belongs to someone else. */
|
|
@@ -677,4 +692,4 @@ type DeliveryNotices = {
|
|
|
677
692
|
/** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
|
|
678
693
|
declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
|
|
679
694
|
|
|
680
|
-
export { 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, CustomerIdentifier, CustomerSession, CustomerSessionInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, Order, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorKind, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, hreflangLinks, isStorefrontError, isTokenPublishable, negotiateLocale, normalizeClientIp, normalizeNote, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, resolveAvailability, rewardLabel, safeHttpsUrl, schemaAvailability, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
|
695
|
+
export { Address, AddressInput, Article, type ArticleListParams, Availability, type AvailabilityLocale, type AvailabilityMessageKey, type AvailabilityMessages, AvailabilityStatus, type AvailabilityTone, type AvailabilityView, type AvailabilityViewOptions, CLIENT_IP_HEADER, COUNTRY_HEADERS, Cart, CartBuyerInput, CartLineInput, CartLineProblem, type CartLineProblemView, CartLineUpdateInput, CartPromotions, CartRecommendations, CheckoutInput, CheckoutResult, Collection, type CollectionListParams, Connection, Customer, CustomerCapabilities, CustomerIdentifier, CustomerPasswordLoginInput, CustomerRegisterInput, CustomerRegisterResult, CustomerResetPasswordInput, CustomerSession, CustomerSessionInput, CustomerSetPasswordInput, CustomerVerifyRegistrationInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, Order, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorKind, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, hreflangLinks, isStorefrontError, isTokenPublishable, negotiateLocale, normalizeClientIp, normalizeNote, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, resolveAvailability, rewardLabel, safeHttpsUrl, schemaAvailability, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeoPoint } from './geo.js';
|
|
2
2
|
export { OpenStatus, OpeningHours } from './geo.js';
|
|
3
|
-
import {
|
|
4
|
-
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartLine, m as CartLineMerchandise, q as CartRecommendation, s as CheckoutInfo, u as CheckoutPayment,
|
|
3
|
+
import { at as ProductSort, aI as Shop, ar as ProductConnection, ao as Product, x as Connection, w as Collection, Z as LocationListParams, W as Location, a3 as NearestLocation, aM as StockLevel, aA as RestockSubscriptionInput, aB as RestockSubscriptionResult, l as CartLineInput, C as Cart, o as CartLineUpdateInput, f as CartBuyerInput, a as AddressInput, O as DeliveryOptions, ag as PaymentMethods, M as DeliveryInput, az as RecommendationPlacement, r as CartRecommendations, t as CheckoutInput, v as CheckoutResult, ay as PromotionsList, ad as PaymentConfig, al as PaymentSubmitInput, a9 as PaymentAttemptResult, B as CustomerIdentifier, I as CustomerSessionInput, H as CustomerSession, z as CustomerCapabilities, E as CustomerRegisterInput, F as CustomerRegisterResult, K as CustomerVerifyRegistrationInput, D as CustomerPasswordLoginInput, J as CustomerSetPasswordInput, G as CustomerResetPasswordInput, y as Customer, a4 as Order, aD as ReturnRequestInput, aC as ReturnRequest, U as InvoiceRequest, V as InvoiceResult, A as Address, aP as Theme, a6 as Page, $ as Menu, b as Article, aO as StorefrontErrorCode, T as InsufficientStockLine, a1 as Money, d as AvailabilityStatus, n as CartLineProblem, c as Availability, au as ProductVariant, L as DeclineCode, am as PaymentVoucher, ah as PaymentNextStep, p as CartPromotions, aw as PromotionReward, N as DeliveryMethod, aQ as UnavailableRateProvider } from './types-COSwo4ND.js';
|
|
4
|
+
export { e as CartBuyer, g as CartCost, h as CartDelivery, i as CartDiscountCode, j as CartDiscountLine, k as CartLine, m as CartLineMerchandise, q as CartRecommendation, s as CheckoutInfo, u as CheckoutPayment, P as Facet, Q as FacetValue, R as Image, S as InsufficientStockDetails, X as LocationContacts, Y as LocationKind, _ as LocationPickup, a0 as MenuItem, a2 as MoneyRange, a5 as OrderLine, a7 as PageInfo, a8 as PaymentAction, aa as PaymentAttemptStatus, ab as PaymentClient, ac as PaymentClientCsp, ae as PaymentFlow, af as PaymentMethod, ai as PaymentOption, aj as PaymentOptionKey, ak as PaymentPoint, an as PickupOption, ap as ProductAttributeValue, aq as ProductCategory, as as ProductOption, av as PromotionAnnouncement, ax as PromotionTier, aE as SEO, aF as Section, aG as SelectedOption, aH as ShippingRate, aJ as ShopBranch, aK as ShopContact, aL as ShopPolicies, aN as StorefrontErrorBody } from './types-COSwo4ND.js';
|
|
5
5
|
|
|
6
6
|
type QueryValue = string | number | boolean | null | undefined;
|
|
7
7
|
type QueryParams = Record<string, QueryValue | QueryValue[]>;
|
|
@@ -270,6 +270,21 @@ declare function createStorefrontClient(config: StorefrontClientOptions): {
|
|
|
270
270
|
requestOtp: (identifier: CustomerIdentifier, options?: WriteOptions) => Promise<void>;
|
|
271
271
|
/** Exchanges the code for a buyer session (`token` goes in `customerToken`). */
|
|
272
272
|
createSession: (input: CustomerSessionInput, options?: WriteOptions) => Promise<CustomerSession>;
|
|
273
|
+
/** What the store supports (password login, email verification, OTP channels). Drives which forms to show. */
|
|
274
|
+
capabilities: (options?: RequestOptions) => Promise<CustomerCapabilities>;
|
|
275
|
+
/**
|
|
276
|
+
* Creates an account with email + password. `verification_required` (202): a code was emailed, finish with
|
|
277
|
+
* `verifyRegistration`. `created` (201): the account exists and `session` is ready. `409` when the email is taken.
|
|
278
|
+
*/
|
|
279
|
+
register: (input: CustomerRegisterInput, options?: WriteOptions) => Promise<CustomerRegisterResult>;
|
|
280
|
+
/** Confirms the emailed registration code and returns the new buyer session. */
|
|
281
|
+
verifyRegistration: (input: CustomerVerifyRegistrationInput, options?: WriteOptions) => Promise<CustomerSession>;
|
|
282
|
+
/** Email + password login. `401` for wrong credentials. */
|
|
283
|
+
loginWithPassword: (input: CustomerPasswordLoginInput, options?: WriteOptions) => Promise<CustomerSession>;
|
|
284
|
+
/** Sets or changes the password of the signed-in buyer (`options.customerToken`, or a `withCustomerToken` client). */
|
|
285
|
+
setPassword: (input: CustomerSetPasswordInput, options?: WriteOptions) => Promise<void>;
|
|
286
|
+
/** Resets a forgotten password with the code from `requestOtp({ email })`. */
|
|
287
|
+
resetPassword: (input: CustomerResetPasswordInput, options?: WriteOptions) => Promise<void>;
|
|
273
288
|
get: (options?: RequestOptions) => Promise<Customer>;
|
|
274
289
|
orders: (params?: PaginationParams, options?: RequestOptions) => Promise<Connection<Order>>;
|
|
275
290
|
/** `null` when the order does not exist or belongs to someone else. */
|
|
@@ -677,4 +692,4 @@ type DeliveryNotices = {
|
|
|
677
692
|
/** Splits `delivery.unavailable` into the `missing_weight` notice and the generic one. */
|
|
678
693
|
declare function deliveryNotices(delivery: Pick<DeliveryOptions, 'unavailable' | 'partial'> | null | undefined): DeliveryNotices;
|
|
679
694
|
|
|
680
|
-
export { 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, CustomerIdentifier, CustomerSession, CustomerSessionInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, Order, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorKind, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, hreflangLinks, isStorefrontError, isTokenPublishable, negotiateLocale, normalizeClientIp, normalizeNote, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, resolveAvailability, rewardLabel, safeHttpsUrl, schemaAvailability, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
|
695
|
+
export { Address, AddressInput, Article, type ArticleListParams, Availability, type AvailabilityLocale, type AvailabilityMessageKey, type AvailabilityMessages, AvailabilityStatus, type AvailabilityTone, type AvailabilityView, type AvailabilityViewOptions, CLIENT_IP_HEADER, COUNTRY_HEADERS, Cart, CartBuyerInput, CartLineInput, CartLineProblem, type CartLineProblemView, CartLineUpdateInput, CartPromotions, CartRecommendations, CheckoutInput, CheckoutResult, Collection, type CollectionListParams, Connection, Customer, CustomerCapabilities, CustomerIdentifier, CustomerPasswordLoginInput, CustomerRegisterInput, CustomerRegisterResult, CustomerResetPasswordInput, CustomerSession, CustomerSessionInput, CustomerSetPasswordInput, CustomerVerifyRegistrationInput, DeclineCode, type DeliveryChoice, type DeliveryChoiceKind, DeliveryInput, DeliveryMethod, type DeliveryNotices, DeliveryOptions, type DiscountBarState, type DiscountBarView, type FetchLike, type FormatMoneyOptions, GeoPoint, InsufficientStockLine, InvoiceRequest, InvoiceResult, Location, LocationListParams, MISSING_WEIGHT, type MarketInfo, type MarketSuggestion, Menu, Money, NOTE_MAX_LENGTH, NearestLocation, Order, Page, type PaginationParams, PaymentAttemptResult, PaymentConfig, type PaymentErrorKind, type PaymentErrorView, type PaymentLocale, type PaymentMessageKey, type PaymentMessages, PaymentMethods, PaymentNextStep, type PaymentOutcome, type PaymentOutcomeKind, PaymentSubmitInput, PaymentVoucher, type PreviewOptions, Product, ProductConnection, type ProductListParams, ProductSort, ProductVariant, type PromoProgressView, type PromotionLocale, type PromotionMessageKey, type PromotionMessages, PromotionReward, PromotionsList, type QueryParams, type QueryValue, RecommendationPlacement, type RequestOptions, type ResolveAvailabilityOptions, RestockSubscriptionInput, RestockSubscriptionResult, ReturnRequest, ReturnRequestInput, type ShippingBarState, type ShippingBarView, Shop, StockLevel, type StorefrontClient, type StorefrontClientOptions, StorefrontError, StorefrontErrorCode, type StorefrontErrorInit, type StorefrontRequestContext, type StorefrontResponseContext, Theme, UnavailableRateProvider, type WriteOptions, appendParams, availabilityLocale, availabilityMessages, availabilityView, cartLineProblemView, clampPercent, createStorefrontClient, declineMessage, declineMessageKey, deliveryInput, deliveryNotices, formatAvailabilityMessage, formatMoney, formatVoucherExpiry, generateIdempotencyKey, hreflangLinks, isStorefrontError, isTokenPublishable, negotiateLocale, normalizeClientIp, normalizeNote, parseDelivery, parseMoney, parseProductFilters, paymentErrorView, paymentIdempotencyKey, paymentMessages, paymentOutcome, preferredLanguages, productAvailability, productListQuery, promoProgressView, promotionMessages, resolveAvailability, rewardLabel, safeHttpsUrl, schemaAvailability, storefrontDomainHeader, suggestMarket, toMoney, visitorCountry };
|
package/dist/index.js
CHANGED
|
@@ -380,6 +380,24 @@ function createStorefrontClient(config) {
|
|
|
380
380
|
requestOtp: (identifier, options) => write("POST", "/storefront/customer/otp", identifier, options),
|
|
381
381
|
/** Exchanges the code for a buyer session (`token` goes in `customerToken`). */
|
|
382
382
|
createSession: (input, options) => write("POST", "/storefront/customer/session", input, options),
|
|
383
|
+
/** What the store supports (password login, email verification, OTP channels). Drives which forms to show. */
|
|
384
|
+
capabilities: (options) => get("/storefront/customer/capabilities", void 0, options),
|
|
385
|
+
/**
|
|
386
|
+
* Creates an account with email + password. `verification_required` (202): a code was emailed, finish with
|
|
387
|
+
* `verifyRegistration`. `created` (201): the account exists and `session` is ready. `409` when the email is taken.
|
|
388
|
+
*/
|
|
389
|
+
register: async (input, options) => {
|
|
390
|
+
const res = await write("POST", "/storefront/customer/register", input, options);
|
|
391
|
+
return res && "token" in res ? { status: "created", session: res } : { status: "verification_required" };
|
|
392
|
+
},
|
|
393
|
+
/** Confirms the emailed registration code and returns the new buyer session. */
|
|
394
|
+
verifyRegistration: (input, options) => write("POST", "/storefront/customer/register/verify", input, options),
|
|
395
|
+
/** Email + password login. `401` for wrong credentials. */
|
|
396
|
+
loginWithPassword: (input, options) => write("POST", "/storefront/customer/login", input, options),
|
|
397
|
+
/** Sets or changes the password of the signed-in buyer (`options.customerToken`, or a `withCustomerToken` client). */
|
|
398
|
+
setPassword: (input, options) => write("PUT", "/storefront/customer/password", input, options),
|
|
399
|
+
/** Resets a forgotten password with the code from `requestOtp({ email })`. */
|
|
400
|
+
resetPassword: (input, options) => write("POST", "/storefront/customer/password/reset", input, options),
|
|
383
401
|
get: (options) => get("/storefront/customer", void 0, options),
|
|
384
402
|
orders: (params, options) => get("/storefront/customer/orders", params, options),
|
|
385
403
|
/** `null` when the order does not exist or belongs to someone else. */
|