@useinsider/guido 3.6.0-beta.4f2bf14 → 3.6.0-beta.804c9cb

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,6 +1,7 @@
1
- import { useToaster as w } from "./useToaster.js";
2
- const v = () => {
3
- const { handleError: n } = w(), m = (t = {}) => new Promise((e, a) => {
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) => {
4
5
  const o = { ...{
5
6
  minimize: !0,
6
7
  utmEntity: {
@@ -20,29 +21,29 @@ const v = () => {
20
21
  forceAmp: !1,
21
22
  resetDataSavedFlag: !1,
22
23
  disableLineHeightsReplace: !0
23
- }, ...t }, s = {
24
- callback: (l, p, d, c, u) => {
25
- l ? a(l) : e({
24
+ }, ...t }, l = {
25
+ callback: (r, p, d, c, u) => {
26
+ r ? a(r) : e({
26
27
  html: p,
27
28
  ampHtml: d,
28
- ampErrors: c,
29
+ ampErrors: w(c ?? []),
29
30
  displayConditions: u
30
31
  });
31
32
  },
32
33
  ...o
33
34
  };
34
- window.StripoEditorApi.actionsApi.compileEmail(s);
35
+ window.StripoEditorApi.actionsApi.compileEmail(l);
35
36
  });
36
37
  return {
37
- getCompiledEmail: m,
38
+ getCompiledEmail: s,
38
39
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: a, css: i, width: o, height: r, utmParams: s, syncModulesIds: l }) => t({
40
+ const e = ({ html: a, css: i, width: o, height: m, utmParams: l, syncModulesIds: r }) => t({
40
41
  html: a,
41
42
  css: i,
42
43
  width: o,
43
- height: r,
44
- utmParams: s,
45
- syncModulesIds: l
44
+ height: m,
45
+ utmParams: l,
46
+ syncModulesIds: r
46
47
  });
47
48
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
49
  }),
@@ -56,7 +57,7 @@ const v = () => {
56
57
  displayConditions: a,
57
58
  ampHtml: i = "",
58
59
  ampErrors: o = []
59
- } = await m({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
+ } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
61
  return {
61
62
  html: e,
62
63
  ampHtml: i,
@@ -101,5 +102,5 @@ const v = () => {
101
102
  };
102
103
  };
103
104
  export {
104
- v as useActionsApi
105
+ D as useActionsApi
105
106
  };
@@ -1,30 +1,48 @@
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,
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,
15
34
  ...g,
16
- ...f,
17
- ...C,
18
35
  ...b,
19
- ...t("liquidSyntax") ? R : [],
20
- ...s.map((o, a) => ({
36
+ ...H,
37
+ ...a("liquidSyntax") ? C : [],
38
+ ...u.map((o, f) => ({
21
39
  ...o,
22
- priority: o.priority + 1e3 + a
40
+ priority: o.priority + 1e3 + f
23
41
  // Ensure additional rules run after default rules
24
42
  }))
25
- ], p = H(u), n = (r = i.value) == null ? void 0 : r.fallbackFont;
26
- return { compileHtml: (o) => p.compile(o, void 0, n) };
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) };
27
45
  };
28
46
  export {
29
- w as useHtmlCompiler
47
+ M as useHtmlCompiler
30
48
  };
@@ -1,35 +1,33 @@
1
- import { useStripoApi as c } from "../services/stripoApi.js";
1
+ import { useStripoApi as i } from "../services/stripoApi.js";
2
2
  import { useEditorStore as u } from "../stores/editor.js";
3
3
  import { useOnboardingStore as l } from "../stores/onboarding.js";
4
4
  import { useUnsubscribeStore as b } from "../stores/unsubscribe.js";
5
5
  const v = () => {
6
- const { updateSyncModule: r, getSyncModule: a } = c(), t = u(), s = b(), i = {
6
+ const { updateSyncModule: d, getSyncModule: r } = i(), n = u(), s = b(), a = {
7
7
  block_dropped: ({ blockName: e }) => {
8
8
  if (e === "BLOCK_TEXT") {
9
- const o = l(), n = !o.shouldShowOnboarding("textBlockOnboarding"), d = o.isActive("textBlockOnboarding");
10
- if (n || d)
9
+ const o = l(), t = !o.shouldShowOnboarding("textBlockOnboarding"), c = o.isActive("textBlockOnboarding");
10
+ if (t || c)
11
11
  return;
12
12
  o.start("textBlockOnboarding");
13
13
  }
14
14
  },
15
15
  module_saved: async (e) => {
16
- t.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await r(e));
16
+ n.syncModulesEnabled && (console.debug("[module_saved] Saved module data:", e), await d(e));
17
17
  },
18
18
  module_dropped: async (e) => {
19
- if (!t.syncModulesEnabled)
19
+ if (!n.syncModulesEnabled)
20
20
  return;
21
- const { moduleId: o } = e, n = await a(o);
22
- console.debug("[module_dropped] Sync module data:", n), n.unsubscriptionPreferencePages.length && (await s.fetchTemplates(), s.addUnsubscribePages(
23
- n.unsubscriptionPreferencePages.map((d) => d.id)
24
- ));
21
+ const { moduleId: o } = e, t = await r(o);
22
+ console.debug("[module_dropped] Sync module data:", t), t.unsubscriptionPreferencePages.length && await s.fetchTemplates();
25
23
  },
26
24
  module_updated: async (e) => {
27
- t.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await r(e));
25
+ n.syncModulesEnabled && (console.debug("[module_updated] Updated module data:", e), await d(e));
28
26
  }
29
27
  };
30
28
  return { handleEvent: async (e, o) => {
31
- const n = i[e];
32
- console.debug("Stripo Event: ", e, o), n && await n(o);
29
+ const t = a[e];
30
+ console.debug("Stripo Event: ", e, o), t && await t(o);
33
31
  } };
34
32
  };
35
33
  export {
@@ -1,31 +1,31 @@
1
- var f = Object.defineProperty;
2
- var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
3
- var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
1
+ var C = Object.defineProperty;
2
+ var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
3
+ var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
4
4
  import { CommonControl as g } from "../../../common-control.js";
5
5
  import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
6
6
  import { RecommendationConfigService as h } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
8
- import { AlgorithmControl as R } from "./algorithm.js";
9
- import { ALGORITHM_CONTROL_ID as J } from "./algorithm.js";
10
- import { CurrencyControl as N } from "./currency.js";
11
- import { CURRENCY_CONTROL_ID as X } from "./currency.js";
8
+ import { AlgorithmControl as N } from "./algorithm.js";
9
+ import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
10
+ import { CurrencyControl as R } from "./currency.js";
11
+ import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
12
12
  import { FiltersControl as _ } from "./filters.js";
13
- import { FILTERS_CONTROL_ID as tt } from "./filters.js";
13
+ import { FILTERS_CONTROL_ID as et } from "./filters.js";
14
14
  import { LayoutOrientationControl as b } from "./layoutOrientation.js";
15
- import { LAYOUT_ORIENTATION_CONTROL_ID as ot } from "./layoutOrientation.js";
15
+ import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
16
16
  import { LocaleControl as O } from "./locale.js";
17
- import { LOCALE_CONTROL_ID as nt } from "./locale.js";
17
+ import { LOCALE_CONTROL_ID as it } from "./locale.js";
18
18
  import { ProductCountControl as I } from "./productCount.js";
19
- import { PRODUCT_COUNT_CONTROL_ID as st } from "./productCount.js";
19
+ import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
20
20
  import { ProductLayoutControl as T } from "./productLayout.js";
21
21
  import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
22
22
  import { ShuffleControl as S } from "./shuffle.js";
23
- import { SHUFFLE_CONTROL_ID as ut } from "./shuffle.js";
24
- import { getBlockElement as L, updateProductContentInPlace as P, regenerateProductRowsWithStyles as D } from "./utils.js";
25
- import { adjustProductsToSize as ht, formatProductPrice as mt, getCardComposition as Ct, getCurrentLayout as ft, reapplySpacing as pt, regenerateMobileProductRows as gt, regenerateProductRows as yt, setCurrencyAttributes as Rt, updatePricesInPlace as Nt, updateSingleProductContent as _t } from "./utils.js";
23
+ import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
24
+ import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as D, regenerateProductRowsWithStyles as k } from "./utils.js";
25
+ import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Nt, updatePricesInPlace as Rt, updateSingleProductContent as _t } from "./utils.js";
26
26
  import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
27
- const k = "recommendation-id", E = "ui-elements-recommendation-block";
28
- class H extends g {
27
+ const E = "recommendation-id", v = "ui-elements-recommendation-block";
28
+ class K extends g {
29
29
  constructor() {
30
30
  super(...arguments);
31
31
  s(this, "store", y());
@@ -62,11 +62,11 @@ class H extends g {
62
62
  if (!this.currentNode || !this.api)
63
63
  return;
64
64
  const e = this.api.getDocumentModifier();
65
- P({
65
+ D({
66
66
  currentNode: this.currentNode,
67
67
  documentModifier: e,
68
68
  products: t
69
- }) || D({
69
+ }) || k({
70
70
  currentNode: this.currentNode,
71
71
  documentModifier: e,
72
72
  products: t
@@ -74,10 +74,10 @@ class H extends g {
74
74
  }, 100));
75
75
  }
76
76
  getId() {
77
- return E;
77
+ return v;
78
78
  }
79
79
  getTemplate() {
80
- return this.algorithmControl = new R(), this.localeControl = new O(), this.currencyControl = new N(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
80
+ return this.algorithmControl = new N(), this.localeControl = new O(), this.currencyControl = new R(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
81
81
  this.algorithmControl,
82
82
  this.localeControl,
83
83
  this.currencyControl,
@@ -263,7 +263,11 @@ class H extends g {
263
263
  this.currentNode,
264
264
  e,
265
265
  "Applied smart defaults"
266
- ), this.store.patchCurrentBlockConfig({
266
+ ), o && e.currency && L({
267
+ currentNode: this.currentNode,
268
+ documentModifier: this.api.getDocumentModifier(),
269
+ currency: e.currency
270
+ }), this.store.patchCurrentBlockConfig({
267
271
  ...o ? {
268
272
  currencySettings: {
269
273
  name: o,
@@ -283,10 +287,10 @@ class H extends g {
283
287
  * Reads the recommendation-id attribute from the block element within the node
284
288
  */
285
289
  _getRecommendationIdFromNode(t) {
286
- const e = L(t);
290
+ const e = P(t);
287
291
  if (!e || !("getAttribute" in e))
288
292
  return null;
289
- const o = e.getAttribute(k);
293
+ const o = e.getAttribute(E);
290
294
  if (!o)
291
295
  return null;
292
296
  const r = parseInt(o);
@@ -316,8 +320,8 @@ class H extends g {
316
320
  }
317
321
  const i = t.$state.configVersion;
318
322
  i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
319
- const c = t.recommendationProducts, u = c !== e, C = Array.isArray(c) && c.length > 0;
320
- u && C && (e = c, this._debouncedRegenerateWithProducts());
323
+ const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
324
+ u && f && (e = l, this._debouncedRegenerateWithProducts());
321
325
  });
322
326
  }
323
327
  /**
@@ -337,35 +341,35 @@ class H extends g {
337
341
  }
338
342
  }
339
343
  export {
340
- J as ALGORITHM_CONTROL_ID,
341
- R as AlgorithmControl,
342
- E as CONTROL_BLOCK_ID,
343
- X as CURRENCY_CONTROL_ID,
344
- N as CurrencyControl,
345
- tt as FILTERS_CONTROL_ID,
344
+ Q as ALGORITHM_CONTROL_ID,
345
+ N as AlgorithmControl,
346
+ v as CONTROL_BLOCK_ID,
347
+ Z as CURRENCY_CONTROL_ID,
348
+ R as CurrencyControl,
349
+ et as FILTERS_CONTROL_ID,
346
350
  _ as FiltersControl,
347
- ot as LAYOUT_ORIENTATION_CONTROL_ID,
348
- nt as LOCALE_CONTROL_ID,
351
+ rt as LAYOUT_ORIENTATION_CONTROL_ID,
352
+ it as LOCALE_CONTROL_ID,
349
353
  b as LayoutOrientationControl,
350
354
  O as LocaleControl,
351
- st as PRODUCT_COUNT_CONTROL_ID,
355
+ at as PRODUCT_COUNT_CONTROL_ID,
352
356
  lt as PRODUCT_LAYOUT_CONTROL_ID,
353
357
  I as ProductCountControl,
354
358
  T as ProductLayoutControl,
355
- H as RecommendationBlockControl,
356
- ut as SHUFFLE_CONTROL_ID,
359
+ K as RecommendationBlockControl,
360
+ dt as SHUFFLE_CONTROL_ID,
357
361
  S as ShuffleControl,
358
- ht as adjustProductsToSize,
359
- mt as formatProductPrice,
360
- L as getBlockElement,
362
+ mt as adjustProductsToSize,
363
+ ft as formatProductPrice,
364
+ P as getBlockElement,
361
365
  Ct as getCardComposition,
362
- ft as getCurrentLayout,
363
- pt as reapplySpacing,
364
- gt as regenerateMobileProductRows,
365
- yt as regenerateProductRows,
366
- D as regenerateProductRowsWithStyles,
367
- Rt as setCurrencyAttributes,
368
- Nt as updatePricesInPlace,
369
- P as updateProductContentInPlace,
366
+ pt as getCurrentLayout,
367
+ gt as reapplySpacing,
368
+ yt as regenerateMobileProductRows,
369
+ Nt as regenerateProductRows,
370
+ k as regenerateProductRowsWithStyles,
371
+ L as setCurrencyAttributes,
372
+ Rt as updatePricesInPlace,
373
+ D as updateProductContentInPlace,
370
374
  _t as updateSingleProductContent
371
375
  };
@@ -1,6 +1,6 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
3
+ import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as E } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
6
  import { prepareProductRows as _ } from "../../templates/index.js";
@@ -1,4 +1,5 @@
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;
4
5
  };
@@ -0,0 +1,2 @@
1
+ export declare const AMP_ERROR_WHITELISTED_TOKENS: string[];
2
+ export declare const filterAmpErrors: (ampErrors: string[]) => string[];
@@ -0,0 +1,8 @@
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
+ };
@@ -1,55 +1,55 @@
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";
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";
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 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));
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));
15
15
  }
16
- async function U(i) {
17
- const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
16
+ async function F(s) {
17
+ const m = new DOMParser().parseFromString(s, "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 g, f, u, n, y;
23
- const c = t.getAttribute("recommendation-id"), r = c ? Number(c) : NaN;
24
- if (!Number.isFinite(r))
22
+ var u, g, f, d, c;
23
+ const o = t.getAttribute("recommendation-id"), a = o ? Number(o) : NaN;
24
+ if (!Number.isFinite(a))
25
25
  return;
26
- const a = t.getAttribute("esd-ext-config");
27
- if (!a)
26
+ const n = t.getAttribute("esd-ext-config");
27
+ if (!n)
28
28
  return;
29
29
  let e;
30
30
  try {
31
- e = JSON.parse(a);
31
+ e = JSON.parse(n);
32
32
  } catch {
33
33
  return;
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
- const p = {
38
- strategy: e.strategy ?? s.strategy,
39
- language: e.language ?? s.language,
40
- size: e.size ?? s.size,
37
+ const y = {
38
+ strategy: e.strategy ?? i.strategy,
39
+ language: e.language ?? i.language,
40
+ size: e.size ?? i.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 ?? [...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
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
51
51
  };
52
- l.seedBlockUrlConfig(r, p);
52
+ l.seedBlockUrlConfig(a, y);
53
53
  });
54
54
  try {
55
55
  await l.fetchRecommendationCreateData();
@@ -60,42 +60,42 @@ async function U(i) {
60
60
  );
61
61
  }
62
62
  }
63
- const _ = () => {
64
- const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
63
+ const O = () => {
64
+ const s = E(), r = H(), { getCompiledEmail: m, getTemplateData: l } = D(), { compileHtml: t, compileAmpHtml: o } = P();
65
65
  return {
66
66
  prepareTemplateDetails: async () => {
67
- const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
67
+ const { html: n, ampHtml: e = "", ampErrors: y = [] } = await m({
68
68
  minimize: !0,
69
69
  resetDataSavedFlag: !1
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();
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();
73
73
  return console.debug("HTML Compilation Stats:", {
74
- originalSize: n.originalSize,
75
- compiledSize: n.compiledSize,
76
- reduction: `${n.reductionPercentage.toFixed(2)}%`,
77
- appliedRules: y,
78
- executionTime: `${n.executionTime.toFixed(2)}ms`
74
+ originalSize: c.originalSize,
75
+ compiledSize: c.compiledSize,
76
+ reduction: `${c.reductionPercentage.toFixed(2)}%`,
77
+ appliedRules: h,
78
+ executionTime: `${c.executionTime.toFixed(2)}ms`
79
79
  }), {
80
- dynamicContentList: h,
81
- compiledHtml: u,
82
- rawHtml: p,
80
+ dynamicContentList: C,
81
+ compiledHtml: d,
82
+ rawHtml: u,
83
83
  css: g,
84
- ampHtml: a,
85
- ampErrors: e,
84
+ ampHtml: A,
85
+ ampErrors: y,
86
86
  modules: f.map(Number),
87
87
  recommendation: {
88
- campaignUrls: A.recommendationCampaignUrls,
88
+ campaignUrls: T.recommendationCampaignUrls,
89
89
  configs: {}
90
90
  },
91
91
  unsubscribe: {
92
- status: o.unsubscribePagesStatus,
93
- config: E(u, o.selectedUnsubscribePages)
92
+ status: r.unsubscribePagesStatus,
93
+ config: U(d, r.selectedUnsubscribePages)
94
94
  }
95
95
  };
96
96
  }
97
97
  };
98
98
  };
99
99
  export {
100
- _ as useTemplatePreparation
100
+ O 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.4f2bf14",
3
+ "version": "3.6.0-beta.804c9cb",
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",