@useinsider/guido 3.17.0-beta.a0d17c2 → 3.17.0-beta.a2334c9

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 (27) hide show
  1. package/dist/components/Guido.vue.js +4 -4
  2. package/dist/components/Guido.vue2.js +48 -46
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +80 -55
  5. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  6. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  7. package/dist/composables/useLegacyStrategyConversion.js +52 -0
  8. package/dist/enums/extensions/recommendationBlock.js +2 -1
  9. package/dist/extensions/Blocks/Recommendation/block.js +12 -11
  10. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +14 -13
  11. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +92 -90
  12. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +62 -28
  13. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +90 -49
  14. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +58 -0
  15. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +9 -9
  16. package/dist/guido.css +1 -1
  17. package/dist/services/recommendationApi.js +61 -52
  18. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  19. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  20. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
  21. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
  22. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -0
  23. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +54 -1
  24. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +39 -0
  25. package/dist/src/services/recommendationApi.d.ts +2 -1
  26. package/dist/static/styles/components/recommendation-strategy.css.js +33 -3
  27. package/package.json +1 -1
@@ -3,7 +3,7 @@ import o from "./Guido.vue2.js";
3
3
  import i from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var t = function() {
5
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(_) {
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(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : 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(
@@ -12,9 +12,9 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "5c588dc5"
15
+ "d1f80922"
16
16
  );
17
- const v = n.exports;
17
+ const f = n.exports;
18
18
  export {
19
- v as default
19
+ f as default
20
20
  };
@@ -1,30 +1,30 @@
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";
1
+ import { defineComponent as ee, defineAsyncComponent as m, ref as U, computed as u, watch as A, onMounted as te, onUnmounted as oe } from "vue";
2
+ import { useCortexBlueprintBridge as ne } from "../composables/useCortexBlueprintBridge.js";
3
+ import { provideGuidoActions as re } from "../composables/useGuidoActions.js";
4
+ import { useGuidoStateBridge as se } from "../composables/useGuidoStateBridge.js";
5
+ import { usePartner as ae } from "../composables/usePartner.js";
6
+ import { useStripo as ie } from "../composables/useStripo.js";
7
+ import { useTimerClone as ce } 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 ce } from "../enums/onboarding.js";
10
+ import { RIBBON_SELECTOR as de } from "../enums/onboarding.js";
11
11
  import { useRecommendationExtensionStore as O } from "../extensions/Blocks/Recommendation/store/recommendation.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";
12
+ import me from "./organisms/AutoSaveController.vue.js";
13
+ import le from "./organisms/base/Toaster.vue.js";
14
+ import ue from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
+ import pe from "./organisms/header/HeaderWrapper.vue.js";
16
+ import fe from "./organisms/LoadingWrapper.vue.js";
17
+ import ye from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
+ import ge from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
+ import { useStripoApi as ve } from "../services/stripoApi.js";
20
+ import { useConfigStore as Se } from "../stores/config.js";
21
+ import { useDynamicContentStore as he } from "../stores/dynamic-content.js";
22
22
  import { useEditorStore as P } from "../stores/editor.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";
23
+ import { usePreviewStore as be } from "../stores/preview.js";
24
+ import { useTemplateStore as Ee } from "../stores/template.js";
25
+ import { useUnsubscribeStore as we } from "../stores/unsubscribe.js";
26
26
  import { readTrackFloor as W } from "../utils/linkTrackingIds.js";
27
- const je = /* @__PURE__ */ Z({
27
+ const Je = /* @__PURE__ */ ee({
28
28
  __name: "Guido",
29
29
  props: {
30
30
  config: null,
@@ -32,23 +32,25 @@ const je = /* @__PURE__ */ Z({
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 = l(
35
+ const a = x, H = m(
36
36
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
37
- ), $ = l(
37
+ ), $ = m(
38
38
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
39
- ), z = l(
39
+ ), z = m(
40
40
  () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
41
- ), q = l(
41
+ ), q = m(
42
42
  () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
43
- ), h = A(), p = A(), f = Se(), b = Ee(), o = ve();
43
+ ), K = m(
44
+ () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
45
+ ), h = U(), p = U(), f = he(), b = we(), o = Se();
44
46
  a.ready && o.init(a.config);
45
- const c = P(), K = he(), m = u(() => c.hasChanges), { isTestPartner: V } = se(), E = () => {
47
+ const c = P(), V = be(), l = u(() => c.hasChanges), { isTestPartner: j } = ae(), E = () => {
46
48
  var t;
47
49
  return (t = h.value) == null ? void 0 : t.handleSave(!0);
48
50
  }, w = (t) => {
49
51
  c.loadingStatus = t;
50
52
  };
51
- oe(), re();
53
+ ne(), se();
52
54
  const y = () => {
53
55
  var t, e;
54
56
  return {
@@ -59,13 +61,13 @@ const je = /* @__PURE__ */ Z({
59
61
  savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
60
62
  defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
61
63
  };
62
- }, { initPlugin: C, preloadRuntime: D } = ae(), { getDefaultTemplate: k } = ge(), { cloneTimersOnSave: T, hasTimerBlocks: F } = ie(), j = u(() => {
64
+ }, { initPlugin: C, preloadRuntime: D } = ie(), { getDefaultTemplate: k } = ve(), { cloneTimersOnSave: T, hasTimerBlocks: F } = ce(), J = u(() => {
63
65
  var t;
64
66
  return !((t = o.ui) != null && t.showHeader);
65
- }), J = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), Q = u(
67
+ }), Q = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), X = u(
66
68
  () => !!O().recommendationConfigs.strategyId
67
69
  );
68
- ne({
70
+ re({
69
71
  onBack: () => {
70
72
  console.debug("guido:back"), r("back");
71
73
  },
@@ -85,8 +87,8 @@ const je = /* @__PURE__ */ Z({
85
87
  }, R = () => {
86
88
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
87
89
  };
88
- U(() => m.value, () => {
89
- r("on-change", m.value);
90
+ A(() => l.value, () => {
91
+ r("on-change", l.value);
90
92
  });
91
93
  const g = (t) => {
92
94
  const e = t, { attribute: s, position: d } = e.detail;
@@ -95,7 +97,7 @@ const je = /* @__PURE__ */ Z({
95
97
  let i = null;
96
98
  const v = () => {
97
99
  var e;
98
- const t = document.querySelector(ce);
100
+ const t = document.querySelector(de);
99
101
  (e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
100
102
  }, S = async () => {
101
103
  var t;
@@ -109,32 +111,32 @@ const je = /* @__PURE__ */ Z({
109
111
  css: d
110
112
  };
111
113
  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 = {
114
+ const Y = B ? W(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
115
+ F(n.html) && (n.html = await T(n.html)), B && (c.trackIdSessionFloor = Math.max(Y, W(n.html)));
116
+ const Z = {
115
117
  preselectedDynamicContentList: L,
116
118
  onReady: () => {
117
119
  console.debug("guido:ready"), r("ready");
118
120
  }
119
121
  };
120
- await C(n, y(), Y), f.selectedDynamicContentList = L;
122
+ await C(n, y(), Z), f.selectedDynamicContentList = L;
121
123
  } catch (e) {
122
124
  console.error("Failed to initialize Stripo editor:", e);
123
125
  }
124
126
  };
125
- return ee(async () => {
127
+ return te(async () => {
126
128
  var e;
127
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), O().$reset(), P().$reset(), be().$reset(), v();
129
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), O().$reset(), P().$reset(), Ee().$reset(), v();
128
130
  const t = (e = p.value) == null ? void 0 : e.parentElement;
129
131
  if (t && (i = new ResizeObserver(v), i.observe(t)), D(), a.ready)
130
132
  await S();
131
133
  else {
132
- const s = U(() => a.ready, (d) => {
134
+ const s = A(() => a.ready, (d) => {
133
135
  d && (s(), S());
134
136
  });
135
137
  }
136
138
  document.addEventListener("dynamic-content:open", g);
137
- }), te(() => {
139
+ }), oe(() => {
138
140
  i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", g);
139
141
  try {
140
142
  window.UIEditor.removeEditor();
@@ -147,12 +149,12 @@ const je = /* @__PURE__ */ Z({
147
149
  insert: I,
148
150
  close: R
149
151
  },
150
- hasChanges: m,
152
+ hasChanges: l,
151
153
  saveSilent: E,
152
154
  setLoading: w
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 };
155
+ }), { __sfc: !0, PreviewContainer: H, OnboardingWrapper: $, AssignStrategyDrawer: z, RemoveStrategyModal: q, LegacyStrategyUpdatedModal: K, headerWrapperRef: h, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: b, props: a, configStore: o, editorStore: c, previewStore: V, hasChanges: l, isTestPartner: j, saveSilent: E, setLoading: w, emit: r, buildMetadata: y, initPlugin: C, preloadRuntime: D, getDefaultTemplate: k, cloneTimersOnSave: T, hasTimerBlocks: F, noHeader: J, isRrsEnabled: Q, hasAssignedStrategy: X, insertDynamicContent: I, closeDynamicContent: R, handleDynamicContentOpen: g, ribbonObserver: i, updateRibbonOffset: v, startEditor: S, AutoSaveController: me, Toaster: le, FilterSelectionDrawer: ue, HeaderWrapper: pe, LoadingWrapper: fe, SaveAsTemplateDrawer: ye, UnsubscribeWrapper: ge };
154
156
  }
155
157
  });
156
158
  export {
157
- je as default
159
+ Je as default
158
160
  };
@@ -1,19 +1,19 @@
1
1
  import r from "./AssignStrategyDrawer.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
- import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
5
- var o = function() {
4
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
5
+ var a = 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
- 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__ */ a(
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 || t.store.legacyConversionLoading, "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: { infoBoxButtonClick: t.onInfoBoxButtonClick, select: t.onSelect } })], 1)];
9
+ }, proxy: !0 }], null, !1, 239334473) }) : e._e();
10
+ }, n = [], i = /* @__PURE__ */ o(
11
11
  r,
12
- o,
12
+ a,
13
13
  n,
14
14
  !1,
15
15
  null,
16
- "2580a7d9"
16
+ "59777460"
17
17
  );
18
18
  const y = i.exports;
19
19
  export {
@@ -1,48 +1,73 @@
1
- import { defineComponent as v, defineAsyncComponent as y, ref as u, computed as l, watch as O } from "vue";
1
+ import { defineComponent as h, defineAsyncComponent as T, ref as _, computed as o, watch as B } from "vue";
2
2
  import "@useinsider/design-system-organisms/style";
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 m } 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 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({
3
+ import { useLegacyStrategyConversion as I } from "../../../../composables/useLegacyStrategyConversion.js";
4
+ import { useToaster as N } from "../../../../composables/useToaster.js";
5
+ import { useTranslations as k } from "../../../../composables/useTranslations.js";
6
+ import { DOTTED_DATE_LOCALE as P } from "../../../../enums/date.js";
7
+ import { URLS as U } from "../../../../enums/extensions/recommendationBlock.js";
8
+ import { ToasterTypeOptions as p } from "../../../../enums/toaster.js";
9
+ import { useRecommendationExtensionStore as b } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
10
+ import G from "./StrategyInfoBoxContent.vue.js";
11
+ import { formatShortDate as M } from "../../../../utils/dateUtil.js";
12
+ import { asText as D } from "../../../../utils/genericUtil.js";
13
+ import { escapeHtml as x } from "../../../../utils/htmlEscape.js";
14
+ import { InSkeleton as R } from "@useinsider/design-system-vue";
15
+ const ot = /* @__PURE__ */ h({
15
16
  __name: "AssignStrategyDrawer",
16
- setup(k) {
17
- const c = () => import("@useinsider/design-system-organisms"), g = (t, r) => ({
18
- render: (a) => a(b, { props: { sizing: { width: t, height: r } } })
19
- }), S = y({
17
+ setup(H) {
18
+ const c = () => import("@useinsider/design-system-organisms"), g = (t, a) => ({
19
+ render: (n) => n(R, { props: { sizing: { width: t, height: a } } })
20
+ }), O = T({
20
21
  loader: async () => (await c()).OrgStrategyDetailModal,
21
22
  loadingComponent: g(480, 240),
22
23
  delay: 0
23
- }), T = y({
24
+ }), w = T({
24
25
  loader: async () => (await c()).OrgStrategyDropdown,
25
26
  loadingComponent: g(240, 42),
26
27
  delay: 0
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 }) : "");
28
- O(() => e.assignStrategyDrawerStatus, (t) => {
28
+ }), r = k(), e = b(), { showToaster: i } = N(), { convertLegacyStrategy: u } = I(), s = _(null), y = "legacy", m = "guido__btn-update-legacy-strategy", l = _(!1), A = o(() => e.assignStrategyDrawerStatus ? r("email-editor.assign-strategy-description", { url: U.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
29
+ B(() => e.assignStrategyDrawerStatus, (t) => {
29
30
  if (!t)
30
31
  return;
31
- const { strategyId: r } = e.recommendationConfigs;
32
- n.value = r || null, i.value = !1, e.fetchStrategies().catch(() => {
33
- s({
34
- type: m.Error,
35
- message: o("discovery-strategy.error-description")
32
+ const { strategyId: a } = e.recommendationConfigs;
33
+ s.value = a || (e.isLegacyStrategyBlock ? y : null), l.value = !1, e.fetchStrategies().catch(() => {
34
+ i({
35
+ type: p.Error,
36
+ message: r("discovery-strategy.error-description")
36
37
  });
37
38
  });
38
39
  });
39
- const p = (t) => {
40
- const r = f(t.updated_at || t.created_at);
41
- if (!r)
40
+ const f = (t) => {
41
+ const a = D(t.updated_at || t.created_at);
42
+ if (!a)
42
43
  return "";
43
- const a = I(r, E);
44
- return o("recommendation-strategy.last-updated-on", { value: a });
45
- }, D = l(() => e.strategies.map((t) => ({
44
+ const n = M(a, P);
45
+ return r("recommendation-strategy.last-updated-on", { value: n });
46
+ }, S = o(() => ({
47
+ text: r("email-editor.legacy-strategy"),
48
+ value: y,
49
+ infoBoxProps: {
50
+ id: "strategy-info-legacy",
51
+ theme: "light",
52
+ variant: "information",
53
+ className: "assign-strategy-info-box",
54
+ titleText: x(r("email-editor.legacy-strategy")),
55
+ descriptionStatus: !0,
56
+ descriptionText: r("email-editor.legacy-strategy-description"),
57
+ buttonOptions: [{
58
+ id: m,
59
+ type: "primary",
60
+ text: r("email-editor.legacy-strategy-update"),
61
+ loadingStatus: e.legacyConversionLoading,
62
+ disabledStatus: e.legacyConversionLoading
63
+ }]
64
+ }
65
+ })), E = async (t) => {
66
+ if ((t == null ? void 0 : t.id) !== m)
67
+ return;
68
+ const a = await u();
69
+ a && (s.value = a);
70
+ }, d = o(() => e.strategies.map((t) => ({
46
71
  text: t.name,
47
72
  value: t.strategy_id,
48
73
  infoBoxProps: {
@@ -50,57 +75,57 @@ const W = /* @__PURE__ */ v({
50
75
  theme: "light",
51
76
  variant: "information",
52
77
  className: "assign-strategy-info-box",
53
- titleText: N(f(t.name)),
78
+ titleText: x(D(t.name)),
54
79
  descriptionStatus: !0,
55
- descriptionText: p(t),
56
- slot: B,
80
+ descriptionText: f(t),
81
+ slot: G,
57
82
  slotProps: { strategy: t }
58
83
  }
59
- }))), d = l(() => {
60
- const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
84
+ }))), C = o(() => e.isLegacyStrategyBlock ? [S.value, ...d.value] : d.value), v = o(() => {
85
+ const t = e.strategies.find((a) => String(a.strategy_id) === String(s.value ?? ""));
61
86
  return t ? { ...t, fallback_config: null } : null;
62
- }), w = l(() => ({
87
+ }), L = o(() => ({
63
88
  primaryButton: {
64
89
  styling: "solid",
65
90
  type: "primary",
66
- labelText: o("products.assign-btn")
91
+ labelText: r("products.assign-btn")
67
92
  },
68
93
  cancelOrBackButton: {
69
94
  styling: "ghost",
70
95
  type: "secondary",
71
- labelText: o("products.cancel")
96
+ labelText: r("products.cancel")
72
97
  }
73
98
  }));
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: () => {
99
+ return { __sfc: !0, loadOrganisms: c, skeleton: g, OrgStrategyDetailModal: O, OrgStrategyDropdown: w, trans: r, store: e, showToaster: i, convertLegacyStrategy: u, selectedStrategyId: s, LEGACY_OPTION_VALUE: y, LEGACY_UPDATE_BUTTON_ID: m, showSelectionError: l, drawerDescription: A, lastUpdatedText: f, legacyStrategyOption: S, onInfoBoxButtonClick: E, remoteStrategyOptions: d, strategyOptions: C, selectedStrategy: v, footerButtonGroupOptions: L, closeDrawer: () => {
75
100
  e.closeAssignStrategyDrawer();
76
101
  }, assignStrategy: async () => {
77
- const t = d.value;
102
+ const t = v.value;
78
103
  if (!t) {
79
- i.value = !0;
104
+ l.value = !0;
80
105
  return;
81
106
  }
82
- let r = "";
107
+ let a = "";
83
108
  try {
84
- r = await e.resolveStrategyUrlTemplate(t, e.recommendationConfigs.currencySettings.value);
85
- } catch (a) {
86
- console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", a);
109
+ a = await e.resolveStrategyUrlTemplate(t, e.recommendationConfigs.currencySettings.value);
110
+ } catch (n) {
111
+ console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", n);
87
112
  }
88
- if (!r) {
89
- s({
90
- type: m.Error,
91
- message: o("email-editor.strategy-assign-failed", { strategyName: t.name })
113
+ if (!a) {
114
+ i({
115
+ type: p.Error,
116
+ message: r("email-editor.strategy-assign-failed", { strategyName: t.name })
92
117
  });
93
118
  return;
94
119
  }
95
- e.assignStrategy(t), s({
96
- type: m.Success,
97
- message: o("email-editor.strategy-assigned-success", { strategyName: t.name })
120
+ e.assignStrategy(t), i({
121
+ type: p.Success,
122
+ message: r("email-editor.strategy-assigned-success", { strategyName: t.name })
98
123
  }), e.closeAssignStrategyDrawer();
99
124
  }, onSelect: (t) => {
100
- n.value = t.value, i.value = !1;
125
+ s.value = t.value, l.value = !1;
101
126
  } };
102
127
  }
103
128
  });
104
129
  export {
105
- W as default
130
+ ot as default
106
131
  };
@@ -0,0 +1,18 @@
1
+ import s from "./LegacyStrategyUpdatedModal.vue2.js";
2
+ /* empty css */
3
+ import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
+ var t = this, a = t._self._c, e = t._self._setupProxy;
6
+ return e.store.legacyStrategyUpdatedModalStatus ? a("div", { staticClass: "legacy-strategy-updated-modal" }, [a(e.WpModal, { attrs: { id: "guido__legacy-strategy-updated-modal", size: "small", "close-on-outside-click": !1, "footer-button-options": e.footerButtonOptions, title: e.trans("email-editor.legacy-strategy-updated-title") }, on: { close: e.close, "primary-action": e.close } }, [a("p", [t._v(t._s(e.messageParts[0])), a("b", [t._v(t._s(e.strategyName))]), t._v(t._s(e.messageParts[1]))])])], 1) : t._e();
7
+ }, l = [], _ = /* @__PURE__ */ o(
8
+ s,
9
+ r,
10
+ l,
11
+ !1,
12
+ null,
13
+ "13275a66"
14
+ );
15
+ const p = _.exports;
16
+ export {
17
+ p as default
18
+ };
@@ -0,0 +1,25 @@
1
+ import { defineComponent as i, computed as s } from "vue";
2
+ import p from "../../../wrappers/WpModal.vue.js";
3
+ import { useTranslations as d } from "../../../../composables/useTranslations.js";
4
+ import { useRecommendationExtensionStore as g } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ const M = /* @__PURE__ */ i({
6
+ __name: "LegacyStrategyUpdatedModal",
7
+ setup(l) {
8
+ const e = d(), t = g(), n = s(() => ({
9
+ primaryButton: {
10
+ type: "primary",
11
+ labelText: e("action-builder.ok")
12
+ }
13
+ })), m = s(() => {
14
+ var r;
15
+ const { strategyId: a } = t.recommendationConfigs;
16
+ return ((r = t.assignedStrategy) == null ? void 0 : r.name) || `#${a}`;
17
+ }), o = "__STRATEGY_NAME__", c = s(() => e("email-editor.legacy-strategy-updated-message", { strategyName: o }).split(o));
18
+ return { __sfc: !0, trans: e, store: t, footerButtonOptions: n, strategyName: m, NAME_TOKEN: o, messageParts: c, close: () => {
19
+ t.closeLegacyStrategyUpdatedModal();
20
+ }, WpModal: p };
21
+ }
22
+ });
23
+ export {
24
+ M as default
25
+ };
@@ -0,0 +1,52 @@
1
+ import { useRecommendation as l } from "./useRecommendation.js";
2
+ import { useToaster as u } from "./useToaster.js";
3
+ import { useTranslations as p } from "./useTranslations.js";
4
+ import { ToasterTypeOptions as f } from "../enums/toaster.js";
5
+ import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
+ import { CURRENT_CONFIG_VERSION as S } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
+ import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { buildLegacyMigrationPayload as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
+ import { commitBlockChangeOutsidePanel as v } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
+ import { useConfigStore as I } from "../stores/config.js";
11
+ const x = () => {
12
+ const t = C(), a = I(), { buildCampaignUrl: n } = l(), { showToaster: i } = u(), c = p();
13
+ return { convertLegacyStrategy: async () => {
14
+ const e = t.currentRecommendationId;
15
+ if (e === null || !t.isLegacyStrategyBlock || t.legacyConversionLoading)
16
+ return "";
17
+ const { strategy: s, productIds: m, filters: g } = t.recommendationConfigs, d = L({
18
+ blockId: e,
19
+ url: n(String(e)),
20
+ templateId: a.templateId,
21
+ variationId: a.variationId,
22
+ strategy: s,
23
+ productIds: m,
24
+ filters: g,
25
+ attributes: t.getFilterList
26
+ });
27
+ let o;
28
+ try {
29
+ o = await t.convertLegacyStrategy(d);
30
+ } catch (r) {
31
+ return console.error("[useLegacyStrategyConversion] migration failed", r), i({
32
+ type: f.Error,
33
+ message: c("email-editor.legacy-strategy-update-failed")
34
+ }), "";
35
+ }
36
+ const { size: y } = t.recommendationConfigs;
37
+ try {
38
+ await t.fetchRecommendationProducts();
39
+ } catch (r) {
40
+ console.error("[useLegacyStrategyConversion] product refetch failed", r);
41
+ }
42
+ return v(
43
+ e,
44
+ { strategyId: o, size: y, configVersion: S },
45
+ t.recommendationProducts,
46
+ "Converted legacy recommendation strategy"
47
+ ), t.openLegacyStrategyUpdatedModal(), o;
48
+ } };
49
+ };
50
+ export {
51
+ x as useLegacyStrategyConversion
52
+ };
@@ -4,7 +4,8 @@ const l = {
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
5
  PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
6
  RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
- RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
7
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
8
+ NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations"
8
9
  }, c = {
9
10
  CLIENT_ID: "clientId"
10
11
  }, d = () => {
@@ -6,15 +6,16 @@ import { BlockId as y } from "../../../enums/block.js";
6
6
  import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
7
7
  import { Block as b, BlockCompositionType as A, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
8
  import { CURRENT_CONFIG_VERSION as E, PRE_RRS_CONFIG_VERSION as S } from "./constants/defaultConfig.js";
9
+ import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
9
10
  import { regenerateMobileProductRows as N } from "./controls/main/utils.js";
10
11
  import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as O } from "./controls/mobileLayout/cssRules.js";
11
12
  import { RecommendationConfigService as s } from "./services/configService.js";
12
13
  import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
13
14
  import { getDefaultTemplate as M } from "./templates/grid/template.js";
14
15
  import { useRecommendationBlockWarning as w } from "./useRecommendationBlockWarning.js";
15
- const _ = y.Recommendation, m = "recommendation-block-v2", u = "recommendation-id", I = "hide-price";
16
+ const _ = y.Recommendation, u = "recommendation-block-v2", I = "hide-price";
16
17
  let k = !1;
17
- class K extends b {
18
+ class W extends b {
18
19
  constructor() {
19
20
  super();
20
21
  /**
@@ -172,9 +173,9 @@ class K extends b {
172
173
  let t = 0;
173
174
  try {
174
175
  const e = this.api.getDocumentRoot();
175
- e && "querySelectorAll" in e && e.querySelectorAll(`.${m}`).forEach((n) => {
176
+ e && "querySelectorAll" in e && e.querySelectorAll(`.${u}`).forEach((n) => {
176
177
  if ("getAttribute" in n) {
177
- const o = n.getAttribute(u), r = o ? parseInt(o) : 0;
178
+ const o = n.getAttribute(m), r = o ? parseInt(o) : 0;
178
179
  r > t && (t = r);
179
180
  }
180
181
  });
@@ -202,7 +203,7 @@ class K extends b {
202
203
  if (!i || !("querySelectorAll" in i))
203
204
  return;
204
205
  const n = i.querySelectorAll(
205
- `.${m}[${u}="${e}"]`
206
+ `.${u}[${m}="${e}"]`
206
207
  );
207
208
  if (n.length <= 1)
208
209
  return;
@@ -227,7 +228,7 @@ class K extends b {
227
228
  const e = this.api.getDocumentRoot();
228
229
  if (e && "querySelectorAll" in e)
229
230
  return e.querySelectorAll(
230
- `.${m}[${u}="${t}"]`
231
+ `.${u}[${m}="${t}"]`
231
232
  ).length > 1;
232
233
  } catch {
233
234
  }
@@ -284,7 +285,7 @@ class K extends b {
284
285
  if (!i)
285
286
  return;
286
287
  const n = this.api.getDocumentModifier();
287
- n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new g(`Assign recommendation ID ${e}`));
288
+ n.modifyHtml(i).setAttribute(m, e.toString()), n.apply(new g(`Assign recommendation ID ${e}`));
288
289
  }
289
290
  /**
290
291
  * Stamps the `hide-price` attribute (read by email-service at send time) on
@@ -312,7 +313,7 @@ class K extends b {
312
313
  const e = this._getBlockElement(t);
313
314
  if (!e || !("getAttribute" in e))
314
315
  return null;
315
- const i = e.getAttribute(u);
316
+ const i = e.getAttribute(m);
316
317
  if (!i)
317
318
  return null;
318
319
  const n = parseInt(i);
@@ -324,10 +325,10 @@ class K extends b {
324
325
  _getBlockElement(t) {
325
326
  if ("getAttribute" in t) {
326
327
  const e = t.getAttribute("class");
327
- if (e && e.includes(m))
328
+ if (e && e.includes(u))
328
329
  return t;
329
330
  }
330
- return "querySelector" in t ? t.querySelector(`.${m}`) ?? null : null;
331
+ return "querySelector" in t ? t.querySelector(`.${u}`) ?? null : null;
331
332
  }
332
333
  /**
333
334
  * Migrate configuration from legacy format
@@ -338,5 +339,5 @@ class K extends b {
338
339
  }
339
340
  export {
340
341
  _ as BLOCK_ID,
341
- K as RecommendationBlock
342
+ W as RecommendationBlock
342
343
  };