@useinsider/guido 3.18.2 → 3.19.0-beta.019f238

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 (92) hide show
  1. package/README.md +41 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +70 -68
  5. package/dist/components/organisms/base/Toaster.vue2.js +13 -12
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  7. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
  8. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  9. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  10. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
  11. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  12. package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
  13. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  14. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  15. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  16. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  17. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  18. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  19. package/dist/composables/useActionsApi.js +52 -47
  20. package/dist/composables/useCodeEditorApi.js +23 -9
  21. package/dist/composables/useCustomInterfaceAppearance.js +65 -51
  22. package/dist/composables/useGuidoStateBridge.js +29 -24
  23. package/dist/composables/useHtmlValidator.js +87 -82
  24. package/dist/composables/useHttp.js +24 -22
  25. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  26. package/dist/composables/useRecommendation.js +40 -35
  27. package/dist/composables/useStripo.js +29 -29
  28. package/dist/composables/useToaster.js +14 -20
  29. package/dist/composables/useTranslations.js +3 -2
  30. package/dist/composables/useVersionHistoryApi.js +33 -24
  31. package/dist/enums/extensions/recommendationBlock.js +49 -33
  32. package/dist/extensions/Blocks/Recommendation/block.js +61 -42
  33. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  34. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +4 -4
  35. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +100 -94
  36. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +130 -55
  37. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  38. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +6 -3
  39. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +273 -92
  40. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  41. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  42. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  43. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  44. package/dist/guido.css +1 -1
  45. package/dist/library.js +15 -13
  46. package/dist/package.json.js +1 -1
  47. package/dist/public/editorState.js +4 -0
  48. package/dist/services/recommendationApi.js +46 -37
  49. package/dist/services/templateLibraryApi.js +17 -14
  50. package/dist/src/@types/config/schemas.d.ts +16 -0
  51. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  52. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  53. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  54. package/dist/src/composables/useConfig.d.ts +4 -0
  55. package/dist/src/composables/useGuidoStateBridge.d.ts +11 -7
  56. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  57. package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
  58. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  59. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  60. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  61. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  62. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  64. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
  65. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  66. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  67. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  68. package/dist/src/library.d.ts +2 -0
  69. package/dist/src/public/editorState.d.ts +14 -0
  70. package/dist/src/public/trackingIds.d.ts +6 -2
  71. package/dist/src/services/recommendationApi.d.ts +2 -1
  72. package/dist/src/stores/config.d.ts +322 -0
  73. package/dist/src/stores/editor.d.ts +25 -0
  74. package/dist/src/stores/guido-email-editor.d.ts +27 -27
  75. package/dist/src/stores/onboarding.d.ts +808 -10
  76. package/dist/src/utils/genericUtil.d.ts +6 -0
  77. package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
  78. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  79. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  80. package/dist/static/assets/icons/line-info.svg.js +5 -0
  81. package/dist/static/styles/components/recommendation-strategy.css.js +104 -9
  82. package/dist/static/styles/components/skeleton.css.js +23 -0
  83. package/dist/stores/config.js +74 -60
  84. package/dist/stores/editor.js +4 -0
  85. package/dist/stores/guido-email-editor.js +0 -4
  86. package/dist/stores/onboarding.js +46 -36
  87. package/dist/stores/unsubscribe.js +3 -3
  88. package/dist/utils/genericUtil.js +63 -54
  89. package/dist/utils/liquidDynamicContent.js +15 -0
  90. package/dist/utils/stripoEditorApi.js +11 -0
  91. package/dist/utils/templatePreparation.js +61 -60
  92. package/package.json +10 -6
