@useinsider/guido 3.17.0-beta.6255bfc → 3.17.0-beta.a410c07

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 +0 -5
  2. package/dist/components/Guido.vue.js +8 -8
  3. package/dist/components/Guido.vue2.js +76 -73
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -10
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +75 -36
  6. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  7. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +62 -0
  8. package/dist/composables/useRecommendation.js +29 -30
  9. package/dist/config/migrator/recommendation/settingsMapper.js +0 -2
  10. package/dist/config/migrator/recommendationMigrator.js +0 -1
  11. package/dist/enums/date.js +5 -4
  12. package/dist/enums/extensions/recommendationBlock.js +0 -1
  13. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -2
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +27 -45
  15. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -18
  16. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +111 -166
  17. package/dist/guido.css +1 -1
  18. package/dist/services/recommendationApi.js +11 -17
  19. package/dist/src/@types/config/schemas.d.ts +0 -10
  20. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  21. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  22. package/dist/src/enums/date.d.ts +1 -0
  23. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -5
  24. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -7
  25. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -14
  26. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -56
  27. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -5
  28. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -61
  29. package/dist/src/services/recommendationApi.d.ts +1 -1
  30. package/dist/src/stores/save-as-template.d.ts +4 -3
  31. package/dist/static/assets/icons/line-delete.svg.js +2 -2
  32. package/dist/static/assets/icons/line-plus.svg.js +2 -2
  33. package/dist/static/styles/components/recommendation-strategy.css.js +2 -35
  34. package/dist/utils/dateUtil.js +18 -24
  35. package/dist/utils/templatePreparation.js +0 -2
  36. package/package.json +2 -2
  37. package/dist/src/utils/strategyInfoBox.d.ts +0 -22
  38. package/dist/utils/strategyInfoBox.js +0 -37
@@ -220,11 +220,6 @@ const p = {
220
220
  allowlistEnabled: e(o(), !1),
221
221
  /** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
222
222
  linkTrackingIds: e(o(), !1),
223
- /**
224
- * Assign a Reusable Recommendation Strategy (RRS) to recommendation blocks instead of
225
- * per-block algorithm settings. Hides Algorithm, Filters, Shuffle and Number of Products
226
- * (they live on the strategy) and adds the Assign Strategy flow.
227
- */
228
223
  reusableRecommendationStrategy: e(o(), !1)
229
224
  }), B = i([
230
225
  "amp-accordion",
@@ -1,20 +1,20 @@
1
- import i from "./Guido.vue2.js";
1
+ import a from "./Guido.vue2.js";
2
2
  /* empty css */
3
- import a from "../_virtual/_plugin-vue2_normalizer.js";
3
+ import i from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var t = function() {
5
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), r(e.AssignStrategyDrawer), r(e.SaveAsTemplateDrawer), e.isTestPartner() ? o._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(p) {
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) {
7
7
  return e.emit("onboarding:finished");
8
8
  } } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
9
- }, n = [], s = /* @__PURE__ */ a(
10
- i,
9
+ }, s = [], n = /* @__PURE__ */ i(
10
+ a,
11
11
  t,
12
- n,
12
+ s,
13
13
  !1,
14
14
  null,
15
- "003398e6"
15
+ "e6f99d29"
16
16
  );
17
- const l = s.exports;
17
+ const l = n.exports;
18
18
  export {
19
19
  l as default
20
20
  };
@@ -1,52 +1,53 @@
1
- import { defineComponent as j, defineAsyncComponent as R, ref as B, computed as U, watch as _, onMounted as J, onUnmounted as Q } from "vue";
2
- import { useCortexBlueprintBridge as X } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as Y } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as Z } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as ee } from "../composables/usePartner.js";
6
- import { useStripo as te } from "../composables/useStripo.js";
7
- import { useTimerClone as oe } from "../composables/useTimerClone.js";
8
- import { migrate as A } from "../config/migrator/index.js";
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";
8
+ import { migrate as _ } from "../config/migrator/index.js";
9
9
  import { ModuleFolderDefaults as N } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as ne } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as re } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import se from "./organisms/AutoSaveController.vue.js";
