@useinsider/guido 3.19.0-beta.f02eaa1 → 3.19.0-beta.f66e9de

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 (56) hide show
  1. package/dist/components/Guido.vue.js +8 -8
  2. package/dist/components/Guido.vue2.js +44 -43
  3. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  4. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  5. package/dist/components/organisms/base/Toaster.vue2.js +13 -12
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +9 -7
  7. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +69 -52
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -44
  9. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  10. package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
  11. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +3 -3
  12. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +21 -20
  13. package/dist/composables/useActionsApi.js +52 -47
  14. package/dist/composables/useAuthError.js +54 -0
  15. package/dist/composables/useCodeEditorApi.js +23 -9
  16. package/dist/composables/useCustomInterfaceAppearance.js +61 -51
  17. package/dist/composables/useHtmlValidator.js +87 -82
  18. package/dist/composables/useHttp.js +54 -44
  19. package/dist/composables/useRecommendation.js +40 -35
  20. package/dist/composables/useStripo.js +30 -30
  21. package/dist/composables/useToaster.js +14 -20
  22. package/dist/composables/useTranslations.js +3 -2
  23. package/dist/composables/useVersionHistoryApi.js +33 -24
  24. package/dist/enums/extensions/recommendationBlock.js +32 -25
  25. package/dist/extensions/Blocks/Recommendation/block.js +61 -42
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  27. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +63 -58
  28. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +109 -78
  29. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +96 -97
  30. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +209 -92
  31. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +1 -1
  32. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  33. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  34. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  35. package/dist/guido.css +1 -1
  36. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  37. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  38. package/dist/src/composables/useAuthError.d.ts +13 -0
  39. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  40. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  41. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  42. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  43. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +8 -0
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -6
  46. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +92 -0
  47. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +1 -1
  48. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  49. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  50. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  51. package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
  52. package/dist/static/styles/components/skeleton.css.js +23 -0
  53. package/dist/stores/unsubscribe.js +3 -3
  54. package/dist/utils/stripoEditorApi.js +11 -0
  55. package/dist/utils/templatePreparation.js +55 -55
  56. package/package.json +2 -1
@@ -1,4 +1,4 @@
1
- import { defineComponent as q, ref as l, computed as w } from "vue";
1
+ import { defineComponent as q, ref as n, computed as x } from "vue";
2
2
  import { useActionsApi as b } from "../../../composables/useActionsApi.js";
3
3
  import { useConfig as k } from "../../../composables/useConfig.js";
4
4
  import { useExport as B } from "../../../composables/useExport.js";
@@ -17,48 +17,46 @@ import { storeToRefs as Q } from "pinia";
17
17
  import U from "./MigrationConfirmModal.vue.js";
