@useinsider/guido 3.20.0-beta.30c96fc → 3.20.0-beta.3ad13f5

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 (32) hide show
  1. package/dist/composables/useStripo.js +4 -3
  2. package/dist/config/compiler/itemsCompilerRules.js +5 -14
  3. package/dist/config/compiler/utils/itemsCompilerUtils.js +21 -48
  4. package/dist/config/migrator/itemsBlockMigrator.js +108 -112
  5. package/dist/extensions/Blocks/Items/block.js +67 -78
  6. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  7. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  8. package/dist/package.json.js +1 -1
  9. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +0 -5
  10. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  11. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  12. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -5
  13. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  14. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  15. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  16. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  17. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  18. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  19. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  20. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  21. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  22. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  23. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  24. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  25. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  26. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  27. package/dist/static/styles/components/button.css.js +5 -0
  28. package/package.json +3 -3
  29. package/dist/extensions/Blocks/Items/constants/cardWidth.js +0 -20
  30. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +0 -12
  31. package/dist/src/utils/liquidProtection.d.ts +0 -3
  32. package/dist/utils/liquidProtection.js +0 -5
@@ -31,13 +31,13 @@ const he = () => {
31
31
  n = null;
32
32
  }), n), D = async (r, s, o, a = [], i = !1) => {
33
33
  var y, E, h, C;
34
- const e = k(), { html: d, css: R } = r, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
34
+ const e = k(), { html: d, css: P } = r, { baseBlocks: g, extensions: R } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
35
  w().importCss(), await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
38
38
  metadata: s,
39
39
  html: d,
40
- css: R,
40
+ css: P,
41
41
  forceRecreate: I,
42
42
  locale: "en",
43
43
  undoButtonSelector: "#guido__undo-button",
@@ -60,6 +60,7 @@ const he = () => {
60
60
  keepModuleStylesEnabled: !0,
61
61
  displayTitle: !1,
62
62
  displayUTM: !1,
63
+ copyPasteEnabled: !1,
63
64
  selectElementAfterDrop: !0,
64
65
  sameFontSizeForOutlook: !0,
65
66
  allowedScriptSourceDomains: q,
@@ -120,7 +121,7 @@ const he = () => {
120
121
  ".in-modal-v2-wrapper",
121
122
  ".in-toasts-wrapper"
122
123
  ],
123
- extensions: P,
124
+ extensions: R,
124
125
  localePatch: J
125
126
  }
126
127
  );
@@ -1,15 +1,6 @@
1
1
  import { pairProductVariables as o } from "../../utils/pairProductVariables.js";
