@misiki/gocommerce-connector 0.6.0 → 0.8.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, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, X as InitService, Y as Invitation, Z as LayoutService, _ as Lead, a0 as MeilisearchService, a1 as Member, a4 as MenuService, a7 as NewsletterService, ab as OrderService, ac as PageService, ae as PaymentMethodService, ag as PluginService, ag as PluginsService, ah as PopularSearchService, ai as PopularityService, al as ProductService, am as ProfileService, an as Quote, ao as REDIRECT_GATEWAYS, ap as ReelsService, aq as RegionService, ar as RejectedLine, au as ReviewService, ax as SearchService, ay as SettingService, ay as SettingsService, aA as StateService, aC as StoreService, aE as StorefrontMenu, aH as UploadService, aI as UserService, aL as VariantService, aM as VarniCustomDesignService, aN as VarniCustomProductService, aP as VendorService, aQ as WarrantyService, 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, b7 as currencyService, b8 as dealService, b9 as demoRequestService, bb as emptyPage, bc as enquiryService, bd as faqService, be as feedbackService, bi as galleryService, bj as homeService, bk as initService, bl as layoutService, bm as mediaUrl, bn as meilisearchService, bo as menuService, 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, 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, bZ as toPage, 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-1Tr-Urb_.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, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, X as InitService, Y as Invitation, Z as LayoutCollection, _ as LayoutService, $ as Lead, a1 as MeilisearchService, a2 as Member, a5 as MenuService, a8 as NewsletterService, ac as OrderService, ad as PageService, af as PaymentMethodService, ah as PluginService, ah as PluginsService, ai as PopularSearchService, aj as PopularityService, am as ProductService, an as ProfileService, ao as Quote, ap as REDIRECT_GATEWAYS, aq as ReelsService, ar as RegionService, as as RejectedLine, av as ReviewService, ay as SearchService, az as SettingService, az as SettingsService, aB as StateService, aD as StoreService, aF as StorefrontMenu, aI as ThemeSettings, aJ as ThemeSettingsResult, aK as UploadService, aL as UserService, aO as VariantService, aP as VarniCustomDesignService, aQ as VarniCustomProductService, aS as VendorService, aT as WarrantyService, aW as WishlistService, aX as addressService, aY as authService, aZ as autocompleteService, a_ as b2bService, a$ as bannerService, b0 as blogService, b1 as cartService, b2 as categoryService, b3 as chatService, b4 as checkoutService, b5 as collectionService, b6 as contactService, b7 as countryService, b8 as couponService, ba as currencyService, bb as dealService, bc as demoRequestService, be as emptyPage, bf as enquiryService, bg as faqService, bh as feedbackService, bl as galleryService, bm as homeService, bn as initService, bo as layoutService, bp as mediaUrl, bq as meilisearchService, br as menuService, bt as newsletterService, bu as orderService, bv as ownDomain, bw as pageService, bx as paymentMethodService, by as pluginService, bz as pluginsService, bA as popularSearchService, bB as popularityService, bE as productService, bF as profileService, bG as qs, bH as reelsService, bI as regionService, bJ as reviewService, bK as searchService, bL as setRequestHost, bM as settingService, bN as settingsService, bO as stateService, bP as staticStore, bQ as storeForHost, bR as storeService, c0 as toPage, c6 as uploadService, c7 as userService, c8 as variantService, c9 as varniCustomDesignService, ca as varniCustomProductService, cb as vendorService, cc as warrantyService, cd as wishlistService } from '../index-inrM-B0Z.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, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, X as InitService, Y as Invitation, Z as LayoutService, _ as Lead, a0 as MeilisearchService, a1 as Member, a4 as MenuService, a7 as NewsletterService, ab as OrderService, ac as PageService, ae as PaymentMethodService, ag as PluginService, ag as PluginsService, ah as PopularSearchService, ai as PopularityService, al as ProductService, am as ProfileService, an as Quote, ao as REDIRECT_GATEWAYS, ap as ReelsService, aq as RegionService, ar as RejectedLine, au as ReviewService, ax as SearchService, ay as SettingService, ay as SettingsService, aA as StateService, aC as StoreService, aE as StorefrontMenu, aH as UploadService, aI as UserService, aL as VariantService, aM as VarniCustomDesignService, aN as VarniCustomProductService, aP as VendorService, aQ as WarrantyService, 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, b7 as currencyService, b8 as dealService, b9 as demoRequestService, bb as emptyPage, bc as enquiryService, bd as faqService, be as feedbackService, bi as galleryService, bj as homeService, bk as initService, bl as layoutService, bm as mediaUrl, bn as meilisearchService, bo as menuService, 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, 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, bZ as toPage, 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-1Tr-Urb_.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, P as FaqService, Q as FeedbackService, S as GalleryService, T as HomeLayout, U as HomeLayoutSection, V as HomeService, X as InitService, Y as Invitation, Z as LayoutCollection, _ as LayoutService, $ as Lead, a1 as MeilisearchService, a2 as Member, a5 as MenuService, a8 as NewsletterService, ac as OrderService, ad as PageService, af as PaymentMethodService, ah as PluginService, ah as PluginsService, ai as PopularSearchService, aj as PopularityService, am as ProductService, an as ProfileService, ao as Quote, ap as REDIRECT_GATEWAYS, aq as ReelsService, ar as RegionService, as as RejectedLine, av as ReviewService, ay as SearchService, az as SettingService, az as SettingsService, aB as StateService, aD as StoreService, aF as StorefrontMenu, aI as ThemeSettings, aJ as ThemeSettingsResult, aK as UploadService, aL as UserService, aO as VariantService, aP as VarniCustomDesignService, aQ as VarniCustomProductService, aS as VendorService, aT as WarrantyService, aW as WishlistService, aX as addressService, aY as authService, aZ as autocompleteService, a_ as b2bService, a$ as bannerService, b0 as blogService, b1 as cartService, b2 as categoryService, b3 as chatService, b4 as checkoutService, b5 as collectionService, b6 as contactService, b7 as countryService, b8 as couponService, ba as currencyService, bb as dealService, bc as demoRequestService, be as emptyPage, bf as enquiryService, bg as faqService, bh as feedbackService, bl as galleryService, bm as homeService, bn as initService, bo as layoutService, bp as mediaUrl, bq as meilisearchService, br as menuService, bt as newsletterService, bu as orderService, bv as ownDomain, bw as pageService, bx as paymentMethodService, by as pluginService, bz as pluginsService, bA as popularSearchService, bB as popularityService, bE as productService, bF as profileService, bG as qs, bH as reelsService, bI as regionService, bJ as reviewService, bK as searchService, bL as setRequestHost, bM as settingService, bN as settingsService, bO as stateService, bP as staticStore, bQ as storeForHost, bR as storeService, c0 as toPage, c6 as uploadService, c7 as userService, c8 as variantService, c9 as varniCustomDesignService, ca as varniCustomProductService, cb as vendorService, cc as warrantyService, cd as wishlistService } from '../index-inrM-B0Z.js';
@@ -2032,6 +2032,31 @@ var OrderService = class extends BaseService {
2032
2032
  async listPublic(_args = {}) {
2033
2033
  return emptyPage();
2034
2034
  }
2035
+ /**
2036
+ * Opens an order with its number and the email or phone on it, no code. The
2037
+ * engine answers one 404 for an unknown number and a wrong contact. The
2038
+ * token it answers is kept like an order placed in this browser, so the
2039
+ * order page and `getOrder` read it again.
2040
+ */
2041
+ async openOrder({ orderNo, contact }) {
2042
+ const res = await this.data(
2043
+ `/api/orders/${encodeURIComponent(orderNo.trim())}/open`,
2044
+ { method: "POST", body: { contact: contact.trim() } }
2045
+ );
2046
+ rememberOrder({ number: res.order.number, token: res.access_token, cartId: "" });
2047
+ return { data: [toOrder(res.order)] };
2048
+ }
2049
+ /**
2050
+ * Opens an order from the link in its emails, which carries the order's key
2051
+ * (`/order-tracking?order=…&key=…`). The key is kept like an order placed in
2052
+ * this browser, so the page can drop it from the address bar.
2053
+ */
2054
+ async openOrderWithKey({ orderNo, key }) {
2055
+ const number = orderNo.trim();
2056
+ const order = await this.data(`/api/orders/${encodeURIComponent(number)}`, { query: { token: key.trim() } });
2057
+ rememberOrder({ number: order.number, token: key.trim(), cartId: "" });
2058
+ return { data: [toOrder(order)] };
2059
+ }
2035
2060
  /**
2036
2061
  * Sends a 4-digit code to the email or phone on the order, when `contact`
2037
2062
  * is that email or phone. The engine answers the same either way, so this
@@ -2715,7 +2740,7 @@ var pageService = new PageService();
2715
2740
  var faqService = new FaqService();
2716
2741
 
2717
2742
  // src/services/layout-service.ts
2718
- var IMAGE_KEYS = ["image", "mobile_image"];
2743
+ var MEDIA_KEYS = /* @__PURE__ */ new Set(["image", "mobile_image", "poster", "video_file"]);
2719
2744
  var LayoutService = class extends BaseService {
2720
2745
  async getHomeLayout({ preview } = {}) {
2721
2746
  let layout;
@@ -2733,17 +2758,53 @@ var LayoutService = class extends BaseService {
2733
2758
  theme: layout.theme,
2734
2759
  revision: layout.revision,
2735
2760
  preview: !!layout.preview,
2761
+ themeSettings: tokens(layout.theme_settings),
2736
2762
  sections: (layout.sections ?? []).map(toSection)
2737
2763
  };
2738
2764
  }
2765
+ /**
2766
+ * The store's design tokens, for a page other than the home page: the
2767
+ * published ones, or a preview key's draft. Null when there are none to
2768
+ * apply — nothing published, the editor off, an engine without the
2769
+ * module — and on any failure too: a missing look must never cost the
2770
+ * page.
2771
+ */
2772
+ async getThemeSettings({ preview } = {}) {
2773
+ try {
2774
+ const out = await this.data("/x/layouts/theme", {
2775
+ query: { preview: preview?.trim() || void 0 }
2776
+ });
2777
+ if (!out) return null;
2778
+ return { revision: out.revision, preview: !!out.preview, settings: tokens(out.settings) ?? {} };
2779
+ } catch {
2780
+ return null;
2781
+ }
2782
+ }
2739
2783
  };
2740
- function toSection(s) {
2741
- const settings = { ...s.settings ?? {} };
2742
- for (const key of IMAGE_KEYS) {
2743
- if (typeof settings[key] === "string") settings[key] = mediaUrl(settings[key]);
2784
+ function tokens(v) {
2785
+ return v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length ? { ...v } : null;
2786
+ }
2787
+ function withMedia(value, key) {
2788
+ if (Array.isArray(value)) return value.map((x) => withMedia(x, null));
2789
+ if (value && typeof value === "object") {
2790
+ return Object.fromEntries(Object.entries(value).map(([k, x]) => [k, withMedia(x, k)]));
2744
2791
  }
2792
+ if (key && MEDIA_KEYS.has(key) && typeof value === "string") return mediaUrl(value);
2793
+ return value;
2794
+ }
2795
+ function toSection(s) {
2796
+ const settings = withMedia(s.settings ?? {}, null);
2745
2797
  const out = { id: s.id, type: s.type, settings };
2746
2798
  if (s.type === "product-grid") out.products = (s.products ?? []).map((p) => toProduct(p));
2799
+ if (s.type === "collection-list") {
2800
+ out.collections = (s.collections ?? []).map((c) => ({
2801
+ id: String(c.id),
2802
+ title: c.title,
2803
+ slug: c.slug,
2804
+ link: `/collections/${c.slug}`,
2805
+ image: mediaUrl(c.image) ?? null
2806
+ }));
2807
+ }
2747
2808
  return out;
2748
2809
  }
2749
2810
  var layoutService = new LayoutService();