@useinsider/guido 3.4.1-beta.baebb5e → 3.4.1-beta.ce8d9b0

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
- "b293a2b0"
15
+ "cdee3452"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,44 +1,42 @@
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";
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";
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 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";
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";
23
22
  import { usePreviewStore as he } from "../stores/preview.js";
24
- import { useTemplateStore as be } from "../stores/template.js";
25
- import { useUnsubscribeStore as ge } from "../stores/unsubscribe.js";
26
- const Ke = /* @__PURE__ */ Q({
23
+ import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
24
+ const He = /* @__PURE__ */ J({
27
25
  __name: "Guido",
28
26
  props: {
29
27
  config: null
30
28
  },
31
29
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
32
- setup($, { expose: z, emit: n }) {
33
- const g = $, q = N(
30
+ setup(H, { expose: z, emit: n }) {
31
+ const g = H, q = R(
34
32
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
35
- ), K = N(
33
+ ), K = R(
36
34
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
37
- ), E = I(), u = I(), p = Se(), w = ge(), i = ye();
35
+ ), w = I(), u = I(), p = ve(), E = Se(), i = fe();
38
36
  i.init(g.config);
39
- const f = H(), V = he(), m = W(() => f.hasChanges), { isTestPartner: j } = ne(), D = () => {
37
+ const f = ye(), V = he(), m = W(() => f.hasChanges), { isTestPartner: $ } = te(), D = () => {
40
38
  var e;
41
- return (e = E.value) == null ? void 0 : e.handleSave(!0);
39
+ return (e = w.value) == null ? void 0 : e.handleSave(!0);
42
40
  }, {
43
41
  templateId: v,
44
42
  userId: C,
@@ -47,8 +45,8 @@ const Ke = /* @__PURE__ */ Q({
47
45
  template: o,
48
46
  editor: s
49
47
  } = 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;
50
- ee(), te();
51
- const S = {
48
+ f.templateId = v, Z(), oe();
49
+ const h = {
52
50
  emailId: v,
53
51
  userId: C,
54
52
  username: k,
@@ -60,11 +58,11 @@ const Ke = /* @__PURE__ */ Q({
60
58
  onReady: () => {
61
59
  console.debug("guido:ready"), n("ready");
62
60
  }
63
- }, { initPlugin: M } = re(S, _), { getDefaultTemplate: O } = ve(), { cloneTimersOnSave: P, hasTimerBlocks: R } = se(), J = W(() => {
61
+ }, { initPlugin: M } = ne(h, _), { getDefaultTemplate: O } = pe(), { cloneTimersOnSave: P, hasTimerBlocks: A } = re(), j = W(() => {
64
62
  var e;
65
63
  return !((e = i.ui) != null && e.showHeader);
66
64
  });
67
- oe({
65
+ ee({
68
66
  onBack: () => {
69
67
  console.debug("guido:back"), n("back");
70
68
  },
@@ -72,50 +70,50 @@ const Ke = /* @__PURE__ */ Q({
72
70
  console.debug("guido:save:start"), n("save:start");
73
71
  },
74
72
  onSaveComplete: (e) => {
75
- const t = { ...e, metadata: S };
73
+ const t = { ...e, metadata: h };
76
74
  console.debug("guido:save:complete", t), n("save:complete", t);
77
75
  },
78
76
  onTestEmailClick: () => {
79
77
  console.debug("guido:test-email:click"), n("test-email:click");
80
78
  }
81
79
  });
82
- const A = (e) => {
80
+ const B = (e) => {
83
81
  console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
84
- }, B = () => {
82
+ }, N = () => {
85
83
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
86
84
  };
87
- X(() => m.value, () => {
85
+ Q(() => m.value, () => {
88
86
  n("on-change", m.value);
89
87
  });
90
- const h = (e) => {
88
+ const S = (e) => {
91
89
  const t = e, { attribute: l, position: a } = t.detail;
92
90
  console.debug("dynamic-content:open", t.detail), n("dynamic-content:open", l, a);
93
91
  };
94
92
  let c = null;
95
93
  const b = () => {
96
94
  var t;
97
- const e = document.querySelector(ce);
95
+ const e = document.querySelector(se);
98
96
  (t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
99
97
  };
100
- return Y(async () => {
98
+ return X(async () => {
101
99
  var t, l;
102
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ae().$reset(), H().$reset(), f.templateId = v, be().$reset(), b();
100
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b();
103
101
  const e = (t = u.value) == null ? void 0 : t.parentElement;
104
102
  e && (c = new ResizeObserver(b), c.observe(e));
105
103
  try {
106
- w.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
104
+ E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
107
105
  const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
108
106
  let r = {
109
107
  html: d && await x(d, a),
110
108
  css: F
111
109
  };
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;
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;
113
111
  } catch (a) {
114
112
  console.error("Failed to initialize Stripo editor:", a);
115
113
  }
116
- document.addEventListener("dynamic-content:open", h);
117
- }), Z(() => {
118
- c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", h);
114
+ document.addEventListener("dynamic-content:open", S);
115
+ }), Y(() => {
116
+ c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", S);
119
117
  try {
120
118
  window.UIEditor.removeEditor();
121
119
  } catch {
@@ -124,14 +122,14 @@ const Ke = /* @__PURE__ */ Q({
124
122
  i.reset();
125
123
  }), z({
126
124
  dynamicContent: {
127
- insert: A,
128
- close: B
125
+ insert: B,
126
+ close: N
129
127
  },
130
128
  hasChanges: m,
131
129
  saveSilent: D
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 };
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 };
133
131
  }
134
132
  });
135
133
  export {
136
- Ke as default
134
+ He as default
137
135
  };
@@ -21,9 +21,9 @@ const v = () => {
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
23
  }, ...t }, s = {
24
- callback: (l, p, d, c, u) => {
24
+ callback: (l, r, d, c, u) => {
25
25
  l ? a(l) : e({
26
- html: p,
26
+ html: r,
27
27
  ampHtml: d,
28
28
  ampErrors: c,
29
29
  displayConditions: u
@@ -36,11 +36,11 @@ const v = () => {
36
36
  return {
37
37
  getCompiledEmail: m,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
39
+ const e = ({ html: a, css: i, width: o, height: p, utmParams: s, syncModulesIds: l }) => t({
40
40
  html: a,
41
41
  css: i,
42
42
  width: o,
43
- height: r,
43
+ height: p,
44
44
  utmParams: s,
45
45
  syncModulesIds: l
46
46
  });
@@ -91,11 +91,7 @@ const v = () => {
91
91
  },
92
92
  editorSave: () => new Promise((t) => {
93
93
  window.StripoEditorApi.actionsApi.save((e) => {
94
- if (e) {
95
- n(e, "Failed to save template"), t(!1);
96
- return;
97
- }
98
- t(!0);
94
+ e && n(e, "Failed to save template"), t();
99
95
  });
100
96
  })
101
97
  };
@@ -1,30 +1,48 @@
1
- import { defaultHtmlCompilerRules as c } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
3
- import { liquidCompilerRules as R } from "../config/compiler/liquidCompilerRules.js";
4
- import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
5
- import { recommendationCompilerRules as d } from "../config/compiler/recommendationCompilerRules.js";
6
- import { socialCompilerRules as b } from "../config/compiler/socialCompilerRules.js";
7
- import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
8
- import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
9
- import { useConfig as v } from "./useConfig.js";
10
- const w = () => {
11
- var l, m, r;
12
- const { compiler: e, isFeatureEnabled: t, partner: i } = v(), s = ((l = e.value) == null ? void 0 : l.customRules) || [], u = [
13
- ...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : c,
14
- ...d,
1
+ import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
3
+ import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
4
+ import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
5
+ import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
6
+ import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
+ import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
8
+ import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
9
+ import { useConfig as k } from "./useConfig.js";
10
+ const y = /* @__PURE__ */ new Set([
11
+ // URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
12
+ "fix-url-encoding-start",
13
+ "fix-url-encoding-end",
14
+ "fix-tags-start",
15
+ "fix-tags-end",
16
+ // Image domain corrections — plain string replacement.
17
+ "replace-old-image-domain",
18
+ "replace-old-v2-image-domain",
19
+ // Unsubscribe domain — the actual fix: injects the real unsubscribe href in
20
+ // place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
21
+ // unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
22
+ "add-unsubscribe-link-values",
23
+ "remove-data-ogsb-button-styles",
24
+ "format-comment-braces",
25
+ "add-universal-link-flags",
26
+ // Coupon placeholder replacement (only present when liquidSyntax is enabled).
27
+ "liquid-coupon-code"
28
+ ]), M = () => {
29
+ var m, t, r;
30
+ const { compiler: e, isFeatureEnabled: a, partner: n } = k(), u = ((m = e.value) == null ? void 0 : m.customRules) || [], l = [
31
+ ...!!((t = e.value) != null && t.ignoreDefaultRules) ? [] : R,
32
+ ...v,
33
+ ...x,
15
34
  ...g,
16
- ...f,
17
- ...C,
18
35
  ...b,
19
- ...t("liquidSyntax") ? R : [],
20
- ...s.map((o, a) => ({
36
+ ...H,
37
+ ...a("liquidSyntax") ? C : [],
38
+ ...u.map((o, f) => ({
21
39
  ...o,
22
- priority: o.priority + 1e3 + a
40
+ priority: o.priority + 1e3 + f
23
41
  // Ensure additional rules run after default rules
24
42
  }))
25
- ], p = H(u), n = (r = i.value) == null ? void 0 : r.fallbackFont;
26
- return { compileHtml: (o) => p.compile(o, void 0, n) };
43
+ ], p = s(l), c = l.filter((o) => y.has(o.id)), d = s(c), i = (r = n.value) == null ? void 0 : r.fallbackFont;
44
+ return { compileHtml: (o) => p.compile(o, void 0, i), compileAmpHtml: (o) => d.compile(o, void 0, i) };
27
45
  };
28
46
  export {
29
- w as useHtmlCompiler
47
+ M as useHtmlCompiler
30
48
  };
@@ -1,31 +1,32 @@
1
1
  import { useActionsApi as x } from "./useActionsApi.js";
2
2
  import { useConfig as y } from "./useConfig.js";
3
3
  import { useSaveStart as w, useSaveComplete as C } from "./useGuidoActions.js";
4
- import { useSyncModuleExtractor as E } from "./useSyncModuleExtractor.js";
5
- import { useStripoApi as H } from "../services/stripoApi.js";
6
- import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as q } from "./useHtmlValidator.js";
8
- import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
- import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
- const z = () => {
11
- const o = w(), s = C(), { validateHtml: r } = q(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = E(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = x();
4
+ import { useSyncModuleExtractor as H } from "./useSyncModuleExtractor.js";
5
+ import { useStripoApi as b } from "../services/stripoApi.js";
6
+ import { useTemplatePreparation as q } from "../utils/templatePreparation.js";
7
+ import { useHtmlValidator as L } from "./useHtmlValidator.js";
8
+ import { useCouponBlockValidator as P } from "./validators/useCouponBlockValidator.js";
9
+ import { useLiquidValidator as E } from "./validators/useLiquidValidator.js";
10
+ const j = () => {
11
+ const o = w(), s = C(), { validateHtml: r } = L(), { validateLiquidSyntax: l } = E(), { validateCouponBlockTags: n } = P(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = H(), { setSyncModuleUnsubscriptionPages: c } = b(), { editorSave: m } = x();
12
12
  return { save: async (p = !1, f = !1) => {
13
13
  var i;
14
14
  o();
15
- const { prepareTemplateDetails: v } = b(), t = await v();
16
- if (!l(t.compiledHtml))
15
+ const { prepareTemplateDetails: v } = q(), t = await v();
16
+ if (!n(t.compiledHtml))
17
17
  return;
18
18
  if (d("liquidSyntax")) {
19
- if (!await n(t.compiledHtml))
19
+ if (!await l(t.compiledHtml))
20
20
  return;
21
21
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
22
22
  return;
23
- if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t) || !await m())
23
+ if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
24
24
  return;
25
+ await m();
25
26
  const { unsubscribePayload: S, stripoModules: V } = u(t.rawHtml);
26
27
  return await c(S), t.modules = V, p || s({ ...t, silent: f }), t;
27
28
  } };
28
29
  };
29
30
  export {
30
- z as useSave
31
+ j as useSave
31
32
  };
@@ -1,15 +1,15 @@
1
1
  var k = Object.defineProperty;
2
- var y = (a, r, t) => r in a ? k(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
- var d = (a, r, t) => y(a, typeof r != "symbol" ? r + "" : r, t);
4
- import { BlockId as B } from "../../../enums/block.js";
5
- import { getMigrationBannerHtml as D } from "../../../utils/migrationBannerHtml.js";
6
- import { Block as R, BlockCompositionType as C, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { regenerateMobileProductRows as b } from "./controls/main/utils.js";
8
- import { ensureMobileCssRulesExist as p, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
9
- import { RecommendationConfigService as c } from "./services/configService.js";
10
- import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
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
11
  import { getDefaultTemplate as E } from "./templates/grid/template.js";
12
- const _ = B.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
12
+ const h = _.Recommendation, l = "recommendation-block-v2", m = "recommendation-id";
13
13
  let I = !1;
14
14
  class q extends R {
15
15
  constructor() {
@@ -18,16 +18,16 @@ class q extends R {
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
- d(this, "_pendingBlockId", null);
21
+ g(this, "_pendingBlockId", null);
22
22
  }
23
23
  getId() {
24
- return _;
24
+ return h;
25
25
  }
26
26
  getIcon() {
27
27
  return "recommendation-icon";
28
28
  }
29
29
  getBlockCompositionType() {
30
- return C.CONTAINER;
30
+ return y.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 D(
42
- _,
41
+ return b(
42
+ h,
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
  );
@@ -70,32 +70,24 @@ class q extends R {
70
70
  */
71
71
  onCreated(t) {
72
72
  const e = this._getRecommendationId(t);
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);
73
+ if (e !== null && e > 0)
81
74
  return;
82
- }
83
75
  const i = this._pendingBlockId ?? this._generateNextId();
84
76
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
85
- const { config: n, wasFreshDrop: o } = c.initializeConfig(
77
+ const { config: o, wasFreshDrop: c } = s.initializeConfig(
86
78
  this.api,
87
79
  t,
88
80
  { recommendationId: i }
89
- ), s = g();
90
- if (s.setCurrentBlock(i), o) {
91
- p(this.api);
92
- const l = this._getBlockElement(t);
93
- l && (f(this.api, l, !0), b({
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({
94
86
  currentNode: t,
95
87
  documentModifier: this.api.getDocumentModifier()
96
88
  }));
97
89
  }
98
- s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
90
+ a.patchCurrentBlockConfig({ language: o.language }, { triggerRefetch: !1 });
99
91
  }
100
92
  /**
101
93
  * Called when the document changes or template is loaded
@@ -108,20 +100,20 @@ class q extends R {
108
100
  if (!(!t || !("getNodeConfig" in t))) {
109
101
  if (!this._getRecommendationId(t)) {
110
102
  const e = this._generateNextId();
111
- this._assignRecommendationId(t, e), c.hasConfig(t) && c.updateConfig(
103
+ this._assignRecommendationId(t, e), s.hasConfig(t) && s.updateConfig(
112
104
  this.api,
113
105
  t,
114
106
  { recommendationId: e },
115
107
  "Assign recommendation ID to legacy block"
116
108
  );
117
109
  }
118
- this._healLingeringDuplicate(t), c.needsMigration(t) && this._migrateFromLegacy(t);
110
+ s.needsMigration(t) && this._migrateFromLegacy(t);
119
111
  try {
120
- I || (p(this.api), I = !0);
121
- const e = c.getConfig(t), i = this._getBlockElement(t);
112
+ I || (d(this.api), I = !0);
113
+ const e = s.getConfig(t), i = this._getBlockElement(t);
122
114
  if (i) {
123
- const n = !e.mobileLayoutEnabled;
124
- A(i) !== n && f(this.api, i, n);
115
+ const o = !e.mobileLayoutEnabled;
116
+ D(i) !== o && p(this.api, i, o);
125
117
  }
126
118
  } catch {
127
119
  }
@@ -135,7 +127,7 @@ class q extends R {
135
127
  */
136
128
  onDelete(t) {
137
129
  const e = this._getRecommendationId(t);
138
- e && g().removeBlockState(e);
130
+ e && f().removeBlockState(e);
139
131
  }
140
132
  /**
141
133
  * Generates the next unique recommendation ID by scanning all existing blocks
@@ -145,107 +137,16 @@ class q extends R {
145
137
  let t = 0;
146
138
  try {
147
139
  const e = this.api.getDocumentRoot();
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);
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);
152
144
  }
153
145
  });
154
146
  } catch {
155
147
  }
156
148
  return t + 1;
157
149
  }
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 l = 0; l < n.length; l++)
187
- if (n[l] === o) {
188
- s = l;
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), c.hasConfig(t) && c.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 in the editor and is also the key the
237
- * mail render service reads to look up per-id campaign config, so leaving
238
- * the source's class would both leak stylistic edits across blocks and
239
- * cause the mail render to apply the source block's config to the clone.
240
- */
241
- _reassignInstanceClass(t, e, i) {
242
- if (!("getAttribute" in t))
243
- return;
244
- const n = `ins-recommendation-v3-block-${e}`, o = `ins-recommendation-v3-block-${i}`, s = this.api.getDocumentModifier();
245
- s.modifyHtml(t).removeClass(n).setClass(o), s.apply(new h(
246
- `Reassign recommendation instance class ${n} -> ${o}`
247
- ));
248
- }
249
150
  /**
250
151
  * Assigns a recommendation-id attribute to the block element.
251
152
  * The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
@@ -256,8 +157,8 @@ class q extends R {
256
157
  const i = this._getBlockElement(t);
257
158
  if (!i)
258
159
  return;
259
- const n = this.api.getDocumentModifier();
260
- n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new h(`Assign recommendation ID ${e}`));
160
+ const o = this.api.getDocumentModifier();
161
+ o.modifyHtml(i).setAttribute(m, e.toString()), o.apply(new C(`Assign recommendation ID ${e}`));
261
162
  }
262
163
  /**
263
164
  * Gets the recommendation-id from a block node
@@ -266,11 +167,11 @@ class q extends R {
266
167
  const e = this._getBlockElement(t);
267
168
  if (!e || !("getAttribute" in e))
268
169
  return null;
269
- const i = e.getAttribute(u);
170
+ const i = e.getAttribute(m);
270
171
  if (!i)
271
172
  return null;
272
- const n = parseInt(i);
273
- return Number.isNaN(n) ? null : n;
173
+ const o = parseInt(i);
174
+ return Number.isNaN(o) ? null : o;
274
175
  }
275
176
  /**
276
177
  * Gets the block element (the element with BLOCK_CLASS)
@@ -278,19 +179,19 @@ class q extends R {
278
179
  _getBlockElement(t) {
279
180
  if ("getAttribute" in t) {
280
181
  const e = t.getAttribute("class");
281
- if (e && e.includes(m))
182
+ if (e && e.includes(l))
282
183
  return t;
283
184
  }
284
- return "querySelector" in t ? t.querySelector(`.${m}`) ?? null : null;
185
+ return "querySelector" in t ? t.querySelector(`.${l}`) ?? null : null;
285
186
  }
286
187
  /**
287
188
  * Migrate configuration from legacy format
288
189
  */
289
190
  _migrateFromLegacy(t) {
290
- c.migrateFromDataAttributes(this.api, t);
191
+ s.migrateFromDataAttributes(this.api, t);
291
192
  }
292
193
  }
293
194
  export {
294
- _ as BLOCK_ID,
195
+ h as BLOCK_ID,
295
196
  q as RecommendationBlock
296
197
  };
@@ -1,16 +1,16 @@
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";
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";
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 v } from "../validation/filterSchema.js";
10
- import { isConfigValid as w } from "../validation/requiredFields.js";
11
- const h = y();
9
+ import { isFilterValid as w } from "../validation/filterSchema.js";
10
+ import { isConfigValid as v } from "../validation/requiredFields.js";
11
+ const h = C();
12
12
  let m = null, u = null, d = null;
13
- function I() {
13
+ function k() {
14
14
  return {
15
15
  cardsInRow: F,
16
16
  currencySettings: {
@@ -38,9 +38,9 @@ function I() {
38
38
  customAttributes: []
39
39
  };
40
40
  }
41
- function k() {
41
+ function I() {
42
42
  return {
43
- recommendationConfigs: I(),
43
+ recommendationConfigs: k(),
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 : I();
72
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
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}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
136
+ return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : y.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]: k()
158
+ [t]: I()
159
159
  }), this.currentRecommendationId = t;
160
160
  },
161
161
  /**
@@ -174,25 +174,6 @@ 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
- },
196
177
  /**
197
178
  * Marks a block as initialized (initial API data has been fetched).
198
179
  * Automatically cleaned up when removeBlockState deletes the block entry.
@@ -223,7 +204,7 @@ const N = () => ({
223
204
  decimalCount: String(e.currencyDecimalCount),
224
205
  decimalSeparator: r(e.currencyDecimalSeparator, ","),
225
206
  thousandSeparator: r(e.currencyThousandSeparator, ".")
226
- }, c = !this.blockStates[t], i = c ? k() : this.blockStates[t];
207
+ }, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
227
208
  i.recommendationConfigs = {
228
209
  ...i.recommendationConfigs,
229
210
  strategy: e.strategy,
@@ -378,7 +359,7 @@ const N = () => ({
378
359
  const n = [...e.recommendationConfigs.filters];
379
360
  n[r] = {
380
361
  ...t,
381
- isValid: v(t)
362
+ isValid: w(t)
382
363
  }, e.recommendationConfigs.filters = n;
383
364
  }
384
365
  },
@@ -424,7 +405,7 @@ const N = () => ({
424
405
  * every block's recommendationConfigs across user edits.
425
406
  */
426
407
  hasInvalidBlock() {
427
- return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
408
+ return Object.values(this.blockStates).some((t) => !v(t.recommendationConfigs, this));
428
409
  },
429
410
  // ====================================================================
430
411
  // 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-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}
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}
@@ -7,5 +7,5 @@ export declare const useActionsApi: () => {
7
7
  getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
8
8
  updateTimerInClonedTemplate: () => Promise<string | null>;
9
9
  updateHtmlAndCss: (html: string, css: string) => void;
10
- editorSave: () => Promise<boolean>;
10
+ editorSave: () => Promise<void>;
11
11
  };
@@ -1,4 +1,5 @@
1
1
  import type { CompilationResult } from '@@/Types/html-compiler';
2
2
  export declare const useHtmlCompiler: () => {
3
3
  compileHtml: (html: string) => CompilationResult;
4
+ compileAmpHtml: (amp: string) => CompilationResult;
4
5
  };
@@ -60,43 +60,6 @@ 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 in the editor and is also the key the
95
- * mail render service reads to look up per-id campaign config, so leaving
96
- * the source's class would both leak stylistic edits across blocks and
97
- * cause the mail render to apply the source block's config to the clone.
98
- */
99
- private _reassignInstanceClass;
100
63
  /**
101
64
  * Assigns a recommendation-id attribute to the block element.
102
65
  * The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
@@ -216,11 +216,6 @@ 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;
224
219
  /**
225
220
  * Marks a block as initialized (initial API data has been fetched).
226
221
  * Automatically cleaned up when removeBlockState deletes the block entry.
@@ -1,101 +1,93 @@
1
- import { useActionsApi as C } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as T } from "../composables/useHtmlCompiler.js";
3
- import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { useActionsApi as P } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as D } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { DATA_ATTRIBUTES as S } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as D } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as P } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
9
- function E(i, o) {
10
- const t = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), c = [];
11
- return t.forEach((r) => {
12
- const a = r.getAttribute(S.PAGE_LIST);
13
- a && c.push(...D(a));
14
- }), o.filter((r) => c.includes(r));
5
+ import { DATA_ATTRIBUTES as y } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { parsePageList as E } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as U } from "../stores/unsubscribe.js";
9
+ function F(a, t) {
10
+ const c = new DOMParser().parseFromString(a, "text/html").querySelectorAll(`[${y.PAGE_LIST}]`), r = [];
11
+ return c.forEach((o) => {
12
+ const n = o.getAttribute(y.PAGE_LIST);
13
+ n && r.push(...E(n));
14
+ }), t.filter((o) => r.includes(o));
15
15
  }
16
- async function U(i) {
17
- const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
16
+ function x(a) {
17
+ const m = new DOMParser().parseFromString(a, "text/html").querySelectorAll(".recommendation-block-v2");
18
18
  if (m.length === 0)
19
19
  return;
20
- const l = b();
21
- m.forEach((t) => {
22
- var g, f, u, n, y;
23
- const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
24
- if (!Number.isFinite(r))
20
+ const p = b();
21
+ m.forEach((c) => {
22
+ var l, g, f, u, s;
23
+ const r = c.getAttribute("recommendation-id"), o = r ? Number(r) : NaN;
24
+ if (!Number.isFinite(o))
25
25
  return;
26
- const a = t.getAttribute("esd-ext-config");
27
- if (!a)
26
+ const n = c.getAttribute("esd-ext-config");
27
+ if (!n)
28
28
  return;
29
29
  let e;
30
30
  try {
31
- e = JSON.parse(a);
31
+ e = JSON.parse(n);
32
32
  } catch {
33
33
  return;
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
- const p = {
38
- strategy: e.strategy ?? s.strategy,
39
- language: e.language ?? s.language,
40
- size: e.size ?? s.size,
37
+ const S = {
38
+ strategy: e.strategy ?? i.strategy,
39
+ language: e.language ?? i.language,
40
+ size: e.size ?? i.size,
41
41
  // Spread the default arrays so each block gets a fresh reference
42
42
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
43
- productIds: e.productIds ?? [...s.productIds],
44
- filters: e.filters ?? [...s.filters],
45
- shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
46
- currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
47
- currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
48
- currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? d.decimalCount,
49
- currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? d.decimalSeparator,
50
- currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? d.thousandSeparator
43
+ productIds: e.productIds ?? [...i.productIds],
44
+ filters: e.filters ?? [...i.filters],
45
+ shuffleProducts: e.shuffleProducts ?? i.shuffleProducts,
46
+ currencyCode: ((l = e.currency) == null ? void 0 : l.code) ?? d.code,
47
+ currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? d.alignment,
48
+ currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? d.decimalCount,
49
+ currencyDecimalSeparator: ((u = e.currency) == null ? void 0 : u.decimalSeparator) ?? d.decimalSeparator,
50
+ currencyThousandSeparator: ((s = e.currency) == null ? void 0 : s.thousandSeparator) ?? d.thousandSeparator
51
51
  };
52
- l.seedBlockUrlConfig(r, p);
52
+ p.seedBlockUrlConfig(o, S);
53
53
  });
54
- try {
55
- await l.fetchRecommendationCreateData();
56
- } catch (t) {
57
- console.warn(
58
- "Recommendation reference data pre-load failed; validator will skip the availability check.",
59
- t
60
- );
61
- }
62
54
  }
63
- const _ = () => {
64
- const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
55
+ const M = () => {
56
+ const a = H(), t = U(), { getCompiledEmail: m, getTemplateData: p } = P(), { compileHtml: c, compileAmpHtml: r } = D();
65
57
  return {
66
58
  prepareTemplateDetails: async () => {
67
- const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
59
+ const { html: n, ampHtml: e = "", ampErrors: S = [] } = await m({
68
60
  minimize: !0,
69
61
  resetDataSavedFlag: !1
70
- }), { html: p, css: g, syncModulesIds: f = [] } = await l();
71
- o.selectedUnsubscribePages.length && await o.fetchTemplates(), await U(p);
72
- const { compiledHtml: u, stats: n, appliedRules: y } = t(r), h = i.getSelectedDynamicContentList, A = b();
62
+ }), { html: l, css: g, syncModulesIds: f = [] } = await p();
63
+ t.selectedUnsubscribePages.length && await t.fetchTemplates(), x(l);
64
+ const { compiledHtml: u, stats: s, appliedRules: A } = c(n), h = e && r(e).compiledHtml, C = a.getSelectedDynamicContentList, T = b();
73
65
  return console.debug("HTML Compilation Stats:", {
74
- originalSize: n.originalSize,
75
- compiledSize: n.compiledSize,
76
- reduction: `${n.reductionPercentage.toFixed(2)}%`,
77
- appliedRules: y,
78
- executionTime: `${n.executionTime.toFixed(2)}ms`
66
+ originalSize: s.originalSize,
67
+ compiledSize: s.compiledSize,
68
+ reduction: `${s.reductionPercentage.toFixed(2)}%`,
69
+ appliedRules: A,
70
+ executionTime: `${s.executionTime.toFixed(2)}ms`
79
71
  }), {
80
- dynamicContentList: h,
72
+ dynamicContentList: C,
81
73
  compiledHtml: u,
82
- rawHtml: p,
74
+ rawHtml: l,
83
75
  css: g,
84
- ampHtml: a,
85
- ampErrors: e,
76
+ ampHtml: h,
77
+ ampErrors: S,
86
78
  modules: f.map(Number),
87
79
  recommendation: {
88
- campaignUrls: A.recommendationCampaignUrls,
80
+ campaignUrls: T.recommendationCampaignUrls,
89
81
  configs: {}
90
82
  },
91
83
  unsubscribe: {
92
- status: o.unsubscribePagesStatus,
93
- config: E(u, o.selectedUnsubscribePages)
84
+ status: t.unsubscribePagesStatus,
85
+ config: F(u, t.selectedUnsubscribePages)
94
86
  }
95
87
  };
96
88
  }
97
89
  };
98
90
  };
99
91
  export {
100
- _ as useTemplatePreparation
92
+ M as useTemplatePreparation
101
93
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.4.1-beta.baebb5e",
3
+ "version": "3.4.1-beta.ce8d9b0",
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",