@misiki/gocommerce-connector 0.27.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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as CustomizerDesign, M as CustomizerDocument, N as CustomizerEditor, O as CustomizerFile, P as CustomizerLayer, Q as CustomizerSavedDesign, R as CustomizerService, S as CustomizerSetup, T as CustomizerUpload, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, Y as Envelope, Z as FacetValue, _ as Faq, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a2 as FreeShipping, a3 as Fulfillment, a4 as GalleryService, a5 as GooglePlace, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, a9 as GoogleSurvey, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, ae as IdentityAddress, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, al as ListMeta, am as MeilisearchService, an as Member, ao as Menu, ap as MenuItem, aq as MenuService, ar as MenuSummary, as as Money, at as NewsletterService, au as Offer, av as OpeningHours, aw as Order, ax as OrderLine, ay as OrderService, az as PageLayout, aA as PageService, aB as PaymentIntent, aC as PaymentMethodService, aD as Plugin, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG as PopularityService, aH as Postcode, aI as Product, aJ as ProductFacets, 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b3 as StoreProfile, b4 as StoreService, b5 as StorefrontCategory, b6 as StorefrontMenu, b7 as StorefrontOrder, b8 as StorefrontProduct, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bd as Variant, be as VariantImage, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bi as Vendor, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bo as Wishlist, bp as WishlistItem, 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, bF as currencyExponent, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bK as emptyCart, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bP as fromEngineAddress, bQ as fromIdentityAddress, bR as fromSearchDoc, 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 minorToMajor, 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, c8 as priceOf, c9 as productImages, ca as productService, cb as productVideos, 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, cp as toAddOn, cq as toCart, cr as toCartLine, cs as toCartOffer, ct as toCategory, cu as toCmsPage, cv as toCollection, cw as toEngineAddress, cx as toFreeShipping, cy as toIdentityAddress, cz as toMajor, cA as toMinor, cB as toOrder, cC as toPage, cD as toProduct, cE as toRating, cF as toStorefrontFacets, cG as toUser, cH as toVariant, cI as toVendor, 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-BY0qUnNO.cjs';
1
+ export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as CustomizerDesign, M as CustomizerDocument, N as CustomizerEditor, O as CustomizerFile, P as CustomizerLayer, Q as CustomizerSavedDesign, R as CustomizerService, S as CustomizerSetup, T as CustomizerUpload, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, Y as Envelope, Z as FacetValue, _ as Faq, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a2 as FreeShipping, a3 as Fulfillment, a4 as GalleryService, a5 as GooglePlace, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, a9 as GoogleSurvey, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, ae as IdentityAddress, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, al as ListMeta, am as MeilisearchService, an as Member, ao as Menu, ap as MenuItem, aq as MenuService, ar as MenuSummary, as as Money, at as NewsletterService, au as Offer, av as OpeningHours, aw as Order, ax as OrderLine, ay as OrderService, az as PageLayout, aA as PageService, aB as PaymentIntent, aC as PaymentMethodService, aD as Plugin, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG as PopularityService, aH as Postcode, aI as Product, aJ as ProductFacets, 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b3 as StoreProfile, b4 as StoreService, b5 as StorefrontCategory, b6 as StorefrontMenu, b7 as StorefrontOrder, b8 as StorefrontProduct, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bd as Variant, be as VariantImage, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bi as Vendor, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bo as Wishlist, bp as WishlistItem, 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, bF as currencyExponent, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bK as emptyCart, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bP as fromEngineAddress, bQ as fromIdentityAddress, bR as fromSearchDoc, 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 minorToMajor, 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, c8 as priceOf, c9 as productImages, ca as productService, cb as productVideos, 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, cp as toAddOn, cq as toCart, cr as toCartLine, cs as toCartOffer, ct as toCategory, cu as toCmsPage, cv as toCollection, cw as toEngineAddress, cx as toFreeShipping, cy as toIdentityAddress, cz as toMajor, cA as toMinor, cB as toOrder, cC as toPage, cD as toProduct, cE as toRating, cF as toStorefrontFacets, cG as toUser, cH as toVariant, cI as toVendor, 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';
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 AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as CustomizerDesign, M as CustomizerDocument, N as CustomizerEditor, O as CustomizerFile, P as CustomizerLayer, Q as CustomizerSavedDesign, R as CustomizerService, S as CustomizerSetup, T as CustomizerUpload, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, Y as Envelope, Z as FacetValue, _ as Faq, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a2 as FreeShipping, a3 as Fulfillment, a4 as GalleryService, a5 as GooglePlace, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, a9 as GoogleSurvey, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, ae as IdentityAddress, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, al as ListMeta, am as MeilisearchService, an as Member, ao as Menu, ap as MenuItem, aq as MenuService, ar as MenuSummary, as as Money, at as NewsletterService, au as Offer, av as OpeningHours, aw as Order, ax as OrderLine, ay as OrderService, az as PageLayout, aA as PageService, aB as PaymentIntent, aC as PaymentMethodService, aD as Plugin, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG as PopularityService, aH as Postcode, aI as Product, aJ as ProductFacets, 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b3 as StoreProfile, b4 as StoreService, b5 as StorefrontCategory, b6 as StorefrontMenu, b7 as StorefrontOrder, b8 as StorefrontProduct, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bd as Variant, be as VariantImage, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bi as Vendor, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bo as Wishlist, bp as WishlistItem, 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, bF as currencyExponent, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bK as emptyCart, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bP as fromEngineAddress, bQ as fromIdentityAddress, bR as fromSearchDoc, 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 minorToMajor, 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, c8 as priceOf, c9 as productImages, ca as productService, cb as productVideos, 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, cp as toAddOn, cq as toCart, cr as toCartLine, cs as toCartOffer, ct as toCategory, cu as toCmsPage, cv as toCollection, cw as toEngineAddress, cx as toFreeShipping, cy as toIdentityAddress, cz as toMajor, cA as toMinor, cB as toOrder, cC as toPage, cD as toProduct, cE as toRating, cF as toStorefrontFacets, cG as toUser, cH as toVariant, cI as toVendor, 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-BY0qUnNO.js';
1
+ export { A as AddOn, a as Address, b as AddressService, c as AppliedDiscount, d as Approval, e as AuthResponse, f as AuthService, g as AutocompleteService, B as B2bPlaced, h as B2bRole, i as B2bService, j as BannerService, k as BaseService, l as BlogService, C as Cart, m as CartLine, n as CartOffer, o as CartService, p as CatalogService, q as Category, r as CategoryService, s as ChatService, t as CheckoutOptions, u as CheckoutResult, v as CheckoutService, w as CmsPage, x as Collection, y as CollectionService, z as Company, D as CompanyOrder, E as ContactService, F as CountryService, G as CouponService, H as Credentials, I as Credit, J as CurrencyService, K as Customer, L as CustomizerDesign, M as CustomizerDocument, N as CustomizerEditor, O as CustomizerFile, P as CustomizerLayer, Q as CustomizerSavedDesign, R as CustomizerService, S as CustomizerSetup, T as CustomizerUpload, U as DealService, V as DemoRequestService, W as EngineRequest, X as EnquiryService, Y as Envelope, Z as FacetValue, _ as Faq, $ as FaqService, a0 as FeedbackService, a1 as FooterSettings, a2 as FreeShipping, a3 as Fulfillment, a4 as GalleryService, a5 as GooglePlace, a6 as GoogleReview, a7 as GoogleReviewService, a8 as GoogleReviews, a9 as GoogleSurvey, aa as HeaderSettings, ab as HomeLayout, ac as HomeLayoutSection, ad as HomeService, ae as IdentityAddress, af as InitService, ag as Invitation, ah as LayoutCollection, ai as LayoutPage, aj as LayoutService, ak as Lead, al as ListMeta, am as MeilisearchService, an as Member, ao as Menu, ap as MenuItem, aq as MenuService, ar as MenuSummary, as as Money, at as NewsletterService, au as Offer, av as OpeningHours, aw as Order, ax as OrderLine, ay as OrderService, az as PageLayout, aA as PageService, aB as PaymentIntent, aC as PaymentMethodService, aD as Plugin, aE as PluginService, aE as PluginsService, aF as PopularSearchService, aG as PopularityService, aH as Postcode, aI as Product, aJ as ProductFacets, 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, a_ as SiteChrome, a$ as SiteFooter, b0 as SiteHeader, b1 as SocialLink, b2 as StateService, b3 as StoreProfile, b4 as StoreService, b5 as StorefrontCategory, b6 as StorefrontMenu, b7 as StorefrontOrder, b8 as StorefrontProduct, b9 as ThemeSettings, ba as ThemeSettingsResult, bb as UploadService, bc as UserService, bd as Variant, be as VariantImage, bf as VariantService, bg as VarniCustomDesignService, bh as VarniCustomProductService, bi as Vendor, bj as VendorService, bk as WarrantyService, bl as WhatsappConsent, bm as WhatsappConsentOffer, bn as WhatsappService, bo as Wishlist, bp as WishlistItem, 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, bF as currencyExponent, bG as currencyService, bH as customizerService, bI as dealService, bJ as demoRequestService, bK as emptyCart, bL as emptyPage, bM as enquiryService, bN as faqService, bO as feedbackService, bP as fromEngineAddress, bQ as fromIdentityAddress, bR as fromSearchDoc, 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 minorToMajor, 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, c8 as priceOf, c9 as productImages, ca as productService, cb as productVideos, 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, cp as toAddOn, cq as toCart, cr as toCartLine, cs as toCartOffer, ct as toCategory, cu as toCmsPage, cv as toCollection, cw as toEngineAddress, cx as toFreeShipping, cy as toIdentityAddress, cz as toMajor, cA as toMinor, cB as toOrder, cC as toPage, cD as toProduct, cE as toRating, cF as toStorefrontFacets, cG as toUser, cH as toVariant, cI as toVendor, 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';
2
2
 
3
3
  /**
4
4
  * The two ways a call through this connector fails.
package/dist/index.js CHANGED
@@ -438,12 +438,19 @@ var BaseService = class _BaseService {
438
438
  * Prices a cart at the signed-in shopper's customer-group prices. The
439
439
  * engine does this only for an account whose email is confirmed (403
440
440
  * otherwise), and the cart stays the shopper's either way — so a refusal
441
- * is not an error, and neither is a build without ext/identity.
441
+ * is not an error, and neither is a build without ext/identity. A refused
442
+ * claim still gives the cart the account's email, which the claim would
443
+ * have set, or the checkout asks the shopper for it again.
442
444
  */
443
445
  async claimCartForAccount(cartId) {
444
446
  try {
445
447
  await this.engine("/x/identity/me/carts", { method: "POST", body: { cart_id: cartId }, auth: true });
446
448
  } catch {
449
+ const email = currentMe()?.email;
450
+ if (email)
451
+ await this.engine(`/api/carts/${encodeURIComponent(cartId)}/email`, { method: "PUT", body: { email } }).catch(
452
+ () => void 0
453
+ );
447
454
  }
448
455
  }
449
456
  // ------------------------------------------------------------ Litekart verbs
@@ -1584,7 +1591,23 @@ function attributesFrom(p) {
1584
1591
  return Object.keys(out).length ? out : void 0;
1585
1592
  }
1586
1593
  var counts = (values) => Object.fromEntries((values ?? []).map((v) => [v.value, v.count]));
1587
- function toStorefrontFacets(f) {
1594
+ function categoryFacets(counted, tree) {
1595
+ const byId = new Map(tree.map((c) => [c.id, c]));
1596
+ const totals = /* @__PURE__ */ new Map();
1597
+ for (const { id: id2, count } of counted) {
1598
+ for (let c = byId.get(id2); c; c = c.parent_id === null ? void 0 : byId.get(c.parent_id)) {
1599
+ totals.set(c.id, (totals.get(c.id) ?? 0) + count);
1600
+ }
1601
+ }
1602
+ const kept = tree.filter((c) => totals.has(c.id)).sort((a, b) => a.position - b.position || a.id - b.id);
1603
+ const parentOf = (c) => c.parent_id !== null && byId.has(c.parent_id) ? c.parent_id : null;
1604
+ 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)]);
1605
+ return [
1606
+ ...under(null),
1607
+ ...counted.filter((c) => !byId.has(c.id)).map((c) => ({ name: c.title, slug: c.slug, count: c.count, depth: 0 }))
1608
+ ];
1609
+ }
1610
+ function toStorefrontFacets(f, tree = []) {
1588
1611
  if (!f) return { priceStat: {}, categories: [], tags: [], allFilters: {} };
1589
1612
  const allFilters = {};
1590
1613
  const group = (key, values) => {
@@ -1595,7 +1618,7 @@ function toStorefrontFacets(f) {
1595
1618
  for (const [handle, values] of Object.entries(f.attributes ?? {})) group(`attributes.${handle}`, values);
1596
1619
  return {
1597
1620
  priceStat: f.price ? { min: toMajor(f.price.min), max: toMajor(f.price.max) } : {},
1598
- categories: (f.categories ?? []).map((c) => ({ name: c.title, slug: c.slug, count: c.count })),
1621
+ categories: categoryFacets(f.categories ?? [], tree),
1599
1622
  tags: (f.tags ?? []).map((t) => ({ name: t.value, count: t.count })),
1600
1623
  allFilters
1601
1624
  };
@@ -1628,13 +1651,14 @@ var SearchService = class extends CatalogService {
1628
1651
  productTypes: listParam(p, "product_type"),
1629
1652
  facets: true
1630
1653
  });
1654
+ const tree = res.facets?.categories?.length ? await this.facts.categories().catch(() => []) : [];
1631
1655
  return {
1632
1656
  data: res.data,
1633
1657
  count: res.count,
1634
1658
  totalPages: res.noOfPage,
1635
1659
  page: res.page,
1636
1660
  categoryHierarchy: res.categoryHierarchy,
1637
- facets: toStorefrontFacets(res.facets)
1661
+ facets: toStorefrontFacets(res.facets, tree)
1638
1662
  };
1639
1663
  } catch (err) {
1640
1664
  if (err?.status === 404) return this.emptyResult();