@useinsider/guido 3.17.0-beta.668ca65 → 3.17.0-beta.6cedc6c

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 (23) hide show
  1. package/README.md +5 -5
  2. package/dist/components/Guido.vue.js +7 -7
  3. package/dist/components/Guido.vue2.js +59 -57
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +5 -5
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +31 -30
  6. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +52 -0
  8. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +36 -35
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +198 -135
  10. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +1 -1
  11. package/dist/extensions/Blocks/Recommendation/services/configService.js +34 -16
  12. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +47 -37
  13. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  14. package/dist/guido.css +1 -1
  15. package/dist/services/recommendationApi.js +1 -1
  16. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  17. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +38 -8
  18. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  19. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -0
  20. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  21. package/dist/src/utils/genericUtil.d.ts +5 -0
  22. package/dist/utils/genericUtil.js +28 -27
  23. package/package.json +2 -2
package/README.md CHANGED
@@ -634,16 +634,16 @@ toaster fires (useful before the host has wired the catalog).
634
634
 
635
635
  ```bash
636
636
  # Install
637
- bun install
637
+ npm install
638
638
 
639
639
  # Start dev server
640
- bun start
640
+ npm start
641
641
 
642
642
  # Build
643
- bun run build
643
+ npm run build
644
644
 
645
645
  # Lint & type-check
646
- bun run lint
646
+ npm run lint
647
647
  ```
648
648
 
649
649
  ### Environment Variables
@@ -661,7 +661,7 @@ VITE_STRIPO_USER=your_user
661
661
 
