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

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 (45) hide show
  1. package/dist/@types/config/schemas.js +104 -91
  2. package/dist/components/Guido.vue.js +8 -8
  3. package/dist/components/Guido.vue2.js +79 -74
  4. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  5. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  6. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  7. package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
  8. package/dist/components/wrappers/WpModal.vue.js +1 -1
  9. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  10. package/dist/composables/useActionsApi.js +52 -47
  11. package/dist/composables/useAuthError.js +52 -0
  12. package/dist/composables/useCodeEditorApi.js +23 -9
  13. package/dist/composables/useHttp.js +48 -49
  14. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  15. package/dist/composables/useStripo.js +24 -20
  16. package/dist/composables/useToaster.js +17 -15
  17. package/dist/composables/useTranslations.js +3 -2
  18. package/dist/composables/useVersionHistoryApi.js +33 -24
  19. package/dist/composables/validators/useLiquidValidator.js +15 -15
  20. package/dist/config/migrator/index.js +14 -13
  21. package/dist/config/migrator/recommendationPartnerMigrator.js +50 -0
  22. package/dist/enums/extensions/recommendationBlock.js +30 -29
  23. package/dist/extensions/Blocks/Recommendation/block.js +15 -14
  24. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
  25. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -29
  27. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  28. package/dist/guido.css +1 -1
  29. package/dist/src/@types/config/schemas.d.ts +16 -0
  30. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  31. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  32. package/dist/src/composables/useAuthError.d.ts +12 -0
  33. package/dist/src/composables/useConfig.d.ts +2 -0
  34. package/dist/src/composables/useHttp.d.ts +2 -0
  35. package/dist/src/config/migrator/index.d.ts +2 -1
  36. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  37. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  38. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  39. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  40. package/dist/src/stores/config.d.ts +20 -0
  41. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  42. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  43. package/dist/stores/unsubscribe.js +3 -3
  44. package/dist/utils/stripoEditorApi.js +11 -0
  45. package/package.json +2 -1
@@ -0,0 +1,52 @@
1
+ import { ToasterTypeOptions as l } from "../enums/toaster.js";
2
+ import { ref as p } from "vue";
3
+ import { useToaster as u } from "./useToaster.js";
4
+ import { useTranslations as f } from "./useTranslations.js";
5
+ const d = ["accessExpired", "domainRestricted", "ipRestricted", "insiderAccessRestricted"], n = p(null), a = (e) => {
6
+ try {
7
+ return new URL(e, window.location.href).origin === window.location.origin;
8
+ } catch {
9
+ return !0;
10
+ }
11
+ }, g = (e) => {
12
+ try {
13
+ const o = new URL(e, window.location.href);
14
+ return o.origin === window.location.origin ? o.href : "";
15
+ } catch {
16
+ return "";
17
+ }
18
+ }, w = (e) => {
19
+ try {
20
+ const o = JSON.parse(e);
21
+ return o && typeof o == "object" && Object.keys(o).length ? o : null;
22
+ } catch {
23
+ return null;
24
+ }
25
+ }, y = (e) => typeof (e == null ? void 0 : e.message) == "string" ? e.message : "", s = (e) => y(e) || f()("user-management.collaborate-forbidden-action"), c = (e) => {
26
+ u().showToaster({ type: l.Error, message: e });
27
+ }, R = (e, o, t) => {
28
+ if (t && !a(t))
29
+ return;
30
+ const r = w(o);
31
+ if (e === 403) {
32
+ c(s(r));
33
+ return;
34
+ }
35
+ if (e === 401 && (r == null ? void 0 : r.type) === "groupLevelAccess") {
36
+ c(s(r));
37
+ return;
38
+ }
39
+ if (e === 401 && typeof (r == null ? void 0 : r.type) == "string" && d.includes(r.type)) {
40
+ const i = typeof r.redirect == "string" ? g(r.redirect) : "";
41
+ if (i) {
42
+ window.location.replace(i);
43
+ return;
44
+ }
45
+ }
46
+ e !== 401 && e !== 419 || n.value || (window.isSessionExpired = !0, n.value = { status: e, data: r });
47
+ }, T = () => ({ authError: n });
48
+ export {
49
+ a as isPanelOrigin,
50
+ R as reportAuthError,
51
+ T as useAuthError
52
+ };
@@ -1,11 +1,25 @@
1
- const i = () => ({
2
- openCodeEditor: () => {
3
- window.StripoEditorApi.codeEditorApi.openCodeEditor();
4
- },
5
- closeCodeEditor: () => {
6
- window.StripoEditorApi.codeEditorApi.closeCodeEditor();
7
- }
8
- });
1
+ import { ToasterTypeOptions as d } from "../enums/toaster.js";
2
+ import { findEditorApi as s, EDITOR_NOT_READY_MESSAGE as p } from "../utils/stripoEditorApi.js";
3
+ import { useToaster as E } from "./useToaster.js";
4
+ const T = () => {
5
+ const { showToaster: i } = E(), t = (o) => {
6
+ var r;
7
+ const e = (r = s()) == null ? void 0 : r.codeEditorApi;
8
+ if (!e) {
9
+ i({ type: d.Error, message: p });
10
+ return;
11
+ }
12
+ o(e);
13
+ };
14
+ return {
15
+ openCodeEditor: () => {
16
+ t((o) => o.openCodeEditor());
17
+ },
18
+ closeCodeEditor: () => {
19
+ t((o) => o.closeCodeEditor());
20
+ }
21
+ };
22
+ };
9
23
  export {
10
- i as useCodeEditorApi
24
+ T as useCodeEditorApi
11
25
  };
