@useinsider/guido 3.30.1-beta.51debcb → 3.30.1-beta.63a30e4

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,9 +12,9 @@ var n = function() {
12
12
  t,
13
13
  !1,
14
14
  null,
15
- "0c5f11a1"
15
+ "4eea8564"
16
16
  );
17
- const u = s.exports;
17
+ const c = s.exports;
18
18
  export {
19
- u as default
19
+ c as default
20
20
  };
@@ -1,43 +1,43 @@
1
- import { defineComponent as Se, defineAsyncComponent as a, ref as W, computed as l, watch as $, onMounted as he, onUnmounted as Ee } from "vue";
2
- import { useCortexBlueprintBridge as Ce } from "../composables/useCortexBlueprintBridge.js";
3
- import { useEditorLock as De } from "../composables/useEditorLock.js";
4
- import { startEditorOpenMetrics as we } from "../composables/useEditorOpenMetrics.js";
5
- import { provideGuidoActions as Te } from "../composables/useGuidoActions.js";
6
- import { useGuidoStateBridge as ke } from "../composables/useGuidoStateBridge.js";
7
- import { usePartner as Fe } from "../composables/usePartner.js";
8
- import { useSaveValidationRollout as Me } from "../composables/useSaveValidationRollout.js";
9
- import { useStripo as Ie } from "../composables/useStripo.js";
10
- import { useTimerClone as Le } from "../composables/useTimerClone.js";
11
- import { useToaster as Re } from "../composables/useToaster.js";
12
- import { useTranslations as Oe } from "../composables/useTranslations.js";
13
- import { migrate as Ue } from "../config/migrator/index.js";
1
+ import { defineComponent as he, defineAsyncComponent as a, ref as W, computed as u, watch as $, onMounted as Ee, onUnmounted as Ce } from "vue";
2
+ import { useCortexBlueprintBridge as De } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as we } from "../composables/useEditorLock.js";
4
+ import { startEditorOpenMetrics as Te } from "../composables/useEditorOpenMetrics.js";
5
+ import { provideGuidoActions as ke } from "../composables/useGuidoActions.js";
6
+ import { useGuidoStateBridge as Fe } from "../composables/useGuidoStateBridge.js";
7
+ import { usePartner as Me } from "../composables/usePartner.js";
8
+ import { useSaveValidationRollout as Ie } from "../composables/useSaveValidationRollout.js";
9
+ import { useStripo as Le } from "../composables/useStripo.js";
10
+ import { useTimerClone as Re } from "../composables/useTimerClone.js";
11
+ import { useToaster as Oe } from "../composables/useToaster.js";
12
+ import { useTranslations as Ue } from "../composables/useTranslations.js";
13
+ import { migrate as Ae } from "../config/migrator/index.js";
14
14
  import { ModuleFolderDefaults as G } from "../enums/defaults.js";
15
- import { RIBBON_SELECTOR as Ae } from "../enums/onboarding.js";
16
- import { ToasterTypeOptions as Ne } from "../enums/toaster.js";
17
- import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as _e } from "../extensions/Blocks/Recommendation/store/recommendation.js";
18
- import { disposeUnsubscribeListeners as Pe } from "../extensions/Blocks/Unsubscribe/block.js";
19
- import { disposeDisplayConditionRequest as xe } from "../extensions/DisplayConditions/bridge.js";
20
- import Be from "./organisms/AutoSaveController.vue.js";
21
- import He from "./organisms/base/AuthErrorModal.vue.js";
22
- import Ve from "./organisms/base/Toaster.vue.js";
23
- import We from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
24
- import $e from "./organisms/header/HeaderWrapper.vue.js";
25
- import Ge from "./organisms/LoadingWrapper.vue.js";
26
- import ze from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
27
- import qe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
28
- import Ke from "./organisms/validation/ValidationErrorDrawer.vue.js";
29
- import { useStripoApi as je } from "../services/stripoApi.js";
30
- import { useConfigStore as Je } from "../stores/config.js";
31
- import { useDynamicContentStore as Qe } from "../stores/dynamic-content.js";
15
+ import { RIBBON_SELECTOR as Ne } from "../enums/onboarding.js";
16
+ import { ToasterTypeOptions as _e } from "../enums/toaster.js";
17
+ import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as Pe } from "../extensions/Blocks/Recommendation/store/recommendation.js";
18
+ import { disposeUnsubscribeListeners as xe } from "../extensions/Blocks/Unsubscribe/block.js";
19
+ import { disposeDisplayConditionRequest as Be } from "../extensions/DisplayConditions/bridge.js";
20
+ import He from "./organisms/AutoSaveController.vue.js";
21
+ import Ve from "./organisms/base/AuthErrorModal.vue.js";
22
+ import We from "./organisms/base/Toaster.vue.js";
23
+ import $e from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
24
+ import Ge from "./organisms/header/HeaderWrapper.vue.js";
25
+ import ze from "./organisms/LoadingWrapper.vue.js";
26
+ import qe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
27
+ import Ke from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
28
+ import je from "./organisms/validation/ValidationErrorDrawer.vue.js";
29
+ import { useStripoApi as Je } from "../services/stripoApi.js";
30
+ import { useConfigStore as Qe } from "../stores/config.js";
31
+ import { useDynamicContentStore as Xe } from "../stores/dynamic-content.js";
32
32
  import { useEditorStore as C } from "../stores/editor.js";
33
33
  import { useModuleDynamicContentStore as q } from "../stores/module-dynamic-content.js";
34
- import { useOnboardingStore as Xe } from "../stores/onboarding.js";
35
- import { usePreviewStore as Ye } from "../stores/preview.js";
36
- import { useSaveValidationStore as Ze } from "../stores/save-validation.js";
37
- import { useTemplateStore as et } from "../stores/template.js";
38
- import { useUnsubscribeStore as tt } from "../stores/unsubscribe.js";
34
+ import { useOnboardingStore as Ye } from "../stores/onboarding.js";
35
+ import { usePreviewStore as Ze } from "../stores/preview.js";
36
+ import { useSaveValidationStore as et } from "../stores/save-validation.js";
37
+ import { useTemplateStore as tt } from "../stores/template.js";
38
+ import { useUnsubscribeStore as ot } from "../stores/unsubscribe.js";
39
39
  import { readTrackFloor as K } from "../utils/linkTrackingIds.js";
