@useinsider/guido 3.1.1 → 3.2.0-beta.1949a28

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 (104) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +66 -54
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +91 -81
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  6. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  7. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  8. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  9. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  10. package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
  11. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  12. package/dist/composables/useActionsApi.js +4 -4
  13. package/dist/composables/useFullStoryBridge.js +14 -0
  14. package/dist/composables/useHtmlCompiler.js +23 -21
  15. package/dist/composables/useHtmlValidator.js +40 -38
  16. package/dist/composables/usePreviewMode.js +20 -16
  17. package/dist/composables/useSave.js +23 -15
  18. package/dist/composables/useStripo.js +52 -47
  19. package/dist/composables/validators/useLiquidValidator.js +42 -0
  20. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  21. package/dist/config/compiler/recommendationCompilerRules.js +162 -43
  22. package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
  23. package/dist/config/compiler/utils/recommendationCompilerUtils.js +52 -46
  24. package/dist/config/i18n/en/tooltips.json.js +2 -1
  25. package/dist/config/migrator/checkboxMigrator.js +5 -3
  26. package/dist/config/migrator/radioButtonMigrator.js +66 -44
  27. package/dist/config/migrator/recommendationMigrator.js +1 -1
  28. package/dist/enums/extensions/recommendationBlock.js +14 -11
  29. package/dist/enums/recommendation.js +2 -2
  30. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  31. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
  32. package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
  33. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  34. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  35. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  36. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  37. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  38. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  39. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  40. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
  41. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  42. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
  43. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  44. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  45. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  46. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  47. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
  48. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
  49. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  50. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  51. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
  52. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  53. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  54. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  55. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  56. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  57. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  58. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  59. package/dist/guido.css +1 -1
  60. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
  61. package/dist/package.json.js +1 -1
  62. package/dist/services/recommendationApi.js +15 -15
  63. package/dist/services/stripoApi.js +9 -9
  64. package/dist/services/templateLibraryApi.js +48 -46
  65. package/dist/src/@types/config/index.d.ts +1 -1
  66. package/dist/src/@types/config/schemas.d.ts +28 -0
  67. package/dist/src/@types/config/types.d.ts +3 -1
  68. package/dist/src/@types/generic.d.ts +0 -1
  69. package/dist/src/@types/save-as-template.d.ts +1 -0
  70. package/dist/src/composables/useActionsApi.d.ts +1 -1
  71. package/dist/src/composables/useConfig.d.ts +12 -0
  72. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  73. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  74. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  75. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  76. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  77. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  78. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  79. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  80. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  81. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  82. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  86. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  87. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  88. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  89. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  90. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  91. package/dist/src/stores/config.d.ts +108 -0
  92. package/dist/src/stores/preview.d.ts +3 -0
  93. package/dist/src/utils/genericUtil.d.ts +1 -1
  94. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  95. package/dist/static/styles/base.css.js +7 -2
  96. package/dist/static/styles/components/button.css.js +16 -9
  97. package/dist/static/styles/components/loader.css.js +4 -0
  98. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  99. package/dist/stores/preview.js +4 -3
  100. package/dist/utils/genericUtil.js +42 -20
  101. package/dist/utils/htmlCompiler.js +48 -41
  102. package/dist/utils/templatePreparation.js +36 -25
  103. package/dist/utils/tooltipUtils.js +4 -5
  104. package/package.json +4 -4
