@useinsider/guido 3.17.0-beta.bc6e089 → 3.17.0-beta.c3ab4de

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 (59) hide show
  1. package/dist/@types/config/schemas.js +15 -13
  2. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  3. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +21 -0
  4. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  5. package/dist/components/organisms/header/EditorActions.vue2.js +34 -50
  6. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  7. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +39 -0
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  10. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  11. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  12. package/dist/components/organisms/header/RightSlot.vue.js +7 -6
  13. package/dist/components/organisms/header/RightSlot.vue2.js +17 -15
  14. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  15. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  16. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +24 -0
  17. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  18. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +18 -0
  19. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +74 -0
  20. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -34
  21. package/dist/composables/useAccessibilityApi.js +31 -0
  22. package/dist/composables/useCustomInterfaceAppearance.js +31 -28
  23. package/dist/config/i18n/en/labels.json.js +28 -4
  24. package/dist/config/migrator/itemsBlockMigrator.js +156 -204
  25. package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
  26. package/dist/extensions/Blocks/Items/controls/settingsControl.js +55 -58
  27. package/dist/extensions/Blocks/Items/enums/productEnums.js +9 -14
  28. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +9 -11
  29. package/dist/extensions/Blocks/Items/template.js +206 -214
  30. package/dist/guido.css +1 -1
  31. package/dist/node_modules/@vueuse/core/index.js +102 -0
  32. package/dist/node_modules/@vueuse/shared/index.js +40 -28
  33. package/dist/sprite.svg +6 -0
  34. package/dist/src/@types/config/schemas.d.ts +4 -0
  35. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  36. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  37. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  38. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  39. package/dist/src/composables/useAccessibilityApi.d.ts +15 -0
  40. package/dist/src/composables/useActionsApi.d.ts +2 -2
  41. package/dist/src/composables/useConfig.d.ts +2 -0
  42. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -3
  43. package/dist/src/stores/config.d.ts +18 -0
  44. package/dist/src/stores/editor.d.ts +76 -0
  45. package/dist/src/stores/onboarding.d.ts +377 -0
  46. package/dist/src/stores/version-history.d.ts +1 -1
  47. package/dist/src/utils/timeUtil.d.ts +10 -0
  48. package/dist/static/styles/components/accessibility.css.js +137 -0
  49. package/dist/static/styles/variables.css.js +1 -0
  50. package/dist/stores/editor.js +4 -1
  51. package/dist/stores/onboarding.js +16 -11
  52. package/dist/utils/pairProductVariables.js +70 -70
  53. package/dist/utils/timeUtil.js +6 -17
  54. package/package.json +1 -1
  55. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  56. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  57. package/dist/extensions/Blocks/Items/constants/cardLayout.js +0 -20
  58. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +0 -44
  59. /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → AutoSaveStatus.vue.d.ts} +0 -0
