@useinsider/guido 3.23.0-beta.5389d8c → 3.23.0-beta.57760f0

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 (34) hide show
  1. package/dist/components/Guido.vue.js +3 -3
  2. package/dist/components/Guido.vue2.js +42 -38
  3. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +8 -10
  4. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +23 -12
  5. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +1 -1
  6. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +51 -41
  7. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +10 -10
  8. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +42 -36
  9. package/dist/composables/useBlocksConfig.js +32 -29
  10. package/dist/composables/useDisplayConditions.js +46 -38
  11. package/dist/composables/useTranslations.js +2 -1
  12. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  13. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  14. package/dist/extensions/DisplayConditions/bridge.js +20 -13
  15. package/dist/extensions/DisplayConditions/control.js +69 -51
  16. package/dist/extensions/DisplayConditions/library.js +14 -11
  17. package/dist/extensions/LinkTracking/extension.js +17 -0
  18. package/dist/extensions/LinkTracking/writer.js +35 -0
  19. package/dist/guido.css +1 -1
  20. package/dist/package.json.js +1 -1
  21. package/dist/src/@types/display-condition.d.ts +0 -1
  22. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +1 -1
  23. package/dist/src/composables/useDisplayConditions.d.ts +2 -0
  24. package/dist/src/extensions/DisplayConditions/bridge.d.ts +2 -1
  25. package/dist/src/extensions/DisplayConditions/control.d.ts +2 -0
  26. package/dist/src/extensions/LinkTracking/extension.d.ts +2 -0
  27. package/dist/src/extensions/LinkTracking/writer.d.ts +13 -0
  28. package/dist/src/utils/displayCondition.d.ts +4 -3
  29. package/dist/src/utils/linkTrackingIds.d.ts +20 -5
  30. package/dist/utils/displayCondition.js +13 -13
  31. package/dist/utils/linkTrackingIds.js +80 -47
  32. package/dist/utils/protectTableText.js +9 -9
  33. package/dist/utils/templatePreparation.js +67 -57
  34. package/package.json +1 -1
@@ -12,9 +12,9 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "36a92344"
15
+ "e96ff469"
16
16
  );
17
- const v = n.exports;
17
+ const f = n.exports;
18
18
  export {
19
- v as default
19
+ f as default
20
20
  };
@@ -13,25 +13,27 @@ import { ModuleFolderDefaults as G } from "../enums/defaults.js";
13
13
  import { RIBBON_SELECTOR as we } from "../enums/onboarding.js";
14
14
  import { useRecommendationExtensionStore as V, disposeStrategyPageReturnListeners as ke } from "../extensions/Blocks/Recommendation/store/recommendation.js";
15
15
  import { disposeUnsubscribeListeners as Ie } from "../extensions/Blocks/Unsubscribe/block.js";
16
+ import { disposeDisplayConditionRequest as Re } from "../extensions/DisplayConditions/bridge.js";
17
+ import { disposeTrackingIdWriter as Te } from "../extensions/LinkTracking/writer.js";
16
18
  import Fe from "./organisms/AutoSaveController.vue.js";
17
19
  import Me from "./organisms/base/AuthErrorModal.vue.js";
18
- import Re from "./organisms/base/Toaster.vue.js";
19
- import Te from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
20
- import Le from "./organisms/header/HeaderWrapper.vue.js";
21
- import Ue from "./organisms/LoadingWrapper.vue.js";
22
- import Ne from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
23
- import _e from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
24
- import xe from "./organisms/validation/ValidationErrorDrawer.vue.js";
25
- import { useStripoApi as Ae } from "../services/stripoApi.js";
26
- import { useConfigStore as Be } from "../stores/config.js";
27
- import { useDynamicContentStore as Oe } from "../stores/dynamic-content.js";
20
+ import Le from "./organisms/base/Toaster.vue.js";
21
+ import Ue from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
22
+ import Ne from "./organisms/header/HeaderWrapper.vue.js";
23
+ import _e from "./organisms/LoadingWrapper.vue.js";
24
+ import xe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
25
+ import Ae from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
26
+ import Be from "./organisms/validation/ValidationErrorDrawer.vue.js";
27
+ import { useStripoApi as Oe } from "../services/stripoApi.js";
28
+ import { useConfigStore as Pe } from "../stores/config.js";
29
+ import { useDynamicContentStore as We } from "../stores/dynamic-content.js";
28
30
  import { useEditorStore as C } from "../stores/editor.js";
