@useinsider/guido 3.4.1-beta.5e1fcb5 → 3.4.2-beta.6886b92
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.
|
@@ -9,25 +9,25 @@ const o = [
|
|
|
9
9
|
getValue: (e) => e.currencySettings.value,
|
|
10
10
|
getAvailableOptions: (e) => e.currencyList.map((n) => n.text)
|
|
11
11
|
}
|
|
12
|
-
],
|
|
13
|
-
function
|
|
12
|
+
], l = "newsletter.recommendation-fill-required-fields";
|
|
13
|
+
function u(e, n) {
|
|
14
14
|
return o.filter((t) => {
|
|
15
15
|
var a;
|
|
16
16
|
if (t.condition && !t.condition(e))
|
|
17
17
|
return !1;
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
18
|
+
const i = t.getValue(e);
|
|
19
|
+
if (!i)
|
|
20
20
|
return !0;
|
|
21
|
-
const
|
|
22
|
-
return
|
|
21
|
+
const r = (a = t.getAvailableOptions) == null ? void 0 : a.call(t, n);
|
|
22
|
+
return r !== void 0 && !r.includes(i);
|
|
23
23
|
}).map((t) => t.key);
|
|
24
24
|
}
|
|
25
25
|
function s(e, n) {
|
|
26
|
-
return
|
|
26
|
+
return u(e, n).length === 0;
|
|
27
27
|
}
|
|
28
28
|
export {
|
|
29
29
|
o as REQUIRED_RECOMMENDATION_FIELDS,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
l as RecommendationRequiredFieldsKey,
|
|
31
|
+
u as getInvalidFields,
|
|
32
32
|
s as isConfigValid
|
|
33
33
|
};
|
|
@@ -1,87 +1,79 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
1
|
+
import { useActionsApi as T } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
import { DATA_ATTRIBUTES as
|
|
6
|
-
import { parsePageList as
|
|
7
|
-
import { useDynamicContentStore as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}),
|
|
5
|
+
import { DATA_ATTRIBUTES as y } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
7
|
+
import { useDynamicContentStore as D } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
|
|
9
|
+
function U(i, r) {
|
|
10
|
+
const s = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${y.PAGE_LIST}]`), c = [];
|
|
11
|
+
return s.forEach((t) => {
|
|
12
|
+
const o = t.getAttribute(y.PAGE_LIST);
|
|
13
|
+
o && c.push(...P(o));
|
|
14
|
+
}), r.filter((t) => c.includes(t));
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
function F(i) {
|
|
17
17
|
const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
18
18
|
if (m.length === 0)
|
|
19
19
|
return;
|
|
20
|
-
const
|
|
21
|
-
m.forEach((
|
|
22
|
-
var g, f, u, n,
|
|
23
|
-
const c =
|
|
24
|
-
if (!Number.isFinite(
|
|
20
|
+
const d = b();
|
|
21
|
+
m.forEach((s) => {
|
|
22
|
+
var g, f, u, n, S;
|
|
23
|
+
const c = s.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
|
|
24
|
+
if (!Number.isFinite(t))
|
|
25
25
|
return;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
26
|
+
const o = s.getAttribute("esd-ext-config");
|
|
27
|
+
if (!o)
|
|
28
28
|
return;
|
|
29
29
|
let e;
|
|
30
30
|
try {
|
|
31
|
-
e = JSON.parse(
|
|
31
|
+
e = JSON.parse(o);
|
|
32
32
|
} catch {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
36
36
|
return;
|
|
37
37
|
const p = {
|
|
38
|
-
strategy: e.strategy ??
|
|
39
|
-
language: e.language ??
|
|
40
|
-
size: e.size ??
|
|
38
|
+
strategy: e.strategy ?? a.strategy,
|
|
39
|
+
language: e.language ?? a.language,
|
|
40
|
+
size: e.size ?? a.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: ((g = e.currency) == null ? void 0 : g.code) ??
|
|
47
|
-
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ??
|
|
48
|
-
currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ??
|
|
49
|
-
currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ??
|
|
50
|
-
currencyThousandSeparator: ((
|
|
43
|
+
productIds: e.productIds ?? [...a.productIds],
|
|
44
|
+
filters: e.filters ?? [...a.filters],
|
|
45
|
+
shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
|
|
46
|
+
currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? l.code,
|
|
47
|
+
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? l.alignment,
|
|
48
|
+
currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? l.decimalCount,
|
|
49
|
+
currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? l.decimalSeparator,
|
|
50
|
+
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? l.thousandSeparator
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
d.seedBlockUrlConfig(t, p);
|
|
53
53
|
});
|
|
54
|
-
try {
|
|
55
|
-
await l.fetchRecommendationCreateData();
|
|
56
|
-
} catch (t) {
|
|
57
|
-
console.warn(
|
|
58
|
-
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
59
|
-
t
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
54
|
}
|
|
63
55
|
const _ = () => {
|
|
64
|
-
const i =
|
|
56
|
+
const i = D(), r = E(), { getCompiledEmail: m, getTemplateData: d } = T(), { compileHtml: s } = C();
|
|
65
57
|
return {
|
|
66
58
|
prepareTemplateDetails: async () => {
|
|
67
|
-
const { html:
|
|
59
|
+
const { html: t, ampHtml: o = "", ampErrors: e = [] } = await m({
|
|
68
60
|
minimize: !0,
|
|
69
61
|
resetDataSavedFlag: !1
|
|
70
|
-
}), { html: p, css: g, syncModulesIds: f = [] } = await
|
|
71
|
-
|
|
72
|
-
const { compiledHtml: u, stats: n, appliedRules:
|
|
62
|
+
}), { html: p, css: g, syncModulesIds: f = [] } = await d();
|
|
63
|
+
r.selectedUnsubscribePages.length && await r.fetchTemplates(), F(p);
|
|
64
|
+
const { compiledHtml: u, stats: n, appliedRules: S } = s(t), h = i.getSelectedDynamicContentList, A = b();
|
|
73
65
|
return console.debug("HTML Compilation Stats:", {
|
|
74
66
|
originalSize: n.originalSize,
|
|
75
67
|
compiledSize: n.compiledSize,
|
|
76
68
|
reduction: `${n.reductionPercentage.toFixed(2)}%`,
|
|
77
|
-
appliedRules:
|
|
69
|
+
appliedRules: S,
|
|
78
70
|
executionTime: `${n.executionTime.toFixed(2)}ms`
|
|
79
71
|
}), {
|
|
80
72
|
dynamicContentList: h,
|
|
81
73
|
compiledHtml: u,
|
|
82
74
|
rawHtml: p,
|
|
83
75
|
css: g,
|
|
84
|
-
ampHtml:
|
|
76
|
+
ampHtml: o,
|
|
85
77
|
ampErrors: e,
|
|
86
78
|
modules: f.map(Number),
|
|
87
79
|
recommendation: {
|
|
@@ -89,8 +81,8 @@ const _ = () => {
|
|
|
89
81
|
configs: {}
|
|
90
82
|
},
|
|
91
83
|
unsubscribe: {
|
|
92
|
-
status:
|
|
93
|
-
config:
|
|
84
|
+
status: r.unsubscribePagesStatus,
|
|
85
|
+
config: U(u, r.selectedUnsubscribePages)
|
|
94
86
|
}
|
|
95
87
|
};
|
|
96
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2-beta.6886b92",
|
|
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",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|