@useinsider/guido 1.0.2-beta.4dd4c2c → 1.0.2-beta.4e8474b

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 (87) hide show
  1. package/README.md +43 -1
  2. package/dist/@types/events.d.ts +6 -0
  3. package/dist/@types/generic.d.ts +5 -0
  4. package/dist/components/Guido.vue.d.ts +3 -0
  5. package/dist/components/Guido.vue.js +10 -10
  6. package/dist/components/Guido.vue2.js +80 -63
  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/email-preview/amp/AmpToggle.vue2.js +14 -15
  10. package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
  11. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  12. package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -9
  13. package/dist/components/organisms/header/RightSlot.vue.d.ts +3 -1
  14. package/dist/components/organisms/header/RightSlot.vue.js +5 -3
  15. package/dist/components/organisms/header/RightSlot.vue2.js +25 -27
  16. package/dist/components/organisms/header/ViewOptions.vue.js +11 -11
  17. package/dist/components/organisms/header/ViewOptions.vue2.js +5 -5
  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 +21 -23
  22. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +14 -14
  23. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +26 -28
  24. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +1 -1
  25. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +11 -9
  26. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +37 -14
  27. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +13 -13
  28. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +38 -28
  29. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +14 -14
  30. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +21 -23
  31. package/dist/components/wrappers/WpDrawer.vue.d.ts +1 -1
  32. package/dist/components/wrappers/WpModal.vue.d.ts +1 -1
  33. package/dist/composables/useCustomInterfaceAppearance.js +22 -18
  34. package/dist/composables/useHtmlCompiler.js +17 -9
  35. package/dist/composables/useHtmlValidator.d.ts +3 -0
  36. package/dist/composables/useHtmlValidator.js +120 -0
  37. package/dist/composables/usePartner.d.ts +1 -0
  38. package/dist/composables/usePartner.js +16 -9
  39. package/dist/composables/usePreviewMode.js +14 -15
  40. package/dist/composables/useRecommendation.d.ts +19 -0
  41. package/dist/composables/useRecommendation.js +27 -0
  42. package/dist/composables/useSave.d.ts +4 -0
  43. package/dist/composables/useSave.js +15 -0
  44. package/dist/composables/useStripo.js +32 -31
  45. package/dist/composables/useStripoEventHandler.js +8 -8
  46. package/dist/composables/useToaster.js +17 -17
  47. package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
  48. package/dist/config/compiler/outlookCompilerRules.js +36 -0
  49. package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
  50. package/dist/config/compiler/recommendationCompilerRules.js +83 -0
  51. package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
  52. package/dist/config/compiler/socialCompilerRules.js +21 -0
  53. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
  54. package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
  55. package/dist/enums/defaults.d.ts +6 -1
  56. package/dist/enums/defaults.js +47 -10
  57. package/dist/enums/html-validator.d.ts +6 -0
  58. package/dist/enums/html-validator.js +7 -0
  59. package/dist/enums/recommendation.d.ts +54 -0
  60. package/dist/enums/recommendation.js +56 -0
  61. package/dist/enums/unsubscribe.d.ts +15 -0
  62. package/dist/enums/unsubscribe.js +17 -0
  63. package/dist/guido.css +1 -1
  64. package/dist/mock/api/validator.d.ts +2 -0
  65. package/dist/services/onboardingApi.d.ts +4 -0
  66. package/dist/services/onboardingApi.js +23 -0
  67. package/dist/static/styles/components/alert-message.css.js +32 -2
  68. package/dist/static/styles/components/button.css.js +32 -2
  69. package/dist/static/styles/components/notification.css.js +55 -0
  70. package/dist/static/styles/components/popup.css.js +68 -0
  71. package/dist/static/styles/components/wide-panel.css.js +13 -0
  72. package/dist/static/styles/customEditorStyle.css.js +24 -0
  73. package/dist/static/styles/variables.css.js +10 -0
  74. package/dist/stores/dynamic-content.d.ts +12 -0
  75. package/dist/stores/dynamic-content.js +7 -6
  76. package/dist/stores/onboarding.d.ts +98 -1028
  77. package/dist/stores/onboarding.js +54 -67
  78. package/dist/stores/preview.js +6 -14
  79. package/dist/stores/recommendation.d.ts +10 -0
  80. package/dist/stores/recommendation.js +9 -0
  81. package/dist/stores/unsubscribe.d.ts +8 -0
  82. package/dist/stores/unsubscribe.js +9 -0
  83. package/dist/utils/genericUtil.js +9 -6
  84. package/dist/utils/templatePreparation.js +21 -14
  85. package/package.json +4 -2
  86. package/dist/composables/useOnboardingApi.d.ts +0 -4
  87. package/dist/composables/useOnboardingApi.js +0 -23
