@useinsider/guido 3.3.1-beta.11641c6 → 3.4.0-beta.0ec3bc7

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 (38) hide show
  1. package/dist/@types/config/schemas.js +1 -1
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +42 -40
  4. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +9 -11
  5. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +70 -35
  6. package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
  7. package/dist/composables/useCortexBlueprintBridge.js +66 -0
  8. package/dist/composables/useEmailTemplateApplier.js +41 -0
  9. package/dist/composables/useGuidoStateBridge.js +48 -0
  10. package/dist/composables/useHtmlValidator.js +41 -36
  11. package/dist/composables/useResponsivePreview.js +1 -1
  12. package/dist/config/compiler/recommendationCompilerRules.js +10 -10
  13. package/dist/config/migrator/radioButtonMigrator.js +30 -29
  14. package/dist/config/migrator/recommendation/htmlBuilder.js +65 -65
  15. package/dist/enums/extensions/recommendationBlock.js +33 -32
  16. package/dist/extensions/Blocks/RadioButton/template.js +6 -6
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -21
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +10 -10
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  20. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +5 -5
  21. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +26 -13
  22. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
  23. package/dist/guido.css +1 -1
  24. package/dist/node_modules/valibot/dist/index.js +252 -329
  25. package/dist/package.json.js +1 -1
  26. package/dist/services/unsubscribeApi.js +6 -6
  27. package/dist/src/composables/useCortexBlueprintBridge.d.ts +25 -0
  28. package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
  29. package/dist/src/composables/useGuidoStateBridge.d.ts +22 -0
  30. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
  31. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  32. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -1
  33. package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +2 -0
  34. package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.test.d.ts +1 -0
  35. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
  36. package/dist/src/stores/guido-email-editor.d.ts +41 -0
  37. package/dist/stores/guido-email-editor.js +20 -0
  38. package/package.json +5 -4
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as S } from "../../enums/defaults.js";
2
- import { object as o, number as n, optional as e, string as t, pipe as p, picklist as l, minLength as b, custom as h, boolean as a, array as c, record as k, looseObject as y, literal as i, variant as g, union as f, unknown as s } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as n, optional as e, string as t, picklist as l, pipe as p, minLength as b, custom as h, boolean as a, array as c, record as k, literal as i, looseObject as y, variant as g, union as f, unknown as s } from "../../node_modules/valibot/dist/index.js";
3
3
  const d = {
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
- "1a4e7084"
15
+ "cdee3452"
16
16
  );
17
17
  const l = s.exports;
