@useinsider/guido 3.20.0 → 3.20.1-beta.07e0277

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 (113) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +11 -10
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +114 -103
  5. package/dist/components/organisms/AutoSaveController.vue2.js +19 -9
  6. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  7. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +25 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  9. package/dist/components/organisms/header/EditorActions.vue2.js +57 -72
  10. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  11. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +98 -0
  12. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  13. package/dist/components/organisms/header/HeaderWrapper.vue2.js +9 -17
  14. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  15. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  16. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  17. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  18. package/dist/components/organisms/header/RightSlot.vue.js +11 -10
  19. package/dist/components/organisms/header/RightSlot.vue2.js +13 -18
  20. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  21. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  22. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +22 -0
  23. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  24. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +19 -0
  25. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +90 -0
  26. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
  27. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +60 -35
  28. package/dist/composables/useAccessibilityApi.js +51 -0
  29. package/dist/composables/useCustomInterfaceAppearance.js +42 -41
  30. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  31. package/dist/composables/useStripo.js +4 -3
  32. package/dist/config/compiler/itemsCompilerRules.js +21 -5
  33. package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
  34. package/dist/config/i18n/en/labels.json.js +36 -4
  35. package/dist/config/i18n/en/tooltips.json.js +2 -1
  36. package/dist/config/migrator/itemsBlockMigrator.js +112 -108
  37. package/dist/extensions/Blocks/Items/block.js +76 -64
  38. package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
  39. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  40. package/dist/extensions/Blocks/Recommendation/block.js +51 -44
  41. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +103 -91
  42. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +308 -218
  43. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
  44. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +232 -186
  45. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
  46. package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
  47. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
  48. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
  49. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +63 -27
  50. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +39 -20
  51. package/dist/guido.css +1 -1
  52. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  53. package/dist/package.json.js +1 -1
  54. package/dist/sprite.svg +10 -0
  55. package/dist/src/@types/config/schemas.d.ts +2 -0
  56. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +19 -1
  57. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  58. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -19
  59. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -19
  60. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  61. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  62. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  63. package/dist/src/composables/useAccessibilityApi.d.ts +13 -0
  64. package/dist/src/composables/useActionsApi.d.ts +2 -2
  65. package/dist/src/composables/useConfig.d.ts +2 -0
  66. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
  67. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  68. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  69. package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
  70. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
  71. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  72. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  73. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +2 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  76. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
  77. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  78. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  79. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +20 -3
  80. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  81. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  82. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  86. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -6
  87. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
  88. package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
  89. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
  90. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +10 -1
  91. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  92. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  93. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  94. package/dist/src/stores/autosave.d.ts +73 -1
  95. package/dist/src/stores/config.d.ts +20 -0
  96. package/dist/src/stores/editor.d.ts +109 -0
  97. package/dist/src/stores/onboarding.d.ts +966 -35
  98. package/dist/src/stores/version-history.d.ts +1 -1
  99. package/dist/src/utils/liquidProtection.d.ts +3 -0
  100. package/dist/src/utils/timeUtil.d.ts +5 -8
  101. package/dist/static/styles/components/accessibility.css.js +234 -0
  102. package/dist/static/styles/components/button.css.js +5 -0
  103. package/dist/static/styles/variables.css.js +2 -0
  104. package/dist/stores/autosave.js +12 -7
  105. package/dist/stores/editor.js +8 -3
  106. package/dist/stores/onboarding.js +48 -22
  107. package/dist/utils/liquidProtection.js +5 -0
  108. package/dist/utils/templatePreparation.js +61 -85
  109. package/dist/utils/timeUtil.js +6 -17
  110. package/package.json +3 -3
  111. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  112. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  113. /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → AutoSaveStatus.vue.d.ts} +0 -0
