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

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 (94) hide show
  1. package/README.md +31 -1
  2. package/dist/@types/events.d.ts +6 -0
  3. package/dist/@types/generic.d.ts +4 -0
  4. package/dist/components/Guido.vue.d.ts +3 -1
  5. package/dist/components/Guido.vue.js +2 -2
  6. package/dist/components/Guido.vue2.js +67 -54
  7. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  8. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +3 -2
  9. package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
  10. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  11. package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -9
  12. package/dist/components/organisms/header/RightSlot.vue.d.ts +3 -1
  13. package/dist/components/organisms/header/RightSlot.vue.js +5 -3
  14. package/dist/components/organisms/header/RightSlot.vue2.js +26 -27
  15. package/dist/components/organisms/header/ViewOptions.vue.js +11 -11
  16. package/dist/components/organisms/header/ViewOptions.vue2.js +5 -5
  17. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +11 -11
  18. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +5 -5
  19. package/dist/components/organisms/onboarding/AMPOnboarding.vue.d.ts +2 -0
  20. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +20 -0
  21. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +37 -0
  22. package/dist/components/organisms/onboarding/GenericOnboarding.vue.d.ts +2 -0
  23. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +21 -0
  24. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +83 -0
  25. package/dist/components/organisms/onboarding/NewVersionPopup.vue.d.ts +2 -0
  26. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +17 -0
  27. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +30 -0
  28. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +2 -0
  29. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +19 -0
  30. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -0
  31. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.d.ts +2 -0
  32. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +21 -0
  33. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +74 -0
  34. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts +2 -0
  35. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +20 -0
  36. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +37 -0
  37. package/dist/composables/useCustomInterfaceAppearance.js +22 -18
  38. package/dist/composables/useHtmlCompiler.js +17 -9
  39. package/dist/composables/useHtmlValidator.d.ts +3 -0
  40. package/dist/composables/useHtmlValidator.js +120 -0
  41. package/dist/composables/usePartner.d.ts +1 -0
  42. package/dist/composables/usePartner.js +16 -9
  43. package/dist/composables/useRecommendation.d.ts +19 -0
  44. package/dist/composables/useRecommendation.js +27 -0
  45. package/dist/composables/useSave.d.ts +4 -0
  46. package/dist/composables/useSave.js +15 -0
  47. package/dist/composables/useStripo.js +32 -28
  48. package/dist/composables/useStripoEventHandler.d.ts +3 -0
  49. package/dist/composables/useStripoEventHandler.js +20 -0
  50. package/dist/composables/useToaster.js +17 -17
  51. package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
  52. package/dist/config/compiler/outlookCompilerRules.js +36 -0
  53. package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
  54. package/dist/config/compiler/recommendationCompilerRules.js +83 -0
  55. package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
  56. package/dist/config/compiler/socialCompilerRules.js +21 -0
  57. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
  58. package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
  59. package/dist/enums/defaults.d.ts +6 -1
  60. package/dist/enums/defaults.js +45 -9
  61. package/dist/enums/html-validator.d.ts +6 -0
  62. package/dist/enums/html-validator.js +7 -0
  63. package/dist/enums/onboarding.d.ts +1 -0
  64. package/dist/enums/onboarding.js +8 -0
  65. package/dist/enums/recommendation.d.ts +54 -0
  66. package/dist/enums/recommendation.js +56 -0
  67. package/dist/enums/unsubscribe.d.ts +15 -0
  68. package/dist/enums/unsubscribe.js +17 -0
  69. package/dist/guido.css +1 -1
  70. package/dist/mock/api/user-modal-state.d.ts +2 -0
  71. package/dist/mock/api/validator.d.ts +2 -0
  72. package/dist/services/onboardingApi.d.ts +4 -0
  73. package/dist/services/onboardingApi.js +23 -0
  74. package/dist/static/assets/onboarding-img.svg.js +4 -0
  75. package/dist/static/styles/components/alert-message.css.js +32 -2
  76. package/dist/static/styles/components/button.css.js +32 -2
  77. package/dist/static/styles/components/notification.css.js +55 -0
  78. package/dist/static/styles/components/popup.css.js +68 -0
  79. package/dist/static/styles/components/wide-panel.css.js +5 -1
  80. package/dist/static/styles/customEditorStyle.css.js +6 -0
  81. package/dist/static/styles/variables.css.js +10 -0
  82. package/dist/stores/dynamic-content.d.ts +12 -0
  83. package/dist/stores/dynamic-content.js +7 -6
  84. package/dist/stores/editor.d.ts +21 -0
  85. package/dist/stores/editor.js +2 -1
  86. package/dist/stores/onboarding.d.ts +1068 -0
  87. package/dist/stores/onboarding.js +95 -0
  88. package/dist/stores/recommendation.d.ts +10 -0
  89. package/dist/stores/recommendation.js +9 -0
  90. package/dist/stores/unsubscribe.d.ts +8 -0
  91. package/dist/stores/unsubscribe.js +9 -0
  92. package/dist/utils/genericUtil.js +9 -6
  93. package/dist/utils/templatePreparation.js +21 -14
  94. package/package.json +4 -2
