@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.
@@ -1 +1 @@
1
- export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, Q as FaqService, R as FeedbackService, T as GalleryService, U as HomeLayout, V as HomeLayoutSection, W as HomeService, Y as InitService, Z as Invitation, _ as LayoutCollection, $ as LayoutPage, a0 as LayoutService, a1 as Lead, a3 as MeilisearchService, a4 as Member, a7 as MenuService, aa as NewsletterService, ae as OrderService, af as PageLayout, ag as PageService, ai as PaymentMethodService, ak as PluginService, ak as PluginsService, al as PopularSearchService, am as PopularityService, aq as ProductService, ar as ProfileService, as as Quote, at as REDIRECT_GATEWAYS, au as ReelsService, av as RegionService, aw as RejectedLine, az as ReviewService, aC as SearchService, aD as SettingService, aD as SettingsService, aF as StateService, aH as StoreService, aJ as StorefrontMenu, aM as ThemeSettings, aN as ThemeSettingsResult, aO as UploadService, aP as UserService, aS as VariantService, aT as VarniCustomDesignService, aU as VarniCustomProductService, aW as VendorService, aX as WarrantyService, a_ as WishlistService, a$ as addressService, b0 as authService, b1 as autocompleteService, b2 as b2bService, b3 as bannerService, b4 as blogService, b5 as cartService, b6 as categoryService, b7 as chatService, b8 as checkoutService, b9 as collectionService, ba as contactService, bb as countryService, bc as couponService, be as currencyService, bf as dealService, bg as demoRequestService, bi as emptyPage, bj as enquiryService, bk as faqService, bl as feedbackService, bp as galleryService, bq as homeService, br as initService, bs as layoutService, bt as mediaUrl, bu as meilisearchService, bv as menuService, bx as newsletterService, by as orderService, bz as ownDomain, bA as pageService, bB as paymentMethodService, bC as pluginService, bD as pluginsService, bE as popularSearchService, bF as popularityService, bI as productService, bJ as profileService, bK as qs, bL as reelsService, bM as regionService, bN as reviewService, bO as searchService, bP as setRequestHost, bQ as settingService, bR as settingsService, bS as stateService, bT as staticStore, bU as storeForHost, bV as storeService, c4 as toPage, c7 as toStorefrontFacets, cb as uploadService, cc as userService, cd as variantService, ce as varniCustomDesignService, cf as varniCustomProductService, cg as vendorService, ch as warrantyService, ci as wishlistService } from '../index-mqcHZ96i.cjs';
1
+ export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, Q as FaqService, R as FeedbackService, S as FooterSettings, U as GalleryService, V as HeaderSettings, W as HomeLayout, X as HomeLayoutSection, Y as HomeService, _ as InitService, $ as Invitation, a0 as LayoutCollection, a1 as LayoutPage, a2 as LayoutService, a3 as Lead, a5 as MeilisearchService, a6 as Member, a9 as MenuService, ac as NewsletterService, ag as OrderService, ah as PageLayout, ai as PageService, ak as PaymentMethodService, am as PluginService, am as PluginsService, an as PopularSearchService, ao as PopularityService, as as ProductService, at as ProfileService, au as Quote, av as REDIRECT_GATEWAYS, aw as ReelsService, ax as RegionService, ay as RejectedLine, aB as ReviewService, aE as SearchService, aF as SettingService, aF as SettingsService, aH as SiteChrome, aI as SiteFooter, aJ as SiteHeader, aK as SocialLink, aL as StateService, aN as StoreService, aP as StorefrontMenu, aS as ThemeSettings, aT as ThemeSettingsResult, aU as UploadService, aV as UserService, aY as VariantService, aZ as VarniCustomDesignService, a_ as VarniCustomProductService, b0 as VendorService, b1 as WarrantyService, b4 as WishlistService, b5 as addressService, b6 as authService, b7 as autocompleteService, b8 as b2bService, b9 as bannerService, ba as blogService, bb as cartService, bc as categoryService, bd as chatService, be as checkoutService, bf as collectionService, bg as contactService, bh as countryService, bi as couponService, bk as currencyService, bl as dealService, bm as demoRequestService, bo as emptyPage, bp as enquiryService, bq as faqService, br as feedbackService, bv as galleryService, bw as homeService, bx as initService, by as layoutService, bz as mediaUrl, bA as meilisearchService, bB as menuService, bD as newsletterService, bE as orderService, bF as ownDomain, bG as pageService, bH as paymentMethodService, bI as pluginService, bJ as pluginsService, bK as popularSearchService, bL as popularityService, bO as productService, bP as profileService, bQ as qs, bR as reelsService, bS as regionService, bT as reviewService, bU as searchService, bV as setRequestHost, bW as settingService, bX as settingsService, bY as stateService, bZ as staticStore, b_ as storeForHost, b$ as storeService, ca as toPage, cd as toStorefrontFacets, ch as uploadService, ci as userService, cj as variantService, ck as varniCustomDesignService, cl as varniCustomProductService, cm as vendorService, cn as warrantyService, co as wishlistService } from '../index-90wdO5MM.cjs';
@@ -1 +1 @@
1
- export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, Q as FaqService, R as FeedbackService, T as GalleryService, U as HomeLayout, V as HomeLayoutSection, W as HomeService, Y as InitService, Z as Invitation, _ as LayoutCollection, $ as LayoutPage, a0 as LayoutService, a1 as Lead, a3 as MeilisearchService, a4 as Member, a7 as MenuService, aa as NewsletterService, ae as OrderService, af as PageLayout, ag as PageService, ai as PaymentMethodService, ak as PluginService, ak as PluginsService, al as PopularSearchService, am as PopularityService, aq as ProductService, ar as ProfileService, as as Quote, at as REDIRECT_GATEWAYS, au as ReelsService, av as RegionService, aw as RejectedLine, az as ReviewService, aC as SearchService, aD as SettingService, aD as SettingsService, aF as StateService, aH as StoreService, aJ as StorefrontMenu, aM as ThemeSettings, aN as ThemeSettingsResult, aO as UploadService, aP as UserService, aS as VariantService, aT as VarniCustomDesignService, aU as VarniCustomProductService, aW as VendorService, aX as WarrantyService, a_ as WishlistService, a$ as addressService, b0 as authService, b1 as autocompleteService, b2 as b2bService, b3 as bannerService, b4 as blogService, b5 as cartService, b6 as categoryService, b7 as chatService, b8 as checkoutService, b9 as collectionService, ba as contactService, bb as countryService, bc as couponService, be as currencyService, bf as dealService, bg as demoRequestService, bi as emptyPage, bj as enquiryService, bk as faqService, bl as feedbackService, bp as galleryService, bq as homeService, br as initService, bs as layoutService, bt as mediaUrl, bu as meilisearchService, bv as menuService, bx as newsletterService, by as orderService, bz as ownDomain, bA as pageService, bB as paymentMethodService, bC as pluginService, bD as pluginsService, bE as popularSearchService, bF as popularityService, bI as productService, bJ as profileService, bK as qs, bL as reelsService, bM as regionService, bN as reviewService, bO as searchService, bP as setRequestHost, bQ as settingService, bR as settingsService, bS as stateService, bT as staticStore, bU as storeForHost, bV as storeService, c4 as toPage, c7 as toStorefrontFacets, cb as uploadService, cc as userService, cd as variantService, ce as varniCustomDesignService, cf as varniCustomProductService, cg as vendorService, ch as warrantyService, ci as wishlistService } from '../index-mqcHZ96i.js';
1
+ export { a as AddressService, c as Approval, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, m as CartService, n as CatalogService, p as CategoryService, q as ChatService, t as CheckoutService, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, G as Credit, H as CurrencyService, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, Q as FaqService, R as FeedbackService, S as FooterSettings, U as GalleryService, V as HeaderSettings, W as HomeLayout, X as HomeLayoutSection, Y as HomeService, _ as InitService, $ as Invitation, a0 as LayoutCollection, a1 as LayoutPage, a2 as LayoutService, a3 as Lead, a5 as MeilisearchService, a6 as Member, a9 as MenuService, ac as NewsletterService, ag as OrderService, ah as PageLayout, ai as PageService, ak as PaymentMethodService, am as PluginService, am as PluginsService, an as PopularSearchService, ao as PopularityService, as as ProductService, at as ProfileService, au as Quote, av as REDIRECT_GATEWAYS, aw as ReelsService, ax as RegionService, ay as RejectedLine, aB as ReviewService, aE as SearchService, aF as SettingService, aF as SettingsService, aH as SiteChrome, aI as SiteFooter, aJ as SiteHeader, aK as SocialLink, aL as StateService, aN as StoreService, aP as StorefrontMenu, aS as ThemeSettings, aT as ThemeSettingsResult, aU as UploadService, aV as UserService, aY as VariantService, aZ as VarniCustomDesignService, a_ as VarniCustomProductService, b0 as VendorService, b1 as WarrantyService, b4 as WishlistService, b5 as addressService, b6 as authService, b7 as autocompleteService, b8 as b2bService, b9 as bannerService, ba as blogService, bb as cartService, bc as categoryService, bd as chatService, be as checkoutService, bf as collectionService, bg as contactService, bh as countryService, bi as couponService, bk as currencyService, bl as dealService, bm as demoRequestService, bo as emptyPage, bp as enquiryService, bq as faqService, br as feedbackService, bv as galleryService, bw as homeService, bx as initService, by as layoutService, bz as mediaUrl, bA as meilisearchService, bB as menuService, bD as newsletterService, bE as orderService, bF as ownDomain, bG as pageService, bH as paymentMethodService, bI as pluginService, bJ as pluginsService, bK as popularSearchService, bL as popularityService, bO as productService, bP as profileService, bQ as qs, bR as reelsService, bS as regionService, bT as reviewService, bU as searchService, bV as setRequestHost, bW as settingService, bX as settingsService, bY as stateService, bZ as staticStore, b_ as storeForHost, b$ as storeService, ca as toPage, cd as toStorefrontFacets, ch as uploadService, ci as userService, cj as variantService, ck as varniCustomDesignService, cl as varniCustomProductService, cm as vendorService, cn as warrantyService, co as wishlistService } from '../index-90wdO5MM.js';
@@ -2658,21 +2658,38 @@ var MenuService = class extends BaseService {
2658
2658
  const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
2659
2659
  return { menuId: m.handle, name: m.title, items: (m.items ?? []).map(toItem) };
2660
2660
  }
