@useinsider/guido 2.0.0-beta.bf65edd → 2.0.0-beta.c0d8594

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 (61) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +3 -1
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +57 -61
  5. package/dist/components/organisms/base/Toaster.vue.js +6 -6
  6. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +2 -2
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +6 -6
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  9. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  10. package/dist/components/organisms/header/LeftSlot.vue.js +12 -12
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +6 -6
  12. package/dist/composables/useStripo.js +40 -40
  13. package/dist/config/migrator/index.js +9 -8
  14. package/dist/config/migrator/itemsBlockMigrator.js +283 -0
  15. package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
  16. package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
  17. package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
  18. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
  19. package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
  20. package/dist/extensions/Blocks/Items/block.js +39 -40
  21. package/dist/extensions/Blocks/Items/controls/button/link.js +22 -29
  22. package/dist/extensions/Blocks/Items/controls/cardComposition.js +46 -49
  23. package/dist/extensions/Blocks/Items/controls/image/link.js +23 -30
  24. package/dist/extensions/Blocks/Items/controls/name/trimming.js +13 -15
  25. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +1 -1
  26. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +1 -1
  27. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +15 -17
  28. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -15
  29. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +29 -27
  30. package/dist/extensions/Blocks/Items/controls/settingsControl.js +145 -136
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +2 -2
  32. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +58 -48
  33. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +48 -58
  34. package/dist/extensions/Blocks/Items/settingsPanel.js +4 -4
  35. package/dist/extensions/Blocks/Items/store/items-block.js +2 -2
  36. package/dist/extensions/Blocks/Items/template.js +312 -125
  37. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +172 -0
  38. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +17 -44
  39. package/dist/extensions/Blocks/Recommendation/control.js +1 -1
  40. package/dist/extensions/Blocks/common-control.js +64 -53
  41. package/dist/extensions/Blocks/controlFactories.js +139 -118
  42. package/dist/guido.css +1 -1
  43. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +370 -286
  44. package/dist/package.json.js +1 -1
  45. package/dist/services/stripoApi.js +6 -10
  46. package/dist/src/@types/config/schemas.d.ts +4 -0
  47. package/dist/src/composables/useConfig.d.ts +2 -0
  48. package/dist/src/config/migrator/itemsBlockMigrator.d.ts +6 -0
  49. package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
  50. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
  51. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -2
  53. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -2
  54. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +0 -4
  56. package/dist/src/extensions/Blocks/Items/template.d.ts +20 -1
  57. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +71 -0
  58. package/dist/src/extensions/Blocks/common-control.d.ts +13 -8
  59. package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
  60. package/dist/src/stores/config.d.ts +17 -0
  61. package/package.json +3 -3