40
- const Vt = /* @__PURE__ */ Se({
40
+ const Wt = /* @__PURE__ */ he({
41
41
  __name: "Guido",
42
42
  props: {
43
43
  config: null,
@@ -45,7 +45,7 @@ const Vt = /* @__PURE__ */ Se({
45
45
  },
46
46
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
47
47
  setup(j, { expose: J, emit: i }) {
48
- const c = j, r = we(), Q = a(
48
+ const c = j, r = Te(), Q = a(
49
49
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
50
50
  ), X = a(
51
51
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
@@ -61,13 +61,13 @@ const Vt = /* @__PURE__ */ Se({
61
61
  () => import("./organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js")
62
62
  ), ne = a(
63
63
  () => import("./organisms/dynamic-content/AmbiguousDynamicContentModal.vue.js")
64
- ), y = W(), g = Qe(), w = tt(), re = q(), o = Je();
64
+ ), y = W(), g = Xe(), w = ot(), re = q(), o = Qe();
65
65
  c.ready && o.init(c.config);
66
- const d = C(), ie = Ye(), p = l(() => d.hasChanges), { isTestPartner: se } = Fe(), { isEnabled: ae, loadRollout: T } = Me(), { showToaster: k } = Re(), F = Oe(), M = () => {
66
+ const d = C(), ie = Ze(), p = u(() => d.hasChanges), { isTestPartner: se } = Me(), { isEnabled: ae, loadRollout: T } = Ie(), { showToaster: k } = Oe(), F = Ue(), M = () => {
67
67
  var t;
68
68
  if (d.isVersionHistoryOpen) {
69
69
  console.debug("guido:save:silent:blocked", { isVersionHistoryOpen: !0 }), k({
70
- type: Ne.Warning,
70
+ type: _e.Warning,
71
71
  message: F("email-editor.save-blocked-outside-editor")
72
72
  });
73
73
  return;
@@ -76,7 +76,7 @@ const Vt = /* @__PURE__ */ Se({
76
76
  }, I = (t) => {
77
77
  d.loadingStatus = t;
78
78
  };
79
- Ce(), ke();
79
+ De(), Fe();
80
80
  const b = () => {
81
81
  var t, e;
82
82
  return {
@@ -87,17 +87,17 @@ const Vt = /* @__PURE__ */ Se({
87
87
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
88
88
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
89
89
  };
90
- }, { initPlugin: L, preloadRuntime: R } = Ie(r), { runExclusive: O, beginMount: U, isCurrentMount: v } = De();
90
+ }, { initPlugin: L, preloadRuntime: R } = Le(r), { runExclusive: O, beginMount: U, isCurrentMount: v } = we();
91
91
  let f = 0;
92
- const { getDefaultTemplate: A } = je(), { cloneTimersOnSave: N, hasTimerBlocks: _ } = Le(), ce = l(() => {
92
+ const { getDefaultTemplate: A } = Je(), { cloneTimersOnSave: N, hasTimerBlocks: _ } = Re(), ce = u(() => {
93
93
  var t;
94
94
  return !((t = o.ui) != null && t.showHeader);
95
- }), de = l(() => o.isFeatureEnabled("reusableRecommendationStrategy")), me = l(() => o.externalDisplayConditions), le = l(
95
+ }), de = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), me = u(() => o.externalDisplayConditions), le = u(
96
96
  () => o.isFeatureEnabled("legacyUnsubscribeConversion")
97
- ), ue = l(
97
+ ), ue = u(
98
98
  () => !!z().recommendationConfigs.strategyId
99
99
  );
100
- Te({
100
+ ke({
101
101
  onBack: () => {
102
102
  console.debug("guido:back"), i("back");
103
103
  },
@@ -121,13 +121,13 @@ const Vt = /* @__PURE__ */ Se({
121
121
  i("on-change", p.value);
122
122
  });
123
123
  const S = (t) => {
124
- const e = t, { attribute: s, position: u } = e.detail;
125
- console.debug("dynamic-content:open", e.detail), i("dynamic-content:open", s, u);
124
+ const e = t, { attribute: s, position: l } = e.detail;
125
+ console.debug("dynamic-content:open", e.detail), i("dynamic-content:open", s, l);
126
126
  };
127
127
  let m = null;
128
128
  const h = () => {
129
129
  var e;
130
- const t = document.querySelector(Ae);
130
+ const t = document.querySelector(Ne);
131
131
  (e = y.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
132
132
  }, E = async () => {
133
133
  var t;
@@ -139,7 +139,7 @@ const Vt = /* @__PURE__ */ Se({
139
139
  templateId: o.templateId,
140
140
  variationId: o.variationId
141
141
  });
142
- const e = o.template, s = (e == null ? void 0 : e.html) || "", u = (e == null ? void 0 : e.css) || "", B = (e == null ? void 0 : e.preselectedDynamicContent) || [];
142
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", l = (e == null ? void 0 : e.css) || "", B = (e == null ? void 0 : e.preselectedDynamicContent) || [];
143
143
  w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
144
144
  const pe = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, H = o.isFeatureEnabled("linkTrackingIds"), fe = {
145
145
  partnerName: o.partnerName,
@@ -147,15 +147,15 @@ const Vt = /* @__PURE__ */ Se({
147
147
  rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
148
148
  }, ye = {
149
149
  itemsPriceFormatting: o.isFeatureEnabled("itemsPriceFormatting")
150
- }, V = (ve) => r.timed(
150
+ }, V = (ve, Se) => r.timed(
151
151
  "migration",
152
- () => Ue(ve, pe, fe, ye)
152
+ () => Ae(ve, pe, fe, ye, Se)
153
153
  );
154
154
  let n = {
155
- html: s && await V(s),
156
- css: u
155
+ html: s && await V(s, l),
156
+ css: l
157
157
  };
158
- n.html || (n = await r.timed("default_template", () => A()), n.html = await V(n.html));
158
+ n.html || (n = await r.timed("default_template", () => A()), n.html = await V(n.html, n.css));
159
159
  const ge = H ? K(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
160
160
  _(n.html) && (n.html = await r.timed("timer_clone", () => N(n.html))), H && (d.trackIdSessionFloor = Math.max(ge, K(n.html)));
161
161
  const be = {
@@ -169,21 +169,21 @@ const Vt = /* @__PURE__ */ Se({
169
169
  console.error("Failed to initialize Stripo editor:", e), r.markFailed();
170
170
  }
171
171
  };
172
- return he(async () => {
172
+ return Ee(async () => {
173
173
  var e;
174
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), C().$reset(), et().$reset(), Ze().$reset(), q().$reset(), Xe().resetOnboarding("recommendationLegacyStrategyOnboarding"), T(), h();
174
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), C().$reset(), tt().$reset(), et().$reset(), q().$reset(), Ye().resetOnboarding("recommendationLegacyStrategyOnboarding"), T(), h();
175
175
  const t = (e = y.value) == null ? void 0 : e.parentElement;
176
176
  if (t && (m = new ResizeObserver(h), m.observe(t)), R(), c.ready)
177
177
  await E();
178
178
  else {
179
- const s = $(() => c.ready, (u) => {
180
- u && (s(), E());
179
+ const s = $(() => c.ready, (l) => {
180
+ l && (s(), E());
181
181
  });
182
182
  }
183
183
  document.addEventListener("dynamic-content:open", S);
184
- }), Ee(() => {
185
- if (Pe(), _e(), r.dispose(), m == null || m.disconnect(), document.removeEventListener("dynamic-content:open", S), v(f)) {
186
- xe();
184
+ }), Ce(() => {
185
+ if (xe(), Pe(), r.dispose(), m == null || m.disconnect(), document.removeEventListener("dynamic-content:open", S), v(f)) {
186
+ Be();
187
187
  try {
188
188
  const t = C();
189
189
  t.isStripoInitialized = !1, t.isAccessibilityTestingOpen = !1, t.imagesHidden = !1, t.colorVisionDeficiency = "";
@@ -207,9 +207,9 @@ const Vt = /* @__PURE__ */ Se({
207
207
  hasChanges: p,
208
208
  saveSilent: M,
209
209
  setLoading: I
210
- }), { __sfc: !0, openMetrics: r, PreviewContainer: Q, OnboardingWrapper: X, AssignStrategyDrawer: Y, RemoveStrategyModal: Z, DisplayConditionsHost: ee, autoSaveControllerRef: D, LegacyStrategyUpdatedModal: te, LegacyUnsubscribeConvertedModal: oe, AmbiguousDynamicContentModal: ne, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: w, moduleDynamicContentStore: re, props: c, configStore: o, editorStore: d, previewStore: ie, hasChanges: p, isTestPartner: se, isSaveValidationEnabled: ae, loadRollout: T, showToaster: k, trans: F, saveSilent: M, setLoading: I, emit: i, buildMetadata: b, initPlugin: L, preloadRuntime: R, runExclusive: O, beginMount: U, isCurrentMount: v, mountGeneration: f, getDefaultTemplate: A, cloneTimersOnSave: N, hasTimerBlocks: _, noHeader: ce, isRrsEnabled: de, isExternalDisplayConditionsEnabled: me, isLegacyUnsubscribeConversionEnabled: le, hasAssignedStrategy: ue, insertDynamicContent: P, closeDynamicContent: x, handleDynamicContentOpen: S, ribbonObserver: m, updateRibbonOffset: h, startEditor: E, AutoSaveController: Be, AuthErrorModal: He, Toaster: Ve, FilterSelectionDrawer: We, HeaderWrapper: $e, LoadingWrapper: Ge, SaveAsTemplateDrawer: ze, UnsubscribeWrapper: qe, ValidationErrorDrawer: Ke };
210
+ }), { __sfc: !0, openMetrics: r, PreviewContainer: Q, OnboardingWrapper: X, AssignStrategyDrawer: Y, RemoveStrategyModal: Z, DisplayConditionsHost: ee, autoSaveControllerRef: D, LegacyStrategyUpdatedModal: te, LegacyUnsubscribeConvertedModal: oe, AmbiguousDynamicContentModal: ne, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: w, moduleDynamicContentStore: re, props: c, configStore: o, editorStore: d, previewStore: ie, hasChanges: p, isTestPartner: se, isSaveValidationEnabled: ae, loadRollout: T, showToaster: k, trans: F, saveSilent: M, setLoading: I, emit: i, buildMetadata: b, initPlugin: L, preloadRuntime: R, runExclusive: O, beginMount: U, isCurrentMount: v, mountGeneration: f, getDefaultTemplate: A, cloneTimersOnSave: N, hasTimerBlocks: _, noHeader: ce, isRrsEnabled: de, isExternalDisplayConditionsEnabled: me, isLegacyUnsubscribeConversionEnabled: le, hasAssignedStrategy: ue, insertDynamicContent: P, closeDynamicContent: x, handleDynamicContentOpen: S, ribbonObserver: m, updateRibbonOffset: h, startEditor: E, AutoSaveController: He, AuthErrorModal: Ve, Toaster: We, FilterSelectionDrawer: $e, HeaderWrapper: Ge, LoadingWrapper: ze, SaveAsTemplateDrawer: qe, UnsubscribeWrapper: Ke, ValidationErrorDrawer: je };
211
211
  }
212
212
  });
213
213
  export {
214
- Vt as default
214
+ Wt as default
215
215
  };
@@ -1,20 +1,20 @@
1
- import { migrateCheckbox as e } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as a } from "./couponBlockMigrator.js";
3
- import { migrateFullStoryScripts as c } from "./fullStoryScriptMigrator.js";
4
- import { migrateItemsBlock as g } from "./itemsBlockMigrator.js";
5
- import { migrateItemsPriceFormat as n } from "./itemsPriceFormatMigrator.js";
6
- import { migrateLegacyUnsubscribeText as p } from "./legacyUnsubscribeTextMigrator.js";
7
- import { migrateProductNameLink as f } from "./productNameLinkMigrator.js";
8
- import { migrateRadioButton as l } from "./radioButtonMigrator.js";
9
- import { migrateRecommendation as s } from "./recommendationMigrator.js";
10
- import { migrateRecommendationPartnerScope as d } from "./recommendationPartnerMigrator.js";
11
- import { migrateRecommendationTitle as b } from "./recommendationTitleMigrator.js";
12
- import { migrateSocialIcons as k } from "./socialIconMigrator.js";
13
- import { migrateUnsubscribe as P } from "./unsubscribeMigrator.js";
14
- const w = async (t, i = {}, o, r) => {
1
+ import { migrateCheckbox as a } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as c } from "./couponBlockMigrator.js";
3
+ import { migrateFullStoryScripts as g } from "./fullStoryScriptMigrator.js";
4
+ import { migrateItemsBlock as n } from "./itemsBlockMigrator.js";
5
+ import { migrateItemsPriceFormat as p } from "./itemsPriceFormatMigrator.js";
6
+ import { migrateLegacyUnsubscribeText as f } from "./legacyUnsubscribeTextMigrator.js";
7
+ import { migrateProductNameLink as l } from "./productNameLinkMigrator.js";
8
+ import { migrateRadioButton as s } from "./radioButtonMigrator.js";
9
+ import { migrateRecommendation as d } from "./recommendationMigrator.js";
10
+ import { migrateRecommendationPartnerScope as b } from "./recommendationPartnerMigrator.js";
11
+ import { migrateRecommendationTitle as k } from "./recommendationTitleMigrator.js";
12
+ import { migrateSocialIcons as P } from "./socialIconMigrator.js";
13
+ import { migrateUnsubscribe as R } from "./unsubscribeMigrator.js";
14
+ const H = async (t, i = {}, o, r, e = "") => {
15
15
  let m = t;
16
- return m = e(m), m = l(m), m = p(m), m = await P(m), m = a(m), m = s(m, i), o && (m = d(m, o)), m = b(m), m = g(m), r != null && r.itemsPriceFormatting && (m = n(m)), m = f(m), m = k(m), m = c(m), m;
16
+ return m = a(m), m = s(m), m = f(m), m = await R(m), m = c(m), m = d(m, i, e), o && (m = b(m, o)), m = k(m), m = n(m), r != null && r.itemsPriceFormatting && (m = p(m)), m = l(m), m = P(m), m = g(m), m;
17
17
  };
18
18
  export {
19
- w as migrate
19
+ H as migrate
20
20
  };
@@ -0,0 +1,84 @@
1
+ const f = /\s*!important\s*$/i, g = /\/\*[\s\S]*?\*\//g, a = /#[\w-]+/g, p = /\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+(?:\([^)]*\))?/g, d = /::[\w-]+/g, E = /(?:^|[\s>+~])([a-z][\w-]*)/gi;
2
+ function h(o) {
3
+ return o.split(";").flatMap((r) => {
4
+ const s = r.indexOf(":");
5
+ if (s < 0)
6
+ return [];
7
+ const e = r.slice(0, s).trim().toLowerCase(), t = r.slice(s + 1), n = t.replace(f, "").trim();
8
+ return e && n ? [{ prop: e, value: n, important: f.test(t) }] : [];
9
+ });
10
+ }
11
+ function w(o, r) {
12
+ let s = 0;
13
+ for (let e = r; e < o.length; e += 1)
14
+ if (o[e] === "{")
15
+ s += 1;
16
+ else if (o[e] === "}" && (s -= 1, s === 0))
17
+ return e;
18
+ return o.length;
19
+ }
20
+ function m(o) {
21
+ let r = 0;
22
+ return Array.from(o).reduce((e, t) => (t === "(" || t === "[" ? r += 1 : (t === ")" || t === "]") && r > 0 && (r -= 1), t === "," && r === 0 ? e.push("") : e[e.length - 1] += t, e), [""]).map((e) => e.trim()).filter(Boolean);
23
+ }
24
+ function v(o) {
25
+ const r = o.replace(g, ""), s = [];
26
+ let e = 0;
27
+ for (; e < r.length; ) {
28
+ const t = r.indexOf("{", e);
29
+ if (t < 0)
30
+ break;
31
+ const n = r.slice(e, t), i = n.slice(n.lastIndexOf(";") + 1).trim(), c = w(r, t);
32
+ if (i && !i.startsWith("@")) {
33
+ const l = m(i), u = h(r.slice(t + 1, c));
34
+ l.length > 0 && u.length > 0 && s.push({ selectors: l, declarations: u });
35
+ }
36
+ e = c + 1;
37
+ }
38
+ return s;
39
+ }
40
+ function S(o) {
41
+ var i, c;
42
+ const r = o.replace(d, " "), s = ((i = r.match(a)) == null ? void 0 : i.length) ?? 0, e = r.replace(a, " "), t = ((c = e.match(p)) == null ? void 0 : c.length) ?? 0, n = Array.from(e.replace(p, " ").matchAll(E)).length;
43
+ return s * 1e6 + t * 1e3 + n;
44
+ }
45
+ function O(o, r) {
46
+ return r.reduce((s, e) => {
47
+ let t = !1;
48
+ try {
49
+ t = o.matches(e);
50
+ } catch {
51
+ t = !1;
52
+ }
53
+ if (!t)
54
+ return s;
55
+ const n = S(e);
56
+ return s === void 0 || n > s ? n : s;
57
+ }, void 0);
58
+ }
59
+ function y(o, r) {
60
+ const s = /* @__PURE__ */ new Map();
61
+ if (!o)
62
+ return s;
63
+ const e = [];
64
+ return r.forEach((t, n) => {
65
+ const i = O(o, t.selectors);
66
+ i !== void 0 && t.declarations.forEach((c, l) => {
67
+ e.push({
68
+ ...c,
69
+ tier: c.important ? 2 : 0,
70
+ weight: i,
71
+ order: n * 1e3 + l
72
+ });
73
+ });
74
+ }), h(o.getAttribute("style") ?? "").forEach((t, n) => {
75
+ e.push({ ...t, tier: t.important ? 3 : 1, weight: 0, order: n });
76
+ }), e.sort((t, n) => t.tier - n.tier || t.weight - n.weight || t.order - n.order).forEach((t, n) => {
77
+ s.set(t.prop, { value: t.value, position: n });
78
+ }), s;
79
+ }
80
+ export {
81
+ v as parseCssRules,
82
+ h as parseDeclarations,
83
+ y as resolveDeclaredStyle
84
+ };
@@ -1,114 +1,220 @@
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 h, CSS_CLASS_SKIP_COMPILE as A } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ import { resolveDeclaredStyle as S } from "./cssCascade.js";
3
+ const C = "You May Also Like!";
4
+ function $(t) {
5
+ var r;
6
+ const o = t.querySelector(".ext-recommendation-title");
7
+ if (!o)
8
+ return C;
9
+ const e = (r = o.textContent) == null ? void 0 : r.trim();
10
+ return e && e.length > 0 ? e : C;
11
+ }
12
+ function j(t) {
13
+ const o = t.querySelector(".ext-recommendation-title");
14
+ return o ? !/display\s*:\s*none/i.test(o.getAttribute("style") ?? "") : !1;
15
+ }
16
+ function H(t) {
17
+ var e;
18
+ const o = t.querySelector(".ext-recommendation-title");
19
+ return !!o && !((e = o == null ? void 0 : o.textContent) != null && e.trim());
20
+ }
21
+ function W(t) {
22
+ const o = t.querySelector(".ext-product-price"), e = t.querySelector(".ext-product-original-price");
23
+ return !o || !e ? !1 : o.compareDocumentPosition(e) === Node.DOCUMENT_POSITION_PRECEDING;
24
+ }
25
+ function x(t) {
26
+ return /(?:^|;)\s*display\s*:\s*table-cell/i.test(t.getAttribute("style") ?? "");
27
+ }
28
+ function X(t) {
29
+ var r, n;
30
+ const o = (r = t.querySelector(".ext-product-price")) == null ? void 0 : r.closest("tr"), e = (n = t.querySelector(".ext-product-original-price")) == null ? void 0 : n.closest("tr");
31
+ return !o || !e || o === e ? !1 : !x(o) && !x(e);
32
+ }
33
+ const L = /* @__PURE__ */ new Map([
33
34
  ["p_name", ".ext-product-name p"],
34
35
  ["p_price", ".ext-product-price p"],
35
36
  ["p_original_price", ".ext-product-original-price p"]
36
37
  ]);
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;
40
- }
41
- const x = "ins-trim-text";
42
- function h(e, r) {
43
- return e == null ? void 0 : e.map((t) => {
44
- 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,
38
+ function R(t) {
39
+ const o = ((t == null ? void 0 : t.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
40
+ return (o == null ? void 0 : o[1].trim()) || void 0;
41
+ }
42
+ const O = "ins-trim-text";
43
+ function z(t, o) {
44
+ return t == null ? void 0 : t.map((e) => {
45
+ var s, d;
46
+ const r = L.get(e.variable ?? "");
47
+ if (!r)
48
+ return e;
49
+ const n = o.querySelector(r), i = (d = (s = e.theme) == null ? void 0 : s.textColor) != null && d.color ? void 0 : R(n), c = e.variable === "p_name" && (n == null ? void 0 : n.classList.contains(O));
50
+ return !i && !c ? e : {
51
+ ...e,
51
52
  theme: {
52
- ...t.theme,
53
- ...c ? { textColor: { color: c } } : {},
54
- ...i ? { textTrimming: !0 } : {}
53
+ ...e.theme,
54
+ ...i ? { textColor: { color: i } } : {},
55
+ ...c ? { textTrimming: !0 } : {}
55
56
  }
56
57
  };
57
58
  });
58
59
  }
59
- function R(e) {
60
- const r = [
61
- e,
62
- ...Array.from(e.querySelectorAll(".product-card, .ext-recommendation-card"))
60
+ const w = /^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([\d.,\s%]+\)|[a-z]+)$/i, B = new Set(
61
+ ["none", "transparent", "inherit", "initial", "unset", "revert", "currentColor"].map((t) => t.toLowerCase())
62
+ ), P = /^(\d+(?:\.\d+)?)(?:px)?$/i, I = /* @__PURE__ */ new Set([
63
+ "none",
64
+ "hidden",
65
+ "dotted",
66
+ "dashed",
67
+ "solid",
68
+ "double",
69
+ "groove",
70
+ "ridge",
71
+ "inset",
72
+ "outset"
73
+ ]), N = /\s/, D = ["padding-top", "padding-right", "padding-bottom", "padding-left"];
74
+ function p(t, o) {
75
+ var e;
76
+ return (e = t.get(o)) == null ? void 0 : e.value;
77
+ }
78
+ function m(t) {
79
+ return t && w.test(t) && !B.has(t.toLowerCase()) ? t : void 0;
80
+ }
81
+ function T(t) {
82
+ return (t == null ? void 0 : t.toLowerCase()) === "transparent" ? "transparent" : m(t);
83
+ }
84
+ function f(t) {
85
+ const o = t == null ? void 0 : t.match(P);
86
+ return (o == null ? void 0 : o[1]) !== void 0 ? Number(o[1]) : void 0;
87
+ }
88
+ function y(t) {
89
+ const o = t == null ? void 0 : t.toLowerCase();
90
+ return o && I.has(o) ? o : void 0;
91
+ }
92
+ function _(t) {
93
+ let o = 0;
94
+ return Array.from(t).reduce((r, n) => (n === "(" ? o += 1 : n === ")" && o > 0 && (o -= 1), o === 0 && N.test(n) ? r.push("") : r[r.length - 1] += n, r), [""]).filter(Boolean);
95
+ }
96
+ function E(t, o) {
97
+ const e = _(t ?? "").map(o);
98
+ if (e.length === 0 || e.length > 4 || e.some((s) => s === void 0))
99
+ return;
100
+ const [r, n = r, i = r, c = n] = e;
101
+ return { top: r, right: n, bottom: i, left: c };
102
+ }
103
+ function k(t) {
104
+ const o = t.get("padding"), e = o ? E(o.value, f) : void 0, r = ["top", "right", "bottom", "left"], [n, i, c, s] = D.map((d, l) => {
105
+ const u = t.get(d);
106
+ return u && u.position > ((o == null ? void 0 : o.position) ?? -1) ? f(u.value) : e == null ? void 0 : e[r[l]];
107
+ });
108
+ if (!(n === void 0 || i === void 0 || c === void 0 || s === void 0))
109
+ return { top: n, right: i, bottom: c, left: s };
110
+ }
111
+ function q(t) {
112
+ return t === void 0 ? void 0 : { top: t, right: t, bottom: t, left: t };
113
+ }
114
+ function Y(t) {
115
+ return _(t ?? "").reduce((e, r) => {
116
+ const n = f(r), i = y(r), c = T(r);
117
+ if (e) {
118
+ if (n !== void 0 && e.width === void 0)
119
+ return { ...e, width: n };
120
+ if (i && !e.style)
121
+ return { ...e, style: i };
122
+ if (c && !e.color)
123
+ return { ...e, color: c };
124
+ }
125
+ }, {}) ?? {};
126
+ }
127
+ function g(t, o, e, r) {
128
+ var s, d;
129
+ const n = E(p(t, o), e), i = q(r);
130
+ return (((s = t.get(o)) == null ? void 0 : s.position) ?? -1) > (((d = t.get("border")) == null ? void 0 : d.position) ?? -1) ? n ?? i : i ?? n;
131
+ }
132
+ function M(t) {
133
+ const o = Y(p(t, "border")), e = g(t, "border-width", f, o.width);
134
+ if (!e)
135
+ return;
136
+ const r = g(t, "border-style", y, o.style), n = g(t, "border-color", T, o.color);
137
+ return {
138
+ width: e,
139
+ ...r ? { style: r } : {},
140
+ ...n ? { color: n } : {}
141
+ };
142
+ }
143
+ function b(t) {
144
+ const [o] = ["background", "background-color"].filter((e) => t.has(e)).sort((e, r) => {
145
+ var n, i;
146
+ return (((n = t.get(r)) == null ? void 0 : n.position) ?? -1) - (((i = t.get(e)) == null ? void 0 : i.position) ?? -1);
147
+ });
148
+ return o ? m(p(t, o)) : void 0;
149
+ }
150
+ function G(t, o = {}, e = []) {
151
+ var u, a;
152
+ const r = S(t.querySelector(".ext-product-button a.es-button"), e), n = S(t.querySelector(".ext-product-button .es-button-border"), e), i = {}, c = (u = o.buttonColor) != null && u.color ? void 0 : b(n) ?? b(r), s = (a = o.textButtonColor) != null && a.color ? void 0 : m(p(r, "color")), d = o.buttonBorder === void 0 ? M(n) : void 0, l = k(r);
153
+ return c && (i.buttonColor = { color: c }), s && (i.textButtonColor = { color: s }), d && (i.buttonBorder = d), l && (i.buttonInternalPadding = { desktop: l }), i;
154
+ }
155
+ function v(t, o, e = []) {
156
+ return t == null ? void 0 : t.map((r) => {
157
+ if (r.variable !== "p_button")
158
+ return r;
159
+ const n = G(o, r.theme ?? {}, e);
160
+ return Object.keys(n).length === 0 ? r : { ...r, theme: { ...r.theme, ...n } };
161
+ });
162
+ }
163
+ function J(t) {
164
+ const o = [
165
+ t,
166
+ ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
63
167
  ];
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);
168
+ let e = "";
169
+ return o.some((r) => {
170
+ const n = r.getAttribute("bgcolor");
171
+ if (n && n.trim())
172
+ return e = n.trim(), !0;
173
+ const c = (r.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
174
+ return c && c[1] ? (e = c[1].trim(), !0) : !1;
175
+ }), e;
176
+ }
177
+ function Q(t) {
178
+ const o = t.getAttribute(h.CURRENCY), e = t.getAttribute(h.SYMBOL);
75
179
  return {
76
- ...r ? { value: r } : {},
180
+ ...o ? { value: o } : {},
77
181
  // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
78
182
  // the currency code as the symbol.
79
- ...t ? { symbol: t } : {},
183
+ ...e ? { symbol: e } : {},
80
184
  alignment: 1,
81
185
  decimalCount: "2",
82
186
  decimalSeparator: ",",
83
187
  thousandSeparator: "."
84
188
  };
85
189
  }
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)
190
+ const F = /^es-p(\d+)([trbl]?)$/, K = { t: "top", r: "right", b: "bottom", l: "left" };
191
+ function Z(t) {
192
+ const o = t.querySelector("td.esd-structure.esd-extension-internal-block");
193
+ if (!o)
90
194
  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)
195
+ const e = { top: 0, right: 0, bottom: 0, left: 0 };
196
+ return o.classList.forEach((r) => {
197
+ const n = r.match(F);
198
+ if (!n)
95
199
  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;
200
+ const i = Number(n[1]), c = n[2];
201
+ c ? e[K[c]] = i : Object.assign(e, { top: i, right: i, bottom: i, left: i });
202
+ }), e;
99
203
  }
100
- function I(e) {
101
- return e.classList.contains(m);
204
+ function tt(t) {
205
+ return t.classList.contains(A);
102
206
  }
103
207
  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
208
+ J as extractCardBgColor,
209
+ Q as extractCurrencyFromBlock,
210
+ Z as extractRenderedBlockPadding,
211
+ G as extractRenderedButtonTheme,
212
+ $ as extractTitleText,
213
+ H as hasEmptyTitle,
214
+ j as hasVisibleTitle,
215
+ W as isOldPriceFirst,
216
+ tt as isPartnerManagedBlock,
217
+ X as isPriceOnNextLine,
218
+ v as withRenderedButtonTheme,
219
+ z as withRenderedTextTheme
114
220
  };
@@ -16,21 +16,21 @@ function P(n) {
16
16
  const t = n.top ?? n.all ?? 0, o = n.right ?? n.all ?? 0, i = n.bottom ?? n.all ?? 0, l = n.left ?? n.all ?? 0;
17
17
  return t === 0 && o === 0 && i === 0 && l === 0 ? null : `${t}px ${o}px ${i}px ${l}px`;
18
18
  }
19
- function z(n) {
19
+ function C(n) {
20
20
  if (!n)
21
21
  return null;
22
22
  const { top: t, right: o, bottom: i, left: l } = n;
23
23
  return t === void 0 ? null : t === o && t === i && t === l ? t : null;
24
24
  }
25
25
  function $(n, t, o, i) {
26
- const l = z(o);
26
+ const l = C(o);
27
27
  if (l !== null) {
28
28
  r(n, `border-${t}`, i(l));
29
29
  return;
30
30
  }
31
31
  o && (r(n, `border-top-${t}`, o.top !== void 0 ? i(o.top) : null), r(n, `border-right-${t}`, o.right !== void 0 ? i(o.right) : null), r(n, `border-bottom-${t}`, o.bottom !== void 0 ? i(o.bottom) : null), r(n, `border-left-${t}`, o.left !== void 0 ? i(o.left) : null));
32
32
  }
33
- function D(n) {
33
+ function I(n) {
34
34
  if (!n)
35
35
  return null;
36
36
  const t = x(n.radius ?? n.borderRadius);
@@ -42,14 +42,14 @@ function D(n) {
42
42
  }
43
43
  return null;
44
44
  }
45
- function I(n) {
45
+ function v(n) {
46
46
  var t, o;
47
47
  return ((t = n.textLineSpacing) == null ? void 0 : t.lineSpacing) ?? ((o = n.textLineSpacing) == null ? void 0 : o["font-lineSpacing"]);
48
48
  }
49
49
  function N(n) {
50
- var u, s, a, d, g, b, p, y;
50
+ var u, s, a, d, g, p, b, y;
51
51
  const t = [], o = [], i = (u = n == null ? void 0 : n.textAlign) == null ? void 0 : u.align, l = P((s = n == null ? void 0 : n.textPadding) == null ? void 0 : s.desktop), f = (a = n == null ? void 0 : n.textStyle) == null ? void 0 : a["font-weight"], c = (d = n == null ? void 0 : n.textStyle) == null ? void 0 : d["font-style"];
52
- return r(t, "background-color", (g = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : g.color), r(t, "padding", l), r(o, "font-family", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-family"]), r(o, "font-size", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-size"]), r(o, "font-weight", f), r(o, "font-style", c), r(o, "color", (y = n == null ? void 0 : n.textColor) == null ? void 0 : y.color), r(o, "line-height", I(n ?? {})), r(o, "text-align", i), {
52
+ return r(t, "background-color", (g = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : g.color), r(t, "padding", l), r(o, "font-family", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-family"]), r(o, "font-size", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-size"]), r(o, "font-weight", f), r(o, "font-style", c), r(o, "color", (y = n == null ? void 0 : n.textColor) == null ? void 0 : y.color), r(o, "line-height", v(n ?? {})), r(o, "text-align", i), {
53
53
  tdStyle: t.join("; "),
54
54
  pStyle: o.join("; "),
55
55
  align: i || void 0,
@@ -59,47 +59,59 @@ function N(n) {
59
59
  };
60
60
  }
61
61
  function E(n) {
62
- var s, a, d, g, b, p, y, k, w, B, T, j;
62
+ var s, a, d, g, p, b, y, k, w, B, j, T;
63
63
  const t = [], o = [], i = [];
64
- r(t, "padding", P((s = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : s.desktop)), r(i, "padding", P((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-family"]), r(i, "font-size", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-size"]), r(i, "font-weight", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-weight"]), r(i, "font-style", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-style"]);
64
+ r(t, "padding", P((s = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : s.desktop)), r(i, "padding", P((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-family"]), r(i, "font-size", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-size"]), r(i, "font-weight", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-weight"]), r(i, "font-style", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-style"]);
65
65
  const l = (y = n == null ? void 0 : n.buttonColor) == null ? void 0 : y.color, f = (k = n == null ? void 0 : n.textButtonColor) == null ? void 0 : k.color;
66
- r(o, "background", l), r(i, "background", l), r(i, "color", f);
66
+ r(o, "background", l), r(i, "background", l), r(i, "color", f), r(i, "mso-border-alt", l ? `10px solid ${l}` : void 0);
67
67
  const c = n == null ? void 0 : n.buttonBorder;
68
68
  $(o, "width", c == null ? void 0 : c.width, (S) => `${S}px`), $(o, "style", c == null ? void 0 : c.style, (S) => S), $(o, "color", c == null ? void 0 : c.color, (S) => S);
69
- const u = D((n == null ? void 0 : n.buttonBorderRadius) ?? (n == null ? void 0 : n.borderRadius));
69
+ const u = I((n == null ? void 0 : n.buttonBorderRadius) ?? (n == null ? void 0 : n.borderRadius));
70
70
  return u && (r(o, "border-radius", u), r(i, "border-radius", u)), ((w = n == null ? void 0 : n.buttonStretch) == null ? void 0 : w.stretched) === !1 ? (r(o, "display", "inline-block"), r(i, "display", "inline-block")) : ((B = n == null ? void 0 : n.buttonStretch) == null ? void 0 : B.stretched) === !0 && (r(o, "display", "block"), r(i, "display", "block")), {
71
71
  tdStyle: t.join("; "),
72
- align: ((T = n == null ? void 0 : n.buttonAlign) == null ? void 0 : T.align) || void 0,
72
+ align: ((j = n == null ? void 0 : n.buttonAlign) == null ? void 0 : j.align) || void 0,
73
73
  spanStyle: o.join("; "),
74
74
  aStyle: i.join("; "),
75
- text: (j = n == null ? void 0 : n.buttonText) == null ? void 0 : j.text
75
+ text: (T = n == null ? void 0 : n.buttonText) == null ? void 0 : T.text
76
76
  };
77
77
  }
78
- function L(n) {
78
+ function R(n) {
79
79
  var t, o;
80
80
  return {
81
81
  width: x((t = n == null ? void 0 : n.imageSize) == null ? void 0 : t.width),
82
82
  height: x((o = n == null ? void 0 : n.imageSize) == null ? void 0 : o.height)
83
83
  };
84
84
  }
85
- const A = /* @__PURE__ */ new Set([5, 10, 15, 20, 25, 30, 35, 40]), C = [["t", "top"], ["r", "right"], ["b", "bottom"], ["l", "left"]];
86
- function R(n) {
85
+ const A = /* @__PURE__ */ new Set([5, 10, 15, 20, 25, 30, 35, 40]), L = [["t", "top"], ["r", "right"], ["b", "bottom"], ["l", "left"]];
86
+ function _(n) {
87
87
  if (!n)
88
88
  return;
89
89
  const t = [], o = [];
90
- return C.forEach(([i, l]) => {
90
+ return L.forEach(([i, l]) => {
91
91
  const f = x(n[l] ?? n.all) ?? 0;
92
92
  A.has(f) ? t.push(`es-p${f}${i}`) : f > 0 && o.push(`padding-${l}: ${f}px`);
93
93
  }), { classes: t.join(" "), style: o.join("; ") };
94
94
  }
95
- function v(n, t) {
95
+ function z(n) {
96
+ return n.split(";").map((t) => t.trim()).filter(Boolean);
97
+ }
98
+ function D(n) {
99
+ const t = n.indexOf(":");
100
+ return (t === -1 ? n : n.slice(0, t)).trim().toLowerCase();
101
+ }
102
+ function F(n, t) {
96
103
  const o = (n ?? "").trim().replace(/;$/, "").trim(), i = (t ?? "").trim().replace(/;$/, "").trim();
97
- return o ? i ? `${o}; ${i}` : o : i;
104
+ if (!o)
105
+ return i;
106
+ if (!i)
107
+ return o;
108
+ const l = new Set(z(i).map(D)), f = z(o), c = f.filter((u) => !l.has(D(u)));
109
+ return c.length === f.length ? `${o}; ${i}` : c.length ? `${c.join("; ")}; ${i}` : i;
98
110
  }
99
111
  export {
100
- v as appendStyle,
101
- R as mapBlockPadding,
112
+ F as appendStyle,
113
+ _ as mapBlockPadding,
102
114
  E as mapButtonTheme,
103
- L as mapImageTheme,
115
+ R as mapImageTheme,
104
116
  N as mapTextTheme
105
117
  };
@@ -1,59 +1,65 @@
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";
2
+ import { DEFAULT_NODE_CONFIG as x } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_PRODUCT_BUTTON as T, ATTR_RECOMMENDATION_TITLE as y } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
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)
5
+ import { mapComposition as B } from "./recommendation/compositionMapper.js";
6
+ import { parseCssRules as S } from "./recommendation/cssCascade.js";
7
+ import { isPriceOnNextLine as E, extractCurrencyFromBlock as w, isOldPriceFirst as L, withRenderedButtonTheme as O, withRenderedTextTheme as P, extractRenderedButtonTheme as A, extractTitleText as H, hasEmptyTitle as N, hasVisibleTitle as F, extractCardBgColor as I, isPartnerManagedBlock as _, extractRenderedBlockPadding as D } from "./recommendation/extractors.js";
8
+ import { buildBlockHtml as $ } from "./recommendation/htmlBuilder.js";
9
+ import { parseRecommendationId as k, parseLegacyConfig as U } from "./recommendation/parseLegacyConfig.js";
10
+ import { mapSettings as V } from "./recommendation/settingsMapper.js";
11
+ import { mapButtonTheme as q, mapBlockPadding as G } from "./recommendation/themeMapper.js";
12
+ const j = '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)';
13
+ function K(a, e, m, c) {
14
+ var p, g, u;
15
+ const r = k(e);
16
+ if (r === null)
16
17
  return console.warn(
17
18
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
18
19
  ), !1;
19
- const r = F(e);
20
- if (!r)
20
+ const o = U(e);
21
+ if (!o)
21
22
  return console.warn(
22
- `[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
23
+ `[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
23
24
  ), !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),
30
- { 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,
25
+ const i = m[String(r)] ?? {}, s = {
26
+ ...i,
27
+ currencySettings: i.currencySettings ?? w(e),
28
+ isPriceMovedToNextLine: i.isPriceMovedToNextLine ?? E(e)
29
+ }, n = V(s, o, r), t = B(
30
+ O(P((p = o.composition) == null ? void 0 : p.variables, e), e, c),
31
+ { oldPriceFirst: L(e) }
32
+ );
33
+ if (t.perElementStyles[T] === void 0) {
34
+ const f = A(e, {}, c);
35
+ Object.keys(f).length > 0 && (t.perElementStyles[T] = q(f));
36
+ }
37
+ const v = H(e);
38
+ N(e) ? t.visibility[y] = !1 : t.titleVariable || (t.visibility[y] = F(e));
39
+ const R = I(e), h = {
40
+ ...n,
35
41
  strategyId: "",
36
- composition: i.composition,
37
- visibility: i.visibility,
38
- previousTitleHtml: C.previousTitleHtml,
39
- textTrimming: i.anyTextTrimming
40
- }, s = A(e), v = `
42
+ composition: t.composition,
43
+ visibility: t.visibility,
44
+ previousTitleHtml: x.previousTitleHtml,
45
+ textTrimming: t.anyTextTrimming
46
+ }, d = _(e), C = `
41
47
  <table>
42
48
  <tbody>
43
49
  <tr>
44
50
  <td class="esd-structure" align="left">
45
51
  <table width="100%" cellpadding="0" cellspacing="0">
46
52
  <tbody>
47
- <tr>${N({
48
- nodeConfig: T,
49
- composition: i,
50
- cardBg: y,
51
- titleText: u,
53
+ <tr>${$({
54
+ nodeConfig: h,
55
+ composition: t,
56
+ cardBg: R,
57
+ titleText: v,
52
58
  legacyId: e.getAttribute("id") ?? void 0,
53
59
  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))
60
+ preserveInnerHtml: d ? e.innerHTML : void 0,
61
+ skipCompile: d,
62
+ blockPadding: G(((u = (g = o.theme) == null ? void 0 : g.blockPadding) == null ? void 0 : u.desktop) ?? D(e))
57
63
  })}</tr>
58
64
  </tbody>
59
65
  </table>
@@ -61,40 +67,41 @@ function $(c, e, m) {
61
67
  </tr>
62
68
  </tbody>
63
69
  </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);
70
+ `, l = a.parseFromString(C, "text/html").querySelector("td.esd-structure");
71
+ return !l || !e.parentNode ? (console.warn(
72
+ `[RecommendationMigrator] Aborting block id=${r} — failed to construct new HTML element`
73
+ ), !1) : (e.parentNode.replaceChild(l, e), !0);
68
74
  }
69
- function X(c, e = {}) {
70
- const m = new DOMParser();
71
- let t;
75
+ function ae(a, e = {}, m = "") {
76
+ const c = new DOMParser();
77
+ let r;
72
78
  try {
73
- t = m.parseFromString(c, "text/html");
79
+ r = c.parseFromString(a, "text/html");
74
80
  } catch (n) {
75
- return console.error("[RecommendationMigrator] Failed to parse template:", n), c;
81
+ return console.error("[RecommendationMigrator] Failed to parse template:", n), a;
76
82
  }
77
- const r = Array.from(t.querySelectorAll(k));
83
+ const o = Array.from(r.querySelectorAll(j));
78
84
  try {
79
- M().$patch((a) => {
80
- a.migrations = {
81
- ...a.migrations,
82
- [b.Recommendation]: r.length
85
+ M().$patch((t) => {
86
+ t.migrations = {
87
+ ...t.migrations,
88
+ [b.Recommendation]: o.length
83
89
  };
84
90
  });
85
91
  } catch {
86
92
  }
87
- if (r.length === 0)
88
- return c;
89
- let o = 0;
90
- return r.forEach((n) => {
93
+ if (o.length === 0)
94
+ return a;
95
+ let i = 0;
96
+ const s = S(m);
97
+ return o.forEach((n) => {
91
98
  try {
92
- $(m, n, e) && (o += 1);
93
- } catch (a) {
94
- console.error("[RecommendationMigrator] Unexpected error migrating block:", a);
99
+ K(c, n, e, s) && (i += 1);
100
+ } catch (t) {
101
+ console.error("[RecommendationMigrator] Unexpected error migrating block:", t);
95
102
  }
96
- }), o > 0 && console.info(`[RecommendationMigrator] Migrated ${o} legacy Recommendation block(s)`), t.documentElement.outerHTML;
103
+ }), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), r.documentElement.outerHTML;
97
104
  }
98
105
  export {
99
- X as migrateRecommendation
106
+ ae as migrateRecommendation
100
107
  };
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-c8351f74]{gap:16px}.validation-error-row[data-v-c8351f74]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-c8351f74]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-c8351f74]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-0c5f11a1]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-0c5f11a1]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-0c5f11a1]{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-f5ff6219]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-f5ff6219]{min-height:504px}.iframe-wrapper[data-v-a7102458]{width:258px}.iframe-scaled[data-v-a7102458]{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-fcba7e99] .vueperslides__bullets{pointer-events:none!important}[data-v-fcba7e99] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-1a34025a] .vueperslides__bullets{pointer-events:none!important}[data-v-1a34025a] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-8fc96a58] .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 .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}.guido-display-condition-create__separator[data-v-929822bc]{height:1px;margin:0 0 24px;background-image:linear-gradient(to right,currentColor 1px,transparent 1px);background-size:5px 1px}.guido-display-condition-create__methods[data-v-929822bc]{gap:16px}.guido-display-condition-select-root[data-v-0d740001] .in-drawer__footer{justify-content:flex-start}.guido-display-condition-select__delete-modal[data-v-0d740001]{position:relative;z-index:145}.guido-display-condition-select__delete-modal[data-v-0d740001] .in-modal-v2-wrapper__header-title{margin-bottom:0}.guido-display-condition-select-root[data-v-0d740001] .in-drawer__content>div{display:flex;flex-direction:column;min-height:100%}.guido-display-condition-select__list[data-v-0d740001]{display:flex;flex-direction:column;gap:24px;margin:0;padding:0;list-style:none}.guido-display-condition-card__header[data-v-0d740001]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px}.guido-display-condition-card__text[data-v-0d740001]{min-width:0}.guido-display-condition-card__name[data-v-0d740001],.guido-display-condition-card__description[data-v-0d740001]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__actions[data-v-0d740001]{display:flex;flex-shrink:0;align-items:center;gap:16px}.guido-display-condition-card__split[data-v-0d740001]{position:relative;display:flex;gap:1px}.guido-display-condition-card__menu[data-v-0d740001]{z-index:2;min-width:115px}.guido-display-condition-card__divider[data-v-0d740001]{width:1px;height:24px}.guido-display-condition-card__code[data-v-0d740001]{margin:1px 15px 15px;padding:8px;font-family:inherit;white-space:pre-wrap;word-break:break-word}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}.ambiguous-dynamic-content-modal__content[data-v-2643213c]{padding-bottom:150px}
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-c8351f74]{gap:16px}.validation-error-row[data-v-c8351f74]{gap:8px;padding:24px;border:1px solid #E1E1E1;border-radius:8px}.validation-error-row__icon[data-v-c8351f74]{flex-shrink:0;font-size:24px;line-height:0}.validation-error-row__text[data-v-c8351f74]{font-size:13px;line-height:16px;color:#292929;word-break:break-word}.guido-editor__wrapper[data-v-4eea8564]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-4eea8564]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-4eea8564]{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-f5ff6219]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-f5ff6219]{min-height:504px}.iframe-wrapper[data-v-a7102458]{width:258px}.iframe-scaled[data-v-a7102458]{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-fcba7e99] .vueperslides__bullets{pointer-events:none!important}[data-v-fcba7e99] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-1a34025a] .vueperslides__bullets{pointer-events:none!important}[data-v-1a34025a] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-8fc96a58] .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 .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}.guido-display-condition-create__separator[data-v-929822bc]{height:1px;margin:0 0 24px;background-image:linear-gradient(to right,currentColor 1px,transparent 1px);background-size:5px 1px}.guido-display-condition-create__methods[data-v-929822bc]{gap:16px}.guido-display-condition-select-root[data-v-0d740001] .in-drawer__footer{justify-content:flex-start}.guido-display-condition-select__delete-modal[data-v-0d740001]{position:relative;z-index:145}.guido-display-condition-select__delete-modal[data-v-0d740001] .in-modal-v2-wrapper__header-title{margin-bottom:0}.guido-display-condition-select-root[data-v-0d740001] .in-drawer__content>div{display:flex;flex-direction:column;min-height:100%}.guido-display-condition-select__list[data-v-0d740001]{display:flex;flex-direction:column;gap:24px;margin:0;padding:0;list-style:none}.guido-display-condition-card__header[data-v-0d740001]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px}.guido-display-condition-card__text[data-v-0d740001]{min-width:0}.guido-display-condition-card__name[data-v-0d740001],.guido-display-condition-card__description[data-v-0d740001]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.guido-display-condition-card__actions[data-v-0d740001]{display:flex;flex-shrink:0;align-items:center;gap:16px}.guido-display-condition-card__split[data-v-0d740001]{position:relative;display:flex;gap:1px}.guido-display-condition-card__menu[data-v-0d740001]{z-index:2;min-width:115px}.guido-display-condition-card__divider[data-v-0d740001]{width:1px;height:24px}.guido-display-condition-card__code[data-v-0d740001]{margin:1px 15px 15px;padding:8px;font-family:inherit;white-space:pre-wrap;word-break:break-word}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}.ambiguous-dynamic-content-modal__content[data-v-2643213c]{padding-bottom:150px}
@@ -1,4 +1,4 @@
1
- const o = "3.30.1-beta.51debcb", s = { stripo: { version: "2.87.0" } }, e = {
1
+ const o = "3.30.1-beta.63a30e4", s = { stripo: { version: "2.87.0" } }, e = {
2
2
  version: o,
3
3
  guido: s
4
4
  };
@@ -3,4 +3,4 @@ import { type PartnerScopeMigrationOptions } from './recommendationPartnerMigrat
3
3
  export interface MigrationFeatureFlags {
4
4
  itemsPriceFormatting?: boolean;
5
5
  }
6
- export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>, partnerScope?: PartnerScopeMigrationOptions, features?: MigrationFeatureFlags) => Promise<string>;
6
+ export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>, partnerScope?: PartnerScopeMigrationOptions, features?: MigrationFeatureFlags, css?: string) => Promise<string>;
@@ -0,0 +1,24 @@
1
+ export type StyleDeclaration = {
2
+ prop: string;
3
+ value: string;
4
+ important: boolean;
5
+ };
6
+ export type CssRule = {
7
+ selectors: string[];
8
+ declarations: StyleDeclaration[];
9
+ };
10
+ export type ResolvedStyle = Map<string, {
11
+ value: string;
12
+ position: number;
13
+ }>;
14
+ export declare function parseDeclarations(text: string): StyleDeclaration[];
15
+ /**
16
+ * Parses the top-level style rules of a stylesheet; at-rules such as `@media` are skipped
17
+ * because they apply only to other screen sizes or clients, not to the desktop render.
18
+ */
19
+ export declare function parseCssRules(css: string): CssRule[];
20
+ /**
21
+ * Resolves the element's declared style the way the legacy editor rendered it: matching stylesheet rules,
22
+ * then the inline style, ordered by the CSS cascade (importance, inline over stylesheet, specificity, order).
23
+ */
24
+ export declare function resolveDeclaredStyle(element: Element | null, rules: CssRule[]): ResolvedStyle;
@@ -1,4 +1,5 @@
1
- import type { LegacyPaddingViewport, LegacyVariable } from './types';
1
+ import type { CssRule } from './cssCascade';
2
+ import type { LegacyButtonTheme, LegacyPaddingViewport, LegacyVariable } from './types';
2
3
  export declare function extractTitleText(block: Element): string;
3
4
  /**
4
5
  * Fallback for legacy configs that carry no `p_recommendation_title` variable:
@@ -33,6 +34,22 @@ export declare function isPriceOnNextLine(block: Element): boolean;
33
34
  * @returns The variables, with `textColor` / `textTrimming` filled from the rendered HTML where the theme lacks them
34
35
  */
35
36
  export declare function withRenderedTextTheme(variables: LegacyVariable[] | undefined, block: Element): LegacyVariable[] | undefined;
37
+ /**
38
+ * Reads the first legacy product button's colors, border and internal padding as the legacy editor rendered them.
39
+ * @param block - The legacy recommendation block element
40
+ * @param theme - The legacy button theme; its colors and border are not read again, its internal padding is
41
+ * @param cssRules - The template stylesheet's rules; legacy templates keep the button's text color and border there
42
+ * @returns Only the keys filled from the rendered button, or an empty object
43
+ */
44
+ export declare function extractRenderedButtonTheme(block: Element, theme?: LegacyButtonTheme, cssRules?: CssRule[]): LegacyButtonTheme;
45
+ /**
46
+ * Legacy keeps the product button's colors, border and internal padding on the rendered button and its stylesheet.
47
+ * @param variables - The legacy composition variables
48
+ * @param block - The legacy recommendation block element
49
+ * @param cssRules - The template stylesheet's rules
50
+ * @returns The variables, with the `p_button` theme filled from the rendered button where the theme lacks a value
51
+ */
52
+ export declare function withRenderedButtonTheme(variables: LegacyVariable[] | undefined, block: Element, cssRules?: CssRule[]): LegacyVariable[] | undefined;
36
53
  /**
37
54
  * Card background lives on either the block (`bgcolor`/`style`) or per-card
38
55
  * cells (`.product-card`). Returns empty string when no background is set —
@@ -8,6 +8,7 @@ import type { LegacyRecommendationConfig } from '@@/Types/config';
8
8
  * Migrate all legacy Recommendation Blocks in the given HTML string.
9
9
  * @param html - Full template HTML.
10
10
  * @param recommendationConfigs - Map of campaign-id → legacy config (`Record<string, LegacyRecommendationConfig>`).
11
+ * @param css - The template stylesheet, where legacy templates keep the product button's colors and border.
11
12
  * @returns Migrated HTML, or the original HTML if no legacy blocks exist.
12
13
  */
13
- export declare function migrateRecommendation(html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>): string;
14
+ export declare function migrateRecommendation(html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>, css?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.30.1-beta.51debcb",
3
+ "version": "3.30.1-beta.63a30e4",
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",