2661
- /** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
2661
+ /**
2662
+ * The header and footer menus, or `null` when the module is not there. Cached: a menu is
2663
+ * store-level. Each is the menu the shop chose for it in the theme editor's header or footer
2664
+ * (GoCommerce D131), still under the `header` / `footer` id every storefront looks for, so the
2665
+ * choice reaches every place that draws one; the menus named so are the default.
2666
+ */
2662
2667
  async engineMenus() {
2663
2668
  if (!await this.facts.pluginOn("navigation")) return null;
2664
2669
  return remember(`${this.engineBase()}|${this.store ?? ""}|menus`, async () => {
2665
2670
  const out = [];
2666
- for (const handle of ["header", "footer"]) {
2671
+ for (const part of ["header", "footer"]) {
2667
2672
  try {
2668
- const m = await this.data(`/x/navigation/menus/${handle}`);
2669
- out.push({ menuId: handle, name: m.title, items: (m.items ?? []).map(toItem) });
2673
+ const handle = await this.chosenMenu(part);
2674
+ const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
2675
+ out.push({ menuId: part, name: m.title, items: (m.items ?? []).map(toItem) });
2670
2676
  } catch {
2671
2677
  }
2672
2678
  }
2673
2679
  return out;
2674
2680
  }).catch(() => null);
2675
2681
  }
2682
+ /** The handle of the menu the published header or footer names, else the part's own name. */
2683
+ async chosenMenu(part) {
2684
+ if (!await this.facts.pluginOn("layouts")) return part;
2685
+ try {
2686
+ const layout = await this.data(`/x/layouts/${part}`);
2687
+ const menu = layout?.sections?.find((s) => s.type === part)?.settings?.menu;
2688
+ return typeof menu === "string" && menu ? menu : part;
2689
+ } catch {
2690
+ return part;
2691
+ }
2692
+ }
2676
2693
  };
