@useinsider/guido 3.21.2-beta.4c14c74 → 3.21.2-beta.928b4a8

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 (31) hide show
  1. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  2. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  3. package/dist/extensions/Blocks/Items/controls/button/link.js +17 -14
  4. package/dist/extensions/Blocks/Items/controls/cardComposition.js +17 -14
  5. package/dist/extensions/Blocks/Items/controls/image/link.js +17 -14
  6. package/dist/extensions/Blocks/Items/controls/name/trimming.js +10 -9
  7. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  8. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +13 -12
  9. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -29
  10. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +16 -15
  11. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +26 -25
  12. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +28 -27
  13. package/dist/extensions/Blocks/Items/controls/settingsControl.js +80 -75
  14. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  15. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +7 -7
  16. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  17. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +116 -121
  18. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  19. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  20. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  21. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  22. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  23. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  24. package/dist/extensions/Blocks/common-control.js +55 -62
  25. package/dist/guido.css +1 -1
  26. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +1 -0
  27. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -3
  28. package/dist/src/extensions/Blocks/common-control.d.ts +0 -2
  29. package/dist/src/stores/unsubscribe.d.ts +10 -0
  30. package/dist/stores/unsubscribe.js +28 -24
  31. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
1
  import a from "./UnsubscribePageSelection.vue2.js";
2
2
  /* empty css */
3
3
  import n from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
4
+ var i = function() {
5
5
  var r = this, e = r._self._c, t = r._self._setupProxy;
6
6
  return e(t.WpDrawer, { attrs: { id: "unsubscribe-modal", "description-status": "", size: "large", "footer-button-group-options": t.footerButtonGroupOptions, status: t.unsubscribeStore.pageSelectionDrawerStatus, "title-text": t.trans("newsletter.select-a-template") }, on: { cancelOrBackButtonEvent: t.handleBack, onCloseEvent: t.handleClose, primaryButtonEvent: t.handleSave }, scopedSlots: r._u([{ key: "headerBottomSlot", fn: function() {
7
7
  return [e(t.UnsubscribeBreadcrumb, { staticClass: "px-5 py-3" })];
8
8
  }, proxy: !0 }]) }, [e("div", { staticClass: "d-g templates-wrapper" }, r._l(t.unsubscribeStore.getTemplatesByActiveType, function(s) {
9
9
  return e("div", { key: s.id, staticClass: "template-wrapper", on: { click: function(u) {
10
10
  return t.selectTemplate(s.id);
11
- } } }, [e(t.InContainer, { staticClass: "template-container o-h", class: { selected: t.unsubscribeStore.getSelectedTemplateByActiveType === s.id }, attrs: { border: t.getBorderClass(s.id) } }, [e("div", { staticClass: "w-1 h-1 d-f j-c-c a-i-c" }, [e("img", { staticClass: "w-1 h-1 thumbnail o-h", attrs: { alt: s.name, src: s.thumbnail } })])]), e("div", { staticClass: "mt-1 f-s-1" }, [r._v(" " + r._s(s.name) + " ")])], 1);
11
+ } } }, [e(t.InContainer, { staticClass: "template-container o-h p-r", class: { selected: t.unsubscribeStore.getSelectedTemplateByActiveType === s.id }, attrs: { border: t.getBorderClass(s.id) } }, [e("div", { staticClass: "w-1 h-1 d-f j-c-c a-i-c" }, [e("img", { staticClass: "w-1 h-1 thumbnail o-h", attrs: { alt: s.name, src: s.thumbnail } })]), s.isDefault ? e(t.InChips, { staticClass: "default-chip p-a", attrs: { id: "guido__unsubscribe-default-chip", styles: "stroke", type: "neutral", value: "default", "close-button": !1, interactive: !1, text: t.trans("unsubscription-preference.default") } }) : r._e()], 1), e("div", { staticClass: "mt-1 f-s-1" }, [r._v(" " + r._s(s.name) + " ")])], 1);
12
12
  }), 0)]);
