@useinsider/guido 3.7.0-beta.24bdfa3 → 3.7.0-beta.4311638
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/@types/config/schemas.js +66 -70
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Items/block.js +48 -29
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
- package/dist/extensions/Blocks/Recommendation/block.js +39 -58
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +66 -68
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/stores/config.d.ts +0 -36
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -100
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/composables/useRecommendationPreview.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,69 +1,43 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
</p>
|
|
17
|
-
</td>
|
|
18
|
-
</tr>
|
|
19
|
-
`;
|
|
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;
|
|
8
|
+
return {
|
|
9
|
+
code: e.value,
|
|
10
|
+
symbol: e.symbol,
|
|
11
|
+
alignment: e.alignment === "0" ? "before" : "after",
|
|
12
|
+
decimalCount: parseInt(e.decimalCount) || 2,
|
|
13
|
+
decimalSeparator: e.decimalSeparator,
|
|
14
|
+
thousandSeparator: e.thousandSeparator
|
|
15
|
+
};
|
|
20
16
|
}
|
|
21
|
-
function
|
|
22
|
-
const n =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
style="width: auto;${s}">
|
|
28
|
-
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
29
|
-
<strong>${r(t, "price")}</strong>
|
|
30
|
-
</p>
|
|
31
|
-
</td>`, i = (s) => `<td
|
|
32
|
-
class="esd-block-text product-old-price"
|
|
33
|
-
esd-extension-block-id="${e.OLD_PRICE}"
|
|
34
|
-
align="left"
|
|
35
|
-
valign="middle"
|
|
36
|
-
style="width: auto;${s}">
|
|
37
|
-
<p
|
|
38
|
-
contenteditable="false"
|
|
39
|
-
style="font-size: 14px; color: #999999; margin: 0;">
|
|
40
|
-
${n}
|
|
41
|
-
</p>
|
|
42
|
-
</td>`, c = o ? i(" padding-right: 8px;") : l(" padding-right: 8px;"), a = o ? l("") : i("");
|
|
43
|
-
return `
|
|
44
|
-
<tr>
|
|
45
|
-
${c}
|
|
46
|
-
${a}
|
|
47
|
-
</tr>
|
|
48
|
-
`;
|
|
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
|
|
22
|
+
});
|
|
49
23
|
}
|
|
50
|
-
const
|
|
24
|
+
const I = {
|
|
51
25
|
/**
|
|
52
26
|
* Image cell - left column (120px fixed width)
|
|
53
27
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
54
28
|
*/
|
|
55
|
-
[
|
|
29
|
+
[p]: (t) => `
|
|
56
30
|
<td
|
|
57
31
|
width="120"
|
|
58
32
|
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
59
|
-
esd-extension-block-id="${
|
|
60
|
-
data-attribute-type="${
|
|
33
|
+
esd-extension-block-id="${o.IMAGE}"
|
|
34
|
+
data-attribute-type="${p}"
|
|
61
35
|
data-visibility="1"
|
|
62
36
|
align="center"
|
|
63
37
|
valign="middle">
|
|
64
|
-
<a target="_blank" href="${t.url}" class="${
|
|
38
|
+
<a target="_blank" href="${t.url}" class="${d}">
|
|
65
39
|
<img
|
|
66
|
-
src="${
|
|
40
|
+
src="${$(t.image_url)}"
|
|
67
41
|
alt="${t.name}"
|
|
68
42
|
style="display: block; max-width: 100%; height: auto;"
|
|
69
43
|
class="adapt-img product-image">
|
|
@@ -73,11 +47,11 @@ const h = {
|
|
|
73
47
|
/**
|
|
74
48
|
* Name element - row for info cell table
|
|
75
49
|
*/
|
|
76
|
-
[
|
|
50
|
+
[_]: (t) => `
|
|
77
51
|
<tr>
|
|
78
52
|
<td
|
|
79
53
|
class="esd-block-text product-name"
|
|
80
|
-
esd-extension-block-id="${
|
|
54
|
+
esd-extension-block-id="${o.NAME}"
|
|
81
55
|
align="left">
|
|
82
56
|
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
|
|
83
57
|
<strong>${t.name}</strong>
|
|
@@ -92,7 +66,7 @@ const h = {
|
|
|
92
66
|
<tr>
|
|
93
67
|
<td
|
|
94
68
|
class="esd-block-text product-price"
|
|
95
|
-
esd-extension-block-id="${
|
|
69
|
+
esd-extension-block-id="${o.PRICE}"
|
|
96
70
|
align="left">
|
|
97
71
|
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
98
72
|
<strong>${r(t, "price")}</strong>
|
|
@@ -103,7 +77,20 @@ const h = {
|
|
|
103
77
|
/**
|
|
104
78
|
* Old price element - row for info cell table
|
|
105
79
|
*/
|
|
106
|
-
[
|
|
80
|
+
[T]: (t) => `
|
|
81
|
+
<tr>
|
|
82
|
+
<td
|
|
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>
|
|
91
|
+
</td>
|
|
92
|
+
</tr>
|
|
93
|
+
`,
|
|
107
94
|
/**
|
|
108
95
|
* Omnibus price element - row for info cell table
|
|
109
96
|
*/
|
|
@@ -113,7 +100,7 @@ const h = {
|
|
|
113
100
|
class="esd-block-text product-omnibus-price"
|
|
114
101
|
data-text-before="Lowest 30-day price: "
|
|
115
102
|
data-text-after=""
|
|
116
|
-
esd-extension-block-id="${
|
|
103
|
+
esd-extension-block-id="${o.OMNIBUS_PRICE}"
|
|
117
104
|
align="left">
|
|
118
105
|
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
119
106
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
@@ -126,20 +113,20 @@ const h = {
|
|
|
126
113
|
/**
|
|
127
114
|
* Omnibus discount element - row for info cell table
|
|
128
115
|
*/
|
|
129
|
-
[
|
|
130
|
-
var
|
|
131
|
-
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%";
|
|
132
119
|
return `
|
|
133
120
|
<tr>
|
|
134
121
|
<td
|
|
135
122
|
class="esd-block-text product-omnibus-discount"
|
|
136
123
|
data-text-before=""
|
|
137
124
|
data-text-after=""
|
|
138
|
-
esd-extension-block-id="${
|
|
125
|
+
esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
|
|
139
126
|
align="left">
|
|
140
127
|
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
141
128
|
<span class="omnibus-text-before"></span>
|
|
142
|
-
<span class="omnibus-discount-value">${
|
|
129
|
+
<span class="omnibus-discount-value">${m}</span>
|
|
143
130
|
<span class="omnibus-text-after"></span>
|
|
144
131
|
</p>
|
|
145
132
|
</td>
|
|
@@ -150,12 +137,12 @@ const h = {
|
|
|
150
137
|
* Button cell - right column (100px fixed width)
|
|
151
138
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
152
139
|
*/
|
|
153
|
-
[
|
|
140
|
+
[c]: (t) => `
|
|
154
141
|
<td
|
|
155
142
|
width="100"
|
|
156
143
|
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
157
|
-
esd-extension-block-id="${
|
|
158
|
-
data-attribute-type="${
|
|
144
|
+
esd-extension-block-id="${o.BUTTON}"
|
|
145
|
+
data-attribute-type="${c}"
|
|
159
146
|
data-visibility="1"
|
|
160
147
|
align="center"
|
|
161
148
|
valign="middle">
|
|
@@ -169,7 +156,7 @@ const h = {
|
|
|
169
156
|
<a
|
|
170
157
|
href="${t.url}"
|
|
171
158
|
target="_blank"
|
|
172
|
-
class="es-button ${
|
|
159
|
+
class="es-button ${d}"
|
|
173
160
|
style="
|
|
174
161
|
color: rgb(56, 118, 29);
|
|
175
162
|
background: rgb(217, 234, 211);
|
|
@@ -192,20 +179,18 @@ const h = {
|
|
|
192
179
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
193
180
|
* @param content - Display content for the cell
|
|
194
181
|
*/
|
|
195
|
-
[
|
|
182
|
+
[O]: (t, e) => `
|
|
196
183
|
<tr>
|
|
197
184
|
<td
|
|
198
|
-
${
|
|
185
|
+
${u}="${t}"
|
|
199
186
|
class="esd-block-text product-custom-attribute"
|
|
200
|
-
esd-extension-block-id="${
|
|
187
|
+
esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
|
|
201
188
|
align="left">
|
|
202
|
-
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${
|
|
189
|
+
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${e}</p>
|
|
203
190
|
</td>
|
|
204
191
|
</tr>
|
|
205
192
|
`
|
|
206
193
|
};
|
|
207
194
|
export {
|
|
208
|
-
|
|
209
|
-
y as renderInlineListPriceRow,
|
|
210
|
-
R as renderListOldPriceRow
|
|
195
|
+
I as listElementRenderer
|
|
211
196
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as
|
|
2
|
-
import { DEFAULT_CARD_COMPOSITION as
|
|
3
|
-
import { listElementRenderer as
|
|
4
|
-
function
|
|
5
|
-
const
|
|
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>/, "");
|
|
6
6
|
return `<tr
|
|
7
7
|
class="recommendation-attribute-row"
|
|
8
|
-
data-attribute-type="${
|
|
9
|
-
data-visibility="${
|
|
8
|
+
data-attribute-type="${n}"
|
|
9
|
+
data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const y = `
|
|
12
12
|
<tr class="recommendation-product-row">
|
|
13
13
|
<td style="padding: 0 5px;">
|
|
14
14
|
<table
|
|
@@ -26,29 +26,29 @@ const _ = `
|
|
|
26
26
|
</td>
|
|
27
27
|
</tr>
|
|
28
28
|
`;
|
|
29
|
-
function
|
|
30
|
-
const
|
|
29
|
+
function O(r, n = b, l = {}) {
|
|
30
|
+
const t = C(f, n, l), o = t[a](r), c = `
|
|
31
31
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
32
32
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
33
33
|
<tbody>
|
|
34
|
-
${
|
|
35
|
-
const
|
|
36
|
-
return
|
|
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);
|
|
37
37
|
}).join(`
|
|
38
38
|
`)}
|
|
39
39
|
</tbody>
|
|
40
40
|
</table>
|
|
41
41
|
</td>
|
|
42
|
-
`,
|
|
43
|
-
return
|
|
42
|
+
`, s = t[d](r), p = o + c + s;
|
|
43
|
+
return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
47
|
-
const
|
|
48
|
-
return
|
|
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;
|
|
49
49
|
}).join("");
|
|
50
50
|
}
|
|
51
51
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
O as getListProductCard,
|
|
53
|
+
D as prepareProductRows
|
|
54
54
|
};
|
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { formatPrice as P } from "../utils/priceFormatter.js";
|
|
4
|
-
function S() {
|
|
5
|
-
const t = D(), { currencySettings: e } = t.recommendationConfigs;
|
|
6
|
-
return {
|
|
7
|
-
code: e.value,
|
|
8
|
-
symbol: e.symbol,
|
|
9
|
-
alignment: e.alignment === "0" ? "before" : "after",
|
|
10
|
-
decimalCount: parseInt(e.decimalCount) || 2,
|
|
11
|
-
decimalSeparator: e.decimalSeparator,
|
|
12
|
-
thousandSeparator: e.thousandSeparator
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function w(t, e = "price") {
|
|
16
|
-
const r = S(), n = t[e], o = (n == null ? void 0 : n[r.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
17
|
-
return P({
|
|
18
|
-
price: o,
|
|
19
|
-
currency: r
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function h(t) {
|
|
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) {
|
|
23
3
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
24
4
|
}
|
|
25
|
-
function
|
|
26
|
-
const e = t.indexOf(c), r = t.indexOf(l), n = r !== -1 && (e === -1 || r < e);
|
|
27
|
-
return {
|
|
28
|
-
originalFirst: n,
|
|
29
|
-
anchor: n ? l : c,
|
|
30
|
-
skip: n ? c : l
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function I(t) {
|
|
5
|
+
function U(t) {
|
|
34
6
|
const e = Array.isArray(t) ? t[t.length - 1] : t;
|
|
35
7
|
if (typeof e == "string")
|
|
36
8
|
return e;
|
|
@@ -38,57 +10,57 @@ function I(t) {
|
|
|
38
10
|
return String(e);
|
|
39
11
|
}
|
|
40
12
|
function C(t, e) {
|
|
41
|
-
const
|
|
42
|
-
return (
|
|
13
|
+
const n = Object.values(e).find((r) => r.attributeName === t);
|
|
14
|
+
return (n == null ? void 0 : n.type) === "defaultAttribute";
|
|
43
15
|
}
|
|
44
|
-
function
|
|
16
|
+
function h(t, e) {
|
|
45
17
|
return C(t, e) ? t : `product_attribute.${t}`;
|
|
46
18
|
}
|
|
47
|
-
const
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
19
|
+
const P = Symbol("customCellHtml");
|
|
20
|
+
function L(t, e, n = {}) {
|
|
21
|
+
const r = t[P];
|
|
22
|
+
if (!r)
|
|
51
23
|
return { ...t };
|
|
52
|
-
const
|
|
53
|
-
return e.filter((
|
|
54
|
-
const
|
|
55
|
-
o
|
|
56
|
-
var
|
|
57
|
-
const
|
|
58
|
-
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);
|
|
59
31
|
};
|
|
60
|
-
}),
|
|
32
|
+
}), i;
|
|
61
33
|
}
|
|
62
|
-
const
|
|
34
|
+
const M = {
|
|
63
35
|
TITLE: "You May Also Like!"
|
|
64
|
-
},
|
|
36
|
+
}, $ = [
|
|
37
|
+
u,
|
|
65
38
|
p,
|
|
39
|
+
m,
|
|
66
40
|
b,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
g
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
], V = {
|
|
41
|
+
T,
|
|
42
|
+
_,
|
|
43
|
+
g
|
|
44
|
+
], w = {
|
|
45
|
+
[u]: !0,
|
|
73
46
|
[p]: !0,
|
|
74
47
|
[b]: !0,
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
|
|
80
|
-
}, L = `
|
|
48
|
+
[m]: !0,
|
|
49
|
+
[T]: !1,
|
|
50
|
+
[_]: !1,
|
|
51
|
+
[g]: !0
|
|
52
|
+
}, I = `
|
|
81
53
|
<tr>
|
|
82
54
|
<td class="spacer" style="height: 10px;"></td>
|
|
83
55
|
</tr>
|
|
84
|
-
`,
|
|
85
|
-
function
|
|
86
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
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;
|
|
87
59
|
}
|
|
88
|
-
function
|
|
60
|
+
function E(t) {
|
|
89
61
|
return {
|
|
90
62
|
name: "Product Name",
|
|
91
|
-
image_url:
|
|
63
|
+
image_url: f,
|
|
92
64
|
price: { USD: 18 },
|
|
93
65
|
original_price: { USD: 20 },
|
|
94
66
|
discount: { USD: 2 },
|
|
@@ -100,19 +72,19 @@ function x(t) {
|
|
|
100
72
|
category: []
|
|
101
73
|
};
|
|
102
74
|
}
|
|
103
|
-
function
|
|
75
|
+
function k(t = 6) {
|
|
104
76
|
return Array.from(
|
|
105
77
|
{ length: t },
|
|
106
|
-
(e,
|
|
78
|
+
(e, n) => E(String(n + 1))
|
|
107
79
|
);
|
|
108
80
|
}
|
|
109
|
-
function
|
|
110
|
-
const
|
|
111
|
-
data-layout="list"` : "",
|
|
81
|
+
function x(t = "grid", e) {
|
|
82
|
+
const n = t === "list" ? `
|
|
83
|
+
data-layout="list"` : "", r = e ? ` ${e}` : "";
|
|
112
84
|
return `
|
|
113
85
|
<td
|
|
114
86
|
align="left"
|
|
115
|
-
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}>
|
|
116
88
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
117
89
|
<tr>
|
|
118
90
|
<td align="center">
|
|
@@ -144,7 +116,7 @@ function j(t = "grid", e) {
|
|
|
144
116
|
</table>
|
|
145
117
|
</td>
|
|
146
118
|
</tr>
|
|
147
|
-
${
|
|
119
|
+
${I}
|
|
148
120
|
<tr>
|
|
149
121
|
<td>
|
|
150
122
|
<table
|
|
@@ -183,21 +155,18 @@ function j(t = "grid", e) {
|
|
|
183
155
|
`;
|
|
184
156
|
}
|
|
185
157
|
export {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
S as getCurrentCurrencyConfig,
|
|
195
|
-
W as getDefaultProducts,
|
|
158
|
+
P as CUSTOM_CELL_HTML,
|
|
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,
|
|
196
166
|
C as isDefaultAttribute,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
I as toDisplayableAttributeValue
|
|
167
|
+
h as resolveProductAttrValue,
|
|
168
|
+
N as sanitizeImageUrl,
|
|
169
|
+
I as spacer,
|
|
170
|
+
y as toDisplayName,
|
|
171
|
+
U as toDisplayableAttributeValue
|
|
203
172
|
};
|
|
@@ -139,10 +139,6 @@ export declare const LegacyRecommendationConfigSchema: v.LooseObjectSchema<{
|
|
|
139
139
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
140
140
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
141
141
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
142
|
-
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
143
|
-
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
144
|
-
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
145
|
-
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
146
142
|
}, undefined>;
|
|
147
143
|
/**
|
|
148
144
|
* Migration-only inputs scoped to this template.
|
|
@@ -199,10 +195,6 @@ export declare const TemplateMigrationSchema: v.ObjectSchema<{
|
|
|
199
195
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
200
196
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
201
197
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
202
|
-
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
203
|
-
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
204
|
-
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
205
|
-
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
206
198
|
}, undefined>, undefined>, {}>;
|
|
207
199
|
}, undefined>;
|
|
208
200
|
/**
|
|
@@ -282,10 +274,6 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
282
274
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
283
275
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
284
276
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
285
|
-
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
286
|
-
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
287
|
-
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
288
|
-
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
289
277
|
}, undefined>, undefined>, {}>;
|
|
290
278
|
}, undefined>, {}>;
|
|
291
279
|
}, undefined>;
|
|
@@ -677,10 +665,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
677
665
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
678
666
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
679
667
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
680
|
-
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
681
|
-
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
682
|
-
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
683
|
-
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
684
668
|
}, undefined>, undefined>, {}>;
|
|
685
669
|
}, undefined>, {}>;
|
|
686
670
|
}, undefined>, {}>;
|
|
@@ -60,8 +60,6 @@ export declare const useConfig: () => {
|
|
|
60
60
|
blockType?: string | undefined;
|
|
61
61
|
size?: string | number | undefined;
|
|
62
62
|
verticalResponsiveness?: boolean | undefined;
|
|
63
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
64
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
65
63
|
} & {
|
|
66
64
|
[key: string]: unknown;
|
|
67
65
|
};
|
|
@@ -188,8 +186,6 @@ export declare const useConfig: () => {
|
|
|
188
186
|
blockType?: string | undefined;
|
|
189
187
|
size?: string | number | undefined;
|
|
190
188
|
verticalResponsiveness?: boolean | undefined;
|
|
191
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
192
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
193
189
|
} & {
|
|
194
190
|
[key: string]: unknown;
|
|
195
191
|
};
|
|
@@ -3,5 +3,5 @@ import type { CurrencyConfig, RecommendationNodeConfig } from '@@/Extensions/Blo
|
|
|
3
3
|
import type { LegacyRecommendationConfig } from '@@/Types/config';
|
|
4
4
|
/** Defensive against missing/malformed legacy `currencySettings` — defaults are per-field, not whole-object. */
|
|
5
5
|
export declare function mapCurrency(legacy: unknown): CurrencyConfig;
|
|
6
|
-
export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | '
|
|
6
|
+
export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'configVersion'>;
|
|
7
7
|
export declare function mapSettings(recCfg: LegacyRecommendationConfig, parsed: LegacyProductConfig, id: number): SettingsPartial;
|
|
@@ -24,5 +24,13 @@ export declare class ItemsBlock extends Block {
|
|
|
24
24
|
getSettingsPanelTitleHtml(): string;
|
|
25
25
|
getTemplate(): string;
|
|
26
26
|
allowInnerBlocksDND(): boolean;
|
|
27
|
+
canBeSavedAsModule(): boolean;
|
|
27
28
|
onCreated(node: ImmutableHtmlNode): void;
|
|
29
|
+
/**
|
|
30
|
+
* Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
|
|
31
|
+
* surfaces via document load. Stripo strips esd-ext-config and never restores it
|
|
32
|
+
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
33
|
+
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
34
|
+
*/
|
|
35
|
+
onDocumentChanged(node: ImmutableHtmlNode): void;
|
|
28
36
|
}
|
|
@@ -55,7 +55,7 @@ export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode |
|
|
|
55
55
|
/**
|
|
56
56
|
* Gets the node configuration from the Items block.
|
|
57
57
|
* Uses Stripo V2's getNodeConfig() API.
|
|
58
|
-
* Falls back to
|
|
58
|
+
* Falls back to the persisted esd-ext-config (saved modules), then legacy config block.
|
|
59
59
|
* @param currentNode - The current node from the control
|
|
60
60
|
* @returns The ItemsBlockConfig object or null if not found
|
|
61
61
|
*/
|
|
@@ -104,16 +104,6 @@ export declare class RecommendationBlock extends Block {
|
|
|
104
104
|
* added classes via setAttribute.
|
|
105
105
|
*/
|
|
106
106
|
private _assignRecommendationId;
|
|
107
|
-
/**
|
|
108
|
-
* Stamps the `hide-price` attribute (read by email-service at send time) on
|
|
109
|
-
* the block element from the config flag.
|
|
110
|
-
*/
|
|
111
|
-
private _stampHidePrice;
|
|
112
|
-
/**
|
|
113
|
-
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
114
|
-
* heals templates saved before this feature without dirtying current ones.
|
|
115
|
-
*/
|
|
116
|
-
private _healHidePriceAttr;
|
|
117
107
|
/**
|
|
118
108
|
* Gets the recommendation-id from a block node
|
|
119
109
|
*/
|