@useinsider/guido 2.0.0-beta.e68b206 → 2.0.0-beta.e980c5b

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.
@@ -3,7 +3,7 @@ import o from "./AmpToggle.vue2.js";
3
3
  import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var s = function() {
5
5
  var r = this, t = r._self._c, e = r._self._setupProxy;
6
- return t("div", [t("div", { staticClass: "d-f a-i-c ml-3" }, [t(e.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": e.segmentList, selected: e.previewStore.emailFormat }, on: { click: e.handleFormatChange } }), e.previewStore.showAMPErrorButton ? t(e.InButtonV2, { staticClass: "ml-2 d-f a-i-c b-c-11 b-c-h-11 t-c-4 t-c-h-4 i-c-4 bor-w-1 bor-s-s bor-c-11 bor-r-2", attrs: { id: "guido__amp-error-button", "left-icon": "line-error-box", type: "danger", "label-text-status": !1 }, on: { click: function(l) {
6
+ return t("div", [t("div", { staticClass: "d-f a-i-c ml-3" }, [t(e.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": e.segmentList, selected: e.previewStore.emailFormat }, on: { click: e.handleFormatChange } }), e.previewStore.showAMPErrorButton ? t(e.InButtonV2, { staticClass: "ml-3 d-f a-i-c b-c-11 b-c-h-11 t-c-4 t-c-h-4 i-c-4 bor-w-1 bor-s-s bor-c-11 bor-r-2", attrs: { id: "guido__amp-error-button", "left-icon": "line-error-box", type: "danger", "label-text-status": !1 }, on: { click: function(l) {
7
7
  return e.previewStore.openErrorModal();
8
8
  } } }) : r._e()], 1)]);
9
9
  }, a = [], i = /* @__PURE__ */ n(
@@ -12,7 +12,7 @@ var s = function() {
12
12
  a,
13
13
  !1,
14
14
  null,
15
- "b5997368"
15
+ "5196584c"
16
16
  );
17
17
  const d = i.exports;
18
18
  export {
@@ -1,7 +1,7 @@
1
1
  import { useToaster as w } from "./useToaster.js";
2
- const S = () => {
3
- const { handleError: l } = w(), s = (t = {}) => new Promise((e, i) => {
4
- const n = { ...{
2
+ const v = () => {
3
+ const { handleError: l } = w(), r = (t = {}) => new Promise((e, a) => {
4
+ const o = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
7
7
  utmSource: "",
@@ -20,29 +20,29 @@ const S = () => {
20
20
  forceAmp: !1,
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
- }, ...t }, m = {
24
- callback: (o, p, d, c, u) => {
25
- o ? i(o) : e({
23
+ }, ...t }, s = {
24
+ callback: (n, p, d, c, u) => {
25
+ n ? a(n) : e({
26
26
  html: p,
27
27
  ampHtml: d,
28
28
  ampErrors: c,
29
29
  displayConditions: u
30
30
  });
31
31
  },
32
- ...n
32
+ ...o
33
33
  };
34
- window.StripoEditorApi.actionsApi.compileEmail(m);
34
+ window.StripoEditorApi.actionsApi.compileEmail(s);
35
35
  });
36
36
  return {
37
- getCompiledEmail: s,
37
+ getCompiledEmail: r,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: i, css: a, width: n, height: r, utmParams: m, syncModulesIds: o }) => t({
40
- html: i,
41
- css: a,
42
- width: n,
43
- height: r,
44
- utmParams: m,
45
- syncModulesIds: o
39
+ const e = ({ html: a, css: i, width: o, height: m, utmParams: s, syncModulesIds: n }) => t({
40
+ html: a,
41
+ css: i,
42
+ width: o,
43
+ height: m,
44
+ utmParams: s,
45
+ syncModulesIds: n
46
46
  });
47
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
48
  }),
@@ -53,15 +53,15 @@ const S = () => {
53
53
  try {
54
54
  const {
55
55
  html: e,
56
- displayConditions: i,
57
- ampHtml: a = "",
58
- ampErrors: n = []
59
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
56
+ displayConditions: a,
57
+ ampHtml: i = "",
58
+ ampErrors: o = []
59
+ } = await r({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
60
  return {
61
61
  html: e,
62
- ampHtml: a,
63
- ampErrors: n,
64
- displayConditions: i
62
+ ampHtml: i,
63
+ ampErrors: o,
64
+ displayConditions: a
65
65
  };
66
66
  } catch (e) {
67
67
  return l(e, "Error loading preview"), {
@@ -73,24 +73,27 @@ const S = () => {
73
73
  }
74
74
  },
75
75
  updateTimerInClonedTemplate: () => new Promise((t) => {
76
- var e, i;
77
- if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
76
+ var e, a;
77
+ if (typeof ((a = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : a.updateTimerInClonedTemplate) != "function") {
78
78
  t(null);
79
79
  return;
80
80
  }
81
81
  try {
82
- window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, n) => {
83
- a ? (l(a, "Failed to update timer in cloned template"), t(null)) : t(n || null);
82
+ window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
83
+ i ? (l(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
84
84
  });
85
- } catch (a) {
86
- l(a, "Failed to call updateTimerInClonedTemplate"), t(null);
85
+ } catch (i) {
86
+ l(i, "Failed to call updateTimerInClonedTemplate"), t(null);
87
87
  }
88
88
  }),
89
89
  updateHtmlAndCss: (t, e) => {
90
90
  window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
91
+ },
92
+ editorSave: () => {
93
+ window.StripoEditorApi.actionsApi.save();
91
94
  }
92
95
  };
93
96
  };
94
97
  export {
95
- S as useActionsApi
98
+ v as useActionsApi
96
99
  };
@@ -1,10 +1,10 @@
1
1
  var L = Object.defineProperty;
2
- var K = (r, t, o) => t in r ? L(r, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[t] = o;
3
- var v = (r, t, o) => K(r, typeof t != "symbol" ? t + "" : t, o);
2
+ var K = (o, t, r) => t in o ? L(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r;
3
+ var R = (o, t, r) => K(o, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { productPairs as B } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
5
  import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as _ } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
6
  import { getDefaultTemplate as U } from "../../extensions/Blocks/Items/template.js";
7
- const q = {
7
+ const w = {
8
8
  img: {
9
9
  pairsKey: "imageSrc",
10
10
  defaultKey: "DEFAULT",
@@ -71,59 +71,57 @@ const q = {
71
71
  isArray: !1
72
72
  }
73
73
  };
74
- function w() {
74
+ function F() {
75
75
  return String(Date.now() + Math.floor(Math.random() * 1e3));
76
76
  }
77
- function F(r) {
78
- return r ? {
77
+ function q(o) {
78
+ return o ? {
79
79
  CartItems: _.ITEMS_TYPE.CART_ITEMS,
80
80
  BrowsedItems: _.ITEMS_TYPE.BROWSED_ITEMS,
81
81
  PurchasedItems: _.ITEMS_TYPE.PURCHASED_ITEMS,
82
82
  CART_ITEMS: _.ITEMS_TYPE.CART_ITEMS,
83
83
  BROWSED_ITEMS: _.ITEMS_TYPE.BROWSED_ITEMS,
84
84
  PURCHASED_ITEMS: _.ITEMS_TYPE.PURCHASED_ITEMS
85
- }[r] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
85
+ }[o] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
86
86
  }
87
- function R(r) {
88
- const t = (e, a) => e == null ? a : e === "1" || e === "true", o = (e, a) => e || a, c = r["data-type"] || r["data-source"], n = F(c);
89
- let i = r["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
87
+ function M(o) {
88
+ const t = (e, a) => e == null ? a : e === "1" || e === "true", r = (e, a) => e || a, c = o["data-type"] || o["data-source"], n = q(c);
89
+ let i = o["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
90
90
  if (i && !i.includes("{{") && /^\d+$/.test(i)) {
91
91
  const e = parseInt(i) - 1, a = E[n];
92
92
  a && a[e] && (i = a[e].value);
93
93
  }
94
94
  return {
95
95
  initialized: !0,
96
- blockInstanceId: o(r["data-block-instance-id"], w()),
96
+ blockInstanceId: r(o["data-block-instance-id"], F()),
97
97
  source: n,
98
98
  type: n,
99
99
  itemsSelectValue: i,
100
- orientation: r["data-card_orientation_control_value"] || _.ORIENTATION.VERTICAL,
101
- nameTrimming: t(r["data-product_name_control_trim"], !0),
102
- nameControlEnabled: t(r["data-product_name_control_enabled"], !0),
103
- priceHideDiscount: t(r["data-product_price_control_nodup"], !0),
104
- priceFormatted: t(r["data-product_price_control_formated"], !0),
105
- priceSinglePrice: t(r["data-product_price_control_single_price"], !1),
106
- priceCurrencySymbol: o(
107
- r["data-product_price_currency_symbol"],
100
+ orientation: o["data-card_orientation_control_value"] || _.ORIENTATION.VERTICAL,
101
+ nameTrimming: t(o["data-product_name_control_trim"], !0),
102
+ priceHideDiscount: t(o["data-product_price_control_nodup"], !0),
103
+ priceFormatted: t(o["data-product_price_control_formated"], !0),
104
+ priceSinglePrice: t(o["data-product_price_control_single_price"], !1),
105
+ priceCurrencySymbol: r(
106
+ o["data-product_price_currency_symbol"],
108
107
  g.productPriceCurrencySymbolControlValue
109
108
  ),
110
- priceCurrencyLocation: o(
111
- r["data-product_price_currency_location"],
109
+ priceCurrencyLocation: r(
110
+ o["data-product_price_currency_location"],
112
111
  g.productPriceCurrencyLocationControlValue
113
112
  ),
114
- priceControlOpened: t(r["data-product_price_control_opened"], !0),
115
- priceOrientation: r["data-product_original_price_control_orientation"] || "horizontal",
116
- quantityControlEnabled: t(r["data-product_quantity_control_enabled"], !0),
117
- buttonLink: o(r["data-product_button_link"], g.productButtonLinkControlValue),
118
- imageLink: o(r["data-product_image_link"], g.productImageLinkControlValue),
119
- buttonLabel: o(r["data-product_button_control_label"], "Buy"),
120
- buttonFullWidth: t(r["data-product_button_control_atw"], !0),
121
- imageVisible: t(r["data-product_image_control_enabled"], !0),
122
- nameVisible: t(r["data-product_name_control_enabled"], !0),
123
- quantityVisible: t(r["data-product_quantity_visible"], !0),
124
- priceVisible: t(r["data-product_price_visible"], !0),
125
- originalPriceVisible: t(r["data-product_original_price_control_enabled"], !0),
126
- buttonVisible: t(r["data-product_button_visible"], !0)
113
+ priceOrientation: o["data-product_original_price_control_orientation"] || "horizontal",
114
+ quantityControlEnabled: t(o["data-product_quantity_control_enabled"], !0),
115
+ buttonLink: r(o["data-product_button_link"], g.productButtonLinkControlValue),
116
+ imageLink: r(o["data-product_image_link"], g.productImageLinkControlValue),
117
+ buttonLabel: r(o["data-product_button_control_label"], "Buy"),
118
+ buttonFullWidth: t(o["data-product_button_control_atw"], !0),
119
+ imageVisible: t(o["data-product_image_control_enabled"], !0),
120
+ nameVisible: t(o["data-product_name_control_enabled"], !0),
121
+ quantityVisible: t(o["data-product_quantity_control_enabled"], !0),
122
+ priceVisible: t(o["data-product_price_control_enabled"], !0),
123
+ originalPriceVisible: t(o["data-product_original_price_control_enabled"], !0),
124
+ buttonVisible: t(o["data-product_button_control_enabled"], !0)
127
125
  };
128
126
  }
129
127
  const x = {
@@ -133,17 +131,17 @@ const x = {
133
131
  };
134
132
  class N {
135
133
  constructor() {
136
- v(this, "parser");
134
+ R(this, "parser");
137
135
  this.parser = new DOMParser();
138
136
  }
139
137
  migrate(t) {
140
138
  try {
141
- let o = this.removeJinjaConditionals(t);
142
- o = this.replaceTemplateVariables(o);
143
- const c = this.parser.parseFromString(o, "text/html"), n = c.querySelectorAll(
139
+ let r = this.removeJinjaConditionals(t);
140
+ r = this.replaceTemplateVariables(r);
141
+ const c = this.parser.parseFromString(r, "text/html"), n = c.querySelectorAll(
144
142
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
145
143
  );
146
- return n.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), o) : (n.forEach((i) => {
144
+ return n.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (n.forEach((i) => {
147
145
  const e = this.extractConfiguration(i), a = U({
148
146
  orientation: e.orientation,
149
147
  itemsType: e.itemsType,
@@ -158,20 +156,20 @@ class N {
158
156
  priceStyles: e.priceStyles,
159
157
  originalPriceStyles: e.originalPriceStyles,
160
158
  quantityStyles: e.quantityStyles,
161
- nodeConfig: R(e.configBlockAttributes)
159
+ nodeConfig: M(e.configBlockAttributes)
162
160
  }), l = this.parser.parseFromString(
163
161
  `<table><tbody><tr>${a}</tr></tbody></table>`,
164
162
  "text/html"
165
163
  ).querySelector("td");
166
164
  if (l && i.parentNode) {
167
- const f = R(e.configBlockAttributes);
165
+ const f = M(e.configBlockAttributes);
168
166
  l.setAttribute("esd-ext-config", JSON.stringify(f));
169
167
  const u = l.querySelector("esd-config-block");
170
168
  u && u.remove(), i.parentNode.replaceChild(l, i);
171
169
  }
172
170
  }), c.documentElement.outerHTML);
173
- } catch (o) {
174
- return console.error("ItemsBlockMigrator failed:", o), t;
171
+ } catch (r) {
172
+ return console.error("ItemsBlockMigrator failed:", r), t;
175
173
  }
176
174
  }
177
175
  /**
@@ -182,13 +180,13 @@ class N {
182
180
  */
183
181
  extractConfiguration(t) {
184
182
  var C, D, P;
185
- const o = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", c = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", n = parseInt(c) - 1, i = E[o], e = ((P = i == null ? void 0 : i[n]) == null ? void 0 : P.value) || i[0].value, a = t.querySelector('[product-attr="price"]'), d = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || "USD", f = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, o), b = s["data-card_orientation_control_value"];
183
+ const r = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", c = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", n = parseInt(c) - 1, i = E[r], e = ((P = i == null ? void 0 : i[n]) == null ? void 0 : P.value) || i[0].value, a = t.querySelector('[product-attr="price"]'), d = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || "USD", f = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r), b = s["data-card_orientation_control_value"];
186
184
  let S;
187
185
  b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
188
- const p = t.querySelector('a[product-attr="name"]'), T = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, M = (a == null ? void 0 : a.getAttribute("style")) || void 0, A = t.querySelector("p.original-price"), h = (A == null ? void 0 : A.getAttribute("style")) || void 0, I = t.querySelector('[product-attr="quantity"]'), k = (I == null ? void 0 : I.getAttribute("style")) || void 0;
186
+ const p = t.querySelector('a[product-attr="name"]'), T = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, h = (a == null ? void 0 : a.getAttribute("style")) || void 0, A = t.querySelector("p.original-price"), k = (A == null ? void 0 : A.getAttribute("style")) || void 0, I = t.querySelector('[product-attr="quantity"]'), v = (I == null ? void 0 : I.getAttribute("style")) || void 0;
189
187
  return {
190
188
  orientation: S,
191
- itemsType: o,
189
+ itemsType: r,
192
190
  itemId: e,
193
191
  currencySymbol: d,
194
192
  currencyLocation: f,
@@ -196,9 +194,9 @@ class N {
196
194
  configBlockAttributes: s,
197
195
  nameStyles: T,
198
196
  buttonStyles: m,
199
- priceStyles: M,
200
- originalPriceStyles: h,
201
- quantityStyles: k
197
+ priceStyles: h,
198
+ originalPriceStyles: k,
199
+ quantityStyles: v
202
200
  };
203
201
  }
204
202
  /**
@@ -207,7 +205,7 @@ class N {
207
205
  * @param block - The block element containing the esd-config-block
208
206
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
209
207
  */
210
- extractConfigBlockAttributes(t, o) {
208
+ extractConfigBlockAttributes(t, r) {
211
209
  const c = t.querySelector("esd-config-block"), n = {};
212
210
  if (!c)
213
211
  return this.getDefaultConfigBlockAttributes();
@@ -216,7 +214,7 @@ class N {
216
214
  }), n["data-cart_items_select_control_value"]) {
217
215
  const e = n["data-cart_items_select_control_value"];
218
216
  if (/^\d+$/.test(e)) {
219
- const a = parseInt(e) - 1, d = E[o];
217
+ const a = parseInt(e) - 1, d = E[r];
220
218
  d && d[a] && (n["data-cart_items_select_control_value"] = d[a].value);
221
219
  }
222
220
  }
@@ -227,7 +225,7 @@ class N {
227
225
  }
228
226
  (!n["data-product_price_currency_symbol"] || n["data-product_price_currency_symbol"].trim() === "") && (n["data-product_price_currency_symbol"] = "USD");
229
227
  const i = { ...this.getDefaultConfigBlockAttributes(), ...n };
230
- return i["data-type"] = o, i["data-source"] = o, i;
228
+ return i["data-type"] = r, i["data-source"] = r, i;
231
229
  }
232
230
  /**
233
231
  * Returns default esd-config-block attributes based on the old template structure
@@ -239,24 +237,19 @@ class N {
239
237
  "data-type": "CART_ITEMS",
240
238
  "data-card_orientation_control_value": "vertical",
241
239
  // Image settings
242
- "data-product_image_control_opened": "false",
243
240
  "data-product_image_control_image-width": "70",
244
241
  "data-product_image_control_image-height": "70",
245
242
  "data-product_image_control_align_button": "true",
246
243
  "data-product_image_control_padding_mobile": "true",
247
244
  "data-product_image_link": "{{Abandoned Cart Item (1) Image}}",
248
- "data-product_image_control_enabled": "1",
245
+ "data-product_image_control_enabled": "true",
249
246
  // Name settings
250
- "data-product_name_control_opened": "false",
251
- "data-product_name_control_enabled": "1",
247
+ "data-product_name_control_enabled": "true",
252
248
  "data-product_name_control_font_font_size": "20",
253
249
  "data-product_name_control_trim": "1",
254
250
  // Quantity settings
255
- "data-product_quantity_control_opened": "true",
256
251
  "data-product_quantity_control_enabled": "true",
257
- "data-product_quantity_visible": "1",
258
252
  // Price settings
259
- "data-product_price_control_opened": "false",
260
253
  "data-product_price_control_font_font_size": "20",
261
254
  "data-product_price_control_color": "#060606",
262
255
  "data-product_price_control_curency": "0",
@@ -265,21 +258,20 @@ class N {
265
258
  "data-product_price_control_formated": "1",
266
259
  "data-product_price_control_nodup": "1",
267
260
  "data-product_price_control_single_price": "false",
268
- "data-product_price_visible": "1",
261
+ "data-product_price_control_enabled": "true",
269
262
  // Original price settings
270
263
  "data-product_original_price_control_font_font_size": "19",
271
264
  "data-product_original_price_control_align_align_desktop": "center",
272
265
  "data-product_original_price_control_orientation": "horizontal",
273
266
  "data-product_original_price_control_enabled": "true",
274
267
  // Button settings
275
- "data-product_button_control_opened": "true",
268
+ "data-product_button_control_enabled": "true",
276
269
  "data-product_button_control_label": "Buy",
277
270
  "data-product_button_control_font_font_size": "17",
278
271
  "data-product_button_control_color": "#ffffff",
279
272
  "data-product_button_control_background": "#010101",
280
273
  "data-product_button_control_atw": "true",
281
- "data-product_button_link": "{{Abandoned Cart Item (1) Url}}",
282
- "data-product_button_visible": "1"
274
+ "data-product_button_link": "{{Abandoned Cart Item (1) Url}}"
283
275
  };
284
276
  }
285
277
  /**
@@ -290,16 +282,16 @@ class N {
290
282
  * - Purchased Items: purchased_item_total_product_kind, purchased_item_price_N, purchased_item_originalprice_N
291
283
  */
292
284
  removeJinjaConditionals(t) {
293
- let o = t.replace(
285
+ let r = t.replace(
294
286
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
295
287
  ""
296
288
  );
297
- return o = o.replace(
289
+ return r = r.replace(
298
290
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
299
291
  ""
300
- ), o = o.replace(/\{%\s*endif\s*%\}/g, ""), o = o.replace(/\n\s*\n\s*\n/g, `
292
+ ), r = r.replace(/\{%\s*endif\s*%\}/g, ""), r = r.replace(/\n\s*\n\s*\n/g, `
301
293
 
302
- `), o;
294
+ `), r;
303
295
  }
304
296
  /**
305
297
  * Replaces template variables with default values from productPairs
@@ -311,7 +303,7 @@ class N {
311
303
  * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
312
304
  */
313
305
  replaceTemplateVariables(t) {
314
- const { PAIRS_FOR_EXTENSION: o } = B;
306
+ const { PAIRS_FOR_EXTENSION: r } = B;
315
307
  return t.replace(/{{([^}]+)}}/g, (c, n) => {
316
308
  const i = n.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
317
309
  if (!i)
@@ -319,10 +311,10 @@ class N {
319
311
  const [, e, a, d] = i, l = x[e];
320
312
  if (!l)
321
313
  return console.warn(`Unknown variable prefix: ${e}`), c;
322
- const f = q[a];
314
+ const f = w[a];
323
315
  if (!f)
324
316
  return console.warn(`Unknown variable suffix mapping for: ${a}`), c;
325
- const { pairsKey: u, defaultKey: s, isArray: b } = f, p = o[u][l];
317
+ const { pairsKey: u, defaultKey: s, isArray: b } = f, p = r[u][l];
326
318
  if (!p)
327
319
  return console.warn(`No data found for: ${u}.${l}`), c;
328
320
  if (b) {
@@ -334,8 +326,8 @@ class N {
334
326
  });
335
327
  }
336
328
  }
337
- function Y(r) {
338
- return new N().migrate(r);
329
+ function Y(o) {
330
+ return new N().migrate(o);
339
331
  }
340
332
  export {
341
333
  Y as migrateItemsBlock
@@ -1,20 +1,19 @@
1
- import { useOnboardingStore as d } from "../../../stores/onboarding.js";
2
- import { Block as u, BlockCompositionType as p, ModificationDescription as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- import { ItemsBlockId as f } from "./enums/controlEnums.js";
1
+ import { useOnboardingStore as m } from "../../../stores/onboarding.js";
2
+ import { Block as u, BlockCompositionType as d, ModificationDescription as i } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
4
3
  import { SETTINGS_ENUMS as c, DefaultConfigValues as o } from "./enums/settingsEnums.js";
5
- import { useItemsBlockStore as g } from "./store/items-block.js";
6
- import { getDefaultTemplate as y } from "./template.js";
7
- import { getItemsBlockContainer as C, getItemsBlockConfig as a, getDefaultItemsBlockConfig as I } from "./utils/nodeConfigUtils.js";
8
- const b = "items-block";
9
- class O extends u {
4
+ import { useItemsBlockStore as p } from "./store/items-block.js";
5
+ import { getDefaultTemplate as f } from "./template.js";
6
+ import { getItemsBlockContainer as g, getItemsBlockConfig as a, getDefaultItemsBlockConfig as C } from "./utils/nodeConfigUtils.js";
7
+ const y = "items-block";
8
+ class B extends u {
10
9
  getId() {
11
- return b;
10
+ return y;
12
11
  }
13
12
  getIcon() {
14
13
  return "items-icon";
15
14
  }
16
15
  getBlockCompositionType() {
17
- return p.CONTAINER;
16
+ return d.CONTAINER;
18
17
  }
19
18
  getName() {
20
19
  return this.api.translate("Items");
@@ -23,7 +22,7 @@ class O extends u {
23
22
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
23
  }
25
24
  getTemplate() {
26
- return y({
25
+ return f({
27
26
  orientation: c.ORIENTATION.VERTICAL,
28
27
  itemsType: c.ITEMS_TYPE.CART_ITEMS,
29
28
  itemId: "{{Abandoned Cart Item (1) Url}}",
@@ -35,22 +34,20 @@ class O extends u {
35
34
  allowInnerBlocksDND() {
36
35
  return !1;
37
36
  }
38
- onCreated(i) {
39
- const e = C(i);
37
+ onCreated(n) {
38
+ const e = g(n);
40
39
  if (!e)
41
40
  return;
42
- const t = e.getNodeConfig(), l = t && Object.keys(t).length > 0, r = a(i);
41
+ const t = e.getNodeConfig(), l = t && Object.keys(t).length > 0, r = a(n);
43
42
  if (r != null && r.initialized)
44
- l ? r.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...r, blockInstanceId: String(Date.now()) }).apply(new n("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(r).apply(new n("Migrate legacy config to nodeConfig"));
43
+ l ? r.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...r, blockInstanceId: String(Date.now()) }).apply(new i("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(r).apply(new i("Migrate legacy config to nodeConfig"));
45
44
  else {
46
- const m = I();
47
- this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new n("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
45
+ const s = C();
46
+ this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(s).apply(new i("Initialize Items block with default configuration")), m().startOnboarding("itemsOnboarding");
48
47
  }
49
- const s = `[esd-extension-block-id="${f.IMAGE}"] img`;
50
- this.api.getDocumentModifier().modifyHtml(i.querySelector(s)).setStyle("object-fit", "contain").apply(new n("Updated image object-fit"));
51
48
  }
52
- onSelect(i) {
53
- const e = g(), t = a(i);
49
+ onSelect(n) {
50
+ const e = p(), t = a(n);
54
51
  t && (e.setItemsType(t.type || o.itemsType), e.setItemIds(t.itemsSelectValue || o.cartItemsSelectControlValue), e.setOrientation(t.orientation || o.cardOrientationControlValue), e.setCurrencySymbol(
55
52
  t.priceCurrencySymbol || o.productPriceCurrencySymbolControlValue
56
53
  ), e.setCurrencyLocation(
@@ -61,6 +58,6 @@ class O extends u {
61
58
  }
62
59
  }
63
60
  export {
64
- b as BLOCK_ID,
65
- O as ItemsBlock
61
+ y as BLOCK_ID,
62
+ B as ItemsBlock
66
63
  };