13
- }, i = [], c = /* @__PURE__ */ n(
13
+ }, o = [], c = /* @__PURE__ */ n(
14
14
  a,
15
- o,
16
15
  i,
16
+ o,
17
17
  !1,
18
18
  null,
19
- "91a26acd"
19
+ "6750a053"
20
20
  );
21
21
  const _ = c.exports;
22
22
  export {
@@ -1,16 +1,16 @@
1
1
  import { defineComponent as y, ref as T, computed as a, watch as v } from "vue";
2
2
  import w from "../../wrappers/WpDrawer.vue.js";
3
- import { useToaster as B } from "../../../composables/useToaster.js";
4
- import { useTranslations as C } from "../../../composables/useTranslations.js";
3
+ import { useToaster as C } from "../../../composables/useToaster.js";
4
+ import { useTranslations as B } from "../../../composables/useTranslations.js";
5
5
  import { ToasterTypeOptions as h } from "../../../enums/toaster.js";
6
6
  import { useEditorStore as P } from "../../../stores/editor.js";
7
7
  import { useUnsubscribeStore as U } from "../../../stores/unsubscribe.js";
8
- import { InContainer as _ } from "@useinsider/design-system-vue";
9
- import I from "./UnsubscribeBreadcrumb.vue.js";
10
- const N = /* @__PURE__ */ y({
8
+ import { InContainer as I, InChips as _ } from "@useinsider/design-system-vue";
9
+ import x from "./UnsubscribeBreadcrumb.vue.js";
10
+ const W = /* @__PURE__ */ y({
11
11
  __name: "UnsubscribePageSelection",
12
- setup(x) {
13
- const s = C(), e = U(), r = P(), { showToaster: c } = B(), o = T(!1), i = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), l = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = a(() => ({
12
+ setup(A) {
13
+ const s = B(), e = U(), r = P(), { showToaster: c } = C(), o = T(!1), i = a(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), l = a(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = a(() => ({
14
14
  primaryButton: {
15
15
  styling: "solid",
16
16
  type: "primary",
@@ -63,9 +63,9 @@ const N = /* @__PURE__ */ y({
63
63
  };
64
64
  return v(() => e.pageSelectionDrawerStatus, (t) => {
65
65
  t && e.pageSelectionUpdateStatus && e.fetchTemplates();
66
- }), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: c, isApplying: o, getPrimaryButtonText: i, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleClose: m, handleBack: b, handleSave: f, selectTemplate: g, WpDrawer: w, InContainer: _, UnsubscribeBreadcrumb: I };
66
+ }), { __sfc: !0, trans: s, unsubscribeStore: e, editorStore: r, showToaster: c, isApplying: o, getPrimaryButtonText: i, getCancelOrBackButtonText: l, footerButtonGroupOptions: p, getBorderClass: d, closeModal: n, handleClose: m, handleBack: b, handleSave: f, selectTemplate: g, WpDrawer: w, InChips: _, InContainer: I, UnsubscribeBreadcrumb: x };
67
67
  }
68
68
  });
69
69
  export {
70
- N as default
70
+ W as default
71
71
  };
@@ -1,28 +1,31 @@
1
- import { CommonControl as s } from "../../../common-control.js";
2
- import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
3
- import { getItemsBlockConfig as a } from "../../utils/nodeConfigUtils.js";
4
- const e = r.BUTTON_LINK, n = {
1
+ import { CommonControl as r } from "../../../common-control.js";
2
+ import { ItemsBlockControlId as i } from "../../enums/controlEnums.js";
3
+ import { getItemsBlockConfig as o } from "../../utils/nodeConfigUtils.js";
4
+ const s = i.BUTTON_LINK, n = {
5
5
  LINK: "link"
6
6
  };
7
- class L extends s {
7
+ class m extends r {
8
8
  getId() {
9
- return e;
9
+ return s;
10
10
  }
11
11
  getTemplate() {
12
12
  return `
13
- <div class="container ${e}">
13
+ <div class="container ${s}">
14
14
  ${this._getLink()}
15
15
  </div>
16
16
  `;
17
17
  }
18
18
  onRender() {
19
- this.forgetLastPanelNode();
19
+ const t = o(this.currentNode);
20
+ this.api.updateValues({
21
+ [n.LINK]: (t == null ? void 0 : t.buttonLink) ?? ""
22
+ });
20
23
  }
21
- onTemplateNodeUpdated(o) {
22
- super.onTemplateNodeUpdated(o), this.handleBlockInstanceChange(() => {
23
- const t = a(this.currentNode);
24
+ onTemplateNodeUpdated(t) {
25
+ super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
26
+ const e = o(this.currentNode);
24
27
  this.api.updateValues({
25
- [n.LINK]: (t == null ? void 0 : t.buttonLink) ?? ""
28
+ [n.LINK]: (e == null ? void 0 : e.buttonLink) ?? ""
26
29
  });
27
30
  });
28
31
  }
@@ -41,6 +44,6 @@ class L extends s {
41
44
  }
42
45
  }
43
46
  export {
44
- L as ButtonLinkControl,
45
- e as CONTROL_BLOCK_ID
47
+ m as ButtonLinkControl,
48
+ s as CONTROL_BLOCK_ID
46
49
  };
@@ -1,12 +1,12 @@
1
1
  var I = Object.defineProperty;
2
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 y = (d, a, t) => U(d, typeof a != "symbol" ? a + "" : a, t);
3
+ var p = (d, a, t) => U(d, typeof a != "symbol" ? a + "" : a, t);
4
4
  import { ModificationDescription as c } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as b } from "../../common-control.js";
6
6
  import { ItemsBlockId as r } from "../enums/controlEnums.js";
7
7
  import { SETTINGS_ENUMS as h } from "../enums/settingsEnums.js";
8
8
  import { getItemsBlockConfig as R, setItemsBlockConfig as m } from "../utils/nodeConfigUtils.js";
9
- const N = "ui-elements-items-card-composition-block", i = {
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",
@@ -17,7 +17,7 @@ const N = "ui-elements-items-card-composition-block", i = {
17
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 M extends b {
27
27
  });
28
28
  }
29
29
  getId() {
30
- return N;
30
+ return g;
31
31
  }
32
32
  getTemplate() {
33
33
  return `
@@ -44,7 +44,7 @@ class M extends b {
44
44
  `;
45
45
  }
46
46
  onRender() {
47
- this.forgetLastPanelNode(), this._listenToFormUpdates();
47
+ this._syncVisibilityFromAttributes(), this._handleBrowsedItemsQuantity(), this._initializeToggles(), this._listenToFormUpdates();
48
48
  }
49
49
  onTemplateNodeUpdated(t) {
50
50
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
@@ -61,6 +61,9 @@ class M extends b {
61
61
  </div>
62
62
  `;
63
63
  }
64
+ _initializeToggles() {
65
+ this._updateTogglesFromState();
66
+ }
64
67
  _updateTogglesFromState() {
65
68
  this.api.updateValues({
66
69
  [i.PRODUCT_IMAGE]: this.visibilityState[i.PRODUCT_IMAGE],
@@ -221,21 +224,21 @@ class M extends b {
221
224
  * - When both are visible, they share 50% each
222
225
  */
223
226
  _updatePriceCellWidthsForVerticalLayout(t) {
224
- var O, p;
227
+ var O, y;
225
228
  const e = R(this.currentNode);
226
229
  if (!((e == null ? void 0 : e.orientation) === h.ORIENTATION.VERTICAL))
227
230
  return;
228
- const n = (O = this.currentNode) == null ? void 0 : O.querySelectorAll(".product-price-class"), s = (p = this.currentNode) == null ? void 0 : p.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();
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();
229
232
  if (n && n.length > 0) {
230
- const u = l || !C ? "100%" : "50%";
231
- n.forEach((_) => {
232
- T.modifyHtml(_).setStyle("width", u);
233
+ const _ = l || !C ? "100%" : "50%";
234
+ n.forEach((u) => {
235
+ T.modifyHtml(u).setStyle("width", _);
233
236
  });
234
237
  }
235
238
  if (s && s.length > 0) {
236
- const u = l || !P ? "100%" : "50%";
237
- s.forEach((_) => {
238
- T.modifyHtml(_).setStyle("width", u);
239
+ const _ = l || !P ? "100%" : "50%";
240
+ s.forEach((u) => {
241
+ T.modifyHtml(u).setStyle("width", _);
239
242
  });
240
243
  }
241
244
  t || T.apply(new c("Updated price cell widths for vertical layout"));
@@ -253,6 +256,6 @@ class M extends b {
253
256
  }
254
257
  }
255
258
  export {
256
- N as COMPOSITION_CONTROL_BLOCK_ID,
259
+ g as COMPOSITION_CONTROL_BLOCK_ID,
257
260
  M as ItemsBlockCardCompositionControl
258
261
  };
@@ -1,28 +1,31 @@
1
- import { CommonControl as s } from "../../../common-control.js";
2
- import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
3
- import { getItemsBlockConfig as a } from "../../utils/nodeConfigUtils.js";
4
- const t = r.IMAGE_LINK, n = {
1
+ import { CommonControl as a } from "../../../common-control.js";
2
+ import { ItemsBlockControlId as i } from "../../enums/controlEnums.js";
3
+ import { getItemsBlockConfig as o } from "../../utils/nodeConfigUtils.js";
4
+ const s = i.IMAGE_LINK, n = {
5
5
  LINK: "link"
6
6
  };
7
- class L extends s {
7
+ class p extends a {
8
8
  getId() {
9
- return t;
9
+ return s;
10
10
  }
11
11
  getTemplate() {
12
12
  return `
13
- <div class="container ${t}">
13
+ <div class="container ${s}">
14
14
  ${this._getLink()}
15
15
  </div>
16
16
  `;
17
17
  }
18
18
  onRender() {
19
- this.forgetLastPanelNode();
19
+ const e = o(this.currentNode);
20
+ this.api.updateValues({
21
+ [n.LINK]: (e == null ? void 0 : e.imageLink) ?? ""
22
+ });
20
23
  }
21
- onTemplateNodeUpdated(o) {
22
- super.onTemplateNodeUpdated(o), this.handleBlockInstanceChange(() => {
23
- const e = a(this.currentNode);
24
+ onTemplateNodeUpdated(e) {
25
+ super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
26
+ const t = o(this.currentNode);
24
27
  this.api.updateValues({
25
- [n.LINK]: (e == null ? void 0 : e.imageLink) ?? ""
28
+ [n.LINK]: (t == null ? void 0 : t.imageLink) ?? ""
26
29
  });
27
30
  });
28
31
  }
@@ -41,6 +44,6 @@ class L extends s {
41
44
  }
42
45
  }
43
46
  export {
44
- t as CONTROL_BLOCK_ID,
45
- L as ImageLinkControl
47
+ s as CONTROL_BLOCK_ID,
48
+ p as ImageLinkControl
46
49
  };
@@ -1,9 +1,9 @@
1
- import { ModificationDescription as d, UIElementType as m, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as d, UIElementType as s, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CommonControl as T } from "../../../common-control.js";
3
3
  import { nameMaxWidthFor as h } from "../../constants/cardLayout.js";
4
4
  import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
5
5
  import { findNameTextNode as c } from "../../utils/nameNode.js";
6
- import { getItemsBlockConfig as s, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
6
+ import { getItemsBlockConfig as r, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
7
7
  const I = a.NAME_TRIMMING, n = {
8
8
  TRIMMING: "trimming"
9
9
  };
@@ -19,13 +19,14 @@ class E extends T {
19
19
  `;
20
20
  }
21
21
  onRender() {
22
- this.forgetLastPanelNode(), this.api.onValueChanged(n.TRIMMING, (e) => {
23
- this._onTrimmingChange(e);
22
+ const e = r(this.currentNode);
23
+ this.api.updateValues({ [n.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(n.TRIMMING, (t) => {
24
+ this._onTrimmingChange(t);
24
25
  });
25
26
  }
26
27
  onTemplateNodeUpdated(e) {
27
28
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = s(this.currentNode);
29
+ const t = r(this.currentNode);
29
30
  this.api.updateValues({ [n.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
30
31
  });
31
32
  }
@@ -36,16 +37,16 @@ class E extends T {
36
37
  const t = c(this.currentNode);
37
38
  if (!t)
38
39
  return;
39
- const i = s(this.currentNode), r = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
40
- r ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${r ? "Enabled" : "Disabled"}`));
40
+ const i = r(this.currentNode), m = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
41
+ m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
41
42
  }
42
43
  _getTextTrimming() {
43
44
  return `
44
45
  <div class="display-flex align-items-center justify-content-between">
45
- <${m.LABEL}
46
+ <${s.LABEL}
46
47
  ${p.LABEL.text}="${this.api.translate("Text Trimming")}"
47
48
  >
48
- </${m.LABEL}>
49
+ </${s.LABEL}>
49
50
  ${this._GuToggle(n.TRIMMING)}
50
51
  </div>
51
52
  `;
@@ -1,32 +1,33 @@
1
- import { currencyLocationMaps as m } from "../../../../../enums/extensions/recommendationBlock.js";
2
- import { UEAttr as I, ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { CommonControl as N } from "../../../common-control.js";
1
+ import { currencyLocationMaps as p } from "../../../../../enums/extensions/recommendationBlock.js";
2
+ import { UEAttr as N, ModificationDescription as I } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { CommonControl as L } from "../../../common-control.js";
4
4
  import { ITEMS_CURRENCY_ATTR as T, currencyPositionFromLocation as E } from "../../constants/currency.js";
5
- import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
6
- import { getItemsBlockConfig as u, setItemsBlockConfig as O, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
7
- const b = p.PRICE_CURRENCY_LOCATION, a = {
5
+ import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
6
+ import { getItemsBlockConfig as l, setItemsBlockConfig as O, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
7
+ const b = m.PRICE_CURRENCY_LOCATION, c = {
8
8
  CURRENCY_LOCATION: "currencyLocation"
9
9
  };
10
- class B extends N {
10
+ class Y extends L {
11
11
  getId() {
12
12
  return b;
13
13
  }
14
14
  getTemplate() {
15
15
  return `
16
- <div class="container ${p.PRICE_CURRENCY_LOCATION}">
16
+ <div class="container ${m.PRICE_CURRENCY_LOCATION}">
17
17
  ${this._getCurrencyLocation()}
18
18
  </div>
19
19
  `;
20
20
  }
21
21
  onRender() {
22
- this.forgetLastPanelNode(), this.api.setUIEAttribute(a.CURRENCY_LOCATION, I.SELECTPICKER.items, m), this.api.onValueChanged(a.CURRENCY_LOCATION, (e) => {
23
- this._onCurrencyLocationChange(e);
22
+ const e = l(this.currentNode);
23
+ this.api.setUIEAttribute(c.CURRENCY_LOCATION, N.SELECTPICKER.items, p), this.api.updateValues({ [c.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(c.CURRENCY_LOCATION, (t) => {
24
+ this._onCurrencyLocationChange(t);
24
25
  });
25
26
  }
26
27
  onTemplateNodeUpdated(e) {
27
28
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = u(this.currentNode);
29
- this.api.updateValues({ [a.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
29
+ const t = l(this.currentNode);
30
+ this.api.updateValues({ [c.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
30
31
  });
31
32
  }
32
33
  _onCurrencyLocationChange(e) {
@@ -35,15 +36,15 @@ class B extends N {
35
36
  const t = this._getPriceBlocks();
36
37
  if (!t || t.length === 0)
37
38
  return;
38
- const r = u(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", c = E(n), i = this.api.getDocumentModifier();
39
+ const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "", i = E(n), s = this.api.getDocumentModifier();
39
40
  t.forEach((h) => {
40
- const s = this._getParagraph(h);
41
- if (!s)
41
+ const a = this._getParagraph(h);
42
+ if (!a)
42
43
  return;
43
- const d = s.getInnerHTML().trim() || "", l = s.getInnerText().trim() || "", C = (o == null ? void 0 : o.trim()) || "", g = this._removeCurrencySymbol(l, C), _ = this._detectSymbolInText(l) || C, y = this._buildPriceContent(g, _, n), R = d.replace(l, f(y));
44
- i.modifyHtml(s).setInnerHtml(R).setAttribute(T.POSITION, c);
45
- }), i.apply(new L(
46
- `Updated currency location to ${c}`
44
+ const d = a.getInnerHTML().trim() || "", C = a.getInnerText().trim() || "", u = (o == null ? void 0 : o.trim()) || "", _ = this._removeCurrencySymbol(C, u), g = this._detectSymbolInText(C) || u, R = this._buildPriceContent(_, g, n), y = d.replace(C, f(R));
45
+ s.modifyHtml(a).setInnerHtml(y).setAttribute(T.POSITION, i);
46
+ }), s.apply(new I(
47
+ `Updated currency location to ${i}`
47
48
  ));
48
49
  }
49
50
  _getPriceBlocks() {
@@ -65,8 +66,8 @@ class B extends N {
65
66
  } else {
66
67
  const o = r.match(/([^0-9.,\s]+)/);
67
68
  if (o && o[1]) {
68
- const c = o[1].trim(), i = new RegExp(`\\s*${this._escapeRegex(c)}\\s*`);
69
- n = r.replace(i, "").trim();
69
+ const i = o[1].trim(), s = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
70
+ n = r.replace(s, "").trim();
70
71
  }
71
72
  }
72
73
  return n;
@@ -83,9 +84,9 @@ class B extends N {
83
84
  ${this._GuTwoColumns([
84
85
  this._GuLabel({ text: "Currency Location" }),
85
86
  this._GuSelect({
86
- name: a.CURRENCY_LOCATION,
87
+ name: c.CURRENCY_LOCATION,
87
88
  placeholder: "",
88
- options: m
89
+ options: p
89
90
  })
90
91
  ])}
91
92
  `;
@@ -93,5 +94,5 @@ class B extends N {
93
94
  }
94
95
  export {
95
96
  b as CONTROL_BLOCK_ID,
96
- B as PriceCurrencyLocationControl
97
+ Y as PriceCurrencyLocationControl
97
98
  };
@@ -2,20 +2,20 @@ var R = Object.defineProperty;
2
2
  var N = (s, c, e) => c in s ? R(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
3
3
  var h = (s, c, e) => N(s, typeof c != "symbol" ? c + "" : c, e);
4
4
  import { ModificationDescription as E } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as f } from "../../../common-control.js";
6
- import { ITEMS_CURRENCY_ATTR as B } from "../../constants/currency.js";
5
+ import { CommonControl as B } from "../../../common-control.js";
6
+ import { ITEMS_CURRENCY_ATTR as T } from "../../constants/currency.js";
7
7
  import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
8
- import { getItemsBlockConfig as p, setItemsBlockConfig as T, escapeReplacement as x } from "../../utils/nodeConfigUtils.js";
9
- const I = y.PRICE_CURRENCY_SYMBOL, u = {
8
+ import { getItemsBlockConfig as p, setItemsBlockConfig as Y, escapeReplacement as f } from "../../utils/nodeConfigUtils.js";
9
+ const x = y.PRICE_CURRENCY_SYMBOL, u = {
10
10
  CURRENCY_SYMBOL: "currencySymbol"
11
11
  };
12
- class $ extends f {
12
+ class $ extends B {
13
13
  constructor() {
14
14
  super(...arguments);
15
15
  h(this, "originalPriceContents", /* @__PURE__ */ new Map());
16
16
  }
17
17
  getId() {
18
- return I;
18
+ return x;
19
19
  }
20
20
  getTemplate() {
21
21
  return `
@@ -25,8 +25,9 @@ class $ extends f {
25
25
  `;
26
26
  }
27
27
  onRender() {
28
- this.forgetLastPanelNode(), this.api.onValueChanged(u.CURRENCY_SYMBOL, (e) => {
29
- this._onCurrencySymbolChange(e);
28
+ const e = p(this.currentNode);
29
+ this.api.updateValues({ [u.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(u.CURRENCY_SYMBOL, (t) => {
30
+ this._onCurrencySymbolChange(t);
30
31
  });
31
32
  }
32
33
  onDestroy() {
@@ -42,7 +43,7 @@ class $ extends f {
42
43
  var a;
43
44
  console.debug("Currency symbol changed to: ", e);
44
45
  const t = p(this.currentNode), o = ((a = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : a.trim()) || "";
45
- if (T(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
46
+ if (Y(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
46
47
  return;
47
48
  const r = this._getPriceBlocks();
48
49
  if (!r || r.length === 0)
@@ -52,8 +53,8 @@ class $ extends f {
52
53
  const m = this._getParagraph(d);
53
54
  if (!m)
54
55
  return;
55
- const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, x(S));
56
- i.modifyHtml(m).setInnerHtml(b).setAttribute(B.SYMBOL, n);
56
+ const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
57
+ i.modifyHtml(m).setInnerHtml(b).setAttribute(T.SYMBOL, n);
57
58
  }), i.apply(new E(
58
59
  `Updated currency symbol to ${n || "removed"}`
59
60
  ));
@@ -115,6 +116,6 @@ class $ extends f {
115
116
  }
116
117
  }
117
118
  export {
118
- I as CONTROL_BLOCK_ID,
119
+ x as CONTROL_BLOCK_ID,
119
120
  $ as PriceCurrencySymbolControl
120
121
  };
@@ -1,12 +1,12 @@
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 = {
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 = {
7
7
  FORMATTED_PRICE: "formattedPrice"
8
8
  };
9
- class k extends g {
9
+ class k extends D {
10
10
  getId() {
11
11
  return O;
12
12
  }
@@ -18,52 +18,53 @@ class k extends g {
18
18
  `;
19
19
  }
20
20
  onRender() {
21
- this.forgetLastPanelNode(), this.api.onValueChanged(d.FORMATTED_PRICE, (e) => {
22
- this._onFormattedPriceChange(e);
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);
23
24
  });
24
25
  }
25
26
  onTemplateNodeUpdated(e) {
26
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
27
- const t = p(this.currentNode);
28
- this.api.updateValues({ [d.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
28
+ const t = l(this.currentNode);
29
+ this.api.updateValues({ [a.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
29
30
  });
30
31
  }
31
32
  _onFormattedPriceChange(e) {
32
33
  if (console.debug("Formatted price changed to: ", e), !this.currentNode)
33
34
  return;
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 ? [
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 ? [
35
36
  o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
36
37
  o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
37
38
  ] : [
38
39
  o ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
39
40
  o ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
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);
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);
51
52
  }), s.apply(new C(
52
53
  `Updated price to ${e ? "formatted" : "unformatted"}`
53
54
  ));
54
55
  }
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);
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);
58
59
  }
59
60
  _getFormattedPrice() {
60
61
  return `
61
62
  <div class="display-flex align-items-center justify-content-between">
62
- <${T.LABEL}
63
+ <${_.LABEL}
63
64
  ${L.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
64
65
  >
65
- </${T.LABEL}>
66
- ${this._GuToggle(d.FORMATTED_PRICE)}
66
+ </${_.LABEL}>
67
+ ${this._GuToggle(a.FORMATTED_PRICE)}
67
68
  </div>
68
69
  `;
69
70
  }