@@ -1,22 +1,24 @@
1
- import { useRecommendation as $ } from "../../../composables/useRecommendation.js";
2
- function b(e, u, r, o) {
3
- const n = `{{${e}_${u}_${r}}}`, t = `{{${e}_${u}_currency}}`;
1
+ import { useConfig as S } from "../../../composables/useConfig.js";
2
+ import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
3
+ import { useRecommendationExtensionStore as d } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ function y(e, u, r, o, s = "") {
5
+ const n = `{{${s}${e}_${u}_${r}}}`, t = `{{${s}${e}_${u}_currency}}`;
4
6
  return o === "before" ? `${t} ${n}` : `${n} ${t}`;
5
7
  }
6
- function p(e, u, r, o, n) {
8
+ function m(e, u, r, o, s, n) {
7
9
  switch (u) {
8
10
  case "productImage": {
9
11
  const t = e.querySelector("img");
10
- t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
12
+ t && (t.setAttribute("src", `{{${n}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${r}_${o}_name}}`));
11
13
  const c = e.querySelector("a");
12
- c && c.setAttribute("href", `{{${r}_${o}_url}}`);
14
+ c && c.setAttribute("href", `{{${n}${r}_${o}_url}}`);
13
15
  break;
14
16
  }
15
17
  case "productName": {
16
18
  const t = e.querySelector("p");
17
19
  if (t) {
18
20
  const c = t.querySelector("strong") || t;
19
- c.textContent = `{{${r}_${o}_name}}`;
21
+ c.textContent = `{{${n}${r}_${o}_name}}`;
20
22
  }
21
23
  break;
22
24
  }
@@ -24,7 +26,7 @@ function p(e, u, r, o, n) {
24
26
  const t = e.querySelector("p");
25
27
  if (t) {
26
28
  const c = t.querySelector("strong") || t;
27
- c.textContent = b(r, o, "price", n);
29
+ c.textContent = y(r, o, "price", s, n);
28
30
  }
29
31
  break;
30
32
  }
@@ -32,10 +34,11 @@ function p(e, u, r, o, n) {
32
34
  const t = e.querySelector("p");
33
35
  if (t) {
34
36
  const c = t.querySelector("strong") || t;
35
- c.textContent = b(
37
+ c.textContent = y(
36
38
  r,
37
39
  o,
38
40
  "original_price",
41
+ s,
39
42
  n
40
43
  ), t.setAttribute("product-attr", "discount");
41
44
  }
@@ -43,13 +46,13 @@ function p(e, u, r, o, n) {
43
46
  }
44
47
  case "productButton": {
45
48
  const t = e.querySelector("a");
46
- t && t.setAttribute("href", `{{${r}_${o}_url}}`);
49
+ t && t.setAttribute("href", `{{${n}${r}_${o}_url}}`);
47
50
  break;
48
51
  }
49
52
  case "productOmnibusPrice": {
50
53
  const t = e.querySelector(".omnibus-price-value");
51
54
  if (t) {
52
- t.textContent = `{{${r}_${o}_omnibus_price}}`;
55
+ t.textContent = `{{${n}${r}_${o}_omnibus_price}}`;
53
56
  const c = t.closest("p");
54
57
  c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
55
58
  }
@@ -58,7 +61,7 @@ function p(e, u, r, o, n) {
58
61
  case "productOmnibusDiscount": {
59
62
  const t = e.querySelector(".omnibus-discount-value");
60
63
  if (t) {
61
- t.textContent = `{{${r}_${o}_omnibus_discount}}`;
64
+ t.textContent = `{{${n}${r}_${o}_omnibus_discount}}`;
62
65
  const c = t.closest("p");
63
66
  c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
64
67
  }
@@ -67,66 +70,69 @@ function p(e, u, r, o, n) {
67
70
  default: {
68
71
  const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
69
72
  if (t) {
70
- const c = t.getAttribute("product-attr"), s = t.querySelector("p");
71
- if (s) {
72
- const i = s.querySelector("strong") || s;
73
- i.textContent = `{{${r}_${o}_${c}}}`;
73
+ const c = t.getAttribute("product-attr"), a = t.querySelector("p");
74
+ if (a) {
75
+ const i = a.querySelector("strong") || a;
76
+ i.textContent = `{{${n}${r}_${o}_${c}}}`;
74
77
  }
75
78
  }
76
79
  break;
77
80
  }
78
81
  }
79
82
  }
80
- function S(e, u, r) {
83
+ function q(e, u, r, o) {
81
84
  e.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
82
- n.querySelectorAll("[data-attribute-type]").forEach((s) => {
83
- const i = s.getAttribute("data-attribute-type") || "", l = s.querySelectorAll(".attribute-cell");
84
- l.length > 0 ? l.forEach((a) => {
85
- p(a, i, u, t, r);
86
- }) : p(s, i, u, t, r);
85
+ n.querySelectorAll("[data-attribute-type]").forEach((a) => {
86
+ const i = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
87
+ l.length > 0 ? l.forEach((p) => {
88
+ m(p, i, u, t, r, o);
89
+ }) : m(a, i, u, t, r, o);
87
90
  });
88
91
  });
89
92
  }
90
- function _(e, u, r) {
91
- const o = e.querySelectorAll(".recommendation-product-row");
92
- if (!o.length)
93
+ function g(e, u, r, o) {
94
+ const s = e.querySelectorAll(".recommendation-product-row");
95
+ if (!s.length)
93
96
  return;
94
- const [n] = o, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
95
- o.forEach((s, i) => {
96
- s.querySelectorAll("[data-attribute-type]").forEach((a) => {
97
- const f = a.getAttribute("data-attribute-type") || "";
98
- a.querySelectorAll(".attribute-cell").forEach((y, A) => {
99
- const m = i * c + A;
100
- p(y, f, u, m, r);
97
+ const [n] = s, t = n.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
98
+ s.forEach((a, i) => {
99
+ a.querySelectorAll("[data-attribute-type]").forEach((p) => {
100
+ const b = p.getAttribute("data-attribute-type") || "";
101
+ p.querySelectorAll(".attribute-cell").forEach((f, $) => {
102
+ const A = i * c + $;
103
+ m(f, b, u, A, r, o);
101
104
  });
102
105
  });
103
106
  });
104
107
  }
105
- function q(e, u, r) {
108
+ function h(e, u, r, o) {
106
109
  e.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
107
- _(n, u, r);
110
+ g(n, u, r, o);
108
111
  });
109
112
  }
110
- function d(e, u) {
111
- const r = e.getAttribute("data-layout") || "grid", o = e.getAttribute("currency-alignment") || "after";
112
- r === "list" ? S(e, u, o) : q(e, u, o);
113
+ function C(e, u, r) {
114
+ const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
115
+ o === "list" ? q(e, u, s, r) : h(e, u, s, r);
113
116
  }
114
- function g(e, u) {
117
+ function E(e, u) {
115
118
  const r = e.match(/<!DOCTYPE[^>]*>/i);
116
119
  return (r ? `${r[0]}
117
120
  ` : "") + u.documentElement.outerHTML;
118
121
  }
119
- function E(e) {
122
+ function T(e) {
120
123
  const u = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(u, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
121
124
  if (!o.length)
122
125
  return e;
123
- const { buildCampaignUrl: n } = $();
124
- return o.forEach((c) => {
125
- const s = c.getAttribute("recommendation-id");
126
- s && (n(s), d(c, s));
127
- }), g(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
126
+ const { buildCampaignUrl: s } = _(), n = d();
127
+ n.recommendationCampaignUrls = {};
128
+ const { isFeatureEnabled: t } = S(), c = t("liquidSyntax") ? "reco_" : "";
129
+ return o.forEach((i) => {
130
+ var p, b;
131
+ const l = i.getAttribute("recommendation-id");
132
+ l && ((p = i.parentNode) == null || p.insertBefore(r.createComment("REC_START"), i), (b = i.parentNode) == null || b.insertBefore(r.createComment("REC_END"), i.nextSibling), s(l), C(i, l, c));
133
+ }), E(u, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
128
134
  }
129
135
  export {
130
- b as formatPriceVariable,
131
- E as prepareRecommendationBlocks
136
+ y as formatPriceVariable,
137
+ T as prepareRecommendationBlocks
132
138
  };
@@ -75,7 +75,8 @@ const e = {
75
75
  "The image with the invalid link cannot be saved to the image gallery": "Enter a valid image link to continue.",
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
- "The option is disabled because was overridden in the Code editor": "The option is disabled because it was overridden in the Code Editor."
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
80
  };
80
81
  export {
81
82
  e as default
@@ -11,6 +11,8 @@ class f {
11
11
  try {
12
12
  const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
13
13
  return i.length === 0 ? t : (i.forEach((r) => {
14
+ if (r.classList.contains("checkbox-block-v2"))
15
+ return;
14
16
  const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
15
17
  `<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
16
18
  "text/html"
@@ -22,7 +24,7 @@ class f {
22
24
  }
23
25
  }
24
26
  extractTextFromElement(t, e) {
25
- var o, u;
27
+ var o, d;
26
28
  const i = t.querySelector(`.${e}`);
27
29
  if (!i)
28
30
  return {
@@ -41,13 +43,13 @@ class f {
41
43
  align: i.getAttribute("align") || "left",
42
44
  styles: ""
43
45
  };
44
- const n = ((u = r.textContent) == null ? void 0 : u.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g);
46
+ const n = ((d = r.textContent) == null ? void 0 : d.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), u = this.convertInlineToBlock(g);
45
47
  return {
46
48
  text: n,
47
49
  isBold: a,
48
50
  isItalic: p,
49
51
  align: c,
50
- styles: d
52
+ styles: u
51
53
  };
52
54
  }
53
55
  buildTextBlock(t) {
@@ -1,32 +1,54 @@
1
- var b = Object.defineProperty;
2
- var f = (r, t, e) => t in r ? b(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var x = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
4
- import h from "../../extensions/Blocks/RadioButton/template.js";
5
- class T {
1
+ var x = Object.defineProperty;
2
+ var T = (l, e, t) => e in l ? x(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var b = (l, e, t) => T(l, typeof e != "symbol" ? e + "" : e, t);
4
+ import S from "../../extensions/Blocks/RadioButton/template.js";
5
+ class B {
6
6
  constructor() {
7
- x(this, "parser");
7
+ b(this, "parser");
8
8
  this.parser = new DOMParser();
9
9
  }
10
- migrate(t) {
10
+ migrate(e) {
11
11
  try {
12
- const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
13
- return i.length === 0 ? t : (i.forEach((s) => {
14
- const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n), y = this.parser.parseFromString(
15
- `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
12
+ const t = this.parser.parseFromString(e, "text/html"), i = t.querySelectorAll("td.radio-button-block"), s = t.querySelectorAll("td.radio-button-v2");
13
+ if (i.length === 0 && s.length === 0)
14
+ return e;
15
+ let o = !1;
16
+ return i.forEach((r) => {
17
+ if (r.classList.contains("radio-button-v2"))
18
+ return;
19
+ const n = r.getAttribute("id"), a = this.extractTextFromElement(r, "ins-title"), g = this.extractTextFromElement(r, "ins-description"), c = this.extractTextFromElement(r, "ins-subscribe"), u = this.extractTextFromElement(r, "ins-unsubscribe"), d = this.buildTextBlock(a), p = this.buildTextBlock(g), y = this.buildTextBlock({ ...c, classList: "" }), f = this.buildTextBlock({ ...u, classList: "" }), h = S.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", p).replace("{-{-YES-}-}", y).replace("{-{-NO-}-}", f), m = this.parser.parseFromString(
20
+ `<table id="tempDoc"><tbody><tr>${h}</tr></tbody></table>`,
16
21
  "text/html"
17
22
  ).querySelector(".radio-button-v2");
18
- y && s.parentNode && (y.setAttribute("id", o || ""), s.parentNode.replaceChild(y, s));
19
- }), e.documentElement.outerHTML);
20
- } catch (e) {
21
- return console.error("RadioButtonMigrator failed:", e), t;
23
+ m && r.parentNode && (m.setAttribute("id", n || ""), r.parentNode.replaceChild(m, r), o = !0);
24
+ }), o = this.healRadioButtonV2(t) || o, o ? t.documentElement.outerHTML : e;
25
+ } catch (t) {
26
+ return console.error("RadioButtonMigrator failed:", t), e;
22
27
  }
23
28
  }
24
- extractTextFromElement(t, e) {
25
- var n, c;
26
- const i = t.querySelector(`.${e}`);
29
+ healRadioButtonV2(e) {
30
+ let t = !1;
31
+ return e.querySelectorAll("td.radio-button-v2").forEach((i) => {
32
+ var p;
33
+ const s = i.querySelector("input#radioYes"), o = i.querySelector("input#radioNo");
34
+ if (!s || !o)
35
+ return;
36
+ const r = ((p = s.parentElement) == null ? void 0 : p.querySelector(":scope > p")) || null;
37
+ if (!r && !s.hasAttribute("align"))
38
+ return;
39
+ const n = s.closest("tr"), a = o.closest("tr");
40
+ if (!n || !a || n === a || !n.parentNode)
41
+ return;
42
+ const g = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", c = a.cloneNode(!0), u = c.querySelector("input#radioNo"), d = c.querySelector("p");
43
+ u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), d && (d.innerHTML = g), n.parentNode.replaceChild(c, n), t = !0;
44
+ }), t;
45
+ }
46
+ extractTextFromElement(e, t) {
47
+ var p, y;
48
+ const i = e.querySelector(`.${t}`);
27
49
  if (!i)
28
50
  return {
29
- text: e === "ins-title" ? "Title" : "Description",
51
+ text: t === "ins-title" ? "Title" : "Description",
30
52
  isBold: !1,
31
53
  isItalic: !1,
32
54
  align: "left",
@@ -36,51 +58,51 @@ class T {
36
58
  const s = i.querySelector("p");
37
59
  if (!s)
38
60
  return {
39
- text: ((n = i.textContent) == null ? void 0 : n.trim()) || (e === "ins-title" ? "Title" : "Description"),
61
+ text: ((p = i.textContent) == null ? void 0 : p.trim()) || (t === "ins-title" ? "Title" : "Description"),
40
62
  isBold: !1,
41
63
  isItalic: !1,
42
64
  align: i.getAttribute("align") || "left",
43
65
  styles: "",
44
66
  classList: ""
45
67
  };
46
- const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
68
+ const o = ((y = s.textContent) == null ? void 0 : y.trim()) || (t === "ins-title" ? "Title" : "Description"), r = s.getAttribute("style") || "", n = i.getAttribute("align") || s.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(r) || !!s.querySelector("b, strong"), g = /font-style\s*:\s*italic/i.test(r) || !!s.querySelector("i, em"), c = this.removeStyleProperties(r, ["font-weight", "font-style"]), u = this.convertInlineToBlock(c), d = i.getAttribute("class") || "";
47
69
  return {
48
70
  text: o,
49
- isBold: p,
50
- isItalic: u,
51
- align: a,
52
- styles: g,
53
- classList: m
71
+ isBold: a,
72
+ isItalic: g,
73
+ align: n,
74
+ styles: u,
75
+ classList: d
54
76
  };
55
77
  }
56
- buildTextBlock(t) {
57
- let e = t.text;
58
- t.isBold && t.isItalic ? e = `<strong path="1,0"><em path="1,0,0">${e}</em></strong>` : t.isBold ? e = `<strong path="1,0">${e}</strong>` : t.isItalic && (e = `<em path="1,0">${e}</em>`);
59
- const i = t.align ? ` align="${t.align}"` : "", s = t.styles ? ` style="${t.styles.replaceAll('"', "'")}"` : "";
78
+ buildTextBlock(e) {
79
+ let t = e.text;
80
+ e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
81
+ const i = e.align ? ` align="${e.align}"` : "", s = e.styles ? ` style="${e.styles.replaceAll('"', "'")}"` : "";
60
82
  return `
61
- <td class="esd-block-text ${t.classList}" ${i}>
83
+ <td class="esd-block-text ${e.classList}" ${i}>
62
84
  <p path="1" ${s}>
63
- ${e}
85
+ ${t}
64
86
  </p>
65
87
  </td>
66
88
  `;
67
89
  }
68
- removeStyleProperties(t, e) {
69
- return t ? e.reduce((s, o) => {
70
- const l = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
71
- return s.replace(l, "");
72
- }, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
90
+ removeStyleProperties(e, t) {
91
+ return e ? t.reduce((s, o) => {
92
+ const r = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
93
+ return s.replace(r, "");
94
+ }, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
73
95
  }
74
- convertInlineToBlock(t) {
75
- if (!t)
96
+ convertInlineToBlock(e) {
97
+ if (!e)
76
98
  return "";
77
- let e = t.replace(/display\s*:\s*inline/gi, "display: block");
78
- return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
99
+ let t = e.replace(/display\s*:\s*inline/gi, "display: block");
100
+ return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
79
101
  }
80
102
  }
81
- function A(r) {
82
- return new T().migrate(r);
103
+ function q(l) {
104
+ return new B().migrate(l);
83
105
  }
84
106
  export {
85
- A as migrateRadioButton
107
+ q as migrateRadioButton
86
108
  };
@@ -13,7 +13,7 @@ class B {
13
13
  migrate(e) {
14
14
  try {
15
15
  const t = this.parser.parseFromString(e, "text/html"), s = t.querySelectorAll(
16
- 'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
16
+ 'td.ins-recommendation-v3-block-1:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"]:not(.recommendation-block-v2)'
17
17
  );
18
18
  return w().$patch((i) => {
19
19
  i.migrations = { ...i.migrations, [S]: s.length };
@@ -1,6 +1,8 @@
1
1
  const s = {
2
2
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
3
- }, i = [
3
+ }, i = {
4
+ CLIENT_ID: "clientId"
5
+ }, u = [
4
6
  { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
5
7
  { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
6
8
  { id: 13, key: "userBased", name: "User Based", path: "user-based" },
@@ -11,13 +13,13 @@ const s = {
11
13
  { id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
12
14
  { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
13
15
  { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
14
- ], u = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], l = [
16
+ ], l = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], c = [
15
17
  { text: "before the amount", value: "0" },
16
18
  { text: "after the amount", value: "1" }
17
- ], c = [
19
+ ], d = [
18
20
  { text: "dot(.)", value: "." },
19
21
  { text: "comma(,)", value: "," }
20
- ], d = [
22
+ ], p = [
21
23
  { text: "0", value: "0" },
22
24
  { text: "1", value: "1" },
23
25
  { text: "2", value: "2" },
@@ -46,7 +48,7 @@ const s = {
46
48
  ], n = [
47
49
  { text: "true", value: "==" },
48
50
  { text: "false", value: "!=" }
49
- ], p = (t) => {
51
+ ], m = (t) => {
50
52
  if (!t)
51
53
  return e;
52
54
  switch (t) {
@@ -65,13 +67,14 @@ const s = {
65
67
  }
66
68
  };
67
69
  export {
68
- u as PriceAttributes,
69
- i as RecommendationFeedSourceMaps,
70
+ l as PriceAttributes,
71
+ i as QUERY_PARAMS,
72
+ u as RecommendationFeedSourceMaps,
70
73
  s as URLS,
71
- d as currencyDecimalCounts,
72
- l as currencyLocationMaps,
73
- c as currencyOperators,
74
- p as getOperatorOptions,
74
+ p as currencyDecimalCounts,
75
+ c as currencyLocationMaps,
76
+ d as currencyOperators,
77
+ m as getOperatorOptions,
75
78
  a as operatorOptionsForArrayOfStrings,
76
79
  n as operatorOptionsForBooleans,
77
80
  o as operatorOptionsForDates,
@@ -28,8 +28,8 @@ const e = 20, s = 320, t = "vertical", m = {
28
28
  ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
29
29
  ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
30
30
  COMPOSITION: /composition="true"/gm,
31
- CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
32
- CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
31
+ CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
32
+ CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
33
33
  CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
34
34
  }, n = {
35
35
  PARAGRAPH_END_TAG: "</p>"
@@ -1,29 +1,40 @@
1
- import { BlockType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { COUPON_BLOCK_ID as e } from "./block.js";
3
- const t = `
4
- <${o.BLOCK_TEXT}
1
+ import { useConfig as n } from "../../../composables/useConfig.js";
2
+ import { BlockType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ import { COUPON_BLOCK_ID as t } from "./block.js";
4
+ const c = "{@COUPON_CODE}", s = "{{ins_coupon_code}}";
5
+ function l() {
6
+ const { isFeatureEnabled: o } = n();
7
+ return o("liquidSyntax") ? s : c;
8
+ }
9
+ function i(o) {
10
+ return `
11
+ <${e.BLOCK_TEXT}
5
12
  class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
6
13
  align="center"
7
- esd-extension-block-id="${e}">
14
+ esd-extension-block-id="${t}">
8
15
  <p
9
16
  path="1"
10
17
  contenteditable="false"
11
18
  style="font-size: 16px; color: #333333;">
12
- <strong path="1,0">{@COUPON_CODE}</strong>
19
+ <strong path="1,0">${o}</strong>
13
20
  </p>
14
- </${o.BLOCK_TEXT}>
15
- `, l = `
21
+ </${e.BLOCK_TEXT}>
22
+ `;
23
+ }
24
+ const u = `
16
25
  <td
17
26
  class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
18
- esd-extension-block-id="${e}"
27
+ esd-extension-block-id="${t}"
19
28
  >
20
29
  <p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
21
30
  </td>
22
31
  `;
23
- function s() {
24
- return t;
32
+ function d() {
33
+ return i(l());
25
34
  }
26
35
  export {
27
- l as default,
28
- s as getDefaultTemplate
36
+ c as COUPON_PLACEHOLDER_DEFAULT,
37
+ s as COUPON_PLACEHOLDER_LIQUID,
38
+ u as default,
39
+ d as getDefaultTemplate
29
40
  };
@@ -1,75 +1,75 @@
1
- import { ModificationDescription as m, UIElementType as _, UEAttr as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as h } from "../../../common-control.js";
3
- import { ItemsBlockControlId as L, ItemsBlockId as R } from "../../enums/controlEnums.js";
4
- import { productPairs as T } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as N } from "../../utils/nodeConfigUtils.js";
6
- const D = L.PRICE_SINGLE_PRICE, l = {
1
+ import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as A } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
4
+ import { productPairs as R } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
+ const u = T.PRICE_SINGLE_PRICE, l = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
- class y extends h {
9
+ class k extends A {
10
10
  getId() {
11
- return D;
11
+ return u;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${L.PRICE_SINGLE_PRICE}">
15
+ <div class="container ${T.PRICE_SINGLE_PRICE}">
16
16
  ${this._getSinglePrice()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
21
  const e = I(this.currentNode);
22
- this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (t) => {
23
- this._onSinglePriceChange(t);
22
+ this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
23
+ this._onSinglePriceChange(i);
24
24
  });
25
25
  }
26
26
  onTemplateNodeUpdated(e) {
27
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = I(this.currentNode);
29
- this.api.updateValues({ [l.SINGLE_PRICE]: (t == null ? void 0 : t.priceSinglePrice) ?? !1 });
28
+ const i = I(this.currentNode);
29
+ this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
30
30
  });
31
31
  }
32
32
  _onSinglePriceChange(e) {
33
- if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
33
+ if (console.debug("Single price changed to: ", e), !this.currentNode)
34
34
  return;
35
- const t = I(this.currentNode), o = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = T.PAIRS_FOR_EXTENSION.price[o], c = T.PAIRS_FOR_EXTENSION.originalPrice[o], [P, p] = e ? [
36
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
37
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
35
+ const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
36
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
37
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
38
38
  ] : [
39
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
40
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
41
- ], s = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, d = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [g, C] = e ? [s, d] : [d, s], n = this.currentNode.closest(".items-block"), S = (n == null ? void 0 : n.querySelectorAll(
42
- `[esd-extension-block-id="${R.PRICE}"]`
43
- )) || [], E = this.api.getDocumentModifier();
44
- S.forEach((a) => {
45
- this._updatePriceBlock(E, a, P, p, e);
46
- }), ((n == null ? void 0 : n.querySelectorAll(
47
- `[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
39
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
40
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
41
+ ], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
42
+ N(this.currentNode, this.api, { priceSinglePrice: e }, s);
43
+ const o = this.currentNode.closest(".items-block");
44
+ ((o == null ? void 0 : o.querySelectorAll(
45
+ `[esd-extension-block-id="${p.PRICE}"]`
48
46
  )) || []).forEach((a) => {
49
- this._updatePriceBlock(E, a, g, C, e);
50
- }), E.apply(new m(
47
+ this._updatePriceBlock(s, a, E, g, e);
48
+ }), ((o == null ? void 0 : o.querySelectorAll(
49
+ `[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
50
+ )) || []).forEach((a) => {
51
+ this._updatePriceBlock(s, a, L, C, e);
52
+ }), s.apply(new S(
51
53
  `Updated price to ${e ? "single" : "total"} price`
52
54
  ));
53
55
  }
54
- _updatePriceBlock(e, t, o, r, i) {
55
- const c = t.getInnerHTML().trim().replace(o, N(r));
56
- e.modifyHtml(t).setInnerHtml(c), t.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
57
- e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
58
- });
56
+ _updatePriceBlock(e, i, c, r, t) {
57
+ const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
58
+ e.modifyHtml(i).setInnerHtml(E);
59
59
  }
60
60
  _getSinglePrice() {
61
61
  return `
62
62
  <div class="display-flex align-items-center justify-content-between">
63
- <${_.LABEL}
64
- ${A.LABEL.text}="${this.api.translate("Show Single Product Price")}"
63
+ <${d.LABEL}
64
+ ${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
65
65
  >
66
- </${_.LABEL}>
66
+ </${d.LABEL}>
67
67
  ${this._GuToggle(l.SINGLE_PRICE)}
68
68
  </div>
69
69
  `;
70
70
  }
71
71
  }
72
72
  export {
73
- D as CONTROL_BLOCK_ID,
74
- y as PriceSinglePriceControl
73
+ u as CONTROL_BLOCK_ID,
74
+ k as PriceSinglePriceControl
75
75
  };