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

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 (32) hide show
  1. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  2. package/dist/components/organisms/header/RightSlot.vue2.js +25 -20
  3. package/dist/composables/useHtmlCompiler.js +9 -17
  4. package/dist/config/compiler/outlookCompilerRules.d.ts +0 -2
  5. package/dist/enums/defaults.d.ts +1 -5
  6. package/dist/enums/defaults.js +8 -12
  7. package/dist/utils/templatePreparation.js +14 -21
  8. package/package.json +2 -4
  9. package/dist/composables/useHtmlValidator.d.ts +0 -3
  10. package/dist/composables/useHtmlValidator.js +0 -120
  11. package/dist/composables/useRecommendation.d.ts +0 -19
  12. package/dist/composables/useRecommendation.js +0 -27
  13. package/dist/composables/useSave.d.ts +0 -3
  14. package/dist/composables/useSave.js +0 -14
  15. package/dist/config/compiler/outlookCompilerRules.js +0 -36
  16. package/dist/config/compiler/recommendationCompilerRules.d.ts +0 -2
  17. package/dist/config/compiler/recommendationCompilerRules.js +0 -83
  18. package/dist/config/compiler/socialCompilerRules.d.ts +0 -2
  19. package/dist/config/compiler/socialCompilerRules.js +0 -21
  20. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +0 -2
  21. package/dist/config/compiler/unsubscribeCompilerRules.js +0 -64
  22. package/dist/enums/html-validator.d.ts +0 -6
  23. package/dist/enums/html-validator.js +0 -7
  24. package/dist/enums/recommendation.d.ts +0 -54
  25. package/dist/enums/recommendation.js +0 -56
  26. package/dist/enums/unsubscribe.d.ts +0 -15
  27. package/dist/enums/unsubscribe.js +0 -17
  28. package/dist/mock/api/validator.d.ts +0 -2
  29. package/dist/stores/recommendation.d.ts +0 -10
  30. package/dist/stores/recommendation.js +0 -9
  31. package/dist/stores/unsubscribe.d.ts +0 -8
  32. package/dist/stores/unsubscribe.js +0 -9
