@useinsider/guido 3.23.0-beta.ff29317 → 3.24.0-beta.003db4c

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.
package/README.md CHANGED
@@ -124,7 +124,12 @@ const config: GuidoConfigInput = {
124
124
  // host-side). Omit it and the repair is a silent no-op. Default: {}.
125
125
  dynamicContentList?: DynamicContentList,
126
126
  selectedUnsubscribePages?: number[],
127
- forceRecreate?: boolean, // Default: false - Force recreate template in Stripo storage
127
+ // Default: false. Stripo opens its stored copy for the templateId unless this is true;
128
+ // Guido sets it itself when a load-time migration rewrote the html. Set it to true
129
+ // whenever the host changed html under an existing templateId outside the editor.
130
+ // Behaviour change: releases up to v3.23.0 forced a recreate for any non-empty html and
131
+ // ignored this option, so a host that sends `false` now gets Stripo's stored copy.
132
+ forceRecreate?: boolean,
128
133
  migration?: {
129
134
  // Legacy block configs keyed by block ID. Consumed once by the migrator
130
135
  // when upgrading templates authored with v1 block formats. See the
@@ -12,7 +12,7 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "8422eef8"
15
+ "0191951d"
16
16
  );
17
17
  const c = n.exports;
18
18
  export {
@@ -151,7 +151,7 @@ const Ft = /* @__PURE__ */ le({
151
151
  console.debug("guido:ready"), s("ready");
152
152
  }
153
153
  };
154
- p = U(), await R(r, v(), de), g.selectedDynamicContentList = x;
154
+ p = U(), await R(r, v(), de, r.html !== i), g.selectedDynamicContentList = x;
155
155
  } catch (e) {
156
156
  console.error("Failed to initialize Stripo editor:", e), n.markFailed();
157
157
  }
@@ -16,6 +16,8 @@ const x = /* @__PURE__ */ new Set([
16
16
  "fix-tags-end",
17
17
  // Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
18
18
  "strip-font-tags",
19
+ // Trim whitespace inside href values — attribute-value edit only, emits nothing new.
20
+ "trim-href-whitespace",
19
21
  // Image domain corrections — plain string replacement.
20
22
  "replace-old-image-domain",
21
23
  "replace-old-v2-image-domain",
@@ -1,54 +1,54 @@
1
- import { useActionsApi as M } from "./useActionsApi.js";
2
- import { useBlocksConfig as N } from "./useBlocksConfig.js";
3
- import { useConfig as j } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as _ } from "./useCustomInterfaceAppearance.js";
5
- import { useFullStoryBridge as z } from "./useFullStoryBridge.js";
6
- import { useModuleRepair as $ } from "./useModuleRepair.js";
7
- import { useStripoEventHandler as G } from "./useStripoEventHandler.js";
8
- import { useStripoNotifications as X } from "./useStripoNotifications.js";
9
- import { useToaster as J } from "./useToaster.js";
10
- import { localePatch as K } from "../config/i18n/index.js";
1
+ import { useActionsApi as N } from "./useActionsApi.js";
2
+ import { useBlocksConfig as j } from "./useBlocksConfig.js";
3
+ import { useConfig as z } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as v } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as $ } from "./useFullStoryBridge.js";
6
+ import { useModuleRepair as G } from "./useModuleRepair.js";
7
+ import { useStripoEventHandler as X } from "./useStripoEventHandler.js";
8
+ import { useStripoNotifications as J } from "./useStripoNotifications.js";
9
+ import { useToaster as K } from "./useToaster.js";
10
+ import { localePatch as Q } from "../config/i18n/index.js";
11
11
  import { en as B } from "../config/i18n/en/index.js";
