@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,29 +1,28 @@
1
- var M = Object.defineProperty;
2
- var D = (h, p, e) => p in h ? M(h, p, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[p] = e;
3
- var b = (h, p, e) => D(h, typeof p != "symbol" ? p + "" : p, e);
4
- import { UEAttr as A, ModificationDescription as d } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as x } from "../../common-control.js";
6
- import { ItemsBlockId as l } from "../enums/controlEnums.js";
7
- import { productPairs as T, templateFirstLine as R } from "../enums/productEnums.js";
8
- import { ItemTypeOptions as P, OrientationOptions as L, ItemInCartOptions as N, SETTINGS_ENUMS as S, DefaultConfigValues as H } from "../enums/settingsEnums.js";
1
+ var D = Object.defineProperty;
2
+ var x = (T, p, e) => p in T ? D(T, p, { enumerable: !0, configurable: !0, writable: !0, value: e }) : T[p] = e;
3
+ var b = (T, p, e) => x(T, typeof p != "symbol" ? p + "" : p, e);
4
+ import { UEAttr as R, ModificationDescription as u } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as H } from "../../common-control.js";
6
+ import { ItemsBlockId as m } from "../enums/controlEnums.js";
7
+ import { productPairs as h, templateFirstLine as A } from "../enums/productEnums.js";
8
+ import { ItemTypeOptions as P, OrientationOptions as k, ItemInCartOptions as N, SETTINGS_ENUMS as S, DefaultConfigValues as L } from "../enums/settingsEnums.js";
9
9
  import U from "../layouts/horizontal.html.js";
10
10
  import F from "../layouts/vertical.html.js";