@@ -3,7 +3,7 @@ import a from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var l = function() {
4
4
  var s, i;
5
5
  var o = this, e = o._self._c, t = o._self._setupProxy;
6
- return e("div", { staticClass: "d-f" }, [(s = t.config.features) != null && s.versionHistory ? e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }) : o._e(), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isExportButtonDisabled, "label-text-status": !1, "loading-status": t.isExporting, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.handleExport } }), (i = t.config.features) != null && i.saveAsTemplate ? e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isSaveAsButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") }, on: { click: t.handleSaveAs } }) : o._e(), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button"), "tooltip-text": t.trans("newsletter.test-email") } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "loading-status": t.isSaving }, on: { click: t.handleSave } })], 1);
6
+ return e("div", { staticClass: "d-f" }, [(s = t.config.features) != null && s.versionHistory ? e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }) : o._e(), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isExportButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.exportHtml } }), (i = t.config.features) != null && i.saveAsTemplate ? e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isSaveAsButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") }, on: { click: t.handleSaveAs } }) : o._e(), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button"), "tooltip-text": t.trans("newsletter.test-email") } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "loading-status": t.isSaving }, on: { click: t.handleSave } })], 1);
7
7
  }, r = [], d = /* @__PURE__ */ a(
8
8
  n,
9
9
  l,
@@ -1,31 +1,36 @@
1
- import { defineComponent as v, ref as p, computed as d } from "vue";
1
+ import { defineComponent as v, ref as S, computed as d } from "vue";
2
2
  import { useConfig as y } from "../../../composables/useConfig.js";
3
- import { useExport as S } from "../../../composables/useExport.js";
4
- import { useSave as g } from "../../../composables/useSave.js";
5
- import { useTranslations as h } from "../../../composables/useTranslations.js";
6
- import { useVersionHistoryApi as H } from "../../../composables/useVersionHistoryApi.js";
7
- import { useEditorStore as _ } from "../../../stores/editor.js";
8
- import { getTooltipOptions as V } from "../../../utils/tooltipUtils.js";
9
- import { InButtonV2 as x } from "@useinsider/design-system-vue";
10
- const j = /* @__PURE__ */ v({
3
+ import { useExport as g } from "../../../composables/useExport.js";
4
+ import { useSaveStart as h, useSaveComplete as H } from "../../../composables/useGuidoActions.js";
5
+ import { useTranslations as _ } from "../../../composables/useTranslations.js";
6
+ import { useVersionHistoryApi as T } from "../../../composables/useVersionHistoryApi.js";
7
+ import { useEditorStore as V } from "../../../stores/editor.js";
8
+ import { useTemplatePreparation as w } from "../../../utils/templatePreparation.js";
9
+ import { getTooltipOptions as x } from "../../../utils/tooltipUtils.js";
10
+ import { InButtonV2 as C } from "@useinsider/design-system-vue";
11
+ const q = /* @__PURE__ */ v({
11
12
  __name: "RightSlot",
12
- setup(w) {
13
- const { config: l } = y(), { exportHtml: r } = S(), { save: n } = g(), { openVersionHistory: i, closeVersionHistory: a } = H(), o = _(), t = h(), e = p(!1), s = p(!1), m = () => {
14
- if (o.isVersionHistoryOpen) {
13
+ setup(O) {
14
+ const { config: p } = y(), { exportHtml: m } = g(), s = h(), n = H(), { openVersionHistory: i, closeVersionHistory: a } = T(), t = V(), e = _(), o = S(!1), l = () => {
15
+ if (t.isVersionHistoryOpen) {
15
16
  a();
16
17
  return;
17
18
  }
18
19
  i();
19
- }, u = async () => {
20
- e.value = !0, await r(), e.value = !1;
21
20
  }, c = () => {
22
- o.isSaveAsTemplateDrawerOpen = !0;
23
- }, f = d(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history"));
24
- return { __sfc: !0, config: l, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, handleVersionHistory: m, handleExport: u, handleSaveAs: c, versionHistoryTooltipText: f, handleSave: async () => {
25
- s.value = !0, o.loadingStatus = !0, await n(), s.value = !1, o.loadingStatus = !1;
26
- }, getTooltipOptions: V, InButtonV2: x };
21
+ t.isSaveAsTemplateDrawerOpen = !0;
22
+ }, f = d(() => t.isVersionHistoryOpen ? e("newsletter.close-version-history") : e("newsletter.version-history"));
23
+ return { __sfc: !0, config: p, exportHtml: m, saveStart: s, saveComplete: n, openVersionHistory: i, closeVersionHistory: a, editorStore: t, trans: e, isSaving: o, handleVersionHistory: l, handleSaveAs: c, versionHistoryTooltipText: f, handleSave: async () => {
24
+ o.value = !0, t.loadingStatus = !0, s();
25
+ try {
26
+ const { prepareTemplateDetails: r } = w(), u = await r();
27
+ n(u), o.value = !1, t.loadingStatus = !1;
28
+ } catch (r) {
29
+ console.error("Failed to get template data for save:", r);
30
+ }
31
+ }, getTooltipOptions: x, InButtonV2: C };
27
32
  }
28
33
  });
29
34
  export {
30
- j as default
35
+ q as default
31
36
  };
@@ -1,25 +1,17 @@
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,
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,
15
7
  ...l.map((o, i) => ({
16
8
  ...o,
17
9
  priority: o.priority + 1e3 + i
18
10
  // Ensure additional rules run after default rules
19
11
  }))
20
- ], r = c(m);
21
- return { compileHtml: (o) => r.compile(o) };
12
+ ], m = p(t);
13
+ return { compileHtml: (o) => m.compile(o) };
22
14
  };
23
15
  export {
24
- h as useHtmlCompiler
16
+ R as useHtmlCompiler
25
17
  };
@@ -1,2 +0,0 @@
1
- import type { CompilerRule } from '@@/Types/html-compiler';
2
- export declare const outlookCompilerRules: CompilerRule[];
@@ -1,11 +1,7 @@
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
- };
7
3
  export declare const DefaultProductType = "email";
8
4
  export declare const DefaultUsername = "Guido User";
9
- export declare const DefaultMessageType: number;
5
+ export declare const DefaultMessageType = 1;
10
6
  export declare const EditorType: number;
11
7
  export declare const ProductIds: Record<string, number>;
@@ -1,4 +1,4 @@
1
- const t = {
1
+ const e = {
2
2
  translationsPath: "window.trans.en",
3
3
  emailHeader: {
4
4
  senderName: "",
@@ -10,19 +10,15 @@ const t = {
10
10
  versionHistory: !0
11
11
  },
12
12
  useHeader: !0
13
- }, e = {
14
- promotional: 1,
15
- transactional: 2
16
- }, a = "email", o = "Guido User", s = e.promotional, n = 2, r = {
13
+ }, t = "email", s = "Guido User", a = 1, r = 2, n = {
17
14
  email: 60,
18
15
  architect: 49
19
16
  };
20
17
  export {
21
- t as DefaultGuidoConfig,
22
- s as DefaultMessageType,
23
- a as DefaultProductType,
24
- o as DefaultUsername,
25
- n as EditorType,
26
- r as ProductIds,
27
- e as TemplateTypes
18
+ e as DefaultGuidoConfig,
19
+ a as DefaultMessageType,
20
+ t as DefaultProductType,
21
+ s as DefaultUsername,
22
+ r as EditorType,
23
+ n as ProductIds
28
24
  };
@@ -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.c122fb4",
3
+ "version": "1.0.2-beta.c3f86dc",
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 $ } from "./useToaster.js";
9
- import { useTranslations as j } from "./useTranslations.js";
10
- const tt = () => {
11
- var f;
12
- const { showToaster: a } = $(), { post: y } = X(), { config: C } = V(), o = j(), m = D(), d = ((f = C.partner) == null ? void 0 : f.messageType) === H.transactional, h = async (t) => {
13
- const i = await y(
14
- "/newsletter/1/check-html-body",
15
- { html: P(t) }
16
- ), { status: c, message: n } = i.data;
17
- return c || a({
18
- type: r.Alert,
19
- message: c === void 0 ? n : o("newsletter.invalid-url-link-for-toaster")
20
- }), o(_), n === o(R) && a({
21
- type: r.Alert,
22
- message: o("newsletter.already-in-progress")
23
- }), c;
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 i = !0;
27
- return e !== null && !d && e.forEach((c) => {
28
- const n = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
29
- if (n && n.length > 0) {
30
- const [l] = n;
31
- v(l) && !s.includes(l) && (a({
32
- type: r.Warning,
33
- message: o("custom-fields.invalid-custom-fields")
34
- }), i = !1);
35
- }
36
- }), i;
37
- }, E = async (t, s, e) => {
38
- const i = e ? await h(t) : !0;
39
- return S(t, s) && i;
40
- }, T = (t) => t.length > 0 ? !0 : (a({
41
- type: r.Warning,
42
- message: o("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: o("custom-fields.missing-closing-braces")
48
- }), s < e && a({
49
- type: r.Warning,
50
- message: o("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: o("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 && !d) {
61
- const i = s.map((n) => n.toLowerCase()), c = e.some((n) => {
62
- const l = n.replace("{{", "").replace("}}", "").trim().toLowerCase();
63
- return !i.includes(l) || l === "";
64
- });
65
- return c && a({
66
- type: r.Warning,
67
- message: o("custom-fields.invalid-custom-fields")
68
- }), !c;
69
- }
70
- return !0;
71
- }, x = (t) => {
72
- const s = t.match(/{%(.*?)%}/g), e = [];
73
- let i = !0;
74
- if (s && s.forEach((c) => {
75
- const n = c.match(O), l = c.match(B), L = (n == null ? void 0 : n.join("")) || "";
76
- (!n || c !== L) && !l && (a({
77
- type: r.Alert,
78
- message: o("newsletter.display-conditions-invalid-syntax")
79
- }), i = !1), n && n.forEach((u) => {
80
- u.trim() === "=" && (a({
81
- type: r.Alert,
82
- message: o("custom-conditions.wrong-equality-operators")
83
- }), i = !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"), n = e.filter((l) => l === "endif");
91
- c.length !== n.length && (a({
92
- type: r.Alert,
93
- message: o("custom-conditions.missing-if-endif-tag")
94
- }), i = !1);
95
- }
96
- return i;
97
- }, b = (t) => {
98
- const s = (t.match(/{% /gm) || []).length, e = (t.match(/ %}/gm) || []).length, i = s === e;
99
- return i || a({
100
- type: r.Warning,
101
- message: o("custom-conditions.no-space-after-braces")
102
- }), i;
103
- }, N = (t) => (t.match(/({%(.*?)%})/g) || []).filter((e) => e.includes("if")).map((e) => (e.match(/{{.*}}/gm) || []).length).reduce((e, i) => e + i, 0) > 0 ? (a({
104
- type: r.Warning,
105
- message: o("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: o("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: o("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,3 +0,0 @@
1
- export declare const useSave: () => {
2
- save: () => Promise<void>;
3
- };
@@ -1,14 +0,0 @@
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,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[];
@@ -1,64 +0,0 @@
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,6 +0,0 @@
1
- export declare const CanNotMakeAnyChangesForRunningKey = "newsletter.already-in-progress";
2
- export declare const CanNotMakeAnyChangesKey = "newsletter.can-not-make-any-changes";
3
- export declare const CampaignCouldNotBeSavedKey = "newsletter.campaign-could-not-be-saved";
4
- export declare const DISPLAY_CONDITIONS_REGEX: RegExp;
5
- export declare const DISPLAY_CONDITIONS_EXCEPTIONS_REGEX: RegExp;
6
- export declare const REMOVE_CONDITIONS_REGEX: RegExp;
@@ -1,7 +0,0 @@
1
- const e = "newsletter.already-in-progress", n = "newsletter.campaign-could-not-be-saved", o = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, a = /{%( )*now( )(".*")( )*%}/gm;
2
- export {
3
- n as CampaignCouldNotBeSavedKey,
4
- e as CanNotMakeAnyChangesForRunningKey,
5
- a as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
6
- o as DISPLAY_CONDITIONS_REGEX
7
- };
@@ -1,54 +0,0 @@
1
- export declare const DefaultPadding = 20;
2
- export declare const MinDeviceViewport = 320;
3
- export declare const VerticalOrientation = "vertical";
4
- export declare const DUMMY_IMAGE_MAPPINGS: {
5
- CART_ABANDONMENT: {
6
- ins_apr_img_1: string;
7
- ins_apr_img_2: string;
8
- ins_apr_img_3: string;
9
- ins_apr_img_4: string;
10
- };
11
- BROWSE_ABANDONMENT: {
12
- browsed_item_img_1: string;
13
- browsed_item_img_2: string;
14
- browsed_item_img_3: string;
15
- browsed_item_img_4: string;
16
- };
17
- };
18
- export declare const ATTRIBUTES: {
19
- DISCOUNT: string;
20
- OMNIBUS_DISCOUNT: string;
21
- OMNIBUS_PRICE: string;
22
- };
23
- export declare const CONDITIONS: {
24
- IF: {
25
- discount: string;
26
- omnibus_discount: string;
27
- omnibus_price: string;
28
- };
29
- ELSE: string;
30
- END_IF: string;
31
- };
32
- export declare const REGEX: {
33
- ID: RegExp;
34
- ATTRIBUTE_PARAGRAPH: RegExp;
35
- ATTRIBUTE_PARAGRAPH_START_TAG: RegExp;
36
- COMPOSITION: RegExp;
37
- CUSTOM_FIELD: RegExp;
38
- CUSTOM_FIELD_INDEXES_PART: RegExp;
39
- CUSTOM_FIELD_NAME_PART: RegExp;
40
- };
41
- export declare const HTML: {
42
- PARAGRAPH_END_TAG: string;
43
- };
44
- export declare const CSS: {
45
- REGULAR_NAME_HEIGHT: string;
46
- TRIMMED_NAME_HEIGHT: string;
47
- ELLIPSIS: string;
48
- REGULAR_NAME_CONTAINER_HEIGHT: string;
49
- TRIMMED_NAME_CONTAINER_CSS: string;
50
- RESPONSIVE_NAME_SIZE: string;
51
- RESPONSIVE_NAME_HEIGHT: string;
52
- RESPONSIVE_NAME_CONTAINER_HEIGHT: string;
53
- TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS: string;
54
- };
@@ -1,56 +0,0 @@
1
- const s = 20, e = 320, t = {
2
- CART_ABANDONMENT: {
3
- ins_apr_img_1: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_1.png",
4
- ins_apr_img_2: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_2.png",
5
- ins_apr_img_3: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_3.png",
6
- ins_apr_img_4: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/ins_apr_img_4.png"
7
- },
8
- BROWSE_ABANDONMENT: {
9
- browsed_item_img_1: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_1.jpg",
10
- browsed_item_img_2: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_2.jpg",
11
- browsed_item_img_3: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_3.jpg",
12
- browsed_item_img_4: "https://s3-eu-west-1.amazonaws.com/web-image.useinsider.com/email-assets/dummyImages/browsed_item_img_4.jpg"
13
- }
14
- }, i = {
15
- DISCOUNT: "discount",
16
- OMNIBUS_DISCOUNT: "omnibus_discount",
17
- OMNIBUS_PRICE: "omnibus_price"
18
- }, m = {
19
- IF: {
20
- discount: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" %}`,
21
- omnibus_discount: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" and {${i.OMNIBUS_DISCOUNT}} != "0%" and {${i.OMNIBUS_DISCOUNT}} != "" %}`,
22
- omnibus_price: `{% if {${i.DISCOUNT}} != "0%" and {${i.DISCOUNT}} != "" and {${i.OMNIBUS_PRICE}} != "" %}`
23
- },
24
- ELSE: "{% else %}",
25
- END_IF: "{% endif %}"
26
- }, _ = {
27
- ID: /ins-recommendation-v3-campaign-id="(.*?)"/gi,
28
- ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)">[\S\s]*?<\/p>/gm,
29
- ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)">/gm,
30
- COMPOSITION: /composition="true"/gm,
31
- CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
32
- CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
33
- CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
34
- }, a = {
35
- PARAGRAPH_END_TAG: "</p>"
36
- }, n = {
37
- REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
38
- TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
39
- ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
40
- REGULAR_NAME_CONTAINER_HEIGHT: ".ext-product-name.ins-vertical { height:100px!important",
41
- TRIMMED_NAME_CONTAINER_CSS: ".ext-product-name.ins-vertical { height:38px!important; padding:0px!important",
42
- RESPONSIVE_NAME_SIZE: ".ext-product-name p { height:unset!important; width:100%!important;",
43
- RESPONSIVE_NAME_HEIGHT: ".ext-product-name p { height:24px!important;",
44
- RESPONSIVE_NAME_CONTAINER_HEIGHT: ".ext-product-name { height:unset!important",
45
- TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS: ".ext-product-name { height:44px!important; padding:0px!important"
46
- };
47
- export {
48
- i as ATTRIBUTES,
49
- m as CONDITIONS,
50
- n as CSS,
51
- t as DUMMY_IMAGE_MAPPINGS,
52
- s as DefaultPadding,
53
- a as HTML,
54
- e as MinDeviceViewport,
55
- _ as REGEX
56
- };
@@ -1,15 +0,0 @@
1
- export declare const LINK_TYPES: {
2
- UNSUBSCRIBE_LINK_TYPE: number;
3
- PREFERENCES_LINK_TYPE: number;
4
- };
5
- export declare const LINK_REGEXES: {
6
- UNSUBSCRIBE_LINK_REGEX: RegExp;
7
- DATA_OGSB_BUTTON_CSS_REGEX: string;
8
- GLOBAL_UNSUBSCRIBE_LINK_REGEX: RegExp;
9
- PREFERENCES_UNSUBSCRIBE_LINK_REGEX: RegExp;
10
- };
11
- export declare const URLS: {
12
- UNSUBSCRIBE_URL: string;
13
- PREFERENCES_URL: string;
14
- };
15
- export declare const INSIDER_ID = "iid";
@@ -1,17 +0,0 @@
1
- const E = {
2
- UNSUBSCRIBE_LINK_TYPE: 1,
3
- PREFERENCES_LINK_TYPE: 3
4
- }, s = {
5
- UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
6
- DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
7
- GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
8
- PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
9
- }, _ = {
10
- UNSUBSCRIBE_URL: "https://mail.useinsider.com/user/v1/unsub",
11
- PREFERENCES_URL: "https://mail.useinsider.com/user/v1/prefs"
12
- };
13
- export {
14
- s as LINK_REGEXES,
15
- E as LINK_TYPES,
16
- _ as URLS
17
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("msw").HttpHandler[];
2
- export default _default;
@@ -1,10 +0,0 @@
1
- type RecommendationConfig = {
2
- filters: {
3
- value: string;
4
- }[];
5
- };
6
- interface StoreState {
7
- recommendationConfigs: RecommendationConfig[];
8
- }
9
- export declare const useRecommendationStore: import("pinia").StoreDefinition<"recommendation", StoreState, {}, {}>;
10
- export {};
@@ -1,9 +0,0 @@
1
- import { defineStore as e } from "pinia";
2
- const t = () => ({
3
- recommendationConfigs: []
4
- }), n = e("recommendation", {
5
- state: () => t()
6
- });
7
- export {
8
- n as useRecommendationStore
9
- };
@@ -1,8 +0,0 @@
1
- type UnsubscribePage = {
2
- type: number;
3
- };
4
- interface StoreState {
5
- selectedUnsubscribePages: UnsubscribePage[];
6
- }
7
- export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"unsubscribe", StoreState, {}, {}>;
8
- export {};
@@ -1,9 +0,0 @@
1
- import { defineStore as e } from "pinia";
2
- const t = () => ({
3
- selectedUnsubscribePages: []
4
- }), r = e("unsubscribe", {
5
- state: () => t()
6
- });
7
- export {
8
- r as useUnsubscribeStore
9
- };