@useinsider/guido 3.24.0-beta.adaba3e → 3.24.0-beta.b9ec78b
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 +6 -2
- package/dist/@types/config/schemas.js +37 -39
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +92 -98
- package/dist/composables/useBlocksConfig.js +20 -31
- package/dist/composables/useHtmlCompiler.js +2 -0
- package/dist/composables/useStripo.js +70 -70
- package/dist/composables/useTranslations.js +1 -2
- package/dist/config/compiler/htmlCompilerRules.js +14 -6
- package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
- package/dist/config/migrator/unsubscribeMigrator.js +94 -98
- package/dist/enums/academy.js +0 -1
- package/dist/extensions/Blocks/Unsubscribe/block.js +104 -96
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +4 -3
- package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +5 -0
- package/dist/guido.css +1 -1
- 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 +4 -4
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useStripo.d.ts +1 -1
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +1 -0
- package/dist/src/stores/config.d.ts +0 -167
- package/dist/src/utils/linkTrackingIds.d.ts +5 -22
- package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
- package/dist/stores/config.js +6 -13
- package/dist/utils/linkTrackingIds.js +48 -82
- package/dist/utils/pairProductVariables.js +29 -30
- package/dist/utils/templatePreparation.js +57 -67
- package/dist/utils/trimHrefWhitespace.js +10 -0
- package/package.json +1 -1
- package/dist/@types/display-condition.js +0 -25
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -18
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
- 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 -117
- package/dist/enums/display-condition.js +0 -12
- package/dist/extensions/DisplayConditions/bridge.js +0 -25
- package/dist/extensions/DisplayConditions/constants.js +0 -17
- package/dist/extensions/DisplayConditions/control.js +0 -200
- 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 -30
- package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
- package/dist/extensions/LinkTracking/extension.js +0 -17
- package/dist/extensions/LinkTracking/writer.js +0 -41
- 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 -18
- package/dist/src/enums/display-condition.d.ts +0 -15
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
- package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
- package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
- 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/extensions/LinkTracking/extension.d.ts +0 -2
- package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
- 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 -84
- package/dist/src/utils/displayCondition.d.ts +0 -11
- package/dist/src/utils/protectTableText.d.ts +0 -2
- package/dist/stores/display-condition.js +0 -29
- package/dist/utils/displayCondition.js +0 -26
- package/dist/utils/protectTableText.js +0 -22
|
@@ -2,35 +2,34 @@ import { ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as Y } from "../extens
|
|
|
2
2
|
import { productPairs as M } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
3
|
import { escapeReplacement as B } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
4
|
import { preserveTextStyles as L } from "./preserveTextStyles.js";
|
|
5
|
-
import {
|
|
6
|
-
import { unwrapProductNameLinks as j } from "./unwrapProductNameLink.js";
|
|
5
|
+
import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
|
|
7
6
|
const q = {
|
|
8
7
|
CART_ITEMS: "ins_apr",
|
|
9
8
|
BROWSED_ITEMS: "browsed_item",
|
|
10
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
11
10
|
}, W = ($) => $.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
12
|
-
function
|
|
11
|
+
function v($, C, A) {
|
|
13
12
|
let d = C;
|
|
14
13
|
for (; d > 0 && /\s/.test($[d - 1]); )
|
|
15
14
|
d -= 1;
|
|
16
15
|
return A.some((E) => $.endsWith(E, d));
|
|
17
16
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
17
|
+
const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
|
|
18
|
+
function Q($, C) {
|
|
20
19
|
var d;
|
|
21
20
|
const A = $.ownerDocument.createTreeWalker($, NodeFilter.SHOW_COMMENT);
|
|
22
21
|
for (let E = A.nextNode(); E; E = A.nextNode())
|
|
23
|
-
(d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(
|
|
22
|
+
(d = E.nodeValue) != null && d.includes("[if mso]") && (E.nodeValue = E.nodeValue.replace(j, (k, P) => `${P}href="${C}"`));
|
|
24
23
|
}
|
|
25
|
-
function
|
|
26
|
-
const C = W(
|
|
27
|
-
|
|
24
|
+
function et($) {
|
|
25
|
+
const C = W($), A = new DOMParser().parseFromString(C, "text/html");
|
|
26
|
+
X(A);
|
|
28
27
|
const d = M.PAIRS_FOR_EXTENSION;
|
|
29
28
|
Object.entries(d).forEach(([o, p]) => {
|
|
30
29
|
A.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
31
30
|
const _ = r.getAttribute("data-number") || "1", y = r.getAttribute("data-type") || "CART_ITEMS";
|
|
32
31
|
r.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
|
|
33
|
-
var
|
|
32
|
+
var S, I, O, x;
|
|
34
33
|
const m = t.getAttribute("data-type") || y, n = t.getAttribute("data-number") || _, f = p[m];
|
|
35
34
|
if (f)
|
|
36
35
|
switch (o) {
|
|
@@ -46,12 +45,12 @@ function ot($) {
|
|
|
46
45
|
return a.includes(g) || a.includes(u) || H === u;
|
|
47
46
|
}) && (e.src = `{{${c}_${n}}}`);
|
|
48
47
|
}
|
|
49
|
-
const i = (I = (
|
|
48
|
+
const i = (I = (S = d.name) == null ? void 0 : S[m]) == null ? void 0 : I.ATTR;
|
|
50
49
|
if (i && e.setAttribute("alt", `{{${i}_${n}}}`), s) {
|
|
51
|
-
const a = (
|
|
50
|
+
const a = (O = d.itemLink) == null ? void 0 : O[m];
|
|
52
51
|
if (a) {
|
|
53
|
-
const
|
|
54
|
-
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(g) || u === `${window.location.href}${g}` || !u || u === window.location.href) && (s.href = `{{${
|
|
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}}}`);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
break;
|
|
@@ -61,25 +60,25 @@ function ot($) {
|
|
|
61
60
|
t.textContent && (t.innerHTML = L(t, `{{${s}_${n}}}`));
|
|
62
61
|
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
63
62
|
if (i && c) {
|
|
64
|
-
const a = i.href,
|
|
65
|
-
(a ===
|
|
63
|
+
const a = i.href, b = `${window.location.href}${l}`;
|
|
64
|
+
(a === b || a.endsWith(l)) && (i.href = `{{${c}_${n}}}`);
|
|
66
65
|
}
|
|
67
66
|
break;
|
|
68
67
|
}
|
|
69
68
|
case "price":
|
|
70
69
|
case "originalPrice": {
|
|
71
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";
|
|
72
|
-
let
|
|
73
|
-
i ?
|
|
71
|
+
let b;
|
|
72
|
+
i ? b = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : b = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
74
73
|
const g = e.CURRENCY;
|
|
75
|
-
let u = `{{${
|
|
74
|
+
let u = `{{${b}_${n}}}`;
|
|
76
75
|
const H = (t.getAttribute(U.SYMBOL) || "").trim(), G = Y(H);
|
|
77
76
|
let F = "";
|
|
78
77
|
G ? F = H : g && (F = `{{${g}_${n}}}`), F && (u = a === "after" ? `${u} ${F}` : `${F} ${u}`), t.innerHTML = L(t, u);
|
|
79
78
|
break;
|
|
80
79
|
}
|
|
81
80
|
case "quantity": {
|
|
82
|
-
const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (
|
|
81
|
+
const e = f, s = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (x = t.textContent) == null ? void 0 : x.trim();
|
|
83
82
|
c && l.includes(c) && (t.innerHTML = L(t, `{{${s}_${n}}}`));
|
|
84
83
|
break;
|
|
85
84
|
}
|
|
@@ -89,7 +88,7 @@ function ot($) {
|
|
|
89
88
|
const i = c.href || "", a = `${window.location.href}${l}`;
|
|
90
89
|
(i === "" || i === "#" || i === a || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${s}_${n}}}`);
|
|
91
90
|
}
|
|
92
|
-
|
|
91
|
+
Q(t, `{{${s}_${n}}}`);
|
|
93
92
|
break;
|
|
94
93
|
}
|
|
95
94
|
case "itemLink": {
|
|
@@ -130,30 +129,30 @@ function ot($) {
|
|
|
130
129
|
h = h.replace(o, B(n));
|
|
131
130
|
}
|
|
132
131
|
});
|
|
133
|
-
const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(),
|
|
132
|
+
const V = A.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set();
|
|
134
133
|
return V.forEach((o) => {
|
|
135
134
|
var t;
|
|
136
135
|
const p = o.getAttribute("data-number"), T = o.getAttribute("data-type");
|
|
137
136
|
if (!p || !q[T])
|
|
138
137
|
return;
|
|
139
138
|
const r = o.closest(".product-original-price-class");
|
|
140
|
-
if (!r ||
|
|
139
|
+
if (!r || D.has(r))
|
|
141
140
|
return;
|
|
142
|
-
|
|
141
|
+
D.add(r);
|
|
143
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: [] };
|
|
144
143
|
R.wrap.push(y !== "false"), w.set(_, R);
|
|
145
144
|
}), w.forEach(({ number: o, type: p, wrap: T }, r) => {
|
|
146
145
|
if (r.includes("{% if") || !T.some(Boolean))
|
|
147
146
|
return;
|
|
148
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)];
|
|
149
|
-
let m = "", n = 0, f = 0,
|
|
150
|
-
for (;
|
|
151
|
-
const I = T[f] === !0 && !
|
|
152
|
-
m += h.slice(n,
|
|
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);
|
|
153
152
|
}
|
|
154
153
|
h = m + h.slice(n);
|
|
155
|
-
}),
|
|
154
|
+
}), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
156
155
|
}
|
|
157
156
|
export {
|
|
158
|
-
|
|
157
|
+
et as pairProductVariables
|
|
159
158
|
};
|
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
import { useActionsApi as E } from "../composables/useActionsApi.js";
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { toBlockUrlConfig as
|
|
6
|
-
import { DATA_ATTRIBUTES as
|
|
7
|
-
import { parsePageList as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
o && e.push(...v(o));
|
|
2
|
+
import { useConfig as F } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as I } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { toBlockUrlConfig as R } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
6
|
+
import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
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
|
+
const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
|
|
15
|
+
return r.forEach((i) => {
|
|
16
|
+
const t = i.getAttribute(g.PAGE_LIST);
|
|
17
|
+
t && e.push(...U(t));
|
|
19
18
|
}), [...new Set(e)];
|
|
20
19
|
}
|
|
21
|
-
async function
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
20
|
+
async function S(n) {
|
|
21
|
+
const o = new DOMParser().parseFromString(n, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (o.length === 0)
|
|
24
23
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
if (!Number.isFinite(
|
|
24
|
+
const r = b();
|
|
25
|
+
o.forEach((e) => {
|
|
26
|
+
const i = e.getAttribute("recommendation-id"), t = i ? Number(i) : NaN;
|
|
27
|
+
if (!Number.isFinite(t))
|
|
29
28
|
return;
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
29
|
+
const m = e.getAttribute("esd-ext-config");
|
|
30
|
+
if (!m)
|
|
32
31
|
return;
|
|
33
|
-
let
|
|
32
|
+
let a;
|
|
34
33
|
try {
|
|
35
|
-
|
|
34
|
+
a = JSON.parse(m);
|
|
36
35
|
} catch {
|
|
37
36
|
return;
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
z(a) && r.seedBlockUrlConfig(t, R(a));
|
|
40
39
|
});
|
|
41
40
|
try {
|
|
42
|
-
await
|
|
41
|
+
await r.fetchRecommendationCreateData();
|
|
43
42
|
} catch (e) {
|
|
44
43
|
console.warn(
|
|
45
44
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -47,63 +46,54 @@ async function w(c) {
|
|
|
47
46
|
);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
|
-
const
|
|
51
|
-
const
|
|
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();
|
|
52
51
|
return {
|
|
53
|
-
prepareTemplateDetails: async (
|
|
54
|
-
let { html:
|
|
55
|
-
if (
|
|
52
|
+
prepareTemplateDetails: async (h) => {
|
|
53
|
+
let { html: s, css: u, syncModulesIds: y = [] } = h ?? await e();
|
|
54
|
+
if (a("linkTrackingIds"))
|
|
56
55
|
try {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const h = await e().catch((x) => (console.warn(
|
|
62
|
-
"Tracking-id re-read failed, saving the planned ids without a replacement:",
|
|
63
|
-
x
|
|
64
|
-
), null));
|
|
65
|
-
h ? ({ html: r, css: u, syncModulesIds: g = [] } = h, t = T(r, n.trackIdSessionFloor), n.trackIdSessionFloor = t.plan.nextSeq, p = t.plan.changed) : p = !1;
|
|
66
|
-
}
|
|
67
|
-
t.plan.changed && (r = B(r, t)), p && await s(r, u);
|
|
68
|
-
} catch (t) {
|
|
69
|
-
console.error("Tracking-id step failed, saving anyway:", t);
|
|
56
|
+
const { html: d, changed: x, nextSeq: D } = M(s, c.trackIdSessionFloor);
|
|
57
|
+
c.trackIdSessionFloor = D, x && (s = d, await i(d, u));
|
|
58
|
+
} catch (d) {
|
|
59
|
+
console.error("Tracking-id step failed, saving anyway:", d);
|
|
70
60
|
}
|
|
71
|
-
const { html:
|
|
61
|
+
const { html: T, ampHtml: p = "", ampErrors: A = [] } = await r({
|
|
72
62
|
minimize: !0,
|
|
73
63
|
resetDataSavedFlag: !1
|
|
74
64
|
});
|
|
75
|
-
|
|
76
|
-
const { compiledHtml:
|
|
65
|
+
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(s);
|
|
66
|
+
const { compiledHtml: w, stats: l, appliedRules: C } = t(T), H = p && m(p).compiledHtml, k = n.getSelectedDynamicContentList, P = b(), f = O(s);
|
|
77
67
|
return console.debug("HTML Compilation Stats:", {
|
|
78
|
-
originalSize:
|
|
79
|
-
compiledSize:
|
|
80
|
-
reduction: `${
|
|
81
|
-
appliedRules:
|
|
82
|
-
executionTime: `${
|
|
68
|
+
originalSize: l.originalSize,
|
|
69
|
+
compiledSize: l.compiledSize,
|
|
70
|
+
reduction: `${l.reductionPercentage.toFixed(2)}%`,
|
|
71
|
+
appliedRules: C,
|
|
72
|
+
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
83
73
|
}), {
|
|
84
|
-
dynamicContentList:
|
|
85
|
-
compiledHtml:
|
|
86
|
-
rawHtml:
|
|
74
|
+
dynamicContentList: k,
|
|
75
|
+
compiledHtml: w,
|
|
76
|
+
rawHtml: s,
|
|
87
77
|
css: u,
|
|
88
78
|
ampHtml: H,
|
|
89
|
-
ampErrors:
|
|
90
|
-
modules:
|
|
79
|
+
ampErrors: A,
|
|
80
|
+
modules: y.map(Number),
|
|
91
81
|
recommendation: {
|
|
92
|
-
campaignUrls:
|
|
82
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
93
83
|
configs: {}
|
|
94
84
|
},
|
|
95
85
|
unsubscribe: {
|
|
96
|
-
status:
|
|
97
|
-
config:
|
|
86
|
+
status: f.length > 0,
|
|
87
|
+
config: f
|
|
98
88
|
}
|
|
99
89
|
};
|
|
100
90
|
},
|
|
101
91
|
// Exposed so the back/test validate-only path can seed the reco store the
|
|
102
92
|
// same way a full save does (required-field findings depend on it).
|
|
103
|
-
hydrateRecommendationStore:
|
|
93
|
+
hydrateRecommendationStore: S
|
|
104
94
|
};
|
|
105
95
|
};
|
|
106
96
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
98
|
+
Z as useTemplatePreparation
|
|
109
99
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const E = /(<[a-z][\w:-]*(?:\s[^>]*?)?\shref\s*=\s*)(["'])([\s\S]*?)\2/gi, c = /^(?:\s| | | )+|(?:\s| | | )+$/gi;
|
|
2
|
+
function a(e) {
|
|
3
|
+
return !e || !/href/i.test(e) ? e : e.replace(E, (i, s, r, n) => {
|
|
4
|
+
const t = n.replace(c, "");
|
|
5
|
+
return `${s}${r}${t}${r}`;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
a as trimHrefWhitespace
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.24.0-beta.
|
|
3
|
+
"version": "3.24.0-beta.b9ec78b",
|
|
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",
|
|
@@ -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,18 +0,0 @@
|
|
|
1
|
-
import t from "./CodeEditorField.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var s = 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: o.onInput, ready: o.onReady } })], 1);
|
|
7
|
-
}, a = [], d = /* @__PURE__ */ i(
|
|
8
|
-
t,
|
|
9
|
-
s,
|
|
10
|
-
a,
|
|
11
|
-
!1,
|
|
12
|
-
null,
|
|
13
|
-
"c262cac4"
|
|
14
|
-
);
|
|
15
|
-
const p = d.exports;
|
|
16
|
-
export {
|
|
17
|
-
p as default
|
|
18
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { defineComponent as f, computed as m, nextTick as _ } from "vue";
|
|
2
|
-
import { InCodeSnippet as I } from "@useinsider/design-system-vue";
|
|
3
|
-
const S = /* @__PURE__ */ f({
|
|
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(r, { expose: a, emit: n }) {
|
|
15
|
-
const l = r, u = 700;
|
|
16
|
-
let t = null, e = null;
|
|
17
|
-
const d = m(() => ({
|
|
18
|
-
mode: "liquid",
|
|
19
|
-
lint: !1,
|
|
20
|
-
foldGutter: !1,
|
|
21
|
-
placeholder: l.placeholder
|
|
22
|
-
})), p = (o) => {
|
|
23
|
-
t = o;
|
|
24
|
-
}, s = (o) => {
|
|
25
|
-
n("input", o), e == null || e();
|
|
26
|
-
}, i = () => new Promise((o) => {
|
|
27
|
-
if (!t || t.state.doc.toString() === l.value) {
|
|
28
|
-
o(l.value);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const c = setTimeout(() => e == null ? void 0 : e(), u);
|
|
32
|
-
e = () => {
|
|
33
|
-
clearTimeout(c), e = null, _(() => o(l.value));
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
return a({ read: i }), { __sfc: !0, props: l, emit: n, SANITIZED_INPUT_WAIT_MS: u, view: t, settleRead: e, options: d, onReady: p, onInput: s, read: i, InCodeSnippet: I };
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
export {
|
|
40
|
-
S as default
|
|
41
|
-
};
|
|
@@ -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
|
-
"cf448043"
|
|
26
|
-
);
|
|
27
|
-
const f = d.exports;
|
|
28
|
-
export {
|
|
29
|
-
f as default
|
|
30
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { defineComponent as w, reactive as L, ref as c, computed as u, watch as N } from "vue";
|
|
2
|
-
import R from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useDisplayConditions as k, DISPLAY_CONDITIONS_TRANS_KEY as i } from "../../../composables/useDisplayConditions.js";
|
|
4
|
-
import { useTranslations as Y } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { DISPLAY_CONDITION_LIMITS as j } from "../../../enums/display-condition.js";
|
|
6
|
-
import { useDisplayConditionStore as E } from "../../../stores/display-condition.js";
|
|
7
|
-
import { InRadioButton as P, InBasicTextInput as F } from "@useinsider/design-system-vue";
|
|
8
|
-
import G from "./CodeEditorField.vue.js";
|
|
9
|
-
const Z = /* @__PURE__ */ w({
|
|
10
|
-
__name: "DisplayConditionCreateDrawer",
|
|
11
|
-
setup(K) {
|
|
12
|
-
const n = Y(), p = E(), {
|
|
13
|
-
validate: v,
|
|
14
|
-
notifyInvalid: f,
|
|
15
|
-
createInline: y,
|
|
16
|
-
createAndSave: _,
|
|
17
|
-
cancel: b,
|
|
18
|
-
describeWithAcademyLink: B
|
|
19
|
-
} = k(), m = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = L(m()), o = c({}), r = c(!1), l = c(!1), s = u(() => r.value || l.value), g = c(), I = c();
|
|
20
|
-
let d = 0;
|
|
21
|
-
N(() => p.isCreateOpen, (a) => {
|
|
22
|
-
if (d += 1, !a)
|
|
23
|
-
return;
|
|
24
|
-
const { editing: t } = p;
|
|
25
|
-
Object.assign(e, t ? {
|
|
26
|
-
name: t.name,
|
|
27
|
-
description: t.description,
|
|
28
|
-
codeBefore: t.beforeScript,
|
|
29
|
-
codeAfter: t.afterScript
|
|
30
|
-
} : m()), o.value = {}, r.value = !1;
|
|
31
|
-
}, { immediate: !0 });
|
|
32
|
-
const C = u(() => B("create-description")), D = u(() => ({
|
|
33
|
-
cancelOrBackButton: {
|
|
34
|
-
styling: "ghost",
|
|
35
|
-
type: "secondary",
|
|
36
|
-
labelText: n(`${i}.cancel`),
|
|
37
|
-
disabledStatus: s.value
|
|
38
|
-
},
|
|
39
|
-
secondaryButton: {
|
|
40
|
-
styling: "solid",
|
|
41
|
-
type: "subtle-primary",
|
|
42
|
-
labelText: n(`${i}.create-and-save`),
|
|
43
|
-
loadingStatus: r.value
|
|
44
|
-
},
|
|
45
|
-
primaryButton: {
|
|
46
|
-
styling: "solid",
|
|
47
|
-
type: "primary",
|
|
48
|
-
labelText: n(`${i}.create`),
|
|
49
|
-
disabledStatus: s.value
|
|
50
|
-
}
|
|
51
|
-
})), O = (a, t) => {
|
|
52
|
-
t !== e[a] && (e[a] = t, o.value[a] && (o.value = { ...o.value, [a]: void 0 }));
|
|
53
|
-
}, T = u(() => `${n(`${i}.condition-description`)} <span class="guido-display-condition-create__optional">(${n(`${i}.optional`)})</span>`);
|
|
54
|
-
return { __sfc: !0, trans: n, store: p, validate: v, notifyInvalid: f, createInline: y, createAndSave: _, cancel: b, describeWithAcademyLink: B, emptyDraft: m, draft: e, errors: o, isSaving: r, isReadingCode: l, isBusy: s, codeBeforeRef: g, codeAfterRef: I, openGeneration: d, descriptionText: C, footerButtonGroupOptions: D, updateField: O, descriptionLabel: T, submit: async (a) => {
|
|
55
|
-
var S, A;
|
|
56
|
-
if (s.value)
|
|
57
|
-
return;
|
|
58
|
-
const t = d;
|
|
59
|
-
l.value = !0;
|
|
60
|
-
const [$, x] = await Promise.all([(S = g.value) == null ? void 0 : S.read(), (A = I.value) == null ? void 0 : A.read()]);
|
|
61
|
-
if (l.value = !1, t !== d)
|
|
62
|
-
return;
|
|
63
|
-
if (e.codeBefore = $ ?? e.codeBefore, e.codeAfter = x ?? e.codeAfter, o.value = v(e), Object.keys(o.value).length) {
|
|
64
|
-
f();
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (a === "inline") {
|
|
68
|
-
y({ ...e });
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
r.value = !0;
|
|
72
|
-
const h = await _({ ...e });
|
|
73
|
-
r.value = !1, o.value = h ?? {}, Object.keys(o.value).length && f();
|
|
74
|
-
}, close: () => {
|
|
75
|
-
s.value || b();
|
|
76
|
-
}, WpDrawer: R, KEY: i, DISPLAY_CONDITION_LIMITS: j, InBasicTextInput: F, InRadioButton: P, CodeEditorField: G };
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
export {
|
|
80
|
-
Z as default
|
|
81
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import a from "./DisplayConditionSelectDrawer.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import d from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var o = function() {
|
|
5
|
-
var s = this, i = s._self._c, t = s._self._setupProxy;
|
|
6
|
-
return i("div", { staticClass: "guido-display-condition-select-root" }, [i(t.WpDrawer, { attrs: { id: "guido__display-condition-select-drawer", "description-status": "", "class-name": "guido-display-condition-select-drawer", size: "large", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isSelectOpen, "title-text": t.trans(`${t.KEY}.select-title`) }, on: { cancelOrBackButtonEvent: t.cancel, onCloseEvent: t.cancel } }, [i("div", { staticClass: "guido-display-condition-select d-f f-d-c f-g-1" }, [t.store.listStatus === "loaded" && t.store.list.length ? i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "label-status": !1, "placeholder-text": t.trans(`${t.KEY}.search`), "tooltip-status": !1, value: t.search }, on: { input: function(e) {
|
|
7
|
-
t.search = e;
|
|
8
|
-
} } }) : s._e(), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? i("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(t.SKELETON_HEIGHTS, function(e, n) {
|
|
9
|
-
return i(t.InSkeleton, { key: n, attrs: { sizing: { width: 856, height: e } } });
|
|
10
|
-
}), 1) : t.store.listStatus === "error" ? i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-error", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.retry`), description: t.trans(`${t.KEY}.error-load`), title: t.trans(`${t.KEY}.error-load-title`) }, on: { click: t.loadList } }) : t.store.list.length ? t.filteredList.length ? i("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(e) {
|
|
11
|
-
return i("li", { key: e.id, staticClass: "guido-display-condition-card", attrs: { "data-condition-id": e.id } }, [i("div", { staticClass: "guido-display-condition-card__header" }, [i("div", { staticClass: "guido-display-condition-card__text" }, [i("p", { staticClass: "guido-display-condition-card__name" }, [s._v(" " + s._s(e.name) + " ")]), e.description ? i("p", { staticClass: "guido-display-condition-card__description" }, [s._v(" " + s._s(e.description) + " ")]) : s._e()]), i("div", { staticClass: "guido-display-condition-card__actions" }, [i("div", { staticClass: "guido-display-condition-card__split" }, [i(t.InButtonV2, { attrs: { id: `guido__display-condition-select-${e.id}`, type: "subtle-primary", "label-text": t.trans(`${t.KEY}.select`) }, on: { click: function(n) {
|
|
12
|
-
return t.select(e);
|
|
13
|
-
} } }), i(t.InButtonV2, { attrs: { id: `guido__display-condition-menu-${e.id}`, "left-icon": "filled-dropdown-down", type: "subtle-primary", "label-text-status": !1 }, on: { click: function(n) {
|
|
14
|
-
return t.toggleMenu(e);
|
|
15
|
-
} } }), t.menuId === e.id ? i("div", { staticClass: "guido-display-condition-card__menu" }, [i("button", { staticClass: "guido-display-condition-card__menu-item", attrs: { id: `guido__display-condition-delete-${e.id}`, type: "button" }, on: { click: function(n) {
|
|
16
|
-
return t.requestDelete(e);
|
|
17
|
-
} } }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete`)) + " ")])]) : s._e()], 1), i("span", { staticClass: "guido-display-condition-card__divider" }), i("button", { staticClass: "guido-display-condition-card__expand", attrs: { id: `guido__display-condition-expand-${e.id}`, type: "button", "aria-expanded": t.expandedId === e.id ? "true" : "false", "aria-label": t.trans(`${t.KEY}.preview`) }, on: { click: function(n) {
|
|
18
|
-
return t.toggleExpanded(e);
|
|
19
|
-
} } }, [i(t.InIcons, { attrs: { name: t.expandedId === e.id ? "filled-dropdown-up" : "filled-dropdown-down" } })], 1)])]), t.expandedId === e.id ? i("pre", { staticClass: "guido-display-condition-card__code" }, [s._v(s._s(t.codeOf(e)))]) : s._e()]);
|
|
20
|
-
}), 0) : i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-personalization", "button-text": t.trans(`${t.KEY}.create-new`), description: t.trans(`${t.KEY}.empty-description`), title: t.trans(`${t.KEY}.empty-title`) }, on: { click: function(e) {
|
|
21
|
-
return t.store.openCreate();
|
|
22
|
-
} } })], 1)]), t.store.pendingDelete ? i("div", { staticClass: "guido-display-condition-select__delete-modal" }, [i(t.WpModal, { attrs: { id: "guido__display-condition-delete-modal", size: "X-small", state: "danger", "close-on-outside-click": !1, "footer-button-options": t.deleteModalButtons, title: t.trans(`${t.KEY}.delete-confirm-title`) }, on: { close: t.closeDeleteModal, "primary-action": t.confirmDelete } }, [i("p", { staticClass: "guido-display-condition-select__delete-text" }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete-confirm-description`, { name: t.store.pendingDelete.name })) + " ")])])], 1) : s._e()], 1);
|
|
23
|
-
}, l = [], c = /* @__PURE__ */ d(
|
|
24
|
-
a,
|
|
25
|
-
o,
|
|
26
|
-
l,
|
|
27
|
-
!1,
|
|
28
|
-
null,
|
|
29
|
-
"21acc8d8"
|
|
30
|
-
);
|
|
31
|
-
const f = c.exports;
|
|
32
|
-
export {
|
|
33
|
-
f as default
|
|
34
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineComponent as x, ref as a, watch as D, computed as r, onBeforeUnmount as M } from "vue";
|
|
2
|
-
import b from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import h from "../../wrappers/WpModal.vue.js";
|
|
4
|
-
import { useDisplayConditions as C, DISPLAY_CONDITIONS_TRANS_KEY as c } from "../../../composables/useDisplayConditions.js";
|
|
5
|
-
import { useTranslations as w } from "../../../composables/useTranslations.js";
|
|
6
|
-
import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
|
|
7
|
-
import { InSkeleton as A, InNoData as N, InIcons as $, InButtonV2 as K, InBasicTextInput as P } from "@useinsider/design-system-vue";
|
|
8
|
-
const Q = /* @__PURE__ */ x({
|
|
9
|
-
__name: "DisplayConditionSelectDrawer",
|
|
10
|
-
setup(W) {
|
|
11
|
-
const I = [40, 76, 76, 76], l = w(), t = k(), { loadList: m, select: y, deleteSaved: f, cancel: _, describeWithAcademyLink: v } = C(), u = a(""), i = a(null), n = a(null), o = a(!1);
|
|
12
|
-
D(() => t.isSelectOpen, (e) => {
|
|
13
|
-
e && (u.value = "", i.value = null, n.value = null, m());
|
|
14
|
-
}, { immediate: !0 });
|
|
15
|
-
const O = r(() => {
|
|
16
|
-
const e = u.value.trim().toLocaleLowerCase();
|
|
17
|
-
return e ? t.list.filter((d) => `${d.name} ${d.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
18
|
-
}), S = r(() => v("select-description")), B = r(() => ({
|
|
19
|
-
cancelOrBackButton: {
|
|
20
|
-
styling: "ghost",
|
|
21
|
-
type: "secondary",
|
|
22
|
-
labelText: l(`${c}.back`),
|
|
23
|
-
leftIcon: "line-arrow-left"
|
|
24
|
-
}
|
|
25
|
-
})), L = r(() => ({
|
|
26
|
-
cancelOrBackButton: {
|
|
27
|
-
type: "secondary",
|
|
28
|
-
styling: "ghost",
|
|
29
|
-
labelText: l(`${c}.cancel`),
|
|
30
|
-
disabledStatus: o.value
|
|
31
|
-
},
|
|
32
|
-
primaryButton: {
|
|
33
|
-
type: "danger",
|
|
34
|
-
labelText: l(`${c}.delete`),
|
|
35
|
-
loadingStatus: o.value
|
|
36
|
-
}
|
|
37
|
-
})), E = (e) => {
|
|
38
|
-
i.value = i.value === e.id ? null : e.id;
|
|
39
|
-
}, T = (e) => {
|
|
40
|
-
n.value = n.value === e.id ? null : e.id;
|
|
41
|
-
}, s = (e) => {
|
|
42
|
-
e.composedPath().some((p) => {
|
|
43
|
-
var g;
|
|
44
|
-
return p instanceof Element && p.matches(".guido-display-condition-card__split") && ((g = p.closest(".guido-display-condition-card")) == null ? void 0 : g.getAttribute("data-condition-id")) === String(n.value);
|
|
45
|
-
}) || (n.value = null);
|
|
46
|
-
};
|
|
47
|
-
return D(n, (e) => {
|
|
48
|
-
e === null ? document.removeEventListener("pointerdown", s, !0) : document.addEventListener("pointerdown", s, !0);
|
|
49
|
-
}), M(() => {
|
|
50
|
-
document.removeEventListener("pointerdown", s, !0);
|
|
51
|
-
}), { __sfc: !0, SKELETON_HEIGHTS: I, trans: l, store: t, loadList: m, select: y, deleteSaved: f, cancel: _, describeWithAcademyLink: v, search: u, expandedId: i, menuId: n, isDeleting: o, filteredList: O, descriptionText: S, footerButtonGroupOptions: B, deleteModalButtons: L, toggleExpanded: E, toggleMenu: T, closeMenuOnOutsidePointer: s, requestDelete: (e) => {
|
|
52
|
-
n.value = null, t.pendingDelete = e;
|
|
53
|
-
}, confirmDelete: async () => {
|
|
54
|
-
!t.pendingDelete || o.value || (o.value = !0, await f(t.pendingDelete), o.value = !1);
|
|
55
|
-
}, closeDeleteModal: () => {
|
|
56
|
-
o.value || (t.pendingDelete = null);
|
|
57
|
-
}, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
58
|
-
`), WpDrawer: b, WpModal: h, KEY: c, InBasicTextInput: P, InButtonV2: K, InIcons: $, InNoData: N, InSkeleton: A };
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
export {
|
|
62
|
-
Q as default
|
|
63
|
-
};
|