@useinsider/guido 3.21.2-beta.4b0fed7 → 3.21.2-beta.4c14c74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/composables/useSave.js +75 -68
  2. package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
  3. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  4. package/dist/config/migrator/recommendation/compositionMapper.js +49 -56
  5. package/dist/config/migrator/recommendation/extractors.js +29 -68
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +200 -283
  7. package/dist/config/migrator/recommendation/settingsMapper.js +32 -35
  8. package/dist/config/migrator/recommendationMigrator.js +29 -32
  9. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
  10. package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
  11. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
  12. package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
  13. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
  14. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
  15. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
  16. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
  17. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
  18. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
  19. package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
  20. package/dist/extensions/Blocks/Recommendation/block.js +24 -33
  21. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  22. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +7 -7
  23. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  24. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +229 -208
  25. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  26. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  27. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  28. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  29. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  30. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -1
  32. package/dist/extensions/Blocks/common-control.js +62 -55
  33. package/dist/services/templateLibraryApi.js +36 -31
  34. package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
  35. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +1 -3
  36. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -20
  37. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +11 -4
  40. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -3
  41. package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
  42. package/dist/src/utils/templatePreparation.d.ts +2 -1
  43. package/dist/utils/pairProductVariables.js +98 -90
  44. package/dist/utils/templatePreparation.js +30 -30
  45. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
- import { ModificationDescription as C, UIElementType as _, UEAttr as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as D } from "../../../common-control.js";
3
- import { ItemsBlockControlId as R, ItemsBlockId as I } from "../../enums/controlEnums.js";
4
- import { productPairs as p } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as l, setItemsBlockConfig as h, escapeReplacement as g } from "../../utils/nodeConfigUtils.js";
6
- const O = R.PRICE_FORMATTED_PRICE, a = {
1
+ import { ModificationDescription as C, UIElementType as T, UEAttr as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as g } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as R, ItemsBlockId as _ } from "../../enums/controlEnums.js";
4
+ import { productPairs as I } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as p, setItemsBlockConfig as D, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
+ const O = R.PRICE_FORMATTED_PRICE, d = {
7
7
  FORMATTED_PRICE: "formattedPrice"
8
8
  };