@@ -0,0 +1,21 @@
1
+ import d from "./RecommendationStrategyOnboarding.vue2.js";
2
+ /* empty css */
3
+ import g from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var m = function() {
5
+ var e, n, r, i, a;
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": (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
+ return o.onboardingStore.close(o.ONBOARDING_TYPE);
9
+ }, nextButtonClick: o.handleNext } }) : t._e();
10
+ }, c = [], _ = /* @__PURE__ */ g(
11
+ d,
12
+ m,
13
+ c,
14
+ !1,
15
+ null,
16
+ "ec2027ff"
17
+ );
18
+ const S = _.exports;
19
+ export {
20
+ S as default
21
+ };
@@ -0,0 +1,47 @@
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({
9
+ __name: "RecommendationStrategyOnboarding",
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 = () => [
12
+ {
13
+ classes: "guido-recommendation-strategy-onboarding",
14
+ // Sits in the gap left of the settings panel and points at the strategy section, which
15
+ // starts 208px down: the panel header and its tab row are fixed chrome above it.
16
+ right: "426px",
17
+ top: r(208),
18
+ position: "Right Top",
19
+ title: e("email-editor.onboarding-recommendation-strategy-title"),
20
+ description: e("email-editor.onboarding-recommendation-strategy-description", {
21
+ academyLink: a
22
+ }),
23
+ imageSource: "",
24
+ backButtonClick: () => {
25
+ },
26
+ nextButtonType: "text",
27
+ nextButtonText: e("action-builder.ok"),
28
+ nextButtonClick: () => {
29
+ t.close(n);
30
+ }
31
+ }
32
+ ], c = p(() => i.strategyPanelOpen && t.onboardings.recommendationStrategyOnboarding.config.length > 0 && t.onboardings.recommendationStrategyOnboarding.isActive), d = () => {
33
+ var o, s;
34
+ (s = (o = t.getRecommendationStrategyCurrentCard) == null ? void 0 : o.nextButtonClick) == null || s.call(o);
35
+ };
36
+ return b(
37
+ () => t.isActive(n),
38
+ (o) => {
39
+ o && t.setConfig(n, m());
40
+ },
41
+ { immediate: !0 }
42
+ ), { __sfc: !0, ONBOARDING_TYPE: n, trans: e, onboardingStore: t, recommendationStore: i, getTopPosition: r, academyLink: a, buildOnboardingCards: m, isVisible: c, handleNext: d, InOnboard: y };
43
+ }
44
+ });
45
+ export {
46
+ h as default
47
+ };
@@ -1,64 +1,64 @@
1
- import { defineComponent as A, ref as c, computed as b, toRef as h, nextTick as C } from "vue";
2
- import N from "../../wrappers/WpDrawer.vue.js";
3
- import { useTranslations as O } from "../../../composables/useTranslations.js";
1
+ import { defineComponent as _, ref as c, computed as h, watch as C, toRef as N, nextTick as O } from "vue";
2
+ import b from "../../wrappers/WpDrawer.vue.js";
3
+ import { useTranslations as D } from "../../../composables/useTranslations.js";
4
4
  import { useTemplateNameValidator as x } from "../../../composables/validators/saveAsTemplate.js";
5
5
  import { useTemplateLibraryApi as B } from "../../../services/templateLibraryApi.js";
