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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +24 -1
  2. package/dist/@types/events.d.ts +6 -0
  3. package/dist/components/Guido.vue.js +2 -2
  4. package/dist/components/Guido.vue2.js +41 -39
  5. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  6. package/dist/components/organisms/header/RightSlot.vue2.js +20 -25
  7. package/dist/components/organisms/header/ViewOptions.vue.js +11 -11
  8. package/dist/components/organisms/header/ViewOptions.vue2.js +5 -5
  9. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +11 -11
  10. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +5 -5
  11. package/dist/components/organisms/onboarding/AMPOnboarding.vue.d.ts +2 -0
  12. package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +20 -0
  13. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +37 -0
  14. package/dist/components/organisms/onboarding/GenericOnboarding.vue.d.ts +2 -0
  15. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +21 -0
  16. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +83 -0
  17. package/dist/components/organisms/onboarding/NewVersionPopup.vue.d.ts +2 -0
  18. package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +17 -0
  19. package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +30 -0
  20. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +2 -0
  21. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +19 -0
  22. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -0
  23. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.d.ts +2 -0
  24. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +21 -0
  25. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +74 -0
  26. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts +2 -0
  27. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +20 -0
  28. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +37 -0
  29. package/dist/composables/useHtmlCompiler.js +17 -9
  30. package/dist/composables/useHtmlValidator.d.ts +3 -0
  31. package/dist/composables/useHtmlValidator.js +120 -0
  32. package/dist/composables/usePartner.d.ts +1 -0
  33. package/dist/composables/usePartner.js +16 -9
  34. package/dist/composables/useRecommendation.d.ts +19 -0
  35. package/dist/composables/useRecommendation.js +27 -0
  36. package/dist/composables/useSave.d.ts +3 -0
  37. package/dist/composables/useSave.js +14 -0
  38. package/dist/composables/useStripo.js +37 -35
  39. package/dist/composables/useStripoEventHandler.d.ts +3 -0
  40. package/dist/composables/useStripoEventHandler.js +20 -0
  41. package/dist/config/compiler/outlookCompilerRules.d.ts +2 -0
  42. package/dist/config/compiler/outlookCompilerRules.js +36 -0
  43. package/dist/config/compiler/recommendationCompilerRules.d.ts +2 -0
  44. package/dist/config/compiler/recommendationCompilerRules.js +83 -0
  45. package/dist/config/compiler/socialCompilerRules.d.ts +2 -0
  46. package/dist/config/compiler/socialCompilerRules.js +21 -0
  47. package/dist/config/compiler/unsubscribeCompilerRules.d.ts +2 -0
  48. package/dist/config/compiler/unsubscribeCompilerRules.js +64 -0
  49. package/dist/enums/defaults.d.ts +6 -1
  50. package/dist/enums/defaults.js +45 -9
  51. package/dist/enums/html-validator.d.ts +6 -0
  52. package/dist/enums/html-validator.js +7 -0
  53. package/dist/enums/onboarding.d.ts +1 -0
  54. package/dist/enums/onboarding.js +8 -0
  55. package/dist/enums/recommendation.d.ts +54 -0
  56. package/dist/enums/recommendation.js +56 -0
  57. package/dist/enums/unsubscribe.d.ts +15 -0
  58. package/dist/enums/unsubscribe.js +17 -0
  59. package/dist/guido.css +1 -1
  60. package/dist/mock/api/user-modal-state.d.ts +2 -0
  61. package/dist/mock/api/validator.d.ts +2 -0
  62. package/dist/services/onboardingApi.d.ts +4 -0
  63. package/dist/services/onboardingApi.js +23 -0
  64. package/dist/static/assets/onboarding-img.svg.js +4 -0
  65. package/dist/stores/editor.d.ts +21 -0
  66. package/dist/stores/editor.js +2 -1
  67. package/dist/stores/onboarding.d.ts +1068 -0
  68. package/dist/stores/onboarding.js +95 -0
  69. package/dist/stores/recommendation.d.ts +10 -0
  70. package/dist/stores/recommendation.js +9 -0
  71. package/dist/stores/unsubscribe.d.ts +8 -0
  72. package/dist/stores/unsubscribe.js +9 -0
  73. package/dist/utils/templatePreparation.js +21 -14
  74. package/package.json +4 -2
@@ -0,0 +1,95 @@
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(),
19
+ getters: {
20
+ getOnboarding: (n) => (o) => n.onboardings[o],
21
+ isActive: (n) => (o) => n.onboardings[o].isActive,
22
+ getCurrentCard: (n) => (o) => {
23
+ const i = n.onboardings[o];
24
+ return i.config[i.cardIndex];
25
+ },
26
+ getGenericCurrentCard: (n) => {
27
+ const { genericOnboarding: o } = n.onboardings;
28
+ return o.config[o.cardIndex];
29
+ },
30
+ getTextBlockCurrentCard: (n) => {
31
+ const { textBlockOnboarding: o } = n.onboardings;
32
+ return o.config[o.cardIndex];
33
+ },
34
+ getVersionHistoryCurrentCard: (n) => {
35
+ const { versionHistoryOnboarding: o } = n.onboardings;
36
+ return o.config[o.cardIndex];
37
+ },
38
+ getAmpCurrentCard: (n) => {
39
+ const { ampOnboarding: o } = n.onboardings;
40
+ return o.config[o.cardIndex];
41
+ },
42
+ shouldShowOnboarding: (n) => (o) => {
43
+ const i = n.userModalState.Guido;
44
+ return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
45
+ }
46
+ },
47
+ 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
+ start(n) {
55
+ this.closeOtherOnboardings(n), this.onboardings[n].cardIndex = 0, this.onboardings[n].isActive = !0;
56
+ },
57
+ async close(n) {
58
+ await this.setUserModalState(n, "true", "Guido"), this.onboardings[n].isActive = !1, this.onboardings[n].cardIndex = 0, this.onboardings[n].config = [];
59
+ },
60
+ next(n) {
61
+ this.onboardings[n].cardIndex < this.onboardings[n].config.length - 1 && this.onboardings[n].cardIndex++;
62
+ },
63
+ previous(n) {
64
+ this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
65
+ },
66
+ setConfig(n, o) {
67
+ this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
68
+ },
69
+ async onDiscoverNowClicked() {
70
+ await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
71
+ },
72
+ onRemindMeLater() {
73
+ sessionStorage.setItem("newVersionPopupDismissed", "true");
74
+ },
75
+ async onNewVersionPopupClose() {
76
+ await this.setUserModalState("newVersionPopup", "true", "Guido");
77
+ },
78
+ isOnboardingActive() {
79
+ return Object.values(this.onboardings).some((n) => n.isActive);
80
+ },
81
+ 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();
90
+ }
91
+ }
92
+ });
93
+ export {
94
+ g as useOnboardingStore
95
+ };
@@ -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,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.c3f86dc",
3
+ "version": "1.0.2-beta.c50c279",
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",