@useinsider/guido 3.28.1-beta.70df1f2 → 3.28.1-beta.7539890
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 +3 -0
- package/dist/@types/display-condition.js +45 -21
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +25 -19
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +72 -53
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +60 -42
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue.js +18 -0
- package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue2.js +25 -0
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue.js +28 -0
- package/dist/components/organisms/display-conditions/LogicBuilderField.vue2.js +28 -0
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue.js +30 -0
- package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue2.js +32 -0
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue.js +28 -0
- package/dist/components/organisms/display-conditions/LogicBuilderRow.vue2.js +60 -0
- package/dist/composables/useDisplayConditionAttributes.js +20 -0
- package/dist/composables/useDisplayConditions.js +83 -68
- package/dist/composables/useScrollToInvalid.js +15 -0
- package/dist/enums/display-condition.js +15 -6
- package/dist/enums/html-validator.js +1 -1
- package/dist/extensions/DisplayConditions/constants.js +19 -10
- package/dist/extensions/DisplayConditions/control.js +84 -64
- package/dist/extensions/DisplayConditions/display-conditions.css.js +58 -6
- package/dist/extensions/DisplayConditions/extension.js +18 -14
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +118 -102
- package/dist/package.json.js +1 -1
- package/dist/services/displayConditionApi.js +18 -19
- package/dist/src/@types/display-condition.d.ts +67 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderConnector.vue.d.ts +19 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderField.vue.d.ts +22 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderGroup.vue.d.ts +24 -0
- package/dist/src/components/organisms/display-conditions/LogicBuilderRow.vue.d.ts +25 -0
- package/dist/src/composables/useDisplayConditionAttributes.d.ts +4 -0
- package/dist/src/composables/useDisplayConditions.d.ts +1 -1
- package/dist/src/composables/useScrollToInvalid.d.ts +6 -0
- package/dist/src/enums/display-condition.d.ts +22 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +1 -0
- package/dist/src/utils/displayConditionAttributes.d.ts +7 -0
- package/dist/src/utils/displayConditionBuilder.d.ts +29 -0
- package/dist/src/utils/displayConditionRules.d.ts +12 -0
- package/dist/src/utils/displayConditionSummary.d.ts +11 -0
- package/dist/src/utils/genericUtil.d.ts +5 -3
- package/dist/utils/displayConditionAttributes.js +22 -0
- package/dist/utils/displayConditionBuilder.js +50 -0
- package/dist/utils/displayConditionRules.js +91 -0
- package/dist/utils/displayConditionSummary.js +28 -0
- package/dist/utils/genericUtil.js +41 -40
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -123,6 +123,9 @@ const config: GuidoConfigInput = {
|
|
|
123
123
|
// modal (see "Saved-module token repair"); an unresolvable token raises a single warning toaster
|
|
124
124
|
// (translation key `dynamic-content.unresolved-attributes-on-drop`, registered
|
|
125
125
|
// host-side). Omit it and the repair is a silent no-op. Default: {}.
|
|
126
|
+
// The display-condition Logic Builder (features.externalDisplayConditions) lists the leaves of
|
|
127
|
+
// dynamicContentList[partner.name] as "Custom Attributes" (identifier-shaped values only); its
|
|
128
|
+
// "Default Attributes" are fixed in Guido: email, name, surname, phone_number, uuid, language, country.
|
|
126
129
|
dynamicContentList?: DynamicContentList,
|
|
127
130
|
selectedUnsubscribePages?: number[],
|
|
128
131
|
// Default: false. Stripo opens its stored copy for the templateId unless this is true;
|
|
@@ -1,25 +1,49 @@
|
|
|
1
|
-
import { object as
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { object as t, optional as c, string as e, nullish as r, number as n, picklist as i, array as a, pipe as o, minLength as s, literal as u, regex as l } from "../node_modules/valibot/dist/index.js";
|
|
2
|
+
const h = i(["liquid", "pongo"]), g = i(["codeOnly", "logicBuilder"]), p = i(["string", "number", "boolean", "date", "strings"]), d = i(["and", "or"]), y = i(["is", "isNot", "contains", "notContains", "isOneOf", "isNotOneOf"]), m = /^[A-Za-z_][\w.]*$/, O = t({
|
|
3
|
+
key: o(e(), l(m)),
|
|
4
|
+
label: o(e(), s(1)),
|
|
5
|
+
type: c(p, "string"),
|
|
6
|
+
options: c(a(t({ label: e(), value: e() })), [])
|
|
7
|
+
}), S = t({
|
|
8
|
+
attribute: o(e(), l(m)),
|
|
9
|
+
type: p,
|
|
10
|
+
operator: y,
|
|
11
|
+
values: o(a(e()), s(1))
|
|
12
|
+
}), b = t({
|
|
13
|
+
condition: d,
|
|
14
|
+
rules: o(a(S), s(1))
|
|
15
|
+
}), R = t({
|
|
16
|
+
version: u(1),
|
|
17
|
+
condition: d,
|
|
18
|
+
groups: o(a(b), s(1))
|
|
19
|
+
}), A = t({
|
|
20
|
+
id: n(),
|
|
21
|
+
name: e(),
|
|
22
|
+
description: r(e(), ""),
|
|
23
|
+
syntax: h,
|
|
24
|
+
method: g,
|
|
25
|
+
codeBefore: e(),
|
|
26
|
+
codeAfter: r(e(), ""),
|
|
27
|
+
createdAt: c(e())
|
|
28
|
+
}), T = t({
|
|
29
|
+
data: a(A),
|
|
30
|
+
meta: t({
|
|
31
|
+
totalCount: n(),
|
|
32
|
+
perPage: n(),
|
|
33
|
+
currentPage: n(),
|
|
34
|
+
lastPage: n()
|
|
18
35
|
})
|
|
19
36
|
});
|
|
20
37
|
export {
|
|
21
|
-
p as
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
p as AttributeTypeSchema,
|
|
39
|
+
O as DisplayConditionAttributeSchema,
|
|
40
|
+
T as DisplayConditionListResponseSchema,
|
|
41
|
+
g as DisplayConditionMethodSchema,
|
|
42
|
+
h as DisplayConditionSyntaxSchema,
|
|
43
|
+
d as LogicOperatorSchema,
|
|
44
|
+
b as RuleGroupSchema,
|
|
45
|
+
y as RuleOperatorSchema,
|
|
46
|
+
S as RuleSchema,
|
|
47
|
+
R as RuleTreeSchema,
|
|
48
|
+
A as SavedDisplayConditionSchema
|
|
25
49
|
};
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from "./DisplayConditionCreateDrawer.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
return
|
|
3
|
+
import a from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var s = function() {
|
|
5
|
+
var o = this, i = o._self._c, e = o._self._setupProxy;
|
|
6
|
+
return i(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(t) {
|
|
7
7
|
return e.submit("inline");
|
|
8
|
-
}, secondaryButtonEvent: function(
|
|
8
|
+
}, secondaryButtonEvent: function(t) {
|
|
9
9
|
return e.submit("save");
|
|
10
|
-
} } }, [
|
|
11
|
-
return e.updateField("name",
|
|
12
|
-
} } }),
|
|
13
|
-
return e.updateField("description",
|
|
14
|
-
} } }),
|
|
15
|
-
return e.
|
|
16
|
-
} } }),
|
|
17
|
-
return e.
|
|
18
|
-
} } })], 1)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
} } }, [i("div", { ref: "contentRef", staticClass: "guido-display-condition-create" }, [i(e.InBasicTextInput, o._b({ 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(t) {
|
|
11
|
+
return e.updateField("name", t);
|
|
12
|
+
} } }, "InBasicTextInput", e.invalidFieldAttrs(e.errors.name), !1)), i(e.InBasicTextInput, o._b({ 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(t) {
|
|
13
|
+
return e.updateField("description", t);
|
|
14
|
+
} } }, "InBasicTextInput", e.invalidFieldAttrs(e.errors.description), !1)), i("div", { staticClass: "guido-display-condition-create__separator t-c-3" }), i("p", { staticClass: "guido-display-condition-create__method-title mt-0 mb-4 f-s-1 f-w-600 l-h-6 l-s-5 t-t-u t-c-55" }, [o._v(" " + o._s(e.trans(`${e.KEY}.condition-method`)) + " ")]), i("div", { staticClass: "guido-display-condition-create__methods d-f mb-4" }, [i(e.InRadioButton, { attrs: { id: "guido__display-condition-method-logic-builder", name: "displayConditionMethod", value: "logicBuilder", disable: e.isSaving, label: e.trans(`${e.KEY}.logic-builder`), selected: e.draft.method }, on: { click: function(t) {
|
|
15
|
+
return e.selectMethod("logicBuilder");
|
|
16
|
+
} } }), i(e.InRadioButton, { attrs: { id: "guido__display-condition-method-code-only", name: "displayConditionMethod", value: "codeOnly", disable: e.isSaving, label: e.trans(`${e.KEY}.code-only`), selected: e.draft.method }, on: { click: function(t) {
|
|
17
|
+
return e.selectMethod("codeOnly");
|
|
18
|
+
} } })], 1), e.isLogicBuilder ? i(e.LogicBuilderField, { attrs: { "custom-attributes": e.attributes.custom, "default-attributes": e.attributes.default, disabled: e.isSaving, "show-errors": e.showRuleErrors }, model: { value: e.builder, callback: function(t) {
|
|
19
|
+
e.builder = t;
|
|
20
|
+
}, expression: "builder" } }) : o._e(), e.isLogicBuilder ? o._e() : i(e.CodeEditorField, o._b({ 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(t) {
|
|
21
|
+
return e.updateField("codeBefore", t);
|
|
22
|
+
} } }, "CodeEditorField", e.invalidFieldAttrs(e.errors.codeBefore), !1)), e.isLogicBuilder ? o._e() : i(e.CodeEditorField, o._b({ 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(t) {
|
|
23
|
+
return e.updateField("codeAfter", t);
|
|
24
|
+
} } }, "CodeEditorField", e.invalidFieldAttrs(e.errors.codeAfter), !1))], 1)]);
|
|
25
|
+
}, n = [], d = /* @__PURE__ */ a(
|
|
26
|
+
r,
|
|
22
27
|
s,
|
|
28
|
+
n,
|
|
23
29
|
!1,
|
|
24
30
|
null,
|
|
25
|
-
"
|
|
31
|
+
"e341027d"
|
|
26
32
|
);
|
|
27
33
|
const f = d.exports;
|
|
28
34
|
export {
|
|
@@ -1,81 +1,100 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { defineComponent as Y, reactive as j, ref as i, computed as u, watch as P } from "vue";
|
|
2
|
+
import G from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useDisplayConditionAttributes as K } from "../../../composables/useDisplayConditionAttributes.js";
|
|
4
|
+
import { useDisplayConditions as M, DISPLAY_CONDITIONS_TRANS_KEY as l } from "../../../composables/useDisplayConditions.js";
|
|
5
|
+
import { invalidFieldAttrs as W, useScrollToInvalid as q } from "../../../composables/useScrollToInvalid.js";
|
|
6
|
+
import { useTranslations as z } from "../../../composables/useTranslations.js";
|
|
7
|
+
import { DISPLAY_CONDITION_LIMITS as H } from "../../../enums/display-condition.js";
|
|
8
|
+
import { useDisplayConditionStore as J } from "../../../stores/display-condition.js";
|
|
9
|
+
import { emptyBuilder as R, builderFromTree as Q, treeFromBuilder as U } from "../../../utils/displayConditionBuilder.js";
|
|
10
|
+
import { readLogicBuilderRules as V } from "../../../utils/displayConditionRules.js";
|
|
11
|
+
import { InRadioButton as X, InBasicTextInput as Z } from "@useinsider/design-system-vue";
|
|
12
|
+
import ee from "./CodeEditorField.vue.js";
|
|
13
|
+
import te from "./LogicBuilderField.vue.js";
|
|
14
|
+
const ge = /* @__PURE__ */ Y({
|
|
10
15
|
__name: "DisplayConditionCreateDrawer",
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
validate:
|
|
14
|
-
notifyInvalid:
|
|
15
|
-
createInline:
|
|
16
|
-
createAndSave:
|
|
17
|
-
cancel:
|
|
18
|
-
describeWithAcademyLink:
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
setup(oe) {
|
|
17
|
+
const s = z(), p = J(), {
|
|
18
|
+
validate: I,
|
|
19
|
+
notifyInvalid: m,
|
|
20
|
+
createInline: _,
|
|
21
|
+
createAndSave: S,
|
|
22
|
+
cancel: A,
|
|
23
|
+
describeWithAcademyLink: T
|
|
24
|
+
} = M(), v = () => ({
|
|
25
|
+
name: "",
|
|
26
|
+
description: "",
|
|
27
|
+
method: "logicBuilder",
|
|
28
|
+
codeBefore: "",
|
|
29
|
+
codeAfter: "",
|
|
30
|
+
rules: null
|
|
31
|
+
}), e = j(v()), y = i(R()), B = i(!1), x = K(), g = u(() => e.method === "logicBuilder"), r = i({}), a = i(!1), d = i(!1), c = u(() => a.value || d.value), C = i(), D = i(), h = i(), { scrollToFirstInvalid: b } = q(h);
|
|
32
|
+
let f = 0;
|
|
33
|
+
P(() => p.isCreateOpen, (o) => {
|
|
34
|
+
if (f += 1, !o)
|
|
23
35
|
return;
|
|
24
|
-
const { editing: t } = p;
|
|
25
|
-
Object.assign(e, t ? {
|
|
36
|
+
const { editing: t } = p, n = t ? V(t.extraData) : null;
|
|
37
|
+
Object.assign(e, v(), t ? {
|
|
26
38
|
name: t.name,
|
|
27
39
|
description: t.description,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
method: n ? "logicBuilder" : "codeOnly",
|
|
41
|
+
codeBefore: n ? "" : t.beforeScript,
|
|
42
|
+
codeAfter: n ? "" : t.afterScript
|
|
43
|
+
} : {}), y.value = n ? Q(n) : R(), B.value = !1, r.value = {}, a.value = !1;
|
|
31
44
|
}, { immediate: !0 });
|
|
32
|
-
const
|
|
45
|
+
const F = u(() => T("create-description")), $ = u(() => ({
|
|
33
46
|
cancelOrBackButton: {
|
|
34
47
|
styling: "ghost",
|
|
35
48
|
type: "secondary",
|
|
36
|
-
labelText:
|
|
37
|
-
disabledStatus:
|
|
49
|
+
labelText: s(`${l}.cancel`),
|
|
50
|
+
disabledStatus: c.value
|
|
38
51
|
},
|
|
39
52
|
secondaryButton: {
|
|
40
53
|
styling: "solid",
|
|
41
54
|
type: "subtle-primary",
|
|
42
|
-
labelText:
|
|
43
|
-
loadingStatus:
|
|
55
|
+
labelText: s(`${l}.create-and-save`),
|
|
56
|
+
loadingStatus: a.value
|
|
44
57
|
},
|
|
45
58
|
primaryButton: {
|
|
46
59
|
styling: "solid",
|
|
47
60
|
type: "primary",
|
|
48
|
-
labelText:
|
|
49
|
-
disabledStatus:
|
|
61
|
+
labelText: s(`${l}.create`),
|
|
62
|
+
disabledStatus: c.value
|
|
50
63
|
}
|
|
51
|
-
})),
|
|
52
|
-
t !== e[
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
})), N = (o, t) => {
|
|
65
|
+
t !== e[o] && (e[o] = t, r.value[o] && (r.value = { ...r.value, [o]: void 0 }));
|
|
66
|
+
}, k = u(() => `${s(`${l}.condition-description`)} <span class="guido-display-condition-create__optional t-c-53">(${s(`${l}.optional`)})</span>`), E = (o) => {
|
|
67
|
+
a.value || (e.method = o);
|
|
68
|
+
}, O = async () => {
|
|
69
|
+
var w, L;
|
|
70
|
+
const o = f;
|
|
71
|
+
d.value = !0;
|
|
72
|
+
const [t, n] = await Promise.all([(w = C.value) == null ? void 0 : w.read(), (L = D.value) == null ? void 0 : L.read()]);
|
|
73
|
+
return d.value = !1, o !== f ? !1 : (e.codeBefore = t ?? e.codeBefore, e.codeAfter = n ?? e.codeAfter, !0);
|
|
74
|
+
};
|
|
75
|
+
return { __sfc: !0, trans: s, store: p, validate: I, notifyInvalid: m, createInline: _, createAndSave: S, cancel: A, describeWithAcademyLink: T, emptyDraft: v, draft: e, builder: y, showRuleErrors: B, attributes: x, isLogicBuilder: g, errors: r, isSaving: a, isReadingCode: d, isBusy: c, codeBeforeRef: C, codeAfterRef: D, contentRef: h, scrollToFirstInvalid: b, openGeneration: f, descriptionText: F, footerButtonGroupOptions: $, updateField: N, descriptionLabel: k, selectMethod: E, readCode: O, submit: async (o) => {
|
|
76
|
+
if (c.value)
|
|
57
77
|
return;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (l.value = !1, t !== d)
|
|
78
|
+
if (g.value)
|
|
79
|
+
e.rules = U(y.value), B.value = !e.rules;
|
|
80
|
+
else if (!await O())
|
|
62
81
|
return;
|
|
63
|
-
if (
|
|
64
|
-
|
|
82
|
+
if (r.value = I(e), Object.keys(r.value).length || g.value && !e.rules) {
|
|
83
|
+
m(), await b();
|
|
65
84
|
return;
|
|
66
85
|
}
|
|
67
|
-
if (
|
|
68
|
-
|
|
86
|
+
if (o === "inline") {
|
|
87
|
+
_({ ...e });
|
|
69
88
|
return;
|
|
70
89
|
}
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
90
|
+
a.value = !0;
|
|
91
|
+
const t = await S({ ...e });
|
|
92
|
+
a.value = !1, r.value = t ?? {}, Object.keys(r.value).length && (m(), await b());
|
|
74
93
|
}, close: () => {
|
|
75
|
-
|
|
76
|
-
}, WpDrawer:
|
|
94
|
+
c.value || A();
|
|
95
|
+
}, WpDrawer: G, KEY: l, invalidFieldAttrs: W, DISPLAY_CONDITION_LIMITS: H, InBasicTextInput: Z, InRadioButton: X, CodeEditorField: ee, LogicBuilderField: te };
|
|
77
96
|
}
|
|
78
97
|
});
|
|
79
98
|
export {
|
|
80
|
-
|
|
99
|
+
ge as default
|
|
81
100
|
};
|
|
@@ -1,63 +1,81 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { defineComponent as R, ref as c, watch as k, computed as r } from "vue";
|
|
2
|
+
import N from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import j from "../../wrappers/WpModal.vue.js";
|
|
4
|
+
import { useDisplayConditionAttributes as K } from "../../../composables/useDisplayConditionAttributes.js";
|
|
5
|
+
import { useDisplayConditions as P, DISPLAY_CONDITIONS_TRANS_KEY as n } from "../../../composables/useDisplayConditions.js";
|
|
6
|
+
import { useTranslations as W } from "../../../composables/useTranslations.js";
|
|
7
|
+
import { useDisplayConditionStore as Y } from "../../../stores/display-condition.js";
|
|
8
|
+
import { parseRuleTree as w } from "../../../utils/displayConditionRules.js";
|
|
9
|
+
import { summarizeRuleTree as F, OPERATOR_TRANS_SUFFIX as G } from "../../../utils/displayConditionSummary.js";
|
|
10
|
+
import { getTooltipOptions as H } from "../../../utils/tooltipUtils.js";
|
|
11
|
+
import { InSkeleton as q, InDropdownMenu as z, InButtonV2 as U, InBasicTextInput as V } from "@useinsider/design-system-vue";
|
|
12
|
+
import X from "./DisplayConditionListState.vue.js";
|
|
13
|
+
const de = /* @__PURE__ */ R({
|
|
11
14
|
__name: "DisplayConditionSelectDrawer",
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
e && (
|
|
15
|
+
setup(J) {
|
|
16
|
+
const _ = [40, 76, 76, 76], o = W(), t = Y(), d = K(), { loadList: m, select: S, deleteSaved: f, cancel: T, describeWithAcademyLink: v } = P(), p = c(""), a = c(null), l = c(null), i = c(!1);
|
|
17
|
+
k(() => t.isSelectOpen, (e) => {
|
|
18
|
+
e && (p.value = "", a.value = null, l.value = null, m());
|
|
16
19
|
}, { immediate: !0 });
|
|
17
|
-
const
|
|
18
|
-
const e =
|
|
19
|
-
return e ? t.list.filter((
|
|
20
|
-
}),
|
|
20
|
+
const g = r(() => {
|
|
21
|
+
const e = p.value.trim().toLocaleLowerCase();
|
|
22
|
+
return e ? t.list.filter((s) => `${s.name} ${s.description}`.toLocaleLowerCase().includes(e)) : t.list;
|
|
23
|
+
}), $ = r(() => t.listStatus === "error" ? "error" : t.list.length ? g.value.length ? null : "no-result" : "empty"), O = r(() => v("select-description")), B = r(() => ({
|
|
21
24
|
cancelOrBackButton: {
|
|
22
25
|
styling: "ghost",
|
|
23
26
|
type: "secondary",
|
|
24
|
-
labelText:
|
|
27
|
+
labelText: o(`${n}.back`),
|
|
25
28
|
leftIcon: "line-arrow-left"
|
|
26
29
|
}
|
|
27
|
-
})),
|
|
30
|
+
})), I = r(() => ({
|
|
28
31
|
cancelOrBackButton: {
|
|
29
32
|
type: "secondary",
|
|
30
33
|
styling: "ghost",
|
|
31
|
-
labelText:
|
|
32
|
-
disabledStatus:
|
|
34
|
+
labelText: o(`${n}.cancel`),
|
|
35
|
+
disabledStatus: i.value
|
|
33
36
|
},
|
|
34
37
|
primaryButton: {
|
|
35
38
|
type: "danger",
|
|
36
|
-
labelText:
|
|
37
|
-
loadingStatus:
|
|
39
|
+
labelText: o(`${n}.delete`),
|
|
40
|
+
loadingStatus: i.value
|
|
38
41
|
}
|
|
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) => {
|
|
42
|
+
})), x = (e) => {
|
|
41
43
|
a.value = a.value === e.id ? null : e.id;
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
44
|
+
}, L = (e) => {
|
|
45
|
+
l.value = l.value === e.id ? null : e.id;
|
|
46
|
+
}, h = (e) => {
|
|
47
|
+
l.value === e.id && (l.value = null);
|
|
48
|
+
}, C = (e) => H(
|
|
47
49
|
`guido__display-condition-expand-tooltip-${e.id}`,
|
|
48
50
|
{ staticPosition: "top right" }
|
|
49
|
-
),
|
|
50
|
-
{ text:
|
|
51
|
-
],
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
!t.pendingDelete ||
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
51
|
+
), b = (e) => [
|
|
52
|
+
{ text: o(`${n}.delete`), value: `guido__display-condition-delete-${e.id}` }
|
|
53
|
+
], A = (e) => {
|
|
54
|
+
l.value = null, t.pendingDelete = e;
|
|
55
|
+
}, E = async () => {
|
|
56
|
+
!t.pendingDelete || i.value || (i.value = !0, await f(t.pendingDelete), i.value = !1);
|
|
57
|
+
}, M = () => {
|
|
58
|
+
i.value || (t.pendingDelete = null);
|
|
59
|
+
}, y = (e) => {
|
|
60
|
+
const s = w(e.codeBefore);
|
|
61
|
+
if (!s)
|
|
62
|
+
return null;
|
|
63
|
+
const D = F(
|
|
64
|
+
s,
|
|
65
|
+
[...d.value.custom, ...d.value.default],
|
|
66
|
+
(u) => o(`${n}.operator-${G[u]}`)
|
|
67
|
+
);
|
|
68
|
+
return D.groups.map((u) => u.lines.join(`
|
|
69
|
+
${o(`${n}.${u.condition}`)} `)).join(`
|
|
70
|
+
|
|
71
|
+
${o(`${n}.${D.condition}`)}
|
|
72
|
+
|
|
73
|
+
`);
|
|
74
|
+
};
|
|
75
|
+
return { __sfc: !0, SKELETON_HEIGHTS: _, trans: o, store: t, attributes: d, loadList: m, select: S, deleteSaved: f, cancel: T, describeWithAcademyLink: v, search: p, expandedId: a, menuId: l, isDeleting: i, filteredList: g, listState: $, descriptionText: O, footerButtonGroupOptions: B, deleteModalButtons: I, toggleExpanded: x, toggleMenu: L, closeMenu: h, expandTooltip: C, menuOptions: b, requestDelete: A, confirmDelete: E, closeDeleteModal: M, summaryOf: y, codeOf: (e) => (e.method === "logicBuilder" ? y(e) : null) ?? [e.codeBefore, e.codeAfter].filter(Boolean).join(`
|
|
76
|
+
`), WpDrawer: N, WpModal: j, KEY: n, InBasicTextInput: V, InButtonV2: U, InDropdownMenu: z, InSkeleton: q, DisplayConditionListState: X };
|
|
59
77
|
}
|
|
60
78
|
});
|
|
61
79
|
export {
|
|
62
|
-
|
|
80
|
+
de as default
|
|
63
81
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import r from "./LogicBuilderConnector.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var o = function() {
|
|
5
|
+
var e = this, s = e._self._c, t = e._self._setupProxy;
|
|
6
|
+
return s("div", { staticClass: "guido-logic-builder-connector", attrs: { "data-logic": e.value } }, [s(t.InSegments, { attrs: { id: e.id, disable: e.disabled, "segment-list": t.segments, selected: e.value, "with-icon": !1 }, on: { click: t.select } })], 1);
|
|
7
|
+
}, c = [], i = /* @__PURE__ */ n(
|
|
8
|
+
r,
|
|
9
|
+
o,
|
|
10
|
+
c,
|
|
11
|
+
!1,
|
|
12
|
+
null,
|
|
13
|
+
"6c88ce0c"
|
|
14
|
+
);
|
|
15
|
+
const m = i.exports;
|
|
16
|
+
export {
|
|
17
|
+
m as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineComponent as i, computed as l } from "vue";
|
|
2
|
+
import { DISPLAY_CONDITIONS_TRANS_KEY as s } from "../../../composables/useDisplayConditions.js";
|
|
3
|
+
import { useTranslations as p } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { InSegments as m } from "@useinsider/design-system-vue";
|
|
5
|
+
const I = /* @__PURE__ */ i({
|
|
6
|
+
__name: "LogicBuilderConnector",
|
|
7
|
+
props: {
|
|
8
|
+
id: null,
|
|
9
|
+
value: null,
|
|
10
|
+
disabled: { type: Boolean }
|
|
11
|
+
},
|
|
12
|
+
emits: ["input"],
|
|
13
|
+
setup(r, { emit: o }) {
|
|
14
|
+
const e = r, t = p(), a = l(() => [
|
|
15
|
+
{ text: t(`${s}.and`), value: "and" },
|
|
16
|
+
{ text: t(`${s}.or`), value: "or" }
|
|
17
|
+
]);
|
|
18
|
+
return { __sfc: !0, props: e, emit: o, trans: t, segments: a, select: (n) => {
|
|
19
|
+
!e.disabled && n !== e.value && o("input", n);
|
|
20
|
+
}, InSegments: m };
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export {
|
|
24
|
+
I as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import n from "./LogicBuilderField.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var d = function() {
|
|
5
|
+
var t = this, i = t._self._c, o = t._self._setupProxy;
|
|
6
|
+
return i("div", { staticClass: "guido-logic-builder", attrs: { id: "guido__display-condition-logic-builder" } }, [t._l(t.value.groups, function(e, u) {
|
|
7
|
+
return i("div", { key: e.id }, [u > 0 ? i(o.LogicBuilderConnector, { staticClass: "guido-logic-builder__group-connector", attrs: { id: `guido__display-condition-group-logic-${e.id}`, disabled: t.disabled, value: t.value.condition }, on: { input: function(r) {
|
|
8
|
+
return o.emit("input", { ...t.value, condition: r });
|
|
9
|
+
} } }) : t._e(), i(o.LogicBuilderGroup, { attrs: { "custom-attributes": t.customAttributes, "default-attributes": t.defaultAttributes, disabled: t.disabled, group: e, "show-errors": t.showErrors, "sole-group": t.value.groups.length === 1 }, on: { remove: function(r) {
|
|
10
|
+
return o.removeGroup(u);
|
|
11
|
+
}, update: function(r) {
|
|
12
|
+
return o.updateGroup(u, r);
|
|
13
|
+
} } })], 1);
|
|
14
|
+
}), i("div", { staticClass: "guido-logic-builder__footer" }, [i(o.InButtonV2, { attrs: { id: "guido__display-condition-add-group", "left-icon": "line-plus-netural", type: "subtle-primary", "disabled-status": t.disabled, "label-text": o.trans(`${o.KEY}.add-condition-group`) }, on: { click: function(e) {
|
|
15
|
+
o.setGroups([...t.value.groups, o.emptyGroup()]);
|
|
16
|
+
} } })], 1)], 2);
|
|
17
|
+
}, l = [], a = /* @__PURE__ */ s(
|
|
18
|
+
n,
|
|
19
|
+
d,
|
|
20
|
+
l,
|
|
21
|
+
!1,
|
|
22
|
+
null,
|
|
23
|
+
"111861b4"
|
|
24
|
+
);
|
|
25
|
+
const f = a.exports;
|
|
26
|
+
export {
|
|
27
|
+
f as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineComponent as m } from "vue";
|
|
2
|
+
import { DISPLAY_CONDITIONS_TRANS_KEY as a } from "../../../composables/useDisplayConditions.js";
|
|
3
|
+
import { useTranslations as c } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { emptyGroup as n } from "../../../utils/displayConditionBuilder.js";
|
|
5
|
+
import { InButtonV2 as f } from "@useinsider/design-system-vue";
|
|
6
|
+
import d from "./LogicBuilderConnector.vue.js";
|
|
7
|
+
import _ from "./LogicBuilderGroup.vue.js";
|
|
8
|
+
const C = /* @__PURE__ */ m({
|
|
9
|
+
__name: "LogicBuilderField",
|
|
10
|
+
props: {
|
|
11
|
+
value: null,
|
|
12
|
+
showErrors: { type: Boolean },
|
|
13
|
+
customAttributes: null,
|
|
14
|
+
defaultAttributes: null,
|
|
15
|
+
disabled: { type: Boolean }
|
|
16
|
+
},
|
|
17
|
+
emits: ["input"],
|
|
18
|
+
setup(s, { emit: u }) {
|
|
19
|
+
const r = s, i = c(), t = (o) => u("input", {
|
|
20
|
+
...r.value,
|
|
21
|
+
groups: o.length ? o : [n()]
|
|
22
|
+
});
|
|
23
|
+
return { __sfc: !0, props: r, emit: u, trans: i, setGroups: t, updateGroup: (o, p) => t(r.value.groups.map((e, l) => l === o ? p : e)), removeGroup: (o) => t(r.value.groups.filter((p, e) => e !== o)), KEY: a, emptyGroup: n, InButtonV2: f, LogicBuilderConnector: d, LogicBuilderGroup: _ };
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
C as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import n from "./LogicBuilderGroup.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import d from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var s = function() {
|
|
5
|
+
var t = this, r = t._self._c, o = t._self._setupProxy;
|
|
6
|
+
return r("div", { staticClass: "guido-logic-builder-group", attrs: { "data-group-id": t.group.id } }, [t._l(t.group.rows, function(e, u) {
|
|
7
|
+
return r("div", { key: e.id }, [u > 0 ? r(o.LogicBuilderConnector, { attrs: { id: `guido__display-condition-row-logic-${e.id}`, disabled: t.disabled, value: t.group.condition }, on: { input: function(i) {
|
|
8
|
+
return o.emit("update", { ...t.group, condition: i });
|
|
9
|
+
} } }) : t._e(), r(o.LogicBuilderRow, { attrs: { "custom-attributes": t.customAttributes, "default-attributes": t.defaultAttributes, disabled: t.disabled, errors: t.showErrors ? o.findRowErrors(e) : {}, "remove-disabled": t.soleGroup && t.group.rows.length === 1, row: e }, on: { duplicate: function(i) {
|
|
10
|
+
return o.duplicateRow(u);
|
|
11
|
+
}, remove: function(i) {
|
|
12
|
+
return o.removeRow(u);
|
|
13
|
+
}, update: function(i) {
|
|
14
|
+
return o.updateRow(u, i);
|
|
15
|
+
} } })], 1);
|
|
16
|
+
}), r("div", { staticClass: "guido-logic-builder-group__footer" }, [r(o.InButtonV2, { attrs: { id: `guido__display-condition-add-rule-${t.group.id}`, "left-icon": "line-plus-netural", type: "subtle-primary", "disabled-status": t.disabled, "label-text": o.trans(`${o.KEY}.add-condition`) }, on: { click: function(e) {
|
|
17
|
+
o.setRows([...t.group.rows, o.emptyRow()]);
|
|
18
|
+
} } })], 1)], 2);
|
|
19
|
+
}, a = [], l = /* @__PURE__ */ d(
|
|
20
|
+
n,
|
|
21
|
+
s,
|
|
22
|
+
a,
|
|
23
|
+
!1,
|
|
24
|
+
null,
|
|
25
|
+
"3de36f36"
|
|
26
|
+
);
|
|
27
|
+
const g = l.exports;
|
|
28
|
+
export {
|
|
29
|
+
g as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineComponent as i } from "vue";
|
|
2
|
+
import { DISPLAY_CONDITIONS_TRANS_KEY as m } from "../../../composables/useDisplayConditions.js";
|
|
3
|
+
import { useTranslations as a } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { findRowErrors as c, emptyRow as w, copyRow as f } from "../../../utils/displayConditionBuilder.js";
|
|
5
|
+
import { InButtonV2 as d } from "@useinsider/design-system-vue";
|
|
6
|
+
import R from "./LogicBuilderConnector.vue.js";
|
|
7
|
+
import g from "./LogicBuilderRow.vue.js";
|
|
8
|
+
const N = /* @__PURE__ */ i({
|
|
9
|
+
__name: "LogicBuilderGroup",
|
|
10
|
+
props: {
|
|
11
|
+
group: null,
|
|
12
|
+
showErrors: { type: Boolean },
|
|
13
|
+
customAttributes: null,
|
|
14
|
+
defaultAttributes: null,
|
|
15
|
+
disabled: { type: Boolean },
|
|
16
|
+
soleGroup: { type: Boolean }
|
|
17
|
+
},
|
|
18
|
+
emits: ["update", "remove"],
|
|
19
|
+
setup(u, { emit: e }) {
|
|
20
|
+
const r = u, n = a(), t = (o) => {
|
|
21
|
+
o.length ? e("update", { ...r.group, rows: o }) : e("remove");
|
|
22
|
+
};
|
|
23
|
+
return { __sfc: !0, props: r, emit: e, trans: n, setRows: t, updateRow: (o, s) => t(r.group.rows.map((p, l) => l === o ? s : p)), duplicateRow: (o) => t([
|
|
24
|
+
...r.group.rows.slice(0, o + 1),
|
|
25
|
+
f(r.group.rows[o]),
|
|
26
|
+
...r.group.rows.slice(o + 1)
|
|
27
|
+
]), removeRow: (o) => t(r.group.rows.filter((s, p) => p !== o)), KEY: m, emptyRow: w, findRowErrors: c, InButtonV2: d, LogicBuilderConnector: R, LogicBuilderRow: g };
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
N as default
|
|
32
|
+
};
|