@useinsider/guido 3.17.0-beta.ad62b51 → 3.17.0-beta.db1a6f8

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 (86) hide show
  1. package/README.md +5 -5
  2. package/dist/@types/config/schemas.js +0 -5
  3. package/dist/components/Guido.vue.js +10 -10
  4. package/dist/components/Guido.vue2.js +93 -85
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +8 -5
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +77 -37
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  9. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  10. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
  11. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  12. package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
  13. package/dist/composables/useActionsApi.js +82 -67
  14. package/dist/composables/useAutoSave.js +31 -26
  15. package/dist/composables/useEditorLock.js +20 -0
  16. package/dist/composables/useGuidoStateBridge.js +37 -31
  17. package/dist/composables/useRecommendation.js +29 -30
  18. package/dist/composables/useSave.js +39 -36
  19. package/dist/composables/useStripo.js +14 -14
  20. package/dist/config/i18n/en/labels.json.js +1 -1
  21. package/dist/config/migrator/index.js +9 -8
  22. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  23. package/dist/config/migrator/recommendation/extractors.js +29 -24
  24. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  25. package/dist/config/migrator/recommendation/settingsMapper.js +0 -2
  26. package/dist/config/migrator/recommendationMigrator.js +30 -26
  27. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  28. package/dist/enums/date.js +5 -4
  29. package/dist/enums/extensions/recommendationBlock.js +0 -1
  30. package/dist/extensions/Blocks/Recommendation/block.js +12 -11
  31. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  32. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  33. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +24 -24
  34. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
  35. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +329 -257
  36. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +180 -133
  37. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +1 -19
  38. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  39. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  40. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  41. package/dist/extensions/Blocks/Recommendation/services/configService.js +34 -16
  42. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  43. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +83 -128
  44. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  45. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  46. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  47. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  48. package/dist/guido.css +1 -1
  49. package/dist/services/recommendationApi.js +10 -16
  50. package/dist/src/@types/config/schemas.d.ts +0 -10
  51. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  52. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  53. package/dist/src/composables/useEditorLock.d.ts +10 -0
  54. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  55. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  56. package/dist/src/enums/date.d.ts +1 -0
  57. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  58. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  59. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -5
  60. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  61. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  62. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +39 -15
  65. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -14
  66. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  67. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  68. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  69. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -56
  70. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  71. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -5
  72. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  73. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -61
  74. package/dist/src/services/recommendationApi.d.ts +1 -1
  75. package/dist/src/stores/save-as-template.d.ts +4 -3
  76. package/dist/src/utils/genericUtil.d.ts +5 -0
  77. package/dist/static/assets/icons/line-delete.svg.js +2 -2
  78. package/dist/static/assets/icons/line-plus.svg.js +2 -2
  79. package/dist/static/styles/components/recommendation-strategy.css.js +2 -35
  80. package/dist/static/styles/customEditorStyle.css.js +3 -1
  81. package/dist/utils/dateUtil.js +18 -24
  82. package/dist/utils/genericUtil.js +28 -27
  83. package/dist/utils/templatePreparation.js +0 -2
  84. package/package.json +3 -3
  85. package/dist/src/utils/strategyInfoBox.d.ts +0 -22
  86. package/dist/utils/strategyInfoBox.js +0 -37
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
@@ -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 o 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
- 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 ? 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
- }, n = [], s = /* @__PURE__ */ a(
10
- i,
9
+ }, s = [], n = /* @__PURE__ */ i(
10
+ o,
11
11
  t,
12
- n,
12
+ s,
13
13
  !1,
14
14
  null,
15
- "b13f0cfc"
15
+ "050dfa52"
16
16
  );
17
- const l = s.exports;
17
+ const f = n.exports;
18
18
  export {
19
- l as default
19
+ f as default
20
20
  };