@@ -1,14 +1,13 @@
1
- var c = Object.defineProperty;
2
- var I = (a, n, t) => n in a ? c(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var _ = (a, n, t) => I(a, typeof n != "symbol" ? n + "" : n, t);
4
- import { ModificationDescription as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as R } from "../../common-control.js";
1
+ var P = Object.defineProperty;
2
+ var _ = (a, n, t) => n in a ? P(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
+ var d = (a, n, t) => _(a, typeof n != "symbol" ? n + "" : n, t);
4
+ import { ModificationDescription as r } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as u } from "../../common-control.js";
6
6
  import { ItemsBlockId as s } from "../enums/controlEnums.js";
7
- import { configAttributes as C } from "../enums/productEnums.js";
8
- import { SETTINGS_ENUMS as u } from "../enums/settingsEnums.js";
7
+ import { SETTINGS_ENUMS as R } from "../enums/settingsEnums.js";
9
8
  import { useItemsBlockStore as O } from "../store/items-block.js";
10
- import { getConfigBlock as P, attributeToBoolean as U } from "../utils/configBlockUtils.js";
11
- const h = "ui-elements-items-card-composition-block", i = {
9
+ import { getItemsBlockConfig as C, setItemsBlockConfig as h } from "../utils/nodeConfigUtils.js";
10
+ const I = "ui-elements-items-card-composition-block", i = {
12
11
  PRODUCT_IMAGE: "image",
13
12
  PRODUCT_NAME: "name",
14
13
  PRODUCT_QUANTITY: "quantity",
@@ -16,11 +15,11 @@ const h = "ui-elements-items-card-composition-block", i = {
16
15
  PRODUCT_ORIGINAL_PRICE: "originalPrice",
17
16
  PRODUCT_BUTTON: "button"
18
17
  };
19
- class g extends R {
18
+ class N extends u {
20
19
  constructor() {
21
20
  super(...arguments);
22
- _(this, "store", O());
23
- _(this, "visibilityState", {
21
+ d(this, "store", O());
22
+ d(this, "visibilityState", {
24
23
  [i.PRODUCT_IMAGE]: !0,
25
24
  [i.PRODUCT_NAME]: !0,
26
25
  [i.PRODUCT_QUANTITY]: !0,
@@ -30,7 +29,7 @@ class g extends R {
30
29
  });
31
30
  }
32
31
  getId() {
33
- return h;
32
+ return I;
34
33
  }
35
34
  getTemplate() {
36
35
  return `
@@ -83,20 +82,20 @@ class g extends R {
83
82
  });
84
83
  }
85
84
  _syncVisibilityFromAttributes() {
86
- const t = P(this.currentNode);
85
+ const t = C(this.currentNode);
87
86
  if (!t)
88
87
  return;
89
88
  const e = {
90
- [i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
91
- [i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
92
- [i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
93
- [i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
94
- [i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
95
- [i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
89
+ [i.PRODUCT_IMAGE]: "imageVisible",
90
+ [i.PRODUCT_NAME]: "nameVisible",
91
+ [i.PRODUCT_QUANTITY]: "quantityControlEnabled",
92
+ [i.PRODUCT_PRICE]: "priceVisible",
93
+ [i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
94
+ [i.PRODUCT_BUTTON]: "buttonVisible"
96
95
  };
97
- Object.entries(e).forEach(([o, r]) => {
98
- const T = t.getAttribute(C[r]);
99
- this.visibilityState[o] = U(T, !0);
96
+ Object.entries(e).forEach(([o, l]) => {
97
+ const T = t[l];
98
+ this.visibilityState[o] = T !== !1;
100
99
  });
101
100
  }
102
101
  /**
@@ -105,11 +104,10 @@ class g extends R {
105
104
  * and mark it as '0'
106
105
  */
107
106
  _handleBrowsedItemsQuantity() {
108
- var r;
109
- const t = this.store.itemsType !== u.ITEMS_TYPE.BROWSED_ITEMS, e = (r = this.currentNode) == null ? void 0 : r.querySelector("esd-config-block");
107
+ const t = this.store.itemsType !== R.ITEMS_TYPE.BROWSED_ITEMS, e = C(this.currentNode);
110
108
  if (!e)
111
109
  return;
112
- const o = e.getAttribute(C.PRODUCT_QUANTITY_VISIBLE) === "1";
110
+ const o = e.quantityControlEnabled !== !1;
113
111
  this.visibilityState[i.PRODUCT_QUANTITY] = t && o, this.api.setVisibility(`${i.PRODUCT_QUANTITY}Container`, t), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t && o);
114
112
  }
115
113
  _applyVisibilityStyles() {
@@ -122,27 +120,26 @@ class g extends R {
122
120
  [i.PRODUCT_BUTTON]: s.BUTTON
123
121
  };
124
122
  Object.entries(t).forEach(([e, o]) => {
125
- var d;
126
- const r = (d = this.currentNode) == null ? void 0 : d.querySelector(`[esd-extension-block-id="${o}"]`);
127
- if (!r)
123
+ var c;
124
+ const l = (c = this.currentNode) == null ? void 0 : c.querySelector(`[esd-extension-block-id="${o}"]`);
125
+ if (!l)
128
126
  return;
129
127
  const T = this.visibilityState[e];
130
- this.api.getDocumentModifier().modifyHtml(r).setStyle("display", T ? "table-cell" : "none").apply(new l(`Applied ${e} visibility from attributes`));
128
+ this.api.getDocumentModifier().modifyHtml(l).setStyle("display", T ? "table-cell" : "none").apply(new r(`Applied ${e} visibility from attributes`));
131
129
  });
132
130
  }
133
131
  _updateVisibilityAttribute(t, e) {
134
- const o = P(this.currentNode);
135
- if (!o)
136
- return;
137
- const T = {
138
- [i.PRODUCT_IMAGE]: "PRODUCT_IMAGE_VISIBLE",
139
- [i.PRODUCT_NAME]: "PRODUCT_NAME_VISIBLE",
140
- [i.PRODUCT_QUANTITY]: "PRODUCT_QUANTITY_VISIBLE",
141
- [i.PRODUCT_PRICE]: "PRODUCT_PRICE_VISIBLE",
142
- [i.PRODUCT_ORIGINAL_PRICE]: "PRODUCT_ORIGINAL_PRICE_VISIBLE",
143
- [i.PRODUCT_BUTTON]: "PRODUCT_BUTTON_VISIBLE"
132
+ const l = {
133
+ [i.PRODUCT_IMAGE]: "imageVisible",
134
+ [i.PRODUCT_NAME]: "nameVisible",
135
+ [i.PRODUCT_QUANTITY]: "quantityControlEnabled",
136
+ [i.PRODUCT_PRICE]: "priceVisible",
137
+ [i.PRODUCT_ORIGINAL_PRICE]: "originalPriceVisible",
138
+ [i.PRODUCT_BUTTON]: "buttonVisible"
144
139
  }[t];
145
- T && this.api.getDocumentModifier().modifyHtml(o).setAttribute(C[T], e ? "1" : "0").apply(new l(`Updated ${t} visibility attribute`));
140
+ l && h(this.currentNode, this.api, {
141
+ [l]: e
142
+ });
146
143
  }
147
144
  _listenToFormUpdates() {
148
145
  this.api.onValueChanged(i.PRODUCT_IMAGE, (t) => this._onProductImageChange(t)), this.api.onValueChanged(i.PRODUCT_NAME, (t) => this._onProductNameChange(t)), this.api.onValueChanged(i.PRODUCT_QUANTITY, (t) => this._onProductQuantityChange(t)), this.api.onValueChanged(i.PRODUCT_PRICE, (t) => this._onProductPriceChange(t)), this.api.onValueChanged(
@@ -153,41 +150,41 @@ class g extends R {
153
150
  _onProductImageChange(t) {
154
151
  var o;
155
152
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.IMAGE}"]`);
156
- e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
153
+ e && (this.visibilityState[i.PRODUCT_IMAGE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product image visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_IMAGE, t));
157
154
  }
158
155
  _onProductNameChange(t) {
159
156
  var o;
160
157
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.NAME}"]`);
161
- e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
158
+ e && (this.visibilityState[i.PRODUCT_NAME] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product name visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_NAME, t));
162
159
  }
163
160
  _onProductQuantityChange(t) {
164
161
  var o;
165
162
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.QUANTITY}"]`);
166
- e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
163
+ e && (this.visibilityState[i.PRODUCT_QUANTITY] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(
167
164
  `Product quantity visibility changed to ${t ? "visible" : "hidden"}`
168
165
  )), this._updateVisibilityAttribute(i.PRODUCT_QUANTITY, t));
169
166
  }
170
167
  _onProductPriceChange(t) {
171
168
  var o;
172
169
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.PRICE}"]`);
173
- e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t));
170
+ e && (this.visibilityState[i.PRODUCT_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product price visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_PRICE, t));
174
171
  }
