@misiki/gocommerce-connector 0.10.0 → 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 +1 -0
- package/dist/{index-mqcHZ96i.d.cts → index-90wdO5MM.d.cts} +68 -3
- package/dist/{index-mqcHZ96i.d.ts → index-90wdO5MM.d.ts} +68 -3
- package/dist/index.cjs +54 -5
- 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 +54 -5
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +54 -5
- 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 +54 -5
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
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 |
|
|
@@ -5665,8 +5665,15 @@ declare class MenuService extends BaseService {
|
|
|
5665
5665
|
listMenus(): Promise<MenuSummary[]>;
|
|
5666
5666
|
/** One menu by handle, in the storefront's shape: `{ menuId, name, items: [{ id, name, link, items }] }`. */
|
|
5667
5667
|
getMenu(handle: string): Promise<StorefrontMenu>;
|
|
5668
|
-
/**
|
|
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
|
+
*/
|
|
5669
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;
|
|
5670
5677
|
}
|
|
5671
5678
|
declare const menuService: MenuService;
|
|
5672
5679
|
|
|
@@ -5830,7 +5837,7 @@ type HomeLayoutSection = {
|
|
|
5830
5837
|
* or `main-collection` (the collection's grid) — at the place the shop put
|
|
5831
5838
|
* it, and the storefront draws its own core there.
|
|
5832
5839
|
*/
|
|
5833
|
-
type LayoutPage = 'home' | 'product' | 'collection';
|
|
5840
|
+
type LayoutPage = 'home' | 'product' | 'collection' | 'header' | 'footer';
|
|
5834
5841
|
type HomeLayout = {
|
|
5835
5842
|
page: string;
|
|
5836
5843
|
theme: string;
|
|
@@ -5850,6 +5857,50 @@ type ThemeSettingsResult = {
|
|
|
5850
5857
|
preview: boolean;
|
|
5851
5858
|
settings: ThemeSettings;
|
|
5852
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>;
|
|
5853
5904
|
/**
|
|
5854
5905
|
* Composed pages from ext/layouts. A store without one — the plugin off,
|
|
5855
5906
|
* nothing published, an engine built without the module, or a preview key
|
|
@@ -5886,6 +5937,20 @@ declare class LayoutService extends BaseService {
|
|
|
5886
5937
|
getThemeSettings({ preview }?: {
|
|
5887
5938
|
preview?: string | null;
|
|
5888
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;
|
|
5889
5954
|
}
|
|
5890
5955
|
declare const layoutService: LayoutService;
|
|
5891
5956
|
|
|
@@ -7029,4 +7094,4 @@ declare class B2bService extends BaseService {
|
|
|
7029
7094
|
}
|
|
7030
7095
|
declare const b2bService: B2bService;
|
|
7031
7096
|
|
|
7032
|
-
export { type
|
|
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 };
|
|
@@ -5665,8 +5665,15 @@ declare class MenuService extends BaseService {
|
|
|
5665
5665
|
listMenus(): Promise<MenuSummary[]>;
|
|
5666
5666
|
/** One menu by handle, in the storefront's shape: `{ menuId, name, items: [{ id, name, link, items }] }`. */
|
|
5667
5667
|
getMenu(handle: string): Promise<StorefrontMenu>;
|
|
5668
|
-
/**
|
|
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
|
+
*/
|
|
5669
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;
|
|
5670
5677
|
}
|
|
5671
5678
|
declare const menuService: MenuService;
|
|
5672
5679
|
|
|
@@ -5830,7 +5837,7 @@ type HomeLayoutSection = {
|
|
|
5830
5837
|
* or `main-collection` (the collection's grid) — at the place the shop put
|
|
5831
5838
|
* it, and the storefront draws its own core there.
|
|
5832
5839
|
*/
|
|
5833
|
-
type LayoutPage = 'home' | 'product' | 'collection';
|
|
5840
|
+
type LayoutPage = 'home' | 'product' | 'collection' | 'header' | 'footer';
|
|
5834
5841
|
type HomeLayout = {
|
|
5835
5842
|
page: string;
|
|
5836
5843
|
theme: string;
|
|
@@ -5850,6 +5857,50 @@ type ThemeSettingsResult = {
|
|
|
5850
5857
|
preview: boolean;
|
|
5851
5858
|
settings: ThemeSettings;
|
|
5852
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>;
|
|
5853
5904
|
/**
|
|
5854
5905
|
* Composed pages from ext/layouts. A store without one — the plugin off,
|
|
5855
5906
|
* nothing published, an engine built without the module, or a preview key
|
|
@@ -5886,6 +5937,20 @@ declare class LayoutService extends BaseService {
|
|
|
5886
5937
|
getThemeSettings({ preview }?: {
|
|
5887
5938
|
preview?: string | null;
|
|
5888
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;
|
|
5889
5954
|
}
|
|
5890
5955
|
declare const layoutService: LayoutService;
|
|
5891
5956
|
|
|
@@ -7029,4 +7094,4 @@ declare class B2bService extends BaseService {
|
|
|
7029
7094
|
}
|
|
7030
7095
|
declare const b2bService: B2bService;
|
|
7031
7096
|
|
|
7032
|
-
export { type
|
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -2679,21 +2679,38 @@ var MenuService = class extends BaseService {
|
|
|
2679
2679
|
const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
|
|
2680
2680
|
return { menuId: m.handle, name: m.title, items: (m.items ?? []).map(toItem) };
|
|
2681
2681
|
}
|
|
2682
|
-
/**
|
|
2682
|
+
/**
|
|
2683
|
+
* The header and footer menus, or `null` when the module is not there. Cached: a menu is
|
|
2684
|
+
* store-level. Each is the menu the shop chose for it in the theme editor's header or footer
|
|
2685
|
+
* (GoCommerce D131), still under the `header` / `footer` id every storefront looks for, so the
|
|
2686
|
+
* choice reaches every place that draws one; the menus named so are the default.
|
|
2687
|
+
*/
|
|
2683
2688
|
async engineMenus() {
|
|
2684
2689
|
if (!await this.facts.pluginOn("navigation")) return null;
|
|
2685
2690
|
return remember(`${this.engineBase()}|${this.store ?? ""}|menus`, async () => {
|
|
2686
2691
|
const out = [];
|
|
2687
|
-
for (const
|
|
2692
|
+
for (const part of ["header", "footer"]) {
|
|
2688
2693
|
try {
|
|
2689
|
-
const
|
|
2690
|
-
|
|
2694
|
+
const handle = await this.chosenMenu(part);
|
|
2695
|
+
const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
|
|
2696
|
+
out.push({ menuId: part, name: m.title, items: (m.items ?? []).map(toItem) });
|
|
2691
2697
|
} catch {
|
|
2692
2698
|
}
|
|
2693
2699
|
}
|
|
2694
2700
|
return out;
|
|
2695
2701
|
}).catch(() => null);
|
|
2696
2702
|
}
|
|
2703
|
+
/** The handle of the menu the published header or footer names, else the part's own name. */
|
|
2704
|
+
async chosenMenu(part) {
|
|
2705
|
+
if (!await this.facts.pluginOn("layouts")) return part;
|
|
2706
|
+
try {
|
|
2707
|
+
const layout = await this.data(`/x/layouts/${part}`);
|
|
2708
|
+
const menu = layout?.sections?.find((s) => s.type === part)?.settings?.menu;
|
|
2709
|
+
return typeof menu === "string" && menu ? menu : part;
|
|
2710
|
+
} catch {
|
|
2711
|
+
return part;
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2697
2714
|
};
|
|
2698
2715
|
var menuService = new MenuService();
|
|
2699
2716
|
|
|
@@ -2808,7 +2825,10 @@ var StoreService = class extends BaseService {
|
|
|
2808
2825
|
isProductReviewsAndRatings: {
|
|
2809
2826
|
...basePlugins.isProductReviewsAndRatings,
|
|
2810
2827
|
...flag(plugins.has("product-reviews"))
|
|
2811
|
-
}
|
|
2828
|
+
},
|
|
2829
|
+
// The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
|
|
2830
|
+
// switch (D131) can only show it while that is on.
|
|
2831
|
+
newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) }
|
|
2812
2832
|
},
|
|
2813
2833
|
...menus?.length ? { menu: menus } : {},
|
|
2814
2834
|
...deliverable(base, ships),
|
|
@@ -2923,6 +2943,35 @@ var LayoutService = class extends BaseService {
|
|
|
2923
2943
|
return null;
|
|
2924
2944
|
}
|
|
2925
2945
|
}
|
|
2946
|
+
/**
|
|
2947
|
+
* The header the shop set in the theme editor (D131), drawn on every
|
|
2948
|
+
* page: the published one, or a preview key's draft. Null — the
|
|
2949
|
+
* storefront's own header — when none is published, the editor is off, the
|
|
2950
|
+
* engine is older, or anything fails: a header is never worth an error page.
|
|
2951
|
+
*/
|
|
2952
|
+
async getHeader({ preview } = {}) {
|
|
2953
|
+
return this.chrome("header", preview);
|
|
2954
|
+
}
|
|
2955
|
+
/** The footer the shop set in the theme editor (D131); null for the storefront's own, as getHeader. */
|
|
2956
|
+
async getFooter({ preview } = {}) {
|
|
2957
|
+
return this.chrome("footer", preview);
|
|
2958
|
+
}
|
|
2959
|
+
async chrome(page, preview) {
|
|
2960
|
+
let layout;
|
|
2961
|
+
try {
|
|
2962
|
+
layout = await this.getPageLayout(page, { preview });
|
|
2963
|
+
} catch {
|
|
2964
|
+
return null;
|
|
2965
|
+
}
|
|
2966
|
+
const section = layout?.sections.find((s) => s.type === page);
|
|
2967
|
+
if (!layout || !section) return null;
|
|
2968
|
+
const settings = { ...section.settings };
|
|
2969
|
+
let menu = null;
|
|
2970
|
+
if (typeof settings.menu === "string" && settings.menu) {
|
|
2971
|
+
menu = await new MenuService(this._fetch).getMenu(settings.menu).catch(() => null);
|
|
2972
|
+
}
|
|
2973
|
+
return { revision: layout.revision, preview: layout.preview, settings, menu };
|
|
2974
|
+
}
|
|
2926
2975
|
};
|
|
2927
2976
|
function tokens(v) {
|
|
2928
2977
|
return v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length ? { ...v } : null;
|