2677
2694
  var menuService = new MenuService();
2678
2695
  var readStaticStore = async () => {
@@ -2790,7 +2807,10 @@ var StoreService = class extends BaseService {
2790
2807
  isProductReviewsAndRatings: {
2791
2808
  ...basePlugins.isProductReviewsAndRatings,
2792
2809
  ...flag(plugins.has("product-reviews"))
2793
- }
2810
+ },
2811
+ // The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
2812
+ // switch (D131) can only show it while that is on.
2813
+ newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) }
2794
2814
  },
2795
2815
  ...menus?.length ? { menu: menus } : {},
2796
2816
  ...deliverable(base, ships),
@@ -2905,6 +2925,35 @@ var LayoutService = class extends BaseService {
2905
2925
  return null;
2906
2926
  }
2907
2927
  }
2928
+ /**
2929
+ * The header the shop set in the theme editor (D131), drawn on every
2930
+ * page: the published one, or a preview key's draft. Null — the
2931
+ * storefront's own header — when none is published, the editor is off, the
2932
+ * engine is older, or anything fails: a header is never worth an error page.
2933
+ */
2934
+ async getHeader({ preview } = {}) {
2935
+ return this.chrome("header", preview);
2936
+ }
2937
+ /** The footer the shop set in the theme editor (D131); null for the storefront's own, as getHeader. */
2938
+ async getFooter({ preview } = {}) {
2939
+ return this.chrome("footer", preview);
2940
+ }
2941
+ async chrome(page, preview) {
2942
+ let layout;
2943
+ try {
2944
+ layout = await this.getPageLayout(page, { preview });
2945
+ } catch {
2946
+ return null;
2947
+ }
2948
+ const section = layout?.sections.find((s) => s.type === page);
2949
+ if (!layout || !section) return null;
2950
+ const settings = { ...section.settings };
2951
+ let menu = null;
2952
+ if (typeof settings.menu === "string" && settings.menu) {
2953
+ menu = await new MenuService(this._fetch).getMenu(settings.menu).catch(() => null);
2954
+ }
2955
+ return { revision: layout.revision, preview: layout.preview, settings, menu };
2956
+ }
2908
2957
  };
2909
2958
  function tokens(v) {
2910
2959
  return v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length ? { ...v } : null;