@useinsider/guido 2.1.0-beta.9ba2e9d → 2.1.0-beta.a67f307

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 (51) hide show
  1. package/README.md +36 -0
  2. package/dist/@types/config/schemas.js +70 -65
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +69 -58
  5. package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
  6. package/dist/composables/useBlocksConfig.js +26 -16
  7. package/dist/composables/useHtmlValidator.js +107 -119
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +70 -96
  9. package/dist/config/migrator/itemsBlockMigrator.js +101 -97
  10. package/dist/enums/defaults.js +8 -4
  11. package/dist/enums/extensions/recommendationBlock.js +1 -1
  12. package/dist/extensions/Blocks/Recommendation/block.js +26 -23
  13. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +27 -26
  14. package/dist/extensions/Blocks/Recommendation/constants/layout.js +6 -4
  15. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +12 -10
  16. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -70
  17. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +87 -37
  18. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +138 -117
  19. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  20. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +117 -107
  21. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +25 -30
  22. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -30
  23. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +20 -25
  24. package/dist/extensions/Blocks/Recommendation/templates/utils.js +43 -31
  25. package/dist/extensions/ModulesTabIcons/extension.js +17 -0
  26. package/dist/guido.css +1 -1
  27. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
  28. package/dist/services/recommendationApi.js +11 -9
  29. package/dist/src/@types/config/schemas.d.ts +8 -0
  30. package/dist/src/composables/useConfig.d.ts +4 -0
  31. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  32. package/dist/src/enums/defaults.d.ts +4 -0
  33. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  34. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -0
  35. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
  36. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
  38. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -2
  39. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  40. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -0
  41. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +1 -1
  42. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +2 -0
  43. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -3
  44. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  45. package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
  46. package/dist/src/stores/config.d.ts +36 -0
  47. package/dist/static/styles/components/notification.css.js +1 -0
  48. package/dist/static/styles/components/version-history.css.js +10 -2
  49. package/dist/static/styles/components/wide-panel.css.js +18 -2
  50. package/dist/static/styles/customEditorStyle.css.js +10 -9
  51. package/package.json +2 -2
@@ -1,8 +1,8 @@
1
1
  var B = Object.defineProperty;