6
- import { useEditorStore as D } from "../../../stores/editor.js";
7
- import { useSaveAsTemplateStore as k } from "../../../stores/save-as-template.js";
8
- import { InMultiSelect as I, InBasicTextInput as M } from "@useinsider/design-system-vue";
9
- import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.js";
10
- const H = /* @__PURE__ */ A({
6
+ import { useEditorStore as k } from "../../../stores/editor.js";
7
+ import { useSaveAsTemplateStore as I } from "../../../stores/save-as-template.js";
8
+ import { InMultiSelect as M, InBasicTextInput as V } from "@useinsider/design-system-vue";
9
+ import { useDebounceFn as E } from "../../../node_modules/@vueuse/shared/index.js";
10
+ const J = /* @__PURE__ */ _({
11
11
  __name: "SaveAsTemplateDrawer",
12
- setup(E) {
13
- const o = O(), n = D(), t = k(), { createTemplate: m } = B(), a = c(!1), r = c(!1), l = c(""), f = b(() => ({
12
+ setup(R) {
13
+ const s = D(), o = k(), t = I(), { createTemplate: m } = B(), a = c(!1), n = c(!1), r = c(""), f = h(() => ({
14
14
  primaryButton: {
15
15
  styling: "solid",
16
16
  type: "primary",
17
- labelText: o(a.value ? "newsletter.saving" : "products.save"),
17
+ labelText: s(a.value ? "newsletter.saving" : "products.save"),
18
18
  loadingStatus: a.value,
19
19
  disabledStatus: t.skeletonStatus
20
20
  },
21
21
  cancelOrBackButton: {
22
22
  styling: "ghost",
23
23
  type: "secondary",
24
- labelText: o("products.cancel"),
24
+ labelText: s("products.cancel"),
25
25
  disabledStatus: a.value
26
26
  }
27
- })), u = () => {
28
- l.value = "", n.isSaveAsTemplateDrawerOpen = !1;
29
- }, i = async () => {
30
- const e = h(t, "templateName"), { success: s, errorMessage: _ } = await x(e).validate();
31
- return l.value = _, s;
32
- }, v = V(async (e) => {
33
- t.templateName = e, await i();
34
- }, 500), g = async (e) => {
35
- r.value = !0, await t.addCategory(e), r.value = !1;
36
- }, y = (e) => {
27
+ })), p = () => {
28
+ r.value = "", o.isSaveAsTemplateDrawerOpen = !1;
29
+ }, l = async () => {
30
+ const e = N(t, "templateName"), { success: i, errorMessage: A } = await x(e).validate();
31
+ return r.value = A, i;
32
+ }, v = E(async (e) => {
33
+ t.templateName = e, await l();
34
+ }, 500), S = async (e) => {
35
+ n.value = !0, await t.addCategory(e), n.value = !1;
36
+ }, T = (e) => {
37
37
  t.selectedCategories = e;
38
- }, S = (e) => {
38
+ }, g = (e) => {
39
39
  e && (t.selectedCategories = e);
40
- }, T = () => {
40
+ }, y = () => {
41
41
  t.selectedCategories = [];
42
42
  }, w = async () => {
43
- if (a.value = !0, !await i()) {
43
+ if (a.value = !0, !await l()) {
44
44
  a.value = !1;
45
45
  return;
46
46
  }
47
- const s = await m();
48
- a.value = !1, s && u();
49
- }, p = () => {
50
- C(() => {
47
+ const i = await m();
48
+ a.value = !1, i && p();
49
+ }, u = () => {
50
+ O(() => {
51
51
  const e = document.querySelector("input#guido__template-name-input");
52
52
  e == null || e.focus();
53
53
  });
54
54
  }, d = async () => {
55
- t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1, p();
55
+ t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1, u();
56
56
  };
57
- return n.$subscribe((e, { isSaveAsTemplateDrawerOpen: s }) => {
58
- s && d();
59
- }), { __sfc: !0, trans: o, editorStore: n, saveAsTemplateStore: t, createTemplate: m, isSaving: a, isAddingOption: r, templateNameError: l, footerButtonGroupOptions: f, closeModal: u, validateTemplateName: i, handleTemplateName: v, handleAddOption: g, handleCategoryChange: y, handleSelectAllOptions: S, handleResetAllOptions: T, saveTemplate: w, focusToInput: p, initializeDrawer: d, WpDrawer: N, InBasicTextInput: M, InMultiSelect: I };
57
+ return C(() => o.isSaveAsTemplateDrawerOpen, (e) => {
58
+ e && d();
59
+ }), { __sfc: !0, trans: s, editorStore: o, saveAsTemplateStore: t, createTemplate: m, isSaving: a, isAddingOption: n, templateNameError: r, footerButtonGroupOptions: f, closeModal: p, validateTemplateName: l, handleTemplateName: v, handleAddOption: S, handleCategoryChange: T, handleSelectAllOptions: g, handleResetAllOptions: y, saveTemplate: w, focusToInput: u, initializeDrawer: d, WpDrawer: b, InBasicTextInput: V, InMultiSelect: M };
60
60
  }
61
61
  });
62
62
  export {
63
- H as default
63
+ J as default
64
64
  };
@@ -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
  };
@@ -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,67 +1,81 @@
1
- import S from "../static/assets/icons/line-change.svg.js";
2
- import i from "../static/assets/icons/line-delete.svg.js";
3
- import n from "../static/assets/icons/line-plus.svg.js";
4
- import p from "../static/styles/base.css.js";
5
- import s from "../static/styles/components/alert-message.css.js";
6
- import C from "../static/styles/components/amp-block.css.js";
7
- import a from "../static/styles/components/base-input.css.js";
8
- import f from "../static/styles/components/button-group.css.js";
9
- import c from "../static/styles/components/button.css.js";
10
- import u from "../static/styles/components/combobox.css.js";
11
- import l from "../static/styles/components/counter.css.js";
12
- import d from "../static/styles/components/dropdown-menu.css.js";
13
- import h from "../static/styles/components/loader.css.js";
14
- import g from "../static/styles/components/narrow-panel.css.js";
15
- import I from "../static/styles/components/popup.css.js";
16
- import w from "../static/styles/components/recommendation-strategy.css.js";
17
- import y from "../static/styles/components/switcher.css.js";
18
- import b from "../static/styles/components/tabs.css.js";
19
- import B from "../static/styles/components/tools.css.js";
20
- import $ from "../static/styles/components/version-history.css.js";
21
- import P from "../static/styles/components/wide-panel.css.js";
22
- import x from "../static/styles/variables.css.js";
23
- function r(t, o) {
24
- return `--guido-icon-${t}: url("data:image/svg+xml,${encodeURIComponent(o.trim())}");`;
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
+ import C from "../static/styles/components/alert-message.css.js";
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())}");`;
25
28
  }
26
- const A = `:host {
27
- ${r("line-change", S)}
28
- ${r("line-delete", i)}
29
- ${r("line-plus", n)}
30
- }`, R = [
31
- x,
29
+ const V = `:host {
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,
32
37
  // Must be on top
33
- A,
34
- p,
38
+ V,
39
+ l,
35
40
  // Must be on top
36
- s,
37
41
  C,
38
- a,
39
- f,
40
- c,
41
- u,
42
- l,
43
42
  d,
43
+ u,
44
44
  h,
45
- g,
46
45
  I,
46
+ g,
47
+ w,
47
48
  y,
48
- b,
49
- B,
49
+ A,
50
50
  $,
51
+ b,
52
+ D,
53
+ R,
51
54
  P,
52
- w
55
+ T,
56
+ x,
57
+ M,
58
+ B
53
59
  // Last: overrides button.css / wide-panel.css defaults
54
60
  ].join(`
55
61
 
56
- `), Y = () => ({ importCss: () => {
57
- const o = new CSSStyleSheet();
58
- o.replaceSync(R);
59
- const e = document.querySelector("ui-editor");
60
- if (!e)
61
- return;
62
- const m = e.shadowRoot;
63
- m && (m.adoptedStyleSheets = [o]);
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();
64
78
  } });
65
79
  export {
66
- Y as useCustomInterfaceAppearance
80
+ po as useCustomInterfaceAppearance
67
81
  };
@@ -1,54 +1,59 @@
1
- import { useActionsApi as b } from "./useActionsApi.js";
2
- import { useEditorLock as v } from "./useEditorLock.js";
1
+ import { useActionsApi as v } from "./useActionsApi.js";
2
+ import { useEditorLock as C } from "./useEditorLock.js";
3
3
  import { useConfigStore as T } from "../stores/config.js";
4
4
  import { useEditorStore as w } from "../stores/editor.js";
5
5
  import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
6
- import { watch as a, onUnmounted as B } from "vue";
7
- const C = 500, L = () => {
8
- const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
9
- let o = null, s = !1;
10
- const n = () => {
6
+ import { watch as c, onUnmounted as z } from "vue";
7
+ const B = 500, G = () => {
8
+ const i = w(), u = y(), d = T(), { getTemplateData: l } = v(), { runExclusive: m, isEditorBusy: p } = C();
9
+ let o = null, n = !1;
10
+ const r = () => {
11
11
  o && (clearTimeout(o), o = null);
12
- }, c = (t) => {
13
- n(), o = setTimeout(() => {
12
+ }, a = (t) => {
13
+ r(), o = setTimeout(() => {
14
14
  o = null, t();
15
- }, C);
15
+ }, B);
16
16
  }, e = async () => {
17
- var t, r;
18
- if (!(s || !i.isStripoInitialized)) {
17
+ var t, s;
18
+ if (!(n || !i.isStripoInitialized)) {
19
19
  if (p()) {
20
- c(() => void e());
20
+ a(() => void e());
21
21
  return;
22
22
  }
23
23
  try {
24
- const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
25
- if (s)
24
+ const { html: E, css: I } = await m(l), b = ((s = (t = d.config) == null ? void 0 : t.identity) == null ? void 0 : s.templateId) ?? "";
25
+ if (n)
26
26
  return;
27
27
  u.$patch({
28
28
  html: E ?? "",
29
- css: g ?? "",
30
- templateId: I,
29
+ css: I ?? "",
30
+ templateId: b,
31
31
  lastUpdatedAt: Date.now()
32
32
  });
33
33
  } catch {
34
34
  }
35
35
  }
36
- }, f = () => c(() => void e()), h = a(
36
+ }, f = () => a(() => void e()), h = c(
37
37
  () => i.isStripoInitialized,
38
38
  (t) => {
39
39
  t && e();
40
40
  },
41
41
  { immediate: !0 }
42
- ), S = a(
42
+ ), S = c(
43
+ () => i.changeSeq,
44
+ () => {
45
+ i.isStripoInitialized && f();
46
+ }
47
+ ), g = c(
43
48
  () => i.hasChanges,
44
- (t, r) => {
45
- i.isStripoInitialized && (t ? f() : r && (n(), e()));
49
+ (t, s) => {
50
+ !t && s && i.isStripoInitialized && (r(), e());
46
51
  }
47
52
  );
48
- B(() => {
49
- s = !0, n(), h(), S();
53
+ z(() => {
54
+ n = !0, r(), h(), S(), g();
50
55
  });
51
56
  };
52
57
  export {
53
- L as useGuidoStateBridge
58
+ G as useGuidoStateBridge
54
59
  };