@useinsider/guido 1.0.2-beta.93e2012 → 1.0.2-beta.94d67e3

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 (80) hide show
  1. package/README.md +1 -31
  2. package/dist/@types/events.d.ts +0 -6
  3. package/dist/@types/generic.d.ts +0 -4
  4. package/dist/components/Guido.vue.d.ts +1 -3
  5. package/dist/components/Guido.vue.js +5 -5
  6. package/dist/components/Guido.vue2.js +62 -73
  7. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  8. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -3
  9. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +15 -14
  10. package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +1 -3
  11. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  12. package/dist/components/organisms/header/HeaderWrapper.vue2.js +9 -15
  13. package/dist/components/organisms/header/RightSlot.vue.d.ts +1 -3
  14. package/dist/components/organisms/header/RightSlot.vue.js +3 -5
  15. package/dist/components/organisms/header/RightSlot.vue2.js +27 -25
  16. package/dist/components/organisms/header/ViewOptions.vue.js +4 -4
  17. package/dist/components/organisms/header/ViewOptions.vue2.js +14 -14
  18. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +11 -11
  19. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +5 -5
  20. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +13 -13
  21. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +23 -21
  22. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +14 -14
  23. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +27 -25
  24. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +1 -1
  25. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -36
  26. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +13 -13
  27. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +29 -39
  28. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +14 -14
  29. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +23 -21
  30. package/dist/composables/useCustomInterfaceAppearance.js +18 -22
  31. package/dist/composables/useHtmlCompiler.js +9 -17
  32. package/dist/composables/usePreviewMode.js +15 -14
  33. package/dist/composables/useStripo.js +25 -27
  34. package/dist/composables/useStripoEventHandler.js +8 -8
  35. package/dist/composables/useToaster.js +17 -17
  36. package/dist/config/compiler/outlookCompilerRules.d.ts +0 -2
  37. package/dist/enums/defaults.d.ts +1 -5
  38. package/dist/enums/defaults.js +10 -14
  39. package/dist/guido.css +1 -1
  40. package/dist/services/onboardingApi.d.ts +2 -2
  41. package/dist/services/onboardingApi.js +9 -9
  42. package/dist/static/styles/components/alert-message.css.js +2 -32
  43. package/dist/static/styles/components/button.css.js +2 -32
  44. package/dist/static/styles/components/wide-panel.css.js +1 -5
  45. package/dist/static/styles/customEditorStyle.css.js +0 -6
  46. package/dist/static/styles/variables.css.js +0 -10
  47. package/dist/stores/dynamic-content.d.ts +0 -12
  48. package/dist/stores/dynamic-content.js +6 -7
  49. package/dist/stores/onboarding.d.ts +592 -133
  50. package/dist/stores/onboarding.js +55 -38
  51. package/dist/stores/preview.js +14 -6
  52. package/dist/utils/genericUtil.js +6 -9
  53. package/dist/utils/templatePreparation.js +14 -21
  54. package/package.json +2 -4
  55. package/dist/composables/useHtmlValidator.d.ts +0 -3
  56. package/dist/composables/useHtmlValidator.js +0 -120
  57. package/dist/composables/useRecommendation.d.ts +0 -19
  58. package/dist/composables/useRecommendation.js +0 -27
  59. package/dist/composables/useSave.d.ts +0 -4
  60. package/dist/composables/useSave.js +0 -15
  61. package/dist/config/compiler/outlookCompilerRules.js +0 -36
  62. package/dist/config/compiler/recommendationCompilerRules.d.ts +0 -2
  63. package/dist/config/compiler/recommendationCompilerRules.js +0 -83
  64. package/dist/config/compiler/socialCompilerRules.d.ts +0 -2
  65. package/dist/config/compiler/socialCompilerRules.js +0 -21
  66. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +0 -2
  67. package/dist/config/compiler/unsubscribeCompilerRules.js +0 -64
  68. package/dist/enums/html-validator.d.ts +0 -6
  69. package/dist/enums/html-validator.js +0 -7
  70. package/dist/enums/recommendation.d.ts +0 -54
  71. package/dist/enums/recommendation.js +0 -56
  72. package/dist/enums/unsubscribe.d.ts +0 -15
  73. package/dist/enums/unsubscribe.js +0 -17
  74. package/dist/mock/api/validator.d.ts +0 -2
  75. package/dist/static/styles/components/notification.css.js +0 -55
  76. package/dist/static/styles/components/popup.css.js +0 -68
  77. package/dist/stores/recommendation.d.ts +0 -10
  78. package/dist/stores/recommendation.js +0 -9
  79. package/dist/stores/unsubscribe.d.ts +0 -8
  80. package/dist/stores/unsubscribe.js +0 -9
