@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.
Files changed (49) hide show
  1. package/README.md +3 -0
  2. package/dist/@types/display-condition.js +45 -21
  3. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +25 -19
  4. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +72 -53
  5. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +1 -1
  6. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +60 -42
  7. package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue.js +18 -0
  8. package/dist/components/organisms/display-conditions/LogicBuilderConnector.vue2.js +25 -0
  9. package/dist/components/organisms/display-conditions/LogicBuilderField.vue.js +28 -0
  10. package/dist/components/organisms/display-conditions/LogicBuilderField.vue2.js +28 -0
  11. package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue.js +30 -0
  12. package/dist/components/organisms/display-conditions/LogicBuilderGroup.vue2.js +32 -0
  13. package/dist/components/organisms/display-conditions/LogicBuilderRow.vue.js +28 -0
  14. package/dist/components/organisms/display-conditions/LogicBuilderRow.vue2.js +60 -0
  15. package/dist/composables/useDisplayConditionAttributes.js +20 -0
  16. package/dist/composables/useDisplayConditions.js +83 -68
  17. package/dist/composables/useScrollToInvalid.js +15 -0
  18. package/dist/enums/display-condition.js +15 -6
  19. package/dist/enums/html-validator.js +1 -1
  20. package/dist/extensions/DisplayConditions/constants.js +19 -10
  21. package/dist/extensions/DisplayConditions/control.js +84 -64
  22. package/dist/extensions/DisplayConditions/display-conditions.css.js +58 -6
  23. package/dist/extensions/DisplayConditions/extension.js +18 -14
  24. package/dist/guido.css +1 -1
  25. package/dist/node_modules/valibot/dist/index.js +118 -102
  26. package/dist/package.json.js +1 -1
  27. package/dist/services/displayConditionApi.js +18 -19
  28. package/dist/src/@types/display-condition.d.ts +67 -0
  29. package/dist/src/components/organisms/display-conditions/LogicBuilderConnector.vue.d.ts +19 -0
  30. package/dist/src/components/organisms/display-conditions/LogicBuilderField.vue.d.ts +22 -0
  31. package/dist/src/components/organisms/display-conditions/LogicBuilderGroup.vue.d.ts +24 -0
  32. package/dist/src/components/organisms/display-conditions/LogicBuilderRow.vue.d.ts +25 -0
  33. package/dist/src/composables/useDisplayConditionAttributes.d.ts +4 -0
  34. package/dist/src/composables/useDisplayConditions.d.ts +1 -1
  35. package/dist/src/composables/useScrollToInvalid.d.ts +6 -0
  36. package/dist/src/enums/display-condition.d.ts +22 -0
  37. package/dist/src/extensions/DisplayConditions/constants.d.ts +2 -0
  38. package/dist/src/extensions/DisplayConditions/control.d.ts +1 -0
  39. package/dist/src/utils/displayConditionAttributes.d.ts +7 -0
  40. package/dist/src/utils/displayConditionBuilder.d.ts +29 -0
  41. package/dist/src/utils/displayConditionRules.d.ts +12 -0
  42. package/dist/src/utils/displayConditionSummary.d.ts +11 -0
  43. package/dist/src/utils/genericUtil.d.ts +5 -3
  44. package/dist/utils/displayConditionAttributes.js +22 -0
  45. package/dist/utils/displayConditionBuilder.js +50 -0
  46. package/dist/utils/displayConditionRules.js +91 -0
  47. package/dist/utils/displayConditionSummary.js +28 -0
  48. package/dist/utils/genericUtil.js +41 -40
  49. 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 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()
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 DisplayConditionListResponseSchema,
22
- d as DisplayConditionMethodSchema,
23
- s as DisplayConditionSyntaxSchema,
24
- r as SavedDisplayConditionSchema
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 a from "./DisplayConditionCreateDrawer.vue2.js";
1
+ import r from "./DisplayConditionCreateDrawer.vue2.js";
2
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) {
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(o) {
8
+ }, secondaryButtonEvent: function(t) {
9
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-c-3" }), t("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" }, [i._v(" " + i._s(e.trans(`${e.KEY}.select-method`)) + " ")]), t("div", { staticClass: "guido-display-condition-create__methods d-f mb-4" }, [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,
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
- "929822bc"
31
+ "e341027d"
26
32
  );
27
33
  const f = d.exports;
28
34
  export {
@@ -1,81 +1,100 @@
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({
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(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)
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
- codeBefore: t.beforeScript,
29
- codeAfter: t.afterScript
30
- } : m()), o.value = {}, r.value = !1;
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 C = u(() => B("create-description")), D = u(() => ({
45
+ const F = u(() => T("create-description")), $ = u(() => ({
33
46
  cancelOrBackButton: {
34
47
  styling: "ghost",
35
48
  type: "secondary",
36
- labelText: n(`${i}.cancel`),
37
- disabledStatus: s.value
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: n(`${i}.create-and-save`),
43
- loadingStatus: r.value
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: n(`${i}.create`),
49
- disabledStatus: s.value
61
+ labelText: s(`${l}.create`),
62
+ disabledStatus: c.value
50
63
  }
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)
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
- 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)
78
+ if (g.value)
79
+ e.rules = U(y.value), B.value = !e.rules;
80
+ else if (!await O())
62
81
  return;
63
- if (e.codeBefore = $ ?? e.codeBefore, e.codeAfter = x ?? e.codeAfter, o.value = v(e), Object.keys(o.value).length) {
64
- f();
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 (a === "inline") {
68
- y({ ...e });
86
+ if (o === "inline") {
87
+ _({ ...e });
69
88
  return;
70
89
  }
71
- r.value = !0;
72
- const h = await _({ ...e });
73
- r.value = !1, o.value = h ?? {}, Object.keys(o.value).length && f();
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
- s.value || b();
76
- }, WpDrawer: R, KEY: i, DISPLAY_CONDITION_LIMITS: j, InBasicTextInput: F, InRadioButton: P, CodeEditorField: G };
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
- Z as default
99
+ ge as default
81
100
  };
@@ -28,7 +28,7 @@ var a = function() {
28
28
  l,
29
29
  !1,
30
30
  null,
31
- "0d740001"
31
+ "dbda3fdd"
32
32
  );
33
33
  const f = c.exports;
34
34
  export {
@@ -1,63 +1,81 @@
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({
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(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());
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 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(() => ({
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: l(`${s}.back`),
27
+ labelText: o(`${n}.back`),
25
28
  leftIcon: "line-arrow-left"
26
29
  }
27
- })), x = i(() => ({
30
+ })), I = r(() => ({
28
31
  cancelOrBackButton: {
29
32
  type: "secondary",
30
33
  styling: "ghost",
31
- labelText: l(`${s}.cancel`),
32
- disabledStatus: o.value
34
+ labelText: o(`${n}.cancel`),
35
+ disabledStatus: i.value
33
36
  },
34
37
  primaryButton: {
35
38
  type: "danger",
36
- labelText: l(`${s}.delete`),
37
- loadingStatus: o.value
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
- }, 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(
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
- ), 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 };
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
- ee as default
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
+ };