@misiki/gocommerce-connector 0.9.1 → 0.11.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 CHANGED
@@ -140,6 +140,7 @@ down stays best-effort: the storefront renders from its static record.
140
140
  | FAQ | `/x/faq` |
141
141
  | composed home page | `/x/layouts/home` (`?preview=` for a draft) — `layoutService.getHomeLayout()`, null when the store has none; carries `themeSettings` and each collection list's `collections` |
142
142
  | product and collection templates | `/x/layouts/product`, `/x/layouts/collection` (`?preview=` for a draft) — `layoutService.getProductLayout()` and `getCollectionLayout()`, the sections the shop arranged around the page's core (`main-product`, `main-collection`); null when none is published, and the page draws as before |
143
+ | header and footer | `/x/layouts/header`, `/x/layouts/footer` (`?preview=` for a draft) — `layoutService.getHeader()` and `getFooter()`: the announcement strip and header menu, the footer's columns menu, words, newsletter switch, social links and copyright line, with the named menu read live from `/x/navigation/menus/{handle}`; null when none is published or on any failure, and the storefront keeps its own. The store's `header` and `footer` menus (`menuService.engineMenus()`, the store record's `menu`) are the ones those name |
143
144
  | theme settings | `/x/layouts/theme` (`?preview=` for a draft) — `layoutService.getThemeSettings()`, the store's colours, fonts and rounding for every page; null when there are none |
144
145
  | menus | `/x/navigation/menus/{header,footer}`, laid over `store.menu`; any menu by handle |
145
146
  | product specs table | the product's category attribute answers |
@@ -225,13 +226,13 @@ Each of these is a real gap, listed so nobody has to find it in production.
225
226
  `checkoutService.checkout(code)` for a storefront that drives its own payment
226
227
  UI. Payment is confirmed by the gateway's webhook to the engine; the order
227
228
  shows `paymentStatus` once it lands.
228
- - **Attribute filters inside a category.** The engine filters by attribute on
229
- the whole-shop listing only; on a category page they are not applied.
229
+ - **Filters on an older engine.** Listing filters and their counts (tags,
230
+ vendor, product type, category attributes, price) need an engine that counts
231
+ them (`GET /api/products?facets=1`, D130). Against an older one the filter
232
+ rail is empty and a category page's attribute filters are not applied.
230
233
  - **Tax in the bag.** The engine's cart carries no tax or total; tax is computed
231
234
  when the order is placed. The bag shows subtotal − discount + delivery, and the
232
235
  order shows the real figures.
233
- - **Facets.** The engine's search returns hits and a total, not distributions, so
234
- category and tag facets and the price slider are not shown.
235
236
  - **Phone sign-in by code, account deletion, guest order lookup by email and
236
237
  code** are not engine features and throw.
237
238
 
@@ -109,6 +109,29 @@ type ListMeta = {
109
109
  offset: number;
110
110
  page: number;
111
111
  total_pages: number;
112
+ /** Only on `GET /api/products?facets=1`, from an engine that counts them (D130). */
113
+ facets?: ProductFacets;
114
+ };
115
+ type FacetValue = {
116
+ value: string;
117
+ count: number;
118
+ };
119
+ /** core/catalog_facets.go: counted over the whole listing, each group without its own selection. */
120
+ type ProductFacets = {
121
+ price: {
122
+ min: Money;
123
+ max: Money;
124
+ } | null;
125
+ tags: FacetValue[] | null;
126
+ vendors: FacetValue[] | null;
127
+ product_types: FacetValue[] | null;
128
+ categories: {
129
+ id: number;
130
+ slug: string;
131
+ title: string;
132
+ count: number;
133
+ }[] | null;
134
+ attributes: Record<string, FacetValue[]> | null;
112
135
  };
113
136
  type Envelope<T> = {
114
137
  data: T;
@@ -1327,6 +1350,16 @@ type CatalogQuery = {
1327
1350
  * are not applied.
1328
1351
  */
1329
1352
  attributes?: Record<string, string[]>;
1353
+ tags?: string[];
1354
+ vendors?: string[];
1355
+ productTypes?: string[];
1356
+ /**
1357
+ * Ask the engine to count the filter values too. Such a query goes to
1358
+ * `GET /api/products`, which then also answers the category, the price
1359
+ * range, the sort and every filter above (D130); an engine too old to count
1360
+ * them is asked the way it always was, and the page has no facets.
1361
+ */
1362
+ facets?: boolean;
1330
1363
  };
1331
1364
  type CatalogPage = {
1332
1365
  data: ReturnType<typeof toProduct>[] | ReturnType<typeof fromSearchDoc>[];
@@ -1340,17 +1373,8 @@ type CatalogPage = {
1340
1373
  }[];
1341
1374
  /** Whether the answer honoured `sort` and the price range, or had to drop them. */
1342
1375
  sorted: boolean;
1376
+ facets?: ProductFacets;
1343
1377
  };
1344
- /**
1345
- * One shelf of products, from whichever engine route can answer the question.
1346
- *
1347
- * - A category, no reordering: `GET /api/categories/{slug}`, which sells the
1348
- * category and its descendants.
1349
- * - A search or the whole shop, no reordering: `GET /api/products?q=`.
1350
- * - Any sort but newest, or a price range: the Meilisearch module, when it is
1351
- * installed and configured. Without it the shelf comes back in the engine's
1352
- * order with `sorted: false`, rather than failing or pretending.
1353
- */
1354
1378
  declare class CatalogService extends BaseService {
1355
1379
  protected readonly facts: StoreFacts;
1356
1380
  protected queryCatalog(q: CatalogQuery): Promise<CatalogPage>;
@@ -1968,14 +1992,39 @@ declare class ProductService extends CatalogService {
1968
1992
  }
1969
1993
  declare const productService: ProductService;
1970
1994
 
1995
+ /**
1996
+ * The engine's counts in the shape the storefront's filter rail reads. Each
1997
+ * `allFilters` key is also the URL parameter the rail writes when a value is
1998
+ * ticked, and `searchWithUrl` reads it back: `vendor`, `product_type` and
1999
+ * `attributes.<handle>`. Tags go to the rail's own tag group, written as `tags`.
2000
+ */
2001
+ declare function toStorefrontFacets(f?: ProductFacets | null): {
2002
+ priceStat: {
2003
+ min: number;
2004
+ max: number;
2005
+ } | {
2006
+ min?: undefined;
2007
+ max?: undefined;
2008
+ };
2009
+ categories: {
2010
+ name: string;
2011
+ slug: string;
2012
+ count: number;
2013
+ }[];
2014
+ tags: {
2015
+ name: string;
2016
+ count: number;
2017
+ }[];
2018
+ allFilters: Record<string, Record<string, number>>;
2019
+ };
1971
2020
  /**
1972
2021
  * The listing pages' search: `/products?search=&sort=&page=` and the category
1973
2022
  * catch-all `/{slug}`.
1974
2023
  *
1975
- * Facets are empty. The engine's search route returns hits and a total, not
1976
- * distributions, and a facet list made from one page of hits would count that
1977
- * page, not the shop. An empty `priceStat` hides the price slider rather than
1978
- * drawing one with a made-up range.
2024
+ * Facets come from the engine, counted over the whole listing rather than the
2025
+ * page (D130). An engine too old to count them leaves them empty, and an empty
2026
+ * `priceStat` hides the price slider rather than drawing one with a made-up
2027
+ * range.
1979
2028
  */
1980
2029
  declare class SearchService extends CatalogService {
1981
2030
  emptyResult(): {
@@ -1987,10 +2036,23 @@ declare class SearchService extends CatalogService {
1987
2036
  slug: string;
1988
2037
  }[];
1989
2038
  facets: {
1990
- priceStat: {};
1991
- categories: never[];
1992
- tags: never[];
1993
- allFilters: {};
2039
+ priceStat: {
2040
+ min: number;
2041
+ max: number;
2042
+ } | {
2043
+ min?: undefined;
2044
+ max?: undefined;
2045
+ };
2046
+ categories: {
2047
+ name: string;
2048
+ slug: string;
2049
+ count: number;
2050
+ }[];
2051
+ tags: {
2052
+ name: string;
2053
+ count: number;
2054
+ }[];
2055
+ allFilters: Record<string, Record<string, number>>;
1994
2056
  };
1995
2057
  };
1996
2058
  searchWithUrl(url: URL | string, slug?: string): Promise<{
@@ -2002,10 +2064,23 @@ declare class SearchService extends CatalogService {
2002
2064
  slug: string;
2003
2065
  }[];
2004
2066
  facets: {
2005
- priceStat: {};
2006
- categories: never[];
2007
- tags: never[];
2008
- allFilters: {};
2067
+ priceStat: {
2068
+ min: number;
2069
+ max: number;
2070
+ } | {
2071
+ min?: undefined;
2072
+ max?: undefined;
2073
+ };
2074
+ categories: {
2075
+ name: string;
2076
+ slug: string;
2077
+ count: number;
2078
+ }[];
2079
+ tags: {
2080
+ name: string;
2081
+ count: number;
2082
+ }[];
2083
+ allFilters: Record<string, Record<string, number>>;
2009
2084
  };
2010
2085
  } | {
2011
2086
  data: {
@@ -2154,10 +2229,23 @@ declare class SearchService extends CatalogService {
2154
2229
  slug: string;
2155
2230
  }[];
2156
2231
  facets: {
2157
- priceStat: {};
2158
- categories: never[];
2159
- tags: never[];
2160
- allFilters: {};
2232
+ priceStat: {
2233
+ min: number;
2234
+ max: number;
2235
+ } | {
2236
+ min?: undefined;
2237
+ max?: undefined;
2238
+ };
2239
+ categories: {
2240
+ name: string;
2241
+ slug: string;
2242
+ count: number;
2243
+ }[];
2244
+ tags: {
2245
+ name: string;
2246
+ count: number;
2247
+ }[];
2248
+ allFilters: Record<string, Record<string, number>>;
2161
2249
  };
2162
2250
  }>;
2163
2251
  }
@@ -5577,8 +5665,15 @@ declare class MenuService extends BaseService {
5577
5665
  listMenus(): Promise<MenuSummary[]>;
5578
5666
  /** One menu by handle, in the storefront's shape: `{ menuId, name, items: [{ id, name, link, items }] }`. */
5579
5667
  getMenu(handle: string): Promise<StorefrontMenu>;
5580
- /** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
5668
+ /**
5669
+ * The header and footer menus, or `null` when the module is not there. Cached: a menu is
5670
+ * store-level. Each is the menu the shop chose for it in the theme editor's header or footer
5671
+ * (GoCommerce D131), still under the `header` / `footer` id every storefront looks for, so the
5672
+ * choice reaches every place that draws one; the menus named so are the default.
5673
+ */
5581
5674
  engineMenus(): Promise<StorefrontMenu[] | null>;
5675
+ /** The handle of the menu the published header or footer names, else the part's own name. */
5676
+ private chosenMenu;
5582
5677
  }
5583
5678
  declare const menuService: MenuService;
5584
5679
 
@@ -5742,7 +5837,7 @@ type HomeLayoutSection = {
5742
5837
  * or `main-collection` (the collection's grid) — at the place the shop put
5743
5838
  * it, and the storefront draws its own core there.
5744
5839
  */
5745
- type LayoutPage = 'home' | 'product' | 'collection';
5840
+ type LayoutPage = 'home' | 'product' | 'collection' | 'header' | 'footer';
5746
5841
  type HomeLayout = {
5747
5842
  page: string;
5748
5843
  theme: string;
@@ -5762,6 +5857,50 @@ type ThemeSettingsResult = {
5762
5857
  preview: boolean;
5763
5858
  settings: ThemeSettings;
5764
5859
  };
5860
+ /**
5861
+ * The header's settings as the shop set them (ext/layouts, D131): the strip
5862
+ * above the header — shown or not, its words, its link, and whether it is on
5863
+ * every page or the home page only — and the handle of the menu across it.
5864
+ * Plain text, and a link that is `/path` or `http(s)://`.
5865
+ */
5866
+ type HeaderSettings = {
5867
+ show_announcement?: boolean;
5868
+ announcement_text?: string;
5869
+ announcement_link?: string;
5870
+ announcement_pages?: 'all' | 'home';
5871
+ menu?: string;
5872
+ };
5873
+ /** A footer's link to the shop's page on a social network; `url` is always `http(s)://`. */
5874
+ type SocialLink = {
5875
+ network: 'instagram' | 'facebook' | 'x' | 'youtube' | 'pinterest' | 'linkedin' | 'whatsapp' | 'telegram';
5876
+ url: string;
5877
+ };
5878
+ /**
5879
+ * The footer's settings (D131): the handle of the menu whose top-level links
5880
+ * become its columns, a few words about the shop, whether the newsletter
5881
+ * sign-up shows (absent while the newsletter is off), social links and the
5882
+ * copyright line. An absent one means the storefront keeps its own.
5883
+ */
5884
+ type FooterSettings = {
5885
+ menu?: string;
5886
+ about?: string;
5887
+ newsletter?: boolean;
5888
+ social?: SocialLink[];
5889
+ copyright?: string;
5890
+ };
5891
+ /**
5892
+ * The published header or footer, or a preview key's draft, with the menu
5893
+ * it names already read — live, so a menu edited in the panel shows without a
5894
+ * publish. `menu` is null when none is named or the named one is gone.
5895
+ */
5896
+ type SiteChrome<S> = {
5897
+ revision?: number;
5898
+ preview: boolean;
5899
+ settings: S;
5900
+ menu: StorefrontMenu | null;
5901
+ };
5902
+ type SiteHeader = SiteChrome<HeaderSettings>;
5903
+ type SiteFooter = SiteChrome<FooterSettings>;
5765
5904
  /**
5766
5905
  * Composed pages from ext/layouts. A store without one — the plugin off,
5767
5906
  * nothing published, an engine built without the module, or a preview key
@@ -5798,6 +5937,20 @@ declare class LayoutService extends BaseService {
5798
5937
  getThemeSettings({ preview }?: {
5799
5938
  preview?: string | null;
5800
5939
  }): Promise<ThemeSettingsResult | null>;
5940
+ /**
5941
+ * The header the shop set in the theme editor (D131), drawn on every
5942
+ * page: the published one, or a preview key's draft. Null — the
5943
+ * storefront's own header — when none is published, the editor is off, the
5944
+ * engine is older, or anything fails: a header is never worth an error page.
5945
+ */
5946
+ getHeader({ preview }?: {
5947
+ preview?: string | null;
5948
+ }): Promise<SiteHeader | null>;
5949
+ /** The footer the shop set in the theme editor (D131); null for the storefront's own, as getHeader. */
5950
+ getFooter({ preview }?: {
5951
+ preview?: string | null;
5952
+ }): Promise<SiteFooter | null>;
5953
+ private chrome;
5801
5954
  }
5802
5955
  declare const layoutService: LayoutService;
5803
5956
 
@@ -6941,4 +7094,4 @@ declare class B2bService extends BaseService {
6941
7094
  }
6942
7095
  declare const b2bService: B2bService;
6943
7096
 
6944
- export { LayoutService as $, type Address as A, type B2bPlaced as B, type Cart as C, CountryService as D, CouponService as E, type Credentials as F, type Credit as G, CurrencyService as H, type Customer as I, DealService as J, DemoRequestService as K, type EngineRequest as L, EnquiryService as M, type Envelope as N, type Faq as O, FaqService as P, FeedbackService as Q, type Fulfillment as R, GalleryService as S, type HomeLayout as T, type HomeLayoutSection as U, HomeService as V, type IdentityAddress as W, InitService as X, type Invitation as Y, type LayoutCollection as Z, type LayoutPage as _, AddressService as a, autocompleteService as a$, type Lead as a0, type ListMeta as a1, MeilisearchService as a2, type Member as a3, type Menu as a4, type MenuItem as a5, MenuService as a6, type MenuSummary as a7, type Money as a8, NewsletterService as a9, SearchService as aA, SettingService as aB, type ShippingRate as aC, StateService as aD, type StoreProfile as aE, StoreService as aF, type StorefrontCategory as aG, type StorefrontMenu as aH, type StorefrontOrder as aI, type StorefrontProduct as aJ, type ThemeSettings as aK, type ThemeSettingsResult as aL, UploadService as aM, UserService as aN, type Variant as aO, type VariantImage as aP, VariantService as aQ, VarniCustomDesignService as aR, VarniCustomProductService as aS, type Vendor as aT, VendorService as aU, WarrantyService as aV, type Wishlist as aW, type WishlistItem as aX, WishlistService as aY, addressService as aZ, authService as a_, type Offer as aa, type Order as ab, type OrderLine as ac, OrderService as ad, type PageLayout as ae, PageService as af, type PaymentIntent as ag, PaymentMethodService as ah, type Plugin as ai, PluginService as aj, PopularSearchService as ak, PopularityService as al, type Product as am, type ProductOption as an, ProductService as ao, ProfileService as ap, type Quote as aq, REDIRECT_GATEWAYS as ar, ReelsService as as, RegionService as at, type RejectedLine as au, type Review as av, type ReviewPage as aw, ReviewService as ax, type SearchDoc as ay, type SearchResult as az, type AppliedDiscount as b, toMajor as b$, b2bService as b0, bannerService as b1, blogService as b2, cartService as b3, categoryService as b4, chatService as b5, checkoutService as b6, collectionService as b7, contactService as b8, countryService as b9, pluginService as bA, pluginsService as bB, popularSearchService as bC, popularityService as bD, priceOf as bE, productImages as bF, productService as bG, profileService as bH, qs as bI, reelsService as bJ, regionService as bK, reviewService as bL, searchService as bM, setRequestHost as bN, settingService as bO, settingsService as bP, stateService as bQ, staticStore as bR, storeForHost as bS, storeService as bT, toCart as bU, toCartLine as bV, toCategory as bW, toCmsPage as bX, toCollection as bY, toEngineAddress as bZ, toIdentityAddress as b_, couponService as ba, currencyExponent as bb, currencyService as bc, dealService as bd, demoRequestService as be, emptyCart as bf, emptyPage as bg, enquiryService as bh, faqService as bi, feedbackService as bj, fromEngineAddress as bk, fromIdentityAddress as bl, fromSearchDoc as bm, galleryService as bn, homeService as bo, initService as bp, layoutService as bq, mediaUrl as br, meilisearchService as bs, menuService as bt, minorToMajor as bu, newsletterService as bv, orderService as bw, ownDomain as bx, pageService as by, paymentMethodService as bz, type Approval as c, toMinor as c0, toOrder as c1, toPage as c2, toProduct as c3, toRating as c4, toUser as c5, toVariant as c6, toVendor as c7, uploadService as c8, userService as c9, variantService as ca, varniCustomDesignService as cb, varniCustomProductService as cc, vendorService as cd, warrantyService as ce, wishlistService as cf, type AuthResponse as d, AuthService as e, AutocompleteService as f, type B2bRole as g, B2bService as h, BannerService as i, BaseService as j, BlogService as k, type CartLine as l, CartService as m, CatalogService as n, type Category as o, CategoryService as p, ChatService as q, type CheckoutOptions as r, type CheckoutResult as s, CheckoutService as t, type CmsPage as u, type Collection as v, CollectionService as w, type Company as x, type CompanyOrder as y, ContactService as z };
7097
+ export { type Invitation as $, type Address as A, type B2bPlaced as B, type Cart as C, CountryService as D, CouponService as E, type Credentials as F, type Credit as G, CurrencyService as H, type Customer as I, DealService as J, DemoRequestService as K, type EngineRequest as L, EnquiryService as M, type Envelope as N, type FacetValue as O, type Faq as P, FaqService as Q, FeedbackService as R, type FooterSettings as S, type Fulfillment as T, GalleryService as U, type HeaderSettings as V, type HomeLayout as W, type HomeLayoutSection as X, HomeService as Y, type IdentityAddress as Z, InitService as _, AddressService as a, type Vendor as a$, type LayoutCollection as a0, type LayoutPage as a1, LayoutService as a2, type Lead as a3, type ListMeta as a4, MeilisearchService as a5, type Member as a6, type Menu as a7, type MenuItem as a8, MenuService as a9, type ReviewPage as aA, ReviewService as aB, type SearchDoc as aC, type SearchResult as aD, SearchService as aE, SettingService as aF, type ShippingRate as aG, type SiteChrome as aH, type SiteFooter as aI, type SiteHeader as aJ, type SocialLink as aK, StateService as aL, type StoreProfile as aM, StoreService as aN, type StorefrontCategory as aO, type StorefrontMenu as aP, type StorefrontOrder as aQ, type StorefrontProduct as aR, type ThemeSettings as aS, type ThemeSettingsResult as aT, UploadService as aU, UserService as aV, type Variant as aW, type VariantImage as aX, VariantService as aY, VarniCustomDesignService as aZ, VarniCustomProductService as a_, type MenuSummary as aa, type Money as ab, NewsletterService as ac, type Offer as ad, type Order as ae, type OrderLine as af, OrderService as ag, type PageLayout as ah, PageService as ai, type PaymentIntent as aj, PaymentMethodService as ak, type Plugin as al, PluginService as am, PopularSearchService as an, PopularityService as ao, type Product as ap, type ProductFacets as aq, type ProductOption as ar, ProductService as as, ProfileService as at, type Quote as au, REDIRECT_GATEWAYS as av, ReelsService as aw, RegionService as ax, type RejectedLine as ay, type Review as az, type AppliedDiscount as b, storeService as b$, VendorService as b0, WarrantyService as b1, type Wishlist as b2, type WishlistItem as b3, WishlistService as b4, addressService as b5, authService as b6, autocompleteService as b7, b2bService as b8, bannerService as b9, meilisearchService as bA, menuService as bB, minorToMajor as bC, newsletterService as bD, orderService as bE, ownDomain as bF, pageService as bG, paymentMethodService as bH, pluginService as bI, pluginsService as bJ, popularSearchService as bK, popularityService as bL, priceOf as bM, productImages as bN, productService as bO, profileService as bP, qs as bQ, reelsService as bR, regionService as bS, reviewService as bT, searchService as bU, setRequestHost as bV, settingService as bW, settingsService as bX, stateService as bY, staticStore as bZ, storeForHost as b_, blogService as ba, cartService as bb, categoryService as bc, chatService as bd, checkoutService as be, collectionService as bf, contactService as bg, countryService as bh, couponService as bi, currencyExponent as bj, currencyService as bk, dealService as bl, demoRequestService as bm, emptyCart as bn, emptyPage as bo, enquiryService as bp, faqService as bq, feedbackService as br, fromEngineAddress as bs, fromIdentityAddress as bt, fromSearchDoc as bu, galleryService as bv, homeService as bw, initService as bx, layoutService as by, mediaUrl as bz, type Approval as c, toCart as c0, toCartLine as c1, toCategory as c2, toCmsPage as c3, toCollection as c4, toEngineAddress as c5, toIdentityAddress as c6, toMajor as c7, toMinor as c8, toOrder as c9, toPage as ca, toProduct as cb, toRating as cc, toStorefrontFacets as cd, toUser as ce, toVariant as cf, toVendor as cg, uploadService as ch, userService as ci, variantService as cj, varniCustomDesignService as ck, varniCustomProductService as cl, vendorService as cm, warrantyService as cn, wishlistService as co, type AuthResponse as d, AuthService as e, AutocompleteService as f, type B2bRole as g, B2bService as h, BannerService as i, BaseService as j, BlogService as k, type CartLine as l, CartService as m, CatalogService as n, type Category as o, CategoryService as p, ChatService as q, type CheckoutOptions as r, type CheckoutResult as s, CheckoutService as t, type CmsPage as u, type Collection as v, CollectionService as w, type Company as x, type CompanyOrder as y, ContactService as z };
@@ -109,6 +109,29 @@ type ListMeta = {
109
109
  offset: number;
110
110
  page: number;
111
111
  total_pages: number;
112
+ /** Only on `GET /api/products?facets=1`, from an engine that counts them (D130). */
113
+ facets?: ProductFacets;
114
+ };
115
+ type FacetValue = {
116
+ value: string;
117
+ count: number;
118
+ };
119
+ /** core/catalog_facets.go: counted over the whole listing, each group without its own selection. */
120
+ type ProductFacets = {
121
+ price: {
122
+ min: Money;
123
+ max: Money;
124
+ } | null;
125
+ tags: FacetValue[] | null;
126
+ vendors: FacetValue[] | null;
127
+ product_types: FacetValue[] | null;
128
+ categories: {
129
+ id: number;
130
+ slug: string;
131
+ title: string;
132
+ count: number;
133
+ }[] | null;
134
+ attributes: Record<string, FacetValue[]> | null;
112
135
  };
113
136
  type Envelope<T> = {
114
137
  data: T;
@@ -1327,6 +1350,16 @@ type CatalogQuery = {
1327
1350
  * are not applied.
1328
1351
  */
1329
1352
  attributes?: Record<string, string[]>;
1353
+ tags?: string[];
1354
+ vendors?: string[];
1355
+ productTypes?: string[];
1356
+ /**
1357
+ * Ask the engine to count the filter values too. Such a query goes to
1358
+ * `GET /api/products`, which then also answers the category, the price
1359
+ * range, the sort and every filter above (D130); an engine too old to count
1360
+ * them is asked the way it always was, and the page has no facets.
1361
+ */
1362
+ facets?: boolean;
1330
1363
  };
1331
1364
  type CatalogPage = {
1332
1365
  data: ReturnType<typeof toProduct>[] | ReturnType<typeof fromSearchDoc>[];
@@ -1340,17 +1373,8 @@ type CatalogPage = {
1340
1373
  }[];
1341
1374
  /** Whether the answer honoured `sort` and the price range, or had to drop them. */
1342
1375
  sorted: boolean;
1376
+ facets?: ProductFacets;
1343
1377
  };
1344
- /**
1345
- * One shelf of products, from whichever engine route can answer the question.
1346
- *
1347
- * - A category, no reordering: `GET /api/categories/{slug}`, which sells the
1348
- * category and its descendants.
1349
- * - A search or the whole shop, no reordering: `GET /api/products?q=`.
1350
- * - Any sort but newest, or a price range: the Meilisearch module, when it is
1351
- * installed and configured. Without it the shelf comes back in the engine's
1352
- * order with `sorted: false`, rather than failing or pretending.
1353
- */
1354
1378
  declare class CatalogService extends BaseService {
1355
1379
  protected readonly facts: StoreFacts;
1356
1380
  protected queryCatalog(q: CatalogQuery): Promise<CatalogPage>;
@@ -1968,14 +1992,39 @@ declare class ProductService extends CatalogService {
1968
1992
  }
1969
1993
  declare const productService: ProductService;
1970
1994
 
1995
+ /**
1996
+ * The engine's counts in the shape the storefront's filter rail reads. Each
1997
+ * `allFilters` key is also the URL parameter the rail writes when a value is
1998
+ * ticked, and `searchWithUrl` reads it back: `vendor`, `product_type` and
1999
+ * `attributes.<handle>`. Tags go to the rail's own tag group, written as `tags`.
2000
+ */
2001
+ declare function toStorefrontFacets(f?: ProductFacets | null): {
2002
+ priceStat: {
2003
+ min: number;
2004
+ max: number;
2005
+ } | {
2006
+ min?: undefined;
2007
+ max?: undefined;
2008
+ };
2009
+ categories: {
2010
+ name: string;
2011
+ slug: string;
2012
+ count: number;
2013
+ }[];
2014
+ tags: {
2015
+ name: string;
2016
+ count: number;
2017
+ }[];
2018
+ allFilters: Record<string, Record<string, number>>;
2019
+ };
1971
2020
  /**
1972
2021
  * The listing pages' search: `/products?search=&sort=&page=` and the category
1973
2022
  * catch-all `/{slug}`.
1974
2023
  *
1975
- * Facets are empty. The engine's search route returns hits and a total, not
1976
- * distributions, and a facet list made from one page of hits would count that
1977
- * page, not the shop. An empty `priceStat` hides the price slider rather than
1978
- * drawing one with a made-up range.
2024
+ * Facets come from the engine, counted over the whole listing rather than the
2025
+ * page (D130). An engine too old to count them leaves them empty, and an empty
2026
+ * `priceStat` hides the price slider rather than drawing one with a made-up
2027
+ * range.
1979
2028
  */
1980
2029
  declare class SearchService extends CatalogService {
1981
2030
  emptyResult(): {
@@ -1987,10 +2036,23 @@ declare class SearchService extends CatalogService {
1987
2036
  slug: string;
1988
2037
  }[];
1989
2038
  facets: {
1990
- priceStat: {};
1991
- categories: never[];
1992
- tags: never[];
1993
- allFilters: {};
2039
+ priceStat: {
2040
+ min: number;
2041
+ max: number;
2042
+ } | {
2043
+ min?: undefined;
2044
+ max?: undefined;
2045
+ };
2046
+ categories: {
2047
+ name: string;
2048
+ slug: string;
2049
+ count: number;
2050
+ }[];
2051
+ tags: {
2052
+ name: string;
2053
+ count: number;
2054
+ }[];
2055
+ allFilters: Record<string, Record<string, number>>;
1994
2056
  };
1995
2057
  };
1996
2058
  searchWithUrl(url: URL | string, slug?: string): Promise<{
@@ -2002,10 +2064,23 @@ declare class SearchService extends CatalogService {
2002
2064
  slug: string;
2003
2065
  }[];
2004
2066
  facets: {
2005
- priceStat: {};
2006
- categories: never[];
2007
- tags: never[];
2008
- allFilters: {};
2067
+ priceStat: {
2068
+ min: number;
2069
+ max: number;
2070
+ } | {
2071
+ min?: undefined;
2072
+ max?: undefined;
2073
+ };
2074
+ categories: {
2075
+ name: string;
2076
+ slug: string;
2077
+ count: number;
2078
+ }[];
2079
+ tags: {
2080
+ name: string;
2081
+ count: number;
2082
+ }[];
2083
+ allFilters: Record<string, Record<string, number>>;
2009
2084
  };
2010
2085
  } | {
2011
2086
  data: {
@@ -2154,10 +2229,23 @@ declare class SearchService extends CatalogService {
2154
2229
  slug: string;
2155
2230
  }[];
2156
2231
  facets: {
2157
- priceStat: {};
2158
- categories: never[];
2159
- tags: never[];
2160
- allFilters: {};
2232
+ priceStat: {
2233
+ min: number;
2234
+ max: number;
2235
+ } | {
2236
+ min?: undefined;
2237
+ max?: undefined;
2238
+ };
2239
+ categories: {
2240
+ name: string;
2241
+ slug: string;
2242
+ count: number;
2243
+ }[];
2244
+ tags: {
2245
+ name: string;
2246
+ count: number;
2247
+ }[];
2248
+ allFilters: Record<string, Record<string, number>>;
2161
2249
  };
2162
2250
  }>;
2163
2251
  }
@@ -5577,8 +5665,15 @@ declare class MenuService extends BaseService {
5577
5665
  listMenus(): Promise<MenuSummary[]>;
5578
5666
  /** One menu by handle, in the storefront's shape: `{ menuId, name, items: [{ id, name, link, items }] }`. */
5579
5667
  getMenu(handle: string): Promise<StorefrontMenu>;
5580
- /** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
5668
+ /**
5669
+ * The header and footer menus, or `null` when the module is not there. Cached: a menu is
5670
+ * store-level. Each is the menu the shop chose for it in the theme editor's header or footer
5671
+ * (GoCommerce D131), still under the `header` / `footer` id every storefront looks for, so the
5672
+ * choice reaches every place that draws one; the menus named so are the default.
5673
+ */
5581
5674
  engineMenus(): Promise<StorefrontMenu[] | null>;
5675
+ /** The handle of the menu the published header or footer names, else the part's own name. */
5676
+ private chosenMenu;
5582
5677
  }
5583
5678
  declare const menuService: MenuService;
5584
5679
 
@@ -5742,7 +5837,7 @@ type HomeLayoutSection = {
5742
5837
  * or `main-collection` (the collection's grid) — at the place the shop put
5743
5838
  * it, and the storefront draws its own core there.
5744
5839
  */
5745
- type LayoutPage = 'home' | 'product' | 'collection';
5840
+ type LayoutPage = 'home' | 'product' | 'collection' | 'header' | 'footer';
5746
5841
  type HomeLayout = {
5747
5842
  page: string;
5748
5843
  theme: string;
@@ -5762,6 +5857,50 @@ type ThemeSettingsResult = {
5762
5857
  preview: boolean;
5763
5858
  settings: ThemeSettings;
5764
5859
  };
5860
+ /**
5861
+ * The header's settings as the shop set them (ext/layouts, D131): the strip
5862
+ * above the header — shown or not, its words, its link, and whether it is on
5863
+ * every page or the home page only — and the handle of the menu across it.
5864
+ * Plain text, and a link that is `/path` or `http(s)://`.
5865
+ */
5866
+ type HeaderSettings = {
5867
+ show_announcement?: boolean;
5868
+ announcement_text?: string;
5869
+ announcement_link?: string;
5870
+ announcement_pages?: 'all' | 'home';
5871
+ menu?: string;
5872
+ };
5873
+ /** A footer's link to the shop's page on a social network; `url` is always `http(s)://`. */
5874
+ type SocialLink = {
5875
+ network: 'instagram' | 'facebook' | 'x' | 'youtube' | 'pinterest' | 'linkedin' | 'whatsapp' | 'telegram';
5876
+ url: string;
5877
+ };
5878
+ /**
5879
+ * The footer's settings (D131): the handle of the menu whose top-level links
5880
+ * become its columns, a few words about the shop, whether the newsletter
5881
+ * sign-up shows (absent while the newsletter is off), social links and the
5882
+ * copyright line. An absent one means the storefront keeps its own.
5883
+ */
5884
+ type FooterSettings = {
5885
+ menu?: string;
5886
+ about?: string;
5887
+ newsletter?: boolean;
5888
+ social?: SocialLink[];
5889
+ copyright?: string;
5890
+ };
5891
+ /**
5892
+ * The published header or footer, or a preview key's draft, with the menu
5893
+ * it names already read — live, so a menu edited in the panel shows without a
5894
+ * publish. `menu` is null when none is named or the named one is gone.
5895
+ */
5896
+ type SiteChrome<S> = {
5897
+ revision?: number;
5898
+ preview: boolean;
5899
+ settings: S;
5900
+ menu: StorefrontMenu | null;
5901
+ };
5902
+ type SiteHeader = SiteChrome<HeaderSettings>;
5903
+ type SiteFooter = SiteChrome<FooterSettings>;
5765
5904
  /**
5766
5905
  * Composed pages from ext/layouts. A store without one — the plugin off,
5767
5906
  * nothing published, an engine built without the module, or a preview key
@@ -5798,6 +5937,20 @@ declare class LayoutService extends BaseService {
5798
5937
  getThemeSettings({ preview }?: {
5799
5938
  preview?: string | null;
5800
5939
  }): Promise<ThemeSettingsResult | null>;
5940
+ /**
5941
+ * The header the shop set in the theme editor (D131), drawn on every
5942
+ * page: the published one, or a preview key's draft. Null — the
5943
+ * storefront's own header — when none is published, the editor is off, the
5944
+ * engine is older, or anything fails: a header is never worth an error page.
5945
+ */
5946
+ getHeader({ preview }?: {
5947
+ preview?: string | null;
5948
+ }): Promise<SiteHeader | null>;
5949
+ /** The footer the shop set in the theme editor (D131); null for the storefront's own, as getHeader. */
5950
+ getFooter({ preview }?: {
5951
+ preview?: string | null;
5952
+ }): Promise<SiteFooter | null>;
5953
+ private chrome;
5801
5954
  }
5802
5955
  declare const layoutService: LayoutService;
5803
5956
 
@@ -6941,4 +7094,4 @@ declare class B2bService extends BaseService {
6941
7094
  }
6942
7095
  declare const b2bService: B2bService;
6943
7096
 
6944
- export { LayoutService as $, type Address as A, type B2bPlaced as B, type Cart as C, CountryService as D, CouponService as E, type Credentials as F, type Credit as G, CurrencyService as H, type Customer as I, DealService as J, DemoRequestService as K, type EngineRequest as L, EnquiryService as M, type Envelope as N, type Faq as O, FaqService as P, FeedbackService as Q, type Fulfillment as R, GalleryService as S, type HomeLayout as T, type HomeLayoutSection as U, HomeService as V, type IdentityAddress as W, InitService as X, type Invitation as Y, type LayoutCollection as Z, type LayoutPage as _, AddressService as a, autocompleteService as a$, type Lead as a0, type ListMeta as a1, MeilisearchService as a2, type Member as a3, type Menu as a4, type MenuItem as a5, MenuService as a6, type MenuSummary as a7, type Money as a8, NewsletterService as a9, SearchService as aA, SettingService as aB, type ShippingRate as aC, StateService as aD, type StoreProfile as aE, StoreService as aF, type StorefrontCategory as aG, type StorefrontMenu as aH, type StorefrontOrder as aI, type StorefrontProduct as aJ, type ThemeSettings as aK, type ThemeSettingsResult as aL, UploadService as aM, UserService as aN, type Variant as aO, type VariantImage as aP, VariantService as aQ, VarniCustomDesignService as aR, VarniCustomProductService as aS, type Vendor as aT, VendorService as aU, WarrantyService as aV, type Wishlist as aW, type WishlistItem as aX, WishlistService as aY, addressService as aZ, authService as a_, type Offer as aa, type Order as ab, type OrderLine as ac, OrderService as ad, type PageLayout as ae, PageService as af, type PaymentIntent as ag, PaymentMethodService as ah, type Plugin as ai, PluginService as aj, PopularSearchService as ak, PopularityService as al, type Product as am, type ProductOption as an, ProductService as ao, ProfileService as ap, type Quote as aq, REDIRECT_GATEWAYS as ar, ReelsService as as, RegionService as at, type RejectedLine as au, type Review as av, type ReviewPage as aw, ReviewService as ax, type SearchDoc as ay, type SearchResult as az, type AppliedDiscount as b, toMajor as b$, b2bService as b0, bannerService as b1, blogService as b2, cartService as b3, categoryService as b4, chatService as b5, checkoutService as b6, collectionService as b7, contactService as b8, countryService as b9, pluginService as bA, pluginsService as bB, popularSearchService as bC, popularityService as bD, priceOf as bE, productImages as bF, productService as bG, profileService as bH, qs as bI, reelsService as bJ, regionService as bK, reviewService as bL, searchService as bM, setRequestHost as bN, settingService as bO, settingsService as bP, stateService as bQ, staticStore as bR, storeForHost as bS, storeService as bT, toCart as bU, toCartLine as bV, toCategory as bW, toCmsPage as bX, toCollection as bY, toEngineAddress as bZ, toIdentityAddress as b_, couponService as ba, currencyExponent as bb, currencyService as bc, dealService as bd, demoRequestService as be, emptyCart as bf, emptyPage as bg, enquiryService as bh, faqService as bi, feedbackService as bj, fromEngineAddress as bk, fromIdentityAddress as bl, fromSearchDoc as bm, galleryService as bn, homeService as bo, initService as bp, layoutService as bq, mediaUrl as br, meilisearchService as bs, menuService as bt, minorToMajor as bu, newsletterService as bv, orderService as bw, ownDomain as bx, pageService as by, paymentMethodService as bz, type Approval as c, toMinor as c0, toOrder as c1, toPage as c2, toProduct as c3, toRating as c4, toUser as c5, toVariant as c6, toVendor as c7, uploadService as c8, userService as c9, variantService as ca, varniCustomDesignService as cb, varniCustomProductService as cc, vendorService as cd, warrantyService as ce, wishlistService as cf, type AuthResponse as d, AuthService as e, AutocompleteService as f, type B2bRole as g, B2bService as h, BannerService as i, BaseService as j, BlogService as k, type CartLine as l, CartService as m, CatalogService as n, type Category as o, CategoryService as p, ChatService as q, type CheckoutOptions as r, type CheckoutResult as s, CheckoutService as t, type CmsPage as u, type Collection as v, CollectionService as w, type Company as x, type CompanyOrder as y, ContactService as z };
7097
+ export { type Invitation as $, type Address as A, type B2bPlaced as B, type Cart as C, CountryService as D, CouponService as E, type Credentials as F, type Credit as G, CurrencyService as H, type Customer as I, DealService as J, DemoRequestService as K, type EngineRequest as L, EnquiryService as M, type Envelope as N, type FacetValue as O, type Faq as P, FaqService as Q, FeedbackService as R, type FooterSettings as S, type Fulfillment as T, GalleryService as U, type HeaderSettings as V, type HomeLayout as W, type HomeLayoutSection as X, HomeService as Y, type IdentityAddress as Z, InitService as _, AddressService as a, type Vendor as a$, type LayoutCollection as a0, type LayoutPage as a1, LayoutService as a2, type Lead as a3, type ListMeta as a4, MeilisearchService as a5, type Member as a6, type Menu as a7, type MenuItem as a8, MenuService as a9, type ReviewPage as aA, ReviewService as aB, type SearchDoc as aC, type SearchResult as aD, SearchService as aE, SettingService as aF, type ShippingRate as aG, type SiteChrome as aH, type SiteFooter as aI, type SiteHeader as aJ, type SocialLink as aK, StateService as aL, type StoreProfile as aM, StoreService as aN, type StorefrontCategory as aO, type StorefrontMenu as aP, type StorefrontOrder as aQ, type StorefrontProduct as aR, type ThemeSettings as aS, type ThemeSettingsResult as aT, UploadService as aU, UserService as aV, type Variant as aW, type VariantImage as aX, VariantService as aY, VarniCustomDesignService as aZ, VarniCustomProductService as a_, type MenuSummary as aa, type Money as ab, NewsletterService as ac, type Offer as ad, type Order as ae, type OrderLine as af, OrderService as ag, type PageLayout as ah, PageService as ai, type PaymentIntent as aj, PaymentMethodService as ak, type Plugin as al, PluginService as am, PopularSearchService as an, PopularityService as ao, type Product as ap, type ProductFacets as aq, type ProductOption as ar, ProductService as as, ProfileService as at, type Quote as au, REDIRECT_GATEWAYS as av, ReelsService as aw, RegionService as ax, type RejectedLine as ay, type Review as az, type AppliedDiscount as b, storeService as b$, VendorService as b0, WarrantyService as b1, type Wishlist as b2, type WishlistItem as b3, WishlistService as b4, addressService as b5, authService as b6, autocompleteService as b7, b2bService as b8, bannerService as b9, meilisearchService as bA, menuService as bB, minorToMajor as bC, newsletterService as bD, orderService as bE, ownDomain as bF, pageService as bG, paymentMethodService as bH, pluginService as bI, pluginsService as bJ, popularSearchService as bK, popularityService as bL, priceOf as bM, productImages as bN, productService as bO, profileService as bP, qs as bQ, reelsService as bR, regionService as bS, reviewService as bT, searchService as bU, setRequestHost as bV, settingService as bW, settingsService as bX, stateService as bY, staticStore as bZ, storeForHost as b_, blogService as ba, cartService as bb, categoryService as bc, chatService as bd, checkoutService as be, collectionService as bf, contactService as bg, countryService as bh, couponService as bi, currencyExponent as bj, currencyService as bk, dealService as bl, demoRequestService as bm, emptyCart as bn, emptyPage as bo, enquiryService as bp, faqService as bq, feedbackService as br, fromEngineAddress as bs, fromIdentityAddress as bt, fromSearchDoc as bu, galleryService as bv, homeService as bw, initService as bx, layoutService as by, mediaUrl as bz, type Approval as c, toCart as c0, toCartLine as c1, toCategory as c2, toCmsPage as c3, toCollection as c4, toEngineAddress as c5, toIdentityAddress as c6, toMajor as c7, toMinor as c8, toOrder as c9, toPage as ca, toProduct as cb, toRating as cc, toStorefrontFacets as cd, toUser as ce, toVariant as cf, toVendor as cg, uploadService as ch, userService as ci, variantService as cj, varniCustomDesignService as ck, varniCustomProductService as cl, vendorService as cm, warrantyService as cn, wishlistService as co, type AuthResponse as d, AuthService as e, AutocompleteService as f, type B2bRole as g, B2bService as h, BannerService as i, BaseService as j, BlogService as k, type CartLine as l, CartService as m, CatalogService as n, type Category as o, CategoryService as p, ChatService as q, type CheckoutOptions as r, type CheckoutResult as s, CheckoutService as t, type CmsPage as u, type Collection as v, CollectionService as w, type Company as x, type CompanyOrder as y, ContactService as z };