@@ -1,28 +1,75 @@
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) {
1
+ import { PRODUCT_WRAPPER_SELECTOR as h, hasZeroWidthDeclaration as E, isZeroWidthValue as f, withWidthPin as T, PRODUCT_TD_SELECTOR as _, withoutZeroWidth as y } from "../../../extensions/Blocks/Items/constants/cardWidth.js";
2
+ import { DefaultConfigValues as D } from "../../../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ import { protectLiquid as p, restoreLiquid as A } from "../../../utils/liquidProtection.js";
4
+ const m = "MSO_ITEMS_HIDE_START", S = "MSO_ITEMS_HIDE_END", M = "mso-hide:all; max-height:0; overflow:hidden; font-size:0; line-height:0;", I = ".ins-product-cart td.horizontal-price, .ins-product-cart td.vertical-price", O = ".ins-product-td td.product-image-class img[width]", g = Number(D.productImageWidth);
5
+ function C(t) {
3
6
  if (!t.includes("vertical-price") || !t.includes("ins-product-cart"))
4
7
  return t;
5
- const i = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(i, "text/html");
8
+ const s = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), o = new DOMParser().parseFromString(s, "text/html");
6
9
  let n = !1;
7
- if (r.querySelectorAll(_).forEach((e) => {
8
- var s, a;
9
- const o = e.getAttribute("style") || "";
10
- if (!/display\s*:\s*none/i.test(o))
10
+ if (o.querySelectorAll(I).forEach((e) => {
11
+ var d, u;
12
+ const r = e.getAttribute("style") || "";
13
+ if (!/display\s*:\s*none/i.test(r))
11
14
  return;
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}`);
15
+ const l = e.previousSibling;
16
+ if (((l == null ? void 0 : l.nodeType) !== Node.COMMENT_NODE || l.data !== m) && ((d = e.parentNode) == null || d.insertBefore(o.createComment(m), e), (u = e.parentNode) == null || u.insertBefore(o.createComment(S), e.nextSibling)), !/mso-hide/i.test(r)) {
17
+ const a = r.trim().endsWith(";") ? " " : "; ";
18
+ e.setAttribute("style", `${r}${a}${M}`);
16
19
  }
17
20
  n = !0;
18
21
  }), !n)
19
22
  return t;
20
- const l = i.match(/<!DOCTYPE[^>]*>/i);
21
- return ((l ? `${l[0]}
22
- ` : "") + r.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
23
+ const c = s.match(/<!DOCTYPE[^>]*>/i);
24
+ return ((c ? `${c[0]}
25
+ ` : "") + o.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
26
+ }
27
+ function N(t) {
28
+ if (!t.includes("ins-product-wrapper") && !t.includes("ins-product-td"))
29
+ return t;
30
+ const s = new DOMParser().parseFromString(p(t), "text/html");
31
+ let o = !1;
32
+ if (s.querySelectorAll(h).forEach((i) => {
33
+ const e = i.getAttribute("style") || "";
34
+ if (!E(e) && !f(i.getAttribute("width")))
35
+ return;
36
+ const r = T(e);
37
+ r !== e && (i.setAttribute("style", r), o = !0), f(i.getAttribute("width")) && (i.setAttribute("width", "100%"), o = !0);
38
+ }), s.querySelectorAll(_).forEach((i) => {
39
+ const e = i.getAttribute("style") || "";
40
+ if (E(e)) {
41
+ const r = y(e);
42
+ r ? i.setAttribute("style", r) : i.removeAttribute("style"), o = !0;
43
+ }
44
+ f(i.getAttribute("width")) && (i.removeAttribute("width"), o = !0);
45
+ }), !o)
46
+ return t;
47
+ const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
48
+ ` : "";
49
+ return A(c + s.documentElement.outerHTML);
50
+ }
51
+ function L(t) {
52
+ if (!t.includes("product-image-class"))
53
+ return t;
54
+ const s = new DOMParser().parseFromString(p(t), "text/html");
55
+ let o = !1;
56
+ if (s.querySelectorAll(O).forEach((i) => {
57
+ var u, a;
58
+ const e = ((u = i.getAttribute("width")) == null ? void 0 : u.trim()) ?? "", r = ((a = i.getAttribute("style")) == null ? void 0 : a.trim()) ?? "";
59
+ if (!/^\d+$/.test(e) || /(^|;)\s*min-width\s*:/i.test(r))
60
+ return;
61
+ const l = r && !r.endsWith(";") ? ";" : "", d = Math.min(Number(e), g);
62
+ i.setAttribute("style", `${r}${l}min-width:${d}px;max-width:${e}px`), o = !0;
63
+ }), !o)
64
+ return t;
65
+ const n = t.match(/<!DOCTYPE[^>]*>/i), c = n ? `${n[0]}
66
+ ` : "";
67
+ return A(c + s.documentElement.outerHTML);
23
68
  }
24
69
  export {
25
- E as MSO_ITEMS_HIDE_END,
26
- p as MSO_ITEMS_HIDE_START,
27
- T as wrapHiddenPriceTdsForOutlook
70
+ S as MSO_ITEMS_HIDE_END,
71
+ m as MSO_ITEMS_HIDE_START,
72
+ L as lockHorizontalItemImageWidths,
73
+ N as normalizeItemsBlockWidths,
74
+ C as wrapHiddenPriceTdsForOutlook
28
75
  };
@@ -1,19 +1,51 @@
1
- const e = "Items", o = "Default", t = "Custom", s = {
1
+ const e = "Items", o = "Default", i = "Custom", t = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
3
  "Structures & Modules": "Structures and Modules",
4
4
  "Recommendation Block": "Recommendation Block",
5
5
  Items: e,
6
6
  "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
7
  "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
+ "email-editor.a11y-hide-images": "Hide images",
9
+ "email-editor.a11y-show-images": "Show images",
10
+ "email-editor.cvd-none": "No Color Deficiency",
11
+ "email-editor.cvd-protanopia": "Protanopia",
12
+ "email-editor.cvd-protanopia-description": "Causes red-green confusion and makes reds appear darker.",
13
+ "email-editor.cvd-deuteranopia": "Deuteranopia",
14
+ "email-editor.cvd-deuteranopia-description": "Causes red-green confusion.",
15
+ "email-editor.cvd-tritanopia": "Tritanopia",
16
+ "email-editor.cvd-tritanopia-description": "Causes blue-yellow confusion.",
17
+ "email-editor.cvd-achromatopsia": "Achromatopsia",
18
+ "email-editor.cvd-achromatopsia-description": "Causes complete color blindness.",
19
+ "email-editor.more-actions": "More actions",
20
+ "email-editor.preferences": "Preferences",
21
+ "email-editor.actions": "Actions",
22
+ "email-editor.accessibility-test": "Accessibility Test",
23
+ "email-editor.autosaved-at-today": "{boldStart}Autosaved{boldEnd} at {time}, Today",
24
+ "email-editor.autosaved-at-date": "{boldStart}Autosaved{boldEnd} at {date}",
25
+ "email-editor.export-html": "Export HTML",
26
+ "email-editor.onboarding-kebab-title": "Discover Preferences and Actions",
27
+ "email-editor.onboarding-kebab-description": "You can now access your Preferences and Actions easily such as Autosave, Export HTML, Version History, Accessibility Test and Save As Template.",
28
+ "email-editor.onboarding-autosave-title": "Autosave Your Design",
29
+ "email-editor.onboarding-autosave-description": "You can save your design automatically by enabling Autosave without losing your work.",
30
+ "email-editor.onboarding-accessibility-title": "Test Accessibility of Your Design",
31
+ "email-editor.onboarding-accessibility-description": "You can test the accessibility of your design to see the Failed, Passed items and update the Failed ones accordingly.",
8
32
  "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
33
  "OPT-IN SELECTION": "OPT-IN SELECTION",
10
34
  "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
11
35
  Default: o,
12
- Custom: t
36
+ Custom: i,
37
+ "Foreground color": "Foreground Color",
38
+ "Contrast ratio": "Contrast Ratio",
39
+ "You’ve fixed all issues!": `No Failed Items
40
+ You have no failed items.`,
41
+ "No accessibility issues found": `No Failed Items
42
+ You have no failed items.`,
43
+ "You have no ignored issues yet": `No Ignored Items
44
+ You have no ignored items.`
13
45
  };
14
46
  export {
15
- t as Custom,
47
+ i as Custom,
16
48
  o as Default,
17
49
  e as Items,
18
- s as default
50
+ t as default
19
51
  };
@@ -76,7 +76,8 @@ const e = {
76
76
  "The data source link is unavailable. Please, make sure there is an access to the data source.": "Enter an accessible Data Source Link to contiue.",
77
77
  "The file should not exceed the maximum resolution of {maxImageResolution}px.": "Upload files up to 1024x512 pixels to continue.",
78
78
  "The option is disabled because was overridden in the Code editor": "The option is disabled because it was overridden in the Code Editor.",
79
- "Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit."
79
+ "Dropdown with a list of available data services, preliminarily created in the Data section → Services tab of the Account.": "Service for Data Collection lets you enter a form submission URL for the recipients to submit.",
80
+ 'Read more about the issue on <a target="_blank" rel="noopener noreferrer" href="{url}">ACT Rules Community Group forum</a>': 'Read more about the issue on <a target="_blank" rel="noopener noreferrer" href="{url}">ACT Rules Community Group forum.</a>'
80
81
  };
81
82
  export {
82
83
  e as default
@@ -1,84 +1,86 @@
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);
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);
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";
5
6
  import { ItemInCartOptions as h, DefaultConfigValues as b, SETTINGS_ENUMS as _ } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
6
- import { getDefaultTemplate as L } from "../../extensions/Blocks/Items/template.js";
7
- import { useTemplateStore as x } from "../../stores/template.js";
8
- function O() {
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() {
9
11
  return String(Date.now() + Math.floor(Math.random() * 1e3));
10
12
  }
11
- function P(c) {
12
- return c ? {
13
+ function D(n) {
14
+ return n ? {
13
15
  CartItems: _.ITEMS_TYPE.CART_ITEMS,
14
16
  BrowsedItems: _.ITEMS_TYPE.BROWSED_ITEMS,
15
17
  PurchasedItems: _.ITEMS_TYPE.PURCHASED_ITEMS,
16
18
  CART_ITEMS: _.ITEMS_TYPE.CART_ITEMS,
17
19
  BROWSED_ITEMS: _.ITEMS_TYPE.BROWSED_ITEMS,
18
20
  PURCHASED_ITEMS: _.ITEMS_TYPE.PURCHASED_ITEMS
19
- }[c] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
21
+ }[n] || _.ITEMS_TYPE.CART_ITEMS : _.ITEMS_TYPE.CART_ITEMS;
20
22
  }
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;
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;
23
25
  }
24
- function D(c) {
26
+ function P(n) {
25
27
  var o;
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);
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);
31
33
  }
32
34
  return {
33
35
  initialized: !0,
34
- blockInstanceId: e(c["data-block-instance-id"], O()),
36
+ blockInstanceId: e(n["data-block-instance-id"], F()),
35
37
  source: r,
36
38
  type: r,
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),
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),
43
45
  priceCurrencySymbol: e(
44
- c["data-product_price_control_currency_symbol"],
46
+ n["data-product_price_control_currency_symbol"],
45
47
  b.productPriceCurrencySymbolControlValue
46
48
  ),
47
49
  priceCurrencyLocation: e(
48
- c["data-product_price_currency_location"],
50
+ n["data-product_price_currency_location"],
49
51
  b.productPriceCurrencyLocationControlValue
50
52
  ),
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)
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)
63
65
  };