@@ -1,12 +1,12 @@
1
- var K = Object.defineProperty;
2
- var U = (a, t, e) => t in a ? K(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var R = (a, t, e) => U(a, typeof t != "symbol" ? t + "" : t, e);
4
- import { BLOCK_ID as F } from "../../extensions/Blocks/Items/block.js";
5
- import { productPairs as x } from "../../extensions/Blocks/Items/enums/productEnums.js";
6
- import { ItemInCartOptions as I, DefaultConfigValues as S, SETTINGS_ENUMS as p } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
7
- import { getDefaultTemplate as O } from "../../extensions/Blocks/Items/template.js";
8
- import { useTemplateStore as $ } from "../../stores/template.js";
9
- const V = {
1
+ var v = Object.defineProperty;
2
+ var U = (o, t, r) => t in o ? v(o, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[t] = r;
3
+ var M = (o, t, r) => U(o, typeof t != "symbol" ? t + "" : t, r);
4
+ import { BLOCK_ID as w } from "../../extensions/Blocks/Items/block.js";
5
+ import { productPairs as K } from "../../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { ItemInCartOptions as I, DefaultConfigValues as g, SETTINGS_ENUMS as p } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
7
+ import { getDefaultTemplate as F } from "../../extensions/Blocks/Items/template.js";
8
+ import { useTemplateStore as q } from "../../stores/template.js";
9
+ const x = {
10
10
  img: {
11
11
  pairsKey: "imageSrc",
12
12
  defaultKey: "DEFAULT",
@@ -73,126 +73,126 @@ const V = {
73
73
  isArray: !1
74
74
  }
75
75
  };
76
- function N() {
76
+ function O() {
77
77
  return String(Date.now() + Math.floor(Math.random() * 1e3));
78
78
  }
79
- function L(a) {
80
- return a ? {
79
+ function k(o) {
80
+ return o ? {
81
81
  CartItems: p.ITEMS_TYPE.CART_ITEMS,
82
82
  BrowsedItems: p.ITEMS_TYPE.BROWSED_ITEMS,
83
83
  PurchasedItems: p.ITEMS_TYPE.PURCHASED_ITEMS,
84
84
  CART_ITEMS: p.ITEMS_TYPE.CART_ITEMS,
85
85
  BROWSED_ITEMS: p.ITEMS_TYPE.BROWSED_ITEMS,
86
86
  PURCHASED_ITEMS: p.ITEMS_TYPE.PURCHASED_ITEMS
87
- }[a] || p.ITEMS_TYPE.CART_ITEMS : p.ITEMS_TYPE.CART_ITEMS;
87
+ }[o] || p.ITEMS_TYPE.CART_ITEMS : p.ITEMS_TYPE.CART_ITEMS;
88
88
  }
89
- function k(a) {
90
- var r;
91
- const t = (l, u) => l == null ? u : l === "1" || l === "true", e = (l, u) => l || u, c = a["data-type"] || a["data-source"], o = L(c), n = I[o];
92
- let i = a["data-cart_items_select_control_value"] || ((r = n == null ? void 0 : n[0]) == null ? void 0 : r.value) || S.cartItemsSelectControlValue;
93
- if (i && !i.includes("{{") && /^\d+$/.test(i)) {
94
- const l = parseInt(i) - 1, u = I[o];
95
- u && u[l] && (i = u[l].value);
89
+ function h(o) {
90
+ var e;
91
+ const t = (l, u) => l == null ? u : l === "1" || l === "true", r = (l, u) => l || u, c = o["data-type"] || o["data-source"], a = k(c), i = I[a];
92
+ let n = o["data-cart_items_select_control_value"] || ((e = i == null ? void 0 : i[0]) == null ? void 0 : e.value) || g.cartItemsSelectControlValue;
93
+ if (n && !n.includes("{{") && /^\d+$/.test(n)) {
94
+ const l = parseInt(n) - 1, u = I[a];
95
+ u && u[l] && (n = u[l].value);
96
96
  }
97
97
  return {
98
98
  initialized: !0,
99
- blockInstanceId: e(a["data-block-instance-id"], N()),
100
- source: o,
101
- type: o,
102
- itemsSelectValue: i,
103
- orientation: a["data-card_orientation_control_value"] || p.ORIENTATION.VERTICAL,
104
- nameTrimming: t(a["data-product_name_control_trim"], !0),
105
- priceHideDiscount: t(a["data-product_price_control_nodup"], !0),
106
- priceFormatted: t(a["data-product_price_control_formated"], !0),
107
- priceSinglePrice: t(a["data-product_price_control_single_price"], !1),
108
- priceCurrencySymbol: e(
109
- a["data-product_price_control_currency_symbol"],
110
- S.productPriceCurrencySymbolControlValue
99
+ blockInstanceId: r(o["data-block-instance-id"], O()),
100
+ source: a,
101
+ type: a,
102
+ itemsSelectValue: n,
103
+ orientation: o["data-card_orientation_control_value"] || p.ORIENTATION.VERTICAL,
104
+ nameTrimming: t(o["data-product_name_control_trim"], !0),
105
+ priceHideDiscount: t(o["data-product_price_control_nodup"], !0),
106
+ priceFormatted: t(o["data-product_price_control_formated"], !0),
107
+ priceSinglePrice: t(o["data-product_price_control_single_price"], !1),
108
+ priceCurrencySymbol: r(
109
+ o["data-product_price_control_currency_symbol"],
110
+ g.productPriceCurrencySymbolControlValue
111
111
  ),
112
- priceCurrencyLocation: e(
113
- a["data-product_price_currency_location"],
114
- S.productPriceCurrencyLocationControlValue
112
+ priceCurrencyLocation: r(
113
+ o["data-product_price_currency_location"],
114
+ g.productPriceCurrencyLocationControlValue
115
115
  ),
116
- priceOrientation: a["data-product_original_price_control_orientation"] || "horizontal",
117
- quantityControlEnabled: t(a["data-product_quantity_control_enabled"], !0),
118
- buttonLink: e(a["data-product_button_link"], S.productButtonLinkControlValue),
119
- imageLink: e(a["data-product_image_link"], S.productImageLinkControlValue),
120
- buttonLabel: e(a["data-product_button_control_label"], "Buy"),
121
- buttonFullWidth: t(a["data-product_button_control_atw"], !0),
122
- imageVisible: t(a["data-product_image_control_enabled"], !0),
123
- nameVisible: t(a["data-product_name_control_enabled"], !0),
124
- quantityVisible: t(a["data-product_quantity_control_enabled"], !0),
125
- priceVisible: t(a["data-product_price_control_enabled"], !0),
126
- originalPriceVisible: t(a["data-product_original_price_control_enabled"], !0),
127
- buttonVisible: t(a["data-product_button_control_enabled"], !0)
116
+ priceOrientation: o["data-product_original_price_control_orientation"] || "horizontal",
117
+ quantityControlEnabled: t(o["data-product_quantity_control_enabled"], !0),
118
+ buttonLink: r(o["data-product_button_link"], g.productButtonLinkControlValue),
119
+ imageLink: r(o["data-product_image_link"], g.productImageLinkControlValue),
120
+ buttonLabel: r(o["data-product_button_control_label"], "Buy"),
121
+ buttonFullWidth: t(o["data-product_button_control_atw"], !0),
122
+ imageVisible: t(o["data-product_image_control_enabled"], !0),
123
+ nameVisible: t(o["data-product_name_control_enabled"], !0),
124
+ quantityVisible: t(o["data-product_quantity_control_enabled"], !0),
125
+ priceVisible: t(o["data-product_price_control_enabled"], !0),
126
+ originalPriceVisible: t(o["data-product_original_price_control_enabled"], !0),
127
+ buttonVisible: t(o["data-product_button_control_enabled"], !0)
128
128
  };
129
129
  }
130
- const z = {
130
+ const V = {
131
131
  ins_apr: "CART_ITEMS",
132
132
  browsed_item: "BROWSED_ITEMS",
133
133
  purchased_item: "PURCHASED_ITEMS"
134
134
  };
135
- function H(a, t) {
136
- const e = {
135
+ function $(o, t) {
136
+ const r = {
137
137
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
138
138
  BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
139
139
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
140
140
  };
141
- return e[a] || e.CART_ITEMS;
141
+ return r[o] || r.CART_ITEMS;
142
142
  }
143
- function Y(a, t) {
144
- const e = {
143
+ function N(o, t) {
144
+ const r = {
145
145
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
146
146
  BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
147
147
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
148
148
  };
149
- return e[a] || e.CART_ITEMS;
149
+ return r[o] || r.CART_ITEMS;
150
150
  }
151
- class W {
151
+ class H {
152
152
  constructor() {
153
- R(this, "parser");
153
+ M(this, "parser");
154
154
  this.parser = new DOMParser();
155
155
  }
156
156
  migrate(t) {
157
157
  try {
158
158
  if (!this.containsItemsBlock(t))
159
159
  return this.backfillV2ProductTdAttributes(t);
160
- let e = this.removeJinjaConditionals(t);
161
- e = this.replaceTemplateVariables(e);
162
- const c = this.parser.parseFromString(e, "text/html"), o = c.querySelectorAll(
160
+ let r = this.removeJinjaConditionals(t);
161
+ r = this.replaceTemplateVariables(r);
162
+ const c = this.parser.parseFromString(r, "text/html"), a = c.querySelectorAll(
163
163
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
164
164
  );
165
- return $().$patch((i) => {
166
- i.migrations = { ...i.migrations, [F]: o.length };
167
- }), o.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), e) : (o.forEach((i) => {
168
- const r = this.extractConfiguration(i), l = O({
169
- orientation: r.orientation,
170
- itemsType: r.itemsType,
171
- itemId: r.itemId,
172
- currencySymbol: r.currencySymbol,
173
- currencyLocation: r.currencyLocation,
174
- formattedPrice: r.formattedPrice,
175
- configBlockAttributes: r.configBlockAttributes,
165
+ return q().$patch((n) => {
166
+ n.migrations = { ...n.migrations, [w]: a.length };
167
+ }), a.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (a.forEach((n) => {
168
+ const e = this.extractConfiguration(n), l = F({
169
+ orientation: e.orientation,
170
+ itemsType: e.itemsType,
171
+ itemId: e.itemId,
172
+ currencySymbol: e.currencySymbol,
173
+ currencyLocation: e.currencyLocation,
174
+ formattedPrice: e.formattedPrice,
175
+ configBlockAttributes: e.configBlockAttributes,
176
176
  migrate: !0,
177
- nameStyles: r.nameStyles,
178
- buttonStyles: r.buttonStyles,
179
- priceStyles: r.priceStyles,
180
- originalPriceStyles: r.originalPriceStyles,
181
- quantityStyles: r.quantityStyles,
182
- nodeConfig: k(r.configBlockAttributes)
177
+ nameStyles: e.nameStyles,
178
+ buttonStyles: e.buttonStyles,
179
+ priceStyles: e.priceStyles,
180
+ originalPriceStyles: e.originalPriceStyles,
181
+ quantityStyles: e.quantityStyles,
182
+ nodeConfig: h(e.configBlockAttributes)
183
183
  }), s = this.parser.parseFromString(
184
184
  `<table><tbody><tr>${l}</tr></tbody></table>`,
185
185
  "text/html"
186
186
  ).querySelector("td");
187
- if (s && i.parentNode) {
188
- const _ = k(r.configBlockAttributes);
187
+ if (s && n.parentNode) {
188
+ const _ = h(e.configBlockAttributes);
189
189
  s.setAttribute("esd-ext-config", JSON.stringify(_)), s.setAttribute("data-type", _.type);
190
190
  const d = s.querySelector("esd-config-block");
191
- d && d.remove(), i.parentNode.replaceChild(s, i);
191
+ d && d.remove(), n.parentNode.replaceChild(s, n);
192
192
  }
193
193
  }), c.documentElement.outerHTML);
194
- } catch (e) {
195
- return console.error("ItemsBlockMigrator failed:", e), t;
194
+ } catch (r) {
195
+ return console.error("ItemsBlockMigrator failed:", r), t;
196
196
  }
197
197
  }
198
198
  /**
@@ -202,76 +202,28 @@ class W {
202
202
  * - UI styles from product elements (name, price, button, quantity, etc.)
203
203
  */
204
204
  extractConfiguration(t) {
205
- var D, P, M;
206
- const e = L(
207
- ((D = t.querySelector("[data-type]")) == null ? void 0 : D.getAttribute("data-type")) ?? null
208
- ), c = ((P = t.querySelector("[data-number]")) == null ? void 0 : P.getAttribute("data-number")) || "1", o = parseInt(c) - 1, n = I[e], i = ((M = n == null ? void 0 : n[o]) == null ? void 0 : M.value) || n[0].value, r = this.extractConfigBlockAttributes(t, e, c);
209
- this.applyDomFallbacks(t, r);
210
- const l = t.querySelector('[product-attr="price"]'), u = l ?? t.querySelector('[product-attr="originalPrice"]'), s = (u == null ? void 0 : u.getAttribute("data-currency_symbol")) || r["data-product_price_control_currency_symbol"], _ = u == null ? void 0 : u.getAttribute("data-curency");
211
- let d = r["data-product_price_currency_location"] || "0";
212
- _ && (d = _ === "after" ? "1" : "0");
213
- const A = (u == null ? void 0 : u.getAttribute("data-formated")) ?? r["data-product_price_control_formated"], h = A !== "false" && A !== "0", m = r["data-card_orientation_control_value"];
214
- let g;
215
- m ? g = m === "horizontal" ? "horizontal" : "vertical" : g = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
216
- const f = t.querySelector('a[product-attr="name"]'), b = (f == null ? void 0 : f.getAttribute("style")) || void 0, E = t.querySelector('a[product-attr="button"]'), w = (E == null ? void 0 : E.getAttribute("style")) || void 0, v = (l == null ? void 0 : l.getAttribute("style")) || void 0, y = t.querySelector("p.original-price") ?? t.querySelector('[product-attr="originalPrice"]'), T = y != null && y.getAttribute("style") ? y : (y == null ? void 0 : y.closest("p")) ?? y, B = (T == null ? void 0 : T.getAttribute("style")) || void 0, C = t.querySelector('[product-attr="quantity"]'), q = (C == null ? void 0 : C.getAttribute("style")) || void 0;
205
+ var C, D, P;
206
+ const r = k(
207
+ ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) ?? null
208
+ ), c = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", a = parseInt(c) - 1, i = I[r], n = ((P = i == null ? void 0 : i[a]) == null ? void 0 : P.value) || i[0].value, e = t.querySelector('[product-attr="price"]'), l = (e == null ? void 0 : e.getAttribute("data-currency_symbol")) || "USD", s = ((e == null ? void 0 : e.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", _ = (e == null ? void 0 : e.getAttribute("data-formated")) !== "false", d = this.extractConfigBlockAttributes(t, r, c), b = d["data-card_orientation_control_value"];
209
+ let S;
210
+ b ? S = b === "horizontal" ? "horizontal" : "vertical" : S = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
211
+ const y = t.querySelector('a[product-attr="name"]'), A = (y == null ? void 0 : y.getAttribute("style")) || void 0, f = t.querySelector('a[product-attr="button"]'), m = (f == null ? void 0 : f.getAttribute("style")) || void 0, R = (e == null ? void 0 : e.getAttribute("style")) || void 0, E = t.querySelector("p.original-price"), L = (E == null ? void 0 : E.getAttribute("style")) || void 0, T = t.querySelector('[product-attr="quantity"]'), B = (T == null ? void 0 : T.getAttribute("style")) || void 0;
217
212
  return {
218
- orientation: g,
219
- itemsType: e,
220
- itemId: i,
221
- currencySymbol: s,
222
- currencyLocation: d,
223
- formattedPrice: h,
224
- configBlockAttributes: r,
225
- nameStyles: b,
226
- buttonStyles: w,
227
- priceStyles: v,
228
- originalPriceStyles: B,
229
- quantityStyles: q
213
+ orientation: S,
214
+ itemsType: r,
215
+ itemId: n,
216
+ currencySymbol: l,
217
+ currencyLocation: s,
218
+ formattedPrice: _,
219
+ configBlockAttributes: d,
220
+ nameStyles: A,
221
+ buttonStyles: m,
222
+ priceStyles: R,
223
+ originalPriceStyles: L,
224
+ quantityStyles: B
230
225
  };
231
226
  }
232
- /**
233
- * DOM fallback for hand-edited templates whose esd-config-block was deleted. With no
234
- * toggle record left, derive each field's enabled state from whether its product-attr
235
- * element still exists and read the button label from the live caption — a deleted
236
- * element means the field is off, not an all-ON default. A present config block stays
237
- * authoritative (a missing flag there still means "default on"), so we no-op for it.
238
- */
239
- applyDomFallbacks(t, e) {
240
- var u;
241
- const c = t.querySelector("esd-config-block");
242
- if (Object.entries({
243
- image: '[product-attr="imageSrc"]',
244
- name: '[product-attr="name"]',
245
- price: '[product-attr="price"]',
246
- original_price: '[product-attr="originalPrice"], p.original-price',
247
- quantity: '[product-attr="quantity"]',
248
- button: '[product-attr="button"]'
249
- }).forEach(([s, _]) => {
250
- const d = `data-product_${s}_control_enabled`;
251
- (!c || !c.hasAttribute(d)) && (e[d] = t.querySelector(_) ? "true" : "false");
252
- }), c)
253
- return;
254
- e["data-card_orientation_control_value"] = t.querySelector('[colspan="2"]') ? "vertical" : "horizontal";
255
- const n = t.querySelector('a[product-attr="button"]'), i = (u = n == null ? void 0 : n.textContent) == null ? void 0 : u.replace(/\s+/g, " ").trim();
256
- i && (e["data-product_button_control_label"] = i), /display:\s*inline/.test((n == null ? void 0 : n.getAttribute("style")) || "") && (e["data-product_button_control_atw"] = "false");
257
- const r = t.querySelector('[product-attr="imageSrc"]'), l = r ? this.readImageDimension(r) : null;
258
- l && (e["data-product_image_control_image-height"] = l, e["data-product_image_control_image-width"] = l);
259
- }
260
- /**
261
- * Reads a pixel dimension for the product image from its DOM element — the legacy
262
- * `width` attribute first, then a px value in the inline style. An explicit `width` wins
263
- * over `max-width`, which is only an upper bound; `max-width` still covers the common
264
- * `width: 100%` case, where no pixel size can be read from `width` itself.
265
- * Returns null when no pixel size is present.
266
- */
267
- readImageDimension(t) {
268
- var n;
269
- const e = (n = t.getAttribute("width")) == null ? void 0 : n.trim();
270
- if (e && /^\d+$/.test(e))
271
- return e;
272
- const c = t.getAttribute("style") || "", o = c.match(/(?:^|;)\s*width:\s*(\d+)px/) || c.match(/max-width:\s*(\d+)px/);
273
- return o ? o[1] : null;
274
- }
275
227
  /**
276
228
  * Extracts all data-* attributes from the esd-config-block element
277
229
  * Returns a key-value mapping of all configuration attributes
@@ -279,27 +231,27 @@ class W {
279
231
  * @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
280
232
  * @param itemNumber - The item number (1-based index)
281
233
  */
282
- extractConfigBlockAttributes(t, e, c) {
283
- const o = t.querySelector("esd-config-block"), n = {};
284
- if (o) {
285
- if (Array.from(o.attributes).forEach((r) => {
286
- r.name.startsWith("data-") && (n[r.name] = r.value);
287
- }), n["data-cart_items_select_control_value"]) {
288
- const r = n["data-cart_items_select_control_value"];
289
- if (/^\d+$/.test(r)) {
290
- const l = parseInt(r) - 1, u = I[e];
291
- u && u[l] && (n["data-cart_items_select_control_value"] = u[l].value);
292
- }
234
+ extractConfigBlockAttributes(t, r, c) {
235
+ const a = t.querySelector("esd-config-block"), i = {};
236
+ if (!a)
237
+ return this.getDefaultConfigBlockAttributes();
238
+ if (Array.from(a.attributes).forEach((e) => {
239
+ e.name.startsWith("data-") && (i[e.name] = e.value);
240
+ }), i["data-cart_items_select_control_value"]) {
241
+ const e = i["data-cart_items_select_control_value"];
242
+ if (/^\d+$/.test(e)) {
243
+ const l = parseInt(e) - 1, u = I[r];
244
+ u && u[l] && (i["data-cart_items_select_control_value"] = u[l].value);
293
245
  }
294
- if (n["data-product_price_control_curency"]) {
295
- const r = n["data-product_price_control_curency"];
296
- let l = r;
297
- r === "before" ? l = "0" : r === "after" && (l = "1"), n["data-product_price_control_curency"] = l, n["data-product_price_currency_location"] = l;
298
- }
299
- (!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
300
246
  }
301
- const i = { ...this.getDefaultConfigBlockAttributes(), ...n };
302
- return i["data-type"] = e, i["data-source"] = e, i["data-product_image_link"] = H(e, c), i["data-product_button_link"] = Y(e, c), i;
247
+ if (i["data-product_price_control_curency"]) {
248
+ const e = i["data-product_price_control_curency"];
249
+ let l = e;
250
+ e === "before" ? l = "0" : e === "after" && (l = "1"), i["data-product_price_control_curency"] = l, i["data-product_price_currency_location"] = l;
251
+ }
252
+ (!i["data-product_price_control_currency_symbol"] || i["data-product_price_control_currency_symbol"].trim() === "") && (i["data-product_price_control_currency_symbol"] = "USD");
253
+ const n = { ...this.getDefaultConfigBlockAttributes(), ...i };
254
+ return n["data-type"] = r, n["data-source"] = r, n["data-product_image_link"] = $(r, c), n["data-product_button_link"] = N(r, c), n;
303
255
  }
304
256
  /**
305
257
  * Returns default esd-config-block attributes based on the old template structure
@@ -373,25 +325,25 @@ class W {
373
325
  backfillV2ProductTdAttributes(t) {
374
326
  if (!t.includes("ins-product-td") || !t.includes("esd-ext-config"))
375
327
  return t;
376
- const e = this.parser.parseFromString(t, "text/html");
328
+ const r = this.parser.parseFromString(t, "text/html");
377
329
  let c = !1;
378
- return e.querySelectorAll(".ins-product-td").forEach((o) => {
379
- o.hasAttribute("width") && (o.removeAttribute("width"), c = !0);
380
- const n = o.getAttribute("esd-ext-config");
381
- let i = null;
330
+ return r.querySelectorAll(".ins-product-td").forEach((a) => {
331
+ a.hasAttribute("width") && (a.removeAttribute("width"), c = !0);
332
+ const i = a.getAttribute("esd-ext-config");
333
+ let n = null;
382
334
  try {
383
- i = n ? JSON.parse(n) : null;
335
+ n = i ? JSON.parse(i) : null;
384
336
  } catch {
385
337
  }
386
- if (!i || (!o.getAttribute("data-nodup") && typeof i.priceHideDiscount == "boolean" && (o.setAttribute("data-nodup", String(i.priceHideDiscount)), c = !0), o.getAttribute("data-type")))
338
+ if (!n || (!a.getAttribute("data-nodup") && typeof n.priceHideDiscount == "boolean" && (a.setAttribute("data-nodup", String(n.priceHideDiscount)), c = !0), a.getAttribute("data-type")))
387
339
  return;
388
- const r = i.type || i.source;
389
- if (!r)
340
+ const e = n.type || n.source;
341
+ if (!e)
390
342
  return;
391
- o.setAttribute("data-type", r), c = !0;
392
- const l = typeof i.itemsSelectValue == "string" ? i.itemsSelectValue.match(/\((\d+)\)/) : null;
393
- l && o.getAttribute("data-number") !== l[1] && o.setAttribute("data-number", l[1]);
394
- }), c ? e.documentElement.outerHTML : t;
343
+ a.setAttribute("data-type", e), c = !0;
344
+ const l = typeof n.itemsSelectValue == "string" ? n.itemsSelectValue.match(/\((\d+)\)/) : null;
345
+ l && a.getAttribute("data-number") !== l[1] && a.setAttribute("data-number", l[1]);
346
+ }), c ? r.documentElement.outerHTML : t;
395
347
  }
396
348
  /**
397
349
  * Fast check for the presence of any items block (cart / browsed / purchased)
@@ -412,17 +364,17 @@ class W {
412
364
  * contains display condition Jinja scripts that should NOT be removed.
413
365
  */
414
366
  removeJinjaConditionals(t) {
415
- const e = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
416
- let o = c ? t.replace(c[0], e) : t;
417
- return o = o.replace(
367
+ const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", c = t.match(/esd-custom-display-conditions="[^"]*"/);
368
+ let a = c ? t.replace(c[0], r) : t;
369
+ return a = a.replace(
418
370
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(&gt;|>)\s*\d+\s*%\}/g,
419
371
  ""
420
- ), o = o.replace(
372
+ ), a = a.replace(
421
373
  /\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!&#61;|!=)\s*\1_originalprice_\d+\s*%\}/g,
422
374
  ""
423
- ), o = o.replace(/\{%\s*endif\s*%\}/g, ""), c && (o = o.replace(e, c[0])), o = o.replace(/\n\s*\n\s*\n/g, `
375
+ ), a = a.replace(/\{%\s*endif\s*%\}/g, ""), c && (a = a.replace(r, c[0])), a = a.replace(/\n\s*\n\s*\n/g, `
424
376
 
425
- `), o;
377
+ `), a;
426
378
  }
427
379
  /**
428
380
  * Replaces template variables with default values from productPairs
@@ -434,32 +386,32 @@ class W {
434
386
  * - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
435
387
  */
436
388
  replaceTemplateVariables(t) {
437
- const { PAIRS_FOR_EXTENSION: e } = x;
438
- return t.replace(/{{([^}]+)}}/g, (c, o) => {
439
- const n = o.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
440
- if (!n)
389
+ const { PAIRS_FOR_EXTENSION: r } = K;
390
+ return t.replace(/{{([^}]+)}}/g, (c, a) => {
391
+ const i = a.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
392
+ if (!i)
441
393
  return c;
442
- const [, i, r, l] = n, u = z[i];
394
+ const [, n, e, l] = i, u = V[n];
443
395
  if (!u)
444
- return console.warn(`Unknown variable prefix: ${i}`), c;
445
- const s = V[r];
396
+ return console.warn(`Unknown variable prefix: ${n}`), c;
397
+ const s = x[e];
446
398
  if (!s)
447
- return console.warn(`Unknown variable suffix mapping for: ${r}`), c;
448
- const { pairsKey: _, defaultKey: d, isArray: A } = s, m = e[_][u];
449
- if (!m)
399
+ return console.warn(`Unknown variable suffix mapping for: ${e}`), c;
400
+ const { pairsKey: _, defaultKey: d, isArray: b } = s, y = r[_][u];
401
+ if (!y)
450
402
  return console.warn(`No data found for: ${_}.${u}`), c;
451
- if (A) {
452
- const f = parseInt(l) - 1, b = m[d];
453
- return Array.isArray(b) && b[f] ? b[f] : (console.warn(`Array value not found: ${_}.${u}.${d}[${f}]`), c);
403
+ if (b) {
404
+ const f = parseInt(l) - 1, m = y[d];
405
+ return Array.isArray(m) && m[f] ? m[f] : (console.warn(`Array value not found: ${_}.${u}.${d}[${f}]`), c);
454
406
  }
455
- const g = m[d];
456
- return g !== void 0 ? String(g) : (console.warn(`Default value not found: ${_}.${u}.${d}`), c);
407
+ const A = y[d];
408
+ return A !== void 0 ? String(A) : (console.warn(`Default value not found: ${_}.${u}.${d}`), c);
457
409
  });
458
410
  }
459
411
  }
460
- function et(a) {
461
- return new W().migrate(a);
412
+ function Q(o) {
413
+ return new H().migrate(o);
462
414
  }
463
415
  export {
464
- et as migrateItemsBlock
416
+ Q as migrateItemsBlock
465
417
  };
@@ -1,15 +1,14 @@
1
- import { ModificationDescription as d, UIElementType as s, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as T } from "../../../common-control.js";
3
- import { nameMaxWidthFor as h } from "../../constants/cardLayout.js";
1
+ import { ModificationDescription as l, UIElementType as s, UEAttr as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as p } from "../../../common-control.js";
4
3
  import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
5
- import { findNameTextNode as c } from "../../utils/nameNode.js";
6
- import { getItemsBlockConfig as r, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
7
- const I = a.NAME_TRIMMING, n = {
4
+ import { findNameTextNode as T } from "../../utils/nameNode.js";
5
+ import { getItemsBlockConfig as r, setItemsBlockConfig as c } from "../../utils/nodeConfigUtils.js";
6
+ const g = a.NAME_TRIMMING, i = {
8
7
  TRIMMING: "trimming"
9
8
  };
10
- class E extends T {
9
+ class y extends p {
11
10
  getId() {
12
- return I;
11
+ return g;
13
12
  }
14
13
  getTemplate() {
15
14
  return `
@@ -20,39 +19,39 @@ class E extends T {
20
19
  }
21
20
  onRender() {
22
21
  const e = r(this.currentNode);
23
- this.api.updateValues({ [n.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(n.TRIMMING, (t) => {
22
+ this.api.updateValues({ [i.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(i.TRIMMING, (t) => {
24
23
  this._onTrimmingChange(t);
25
24
  });
26
25
  }
27
26
  onTemplateNodeUpdated(e) {
28
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
29
28
  const t = r(this.currentNode);
30
- this.api.updateValues({ [n.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
29
+ this.api.updateValues({ [i.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
31
30
  });
32
31
  }
33
32
  _onTrimmingChange(e) {
34
- g(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [n.TRIMMING]: e }), this._applyTrimmingStyles(e);
33
+ c(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [i.TRIMMING]: e }), this._applyTrimmingStyles(e);
35
34
  }
36
35
  _applyTrimmingStyles(e) {
37
- const t = c(this.currentNode);
36
+ const t = T(this.currentNode);
38
37
  if (!t)
39
38
  return;
40
- const i = r(this.currentNode), m = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
41
- m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
39
+ const n = r(this.currentNode), m = e !== void 0 ? e : (n == null ? void 0 : n.nameTrimming) ?? !0, o = this.api.getDocumentModifier().modifyHtml(t);
40
+ m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", "100%").apply(new l(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
42
41
  }
43
42
  _getTextTrimming() {
44
43
  return `
45
44
  <div class="display-flex align-items-center justify-content-between">
46
45
  <${s.LABEL}
47
- ${p.LABEL.text}="${this.api.translate("Text Trimming")}"
46
+ ${d.LABEL.text}="${this.api.translate("Text Trimming")}"
48
47
  >
49
48
  </${s.LABEL}>
50
- ${this._GuToggle(n.TRIMMING)}
49
+ ${this._GuToggle(i.TRIMMING)}
51
50
  </div>
52
51
  `;
53
52
  }
54
53
  }
55
54
  export {
56
- I as CONTROL_BLOCK_ID,
57
- E as NameTrimmingControl
55
+ g as CONTROL_BLOCK_ID,
56
+ y as NameTrimmingControl
58
57
  };