@useinsider/guido 3.17.0-beta.3a4c221 → 3.17.0-beta.3deafbf
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 +5 -5
- package/dist/extensions/Blocks/Items/block.js +98 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
- package/dist/utils/genericUtil.js +54 -45
- package/dist/utils/pairProductVariables.js +60 -59
- package/package.json +2 -2
- package/dist/src/utils/dynamicContentFormat.d.ts +0 -26
- package/dist/utils/dynamicContentFormat.js +0 -37
|
@@ -1,59 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
const o = (l) => {
|
|
2
|
+
const a = l.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((t) => t.trim()), [c] = a, r = {
|
|
3
|
+
text: l.label,
|
|
4
|
+
value: c || ""
|
|
5
|
+
};
|
|
6
|
+
if (a.length >= 2) {
|
|
7
|
+
const [, t, e] = a;
|
|
8
|
+
if (t.startsWith("default:")) {
|
|
9
|
+
let n = t.slice(8).trim();
|
|
10
|
+
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
|
+
} else {
|
|
12
|
+
const n = t.includes("=") ? { key: t.split("=")[0].trim(), value: t.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : e || (r.fallback = t), e && (r.fallback = e);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return r;
|
|
17
|
+
}, f = (l, s = !1) => l.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 (s) {
|
|
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}"`;
|
|
18
30
|
return {
|
|
19
|
-
label:
|
|
20
|
-
value: r
|
|
31
|
+
label: `${a.text} | ${a.fallback}`,
|
|
32
|
+
value: `{{ ${a.value} | default: ${r} }}`
|
|
21
33
|
};
|
|
22
34
|
}
|
|
23
|
-
return
|
|
24
|
-
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
25
|
-
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
26
|
-
} : {
|
|
35
|
+
return {
|
|
27
36
|
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
28
37
|
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
29
38
|
};
|
|
30
|
-
}),
|
|
31
|
-
const
|
|
32
|
-
Array.isArray(
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
39
|
+
}), b = (l) => {
|
|
40
|
+
const s = [], a = /* @__PURE__ */ new Set(), c = (t) => {
|
|
41
|
+
Array.isArray(t) && t.forEach((e) => {
|
|
42
|
+
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
|
+
if (n.length > 0) {
|
|
44
|
+
c(n);
|
|
36
45
|
return;
|
|
37
46
|
}
|
|
38
|
-
const
|
|
39
|
-
|
|
47
|
+
const u = e.text || e.tag_text;
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), s.push({ text: u, value: e.value }));
|
|
40
49
|
});
|
|
41
|
-
}, [
|
|
42
|
-
return r
|
|
43
|
-
},
|
|
44
|
-
const
|
|
50
|
+
}, [r] = Object.values(l ?? {});
|
|
51
|
+
return c(r), s;
|
|
52
|
+
}, v = (l, s, a = !1) => {
|
|
53
|
+
const c = new Set(l.map((t) => t.value)), r = s.filter((t) => c.has(t.value) ? !1 : (c.add(t.value), !0));
|
|
45
54
|
return [
|
|
46
|
-
...
|
|
47
|
-
...
|
|
55
|
+
...f(l, a),
|
|
56
|
+
...f(r, a)
|
|
48
57
|
];
|
|
49
|
-
},
|
|
50
|
-
var
|
|
51
|
-
return ((
|
|
58
|
+
}, i = () => {
|
|
59
|
+
var l;
|
|
60
|
+
return ((l = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : l.getAttribute("content")) ?? "";
|
|
52
61
|
};
|
|
53
62
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
v as buildMergeTagEntries,
|
|
64
|
+
f as dynamicContentToMergeTags,
|
|
65
|
+
b as flattenDynamicContentList,
|
|
66
|
+
i as getCsrfToken,
|
|
67
|
+
o as mergeTagToDynamicContent
|
|
59
68
|
};
|
|
@@ -1,82 +1,83 @@
|
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as N } from "../extensions/Blocks/Items/constants/currency.js";
|
|
1
2
|
import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
-
import { DefaultConfigValues as
|
|
3
|
-
import { escapeReplacement as
|
|
3
|
+
import { DefaultConfigValues as G } from "../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
4
|
+
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
5
|
import { preserveTextStyles as F } from "./preserveTextStyles.js";
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
+
import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
|
|
6
7
|
const x = {
|
|
7
8
|
CART_ITEMS: "ins_apr",
|
|
8
9
|
BROWSED_ITEMS: "browsed_item",
|
|
9
10
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function v(S,
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
11
|
+
}, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
12
|
+
function v(S, I, b) {
|
|
13
|
+
let h = I;
|
|
14
|
+
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
15
|
+
h -= 1;
|
|
16
|
+
return b.some((P) => S.endsWith(P, h));
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
Object.entries(
|
|
22
|
-
|
|
18
|
+
function Z(S) {
|
|
19
|
+
const I = O(S), b = new DOMParser().parseFromString(I, "text/html");
|
|
20
|
+
Y(b);
|
|
21
|
+
const h = L.PAIRS_FOR_EXTENSION;
|
|
22
|
+
Object.entries(h).forEach(([n, d]) => {
|
|
23
|
+
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
24
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
25
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
26
|
+
var $, H, D;
|
|
27
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
|
|
28
|
+
if (u)
|
|
28
29
|
switch (n) {
|
|
29
30
|
case "imageSrc": {
|
|
30
31
|
let e = null, s = null;
|
|
31
32
|
if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
|
|
32
33
|
break;
|
|
33
|
-
const a =
|
|
34
|
+
const a = u.DEFAULT, l = u.ATTR;
|
|
34
35
|
if (a && e.src) {
|
|
35
36
|
const i = e.src;
|
|
36
|
-
a.some((
|
|
37
|
-
const
|
|
38
|
-
return i.includes(
|
|
37
|
+
a.some((_) => {
|
|
38
|
+
const f = _.split("/").pop() || "", C = i.split("/").pop() || "";
|
|
39
|
+
return i.includes(_) || i.includes(f) || C === f;
|
|
39
40
|
}) && (e.src = `{{${l}_${o}}}`);
|
|
40
41
|
}
|
|
41
|
-
const c = (
|
|
42
|
+
const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
|
|
42
43
|
if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
|
|
43
|
-
const i = (D =
|
|
44
|
+
const i = (D = h.itemLink) == null ? void 0 : D[g];
|
|
44
45
|
if (i) {
|
|
45
|
-
const
|
|
46
|
-
(
|
|
46
|
+
const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
|
|
47
|
+
(f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
break;
|
|
50
51
|
}
|
|
51
52
|
case "name": {
|
|
52
|
-
const e =
|
|
53
|
+
const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
|
|
53
54
|
t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
|
|
54
55
|
const c = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
56
|
if (c && l) {
|
|
56
|
-
const i = c.href,
|
|
57
|
-
(i ===
|
|
57
|
+
const i = c.href, R = `${window.location.href}${a}`;
|
|
58
|
+
(i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
|
|
58
59
|
}
|
|
59
60
|
break;
|
|
60
61
|
}
|
|
61
62
|
case "price":
|
|
62
63
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
c ?
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
69
|
-
let
|
|
70
|
-
|
|
64
|
+
const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(N.POSITION) || "before";
|
|
65
|
+
let R;
|
|
66
|
+
c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
|
|
67
|
+
const _ = e.CURRENCY;
|
|
68
|
+
let f = `{{${R}_${o}}}`;
|
|
69
|
+
const C = (t.getAttribute(N.SYMBOL) || "").trim(), V = C !== "" && C !== G.productPriceCurrencySymbolControlValue;
|
|
70
|
+
let y = "";
|
|
71
|
+
V ? y = C : _ && (y = `{{${_}_${o}}}`), y && (f = i === "after" ? `${f} ${y}` : `${y} ${f}`), t.innerHTML = F(t, f);
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
73
74
|
case "quantity": {
|
|
74
|
-
const e =
|
|
75
|
+
const e = u, s = e.ATTR, a = e.DEFAULT;
|
|
75
76
|
t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
79
|
case "button": {
|
|
79
|
-
const e =
|
|
80
|
+
const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
81
|
if (l) {
|
|
81
82
|
const c = l.href || "", i = `${window.location.href}${a}`;
|
|
82
83
|
(c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
|
|
@@ -84,7 +85,7 @@ function J(S) {
|
|
|
84
85
|
break;
|
|
85
86
|
}
|
|
86
87
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
88
|
+
const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
|
|
88
89
|
if (l.href) {
|
|
89
90
|
const c = l.href, i = `${window.location.href}${a}`;
|
|
90
91
|
(c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
|
|
@@ -92,8 +93,8 @@ function J(S) {
|
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
94
95
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
96
|
+
if ("ATTR" in u) {
|
|
97
|
+
const e = u.ATTR;
|
|
97
98
|
t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
|
|
98
99
|
}
|
|
99
100
|
break;
|
|
@@ -102,9 +103,9 @@ function J(S) {
|
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
105
|
});
|
|
105
|
-
const
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
106
|
+
const P = I.match(/<!DOCTYPE[^>]*>/i), q = P ? `${P[0]}
|
|
107
|
+
` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
|
|
108
|
+
U.forEach((n) => {
|
|
108
109
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
110
|
M.push({
|
|
110
111
|
element: n,
|
|
@@ -113,16 +114,16 @@ function J(S) {
|
|
|
113
114
|
number: p
|
|
114
115
|
});
|
|
115
116
|
});
|
|
116
|
-
let A =
|
|
117
|
+
let A = q + b.documentElement.outerHTML;
|
|
117
118
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
119
|
const r = x[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
120
|
if (E) {
|
|
120
|
-
const
|
|
121
|
-
A = A.replace(n,
|
|
121
|
+
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
122
|
+
A = A.replace(n, X(o));
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
125
|
+
const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
126
|
+
return W.forEach((n) => {
|
|
126
127
|
var t;
|
|
127
128
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
129
|
if (!d || !x[p])
|
|
@@ -131,20 +132,20 @@ function J(S) {
|
|
|
131
132
|
if (!r || k.has(r))
|
|
132
133
|
return;
|
|
133
134
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"),
|
|
135
|
-
|
|
135
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = w.get(E) ?? { number: d, type: p, wrap: [] };
|
|
136
|
+
T.wrap.push(m !== "false"), w.set(E, T);
|
|
136
137
|
}), w.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
138
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
139
|
return;
|
|
139
|
-
const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE,
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
140
|
+
const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, O(T)];
|
|
141
|
+
let g = "", o = 0, u = 0, $ = A.indexOf(r);
|
|
142
|
+
for (; $ !== -1; ) {
|
|
143
|
+
const H = p[u] === !0 && !v(A, $, t);
|
|
144
|
+
g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
|
|
144
145
|
}
|
|
145
|
-
A =
|
|
146
|
+
A = g + A.slice(o);
|
|
146
147
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
148
|
}
|
|
148
149
|
export {
|
|
149
|
-
|
|
150
|
+
Z as pairProductVariables
|
|
150
151
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.17.0-beta.
|
|
3
|
+
"version": "3.17.0-beta.3deafbf",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"start": "vite",
|
|
26
26
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
|
|
27
27
|
"preview": "vite preview",
|
|
28
|
-
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ &&
|
|
28
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
|
|
29
29
|
"lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
|
|
30
30
|
"lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
|
|
31
31
|
"lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { BaseDynamicContent } from '@@/Types/generic';
|
|
2
|
-
/** Format key the dynamic-content picker sends for a custom date/time format. */
|
|
3
|
-
export declare const TIME_FORMAT_KEY = "time-format";
|
|
4
|
-
/** Liquid filter that renders a date/time value in a custom pattern. */
|
|
5
|
-
export declare const TIME_FORMAT_FILTER = "time_format";
|
|
6
|
-
/** Liquid filter that renders a fallback when the value is empty. */
|
|
7
|
-
export declare const DEFAULT_FILTER = "default";
|
|
8
|
-
export type DynamicContentFormat = NonNullable<BaseDynamicContent['format']>;
|
|
9
|
-
/** Unwraps a quoted Liquid literal — the exact inverse of `toLiquidLiteral`. */
|
|
10
|
-
export declare const stripQuotes: (literal: string) => string;
|
|
11
|
-
/** Liquid string literal — numbers stay unquoted so `default: 0` keeps its type. */
|
|
12
|
-
export declare const toLiquidLiteral: (value: string) => string;
|
|
13
|
-
/** `{ key: 'time-format', value: 'YYYY-MM-DD' }` → `time_format: "YYYY-MM-DD"`, or null when the format has no Liquid filter. */
|
|
14
|
-
export declare const formatToLiquidFilter: (format: DynamicContentFormat | undefined) => string | null;
|
|
15
|
-
/** Inverse of `formatToLiquidFilter` — reads the picker format back out of one filter segment. */
|
|
16
|
-
export declare const liquidFilterToFormat: (segment: string) => DynamicContentFormat | null;
|
|
17
|
-
/**
|
|
18
|
-
* `{{ signup_date | time_format: "YYYY-MM-DD" | default: "-" }}`. Returns null when
|
|
19
|
-
* the format has no Liquid filter, so the caller keeps the legacy tag instead of
|
|
20
|
-
* emitting a tag that silently lost its format.
|
|
21
|
-
*/
|
|
22
|
-
export declare const buildLiquidTag: ({ value, format, fallback }: BaseDynamicContent) => string | null;
|
|
23
|
-
/** Whether one `{{ … }}` segment is a `default:` filter. */
|
|
24
|
-
export declare const isLiquidDefaultFilter: (segment: string) => boolean;
|
|
25
|
-
/** Reads the fallback out of a `default: "…"` filter segment. */
|
|
26
|
-
export declare const readLiquidDefault: (segment: string) => string;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const l = "time-format", _ = "time_format", s = "default", u = {
|
|
2
|
-
[l]: _
|
|
3
|
-
}, F = Object.fromEntries(
|
|
4
|
-
Object.entries(u).map(([t, e]) => [e, t])
|
|
5
|
-
), L = /^([a-z_]+)\s*:\s*(.+)$/, r = (t) => {
|
|
6
|
-
const e = t.slice(0, 1);
|
|
7
|
-
return (e === '"' || e === "'") && t.endsWith(e) && t.length > 1 ? t.slice(1, -1).replace(/\\(["'\\])/g, "$1") : t;
|
|
8
|
-
}, o = (t) => !Number.isNaN(Number(t)) && t.trim() !== "" ? t : `"${t.replace(/(["\\])/g, "\\$1")}"`, T = (t) => {
|
|
9
|
-
const e = t != null && t.key ? u[t.key] : void 0;
|
|
10
|
-
return !e || !(t != null && t.value) ? null : `${e}: ${o(t.value)}`;
|
|
11
|
-
}, E = (t) => {
|
|
12
|
-
const e = t.trim().match(L);
|
|
13
|
-
if (!e)
|
|
14
|
-
return null;
|
|
15
|
-
const i = F[e[1]];
|
|
16
|
-
return i ? { key: i, value: r(e[2].trim()) } : null;
|
|
17
|
-
}, d = ({ value: t, format: e, fallback: i }) => {
|
|
18
|
-
const n = T(e);
|
|
19
|
-
if (e && !n)
|
|
20
|
-
return null;
|
|
21
|
-
const c = [n];
|
|
22
|
-
return i && c.push(`${s}: ${o(i)}`), `{{ ${[t, ...c.filter(Boolean)].join(" | ")} }}`;
|
|
23
|
-
}, I = (t) => t.startsWith(`${s}:`), $ = (t) => r(
|
|
24
|
-
t.slice(`${s}:`.length).trim()
|
|
25
|
-
);
|
|
26
|
-
export {
|
|
27
|
-
s as DEFAULT_FILTER,
|
|
28
|
-
_ as TIME_FORMAT_FILTER,
|
|
29
|
-
l as TIME_FORMAT_KEY,
|
|
30
|
-
d as buildLiquidTag,
|
|
31
|
-
T as formatToLiquidFilter,
|
|
32
|
-
I as isLiquidDefaultFilter,
|
|
33
|
-
E as liquidFilterToFormat,
|
|
34
|
-
$ as readLiquidDefault,
|
|
35
|
-
r as stripQuotes,
|
|
36
|
-
o as toLiquidLiteral
|
|
37
|
-
};
|