@useinsider/guido 3.8.0-beta.84f6c0a → 3.8.0-beta.bf9ea20
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/config/compiler/utils/recommendationCompilerUtils.js +25 -19
- package/dist/extensions/Blocks/Items/block.js +48 -29
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +26 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +333 -285
- 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 +173 -142
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -56
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +105 -132
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +23 -44
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +64 -112
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
- 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 -165
- 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 -29
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -219
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
|
@@ -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 = P(), { 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,152 +14,120 @@ function x() {
|
|
|
15
14
|
thousandSeparator: e.thousandSeparator
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
price:
|
|
22
|
-
currency:
|
|
17
|
+
function r(t, e = "price") {
|
|
18
|
+
const n = b(), s = t[e], a = (s == null ? void 0 : s[n.code]) ?? Object.values(s ?? {})[0] ?? 0;
|
|
19
|
+
return R({
|
|
20
|
+
price: a,
|
|
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 l = ((a = e == null ? void 0 : e.styleTemplate) == null ? void 0 : a.imgStyle) ?? M;
|
|
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 l = u(
|
|
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
|
-
class="esd-block-text product-name
|
|
69
|
-
esd-extension-block-id="${
|
|
70
|
-
align="
|
|
71
|
-
|
|
53
|
+
class="esd-block-text product-name"
|
|
54
|
+
esd-extension-block-id="${o.NAME}"
|
|
55
|
+
align="left">
|
|
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 l = u(
|
|
81
|
-
T(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
|
-
class="esd-block-text product-price
|
|
93
|
-
esd-extension-block-id="${
|
|
94
|
-
align="
|
|
95
|
-
|
|
68
|
+
class="esd-block-text product-price"
|
|
69
|
+
esd-extension-block-id="${o.PRICE}"
|
|
70
|
+
align="left">
|
|
71
|
+
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
72
|
+
<strong>${r(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 l = u(
|
|
105
|
-
T(r, "original_price"),
|
|
106
|
-
{
|
|
107
|
-
pStyle: "font-size: 14px; color: #999999; margin: 0;",
|
|
108
|
-
openTags: "<s><strong>",
|
|
109
|
-
closeTags: "</strong></s>"
|
|
110
|
-
},
|
|
111
|
-
e == null ? void 0 : e.styleTemplate
|
|
112
|
-
);
|
|
113
|
-
return `
|
|
80
|
+
[T]: (t) => `
|
|
114
81
|
<tr>
|
|
115
82
|
<td
|
|
116
|
-
class="esd-block-text product-old-price
|
|
117
|
-
esd-extension-block-id="${
|
|
118
|
-
align="
|
|
119
|
-
|
|
83
|
+
class="esd-block-text product-old-price"
|
|
84
|
+
esd-extension-block-id="${o.OLD_PRICE}"
|
|
85
|
+
align="left">
|
|
86
|
+
<p
|
|
87
|
+
contenteditable="false"
|
|
88
|
+
style="font-size: 14px; color: #999999; margin: 0;">
|
|
89
|
+
<s><strong>${r(t, "original_price")}</strong></s>
|
|
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 l = y("font-size: 12px; color: #666666; margin: 0;", e == null ? void 0 : e.styleTemplate), { before: a, after: c } = S(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
|
|
129
|
-
return `
|
|
97
|
+
[f]: (t) => `
|
|
130
98
|
<tr>
|
|
131
99
|
<td
|
|
132
|
-
class="esd-block-text product-omnibus-price
|
|
133
|
-
data-text-before="
|
|
134
|
-
data-text-after="
|
|
135
|
-
esd-extension-block-id="${
|
|
136
|
-
align="
|
|
137
|
-
<p contenteditable="false" style="
|
|
138
|
-
<span class="omnibus-text-before"
|
|
139
|
-
<span class="omnibus-price-value">${
|
|
140
|
-
<span class="omnibus-text-after"
|
|
100
|
+
class="esd-block-text product-omnibus-price"
|
|
101
|
+
data-text-before="Lowest 30-day price: "
|
|
102
|
+
data-text-after=""
|
|
103
|
+
esd-extension-block-id="${o.OMNIBUS_PRICE}"
|
|
104
|
+
align="left">
|
|
105
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
106
|
+
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
107
|
+
<span class="omnibus-price-value">${r(t, "original_price")}</span>
|
|
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, s = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, a = n > 0 ? Math.round((n - s) / n * 100) : 0, m = a > 0 ? `-${a}%` : "0%";
|
|
152
119
|
return `
|
|
153
120
|
<tr>
|
|
154
121
|
<td
|
|
155
|
-
class="esd-block-text product-omnibus-discount
|
|
156
|
-
data-text-before="
|
|
157
|
-
data-text-after="
|
|
158
|
-
esd-extension-block-id="${
|
|
159
|
-
align="
|
|
160
|
-
<p contenteditable="false" style="
|
|
161
|
-
<span class="omnibus-text-before"
|
|
162
|
-
<span class="omnibus-discount-value">${
|
|
163
|
-
<span class="omnibus-text-after"
|
|
122
|
+
class="esd-block-text product-omnibus-discount"
|
|
123
|
+
data-text-before=""
|
|
124
|
+
data-text-after=""
|
|
125
|
+
esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
|
|
126
|
+
align="left">
|
|
127
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
128
|
+
<span class="omnibus-text-before"></span>
|
|
129
|
+
<span class="omnibus-discount-value">${m}</span>
|
|
130
|
+
<span class="omnibus-text-after"></span>
|
|
164
131
|
</p>
|
|
165
132
|
</td>
|
|
166
133
|
</tr>
|
|
@@ -170,54 +137,60 @@ const V = {
|
|
|
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 l = e == null ? void 0 : e.styleTemplate, a = (l == null ? void 0 : l.buttonBorderStyle) ?? L, c = (l == null ? void 0 : l.buttonAnchorStyle) ?? z, s = N((l == null ? void 0 : l.buttonText) ?? "Buy", l);
|
|
175
|
-
return `
|
|
140
|
+
[c]: (t) => `
|
|
176
141
|
<td
|
|
177
142
|
width="100"
|
|
178
|
-
class="esd-block-button button-cell recommendation-attribute-row product-button
|
|
179
|
-
esd-extension-block-id="${
|
|
180
|
-
data-attribute-type="${
|
|
143
|
+
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
144
|
+
esd-extension-block-id="${o.BUTTON}"
|
|
145
|
+
data-attribute-type="${c}"
|
|
181
146
|
data-visibility="1"
|
|
182
|
-
align="
|
|
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 = u(
|
|
204
|
-
e,
|
|
205
|
-
{ pStyle: "font-size: 12px; color: #666666; margin: 0;", openTags: "", closeTags: "" },
|
|
206
|
-
l == null ? void 0 : l.styleTemplate
|
|
207
|
-
);
|
|
208
|
-
return `
|
|
182
|
+
[O]: (t, e) => `
|
|
209
183
|
<tr>
|
|
210
184
|
<td
|
|
211
|
-
${
|
|
212
|
-
class="esd-block-text product-custom-attribute
|
|
213
|
-
esd-extension-block-id="${
|
|
214
|
-
align="
|
|
215
|
-
|
|
185
|
+
${u}="${t}"
|
|
186
|
+
class="esd-block-text product-custom-attribute"
|
|
187
|
+
esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
|
|
188
|
+
align="left">
|
|
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 = e ? "" : ' style="display: none;"', a = n.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
|
-
data-attribute-type="${
|
|
10
|
-
data-visibility="${
|
|
8
|
+
data-attribute-type="${n}"
|
|
9
|
+
data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
|
|
11
10
|
}
|
|
12
|
-
const
|
|
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,49 +26,29 @@ const $ = `
|
|
|
27
26
|
</td>
|
|
28
27
|
</tr>
|
|
29
28
|
`;
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
cellPadding: a = L,
|
|
33
|
-
styleTemplates: o,
|
|
34
|
-
cardBackgroundColor: p,
|
|
35
|
-
cellBackgroundColors: c,
|
|
36
|
-
cellAlignments: d,
|
|
37
|
-
cellClasses: i,
|
|
38
|
-
omnibusTexts: R,
|
|
39
|
-
visibility: C
|
|
40
|
-
} = l, D = p ? ` style="background-color: ${p};"` : "", u = T(N, r, e), _ = { styleTemplate: o == null ? void 0 : o[b] }, P = u[b](n, _), m = `
|
|
29
|
+
function O(r, n = b, l = {}) {
|
|
30
|
+
const t = C(f, n, l), o = t[a](r), c = `
|
|
41
31
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
42
32
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
43
33
|
<tbody>
|
|
44
|
-
${
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
cellBackgroundColor: c == null ? void 0 : c[t],
|
|
48
|
-
cellAlignment: d == null ? void 0 : d[t],
|
|
49
|
-
cellClasses: i == null ? void 0 : i[t],
|
|
50
|
-
omnibusText: R == null ? void 0 : R[t]
|
|
51
|
-
});
|
|
52
|
-
return U(E, t, w);
|
|
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);
|
|
53
37
|
}).join(`
|
|
54
38
|
`)}
|
|
55
39
|
</tbody>
|
|
56
40
|
</table>
|
|
57
41
|
</td>
|
|
58
|
-
`,
|
|
59
|
-
|
|
60
|
-
cellAlignment: d == null ? void 0 : d[s],
|
|
61
|
-
cellClasses: i == null ? void 0 : i[s]
|
|
62
|
-
}, f = u[s](n, A), g = P + m + f;
|
|
63
|
-
return $.replace("{-{-CARD_PADDING-}-}", a).replace("{-{-WRAPPER_STYLE-}-}", D).replace("{-{-PRODUCT_CONTENT-}-}", g);
|
|
42
|
+
`, s = t[d](r), p = o + c + s;
|
|
43
|
+
return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
|
|
64
44
|
}
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return p > 0 ? a + 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;
|
|
70
49
|
}).join("");
|
|
71
50
|
}
|
|
72
51
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
52
|
+
O as getListProductCard,
|
|
53
|
+
D as prepareProductRows
|
|
75
54
|
};
|
|
@@ -1,101 +1,66 @@
|
|
|
1
|
-
import { ATTR_CUSTOM_PREFIX as
|
|
2
|
-
function
|
|
3
|
-
return t.replace(/_/g, " ").replace(/\b\w/g, (
|
|
4
|
-
}
|
|
5
|
-
function S(t) {
|
|
6
|
-
const n = Array.isArray(t) ? t[t.length - 1] : t;
|
|
7
|
-
if (typeof n == "string")
|
|
8
|
-
return n;
|
|
9
|
-
if (typeof n == "number")
|
|
10
|
-
return String(n);
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as d, ATTR_PRODUCT_IMAGE as u, ATTR_PRODUCT_NAME as p, ATTR_PRODUCT_OLD_PRICE as m, ATTR_PRODUCT_PRICE as b, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as g } from "../constants/selectors.js";
|
|
2
|
+
function y(t) {
|
|
3
|
+
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
11
4
|
}
|
|
12
|
-
function
|
|
13
|
-
const e =
|
|
14
|
-
|
|
5
|
+
function U(t) {
|
|
6
|
+
const e = Array.isArray(t) ? t[t.length - 1] : t;
|
|
7
|
+
if (typeof e == "string")
|
|
8
|
+
return e;
|
|
9
|
+
if (typeof e == "number")
|
|
10
|
+
return String(e);
|
|
15
11
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
12
|
+
function C(t, e) {
|
|
13
|
+
const n = Object.values(e).find((r) => r.attributeName === t);
|
|
14
|
+
return (n == null ? void 0 : n.type) === "defaultAttribute";
|
|
18
15
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
return `${c}${n}`;
|
|
16
|
+
function h(t, e) {
|
|
17
|
+
return C(t, e) ? t : `product_attribute.${t}`;
|
|
22
18
|
}
|
|
23
19
|
const P = Symbol("customCellHtml");
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
20
|
+
function L(t, e, n = {}) {
|
|
21
|
+
const r = t[P];
|
|
22
|
+
if (!r)
|
|
27
23
|
return { ...t };
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
const D = R ?
|
|
34
|
-
return
|
|
24
|
+
const i = { ...t };
|
|
25
|
+
return e.filter((o) => o.startsWith(d) && !i[o]).forEach((o) => {
|
|
26
|
+
const s = o.substring(d.length), l = y(s), A = h(s, n), R = C(s, n);
|
|
27
|
+
i[o] = (c) => {
|
|
28
|
+
var a;
|
|
29
|
+
const D = R ? c[s] : (a = c.product_attributes) == null ? void 0 : a[s], O = U(D) ?? l;
|
|
30
|
+
return r(A, O);
|
|
35
31
|
};
|
|
36
|
-
}),
|
|
32
|
+
}), i;
|
|
37
33
|
}
|
|
38
|
-
const
|
|
34
|
+
const M = {
|
|
39
35
|
TITLE: "You May Also Like!"
|
|
40
|
-
},
|
|
36
|
+
}, $ = [
|
|
37
|
+
u,
|
|
38
|
+
p,
|
|
39
|
+
m,
|
|
41
40
|
b,
|
|
42
41
|
T,
|
|
43
|
-
g,
|
|
44
42
|
_,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
],
|
|
43
|
+
g
|
|
44
|
+
], w = {
|
|
45
|
+
[u]: !0,
|
|
46
|
+
[p]: !0,
|
|
49
47
|
[b]: !0,
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
|
|
55
|
-
[m]: !0
|
|
56
|
-
}, I = 10;
|
|
57
|
-
function $(t = I) {
|
|
58
|
-
return `
|
|
48
|
+
[m]: !0,
|
|
49
|
+
[T]: !1,
|
|
50
|
+
[_]: !1,
|
|
51
|
+
[g]: !0
|
|
52
|
+
}, I = `
|
|
59
53
|
<tr>
|
|
60
|
-
<td class="spacer" style="height:
|
|
54
|
+
<td class="spacer" style="height: 10px;"></td>
|
|
61
55
|
</tr>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function w(t, n) {
|
|
66
|
-
return n ? n.pStyle ?? "" : t;
|
|
67
|
-
}
|
|
68
|
-
function W(t, n, e) {
|
|
69
|
-
const o = w(n.pStyle, e), s = e ? e.openTags ?? "" : n.openTags, r = e ? e.closeTags ?? "" : n.closeTags;
|
|
70
|
-
return `<p contenteditable="false" style="${o}">${s}${t}${r}</p>`;
|
|
71
|
-
}
|
|
72
|
-
function H(t, n) {
|
|
73
|
-
const e = [];
|
|
74
|
-
return t && e.push(t), n && e.push(`background-color: ${n};`), e.join(" ");
|
|
75
|
-
}
|
|
76
|
-
function Y(t) {
|
|
77
|
-
return t ? ` style="background-color: ${t};"` : "";
|
|
78
|
-
}
|
|
79
|
-
function G(t, n = "") {
|
|
80
|
-
return {
|
|
81
|
-
before: (t == null ? void 0 : t.before) ?? n,
|
|
82
|
-
after: (t == null ? void 0 : t.after) ?? ""
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function z(t, n) {
|
|
86
|
-
return `${(n == null ? void 0 : n.openTags) ?? ""}${t}${(n == null ? void 0 : n.closeTags) ?? ""}`;
|
|
87
|
-
}
|
|
88
|
-
function X(t) {
|
|
89
|
-
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
90
|
-
}
|
|
91
|
-
const j = "display: block; max-width: 100%; height: auto;", V = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", K = "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;", h = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
92
|
-
function q(t) {
|
|
93
|
-
return !t || typeof t != "string" || t.trim() === "" ? h : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
56
|
+
`, f = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
57
|
+
function N(t) {
|
|
58
|
+
return !t || typeof t != "string" || t.trim() === "" ? f : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
94
59
|
}
|
|
95
|
-
function
|
|
60
|
+
function E(t) {
|
|
96
61
|
return {
|
|
97
62
|
name: "Product Name",
|
|
98
|
-
image_url:
|
|
63
|
+
image_url: f,
|
|
99
64
|
price: { USD: 18 },
|
|
100
65
|
original_price: { USD: 20 },
|
|
101
66
|
discount: { USD: 2 },
|
|
@@ -107,19 +72,19 @@ function B(t) {
|
|
|
107
72
|
category: []
|
|
108
73
|
};
|
|
109
74
|
}
|
|
110
|
-
function
|
|
75
|
+
function k(t = 6) {
|
|
111
76
|
return Array.from(
|
|
112
77
|
{ length: t },
|
|
113
|
-
(
|
|
78
|
+
(e, n) => E(String(n + 1))
|
|
114
79
|
);
|
|
115
80
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
118
|
-
data-layout="list"` : "",
|
|
81
|
+
function x(t = "grid", e) {
|
|
82
|
+
const n = t === "list" ? `
|
|
83
|
+
data-layout="list"` : "", r = e ? ` ${e}` : "";
|
|
119
84
|
return `
|
|
120
85
|
<td
|
|
121
86
|
align="left"
|
|
122
|
-
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${
|
|
87
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${r}`}"${n}>
|
|
123
88
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
124
89
|
<tr>
|
|
125
90
|
<td align="center">
|
|
@@ -151,7 +116,7 @@ function Q(t = "grid", n) {
|
|
|
151
116
|
</table>
|
|
152
117
|
</td>
|
|
153
118
|
</tr>
|
|
154
|
-
${
|
|
119
|
+
${I}
|
|
155
120
|
<tr>
|
|
156
121
|
<td>
|
|
157
122
|
<table
|
|
@@ -191,30 +156,17 @@ function Q(t = "grid", n) {
|
|
|
191
156
|
}
|
|
192
157
|
export {
|
|
193
158
|
P as CUSTOM_CELL_HTML,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
h as PLACEHOLDER_IMAGE,
|
|
202
|
-
k as buildElementRenderer,
|
|
203
|
-
$ as buildSpacer,
|
|
204
|
-
Y as cellBgStyleAttr,
|
|
205
|
-
Q as createBlockTemplate,
|
|
206
|
-
J as getDefaultProducts,
|
|
159
|
+
M as DEFAULTS,
|
|
160
|
+
$ as DEFAULT_CARD_COMPOSITION,
|
|
161
|
+
w as DEFAULT_CARD_VISIBILITY,
|
|
162
|
+
f as PLACEHOLDER_IMAGE,
|
|
163
|
+
L as buildElementRenderer,
|
|
164
|
+
x as createBlockTemplate,
|
|
165
|
+
k as getDefaultProducts,
|
|
207
166
|
C as isDefaultAttribute,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
E as resolveProductAttrValue,
|
|
214
|
-
H as resolveSegmentBgStyle,
|
|
215
|
-
q as sanitizeImageUrl,
|
|
216
|
-
L as spacer,
|
|
217
|
-
M as toCustomCompositionKey,
|
|
218
|
-
U as toDisplayName,
|
|
219
|
-
S as toDisplayableAttributeValue
|
|
167
|
+
h as resolveProductAttrValue,
|
|
168
|
+
N as sanitizeImageUrl,
|
|
169
|
+
I as spacer,
|
|
170
|
+
y as toDisplayName,
|
|
171
|
+
U as toDisplayableAttributeValue
|
|
220
172
|
};
|