@useinsider/guido 3.1.1-beta.a80cc5e → 3.1.1-beta.b085e4a

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 (41) hide show
  1. package/dist/@types/config/schemas.js +61 -69
  2. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  3. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +20 -12
  4. package/dist/composables/useHtmlCompiler.js +20 -20
  5. package/dist/composables/usePreviewMode.js +16 -20
  6. package/dist/composables/useSave.js +13 -15
  7. package/dist/config/compiler/recommendationCompilerRules.js +158 -44
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +59 -58
  9. package/dist/config/migrator/checkboxMigrator.js +3 -5
  10. package/dist/config/migrator/radioButtonMigrator.js +12 -14
  11. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  12. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -27
  13. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +172 -185
  14. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +93 -95
  15. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +73 -75
  16. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +5 -7
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +29 -30
  18. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  19. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +1 -3
  20. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +50 -57
  22. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  23. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
  24. package/dist/guido.css +1 -1
  25. package/dist/src/@types/config/index.d.ts +1 -1
  26. package/dist/src/@types/config/schemas.d.ts +0 -20
  27. package/dist/src/@types/config/types.d.ts +1 -3
  28. package/dist/src/composables/useConfig.d.ts +0 -8
  29. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -5
  31. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -5
  32. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  33. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  34. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +3 -20
  35. package/dist/src/stores/config.d.ts +0 -72
  36. package/dist/src/stores/preview.d.ts +0 -3
  37. package/dist/src/utils/htmlCompiler.d.ts +1 -2
  38. package/dist/stores/preview.js +3 -4
  39. package/dist/utils/htmlCompiler.js +41 -48
  40. package/dist/utils/templatePreparation.js +20 -20
  41. package/package.json +1 -1
@@ -22,10 +22,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
22
22
  productType: 60 | 49 | 97;
23
23
  messageType: 1 | 2;
24
24
  username: string;
25
- fallbackFont?: {
26
- name: string;
27
- family: string;
28
- } | undefined;
29
25
  };
30
26
  template: {
31
27
  html: string;
@@ -124,10 +120,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
124
120
  productType: 60 | 49 | 97;
125
121
  messageType: 1 | 2;
126
122
  username: string;
127
- fallbackFont?: {
128
- name: string;
129
- family: string;
130
- } | undefined;
131
123
  };
132
124
  template: {
133
125
  html: string;
@@ -226,10 +218,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
226
218
  productType: 60 | 49 | 97;
227
219
  messageType: 1 | 2;
228
220
  username: string;
229
- fallbackFont?: {
230
- name: string;
231
- family: string;
232
- } | undefined;
233
221
  };
234
222
  template: {
235
223
  html: string;
@@ -328,10 +316,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
328
316
  productType: 60 | 49 | 97;
329
317
  messageType: 1 | 2;
330
318
  username: string;
331
- fallbackFont?: {
332
- name: string;
333
- family: string;
334
- } | undefined;
335
319
  };
336
320
  template: {
337
321
  html: string;
@@ -430,10 +414,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
430
414
  productType: 60 | 49 | 97;
431
415
  messageType: 1 | 2;
432
416
  username: string;
433
- fallbackFont?: {
434
- name: string;
435
- family: string;
436
- } | undefined;
437
417
  };
438
418
  template: {
439
419
  html: string;
@@ -532,10 +512,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
532
512
  productType: 60 | 49 | 97;
533
513
  messageType: 1 | 2;
534
514
  username: string;
535
- fallbackFont?: {
536
- name: string;
537
- family: string;
538
- } | undefined;
539
515
  };
540
516
  template: {
541
517
  html: string;
@@ -634,10 +610,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
634
610
  productType: 60 | 49 | 97;
635
611
  messageType: 1 | 2;
636
612
  username: string;
637
- fallbackFont?: {
638
- name: string;
639
- family: string;
640
- } | undefined;
641
613
  };
642
614
  template: {
643
615
  html: string;
@@ -736,10 +708,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
736
708
  productType: 60 | 49 | 97;
737
709
  messageType: 1 | 2;
738
710
  username: string;
739
- fallbackFont?: {
740
- name: string;
741
- family: string;
742
- } | undefined;
743
711
  };
744
712
  template: {
745
713
  html: string;
@@ -838,10 +806,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
838
806
  productType: 60 | 49 | 97;
839
807
  messageType: 1 | 2;
840
808
  username: string;
841
- fallbackFont?: {
842
- name: string;
843
- family: string;
844
- } | undefined;
845
809
  };