175
172
  _onProductOriginalPriceChange(t) {
176
173
  var o;
177
174
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(
178
175
  `[esd-extension-block-id="${s.ORIGINAL_PRICE}"]`
179
176
  );
180
- e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(
177
+ e && (this.visibilityState[i.PRODUCT_ORIGINAL_PRICE] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(
181
178
  `Product original price visibility changed to ${t ? "visible" : "hidden"}`
182
179
  )), this._updateVisibilityAttribute(i.PRODUCT_ORIGINAL_PRICE, t));
183
180
  }
184
181
  _onProductButtonChange(t) {
185
182
  var o;
186
183
  const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${s.BUTTON}"]`);
187
- e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new l(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
184
+ e && (this.visibilityState[i.PRODUCT_BUTTON] = t, this.api.getDocumentModifier().modifyHtml(e).setStyle("display", t ? "table-cell" : "none").apply(new r(`Product button visibility changed to ${t ? "visible" : "hidden"}`)), this._updateVisibilityAttribute(i.PRODUCT_BUTTON, t));
188
185
  }
189
186
  }
190
187
  export {
191
- h as COMPOSITION_CONTROL_BLOCK_ID,
192
- g as ItemsBlockCardCompositionControl
188
+ I as COMPOSITION_CONTROL_BLOCK_ID,
189
+ N as ItemsBlockCardCompositionControl
193
190
  };
