@useinsider/guido 3.24.0-beta.b9ec78b → 3.24.0-beta.d510b6c
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/composables/useActionsApi.js +2 -2
- package/dist/composables/useEditorTrackingIds.js +49 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -8
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +28 -24
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +23 -22
- package/dist/package.json.js +2 -2
- package/dist/services/templateLibraryApi.js +39 -36
- package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/utils/linkTrackingIds.d.ts +19 -0
- package/dist/utils/linkTrackingIds.js +82 -48
- package/dist/utils/templatePreparation.js +30 -33
- package/package.json +1 -1
|
@@ -111,8 +111,8 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
|
111
111
|
}),
|
|
112
112
|
updateHtmlAndCss: (t, e) => {
|
|
113
113
|
const { actionsApi: i } = r();
|
|
114
|
-
return m("updateHtmlAndCss", H, (a) => {
|
|
115
|
-
i.updateHtmlAndCss(t, e, () => a());
|
|
114
|
+
return m("updateHtmlAndCss", H, (a, o) => {
|
|
115
|
+
i.updateHtmlAndCss(t, e, () => a(), o);
|
|
116
116
|
});
|
|
117
117
|
},
|
|
118
118
|
editorSave: () => m(
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TRACK_ID_ATTRIBUTE as u, writeAnchorTrackIds as I, TRACK_SEQ_ATTRIBUTE as f, planTrackingIds as h, parseTrackSeq as w, readAnchorTrackIds as k } from "../utils/linkTrackingIds.js";
|
|
2
|
+
import { getEditorApi as A } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { ModificationDescription as x } from "../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
4
|
+
function T(t, r = []) {
|
|
5
|
+
const o = t.getType();
|
|
6
|
+
if (o === "comment") {
|
|
7
|
+
const e = t.getTextContent() ?? "", i = k(e);
|
|
8
|
+
return i.length && r.push({ kind: "comment", node: t, text: e, rawIds: i }), r;
|
|
9
|
+
}
|
|
10
|
+
if (o === "element") {
|
|
11
|
+
const e = t;
|
|
12
|
+
e.getTagName().toLowerCase() === "a" && r.push({ kind: "element", node: e, rawIds: [e.getAttribute(u) ?? ""] });
|
|
13
|
+
}
|
|
14
|
+
return t.childNodes().forEach((e) => T(e, r)), r;
|
|
15
|
+
}
|
|
16
|
+
function y(t, r) {
|
|
17
|
+
if (!t)
|
|
18
|
+
throw new Error("The editor exposes no editorCopilotApi.");
|
|
19
|
+
const o = t.getDocumentRootHtmlNode(), e = o.querySelector("body");
|
|
20
|
+
if (!e)
|
|
21
|
+
throw new Error("The editor document has no <body> to record tracking ids on.");
|
|
22
|
+
const i = T(o), s = h(
|
|
23
|
+
i.flatMap((d) => d.rawIds),
|
|
24
|
+
w(e.getAttribute(f)),
|
|
25
|
+
r
|
|
26
|
+
);
|
|
27
|
+
return { api: t, seqHost: e, hosts: i, plan: s };
|
|
28
|
+
}
|
|
29
|
+
const H = () => ({ writeTrackingIds: (r) => {
|
|
30
|
+
const { editorCopilotApi: o } = A();
|
|
31
|
+
let e;
|
|
32
|
+
try {
|
|
33
|
+
e = y(o, r);
|
|
34
|
+
} catch (n) {
|
|
35
|
+
return console.warn("Tracking ids skipped for this save:", n), { changed: !1, nextSeq: r };
|
|
36
|
+
}
|
|
37
|
+
const { api: i, seqHost: s, hosts: d, plan: c } = e;
|
|
38
|
+
if (!c.changed)
|
|
39
|
+
return { changed: !1, nextSeq: c.nextSeq };
|
|
40
|
+
const a = i.getTemplateModifier();
|
|
41
|
+
let l = 0;
|
|
42
|
+
return d.forEach((n) => {
|
|
43
|
+
const m = n.rawIds.map((p, g) => c.reassigned[l + g] ? c.ids[l + g] : null);
|
|
44
|
+
l += n.rawIds.length, !m.every((p) => p === null) && (n.kind === "element" ? a.modifyHtml(n.node).setAttribute(u, String(m[0])) : a.modifyHtml(n.node).replaceWith(`<!--${I(n.text, m)}-->`));
|
|
45
|
+
}), a.modifyHtml(s).setAttribute(f, String(c.nextSeq)), a.apply(new x("Updated Insider tracking IDs").asHidden()), { changed: !0, nextSeq: c.nextSeq };
|
|
46
|
+
} });
|
|
47
|
+
export {
|
|
48
|
+
H as useEditorTrackingIds
|
|
49
|
+
};
|
|
@@ -17,9 +17,9 @@ import { CurrencyControl as U } from "./currency.js";
|
|
|
17
17
|
import { CURRENCY_CONTROL_ID as Ie } from "./currency.js";
|
|
18
18
|
import { FiltersControl as v } from "./filters.js";
|
|
19
19
|
import { FILTERS_CONTROL_ID as ke } from "./filters.js";
|
|
20
|
-
import { LayoutOrientationControl as
|
|
20
|
+
import { LayoutOrientationControl as w } from "./layoutOrientation.js";
|
|
21
21
|
import { LAYOUT_ORIENTATION_CONTROL_ID as Oe } from "./layoutOrientation.js";
|
|
22
|
-
import { LocaleControl as
|
|
22
|
+
import { LocaleControl as A } from "./locale.js";
|
|
23
23
|
import { LOCALE_CONTROL_ID as Be } from "./locale.js";
|
|
24
24
|
import { PricePlacementControl as V } from "./pricePlacement.js";
|
|
25
25
|
import { PRICE_PLACEMENT_CONTROL_ID as Le } from "./pricePlacement.js";
|
|
@@ -28,7 +28,7 @@ import { PRODUCT_COUNT_CONTROL_ID as Ee } from "./productCount.js";
|
|
|
28
28
|
import { ProductLayoutControl as x } from "./productLayout.js";
|
|
29
29
|
import { PRODUCT_LAYOUT_CONTROL_ID as ve } from "./productLayout.js";
|
|
30
30
|
import { ShuffleControl as M } from "./shuffle.js";
|
|
31
|
-
import { SHUFFLE_CONTROL_ID as
|
|
31
|
+
import { SHUFFLE_CONTROL_ID as Ae } from "./shuffle.js";
|
|
32
32
|
import { StrategyControl as G } from "./strategy.js";
|
|
33
33
|
import { STRATEGY_CONTROL_ID as We } from "./strategy.js";
|
|
34
34
|
import { setCurrencyAttributes as $, getBlockElement as z, isPartnerManagedBlock as H, updateProductContentInPlace as Y, regenerateProductRowsWithStyles as j } from "./utils.js";
|
|
@@ -128,7 +128,7 @@ class _e extends I {
|
|
|
128
128
|
return this.rrsEnabled = f().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
|
|
129
129
|
var o;
|
|
130
130
|
return (o = t == null ? void 0 : t.onDestroy) == null ? void 0 : o.call(t);
|
|
131
|
-
}), this.algorithmControl = new E(), this.localeControl = new
|
|
131
|
+
}), this.algorithmControl = new E(), this.localeControl = new A(), this.currencyControl = new U(), this.productCountControl = new W(), this.productLayoutControl = new x(), this.filtersControl = new v(), this.shuffleControl = new M(), this.pricePlacementControl = new V(), this.layoutOrientationControl = new w(), this.strategyControl = this.rrsEnabled ? new G() : null, this._subControls.forEach((t) => {
|
|
132
132
|
t && (t.api = this.api);
|
|
133
133
|
}), `
|
|
134
134
|
<div class="recommendation-controls-container">
|
|
@@ -452,7 +452,9 @@ class _e extends I {
|
|
|
452
452
|
e,
|
|
453
453
|
this._getNodeConfigUpdates(n.recommendationConfigs),
|
|
454
454
|
h
|
|
455
|
-
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e })
|
|
455
|
+
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e });
|
|
456
|
+
const s = o && n.drawnProducts !== n.recommendationProducts;
|
|
457
|
+
(i || s) && this._refreshOutsidePanel(e, i);
|
|
456
458
|
} catch (n) {
|
|
457
459
|
console.error("[recommendation] finishing the block outside the panel failed", n);
|
|
458
460
|
}
|
|
@@ -552,8 +554,8 @@ export {
|
|
|
552
554
|
v as FiltersControl,
|
|
553
555
|
Oe as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
554
556
|
Be as LOCALE_CONTROL_ID,
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
w as LayoutOrientationControl,
|
|
558
|
+
A as LocaleControl,
|
|
557
559
|
Le as PRICE_PLACEMENT_CONTROL_ID,
|
|
558
560
|
Ee as PRODUCT_COUNT_CONTROL_ID,
|
|
559
561
|
ve as PRODUCT_LAYOUT_CONTROL_ID,
|
|
@@ -561,7 +563,7 @@ export {
|
|
|
561
563
|
W as ProductCountControl,
|
|
562
564
|
x as ProductLayoutControl,
|
|
563
565
|
_e as RecommendationBlockControl,
|
|
564
|
-
|
|
566
|
+
Ae as SHUFFLE_CONTROL_ID,
|
|
565
567
|
We as STRATEGY_CONTROL_ID,
|
|
566
568
|
M as ShuffleControl,
|
|
567
569
|
G as StrategyControl,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useToaster as L } from "../../../../composables/useToaster.js";
|
|
2
2
|
import { useTranslations as U } from "../../../../composables/useTranslations.js";
|
|
3
|
-
import { getRecommendationFeedSourceMaps as
|
|
3
|
+
import { getRecommendationFeedSourceMaps as w, strategyEditPath as z, strategyCreatePath as B, getOperatorOptions as M, PriceAttributes as N } from "../../../../enums/extensions/recommendationBlock.js";
|
|
4
4
|
import { ToasterTypeOptions as E } from "../../../../enums/toaster.js";
|
|
5
5
|
import { useRecommendationApi as O } from "../../../../services/recommendationApi.js";
|
|
6
6
|
import { useConfigStore as R } from "../../../../stores/config.js";
|
|
@@ -8,21 +8,21 @@ import { defineStore as V } from "pinia";
|
|
|
8
8
|
import "../constants/selectors.js";
|
|
9
9
|
import { DEFAULT_MOBILE_CARDS_IN_ROW as A, DEFAULT_CARDS_IN_ROW as x } from "../constants/layout.js";
|
|
10
10
|
import { CURRENT_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as T, EXCLUDED_ALGORITHM_IDS as j } from "../constants/defaultConfig.js";
|
|
11
|
-
import { getDefaultProducts as
|
|
11
|
+
import { getDefaultProducts as F } from "../templates/utils.js";
|
|
12
12
|
import { generateCompleteFilterQuery as P } from "../utils/filterUtil.js";
|
|
13
13
|
import { isLegacyStrategyConfig as $ } from "../utils/legacyStrategyMigration.js";
|
|
14
14
|
import { getPartnerRecommendationParams as q } from "../utils/partnerCustomizations.js";
|
|
15
15
|
import { sanitizeProductIds as K } from "../utils/productIds.js";
|
|
16
16
|
import { isFilterValid as H } from "../validation/filterSchema.js";
|
|
17
17
|
import { getInvalidFields as J, isConfigValid as Q } from "../validation/requiredFields.js";
|
|
18
|
-
const
|
|
18
|
+
const u = O();
|
|
19
19
|
let p = null, y = null;
|
|
20
20
|
const I = /* @__PURE__ */ new Map();
|
|
21
21
|
let k = null, b = 0;
|
|
22
|
-
const
|
|
22
|
+
const m = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
|
|
23
23
|
function W(t) {
|
|
24
24
|
const e = _.get(t);
|
|
25
|
-
return e && e.token ===
|
|
25
|
+
return e && e.token === m.get(t) ? e.outcome : !1;
|
|
26
26
|
}
|
|
27
27
|
let l = null;
|
|
28
28
|
const X = () => {
|
|
@@ -80,7 +80,8 @@ function G() {
|
|
|
80
80
|
syncedConfigFingerprint: null,
|
|
81
81
|
legacyConversionLoading: !1,
|
|
82
82
|
configVersion: 0,
|
|
83
|
-
adoptedSizeVersion: 0
|
|
83
|
+
adoptedSizeVersion: 0,
|
|
84
|
+
drawnProducts: null
|
|
84
85
|
};
|
|
85
86
|
}
|
|
86
87
|
const Y = () => ({
|
|
@@ -173,7 +174,7 @@ const Y = () => ({
|
|
|
173
174
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, n) => e - n);
|
|
174
175
|
},
|
|
175
176
|
getActivePredictiveAlgorithms: (t) => {
|
|
176
|
-
const e =
|
|
177
|
+
const e = w(), n = [];
|
|
177
178
|
return t.activePredictiveAlgorithms.filter((r) => !j.includes(r)).forEach((r) => {
|
|
178
179
|
n.push(...e.filter((o) => o.id === r));
|
|
179
180
|
}), n.map((r) => ({
|
|
@@ -245,7 +246,7 @@ const Y = () => ({
|
|
|
245
246
|
const n = this.blockStates[t];
|
|
246
247
|
if (n) {
|
|
247
248
|
const s = structuredClone(n);
|
|
248
|
-
s.recommendationConfigs.id = e, s.recommendationConfigs.strategyId && R().isFeatureEnabled("reusableRecommendationStrategy") && (s.isInitialized = !1, s.syncedConfigFingerprint = null), this.blockStates = {
|
|
249
|
+
s.recommendationConfigs.id = e, s.drawnProducts = null, s.recommendationConfigs.strategyId && R().isFeatureEnabled("reusableRecommendationStrategy") && (s.isInitialized = !1, s.syncedConfigFingerprint = null), this.blockStates = {
|
|
249
250
|
...this.blockStates,
|
|
250
251
|
[e]: s
|
|
251
252
|
};
|
|
@@ -256,6 +257,9 @@ const Y = () => ({
|
|
|
256
257
|
[o]: i
|
|
257
258
|
});
|
|
258
259
|
},
|
|
260
|
+
markProductsDrawn(t, e) {
|
|
261
|
+
this.blockStates[t] && (this.blockStates[t].drawnProducts = e);
|
|
262
|
+
},
|
|
259
263
|
/**
|
|
260
264
|
* Marks a block as initialized (initial API data has been fetched).
|
|
261
265
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -401,7 +405,7 @@ const Y = () => ({
|
|
|
401
405
|
const t = b, e = (async () => {
|
|
402
406
|
this.strategiesLoading = !0;
|
|
403
407
|
try {
|
|
404
|
-
const n = await
|
|
408
|
+
const n = await u.fetchRecommendationStrategies();
|
|
405
409
|
if (t !== b)
|
|
406
410
|
return;
|
|
407
411
|
this.strategies = n, this.strategiesFetched = !0;
|
|
@@ -495,7 +499,7 @@ const Y = () => ({
|
|
|
495
499
|
const n = typeof t.updated_at == "string" ? t.updated_at : "", r = n ? `${t.strategy_id}:${n}:${e}` : "", o = r ? this.strategyUrlTemplates[r] : void 0;
|
|
496
500
|
if (o)
|
|
497
501
|
return o;
|
|
498
|
-
const { full_path: i = "" } = await
|
|
502
|
+
const { full_path: i = "" } = await u.generateStrategyEndpoint(t, e) ?? {};
|
|
499
503
|
return r && i && (this.strategyUrlTemplates = {
|
|
500
504
|
...this.strategyUrlTemplates,
|
|
501
505
|
[r]: i
|
|
@@ -513,7 +517,7 @@ const Y = () => ({
|
|
|
513
517
|
throw new Error("[Guido] convertLegacyStrategy called without an active block");
|
|
514
518
|
this.blockStates[n].legacyConversionLoading = !0;
|
|
515
519
|
try {
|
|
516
|
-
const r = await
|
|
520
|
+
const r = await u.migrateLegacyStrategy(t, e);
|
|
517
521
|
this.invalidateStrategies();
|
|
518
522
|
try {
|
|
519
523
|
await this.fetchStrategies();
|
|
@@ -562,7 +566,7 @@ const Y = () => ({
|
|
|
562
566
|
activePredictiveAlgorithms: t,
|
|
563
567
|
languages: e,
|
|
564
568
|
currencies: n
|
|
565
|
-
} = await
|
|
569
|
+
} = await u.fetchRecommendationCreateData();
|
|
566
570
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
567
571
|
const r = this.blockStates[this.currentRecommendationId];
|
|
568
572
|
r.filterStatus = !!r.recommendationConfigs.filters.length;
|
|
@@ -583,7 +587,7 @@ const Y = () => ({
|
|
|
583
587
|
return;
|
|
584
588
|
}
|
|
585
589
|
y = (async () => {
|
|
586
|
-
const t = await
|
|
590
|
+
const t = await u.fetchRecommendationFilters();
|
|
587
591
|
this.filterList = t;
|
|
588
592
|
})();
|
|
589
593
|
try {
|
|
@@ -709,14 +713,14 @@ const Y = () => ({
|
|
|
709
713
|
await this._doFetchStrategyProducts(e);
|
|
710
714
|
return;
|
|
711
715
|
}
|
|
712
|
-
const i = (
|
|
713
|
-
|
|
716
|
+
const i = (m.get(e) ?? 0) + 1;
|
|
717
|
+
m.set(e, i);
|
|
714
718
|
const s = parseInt(r.size) || 6;
|
|
715
719
|
if (!r.strategy) {
|
|
716
720
|
this._setBlockProducts(e, [], s);
|
|
717
721
|
return;
|
|
718
722
|
}
|
|
719
|
-
const a = r.filters.filter((h) => h.isValid), d = P(a), f = ((S =
|
|
723
|
+
const a = r.filters.filter((h) => h.isValid), d = P(a), f = ((S = w().find((h) => h.key === r.strategy)) == null ? void 0 : S.path) || "", c = {
|
|
720
724
|
locale: r.language,
|
|
721
725
|
currency: r.currencySettings.value,
|
|
722
726
|
partnerName: o.partnerName,
|
|
@@ -730,11 +734,11 @@ const Y = () => ({
|
|
|
730
734
|
);
|
|
731
735
|
let g;
|
|
732
736
|
try {
|
|
733
|
-
g = await
|
|
737
|
+
g = await u.fetchRecommendationProducts(f, c);
|
|
734
738
|
} catch {
|
|
735
739
|
g = [];
|
|
736
740
|
}
|
|
737
|
-
|
|
741
|
+
m.get(e) === i && this._setBlockProducts(e, g, s);
|
|
738
742
|
},
|
|
739
743
|
/**
|
|
740
744
|
* Block-scoped counterpart of `fetchRecommendationProducts`, which only serves the selected block:
|
|
@@ -773,8 +777,8 @@ const Y = () => ({
|
|
|
773
777
|
return !0;
|
|
774
778
|
},
|
|
775
779
|
_doFetchStrategyProducts(t, e = {}) {
|
|
776
|
-
const n = (
|
|
777
|
-
|
|
780
|
+
const n = (m.get(t) ?? 0) + 1;
|
|
781
|
+
m.set(t, n);
|
|
778
782
|
const r = this._loadStrategyProducts(t, n, e);
|
|
779
783
|
return _.set(t, { token: n, outcome: r }), r;
|
|
780
784
|
},
|
|
@@ -789,20 +793,20 @@ const Y = () => ({
|
|
|
789
793
|
if (s) {
|
|
790
794
|
i = parseInt(String(s.size ?? "")) || i;
|
|
791
795
|
const a = r.currencySettings.value, f = (await this.resolveStrategyUrlTemplate(s, a)).replaceAll("{locale}", r.language).replaceAll("{currency}", a), c = f.indexOf("?"), g = c === -1 ? f : f.slice(0, c), S = (c === -1 ? "" : f.slice(c + 1)).split("&").filter((v) => v && !v.startsWith("user_id=")), h = S.length ? `${g}?${S.join("&")}` : g;
|
|
792
|
-
h && (o = await
|
|
796
|
+
h && (o = await u.fetchRecommendationProductsByUrl(h));
|
|
793
797
|
}
|
|
794
798
|
} catch {
|
|
795
799
|
o = [];
|
|
796
800
|
}
|
|
797
|
-
return
|
|
801
|
+
return m.get(t) !== e ? W(t) : !o.length && n ? !1 : (this._setBlockProducts(t, o, i), o.length > 0);
|
|
798
802
|
},
|
|
799
803
|
_setBlockProducts(t, e, n) {
|
|
800
804
|
if (!this.blockStates[t])
|
|
801
805
|
return;
|
|
802
|
-
const r = e.length > 0 ? e :
|
|
806
|
+
const r = e.length > 0 ? e : F(n);
|
|
803
807
|
this.blockStates[t].recommendationProducts = [
|
|
804
808
|
...r.slice(0, n),
|
|
805
|
-
...
|
|
809
|
+
...F(Math.max(0, n - r.length))
|
|
806
810
|
];
|
|
807
811
|
}
|
|
808
812
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ModificationDescription as a } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RECOMMENDATION_ID_ATTR as m } from "../constants/selectors.js";
|
|
3
|
-
import { isPartnerManagedBlock as
|
|
3
|
+
import { isPartnerManagedBlock as N, updateProductContentInPlace as I, regenerateProductRowsWithStyles as O } from "../controls/main/utils.js";
|
|
4
4
|
import { RecommendationConfigService as c } from "../services/configService.js";
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
5
|
+
import { useRecommendationExtensionStore as C } from "../store/recommendation.js";
|
|
6
6
|
let r = null;
|
|
7
|
-
function
|
|
7
|
+
function T(t) {
|
|
8
8
|
r = t;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function p(t) {
|
|
11
11
|
const n = r == null ? void 0 : r.getDocumentRootHtmlNode();
|
|
12
12
|
return !n || !("querySelector" in n) ? null : n.querySelector(`[${m}="${t}"]`) ?? null;
|
|
13
13
|
}
|
|
@@ -19,18 +19,18 @@ function R(t, n) {
|
|
|
19
19
|
const o = c.getConfig(t);
|
|
20
20
|
return ["filters", "strategy", "strategyId", "size", "productIds"].some((e) => e in n && JSON.stringify(o[e]) !== JSON.stringify(n[e]));
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
function
|
|
22
|
+
const S = "Updated product IDs";
|
|
23
|
+
function y(t, n) {
|
|
24
24
|
if (!("productIds" in n))
|
|
25
25
|
return !1;
|
|
26
26
|
const o = c.getConfig(t);
|
|
27
27
|
return JSON.stringify(o.productIds) !== JSON.stringify(n.productIds);
|
|
28
28
|
}
|
|
29
29
|
function h(t, n, o) {
|
|
30
|
-
return
|
|
30
|
+
return y(t, n) ? S : o;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const e =
|
|
32
|
+
function $(t, n, o) {
|
|
33
|
+
const e = p(t);
|
|
34
34
|
if (!r || !e)
|
|
35
35
|
return !1;
|
|
36
36
|
if (R(e, n)) {
|
|
@@ -40,7 +40,7 @@ function k(t, n, o) {
|
|
|
40
40
|
return !0;
|
|
41
41
|
}
|
|
42
42
|
function P(t, n) {
|
|
43
|
-
const o =
|
|
43
|
+
const o = C(), e = o.currentRecommendationId;
|
|
44
44
|
if (e === t || !o.blockStates[t]) {
|
|
45
45
|
n();
|
|
46
46
|
return;
|
|
@@ -52,16 +52,17 @@ function P(t, n) {
|
|
|
52
52
|
o.$patch({ currentRecommendationId: e });
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function k(t) {
|
|
56
56
|
const n = r == null ? void 0 : r.getDocumentRootHtmlNode();
|
|
57
57
|
return !n || !("querySelectorAll" in n) ? [] : n.querySelectorAll(`[${m}="${t}"]`).map((o) => c.getConfig(o));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
const i =
|
|
59
|
+
function q(t, n, o, e) {
|
|
60
|
+
const i = p(t);
|
|
61
61
|
if (!r || !i)
|
|
62
62
|
return !1;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
C().markProductsDrawn(t, o);
|
|
64
|
+
const f = r.getDocumentModifier(), d = D(i, n), g = y(i, n), s = g ? S : e, l = { currentNode: i, documentModifier: f, products: o, ...g ? { description: s } : {} };
|
|
65
|
+
if (c.stageConfig(f, i, n), N(i))
|
|
65
66
|
return d && f.apply(new a(s)), !0;
|
|
66
67
|
let u = !1;
|
|
67
68
|
return P(t, () => {
|
|
@@ -70,16 +71,16 @@ function w(t, n, o, e) {
|
|
|
70
71
|
onApplied: () => {
|
|
71
72
|
u = !0;
|
|
72
73
|
}
|
|
73
|
-
}) || (u =
|
|
74
|
+
}) || (u = O(l));
|
|
74
75
|
}), !u && d && f.apply(new a(s)), !0;
|
|
75
76
|
}
|
|
76
77
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
S as PRODUCT_IDS_DESCRIPTION,
|
|
79
|
+
q as commitBlockChangeOutsidePanel,
|
|
79
80
|
R as hasEditedConfigChange,
|
|
80
|
-
|
|
81
|
+
y as isProductIdsChange,
|
|
81
82
|
h as pickConfigDescription,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
k as readBlockNodeConfigs,
|
|
84
|
+
T as registerNodeConfigWriter,
|
|
85
|
+
$ as writeBlockConfigOutsidePanel
|
|
85
86
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const o = "3.24.0-beta.
|
|
1
|
+
const o = "3.24.0-beta.d510b6c", s = { stripo: { version: "2.83.1" } }, t = {
|
|
2
2
|
version: o,
|
|
3
3
|
guido: s
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
t as default,
|
|
7
7
|
s as guido,
|
|
8
8
|
o as version
|
|
9
9
|
};
|
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as A } from "../composables/useActionsApi.js";
|
|
2
2
|
import { useConfig as S } from "../composables/useConfig.js";
|
|
3
|
-
import { useHttp as
|
|
3
|
+
import { useHttp as E } from "../composables/useHttp.js";
|
|
4
4
|
import { useToaster as x } from "../composables/useToaster.js";
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import { useHtmlDocumentCountValidator as
|
|
5
|
+
import { useTranslations as P } from "../composables/useTranslations.js";
|
|
6
|
+
import { useHtmlDocumentCountValidator as L } from "../composables/validators/useHtmlDocumentCountValidator.js";
|
|
7
7
|
import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
|
|
8
8
|
import { EditorType as H } from "../enums/defaults.js";
|
|
9
|
-
import { ToasterTypeOptions as
|
|
9
|
+
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
10
10
|
import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
-
import { useSaveAsTemplateStore as
|
|
11
|
+
import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
|
|
12
12
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
13
|
-
import { isPlainObject as
|
|
13
|
+
import { isPlainObject as w } from "../utils/genericUtil.js";
|
|
14
14
|
import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
|
|
15
15
|
const Z = () => {
|
|
16
|
-
const { get:
|
|
16
|
+
const { get: l, post: c } = E(), { handleError: o, showToaster: i } = x(), { config: p, isFeatureEnabled: u } = S(), { validateLiquidSyntax: b } = N(), { validateSingleHtmlDocument: C } = L(), { getTemplateData: h } = A(), n = P();
|
|
17
17
|
return {
|
|
18
18
|
getCategories: async () => {
|
|
19
19
|
try {
|
|
20
|
-
const { data: e
|
|
21
|
-
return e
|
|
20
|
+
const { data: e } = await l("/newsletter/template-library/get-template-categories");
|
|
21
|
+
return Array.isArray(e) ? e : ((!w(e) || e.type !== "alert") && console.error("[TEMPLATE_LIBRARY_API] Unexpected get-template-categories response", e), i({
|
|
22
|
+
message: n("newsletter.template-library-service-error"),
|
|
23
|
+
type: T.Error
|
|
24
|
+
}), []);
|
|
22
25
|
} catch (e) {
|
|
23
|
-
return
|
|
26
|
+
return o(e, "Failed to fetch template categories"), [];
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
checkTemplateNameAvailability: async (e) => {
|
|
27
|
-
const { data: { status: t = !1 } } = await
|
|
30
|
+
const { data: { status: t = !1 } } = await l(
|
|
28
31
|
`/newsletter/template-library/template-name-exists?name=${e}`
|
|
29
32
|
);
|
|
30
33
|
return !t;
|
|
31
34
|
},
|
|
32
35
|
createCategory: async (e) => {
|
|
33
36
|
try {
|
|
34
|
-
const { data: { id: t } } = await
|
|
37
|
+
const { data: { id: t } } = await c(
|
|
35
38
|
"/newsletter/template-library/create-category",
|
|
36
39
|
{ name: e }
|
|
37
40
|
);
|
|
38
41
|
return t.toString();
|
|
39
42
|
} catch (t) {
|
|
40
|
-
return
|
|
43
|
+
return o(t, "Failed to create category"), "";
|
|
41
44
|
}
|
|
42
45
|
},
|
|
43
46
|
createTemplate: async () => {
|
|
44
47
|
var e, t, d, y;
|
|
45
48
|
try {
|
|
46
|
-
const { prepareTemplateDetails:
|
|
47
|
-
if (!
|
|
49
|
+
const { prepareTemplateDetails: m } = F(), s = q(), g = await h();
|
|
50
|
+
if (!C(g.html))
|
|
48
51
|
return !1;
|
|
49
|
-
const a = await
|
|
50
|
-
if (
|
|
52
|
+
const a = await m(g);
|
|
53
|
+
if (u("liquidSyntax") && !await b(a.compiledHtml))
|
|
51
54
|
return !1;
|
|
52
|
-
const
|
|
53
|
-
name:
|
|
54
|
-
categories:
|
|
55
|
-
productId: ((t = (e =
|
|
55
|
+
const v = {
|
|
56
|
+
name: s.getTemplateName,
|
|
57
|
+
categories: s.getSelectedCategoryIds,
|
|
58
|
+
productId: ((t = (e = p.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
56
59
|
editorType: H,
|
|
57
|
-
messageType: ((y = (d =
|
|
60
|
+
messageType: ((y = (d = p.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
58
61
|
content: r(a.compiledHtml),
|
|
59
62
|
css: r(a.css),
|
|
60
63
|
unsubscriptionPreferencePageStatus: !1,
|
|
@@ -65,34 +68,34 @@ const Z = () => {
|
|
|
65
68
|
recommendationConfigs: r({}),
|
|
66
69
|
isGuido: !0,
|
|
67
70
|
// eslint-disable-next-line camelcase
|
|
68
|
-
template_engine:
|
|
71
|
+
template_engine: u("liquidSyntax") ? 1 : 0,
|
|
69
72
|
stripoConfig: r({
|
|
70
73
|
editor: "stripo",
|
|
71
74
|
html: a.rawHtml,
|
|
72
75
|
css: a.css,
|
|
73
76
|
dynamicContentList: a.dynamicContentList
|
|
74
77
|
})
|
|
75
|
-
}, { data: f } = await
|
|
78
|
+
}, { data: f } = await c(
|
|
76
79
|
"/newsletter/template-library/create-template",
|
|
77
|
-
|
|
80
|
+
v
|
|
78
81
|
);
|
|
79
|
-
if (!
|
|
82
|
+
if (!w(f))
|
|
80
83
|
throw new Error("Unexpected create-template response");
|
|
81
|
-
return f.type === "alert" ? (
|
|
82
|
-
message:
|
|
84
|
+
return f.type === "alert" ? (i({
|
|
85
|
+
message: n(
|
|
83
86
|
"newsletter.template-library-save-alert",
|
|
84
|
-
{ templateName:
|
|
87
|
+
{ templateName: s.getTemplateName }
|
|
85
88
|
),
|
|
86
|
-
type:
|
|
87
|
-
}), !1) : (
|
|
88
|
-
message:
|
|
89
|
+
type: T.Error
|
|
90
|
+
}), !1) : (i({
|
|
91
|
+
message: n(
|
|
89
92
|
"newsletter.template-library-save-success",
|
|
90
|
-
{ templateName:
|
|
93
|
+
{ templateName: s.getTemplateName }
|
|
91
94
|
),
|
|
92
95
|
type: "success"
|
|
93
96
|
}), !0);
|
|
94
|
-
} catch (
|
|
95
|
-
return
|
|
97
|
+
} catch (m) {
|
|
98
|
+
return o(m, "Failed to create template"), !1;
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
};
|
|
@@ -57,6 +57,7 @@ interface PerBlockState {
|
|
|
57
57
|
legacyConversionLoading: boolean;
|
|
58
58
|
configVersion: number;
|
|
59
59
|
adoptedSizeVersion: number;
|
|
60
|
+
drawnProducts: RecommendationProduct[] | null;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
|
|
@@ -491,6 +492,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
491
492
|
* (SD-149916).
|
|
492
493
|
*/
|
|
493
494
|
cloneBlockState(sourceId: number, newId: number): void;
|
|
495
|
+
markProductsDrawn(id: number, products: RecommendationProduct[]): void;
|
|
494
496
|
/**
|
|
495
497
|
* Marks a block as initialized (initial API data has been fetched).
|
|
496
498
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -20,6 +20,25 @@ export declare function readTrackSeq(html: string): number;
|
|
|
20
20
|
* Scans the document because a rewrite can strip the seq host but keep the ids.
|
|
21
21
|
*/
|
|
22
22
|
export declare function readTrackFloor(html: string, persistedCounter?: number): number;
|
|
23
|
+
export interface TrackingIdPlan {
|
|
24
|
+
/** Final id per anchor, in the order the raw values were given. */
|
|
25
|
+
ids: number[];
|
|
26
|
+
reassigned: boolean[];
|
|
27
|
+
nextSeq: number;
|
|
28
|
+
seqChanged: boolean;
|
|
29
|
+
changed: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The id rule shared by the string transform and the editor-model writer: `rawIds` are the
|
|
33
|
+
* anchors' current `data-ins-track-id` values in document order ('' when absent).
|
|
34
|
+
*/
|
|
35
|
+
export declare function planTrackingIds(rawIds: readonly string[], persistedSeq: number, floor?: number): TrackingIdPlan;
|
|
36
|
+
/** Reads a `data-ins-track-seq` attribute value the way readTrackSeq reads it from HTML. */
|
|
37
|
+
export declare function parseTrackSeq(value: string | null): number;
|
|
38
|
+
/** The `data-ins-track-id` value of every `<a>` opening tag in `html`, in order ('' when absent). */
|
|
39
|
+
export declare function readAnchorTrackIds(html: string): string[];
|
|
40
|
+
/** Writes `ids[i]` onto the i-th `<a>` opening tag of `html`; `null` or a missing entry leaves it untouched. */
|
|
41
|
+
export declare function writeAnchorTrackIds(html: string, ids: readonly (number | null)[]): string;
|
|
23
42
|
/**
|
|
24
43
|
* Ensures every <a> opening tag carries a unique positive-integer id and the
|
|
25
44
|
* document records the id high-water mark. Ids are minted above
|
|
@@ -1,56 +1,90 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
return Number.isSafeInteger(
|
|
5
|
-
}
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const o = (r = s.exec(e)) == null ? void 0 : r[0];
|
|
11
|
-
return o ? S.exec(o) : null;
|
|
12
|
-
}, t = n(b) ?? n(N), c = (t == null ? void 0 : t[1]) ?? (t == null ? void 0 : t[2]) ?? (t == null ? void 0 : t[3]) ?? ((a = _.exec(e)) == null ? void 0 : a[1]) ?? "";
|
|
13
|
-
return m(c);
|
|
14
|
-
}
|
|
15
|
-
function P(e, n = 0) {
|
|
16
|
-
let t = 0;
|
|
17
|
-
[...e.matchAll(f)].forEach(([a]) => {
|
|
18
|
-
const s = I.exec(a), o = s ? s[1] ?? s[2] ?? s[3] ?? "" : "";
|
|
19
|
-
w.test(o) && (t = Math.max(t, Number(o)));
|
|
1
|
+
const l = "data-ins-track-id", E = "data-ins-track-seq", A = `(?:[^>"']|"[^"]*"|'[^']*')*`, k = new RegExp(`<a\\b${A}>`, "gi"), R = new RegExp(`<body\\b${A}>`, "i"), _ = new RegExp(`<html\\b${A}>`, "i"), m = new RegExp(`\\b${l}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"), f = new RegExp(`\\b${E}\\s*=\\s*(?:"(\\d+)"|'(\\d+)'|(\\d+))`, "i"), p = "ins-track-seq", x = new RegExp(`<!--\\s*${p}:(\\d+)\\s*-->`, "i"), $ = /^[1-9][0-9]{0,14}$/, q = 999999999999999;
|
|
2
|
+
function I(e) {
|
|
3
|
+
const c = Number(e);
|
|
4
|
+
return Number.isSafeInteger(c) && c > 0 ? c : 0;
|
|
5
|
+
}
|
|
6
|
+
function T(e) {
|
|
7
|
+
return [...e.matchAll(k)].map((c) => {
|
|
8
|
+
const [n] = c, t = m.exec(n), r = t ? t[1] ?? t[2] ?? t[3] ?? "" : "";
|
|
9
|
+
return { index: c.index, tag: n, attrMatch: t, rawValue: r };
|
|
20
10
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
}
|
|
12
|
+
function b(e) {
|
|
13
|
+
var r;
|
|
14
|
+
const c = (s) => {
|
|
15
|
+
var a;
|
|
16
|
+
const o = (a = s.exec(e)) == null ? void 0 : a[0];
|
|
17
|
+
return o ? f.exec(o) : null;
|
|
18
|
+
}, n = c(R) ?? c(_), t = (n == null ? void 0 : n[1]) ?? (n == null ? void 0 : n[2]) ?? (n == null ? void 0 : n[3]) ?? ((r = x.exec(e)) == null ? void 0 : r[1]) ?? "";
|
|
19
|
+
return I(t);
|
|
20
|
+
}
|
|
21
|
+
function h(e, c = 0) {
|
|
22
|
+
let n = 0;
|
|
23
|
+
T(e).forEach(({ rawValue: r }) => {
|
|
24
|
+
$.test(r) && (n = Math.max(n, Number(r)));
|
|
25
|
+
});
|
|
26
|
+
const t = Number.isSafeInteger(c) && c > 0 ? c : 0;
|
|
27
|
+
return Math.max(b(e), n, t);
|
|
28
|
+
}
|
|
29
|
+
function w(e, c) {
|
|
30
|
+
const n = `${E}="${c}"`, t = R.exec(e) ?? _.exec(e);
|
|
31
|
+
if (t) {
|
|
32
|
+
const [s] = t, o = f.exec(s), a = o ? s.replace(o[0], n) : s.replace(/\/?>$/, (u) => ` ${n}${u}`);
|
|
33
|
+
return e.slice(0, t.index) + a + e.slice(t.index + s.length);
|
|
29
34
|
}
|
|
30
|
-
const
|
|
31
|
-
return
|
|
35
|
+
const r = `<!--${p}:${c}-->`;
|
|
36
|
+
return x.test(e) ? e.replace(x, r) : `${r}${e}`;
|
|
32
37
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
return
|
|
38
|
+
function M(e, c, n) {
|
|
39
|
+
const t = `${l}="${n}"`;
|
|
40
|
+
return c ? e.replace(c[0], t) : e.replace(/^<a\b/i, (r) => `${r} ${t}`);
|
|
36
41
|
}
|
|
37
|
-
function C(e, n = 0) {
|
|
42
|
+
function C(e, c, n = 0) {
|
|
38
43
|
const t = /* @__PURE__ */ new Set();
|
|
39
|
-
let
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
let r = 0;
|
|
45
|
+
const s = e.map((i) => {
|
|
46
|
+
if (!$.test(i) || t.has(Number(i)))
|
|
47
|
+
return null;
|
|
48
|
+
const d = Number(i);
|
|
49
|
+
return t.add(d), r = Math.max(r, d), d;
|
|
50
|
+
}), o = Number.isSafeInteger(n) && n > 0 && n < q ? n : 0;
|
|
51
|
+
let a = Math.max(c, r, o);
|
|
52
|
+
const u = s.map((i) => i === null), S = s.map((i) => i !== null ? i : (a += 1, a)), g = a > 0 && c !== a;
|
|
53
|
+
return { ids: S, reassigned: u, nextSeq: a, seqChanged: g, changed: g || u.includes(!0) };
|
|
54
|
+
}
|
|
55
|
+
function D(e) {
|
|
56
|
+
return e !== null && /^\d+$/.test(e) ? I(e) : 0;
|
|
57
|
+
}
|
|
58
|
+
function N(e, c, n) {
|
|
59
|
+
let t = "", r = 0;
|
|
60
|
+
return c.forEach((s, o) => {
|
|
61
|
+
const a = n[o] ?? null;
|
|
62
|
+
t += e.slice(r, s.index), t += a === null ? s.tag : M(s.tag, s.attrMatch, a), r = s.index + s.tag.length;
|
|
63
|
+
}), t + e.slice(r);
|
|
64
|
+
}
|
|
65
|
+
function P(e) {
|
|
66
|
+
return T(e).map((c) => c.rawValue);
|
|
67
|
+
}
|
|
68
|
+
function K(e, c) {
|
|
69
|
+
return N(e, T(e), c);
|
|
70
|
+
}
|
|
71
|
+
function O(e, c = 0) {
|
|
72
|
+
const n = T(e), t = C(n.map((s) => s.rawValue), b(e), c);
|
|
73
|
+
let r = N(
|
|
74
|
+
e,
|
|
75
|
+
n,
|
|
76
|
+
t.ids.map((s, o) => t.reassigned[o] ? s : null)
|
|
77
|
+
);
|
|
78
|
+
return t.seqChanged && (r = w(r, t.nextSeq)), { html: r, changed: t.changed, nextSeq: t.nextSeq };
|
|
49
79
|
}
|
|
50
80
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
81
|
+
l as TRACK_ID_ATTRIBUTE,
|
|
82
|
+
E as TRACK_SEQ_ATTRIBUTE,
|
|
83
|
+
O as assignTrackingIds,
|
|
84
|
+
D as parseTrackSeq,
|
|
85
|
+
C as planTrackingIds,
|
|
86
|
+
P as readAnchorTrackIds,
|
|
87
|
+
h as readTrackFloor,
|
|
88
|
+
b as readTrackSeq,
|
|
89
|
+
K as writeAnchorTrackIds
|
|
56
90
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
1
|
+
import { useActionsApi as x } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "../composables/useConfig.js";
|
|
3
|
+
import { useEditorTrackingIds as F } from "../composables/useEditorTrackingIds.js";
|
|
3
4
|
import { useHtmlCompiler as I } from "../composables/useHtmlCompiler.js";
|
|
4
5
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
6
|
import { toBlockUrlConfig as R } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
@@ -7,10 +8,9 @@ import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/con
|
|
|
7
8
|
import { parsePageList as U } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
9
|
import { useDynamicContentStore as L } from "../stores/dynamic-content.js";
|
|
9
10
|
import { useEditorStore as N } from "../stores/editor.js";
|
|
10
|
-
import { useUnsubscribeStore as
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
|
|
13
|
-
function O(n) {
|
|
11
|
+
import { useUnsubscribeStore as z } from "../stores/unsubscribe.js";
|
|
12
|
+
import { isPlainObject as v } from "./genericUtil.js";
|
|
13
|
+
function M(n) {
|
|
14
14
|
const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
|
|
15
15
|
return r.forEach((i) => {
|
|
16
16
|
const t = i.getAttribute(g.PAGE_LIST);
|
|
@@ -26,16 +26,16 @@ async function S(n) {
|
|
|
26
26
|
const i = e.getAttribute("recommendation-id"), t = i ? Number(i) : NaN;
|
|
27
27
|
if (!Number.isFinite(t))
|
|
28
28
|
return;
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
29
|
+
const c = e.getAttribute("esd-ext-config");
|
|
30
|
+
if (!c)
|
|
31
31
|
return;
|
|
32
32
|
let a;
|
|
33
33
|
try {
|
|
34
|
-
a = JSON.parse(
|
|
34
|
+
a = JSON.parse(c);
|
|
35
35
|
} catch {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
v(a) && r.seedBlockUrlConfig(t, R(a));
|
|
39
39
|
});
|
|
40
40
|
try {
|
|
41
41
|
await r.fetchRecommendationCreateData();
|
|
@@ -46,40 +46,37 @@ async function S(n) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
const n = L(),
|
|
49
|
+
const Y = () => {
|
|
50
|
+
const n = L(), s = N(), o = z(), { getCompiledEmail: r, getTemplateData: e } = x(), { writeTrackingIds: i } = F(), { compileHtml: t, compileAmpHtml: c } = I(), { isFeatureEnabled: a } = D();
|
|
51
51
|
return {
|
|
52
52
|
prepareTemplateDetails: async (h) => {
|
|
53
|
-
let { html:
|
|
54
|
-
if (a("linkTrackingIds"))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.error("Tracking-id step failed, saving anyway:", d);
|
|
60
|
-
}
|
|
61
|
-
const { html: T, ampHtml: p = "", ampErrors: A = [] } = await r({
|
|
53
|
+
let { html: m, css: p, syncModulesIds: u = [] } = h ?? await e();
|
|
54
|
+
if (a("linkTrackingIds")) {
|
|
55
|
+
const { changed: P, nextSeq: E } = i(s.trackIdSessionFloor);
|
|
56
|
+
s.trackIdSessionFloor = E, P && ({ html: m, css: p, syncModulesIds: u = [] } = await e());
|
|
57
|
+
}
|
|
58
|
+
const { html: T, ampHtml: d = "", ampErrors: w = [] } = await r({
|
|
62
59
|
minimize: !0,
|
|
63
60
|
resetDataSavedFlag: !1
|
|
64
61
|
});
|
|
65
|
-
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(
|
|
66
|
-
const { compiledHtml:
|
|
62
|
+
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(m);
|
|
63
|
+
const { compiledHtml: A, stats: l, appliedRules: y } = t(T), C = d && c(d).compiledHtml, k = n.getSelectedDynamicContentList, H = b(), f = M(m);
|
|
67
64
|
return console.debug("HTML Compilation Stats:", {
|
|
68
65
|
originalSize: l.originalSize,
|
|
69
66
|
compiledSize: l.compiledSize,
|
|
70
67
|
reduction: `${l.reductionPercentage.toFixed(2)}%`,
|
|
71
|
-
appliedRules:
|
|
68
|
+
appliedRules: y,
|
|
72
69
|
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
73
70
|
}), {
|
|
74
71
|
dynamicContentList: k,
|
|
75
|
-
compiledHtml:
|
|
76
|
-
rawHtml:
|
|
77
|
-
css:
|
|
78
|
-
ampHtml:
|
|
79
|
-
ampErrors:
|
|
80
|
-
modules:
|
|
72
|
+
compiledHtml: A,
|
|
73
|
+
rawHtml: m,
|
|
74
|
+
css: p,
|
|
75
|
+
ampHtml: C,
|
|
76
|
+
ampErrors: w,
|
|
77
|
+
modules: u.map(Number),
|
|
81
78
|
recommendation: {
|
|
82
|
-
campaignUrls:
|
|
79
|
+
campaignUrls: H.recommendationCampaignUrls,
|
|
83
80
|
configs: {}
|
|
84
81
|
},
|
|
85
82
|
unsubscribe: {
|
|
@@ -94,6 +91,6 @@ const Z = () => {
|
|
|
94
91
|
};
|
|
95
92
|
};
|
|
96
93
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
M as getHtmlReferencedUnsubscribePages,
|
|
95
|
+
Y as useTemplatePreparation
|
|
99
96
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.24.0-beta.
|
|
3
|
+
"version": "3.24.0-beta.d510b6c",
|
|
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",
|