@@ -1,70 +1,80 @@
1
- import { useOnboardingApi as t } from "../services/onboardingApi.js";
1
+ import { useOnboardingApi as i } from "../services/onboardingApi.js";
2
2
  import { defineStore as s } from "pinia";
3
- const e = () => ({
3
+ const t = () => ({
4
4
  cardIndex: 0,
5
5
  isActive: !1,
6
6
  config: []
7
7
  }), a = () => ({
8
8
  onboardings: {
9
- newVersionPopup: e(),
10
- genericOnboarding: e(),
11
- textBlockOnboarding: e(),
12
- versionHistoryOnboarding: e(),
13
- ampOnboarding: e()
9
+ newVersionPopup: t(),
10
+ genericOnboarding: t(),
11
+ textBlockOnboarding: t(),
12
+ versionHistoryOnboarding: t(),
13
+ ampOnboarding: t()
14
14
  },
15
15
  userModalState: {},
16
16
  isFetched: !1
17
- }), g = s("onboarding", {
17
+ }), b = s("onboarding", {
18
18
  state: () => a(),
19
19
  getters: {
20
- getOnboarding: (n) => (o) => n.onboardings[o],
20
+ get: (n) => (o) => n.onboardings[o],
21
21
  isActive: (n) => (o) => n.onboardings[o].isActive,
22
22
  getCurrentCard: (n) => (o) => {
23
- const i = n.onboardings[o];
24
- return i.config[i.cardIndex];
25
- },
26
- getGenericCurrentCard: (n) => {
23
+ const e = n.onboardings[o];
24
+ return e.config[e.cardIndex];
25
+ },
26
+ genericOnboarding: (n) => n.onboardings.genericOnboarding,
27
+ textBlockOnboarding: (n) => n.onboardings.textBlockOnboarding,
28
+ versionHistoryOnboarding: (n) => n.onboardings.versionHistoryOnboarding,
29
+ ampOnboarding: (n) => n.onboardings.ampOnboarding,
30
+ genericCurrentCard: (n) => {
27
31
  const { genericOnboarding: o } = n.onboardings;
28
32
  return o.config[o.cardIndex];
29
33
  },
30
- getTextBlockCurrentCard: (n) => {
34
+ textBlockCurrentCard: (n) => {
31
35
  const { textBlockOnboarding: o } = n.onboardings;
32
36
  return o.config[o.cardIndex];
33
37
  },
34
- getVersionHistoryCurrentCard: (n) => {
38
+ versionHistoryCurrentCard: (n) => {
35
39
  const { versionHistoryOnboarding: o } = n.onboardings;
36
40
  return o.config[o.cardIndex];
37
41
  },
38
- getAmpCurrentCard: (n) => {
42
+ ampCurrentCard: (n) => {
39
43
  const { ampOnboarding: o } = n.onboardings;
40
44
  return o.config[o.cardIndex];
41
45
  },
42
46
  shouldShowOnboarding: (n) => (o) => {
43
- const i = n.userModalState.Guido;
44
- return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
47
+ const e = n.userModalState.Guido;
48
+ return o === "newVersionPopup" && (e != null && e.genericOnboarding) ? !1 : e ? !e[o] : !0;
45
49
  }
46
50
  },
47
51
  actions: {
48
- closeOtherOnboardings(n) {
49
- Object.keys(this.onboardings).forEach((o) => {
50
- const i = o;
51
- i !== n && this.onboardings[i].isActive && (this.onboardings[i].isActive = !1, this.onboardings[i].cardIndex = 0, this.onboardings[i].config = []);
52
- });
53
- },
54
52
  start(n) {
55
- this.closeOtherOnboardings(n), this.onboardings[n].cardIndex = 0, this.onboardings[n].isActive = !0;
53
+ Object.keys(this.onboardings).forEach((e) => {
54
+ if (e !== n) {
55
+ const r = this.onboardings[e];
56
+ r.isActive && (r.isActive = !1, r.cardIndex = 0, r.config = []);
57
+ }
58
+ });
59
+ const o = this.onboardings[n];
60
+ o.cardIndex = 0, o.isActive = !0;
56
61
  },
57
62
  async close(n) {
58
- await this.setUserModalState(n, "true", "Guido"), this.onboardings[n].isActive = !1, this.onboardings[n].cardIndex = 0, this.onboardings[n].config = [];
63
+ await this.setUserModalState(n, "true", "Guido");
64
+ const o = this.onboardings[n];
65
+ o.isActive = !1, o.cardIndex = 0, o.config = [];
59
66
  },
60
67
  next(n) {
61
- this.onboardings[n].cardIndex < this.onboardings[n].config.length - 1 && this.onboardings[n].cardIndex++;
68
+ const o = this.onboardings[n];
69
+ o.cardIndex < o.config.length - 1 && o.cardIndex++;
62
70
  },
63
71
  previous(n) {
64
- this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
72
+ const o = this.onboardings[n];
73
+ o.cardIndex > 0 && o.cardIndex--;
65
74
  },
66
75
  setConfig(n, o) {
67
- this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
76
+ const e = this.onboardings[n];
77
+ e.config = o ?? [], e.cardIndex >= e.config.length && (e.cardIndex = 0);
68
78
  },
69
79
  async onDiscoverNowClicked() {
70
80
  await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
@@ -79,17 +89,24 @@ const e = () => ({
79
89
  return Object.values(this.onboardings).some((n) => n.isActive);
80
90
  },
81
91
  async fetchUserModalState() {
82
- if (this.isFetched)
83
- return;
84
- const { fetchUserModalState: n } = t(), o = await n();
85
- this.userModalState = o, this.isFetched = !0;
86
- },
87
- async setUserModalState(n, o, i) {
88
- const { setUserModalState: r } = t();
89
- await r(n, o, i), this.isFetched = !1, await this.fetchUserModalState();
92
+ if (!this.isFetched)
93
+ try {
94
+ const { fetchUserModalState: n } = i(), o = await n();
95
+ this.userModalState = o.data, this.isFetched = !0;
96
+ } catch (n) {
97
+ console.error("Failed to fetch user modal state:", n);
98
+ }
99
+ },
100
+ async setUserModalState(n, o, e) {
101
+ try {
102
+ const { setUserModalState: r } = i();
103
+ (await r(n, o, e)).data === 1 && (this.userModalState[e] || (this.userModalState[e] = {}), this.userModalState[e][n] = o === "true");
104
+ } catch (r) {
105
+ console.error("Failed to set user modal state:", r);
106
+ }
90
107
  }
91
108
  }
92
109
  });
93
110
  export {
94
- g as useOnboardingStore
111
+ b as useOnboardingStore
95
112
  };
@@ -1,13 +1,14 @@
1
- import { defineStore as e } from "pinia";
2
- const s = () => ({
1
+ import { useOnboardingStore as i } from "./onboarding.js";
2
+ import { defineStore as a } from "pinia";
3
+ const m = () => ({
3
4
  emailFormat: "html",
4
5
  ampHtml: "",
5
6
  ampErrors: [],
6
7
  templateHtml: "",
7
8
  isLoaded: !1,
8
9
  isAMPErrorModalVisible: !1
9
- }), a = e("preview", {
10
- state: () => s(),
10
+ }), h = a("preview", {
11
+ state: () => m(),
11
12
  getters: {
12
13
  isAMPModeEnabled: (t) => t.emailFormat === "AMP",
13
14
  previewHtml() {
@@ -27,7 +28,14 @@ const s = () => ({
27
28
  },
28
29
  actions: {
29
30
  updateAMPData(t) {
30
- this.ampHtml = t.ampHtml ?? "", this.ampErrors = t.ampErrors ?? [], this.emailFormat = t.ampHtml ? "AMP" : "html";
31
+ var s;
32
+ const r = !!((s = this.ampHtml) != null && s.trim());
33
+ this.ampHtml = t.ampHtml ?? "", this.ampErrors = t.ampErrors ?? [];
34
+ const o = t.ampHtml ? "AMP" : "html";
35
+ if (this.emailFormat = o, !r && o === "AMP") {
36
+ const e = i();
37
+ e.shouldShowOnboarding("ampOnboarding") && e.start("ampOnboarding");
38
+ }
31
39
  },
32
40
  setEmailFormat(t) {
33
41
  this.emailFormat = t;
@@ -41,5 +49,5 @@ const s = () => ({
41
49
  }
42
50
  });
43
51
  export {
44
- a as usePreviewStore
52
+ h as usePreviewStore
45
53
  };
@@ -1,14 +1,11 @@
1
- const e = (l) => l.map((a) => a.format ? {
2
- label: `${a.text} | ${a.format.key}=${a.format.value}`,
3
- value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
4
- } : {
1
+ const l = (e) => e.map((a) => ({
5
2
  label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
6
3
  value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
7
- }), r = () => {
8
- var l;
9
- return ((l = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : l.getAttribute("content")) ?? "";
4
+ })), t = () => {
5
+ var e;
6
+ return ((e = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : e.getAttribute("content")) ?? "";
10
7
  };
11
8
  export {
12
- e as dynamicContentToMergeTags,
13
- r as getCsrfToken
9
+ l as dynamicContentToMergeTags,
10
+ t as getCsrfToken
14
11
  };
@@ -1,28 +1,21 @@
1
- import { useActionsApi as g } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as S } from "../composables/useHtmlCompiler.js";
3
- import { useDynamicContentStore as f } from "../stores/dynamic-content.js";
4
- const H = () => {
5
- const t = f(), { getCompiledEmail: i, getTemplateData: o } = g(), { compileHtml: n } = S();
1
+ import { useActionsApi as c } from "../composables/useActionsApi.js";
2
+ import { useDynamicContentStore as l } from "../stores/dynamic-content.js";
3
+ const y = () => {
4
+ const t = l(), { getCompiledEmail: e, getTemplateData: a } = c();
6
5
  return {
7
6
  prepareTemplateDetails: async () => {
8
- const { html: a, ampHtml: s = "", ampErrors: m = [] } = await i({
7
+ const { html: n, ampHtml: s = "", ampErrors: o = [] } = await e({
9
8
  minimize: !0,
10
9
  resetDataSavedFlag: !1
11
- }), { html: r, css: c, syncModulesIds: l = [] } = await o(), { compiledHtml: p, stats: e, appliedRules: d } = n(a), u = t.getSelectedDynamicContentList;
12
- return console.debug("HTML Compilation Stats:", {
13
- originalSize: e.originalSize,
14
- compiledSize: e.compiledSize,
15
- reduction: `${e.reductionPercentage.toFixed(2)}%`,
16
- appliedRules: d,
17
- executionTime: `${e.executionTime.toFixed(2)}ms`
18
- }), {
19
- dynamicContentList: u,
20
- compiledHtml: p,
21
- rawHtml: r,
22
- css: c,
10
+ }), { html: m, css: i, syncModulesIds: r = [] } = await a();
11
+ return {
12
+ dynamicContentList: t.getSelectedDynamicContentList,
13
+ compiledHtml: n,
14
+ rawHtml: m,
15
+ css: i,
23
16
  ampHtml: s,
24
- ampErrors: m,
25
- modules: l,
17
+ ampErrors: o,
18
+ modules: r,
26
19
  recommendation: {
27
20
  campaignUrls: {},
28
21
  configs: {}
@@ -36,5 +29,5 @@ const H = () => {
36
29
  };
37
30
  };
38
31
  export {
39
- H as useTemplatePreparation
32
+ y as useTemplatePreparation
40
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.2-beta.93e2012",
3
+ "version": "1.0.2-beta.94d67e3",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -24,8 +24,7 @@
24
24
  "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
25
25
  "lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
26
26
  "type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json",
27
- "test:visual-update": "npx playwright test --update-snapshots --reporter html",
28
- "prepare": "husky"
27
+ "test:visual-update": "npx playwright test --update-snapshots --reporter html"
29
28
  },
30
29
  "keywords": [],
31
30
  "author": "",
@@ -66,7 +65,6 @@
66
65
  "eslint-plugin-vue": "10.1.0",
67
66
  "eslint-plugin-vue-scoped-css": "2.6.1",
68
67
  "globals": "16.0.0",
69
- "husky": "9.1.7",
70
68
  "msw": "2.10.3",
71
69
  "sass": "1.69.7",
72
70
  "typescript": "5.5.4",
@@ -1,3 +0,0 @@
1
- export declare const useHtmlValidator: () => {
2
- validateHtml: (html: string, customFields: string[], isOnSaveValidation?: boolean) => Promise<boolean>;
3
- };
@@ -1,120 +0,0 @@
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,19 +0,0 @@
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 {};
@@ -1,27 +0,0 @@
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
- };
@@ -1,4 +0,0 @@
1
- import { SavedTemplateDetails } from '@@/Types/stripo';
2
- export declare const useSave: () => {
3
- save: (isSilent?: boolean) => Promise<SavedTemplateDetails | undefined>;
4
- };
@@ -1,15 +0,0 @@
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,36 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- import type { CompilerRule } from '@@/Types/html-compiler';
2
- export declare const recommendationCompilerRules: CompilerRule[];
@@ -1,83 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- import type { CompilerRule } from '@@/Types/html-compiler';
2
- export declare const socialCompilerRules: CompilerRule[];
@@ -1,21 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- import type { CompilerRule } from '@@/Types/html-compiler';
2
- export declare const unsubscribeCompilerRules: CompilerRule[];