@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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as FacetValue, P as Faq, Q as FaqService, R as FeedbackService, S as Fulfillment, T as GalleryService, U as HomeLayout, V as HomeLayoutSection, W as HomeService, X as IdentityAddress, Y as InitService, Z as Invitation, _ as LayoutCollection, $ as LayoutPage, a0 as LayoutService, a1 as Lead, a2 as ListMeta, a3 as MeilisearchService, a4 as Member, a5 as Menu, a6 as MenuItem, a7 as MenuService, a8 as MenuSummary, a9 as Money, aa as NewsletterService, ab as Offer, ac as Order, ad as OrderLine, ae as OrderService, af as PageLayout, ag as PageService, ah as PaymentIntent, ai as PaymentMethodService, aj as Plugin, ak as PluginService, ak as PluginsService, al as PopularSearchService, am as PopularityService, an as Product, ao as ProductFacets, ap as ProductOption, aq as ProductService, ar as ProfileService, as as Quote, at as REDIRECT_GATEWAYS, au as ReelsService, av as RegionService, aw as RejectedLine, ax as Review, ay as ReviewPage, az as ReviewService, aA as SearchDoc, aB as SearchResult, aC as SearchService, aD as SettingService, aD as SettingsService, aE as ShippingRate, aF as StateService, aG as StoreProfile, aH as StoreService, aI as StorefrontCategory, aJ as StorefrontMenu, aK as StorefrontOrder, aL as StorefrontProduct, aM as ThemeSettings, aN as ThemeSettingsResult, aO as UploadService, aP as UserService, aQ as Variant, aR as VariantImage, aS as VariantService, aT as VarniCustomDesignService, aU as VarniCustomProductService, aV as Vendor, aW as VendorService, aX as WarrantyService, aY as Wishlist, aZ as WishlistItem, 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, bd as currencyExponent, be as currencyService, bf as dealService, bg as demoRequestService, bh as emptyCart, bi as emptyPage, bj as enquiryService, bk as faqService, bl as feedbackService, bm as fromEngineAddress, bn as fromIdentityAddress, bo as fromSearchDoc, bp as galleryService, bq as homeService, br as initService, bs as layoutService, bt as mediaUrl, bu as meilisearchService, bv as menuService, bw as minorToMajor, 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, bG as priceOf, bH as productImages, 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, bW as toCart, bX as toCartLine, bY as toCategory, bZ as toCmsPage, b_ as toCollection, b$ as toEngineAddress, c0 as toIdentityAddress, c1 as toMajor, c2 as toMinor, c3 as toOrder, c4 as toPage, c5 as toProduct, c6 as toRating, c7 as toStorefrontFacets, c8 as toUser, c9 as toVariant, ca as toVendor, 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 Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as FacetValue, P as Faq, Q as FaqService, R as FeedbackService, S as FooterSettings, T as Fulfillment, U as GalleryService, V as HeaderSettings, W as HomeLayout, X as HomeLayoutSection, Y as HomeService, Z as IdentityAddress, _ as InitService, $ as Invitation, a0 as LayoutCollection, a1 as LayoutPage, a2 as LayoutService, a3 as Lead, a4 as ListMeta, a5 as MeilisearchService, a6 as Member, a7 as Menu, a8 as MenuItem, a9 as MenuService, aa as MenuSummary, ab as Money, ac as NewsletterService, ad as Offer, ae as Order, af as OrderLine, ag as OrderService, ah as PageLayout, ai as PageService, aj as PaymentIntent, ak as PaymentMethodService, al as Plugin, am as PluginService, am as PluginsService, an as PopularSearchService, ao as PopularityService, ap as Product, aq as ProductFacets, ar as ProductOption, as as ProductService, at as ProfileService, au as Quote, av as REDIRECT_GATEWAYS, aw as ReelsService, ax as RegionService, ay as RejectedLine, az as Review, aA as ReviewPage, aB as ReviewService, aC as SearchDoc, aD as SearchResult, aE as SearchService, aF as SettingService, aF as SettingsService, aG as ShippingRate, aH as SiteChrome, aI as SiteFooter, aJ as SiteHeader, aK as SocialLink, aL as StateService, aM as StoreProfile, aN as StoreService, aO as StorefrontCategory, aP as StorefrontMenu, aQ as StorefrontOrder, aR as StorefrontProduct, aS as ThemeSettings, aT as ThemeSettingsResult, aU as UploadService, aV as UserService, aW as Variant, aX as VariantImage, aY as VariantService, aZ as VarniCustomDesignService, a_ as VarniCustomProductService, a$ as Vendor, b0 as VendorService, b1 as WarrantyService, b2 as Wishlist, b3 as WishlistItem, 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, bj as currencyExponent, bk as currencyService, bl as dealService, bm as demoRequestService, bn as emptyCart, bo as emptyPage, bp as enquiryService, bq as faqService, br as feedbackService, bs as fromEngineAddress, bt as fromIdentityAddress, bu as fromSearchDoc, bv as galleryService, bw as homeService, bx as initService, by as layoutService, bz as mediaUrl, bA as meilisearchService, bB as menuService, bC as minorToMajor, 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, bM as priceOf, bN as productImages, 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, c0 as toCart, c1 as toCartLine, c2 as toCategory, c3 as toCmsPage, c4 as toCollection, c5 as toEngineAddress, c6 as toIdentityAddress, c7 as toMajor, c8 as toMinor, c9 as toOrder, ca as toPage, cb as toProduct, cc as toRating, cd as toStorefrontFacets, ce as toUser, cf as toVariant, cg as toVendor, 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';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as FacetValue, P as Faq, Q as FaqService, R as FeedbackService, S as Fulfillment, T as GalleryService, U as HomeLayout, V as HomeLayoutSection, W as HomeService, X as IdentityAddress, Y as InitService, Z as Invitation, _ as LayoutCollection, $ as LayoutPage, a0 as LayoutService, a1 as Lead, a2 as ListMeta, a3 as MeilisearchService, a4 as Member, a5 as Menu, a6 as MenuItem, a7 as MenuService, a8 as MenuSummary, a9 as Money, aa as NewsletterService, ab as Offer, ac as Order, ad as OrderLine, ae as OrderService, af as PageLayout, ag as PageService, ah as PaymentIntent, ai as PaymentMethodService, aj as Plugin, ak as PluginService, ak as PluginsService, al as PopularSearchService, am as PopularityService, an as Product, ao as ProductFacets, ap as ProductOption, aq as ProductService, ar as ProfileService, as as Quote, at as REDIRECT_GATEWAYS, au as ReelsService, av as RegionService, aw as RejectedLine, ax as Review, ay as ReviewPage, az as ReviewService, aA as SearchDoc, aB as SearchResult, aC as SearchService, aD as SettingService, aD as SettingsService, aE as ShippingRate, aF as StateService, aG as StoreProfile, aH as StoreService, aI as StorefrontCategory, aJ as StorefrontMenu, aK as StorefrontOrder, aL as StorefrontProduct, aM as ThemeSettings, aN as ThemeSettingsResult, aO as UploadService, aP as UserService, aQ as Variant, aR as VariantImage, aS as VariantService, aT as VarniCustomDesignService, aU as VarniCustomProductService, aV as Vendor, aW as VendorService, aX as WarrantyService, aY as Wishlist, aZ as WishlistItem, 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, bd as currencyExponent, be as currencyService, bf as dealService, bg as demoRequestService, bh as emptyCart, bi as emptyPage, bj as enquiryService, bk as faqService, bl as feedbackService, bm as fromEngineAddress, bn as fromIdentityAddress, bo as fromSearchDoc, bp as galleryService, bq as homeService, br as initService, bs as layoutService, bt as mediaUrl, bu as meilisearchService, bv as menuService, bw as minorToMajor, 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, bG as priceOf, bH as productImages, 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, bW as toCart, bX as toCartLine, bY as toCategory, bZ as toCmsPage, b_ as toCollection, b$ as toEngineAddress, c0 as toIdentityAddress, c1 as toMajor, c2 as toMinor, c3 as toOrder, c4 as toPage, c5 as toProduct, c6 as toRating, c7 as toStorefrontFacets, c8 as toUser, c9 as toVariant, ca as toVendor, 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 Address, a as AddressService, b as AppliedDiscount, c as Approval, d as AuthResponse, e as AuthService, f as AutocompleteService, B as B2bPlaced, g as B2bRole, h as B2bService, i as BannerService, j as BaseService, k as BlogService, C as Cart, l as CartLine, m as CartService, n as CatalogService, o as Category, p as CategoryService, q as ChatService, r as CheckoutOptions, s as CheckoutResult, t as CheckoutService, u as CmsPage, v as Collection, w as CollectionService, x as Company, y as CompanyOrder, z as ContactService, D as CountryService, E as CouponService, F as Credentials, G as Credit, H as CurrencyService, I as Customer, J as DealService, K as DemoRequestService, L as EngineRequest, M as EnquiryService, N as Envelope, O as FacetValue, P as Faq, Q as FaqService, R as FeedbackService, S as FooterSettings, T as Fulfillment, U as GalleryService, V as HeaderSettings, W as HomeLayout, X as HomeLayoutSection, Y as HomeService, Z as IdentityAddress, _ as InitService, $ as Invitation, a0 as LayoutCollection, a1 as LayoutPage, a2 as LayoutService, a3 as Lead, a4 as ListMeta, a5 as MeilisearchService, a6 as Member, a7 as Menu, a8 as MenuItem, a9 as MenuService, aa as MenuSummary, ab as Money, ac as NewsletterService, ad as Offer, ae as Order, af as OrderLine, ag as OrderService, ah as PageLayout, ai as PageService, aj as PaymentIntent, ak as PaymentMethodService, al as Plugin, am as PluginService, am as PluginsService, an as PopularSearchService, ao as PopularityService, ap as Product, aq as ProductFacets, ar as ProductOption, as as ProductService, at as ProfileService, au as Quote, av as REDIRECT_GATEWAYS, aw as ReelsService, ax as RegionService, ay as RejectedLine, az as Review, aA as ReviewPage, aB as ReviewService, aC as SearchDoc, aD as SearchResult, aE as SearchService, aF as SettingService, aF as SettingsService, aG as ShippingRate, aH as SiteChrome, aI as SiteFooter, aJ as SiteHeader, aK as SocialLink, aL as StateService, aM as StoreProfile, aN as StoreService, aO as StorefrontCategory, aP as StorefrontMenu, aQ as StorefrontOrder, aR as StorefrontProduct, aS as ThemeSettings, aT as ThemeSettingsResult, aU as UploadService, aV as UserService, aW as Variant, aX as VariantImage, aY as VariantService, aZ as VarniCustomDesignService, a_ as VarniCustomProductService, a$ as Vendor, b0 as VendorService, b1 as WarrantyService, b2 as Wishlist, b3 as WishlistItem, 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, bj as currencyExponent, bk as currencyService, bl as dealService, bm as demoRequestService, bn as emptyCart, bo as emptyPage, bp as enquiryService, bq as faqService, br as feedbackService, bs as fromEngineAddress, bt as fromIdentityAddress, bu as fromSearchDoc, bv as galleryService, bw as homeService, bx as initService, by as layoutService, bz as mediaUrl, bA as meilisearchService, bB as menuService, bC as minorToMajor, 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, bM as priceOf, bN as productImages, 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, c0 as toCart, c1 as toCartLine, c2 as toCategory, c3 as toCmsPage, c4 as toCollection, c5 as toEngineAddress, c6 as toIdentityAddress, c7 as toMajor, c8 as toMinor, c9 as toOrder, ca as toPage, cb as toProduct, cc as toRating, cd as toStorefrontFacets, ce as toUser, cf as toVariant, cg as toVendor, 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';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.js CHANGED
@@ -2677,21 +2677,38 @@ var MenuService = class extends BaseService {
2677
2677
  const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
2678
2678
  return { menuId: m.handle, name: m.title, items: (m.items ?? []).map(toItem) };
2679
2679
  }
