@useinsider/guido 3.7.2-beta.3cec1a4 → 3.7.2-beta.a114aa7

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.
Files changed (33) hide show
  1. package/dist/composables/useHtmlValidator.js +180 -133
  2. package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
  3. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  4. package/dist/config/migrator/recommendation/extractors.js +44 -22
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
  6. package/dist/config/migrator/recommendationMigrator.js +30 -31
  7. package/dist/extensions/Blocks/Recommendation/block.js +1 -4
  8. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +166 -169
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +43 -42
  11. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +44 -33
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +59 -49
  14. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +89 -82
  15. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  16. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  17. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  18. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +13 -12
  20. package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
  21. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  22. package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
  23. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  24. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  25. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  26. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  27. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  28. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
  29. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  32. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
  33. package/package.json +1 -1
@@ -6,26 +6,26 @@ import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
6
6
  import { RecommendationConfigService as h } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
8
8
  import { AlgorithmControl as R } from "./algorithm.js";
9
- import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
10
- import { CurrencyControl as b } from "./currency.js";
11
- import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
12
- import { FiltersControl as N } from "./filters.js";
13
- import { FILTERS_CONTROL_ID as et } from "./filters.js";
9
+ import { ALGORITHM_CONTROL_ID as X } from "./algorithm.js";
10
+ import { CurrencyControl as N } from "./currency.js";
11
+ import { CURRENCY_CONTROL_ID as tt } from "./currency.js";
12
+ import { FiltersControl as b } from "./filters.js";
13
+ import { FILTERS_CONTROL_ID as ot } from "./filters.js";
14
14
  import { LayoutOrientationControl as I } from "./layoutOrientation.js";
15
- import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
15
+ import { LAYOUT_ORIENTATION_CONTROL_ID as nt } from "./layoutOrientation.js";
16
16
  import { LocaleControl as _ } from "./locale.js";
17
- import { LOCALE_CONTROL_ID as it } from "./locale.js";
17
+ import { LOCALE_CONTROL_ID as st } from "./locale.js";
18
18
  import { ProductCountControl as O } from "./productCount.js";
19
- import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
19
+ import { PRODUCT_COUNT_CONTROL_ID as ct } from "./productCount.js";
20
20
  import { ProductLayoutControl as T } from "./productLayout.js";
21
- import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
21
+ import { PRODUCT_LAYOUT_CONTROL_ID as ut } from "./productLayout.js";
22
22
  import { ShuffleControl as S } from "./shuffle.js";
23
- import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
24
- import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as k, regenerateProductRowsWithStyles as D } from "./utils.js";
25
- import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Rt, updatePricesInPlace as bt, updateSingleProductContent as Nt } from "./utils.js";
23
+ import { SHUFFLE_CONTROL_ID as ht } from "./shuffle.js";
24
+ import { setCurrencyAttributes as L, getBlockElement as P, isPartnerManagedBlock as k, updateProductContentInPlace as D, regenerateProductRowsWithStyles as E } from "./utils.js";
25
+ import { adjustProductsToSize as ft, formatProductPrice as Ct, getCardComposition as pt, getCurrentLayout as gt, reapplySpacing as yt, regenerateMobileProductRows as Rt, regenerateProductRows as Nt, updatePricesInPlace as bt, updateSingleProductContent as It } from "./utils.js";
26
26
  import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
