@misiki/gocommerce-connector 0.28.0 → 0.29.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 { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, N as CustomizerEditor, O as CustomizerFile, Q as CustomizerSavedDesign, R as CustomizerService, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a4 as GalleryService, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, am as MeilisearchService, an as Member, aq as MenuService, at as NewsletterService, ay as OrderService, az as PageLayout, aA as PageService, aC as PaymentMethodService, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b4 as StoreService, b6 as StorefrontMenu, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bq as WishlistService, br as addressService, bs as authService, bt as autocompleteService, bu as b2bService, bv as bannerService, bw as blogService, bx as cartService, by as categoryService, bz as chatService, bA as checkoutService, bB as collectionService, bC as contactService, bD as countryService, bE as couponService, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bS as galleryService, bT as googleReviewService, bU as homeService, bV as initService, bW as layoutService, bX as mediaUrl, bY as meilisearchService, bZ as menuService, b$ as newsletterService, c0 as orderService, c1 as ownDomain, c2 as pageService, c3 as paymentMethodService, c4 as pluginService, c5 as pluginsService, c6 as popularSearchService, c7 as popularityService, ca as productService, cc as profileService, cd as qs, ce as reelsService, cf as regionService, cg as reviewService, ch as searchService, ci as setRequestHost, cj as settingService, ck as settingsService, cl as stateService, cm as staticStore, cn as storeForHost, co as storeService, cC as toPage, cF as toStorefrontFacets, cJ as uploadService, cK as userService, cL as variantService, cM as varniCustomDesignService, cN as varniCustomProductService, cO as vendorService, cP as warrantyService, cQ as whatsappService, cR as wishlistService } from '../index-BaFtBtaA.cjs';
1
+ export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, N as CustomizerEditor, O as CustomizerFile, Q as CustomizerSavedDesign, R as CustomizerService, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a4 as GalleryService, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, am as MeilisearchService, an as Member, aq as MenuService, at as NewsletterService, ay as OrderService, az as PageLayout, aA as PageService, aC as PaymentMethodService, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b4 as StoreService, b6 as StorefrontMenu, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bq as WishlistService, br as addressService, bs as authService, bt as autocompleteService, bu as b2bService, bv as bannerService, bw as blogService, bx as cartService, by as categoryService, bz as chatService, bA as checkoutService, bB as collectionService, bC as contactService, bD as countryService, bE as couponService, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bS as galleryService, bT as googleReviewService, bU as homeService, bV as initService, bW as layoutService, bX as mediaUrl, bY as meilisearchService, bZ as menuService, b$ as newsletterService, c0 as orderService, c1 as ownDomain, c2 as pageService, c3 as paymentMethodService, c4 as pluginService, c5 as pluginsService, c6 as popularSearchService, c7 as popularityService, ca as productService, cc as profileService, cd as qs, ce as reelsService, cf as regionService, cg as reviewService, ch as searchService, ci as setRequestHost, cj as settingService, ck as settingsService, cl as stateService, cm as staticStore, cn as storeForHost, co as storeService, cC as toPage, cF as toStorefrontFacets, cJ as uploadService, cK as userService, cL as variantService, cM as varniCustomDesignService, cN as varniCustomProductService, cO as vendorService, cP as warrantyService, cQ as whatsappService, cR as wishlistService } from '../index-DOlNI60Y.cjs';
@@ -1 +1 @@
1
- export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, N as CustomizerEditor, O as CustomizerFile, Q as CustomizerSavedDesign, R as CustomizerService, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a4 as GalleryService, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, am as MeilisearchService, an as Member, aq as MenuService, at as NewsletterService, ay as OrderService, az as PageLayout, aA as PageService, aC as PaymentMethodService, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b4 as StoreService, b6 as StorefrontMenu, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bq as WishlistService, br as addressService, bs as authService, bt as autocompleteService, bu as b2bService, bv as bannerService, bw as blogService, bx as cartService, by as categoryService, bz as chatService, bA as checkoutService, bB as collectionService, bC as contactService, bD as countryService, bE as couponService, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bS as galleryService, bT as googleReviewService, bU as homeService, bV as initService, bW as layoutService, bX as mediaUrl, bY as meilisearchService, bZ as menuService, b$ as newsletterService, c0 as orderService, c1 as ownDomain, c2 as pageService, c3 as paymentMethodService, c4 as pluginService, c5 as pluginsService, c6 as popularSearchService, c7 as popularityService, ca as productService, cc as profileService, cd as qs, ce as reelsService, cf as regionService, cg as reviewService, ch as searchService, ci as setRequestHost, cj as settingService, ck as settingsService, cl as stateService, cm as staticStore, cn as storeForHost, co as storeService, cC as toPage, cF as toStorefrontFacets, cJ as uploadService, cK as userService, cL as variantService, cM as varniCustomDesignService, cN as varniCustomProductService, cO as vendorService, cP as warrantyService, cQ as whatsappService, cR as wishlistService } from '../index-BaFtBtaA.js';
1
+ export { b as AddressService, d as Approval, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, o as CartService, p as CatalogService, r as CategoryService, s as ChatService, v as CheckoutService, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, I as Credit, J as CurrencyService, N as CustomizerEditor, O as CustomizerFile, Q as CustomizerSavedDesign, R as CustomizerService, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a4 as GalleryService, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, am as MeilisearchService, an as Member, aq as MenuService, at as NewsletterService, ay as OrderService, az as PageLayout, aA as PageService, aC as PaymentMethodService, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b4 as StoreService, b6 as StorefrontMenu, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bq as WishlistService, br as addressService, bs as authService, bt as autocompleteService, bu as b2bService, bv as bannerService, bw as blogService, bx as cartService, by as categoryService, bz as chatService, bA as checkoutService, bB as collectionService, bC as contactService, bD as countryService, bE as couponService, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bS as galleryService, bT as googleReviewService, bU as homeService, bV as initService, bW as layoutService, bX as mediaUrl, bY as meilisearchService, bZ as menuService, b$ as newsletterService, c0 as orderService, c1 as ownDomain, c2 as pageService, c3 as paymentMethodService, c4 as pluginService, c5 as pluginsService, c6 as popularSearchService, c7 as popularityService, ca as productService, cc as profileService, cd as qs, ce as reelsService, cf as regionService, cg as reviewService, ch as searchService, ci as setRequestHost, cj as settingService, ck as settingsService, cl as stateService, cm as staticStore, cn as storeForHost, co as storeService, cC as toPage, cF as toStorefrontFacets, cJ as uploadService, cK as userService, cL as variantService, cM as varniCustomDesignService, cN as varniCustomProductService, cO as vendorService, cP as warrantyService, cQ as whatsappService, cR as wishlistService } from '../index-DOlNI60Y.js';
@@ -1572,7 +1572,23 @@ function attributesFrom(p) {
1572
1572
  return Object.keys(out).length ? out : void 0;
1573
1573
  }