2680
- /** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
2680
+ /**
2681
+ * The header and footer menus, or `null` when the module is not there. Cached: a menu is
2682
+ * store-level. Each is the menu the shop chose for it in the theme editor's header or footer
2683
+ * (GoCommerce D131), still under the `header` / `footer` id every storefront looks for, so the
2684
+ * choice reaches every place that draws one; the menus named so are the default.
2685
+ */
2681
2686
  async engineMenus() {
2682
2687
  if (!await this.facts.pluginOn("navigation")) return null;
2683
2688
  return remember(`${this.engineBase()}|${this.store ?? ""}|menus`, async () => {
2684
2689
  const out = [];
2685
- for (const handle of ["header", "footer"]) {
2690
+ for (const part of ["header", "footer"]) {
2686
2691
  try {
2687
- const m = await this.data(`/x/navigation/menus/${handle}`);
2688
- out.push({ menuId: handle, name: m.title, items: (m.items ?? []).map(toItem) });
2692
+ const handle = await this.chosenMenu(part);
2693
+ const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
2694
+ out.push({ menuId: part, name: m.title, items: (m.items ?? []).map(toItem) });
2689
2695
  } catch {
2690
2696
  }
2691
2697
  }
2692
2698
  return out;
2693
2699
  }).catch(() => null);
2694
2700
  }
2701
+ /** The handle of the menu the published header or footer names, else the part's own name. */
2702
+ async chosenMenu(part) {
2703
+ if (!await this.facts.pluginOn("layouts")) return part;
2704
+ try {
2705
+ const layout = await this.data(`/x/layouts/${part}`);
2706
+ const menu = layout?.sections?.find((s) => s.type === part)?.settings?.menu;
2707
+ return typeof menu === "string" && menu ? menu : part;
2708
+ } catch {
2709
+ return part;
2710
+ }
2711
+ }
2695
2712
  };
