@useinsider/guido 3.6.0-beta.596b70e → 3.6.0-beta.5cbaa8f
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.
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +12 -10
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +32 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +40 -34
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +338 -310
- package/dist/extensions/Blocks/Recommendation/extension.js +5 -6
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +146 -117
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -49
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +83 -110
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -31
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +54 -90
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +16 -20
- package/dist/extensions/Blocks/Unsubscribe/block.js +122 -72
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +11 -127
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -20
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -139
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -44
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.test.d.ts +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { formatPrice as
|
|
5
|
-
import { CUSTOM_CELL_HTML as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const r = U(), { currencySettings: e } = r.recommendationConfigs;
|
|
1
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as u, ATTR_PRODUCT_BUTTON as c, CSS_CLASS_RECO_BUTTON as d, ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_OMNIBUS_DISCOUNT as g, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as x, ATTR_PRODUCT_NAME as _ } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
4
|
+
import { formatPrice as R } from "../../utils/priceFormatter.js";
|
|
5
|
+
import { CUSTOM_CELL_HTML as O, sanitizeImageUrl as $ } from "../utils.js";
|
|
6
|
+
function b() {
|
|
7
|
+
const t = C(), { currencySettings: e } = t.recommendationConfigs;
|
|
9
8
|
return {
|
|
10
9
|
code: e.value,
|
|
11
10
|
symbol: e.symbol,
|
|
@@ -15,151 +14,119 @@ function y() {
|
|
|
15
14
|
thousandSeparator: e.thousandSeparator
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
price:
|
|
22
|
-
currency:
|
|
17
|
+
function s(t, e = "price") {
|
|
18
|
+
const n = b(), a = t[e], r = (a == null ? void 0 : a[n.code]) ?? Object.values(a ?? {})[0] ?? 0;
|
|
19
|
+
return R({
|
|
20
|
+
price: r,
|
|
21
|
+
currency: n
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
|
-
const
|
|
24
|
+
const I = {
|
|
26
25
|
/**
|
|
27
26
|
* Image cell - left column (120px fixed width)
|
|
28
27
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
29
28
|
*/
|
|
30
|
-
[
|
|
31
|
-
var a;
|
|
32
|
-
const t = ((a = e == null ? void 0 : e.styleTemplate) == null ? void 0 : a.imgStyle) ?? I;
|
|
33
|
-
return `
|
|
29
|
+
[p]: (t) => `
|
|
34
30
|
<td
|
|
35
31
|
width="120"
|
|
36
32
|
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
37
|
-
esd-extension-block-id="${
|
|
38
|
-
data-attribute-type="${
|
|
33
|
+
esd-extension-block-id="${o.IMAGE}"
|
|
34
|
+
data-attribute-type="${p}"
|
|
39
35
|
data-visibility="1"
|
|
40
36
|
align="center"
|
|
41
37
|
valign="middle">
|
|
42
|
-
<a target="_blank" href="${
|
|
38
|
+
<a target="_blank" href="${t.url}" class="${d}">
|
|
43
39
|
<img
|
|
44
|
-
src="${
|
|
45
|
-
alt="${
|
|
46
|
-
style="
|
|
40
|
+
src="${$(t.image_url)}"
|
|
41
|
+
alt="${t.name}"
|
|
42
|
+
style="display: block; max-width: 100%; height: auto;"
|
|
47
43
|
class="adapt-img product-image">
|
|
48
44
|
</a>
|
|
49
45
|
</td>
|
|
50
|
-
|
|
51
|
-
},
|
|
46
|
+
`,
|
|
52
47
|
/**
|
|
53
48
|
* Name element - row for info cell table
|
|
54
49
|
*/
|
|
55
|
-
[
|
|
56
|
-
const t = s(
|
|
57
|
-
r.name,
|
|
58
|
-
{
|
|
59
|
-
pStyle: "font-size: 16px; color: #333333; font-weight: 600; margin: 0;",
|
|
60
|
-
openTags: "<strong>",
|
|
61
|
-
closeTags: "</strong>"
|
|
62
|
-
},
|
|
63
|
-
e == null ? void 0 : e.styleTemplate
|
|
64
|
-
);
|
|
65
|
-
return `
|
|
50
|
+
[_]: (t) => `
|
|
66
51
|
<tr>
|
|
67
52
|
<td
|
|
68
53
|
class="esd-block-text product-name"
|
|
69
|
-
esd-extension-block-id="${
|
|
54
|
+
esd-extension-block-id="${o.NAME}"
|
|
70
55
|
align="left">
|
|
71
|
-
|
|
56
|
+
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
|
|
57
|
+
<strong>${t.name}</strong>
|
|
58
|
+
</p>
|
|
72
59
|
</td>
|
|
73
60
|
</tr>
|
|
74
|
-
|
|
75
|
-
},
|
|
61
|
+
`,
|
|
76
62
|
/**
|
|
77
63
|
* Price element - row for info cell table
|
|
78
64
|
*/
|
|
79
|
-
[
|
|
80
|
-
const t = s(
|
|
81
|
-
o(r, "price"),
|
|
82
|
-
{
|
|
83
|
-
pStyle: "font-size: 16px; color: #333333; font-weight: bold; margin: 0;",
|
|
84
|
-
openTags: "<strong>",
|
|
85
|
-
closeTags: "</strong>"
|
|
86
|
-
},
|
|
87
|
-
e == null ? void 0 : e.styleTemplate
|
|
88
|
-
);
|
|
89
|
-
return `
|
|
65
|
+
[x]: (t) => `
|
|
90
66
|
<tr>
|
|
91
67
|
<td
|
|
92
68
|
class="esd-block-text product-price"
|
|
93
|
-
esd-extension-block-id="${
|
|
69
|
+
esd-extension-block-id="${o.PRICE}"
|
|
94
70
|
align="left">
|
|
95
|
-
|
|
71
|
+
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
72
|
+
<strong>${s(t, "price")}</strong>
|
|
73
|
+
</p>
|
|
96
74
|
</td>
|
|
97
75
|
</tr>
|
|
98
|
-
|
|
99
|
-
},
|
|
76
|
+
`,
|
|
100
77
|
/**
|
|
101
78
|
* Old price element - row for info cell table
|
|
102
79
|
*/
|
|
103
|
-
[
|
|
104
|
-
const t = s(
|
|
105
|
-
o(r, "original_price"),
|
|
106
|
-
{
|
|
107
|
-
pStyle: "font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;",
|
|
108
|
-
openTags: "<strong>",
|
|
109
|
-
closeTags: "</strong>"
|
|
110
|
-
},
|
|
111
|
-
e == null ? void 0 : e.styleTemplate
|
|
112
|
-
);
|
|
113
|
-
return `
|
|
80
|
+
[T]: (t) => `
|
|
114
81
|
<tr>
|
|
115
82
|
<td
|
|
116
83
|
class="esd-block-text product-old-price"
|
|
117
|
-
esd-extension-block-id="${
|
|
84
|
+
esd-extension-block-id="${o.OLD_PRICE}"
|
|
118
85
|
align="left">
|
|
119
|
-
|
|
86
|
+
<p
|
|
87
|
+
contenteditable="false"
|
|
88
|
+
style="font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;">
|
|
89
|
+
<strong>${s(t, "original_price")}</strong>
|
|
90
|
+
</p>
|
|
120
91
|
</td>
|
|
121
92
|
</tr>
|
|
122
|
-
|
|
123
|
-
},
|
|
93
|
+
`,
|
|
124
94
|
/**
|
|
125
95
|
* Omnibus price element - row for info cell table
|
|
126
96
|
*/
|
|
127
|
-
[
|
|
128
|
-
const t = _("font-size: 12px; color: #666666; margin: 0;", e == null ? void 0 : e.styleTemplate);
|
|
129
|
-
return `
|
|
97
|
+
[f]: (t) => `
|
|
130
98
|
<tr>
|
|
131
99
|
<td
|
|
132
100
|
class="esd-block-text product-omnibus-price"
|
|
133
101
|
data-text-before="Lowest 30-day price: "
|
|
134
102
|
data-text-after=""
|
|
135
|
-
esd-extension-block-id="${
|
|
103
|
+
esd-extension-block-id="${o.OMNIBUS_PRICE}"
|
|
136
104
|
align="left">
|
|
137
|
-
<p contenteditable="false" style="
|
|
105
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
138
106
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
139
|
-
<span class="omnibus-price-value">${
|
|
107
|
+
<span class="omnibus-price-value">${s(t, "original_price")}</span>
|
|
140
108
|
<span class="omnibus-text-after"></span>
|
|
141
109
|
</p>
|
|
142
110
|
</td>
|
|
143
111
|
</tr>
|
|
144
|
-
|
|
145
|
-
},
|
|
112
|
+
`,
|
|
146
113
|
/**
|
|
147
114
|
* Omnibus discount element - row for info cell table
|
|
148
115
|
*/
|
|
149
|
-
[
|
|
150
|
-
var
|
|
151
|
-
const
|
|
116
|
+
[g]: (t) => {
|
|
117
|
+
var i, l;
|
|
118
|
+
const e = b(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, a = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - a) / n * 100) : 0, m = r > 0 ? `-${r}%` : "0%";
|
|
152
119
|
return `
|
|
153
120
|
<tr>
|
|
154
121
|
<td
|
|
155
122
|
class="esd-block-text product-omnibus-discount"
|
|
156
123
|
data-text-before=""
|
|
157
124
|
data-text-after=""
|
|
158
|
-
esd-extension-block-id="${
|
|
125
|
+
esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
|
|
159
126
|
align="left">
|
|
160
|
-
<p contenteditable="false" style="
|
|
127
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
161
128
|
<span class="omnibus-text-before"></span>
|
|
162
|
-
<span class="omnibus-discount-value">${
|
|
129
|
+
<span class="omnibus-discount-value">${m}</span>
|
|
163
130
|
<span class="omnibus-text-after"></span>
|
|
164
131
|
</p>
|
|
165
132
|
</td>
|
|
@@ -170,54 +137,60 @@ const z = {
|
|
|
170
137
|
* Button cell - right column (100px fixed width)
|
|
171
138
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
172
139
|
*/
|
|
173
|
-
[
|
|
174
|
-
const t = e == null ? void 0 : e.styleTemplate, a = (t == null ? void 0 : t.buttonBorderStyle) ?? B, c = (t == null ? void 0 : t.buttonAnchorStyle) ?? L, d = E("Buy", t);
|
|
175
|
-
return `
|
|
140
|
+
[c]: (t) => `
|
|
176
141
|
<td
|
|
177
142
|
width="100"
|
|
178
143
|
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
179
|
-
esd-extension-block-id="${
|
|
180
|
-
data-attribute-type="${
|
|
144
|
+
esd-extension-block-id="${o.BUTTON}"
|
|
145
|
+
data-attribute-type="${c}"
|
|
181
146
|
data-visibility="1"
|
|
182
147
|
align="center"
|
|
183
148
|
valign="middle">
|
|
184
|
-
<span
|
|
149
|
+
<span
|
|
150
|
+
class="es-button-border"
|
|
151
|
+
style="
|
|
152
|
+
border-width: 1px;
|
|
153
|
+
background: rgb(217, 234, 211);
|
|
154
|
+
border-color: rgb(106, 168, 79);
|
|
155
|
+
">
|
|
185
156
|
<a
|
|
186
|
-
href="${
|
|
157
|
+
href="${t.url}"
|
|
187
158
|
target="_blank"
|
|
188
|
-
class="es-button ${
|
|
189
|
-
style="
|
|
190
|
-
|
|
159
|
+
class="es-button ${d}"
|
|
160
|
+
style="
|
|
161
|
+
color: rgb(56, 118, 29);
|
|
162
|
+
background: rgb(217, 234, 211);
|
|
163
|
+
font-family: arial, 'helvetica neue', helvetica, sans-serif;
|
|
164
|
+
font-size: 16px;
|
|
165
|
+
font-weight: normal;
|
|
166
|
+
line-height: 120%;
|
|
167
|
+
padding: 5px 30px;
|
|
168
|
+
mso-border-alt: 10px solid rgb(217, 234, 211);
|
|
169
|
+
mso-padding-alt: 0;
|
|
170
|
+
">
|
|
171
|
+
Buy
|
|
191
172
|
</a>
|
|
192
173
|
</span>
|
|
193
174
|
</td>
|
|
194
|
-
|
|
195
|
-
},
|
|
175
|
+
`,
|
|
196
176
|
/**
|
|
197
177
|
* Custom attribute row template — same tr-td structure as Name, Price, etc.
|
|
198
178
|
* Used by `buildElementRenderer` for `customAttr:*` composition entries.
|
|
199
179
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
200
180
|
* @param content - Display content for the cell
|
|
201
181
|
*/
|
|
202
|
-
[
|
|
203
|
-
const a = s(
|
|
204
|
-
e,
|
|
205
|
-
{ pStyle: "font-size: 12px; color: #666666; margin: 0;", openTags: "", closeTags: "" },
|
|
206
|
-
t == null ? void 0 : t.styleTemplate
|
|
207
|
-
);
|
|
208
|
-
return `
|
|
182
|
+
[O]: (t, e) => `
|
|
209
183
|
<tr>
|
|
210
184
|
<td
|
|
211
|
-
${
|
|
185
|
+
${u}="${t}"
|
|
212
186
|
class="esd-block-text product-custom-attribute"
|
|
213
|
-
esd-extension-block-id="${
|
|
187
|
+
esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
|
|
214
188
|
align="left">
|
|
215
|
-
|
|
189
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${e}</p>
|
|
216
190
|
</td>
|
|
217
191
|
</tr>
|
|
218
|
-
|
|
219
|
-
}
|
|
192
|
+
`
|
|
220
193
|
};
|
|
221
194
|
export {
|
|
222
|
-
|
|
195
|
+
I as listElementRenderer
|
|
223
196
|
};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
2
|
-
import {
|
|
3
|
-
import { listElementRenderer as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const l = o ? "" : ' style="display: none;"', i = e.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
|
|
2
|
+
import { DEFAULT_CARD_COMPOSITION as b, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as T } from "../utils.js";
|
|
3
|
+
import { listElementRenderer as f } from "./elementRenderer.js";
|
|
4
|
+
function R(r, n, l) {
|
|
5
|
+
const t = l ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
7
6
|
return `<tr
|
|
8
7
|
class="recommendation-attribute-row"
|
|
9
8
|
data-attribute-type="${n}"
|
|
10
|
-
data-visibility="${
|
|
9
|
+
data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
|
|
11
10
|
}
|
|
12
11
|
const y = `
|
|
13
12
|
<tr class="recommendation-product-row">
|
|
14
|
-
<td style="padding:
|
|
13
|
+
<td style="padding: 0 5px;">
|
|
15
14
|
<table
|
|
16
15
|
width="100%"
|
|
17
16
|
cellpadding="0"
|
|
18
17
|
cellspacing="0"
|
|
19
18
|
border="0"
|
|
20
|
-
class="product-card-wrapper"
|
|
19
|
+
class="product-card-wrapper">
|
|
21
20
|
<tbody>
|
|
22
21
|
<tr>
|
|
23
22
|
{-{-PRODUCT_CONTENT-}-}
|
|
@@ -27,38 +26,29 @@ const y = `
|
|
|
27
26
|
</td>
|
|
28
27
|
</tr>
|
|
29
28
|
`;
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
cellPadding: i = I,
|
|
33
|
-
styleTemplates: t,
|
|
34
|
-
cardBackgroundColor: a,
|
|
35
|
-
cellBackgroundColors: c
|
|
36
|
-
} = l, u = a ? ` style="background-color: ${a};"` : "", d = g(E, n, o), R = { styleTemplate: t == null ? void 0 : t[s] }, C = d[s](e, R), b = `
|
|
29
|
+
function O(r, n = b, l = {}) {
|
|
30
|
+
const t = C(f, n, l), o = t[a](r), c = `
|
|
37
31
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
38
32
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
39
33
|
<tbody>
|
|
40
|
-
${n.filter((
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
cellBackgroundColor: c == null ? void 0 : c[r]
|
|
44
|
-
});
|
|
45
|
-
return O(P, r, A);
|
|
34
|
+
${n.filter((e) => e !== a && e !== d).filter((e) => t[e]).map((e) => {
|
|
35
|
+
const u = T[e] ?? !0;
|
|
36
|
+
return R(t[e](r), e, u);
|
|
46
37
|
}).join(`
|
|
47
38
|
`)}
|
|
48
39
|
</tbody>
|
|
49
40
|
</table>
|
|
50
41
|
</td>
|
|
51
|
-
`,
|
|
52
|
-
return y.replace("{-{-
|
|
42
|
+
`, s = t[d](r), p = o + c + s;
|
|
43
|
+
return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
|
|
53
44
|
}
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return a > 0 ? i + c : c;
|
|
45
|
+
function D(r, n, l = {}) {
|
|
46
|
+
return r.map((t, o) => {
|
|
47
|
+
const i = O(t, n, l);
|
|
48
|
+
return o > 0 ? m + i : i;
|
|
59
49
|
}).join("");
|
|
60
50
|
}
|
|
61
51
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
O as getListProductCard,
|
|
53
|
+
D as prepareProductRows
|
|
64
54
|
};
|
|
@@ -1,82 +1,57 @@
|
|
|
1
|
-
import { ATTR_CUSTOM_PREFIX as
|
|
2
|
-
function
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as u, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as b, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OMNIBUS_DISCOUNT as C, ATTR_PRODUCT_BUTTON as f } from "../constants/selectors.js";
|
|
2
|
+
function U(t) {
|
|
3
3
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const n = Object.values(e).find((
|
|
5
|
+
function R(t, e) {
|
|
6
|
+
const n = Object.values(e).find((r) => r.attributeName === t);
|
|
7
7
|
return (n == null ? void 0 : n.type) === "defaultAttribute";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function y(t, e) {
|
|
10
|
+
return R(t, e) ? t : `product_attribute.${t}`;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
12
|
+
const P = Symbol("customCellHtml");
|
|
13
|
+
function S(t, e, n = {}) {
|
|
14
|
+
const r = t[P];
|
|
15
|
+
if (!r)
|
|
16
16
|
return { ...t };
|
|
17
|
-
const
|
|
18
|
-
return e.filter((
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
const
|
|
23
|
-
let
|
|
24
|
-
return typeof
|
|
17
|
+
const l = { ...t };
|
|
18
|
+
return e.filter((o) => o.startsWith(u) && !l[o]).forEach((o) => {
|
|
19
|
+
const s = o.substring(u.length), a = U(s), D = y(s, n), O = R(s, n);
|
|
20
|
+
l[o] = (d) => {
|
|
21
|
+
var p;
|
|
22
|
+
const i = O ? d[s] : (p = d.product_attributes) == null ? void 0 : p[s];
|
|
23
|
+
let c = a;
|
|
24
|
+
return typeof i == "string" ? c = i : typeof i == "number" && (c = String(i)), r(D, c);
|
|
25
25
|
};
|
|
26
|
-
}),
|
|
26
|
+
}), l;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const L = {
|
|
29
29
|
TITLE: "You May Also Like!"
|
|
30
30
|
}, M = [
|
|
31
|
+
m,
|
|
32
|
+
b,
|
|
31
33
|
T,
|
|
32
|
-
g,
|
|
33
|
-
p,
|
|
34
34
|
_,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
],
|
|
39
|
-
[
|
|
40
|
-
[
|
|
35
|
+
g,
|
|
36
|
+
C,
|
|
37
|
+
f
|
|
38
|
+
], $ = {
|
|
39
|
+
[m]: !0,
|
|
40
|
+
[b]: !0,
|
|
41
41
|
[_]: !0,
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
},
|
|
47
|
-
function P(t = E) {
|
|
48
|
-
return `
|
|
42
|
+
[T]: !0,
|
|
43
|
+
[g]: !1,
|
|
44
|
+
[C]: !1,
|
|
45
|
+
[f]: !0
|
|
46
|
+
}, h = `
|
|
49
47
|
<tr>
|
|
50
|
-
<td class="spacer" style="height:
|
|
48
|
+
<td class="spacer" style="height: 10px;"></td>
|
|
51
49
|
</tr>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const I = P();
|
|
55
|
-
function L(t, e) {
|
|
56
|
-
return e ? e.pStyle ?? "" : t;
|
|
57
|
-
}
|
|
58
|
-
function v(t, e, n) {
|
|
59
|
-
const o = L(e.pStyle, n), s = n ? n.openTags ?? "" : e.openTags, r = n ? n.closeTags ?? "" : e.closeTags;
|
|
60
|
-
return `<p contenteditable="false" style="${o}">${s}${t}${r}</p>`;
|
|
61
|
-
}
|
|
62
|
-
function x(t, e) {
|
|
63
|
-
const n = [];
|
|
64
|
-
return t && n.push(t), e && n.push(`background-color: ${e};`), n.join(" ");
|
|
65
|
-
}
|
|
66
|
-
function F(t) {
|
|
67
|
-
return t ? ` style="background-color: ${t};"` : "";
|
|
68
|
-
}
|
|
69
|
-
function H(t, e) {
|
|
70
|
-
return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
|
|
71
|
-
}
|
|
72
|
-
function W(t) {
|
|
73
|
-
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
74
|
-
}
|
|
75
|
-
const Y = "display: block; max-width: 100%; height: auto;", G = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", z = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
76
|
-
function V(t) {
|
|
50
|
+
`, A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
51
|
+
function w(t) {
|
|
77
52
|
return !t || typeof t != "string" || t.trim() === "" ? A : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
78
53
|
}
|
|
79
|
-
function
|
|
54
|
+
function I(t) {
|
|
80
55
|
return {
|
|
81
56
|
name: "Product Name",
|
|
82
57
|
image_url: A,
|
|
@@ -91,19 +66,19 @@ function $(t) {
|
|
|
91
66
|
category: []
|
|
92
67
|
};
|
|
93
68
|
}
|
|
94
|
-
function
|
|
69
|
+
function N(t = 6) {
|
|
95
70
|
return Array.from(
|
|
96
71
|
{ length: t },
|
|
97
|
-
(e, n) =>
|
|
72
|
+
(e, n) => I(String(n + 1))
|
|
98
73
|
);
|
|
99
74
|
}
|
|
100
|
-
function
|
|
75
|
+
function k(t = "grid", e) {
|
|
101
76
|
const n = t === "list" ? `
|
|
102
|
-
data-layout="list"` : "",
|
|
77
|
+
data-layout="list"` : "", r = e ? ` ${e}` : "";
|
|
103
78
|
return `
|
|
104
79
|
<td
|
|
105
80
|
align="left"
|
|
106
|
-
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${
|
|
81
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${r}`}"${n}>
|
|
107
82
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
108
83
|
<tr>
|
|
109
84
|
<td align="center">
|
|
@@ -135,7 +110,7 @@ function X(t = "grid", e) {
|
|
|
135
110
|
</table>
|
|
136
111
|
</td>
|
|
137
112
|
</tr>
|
|
138
|
-
${
|
|
113
|
+
${h}
|
|
139
114
|
<tr>
|
|
140
115
|
<td>
|
|
141
116
|
<table
|
|
@@ -174,28 +149,17 @@ function X(t = "grid", e) {
|
|
|
174
149
|
`;
|
|
175
150
|
}
|
|
176
151
|
export {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
z as DEFAULT_BUTTON_ANCHOR_STYLE,
|
|
180
|
-
G as DEFAULT_BUTTON_BORDER_STYLE,
|
|
152
|
+
P as CUSTOM_CELL_HTML,
|
|
153
|
+
L as DEFAULTS,
|
|
181
154
|
M as DEFAULT_CARD_COMPOSITION,
|
|
182
|
-
|
|
183
|
-
Y as DEFAULT_IMG_STYLE,
|
|
184
|
-
E as DEFAULT_ROW_SPACING_PX,
|
|
155
|
+
$ as DEFAULT_CARD_VISIBILITY,
|
|
185
156
|
A as PLACEHOLDER_IMAGE,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
W as resolveButtonBorderClass,
|
|
195
|
-
L as resolvePStyle,
|
|
196
|
-
O as resolveProductAttrValue,
|
|
197
|
-
x as resolveSegmentBgStyle,
|
|
198
|
-
V as sanitizeImageUrl,
|
|
199
|
-
I as spacer,
|
|
200
|
-
D as toDisplayName
|
|
157
|
+
S as buildElementRenderer,
|
|
158
|
+
k as createBlockTemplate,
|
|
159
|
+
N as getDefaultProducts,
|
|
160
|
+
R as isDefaultAttribute,
|
|
161
|
+
y as resolveProductAttrValue,
|
|
162
|
+
w as sanitizeImageUrl,
|
|
163
|
+
h as spacer,
|
|
164
|
+
U as toDisplayName
|
|
201
165
|
};
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
import { escapeHtml as
|
|
2
|
-
function
|
|
3
|
-
return "getInnerHTML" in
|
|
1
|
+
import { escapeHtml as m } from "../../../../utils/htmlEscape.js";
|
|
2
|
+
function T(t) {
|
|
3
|
+
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
function H(t, f) {
|
|
6
|
+
const n = m(f);
|
|
7
|
+
if (!t)
|
|
8
|
+
return n;
|
|
9
|
+
const r = T(t);
|
|
10
|
+
if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
|
|
11
|
+
return n;
|
|
12
|
+
const e = [], s = [];
|
|
13
|
+
let o = r.trim();
|
|
8
14
|
for (; ; ) {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
15
|
+
const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
|
|
16
|
+
if (!u)
|
|
11
17
|
break;
|
|
12
|
-
const [, i, a = "",
|
|
13
|
-
if (!
|
|
18
|
+
const [, i, a = "", c] = u, g = new RegExp(`</${i}>$`, "i");
|
|
19
|
+
if (!g.test(c))
|
|
14
20
|
break;
|
|
15
|
-
|
|
21
|
+
e.push(`<${i}${a}>`), s.unshift(`</${i}>`), o = c.replace(g, "").trim();
|
|
16
22
|
}
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
function p(n, s) {
|
|
20
|
-
const t = g(s);
|
|
21
|
-
if (!n)
|
|
22
|
-
return t;
|
|
23
|
-
const r = u(n);
|
|
24
|
-
if (!r || r.trim() === "")
|
|
25
|
-
return t;
|
|
26
|
-
const { openTags: e, closeTags: i } = T(r);
|
|
27
|
-
return e ? e + t + i : t;
|
|
23
|
+
return e.length > 0 ? e.join("") + n + s.join("") : n;
|
|
28
24
|
}
|
|
29
25
|
export {
|
|
30
|
-
|
|
31
|
-
p as preserveTextStyles
|
|
26
|
+
H as preserveTextStyles
|
|
32
27
|
};
|