@useinsider/guido 3.21.2-beta.b6f3ef8 → 3.21.2-beta.c321b5c
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/README.md +4 -34
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +108 -118
- package/dist/composables/useSave.js +75 -68
- package/dist/composables/useStripo.js +82 -94
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/guido.css +1 -1
- package/dist/library.js +10 -12
- package/dist/package.json.js +4 -6
- package/dist/services/templateLibraryApi.js +36 -31
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/library.d.ts +0 -1
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/utils/pairProductVariables.js +98 -90
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +1 -6
- package/dist/composables/useEditorOpenMetrics.js +0 -164
- package/dist/public/prefetchRuntime.js +0 -4
- package/dist/src/composables/useEditorOpenMetrics.d.ts +0 -27
- package/dist/src/public/prefetchRuntime.d.ts +0 -1
- package/dist/src/utils/runtimePrefetch.d.ts +0 -4
- package/dist/src/utils/stripoRuntime.d.ts +0 -2
- package/dist/static/stripo-runtime-manifest.json.js +0 -9
- package/dist/utils/runtimePrefetch.js +0 -26
- package/dist/utils/stripoRuntime.js +0 -9
|
@@ -1,100 +1,108 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
3
|
-
import { escapeReplacement as
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as M } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
|
+
import { escapeReplacement as B } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
+
import { preserveTextStyles as L } from "./preserveTextStyles.js";
|
|
5
|
+
import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
|
|
6
|
+
const q = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
10
|
+
}, W = ($) => $.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function v($, C, A) {
|
|
12
|
+
let d = C;
|
|
13
|
+
for (; d > 0 && /\s/.test($[d - 1]); )
|
|
14
|
+
d -= 1;
|
|
15
|
+
return A.some((E) => $.endsWith(E, d));
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
|
|
18
|
+
function Q($, C) {
|
|
19
|
+
var d;
|
|
20
|
+
const A = $.ownerDocument.createTreeWalker($, NodeFilter.SHOW_COMMENT);
|
|
21
|
+
for (let E = A.nextNode(); E; E = A.nextNode())
|
|
22
|
+
(d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(j, (k, P) => `${P}href="${C}"`));
|
|
23
|
+
}
|
|
24
|
+
function et($) {
|
|
25
|
+
const C = W($), A = new DOMParser().parseFromString(C, "text/html");
|
|
26
|
+
X(A);
|
|
27
|
+
const d = M.PAIRS_FOR_EXTENSION;
|
|
28
|
+
Object.entries(d).forEach(([o, p]) => {
|
|
29
|
+
A.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
30
|
+
const _ = r.getAttribute("data-number") || "1", y = r.getAttribute("data-type") || "CART_ITEMS";
|
|
31
|
+
r.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
|
|
32
|
+
var S, I, O, x;
|
|
33
|
+
const m = t.getAttribute("data-type") || y, n = t.getAttribute("data-number") || _, f = p[m];
|
|
27
34
|
if (f)
|
|
28
|
-
switch (
|
|
35
|
+
switch (o) {
|
|
29
36
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
37
|
+
let e = null, s = null;
|
|
38
|
+
if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
|
|
32
39
|
break;
|
|
33
40
|
const l = f.DEFAULT, c = f.ATTR;
|
|
34
41
|
if (l && e.src) {
|
|
35
|
-
const
|
|
36
|
-
l.some((
|
|
37
|
-
const u =
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${c}_${
|
|
42
|
+
const a = e.src;
|
|
43
|
+
l.some((g) => {
|
|
44
|
+
const u = g.split("/").pop() || "", H = a.split("/").pop() || "";
|
|
45
|
+
return a.includes(g) || a.includes(u) || H === u;
|
|
46
|
+
}) && (e.src = `{{${c}_${n}}}`);
|
|
40
47
|
}
|
|
41
|
-
const i = (
|
|
42
|
-
if (i && e.setAttribute("alt", `{{${i}_${
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(
|
|
48
|
+
const i = (I = (S = d.name) == null ? void 0 : S[m]) == null ? void 0 : I.ATTR;
|
|
49
|
+
if (i && e.setAttribute("alt", `{{${i}_${n}}}`), s) {
|
|
50
|
+
const a = (O = d.itemLink) == null ? void 0 : O[m];
|
|
51
|
+
if (a) {
|
|
52
|
+
const b = a.HREF, g = a.DEFAULT_HREF || "#!", u = s.href;
|
|
53
|
+
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(g) || u === `${window.location.href}${g}` || !u || u === window.location.href) && (s.href = `{{${b}_${n}}}`);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
break;
|
|
50
57
|
}
|
|
51
58
|
case "name": {
|
|
52
|
-
const e = f,
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
59
|
+
const e = f, s = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
|
|
60
|
+
t.textContent && (t.innerHTML = L(t, `{{${s}_${n}}}`));
|
|
54
61
|
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
62
|
if (i && c) {
|
|
56
|
-
const
|
|
57
|
-
(
|
|
63
|
+
const a = i.href, b = `${window.location.href}${l}`;
|
|
64
|
+
(a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
|
|
58
65
|
}
|
|
59
66
|
break;
|
|
60
67
|
}
|
|
61
68
|
case "price":
|
|
62
69
|
case "originalPrice": {
|
|
63
|
-
const e = f,
|
|
64
|
-
let
|
|
65
|
-
i ?
|
|
66
|
-
const
|
|
67
|
-
let u = `{{${
|
|
68
|
-
const H = (t.getAttribute(
|
|
69
|
-
let
|
|
70
|
-
G ?
|
|
70
|
+
const e = f, s = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = s === "true", i = l === "true", a = t.getAttribute(U.POSITION) || "before";
|
|
71
|
+
let b;
|
|
72
|
+
i ? b = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : b = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
73
|
+
const g = e.CURRENCY;
|
|
74
|
+
let u = `{{${b}_${n}}}`;
|
|
75
|
+
const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
|
|
76
|
+
let F = "";
|
|
77
|
+
G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
|
|
71
78
|
break;
|
|
72
79
|
}
|
|
73
80
|
case "quantity": {
|
|
74
|
-
const e = f,
|
|
75
|
-
c && l.includes(c) && (t.innerHTML =
|
|
81
|
+
const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (x = t.textContent) == null ? void 0 : x.trim();
|
|
82
|
+
c && l.includes(c) && (t.innerHTML = L(t, `{{${s}_${n}}}`));
|
|
76
83
|
break;
|
|
77
84
|
}
|
|
78
85
|
case "button": {
|
|
79
|
-
const e = f,
|
|
86
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
87
|
if (c) {
|
|
81
|
-
const i = c.href || "",
|
|
82
|
-
(i === "" || i === "#" || i ===
|
|
88
|
+
const i = c.href || "", a = `${window.location.href}${l}`;
|
|
89
|
+
(i === "" || i === "#" || i === a || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${s}_${n}}}`);
|
|
83
90
|
}
|
|
91
|
+
Q(t, `{{${s}_${n}}}`);
|
|
84
92
|
break;
|
|
85
93
|
}
|
|
86
94
|
case "itemLink": {
|
|
87
|
-
const e = f,
|
|
95
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
96
|
if (c.href) {
|
|
89
|
-
const i = c.href,
|
|
90
|
-
(i ===
|
|
97
|
+
const i = c.href, a = `${window.location.href}${l}`;
|
|
98
|
+
(i === a || i.endsWith(l)) && (c.href = `{{${s}_${n}}}`);
|
|
91
99
|
}
|
|
92
100
|
break;
|
|
93
101
|
}
|
|
94
102
|
default: {
|
|
95
103
|
if ("ATTR" in f) {
|
|
96
104
|
const e = f.ATTR;
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
105
|
+
t.textContent && (t.innerHTML = L(t, `{{${e}_${n}}}`));
|
|
98
106
|
}
|
|
99
107
|
break;
|
|
100
108
|
}
|
|
@@ -102,49 +110,49 @@ function Z(S) {
|
|
|
102
110
|
});
|
|
103
111
|
});
|
|
104
112
|
});
|
|
105
|
-
const
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
element:
|
|
113
|
+
const E = C.match(/<!DOCTYPE[^>]*>/i), k = E ? `${E[0]}
|
|
114
|
+
` : "", P = A.querySelectorAll(".ins-product-td"), N = [];
|
|
115
|
+
P.forEach((o) => {
|
|
116
|
+
const p = o.getAttribute("data-type") || "CART_ITEMS", T = o.getAttribute("data-number") || "1", r = o.outerHTML;
|
|
117
|
+
N.push({
|
|
118
|
+
element: o,
|
|
111
119
|
outerHtml: r,
|
|
112
|
-
type:
|
|
113
|
-
number:
|
|
120
|
+
type: p,
|
|
121
|
+
number: T
|
|
114
122
|
});
|
|
115
123
|
});
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
const r =
|
|
119
|
-
if (
|
|
120
|
-
const
|
|
121
|
-
|
|
124
|
+
let h = k + A.documentElement.outerHTML;
|
|
125
|
+
N.reverse().forEach(({ outerHtml: o, type: p, number: T }) => {
|
|
126
|
+
const r = q[p], _ = r ? `${r}_total_product_kind` : "";
|
|
127
|
+
if (_) {
|
|
128
|
+
const R = parseInt(T) - 1, n = `${`{% if ${_} > ${R} %}`}${o}{% endif %}`;
|
|
129
|
+
h = h.replace(o, B(n));
|
|
122
130
|
}
|
|
123
131
|
});
|
|
124
|
-
const V =
|
|
125
|
-
return V.forEach((
|
|
132
|
+
const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set();
|
|
133
|
+
return V.forEach((o) => {
|
|
126
134
|
var t;
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
135
|
+
const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
|
|
136
|
+
if (!p || !q[T])
|
|
129
137
|
return;
|
|
130
|
-
const r =
|
|
131
|
-
if (!r ||
|
|
138
|
+
const r = o.closest(".product-original-price-class");
|
|
139
|
+
if (!r || D.has(r))
|
|
132
140
|
return;
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}),
|
|
137
|
-
if (r.includes("{% if") || !
|
|
141
|
+
D.add(r);
|
|
142
|
+
const _ = r.outerHTML, y = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), R = w.get(_) ?? { number: p, type: T, wrap: [] };
|
|
143
|
+
R.wrap.push(y !== "false"), w.set(_, R);
|
|
144
|
+
}), w.forEach(({ number: o, type: p, wrap: T }, r) => {
|
|
145
|
+
if (r.includes("{% if") || !T.some(Boolean))
|
|
138
146
|
return;
|
|
139
|
-
const
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
147
|
+
const _ = M.PAIRS_FOR_EXTENSION.price[p].PRICE, y = M.PAIRS_FOR_EXTENSION.originalPrice[p].PRICE, R = `{% if ${_}_${o} != ${y}_${o} %}`, t = [R, W(R)];
|
|
148
|
+
let m = "", n = 0, f = 0, S = h.indexOf(r);
|
|
149
|
+
for (; S !== -1; ) {
|
|
150
|
+
const I = T[f] === !0 && !v(h, S, t);
|
|
151
|
+
m += h.slice(n, S) + (I ? `${R}${r}{% endif %}` : r), n = S + r.length, f += 1, S = h.indexOf(r, n);
|
|
144
152
|
}
|
|
145
|
-
|
|
146
|
-
}),
|
|
153
|
+
h = m + h.slice(n);
|
|
154
|
+
}), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
155
|
}
|
|
148
156
|
export {
|
|
149
|
-
|
|
157
|
+
et as pairProductVariables
|
|
150
158
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
1
|
+
import { useActionsApi as E } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as F } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as I } from "../composables/useHtmlCompiler.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
import { toBlockUrlConfig as
|
|
5
|
+
import { toBlockUrlConfig as R } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
6
6
|
import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
7
|
-
import { parsePageList as
|
|
8
|
-
import { useDynamicContentStore as
|
|
9
|
-
import { useEditorStore as
|
|
10
|
-
import { useUnsubscribeStore as
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
7
|
+
import { parsePageList as U } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
|
+
import { useDynamicContentStore as L } from "../stores/dynamic-content.js";
|
|
9
|
+
import { useEditorStore as N } from "../stores/editor.js";
|
|
10
|
+
import { useUnsubscribeStore as v } from "../stores/unsubscribe.js";
|
|
11
|
+
import { isPlainObject as z } from "./genericUtil.js";
|
|
12
|
+
import { assignTrackingIds as M } from "./linkTrackingIds.js";
|
|
13
|
+
function O(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);
|
|
17
|
-
t && e.push(...
|
|
17
|
+
t && e.push(...U(t));
|
|
18
18
|
}), [...new Set(e)];
|
|
19
19
|
}
|
|
20
20
|
async function S(n) {
|
|
@@ -35,7 +35,7 @@ async function S(n) {
|
|
|
35
35
|
} catch {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
z(a) && r.seedBlockUrlConfig(t, R(a));
|
|
39
39
|
});
|
|
40
40
|
try {
|
|
41
41
|
await r.fetchRecommendationCreateData();
|
|
@@ -46,40 +46,40 @@ async function S(n) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
const n =
|
|
49
|
+
const Z = () => {
|
|
50
|
+
const n = L(), c = N(), o = v(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = E(), { compileHtml: t, compileAmpHtml: m } = I(), { isFeatureEnabled: a } = F();
|
|
51
51
|
return {
|
|
52
|
-
prepareTemplateDetails: async () => {
|
|
53
|
-
let { html: s, css: u, syncModulesIds:
|
|
52
|
+
prepareTemplateDetails: async (h) => {
|
|
53
|
+
let { html: s, css: u, syncModulesIds: y = [] } = h ?? await e();
|
|
54
54
|
if (a("linkTrackingIds"))
|
|
55
55
|
try {
|
|
56
|
-
const { html: d, changed:
|
|
57
|
-
c.trackIdSessionFloor =
|
|
56
|
+
const { html: d, changed: x, nextSeq: D } = M(s, c.trackIdSessionFloor);
|
|
57
|
+
c.trackIdSessionFloor = D, x && (s = d, await i(d, u));
|
|
58
58
|
} catch (d) {
|
|
59
59
|
console.error("Tracking-id step failed, saving anyway:", d);
|
|
60
60
|
}
|
|
61
|
-
const { html:
|
|
61
|
+
const { html: T, ampHtml: p = "", ampErrors: A = [] } = await r({
|
|
62
62
|
minimize: !0,
|
|
63
63
|
resetDataSavedFlag: !1
|
|
64
64
|
});
|
|
65
65
|
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(s);
|
|
66
|
-
const { compiledHtml:
|
|
66
|
+
const { compiledHtml: w, stats: l, appliedRules: C } = t(T), H = p && m(p).compiledHtml, k = n.getSelectedDynamicContentList, P = b(), f = O(s);
|
|
67
67
|
return console.debug("HTML Compilation Stats:", {
|
|
68
68
|
originalSize: l.originalSize,
|
|
69
69
|
compiledSize: l.compiledSize,
|
|
70
70
|
reduction: `${l.reductionPercentage.toFixed(2)}%`,
|
|
71
|
-
appliedRules:
|
|
71
|
+
appliedRules: C,
|
|
72
72
|
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
73
73
|
}), {
|
|
74
|
-
dynamicContentList:
|
|
75
|
-
compiledHtml:
|
|
74
|
+
dynamicContentList: k,
|
|
75
|
+
compiledHtml: w,
|
|
76
76
|
rawHtml: s,
|
|
77
77
|
css: u,
|
|
78
|
-
ampHtml:
|
|
79
|
-
ampErrors:
|
|
80
|
-
modules:
|
|
78
|
+
ampHtml: H,
|
|
79
|
+
ampErrors: A,
|
|
80
|
+
modules: y.map(Number),
|
|
81
81
|
recommendation: {
|
|
82
|
-
campaignUrls:
|
|
82
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
83
83
|
configs: {}
|
|
84
84
|
},
|
|
85
85
|
unsubscribe: {
|
|
@@ -94,6 +94,6 @@ const Y = () => {
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
98
|
+
Z as useTemplatePreparation
|
|
99
99
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.21.2-beta.
|
|
3
|
+
"version": "3.21.2-beta.c321b5c",
|
|
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",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"types": "./dist/src/public/editorState.d.ts",
|
|
23
23
|
"import": "./dist/public/editorState.js"
|
|
24
24
|
},
|
|
25
|
-
"./prefetch": {
|
|
26
|
-
"types": "./dist/src/public/prefetchRuntime.d.ts",
|
|
27
|
-
"import": "./dist/public/prefetchRuntime.js"
|
|
28
|
-
},
|
|
29
25
|
"./style": "./dist/guido.css"
|
|
30
26
|
},
|
|
31
27
|
"scripts": {
|
|
@@ -49,7 +45,6 @@
|
|
|
49
45
|
"coverage:e2e:report": "nyc report --reporter=lcov --reporter=text-summary --report-dir=coverage/e2e",
|
|
50
46
|
"test:mutation": "stryker run",
|
|
51
47
|
"test:mutation:since": "CHANGED=$(git diff --name-only --diff-filter=AMR origin/develop...HEAD -- 'src/**/*.ts' ':(glob)src/components/organisms/onboarding/**/*.vue' ':(glob)src/components/organisms/header/**/*.vue' ':(glob)src/components/organisms/unsubscribe/**/*.vue' ':(glob)src/components/organisms/save-as-template/**/*.vue' ':(glob)src/components/organisms/email-preview/**/*.vue' ':(glob)src/components/wrappers/**/*.vue' 'src/components/Guido.vue' ':(exclude)src/**/*.test.ts' ':(exclude)src/**/index.ts' ':(exclude)src/@types/**' ':(exclude)src/enums/**' ':(exclude)src/mock/**' ':(exclude)src/**/_Boilerplate/**' | paste -sd, -); if [ -n \"$CHANGED\" ]; then stryker run --incremental --mutate \"$CHANGED\"; else echo \"No changed mutatable src files vs origin/develop\"; fi",
|
|
52
|
-
"stripo:manifest": "node scripts/stripo-runtime-manifest.mjs",
|
|
53
48
|
"prepare": "husky",
|
|
54
49
|
"preinstall": "rm -rf ./node_modules/.vite"
|
|
55
50
|
},
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { SYNC_MODULE_CLASS as w } from "./useSyncModuleExtractor.js";
|
|
2
|
-
import { readRuntimePrefetchState as M } from "../utils/runtimePrefetch.js";
|
|
3
|
-
import f from "../package.json.js";
|
|
4
|
-
const s = "guido:open:", k = "total", A = [
|
|
5
|
-
"setup",
|
|
6
|
-
"host_ready",
|
|
7
|
-
"migration_start",
|
|
8
|
-
"migration_end",
|
|
9
|
-
"default_template_start",
|
|
10
|
-
"default_template_end",
|
|
11
|
-
"timer_clone_start",
|
|
12
|
-
"timer_clone_end",
|
|
13
|
-
"plugin_start",
|
|
14
|
-
"script_ready",
|
|
15
|
-
"fonts_sync_ready",
|
|
16
|
-
"blocks_config_ready",
|
|
17
|
-
"init_editor",
|
|
18
|
-
"token_start",
|
|
19
|
-
"token_end",
|
|
20
|
-
"ready"
|
|
21
|
-
], p = [
|
|
22
|
-
["host_wait", "setup", "host_ready"],
|
|
23
|
-
["migration", "migration_start", "migration_end"],
|
|
24
|
-
["default_template", "default_template_start", "default_template_end"],
|
|
25
|
-
["timer_clone", "timer_clone_start", "timer_clone_end"],
|
|
26
|
-
["script", "plugin_start", "script_ready"],
|
|
27
|
-
["fonts_sync", "script_ready", "fonts_sync_ready"],
|
|
28
|
-
["blocks_config", "fonts_sync_ready", "blocks_config_ready"],
|
|
29
|
-
["editor_config", "blocks_config_ready", "init_editor"],
|
|
30
|
-
["stripo_load", "init_editor", "ready"],
|
|
31
|
-
["token", "token_start", "token_end"]
|
|
32
|
-
], b = (e) => new RegExp(`(?:^|[\\s"'])(?:${e})(?=[\\s"'])`, "g"), N = /<img\b/gi, $ = b(w), C = /\srecommendation-id=/g, O = b("items-block-v2|esd-(?:cart|browsed|purchased)-items-block"), I = "esd-timer-id", g = {
|
|
33
|
-
html_bytes: null,
|
|
34
|
-
css_bytes: null,
|
|
35
|
-
image_count: null,
|
|
36
|
-
synced_module_count: null,
|
|
37
|
-
recommendation_block_count: null,
|
|
38
|
-
items_block_count: null,
|
|
39
|
-
has_timers: null,
|
|
40
|
-
force_recreate: null
|
|
41
|
-
};
|
|
42
|
-
let d = null;
|
|
43
|
-
const i = (e) => {
|
|
44
|
-
try {
|
|
45
|
-
e();
|
|
46
|
-
} catch (t) {
|
|
47
|
-
console.debug("guido:open: metrics step failed", t);
|
|
48
|
-
}
|
|
49
|
-
}, E = () => window.DD_RUM, y = (e, t) => e === void 0 || t === void 0 ? null : Math.round(t - e), _ = (e, t) => {
|
|
50
|
-
var r;
|
|
51
|
-
return ((r = e.match(t)) == null ? void 0 : r.length) ?? 0;
|
|
52
|
-
}, h = (e) => new TextEncoder().encode(e).length, L = (e) => {
|
|
53
|
-
if (!e)
|
|
54
|
-
return g;
|
|
55
|
-
try {
|
|
56
|
-
const { html: t, css: r, forceRecreate: o } = e;
|
|
57
|
-
return {
|
|
58
|
-
html_bytes: h(t),
|
|
59
|
-
css_bytes: h(r),
|
|
60
|
-
image_count: _(t, N),
|
|
61
|
-
synced_module_count: _(t, $),
|
|
62
|
-
recommendation_block_count: _(t, C),
|
|
63
|
-
items_block_count: _(t, O),
|
|
64
|
-
has_timers: t.includes(I),
|
|
65
|
-
force_recreate: o
|
|
66
|
-
};
|
|
67
|
-
} catch (t) {
|
|
68
|
-
return console.debug("guido:open: template weight failed", t), g;
|
|
69
|
-
}
|
|
70
|
-
}, T = () => {
|
|
71
|
-
i(() => {
|
|
72
|
-
A.forEach((e) => performance.clearMarks(`${s}${e}`)), [...p.map(([e]) => e), k].forEach((e) => performance.clearMeasures(`${s}${e}`));
|
|
73
|
-
});
|
|
74
|
-
}, v = (e) => {
|
|
75
|
-
const t = {
|
|
76
|
-
marks: {},
|
|
77
|
-
context: null,
|
|
78
|
-
template: null,
|
|
79
|
-
scriptPreloaded: null,
|
|
80
|
-
runtimePrefetch: null,
|
|
81
|
-
wasBackgrounded: document.visibilityState === "hidden",
|
|
82
|
-
finished: e,
|
|
83
|
-
onVisibilityChange: () => {
|
|
84
|
-
document.visibilityState === "hidden" && (t.wasBackgrounded = !0);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
return t;
|
|
88
|
-
}, l = (e, t) => {
|
|
89
|
-
if (e.finished || e.marks[t] !== void 0)
|
|
90
|
-
return;
|
|
91
|
-
const r = performance.now();
|
|
92
|
-
e.marks[t] = r, e === d && i(() => performance.mark(`${s}${t}`, { startTime: r }));
|
|
93
|
-
}, u = (e) => {
|
|
94
|
-
e.finished = !0, document.removeEventListener("visibilitychange", e.onVisibilityChange);
|
|
95
|
-
}, B = (e, t) => {
|
|
96
|
-
const { marks: r } = e, o = p.map(([n, a, c]) => [n, r[a], r[c]]);
|
|
97
|
-
o.push([k, r.setup, t]), o.forEach(([n, a, c]) => {
|
|
98
|
-
a !== void 0 && c !== void 0 && i(() => performance.measure(`${s}${n}`, { start: a, end: c }));
|
|
99
|
-
});
|
|
100
|
-
}, D = (e, t, r) => {
|
|
101
|
-
const { marks: o, context: n } = e, a = Object.fromEntries(
|
|
102
|
-
p.map(([c, R, S]) => [`${c}_ms`, y(o[R], o[S])])
|
|
103
|
-
);
|
|
104
|
-
return {
|
|
105
|
-
outcome: t,
|
|
106
|
-
open_ms: y(o.setup, r),
|
|
107
|
-
...a,
|
|
108
|
-
script_preloaded: e.scriptPreloaded,
|
|
109
|
-
runtime_prefetch: e.runtimePrefetch,
|
|
110
|
-
...L(e.template),
|
|
111
|
-
partner_name: (n == null ? void 0 : n.partnerName) ?? null,
|
|
112
|
-
product_type: (n == null ? void 0 : n.productType) ?? null,
|
|
113
|
-
template_id: (n == null ? void 0 : n.templateId) ?? null,
|
|
114
|
-
variation_id: (n == null ? void 0 : n.variationId) ?? null,
|
|
115
|
-
guido_version: f.version,
|
|
116
|
-
stripo_version: f.guido.stripo.version,
|
|
117
|
-
was_backgrounded: e.wasBackgrounded
|
|
118
|
-
};
|
|
119
|
-
}, m = (e, t) => {
|
|
120
|
-
i(() => {
|
|
121
|
-
const r = e.marks.ready ?? performance.now(), o = D(e, t, r);
|
|
122
|
-
e.template = null, e === d && B(e, r), console.debug("guido:open", o), i(() => {
|
|
123
|
-
var n, a;
|
|
124
|
-
return (a = (n = E()) == null ? void 0 : n.addAction) == null ? void 0 : a.call(n, "guido_editor_open", o);
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
}, P = (e) => ({
|
|
128
|
-
mark: (t) => l(e, t),
|
|
129
|
-
timed: async (t, r) => {
|
|
130
|
-
l(e, `${t}_start`);
|
|
131
|
-
const o = await r();
|
|
132
|
-
return l(e, `${t}_end`), o;
|
|
133
|
-
},
|
|
134
|
-
setContext: (t) => {
|
|
135
|
-
e.context = t;
|
|
136
|
-
},
|
|
137
|
-
setTemplate: (t) => {
|
|
138
|
-
e.template = t;
|
|
139
|
-
},
|
|
140
|
-
setScriptPreloaded: (t) => {
|
|
141
|
-
e.scriptPreloaded = t;
|
|
142
|
-
},
|
|
143
|
-
markReady: () => {
|
|
144
|
-
e.finished || (l(e, "ready"), u(e), i(() => {
|
|
145
|
-
var t, r;
|
|
146
|
-
return (r = (t = E()) == null ? void 0 : t.addTiming) == null ? void 0 : r.call(t, "guido_editor_ready");
|
|
147
|
-
}), setTimeout(() => m(e, "ready"), 0));
|
|
148
|
-
},
|
|
149
|
-
markFailed: () => {
|
|
150
|
-
e.finished || (u(e), m(e, "error"));
|
|
151
|
-
},
|
|
152
|
-
dispose: () => {
|
|
153
|
-
e.finished || (u(e), m(e, "abandoned")), e === d && (T(), d = null);
|
|
154
|
-
}
|
|
155
|
-
}), F = () => {
|
|
156
|
-
const e = v(!1);
|
|
157
|
-
return T(), d = e, i(() => {
|
|
158
|
-
e.runtimePrefetch = M();
|
|
159
|
-
}), document.addEventListener("visibilitychange", e.onVisibilityChange), l(e, "setup"), P(e);
|
|
160
|
-
}, G = () => P(d ?? v(!0));
|
|
161
|
-
export {
|
|
162
|
-
F as startEditorOpenMetrics,
|
|
163
|
-
G as useEditorOpenMetrics
|
|
164
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export type TimedOpenPhase = 'migration' | 'default_template' | 'timer_clone';
|
|
2
|
-
export type OpenPhase = 'setup' | 'host_ready' | `${TimedOpenPhase}_start` | `${TimedOpenPhase}_end` | 'plugin_start' | 'script_ready' | 'fonts_sync_ready' | 'blocks_config_ready' | 'init_editor' | 'token_start' | 'token_end' | 'ready';
|
|
3
|
-
export type OpenOutcome = 'ready' | 'error' | 'abandoned';
|
|
4
|
-
export interface OpenContext {
|
|
5
|
-
partnerName: string;
|
|
6
|
-
productType: number;
|
|
7
|
-
templateId: string;
|
|
8
|
-
variationId: string;
|
|
9
|
-
}
|
|
10
|
-
export interface OpenTemplate {
|
|
11
|
-
html: string;
|
|
12
|
-
css: string;
|
|
13
|
-
forceRecreate: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface EditorOpenMetrics {
|
|
16
|
-
mark: (phase: OpenPhase) => void;
|
|
17
|
-
timed: <T>(phase: TimedOpenPhase, task: () => Promise<T>) => Promise<T>;
|
|
18
|
-
setContext: (context: OpenContext) => void;
|
|
19
|
-
setTemplate: (template: OpenTemplate) => void;
|
|
20
|
-
setScriptPreloaded: (preloaded: boolean) => void;
|
|
21
|
-
markReady: () => void;
|
|
22
|
-
markFailed: () => void;
|
|
23
|
-
dispose: () => void;
|
|
24
|
-
}
|
|
25
|
-
export declare const startEditorOpenMetrics: () => EditorOpenMetrics;
|
|
26
|
-
/** Binds to the session open at call time, so a remounted editor never writes into its replacement's session. */
|
|
27
|
-
export declare const useEditorOpenMetrics: () => EditorOpenMetrics;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { prefetchGuidoRuntime } from '../utils/runtimePrefetch';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const s = "2.81.1", n = ["UIEditor.js", "zone.js", "styles-BWH3PMR4.css", "polyfills-FF3RLU5F.js", "main-5LCHF56A.js", "chunk-2HYLRI4G.js", "chunk-4SN7BSQN.js", "chunk-5IY7ZG3R.js", "chunk-62K3AMOD.js", "chunk-GK543IRH.js", "chunk-L2EPGQ76.js", "chunk-LXS5IGCQ.js", "chunk-PNWIGF4L.js", "chunk-S2TYCIH3.js", "chunk-S5UZ4LUK.js", "chunk-V2AGQPVL.js", "chunk-XZ6MUAN5.js", "chunk-ZPL4VL4O.js", "assets/css/uiEditor.css", "assets/i18n/en.json", "assets/icons/ui-editor-icons.sprite.svg", "assets/icons/ui-editor-icons.map.json", "assets/imageeditor/scripts.min.js", "assets/imageeditor/assets/icons/merged.svg"], i = {
|
|
2
|
-
version: s,
|
|
3
|
-
files: n
|
|
4
|
-
};
|
|
5
|
-
export {
|
|
6
|
-
i as default,
|
|
7
|
-
n as files,
|
|
8
|
-
s as version
|
|
9
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import s from "../static/stripo-runtime-manifest.json.js";
|
|
2
|
-
import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
|
|
3
|
-
const r = "data-guido-prefetch", d = "pending", o = "settled", i = `link[${r}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, E = () => {
|
|
4
|
-
const { connection: e } = navigator;
|
|
5
|
-
return (e == null ? void 0 : e.saveData) === !0 || u.includes((e == null ? void 0 : e.effectiveType) ?? "");
|
|
6
|
-
}, m = (e) => {
|
|
7
|
-
const t = document.createElement("link"), n = () => t.setAttribute(r, o);
|
|
8
|
-
t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(r, d), t.addEventListener("load", n, { once: !0 }), t.addEventListener("error", n, { once: !0 }), document.head.appendChild(t);
|
|
9
|
-
}, T = () => {
|
|
10
|
-
try {
|
|
11
|
-
const e = c(), t = document.querySelector(i) !== null;
|
|
12
|
-
if (!e || t || a() || E())
|
|
13
|
-
return;
|
|
14
|
-
s.files.forEach((n) => m(`${e}${n}`));
|
|
15
|
-
} catch (e) {
|
|
16
|
-
console.debug("guido: runtime prefetch skipped", e);
|
|
17
|
-
}
|
|
18
|
-
}, g = () => {
|
|
19
|
-
const e = Array.from(document.querySelectorAll(i));
|
|
20
|
-
return e.length ? e.every((t) => t.getAttribute(r) === o) ? "done" : "pending" : "none";
|
|
21
|
-
};
|
|
22
|
-
export {
|
|
23
|
-
r as RUNTIME_PREFETCH_ATTRIBUTE,
|
|
24
|
-
T as prefetchGuidoRuntime,
|
|
25
|
-
g as readRuntimePrefetchState
|
|
26
|
-
};
|