13
- import ae from "./organisms/base/Toaster.vue.js";
14
- import ie from "./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js";
15
- import ce from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
16
- import de from "./organisms/header/HeaderWrapper.vue.js";
17
- import me from "./organisms/LoadingWrapper.vue.js";
18
- import le from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
19
- import ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
20
- import { useStripoApi as pe } from "../services/stripoApi.js";
21
- import { useConfigStore as fe } from "../stores/config.js";
22
- import { useDynamicContentStore as ye } from "../stores/dynamic-content.js";
23
- import { useEditorStore as O } from "../stores/editor.js";
24
- import { usePreviewStore as ve } from "../stores/preview.js";
25
- import { useTemplateStore as ge } from "../stores/template.js";
26
- import { useUnsubscribeStore as Se } from "../stores/unsubscribe.js";
27
- import { readTrackFloor as P } from "../utils/linkTrackingIds.js";
28
- const Ke = /* @__PURE__ */ j({
10
+ import { RIBBON_SELECTOR as ie } from "../enums/onboarding.js";
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";
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";
26
+ import { readTrackFloor as W } from "../utils/linkTrackingIds.js";
27
+ const Ve = /* @__PURE__ */ Y({
29
28
  __name: "Guido",
30
29
  props: {
31
30
  config: null,
32
31
  ready: { type: Boolean, default: !0 }
33
32
  },
34
33
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
35
- setup(W, { expose: x, emit: r }) {
36
- const a = W, G = R(
34
+ setup(x, { expose: G, emit: r }) {
35
+ const a = x, H = S(
37
36
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
38
- ), H = R(
37
+ ), $ = S(
39
38
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
40
- ), g = B(), l = B(), u = ye(), S = Se(), o = fe();
39
+ ), z = S(
40
+ () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
41
+ ), h = A(), u = A(), p = ve(), b = be(), o = ge();
41
42
  a.ready && o.init(a.config);
42
- const c = O(), $ = ve(), m = U(() => c.hasChanges), { isTestPartner: z } = ee(), h = () => {
43
+ const c = P(), q = Se(), m = l(() => c.hasChanges), { isTestPartner: K } = re(), E = () => {
43
44
  var t;
44
- return (t = g.value) == null ? void 0 : t.handleSave(!0);
45
- }, b = (t) => {
45
+ return (t = h.value) == null ? void 0 : t.handleSave(!0);
46
+ }, w = (t) => {
46
47
  c.loadingStatus = t;
47
48
  };
48
- X(), Z();
49
- const p = () => {
49
+ te(), ne();
50
+ const f = () => {
50
51
  var t, e;
51
52
  return {
52
53
  emailId: o.templateId,
@@ -56,11 +57,13 @@ const Ke = /* @__PURE__ */ j({
56
57
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
57
58
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
58
59
  };
59
- }, { initPlugin: E, preloadRuntime: w } = te(), { getDefaultTemplate: D } = pe(), { cloneTimersOnSave: C, hasTimerBlocks: k } = oe(), q = U(() => {
60
+ }, { initPlugin: C, preloadRuntime: D } = se(), { getDefaultTemplate: k } = ye(), { cloneTimersOnSave: T, hasTimerBlocks: F } = ae(), V = l(() => {
60
61
  var t;
61
62
  return !((t = o.ui) != null && t.showHeader);
62
- });
63
- Y({
63
+ }), j = l(() => o.isFeatureEnabled("reusableRecommendationStrategy")), J = l(
64
+ () => !!O().recommendationConfigs.strategyId
65
+ );
66
+ oe({
64
67
  onBack: () => {
65
68
  console.debug("guido:back"), r("back");
66
69
  },
@@ -68,86 +71,86 @@ const Ke = /* @__PURE__ */ j({
68
71
  console.debug("guido:save:start"), r("save:start");
69
72
  },
70
73
  onSaveComplete: (t) => {
71
- const e = { ...t, metadata: p() };
74
+ const e = { ...t, metadata: f() };
72
75
  console.debug("guido:save:complete", e), r("save:complete", e);
73
76
  },
74
77
  onTestEmailClick: () => {
75
78
  console.debug("guido:test-email:click"), r("test-email:click");
76
79
  }
77
80
  });
78
- const T = (t) => {
79
- console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
80
- }, F = () => {
81
+ const I = (t) => {
82
+ console.debug("dynamic-content:close", t), p.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
83
+ }, R = () => {
81
84
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
82
85
  };
83
- _(() => m.value, () => {
86
+ U(() => m.value, () => {
84
87
  r("on-change", m.value);
85
88
  });
86
- const f = (t) => {
89
+ const y = (t) => {
87
90
  const e = t, { attribute: s, position: d } = e.detail;
88
91
  console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
89
92
  };
90
93
  let i = null;
91
- const y = () => {
94
+ const g = () => {
92
95
  var e;
93
- const t = document.querySelector(ne);
94
- (e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
96
+ const t = document.querySelector(ie);
97
+ (e = u.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
95
98
  }, v = async () => {
96
99
  var t;
97
100
  try {
98
101
  o.initialized || o.init(a.config), c.templateId = o.templateId;
99
- const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", I = (e == null ? void 0 : e.preselectedDynamicContent) || [];
100
- S.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
101
- const L = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, M = o.isFeatureEnabled("linkTrackingIds");
102
+ 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
+ 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");
102
105
  let n = {
103
- html: s && await A(s, L),
106
+ html: s && await _(s, B),
104
107
  css: d
105
108
  };
106
- n.html || (n = await D(), n.html = await A(n.html, L));
107
- const K = M ? P(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
108
- k(n.html) && (n.html = await C(n.html)), M && (c.trackIdSessionFloor = Math.max(K, P(n.html)));
109
- const V = {
110
- preselectedDynamicContentList: I,
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 = {
113
+ preselectedDynamicContentList: L,
111
114
  onReady: () => {
112
115
  console.debug("guido:ready"), r("ready");
113
116
  }
114
117
  };
115
- await E(n, p(), V), u.selectedDynamicContentList = I;
118
+ await C(n, f(), X), p.selectedDynamicContentList = L;
116
119
  } catch (e) {
117
120
  console.error("Failed to initialize Stripo editor:", e);
118
121
  }
119
122
  };
120
- return J(async () => {
123
+ return Z(async () => {
121
124
  var e;
122
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), re().$reset(), O().$reset(), ge().$reset(), y();
123
- const t = (e = l.value) == null ? void 0 : e.parentElement;
124
- if (t && (i = new ResizeObserver(y), i.observe(t)), w(), a.ready)
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)
125
128
  await v();
126
129
  else {
127
- const s = _(() => a.ready, (d) => {
130
+ const s = U(() => a.ready, (d) => {
128
131
  d && (s(), v());
129
132
  });
130
133
  }
131
- document.addEventListener("dynamic-content:open", f);
132
- }), Q(() => {
133
- i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", f);
134
+ document.addEventListener("dynamic-content:open", y);
135
+ }), ee(() => {
136
+ i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", y);
134
137
  try {
135
138
  window.UIEditor.removeEditor();
136
139
  } catch {
137
140
  console.debug("Failed to remove Stripo editor: No editor found");
138
141
  }
139
142
  o.reset();
140
- }), x({
143
+ }), G({
141
144
  dynamicContent: {
142
- insert: T,
143
- close: F
145
+ insert: I,
146
+ close: R
144
147
  },
145
148
  hasChanges: m,
146
- saveSilent: h,
147
- setLoading: b
148
- }), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: H, headerWrapperRef: g, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: S, props: a, configStore: o, editorStore: c, previewStore: $, hasChanges: m, isTestPartner: z, saveSilent: h, setLoading: b, emit: r, buildMetadata: p, initPlugin: E, preloadRuntime: w, getDefaultTemplate: D, cloneTimersOnSave: C, hasTimerBlocks: k, noHeader: q, insertDynamicContent: T, closeDynamicContent: F, handleDynamicContentOpen: f, ribbonObserver: i, updateRibbonOffset: y, startEditor: v, AutoSaveController: se, Toaster: ae, AssignStrategyDrawer: ie, FilterSelectionDrawer: ce, HeaderWrapper: de, LoadingWrapper: me, SaveAsTemplateDrawer: le, UnsubscribeWrapper: ue };
149
+ saveSilent: E,
150
+ 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 };
149
152
  }
150
153
  });
151
154
  export {
152
- Ke as default
155
+ Ve as default
153
156
  };
@@ -1,18 +1,21 @@
1
- import a from "./AssignStrategyDrawer.vue2.js";
1
+ import r from "./AssignStrategyDrawer.vue2.js";
2
2
  /* empty css */
3
- import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var o = function() {
5
- var s = this, e = s._self._c, t = s._self._setupProxy;
6
- return e(t.WpDrawer, { attrs: { id: "assign-strategy-drawer", "description-status": "", size: "medium", "description-text": t.drawerDescription, "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.assignStrategyDrawerStatus, "title-text": t.trans("gpt-app-builder.assign-recommendation-strategy") }, on: { cancelOrBackButtonEvent: t.closeDrawer, onCloseEvent: t.closeDrawer, primaryButtonEvent: t.assignStrategy } }, [t.store.assignStrategyDrawerStatus ? e("div", { staticClass: "assign-strategy-drawer-content d-f f-d-c gap-16" }, [e(t.InSelect, { staticClass: "assign-strategy-select", attrs: { id: "assign-strategy-select", "search-status": "", "static-child-position": "bottom right", "button-status": !1, "dynamic-child-position": !1, "label-text": t.trans("ds-steps.recommendation-strategy"), options: t.strategyOptions, "placeholder-text": t.trans("ds-steps.select-strategy"), "skeleton-sizing": { width: 240, height: 42 }, "skeleton-status": t.store.strategiesLoading, state: t.showSelectionError ? "error" : "default", "state-message": t.showSelectionError ? t.trans("ds-steps.select-strategy-tooltip") : "", value: t.selectValue }, on: { select: t.onSelect } }), t.selectedStrategy ? e("div", { key: String(t.selectedStrategy.strategy_id), staticClass: "assign-strategy-detail" }, [e(t.OrgStrategyDetailModal, { attrs: { show: "", "campaign-details-tab-status": t.campaignTabSupported, "footer-status": !1, strategy: t.selectedStrategy } })], 1) : s._e()], 1) : s._e()]);
7
- }, n = [], i = /* @__PURE__ */ r(
3
+ /* empty css */
4
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
5
+ var a = function() {
6
+ var e = this, s = e._self._c, t = e._self._setupProxy;
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
+ 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
+ }, proxy: !0 }], null, !1, 2542767044) }) : e._e();
10
+ }, n = [], i = /* @__PURE__ */ o(
11
+ r,
8
12
  a,
9
- o,
10
13
  n,
11
14
  !1,
12
15
  null,
13
- "afde0449"
16
+ "d3080c55"
14
17
  );
15
- const p = i.exports;
18
+ const y = i.exports;
16
19
  export {
17
- p as default
20
+ y as default
18
21
  };
@@ -1,64 +1,103 @@
1
- import { defineComponent as S, defineAsyncComponent as w, ref as c, computed as o, watch as v } from "vue";
1
+ import { defineComponent as v, defineAsyncComponent as u, ref as f, computed as l, watch as O } from "vue";
2
2
  import "@useinsider/design-system-organisms/style";
3
- import _ from "../../../wrappers/WpDrawer.vue.js";
4
- import { useToaster as D } from "../../../../composables/useToaster.js";
5
- import { useTranslations as T } from "../../../../composables/useTranslations.js";
6
- import { URLS as A } from "../../../../enums/extensions/recommendationBlock.js";
7
- import { ToasterTypeOptions as u } from "../../../../enums/toaster.js";
8
- import { useRecommendationExtensionStore as E } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { buildStrategyInfoBoxProps as O } from "../../../../utils/strategyInfoBox.js";
10
- import { InSelect as x } from "@useinsider/design-system-vue";
11
- const V = /* @__PURE__ */ S({
3
+ import { useToaster as x } from "../../../../composables/useToaster.js";
4
+ import { useTranslations as A } from "../../../../composables/useTranslations.js";
5
+ import { DOTTED_DATE_LOCALE as E } from "../../../../enums/date.js";
6
+ import { URLS as h } from "../../../../enums/extensions/recommendationBlock.js";
7
+ import { ToasterTypeOptions as p } from "../../../../enums/toaster.js";
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({
12
14
  __name: "AssignStrategyDrawer",
13
- setup(B) {
14
- const p = w(
15
- async () => (await import("@useinsider/design-system-organisms")).OrgStrategyDetailModal
16
- ), r = T(), e = E(), { showToaster: n } = D(), s = c(null), a = c(!1), l = c(!1), m = o(() => e.assignStrategyDrawerStatus ? r("email-editor.assign-strategy-description", { url: A.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
17
- v(() => e.assignStrategyDrawerStatus, (t) => {
15
+ setup(k) {
16
+ const c = () => import("@useinsider/design-system-organisms"), g = (t, r) => ({
17
+ render: (s) => s(N, { props: { sizing: { width: t, height: r } } })
18
+ }), S = u({
19
+ loader: async () => (await c()).OrgStrategyDetailModal,
20
+ loadingComponent: g(480, 240),
21
+ delay: 0
22
+ }), T = u({
23
+ loader: async () => (await c()).OrgStrategyDropdown,
24
+ loadingComponent: g(240, 42),
25
+ 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(() => e.assignStrategyDrawerStatus, (t) => {
18
28
  if (!t)
19
29
  return;
20
- const { strategyId: i } = e.recommendationConfigs;
21
- s.value = i || null, a.value = !1, l.value = !!window.l10n, e.fetchStrategies().catch(() => {
22
- n({
23
- type: u.Error,
24
- message: r("discovery-strategy.error-description")
30
+ const { strategyId: r } = e.recommendationConfigs;
31
+ n.value = r || null, i.value = !1, e.fetchStrategies().catch(() => {
32
+ a({
33
+ type: p.Error,
34
+ message: o("discovery-strategy.error-description")
25
35
  });
26
36
  });
27
37
  });
28
- const y = o(() => e.strategies.map((t) => ({
38
+ const d = (t) => {
39
+ const r = m(t.updated_at || t.created_at);
40
+ if (!r)
41
+ return "";
42
+ const s = B(r, E);
43
+ return o("recommendation-strategy.last-updated-on", { value: s });
44
+ }, D = l(() => e.strategies.map((t) => ({
29
45
  text: t.name,
30
46
  value: t.strategy_id,
31
- infoBoxProps: O(t, r)
32
- }))), d = o(() => [{ value: s.value }]), g = o(() => {
33
- const t = e.strategies.find((i) => String(i.strategy_id) === String(s.value ?? ""));
47
+ infoBoxProps: {
48
+ id: `strategy-info-${t.strategy_id}`,
49
+ theme: "light",
50
+ variant: "information",
51
+ className: "assign-strategy-info-box",
52
+ titleText: I(m(t.name)),
53
+ descriptionStatus: !0,
54
+ descriptionText: d(t),
55
+ slot: b,
56
+ slotProps: { strategy: t }
57
+ }
58
+ }))), y = l(() => {
59
+ const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
34
60
  return t ? { ...t, fallback_config: null } : null;
35
- }), f = o(() => ({
61
+ }), w = l(() => ({
36
62
  primaryButton: {
37
63
  styling: "solid",
38
64
  type: "primary",
39
- labelText: r("products.assign-btn")
65
+ labelText: o("products.assign-btn")
40
66
  },
41
67
  cancelOrBackButton: {
42
68
  styling: "ghost",
43
69
  type: "secondary",
44
- labelText: r("products.cancel")
70
+ labelText: o("products.cancel")
45
71
  }
46
72
  }));
47
- return { __sfc: !0, OrgStrategyDetailModal: p, trans: r, store: e, showToaster: n, selectedStrategyId: s, showSelectionError: a, campaignTabSupported: l, drawerDescription: m, strategyOptions: y, selectValue: d, selectedStrategy: g, footerButtonGroupOptions: f, closeDrawer: () => {
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: () => {
48
74
  e.closeAssignStrategyDrawer();
49
- }, assignStrategy: () => {
50
- const t = g.value;
75
+ }, assignStrategy: async () => {
76
+ const t = y.value;
51
77
  if (!t) {
52
- a.value = !0;
78
+ i.value = !0;
79
+ return;
80
+ }
81
+ let r = "";
82
+ try {
83
+ r = await e.resolveStrategyUrlTemplate(t, e.recommendationConfigs.currencySettings.value);
84
+ } catch (s) {
85
+ console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", s);
86
+ }
87
+ if (!r) {
88
+ a({
89
+ type: p.Error,
90
+ message: o("email-editor.strategy-assign-failed", { strategyName: t.name })
91
+ });
53
92
  return;
54
93
  }
55
- e.assignStrategy(t), n({
56
- type: u.Success,
57
- message: r("email-editor.strategy-assigned-success", { strategyName: t.name })
94
+ e.assignStrategy(t), a({
95
+ type: p.Success,
96
+ message: o("email-editor.strategy-assigned-success", { strategyName: t.name })
58
97
  }), e.closeAssignStrategyDrawer();
59
98
  }, onSelect: (t) => {
60
- s.value = t.value, a.value = !1;
61
- }, WpDrawer: _, InSelect: x };
99
+ n.value = t.value, i.value = !1;
100
+ } };
62
101
  }
63
102
  });
64
103
  export {
@@ -0,0 +1,19 @@
1
+ import r from "./StrategyInfoBoxContent.vue2.js";
2
+ import _ from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var c = function() {
4
+ var t = this, s = t._self._c, n = t._self._setupProxy;
5
+ return s("div", { staticClass: "d-f f-d-c mt-3" }, t._l(n.details, function(e, a) {
6
+ return s("div", { key: e.title, staticClass: "d-f f-d-c", class: { "mt-2": a > 0 } }, [s("span", { staticClass: "f-s-1 f-w-600 l-h-1 t-c-52 mb-12" }, [t._v(t._s(e.title))]), s("span", { staticClass: "f-s-1 l-h-6 t-c-55 w-b-b-w" }, [t._v(t._s(e.value))])]);
7
+ }), 0);
8
+ }, f = [], l = /* @__PURE__ */ _(
9
+ r,
10
+ c,
11
+ f,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const p = l.exports;
17
+ export {
18
+ p as default
19
+ };
@@ -0,0 +1,62 @@
1
+ import { defineComponent as v, computed as i } from "vue";
2
+ import { useTranslations as _ } from "../../../../composables/useTranslations.js";
3
+ const A = /* @__PURE__ */ v({
4
+ __name: "StrategyInfoBoxContent",
5
+ props: {
6
+ strategy: null
7
+ },
8
+ 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)
19
+ return "";
20
+ let r;
21
+ try {
22
+ r = JSON.parse(e);
23
+ } catch {
24
+ return e;
25
+ }
26
+ if (Array.isArray(r))
27
+ return r.length ? String(r.length) : "";
28
+ if (r && typeof r == "object") {
29
+ const c = Object.keys(r).length;
30
+ return c ? String(c) : "";
31
+ }
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;
38
+ }, y = i(() => {
39
+ const t = s.strategy.filters;
40
+ if (!t)
41
+ return a.value;
42
+ 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;
48
+ } catch {
49
+ return a.value;
50
+ }
51
+ }), h = i(() => [
52
+ { title: n("gpt-app-builder.algorithms-and-method"), value: u.value },
53
+ { title: n("gpt-app-builder.exclusions"), value: g.value },
54
+ { title: n("discovery-strategy.filters"), value: y.value },
55
+ { title: n("action-builder.manual-merchandising"), value: d.value }
56
+ ]);
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
+ }
59
+ });
60
+ export {
61
+ A as default
62
+ };