@useinsider/guido 3.19.0-beta.d04f200 → 3.19.0-beta.e110e88

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 (43) hide show
  1. package/dist/@types/config/schemas.js +91 -104
  2. package/dist/components/Guido.vue.js +8 -8
  3. package/dist/components/Guido.vue2.js +74 -79
  4. package/dist/components/wrappers/WpModal.vue.js +1 -1
  5. package/dist/components/wrappers/WpModal.vue2.js +3 -4
  6. package/dist/composables/useHttp.js +54 -64
  7. package/dist/composables/useLegacyStrategyConversion.js +19 -23
  8. package/dist/composables/useStripo.js +20 -24
  9. package/dist/composables/useToaster.js +15 -17
  10. package/dist/composables/validators/useLiquidValidator.js +15 -15
  11. package/dist/config/migrator/index.js +13 -14
  12. package/dist/enums/extensions/recommendationBlock.js +29 -30
  13. package/dist/extensions/Blocks/Recommendation/block.js +22 -21
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -97
  15. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +49 -72
  16. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +91 -67
  18. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -21
  19. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +55 -16
  20. package/dist/guido.css +1 -1
  21. package/dist/src/@types/config/schemas.d.ts +0 -16
  22. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -5
  23. package/dist/src/composables/useConfig.d.ts +0 -2
  24. package/dist/src/composables/useHttp.d.ts +0 -2
  25. package/dist/src/config/migrator/index.d.ts +1 -2
  26. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  27. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  28. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +13 -2
  29. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
  30. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
  31. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  32. package/dist/src/stores/config.d.ts +0 -20
  33. package/dist/static/styles/components/recommendation-strategy.css.js +0 -9
  34. package/package.json +1 -1
  35. package/dist/components/organisms/base/AuthErrorModal.vue.js +0 -18
  36. package/dist/components/organisms/base/AuthErrorModal.vue2.js +0 -42
  37. package/dist/composables/useAuthError.js +0 -52
  38. package/dist/config/migrator/recommendationPartnerMigrator.js +0 -50
  39. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +0 -25
  40. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +0 -2
  41. package/dist/src/composables/useAuthError.d.ts +0 -12
  42. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +0 -19
  43. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +0 -33
@@ -1,58 +1,57 @@
1
- import { defineComponent as ae, defineAsyncComponent as m, ref as x, computed as u, watch as W, onMounted as se, onUnmounted as ie } from "vue";
2
- import { useCortexBlueprintBridge as ce } from "../composables/useCortexBlueprintBridge.js";
3
- import { useEditorLock as de } from "../composables/useEditorLock.js";
4
- import { provideGuidoActions as me } from "../composables/useGuidoActions.js";
5
- import { useGuidoStateBridge as le } from "../composables/useGuidoStateBridge.js";
6
- import { usePartner as ue } from "../composables/usePartner.js";
7
- import { useStripo as pe } from "../composables/useStripo.js";
8
- import { useTimerClone as fe } from "../composables/useTimerClone.js";
9
- import { migrate as G } from "../config/migrator/index.js";
10
- import { ModuleFolderDefaults as H } from "../enums/defaults.js";
11
- import { RIBBON_SELECTOR as ye } from "../enums/onboarding.js";
1
+ import { defineComponent as re, defineAsyncComponent as m, ref as O, computed as u, watch as x, onMounted as se, onUnmounted as ae } from "vue";
2
+ import { useCortexBlueprintBridge as ie } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as ce } from "../composables/useEditorLock.js";
4
+ import { provideGuidoActions as de } from "../composables/useGuidoActions.js";
5
+ import { useGuidoStateBridge as me } from "../composables/useGuidoStateBridge.js";
6
+ import { usePartner as le } from "../composables/usePartner.js";
7
+ import { useStripo as ue } from "../composables/useStripo.js";
8
+ import { useTimerClone as pe } from "../composables/useTimerClone.js";
9
+ import { migrate as W } from "../config/migrator/index.js";
10
+ import { ModuleFolderDefaults as G } from "../enums/defaults.js";
11
+ import { RIBBON_SELECTOR as fe } from "../enums/onboarding.js";
12
12
  import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
