@useinsider/guido 3.4.1-beta.5e1fcb5 → 3.4.2-beta.6886b92

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.
@@ -9,25 +9,25 @@ const o = [
9
9
  getValue: (e) => e.currencySettings.value,
10
10
  getAvailableOptions: (e) => e.currencyList.map((n) => n.text)
11
11
  }
12
- ], u = "newsletter.recommendation-fill-required-fields";
13
- function l(e, n) {
12
+ ], l = "newsletter.recommendation-fill-required-fields";
13
+ function u(e, n) {
14
14
  return o.filter((t) => {
15
15
  var a;
16
16
  if (t.condition && !t.condition(e))
17
17
  return !1;
18
- const r = t.getValue(e);
19
- if (!r)
18
+ const i = t.getValue(e);
19
+ if (!i)
20
20
  return !0;
21
- const i = (a = t.getAvailableOptions) == null ? void 0 : a.call(t, n);
22
- return i !== void 0 && i.length > 0 && !i.includes(r);
21
+ const r = (a = t.getAvailableOptions) == null ? void 0 : a.call(t, n);
22
+ return r !== void 0 && !r.includes(i);
23
23
  }).map((t) => t.key);
24
24
  }
25
25
  function s(e, n) {
26
- return l(e, n).length === 0;
26
+ return u(e, n).length === 0;
27
27
  }
28
28
  export {
29
29
  o as REQUIRED_RECOMMENDATION_FIELDS,
30
- u as RecommendationRequiredFieldsKey,
31
- l as getInvalidFields,
30
+ l as RecommendationRequiredFieldsKey,
31
+ u as getInvalidFields,
32
32
  s as isConfigValid
33
33
  };
@@ -1,87 +1,79 @@
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 T } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
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));
5
+ import { DATA_ATTRIBUTES as y } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as D } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
9
+ function U(i, r) {
10
+ const s = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${y.PAGE_LIST}]`), c = [];
11
+ return s.forEach((t) => {
12
+ const o = t.getAttribute(y.PAGE_LIST);
13
+ o && c.push(...P(o));
14
+ }), r.filter((t) => c.includes(t));
15
15
  }
16
- async function U(i) {
16
+ function F(i) {
17
17
  const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
18
18
  if (m.length === 0)
19
19
  return;
20
- const l = b();
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))
20
+ const d = b();
21
+ m.forEach((s) => {
22
+ var g, f, u, n, S;
23
+ const c = s.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
24
+ if (!Number.isFinite(t))
25
25
  return;
26
- const a = t.getAttribute("esd-ext-config");
27
- if (!a)
26
+ const o = s.getAttribute("esd-ext-config");
27
+ if (!o)
28
28
  return;
29
29
  let e;
30
30
  try {
31
- e = JSON.parse(a);
31
+ e = JSON.parse(o);
32
32
  } catch {
33
33
  return;
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
37
  const p = {
38
- strategy: e.strategy ?? s.strategy,
39
- language: e.language ?? s.language,
40
- size: e.size ?? s.size,
38
+ strategy: e.strategy ?? a.strategy,
39
+ language: e.language ?? a.language,
40
+ size: e.size ?? a.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 ?? [...a.productIds],
44
+ filters: e.filters ?? [...a.filters],
45
+ shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
46
+ currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? l.code,
47
+ currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? l.alignment,
48
+ currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? l.decimalCount,
49
+ currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? l.decimalSeparator,
50
+ currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? l.thousandSeparator
51
51
  };
52
- l.seedBlockUrlConfig(r, p);
52
+ d.seedBlockUrlConfig(t, p);
53
53
  });
54
- try {
55
- await l.fetchRecommendationCreateData();
56
- } catch (t) {
57
- console.warn(
58
- "Recommendation reference data pre-load failed; validator will skip the availability check.",
59
- t
60
- );
61
- }
62
54
  }
63
55
  const _ = () => {
64
- const i = P(), o = w(), { getCompiledEmail: m, getTemplateData: l } = C(), { compileHtml: t } = T();
56
+ const i = D(), r = E(), { getCompiledEmail: m, getTemplateData: d } = T(), { compileHtml: s } = C();
65
57
  return {
66
58
  prepareTemplateDetails: async () => {
67
- const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
59
+ const { html: t, ampHtml: o = "", ampErrors: e = [] } = await m({
68
60
  minimize: !0,
69
61
  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();
62
+ }), { html: p, css: g, syncModulesIds: f = [] } = await d();
63
+ r.selectedUnsubscribePages.length && await r.fetchTemplates(), F(p);
64
+ const { compiledHtml: u, stats: n, appliedRules: S } = s(t), h = i.getSelectedDynamicContentList, A = b();
73
65
  return console.debug("HTML Compilation Stats:", {
74
66
  originalSize: n.originalSize,
75
67
  compiledSize: n.compiledSize,
76
68
  reduction: `${n.reductionPercentage.toFixed(2)}%`,
77
- appliedRules: y,
69
+ appliedRules: S,
78
70
  executionTime: `${n.executionTime.toFixed(2)}ms`
79
71
  }), {
80
72
  dynamicContentList: h,
81
73
  compiledHtml: u,
82
74
  rawHtml: p,
83
75
  css: g,
84
- ampHtml: a,
76
+ ampHtml: o,
85
77
  ampErrors: e,
86
78
  modules: f.map(Number),
87
79
  recommendation: {
@@ -89,8 +81,8 @@ const _ = () => {
89
81
  configs: {}
90
82
  },
91
83
  unsubscribe: {
92
- status: o.unsubscribePagesStatus,
93
- config: E(u, o.selectedUnsubscribePages)
84
+ status: r.unsubscribePagesStatus,
85
+ config: U(u, r.selectedUnsubscribePages)
94
86
  }
95
87
  };
96
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.4.1-beta.5e1fcb5",
3
+ "version": "3.4.2-beta.6886b92",
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",