@useinsider/guido 3.6.0-beta.6807430 → 3.6.0-beta.6c3407e

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,7 +1,6 @@
1
- import { filterAmpErrors as w } from "../utils/ampErrorFilter.js";
2
- import { useToaster as A } from "./useToaster.js";
3
- const D = () => {
4
- const { handleError: n } = A(), s = (t = {}) => new Promise((e, a) => {
1
+ import { useToaster as w } from "./useToaster.js";
2
+ const v = () => {
3
+ const { handleError: n } = w(), m = (t = {}) => new Promise((e, a) => {
5
4
  const o = { ...{
6
5
  minimize: !0,
7
6
  utmEntity: {
@@ -21,29 +20,29 @@ const D = () => {
21
20
  forceAmp: !1,
22
21
  resetDataSavedFlag: !1,
23
22
  disableLineHeightsReplace: !0
24
- }, ...t }, l = {
25
- callback: (r, p, d, c, u) => {
26
- r ? a(r) : e({
23
+ }, ...t }, s = {
24
+ callback: (l, p, d, c, u) => {
25
+ l ? a(l) : e({
27
26
  html: p,
28
27
  ampHtml: d,
29
- ampErrors: w(c ?? []),
28
+ ampErrors: c,
30
29
  displayConditions: u
31
30
  });
32
31
  },
33
32
  ...o
34
33
  };
35
- window.StripoEditorApi.actionsApi.compileEmail(l);
34
+ window.StripoEditorApi.actionsApi.compileEmail(s);
36
35
  });
37
36
  return {
38
- getCompiledEmail: s,
37
+ getCompiledEmail: m,
39
38
  getTemplateData: () => new Promise((t) => {
40
- const e = ({ html: a, css: i, width: o, height: m, utmParams: l, syncModulesIds: r }) => t({
39
+ const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
41
40
  html: a,
42
41
  css: i,
43
42
  width: o,
44
- height: m,
45
- utmParams: l,
46
- syncModulesIds: r
43
+ height: r,
44
+ utmParams: s,
45
+ syncModulesIds: l
47
46
  });
48
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
49
48
  }),
@@ -57,7 +56,7 @@ const D = () => {
57
56
  displayConditions: a,
58
57
  ampHtml: i = "",
59
58
  ampErrors: o = []
60
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
59
+ } = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
61
60
  return {
62
61
  html: e,
63
62
  ampHtml: i,
@@ -102,5 +101,5 @@ const D = () => {
102
101
  };
103
102
  };
104
103
  export {
105
- D as useActionsApi
104
+ v as useActionsApi
106
105
  };
@@ -1,48 +1,30 @@
1
- import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
3
- import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
4
- import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
5
- import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
6
- import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
- import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
8
- import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
9
- import { useConfig as k } from "./useConfig.js";
10
- const y = /* @__PURE__ */ new Set([
11
- // URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
12
- "fix-url-encoding-start",
13
- "fix-url-encoding-end",
14
- "fix-tags-start",
15
- "fix-tags-end",
16
- // Image domain corrections — plain string replacement.
17
- "replace-old-image-domain",
18
- "replace-old-v2-image-domain",
19
- // Unsubscribe domain — the actual fix: injects the real unsubscribe href in
20
- // place of the `{{ins-*-unsubscribe-link}}` placeholders, plus related
21
- // unsubscribe-only cleanups. All pure regex/text, no AMP-forbidden output.
22
- "add-unsubscribe-link-values",
23
- "remove-data-ogsb-button-styles",
24
- "format-comment-braces",
25
- "add-universal-link-flags",
26
- // Coupon placeholder replacement (only present when liquidSyntax is enabled).
27
- "liquid-coupon-code"
28
- ]), M = () => {
29
- var m, t, r;
30
- const { compiler: e, isFeatureEnabled: a, partner: n } = k(), u = ((m = e.value) == null ? void 0 : m.customRules) || [], l = [
31
- ...!!((t = e.value) != null && t.ignoreDefaultRules) ? [] : R,
32
- ...v,
33
- ...x,
1
+ import { defaultHtmlCompilerRules as c } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
3
+ import { liquidCompilerRules as R } from "../config/compiler/liquidCompilerRules.js";
4
+ import { outlookCompilerRules as C } from "../config/compiler/outlookCompilerRules.js";
5
+ import { recommendationCompilerRules as d } from "../config/compiler/recommendationCompilerRules.js";
6
+ import { socialCompilerRules as b } from "../config/compiler/socialCompilerRules.js";
7
+ import { unsubscribeCompilerRules as g } from "../config/compiler/unsubscribeCompilerRules.js";
8
+ import { createHtmlCompiler as H } from "../utils/htmlCompiler.js";
9
+ import { useConfig as v } from "./useConfig.js";
10
+ const w = () => {
11
+ var l, m, r;
12
+ const { compiler: e, isFeatureEnabled: t, partner: i } = v(), s = ((l = e.value) == null ? void 0 : l.customRules) || [], u = [
13
+ ...!!((m = e.value) != null && m.ignoreDefaultRules) ? [] : c,
14
+ ...d,
34
15
  ...g,
16
+ ...f,
17
+ ...C,
35
18
  ...b,
36
- ...H,
37
- ...a("liquidSyntax") ? C : [],
38
- ...u.map((o, f) => ({
19
+ ...t("liquidSyntax") ? R : [],
20
+ ...s.map((o, a) => ({
39
21
  ...o,
40
- priority: o.priority + 1e3 + f
22
+ priority: o.priority + 1e3 + a
41
23
  // Ensure additional rules run after default rules
42
24
  }))
43
- ], p = s(l), c = l.filter((o) => y.has(o.id)), d = s(c), i = (r = n.value) == null ? void 0 : r.fallbackFont;
44
- return { compileHtml: (o) => p.compile(o, void 0, i), compileAmpHtml: (o) => d.compile(o, void 0, i) };
25
+ ], p = H(u), n = (r = i.value) == null ? void 0 : r.fallbackFont;
26
+ return { compileHtml: (o) => p.compile(o, void 0, n) };
45
27
  };
46
28
  export {
47
- M as useHtmlCompiler
29
+ w as useHtmlCompiler
48
30
  };
@@ -1,4 +1,4 @@
1
- var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r))(c || {});
1
+ var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r.Dark = "dark", r))(c || {});
2
2
  export {
3
3
  c as ToasterTypeOptions
4
4
  };
@@ -1,17 +1,18 @@
1
1
  var k = Object.defineProperty;
2
- var y = (a, r, t) => r in a ? k(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
- var d = (a, r, t) => y(a, typeof r != "symbol" ? r + "" : r, t);
4
- import { BlockId as B } from "../../../enums/block.js";
5
- import { getMigrationBannerHtml as D } from "../../../utils/migrationBannerHtml.js";
6
- import { Block as R, BlockCompositionType as C, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ var B = (a, r, t) => r in a ? k(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
+ var d = (a, r, t) => B(a, typeof r != "symbol" ? r + "" : r, t);
4
+ import { BlockId as R } from "../../../enums/block.js";
5
+ import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
6
+ import { Block as D, BlockCompositionType as C, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
7
  import { regenerateMobileProductRows as b } from "./controls/main/utils.js";
8
8
  import { ensureMobileCssRulesExist as p, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as A } from "./controls/mobileLayout/cssRules.js";
9
9
  import { RecommendationConfigService as c } from "./services/configService.js";
10
10
  import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
11
11
  import { getDefaultTemplate as E } from "./templates/grid/template.js";
12
- const _ = B.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
13
- let I = !1;
14
- class q extends R {
12
+ import { useRecommendationBlockWarning as M } from "./useRecommendationBlockWarning.js";
13
+ const I = R.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
14
+ let _ = !1;
15
+ class H extends D {
15
16
  constructor() {
16
17
  super();
17
18
  /**
@@ -21,7 +22,7 @@ class q extends R {
21
22
  d(this, "_pendingBlockId", null);
22
23
  }
23
24
  getId() {
24
- return _;
25
+ return I;
25
26
  }
26
27
  getIcon() {
27
28
  return "recommendation-icon";
@@ -38,8 +39,8 @@ class q extends R {
38
39
  );
39
40
  }
40
41
  getSettingsPanelTitleHtml() {
41
- return D(
42
- _,
42
+ return y(
43
+ I,
43
44
  this.api.translate("Recommendation Block"),
44
45
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
45
46
  );
@@ -95,7 +96,7 @@ class q extends R {
95
96
  documentModifier: this.api.getDocumentModifier()
96
97
  }));
97
98
  }
98
- s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
99
+ s.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
99
100
  }
100
101
  /**
101
102
  * Called when the document changes or template is loaded
@@ -117,7 +118,7 @@ class q extends R {
117
118
  }
118
119
  this._healLingeringDuplicate(t), c.needsMigration(t) && this._migrateFromLegacy(t);
119
120
  try {
120
- I || (p(this.api), I = !0);
121
+ _ || (p(this.api), _ = !0);
121
122
  const e = c.getConfig(t), i = this._getBlockElement(t);
122
123
  if (i) {
123
124
  const n = !e.mobileLayoutEnabled;
@@ -137,6 +138,24 @@ class q extends R {
137
138
  const e = this._getRecommendationId(t);
138
139
  e && g().removeBlockState(e);
139
140
  }
141
+ /**
142
+ * Warns (dark advisory toaster) when the design holds more than one live
143
+ * recommendation block. Triggered from the user-add paths only (fresh drop
144
+ * and duplicate) — never from document-load/migration, so opening a template
145
+ * that already has multiple blocks does not fire it. `onCreated` also runs
146
+ * for a reco block that arrives inside a saved structure (SD-143028), so this
147
+ * covers that case too — no separate `module_dropped` handling is needed.
148
+ *
149
+ * Counting lives in `useRecommendationBlockWarning`, whose DOM-based logic
150
+ * ignores the empty shells deletions leave behind (SD-143028). Wrapped in
151
+ * try/catch because the document root may be unavailable during initial load.
152
+ */
153
+ _warnIfMultipleBlocks() {
154
+ try {
155
+ M().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
156
+ } catch {
157
+ }
158
+ }
140
159
  /**
141
160
  * Generates the next unique recommendation ID by scanning all existing blocks
142
161
  * in the document and finding the maximum existing ID + 1.
@@ -209,7 +228,7 @@ class q extends R {
209
228
  /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
210
229
  _handleDuplicate(t, e) {
211
230
  const i = this._reassignDuplicateId(t, e), n = g();
212
- n.cloneBlockState(e, i), n.setCurrentBlock(i);
231
+ n.cloneBlockState(e, i), n.setCurrentBlock(i), this._warnIfMultipleBlocks();
213
232
  }
214
233
  /**
215
234
  * Core id-reassignment for a duplicated block: rewrites the DOM
@@ -291,6 +310,6 @@ class q extends R {
291
310
  }
292
311
  }
293
312
  export {
294
- _ as BLOCK_ID,
295
- q as RecommendationBlock
313
+ I as BLOCK_ID,
314
+ H as RecommendationBlock
296
315
  };
@@ -0,0 +1,16 @@
1
+ import { useToaster as r } from "../../../composables/useToaster.js";
2
+ import { useTranslations as s } from "../../../composables/useTranslations.js";
3
+ import { ToasterTypeOptions as n } from "../../../enums/toaster.js";
4
+ import { countLiveRecommendationBlocks as i } from "./utils/recommendationBlockCount.js";
5
+ const a = "newsletter.multiple-reco-blocks-warning", f = () => {
6
+ const { showToaster: o } = r(), t = s();
7
+ return { warnIfMultipleBlocks: (e) => {
8
+ i(e) > 1 && o({
9
+ type: n.Dark,
10
+ message: t(a)
11
+ });
12
+ } };
13
+ };
14
+ export {
15
+ f as useRecommendationBlockWarning
16
+ };
@@ -0,0 +1,9 @@
1
+ const r = ".recommendation-block-v2", t = ".recommendation-product-row";
2
+ function n(o) {
3
+ return Array.from(o.querySelectorAll(r)).filter((e) => e.querySelector(t)).length;
4
+ }
5
+ export {
6
+ r as RECOMMENDATION_BLOCK_SELECTOR,
7
+ t as RECOMMENDATION_PRODUCT_ROW_SELECTOR,
8
+ n as countLiveRecommendationBlocks
9
+ };
@@ -1,5 +1,4 @@
1
1
  import type { CompilationResult } from '@@/Types/html-compiler';
2
2
  export declare const useHtmlCompiler: () => {
3
3
  compileHtml: (html: string) => CompilationResult;
4
- compileAmpHtml: (amp: string) => CompilationResult;
5
4
  };
@@ -1,5 +1,6 @@
1
1
  export declare enum ToasterTypeOptions {
2
2
  Success = "success",
3
3
  Warning = "warning",
4
- Alert = "alert"
4
+ Alert = "alert",
5
+ Dark = "dark"
5
6
  }
@@ -55,6 +55,19 @@ export declare class RecommendationBlock extends Block {
55
55
  * @param node - The block node being deleted
56
56
  */
57
57
  onDelete(node: ImmutableHtmlNode): void;
58
+ /**
59
+ * Warns (dark advisory toaster) when the design holds more than one live
60
+ * recommendation block. Triggered from the user-add paths only (fresh drop
61
+ * and duplicate) — never from document-load/migration, so opening a template
62
+ * that already has multiple blocks does not fire it. `onCreated` also runs
63
+ * for a reco block that arrives inside a saved structure (SD-143028), so this
64
+ * covers that case too — no separate `module_dropped` handling is needed.
65
+ *
66
+ * Counting lives in `useRecommendationBlockWarning`, whose DOM-based logic
67
+ * ignores the empty shells deletions leave behind (SD-143028). Wrapped in
68
+ * try/catch because the document root may be unavailable during initial load.
69
+ */
70
+ private _warnIfMultipleBlocks;
58
71
  /**
59
72
  * Generates the next unique recommendation ID by scanning all existing blocks
60
73
  * in the document and finding the maximum existing ID + 1.
@@ -0,0 +1,12 @@
1
+ import type { QueryableRoot } from './utils/recommendationBlockCount';
2
+ /**
3
+ * Advisory shown when a design ends up with more than one recommendation block,
4
+ * since multiple blocks can slow campaign delivery. Driven from the block
5
+ * lifecycle (`onCreated` for direct drop / duplicate, counting the editor's
6
+ * document root). `onCreated` also fires for a reco block that arrives inside a
7
+ * saved structure (SD-143028), so that case is covered without a separate
8
+ * `module_dropped` re-check.
9
+ */
10
+ export declare const useRecommendationBlockWarning: () => {
11
+ warnIfMultipleBlocks: (root: QueryableRoot) => void;
12
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Counts *live* recommendation blocks in a document.
3
+ *
4
+ * Deleting a recommendation block strips its inner content but leaves an empty
5
+ * `.recommendation-block-v2` container shell behind — present in every document
6
+ * representation the editor exposes (`getDocumentRoot`, `getDocumentRootHtmlNode`
7
+ * and even `getTemplateData`). A raw class count therefore over-reports after a
8
+ * delete→add cycle (SD-143028). The product row (`.recommendation-product-row`)
9
+ * is present on every live block from drop time (the default template ships
10
+ * product rows, both grid and list layouts) and is removed from a deleted
11
+ * block's leftover shell, so filtering by it cleanly separates live blocks from
12
+ * ghosts without reading any store.
13
+ */
14
+ export declare const RECOMMENDATION_BLOCK_SELECTOR = ".recommendation-block-v2";
15
+ export declare const RECOMMENDATION_PRODUCT_ROW_SELECTOR = ".recommendation-product-row";
16
+ interface QueryableNode {
17
+ querySelector(selector: string): unknown;
18
+ }
19
+ export interface QueryableRoot {
20
+ querySelectorAll(selector: string): Iterable<QueryableNode>;
21
+ }
22
+ /**
23
+ * Counts the live recommendation blocks reachable from `root`. Works on the
24
+ * editor's `ImmutableHtmlNode` document root (the `onCreated` drop / duplicate
25
+ * paths) and on any DOM-like root exposing `querySelectorAll`.
26
+ */
27
+ export declare function countLiveRecommendationBlocks(root: QueryableRoot): number;
28
+ export {};
@@ -1,55 +1,55 @@
1
- import { useActionsApi as D } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as P } from "../composables/useHtmlCompiler.js";
3
- import { DEFAULT_CURRENCY as p, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
1
+ import { useActionsApi as C } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as T } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
5
  import { DATA_ATTRIBUTES as S } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as w } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as E } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as H } from "../stores/unsubscribe.js";
9
- function U(s, r) {
10
- const t = new DOMParser().parseFromString(s, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), o = [];
11
- return t.forEach((a) => {
12
- const n = a.getAttribute(S.PAGE_LIST);
13
- n && o.push(...w(n));
14
- }), r.filter((a) => o.includes(a));
6
+ import { parsePageList as D } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as P } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
9
+ function E(i, o) {
10
+ const t = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${S.PAGE_LIST}]`), c = [];
11
+ return t.forEach((r) => {
12
+ const a = r.getAttribute(S.PAGE_LIST);
13
+ a && c.push(...D(a));
14
+ }), o.filter((r) => c.includes(r));
15
15
  }
16
- async function F(s) {
17
- const m = new DOMParser().parseFromString(s, "text/html").querySelectorAll(".recommendation-block-v2");
16
+ async function U(i) {
17
+ const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
18
18
  if (m.length === 0)
19
19
  return;
20
20
  const l = b();
21
21
  m.forEach((t) => {
22
- var u, g, f, d, c;
23
- const o = t.getAttribute("recommendation-id"), a = o ? Number(o) : NaN;
24
- if (!Number.isFinite(a))
22
+ var g, f, u, n, y;
23
+ const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
24
+ if (!Number.isFinite(r))
25
25
  return;
26
- const n = t.getAttribute("esd-ext-config");
27
- if (!n)
26
+ const a = t.getAttribute("esd-ext-config");
27
+ if (!a)
28
28
  return;
29
29
  let e;
30
30
  try {
31
- e = JSON.parse(n);
31
+ e = JSON.parse(a);
32
32
  } catch {
33
33
  return;
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
- const y = {
38
- strategy: e.strategy ?? i.strategy,
39
- language: e.language ?? i.language,
40
- size: e.size ?? i.size,
37
+ const p = {
38
+ strategy: e.strategy ?? s.strategy,
39
+ language: e.language ?? s.language,
40
+ size: e.size ?? s.size,
41
41
  // Spread the default arrays so each block gets a fresh reference
42
42
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
43
- productIds: e.productIds ?? [...i.productIds],
44
- filters: e.filters ?? [...i.filters],
45
- shuffleProducts: e.shuffleProducts ?? i.shuffleProducts,
46
- currencyCode: ((u = e.currency) == null ? void 0 : u.code) ?? p.code,
47
- currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? p.alignment,
48
- currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? p.decimalCount,
49
- currencyDecimalSeparator: ((d = e.currency) == null ? void 0 : d.decimalSeparator) ?? p.decimalSeparator,
50
- currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? p.thousandSeparator
43
+ productIds: e.productIds ?? [...s.productIds],
44
+ filters: e.filters ?? [...s.filters],
45
+ shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
46
+ currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
47
+ currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
48
+ currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? d.decimalCount,
49
+ currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? d.decimalSeparator,
50
+ currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? d.thousandSeparator
51
51
  };
52
- l.seedBlockUrlConfig(a, y);
52
+ l.seedBlockUrlConfig(r, p);
53
53
  });
54
54
  try {
55
55
  await l.fetchRecommendationCreateData();
@@ -60,42 +60,42 @@ async function F(s) {
60
60
  );
61
61
  }
62
62
  }
63
- const O = () => {
64
- const s = E(), r = H(), { getCompiledEmail: m, getTemplateData: l } = D(), { compileHtml: t, compileAmpHtml: o } = P();
63
+ const _ = () => {
64
+ const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
65
65
  return {
66
66
  prepareTemplateDetails: async () => {
67
- const { html: n, ampHtml: e = "", ampErrors: y = [] } = await m({
67
+ const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
68
68
  minimize: !0,
69
69
  resetDataSavedFlag: !1
70
- }), { html: u, css: g, syncModulesIds: f = [] } = await l();
71
- r.selectedUnsubscribePages.length && await r.fetchTemplates(), await F(u);
72
- const { compiledHtml: d, stats: c, appliedRules: h } = t(n), A = e && o(e).compiledHtml, C = s.getSelectedDynamicContentList, T = b();
70
+ }), { html: p, css: g, syncModulesIds: f = [] } = await l();
71
+ o.selectedUnsubscribePages.length && await o.fetchTemplates(), await U(p);
72
+ const { compiledHtml: u, stats: n, appliedRules: y } = t(r), h = i.getSelectedDynamicContentList, A = b();
73
73
  return console.debug("HTML Compilation Stats:", {
74
- originalSize: c.originalSize,
75
- compiledSize: c.compiledSize,
76
- reduction: `${c.reductionPercentage.toFixed(2)}%`,
77
- appliedRules: h,
78
- executionTime: `${c.executionTime.toFixed(2)}ms`
74
+ originalSize: n.originalSize,
75
+ compiledSize: n.compiledSize,
76
+ reduction: `${n.reductionPercentage.toFixed(2)}%`,
77
+ appliedRules: y,
78
+ executionTime: `${n.executionTime.toFixed(2)}ms`
79
79
  }), {
80
- dynamicContentList: C,
81
- compiledHtml: d,
82
- rawHtml: u,
80
+ dynamicContentList: h,
81
+ compiledHtml: u,
82
+ rawHtml: p,
83
83
  css: g,
84
- ampHtml: A,
85
- ampErrors: y,
84
+ ampHtml: a,
85
+ ampErrors: e,
86
86
  modules: f.map(Number),
87
87
  recommendation: {
88
- campaignUrls: T.recommendationCampaignUrls,
88
+ campaignUrls: A.recommendationCampaignUrls,
89
89
  configs: {}
90
90
  },
91
91
  unsubscribe: {
92
- status: r.unsubscribePagesStatus,
93
- config: U(d, r.selectedUnsubscribePages)
92
+ status: o.unsubscribePagesStatus,
93
+ config: E(u, o.selectedUnsubscribePages)
94
94
  }
95
95
  };
96
96
  }
97
97
  };
98
98
  };
99
99
  export {
100
- O as useTemplatePreparation
100
+ _ as useTemplatePreparation
101
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.6.0-beta.6807430",
3
+ "version": "3.6.0-beta.6c3407e",
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",
@@ -1,2 +0,0 @@
1
- export declare const AMP_ERROR_WHITELISTED_TOKENS: string[];
2
- export declare const filterAmpErrors: (ampErrors: string[]) => string[];
@@ -1,8 +0,0 @@
1
- import { MERGE_TAGS as t } from "../enums/unsubscribe.js";
2
- const E = Object.values(t), c = (r) => r.filter(
3
- (e) => !E.some((o) => e.includes(o))
4
- );
5
- export {
6
- E as AMP_ERROR_WHITELISTED_TOKENS,
7
- c as filterAmpErrors
8
- };