13
- import ge from "./organisms/AutoSaveController.vue.js";
14
- import Se from "./organisms/base/AuthErrorModal.vue.js";
15
- import ve from "./organisms/base/Toaster.vue.js";
16
- import be from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
17
- import he from "./organisms/header/HeaderWrapper.vue.js";
18
- import Ee from "./organisms/LoadingWrapper.vue.js";
19
- import we from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
20
- import Ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
21
- import { useStripoApi as De } from "../services/stripoApi.js";
22
- import { useConfigStore as ke } from "../stores/config.js";
23
- import { useDynamicContentStore as Fe } from "../stores/dynamic-content.js";
24
- import { useEditorStore as $ } from "../stores/editor.js";
25
- import { usePreviewStore as Me } from "../stores/preview.js";
26
- import { useTemplateStore as Re } from "../stores/template.js";
27
- import { useUnsubscribeStore as Te } from "../stores/unsubscribe.js";
28
- import { readTrackFloor as z } from "../utils/linkTrackingIds.js";
29
- const rt = /* @__PURE__ */ ae({
13
+ import ye from "./organisms/AutoSaveController.vue.js";
14
+ import ge from "./organisms/base/Toaster.vue.js";
15
+ import ve from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
16
+ import Se from "./organisms/header/HeaderWrapper.vue.js";
17
+ import be from "./organisms/LoadingWrapper.vue.js";
18
+ import he from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
19
+ import Ee from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
20
+ import { useStripoApi as we } from "../services/stripoApi.js";
21
+ import { useConfigStore as Ce } from "../stores/config.js";
22
+ import { useDynamicContentStore as De } from "../stores/dynamic-content.js";
23
+ import { useEditorStore as H } from "../stores/editor.js";
24
+ import { usePreviewStore as ke } from "../stores/preview.js";
25
+ import { useTemplateStore as Te } from "../stores/template.js";
26
+ import { useUnsubscribeStore as Fe } from "../stores/unsubscribe.js";
27
+ import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
28
+ const tt = /* @__PURE__ */ re({
30
29
  __name: "Guido",
31
30
  props: {
32
31
  config: null,
33
32
  ready: { type: Boolean, default: !0 }
34
33
  },
35
34
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
36
- setup(q, { expose: K, emit: r }) {
37
- const s = q, V = m(
35
+ setup(z, { expose: q, emit: r }) {
36
+ const a = z, K = m(
38
37
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
39
- ), j = m(
38
+ ), V = m(
40
39
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
41
- ), J = m(
40
+ ), j = m(
42
41
  () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
43
- ), Q = m(
42
+ ), J = m(
44
43
  () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
45
- ), X = m(
44
+ ), Q = m(
46
45
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
47
- ), E = x(), p = x(), f = Fe(), w = Te(), o = ke();
48
- s.ready && o.init(s.config);
49
- const c = $(), Y = Me(), l = u(() => c.hasChanges), { isTestPartner: Z } = ue(), C = () => {
46
+ ), E = O(), p = O(), f = De(), w = Fe(), o = Ce();
47
+ a.ready && o.init(a.config);
48
+ const c = H(), X = ke(), l = u(() => c.hasChanges), { isTestPartner: Y } = le(), C = () => {
50
49
  var t;
51
50
  return (t = E.value) == null ? void 0 : t.handleSave(!0);
52
51
  }, D = (t) => {
53
52
  c.loadingStatus = t;
54
53
  };
55
- ce(), le();
54
+ ie(), me();
56
55
  const y = () => {
57
56
  var t, e;
58
57
  return {
@@ -60,18 +59,18 @@ const rt = /* @__PURE__ */ ae({
60
59
  userId: o.userId,
61
60
  username: o.username,
62
61
  partnerName: o.partnerName,
63
- savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || H.SAVED_MODULES,
64
- defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || H.DEFAULT_MODULES
62
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
63
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
65
64
  };
66
- }, { initPlugin: k, preloadRuntime: F } = pe(), { runExclusive: M, beginMount: R, isCurrentMount: T } = de();
65
+ }, { initPlugin: k, preloadRuntime: T } = ue(), { runExclusive: F, beginMount: M, isCurrentMount: R } = ce();
67
66
  let g = 0;
68
- const { getDefaultTemplate: I } = De(), { cloneTimersOnSave: L, hasTimerBlocks: U } = fe(), ee = u(() => {
67
+ const { getDefaultTemplate: I } = we(), { cloneTimersOnSave: L, hasTimerBlocks: B } = pe(), Z = u(() => {
69
68
  var t;
70
69
  return !((t = o.ui) != null && t.showHeader);
71
- }), te = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), oe = u(
70
+ }), ee = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), te = u(
72
71
  () => !!h().recommendationConfigs.strategyId
73
72
  );
74
- me({
73
+ de({
75
74
  onBack: () => {
76
75
  console.debug("guido:back"), r("back");
77
76
  },
@@ -86,84 +85,80 @@ const rt = /* @__PURE__ */ ae({
86
85
  console.debug("guido:test-email:click"), r("test-email:click");
87
86
  }
88
87
  });
89
- const A = (t) => {
88
+ const U = (t) => {
90
89
  console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
91
- }, B = () => {
90
+ }, A = () => {
92
91
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
93
92
  };
94
- W(() => l.value, () => {
93
+ x(() => l.value, () => {
95
94
  r("on-change", l.value);
96
95
  });
97
- const S = (t) => {
98
- const e = t, { attribute: a, position: d } = e.detail;
99
- console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", a, d);
96
+ const v = (t) => {
97
+ const e = t, { attribute: s, position: d } = e.detail;
98
+ console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
100
99
  };
101
100
  let i = null;
102
- const v = () => {
101
+ const S = () => {
103
102
  var e;
104
- const t = document.querySelector(ye);
103
+ const t = document.querySelector(fe);
105
104
  (e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
106
105
  }, b = async () => {
107
106
  var t;
108
107
  try {
109
- o.initialized || o.init(s.config), c.templateId = o.templateId;
110
- const e = o.template, a = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", N = (e == null ? void 0 : e.preselectedDynamicContent) || [];
108
+ o.initialized || o.init(a.config), c.templateId = o.templateId;
109
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
111
110
  w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
112
- const P = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, _ = o.isFeatureEnabled("linkTrackingIds"), O = {
113
- partnerName: o.partnerName,
114
- campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
115
- rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
116
- };
111
+ const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, N = o.isFeatureEnabled("linkTrackingIds");
117
112
  let n = {
118
- html: a && await G(a, P, O),
113
+ html: s && await W(s, _),
119
114
  css: d
120
115
  };
121
- n.html || (n = await I(), n.html = await G(n.html, P, O));
122
- const ne = _ ? z(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
123
- U(n.html) && (n.html = await L(n.html)), _ && (c.trackIdSessionFloor = Math.max(ne, z(n.html)));
124
- const re = {
125
- preselectedDynamicContentList: N,
116
+ n.html || (n = await I(), n.html = await W(n.html, _));
117
+ const oe = N ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
118
+ B(n.html) && (n.html = await L(n.html)), N && (c.trackIdSessionFloor = Math.max(oe, $(n.html)));
119
+ const ne = {
120
+ preselectedDynamicContentList: P,
126
121
  onReady: () => {
127
122
  console.debug("guido:ready"), r("ready");
128
123
  }
129
124
  };
130
- g = R(), await k(n, y(), re), f.selectedDynamicContentList = N;
125
+ g = M(), await k(n, y(), ne), f.selectedDynamicContentList = P;
131
126
  } catch (e) {
132
127
  console.error("Failed to initialize Stripo editor:", e);
133
128
  }
134
129
  };
135
130
  return se(async () => {
136
131
  var e;
137
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), $().$reset(), Re().$reset(), v();
132
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), H().$reset(), Te().$reset(), S();
138
133
  const t = (e = p.value) == null ? void 0 : e.parentElement;
139
- if (t && (i = new ResizeObserver(v), i.observe(t)), F(), s.ready)
134
+ if (t && (i = new ResizeObserver(S), i.observe(t)), T(), a.ready)
140
135
  await b();
141
136
  else {
142
- const a = W(() => s.ready, (d) => {
143
- d && (a(), b());
137
+ const s = x(() => a.ready, (d) => {
138
+ d && (s(), b());
144
139
  });
145
140
  }
146
- document.addEventListener("dynamic-content:open", S);
147
- }), ie(() => {
148
- i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", S), h().disposeStrategyPageReturn(), M(async () => {
149
- if (T(g))
141
+ document.addEventListener("dynamic-content:open", v);
142
+ }), ae(() => {
143
+ i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), h().disposeStrategyPageReturn(), F(async () => {
144
+ if (R(g))
150
145
  try {
151
146
  window.UIEditor.removeEditor();
152
147
  } catch {
153
148
  console.debug("Failed to remove Stripo editor: No editor found");
154
149
  }
155
150
  }), o.reset();
156
- }), K({
151
+ }), q({
157
152
  dynamicContent: {
158
- insert: A,
159
- close: B
153
+ insert: U,
154
+ close: A
160
155
  },
161
156
  hasChanges: l,
162
157
  saveSilent: C,
163
158
  setLoading: D
164
- }), { __sfc: !0, PreviewContainer: V, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: s, configStore: o, editorStore: c, previewStore: Y, hasChanges: l, isTestPartner: Z, saveSilent: C, setLoading: D, emit: r, buildMetadata: y, initPlugin: k, preloadRuntime: F, runExclusive: M, beginMount: R, isCurrentMount: T, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: U, noHeader: ee, isRrsEnabled: te, hasAssignedStrategy: oe, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: S, ribbonObserver: i, updateRibbonOffset: v, startEditor: b, AutoSaveController: ge, AuthErrorModal: Se, Toaster: ve, FilterSelectionDrawer: be, HeaderWrapper: he, LoadingWrapper: Ee, SaveAsTemplateDrawer: we, UnsubscribeWrapper: Ce };
159
+ }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, LegacyStrategyUpdatedModal: Q, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: a, configStore: o, editorStore: c, previewStore: X, hasChanges: l, isTestPartner: Y, saveSilent: C, setLoading: D, emit: r, buildMetadata: y, initPlugin: k, preloadRuntime: T, runExclusive: F, beginMount: M, isCurrentMount: R, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: B, noHeader: Z, isRrsEnabled: ee, hasAssignedStrategy: te, insertDynamicContent: U, closeDynamicContent: A, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: b, AutoSaveController: ye, Toaster: ge, FilterSelectionDrawer: ve, HeaderWrapper: Se, LoadingWrapper: be, SaveAsTemplateDrawer: he, UnsubscribeWrapper: Ee };
165
160
  }
166
161
  });
167
162
  export {
168
- rt as default
163
+ tt as default
169
164
  };
@@ -2,7 +2,7 @@ import r from "./WpModal.vue2.js";
2
2
  import s from "../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var i = function() {
4
4
  var t = this, o = t._self._c, e = t._self._setupProxy;
5
- return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, state: t.state, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
5
+ return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
6
6
  return e.emit("close");
7
7
  }, onCloseEvent: function(n) {
8
8
  return e.emit("close");
@@ -1,12 +1,11 @@
1
1
  import { defineComponent as e } from "vue";
2
2
  import { InModalV2 as o } from "@useinsider/design-system-vue";
3
- const n = /* @__PURE__ */ e({
3
+ const u = /* @__PURE__ */ e({
4
4
  __name: "WpModal",
5
5
  props: {
6
6
  id: null,
7
7
  title: null,
8
8
  description: { default: "" },
9
- state: { default: "default" },
10
9
  size: { default: "small" },
11
10
  footerButtonOptions: { default: void 0 },
12
11
  closeButtonStatus: { type: Boolean, default: !0 },
@@ -14,10 +13,10 @@ const n = /* @__PURE__ */ e({
14
13
  footerStatus: { type: Boolean, default: !0 }
15
14
  },
16
15
  emits: ["close", "primary-action", "secondary-action"],
17
- setup(a, { emit: t }) {
16
+ setup(l, { emit: t }) {
18
17
  return { __sfc: !0, emit: t, InModalV2: o };
19
18
  }
20
19
  });
21
20
  export {
22
- n as default
21
+ u as default
23
22
  };
@@ -1,98 +1,88 @@
1
- import { getCsrfToken as D } from "../utils/genericUtil.js";
2
- import { ref as T, computed as w } from "vue";
3
- import { isPanelOrigin as j, reportAuthError as X } from "./useAuthError.js";
4
- const k = [401, 403, 419], _ = (g = {}) => {
5
- const f = T(!1), n = T(null), c = T(null), b = w(() => f.value), y = w(() => n.value !== null), E = {
1
+ import { getCsrfToken as O } from "../utils/genericUtil.js";
2
+ import { ref as m, computed as T } from "vue";
3
+ const X = (b = {}) => {
4
+ const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
6
5
  baseURL: "",
7
6
  timeout: 1e4,
8
7
  retry: 0,
9
8
  retryDelay: 1e3,
10
9
  headers: {
11
10
  "Content-Type": "application/json",
12
- "X-CSRF-TOKEN": D(),
11
+ "X-CSRF-TOKEN": O(),
13
12
  Accept: "application/json",
14
- // Without this a guest fetch gets a 302 to the login page, never an auth status.
15
13
  "X-Requested-With": "XMLHttpRequest"
16
14
  },
17
- ...g
18
- }, x = (e, r) => {
15
+ ...b
16
+ }, w = (e, s) => {
19
17
  if (e.startsWith("http://") || e.startsWith("https://"))
20
18
  return e;
21
- const t = r || E.baseURL || "";
19
+ const t = s || v.baseURL || "";
22
20
  return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
23
- }, R = (e) => new Promise((r, t) => {
21
+ }, P = (e) => new Promise((s, t) => {
24
22
  setTimeout(() => {
25
23
  t(new Error("Request timeout"));
26
24
  }, e);
27
- }), P = (e) => new Promise((r) => {
28
- setTimeout(r, e);
29
- }), i = async (e, r, t, W = {}) => {
30
- n.value = null, f.value = !0, c.value = new AbortController();
31
- const a = { ...E, ...W }, p = x(r, a.baseURL), d = {
25
+ }), x = (e) => new Promise((s) => {
26
+ setTimeout(s, e);
27
+ }), i = async (e, s, t, L = {}) => {
28
+ a.value = null, p.value = !0, u.value = new AbortController();
29
+ const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
32
30
  method: e,
33
- headers: { ...a.headers },
34
- signal: c.value.signal,
35
- ...a
31
+ headers: { ...n.headers },
32
+ signal: u.value.signal,
33
+ ...n
36
34
  };
37
- t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete d.headers["Content-Type"], d.body = t) : d.body = JSON.stringify(t));
38
- const v = async (m = 0) => {
39
- if (window.isSessionExpired) {
40
- n.value = { message: "Session expired", authReported: !0 };
41
- const o = new Error("Session expired");
42
- throw o.authReported = !0, o;
43
- }
35
+ t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
36
+ const E = async (h = 0) => {
44
37
  try {
45
- const o = [fetch(p, d)];
46
- a.timeout && o.push(R(a.timeout));
47
- const s = await Promise.race(o);
48
- if (!s.ok) {
49
- const H = `HTTP Error: ${s.status} ${s.statusText}`, l = new Error(H);
50
- throw l.status = s.status, l.statusText = s.statusText, l.response = s, l.authReported = k.includes(s.status) && j(p), l.authReported && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((O) => X(
51
- s.status,
52
- O,
53
- new URL(p, window.location.href).href
54
- )).catch(() => {
55
- }), l;
38
+ const o = [fetch(D, c)];
39
+ n.timeout && o.push(P(n.timeout));
40
+ const r = await Promise.race(o);
41
+ if (!r.ok) {
42
+ const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
43
+ throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
56
44
  }
57
- let h;
58
- const u = s.headers.get("content-type");
59
- return u != null && u.includes("application/json") ? h = await s.json() : u != null && u.includes("text/") ? h = await s.text() : h = await s.blob(), {
60
- data: h,
61
- status: s.status,
62
- statusText: s.statusText,
63
- headers: s.headers
45
+ let f;
46
+ const l = r.headers.get("content-type");
47
+ return l != null && l.includes("application/json") ? f = await r.json() : l != null && l.includes("text/") ? f = await r.text() : f = await r.blob(), {
48
+ data: f,
49
+ status: r.status,
50
+ statusText: r.statusText,
51
+ headers: r.headers
64
52
  };
65
53
  } catch (o) {
66
- const s = o instanceof Error && o.name === "AbortError";
67
- if (m < (a.retry || 0) && !s)
68
- return await P(a.retryDelay || 1e3), v(m + 1);
69
- throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
54
+ const r = o instanceof Error && o.name === "AbortError";
55
+ if (h < (n.retry || 0) && !r)
56
+ return await x(n.retryDelay || 1e3), E(h + 1);
57
+ throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
70
58
  }
71
59
  };
72
60
  try {
73
- return await v();
61
+ return await E();
74
62
  } finally {
75
- f.value = !1, c.value = null;
63
+ p.value = !1, u.value = null;
76
64
  }
77
- }, A = (e, r) => i("GET", e, void 0, r), S = (e, r, t) => i("POST", e, r, t), U = (e, r, t) => i("PUT", e, r, t), C = (e, r, t) => i("PATCH", e, r, t), $ = (e, r) => i("DELETE", e, void 0, r), q = (e) => {
78
- c.value && c.value.abort(e);
79
- }, L = () => {
80
- n.value = null;
65
+ }, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
66
+ u.value && u.value.abort(e);
67
+ }, W = () => {
68
+ a.value = null;
81
69
  };
82
70
  return {
83
- loading: b,
84
- error: w(() => n.value),
71
+ // State
72
+ loading: g,
73
+ error: T(() => a.value),
85
74
  hasError: y,
75
+ // Methods
86
76
  request: i,
87
- get: A,
88
- post: S,
89
- put: U,
90
- patch: C,
91
- delete: $,
92
- cancel: q,
93
- clearError: L
77
+ get: C,
78
+ post: R,
79
+ put: $,
80
+ patch: q,
81
+ delete: A,
82
+ cancel: U,
83
+ clearError: W
94
84
  };
95
85
  };
96
86
  export {
97
- _ as useHttp
87
+ X as useHttp
98
88
  };
@@ -1,23 +1,23 @@
1
- import { useRecommendation as C } from "./useRecommendation.js";
2
- import { useToaster as I } from "./useToaster.js";
1
+ import { useRecommendation as I } from "./useRecommendation.js";
2
+ import { useToaster as C } from "./useToaster.js";
3
3
  import { useTranslations as v } from "./useTranslations.js";
4
4
  import { ToasterTypeOptions as g } from "../enums/toaster.js";
5
5
  import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
6
  import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
7
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
- import { resolveMigrationTarget as k, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
- import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
- import { useConfigStore as h } from "../stores/config.js";
8
+ import { resolveMigrationTarget as R, buildLegacyMigrationPayload as T } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
+ import { commitBlockChangeOutsidePanel as h } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
+ import { useConfigStore as k } from "../stores/config.js";
11
11
  const F = () => {
12
- const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = v();
12
+ const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
13
13
  return { convertLegacyStrategy: async () => {
14
14
  const t = e.currentRecommendationId;
15
15
  if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
16
16
  return "";
17
- const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
17
+ const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = R({
18
18
  campaignId: r.campaignId,
19
19
  templateLibraryId: r.templateLibraryId
20
- }), S = R({
20
+ }), S = T({
21
21
  blockId: t,
22
22
  url: m(String(t)),
23
23
  campaignId: r.campaignId,
@@ -29,34 +29,30 @@ const F = () => {
29
29
  let o;
30
30
  try {
31
31
  o = await e.convertLegacyStrategy(S, s);
32
- } catch (i) {
33
- return console.error("[useLegacyStrategyConversion] migration failed", i), c({
32
+ } catch (n) {
33
+ return console.error("[useLegacyStrategyConversion] migration failed", n), i({
34
34
  type: g.Error,
35
- message: a("email-editor.legacy-strategy-migration-failed"),
36
- actionButton: {
37
- text: a("ds-steps.create-recommendation-strategy"),
38
- onClick: () => e.openStrategyCreation()
39
- }
35
+ message: c("email-editor.legacy-strategy-update-failed")
40
36
  }), "";
41
37
  }
42
38
  try {
43
39
  await e.fetchStrategyProductsForBlock(t);
44
- } catch (i) {
45
- console.error("[useLegacyStrategyConversion] product refetch failed", i);
40
+ } catch (n) {
41
+ console.error("[useLegacyStrategyConversion] product refetch failed", n);
46
42
  }
47
- const n = e.blockStates[t];
48
- return n ? T(
43
+ const a = e.blockStates[t];
44
+ return a ? h(
49
45
  t,
50
46
  {
51
47
  strategyId: o,
52
- size: n.recommendationConfigs.size,
48
+ size: a.recommendationConfigs.size,
53
49
  configVersion: L
54
50
  },
55
- n.recommendationProducts,
51
+ a.recommendationProducts,
56
52
  "Converted legacy recommendation strategy"
57
- ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
53
+ ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
58
54
  type: g.Error,
59
- message: a("email-editor.legacy-strategy-update-failed")
55
+ message: c("email-editor.legacy-strategy-update-failed")
60
56
  }), "") : o;
61
57
  } };
62
58
  };
@@ -17,21 +17,21 @@ import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../ut
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
19
  const he = () => {
20
- const { features: c, template: u, isFeatureEnabled: p } = H(), { handleError: m, showToaster: v } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = O(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((r, s) => {
20
+ const { features: c, template: u, isFeatureEnabled: m } = H(), { handleError: p, showToaster: B } = G(), { getToken: M, getCustomFonts: T, getSyncModulesStatus: v } = K(), { handleEvent: F } = z(), { handleModuleAdd: A } = j(), { getStripoBlocksConfig: V } = O(), { getStripoNotifications: _ } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
- r();
23
+ i();
24
24
  return;
25
25
  }
26
- const o = Z.guido, i = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
27
- e.id = "UiEditorScript", e.type = "module", e.src = i, e.onload = () => r(), e.onerror = () => {
28
- e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${i}`));
26
+ const o = Z.guido, r = `https://email-static.useinsider.com/guido/${(d = o == null ? void 0 : o.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
27
+ e.id = "UiEditorScript", e.type = "module", e.src = r, e.onload = () => i(), e.onerror = () => {
28
+ e.remove(), s(new Error(`Failed to load Stripo UIEditor script from S3: ${r}`));
29
29
  }, document.body.appendChild(e);
30
30
  }), n.catch(() => {
31
31
  n = null;
32
- }), n), D = async (r, s, o, a = [], i = !1) => {
32
+ }), n), D = async (i, s, o, a = [], r = !1) => {
33
33
  var y, E, h, C;
34
- const e = k(), { html: d, css: R } = r, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
34
+ const e = k(), { html: d, css: R } = i, { baseBlocks: g, extensions: P } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
35
  w().importCss(), await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
@@ -45,7 +45,7 @@ const he = () => {
45
45
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
46
46
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
47
47
  codeEditorButtonSelector: "#guido__code-button",
48
- customAppearanceMergetags: !p("liquidSyntax"),
48
+ customAppearanceMergetags: !m("liquidSyntax"),
49
49
  customAppearanceMergetagsBorderColor: "#f1f3fe",
50
50
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
51
51
  customViewStyles: Q,
@@ -53,7 +53,7 @@ const he = () => {
53
53
  customConditionsEnabled: S,
54
54
  enableXSSSecurity: !0,
55
55
  modulesDisabled: U,
56
- syncModulesEnabled: i,
56
+ syncModulesEnabled: r,
57
57
  messageSettingsEnabled: !0,
58
58
  displayGmailAnnotations: !0,
59
59
  displayHiddenPreheader: !1,
@@ -74,16 +74,16 @@ const he = () => {
74
74
  entries: W(
75
75
  o.preselectedDynamicContentList,
76
76
  Y((C = u.value) == null ? void 0 : C.dynamicContentList),
77
- p("liquidSyntax")
77
+ m("liquidSyntax")
78
78
  )
79
79
  }
80
80
  ],
81
81
  async onTokenRefreshRequest(t) {
82
82
  try {
83
- const l = await B();
83
+ const l = await M();
84
84
  t(l);
85
85
  } catch (l) {
86
- m(l, "Failed to refresh token");
86
+ p(l, "Failed to refresh token");
87
87
  }
88
88
  },
89
89
  onTemplateLoaded() {
@@ -93,7 +93,7 @@ const he = () => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
96
- m(t, "Failed to load custom interface appearance");
96
+ p(t, "Failed to load custom interface appearance");
97
97
  }
98
98
  },
99
99
  onCodeEditorVisibilityChanged(t) {
@@ -111,31 +111,27 @@ const he = () => {
111
111
  onEvent: F,
112
112
  onModuleAdd: A,
113
113
  notifications: _(),
114
- // Stripo deselects the block on any click outside the canvas, so every surface
115
- // that belongs to the block's own flow has to be listed here (SD-153273).
116
114
  ignoreClickOutsideSelectors: [
117
115
  "#guido-dynamic-content-modal",
118
116
  ".in-on-board-wrapper",
119
- ".in-drawer__container",
120
- ".in-modal-v2-wrapper",
121
- ".in-toasts-wrapper"
117
+ ".in-drawer__container"
122
118
  ],
123
119
  extensions: P,
124
120
  localePatch: J
125
121
  }
126
122
  );
127
123
  };
128
- return { initPlugin: async (r, s, o) => {
124
+ return { initPlugin: async (i, s, o) => {
129
125
  const a = k();
130
126
  try {
131
127
  await f();
132
- const [i, e] = await Promise.all([
133
- M(),
134
- T()
128
+ const [r, e] = await Promise.all([
129
+ T(),
130
+ v()
135
131
  ]);
136
- a.syncModulesEnabled = e, await D(r, s, o, i, e);
132
+ a.syncModulesEnabled = e, await D(i, s, o, r, e);
137
133
  } catch {
138
- a.loadingStatus = !1, v({
134
+ a.loadingStatus = !1, B({
139
135
  type: X.Error,
140
136
  message: b["An error has occurred. Please report the error code to support."],
141
137
  actionButton: {