11
- import { useItemsBlockStore as $ } from "../store/items-block.js";
12
- import { getDefaultTemplate as q } from "../template.js";
13
- import { syncCurrencySymbolFromAttributes as k, syncCurrencyLocationFromAttributes as w, syncFormattedPriceFromAttributes as B } from "../utils/syncAttributesFromConfigBlock.js";
14
- import { updateConfigBlockAttributes as f } from "../utils/updateAttributes.js";
15
- const G = "ui-elements-items-block", s = {
11
+ import { useItemsBlockStore as q } from "../store/items-block.js";
12
+ import { getDefaultTemplate as $ } from "../template.js";
13
+ import { getItemsBlockConfig as M, setItemsBlockConfig as f } from "../utils/nodeConfigUtils.js";
14
+ const w = "ui-elements-items-block", o = {
16
15
  ITEMS_TYPE: "itemsType",
17
16
  ORIENTATION: "orientation",
18
17
  ITEM_IDS: "itemIds"
19
18
  };
20
- class te extends x {
19
+ class j extends H {
21
20
  constructor() {
22
21
  super(...arguments);
23
- b(this, "store", $());
22
+ b(this, "store", q());
24
23
  }
25
24
  getId() {
26
- return G;
25
+ return w;
27
26
  }
28
27
  getTemplate() {
29
28
  return `
@@ -36,21 +35,22 @@ class te extends x {
36
35
  }
37
36
  onRender() {
38
37
  this.api.updateValues({
39
- [s.ORIENTATION]: this.store.orientation,
40
- [s.ITEMS_TYPE]: this.store.itemsType,
41
- [s.ITEM_IDS]: this.store.itemIds
38
+ [o.ORIENTATION]: this.store.orientation,
39
+ [o.ITEMS_TYPE]: this.store.itemsType,
40
+ [o.ITEM_IDS]: this.store.itemIds
42
41
  }), this._listenToFormUpdates();
43
42
  }
44
43
  onTemplateNodeUpdated(e) {
45
44
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(
46
45
  () => {
47
- k(this.currentNode), w(this.currentNode), B(this.currentNode);
46
+ const t = M(this.currentNode);
47
+ t && (this.store.setItemsType(t.type), this.store.setItemIds(t.itemsSelectValue), this.store.setOrientation(t.orientation), this.store.setCurrencySymbol(t.priceCurrencySymbol), this.store.setCurrencyLocation(t.priceCurrencyLocation), this.store.setFormattedPrice(t.priceFormatted), this.store.setImageLink(t.imageLink), this.store.setButtonLink(t.buttonLink));
48
48
  },
49
49
  () => {
50
50
  this.api.updateValues({
51
- [s.ORIENTATION]: this.store.orientation,
52
- [s.ITEMS_TYPE]: this.store.itemsType,
53
- [s.ITEM_IDS]: this.store.itemIds
51
+ [o.ORIENTATION]: this.store.orientation,
52
+ [o.ITEMS_TYPE]: this.store.itemsType,
53
+ [o.ITEM_IDS]: this.store.itemIds
54
54
  }), this._initializeSelectItems();
55
55
  }
56
56
  );
@@ -64,7 +64,7 @@ class te extends x {
64
64
  ${this._GuOneColumn([
65
65
  this._GuLabel({ text: "Item Type" }),
66
66
  this._GuSelect({
67
- name: s.ITEMS_TYPE,
67
+ name: o.ITEMS_TYPE,
68
68
  className: "es-100",
69
69
  placeholder: "Select Item Type",
70
70
  options: P
@@ -77,8 +77,8 @@ class te extends x {
77
77
  ${this._GuTwoColumns([
78
78
  this._GuLabel({ text: "Orientation" }),
79
79
  this._GuRadioButton({
80
- name: s.ORIENTATION,
81
- buttons: L
80
+ name: o.ORIENTATION,
81
+ buttons: k
82
82
  })
83
83
  ])}
84
84
  `;
@@ -88,7 +88,7 @@ class te extends x {
88
88
  ${this._GuTwoColumns([
89
89
  this._GuLabel({ text: "Item in Cart" }),
90
90
  this._GuSelect({
91
- name: s.ITEM_IDS,
91
+ name: o.ITEM_IDS,
92
92
  className: "es-100",
93
93
  placeholder: "Select Item In Cart",
94
94
  options: []
@@ -97,172 +97,181 @@ class te extends x {
97
97
  `;
98
98
  }
99
99
  _onOrientationChange(e) {
100
- console.debug("Orientation changed to: ", e), this.store.setOrientation(e), this.store.setPriceOrientation("horizontal"), this.api.updateValues({ [s.ORIENTATION]: e }), f(this.currentNode, this.api), this._reOrderTemplate(), setTimeout(() => {
100
+ this.store.setOrientation(e), this.store.setPriceOrientation("horizontal"), this.api.updateValues({ [o.ORIENTATION]: e }), f(this.currentNode, this.api, {
101
+ orientation: e,
102
+ priceOrientation: "horizontal"
103
+ }), this._reOrderTemplate(), setTimeout(() => {
101
104
  this._recalculateTrimming();
102
105
  }, 50);
103
106
  }
104
107
  _onItemsTypeChange(e) {
105
- const i = S.ITEMS_TYPE[e], t = N[e], r = t == null ? void 0 : t[0];
106
- !i || !r || (this.store.setItemsType(i), this.store.setItemIds(r.value), f(this.currentNode, this.api), this._updateDataTypeAttributes(i), this._initializeSelectItems(), this._reFillTemplate());
108
+ const t = S.ITEMS_TYPE[e], i = N[e], r = i == null ? void 0 : i[0];
109
+ !t || !r || (this.store.setItemsType(t), this.store.setItemIds(r.value), f(this.currentNode, this.api, {
110
+ source: t,
111
+ type: t,
112
+ itemsSelectValue: r.value,
113
+ imageLink: this.store.imageLink,
114
+ buttonLink: this.store.buttonLink
115
+ }), this._updateDataTypeAttributes(t), this._initializeSelectItems(), this._reFillTemplate());
107
116
  }
108
117
  _onItemIdsChange(e) {
109
- console.debug("Item ids changed to: ", e), this.store.setItemIds(e), this.api.updateValues({ [s.ITEM_IDS]: e }), f(this.currentNode, this.api), this._updateDataNumberAttributes(e), this._reFillTemplate();
118
+ this.store.setItemIds(e), this.api.updateValues({ [o.ITEM_IDS]: e }), f(this.currentNode, this.api, {
119
+ itemsSelectValue: e,
120
+ imageLink: this.store.imageLink,
121
+ buttonLink: this.store.buttonLink
122
+ }), this._updateDataNumberAttributes(e), this._reFillTemplate();
110
123
  }
111
124
  _initializeSelectItems() {
112
125
  this.api.setUIEAttribute(
113
- s.ITEMS_TYPE,
114
- A.SELECTPICKER.items,
126
+ o.ITEMS_TYPE,
127
+ R.SELECTPICKER.items,
115
128
  P
116
129
  );
117
- const { itemsType: e, itemIds: i } = this.store;
130
+ const { itemsType: e, itemIds: t } = this.store;
118
131
  this.api.updateValues({
119
- [s.ITEMS_TYPE]: e
132
+ [o.ITEMS_TYPE]: e
120
133
  });
121
- const t = N[e];
134
+ const i = N[e];
122
135
  this.api.setUIEAttribute(
123
- s.ITEM_IDS,
124
- A.SELECTPICKER.items,
125
- t
136
+ o.ITEM_IDS,
137
+ R.SELECTPICKER.items,
138
+ i
126
139
  ), this.api.updateValues({
127
- [s.ITEM_IDS]: i
140
+ [o.ITEM_IDS]: t
128
141
  });
129
142
  }
130
143
  _listenToFormUpdates() {
131
144
  this.api.onValueChanged(
132
- s.ITEMS_TYPE,
145
+ o.ITEMS_TYPE,
133
146
  (e) => this._onItemsTypeChange(e)
134
147
  ), this.api.onValueChanged(
135
- s.ORIENTATION,
148
+ o.ORIENTATION,
136
149
  (e) => this._onOrientationChange(e)
137
150
  ), this.api.onValueChanged(
138
- s.ITEM_IDS,
151
+ o.ITEM_IDS,
139
152
  (e) => this._onItemIdsChange(e)
140
153
  );
141
154
  }
142
155
  _renderTemplate() {
143
156
  const {
144
157
  orientation: e,
145
- itemsType: i,
146
- itemIds: t,
158
+ itemsType: t,
159
+ itemIds: i,
147
160
  currencySymbol: r,
148
161
  currencyLocation: n,
149
- formattedPrice: o
162
+ formattedPrice: s
150
163
  } = this.store;
151
- this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(q({
164
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml($({
152
165
  orientation: e,
153
- itemsType: i,
154
- itemId: t,
166
+ itemsType: t,
167
+ itemId: i,
155
168
  currencySymbol: r,
156
169
  currencyLocation: n,
157
- formattedPrice: o
158
- })).apply(new d("Updated template"));
170
+ formattedPrice: s
171
+ })).apply(new u("Updated template"));
159
172
  }
160
173
  _getTemplateData() {
161
- const { itemsType: e, itemIds: i, formattedPrice: t } = this.store, r = N[e].findIndex((o) => o.value === i), n = r > -1 ? r : 0;
174
+ const { itemsType: e, itemIds: t, formattedPrice: i } = this.store, r = N[e].findIndex((s) => s.value === t), n = r > -1 ? r : 0;
162
175
  return {
163
- imageSrc: T.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
164
- name: T.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
165
- price: t ? T.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : T.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
166
- originalPrice: t ? T.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : T.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
167
- quantity: T.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
168
- button: T.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
176
+ imageSrc: h.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[n],
177
+ name: h.PAIRS_FOR_EXTENSION.name[e].DEFAULT[n],
178
+ price: i ? h.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE_FORMATTED : h.PAIRS_FOR_EXTENSION.price[e].DEFAULT_PRICE,
179
+ originalPrice: i ? h.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE_FORMATTED : h.PAIRS_FOR_EXTENSION.originalPrice[e].DEFAULT_PRICE,
180
+ quantity: h.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT,
181
+ button: h.PAIRS_FOR_EXTENSION.button[e].DEFAULT_LABEL
169
182
  };
170
183
  }
171
184
  _updateImageSrc(e) {
172
- var t;
173
- const i = (t = this.currentNode) == null ? void 0 : t.querySelector(`[esd-extension-block-id="${l.IMAGE}"] img`);
174
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute("src", e).apply(new d("Updated image src"));
185
+ var i;
186
+ const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${m.IMAGE}"] img`);
187
+ t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("src", e).apply(new u("Updated image src"));
175
188
  }
176
189
  _updateName(e) {
177
190
  var n;
178
- const i = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${l.NAME}"]`);
179
- if (!i)
191
+ const t = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
192
+ if (!t)
180
193
  return;
181
- const t = i.getInnerText().trim();
182
- let r = i.getInnerHTML();
183
- r = r.replace(t, e), this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(r).apply(new d("Updated name"));
194
+ const i = t.getInnerText().trim();
195
+ let r = t.getInnerHTML();
196
+ r = r.replace(i, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(r).apply(new u("Updated name"));
184
197
  }
185
198
  _updatePrice(e) {
186
199
  var g;
187
- const i = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${l.PRICE}"]`);
188
- if (!i)
189
- return;
190
- const t = this._getParagraphFromBlock(i);
200
+ const t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.PRICE}"]`);
191
201
  if (!t)
192
202
  return;
193
- const r = t.getInnerHTML() || "", n = t.getInnerText() || "", { currencySymbol: o, currencyLocation: a } = this.store, c = (o == null ? void 0 : o.trim()) || "", m = this._removeCurrencySymbol(n, c), u = this._replacePriceNumber(m, e), I = this._buildPriceContent(u, c, a), _ = r.replace(n, I);
194
- this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(_).apply(new d("Updated price"));
203
+ const i = this._getParagraphFromBlock(t);
204
+ if (!i)
205
+ return;
206
+ const r = i.getInnerHTML() || "", n = i.getInnerText() || "", { currencySymbol: s, currencyLocation: c } = this.store, a = (s == null ? void 0 : s.trim()) || "", l = this._removeCurrencySymbol(n, a), d = this._replacePriceNumber(l, e), I = this._buildPriceContent(d, a, c), _ = r.replace(n, I);
207
+ this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(_).apply(new u("Updated price"));
195
208
  }
196
209
  _updateOriginalPrice(e) {
197
210
  var y;
198
- const i = (y = this.currentNode) == null ? void 0 : y.querySelector(
199
- `[esd-extension-block-id="${l.ORIGINAL_PRICE}"]`
211
+ const t = (y = this.currentNode) == null ? void 0 : y.querySelector(
212
+ `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
200
213
  );
201
- if (!i)
202
- return;
203
- const t = this._getParagraphFromBlock(i);
204
214
  if (!t)
205
215
  return;
206
- const r = t.querySelector("s");
216
+ const i = this._getParagraphFromBlock(t);
217
+ if (!i)
218
+ return;
219
+ const r = i.querySelector("s");
207
220
  if (!r)
208
221
  return;
209
- const n = r.getInnerHTML() || "", o = r.getInnerText() || "", { currencySymbol: a, currencyLocation: c } = this.store, m = (a == null ? void 0 : a.trim()) || "", u = this._removeCurrencySymbol(o, m), I = this._replacePriceNumber(u, e), _ = this._buildPriceContent(I, m, c), E = `<s>${n.replace(o, _)}</s>`;
210
- this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(E).apply(new d("Updated original price"));
222
+ const n = r.getInnerHTML() || "", s = r.getInnerText() || "", { currencySymbol: c, currencyLocation: a } = this.store, l = (c == null ? void 0 : c.trim()) || "", d = this._removeCurrencySymbol(s, l), I = this._replacePriceNumber(d, e), _ = this._buildPriceContent(I, l, a), E = `<s>${n.replace(s, _)}</s>`;
223
+ this.api.getDocumentModifier().modifyHtml(i).setInnerHtml(E).apply(new u("Updated original price"));
211
224
  }
212
225
  _updateQuantity(e) {
213
- var a;
214
- const i = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, t = (a = this.currentNode) == null ? void 0 : a.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`);
215
- if (!t)
226
+ var l;
227
+ const t = this.store.itemsType !== S.ITEMS_TYPE.BROWSED_ITEMS, i = M(this.currentNode), r = (i == null ? void 0 : i.quantityControlEnabled) !== !1, n = t && r, s = (l = this.currentNode) == null ? void 0 : l.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`);
228
+ if (!s)
216
229
  return;
217
- const r = t.getStyle("display") === "none", n = t.getInnerText().trim();
218
- let o = t.getInnerHTML();
219
- o = o.replace(n, e), this.api.getDocumentModifier().modifyHtml(t).setInnerHtml(o).setStyle("display", i && !r ? "table-cell" : "none").apply(new d("Updated quantity"));
230
+ const c = s.getInnerText().trim();
231
+ let a = s.getInnerHTML();
232
+ a = a.replace(c, e), this.api.getDocumentModifier().modifyHtml(s).setInnerHtml(a).setStyle("display", n ? "table-cell" : "none").apply(new u("Updated quantity"));
220
233
  }
221
- /**
222
- * @todo Optimize template reordering for performance.
223
- * @description Reorders the template structure based on current orientation and visibility settings.
224
- */
225
234
  _reOrderTemplate() {
226
235
  var I, _, g, E, y, O, C;
227
- const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${l.IMAGE}"]`), i = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${l.NAME}"]`), t = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${l.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
228
- `[esd-extension-block-id="${l.ORIGINAL_PRICE}"]`
229
- ), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${l.QUANTITY}"]`), o = (O = this.currentNode) == null ? void 0 : O.querySelector(`[esd-extension-block-id="${l.BUTTON}"]`), a = (C = this.currentNode) == null ? void 0 : C.querySelector("esd-config-block");
230
- if (!e || !i || !t || !r || !n || !o || !a)
236
+ const e = (I = this.currentNode) == null ? void 0 : I.querySelector(`[esd-extension-block-id="${m.IMAGE}"]`), t = (_ = this.currentNode) == null ? void 0 : _.querySelector(`[esd-extension-block-id="${m.NAME}"]`), i = (g = this.currentNode) == null ? void 0 : g.querySelector(`[esd-extension-block-id="${m.PRICE}"]`), r = (E = this.currentNode) == null ? void 0 : E.querySelector(
237
+ `[esd-extension-block-id="${m.ORIGINAL_PRICE}"]`
238
+ ), n = (y = this.currentNode) == null ? void 0 : y.querySelector(`[esd-extension-block-id="${m.QUANTITY}"]`), s = (O = this.currentNode) == null ? void 0 : O.querySelector(`[esd-extension-block-id="${m.BUTTON}"]`), c = (C = this.currentNode) == null ? void 0 : C.querySelector("esd-config-block");
239
+ if (!e || !t || !i || !r || !n || !s)
231
240
  return;
232
- const { orientation: c } = this.store, m = c === S.ORIENTATION.VERTICAL;
233
- let u = m ? F : U;
234
- this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", H.productImageWidth).apply(new d("Updated image width")), setTimeout(() => {
235
- u = u.replace("{-{-TEMPLATE_FIRST_LINE-}-}", m ? R : "").replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", i.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", o.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", a.getOuterHTML()), u = u.trim().replace(R, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(u).apply(new d("Reordered template"));
241
+ const { orientation: a } = this.store, l = a === S.ORIENTATION.VERTICAL;
242
+ let d = l ? F : U;
243
+ this.api.getDocumentModifier().modifyHtml(e.querySelector("img")).setAttribute("width", L.productImageWidth).setAttribute("height", L.productImageWidth).apply(new u("Updated image width")), setTimeout(() => {
244
+ d = d.replace("{-{-TEMPLATE_FIRST_LINE-}-}", l ? A : "").replace("{-{-PRODUCT_IMAGE-}-}", e.getOuterHTML()).replace("{-{-PRODUCT_NAME-}-}", t.getOuterHTML()).replaceAll("{-{-PRODUCT_PRICE-}-}", i.getOuterHTML()).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", r.getOuterHTML()).replace("{-{-PRODUCT_QUANTITY-}-}", n.getOuterHTML()).replace("{-{-PRODUCT_BUTTON-}-}", s.getOuterHTML()).replace("{-{-CONFIG_BLOCK-}-}", (c == null ? void 0 : c.getOuterHTML()) || ""), d = d.trim().replace(A, "").slice(0, -5), this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(d).apply(new u("Reordered template"));
236
245
  }, 50);
237
246
  }
238
247
  _updateDataTypeAttributes(e) {
239
248
  if (!this.currentNode)
240
249
  return;
241
- const i = this.currentNode.closest(".ins-product-td"), t = this.api.getDocumentModifier();
242
- i && t.modifyHtml(i).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
243
- const o = n;
244
- t.modifyHtml(o).setAttribute("data-type", e);
245
- }), t.apply(new d("Updated data-type attribute"));
250
+ const t = this.currentNode.closest(".ins-product-td"), i = this.api.getDocumentModifier();
251
+ t && i.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
252
+ const s = n;
253
+ i.modifyHtml(s).setAttribute("data-type", e);
254
+ }), i.apply(new u("Updated data-type attribute"));
246
255
  }
247
256
  _updateDataNumberAttributes(e) {
248
257
  if (!this.currentNode)
249
258
  return;
250
- const { itemsType: i } = this.store, t = N[i].findIndex((c) => c.value === e);
259
+ const { itemsType: t } = this.store, i = N[t].findIndex((a) => a.value === e);
251
260
  let r = "1";
252
- if (t >= 0)
253
- r = String(t + 1);
261
+ if (i >= 0)
262
+ r = String(i + 1);
254
263
  else if (e) {
255
- const c = e.match(/\((\d+)\)/);
256
- if (c) {
257
- const [, m] = c;
258
- r = m;
264
+ const a = e.match(/\((\d+)\)/);
265
+ if (a) {
266
+ const [, l] = a;
267
+ r = l;
259
268
  }
260
269
  }
261
- const n = this.currentNode.closest(".ins-product-td"), o = this.api.getDocumentModifier();
262
- n && o.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((c) => {
263
- const m = c;
264
- o.modifyHtml(m).setAttribute("data-number", r);
265
- }), o.apply(new d("Updated data-number attribute"));
270
+ const n = this.currentNode.closest(".ins-product-td"), s = this.api.getDocumentModifier();
271
+ n && s.modifyHtml(n).setAttribute("data-number", r), this.currentNode.querySelectorAll("[data-number]").forEach((a) => {
272
+ const l = a;
273
+ s.modifyHtml(l).setAttribute("data-number", r);
274
+ }), s.apply(new u("Updated data-number attribute"));
266
275
  }
267
276
  _reFillTemplate() {
268
277
  const e = this._getTemplateData();
@@ -272,14 +281,14 @@ class te extends x {
272
281
  var n;
273
282
  if (!this.currentNode)
274
283
  return;
275
- const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${l.NAME}"]`);
284
+ const e = (n = this.currentNode) == null ? void 0 : n.querySelector(`[esd-extension-block-id="${m.NAME}"]`);
276
285
  if (!e)
277
286
  return;
278
- const i = e.querySelector("p > a");
279
- if (!i)
287
+ const t = e.querySelector("p > a");
288
+ if (!t)
280
289
  return;
281
- const t = this.store.orientation === S.ORIENTATION.VERTICAL, r = this.store.nameTrimming;
282
- this.api.getDocumentModifier().modifyHtml(i).setStyle("overflow", "hidden").setStyle("white-space", r ? "nowrap" : "normal").setStyle("text-overflow", r ? "ellipsis" : "unset").setStyle("max-width", t ? "130px" : "520px").setStyle("width", t ? "130px" : "520px").apply(new d("Recalculated trimming after orientation change"));
290
+ const i = this.store.orientation === S.ORIENTATION.HORIZONTAL, r = this.store.nameTrimming;
291
+ this.api.getDocumentModifier().modifyHtml(t).setStyle("overflow", "hidden").setStyle("white-space", r ? "nowrap" : "normal").setStyle("text-overflow", r ? "ellipsis" : "unset").setStyle("max-width", i ? "130px" : "520px").setStyle("width", i ? "130px" : "520px").apply(new u("Recalculated trimming after orientation change"));
283
292
  }
284
293
  _getParagraphFromBlock(e) {
285
294
  return e.querySelector("p");
@@ -287,30 +296,30 @@ class te extends x {
287
296
  _escapeRegex(e) {
288
297
  return e.replace(/[-\\^$*+?().|[\]{}]/g, "\\$&");
289
298
  }
290
- _removeCurrencySymbol(e, i) {
291
- const t = e || "";
292
- let r = t;
293
- if (i) {
294
- const n = new RegExp(`\\s*${this._escapeRegex(i)}\\s*`);
295
- r = t.replace(n, "").trim();
299
+ _removeCurrencySymbol(e, t) {
300
+ const i = e || "";
301
+ let r = i;
302
+ if (t) {
303
+ const n = new RegExp(`\\s*${this._escapeRegex(t)}\\s*`);
304
+ r = i.replace(n, "").trim();
296
305
  } else {
297
- const n = t.match(/([^0-9.,\s]+)/);
306
+ const n = i.match(/([^0-9.,\s]+)/);
298
307
  if (n && n[1]) {
299
- const o = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(o)}\\s*`);
300
- r = t.replace(a, "").trim();
308
+ const s = n[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
309
+ r = i.replace(c, "").trim();
301
310
  }
302
311
  }
303
312
  return r;
304
313
  }
305
- _replacePriceNumber(e, i) {
306
- const t = /([0-9][0-9,.]*)/;
307
- return e.replace(t, i).trim();
314
+ _replacePriceNumber(e, t) {
315
+ const i = /([0-9][0-9,.]*)/;
316
+ return e.replace(i, t).trim();
308
317
  }
309
- _buildPriceContent(e, i, t) {
310
- return i ? t === "1" ? `${e}&nbsp;${i}&nbsp;` : `${i}&nbsp;${e}` : e;
318
+ _buildPriceContent(e, t, i) {
319
+ return t ? i === "1" ? `${e}&nbsp;${t}&nbsp;` : `${t}&nbsp;${e}` : e;
311
320
  }
312
321
  }
313
322
  export {
314
- G as CONTROL_BLOCK_ID,
315
- te as ItemsBlockControl
323
+ w as CONTROL_BLOCK_ID,
324
+ j as ItemsBlockControl
316
325
  };
@@ -18,9 +18,9 @@ const e = {
18
18
  ], a = {
19
19
  itemsType: e.ITEMS_TYPE.CART_ITEMS,
20
20
  cartItemsSelectControlValue: "{{Abandoned Cart Item (1) Url}}",
21
- cardOrientationControlValue: e.ORIENTATION.HORIZONTAL,
21
+ cardOrientationControlValue: e.ORIENTATION.VERTICAL,
22
22
  productNameTrimmingControlValue: "1",
23
- productPriceHideDiscountControlValue: "0",
23
+ productPriceHideDiscountControlValue: "1",
24
24
  productPriceFormattedControlValue: "1",
25
25
  productPriceCurrencySymbolControlValue: "USD",
26
26
  productPriceCurrencyLocationControlValue: "0",
@@ -1,55 +1,65 @@
1
1
  const t = `{-{-TEMPLATE_FIRST_LINE-}-}
2
- <table class="es-left ins-product-wrapper" cellspacing="0" cellpadding="0" align="left" width="100%">
2
+ <table class="es-left ins-product-wrapper ins-product-cart" width="100%" cellspacing="0" cellpadding="0">
3
3
  {-{-CONFIG_BLOCK-}-}
4
4
  <tbody>
5
5
  <tr>
6
- <td class="es-p20b es-p10r es-p10l es-m-p20b es-p10t" width="100%" align="center">
7
- <table class="ins-product-cart" width="100%" cellspacing="0" cellpadding="0">
8
- <tr style="vertical-align: top">
9
- <td colspan="2" width="100%" align="center" data-slot-1>
10
- <table width="100%">
11
- <tbody>
12
- {-{-PRODUCT_IMAGE-}-}
13
- </tbody>
14
- </table>
15
- </td>
16
- </tr>
17
- {-{-PRODUCT_NAME-}-}
18
- <tr>
19
- <td width="50%" style=" width: 50%;display: block;float: left;" class="product-price-class">
20
- <table width="100%">
21
- <tbody>
22
- {-{-PRODUCT_PRICE-}-}
23
- </tbody>
24
- </table>
25
- </td>
26
- <td width="50%" style=" width: 50%;display: block;float: left;"
27
- class="product-original-price-class">
28
- <table width="100%">
29
- <tbody>
30
- {-{-PRODUCT_ORIGINAL_PRICE-}-}
31
- </tbody>
32
- </table>
33
- </td>
34
- </tr>
35
- <tr>
36
- <td width="100%" class="product-quantity-class" data-slot-3>
37
- <table width="100%">
38
- <tbody>
39
- {-{-PRODUCT_QUANTITY-}-}
40
- </tbody>
41
- </table>
42
- </td>
43
- </tr>
44
- <tr>
45
- <td width="100%" class="product-button-class" data-slot-6>
46
- <table width="100%">
47
- <tbody>
48
- {-{-PRODUCT_BUTTON-}-}
49
- </tbody>
50
- </table>
51
- </td>
52
- </tr>
6
+ <td style="padding: 16px 9px;">
7
+ <table class="es-left esdev-disable-select" cellspacing="0" cellpadding="0" align="left" width="100%">
8
+ <tbody>
9
+ <tr>
10
+ <td class="product-image-class" data-slot-1>
11
+ {-{-PRODUCT_IMAGE-}-}
12
+ </td>
13
+ <td class="product-name-class" data-slot-2>
14
+ <table>
15
+ <tbody>
16
+ {-{-PRODUCT_NAME-}-}
17
+ </tbody>
18
+ </table>
19
+ </td>
20
+ <td class="product-quantity-class" data-slot-3>
21
+ <table width="100%">
22
+ <tbody>
23
+ {-{-PRODUCT_QUANTITY-}-}
24
+ </tbody>
25
+ </table>
26
+ </td>
27
+ <td class="product-price-class horizontal-price" data-slot-4>
28
+ <table width="100%">
29
+ <tbody>
30
+ {-{-PRODUCT_PRICE-}-}
31
+ </tbody>
32
+ </table>
33
+ </td>
34
+ <td class="product-original-price-class horizontal-price" data-slot-5>
35
+ <table width="100%">
36
+ <tbody>
37
+ {-{-PRODUCT_ORIGINAL_PRICE-}-}
38
+ </tbody>
39
+ </table>
40
+ </td>
41
+ <td class="product-price-container vertical-price" data-slot-4 style="display: none;">
42
+ <table class="product-price-class" width="100%" data-slot-4>
43
+ <tbody>
44
+ {-{-PRODUCT_PRICE-}-}
45
+ </tbody>
46
+ </table>
47
+ <table class="product-original-price-class product-original-price-container"
48
+ width="100%" data-slot-5>
49
+ <tbody>
50
+ {-{-PRODUCT_ORIGINAL_PRICE-}-}
51
+ </tbody>
52
+ </table>
53
+ </td>
54
+ <td class="product-button-class" data-slot-6>
55
+ <table width="100%">
56
+ <tbody>
57
+ {-{-PRODUCT_BUTTON-}-}
58
+ </tbody>
59
+ </table>
60
+ </td>
61
+ </tr>
62
+ </tbody>
53
63
  </table>
54
64
  </td>
55
65
  </tr>