@useinsider/guido 3.18.0-beta.dc6c376 → 3.18.0-beta.fda7e92
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/package.json.js
CHANGED
|
@@ -1,72 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
if (!t.includes("="))
|
|
4
|
-
return null;
|
|
5
|
-
const [e, a] = t.split("=");
|
|
6
|
-
return { key: e.trim(), value: a.trim() };
|
|
7
|
-
}, c = "default:", f = (t) => {
|
|
8
|
-
if (!t.startsWith(c))
|
|
9
|
-
return t;
|
|
10
|
-
const e = t.slice(c.length).trim(), a = (l) => e.length >= 2 && e.startsWith(l) && e.endsWith(l);
|
|
11
|
-
return a('"') || a("'") ? e.slice(1, -1) : e;
|
|
12
|
-
}, $ = (t) => {
|
|
13
|
-
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((r) => r.trim()), [l] = a, s = {
|
|
1
|
+
const o = (t) => {
|
|
2
|
+
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
|
|
14
3
|
text: t.label,
|
|
15
|
-
value:
|
|
4
|
+
value: s || ""
|
|
16
5
|
};
|
|
17
6
|
if (a.length >= 2) {
|
|
18
|
-
const [,
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
const [, l, e] = a;
|
|
8
|
+
if (l.startsWith("default:")) {
|
|
9
|
+
let n = l.slice(8).trim();
|
|
10
|
+
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
|
+
} else {
|
|
12
|
+
const n = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : e || (r.fallback = l), e && (r.fallback = e);
|
|
24
14
|
}
|
|
25
15
|
}
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
16
|
+
return r;
|
|
17
|
+
}, f = (t, c = !1) => t.map((a) => {
|
|
18
|
+
if (a.format)
|
|
19
|
+
return {
|
|
20
|
+
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
21
|
+
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
22
|
+
};
|
|
23
|
+
if (c) {
|
|
24
|
+
if (!a.fallback)
|
|
25
|
+
return {
|
|
26
|
+
label: a.text,
|
|
27
|
+
value: `{{ ${a.value} }}`
|
|
28
|
+
};
|
|
29
|
+
const r = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
|
|
30
|
+
return {
|
|
31
|
+
label: `${a.text} | ${a.fallback}`,
|
|
32
|
+
value: `{{ ${a.value} | default: ${r} }}`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
32
35
|
return {
|
|
33
|
-
label:
|
|
34
|
-
value: `{{
|
|
36
|
+
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
37
|
+
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
35
38
|
};
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}), d = (t) => {
|
|
43
|
-
const e = [], a = /* @__PURE__ */ new Set(), l = (r) => {
|
|
44
|
-
Array.isArray(r) && r.forEach((n) => {
|
|
45
|
-
const o = [...n.children ?? [], ...n.select_items ?? []];
|
|
46
|
-
if (o.length > 0) {
|
|
47
|
-
l(o);
|
|
39
|
+
}), b = (t) => {
|
|
40
|
+
const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
|
|
41
|
+
Array.isArray(l) && l.forEach((e) => {
|
|
42
|
+
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
|
+
if (n.length > 0) {
|
|
44
|
+
s(n);
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
|
-
const u =
|
|
51
|
-
u &&
|
|
47
|
+
const u = e.text || e.tag_text;
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
|
|
52
49
|
});
|
|
53
|
-
}, [
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
const
|
|
50
|
+
}, [r] = Object.values(t ?? {});
|
|
51
|
+
return s(r), c;
|
|
52
|
+
}, i = (t, c, a = !1) => {
|
|
53
|
+
const s = new Set(t.map((l) => l.value)), r = c.filter((l) => s.has(l.value) ? !1 : (s.add(l.value), !0));
|
|
57
54
|
return [
|
|
58
|
-
...
|
|
59
|
-
...
|
|
55
|
+
...f(t, a),
|
|
56
|
+
...f(r, a)
|
|
60
57
|
];
|
|
61
|
-
},
|
|
58
|
+
}, v = () => {
|
|
62
59
|
var t;
|
|
63
60
|
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
64
|
-
},
|
|
61
|
+
}, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
|
|
65
62
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
k as asText,
|
|
64
|
+
i as buildMergeTagEntries,
|
|
65
|
+
f as dynamicContentToMergeTags,
|
|
66
|
+
b as flattenDynamicContentList,
|
|
67
|
+
v as getCsrfToken,
|
|
68
|
+
o as mergeTagToDynamicContent
|
|
72
69
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.18.0-beta.
|
|
3
|
+
"version": "3.18.0-beta.fda7e92",
|
|
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",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
},
|
|
119
119
|
"guido": {
|
|
120
120
|
"stripo": {
|
|
121
|
-
"version": "2.
|
|
121
|
+
"version": "2.73.0"
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { BaseDynamicContent } from '@@/Types/generic';
|
|
2
|
-
export type DynamicContentFormat = NonNullable<BaseDynamicContent['format']>;
|
|
3
|
-
/** Format key the dynamic-content picker sends for a custom date/time format. */
|
|
4
|
-
export declare const TIME_FORMAT_KEY = "time-format";
|
|
5
|
-
/** Wraps a Liquid filter argument in whichever quote style the value itself does not use. */
|
|
6
|
-
export declare const quoteArgument: (value: string) => string | null;
|
|
7
|
-
/**
|
|
8
|
-
* `{ key: 'time-format', value: '%Y-%m-%d' }` -> `date: "%Y-%m-%d"`.
|
|
9
|
-
*
|
|
10
|
-
* Only a custom date/time strftime pattern has a Liquid equivalent. Anything else returns null so
|
|
11
|
-
* the caller emits a plain tag rather than one that silently lost — or literally printed — its
|
|
12
|
-
* format.
|
|
13
|
-
* @example formatToLiquidFilter({ key: 'time-format', value: '%b %-d, %Y' }) -> date: "%b %-d, %Y"
|
|
14
|
-
*/
|
|
15
|
-
export declare const formatToLiquidFilter: (format: DynamicContentFormat) => string | null;
|
|
16
|
-
/**
|
|
17
|
-
* Inverse of `formatToLiquidFilter` — reads the picker format back out of one filter segment, so a
|
|
18
|
-
* reopened tag restores its selection in the host's format dropdown.
|
|
19
|
-
*/
|
|
20
|
-
export declare const liquidFilterToFormat: (segment: string) => DynamicContentFormat | null;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const E = "time-format", r = "date", u = new RegExp(`^${r}\\s*:\\s*(?:"([^"]*)"|'([^']*)')$`), s = /%[-_0^#]?\d*[a-zA-Z%]/, c = new RegExp(s, "g"), l = /\b(?:Y{2,4}|M{2,4}|D{1,4}|d{3,4}|H{2}|h{2}|m{2}|s{2}|S{1,3}|A|a)\b/, T = (t) => t.includes('"') ? t.includes("'") ? null : `'${t}'` : `"${t}"`, i = (t) => s.test(t) && !l.test(t.replace(c, "")), R = (t) => {
|
|
2
|
-
if (t.key !== E || !i(t.value ?? ""))
|
|
3
|
-
return null;
|
|
4
|
-
const n = T(t.value);
|
|
5
|
-
return n === null ? null : `${r}: ${n}`;
|
|
6
|
-
}, _ = (t) => {
|
|
7
|
-
const [, n, o] = t.match(u) ?? [], e = n ?? o;
|
|
8
|
-
return e ? { key: E, value: e } : null;
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
E as TIME_FORMAT_KEY,
|
|
12
|
-
R as formatToLiquidFilter,
|
|
13
|
-
_ as liquidFilterToFormat,
|
|
14
|
-
T as quoteArgument
|
|
15
|
-
};
|