@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.
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +64 -64
- package/dist/config/migrator/index.js +16 -16
- package/dist/config/migrator/recommendation/cssCascade.js +84 -0
- package/dist/config/migrator/recommendation/extractors.js +195 -89
- package/dist/config/migrator/recommendation/themeMapper.js +33 -21
- package/dist/config/migrator/recommendationMigrator.js +70 -63
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/config/migrator/index.d.ts +1 -1
- package/dist/src/config/migrator/recommendation/cssCascade.d.ts +24 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +18 -1
- package/dist/src/config/migrator/recommendationMigrator.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCortexBlueprintBridge as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { startEditorOpenMetrics as
|
|
5
|
-
import { provideGuidoActions as
|
|
6
|
-
import { useGuidoStateBridge as
|
|
7
|
-
import { usePartner as
|
|
8
|
-
import { useSaveValidationRollout as
|
|
9
|
-
import { useStripo as
|
|
10
|
-
import { useTimerClone as
|
|
11
|
-
import { useToaster as
|
|
12
|
-
import { useTranslations as
|
|
13
|
-
import { migrate as
|
|
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
|
|
16
|
-
import { ToasterTypeOptions as
|
|
17
|
-
import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as
|
|
18
|
-
import { disposeUnsubscribeListeners as
|
|
19
|
-
import { disposeDisplayConditionRequest as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import { useStripoApi as
|
|
30
|
-
import { useConfigStore as
|
|
31
|
-
import { useDynamicContentStore as
|
|
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
|
|
35
|
-
import { usePreviewStore as
|
|
36
|
-
import { useSaveValidationStore as
|
|
37
|
-
import { useTemplateStore as
|
|
38
|
-
import { useUnsubscribeStore as
|
|
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
|
|
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 =
|
|
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 =
|
|
64
|
+
), y = W(), g = Xe(), w = ot(), re = q(), o = Qe();
|
|
65
65
|
c.ready && o.init(c.config);
|
|
66
|
-
const d = C(), ie =
|
|
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:
|
|
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
|
-
|
|
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 } =
|
|
90
|
+
}, { initPlugin: L, preloadRuntime: R } = Le(r), { runExclusive: O, beginMount: U, isCurrentMount: v } = we();
|
|
91
91
|
let f = 0;
|
|
92
|
-
const { getDefaultTemplate: A } =
|
|
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 =
|
|
95
|
+
}), de = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), me = u(() => o.externalDisplayConditions), le = u(
|
|
96
96
|
() => o.isFeatureEnabled("legacyUnsubscribeConversion")
|
|
97
|
-
), ue =
|
|
97
|
+
), ue = u(
|
|
98
98
|
() => !!z().recommendationConfigs.strategyId
|
|
99
99
|
);
|
|
100
|
-
|
|
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:
|
|
125
|
-
console.debug("dynamic-content:open", e.detail), i("dynamic-content:open", s,
|
|
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(
|
|
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) || "",
|
|
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
|
-
() =>
|
|
152
|
+
() => Ae(ve, pe, fe, ye, Se)
|
|
153
153
|
);
|
|
154
154
|
let n = {
|
|
155
|
-
html: s && await V(s),
|
|
156
|
-
css:
|
|
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
|
|
172
|
+
return Ee(async () => {
|
|
173
173
|
var e;
|
|
174
|
-
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), C().$reset(),
|
|
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, (
|
|
180
|
-
|
|
179
|
+
const s = $(() => c.ready, (l) => {
|
|
180
|
+
l && (s(), E());
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
document.addEventListener("dynamic-content:open", S);
|
|
184
|
-
}),
|
|
185
|
-
if (
|
|
186
|
-
|
|
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:
|
|
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
|
-
|
|
214
|
+
Wt as default
|
|
215
215
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
3
|
-
import { migrateFullStoryScripts as
|
|
4
|
-
import { migrateItemsBlock as
|
|
5
|
-
import { migrateItemsPriceFormat as
|
|
6
|
-
import { migrateLegacyUnsubscribeText as
|
|
7
|
-
import { migrateProductNameLink as
|
|
8
|
-
import { migrateRadioButton as
|
|
9
|
-
import { migrateRecommendation as
|
|
10
|
-
import { migrateRecommendationPartnerScope as
|
|
11
|
-
import { migrateRecommendationTitle as
|
|
12
|
-
import { migrateSocialIcons as
|
|
13
|
-
import { migrateUnsubscribe as
|
|
14
|
-
const
|
|
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 =
|
|
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
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
38
|
-
const
|
|
39
|
-
return (
|
|
40
|
-
}
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
return
|
|
44
|
-
var s,
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
return
|
|
48
|
-
const
|
|
49
|
-
return !
|
|
50
|
-
...
|
|
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
|
-
...
|
|
53
|
-
...
|
|
54
|
-
...
|
|
53
|
+
...e.theme,
|
|
54
|
+
...i ? { textColor: { color: i } } : {},
|
|
55
|
+
...c ? { textTrimming: !0 } : {}
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
65
|
-
return
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
}),
|
|
72
|
-
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
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
|
-
...
|
|
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
|
-
...
|
|
183
|
+
...e ? { symbol: e } : {},
|
|
80
184
|
alignment: 1,
|
|
81
185
|
decimalCount: "2",
|
|
82
186
|
decimalSeparator: ",",
|
|
83
187
|
thousandSeparator: "."
|
|
84
188
|
};
|
|
85
189
|
}
|
|
86
|
-
const
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
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
|
|
92
|
-
return
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
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
|
|
97
|
-
|
|
98
|
-
}),
|
|
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
|
|
101
|
-
return
|
|
204
|
+
function tt(t) {
|
|
205
|
+
return t.classList.contains(A);
|
|
102
206
|
}
|
|
103
207
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
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,
|
|
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", (
|
|
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,
|
|
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", (
|
|
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 =
|
|
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: ((
|
|
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: (
|
|
75
|
+
text: (T = n == null ? void 0 : n.buttonText) == null ? void 0 : T.text
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
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]),
|
|
86
|
-
function
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
101
|
-
|
|
112
|
+
F as appendStyle,
|
|
113
|
+
_ as mapBlockPadding,
|
|
102
114
|
E as mapButtonTheme,
|
|
103
|
-
|
|
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
|
|
3
|
-
import { ATTR_RECOMMENDATION_TITLE as
|
|
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
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
20
|
-
if (!
|
|
20
|
+
const o = U(e);
|
|
21
|
+
if (!o)
|
|
21
22
|
return console.warn(
|
|
22
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
23
|
+
`[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
23
24
|
), !1;
|
|
24
|
-
const
|
|
25
|
-
...
|
|
26
|
-
currencySettings:
|
|
27
|
-
isPriceMovedToNextLine:
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
{ oldPriceFirst:
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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:
|
|
37
|
-
visibility:
|
|
38
|
-
previousTitleHtml:
|
|
39
|
-
textTrimming:
|
|
40
|
-
},
|
|
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>${
|
|
48
|
-
nodeConfig:
|
|
49
|
-
composition:
|
|
50
|
-
cardBg:
|
|
51
|
-
titleText:
|
|
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:
|
|
55
|
-
skipCompile:
|
|
56
|
-
blockPadding:
|
|
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
|
-
`,
|
|
65
|
-
return !
|
|
66
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
67
|
-
), !1) : (e.parentNode.replaceChild(
|
|
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
|
|
70
|
-
const
|
|
71
|
-
let
|
|
75
|
+
function ae(a, e = {}, m = "") {
|
|
76
|
+
const c = new DOMParser();
|
|
77
|
+
let r;
|
|
72
78
|
try {
|
|
73
|
-
|
|
79
|
+
r = c.parseFromString(a, "text/html");
|
|
74
80
|
} catch (n) {
|
|
75
|
-
return console.error("[RecommendationMigrator] Failed to parse template:", n),
|
|
81
|
+
return console.error("[RecommendationMigrator] Failed to parse template:", n), a;
|
|
76
82
|
}
|
|
77
|
-
const
|
|
83
|
+
const o = Array.from(r.querySelectorAll(j));
|
|
78
84
|
try {
|
|
79
|
-
M().$patch((
|
|
80
|
-
|
|
81
|
-
...
|
|
82
|
-
[b.Recommendation]:
|
|
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 (
|
|
88
|
-
return
|
|
89
|
-
let
|
|
90
|
-
|
|
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
|
-
|
|
93
|
-
} catch (
|
|
94
|
-
console.error("[RecommendationMigrator] Unexpected error migrating block:",
|
|
99
|
+
K(c, n, e, s) && (i += 1);
|
|
100
|
+
} catch (t) {
|
|
101
|
+
console.error("[RecommendationMigrator] Unexpected error migrating block:", t);
|
|
95
102
|
}
|
|
96
|
-
}),
|
|
103
|
+
}), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), r.documentElement.outerHTML;
|
|
97
104
|
}
|
|
98
105
|
export {
|
|
99
|
-
|
|
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-
|
|
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}
|
package/dist/package.json.js
CHANGED
|
@@ -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 {
|
|
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
|
|
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.
|
|
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",
|