29
- import { usePreviewStore as Pe } from "../stores/preview.js";
30
- import { useSaveValidationStore as We } from "../stores/save-validation.js";
31
- import { useTemplateStore as He } from "../stores/template.js";
32
- import { useUnsubscribeStore as Ge } from "../stores/unsubscribe.js";
31
+ import { usePreviewStore as He } from "../stores/preview.js";
32
+ import { useSaveValidationStore as Ge } from "../stores/save-validation.js";
33
+ import { useTemplateStore as Ve } from "../stores/template.js";
34
+ import { useUnsubscribeStore as $e } from "../stores/unsubscribe.js";
33
35
  import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
34
- const Ct = /* @__PURE__ */ le({
36
+ const It = /* @__PURE__ */ le({
35
37
  __name: "Guido",
36
38
  props: {
37
39
  config: null,
@@ -39,7 +41,7 @@ const Ct = /* @__PURE__ */ le({
39
41
  },
40
42
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
41
43
  setup(z, { expose: q, emit: a }) {
42
- const s = z, r = ge(), K = d(
44
+ const s = z, n = ge(), K = d(
43
45
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
44
46
  ), j = d(
45
47
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
@@ -51,12 +53,12 @@ const Ct = /* @__PURE__ */ le({
51
53
  () => import("./organisms/display-conditions/DisplayConditionsHost.vue.js")
52
54
  ), Y = d(
53
55
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
54
- ), D = W(), y = W(), g = Oe(), w = Ge(), o = Be();
56
+ ), D = W(), y = W(), g = We(), w = $e(), o = Pe();
55
57
  s.ready && o.init(s.config);
56
- const m = C(), Z = Pe(), u = p(() => m.hasChanges), { isTestPartner: ee } = be(), { isEnabled: te, loadRollout: k } = he(), I = () => {
58
+ const m = C(), Z = He(), u = p(() => m.hasChanges), { isTestPartner: ee } = be(), { isEnabled: te, loadRollout: k } = he(), I = () => {
57
59
  var t;
58
60
  return (t = D.value) == null ? void 0 : t.handleSave(!0);
59
- }, F = (t) => {
61
+ }, R = (t) => {
60
62
  m.loadingStatus = t;
61
63
  };
62
64
  fe(), Se();
@@ -70,12 +72,12 @@ const Ct = /* @__PURE__ */ le({
70
72
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
71
73
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
72
74
  };
73
- }, { initPlugin: M, preloadRuntime: R } = Ee(r), { runExclusive: T, beginMount: L, isCurrentMount: S } = ye();
75
+ }, { initPlugin: T, preloadRuntime: F } = Ee(n), { runExclusive: M, beginMount: L, isCurrentMount: S } = ye();
74
76
  let f = 0;
75
- const { getDefaultTemplate: U } = Ae(), { cloneTimersOnSave: N, hasTimerBlocks: _ } = Ce(), oe = p(() => {
77
+ const { getDefaultTemplate: U } = Oe(), { cloneTimersOnSave: N, hasTimerBlocks: _ } = Ce(), oe = p(() => {
76
78
  var t;
77
79
  return !((t = o.ui) != null && t.showHeader);
78
- }), ne = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), re = p(() => o.externalDisplayConditions), ae = p(
80
+ }), re = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ne = p(() => o.externalDisplayConditions), ae = p(
79
81
  () => !!V().recommendationConfigs.strategyId
80
82
  );
81
83
  ve({
@@ -112,9 +114,9 @@ const Ct = /* @__PURE__ */ le({
112
114
  (e = y.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
113
115
  }, E = async () => {
114
116
  var t;
115
- r.mark("host_ready");
117
+ n.mark("host_ready");
116
118
  try {
117
- o.initialized || o.init(s.config), m.templateId = o.templateId, r.setContext({
119
+ o.initialized || o.init(s.config), m.templateId = o.templateId, n.setContext({
118
120
  partnerName: o.partnerName,
119
121
  productType: o.productType,
120
122
  templateId: o.templateId,
@@ -126,33 +128,33 @@ const Ct = /* @__PURE__ */ le({
126
128
  partnerName: o.partnerName,
127
129
  campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
128
130
  rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
129
- }, P = (me) => r.timed(
131
+ }, P = (me) => n.timed(
130
132
  "migration",
131
133
  () => De(me, ie, se)
132
134
  );
133
- let n = {
135
+ let r = {
134
136
  html: i && await P(i),
135
137
  css: l
136
138
  };
137
- n.html || (n = await r.timed("default_template", () => U()), n.html = await P(n.html));
138
- const ce = O ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
139
- _(n.html) && (n.html = await r.timed("timer_clone", () => N(n.html))), O && (m.trackIdSessionFloor = Math.max(ce, $(n.html)));
139
+ r.html || (r = await n.timed("default_template", () => U()), r.html = await P(r.html));
140
+ const ce = O ? $(r.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
141
+ _(r.html) && (r.html = await n.timed("timer_clone", () => N(r.html))), O && (m.trackIdSessionFloor = Math.max(ce, $(r.html)));
140
142
  const de = {
141
143
  preselectedDynamicContentList: B,
142
144
  onReady: () => {
143
145
  console.debug("guido:ready"), a("ready");
144
146
  }
145
147
  };
146
- f = L(), await M(n, v(), de), g.selectedDynamicContentList = B;
148
+ f = L(), await T(r, v(), de), g.selectedDynamicContentList = B;
147
149
  } catch (e) {
148
- console.error("Failed to initialize Stripo editor:", e), r.markFailed();
150
+ console.error("Failed to initialize Stripo editor:", e), n.markFailed();
149
151
  }
150
152
  };
151
153
  return pe(async () => {
152
154
  var e;
153
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), V().$reset(), C().$reset(), He().$reset(), We().$reset(), k(), h();
155
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), V().$reset(), C().$reset(), Ve().$reset(), Ge().$reset(), k(), h();
154
156
  const t = (e = y.value) == null ? void 0 : e.parentElement;
155
- if (t && (c = new ResizeObserver(h), c.observe(t)), R(), s.ready)
157
+ if (t && (c = new ResizeObserver(h), c.observe(t)), F(), s.ready)
156
158
  await E();
157
159
  else {
158
160
  const i = H(() => s.ready, (l) => {
@@ -161,13 +163,15 @@ const Ct = /* @__PURE__ */ le({
161
163
  }
162
164
  document.addEventListener("dynamic-content:open", b);
163
165
  }), ue(() => {
164
- if (Ie(), ke(), r.dispose(), c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b), S(f))
166
+ if (Ie(), ke(), n.dispose(), c == null || c.disconnect(), document.removeEventListener("dynamic-content:open", b), S(f)) {
167
+ Re(), Te();
165
168
  try {
166
169
  C().isStripoInitialized = !1;
167
170
  } catch (t) {
168
171
  console.debug("Failed to close the editor readiness gate on unmount", t);
169
172
  }
170
- T(async () => {
173
+ }
174
+ M(async () => {
171
175
  if (S(f))
172
176
  try {
173
177
  window.UIEditor.removeEditor();
@@ -182,10 +186,10 @@ const Ct = /* @__PURE__ */ le({
182
186
  },
183
187
  hasChanges: u,
184
188
  saveSilent: I,
185
- setLoading: F
186
- }), { __sfc: !0, openMetrics: r, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, DisplayConditionsHost: X, LegacyStrategyUpdatedModal: Y, headerWrapperRef: D, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: w, props: s, configStore: o, editorStore: m, previewStore: Z, hasChanges: u, isTestPartner: ee, isSaveValidationEnabled: te, loadRollout: k, saveSilent: I, setLoading: F, emit: a, buildMetadata: v, initPlugin: M, preloadRuntime: R, runExclusive: T, beginMount: L, isCurrentMount: S, mountGeneration: f, getDefaultTemplate: U, cloneTimersOnSave: N, hasTimerBlocks: _, noHeader: oe, isRrsEnabled: ne, isExternalDisplayConditionsEnabled: re, hasAssignedStrategy: ae, insertDynamicContent: x, closeDynamicContent: A, handleDynamicContentOpen: b, ribbonObserver: c, updateRibbonOffset: h, startEditor: E, AutoSaveController: Fe, AuthErrorModal: Me, Toaster: Re, FilterSelectionDrawer: Te, HeaderWrapper: Le, LoadingWrapper: Ue, SaveAsTemplateDrawer: Ne, UnsubscribeWrapper: _e, ValidationErrorDrawer: xe };
189
+ setLoading: R
190
+ }), { __sfc: !0, openMetrics: n, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, DisplayConditionsHost: X, LegacyStrategyUpdatedModal: Y, headerWrapperRef: D, wrapperRef: y, dynamicContentStore: g, unsubscribeStore: w, props: s, configStore: o, editorStore: m, previewStore: Z, hasChanges: u, isTestPartner: ee, isSaveValidationEnabled: te, loadRollout: k, saveSilent: I, setLoading: R, emit: a, buildMetadata: v, initPlugin: T, preloadRuntime: F, runExclusive: M, beginMount: L, isCurrentMount: S, mountGeneration: f, getDefaultTemplate: U, cloneTimersOnSave: N, hasTimerBlocks: _, noHeader: oe, isRrsEnabled: re, isExternalDisplayConditionsEnabled: ne, hasAssignedStrategy: ae, insertDynamicContent: x, closeDynamicContent: A, handleDynamicContentOpen: b, ribbonObserver: c, updateRibbonOffset: h, startEditor: E, AutoSaveController: Fe, AuthErrorModal: Me, Toaster: Le, FilterSelectionDrawer: Ue, HeaderWrapper: Ne, LoadingWrapper: _e, SaveAsTemplateDrawer: xe, UnsubscribeWrapper: Ae, ValidationErrorDrawer: Be };
187
191
  }
188
192
  });
189
193
  export {
190
- Ct as default
194
+ It as default
191
195
  };
@@ -1,18 +1,16 @@
1
- import i from "./CodeEditorField.vue2.js";
1
+ import t from "./CodeEditorField.vue2.js";
2
2
  /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
3
+ import i from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var s = function() {
5
5
  var e = this, r = e._self._c, o = e._self._setupProxy;
6
- return r("div", { staticClass: "guido-code-editor-field", attrs: { id: e.id } }, [r("p", { staticClass: "guido-code-editor-field__label" }, [e._v(" " + e._s(e.label) + " ")]), r(o.InCodeSnippet, { attrs: { code: e.value, disable: e.disabled, "focus-editor": !1, invalid: !!e.error, "invalid-message": e.error, options: o.options, size: { height: e.error ? 196 : 216 }, "syntax-check": !1 }, on: { input: function(t) {
7
- return o.emit("input", t);
8
- }, ready: o.onReady } })], 1);
9
- }, n = [], d = /* @__PURE__ */ s(
10
- i,
6
+ return r("div", { staticClass: "guido-code-editor-field", attrs: { id: e.id } }, [r("p", { staticClass: "guido-code-editor-field__label" }, [e._v(" " + e._s(e.label) + " ")]), r(o.InCodeSnippet, { attrs: { code: e.value, disable: e.disabled, "focus-editor": !1, invalid: !!e.error, "invalid-message": e.error, options: o.options, size: { height: e.error ? 196 : 216 }, "syntax-check": !1 }, on: { input: o.onInput, ready: o.onReady } })], 1);
7
+ }, a = [], d = /* @__PURE__ */ i(
8
+ t,
9
+ s,
11
10
  a,
12
- n,
13
11
  !1,
14
12
  null,
15
- "e96c7aa3"
13
+ "c262cac4"
16
14
  );
17
15
  const p = d.exports;
18
16
  export {
@@ -1,6 +1,6 @@
1
- import { defineComponent as s, computed as u } from "vue";
2
- import { InCodeSnippet as i } from "@useinsider/design-system-vue";
3
- const m = /* @__PURE__ */ s({
1
+ import { defineComponent as f, computed as m, nextTick as _ } from "vue";
2
+ import { InCodeSnippet as I } from "@useinsider/design-system-vue";
3
+ const S = /* @__PURE__ */ f({
4
4
  __name: "CodeEditorField",
5
5
  props: {
6
6
  id: null,
@@ -11,20 +11,31 @@ const m = /* @__PURE__ */ s({
11
11
  disabled: { type: Boolean, default: !1 }
12
12
  },
13
13
  emits: ["input"],
14
- setup(t, { expose: n, emit: d }) {
15
- const l = t;
16
- let e = null;
17
- const a = u(() => ({
14
+ setup(r, { expose: a, emit: n }) {
15
+ const l = r, u = 700;
16
+ let t = null, e = null;
17
+ const d = m(() => ({
18
18
  mode: "liquid",
19
19
  lint: !1,
20
20
  foldGutter: !1,
21
21
  placeholder: l.placeholder
22
- })), r = (p) => {
23
- e = p;
24
- }, o = () => (e == null ? void 0 : e.state.doc.toString()) ?? l.value;
25
- return n({ read: o }), { __sfc: !0, props: l, emit: d, view: e, options: a, onReady: r, read: o, InCodeSnippet: i };
22
+ })), p = (o) => {
23
+ t = o;
24
+ }, s = (o) => {
25
+ n("input", o), e == null || e();
26
+ }, i = () => new Promise((o) => {
27
+ if (!t || t.state.doc.toString() === l.value) {
28
+ o(l.value);
29
+ return;
30
+ }
31
+ const c = setTimeout(() => e == null ? void 0 : e(), u);
32
+ e = () => {
33
+ clearTimeout(c), e = null, _(() => o(l.value));
34
+ };
35
+ });
36
+ return a({ read: i }), { __sfc: !0, props: l, emit: n, SANITIZED_INPUT_WAIT_MS: u, view: t, settleRead: e, options: d, onReady: p, onInput: s, read: i, InCodeSnippet: I };
26
37
  }
27
38
  });
28
39
  export {
29
- m as default
40
+ S as default
30
41
  };
@@ -22,7 +22,7 @@ var n = function() {
22
22
  s,
23
23
  !1,
24
24
  null,
25
- "a4b2ccb9"
25
+ "cf448043"
26
26
  );
27
27
  const f = d.exports;
28
28
  export {
@@ -1,71 +1,81 @@
1
- import { defineComponent as D, reactive as $, ref as s, watch as C, computed as u } from "vue";
2
- import O from "../../wrappers/WpDrawer.vue.js";
3
- import { useDisplayConditions as T } from "../../../composables/useDisplayConditions.js";
4
- import { useTranslations as L } from "../../../composables/useTranslations.js";
5
- import { ACADEMY_LINKS as x } from "../../../enums/academy.js";
6
- import { DISPLAY_CONDITION_LIMITS as h } from "../../../enums/display-condition.js";
7
- import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
8
- import { InRadioButton as N, InBasicTextInput as w } from "@useinsider/design-system-vue";
9
- import E from "./CodeEditorField.vue.js";
10
- const J = /* @__PURE__ */ D({
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({
11
10
  __name: "DisplayConditionCreateDrawer",
12
- setup(Y) {
13
- const r = "email-editor.display-conditions", i = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
14
- C(() => c.isCreateOpen, (n) => {
15
- if (!n)
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
23
  return;
17
- const { editing: t } = c;
24
+ const { editing: t } = p;
18
25
  Object.assign(e, t ? {
19
26
  name: t.name,
20
27
  description: t.description,
21
28
  codeBefore: t.beforeScript,
22
29
  codeAfter: t.afterScript
23
- } : d()), o.value = {}, a.value = !1;
30
+ } : m()), o.value = {}, r.value = !1;
24
31
  }, { immediate: !0 });
25
- const g = u(() => i(`${r}.create-description`, {
26
- academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${i(`${r}.academy`)}</a>`
27
- })), S = u(() => ({
32
+ const C = u(() => B("create-description")), D = u(() => ({
28
33
  cancelOrBackButton: {
29
34
  styling: "ghost",
30
35
  type: "secondary",
31
- labelText: i(`${r}.cancel`),
32
- disabledStatus: a.value
36
+ labelText: n(`${i}.cancel`),
37
+ disabledStatus: s.value
33
38
  },
34
39
  secondaryButton: {
35
40
  styling: "solid",
36
41
  type: "subtle-primary",
37
- labelText: i(`${r}.create-and-save`),
38
- loadingStatus: a.value
42
+ labelText: n(`${i}.create-and-save`),
43
+ loadingStatus: r.value
39
44
  },
40
45
  primaryButton: {
41
46
  styling: "solid",
42
47
  type: "primary",
43
- labelText: i(`${r}.create`),
44
- disabledStatus: a.value
48
+ labelText: n(`${i}.create`),
49
+ disabledStatus: s.value
45
50
  }
46
- })), B = (n, t) => {
47
- t !== e[n] && (e[n] = t, o.value[n] && (o.value = { ...o.value, [n]: void 0 }));
48
- }, A = u(() => `${i(`${r}.condition-description`)} <span class="guido-display-condition-create__optional">(${i(`${r}.optional`)})</span>`);
49
- return { __sfc: !0, KEY: r, trans: i, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (n) => {
50
- var I, b;
51
- if (a.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">(${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)
52
57
  return;
53
- if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e), Object.keys(o.value).length) {
54
- l();
58
+ const t = d;
59
+ l.value = !0;
60
+ const [$, x] = await Promise.all([(S = g.value) == null ? void 0 : S.read(), (A = I.value) == null ? void 0 : A.read()]);
61
+ if (l.value = !1, t !== d)
62
+ return;
63
+ if (e.codeBefore = $ ?? e.codeBefore, e.codeAfter = x ?? e.codeAfter, o.value = v(e), Object.keys(o.value).length) {
64
+ f();
55
65
  return;
56
66
  }
57
- if (n === "inline") {
58
- f({ ...e });
67
+ if (a === "inline") {
68
+ y({ ...e });
59
69
  return;
60
70
  }
61
- a.value = !0;
62
- const t = await m({ ...e });
63
- a.value = !1, o.value = t ?? {}, Object.keys(o.value).length && l();
71
+ r.value = !0;
72
+ const h = await _({ ...e });
73
+ r.value = !1, o.value = h ?? {}, Object.keys(o.value).length && f();
64
74
  }, close: () => {
65
- a.value || y();
66
- }, WpDrawer: O, DISPLAY_CONDITION_LIMITS: h, InBasicTextInput: w, InRadioButton: N, CodeEditorField: E };
75
+ s.value || b();
76
+ }, WpDrawer: R, KEY: i, DISPLAY_CONDITION_LIMITS: j, InBasicTextInput: F, InRadioButton: P, CodeEditorField: G };
67
77
  }
68
78
  });
69
79
  export {
70
- J as default
80
+ Z as default
71
81
  };
@@ -1,13 +1,13 @@
1
1
  import a from "./DisplayConditionSelectDrawer.vue2.js";
2
2
  /* empty css */
3
- import o from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var d = function() {
3
+ import d from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var o = function() {
5
5
  var s = this, i = s._self._c, t = s._self._setupProxy;
6
- return i("div", { staticClass: "guido-display-condition-select-root" }, [i(t.WpDrawer, { attrs: { id: "guido__display-condition-select-drawer", "description-status": "", "class-name": "guido-display-condition-select-drawer", size: "large", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isSelectOpen, "title-text": t.trans(`${t.KEY}.select-title`) }, on: { cancelOrBackButtonEvent: t.cancel, onCloseEvent: t.cancel } }, [i("div", { staticClass: "guido-display-condition-select" }, [t.store.listStatus === "loaded" && t.store.list.length ? i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "label-status": !1, "placeholder-text": t.trans(`${t.KEY}.search`), "tooltip-status": !1, value: t.search }, on: { input: function(e) {
6
+ return i("div", { staticClass: "guido-display-condition-select-root" }, [i(t.WpDrawer, { attrs: { id: "guido__display-condition-select-drawer", "description-status": "", "class-name": "guido-display-condition-select-drawer", size: "large", "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isSelectOpen, "title-text": t.trans(`${t.KEY}.select-title`) }, on: { cancelOrBackButtonEvent: t.cancel, onCloseEvent: t.cancel } }, [i("div", { staticClass: "guido-display-condition-select d-f f-d-c f-g-1" }, [t.store.listStatus === "loaded" && t.store.list.length ? i(t.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-search-input", name: "displayConditionSearch", "character-counter-status": !1, "label-status": !1, "placeholder-text": t.trans(`${t.KEY}.search`), "tooltip-status": !1, value: t.search }, on: { input: function(e) {
7
7
  t.search = e;
8
8
  } } }) : s._e(), t.store.listStatus === "loading" || t.store.listStatus === "idle" ? i("div", { staticClass: "guido-display-condition-select__list", attrs: { "data-testid": "display-condition-loading" } }, s._l(t.SKELETON_HEIGHTS, function(e, n) {
9
9
  return i(t.InSkeleton, { key: n, attrs: { sizing: { width: 856, height: e } } });
10
- }), 1) : t.store.listStatus === "error" ? i(t.InNoData, { attrs: { id: "guido__display-condition-error", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.retry`), description: t.trans(`${t.KEY}.error-load`), title: t.trans(`${t.KEY}.error-load-title`) }, on: { click: t.loadList } }) : t.store.list.length ? t.filteredList.length ? i("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(e) {
10
+ }), 1) : t.store.listStatus === "error" ? i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-error", "button-status": "", icon: "no-data", "button-text": t.trans(`${t.KEY}.retry`), description: t.trans(`${t.KEY}.error-load`), title: t.trans(`${t.KEY}.error-load-title`) }, on: { click: t.loadList } }) : t.store.list.length ? t.filteredList.length ? i("ul", { staticClass: "guido-display-condition-select__list" }, s._l(t.filteredList, function(e) {
11
11
  return i("li", { key: e.id, staticClass: "guido-display-condition-card", attrs: { "data-condition-id": e.id } }, [i("div", { staticClass: "guido-display-condition-card__header" }, [i("div", { staticClass: "guido-display-condition-card__text" }, [i("p", { staticClass: "guido-display-condition-card__name" }, [s._v(" " + s._s(e.name) + " ")]), e.description ? i("p", { staticClass: "guido-display-condition-card__description" }, [s._v(" " + s._s(e.description) + " ")]) : s._e()]), i("div", { staticClass: "guido-display-condition-card__actions" }, [i("div", { staticClass: "guido-display-condition-card__split" }, [i(t.InButtonV2, { attrs: { id: `guido__display-condition-select-${e.id}`, type: "subtle-primary", "label-text": t.trans(`${t.KEY}.select`) }, on: { click: function(n) {
12
12
  return t.select(e);
13
13
  } } }), i(t.InButtonV2, { attrs: { id: `guido__display-condition-menu-${e.id}`, "left-icon": "filled-dropdown-down", type: "subtle-primary", "label-text-status": !1 }, on: { click: function(n) {
@@ -17,18 +17,18 @@ var d = function() {
17
17
  } } }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete`)) + " ")])]) : s._e()], 1), i("span", { staticClass: "guido-display-condition-card__divider" }), i("button", { staticClass: "guido-display-condition-card__expand", attrs: { id: `guido__display-condition-expand-${e.id}`, type: "button", "aria-expanded": t.expandedId === e.id ? "true" : "false", "aria-label": t.trans(`${t.KEY}.preview`) }, on: { click: function(n) {
18
18
  return t.toggleExpanded(e);
19
19
  } } }, [i(t.InIcons, { attrs: { name: t.expandedId === e.id ? "filled-dropdown-up" : "filled-dropdown-down" } })], 1)])]), t.expandedId === e.id ? i("pre", { staticClass: "guido-display-condition-card__code" }, [s._v(s._s(t.codeOf(e)))]) : s._e()]);
20
- }), 0) : i(t.InNoData, { attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-personalization", "button-text": t.trans(`${t.KEY}.create-new`), description: t.trans(`${t.KEY}.empty-description`), title: t.trans(`${t.KEY}.empty-title`) }, on: { click: function(e) {
20
+ }), 0) : i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-no-result", icon: "no-data", title: t.trans(`${t.KEY}.no-result`) } }) : i(t.InNoData, { staticClass: "d-f f-d-c j-c-c f-g-1", attrs: { id: "guido__display-condition-empty", "button-status": "", icon: "no-personalization", "button-text": t.trans(`${t.KEY}.create-new`), description: t.trans(`${t.KEY}.empty-description`), title: t.trans(`${t.KEY}.empty-title`) }, on: { click: function(e) {
21
21
  return t.store.openCreate();
22
22
  } } })], 1)]), t.store.pendingDelete ? i("div", { staticClass: "guido-display-condition-select__delete-modal" }, [i(t.WpModal, { attrs: { id: "guido__display-condition-delete-modal", size: "X-small", state: "danger", "close-on-outside-click": !1, "footer-button-options": t.deleteModalButtons, title: t.trans(`${t.KEY}.delete-confirm-title`) }, on: { close: t.closeDeleteModal, "primary-action": t.confirmDelete } }, [i("p", { staticClass: "guido-display-condition-select__delete-text" }, [s._v(" " + s._s(t.trans(`${t.KEY}.delete-confirm-description`, { name: t.store.pendingDelete.name })) + " ")])])], 1) : s._e()], 1);
23
- }, l = [], c = /* @__PURE__ */ o(
23
+ }, l = [], c = /* @__PURE__ */ d(
24
24
  a,
25
- d,
25
+ o,
26
26
  l,
27
27
  !1,
28
28
  null,
29
- "10ac7a13"
29
+ "21acc8d8"
30
30
  );
31
- const y = c.exports;
31
+ const f = c.exports;
32
32
  export {
33
- y as default
33
+ f as default
34
34
  };
@@ -1,57 +1,63 @@
1
- import { defineComponent as _, ref as i, watch as S, computed as c } from "vue";
2
- import B from "../../wrappers/WpDrawer.vue.js";
3
- import L from "../../wrappers/WpModal.vue.js";
4
- import { useDisplayConditions as x } from "../../../composables/useDisplayConditions.js";
5
- import { useTranslations as O } from "../../../composables/useTranslations.js";
6
- import { ACADEMY_LINKS as T } from "../../../enums/academy.js";
7
- import { useDisplayConditionStore as $ } from "../../../stores/display-condition.js";
8
- import { InSkeleton as C, InNoData as E, InIcons as M, InButtonV2 as b, InBasicTextInput as k } from "@useinsider/design-system-vue";
9
- const J = /* @__PURE__ */ _({
1
+ import { defineComponent as x, ref as a, watch as D, computed as r, onBeforeUnmount as M } from "vue";
2
+ import b from "../../wrappers/WpDrawer.vue.js";
3
+ import h from "../../wrappers/WpModal.vue.js";
4
+ import { useDisplayConditions as C, DISPLAY_CONDITIONS_TRANS_KEY as c } from "../../../composables/useDisplayConditions.js";
5
+ import { useTranslations as w } from "../../../composables/useTranslations.js";
6
+ import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
7
+ import { InSkeleton as A, InNoData as N, InIcons as $, InButtonV2 as K, InBasicTextInput as P } from "@useinsider/design-system-vue";
8
+ const Q = /* @__PURE__ */ x({
10
9
  __name: "DisplayConditionSelectDrawer",
11
- setup(h) {
12
- const o = "email-editor.display-conditions", m = [40, 76, 76, 76], l = O(), t = $(), { loadList: d, select: f, deleteSaved: u, cancel: g } = x(), r = i(""), s = i(null), a = i(null), n = i(!1);
13
- S(() => t.isSelectOpen, (e) => {
14
- e && (r.value = "", s.value = null, a.value = null, d());
10
+ setup(W) {
11
+ const I = [40, 76, 76, 76], l = w(), t = k(), { loadList: m, select: y, deleteSaved: f, cancel: _, describeWithAcademyLink: v } = C(), u = a(""), i = a(null), n = a(null), o = a(!1);
12
+ D(() => t.isSelectOpen, (e) => {
13
+ e && (u.value = "", i.value = null, n.value = null, m());
15
14
  }, { immediate: !0 });
16
- const D = c(() => {
17
- const e = r.value.trim().toLocaleLowerCase();
18
- return e ? t.list.filter((p) => `${p.name} ${p.description}`.toLocaleLowerCase().includes(e)) : t.list;
19
- }), v = c(() => l(`${o}.select-description`, {
20
- academyLink: `<a href="${T.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${l(`${o}.academy`)}</a>`
21
- })), y = c(() => ({
15
+ const O = r(() => {
16
+ const e = u.value.trim().toLocaleLowerCase();
17
+ return e ? t.list.filter((d) => `${d.name} ${d.description}`.toLocaleLowerCase().includes(e)) : t.list;
18
+ }), S = r(() => v("select-description")), B = r(() => ({
22
19
  cancelOrBackButton: {
23
20
  styling: "ghost",
24
21
  type: "secondary",
25
- labelText: l(`${o}.back`),
22
+ labelText: l(`${c}.back`),
26
23
  leftIcon: "line-arrow-left"
27
24
  }
28
- })), I = c(() => ({
25
+ })), L = r(() => ({
29
26
  cancelOrBackButton: {
30
27
  type: "secondary",
31
28
  styling: "ghost",
32
- labelText: l(`${o}.cancel`),
33
- disabledStatus: n.value
29
+ labelText: l(`${c}.cancel`),
30
+ disabledStatus: o.value
34
31
  },
35
32
  primaryButton: {
36
33
  type: "danger",
37
- labelText: l(`${o}.delete`),
38
- loadingStatus: n.value
34
+ labelText: l(`${c}.delete`),
35
+ loadingStatus: o.value
39
36
  }
40
- }));
41
- return { __sfc: !0, KEY: o, SKELETON_HEIGHTS: m, trans: l, store: t, loadList: d, select: f, deleteSaved: u, cancel: g, search: r, expandedId: s, menuId: a, isDeleting: n, filteredList: D, descriptionText: v, footerButtonGroupOptions: y, deleteModalButtons: I, toggleExpanded: (e) => {
42
- s.value = s.value === e.id ? null : e.id;
43
- }, toggleMenu: (e) => {
44
- a.value = a.value === e.id ? null : e.id;
45
- }, requestDelete: (e) => {
46
- a.value = null, t.pendingDelete = e;
37
+ })), E = (e) => {
38
+ i.value = i.value === e.id ? null : e.id;
39
+ }, T = (e) => {
40
+ n.value = n.value === e.id ? null : e.id;
41
+ }, s = (e) => {
42
+ e.composedPath().some((p) => {
43
+ var g;
44
+ return p instanceof Element && p.matches(".guido-display-condition-card__split") && ((g = p.closest(".guido-display-condition-card")) == null ? void 0 : g.getAttribute("data-condition-id")) === String(n.value);
45
+ }) || (n.value = null);
46
+ };
47
+ return D(n, (e) => {
48
+ e === null ? document.removeEventListener("pointerdown", s, !0) : document.addEventListener("pointerdown", s, !0);
49
+ }), M(() => {
50
+ document.removeEventListener("pointerdown", s, !0);
51
+ }), { __sfc: !0, SKELETON_HEIGHTS: I, trans: l, store: t, loadList: m, select: y, deleteSaved: f, cancel: _, describeWithAcademyLink: v, search: u, expandedId: i, menuId: n, isDeleting: o, filteredList: O, descriptionText: S, footerButtonGroupOptions: B, deleteModalButtons: L, toggleExpanded: E, toggleMenu: T, closeMenuOnOutsidePointer: s, requestDelete: (e) => {
52
+ n.value = null, t.pendingDelete = e;
47
53
  }, confirmDelete: async () => {
48
- !t.pendingDelete || n.value || (n.value = !0, await u(t.pendingDelete), n.value = !1);
54
+ !t.pendingDelete || o.value || (o.value = !0, await f(t.pendingDelete), o.value = !1);
49
55
  }, closeDeleteModal: () => {
50
- n.value || (t.pendingDelete = null);
56
+ o.value || (t.pendingDelete = null);
51
57
  }, codeOf: (e) => [e.codeBefore, e.codeAfter].filter(Boolean).join(`
52
- `), WpDrawer: B, WpModal: L, InBasicTextInput: k, InButtonV2: b, InIcons: M, InNoData: E, InSkeleton: C };
58
+ `), WpDrawer: b, WpModal: h, KEY: c, InBasicTextInput: P, InButtonV2: K, InIcons: $, InNoData: N, InSkeleton: A };
53
59
  }
54
60
  });
55
61
  export {
56
- J as default
62
+ Q as default
57
63
  };