@useinsider/guido 3.24.0-beta.0abeefe → 3.24.0-beta.172ae7a

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 (97) hide show
  1. package/README.md +15 -2
  2. package/dist/@types/config/schemas.js +37 -37
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +80 -82
  5. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +17 -0
  6. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +30 -0
  7. package/dist/composables/useActionsApi.js +2 -2
  8. package/dist/composables/useBlocksConfig.js +20 -31
  9. package/dist/composables/useEditorTrackingIds.js +49 -0
  10. package/dist/composables/useHtmlCompiler.js +2 -0
  11. package/dist/composables/useModuleRepair.js +32 -23
  12. package/dist/composables/useStripo.js +70 -70
  13. package/dist/composables/useTranslations.js +1 -2
  14. package/dist/config/compiler/htmlCompilerRules.js +14 -6
  15. package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
  16. package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
  17. package/dist/config/migrator/index.js +10 -9
  18. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +16 -0
  19. package/dist/enums/academy.js +2 -2
  20. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -8
  21. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +28 -24
  22. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +23 -22
  23. package/dist/guido.css +1 -1
  24. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  25. package/dist/node_modules/valibot/dist/index.js +261 -297
  26. package/dist/package.json.js +6 -6
  27. package/dist/services/templateLibraryApi.js +39 -36
  28. package/dist/src/@types/config/schemas.d.ts +4 -4
  29. package/dist/src/composables/useConfig.d.ts +2 -2
  30. package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
  31. package/dist/src/composables/useModuleRepair.d.ts +2 -11
  32. package/dist/src/composables/useStripo.d.ts +1 -1
  33. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +1 -0
  34. package/dist/src/enums/academy.d.ts +1 -1
  35. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  36. package/dist/src/stores/config.d.ts +20 -167
  37. package/dist/src/stores/editor.d.ts +27 -0
  38. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +10 -0
  39. package/dist/src/utils/linkTrackingIds.d.ts +24 -22
  40. package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
  41. package/dist/stores/config.js +6 -13
  42. package/dist/stores/editor.js +1 -0
  43. package/dist/utils/legacyUnsubscribeConversion.js +49 -0
  44. package/dist/utils/linkTrackingIds.js +72 -72
  45. package/dist/utils/pairProductVariables.js +29 -30
  46. package/dist/utils/templatePreparation.js +59 -72
  47. package/dist/utils/trimHrefWhitespace.js +10 -0
  48. package/package.json +1 -1
  49. package/dist/@types/display-condition.js +0 -25
  50. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -17
  51. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
  52. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  53. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
  54. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +0 -17
  55. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +0 -45
  56. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -36
  57. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
  58. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  59. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  60. package/dist/composables/useDisplayConditions.js +0 -117
  61. package/dist/enums/display-condition.js +0 -12
  62. package/dist/extensions/DisplayConditions/bridge.js +0 -25
  63. package/dist/extensions/DisplayConditions/constants.js +0 -26
  64. package/dist/extensions/DisplayConditions/control.js +0 -215
  65. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -226
  66. package/dist/extensions/DisplayConditions/extension.js +0 -28
  67. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  68. package/dist/extensions/DisplayConditions/library.js +0 -30
  69. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  70. package/dist/extensions/LinkTracking/extension.js +0 -17
  71. package/dist/extensions/LinkTracking/writer.js +0 -41
  72. package/dist/services/displayConditionApi.js +0 -39
  73. package/dist/src/@types/display-condition.d.ts +0 -60
  74. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  75. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +0 -18
  76. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  77. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  78. package/dist/src/composables/useDisplayConditions.d.ts +0 -18
  79. package/dist/src/enums/display-condition.d.ts +0 -15
  80. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
  81. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -23
  82. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
  83. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  84. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  85. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  86. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  87. package/dist/src/extensions/LinkTracking/extension.d.ts +0 -2
  88. package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
  89. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  90. package/dist/src/services/displayConditionApi.d.ts +0 -8
  91. package/dist/src/stores/display-condition.d.ts +0 -84
  92. package/dist/src/utils/displayCondition.d.ts +0 -11
  93. package/dist/src/utils/protectTableText.d.ts +0 -2
  94. package/dist/stores/display-condition.js +0 -29
  95. package/dist/utils/displayCondition.js +0 -26
  96. package/dist/utils/protectTableText.js +0 -22
  97. /package/dist/src/components/organisms/{display-conditions/DisplayConditionCreateDrawer.vue.d.ts → unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts} +0 -0
