@useinsider/guido 1.0.2-beta.c3f86dc → 1.0.2-beta.c50c279

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 (74) hide show
  1. package/README.md +24 -1
  2. package/dist/@types/events.d.ts +6 -0
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +41 -39
  5. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  6. package/dist/components/organisms/header/RightSlot.vue2.js +20 -25
  7. package/dist/components/organisms/header/ViewOptions.vue.js +11 -11
  8. package/dist/components/organisms/header/ViewOptions.vue2.js +5 -5
  9. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +11 -11
  10. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +5 -5
  11. package/dist/components/organisms/onboarding/AMPOnboarding.vue.d.ts +2 -0
  12. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +20 -0
  13. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +37 -0
  14. package/dist/components/organisms/onboarding/GenericOnboarding.vue.d.ts +2 -0
  15. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +21 -0
  16. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +83 -0
  17. package/dist/components/organisms/onboarding/NewVersionPopup.vue.d.ts +2 -0
  18. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +17 -0
  19. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +30 -0
  20. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +2 -0
  21. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +19 -0
  22. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -0
  23. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.d.ts +2 -0
  24. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +21 -0
  25. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +74 -0
  26. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts +2 -0
  27. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +20 -0
  28. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +37 -0
  29. package/dist/composables/useHtmlCompiler.js +17 -9
  30. package/dist/composables/useHtmlValidator.d.ts +3 -0
  31. package/dist/composables/useHtmlValidator.js +120 -0
  32. package/dist/composables/usePartner.d.ts +1 -0
  33. package/dist/composables/usePartner.js +16 -9
  34. package/dist/composables/useRecommendation.d.ts +19 -0
  35. package/dist/composables/useRecommendation.js +27 -0
  36. package/dist/composables/useSave.d.ts +3 -0
  37. package/dist/composables/useSave.js +14 -0
  38. package/dist/composables/useStripo.js +37 -35
  39. package/dist/composables/useStripoEventHandler.d.ts +3 -0
  40. package/dist/composables/useStripoEventHandler.js +20 -0
  41. package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
  42. package/dist/config/compiler/outlookCompilerRules.js +36 -0
  43. package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
  44. package/dist/config/compiler/recommendationCompilerRules.js +83 -0
  45. package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
  46. package/dist/config/compiler/socialCompilerRules.js +21 -0
  47. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
  48. package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
  49. package/dist/enums/defaults.d.ts +6 -1
  50. package/dist/enums/defaults.js +45 -9
  51. package/dist/enums/html-validator.d.ts +6 -0
  52. package/dist/enums/html-validator.js +7 -0
  53. package/dist/enums/onboarding.d.ts +1 -0
  54. package/dist/enums/onboarding.js +8 -0
  55. package/dist/enums/recommendation.d.ts +54 -0
  56. package/dist/enums/recommendation.js +56 -0
  57. package/dist/enums/unsubscribe.d.ts +15 -0
  58. package/dist/enums/unsubscribe.js +17 -0
  59. package/dist/guido.css +1 -1
  60. package/dist/mock/api/user-modal-state.d.ts +2 -0
  61. package/dist/mock/api/validator.d.ts +2 -0
  62. package/dist/services/onboardingApi.d.ts +4 -0
  63. package/dist/services/onboardingApi.js +23 -0
  64. package/dist/static/assets/onboarding-img.svg.js +4 -0
  65. package/dist/stores/editor.d.ts +21 -0
  66. package/dist/stores/editor.js +2 -1
  67. package/dist/stores/onboarding.d.ts +1068 -0
  68. package/dist/stores/onboarding.js +95 -0
  69. package/dist/stores/recommendation.d.ts +10 -0
  70. package/dist/stores/recommendation.js +9 -0
  71. package/dist/stores/unsubscribe.d.ts +8 -0
  72. package/dist/stores/unsubscribe.js +9 -0
  73. package/dist/utils/templatePreparation.js +21 -14
  74. package/package.json +4 -2