@@ -1,99 +1,98 @@
1
- import { getCsrfToken as O } from "../utils/genericUtil.js";
2
- import { ref as m, computed as w } from "vue";
3
- const k = (g = {}) => {
4
- const h = m(!1), n = m(null), u = m(null), b = w(() => h.value), y = w(() => n.value !== null), v = {
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 = {
5
6
  baseURL: "",
6
7
  timeout: 1e4,
7
8
  retry: 0,
8
9
  retryDelay: 1e3,
9
10
  headers: {
10
11
  "Content-Type": "application/json",
11
- "X-CSRF-TOKEN": O(),
12
+ "X-CSRF-TOKEN": D(),
12
13
  Accept: "application/json",
13
- // The panel backend only answers 401/419 to ajax requests; without this a guest
14
- // fetch gets a 302 to the login page and never sees an auth status.
14
+ // Without this a guest fetch gets a 302 to the login page, never an auth status.
15
15
  "X-Requested-With": "XMLHttpRequest"
16
16
  },
17
17
  ...g
18
18
  }, x = (e, r) => {
19
19
  if (e.startsWith("http://") || e.startsWith("https://"))
20
20
  return e;
21
- const t = r || v.baseURL || "";
21
+ const t = r || E.baseURL || "";
22
22
  return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
23
- }, P = (e) => new Promise((r, t) => {
23
+ }, R = (e) => new Promise((r, t) => {
24
24
  setTimeout(() => {
25
25
  t(new Error("Request timeout"));
26
26
  }, e);
27
- }), C = (e) => new Promise((r) => {
27
+ }), P = (e) => new Promise((r) => {
28
28
  setTimeout(r, e);
29
29
  }), i = async (e, r, t, W = {}) => {
30
- n.value = null, h.value = !0, u.value = new AbortController();
31
- const a = { ...v, ...W }, E = x(r, a.baseURL), c = {
30
+ n.value = null, f.value = !0, c.value = new AbortController();
31
+ const a = { ...E, ...W }, p = x(r, a.baseURL), d = {
32
32
  method: e,
33
33
  headers: { ...a.headers },
34
- signal: u.value.signal,
34
+ signal: c.value.signal,
35
35
  ...a
36
36
  };
37
- t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
38
- const T = async (p = 0) => {
39
- if (window.isSessionExpired)
40
- throw n.value = { message: "Session expired" }, new Error("Session expired");
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
+ }
41
44
  try {
42
- const o = [fetch(E, c)];
43
- a.timeout && o.push(P(a.timeout));
45
+ const o = [fetch(p, d)];
46
+ a.timeout && o.push(R(a.timeout));
44
47
  const s = await Promise.race(o);
45
48
  if (!s.ok) {
46
- const D = `HTTP Error: ${s.status} ${s.statusText}`, f = new Error(D);
47
- throw f.status = s.status, f.statusText = s.statusText, f.response = s, [401, 403, 419].includes(s.status) && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((H) => window.dispatchEvent(new CustomEvent("insider:http-auth-error", {
48
- detail: {
49
- status: s.status,
50
- body: H,
51
- url: new URL(E, window.location.href).href
52
- }
53
- }))).catch(() => {
54
- }), f;
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;
55
56
  }
56
- let d;
57
- const l = s.headers.get("content-type");
58
- return l != null && l.includes("application/json") ? d = await s.json() : l != null && l.includes("text/") ? d = await s.text() : d = await s.blob(), {
59
- data: d,
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,
60
61
  status: s.status,
61
62
  statusText: s.statusText,
62
63
  headers: s.headers
63
64
  };
64
65
  } catch (o) {
65
66
  const s = o instanceof Error && o.name === "AbortError";
66
- if (p < (a.retry || 0) && !s)
67
- return await C(a.retryDelay || 1e3), T(p + 1);
67
+ if (m < (a.retry || 0) && !s)
68
+ return await P(a.retryDelay || 1e3), v(m + 1);
68
69
  throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
69
70
  }
70
71
  };
71
72
  try {
72
- return await T();
73
+ return await v();
73
74
  } finally {
74
- h.value = !1, u.value = null;
75
+ f.value = !1, c.value = null;
75
76
  }
76
- }, R = (e, r) => i("GET", e, void 0, r), U = (e, r, t) => i("POST", e, r, t), $ = (e, r, t) => i("PUT", e, r, t), q = (e, r, t) => i("PATCH", e, r, t), A = (e, r) => i("DELETE", e, void 0, r), L = (e) => {
77
- u.value && u.value.abort(e);
78
- }, S = () => {
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 = () => {
79
80
  n.value = null;
80
81
  };
81
82
  return {
82
- // State
83
83
  loading: b,
84
84
  error: w(() => n.value),
85
85
  hasError: y,
86
- // Methods
87
86
  request: i,
88
- get: R,
89
- post: U,
90
- put: $,
91
- patch: q,
92
- delete: A,
93
- cancel: L,
94
- clearError: S
87
+ get: A,
88
+ post: S,
89
+ put: U,
90
+ patch: C,
91
+ delete: $,
92
+ cancel: q,
93
+ clearError: L
95
94
  };
96
95
  };
97
96
  export {
98
- k as useHttp
97
+ _ as useHttp
99
98
  };
@@ -1,23 +1,23 @@
1
- import { useRecommendation as I } from "./useRecommendation.js";
2
- import { useToaster as C } from "./useToaster.js";
1
+ import { useRecommendation as C } from "./useRecommendation.js";
2
+ import { useToaster as I } 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 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";
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";
11
11
  const F = () => {
12
- const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
12
+ const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = 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 = R({
17
+ const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
18
18
  campaignId: r.campaignId,
19
19
  templateLibraryId: r.templateLibraryId
20
- }), S = T({
20
+ }), S = R({
21
21
  blockId: t,
22
22
  url: m(String(t)),
23
23
  campaignId: r.campaignId,
@@ -29,30 +29,34 @@ const F = () => {
29
29
  let o;
30
30
  try {
31
31
  o = await e.convertLegacyStrategy(S, s);
32
- } catch (n) {
33
- return console.error("[useLegacyStrategyConversion] migration failed", n), i({
32
+ } catch (i) {
33
+ return console.error("[useLegacyStrategyConversion] migration failed", i), c({
34
34
  type: g.Error,
35
- message: c("email-editor.legacy-strategy-update-failed")
35
+ message: a("email-editor.legacy-strategy-migration-failed"),
36
+ actionButton: {
37
+ text: a("ds-steps.create-recommendation-strategy"),
38
+ onClick: () => e.openStrategyCreation()
39
+ }
36
40
  }), "";
37
41
  }
38
42
  try {
39
43
  await e.fetchStrategyProductsForBlock(t);
40
- } catch (n) {
41
- console.error("[useLegacyStrategyConversion] product refetch failed", n);
44
+ } catch (i) {
45
+ console.error("[useLegacyStrategyConversion] product refetch failed", i);
42
46
  }
43
- const a = e.blockStates[t];
44
- return a ? h(
47
+ const n = e.blockStates[t];
48
+ return n ? T(
45
49
  t,
46
50
  {
47
51
  strategyId: o,
48
- size: a.recommendationConfigs.size,
52
+ size: n.recommendationConfigs.size,
49
53
  configVersion: L
50
54
  },
51
- a.recommendationProducts,
55
+ n.recommendationProducts,
52
56
  "Converted legacy recommendation strategy"
53
- ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
57
+ ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
54
58
  type: g.Error,
55
- message: c("email-editor.legacy-strategy-update-failed")
59
+ message: a("email-editor.legacy-strategy-update-failed")
56
60
  }), "") : o;
57
61
  } };
58
62
  };
@@ -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: 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) => {
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) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
23
- i();
23
+ r();
24
24
  return;
25
25
  }
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}`));
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}`));
29
29
  }, document.body.appendChild(e);