846
810
  template: {
847
811
  html: string;
@@ -940,10 +904,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
940
904
  productType: 60 | 49 | 97;
941
905
  messageType: 1 | 2;
942
906
  username: string;
943
- fallbackFont?: {
944
- name: string;
945
- family: string;
946
- } | undefined;
947
907
  };
948
908
  template: {
949
909
  html: string;
@@ -1042,10 +1002,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1042
1002
  productType: 60 | 49 | 97;
1043
1003
  messageType: 1 | 2;
1044
1004
  username: string;
1045
- fallbackFont?: {
1046
- name: string;
1047
- family: string;
1048
- } | undefined;
1049
1005
  };
1050
1006
  template: {
1051
1007
  html: string;
@@ -1144,10 +1100,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1144
1100
  productType: 60 | 49 | 97;
1145
1101
  messageType: 1 | 2;
1146
1102
  username: string;
1147
- fallbackFont?: {
1148
- name: string;
1149
- family: string;
1150
- } | undefined;
1151
1103
  };
1152
1104
  template: {
1153
1105
  html: string;
@@ -1246,10 +1198,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1246
1198
  productType: 60 | 49 | 97;
1247
1199
  messageType: 1 | 2;
1248
1200
  username: string;
1249
- fallbackFont?: {
1250
- name: string;
1251
- family: string;
1252
- } | undefined;
1253
1201
  };
1254
1202
  template: {
1255
1203
  html: string;
@@ -1348,10 +1296,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1348
1296
  productType: 60 | 49 | 97;
1349
1297
  messageType: 1 | 2;
1350
1298
  username: string;
1351
- fallbackFont?: {
1352
- name: string;
1353
- family: string;
1354
- } | undefined;
1355
1299
  };
1356
1300
  template: {
1357
1301
  html: string;
@@ -1450,10 +1394,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1450
1394
  productType: 60 | 49 | 97;
1451
1395
  messageType: 1 | 2;
1452
1396
  username: string;
1453
- fallbackFont?: {
1454
- name: string;
1455
- family: string;
1456
- } | undefined;
1457
1397
  };
1458
1398
  template: {
1459
1399
  html: string;
@@ -1552,10 +1492,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1552
1492
  productType: 60 | 49 | 97;
1553
1493
  messageType: 1 | 2;
1554
1494
  username: string;
1555
- fallbackFont?: {
1556
- name: string;
1557
- family: string;
1558
- } | undefined;
1559
1495
  };
1560
1496
  template: {
1561
1497
  html: string;
@@ -1654,10 +1590,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1654
1590
  productType: 60 | 49 | 97;
1655
1591
  messageType: 1 | 2;
1656
1592
  username: string;
1657
- fallbackFont?: {
1658
- name: string;
1659
- family: string;
1660
- } | undefined;
1661
1593
  };
1662
1594
  template: {
1663
1595
  html: string;
@@ -1756,10 +1688,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1756
1688
  productType: 60 | 49 | 97;
1757
1689
  messageType: 1 | 2;
1758
1690
  username: string;
1759
- fallbackFont?: {
1760
- name: string;
1761
- family: string;
1762
- } | undefined;
1763
1691
  };