12
- import { ToasterTypeOptions as Q } from "../enums/toaster.js";
13
- import { useStripoApi as W } from "../services/stripoApi.js";
14
- import Y from "../static/styles/customEditorStyle.css.js";
15
- import { useEditorStore as v } from "../stores/editor.js";
16
- import { buildMergeTagEntries as Z, flattenDynamicContentList as ee } from "../utils/genericUtil.js";
17
- import { getStripoRuntimeBaseUrl as te } from "../utils/stripoRuntime.js";
18
- let d = null, T = !1;
19
- const we = (e) => {
20
- const { features: u, template: m, isFeatureEnabled: p } = j(), { handleError: f, showToaster: F } = J(), { getToken: A, getCustomFonts: P, getSyncModulesStatus: R } = W(), { handleEvent: U } = G(), { handleModuleAdd: V } = $(), { getStripoBlocksConfig: D } = N(), { getStripoNotifications: I } = X(), g = () => d || (d = new Promise((a, s) => {
12
+ import { ToasterTypeOptions as W } from "../enums/toaster.js";
13
+ import { useStripoApi as Y } from "../services/stripoApi.js";
14
+ import Z from "../static/styles/customEditorStyle.css.js";
15
+ import { useEditorStore as T } from "../stores/editor.js";
16
+ import { buildMergeTagEntries as ee, flattenDynamicContentList as te } from "../utils/genericUtil.js";
17
+ import { getStripoRuntimeBaseUrl as oe } from "../utils/stripoRuntime.js";
18
+ let d = null, F = !1;
19
+ const ke = (t) => {
20
+ const { features: u, template: m, isFeatureEnabled: p } = z(), { handleError: f, showToaster: A } = K(), { getToken: P, getCustomFonts: R, getSyncModulesStatus: U } = Y(), { handleEvent: V } = X(), { handleModuleAdd: D } = G(), { getStripoBlocksConfig: I } = j(), { getStripoNotifications: L } = J(), g = () => d || (d = new Promise((n, a) => {
21
21
  if (document.getElementById("UiEditorScript")) {
22
- a();
22
+ n();
23
23
  return;
24
24
  }
25
- const i = te();
25
+ const i = oe();
26
26
  if (!i) {
27
- s(
27
+ a(
28
28
  new Error("guido.stripo.version is not set in package.json. Please configure the Stripo version.")
29
29
  );
30
30
  return;
31
31
  }
32
- const n = `${i}UIEditor.js`, t = document.createElement("script");
33
- t.id = "UiEditorScript", t.type = "module", t.src = n, t.onload = () => {
34
- T = !0, a();
35
- }, t.onerror = () => {
36
- t.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${n}`));
37
- }, document.body.appendChild(t);
32
+ const s = `${i}UIEditor.js`, e = document.createElement("script");
33
+ e.id = "UiEditorScript", e.type = "module", e.src = s, e.onload = () => {
34
+ F = !0, n();
35
+ }, e.onerror = () => {
36
+ e.remove(), a(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
37
+ }, document.body.appendChild(e);
38
38
  }), d.catch(() => {
39
39
  d = null;
40
- }), d), L = async (a, s, i, n = [], t = !1) => {
41
- var C, w, k, b;
42
- const o = v(), { html: c, css: S } = a, { baseBlocks: y, extensions: q } = await D();
43
- e.mark("blocks_config_ready");
44
- const E = ((C = u.value) == null ? void 0 : C.displayConditions) ?? !0, x = ((w = u.value) == null ? void 0 : w.modulesDisabled) ?? !1, h = !!c || (((k = m.value) == null ? void 0 : k.forceRecreate) ?? !1), O = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
- e.setTemplate({ html: c, css: S, forceRecreate: h }), _().importCss(), e.mark("init_editor"), await window.UIEditor.initEditor(
40
+ }), d), q = async (n, a, i, s = [], e = !1, c = !1) => {
41
+ var w, k, b, _;
42
+ const o = T(), { html: S, css: y } = n, { baseBlocks: E, extensions: x } = await I();
43
+ t.mark("blocks_config_ready");
44
+ const h = ((w = u.value) == null ? void 0 : w.displayConditions) ?? !0, O = ((k = u.value) == null ? void 0 : k.modulesDisabled) ?? !1, C = c || (((b = m.value) == null ? void 0 : b.forceRecreate) ?? !1), H = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
45
+ t.setTemplate({ html: S, css: y, forceRecreate: C }), v().importCss(), t.mark("init_editor"), await window.UIEditor.initEditor(
46
46
  document.querySelector("#guido-editor"),
47
47
  {
48
- metadata: s,
49
- html: c,
50
- css: S,
51
- forceRecreate: h,
48
+ metadata: a,
49
+ html: S,
50
+ css: y,
51
+ forceRecreate: C,
52
52
  locale: "en",
53
53
  undoButtonSelector: "#guido__undo-button",
54
54
  redoButtonSelector: "#guido__redo-button",
@@ -58,12 +58,12 @@ const we = (e) => {
58
58
  customAppearanceMergetags: !p("liquidSyntax"),
59
59
  customAppearanceMergetagsBorderColor: "#f1f3fe",
60
60
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
61
- customViewStyles: Y,
62
- conditionsEnabled: E,
63
- customConditionsEnabled: E,
61
+ customViewStyles: Z,
62
+ conditionsEnabled: h,
63
+ customConditionsEnabled: h,
64
64
  enableXSSSecurity: !0,
65
- modulesDisabled: x,
66
- syncModulesEnabled: t,
65
+ modulesDisabled: O,
66
+ syncModulesEnabled: e,
67
67
  messageSettingsEnabled: !0,
68
68
  displayGmailAnnotations: !0,
69
69
  displayHiddenPreheader: !1,
@@ -73,37 +73,37 @@ const we = (e) => {
73
73
  copyPasteEnabled: !1,
74
74
  selectElementAfterDrop: !0,
75
75
  sameFontSizeForOutlook: !0,
76
- allowedScriptSourceDomains: O,
77
- ...y ? { baseBlocks: y } : {},
76
+ allowedScriptSourceDomains: H,
77
+ ...E ? { baseBlocks: E } : {},
78
78
  editorFonts: {
79
79
  showDefaultStandardFonts: !0,
80
80
  showDefaultNotStandardFonts: !0,
81
- customFonts: n
81
+ customFonts: s
82
82
  },
83
83
  mergeTags: [
84
84
  {
85
- entries: Z(
85
+ entries: ee(
86
86
  i.preselectedDynamicContentList,
87
- ee((b = m.value) == null ? void 0 : b.dynamicContentList),
87
+ te((_ = m.value) == null ? void 0 : _.dynamicContentList),
88
88
  p("liquidSyntax")
89
89
  )
90
90
  }
91
91
  ],
92
92
  async onTokenRefreshRequest(r) {
93
93
  try {
94
- e.mark("token_start");
95
- const l = await A();
96
- e.mark("token_end"), r(l);
94
+ t.mark("token_start");
95
+ const l = await P();
96
+ t.mark("token_end"), r(l);
97
97
  } catch (l) {
98
98
  f(l, "Failed to refresh token");
99
99
  }
100
100
  },
101
101
  onTemplateLoaded() {
102
102
  try {
103
- const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = M(), { injectFullStory: H } = z();
104
- _().importCss(), r(), H(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
103
+ const { activateCustomViewStyles: r, updateTimerInClonedTemplate: l } = N(), { injectFullStory: M } = $();
104
+ v().importCss(), r(), M(), l(), i.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
105
105
  o.hasChanges = !1;
106
- }, 1e3), e.markReady();
106
+ }, 1e3), t.markReady();
107
107
  } catch (r) {
108
108
  f(r, "Failed to load custom interface appearance");
109
109
  }
@@ -120,9 +120,9 @@ const we = (e) => {
120
120
  onDataChanged() {
121
121
  o.hasChanges = !0, o.changeSeq += 1;
122
122
  },
123
- onEvent: U,
124
- onModuleAdd: V,
125
- notifications: I(),
123
+ onEvent: V,
124
+ onModuleAdd: D,
125
+ notifications: L(),
126
126
  // Stripo deselects the block on any click outside the canvas, so every surface
127
127
  // that belongs to the block's own flow has to be listed here (SD-153273).
128
128
  ignoreClickOutsideSelectors: [
@@ -132,29 +132,29 @@ const we = (e) => {
132
132
  ".in-modal-v2-wrapper",
133
133
  ".in-toasts-wrapper"
134
134
  ],
135
- extensions: q,
136
- localePatch: K
135
+ extensions: x,
136
+ localePatch: Q
137
137
  }
138
138
  );
139
139
  };
140
- return { initPlugin: async (a, s, i) => {
141
- const n = v();
140
+ return { initPlugin: async (n, a, i, s = !1) => {
141
+ const e = T();
142
142
  try {
143
- e.mark("plugin_start"), e.setScriptPreloaded(T), await g(), e.mark("script_ready");
144
- const [t, o] = await Promise.all([
145
- P(),
146
- R()
143
+ t.mark("plugin_start"), t.setScriptPreloaded(F), await g(), t.mark("script_ready");
144
+ const [c, o] = await Promise.all([
145
+ R(),
146
+ U()
147
147
  ]);
148
- e.mark("fonts_sync_ready"), n.syncModulesEnabled = o, await L(a, s, i, t, o);
148
+ t.mark("fonts_sync_ready"), e.syncModulesEnabled = o, await q(n, a, i, c, o, s);
149
149
  } catch {
150
- n.loadingStatus = !1, F({
151
- type: Q.Error,
150
+ e.loadingStatus = !1, A({
151
+ type: W.Error,
152
152
  message: B["An error has occurred. Please report the error code to support."],
153
153
  actionButton: {
154
154
  text: B["Reload page"],
155
155
  onClick: () => window.location.reload()
156
156
  }
157
- }), e.markFailed();
157
+ }), t.markFailed();
158
158
  }
159
159
  }, preloadRuntime: () => {
160
160
  g().catch(() => {
@@ -162,5 +162,5 @@ const we = (e) => {
162
162
  } };
163
163
  };
164
164
  export {
165
- we as useStripo
165
+ ke as useStripo
166
166
  };
@@ -1,5 +1,6 @@
1
- import { stripFontTags as p } from "../../utils/stripFontTags.js";
2
- const d = [
1
+ import { stripFontTags as c } from "../../utils/stripFontTags.js";
2
+ import { trimHrefWhitespace as l } from "../../utils/trimHrefWhitespace.js";
3
+ const f = [
3
4
  {
4
5
  id: "fix-url-encoding-start",
5
6
  description: "Replace {%22 with %7B%22 to fix URL encoding",
@@ -58,9 +59,16 @@ const d = [
58
59
  id: "strip-font-tags",
59
60
  description: 'Unwrap browser-translate-injected <font dir="auto"> tags, keeping inner content; other <font> elements are left intact.',
60
61
  type: "custom",
61
- processor: (e) => p(e),
62
+ processor: (e) => c(e),
62
63
  priority: 15
63
64
  },
65
+ {
66
+ id: "trim-href-whitespace",
67
+ description: "Trim leading/trailing whitespace and &nbsp; from every href value",
68
+ type: "custom",
69
+ processor: (e) => l(e),
70
+ priority: 16
71
+ },
64
72
  {
65
73
  id: "remove-apty-iframe",
66
74
  description: "Cleanup Apty Iframe Code",
@@ -157,8 +165,8 @@ const d = [
157
165
  processor: (e) => {
158
166
  const t = (i) => i.toString(16).padStart(2, "0");
159
167
  return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
160
- const [s, a, c] = [Number(o), Number(n), Number(r)];
161
- return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
168
+ const [s, a, p] = [Number(o), Number(n), Number(r)];
169
+ return s > 255 || a > 255 || p > 255 ? i : `#${t(s)}${t(a)}${t(p)}`;
162
170
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
163
171
  },
164
172
  priority: 44
@@ -200,5 +208,5 @@ const d = [
200
208
  }
201
209
  ];
202
210
  export {
203
- d as defaultHtmlCompilerRules
211
+ f as defaultHtmlCompilerRules
204
212
  };
@@ -1,114 +1,239 @@
1
- import { CURRENCY_ATTR as l, CSS_CLASS_SKIP_COMPILE as m } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
- const a = "You May Also Like!";
3
- function C(e) {
4
- var n;
5
- const r = e.querySelector(".ext-recommendation-title");
6
- if (!r)
7
- return a;
8
- const t = (n = r.textContent) == null ? void 0 : n.trim();
9
- return t && t.length > 0 ? t : a;
10
- }
11
- function A(e) {
12
- const r = e.querySelector(".ext-recommendation-title");
13
- return r ? !/display\s*:\s*none/i.test(r.getAttribute("style") ?? "") : !1;
14
- }
15
- function _(e) {
16
- var t;
17
- const r = e.querySelector(".ext-recommendation-title");
18
- return !!r && !((t = r == null ? void 0 : r.textContent) != null && t.trim());
19
- }
20
- function E(e) {
21
- const r = e.querySelector(".ext-product-price"), t = e.querySelector(".ext-product-original-price");
22
- return !r || !t ? !1 : r.compareDocumentPosition(t) === Node.DOCUMENT_POSITION_PRECEDING;
23
- }
24
- function d(e) {
25
- return /(?:^|;)\s*display\s*:\s*table-cell/i.test(e.getAttribute("style") ?? "");
26
- }
27
- function T(e) {
28
- var n, o;
29
- const r = (n = e.querySelector(".ext-product-price")) == null ? void 0 : n.closest("tr"), t = (o = e.querySelector(".ext-product-original-price")) == null ? void 0 : o.closest("tr");
30
- return !r || !t || r === t ? !1 : !d(r) && !d(t);
31
- }
32
- const p = /* @__PURE__ */ new Map([
1
+ import { CURRENCY_ATTR as _, CSS_CLASS_SKIP_COMPILE as v } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ const A = "You May Also Like!";
3
+ function z(t) {
4
+ var r;
5
+ const e = t.querySelector(".ext-recommendation-title");
6
+ if (!e)
7
+ return A;
8
+ const o = (r = e.textContent) == null ? void 0 : r.trim();
9
+ return o && o.length > 0 ? o : A;
10
+ }
11
+ function L(t) {
12
+ const e = t.querySelector(".ext-recommendation-title");
13
+ return e ? !/display\s*:\s*none/i.test(e.getAttribute("style") ?? "") : !1;
14
+ }
15
+ function X(t) {
16
+ var o;
17
+ const e = t.querySelector(".ext-recommendation-title");
18
+ return !!e && !((o = e == null ? void 0 : e.textContent) != null && o.trim());
19
+ }
20
+ function K(t) {
21
+ const e = t.querySelector(".ext-product-price"), o = t.querySelector(".ext-product-original-price");
22
+ return !e || !o ? !1 : e.compareDocumentPosition(o) === Node.DOCUMENT_POSITION_PRECEDING;
23
+ }
24
+ function E(t) {
25
+ return /(?:^|;)\s*display\s*:\s*table-cell/i.test(t.getAttribute("style") ?? "");
26
+ }
27
+ function H(t) {
28
+ var r, n;
29
+ const e = (r = t.querySelector(".ext-product-price")) == null ? void 0 : r.closest("tr"), o = (n = t.querySelector(".ext-product-original-price")) == null ? void 0 : n.closest("tr");
30
+ return !e || !o || e === o ? !1 : !E(e) && !E(o);
31
+ }
32
+ const P = ["font-family", "font-size", "font-weight", "font-style"], O = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([\d\s.,%/]+\)|[a-z]+)$/i, q = /^(\d+(?:\.\d+)?)(px)?$/;
33
+ function l(t) {
34
+ const e = {};
35
+ return ((t == null ? void 0 : t.getAttribute("style")) ?? "").split(";").forEach((o) => {
36
+ const r = o.indexOf(":"), n = o.slice(0, r).trim().toLowerCase(), i = o.slice(r + 1).replace(/!important/i, "").trim();
37
+ r > 0 && n && i && (e[n] = i);
38
+ }), e;
39
+ }
40
+ function d(t) {
41
+ const e = t == null ? void 0 : t.trim().match(q);
42
+ return e ? Number(e[1]) : void 0;
43
+ }
44
+ function a(t) {
45
+ return t && O.test(t.trim()) ? t.trim() : void 0;
46
+ }
47
+ const w = /* @__PURE__ */ new Map([
33
48
  ["p_name", ".ext-product-name p"],
34
49
  ["p_price", ".ext-product-price p"],
35
50
  ["p_original_price", ".ext-product-original-price p"]
36
51
  ]);
37
- function f(e) {
38
- const r = ((e == null ? void 0 : e.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
39
- return (r == null ? void 0 : r[1].trim()) || void 0;
52
+ function B(t) {
53
+ return a(l(t).color);
40
54
  }
41
- const x = "ins-trim-text";
42
- function h(e, r) {
43
- return e == null ? void 0 : e.map((t) => {
55
+ const I = "ins-trim-text";
56
+ function J(t, e) {
57
+ return t == null ? void 0 : t.map((o) => {
44
58
  var s, u;
45
- const n = p.get(t.variable ?? "");
46
- if (!n)
47
- return t;
48
- const o = r.querySelector(n), c = (u = (s = t.theme) == null ? void 0 : s.textColor) != null && u.color ? void 0 : f(o), i = t.variable === "p_name" && (o == null ? void 0 : o.classList.contains(x));
49
- return !c && !i ? t : {
50
- ...t,
59
+ const r = w.get(o.variable ?? "");
60
+ if (!r)
61
+ return o;
62
+ const n = e.querySelector(r), i = (u = (s = o.theme) == null ? void 0 : s.textColor) != null && u.color ? void 0 : B(n), c = o.variable === "p_name" && (n == null ? void 0 : n.classList.contains(I));
63
+ return !i && !c ? o : {
64
+ ...o,
51
65
  theme: {
52
- ...t.theme,
53
- ...c ? { textColor: { color: c } } : {},
54
- ...i ? { textTrimming: !0 } : {}
66
+ ...o.theme,
67
+ ...i ? { textColor: { color: i } } : {},
68
+ ...c ? { textTrimming: !0 } : {}
55
69
  }
56
70
  };
57
71
  });
58
72
  }
59
- function R(e) {
60
- const r = [
61
- e,
62
- ...Array.from(e.querySelectorAll(".product-card, .ext-recommendation-card"))
73
+ function Q(t) {
74
+ const e = [
75
+ t,
76
+ ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
63
77
  ];
64
- let t = "";
65
- return r.some((n) => {
66
- const o = n.getAttribute("bgcolor");
67
- if (o && o.trim())
68
- return t = o.trim(), !0;
69
- const i = (n.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
70
- return i && i[1] ? (t = i[1].trim(), !0) : !1;
71
- }), t;
72
- }
73
- function L(e) {
74
- const r = e.getAttribute(l.CURRENCY), t = e.getAttribute(l.SYMBOL);
78
+ let o = "";
79
+ return e.some((r) => {
80
+ const n = r.getAttribute("bgcolor");
81
+ if (n && n.trim())
82
+ return o = n.trim(), !0;
83
+ const c = (r.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
84
+ return c && c[1] ? (o = c[1].trim(), !0) : !1;
85
+ }), o;
86
+ }
87
+ function W(t) {
88
+ const e = t.getAttribute(_.CURRENCY), o = t.getAttribute(_.SYMBOL);
75
89
  return {
76
- ...r ? { value: r } : {},
90
+ ...e ? { value: e } : {},
77
91
  // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
78
92
  // the currency code as the symbol.
79
- ...t ? { symbol: t } : {},
93
+ ...o ? { symbol: o } : {},
80
94
  alignment: 1,
81
95
  decimalCount: "2",
82
96
  decimalSeparator: ",",
83
97
  thousandSeparator: "."
84
98
  };
85
99
  }
86
- const S = /^es-p(\d+)([trbl]?)$/, g = { t: "top", r: "right", b: "bottom", l: "left" };
87
- function P(e) {
88
- const r = e.querySelector("td.esd-structure.esd-extension-internal-block");
89
- if (!r)
100
+ const N = /^es-p(\d+)([trbl]?)$/, D = { t: "top", r: "right", b: "bottom", l: "left" };
101
+ function Z(t) {
102
+ const e = t.querySelector("td.esd-structure.esd-extension-internal-block");
103
+ if (!e)
90
104
  return;
91
- const t = { top: 0, right: 0, bottom: 0, left: 0 };
92
- return r.classList.forEach((n) => {
93
- const o = n.match(S);
94
- if (!o)
105
+ const o = { top: 0, right: 0, bottom: 0, left: 0 };
106
+ return e.classList.forEach((r) => {
107
+ const n = r.match(N);
108
+ if (!n)
95
109
  return;
96
- const c = Number(o[1]), i = o[2];
97
- i ? t[g[i]] = c : Object.assign(t, { top: c, right: c, bottom: c, left: c });
98
- }), t;
110
+ const i = Number(n[1]), c = n[2];
111
+ c ? o[D[c]] = i : Object.assign(o, { top: i, right: i, bottom: i, left: i });
112
+ }), o;
113
+ }
114
+ function f(t) {
115
+ const e = (t.padding ?? "").split(/\s+/).filter(Boolean).map(d), o = e.every((u) => u !== void 0) ? e : [], r = o[0] ?? 0, n = o[1] ?? r, i = o[2] ?? r, c = o[3] ?? n, s = {
116
+ top: d(t["padding-top"]) ?? r,
117
+ right: d(t["padding-right"]) ?? n,
118
+ bottom: d(t["padding-bottom"]) ?? i,
119
+ left: d(t["padding-left"]) ?? c
120
+ };
121
+ return Object.values(s).some(Boolean) ? s : void 0;
122
+ }
123
+ function k(t, e) {
124
+ return !t || !e ? t ?? e : {
125
+ top: t.top + e.top,
126
+ right: t.right + e.right,
127
+ bottom: t.bottom + e.bottom,
128
+ left: t.left + e.left
129
+ };
130
+ }
131
+ function h(t) {
132
+ const e = Object.fromEntries(P.filter((o) => t[o]).map((o) => [o, t[o]]));
133
+ return Object.keys(e).length ? e : void 0;
134
+ }
135
+ function g(t) {
136
+ return t === void 0 ? void 0 : { top: t, right: t, bottom: t, left: t };
137
+ }
138
+ function x(t) {
139
+ const e = Object.entries(t).filter(([, o]) => o !== void 0);
140
+ return e.length ? Object.fromEntries(e) : void 0;
141
+ }
142
+ function p(t) {
143
+ const e = t.querySelector("p"), o = l(t), r = l(e ?? t), n = a(r.color), i = a(o["background-color"]), c = k(f(o), e ? f(r) : void 0), s = t.getAttribute("align");
144
+ return x({
145
+ textStyle: h(r),
146
+ textColor: n ? { color: n } : void 0,
147
+ textBackgroundColor: i ? { color: i } : void 0,
148
+ textPadding: c ? { desktop: c } : void 0,
149
+ textLineSpacing: r["line-height"] ? { lineSpacing: r["line-height"] } : void 0,
150
+ textAlign: s ? { align: s } : void 0
151
+ });
152
+ }
153
+ function M(t) {
154
+ const e = d(t["border-width"]), o = t["border-style"], r = a(t["border-color"]);
155
+ if (!(e === void 0 && !o && !r))
156
+ return { width: g(e), style: g(o), color: g(r) };
157
+ }
158
+ function F(t) {
159
+ var C;
160
+ const e = l(t.querySelector(".es-button-border")), o = t.querySelector("a"), r = l(o), n = (C = o == null ? void 0 : o.textContent) == null ? void 0 : C.trim(), i = a(e["background-color"] ?? e.background ?? r["background-color"] ?? r.background), c = a(r.color), s = d(e["border-radius"] ?? r["border-radius"]), u = f(r), S = f(l(t)), y = t.getAttribute("align"), { display: m } = e;
161
+ return x({
162
+ buttonText: n ? { text: n } : void 0,
163
+ buttonStyle: h(r),
164
+ buttonColor: i ? { color: i } : void 0,
165
+ textButtonColor: c ? { color: c } : void 0,
166
+ buttonBorder: M(e),
167
+ buttonBorderRadius: s === void 0 ? void 0 : { radius: s },
168
+ buttonInternalPadding: u ? { desktop: u } : void 0,
169
+ buttonExternalPadding: S ? { desktop: S } : void 0,
170
+ buttonStretch: m === "block" || m === "inline-block" ? { stretched: m === "block" } : void 0,
171
+ buttonAlign: y ? { align: y } : void 0
172
+ });
173
+ }
174
+ function Y(t) {
175
+ const e = t.querySelector("img"), o = d(e == null ? void 0 : e.getAttribute("width")), r = d(e == null ? void 0 : e.getAttribute("height"));
176
+ return o === void 0 && r === void 0 ? void 0 : { imageSize: { width: o, height: r } };
177
+ }
178
+ const j = [
179
+ ["p_image", ".ext-product-image", !1, Y],
180
+ ["p_name", ".ext-product-name", !1, p],
181
+ ["p_original_price", ".ext-product-original-price", !1, p],
182
+ ["p_price", ".ext-product-price", !1, p],
183
+ ["p_omnibus_price", ".ext-product-omnibus-price", !0, p],
184
+ ["p_omnibus_discount", ".ext-product-omnibus-discount", !0, p],
185
+ ["p_button", ".ext-product-button", !1, F]
186
+ ];
187
+ function b(t, e) {
188
+ return e ? { ...t, theme: e } : t;
189
+ }
190
+ function G(t) {
191
+ const e = t.querySelector(".ext-recommendation-title");
192
+ if (!e)
193
+ return [];
194
+ const o = l(e.querySelector("p") ?? e), r = a(o.color), n = x({ textStyle: h(o), textColor: r ? { color: r } : void 0 });
195
+ return [b({ variable: "p_recommendation_title", hidden: !L(t) }, n)];
196
+ }
197
+ function U(t) {
198
+ const e = j.flatMap(([n, i, c, s]) => {
199
+ const u = t.querySelector(i);
200
+ return u ? [b({ variable: n, hidden: c }, s(u))] : [];
201
+ }), o = t.querySelectorAll(".ext-ins-attr p[product-attr]"), r = Array.from(o, (n, i) => b({
202
+ variable: `p_attribute_${i}`,
203
+ variableType: "p_attribute",
204
+ value: n.getAttribute("product-attr") ?? "",
205
+ hidden: !1
206
+ }, p(n.closest(".ext-ins-attr") ?? n)));
207
+ return [...e, ...r];
208
+ }
209
+ const R = "td.product-card", T = (t) => t.querySelectorAll(R).length;
210
+ function V(t, e) {
211
+ let o = e.parentElement;
212
+ for (; o && o !== t && T(o) < 2; )
213
+ o = o.parentElement;
214
+ return !o || o === t ? 0 : o.tagName === "TBODY" || o.tagName === "TABLE" ? 1 : T(o);
215
+ }
216
+ function tt(t) {
217
+ const e = t.querySelectorAll(R), [o] = e, r = o ? V(t, o) : 0, n = o ? U(o) : [];
218
+ return {
219
+ ...e.length ? { totalCount: e.length } : {},
220
+ ...r ? { rowCount: r } : {},
221
+ composition: { variables: n.length ? [...G(t), ...n] : [] }
222
+ };
99
223
  }
100
- function I(e) {
101
- return e.classList.contains(m);
224
+ function et(t) {
225
+ return t.classList.contains(v);
102
226
  }
103
227
  export {
104
- R as extractCardBgColor,
105
- L as extractCurrencyFromBlock,
106
- P as extractRenderedBlockPadding,
107
- C as extractTitleText,
108
- _ as hasEmptyTitle,
109
- A as hasVisibleTitle,
110
- E as isOldPriceFirst,
111
- I as isPartnerManagedBlock,
112
- T as isPriceOnNextLine,
113
- h as withRenderedTextTheme
228
+ Q as extractCardBgColor,
229
+ W as extractCurrencyFromBlock,
230
+ Z as extractRenderedBlockPadding,
231
+ z as extractTitleText,
232
+ X as hasEmptyTitle,
233
+ L as hasVisibleTitle,
234
+ tt as inferLegacyConfig,
235
+ K as isOldPriceFirst,
236
+ et as isPartnerManagedBlock,
237
+ H as isPriceOnNextLine,
238
+ J as withRenderedTextTheme
114
239
  };
@@ -1,33 +1,35 @@
1
- function c(e) {
2
- return e.replace(/&#x27;/g, "'").replace(/&#x2F;/g, "/").replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
1
+ const s = "esd-dev-product-config";
2
+ function a(t) {
3
+ return t.replace(/&#x27;/g, "'").replace(/&#x2F;/g, "/").replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
3
4
  }
4
- function s(e) {
5
- const t = e.getAttribute("esd-dev-product-config");
6
- if (!t)
5
+ function o(t) {
6
+ const e = t.getAttribute(s);
7
+ if (!e)
7
8
  return null;
8
9
  try {
9
- const n = c(c(t));
10
+ const n = a(a(e));
10
11
  return JSON.parse(n);
11
12
  } catch {
12
13
  return null;
13
14
  }
14
15
  }
15
- function i(e) {
16
- const t = e.getAttribute("ins-recommendation-v3-campaign-id");
17
- if (t) {
18
- const r = parseInt(t);
16
+ function i(t) {
17
+ const e = t.getAttribute("ins-recommendation-v3-campaign-id");
18
+ if (e) {
19
+ const r = parseInt(e);
19
20
  if (!Number.isNaN(r))
20
21
  return r;
21
22
  }
22
- const a = (e.getAttribute("class") ?? "").match(/ins-recommendation-v3-block-(\d+)/);
23
- if (a) {
24
- const r = parseInt(a[1]);
23
+ const c = (t.getAttribute("class") ?? "").match(/ins-recommendation-v3-block-(\d+)/);
24
+ if (c) {
25
+ const r = parseInt(c[1]);
25
26
  if (!Number.isNaN(r))
26
27
  return r;
27
28
  }
28
29
  return null;
29
30
  }
30
31
  export {
31
- s as parseLegacyConfig,
32
+ s as LEGACY_CONFIG_ATTR,
33
+ o as parseLegacyConfig,
32
34
  i as parseRecommendationId
33
35
  };
@@ -1,59 +1,69 @@
1
1
  import { BlockId as b } from "../../enums/block.js";
2
- import { DEFAULT_NODE_CONFIG as C } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
- import { ATTR_RECOMMENDATION_TITLE as f } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useTemplateStore as M } from "../../stores/template.js";
5
- import { mapComposition as x } from "./recommendation/compositionMapper.js";
6
- import { isPriceOnNextLine as R, extractCurrencyFromBlock as h, isOldPriceFirst as S, withRenderedTextTheme as w, extractTitleText as E, hasEmptyTitle as L, hasVisibleTitle as B, extractCardBgColor as P, isPartnerManagedBlock as A, extractRenderedBlockPadding as H } from "./recommendation/extractors.js";
7
- import { buildBlockHtml as N } from "./recommendation/htmlBuilder.js";
8
- import { parseRecommendationId as O, parseLegacyConfig as F } from "./recommendation/parseLegacyConfig.js";
9
- import { mapSettings as I } from "./recommendation/settingsMapper.js";
10
- import { mapBlockPadding as _ } from "./recommendation/themeMapper.js";
11
- const k = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
12
- function $(c, e, m) {
13
- var l, g, p;
14
- const t = O(e);
15
- if (t === null)
2
+ import { DEFAULT_NODE_CONFIG as M } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_RECOMMENDATION_TITLE as u } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useTemplateStore as x } from "../../stores/template.js";
5
+ import { mapComposition as L } from "./recommendation/compositionMapper.js";
6
+ import { inferLegacyConfig as A, isPriceOnNextLine as B, extractCurrencyFromBlock as E, isOldPriceFirst as S, withRenderedTextTheme as w, extractTitleText as P, hasEmptyTitle as H, hasVisibleTitle as O, extractCardBgColor as _, isPartnerManagedBlock as I, extractRenderedBlockPadding as N } from "./recommendation/extractors.js";
7
+ import { buildBlockHtml as F } from "./recommendation/htmlBuilder.js";
8
+ import { LEGACY_CONFIG_ATTR as m, parseRecommendationId as $, parseLegacyConfig as k } from "./recommendation/parseLegacyConfig.js";
9
+ import { mapSettings as D } from "./recommendation/settingsMapper.js";
10
+ import { mapBlockPadding as G } from "./recommendation/themeMapper.js";
11
+ const V = [
12
+ `td[${m}][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2)`,
13
+ `td.product-block[esd-handler-name*="EmailRecommendationV3"][${m}]:not(.recommendation-block-v2)`,
14
+ `td.product-block[class*="ins-recommendation-v3-block-"]:not([${m}]):not([esd-ext-config]):not(.recommendation-block-v2)`
15
+ ].join(", "), U = /{{\s*\d+_\d+_/, T = (i) => {
16
+ var e;
17
+ return !!((e = i.getAttribute(m)) != null && e.trim());
18
+ };
19
+ function q(i, e, s) {
20
+ var g, p, f;
21
+ const o = $(e);
22
+ if (o === null)
16
23
  return console.warn(
17
24
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
18
25
  ), !1;
19
- const r = F(e);
26
+ const a = T(e), r = a ? k(e) : A(e);
20
27
  if (!r)
21
28
  return console.warn(
22
- `[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
29
+ `[RecommendationMigrator] Aborting block id=${o} — \`esd-dev-product-config\` unable to be parsed`
23
30
  ), !1;
24
- const o = m[String(t)] ?? {}, n = {
25
- ...o,
26
- currencySettings: o.currencySettings ?? h(e),
27
- isPriceMovedToNextLine: o.isPriceMovedToNextLine ?? R(e)
28
- }, a = I(n, r, t), i = x(
29
- w((l = r.composition) == null ? void 0 : l.variables, e),
31
+ a || console.info(
32
+ `[RecommendationMigrator] Block id=${o} has no \`esd-dev-product-config\`, inferred from the html`
33
+ );
34
+ const t = s[String(o)] ?? {}, c = {
35
+ ...t,
36
+ currencySettings: t.currencySettings ?? E(e),
37
+ isPriceMovedToNextLine: t.isPriceMovedToNextLine ?? B(e)
38
+ }, y = D(c, r, o), n = L(
39
+ w((g = r.composition) == null ? void 0 : g.variables, e),
30
40
  { oldPriceFirst: S(e) }
31
- ), u = E(e);
32
- L(e) ? i.visibility[f] = !1 : i.titleVariable || (i.visibility[f] = B(e));
33
- const y = P(e), T = {
34
- ...a,
41
+ ), C = P(e);
42
+ H(e) ? n.visibility[u] = !1 : n.titleVariable || (n.visibility[u] = O(e));
43
+ const v = _(e), h = {
44
+ ...y,
35
45
  strategyId: "",
36
- composition: i.composition,
37
- visibility: i.visibility,
38
- previousTitleHtml: C.previousTitleHtml,
39
- textTrimming: i.anyTextTrimming
40
- }, s = A(e), v = `
46
+ composition: n.composition,
47
+ visibility: n.visibility,
48
+ previousTitleHtml: M.previousTitleHtml,
49
+ textTrimming: n.anyTextTrimming
50
+ }, d = I(e), R = `
41
51
  <table>
42
52
  <tbody>
43
53
  <tr>
44
54
  <td class="esd-structure" align="left">
45
55
  <table width="100%" cellpadding="0" cellspacing="0">
46
56
  <tbody>
47
- <tr>${N({
48
- nodeConfig: T,
49
- composition: i,
50
- cardBg: y,
51
- titleText: u,
57
+ <tr>${F({
58
+ nodeConfig: h,
59
+ composition: n,
60
+ cardBg: v,
61
+ titleText: C,
52
62
  legacyId: e.getAttribute("id") ?? void 0,
53
63
  legacyBgColor: e.getAttribute("bgcolor") ?? void 0,
54
- preserveInnerHtml: s ? e.innerHTML : void 0,
55
- skipCompile: s,
56
- blockPadding: _(((p = (g = r.theme) == null ? void 0 : g.blockPadding) == null ? void 0 : p.desktop) ?? H(e))
64
+ preserveInnerHtml: d ? e.innerHTML : void 0,
65
+ skipCompile: d,
66
+ blockPadding: G(((f = (p = r.theme) == null ? void 0 : p.blockPadding) == null ? void 0 : f.desktop) ?? N(e))
57
67
  })}</tr>
58
68
  </tbody>
59
69
  </table>
@@ -61,40 +71,40 @@ function $(c, e, m) {
61
71
  </tr>
62
72
  </tbody>
63
73
  </table>
64
- `, d = c.parseFromString(v, "text/html").querySelector("td.esd-structure");
65
- return !d || !e.parentNode ? (console.warn(
66
- `[RecommendationMigrator] Aborting block id=${t} — failed to construct new HTML element`
67
- ), !1) : (e.parentNode.replaceChild(d, e), !0);
74
+ `, l = i.parseFromString(R, "text/html").querySelector("td.esd-structure");
75
+ return !l || !e.parentNode ? (console.warn(
76
+ `[RecommendationMigrator] Aborting block id=${o} — failed to construct new HTML element`
77
+ ), !1) : (e.parentNode.replaceChild(l, e), !0);
68
78
  }
69
- function X(c, e = {}) {
70
- const m = new DOMParser();
71
- let t;
79
+ function re(i, e = {}) {
80
+ const s = new DOMParser();
81
+ let o;
72
82
  try {
73
- t = m.parseFromString(c, "text/html");
74
- } catch (n) {
75
- return console.error("[RecommendationMigrator] Failed to parse template:", n), c;
83
+ o = s.parseFromString(i, "text/html");
84
+ } catch (t) {
85
+ return console.error("[RecommendationMigrator] Failed to parse template:", t), i;
76
86
  }
77
- const r = Array.from(t.querySelectorAll(k));
87
+ const a = Array.from(o.querySelectorAll(V)).filter((t) => T(t) || U.test(t.innerHTML));
78
88
  try {
79
- M().$patch((a) => {
80
- a.migrations = {
81
- ...a.migrations,
82
- [b.Recommendation]: r.length
89
+ x().$patch((c) => {
90
+ c.migrations = {
91
+ ...c.migrations,
92
+ [b.Recommendation]: a.length
83
93
  };
84
94
  });
85
95
  } catch {
86
96
  }
87
- if (r.length === 0)
88
- return c;
89
- let o = 0;
90
- return r.forEach((n) => {
97
+ if (a.length === 0)
98
+ return i;
99
+ let r = 0;
100
+ return a.forEach((t) => {
91
101
  try {
92
- $(m, n, e) && (o += 1);
93
- } catch (a) {
94
- console.error("[RecommendationMigrator] Unexpected error migrating block:", a);
102
+ q(s, t, e) && (r += 1);
103
+ } catch (c) {
104
+ console.error("[RecommendationMigrator] Unexpected error migrating block:", c);
95
105
  }
96
- }), o > 0 && console.info(`[RecommendationMigrator] Migrated ${o} legacy Recommendation block(s)`), t.documentElement.outerHTML;
106
+ }), r > 0 && console.info(`[RecommendationMigrator] Migrated ${r} legacy Recommendation block(s)`), o.documentElement.outerHTML;
97
107
  }
98
108
  export {
99
- X as migrateRecommendation
109
+ re as migrateRecommendation
100
110
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-9d988e4b] .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}.color-vision-select__dropdown[data-v-64cb50da]{z-index:20;width:387px}.accessibility-toolbar[data-v-391019bc]{gap:16px}.accessibility-toolbar[data-v-391019bc] .in-segments-wrapper__button svg{margin-right:0}.accessibility-toolbar[data-v-391019bc] .in-segments-wrapper__button .clearfix:after{content:none}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-actions-menu__dropdown[data-v-bdb3b37a]{z-index:20;width:222px}.editor-actions[data-v-9a028d08]{gap:16px}.editor-actions__divider[data-v-9a028d08]{width:1px;height:40px;background-color:#e1e1e1}.right-slot[data-v-77451c9a]{gap:16px}.header-wrapper[data-v-3c713746]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-8422eef8]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-8422eef8]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-8422eef8]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-eaf8e461]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-eaf8e461]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-eaf8e461]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-eaf8e461]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-eaf8e461]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.guido-tab-bar-onboarding[data-v-219b4f7c]{z-index:21}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
1
+ @charset "UTF-8";.auth-error-modal[data-v-b4d7ae51]{position:relative;z-index:145}.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-9d988e4b] .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}.color-vision-select__dropdown[data-v-64cb50da]{z-index:20;width:387px}.accessibility-toolbar[data-v-391019bc]{gap:16px}.accessibility-toolbar[data-v-391019bc] .in-segments-wrapper__button svg{margin-right:0}.accessibility-toolbar[data-v-391019bc] .in-segments-wrapper__button .clearfix:after{content:none}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-actions-menu__dropdown[data-v-bdb3b37a]{z-index:20;width:222px}.editor-actions[data-v-9a028d08]{gap:16px}.editor-actions__divider[data-v-9a028d08]{width:1px;height:40px;background-color:#e1e1e1}.right-slot[data-v-77451c9a]{gap:16px}.header-wrapper[data-v-3c713746]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.validation-error-list[data-v-e48cebe9]{gap:16px}.validation-error-row[data-v-e48cebe9]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-e48cebe9]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-e48cebe9]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-0191951d]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-0191951d]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-0191951d]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-eaf8e461]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-eaf8e461]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-eaf8e461]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-eaf8e461]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-eaf8e461]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .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-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{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-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.guido-tab-bar-onboarding[data-v-219b4f7c]{z-index:21}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-ec2027ff] .vueperslides__bullets,[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
@@ -1,4 +1,4 @@
1
- const o = "3.23.0-beta.ff29317", s = { stripo: { version: "2.83.1" } }, t = {
1
+ const o = "3.24.0-beta.003db4c", s = { stripo: { version: "2.83.1" } }, t = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import type { EditorOpenMetrics } from '@@/Composables/useEditorOpenMetrics';
2
2
  import type { Metadata, Options, Template } from '@@/Types/stripo';
3
3
  export declare const useStripo: (openMetrics: EditorOpenMetrics) => {
4
- initPlugin: (template: Template, metadata: Metadata, options: Options) => Promise<void>;
4
+ initPlugin: (template: Template, metadata: Metadata, options: Options, htmlChanged?: boolean) => Promise<void>;
5
5
  preloadRuntime: () => void;
6
6
  };
@@ -1,4 +1,4 @@
1
- import type { LegacyPaddingViewport, LegacyVariable } from './types';
1
+ import type { LegacyPaddingViewport, LegacyProductConfig, LegacyVariable } from './types';
2
2
  export declare function extractTitleText(block: Element): string;
3
3
  /**
4
4
  * Fallback for legacy configs that carry no `p_recommendation_title` variable:
@@ -50,6 +50,13 @@ export declare function extractCurrencyFromBlock(block: Element): Record<string,
50
50
  * @returns The row's `es-p{n}{side}` padding, or undefined when the block has no product row
51
51
  */
52
52
  export declare function extractRenderedBlockPadding(block: Element): LegacyPaddingViewport | undefined;
53
+ /**
54
+ * Settings and styling as the legacy block renders them, for blocks with no `esd-dev-product-config`.
55
+ * Themes come from the first card's inline CSS, in the shape the config-driven path already maps.
56
+ * @param block - The legacy recommendation block element
57
+ * @returns A product config holding only what the rendered markup shows; absent fields fall back to the mappers' defaults
58
+ */
59
+ export declare function inferLegacyConfig(block: Element): LegacyProductConfig;
53
60
  /**
54
61
  * True when a PM has manually opted the legacy block out of content
55
62
  * regeneration by adding the `ins-skip-compile` class. Detected before rebuild
@@ -1,10 +1,10 @@
1
1
  import type { LegacyProductConfig } from './types';
2
+ export declare const LEGACY_CONFIG_ATTR = "esd-dev-product-config";
2
3
  /**
3
4
  * `esd-dev-product-config` is double-HTML-encoded JSON: serialization
4
5
  * escapes once to embed inside the attribute, and Stripo's templating
5
6
  * layer escapes a second time when round-tripping. Returns `null` when
6
- * the attribute is missing or unable to be parsed — the caller treats
7
- * either case as an abort.
7
+ * the attribute is missing or unable to be parsed.
8
8
  */
9
9
  export declare function parseLegacyConfig(block: Element): LegacyProductConfig | null;
10
10
  /**
@@ -1,7 +1,6 @@
1
1
  /**
2
- * Idempotent: the selector matches only blocks that have
3
- * `esd-dev-product-config` AND lack `recommendation-block-v2`, so
4
- * re-running on a migrated template is a no-op.
2
+ * Idempotent: the selector matches only blocks that lack `recommendation-block-v2`,
3
+ * so re-running on a migrated template is a no-op.
5
4
  */
6
5
  import type { LegacyRecommendationConfig } from '@@/Types/config';
7
6
  /**
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Browsers ignore whitespace around an href, but the send-time link rewrite does not:
3
+ * a trailing space ends up inside the path and a leading one skips the tracking params.
4
+ */
5
+ export declare function trimHrefWhitespace(html: string): string;
@@ -0,0 +1,10 @@
1
+ const E = /(<[a-z][\w:-]*(?:\s[^>]*?)?\shref\s*=\s*)(["'])([\s\S]*?)\2/gi, c = /^(?:\s|&nbsp;|&#160;|&#xa0;)+|(?:\s|&nbsp;|&#160;|&#xa0;)+$/gi;
2
+ function a(e) {
3
+ return !e || !/href/i.test(e) ? e : e.replace(E, (i, s, r, n) => {
4
+ const t = n.replace(c, "");
5
+ return `${s}${r}${t}${r}`;
6
+ });
7
+ }
8
+ export {
9
+ a as trimHrefWhitespace
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.23.0-beta.ff29317",
3
+ "version": "3.24.0-beta.003db4c",
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",