@useinsider/guido 3.6.0-beta.804c9cb → 3.6.0-beta.8307d2e

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,31 +1,32 @@
1
1
  import { useActionsApi as x } from "./useActionsApi.js";
2
2
  import { useConfig as y } from "./useConfig.js";
3
- import { useSaveStart as w, useSaveComplete as C } from "./useGuidoActions.js";
4
- import { useSyncModuleExtractor as E } from "./useSyncModuleExtractor.js";
5
- import { useStripoApi as H } from "../services/stripoApi.js";
6
- import { useTemplatePreparation as b } from "../utils/templatePreparation.js";
7
- import { useHtmlValidator as q } from "./useHtmlValidator.js";
3
+ import { useSaveStart as w, useSaveComplete as H } from "./useGuidoActions.js";
4
+ import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
5
+ import { useStripoApi as C } from "../services/stripoApi.js";
6
+ import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
7
+ import { useHtmlValidator as k } from "./useHtmlValidator.js";
8
8
  import { useCouponBlockValidator as L } from "./validators/useCouponBlockValidator.js";
9
9
  import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
10
- const z = () => {
11
- const o = w(), s = C(), { validateHtml: r } = q(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { callbacks: a, isFeatureEnabled: d } = y(), { extractSyncModuleData: u } = E(), { setSyncModuleUnsubscriptionPages: c } = H(), { editorSave: m } = x();
12
- return { save: async (p = !1, f = !1) => {
13
- var i;
10
+ import { useUnsubscribeBlockValidator as B } from "./validators/useUnsubscribeBlockValidator.js";
11
+ const J = () => {
12
+ const o = w(), s = H(), { validateHtml: r } = k(), { validateLiquidSyntax: n } = P(), { validateCouponBlockTags: l } = L(), { validateUnsubscribeBlockUniqueness: d } = B(), { callbacks: i, isFeatureEnabled: u } = y(), { extractSyncModuleData: c } = q(), { setSyncModuleUnsubscriptionPages: m } = C(), { editorSave: p } = x();
13
+ return { save: async (f = !1, v = !1) => {
14
+ var a;
14
15
  o();
15
- const { prepareTemplateDetails: v } = b(), t = await v();
16
- if (!l(t.compiledHtml))
16
+ const { prepareTemplateDetails: S } = E(), t = await S();
17
+ if (!l(t.compiledHtml) || !d(t.compiledHtml))
17
18
  return;
18
- if (d("liquidSyntax")) {
19
+ if (u("liquidSyntax")) {
19
20
  if (!await n(t.compiledHtml))
20
21
  return;
21
22
  } else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
22
23
  return;
23
- if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t) || !await m())
24
+ if ((a = i.value) != null && a.externalValidation && !await i.value.externalValidation(t) || !await p())
24
25
  return;
25
- const { unsubscribePayload: S, stripoModules: V } = u(t.rawHtml);
26
- return await c(S), t.modules = V, p || s({ ...t, silent: f }), t;
26
+ const { unsubscribePayload: V, stripoModules: b } = c(t.rawHtml);
27
+ return await m(V), t.modules = b, f || s({ ...t, silent: v }), t;
27
28
  } };
28
29
  };
29
30
  export {
30
- z as useSave
31
+ J as useSave
31
32
  };
@@ -0,0 +1,32 @@
1
+ import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
+ import { PAGE_TYPES as n } from "../../enums/unsubscribe.js";
3
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as u, DATA_ATTRIBUTES as l } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
+ import { useToaster as T } from "../useToaster.js";
5
+ import { useTranslations as E } from "../useTranslations.js";
6
+ const m = [
7
+ {
8
+ pageType: n.GLOBAL_UNSUBSCRIBE,
9
+ messageKey: "unsubscription-preference.duplicate-global-unsub"
10
+ },
11
+ {
12
+ pageType: n.SUBSCRIPTION_PREFERENCE_CENTER,
13
+ messageKey: "unsubscription-preference.duplicate-pref-center"
14
+ }
15
+ ], g = "unsubscription-preference.duplicate-both", y = () => {
16
+ const { showToaster: o } = T(), a = E();
17
+ return { validateUnsubscribeBlockUniqueness: (c) => {
18
+ const p = new DOMParser().parseFromString(c, "text/html"), t = /* @__PURE__ */ new Map();
19
+ p.querySelectorAll(u).forEach((e) => {
20
+ const r = Number(e.getAttribute(l.PAGE_TYPE));
21
+ t.set(r, (t.get(r) ?? 0) + 1);
22
+ });
23
+ const s = m.filter((e) => (t.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
+ return s.length ? (o({
25
+ type: i.Alert,
26
+ message: a(s.length > 1 ? g : s[0])
27
+ }), !1) : !0;
28
+ } };
29
+ };
30
+ export {
31
+ y as useUnsubscribeBlockValidator
32
+ };
@@ -5,11 +5,11 @@ import { useToaster as B } from "../../../composables/useToaster.js";
5
5
  import { ToasterTypeOptions as S } from "../../../enums/toaster.js";
6
6
  import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
7
7
  import { useUnsubscribeStore as a } from "../../../stores/unsubscribe.js";
8
- import { Block as L, BlockCompositionType as f, ContextActionType as h, ModificationDescription as b, BlockType as v } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
- import { getDefaultTemplate as A } from "./template.js";
10
- import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
11
- import { parsePageList as p } from "./utils/utils.js";
12
- const y = "unsubscribe-block", m = 'a[data-unsubscribe-link="true"]', _ = ".unsubscribe-block-v2", I = "{{ins-unsubscribe-link}}", T = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", C = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", N = {
8
+ import { Block as L, BlockCompositionType as f, ContextActionType as h, ModificationDescription as b, BlockType as A } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
9
+ import { getDefaultTemplate as v } from "./template.js";
10
+ import { DATA_ATTRIBUTES as i, UNSUBSCRIBE_BLOCK_SELECTOR as p, UNSUBSCRIBE_EVENTS as d } from "./utils/constants.js";
11
+ import { parsePageList as m } from "./utils/utils.js";
12
+ const y = "unsubscribe-block", _ = 'a[data-unsubscribe-link="true"]', I = "{{ins-unsubscribe-link}}", T = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", C = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", N = {
13
13
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
14
14
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
15
15
  };
@@ -42,7 +42,7 @@ class F extends L {
42
42
  return this.api.translate("Unsubscribe Block Description");
43
43
  }
44
44
  getTemplate() {
45
- return A();
45
+ return v();
46
46
  }
47
47
  getContextActionsIds() {
48
48
  return [h.MOVE, h.REMOVE];
@@ -68,7 +68,7 @@ class F extends L {
68
68
  this._removeEventListeners(), this.currentNode = void 0, this.linkStateByBlockId.clear();
69
69
  }
70
70
  _hasUnsubscribeLink(e) {
71
- return "querySelector" in e ? !!e.querySelector(m) : !1;
71
+ return "querySelector" in e ? !!e.querySelector(_) : !1;
72
72
  }
73
73
  _readBlockId(e) {
74
74
  return "getAttribute" in e ? e.getAttribute(i.BLOCK_ID) : null;
@@ -102,7 +102,7 @@ class F extends L {
102
102
  let e = 0;
103
103
  try {
104
104
  const t = this.api.getDocumentRoot();
105
- t && "querySelectorAll" in t && t.querySelectorAll(_).forEach((s) => {
105
+ t && "querySelectorAll" in t && t.querySelectorAll(p).forEach((s) => {
106
106
  if ("getAttribute" in s) {
107
107
  const o = s.getAttribute(i.BLOCK_ID), u = o ? parseInt(o) : 0;
108
108
  u > e && (e = u);
@@ -150,7 +150,7 @@ class F extends L {
150
150
  try {
151
151
  if (!this.currentNode)
152
152
  return;
153
- this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${v.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
153
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${A.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
154
154
  } catch (e) {
155
155
  console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
156
156
  }
@@ -161,7 +161,7 @@ class F extends L {
161
161
  _updateBlock(e, t) {
162
162
  if (!this.currentNode || !("querySelector" in this.currentNode))
163
163
  return;
164
- const r = this.currentNode.querySelector(m);
164
+ const r = this.currentNode.querySelector(_);
165
165
  if (!r)
166
166
  return;
167
167
  const s = this._getMergeTag(e);
@@ -181,7 +181,7 @@ class F extends L {
181
181
  }
182
182
  _checkExistingBlocks() {
183
183
  const e = a();
184
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(_).forEach((r) => {
184
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(p).forEach((r) => {
185
185
  if ("getAttribute" in r) {
186
186
  const s = r.getAttribute(i.PAGE_TYPE);
187
187
  if (s) {
@@ -197,7 +197,7 @@ class F extends L {
197
197
  const t = e.getAttribute(i.PAGE_TYPE), r = e.getAttribute(i.PAGE_LIST);
198
198
  if (!t || !r)
199
199
  return;
200
- const s = a(), o = Number(t), u = p(r);
200
+ const s = a(), o = Number(t), u = m(r);
201
201
  await s.fetchTemplates(), s.setCollectionWithoutAutoSelection(o), s.loadSelectedTemplates(u);
202
202
  }
203
203
  _resetStoreState() {
@@ -209,7 +209,7 @@ class F extends L {
209
209
  const t = e.getAttribute(i.PAGE_LIST);
210
210
  if (!t)
211
211
  return;
212
- const r = a(), s = p(t);
212
+ const r = a(), s = m(t);
213
213
  r.removeUnsubscribePages(s);
214
214
  }
215
215
  }
@@ -1,12 +1,13 @@
1
1
  const s = {
2
2
  SELECT: "unsubscribe:select",
3
3
  CANCEL: "unsubscribe:cancel"
4
- }, e = {
4
+ }, b = {
5
5
  PAGE_TYPE: "data-unsubscribe-page-type",
6
6
  PAGE_LIST: "data-unsubscribe-page-list",
7
7
  BLOCK_ID: "data-unsubscribe-block-id"
8
- };
8
+ }, c = ".unsubscribe-block-v2";
9
9
  export {
10
- e as DATA_ATTRIBUTES,
10
+ b as DATA_ATTRIBUTES,
11
+ c as UNSUBSCRIBE_BLOCK_SELECTOR,
11
12
  s as UNSUBSCRIBE_EVENTS
12
13
  };
@@ -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
  };
@@ -0,0 +1,3 @@
1
+ export declare const useUnsubscribeBlockValidator: () => {
2
+ validateUnsubscribeBlockUniqueness: (html: string) => boolean;
3
+ };
@@ -8,3 +8,4 @@ export declare const DATA_ATTRIBUTES: {
8
8
  readonly PAGE_LIST: "data-unsubscribe-page-list";
9
9
  readonly BLOCK_ID: "data-unsubscribe-block-id";
10
10
  };
11
+ export declare const UNSUBSCRIBE_BLOCK_SELECTOR = ".unsubscribe-block-v2";
@@ -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.804c9cb",
3
+ "version": "3.6.0-beta.8307d2e",
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
- };