2
- var U = (r, t, e) => t in r ? B(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var M = (r, t, e) => U(r, typeof t != "symbol" ? t + "" : t, e);
2
+ var U = (e, t, r) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var M = (e, t, r) => U(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { productPairs as v } from "../../extensions/Blocks/Items/enums/productEnums.js";
5
- import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as d } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
5
+ import { ItemInCartOptions as E, DefaultConfigValues as g, SETTINGS_ENUMS as u } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
6
  import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
7
7
  const w = {
8
8
  img: {
@@ -74,76 +74,76 @@ const w = {
74
74
  function F() {
75
75
  return String(Date.now() + Math.floor(Math.random() * 1e3));
76
76
  }
77
- function q(r) {
78
- return r ? {
79
- CartItems: d.ITEMS_TYPE.CART_ITEMS,
80
- BrowsedItems: d.ITEMS_TYPE.BROWSED_ITEMS,
81
- PurchasedItems: d.ITEMS_TYPE.PURCHASED_ITEMS,
82
- CART_ITEMS: d.ITEMS_TYPE.CART_ITEMS,
83
- BROWSED_ITEMS: d.ITEMS_TYPE.BROWSED_ITEMS,
84
- PURCHASED_ITEMS: d.ITEMS_TYPE.PURCHASED_ITEMS
85
- }[r] || d.ITEMS_TYPE.CART_ITEMS : d.ITEMS_TYPE.CART_ITEMS;
77
+ function q(e) {
78
+ return e ? {
79
+ CartItems: u.ITEMS_TYPE.CART_ITEMS,
80
+ BrowsedItems: u.ITEMS_TYPE.BROWSED_ITEMS,
81
+ PurchasedItems: u.ITEMS_TYPE.PURCHASED_ITEMS,
82
+ CART_ITEMS: u.ITEMS_TYPE.CART_ITEMS,
83
+ BROWSED_ITEMS: u.ITEMS_TYPE.BROWSED_ITEMS,
84
+ PURCHASED_ITEMS: u.ITEMS_TYPE.PURCHASED_ITEMS
85
+ }[e] || u.ITEMS_TYPE.CART_ITEMS : u.ITEMS_TYPE.CART_ITEMS;
86
86
  }
87
- function R(r) {
88
- const t = (a, o) => a == null ? o : a === "1" || a === "true", e = (a, o) => a || o, i = r["data-type"] || r["data-source"], l = q(i);
89
- let n = r["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
87
+ function R(e) {
88
+ const t = (a, o) => a == null ? o : a === "1" || a === "true", r = (a, o) => a || o, c = e["data-type"] || e["data-source"], i = q(c);
89
+ let n = e["data-cart_items_select_control_value"] || g.cartItemsSelectControlValue;
90
90
  if (n && !n.includes("{{") && /^\d+$/.test(n)) {
91
- const a = parseInt(n) - 1, o = E[l];
91
+ const a = parseInt(n) - 1, o = E[i];
92
92
  o && o[a] && (n = o[a].value);
93
93
  }
94
94
  return {
95
95
  initialized: !0,
96
- blockInstanceId: e(r["data-block-instance-id"], F()),
97
- source: l,
98
- type: l,
96
+ blockInstanceId: r(e["data-block-instance-id"], F()),
97
+ source: i,
98
+ type: i,
99
99
  itemsSelectValue: n,
100
- orientation: r["data-card_orientation_control_value"] || d.ORIENTATION.VERTICAL,
101
- nameTrimming: t(r["data-product_name_control_trim"], !0),
102
- priceHideDiscount: t(r["data-product_price_control_nodup"], !0),
103
- priceFormatted: t(r["data-product_price_control_formated"], !0),
104
- priceSinglePrice: t(r["data-product_price_control_single_price"], !1),
105
- priceCurrencySymbol: e(
106
- r["data-product_price_control_currency_symbol"],
100
+ orientation: e["data-card_orientation_control_value"] || u.ORIENTATION.VERTICAL,
101
+ nameTrimming: t(e["data-product_name_control_trim"], !0),
102
+ priceHideDiscount: t(e["data-product_price_control_nodup"], !0),
103
+ priceFormatted: t(e["data-product_price_control_formated"], !0),
104
+ priceSinglePrice: t(e["data-product_price_control_single_price"], !1),
105
+ priceCurrencySymbol: r(
106
+ e["data-product_price_control_currency_symbol"],
107
107
  g.productPriceCurrencySymbolControlValue
108
108
  ),
109
- priceCurrencyLocation: e(
110
- r["data-product_price_currency_location"],
109
+ priceCurrencyLocation: r(
110
+ e["data-product_price_currency_location"],
111
111
  g.productPriceCurrencyLocationControlValue
112
112
  ),
113
- priceOrientation: r["data-product_original_price_control_orientation"] || "horizontal",
114
- quantityControlEnabled: t(r["data-product_quantity_control_enabled"], !0),
115
- buttonLink: e(r["data-product_button_link"], g.productButtonLinkControlValue),
116
- imageLink: e(r["data-product_image_link"], g.productImageLinkControlValue),
117
- buttonLabel: e(r["data-product_button_control_label"], "Buy"),
118
- buttonFullWidth: t(r["data-product_button_control_atw"], !0),
119
- imageVisible: t(r["data-product_image_control_enabled"], !0),
120
- nameVisible: t(r["data-product_name_control_enabled"], !0),
121
- quantityVisible: t(r["data-product_quantity_control_enabled"], !0),
122
- priceVisible: t(r["data-product_price_control_enabled"], !0),
123
- originalPriceVisible: t(r["data-product_original_price_control_enabled"], !0),
124
- buttonVisible: t(r["data-product_button_control_enabled"], !0)
113
+ priceOrientation: e["data-product_original_price_control_orientation"] || "horizontal",
114
+ quantityControlEnabled: t(e["data-product_quantity_control_enabled"], !0),
115
+ buttonLink: r(e["data-product_button_link"], g.productButtonLinkControlValue),
116
+ imageLink: r(e["data-product_image_link"], g.productImageLinkControlValue),
117
+ buttonLabel: r(e["data-product_button_control_label"], "Buy"),
118
+ buttonFullWidth: t(e["data-product_button_control_atw"], !0),
119
+ imageVisible: t(e["data-product_image_control_enabled"], !0),
120
+ nameVisible: t(e["data-product_name_control_enabled"], !0),
121
+ quantityVisible: t(e["data-product_quantity_control_enabled"], !0),
122
+ priceVisible: t(e["data-product_price_control_enabled"], !0),
123
+ originalPriceVisible: t(e["data-product_original_price_control_enabled"], !0),
124
+ buttonVisible: t(e["data-product_button_control_enabled"], !0)
125
125
  };
126
126
  }
127
- const $ = {
127
+ const O = {
128
128
  ins_apr: "CART_ITEMS",
129
129
  browsed_item: "BROWSED_ITEMS",
130
130
  purchased_item: "PURCHASED_ITEMS"
131
131
  };
132
- function x(r, t) {
133
- const e = {
132
+ function $(e, t) {
133
+ const r = {
134
134
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
135
135
  BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
136
136
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
137
137
  };
138
- return e[r] || e.CART_ITEMS;
138
+ return r[e] || r.CART_ITEMS;
139
139
  }
140
- function O(r, t) {
141
- const e = {
140
+ function x(e, t) {
141
+ const r = {
142
142
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
143
143
  BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
144
144
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
145
145
  };
146
- return e[r] || e.CART_ITEMS;
146
+ return r[e] || r.CART_ITEMS;
147
147
  }
148
148
  class V {
149
149
  constructor() {
@@ -152,12 +152,12 @@ class V {
152
152
  }
153
153
  migrate(t) {
154
154
  try {
155
- let e = this.removeJinjaConditionals(t);
156
- e = this.replaceTemplateVariables(e);
157
- const i = this.parser.parseFromString(e, "text/html"), l = i.querySelectorAll(
155
+ let r = this.removeJinjaConditionals(t);
156
+ r = this.replaceTemplateVariables(r);
157
+ const c = this.parser.parseFromString(r, "text/html"), i = c.querySelectorAll(
158
158
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
159
159
  );
160
- return l.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), e) : (l.forEach((n) => {
160
+ return i.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (i.forEach((n) => {
161
161
  const a = this.extractConfiguration(n), o = K({
162
162
  orientation: a.orientation,
163
163
  itemsType: a.itemsType,
@@ -173,19 +173,19 @@ class V {
173
173
  originalPriceStyles: a.originalPriceStyles,
174
174
  quantityStyles: a.quantityStyles,
175
175
  nodeConfig: R(a.configBlockAttributes)
176
- }), c = this.parser.parseFromString(
176
+ }), l = this.parser.parseFromString(
177
177
  `<table><tbody><tr>${o}</tr></tbody></table>`,
178
178
  "text/html"
179
179
  ).querySelector("td");
180
- if (c && n.parentNode) {
180
+ if (l && n.parentNode) {
181
181
  const f = R(a.configBlockAttributes);
182
- c.setAttribute("esd-ext-config", JSON.stringify(f));
183
- const u = c.querySelector("esd-config-block");
184
- u && u.remove(), n.parentNode.replaceChild(c, n);
182
+ l.setAttribute("esd-ext-config", JSON.stringify(f));
183
+ const d = l.querySelector("esd-config-block");
184
+ d && d.remove(), n.parentNode.replaceChild(l, n);
185
185
  }
186
- }), i.documentElement.outerHTML);
187
- } catch (e) {
188
- return console.error("ItemsBlockMigrator failed:", e), t;
186
+ }), c.documentElement.outerHTML);
187
+ } catch (r) {
188
+ return console.error("ItemsBlockMigrator failed:", r), t;
189
189
  }
190
190
  }
191
191
  /**
@@ -196,22 +196,22 @@ class V {
196
196
  */
197
197
  extractConfiguration(t) {
198
198
  var C, D, P;
199
- const e = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", i = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", l = parseInt(i) - 1, n = E[e], a = ((P = n == null ? void 0 : n[l]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", u = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, e, i), b = s["data-card_orientation_control_value"];
200
- let S;
201
- b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
202
- 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, k = (o == null ? void 0 : o.getAttribute("style")) || void 0, I = t.querySelector("p.original-price"), h = (I == null ? void 0 : I.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
199
+ 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", i = parseInt(c) - 1, n = E[r], a = ((P = n == null ? void 0 : n[i]) == null ? void 0 : P.value) || n[0].value, o = t.querySelector('[product-attr="price"]'), _ = (o == null ? void 0 : o.getAttribute("data-currency_symbol")) || "USD", f = ((o == null ? void 0 : o.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", d = (o == null ? void 0 : o.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r, c), S = s["data-card_orientation_control_value"];
200
+ let b;
201
+ S ? b = S === "horizontal" ? "horizontal" : "vertical" : b = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
202
+ const p = t.querySelector('a[product-attr="name"]'), I = (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 = (o == null ? void 0 : o.getAttribute("style")) || void 0, T = t.querySelector("p.original-price"), k = (T == null ? void 0 : T.getAttribute("style")) || void 0, A = t.querySelector('[product-attr="quantity"]'), L = (A == null ? void 0 : A.getAttribute("style")) || void 0;
203
203
  return {
204
- orientation: S,
205
- itemsType: e,
204
+ orientation: b,
205
+ itemsType: r,
206
206
  itemId: a,
207
207
  currencySymbol: _,
208
208
  currencyLocation: f,
209
- formattedPrice: u,
209
+ formattedPrice: d,
210
210
  configBlockAttributes: s,
211
- nameStyles: T,
211
+ nameStyles: I,
212
212
  buttonStyles: m,
213
- priceStyles: k,
214
- originalPriceStyles: h,
213
+ priceStyles: h,
214
+ originalPriceStyles: k,
215
215
  quantityStyles: L
216
216
  };
217
217
  }
@@ -222,17 +222,17 @@ class V {
222
222
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
223
223
  * @param itemNumber - The item number (1-based index)
224
224
  */
225
- extractConfigBlockAttributes(t, e, i) {
226
- const l = t.querySelector("esd-config-block"), n = {};
227
- if (!l)
225
+ extractConfigBlockAttributes(t, r, c) {
226
+ const i = t.querySelector("esd-config-block"), n = {};
227
+ if (!i)
228
228
  return this.getDefaultConfigBlockAttributes();
229
- if (Array.from(l.attributes).forEach((o) => {
229
+ if (Array.from(i.attributes).forEach((o) => {
230
230
  o.name.startsWith("data-") && (n[o.name] = o.value);
231
231
  }), n["data-cart_items_select_control_value"]) {
232
232
  const o = n["data-cart_items_select_control_value"];
233
233
  if (/^\d+$/.test(o)) {
234
- const _ = parseInt(o) - 1, c = E[e];
235
- c && c[_] && (n["data-cart_items_select_control_value"] = c[_].value);
234
+ const _ = parseInt(o) - 1, l = E[r];
235
+ l && l[_] && (n["data-cart_items_select_control_value"] = l[_].value);
236
236
  }
237
237
  }
238
238
  if (n["data-product_price_control_curency"]) {
@@ -242,7 +242,7 @@ class V {
242
242
  }
243
243
  (!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
244
244
  const a = { ...this.getDefaultConfigBlockAttributes(), ...n };
245
- return a["data-type"] = e, a["data-source"] = e, a["data-product_image_link"] = x(e, i), a["data-product_button_link"] = O(e, i), a;
245
+ return a["data-type"] = r, a["data-source"] = r, a["data-product_image_link"] = $(r, c), a["data-product_button_link"] = x(r, c), a;
246
246
  }
247
247
  /**
248
248
  * Returns default esd-config-block attributes based on the old template structure
@@ -297,18 +297,22 @@ class V {
297
297
  * - Cart Items: ins_apr_total_product_kind, ins_apr_price_N, ins_apr_originalprice_N
298
298
  * - Browsed Items: browsed_item_total_product_kind, browsed_item_price_N, browsed_item_originalprice_N
299
299
  * - Purchased Items: purchased_item_total_product_kind, purchased_item_price_N, purchased_item_originalprice_N
300
+ *
301
+ * IMPORTANT: Preserves the esd-custom-display-conditions attribute on <body> which
302
+ * contains display condition Jinja scripts that should NOT be removed.
300
303
  */
301
304
  removeJinjaConditionals(t) {
302
- let e = t.replace(
305
+ const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
306
+ let i = c ? t.replace(c[0], r) : t;
307
+ return i = i.replace(
303
308
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
304
309
  ""
305
- );
306
- return e = e.replace(
310
+ ), i = i.replace(
307
311
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
308
312
  ""
309
- ), e = e.replace(/\{%\s*endif\s*%\}/g, ""), e = e.replace(/\n\s*\n\s*\n/g, `
313
+ ), i = i.replace(/\{%\s*endif\s*%\}/g, ""), c && (i = i.replace(r, c[0])), i = i.replace(/\n\s*\n\s*\n/g, `
310
314
 
311
- `), e;
315
+ `), i;
312
316
  }
313
317
  /**
314
318
  * Replaces template variables with default values from productPairs
@@ -320,31 +324,31 @@ class V {
320
324
  * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
321
325
  */
322
326
  replaceTemplateVariables(t) {
323
- const { PAIRS_FOR_EXTENSION: e } = v;
324
- return t.replace(/{{([^}]+)}}/g, (i, l) => {
325
- const n = l.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
327
+ const { PAIRS_FOR_EXTENSION: r } = v;
328
+ return t.replace(/{{([^}]+)}}/g, (c, i) => {
329
+ const n = i.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
326
330
  if (!n)
327
- return i;
328
- const [, a, o, _] = n, c = $[a];
329
- if (!c)
330
- return console.warn(`Unknown variable prefix: ${a}`), i;
331
+ return c;
332
+ const [, a, o, _] = n, l = O[a];
333
+ if (!l)
334
+ return console.warn(`Unknown variable prefix: ${a}`), c;
331
335
  const f = w[o];
332
336
  if (!f)
333
- return console.warn(`Unknown variable suffix mapping for: ${o}`), i;
334
- const { pairsKey: u, defaultKey: s, isArray: b } = f, p = e[u][c];
337
+ return console.warn(`Unknown variable suffix mapping for: ${o}`), c;
338
+ const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][l];
335
339
  if (!p)
336
- return console.warn(`No data found for: ${u}.${c}`), i;
337
- if (b) {
340
+ return console.warn(`No data found for: ${d}.${l}`), c;
341
+ if (S) {
338
342
  const y = parseInt(_) - 1, m = p[s];
339
- return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${u}.${c}.${s}[${y}]`), i);
343
+ return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${l}.${s}[${y}]`), c);
340
344
  }
341
- const T = p[s];
342
- return T !== void 0 ? String(T) : (console.warn(`Default value not found: ${u}.${c}.${s}`), i);
345
+ const I = p[s];
346
+ return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${l}.${s}`), c);
343
347
  });
344
348
  }
345
349
  }
346
- function G(r) {
347
- return new V().migrate(r);
350
+ function G(e) {
351
+ return new V().migrate(e);
348
352
  }
349
353
  export {
350
354
  G as migrateItemsBlock
@@ -1,8 +1,12 @@
1
- const t = {
1
+ const e = {
2
2
  transactional: 2
3
- }, o = 2, T = 13;
3
+ }, o = 2, t = 13, s = {
4
+ SAVED_MODULES: "savedModules",
5
+ DEFAULT_MODULES: "defaultModules"
6
+ };
4
7
  export {
5
8
  o as EditorType,
6
- T as MAX_DEFAULT_TEMPLATE_ID,
7
- t as TemplateTypes
9
+ t as MAX_DEFAULT_TEMPLATE_ID,
10
+ s as ModuleFolderDefaults,
11
+ e as TemplateTypes
8
12
  };
@@ -1,5 +1,5 @@
1
1
  const s = {
2
- RECOMMENDATION_API_URL: "http://recommendationv2.api.useinsider.com"
2
+ RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
3
3
  }, i = [
4
4
  { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
5
5
  { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
@@ -1,12 +1,13 @@
1
- var u = Object.defineProperty;
2
- var p = (r, i, t) => i in r ? u(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
3
- var g = (r, i, t) => p(r, typeof i != "symbol" ? i + "" : i, t);
4
- import { Block as f, BlockCompositionType as I, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var p = Object.defineProperty;
2
+ var f = (r, o, t) => o in r ? p(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
+ var g = (r, o, t) => f(r, typeof o != "symbol" ? o + "" : o, t);
4
+ import { Block as h, BlockCompositionType as I, ModificationDescription as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { ensureMobileCssRulesExist as d } from "./controls/mobileLayout/cssRules.js";
5
6
  import { RecommendationConfigService as s } from "./services/configService.js";
6
- import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
7
- import { getDefaultTemplate as _ } from "./templates/grid/template.js";
8
- const k = "recommendation-block", c = "ins-recommendation-v3-block-v2", m = "recommendation-id";
9
- class b extends f {
7
+ import { useRecommendationExtensionStore as u } from "./store/recommendation.js";
8
+ import { getDefaultTemplate as k } from "./templates/grid/template.js";
9
+ const B = "recommendation-block", c = "ins-recommendation-v3-block-v2", a = "recommendation-id";
10
+ class y extends h {
10
11
  constructor() {
11
12
  super();
12
13
  /**
@@ -16,7 +17,7 @@ class b extends f {
16
17
  g(this, "_pendingBlockId", null);
17
18
  }
18
19
  getId() {
19
- return k;
20
+ return B;
20
21
  }
21
22
  getIcon() {
22
23
  return "recommendation-icon";
@@ -39,7 +40,7 @@ class b extends f {
39
40
  */
40
41
  getTemplate() {
41
42
  const t = this._generateNextId();
42
- return this._pendingBlockId = t, _(t);
43
+ return this._pendingBlockId = t, k(t);
43
44
  }
44
45
  /**
45
46
  * Called when a new block is dropped into the template
@@ -50,7 +51,9 @@ class b extends f {
50
51
  */
51
52
  onCreated(t) {
52
53
  const e = this._pendingBlockId ?? this._generateNextId();
53
- this._pendingBlockId = null, this._assignRecommendationId(t, e), s.initializeConfig(this.api, t, { recommendationId: e }), d().setCurrentBlock(e);
54
+ this._pendingBlockId = null, this._assignRecommendationId(t, e);
55
+ const n = s.initializeConfig(this.api, t, { recommendationId: e }), i = u();
56
+ i.setCurrentBlock(e), d(this.api), i.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
54
57
  }
55
58
  /**
56
59
  * Called when the document changes or template is loaded
@@ -70,7 +73,7 @@ class b extends f {
70
73
  "Assign recommendation ID to legacy block"
71
74
  );
72
75
  }
73
- s.needsMigration(t) && this._migrateFromLegacy(t);
76
+ s.needsMigration(t) && this._migrateFromLegacy(t), d(this.api);
74
77
  }
75
78
  }
76
79
  /**
@@ -81,7 +84,7 @@ class b extends f {
81
84
  */
82
85
  onDelete(t) {
83
86
  const e = this._getRecommendationId(t);
84
- e && d().removeBlockState(e);
87
+ e && u().removeBlockState(e);
85
88
  }
86
89
  /**
87
90
  * Generates the next unique recommendation ID by scanning all existing blocks
@@ -91,9 +94,9 @@ class b extends f {
91
94
  let t = 0;
92
95
  try {
93
96
  const e = this.api.getDocumentRoot();
94
- e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((o) => {
95
- if ("getAttribute" in o) {
96
- const a = o.getAttribute(m), l = a ? parseInt(a) : 0;
97
+ e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((i) => {
98
+ if ("getAttribute" in i) {
99
+ const m = i.getAttribute(a), l = m ? parseInt(m) : 0;
97
100
  l > t && (t = l);
98
101
  }
99
102
  });
@@ -111,8 +114,8 @@ class b extends f {
111
114
  const n = this._getBlockElement(t);
112
115
  if (!n)
113
116
  return;
114
- const o = this.api.getDocumentModifier();
115
- o.modifyHtml(n).setAttribute(m, e.toString()), o.apply(new h(`Assign recommendation ID ${e}`));
117
+ const i = this.api.getDocumentModifier();
118
+ i.modifyHtml(n).setAttribute(a, e.toString()), i.apply(new _(`Assign recommendation ID ${e}`));
116
119
  }
117
120
  /**
118
121
  * Gets the recommendation-id from a block node
@@ -121,11 +124,11 @@ class b extends f {
121
124
  const e = this._getBlockElement(t);
122
125
  if (!e || !("getAttribute" in e))
123
126
  return null;
124
- const n = e.getAttribute(m);
127
+ const n = e.getAttribute(a);
125
128
  if (!n)
126
129
  return null;
127
- const o = parseInt(n);
128
- return Number.isNaN(o) ? null : o;
130
+ const i = parseInt(n);
131
+ return Number.isNaN(i) ? null : i;
129
132
  }
130
133
  /**
131
134
  * Gets the block element (the element with BLOCK_CLASS)
@@ -146,6 +149,6 @@ class b extends f {
146
149
  }
147
150
  }
148
151
  export {
149
- k as BLOCK_ID,
150
- b as RecommendationBlock
152
+ B as BLOCK_ID,
153
+ y as RecommendationBlock
151
154
  };
@@ -1,6 +1,6 @@
1
- import { DEFAULT_ROW_SPACING as n, DEFAULT_COLUMN_SPACING as s, DEFAULT_CARDS_IN_ROW as R } from "./layout.js";
2
- import { ATTR_PRODUCT_IMAGE as t, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as r, ATTR_PRODUCT_BUTTON as U } from "./selectors.js";
3
- const I = {
1
+ import { DEFAULT_ROW_SPACING as U, DEFAULT_COLUMN_SPACING as I, DEFAULT_MOBILE_CARDS_IN_ROW as n, DEFAULT_CARDS_IN_ROW as s } from "./layout.js";
2
+ import { ATTR_PRODUCT_IMAGE as t, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as r, ATTR_PRODUCT_BUTTON as R } from "./selectors.js";
3
+ const O = {
4
4
  code: "USD",
5
5
  symbol: "USD",
6
6
  alignment: "after",
@@ -10,56 +10,57 @@ const I = {
10
10
  }, i = {
11
11
  textBefore: "",
12
12
  textAfter: ""
13
- }, O = {
13
+ }, C = {
14
14
  textBefore: "",
15
15
  textAfter: ""
16
- }, C = [
16
+ }, D = [
17
17
  t,
18
18
  e,
19
19
  o,
20
- T,
21
20
  _,
21
+ T,
22
22
  r,
23
- U
24
- ], D = {
23
+ R
24
+ ], A = {
25
25
  [t]: !0,
26
26
  [e]: !0,
27
- [T]: !0,
27
+ [_]: !0,
28
28
  [o]: !0,
29
- [_]: !1,
29
+ [T]: !1,
30
30
  [r]: !1,
31
- [U]: !0
32
- }, a = {
31
+ [R]: !0
32
+ }, E = {
33
33
  // Settings
34
34
  strategy: "mostPopular",
35
35
  productIds: [],
36
36
  size: "6",
37
37
  shuffleProducts: !1,
38
38
  language: "en_US",
39
- currency: I,
39
+ currency: O,
40
40
  filters: [],
41
41
  // Layout
42
42
  layout: "grid",
43
- cardsInRow: R,
44
- columnSpacing: s,
45
- rowSpacing: n,
43
+ cardsInRow: s,
44
+ mobileCardsInRow: n,
45
+ columnSpacing: I,
46
+ rowSpacing: U,
46
47
  // Composition
47
- composition: C,
48
- visibility: D,
48
+ composition: D,
49
+ visibility: A,
49
50
  // Element settings
50
51
  omnibusPrice: i,
51
- omnibusDiscount: O,
52
+ omnibusDiscount: C,
52
53
  textTrimming: !1,
53
54
  // Meta
54
55
  configVersion: 1,
55
56
  recommendationId: 0
56
- }, E = 1;
57
+ }, N = 1;
57
58
  export {
58
- E as CURRENT_CONFIG_VERSION,
59
- C as DEFAULT_COMPOSITION,
60
- I as DEFAULT_CURRENCY,
61
- a as DEFAULT_NODE_CONFIG,
62
- O as DEFAULT_OMNIBUS_DISCOUNT,
59
+ N as CURRENT_CONFIG_VERSION,
60
+ D as DEFAULT_COMPOSITION,
61
+ O as DEFAULT_CURRENCY,
62
+ E as DEFAULT_NODE_CONFIG,
63
+ C as DEFAULT_OMNIBUS_DISCOUNT,
63
64
  i as DEFAULT_OMNIBUS_PRICE,
64
- D as DEFAULT_VISIBILITY
65
+ A as DEFAULT_VISIBILITY
65
66
  };
@@ -4,17 +4,19 @@ const _ = {
4
4
  }, o = [
5
5
  { icon: "grid-orientation", value: _.GRID },
6
6
  { icon: "list-orientation", value: _.LIST }
7
- ], t = 3, n = 3, A = 9, T = 4, c = 10, s = 20, O = 0, S = 50, I = 5;
7
+ ], t = 3, n = 3, A = 9, O = 4, R = 1, T = 2, c = 10, s = 20, I = 0, S = 50, P = 5;
8
8
  export {
9
9
  n as DEFAULT_CARDS_IN_ROW,
10
10
  c as DEFAULT_COLUMN_SPACING,
11
+ R as DEFAULT_MOBILE_CARDS_IN_ROW,
11
12
  t as DEFAULT_PRODUCTS_PER_ROW,
12
13
  s as DEFAULT_ROW_SPACING,
13
14
  o as LAYOUT_OPTIONS,
14
15
  _ as LAYOUT_VALUES,
15
- T as MAX_PRODUCTS_PER_ROW,
16
+ T as MAX_MOBILE_PRODUCTS_PER_ROW,
17
+ O as MAX_PRODUCTS_PER_ROW,
16
18
  A as MAX_PRODUCT_COUNT,
17
19
  S as MAX_SPACING,
18
- O as MIN_SPACING,
19
- I as SPACING_STEP
20
+ I as MIN_SPACING,
21
+ P as SPACING_STEP
20
22
  };
@@ -1,19 +1,21 @@
1
- const c = ".ins-recommendation-product-container", T = {
1
+ const c = ".ins-recommendation-product-container", n = ".ins-recommendation-desktop-container", o = ".ins-recommendation-mobile-container", T = {
2
2
  CURRENCY: "currency",
3
3
  SYMBOL: "currency-symbol",
4
4
  ALIGNMENT: "currency-alignment",
5
5
  THOUSAND_SEPARATOR: "currency-thousand-separator",
6
6
  DECIMAL_SEPARATOR: "currency-decimal-separator",
7
7
  DECIMAL_COUNT: "currency-decimal-count"
8
- }, r = "productImage", n = "productName", o = "productPrice", t = "productOldPrice", R = "productOmnibusPrice", O = "productOmnibusDiscount", _ = "productButton";
8
+ }, t = "productImage", r = "productName", R = "productPrice", e = "productOldPrice", O = "productOmnibusPrice", _ = "productOmnibusDiscount", C = "productButton";
9
9
  export {
10
- _ as ATTR_PRODUCT_BUTTON,
11
- r as ATTR_PRODUCT_IMAGE,
12
- n as ATTR_PRODUCT_NAME,
13
- t as ATTR_PRODUCT_OLD_PRICE,
14
- O as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
15
- R as ATTR_PRODUCT_OMNIBUS_PRICE,
16
- o as ATTR_PRODUCT_PRICE,
10
+ C as ATTR_PRODUCT_BUTTON,
11
+ t as ATTR_PRODUCT_IMAGE,
12
+ r as ATTR_PRODUCT_NAME,
13
+ e as ATTR_PRODUCT_OLD_PRICE,
14
+ _ as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
15
+ O as ATTR_PRODUCT_OMNIBUS_PRICE,
16
+ R as ATTR_PRODUCT_PRICE,
17
17
  c as CONTAINER_SELECTOR,
18
- T as CURRENCY_ATTR
18
+ T as CURRENCY_ATTR,
19
+ n as DESKTOP_CONTAINER_SELECTOR,
20
+ o as MOBILE_CONTAINER_SELECTOR
19
21
  };