@useinsider/guido 3.4.1-beta.ad76dd1 → 3.4.1-beta.aeb242c

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.
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "cdee3452"
15
+ "b293a2b0"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,42 +1,44 @@
1
- import { defineComponent as J, defineAsyncComponent as R, ref as I, computed as W, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
2
- import { useCortexBlueprintBridge as Z } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as ee } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as oe } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as te } from "../composables/usePartner.js";
6
- import { useStripo as ne } from "../composables/useStripo.js";
7
- import { useTimerClone as re } from "../composables/useTimerClone.js";
1
+ import { defineComponent as Q, defineAsyncComponent as N, ref as I, computed as W, watch as X, onMounted as Y, onUnmounted as Z } from "vue";
2
+ import { useCortexBlueprintBridge as ee } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as oe } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as te } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as ne } from "../composables/usePartner.js";
6
+ import { useStripo as re } from "../composables/useStripo.js";
7
+ import { useTimerClone as se } from "../composables/useTimerClone.js";
8
8
  import { migrate as x } from "../config/migrator/index.js";
9
9
  import { ModuleFolderDefaults as G } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as se } from "../enums/onboarding.js";
11
- import ce from "./organisms/AutoSaveController.vue.js";
12
- import ae from "./organisms/base/Toaster.vue.js";
13
- import ie from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
14
- import me from "./organisms/header/HeaderWrapper.vue.js";
15
- import de from "./organisms/LoadingWrapper.vue.js";
16
- import le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
17
- import ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
18
- import { useStripoApi as pe } from "../services/stripoApi.js";
19
- import { useConfigStore as fe } from "../stores/config.js";
20
- import { useDynamicContentStore as ve } from "../stores/dynamic-content.js";
21
- import { useEditorStore as ye } from "../stores/editor.js";
10
+ import { RIBBON_SELECTOR as ce } from "../enums/onboarding.js";
11
+ import { useRecommendationExtensionStore as ae } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
+ import ie from "./organisms/AutoSaveController.vue.js";
13
+ import me from "./organisms/base/Toaster.vue.js";
14
+ import de from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
+ import le from "./organisms/header/HeaderWrapper.vue.js";
16
+ import ue from "./organisms/LoadingWrapper.vue.js";
17
+ import pe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
+ import fe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
+ import { useStripoApi as ve } from "../services/stripoApi.js";
20
+ import { useConfigStore as ye } from "../stores/config.js";
21
+ import { useDynamicContentStore as Se } from "../stores/dynamic-content.js";
22
+ import { useEditorStore as H } from "../stores/editor.js";
22
23
  import { usePreviewStore as he } from "../stores/preview.js";