@@ -1,67 +1,74 @@
1
- import { defineComponent as Q, defineAsyncComponent as g, ref as U, computed as S, watch as _, onMounted as X, onUnmounted as Y } from "vue";
2
- import { useCortexBlueprintBridge as Z } from "../composables/useCortexBlueprintBridge.js";
3
- import { provideGuidoActions as ee } from "../composables/useGuidoActions.js";
4
- import { useGuidoStateBridge as te } from "../composables/useGuidoStateBridge.js";
5
- import { usePartner as oe } from "../composables/usePartner.js";
6
- import { useStripo as ne } from "../composables/useStripo.js";
7
- import { useTimerClone as re } from "../composables/useTimerClone.js";
8
- import { migrate as A } from "../config/migrator/index.js";
9
- import { ModuleFolderDefaults as N } from "../enums/defaults.js";
10
- import { RIBBON_SELECTOR as se } from "../enums/onboarding.js";
11
- import { useRecommendationExtensionStore as ae } from "../extensions/Blocks/Recommendation/store/recommendation.js";
12
- import ie from "./organisms/AutoSaveController.vue.js";
13
- import ce from "./organisms/base/Toaster.vue.js";
14
- import de from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
15
- import me from "./organisms/header/HeaderWrapper.vue.js";
16
- import le from "./organisms/LoadingWrapper.vue.js";
17
- import ue from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
18
- import pe from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
19
- import { useStripoApi as fe } from "../services/stripoApi.js";
20
- import { useConfigStore as ye } from "../stores/config.js";
21
- import { useDynamicContentStore as ve } from "../stores/dynamic-content.js";
22
- import { useEditorStore as O } from "../stores/editor.js";
23
- import { usePreviewStore as ge } from "../stores/preview.js";
24
- import { useTemplateStore as Se } from "../stores/template.js";
25
- import { useUnsubscribeStore as be } from "../stores/unsubscribe.js";
26
- import { readTrackFloor as P } from "../utils/linkTrackingIds.js";
27
- const Ke = /* @__PURE__ */ Q({
1
+ import { defineComponent as ne, defineAsyncComponent as l, ref as O, computed as u, watch as P, onMounted as re, onUnmounted as se } from "vue";
2
+ import { useCortexBlueprintBridge as ae } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as ie } from "../composables/useEditorLock.js";
4
+ import { provideGuidoActions as ce } from "../composables/useGuidoActions.js";
5
+ import { useGuidoStateBridge as de } from "../composables/useGuidoStateBridge.js";
6
+ import { usePartner as me } from "../composables/usePartner.js";
7
+ import { useStripo as le } from "../composables/useStripo.js";
8
+ import { useTimerClone as ue } from "../composables/useTimerClone.js";
9
+ import { migrate as x } from "../config/migrator/index.js";
10
+ import { ModuleFolderDefaults as W } from "../enums/defaults.js";
11
+ import { RIBBON_SELECTOR as pe } from "../enums/onboarding.js";
12
+ import { useRecommendationExtensionStore as G } from "../extensions/Blocks/Recommendation/store/recommendation.js";
13
+ import fe from "./organisms/AutoSaveController.vue.js";
14
+ import ye from "./organisms/base/Toaster.vue.js";
15
+ import ge from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
16
+ import ve from "./organisms/header/HeaderWrapper.vue.js";
17
+ import Se from "./organisms/LoadingWrapper.vue.js";
18
+ import be from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
19
+ import he from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
20
+ import { useStripoApi as Ee } from "../services/stripoApi.js";
21
+ import { useConfigStore as we } from "../stores/config.js";
22
+ import { useDynamicContentStore as Ce } from "../stores/dynamic-content.js";
23
+ import { useEditorStore as H } from "../stores/editor.js";
24
+ import { usePreviewStore as De } from "../stores/preview.js";
25
+ import { useTemplateStore as ke } from "../stores/template.js";
26
+ import { useUnsubscribeStore as Te } from "../stores/unsubscribe.js";
27
+ import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
28
+ const et = /* @__PURE__ */ ne({
28
29
  __name: "Guido",
29
30
  props: {
30
31
  config: null,
31
32
  ready: { type: Boolean, default: !0 }
32
33
  },
33
34
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
34
- setup(W, { expose: x, emit: r }) {
35
- const a = W, G = g(
35
+ setup(z, { expose: q, emit: r }) {
36
+ const a = z, K = l(
36
37
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
37
- ), H = g(
38
+ ), V = l(
38
39
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
39
- ), $ = g(
40
+ ), j = l(
40
41
  () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
41
- ), b = U(), l = U(), u = ve(), h = be(), o = ye();
42
+ ), J = l(
43
+ () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
44
+ ), h = O(), p = O(), f = Ce(), E = Te(), o = we();
42
45
  a.ready && o.init(a.config);
43
- const c = O(), z = ge(), m = S(() => c.hasChanges), { isTestPartner: q } = oe(), E = () => {
46
+ const c = H(), Q = De(), m = u(() => c.hasChanges), { isTestPartner: X } = me(), w = () => {
44
47
  var t;
45
- return (t = b.value) == null ? void 0 : t.handleSave(!0);
46
- }, w = (t) => {
48
+ return (t = h.value) == null ? void 0 : t.handleSave(!0);
49
+ }, C = (t) => {
47
50
  c.loadingStatus = t;
48
51
  };
49
- Z(), te();
50
- const p = () => {
52
+ ae(), de();
53
+ const y = () => {
51
54
  var t, e;
52
55
  return {
53
56
  emailId: o.templateId,
54
57
  userId: o.userId,
55
58
  username: o.username,
56
59
  partnerName: o.partnerName,
57
- savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || N.SAVED_MODULES,
58
- defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || N.DEFAULT_MODULES
60
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || W.SAVED_MODULES,
61
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || W.DEFAULT_MODULES
59
62
  };
60
- }, { initPlugin: D, preloadRuntime: C } = ne(), { getDefaultTemplate: k } = fe(), { cloneTimersOnSave: T, hasTimerBlocks: F } = re(), K = S(() => {
63
+ }, { initPlugin: D, preloadRuntime: k } = le(), { runExclusive: T, beginMount: F, isCurrentMount: I } = ie();
64
+ let g = 0;
65
+ const { getDefaultTemplate: M } = Ee(), { cloneTimersOnSave: R, hasTimerBlocks: L } = ue(), Y = u(() => {
61
66
  var t;
62
67
  return !((t = o.ui) != null && t.showHeader);
63
- }), V = S(() => o.isFeatureEnabled("reusableRecommendationStrategy"));
64
- ee({
68
+ }), Z = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ee = u(
69
+ () => !!G().recommendationConfigs.strategyId
70
+ );
71
+ ce({
65
72
  onBack: () => {
66
73
  console.debug("guido:back"), r("back");
67
74
  },
@@ -69,86 +76,87 @@ const Ke = /* @__PURE__ */ Q({
69
76
  console.debug("guido:save:start"), r("save:start");
70
77
  },
71
78
  onSaveComplete: (t) => {
72
- const e = { ...t, metadata: p() };
79
+ const e = { ...t, metadata: y() };
73
80
  console.debug("guido:save:complete", e), r("save:complete", e);
74
81
  },
75
82
  onTestEmailClick: () => {
76
83
  console.debug("guido:test-email:click"), r("test-email:click");
77
84
  }
78
85
  });
79
- const I = (t) => {
80
- console.debug("dynamic-content:close", t), u.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
81
- }, R = () => {
86
+ const B = (t) => {
87
+ console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
88
+ }, A = () => {
82
89
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
83
90
  };
84
- _(() => m.value, () => {
91
+ P(() => m.value, () => {
85
92
  r("on-change", m.value);
86
93
  });
87
- const f = (t) => {
94
+ const v = (t) => {
88
95
  const e = t, { attribute: s, position: d } = e.detail;
89
96
  console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
90
97
  };
91
98
  let i = null;
92
- const y = () => {
99
+ const S = () => {
93
100
  var e;
94
- const t = document.querySelector(se);
95
- (e = l.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
96
- }, v = async () => {
101
+ const t = document.querySelector(pe);
102
+ (e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
103
+ }, b = async () => {
97
104
  var t;
98
105
  try {
99
106
  o.initialized || o.init(a.config), c.templateId = o.templateId;
100
- 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) || [];
101
- h.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
102
- const M = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, B = o.isFeatureEnabled("linkTrackingIds");
107
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", U = (e == null ? void 0 : e.preselectedDynamicContent) || [];
108
+ E.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
109
+ const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, N = o.isFeatureEnabled("linkTrackingIds");
103
110
  let n = {
104
- html: s && await A(s, M),
111
+ html: s && await x(s, _),
105
112
  css: d
106
113
  };
107
- n.html || (n = await k(), n.html = await A(n.html, M));
108
- const j = B ? P(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
109
- F(n.html) && (n.html = await T(n.html)), B && (c.trackIdSessionFloor = Math.max(j, P(n.html)));
110
- const J = {
111
- preselectedDynamicContentList: L,
114
+ n.html || (n = await M(), n.html = await x(n.html, _));
115
+ const te = N ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
116
+ L(n.html) && (n.html = await R(n.html)), N && (c.trackIdSessionFloor = Math.max(te, $(n.html)));
117
+ const oe = {
118
+ preselectedDynamicContentList: U,
112
119
  onReady: () => {
113
120
  console.debug("guido:ready"), r("ready");
114
121
  }
115
122
  };
116
- await D(n, p(), J), u.selectedDynamicContentList = L;
123
+ g = F(), await D(n, y(), oe), f.selectedDynamicContentList = U;
117
124
  } catch (e) {
118
125
  console.error("Failed to initialize Stripo editor:", e);
119
126
  }
120
127
  };
121
- return X(async () => {
128
+ return re(async () => {
122
129
  var e;
123
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), ae().$reset(), O().$reset(), Se().$reset(), y();
124
- const t = (e = l.value) == null ? void 0 : e.parentElement;
125
- if (t && (i = new ResizeObserver(y), i.observe(t)), C(), a.ready)
126
- await v();
130
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), G().$reset(), H().$reset(), ke().$reset(), S();
131
+ const t = (e = p.value) == null ? void 0 : e.parentElement;
132
+ if (t && (i = new ResizeObserver(S), i.observe(t)), k(), a.ready)
133
+ await b();
127
134
  else {
128
- const s = _(() => a.ready, (d) => {
129
- d && (s(), v());
135
+ const s = P(() => a.ready, (d) => {
136
+ d && (s(), b());
130
137
  });
131
138
  }
132
- document.addEventListener("dynamic-content:open", f);
133
- }), Y(() => {
134
- i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", f);
135
- try {
136
- window.UIEditor.removeEditor();
137
- } catch {
138
- console.debug("Failed to remove Stripo editor: No editor found");
139
- }
140
- o.reset();
141
- }), x({
139
+ document.addEventListener("dynamic-content:open", v);
140
+ }), se(() => {
141
+ i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), T(async () => {
142
+ if (I(g))
143
+ try {
144
+ window.UIEditor.removeEditor();
145
+ } catch {
146
+ console.debug("Failed to remove Stripo editor: No editor found");
147
+ }
148
+ }), o.reset();
149
+ }), q({
142
150
  dynamicContent: {
143
- insert: I,
144
- close: R
151
+ insert: B,
152
+ close: A
145
153
  },
146
154
  hasChanges: m,
147
- saveSilent: E,
148
- setLoading: w
149
- }), { __sfc: !0, PreviewContainer: G, OnboardingWrapper: H, AssignStrategyDrawer: $, headerWrapperRef: b, wrapperRef: l, dynamicContentStore: u, unsubscribeStore: h, props: a, configStore: o, editorStore: c, previewStore: z, hasChanges: m, isTestPartner: q, saveSilent: E, setLoading: w, emit: r, buildMetadata: p, initPlugin: D, preloadRuntime: C, getDefaultTemplate: k, cloneTimersOnSave: T, hasTimerBlocks: F, noHeader: K, isRrsEnabled: V, insertDynamicContent: I, closeDynamicContent: R, handleDynamicContentOpen: f, ribbonObserver: i, updateRibbonOffset: y, startEditor: v, AutoSaveController: ie, Toaster: ce, FilterSelectionDrawer: de, HeaderWrapper: me, LoadingWrapper: le, SaveAsTemplateDrawer: ue, UnsubscribeWrapper: pe };
155
+ saveSilent: w,
156
+ setLoading: C
157
+ }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, headerWrapperRef: h, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: E, props: a, configStore: o, editorStore: c, previewStore: Q, hasChanges: m, isTestPartner: X, saveSilent: w, setLoading: C, emit: r, buildMetadata: y, initPlugin: D, preloadRuntime: k, runExclusive: T, beginMount: F, isCurrentMount: I, mountGeneration: g, getDefaultTemplate: M, cloneTimersOnSave: R, hasTimerBlocks: L, noHeader: Y, isRrsEnabled: Z, hasAssignedStrategy: ee, insertDynamicContent: B, closeDynamicContent: A, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: b, AutoSaveController: fe, Toaster: ye, FilterSelectionDrawer: ge, HeaderWrapper: ve, LoadingWrapper: Se, SaveAsTemplateDrawer: be, UnsubscribeWrapper: he };
150
158
  }
151
159
  });
152
160
  export {
153
- Ke as default
161
+ et as default
154
162
  };
@@ -1,18 +1,21 @@
1
1
  import r from "./AssignStrategyDrawer.vue2.js";
2
2
  /* empty css */
3
+ /* empty css */
3
4
  import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
5
  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: "", "footer-status": !1, strategy: t.selectedStrategy } })], 1) : s._e()], 1) : s._e()]);
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();
7
10
  }, n = [], i = /* @__PURE__ */ a(
8
11
  r,
9
12
  o,
10
13
  n,
11
14
  !1,
12
15
  null,
13
- "c56bb033"
16
+ "2580a7d9"
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,66 +1,106 @@
1
- import { defineComponent as f, defineAsyncComponent as S, ref as l, computed as o, watch as _ } 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
- import v from "../../../wrappers/WpDrawer.vue.js";
4
- import { useToaster as w } from "../../../../composables/useToaster.js";
5
- import { useTranslations as D } from "../../../../composables/useTranslations.js";
6
- import { URLS as T } from "../../../../enums/extensions/recommendationBlock.js";
7
- import { ToasterTypeOptions as g } from "../../../../enums/toaster.js";
8
- import { useRecommendationExtensionStore as A } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { buildStrategyInfoBoxProps as E } from "../../../../utils/strategyInfoBox.js";
10
- import { InSelect as O } from "@useinsider/design-system-vue";
11
- const U = /* @__PURE__ */ f({
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({
12
15
  __name: "AssignStrategyDrawer",
13
- setup(x) {
14
- const u = S(
15
- async () => (await import("@useinsider/design-system-organisms")).OrgStrategyDetailModal
16
- ), r = D(), e = A(), { showToaster: n } = w(), s = l(null), a = l(!1), m = o(() => e.assignStrategyDrawerStatus ? r("email-editor.assign-strategy-description", { url: T.RECOMMENDATION_STRATEGIES_PANEL_PATH }) : "");
17
- _(() => e.assignStrategyDrawerStatus, (t) => {
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({
20
+ loader: async () => (await c()).OrgStrategyDetailModal,
21
+ loadingComponent: g(480, 240),
22
+ delay: 0
23
+ }), T = y({
24
+ loader: async () => (await c()).OrgStrategyDropdown,
25
+ loadingComponent: g(240, 42),
26
+ 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) => {
18
29
  if (!t)
19
30
  return;
20
- const { strategyId: i } = e.recommendationConfigs;
21
- s.value = i || null, a.value = !1, e.fetchStrategies().catch(() => {
22
- n({
23
- type: g.Error,
24
- message: r("discovery-strategy.error-description")
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")
25
36
  });
26
37
  });
27
38
  });
28
- const p = o(() => e.strategies.map((t) => ({
39
+ const p = (t) => {
40
+ const r = f(t.updated_at || t.created_at);
41
+ if (!r)
42
+ return "";
43
+ const a = I(r, E);
44
+ return o("recommendation-strategy.last-updated-on", { value: a });
45
+ }, D = l(() => e.strategies.map((t) => ({
29
46
  text: t.name,
30
47
  value: t.strategy_id,
31
- infoBoxProps: E(t, r)
32
- }))), y = o(() => [{ value: s.value }]), c = o(() => {
33
- const t = e.strategies.find((i) => String(i.strategy_id) === String(s.value ?? ""));
48
+ infoBoxProps: {
49
+ id: `strategy-info-${t.strategy_id}`,
50
+ theme: "light",
51
+ variant: "information",
52
+ className: "assign-strategy-info-box",
53
+ titleText: N(f(t.name)),
54
+ descriptionStatus: !0,
55
+ descriptionText: p(t),
56
+ slot: B,
57
+ slotProps: { strategy: t }
58
+ }
59
+ }))), d = l(() => {
60
+ const t = e.strategies.find((r) => String(r.strategy_id) === String(n.value ?? ""));
34
61
  return t ? { ...t, fallback_config: null } : null;
35
- }), d = o(() => ({
62
+ }), w = l(() => ({
36
63
  primaryButton: {
37
64
  styling: "solid",
38
65
  type: "primary",
39
- labelText: r("products.assign-btn")
66
+ labelText: o("products.assign-btn")
40
67
  },
41
68
  cancelOrBackButton: {
42
69
  styling: "ghost",
43
70
  type: "secondary",
44
- labelText: r("products.cancel")
71
+ labelText: o("products.cancel")
45
72
  }
46
73
  }));
47
- return { __sfc: !0, OrgStrategyDetailModal: u, trans: r, store: e, showToaster: n, selectedStrategyId: s, showSelectionError: a, drawerDescription: m, strategyOptions: p, selectValue: y, selectedStrategy: c, footerButtonGroupOptions: d, 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: () => {
48
75
  e.closeAssignStrategyDrawer();
49
- }, assignStrategy: () => {
50
- const t = c.value;
76
+ }, assignStrategy: async () => {
77
+ const t = d.value;
51
78
  if (!t) {
52
- a.value = !0;
79
+ i.value = !0;
80
+ return;
81
+ }
82
+ let r = "";
83
+ try {
84
+ r = await e.resolveStrategyUrlTemplate(t, e.recommendationConfigs.currencySettings.value);
85
+ } catch (a) {
86
+ console.error("[AssignStrategyDrawer] resolveStrategyUrlTemplate failed", a);
87
+ }
88
+ if (!r) {
89
+ s({
90
+ type: m.Error,
91
+ message: o("email-editor.strategy-assign-failed", { strategyName: t.name })
92
+ });
53
93
  return;
54
94
  }
55
- e.assignStrategy(t), n({
56
- type: g.Success,
57
- message: r("email-editor.strategy-assigned-success", { strategyName: t.name })
95
+ e.assignStrategy(t), s({
96
+ type: m.Success,
97
+ message: o("email-editor.strategy-assigned-success", { strategyName: t.name })
58
98
  }), e.closeAssignStrategyDrawer();
59
99
  }, onSelect: (t) => {
60
- s.value = t.value, a.value = !1;
61
- }, WpDrawer: v, InSelect: O };
100
+ n.value = t.value, i.value = !1;
101
+ } };
62
102
  }
63
103
  });
64
104
  export {
65
- U as default
105
+ W as default
66
106
  };
@@ -0,0 +1,17 @@
1
+ import s from "./RemoveStrategyModal.vue2.js";
2
+ import r 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: "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.messageParts[0])), o("b", [t._v(t._s(e.strategyName))]), t._v(t._s(e.messageParts[1]))])]) : t._e();
6
+ }, n = [], _ = /* @__PURE__ */ r(
7
+ s,
8
+ a,
9
+ n,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const c = _.exports;
15
+ export {
16
+ c as default
17
+ };
@@ -0,0 +1,57 @@
1
+ import { defineComponent as u, computed as n } from "vue";
2
+ import y from "../../../wrappers/WpModal.vue.js";
3
+ import { useToaster as f } from "../../../../composables/useToaster.js";
4
+ import { useTranslations as _ } from "../../../../composables/useTranslations.js";
5
+ import { ToasterTypeOptions as v } from "../../../../enums/toaster.js";
6
+ import { useRecommendationExtensionStore as T } from "../../../../extensions/Blocks/Recommendation/store/recommendation.js";
7
+ import { commitBlockChangeOutsidePanel as h } from "../../../../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
8
+ import { escapeHtml as R } from "../../../../utils/htmlEscape.js";
9
+ const P = /* @__PURE__ */ u({
10
+ __name: "RemoveStrategyModal",
11
+ setup(S) {
12
+ const t = _(), e = T(), { showToaster: a } = f(), i = n(() => ({
13
+ cancelOrBackButton: {
14
+ type: "secondary",
15
+ labelText: t("products.cancel"),
16
+ styling: "ghost"
17
+ },
18
+ primaryButton: {
19
+ type: "danger",
20
+ labelText: t("discovery-strategy.remove")
21
+ }
22
+ })), m = n(() => {
23
+ var o;
24
+ const { strategyId: r } = e.recommendationConfigs;
25
+ return ((o = e.assignedStrategy) == null ? void 0 : o.name) || `#${r}`;
26
+ }), s = "__STRATEGY_NAME__", d = n(() => t("email-editor.remove-strategy-confirm-message", { strategyName: s }).split(s)), c = () => {
27
+ e.closeRemoveStrategyModal();
28
+ };
29
+ return { __sfc: !0, trans: t, store: e, showToaster: a, footerButtonOptions: i, strategyName: m, NAME_TOKEN: s, messageParts: d, close: c, handleConfirm: async () => {
30
+ const r = m.value, o = e.currentRecommendationId;
31
+ e.removeStrategy(), c();
32
+ const { strategyId: l, size: g } = e.recommendationConfigs;
33
+ if (a({
34
+ type: v.Success,
35
+ // The toast renders through a sanitizing v-html, so the name is escaped first.
36
+ message: t("email-editor.strategy-removed-success", {
37
+ strategyName: `<b>${R(r)}</b>`
38
+ })
39
+ }), o !== null) {
40
+ try {
41
+ await e.fetchRecommendationProducts();
42
+ } catch (p) {
43
+ console.error("[RemoveStrategyModal] product refetch failed", p);
44
+ }
45
+ h(
46
+ o,
47
+ { strategyId: l, size: g },
48
+ e.recommendationProducts,
49
+ "Removed recommendation strategy"
50
+ );
51
+ }
52
+ }, WpModal: y };
53
+ }
54
+ });
55
+ export {
56
+ P as default
57
+ };
@@ -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
+ };