@useinsider/guido 2.1.0-beta.01eaf27 → 2.1.0-beta.1d0cd94

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,6 +1,6 @@
1
1
  import { useToaster as w } from "./useToaster.js";
2
2
  const v = () => {
3
- const { handleError: l } = w(), r = (t = {}) => new Promise((e, a) => {
3
+ const { handleError: n } = w(), m = (t = {}) => new Promise((e, a) => {
4
4
  const o = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
@@ -21,9 +21,9 @@ const v = () => {
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
23
  }, ...t }, s = {
24
- callback: (n, p, d, c, u) => {
25
- n ? a(n) : e({
26
- html: p,
24
+ callback: (l, r, d, c, u) => {
25
+ l ? a(l) : e({
26
+ html: r,
27
27
  ampHtml: d,
28
28
  ampErrors: c,
29
29
  displayConditions: u
@@ -34,15 +34,15 @@ const v = () => {
34
34
  window.StripoEditorApi.actionsApi.compileEmail(s);
35
35
  });
36
36
  return {
37
- getCompiledEmail: r,
37
+ getCompiledEmail: m,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: a, css: i, width: o, height: m, utmParams: s, syncModulesIds: n }) => t({
39
+ const e = ({ html: a, css: i, width: o, height: p, utmParams: s, syncModulesIds: l }) => t({
40
40
  html: a,
41
41
  css: i,
42
42
  width: o,
43
- height: m,
43
+ height: p,
44
44
  utmParams: s,
45
- syncModulesIds: n
45
+ syncModulesIds: l
46
46
  });
47
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
48
  }),
@@ -56,7 +56,7 @@ const v = () => {
56
56
  displayConditions: a,
57
57
  ampHtml: i = "",
58
58
  ampErrors: o = []
59
- } = await r({ minimize: !1, resetDataSavedFlag: !1, ...t });
59
+ } = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
60
  return {
61
61
  html: e,
62
62
  ampHtml: i,
@@ -64,7 +64,7 @@ const v = () => {
64
64
  displayConditions: a
65
65
  };
66
66
  } catch (e) {
67
- return l(e, "Error loading preview"), {
67
+ return n(e, "Error loading preview"), {
68
68
  html: "",
69
69
  ampHtml: "",
70
70
  ampErrors: [],
@@ -80,17 +80,19 @@ const v = () => {
80
80
  }
81
81
  try {
82
82
  window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
83
- i ? (l(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
83
+ i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
84
84
  });
85
85
  } catch (i) {
86
- l(i, "Failed to call updateTimerInClonedTemplate"), t(null);
86
+ n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
87
87
  }
88
88
  }),
89
89
  updateHtmlAndCss: (t, e) => {
90
90
  window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
91
91
  },
92
92
  editorSave: () => {
93
- window.StripoEditorApi.actionsApi.save();
93
+ window.StripoEditorApi.actionsApi.save((t) => {
94
+ t && n(t, "Failed to save template");
95
+ });
94
96
  }
95
97
  };
96
98
  };
@@ -1,18 +1,18 @@
1
- import { useOnboardingStore as l } from "../../../stores/onboarding.js";
2
- import { Block as m, BlockCompositionType as d, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { SETTINGS_ENUMS as a, DefaultConfigValues as n } from "./enums/settingsEnums.js";
4
- import { getDefaultTemplate as f } from "./template.js";
5
- import { getItemsBlockContainer as g, getItemsBlockConfig as p, getDefaultItemsBlockConfig as u } from "./utils/nodeConfigUtils.js";
6
- const I = "items-block";
7
- class S extends m {
1
+ import { useOnboardingStore as d } from "../../../stores/onboarding.js";
2
+ import { Block as g, BlockCompositionType as f, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { SETTINGS_ENUMS as c, DefaultConfigValues as i } from "./enums/settingsEnums.js";
4
+ import { getDefaultTemplate as p } from "./template.js";
5
+ import { getItemsBlockContainer as u, getItemsBlockConfig as C, getDefaultItemsBlockConfig as I } from "./utils/nodeConfigUtils.js";
6
+ const y = "items-block";
7
+ class B extends g {
8
8
  getId() {
9
- return I;
9
+ return y;
10
10
  }
11
11
  getIcon() {
12
12
  return "items-icon";
13
13
  }
14
14
  getBlockCompositionType() {
15
- return d.CONTAINER;
15
+ return f.CONTAINER;
16
16
  }
17
17
  getName() {
18
18
  return this.api.translate("Items");
@@ -21,32 +21,34 @@ class S extends m {
21
21
  return this.api.translate("Items lets you display personalized products based on user behavior.");
22
22
  }
23
23
  getTemplate() {
24
- return f({
25
- orientation: a.ORIENTATION.VERTICAL,
26
- itemsType: a.ITEMS_TYPE.CART_ITEMS,
24
+ return p({
25
+ orientation: c.ORIENTATION.VERTICAL,
26
+ itemsType: c.ITEMS_TYPE.CART_ITEMS,
27
27
  itemId: "{{Abandoned Cart Item (1) Url}}",
28
- currencySymbol: n.productPriceCurrencySymbolControlValue,
29
- currencyLocation: n.productPriceCurrencyLocationControlValue,
30
- formattedPrice: n.productPriceFormattedControlValue === "1"
28
+ currencySymbol: i.productPriceCurrencySymbolControlValue,
29
+ currencyLocation: i.productPriceCurrencyLocationControlValue,
30
+ formattedPrice: i.productPriceFormattedControlValue === "1"
31
31
  });
32
32
  }
33
33
  allowInnerBlocksDND() {
34
34
  return !1;
35
35
  }
36
- onCreated(i) {
37
- const t = g(i);
38
- if (!t)
36
+ onCreated(n) {
37
+ const s = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
38
+ r.querySelector('[product-attr="imageSrc"] img') || s.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
39
+ const e = u(n);
40
+ if (!e)
39
41
  return;
40
- const r = t.getNodeConfig(), c = r && Object.keys(r).length > 0, e = p(i);
41
- if (e != null && e.initialized)
42
- c ? e.blockInstanceId || this.api.getDocumentModifier().modifyHtml(t).setNodeConfig({ ...e, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(e).apply(new o("Migrate legacy config to nodeConfig"));
42
+ const a = e.getNodeConfig(), l = a && Object.keys(a).length > 0, t = C(n);
43
+ if (t != null && t.initialized)
44
+ l ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new o("Migrate legacy config to nodeConfig"));
43
45
  else {
44
- const s = u();
45
- this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(s).apply(new o("Initialize Items block with default configuration")), l().startOnboarding("itemsOnboarding");
46
+ const m = I();
47
+ this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new o("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
46
48
  }
47
49
  }
48
50
  }
49
51
  export {
50
- I as BLOCK_ID,
51
- S as ItemsBlock
52
+ y as BLOCK_ID,
53
+ B as ItemsBlock
52
54
  };
@@ -1,12 +1,12 @@
1
1
  var I = Object.defineProperty;
2
- var p = (c, r, t) => r in c ? I(c, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[r] = t;
3
- var y = (c, r, t) => p(c, typeof r != "symbol" ? r + "" : r, t);
4
- import { ModificationDescription as a } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as U } from "../../common-control.js";
6
- import { ItemsBlockId as n } from "../enums/controlEnums.js";
7
- import { SETTINGS_ENUMS as u } from "../enums/settingsEnums.js";
8
- import { getItemsBlockConfig as h, setItemsBlockConfig as b } from "../utils/nodeConfigUtils.js";
9
- const m = "ui-elements-items-card-composition-block", i = {
2
+ var U = (d, a, t) => a in d ? I(d, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[a] = t;
3
+ var p = (d, a, t) => U(d, typeof a != "symbol" ? a + "" : a, t);
4
+ import { ModificationDescription as c } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as b } from "../../common-control.js";
6
+ import { ItemsBlockId as r } from "../enums/controlEnums.js";
7
+ import { SETTINGS_ENUMS as h } from "../enums/settingsEnums.js";
8
+ import { getItemsBlockConfig as R, setItemsBlockConfig as m } from "../utils/nodeConfigUtils.js";
9
+ const g = "ui-elements-items-card-composition-block", i = {
10
10
  PRODUCT_IMAGE: "image",
11
11
  PRODUCT_NAME: "name",
12
12
  PRODUCT_QUANTITY: "quantity",
@@ -14,10 +14,10 @@ const m = "ui-elements-items-card-composition-block", i = {
14
14
  PRODUCT_ORIGINAL_PRICE: "originalPrice",
15
15
  PRODUCT_BUTTON: "button"
16
16
  };
17
- class S extends U {
17
+ class M extends b {
18
18
  constructor() {
19
19
  super(...arguments);
20
- y(this, "visibilityState", {
20
+ p(this, "visibilityState", {
21
21
  [i.PRODUCT_IMAGE]: !0,
22
22
  [i.PRODUCT_NAME]: !0,
23
23
  [i.PRODUCT_QUANTITY]: !0,
@@ -27,7 +27,7 @@ class S extends U {
27
27
  });
28
28
  }
29
29
  getId() {
30
- return m;
30
+ return g;
31
31
  }
32
32
  getTemplate() {
33
33
  return `
@@ -39,7 +39,7 @@ class S extends U {
39
39
  { name: i.PRODUCT_PRICE, label: "Product Price" },
40
40
  { name: i.PRODUCT_ORIGINAL_PRICE, label: "Product Original Price" },
41
41
  { name: i.PRODUCT_BUTTON, label: "Product Button" }
42
- ].map((o) => this._getToggleContainer(o)).join("")}
42
+ ].map((e) => this._getToggleContainer(e)).join("")}
43
43
  </div>
44
44
  `;
45
45
  }
@@ -48,14 +48,14 @@ class S extends U {
48
48
  }
49
49
  onTemplateNodeUpdated(t) {
50
50
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
51
- this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._applyVisibilityStyles(), this._updateTogglesFromState();
51
+ this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(!0), this._updateTogglesFromState();
52
52
  });
53
53
  }
54
- _getToggleContainer({ name: t, label: o }) {
54
+ _getToggleContainer({ name: t, label: e }) {
55
55
  return `
56
56
  <div class="container" name="${t}Container">
57
57
  <div class="display-flex align-items-center justify-content-between">
58
- ${this._GuLabel({ text: o, name: `${t}Label` })}
58
+ ${this._GuLabel({ text: e, name: `${t}Label` })}
59
59
  ${this._GuToggle(t)}
60
60
  </div>
61
61
  </div>
@@ -75,10 +75,10 @@ class S extends U {
75
75
  });
76
76
  }
77
77
  _syncVisibilityFromAttributes() {
78
- const t = h(this.currentNode);
78
+ const t = R(this.currentNode);
79
79
  if (!t)
80
80
  return;
81
- const o = {
81
+ const e = {
82
82
  [i.PRODUCT_IMAGE]: "imageVisible",
83
83
  [i.PRODUCT_NAME]: "nameVisible",
84
84
  [i.PRODUCT_QUANTITY]: "quantityControlEnabled",
@@ -86,44 +86,45 @@ class S extends U {
86
86
  [i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
87
87
  [i.PRODUCT_BUTTON]: "buttonVisible"
88
88
  };
89
- Object.entries(o).forEach(([e, s]) => {
90
- const l = t[s];
91
- this.visibilityState[e] = l !== !1;
89
+ Object.entries(e).forEach(([o, n]) => {
90
+ const s = t[n];
91
+ this.visibilityState[o] = s !== !1;
92
92
  });
93
93
  }
94
94
  /**
95
95
  * If itemsType is not BROWSED_ITEMS, show quantity
96
96
  * If itemsType is BROWSED_ITEMS, hide quantity
97
97
  * and mark it as '0'
98
+ * @param syncOnly - If true, only sync local state and UI without modifying the document
98
99
  */
99
- _handleBrowsedItemsQuantity() {
100
- const t = h(this.currentNode), e = ((t == null ? void 0 : t.type) ?? u.ITEMS_TYPE.CART_ITEMS) !== u.ITEMS_TYPE.BROWSED_ITEMS;
101
- if (!t)
100
+ _handleBrowsedItemsQuantity(t = !1) {
101
+ const e = R(this.currentNode), n = ((e == null ? void 0 : e.type) ?? h.ITEMS_TYPE.CART_ITEMS) !== h.ITEMS_TYPE.BROWSED_ITEMS;
102
+ if (!e)
102
103
  return;
103
- const s = t.quantityControlEnabled !== !1;
104
- this.visibilityState[i.PRODUCT_QUANTITY] = e && s, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, e), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, e && s);
105
- }
106
- _applyVisibilityStyles() {
107
- const t = {
108
- [i.PRODUCT_IMAGE]: n.IMAGE,
109
- [i.PRODUCT_NAME]: n.NAME,
110
- [i.PRODUCT_QUANTITY]: n.QUANTITY,
111
- [i.PRODUCT_PRICE]: n.PRICE,
112
- [i.PRODUCT_ORIGINAL_PRICE]: n.ORIGINAL_PRICE,
113
- [i.PRODUCT_BUTTON]: n.BUTTON
114
- };
115
- Object.entries(t).forEach(([o, e]) => {
104
+ const s = e.quantityControlEnabled !== !1;
105
+ this.visibilityState[i.PRODUCT_QUANTITY] = n && s, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, n), t || this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, n && s);
106
+ }
107
+ _applyVisibilityStyles(t) {
108
+ const e = {
109
+ [i.PRODUCT_IMAGE]: r.IMAGE,
110
+ [i.PRODUCT_NAME]: r.NAME,
111
+ [i.PRODUCT_QUANTITY]: r.QUANTITY,
112
+ [i.PRODUCT_PRICE]: r.PRICE,
113
+ [i.PRODUCT_ORIGINAL_PRICE]: r.ORIGINAL_PRICE,
114
+ [i.PRODUCT_BUTTON]: r.BUTTON
115
+ }, o = t ?? this.api.getDocumentModifier();
116
+ Object.entries(e).forEach(([n, s]) => {
116
117
  var C;
117
- const s = (C = this.currentNode) == null ? void 0 : C.querySelectorAll(`[esd-extension-block-id="${e}"]`);
118
- if (!s)
118
+ const l = (C = this.currentNode) == null ? void 0 : C.querySelectorAll(`[esd-extension-block-id="${s}"]`);
119
+ if (!l)
119
120
  return;
120
- const l = this.visibilityState[o], T = this.api.getDocumentModifier();
121
- s.forEach((d) => {
122
- T.modifyHtml(d).setStyle("display", l ? "table-cell" : "none");
123
- }), T.apply(new a("Applied visibility from attributes"));
124
- }), this._updatePriceCellWidthsForVerticalLayout();
121
+ const P = this.visibilityState[n];
122
+ l.forEach((T) => {
123
+ o.modifyHtml(T).setStyle("display", P ? "table-cell" : "none");
124
+ });
125
+ }), this._updatePriceCellWidthsForVerticalLayout(o), t || o.apply(new c("Applied visibility styles"));
125
126
  }
126
- _updateVisibilityAttribute(t, o) {
127
+ _updateVisibilityAttribute(t, e, o) {
127
128
  const s = {
128
129
  [i.PRODUCT_IMAGE]: "imageVisible",
129
130
  [i.PRODUCT_NAME]: "nameVisible",
@@ -132,9 +133,9 @@ class S extends U {
132
133
  [i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
133
134
  [i.PRODUCT_BUTTON]: "buttonVisible"
134
135
  }[t];
135
- s && b(this.currentNode, this.api, {
136
- [s]: o
137
- });
136
+ s && m(this.currentNode, this.api, {
137
+ [s]: e
138
+ }, o);
138
139
  }
139
140
  _listenToFormUpdates() {
140
141
  this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => {
@@ -152,51 +153,67 @@ class S extends U {
152
153
  });
153
154
  }
154
155
  _onProductImageChange(t) {
155
- var e;
156
- const o = (e = this.currentNode) == null ? void 0 : e.querySelector(`[esd-extension-block-id="${n.IMAGE}"]`);
157
- o && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(o).setStyle("display", t ? "table-cell" : "none").apply(new a(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
156
+ var s;
157
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.IMAGE}"]`);
158
+ if (!e)
159
+ return;
160
+ this.visibilityState[i.PRODUCT_IMAGE] = t;
161
+ const o = this.api.getDocumentModifier();
162
+ o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t, o);
163
+ const n = `Product image visibility changed to ${t ? "visible" : "hidden"}`;
164
+ o.apply(new c(n));
158
165
  }
159
166
  _onProductNameChange(t) {
160
- var e;
161
- const o = (e = this.currentNode) == null ? void 0 : e.querySelector(`[esd-extension-block-id="${n.NAME}"]`);
162
- o && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(o).setStyle("display", t ? "table-cell" : "none").apply(new a(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
167
+ var s;
168
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.NAME}"]`);
169
+ if (!e)
170
+ return;
171
+ this.visibilityState[i.PRODUCT_NAME] = t;
172
+ const o = this.api.getDocumentModifier();
173
+ o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_NAME, t, o);
174
+ const n = `Product name visibility changed to ${t ? "visible" : "hidden"}`;
175
+ o.apply(new c(n));
163
176
  }
164
177
  _onProductQuantityChange(t) {
165
- var e;
166
- const o = (e = this.currentNode) == null ? void 0 : e.querySelector(`[esd-extension-block-id="${n.QUANTITY}"]`);
167
- o && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(o).setStyle("display", t ? "table-cell" : "none").apply(new a(
168
- `Product quantity visibility changed to ${t ? "visible" : "hidden"}`
169
- )), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
178
+ var s;
179
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.QUANTITY}"]`);
180
+ if (!e)
181
+ return;
182
+ this.visibilityState[i.PRODUCT_QUANTITY] = t;
183
+ const o = this.api.getDocumentModifier();
184
+ o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t, o);
185
+ const n = `Product quantity visibility changed to ${t ? "visible" : "hidden"}`;
186
+ o.apply(new c(n));
170
187
  }
171
188
  _onProductPriceChange(t) {
172
189
  var s;
173
- const o = (s = this.currentNode) == null ? void 0 : s.querySelectorAll(
174
- `[esd-extension-block-id="${n.PRICE}"]`
190
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelectorAll(
191
+ `[esd-extension-block-id="${r.PRICE}"]`
175
192
  );
176
- if (!o)
193
+ if (!e)
177
194
  return;
178
195
  this.visibilityState[i.PRODUCT_PRICE] = t;
179
- const e = this.api.getDocumentModifier();
180
- o.forEach((l) => {
181
- e.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
182
- }), e.apply(
183
- new a(`Product price visibility changed to ${t ? "visible" : "hidden"}`)
184
- ), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t), this._updatePriceCellWidthsForVerticalLayout();
196
+ const o = this.api.getDocumentModifier();
197
+ e.forEach((l) => {
198
+ o.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
199
+ }), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t, o), this._updatePriceCellWidthsForVerticalLayout(o);
200
+ const n = `Product price visibility changed to ${t ? "visible" : "hidden"}`;
201
+ o.apply(new c(n));
185
202
  }
186
203
  _onProductOriginalPriceChange(t) {
187
204
  var s;
188
- const o = (s = this.currentNode) == null ? void 0 : s.querySelectorAll(
189
- `[esd-extension-block-id="${n.ORIGINAL_PRICE}"]`
205
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelectorAll(
206
+ `[esd-extension-block-id="${r.ORIGINAL_PRICE}"]`
190
207
  );
191
- if (!o)
208
+ if (!e)
192
209
  return;
193
210
  this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t;
194
- const e = this.api.getDocumentModifier();
195
- o.forEach((l) => {
196
- e.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
197
- }), e.apply(new a(
198
- `Product original price visibility changed to ${t ? "visible" : "hidden"}`
199
- )), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t), this._updatePriceCellWidthsForVerticalLayout();
211
+ const o = this.api.getDocumentModifier();
212
+ e.forEach((l) => {
213
+ o.modifyHtml(l).setStyle("display", t ? "table-cell" : "none");
214
+ }), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t, o), this._updatePriceCellWidthsForVerticalLayout(o);
215
+ const n = `Product original price visibility changed to ${t ? "visible" : "hidden"}`;
216
+ o.apply(new c(n));
200
217
  }
201
218
  /**
202
219
  * Updates both price cell widths in vertical layout based on priceOrientation and visibility.
@@ -206,33 +223,39 @@ class S extends U {
206
223
  * - When price is hidden, original price cell expands to 100%
207
224
  * - When both are visible, they share 50% each
208
225
  */
209
- _updatePriceCellWidthsForVerticalLayout() {
210
- var R, O;
211
- const t = h(this.currentNode);
212
- if (!((t == null ? void 0 : t.orientation) === u.ORIENTATION.VERTICAL))
226
+ _updatePriceCellWidthsForVerticalLayout(t) {
227
+ var O, y;
228
+ const e = R(this.currentNode);
229
+ if (!((e == null ? void 0 : e.orientation) === h.ORIENTATION.VERTICAL))
213
230
  return;
214
- const e = (R = this.currentNode) == null ? void 0 : R.querySelectorAll(".product-price-class"), s = (O = this.currentNode) == null ? void 0 : O.querySelectorAll(".product-original-price-class"), l = (t == null ? void 0 : t.priceOrientation) === "vertical", T = this.visibilityState[i.PRODUCT_PRICE], C = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], d = this.api.getDocumentModifier();
215
- if (e && e.length > 0) {
216
- const P = l || !C ? "100%" : "50%";
217
- e.forEach((_) => {
218
- d.modifyHtml(_).setStyle("width", P);
231
+ const n = (O = this.currentNode) == null ? void 0 : O.querySelectorAll(".product-price-class"), s = (y = this.currentNode) == null ? void 0 : y.querySelectorAll(".product-original-price-class"), l = (e == null ? void 0 : e.priceOrientation) === "vertical", P = this.visibilityState[i.PRODUCT_PRICE], C = this.visibilityState[i.PRODUCT_ORIGINAL_PRICE], T = t ?? this.api.getDocumentModifier();
232
+ if (n && n.length > 0) {
233
+ const _ = l || !C ? "100%" : "50%";
234
+ n.forEach((u) => {
235
+ T.modifyHtml(u).setStyle("width", _);
219
236
  });
220
237
  }
221
238
  if (s && s.length > 0) {
222
- const P = l || !T ? "100%" : "50%";
223
- s.forEach((_) => {
224
- d.modifyHtml(_).setStyle("width", P);
239
+ const _ = l || !P ? "100%" : "50%";
240
+ s.forEach((u) => {
241
+ T.modifyHtml(u).setStyle("width", _);
225
242
  });
226
243
  }
227
- d.apply(new a("Updated price cell widths for vertical layout"));
244
+ t || T.apply(new c("Updated price cell widths for vertical layout"));
228
245
  }
229
246
  _onProductButtonChange(t) {
230
- var e;
231
- const o = (e = this.currentNode) == null ? void 0 : e.querySelector(`[esd-extension-block-id="${n.BUTTON}"]`);
232
- o && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(o).setStyle("display", t ? "table-cell" : "none").apply(new a(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
247
+ var s;
248
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${r.BUTTON}"]`);
249
+ if (!e)
250
+ return;
251
+ this.visibilityState[i.PRODUCT_BUTTON] = t;
252
+ const o = this.api.getDocumentModifier();
253
+ o.modifyHtml(e).setStyle("display", t ? "table-cell" : "none"), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t, o);
254
+ const n = `Product button visibility changed to ${t ? "visible" : "hidden"}`;
255
+ o.apply(new c(n));
233
256
  }
234
257
  }
235
258
  export {
236
- m as COMPOSITION_CONTROL_BLOCK_ID,
237
- S as ItemsBlockCardCompositionControl
259
+ g as COMPOSITION_CONTROL_BLOCK_ID,
260
+ M as ItemsBlockCardCompositionControl
238
261
  };
@@ -1,20 +1,20 @@
1
- import { UEAttr as P, ModificationDescription as h } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as N, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CommonControl as U } from "../../common-control.js";
3
3
  import { ItemsBlockId as I } from "../enums/controlEnums.js";
4
- import { productPairs as S, templateFirstLine as M } from "../enums/productEnums.js";
5
- import { SETTINGS_ENUMS as d, ItemTypeOptions as b, OrientationOptions as f, ItemInCartOptions as R, DefaultConfigValues as L } from "../enums/settingsEnums.js";
6
- import H from "../layouts/horizontal.html.js";
7
- import F from "../layouts/vertical.html.js";
8
- import { getDefaultTemplate as k } from "../template.js";
9
- import { getItemsBlockConfig as E, setItemsBlockConfig as O, escapeReplacement as A } from "../utils/nodeConfigUtils.js";
10
- const $ = "ui-elements-items-block", l = {
4
+ import { productPairs as y, templateFirstLine as b } from "../enums/productEnums.js";
5
+ import { SETTINGS_ENUMS as d, ItemTypeOptions as D, OrientationOptions as k, ItemInCartOptions as g, DefaultConfigValues as x } from "../enums/settingsEnums.js";
6
+ import F from "../layouts/horizontal.html.js";
7
+ import $ from "../layouts/vertical.html.js";
8
+ import { getDefaultTemplate as q } from "../template.js";
9
+ import { getItemsBlockConfig as _, setItemsBlockConfig as O, escapeReplacement as A } from "../utils/nodeConfigUtils.js";
10
+ const w = "ui-elements-items-block", m = {
11
11
  ITEMS_TYPE: "itemsType",
12
12
  ORIENTATION: "orientation",
13
13
  ITEM_IDS: "itemIds"
14
14
  };
15
- class X extends U {
15
+ class Z extends U {
16
16
  getId() {
17
- return $;
17
+ return w;
18
18
  }
19
19
  getTemplate() {
20
20
  return `
@@ -26,20 +26,20 @@ class X extends U {
26
26
  `;
27
27
  }
28
28
  onRender() {
29
- const e = E(this.currentNode);
29
+ const e = _(this.currentNode);
30
30
  this.api.updateValues({
31
- [l.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL,
32
- [l.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS,
33
- [l.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
31
+ [m.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL,
32
+ [m.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS,
33
+ [m.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
34
34
  }), this._listenToFormUpdates();
35
35
  }
36
36
  onTemplateNodeUpdated(e) {
37
37
  super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(() => {
38
- const t = E(this.currentNode);
38
+ const r = _(this.currentNode);
39
39
  this.api.updateValues({
40
- [l.ORIENTATION]: (t == null ? void 0 : t.orientation) ?? d.ORIENTATION.VERTICAL,
41
- [l.ITEMS_TYPE]: (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS,
42
- [l.ITEM_IDS]: (t == null ? void 0 : t.itemsSelectValue) ?? ""
40
+ [m.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? d.ORIENTATION.VERTICAL,
41
+ [m.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? d.ITEMS_TYPE.CART_ITEMS,
42
+ [m.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
43
43
  }), this._initializeSelectItems();
44
44
  });
45
45
  }
@@ -48,10 +48,10 @@ class X extends U {
48
48
  ${this._GuOneColumn([
49
49
  this._GuLabel({ text: "Item Type" }),
50
50
  this._GuSelect({
51
- name: l.ITEMS_TYPE,
51
+ name: m.ITEMS_TYPE,
52
52
  className: "es-100",
53
53
  placeholder: "Select Item Type",
54
- options: b
54
+ options: D
55
55
  })
56
56
  ])}
57
57
  `;
@@ -61,8 +61,8 @@ class X extends U {
61
61
  ${this._GuTwoColumns([
62
62
  this._GuLabel({ text: "Orientation" }),
63
63
  this._GuRadioButton({
64
- name: l.ORIENTATION,
65
- buttons: f
64
+ name: m.ORIENTATION,
65
+ buttons: k
66
66
  })
67
67
  ])}
68
68
  `;
@@ -72,7 +72,7 @@ class X extends U {
72
72
  ${this._GuTwoColumns([
73
73
  this._GuLabel({ text: "Item in Cart" }),
74
74
  this._GuSelect({
75
- name: l.ITEM_IDS,
75
+ name: m.ITEM_IDS,
76
76
  className: "es-100",
77
77
  placeholder: "Select Item In Cart",
78
78
  options: []
@@ -81,213 +81,219 @@ class X extends U {
81
81
  `;
82
82
  }
83
83
  _onOrientationChange(e) {
84
- this.api.updateValues({ [l.ORIENTATION]: e }), O(this.currentNode, this.api, {
84
+ this.api.updateValues({ [m.ORIENTATION]: e });
85
+ const r = this.api.getDocumentModifier();
86
+ O(this.currentNode, this.api, {
85
87
  orientation: e,
86
88
  priceOrientation: "horizontal"
87
- }), this._reOrderTemplate(), setTimeout(() => {
89
+ }, r), r.apply(new N("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
88
90
  this._recalculateTrimming();
89
91
  }, 50);
90
92
  }
91
93
  _onItemsTypeChange(e) {
92
- const t = d.ITEMS_TYPE[e], r = R[e], i = r == null ? void 0 : r[0];
93
- if (!t || !i)
94
+ const r = d.ITEMS_TYPE[e], t = g[e], i = t == null ? void 0 : t[0];
95
+ if (!r || !i)
94
96
  return;
95
- const n = i.value, o = i.value.replace("Url}}", "Image}}");
97
+ const n = i.value, s = i.value.replace("Url}}", "Image}}"), o = this.api.getDocumentModifier();
96
98
  O(this.currentNode, this.api, {
97
- source: t,
98
- type: t,
99
+ source: r,
100
+ type: r,
99
101
  itemsSelectValue: i.value,
100
- imageLink: o,
102
+ imageLink: s,
101
103
  buttonLink: n
102
- }), this._updateDataTypeAttributes(t), this._initializeSelectItems(), this._reFillTemplate(t);
104
+ }, o), this._updateDataTypeAttributes(r, o), this._initializeSelectItems();
105
+ const l = this._getTemplateData(r, i.value);
106
+ this._updateImageSrc(l.imageSrc, o), this._updateName(l.name, o), this._updatePrice(l.price, o), this._updateOriginalPrice(l.originalPrice, o), this._updateQuantity(l.quantity, r, o), o.apply(new N("Updated items type"));
103
107
  }
104
108
  _onItemIdsChange(e) {
105
- this.api.updateValues({ [l.ITEM_IDS]: e });
106
- const t = e, r = e.replace("Url}}", "Image}}");
109
+ this.api.updateValues({ [m.ITEM_IDS]: e });
110
+ const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
107
111
  O(this.currentNode, this.api, {
108
112
  itemsSelectValue: e,
109
- imageLink: r,
110
- buttonLink: t
111
- }), this._updateDataNumberAttributes(e), this._reFillTemplate();
113
+ imageLink: t,
114
+ buttonLink: r
115
+ }, i), this._updateDataNumberAttributes(e, i);
116
+ const n = this._getTemplateData(void 0, e);
117
+ this._updateImageSrc(n.imageSrc, i), this._updateName(n.name, i), this._updatePrice(n.price, i), this._updateOriginalPrice(n.originalPrice, i), this._updateQuantity(n.quantity, void 0, i), i.apply(new N("Updated item selection"));
112
118
  }
113
119
  _initializeSelectItems() {
114
120
  this.api.setUIEAttribute(
115
- l.ITEMS_TYPE,
116
- P.SELECTPICKER.items,
117
- b
121
+ m.ITEMS_TYPE,
122
+ L.SELECTPICKER.items,
123
+ D
118
124
  );
119
- const e = E(this.currentNode), t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, r = (e == null ? void 0 : e.itemsSelectValue) ?? "";
125
+ const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
120
126
  this.api.updateValues({
121
- [l.ITEMS_TYPE]: t
127
+ [m.ITEMS_TYPE]: r
122
128
  });
123
- const i = R[t];
129
+ const i = g[r];
124
130
  this.api.setUIEAttribute(
125
- l.ITEM_IDS,
126
- P.SELECTPICKER.items,
131
+ m.ITEM_IDS,
132
+ L.SELECTPICKER.items,
127
133
  i
128
134
  ), this.api.updateValues({
129
- [l.ITEM_IDS]: r
135
+ [m.ITEM_IDS]: t
130
136
  });
131
137
  }
132
138
  _listenToFormUpdates() {
133
139
  this.api.onValueChanged(
134
- l.ITEMS_TYPE,
140
+ m.ITEMS_TYPE,
135
141
  (e) => this._onItemsTypeChange(e)
136
142
  ), this.api.onValueChanged(
137
- l.ORIENTATION,
143
+ m.ORIENTATION,
138
144
  (e) => this._onOrientationChange(e)
139
145
  ), this.api.onValueChanged(
140
- l.ITEM_IDS,
146
+ m.ITEM_IDS,
141
147
  (e) => this._onItemIdsChange(e)
142
148
  );
143
149
  }
144
150
  _renderTemplate() {
145
- const e = E(this.currentNode), t = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, r = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", o = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", a = (e == null ? void 0 : e.priceFormatted) ?? !1;
146
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(k({
147
- orientation: t,
148
- itemsType: r,
151
+ const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? d.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", o = (e == null ? void 0 : e.priceFormatted) ?? !1;
152
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
153
+ orientation: r,
154
+ itemsType: t,
149
155
  itemId: i,
150
156
  currencySymbol: n,
151
- currencyLocation: o,
152
- formattedPrice: a
153
- })).apply(new h("Updated template"));
157
+ currencyLocation: s,
158
+ formattedPrice: o
159
+ })).apply(new N("Updated template"));
154
160
  }
155
- _getTemplateData(e) {
156
- const t = E(this.currentNode), r = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = (t == null ? void 0 : t.itemsSelectValue) ?? "", n = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, a = R[r].findIndex((T) => T.value === i), c = a > -1 ? a : 0, s = S.PAIRS_FOR_EXTENSION.price[r], m = S.PAIRS_FOR_EXTENSION.originalPrice[r];
161
+ _getTemplateData(e, r) {
162
+ const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, l = g[i].findIndex((h) => h.value === n), a = l > -1 ? l : 0, c = y.PAIRS_FOR_EXTENSION.price[i], T = y.PAIRS_FOR_EXTENSION.originalPrice[i];
157
163
  let u, p;
158
- return o ? (u = n ? s.DEFAULT_SINGLE_PRICE_FORMATTED : s.DEFAULT_SINGLE_PRICE, p = n ? m.DEFAULT_SINGLE_PRICE_FORMATTED : m.DEFAULT_SINGLE_PRICE) : (u = n ? s.DEFAULT_PRICE_FORMATTED : s.DEFAULT_PRICE, p = n ? m.DEFAULT_PRICE_FORMATTED : m.DEFAULT_PRICE), {
159
- imageSrc: S.PAIRS_FOR_EXTENSION.imageSrc[r].DEFAULT[c],
160
- name: S.PAIRS_FOR_EXTENSION.name[r].DEFAULT[c],
164
+ return o ? (u = s ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, p = s ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE) : (u = s ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, p = s ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE), {
165
+ imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[a],
166
+ name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[a],
161
167
  price: u,
162
168
  originalPrice: p,
163
- quantity: S.PAIRS_FOR_EXTENSION.quantity[r].DEFAULT,
164
- button: S.PAIRS_FOR_EXTENSION.button[r].DEFAULT_LABEL
169
+ quantity: y.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
170
+ button: y.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
165
171
  };
166
172
  }
167
- _updateImageSrc(e) {
168
- var r;
169
- const t = (r = this.currentNode) == null ? void 0 : r.querySelector(`[esd-extension-block-id="${I.IMAGE}"] img`);
170
- t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new h("Updated image src"));
173
+ _updateImageSrc(e, r) {
174
+ var i;
175
+ const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${I.IMAGE}"] img`);
176
+ t && r.modifyHtml(t).setAttribute("src", e);
171
177
  }
172
- _updateName(e) {
173
- var n;
174
- const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
178
+ _updateName(e, r) {
179
+ var s;
180
+ const t = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
175
181
  if (!t)
176
182
  return;
177
- const r = t.getInnerText().trim();
178
- let i = t.getInnerHTML().trim();
179
- i = i.replace(r, A(e)), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(i).apply(new h("Updated name"));
183
+ const i = t.getInnerText().trim();
184
+ let n = t.getInnerHTML().trim();
185
+ n = n.replace(i, A(e)), r.modifyHtml(t).setInnerHtml(n);
180
186
  }
181
- _updatePrice(e) {
187
+ _updatePrice(e, r) {
182
188
  var o;
183
189
  const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
184
190
  `[esd-extension-block-id="${I.PRICE}"]`
185
- )) || [], r = E(this.currentNode), i = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", n = (r == null ? void 0 : r.priceCurrencyLocation) ?? "0";
186
- t.forEach((a) => {
187
- const c = this._getParagraphFromBlock(a);
188
- if (!c)
191
+ )) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
192
+ t.forEach((l) => {
193
+ const a = this._getParagraphFromBlock(l);
194
+ if (!a)
189
195
  return;
190
- const s = c.getInnerHTML().trim() || "", m = c.getInnerText().trim() || "", u = (i == null ? void 0 : i.trim()) || "", p = this._removeCurrencySymbol(m, u), T = this._replacePriceNumber(p, e), _ = this._buildPriceContent(T, u, n), y = s.replace(m, A(_));
191
- this.api.getDocumentModifier().modifyHtml(c).setInnerHtml(y).apply(new h("Updated price"));
196
+ const c = a.getInnerHTML().trim() || "", T = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", p = this._removeCurrencySymbol(T, u), h = this._replacePriceNumber(p, e), E = this._buildPriceContent(h, u, s), S = c.replace(T, A(E));
197
+ r.modifyHtml(a).setInnerHtml(S);
192
198
  });
193
199
  }
194
- _updateOriginalPrice(e) {
200
+ _updateOriginalPrice(e, r) {
195
201
  var o;
196
202
  const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
197
203
  `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
198
- )) || [], r = E(this.currentNode), i = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", n = (r == null ? void 0 : r.priceCurrencyLocation) ?? "0";
199
- t.forEach((a) => {
200
- const c = this._getParagraphFromBlock(a);
201
- if (!c)
204
+ )) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
205
+ t.forEach((l) => {
206
+ const a = this._getParagraphFromBlock(l);
207
+ if (!a)
202
208
  return;
203
- const s = c.querySelector("s");
204
- if (!s)
209
+ const c = a.querySelector("s");
210
+ if (!c)
205
211
  return;
206
- const m = s.getInnerHTML().trim() || "", u = s.getInnerText().trim() || "", p = (i == null ? void 0 : i.trim()) || "", T = this._removeCurrencySymbol(u, p), _ = this._replacePriceNumber(T, e), y = this._buildPriceContent(_, p, n), N = `<s>${m.replace(u, A(y))}</s>`;
207
- this.api.getDocumentModifier().modifyHtml(c).setInnerHtml(N).apply(new h("Updated original price"));
212
+ const T = c.getInnerHTML().trim() || "", u = c.getInnerText().trim() || "", p = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(u, p), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, p, s), R = `<s>${T.replace(u, A(S))}</s>`;
213
+ r.modifyHtml(a).setInnerHtml(R);
208
214
  });
209
215
  }
210
- _updateQuantity(e, t) {
211
- var _;
212
- const r = E(this.currentNode), n = (t ?? (r == null ? void 0 : r.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (r == null ? void 0 : r.quantityControlEnabled) !== !1, a = n && o, c = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
213
- if (!c)
216
+ _updateQuantity(e, r, t) {
217
+ var h;
218
+ const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? d.ITEMS_TYPE.CART_ITEMS) !== d.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = s && o, a = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
219
+ if (!a)
214
220
  return;
215
- const s = this._getParagraphFromBlock(c);
216
- if (!s)
221
+ const c = this._getParagraphFromBlock(a);
222
+ if (!c)
217
223
  return;
218
- const m = s.getInnerText().trim();
219
- let u = s.getInnerHTML().trim();
220
- function p(y, C, N) {
221
- return y.replace(
222
- new RegExp(`(>\\s*)?${C}(\\s*<)?`, "g"),
223
- `$1${N}$2`
224
+ const T = c.getInnerText().trim();
225
+ let u = c.getInnerHTML().trim();
226
+ function p(E, S, C) {
227
+ return E.replace(
228
+ new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
229
+ `$1${C}$2`
224
230
  );
225
231
  }
226
- u = p(u, m, e);
227
- const T = this.api.getDocumentModifier();
228
- T.modifyHtml(s).setInnerHtml(u), T.modifyHtml(c).setStyle("display", a ? "table-cell" : "none"), T.apply(new h("Updated quantity"));
232
+ u = p(u, T, e), t.modifyHtml(c).setInnerHtml(u), t.modifyHtml(a).setStyle("display", l ? "table-cell" : "none");
229
233
  }
230
- _reOrderTemplate() {
231
- var T, _, y, C, N, g;
232
- const e = (T = this.currentNode) == null ? void 0 : T.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${I.NAME}"]`), r = ((y = this.currentNode) == null ? void 0 : y.querySelectorAll(
234
+ _reOrderTemplate(e) {
235
+ var h, E, S, C, R, M;
236
+ const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
233
237
  `[esd-extension-block-id="${I.PRICE}"]`
234
- )) || [], i = ((C = this.currentNode) == null ? void 0 : C.querySelectorAll(
238
+ )) || [], n = ((C = this.currentNode) == null ? void 0 : C.querySelectorAll(
235
239
  `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
236
- )) || [], [n] = r, [o] = i, a = (N = this.currentNode) == null ? void 0 : N.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), c = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
237
- if (!e || !t || !n || !o || !a || !c)
240
+ )) || [], [s] = i, [o] = n, l = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), a = (M = this.currentNode) == null ? void 0 : M.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
241
+ if (!r || !t || !s || !o || !l || !a)
238
242
  return;
239
- const s = E(this.currentNode), u = ((s == null ? void 0 : s.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
240
- let p = u ? F : H;
241
- this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", L.productImageWidth).setAttribute("height", L.productImageWidth).apply(new h("Updated image width")), setTimeout(() => {
242
- const D = A(n.getOuterHTML()), x = A(o.getOuterHTML());
243
- p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? M : "").replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", D).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", x).replace("{-{-PRODUCT_QUANTITY-}-}", a.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", c.getOuterHTML()), p = p.trim().replace(M, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(p).apply(new h("Reordered template"));
243
+ const c = _(this.currentNode), u = ((c == null ? void 0 : c.orientation) ?? d.ORIENTATION.VERTICAL) === d.ORIENTATION.VERTICAL;
244
+ let p = u ? $ : F;
245
+ setTimeout(() => {
246
+ const H = A(s.getOuterHTML()), f = A(o.getOuterHTML());
247
+ p = p.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? b : "").replace("{-{-PRODUCT_IMAGE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", H).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", f).replace("{-{-PRODUCT_QUANTITY-}-}", l.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", a.getOuterHTML()), p = p.trim().replace(b, "").slice(0, -5);
248
+ const P = e ?? this.api.getDocumentModifier();
249
+ P.modifyHtml(r.querySelector("img")).setAttribute("width", x.productImageWidth).setAttribute("height", x.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(p), e || P.apply(new N("Reordered template"));
244
250
  }, 50);
245
251
  }
246
- _updateDataTypeAttributes(e) {
252
+ _updateDataTypeAttributes(e, r) {
247
253
  if (!this.currentNode)
248
254
  return;
249
- const t = this.currentNode.closest(".ins-product-td"), r = this.api.getDocumentModifier();
255
+ const t = this.currentNode.closest(".ins-product-td");
250
256
  t && r.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
251
- const o = n;
252
- r.modifyHtml(o).setAttribute("data-type", e);
253
- }), r.apply(new h("Updated data-type attribute"));
257
+ const s = n;
258
+ r.modifyHtml(s).setAttribute("data-type", e);
259
+ });
254
260
  }
255
- _updateDataNumberAttributes(e) {
261
+ _updateDataNumberAttributes(e, r) {
256
262
  if (!this.currentNode)
257
263
  return;
258
- const t = E(this.currentNode), r = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, i = R[r].findIndex((s) => s.value === e);
259
- let n = "1";
260
- if (i >= 0)
261
- n = String(i + 1);
264
+ const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? d.ITEMS_TYPE.CART_ITEMS, n = g[i].findIndex((a) => a.value === e);
265
+ let s = "1";
266
+ if (n >= 0)
267
+ s = String(n + 1);
262
268
  else if (e) {
263
- const s = e.match(/\((\d+)\)/);
264
- if (s) {
265
- const [, m] = s;
266
- n = m;
269
+ const a = e.match(/\((\d+)\)/);
270
+ if (a) {
271
+ const [, c] = a;
272
+ s = c;
267
273
  }
268
274
  }
269
- const o = this.currentNode.closest(".ins-product-td"), a = this.api.getDocumentModifier();
270
- o && a.modifyHtml(o).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((s) => {
271
- const m = s;
272
- a.modifyHtml(m).setAttribute("data-number", n);
273
- }), a.apply(new h("Updated data-number attribute"));
275
+ const o = this.currentNode.closest(".ins-product-td");
276
+ o && r.modifyHtml(o).setAttribute("data-number", s), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
277
+ const c = a;
278
+ r.modifyHtml(c).setAttribute("data-number", s);
279
+ });
274
280
  }
275
281
  _reFillTemplate(e) {
276
- const t = this._getTemplateData(e);
277
- this._updateImageSrc(t.imageSrc), this._updateName(t.name), this._updatePrice(t.price), this._updateOriginalPrice(t.originalPrice), this._updateQuantity(t.quantity, e);
282
+ const r = this._getTemplateData(e), t = this.api.getDocumentModifier();
283
+ this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new N("Refilled template"));
278
284
  }
279
285
  _recalculateTrimming() {
280
- var o;
286
+ var s;
281
287
  if (!this.currentNode)
282
288
  return;
283
- const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
289
+ const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
284
290
  if (!e)
285
291
  return;
286
- const t = e.querySelector("p > a");
287
- if (!t)
292
+ const r = e.querySelector("p > a");
293
+ if (!r)
288
294
  return;
289
- const r = E(this.currentNode), i = (r == null ? void 0 : r.orientation) === d.ORIENTATION.HORIZONTAL, n = (r == null ? void 0 : r.nameTrimming) ?? !0;
290
- this.api.getDocumentModifier().modifyHtml(t).setStyle("overflow", "hidden").setStyle("white-space", n ? "nowrap" : "normal").setStyle("text-overflow", n ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new h("Recalculated trimming after orientation change"));
295
+ const t = _(this.currentNode), i = (t == null ? void 0 : t.orientation) === d.ORIENTATION.HORIZONTAL, n = (t == null ? void 0 : t.nameTrimming) ?? !0;
296
+ this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", n ? "nowrap" : "normal").setStyle("text-overflow", n ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new N("Recalculated trimming after orientation change"));
291
297
  }
292
298
  _getParagraphFromBlock(e) {
293
299
  return e.querySelector("p");
@@ -295,30 +301,30 @@ class X extends U {
295
301
  _escapeRegex(e) {
296
302
  return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
297
303
  }
298
- _removeCurrencySymbol(e, t) {
299
- const r = e || "";
300
- let i = r;
301
- if (t) {
302
- const n = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
303
- i = r.replace(n, "").trim();
304
+ _removeCurrencySymbol(e, r) {
305
+ const t = e || "";
306
+ let i = t;
307
+ if (r) {
308
+ const n = new RegExp(`\\s*${this._escapeRegex(r)}\\s*`);
309
+ i = t.replace(n, "").trim();
304
310
  } else {
305
- const n = r.match(/([^0-9.,\s]+)/);
311
+ const n = t.match(/([^0-9.,\s]+)/);
306
312
  if (n && n[1]) {
307
- const o = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(o)}\\s*`);
308
- i = r.replace(a, "").trim();
313
+ const s = n[1].trim(), o = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
314
+ i = t.replace(o, "").trim();
309
315
  }
310
316
  }
311
317
  return i;
312
318
  }
313
- _replacePriceNumber(e, t) {
314
- const r = /([0-9][0-9,.]*)/;
315
- return e.replace(r, t).trim();
319
+ _replacePriceNumber(e, r) {
320
+ const t = /([0-9][0-9,.]*)/;
321
+ return e.replace(t, r).trim();
316
322
  }
317
- _buildPriceContent(e, t, r) {
318
- return t ? r === "1" ? `${e}&nbsp;${t}` : `${t}&nbsp;${e}` : e;
323
+ _buildPriceContent(e, r, t) {
324
+ return r ? t === "1" ? `${e}&nbsp;${r}` : `${r}&nbsp;${e}` : e;
319
325
  }
320
326
  }
321
327
  export {
322
- $ as CONTROL_BLOCK_ID,
323
- X as ItemsBlockControl
328
+ w as CONTROL_BLOCK_ID,
329
+ Z as ItemsBlockControl
324
330
  };
@@ -3,20 +3,19 @@ import { ItemsBlock as i } from "./block.js";
3
3
  import { ButtonLinkControl as C } from "./controls/button/link.js";
4
4
  import { ItemsBlockCardCompositionControl as e } from "./controls/cardComposition.js";
5
5
  import { ImageLinkControl as m } from "./controls/image/link.js";
6
- import { NameControls as t, QuantityControls as n, OriginalPriceControls as r, PriceControls as d, ImageControls as l, ButtonControls as o } from "./controls/index.js";
6
+ import { NameControls as r, QuantityControls as n, OriginalPriceControls as t, PriceControls as d, ImageControls as l, ButtonControls as o } from "./controls/index.js";
7
7
  import { NameTrimmingControl as s } from "./controls/name/trimming.js";
8
8
  import { PriceCurrencyLocationControl as c } from "./controls/price/currencyLocation.js";
9
- import { PriceCurrencySymbolControl as f } from "./controls/price/currencySymbol.js";
10
- import { PriceFormattedPriceControl as g } from "./controls/price/formattedPrice.js";
9
+ import { PriceCurrencySymbolControl as g } from "./controls/price/currencySymbol.js";
10
+ import { PriceFormattedPriceControl as f } from "./controls/price/formattedPrice.js";
11
11
  import { PriceHideDiscountControl as p } from "./controls/price/hideDiscount.js";
12
12
  import { PriceOrientationControl as y } from "./controls/price/priceOrientation.js";
13
13
  import { PriceSinglePriceControl as u } from "./controls/price/singlePrice.js";
14
14
  import { ItemsBlockControl as P } from "./controls/settingsControl.js";
15
- import { ItemsBlockId as k } from "./enums/controlEnums.js";
16
- import { ItemsIconsRegistry as I } from "./iconsRegistry.js";
17
- import b from "./items.css.js";
18
- import { SettingsPanel as B } from "./settingsPanel.js";
19
- const M = new a().addBlock(i).withSettingsPanelRegistry(B).addControl(P).addControl(e).addControl(t.align).addControl(t.color).addControl(t.size).addControl(t.style).addControl(t.fontFamily).addControl(t.background).addControl(t.paddings).addControl(s).addControl(n.align).addControl(n.color).addControl(n.fontFamily).addControl(n.paddings).addControl(n.size).addControl(n.style).addControl(r.align).addControl(r.color).addControl(r.size).addControl(r.style).addControl(r.fontFamily).addControl(r.background).addControl(r.paddings).addControl(d.align).addControl(d.color).addControl(d.size).addControl(d.style).addControl(d.fontFamily).addControl(d.background).addControl(d.paddings).addControl(p).addControl(g).addControl(u).addControl(f).addControl(c).addControl(y).addControl(m).addControl(l.size).addControl(l.margins).addControl(C).addControl(o.align).addControl(o.border).addControl(o.borderRadius).addControl(o.color).addControl(o.fontFamily).addControl(o.margins).addControl(o.paddings).addControl(o.text).addControl(o.textSize).addControl(o.textStyleAndFontColor).addControl(o.fitToContent).addStyles(b).withPreviewStyles(`[esd-extension-block-id="${k.IMAGE}"] img {object-fit: contain;}`).withIconsRegistry(I).build();
15
+ import { ItemsIconsRegistry as k } from "./iconsRegistry.js";
16
+ import I from "./items.css.js";
17
+ import { SettingsPanel as b } from "./settingsPanel.js";
18
+ const j = new a().addBlock(i).withSettingsPanelRegistry(b).addControl(P).addControl(e).addControl(r.align).addControl(r.color).addControl(r.size).addControl(r.style).addControl(r.fontFamily).addControl(r.background).addControl(r.paddings).addControl(s).addControl(n.align).addControl(n.color).addControl(n.fontFamily).addControl(n.paddings).addControl(n.size).addControl(n.style).addControl(t.align).addControl(t.color).addControl(t.size).addControl(t.style).addControl(t.fontFamily).addControl(t.background).addControl(t.paddings).addControl(d.align).addControl(d.color).addControl(d.size).addControl(d.style).addControl(d.fontFamily).addControl(d.background).addControl(d.paddings).addControl(p).addControl(f).addControl(u).addControl(g).addControl(c).addControl(y).addControl(m).addControl(l.size).addControl(l.margins).addControl(C).addControl(o.align).addControl(o.border).addControl(o.borderRadius).addControl(o.color).addControl(o.fontFamily).addControl(o.margins).addControl(o.paddings).addControl(o.text).addControl(o.textSize).addControl(o.textStyleAndFontColor).addControl(o.fitToContent).addStyles(I).withIconsRegistry(k).build();
20
19
  export {
21
- M as default
20
+ j as default
22
21
  };
@@ -2,8 +2,8 @@ import { BlockType as b, BlockAttr as N } from "../../../node_modules/@stripoinc
2
2
  import { ItemsBlockId as O } from "./enums/controlEnums.js";
3
3
  import { productPairs as A, templateFirstLine as C } from "./enums/productEnums.js";
4
4
  import { ItemInCartOptions as Y, SETTINGS_ENUMS as x, DefaultConfigValues as D } from "./enums/settingsEnums.js";
5
- import q from "./layouts/horizontal.html.js";
6
- import j from "./layouts/vertical.html.js";
5
+ import j from "./layouts/horizontal.html.js";
6
+ import q from "./layouts/vertical.html.js";
7
7
  import { escapeReplacement as V } from "./utils/nodeConfigUtils.js";
8
8
  let [g] = A.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [L] = A.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [m] = A.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [S] = A.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [M] = A.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
9
9
  const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), F = (s) => U(s, "text-align"), w = (s, e) => {
@@ -27,6 +27,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
27
27
  target="_blank"
28
28
  href="#!">
29
29
  <img class="adapt-img document-node-component ng-star-inserted"
30
+ style="object-fit: contain;"
30
31
  src="${g}"
31
32
  alt="${L}"
32
33
  width="${i}"
@@ -402,7 +403,7 @@ function Tt({
402
403
  d ? (m = o ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE, S = o ? I.DEFAULT_SINGLE_PRICE_FORMATTED : I.DEFAULT_SINGLE_PRICE) : (m = o ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE, S = o ? I.DEFAULT_PRICE_FORMATTED : I.DEFAULT_PRICE), M = A.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
403
404
  const h = P || (l == null ? void 0 : l.priceOrientation) || "horizontal";
404
405
  return s === x.ORIENTATION.VERTICAL ? z(
405
- j,
406
+ q,
406
407
  e,
407
408
  R,
408
409
  s,
@@ -422,7 +423,7 @@ function Tt({
422
423
  u,
423
424
  d
424
425
  ) : z(
425
- q,
426
+ j,
426
427
  e,
427
428
  R,
428
429
  s,
@@ -1,13 +1,13 @@
1
1
  import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { DefaultConfigValues as o, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
3
- function d() {
3
+ function _() {
4
4
  return String(Date.now() + Math.floor(Math.random() * 1e3));
5
5
  }
6
6
  const E = (r) => r.replace(/\$/g, "$$$$");
7
7
  function S() {
8
8
  return {
9
9
  initialized: !0,
10
- blockInstanceId: d(),
10
+ blockInstanceId: _(),
11
11
  source: n.ITEMS_TYPE.CART_ITEMS,
12
12
  type: n.ITEMS_TYPE.CART_ITEMS,
13
13
  itemsSelectValue: o.cartItemsSelectControlValue,
@@ -33,7 +33,7 @@ function S() {
33
33
  buttonVisible: o.productButtonVisible === "1"
34
34
  };
35
35
  }
36
- function s(r) {
36
+ function p(r) {
37
37
  if (!r)
38
38
  return null;
39
39
  const t = r.closest(".items-block-v2");
@@ -66,16 +66,16 @@ function C(r) {
66
66
  const t = r.querySelector("esd-config-block");
67
67
  if (!t)
68
68
  return null;
69
- const e = (c, a) => c == null ? a : c === "1" || c === "true", i = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), _ = t.getAttribute("data-cart_items_select_control_value"), p = I(_, u);
69
+ const e = (c, s) => c == null ? s : c === "1" || c === "true", i = (c, s) => c || s, u = t.getAttribute("data-type"), a = m(u), d = t.getAttribute("data-cart_items_select_control_value"), l = I(d, a);
70
70
  return {
71
71
  initialized: e(t.getAttribute("data-initialized"), !1),
72
72
  blockInstanceId: i(
73
73
  t.getAttribute("data-block-instance-id"),
74
- d()
74
+ _()
75
75
  ),
76
- source: u,
77
- type: u,
78
- itemsSelectValue: p,
76
+ source: a,
77
+ type: a,
78
+ itemsSelectValue: l,
79
79
  orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
80
80
  nameTrimming: e(
81
81
  t.getAttribute("data-product_name_control_trim"),
@@ -150,7 +150,7 @@ function C(r) {
150
150
  };
151
151
  }
152
152
  function y(r) {
153
- const t = s(r);
153
+ const t = p(r);
154
154
  if (!t)
155
155
  return null;
156
156
  const e = t.getNodeConfig();
@@ -159,18 +159,18 @@ function y(r) {
159
159
  const i = C(t);
160
160
  return i || null;
161
161
  }
162
- function A(r, t, e) {
163
- const i = s(r);
164
- if (!i)
162
+ function A(r, t, e, i) {
163
+ const u = p(r);
164
+ if (!u)
165
165
  return;
166
- const u = { ...i.getNodeConfig() || {}, ...e };
167
- t.getDocumentModifier().modifyHtml(i).setNodeConfig(u).apply(new b("Update Items block configuration"));
166
+ const d = { ...u.getNodeConfig() || {}, ...e }, l = i ?? t.getDocumentModifier();
167
+ l.modifyHtml(u).setNodeConfig(d), i || l.apply(new b("Update Items block configuration"));
168
168
  }
169
169
  export {
170
170
  E as escapeReplacement,
171
- d as generateBlockInstanceId,
171
+ _ as generateBlockInstanceId,
172
172
  S as getDefaultItemsBlockConfig,
173
173
  y as getItemsBlockConfig,
174
- s as getItemsBlockContainer,
174
+ p as getItemsBlockContainer,
175
175
  A as setItemsBlockConfig
176
176
  };
@@ -1,4 +1,4 @@
1
- const o = { stripo: { version: "2.52.0" } }, s = {
1
+ const o = { stripo: { version: "2.54.0" } }, s = {
2
2
  guido: o
3
3
  };
4
4
  export {
@@ -18,10 +18,11 @@ export declare class ItemsBlockCardCompositionControl extends CommonControl {
18
18
  * If itemsType is not BROWSED_ITEMS, show quantity
19
19
  * If itemsType is BROWSED_ITEMS, hide quantity
20
20
  * and mark it as '0'
21
+ * @param syncOnly - If true, only sync local state and UI without modifying the document
21
22
  */
22
- _handleBrowsedItemsQuantity(): void;
23
- _applyVisibilityStyles(): void;
24
- _updateVisibilityAttribute(elementName: string, isVisible: boolean): void;
23
+ _handleBrowsedItemsQuantity(syncOnly?: boolean): void;
24
+ _applyVisibilityStyles(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
25
+ _updateVisibilityAttribute(elementName: string, isVisible: boolean, modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
25
26
  _listenToFormUpdates(): void;
26
27
  _onProductImageChange(value: boolean): void;
27
28
  _onProductNameChange(value: boolean): void;
@@ -36,6 +37,6 @@ export declare class ItemsBlockCardCompositionControl extends CommonControl {
36
37
  * - When price is hidden, original price cell expands to 100%
37
38
  * - When both are visible, they share 50% each
38
39
  */
39
- _updatePriceCellWidthsForVerticalLayout(): void;
40
+ _updatePriceCellWidthsForVerticalLayout(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
40
41
  _onProductButtonChange(value: boolean): void;
41
42
  }
@@ -16,7 +16,7 @@ export declare class ItemsBlockControl extends CommonControl {
16
16
  _initializeSelectItems(): void;
17
17
  _listenToFormUpdates(): void;
18
18
  _renderTemplate(): void;
19
- _getTemplateData(itemsTypeOverride?: ProductType): {
19
+ _getTemplateData(itemsTypeOverride?: ProductType, itemIdOverride?: string): {
20
20
  imageSrc: string;
21
21
  name: string;
22
22
  price: string;
@@ -24,14 +24,14 @@ export declare class ItemsBlockControl extends CommonControl {
24
24
  quantity: string;
25
25
  button: string;
26
26
  };
27
- _updateImageSrc(imageSrc: string): void;
28
- _updateName(name: string): void;
29
- _updatePrice(price: string): void;
30
- _updateOriginalPrice(originalPrice: string): void;
31
- _updateQuantity(quantity: string, itemsTypeOverride?: ProductType): void;
32
- _reOrderTemplate(): void;
33
- _updateDataTypeAttributes(itemsType: ProductType): void;
34
- _updateDataNumberAttributes(itemId: string): void;
27
+ _updateImageSrc(imageSrc: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
28
+ _updateName(name: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
29
+ _updatePrice(price: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
30
+ _updateOriginalPrice(originalPrice: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
31
+ _updateQuantity(quantity: string, itemsTypeOverride: ProductType | undefined, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
32
+ _reOrderTemplate(modifier?: ReturnType<typeof this.api.getDocumentModifier>): void;
33
+ _updateDataTypeAttributes(itemsType: ProductType, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
34
+ _updateDataNumberAttributes(itemId: string, modifier: ReturnType<typeof this.api.getDocumentModifier>): void;
35
35
  _reFillTemplate(itemsType?: ProductType): void;
36
36
  _recalculateTrimming(): void;
37
37
  private _getParagraphFromBlock;
@@ -66,8 +66,9 @@ export declare function getItemsBlockConfig(currentNode: ImmutableHtmlNode | und
66
66
  * @param currentNode - The current node from the control
67
67
  * @param api - The API object (ControlApi or BlockApi)
68
68
  * @param config - The configuration to set (partial update supported)
69
+ * @param modifier - Optional document modifier for batching updates
69
70
  */
70
- export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>): void;
71
+ export declare function setItemsBlockConfig(currentNode: ImmutableHtmlNode | undefined, api: ControlApi | BlockApi, config: Partial<ItemsBlockConfig>, modifier?: ReturnType<typeof api.getDocumentModifier>): void;
71
72
  /**
72
73
  * Gets the block instance ID from the node config.
73
74
  * @param currentNode - The current node from the control
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.1.0-beta.01eaf27",
3
+ "version": "2.1.0-beta.1d0cd94",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "guido": {
87
87
  "stripo": {
88
- "version": "2.52.0"
88
+ "version": "2.54.0"
89
89
  }
90
90
  }
91
91
  }