@useinsider/guido 3.14.0-beta.8d5df20 → 3.14.0-beta.98ecc9b
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/utils/linkTrackingIds.js +34 -34
- package/package.json +1 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
return Number.isSafeInteger(
|
|
1
|
+
const $ = "data-ins-track-id", l = "data-ins-track-seq", E = `(?:[^>"']|"[^"]*"|'[^']*')*`, S = new RegExp(`<a\\b${E}>`, "gi"), p = new RegExp(`<body\\b${E}>`, "i"), b = new RegExp(`<html\\b${E}>`, "i"), I = new RegExp(`\\b${$}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"), N = new RegExp(`\\b${l}\\s*=\\s*(?:"(\\d+)"|'(\\d+)'|(\\d+))`, "i"), f = "ins-track-seq", x = new RegExp(`<!--\\s*${f}:(\\d+)\\s*-->`, "i"), w = /^[1-9][0-9]{0,14}$/, q = 999999999999999;
|
|
2
|
+
function C(e) {
|
|
3
|
+
const n = Number(e);
|
|
4
|
+
return Number.isSafeInteger(n) && n > 0 ? n : 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
return
|
|
6
|
+
function k(e) {
|
|
7
|
+
var a;
|
|
8
|
+
const n = (r) => {
|
|
9
|
+
var c;
|
|
10
|
+
const o = (c = r.exec(e)) == null ? void 0 : c[0];
|
|
11
|
+
return o ? N.exec(o) : null;
|
|
12
|
+
}, t = n(p) ?? n(b), s = (t == null ? void 0 : t[1]) ?? (t == null ? void 0 : t[2]) ?? (t == null ? void 0 : t[3]) ?? ((a = x.exec(e)) == null ? void 0 : a[1]) ?? "";
|
|
13
|
+
return C(s);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
15
|
+
function D(e, n) {
|
|
16
|
+
const t = `${l}="${n}"`, s = p.exec(e) ?? b.exec(e);
|
|
17
17
|
if (s) {
|
|
18
|
-
const [
|
|
19
|
-
return e.slice(0, s.index) +
|
|
18
|
+
const [r] = s, o = N.exec(r), c = o ? r.replace(o[0], t) : r.replace(/\/?>$/, (T) => ` ${t}${T}`);
|
|
19
|
+
return e.slice(0, s.index) + c + e.slice(s.index + r.length);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
return
|
|
21
|
+
const a = `<!--${f}:${n}-->`;
|
|
22
|
+
return x.test(e) ? e.replace(x, a) : `${a}${e}`;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
const s = `${
|
|
26
|
-
return
|
|
24
|
+
function M(e, n, t) {
|
|
25
|
+
const s = `${$}="${t}"`;
|
|
26
|
+
return n ? e.replace(n[0], s) : e.replace(/^<a\b/i, (a) => `${a} ${s}`);
|
|
27
27
|
}
|
|
28
|
-
function P(e,
|
|
29
|
-
const
|
|
28
|
+
function P(e, n = 0) {
|
|
29
|
+
const t = /* @__PURE__ */ new Set();
|
|
30
30
|
let s = 0;
|
|
31
|
-
const
|
|
32
|
-
const [
|
|
31
|
+
const a = [...e.matchAll(S)].map((i) => {
|
|
32
|
+
const [g] = i, u = I.exec(g), _ = u ? u[1] ?? u[2] ?? u[3] ?? "" : "";
|
|
33
33
|
let d = null;
|
|
34
|
-
return
|
|
35
|
-
}),
|
|
36
|
-
let c = Math.max(
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
}),
|
|
34
|
+
return w.test(_) && !t.has(Number(_)) && (d = Number(_), t.add(d), s = Math.max(s, d)), { index: i.index, tag: g, attrMatch: u, id: d };
|
|
35
|
+
}), r = k(e), o = Number.isSafeInteger(n) && n > 0 && n < q ? n : 0;
|
|
36
|
+
let c = Math.max(r, s, o), T = "", A = 0, R = !1;
|
|
37
|
+
return a.forEach((i) => {
|
|
38
|
+
T += e.slice(A, i.index), i.id === null ? (c += 1, T += M(i.tag, i.attrMatch, c), R = !0) : T += i.tag, A = i.index + i.tag.length;
|
|
39
|
+
}), T += e.slice(A), c > 0 && r !== c && (T = D(T, c), R = !0), { html: T, changed: R, nextSeq: c };
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
$ as TRACK_ID_ATTRIBUTE,
|
|
43
|
+
l as TRACK_SEQ_ATTRIBUTE,
|
|
44
44
|
P as assignTrackingIds,
|
|
45
|
-
|
|
45
|
+
k as readTrackSeq
|
|
46
46
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.14.0-beta.
|
|
3
|
+
"version": "3.14.0-beta.98ecc9b",
|
|
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",
|