1764
1692
  template: {
1765
1693
  html: string;
@@ -7,7 +7,6 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPrev
7
7
  templateHtml: string;
8
8
  isLoaded: boolean;
9
9
  isAMPErrorModalVisible: boolean;
10
- emailSizeKB: number;
11
10
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
12
11
  previewHtml(): string;
13
12
  hasAMP: (state: {
@@ -17,7 +16,6 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPrev
17
16
  templateHtml: string;
18
17
  isLoaded: boolean;
19
18
  isAMPErrorModalVisible: boolean;
20
- emailSizeKB: number;
21
19
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
22
20
  hasAMPErrors: (state: {
23
21
  emailFormat: EmailFormat;
@@ -26,7 +24,6 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"guidoPrev
26
24
  templateHtml: string;
27
25
  isLoaded: boolean;
28
26
  isAMPErrorModalVisible: boolean;
29
- emailSizeKB: number;
30
27
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
31
28
  showAMPErrorButton(): boolean;
32
29
  isAMPResponsive(): boolean;
@@ -1,9 +1,8 @@
1
- import type { FallbackFont } from '@@/Types/config';
2
1
  import type { CompilerRule, CompilationResult, HtmlCompiler } from '@@/Types/html-compiler';
3
2
  export declare class HtmlCompilerEngine implements HtmlCompiler {
4
3
  private rules;
5
4
  constructor(rules?: CompilerRule[]);
6
- compile(html: string, rules?: CompilerRule[], fallbackFont?: FallbackFont): CompilationResult;
5
+ compile(html: string, rules?: CompilerRule[]): CompilationResult;
7
6
  private applyRule;
8
7
  private applyReplaceRule;
9
8
  private applyRegexRule;
@@ -1,14 +1,13 @@
1
1
  import { defineStore as e } from "pinia";
2
- const i = () => ({
2
+ const s = () => ({
3
3
  emailFormat: "html",
4
4
  ampHtml: "",
5
5
  ampErrors: [],
6
6
  templateHtml: "",
7
7
  isLoaded: !1,
8
- isAMPErrorModalVisible: !1,
9
- emailSizeKB: 0
8
+ isAMPErrorModalVisible: !1
10
9
  }), a = e("guidoPreview", {
11
- state: () => i(),
10
+ state: () => s(),
12
11
  getters: {
13
12
  isAMPModeEnabled: (t) => t.emailFormat === "AMP",
14
13
  previewHtml() {
@@ -1,77 +1,70 @@
1
- var h = Object.defineProperty;
2
- var f = (o, e, t) => e in o ? h(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var m = (o, e, t) => f(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { useToaster as x } from "../composables/useToaster.js";
5
- const E = /font-family\s*:[^;}"']+/gi;
6
- class T {
1
+ var y = Object.defineProperty;
2
+ var g = (p, e, r) => e in p ? y(p, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : p[e] = r;
3
+ var u = (p, e, r) => g(p, typeof e != "symbol" ? e + "" : e, r);
4
+ import { useToaster as m } from "../composables/useToaster.js";
5
+ class d {
7
6
  constructor(e = []) {
8
- m(this, "rules");
7
+ u(this, "rules");
9
8
  this.rules = e;
10
9
  }
11
- compile(e, t, r) {
12
- const n = performance.now(), l = e, c = e.length;
10
+ compile(e, r) {
11
+ const l = performance.now(), t = e, o = e.length;
13
12
  let s = e;
14
- const i = [];
15
- (t || this.rules).sort((p, a) => p.priority - a.priority).forEach((p) => {
16
- const a = s.length;
17
- s = this.applyRule(s, p), s.length !== a && i.push(p.id);
13
+ const a = [];
14
+ (r || this.rules).sort((n, c) => n.priority - c.priority).forEach((n) => {
15
+ const c = s.length;
16
+ s = this.applyRule(s, n), s.length !== c && a.push(n.id);
18
17
  });
19
- const u = s.length, R = c > 0 ? (c - u) / c * 100 : 0, d = new TextEncoder().encode(s).byteLength;
20
- let y = 0;
21
- if (r && r.name && r.family) {
22
- const p = (s.match(E) || []).length, a = `, ${r.name}, ${r.family}`;
23
- y = p * new TextEncoder().encode(a).byteLength;
24
- }
25
- const g = Math.round((d + y) / 1024);
18
+ const i = s.length, R = o > 0 ? (o - i) / o * 100 : 0;
26
19
  return {
27
- originalHtml: l,
20
+ originalHtml: t,
28
21
  compiledHtml: s,
29
- appliedRules: i,
30
- estimatedSizeKB: g,
22
+ appliedRules: a,
23
+ // TODO: We can use stats for monitoring in the future
31
24
  stats: {
32
- originalSize: c,
33
- compiledSize: u,
25
+ originalSize: o,
26
+ compiledSize: i,
34
27
  reductionPercentage: R,
35
- executionTime: performance.now() - n
28
+ executionTime: performance.now() - l
36
29
  }
37
30
  };
38
31
  }
39
- applyRule(e, t) {
32
+ applyRule(e, r) {
40
33
  try {
41
- switch (t.type) {
34
+ switch (r.type) {
42
35
  case "replace":
43
- return this.applyReplaceRule(e, t);
36
+ return this.applyReplaceRule(e, r);
44
37
  case "regex":
45
- return this.applyRegexRule(e, t);
38
+ return this.applyRegexRule(e, r);
46
39
  case "remove":
47
- return this.applyRemoveRule(e, t);
40
+ return this.applyRemoveRule(e, r);
48
41
  case "custom":
49
- return this.applyCustomRule(e, t);
42
+ return this.applyCustomRule(e, r);
50
43
  default:
51
44
  return e;
52
45
  }
53
- } catch (r) {
54
- const { handleError: n } = x();
55
- return n(r, `Failed to apply rule ${t.id}:`), e;
46
+ } catch (l) {
47
+ const { handleError: t } = m();
48
+ return t(l, `Failed to apply rule ${r.id}:`), e;
56
49
  }
57
50
  }
58
- applyReplaceRule(e, t) {
59
- const { search: r, replacement: n, replaceAll: l = !0 } = t;
60
- return l ? e.replaceAll(r, n) : e.replace(r, n);
51
+ applyReplaceRule(e, r) {
52
+ const { search: l, replacement: t, replaceAll: o = !0 } = r;
53
+ return o ? e.replaceAll(l, t) : e.replace(l, t);
61
54
  }
62
- applyRegexRule(e, t) {
63
- const { pattern: r, replacement: n, flags: l = "g" } = t, c = new RegExp(r, l);
64
- return e.replace(c, n);
55
+ applyRegexRule(e, r) {
56
+ const { pattern: l, replacement: t, flags: o = "g" } = r, s = new RegExp(l, o);
57
+ return e.replace(s, t);
65
58
  }
66
- applyRemoveRule(e, t) {
67
- return t.targets.reduce((r, n) => n instanceof RegExp ? r.replace(n, "") : r.replaceAll(n, ""), e);
59
+ applyRemoveRule(e, r) {
60
+ return r.targets.reduce((l, t) => t instanceof RegExp ? l.replace(t, "") : l.replaceAll(t, ""), e);
68
61
  }
69
- applyCustomRule(e, t) {
70
- return t.processor(e);
62
+ applyCustomRule(e, r) {
63
+ return r.processor(e);
71
64
  }
72
65
  }
73
- const H = (o = []) => new T(o);
66
+ const A = (p = []) => new d(p);
74
67
  export {
75
- T as HtmlCompilerEngine,
76
- H as createHtmlCompiler
68
+ d as HtmlCompilerEngine,
69
+ A as createHtmlCompiler
77
70
  };
@@ -1,32 +1,32 @@
1
- import { useActionsApi as S } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as f } from "../composables/useHtmlCompiler.js";
3
- import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
- import { useDynamicContentStore as T } from "../stores/dynamic-content.js";
5
- import { useUnsubscribeStore as x } from "../stores/unsubscribe.js";
6
- const h = () => {
7
- const o = T(), e = x(), { getCompiledEmail: i, getTemplateData: s } = S(), { compileHtml: n } = f();
1
+ import { useActionsApi as f } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
5
+ import { useUnsubscribeStore as y } from "../stores/unsubscribe.js";
6
+ const w = () => {
7
+ const o = x(), e = y(), { getCompiledEmail: i, getTemplateData: s, editorSave: n } = f(), { compileHtml: a } = C();
8
8
  return {
9
9
  prepareTemplateDetails: async () => {
10
- const { html: a, ampHtml: m = "", ampErrors: r = [] } = await i({
10
+ const { html: m, ampHtml: r = "", ampErrors: c = [] } = await i({
11
11
  minimize: !0,
12
12
  resetDataSavedFlag: !1
13
- }), { html: c, css: l, syncModulesIds: p = [] } = await s();
13
+ }), { html: l, css: p, syncModulesIds: u = [] } = await s();
14
14
  e.selectedUnsubscribePages.length && await e.fetchTemplates();
15
- const { compiledHtml: u, stats: t, appliedRules: d } = n(a), g = o.getSelectedDynamicContentList, b = C();
16
- return console.debug("HTML Compilation Stats:", {
15
+ const { compiledHtml: d, stats: t, appliedRules: g } = a(m), S = o.getSelectedDynamicContentList, b = T();
16
+ return n(), console.debug("HTML Compilation Stats:", {
17
17
  originalSize: t.originalSize,
18
18
  compiledSize: t.compiledSize,
19
19
  reduction: `${t.reductionPercentage.toFixed(2)}%`,
20
- appliedRules: d,
20
+ appliedRules: g,
21
21
  executionTime: `${t.executionTime.toFixed(2)}ms`
22
22
  }), {
23
- dynamicContentList: g,
24
- compiledHtml: u,
25
- rawHtml: c,
26
- css: l,
27
- ampHtml: m,
28
- ampErrors: r,
29
- modules: p.map(Number),
23
+ dynamicContentList: S,
24
+ compiledHtml: d,
25
+ rawHtml: l,
26
+ css: p,
27
+ ampHtml: r,
28
+ ampErrors: c,
29
+ modules: u.map(Number),
30
30
  recommendation: {
31
31
  campaignUrls: b.recommendationCampaignUrls,
32
32
  configs: {}
@@ -40,5 +40,5 @@ const h = () => {
40
40
  };
41
41
  };
42
42
  export {
43
- h as useTemplatePreparation
43
+ w as useTemplatePreparation
44
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.1.1-beta.a80cc5e",
3
+ "version": "3.1.1-beta.b085e4a",
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",