@useinsider/guido 2.1.0-beta.7ffef92 → 2.1.0-beta.84a7014

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 (64) hide show
  1. package/README.md +41 -2
  2. package/dist/@types/config/schemas.js +1 -1
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +66 -66
  5. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +13 -11
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +24 -55
  7. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +3 -3
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +21 -34
  9. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +9 -9
  10. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +35 -44
  11. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  12. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  13. package/dist/composables/useSave.js +16 -12
  14. package/dist/composables/useStripo.js +63 -57
  15. package/dist/composables/useStripoEventHandler.js +27 -12
  16. package/dist/composables/useSyncModuleExtractor.js +45 -0
  17. package/dist/composables/useVersionHistoryApi.js +1 -1
  18. package/dist/config/i18n/en/index.js +11 -0
  19. package/dist/config/i18n/en/labels.json.js +7 -0
  20. package/dist/config/i18n/en/toasters.json.js +56 -0
  21. package/dist/config/i18n/en/tooltips.json.js +82 -0
  22. package/dist/config/i18n/index.js +7 -0
  23. package/dist/config/migrator/itemsBlockMigrator.js +65 -64
  24. package/dist/enums/unsubscribe.js +25 -21
  25. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +39 -58
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +57 -93
  27. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
  28. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  29. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  30. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  31. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  32. package/dist/guido.css +1 -1
  33. package/dist/services/stripoApi.js +55 -19
  34. package/dist/src/@types/config/schemas.d.ts +1 -1
  35. package/dist/src/@types/events.d.ts +38 -2
  36. package/dist/src/components/Guido.vue.d.ts +2 -2
  37. package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +0 -1
  38. package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +1 -15
  39. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  40. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  41. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  42. package/dist/src/composables/useGuidoActions.d.ts +1 -1
  43. package/dist/src/composables/useSave.d.ts +2 -2
  44. package/dist/src/composables/useStripo.d.ts +2 -2
  45. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  46. package/dist/src/config/i18n/en/index.d.ts +1 -0
  47. package/dist/src/config/i18n/index.d.ts +16 -0
  48. package/dist/src/enums/unsubscribe.d.ts +3 -0
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -5
  50. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -18
  51. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  52. package/dist/src/mock/api/settings.d.ts +2 -0
  53. package/dist/src/services/stripoApi.d.ts +5 -0
  54. package/dist/src/stores/editor.d.ts +23 -0
  55. package/dist/src/utils/templatePreparation.d.ts +1 -1
  56. package/dist/static/styles/components/notification.css.js +18 -0
  57. package/dist/static/styles/components/tools.css.js +6 -2
  58. package/dist/static/styles/variables.css.js +2 -0
  59. package/dist/stores/editor.js +2 -1
  60. package/dist/stores/unsubscribe.js +37 -34
  61. package/dist/utils/templatePreparation.js +1 -1
  62. package/package.json +1 -1
  63. package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +0 -29
  64. package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +0 -15
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  <p align="center">
2
2
  <a href="https://www.youtube.com/shorts/Y0RwBeMezL4" target="_blank" rel="noopener noreferrer">
3
- <img width="180" src="./public/guido.png" alt="Guido logo">
3
+ <img width="180"
4
+ src="https://web-image.useinsider.com/guido/defaultImageLibrary/iUH0liTK0d2YDsVB5LDN1770169173.jpg"
5
+ alt="Guido logo">
4
6
  </a>
5
7
  </p>
6
8
 
@@ -172,11 +174,48 @@ const config: GuidoConfigInput = {
172
174
  | `dynamic-content:open` | `DynamicContent \| null` | User wants to insert dynamic content |
173
175
  | `back` | - | Back button clicked |
174
176
  | `save:start` | - | Save process started |
175
- | `save:complete` | `Template` | Save completed successfully |
177
+ | `save:complete` | `SavedTemplateDetails` | Save completed successfully (includes `metadata`) |
176
178
  | `on-change` | - | Template was modified |
177
179
  | `test-email:click` | - | Test email button clicked |
178
180
  | `onboarding-finished` | - | Onboarding popup dismissed |
179
181
 
182
+ ### `save:complete` Payload
183
+
184
+ The `save:complete` event emits a `SavedTemplateDetails` object containing the compiled template data along with editor `metadata`:
185
+
186
+ ```typescript
187
+ interface SavedTemplateDetails {
188
+ dynamicContentList: DynamicContent[];
189
+ compiledHtml: string;
190
+ rawHtml: string;
191
+ css: string;
192
+ ampHtml: string;
193
+ ampErrors: string[];
194
+ modules: number[];
195
+ recommendation: {
196
+ campaignUrls: Record<string, string>;
197
+ configs: Record<string, string>;
198
+ };
199
+ unsubscribe: {
200
+ status: boolean;
201
+ config: number[];
202
+ };
203
+ metadata: Metadata;
204
+ }
205
+
206
+ interface Metadata {
207
+ emailId: string;
208
+ partnerName?: string;
209
+ productType?: number;
210
+ userId: string;
211
+ username?: string;
212
+ savedModulesFolderName?: string;
213
+ defaultModulesFolderName?: string;
214
+ }
215
+ ```
216
+
217
+ > ⚠️ **Important:** The `metadata` object in the `save:complete` payload must be passed directly into your `templateConfig` / `stripoConfig` object while saving. This ensures the email-service receives the correct version of sync modules features
218
+
180
219
  ---
181
220
 
182
221
  ## Exposed Methods
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as b } from "../../enums/defaults.js";
2
- import { object as o, number as p, optional as e, string as t, pipe as u, picklist as n, minLength as d, custom as S, boolean as a, array as c, literal as r, variant as k } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as p, optional as e, string as t, pipe as u, picklist as n, custom as S, boolean as a, array as c, minLength as d, literal as r, variant as k } from "../../node_modules/valibot/dist/index.js";
3
3
  const m = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "16abb398"
