@useinsider/guido 3.6.0-beta.859e737 → 3.6.0-beta.dc3a2aa

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,6 @@
1
- var O = Object.defineProperty;
2
- var p = (o, e, t) => e in o ? O(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var r = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
1
+ var p = Object.defineProperty;
2
+ var A = (o, e, t) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var r = (o, e, t) => A(o, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as N } from "../../../common-control.js";
6
6
  import { ATTR_DATA_CUSTOM_ATTRIBUTES as L } from "../../constants/selectors.js";
@@ -9,9 +9,9 @@ import { DEFAULT_COMPOSITION as _ } from "../../constants/defaultConfig.js";
9
9
  import { RecommendationConfigService as s } from "../../services/configService.js";
10
10
  import { useRecommendationExtensionStore as f } from "../../store/recommendation.js";
11
11
  import { getCurrentLayout as C, getBlockElement as I, regenerateProductRowsWithStyles as S } from "./utils.js";
12
- const U = "recommendation-layout-orientation-control", A = "recommendationInfoBannerTest", a = {
12
+ const U = "recommendation-layout-orientation-control", O = "recommendationInfoBannerTest", a = {
13
13
  LAYOUT: "layout"
14
- }, y = "data-card-composition", i = {
14
+ }, y = "data-card-composition", n = {
15
15
  LAYOUT: "data-layout",
16
16
  COLUMN_SPACING: "data-column-spacing",
17
17
  ROW_SPACING: "data-row-spacing",
@@ -30,7 +30,7 @@ class Y extends N {
30
30
  getTemplate() {
31
31
  return `
32
32
  <div class="layout-control-container">
33
- ${this._GuOnPageMessage({ name: A })}
33
+ ${this._GuOnPageMessage({ name: O })}
34
34
 
35
35
  ${this._GuTwoColumns([
36
36
  this._GuLabel({ text: this.api.translate("Layout Orientation") }),
@@ -44,10 +44,11 @@ class Y extends N {
44
44
  }
45
45
  onRender() {
46
46
  this._setInfoMessageValue(
47
- A,
47
+ O,
48
48
  this.api.translate(
49
- `Note that updating the Layout Orientation, Number of Products and
50
- Products in One Row settings resets the style of your Recommendation block.`
49
+ `Note that updating the Layout Orientation, Number of Products,
50
+ Products in One Row and Mobile Layout Optimization settings
51
+ resets the style of your Recommendation block.`
51
52
  )
52
53
  ), this._setFormValues(), this._listenToFormUpdates();
53
54
  }
@@ -83,8 +84,8 @@ class Y extends N {
83
84
  },
84
85
  `Changed layout to ${t}`
85
86
  ), this.store.patchCurrentBlockConfig({ orientation: t });
86
- const n = this.api.getDocumentModifier().modifyHtml(c).setAttribute(i.LAYOUT, t).setAttribute(i.COLUMN_SPACING, g.toString()).setAttribute(i.ROW_SPACING, l.toString()).setAttribute(i.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(i.MOBILE_ROW_SPACING, m.toString());
87
- t === "list" ? (n.setClass("es-m-p0"), n.setClass("ins-recommendation-list-layout")) : (n.removeClass("es-m-p0"), n.removeClass("ins-recommendation-list-layout")), n.setAttribute(y, _.join(",")).setAttribute(L, "[]"), n.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t);
87
+ const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, g.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
88
+ t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.setAttribute(y, _.join(",")).setAttribute(L, "[]"), i.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t);
88
89
  } finally {
89
90
  this.isChangingLayout = !1;
90
91
  }
@@ -1,5 +1,5 @@
1
1
  import { RecommendationBlockId as s } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
2
+ import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x, ATTR_PRODUCT_IMAGE as _ } from "../../constants/selectors.js";
3
3
  import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
4
4
  import { formatPrice as C } from "../../utils/priceFormatter.js";
5
5
  import { CUSTOM_CELL_HTML as R, sanitizeImageUrl as O } from "../utils.js";
@@ -23,7 +23,7 @@ function i(t, e = "price") {
23
23
  });
24
24
  }
25
25
  const S = {
26
- [x]: (t) => `
26
+ [_]: (t) => `
27
27
  <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
28
28
  <table
29
29
  class="product-card-segment"
@@ -51,7 +51,7 @@ const S = {
51
51
  </table>
52
52
  </td>
53
53
  `,
54
- [_]: (t) => `
54
+ [x]: (t) => `
55
55
  <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
56
56
  <table
57
57
  class="product-card-segment"
@@ -115,7 +115,9 @@ const S = {
115
115
  class="esd-block-text product-old-price es-p15l es-p15r"
116
116
  align="center"
117
117
  esd-extension-block-id="${s.OLD_PRICE}">
118
- <p contenteditable="false" style="font-size: 14px; color: #999999;">
118
+ <p
119
+ contenteditable="false"
120
+ style="font-size: 14px; color: #999999; text-decoration: line-through;">
119
121
  <strong>${i(t, "original_price")}</strong>
120
122
  </p>
121
123
  </td>
@@ -1,29 +1,29 @@
1
- function d(a, t) {
2
- const { thousandSeparator: s, decimalSeparator: e, decimalCount: r } = t, u = Math.abs(a).toFixed(r), [c, o] = u.split("."), n = c.replace(
1
+ function $(a, e) {
2
+ const { thousandSeparator: u, decimalSeparator: t, decimalCount: r } = e, m = Number(Math.abs(a).toPrecision(15)), [c, i = ""] = String(m).split("."), n = i.padEnd(r, "0"), s = c.replace(
3
3
  /\B(?=(\d{3})+(?!\d))/g,
4
- s
5
- ), i = a < 0 ? "-" : "";
6
- return r > 0 && o ? `${i}${n}${e}${o}` : `${i}${n}`;
4
+ u
5
+ ), o = a < 0 ? "-" : "";
6
+ return r > 0 && n ? `${o}${s}${t}${n}` : `${o}${s}`;
7
7
  }
8
- function m(a) {
9
- const { price: t, currency: s } = a, {
10
- symbol: e,
8
+ function d(a) {
9
+ const { price: e, currency: u } = a, {
10
+ symbol: t,
11
11
  alignment: r,
12
- thousandSeparator: u,
12
+ thousandSeparator: m,
13
13
  decimalSeparator: c,
14
- decimalCount: o
15
- } = s;
16
- if (typeof t != "number" || Number.isNaN(t)) {
17
- const i = "0".repeat(o), $ = `0${c}${i}`;
18
- return r === "before" ? `${e} ${$}` : `${$} ${e}`;
14
+ decimalCount: i
15
+ } = u;
16
+ if (typeof e != "number" || Number.isNaN(e)) {
17
+ const s = "0".repeat(i), o = `0${c}${s}`;
18
+ return r === "before" ? `${t} ${o}` : `${o} ${t}`;
19
19
  }
20
- const n = d(t, {
21
- thousandSeparator: u,
20
+ const n = $(e, {
21
+ thousandSeparator: m,
22
22
  decimalSeparator: c,
23
- decimalCount: o
23
+ decimalCount: i
24
24
  });
25
- return r === "before" ? `${e} ${n}` : `${n} ${e}`;
25
+ return r === "before" ? `${t} ${n}` : `${n} ${t}`;
26
26
  }
27
27
  export {
28
- m as formatPrice
28
+ d as formatPrice
29
29
  };
@@ -1,20 +1,4 @@
1
1
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
- /**
3
- * Collects every unsubscribe page id referenced by the unsubscribe blocks
4
- * present in the email HTML, deduped.
5
- *
6
- * The email's unsubscribe link is variation-scoped on the backend, which
7
- * resolves the page to render from the page ids the FE persists for that
8
- * variation. Those ids must reflect the blocks actually in the email — not a
9
- * UI-only selection store — otherwise a block that entered the editor by any
10
- * path other than the page-selection UI (e.g. a dropped saved module) sends an
11
- * empty association and the backend falls back to the default page.
12
- *
13
- * Read from raw editor HTML: the `data-unsubscribe-page-list` attribute lives
14
- * on the block node there (the save-time sync-module extractor relies on the
15
- * same source), so it is reliably present regardless of how the block was added.
16
- */
17
- export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
18
2
  export declare const useTemplatePreparation: () => {
19
3
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
20
4
  };
@@ -1,58 +1,58 @@
1
- import { useActionsApi as T } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as D } from "../composables/useHtmlCompiler.js";
3
- import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } 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
- import { DATA_ATTRIBUTES as h } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as w } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
9
- function U(c) {
10
- const n = new DOMParser().parseFromString(c, "text/html").querySelectorAll(`[${h.PAGE_LIST}]`), t = [];
11
- return n.forEach((s) => {
12
- const r = s.getAttribute(h.PAGE_LIST);
13
- r && t.push(...P(r));
14
- }), [...new Set(t)];
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));
15
15
  }
16
- async function F(c) {
17
- const i = new DOMParser().parseFromString(c, "text/html").querySelectorAll(".recommendation-block-v2");
18
- if (i.length === 0)
16
+ async function U(i) {
17
+ const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
18
+ if (m.length === 0)
19
19
  return;
20
- const n = b();
21
- i.forEach((t) => {
22
- var p, g, f, o, y;
23
- const s = t.getAttribute("recommendation-id"), r = s ? Number(s) : NaN;
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
24
  if (!Number.isFinite(r))
25
25
  return;
26
- const d = t.getAttribute("esd-ext-config");
27
- if (!d)
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(d);
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 m = {
38
- strategy: e.strategy ?? a.strategy,
39
- language: e.language ?? a.language,
40
- size: e.size ?? a.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 ?? [...a.productIds],
44
- filters: e.filters ?? [...a.filters],
45
- shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
46
- currencyCode: ((p = e.currency) == null ? void 0 : p.code) ?? l.code,
47
- currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? l.alignment,
48
- currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? l.decimalCount,
49
- currencyDecimalSeparator: ((o = e.currency) == null ? void 0 : o.decimalSeparator) ?? l.decimalSeparator,
50
- currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? l.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
- n.seedBlockUrlConfig(r, m);
52
+ l.seedBlockUrlConfig(r, p);
53
53
  });
54
54
  try {
55
- await n.fetchRecommendationCreateData();
55
+ await l.fetchRecommendationCreateData();
56
56
  } catch (t) {
57
57
  console.warn(
58
58
  "Recommendation reference data pre-load failed; validator will skip the availability check.",
@@ -60,43 +60,42 @@ async function F(c) {
60
60
  );
61
61
  }
62
62
  }
63
- const k = () => {
64
- const c = w(), u = E(), { getCompiledEmail: i, getTemplateData: n } = T(), { compileHtml: t } = D();
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: r, ampHtml: d = "", ampErrors: e = [] } = await i({
67
+ const { html: r, ampHtml: a = "", ampErrors: e = [] } = await m({
68
68
  minimize: !0,
69
69
  resetDataSavedFlag: !1
70
- }), { html: m, css: p, syncModulesIds: g = [] } = await n();
71
- u.selectedUnsubscribePages.length && await u.fetchTemplates(), await F(m);
72
- const { compiledHtml: f, stats: o, appliedRules: y } = t(r), A = c.getSelectedDynamicContentList, C = b(), S = U(m);
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: o.originalSize,
75
- compiledSize: o.compiledSize,
76
- reduction: `${o.reductionPercentage.toFixed(2)}%`,
74
+ originalSize: n.originalSize,
75
+ compiledSize: n.compiledSize,
76
+ reduction: `${n.reductionPercentage.toFixed(2)}%`,
77
77
  appliedRules: y,
78
- executionTime: `${o.executionTime.toFixed(2)}ms`
78
+ executionTime: `${n.executionTime.toFixed(2)}ms`
79
79
  }), {
80
- dynamicContentList: A,
81
- compiledHtml: f,
82
- rawHtml: m,
83
- css: p,
84
- ampHtml: d,
80
+ dynamicContentList: h,
81
+ compiledHtml: u,
82
+ rawHtml: p,
83
+ css: g,
84
+ ampHtml: a,
85
85
  ampErrors: e,
86
- modules: g.map(Number),
86
+ modules: f.map(Number),
87
87
  recommendation: {
88
- campaignUrls: C.recommendationCampaignUrls,
88
+ campaignUrls: A.recommendationCampaignUrls,
89
89
  configs: {}
90
90
  },
91
91
  unsubscribe: {
92
- status: S.length > 0,
93
- config: S
92
+ status: o.unsubscribePagesStatus,
93
+ config: E(u, o.selectedUnsubscribePages)
94
94
  }
95
95
  };
96
96
  }
97
97
  };
98
98
  };
99
99
  export {
100
- U as getHtmlReferencedUnsubscribePages,
101
- k as useTemplatePreparation
100
+ _ as useTemplatePreparation
102
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.6.0-beta.859e737",
3
+ "version": "3.6.0-beta.dc3a2aa",
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",