662
662
  ```bash
663
663
  # Build the package
664
- bun run build
664
+ npm run build
665
665
 
666
666
  # Create tarball
667
667
  npm pack
@@ -1,20 +1,20 @@
1
- import a from "./Guido.vue2.js";
1
+ import o from "./Guido.vue2.js";
2
2
  /* empty css */
3
3
  import i from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var t = function() {
5
- var o = this, r = o._self._c, e = o._self._setupProxy;
6
- return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), r(e.AutoSaveController), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : o._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : o._e(), r(e.SaveAsTemplateDrawer), e.isTestPartner() ? o._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(p) {
5
+ var a = this, r = a._self._c, e = a._self._setupProxy;
6
+ return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), r(e.AutoSaveController), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
7
7
  return e.emit("onboarding:finished");
8
8
  } } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
9
9
  }, s = [], n = /* @__PURE__ */ i(
10
- a,
10
+ o,
11
11
  t,
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "e6f99d29"
15
+ "5c588dc5"
16
16
  );
17
- const l = n.exports;
17
+ const v = n.exports;
18
18
  export {
19
- l as default
19
+ v as default
20
20
  };
@@ -1,30 +1,30 @@
1
- import { defineComponent as Y, defineAsyncComponent as S, ref as A, computed as l, watch as U, onMounted as Z, onUnmounted as ee } from "vue";
2
- import { useCortexBlueprintBridge as te } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as oe } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as ne } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as re } from "../composables/usePartner.js";
6
- import { useStripo as se } from "../composables/useStripo.js";
7
- import { useTimerClone as ae } from "../composables/useTimerClone.js";
1
+ import { defineComponent as Z, defineAsyncComponent as l, ref as A, computed as u, watch as U, onMounted as ee, onUnmounted as te } from "vue";
2
+ import { useCortexBlueprintBridge as oe } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as ne } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as re } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as se } from "../composables/usePartner.js";
6
+ import { useStripo as ae } from "../composables/useStripo.js";
7
+ import { useTimerClone as ie } from "../composables/useTimerClone.js";
8
8
  import { migrate as _ } from "../config/migrator/index.js";
9
9
  import { ModuleFolderDefaults as N } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as ie } from "../enums/onboarding.js";
10
+ import { RIBBON_SELECTOR as ce } from "../enums/onboarding.js";
11
11
  import { useRecommendationExtensionStore as O } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import ce from "./organisms/AutoSaveController.vue.js";
13
- import de from "./organisms/base/Toaster.vue.js";
14
- import me from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import le from "./organisms/header/HeaderWrapper.vue.js";
16
- import ue from "./organisms/LoadingWrapper.vue.js";
17
- import pe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import fe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as ye } from "../services/stripoApi.js";
20
- import { useConfigStore as ge } from "../stores/config.js";
21
- import { useDynamicContentStore as ve } from "../stores/dynamic-content.js";
12
+ import de from "./organisms/AutoSaveController.vue.js";
13
+ import me from "./organisms/base/Toaster.vue.js";
14
+ import le from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
+ import ue from "./organisms/header/HeaderWrapper.vue.js";
16
+ import pe from "./organisms/LoadingWrapper.vue.js";
17
+ import fe from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
+ import ye from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
+ import { useStripoApi as ge } from "../services/stripoApi.js";
20
+ import { useConfigStore as ve } from "../stores/config.js";
21
+ import { useDynamicContentStore as Se } from "../stores/dynamic-content.js";
22
22
  import { useEditorStore as P } from "../stores/editor.js";
23
- import { usePreviewStore as Se } from "../stores/preview.js";
24
- import { useTemplateStore as he } from "../stores/template.js";
25
- import { useUnsubscribeStore as be } from "../stores/unsubscribe.js";
23
+ import { usePreviewStore as he } from "../stores/preview.js";
24
+ import { useTemplateStore as be } from "../stores/template.js";
25
+ import { useUnsubscribeStore as Ee } from "../stores/unsubscribe.js";
26
26
  import { readTrackFloor as W } from "../utils/linkTrackingIds.js";
27
- const Ve = /* @__PURE__ */ Y({
27
+ const je = /* @__PURE__ */ Z({
28
28
  __name: "Guido",
29
29
  props: {
30
30
  config: null,
@@ -32,22 +32,24 @@ const Ve = /* @__PURE__ */ Y({
32
32
  },
33
33
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
34
34
  setup(x, { expose: G, emit: r }) {
35
- const a = x, H = S(
35
+ const a = x, H = l(
36
36
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
37
- ), $ = S(
37
+ ), $ = l(
38
38
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
39
- ), z = S(
39
+ ), z = l(
40
40
  () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
41
- ), h = A(), u = A(), p = ve(), b = be(), o = ge();
41
+ ), q = l(
42
+ () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
43
+ ), h = A(), p = A(), f = Se(), b = Ee(), o = ve();
42
44
  a.ready && o.init(a.config);
43
- const c = P(), q = Se(), m = l(() => c.hasChanges), { isTestPartner: K } = re(), E = () => {
45
+ const c = P(), K = he(), m = u(() => c.hasChanges), { isTestPartner: V } = se(), E = () => {
44
46
  var t;
45
47
  return (t = h.value) == null ? void 0 : t.handleSave(!0);
46
48
  }, w = (t) => {
47
49
  c.loadingStatus = t;
48
50
  };
49
- te(), ne();
50
- const f = () => {
51
+ oe(), re();
52
+ const y = () => {
51
53
  var t, e;
52
54
  return {
53
55
  emailId: o.templateId,
@@ -57,13 +59,13 @@ const Ve = /* @__PURE__ */ Y({
57
59
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
58
60
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
59
61
  };
60
- }, { initPlugin: C, preloadRuntime: D } = se(), { getDefaultTemplate: k } = ye(), { cloneTimersOnSave: T, hasTimerBlocks: F } = ae(), V = l(() => {
62
+ }, { initPlugin: C, preloadRuntime: D } = ae(), { getDefaultTemplate: k } = ge(), { cloneTimersOnSave: T, hasTimerBlocks: F } = ie(), j = u(() => {
61
63
  var t;
62
64
  return !((t = o.ui) != null && t.showHeader);
63
- }), j = l(() => o.isFeatureEnabled("reusableRecommendationStrategy")), J = l(
65
+ }), J = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), Q = u(
64
66
  () => !!O().recommendationConfigs.strategyId
65
67
  );
66
- oe({
68
+ ne({
67
69
  onBack: () => {
68
70
  console.debug("guido:back"), r("back");
69
71
  },
@@ -71,7 +73,7 @@ const Ve = /* @__PURE__ */ Y({
71
73
  console.debug("guido:save:start"), r("save:start");
72
74
  },
73
75
  onSaveComplete: (t) => {
74
- const e = { ...t, metadata: f() };
76
+ const e = { ...t, metadata: y() };
75
77
  console.debug("guido:save:complete", e), r("save:complete", e);
76
78
  },
77
79
  onTestEmailClick: () => {
@@ -79,61 +81,61 @@ const Ve = /* @__PURE__ */ Y({
79
81
  }
80
82
  });
81
83
  const I = (t) => {
82
- console.debug("dynamic-content:close", t), p.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
84
+ console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
83
85
  }, R = () => {
84
86
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
85
87
  };
86
88
  U(() => m.value, () => {
87
89
  r("on-change", m.value);
88
90
  });
89
- const y = (t) => {
91
+ const g = (t) => {
90
92
  const e = t, { attribute: s, position: d } = e.detail;
91
93
  console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
92
94
  };
93
95
  let i = null;
94
- const g = () => {
96
+ const v = () => {
95
97
  var e;
96
- const t = document.querySelector(ie);
97
- (e = u.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
98
- }, v = async () => {
98
+ const t = document.querySelector(ce);
99
+ (e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
100
+ }, S = async () => {
99
101
  var t;
100
102
  try {
101
103
  o.initialized || o.init(a.config), c.templateId = o.templateId;
102
104
  const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", L = (e == null ? void 0 : e.preselectedDynamicContent) || [];
103
105
  b.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
104
- const B = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, M = o.isFeatureEnabled("linkTrackingIds");
106
+ const M = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, B = o.isFeatureEnabled("linkTrackingIds");
105
107
  let n = {
106
- html: s && await _(s, B),
108
+ html: s && await _(s, M),
107
109
  css: d
108
110
  };
109
- n.html || (n = await k(), n.html = await _(n.html, B));
110
- const Q = M ? W(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
111
- F(n.html) && (n.html = await T(n.html)), M && (c.trackIdSessionFloor = Math.max(Q, W(n.html)));
112
- const X = {
111
+ n.html || (n = await k(), n.html = await _(n.html, M));
112
+ const X = B ? W(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
113
+ F(n.html) && (n.html = await T(n.html)), B && (c.trackIdSessionFloor = Math.max(X, W(n.html)));
114
+ const Y = {
113
115
  preselectedDynamicContentList: L,
114
116
  onReady: () => {
115
117
  console.debug("guido:ready"), r("ready");
116
118
  }
117
119
  };
118
- await C(n, f(), X), p.selectedDynamicContentList = L;
120
+ await C(n, y(), Y), f.selectedDynamicContentList = L;
119
121
  } catch (e) {
120
122
  console.error("Failed to initialize Stripo editor:", e);
121
123
  }
122
124
  };
123
- return Z(async () => {
125
+ return ee(async () => {
124
126
  var e;
125
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), O().$reset(), P().$reset(), he().$reset(), g();
126
- const t = (e = u.value) == null ? void 0 : e.parentElement;
127
- if (t && (i = new ResizeObserver(g), i.observe(t)), D(), a.ready)
128
- await v();
127
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), O().$reset(), P().$reset(), be().$reset(), v();
128
+ const t = (e = p.value) == null ? void 0 : e.parentElement;
129
+ if (t && (i = new ResizeObserver(v), i.observe(t)), D(), a.ready)
130
+ await S();
129
131
  else {
130
132
  const s = U(() => a.ready, (d) => {
131
- d && (s(), v());
133
+ d && (s(), S());
132
134
  });
133
135
  }
134
- document.addEventListener("dynamic-content:open", y);
135
- }), ee(() => {
136
- i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", y);
136
+ document.addEventListener("dynamic-content:open", g);
137
+ }), te(() => {
138
+ i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", g);
137
139
  try {
138
140
  window.UIEditor.removeEditor();
139
141
  } catch {
@@ -148,9 +150,9 @@ const Ve = /* @__PURE__ */ Y({
148
150
  hasChanges: m,
149
151
  saveSilent: E,
150
152
  setLoading: w
151
- }), { __sfc: !0, PreviewContainer: H, OnboardingWrapper: $, AssignStrategyDrawer: z, headerWrapperRef: h, wrapperRef: u, dynamicContentStore: p, unsubscribeStore: b, props: a, configStore: o, editorStore: c, previewStore: q, hasChanges: m, isTestPartner: K, saveSilent: E, setLoading: w, emit: r, buildMetadata: f, initPlugin: C, preloadRuntime: D, getDefaultTemplate: k, cloneTimersOnSave: T, hasTimerBlocks: F, noHeader: V, isRrsEnabled: j, hasAssignedStrategy: J, insertDynamicContent: I, closeDynamicContent: R, handleDynamicContentOpen: y, ribbonObserver: i, updateRibbonOffset: g, startEditor: v, AutoSaveController: ce, Toaster: de, FilterSelectionDrawer: me, HeaderWrapper: le, LoadingWrapper: ue, SaveAsTemplateDrawer: pe, UnsubscribeWrapper: fe };
153
+ }), { __sfc: !0, PreviewContainer: H, OnboardingWrapper: $, AssignStrategyDrawer: z, RemoveStrategyModal: q, headerWrapperRef: h, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: b, props: a, configStore: o, editorStore: c, previewStore: K, hasChanges: m, isTestPartner: V, saveSilent: E, setLoading: w, emit: r, buildMetadata: y, initPlugin: C, preloadRuntime: D, getDefaultTemplate: k, cloneTimersOnSave: T, hasTimerBlocks: F, noHeader: j, isRrsEnabled: J, hasAssignedStrategy: Q, insertDynamicContent: I, closeDynamicContent: R, handleDynamicContentOpen: g, ribbonObserver: i, updateRibbonOffset: v, startEditor: S, AutoSaveController: de, Toaster: me, FilterSelectionDrawer: le, HeaderWrapper: ue, LoadingWrapper: pe, SaveAsTemplateDrawer: fe, UnsubscribeWrapper: ye };
152
154
  }
153
155
  });
154
156
  export {
155
- Ve as default
157
+ je as default
156
158
  };
@@ -1,19 +1,19 @@
1
1
  import r from "./AssignStrategyDrawer.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
- import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
5
- var a = function() {
4
+ import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
5
+ var o = function() {
6
6
  var e = this, s = e._self._c, t = e._self._setupProxy;
7
7
  return t.store.assignStrategyDrawerStatus ? s(t.OrgStrategyDetailModal, { staticClass: "assign-strategy-drawer", attrs: { "description-status": "", show: "", "description-text": t.drawerDescription, "footer-button-group-options": t.footerButtonGroupOptions, strategy: t.selectedStrategy ?? {}, "title-text": t.trans("gpt-app-builder.assign-recommendation-strategy") }, on: { close: t.closeDrawer, primaryClick: t.assignStrategy }, scopedSlots: e._u([{ key: "contentTop", fn: function() {
8
8
  return [s("div", { staticClass: "assign-strategy-drawer-content px-5 py-5" }, [s(t.OrgStrategyDropdown, { staticClass: "assign-strategy-select", attrs: { id: "assign-strategy-select", "info-box-position": "bottom right", "create-button-visible": !1, loading: t.store.strategiesLoading, "placeholder-text": t.trans("smart-recommender.select-recommendation-strategy"), "selected-strategy-id": t.selectedStrategyId, state: t.showSelectionError ? "error" : "default", "state-message": t.showSelectionError ? t.trans("ds-steps.select-strategy-tooltip") : "", strategies: t.strategyOptions }, on: { select: t.onSelect } })], 1)];
9
9
  }, proxy: !0 }], null, !1, 2542767044) }) : e._e();
10
- }, n = [], i = /* @__PURE__ */ o(
10
+ }, n = [], i = /* @__PURE__ */ a(
11
11
  r,
12
- a,
12
+ o,
13
13
  n,
14
14
  !1,
15
15
  null,
16
- "d3080c55"
16
+ "2580a7d9"
17
17
  );
18
18
  const y = i.exports;
19
19
  export {
@@ -1,46 +1,47 @@
1
- import { defineComponent as v, defineAsyncComponent as u, ref as f, computed as l, watch as O } from "vue";
1
+ import { defineComponent as v, defineAsyncComponent as y, ref as u, computed as l, watch as O } from "vue";
2
2
  import "@useinsider/design-system-organisms/style";
3
3
  import { useToaster as x } from "../../../../composables/useToaster.js";
4
4
  import { useTranslations as A } from "../../../../composables/useTranslations.js";
5
5
  import { DOTTED_DATE_LOCALE as E } from "../../../../enums/date.js";
6
6
  import { URLS as h } from "../../../../enums/extensions/recommendationBlock.js";
7
- import { ToasterTypeOptions as p } from "../../../../enums/toaster.js";
7
+ import { ToasterTypeOptions as m } from "../../../../enums/toaster.js";
8
8
  import { useRecommendationExtensionStore as C } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import b from "./StrategyInfoBoxContent.vue.js";
10
- import { formatShortDate as B } from "../../../../utils/dateUtil.js";
11
- import { escapeHtml as I } from "../../../../utils/htmlEscape.js";
12
- import { InSkeleton as N } from "@useinsider/design-system-vue";
13
- const V = /* @__PURE__ */ v({
9
+ import B from "./StrategyInfoBoxContent.vue.js";
10
+ import { formatShortDate as I } from "../../../../utils/dateUtil.js";
11
+ import { asText as f } from "../../../../utils/genericUtil.js";
12
+ import { escapeHtml as N } from "../../../../utils/htmlEscape.js";
13
+ import { InSkeleton as b } from "@useinsider/design-system-vue";
14
+ const W = /* @__PURE__ */ v({
14
15
  __name: "AssignStrategyDrawer",
15
16
  setup(k) {
16
17
  const c = () => import("@useinsider/design-system-organisms"), g = (t, r) => ({
17
- render: (s) => s(N, { props: { sizing: { width: t, height: r } } })
18
- }), S = u({
18
+ render: (a) => a(b, { props: { sizing: { width: t, height: r } } })
19
+ }), S = y({
19
20
  loader: async () => (await c()).OrgStrategyDetailModal,
20
21
  loadingComponent: g(480, 240),
21
22
  delay: 0
22
- }), T = u({
23
+ }), T = y({
23
24
  loader: async () => (await c()).OrgStrategyDropdown,
24
25
  loadingComponent: g(240, 42),
25
26
  delay: 0
26
- }), o = A(), e = C(), { showToaster: a } = x(), n = f(null), i = f(!1), m = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", _ = l(() => e.assignStrategyDrawerStatus ? o("email-editor.assign-strategy-description", { url: h.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
27
+ }), o = A(), e = C(), { showToaster: s } = x(), n = u(null), i = u(!1), _ = l(() => e.assignStrategyDrawerStatus ? o("email-editor.assign-strategy-description", { url: h.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
27
28
  O(() => e.assignStrategyDrawerStatus, (t) => {
28
29
  if (!t)
29
30
  return;
30
31
  const { strategyId: r } = e.recommendationConfigs;
31
32
  n.value = r || null, i.value = !1, e.fetchStrategies().catch(() => {
32
- a({
33
- type: p.Error,
33
+ s({
34
+ type: m.Error,
34
35
  message: o("discovery-strategy.error-description")
35
36
  });
36
37
  });
37
38
  });
38
- const d = (t) => {
39
- const r = m(t.updated_at || t.created_at);
39
+ const p = (t) => {
40
+ const r = f(t.updated_at || t.created_at);
40
41
  if (!r)
41
42
  return "";
42
- const s = B(r, E);
43
- return o("recommendation-strategy.last-updated-on", { value: s });
43
+ const a = I(r, E);
44
+ return o("recommendation-strategy.last-updated-on", { value: a });
44
45
  }, D = l(() => e.strategies.map((t) => ({
45
46
  text: t.name,
46
47
  value: t.strategy_id,
@@ -49,13 +50,13 @@ const V = /* @__PURE__ */ v({
49
50
  theme: "light",
50
51
  variant: "information",
51
52
  className: "assign-strategy-info-box",
52
- titleText: I(m(t.name)),
53
+ titleText: N(f(t.name)),
53
54
  descriptionStatus: !0,
54
- descriptionText: d(t),
55
- slot: b,
55
+ descriptionText: p(t),
56
+ slot: B,
56
57
  slotProps: { strategy: t }
57
58
  }
58
- }))), y = l(() => {
59
+ }))), d = l(() => {
59
60
  const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
60
61
  return t ? { ...t, fallback_config: null } : null;
61
62
  }), w = l(() => ({
@@ -70,10 +71,10 @@ const V = /* @__PURE__ */ v({
70
71
  labelText: o("products.cancel")
71
72
  }
72
73
  }));
73
- return { __sfc: !0, loadOrganisms: c, skeleton: g, OrgStrategyDetailModal: S, OrgStrategyDropdown: T, trans: o, store: e, showToaster: a, selectedStrategyId: n, showSelectionError: i, asText: m, drawerDescription: _, lastUpdatedText: d, strategyOptions: D, selectedStrategy: y, footerButtonGroupOptions: w, closeDrawer: () => {
74
+ return { __sfc: !0, loadOrganisms: c, skeleton: g, OrgStrategyDetailModal: S, OrgStrategyDropdown: T, trans: o, store: e, showToaster: s, selectedStrategyId: n, showSelectionError: i, drawerDescription: _, lastUpdatedText: p, strategyOptions: D, selectedStrategy: d, footerButtonGroupOptions: w, closeDrawer: () => {
74
75
  e.closeAssignStrategyDrawer();
75
76
  }, assignStrategy: async () => {
76
- const t = y.value;
77
+ const t = d.value;
77
78
  if (!t) {
78
79
  i.value = !0;
79
80
  return;
@@ -81,18 +82,18 @@ const V = /* @__PURE__ */ v({
81
82
  let r = "";
82
83
  try {
83
84
  r = await e.resolveStrategyUrlTemplate(t, e.recommendationConfigs.currencySettings.value);
84
- } catch (s) {
85
- console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", s);
85
+ } catch (a) {
86
+ console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", a);
86
87
  }
87
88
  if (!r) {
88
- a({
89
- type: p.Error,
89
+ s({
90
+ type: m.Error,
90
91
  message: o("email-editor.strategy-assign-failed", { strategyName: t.name })
91
92
  });
92
93
  return;
93
94
  }
94
- e.assignStrategy(t), a({
95
- type: p.Success,
95
+ e.assignStrategy(t), s({
96
+ type: m.Success,
96
97
  message: o("email-editor.strategy-assigned-success", { strategyName: t.name })
97
98
  }), e.closeAssignStrategyDrawer();
98
99
  }, onSelect: (t) => {
@@ -101,5 +102,5 @@ const V = /* @__PURE__ */ v({
101
102
  }
102
103
  });
103
104
  export {
104
- V as default
105
+ W as default
105
106
  };
@@ -0,0 +1,17 @@
1
+ import r from "./RemoveStrategyModal.vue2.js";
2
+ import s from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var a = function() {
4
+ var t = this, o = t._self._c, e = t._self._setupProxy;
5
+ return e.store.removeStrategyModalStatus ? o(e.WpModal, { attrs: { id: "guido__remove-strategy-modal", size: "X-small", "close-on-outside-click": !1, "footer-button-options": e.footerButtonOptions, title: e.trans("email-editor.remove-strategy-confirm-title") }, on: { close: e.close, "primary-action": e.handleConfirm, "secondary-action": e.close } }, [o("p", [t._v(t._s(e.trans("email-editor.remove-strategy-confirm-message", { strategyName: e.strategyName })))])]) : t._e();
6
+ }, n = [], i = /* @__PURE__ */ s(
7
+ r,
8
+ a,
9
+ n,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const c = i.exports;
15
+ export {
16
+ c as default
17
+ };
@@ -0,0 +1,52 @@
1
+ import { defineComponent as p, computed as m } from "vue";
2
+ import u from "../../../wrappers/WpModal.vue.js";
3
+ import { useToaster as y } from "../../../../composables/useToaster.js";
4
+ import { useTranslations as f } from "../../../../composables/useTranslations.js";
5
+ import { ToasterTypeOptions as g } from "../../../../enums/toaster.js";
6
+ import { useRecommendationExtensionStore as v } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
7
+ import { commitBlockChangeOutsidePanel as h } from "../../../../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
8
+ const O = /* @__PURE__ */ p({
9
+ __name: "RemoveStrategyModal",
10
+ setup(_) {
11
+ const o = f(), e = v(), { showToaster: n } = y(), c = m(() => ({
12
+ cancelOrBackButton: {
13
+ type: "secondary",
14
+ labelText: o("products.cancel"),
15
+ styling: "ghost"
16
+ },
17
+ primaryButton: {
18
+ type: "danger",
19
+ labelText: o("discovery-strategy.remove")
20
+ }
21
+ })), s = m(() => {
22
+ var t;
23
+ const { strategyId: r } = e.recommendationConfigs;
24
+ return ((t = e.assignedStrategy) == null ? void 0 : t.name) || `#${r}`;
25
+ }), a = () => {
26
+ e.closeRemoveStrategyModal();
27
+ };
28
+ return { __sfc: !0, trans: o, store: e, showToaster: n, footerButtonOptions: c, strategyName: s, close: a, handleConfirm: async () => {
29
+ const r = s.value, t = e.currentRecommendationId;
30
+ if (e.removeStrategy(), a(), n({
31
+ type: g.Success,
32
+ message: o("email-editor.strategy-removed-success", { strategyName: r })
33
+ }), t === null)
34
+ return;
35
+ try {
36
+ await e.fetchRecommendationProducts();
37
+ } catch (l) {
38
+ console.error("[RemoveStrategyModal] product refetch failed", l);
39
+ }
40
+ const { strategyId: i, size: d } = e.recommendationConfigs;
41
+ h(
42
+ t,
43
+ { strategyId: i, size: d },
44
+ e.recommendationProducts,
45
+ "Removed recommendation strategy"
46
+ );
47
+ }, WpModal: u };
48
+ }
49
+ });
50
+ export {
51
+ O as default
52
+ };
@@ -1,62 +1,63 @@
1
- import { defineComponent as v, computed as i } from "vue";
1
+ import { defineComponent as f, computed as i } from "vue";
2
2
  import { useTranslations as _ } from "../../../../composables/useTranslations.js";
