@useinsider/guido 1.0.2-beta.357420e → 1.0.2-beta.3787efd

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 (96) hide show
  1. package/README.md +43 -1
  2. package/dist/@types/events.d.ts +6 -0
  3. package/dist/@types/generic.d.ts +1 -0
  4. package/dist/components/Guido.vue.d.ts +3 -0
  5. package/dist/components/Guido.vue.js +11 -11
  6. package/dist/components/Guido.vue2.js +80 -61
  7. package/dist/components/organisms/LoadingWrapper.vue.d.ts +2 -0
  8. package/dist/components/organisms/LoadingWrapper.vue.js +18 -0
  9. package/dist/components/organisms/LoadingWrapper.vue2.js +12 -0
  10. package/dist/components/organisms/email-preview/PreviewContainer.vue.js +12 -12
  11. package/dist/components/organisms/email-preview/PreviewContainer.vue2.js +7 -8
  12. package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
  13. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  14. package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -9
  15. package/dist/components/organisms/header/LeftSlot.vue.js +10 -9
  16. package/dist/components/organisms/header/MiddleSlot.vue.js +6 -6
  17. package/dist/components/organisms/header/MiddleSlot.vue2.js +15 -16
  18. package/dist/components/organisms/header/RightSlot.vue.d.ts +3 -1
  19. package/dist/components/organisms/header/RightSlot.vue.js +6 -4
  20. package/dist/components/organisms/header/RightSlot.vue2.js +26 -28
  21. package/dist/components/organisms/header/ViewOptions.vue.js +11 -11
  22. package/dist/components/organisms/header/ViewOptions.vue2.js +14 -15
  23. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +11 -11
  24. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +5 -5
  25. package/dist/components/organisms/onboarding/AMPOnboarding.vue.d.ts +2 -0
  26. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +20 -0
  27. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +37 -0
  28. package/dist/components/organisms/onboarding/GenericOnboarding.vue.d.ts +2 -0
  29. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +21 -0
  30. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +83 -0
  31. package/dist/components/organisms/onboarding/NewVersionPopup.vue.d.ts +2 -0
  32. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +17 -0
  33. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +30 -0
  34. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +2 -0
  35. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +19 -0
  36. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -0
  37. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.d.ts +2 -0
  38. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +21 -0
  39. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +62 -0
  40. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts +2 -0
  41. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +20 -0
  42. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +37 -0
  43. package/dist/composables/useCustomInterfaceAppearance.js +15 -13
  44. package/dist/composables/useHtmlCompiler.js +17 -9
  45. package/dist/composables/useHtmlValidator.d.ts +3 -0
  46. package/dist/composables/useHtmlValidator.js +120 -0
  47. package/dist/composables/usePartner.d.ts +1 -0
  48. package/dist/composables/usePartner.js +16 -9
  49. package/dist/composables/usePreviewMode.js +13 -13
  50. package/dist/composables/useRecommendation.d.ts +19 -0
  51. package/dist/composables/useRecommendation.js +27 -0
  52. package/dist/composables/useSave.d.ts +4 -0
  53. package/dist/composables/useSave.js +15 -0
  54. package/dist/composables/useStripo.js +54 -51
  55. package/dist/composables/useStripoEventHandler.d.ts +3 -0
  56. package/dist/composables/useStripoEventHandler.js +20 -0
  57. package/dist/composables/useToaster.js +17 -17
  58. package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
  59. package/dist/config/compiler/outlookCompilerRules.js +36 -0
  60. package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
  61. package/dist/config/compiler/recommendationCompilerRules.js +83 -0
  62. package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
  63. package/dist/config/compiler/socialCompilerRules.js +21 -0
  64. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
  65. package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
  66. package/dist/enums/defaults.d.ts +6 -1
  67. package/dist/enums/defaults.js +47 -10
  68. package/dist/enums/html-validator.d.ts +6 -0
  69. package/dist/enums/html-validator.js +7 -0
  70. package/dist/enums/onboarding.d.ts +1 -0
  71. package/dist/enums/onboarding.js +8 -0
  72. package/dist/enums/recommendation.d.ts +54 -0
  73. package/dist/enums/recommendation.js +56 -0
  74. package/dist/enums/unsubscribe.d.ts +15 -0
  75. package/dist/enums/unsubscribe.js +17 -0
  76. package/dist/guido.css +1 -1
  77. package/dist/mock/api/user-modal-state.d.ts +2 -0
  78. package/dist/mock/api/validator.d.ts +2 -0
  79. package/dist/services/onboardingApi.d.ts +4 -0
  80. package/dist/services/onboardingApi.js +23 -0
  81. package/dist/static/assets/onboarding-img.svg.js +4 -0
  82. package/dist/static/styles/components/loader.css.js +10 -0
  83. package/dist/static/styles/components/wide-panel.css.js +11 -2
  84. package/dist/static/styles/customEditorStyle.css.js +18 -0
  85. package/dist/stores/editor.d.ts +194 -1
  86. package/dist/stores/editor.js +18 -2
  87. package/dist/stores/onboarding.d.ts +1068 -0
  88. package/dist/stores/onboarding.js +95 -0
  89. package/dist/stores/preview.d.ts +0 -8
  90. package/dist/stores/preview.js +12 -20
  91. package/dist/stores/recommendation.d.ts +10 -0
  92. package/dist/stores/recommendation.js +9 -0
  93. package/dist/stores/unsubscribe.d.ts +8 -0
  94. package/dist/stores/unsubscribe.js +9 -0
  95. package/dist/utils/templatePreparation.js +21 -14
  96. package/package.json +4 -2