@@ -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,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,22 +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 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;
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;
13
14
  window.UIEditor.initEditor(
14
15
  document.querySelector("#guido-editor"),
15
16
  {
16
- metadata: d,
17
+ metadata: s,
17
18
  html: o,
18
- css: s,
19
- forceRecreate: p,
19
+ css: a,
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: _(s.preselectedDynamicContentList)
44
45
  }
45
46
  ],
46
47
  async onTokenRefreshRequest(t) {
@@ -48,15 +49,17 @@ 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 } = S(), { activateCustomViewStyles: n } = f();
58
+ t(), n(), s.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
59
+ e.hasChanges = !1;
60
+ }, 1e3);
58
61
  } catch (t) {
59
- a(t, "Failed to load custom interface appearance");
62
+ d(t, "Failed to load custom interface appearance");
60
63
  }
61
64
  },
62
65
  onCodeEditorVisibilityChanged(t) {
@@ -71,8 +74,9 @@ const P = (d) => {
71
74
  onDataChanged() {
72
75
  e.hasChanges = !0;
73
76
  },
74
- ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
75
- extensions: [y]
77
+ onEvent: l,
78
+ ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
79
+ extensions: [h]
76
80
  }
77
81
  );
78
82
  }, m = (r) => new Promise((i, e) => {
@@ -84,17 +88,17 @@ const P = (d) => {
84
88
  o.id = "UiEditorScript", o.type = "module", o.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o.onload = () => {
85
89
  r(), i();
86
90
  }, o.onerror = () => {
87
- const s = new Error("Failed to load Stripo UIEditor script");
88
- e(s);
91
+ const a = new Error("Failed to load Stripo UIEditor script");
92
+ e(a);
89
93
  }, document.body.appendChild(o);
90
94
  });
91
95
  return { initPlugin: async (r) => {
92
96
  await m(async () => {
93
97
  const i = await u();
94
- l(r, i);
98
+ p(r, i);
95
99
  });
96
100
  } };
97
101
  };
98
102
  export {
99
- P as useStripo
103
+ R as useStripo
100
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
  };
