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