64
66
  }
65
- function H(c, t) {
67
+ function Y(n, t) {
66
68
  const e = {
67
69
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
68
70
  BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
69
71
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
70
72
  };
71
- return e[c] || e.CART_ITEMS;
73
+ return e[n] || e.CART_ITEMS;
72
74
  }
73
- function $(c, t) {
75
+ function W(n, t) {
74
76
  const e = {
75
77
  CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
76
78
  BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
77
79
  PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
78
80
  };
79
- return e[c] || e.CART_ITEMS;
81
+ return e[n] || e.CART_ITEMS;
80
82
  }
81
- class F {
83
+ class z {
82
84
  constructor() {
83
85
  M(this, "parser");
84
86
  this.parser = new DOMParser();
@@ -90,10 +92,10 @@ class F {
90
92
  const e = this.removeJinjaConditionals(t), a = this.parser.parseFromString(e, "text/html"), r = a.querySelectorAll(
91
93
  "td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
92
94
  );
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({
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({
97
99
  orientation: o.orientation,
98
100
  itemsType: o.itemsType,
99
101
  itemId: o.itemId,
@@ -107,18 +109,18 @@ class F {
107
109
  priceStyles: o.priceStyles,
108
110
  originalPriceStyles: o.originalPriceStyles,
109
111
  quantityStyles: o.quantityStyles,
110
- nodeConfig: D(o.configBlockAttributes)
112
+ nodeConfig: P(o.configBlockAttributes)
111
113
  }), l = this.parser.parseFromString(
112
114
  `<table><tbody><tr>${i}</tr></tbody></table>`,
113
115
  "text/html"
114
116
  ).querySelector("td");
115
- if (l && n.parentNode) {
116
- const s = D(o.configBlockAttributes);
117
+ if (l && c.parentNode) {
118
+ const s = P(o.configBlockAttributes);
117
119
  l.setAttribute("esd-ext-config", JSON.stringify(s)), l.setAttribute("data-type", s.type);
118
120
  const p = l.querySelector("esd-config-block");
119
- p && p.remove(), n.parentNode.replaceChild(l, n);
121
+ p && p.remove(), c.parentNode.replaceChild(l, c);
120
122
  }
121
- }), a.documentElement.outerHTML);
123
+ }), this.backfillV2ProductTdAttributes(a.documentElement.outerHTML));
122
124
  } catch (e) {
123
125
  return console.error("ItemsBlockMigrator failed:", e), t;
124
126
  }
@@ -131,24 +133,24 @@ class F {
131
133
  */
132
134
  extractConfiguration(t) {
133
135
  var C;
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);
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);
137
139
  this.applyDomFallbacks(t, o);
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;
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;
139
141
  return {
140
142
  orientation: S,
141
143
  itemsType: e,
142
- itemId: n,
143
- currencySymbol: u,
144
+ itemId: c,
145
+ currencySymbol: d,
144
146
  currencyLocation: l,
145
147
  formattedPrice: p,
146
148
  configBlockAttributes: o,
147
- nameStyles: f,
149
+ nameStyles: y,
148
150
  buttonStyles: I,
149
- priceStyles: w,
150
- originalPriceStyles: k,
151
- quantityStyles: B
151
+ priceStyles: k,
152
+ originalPriceStyles: q,
153
+ quantityStyles: w
152
154
  };
153
155
  }
154
156
  /**
@@ -159,8 +161,8 @@ class F {
159
161
  * card migrates with the boilerplate defaults: caption "Buy", USD, full-width button.
160
162
  */
161
163
  applyDomFallbacks(t, e) {
162
- var S, y;
163
- const a = t.querySelector("esd-config-block"), r = (...f) => !a || f.every((g) => !(a.getAttribute(g) ?? "").trim());
164
+ var S, f;
165
+ const a = t.querySelector("esd-config-block"), r = (...y) => !a || y.every((g) => !(a.getAttribute(g) ?? "").trim());
164
166
  Object.entries({
165
167
  image: '[product-attr="imageSrc"]',
166
168
  name: '[product-attr="name"]',
@@ -168,17 +170,17 @@ class F {
168
170
  original_price: '[product-attr="originalPrice"], p.original-price',
169
171
  quantity: '[product-attr="quantity"]',
170
172
  button: '[product-attr="button"]'
171
- }).forEach(([f, g]) => {
172
- const I = `data-product_${f}_control_enabled`;
173
+ }).forEach(([y, g]) => {
174
+ const I = `data-product_${y}_control_enabled`;
173
175
  r(I) && (e[I] = t.querySelector(g) ? "true" : "false");
174
176
  }), r("data-card_orientation_control_value") && (e["data-card_orientation_control_value"] = t.querySelector('[colspan="2"]') ? "vertical" : "horizontal");
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();
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();
176
178
  o && r("data-product_button_control_label") && (e["data-product_button_control_label"] = o);
177
- const i = (n == null ? void 0 : n.getAttribute("style")) || "";
179
+ const i = (c == null ? void 0 : c.getAttribute("style")) || "";
178
180
  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");
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);
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);
180
182
  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);
181
- const T = ((y = t.querySelector('[product-attr="name"]')) == null ? void 0 : y.getAttribute("style")) || "";
183
+ const T = ((f = t.querySelector('[product-attr="name"]')) == null ? void 0 : f.getAttribute("style")) || "";
182
184
  r("data-product_name_control_trim") && /white-space:\s*normal/.test(T) && (e["data-product_name_control_trim"] = "0");
183
185
  }
