@useinsider/guido 3.27.0-beta.c63ada9 → 3.27.0-beta.ee85b86
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 +10 -5
- package/dist/components/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +86 -83
- package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.js +24 -0
- package/dist/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue2.js +59 -0
- package/dist/composables/useAmbiguousDynamicContent.js +72 -0
- package/dist/composables/useHtmlCompiler.js +9 -8
- package/dist/composables/useModuleRepair.js +63 -32
- package/dist/composables/useStripo.js +44 -43
- package/dist/config/compiler/htmlCompilerRules.js +16 -6
- package/dist/enums/dynamic-content.js +4 -0
- package/dist/guido.css +1 -1
- package/dist/package.json.js +4 -4
- package/dist/src/@types/generic.d.ts +7 -0
- package/dist/src/components/organisms/dynamic-content/AmbiguousDynamicContentModal.vue.d.ts +2 -0
- package/dist/src/composables/useAmbiguousDynamicContent.d.ts +7 -0
- package/dist/src/composables/useModuleRepair.d.ts +6 -0
- package/dist/src/enums/dynamic-content.d.ts +3 -0
- package/dist/src/stores/module-dynamic-content.d.ts +30 -0
- package/dist/src/utils/dynamicContentConverter.d.ts +20 -18
- package/dist/src/utils/dynamicContentPendingMarker.d.ts +2 -0
- package/dist/src/utils/genericUtil.d.ts +4 -8
- package/dist/stores/module-dynamic-content.js +20 -0
- package/dist/utils/dynamicContentConverter.js +41 -27
- package/dist/utils/dynamicContentPendingMarker.js +6 -0
- package/dist/utils/genericUtil.js +39 -39
- package/package.json +1 -1
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
import { DATA_ATTRIBUTE_REGEX as
|
|
2
|
-
import { dynamicContentToMergeTags as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
return o.
|
|
6
|
-
i.
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { DATA_ATTRIBUTE_REGEX as g, DYNAMIC_CONTENT_TAG_REGEX as A, ALLOWED_DYNAMIC_SYSTEM_TOKENS as T } from "../enums/html-validator.js";
|
|
2
|
+
import { dynamicContentToMergeTags as D } from "./genericUtil.js";
|
|
3
|
+
const f = "guidoDataMask", h = "EndDataMask", v = /guidoDataMask(\d+)EndDataMask/g, M = /^\d+_\d+_.+$/, d = (e) => e.trim().toLowerCase(), E = (e, n) => {
|
|
4
|
+
const t = [];
|
|
5
|
+
return e.replace(g, (o) => (t.push(o), `${f}${t.length - 1}${h}`)).replace(A, (o) => {
|
|
6
|
+
const i = o.slice(2, -2), c = i.indexOf("|"), l = c === -1 ? i : i.slice(0, c);
|
|
7
|
+
return n({ tag: o, inner: i, pipeIndex: c, namePart: l, name: l.trim() });
|
|
8
|
+
}).replace(v, (o, i) => t[Number(i)]);
|
|
9
|
+
}, _ = (e, n) => e.pipeIndex !== -1 ? `{{${e.namePart.replace(e.name, () => n)}${e.inner.slice(e.pipeIndex)}}}` : D([{ text: e.name, value: n }])[0].value, w = (e) => {
|
|
10
|
+
const n = /* @__PURE__ */ new Map();
|
|
11
|
+
return e.forEach((t) => {
|
|
12
|
+
new Set([t.text, t.tagText].map(d)).forEach((s) => {
|
|
13
|
+
if (!s)
|
|
14
|
+
return;
|
|
15
|
+
let a = n.get(s);
|
|
16
|
+
a || (a = [], n.set(s, a)), a.some((o) => o.value === t.value) || a.push(t);
|
|
9
17
|
});
|
|
10
|
-
}),
|
|
11
|
-
},
|
|
12
|
-
const s = /* @__PURE__ */ new Set(), a = new
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
}), n;
|
|
19
|
+
}, x = (e, n, t = []) => {
|
|
20
|
+
const s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
21
|
+
...[...n.values()].flat().map((c) => c.value),
|
|
22
|
+
...t
|
|
23
|
+
]);
|
|
24
|
+
return { html: E(e, (c) => {
|
|
25
|
+
const { tag: l, name: r } = c;
|
|
26
|
+
if (r === "" || T.includes(r) || r.includes(".") || M.test(r) || o.has(r))
|
|
27
|
+
return l;
|
|
28
|
+
const m = d(r), u = n.get(m) ?? [];
|
|
29
|
+
if (u.length === 1)
|
|
30
|
+
return _(c, u[0].value);
|
|
31
|
+
if (u.length > 1) {
|
|
32
|
+
const p = a.get(m) ?? { label: r, spellings: [], candidates: u };
|
|
33
|
+
return p.spellings.includes(r) || p.spellings.push(r), a.set(m, p), l;
|
|
24
34
|
}
|
|
25
|
-
return s.add(
|
|
26
|
-
})
|
|
27
|
-
}
|
|
35
|
+
return s.add(r), l;
|
|
36
|
+
}), unresolved: [...s], ambiguous: [...a.values()] };
|
|
37
|
+
}, I = (e, n) => E(e, (t) => {
|
|
38
|
+
const s = n.get(t.name);
|
|
39
|
+
return s ? _(t, s) : t.tag;
|
|
40
|
+
});
|
|
28
41
|
export {
|
|
29
|
-
I as
|
|
30
|
-
w as
|
|
42
|
+
I as applyDynamicContentChoices,
|
|
43
|
+
w as buildDynamicContentLookup,
|
|
44
|
+
x as convertModuleDynamicContent
|
|
31
45
|
};
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { formatToLiquidFilter as
|
|
2
|
-
const
|
|
1
|
+
import { formatToLiquidFilter as y, liquidFilterToFormat as g, quoteArgument as m } from "./liquidDynamicContent.js";
|
|
2
|
+
const v = (t) => {
|
|
3
3
|
if (!t.includes("="))
|
|
4
4
|
return null;
|
|
5
5
|
const [r, e] = t.split("=");
|
|
6
6
|
return { key: r.trim(), value: e.trim() };
|
|
7
|
-
},
|
|
8
|
-
if (!t.startsWith(
|
|
7
|
+
}, u = "default:", i = (t) => {
|
|
8
|
+
if (!t.startsWith(u))
|
|
9
9
|
return t;
|
|
10
|
-
const r = t.slice(
|
|
10
|
+
const r = t.slice(u.length).trim(), e = (n) => r.length >= 2 && r.startsWith(n) && r.endsWith(n);
|
|
11
11
|
return e('"') || e("'") ? r.slice(1, -1) : r;
|
|
12
|
-
},
|
|
13
|
-
const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [
|
|
12
|
+
}, $ = (t) => {
|
|
13
|
+
const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [n] = e, s = {
|
|
14
14
|
text: t.label,
|
|
15
|
-
value:
|
|
15
|
+
value: n || ""
|
|
16
16
|
};
|
|
17
17
|
if (e.length >= 2) {
|
|
18
|
-
const [, a,
|
|
19
|
-
if (a.startsWith(
|
|
20
|
-
s.fallback =
|
|
18
|
+
const [, a, o] = e;
|
|
19
|
+
if (a.startsWith(u))
|
|
20
|
+
s.fallback = i(a);
|
|
21
21
|
else {
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const l = g(a) ?? v(a);
|
|
23
|
+
l ? s.format = l : o || (s.fallback = a), o && (s.fallback = i(o));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
return s;
|
|
27
|
+
}, h = (t) => {
|
|
28
|
+
const e = !Number.isNaN(Number(t)) && t.trim() !== "" ? t : m(t);
|
|
29
|
+
return e === null ? null : `${u} ${e}`;
|
|
27
30
|
}, p = (t) => {
|
|
28
|
-
const
|
|
29
|
-
return e === null ? null : `${c} ${e}`;
|
|
30
|
-
}, v = (t) => {
|
|
31
|
-
const r = t.format ? b(t.format) : null, e = t.fallback ? p(t.fallback) : null, l = [t.value, r, e].filter(Boolean);
|
|
31
|
+
const r = t.format ? y(t.format) : null, e = t.fallback ? h(t.fallback) : null, n = [t.value, r, e].filter(Boolean);
|
|
32
32
|
return {
|
|
33
33
|
label: [t.text, r, e && t.fallback].filter(Boolean).join(" | "),
|
|
34
|
-
value: `{{ ${
|
|
34
|
+
value: `{{ ${n.join(" | ")} }}`
|
|
35
35
|
};
|
|
36
|
-
},
|
|
36
|
+
}, b = (t, r = !1) => t.map((e) => r ? p(e) : e.format ? {
|
|
37
37
|
label: `${e.text} | ${e.format.key}=${e.format.value}`,
|
|
38
38
|
value: `{{${e.value}|${e.format.key}=${e.format.value}}}`
|
|
39
39
|
} : {
|
|
40
40
|
label: e.fallback ? `${e.text} | ${e.fallback}` : e.text,
|
|
41
41
|
value: e.fallback ? `{{${e.value}|${e.fallback}}}` : `{{${e.value}}}`
|
|
42
|
-
}),
|
|
43
|
-
const r = [], e = /* @__PURE__ */ new Set(),
|
|
44
|
-
Array.isArray(a) && a.forEach((
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
42
|
+
}), k = (t) => {
|
|
43
|
+
const r = [], e = /* @__PURE__ */ new Set(), n = (a, o) => {
|
|
44
|
+
Array.isArray(a) && a.forEach((l) => {
|
|
45
|
+
const f = [...l.children ?? [], ...l.select_items ?? []], c = l.text || l.tag_text;
|
|
46
|
+
if (f.length > 0) {
|
|
47
|
+
n(f, c ? [...o, c] : o);
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
u && n.value && !e.has(n.value) && (e.add(n.value), r.push({ text: u, value: n.value }));
|
|
50
|
+
c && l.value && !e.has(l.value) && (e.add(l.value), r.push({ value: l.value, text: c, tagText: l.tag_text || c, path: o }));
|
|
52
51
|
});
|
|
53
52
|
}, [s] = Object.values(t ?? {});
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
const
|
|
53
|
+
return n(s, []), r;
|
|
54
|
+
}, x = (t) => k(t).map(({ text: r, value: e }) => ({ text: r, value: e })), T = (t, r, e = !1) => {
|
|
55
|
+
const n = new Set(t.map((a) => a.value)), s = r.filter((a) => n.has(a.value) ? !1 : (n.add(a.value), !0));
|
|
57
56
|
return [
|
|
58
|
-
...
|
|
59
|
-
...
|
|
57
|
+
...b(t, e),
|
|
58
|
+
...b(s, e)
|
|
60
59
|
];
|
|
61
60
|
}, F = () => {
|
|
62
61
|
var t;
|
|
63
62
|
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
64
|
-
},
|
|
63
|
+
}, P = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", j = (t) => {
|
|
65
64
|
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
66
65
|
return !1;
|
|
67
66
|
const r = Object.getPrototypeOf(t);
|
|
68
67
|
return r === Object.prototype || r === null;
|
|
69
68
|
};
|
|
70
69
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
P as asText,
|
|
71
|
+
T as buildMergeTagEntries,
|
|
72
|
+
b as dynamicContentToMergeTags,
|
|
73
|
+
k as flattenDynamicContentCandidates,
|
|
74
|
+
x as flattenDynamicContentList,
|
|
75
75
|
F as getCsrfToken,
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
j as isPlainObject,
|
|
77
|
+
$ as mergeTagToDynamicContent
|
|
78
78
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.27.0-beta.
|
|
3
|
+
"version": "3.27.0-beta.ee85b86",
|
|
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",
|