@@ -0,0 +1,2 @@
1
+ import type { CompilerRule } from '@@/Types/html-compiler';
2
+ export declare const outlookCompilerRules: CompilerRule[];
@@ -0,0 +1,36 @@
1
+ const c = `
2
+ <!--[if gte mso 9]>
3
+ <xml>
4
+ <o:OfficeDocumentSettings>
5
+ <o:AllowPNG></o:AllowPNG>
6
+ <o:PixelsPerInch>96</o:PixelsPerInch>
7
+ </o:OfficeDocumentSettings>
8
+ </xml>
9
+ <![endif]-->`, s = {
10
+ xmlns: "http://www.w3.org/1999/xhtml",
11
+ "xmlns:o": "urn:schemas-microsoft-com:office:office"
12
+ }, r = [
13
+ {
14
+ id: "append-office-xml",
15
+ description: "Appending office XML into the head if it does not exist.",
16
+ type: "custom",
17
+ processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${c}</head>`),
18
+ priority: 70
19
+ },
20
+ {
21
+ id: "set-html-attributes",
22
+ description: "Appending office XML into the head if it does not exist.",
23
+ type: "custom",
24
+ processor: (e) => {
25
+ let t = e;
26
+ return Object.entries(s).forEach(([o, i]) => {
27
+ const n = new RegExp(`${o}="[^"]*"`);
28
+ t.search(n) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
29
+ }), t;
30
+ },
31
+ priority: 71
32
+ }
33
+ ];
34
+ export {
35
+ r as outlookCompilerRules
36
+ };
@@ -0,0 +1,2 @@
1
+ import type { CompilerRule } from '@@/Types/html-compiler';
2
+ export declare const recommendationCompilerRules: CompilerRule[];
@@ -0,0 +1,83 @@
1
+ import { useRecommendation as u } from "../../composables/useRecommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as P, REGEX as i, CSS as e, CONDITIONS as E, ATTRIBUTES as r, HTML as h } from "../../enums/recommendation.js";
3
+ const H = [
4
+ {
5
+ id: "replace-images-with-variable-names",
6
+ description: "Replacing dummy images with variable names in recommendation module",
7
+ type: "custom",
8
+ processor: (a) => {
9
+ let t = a;
10
+ return Object.entries(P).forEach(([, n]) => {
11
+ Object.entries(n).forEach(([s, o]) => {
12
+ t = t.replaceAll(o, `{{${s}}}`);
13
+ });
14
+ }), t;
15
+ },
16
+ priority: 50
17
+ },
18
+ {
19
+ id: "replace-recommendation-button-span-css",
20
+ description: "Replacing recommendation button span css",
21
+ type: "replace",
22
+ search: ".ext-product-button span,",
23
+ replacement: ".ext-product-button,",
24
+ replaceAll: !0,
25
+ priority: 51
26
+ },
27
+ {
28
+ id: "add-recommendation-unresponsive-css",
29
+ description: "Adding recommendation unresponsive css",
30
+ type: "custom",
31
+ processor: (a) => {
32
+ const { getRecommendationCampaignData: t } = u();
33
+ let n = a;
34
+ const s = n.match(i.ID);
35
+ if (s) {
36
+ const o = [];
37
+ if (s.forEach((c) => {
38
+ const m = c.slice(35, c.length - 1).trim();
39
+ t(m);
40
+ }), o.length) {
41
+ const c = `width:${Math.min(...o)}px!important;`;
42
+ n = n.replace(e.REGULAR_NAME_HEIGHT, `${e.TRIMMED_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.REGULAR_NAME_CONTAINER_HEIGHT, e.TRIMMED_NAME_CONTAINER_CSS).replace(e.RESPONSIVE_NAME_SIZE, `${e.RESPONSIVE_NAME_HEIGHT} ${c} ${e.ELLIPSIS}`).replace(e.RESPONSIVE_NAME_CONTAINER_HEIGHT, e.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
43
+ }
44
+ }
45
+ return n;
46
+ },
47
+ priority: 52
48
+ },
49
+ // TODO: prepareRecommendations
50
+ // TODO: addRecommendationCustomFields
51
+ {
52
+ id: "add-discount-conditions",
53
+ description: "Adding discount conditions to the recommendation block",
54
+ type: "custom",
55
+ processor: (a) => {
56
+ let t = a;
57
+ const n = t.match(i.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: s } = u();
58
+ return n !== null && n.forEach((o) => {
59
+ const c = o.match(i.CUSTOM_FIELD);
60
+ if (!c)
61
+ return;
62
+ const [m] = c, p = m.match(i.CUSTOM_FIELD_INDEXES_PART), A = m.match(i.CUSTOM_FIELD_NAME_PART), _ = o.match(i.ATTRIBUTE_PARAGRAPH_START_TAG);
63
+ if (!p || !A || !_)
64
+ return;
65
+ const [l] = p, [T] = A, [d] = _, N = T.substring(1, T.length - 2), R = d.match(i.COMPOSITION) !== null;
66
+ let O = m;
67
+ if (R) {
68
+ const M = l.substring(2, l.length - 3);
69
+ s(M);
70
+ }
71
+ const I = l.substring(2);
72
+ let S = "";
73
+ N in E.IF && (S = E.IF[N].replaceAll(`{${r.DISCOUNT}}`, `${I}${r.DISCOUNT}`).replaceAll(`{${r.OMNIBUS_DISCOUNT}}`, `${I}${r.OMNIBUS_DISCOUNT}`).replaceAll(`{${r.OMNIBUS_PRICE}}`, `${I}${r.OMNIBUS_PRICE}`));
74
+ const $ = `${d}${O}${h.PARAGRAPH_END_TAG}`, C = `${S}${R ? $ : o}${E.ELSE}${d}${h.PARAGRAPH_END_TAG}${E.END_IF}`;
75
+ t = t.replace(o, C);
76
+ }), t;
77
+ },
78
+ priority: 53
79
+ }
80
+ ];
81
+ export {
82
+ H as recommendationCompilerRules
83
+ };
@@ -0,0 +1,2 @@
1
+ import type { CompilerRule } from '@@/Types/html-compiler';
2
+ export declare const socialCompilerRules: CompilerRule[];
@@ -0,0 +1,21 @@
1
+ const a = [
2
+ {
3
+ id: "fix-custom-social-block",
4
+ description: "Fixing custom social block.",
5
+ type: "custom",
6
+ processor: (e) => {
7
+ let c = e;
8
+ const s = c.match(/<table[^>]*?class="[^>]*?es-social[^>]*?"[\S\s]*?<\/table>/gm);
9
+ return s && s.forEach((o) => {
10
+ if (o.match(/<img[^>]*?height="[0-9]+?"/gm)) {
11
+ const i = o.replace(/<img[^>]*?height="[0-9]+?"/gm, (t) => t.replace("height", "width"));
12
+ c = c.replace(o, i);
13
+ }
14
+ }), c;
15
+ },
16
+ priority: 80
17
+ }
18
+ ];
19
+ export {
20
+ a as socialCompilerRules
21
+ };
@@ -0,0 +1,2 @@
1
+ import type { CompilerRule } from '@@/Types/html-compiler';
2
+ export declare const unsubscribeCompilerRules: CompilerRule[];
@@ -0,0 +1,64 @@
1
+ import { usePartner as m } from "../../composables/usePartner.js";
2
+ import { LINK_REGEXES as c, LINK_TYPES as p, URLS as E } from "../../enums/unsubscribe.js";
3
+ import { useUnsubscribeStore as b } from "../../stores/unsubscribe.js";
4
+ const S = [
5
+ {
6
+ id: "add-unsubscribe-link-values",
7
+ description: "Adding unsubscribe link values",
8
+ type: "custom",
9
+ processor: (n) => {
10
+ var a, u;
11
+ const { getPartnerName: i } = m(), t = b();
12
+ let e = n;
13
+ const o = `/${i()}/email/0?user={{iid}}`, r = (a = t.selectedUnsubscribePages) == null ? void 0 : a.find((l) => l.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = t.selectedUnsubscribePages) == null ? void 0 : u.find((l) => l.type === p.PREFERENCES_LINK_TYPE);
14
+ return r && (e = e.replace(
15
+ c.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
16
+ E.UNSUBSCRIBE_URL + o
17
+ )), s && (e = e.replace(
18
+ c.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
19
+ E.PREFERENCES_URL + o
20
+ )), e.replace(c.UNSUBSCRIBE_LINK_REGEX, "");
21
+ },
22
+ priority: 60
23
+ },
24
+ {
25
+ id: "remove-data-ogsb-button-styles",
26
+ description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
27
+ type: "regex",
28
+ pattern: c.DATA_OGSB_BUTTON_CSS_REGEX,
29
+ replacement: "",
30
+ flags: "g",
31
+ priority: 61
32
+ },
33
+ {
34
+ id: "format-comment-braces",
35
+ description: "Adding spaces around comment braces for proper formatting",
36
+ type: "custom",
37
+ processor: (n) => n.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
38
+ priority: 62
39
+ },
40
+ {
41
+ id: "add-universal-link-flags",
42
+ description: "Adding universal link flags",
43
+ type: "custom",
44
+ processor: (n) => {
45
+ let i = n;
46
+ const t = i.match(/<a[^>]+>(.*?)<\/a>/gm);
47
+ return t && t.forEach((e) => {
48
+ if (e.includes("insEmail=1"))
49
+ return;
50
+ if (e.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
51
+ const o = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
52
+ const s = r.slice(6, r.length - 1).trim();
53
+ return r.includes("?") || r.includes("#") ? s.slice(-1) === "&" ? r.replace(s, `${s}insEmail=1`) : r.replace(s, `${s}&insEmail=1`) : r.replace(s, `${s}?insEmail=1`);
54
+ });
55
+ i = i.replace(e, o);
56
+ }
57
+ }), i;
58
+ },
59
+ priority: 63
60
+ }
61
+ ];
62
+ export {
63
+ S as unsubscribeCompilerRules
64
+ };
@@ -1,7 +1,12 @@
1
1
  import type { GuidoConfig } from '@@/Types/generic';
2
2
  export declare const DefaultGuidoConfig: GuidoConfig;
3
+ export declare const TemplateTypes: {
4
+ promotional: number;
5
+ transactional: number;
6
+ };
3
7
  export declare const DefaultProductType = "email";
4
8
  export declare const DefaultUsername = "Guido User";
5
- export declare const DefaultMessageType = 1;
9
+ export declare const DefaultMessageType: number;
6
10
  export declare const EditorType: number;
7
11
  export declare const ProductIds: Record<string, number>;
12
+ export declare const TEST_PARTNER_LIST: string[];