@@ -0,0 +1,19 @@
1
+ import o from "./OnboardingWrapper.vue2.js";
2
+ import _ from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var s = function() {
4
+ var n = this, e = n._self._c, t = n._self._setupProxy;
5
+ return e("div", n._l(t.visibleOnboardings, function(r) {
6
+ return e(r.component, { key: r.type, tag: "component" });
7
+ }), 1);
8
+ }, a = [], p = /* @__PURE__ */ _(
9
+ o,
10
+ s,
11
+ a,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const m = p.exports;
17
+ export {
18
+ m as default
19
+ };
@@ -0,0 +1,43 @@
1
+ import { defineComponent as g, computed as e, onMounted as b, watch as t } from "vue";
2
+ import { usePartner as O } from "../../../composables/usePartner.js";
3
+ import { useEditorStore as u } from "../../../stores/editor.js";
4
+ import { useOnboardingStore as v } from "../../../stores/onboarding.js";
5
+ import { usePreviewStore as l } from "../../../stores/preview.js";
6
+ import y from "./AMPOnboarding.vue.js";
7
+ import S from "./GenericOnboarding.vue.js";
8
+ import w from "./NewVersionPopup.vue.js";
9
+ import P from "./TextBlockOnboarding.vue.js";
10
+ import h from "./VersionHistoryOnboarding.vue.js";
11
+ const E = /* @__PURE__ */ g({
12
+ __name: "OnboardingWrapper",
13
+ setup(_) {
14
+ const o = v(), r = u(), s = l(), { isTestPartner: a } = O(), p = e(() => r.isStripoInitialized), d = e(() => a()), m = [
15
+ { type: "newVersionPopup", component: w },
16
+ { type: "genericOnboarding", component: S },
17
+ { type: "textBlockOnboarding", component: P },
18
+ { type: "versionHistoryOnboarding", component: h },
19
+ { type: "ampOnboarding", component: y }
20
+ ], c = (n) => d.value || !p.value ? !1 : n === "newVersionPopup" ? o.shouldShowOnboarding(n) : o.isActive(n), f = e(() => m.filter((n) => c(n.type)));
21
+ return b(async () => {
22
+ await o.fetchUserModalState();
23
+ }), t(
24
+ () => r.isVersionHistoryOpen,
25
+ (n, i) => {
26
+ n && !i && o.shouldShowOnboarding("versionHistoryOnboarding") && o.start("versionHistoryOnboarding"), !n && i && o.isActive("versionHistoryOnboarding") && o.close("versionHistoryOnboarding");
27
+ }
28
+ ), t(
29
+ () => s.emailFormat,
30
+ (n, i) => {
31
+ i !== "AMP" && n === "AMP" && o.shouldShowOnboarding("ampOnboarding") && o.start("ampOnboarding");
32
+ }
33
+ ), t(
34
+ () => r.isPreviewModeOpen,
35
+ (n) => {
36
+ !n && o.isActive("ampOnboarding") && o.close("ampOnboarding");
37
+ }
38
+ ), { __sfc: !0, onboardingStore: o, editorStore: r, previewStore: s, isTestPartner: a, isStripoReady: p, isTestPartnerActive: d, onboardingConfigs: m, shouldShow: c, visibleOnboardings: f };
39
+ }
40
+ });
41
+ export {
42
+ E as default
43
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import l from "./TextBlockOnboarding.vue2.js";
2
+ /* empty css */
3
+ import d from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var g = function() {
5
+ var e, n, r, i, a, s;
6
+ var t = this, c = t._self._c, o = t._self._setupProxy;
7
+ return o.isVisible ? c(o.InOnboard, { key: "guido__text-block-onboard", staticClass: "w-21-s p-a z-11", class: (e = o.onboardingStore.getTextBlockCurrentCard) == null ? void 0 : e.classes, attrs: { id: "guido__text-block-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "bottom-position": (n = o.onboardingStore.getTextBlockCurrentCard) == null ? void 0 : n.bottom, "left-position": (r = o.onboardingStore.getTextBlockCurrentCard) == null ? void 0 : r.left, "pages-config": o.onboardingStore.onboardings.textBlockOnboarding.config, "pointer-position": (i = o.onboardingStore.getTextBlockCurrentCard) == null ? void 0 : i.position, "right-position": (a = o.onboardingStore.getTextBlockCurrentCard) == null ? void 0 : a.right, "top-position": (s = o.onboardingStore.getTextBlockCurrentCard) == null ? void 0 : s.top }, on: { backButtonClick: o.handleBack, close: function(u) {
8
+ return o.onboardingStore.close("textBlockOnboarding");
9
+ }, nextButtonClick: o.handleNext } }) : t._e();
10
+ }, b = [], p = /* @__PURE__ */ d(
11
+ l,
12
+ g,
13
+ b,
14
+ !1,
15
+ null,
16
+ "a408dcea"
17
+ );
18
+ const f = p.exports;
19
+ export {
20
+ f as default
21
+ };
@@ -0,0 +1,74 @@
1
+ import { defineComponent as u, computed as a, watch as b } from "vue";
2
+ import { useTranslations as m } from "../../../composables/useTranslations.js";
3
+ import { useOnboardingStore as k } from "../../../stores/onboarding.js";
4
+ import { InOnboard as B } from "@useinsider/design-system-vue";
5
+ const y = /* @__PURE__ */ u({
6
+ __name: "TextBlockOnboarding",
7
+ setup(h) {
8
+ const i = m(), o = k(), e = a(() => {
9
+ const n = window.innerHeight - 128, r = Math.max(90, n * 0.15), s = Math.max(490, n * 0.71), d = 200, g = 40;
10
+ return {
11
+ settings: {
12
+ top: `${r}px`,
13
+ position: r + d + g > n ? "Right Bottom" : "Right Top"
14
+ },
15
+ dynamic: {
16
+ top: `${s}px`,
17
+ position: s + d + g > n ? "Right Bottom" : "Right Top"
18
+ }
19
+ };
20
+ }), c = a(() => [
21
+ {
22
+ classes: "guido-text-block-onboarding-settings",
23
+ right: "450px",
24
+ top: e.value.settings.top,
25
+ position: e.value.settings.position,
26
+ title: i("email-editor.onboarding-text-block-title"),
27
+ description: i("email-editor.onboarding-text-block-description"),
28
+ imageSource: "",
29
+ backButtonClick: () => {
30
+ },
31
+ nextButtonType: "text",
32
+ nextButtonText: i("products.next"),
33
+ nextButtonClick: () => {
34
+ o.next("textBlockOnboarding");
35
+ }
36
+ },
37
+ {
38
+ classes: "guido-text-block-onboarding-dynamic",
39
+ right: "450px",
40
+ top: e.value.dynamic.top,
41
+ position: e.value.dynamic.position,
42
+ title: i("email-editor.onboarding-dynamic-content-title"),
43
+ description: i("email-editor.onboarding-dynamic-content-description"),
44
+ imageSource: "",
45
+ backButtonType: "text",
46
+ backButtonText: i("ds-steps.back"),
47
+ backButtonClick: () => {
48
+ o.previous("textBlockOnboarding");
49
+ },
50
+ nextButtonType: "text",
51
+ nextButtonText: i("action-builder.ok"),
52
+ nextButtonClick: () => {
53
+ o.close("textBlockOnboarding");
54
+ }
55
+ }
56
+ ]), l = a(() => o.onboardings.textBlockOnboarding.config.length > 0 && o.onboardings.textBlockOnboarding.isActive), p = () => {
57
+ var t, n;
58
+ (n = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.nextButtonClick) == null || n.call(t);
59
+ }, x = () => {
60
+ var t, n;
61
+ (n = (t = o.getTextBlockCurrentCard) == null ? void 0 : t.backButtonClick) == null || n.call(t);
62
+ };
63
+ return b(
64
+ () => o.isActive("textBlockOnboarding"),
65
+ (t) => {
66
+ t && o.setConfig("textBlockOnboarding", c.value);
67
+ },
68
+ { immediate: !0 }
69
+ ), { __sfc: !0, trans: i, onboardingStore: o, dynamicPosition: e, onboardingCardsConfig: c, isVisible: l, handleNext: p, handleBack: x, InOnboard: B };
70
+ }
71
+ });
72
+ export {
73
+ y as default
74
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _default;
@@ -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
+ };
@@ -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
  };
