@useinsider/guido 3.28.1-beta.d3309a6 → 3.28.1-beta.ff58f9a
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 +0 -10
- package/dist/@types/config/schemas.js +129 -142
- package/dist/@types/display-condition.js +21 -45
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +19 -25
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +55 -77
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +43 -62
- package/dist/composables/useDisplayConditions.js +68 -83
- package/dist/enums/html-validator.js +1 -1
- package/dist/extensions/DisplayConditions/constants.js +10 -19
- package/dist/extensions/DisplayConditions/control.js +99 -120
- package/dist/extensions/DisplayConditions/display-conditions.css.js +6 -58
- package/dist/extensions/DisplayConditions/extension.js +14 -18
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +102 -118
- package/dist/package.json.js +1 -1
- package/dist/services/displayConditionApi.js +19 -18
- package/dist/src/@types/config/schemas.d.ts +0 -65
- package/dist/src/@types/display-condition.d.ts +0 -67
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +2 -42
- package/dist/src/composables/useDisplayConditions.d.ts +1 -1
- package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -2
- package/dist/src/extensions/DisplayConditions/control.d.ts +0 -1
- package/dist/src/stores/config.d.ts +21 -441
- package/package.json +2 -2
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue.js +0 -18
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue2.js +0 -25
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue.js +0 -28
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue2.js +0 -28
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue.js +0 -30
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue2.js +0 -32
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue.js +0 -28
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue2.js +0 -60
- package/dist/composables/useScrollToInvalid.js +0 -15
- package/dist/src/components/organisms/display-conditions/LogicBuilderConnector.vue.d.ts +0 -19
- package/dist/src/components/organisms/display-conditions/LogicBuilderField.vue.d.ts +0 -22
- package/dist/src/components/organisms/display-conditions/LogicBuilderGroup.vue.d.ts +0 -24
- package/dist/src/components/organisms/display-conditions/LogicBuilderRow.vue.d.ts +0 -25
- package/dist/src/composables/useScrollToInvalid.d.ts +0 -6
- package/dist/src/utils/displayConditionBuilder.d.ts +0 -29
- package/dist/src/utils/displayConditionRules.d.ts +0 -12
- package/dist/src/utils/displayConditionSummary.d.ts +0 -11
- package/dist/utils/displayConditionBuilder.js +0 -50
- package/dist/utils/displayConditionRules.js +0 -91
- package/dist/utils/displayConditionSummary.js +0 -28
|
@@ -1,103 +1,81 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useDisplayConditions as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import { readLogicBuilderRules as X } from "../../../utils/displayConditionRules.js";
|
|
11
|
-
import { InRadioButton as Z, InBasicTextInput as ee } from "@useinsider/design-system-vue";
|
|
12
|
-
import te from "./CodeEditorField.vue.js";
|
|
13
|
-
import oe from "./LogicBuilderField.vue.js";
|
|
14
|
-
const be = /* @__PURE__ */ j({
|
|
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({
|
|
15
10
|
__name: "DisplayConditionCreateDrawer",
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
validate:
|
|
19
|
-
notifyInvalid:
|
|
20
|
-
createInline:
|
|
21
|
-
createAndSave:
|
|
22
|
-
cancel:
|
|
23
|
-
describeWithAcademyLink:
|
|
24
|
-
} =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
codeBefore: "",
|
|
29
|
-
codeAfter: "",
|
|
30
|
-
rules: null
|
|
31
|
-
}), e = P(v()), y = i(x()), B = i(!1), F = l(() => {
|
|
32
|
-
var t;
|
|
33
|
-
return ((t = S.template) == null ? void 0 : t.displayConditionAttributes) ?? { custom: [], default: [] };
|
|
34
|
-
}), g = l(() => e.method === "logicBuilder"), r = i({}), a = i(!1), d = i(!1), u = l(() => a.value || d.value), h = i(), D = i(), O = i(), { scrollToFirstInvalid: b } = q(O);
|
|
35
|
-
let f = 0;
|
|
36
|
-
G(() => p.isCreateOpen, (t) => {
|
|
37
|
-
if (f += 1, !t)
|
|
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)
|
|
38
23
|
return;
|
|
39
|
-
const { editing:
|
|
40
|
-
Object.assign(e,
|
|
41
|
-
name:
|
|
42
|
-
description:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} : {}), y.value = n ? U(n) : x(), B.value = !1, r.value = {}, a.value = !1;
|
|
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;
|
|
47
31
|
}, { immediate: !0 });
|
|
48
|
-
const
|
|
32
|
+
const C = u(() => B("create-description")), D = u(() => ({
|
|
49
33
|
cancelOrBackButton: {
|
|
50
34
|
styling: "ghost",
|
|
51
35
|
type: "secondary",
|
|
52
|
-
labelText:
|
|
53
|
-
disabledStatus:
|
|
36
|
+
labelText: n(`${i}.cancel`),
|
|
37
|
+
disabledStatus: s.value
|
|
54
38
|
},
|
|
55
39
|
secondaryButton: {
|
|
56
40
|
styling: "solid",
|
|
57
41
|
type: "subtle-primary",
|
|
58
|
-
labelText:
|
|
59
|
-
loadingStatus:
|
|
42
|
+
labelText: n(`${i}.create-and-save`),
|
|
43
|
+
loadingStatus: r.value
|
|
60
44
|
},
|
|
61
45
|
primaryButton: {
|
|
62
46
|
styling: "solid",
|
|
63
47
|
type: "primary",
|
|
64
|
-
labelText:
|
|
65
|
-
disabledStatus:
|
|
48
|
+
labelText: n(`${i}.create`),
|
|
49
|
+
disabledStatus: s.value
|
|
66
50
|
}
|
|
67
|
-
})),
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const t = f;
|
|
74
|
-
d.value = !0;
|
|
75
|
-
const [o, n] = await Promise.all([(L = h.value) == null ? void 0 : L.read(), (R = D.value) == null ? void 0 : R.read()]);
|
|
76
|
-
return d.value = !1, t !== f ? !1 : (e.codeBefore = o ?? e.codeBefore, e.codeAfter = n ?? e.codeAfter, !0);
|
|
77
|
-
};
|
|
78
|
-
return { __sfc: !0, trans: s, store: p, configStore: S, validate: I, notifyInvalid: m, createInline: _, createAndSave: A, cancel: C, describeWithAcademyLink: T, emptyDraft: v, draft: e, builder: y, showRuleErrors: B, attributes: F, isLogicBuilder: g, errors: r, isSaving: a, isReadingCode: d, isBusy: u, codeBeforeRef: h, codeAfterRef: D, contentRef: O, scrollToFirstInvalid: b, openGeneration: f, descriptionText: $, footerButtonGroupOptions: N, updateField: k, descriptionLabel: E, selectMethod: Y, readCode: w, submit: async (t) => {
|
|
79
|
-
if (u.value)
|
|
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 t-c-53">(${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)
|
|
80
57
|
return;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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)
|
|
84
62
|
return;
|
|
85
|
-
if (
|
|
86
|
-
|
|
63
|
+
if (e.codeBefore = $ ?? e.codeBefore, e.codeAfter = x ?? e.codeAfter, o.value = v(e), Object.keys(o.value).length) {
|
|
64
|
+
f();
|
|
87
65
|
return;
|
|
88
66
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
67
|
+
if (a === "inline") {
|
|
68
|
+
y({ ...e });
|
|
91
69
|
return;
|
|
92
70
|
}
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
71
|
+
r.value = !0;
|
|
72
|
+
const h = await _({ ...e });
|
|
73
|
+
r.value = !1, o.value = h ?? {}, Object.keys(o.value).length && f();
|
|
96
74
|
}, close: () => {
|
|
97
|
-
|
|
98
|
-
}, WpDrawer:
|
|
75
|
+
s.value || b();
|
|
76
|
+
}, WpDrawer: R, KEY: i, DISPLAY_CONDITION_LIMITS: j, InBasicTextInput: F, InRadioButton: P, CodeEditorField: G };
|
|
99
77
|
}
|
|
100
78
|
});
|
|
101
79
|
export {
|
|
102
|
-
|
|
80
|
+
Z as default
|
|
103
81
|
};
|
|
@@ -1,82 +1,63 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useDisplayConditions as
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import { InSkeleton as U, InDropdownMenu as V, InButtonV2 as X, InBasicTextInput as J } from "@useinsider/design-system-vue";
|
|
12
|
-
import Q from "./DisplayConditionListState.vue.js";
|
|
13
|
-
const me = /* @__PURE__ */ b({
|
|
1
|
+
import { defineComponent as T, ref as r, watch as I, computed as i } from "vue";
|
|
2
|
+
import O from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import B from "../../wrappers/WpModal.vue.js";
|
|
4
|
+
import { useDisplayConditions as L, DISPLAY_CONDITIONS_TRANS_KEY as s } from "../../../composables/useDisplayConditions.js";
|
|
5
|
+
import { useTranslations as M } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useDisplayConditionStore as h } from "../../../stores/display-condition.js";
|
|
7
|
+
import { getTooltipOptions as C } from "../../../utils/tooltipUtils.js";
|
|
8
|
+
import { InSkeleton as $, InDropdownMenu as E, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
|
|
9
|
+
import w from "./DisplayConditionListState.vue.js";
|
|
10
|
+
const ee = /* @__PURE__ */ T({
|
|
14
11
|
__name: "DisplayConditionSelectDrawer",
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
e && (
|
|
12
|
+
setup(A) {
|
|
13
|
+
const g = [40, 76, 76, 76], l = M(), t = h(), { loadList: c, select: v, deleteSaved: d, cancel: D, describeWithAcademyLink: p } = L(), u = r(""), a = r(null), n = r(null), o = r(!1);
|
|
14
|
+
I(() => t.isSelectOpen, (e) => {
|
|
15
|
+
e && (u.value = "", a.value = null, n.value = null, c());
|
|
19
16
|
}, { immediate: !0 });
|
|
20
|
-
const
|
|
21
|
-
const e =
|
|
22
|
-
return e ? t.list.filter((
|
|
23
|
-
}),
|
|
17
|
+
const f = i(() => {
|
|
18
|
+
const e = u.value.trim().toLocaleLowerCase();
|
|
19
|
+
return e ? t.list.filter((m) => `${m.name} ${m.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
20
|
+
}), y = i(() => t.listStatus === "error" ? "error" : t.list.length ? f.value.length ? null : "no-result" : "empty"), _ = i(() => p("select-description")), S = i(() => ({
|
|
24
21
|
cancelOrBackButton: {
|
|
25
22
|
styling: "ghost",
|
|
26
23
|
type: "secondary",
|
|
27
|
-
labelText:
|
|
24
|
+
labelText: l(`${s}.back`),
|
|
28
25
|
leftIcon: "line-arrow-left"
|
|
29
26
|
}
|
|
30
|
-
})),
|
|
27
|
+
})), x = i(() => ({
|
|
31
28
|
cancelOrBackButton: {
|
|
32
29
|
type: "secondary",
|
|
33
30
|
styling: "ghost",
|
|
34
|
-
labelText:
|
|
35
|
-
disabledStatus:
|
|
31
|
+
labelText: l(`${s}.cancel`),
|
|
32
|
+
disabledStatus: o.value
|
|
36
33
|
},
|
|
37
34
|
primaryButton: {
|
|
38
35
|
type: "danger",
|
|
39
|
-
labelText:
|
|
40
|
-
loadingStatus:
|
|
36
|
+
labelText: l(`${s}.delete`),
|
|
37
|
+
loadingStatus: o.value
|
|
41
38
|
}
|
|
42
|
-
}))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
}));
|
|
40
|
+
return { __sfc: !0, SKELETON_HEIGHTS: g, trans: l, store: t, loadList: c, select: v, deleteSaved: d, cancel: D, describeWithAcademyLink: p, search: u, expandedId: a, menuId: n, isDeleting: o, filteredList: f, listState: y, descriptionText: _, footerButtonGroupOptions: S, deleteModalButtons: x, toggleExpanded: (e) => {
|
|
41
|
+
a.value = a.value === e.id ? null : e.id;
|
|
42
|
+
}, toggleMenu: (e) => {
|
|
43
|
+
n.value = n.value === e.id ? null : e.id;
|
|
44
|
+
}, closeMenu: (e) => {
|
|
45
|
+
n.value === e.id && (n.value = null);
|
|
46
|
+
}, expandTooltip: (e) => C(
|
|
49
47
|
`guido__display-condition-expand-tooltip-${e.id}`,
|
|
50
48
|
{ staticPosition: "top right" }
|
|
51
|
-
),
|
|
52
|
-
{ text:
|
|
53
|
-
],
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
!t.pendingDelete ||
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
const s = G(e.codeBefore);
|
|
62
|
-
if (!s)
|
|
63
|
-
return null;
|
|
64
|
-
const r = (D = m.template) == null ? void 0 : D.displayConditionAttributes, _ = H(
|
|
65
|
-
s,
|
|
66
|
-
[...(r == null ? void 0 : r.custom) ?? [], ...(r == null ? void 0 : r.default) ?? []],
|
|
67
|
-
(u) => o(`${n}.operator-${q[u]}`)
|
|
68
|
-
);
|
|
69
|
-
return _.groups.map((u) => u.lines.join(`
|
|
70
|
-
${o(`${n}.${u.condition}`)} `)).join(`
|
|
71
|
-
|
|
72
|
-
${o(`${n}.${_.condition}`)}
|
|
73
|
-
|
|
74
|
-
`);
|
|
75
|
-
};
|
|
76
|
-
return { __sfc: !0, SKELETON_HEIGHTS: T, trans: o, store: t, configStore: m, loadList: f, select: $, deleteSaved: g, cancel: O, describeWithAcademyLink: v, search: p, expandedId: c, menuId: l, isDeleting: i, filteredList: y, listState: B, descriptionText: I, footerButtonGroupOptions: x, deleteModalButtons: C, toggleExpanded: L, toggleMenu: h, closeMenu: A, expandTooltip: E, menuOptions: M, requestDelete: R, confirmDelete: k, closeDeleteModal: N, summaryOf: S, codeOf: (e) => (e.method === "logicBuilder" ? S(e) : null) ?? [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
77
|
-
`), WpDrawer: K, WpModal: P, KEY: n, InBasicTextInput: J, InButtonV2: X, InDropdownMenu: V, InSkeleton: U, DisplayConditionListState: Q };
|
|
49
|
+
), menuOptions: (e) => [
|
|
50
|
+
{ text: l(`${s}.delete`), value: `guido__display-condition-delete-${e.id}` }
|
|
51
|
+
], requestDelete: (e) => {
|
|
52
|
+
n.value = null, t.pendingDelete = e;
|
|
53
|
+
}, confirmDelete: async () => {
|
|
54
|
+
!t.pendingDelete || o.value || (o.value = !0, await d(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: O, WpModal: B, KEY: s, InBasicTextInput: k, InButtonV2: b, InDropdownMenu: E, InSkeleton: $, DisplayConditionListState: w };
|
|
78
59
|
}
|
|
79
60
|
});
|
|
80
61
|
export {
|
|
81
|
-
|
|
62
|
+
ee as default
|
|
82
63
|
};
|
|
@@ -1,48 +1,34 @@
|
|
|
1
|
-
import { useToaster as
|
|
2
|
-
import { useTranslations as
|
|
3
|
-
import { ACADEMY_LINKS as
|
|
4
|
-
import { DisplayConditionSourceType as
|
|
5
|
-
import { ToasterTypeOptions as
|
|
6
|
-
import { useDisplayConditionApi as
|
|
1
|
+
import { useToaster as M } from "./useToaster.js";
|
|
2
|
+
import { useTranslations as x } from "./useTranslations.js";
|
|
3
|
+
import { ACADEMY_LINKS as L } from "../enums/academy.js";
|
|
4
|
+
import { DisplayConditionSourceType as y, DISPLAY_CONDITION_LIMITS as s, DisplayConditionEvent as I } from "../enums/display-condition.js";
|
|
5
|
+
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
6
|
+
import { useDisplayConditionApi as O } from "../services/displayConditionApi.js";
|
|
7
7
|
import { useConfigStore as q } from "../stores/config.js";
|
|
8
|
-
import { useDisplayConditionStore as
|
|
9
|
-
import { findInvalidCodeFields as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
import { useDisplayConditionStore as P } from "../stores/display-condition.js";
|
|
9
|
+
import { findInvalidCodeFields as Y, nextConditionId as w } from "../utils/displayCondition.js";
|
|
10
|
+
import { escapeHtml as R } from "../utils/htmlEscape.js";
|
|
11
|
+
import { computed as b } from "vue";
|
|
12
|
+
const B = "email-editor.display-conditions", i = B, F = 409, S = (n, m, r) => ({
|
|
13
|
+
id: w(),
|
|
14
|
+
name: n.name.trim(),
|
|
15
|
+
description: n.description.trim(),
|
|
16
|
+
beforeScript: n.codeBefore,
|
|
17
|
+
afterScript: n.codeAfter,
|
|
18
|
+
extraData: JSON.stringify(r === void 0 ? { source: m } : { source: m, savedId: r })
|
|
19
|
+
}), v = (n) => ({
|
|
20
|
+
name: n.name,
|
|
21
|
+
description: n.description,
|
|
22
|
+
codeBefore: n.codeBefore,
|
|
23
|
+
codeAfter: n.codeAfter
|
|
24
|
+
}), ne = () => {
|
|
25
|
+
const n = P(), m = q(), r = O(), o = x(), { showToaster: p } = M(), u = b(
|
|
26
|
+
() => m.isFeatureEnabled("liquidSyntax") ? "liquid" : "pongo"
|
|
27
|
+
), f = (e) => {
|
|
27
28
|
const t = { condition: e };
|
|
28
|
-
return document.dispatchEvent(new CustomEvent(
|
|
29
|
-
}, D = (
|
|
30
|
-
|
|
31
|
-
return e.method !== "logicBuilder" ? {
|
|
32
|
-
...s,
|
|
33
|
-
beforeScript: e.codeBefore,
|
|
34
|
-
afterScript: e.codeAfter,
|
|
35
|
-
extraData: JSON.stringify(f)
|
|
36
|
-
} : e.rules ? {
|
|
37
|
-
...s,
|
|
38
|
-
...k(e.rules, d.value, `dc${c}`),
|
|
39
|
-
extraData: JSON.stringify({ ...f, method: "logicBuilder", rules: e.rules })
|
|
40
|
-
} : null;
|
|
41
|
-
}, A = (e, t, r) => {
|
|
42
|
-
const c = D(e, t, r);
|
|
43
|
-
return c ? h(c) : !1;
|
|
44
|
-
}, g = () => {
|
|
45
|
-
n.view !== "none" && (document.dispatchEvent(new CustomEvent(C.CANCEL)), n.close());
|
|
29
|
+
return document.dispatchEvent(new CustomEvent(I.APPLY, { detail: t })), n.close(), t.applied === !0;
|
|
30
|
+
}, D = () => {
|
|
31
|
+
n.view !== "none" && (document.dispatchEvent(new CustomEvent(I.CANCEL)), n.close());
|
|
46
32
|
}, N = (e) => {
|
|
47
33
|
if (e.mode === "select") {
|
|
48
34
|
n.openSelect();
|
|
@@ -53,72 +39,71 @@ const w = "email-editor.display-conditions", i = w, K = 409, I = (n) => {
|
|
|
53
39
|
const e = ++n.listRequest;
|
|
54
40
|
n.listStatus = "loading";
|
|
55
41
|
try {
|
|
56
|
-
const t = await
|
|
42
|
+
const t = await r.list(u.value);
|
|
57
43
|
e === n.listRequest && (n.list = t, n.listStatus = "loaded");
|
|
58
44
|
} catch (t) {
|
|
59
45
|
console.warn("Display conditions could not be loaded.", t), e === n.listRequest && (n.listStatus = "error");
|
|
60
46
|
}
|
|
61
|
-
},
|
|
62
|
-
const t = {},
|
|
63
|
-
|
|
64
|
-
const { DESCRIPTION_MAX:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
e[s].trim() ? f.includes(s) ? t[s] = o(`${i}.error-code-invalid`) : e[s].length > a.CODE_MAX && (t[s] = o(`${i}.error-code-max`, { max: a.CODE_MAX })) : t[s] = o(`${i}.error-code-required`);
|
|
47
|
+
}, h = (e) => {
|
|
48
|
+
const t = {}, d = e.name.trim();
|
|
49
|
+
d ? d.length < s.NAME_MIN ? t.name = o(`${i}.error-name-min`, { min: s.NAME_MIN }) : d.length > s.NAME_MAX && (t.name = o(`${i}.error-name-max`, { max: s.NAME_MAX })) : t.name = o(`${i}.error-name-required`);
|
|
50
|
+
const { DESCRIPTION_MAX: C } = s;
|
|
51
|
+
e.description.trim().length > C && (t.description = o(`${i}.error-description-max`, { max: C }));
|
|
52
|
+
const g = Y(e.codeBefore, e.codeAfter, u.value);
|
|
53
|
+
return ["codeBefore", "codeAfter"].forEach((a) => {
|
|
54
|
+
e[a].trim() ? g.includes(a) ? t[a] = o(`${i}.error-code-invalid`) : e[a].length > s.CODE_MAX && (t[a] = o(`${i}.error-code-max`, { max: s.CODE_MAX })) : t[a] = o(`${i}.error-code-required`);
|
|
70
55
|
}), t;
|
|
71
|
-
},
|
|
72
|
-
p(e ? { type:
|
|
73
|
-
},
|
|
56
|
+
}, A = (e, t) => {
|
|
57
|
+
p(e ? { type: l.Success, message: t } : { type: l.Error, message: o("products.something-went-wrong") });
|
|
58
|
+
}, T = (e) => o(
|
|
74
59
|
`${i}.${e}`,
|
|
75
60
|
{
|
|
76
|
-
academyLink: `<a href="${
|
|
61
|
+
academyLink: `<a href="${L.EMAIL_DISPLAY_CONDITIONS}" target="_blank" style="color: #0A2ECC; text-decoration: underline;">${o(`${i}.academy`)}</a>`
|
|
77
62
|
}
|
|
78
|
-
),
|
|
79
|
-
p({ type:
|
|
80
|
-
},
|
|
81
|
-
e != null && e.authReported || (console.warn(t, e), p({ type:
|
|
63
|
+
), _ = () => {
|
|
64
|
+
p({ type: l.Error, message: o(`${i}.validation-failed`) });
|
|
65
|
+
}, c = (e) => ({ name: R(e) }), E = (e, t) => {
|
|
66
|
+
e != null && e.authReported || (console.warn(t, e), p({ type: l.Error, message: t }));
|
|
82
67
|
};
|
|
83
68
|
return {
|
|
84
|
-
syntax:
|
|
69
|
+
syntax: u,
|
|
85
70
|
handleOpen: N,
|
|
86
|
-
cancel:
|
|
71
|
+
cancel: D,
|
|
87
72
|
loadList: $,
|
|
88
|
-
validate:
|
|
89
|
-
notifyInvalid:
|
|
90
|
-
describeWithAcademyLink:
|
|
73
|
+
validate: h,
|
|
74
|
+
notifyInvalid: _,
|
|
75
|
+
describeWithAcademyLink: T,
|
|
91
76
|
createInline: (e) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
o(`${i}.created`,
|
|
77
|
+
A(
|
|
78
|
+
f(S(e, y.INLINE)),
|
|
79
|
+
o(`${i}.created`, c(e.name.trim()))
|
|
95
80
|
);
|
|
96
81
|
},
|
|
97
82
|
createAndSave: async (e) => {
|
|
98
83
|
try {
|
|
99
|
-
const t = await
|
|
100
|
-
return n.list = [t, ...n.list.filter((
|
|
101
|
-
|
|
102
|
-
o(`${i}.created-and-saved`,
|
|
84
|
+
const t = await r.create(e, u.value);
|
|
85
|
+
return n.list = [t, ...n.list.filter((d) => d.id !== t.id)], A(
|
|
86
|
+
f(S(v(t), y.SAVED, t.id)),
|
|
87
|
+
o(`${i}.created-and-saved`, c(t.name))
|
|
103
88
|
), {};
|
|
104
89
|
} catch (t) {
|
|
105
|
-
return (t == null ? void 0 : t.status) ===
|
|
90
|
+
return (t == null ? void 0 : t.status) === F ? { name: o(`${i}.error-name-exists`) } : (E(t, o(`${i}.save-failed`, c(e.name.trim()))), null);
|
|
106
91
|
}
|
|
107
92
|
},
|
|
108
93
|
select: (e) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
o(`${i}.applied`,
|
|
94
|
+
A(
|
|
95
|
+
f(S(v(e), y.SAVED, e.id)),
|
|
96
|
+
o(`${i}.applied`, c(e.name))
|
|
112
97
|
);
|
|
113
98
|
},
|
|
114
99
|
deleteSaved: async (e) => {
|
|
115
100
|
try {
|
|
116
|
-
await
|
|
117
|
-
type:
|
|
118
|
-
message: o(`${i}.deleted`,
|
|
101
|
+
await r.remove(e.id), n.list = n.list.filter((t) => t.id !== e.id), p({
|
|
102
|
+
type: l.Success,
|
|
103
|
+
message: o(`${i}.deleted`, c(e.name))
|
|
119
104
|
});
|
|
120
105
|
} catch (t) {
|
|
121
|
-
|
|
106
|
+
E(t, o(`${i}.delete-failed`));
|
|
122
107
|
} finally {
|
|
123
108
|
n.pendingDelete = null;
|
|
124
109
|
}
|
|
@@ -126,6 +111,6 @@ const w = "email-editor.display-conditions", i = w, K = 409, I = (n) => {
|
|
|
126
111
|
};
|
|
127
112
|
};
|
|
128
113
|
export {
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
B as DISPLAY_CONDITIONS_TRANS_KEY,
|
|
115
|
+
ne as useDisplayConditions
|
|
131
116
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const n = "newsletter.already-in-progress", s = "newsletter.campaign-could-not-be-saved", e = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|(
|
|
1
|
+
const n = "newsletter.already-in-progress", s = "newsletter.campaign-could-not-be-saved", e = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, E = /{%( )*now( )(".*")( )*%}/gm, o = /{%(?:(?!{%)[\s\S])*?%}/g, _ = /\{\{[^{}]+\}\}/g, t = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, i = /^[A-Za-z0-9_.]+$/, a = [
|
|
2
2
|
"ins-unsubscribe-link",
|
|
3
3
|
"ins-global-unsubscribe-link",
|
|
4
4
|
"ins-preferences-unsubscribe-link",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BlockType as o } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
const n = "conditions", t = "guido-display-conditions-control",
|
|
2
|
+
const n = "conditions", t = "guido-display-conditions-control", d = 10, s = [o.STRIPE, o.STRUCTURE, o.CONTAINER], c = {
|
|
3
3
|
PLUS: "guido-display-condition-plus",
|
|
4
4
|
EDIT: "guido-display-condition-edit",
|
|
5
5
|
TRASH: "guido-display-condition-trash",
|
|
6
6
|
CHEVRON: "guido-display-condition-chevron"
|
|
7
|
-
},
|
|
7
|
+
}, e = {
|
|
8
8
|
ADD: "guidoDisplayConditionAdd",
|
|
9
9
|
CREATE: "guidoDisplayConditionCreate",
|
|
10
10
|
SELECT: "guidoDisplayConditionSelect",
|
|
@@ -12,24 +12,15 @@ const n = "conditions", t = "guido-display-conditions-control", s = 10, d = [o.S
|
|
|
12
12
|
SHOW_LESS: "guidoDisplayConditionShowLess",
|
|
13
13
|
EDIT: "guidoDisplayConditionEdit",
|
|
14
14
|
REMOVE: "guidoDisplayConditionRemove"
|
|
15
|
-
},
|
|
16
|
-
is: "is",
|
|
17
|
-
"is-not": "is not",
|
|
18
|
-
contains: "contain",
|
|
19
|
-
"not-contains": "doesn't contain",
|
|
20
|
-
"is-one-of": "is one of",
|
|
21
|
-
"is-not-one-of": "is not one of"
|
|
22
|
-
};
|
|
15
|
+
}, C = ["applyConditionSwitcher", "applyCondition", "displayConditions"], a = "You can add Display Condition by selecting an existing condition or creating a new one to show specific content.", O = "You can create or select a display condition to control content visibility based on your recipients' properties or events.";
|
|
23
16
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
O as APPLIED_DESCRIPTION,
|
|
18
|
+
C as BUILT_IN_CONDITION_CONTROLS,
|
|
26
19
|
t as CONDITIONS_CONTROL_ID,
|
|
27
20
|
n as CONDITIONS_TAB_ID,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
I as OPERATOR_LABELS,
|
|
34
|
-
p as RULES_INTRO
|
|
21
|
+
s as CONDITION_BLOCK_TYPES,
|
|
22
|
+
e as CONDITION_BUTTONS,
|
|
23
|
+
c as CONDITION_ICONS,
|
|
24
|
+
a as EMPTY_DESCRIPTION,
|
|
25
|
+
d as MAX_COLLAPSED_LINES
|
|
35
26
|
};
|