2696
2713
  var menuService = new MenuService();
2697
2714
 
@@ -2806,7 +2823,10 @@ var StoreService = class extends BaseService {
2806
2823
  isProductReviewsAndRatings: {
2807
2824
  ...basePlugins.isProductReviewsAndRatings,
2808
2825
  ...flag(plugins.has("product-reviews"))
2809
- }
2826
+ },
2827
+ // The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
2828
+ // switch (D131) can only show it while that is on.
2829
+ newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) }
2810
2830
  },
2811
2831
  ...menus?.length ? { menu: menus } : {},
2812
2832
  ...deliverable(base, ships),
@@ -2921,6 +2941,35 @@ var LayoutService = class extends BaseService {
2921
2941
  return null;
2922
2942
  }
2923
2943
  }
2944
+ /**
2945
+ * The header the shop set in the theme editor (D131), drawn on every
2946
+ * page: the published one, or a preview key's draft. Null — the
2947
+ * storefront's own header — when none is published, the editor is off, the
2948
+ * engine is older, or anything fails: a header is never worth an error page.
2949
+ */
2950
+ async getHeader({ preview } = {}) {
2951
+ return this.chrome("header", preview);
2952
+ }
2953
+ /** The footer the shop set in the theme editor (D131); null for the storefront's own, as getHeader. */
2954
+ async getFooter({ preview } = {}) {
2955
+ return this.chrome("footer", preview);
2956
+ }
2957
+ async chrome(page, preview) {
2958
+ let layout;
2959
+ try {
2960
+ layout = await this.getPageLayout(page, { preview });
2961
+ } catch {
2962
+ return null;
2963
+ }
2964
+ const section = layout?.sections.find((s) => s.type === page);
2965
+ if (!layout || !section) return null;
2966
+ const settings = { ...section.settings };
2967
+ let menu = null;
2968
+ if (typeof settings.menu === "string" && settings.menu) {
2969
+ menu = await new MenuService(this._fetch).getMenu(settings.menu).catch(() => null);
2970
+ }
2971
+ return { revision: layout.revision, preview: layout.preview, settings, menu };
2972
+ }
2924
2973
  };
2925
2974
  function tokens(v) {
2926
2975
  return v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length ? { ...v } : null;