@@ -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,3 @@
1
+ export declare const useSave: () => {
2
+ save: () => Promise<void>;
3
+ };
@@ -0,0 +1,14 @@
1
+ import { useSaveStart as r, useSaveComplete as i } from "./useGuidoActions.js";
2
+ import { useTemplatePreparation as m } from "../utils/templatePreparation.js";
3
+ import { useHtmlValidator as l } from "./useHtmlValidator.js";
4
+ const d = () => {
5
+ const e = r(), a = i(), { validateHtml: s } = l();
6
+ return { save: async () => {
7
+ e();
8
+ const { prepareTemplateDetails: o } = m(), t = await o();
9
+ await s(t.compiledHtml, [], !0) && a(t);
10
+ } };
11
+ };
12
+ export {
13
+ d as useSave
14
+ };
@@ -1,22 +1,23 @@
1
- import { useActionsApi as g } from "./useActionsApi.js";
1
+ import { useActionsApi as S } from "./useActionsApi.js";
2
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 h from "../static/styles/customEditorStyle.css.js";
8
- import { useEditorStore as w } from "../stores/editor.js";
9
- import { dynamicContentToMergeTags as b } from "../utils/genericUtil.js";
10
- const P = (d) => {
11
- const { handleError: a } = S(), { getToken: c, getCustomFonts: u } = E(), l = (r, i = []) => {
12
- const e = w(), { html: o, css: s, forceRecreate: p } = r;
3
+ import { useStripoEventHandler as E } from "./useStripoEventHandler.js";
4
+ import { useToaster as C } 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 x = (a) => {
12
+ const { handleError: d } = C(), { getToken: c, getCustomFonts: u } = w(), { handleEvent: l } = E(), p = (r, i = []) => {
13
+ const o = V(), { html: e, css: s, forceRecreate: g } = r;
13
14
  window.UIEditor.initEditor(
14
15
  document.querySelector("#guido-editor"),
15
16
  {
16
- metadata: d,
17
- html: o,
17
+ metadata: a,
18
+ html: e,
18
19
  css: s,
19
- forceRecreate: p,
20
+ forceRecreate: g,
20
21
  locale: "en",
21
22
  undoButtonSelector: "#guido__undo-button",
22
23
  redoButtonSelector: "#guido__redo-button",
@@ -26,10 +27,10 @@ const P = (d) => {
26
27
  customAppearanceMergetags: !0,
27
28
  customAppearanceMergetagsBorderColor: "#f1f3fe",
28
29
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
29
- customViewStyles: h,
30
+ customViewStyles: b,
30
31
  conditionsEnabled: !0,
31
32
  customConditionsEnabled: !0,
32
- conditionCategories: C,
33
+ conditionCategories: y,
33
34
  enableXSSSecurity: !0,
34
35
  messageSettingsEnabled: !1,
35
36
  selectBlockAfterDropFromSettingsPanel: !0,
@@ -40,7 +41,7 @@ const P = (d) => {
40
41
  },
41
42
  mergeTags: [
42
43
  {
43
- entries: b(d.preselectedDynamicContentList)
44
+ entries: _(a.preselectedDynamicContentList)
44
45
  }
45
46
  ],
46
47
  async onTokenRefreshRequest(t) {
@@ -48,53 +49,54 @@ const P = (d) => {
48
49
  const n = await c();
49
50
  t(n);
50
51
  } catch (n) {
51
- a(n, "Failed to refresh token");
52
+ d(n, "Failed to refresh token");
52
53
  }
53
54
  },
54
55
  onTemplateLoaded() {
55
56
  try {
56
- const { importCss: t } = f(), { activateCustomViewStyles: n } = g();
57
- t(), n(), e.loadingStatus = !1;
57
+ const { importCss: t } = f(), { activateCustomViewStyles: n } = S();
58
+ t(), n(), o.isStripoInitialized = !0, o.loadingStatus = !1;
58
59
  } catch (t) {
59
- a(t, "Failed to load custom interface appearance");
60
+ d(t, "Failed to load custom interface appearance");
60
61
  }
61
62
  },
62
63
  onCodeEditorVisibilityChanged(t) {
63
- e.isCodeEditorOpen = t;
64
+ o.isCodeEditorOpen = t;
64
65
  },
65
66
  onEditorVisualModeChanged(t) {
66
- e.editorVisualMode = t.toLowerCase();
67
+ o.editorVisualMode = t.toLowerCase();
67
68
  },
68
69
  onVersionHistoryVisibilityChanged(t) {
69
- e.isVersionHistoryOpen = t;
70
+ o.isVersionHistoryOpen = t;
70
71
  },
71
72
  onDataChanged() {
72
- e.hasChanges = !0;
73
+ o.hasChanges = !0;
73
74
  },
74
- ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
75
- extensions: [y]
75
+ onEvent: l,
76
+ ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
77
+ extensions: [h]
76
78
  }
77
79
  );
78
- }, m = (r) => new Promise((i, e) => {
80
+ }, m = (r) => new Promise((i, o) => {
79
81
  if (document.getElementById("UiEditorScript")) {
80
82
  r(), i();
81
83
  return;
82
84
  }
83
- const o = document.createElement("script");
84
- o.id = "UiEditorScript", o.type = "module", o.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o.onload = () => {
85
+ const e = document.createElement("script");
86
+ e.id = "UiEditorScript", e.type = "module", e.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", e.onload = () => {
85
87
  r(), i();
86
- }, o.onerror = () => {
88
+ }, e.onerror = () => {
87
89
  const s = new Error("Failed to load Stripo UIEditor script");
88
- e(s);
89
- }, document.body.appendChild(o);
90
+ o(s);
91
+ }, document.body.appendChild(e);
90
92
  });
91
93
  return { initPlugin: async (r) => {
92
94
  await m(async () => {
93
95
  const i = await u();
94
- l(r, i);
96
+ p(r, i);
95
97
  });
96
98
  } };
97
99
  };
98
100
  export {
99
- P as useStripo
101
+ x as useStripo
100
102
  };
@@ -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
+ };