@@ -1,14 +1,13 @@
1
1
  import { useConfig as C } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as O } from "../../../composables/useRecommendation.js";
3
- import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as T } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useRecommendationExtensionStore as B } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { protectTableText as N, restoreTableText as L } from "../../../utils/protectTableText.js";
6
- import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
7
- function R(t, r, e, o, c = "") {
3
+ import { MOBILE_ROW_SELECTOR as q, MOBILE_CONTAINER_SELECTOR as M, CSS_CLASS_RECO_BUTTON as B } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useRecommendationExtensionStore as N } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { isIgnoredRecommendationBlock as T } from "./recommendationIgnoreUtils.js";
6
+ function L(t, r, e, o, c = "") {
8
7
  const i = `{{${c}${t}_${r}_${e}}}`, n = `{{${c}${t}_${r}_currency}}`;
9
8
  return o === "before" ? `${n} ${i}` : `${i} ${n}`;
10
9
  }
11
- function b(t) {
10
+ function A(t) {
12
11
  let r = t;
13
12
  for (; r.children.length === 1; )
14
13
  [r] = r.children;
@@ -20,12 +19,12 @@ function _(t, r, e, o, c, i) {
20
19
  const n = t.querySelector("img");
21
20
  n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
22
21
  const s = t.querySelector("a");
23
- s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(T));
22
+ s && (s.setAttribute("href", `{{${i}${e}_${o}_url}}`), s.classList.add(B));
24
23
  break;
25
24
  }
26
25
  case "productName": {
27
26
  const n = t.querySelector("p");
28
- n && (b(n).textContent = `{{${i}${e}_${o}_name}}`);
27
+ n && (A(n).textContent = `{{${i}${e}_${o}_name}}`);
29
28
  break;
30
29
  }
31
30
  // Inline mode ("Move to next line" OFF) merges BOTH prices into one row
@@ -33,16 +32,16 @@ function _(t, r, e, o, c, i) {
33
32
  // substitute by cell content, not by the row's anchor (SD-145161).
34
33
  case "productPrice":
35
34
  case "productOldPrice": {
36
- const n = (l, d) => {
37
- l && (b(l).textContent = R(
35
+ const n = (a, l) => {
36
+ a && (A(a).textContent = L(
38
37
  e,
39
38
  o,
40
- d,
39
+ l,
41
40
  c,
42
41
  i
43
42
  ));
44
- }, s = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !s && !a ? t.querySelector("p") : null;
45
- n(s ?? (r === "productPrice" ? u : null), "price"), n(a ?? (r === "productOldPrice" ? u : null), "original_price");
43
+ }, s = t.querySelector(".product-price p"), d = t.querySelector(".product-old-price p"), u = !s && !d ? t.querySelector("p") : null;
44
+ n(s ?? (r === "productPrice" ? u : null), "price"), n(d ?? (r === "productOldPrice" ? u : null), "original_price");
46
45
  break;
47
46
  }
48
47
  case "productButton": {
@@ -71,72 +70,72 @@ function _(t, r, e, o, c, i) {
71
70
  default: {
72
71
  const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
73
72
  if (n) {
74
- const s = n.getAttribute("product-attr"), a = n.querySelector("p");
75
- a && (b(a).textContent = `{{${i}${e}_${o}_${s}}}`);
73
+ const s = n.getAttribute("product-attr"), d = n.querySelector("p");
74
+ d && (A(d).textContent = `{{${i}${e}_${o}_${s}}}`);
76
75
  }
77
76
  break;
78
77
  }
79
78
  }
80
79
  }
81
- const w = "name";
80
+ const P = "name";
82
81
  function y(t, r, e, o) {
83
- const c = `${o}${r}_${e}_${w}`;
82
+ const c = `${o}${r}_${e}_${P}`;
84
83
  return {
85
84
  open: t.createComment(`{% if ${c} and ${c} != "" %}`),
86
85
  close: t.createComment("{% endif %}")
87
86
  };
88
87
  }
89
- function D(t, r, e) {
88
+ function R(t, r, e) {
90
89
  return y(t, r, 0, e);
91
90
  }
92
- function v(t, r, e, o) {
91
+ function w(t, r, e, o) {
93
92
  if (!t.innerHTML.includes("{{"))
94
93
  return;
95
94
  const { open: c, close: i } = y(t.ownerDocument, r, e, o);
96
95
  t.insertBefore(c, t.firstChild), t.appendChild(i);
97
96
  }
98
- function W(t, r, e, o) {
97
+ function D(t, r, e, o) {
99
98
  var n, s;
100
99
  if (!t.innerHTML.includes("{{"))
101
100
  return;
102
101
  const { open: c, close: i } = y(t.ownerDocument, r, e, o);
103
102
  (n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
104
103
  }
105
- function H(t, r, e, o) {
104
+ function v(t, r, e, o) {
106
105
  t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
107
- i.querySelectorAll("[data-attribute-type]").forEach((a) => {
108
- const u = a.getAttribute("data-attribute-type") || "", l = a.querySelectorAll(".attribute-cell");
109
- l.length > 0 ? l.forEach((d) => {
110
- _(d, u, r, n, e, o);
111
- }) : _(a, u, r, n, e, o);
112
- }), W(i, r, n, o);
106
+ i.querySelectorAll("[data-attribute-type]").forEach((d) => {
107
+ const u = d.getAttribute("data-attribute-type") || "", a = d.querySelectorAll(".attribute-cell");
108
+ a.length > 0 ? a.forEach((l) => {
109
+ _(l, u, r, n, e, o);
110
+ }) : _(d, u, r, n, e, o);
111
+ }), D(i, r, n, o);
113
112
  });
114
113
  }
115
- function x(t, r, e, o) {
114
+ function H(t, r, e, o) {
116
115
  const c = t.querySelectorAll(".recommendation-product-row");
117
116
  if (!c.length)
118
117
  return;
119
118
  const [i] = c, n = i.querySelector("[data-attribute-type]"), s = n ? n.querySelectorAll(".attribute-cell").length : 1;
120
- c.forEach((a, u) => {
121
- a.querySelectorAll("[data-attribute-type]").forEach((d) => {
122
- const p = d.getAttribute("data-attribute-type") || "";
123
- d.querySelectorAll(".attribute-cell").forEach((m, h) => {
119
+ c.forEach((d, u) => {
120
+ d.querySelectorAll("[data-attribute-type]").forEach((l) => {
121
+ const p = l.getAttribute("data-attribute-type") || "";
122
+ l.querySelectorAll(".attribute-cell").forEach((m, h) => {
124
123
  const S = u * s + h;
125
- _(m, p, r, S, e, o), v(m, r, S, o);
124
+ _(m, p, r, S, e, o), w(m, r, S, o);
126
125
  });
127
126
  });
128
127
  });
129
128
  }
130
- function F(t, r, e, o) {
129
+ function W(t, r, e, o) {
131
130
  t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
132
- x(i, r, e, o);
131
+ H(i, r, e, o);
133
132
  });
134
133
  }
135
- function G(t, r, e) {
134
+ function F(t, r, e) {
136
135
  const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment"), i = c === "0" || c === "before" ? "before" : "after";
137
- o === "list" ? H(t, r, i, e) : F(t, r, i, e);
136
+ o === "list" ? v(t, r, i, e) : W(t, r, i, e);
138
137
  }
139
- function A(t, r, e) {
138
+ function b(t, r, e) {
140
139
  const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
141
140
  return c ? parseInt(c[1]) : e;
142
141
  }
@@ -151,7 +150,7 @@ function g(t) {
151
150
  const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
152
151
  return e && $(e[1]) ? e[1] : null;
153
152
  }
154
- function V(t, r) {
153
+ function x(t, r) {
155
154
  let e = t.parentElement;
156
155
  for (; e && e !== r; ) {
157
156
  if (e.tagName === "TD" && g(e))
@@ -160,64 +159,62 @@ function V(t, r) {
160
159
  }
161
160
  return null;
162
161
  }
163
- function U(t) {
164
- const r = t.getAttribute("style") || "", e = A(r, "width", 600), o = A(r, "padding", 0) * 2, c = Math.max(0, e - o);
162
+ function G(t) {
163
+ const r = t.getAttribute("style") || "", e = b(r, "width", 600), o = b(r, "padding", 0) * 2, c = Math.max(0, e - o);
165
164
  c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
166
165
  if (i.hasAttribute("width"))
167
166
  return;
168
- const n = V(i, t);
167
+ const n = x(i, t);
169
168
  if (!n)
170
169
  return;
171
- const s = g(n), a = A(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), l = Math.max(1, u - a), d = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(d);
170
+ const s = g(n), d = b(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
172
171
  if (p) {
173
- i.setAttribute("width", String(Math.max(1, Math.min(l, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
172
+ i.setAttribute("width", String(Math.max(1, Math.min(a, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
174
173
  return;
175
174
  }
176
- if (i.setAttribute("width", String(l)), !/\bwidth\s*:\s*\d/i.test(d)) {
177
- const f = d && !d.trim().endsWith(";") ? "; " : "";
178
- i.setAttribute("style", `${d}${f}width: ${l}px`);
175
+ if (i.setAttribute("width", String(a)), !/\bwidth\s*:\s*\d/i.test(l)) {
176
+ const f = l && !l.trim().endsWith(";") ? "; " : "";
177
+ i.setAttribute("style", `${l}${f}width: ${a}px`);
179
178
  }
180
179
  });
181
180
  }
182
- const E = "MSO_MOBILE_HIDE_START", X = "MSO_MOBILE_HIDE_END";
183
- function j(t, r) {
181
+ const E = "MSO_MOBILE_HIDE_START", V = "MSO_MOBILE_HIDE_END";
182
+ function U(t, r) {
184
183
  t.querySelectorAll(q).forEach((e) => {
185
184
  var i, n;
186
185
  const o = e.querySelector(M);
187
186
  if (!o || o.children.length === 0)
188
187
  return;
189
188
  const c = e.previousSibling;
190
- (c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(X), e.nextSibling));
189
+ (c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(V), e.nextSibling));
191
190
  });
192
191
  }
193
- function Y(t, r) {
192
+ function X(t, r) {
194
193
  const e = t.match(/<!DOCTYPE[^>]*>/i);
195
194
  return (e ? `${e[0]}
196
195
  ` : "") + r.documentElement.outerHTML;
197
196
  }
198
- function I(t) {
199
- const r = N(t).replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
197
+ function Q(t) {
198
+ const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
200
199
  if (!o.length)
201
200
  return t;
202
- const { buildCampaignUrl: c } = O(), i = B();
201
+ const { buildCampaignUrl: c } = O(), i = N();
203
202
  i.recommendationCampaignUrls = {};
204
203
  const { isFeatureEnabled: n } = C(), s = n("liquidSyntax") ? "reco_" : "";
205
- o.forEach((u) => {
206
- var d, p, f, m;
207
- const l = u.getAttribute("recommendation-id");
208
- if (l) {
209
- if ((d = u.parentNode) == null || d.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(l), j(u, e), !P(u)) {
210
- G(u, l, s);
211
- const { open: h, close: S } = D(e, l, s);
204
+ return o.forEach((u) => {
205
+ var l, p, f, m;
206
+ const a = u.getAttribute("recommendation-id");
207
+ if (a) {
208
+ if ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(a), U(u, e), !T(u)) {
209
+ F(u, a, s);
210
+ const { open: h, close: S } = R(e, a, s);
212
211
  (f = u.parentNode) == null || f.insertBefore(h, u), (m = u.parentNode) == null || m.insertBefore(S, u.nextSibling);
213
212
  }
214
- U(u);
213
+ G(u);
215
214
  }
216
- });
217
- const a = Y(r, e);
218
- return L(a.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
215
+ }), X(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
219
216
  }
220
217
  export {
221
- R as formatPriceVariable,
222
- I as prepareRecommendationBlocks
218
+ L as formatPriceVariable,
219
+ Q as prepareRecommendationBlocks
223
220
  };
@@ -1,18 +1,19 @@
1
1
  import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
2
  import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
3
  import { migrateFullStoryScripts as a } from "./fullStoryScriptMigrator.js";
4
- import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
- import { migrateProductNameLink as c } from "./productNameLinkMigrator.js";
6
- import { migrateRadioButton as g } from "./radioButtonMigrator.js";
7
- import { migrateRecommendation as p } from "./recommendationMigrator.js";
8
- import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
4
+ import { migrateItemsBlock as c } from "./itemsBlockMigrator.js";
5
+ import { migrateLegacyUnsubscribeText as g } from "./legacyUnsubscribeTextMigrator.js";
6
+ import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
7
+ import { migrateRadioButton as p } from "./radioButtonMigrator.js";
8
+ import { migrateRecommendation as f } from "./recommendationMigrator.js";
9
+ import { migrateRecommendationPartnerScope as s } from "./recommendationPartnerMigrator.js";
9
10
  import { migrateRecommendationTitle as l } from "./recommendationTitleMigrator.js";
10
- import { migrateSocialIcons as s } from "./socialIconMigrator.js";
11
+ import { migrateSocialIcons as u } from "./socialIconMigrator.js";
11
12
  import { migrateUnsubscribe as d } from "./unsubscribeMigrator.js";
12
- const h = async (o, t = {}, r) => {
13
+ const U = async (o, t = {}, r) => {
13
14
  let m = o;
14
- return m = i(m), m = g(m), m = await d(m), m = e(m), m = p(m, t), r && (m = f(m, r)), m = l(m), m = n(m), m = c(m), m = s(m), m = a(m), m;
15
+ return m = i(m), m = p(m), m = g(m), m = await d(m), m = e(m), m = f(m, t), r && (m = s(m, r)), m = l(m), m = c(m), m = n(m), m = u(m), m = a(m), m;
15
16
  };
16
17
  export {
17
- h as migrate
18
+ U as migrate
18
19
  };
@@ -0,0 +1,16 @@
1
+ import { useConfigStore as o } from "../../stores/config.js";
2
+ import { useEditorStore as s } from "../../stores/editor.js";
3
+ import { hasLegacyUnsubscribeClass as c, convertLegacyUnsubscribeInDocumentHtml as i } from "../../utils/legacyUnsubscribeConversion.js";
4
+ const b = (e) => {
5
+ try {
6
+ if (!c(e) || !o().isFeatureEnabled("legacyUnsubscribeConversion"))
7
+ return e;
8
+ const { html: r, converted: t } = i(e);
9
+ return t && (s().isLegacyUnsubscribeModalRequested = !0), r;
10
+ } catch (r) {
11
+ return console.error("LegacyUnsubscribeTextMigrator failed:", r), e;
12
+ }
13
+ };
14
+ export {
15
+ b as migrateLegacyUnsubscribeText
16
+ };
@@ -2,8 +2,8 @@ const e = "https://academy.insiderone.com", o = {
2
2
  EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
3
3
  GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
5
- EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
6
- EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`
5
+ EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`,
6
+ LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`
7
7
  };
8
8
  export {
9
9
  o as ACADEMY_LINKS
@@ -17,9 +17,9 @@ import { CurrencyControl as U } from "./currency.js";
17
17
  import { CURRENCY_CONTROL_ID as Ie } from "./currency.js";
18
18
  import { FiltersControl as v } from "./filters.js";
19
19
  import { FILTERS_CONTROL_ID as ke } from "./filters.js";
20
- import { LayoutOrientationControl as A } from "./layoutOrientation.js";
20
+ import { LayoutOrientationControl as w } from "./layoutOrientation.js";
21
21
  import { LAYOUT_ORIENTATION_CONTROL_ID as Oe } from "./layoutOrientation.js";
22
- import { LocaleControl as w } from "./locale.js";
22
+ import { LocaleControl as A } from "./locale.js";
23
23
  import { LOCALE_CONTROL_ID as Be } from "./locale.js";
24
24
  import { PricePlacementControl as V } from "./pricePlacement.js";
25
25
  import { PRICE_PLACEMENT_CONTROL_ID as Le } from "./pricePlacement.js";
@@ -28,7 +28,7 @@ import { PRODUCT_COUNT_CONTROL_ID as Ee } from "./productCount.js";
28
28
  import { ProductLayoutControl as x } from "./productLayout.js";
29
29
  import { PRODUCT_LAYOUT_CONTROL_ID as ve } from "./productLayout.js";
30
30
  import { ShuffleControl as M } from "./shuffle.js";
31
- import { SHUFFLE_CONTROL_ID as we } from "./shuffle.js";
31
+ import { SHUFFLE_CONTROL_ID as Ae } from "./shuffle.js";
32
32
  import { StrategyControl as G } from "./strategy.js";
33
33
  import { STRATEGY_CONTROL_ID as We } from "./strategy.js";
34
34
  import { setCurrencyAttributes as $, getBlockElement as z, isPartnerManagedBlock as H, updateProductContentInPlace as Y, regenerateProductRowsWithStyles as j } from "./utils.js";
@@ -128,7 +128,7 @@ class _e extends I {
128
128
  return this.rrsEnabled = f().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
129
129
  var o;
130
130
  return (o = t == null ? void 0 : t.onDestroy) == null ? void 0 : o.call(t);
131
- }), this.algorithmControl = new E(), this.localeControl = new w(), this.currencyControl = new U(), this.productCountControl = new W(), this.productLayoutControl = new x(), this.filtersControl = new v(), this.shuffleControl = new M(), this.pricePlacementControl = new V(), this.layoutOrientationControl = new A(), this.strategyControl = this.rrsEnabled ? new G() : null, this._subControls.forEach((t) => {
131
+ }), this.algorithmControl = new E(), this.localeControl = new A(), this.currencyControl = new U(), this.productCountControl = new W(), this.productLayoutControl = new x(), this.filtersControl = new v(), this.shuffleControl = new M(), this.pricePlacementControl = new V(), this.layoutOrientationControl = new w(), this.strategyControl = this.rrsEnabled ? new G() : null, this._subControls.forEach((t) => {
132
132
  t && (t.api = this.api);
133
133
  }), `
134
134
  <div class="recommendation-controls-container">
@@ -452,7 +452,9 @@ class _e extends I {
452
452
  e,
453
453
  this._getNodeConfigUpdates(n.recommendationConfigs),
454
454
  h
455
- ) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || o) && this._refreshOutsidePanel(e, i);
455
+ ) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e });
456
+ const s = o && n.drawnProducts !== n.recommendationProducts;
457
+ (i || s) && this._refreshOutsidePanel(e, i);
456
458
  } catch (n) {
457
459
  console.error("[recommendation] finishing the block outside the panel failed", n);
458
460
  }
@@ -552,8 +554,8 @@ export {
552
554
  v as FiltersControl,
553
555
  Oe as LAYOUT_ORIENTATION_CONTROL_ID,
554
556
  Be as LOCALE_CONTROL_ID,
555
- A as LayoutOrientationControl,
556
- w as LocaleControl,
557
+ w as LayoutOrientationControl,
558
+ A as LocaleControl,
557
559
  Le as PRICE_PLACEMENT_CONTROL_ID,
558
560
  Ee as PRODUCT_COUNT_CONTROL_ID,
559
561
  ve as PRODUCT_LAYOUT_CONTROL_ID,
@@ -561,7 +563,7 @@ export {
561
563
  W as ProductCountControl,
562
564
  x as ProductLayoutControl,
563
565
  _e as RecommendationBlockControl,
564
- we as SHUFFLE_CONTROL_ID,
566
+ Ae as SHUFFLE_CONTROL_ID,
565
567
  We as STRATEGY_CONTROL_ID,
566
568
  M as ShuffleControl,
567
569
  G as StrategyControl,
@@ -1,6 +1,6 @@
1
1
  import { useToaster as L } from "../../../../composables/useToaster.js";
2
2
  import { useTranslations as U } from "../../../../composables/useTranslations.js";
3
- import { getRecommendationFeedSourceMaps as F, strategyEditPath as z, strategyCreatePath as B, getOperatorOptions as M, PriceAttributes as N } from "../../../../enums/extensions/recommendationBlock.js";
3
+ import { getRecommendationFeedSourceMaps as w, strategyEditPath as z, strategyCreatePath as B, getOperatorOptions as M, PriceAttributes as N } from "../../../../enums/extensions/recommendationBlock.js";
4
4
  import { ToasterTypeOptions as E } from "../../../../enums/toaster.js";
5
5
  import { useRecommendationApi as O } from "../../../../services/recommendationApi.js";
6
6
  import { useConfigStore as R } from "../../../../stores/config.js";
@@ -8,21 +8,21 @@ import { defineStore as V } from "pinia";
8
8
  import "../constants/selectors.js";
9
9
  import { DEFAULT_MOBILE_CARDS_IN_ROW as A, DEFAULT_CARDS_IN_ROW as x } from "../constants/layout.js";
10
10
  import { CURRENT_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as T, EXCLUDED_ALGORITHM_IDS as j } from "../constants/defaultConfig.js";
11
- import { getDefaultProducts as w } from "../templates/utils.js";
11
+ import { getDefaultProducts as F } from "../templates/utils.js";
12
12
  import { generateCompleteFilterQuery as P } from "../utils/filterUtil.js";
13
13
  import { isLegacyStrategyConfig as $ } from "../utils/legacyStrategyMigration.js";
14
14
  import { getPartnerRecommendationParams as q } from "../utils/partnerCustomizations.js";
15
15
  import { sanitizeProductIds as K } from "../utils/productIds.js";
16
16
  import { isFilterValid as H } from "../validation/filterSchema.js";
17
17
  import { getInvalidFields as J, isConfigValid as Q } from "../validation/requiredFields.js";
18
- const m = O();
18
+ const u = O();
19
19
  let p = null, y = null;
20
20
  const I = /* @__PURE__ */ new Map();
21
21
  let k = null, b = 0;
22
- const u = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
22
+ const m = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
23
23
  function W(t) {
24
24
  const e = _.get(t);
25
- return e && e.token === u.get(t) ? e.outcome : !1;
25
+ return e && e.token === m.get(t) ? e.outcome : !1;
26
26
  }
27
27
  let l = null;
28
28
  const X = () => {
@@ -80,7 +80,8 @@ function G() {
80
80
  syncedConfigFingerprint: null,
81
81
  legacyConversionLoading: !1,
82
82
  configVersion: 0,
83
- adoptedSizeVersion: 0
83
+ adoptedSizeVersion: 0,
84
+ drawnProducts: null
84
85
  };
85
86
  }
86
87
  const Y = () => ({
@@ -173,7 +174,7 @@ const Y = () => ({
173
174
  return [...new Set(t.map((e) => e.filterGroup))].sort((e, n) => e - n);
174
175
  },
175
176
  getActivePredictiveAlgorithms: (t) => {
176
- const e = F(), n = [];
177
+ const e = w(), n = [];
177
178
  return t.activePredictiveAlgorithms.filter((r) => !j.includes(r)).forEach((r) => {
178
179
  n.push(...e.filter((o) => o.id === r));
179
180
  }), n.map((r) => ({
@@ -245,7 +246,7 @@ const Y = () => ({
245
246
  const n = this.blockStates[t];
246
247
  if (n) {
247
248
  const s = structuredClone(n);
248
- s.recommendationConfigs.id = e, s.recommendationConfigs.strategyId && R().isFeatureEnabled("reusableRecommendationStrategy") && (s.isInitialized = !1, s.syncedConfigFingerprint = null), this.blockStates = {
249
+ s.recommendationConfigs.id = e, s.drawnProducts = null, s.recommendationConfigs.strategyId && R().isFeatureEnabled("reusableRecommendationStrategy") && (s.isInitialized = !1, s.syncedConfigFingerprint = null), this.blockStates = {
249
250
  ...this.blockStates,
250
251
  [e]: s
251
252
  };
@@ -256,6 +257,9 @@ const Y = () => ({
256
257
  [o]: i
257
258
  });
258
259
  },
260
+ markProductsDrawn(t, e) {
261
+ this.blockStates[t] && (this.blockStates[t].drawnProducts = e);
262
+ },
259
263
  /**
260
264
  * Marks a block as initialized (initial API data has been fetched).
261
265
  * Automatically cleaned up when removeBlockState deletes the block entry.
@@ -401,7 +405,7 @@ const Y = () => ({
401
405
  const t = b, e = (async () => {
402
406
  this.strategiesLoading = !0;
403
407
  try {
404
- const n = await m.fetchRecommendationStrategies();
408
+ const n = await u.fetchRecommendationStrategies();
405
409
  if (t !== b)
406
410
  return;
407
411
  this.strategies = n, this.strategiesFetched = !0;
@@ -495,7 +499,7 @@ const Y = () => ({
495
499
  const n = typeof t.updated_at == "string" ? t.updated_at : "", r = n ? `${t.strategy_id}:${n}:${e}` : "", o = r ? this.strategyUrlTemplates[r] : void 0;
496
500
  if (o)
497
501
  return o;
498
- const { full_path: i = "" } = await m.generateStrategyEndpoint(t, e) ?? {};
502
+ const { full_path: i = "" } = await u.generateStrategyEndpoint(t, e) ?? {};
499
503
  return r && i && (this.strategyUrlTemplates = {
500
504
  ...this.strategyUrlTemplates,
501
505
  [r]: i
@@ -513,7 +517,7 @@ const Y = () => ({
513
517
  throw new Error("[Guido] convertLegacyStrategy called without an active block");
514
518
  this.blockStates[n].legacyConversionLoading = !0;
515
519
  try {
516
- const r = await m.migrateLegacyStrategy(t, e);
520
+ const r = await u.migrateLegacyStrategy(t, e);
517
521
  this.invalidateStrategies();
518
522
  try {
519
523
  await this.fetchStrategies();
@@ -562,7 +566,7 @@ const Y = () => ({
562
566
  activePredictiveAlgorithms: t,
563
567
  languages: e,
564
568
  currencies: n
565
- } = await m.fetchRecommendationCreateData();
569
+ } = await u.fetchRecommendationCreateData();
566
570
  if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
567
571
  const r = this.blockStates[this.currentRecommendationId];
568
572
  r.filterStatus = !!r.recommendationConfigs.filters.length;
@@ -583,7 +587,7 @@ const Y = () => ({
583
587
  return;
584
588
  }
585
589
  y = (async () => {
586
- const t = await m.fetchRecommendationFilters();
590
+ const t = await u.fetchRecommendationFilters();
587
591
  this.filterList = t;
588
592
  })();
589
593
  try {
@@ -709,14 +713,14 @@ const Y = () => ({
709
713
  await this._doFetchStrategyProducts(e);
710
714
  return;
711
715
  }
712
- const i = (u.get(e) ?? 0) + 1;
713
- u.set(e, i);
716
+ const i = (m.get(e) ?? 0) + 1;
717
+ m.set(e, i);
714
718
  const s = parseInt(r.size) || 6;
715
719
  if (!r.strategy) {
716
720
  this._setBlockProducts(e, [], s);
717
721
  return;
718
722
  }
719
- const a = r.filters.filter((h) => h.isValid), d = P(a), f = ((S = F().find((h) => h.key === r.strategy)) == null ? void 0 : S.path) || "", c = {
723
+ const a = r.filters.filter((h) => h.isValid), d = P(a), f = ((S = w().find((h) => h.key === r.strategy)) == null ? void 0 : S.path) || "", c = {
720
724
  locale: r.language,
721
725
  currency: r.currencySettings.value,
722
726
  partnerName: o.partnerName,
@@ -730,11 +734,11 @@ const Y = () => ({
730
734
  );
731
735
  let g;
732
736
  try {
733
- g = await m.fetchRecommendationProducts(f, c);
737
+ g = await u.fetchRecommendationProducts(f, c);
734
738
  } catch {
735
739
  g = [];
736
740
  }
737
- u.get(e) === i && this._setBlockProducts(e, g, s);
741
+ m.get(e) === i && this._setBlockProducts(e, g, s);
738
742
  },
739
743
  /**
740
744
  * Block-scoped counterpart of `fetchRecommendationProducts`, which only serves the selected block:
@@ -773,8 +777,8 @@ const Y = () => ({
773
777
  return !0;
774
778
  },
775
779
  _doFetchStrategyProducts(t, e = {}) {
776
- const n = (u.get(t) ?? 0) + 1;
777
- u.set(t, n);
780
+ const n = (m.get(t) ?? 0) + 1;
781
+ m.set(t, n);
778
782
  const r = this._loadStrategyProducts(t, n, e);
779
783
  return _.set(t, { token: n, outcome: r }), r;
780
784
  },
@@ -789,20 +793,20 @@ const Y = () => ({
789
793
  if (s) {
790
794
  i = parseInt(String(s.size ?? "")) || i;
791
795
  const a = r.currencySettings.value, f = (await this.resolveStrategyUrlTemplate(s, a)).replaceAll("{locale}", r.language).replaceAll("{currency}", a), c = f.indexOf("?"), g = c === -1 ? f : f.slice(0, c), S = (c === -1 ? "" : f.slice(c + 1)).split("&").filter((v) => v && !v.startsWith("user_id=")), h = S.length ? `${g}?${S.join("&")}` : g;
792
- h && (o = await m.fetchRecommendationProductsByUrl(h));
796
+ h && (o = await u.fetchRecommendationProductsByUrl(h));
793
797
  }
794
798
  } catch {
795
799
  o = [];
796
800
  }
797
- return u.get(t) !== e ? W(t) : !o.length && n ? !1 : (this._setBlockProducts(t, o, i), o.length > 0);
801
+ return m.get(t) !== e ? W(t) : !o.length && n ? !1 : (this._setBlockProducts(t, o, i), o.length > 0);
798
802
  },
799
803
  _setBlockProducts(t, e, n) {
800
804
  if (!this.blockStates[t])
801
805
  return;
802
- const r = e.length > 0 ? e : w(n);
806
+ const r = e.length > 0 ? e : F(n);
803
807
  this.blockStates[t].recommendationProducts = [
804
808
  ...r.slice(0, n),
805
- ...w(Math.max(0, n - r.length))
809
+ ...F(Math.max(0, n - r.length))
806
810
  ];
807
811
  }
808
812
  }