2
- import { normalizeItemsBlockWidths as r, wrapHiddenPriceTdsForOutlook as e, MSO_ITEMS_HIDE_START as t, MSO_ITEMS_HIDE_END as s } from "./utils/itemsCompilerUtils.js";
3
- const d = [
4
- {
5
- id: "normalize-items-block-widths",
6
- // Runs before the other items rules so they see non-zero widths; not AMP-safe.
7
- description: "Normalize zero Items card widths in the compiled email",
8
- type: "custom",
9
- processor: r,
10
- priority: 55
11
- // Before pair-product-variables (60)
12
- },
2
+ import { wrapHiddenPriceTdsForOutlook as r, MSO_ITEMS_HIDE_START as e, MSO_ITEMS_HIDE_END as t } from "./utils/itemsCompilerUtils.js";
3
+ const a = [
13
4
  {
14
5
  id: "pair-product-variables",
15
6
  description: "Replace product default values with template variables",
@@ -25,7 +16,7 @@ const d = [
25
16
  // with safe placeholder comments and collapse them inline for web-engine Outlook.
26
17
  description: "Mark hidden Items price tds for Outlook conditional hiding",
27
18
  type: "custom",
28
- processor: e,
19
+ processor: r,
29
20
  priority: 65
30
21
  // After pair-product-variables (60), before outlook rules (70+)
31
22
  },
@@ -35,10 +26,10 @@ const d = [
35
26
  // and reco swap P100) keeps it out of every whitespace/comment-mangling pass.
36
27
  description: "Swap Items MSO markers into [if !mso] conditional comments",
37
28
  type: "custom",
38
- processor: (i) => i.replaceAll(`<!--${t}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${s}-->`, "<!--<![endif]-->"),
29
+ processor: (i) => i.replaceAll(`<!--${e}-->`, "<!--[if !mso]><!-- -->").replaceAll(`<!--${t}-->`, "<!--<![endif]-->"),
39
30
  priority: 101
40
31
  }
41
32
  ];
42
33
  export {
43
- d as itemsCompilerRules
34
+ a as itemsCompilerRules
44
35
  };
@@ -1,55 +1,28 @@
1
- import { PRODUCT_WRAPPER_SELECTOR as A, hasZeroWidthDeclaration as E, isZeroWidthValue as u, withWidthPin as h, PRODUCT_TD_SELECTOR as S, withoutZeroWidth as _ } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
- import { protectLiquid as m, restoreLiquid as y } from "../../../utils/liquidProtection.js";
3
- const f = "MSO_ITEMS_HIDE_START", D = "MSO_ITEMS_HIDE_END", T = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", M = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price";
4
- function g(e) {
5
- if (!e.includes("vertical-price") || !e.includes("ins-product-cart"))
6
- return e;
7
- const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(n, "text/html");
8
- let s = !1;
9
- if (r.querySelectorAll(M).forEach((t) => {
10
- var d, a;
11
- const o = t.getAttribute("style") || "";
1
+ const p = "MSO_ITEMS_HIDE_START", E = "MSO_ITEMS_HIDE_END", u = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", _ = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price";
2
+ function T(t) {
3
+ if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
4
+ return t;
5
+ const i = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(i, "text/html");
6
+ let n = !1;
7
+ if (r.querySelectorAll(_).forEach((e) => {
8
+ var s, a;
9
+ const o = e.getAttribute("style") || "";
12
10
  if (!/display\s*:\s*none/i.test(o))
13
11
  return;
14
- const l = t.previousSibling;
15
- if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== f) && ((d = t.parentNode) == null || d.insertBefore(r.createComment(f), t), (a = t.parentNode) == null || a.insertBefore(r.createComment(D), t.nextSibling)), !/mso-hide/i.test(o)) {
16
- const p = o.trim().endsWith(";") ? " " : "; ";
17
- t.setAttribute("style", `${o}${p}${T}`);
12
+ const c = e.previousSibling;
13
+ if (((c == null ? void 0 : c.nodeType) !== Node.COMMENT_NODE || c.data !== p) && ((s = e.parentNode) == null || s.insertBefore(r.createComment(p), e), (a = e.parentNode) == null || a.insertBefore(r.createComment(E), e.nextSibling)), !/mso-hide/i.test(o)) {
14
+ const d = o.trim().endsWith(";") ? " " : "; ";
15
+ e.setAttribute("style", `${o}${d}${u}`);
18
16
  }
19
- s = !0;
20
- }), !s)
21
- return e;
22
- const c = n.match(/<!DOCTYPE[^>]*>/i);
23
- return ((c ? `${c[0]}
17
+ n = !0;
18
+ }), !n)
19
+ return t;
20
+ const l = i.match(/<!DOCTYPE[^>]*>/i);
21
+ return ((l ? `${l[0]}
24
22
  ` : "") + r.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
25
23
  }
26
- function I(e) {
27
- if (!e.includes("ins-product-wrapper") && !e.includes("ins-product-td"))
28
- return e;
29
- const n = new DOMParser().parseFromString(m(e), "text/html");
30
- let r = !1;
31
- if (n.querySelectorAll(A).forEach((i) => {
32
- const t = i.getAttribute("style") || "";
33
- if (!E(t) && !u(i.getAttribute("width")))
34
- return;
35
- const o = h(t);
36
- o !== t && (i.setAttribute("style", o), r = !0), u(i.getAttribute("width")) && (i.setAttribute("width", "100%"), r = !0);
37
- }), n.querySelectorAll(S).forEach((i) => {
38
- const t = i.getAttribute("style") || "";
39
- if (E(t)) {
40
- const o = _(t);
41
- o ? i.setAttribute("style", o) : i.removeAttribute("style"), r = !0;
42
- }
43
- u(i.getAttribute("width")) && (i.removeAttribute("width"), r = !0);
44
- }), !r)
45
- return e;
46
- const s = e.match(/<!DOCTYPE[^>]*>/i), c = s ? `${s[0]}
47
- ` : "";
48
- return y(c + n.documentElement.outerHTML);
49
- }
50
24
  export {
51
- D as MSO_ITEMS_HIDE_END,
52
- f as MSO_ITEMS_HIDE_START,
53
- I as normalizeItemsBlockWidths,
54
- g as wrapHiddenPriceTdsForOutlook
25
+ E as MSO_ITEMS_HIDE_END,
26
+ p as MSO_ITEMS_HIDE_START,
27
+ T as wrapHiddenPriceTdsForOutlook
55
28
  };
@@ -1,86 +1,84 @@
1
- var B = Object.defineProperty;
2
- var v = (n, t, e) => t in n ? B(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var M = (n, t, e) => v(n, typeof t != "symbol" ? t + "" : t, e);
1
+ var q = Object.defineProperty;
2
+ var v = (c, t, e) => t in c ? q(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
+ var M = (c, t, e) => v(c, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { BLOCK_ID as R } from "../../extensions/Blocks/Items/block.js";
5
- import { hasZeroWidthDeclaration as L, withoutZeroWidth as x } from "../../extensions/Blocks/Items/constants/cardWidth.js";
6
5
  import { ItemInCartOptions as h, DefaultConfigValues as b, SETTINGS_ENUMS as _ } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
7
- import { getDefaultTemplate as V } from "../../extensions/Blocks/Items/template.js";
8
- import { useTemplateStore as O } from "../../stores/template.js";
9
- import { protectLiquid as H, restoreLiquid as $ } from "../../utils/liquidProtection.js";
10
- function F() {
6
+ import { getDefaultTemplate as L } from "../../extensions/Blocks/Items/template.js";
7
+ import { useTemplateStore as x } from "../../stores/template.js";
8
+ function O() {
11
9
  return String(Date.now() + Math.floor(Math.random() * 1e3));
12
10
  }
13
- function D(n) {
14
- return n ? {
11
+ function P(c) {
12
+ return c ? {
15
13
  CartItems: _.ITEMS_TYPE.CART_ITEMS,
16
14
  BrowsedItems: _.ITEMS_TYPE.BROWSED_ITEMS,
17
15
  PurchasedItems: _.ITEMS_TYPE.PURCHASED_ITEMS,
18
16
  CART_ITEMS: _.ITEMS_TYPE.CART_ITEMS,
19
17
  BROWSED_ITEMS: _.ITEMS_TYPE.BROWSED_ITEMS,
20
18
  PURCHASED_ITEMS: _.ITEMS_TYPE.PURCHASED_ITEMS
21
- }[n] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
19
+ }[c] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
22
20
  }
23
- function U(n) {
24
- return n.classList.contains("esd-browsed-items-block") ? _.ITEMS_TYPE.BROWSED_ITEMS : n.classList.contains("esd-purchased-items-block") ? _.ITEMS_TYPE.PURCHASED_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
21
+ function V(c) {
22
+ return c.classList.contains("esd-browsed-items-block") ? _.ITEMS_TYPE.BROWSED_ITEMS : c.classList.contains("esd-purchased-items-block") ? _.ITEMS_TYPE.PURCHASED_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
25
23
  }
26
- function P(n) {
24
+ function D(c) {
27
25
  var o;
28
- const t = (i, d) => i == null ? d : i === "1" || i === "true", e = (i, d) => i || d, a = n["data-type"] || n["data-source"], r = D(a), u = h[r];
29
- let c = n["data-cart_items_select_control_value"] || ((o = u == null ? void 0 : u[0]) == null ? void 0 : o.value) || b.cartItemsSelectControlValue;
30
- if (c && !c.includes("{{") && /^\d+$/.test(c)) {
31
- const i = parseInt(c) - 1, d = h[r];
32
- d && d[i] && (c = d[i].value);
26
+ const t = (i, u) => i == null ? u : i === "1" || i === "true", e = (i, u) => i || u, a = c["data-type"] || c["data-source"], r = P(a), d = h[r];
27
+ let n = c["data-cart_items_select_control_value"] || ((o = d == null ? void 0 : d[0]) == null ? void 0 : o.value) || b.cartItemsSelectControlValue;
28
+ if (n && !n.includes("{{") && /^\d+$/.test(n)) {
29
+ const i = parseInt(n) - 1, u = h[r];
30
+ u && u[i] && (n = u[i].value);
33
31
  }
34
32
  return {
35
33
  initialized: !0,
36
- blockInstanceId: e(n["data-block-instance-id"], F()),
34
+ blockInstanceId: e(c["data-block-instance-id"], O()),
37
35
  source: r,
38
36
  type: r,
39
- itemsSelectValue: c,
40
- orientation: n["data-card_orientation_control_value"] || _.ORIENTATION.VERTICAL,
41
- nameTrimming: t(n["data-product_name_control_trim"], !0),
42
- priceHideDiscount: t(n["data-product_price_control_nodup"], !0),
43
- priceFormatted: t(n["data-product_price_control_formated"], !0),
44
- priceSinglePrice: t(n["data-product_price_control_single_price"], !1),
37
+ itemsSelectValue: n,
38
+ orientation: c["data-card_orientation_control_value"] || _.ORIENTATION.VERTICAL,
39
+ nameTrimming: t(c["data-product_name_control_trim"], !0),
40
+ priceHideDiscount: t(c["data-product_price_control_nodup"], !0),
41
+ priceFormatted: t(c["data-product_price_control_formated"], !0),
42
+ priceSinglePrice: t(c["data-product_price_control_single_price"], !1),
45
43
  priceCurrencySymbol: e(
46
- n["data-product_price_control_currency_symbol"],
44
+ c["data-product_price_control_currency_symbol"],
47
45
  b.productPriceCurrencySymbolControlValue
48
46
  ),
49
47
  priceCurrencyLocation: e(
50
- n["data-product_price_currency_location"],
48
+ c["data-product_price_currency_location"],
51
49
  b.productPriceCurrencyLocationControlValue
52
50
  ),
53
- priceOrientation: n["data-product_original_price_control_orientation"] || "horizontal",
54
- quantityControlEnabled: t(n["data-product_quantity_control_enabled"], !0),
55
- buttonLink: e(n["data-product_button_link"], b.productButtonLinkControlValue),
56
- imageLink: e(n["data-product_image_link"], b.productImageLinkControlValue),
57
- buttonLabel: e(n["data-product_button_control_label"], "Buy"),
58
- buttonFullWidth: t(n["data-product_button_control_atw"], !0),
59
- imageVisible: t(n["data-product_image_control_enabled"], !0),
60
- nameVisible: t(n["data-product_name_control_enabled"], !0),
61
- quantityVisible: t(n["data-product_quantity_control_enabled"], !0),
62
- priceVisible: t(n["data-product_price_control_enabled"], !0),
63
- originalPriceVisible: t(n["data-product_original_price_control_enabled"], !0),
64
- buttonVisible: t(n["data-product_button_control_enabled"], !0)
51
+ priceOrientation: c["data-product_original_price_control_orientation"] || "horizontal",
52
+ quantityControlEnabled: t(c["data-product_quantity_control_enabled"], !0),
53
+ buttonLink: e(c["data-product_button_link"], b.productButtonLinkControlValue),
54
+ imageLink: e(c["data-product_image_link"], b.productImageLinkControlValue),
55
+ buttonLabel: e(c["data-product_button_control_label"], "Buy"),
56
+ buttonFullWidth: t(c["data-product_button_control_atw"], !0),
57
+ imageVisible: t(c["data-product_image_control_enabled"], !0),
58
+ nameVisible: t(c["data-product_name_control_enabled"], !0),
59
+ quantityVisible: t(c["data-product_quantity_control_enabled"], !0),
60
+ priceVisible: t(c["data-product_price_control_enabled"], !0),
61
+ originalPriceVisible: t(c["data-product_original_price_control_enabled"], !0),
62
+ buttonVisible: t(c["data-product_button_control_enabled"], !0)
65
63
  };
66
64
  }
67
- function Y(n, t) {
65
+ function H(c, t) {
68
66
  const e = {
69
67
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
70
68
  BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
71
69
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
72
70
  };
73
- return e[n] || e.CART_ITEMS;
71
+ return e[c] || e.CART_ITEMS;
74
72
  }
75
- function W(n, t) {
73
+ function $(c, t) {
76
74
  const e = {
77
75
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
78
76
  BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
79
77
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
80
78
  };
81
- return e[n] || e.CART_ITEMS;
79
+ return e[c] || e.CART_ITEMS;
82
80
  }
83
- class z {
81
+ class F {
84
82
  constructor() {
85
83
  M(this, "parser");
86
84
  this.parser = new DOMParser();
@@ -92,10 +90,10 @@ class z {
92
90
  const e = this.removeJinjaConditionals(t), a = this.parser.parseFromString(e, "text/html"), r = a.querySelectorAll(
93
91
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
94
92
  );
95
- return O().$patch((c) => {
96
- c.migrations = { ...c.migrations, [R]: r.length };
97
- }), r.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), this.backfillV2ProductTdAttributes(e)) : (r.forEach((c) => {
98
- const o = this.extractConfiguration(c), i = V({
93
+ return x().$patch((n) => {
94
+ n.migrations = { ...n.migrations, [R]: r.length };
95
+ }), r.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), e) : (r.forEach((n) => {
96
+ const o = this.extractConfiguration(n), i = L({
99
97
  orientation: o.orientation,
100
98
  itemsType: o.itemsType,
101
99
  itemId: o.itemId,
@@ -109,18 +107,18 @@ class z {
109
107
  priceStyles: o.priceStyles,
110
108
  originalPriceStyles: o.originalPriceStyles,
111
109
  quantityStyles: o.quantityStyles,
112
- nodeConfig: P(o.configBlockAttributes)
110
+ nodeConfig: D(o.configBlockAttributes)
113
111
  }), l = this.parser.parseFromString(
114
112
  `<table><tbody><tr>${i}</tr></tbody></table>`,
115
113
  "text/html"
116
114
  ).querySelector("td");
117
- if (l && c.parentNode) {
118
- const s = P(o.configBlockAttributes);
115
+ if (l && n.parentNode) {
116
+ const s = D(o.configBlockAttributes);
119
117
  l.setAttribute("esd-ext-config", JSON.stringify(s)), l.setAttribute("data-type", s.type);
120
118
  const p = l.querySelector("esd-config-block");
121
- p && p.remove(), c.parentNode.replaceChild(l, c);
119
+ p && p.remove(), n.parentNode.replaceChild(l, n);
122
120
  }
123
- }), this.backfillV2ProductTdAttributes(a.documentElement.outerHTML));
121
+ }), a.documentElement.outerHTML);
124
122
  } catch (e) {
125
123
  return console.error("ItemsBlockMigrator failed:", e), t;
126
124
  }
@@ -133,24 +131,24 @@ class z {
133
131
  */
134
132
  extractConfiguration(t) {
135
133
  var C;
136
- const e = D(
137
- this.readSelfOrDescendantAttribute(t, "data-type") || U(t)
138
- ), a = this.readSelfOrDescendantAttribute(t, "data-number") || "1", r = parseInt(a) - 1, u = h[e], c = ((C = u == null ? void 0 : u[r]) == null ? void 0 : C.value) || u[0].value, o = this.extractConfigBlockAttributes(t, e, a);
134
+ const e = P(
135
+ this.readSelfOrDescendantAttribute(t, "data-type") || V(t)
136
+ ), a = this.readSelfOrDescendantAttribute(t, "data-number") || "1", r = parseInt(a) - 1, d = h[e], n = ((C = d == null ? void 0 : d[r]) == null ? void 0 : C.value) || d[0].value, o = this.extractConfigBlockAttributes(t, e, a);
139
137
  this.applyDomFallbacks(t, o);
140
- const i = t.querySelector('[product-attr="price"]'), d = o["data-product_price_control_currency_symbol"], l = o["data-product_price_currency_location"] || "0", s = o["data-product_price_control_formated"], p = s !== "false" && s !== "0", S = o["data-card_orientation_control_value"] === "horizontal" ? "horizontal" : "vertical", f = t.querySelector('a[product-attr="name"]'), y = (f == null ? void 0 : f.getAttribute("style")) || void 0, g = t.querySelector('a[product-attr="button"]') ?? t.querySelector('[product-attr="button"]'), I = (g == null ? void 0 : g.getAttribute("style")) || void 0, k = (i == null ? void 0 : i.getAttribute("style")) || void 0, m = t.querySelector("p.original-price") ?? t.querySelector('[product-attr="originalPrice"]'), A = m != null && m.getAttribute("style") ? m : (m == null ? void 0 : m.closest("p")) ?? m, q = (A == null ? void 0 : A.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), w = (E == null ? void 0 : E.getAttribute("style")) || void 0;
138
+ const i = t.querySelector('[product-attr="price"]'), u = o["data-product_price_control_currency_symbol"], l = o["data-product_price_currency_location"] || "0", s = o["data-product_price_control_formated"], p = s !== "false" && s !== "0", S = o["data-card_orientation_control_value"] === "horizontal" ? "horizontal" : "vertical", y = t.querySelector('a[product-attr="name"]'), f = (y == null ? void 0 : y.getAttribute("style")) || void 0, g = t.querySelector('a[product-attr="button"]') ?? t.querySelector('[product-attr="button"]'), I = (g == null ? void 0 : g.getAttribute("style")) || void 0, w = (i == null ? void 0 : i.getAttribute("style")) || void 0, m = t.querySelector("p.original-price") ?? t.querySelector('[product-attr="originalPrice"]'), A = m != null && m.getAttribute("style") ? m : (m == null ? void 0 : m.closest("p")) ?? m, k = (A == null ? void 0 : A.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), B = (E == null ? void 0 : E.getAttribute("style")) || void 0;
141
139
  return {
142
140
  orientation: S,
143
141
  itemsType: e,
144
- itemId: c,
145
- currencySymbol: d,
142
+ itemId: n,
143
+ currencySymbol: u,
146
144
  currencyLocation: l,
147
145
  formattedPrice: p,
148
146
  configBlockAttributes: o,
149
- nameStyles: y,
147
+ nameStyles: f,
150
148
  buttonStyles: I,
151
- priceStyles: k,
152
- originalPriceStyles: q,
153
- quantityStyles: w
149
+ priceStyles: w,
150
+ originalPriceStyles: k,
151
+ quantityStyles: B
154
152
  };
155
153
  }
156
154
  /**
@@ -161,8 +159,8 @@ class z {
161
159
  * card migrates with the boilerplate defaults: caption "Buy", USD, full-width button.
162
160
  */
163
161
  applyDomFallbacks(t, e) {
164
- var S, f;
165
- const a = t.querySelector("esd-config-block"), r = (...y) => !a || y.every((g) => !(a.getAttribute(g) ?? "").trim());
162
+ var S, y;
163
+ const a = t.querySelector("esd-config-block"), r = (...f) => !a || f.every((g) => !(a.getAttribute(g) ?? "").trim());
166
164
  Object.entries({
167
165
  image: '[product-attr="imageSrc"]',
168
166
  name: '[product-attr="name"]',
@@ -170,17 +168,17 @@ class z {
170
168
  original_price: '[product-attr="originalPrice"], p.original-price',
171
169
  quantity: '[product-attr="quantity"]',
172
170
  button: '[product-attr="button"]'
173
- }).forEach(([y, g]) => {
174
- const I = `data-product_${y}_control_enabled`;
171
+ }).forEach(([f, g]) => {
172
+ const I = `data-product_${f}_control_enabled`;
175
173
  r(I) && (e[I] = t.querySelector(g) ? "true" : "false");
176
174
  }), r("data-card_orientation_control_value") && (e["data-card_orientation_control_value"] = t.querySelector('[colspan="2"]') ? "vertical" : "horizontal");
177
- const c = t.querySelector('a[product-attr="button"]') ?? t.querySelector('[product-attr="button"]'), o = (S = c == null ? void 0 : c.textContent) == null ? void 0 : S.replace(/\s+/g, " ").trim();
175
+ const n = t.querySelector('a[product-attr="button"]') ?? t.querySelector('[product-attr="button"]'), o = (S = n == null ? void 0 : n.textContent) == null ? void 0 : S.replace(/\s+/g, " ").trim();
178
176
  o && r("data-product_button_control_label") && (e["data-product_button_control_label"] = o);
179
- const i = (c == null ? void 0 : c.getAttribute("style")) || "";
177
+ const i = (n == null ? void 0 : n.getAttribute("style")) || "";
180
178
  r("data-product_button_control_atw") && /display:\s*inline/.test(i) && !/(?:^|;)\s*width\s*:\s*100%/.test(i) && (e["data-product_button_control_atw"] = "false");
181
- const d = t.querySelector('[product-attr="imageSrc"]'), l = d ? this.readImageSize(d) : null, s = (l == null ? void 0 : l.height) ?? (l == null ? void 0 : l.width), p = (l == null ? void 0 : l.width) ?? (l == null ? void 0 : l.height);
179
+ const u = t.querySelector('[product-attr="imageSrc"]'), l = u ? this.readImageSize(u) : null, s = (l == null ? void 0 : l.height) ?? (l == null ? void 0 : l.width), p = (l == null ? void 0 : l.width) ?? (l == null ? void 0 : l.height);
182
180
  s && r("data-product_image_control_image-height") && (e["data-product_image_control_image-height"] = s), p && r("data-product_image_control_image-width") && (e["data-product_image_control_image-width"] = p), this.applyPriceDomFallbacks(t, e, r);
183
- const T = ((f = t.querySelector('[product-attr="name"]')) == null ? void 0 : f.getAttribute("style")) || "";
181
+ const T = ((y = t.querySelector('[product-attr="name"]')) == null ? void 0 : y.getAttribute("style")) || "";
184
182
  r("data-product_name_control_trim") && /white-space:\s*normal/.test(T) && (e["data-product_name_control_trim"] = "0");
185
183
  }
186
184
  /**
@@ -191,15 +189,15 @@ class z {
191
189
  * the default back over the real value.
192
190
  */
193
191
  applyPriceDomFallbacks(t, e, a) {
194
- var d;
192
+ var u;
195
193
  const r = t.querySelector('[product-attr="price"]') ?? t.querySelector('[product-attr="originalPrice"]');
196
194
  if (!r)
197
195
  return;
198
- const u = (d = r.getAttribute("data-currency_symbol")) == null ? void 0 : d.trim();
199
- u && a("data-product_price_control_currency_symbol") && (e["data-product_price_control_currency_symbol"] = u);
200
- const c = r.getAttribute("data-curency");
201
- if (c && a("data-product_price_currency_location", "data-product_price_control_curency")) {
202
- const l = c === "after" ? "1" : "0";
196
+ const d = (u = r.getAttribute("data-currency_symbol")) == null ? void 0 : u.trim();
197
+ d && a("data-product_price_control_currency_symbol") && (e["data-product_price_control_currency_symbol"] = d);
198
+ const n = r.getAttribute("data-curency");
199
+ if (n && a("data-product_price_currency_location", "data-product_price_control_curency")) {
200
+ const l = n === "after" ? "1" : "0";
203
201
  e["data-product_price_currency_location"] = l, e["data-product_price_control_curency"] = l;
204
202
  }
205
203
  const o = r.getAttribute("data-formated");
@@ -234,14 +232,14 @@ class z {
234
232
  * to nothing, so only a positive integer counts as an answer.
235
233
  */
236
234
  readImageDimension(t, e) {
237
- var d;
235
+ var u;
238
236
  const a = (l) => {
239
237
  const s = (l ?? "").trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i), p = s ? Math.floor(parseFloat(s[1])) : 0;
240
238
  return p > 0 ? String(p) : null;
241
- }, r = a((d = t.getAttribute(e)) == null ? void 0 : d.trim());
239
+ }, r = a((u = t.getAttribute(e)) == null ? void 0 : u.trim());
242
240
  if (r)
243
241
  return r;
244
- const u = t.getAttribute("style") || "", c = new RegExp(`(?:^|;)\\s*${e}:\\s*(\\d+(?:\\.\\d+)?)px`), o = new RegExp(`max-${e}:\\s*(\\d+(?:\\.\\d+)?)px`), i = u.match(c) || u.match(o);
242
+ const d = t.getAttribute("style") || "", n = new RegExp(`(?:^|;)\\s*${e}:\\s*(\\d+(?:\\.\\d+)?)px`), o = new RegExp(`max-${e}:\\s*(\\d+(?:\\.\\d+)?)px`), i = d.match(n) || d.match(o);
245
243
  return a(i == null ? void 0 : i[1]);
246
244
  }
247
245
  /**
@@ -252,26 +250,26 @@ class z {
252
250
  * @param itemNumber - The item number (1-based index)
253
251
  */
254
252
  extractConfigBlockAttributes(t, e, a) {
255
- const r = t.querySelector("esd-config-block"), u = {};
253
+ const r = t.querySelector("esd-config-block"), d = {};
256
254
  if (r) {
257
255
  if (Array.from(r.attributes).forEach((o) => {
258
- o.name.startsWith("data-") && (u[o.name] = o.value);
259
- }), u["data-cart_items_select_control_value"]) {
260
- const o = u["data-cart_items_select_control_value"];
256
+ o.name.startsWith("data-") && (d[o.name] = o.value);
257
+ }), d["data-cart_items_select_control_value"]) {
258
+ const o = d["data-cart_items_select_control_value"];
261
259
  if (/^\d+$/.test(o)) {
262
- const i = parseInt(o) - 1, d = h[e];
263
- d && d[i] && (u["data-cart_items_select_control_value"] = d[i].value);
260
+ const i = parseInt(o) - 1, u = h[e];
261
+ u && u[i] && (d["data-cart_items_select_control_value"] = u[i].value);
264
262
  }
265
263
  }
266
- if (u["data-product_price_control_curency"]) {
267
- const o = u["data-product_price_control_curency"];
264
+ if (d["data-product_price_control_curency"]) {
265
+ const o = d["data-product_price_control_curency"];
268
266
  let i = o;
269
- o === "before" ? i = "0" : o === "after" && (i = "1"), u["data-product_price_control_curency"] = i, u["data-product_price_currency_location"] = i;
267
+ o === "before" ? i = "0" : o === "after" && (i = "1"), d["data-product_price_control_curency"] = i, d["data-product_price_currency_location"] = i;
270
268
  }
271
- (!u["data-product_price_control_currency_symbol"] || u["data-product_price_control_currency_symbol"].trim() === "") && (u["data-product_price_control_currency_symbol"] = "USD");
269
+ (!d["data-product_price_control_currency_symbol"] || d["data-product_price_control_currency_symbol"].trim() === "") && (d["data-product_price_control_currency_symbol"] = "USD");
272
270
  }
273
- const c = { ...this.getDefaultConfigBlockAttributes(), ...u };
274
- return c["data-type"] = e, c["data-source"] = e, c["data-product_image_link"] = Y(e, a), c["data-product_button_link"] = W(e, a), c;
271
+ const n = { ...this.getDefaultConfigBlockAttributes(), ...d };
272
+ return n["data-type"] = e, n["data-source"] = e, n["data-product_image_link"] = H(e, a), n["data-product_button_link"] = $(e, a), n;
275
273
  }
276
274
  /**
277
275
  * Returns default esd-config-block attributes based on the old template structure
@@ -345,29 +343,27 @@ class z {
345
343
  backfillV2ProductTdAttributes(t) {
346
344
  if (!t.includes("ins-product-td") || !t.includes("esd-ext-config"))
347
345
  return t;
348
- const e = this.parser.parseFromString(H(t), "text/html");
346
+ const e = this.parser.parseFromString(t, "text/html");
349
347
  let a = !1;
350
348
  return e.querySelectorAll(".ins-product-td").forEach((r) => {
351
- r.hasAttribute("width") && (r.removeAttribute("width"), a = !0), r.classList.contains("esd-container-frame") && (r.classList.remove("esd-container-frame"), a = !0), r.querySelectorAll("table.ins-product-wrapper").forEach((d) => {
352
- d.hasAttribute("width") && d.getAttribute("width") !== "100%" && (d.setAttribute("width", "100%"), a = !0);
353
- const l = d.getAttribute("style");
354
- l && L(l) && (d.setAttribute("style", x(l)), d.setAttribute("width", "100%"), a = !0);
355
- });
356
- const u = r.getAttribute("esd-ext-config");
357
- let c = null;
349
+ r.hasAttribute("width") && (r.removeAttribute("width"), a = !0), r.classList.contains("esd-container-frame") && (r.classList.remove("esd-container-frame"), a = !0);
350
+ const d = r.querySelector("table.ins-product-wrapper");
351
+ d != null && d.hasAttribute("width") && d.getAttribute("width") !== "100%" && (d.setAttribute("width", "100%"), a = !0);
352
+ const n = r.getAttribute("esd-ext-config");
353
+ let o = null;
358
354
  try {
359
- c = u ? JSON.parse(u) : null;
355
+ o = n ? JSON.parse(n) : null;
360
356
  } catch {
361
357
  }
362
- if (!c || (!r.getAttribute("data-nodup") && typeof c.priceHideDiscount == "boolean" && (r.setAttribute("data-nodup", String(c.priceHideDiscount)), a = !0), r.getAttribute("data-type")))
358
+ if (!o || (!r.getAttribute("data-nodup") && typeof o.priceHideDiscount == "boolean" && (r.setAttribute("data-nodup", String(o.priceHideDiscount)), a = !0), r.getAttribute("data-type")))
363
359
  return;
364
- const o = c.type || c.source;
365
- if (!o)
360
+ const i = o.type || o.source;
361
+ if (!i)
366
362
  return;
367
- r.setAttribute("data-type", o), a = !0;
368
- const i = typeof c.itemsSelectValue == "string" ? c.itemsSelectValue.match(/\((\d+)\)/) : null;
369
- i && r.getAttribute("data-number") !== i[1] && r.setAttribute("data-number", i[1]);
370
- }), a ? $(e.documentElement.outerHTML) : t;
363
+ r.setAttribute("data-type", i), a = !0;
364
+ const u = typeof o.itemsSelectValue == "string" ? o.itemsSelectValue.match(/\((\d+)\)/) : null;
365
+ u && r.getAttribute("data-number") !== u[1] && r.setAttribute("data-number", u[1]);
366
+ }), a ? e.documentElement.outerHTML : t;
371
367
  }
372
368
  /**
373
369
  * Fast check for the presence of any items block (cart / browsed / purchased)
@@ -401,9 +397,9 @@ class z {
401
397
  `), r;
402
398
  }
403
399
  }
404
- function X(n) {
405
- return new z().migrate(n);
400
+ function J(c) {
401
+ return new F().migrate(c);
406
402
  }
407
403
  export {
408
- X as migrateItemsBlock
404
+ J as migrateItemsBlock
409
405
  };