@useinsider/guido 3.20.1 → 3.21.0-beta.0df5409

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