184
186
  /**
@@ -189,15 +191,15 @@ class F {
189
191
  * the default back over the real value.
190
192
  */
191
193
  applyPriceDomFallbacks(t, e, a) {
192
- var u;
194
+ var d;
193
195
  const r = t.querySelector('[product-attr="price"]') ?? t.querySelector('[product-attr="originalPrice"]');
194
196
  if (!r)
195
197
  return;
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";
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";
201
203
  e["data-product_price_currency_location"] = l, e["data-product_price_control_curency"] = l;
202
204
  }
203
205
  const o = r.getAttribute("data-formated");
@@ -232,14 +234,14 @@ class F {
232
234
  * to nothing, so only a positive integer counts as an answer.
233
235
  */
234
236
  readImageDimension(t, e) {
235
- var u;
237
+ var d;
236
238
  const a = (l) => {
237
239
  const s = (l ?? "").trim().match(/^(\d+(?:\.\d+)?)(?:px)?$/i), p = s ? Math.floor(parseFloat(s[1])) : 0;
238
240
  return p > 0 ? String(p) : null;
239
- }, r = a((u = t.getAttribute(e)) == null ? void 0 : u.trim());
241
+ }, r = a((d = t.getAttribute(e)) == null ? void 0 : d.trim());
240
242
  if (r)
241
243
  return r;
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);
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);
243
245
  return a(i == null ? void 0 : i[1]);
