@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29

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 (72) hide show
  1. package/dist/composables/useActionsApi.js +64 -80
  2. package/dist/composables/useFullStoryBridge.js +10 -9
  3. package/dist/composables/useGuidoStateBridge.js +3 -3
  4. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  5. package/dist/composables/useStripo.js +10 -11
  6. package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
  7. package/dist/config/migrator/index.js +11 -10
  8. package/dist/extensions/Blocks/Items/block.js +42 -43
  9. package/dist/extensions/Blocks/Recommendation/block.js +29 -33
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
  11. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
  12. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
  16. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
  17. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
  18. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
  19. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
  20. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
  22. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
  23. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
  24. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  25. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
  27. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  28. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
  29. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
  30. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
  31. package/dist/package.json.js +1 -1
  32. package/dist/src/composables/useActionsApi.d.ts +1 -5
  33. package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
  34. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
  35. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
  36. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
  37. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
  41. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
  42. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
  43. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
  48. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
  50. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
  51. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
  52. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
  53. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
  54. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
  55. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
  56. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
  57. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
  58. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
  59. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
  60. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
  61. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
  62. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
  63. package/dist/src/stores/editor.d.ts +1 -3
  64. package/dist/src/utils/fullStoryScripts.d.ts +6 -0
  65. package/dist/static/styles/components/button.css.js +0 -5
  66. package/dist/stores/editor.js +0 -5
  67. package/dist/utils/fullStoryScripts.js +8 -0
  68. package/package.json +3 -3
  69. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
  70. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
  71. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
  72. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
