@useinsider/guido 3.6.0-beta.804c9cb → 3.6.0-beta.8307d2e
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 +15 -16
- package/dist/composables/useHtmlCompiler.js +22 -40
- package/dist/composables/useSave.js +17 -16
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +32 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +13 -13
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +4 -3
- package/dist/src/composables/useHtmlCompiler.d.ts +0 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +3 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/utils/templatePreparation.js +53 -53
- package/package.json +1 -1
- package/dist/src/utils/ampErrorFilter.d.ts +0 -2
- package/dist/utils/ampErrorFilter.js +0 -8
- /package/dist/src/{utils/ampErrorFilter.test.d.ts → composables/validators/useUnsubscribeBlockValidator.test.d.ts} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const { handleError: n } = A(), s = (t = {}) => new Promise((e, a) => {
|
|
1
|
+
import { useToaster as w } from "./useToaster.js";
|
|
2
|
+
const v = () => {
|
|
3
|
+
const { handleError: n } = w(), m = (t = {}) => new Promise((e, a) => {
|
|
5
4
|
const o = { ...{
|
|
6
5
|
minimize: !0,
|
|
7
6
|
utmEntity: {
|
|
@@ -21,29 +20,29 @@ const D = () => {
|
|
|
21
20
|
forceAmp: !1,
|
|
22
21
|
resetDataSavedFlag: !1,
|
|
23
22
|
disableLineHeightsReplace: !0
|
|
24
|
-
}, ...t },
|
|
25
|
-
callback: (
|
|
26
|
-
|
|
23
|
+
}, ...t }, s = {
|
|
24
|
+
callback: (l, p, d, c, u) => {
|
|
25
|
+
l ? a(l) : e({
|
|
27
26
|
html: p,
|
|
28
27
|
ampHtml: d,
|
|
29
|
-
ampErrors:
|
|
28
|
+
ampErrors: c,
|
|
30
29
|
displayConditions: u
|
|
31
30
|
});
|
|
32
31
|
},
|
|
33
32
|
...o
|
|
34
33
|
};
|
|
35
|
-
window.StripoEditorApi.actionsApi.compileEmail(
|
|
34
|
+
window.StripoEditorApi.actionsApi.compileEmail(s);
|
|
36
35
|
});
|
|
37
36
|
return {
|
|
38
|
-
getCompiledEmail:
|
|
37
|
+
getCompiledEmail: m,
|
|
39
38
|
getTemplateData: () => new Promise((t) => {
|
|
40
|
-
const e = ({ html: a, css: i, width: o, height:
|
|
39
|
+
const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
|
|
41
40
|
html: a,
|
|
42
41
|
css: i,
|
|
43
42
|
width: o,
|
|
44
|
-
height:
|
|
45
|
-
utmParams:
|
|
46
|
-
syncModulesIds:
|
|
43
|
+
height: r,
|
|
44
|
+
utmParams: s,
|
|
45
|
+
syncModulesIds: l
|
|
47
46
|
});
|
|
48
47
|
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
49
48
|
}),
|
|
@@ -57,7 +56,7 @@ const D = () => {
|
|
|
57
56
|
displayConditions: a,
|
|
58
57
|
ampHtml: i = "",
|
|
59
58
|
ampErrors: o = []
|
|
60
|
-
} = await
|
|
59
|
+
} = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
61
60
|
return {
|
|
62
61
|
html: e,
|
|
63
62
|
ampHtml: i,
|
|
@@ -102,5 +101,5 @@ const D = () => {
|
|
|
102
101
|
};
|
|
103
102
|
};
|
|
104
103
|
export {
|
|
105
|
-
|
|
104
|
+
v as useActionsApi
|
|
106
105
|
};
|
|
@@ -1,48 +1,30 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { liquidCompilerRules as
|
|
4
|
-
import { outlookCompilerRules as
|
|
5
|
-
import { recommendationCompilerRules as
|
|
6
|
-
import { socialCompilerRules as
|
|
7
|
-
import { unsubscribeCompilerRules as
|
|
8
|
-
import { createHtmlCompiler as
|
|
9
|
-
import { useConfig as
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"fix-tags-end",
|
|
16
|
-
// Image domain corrections — plain string replacement.
|
|
17
|
-
"replace-old-image-domain",
|
|
18
|
-
"replace-old-v2-image-domain",
|
|
19
|
-
// Unsubscribe domain — the actual fix: injects the real unsubscribe href in
|
|
20
|
-
// place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
|
|
21
|
-
// unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
|
|
22
|
-
"add-unsubscribe-link-values",
|
|
23
|
-
"remove-data-ogsb-button-styles",
|
|
24
|
-
"format-comment-braces",
|
|
25
|
-
"add-universal-link-flags",
|
|
26
|
-
// Coupon placeholder replacement (only present when liquidSyntax is enabled).
|
|
27
|
-
"liquid-coupon-code"
|
|
28
|
-
]), M = () => {
|
|
29
|
-
var m, t, r;
|
|
30
|
-
const { compiler: e, isFeatureEnabled: a, partner: n } = k(), u = ((m = e.value) == null ? void 0 : m.customRules) || [], l = [
|
|
31
|
-
...!!((t = e.value) != null && t.ignoreDefaultRules) ? [] : R,
|
|
32
|
-
...v,
|
|
33
|
-
...x,
|
|
1
|
+
import { defaultHtmlCompilerRules as c } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as R } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
|
|
5
|
+
import { recommendationCompilerRules as d } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
|
+
import { socialCompilerRules as b } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
+
import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { useConfig as v } from "./useConfig.js";
|
|
10
|
+
const w = () => {
|
|
11
|
+
var l, m, r;
|
|
12
|
+
const { compiler: e, isFeatureEnabled: t, partner: i } = v(), s = ((l = e.value) == null ? void 0 : l.customRules) || [], u = [
|
|
13
|
+
...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : c,
|
|
14
|
+
...d,
|
|
34
15
|
...g,
|
|
16
|
+
...f,
|
|
17
|
+
...C,
|
|
35
18
|
...b,
|
|
36
|
-
...
|
|
37
|
-
...a
|
|
38
|
-
...u.map((o, f) => ({
|
|
19
|
+
...t("liquidSyntax") ? R : [],
|
|
20
|
+
...s.map((o, a) => ({
|
|
39
21
|
...o,
|
|
40
|
-
priority: o.priority + 1e3 +
|
|
22
|
+
priority: o.priority + 1e3 + a
|
|
41
23
|
// Ensure additional rules run after default rules
|
|
42
24
|
}))
|
|
43
|
-
], p =
|
|
44
|
-
return { compileHtml: (o) => p.compile(o, void 0,
|
|
25
|
+
], p = H(u), n = (r = i.value) == null ? void 0 : r.fallbackFont;
|
|
26
|
+
return { compileHtml: (o) => p.compile(o, void 0, n) };
|
|
45
27
|
};
|
|
46
28
|
export {
|
|
47
|
-
|
|
29
|
+
w as useHtmlCompiler
|
|
48
30
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { useActionsApi as x } from "./useActionsApi.js";
|
|
2
2
|
import { useConfig as y } from "./useConfig.js";
|
|
3
|
-
import { useSaveStart as w, useSaveComplete as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
3
|
+
import { useSaveStart as w, useSaveComplete as H } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as C } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as k } from "./useHtmlValidator.js";
|
|
8
8
|
import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
|
|
9
9
|
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { useUnsubscribeBlockValidator as B } from "./validators/useUnsubscribeBlockValidator.js";
|
|
11
|
+
const J = () => {
|
|
12
|
+
const o = w(), s = H(), { validateHtml: r } = k(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { validateUnsubscribeBlockUniqueness: d } = B(), { callbacks: i, isFeatureEnabled: u } = y(), { extractSyncModuleData: c } = q(), { setSyncModuleUnsubscriptionPages: m } = C(), { editorSave: p } = x();
|
|
13
|
+
return { save: async (f = !1, v = !1) => {
|
|
14
|
+
var a;
|
|
14
15
|
o();
|
|
15
|
-
const { prepareTemplateDetails:
|
|
16
|
-
if (!l(t.compiledHtml))
|
|
16
|
+
const { prepareTemplateDetails: S } = E(), t = await S();
|
|
17
|
+
if (!l(t.compiledHtml) || !d(t.compiledHtml))
|
|
17
18
|
return;
|
|
18
|
-
if (
|
|
19
|
+
if (u("liquidSyntax")) {
|
|
19
20
|
if (!await n(t.compiledHtml))
|
|
20
21
|
return;
|
|
21
22
|
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
22
23
|
return;
|
|
23
|
-
if ((
|
|
24
|
+
if ((a = i.value) != null && a.externalValidation && !await i.value.externalValidation(t) || !await p())
|
|
24
25
|
return;
|
|
25
|
-
const { unsubscribePayload:
|
|
26
|
-
return await
|
|
26
|
+
const { unsubscribePayload: V, stripoModules: b } = c(t.rawHtml);
|
|
27
|
+
return await m(V), t.modules = b, f || s({ ...t, silent: v }), t;
|
|
27
28
|
} };
|
|
28
29
|
};
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
J as useSave
|
|
31
32
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ToasterTypeOptions as i } from "../../enums/toaster.js";
|
|
2
|
+
import { PAGE_TYPES as n } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as u, DATA_ATTRIBUTES as l } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
+
import { useToaster as T } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as E } from "../useTranslations.js";
|
|
6
|
+
const m = [
|
|
7
|
+
{
|
|
8
|
+
pageType: n.GLOBAL_UNSUBSCRIBE,
|
|
9
|
+
messageKey: "unsubscription-preference.duplicate-global-unsub"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
pageType: n.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
13
|
+
messageKey: "unsubscription-preference.duplicate-pref-center"
|
|
14
|
+
}
|
|
15
|
+
], g = "unsubscription-preference.duplicate-both", y = () => {
|
|
16
|
+
const { showToaster: o } = T(), a = E();
|
|
17
|
+
return { validateUnsubscribeBlockUniqueness: (c) => {
|
|
18
|
+
const p = new DOMParser().parseFromString(c, "text/html"), t = /* @__PURE__ */ new Map();
|
|
19
|
+
p.querySelectorAll(u).forEach((e) => {
|
|
20
|
+
const r = Number(e.getAttribute(l.PAGE_TYPE));
|
|
21
|
+
t.set(r, (t.get(r) ?? 0) + 1);
|
|
22
|
+
});
|
|
23
|
+
const s = m.filter((e) => (t.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
|
|
24
|
+
return s.length ? (o({
|
|
25
|
+
type: i.Alert,
|
|
26
|
+
message: a(s.length > 1 ? g : s[0])
|
|
27
|
+
}), !1) : !0;
|
|
28
|
+
} };
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
y as useUnsubscribeBlockValidator
|
|
32
|
+
};
|
|
@@ -5,11 +5,11 @@ import { useToaster as B } from "../../../composables/useToaster.js";
|
|
|
5
5
|
import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
|
|
6
6
|
import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
|
|
7
7
|
import { useUnsubscribeStore as a } from "../../../stores/unsubscribe.js";
|
|
8
|
-
import { Block as L, BlockCompositionType as f, ContextActionType as h, ModificationDescription as b, BlockType as
|
|
9
|
-
import { getDefaultTemplate as
|
|
10
|
-
import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
|
|
11
|
-
import { parsePageList as
|
|
12
|
-
const y = "unsubscribe-block",
|
|
8
|
+
import { Block as L, BlockCompositionType as f, ContextActionType as h, ModificationDescription as b, BlockType as A } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
9
|
+
import { getDefaultTemplate as v } from "./template.js";
|
|
10
|
+
import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_BLOCK_SELECTOR as p, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
|
|
11
|
+
import { parsePageList as m } from "./utils/utils.js";
|
|
12
|
+
const y = "unsubscribe-block", _ = 'a[data-unsubscribe-link="true"]', I = "{{ins-unsubscribe-link}}", T = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", C = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", N = {
|
|
13
13
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
14
14
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
15
15
|
};
|
|
@@ -42,7 +42,7 @@ class F extends L {
|
|
|
42
42
|
return this.api.translate("Unsubscribe Block Description");
|
|
43
43
|
}
|
|
44
44
|
getTemplate() {
|
|
45
|
-
return
|
|
45
|
+
return v();
|
|
46
46
|
}
|
|
47
47
|
getContextActionsIds() {
|
|
48
48
|
return [h.MOVE, h.REMOVE];
|
|
@@ -68,7 +68,7 @@ class F extends L {
|
|
|
68
68
|
this._removeEventListeners(), this.currentNode = void 0, this.linkStateByBlockId.clear();
|
|
69
69
|
}
|
|
70
70
|
_hasUnsubscribeLink(e) {
|
|
71
|
-
return "querySelector" in e ? !!e.querySelector(
|
|
71
|
+
return "querySelector" in e ? !!e.querySelector(_) : !1;
|
|
72
72
|
}
|
|
73
73
|
_readBlockId(e) {
|
|
74
74
|
return "getAttribute" in e ? e.getAttribute(i.BLOCK_ID) : null;
|
|
@@ -102,7 +102,7 @@ class F extends L {
|
|
|
102
102
|
let e = 0;
|
|
103
103
|
try {
|
|
104
104
|
const t = this.api.getDocumentRoot();
|
|
105
|
-
t && "querySelectorAll" in t && t.querySelectorAll(
|
|
105
|
+
t && "querySelectorAll" in t && t.querySelectorAll(p).forEach((s) => {
|
|
106
106
|
if ("getAttribute" in s) {
|
|
107
107
|
const o = s.getAttribute(i.BLOCK_ID), u = o ? parseInt(o) : 0;
|
|
108
108
|
u > e && (e = u);
|
|
@@ -150,7 +150,7 @@ class F extends L {
|
|
|
150
150
|
try {
|
|
151
151
|
if (!this.currentNode)
|
|
152
152
|
return;
|
|
153
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${
|
|
153
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${A.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
|
|
154
154
|
} catch (e) {
|
|
155
155
|
console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
|
|
156
156
|
}
|
|
@@ -161,7 +161,7 @@ class F extends L {
|
|
|
161
161
|
_updateBlock(e, t) {
|
|
162
162
|
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
163
163
|
return;
|
|
164
|
-
const r = this.currentNode.querySelector(
|
|
164
|
+
const r = this.currentNode.querySelector(_);
|
|
165
165
|
if (!r)
|
|
166
166
|
return;
|
|
167
167
|
const s = this._getMergeTag(e);
|
|
@@ -181,7 +181,7 @@ class F extends L {
|
|
|
181
181
|
}
|
|
182
182
|
_checkExistingBlocks() {
|
|
183
183
|
const e = a();
|
|
184
|
-
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(
|
|
184
|
+
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(p).forEach((r) => {
|
|
185
185
|
if ("getAttribute" in r) {
|
|
186
186
|
const s = r.getAttribute(i.PAGE_TYPE);
|
|
187
187
|
if (s) {
|
|
@@ -197,7 +197,7 @@ class F extends L {
|
|
|
197
197
|
const t = e.getAttribute(i.PAGE_TYPE), r = e.getAttribute(i.PAGE_LIST);
|
|
198
198
|
if (!t || !r)
|
|
199
199
|
return;
|
|
200
|
-
const s = a(), o = Number(t), u =
|
|
200
|
+
const s = a(), o = Number(t), u = m(r);
|
|
201
201
|
await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(o), s.loadSelectedTemplates(u);
|
|
202
202
|
}
|
|
203
203
|
_resetStoreState() {
|
|
@@ -209,7 +209,7 @@ class F extends L {
|
|
|
209
209
|
const t = e.getAttribute(i.PAGE_LIST);
|
|
210
210
|
if (!t)
|
|
211
211
|
return;
|
|
212
|
-
const r = a(), s =
|
|
212
|
+
const r = a(), s = m(t);
|
|
213
213
|
r.removeUnsubscribePages(s);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
const s = {
|
|
2
2
|
SELECT: "unsubscribe:select",
|
|
3
3
|
CANCEL: "unsubscribe:cancel"
|
|
4
|
-
},
|
|
4
|
+
}, b = {
|
|
5
5
|
PAGE_TYPE: "data-unsubscribe-page-type",
|
|
6
6
|
PAGE_LIST: "data-unsubscribe-page-list",
|
|
7
7
|
BLOCK_ID: "data-unsubscribe-block-id"
|
|
8
|
-
};
|
|
8
|
+
}, c = ".unsubscribe-block-v2";
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
b as DATA_ATTRIBUTES,
|
|
11
|
+
c as UNSUBSCRIBE_BLOCK_SELECTOR,
|
|
11
12
|
s as UNSUBSCRIBE_EVENTS
|
|
12
13
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
1
|
+
import { useActionsApi as C } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as T } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
5
|
import { DATA_ATTRIBUTES as S } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
-
import { parsePageList as
|
|
7
|
-
import { useDynamicContentStore as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
function
|
|
10
|
-
const t = new DOMParser().parseFromString(
|
|
11
|
-
return t.forEach((
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}),
|
|
6
|
+
import { parsePageList as D } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
7
|
+
import { useDynamicContentStore as P } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
|
|
9
|
+
function E(i, o) {
|
|
10
|
+
const t = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), c = [];
|
|
11
|
+
return t.forEach((r) => {
|
|
12
|
+
const a = r.getAttribute(S.PAGE_LIST);
|
|
13
|
+
a && c.push(...D(a));
|
|
14
|
+
}), o.filter((r) => c.includes(r));
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
17
|
-
const m = new DOMParser().parseFromString(
|
|
16
|
+
async function U(i) {
|
|
17
|
+
const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
18
18
|
if (m.length === 0)
|
|
19
19
|
return;
|
|
20
20
|
const l = b();
|
|
21
21
|
m.forEach((t) => {
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
if (!Number.isFinite(
|
|
22
|
+
var g, f, u, n, y;
|
|
23
|
+
const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
|
|
24
|
+
if (!Number.isFinite(r))
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const a = t.getAttribute("esd-ext-config");
|
|
27
|
+
if (!a)
|
|
28
28
|
return;
|
|
29
29
|
let e;
|
|
30
30
|
try {
|
|
31
|
-
e = JSON.parse(
|
|
31
|
+
e = JSON.parse(a);
|
|
32
32
|
} catch {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
38
|
-
strategy: e.strategy ??
|
|
39
|
-
language: e.language ??
|
|
40
|
-
size: e.size ??
|
|
37
|
+
const p = {
|
|
38
|
+
strategy: e.strategy ?? s.strategy,
|
|
39
|
+
language: e.language ?? s.language,
|
|
40
|
+
size: e.size ?? s.size,
|
|
41
41
|
// Spread the default arrays so each block gets a fresh reference
|
|
42
42
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
43
|
-
productIds: e.productIds ?? [...
|
|
44
|
-
filters: e.filters ?? [...
|
|
45
|
-
shuffleProducts: e.shuffleProducts ??
|
|
46
|
-
currencyCode: ((
|
|
47
|
-
currencyAlignment: ((
|
|
48
|
-
currencyDecimalCount: ((
|
|
49
|
-
currencyDecimalSeparator: ((
|
|
50
|
-
currencyThousandSeparator: ((
|
|
43
|
+
productIds: e.productIds ?? [...s.productIds],
|
|
44
|
+
filters: e.filters ?? [...s.filters],
|
|
45
|
+
shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
|
|
46
|
+
currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
|
|
47
|
+
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
|
|
48
|
+
currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? d.decimalCount,
|
|
49
|
+
currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? d.decimalSeparator,
|
|
50
|
+
currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? d.thousandSeparator
|
|
51
51
|
};
|
|
52
|
-
l.seedBlockUrlConfig(
|
|
52
|
+
l.seedBlockUrlConfig(r, p);
|
|
53
53
|
});
|
|
54
54
|
try {
|
|
55
55
|
await l.fetchRecommendationCreateData();
|
|
@@ -60,42 +60,42 @@ async function F(s) {
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
const
|
|
63
|
+
const _ = () => {
|
|
64
|
+
const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
|
|
65
65
|
return {
|
|
66
66
|
prepareTemplateDetails: async () => {
|
|
67
|
-
const { html:
|
|
67
|
+
const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
|
|
68
68
|
minimize: !0,
|
|
69
69
|
resetDataSavedFlag: !1
|
|
70
|
-
}), { html:
|
|
71
|
-
|
|
72
|
-
const { compiledHtml:
|
|
70
|
+
}), { html: p, css: g, syncModulesIds: f = [] } = await l();
|
|
71
|
+
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await U(p);
|
|
72
|
+
const { compiledHtml: u, stats: n, appliedRules: y } = t(r), h = i.getSelectedDynamicContentList, A = b();
|
|
73
73
|
return console.debug("HTML Compilation Stats:", {
|
|
74
|
-
originalSize:
|
|
75
|
-
compiledSize:
|
|
76
|
-
reduction: `${
|
|
77
|
-
appliedRules:
|
|
78
|
-
executionTime: `${
|
|
74
|
+
originalSize: n.originalSize,
|
|
75
|
+
compiledSize: n.compiledSize,
|
|
76
|
+
reduction: `${n.reductionPercentage.toFixed(2)}%`,
|
|
77
|
+
appliedRules: y,
|
|
78
|
+
executionTime: `${n.executionTime.toFixed(2)}ms`
|
|
79
79
|
}), {
|
|
80
|
-
dynamicContentList:
|
|
81
|
-
compiledHtml:
|
|
82
|
-
rawHtml:
|
|
80
|
+
dynamicContentList: h,
|
|
81
|
+
compiledHtml: u,
|
|
82
|
+
rawHtml: p,
|
|
83
83
|
css: g,
|
|
84
|
-
ampHtml:
|
|
85
|
-
ampErrors:
|
|
84
|
+
ampHtml: a,
|
|
85
|
+
ampErrors: e,
|
|
86
86
|
modules: f.map(Number),
|
|
87
87
|
recommendation: {
|
|
88
|
-
campaignUrls:
|
|
88
|
+
campaignUrls: A.recommendationCampaignUrls,
|
|
89
89
|
configs: {}
|
|
90
90
|
},
|
|
91
91
|
unsubscribe: {
|
|
92
|
-
status:
|
|
93
|
-
config:
|
|
92
|
+
status: o.unsubscribePagesStatus,
|
|
93
|
+
config: E(u, o.selectedUnsubscribePages)
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
export {
|
|
100
|
-
|
|
100
|
+
_ as useTemplatePreparation
|
|
101
101
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.8307d2e",
|
|
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",
|
|
File without changes
|