244
246
  }
245
247
  /**
@@ -250,26 +252,26 @@ class F {
250
252
  * @param itemNumber - The item number (1-based index)
251
253
  */
252
254
  extractConfigBlockAttributes(t, e, a) {
253
- const r = t.querySelector("esd-config-block"), d = {};
255
+ const r = t.querySelector("esd-config-block"), u = {};
254
256
  if (r) {
255
257
  if (Array.from(r.attributes).forEach((o) => {
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"];
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"];
259
261
  if (/^\d+$/.test(o)) {
260
- const i = parseInt(o) - 1, u = h[e];
261
- u && u[i] && (d["data-cart_items_select_control_value"] = u[i].value);
262
+ const i = parseInt(o) - 1, d = h[e];
263
+ d && d[i] && (u["data-cart_items_select_control_value"] = d[i].value);
262
264
  }
263
265
  }
264
- if (d["data-product_price_control_curency"]) {
265
- const o = d["data-product_price_control_curency"];
266
+ if (u["data-product_price_control_curency"]) {
267
+ const o = u["data-product_price_control_curency"];
266
268
  let i = o;
267
- o === "before" ? i = "0" : o === "after" && (i = "1"), d["data-product_price_control_curency"] = i, d["data-product_price_currency_location"] = i;
269
+ o === "before" ? i = "0" : o === "after" && (i = "1"), u["data-product_price_control_curency"] = i, u["data-product_price_currency_location"] = i;
268
270
  }
269
- (!d["data-product_price_control_currency_symbol"] || d["data-product_price_control_currency_symbol"].trim() === "") && (d["data-product_price_control_currency_symbol"] = "USD");
271
+ (!u["data-product_price_control_currency_symbol"] || u["data-product_price_control_currency_symbol"].trim() === "") && (u["data-product_price_control_currency_symbol"] = "USD");
270
272
  }
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;
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;
273
275
  }
274
276
  /**
275
277
  * Returns default esd-config-block attributes based on the old template structure
@@ -343,27 +345,29 @@ class F {
343
345
  backfillV2ProductTdAttributes(t) {
344
346
  if (!t.includes("ins-product-td") || !t.includes("esd-ext-config"))
345
347
  return t;
346
- const e = this.parser.parseFromString(t, "text/html");
348
+ const e = this.parser.parseFromString(H(t), "text/html");
347
349
  let a = !1;
348
350
  return e.querySelectorAll(".ins-product-td").forEach((r) => {
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;
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;
354
358
  try {
355
- o = n ? JSON.parse(n) : null;
359
+ c = u ? JSON.parse(u) : null;
356
360
  } catch {
357
361
  }
358
- if (!o || (!r.getAttribute("data-nodup") && typeof o.priceHideDiscount == "boolean" && (r.setAttribute("data-nodup", String(o.priceHideDiscount)), a = !0), r.getAttribute("data-type")))
362
+ if (!c || (!r.getAttribute("data-nodup") && typeof c.priceHideDiscount == "boolean" && (r.setAttribute("data-nodup", String(c.priceHideDiscount)), a = !0), r.getAttribute("data-type")))
359
363
  return;
360
- const i = o.type || o.source;
361
- if (!i)
364
+ const o = c.type || c.source;
365
+ if (!o)
362
366
  return;
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;
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;
367
371
  }
368
372
  /**
369
373
  * Fast check for the presence of any items block (cart / browsed / purchased)
@@ -397,9 +401,9 @@ class F {
397
401
  `), r;
398
402
  }
399
403
  }
400
- function J(c) {
401
- return new F().migrate(c);
404
+ function X(n) {
405
+ return new z().migrate(n);
402
406
  }
403
407
  export {
404
- J as migrateItemsBlock
408
+ X as migrateItemsBlock
405
409
  };