@useinsider/guido 3.1.1-beta.e00a22b → 3.1.1-beta.e2f9e0a

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.
@@ -1,44 +1,53 @@
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 T } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as P } from "../composables/useHtmlCompiler.js";
3
+ import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { DATA_ATTRIBUTES as l } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
5
+ import { parsePageList as h } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
6
+ import { useDynamicContentStore as C } from "../stores/dynamic-content.js";
7
+ import { useUnsubscribeStore as D } from "../stores/unsubscribe.js";
8
+ function x(i, e) {
9
+ const r = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${l.PAGE_LIST}]`), n = [];
10
+ return r.forEach((t) => {
11
+ const o = t.getAttribute(l.PAGE_LIST);
12
+ o && n.push(...h(o));
13
+ }), e.filter((t) => n.includes(t));
14
+ }
15
+ const I = () => {
16
+ const i = C(), e = D(), { getCompiledEmail: a, getTemplateData: m } = T(), { compileHtml: r } = P();
8
17
  return {
9
18
  prepareTemplateDetails: async () => {
10
- const { html: a, ampHtml: m = "", ampErrors: r = [] } = await i({
19
+ const { html: t, ampHtml: o = "", ampErrors: p = [] } = await a({
11
20
  minimize: !0,
12
21
  resetDataSavedFlag: !1
13
- }), { html: c, css: l, syncModulesIds: p = [] } = await s();
22
+ }), { html: u, css: d, syncModulesIds: g = [] } = await m();
14
23
  e.selectedUnsubscribePages.length && await e.fetchTemplates();
15
- const { compiledHtml: u, stats: t, appliedRules: d } = n(a), g = o.getSelectedDynamicContentList, b = C();
24
+ const { compiledHtml: c, stats: s, appliedRules: S } = r(t), b = i.getSelectedDynamicContentList, f = A();
16
25
  return console.debug("HTML Compilation Stats:", {
17
- originalSize: t.originalSize,
18
- compiledSize: t.compiledSize,
19
- reduction: `${t.reductionPercentage.toFixed(2)}%`,
20
- appliedRules: d,
21
- executionTime: `${t.executionTime.toFixed(2)}ms`
26
+ originalSize: s.originalSize,
27
+ compiledSize: s.compiledSize,
28
+ reduction: `${s.reductionPercentage.toFixed(2)}%`,
29
+ appliedRules: S,
30
+ executionTime: `${s.executionTime.toFixed(2)}ms`
22
31
  }), {
23
- dynamicContentList: g,
24
- compiledHtml: u,
25
- rawHtml: c,
26
- css: l,
27
- ampHtml: m,
28
- ampErrors: r,
29
- modules: p.map(Number),
32
+ dynamicContentList: b,
33
+ compiledHtml: c,
34
+ rawHtml: u,
35
+ css: d,
36
+ ampHtml: o,
37
+ ampErrors: p,
38
+ modules: g.map(Number),
30
39
  recommendation: {
31
- campaignUrls: b.recommendationCampaignUrls,
40
+ campaignUrls: f.recommendationCampaignUrls,
32
41
  configs: {}
33
42
  },
34
43
  unsubscribe: {
35
44
  status: e.unsubscribePagesStatus,
36
- config: e.selectedUnsubscribePages
45
+ config: x(c, e.selectedUnsubscribePages)
37
46
  }
38
47
  };
39
48
  }
40
49
  };
41
50
  };
42
51
  export {
43
- h as useTemplatePreparation
52
+ I as useTemplatePreparation
44
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.1.1-beta.e00a22b",
3
+ "version": "3.1.1-beta.e2f9e0a",
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",
@@ -34,7 +34,6 @@
34
34
  "dependencies": {
35
35
  "@stripoinc/ui-editor-extensions": "3.5.0",
36
36
  "@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
37
- "@useinsider/guido": "3.1.1-beta.22d798c",
38
37
  "@vueuse/core": "11.3.0",
39
38
  "lodash-es": "4.17.21",
40
39
  "pinia": "2.3.1",
@@ -1,42 +0,0 @@
1
- import { ToasterTypeOptions as a } from "../../enums/toaster.js";
2
- import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
3
- import { useHttp as d } from "../useHttp.js";
4
- import { useToaster as c } from "../useToaster.js";
5
- import { useTranslations as p } from "../useTranslations.js";
6
- const v = () => {
7
- const { post: i } = d(), { showToaster: e } = c(), s = p();
8
- return { validateLiquidSyntax: async (o) => {
9
- try {
10
- const t = await i("/newsletter/contents/validate-syntax", [{
11
- identifier: "default",
12
- syntax: "liquid",
13
- contents: {
14
- subject: null,
15
- preheader: null,
16
- html: u(o),
17
- ampHtml: null
18
- }
19
- }]);
20
- if (!Array.isArray(t.data)) {
21
- const l = t.data;
22
- return e({
23
- type: a.Warning,
24
- message: l.message ?? s("journey-builder.liquid-validation-failed")
25
- }), !1;
26
- }
27
- const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
28
- return n.length ? (e({
29
- type: a.Warning,
30
- message: n[0].replace(/^line \d+:\s*/, "")
31
- }), !1) : !0;
32
- } catch {
33
- return e({
34
- type: a.Alert,
35
- message: s("journey-builder.liquid-validation-failed")
36
- }), !1;
37
- }
38
- } };
39
- };
40
- export {
41
- v as useLiquidValidator
42
- };
@@ -1,15 +0,0 @@
1
- import { COUPON_PLACEHOLDER_LIQUID as e, COUPON_PLACEHOLDER_DEFAULT as i } from "../../extensions/Blocks/CouponBlock/template.js";
2
- const o = [
3
- {
4
- id: "liquid-coupon-code",
5
- description: "Replace legacy coupon placeholder with liquid syntax",
6
- type: "replace",
7
- search: i,
8
- replacement: e,
9
- replaceAll: !0,
10
- priority: 50
11
- }
12
- ];
13
- export {
14
- o as liquidCompilerRules
15
- };
@@ -1,3 +0,0 @@
1
- export declare const useLiquidValidator: () => {
2
- validateLiquidSyntax: (compiledHtml: string) => Promise<boolean>;
3
- };
@@ -1,2 +0,0 @@
1
- import type { CompilerRule } from '@@/Types/html-compiler';
2
- export declare const liquidCompilerRules: CompilerRule[];