18
18
  export {
@@ -1,38 +1,40 @@
1
- import { defineComponent as J, defineAsyncComponent as I, ref as W, computed as B, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
2
- import { provideGuidoActions as Z } from "../composables/useGuidoActions.js";
3
- import { usePartner as ee } from "../composables/usePartner.js";
4
- import { useStripo as oe } from "../composables/useStripo.js";
5
- import { useTimerClone as te } from "../composables/useTimerClone.js";
6
- import { migrate as H } from "../config/migrator/index.js";
7
- import { ModuleFolderDefaults as x } from "../enums/defaults.js";
8
- import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
9
- import re from "./organisms/AutoSaveController.vue.js";
10
- import se from "./organisms/base/Toaster.vue.js";
11
- import ce from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
12
- import ae from "./organisms/header/HeaderWrapper.vue.js";
13
- import ie from "./organisms/LoadingWrapper.vue.js";
14
- import me from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
15
- import de from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
16
- import { useStripoApi as le } from "../services/stripoApi.js";
17
- import { useConfigStore as ue } from "../stores/config.js";
18
- import { useDynamicContentStore as pe } from "../stores/dynamic-content.js";
19
- import { useEditorStore as fe } from "../stores/editor.js";
20
- import { usePreviewStore as ve } from "../stores/preview.js";
21
- import { useUnsubscribeStore as ye } from "../stores/unsubscribe.js";
22
- const We = /* @__PURE__ */ J({
1
+ import { defineComponent as J, defineAsyncComponent as R, ref as I, computed as W, watch as Q, onMounted as X, onUnmounted as Y } from "vue";
2
+ import { useCortexBlueprintBridge as Z } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as ee } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as oe } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as te } from "../composables/usePartner.js";
6
+ import { useStripo as ne } from "../composables/useStripo.js";
7
+ import { useTimerClone as re } from "../composables/useTimerClone.js";
8
+ import { migrate as x } from "../config/migrator/index.js";
9
+ import { ModuleFolderDefaults as G } from "../enums/defaults.js";
10
+ import { RIBBON_SELECTOR as se } from "../enums/onboarding.js";
11
+ import ce from "./organisms/AutoSaveController.vue.js";
12
+ import ae from "./organisms/base/Toaster.vue.js";
13
+ import ie from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
14
+ import me from "./organisms/header/HeaderWrapper.vue.js";
15
+ import de from "./organisms/LoadingWrapper.vue.js";
16
+ import le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
17
+ import ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
18
+ import { useStripoApi as pe } from "../services/stripoApi.js";
19
+ import { useConfigStore as fe } from "../stores/config.js";
20
+ import { useDynamicContentStore as ve } from "../stores/dynamic-content.js";
21
+ import { useEditorStore as ye } from "../stores/editor.js";
22
+ import { usePreviewStore as he } from "../stores/preview.js";
23
+ import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
24
+ const He = /* @__PURE__ */ J({
23
25
  __name: "Guido",
24
26
  props: {
25
27
  config: null
26
28
  },
27
29
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
28
- setup(G, { expose: z, emit: n }) {
29
- const g = G, q = I(
30
+ setup(H, { expose: z, emit: n }) {
31
+ const g = H, q = R(
30
32
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
31
- ), K = I(
33
+ ), K = R(
32
34
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
33
- ), w = W(), u = W(), p = pe(), E = ye(), i = ue();
35
+ ), w = I(), u = I(), p = ve(), E = Se(), i = fe();
34
36
  i.init(g.config);
35
- const f = fe(), V = ve(), m = B(() => f.hasChanges), { isTestPartner: $ } = ee(), D = () => {
37
+ const f = ye(), V = he(), m = W(() => f.hasChanges), { isTestPartner: $ } = te(), D = () => {
36
38
  var e;
37
39
  return (e = w.value) == null ? void 0 : e.handleSave(!0);
38
40
  }, {
@@ -42,8 +44,8 @@ const We = /* @__PURE__ */ J({
42
44
  username: k,
43
45
  template: o,
44
46
  editor: s
45
- } = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || x.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || x.DEFAULT_MODULES;
46
- f.templateId = v;
47
+ } = i, d = (o == null ? void 0 : o.html) || "", F = (o == null ? void 0 : o.css) || "", y = (o == null ? void 0 : o.preselectedDynamicContent) || [], L = (s == null ? void 0 : s.savedModulesFolderName) || G.SAVED_MODULES, U = (s == null ? void 0 : s.defaultModulesFolderName) || G.DEFAULT_MODULES;
48
+ f.templateId = v, Z(), oe();
47
49
  const h = {
48
50
  emailId: v,
49
51
  userId: C,
@@ -56,11 +58,11 @@ const We = /* @__PURE__ */ J({
56
58
  onReady: () => {
57
59
  console.debug("guido:ready"), n("ready");
58
60
  }
59
- }, { initPlugin: M } = oe(h, _), { getDefaultTemplate: O } = le(), { cloneTimersOnSave: P, hasTimerBlocks: A } = te(), j = B(() => {
61
+ }, { initPlugin: M } = ne(h, _), { getDefaultTemplate: O } = pe(), { cloneTimersOnSave: P, hasTimerBlocks: A } = re(), j = W(() => {
60
62
  var e;
61
63
  return !((e = i.ui) != null && e.showHeader);
62
64
  });
63
- Z({
65
+ ee({
64
66
  onBack: () => {
65
67
  console.debug("guido:back"), n("back");
66
68
  },
@@ -75,9 +77,9 @@ const We = /* @__PURE__ */ J({
75
77
  console.debug("guido:test-email:click"), n("test-email:click");
76
78
  }
77
79
  });
78
- const N = (e) => {
80
+ const B = (e) => {
79
81
  console.debug("dynamic-content:close", e), p.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
80
- }, R = () => {
82
+ }, N = () => {
81
83
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
82
84
  };
83
85
  Q(() => m.value, () => {
@@ -90,7 +92,7 @@ const We = /* @__PURE__ */ J({
90
92
  let c = null;
91
93
  const b = () => {
92
94
  var t;
93
- const e = document.querySelector(ne);
95
+ const e = document.querySelector(se);
94
96
  (t = u.value) == null || t.style.setProperty("--ribbon-offset", `${(e == null ? void 0 : e.offsetHeight) ?? 0}px`);
95
97
  };
96
98
  return X(async () => {
@@ -102,10 +104,10 @@ const We = /* @__PURE__ */ J({
102
104
  E.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
103
105
  const a = ((l = o == null ? void 0 : o.migration) == null ? void 0 : l.recommendationConfigs) ?? {};
104
106
  let r = {
105
- html: d && await H(d, a),
107
+ html: d && await x(d, a),
106
108
  css: F
107
109
  };
108
- r.html || (r = await O(), r.html = await H(r.html, a)), A(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
110
+ r.html || (r = await O(), r.html = await x(r.html, a)), A(r.html) && (r.html = await P(r.html)), await M(r), p.selectedDynamicContentList = y;
109
111
  } catch (a) {
110
112
  console.error("Failed to initialize Stripo editor:", a);
111
113
  }
@@ -120,14 +122,14 @@ const We = /* @__PURE__ */ J({
120
122
  i.reset();
121
123
  }), z({
122
124
  dynamicContent: {
123
- insert: N,
124
- close: R
125
+ insert: B,
126
+ close: N
125
127
  },
126
128
  hasChanges: m,
127
129
  saveSilent: D
128
- }), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: w, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: E, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: $, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: A, noHeader: j, insertDynamicContent: N, closeDynamicContent: R, handleDynamicContentOpen: S, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: re, Toaster: se, FilterSelectionDrawer: ce, HeaderWrapper: ae, LoadingWrapper: ie, SaveAsTemplateDrawer: me, UnsubscribeWrapper: de };
130
+ }), { __sfc: !0, PreviewContainer: q, OnboardingWrapper: K, headerWrapperRef: w, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: E, props: g, configStore: i, editorStore: f, previewStore: V, hasChanges: m, isTestPartner: $, saveSilent: D, templateId: v, userId: C, partnerName: T, username: k, templateConfig: o, editorConfig: s, html: d, css: F, preselectedDynamicContentList: y, savedModulesFolderName: L, defaultModulesFolderName: U, emit: n, metadata: h, options: _, initPlugin: M, getDefaultTemplate: O, cloneTimersOnSave: P, hasTimerBlocks: A, noHeader: j, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: S, ribbonObserver: c, updateRibbonOffset: b, AutoSaveController: ce, Toaster: ae, FilterSelectionDrawer: ie, HeaderWrapper: me, LoadingWrapper: de, SaveAsTemplateDrawer: le, UnsubscribeWrapper: ue };
129
131
  }
130
132
  });
131
133
  export {
132
- We as default
134
+ He as default
133
135
  };
@@ -1,26 +1,24 @@
1
- import r from "./FilterItem.vue2.js";
1
+ import l 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 r = function() {
5
5
  var a = this, e = a._self._c, t = a._self._setupProxy;
6
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) {
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) {
9
- 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) {
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: t.handleOperatorChange } }), t.isAnyOfOperator ? e(t.InTags, { staticClass: "w-2", attrs: { "allow-bulk-paste": "", validate: "text", "allow-duplicates": !1, invalid: t.invalidFields.has("value"), "invalid-message": t.valueErrorMessage, label: t.trans("condition.value"), placeholder: t.trans("condition.enter-value-placeholder"), value: t.tagValues }, on: { input: t.onTagsInput } }) : t.isDateAttribute ? e(t.InDatePickerV2, { staticClass: "w-2", attrs: { id: `filter-item-input--value-${a.index}`, "single-date-picker-status": "", "label-text": t.trans("condition.value"), locale: t.datePickerLocale, name: `filter-item-input--value-${a.index}`, "placeholder-text": t.trans("condition.enter-value-placeholder"), state: t.getFieldState("value"), "state-message": t.valueErrorMessage, value: t.datePickerValue }, on: { apply: t.onDatePickerApply } }) : e(t.InBasicTextInput, { staticClass: "w-2", attrs: { id: `filter-item-input--value-${a.index}`, 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: t.safeDecodeURIComponent(t.props.filter.value) }, on: { input: function(s) {
11
9
  t.updateFilter({ text: "value", value: encodeURIComponent(s) });
12
10
  } } })]], 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) {
13
11
  return t.updateFilter({ text: "innerGroupOperator", value: s });
14
12
  } } })], 1) : a._e()]);
15
- }, o = [], n = /* @__PURE__ */ l(
13
+ }, n = [], o = /* @__PURE__ */ i(
14
+ l,
16
15
  r,
17
- i,
18
- o,
16
+ n,
19
17
  !1,
20
18
  null,
21
- "3b53a736"
19
+ "8053a037"
22
20
  );
23
- const f = n.exports;
21
+ const f = o.exports;
24
22
  export {
25
23
  f as default
26
24
  };
@@ -1,12 +1,14 @@
1
- import { defineComponent as _, computed as l } from "vue";
2
- import { useTranslations as C } from "../../../../composables/useTranslations.js";
3
- import { getOperatorOptions as p } from "../../../../enums/extensions/recommendationBlock.js";
4
- import { useRecommendationExtensionStore as V } 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__ */ _({
1
+ import { defineComponent as N, computed as r } from "vue";
2
+ import { useTranslations as U } from "../../../../composables/useTranslations.js";
3
+ import { getOperatorOptions as f, OP_ANY_OF as d } from "../../../../enums/extensions/recommendationBlock.js";
4
+ import { useRecommendationExtensionStore as E } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { parseTagList as j, safeDecodeURIComponent as g } from "../../../../extensions/Blocks/Recommendation/utils/filterUtil.js";
6
+ import { getInvalidFilterFields as w } from "../../../../extensions/Blocks/Recommendation/validation/filterSchema.js";
7
+ import { locale as M } from "../../../../utils/dateUtil.js";
8
+ import { InTags as Y, InButtonV2 as q, InSelect as z, InDatePickerV2 as G, InBasicTextInput as H } from "@useinsider/design-system-vue";
9
+ import J from "./LogicAdapter.vue.js";
10
+ import { useDebounceFn as K } from "../../../../node_modules/@vueuse/shared/index.js";
11
+ const se = /* @__PURE__ */ N({
10
12
  __name: "FilterItem",
11
13
  props: {
12
14
  filter: null,
@@ -15,55 +17,88 @@ const K = /* @__PURE__ */ _({
15
17
  submitted: { type: Boolean }
16
18
  },
17
19
  emits: ["delete-filter"],
18
- setup(f, { emit: v }) {
19
- const t = f, n = C(), a = V(), y = [
20
+ setup(I, { emit: O }) {
21
+ const t = I, s = U(), n = E(), T = [
20
22
  {
21
- text: n("email-editor.standard-filter"),
23
+ text: s("email-editor.standard-filter"),
22
24
  value: "standardFilter"
23
25
  }
24
- ], i = [
26
+ ], u = [
25
27
  { text: "True", value: "true" },
26
28
  { text: "False", value: "false" }
27
- ], d = l(() => t.filter.attribute || ""), r = l(() => a.getFilterList.find((e) => e.value === d.value) || { text: "", value: "", type: "" }), F = l(
29
+ ], m = r(() => t.filter.attribute || ""), i = r(() => n.getFilterList.find((e) => e.value === m.value) || { text: "", value: "", type: "" }), h = r(
28
30
  () => {
29
31
  var e;
30
- return ((e = r.value) == null ? void 0 : e.type) === "Boolean";
32
+ return ((e = i.value) == null ? void 0 : e.type) === "Boolean";
31
33
  }
32
- ), b = l(() => {
34
+ ), b = r(() => {
33
35
  var e;
34
- return p((e = r.value) == null ? void 0 : e.type).find((o) => o.value === t.filter.operator);
35
- }), g = l(
36
- () => i.find((e) => e.value === t.filter.value) || i[0]
37
- ), u = l(() => t.submitted ? A(t.filter) : /* @__PURE__ */ new Set()), h = (e) => u.value.has(e) ? "error" : "default", B = l(
38
- () => u.value.has("value") ? n("action-builder.filter-empty-value-error") : ""
39
- ), c = l(
36
+ return f((e = i.value) == null ? void 0 : e.type).find((o) => o.value === t.filter.operator);
37
+ }), A = r(
38
+ () => u.find((e) => e.value === t.filter.value) || u[0]
39
+ ), p = r(() => t.submitted ? w(t.filter) : /* @__PURE__ */ new Set()), x = (e) => p.value.has(e) ? "error" : "default", B = r(
40
+ () => p.value.has("value") ? s("action-builder.filter-empty-value-error") : ""
41
+ ), v = r(
40
42
  () => {
41
43
  var e;
42
- return ((e = r.value) == null ? void 0 : e.type) === "Number";
44
+ return ((e = i.value) == null ? void 0 : e.type) === "Number";
43
45
  }
44
- ), x = l(() => c.value ? "number" : "text"), T = N((e) => {
45
- a.updateFilter({
46
+ ), D = r(() => v.value ? "number" : "text"), C = r(
47
+ () => {
48
+ var e;
49
+ return ((e = i.value) == null ? void 0 : e.type) === "Date";
50
+ }
51
+ ), _ = r(() => t.filter.operator === d), k = r(() => j(t.filter.value)), P = K((e) => {
52
+ n.updateFilter({
46
53
  ...t.filter,
47
54
  [e.text]: e.value
48
55
  });
49
- }, 500);
50
- return { __sfc: !0, trans: n, store: a, props: t, filterTypeOptions: y, booleanValueOptions: i, attributeType: d, selectedAttributeType: r, isBooleanAttribute: F, selectedOperatorType: b, selectedBooleanValue: g, emit: v, invalidFields: u, getFieldState: h, valueErrorMessage: B, isNumericAttribute: c, valueInputType: x, updateFilter: T, handleAttributeChange: (e) => {
51
- const o = a.getFilterList.find((I) => I.value === e.value), m = (o == null ? void 0 : o.type) === "Boolean", [s] = p(o == null ? void 0 : o.type);
52
- a.updateFilter({
56
+ }, 500), V = (e) => {
57
+ const o = n.getFilterList.find((c) => c.value === e.value), l = (o == null ? void 0 : o.type) === "Boolean", [a] = f(o == null ? void 0 : o.type);
58
+ n.updateFilter({
53
59
  ...t.filter,
54
60
  attribute: e.value,
55
- operator: m ? "=" : (s == null ? void 0 : s.value) ?? "",
56
- value: m ? "true" : ""
61
+ operator: l ? "=" : (a == null ? void 0 : a.value) ?? "",
62
+ value: l ? "true" : ""
57
63
  });
58
- }, handleBooleanValueChange: (e) => {
59
- a.updateFilter({
64
+ }, L = (e) => {
65
+ n.updateFilter({
60
66
  ...t.filter,
61
67
  operator: "=",
62
68
  value: e.value
63
69
  });
64
- }, getOperatorOptions: p, InBasicTextInput: S, InSelect: O, InButtonV2: L, LogicAdapter: E };
70
+ }, S = (e) => {
71
+ const o = e.value;
72
+ if (o === t.filter.operator)
73
+ return;
74
+ const c = t.filter.operator === d !== (o === d);
75
+ n.updateFilter({
76
+ ...t.filter,
77
+ operator: o,
78
+ value: c ? "" : t.filter.value
79
+ });
80
+ }, $ = M(), y = (e) => {
81
+ const [o, l, a] = e.split("-");
82
+ return !o || !l || !a ? "" : `${l}/${a}/${o}`;
83
+ }, F = (e) => {
84
+ const [o, l, a] = e.split("/");
85
+ return !a || !o || !l ? "" : `${a}-${o.padStart(2, "0")}-${l.padStart(2, "0")}`;
86
+ }, R = r(
87
+ () => y(g(t.filter.value))
88
+ );
89
+ return { __sfc: !0, trans: s, store: n, props: t, filterTypeOptions: T, booleanValueOptions: u, attributeType: m, selectedAttributeType: i, isBooleanAttribute: h, selectedOperatorType: b, selectedBooleanValue: A, emit: O, invalidFields: p, getFieldState: x, valueErrorMessage: B, isNumericAttribute: v, valueInputType: D, isDateAttribute: C, isAnyOfOperator: _, tagValues: k, updateFilter: P, handleAttributeChange: V, handleBooleanValueChange: L, handleOperatorChange: S, datePickerLocale: $, isoToPickerDate: y, pickerDateToIso: F, datePickerValue: R, onDatePickerApply: (e) => {
90
+ n.updateFilter({
91
+ ...t.filter,
92
+ value: encodeURIComponent(F(e))
93
+ });
94
+ }, onTagsInput: (e) => {
95
+ n.updateFilter({
96
+ ...t.filter,
97
+ value: e.map(encodeURIComponent).join(",")
98
+ });
99
+ }, getOperatorOptions: f, safeDecodeURIComponent: g, InBasicTextInput: H, InDatePickerV2: G, InSelect: z, InButtonV2: q, InTags: Y, LogicAdapter: J };
65
100
  }
66
101
  });
67
102
  export {
68
- K as default
103
+ se as default
69
104
  };
@@ -1,17 +1,17 @@
1
- import i from "./MiddleSlot.vue2.js";
1
+ import r from "./MiddleSlot.vue2.js";
2
2
  import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var t = function() {
4
- var r = this, e = r._self._c, o = r._self._setupProxy;
5
- return e("div", [o.editorStore.isVersionHistoryOpen ? e("div", { staticClass: "d-f" }, [e(o.VersionHistory), e(o.VersionHistoryViewOptions)], 1) : o.editorStore.isPreviewModeOpen ? e("div", { staticClass: "d-f" }, [e(o.EmailSizeIndicator), e(o.AmpToggle)], 1) : r._e(), e(o.EditorToolbar, { directives: [{ name: "show", rawName: "v-show", value: o.editorStore.isEditorToolbarVisible, expression: "editorStore.isEditorToolbarVisible" }] })], 1);
6
- }, n = [], a = /* @__PURE__ */ s(
7
- i,
4
+ var o = this, e = o._self._c, i = o._self._setupProxy;
5
+ return e("div", { staticClass: "d-f a-i-c" }, [i.editorStore.isVersionHistoryOpen ? e("div", { staticClass: "d-f" }, [e(i.VersionHistory), e(i.VersionHistoryViewOptions)], 1) : i.editorStore.isPreviewModeOpen ? e("div", { staticClass: "d-f" }, [e(i.EmailSizeIndicator), e(i.AmpToggle)], 1) : o._e(), e(i.EditorToolbar, { directives: [{ name: "show", rawName: "v-show", value: i.editorStore.isEditorToolbarVisible, expression: "editorStore.isEditorToolbarVisible" }] })], 1);
6
+ }, a = [], n = /* @__PURE__ */ s(
7
+ r,
8
8
  t,
9
- n,
9
+ a,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const c = a.exports;
14
+ const c = n.exports;
15
15
  export {
16
16
  c as default
17
17
  };
@@ -0,0 +1,66 @@
1
+ import { useEmailTemplateApplier as m, resetEmailTemplateApplier as w } from "./useEmailTemplateApplier.js";
2
+ import { useToaster as _ } from "./useToaster.js";
3
+ import { useTranslations as I } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as S } from "../enums/toaster.js";
5
+ import { getActivePinia as v } from "pinia";
6
+ import { watch as B, onUnmounted as D } from "vue";
7
+ const P = "email_template", x = "chat", L = "guido:debug:ai", M = () => {
8
+ if (typeof window > "u")
9
+ return !1;
10
+ try {
11
+ return window.localStorage.getItem(L) === "1";
12
+ } catch {
13
+ return !1;
14
+ }
15
+ }, O = () => {
16
+ const a = v();
17
+ if (!a)
18
+ return;
19
+ const l = a._s, p = l == null ? void 0 : l.get(x);
20
+ if (!p)
21
+ return;
22
+ const { applyTemplate: d, applyTemplateDebounced: f } = m(), { showToaster: T } = _(), h = I(), A = (e, t) => {
23
+ const r = h(e);
24
+ return r === e ? t : r;
25
+ }, i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), u = M(), E = (e, t) => {
26
+ u && console.debug(`[guido:cortex] msg=${e ?? "?"} type=${(t == null ? void 0 : t.type) ?? "?"}`, t);
27
+ }, y = (e) => {
28
+ if (e.blueprintType !== P)
29
+ return;
30
+ const t = e.blueprintId, r = e.blueprintData;
31
+ if (!t || !(r != null && r.html))
32
+ return;
33
+ const o = i.get(t);
34
+ o === void 0 ? (i.set(t, r.html), d(t, r)) : o !== r.html && (i.set(t, r.html), f(t, r));
35
+ }, s = (e) => e === void 0 || c.has(e) ? !1 : (c.add(e), T({
36
+ type: S.Alert,
37
+ message: A("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
38
+ }), !0), b = B(
39
+ () => p.messages,
40
+ (e) => {
41
+ Array.isArray(e) && e.forEach((t) => {
42
+ const r = t == null ? void 0 : t.id;
43
+ (t == null ? void 0 : t.isError) === !0 && s(r) && u && console.debug(`[guido:cortex] message-level error id=${r}`, t);
44
+ const o = t == null ? void 0 : t.segments;
45
+ Array.isArray(o) && o.forEach((n) => {
46
+ if (n)
47
+ switch (E(r, n), n.type) {
48
+ case "blueprint":
49
+ y(n);
50
+ break;
51
+ case "error":
52
+ s(r);
53
+ break;
54
+ }
55
+ });
56
+ });
57
+ },
58
+ { deep: !0, immediate: !0 }
59
+ );
60
+ D(() => {
61
+ b(), i.clear(), c.clear(), w();
62
+ });
63
+ };
64
+ export {
65
+ O as useCortexBlueprintBridge
66
+ };
@@ -0,0 +1,41 @@
1
+ import { useActionsApi as u } from "./useActionsApi.js";
2
+ import { useToaster as T } from "./useToaster.js";
3
+ import { useTranslations as f } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as n } from "../enums/toaster.js";
5
+ import { ref as y } from "vue";
6
+ const h = 250, s = y({}), o = {}, j = () => {
7
+ const { updateHtmlAndCss: l } = u(), { showToaster: r } = T(), i = f(), c = (e, t, p) => {
8
+ s.value = { ...s.value, [e]: "applying" };
9
+ try {
10
+ l(t, p), s.value = { ...s.value, [e]: "applied" }, r({
11
+ type: n.Success,
12
+ message: i("newsletter.ai-template-applied")
13
+ });
14
+ } catch (a) {
15
+ s.value = { ...s.value, [e]: "failed" }, r({
16
+ type: n.Alert,
17
+ message: a instanceof Error ? a.message : "Failed to apply template"
18
+ });
19
+ }
20
+ }, m = (e) => {
21
+ const t = o[e];
22
+ t && (clearTimeout(t), delete o[e]);
23
+ };
24
+ return { applyStatus: s, applyTemplate: (e, t) => {
25
+ t.html && (m(e), c(e, t.html, t.css ?? ""));
26
+ }, applyTemplateDebounced: (e, t) => {
27
+ if (!t.html)
28
+ return;
29
+ m(e);
30
+ const { html: p } = t, a = t.css ?? "";
31
+ o[e] = setTimeout(() => {
32
+ delete o[e], c(e, p, a);
33
+ }, h);
34
+ } };
35
+ }, w = () => {
36
+ Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
37
+ };
38
+ export {
39
+ w as resetEmailTemplateApplier,
40
+ j as useEmailTemplateApplier
41
+ };
@@ -0,0 +1,48 @@
1
+ import { useActionsApi as g } from "./useActionsApi.js";
2
+ import { useConfigStore as I } from "../stores/config.js";
3
+ import { useEditorStore as b } from "../stores/editor.js";
4
+ import { useGuidoEmailEditorStore as E } from "../stores/guido-email-editor.js";
5
+ import { watch as c, onUnmounted as T } from "vue";
6
+ const w = 500, z = () => {
7
+ const i = b(), a = E(), l = I(), { getTemplateData: m } = g();
8
+ let e = null, n = !1;
9
+ const r = () => {
10
+ e && (clearTimeout(e), e = null);
11
+ }, s = async () => {
12
+ var t, o;
13
+ if (!(n || !i.isStripoInitialized))
14
+ try {
15
+ const { html: f, css: h } = await m(), S = ((o = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : o.templateId) ?? "";
16
+ if (n)
17
+ return;
18
+ a.$patch({
19
+ html: f ?? "",
20
+ css: h ?? "",
21
+ templateId: S,
22
+ lastUpdatedAt: Date.now()
23
+ });
24
+ } catch {
25
+ }
26
+ }, u = () => {
27
+ r(), e = setTimeout(() => {
28
+ e = null, s();
29
+ }, w);
30
+ }, d = c(
31
+ () => i.isStripoInitialized,
32
+ (t) => {
33
+ t && s();
34
+ },
35
+ { immediate: !0 }
36
+ ), p = c(
37
+ () => i.hasChanges,
38
+ (t, o) => {
39
+ i.isStripoInitialized && (t ? u() : o && (r(), s()));
40
+ }
41
+ );
42
+ T(() => {
43
+ n = !0, r(), d(), p();
44
+ });
45
+ };
46
+ export {
47
+ z as useGuidoStateBridge
48
+ };