3
- const A = /* @__PURE__ */ v({
3
+ import { asText as c } from "../../../../utils/genericUtil.js";
4
+ const j = /* @__PURE__ */ f({
4
5
  __name: "StrategyInfoBoxContent",
5
6
  props: {
6
7
  strategy: null
7
8
  },
8
9
  setup(p) {
9
- const s = p, n = _(), o = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", a = i(() => n("recommendation-strategy.none")), u = i(() => {
10
- const t = o(s.strategy.algorithm) === "MIXED" ? n("discovery-strategy.mixed-algorithm") : n("discovery-strategy.single-algorithm"), e = o(s.strategy.algorithm_used).split(",").map((r) => r.trim()).filter(Boolean).map((r) => n(`recommendation-algorithm-names.${r.replaceAll("_", "-").toLowerCase()}`));
11
- return e.length ? `${t} · ${e.join(", ")}` : t;
12
- }), g = i(() => [
13
- [s.strategy.exclude_view, "discovery-strategy.exclude-recently-view-items"],
14
- [s.strategy.exclude_purchase, "discovery-strategy.exclude-recently-purchased-items"],
15
- [s.strategy.exclude_cart, "discovery-strategy.exclude-recently-added-cart-items"]
16
- ].filter(([t]) => Number(t) === 1).map(([, t]) => n(t)).join(", ") || a.value), l = (t) => {
17
- const e = o(t).trim();
18
- if (!e)
10
+ const a = p, n = _(), s = i(() => n("recommendation-strategy.none")), u = i(() => {
11
+ const e = c(a.strategy.algorithm) === "MIXED" ? n("discovery-strategy.mixed-algorithm") : n("discovery-strategy.single-algorithm"), t = c(a.strategy.algorithm_used).split(",").map((r) => r.trim()).filter(Boolean).map((r) => n(`recommendation-algorithm-names.${r.replaceAll("_", "-").toLowerCase()}`));
12
+ return t.length ? `${e} · ${t.join(", ")}` : e;
13
+ }), d = i(() => [
14
+ [a.strategy.exclude_view, "discovery-strategy.exclude-recently-view-items"],
15
+ [a.strategy.exclude_purchase, "discovery-strategy.exclude-recently-purchased-items"],
16
+ [a.strategy.exclude_cart, "discovery-strategy.exclude-recently-added-cart-items"]
17
+ ].filter(([e]) => Number(e) === 1).map(([, e]) => n(e)).join(", ") || s.value), l = (e) => {
18
+ const t = c(e).trim();
19
+ if (!t)
19
20
  return "";
20
21
  let r;
21
22
  try {
22
- r = JSON.parse(e);
23
+ r = JSON.parse(t);
23
24
  } catch {
24
- return e;
25
+ return t;
25
26
  }
26
27
  if (Array.isArray(r))
27
28
  return r.length ? String(r.length) : "";
28
29
  if (r && typeof r == "object") {
29
- const c = Object.keys(r).length;
30
- return c ? String(c) : "";
30
+ const o = Object.keys(r).length;
31
+ return o ? String(o) : "";
31
32
  }
32
- return e;
33
- }, d = i(() => l(s.strategy.manual_merchandising) || l(s.strategy.manual_merchandising_products) || a.value), m = (t) => {
34
- if (Array.isArray(t))
35
- return t.length;
36
- const { conditionList: e } = t ?? {};
37
- return Array.isArray(e) ? e.length : 1;
33
+ return t;
34
+ }, m = i(() => l(a.strategy.manual_merchandising) || l(a.strategy.manual_merchandising_products) || s.value), g = (e) => {
35
+ if (Array.isArray(e))
36
+ return e.length;
37
+ const { conditionList: t } = e ?? {};
38
+ return Array.isArray(t) ? t.length : 1;
38
39
  }, y = i(() => {
39
- const t = s.strategy.filters;
40
- if (!t)
41
- return a.value;
40
+ const e = a.strategy.filters;
41
+ if (!e)
42
+ return s.value;
42
43
  try {
43
- const e = typeof t == "string" ? JSON.parse(t) : t;
44
- if (!e || typeof e != "object")
45
- return a.value;
46
- const r = Object.values(e).reduce((c, f) => c + m(f), 0);
47
- return r ? String(r) : a.value;
44
+ const t = typeof e == "string" ? JSON.parse(e) : e;
45
+ if (!t || typeof t != "object")
46
+ return s.value;
47
+ const r = Object.values(t).reduce((o, v) => o + g(v), 0);
48
+ return r ? String(r) : s.value;
48
49
  } catch {
49
- return a.value;
50
+ return s.value;
50
51
  }
51
52
  }), h = i(() => [
52
53
  { title: n("gpt-app-builder.algorithms-and-method"), value: u.value },
53
- { title: n("gpt-app-builder.exclusions"), value: g.value },
54
+ { title: n("gpt-app-builder.exclusions"), value: d.value },
54
55
  { title: n("discovery-strategy.filters"), value: y.value },
55
- { title: n("action-builder.manual-merchandising"), value: d.value }
56
+ { title: n("action-builder.manual-merchandising"), value: m.value }
56
57
  ]);
57
- return { __sfc: !0, props: s, trans: n, asText: o, none: a, algorithmsAndMethod: u, exclusions: g, asMerchandising: l, manualMerchandising: d, conditionsIn: m, filters: y, details: h };
58
+ return { __sfc: !0, props: a, trans: n, none: s, algorithmsAndMethod: u, exclusions: d, asMerchandising: l, manualMerchandising: m, conditionsIn: g, filters: y, details: h };
58
59
  }
59
60
  });
60
61
  export {
61
- A as default
62
+ j as default
62
63
  };