23
- import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
24
- const He = /* @__PURE__ */ J({
24
+ import { useTemplateStore as be } from "../stores/template.js";
25
+ import { useUnsubscribeStore as ge } from "../stores/unsubscribe.js";
26
+ const Ke = /* @__PURE__ */ Q({
25
27
  __name: "Guido",
26
28
  props: {
27
29
  config: null
28
30
  },
29
31
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
30
- setup(H, { expose: z, emit: n }) {
31
- const g = H, q = R(
32
+ setup($, { expose: z, emit: n }) {
33
+ const g = $, q = N(
32
34
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
33
- ), K = R(
35
+ ), K = N(
34
36
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
35
- ), w = I(), u = I(), p = ve(), E = Se(), i = fe();
37
+ ), E = I(), u = I(), p = Se(), w = ge(), i = ye();
36
38
  i.init(g.config);
37
- const f = ye(), V = he(), m = W(() => f.hasChanges), { isTestPartner: $ } = te(), D = () => {
39
+ const f = H(), V = he(), m = W(() => f.hasChanges), { isTestPartner: j } = ne(), D = () => {
38
40
  var e;
39
- return (e = w.value) == null ? void 0 : e.handleSave(!0);
41
+ return (e = E.value) == null ? void 0 : e.handleSave(!0);
40
42
  }, {
41
43
  templateId: v,
42
44
  userId: C,
@@ -45,8 +47,8 @@ const He = /* @__PURE__ */ J({
45
47
  template: o,
46
48
  editor: s
47
49
  } = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || G.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || G.DEFAULT_MODULES;
48
- f.templateId = v, Z(), oe();
49
- const h = {
50
+ ee(), te();
51
+ const S = {
50
52
  emailId: v,
51
53
  userId: C,
52
54
  username: k,
@@ -58,11 +60,11 @@ const He = /* @__PURE__ */ J({
58
60
  onReady: () => {
59
61
  console.debug("guido:ready"), n("ready");
60
62
  }
61
- }, { initPlugin: M } = ne(h, _), { getDefaultTemplate: O } = pe(), { cloneTimersOnSave: P, hasTimerBlocks: A } = re(), j = W(() => {
63
+ }, { initPlugin: M } = re(S, _), { getDefaultTemplate: O } = ve(), { cloneTimersOnSave: P, hasTimerBlocks: R } = se(), J = W(() => {
62
64
  var e;
63
65
  return !((e = i.ui) != null && e.showHeader);
64
66
  });
65
- ee({
67
+ oe({
66
68
  onBack: () => {
67
69
  console.debug("guido:back"), n("back");
68
70
  },
@@ -70,50 +72,50 @@ const He = /* @__PURE__ */ J({
70
72
  console.debug("guido:save:start"), n("save:start");
71
73
  },
72
74
  onSaveComplete: (e) => {
73
- const t = { ...e, metadata: h };
75
+ const t = { ...e, metadata: S };
74
76
  console.debug("guido:save:complete", t), n("save:complete", t);
75
77
  },
76
78
  onTestEmailClick: () => {
77
79
  console.debug("guido:test-email:click"), n("test-email:click");
78
80
  }
79
81
  });
80
- const B = (e) => {
82
+ const A = (e) => {
81
83
  console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
82
- }, N = () => {
84
+ }, B = () => {
83
85
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
84
86
  };
85
- Q(() => m.value, () => {
87
+ X(() => m.value, () => {
86
88
  n("on-change", m.value);
87
89
  });
88
- const S = (e) => {
90
+ const h = (e) => {
89
91
  const t = e, { attribute: l, position: a } = t.detail;
90
92
  console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
91
93
  };
92
94
  let c = null;
93
95
  const b = () => {
94
96
  var t;
95
- const e = document.querySelector(se);
97
+ const e = document.querySelector(ce);
96
98
  (t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
97
99
  };
98
- return X(async () => {
100
+ return Y(async () => {
99
101
  var t, l;
100
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b();
102
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ae().$reset(), H().$reset(), f.templateId = v, be().$reset(), b();
101
103
  const e = (t = u.value) == null ? void 0 : t.parentElement;
102
104
  e && (c = new ResizeObserver(b), c.observe(e));
103
105
  try {
104
- E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
106
+ w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
105
107
  const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
106
108
  let r = {
107
109
  html: d && await x(d, a),
108
110
  css: F
109
111
  };
110
- r.html || (r = await O(), r.html = await x(r.html, a)), A(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
112
+ r.html || (r = await O(), r.html = await x(r.html, a)), R(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
111
113
  } catch (a) {
112
114
  console.error("Failed to initialize Stripo editor:", a);
113
115
  }
114
- document.addEventListener("dynamic-content:open", S);
115
- }), Y(() => {
116
- c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", S);
116
+ document.addEventListener("dynamic-content:open", h);
117
+ }), Z(() => {
118
+ c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", h);
117
119
  try {
118
120
  window.UIEditor.removeEditor();
119
121
  } catch {
@@ -122,14 +124,14 @@ const He = /* @__PURE__ */ J({
122
124
  i.reset();
123
125
  }), z({
124
126
  dynamicContent: {
125
- insert: B,
126
- close: N
127
+ insert: A,
128
+ close: B
127
129
  },
128
130
  hasChanges: m,
129
131
  saveSilent: D
130
- }), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: w, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: E, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: $, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: A, noHeader: j, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: S, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ce, Toaster: ae, FilterSelectionDrawer: ie, HeaderWrapper: me, LoadingWrapper: de, SaveAsTemplateDrawer: le, UnsubscribeWrapper: ue };
132
+ }), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: E, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: w, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: j, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: S, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: R, noHeader: J, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: h, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ie, Toaster: me, FilterSelectionDrawer: de, HeaderWrapper: le, LoadingWrapper: ue, SaveAsTemplateDrawer: pe, UnsubscribeWrapper: fe };
131
133
  }
132
134
  });
133
135
  export {
134
- He as default
136
+ Ke as default
135
137
  };
@@ -2,128 +2,126 @@ import { useConfig as S } from "../../../composables/useConfig.js";
2
2
  import { useRecommendation as g } from "../../../composables/useRecommendation.js";
3
3
  import { CSS_CLASS_RECO_BUTTON as _ } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
4
  import { useRecommendationExtensionStore as q } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- function y(r, i, e, o, s = "") {
6
- const c = `{{${s}${r}_${i}_${e}}}`, t = `{{${s}${r}_${i}_currency}}`;
7
- return o === "before" ? `${t} ${c}` : `${c} ${t}`;
5
+ function y(r, c, e, o, s = "") {
6
+ const n = `{{${s}${r}_${c}_${e}}}`, t = `{{${s}${r}_${c}_currency}}`;
7
+ return o === "before" ? `${t} ${n}` : `${n} ${t}`;
8
8
  }
9
- function f(r, i, e, o, s, c) {
10
- switch (i) {
9
+ function f(r, c, e, o, s, n) {
10
+ switch (c) {
11
11
  case "productImage": {
12
12
  const t = r.querySelector("img");
13
- t && (t.setAttribute("src", `{{${c}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${c}${e}_${o}_name}}`));
14
- const n = r.querySelector("a");
15
- n && (n.setAttribute("href", `{{${c}${e}_${o}_url}}`), n.classList.add(_));
13
+ t && (t.setAttribute("src", `{{${n}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${n}${e}_${o}_name}}`));
14
+ const i = r.querySelector("a");
15
+ i && (i.setAttribute("href", `{{${n}${e}_${o}_url}}`), i.classList.add(_));
16
16
  break;
17
17
  }
18
18
  case "productName": {
19
19
  const t = r.querySelector("p");
20
20
  if (t) {
21
- const n = t.querySelector("strong") || t;
22
- n.textContent = `{{${c}${e}_${o}_name}}`;
21
+ const i = t.querySelector("strong") || t;
22
+ i.textContent = `{{${n}${e}_${o}_name}}`;
23
23
  }
24
24
  break;
25
25
  }
26
26
  case "productPrice": {
27
27
  const t = r.querySelector("p");
28
28
  if (t) {
29
- const n = t.querySelector("strong") || t;
30
- n.textContent = y(e, o, "price", s, c);
29
+ const i = t.querySelector("strong") || t;
30
+ i.textContent = y(e, o, "price", s, n);
31
31
  }
32
32
  break;
33
33
  }
34
34
  case "productOldPrice": {
35
35
  const t = r.querySelector("p");
36
36
  if (t) {
37
- let n = t;
38
- for (; n.children.length === 1; )
39
- [n] = n.children;
40
- n.textContent = y(
37
+ const i = t.querySelector("strong") || t;
38
+ i.textContent = y(
41
39
  e,
42
40
  o,
43
41
  "original_price",
44
42
  s,
45
- c
43
+ n
46
44
  ), t.setAttribute("product-attr", "discount");
47
45
  }
48
46
  break;
49
47
  }
50
48
  case "productButton": {
51
49
  const t = r.querySelector("a");
52
- t && t.setAttribute("href", `{{${c}${e}_${o}_url}}`);
50
+ t && t.setAttribute("href", `{{${n}${e}_${o}_url}}`);
53
51
  break;
54
52
  }
55
53
  case "productOmnibusPrice": {
56
54
  const t = r.querySelector(".omnibus-price-value");
57
55
  if (t) {
58
- t.textContent = `{{${c}${e}_${o}_omnibus_price}}`;
59
- const n = t.closest("p");
60
- n && (n.setAttribute("product-attr", "omnibus_price"), n.setAttribute("composition", "true"));
56
+ t.textContent = `{{${n}${e}_${o}_omnibus_price}}`;
57
+ const i = t.closest("p");
58
+ i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
61
59
  }
62
60
  break;
63
61
  }
64
62
  case "productOmnibusDiscount": {
65
63
  const t = r.querySelector(".omnibus-discount-value");
66
64
  if (t) {
67
- t.textContent = `{{${c}${e}_${o}_omnibus_discount}}`;
68
- const n = t.closest("p");
69
- n && (n.setAttribute("product-attr", "omnibus_discount"), n.setAttribute("composition", "true"));
65
+ t.textContent = `{{${n}${e}_${o}_omnibus_discount}}`;
66
+ const i = t.closest("p");
67
+ i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
70
68
  }
71
69
  break;
72
70
  }
73
71
  default: {
74
72
  const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
75
73
  if (t) {
76
- const n = t.getAttribute("product-attr"), a = t.querySelector("p");
74
+ const i = t.getAttribute("product-attr"), a = t.querySelector("p");
77
75
  if (a) {
78
76
  const u = a.querySelector("strong") || a;
79
- u.textContent = `{{${c}${e}_${o}_${n}}}`;
77
+ u.textContent = `{{${n}${e}_${o}_${i}}}`;
80
78
  }
81
79
  }
82
80
  break;
83
81
  }
84
82
  }
85
83
  }
86
- function C(r, i, e, o) {
87
- r.querySelectorAll(".recommendation-product-row").forEach((c, t) => {
88
- c.querySelectorAll("[data-attribute-type]").forEach((a) => {
84
+ function C(r, c, e, o) {
85
+ r.querySelectorAll(".recommendation-product-row").forEach((n, t) => {
86
+ n.querySelectorAll("[data-attribute-type]").forEach((a) => {
89
87
  const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
90
88
  p.length > 0 ? p.forEach((l) => {
91
- f(l, u, i, t, e, o);
92
- }) : f(a, u, i, t, e, o);
89
+ f(l, u, c, t, e, o);
90
+ }) : f(a, u, c, t, e, o);
93
91
  });
94
92
  });
95
93
  }
96
- function w(r, i, e, o) {
94
+ function E(r, c, e, o) {
97
95
  const s = r.querySelectorAll(".recommendation-product-row");
98
96
  if (!s.length)
99
97
  return;
100
- const [c] = s, t = c.querySelector("[data-attribute-type]"), n = t ? t.querySelectorAll(".attribute-cell").length : 1;
98
+ const [n] = s, t = n.querySelector("[data-attribute-type]"), i = t ? t.querySelectorAll(".attribute-cell").length : 1;
101
99
  s.forEach((a, u) => {
102
100
  a.querySelectorAll("[data-attribute-type]").forEach((l) => {
103
101
  const d = l.getAttribute("data-attribute-type") || "";
104
102
  l.querySelectorAll(".attribute-cell").forEach((A, h) => {
105
- const $ = u * n + h;
106
- f(A, d, i, $, e, o);
103
+ const $ = u * i + h;
104
+ f(A, d, c, $, e, o);
107
105
  });
108
106
  });
109
107
  });
110
108
  }
111
- function E(r, i, e, o) {
112
- r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
113
- w(c, i, e, o);
109
+ function w(r, c, e, o) {
110
+ r.querySelectorAll(".ins-recommendation-product-container").forEach((n) => {
111
+ E(n, c, e, o);
114
112
  });
115
113
  }
116
- function R(r, i, e) {
114
+ function R(r, c, e) {
117
115
  const o = r.getAttribute("data-layout") || "grid", s = r.getAttribute("currency-alignment") || "after";
118
- o === "list" ? C(r, i, s, e) : E(r, i, s, e);
116
+ o === "list" ? C(r, c, s, e) : w(r, c, s, e);
119
117
  }
120
- function b(r, i, e) {
121
- const o = new RegExp(`${i}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
118
+ function b(r, c, e) {
119
+ const o = new RegExp(`${c}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
122
120
  return s ? parseInt(s[1]) : e;
123
121
  }
124
- function P(r, i) {
122
+ function P(r, c) {
125
123
  let e = r.parentElement;
126
- for (; e && e !== i; ) {
124
+ for (; e && e !== c; ) {
127
125
  if (e.tagName === "TD") {
128
126
  const o = e.getAttribute("width");
129
127
  if (o && o.endsWith("%") && parseFloat(o) < 100)
@@ -134,39 +132,39 @@ function P(r, i) {
134
132
  return null;
135
133
  }
136
134
  function T(r) {
137
- const i = r.getAttribute("style") || "", e = b(i, "width", 600), o = b(i, "padding", 0) * 2, s = Math.max(0, e - o);
138
- s !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
139
- if (c.hasAttribute("width"))
135
+ const c = r.getAttribute("style") || "", e = b(c, "width", 600), o = b(c, "padding", 0) * 2, s = Math.max(0, e - o);
136
+ s !== 0 && r.querySelectorAll("img.adapt-img").forEach((n) => {
137
+ if (n.hasAttribute("width"))
140
138
  return;
141
- const t = P(c, r);
139
+ const t = P(n, r);
142
140
  if (!t)
143
141
  return;
144
- const n = t.getAttribute("width"), a = parseFloat(n), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
145
- c.setAttribute("width", String(l));
146
- const d = c.getAttribute("style") || "";
142
+ const i = t.getAttribute("width"), a = parseFloat(i), u = b(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
143
+ n.setAttribute("width", String(l));
144
+ const d = n.getAttribute("style") || "";
147
145
  if (!/\bwidth\s*:\s*\d/i.test(d)) {
148
146
  const m = d && !d.trim().endsWith(";") ? "; " : "";
149
- c.setAttribute("style", `${d}${m}width: ${l}px`);
147
+ n.setAttribute("style", `${d}${m}width: ${l}px`);
150
148
  }
151
149
  });
152
150
  }
153
- function v(r, i) {
151
+ function v(r, c) {
154
152
  const e = r.match(/<!DOCTYPE[^>]*>/i);
155
153
  return (e ? `${e[0]}
156
- ` : "") + i.documentElement.outerHTML;
154
+ ` : "") + c.documentElement.outerHTML;
157
155
  }
158
156
  function N(r) {
159
- const i = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(i, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
157
+ const c = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(c, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
160
158
  if (!o.length)
161
159
  return r;
162
- const { buildCampaignUrl: s } = g(), c = q();
163
- c.recommendationCampaignUrls = {};
164
- const { isFeatureEnabled: t } = S(), n = t("liquidSyntax") ? "reco_" : "";
160
+ const { buildCampaignUrl: s } = g(), n = q();
161
+ n.recommendationCampaignUrls = {};
162
+ const { isFeatureEnabled: t } = S(), i = t("liquidSyntax") ? "reco_" : "";
165
163
  return o.forEach((u) => {
166
164
  var l, d;
167
165
  const p = u.getAttribute("recommendation-id");
168
- p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p, n), T(u));
169
- }), v(i, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
166
+ p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p, i), T(u));
167
+ }), v(c, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
170
168
  }
171
169
  export {
172
170
  y as formatPriceVariable,
@@ -1,33 +1,33 @@
1
- var k = Object.defineProperty;
2
- var B = (r, n, t) => n in r ? k(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
- var g = (r, n, t) => B(r, typeof n != "symbol" ? n + "" : n, t);
4
- import { BlockId as _ } from "../../../enums/block.js";
5
- import { getMigrationBannerHtml as b } from "../../../utils/migrationBannerHtml.js";
6
- import { Block as R, BlockCompositionType as y, ModificationDescription as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { regenerateMobileProductRows as A } from "./controls/main/utils.js";
8
- import { ensureMobileCssRulesExist as d, setMobileLayoutOptOut as p, hasMobileLayoutOptOut as D } from "./controls/mobileLayout/cssRules.js";
9
- import { RecommendationConfigService as s } from "./services/configService.js";
10
- import { useRecommendationExtensionStore as f } from "./store/recommendation.js";
11
- import { getDefaultTemplate as E } from "./templates/grid/template.js";
12
- const h = _.Recommendation, l = "recommendation-block-v2", m = "recommendation-id";
13
- let I = !1;
14
- class q extends R {
1
+ var y = Object.defineProperty;
2
+ var B = (a, c, t) => c in a ? y(a, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[c] = t;
3
+ var h = (a, c, t) => B(a, typeof c != "symbol" ? c + "" : c, t);
4
+ import { BlockId as D } from "../../../enums/block.js";
5
+ import { getMigrationBannerHtml as R } from "../../../utils/migrationBannerHtml.js";
6
+ import { Block as b, BlockCompositionType as A, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ import { regenerateMobileProductRows as C } from "./controls/main/utils.js";
8
+ import { ensureMobileCssRulesExist as f, setMobileLayoutOptOut as _, hasMobileLayoutOptOut as E } from "./controls/mobileLayout/cssRules.js";
9
+ import { RecommendationConfigService as l } from "./services/configService.js";
10
+ import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
11
+ import { getDefaultTemplate as N } from "./templates/grid/template.js";
12
+ const I = D.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
13
+ let k = !1;
14
+ class v extends b {
15
15
  constructor() {
16
16
  super();
17
17
  /**
18
18
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
19
19
  * This avoids generating a new (different) ID in onCreated().
20
20
  */
21
- g(this, "_pendingBlockId", null);
21
+ h(this, "_pendingBlockId", null);
22
22
  }
23
23
  getId() {
24
- return h;
24
+ return I;
25
25
  }
26
26
  getIcon() {
27
27
  return "recommendation-icon";
28
28
  }
29
29
  getBlockCompositionType() {
30
- return y.CONTAINER;
30
+ return A.CONTAINER;
31
31
  }
32
32
  getName() {
33
33
  return this.api.translate("Recommendation Block");
@@ -38,8 +38,8 @@ class q extends R {
38
38
  );
39
39
  }
40
40
  getSettingsPanelTitleHtml() {
41
- return b(
42
- h,
41
+ return R(
42
+ I,
43
43
  this.api.translate("Recommendation Block"),
44
44
  this.api.translate("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.")
45
45
  );
@@ -59,7 +59,7 @@ class q extends R {
59
59
  */
60
60
  getTemplate() {
61
61
  const t = this._generateNextId();
62
- return this._pendingBlockId = t, E(t);
62
+ return this._pendingBlockId = t, N(t);
63
63
  }
64
64
  /**
65
65
  * Called when a new block is dropped into the template
@@ -70,24 +70,32 @@ class q extends R {
70
70
  */
71
71
  onCreated(t) {
72
72
  const e = this._getRecommendationId(t);
73
- if (e !== null && e > 0)
73
+ if (e !== null && e > 0) {
74
+ if (this._detectDuplicate(e)) {
75
+ this._handleDuplicate(t, e);
76
+ return;
77
+ }
78
+ this._pendingBlockId === null && setTimeout(() => {
79
+ this._getBlockElement(t) && this._detectDuplicate(e) && this._handleDuplicate(t, e);
80
+ }, 0);
74
81
  return;
82
+ }
75
83
  const i = this._pendingBlockId ?? this._generateNextId();
76
84
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
77
- const { config: o, wasFreshDrop: c } = s.initializeConfig(
85
+ const { config: n, wasFreshDrop: o } = l.initializeConfig(
78
86
  this.api,
79
87
  t,
80
88
  { recommendationId: i }
81
- ), a = f();
82
- if (a.setCurrentBlock(i), c) {
83
- d(this.api);
84
- const u = this._getBlockElement(t);
85
- u && (p(this.api, u, !0), A({
89
+ ), s = g();
90
+ if (s.setCurrentBlock(i), o) {
91
+ f(this.api);
92
+ const r = this._getBlockElement(t);
93
+ r && (_(this.api, r, !0), C({
86
94
  currentNode: t,
87
95
  documentModifier: this.api.getDocumentModifier()
88
96
  }));
89
97
  }
90
- a.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
98
+ s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
91
99
  }
92
100
  /**
93
101
  * Called when the document changes or template is loaded
@@ -100,20 +108,20 @@ class q extends R {
100
108
  if (!(!t || !("getNodeConfig" in t))) {
101
109
  if (!this._getRecommendationId(t)) {
102
110
  const e = this._generateNextId();
103
- this._assignRecommendationId(t, e), s.hasConfig(t) && s.updateConfig(
111
+ this._assignRecommendationId(t, e), l.hasConfig(t) && l.updateConfig(
104
112
  this.api,
105
113
  t,
106
114
  { recommendationId: e },
107
115
  "Assign recommendation ID to legacy block"
108
116
  );
109
117
  }
110
- s.needsMigration(t) && this._migrateFromLegacy(t);
118
+ this._healLingeringDuplicate(t), l.needsMigration(t) && this._migrateFromLegacy(t);
111
119
  try {
112
- I || (d(this.api), I = !0);
113
- const e = s.getConfig(t), i = this._getBlockElement(t);
120
+ k || (f(this.api), k = !0);
121
+ const e = l.getConfig(t), i = this._getBlockElement(t);
114
122
  if (i) {
115
- const o = !e.mobileLayoutEnabled;
116
- D(i) !== o && p(this.api, i, o);
123
+ const n = !e.mobileLayoutEnabled;
124
+ E(i) !== n && _(this.api, i, n);
117
125
  }
118
126
  } catch {
119
127
  }
@@ -127,7 +135,7 @@ class q extends R {
127
135
  */
128
136
  onDelete(t) {
129
137
  const e = this._getRecommendationId(t);
130
- e && f().removeBlockState(e);
138
+ e && g().removeBlockState(e);
131
139
  }
132
140
  /**
133
141
  * Generates the next unique recommendation ID by scanning all existing blocks
@@ -137,16 +145,108 @@ class q extends R {
137
145
  let t = 0;
138
146
  try {
139
147
  const e = this.api.getDocumentRoot();
140
- e && "querySelectorAll" in e && e.querySelectorAll(`.${l}`).forEach((o) => {
141
- if ("getAttribute" in o) {
142
- const c = o.getAttribute(m), a = c ? parseInt(c) : 0;
143
- a > t && (t = a);
148
+ e && "querySelectorAll" in e && e.querySelectorAll(`.${m}`).forEach((n) => {
149
+ if ("getAttribute" in n) {
150
+ const o = n.getAttribute(u), s = o ? parseInt(o) : 0;
151
+ s > t && (t = s);
144
152
  }
145
153
  });
146
154
  } catch {
147
155
  }
148
156
  return t + 1;
149
157
  }
158
+ /**
159
+ * Heals a duplicate that slipped past the create-time `_detectDuplicate`
160
+ * scan (or that was persisted by an older template before SD-142352).
161
+ * When two blocks share a `recommendation-id`, the first occurrence in DOM
162
+ * order is treated as the source and any later sibling is reassigned a
163
+ * fresh id. The store entry and active-block focus are intentionally not
164
+ * touched here: each block's persisted `esd-ext-config` carries its own
165
+ * truth and the regular save-time hydration (`hydrateRecommendationStore`)
166
+ * will seed the new id from that. Skipping `setCurrentBlock` avoids
167
+ * yanking the user's current selection mid-edit when the heal fires from
168
+ * `onDocumentChanged`.
169
+ */
170
+ _healLingeringDuplicate(t) {
171
+ const e = this._getRecommendationId(t);
172
+ if (!(e === null || e <= 0))
173
+ try {
174
+ const i = this.api.getDocumentRoot();
175
+ if (!i || !("querySelectorAll" in i))
176
+ return;
177
+ const n = i.querySelectorAll(
178
+ `.${m}[${u}="${e}"]`
179
+ );
180
+ if (n.length <= 1)
181
+ return;
182
+ const o = this._getBlockElement(t);
183
+ if (!o)
184
+ return;
185
+ let s = -1;
186
+ for (let r = 0; r < n.length; r++)
187
+ if (n[r] === o) {
188
+ s = r;
189
+ break;
190
+ }
191
+ if (s <= 0)
192
+ return;
193
+ this._reassignDuplicateId(t, e);
194
+ } catch {
195
+ }
196
+ }
197
+ /** True when another block already holds the same id — Stripo's duplication signal. */
198
+ _detectDuplicate(t) {
199
+ try {
200
+ const e = this.api.getDocumentRoot();
201
+ if (e && "querySelectorAll" in e)
202
+ return e.querySelectorAll(
203
+ `.${m}[${u}="${t}"]`
204
+ ).length > 1;
205
+ } catch {
206
+ }
207
+ return !1;
208
+ }
209
+ /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
210
+ _handleDuplicate(t, e) {
211
+ const i = this._reassignDuplicateId(t, e), n = g();
212
+ n.cloneBlockState(e, i), n.setCurrentBlock(i);
213
+ }
214
+ /**
215
+ * Core id-reassignment for a duplicated block: rewrites the DOM
216
+ * `recommendation-id`, the instance class and the persisted node config to
217
+ * a fresh id. Returns the new id.
218
+ *
219
+ * Used by `_handleDuplicate` at create-time (which additionally clones the
220
+ * store entry and focuses the new block) and by `_healLingeringDuplicate`
221
+ * at document-change time (which intentionally skips store/focus side
222
+ * effects so older bug-affected templates can self-repair without
223
+ * disturbing the user's current selection).
224
+ */
225
+ _reassignDuplicateId(t, e) {
226
+ const i = this._generateNextId(), n = this._getBlockElement(t);
227
+ return this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), l.hasConfig(t) && l.updateConfig(
228
+ this.api,
229
+ t,
230
+ { recommendationId: i },
231
+ `Reassign recommendation ID on duplicate (was ${e})`
232
+ ), i;
233
+ }
234
+ /**
235
+ * Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
236
+ * class scopes per-block CSS rules, so leaving the source's class would
237
+ * make stylistic edits leak between source and clone.
238
+ */
239
+ _reassignInstanceClass(t, e, i) {
240
+ if (!("getAttribute" in t))
241
+ return;
242
+ const n = t.getAttribute("class");
243
+ if (!n)
244
+ return;
245
+ const o = `ins-recommendation-v3-block-${e}`, s = `ins-recommendation-v3-block-${i}`, r = n.includes(o) ? n.replace(o, s) : `${n} ${s}`, d = this.api.getDocumentModifier();
246
+ d.modifyHtml(t).setAttribute("class", r), d.apply(new p(
247
+ `Reassign recommendation instance class ${o} -> ${s}`
248
+ ));
249
+ }
150
250
  /**
151
251
  * Assigns a recommendation-id attribute to the block element.
152
252
  * The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
@@ -157,8 +257,8 @@ class q extends R {
157
257
  const i = this._getBlockElement(t);
158
258
  if (!i)
159
259
  return;
160
- const o = this.api.getDocumentModifier();
161
- o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new C(`Assign recommendation ID ${e}`));
260
+ const n = this.api.getDocumentModifier();
261
+ n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new p(`Assign recommendation ID ${e}`));
162
262
  }
163
263
  /**
164
264
  * Gets the recommendation-id from a block node
@@ -167,11 +267,11 @@ class q extends R {
167
267
  const e = this._getBlockElement(t);
168
268
  if (!e || !("getAttribute" in e))
169
269
  return null;
170
- const i = e.getAttribute(m);
270
+ const i = e.getAttribute(u);
171
271
  if (!i)
172
272
  return null;
173
- const o = parseInt(i);
174
- return Number.isNaN(o) ? null : o;
273
+ const n = parseInt(i);
274
+ return Number.isNaN(n) ? null : n;
175
275
  }
176
276
  /**
177
277
  * Gets the block element (the element with BLOCK_CLASS)
@@ -179,19 +279,19 @@ class q extends R {
179
279
  _getBlockElement(t) {
180
280
  if ("getAttribute" in t) {
181
281
  const e = t.getAttribute("class");
182
- if (e && e.includes(l))
282
+ if (e && e.includes(m))
183
283
  return t;
184
284
  }
185
- return "querySelector" in t ? t.querySelector(`.${l}`) ?? null : null;
285
+ return "querySelector" in t ? t.querySelector(`.${m}`) ?? null : null;
186
286
  }
187
287
  /**
188
288
  * Migrate configuration from legacy format
189
289
  */
190
290
  _migrateFromLegacy(t) {
191
- s.migrateFromDataAttributes(this.api, t);
291
+ l.migrateFromDataAttributes(this.api, t);
192
292
  }
193
293
  }
194
294
  export {
195
- h as BLOCK_ID,
196
- q as RecommendationBlock
295
+ I as BLOCK_ID,
296
+ v as RecommendationBlock
197
297
  };
@@ -1,16 +1,16 @@
1
- import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as y } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
1
+ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
+ import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
4
  import { defineStore as P } from "pinia";
5
5
  import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
6
  import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
7
7
  import { getDefaultProducts as S } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
- import { isFilterValid as w } from "../validation/filterSchema.js";
10
- import { isConfigValid as v } from "../validation/requiredFields.js";
11
- const h = C();
9
+ import { isFilterValid as v } from "../validation/filterSchema.js";
10
+ import { isConfigValid as w } from "../validation/requiredFields.js";
11
+ const h = y();
12
12
  let m = null, u = null, d = null;
13
- function k() {
13
+ function I() {
14
14
  return {
15
15
  cardsInRow: F,
16
16
  currencySettings: {
@@ -38,9 +38,9 @@ function k() {
38
38
  customAttributes: []
39
39
  };
40
40
  }
41
- function I() {
41
+ function k() {
42
42
  return {
43
- recommendationConfigs: k(),
43
+ recommendationConfigs: I(),
44
44
  recommendationProducts: [],
45
45
  filterStatus: !1,
46
46
  filterSelectionDrawerStatus: !1,
@@ -69,7 +69,7 @@ const N = () => ({
69
69
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
70
70
  */
71
71
  recommendationConfigs(t) {
72
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
72
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : I();
73
73
  },
74
74
  /**
75
75
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
@@ -133,7 +133,7 @@ const N = () => ({
133
133
  getFilterList() {
134
134
  return Object.values(this.filterList).map((t) => {
135
135
  let e;
136
- return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : y.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
136
+ return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
137
137
  text: t.displayName,
138
138
  value: e,
139
139
  type: t.attributeType
@@ -155,7 +155,7 @@ const N = () => ({
155
155
  setCurrentBlock(t) {
156
156
  this.blockStates[t] || (this.blockStates = {
157
157
  ...this.blockStates,
158
- [t]: I()
158
+ [t]: k()
159
159
  }), this.currentRecommendationId = t;
160
160
  },
161
161
  /**
@@ -174,6 +174,25 @@ const N = () => ({
174
174
  this.currentRecommendationId = n.length > 0 ? n[0] : null;
175
175
  }
176
176
  },
177
+ /**
178
+ * Deep-clones a block's state and mirrors its campaign URL under a new id.
179
+ * Invoked from `onCreated` when a duplicate is detected (SD-142352).
180
+ */
181
+ cloneBlockState(t, e) {
182
+ const r = this.blockStates[t];
183
+ if (r) {
184
+ const o = structuredClone(r);
185
+ o.recommendationConfigs.id = e, this.blockStates = {
186
+ ...this.blockStates,
187
+ [e]: o
188
+ };
189
+ }
190
+ const n = t.toString(), c = e.toString(), i = this.recommendationCampaignUrls[n];
191
+ i && (this.recommendationCampaignUrls = {
192
+ ...this.recommendationCampaignUrls,
193
+ [c]: i
194
+ });
195
+ },
177
196
  /**
178
197
  * Marks a block as initialized (initial API data has been fetched).
179
198
  * Automatically cleaned up when removeBlockState deletes the block entry.
@@ -204,7 +223,7 @@ const N = () => ({
204
223
  decimalCount: String(e.currencyDecimalCount),
205
224
  decimalSeparator: r(e.currencyDecimalSeparator, ","),
206
225
  thousandSeparator: r(e.currencyThousandSeparator, ".")
207
- }, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
226
+ }, c = !this.blockStates[t], i = c ? k() : this.blockStates[t];
208
227
  i.recommendationConfigs = {
209
228
  ...i.recommendationConfigs,
210
229
  strategy: e.strategy,
@@ -359,7 +378,7 @@ const N = () => ({
359
378
  const n = [...e.recommendationConfigs.filters];
360
379
  n[r] = {
361
380
  ...t,
362
- isValid: w(t)
381
+ isValid: v(t)
363
382
  }, e.recommendationConfigs.filters = n;
364
383
  }
365
384
  },
@@ -405,7 +424,7 @@ const N = () => ({
405
424
  * every block's recommendationConfigs across user edits.
406
425
  */
407
426
  hasInvalidBlock() {
408
- return Object.values(this.blockStates).some((t) => !v(t.recommendationConfigs, this));
427
+ return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
409
428
  },
410
429
  // ====================================================================
411
430
  // Per-Block Product Fetching
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-cdee3452]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-cdee3452]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-cdee3452]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-8053a037],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-4e2a4adb]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-b293a2b0]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-b293a2b0]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-b293a2b0]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
@@ -60,6 +60,41 @@ export declare class RecommendationBlock extends Block {
60
60
  * in the document and finding the maximum existing ID + 1.
61
61
  */
62
62
  private _generateNextId;
63
+ /**
64
+ * Heals a duplicate that slipped past the create-time `_detectDuplicate`
65
+ * scan (or that was persisted by an older template before SD-142352).
66
+ * When two blocks share a `recommendation-id`, the first occurrence in DOM
67
+ * order is treated as the source and any later sibling is reassigned a
68
+ * fresh id. The store entry and active-block focus are intentionally not
69
+ * touched here: each block's persisted `esd-ext-config` carries its own
70
+ * truth and the regular save-time hydration (`hydrateRecommendationStore`)
71
+ * will seed the new id from that. Skipping `setCurrentBlock` avoids
72
+ * yanking the user's current selection mid-edit when the heal fires from
73
+ * `onDocumentChanged`.
74
+ */
75
+ private _healLingeringDuplicate;
76
+ /** True when another block already holds the same id — Stripo's duplication signal. */
77
+ private _detectDuplicate;
78
+ /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
79
+ private _handleDuplicate;
80
+ /**
81
+ * Core id-reassignment for a duplicated block: rewrites the DOM
82
+ * `recommendation-id`, the instance class and the persisted node config to
83
+ * a fresh id. Returns the new id.
84
+ *
85
+ * Used by `_handleDuplicate` at create-time (which additionally clones the
86
+ * store entry and focuses the new block) and by `_healLingeringDuplicate`
87
+ * at document-change time (which intentionally skips store/focus side
88
+ * effects so older bug-affected templates can self-repair without
89
+ * disturbing the user's current selection).
90
+ */
91
+ private _reassignDuplicateId;
92
+ /**
93
+ * Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
94
+ * class scopes per-block CSS rules, so leaving the source's class would
95
+ * make stylistic edits leak between source and clone.
96
+ */
97
+ private _reassignInstanceClass;
63
98
  /**
64
99
  * Assigns a recommendation-id attribute to the block element.
65
100
  * The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
@@ -216,6 +216,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
216
216
  * Resets currentRecommendationId if it was the deleted block.
217
217
  */
218
218
  removeBlockState(id: number): void;
219
+ /**
220
+ * Deep-clones a block's state and mirrors its campaign URL under a new id.
221
+ * Invoked from `onCreated` when a duplicate is detected (SD-142352).
222
+ */
223
+ cloneBlockState(sourceId: number, newId: number): void;
219
224
  /**
220
225
  * Marks a block as initialized (initial API data has been fetched).
221
226
  * Automatically cleaned up when removeBlockState deletes the block entry.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.4.1-beta.ad76dd1",
3
+ "version": "3.4.1-beta.aeb242c",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",