@misiki/gocommerce-connector 0.7.0 → 0.9.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 Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, W as IdentityAddress, X as InitService, Y as Invitation, Z as LayoutService, _ as Lead, $ as ListMeta, a0 as MeilisearchService, a1 as Member, a2 as Menu, a3 as MenuItem, a4 as MenuService, a5 as MenuSummary, a6 as Money, a7 as NewsletterService, a8 as Offer, a9 as Order, aa as OrderLine, ab as OrderService, ac as PageService, ad as PaymentIntent, ae as PaymentMethodService, af as Plugin, ag as PluginService, ag as PluginsService, ah as PopularSearchService, ai as PopularityService, aj as Product, ak as ProductOption, al as ProductService, am as ProfileService, an as Quote, ao as REDIRECT_GATEWAYS, ap as ReelsService, aq as RegionService, ar as RejectedLine, as as Review, at as ReviewPage, au as ReviewService, av as SearchDoc, aw as SearchResult, ax as SearchService, ay as SettingService, ay as SettingsService, az as ShippingRate, aA as StateService, aB as StoreProfile, aC as StoreService, aD as StorefrontCategory, aE as StorefrontMenu, aF as StorefrontOrder, aG as StorefrontProduct, aH as UploadService, aI as UserService, aJ as Variant, aK as VariantImage, aL as VariantService, aM as VarniCustomDesignService, aN as VarniCustomProductService, aO as Vendor, aP as VendorService, aQ as WarrantyService, aR as Wishlist, aS as WishlistItem, aT as WishlistService, aU as addressService, aV as authService, aW as autocompleteService, aX as b2bService, aY as bannerService, aZ as blogService, a_ as cartService, a$ as categoryService, b0 as chatService, b1 as checkoutService, b2 as collectionService, b3 as contactService, b4 as countryService, b5 as couponService, b6 as currencyExponent, b7 as currencyService, b8 as dealService, b9 as demoRequestService, ba as emptyCart, bb as emptyPage, bc as enquiryService, bd as faqService, be as feedbackService, bf as fromEngineAddress, bg as fromIdentityAddress, bh as fromSearchDoc, bi as galleryService, bj as homeService, bk as initService, bl as layoutService, bm as mediaUrl, bn as meilisearchService, bo as menuService, bp as minorToMajor, bq as newsletterService, br as orderService, bs as ownDomain, bt as pageService, bu as paymentMethodService, bv as pluginService, bw as pluginsService, bx as popularSearchService, by as popularityService, bz as priceOf, bA as productImages, bB as productService, bC as profileService, bD as qs, bE as reelsService, bF as regionService, bG as reviewService, bH as searchService, bI as setRequestHost, bJ as settingService, bK as settingsService, bL as stateService, bM as staticStore, bN as storeForHost, bO as storeService, bP as toCart, bQ as toCartLine, bR as toCategory, bS as toCmsPage, bT as toCollection, bU as toEngineAddress, bV as toIdentityAddress, bW as toMajor, bX as toMinor, bY as toOrder, bZ as toPage, b_ as toProduct, b$ as toRating, c0 as toUser, c1 as toVariant, c2 as toVendor, c3 as uploadService, c4 as userService, c5 as variantService, c6 as varniCustomDesignService, c7 as varniCustomProductService, c8 as vendorService, c9 as warrantyService, ca as wishlistService } from './index-D-hnd6-D.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 Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, W as IdentityAddress, X as InitService, Y as Invitation, Z as LayoutCollection, _ as LayoutPage, $ as LayoutService, a0 as Lead, a1 as ListMeta, a2 as MeilisearchService, a3 as Member, a4 as Menu, a5 as MenuItem, a6 as MenuService, a7 as MenuSummary, a8 as Money, a9 as NewsletterService, aa as Offer, ab as Order, ac as OrderLine, ad as OrderService, ae as PageLayout, af as PageService, ag as PaymentIntent, ah as PaymentMethodService, ai as Plugin, aj as PluginService, aj as PluginsService, ak as PopularSearchService, al as PopularityService, am as Product, an as ProductOption, ao as ProductService, ap as ProfileService, aq as Quote, ar as REDIRECT_GATEWAYS, as as ReelsService, at as RegionService, au as RejectedLine, av as Review, aw as ReviewPage, ax as ReviewService, ay as SearchDoc, az as SearchResult, aA as SearchService, aB as SettingService, aB as SettingsService, aC as ShippingRate, aD as StateService, aE as StoreProfile, aF as StoreService, aG as StorefrontCategory, aH as StorefrontMenu, aI as StorefrontOrder, aJ as StorefrontProduct, aK as ThemeSettings, aL as ThemeSettingsResult, aM as UploadService, aN as UserService, aO as Variant, aP as VariantImage, aQ as VariantService, aR as VarniCustomDesignService, aS as VarniCustomProductService, aT as Vendor, aU as VendorService, aV as WarrantyService, aW as Wishlist, aX as WishlistItem, aY as WishlistService, aZ as addressService, a_ as authService, a$ as autocompleteService, b0 as b2bService, b1 as bannerService, b2 as blogService, b3 as cartService, b4 as categoryService, b5 as chatService, b6 as checkoutService, b7 as collectionService, b8 as contactService, b9 as countryService, ba as couponService, bb as currencyExponent, bc as currencyService, bd as dealService, be as demoRequestService, bf as emptyCart, bg as emptyPage, bh as enquiryService, bi as faqService, bj as feedbackService, bk as fromEngineAddress, bl as fromIdentityAddress, bm as fromSearchDoc, bn as galleryService, bo as homeService, bp as initService, bq as layoutService, br as mediaUrl, bs as meilisearchService, bt as menuService, bu as minorToMajor, bv as newsletterService, bw as orderService, bx as ownDomain, by as pageService, bz as paymentMethodService, bA as pluginService, bB as pluginsService, bC as popularSearchService, bD as popularityService, bE as priceOf, bF as productImages, bG as productService, bH as profileService, bI as qs, bJ as reelsService, bK as regionService, bL as reviewService, bM as searchService, bN as setRequestHost, bO as settingService, bP as settingsService, bQ as stateService, bR as staticStore, bS as storeForHost, bT as storeService, bU as toCart, bV as toCartLine, bW as toCategory, bX as toCmsPage, bY as toCollection, bZ as toEngineAddress, b_ as toIdentityAddress, b$ as toMajor, c0 as toMinor, c1 as toOrder, c2 as toPage, c3 as toProduct, c4 as toRating, c5 as toUser, c6 as toVariant, c7 as toVendor, c8 as uploadService, c9 as userService, ca as variantService, cb as varniCustomDesignService, cc as varniCustomProductService, cd as vendorService, ce as warrantyService, cf as wishlistService } from './index-72kQMxjZ.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 Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, W as IdentityAddress, X as InitService, Y as Invitation, Z as LayoutService, _ as Lead, $ as ListMeta, a0 as MeilisearchService, a1 as Member, a2 as Menu, a3 as MenuItem, a4 as MenuService, a5 as MenuSummary, a6 as Money, a7 as NewsletterService, a8 as Offer, a9 as Order, aa as OrderLine, ab as OrderService, ac as PageService, ad as PaymentIntent, ae as PaymentMethodService, af as Plugin, ag as PluginService, ag as PluginsService, ah as PopularSearchService, ai as PopularityService, aj as Product, ak as ProductOption, al as ProductService, am as ProfileService, an as Quote, ao as REDIRECT_GATEWAYS, ap as ReelsService, aq as RegionService, ar as RejectedLine, as as Review, at as ReviewPage, au as ReviewService, av as SearchDoc, aw as SearchResult, ax as SearchService, ay as SettingService, ay as SettingsService, az as ShippingRate, aA as StateService, aB as StoreProfile, aC as StoreService, aD as StorefrontCategory, aE as StorefrontMenu, aF as StorefrontOrder, aG as StorefrontProduct, aH as UploadService, aI as UserService, aJ as Variant, aK as VariantImage, aL as VariantService, aM as VarniCustomDesignService, aN as VarniCustomProductService, aO as Vendor, aP as VendorService, aQ as WarrantyService, aR as Wishlist, aS as WishlistItem, aT as WishlistService, aU as addressService, aV as authService, aW as autocompleteService, aX as b2bService, aY as bannerService, aZ as blogService, a_ as cartService, a$ as categoryService, b0 as chatService, b1 as checkoutService, b2 as collectionService, b3 as contactService, b4 as countryService, b5 as couponService, b6 as currencyExponent, b7 as currencyService, b8 as dealService, b9 as demoRequestService, ba as emptyCart, bb as emptyPage, bc as enquiryService, bd as faqService, be as feedbackService, bf as fromEngineAddress, bg as fromIdentityAddress, bh as fromSearchDoc, bi as galleryService, bj as homeService, bk as initService, bl as layoutService, bm as mediaUrl, bn as meilisearchService, bo as menuService, bp as minorToMajor, bq as newsletterService, br as orderService, bs as ownDomain, bt as pageService, bu as paymentMethodService, bv as pluginService, bw as pluginsService, bx as popularSearchService, by as popularityService, bz as priceOf, bA as productImages, bB as productService, bC as profileService, bD as qs, bE as reelsService, bF as regionService, bG as reviewService, bH as searchService, bI as setRequestHost, bJ as settingService, bK as settingsService, bL as stateService, bM as staticStore, bN as storeForHost, bO as storeService, bP as toCart, bQ as toCartLine, bR as toCategory, bS as toCmsPage, bT as toCollection, bU as toEngineAddress, bV as toIdentityAddress, bW as toMajor, bX as toMinor, bY as toOrder, bZ as toPage, b_ as toProduct, b$ as toRating, c0 as toUser, c1 as toVariant, c2 as toVendor, c3 as uploadService, c4 as userService, c5 as variantService, c6 as varniCustomDesignService, c7 as varniCustomProductService, c8 as vendorService, c9 as warrantyService, ca as wishlistService } from './index-D-hnd6-D.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 Faq, P as FaqService, Q as FeedbackService, R as Fulfillment, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, W as IdentityAddress, X as InitService, Y as Invitation, Z as LayoutCollection, _ as LayoutPage, $ as LayoutService, a0 as Lead, a1 as ListMeta, a2 as MeilisearchService, a3 as Member, a4 as Menu, a5 as MenuItem, a6 as MenuService, a7 as MenuSummary, a8 as Money, a9 as NewsletterService, aa as Offer, ab as Order, ac as OrderLine, ad as OrderService, ae as PageLayout, af as PageService, ag as PaymentIntent, ah as PaymentMethodService, ai as Plugin, aj as PluginService, aj as PluginsService, ak as PopularSearchService, al as PopularityService, am as Product, an as ProductOption, ao as ProductService, ap as ProfileService, aq as Quote, ar as REDIRECT_GATEWAYS, as as ReelsService, at as RegionService, au as RejectedLine, av as Review, aw as ReviewPage, ax as ReviewService, ay as SearchDoc, az as SearchResult, aA as SearchService, aB as SettingService, aB as SettingsService, aC as ShippingRate, aD as StateService, aE as StoreProfile, aF as StoreService, aG as StorefrontCategory, aH as StorefrontMenu, aI as StorefrontOrder, aJ as StorefrontProduct, aK as ThemeSettings, aL as ThemeSettingsResult, aM as UploadService, aN as UserService, aO as Variant, aP as VariantImage, aQ as VariantService, aR as VarniCustomDesignService, aS as VarniCustomProductService, aT as Vendor, aU as VendorService, aV as WarrantyService, aW as Wishlist, aX as WishlistItem, aY as WishlistService, aZ as addressService, a_ as authService, a$ as autocompleteService, b0 as b2bService, b1 as bannerService, b2 as blogService, b3 as cartService, b4 as categoryService, b5 as chatService, b6 as checkoutService, b7 as collectionService, b8 as contactService, b9 as countryService, ba as couponService, bb as currencyExponent, bc as currencyService, bd as dealService, be as demoRequestService, bf as emptyCart, bg as emptyPage, bh as enquiryService, bi as faqService, bj as feedbackService, bk as fromEngineAddress, bl as fromIdentityAddress, bm as fromSearchDoc, bn as galleryService, bo as homeService, bp as initService, bq as layoutService, br as mediaUrl, bs as meilisearchService, bt as menuService, bu as minorToMajor, bv as newsletterService, bw as orderService, bx as ownDomain, by as pageService, bz as paymentMethodService, bA as pluginService, bB as pluginsService, bC as popularSearchService, bD as popularityService, bE as priceOf, bF as productImages, bG as productService, bH as profileService, bI as qs, bJ as reelsService, bK as regionService, bL as reviewService, bM as searchService, bN as setRequestHost, bO as settingService, bP as settingsService, bQ as stateService, bR as staticStore, bS as storeForHost, bT as storeService, bU as toCart, bV as toCartLine, bW as toCategory, bX as toCmsPage, bY as toCollection, bZ as toEngineAddress, b_ as toIdentityAddress, b$ as toMajor, c0 as toMinor, c1 as toOrder, c2 as toPage, c3 as toProduct, c4 as toRating, c5 as toUser, c6 as toVariant, c7 as toVendor, c8 as uploadService, c9 as userService, ca as variantService, cb as varniCustomDesignService, cc as varniCustomProductService, cd as vendorService, ce as warrantyService, cf as wishlistService } from './index-72kQMxjZ.js';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.js CHANGED
@@ -2756,12 +2756,28 @@ var pageService = new PageService();
2756
2756
  var faqService = new FaqService();
