@useinsider/guido 3.21.2-beta.cfc5be2 → 3.21.2-beta.d2a272e
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 +35 -5
- package/dist/@types/config/schemas.js +39 -41
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +107 -99
- package/dist/composables/useBlocksConfig.js +24 -32
- package/dist/composables/useEditorOpenMetrics.js +167 -0
- package/dist/composables/useSave.js +75 -68
- package/dist/composables/useStripo.js +93 -82
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
- package/dist/enums/academy.js +0 -1
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -10
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
- package/dist/node_modules/valibot/dist/index.js +261 -297
- package/dist/package.json.js +6 -4
- package/dist/public/prefetchRuntime.js +4 -0
- package/dist/services/templateLibraryApi.js +36 -31
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
- package/dist/src/composables/useStripo.d.ts +2 -1
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/prefetchRuntime.d.ts +1 -0
- package/dist/src/stores/config.d.ts +0 -166
- package/dist/src/utils/runtimePrefetch.d.ts +4 -0
- package/dist/src/utils/stripoRuntime.d.ts +3 -0
- package/dist/src/utils/templatePreparation.d.ts +2 -1
- package/dist/static/stripo-runtime-manifest.json.js +9 -0
- package/dist/stores/config.js +6 -13
- package/dist/utils/pairProductVariables.js +98 -91
- package/dist/utils/runtimePrefetch.js +26 -0
- package/dist/utils/stripoRuntime.js +13 -0
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +6 -1
- package/dist/@types/display-condition.js +0 -25
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
- package/dist/composables/useDisplayConditions.js +0 -102
- package/dist/enums/display-condition.js +0 -12
- package/dist/extensions/DisplayConditions/bridge.js +0 -17
- package/dist/extensions/DisplayConditions/constants.js +0 -17
- package/dist/extensions/DisplayConditions/control.js +0 -178
- package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
- package/dist/extensions/DisplayConditions/extension.js +0 -28
- package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
- package/dist/extensions/DisplayConditions/library.js +0 -27
- package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
- package/dist/services/displayConditionApi.js +0 -39
- package/dist/src/@types/display-condition.d.ts +0 -59
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
- package/dist/src/composables/useDisplayConditions.d.ts +0 -16
- package/dist/src/enums/display-condition.d.ts +0 -15
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
- package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
- package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
- package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
- package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
- package/dist/src/mock/api/display-conditions.d.ts +0 -2
- package/dist/src/services/displayConditionApi.d.ts +0 -8
- package/dist/src/stores/display-condition.d.ts +0 -81
- package/dist/src/utils/displayCondition.d.ts +0 -10
- package/dist/src/utils/protectTableText.d.ts +0 -2
- package/dist/stores/display-condition.js +0 -28
- package/dist/utils/displayCondition.js +0 -26
- package/dist/utils/protectTableText.js +0 -22
|
@@ -1,101 +1,108 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
3
|
-
import { escapeReplacement as
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const O = {
|
|
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 = {
|
|
8
7
|
CART_ITEMS: "ins_apr",
|
|
9
8
|
BROWSED_ITEMS: "browsed_item",
|
|
10
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
11
|
-
},
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
for (;
|
|
15
|
-
|
|
16
|
-
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));
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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];
|
|
28
34
|
if (f)
|
|
29
|
-
switch (
|
|
35
|
+
switch (o) {
|
|
30
36
|
case "imageSrc": {
|
|
31
|
-
let e = null,
|
|
32
|
-
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)
|
|
33
39
|
break;
|
|
34
40
|
const l = f.DEFAULT, c = f.ATTR;
|
|
35
41
|
if (l && e.src) {
|
|
36
|
-
const
|
|
37
|
-
l.some((
|
|
38
|
-
const u =
|
|
39
|
-
return
|
|
40
|
-
}) && (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}}}`);
|
|
41
47
|
}
|
|
42
|
-
const i = (
|
|
43
|
-
if (i && e.setAttribute("alt", `{{${i}_${
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const
|
|
47
|
-
(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}}}`);
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
56
|
break;
|
|
51
57
|
}
|
|
52
58
|
case "name": {
|
|
53
|
-
const e = f,
|
|
54
|
-
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}}}`));
|
|
55
61
|
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
56
62
|
if (i && c) {
|
|
57
|
-
const
|
|
58
|
-
(
|
|
63
|
+
const a = i.href, b = `${window.location.href}${l}`;
|
|
64
|
+
(a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
|
|
59
65
|
}
|
|
60
66
|
break;
|
|
61
67
|
}
|
|
62
68
|
case "price":
|
|
63
69
|
case "originalPrice": {
|
|
64
|
-
const e = f,
|
|
65
|
-
let
|
|
66
|
-
i ?
|
|
67
|
-
const
|
|
68
|
-
let u = `{{${
|
|
69
|
-
const H = (t.getAttribute(
|
|
70
|
-
let
|
|
71
|
-
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);
|
|
72
78
|
break;
|
|
73
79
|
}
|
|
74
80
|
case "quantity": {
|
|
75
|
-
const e = f,
|
|
76
|
-
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}}}`));
|
|
77
83
|
break;
|
|
78
84
|
}
|
|
79
85
|
case "button": {
|
|
80
|
-
const e = f,
|
|
86
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
81
87
|
if (c) {
|
|
82
|
-
const i = c.href || "",
|
|
83
|
-
(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}}}`);
|
|
84
90
|
}
|
|
91
|
+
Q(t, `{{${s}_${n}}}`);
|
|
85
92
|
break;
|
|
86
93
|
}
|
|
87
94
|
case "itemLink": {
|
|
88
|
-
const e = f,
|
|
95
|
+
const e = f, s = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
89
96
|
if (c.href) {
|
|
90
|
-
const i = c.href,
|
|
91
|
-
(i ===
|
|
97
|
+
const i = c.href, a = `${window.location.href}${l}`;
|
|
98
|
+
(i === a || i.endsWith(l)) && (c.href = `{{${s}_${n}}}`);
|
|
92
99
|
}
|
|
93
100
|
break;
|
|
94
101
|
}
|
|
95
102
|
default: {
|
|
96
103
|
if ("ATTR" in f) {
|
|
97
104
|
const e = f.ATTR;
|
|
98
|
-
t.textContent && (t.innerHTML =
|
|
105
|
+
t.textContent && (t.innerHTML = L(t, `{{${e}_${n}}}`));
|
|
99
106
|
}
|
|
100
107
|
break;
|
|
101
108
|
}
|
|
@@ -103,49 +110,49 @@ function rt(S) {
|
|
|
103
110
|
});
|
|
104
111
|
});
|
|
105
112
|
});
|
|
106
|
-
const
|
|
107
|
-
` : "",
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
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,
|
|
112
119
|
outerHtml: r,
|
|
113
|
-
type:
|
|
114
|
-
number:
|
|
120
|
+
type: p,
|
|
121
|
+
number: T
|
|
115
122
|
});
|
|
116
123
|
});
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
const r =
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
|
|
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));
|
|
123
130
|
}
|
|
124
131
|
});
|
|
125
|
-
const V =
|
|
126
|
-
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) => {
|
|
127
134
|
var t;
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
135
|
+
const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
|
|
136
|
+
if (!p || !q[T])
|
|
130
137
|
return;
|
|
131
|
-
const r =
|
|
132
|
-
if (!r ||
|
|
138
|
+
const r = o.closest(".product-original-price-class");
|
|
139
|
+
if (!r || D.has(r))
|
|
133
140
|
return;
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
}),
|
|
138
|
-
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))
|
|
139
146
|
return;
|
|
140
|
-
const
|
|
141
|
-
let
|
|
142
|
-
for (;
|
|
143
|
-
const
|
|
144
|
-
|
|
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);
|
|
145
152
|
}
|
|
146
|
-
|
|
147
|
-
}),
|
|
153
|
+
h = m + h.slice(n);
|
|
154
|
+
}), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
148
155
|
}
|
|
149
156
|
export {
|
|
150
|
-
|
|
157
|
+
et as pairProductVariables
|
|
151
158
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import i from "../static/stripo-runtime-manifest.json.js";
|
|
2
|
+
import { getStripoRuntimeBaseUrl as c } from "./stripoRuntime.js";
|
|
3
|
+
const n = "data-guido-prefetch", d = "pending", o = "settled", s = `link[${n}]`, u = ["slow-2g", "2g"], l = /\.(?:js|json)$/, a = () => document.getElementById("UiEditorScript") !== null || window.UIEditor !== void 0, p = () => document.createElement("link").relList.supports("prefetch"), 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"), r = () => t.setAttribute(n, o);
|
|
8
|
+
t.rel = "prefetch", t.href = e, l.test(e) && t.setAttribute("crossorigin", "anonymous"), t.setAttribute(n, d), t.addEventListener("load", r, { once: !0 }), t.addEventListener("error", r, { once: !0 }), document.head.appendChild(t);
|
|
9
|
+
}, T = () => {
|
|
10
|
+
try {
|
|
11
|
+
const e = c(), t = document.querySelector(s) !== null;
|
|
12
|
+
if (!e || t || !p() || a() || E())
|
|
13
|
+
return;
|
|
14
|
+
i.files.forEach((r) => m(`${e}${r}`));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
console.debug("guido: runtime prefetch skipped", e);
|
|
17
|
+
}
|
|
18
|
+
}, g = () => {
|
|
19
|
+
const e = Array.from(document.querySelectorAll(s));
|
|
20
|
+
return e.length ? e.every((t) => t.getAttribute(n) === o) ? "done" : "pending" : "none";
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
n as RUNTIME_PREFETCH_ATTRIBUTE,
|
|
24
|
+
T as prefetchGuidoRuntime,
|
|
25
|
+
g as readRuntimePrefetchState
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import r from "../package.json.js";
|
|
2
|
+
const s = "https://email-static.useinsider.com/guido/", e = () => {
|
|
3
|
+
var o;
|
|
4
|
+
const t = r.guido;
|
|
5
|
+
return (o = t == null ? void 0 : t.stripo) == null ? void 0 : o.version;
|
|
6
|
+
}, n = () => {
|
|
7
|
+
const t = e();
|
|
8
|
+
return t ? `${s}${t}/` : null;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
n as getStripoRuntimeBaseUrl,
|
|
12
|
+
e as getStripoVersion
|
|
13
|
+
};
|
|
@@ -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.d2a272e",
|
|
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,6 +22,10 @@
|
|
|
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
|
+
},
|
|
25
29
|
"./style": "./dist/guido.css"
|
|
26
30
|
},
|
|
27
31
|
"scripts": {
|
|
@@ -45,6 +49,7 @@
|
|
|
45
49
|
"coverage:e2e:report": "nyc report --reporter=lcov --reporter=text-summary --report-dir=coverage/e2e",
|
|
46
50
|
"test:mutation": "stryker run",
|
|
47
51
|
"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",
|
|
48
53
|
"prepare": "husky",
|
|
49
54
|
"preinstall": "rm -rf ./node_modules/.vite"
|
|
50
55
|
},
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { object as e, optional as a, string as o, nullish as i, number as t, picklist as n, array as c } from "../node_modules/valibot/dist/index.js";
|
|
2
|
-
const s = n(["liquid", "pongo"]), d = n(["codeOnly", "logicBuilder"]), r = e({
|
|
3
|
-
id: t(),
|
|
4
|
-
name: o(),
|
|
5
|
-
description: i(o(), ""),
|
|
6
|
-
syntax: s,
|
|
7
|
-
method: d,
|
|
8
|
-
codeBefore: o(),
|
|
9
|
-
codeAfter: i(o(), ""),
|
|
10
|
-
createdAt: a(o())
|
|
11
|
-
}), p = e({
|
|
12
|
-
data: c(r),
|
|
13
|
-
meta: e({
|
|
14
|
-
totalCount: t(),
|
|
15
|
-
perPage: t(),
|
|
16
|
-
currentPage: t(),
|
|
17
|
-
lastPage: t()
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
export {
|
|
21
|
-
p as DisplayConditionListResponseSchema,
|
|
22
|
-
d as DisplayConditionMethodSchema,
|
|
23
|
-
s as DisplayConditionSyntaxSchema,
|
|
24
|
-
r as SavedDisplayConditionSchema
|
|
25
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import i from "./CodeEditorField.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var a = function() {
|
|
5
|
-
var e = this, r = e._self._c, o = e._self._setupProxy;
|
|
6
|
-
return r("div", { staticClass: "guido-code-editor-field", attrs: { id: e.id } }, [r("p", { staticClass: "guido-code-editor-field__label" }, [e._v(" " + e._s(e.label) + " ")]), r(o.InCodeSnippet, { attrs: { code: e.value, disable: e.disabled, "focus-editor": !1, invalid: !!e.error, "invalid-message": e.error, options: o.options, size: { height: e.error ? 196 : 216 }, "syntax-check": !1 }, on: { input: function(t) {
|
|
7
|
-
return o.emit("input", t);
|
|
8
|
-
}, ready: o.onReady } })], 1);
|
|
9
|
-
}, n = [], d = /* @__PURE__ */ s(
|
|
10
|
-
i,
|
|
11
|
-
a,
|
|
12
|
-
n,
|
|
13
|
-
!1,
|
|
14
|
-
null,
|
|
15
|
-
"e96c7aa3"
|
|
16
|
-
);
|
|
17
|
-
const p = d.exports;
|
|
18
|
-
export {
|
|
19
|
-
p as default
|
|
20
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { defineComponent as s, computed as u } from "vue";
|
|
2
|
-
import { InCodeSnippet as i } from "@useinsider/design-system-vue";
|
|
3
|
-
const m = /* @__PURE__ */ s({
|
|
4
|
-
__name: "CodeEditorField",
|
|
5
|
-
props: {
|
|
6
|
-
id: null,
|
|
7
|
-
label: null,
|
|
8
|
-
value: null,
|
|
9
|
-
placeholder: { default: "" },
|
|
10
|
-
error: { default: "" },
|
|
11
|
-
disabled: { type: Boolean, default: !1 }
|
|
12
|
-
},
|
|
13
|
-
emits: ["input"],
|
|
14
|
-
setup(t, { expose: n, emit: d }) {
|
|
15
|
-
const l = t;
|
|
16
|
-
let e = null;
|
|
17
|
-
const a = u(() => ({
|
|
18
|
-
mode: "liquid",
|
|
19
|
-
lint: !1,
|
|
20
|
-
foldGutter: !1,
|
|
21
|
-
placeholder: l.placeholder
|
|
22
|
-
})), r = (p) => {
|
|
23
|
-
e = p;
|
|
24
|
-
}, o = () => (e == null ? void 0 : e.state.doc.toString()) ?? l.value;
|
|
25
|
-
return n({ read: o }), { __sfc: !0, props: l, emit: d, view: e, options: a, onReady: r, read: o, InCodeSnippet: i };
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
export {
|
|
29
|
-
m as default
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import a from "./DisplayConditionCreateDrawer.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var n = function() {
|
|
5
|
-
var i = this, t = i._self._c, e = i._self._setupProxy;
|
|
6
|
-
return t(e.WpDrawer, { attrs: { id: "guido__display-condition-create-drawer", "description-status": "", "class-name": "guido-display-condition-create-drawer", size: "large", "close-on-outside-click": !1, "description-text": e.descriptionText, "footer-button-group-options": e.footerButtonGroupOptions, status: e.store.isCreateOpen, "title-text": e.trans(`${e.KEY}.create-title`) }, on: { cancelOrBackButtonEvent: e.close, onCloseEvent: e.close, primaryButtonEvent: function(o) {
|
|
7
|
-
return e.submit("inline");
|
|
8
|
-
}, secondaryButtonEvent: function(o) {
|
|
9
|
-
return e.submit("save");
|
|
10
|
-
} } }, [t("div", { staticClass: "guido-display-condition-create" }, [t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-name-input", name: "displayConditionName", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.trans(`${e.KEY}.condition-name`), "max-character-length": e.DISPLAY_CONDITION_LIMITS.NAME_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-name-placeholder`), "state-message": e.errors.name || "", states: e.errors.name ? "error" : "default", "tooltip-status": !1, value: e.draft.name }, on: { input: function(o) {
|
|
11
|
-
return e.updateField("name", o);
|
|
12
|
-
} } }), t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-description-input", name: "displayConditionDescription", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.descriptionLabel, "max-character-length": e.DISPLAY_CONDITION_LIMITS.DESCRIPTION_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-description-placeholder`), "state-message": e.errors.description || "", states: e.errors.description ? "error" : "default", "tooltip-status": !1, value: e.draft.description }, on: { input: function(o) {
|
|
13
|
-
return e.updateField("description", o);
|
|
14
|
-
} } }), t("div", { staticClass: "guido-display-condition-create__separator" }), t("p", { staticClass: "guido-display-condition-create__method-title" }, [i._v(" " + i._s(e.trans(`${e.KEY}.select-method`)) + " ")]), t("div", { staticClass: "guido-display-condition-create__methods" }, [t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-logic-builder", disable: "", disabled: "", name: "displayConditionMethod", selected: "codeOnly", value: "logicBuilder", label: e.trans(`${e.KEY}.logic-builder`) } }), t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-code-only", name: "displayConditionMethod", selected: "codeOnly", value: "codeOnly", label: e.trans(`${e.KEY}.code-only`) } })], 1), t(e.CodeEditorField, { ref: "codeBeforeRef", staticClass: "mb-3", attrs: { id: "guido__display-condition-code-before", disabled: e.isSaving, error: e.errors.codeBefore, label: e.trans(`${e.KEY}.code-before`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeBefore }, on: { input: function(o) {
|
|
15
|
-
return e.updateField("codeBefore", o);
|
|
16
|
-
} } }), t(e.CodeEditorField, { ref: "codeAfterRef", attrs: { id: "guido__display-condition-code-after", disabled: e.isSaving, error: e.errors.codeAfter, label: e.trans(`${e.KEY}.code-after`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeAfter }, on: { input: function(o) {
|
|
17
|
-
return e.updateField("codeAfter", o);
|
|
18
|
-
} } })], 1)]);
|
|
19
|
-
}, s = [], d = /* @__PURE__ */ r(
|
|
20
|
-
a,
|
|
21
|
-
n,
|
|
22
|
-
s,
|
|
23
|
-
!1,
|
|
24
|
-
null,
|
|
25
|
-
"a4b2ccb9"
|
|
26
|
-
);
|
|
27
|
-
const f = d.exports;
|
|
28
|
-
export {
|
|
29
|
-
f as default
|
|
30
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { defineComponent as D, reactive as $, ref as s, watch as C, computed as u } from "vue";
|
|
2
|
-
import O from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useDisplayConditions as T } from "../../../composables/useDisplayConditions.js";
|
|
4
|
-
import { useTranslations as L } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { ACADEMY_LINKS as x } from "../../../enums/academy.js";
|
|
6
|
-
import { DISPLAY_CONDITION_LIMITS as h } from "../../../enums/display-condition.js";
|
|
7
|
-
import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
|
|
8
|
-
import { InRadioButton as N, InBasicTextInput as w } from "@useinsider/design-system-vue";
|
|
9
|
-
import E from "./CodeEditorField.vue.js";
|
|
10
|
-
const J = /* @__PURE__ */ D({
|
|
11
|
-
__name: "DisplayConditionCreateDrawer",
|
|
12
|
-
setup(Y) {
|
|
13
|
-
const r = "email-editor.display-conditions", i = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
|
|
14
|
-
C(() => c.isCreateOpen, (n) => {
|
|
15
|
-
if (!n)
|
|
16
|
-
return;
|
|
17
|
-
const { editing: t } = c;
|
|
18
|
-
Object.assign(e, t ? {
|
|
19
|
-
name: t.name,
|
|
20
|
-
description: t.description,
|
|
21
|
-
codeBefore: t.beforeScript,
|
|
22
|
-
codeAfter: t.afterScript
|
|
23
|
-
} : d()), o.value = {}, a.value = !1;
|
|
24
|
-
}, { immediate: !0 });
|
|
25
|
-
const g = u(() => i(`${r}.create-description`, {
|
|
26
|
-
academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${i(`${r}.academy`)}</a>`
|
|
27
|
-
})), S = u(() => ({
|
|
28
|
-
cancelOrBackButton: {
|
|
29
|
-
styling: "ghost",
|
|
30
|
-
type: "secondary",
|
|
31
|
-
labelText: i(`${r}.cancel`),
|
|
32
|
-
disabledStatus: a.value
|
|
33
|
-
},
|
|
34
|
-
secondaryButton: {
|
|
35
|
-
styling: "solid",
|
|
36
|
-
type: "subtle-primary",
|
|
37
|
-
labelText: i(`${r}.create-and-save`),
|
|
38
|
-
loadingStatus: a.value
|
|
39
|
-
},
|
|
40
|
-
primaryButton: {
|
|
41
|
-
styling: "solid",
|
|
42
|
-
type: "primary",
|
|
43
|
-
labelText: i(`${r}.create`),
|
|
44
|
-
disabledStatus: a.value
|
|
45
|
-
}
|
|
46
|
-
})), B = (n, t) => {
|
|
47
|
-
t !== e[n] && (e[n] = t, o.value[n] && (o.value = { ...o.value, [n]: void 0 }));
|
|
48
|
-
}, A = u(() => `${i(`${r}.condition-description`)} <span class="guido-display-condition-create__optional">(${i(`${r}.optional`)})</span>`);
|
|
49
|
-
return { __sfc: !0, KEY: r, trans: i, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (n) => {
|
|
50
|
-
var I, b;
|
|
51
|
-
if (a.value)
|
|
52
|
-
return;
|
|
53
|
-
if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e), Object.keys(o.value).length) {
|
|
54
|
-
l();
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (n === "inline") {
|
|
58
|
-
f({ ...e });
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
a.value = !0;
|
|
62
|
-
const t = await m({ ...e });
|
|
63
|
-
a.value = !1, o.value = t ?? {}, Object.keys(o.value).length && l();
|
|
64
|
-
}, close: () => {
|
|
65
|
-
a.value || y();
|
|
66
|
-
}, WpDrawer: O, DISPLAY_CONDITION_LIMITS: h, InBasicTextInput: w, InRadioButton: N, CodeEditorField: E };
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
export {
|
|
70
|
-
J as default
|
|
71
|
-
};
|