@misiki/gocommerce-connector 0.9.1 → 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.
@@ -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 LayoutCollection, _ as LayoutPage, $ as LayoutService, a0 as Lead, a2 as MeilisearchService, a3 as Member, a6 as MenuService, a9 as NewsletterService, ad as OrderService, ae as PageLayout, af as PageService, ah as PaymentMethodService, aj as PluginService, aj as PluginsService, ak as PopularSearchService, al as PopularityService, ao as ProductService, ap as ProfileService, aq as Quote, ar as REDIRECT_GATEWAYS, as as ReelsService, at as RegionService, au as RejectedLine, ax as ReviewService, aA as SearchService, aB as SettingService, aB as SettingsService, aD as StateService, aF as StoreService, aH as StorefrontMenu, aK as ThemeSettings, aL as ThemeSettingsResult, aM as UploadService, aN as UserService, aQ as VariantService, aR as VarniCustomDesignService, aS as VarniCustomProductService, aU as VendorService, aV as WarrantyService, 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, bc as currencyService, bd as dealService, be as demoRequestService, bg as emptyPage, bh as enquiryService, bi as faqService, bj as feedbackService, bn as galleryService, bo as homeService, bp as initService, bq as layoutService, br as mediaUrl, bs as meilisearchService, bt as menuService, 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, 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, c2 as toPage, 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-DSvV8FbK.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, Q as FaqService, R as FeedbackService, S as FooterSettings, U as GalleryService, V as HeaderSettings, W as HomeLayout, X as HomeLayoutSection, Y as HomeService, _ as InitService, $ as Invitation, a0 as LayoutCollection, a1 as LayoutPage, a2 as LayoutService, a3 as Lead, a5 as MeilisearchService, a6 as Member, a9 as MenuService, ac as NewsletterService, ag as OrderService, ah as PageLayout, ai as PageService, ak as PaymentMethodService, am as PluginService, am as PluginsService, an as PopularSearchService, ao as PopularityService, as as ProductService, at as ProfileService, au as Quote, av as REDIRECT_GATEWAYS, aw as ReelsService, ax as RegionService, ay as RejectedLine, aB as ReviewService, aE as SearchService, aF as SettingService, aF as SettingsService, aH as SiteChrome, aI as SiteFooter, aJ as SiteHeader, aK as SocialLink, aL as StateService, aN as StoreService, aP as StorefrontMenu, aS as ThemeSettings, aT as ThemeSettingsResult, aU as UploadService, aV as UserService, aY as VariantService, aZ as VarniCustomDesignService, a_ as VarniCustomProductService, b0 as VendorService, b1 as WarrantyService, 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, bk as currencyService, bl as dealService, bm as demoRequestService, bo as emptyPage, bp as enquiryService, bq as faqService, br as feedbackService, bv as galleryService, bw as homeService, bx as initService, by as layoutService, bz as mediaUrl, bA as meilisearchService, bB as menuService, 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, 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, ca as toPage, cd as toStorefrontFacets, 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';
@@ -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 LayoutCollection, _ as LayoutPage, $ as LayoutService, a0 as Lead, a2 as MeilisearchService, a3 as Member, a6 as MenuService, a9 as NewsletterService, ad as OrderService, ae as PageLayout, af as PageService, ah as PaymentMethodService, aj as PluginService, aj as PluginsService, ak as PopularSearchService, al as PopularityService, ao as ProductService, ap as ProfileService, aq as Quote, ar as REDIRECT_GATEWAYS, as as ReelsService, at as RegionService, au as RejectedLine, ax as ReviewService, aA as SearchService, aB as SettingService, aB as SettingsService, aD as StateService, aF as StoreService, aH as StorefrontMenu, aK as ThemeSettings, aL as ThemeSettingsResult, aM as UploadService, aN as UserService, aQ as VariantService, aR as VarniCustomDesignService, aS as VarniCustomProductService, aU as VendorService, aV as WarrantyService, 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, bc as currencyService, bd as dealService, be as demoRequestService, bg as emptyPage, bh as enquiryService, bi as faqService, bj as feedbackService, bn as galleryService, bo as homeService, bp as initService, bq as layoutService, br as mediaUrl, bs as meilisearchService, bt as menuService, 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, 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, c2 as toPage, 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-DSvV8FbK.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, Q as FaqService, R as FeedbackService, S as FooterSettings, U as GalleryService, V as HeaderSettings, W as HomeLayout, X as HomeLayoutSection, Y as HomeService, _ as InitService, $ as Invitation, a0 as LayoutCollection, a1 as LayoutPage, a2 as LayoutService, a3 as Lead, a5 as MeilisearchService, a6 as Member, a9 as MenuService, ac as NewsletterService, ag as OrderService, ah as PageLayout, ai as PageService, ak as PaymentMethodService, am as PluginService, am as PluginsService, an as PopularSearchService, ao as PopularityService, as as ProductService, at as ProfileService, au as Quote, av as REDIRECT_GATEWAYS, aw as ReelsService, ax as RegionService, ay as RejectedLine, aB as ReviewService, aE as SearchService, aF as SettingService, aF as SettingsService, aH as SiteChrome, aI as SiteFooter, aJ as SiteHeader, aK as SocialLink, aL as StateService, aN as StoreService, aP as StorefrontMenu, aS as ThemeSettings, aT as ThemeSettingsResult, aU as UploadService, aV as UserService, aY as VariantService, aZ as VarniCustomDesignService, a_ as VarniCustomProductService, b0 as VendorService, b1 as WarrantyService, 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, bk as currencyService, bl as dealService, bm as demoRequestService, bo as emptyPage, bp as enquiryService, bq as faqService, br as feedbackService, bv as galleryService, bw as homeService, bx as initService, by as layoutService, bz as mediaUrl, bA as meilisearchService, bB as menuService, 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, 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, ca as toPage, cd as toStorefrontFacets, 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';
@@ -1065,11 +1065,14 @@ var StoreFacts = class extends BaseService {
1065
1065
 
1066
1066
  // src/services/catalog.ts
1067
1067
  var PAGE_SIZE = 24;
1068
- function indexSort(sort) {
1069
- if (!sort) return void 0;
1068
+ function sortParts(sort) {
1070
1069
  const s = sort.trim();
1071
1070
  const [field, dir] = s.startsWith("-") ? [s.slice(1), "desc"] : s.includes(":") ? s.split(":") : [s, "asc"];
1072
- const d = dir === "desc" ? "desc" : "asc";
1071
+ return [field, dir === "desc" ? "desc" : "asc"];
1072
+ }
1073
+ function indexSort(sort) {
1074
+ if (!sort) return void 0;
1075
+ const [field, d] = sortParts(sort);
1073
1076
  switch (field) {
1074
1077
  case "price":
1075
1078
  return `price_minor:${d}`;
@@ -1085,6 +1088,20 @@ function indexSort(sort) {
1085
1088
  return void 0;
1086
1089
  }
1087
1090
  }
1091
+ function engineSort(sort) {
1092
+ if (!sort || NATURAL.has(sort)) return {};
1093
+ const [field, order] = sortParts(sort);
1094
+ const key = {
1095
+ price: "price",
1096
+ createdAt: "created_at",
1097
+ created_at: "created_at",
1098
+ updatedAt: "updated_at",
1099
+ updated_at: "updated_at",
1100
+ title: "title",
1101
+ name: "title"
1102
+ }[field];
1103
+ return key ? { sort: key, order } : {};
1104
+ }
1088
1105
  var NATURAL = /* @__PURE__ */ new Set([
1089
1106
  "-createdAt",
1090
1107
  "createdAt:desc",
@@ -1094,6 +1111,7 @@ var NATURAL = /* @__PURE__ */ new Set([
1094
1111
  "popularity:desc"
1095
1112
  ]);
1096
1113
  var quote = (s) => `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
1114
+ var legacyListing = /* @__PURE__ */ new Set();
1097
1115
  var CatalogService = class extends BaseService {
1098
1116
  facts = new StoreFacts(this._fetch);
1099
1117
  async queryCatalog(q) {
@@ -1103,6 +1121,39 @@ var CatalogService = class extends BaseService {
1103
1121
  const wantsRange = Number.isFinite(q.priceFrom) || Number.isFinite(q.priceTo);
1104
1122
  const sortKey = q.sort && !NATURAL.has(q.sort) ? indexSort(q.sort) : void 0;
1105
1123
  const hierarchy = q.category ? await this.facts.hierarchy(q.category) : [];
1124
+ const attr = Object.entries(q.attributes ?? {}).flatMap(
1125
+ ([handle, values]) => values.filter(Boolean).map((v) => `${handle}:${v}`)
1126
+ );
1127
+ if (q.facets && !legacyListing.has(this.engineBase())) {
1128
+ const { currency } = await this.facts.ready();
1129
+ const minor = (n) => Number.isFinite(n) ? Math.max(0, toMinor(n, currency)) : void 0;
1130
+ const env2 = await this.engine("/api/products", {
1131
+ query: {
1132
+ q: search,
1133
+ page,
1134
+ limit,
1135
+ channel: this.creds.channel,
1136
+ category: q.category,
1137
+ tag: q.tags,
1138
+ vendor: q.vendors,
1139
+ product_type: q.productTypes,
1140
+ attr,
1141
+ price_min: minor(q.priceFrom),
1142
+ price_max: minor(q.priceTo),
1143
+ ...engineSort(q.sort),
1144
+ facets: 1
1145
+ }
1146
+ });
1147
+ if (env2.meta?.facets) {
1148
+ return {
1149
+ ...toPage(env2, (p) => toProduct(p)),
1150
+ categoryHierarchy: hierarchy,
1151
+ sorted: true,
1152
+ facets: env2.meta.facets
1153
+ };
1154
+ }
1155
+ legacyListing.add(this.engineBase());
1156
+ }
1106
1157
  if ((sortKey || wantsRange) && await this.facts.pluginOn("meilisearch")) {
1107
1158
  const filters = [];
1108
1159
  if (q.category) {
@@ -1150,9 +1201,6 @@ var CatalogService = class extends BaseService {
1150
1201
  sorted
1151
1202
  };
1152
1203
  }
1153
- const attr = Object.entries(q.attributes ?? {}).flatMap(
1154
- ([handle, values]) => values.filter(Boolean).map((v) => `${handle}:${v}`)
1155
- );
1156
1204
  const env = await this.engine("/api/products", {
1157
1205
  query: { q: search, page, limit, channel: this.creds.channel, attr }
1158
1206
  });
@@ -1318,16 +1366,44 @@ var num = (v) => {
1318
1366
  const n = Number(v);
1319
1367
  return Number.isFinite(n) ? n : void 0;
1320
1368
  };
1369
+ function decodeOnce(v) {
1370
+ try {
1371
+ return decodeURIComponent(v);
1372
+ } catch {
1373
+ return v;
1374
+ }
1375
+ }
1376
+ function listParam(p, key) {
1377
+ const out = p.getAll(key).flatMap((v) => decodeOnce(v).split(",")).map((v) => v.trim()).filter(Boolean);
1378
+ return out.length ? out : void 0;
1379
+ }
1321
1380
  function attributesFrom(p) {
1322
1381
  const out = {};
1323
- for (const [key, value] of p) {
1382
+ for (const key of new Set(p.keys())) {
1324
1383
  if (!key.startsWith("attributes.")) continue;
1325
1384
  const handle = key.slice("attributes.".length);
1326
- const values = value.split(",").map((v) => decodeURIComponent(v).trim()).filter(Boolean);
1327
- if (handle && values.length) out[handle] = [...out[handle] ?? [], ...values];
1385
+ const values = listParam(p, key);
1386
+ if (handle && values) out[handle] = values;
1328
1387
  }
1329
1388
  return Object.keys(out).length ? out : void 0;
1330
1389
  }
1390
+ var counts = (values) => Object.fromEntries((values ?? []).map((v) => [v.value, v.count]));
1391
+ function toStorefrontFacets(f) {
1392
+ if (!f) return { priceStat: {}, categories: [], tags: [], allFilters: {} };
1393
+ const allFilters = {};
1394
+ const group = (key, values) => {
1395
+ if (values?.length) allFilters[key] = counts(values);
1396
+ };
1397
+ group("vendor", f.vendors);
1398
+ group("product_type", f.product_types);
1399
+ for (const [handle, values] of Object.entries(f.attributes ?? {})) group(`attributes.${handle}`, values);
1400
+ return {
1401
+ priceStat: f.price ? { min: toMajor(f.price.min), max: toMajor(f.price.max) } : {},
1402
+ categories: (f.categories ?? []).map((c) => ({ name: c.title, slug: c.slug, count: c.count })),
1403
+ tags: (f.tags ?? []).map((t) => ({ name: t.value, count: t.count })),
1404
+ allFilters
1405
+ };
1406
+ }
1331
1407
  var SearchService = class extends CatalogService {
1332
1408
  emptyResult() {
1333
1409
  return {
@@ -1335,7 +1411,7 @@ var SearchService = class extends CatalogService {
1335
1411
  count: 0,
1336
1412
  totalPages: 0,
1337
1413
  categoryHierarchy: [],
1338
- facets: { priceStat: {}, categories: [], tags: [], allFilters: {} }
1414
+ facets: toStorefrontFacets()
1339
1415
  };
1340
1416
  }
1341
1417
  async searchWithUrl(url, slug) {
@@ -1350,7 +1426,11 @@ var SearchService = class extends CatalogService {
1350
1426
  category: slug || p.get("categories")?.split(",")[0] || void 0,
1351
1427
  priceFrom: num(p.get("priceFrom")) ?? num(from ?? null),
1352
1428
  priceTo: num(p.get("priceTo")) ?? num(to ?? null),
1353
- attributes: attributesFrom(p)
1429
+ attributes: attributesFrom(p),
1430
+ tags: listParam(p, "tags"),
1431
+ vendors: listParam(p, "vendor"),
1432
+ productTypes: listParam(p, "product_type"),
1433
+ facets: true
1354
1434
  });
1355
1435
  return {
1356
1436
  data: res.data,
@@ -1358,7 +1438,7 @@ var SearchService = class extends CatalogService {
1358
1438
  totalPages: res.noOfPage,
1359
1439
  page: res.page,
1360
1440
  categoryHierarchy: res.categoryHierarchy,
1361
- facets: { priceStat: {}, categories: [], tags: [], allFilters: {} }
1441
+ facets: toStorefrontFacets(res.facets)
1362
1442
  };
1363
1443
  } catch (err) {
1364
1444
  if (err?.status === 404) return this.emptyResult();
@@ -2578,21 +2658,38 @@ var MenuService = class extends BaseService {
2578
2658
  const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
2579
2659
  return { menuId: m.handle, name: m.title, items: (m.items ?? []).map(toItem) };
2580
2660
  }
2581
- /** The header and footer menus, or `null` when the module is not there. Cached: a menu is store-level. */
2661
+ /**
2662
+ * The header and footer menus, or `null` when the module is not there. Cached: a menu is
2663
+ * store-level. Each is the menu the shop chose for it in the theme editor's header or footer
2664
+ * (GoCommerce D131), still under the `header` / `footer` id every storefront looks for, so the
2665
+ * choice reaches every place that draws one; the menus named so are the default.
2666
+ */
2582
2667
  async engineMenus() {
2583
2668
  if (!await this.facts.pluginOn("navigation")) return null;
2584
2669
  return remember(`${this.engineBase()}|${this.store ?? ""}|menus`, async () => {
2585
2670
  const out = [];
2586
- for (const handle of ["header", "footer"]) {
2671
+ for (const part of ["header", "footer"]) {
2587
2672
  try {
2588
- const m = await this.data(`/x/navigation/menus/${handle}`);
2589
- out.push({ menuId: handle, name: m.title, items: (m.items ?? []).map(toItem) });
2673
+ const handle = await this.chosenMenu(part);
2674
+ const m = await this.data(`/x/navigation/menus/${encodeURIComponent(handle)}`);
2675
+ out.push({ menuId: part, name: m.title, items: (m.items ?? []).map(toItem) });
2590
2676
  } catch {
2591
2677
  }
2592
2678
  }
2593
2679
  return out;
2594
2680
  }).catch(() => null);
2595
2681
  }
2682
+ /** The handle of the menu the published header or footer names, else the part's own name. */
2683
+ async chosenMenu(part) {
2684
+ if (!await this.facts.pluginOn("layouts")) return part;
2685
+ try {
2686
+ const layout = await this.data(`/x/layouts/${part}`);
2687
+ const menu = layout?.sections?.find((s) => s.type === part)?.settings?.menu;
2688
+ return typeof menu === "string" && menu ? menu : part;
2689
+ } catch {
2690
+ return part;
2691
+ }
2692
+ }
2596
2693
  };
2597
2694
  var menuService = new MenuService();
2598
2695
  var readStaticStore = async () => {
@@ -2710,7 +2807,10 @@ var StoreService = class extends BaseService {
2710
2807
  isProductReviewsAndRatings: {
2711
2808
  ...basePlugins.isProductReviewsAndRatings,
2712
2809
  ...flag(plugins.has("product-reviews"))
2713
- }
2810
+ },
2811
+ // The footer's sign-up box posts to ext/newsletter, and the theme editor's footer
2812
+ // switch (D131) can only show it while that is on.
2813
+ newsletter: { ...basePlugins.newsletter, ...flag(plugins.has("newsletter")) }
2714
2814
  },
2715
2815
  ...menus?.length ? { menu: menus } : {},
2716
2816
  ...deliverable(base, ships),
@@ -2825,6 +2925,35 @@ var LayoutService = class extends BaseService {
2825
2925
  return null;
2826
2926
  }
2827
2927
  }
2928
+ /**
2929
+ * The header the shop set in the theme editor (D131), drawn on every
2930
+ * page: the published one, or a preview key's draft. Null — the
2931
+ * storefront's own header — when none is published, the editor is off, the
2932
+ * engine is older, or anything fails: a header is never worth an error page.
2933
+ */
2934
+ async getHeader({ preview } = {}) {
2935
+ return this.chrome("header", preview);
2936
+ }
2937
+ /** The footer the shop set in the theme editor (D131); null for the storefront's own, as getHeader. */
2938
+ async getFooter({ preview } = {}) {
2939
+ return this.chrome("footer", preview);
2940
+ }
2941
+ async chrome(page, preview) {
2942
+ let layout;
2943
+ try {
2944
+ layout = await this.getPageLayout(page, { preview });
2945
+ } catch {
2946
+ return null;
2947
+ }
2948
+ const section = layout?.sections.find((s) => s.type === page);
2949
+ if (!layout || !section) return null;
2950
+ const settings = { ...section.settings };
2951
+ let menu = null;
2952
+ if (typeof settings.menu === "string" && settings.menu) {
2953
+ menu = await new MenuService(this._fetch).getMenu(settings.menu).catch(() => null);
2954
+ }
2955
+ return { revision: layout.revision, preview: layout.preview, settings, menu };
2956
+ }
2828
2957
  };
2829
2958
  function tokens(v) {
2830
2959
  return v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length ? { ...v } : null;
@@ -3387,6 +3516,6 @@ function attemptKey(request) {
3387
3516
  }
3388
3517
  var b2bService = new B2bService();
3389
3518
 
3390
- export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3519
+ export { AddressService, AuthService, AutocompleteService, B2bService, BannerService, BaseService, BlogService, CartService, CatalogService, CategoryService, ChatService, CheckoutService, CollectionService, ContactService, CountryService, CouponService, CurrencyService, DealService, DemoRequestService, EnquiryService, FaqService, FeedbackService, GalleryService, HomeService, InitService, LayoutService, MeilisearchService, MenuService, NewsletterService, OrderService, PageService, PaymentMethodService, PluginService, PluginService as PluginsService, PopularSearchService, PopularityService, ProductService, ProfileService, REDIRECT_GATEWAYS, ReelsService, RegionService, ReviewService, SearchService, SettingService, SettingService as SettingsService, StateService, StoreService, UploadService, UserService, VariantService, VarniCustomDesignService, VarniCustomProductService, VendorService, WarrantyService, WishlistService, addressService, authService, autocompleteService, b2bService, bannerService, blogService, cartService, categoryService, chatService, checkoutService, collectionService, contactService, countryService, couponService, currencyService, dealService, demoRequestService, emptyPage, enquiryService, faqService, feedbackService, galleryService, homeService, initService, layoutService, mediaUrl, meilisearchService, menuService, newsletterService, orderService, ownDomain, pageService, paymentMethodService, pluginService, pluginsService, popularSearchService, popularityService, productService, profileService, qs, reelsService, regionService, reviewService, searchService, setRequestHost, settingService, settingsService, stateService, staticStore, storeForHost, storeService, toPage, toStorefrontFacets, uploadService, userService, variantService, varniCustomDesignService, varniCustomProductService, vendorService, warrantyService, wishlistService };
3391
3520
  //# sourceMappingURL=index.js.map
3392
3521
  //# sourceMappingURL=index.js.map