30
30
  }), n.catch(() => {
31
31
  n = null;
32
- }), n), D = async (i, s, o, a = [], r = !1) => {
32
+ }), n), D = async (r, s, o, a = [], i = !1) => {
33
33
  var y, E, h, C;
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";
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";
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: !m("liquidSyntax"),
48
+ customAppearanceMergetags: !p("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: r,
56
+ syncModulesEnabled: i,
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
- m("liquidSyntax")
77
+ p("liquidSyntax")
78
78
  )
79
79
  }
80
80
  ],
81
81
  async onTokenRefreshRequest(t) {
82
82
  try {
83
- const l = await M();
83
+ const l = await B();
84
84
  t(l);
85
85
  } catch (l) {
86
- p(l, "Failed to refresh token");
86
+ m(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
- p(t, "Failed to load custom interface appearance");
96
+ m(t, "Failed to load custom interface appearance");
97
97
  }
98
98
  },
99
99
  onCodeEditorVisibilityChanged(t) {
@@ -111,27 +111,31 @@ 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).
114
116
  ignoreClickOutsideSelectors: [
115
117
  "#guido-dynamic-content-modal",
116
118
  ".in-on-board-wrapper",
117
- ".in-drawer__container"
119
+ ".in-drawer__container",
120
+ ".in-modal-v2-wrapper",
121
+ ".in-toasts-wrapper"
118
122
  ],
119
123
  extensions: P,
120
124
  localePatch: J
121
125
  }