@@ -1,79 +1,73 @@
1
- import { useOnboardingApi as i } from "../composables/useOnboardingApi.js";
2
- import { defineStore as t } from "pinia";
3
- const c = t("onboarding", {
4
- state: () => ({
5
- onboardings: {
6
- newVersionPopup: { cardIndex: 0, isActive: !1, config: [] },
7
- genericOnboarding: { cardIndex: 0, isActive: !1, config: [] },
8
- textBlockOnboarding: { cardIndex: 0, isActive: !1, config: [] },
9
- versionHistoryOnboarding: { cardIndex: 0, isActive: !1, config: [] },
10
- ampOnboarding: { cardIndex: 0, isActive: !1, config: [] }
11
- },
12
- userModalState: {},
13
- isFetched: !1
14
- }),
1
+ import { useOnboardingApi as t } from "../services/onboardingApi.js";
2
+ import { defineStore as s } from "pinia";
3
+ const e = () => ({
4
+ cardIndex: 0,
5
+ isActive: !1,
6
+ config: []
7
+ }), a = () => ({
8
+ onboardings: {
9
+ newVersionPopup: e(),
10
+ genericOnboarding: e(),
11
+ textBlockOnboarding: e(),
12
+ versionHistoryOnboarding: e(),
13
+ ampOnboarding: e()
14
+ },
15
+ userModalState: {},
16
+ isFetched: !1
17
+ }), g = s("onboarding", {
18
+ state: () => a(),
15
19
  getters: {
16
- get: (n) => (o) => n.onboardings[o],
20
+ getOnboarding: (n) => (o) => n.onboardings[o],
17
21
  isActive: (n) => (o) => n.onboardings[o].isActive,
18
22
  getCurrentCard: (n) => (o) => {
19
- const e = n.onboardings[o];
20
- return e.config[e.cardIndex];
21
- },
22
- genericOnboarding: (n) => n.onboardings.genericOnboarding,
23
- textBlockOnboarding: (n) => n.onboardings.textBlockOnboarding,
24
- versionHistoryOnboarding: (n) => n.onboardings.versionHistoryOnboarding,
25
- ampOnboarding: (n) => n.onboardings.ampOnboarding,
26
- genericCurrentCard: (n) => {
27
- const o = n.onboardings.genericOnboarding;
23
+ const i = n.onboardings[o];
24
+ return i.config[i.cardIndex];
25
+ },
26
+ getGenericCurrentCard: (n) => {
27
+ const { genericOnboarding: o } = n.onboardings;
28
28
  return o.config[o.cardIndex];
29
29
  },
30
- textBlockCurrentCard: (n) => {
31
- const o = n.onboardings.textBlockOnboarding;
30
+ getTextBlockCurrentCard: (n) => {
31
+ const { textBlockOnboarding: o } = n.onboardings;
32
32
  return o.config[o.cardIndex];
33
33
  },
34
- versionHistoryCurrentCard: (n) => {
35
- const o = n.onboardings.versionHistoryOnboarding;
34
+ getVersionHistoryCurrentCard: (n) => {
35
+ const { versionHistoryOnboarding: o } = n.onboardings;
36
36
  return o.config[o.cardIndex];
37
37
  },
38
- ampCurrentCard: (n) => {
39
- const o = n.onboardings.ampOnboarding;
38
+ getAmpCurrentCard: (n) => {
39
+ const { ampOnboarding: o } = n.onboardings;
40
40
  return o.config[o.cardIndex];
41
41
  },
42
42
  shouldShowOnboarding: (n) => (o) => {
43
- const e = n.userModalState.Guido;
44
- return e ? !e[o] : !0;
43
+ const i = n.userModalState.Guido;
44
+ return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
45
45
  }
46
46
  },
47
47
  actions: {
48
- start(n) {
49
- Object.keys(this.onboardings).forEach((e) => {
50
- if (e !== n) {
51
- const r = this.onboardings[e];
52
- r.isActive && (r.isActive = !1, r.cardIndex = 0, r.config = []);
53
- }
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 = []);
54
52
  });
55
- const o = this.onboardings[n];
56
- o.cardIndex = 0, o.isActive = !0;
53
+ },
54
+ start(n) {
55
+ this.closeOtherOnboardings(n), this.onboardings[n].cardIndex = 0, this.onboardings[n].isActive = !0;
57
56
  },
58
57
  async close(n) {
59
- await this.setUserModalState(n, "true", "Guido");
60
- const o = this.onboardings[n];
61
- o.isActive = !1, o.cardIndex = 0, o.config = [];
58
+ await this.setUserModalState(n, "true", "Guido"), this.onboardings[n].isActive = !1, this.onboardings[n].cardIndex = 0, this.onboardings[n].config = [];
62
59
  },
63
60
  next(n) {
64
- const o = this.onboardings[n];
65
- o.cardIndex < o.config.length - 1 && o.cardIndex++;
61
+ this.onboardings[n].cardIndex < this.onboardings[n].config.length - 1 && this.onboardings[n].cardIndex++;
66
62
  },
67
63
  previous(n) {
68
- const o = this.onboardings[n];
69
- o.cardIndex > 0 && o.cardIndex--;
64
+ this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
70
65
  },
71
66
  setConfig(n, o) {
72
- const e = this.onboardings[n];
73
- e.config = o ?? [], e.cardIndex >= e.config.length && (e.cardIndex = 0);
67
+ this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
74
68
  },
75
- onDiscoverNowClicked() {
76
- this.start("genericOnboarding");
69
+ async onDiscoverNowClicked() {
70
+ await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
77
71
  },
78
72
  onRemindMeLater() {
79
73
  sessionStorage.setItem("newVersionPopupDismissed", "true");
@@ -85,24 +79,17 @@ const c = t("onboarding", {
85
79
  return Object.values(this.onboardings).some((n) => n.isActive);
86
80
  },
87
81
  async fetchUserModalState() {
88
- if (!this.isFetched)
89
- try {
90
- const { fetchUserModalState: n } = i(), o = await n();
91
- this.userModalState = o.data, this.isFetched = !0;
92
- } catch (n) {
93
- console.error("Failed to fetch user modal state:", n);
94
- }
95
- },
96
- async setUserModalState(n, o, e) {
97
- try {
98
- const { setUserModalState: r } = i();
99
- (await r(n, o, e)).data === 1 && (this.userModalState[e] || (this.userModalState[e] = {}), this.userModalState[e][n] = o === "true");
100
- } catch (r) {
101
- console.error("Failed to set user modal state:", r);
102
- }
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();
103
90
  }
104
91
  }
105
92
  });
106
93
  export {
107
- c as useOnboardingStore
94
+ g as useOnboardingStore
108
95
  };
@@ -1,14 +1,13 @@
1
- import { useOnboardingStore as i } from "./onboarding.js";
2
- import { defineStore as a } from "pinia";
3
- const m = () => ({
1
+ import { defineStore as e } from "pinia";
2
+ const s = () => ({
4
3
  emailFormat: "html",
5
4
  ampHtml: "",
6
5
  ampErrors: [],
7
6
  templateHtml: "",
8
7
  isLoaded: !1,
9
8
  isAMPErrorModalVisible: !1
10
- }), h = a("preview", {
11
- state: () => m(),
9
+ }), a = e("preview", {
10
+ state: () => s(),
12
11
  getters: {
13
12
  isAMPModeEnabled: (t) => t.emailFormat === "AMP",
14
13
  previewHtml() {
@@ -28,14 +27,7 @@ const m = () => ({
28
27
  },
29
28
  actions: {
30
29
  updateAMPData(t) {
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
- }
30
+ this.ampHtml = t.ampHtml ?? "", this.ampErrors = t.ampErrors ?? [], this.emailFormat = t.ampHtml ? "AMP" : "html";
39
31
  },
40
32
  setEmailFormat(t) {
41
33
  this.emailFormat = t;
@@ -49,5 +41,5 @@ const m = () => ({
49
41
  }
50
42
  });
51
43
  export {
52
- h as usePreviewStore
44
+ a as usePreviewStore
53
45
  };
@@ -0,0 +1,10 @@
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 {};
@@ -0,0 +1,9 @@
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
+ };
@@ -0,0 +1,8 @@
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 {};
@@ -0,0 +1,9 @@
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
+ };
@@ -1,11 +1,14 @@
1
- const l = (e) => e.map((a) => ({
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
+ } : {
2
5
  label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
3
6
  value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
4
- })), t = () => {
5
- var e;
6
- return ((e = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : e.getAttribute("content")) ?? "";
7
+ }), r = () => {
8
+ var l;
9
+ return ((l = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : l.getAttribute("content")) ?? "";
7
10
  };
8
11
  export {
9
- l as dynamicContentToMergeTags,
10
- t as getCsrfToken
12
+ e as dynamicContentToMergeTags,
13
+ r as getCsrfToken
11
14
  };
@@ -1,21 +1,28 @@
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();
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();
5
6
  return {
6
7
  prepareTemplateDetails: async () => {
7
- const { html: n, ampHtml: s = "", ampErrors: o = [] } = await e({
8
+ const { html: a, ampHtml: s = "", ampErrors: m = [] } = await i({
8
9
  minimize: !0,
9
10
  resetDataSavedFlag: !1
10
- }), { html: m, css: i, syncModulesIds: r = [] } = await a();
11
- return {
12
- dynamicContentList: t.getSelectedDynamicContentList,
13
- compiledHtml: n,
14
- rawHtml: m,
15
- css: i,
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,
16
23
  ampHtml: s,
17
- ampErrors: o,
18
- modules: r,
24
+ ampErrors: m,
25
+ modules: l,
19
26
  recommendation: {
20
27
  campaignUrls: {},
21
28
  configs: {}
@@ -29,5 +36,5 @@ const y = () => {
29
36
  };
30
37
  };
31
38
  export {
32
- y as useTemplatePreparation
39
+ H as useTemplatePreparation
33
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.2-beta.4dd4c2c",
3
+ "version": "1.0.2-beta.4e8474b",
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,7 +24,8 @@
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"
27
+ "test:visual-update": "npx playwright test --update-snapshots --reporter html",
28
+ "prepare": "husky"
28
29
  },
29
30
  "keywords": [],
30
31
  "author": "",
@@ -65,6 +66,7 @@
65
66
  "eslint-plugin-vue": "10.1.0",
66
67
  "eslint-plugin-vue-scoped-css": "2.6.1",
67
68
  "globals": "16.0.0",
69
+ "husky": "9.1.7",
68
70
  "msw": "2.10.3",
69
71
  "sass": "1.69.7",
70
72
  "typescript": "5.5.4",
@@ -1,4 +0,0 @@
1
- export declare const useOnboardingApi: () => {
2
- fetchUserModalState: () => Promise<import("@@/Composables/useHttp").HttpResponse<unknown>>;
3
- setUserModalState: (modal: string, state: string, page: string) => Promise<import("@@/Composables/useHttp").HttpResponse<unknown>>;
4
- };
@@ -1,23 +0,0 @@
1
- import { useHttp as a } from "./useHttp.js";
2
- const d = () => {
3
- const { get: r } = a();
4
- return {
5
- fetchUserModalState: async () => {
6
- try {
7
- return await r("/user-modal-state/get");
8
- } catch (e) {
9
- throw console.error("fetchUserModalState error:", e), e;
10
- }
11
- },
12
- setUserModalState: async (e, o, s) => {
13
- try {
14
- return await r(`/user-modal-state/set?modal=${e}&state=${o}&page=${s}`);
15
- } catch (t) {
16
- throw console.error("setUserModalState error:", t), t;
17
- }
18
- }
19
- };
20
- };
21
- export {
22
- d as useOnboardingApi
23
- };