2757
2757
 
2758
2758
  // src/services/layout-service.ts
2759
- var IMAGE_KEYS = ["image", "mobile_image"];
2759
+ var MEDIA_KEYS = /* @__PURE__ */ new Set(["image", "mobile_image", "poster", "video_file"]);
2760
2760
  var LayoutService = class extends BaseService {
2761
2761
  async getHomeLayout({ preview } = {}) {
2762
+ return this.getPageLayout("home", { preview });
2763
+ }
2764
+ /**
2765
+ * The template every product page is drawn in: the sections around the
2766
+ * product's core (`main-product`). Null when none is published, so the
2767
+ * product page draws exactly as it did before templates existed.
2768
+ */
2769
+ async getProductLayout({ preview } = {}) {
2770
+ return this.getPageLayout("product", { preview });
2771
+ }
2772
+ /** The template every collection page is drawn in, around its grid (`main-collection`). */
2773
+ async getCollectionLayout({ preview } = {}) {
2774
+ return this.getPageLayout("collection", { preview });
2775
+ }
2776
+ /** Any arranged page by its key; null for none, as the three above. */
2777
+ async getPageLayout(page, { preview } = {}) {
2762
2778
  let layout;
2763
2779
  try {
2764
- layout = await this.data("/x/layouts/home", {
2780
+ layout = await this.data(`/x/layouts/${encodeURIComponent(page)}`, {
2765
2781
  query: { preview: preview?.trim() || void 0 }
2766
2782
  });
2767
2783
  } catch (err) {
@@ -2774,17 +2790,53 @@ var LayoutService = class extends BaseService {
2774
2790
  theme: layout.theme,
2775
2791
  revision: layout.revision,
2776
2792
  preview: !!layout.preview,
2793
+ themeSettings: tokens(layout.theme_settings),
2777
2794
  sections: (layout.sections ?? []).map(toSection)
2778
2795
  };
2779
2796
  }
2797
+ /**
2798
+ * The store's design tokens, for a page other than the home page: the
2799
+ * published ones, or a preview key's draft. Null when there are none to
2800
+ * apply — nothing published, the editor off, an engine without the
2801
+ * module — and on any failure too: a missing look must never cost the
2802
+ * page.
2803
+ */
2804
+ async getThemeSettings({ preview } = {}) {
2805
+ try {
2806
+ const out = await this.data("/x/layouts/theme", {
2807
+ query: { preview: preview?.trim() || void 0 }
2808
+ });
2809
+ if (!out) return null;
2810
+ return { revision: out.revision, preview: !!out.preview, settings: tokens(out.settings) ?? {} };
2811
+ } catch {
2812
+ return null;
2813
+ }
2814
+ }
2780
2815
  };
2781
- function toSection(s) {
2782
- const settings = { ...s.settings ?? {} };
2783
- for (const key of IMAGE_KEYS) {
2784
- if (typeof settings[key] === "string") settings[key] = mediaUrl(settings[key]);
2816
+ function tokens(v) {
2817
+ return v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length ? { ...v } : null;
2818
+ }
2819
+ function withMedia(value, key) {
2820
+ if (Array.isArray(value)) return value.map((x) => withMedia(x, null));
2821
+ if (value && typeof value === "object") {
2822
+ return Object.fromEntries(Object.entries(value).map(([k, x]) => [k, withMedia(x, k)]));
2785
2823
  }
2824
+ if (key && MEDIA_KEYS.has(key) && typeof value === "string") return mediaUrl(value);
2825
+ return value;
2826
+ }
2827
+ function toSection(s) {
2828
+ const settings = withMedia(s.settings ?? {}, null);
2786
2829
  const out = { id: s.id, type: s.type, settings };
2787
2830
  if (s.type === "product-grid") out.products = (s.products ?? []).map((p) => toProduct(p));
2831
+ if (s.type === "collection-list") {
2832
+ out.collections = (s.collections ?? []).map((c) => ({
2833
+ id: String(c.id),
2834
+ title: c.title,
2835
+ slug: c.slug,
2836
+ link: `/collections/${c.slug}`,
2837
+ image: mediaUrl(c.image) ?? null
2838
+ }));
2839
+ }
2788
2840
  return out;
2789
2841
  }
2790
2842
  var layoutService = new LayoutService();