27
- const E = "recommendation-id", w = "ui-elements-recommendation-block";
28
- class K extends g {
27
+ const w = "recommendation-id", B = "ui-elements-recommendation-block";
28
+ class q extends g {
29
29
  constructor() {
30
30
  super(...arguments);
31
31
  s(this, "store", y());
@@ -60,14 +60,14 @@ class K extends g {
60
60
  */
61
61
  s(this, "_debouncedRegenerateWithProducts", m(() => {
62
62
  const t = this.store.recommendationProducts;
63
- if (!this.currentNode || !this.api)
63
+ if (!this.currentNode || !this.api || k(this.currentNode))
64
64
  return;
65
65
  const e = this.api.getDocumentModifier();
66
- k({
66
+ D({
67
67
  currentNode: this.currentNode,
68
68
  documentModifier: e,
69
69
  products: t
70
- }) || D({
70
+ }) || E({
71
71
  currentNode: this.currentNode,
72
72
  documentModifier: e,
73
73
  products: t
@@ -75,10 +75,10 @@ class K extends g {
75
75
  }, 100));
76
76
  }
77
77
  getId() {
78
- return w;
78
+ return B;
79
79
  }
80
80
  getTemplate() {
81
- return this.algorithmControl = new R(), this.localeControl = new _(), this.currencyControl = new b(), this.productCountControl = new O(), this.productLayoutControl = new T(), this.filtersControl = new N(), this.shuffleControl = new S(), this.layoutOrientationControl = new I(), [
81
+ return this.algorithmControl = new R(), this.localeControl = new _(), this.currencyControl = new N(), this.productCountControl = new O(), this.productLayoutControl = new T(), this.filtersControl = new b(), this.shuffleControl = new S(), this.layoutOrientationControl = new I(), [
82
82
  this.algorithmControl,
83
83
  this.localeControl,
84
84
  this.currencyControl,
@@ -295,7 +295,7 @@ class K extends g {
295
295
  const e = P(t);
296
296
  if (!e || !("getAttribute" in e))
297
297
  return null;
298
- const o = e.getAttribute(E);
298
+ const o = e.getAttribute(w);
299
299
  if (!o)
300
300
  return null;
301
301
  const r = parseInt(o);
@@ -346,35 +346,36 @@ class K extends g {
346
346
  }
347
347
  }
348
348
  export {
349
- Q as ALGORITHM_CONTROL_ID,
349
+ X as ALGORITHM_CONTROL_ID,
350
350
  R as AlgorithmControl,
351
- w as CONTROL_BLOCK_ID,
352
- Z as CURRENCY_CONTROL_ID,
353
- b as CurrencyControl,
354
- et as FILTERS_CONTROL_ID,
355
- N as FiltersControl,
356
- rt as LAYOUT_ORIENTATION_CONTROL_ID,
357
- it as LOCALE_CONTROL_ID,
351
+ B as CONTROL_BLOCK_ID,
352
+ tt as CURRENCY_CONTROL_ID,
353
+ N as CurrencyControl,
354
+ ot as FILTERS_CONTROL_ID,
355
+ b as FiltersControl,
356
+ nt as LAYOUT_ORIENTATION_CONTROL_ID,
357
+ st as LOCALE_CONTROL_ID,
358
358
  I as LayoutOrientationControl,
359
359
  _ as LocaleControl,
360
- at as PRODUCT_COUNT_CONTROL_ID,
361
- lt as PRODUCT_LAYOUT_CONTROL_ID,
360
+ ct as PRODUCT_COUNT_CONTROL_ID,
361
+ ut as PRODUCT_LAYOUT_CONTROL_ID,
362
362
  O as ProductCountControl,
363
363
  T as ProductLayoutControl,
364
- K as RecommendationBlockControl,
365
- dt as SHUFFLE_CONTROL_ID,
364
+ q as RecommendationBlockControl,
365
+ ht as SHUFFLE_CONTROL_ID,
366
366
  S as ShuffleControl,
367
- mt as adjustProductsToSize,
368
- ft as formatProductPrice,
367
+ ft as adjustProductsToSize,
368
+ Ct as formatProductPrice,
369
369
  P as getBlockElement,
370
- Ct as getCardComposition,
371
- pt as getCurrentLayout,
372
- gt as reapplySpacing,
373
- yt as regenerateMobileProductRows,
374
- Rt as regenerateProductRows,
375
- D as regenerateProductRowsWithStyles,
370
+ pt as getCardComposition,
371
+ gt as getCurrentLayout,
372
+ k as isPartnerManagedBlock,
373
+ yt as reapplySpacing,
374
+ Rt as regenerateMobileProductRows,
375
+ Nt as regenerateProductRows,
376
+ E as regenerateProductRowsWithStyles,
376
377
  L as setCurrencyAttributes,
377
378
  bt as updatePricesInPlace,
378
- k as updateProductContentInPlace,
379
- Nt as updateSingleProductContent
379
+ D as updateProductContentInPlace,
380
+ It as updateSingleProductContent
380
381
  };
@@ -1,31 +1,31 @@
1
- var p = Object.defineProperty;
2
- var A = (o, e, t) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var r = (o, e, t) => A(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as N } from "../../../common-control.js";
6
- import { ATTR_DATA_CUSTOM_ATTRIBUTES as L } from "../../constants/selectors.js";
7
- import { LAYOUT_OPTIONS as T, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
8
- import { DEFAULT_COMPOSITION as _ } from "../../constants/defaultConfig.js";
9
- import { RecommendationConfigService as s } from "../../services/configService.js";
10
- import { useRecommendationExtensionStore as f } from "../../store/recommendation.js";
11
- import { getCurrentLayout as C, getBlockElement as I, regenerateProductRowsWithStyles as S } from "./utils.js";
12
- const U = "recommendation-layout-orientation-control", O = "recommendationInfoBannerTest", a = {
1
+ var h = Object.defineProperty;
2
+ var p = (o, e, t) => e in o ? h(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var r = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UEAttr as C, ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as L } from "../../../common-control.js";
6
+ import { ATTR_DATA_CUSTOM_ATTRIBUTES as T } from "../../constants/selectors.js";
7
+ import { LAYOUT_OPTIONS as f, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as _ } from "../../constants/layout.js";
8
+ import { DEFAULT_COMPOSITION as g } from "../../constants/defaultConfig.js";
9
+ import { RecommendationConfigService as a } from "../../services/configService.js";
10
+ import { useRecommendationExtensionStore as S } from "../../store/recommendation.js";
11
+ import { isPartnerManagedBlock as I, getCurrentLayout as A, getBlockElement as U, regenerateProductRowsWithStyles as y } from "./utils.js";
12
+ const M = "recommendation-layout-orientation-control", O = "recommendationInfoBannerTest", s = {
13
13
  LAYOUT: "layout"
14
- }, y = "data-card-composition", n = {
14
+ }, R = "data-card-composition", n = {
15
15
  LAYOUT: "data-layout",
16
16
  COLUMN_SPACING: "data-column-spacing",
17
17
  ROW_SPACING: "data-row-spacing",
18
18
  MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
19
19
  MOBILE_ROW_SPACING: "data-mobile-row-spacing"
20
20
  };
21
- class Y extends N {
21
+ class V extends L {
22
22
  constructor() {
23
23
  super(...arguments);
24
- r(this, "store", f());
24
+ r(this, "store", S());
25
25
  r(this, "isChangingLayout", !1);
26
26
  }
27
27
  getId() {
28
- return U;
28
+ return M;
29
29
  }
30
30
  getTemplate() {
31
31
  return `
@@ -35,8 +35,8 @@ class Y extends N {
35
35
  ${this._GuTwoColumns([
36
36
  this._GuLabel({ text: this.api.translate("Layout Orientation") }),
37
37
  this._GuRadioButton({
38
- name: a.LAYOUT,
39
- buttons: T
38
+ name: s.LAYOUT,
39
+ buttons: f
40
40
  })
41
41
  ])}
42
42
  </div>
@@ -50,15 +50,26 @@ class Y extends N {
50
50
  Products in One Row and Mobile Layout Optimization settings
51
51
  resets the style of your Recommendation block.`
52
52
  )
53
- ), this._setFormValues(), this._listenToFormUpdates();
53
+ ), this._setFormValues(), this._syncDisabledState(), this._listenToFormUpdates();
54
54
  }
55
55
  onTemplateNodeUpdated(t) {
56
- super.onTemplateNodeUpdated(t), this._setFormValues();
56
+ super.onTemplateNodeUpdated(t), this._setFormValues(), this._syncDisabledState();
57
+ }
58
+ /**
59
+ * Layout orientation restructures the whole block, which is meaningless for
60
+ * partner-managed (`ins-skip-compile`) blocks — disable the control there.
61
+ */
62
+ _syncDisabledState() {
63
+ this.api.setUIEAttribute(
64
+ s.LAYOUT,
65
+ C.RADIO_BUTTONS.disabled,
66
+ I(this.currentNode)
67
+ );
57
68
  }
58
69
  _setFormValues() {
59
- const u = s.getConfig(this.currentNode).layout || C(this.currentNode);
70
+ const u = a.getConfig(this.currentNode).layout || A(this.currentNode);
60
71
  this.api.updateValues({
61
- [a.LAYOUT]: u
72
+ [s.LAYOUT]: u
62
73
  });
63
74
  }
64
75
  /**
@@ -66,26 +77,26 @@ class Y extends N {
66
77
  * Updates node config, data attribute and regenerates product rows
67
78
  */
68
79
  _onLayoutChange(t) {
69
- if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout || C(this.currentNode)) === t)
80
+ if (this.isChangingLayout || !this.currentNode || (a.getConfig(this.currentNode).layout || A(this.currentNode)) === t)
70
81
  return;
71
- const c = I(this.currentNode);
82
+ const c = U(this.currentNode);
72
83
  if (c) {
73
84
  this.isChangingLayout = !0;
74
85
  try {
75
- s.updateConfig(
86
+ a.updateConfig(
76
87
  this.api,
77
88
  this.currentNode,
78
89
  {
79
90
  layout: t,
80
- columnSpacing: g,
91
+ columnSpacing: _,
81
92
  rowSpacing: l,
82
93
  mobileColumnSpacing: d,
83
94
  mobileRowSpacing: m
84
95
  },
85
96
  `Changed layout to ${t}`
86
97
  ), this.store.patchCurrentBlockConfig({ orientation: t });
87
- const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, g.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
88
- t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.setAttribute(y, _.join(",")).setAttribute(L, "[]"), i.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t);
98
+ const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, _.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
99
+ t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.setAttribute(R, g.join(",")).setAttribute(T, "[]"), i.apply(new N(`Update layout to ${t}`)), this._regenerateProductRows(t);
89
100
  } finally {
90
101
  this.isChangingLayout = !1;
91
102
  }
@@ -97,20 +108,20 @@ class Y extends N {
97
108
  * @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
98
109
  */
99
110
  _regenerateProductRows(t) {
100
- this.currentNode && S({
111
+ this.currentNode && y({
101
112
  currentNode: this.currentNode,
102
113
  documentModifier: this.api.getDocumentModifier(),
103
114
  layout: t,
104
- composition: _
115
+ composition: g
105
116
  });
106
117
  }
107
118
  _listenToFormUpdates() {
108
- this.api.onValueChanged(a.LAYOUT, (t) => {
119
+ this.api.onValueChanged(s.LAYOUT, (t) => {
109
120
  this._onLayoutChange(t);
110
121
  });
111
122
  }
112
123
  }
113
124
  export {
114
- U as LAYOUT_ORIENTATION_CONTROL_ID,
115
- Y as LayoutOrientationControl
125
+ M as LAYOUT_ORIENTATION_CONTROL_ID,
126
+ V as LayoutOrientationControl
116
127
  };
@@ -2,13 +2,14 @@ var s = Object.defineProperty;
2
2
  var u = (e, o, t) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
3
  var i = (e, o, t) => u(e, typeof o != "symbol" ? o + "" : o, t);
4
4
  import { CommonControl as a } from "../../../common-control.js";
5
+ import "../../constants/selectors.js";
5
6
  import { MAX_PRODUCT_COUNT as c } from "../../constants/layout.js";
6
7
  import { RecommendationConfigService as n } from "../../services/configService.js";
7
8
  import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
8
9
  const C = "recommendation-product-count-control", r = {
9
10
  PRODUCT_COUNT: "size"
10
11
  };
11
- class g extends a {
12
+ class U extends a {
12
13
  constructor() {
13
14
  super(...arguments);
14
15
  i(this, "store", d());
@@ -54,5 +55,5 @@ class g extends a {
54
55
  }
55
56
  export {
56
57
  C as PRODUCT_COUNT_CONTROL_ID,
57
- g as ProductCountControl
58
+ U as ProductCountControl
58
59
  };
@@ -1,15 +1,16 @@
1
- var E = Object.defineProperty;
2
- var f = (a, n, t) => n in a ? E(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var c = (a, n, t) => f(a, typeof n != "symbol" ? n + "" : n, t);
4
- import { EditorStatePropertyType as O, PreviewDeviceMode as N, UEAttr as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as M } from "../../../common-control.js";
6
- import { MAX_PRODUCTS_PER_ROW as m, MAX_MOBILE_PRODUCTS_PER_ROW as P, DEFAULT_MOBILE_CARDS_IN_ROW as l, DEFAULT_COLUMN_SPACING as w, DEFAULT_MOBILE_COLUMN_SPACING as y } from "../../constants/layout.js";
1
+ var T = Object.defineProperty;
2
+ var f = (a, n, t) => n in a ? T(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
+ var _ = (a, n, t) => f(a, typeof n != "symbol" ? n + "" : n, t);
4
+ import { UEAttr as d, EditorStatePropertyType as C, PreviewDeviceMode as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as P } from "../../../common-control.js";
6
+ import "../../constants/selectors.js";
7
+ import { MAX_PRODUCTS_PER_ROW as b, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as l, DEFAULT_COLUMN_SPACING as D, DEFAULT_MOBILE_COLUMN_SPACING as y } from "../../constants/layout.js";
7
8
  import { RecommendationConfigService as s } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as D } from "../../store/recommendation.js";
9
- import { setMobileLayoutOptOut as C, ensureMobileCssRulesExist as L } from "../mobileLayout/cssRules.js";
10
- import { getCurrentLayout as U, getBlockElement as A, adjustProductsToSize as b, regenerateProductRowsWithStyles as g, regenerateMobileProductRows as I } from "./utils.js";
9
+ import { useRecommendationExtensionStore as U } from "../../store/recommendation.js";
10
+ import { setMobileLayoutOptOut as m, ensureMobileCssRulesExist as L } from "../mobileLayout/cssRules.js";
11
+ import { isPartnerManagedBlock as w, getCurrentLayout as A, getBlockElement as S, adjustProductsToSize as I, regenerateProductRowsWithStyles as g, regenerateMobileProductRows as E } from "./utils.js";
11
12
  import { useDebounceFn as B } from "../../../../../node_modules/@vueuse/shared/index.js";
12
- const S = "recommendation-product-layout-control", e = {
13
+ const W = "recommendation-product-layout-control", e = {
13
14
  // "Products in One Row" — shown when toggle is OFF
14
15
  PRODUCT_IN_ROW: "cardsInRow",
15
16
  PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
@@ -23,19 +24,19 @@ const S = "recommendation-product-layout-control", e = {
23
24
  MOBILE_LAYOUT_TOGGLE: "mobileLayoutEnabled",
24
25
  MOBILE_LAYOUT_LABEL: "mobileLayoutLabel"
25
26
  };
26
- class v extends M {
27
+ class X extends P {
27
28
  constructor() {
28
29
  super(...arguments);
29
30
  // Store is used for backward compatibility with product fetching and regeneration
30
- c(this, "store", D());
31
- c(this, "storeUnsubscription", () => {
31
+ _(this, "store", U());
32
+ _(this, "storeUnsubscription", () => {
32
33
  });
33
- c(this, "_debouncedRegenerateProductRows", B(() => {
34
+ _(this, "_debouncedRegenerateProductRows", B(() => {
34
35
  this._regenerateProductRows();
35
36
  }, 500));
36
37
  }
37
38
  getId() {
38
- return S;
39
+ return W;
39
40
  }
40
41
  getTemplate() {
41
42
  return `
@@ -45,19 +46,19 @@ class v extends M {
45
46
  text: this.api.translate("Products in One Row"),
46
47
  name: e.PRODUCT_IN_ROW_LABEL
47
48
  }),
48
- this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: m }),
49
+ this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: b }),
49
50
  this._GuLabel({
50
51
  text: this.api.translate("Products in One Row on Desktop"),
51
52
  name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
52
53
  }),
53
- this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: m }),
54
+ this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: b }),
54
55
  this._GuLabel({
55
56
  text: this.api.translate("Products in One Row on Mobile"),
56
57
  name: e.MOBILE_CARDS_IN_ROW_LABEL
57
58
  }),
58
59
  this._GuCounter({
59
60
  name: e.MOBILE_CARDS_IN_ROW,
60
- maxValue: P
61
+ maxValue: M
61
62
  }),
62
63
  this._GuLabel({
63
64
  text: this.api.translate("Mobile Layout Optimization"),
@@ -74,10 +75,19 @@ class v extends M {
74
75
  `;
75
76
  }
76
77
  onRender() {
77
- this._initializeMobileLayoutToggle(), this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates(), this._listenEditorModeChanges();
78
+ this._initializeMobileLayoutToggle(), this._setFormValues(), this._updateProductsInRowVisibility(), this._syncDisabledState(), this._listenToFormUpdates(), this._listenStateUpdates(), this._listenEditorModeChanges();
78
79
  }
79
80
  onTemplateNodeUpdated(t) {
80
- super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
81
+ super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility(), this._syncDisabledState();
82
+ }
83
+ /**
84
+ * Products-per-row and mobile-layout restructure the block, which is
85
+ * meaningless for partner-managed (`ins-skip-compile`) blocks — disable
86
+ * these inputs there. Disabling coexists with the visibility logic above.
87
+ */
88
+ _syncDisabledState() {
89
+ const t = w(this.currentNode);
90
+ this.api.setUIEAttribute(e.PRODUCT_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, d.SWITCHER.disabled, t);
81
91
  }
82
92
  onDestroy() {
83
93
  this.storeUnsubscription();
@@ -95,7 +105,7 @@ class v extends M {
95
105
  * Returns true when the editor preview is in mobile mode.
96
106
  */
97
107
  _isMobilePreview() {
98
- return this.api.getEditorState()[O.previewDeviceMode] === N.MOBILE;
108
+ return this.api.getEditorState()[C.previewDeviceMode] === N.MOBILE;
99
109
  }
100
110
  /**
101
111
  * Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
@@ -110,12 +120,12 @@ class v extends M {
110
120
  */
111
121
  _updateProductsInRowVisibility() {
112
122
  var p;
113
- const t = s.getConfig(this.currentNode), o = (t.layout || U(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, u = this._isMobilePreview();
114
- this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, o), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, o);
115
- const d = o && !r, _ = o && r && !u, h = o && r && u;
116
- this.api.setVisibility(e.PRODUCT_IN_ROW, d), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, d), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, _), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, _), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, h);
117
- const R = (p = this.getContainer()) == null ? void 0 : p.querySelector("[data-product-layout-control]");
118
- R && (R.style.display = o ? "" : "none");
123
+ const t = s.getConfig(this.currentNode), i = (t.layout || A(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, u = this._isMobilePreview();
124
+ this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, i), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, i);
125
+ const c = i && !r, h = i && r && !u, R = i && r && u;
126
+ this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, h), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, R), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, R);
127
+ const O = (p = this.getContainer()) == null ? void 0 : p.querySelector("[data-product-layout-control]");
128
+ O && (O.style.display = i ? "" : "none");
119
129
  }
120
130
  /**
121
131
  * Initializes the mobile layout toggle using the same pattern as shuffle.ts.
@@ -125,7 +135,7 @@ class v extends M {
125
135
  const t = s.getConfig(this.currentNode);
126
136
  this.api.setUIEAttribute(
127
137
  e.MOBILE_LAYOUT_TOGGLE,
128
- T.SELECTPICKER.items,
138
+ d.SELECTPICKER.items,
129
139
  t.mobileLayoutEnabled
130
140
  );
131
141
  }
@@ -137,12 +147,12 @@ class v extends M {
137
147
  _onMobileLayoutToggleChange(t) {
138
148
  if (!this.currentNode)
139
149
  return;
140
- const i = s.getConfig(this.currentNode);
141
- if (i.mobileLayoutEnabled === t)
150
+ const o = s.getConfig(this.currentNode);
151
+ if (o.mobileLayoutEnabled === t)
142
152
  return;
143
- const o = A(this.currentNode);
153
+ const i = S(this.currentNode);
144
154
  if (t) {
145
- const r = i.previousMobileCardsInRow || l;
155
+ const r = o.previousMobileCardsInRow || l;
146
156
  s.updateConfig(
147
157
  this.api,
148
158
  this.currentNode,
@@ -157,15 +167,15 @@ class v extends M {
157
167
  mobileCardsInRow: r
158
168
  },
159
169
  { triggerRefetch: !1 }
160
- ), o && C(this.api, o, !1), L(this.api);
161
- const u = parseInt(i.size) || 6, d = b(this.store.recommendationProducts, u);
170
+ ), i && m(this.api, i, !1), L(this.api);
171
+ const u = parseInt(o.size) || 6, c = I(this.store.recommendationProducts, u);
162
172
  g({
163
173
  currentNode: this.currentNode,
164
174
  documentModifier: this.api.getDocumentModifier(),
165
- products: d
175
+ products: c
166
176
  });
167
177
  } else {
168
- const r = i.mobileCardsInRow;
178
+ const r = o.mobileCardsInRow;
169
179
  s.updateConfig(
170
180
  this.api,
171
181
  this.currentNode,
@@ -181,7 +191,7 @@ class v extends M {
181
191
  mobileCardsInRow: l
182
192
  },
183
193
  { triggerRefetch: !1 }
184
- ), o && C(this.api, o, !0), I({
194
+ ), i && m(this.api, i, !0), E({
185
195
  currentNode: this.currentNode,
186
196
  documentModifier: this.api.getDocumentModifier()
187
197
  });
@@ -191,37 +201,37 @@ class v extends M {
191
201
  _onProductsInRowChange(t) {
192
202
  if (!this.currentNode || s.getConfig(this.currentNode).cardsInRow === t)
193
203
  return;
194
- const o = t === 1 ? 0 : w;
204
+ const i = t === 1 ? 0 : D;
195
205
  s.updateConfig(
196
206
  this.api,
197
207
  this.currentNode,
198
- { cardsInRow: t, columnSpacing: o },
208
+ { cardsInRow: t, columnSpacing: i },
199
209
  `Changed products per row to ${t}`
200
210
  ), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
201
211
  }
202
212
  _onMobileCardsInRowChange(t) {
203
213
  if (!this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t)
204
214
  return;
205
- const o = t === 1 ? 0 : y;
215
+ const i = t === 1 ? 0 : y;
206
216
  s.updateConfig(
207
217
  this.api,
208
218
  this.currentNode,
209
- { mobileCardsInRow: t, mobileColumnSpacing: o },
219
+ { mobileCardsInRow: t, mobileColumnSpacing: i },
210
220
  `Changed mobile products per row to ${t}`
211
221
  ), L(this.api), this.store.patchCurrentBlockConfig(
212
222
  { mobileCardsInRow: t },
213
223
  { triggerRefetch: !1 }
214
- ), I({
224
+ ), E({
215
225
  currentNode: this.currentNode,
216
226
  documentModifier: this.api.getDocumentModifier()
217
227
  });
218
228
  }
219
229
  _regenerateProductRows() {
220
- const t = s.getConfig(this.currentNode), i = parseInt(t.size) || 6, o = b(this.store.recommendationProducts, i);
230
+ const t = s.getConfig(this.currentNode), o = parseInt(t.size) || 6, i = I(this.store.recommendationProducts, o);
221
231
  g({
222
232
  currentNode: this.currentNode,
223
233
  documentModifier: this.api.getDocumentModifier(),
224
- products: o
234
+ products: i
225
235
  });
226
236
  }
227
237
  _listenToFormUpdates() {
@@ -242,8 +252,8 @@ class v extends M {
242
252
  _listenStateUpdates() {
243
253
  let t = this.store.recommendationConfigs.orientation;
244
254
  this.storeUnsubscription = this.store.$subscribe(() => {
245
- const i = this.store.recommendationConfigs.orientation;
246
- i !== t && (t = i, this._updateProductsInRowVisibility());
255
+ const o = this.store.recommendationConfigs.orientation;
256
+ o !== t && (t = o, this._updateProductsInRowVisibility());
247
257
  });
248
258
  }
249
259
  /**
@@ -253,7 +263,7 @@ class v extends M {
253
263
  */
254
264
  _listenEditorModeChanges() {
255
265
  this.api.onEditorStatePropUpdated(
256
- O.previewDeviceMode,
266
+ C.previewDeviceMode,
257
267
  () => {
258
268
  s.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
259
269
  }
@@ -261,6 +271,6 @@ class v extends M {
261
271
  }
262
272
  }
263
273
  export {
264
- S as PRODUCT_LAYOUT_CONTROL_ID,
265
- v as ProductLayoutControl
274
+ W as PRODUCT_LAYOUT_CONTROL_ID,
275
+ X as ProductLayoutControl
266
276
  };