9
- class k extends D {
9
+ class k extends g {
10
10
  getId() {
11
11
  return O;
12
12
  }
@@ -18,53 +18,52 @@ class k extends D {
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = l(this.currentNode);
22
- this.api.updateValues({ [a.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 }), this.api.onValueChanged(a.FORMATTED_PRICE, (t) => {
23
- this._onFormattedPriceChange(t);
21
+ this.forgetLastPanelNode(), this.api.onValueChanged(d.FORMATTED_PRICE, (e) => {
22
+ this._onFormattedPriceChange(e);
24
23
  });
25
24
  }
26
25
  onTemplateNodeUpdated(e) {
27
26
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = l(this.currentNode);
29
- this.api.updateValues({ [a.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
27
+ const t = p(this.currentNode);
28
+ this.api.updateValues({ [d.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
30
29
  });
31
30
  }
32
31
  _onFormattedPriceChange(e) {
33
32
  if (console.debug("Formatted price changed to: ", e), !this.currentNode)
34
33
  return;
35
- const t = l(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = p.PAIRS_FOR_EXTENSION.price[n], i = p.PAIRS_FOR_EXTENSION.originalPrice[n], [E, m] = e ? [
34
+ const t = p(this.currentNode), c = (t == null ? void 0 : t.type) ?? "CART_ITEMS", o = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[c], i = I.PAIRS_FOR_EXTENSION.originalPrice[c], [a, m] = e ? [
36
35
  o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
37
36
  o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
38
37
  ] : [
39
38
  o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
40
39
  o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
41
- ], T = o ? i.DEFAULT_SINGLE_PRICE : i.DEFAULT_PRICE, P = o ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_PRICE_FORMATTED, [F, A] = e ? [T, P] : [P, T], s = this.api.getDocumentModifier();
42
- h(this.currentNode, this.api, { priceFormatted: e }, s);
43
- const c = this.currentNode.closest(".items-block");
44
- ((c == null ? void 0 : c.querySelectorAll(
45
- `[esd-extension-block-id="${I.PRICE}"]`
46
- )) || []).forEach((d) => {
47
- this._updatePriceBlock(s, d, E, m, e);
48
- }), ((c == null ? void 0 : c.querySelectorAll(
49
- `[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
50
- )) || []).forEach((d) => {
51
- this._updatePriceBlock(s, d, F, A, e);
40
+ ], l = o ? i.DEFAULT_SINGLE_PRICE : i.DEFAULT_PRICE, P = o ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_PRICE_FORMATTED, [F, A] = e ? [l, P] : [P, l], s = this.api.getDocumentModifier();
41
+ D(this.currentNode, this.api, { priceFormatted: e }, s);
42
+ const n = this.currentNode.closest(".items-block");
43
+ ((n == null ? void 0 : n.querySelectorAll(
44
+ `[esd-extension-block-id="${_.PRICE}"]`
45
+ )) || []).forEach((E) => {
46
+ this._updatePriceBlock(s, E, a, m, e);
47
+ }), ((n == null ? void 0 : n.querySelectorAll(
48
+ `[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
49
+ )) || []).forEach((E) => {
50
+ this._updatePriceBlock(s, E, F, A, e);
52
51
  }), s.apply(new C(
53
52
  `Updated price to ${e ? "formatted" : "unformatted"}`
54
53
  ));
55
54
  }
56
- _updatePriceBlock(e, t, n, o, r) {
57
- const i = `data-formated="${r ? "true" : "false"}"`, E = t.getInnerHTML().trim().replace(n, g(o)).replace(/data-formated=(?:"[^"]*"|'[^']*')/g, i);
58
- e.modifyHtml(t).setInnerHtml(E);
55
+ _updatePriceBlock(e, t, c, o, r) {
56
+ const i = `data-formated="${r ? "true" : "false"}"`, a = t.getInnerHTML().trim().replace(c, h(o)).replace(/data-formated=(?:"[^"]*"|'[^']*')/g, i);
57
+ e.modifyHtml(t).setInnerHtml(a);
59
58
  }
60
59
  _getFormattedPrice() {
61
60
  return `
62
61
  <div class="display-flex align-items-center justify-content-between">
63
- <${_.LABEL}
62
+ <${T.LABEL}
64
63
  ${L.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
65
64
  >
66
- </${_.LABEL}>
67
- ${this._GuToggle(a.FORMATTED_PRICE)}
65
+ </${T.LABEL}>
66
+ ${this._GuToggle(d.FORMATTED_PRICE)}
68
67
  </div>
69
68
  `;
70
69
  }
@@ -1,30 +1,29 @@
1
- import { ModificationDescription as c, UIElementType as s, UEAttr as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as p } from "../../../common-control.js";
3
- import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
4
- import { getItemsBlockConfig as d, setItemsBlockConfig as u } from "../../utils/nodeConfigUtils.js";
5
- const D = r.PRICE_HIDE_DISCOUNT, i = {
1
+ import { ModificationDescription as r, UIElementType as s, UEAttr as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as a } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
4
+ import { getItemsBlockConfig as p, setItemsBlockConfig as u } from "../../utils/nodeConfigUtils.js";
5
+ const l = d.PRICE_HIDE_DISCOUNT, i = {
6
6
  HIDE_DISCOUNT: "hideDiscount"
7
7
  };
8
- class E extends p {
8
+ class g extends a {
9
9
  getId() {
10
- return D;
10
+ return l;
11
11
  }
12
12
  getTemplate() {
13
13
  return `
14
- <div class="container ${r.PRICE_HIDE_DISCOUNT}">
14
+ <div class="container ${d.PRICE_HIDE_DISCOUNT}">
15
15
  ${this._getHideDiscount()}
16
16
  </div>
17
17
  `;
18
18
  }
19
19
  onRender() {
20
- const t = d(this.currentNode);
21
- this.api.updateValues({ [i.HIDE_DISCOUNT]: (t == null ? void 0 : t.priceHideDiscount) ?? !0 }), this.api.onValueChanged(i.HIDE_DISCOUNT, (e) => {
22
- this._onHideDiscountChange(e);
20
+ this.forgetLastPanelNode(), this.api.onValueChanged(i.HIDE_DISCOUNT, (t) => {
21
+ this._onHideDiscountChange(t);
23
22
  });
24
23
  }
25
24
  onTemplateNodeUpdated(t) {
26
25
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
27
- const e = d(this.currentNode);
26
+ const e = p(this.currentNode);
28
27
  this.api.updateValues({ [i.HIDE_DISCOUNT]: (e == null ? void 0 : e.priceHideDiscount) ?? !0 });
29
28
  });
30
29
  }
@@ -33,13 +32,13 @@ class E extends p {
33
32
  const e = this.api.getDocumentModifier();
34
33
  u(this.currentNode, this.api, { priceHideDiscount: t }, e);
35
34
  const o = (n = this.currentNode) == null ? void 0 : n.closest(".ins-product-td");
36
- o && e.modifyHtml(o).setAttribute("data-nodup", String(t)), e.apply(new c("Update hide-discount setting")), this.api.updateValues({ [i.HIDE_DISCOUNT]: t });
35
+ o && e.modifyHtml(o).setAttribute("data-nodup", String(t)), e.apply(new r("Update hide-discount setting")), this.api.updateValues({ [i.HIDE_DISCOUNT]: t });
37
36
  }
38
37
  _getHideDiscount() {
39
38
  return `
40
39
  <div class="display-flex align-items-center justify-content-between">
41
40
  <${s.LABEL}
42
- ${a.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
41
+ ${c.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
43
42
  >
44
43
  </${s.LABEL}>
45
44
  ${this._GuToggle(i.HIDE_DISCOUNT)}
@@ -49,6 +48,6 @@ class E extends p {
49
48
  }
50
49
  }
51
50
  export {
52
- D as CONTROL_BLOCK_ID,
53
- E as PriceHideDiscountControl
51
+ l as CONTROL_BLOCK_ID,
52
+ g as PriceHideDiscountControl
54
53
  };
@@ -1,17 +1,17 @@
1
- import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CommonControl as O } from "../../../common-control.js";
3
3
  import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
4
- import { SETTINGS_ENUMS as h } from "../../enums/settingsEnums.js";
5
- import { getItemsBlockConfig as u, setItemsBlockConfig as I } from "../../utils/nodeConfigUtils.js";
6
- const N = m.PRICE_ORIENTATION, c = {
4
+ import { SETTINGS_ENUMS as u } from "../../enums/settingsEnums.js";
5
+ import { getItemsBlockConfig as h, setItemsBlockConfig as I } from "../../utils/nodeConfigUtils.js";
6
+ const y = m.PRICE_ORIENTATION, p = {
7
7
  PRICE_ORIENTATION: "priceOrientation"
8
- }, y = [
8
+ }, N = [
9
9
  { icon: "vertical-orientation", value: "vertical" },
10
10
  { icon: "horizontal-orientation", value: "horizontal" }
11
11
  ];
12
12
  class P extends O {
13
13
  getId() {
14
- return N;
14
+ return y;
15
15
  }
16
16
  getTemplate() {
17
17
  return `
@@ -21,15 +21,14 @@ class P extends O {
21
21
  `;
22
22
  }
23
23
  onRender() {
24
- const i = u(this.currentNode);
25
- this.api.updateValues({ [c.PRICE_ORIENTATION]: (i == null ? void 0 : i.priceOrientation) ?? "horizontal" }), this.api.onValueChanged(c.PRICE_ORIENTATION, (t) => {
26
- typeof t == "string" && this._onPriceOrientationChange(t);
24
+ this.forgetLastPanelNode(), this.api.onValueChanged(p.PRICE_ORIENTATION, (i) => {
25
+ typeof i == "string" && this._onPriceOrientationChange(i);
27
26
  });
28
27
  }
29
28
  onTemplateNodeUpdated(i) {
30
29
  super.onTemplateNodeUpdated(i), this.handleBlockInstanceChange(() => {
31
- const t = u(this.currentNode);
32
- this.api.updateValues({ [c.PRICE_ORIENTATION]: (t == null ? void 0 : t.priceOrientation) ?? "horizontal" });
30
+ const t = h(this.currentNode);
31
+ this.api.updateValues({ [p.PRICE_ORIENTATION]: (t == null ? void 0 : t.priceOrientation) ?? "horizontal" });
33
32
  });
34
33
  }
35
34
  _onPriceOrientationChange(i) {
@@ -37,46 +36,46 @@ class P extends O {
37
36
  priceOrientation: i
38
37
  }), !this.currentNode)
39
38
  return;
40
- const t = u(this.currentNode), e = ((t == null ? void 0 : t.orientation) ?? h.ORIENTATION.VERTICAL) === h.ORIENTATION.VERTICAL, o = i === "horizontal";
39
+ const t = h(this.currentNode), e = ((t == null ? void 0 : t.orientation) ?? u.ORIENTATION.VERTICAL) === u.ORIENTATION.VERTICAL, o = i === "horizontal";
41
40
  e ? this._updateVerticalLayout(o) : this._updateHorizontalLayout(o);
42
41
  }
43
42
  _updateVerticalLayout(i) {
44
- var a, s, l, n;
45
- const t = ((s = (a = this.currentNode) == null ? void 0 : a.closest(".ins-product-td")) == null ? void 0 : s.querySelectorAll(".product-price-class")) || [], r = ((n = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : n.querySelectorAll(".product-original-price-class")) || [];
43
+ var a, l, s, n;
44
+ const t = ((l = (a = this.currentNode) == null ? void 0 : a.closest(".ins-product-td")) == null ? void 0 : l.querySelectorAll(".product-price-class")) || [], r = ((n = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : n.querySelectorAll(".product-original-price-class")) || [];
46
45
  if (!t || !r)
47
46
  return;
48
47
  const e = i ? "50%" : "100%", o = this.api.getDocumentModifier();
49
- t.forEach((d) => {
50
- o.modifyHtml(d).setAttribute("width", e).setStyle("width", e);
51
- }), r.forEach((d) => {
52
- o.modifyHtml(d).setAttribute("width", e).setStyle("width", e);
53
- }), o.apply(new p(`Updated original price element width to ${e}`));
48
+ t.forEach((c) => {
49
+ o.modifyHtml(c).setAttribute("width", e).setStyle("width", e);
50
+ }), r.forEach((c) => {
51
+ o.modifyHtml(c).setAttribute("width", e).setStyle("width", e);
52
+ }), o.apply(new d(`Updated original price element width to ${e}`));
54
53
  }
55
54
  _updateHorizontalLayout(i) {
56
- var o, a, s, l;
57
- const t = ((a = (o = this.currentNode) == null ? void 0 : o.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".horizontal-price")) || [], r = (l = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : l.querySelector(".vertical-price");
55
+ var o, a, l, s;
56
+ const t = ((a = (o = this.currentNode) == null ? void 0 : o.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".horizontal-price")) || [], r = (s = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : s.querySelector(".vertical-price");
58
57
  if (!t || !r || t.length === 0)
59
58
  return;
60
59
  const e = this.api.getDocumentModifier();
61
60
  i ? (t.forEach((n) => {
62
61
  e.modifyHtml(n).setStyle("display", "table-cell");
63
- }), e.modifyHtml(r).setStyle("display", "none"), e.apply(new p("Show horizontal price orientation"))) : (t.forEach((n) => {
62
+ }), e.modifyHtml(r).setStyle("display", "none"), e.apply(new d("Show horizontal price orientation"))) : (t.forEach((n) => {
64
63
  e.modifyHtml(n).setStyle("display", "none");
65
- }), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new p("Show vertical price orientation")));
64
+ }), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new d("Show vertical price orientation")));
66
65
  }
67
66
  _getPriceOrientation() {
68
67
  return `
69
68
  ${this._GuTwoColumns([
70
69
  this._GuLabel({ text: "Price Orientation" }),
71
70
  this._GuRadioButton({
72
- name: c.PRICE_ORIENTATION,
73
- buttons: y
71
+ name: p.PRICE_ORIENTATION,
72
+ buttons: N
74
73
  })
75
74
  ])}
76
75
  `;
77
76
  }
78
77
  }
79
78
  export {
80
- N as CONTROL_BLOCK_ID,
79
+ y as CONTROL_BLOCK_ID,
81
80
  P as PriceOrientationControl
82
81
  };
@@ -1,9 +1,9 @@
1
- import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as S, UIElementType as _, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CommonControl as A } from "../../../common-control.js";
3
- import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
4
- import { productPairs as R } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
- const u = T.PRICE_SINGLE_PRICE, l = {
3
+ import { ItemsBlockControlId as T, ItemsBlockId as d } from "../../enums/controlEnums.js";
4
+ import { productPairs as p } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as g, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
+ const u = T.PRICE_SINGLE_PRICE, a = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
9
  class k extends A {
@@ -18,53 +18,52 @@ class k extends A {
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- const e = I(this.currentNode);
22
- this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
23
- this._onSinglePriceChange(i);
21
+ this.forgetLastPanelNode(), this.api.onValueChanged(a.SINGLE_PRICE, (e) => {
22
+ this._onSinglePriceChange(e);
24
23
  });
25
24
  }
26
25
  onTemplateNodeUpdated(e) {
27
26
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const i = I(this.currentNode);
29
- this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
27
+ const t = g(this.currentNode);
28
+ this.api.updateValues({ [a.SINGLE_PRICE]: (t == null ? void 0 : t.priceSinglePrice) ?? !1 });
30
29
  });
31
30
  }
32
31
  _onSinglePriceChange(e) {
33
32
  if (console.debug("Single price changed to: ", e), !this.currentNode)
34
33
  return;
35
- const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
36
- r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
37
- r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
34
+ const t = g(this.currentNode), c = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = p.PAIRS_FOR_EXTENSION.price[c], n = p.PAIRS_FOR_EXTENSION.originalPrice[c], [l, L] = e ? [
35
+ r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
36
+ r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
38
37
  ] : [
39
- r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
40
- r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
41
- ], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
38
+ r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
39
+ r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
40
+ ], I = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, P = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [R, C] = e ? [I, P] : [P, I], s = this.api.getDocumentModifier();
42
41
  N(this.currentNode, this.api, { priceSinglePrice: e }, s);
43
42
  const o = this.currentNode.closest(".items-block");
44
43
  ((o == null ? void 0 : o.querySelectorAll(
45
- `[esd-extension-block-id="${p.PRICE}"]`
46
- )) || []).forEach((a) => {
47
- this._updatePriceBlock(s, a, E, g, e);
44
+ `[esd-extension-block-id="${d.PRICE}"]`
45
+ )) || []).forEach((E) => {
46
+ this._updatePriceBlock(s, E, l, L, e);
48
47
  }), ((o == null ? void 0 : o.querySelectorAll(
49
- `[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
50
- )) || []).forEach((a) => {
51
- this._updatePriceBlock(s, a, L, C, e);
48
+ `[esd-extension-block-id="${d.ORIGINAL_PRICE}"]`
49
+ )) || []).forEach((E) => {
50
+ this._updatePriceBlock(s, E, R, C, e);
52
51
  }), s.apply(new S(
53
52
  `Updated price to ${e ? "single" : "total"} price`
54
53
  ));
55
54
  }
56
- _updatePriceBlock(e, i, c, r, t) {
57
- const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
58
- e.modifyHtml(i).setInnerHtml(E);
55
+ _updatePriceBlock(e, t, c, r, i) {
56
+ const n = `data-single_price="${i ? "true" : "false"}"`, l = t.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
57
+ e.modifyHtml(t).setInnerHtml(l);
59
58
  }
60
59
  _getSinglePrice() {
61
60
  return `
62
61
  <div class="display-flex align-items-center justify-content-between">
63
- <${d.LABEL}
62
+ <${_.LABEL}
64
63
  ${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
65
64
  >
66
- </${d.LABEL}>
67
- ${this._GuToggle(l.SINGLE_PRICE)}
65
+ </${_.LABEL}>
66
+ ${this._GuToggle(a.SINGLE_PRICE)}
68
67
  </div>
69
68
  `;
70
69
  }