@@ -1,59 +1,52 @@
1
- var r = Object.defineProperty;
2
- var a = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var i = (o, t, e) => a(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { CommonControl as m } from "../../../common-control.js";
1
+ var a = Object.defineProperty;
2
+ var m = (t, e, n) => e in t ? a(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var s = (t, e, n) => m(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { CommonControl as l } from "../../../common-control.js";
5
5
  import { ItemsBlockControlId as d } from "../../enums/controlEnums.js";
6
- import { useItemsBlockStore as l } from "../../store/items-block.js";
7
- import { syncImageLinkFromAttributes as h } from "../../utils/syncAttributesFromConfigBlock.js";
8
- import { updateConfigBlockAttributes as p } from "../../utils/updateAttributes.js";
9
- const s = d.IMAGE_LINK, n = {
6
+ import { useItemsBlockStore as L } from "../../store/items-block.js";
7
+ import { getItemsBlockConfig as p } from "../../utils/nodeConfigUtils.js";
8
+ const r = d.IMAGE_LINK, i = {
10
9
  LINK: "link"
11
10
  };
12
- class N extends m {
11
+ class g extends l {
13
12
  constructor() {
14
13
  super(...arguments);
15
- i(this, "store", l());
14
+ s(this, "store", L());
16
15
  }
17
16
  getId() {
18
- return s;
17
+ return r;
19
18
  }
20
19
  getTemplate() {
21
20
  return `
22
- <div class="${s}">
21
+ <div class="container ${r}">
23
22
  ${this._getLink()}
24
23
  </div>
25
24
  `;
26
25
  }
27
26
  onRender() {
28
27
  this.api.updateValues({
29
- [n.LINK]: this.store.imageLink
30
- }), this._listenToFormUpdates();
28
+ [i.LINK]: this.store.imageLink
29
+ });
31
30
  }
32
- onTemplateNodeUpdated(e) {
33
- super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
34
- () => h(this.currentNode),
31
+ onTemplateNodeUpdated(n) {
32
+ super.onTemplateNodeUpdated(n), this.handleBlockInstanceChange(
33
+ () => {
34
+ const o = p(this.currentNode);
35
+ o != null && o.imageLink && this.store.setImageLink(o.imageLink);
36
+ },
35
37
  () => {
36
38
  this.api.updateValues({
37
- [n.LINK]: this.store.imageLink
39
+ [i.LINK]: this.store.imageLink
38
40
  });
39
41
  }
40
42
  );
41
43
  }
42
- _listenToFormUpdates() {
43
- this.api.onValueChanged(
44
- n.LINK,
45
- (e) => this._onLinkChange(e)
46
- );
47
- }
48
- _onLinkChange(e) {
49
- console.debug("Image link changed to: ", e), this.store.setImageLink(e), p(this.currentNode, this.api);
50
- }
51
44
  _getLink() {
52
45
  return `
53
46
  ${this._GuOneColumn([
54
47
  this._GuLabel({ text: "Link" }),
55
48
  this._GuTextInput({
56
- name: n.LINK,
49
+ name: i.LINK,
57
50
  placeholder: "Enter Link",
58
51
  className: "es-100",
59
52
  disabled: !0
@@ -63,6 +56,6 @@ class N extends m {
63
56
  }
64
57
  }
65
58
  export {
66
- s as CONTROL_BLOCK_ID,
67
- N as ImageLinkControl
59
+ r as CONTROL_BLOCK_ID,
60
+ g as ImageLinkControl
68
61
  };
@@ -1,6 +1,6 @@
1
1
  var d = Object.defineProperty;
2
2
  var h = (i, t, e) => t in i ? d(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var n = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
3
+ var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { ModificationDescription as a, UIElementType as l, UEAttr as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as c } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as p } from "../../enums/controlEnums.js";
@@ -11,17 +11,17 @@ import { updateConfigBlockAttributes as u } from "../../utils/updateAttributes.j
11
11
  const y = p.NAME_TRIMMING, o = {
12
12
  TRIMMING: "trimming"
13
13
  };
14
- class _ extends c {
14
+ class v extends c {
15
15
  constructor() {
16
16
  super(...arguments);
17
- n(this, "store", N());
17
+ s(this, "store", N());
18
18
  }
19
19
  getId() {
20
20
  return y;
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${p.NAME_TRIMMING}">
24
+ <div class="container ${p.NAME_TRIMMING}">
25
25
  ${this._getTextTrimming()}
26
26
  </div>
27
27
  `;
@@ -43,8 +43,8 @@ class _ extends c {
43
43
  this.store.setNameTrimming(e), u(this.currentNode, this.api), this.api.updateValues({ [o.TRIMMING]: e }), this._applyTrimmingStyles(e);
44
44
  }
45
45
  _applyTrimmingStyles(e) {
46
- var s;
47
- const r = (s = this.currentNode) == null ? void 0 : s.querySelector("p > a");
46
+ var n;
47
+ const r = (n = this.currentNode) == null ? void 0 : n.querySelector("p > a");
48
48
  if (!r)
49
49
  return;
50
50
  const T = e !== void 0 ? e : this.store.nameTrimming, m = this.store.orientation === I.ORIENTATION.VERTICAL;
@@ -52,19 +52,17 @@ class _ extends c {
52
52
  }
53
53
  _getTextTrimming() {
54
54
  return `
55
- <div class="container">
56
- <div class="display-flex align-items-center justify-content-between">
57
- <${l.LABEL}
58
- ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
59
- >
60
- </${l.LABEL}>
61
- ${this._GuToggle(o.TRIMMING)}
62
- </div>
55
+ <div class="display-flex align-items-center justify-content-between">
56
+ <${l.LABEL}
57
+ ${g.LABEL.text}="${this.api.translate("Text Trimming")}"
58
+ >
59
+ </${l.LABEL}>
60
+ ${this._GuToggle(o.TRIMMING)}
63
61
  </div>
64
62
  `;
65
63
  }
66
64
  }
67
65
  export {
68
66
  y as CONTROL_BLOCK_ID,
69
- _ as NameTrimmingControl
67
+ v as NameTrimmingControl
70
68
  };
@@ -21,7 +21,7 @@ class Y extends T {
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${h.PRICE_CURRENCY_LOCATION}">
24
+ <div class="container ${h.PRICE_CURRENCY_LOCATION}">
25
25
  ${this._getCurrencyLocation()}
26
26
  </div>
27
27
  `;
@@ -21,7 +21,7 @@ class P extends R {
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${h.PRICE_CURRENCY_SYMBOL}">
24
+ <div class="container ${h.PRICE_CURRENCY_SYMBOL}">
25
25
  ${this._getCurrencySymbol()}
26
26
  </div>
27
27
  `;
@@ -3,12 +3,12 @@ var I = (r, e, t) => e in r ? _(r, e, { enumerable: !0, configurable: !0, writab
3
3
  var P = (r, e, t) => I(r, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { ModificationDescription as F, UIElementType as m, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as h } from "../../../common-control.js";
6
- import { ItemsBlockControlId as l, ItemsBlockId as A } from "../../enums/controlEnums.js";
6
+ import { ItemsBlockControlId as p, ItemsBlockId as A } from "../../enums/controlEnums.js";
7
7
  import { productPairs as T } from "../../enums/productEnums.js";
8
8
  import { useItemsBlockStore as u } from "../../store/items-block.js";
9
9
  import { syncFormattedPriceFromAttributes as g } from "../../utils/syncAttributesFromConfigBlock.js";
10
10
  import { updateConfigBlockAttributes as D } from "../../utils/updateAttributes.js";
11
- const f = l.PRICE_FORMATTED_PRICE, n = {
11
+ const f = p.PRICE_FORMATTED_PRICE, s = {
12
12
  FORMATTED_PRICE: "formattedPrice"
13
13
  };
14
14
  class y extends h {
@@ -21,13 +21,13 @@ class y extends h {
21
21
  }
22
22
  getTemplate() {
23
23
  return `
24
- <div class="${l.PRICE_FORMATTED_PRICE}">
24
+ <div class="container ${p.PRICE_FORMATTED_PRICE}">
25
25
  ${this._getFormattedPrice()}
26
26
  </div>
27
27
  `;
28
28
  }
29
29
  onRender() {
30
- this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(n.FORMATTED_PRICE, (t) => {
30
+ this.api.updateValues({ [s.FORMATTED_PRICE]: this.store.formattedPrice }), this.api.onValueChanged(s.FORMATTED_PRICE, (t) => {
31
31
  this._onFormattedPriceChange(t);
32
32
  });
33
33
  }
@@ -35,14 +35,14 @@ class y extends h {
35
35
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
36
36
  () => g(this.currentNode),
37
37
  () => {
38
- this.api.updateValues({ [n.FORMATTED_PRICE]: this.store.formattedPrice });
38
+ this.api.updateValues({ [s.FORMATTED_PRICE]: this.store.formattedPrice });
39
39
  }
40
40
  );
41
41
  }
42
42
  _onFormattedPriceChange(t) {
43
43
  if (console.debug("Formatted price changed to: ", t), this.store.setFormattedPrice(t), D(this.currentNode, this.api), !this.currentNode)
44
44
  return;
45
- const { itemsType: s } = this.store, i = T.PAIRS_FOR_EXTENSION.price[s], o = T.PAIRS_FOR_EXTENSION.originalPrice[s], [c, a] = t ? [i.DEFAULT_PRICE, i.DEFAULT_PRICE_FORMATTED] : [i.DEFAULT_PRICE_FORMATTED, i.DEFAULT_PRICE], [p, R] = t ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE];
45
+ const { itemsType: n } = this.store, i = T.PAIRS_FOR_EXTENSION.price[n], o = T.PAIRS_FOR_EXTENSION.originalPrice[n], [c, a] = t ? [i.DEFAULT_PRICE, i.DEFAULT_PRICE_FORMATTED] : [i.DEFAULT_PRICE_FORMATTED, i.DEFAULT_PRICE], [l, R] = t ? [o.DEFAULT_PRICE, o.DEFAULT_PRICE_FORMATTED] : [o.DEFAULT_PRICE_FORMATTED, o.DEFAULT_PRICE];
46
46
  this._updatePriceBlock(
47
47
  this.currentNode,
48
48
  c,
@@ -50,22 +50,20 @@ class y extends h {
50
50
  "price"
51
51
  );
52
52
  const d = this.currentNode.closest(".items-block"), E = d == null ? void 0 : d.querySelector(`[esd-extension-block-id="${A.ORIGINAL_PRICE}"]`);
53
- E && this._updatePriceBlock(E, p, R, "original price");
53
+ E && this._updatePriceBlock(E, l, R, "original price");
54
54
  }
55
- _updatePriceBlock(t, s, i, o) {
56
- const c = t.getInnerHTML().replace(s, i), a = `Updated ${o} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
55
+ _updatePriceBlock(t, n, i, o) {
56
+ const c = t.getInnerHTML().replace(n, i), a = `Updated ${o} to ${this.store.formattedPrice ? "formatted" : "unformatted"}`;
57
57
  this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(c).apply(new F(a));
58
58
  }
59
59
  _getFormattedPrice() {
60
60
  return `
61
- <div class="container">
62
- <div class="display-flex align-items-center justify-content-between">
63
- <${m.LABEL}
64
- ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
65
- >
66
- </${m.LABEL}>
67
- ${this._GuToggle(n.FORMATTED_PRICE)}
68
- </div>
61
+ <div class="display-flex align-items-center justify-content-between">
62
+ <${m.LABEL}
63
+ ${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
64
+ >
65
+ </${m.LABEL}>
66
+ ${this._GuToggle(s.FORMATTED_PRICE)}
69
67
  </div>
70
68
  `;
71
69
  }
@@ -1,32 +1,32 @@
1
1
  var d = Object.defineProperty;
2
2
  var a = (i, e, t) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
- var o = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { UIElementType as n, UEAttr as c } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as u } from "../../../common-control.js";
3
+ var s = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as n, UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as c } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
7
7
  import { useItemsBlockStore as D } from "../../store/items-block.js";
8
8
  import { syncHideDiscountFromAttributes as p } from "../../utils/syncAttributesFromConfigBlock.js";
9
9
  import { updateConfigBlockAttributes as I } from "../../utils/updateAttributes.js";
10
- const l = r.PRICE_HIDE_DISCOUNT, s = {
10
+ const h = r.PRICE_HIDE_DISCOUNT, o = {
11
11
  HIDE_DISCOUNT: "hideDiscount"
12
12
  };
13
- class N extends u {
13
+ class N extends c {
14
14
  constructor() {
15
15
  super(...arguments);
16
- o(this, "store", D());
16
+ s(this, "store", D());
17
17
  }
18
18
  getId() {
19
- return l;
19
+ return h;
20
20
  }
21
21
  getTemplate() {
22
22
  return `
23
- <div class="${r.PRICE_HIDE_DISCOUNT}">
23
+ <div class="container ${r.PRICE_HIDE_DISCOUNT}">
24
24
  ${this._getHideDiscount()}
25
25
  </div>
26
26
  `;
27
27
  }
28
28
  onRender() {
29
- this.api.updateValues({ [s.HIDE_DISCOUNT]: this.store.hideDiscount }), this.api.onValueChanged(s.HIDE_DISCOUNT, (t) => {
29
+ this.api.updateValues({ [o.HIDE_DISCOUNT]: this.store.hideDiscount }), this.api.onValueChanged(o.HIDE_DISCOUNT, (t) => {
30
30
  this._onHideDiscountChange(t);
31
31
  });
32
32
  }
@@ -34,28 +34,28 @@ class N extends u {
34
34
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
35
35
  () => p(this.currentNode),
36
36
  () => {
37
- this.api.updateValues({ [s.HIDE_DISCOUNT]: this.store.hideDiscount });
37
+ this.api.updateValues({ [o.HIDE_DISCOUNT]: this.store.hideDiscount });
38
38
  }
39
39
  );
40
40
  }
41
41
  _onHideDiscountChange(t) {
42
- this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [s.HIDE_DISCOUNT]: t });
42
+ this.store.setHideDiscount(t), I(this.currentNode, this.api), this.api.updateValues({ [o.HIDE_DISCOUNT]: t });
43
43
  }
44
44
  _getHideDiscount() {
45
45
  return `
46
- <div class="container">
46
+
47
47
  <div class="display-flex align-items-center justify-content-between">
48
48
  <${n.LABEL}
49
- ${c.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
49
+ ${u.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
50
50
  >
51
51
  </${n.LABEL}>
52
- ${this._GuToggle(s.HIDE_DISCOUNT)}
52
+ ${this._GuToggle(o.HIDE_DISCOUNT)}
53
53
  </div>
54
54
  </div>
55
55
  `;
56
56
  }
57
57
  }
58
58
  export {
59
- l as CONTROL_BLOCK_ID,
59
+ h as CONTROL_BLOCK_ID,
60
60
  N as PriceHideDiscountControl
61
61
  };
@@ -1,43 +1,43 @@
1
1
  var I = Object.defineProperty;
2
- var y = (n, o, t) => o in n ? I(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
3
- var m = (n, o, t) => y(n, typeof o != "symbol" ? o + "" : o, t);
4
- import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as E } from "../../../common-control.js";
2
+ var f = (n, o, t) => o in n ? I(n, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[o] = t;
3
+ var m = (n, o, t) => f(n, typeof o != "symbol" ? o + "" : o, t);
4
+ import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as y } from "../../../common-control.js";
6
6
  import { ItemsBlockControlId as O } from "../../enums/controlEnums.js";
7
- import { SETTINGS_ENUMS as N } from "../../enums/settingsEnums.js";
8
- import { useItemsBlockStore as f } from "../../store/items-block.js";
9
- import { syncPriceOrientationFromAttributes as T } from "../../utils/syncAttributesFromConfigBlock.js";
10
- import { updateConfigBlockAttributes as P } from "../../utils/updateAttributes.js";
7
+ import { SETTINGS_ENUMS as E } from "../../enums/settingsEnums.js";
8
+ import { useItemsBlockStore as N } from "../../store/items-block.js";
9
+ import { getItemsBlockConfig as T, setItemsBlockConfig as C } from "../../utils/nodeConfigUtils.js";
11
10
  const _ = O.PRICE_ORIENTATION, p = {
12
11
  PRICE_ORIENTATION: "priceOrientation"
13
- }, C = [
12
+ }, P = [
14
13
  { icon: "vertical-orientation", value: "vertical" },
15
14
  { icon: "horizontal-orientation", value: "horizontal" }
16
15
  ];
17
- class v extends E {
16
+ class H extends y {
18
17
  constructor() {
19
18
  super(...arguments);
20
- m(this, "store", f());
19
+ m(this, "store", N());
21
20
  }
22
21
  getId() {
23
22
  return _;
24
23
  }
25
24
  getTemplate() {
26
25
  return `
27
- <div class="${O.PRICE_ORIENTATION}">
26
+ <div class="container ${O.PRICE_ORIENTATION}">
28
27
  ${this._getPriceOrientation()}
29
28
  </div>
30
29
  `;
31
30
  }
32
31
  onRender() {
33
32
  this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation }), this.api.onValueChanged(p.PRICE_ORIENTATION, (t) => {
34
- this._onPriceOrientationChange(t);
33
+ typeof t == "string" && this._onPriceOrientationChange(t);
35
34
  });
36
35
  }
37
36
  onTemplateNodeUpdated(t) {
38
37
  super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(
39
38
  () => {
40
- T(this.currentNode);
39
+ const i = T(this.currentNode);
40
+ i && this.store.setPriceOrientation(i.priceOrientation || "horizontal");
41
41
  },
42
42
  () => {
43
43
  this.api.updateValues({ [p.PRICE_ORIENTATION]: this.store.priceOrientation });
@@ -45,24 +45,26 @@ class v extends E {
45
45
  );
46
46
  }
47
47
  _onPriceOrientationChange(t) {
48
- if (console.debug("Price orientation changed to: ", t), this.store.setPriceOrientation(t), P(this.currentNode, this.api), !this.currentNode)
48
+ if (this.store.setPriceOrientation(t), C(this.currentNode, this.api, {
49
+ priceOrientation: t
50
+ }), !this.currentNode)
49
51
  return;
50
- const { orientation: i } = this.store, r = i === N.ORIENTATION.VERTICAL, e = t === "horizontal";
52
+ const { orientation: i } = this.store, r = i === E.ORIENTATION.VERTICAL, e = t === "horizontal";
51
53
  r ? this._updateVerticalLayout(e) : this._updateHorizontalLayout(e);
52
54
  }
53
- _updateHorizontalLayout(t) {
55
+ _updateVerticalLayout(t) {
54
56
  var c, l, d, a;
55
57
  const i = ((l = (c = this.currentNode) == null ? void 0 : c.closest(".ins-product-td")) == null ? void 0 : l.querySelectorAll(".product-price-class")) || [], r = ((a = (d = this.currentNode) == null ? void 0 : d.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".product-original-price-class")) || [];
56
58
  if (!i || !r)
57
59
  return;
58
60
  const e = t ? "50%" : "100%", s = this.api.getDocumentModifier();
59
- i.forEach((u) => {
60
- s.modifyHtml(u).setAttribute("width", e).setStyle("width", e);
61
- }), r.forEach((u) => {
62
- s.modifyHtml(u).setAttribute("width", e).setStyle("width", e);
63
- }), s.apply(new h(`Updated original price element width to ${e}`));
61
+ i.forEach((h) => {
62
+ s.modifyHtml(h).setAttribute("width", e).setStyle("width", e);
63
+ }), r.forEach((h) => {
64
+ s.modifyHtml(h).setAttribute("width", e).setStyle("width", e);
65
+ }), s.apply(new u(`Updated original price element width to ${e}`));
64
66
  }
65
- _updateVerticalLayout(t) {
67
+ _updateHorizontalLayout(t) {
66
68
  var s, c, l, d;
67
69
  const i = ((c = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : c.querySelectorAll(".horizontal-price")) || [], r = (d = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : d.querySelector(".vertical-price");
68
70
  if (!i || !r || i.length === 0)
@@ -70,9 +72,9 @@ class v extends E {
70
72
  const e = this.api.getDocumentModifier();
71
73
  t ? (i.forEach((a) => {
72
74
  e.modifyHtml(a).setStyle("display", "table-cell");
73
- }), e.modifyHtml(r).setStyle("display", "none").apply(new h("Hide vertical price element"))) : (i.forEach((a) => {
75
+ }), e.modifyHtml(r).setStyle("display", "none"), e.apply(new u("Show horizontal price orientation"))) : (i.forEach((a) => {
74
76
  e.modifyHtml(a).setStyle("display", "none");
75
- }), e.modifyHtml(r).setStyle("display", "table-cell").apply(new h("Show vertical price element")));
77
+ }), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new u("Show vertical price orientation")));
76
78
  }
77
79
  _getPriceOrientation() {
78
80
  return `
@@ -80,7 +82,7 @@ class v extends E {
80
82
  this._GuLabel({ text: "Price Orientation" }),
81
83
  this._GuRadioButton({
82
84
  name: p.PRICE_ORIENTATION,
83
- buttons: C
85
+ buttons: P
84
86
  })
85
87
  ])}
86
88
  `;
@@ -88,5 +90,5 @@ class v extends E {
88
90
  }
89
91
  export {
90
92
  _ as CONTROL_BLOCK_ID,
91
- v as PriceOrientationControl
93
+ H as PriceOrientationControl
92
94
  };