18
18
  const ft = /* @__PURE__ */ q({
19
19
  __name: "EditorActions",
20
- setup(W, { expose: x }) {
21
- const { config: m, isFeatureEnabled: c } = k(), { exportHtml: p } = B(), { save: u } = R(), { openVersionHistory: f, closeVersionHistory: d } = P(), { getCompiledEmail: v } = b(), { compileHtml: y } = L(), { validateLiquidSyntax: g } = j(), { handleError: r } = z(), e = G(), h = J(), { hasMigrations: H } = Q(h), s = I(), i = l(!1), a = l(!1), S = l(), V = D(), _ = () => {
20
+ setup(W, { expose: w }) {
21
+ const { config: l, isFeatureEnabled: m } = k(), { exportHtml: c } = B(), { save: p } = R(), { openVersionHistory: u, closeVersionHistory: f } = P(), { getCompiledEmail: d } = b(), { compileHtml: v } = L(), { validateLiquidSyntax: y } = j(), { handleError: r } = z(), e = G(), g = J(), { hasMigrations: S } = Q(g), s = I(), i = n(!1), a = n(!1), H = n(), h = D(), _ = () => {
22
22
  if (e.isVersionHistoryOpen) {
23
- d();
23
+ f();
24
24
  return;
25
25
  }
26
- f();
26
+ u();
27
27
  }, C = async () => {
28
- i.value = !0, await p(), i.value = !1;
28
+ i.value = !0, await c(), i.value = !1;
29
29
  }, A = () => {
30
30
  e.isSaveAsTemplateDrawerOpen = !0;
31
- }, M = w(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = w(
31
+ }, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
32
32
  () => {
33
33
  var t, o;
34
- return ((o = (t = m.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
34
+ return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
35
35
  }
36
- ), E = async (t) => {
36
+ ), V = async (t) => {
37
37
  a.value = !0, t || (e.loadingStatus = !0);
38
38
  let o;
39
39
  try {
40
- o = await u(t);
41
- } catch (n) {
42
- if (t)
43
- throw n;
44
- r(n, "Failed to save template");
40
+ o = await p(t);
41
+ } catch (T) {
42
+ r(T, "Failed to save template");
45
43
  } finally {
46
44
  a.value = !1, !t && !o && (e.loadingStatus = !1);
47
45
  }
48
46
  return o;
49
- }, T = (t) => {
47
+ }, E = (t) => {
50
48
  var o;
51
- if (!t && H.value) {
52
- (o = S.value) == null || o.open();
49
+ if (!t && S.value) {
50
+ (o = H.value) == null || o.open();
53
51
  return;
54
52
  }
55
- return E(t);
53
+ return V(t);
56
54
  }, F = async () => {
57
- if (c("liquidSyntax")) {
55
+ if (m("liquidSyntax")) {
58
56
  e.loadingStatus = !0;
59
57
  try {
60
- const { html: t } = await v({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = y(t);
61
- if (!await g(o))
58
+ const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
59
+ if (!await y(o))
62
60
  return;
63
61
  } catch (t) {
64
62
  r(t, "Failed to prepare test email");
@@ -67,11 +65,11 @@ const ft = /* @__PURE__ */ q({
67
65
  e.loadingStatus = !1;
68
66
  }
69
67
  }
70
- V();
68
+ h();
71
69
  };
72
- return x({
73
- handleSave: T
74
- }), { __sfc: !0, config: m, isFeatureEnabled: c, exportHtml: p, save: u, openVersionHistory: f, closeVersionHistory: d, getCompiledEmail: v, compileHtml: y, validateLiquidSyntax: g, handleError: r, editorStore: e, templateStore: h, hasMigrations: H, trans: s, isExporting: i, isSaving: a, migrationModalRef: S, testEmailClick: V, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: E, handleSave: T, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
70
+ return w({
71
+ handleSave: E
72
+ }), { __sfc: !0, config: l, isFeatureEnabled: m, exportHtml: c, save: p, openVersionHistory: u, closeVersionHistory: f, getCompiledEmail: d, compileHtml: v, validateLiquidSyntax: y, handleError: r, editorStore: e, templateStore: g, hasMigrations: S, trans: s, isExporting: i, isSaving: a, migrationModalRef: H, testEmailClick: h, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: V, handleSave: E, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
75
73
  }
76
74
  });
77
75
  export {
@@ -2,9 +2,9 @@ import d from "./RecommendationStrategyOnboarding.vue2.js";
2
2
  /* empty css */
3
3
  import g from "../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var m = function() {
5
- var e, n, r, a, i;
5
+ var e, n, r, i, a;
6
6
  var t = this, s = t._self._c, o = t._self._setupProxy;
7
- return o.isVisible ? s(o.InOnboard, { key: "guido__recommendation-strategy-onboard", staticClass: "w-21-s p-a z-11", class: (e = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : e.classes, attrs: { id: "guido__recommendation-strategy-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "left-position": (n = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : n.left, "pages-config": o.onboardingStore.onboardings.recommendationStrategyOnboarding.config, "pointer-position": (r = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : r.position, "right-position": (a = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : a.right, "top-position": (i = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : i.top }, on: { close: function(p) {
7
+ return o.isVisible ? s(o.InOnboard, { key: "guido__recommendation-strategy-onboard", staticClass: "w-21-s p-a z-11", class: (e = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : e.classes, attrs: { id: "guido__recommendation-strategy-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "left-position": (n = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : n.left, "pages-config": o.onboardingStore.onboardings.recommendationStrategyOnboarding.config, "pointer-position": (r = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : r.position, "right-position": (i = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : i.right, "top-position": (a = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : a.top }, on: { close: function(p) {
8
8
  return o.onboardingStore.close(o.ONBOARDING_TYPE);
9
9
  }, nextButtonClick: o.handleNext } }) : t._e();
10
10
  }, c = [], _ = /* @__PURE__ */ g(
@@ -13,7 +13,7 @@ var m = function() {
13
13
  c,
14
14
  !1,
15
15
  null,
16
- "1f4a4044"
16
+ "ec2027ff"
17
17
  );
18
18
  const S = _.exports;
19
19
  export {
@@ -1,46 +1,47 @@
1
- import { defineComponent as c, computed as g, watch as b } from "vue";
2
- import { useRibbonOffset as p } from "../../../composables/useRibbonOffset.js";
3
- import { useTranslations as u } from "../../../composables/useTranslations.js";
4
- import { ACADEMY_LINKS as l } from "../../../enums/academy.js";
5
- import { useOnboardingStore as f } from "../../../stores/onboarding.js";
6
- import { InOnboard as O } from "@useinsider/design-system-vue";
7
- const B = /* @__PURE__ */ c({
1
+ import { defineComponent as g, computed as p, watch as b } from "vue";
2
+ import { useRibbonOffset as u } from "../../../composables/useRibbonOffset.js";
3
+ import { useTranslations as l } from "../../../composables/useTranslations.js";
4
+ import { ACADEMY_LINKS as f } from "../../../enums/academy.js";
5
+ import { useRecommendationExtensionStore as O } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
6
+ import { useOnboardingStore as _ } from "../../../stores/onboarding.js";
7
+ import { InOnboard as y } from "@useinsider/design-system-vue";
8
+ const h = /* @__PURE__ */ g({
8
9
  __name: "RecommendationStrategyOnboarding",
9
- setup(_) {
10
- const e = "recommendationStrategyOnboarding", n = u(), t = f(), { getTopPosition: i } = p(), r = `<a href="${l.EMAIL_RECOMMENDATION_BLOCK}" target="_blank" rel="noopener noreferrer">${n("action-builder.visit-academy")}</a>`, a = () => [
10
+ setup(C) {
11
+ const n = "recommendationStrategyOnboarding", e = l(), t = _(), i = O(), { getTopPosition: r } = u(), a = `<a href="${f.EMAIL_RECOMMENDATION_BLOCK}" target="_blank" rel="noopener noreferrer">${e("action-builder.visit-academy")}</a>`, m = () => [
11
12
  {
12
13
  classes: "guido-recommendation-strategy-onboarding",
13
14
  // Sits in the gap left of the settings panel and points at the strategy section, which
14
15
  // starts 208px down: the panel header and its tab row are fixed chrome above it.
15
16
  right: "426px",
16
- top: i(208),
17
+ top: r(208),
17
18
  position: "Right Top",
18
- title: n("email-editor.onboarding-recommendation-strategy-title"),
19
- description: n("email-editor.onboarding-recommendation-strategy-description", {
20
- academyLink: r
19
+ title: e("email-editor.onboarding-recommendation-strategy-title"),
20
+ description: e("email-editor.onboarding-recommendation-strategy-description", {
21
+ academyLink: a
21
22
  }),
22
23
  imageSource: "",
23
24
  backButtonClick: () => {
24
25
  },
25
26
  nextButtonType: "text",
26
- nextButtonText: n("action-builder.ok"),
27
+ nextButtonText: e("action-builder.ok"),
27
28
  nextButtonClick: () => {
28
- t.close(e);
29
+ t.close(n);
29
30
  }
30
31
  }
31
- ], m = g(() => t.onboardings.recommendationStrategyOnboarding.config.length > 0 && t.onboardings.recommendationStrategyOnboarding.isActive), d = () => {
32
+ ], c = p(() => i.strategyPanelOpen && t.onboardings.recommendationStrategyOnboarding.config.length > 0 && t.onboardings.recommendationStrategyOnboarding.isActive), d = () => {
32
33
  var o, s;
33
34
  (s = (o = t.getRecommendationStrategyCurrentCard) == null ? void 0 : o.nextButtonClick) == null || s.call(o);
34
35
  };
35
36
  return b(
36
- () => t.isActive(e),
37
+ () => t.isActive(n),
37
38
  (o) => {
38
- o && t.setConfig(e, a());
39
+ o && t.setConfig(n, m());
39
40
  },
40
41
  { immediate: !0 }
41
- ), { __sfc: !0, ONBOARDING_TYPE: e, trans: n, onboardingStore: t, getTopPosition: i, academyLink: r, buildOnboardingCards: a, isVisible: m, handleNext: d, InOnboard: O };
42
+ ), { __sfc: !0, ONBOARDING_TYPE: n, trans: e, onboardingStore: t, recommendationStore: i, getTopPosition: r, academyLink: a, buildOnboardingCards: m, isVisible: c, handleNext: d, InOnboard: y };
42
43
  }
43
44
  });
44
45
  export {
45
- B as default
46
+ h as default
46
47
  };
@@ -1,18 +1,23 @@
1
- import { filterAmpErrors as v } from "../utils/ampErrorFilter.js";
2
- import { useToaster as y } from "./useToaster.js";
3
- const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
4
- const w = setTimeout(
5
- () => m(new Error(`${n} did not report completion within ${l}ms`)),
1
+ import { filterAmpErrors as y } from "../utils/ampErrorFilter.js";
2
+ import { getEditorApi as s } from "../utils/stripoEditorApi.js";
3
+ import { useToaster as D } from "./useToaster.js";
4
+ const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
5
+ const f = setTimeout(
6
+ () => p(new Error(`${n} did not report completion within ${l}ms`)),
6
7
  l
7
- ), p = (A) => (t) => {
8
- clearTimeout(w), A(t);
9
- };
10
- u(p(T), p(m));
11
- }), I = () => {
12
- const { handleError: n } = y(), l = (t = {}) => s(
8
+ ), c = (t) => (e) => {
9
+ clearTimeout(f), t(e);
10
+ }, d = c(p);
11
+ try {
12
+ A(c(C), d);
13
+ } catch (t) {
14
+ d(t);
15
+ }
16
+ }), P = () => {
17
+ const { handleError: n } = D(), l = (t = {}) => r(
13
18
  "compileEmail",
14
- d,
15
- (e, a) => {
19
+ T,
20
+ (e, i) => {
16
21
  const o = { ...{
17
22
  minimize: !0,
18
23
  utmEntity: {
@@ -32,53 +37,53 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
32
37
  forceAmp: !1,
33
38
  resetDataSavedFlag: !1,
34
39
  disableLineHeightsReplace: !0
35
- }, ...t }, c = {
36
- callback: (r, C, f, S, g) => {
37
- r ? a(r) : e({
38
- html: C,
39
- ampHtml: f,
40
- ampErrors: v(S ?? []),
41
- displayConditions: g
40
+ }, ...t }, u = {
41
+ callback: (m, g, w, S, v) => {
42
+ m ? i(m) : e({
43
+ html: g,
44
+ ampHtml: w,
45
+ ampErrors: y(S ?? []),
46
+ displayConditions: v
42
47
  });
43
48
  },
44
49
  ...o
45
50
  };
46
- window.StripoEditorApi.actionsApi.compileEmail(c);
51
+ s().actionsApi.compileEmail(u);
47
52
  }
48
53
  );
49
54
  return {
50
55
  getCompiledEmail: l,
51
- getTemplateData: () => s(
56
+ getTemplateData: () => r(
52
57
  "getTemplateData",
53
- d,
58
+ T,
54
59
  (t) => {
55
- const e = ({ html: a, css: i, width: o, height: E, utmParams: c, syncModulesIds: r }) => t({
56
- html: a,
57
- css: i,
60
+ const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
61
+ html: i,
62
+ css: a,
58
63
  width: o,
59
64
  height: E,
60
- utmParams: c,
61
- syncModulesIds: r
65
+ utmParams: u,
66
+ syncModulesIds: m
62
67
  });
63
- window.StripoEditorApi.actionsApi.getTemplateData(e);
68
+ s().actionsApi.getTemplateData(e);
64
69
  }
65
70
  ),
66
71
  activateCustomViewStyles: (t = !0) => {
67
- window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
72
+ s().actionsApi.activateCustomViewStyles(t);
68
73
  },
69
74
  getPreviewData: async (t) => {
70
75
  try {
71
76
  const {
72
77
  html: e,
73
- displayConditions: a,
74
- ampHtml: i = "",
78
+ displayConditions: i,
79
+ ampHtml: a = "",
75
80
  ampErrors: o = []
76
81
  } = await l({ minimize: !1, resetDataSavedFlag: !1, ...t });
77
82
  return {
78
83
  html: e,
79
- ampHtml: i,
84
+ ampHtml: a,
80
85
  ampErrors: o,
81
- displayConditions: a
86
+ displayConditions: i
82
87
  };
83
88
  } catch (e) {
84
89
  return n(e, "Error loading preview"), {
@@ -90,30 +95,30 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
90
95
  }
91
96
  },
92
97
  updateTimerInClonedTemplate: () => new Promise((t) => {
93
- var e, a;
94
- if (typeof ((a = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : a.updateTimerInClonedTemplate) != "function") {
98
+ var e, i;
99
+ if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
95
100
  t(null);
96
101
  return;
97
102
  }
98
103
  try {
99
- window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
100
- i ? (n(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
104
+ window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, o) => {
105
+ a ? (n(a, "Failed to update timer in cloned template"), t(null)) : t(o || null);
101
106
  });
102
- } catch (i) {
103
- n(i, "Failed to call updateTimerInClonedTemplate"), t(null);
107
+ } catch (a) {
108
+ n(a, "Failed to call updateTimerInClonedTemplate"), t(null);
104
109
  }
105
110
  }),
106
111
  updateHtmlAndCss: (t, e) => {
107
- const { actionsApi: a } = window.StripoEditorApi;
108
- return s("updateHtmlAndCss", D, (i) => {
109
- a.updateHtmlAndCss(t, e, () => i());
112
+ const { actionsApi: i } = s();
113
+ return r("updateHtmlAndCss", h, (a) => {
114
+ i.updateHtmlAndCss(t, e, () => a());
110
115
  });
111
116
  },
112
- editorSave: () => s(
117
+ editorSave: () => r(
113
118
  "save",
114
- d,
119
+ T,
115
120
  (t) => {
116
- window.StripoEditorApi.actionsApi.save((e) => {
121
+ s().actionsApi.save((e) => {
117
122
  if (e) {
118
123
  n(e, "Failed to save template"), t(!1);
119
124
  return;
@@ -125,5 +130,5 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
125
130
  };
126
131
  };
127
132
  export {
128
- I as useActionsApi
133
+ P as useActionsApi
129
134
  };
@@ -0,0 +1,54 @@
1
+ import { ToasterTypeOptions as u } from "../enums/toaster.js";
2
+ import { ref as f } from "vue";
3
+ import { useToaster as p } from "./useToaster.js";
4
+ import { useTranslations as d } from "./useTranslations.js";
5
+ const a = ["accessExpired", "domainRestricted", "ipRestricted", "insiderAccessRestricted"], n = f(null);
6
+ let t = !1;
7
+ const w = (e) => {
8
+ try {
9
+ return new URL(e, window.location.href).origin === window.location.origin;
10
+ } catch {
11
+ return !0;
12
+ }
13
+ }, g = (e) => {
14
+ try {
15
+ const o = new URL(e, window.location.href);
16
+ return o.origin === window.location.origin ? o.href : "";
17
+ } catch {
18
+ return "";
19
+ }
20
+ }, y = (e) => {
21
+ try {
22
+ const o = JSON.parse(e);
23
+ return o && typeof o == "object" && Object.keys(o).length ? o : null;
24
+ } catch {
25
+ return null;
26
+ }
27
+ }, h = (e) => typeof (e == null ? void 0 : e.message) == "string" ? e.message : "", c = (e) => h(e) || d()("user-management.collaborate-forbidden-action"), l = (e) => {
28
+ p().showToaster({ type: u.Error, message: e });
29
+ }, m = () => {
30
+ n.value = null, t && (window.isSessionExpired = !1, t = !1);
31
+ }, A = (e, o, i) => {
32
+ if (i && !w(i))
33
+ return;
34
+ const r = y(o);
35
+ if (e === 403) {
36
+ l(c(r));
37
+ return;
38
+ }
39
+ if (e === 401 && (r == null ? void 0 : r.type) === "groupLevelAccess") {
40
+ l(c(r));
41
+ return;
42
+ }
43
+ if (e === 401 && typeof (r == null ? void 0 : r.type) == "string" && a.includes(r.type)) {
44
+ const s = typeof r.redirect == "string" ? g(r.redirect) : "";
45
+ s && window.location.replace(s);
46
+ return;
47
+ }
48
+ e !== 401 && e !== 419 || n.value || (t = t || !window.isSessionExpired, window.isSessionExpired = !0, n.value = { status: e, data: r });
49
+ }, O = () => ({ authError: n, releaseAuthFreeze: m });
50
+ export {
51
+ m as releaseAuthFreeze,
52
+ A as reportAuthError,
53
+ O as useAuthError
54
+ };
@@ -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,71 +1,81 @@
1
- import i from "../static/assets/icons/filled-arrow-rising.svg.js";
2
- import n from "../static/assets/icons/line-change.svg.js";
3
- import S from "../static/assets/icons/line-delete.svg.js";
4
- import p from "../static/assets/icons/line-info.svg.js";
5
- import s from "../static/assets/icons/line-plus.svg.js";
6
- import f from "../static/styles/base.css.js";
1
+ import p from "../static/assets/icons/filled-arrow-rising.svg.js";
2
+ import s from "../static/assets/icons/line-change.svg.js";
3
+ import a from "../static/assets/icons/line-delete.svg.js";
4
+ import f from "../static/assets/icons/line-info.svg.js";
5
+ import c from "../static/assets/icons/line-plus.svg.js";
6
+ import l from "../static/styles/base.css.js";
7
7
  import C from "../static/styles/components/alert-message.css.js";
8
- import a from "../static/styles/components/amp-block.css.js";
9
- import c from "../static/styles/components/base-input.css.js";
10
- import l from "../static/styles/components/button-group.css.js";
11
- import u from "../static/styles/components/button.css.js";
12
- import d from "../static/styles/components/combobox.css.js";
13
- import I from "../static/styles/components/counter.css.js";
14
- import g from "../static/styles/components/dropdown-menu.css.js";
15
- import h from "../static/styles/components/loader.css.js";
16
- import w from "../static/styles/components/narrow-panel.css.js";
17
- import $ from "../static/styles/components/popup.css.js";
18
- import y from "../static/styles/components/recommendation-strategy.css.js";
19
- import b from "../static/styles/components/switcher.css.js";
20
- import B from "../static/styles/components/tabs.css.js";
21
- import A from "../static/styles/components/tools.css.js";
22
- import P from "../static/styles/components/version-history.css.js";
23
- import R from "../static/styles/components/wide-panel.css.js";
24
- import x from "../static/styles/variables.css.js";
25
- function o(t, r) {
26
- return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(r.trim())}");`;
8
+ import d from "../static/styles/components/amp-block.css.js";
9
+ import u from "../static/styles/components/base-input.css.js";
10
+ import h from "../static/styles/components/button-group.css.js";
11
+ import I from "../static/styles/components/button.css.js";
12
+ import g from "../static/styles/components/combobox.css.js";
13
+ import w from "../static/styles/components/counter.css.js";
14
+ import y from "../static/styles/components/dropdown-menu.css.js";
15
+ import A from "../static/styles/components/loader.css.js";
16
+ import $ from "../static/styles/components/narrow-panel.css.js";
17
+ import b from "../static/styles/components/popup.css.js";
18
+ import B from "../static/styles/components/recommendation-strategy.css.js";
19
+ import D from "../static/styles/components/skeleton.css.js";
20
+ import R from "../static/styles/components/switcher.css.js";
21
+ import P from "../static/styles/components/tabs.css.js";
22
+ import T from "../static/styles/components/tools.css.js";
23
+ import x from "../static/styles/components/version-history.css.js";
24
+ import M from "../static/styles/components/wide-panel.css.js";
25
+ import O from "../static/styles/variables.css.js";
26
+ function o(i, r) {
27
+ return `--guido-icon-${i}: url("data:image/svg+xml,${encodeURIComponent(r.trim())}");`;
27
28
  }
28
29
  const V = `:host {
29
- ${o("line-change", n)}
30
- ${o("line-delete", S)}
31
- ${o("filled-arrow-rising", i)}
32
- ${o("line-info", p)}
33
- ${o("line-plus", s)}
34
- }`, D = [
35
- x,
30
+ ${o("line-change", s)}
31
+ ${o("line-delete", a)}
32
+ ${o("filled-arrow-rising", p)}
33
+ ${o("line-info", f)}
34
+ ${o("line-plus", c)}
35
+ }`, W = [
36
+ O,
36
37
  // Must be on top
37
38
  V,
38
- f,
39
+ l,
39
40
  // Must be on top
40
41
  C,
41
- a,
42
- c,
43
- l,
44
- u,
45
42
  d,
43
+ u,
44
+ h,
46
45
  I,
47
46
  g,
48
- h,
49
47
  w,
48
+ y,
49
+ A,
50
50
  $,
51
51
  b,
52
- B,
53
- A,
54
- P,
52
+ D,
55
53
  R,
56
- y
54
+ P,
55
+ T,
56
+ x,
57
+ M,
58
+ B
57
59
  // Last: overrides button.css / wide-panel.css defaults
58
60
  ].join(`
59
61
 
60
- `), ro = () => ({ importCss: () => {
61
- const r = new CSSStyleSheet();
62
- r.replaceSync(D);
63
- const e = document.querySelector("ui-editor");
64
- if (!e)
65
- return;
66
- const m = e.shadowRoot;
67
- m && (m.adoptedStyleSheets = [r]);
62
+ `), _ = 3e4;
63
+ let e = null;
64
+ function k() {
65
+ return e || (e = new CSSStyleSheet(), e.replaceSync(W)), e;
66
+ }
67
+ const po = () => ({ importCss: () => {
68
+ const r = k(), S = Date.now() + _, n = () => {
69
+ var m;
70
+ const t = (m = document.querySelector("ui-editor")) == null ? void 0 : m.shadowRoot;
71
+ if (t) {
72
+ t.adoptedStyleSheets.includes(r) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, r]);
73
+ return;
74
+ }
75
+ Date.now() < S && requestAnimationFrame(n);
76
+ };
77
+ n();
68
78
  } });
69
79
  export {
70
- ro as useCustomInterfaceAppearance
80
+ po as useCustomInterfaceAppearance
71
81
  };