@useinsider/guido 3.10.0-beta.c6c8506 → 3.10.0-beta.cbd47be
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,16 +1,16 @@
|
|
|
1
1
|
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as M, REGEX as d, VerticalOrientation as $, CSS as n, ATTRIBUTES as p, CONDITIONS as T, HTML as g } from "../../enums/recommendation.js";
|
|
3
3
|
import { prepareRecommendationBlocks as O } from "./utils/recommendationCompilerUtils.js";
|
|
4
|
-
const
|
|
4
|
+
const U = [
|
|
5
5
|
{
|
|
6
6
|
id: "replace-images-with-variable-names",
|
|
7
7
|
description: "Replacing dummy images with variable names in recommendation module",
|
|
8
8
|
type: "custom",
|
|
9
|
-
processor: (
|
|
10
|
-
let e =
|
|
11
|
-
return Object.entries(
|
|
12
|
-
Object.entries(r).forEach(([
|
|
13
|
-
e = e.replaceAll(i, `{{${
|
|
9
|
+
processor: (o) => {
|
|
10
|
+
let e = o;
|
|
11
|
+
return Object.entries(M).forEach(([, r]) => {
|
|
12
|
+
Object.entries(r).forEach(([t, i]) => {
|
|
13
|
+
e = e.replaceAll(i, `{{${t}}}`);
|
|
14
14
|
});
|
|
15
15
|
}), e;
|
|
16
16
|
},
|
|
@@ -41,10 +41,10 @@ const H = [
|
|
|
41
41
|
id: "add-recommendation-unresponsive-css",
|
|
42
42
|
description: "Adding recommendation unresponsive css",
|
|
43
43
|
type: "custom",
|
|
44
|
-
processor: (
|
|
44
|
+
processor: (o) => {
|
|
45
45
|
const { calculateCardWidth: e, getRecommendationCampaignData: r } = N();
|
|
46
|
-
let
|
|
47
|
-
const i =
|
|
46
|
+
let t = o;
|
|
47
|
+
const i = t.match(d.ID);
|
|
48
48
|
if (i) {
|
|
49
49
|
const s = [];
|
|
50
50
|
if (i.forEach((c) => {
|
|
@@ -52,10 +52,10 @@ const H = [
|
|
|
52
52
|
u.textTrimming && u.orientation === $ && s.push(e(u));
|
|
53
53
|
}), s.length) {
|
|
54
54
|
const c = `width:${Math.min(...s)}px!important;`;
|
|
55
|
-
|
|
55
|
+
t = t.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${c} ${n.ELLIPSIS}`).replace(n.REGULAR_NAME_CONTAINER_HEIGHT, n.TRIMMED_NAME_CONTAINER_CSS).replace(n.RESPONSIVE_NAME_SIZE, `${n.RESPONSIVE_NAME_HEIGHT} ${c} ${n.ELLIPSIS}`).replace(n.RESPONSIVE_NAME_CONTAINER_HEIGHT, n.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return t;
|
|
59
59
|
},
|
|
60
60
|
priority: 52
|
|
61
61
|
},
|
|
@@ -63,16 +63,16 @@ const H = [
|
|
|
63
63
|
id: "prepare-recommendations",
|
|
64
64
|
description: "Replacing product data with template variables in recommendation blocks",
|
|
65
65
|
type: "custom",
|
|
66
|
-
processor: (
|
|
66
|
+
processor: (o) => O(o),
|
|
67
67
|
priority: 48
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
id: "add-discount-conditions",
|
|
71
71
|
description: "Adding discount conditions to the recommendation block",
|
|
72
72
|
type: "custom",
|
|
73
|
-
processor: (
|
|
74
|
-
let e =
|
|
75
|
-
const r = e.match(d.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData:
|
|
73
|
+
processor: (o) => {
|
|
74
|
+
let e = o;
|
|
75
|
+
const r = e.match(d.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: t } = N();
|
|
76
76
|
return r !== null && r.forEach((i) => {
|
|
77
77
|
const s = i.match(d.CUSTOM_FIELD);
|
|
78
78
|
if (!s)
|
|
@@ -80,17 +80,17 @@ const H = [
|
|
|
80
80
|
const [c] = s, m = c.match(d.CUSTOM_FIELD_INDEXES_PART), E = c.match(d.CUSTOM_FIELD_NAME_PART), u = i.match(d.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
81
81
|
if (!m || !E || !u)
|
|
82
82
|
return;
|
|
83
|
-
const [
|
|
83
|
+
const [A] = m, [I] = E, [R] = u, b = I.substring(1, I.length - 2), S = R.match(d.COMPOSITION) !== null;
|
|
84
84
|
let a = c;
|
|
85
85
|
if (S) {
|
|
86
|
-
const
|
|
86
|
+
const f = A.substring(2, A.length - 3), l = t(f);
|
|
87
87
|
b === p.OMNIBUS_PRICE && (l.priceBeforeTextValue && (a = `${l.priceBeforeTextValue}${a}`), l.priceAfterTextValue && (a = `${a}${l.priceAfterTextValue}`)), b === p.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (a = `${l.discountBeforeTextValue}${a}`), l.discountAfterTextValue && (a = `${a}${l.discountAfterTextValue}`));
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
let
|
|
91
|
-
b in
|
|
92
|
-
const
|
|
93
|
-
e = e.replace(i,
|
|
89
|
+
const _ = A.substring(2);
|
|
90
|
+
let y = "";
|
|
91
|
+
b in T.IF && (y = T.IF[b].replaceAll(`{${p.DISCOUNT}}`, `${_}${p.DISCOUNT}`).replaceAll(`{${p.OMNIBUS_DISCOUNT}}`, `${_}${p.OMNIBUS_DISCOUNT}`).replaceAll(`{${p.OMNIBUS_PRICE}}`, `${_}${p.OMNIBUS_PRICE}`));
|
|
92
|
+
const C = `${R}${a}${g.PARAGRAPH_END_TAG}`, h = `${y}${S ? C : i}${T.ELSE}${R}${g.PARAGRAPH_END_TAG}${T.END_IF}`;
|
|
93
|
+
e = e.replace(i, h);
|
|
94
94
|
}), e;
|
|
95
95
|
},
|
|
96
96
|
priority: 53
|
|
@@ -110,11 +110,11 @@ const H = [
|
|
|
110
110
|
type: "custom",
|
|
111
111
|
// Scoped to REC_START/REC_END markers so it cannot strip `product-attr`
|
|
112
112
|
// from Items block elements, which the items compiler rule depends on.
|
|
113
|
-
processor: (
|
|
113
|
+
processor: (o) => {
|
|
114
114
|
const e = /\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|data-same-price|product-attr|composition)="[^"]*"/g;
|
|
115
|
-
return
|
|
115
|
+
return o.replace(
|
|
116
116
|
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
117
|
-
(r,
|
|
117
|
+
(r, t) => `<!--REC_START-->${t.replace(e, "")}<!--REC_END-->`
|
|
118
118
|
);
|
|
119
119
|
},
|
|
120
120
|
priority: 55
|
|
@@ -123,8 +123,8 @@ const H = [
|
|
|
123
123
|
id: "strip-unused-recommendation-classes",
|
|
124
124
|
description: "Remove CSS classes not referenced by any style rule from recommendation elements",
|
|
125
125
|
type: "custom",
|
|
126
|
-
processor: (
|
|
127
|
-
let e =
|
|
126
|
+
processor: (o) => {
|
|
127
|
+
let e = o.replace(
|
|
128
128
|
/ class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
|
|
129
129
|
""
|
|
130
130
|
);
|
|
@@ -136,8 +136,8 @@ const H = [
|
|
|
136
136
|
id: "remove-empty-mobile-layout-artifacts",
|
|
137
137
|
description: "Remove empty mobile container rows and unused mobile layout CSS",
|
|
138
138
|
type: "custom",
|
|
139
|
-
processor: (
|
|
140
|
-
let e =
|
|
139
|
+
processor: (o) => {
|
|
140
|
+
let e = o;
|
|
141
141
|
return e = e.replace(
|
|
142
142
|
/<tr[^>]*class="ins-recommendation-mobile-row"[^>]*><\/tr>/g,
|
|
143
143
|
""
|
|
@@ -146,8 +146,8 @@ const H = [
|
|
|
146
146
|
""
|
|
147
147
|
), e = e.replace(
|
|
148
148
|
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
149
|
-
(r,
|
|
150
|
-
const i =
|
|
149
|
+
(r, t) => {
|
|
150
|
+
const i = t.match(/[^{}]+\{[^{}]*\}/g) || [], s = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
151
151
|
return i.every((m) => s.test(m)) ? "" : r;
|
|
152
152
|
}
|
|
153
153
|
)), e;
|
|
@@ -163,11 +163,11 @@ const H = [
|
|
|
163
163
|
// (SD-142395: split out of the removed deduplicate-inline-styles rule.)
|
|
164
164
|
description: "Force !important on es-button link color to defeat Gmail link-color override",
|
|
165
165
|
type: "custom",
|
|
166
|
-
processor: (
|
|
166
|
+
processor: (o) => o.replace(
|
|
167
167
|
/<a\b[^>]*\bes-button\b[^>]*>/g,
|
|
168
168
|
(e) => e.replace(
|
|
169
169
|
/([;"]color:)([^;"]+)/g,
|
|
170
|
-
(r,
|
|
170
|
+
(r, t, i) => i.includes("!important") ? r : `${t}${i} !important`
|
|
171
171
|
)
|
|
172
172
|
),
|
|
173
173
|
priority: 58
|
|
@@ -183,30 +183,13 @@ const H = [
|
|
|
183
183
|
// rather than classed, so they survive Gmail clipping.
|
|
184
184
|
description: "Collapse whitespace inside recommendation blocks and strip boundary markers",
|
|
185
185
|
type: "custom",
|
|
186
|
-
processor: (
|
|
187
|
-
const e = (r) => r.replace(/>\s+</g, "><").replace(/<[^>]+>/g, (
|
|
188
|
-
return
|
|
186
|
+
processor: (o) => {
|
|
187
|
+
const e = (r) => r.replace(/>\s+</g, "><").replace(/<[^>]+>/g, (t) => t.replace(/\s+/g, " "));
|
|
188
|
+
return o.replace(/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, (r, t) => e(t)).replaceAll("<!--REC_START-->", "").replaceAll("<!--REC_END-->", "");
|
|
189
189
|
},
|
|
190
190
|
priority: 99
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
id: "wrap-mobile-row-mso-conditional",
|
|
194
|
-
// SD-145666: OLD Outlook (Word engine) ignores @media and honors display:none
|
|
195
|
-
// on <tr>/<table> unreliably, so it renders BOTH the desktop AND the populated
|
|
196
|
-
// mobile recommendation container — products duplicate (1,2,1,2). prepare-
|
|
197
|
-
// recommendations (P48) tags each POPULATED mobile <tr> with safe placeholder
|
|
198
|
-
// comments; swap them here — AFTER minify (P99) has collapsed whitespace and
|
|
199
|
-
// stripped the REC markers — into a downlevel-revealed conditional comment so
|
|
200
|
-
// Outlook skips the row while every other client still renders it. Injecting the
|
|
201
|
-
// delicate `<!-- -->` ghost token LAST keeps it out of every whitespace/comment-
|
|
202
|
-
// mangling pass. email-service preserves this exact pattern (proven around
|
|
203
|
-
// es-button spans in delivered emails).
|
|
204
|
-
description: "Wrap populated recommendation mobile row in [if !mso] conditional comment for Outlook",
|
|
205
|
-
type: "custom",
|
|
206
|
-
processor: (t) => t.replaceAll("<!--MSO_MOBILE_HIDE_START-->", "<!--[if !mso]><!-- -->").replaceAll("<!--MSO_MOBILE_HIDE_END-->", "<!--<![endif]-->"),
|
|
207
|
-
priority: 100
|
|
208
191
|
}
|
|
209
192
|
];
|
|
210
193
|
export {
|
|
211
|
-
|
|
194
|
+
U as recommendationCompilerRules
|
|
212
195
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useRecommendation as
|
|
3
|
-
import {
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
1
|
+
import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as q } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { CSS_CLASS_RECO_BUTTON as C } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as E } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
5
|
import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
|
|
6
|
-
function
|
|
7
|
-
const c = `{{${
|
|
8
|
-
return
|
|
6
|
+
function P(t, r, e, n, s = "") {
|
|
7
|
+
const c = `{{${s}${t}_${r}_${e}}}`, o = `{{${s}${t}_${r}_currency}}`;
|
|
8
|
+
return n === "before" ? `${o} ${c}` : `${c} ${o}`;
|
|
9
9
|
}
|
|
10
|
-
function m(
|
|
11
|
-
let r =
|
|
10
|
+
function m(t) {
|
|
11
|
+
let r = t;
|
|
12
12
|
for (; r.children.length === 1; )
|
|
13
13
|
[r] = r.children;
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function b(t, r, e, n, s, c) {
|
|
17
17
|
switch (r) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
const o = t.querySelector("img");
|
|
20
|
+
o && (o.setAttribute("src", `{{${c}${e}_${n}_image_url}}`), o.setAttribute("alt", `{{${c}${e}_${n}_name}}`));
|
|
21
|
+
const i = t.querySelector("a");
|
|
22
|
+
i && (i.setAttribute("href", `{{${c}${e}_${n}_url}}`), i.classList.add(C));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const o = t.querySelector("p");
|
|
27
|
+
o && (m(o).textContent = `{{${c}${e}_${n}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
// Inline mode ("Move to next line" OFF) merges BOTH prices into one row
|
|
@@ -32,118 +32,118 @@ function h(e, r, t, o, i, c) {
|
|
|
32
32
|
// substitute by cell content, not by the row's anchor (SD-145161).
|
|
33
33
|
case "productPrice":
|
|
34
34
|
case "productOldPrice": {
|
|
35
|
-
const
|
|
36
|
-
d && (m(d).textContent =
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
const o = (d, l) => {
|
|
36
|
+
d && (m(d).textContent = P(
|
|
37
|
+
e,
|
|
38
|
+
n,
|
|
39
39
|
l,
|
|
40
|
-
|
|
40
|
+
s,
|
|
41
41
|
c
|
|
42
42
|
));
|
|
43
|
-
},
|
|
44
|
-
|
|
43
|
+
}, i = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !i && !a ? t.querySelector("p") : null;
|
|
44
|
+
o(i ?? (r === "productPrice" ? u : null), "price"), o(a ?? (r === "productOldPrice" ? u : null), "original_price");
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
case "productButton": {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const o = t.querySelector("a");
|
|
49
|
+
o && o.setAttribute("href", `{{${c}${e}_${n}_url}}`);
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
case "productOmnibusPrice": {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
53
|
+
const o = t.querySelector(".omnibus-price-value");
|
|
54
|
+
if (o) {
|
|
55
|
+
o.textContent = `{{${c}${e}_${n}_omnibus_price}}`;
|
|
56
|
+
const i = o.closest("p");
|
|
57
|
+
i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "productOmnibusDiscount": {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
62
|
+
const o = t.querySelector(".omnibus-discount-value");
|
|
63
|
+
if (o) {
|
|
64
|
+
o.textContent = `{{${c}${e}_${n}_omnibus_discount}}`;
|
|
65
|
+
const i = o.closest("p");
|
|
66
|
+
i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
|
|
67
67
|
}
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
70
|
default: {
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
a && (m(a).textContent = `{{${c}${
|
|
71
|
+
const o = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
|
|
72
|
+
if (o) {
|
|
73
|
+
const i = o.getAttribute("product-attr"), a = o.querySelector("p");
|
|
74
|
+
a && (m(a).textContent = `{{${c}${e}_${n}_${i}}}`);
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
80
|
+
function R(t, r, e, n) {
|
|
81
|
+
t.querySelectorAll(".recommendation-product-row").forEach((c, o) => {
|
|
82
82
|
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
83
83
|
const u = a.getAttribute("data-attribute-type") || "", d = a.querySelectorAll(".attribute-cell");
|
|
84
84
|
d.length > 0 ? d.forEach((l) => {
|
|
85
|
-
|
|
86
|
-
}) :
|
|
85
|
+
b(l, u, r, o, e, n);
|
|
86
|
+
}) : b(a, u, r, o, e, n);
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
90
|
+
function W(t, r, e, n) {
|
|
91
|
+
const s = t.querySelectorAll(".recommendation-product-row");
|
|
92
|
+
if (!s.length)
|
|
93
93
|
return;
|
|
94
|
-
const [c] =
|
|
95
|
-
|
|
94
|
+
const [c] = s, o = c.querySelector("[data-attribute-type]"), i = o ? o.querySelectorAll(".attribute-cell").length : 1;
|
|
95
|
+
s.forEach((a, u) => {
|
|
96
96
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
97
97
|
const p = l.getAttribute("data-attribute-type") || "";
|
|
98
|
-
l.querySelectorAll(".attribute-cell").forEach((S
|
|
99
|
-
const
|
|
100
|
-
|
|
98
|
+
l.querySelectorAll(".attribute-cell").forEach(($, S) => {
|
|
99
|
+
const g = u * i + S;
|
|
100
|
+
b($, p, r, g, e, n);
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
function v(t, r, e, n) {
|
|
106
|
+
t.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
|
|
107
|
+
W(c, r, e, n);
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
110
|
+
function O(t, r, e) {
|
|
111
|
+
const n = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
|
|
112
|
+
n === "list" ? R(t, r, s, e) : v(t, r, s, e);
|
|
113
113
|
}
|
|
114
|
-
function f(
|
|
115
|
-
const
|
|
116
|
-
return
|
|
114
|
+
function f(t, r, e) {
|
|
115
|
+
const n = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(n);
|
|
116
|
+
return s ? parseInt(s[1]) : e;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
const r =
|
|
118
|
+
function y(t) {
|
|
119
|
+
const r = t.trim();
|
|
120
120
|
return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const r =
|
|
124
|
-
if (r &&
|
|
122
|
+
function A(t) {
|
|
123
|
+
const r = t.getAttribute("width");
|
|
124
|
+
if (r && y(r))
|
|
125
125
|
return r.trim();
|
|
126
|
-
const
|
|
127
|
-
return
|
|
126
|
+
const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
|
|
127
|
+
return e && y(e[1]) ? e[1] : null;
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
let
|
|
131
|
-
for (;
|
|
132
|
-
if (
|
|
133
|
-
return
|
|
134
|
-
|
|
129
|
+
function M(t, r) {
|
|
130
|
+
let e = t.parentElement;
|
|
131
|
+
for (; e && e !== r; ) {
|
|
132
|
+
if (e.tagName === "TD" && A(e))
|
|
133
|
+
return e;
|
|
134
|
+
e = e.parentElement;
|
|
135
135
|
}
|
|
136
136
|
return null;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const r =
|
|
140
|
-
|
|
138
|
+
function T(t) {
|
|
139
|
+
const r = t.getAttribute("style") || "", e = f(r, "width", 600), n = f(r, "padding", 0) * 2, s = Math.max(0, e - n);
|
|
140
|
+
s !== 0 && t.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
141
141
|
if (c.hasAttribute("width"))
|
|
142
142
|
return;
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
143
|
+
const o = M(c, t);
|
|
144
|
+
if (!o)
|
|
145
145
|
return;
|
|
146
|
-
const
|
|
146
|
+
const i = A(o), a = f(o.getAttribute("style") || "", "padding", 0) * 2, u = i.endsWith("%") ? Math.floor(s * parseFloat(i) / 100) : parseInt(i), d = Math.max(1, u - a);
|
|
147
147
|
c.setAttribute("width", String(d));
|
|
148
148
|
const l = c.getAttribute("style") || "";
|
|
149
149
|
if (!/\bwidth\s*:\s*\d/i.test(l)) {
|
|
@@ -152,36 +152,25 @@ function W(e) {
|
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
e
|
|
158
|
-
var c, n;
|
|
159
|
-
const o = t.querySelector(O);
|
|
160
|
-
if (!o || o.children.length === 0)
|
|
161
|
-
return;
|
|
162
|
-
const i = t.previousSibling;
|
|
163
|
-
(i == null ? void 0 : i.nodeType) === Node.COMMENT_NODE && i.data === _ || ((c = t.parentNode) == null || c.insertBefore(r.createComment(_), t), (n = t.parentNode) == null || n.insertBefore(r.createComment(v), t.nextSibling));
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
function V(e, r) {
|
|
167
|
-
const t = e.match(/<!DOCTYPE[^>]*>/i);
|
|
168
|
-
return (t ? `${t[0]}
|
|
155
|
+
function B(t, r) {
|
|
156
|
+
const e = t.match(/<!DOCTYPE[^>]*>/i);
|
|
157
|
+
return (e ? `${e[0]}
|
|
169
158
|
` : "") + r.documentElement.outerHTML;
|
|
170
159
|
}
|
|
171
|
-
function
|
|
172
|
-
const r =
|
|
173
|
-
if (!
|
|
174
|
-
return
|
|
175
|
-
const { buildCampaignUrl:
|
|
160
|
+
function G(t) {
|
|
161
|
+
const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), n = e.querySelectorAll(".recommendation-block-v2");
|
|
162
|
+
if (!n.length)
|
|
163
|
+
return t;
|
|
164
|
+
const { buildCampaignUrl: s } = q(), c = E();
|
|
176
165
|
c.recommendationCampaignUrls = {};
|
|
177
|
-
const { isFeatureEnabled:
|
|
178
|
-
return
|
|
166
|
+
const { isFeatureEnabled: o } = _(), i = o("liquidSyntax") ? "reco_" : "";
|
|
167
|
+
return n.forEach((u) => {
|
|
179
168
|
var l, p;
|
|
180
169
|
const d = u.getAttribute("recommendation-id");
|
|
181
|
-
d && ((l = u.parentNode) == null || l.insertBefore(
|
|
182
|
-
}),
|
|
170
|
+
d && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), s(d), w(u) || O(u, d, i), T(u));
|
|
171
|
+
}), B(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
183
172
|
}
|
|
184
173
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
174
|
+
P as formatPriceVariable,
|
|
175
|
+
G as prepareRecommendationBlocks
|
|
187
176
|
};
|
package/dist/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.10.0-beta.
|
|
3
|
+
"version": "3.10.0-beta.cbd47be",
|
|
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",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"guido": {
|
|
106
106
|
"stripo": {
|
|
107
|
-
"version": "2.
|
|
107
|
+
"version": "2.69.1"
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|