122
126
  );
123
127
  };
124
- return { initPlugin: async (i, s, o) => {
128
+ return { initPlugin: async (r, s, o) => {
125
129
  const a = k();
126
130
  try {
127
131
  await f();
128
- const [r, e] = await Promise.all([
129
- T(),
130
- v()
132
+ const [i, e] = await Promise.all([
133
+ M(),
134
+ T()
131
135
  ]);
132
- a.syncModulesEnabled = e, await D(i, s, o, r, e);
136
+ a.syncModulesEnabled = e, await D(r, s, o, i, e);
133
137
  } catch {
134
- a.loadingStatus = !1, B({
138
+ a.loadingStatus = !1, v({
135
139
  type: X.Error,
136
140
  message: b["An error has occurred. Please report the error code to support."],
137
141
  actionButton: {
@@ -1,26 +1,28 @@
1
1
  import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
- import { useToasterStore as c } from "../stores/toaster.js";
3
- import { nextTick as u } from "vue";
2
+ import { useToasterStore as u } from "../stores/toaster.js";
3
+ import { nextTick as c } from "vue";
4
4
  const s = /* @__PURE__ */ new WeakMap(), p = () => {
5
- const e = c(), o = () => {
6
- const t = s.get(e);
7
- t && (clearTimeout(t), s.delete(e));
5
+ const t = u(), o = () => {
6
+ const e = s.get(t);
7
+ e && (clearTimeout(e), s.delete(t));
8
8
  };
9
- function r(t = { message: "" }) {
10
- o(), e.hideToaster(), u(() => {
11
- e.showToaster(t), e.shouldAutoHide && s.set(e, setTimeout(() => {
12
- e.hideToaster(), o();
9
+ function i(e = { message: "" }) {
10
+ o(), t.hideToaster(), c(() => {
11
+ t.showToaster(e), t.shouldAutoHide && s.set(t, setTimeout(() => {
12
+ t.hideToaster(), o();
13
13
  }, 6e3));
14
14
  });
15
15
  }
16
- function i() {
17
- o(), e.hideToaster();
16
+ function n() {
17
+ o(), t.hideToaster();
18
18
  }
19
- function n(t, a) {
20
- const m = t instanceof Error ? t.message : String(t);
21
- r({ type: T.Error, message: `${a}: ${m}` });
19
+ function a(e, r) {
20
+ if (e != null && e.authReported)
21
+ return;
22
+ const m = e instanceof Error ? e.message : String(e);
23
+ i({ type: T.Error, message: `${r}: ${m}` });
22
24
  }
23
- return { showToaster: r, hideToaster: i, handleError: n };
25
+ return { showToaster: i, hideToaster: n, handleError: a };
24
26
  };
25
27
  export {
26
28
  p as useToaster
@@ -6,9 +6,10 @@ import { useConfig } from "./useConfig.js";
6
6
  const useTranslations = () => {
7
7
  var o, e;
8
8
  const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
9
- const r = translations.value[t];
9
+ var s;
10
+ const r = (s = translations.value) == null ? void 0 : s[t];
10
11
  return r ? n ? Object.entries(n).reduce(
11
- (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
12
+ (i, [a, l]) => i.replace(new RegExp(`{${a}}`, "g"), String(l)),
12
13
  r
13
14
  ) : r : (console.warn(`Translation key not found: ${t}`), t);
14
15
  };
@@ -1,54 +1,63 @@
1
1
  import { ToasterTypeOptions as t } from "../enums/toaster.js";
2
- import { useVersionHistoryStore as c } from "../stores/version-history.js";
3
- import { useToaster as w } from "./useToaster.js";
4
- const S = () => {
5
- const i = c(), { showToaster: s } = w(), n = (e) => {
6
- i.$reset(), i.updateState(e);
7
- }, p = () => {
8
- i.$reset();
2
+ import { useVersionHistoryStore as m } from "../stores/version-history.js";
3
+ import { findEditorApi as w, EDITOR_NOT_READY_MESSAGE as y } from "../utils/stripoEditorApi.js";
4
+ import { useToaster as V } from "./useToaster.js";
5
+ const d = () => {
6
+ const n = m(), { showToaster: i } = V(), o = (e) => {
7
+ var s;
8
+ const r = (s = w()) == null ? void 0 : s.versionHistoryApi;
9
+ if (!r) {
10
+ i({ type: t.Error, message: y });
11
+ return;
12
+ }
13
+ e(r);
14
+ }, p = (e) => {
15
+ n.$reset(), n.updateState(e);
16
+ }, a = () => {
17
+ n.$reset();
9
18
  };
10
19
  return {
11
20
  openVersionHistory: () => {
12
- window.StripoEditorApi.versionHistoryApi.openVersionHistory(n, p);
21
+ o((e) => e.openVersionHistory(p, a));
13
22
  },
14
23
  closeVersionHistory: () => {
15
- window.StripoEditorApi.versionHistoryApi.closeVersionHistory();
24
+ o((e) => e.closeVersionHistory());
16
25
  },
17
26
  switchToDesktopPreview: () => {
18
- window.StripoEditorApi.versionHistoryApi.switchToDesktopPreview();
27
+ o((e) => e.switchToDesktopPreview());
19
28
  },
20
29
  switchToMobilePreview: () => {
21
- window.StripoEditorApi.versionHistoryApi.switchToMobilePreview();
30
+ o((e) => e.switchToMobilePreview());
22
31
  },
23
32
  previewVersion: (e) => {
24
- window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
25
- const r = o instanceof Error ? o.message : String(o);
26
- s({
33
+ o((r) => r.previewVersion(e, (s) => {
34
+ const c = s instanceof Error ? s.message : String(s);
35
+ i({
27
36
  type: t.Error,
28
- message: `Error compiling email: ${r}`
37
+ message: `Error compiling email: ${c}`
29
38
  });
30
- });
39
+ }));
31
40
  },
32
41
  restoreVersion: (e) => {
33
- window.StripoEditorApi.versionHistoryApi.restoreVersion(
42
+ o((r) => r.restoreVersion(
34
43
  e,
35
44
  () => {
36
- s({
45
+ i({
37
46
  type: t.Success,
38
47
  message: "Your version has been restored successfully."
39
48
  });
40
49
  },
41
- (o) => {
42
- const r = o instanceof Error ? o.message : String(o);
43
- s({
50
+ (s) => {
51
+ const c = s instanceof Error ? s.message : String(s);
52
+ i({
44
53
  type: t.Error,
45
- message: `Error compiling email: ${r}`
54
+ message: `Error compiling email: ${c}`
46
55
  });
47
56
  }
48
- );
57
+ ));
49
58
  }
50
59
  };
51
60
  };
52
61
  export {
53
- S as useVersionHistoryApi
62
+ d as useVersionHistoryApi
54
63
  };
@@ -1,13 +1,13 @@
1
- import { ToasterTypeOptions as a } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as r } from "../../enums/toaster.js";
2
2
  import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
3
3
  import { useHttp as d } from "../useHttp.js";
4
- import { useToaster as c } from "../useToaster.js";
5
- import { useTranslations as p } from "../useTranslations.js";
4
+ import { useToaster as p } from "../useToaster.js";
5
+ import { useTranslations as c } from "../useTranslations.js";
6
6
  const v = () => {
7
- const { post: i } = d(), { showToaster: e } = c(), s = p();
7
+ const { post: i } = d(), { showToaster: t } = p(), s = c();
8
8
  return { validateLiquidSyntax: async (o) => {
9
9
  try {
10
- const t = await i("/newsletter/contents/validate-syntax", [{
10
+ const e = await i("/newsletter/contents/validate-syntax", [{
11
11
  identifier: "default",
12
12
  syntax: "liquid",
13
13
  contents: {
@@ -17,21 +17,21 @@ const v = () => {
17
17
  ampHtml: null
18
18
  }
19
19
  }]);
20
- if (!Array.isArray(t.data)) {
21
- const l = t.data;
22
- return e({
23
- type: a.Warning,
20
+ if (!Array.isArray(e.data)) {
21
+ const l = e.data;
22
+ return t({
23
+ type: r.Warning,
24
24
  message: l.message ?? s("journey-builder.liquid-validation-failed")
25
25
  }), !1;
26
26
  }
27
- const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
28
- return n.length ? (e({
29
- type: a.Warning,
27
+ const [a] = e.data, n = Object.values((a == null ? void 0 : a.errors) ?? {});
28
+ return n.length ? (t({
29
+ type: r.Warning,
30
30
  message: n[0].replace(/^line \d+:\s*/, "")
31
31
  }), !1) : !0;
32
- } catch {
33
- return e({
34
- type: a.Error,
32
+ } catch (e) {
33
+ return e != null && e.authReported || t({
34
+ type: r.Error,
35
35
  message: s("journey-builder.liquid-validation-failed")
36
36
  }), !1;
37
37
  }