@@ -0,0 +1,20 @@
1
+ import g from "./VersionHistoryOnboarding.vue2.js";
2
+ import l from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var c = function() {
4
+ var n, t, i, e, s, a;
5
+ var r = this, d = r._self._c, o = r._self._setupProxy;
6
+ return o.isVisible ? d(o.InOnboard, { key: "guido__version-history-onboard", staticClass: "w-21-s p-a z-11", class: (n = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : n.classes, attrs: { id: "guido__version-history-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "bottom-position": (t = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : t.bottom, "left-position": (i = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : i.left, "pages-config": o.onboardingStore.onboardings.versionHistoryOnboarding.config, "pointer-position": (e = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : e.position, "right-position": (s = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : s.right, "top-position": (a = o.onboardingStore.getVersionHistoryCurrentCard) == null ? void 0 : a.top }, on: { backButtonClick: o.handleBack, close: function(b) {
7
+ return o.onboardingStore.close("versionHistoryOnboarding");
8
+ }, nextButtonClick: o.handleNext } }) : r._e();
9
+ }, _ = [], p = /* @__PURE__ */ l(
10
+ g,
11
+ c,
12
+ _,
13
+ !1,
14
+ null,
15
+ null
16
+ );
17
+ const m = p.exports;
18
+ export {
19
+ m as default
20
+ };
@@ -0,0 +1,37 @@
1
+ import { defineComponent as c, computed as e, watch as g } from "vue";
2
+ import { useTranslations as b } from "../../../composables/useTranslations.js";
3
+ import { useOnboardingStore as u } from "../../../stores/onboarding.js";
4
+ import { InOnboard as l } from "@useinsider/design-system-vue";
5
+ const C = /* @__PURE__ */ c({
6
+ __name: "VersionHistoryOnboarding",
7
+ setup(p) {
8
+ const t = b(), n = u(), r = e(() => [
9
+ {
10
+ classes: "guido-version-history-onboarding",
11
+ left: "409px",
12
+ top: "192px",
13
+ position: "Left Top",
14
+ title: t("email-editor.onboarding-version-history-title"),
15
+ description: t("email-editor.onboarding-version-history-description"),
16
+ imageSource: "",
17
+ backButtonClick: () => {
18
+ },
19
+ nextButtonType: "text",
20
+ nextButtonText: t("action-builder.ok"),
21
+ nextButtonClick: () => void n.close("versionHistoryOnboarding")
22
+ }
23
+ ]), s = e(() => n.onboardings.versionHistoryOnboarding.config.length > 0 && n.onboardings.versionHistoryOnboarding.isActive), a = () => {
24
+ var o, i;
25
+ (i = (o = n.getVersionHistoryCurrentCard) == null ? void 0 : o.nextButtonClick) == null || i.call(o);
26
+ }, d = () => {
27
+ var o, i;
28
+ (i = (o = n.getVersionHistoryCurrentCard) == null ? void 0 : o.backButtonClick) == null || i.call(o);
29
+ };
30
+ return g(() => n.onboardings.versionHistoryOnboarding.isActive, (o) => {
31
+ o && n.setConfig("versionHistoryOnboarding", r.value);
32
+ }, { immediate: !0 }), { __sfc: !0, trans: t, onboardingStore: n, onboardingCardsConfig: r, isVisible: s, handleNext: a, handleBack: d, InOnboard: l };
33
+ }
34
+ });
35
+ export {
36
+ C as default
37
+ };
@@ -7,15 +7,16 @@ import n from "../static/styles/components/button.css.js";
7
7
  import s from "../static/styles/components/combobox.css.js";
