@useinsider/guido 2.1.0-beta.01eaf27 → 2.1.0-beta.411f2a9

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,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,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
- 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 = {
3
+ import { ItemsBlockId as T } from "../enums/controlEnums.js";
4
+ import { productPairs as y, templateFirstLine as b } from "../enums/productEnums.js";
5
+ import { SETTINGS_ENUMS as p, 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 h, 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 = h(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) ?? p.ORIENTATION.VERTICAL,
32
+ [m.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? p.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 t = h(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]: (t == null ? void 0 : t.orientation) ?? p.ORIENTATION.VERTICAL,
41
+ [m.ITEMS_TYPE]: (t == null ? void 0 : t.type) ?? p.ITEMS_TYPE.CART_ITEMS,
42
+ [m.ITEM_IDS]: (t == null ? void 0 : t.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 t = this.api.getDocumentModifier();
86
+ O(this.currentNode, this.api, {
85
87
  orientation: e,
86
88
  priceOrientation: "horizontal"
87
- }), this._reOrderTemplate(), setTimeout(() => {
89
+ }, t), t.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];
94
+ const t = p.ITEMS_TYPE[e], r = g[e], i = r == null ? void 0 : r[0];
93
95
  if (!t || !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
99
  source: t,
98
100
  type: t,
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(t, o), this._initializeSelectItems();
105
+ const l = this._getTemplateData(t);
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, t, 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 t = e, r = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
107
111
  O(this.currentNode, this.api, {
108
112
  itemsSelectValue: e,
109
113
  imageLink: r,
110
114
  buttonLink: t
111
- }), this._updateDataNumberAttributes(e), this._reFillTemplate();
115
+ }, i), this._updateDataNumberAttributes(e, i);
116
+ const n = this._getTemplateData();
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 = h(this.currentNode), t = (e == null ? void 0 : e.type) ?? p.ITEMS_TYPE.CART_ITEMS, r = (e == null ? void 0 : e.itemsSelectValue) ?? "";
120
126
  this.api.updateValues({
121
- [l.ITEMS_TYPE]: t
127
+ [m.ITEMS_TYPE]: t
122
128
  });
123
- const i = R[t];
129
+ const i = g[t];
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]: r
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({
151
+ const e = h(this.currentNode), t = (e == null ? void 0 : e.orientation) ?? p.ORIENTATION.VERTICAL, r = (e == null ? void 0 : e.type) ?? p.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({
147
153
  orientation: t,
148
154
  itemsType: r,
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
161
  _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];
157
- 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],
161
- price: u,
162
- originalPrice: p,
163
- quantity: S.PAIRS_FOR_EXTENSION.quantity[r].DEFAULT,
164
- button: S.PAIRS_FOR_EXTENSION.button[r].DEFAULT_LABEL
162
+ const t = h(this.currentNode), r = e ?? (t == null ? void 0 : t.type) ?? p.ITEMS_TYPE.CART_ITEMS, i = (t == null ? void 0 : t.itemsSelectValue) ?? "", n = (t == null ? void 0 : t.priceFormatted) ?? !1, s = (t == null ? void 0 : t.priceSinglePrice) ?? !1, o = g[r].findIndex((d) => d.value === i), l = o > -1 ? o : 0, a = y.PAIRS_FOR_EXTENSION.price[r], c = y.PAIRS_FOR_EXTENSION.originalPrice[r];
163
+ let I, u;
164
+ return s ? (I = n ? a.DEFAULT_SINGLE_PRICE_FORMATTED : a.DEFAULT_SINGLE_PRICE, u = n ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE) : (I = n ? a.DEFAULT_PRICE_FORMATTED : a.DEFAULT_PRICE, u = n ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE), {
165
+ imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[r].DEFAULT[l],
166
+ name: y.PAIRS_FOR_EXTENSION.name[r].DEFAULT[l],
167
+ price: I,
168
+ originalPrice: u,
169
+ quantity: y.PAIRS_FOR_EXTENSION.quantity[r].DEFAULT,
170
+ button: y.PAIRS_FOR_EXTENSION.button[r].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, t) {
174
+ var i;
175
+ const r = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${T.IMAGE}"] img`);
176
+ r && t.modifyHtml(r).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}"]`);
175
- if (!t)
178
+ _updateName(e, t) {
179
+ var s;
180
+ const r = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${T.NAME}"]`);
181
+ if (!r)
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 = r.getInnerText().trim();
184
+ let n = r.getInnerHTML().trim();
185
+ n = n.replace(i, A(e)), t.modifyHtml(r).setInnerHtml(n);
180
186
  }
181
- _updatePrice(e) {
187
+ _updatePrice(e, t) {
182
188
  var o;
183
- const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
184
- `[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)
189
+ const r = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
190
+ `[esd-extension-block-id="${T.PRICE}"]`
191
+ )) || [], i = h(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
192
+ r.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() || "", I = a.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", d = this._removeCurrencySymbol(I, u), _ = this._replacePriceNumber(d, e), E = this._buildPriceContent(_, u, s), S = c.replace(I, A(E));
197
+ t.modifyHtml(a).setInnerHtml(S);
192
198
  });
193
199
  }
194
- _updateOriginalPrice(e) {
200
+ _updateOriginalPrice(e, t) {
195
201
  var o;
196
- const t = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
197
- `[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)
202
+ const r = ((o = this.currentNode) == null ? void 0 : o.querySelectorAll(
203
+ `[esd-extension-block-id="${T.ORIGINAL_PRICE}"]`
204
+ )) || [], i = h(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
205
+ r.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 I = c.getInnerHTML().trim() || "", u = c.getInnerText().trim() || "", d = (n == null ? void 0 : n.trim()) || "", _ = this._removeCurrencySymbol(u, d), E = this._replacePriceNumber(_, e), S = this._buildPriceContent(E, d, s), R = `<s>${I.replace(u, A(S))}</s>`;
213
+ t.modifyHtml(a).setInnerHtml(R);
208
214
  });
209
215
  }
210
- _updateQuantity(e, t) {
216
+ _updateQuantity(e, t, r) {
211
217
  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)
218
+ const i = h(this.currentNode), s = (t ?? (i == null ? void 0 : i.type) ?? p.ITEMS_TYPE.CART_ITEMS) !== p.ITEMS_TYPE.BROWSED_ITEMS, o = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = s && o, a = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${T.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 I = c.getInnerText().trim();
225
+ let u = c.getInnerHTML().trim();
226
+ function d(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 = d(u, I, e), r.modifyHtml(c).setInnerHtml(u), r.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(
233
- `[esd-extension-block-id="${I.PRICE}"]`
234
- )) || [], i = ((C = this.currentNode) == null ? void 0 : C.querySelectorAll(
235
- `[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)
234
+ _reOrderTemplate(e) {
235
+ var _, E, S, C, R, M;
236
+ const t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${T.IMAGE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${T.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
237
+ `[esd-extension-block-id="${T.PRICE}"]`
238
+ )) || [], n = ((C = this.currentNode) == null ? void 0 : C.querySelectorAll(
239
+ `[esd-extension-block-id="${T.ORIGINAL_PRICE}"]`
240
+ )) || [], [s] = i, [o] = n, l = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${T.QUANTITY}"]`), a = (M = this.currentNode) == null ? void 0 : M.querySelector(`[esd-extension-block-id="${T.BUTTON}"]`);
241
+ if (!t || !r || !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 = h(this.currentNode), u = ((c == null ? void 0 : c.orientation) ?? p.ORIENTATION.VERTICAL) === p.ORIENTATION.VERTICAL;
244
+ let d = u ? $ : F;
245
+ setTimeout(() => {
246
+ const H = A(s.getOuterHTML()), f = A(o.getOuterHTML());
247
+ d = d.replace("{-{-TEMPLATE_FIRST_LINE-}-}", u ? b : "").replace("{-{-PRODUCT_IMAGE-}-}", t.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", r.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", H).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", f).replace("{-{-PRODUCT_QUANTITY-}-}", l.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", a.getOuterHTML()), d = d.trim().replace(b, "").slice(0, -5);
248
+ const P = e ?? this.api.getDocumentModifier();
249
+ P.modifyHtml(t.querySelector("img")).setAttribute("width", x.productImageWidth).setAttribute("height", x.productImageWidth), P.modifyHtml(this.currentNode).setInnerHtml(d), e || P.apply(new N("Reordered template"));
244
250
  }, 50);
245
251
  }
246
- _updateDataTypeAttributes(e) {
252
+ _updateDataTypeAttributes(e, t) {
247
253
  if (!this.currentNode)
248
254
  return;
249
- const t = this.currentNode.closest(".ins-product-td"), r = this.api.getDocumentModifier();
250
- 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"));
255
+ const r = this.currentNode.closest(".ins-product-td");
256
+ r && t.modifyHtml(r).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
257
+ const s = n;
258
+ t.modifyHtml(s).setAttribute("data-type", e);
259
+ });
254
260
  }
255
- _updateDataNumberAttributes(e) {
261
+ _updateDataNumberAttributes(e, t) {
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 r = h(this.currentNode), i = (r == null ? void 0 : r.type) ?? p.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 && t.modifyHtml(o).setAttribute("data-number", s), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
277
+ const c = a;
278
+ t.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 t = this._getTemplateData(e), r = this.api.getDocumentModifier();
283
+ this._updateImageSrc(t.imageSrc, r), this._updateName(t.name, r), this._updatePrice(t.price, r), this._updateOriginalPrice(t.originalPrice, r), this._updateQuantity(t.quantity, e, r), r.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="${T.NAME}"]`);
284
290
  if (!e)
285
291
  return;
286
292
  const t = e.querySelector("p > a");
287
293
  if (!t)
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 r = h(this.currentNode), i = (r == null ? void 0 : r.orientation) === p.ORIENTATION.HORIZONTAL, n = (r == null ? void 0 : r.nameTrimming) ?? !0;
296
+ 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 N("Recalculated trimming after orientation change"));
291
297
  }
292
298
  _getParagraphFromBlock(e) {
293
299
  return e.querySelector("p");
@@ -304,8 +310,8 @@ class X extends U {
304
310
  } else {
305
311
  const n = r.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 = r.replace(o, "").trim();
309
315
  }
310
316
  }
311
317
  return i;
@@ -319,6 +325,6 @@ class X extends U {
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 {
@@ -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.411f2a9",
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
  }