@misiki/gocommerce-connector 0.29.0 → 0.30.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 +1 -0
- package/dist/{index-DOlNI60Y.d.cts → index-BdXhbm20.d.cts} +134 -3
- package/dist/{index-DOlNI60Y.d.ts → index-BdXhbm20.d.ts} +134 -3
- package/dist/index.cjs +184 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +184 -24
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +182 -23
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +182 -23
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,6 +160,7 @@ down stays best-effort: the storefront renders from its static record.
|
|
|
160
160
|
| contact form, product enquiries | `/x/contact/messages`, with the form's hidden `website` honeypot passed on so the engine drops what a bot filled in |
|
|
161
161
|
| search words, type-ahead (plugin on) | `/x/meilisearch/search`, falling back to the engine's own search when it is off or down |
|
|
162
162
|
| store record | the storefront's own config, with the engine's currency, menus and module switches over it; the store's own logo, dark logo and icon (`logo_url`, `logo_dark_url`, `icon_url` from `/api/store`, D148) replace `logo`, `logoDark` and `favicon` when it has them; for the contact page (D156), the address once the store shows it (as `address: { street, city, state, pincode, country }`), `mapLocation` and `openingHours` when set, `businessCountry` (the store's ISO country, for the phone's country code), the `whatsapp-chat` plugin's number as `plugins.whatsappChatButton`, and Google Customer Reviews (ext/google-reviews) as `plugins.googleReviewsOptIn` (`active` while the survey is on), `plugins.googleStoreWidget` (`{ active, position: 'RIGHT_BOTTOM' \| 'LEFT_BOTTOM' }`, off without the survey), and the `criteo` plugin's account as `plugins.criteo: { active, accountId }` (the engine decides, never the static record) |
|
|
163
|
+
| store closed, or behind a password (D170) | `store-close` in `/api/plugins`: the store record's `closed` is `{ message, password }` while it is on, `password` saying whether the store has one (never what it is), and absent while the store is open, whatever the static record says and even when the rest of the record fails. When the plugin list itself cannot be read, the last answer stands; with none yet, the store reads as open. Through `POST /api/store/password`, `storeService.unlockStore(password, { clientAddress })` trims what was typed and answers `{ outcome: 'unlocked', pass: { token, expiresAt } }`, or an `outcome` of `wrong`, `throttled` (the engine allows 20 tries an hour), `open` (the store takes no password now) or `unavailable`, and never throws. It sends `clientAddress`, the shopper's, as `X-Forwarded-For` when it is one IP address, so shoppers behind one storefront do not share those tries; the engine believes it only from a server in its `GOCOMMERCE_TRUSTED_PROXIES`. `storeService.checkStorePass(token)` checks a pass without spending a try: the pass, or null when it is wrong, expired or ended by a new password, and it throws the `GoCommerceError` when the engine cannot answer |
|
|
163
164
|
| resized product pictures | `/images/{store}/cdn-cgi/image/width=…/…` — the store record's `plugins.imageCdn` is turned on with provider `cloudflare` and the engine's `images_path` (from `/api/store`, D139) after `PUBLIC_GOCOMMERCE_API_URL`, so the storefront's srcset asks the engine for each width; an engine without it leaves the static record's setting |
|
|
164
165
|
|
|
165
166
|
Blogs, banners, reels, chat, warranties, deals and uploads have no engine
|
|
@@ -297,6 +297,8 @@ type CartOffer = {
|
|
|
297
297
|
free_shipping?: boolean;
|
|
298
298
|
remaining?: Money;
|
|
299
299
|
reason?: string;
|
|
300
|
+
/** Checkout applies it by itself when no code is typed (D179); absent on an engine before it. */
|
|
301
|
+
auto_apply?: boolean;
|
|
300
302
|
};
|
|
301
303
|
/** How far a basket is from free delivery (D133). */
|
|
302
304
|
type FreeShipping = {
|
|
@@ -423,6 +425,24 @@ type CheckoutOptions = {
|
|
|
423
425
|
}[];
|
|
424
426
|
currency: string;
|
|
425
427
|
};
|
|
428
|
+
/** What checkout would charge for a cart now, placing nothing (D185). */
|
|
429
|
+
type CheckoutQuote = {
|
|
430
|
+
subtotal: Money;
|
|
431
|
+
shipping: Money;
|
|
432
|
+
shipping_method?: string;
|
|
433
|
+
/** The code checkout took off; `auto_applied` when the shopper typed none and checkout chose it (D179). */
|
|
434
|
+
discount: {
|
|
435
|
+
code: string;
|
|
436
|
+
title: string;
|
|
437
|
+
auto_applied: boolean;
|
|
438
|
+
amount: Money;
|
|
439
|
+
free_shipping?: boolean;
|
|
440
|
+
} | null;
|
|
441
|
+
tax: Money;
|
|
442
|
+
tax_inclusive: boolean;
|
|
443
|
+
payment_fee: Money;
|
|
444
|
+
total: Money;
|
|
445
|
+
};
|
|
426
446
|
type ShippingRate = {
|
|
427
447
|
rate_id: number;
|
|
428
448
|
name: string;
|
|
@@ -594,6 +614,11 @@ type OpeningHours = {
|
|
|
594
614
|
opens: string;
|
|
595
615
|
closes: string;
|
|
596
616
|
};
|
|
617
|
+
/** `POST /api/store/password` (D170): a closed store's pass, from its password or a pass still good. */
|
|
618
|
+
type StorePassAnswer = {
|
|
619
|
+
token: string;
|
|
620
|
+
expires_at: string;
|
|
621
|
+
};
|
|
597
622
|
type Vendor = {
|
|
598
623
|
id: number;
|
|
599
624
|
slug: string;
|
|
@@ -1453,6 +1478,27 @@ declare function toCartOffer(o: CartOffer, currency: string): {
|
|
|
1453
1478
|
amount: number | null;
|
|
1454
1479
|
remaining: number | null;
|
|
1455
1480
|
reason: string;
|
|
1481
|
+
autoApply: boolean;
|
|
1482
|
+
};
|
|
1483
|
+
/**
|
|
1484
|
+
* A checkout quote under the names `toOrder` gives the order it becomes, so a
|
|
1485
|
+
* page shows the two the same way.
|
|
1486
|
+
*/
|
|
1487
|
+
declare function toCheckoutQuote(q: CheckoutQuote): {
|
|
1488
|
+
subtotal: number;
|
|
1489
|
+
shippingCharges: number;
|
|
1490
|
+
shippingMethod: string | null;
|
|
1491
|
+
discount: number;
|
|
1492
|
+
coupon: {
|
|
1493
|
+
code: string;
|
|
1494
|
+
title: string;
|
|
1495
|
+
autoApplied: boolean;
|
|
1496
|
+
freeShipping: boolean;
|
|
1497
|
+
} | null;
|
|
1498
|
+
tax: number;
|
|
1499
|
+
taxIncluded: boolean;
|
|
1500
|
+
codCharges: number;
|
|
1501
|
+
total: number;
|
|
1456
1502
|
};
|
|
1457
1503
|
declare function toFreeShipping(f: FreeShipping): {
|
|
1458
1504
|
qualifies: boolean;
|
|
@@ -3856,6 +3902,7 @@ declare class CartService extends BaseService {
|
|
|
3856
3902
|
amount: number | null;
|
|
3857
3903
|
remaining: number | null;
|
|
3858
3904
|
reason: string;
|
|
3905
|
+
autoApply: boolean;
|
|
3859
3906
|
}[]>;
|
|
3860
3907
|
/**
|
|
3861
3908
|
* How far the bag is from free delivery (D133), read from the store's own
|
|
@@ -4618,6 +4665,7 @@ declare const customizerService: CustomizerService;
|
|
|
4618
4665
|
* the order page shows `payment_status` once the webhook has landed.
|
|
4619
4666
|
*/
|
|
4620
4667
|
declare class CheckoutService extends BaseService {
|
|
4668
|
+
private expected;
|
|
4621
4669
|
/** Delivery options for the address on the cart: `{ data: [{ id, name, base_rate }] }`. */
|
|
4622
4670
|
getShippingRates({ cartId }?: {
|
|
4623
4671
|
cartId?: string;
|
|
@@ -4844,6 +4892,45 @@ declare class CheckoutService extends BaseService {
|
|
|
4844
4892
|
}[];
|
|
4845
4893
|
currency: string;
|
|
4846
4894
|
}>;
|
|
4895
|
+
/**
|
|
4896
|
+
* What checkout would charge for the cart now, by the storefront's method
|
|
4897
|
+
* code (`COD`, `RAZORPAY`, `PAYPAL`) or none yet (D185). Null until the
|
|
4898
|
+
* address step has stored an address, and null from an engine before D185.
|
|
4899
|
+
*
|
|
4900
|
+
* A refusal is checkout's own: the same GoCommerceError, with the same
|
|
4901
|
+
* message, that placing the order would raise now.
|
|
4902
|
+
*/
|
|
4903
|
+
getQuote({ cartId, method }?: {
|
|
4904
|
+
cartId?: string;
|
|
4905
|
+
method?: string;
|
|
4906
|
+
}): Promise<{
|
|
4907
|
+
subtotal: number;
|
|
4908
|
+
shippingCharges: number;
|
|
4909
|
+
shippingMethod: string | null;
|
|
4910
|
+
discount: number;
|
|
4911
|
+
coupon: {
|
|
4912
|
+
code: string;
|
|
4913
|
+
title: string;
|
|
4914
|
+
autoApplied: boolean;
|
|
4915
|
+
freeShipping: boolean;
|
|
4916
|
+
} | null;
|
|
4917
|
+
tax: number;
|
|
4918
|
+
taxIncluded: boolean;
|
|
4919
|
+
codCharges: number;
|
|
4920
|
+
total: number;
|
|
4921
|
+
} | null>;
|
|
4922
|
+
/**
|
|
4923
|
+
* The total on screen as the shopper confirms, from getQuote, or null when nothing was quoted
|
|
4924
|
+
* (D185). Every order placed for the cart then carries it, and checkout refuses one whose own
|
|
4925
|
+
* total differs instead of charging it: `onChange` gets checkout's figures now and the sentence
|
|
4926
|
+
* the placing call fails with.
|
|
4927
|
+
*/
|
|
4928
|
+
expectTotal({ cartId, total, onChange, }: {
|
|
4929
|
+
cartId?: string;
|
|
4930
|
+
total?: number | null;
|
|
4931
|
+
onChange?: Expected['onChange'];
|
|
4932
|
+
}): void;
|
|
4933
|
+
private storedCheckout;
|
|
4847
4934
|
private redirectGateway;
|
|
4848
4935
|
/**
|
|
4849
4936
|
* One checkout attempt.
|
|
@@ -4859,6 +4946,10 @@ declare class CheckoutService extends BaseService {
|
|
|
4859
4946
|
}
|
|
4860
4947
|
/** The engine's gateways that take payment on their own hosted page. */
|
|
4861
4948
|
declare const REDIRECT_GATEWAYS: Set<string>;
|
|
4949
|
+
type Expected = {
|
|
4950
|
+
total: number;
|
|
4951
|
+
onChange?: (quote: ReturnType<typeof toCheckoutQuote>, message: string) => void;
|
|
4952
|
+
};
|
|
4862
4953
|
declare const checkoutService: CheckoutService;
|
|
4863
4954
|
|
|
4864
4955
|
declare class PaymentMethodService extends BaseService {
|
|
@@ -4893,8 +4984,9 @@ declare const paymentMethodService: PaymentMethodService;
|
|
|
4893
4984
|
* `cartService.applyCoupon`.
|
|
4894
4985
|
*
|
|
4895
4986
|
* The drawer's shape: `amount` is the percentage or the amount,
|
|
4896
|
-
* `minAmount` the bag it needs,
|
|
4897
|
-
* still missing
|
|
4987
|
+
* `minAmount` the bag it needs, `description` says what is
|
|
4988
|
+
* still missing, and `autoApply` marks a code checkout applies by
|
|
4989
|
+
* itself (D179).
|
|
4898
4990
|
*/
|
|
4899
4991
|
declare class CouponService extends BaseService {
|
|
4900
4992
|
listCoupons(_args?: Record<string, unknown>): Promise<{
|
|
@@ -4908,6 +5000,7 @@ declare class CouponService extends BaseService {
|
|
|
4908
5000
|
description: string;
|
|
4909
5001
|
applies: boolean;
|
|
4910
5002
|
remaining: number | null;
|
|
5003
|
+
autoApply: boolean;
|
|
4911
5004
|
}[];
|
|
4912
5005
|
count: number;
|
|
4913
5006
|
pageSize: number;
|
|
@@ -6549,9 +6642,11 @@ declare class StoreService extends BaseService {
|
|
|
6549
6642
|
storeId?: string;
|
|
6550
6643
|
domain?: string;
|
|
6551
6644
|
}): Promise<{
|
|
6645
|
+
closed: StoreClosed | undefined;
|
|
6552
6646
|
id: any;
|
|
6553
6647
|
}>;
|
|
6554
6648
|
getStore(storeId?: string): Promise<{
|
|
6649
|
+
closed: StoreClosed | undefined;
|
|
6555
6650
|
id: any;
|
|
6556
6651
|
}>;
|
|
6557
6652
|
/**
|
|
@@ -6568,9 +6663,39 @@ declare class StoreService extends BaseService {
|
|
|
6568
6663
|
* that list lives here.
|
|
6569
6664
|
*/
|
|
6570
6665
|
post<T = any>(path: string, data?: unknown): Promise<T>;
|
|
6666
|
+
/**
|
|
6667
|
+
* A closed store's password (D170), traded for a pass. Never throws. The
|
|
6668
|
+
* engine allows 20 tries an hour per client, and sees this server as the
|
|
6669
|
+
* client unless `clientAddress`, the shopper's, travels as `X-Forwarded-For`.
|
|
6670
|
+
*/
|
|
6671
|
+
unlockStore(password: string, { clientAddress }?: {
|
|
6672
|
+
clientAddress?: string;
|
|
6673
|
+
}): Promise<StoreUnlock>;
|
|
6674
|
+
/**
|
|
6675
|
+
* A pass checked without spending a try: the pass, or null when it is wrong,
|
|
6676
|
+
* expired, ended by a new password, or the store takes none now. Throws when
|
|
6677
|
+
* the engine cannot say.
|
|
6678
|
+
*/
|
|
6679
|
+
checkStorePass(token: string): Promise<StorePass | null>;
|
|
6680
|
+
private storePass;
|
|
6571
6681
|
private live;
|
|
6572
6682
|
}
|
|
6573
6683
|
declare const storeService: StoreService;
|
|
6684
|
+
/** A store its owner closed (D170): the message to show, and whether a password lets a visitor in. */
|
|
6685
|
+
type StoreClosed = {
|
|
6686
|
+
message: string;
|
|
6687
|
+
password: boolean;
|
|
6688
|
+
};
|
|
6689
|
+
type StorePass = {
|
|
6690
|
+
token: string;
|
|
6691
|
+
expiresAt: Date;
|
|
6692
|
+
};
|
|
6693
|
+
type StoreUnlock = {
|
|
6694
|
+
outcome: 'unlocked';
|
|
6695
|
+
pass: StorePass;
|
|
6696
|
+
} | {
|
|
6697
|
+
outcome: 'wrong' | 'throttled' | 'open' | 'unavailable';
|
|
6698
|
+
};
|
|
6574
6699
|
|
|
6575
6700
|
/**
|
|
6576
6701
|
* Content pages from ext/cms, in the shopper's language with the store's
|
|
@@ -6663,6 +6788,7 @@ type LayoutCollection = {
|
|
|
6663
6788
|
slug: string;
|
|
6664
6789
|
link: string;
|
|
6665
6790
|
image: string | null;
|
|
6791
|
+
description: string | null;
|
|
6666
6792
|
};
|
|
6667
6793
|
/**
|
|
6668
6794
|
* One section of a composed page. `settings` is the merchant's, as validated
|
|
@@ -6908,21 +7034,26 @@ declare class PluginService extends BaseService {
|
|
|
6908
7034
|
/** The store record again, for the callers that ask for it as "settings" or "init". */
|
|
6909
7035
|
declare class SettingService extends BaseService {
|
|
6910
7036
|
fetchSettings(_args?: Record<string, unknown>): Promise<{
|
|
7037
|
+
closed: StoreClosed | undefined;
|
|
6911
7038
|
id: any;
|
|
6912
7039
|
}>;
|
|
6913
7040
|
list(args?: Record<string, unknown>): Promise<{
|
|
7041
|
+
closed: StoreClosed | undefined;
|
|
6914
7042
|
id: any;
|
|
6915
7043
|
}>;
|
|
6916
7044
|
}
|
|
6917
7045
|
declare class InitService extends SettingService {
|
|
6918
7046
|
fetchInit(_args?: Record<string, unknown>): Promise<{
|
|
6919
7047
|
storeOne: {
|
|
7048
|
+
closed: StoreClosed | undefined;
|
|
6920
7049
|
id: any;
|
|
6921
7050
|
};
|
|
6922
7051
|
store: {
|
|
7052
|
+
closed: StoreClosed | undefined;
|
|
6923
7053
|
id: any;
|
|
6924
7054
|
};
|
|
6925
7055
|
settings: {
|
|
7056
|
+
closed: StoreClosed | undefined;
|
|
6926
7057
|
id: any;
|
|
6927
7058
|
};
|
|
6928
7059
|
}>;
|
|
@@ -7999,4 +8130,4 @@ declare class B2bService extends BaseService {
|
|
|
7999
8130
|
}
|
|
8000
8131
|
declare const b2bService: B2bService;
|
|
8001
8132
|
|
|
8002
|
-
export {
|
|
8133
|
+
export { type Faq as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type Company as D, type CompanyOrder as E, ContactService as F, CountryService as G, CouponService as H, type Credentials as I, type Credit as J, CurrencyService as K, type Customer as L, type CustomizerDesign as M, type CustomizerDocument as N, type CustomizerEditor as O, type CustomizerFile as P, type CustomizerLayer as Q, type CustomizerSavedDesign as R, CustomizerService as S, type CustomizerSetup as T, type CustomizerUpload as U, DealService as V, DemoRequestService as W, type EngineRequest as X, EnquiryService as Y, type Envelope as Z, type FacetValue as _, type Address as a, type SiteChrome as a$, FaqService as a0, FeedbackService as a1, type FooterSettings as a2, type FreeShipping as a3, type Fulfillment as a4, GalleryService as a5, type GooglePlace as a6, type GoogleReview as a7, GoogleReviewService as a8, type GoogleReviews as a9, type PageLayout as aA, PageService as aB, type PaymentIntent as aC, PaymentMethodService as aD, type Plugin as aE, PluginService as aF, PopularSearchService as aG, PopularityService as aH, type Postcode as aI, type Product as aJ, type ProductFacets as aK, type ProductOption as aL, ProductService as aM, ProfileService as aN, type Quote as aO, REDIRECT_GATEWAYS as aP, ReelsService as aQ, RegionService as aR, type RejectedLine as aS, type Review as aT, type ReviewPage as aU, ReviewService as aV, type SearchDoc as aW, type SearchResult as aX, SearchService as aY, SettingService as aZ, type ShippingRate as a_, type GoogleSurvey as aa, type HeaderSettings as ab, type HomeLayout as ac, type HomeLayoutSection as ad, HomeService as ae, type IdentityAddress as af, InitService as ag, type Invitation as ah, type LayoutCollection as ai, type LayoutPage as aj, LayoutService as ak, type Lead as al, type ListMeta as am, MeilisearchService as an, type Member as ao, type Menu as ap, type MenuItem as aq, MenuService as ar, type MenuSummary as as, type Money as at, NewsletterService as au, type Offer as av, type OpeningHours as aw, type Order as ax, type OrderLine as ay, OrderService as az, AddressService as b, layoutService as b$, type SiteFooter as b0, type SiteHeader as b1, type SocialLink as b2, StateService as b3, type StoreClosed as b4, type StorePass as b5, type StorePassAnswer as b6, type StoreProfile as b7, StoreService as b8, type StoreUnlock as b9, bannerService as bA, blogService as bB, cartService as bC, categoryService as bD, chatService as bE, checkoutService as bF, collectionService as bG, contactService as bH, countryService as bI, couponService as bJ, currencyExponent as bK, currencyService as bL, customizerService as bM, dealService as bN, demoRequestService as bO, emptyCart as bP, emptyPage as bQ, enquiryService as bR, faqService as bS, feedbackService as bT, fromEngineAddress as bU, fromIdentityAddress as bV, fromSearchDoc as bW, galleryService as bX, googleReviewService as bY, homeService as bZ, initService as b_, type StorefrontCategory as ba, type StorefrontMenu as bb, type StorefrontOrder as bc, type StorefrontProduct as bd, type ThemeSettings as be, type ThemeSettingsResult as bf, UploadService as bg, UserService as bh, type Variant as bi, type VariantImage as bj, VariantService as bk, VarniCustomDesignService as bl, VarniCustomProductService as bm, type Vendor as bn, VendorService as bo, WarrantyService as bp, type WhatsappConsent as bq, type WhatsappConsentOffer as br, WhatsappService as bs, type Wishlist as bt, type WishlistItem as bu, WishlistService as bv, addressService as bw, authService as bx, autocompleteService as by, b2bService as bz, type AppliedDiscount as c, mediaUrl as c0, meilisearchService as c1, menuService as c2, minorToMajor as c3, newsletterService as c4, orderService as c5, ownDomain as c6, pageService as c7, paymentMethodService as c8, pluginService as c9, toCmsPage as cA, toCollection as cB, toEngineAddress as cC, toFreeShipping as cD, toIdentityAddress as cE, toMajor as cF, toMinor as cG, toOrder as cH, toPage as cI, toProduct as cJ, toRating as cK, toStorefrontFacets as cL, toUser as cM, toVariant as cN, toVendor as cO, uploadService as cP, userService as cQ, variantService as cR, varniCustomDesignService as cS, varniCustomProductService as cT, vendorService as cU, warrantyService as cV, whatsappService as cW, wishlistService as cX, pluginsService as ca, popularSearchService as cb, popularityService as cc, priceOf as cd, productImages as ce, productService as cf, productVideos as cg, profileService as ch, qs as ci, reelsService as cj, regionService as ck, reviewService as cl, searchService as cm, setRequestHost as cn, settingService as co, settingsService as cp, stateService as cq, staticStore as cr, storeForHost as cs, storeService as ct, toAddOn as cu, toCart as cv, toCartLine as cw, toCartOffer as cx, toCategory as cy, toCheckoutQuote as cz, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutQuote as u, type CheckoutResult as v, CheckoutService as w, type CmsPage as x, type Collection as y, CollectionService as z };
|
|
@@ -297,6 +297,8 @@ type CartOffer = {
|
|
|
297
297
|
free_shipping?: boolean;
|
|
298
298
|
remaining?: Money;
|
|
299
299
|
reason?: string;
|
|
300
|
+
/** Checkout applies it by itself when no code is typed (D179); absent on an engine before it. */
|
|
301
|
+
auto_apply?: boolean;
|
|
300
302
|
};
|
|
301
303
|
/** How far a basket is from free delivery (D133). */
|
|
302
304
|
type FreeShipping = {
|
|
@@ -423,6 +425,24 @@ type CheckoutOptions = {
|
|
|
423
425
|
}[];
|
|
424
426
|
currency: string;
|
|
425
427
|
};
|
|
428
|
+
/** What checkout would charge for a cart now, placing nothing (D185). */
|
|
429
|
+
type CheckoutQuote = {
|
|
430
|
+
subtotal: Money;
|
|
431
|
+
shipping: Money;
|
|
432
|
+
shipping_method?: string;
|
|
433
|
+
/** The code checkout took off; `auto_applied` when the shopper typed none and checkout chose it (D179). */
|
|
434
|
+
discount: {
|
|
435
|
+
code: string;
|
|
436
|
+
title: string;
|
|
437
|
+
auto_applied: boolean;
|
|
438
|
+
amount: Money;
|
|
439
|
+
free_shipping?: boolean;
|
|
440
|
+
} | null;
|
|
441
|
+
tax: Money;
|
|
442
|
+
tax_inclusive: boolean;
|
|
443
|
+
payment_fee: Money;
|
|
444
|
+
total: Money;
|
|
445
|
+
};
|
|
426
446
|
type ShippingRate = {
|
|
427
447
|
rate_id: number;
|
|
428
448
|
name: string;
|
|
@@ -594,6 +614,11 @@ type OpeningHours = {
|
|
|
594
614
|
opens: string;
|
|
595
615
|
closes: string;
|
|
596
616
|
};
|
|
617
|
+
/** `POST /api/store/password` (D170): a closed store's pass, from its password or a pass still good. */
|
|
618
|
+
type StorePassAnswer = {
|
|
619
|
+
token: string;
|
|
620
|
+
expires_at: string;
|
|
621
|
+
};
|
|
597
622
|
type Vendor = {
|
|
598
623
|
id: number;
|
|
599
624
|
slug: string;
|
|
@@ -1453,6 +1478,27 @@ declare function toCartOffer(o: CartOffer, currency: string): {
|
|
|
1453
1478
|
amount: number | null;
|
|
1454
1479
|
remaining: number | null;
|
|
1455
1480
|
reason: string;
|
|
1481
|
+
autoApply: boolean;
|
|
1482
|
+
};
|
|
1483
|
+
/**
|
|
1484
|
+
* A checkout quote under the names `toOrder` gives the order it becomes, so a
|
|
1485
|
+
* page shows the two the same way.
|
|
1486
|
+
*/
|
|
1487
|
+
declare function toCheckoutQuote(q: CheckoutQuote): {
|
|
1488
|
+
subtotal: number;
|
|
1489
|
+
shippingCharges: number;
|
|
1490
|
+
shippingMethod: string | null;
|
|
1491
|
+
discount: number;
|
|
1492
|
+
coupon: {
|
|
1493
|
+
code: string;
|
|
1494
|
+
title: string;
|
|
1495
|
+
autoApplied: boolean;
|
|
1496
|
+
freeShipping: boolean;
|
|
1497
|
+
} | null;
|
|
1498
|
+
tax: number;
|
|
1499
|
+
taxIncluded: boolean;
|
|
1500
|
+
codCharges: number;
|
|
1501
|
+
total: number;
|
|
1456
1502
|
};
|
|
1457
1503
|
declare function toFreeShipping(f: FreeShipping): {
|
|
1458
1504
|
qualifies: boolean;
|
|
@@ -3856,6 +3902,7 @@ declare class CartService extends BaseService {
|
|
|
3856
3902
|
amount: number | null;
|
|
3857
3903
|
remaining: number | null;
|
|
3858
3904
|
reason: string;
|
|
3905
|
+
autoApply: boolean;
|
|
3859
3906
|
}[]>;
|
|
3860
3907
|
/**
|
|
3861
3908
|
* How far the bag is from free delivery (D133), read from the store's own
|
|
@@ -4618,6 +4665,7 @@ declare const customizerService: CustomizerService;
|
|
|
4618
4665
|
* the order page shows `payment_status` once the webhook has landed.
|
|
4619
4666
|
*/
|
|
4620
4667
|
declare class CheckoutService extends BaseService {
|
|
4668
|
+
private expected;
|
|
4621
4669
|
/** Delivery options for the address on the cart: `{ data: [{ id, name, base_rate }] }`. */
|
|
4622
4670
|
getShippingRates({ cartId }?: {
|
|
4623
4671
|
cartId?: string;
|
|
@@ -4844,6 +4892,45 @@ declare class CheckoutService extends BaseService {
|
|
|
4844
4892
|
}[];
|
|
4845
4893
|
currency: string;
|
|
4846
4894
|
}>;
|
|
4895
|
+
/**
|
|
4896
|
+
* What checkout would charge for the cart now, by the storefront's method
|
|
4897
|
+
* code (`COD`, `RAZORPAY`, `PAYPAL`) or none yet (D185). Null until the
|
|
4898
|
+
* address step has stored an address, and null from an engine before D185.
|
|
4899
|
+
*
|
|
4900
|
+
* A refusal is checkout's own: the same GoCommerceError, with the same
|
|
4901
|
+
* message, that placing the order would raise now.
|
|
4902
|
+
*/
|
|
4903
|
+
getQuote({ cartId, method }?: {
|
|
4904
|
+
cartId?: string;
|
|
4905
|
+
method?: string;
|
|
4906
|
+
}): Promise<{
|
|
4907
|
+
subtotal: number;
|
|
4908
|
+
shippingCharges: number;
|
|
4909
|
+
shippingMethod: string | null;
|
|
4910
|
+
discount: number;
|
|
4911
|
+
coupon: {
|
|
4912
|
+
code: string;
|
|
4913
|
+
title: string;
|
|
4914
|
+
autoApplied: boolean;
|
|
4915
|
+
freeShipping: boolean;
|
|
4916
|
+
} | null;
|
|
4917
|
+
tax: number;
|
|
4918
|
+
taxIncluded: boolean;
|
|
4919
|
+
codCharges: number;
|
|
4920
|
+
total: number;
|
|
4921
|
+
} | null>;
|
|
4922
|
+
/**
|
|
4923
|
+
* The total on screen as the shopper confirms, from getQuote, or null when nothing was quoted
|
|
4924
|
+
* (D185). Every order placed for the cart then carries it, and checkout refuses one whose own
|
|
4925
|
+
* total differs instead of charging it: `onChange` gets checkout's figures now and the sentence
|
|
4926
|
+
* the placing call fails with.
|
|
4927
|
+
*/
|
|
4928
|
+
expectTotal({ cartId, total, onChange, }: {
|
|
4929
|
+
cartId?: string;
|
|
4930
|
+
total?: number | null;
|
|
4931
|
+
onChange?: Expected['onChange'];
|
|
4932
|
+
}): void;
|
|
4933
|
+
private storedCheckout;
|
|
4847
4934
|
private redirectGateway;
|
|
4848
4935
|
/**
|
|
4849
4936
|
* One checkout attempt.
|
|
@@ -4859,6 +4946,10 @@ declare class CheckoutService extends BaseService {
|
|
|
4859
4946
|
}
|
|
4860
4947
|
/** The engine's gateways that take payment on their own hosted page. */
|
|
4861
4948
|
declare const REDIRECT_GATEWAYS: Set<string>;
|
|
4949
|
+
type Expected = {
|
|
4950
|
+
total: number;
|
|
4951
|
+
onChange?: (quote: ReturnType<typeof toCheckoutQuote>, message: string) => void;
|
|
4952
|
+
};
|
|
4862
4953
|
declare const checkoutService: CheckoutService;
|
|
4863
4954
|
|
|
4864
4955
|
declare class PaymentMethodService extends BaseService {
|
|
@@ -4893,8 +4984,9 @@ declare const paymentMethodService: PaymentMethodService;
|
|
|
4893
4984
|
* `cartService.applyCoupon`.
|
|
4894
4985
|
*
|
|
4895
4986
|
* The drawer's shape: `amount` is the percentage or the amount,
|
|
4896
|
-
* `minAmount` the bag it needs,
|
|
4897
|
-
* still missing
|
|
4987
|
+
* `minAmount` the bag it needs, `description` says what is
|
|
4988
|
+
* still missing, and `autoApply` marks a code checkout applies by
|
|
4989
|
+
* itself (D179).
|
|
4898
4990
|
*/
|
|
4899
4991
|
declare class CouponService extends BaseService {
|
|
4900
4992
|
listCoupons(_args?: Record<string, unknown>): Promise<{
|
|
@@ -4908,6 +5000,7 @@ declare class CouponService extends BaseService {
|
|
|
4908
5000
|
description: string;
|
|
4909
5001
|
applies: boolean;
|
|
4910
5002
|
remaining: number | null;
|
|
5003
|
+
autoApply: boolean;
|
|
4911
5004
|
}[];
|
|
4912
5005
|
count: number;
|
|
4913
5006
|
pageSize: number;
|
|
@@ -6549,9 +6642,11 @@ declare class StoreService extends BaseService {
|
|
|
6549
6642
|
storeId?: string;
|
|
6550
6643
|
domain?: string;
|
|
6551
6644
|
}): Promise<{
|
|
6645
|
+
closed: StoreClosed | undefined;
|
|
6552
6646
|
id: any;
|
|
6553
6647
|
}>;
|
|
6554
6648
|
getStore(storeId?: string): Promise<{
|
|
6649
|
+
closed: StoreClosed | undefined;
|
|
6555
6650
|
id: any;
|
|
6556
6651
|
}>;
|
|
6557
6652
|
/**
|
|
@@ -6568,9 +6663,39 @@ declare class StoreService extends BaseService {
|
|
|
6568
6663
|
* that list lives here.
|
|
6569
6664
|
*/
|
|
6570
6665
|
post<T = any>(path: string, data?: unknown): Promise<T>;
|
|
6666
|
+
/**
|
|
6667
|
+
* A closed store's password (D170), traded for a pass. Never throws. The
|
|
6668
|
+
* engine allows 20 tries an hour per client, and sees this server as the
|
|
6669
|
+
* client unless `clientAddress`, the shopper's, travels as `X-Forwarded-For`.
|
|
6670
|
+
*/
|
|
6671
|
+
unlockStore(password: string, { clientAddress }?: {
|
|
6672
|
+
clientAddress?: string;
|
|
6673
|
+
}): Promise<StoreUnlock>;
|
|
6674
|
+
/**
|
|
6675
|
+
* A pass checked without spending a try: the pass, or null when it is wrong,
|
|
6676
|
+
* expired, ended by a new password, or the store takes none now. Throws when
|
|
6677
|
+
* the engine cannot say.
|
|
6678
|
+
*/
|
|
6679
|
+
checkStorePass(token: string): Promise<StorePass | null>;
|
|
6680
|
+
private storePass;
|
|
6571
6681
|
private live;
|
|
6572
6682
|
}
|
|
6573
6683
|
declare const storeService: StoreService;
|
|
6684
|
+
/** A store its owner closed (D170): the message to show, and whether a password lets a visitor in. */
|
|
6685
|
+
type StoreClosed = {
|
|
6686
|
+
message: string;
|
|
6687
|
+
password: boolean;
|
|
6688
|
+
};
|
|
6689
|
+
type StorePass = {
|
|
6690
|
+
token: string;
|
|
6691
|
+
expiresAt: Date;
|
|
6692
|
+
};
|
|
6693
|
+
type StoreUnlock = {
|
|
6694
|
+
outcome: 'unlocked';
|
|
6695
|
+
pass: StorePass;
|
|
6696
|
+
} | {
|
|
6697
|
+
outcome: 'wrong' | 'throttled' | 'open' | 'unavailable';
|
|
6698
|
+
};
|
|
6574
6699
|
|
|
6575
6700
|
/**
|
|
6576
6701
|
* Content pages from ext/cms, in the shopper's language with the store's
|
|
@@ -6663,6 +6788,7 @@ type LayoutCollection = {
|
|
|
6663
6788
|
slug: string;
|
|
6664
6789
|
link: string;
|
|
6665
6790
|
image: string | null;
|
|
6791
|
+
description: string | null;
|
|
6666
6792
|
};
|
|
6667
6793
|
/**
|
|
6668
6794
|
* One section of a composed page. `settings` is the merchant's, as validated
|
|
@@ -6908,21 +7034,26 @@ declare class PluginService extends BaseService {
|
|
|
6908
7034
|
/** The store record again, for the callers that ask for it as "settings" or "init". */
|
|
6909
7035
|
declare class SettingService extends BaseService {
|
|
6910
7036
|
fetchSettings(_args?: Record<string, unknown>): Promise<{
|
|
7037
|
+
closed: StoreClosed | undefined;
|
|
6911
7038
|
id: any;
|
|
6912
7039
|
}>;
|
|
6913
7040
|
list(args?: Record<string, unknown>): Promise<{
|
|
7041
|
+
closed: StoreClosed | undefined;
|
|
6914
7042
|
id: any;
|
|
6915
7043
|
}>;
|
|
6916
7044
|
}
|
|
6917
7045
|
declare class InitService extends SettingService {
|
|
6918
7046
|
fetchInit(_args?: Record<string, unknown>): Promise<{
|
|
6919
7047
|
storeOne: {
|
|
7048
|
+
closed: StoreClosed | undefined;
|
|
6920
7049
|
id: any;
|
|
6921
7050
|
};
|
|
6922
7051
|
store: {
|
|
7052
|
+
closed: StoreClosed | undefined;
|
|
6923
7053
|
id: any;
|
|
6924
7054
|
};
|
|
6925
7055
|
settings: {
|
|
7056
|
+
closed: StoreClosed | undefined;
|
|
6926
7057
|
id: any;
|
|
6927
7058
|
};
|
|
6928
7059
|
}>;
|
|
@@ -7999,4 +8130,4 @@ declare class B2bService extends BaseService {
|
|
|
7999
8130
|
}
|
|
8000
8131
|
declare const b2bService: B2bService;
|
|
8001
8132
|
|
|
8002
|
-
export {
|
|
8133
|
+
export { type Faq as $, type AddOn as A, type B2bPlaced as B, type Cart as C, type Company as D, type CompanyOrder as E, ContactService as F, CountryService as G, CouponService as H, type Credentials as I, type Credit as J, CurrencyService as K, type Customer as L, type CustomizerDesign as M, type CustomizerDocument as N, type CustomizerEditor as O, type CustomizerFile as P, type CustomizerLayer as Q, type CustomizerSavedDesign as R, CustomizerService as S, type CustomizerSetup as T, type CustomizerUpload as U, DealService as V, DemoRequestService as W, type EngineRequest as X, EnquiryService as Y, type Envelope as Z, type FacetValue as _, type Address as a, type SiteChrome as a$, FaqService as a0, FeedbackService as a1, type FooterSettings as a2, type FreeShipping as a3, type Fulfillment as a4, GalleryService as a5, type GooglePlace as a6, type GoogleReview as a7, GoogleReviewService as a8, type GoogleReviews as a9, type PageLayout as aA, PageService as aB, type PaymentIntent as aC, PaymentMethodService as aD, type Plugin as aE, PluginService as aF, PopularSearchService as aG, PopularityService as aH, type Postcode as aI, type Product as aJ, type ProductFacets as aK, type ProductOption as aL, ProductService as aM, ProfileService as aN, type Quote as aO, REDIRECT_GATEWAYS as aP, ReelsService as aQ, RegionService as aR, type RejectedLine as aS, type Review as aT, type ReviewPage as aU, ReviewService as aV, type SearchDoc as aW, type SearchResult as aX, SearchService as aY, SettingService as aZ, type ShippingRate as a_, type GoogleSurvey as aa, type HeaderSettings as ab, type HomeLayout as ac, type HomeLayoutSection as ad, HomeService as ae, type IdentityAddress as af, InitService as ag, type Invitation as ah, type LayoutCollection as ai, type LayoutPage as aj, LayoutService as ak, type Lead as al, type ListMeta as am, MeilisearchService as an, type Member as ao, type Menu as ap, type MenuItem as aq, MenuService as ar, type MenuSummary as as, type Money as at, NewsletterService as au, type Offer as av, type OpeningHours as aw, type Order as ax, type OrderLine as ay, OrderService as az, AddressService as b, layoutService as b$, type SiteFooter as b0, type SiteHeader as b1, type SocialLink as b2, StateService as b3, type StoreClosed as b4, type StorePass as b5, type StorePassAnswer as b6, type StoreProfile as b7, StoreService as b8, type StoreUnlock as b9, bannerService as bA, blogService as bB, cartService as bC, categoryService as bD, chatService as bE, checkoutService as bF, collectionService as bG, contactService as bH, countryService as bI, couponService as bJ, currencyExponent as bK, currencyService as bL, customizerService as bM, dealService as bN, demoRequestService as bO, emptyCart as bP, emptyPage as bQ, enquiryService as bR, faqService as bS, feedbackService as bT, fromEngineAddress as bU, fromIdentityAddress as bV, fromSearchDoc as bW, galleryService as bX, googleReviewService as bY, homeService as bZ, initService as b_, type StorefrontCategory as ba, type StorefrontMenu as bb, type StorefrontOrder as bc, type StorefrontProduct as bd, type ThemeSettings as be, type ThemeSettingsResult as bf, UploadService as bg, UserService as bh, type Variant as bi, type VariantImage as bj, VariantService as bk, VarniCustomDesignService as bl, VarniCustomProductService as bm, type Vendor as bn, VendorService as bo, WarrantyService as bp, type WhatsappConsent as bq, type WhatsappConsentOffer as br, WhatsappService as bs, type Wishlist as bt, type WishlistItem as bu, WishlistService as bv, addressService as bw, authService as bx, autocompleteService as by, b2bService as bz, type AppliedDiscount as c, mediaUrl as c0, meilisearchService as c1, menuService as c2, minorToMajor as c3, newsletterService as c4, orderService as c5, ownDomain as c6, pageService as c7, paymentMethodService as c8, pluginService as c9, toCmsPage as cA, toCollection as cB, toEngineAddress as cC, toFreeShipping as cD, toIdentityAddress as cE, toMajor as cF, toMinor as cG, toOrder as cH, toPage as cI, toProduct as cJ, toRating as cK, toStorefrontFacets as cL, toUser as cM, toVariant as cN, toVendor as cO, uploadService as cP, userService as cQ, variantService as cR, varniCustomDesignService as cS, varniCustomProductService as cT, vendorService as cU, warrantyService as cV, whatsappService as cW, wishlistService as cX, pluginsService as ca, popularSearchService as cb, popularityService as cc, priceOf as cd, productImages as ce, productService as cf, productVideos as cg, profileService as ch, qs as ci, reelsService as cj, regionService as ck, reviewService as cl, searchService as cm, setRequestHost as cn, settingService as co, settingsService as cp, stateService as cq, staticStore as cr, storeForHost as cs, storeService as ct, toAddOn as cu, toCart as cv, toCartLine as cw, toCartOffer as cx, toCategory as cy, toCheckoutQuote as cz, type Approval as d, type AuthResponse as e, AuthService as f, AutocompleteService as g, type B2bRole as h, B2bService as i, BannerService as j, BaseService as k, BlogService as l, type CartLine as m, type CartOffer as n, CartService as o, CatalogService as p, type Category as q, CategoryService as r, ChatService as s, type CheckoutOptions as t, type CheckoutQuote as u, type CheckoutResult as v, CheckoutService as w, type CmsPage as x, type Collection as y, CollectionService as z };
|