@@ -1,30 +1,30 @@
1
- var N = Object.defineProperty;
2
- var O = (o, e, t) => e in o ? N(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var c = (o, e, t) => O(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { UEAttr as A, ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as f } from "../../../common-control.js";
1
+ var _ = Object.defineProperty;
2
+ var p = (o, e, t) => e in o ? _(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UEAttr as L, ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as A } from "../../../common-control.js";
6
6
  import "../../constants/selectors.js";
7
- import { LAYOUT_OPTIONS as T, DEFAULT_MOBILE_ROW_SPACING as g, DEFAULT_MOBILE_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as _, DEFAULT_COLUMN_SPACING as h } from "../../constants/layout.js";
8
- import { RecommendationConfigService as l } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as U } from "../../store/recommendation.js";
10
- import { isPartnerManagedBlock as I, getCurrentLayout as L, getBlockElement as y, getCardComposition as E, regenerateProductRowsWithStyles as R } from "./utils.js";
11
- const b = "recommendation-layout-orientation-control", u = {
7
+ import { LAYOUT_OPTIONS as O, DEFAULT_MOBILE_ROW_SPACING as d, DEFAULT_MOBILE_COLUMN_SPACING as m, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
8
+ import { RecommendationConfigService as u } from "../../services/configService.js";
9
+ import { useRecommendationExtensionStore as f } from "../../store/recommendation.js";
10
+ import { isPartnerManagedBlock as S, getCurrentLayout as C, getBlockElement as T, getCardComposition as U, regenerateProductRowsWithStyles as I } from "./utils.js";
11
+ const y = "recommendation-layout-orientation-control", s = {
12
12
  LAYOUT: "layout"
13
- }, i = {
13
+ }, n = {
14
14
  LAYOUT: "data-layout",
15
15
  COLUMN_SPACING: "data-column-spacing",
16
16
  ROW_SPACING: "data-row-spacing",
17
17
  MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
18
18
  MOBILE_ROW_SPACING: "data-mobile-row-spacing"
19
19
  };
20
- class W extends f {
20
+ class F extends A {
21
21
  constructor() {
22
22
  super(...arguments);
23
- c(this, "store", U());
24
- c(this, "isChangingLayout", !1);
23
+ a(this, "store", f());
24
+ a(this, "isChangingLayout", !1);
25
25
  }
26
26
  getId() {
27
- return b;
27
+ return y;
28
28
  }
29
29
  getTemplate() {
30
30
  return `
@@ -32,8 +32,8 @@ class W extends f {
32
32
  ${this._GuTwoColumns([
33
33
  this._GuLabel({ text: this.api.translate("Layout Orientation") }),
34
34
  this._GuRadioButton({
35
- name: u.LAYOUT,
36
- buttons: T
35
+ name: s.LAYOUT,
36
+ buttons: O
37
37
  })
38
38
  ])}
39
39
  </div>
@@ -51,15 +51,15 @@ class W extends f {
51
51
  */
52
52
  _syncDisabledState() {
53
53
  this.api.setUIEAttribute(
54
- u.LAYOUT,
55
- A.RADIO_BUTTONS.disabled,
56
- I(this.currentNode)
54
+ s.LAYOUT,
55
+ L.RADIO_BUTTONS.disabled,
56
+ S(this.currentNode)
57
57
  );
58
58
  }
59
59
  _setFormValues() {
60
- const n = l.getConfig(this.currentNode).layout || L(this.currentNode);
60
+ const r = u.getConfig(this.currentNode).layout || C(this.currentNode);
61
61
  this.api.updateValues({
62
- [u.LAYOUT]: n
62
+ [s.LAYOUT]: r
63
63
  });
64
64
  }
65
65
  /**
@@ -67,51 +67,53 @@ class W extends f {
67
67
  * Updates node config, data attribute and regenerates product rows
68
68
  */
69
69
  _onLayoutChange(t) {
70
- if (this.isChangingLayout || !this.currentNode || (l.getConfig(this.currentNode).layout || L(this.currentNode)) === t)
70
+ if (this.isChangingLayout || !this.currentNode || (u.getConfig(this.currentNode).layout || C(this.currentNode)) === t)
71
71
  return;
72
- const r = y(this.currentNode);
73
- if (r) {
72
+ const c = T(this.currentNode);
73
+ if (c) {
74
74
  this.isChangingLayout = !0;
75
75
  try {
76
- const p = E(this.currentNode, this.store.filterList), m = {
77
- layout: t,
78
- columnSpacing: h,
79
- rowSpacing: _,
80
- mobileColumnSpacing: C,
81
- mobileRowSpacing: g
82
- }, s = this.api.getDocumentModifier();
83
- l.stageConfig(s, this.currentNode, m), this.store.patchCurrentBlockConfig({ orientation: t });
84
- const a = s.modifyHtml(r).setAttribute(i.LAYOUT, t).setAttribute(i.COLUMN_SPACING, h.toString()).setAttribute(i.ROW_SPACING, _.toString()).setAttribute(i.MOBILE_COLUMN_SPACING, C.toString()).setAttribute(i.MOBILE_ROW_SPACING, g.toString());
85
- t === "list" ? (a.setClass("es-m-p0"), a.setClass("ins-recommendation-list-layout")) : (a.removeClass("es-m-p0"), a.removeClass("ins-recommendation-list-layout")), this._regenerateProductRows(s, t, p, m), s.apply(new S(`Changed layout to ${t}`));
76
+ const h = U(this.currentNode, this.store.filterList);
77
+ u.updateConfig(
78
+ this.api,
79
+ this.currentNode,
80
+ {
81
+ layout: t,
82
+ columnSpacing: g,
83
+ rowSpacing: l,
84
+ mobileColumnSpacing: m,
85
+ mobileRowSpacing: d
86
+ },
87
+ `Changed layout to ${t}`
88
+ ), this.store.patchCurrentBlockConfig({ orientation: t });
89
+ 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, m.toString()).setAttribute(n.MOBILE_ROW_SPACING, d.toString());
90
+ 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.apply(new N(`Update layout to ${t}`)), this._regenerateProductRows(t, h);
86
91
  } finally {
87
92
  this.isChangingLayout = !1;
88
93
  }
89
94
  }
90
95
  }
91
96
  /**
92
- * Stages the product rows for the selected layout into the caller's batch,
93
- * with the user's styles preserved.
97
+ * Regenerates product rows based on the selected layout
98
+ * Uses unified style-preserving regeneration to maintain user customizations
94
99
  * @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
95
100
  * @param composition - The preserved card composition, incl. customAttr:* entries
96
- * @param configOverrides - The config staged in the same batch (spacing defaults)
97
101
  */
98
- _regenerateProductRows(t, n, d, r) {
99
- this.currentNode && R({
102
+ _regenerateProductRows(t, r) {
103
+ this.currentNode && I({
100
104
  currentNode: this.currentNode,
101
- documentModifier: t,
102
- layout: n,
103
- composition: d,
104
- configOverrides: r,
105
- stageOnly: !0
105
+ documentModifier: this.api.getDocumentModifier(),
106
+ layout: t,
107
+ composition: r
106
108
  });
107
109
  }
108
110
  _listenToFormUpdates() {
109
- this.api.onValueChanged(u.LAYOUT, (t) => {
111
+ this.api.onValueChanged(s.LAYOUT, (t) => {
110
112
  this._onLayoutChange(t);
111
113
  });
112
114
  }
113
115
  }
114
116
  export {
115
- b as LAYOUT_ORIENTATION_CONTROL_ID,
116
- W as LayoutOrientationControl
117
+ y as LAYOUT_ORIENTATION_CONTROL_ID,
118
+ F as LayoutOrientationControl
117
119
  };
@@ -1,21 +1,21 @@
1
- var a = Object.defineProperty;
2
- var s = (o, t, e) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var i = (o, t, e) => s(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { UEAttr as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as l } from "../../../common-control.js";
6
- import { RecommendationConfigService as m } from "../../services/configService.js";
7
- import { useRecommendationExtensionStore as c } from "../../store/recommendation.js";
8
- const g = "recommendation-locale-control", n = {
1
+ var s = Object.defineProperty;
2
+ var r = (o, t, e) => t in o ? s(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var a = (o, t, e) => r(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as c } from "../../../common-control.js";
6
+ import { RecommendationConfigService as i } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as g } from "../../store/recommendation.js";
8
+ const m = "recommendation-locale-control", n = {
9
9
  LOCALE: "language"
10
10
  };
11
- class C extends l {
11
+ class E extends c {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  // Store is used ONLY for API-fetched data (language options), not for config
15
- i(this, "store", c());
15
+ a(this, "store", g());
16
16
  }
17
17
  getId() {
18
- return g;
18
+ return m;
19
19
  }
20
20
  getTemplate() {
21
21
  return `
@@ -38,7 +38,7 @@ class C extends l {
38
38
  super.onTemplateNodeUpdated(e), this._setFormValues();
39
39
  }
40
40
  _setFormValues() {
41
- const e = m.getConfig(this.currentNode);
41
+ const e = i.getConfig(this.currentNode);
42
42
  this.api.updateValues({
43
43
  [n.LOCALE]: e.language
44
44
  });
@@ -46,12 +46,17 @@ class C extends l {
46
46
  _initializeSelectItems() {
47
47
  this.api.setUIEAttribute(
48
48
  n.LOCALE,
49
- r.SELECTPICKER.items,
49
+ l.SELECTPICKER.items,
50
50
  this.store.getLanguages
51
51
  );
52
52
  }
53
53
  _onLocaleChange(e) {
54
- this.currentNode && this.store.recommendationConfigs.language !== e && this.store.patchCurrentBlockConfig({ language: e });
54
+ !this.currentNode || i.getConfig(this.currentNode).language === e || (i.updateConfig(
55
+ this.api,
56
+ this.currentNode,
57
+ { language: e },
58
+ `Changed language to ${e}`
59
+ ), this.store.patchCurrentBlockConfig({ language: e }));
55
60
  }
56
61
  _listenToFormUpdates() {
57
62
  this.api.onValueChanged(n.LOCALE, (e) => {
@@ -60,6 +65,6 @@ class C extends l {
60
65
  }
61
66
  }
62
67
  export {
63
- g as LOCALE_CONTROL_ID,
64
- C as LocaleControl
68
+ m as LOCALE_CONTROL_ID,
69
+ E as LocaleControl
65
70
  };
@@ -1,23 +1,23 @@
1
- var p = Object.defineProperty;
2
- var h = (o, n, e) => n in o ? p(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
3
- var d = (o, n, e) => h(o, typeof n != "symbol" ? n + "" : n, e);
4
- import { UEAttr as l, ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var m = Object.defineProperty;
2
+ var p = (i, o, e) => o in i ? m(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
3
+ var d = (i, o, e) => p(i, typeof o != "symbol" ? o + "" : o, e);
4
+ import { UEAttr as u, ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as f } from "../../../common-control.js";
6
6
  import { ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OLD_PRICE as I } from "../../constants/selectors.js";
7
- import { RecommendationConfigService as a } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as g } from "../../store/recommendation.js";
9
- import { getBlockElement as m, regenerateProductRowsWithStyles as T } from "./utils.js";
7
+ import { RecommendationConfigService as n } from "../../services/configService.js";
8
+ import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
9
+ import { getBlockElement as l, regenerateProductRowsWithStyles as g } from "./utils.js";
10
10
  const E = "recommendation-price-placement-control", N = "hide-price", r = {
11
11
  ORIENTATION: "priceOrientation",
12
12
  HIDE_IF_SAME: "priceHideIfSameAsDiscounted"
13
13
  }, A = [
14
14
  { icon: "vertical-orientation", value: "vertical" },
15
15
  { icon: "horizontal-orientation", value: "horizontal" }
16
- ], C = (o) => o ? "vertical" : "horizontal";
17
- class y extends f {
16
+ ], C = (i) => i ? "vertical" : "horizontal";
17
+ class P extends f {
18
18
  constructor() {
19
19
  super(...arguments);
20
- d(this, "store", g());
20
+ d(this, "store", T());
21
21
  }
22
22
  getId() {
23
23
  return E;
@@ -40,11 +40,11 @@ class y extends f {
40
40
  `;
41
41
  }
42
42
  onRender() {
43
- const e = a.getConfig(this.currentNode);
43
+ const e = n.getConfig(this.currentNode);
44
44
  this._initializeHideToggle(e), this._setFormValues(e), this._updateOrientationDisabled(), this._listenToFormUpdates();
45
45
  }
46
46
  onTemplateNodeUpdated(e) {
47
- super.onTemplateNodeUpdated(e), this._setFormValues(a.getConfig(this.currentNode)), this._updateOrientationDisabled();
47
+ super.onTemplateNodeUpdated(e), this._setFormValues(n.getConfig(this.currentNode)), this._updateOrientationDisabled();
48
48
  }
49
49
  _setFormValues(e) {
50
50
  this.api.updateValues({
@@ -55,7 +55,7 @@ class y extends f {
55
55
  _initializeHideToggle(e) {
56
56
  this.api.setUIEAttribute(
57
57
  r.HIDE_IF_SAME,
58
- l.SELECTPICKER.items,
58
+ u.SELECTPICKER.items,
59
59
  e.priceHideIfSameAsDiscounted
60
60
  );
61
61
  }
@@ -67,60 +67,56 @@ class y extends f {
67
67
  * the merged "Product Prices" entry (the price row) governs.
68
68
  */
69
69
  _updateOrientationDisabled() {
70
- const e = m(this.currentNode);
70
+ const e = l(this.currentNode);
71
71
  if (!e || !("querySelectorAll" in e))
72
72
  return;
73
- const i = Array.from(
73
+ const s = Array.from(
74
74
  e.querySelectorAll(".recommendation-attribute-row[data-attribute-type]")
75
- ).some((c) => {
76
- const s = c.getAttribute("data-attribute-type");
77
- return (s === _ || s === I) && c.getAttribute("data-visibility") === "0";
75
+ ).some((a) => {
76
+ const c = a.getAttribute("data-attribute-type");
77
+ return (c === _ || c === I) && a.getAttribute("data-visibility") === "0";
78
78
  });
79
79
  this.api.setUIEAttribute(
80
80
  r.ORIENTATION,
81
- l.RADIO_BUTTONS.disabled,
82
- i ? "true" : "false"
81
+ u.RADIO_BUTTONS.disabled,
82
+ s ? "true" : "false"
83
83
  );
84
84
  }
85
85
  _onOrientationChange(e) {
86
86
  if (!this.currentNode)
87
87
  return;
88
88
  const t = e === "vertical";
89
- if (a.getConfig(this.currentNode).priceMovedToNextLine === t)
90
- return;
91
- const c = { priceMovedToNextLine: t }, s = this.api.getDocumentModifier();
92
- a.stageConfig(s, this.currentNode, c), this.store.patchCurrentBlockConfig({ priceMovedToNextLine: t }), this._regenerate(s, c), s.apply(
93
- new u(`${t ? "Stacked" : "Inlined"} recommendation prices`)
94
- );
89
+ n.getConfig(this.currentNode).priceMovedToNextLine !== t && (n.updateConfig(
90
+ this.api,
91
+ this.currentNode,
92
+ { priceMovedToNextLine: t },
93
+ `${t ? "Stacked" : "Inlined"} recommendation prices`
94
+ ), this.store.patchCurrentBlockConfig({ priceMovedToNextLine: t }), this._regenerate());
95
95
  }
96
96
  _onHideIfSameChange(e) {
97
- if (!this.currentNode || a.getConfig(this.currentNode).priceHideIfSameAsDiscounted === e)
98
- return;
99
- const i = this.api.getDocumentModifier();
100
- a.stageConfig(
101
- i,
97
+ !this.currentNode || n.getConfig(this.currentNode).priceHideIfSameAsDiscounted === e || (n.updateConfig(
98
+ this.api,
102
99
  this.currentNode,
103
- { priceHideIfSameAsDiscounted: e }
104
- ), this.store.patchCurrentBlockConfig({ priceHideIfSameAsDiscounted: e }), this._stampHideIfSameAttr(i, e), i.apply(new u(`${e ? "Enabled" : "Disabled"} hide-if-same price`));
100
+ { priceHideIfSameAsDiscounted: e },
101
+ `${e ? "Enabled" : "Disabled"} hide-if-same price`
102
+ ), this.store.patchCurrentBlockConfig({ priceHideIfSameAsDiscounted: e }), this._stampHideIfSameAttr(e));
105
103
  }
106
104
  /**
107
105
  * Mirrors the hide-if-same flag onto the durable `hide-price` block attribute
108
106
  * read by email-service at send time.
109
107
  */
110
- _stampHideIfSameAttr(e, t) {
111
- const i = m(this.currentNode);
112
- i && e.modifyHtml(i).setAttribute(N, String(t));
108
+ _stampHideIfSameAttr(e) {
109
+ const t = l(this.currentNode);
110
+ t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N, String(e)).apply(new h("Update hide-if-same price flag"));
113
111
  }
114
112
  /**
115
- * Stages the rebuilt product rows into the caller's batch so the renderer
116
- * reads the inline/stacked flag being written. Used by the orientation change only.
113
+ * Rebuilds the product rows so the renderer re-reads the inline/stacked
114
+ * layout flag from the store. Used by the orientation change only.
117
115
  */
118
- _regenerate(e, t) {
119
- this.currentNode && T({
116
+ _regenerate() {
117
+ this.currentNode && g({
120
118
  currentNode: this.currentNode,
121
- documentModifier: e,
122
- configOverrides: t,
123
- stageOnly: !0
119
+ documentModifier: this.api.getDocumentModifier()
124
120
  });
125
121
  }
126
122
  _listenToFormUpdates() {
@@ -133,5 +129,5 @@ class y extends f {
133
129
  }
134
130
  export {
135
131
  E as PRICE_PLACEMENT_CONTROL_ID,
136
- y as PricePlacementControl
132
+ P as PricePlacementControl
137
133
  };
@@ -1,28 +1,28 @@
1
1
  var s = Object.defineProperty;
2
- var i = (e, o, t) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
- var r = (e, o, t) => i(e, typeof o != "symbol" ? o + "" : o, t);
2
+ var u = (e, o, t) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
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
5
  import "../../constants/selectors.js";
6
- import { MAX_PRODUCT_COUNT as m } from "../../constants/layout.js";
7
- import { RecommendationConfigService as u } from "../../services/configService.js";
8
- import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
9
- const d = "recommendation-product-count-control", n = {
6
+ import { MAX_PRODUCT_COUNT as c } from "../../constants/layout.js";
7
+ import { RecommendationConfigService as n } from "../../services/configService.js";
8
+ import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
9
+ const C = "recommendation-product-count-control", r = {
10
10
  PRODUCT_COUNT: "size"
11
11
  };
12
12
  class U extends a {
13
13
  constructor() {
14
14
  super(...arguments);
15
- r(this, "store", C());
15
+ i(this, "store", d());
16
16
  }
17
17
  getId() {
18
- return d;
18
+ return C;
19
19
  }
20
20
  getTemplate() {
21
21
  return `
22
22
  <div class="product-count-control-container">
23
23
  ${this._GuTwoColumns([
24
24
  this._GuLabel({ text: this.api.translate("Number of Products") }),
25
- this._GuCounter({ name: n.PRODUCT_COUNT, maxValue: m })
25
+ this._GuCounter({ name: r.PRODUCT_COUNT, maxValue: c })
26
26
  ])}
27
27
  </div>
28
28
  `;
@@ -34,21 +34,26 @@ class U extends a {
34
34
  super.onTemplateNodeUpdated(t), this._setFormValues();
35
35
  }
36
36
  _setFormValues() {
37
- const t = u.getConfig(this.currentNode);
37
+ const t = n.getConfig(this.currentNode);
38
38
  this.api.updateValues({
39
- [n.PRODUCT_COUNT]: t.size
39
+ [r.PRODUCT_COUNT]: t.size
40
40
  });
41
41
  }
42
42
  _onProductCountChange(t) {
43
- this.currentNode && this.store.recommendationConfigs.size !== t && this.store.patchCurrentBlockConfig({ size: t });
43
+ !this.currentNode || n.getConfig(this.currentNode).size === t || (n.updateConfig(
44
+ this.api,
45
+ this.currentNode,
46
+ { size: t },
47
+ `Changed product count to ${t}`
48
+ ), this.store.patchCurrentBlockConfig({ size: t }));
44
49
  }
45
50
  _listenToFormUpdates() {
46
- this.api.onValueChanged(n.PRODUCT_COUNT, (t) => {
51
+ this.api.onValueChanged(r.PRODUCT_COUNT, (t) => {
47
52
  this._onProductCountChange(t.toString());
48
53
  });
49
54
  }
50
55
  }
51
56
  export {
52
- d as PRODUCT_COUNT_CONTROL_ID,
57
+ C as PRODUCT_COUNT_CONTROL_ID,
53
58
  U as ProductCountControl
54
59
  };