15
+ "a26d7792"
16
16
  );
17
17
  const v = s.exports;
18
18
  export {
@@ -1,65 +1,64 @@
1
- import { defineComponent as z, defineAsyncComponent as M, ref as K, computed as _, watch as V, onMounted as j, onUnmounted as q } from "vue";
2
- import { provideGuidoActions as J } from "../composables/useGuidoActions.js";
3
- import { usePartner as Q } from "../composables/usePartner.js";
4
- import { useStripo as X } from "../composables/useStripo.js";
5
- import { useTimerClone as Y } from "../composables/useTimerClone.js";
6
- import { migrate as P } from "../config/migrator/index.js";
7
- import { ModuleFolderDefaults as A } from "../enums/defaults.js";
8
- import Z from "./organisms/base/Toaster.vue.js";
9
- import $ from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
10
- import ee from "./organisms/header/HeaderWrapper.vue.js";
11
- import oe from "./organisms/LoadingWrapper.vue.js";
12
- import te from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
13
- import ne from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
1
+ import { defineComponent as K, defineAsyncComponent as _, ref as V, computed as P, watch as j, onMounted as q, onUnmounted as J } from "vue";
2
+ import { provideGuidoActions as Q } from "../composables/useGuidoActions.js";
3
+ import { usePartner as X } from "../composables/usePartner.js";
4
+ import { useStripo as Y } from "../composables/useStripo.js";
5
+ import { useTimerClone as Z } from "../composables/useTimerClone.js";
6
+ import { migrate as A } from "../config/migrator/index.js";
7
+ import { ModuleFolderDefaults as N } from "../enums/defaults.js";
8
+ import $ from "./organisms/base/Toaster.vue.js";
9
+ import ee from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
10
+ import oe from "./organisms/header/HeaderWrapper.vue.js";
11
+ import te from "./organisms/LoadingWrapper.vue.js";
12
+ import ne from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
13
+ import se from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
14
14
  import { useStripoApi as re } from "../services/stripoApi.js";
15
- import { useConfigStore as se } from "../stores/config.js";
16
- import { useDynamicContentStore as ce } from "../stores/dynamic-content.js";
17
- import { useEditorStore as ae } from "../stores/editor.js";
18
- import { usePreviewStore as ie } from "../stores/preview.js";
15
+ import { useConfigStore as ce } from "../stores/config.js";
16
+ import { useDynamicContentStore as ae } from "../stores/dynamic-content.js";
17
+ import { useEditorStore as ie } from "../stores/editor.js";
18
+ import { usePreviewStore as me } from "../stores/preview.js";
19
19
  import { useUnsubscribeStore as de } from "../stores/unsubscribe.js";
20
- const Le = /* @__PURE__ */ z({
20
+ const Me = /* @__PURE__ */ K({
21
21
  __name: "Guido",
22
22
  props: {
23
23
  config: null
24
24
  },
25
25
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
26
- setup(N, { expose: W, emit: t }) {
27
- const u = N, I = M(
26
+ setup(W, { expose: I, emit: t }) {
27
+ const v = W, O = _(
28
28
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
29
- ), O = M(
29
+ ), G = _(
30
30
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
31
- ), p = K(), a = ce(), v = de(), r = se();
32
- r.init(u.config);
33
- const i = ae(), G = ie(), s = _(() => i.hasChanges), { isTestPartner: H } = Q(), y = () => {
31
+ ), h = V(), i = ae(), y = de(), s = ce();
32
+ s.init(v.config);
33
+ const m = ie(), H = me(), c = P(() => m.hasChanges), { isTestPartner: x } = X(), f = () => {
34
34
  var e;
35
- return (e = p.value) == null ? void 0 : e.handleSave(!0);
35
+ return (e = h.value) == null ? void 0 : e.handleSave(!0);
36
36
  }, {
37
37
  templateId: d,
38
- userId: h,
39
- partnerName: f,
40
- productType: b,
41
- username: S,
38
+ userId: b,
39
+ partnerName: S,
40
+ username: g,
42
41
  template: o,
43
42
  editor: n
44
- } = r, c = (o == null ? void 0 : o.html) || "", g = (o == null ? void 0 : o.css) || "", m = (o == null ? void 0 : o.preselectedDynamicContent) || [], w = (n == null ? void 0 : n.savedModulesFolderName) || A.SAVED_MODULES, D = (n == null ? void 0 : n.defaultModulesFolderName) || A.DEFAULT_MODULES;
45
- i.templateId = d;
46
- const { initPlugin: E } = X({
43
+ } = s, a = (o == null ? void 0 : o.html) || "", D = (o == null ? void 0 : o.css) || "", l = (o == null ? void 0 : o.preselectedDynamicContent) || [], w = (n == null ? void 0 : n.savedModulesFolderName) || N.SAVED_MODULES, E = (n == null ? void 0 : n.defaultModulesFolderName) || N.DEFAULT_MODULES;
44
+ m.templateId = d;
45
+ const u = {
47
46
  emailId: d,
48
- userId: h,
49
- username: S,
50
- partnerName: f,
51
- productType: b,
52
- preselectedDynamicContentList: m,
47
+ userId: b,
48
+ username: g,
49
+ partnerName: S,
53
50
  savedModulesFolderName: w,
54
- defaultModulesFolderName: D,
51
+ defaultModulesFolderName: E
52
+ }, C = {
53
+ preselectedDynamicContentList: l,
55
54
  onReady: () => {
56
55
  console.debug("guido:ready"), t("ready");
57
56
  }
58
- }), { getDefaultTemplate: C } = re(), { cloneTimersOnSave: T, hasTimerBlocks: k } = Y(), x = _(() => {
57
+ }, { initPlugin: T } = Y(u, C), { getDefaultTemplate: k } = re(), { cloneTimersOnSave: F, hasTimerBlocks: U } = Z(), B = P(() => {
59
58
  var e;
60
- return !((e = r.ui) != null && e.showHeader);
59
+ return !((e = s.ui) != null && e.showHeader);
61
60
  });
62
- J({
61
+ Q({
63
62
  onBack: () => {
64
63
  console.debug("guido:back"), t("back");
65
64
  },
@@ -67,55 +66,56 @@ const Le = /* @__PURE__ */ z({
67
66
  console.debug("guido:save:start"), t("save:start");
68
67
  },
69
68
  onSaveComplete: (e) => {
70
- console.debug("guido:save:complete", e), t("save:complete", e);
69
+ const r = { ...e, metadata: u };
70
+ console.debug("guido:save:complete", r), t("save:complete", r);
71
71
  },
72
72
  onTestEmailClick: () => {
73
73
  console.debug("guido:test-email:click"), t("test-email:click");
74
74
  }
75
75
  });
76
- const F = (e) => {
77
- console.debug("dynamic-content:close", e), a.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
78
- }, U = () => {
76
+ const L = (e) => {
77
+ console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
78
+ }, M = () => {
79
79
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
80
80
  };
81
- V(() => s.value, () => {
82
- t("on-change", s.value);
81
+ j(() => c.value, () => {
82
+ t("on-change", c.value);
83
83
  });
84
- const l = (e) => {
85
- const L = e, { attribute: B, position: R } = L.detail;
86
- console.debug("dynamic-content:open", L.detail), t("dynamic-content:open", B, R);
84
+ const p = (e) => {
85
+ const r = e, { attribute: R, position: z } = r.detail;
86
+ console.debug("dynamic-content:open", r.detail), t("dynamic-content:open", R, z);
87
87
  };
88
- return j(async () => {
88
+ return q(async () => {
89
89
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
90
90
  try {
91
- v.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
91
+ y.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
92
92
  let e = {
93
- html: c && await P(c),
94
- css: g
93
+ html: a && await A(a),
94
+ css: D
95
95
  };
96
- e.html || (e = await C(), e.html = await P(e.html)), k(e.html) && (e.html = await T(e.html)), await E(e), a.selectedDynamicContentList = m;
96
+ e.html || (e = await k(), e.html = await A(e.html)), U(e.html) && (e.html = await F(e.html)), await T(e), i.selectedDynamicContentList = l;
97
97
  } catch (e) {
98
98
  console.error("Failed to initialize Stripo editor:", e);
99
99
  }
100
- document.addEventListener("dynamic-content:open", l);
101
- }), q(() => {
102
- document.removeEventListener("dynamic-content:open", l);
100
+ document.addEventListener("dynamic-content:open", p);
101
+ }), J(() => {
102
+ document.removeEventListener("dynamic-content:open", p);
103
103
  try {
104
104
  window.UIEditor.removeEditor();
105
105
  } catch {
106
106
  console.debug("Failed to remove Stripo editor: No editor found");
107
107
  }
108
- r.reset();
109
- }), W({
108
+ s.reset();
109
+ }), I({
110
110
  dynamicContent: {
111
- insert: F,
112
- close: U
111
+ insert: L,
112
+ close: M
113
113
  },
114
- hasChanges: s,
115
- saveSilent: y
116
- }), { __sfc: !0, PreviewContainer: I, OnboardingWrapper: O, headerWrapperRef: p, dynamicContentStore: a, unsubscribeStore: v, props: u, configStore: r, editorStore: i, previewStore: G, hasChanges: s, isTestPartner: H, saveSilent: y, templateId: d, userId: h, partnerName: f, productType: b, username: S, templateConfig: o, editorConfig: n, html: c, css: g, preselectedDynamicContentList: m, savedModulesFolderName: w, defaultModulesFolderName: D, emit: t, initPlugin: E, getDefaultTemplate: C, cloneTimersOnSave: T, hasTimerBlocks: k, noHeader: x, insertDynamicContent: F, closeDynamicContent: U, handleDynamicContentOpen: l, Toaster: Z, FilterSelectionDrawer: $, HeaderWrapper: ee, LoadingWrapper: oe, SaveAsTemplateDrawer: te, UnsubscribeWrapper: ne };
114
+ hasChanges: c,
115
+ saveSilent: f
116
+ }), { __sfc: !0, PreviewContainer: O, OnboardingWrapper: G, headerWrapperRef: h, dynamicContentStore: i, unsubscribeStore: y, props: v, configStore: s, editorStore: m, previewStore: H, hasChanges: c, isTestPartner: x, saveSilent: f, templateId: d, userId: b, partnerName: S, username: g, templateConfig: o, editorConfig: n, html: a, css: D, preselectedDynamicContentList: l, savedModulesFolderName: w, defaultModulesFolderName: E, emit: t, metadata: u, options: C, initPlugin: T, getDefaultTemplate: k, cloneTimersOnSave: F, hasTimerBlocks: U, noHeader: B, insertDynamicContent: L, closeDynamicContent: M, handleDynamicContentOpen: p, Toaster: $, FilterSelectionDrawer: ee, HeaderWrapper: oe, LoadingWrapper: te, SaveAsTemplateDrawer: ne, UnsubscribeWrapper: se };
117
117
  }
118
118
  });
119
119
  export {
120
- Le as default
120
+ Me as default
121
121
  };
@@ -1,26 +1,28 @@
1
1
  import r from "./FilterItem.vue2.js";
2
2
  /* empty css */
3
- import l from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var i = function() {
3
+ import i from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var l = function() {
5
5
  var a = this, e = a._self._c, t = a._self._setupProxy;
6
- return e("div", { staticClass: "d-f f-d-c w-1 gap-16", attrs: { "data-filter-group": a.filter.filterGroup, "data-filter-number": a.filter.filterNumber } }, [e("div", { staticClass: "d-f a-i-c j-c-s-b pt-4", class: { "bor-t-s-s bor-t-w-1 bor-t-c-50": a.index === 0 } }, [e("p", [a._v(" " + a._s(t.trans("newsletter.filter")) + " " + a._s(a.index + 1) + " ")]), e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: function(s) {
6
+ return e("div", { staticClass: "d-f f-d-c w-1 gap-16" }, [e("div", { staticClass: "d-f a-i-c j-c-s-b pt-4", class: { "bor-t-s-s bor-t-w-1 bor-t-c-50": a.index === 0 } }, [e("p", [a._v(" " + a._s(t.trans("newsletter.filter")) + " " + a._s(a.index + 1) + " ")]), e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: function(s) {
7
7
  return t.emit("delete-filter", t.props.filter);
8
- } } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "disabled-status": "", "search-status": "", "button-status": !1, "label-text": t.trans("action-builder.filter-type"), options: t.filterTypeOptions, value: [t.filterTypeOptions[0]] } }), e(t.InSelect, { staticClass: "w-2", attrs: { id: "filter-item-input--attribute-type", "search-status": "", "static-position": "bottom right", "button-status": !1, "label-text": t.trans("condition.attribute"), options: t.store.getFilterList, state: t.getFieldState("attribute"), value: [t.selectedAttributeType] }, on: { select: t.handleAttributeChange } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [t.isBooleanAttribute ? e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.booleanValueOptions, state: t.getFieldState("value"), value: [t.selectedBooleanValue] }, on: { select: t.handleBooleanValueChange } }) : [e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.getOperatorOptions(t.selectedAttributeType.type), state: t.getFieldState("operator"), value: [t.selectedOperatorType] }, on: { select: function(s) {
8
+ } } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "disabled-status": "", "search-status": "", "button-status": !1, "label-text": t.trans("action-builder.filter-type"), options: t.filterTypeOptions, value: [t.filterTypeOptions[0]] } }), e(t.InSelect, { staticClass: "w-2", attrs: { id: "filter-item-input--attribute-type", "search-status": "", "static-position": "bottom right", "button-status": !1, "label-text": t.trans("condition.attribute"), options: t.store.getFilterList, value: [t.selectedAttributeType] }, on: { select: function(s) {
9
+ return t.updateFilter({ text: "attribute", value: s.value });
10
+ } } })], 1), e("div", { staticClass: "w-1 d-f a-i-s j-c-s-b gap-16" }, [e(t.InSelect, { staticClass: "w-2", attrs: { "button-status": !1, "label-text": t.trans("condition.operator"), options: t.getOperatorOptions(t.selectedAttributeType.type), value: [t.selectedOperatorType] }, on: { select: function(s) {
9
11
  return t.updateFilter({ text: "operator", value: s.value });
10
- } } }), e(t.InBasicTextInput, { staticClass: "w-2", attrs: { id: "filter-item-input--value", name: "imageUrl", "character-counter-status": !1, "label-text": t.trans("condition.value"), "max-character-length": 25, "placeholder-text": t.trans("condition.enter-value-placeholder"), "state-message": t.valueErrorMessage, states: t.getFieldState("value"), "tooltip-status": !1, type: t.valueInputType, value: decodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
12
+ } } }), e(t.InBasicTextInput, { staticClass: "w-2", attrs: { id: "filter-item-input--value", name: "imageUrl", type: "text", "character-counter-status": !1, "label-text": t.trans("condition.value"), "max-character-length": 25, "placeholder-text": t.trans("condition.enter-value-placeholder"), "tooltip-status": !1, value: decodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
11
13
  t.updateFilter({ text: "value", value: encodeURIComponent(s) });
12
- } } })]], 2), t.props.hasLogicAdapter ? e("div", { staticClass: "w-1 d-f a-i-c j-c-c p-r bor-b-s-s bor-b-w-1 bor-b-c-50 mt-4" }, [e(t.LogicAdapter, { staticClass: "p-a", attrs: { logic: t.props.filter.innerGroupOperator }, on: { change: function(s) {
14
+ } } })], 1), t.props.hasLogicAdapter ? e("div", { staticClass: "w-1 d-f a-i-c j-c-c p-r bor-b-s-s bor-b-w-1 bor-b-c-50 mt-4" }, [e(t.LogicAdapter, { staticClass: "p-a", attrs: { logic: t.props.filter.innerGroupOperator }, on: { change: function(s) {
13
15
  return t.updateFilter({ text: "innerGroupOperator", value: s });
14
16
  } } })], 1) : a._e()]);
15
- }, o = [], n = /* @__PURE__ */ l(
17
+ }, n = [], o = /* @__PURE__ */ i(
16
18
  r,
17
- i,
18
- o,
19
+ l,
20
+ n,
19
21
  !1,
20
22
  null,
21
- "b88d274d"
23
+ "6562e38c"
22
24
  );
23
- const f = n.exports;
25
+ const f = o.exports;
24
26
  export {
25
27
  f as default
26
28
  };
@@ -1,69 +1,38 @@
1
- import { defineComponent as V, computed as o } from "vue";
2
- import { useTranslations as _ } from "../../../../composables/useTranslations.js";
3
- import { getOperatorOptions as s } from "../../../../enums/extensions/recommendationBlock.js";
4
- import { useRecommendationExtensionStore as C } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { getInvalidFilterFields as A } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
6
- import { InButtonV2 as L, InSelect as O, InBasicTextInput as S } from "@useinsider/design-system-vue";
7
- import E from "./LogicAdapter.vue.js";
8
- import { useDebounceFn as N } from "../../../../node_modules/@vueuse/shared/index.js";
9
- const K = /* @__PURE__ */ V({
1
+ import { defineComponent as f, computed as i } from "vue";
2
+ import { useTranslations as v } from "../../../../composables/useTranslations.js";
3
+ import { getOperatorOptions as a } from "../../../../enums/extensions/recommendationBlock.js";
4
+ import { useRecommendationExtensionStore as x } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { InButtonV2 as y, InSelect as F, InBasicTextInput as T } from "@useinsider/design-system-vue";
6
+ import _ from "./LogicAdapter.vue.js";
7
+ import { useDebounceFn as b } from "../../../../node_modules/@vueuse/shared/index.js";
8
+ const h = /* @__PURE__ */ f({
10
9
  __name: "FilterItem",
11
10
  props: {
12
11
  filter: null,
13
12
  index: null,
14
- hasLogicAdapter: { type: Boolean },
15
- submitted: { type: Boolean }
13
+ hasLogicAdapter: { type: Boolean }
16
14
  },
17
15
  emits: ["delete-filter"],
18
- setup(f, { emit: v }) {
19
- const t = f, p = _(), l = C(), F = [
16
+ setup(p, { emit: u }) {
17
+ const e = p, n = v(), r = x(), m = [
20
18
  {
21
- text: p("email-editor.standard-filter"),
19
+ text: n("email-editor.standard-filter"),
22
20
  value: "standardFilter"
23
21
  }
24
- ], n = [
25
- { text: "True", value: "true" },
26
- { text: "False", value: "false" }
27
- ], c = o(() => t.filter.attribute || ""), r = o(() => l.getFilterList.find((e) => e.value === c.value) || { text: "", value: "", type: "" }), y = o(
28
- () => {
29
- var e;
30
- return ((e = r.value) == null ? void 0 : e.type) === "Boolean";
31
- }
32
- ), g = o(() => {
33
- var e;
34
- return s((e = r.value) == null ? void 0 : e.type).find((a) => a.value === t.filter.operator);
35
- }), b = o(
36
- () => n.find((e) => e.value === t.filter.value) || n[0]
37
- ), i = o(() => t.submitted ? A(t.filter) : /* @__PURE__ */ new Set()), h = (e) => i.value.has(e) ? "error" : "default", B = o(
38
- () => i.value.has("value") ? "Enter Value to continue." : ""
39
- ), d = o(
40
- () => {
41
- var e;
42
- return ((e = r.value) == null ? void 0 : e.type) === "Number";
43
- }
44
- ), x = o(() => d.value ? "number" : "text"), T = N((e) => {
45
- l.updateFilter({
46
- ...t.filter,
47
- [e.text]: e.value
48
- });
22
+ ], s = i(() => e.filter.attribute || ""), l = i(() => r.getFilterList.find((t) => t.value === s.value) || { text: "", value: "", type: "" }), c = i(() => {
23
+ var t;
24
+ return a((t = l.value) == null ? void 0 : t.type).find((o) => o.value === e.filter.operator);
25
+ }), d = b((t) => {
26
+ console.debug("updateFilter: ", t);
27
+ const o = {
28
+ ...e.filter,
29
+ [t.text]: t.value
30
+ };
31
+ r.updateFilter(o);
49
32
  }, 500);
50
- return { __sfc: !0, trans: p, store: l, props: t, filterTypeOptions: F, booleanValueOptions: n, attributeType: c, selectedAttributeType: r, isBooleanAttribute: y, selectedOperatorType: g, selectedBooleanValue: b, emit: v, invalidFields: i, getFieldState: h, valueErrorMessage: B, isNumericAttribute: d, valueInputType: x, updateFilter: T, handleAttributeChange: (e) => {
51
- const a = l.getFilterList.find((I) => I.value === e.value), m = (a == null ? void 0 : a.type) === "Boolean", [u] = s(a == null ? void 0 : a.type);
52
- l.updateFilter({
53
- ...t.filter,
54
- attribute: e.value,
55
- operator: m ? "=" : (u == null ? void 0 : u.value) ?? "",
56
- value: m ? "true" : ""
57
- });
58
- }, handleBooleanValueChange: (e) => {
59
- l.updateFilter({
60
- ...t.filter,
61
- operator: "=",
62
- value: e.value
63
- });
64
- }, getOperatorOptions: s, InBasicTextInput: S, InSelect: O, InButtonV2: L, LogicAdapter: E };
33
+ return { __sfc: !0, trans: n, store: r, props: e, filterTypeOptions: m, attributeType: s, selectedAttributeType: l, selectedOperatorType: c, emit: u, updateFilter: d, getOperatorOptions: a, InBasicTextInput: T, InSelect: F, InButtonV2: y, LogicAdapter: _ };
65
34
  }
66
35
  });
67
36
  export {
68
- K as default
37
+ h as default
69
38
  };
@@ -1,11 +1,11 @@
1
1
  import o from "./FilterSelectionDrawer.vue2.js";
2
2
  import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
- var i = function() {
3
+ var l = function() {
4
4
  var e = this, r = e._self._c, t = e._self._setupProxy;
5
- return r(t.WpDrawer, { attrs: { id: "recommendation-filter-drawer", "description-status": "", "description-text": t.trans("email-editor.filter-description"), "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.filterSelectionDrawerStatus, "title-text": t.trans("email-editor.add-filters") }, on: { cancelOrBackButtonEvent: t.cancelModal, onCloseEvent: t.cancelModal, primaryButtonEvent: t.applyFilter } }, [t.store.filterSelectionDrawerStatus ? r(t.Filters, { ref: "filtersRef", attrs: { submitted: t.submitted } }) : e._e()], 1);
5
+ return r(t.WpDrawer, { attrs: { id: "recommendation-filter-drawer", "title-text": "Filter Selection", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.filterSelectionDrawerStatus }, on: { cancelOrBackButtonEvent: t.closeModal, onCloseEvent: t.closeModal, primaryButtonEvent: t.applyFilter } }, [r(t.Filters)], 1);
6
6
  }, s = [], a = /* @__PURE__ */ n(
7
7
  o,
8
- i,
8
+ l,
9
9
  s,
10
10
  !1,
11
11
  null,
@@ -1,51 +1,38 @@
1
- import { defineComponent as d, ref as a, watch as y, computed as g, nextTick as v } from "vue";
2
- import b from "../../../wrappers/WpDrawer.vue.js";
3
- import { useTranslations as w } from "../../../../composables/useTranslations.js";
4
- import { useRecommendationExtensionStore as F } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { isFilterValid as _ } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
6
- import h from "./Filters.vue.js";
7
- const I = /* @__PURE__ */ d({
1
+ import { defineComponent as n, ref as a, computed as l } from "vue";
2
+ import i from "../../../wrappers/WpDrawer.vue.js";
3
+ import { useTranslations as c } from "../../../../composables/useTranslations.js";
4
+ import { useRecommendationExtensionStore as p } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import u from "./Filters.vue.js";
6
+ const v = /* @__PURE__ */ n({
8
7
  __name: "FilterSelectionDrawer",
9
- setup(S) {
10
- const r = w(), e = F(), t = a(!1), o = a(!1), c = a();
11
- y(() => e.filterSelectionDrawerStatus, (n) => {
12
- n && (o.value = !1);
13
- });
14
- const f = g(() => ({
8
+ setup(f) {
9
+ const r = c(), t = p(), e = a(!1), s = l(() => ({
15
10
  primaryButton: {
16
11
  styling: "solid",
17
12
  type: "primary",
18
13
  labelText: r(
19
- t.value ? "unsubscription-preference.selecting-type" : "products.select-and-continue"
14
+ e.value ? "unsubscription-preference.selecting-type" : "products.select-and-continue"
20
15
  ),
21
- loadingStatus: t.value
16
+ loadingStatus: e.value,
17
+ disabledStatus: !1
22
18
  },
23
19
  cancelOrBackButton: {
24
20
  styling: "ghost",
25
21
  type: "secondary",
26
22
  labelText: r("products.cancel"),
27
- disabledStatus: t.value
23
+ disabledStatus: e.value
28
24
  }
29
- }));
30
- return { __sfc: !0, trans: r, store: e, isApplying: t, submitted: o, filtersRef: c, footerButtonGroupOptions: f, cancelModal: () => {
31
- e.cancelFilterDrawer();
32
- }, applyFilter: async () => {
33
- var u;
34
- o.value = !0;
35
- const { filters: n } = e.recommendationConfigs, i = n.find((l) => !_(l));
36
- if (i) {
37
- (u = c.value) == null || u.switchToGroup(i.filterGroup), await v();
38
- const { filterGroup: l, filterNumber: p } = i, m = `[data-filter-group="${l}"][data-filter-number="${p}"]`, s = document.querySelector(m);
39
- s == null || s.scrollIntoView({ behavior: "smooth", block: "center" });
40
- return;
41
- }
42
- t.value = !0, e.patchCurrentBlockConfig(
43
- { filters: e.recommendationConfigs.filters },
25
+ })), o = () => {
26
+ t.closeFilterDrawer();
27
+ };
28
+ return { __sfc: !0, trans: r, store: t, isApplying: e, footerButtonGroupOptions: s, closeModal: o, applyFilter: () => {
29
+ e.value = !0, t.patchCurrentBlockConfig(
30
+ { filters: t.recommendationConfigs.filters },
44
31
  { triggerRefetch: !0 }
45
- ), e.closeFilterDrawer(), t.value = !1;
46
- }, WpDrawer: b, Filters: h };
32
+ ), o(), e.value = !1;
33
+ }, WpDrawer: i, Filters: u };
47
34
  }
48
35
  });
49
36
  export {
50
- I as default
37
+ v as default
51
38
  };
@@ -1,20 +1,20 @@
1
- import l from "./Filters.vue2.js";
1
+ import s from "./Filters.vue2.js";
2
2
  /* empty css */
3
3
  import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var o = function() {
5
- var r = this, e = r._self._c, t = r._self._setupProxy;
6
- return e("div", { staticClass: "d-f f-d-c gap-16" }, [e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e(t.InSegments, { staticClass: "f-g-1 w-1", attrs: { id: "guido__filter-group-segments", "segment-list": t.filterGroupList, selected: t.selectedFilterGroup, "with-icon": !1 }, on: { click: t.switchToGroup } }), e(t.InButtonV2, { staticClass: "w-20-s f-g-1", attrs: { id: "guido__add-filter-group-button", "left-icon": "line-plus-netural", type: "secondary", "disabled-status": t.isMaxFilterGroupCount, "label-text": t.trans("smart-recommender.add-filter-group"), "tooltip-text": t.isMaxFilterGroupCount ? t.trans("email-editor.add-filter-group-tooltip") : "" }, on: { click: t.handleAddFilterGroup } })], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e("div", { staticClass: "d-f a-i-c" }, [t.selectedFilterGroup > 1 ? e(t.LogicAdapter, { staticClass: "mr-2", attrs: { logic: t.outerGroupOperator }, on: { change: t.handleOuterGroupOperatorChange } }) : r._e(), e("p", [r._v(" " + r._s(t.trans("email-editor.filter-group")) + " " + r._s(t.selectedFilterGroup) + " ")])], 1), t.hasRemoveFilterButton ? e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: t.handleDeleteFilterGroup } }) : r._e()], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b f-d-c" }, r._l(t.selectedFilterGroupFilters, function(s, i) {
7
- return e(t.FilterItem, { key: i, attrs: { filter: s, "has-logic-adapter": t.hasLogicAdapter && i !== t.selectedFilterGroupFilters.length - 1, index: i, submitted: r.submitted }, on: { "delete-filter": t.handleDeleteFilter } });
8
- }), 1), e("div", { staticClass: "d-f a-i-c j-c-c mt-3" }, [e(t.InButtonV2, { staticClass: "w-11-s", attrs: { id: "filter-group--add-filter-button", "left-icon": "line-plus-netural", type: "subtle-primary", "disabled-status": t.isMaxFilterPerGroupCount, "label-text": t.trans("smart-recommender.add-filter-condition"), "tooltip-text": t.isMaxFilterPerGroupCount ? t.trans("email-editor.add-filter-tooltip") : "" }, on: { click: t.handleAddFilter } })], 1)]);
5
+ var i = this, e = i._self._c, t = i._self._setupProxy;
6
+ return e("div", { staticClass: "d-f f-d-c gap-16" }, [e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e(t.InSegments, { staticClass: "f-g-1 w-1", attrs: { id: "guido__filter-group-segments", "segment-list": t.filterGroupList, selected: t.selectedFilterGroup, "with-icon": !1 }, on: { click: t.changeFilterGroup } }), e(t.InButtonV2, { staticClass: "w-20-s f-g-1", attrs: { id: "guido__add-filter-group-button", "left-icon": "line-plus-netural", type: "secondary", "disabled-status": t.isMaxFilterGroupCount, "label-text": t.trans("smart-recommender.add-filter-group"), "tooltip-text": t.isMaxFilterGroupCount ? t.trans("email-editor.add-filter-tooltip") : "" }, on: { click: t.handleAddFilterGroup } })], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b gap-16" }, [e("div", { staticClass: "d-f a-i-c" }, [t.selectedFilterGroup > 1 ? e(t.LogicAdapter, { staticClass: "mr-2" }) : i._e(), e("p", [i._v(" " + i._s(t.trans("email-editor.filter-group")) + " " + i._s(t.selectedFilterGroup) + " ")])], 1), t.hasRemoveFilterButton ? e(t.InButtonV2, { attrs: { id: "guido__delete-filter-group-button", "left-icon": "line-delete", styling: "text", type: "danger", "label-text-status": !1 }, on: { click: t.handleDeleteFilterGroup } }) : i._e()], 1), e("div", { staticClass: "d-f a-i-c j-c-s-b f-d-c" }, i._l(t.selectedFilterGroupFilters, function(l, r) {
7
+ return e(t.FilterItem, { key: r, attrs: { filter: l, "has-logic-adapter": t.hasLogicAdapter && r !== t.selectedFilterGroupFilters.length - 1, index: r }, on: { "delete-filter": t.handleDeleteFilter } });
8
+ }), 1), e("div", { staticClass: "d-f a-i-c j-c-c mt-3" }, [e(t.InButtonV2, { staticClass: "w-11-s", attrs: { id: "filter-group--add-filter-button", "left-icon": "line-plus-netural", type: "subtle-primary", "label-text": t.trans("smart-recommender.add-filter-condition") }, on: { click: t.handleAddFilter } })], 1)]);
9
9
  }, d = [], n = /* @__PURE__ */ a(
10
- l,
10
+ s,
11
11
  o,
12
12
  d,
13
13
  !1,
14
14
  null,
15
- "bd89e39d"
15
+ "1ccb6d4a"
16
16
  );
17
- const m = n.exports;
17
+ const _ = n.exports;
18
18
  export {
19
- m as default
19
+ _ as default
20
20
  };