1574
1574
  var counts = (values) => Object.fromEntries((values ?? []).map((v) => [v.value, v.count]));
1575
- function toStorefrontFacets(f) {
1575
+ function categoryFacets(counted, tree) {
1576
+ const byId = new Map(tree.map((c) => [c.id, c]));
1577
+ const totals = /* @__PURE__ */ new Map();
1578
+ for (const { id: id2, count } of counted) {
1579
+ for (let c = byId.get(id2); c; c = c.parent_id === null ? void 0 : byId.get(c.parent_id)) {
1580
+ totals.set(c.id, (totals.get(c.id) ?? 0) + count);
1581
+ }
1582
+ }
1583
+ const kept = tree.filter((c) => totals.has(c.id)).sort((a, b) => a.position - b.position || a.id - b.id);
1584
+ const parentOf = (c) => c.parent_id !== null && byId.has(c.parent_id) ? c.parent_id : null;
1585
+ const under = (parent) => kept.filter((c) => parentOf(c) === parent).flatMap((c) => [{ name: c.title, slug: c.slug, count: totals.get(c.id), depth: c.depth }, ...under(c.id)]);
1586
+ return [
1587
+ ...under(null),
1588
+ ...counted.filter((c) => !byId.has(c.id)).map((c) => ({ name: c.title, slug: c.slug, count: c.count, depth: 0 }))
1589
+ ];
1590
+ }
1591
+ function toStorefrontFacets(f, tree = []) {
1576
1592
  if (!f) return { priceStat: {}, categories: [], tags: [], allFilters: {} };
1577
1593
  const allFilters = {};
1578
1594
  const group = (key, values) => {
@@ -1583,7 +1599,7 @@ function toStorefrontFacets(f) {
1583
1599
  for (const [handle, values] of Object.entries(f.attributes ?? {})) group(`attributes.${handle}`, values);
1584
1600
  return {
1585
1601
  priceStat: f.price ? { min: toMajor(f.price.min), max: toMajor(f.price.max) } : {},
1586
- categories: (f.categories ?? []).map((c) => ({ name: c.title, slug: c.slug, count: c.count })),
1602
+ categories: categoryFacets(f.categories ?? [], tree),
1587
1603
  tags: (f.tags ?? []).map((t) => ({ name: t.value, count: t.count })),
1588
1604
  allFilters
1589
1605
  };
@@ -1616,13 +1632,14 @@ var SearchService = class extends CatalogService {
1616
1632
  productTypes: listParam(p, "product_type"),
1617
1633
  facets: true
1618
1634
  });
1635
+ const tree = res.facets?.categories?.length ? await this.facts.categories().catch(() => []) : [];
1619
1636
  return {
1620
1637
  data: res.data,
1621
1638
  count: res.count,
1622
1639
  totalPages: res.noOfPage,
1623
1640
  page: res.page,
1624
1641
  categoryHierarchy: res.categoryHierarchy,
1625
- facets: toStorefrontFacets(res.facets)
1642
+ facets: toStorefrontFacets(res.facets, tree)
1626
1643
  };
1627
1644
  } catch (err) {
1628
1645
  if (err?.status === 404) return this.emptyResult();