8
8
  import C from "../static/styles/components/counter.css.js";
9
9
  import f from "../static/styles/components/dropdown-menu.css.js";
10
- import a from "../static/styles/components/narrow-panel.css.js";
11
- import u from "../static/styles/components/switcher.css.js";
12
- import c from "../static/styles/components/tabs.css.js";
13
- import d from "../static/styles/components/tools.css.js";
14
- import l from "../static/styles/components/version-history.css.js";
15
- import h from "../static/styles/components/wide-panel.css.js";
16
- import w from "../static/styles/variables.css.js";
17
- const y = [
18
- w,
10
+ import a from "../static/styles/components/loader.css.js";
11
+ import u from "../static/styles/components/narrow-panel.css.js";
12
+ import c from "../static/styles/components/switcher.css.js";
13
+ import d from "../static/styles/components/tabs.css.js";
14
+ import l from "../static/styles/components/tools.css.js";
15
+ import h from "../static/styles/components/version-history.css.js";
16
+ import w from "../static/styles/components/wide-panel.css.js";
17
+ import y from "../static/styles/variables.css.js";
18
+ const B = [
19
+ y,
19
20
  // Must be on top
20
21
  S,
21
22
  // Must be on top
@@ -32,12 +33,13 @@ const y = [
32
33
  c,
33
34
  d,
34
35
  l,
35
- h
36
+ h,
37
+ w
36
38
  ].join(`
37
39
 
38
- `), N = () => ({ importCss: () => {
40
+ `), R = () => ({ importCss: () => {
39
41
  const o = new CSSStyleSheet();
40
- o.replaceSync(y);
42
+ o.replaceSync(B);
41
43
  const r = document.querySelector("ui-editor");
42
44
  if (!r)
43
45
  return;
@@ -45,5 +47,5 @@ const y = [
45
47
  t && (t.adoptedStyleSheets = [o]);
46
48
  } });
47
49
  export {
48
- N as useCustomInterfaceAppearance
50
+ R as useCustomInterfaceAppearance
49
51
  };
@@ -1,17 +1,25 @@
1
- import { defaultHtmlCompilerRules as r } from "../config/compiler/htmlCompilerRules.js";
2
- import { createHtmlCompiler as p } from "../utils/htmlCompiler.js";
3
- import { useConfig as s } from "./useConfig.js";
4
- const R = () => {
5
- const { config: e } = s(), l = e.htmlCompilerRules || [], t = [
6
- ...!!e.ignoreDefaultHtmlCompilerRules ? [] : r,
1
+ import { defaultHtmlCompilerRules as t } from "../config/compiler/htmlCompilerRules.js";
2
+ import { outlookCompilerRules as p } from "../config/compiler/outlookCompilerRules.js";
3
+ import { recommendationCompilerRules as s } from "../config/compiler/recommendationCompilerRules.js";
4
+ import { socialCompilerRules as u } from "../config/compiler/socialCompilerRules.js";
5
+ import { unsubscribeCompilerRules as n } from "../config/compiler/unsubscribeCompilerRules.js";
6
+ import { createHtmlCompiler as c } from "../utils/htmlCompiler.js";
7
+ import { useConfig as f } from "./useConfig.js";
8
+ const h = () => {
9
+ const { config: e } = f(), l = e.htmlCompilerRules || [], m = [
10
+ ...!!e.ignoreDefaultHtmlCompilerRules ? [] : t,
11
+ ...s,
12
+ ...n,
13
+ ...p,
14
+ ...u,
7
15
  ...l.map((o, i) => ({
8
16
  ...o,
9
17
  priority: o.priority + 1e3 + i
10
18
  // Ensure additional rules run after default rules
11
19
  }))
12
- ], m = p(t);
13
- return { compileHtml: (o) => m.compile(o) };
20
+ ], r = c(m);
21
+ return { compileHtml: (o) => r.compile(o) };
14
22
  };
15
23
  export {
16
- R as useHtmlCompiler
24
+ h as useHtmlCompiler
17
25
  };
@@ -0,0 +1,3 @@
1
+ export declare const useHtmlValidator: () => {
2
+ validateHtml: (html: string, customFields: string[], isOnSaveValidation?: boolean) => Promise<boolean>;
3
+ };
@@ -0,0 +1,120 @@
1
+ import { useConfig as V } from "./useConfig.js";
2
+ import { TemplateTypes as H } from "../enums/defaults.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as O, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as B, CampaignCouldNotBeSavedKey as _, CanNotMakeAnyChangesForRunningKey as R } from "../enums/html-validator.js";
4
+ import { ToasterTypeOptions as r } from "../enums/toaster.js";
5
+ import { useRecommendationStore as D } from "../stores/recommendation.js";
6
+ import { base64EncodeWithSpecialChars as P } from "../utils/base64.js";
7
+ import { useHttp as X } from "./useHttp.js";
8
+ import { useToaster as j } from "./useToaster.js";
9
+ import { useTranslations as z } from "./useTranslations.js";
10
+ const tt = () => {
11
+ var d;
12
+ const { showToaster: a } = j(), { post: y } = X(), { config: C } = V(), i = z(), m = D(), f = ((d = C.partner) == null ? void 0 : d.messageType) === H.transactional, h = async (t) => {
13
+ const e = await y(
14
+ "/newsletter/template-library/check-template-html-body",
15
+ { html: P(t) }
16
+ ), { status: n, message: c } = e.data;
17
+ return n || a({
18
+ type: r.Alert,
19
+ message: n === void 0 ? c : i("newsletter.invalid-url-link-for-toaster")
20
+ }), i(_), c === i(R) && a({
21
+ type: r.Alert,
22
+ message: i("newsletter.already-in-progress")
23
+ }), n;
24
+ }, v = (t) => !["if", "endif", "else", "elif", "now"].includes(t.toLowerCase()), w = (t) => ["if", "endif"].includes(t.toLowerCase()), S = (t, s) => {
25
+ const e = t.match(/({%(.*?)%})/g);
26
+ let n = !0;
27
+ return e !== null && !f && e.forEach((c) => {
28
+ const o = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
29
+ if (o && o.length > 0) {
30
+ const [l] = o;
31
+ v(l) && !s.includes(l) && (a({
32
+ type: r.Warning,
33
+ message: i("custom-fields.invalid-custom-fields")
34
+ }), n = !1);
35
+ }
36
+ }), n;
37
+ }, E = async (t, s, e) => {
38
+ const n = e ? await h(t) : !0;
39
+ return S(t, s) && n;
40
+ }, T = (t) => t.length > 0 ? !0 : (a({
41
+ type: r.Warning,
42
+ message: i("newsletter.html-content-is-empty")
43
+ }), !1), I = (t) => {
44
+ const s = (t.match(/{/gm) || []).length, e = (t.match(/}/gm) || []).length;
45
+ return s > e && a({
46
+ type: r.Warning,
47
+ message: i("custom-fields.missing-closing-braces")
48
+ }), s < e && a({
49
+ type: r.Warning,
50
+ message: i("custom-fields.missing-opening-braces")
51
+ }), s === e;
52
+ }, A = (t) => {
53
+ const s = t.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
54
+ return s || a({
55
+ type: r.Warning,
56
+ message: i("custom-fields.invalid-custom-fields")
57
+ }), s;
58
+ }, W = (t, s) => {
59
+ const e = t.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
60
+ if (e && !f) {
61
+ const n = s.map((o) => o.toLowerCase()), c = e.some((o) => {
62
+ const l = o.replace("{{", "").replace("}}", "").trim().toLowerCase();
63
+ return !n.includes(l) || l === "";
64
+ });
65
+ return c && a({
66
+ type: r.Warning,
67
+ message: i("custom-fields.invalid-custom-fields")
68
+ }), !c;
69
+ }
70
+ return !0;
71
+ }, x = (t) => {
72
+ const s = t.match(/{%(.*?)%}/g), e = [];
73
+ let n = !0;
74
+ if (s && s.forEach((c) => {
75
+ const o = c.match(O), l = c.match(B), L = (o == null ? void 0 : o.join("")) || "";
76
+ (!o || c !== L) && !l && (a({
77
+ type: r.Alert,
78
+ message: i("newsletter.display-conditions-invalid-syntax")
79
+ }), n = !1), o && o.forEach((u) => {
80
+ u.trim() === "=" && (a({
81
+ type: r.Alert,
82
+ message: i("custom-conditions.wrong-equality-operators")
83
+ }), n = !1);
84
+ const g = u.match(/^[a-zA-Z]*$/g);
85
+ g && g.forEach((p) => {
86
+ w(p) && e.push(p);
87
+ });
88
+ });
89
+ }), e.length) {
90
+ const c = e.filter((l) => l === "if"), o = e.filter((l) => l === "endif");
91
+ c.length !== o.length && (a({
92
+ type: r.Alert,
93
+ message: i("custom-conditions.missing-if-endif-tag")
94
+ }), n = !1);
95
+ }
96
+ return n;
97
+ }, b = (t) => {
98
+ const s = (t.match(/{% /gm) || []).length, e = (t.match(/ %}/gm) || []).length, n = s === e;
99
+ return n || a({
100
+ type: r.Warning,
101
+ message: i("custom-conditions.no-space-after-braces")
102
+ }), n;
103
+ }, N = (t) => (t.match(/({%(.*?)%})/g) || []).filter((e) => e.includes("if")).map((e) => (e.match(/{{.*}}/gm) || []).length).reduce((e, n) => e + n, 0) > 0 ? (a({
104
+ type: r.Warning,
105
+ message: i("custom-conditions.no-braces-inside-if-tag")
106
+ }), !1) : !0, k = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((e) => e.value === "")) !== void 0 ? (a({
107
+ type: r.Alert,
108
+ message: i("newsletter.fill-all-necessary-fields")
109
+ }), !1) : !0, F = (t) => {
110
+ const s = /src="[^"]*\.(svg|pst)"/gm;
111
+ return t.match(s) === null ? !0 : (a({
112
+ type: r.Alert,
113
+ message: i("newsletter.invalid-image-type")
114
+ }), !1);
115
+ };
116
+ return { validateHtml: async (t, s, e = !1) => await E(t, s, e) && T(t) && I(t) && A(t) && W(t, s) && x(t) && b(t) && N(t) && k() && F(t) };
117
+ };
118
+ export {
119
+ tt as useHtmlValidator
120
+ };
@@ -1,4 +1,5 @@
1
1
  export declare const usePartner: () => {
2
2
  getPartnerName: () => string;
3
3
  getProductType: () => number;
4
+ isTestPartner: () => boolean;
4
5
  };
@@ -1,11 +1,18 @@
1
- import { DefaultProductType as e, ProductIds as o } from "../enums/defaults.js";
2
- const c = () => ({
3
- getPartnerName: () => window.location.hostname.split(".")[0] || "",
4
- getProductType: () => {
5
- const t = window.location.pathname.split("/").filter(Boolean)[0] || e;
6
- return o[t] || 0;
7
- }
8
- });
1
+ import { TEST_PARTNER_LIST as r, DefaultProductType as o, ProductIds as n } from "../enums/defaults.js";
2
+ const i = () => {
3
+ const e = () => window.location.hostname.split(".")[0] || "";
4
+ return {
5
+ getPartnerName: e,
6
+ getProductType: () => {
7
+ const t = window.location.pathname.split("/").filter(Boolean)[0] || o;
8
+ return n[t] || 0;
9
+ },
10
+ isTestPartner: () => {
11
+ const t = e();
12
+ return r.includes(t);
13
+ }
14
+ };
15
+ };
9
16
  export {
10
- c as usePartner
17
+ i as usePartner
11
18
  };
@@ -1,26 +1,26 @@
1
1
  import { useEditorStore as n } from "../stores/editor.js";
2
- import { usePreviewStore as m } from "../stores/preview.js";
3
- import { useActionsApi as p } from "./useActionsApi.js";
4
- import { useCodeEditorApi as l } from "./useCodeEditorApi.js";
2
+ import { usePreviewStore as l } from "../stores/preview.js";
3
+ import { useActionsApi as m } from "./useActionsApi.js";
4
+ import { useCodeEditorApi as p } from "./useCodeEditorApi.js";
5
5
  const E = () => {
6
- const i = n(), e = m(), { closeCodeEditor: s } = l(), { getPreviewData: a } = p(), r = () => {
7
- e.isPreviewModeOpen = !1, e.$reset();
6
+ const o = n(), e = l(), { closeCodeEditor: a } = p(), { getPreviewData: s } = m(), r = () => {
7
+ o.isPreviewModeOpen = !1, e.$reset();
8
8
  };
9
9
  return {
10
10
  closePreviewMode: r,
11
11
  openPreviewMode: () => {
12
- i.isCodeEditorOpen && s(), e.isPreviewModeOpen = !0;
12
+ o.isCodeEditorOpen && a(), o.isPreviewModeOpen = !0;
13
13
  },
14
14
  loadPreviewData: async () => {
15
- if (!(e.isLoading || e.isLoaded)) {
16
- e.isLoading = !0;
15
+ if (!(o.loadingStatus || e.isLoaded)) {
16
+ o.loadingStatus = !0;
17
17
  try {
18
- const { html: o, ampHtml: t, ampErrors: d } = await a();
19
- e.templateHtml = o || "", e.ampHtml = t || "", e.ampErrors = d || [], e.setEmailFormat(t ? "AMP" : "html"), e.isLoaded = !0;
20
- } catch (o) {
21
- console.error("Failed to load preview data:", o), r();
18
+ const { html: t, ampHtml: i, ampErrors: d } = await s();
19
+ e.templateHtml = t || "", e.ampHtml = i || "", e.ampErrors = d || [], e.setEmailFormat(i ? "AMP" : "html"), e.isLoaded = !0;
20
+ } catch (t) {
21
+ console.error("Failed to load preview data:", t), r();
22
22
  } finally {
23
- e.isLoading = !1;
23
+ o.loadingStatus = !1;
24
24
  }
25
25
  }
26
26
  }
@@ -0,0 +1,19 @@
1
+ type CardWidthParams = {
2
+ mobileLeftPadding: number;
3
+ mobileRightPadding: number;
4
+ cardsInRow: number;
5
+ unresponsive: boolean;
6
+ };
7
+ interface CampaignData extends CardWidthParams {
8
+ textTrimming: boolean;
9
+ orientation: string;
10
+ priceBeforeTextValue: string;
11
+ priceAfterTextValue: string;
12
+ discountBeforeTextValue: string;
13
+ discountAfterTextValue: string;
14
+ }
15
+ export declare const useRecommendation: () => {
16
+ calculateCardWidth: ({ mobileLeftPadding, mobileRightPadding, cardsInRow, unresponsive, }: CardWidthParams) => number;
17
+ getRecommendationCampaignData: (id: string) => CampaignData;
18
+ };
19
+ export {};
@@ -0,0 +1,27 @@
1
+ import { MinDeviceViewport as r, DefaultPadding as c } from "../enums/recommendation.js";
2
+ const m = () => ({
3
+ calculateCardWidth: ({
4
+ mobileLeftPadding: e,
5
+ mobileRightPadding: a,
6
+ cardsInRow: n,
7
+ unresponsive: i
8
+ }) => {
9
+ const t = i ? n : 1, o = e + a + (t - 1) * c;
10
+ return (r - o) / t;
11
+ },
12
+ getRecommendationCampaignData: (e) => (console.debug(e), {
13
+ textTrimming: !1,
14
+ orientation: "vertical",
15
+ mobileLeftPadding: 0,
16
+ mobileRightPadding: 0,
17
+ cardsInRow: 2,
18
+ unresponsive: !1,
19
+ priceBeforeTextValue: "",
20
+ priceAfterTextValue: "",
21
+ discountBeforeTextValue: "",
22
+ discountAfterTextValue: ""
23
+ })
24
+ });
25
+ export {
26
+ m as useRecommendation
27
+ };
@@ -0,0 +1,4 @@
1
+ import { SavedTemplateDetails } from '@@/Types/stripo';
2
+ export declare const useSave: () => {
3
+ save: (isSilent?: boolean) => Promise<SavedTemplateDetails | undefined>;
4
+ };
@@ -0,0 +1,15 @@
1
+ import { useSaveStart as i, useSaveComplete as l } from "./useGuidoActions.js";
2
+ import { useTemplatePreparation as m } from "../utils/templatePreparation.js";
3
+ import { useHtmlValidator as n } from "./useHtmlValidator.js";
4
+ const f = () => {
5
+ const e = i(), a = l(), { validateHtml: s } = n();
6
+ return { save: async (o = !1) => {
7
+ e();
8
+ const { prepareTemplateDetails: r } = m(), t = await r();
9
+ if (await s(t.compiledHtml, [], !0))
10
+ return o || a(t), t;
11
+ } };
12
+ };
13
+ export {
14
+ f as useSave
15
+ };
@@ -1,21 +1,23 @@
1
- import { useActionsApi as g } from "./useActionsApi.js";
2
- import { useCustomInterfaceAppearance as f } from "./useCustomInterfaceAppearance.js";
3
- import { useToaster as S } from "./useToaster.js";
4
- import { displayConditions as C } from "../enums/displayConditions.js";
5
- import y from "../extensions/DynamicContent/extension.js";
6
- import { useStripoApi as E } from "../services/stripoApi.js";
7
- import { useEditorStore as h } from "../stores/editor.js";
8
- import { dynamicContentToMergeTags as w } from "../utils/genericUtil.js";
9
- const M = (d) => {
10
- const { handleError: a } = S(), { getToken: c, getCustomFonts: u } = E(), l = (e, r = []) => {
11
- const i = h(), { html: t, css: s, forceRecreate: p } = e;
1
+ import { useActionsApi as f } from "./useActionsApi.js";
2
+ import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
3
+ import { useStripoEventHandler as C } from "./useStripoEventHandler.js";
4
+ import { useToaster as E } from "./useToaster.js";
5
+ import { displayConditions as y } from "../enums/displayConditions.js";
6
+ import h from "../extensions/DynamicContent/extension.js";
7
+ import { useStripoApi as w } from "../services/stripoApi.js";
8
+ import b from "../static/styles/customEditorStyle.css.js";
9
+ import { useEditorStore as V } from "../stores/editor.js";
10
+ import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
11
+ const R = (s) => {
12
+ const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = w(), { handleEvent: l } = C(), p = (r, i = []) => {
13
+ const e = V(), { html: o, css: a, forceRecreate: g } = r;
12
14
  window.UIEditor.initEditor(
13
15
  document.querySelector("#guido-editor"),
14
16
  {
15
- metadata: d,
16
- html: t,
17
- css: s,
18
- forceRecreate: p,
17
+ metadata: s,
18
+ html: o,
19
+ css: a,
20
+ forceRecreate: g,
19
21
  locale: "en",
20
22
  undoButtonSelector: "#guido__undo-button",
21
23
  redoButtonSelector: "#guido__redo-button",
@@ -25,77 +27,78 @@ const M = (d) => {
25
27
  customAppearanceMergetags: !0,
26
28
  customAppearanceMergetagsBorderColor: "#f1f3fe",
27
29
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
28
- customViewStyles: `
29
- .esd-x, .esd-merge-tag {color: #0a2ecc !important; box-shadow: none !important;}
30
- .esd-merge-tag {border: 1px solid #b5c1f1; border-radius: 4px !important;}
31
- `,
30
+ customViewStyles: b,
32
31
  conditionsEnabled: !0,
33
32
  customConditionsEnabled: !0,
34
- conditionCategories: C,
33
+ conditionCategories: y,
35
34
  enableXSSSecurity: !0,
36
35
  messageSettingsEnabled: !1,
36
+ selectBlockAfterDropFromSettingsPanel: !0,
37
37
  editorFonts: {
38
38
  showDefaultStandardFonts: !0,
39
39
  showDefaultNotStandardFonts: !0,
40
- customFonts: r
40
+ customFonts: i
41
41
  },
42
42
  mergeTags: [
43
43
  {
44
- entries: w(d.preselectedDynamicContentList)
44
+ entries: _(s.preselectedDynamicContentList)
45
45
  }
46
46
  ],
47
- async onTokenRefreshRequest(o) {
47
+ async onTokenRefreshRequest(t) {
48
48
  try {
49
49
  const n = await c();
50
- o(n);
50
+ t(n);
51
51
  } catch (n) {
52
- a(n, "Failed to refresh token");
52
+ d(n, "Failed to refresh token");
53
53
  }
54
54
  },
55
55
  onTemplateLoaded() {
56
56
  try {
57
- const { importCss: o } = f(), { activateCustomViewStyles: n } = g();
58
- o(), n();
59
- } catch (o) {
60
- a(o, "Failed to load custom interface appearance");
57
+ const { importCss: t } = S(), { activateCustomViewStyles: n } = f();
58
+ t(), n(), s.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
59
+ e.hasChanges = !1;
60
+ }, 1e3);
61
+ } catch (t) {
62
+ d(t, "Failed to load custom interface appearance");
61
63
  }
62
64
  },
63
- onCodeEditorVisibilityChanged(o) {
64
- i.isCodeEditorOpen = o;
65
+ onCodeEditorVisibilityChanged(t) {
66
+ e.isCodeEditorOpen = t;
65
67
  },
66
- onEditorVisualModeChanged(o) {
67
- i.editorVisualMode = o.toLowerCase();
68
+ onEditorVisualModeChanged(t) {
69
+ e.editorVisualMode = t.toLowerCase();
68
70
  },
69
- onVersionHistoryVisibilityChanged(o) {
70
- i.isVersionHistoryOpen = o;
71
+ onVersionHistoryVisibilityChanged(t) {
72
+ e.isVersionHistoryOpen = t;
71
73
  },
72
74
  onDataChanged() {
73
- i.hasChanges = !0;
75
+ e.hasChanges = !0;
74
76
  },
75
- ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
76
- extensions: [y]
77
+ onEvent: l,
78
+ ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
79
+ extensions: [h]
77
80
  }
78
81
  );
79
- }, m = (e) => new Promise((r, i) => {
82
+ }, m = (r) => new Promise((i, e) => {
80
83
  if (document.getElementById("UiEditorScript")) {
81
- e(), r();
84
+ r(), i();
82
85
  return;
83
86
  }
84
- const t = document.createElement("script");
85
- t.id = "UiEditorScript", t.type = "module", t.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", t.onload = () => {
86
- e(), r();
87
- }, t.onerror = () => {
88
- const s = new Error("Failed to load Stripo UIEditor script");
89
- i(s);
90
- }, document.body.appendChild(t);
87
+ const o = document.createElement("script");
88
+ o.id = "UiEditorScript", o.type = "module", o.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o.onload = () => {
89
+ r(), i();
90
+ }, o.onerror = () => {
91
+ const a = new Error("Failed to load Stripo UIEditor script");
92
+ e(a);
93
+ }, document.body.appendChild(o);
91
94
  });
92
- return { initPlugin: async (e) => {
95
+ return { initPlugin: async (r) => {
93
96
  await m(async () => {
94
- const r = await u();
95
- l(e, r);
97
+ const i = await u();
98
+ p(r, i);
96
99
  });
97
100
  } };
98
101
  };
99
102
  export {
100
- M as useStripo
103
+ R as useStripo
101
104
  };
@@ -0,0 +1,3 @@
1
+ export declare const useStripoEventHandler: () => {
2
+ handleEvent: (type: string, params: Record<string, string>) => Promise<void>;
3
+ };
@@ -0,0 +1,20 @@
1
+ import { useOnboardingStore as i } from "../stores/onboarding.js";
2
+ const c = () => {
3
+ const e = {
4
+ block_dropped: ({ blockName: t }) => {
5
+ if (t === "BLOCK_TEXT") {
6
+ const n = i(), o = !n.shouldShowOnboarding("textBlockOnboarding"), r = n.isActive("textBlockOnboarding");
7
+ if (o || r)
8
+ return;
9
+ n.start("textBlockOnboarding");
10
+ }
11
+ }
12
+ };
13
+ return { handleEvent: async (t, n) => {
14
+ const o = e[t];
15
+ o && await o(n);
16
+ } };
17
+ };
18
+ export {
19
+ c as useStripoEventHandler
20
+ };
@@ -1,31 +1,31 @@
1
- import { ToasterTypeOptions as u } from "../enums/toaster.js";
2
- import { useToasterStore as T } from "../stores/toaster.js";
3
- import { watch as c, onUnmounted as l } from "vue";
4
- const p = () => {
5
- const t = T();
6
- let s = null;
7
- const o = () => {
8
- s && (clearTimeout(s), s = null);
1
+ import { ToasterTypeOptions as T } from "../enums/toaster.js";
2
+ import { useToasterStore as u } from "../stores/toaster.js";
3
+ import { watch as c } from "vue";
4
+ const d = () => {
5
+ const t = u();
6
+ let o = null;
7
+ const s = () => {
8
+ o && (clearTimeout(o), o = null);
9
9
  };
10
10
  function r(e = { message: "" }) {
11
- o(), t.hideToaster(), t.showToaster(e);
11
+ s(), t.hideToaster(), t.showToaster(e);
12
12
  }
13
- function n() {
14
- o(), t.hideToaster();
13
+ function i() {
14
+ s(), t.hideToaster();
15
15
  }
16
- function i(e, a) {
16
+ function a(e, n) {
17
17
  const m = e instanceof Error ? e.message : String(e);
18
- r({ type: u.Alert, message: `${a}: ${m}` });
18
+ r({ type: T.Alert, message: `${n}: ${m}` });
19
19
  }
20
20
  return c(
21
21
  () => t.shouldAutoHide,
22
22
  (e) => {
23
- o(), e && (s = setTimeout(() => {
24
- t.hideToaster(), o();
23
+ s(), e && (o = setTimeout(() => {
24
+ t.hideToaster(), s();
25
25
  }, 6e3));
26
26
  }
27
- ), l(o), { showToaster: r, hideToaster: n, handleError: i };
27
+ ), { showToaster: r, hideToaster: i, handleError: a };
28
28
  };
29
29
  export {
30
- p as useToaster
30
+ d as useToaster
31
31
  };