@useinsider/guido 3.8.2-beta.189e91c → 3.8.2
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/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +80 -88
- package/dist/config/migrator/recommendation/htmlBuilder.js +52 -53
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Recommendation/block.js +41 -60
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +264 -345
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +87 -99
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -162
- package/dist/extensions/Blocks/Recommendation/extension.js +29 -30
- 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 +1 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +96 -130
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +54 -43
- package/dist/extensions/Blocks/Recommendation/templates/index.js +14 -17
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +80 -86
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +40 -31
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +102 -155
- 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/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 +1 -13
- 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.d.ts +1 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -51
- 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 -111
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +0 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,148 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
27
|
-
}
|
|
28
|
-
function G(t) {
|
|
29
|
-
const e = t.indexOf(c), n = t.indexOf(l), o = n !== -1 && (e === -1 || n < e);
|
|
30
|
-
return {
|
|
31
|
-
originalFirst: o,
|
|
32
|
-
anchor: o ? l : c,
|
|
33
|
-
skip: o ? c : l
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function $(t) {
|
|
37
|
-
const e = Array.isArray(t) ? t[t.length - 1] : t;
|
|
38
|
-
if (typeof e == "string")
|
|
39
|
-
return e;
|
|
40
|
-
if (typeof e == "number")
|
|
41
|
-
return String(e);
|
|
42
|
-
}
|
|
43
|
-
function h(t, e) {
|
|
44
|
-
const n = Object.values(e).find((o) => o.attributeName === t);
|
|
45
|
-
return (n == null ? void 0 : n.type) === "defaultAttribute";
|
|
46
|
-
}
|
|
47
|
-
function L(t, e) {
|
|
48
|
-
return h(t, e) ? t : `${u}${t}`;
|
|
49
|
-
}
|
|
50
|
-
function j(t) {
|
|
51
|
-
const e = t.startsWith(u) ? t.substring(u.length) : t;
|
|
52
|
-
return `${a}${e}`;
|
|
53
|
-
}
|
|
54
|
-
const x = Symbol("customCellHtml");
|
|
55
|
-
function z(t, e, n = {}) {
|
|
56
|
-
const o = t[x];
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as c, PRODUCT_ATTRIBUTE_PREFIX as l, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as m } from "../constants/selectors.js";
|
|
2
|
+
function U(t) {
|
|
3
|
+
return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
|
|
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);
|
|
11
|
+
}
|
|
12
|
+
function C(t, n) {
|
|
13
|
+
const e = Object.values(n).find((o) => o.attributeName === t);
|
|
14
|
+
return (e == null ? void 0 : e.type) === "defaultAttribute";
|
|
15
|
+
}
|
|
16
|
+
function E(t, n) {
|
|
17
|
+
return C(t, n) ? t : `${l}${t}`;
|
|
18
|
+
}
|
|
19
|
+
function M(t) {
|
|
20
|
+
const n = t.startsWith(l) ? t.substring(l.length) : t;
|
|
21
|
+
return `${c}${n}`;
|
|
22
|
+
}
|
|
23
|
+
const P = Symbol("customCellHtml");
|
|
24
|
+
function k(t, n, e = {}) {
|
|
25
|
+
const o = t[P];
|
|
57
26
|
if (!o)
|
|
58
27
|
return { ...t };
|
|
59
|
-
const
|
|
60
|
-
return
|
|
61
|
-
const i =
|
|
62
|
-
r
|
|
63
|
-
var
|
|
64
|
-
const
|
|
65
|
-
return o(
|
|
28
|
+
const s = { ...t };
|
|
29
|
+
return n.filter((r) => r.startsWith(c) && !s[r]).forEach((r) => {
|
|
30
|
+
const i = r.substring(c.length), a = U(i), y = E(i, e), R = C(i, e);
|
|
31
|
+
s[r] = (d, A) => {
|
|
32
|
+
var u;
|
|
33
|
+
const D = R ? d[i] : (u = d.product_attributes) == null ? void 0 : u[i], O = S(D) ?? a;
|
|
34
|
+
return o(y, O, A);
|
|
66
35
|
};
|
|
67
|
-
}),
|
|
68
|
-
}
|
|
69
|
-
function V(t, e) {
|
|
70
|
-
var n, o, r, s, i;
|
|
71
|
-
return {
|
|
72
|
-
cellPadding: e.cellPadding,
|
|
73
|
-
cardBackgroundColor: e.cardBackgroundColor,
|
|
74
|
-
cellBackgroundColor: (n = e.cellBackgroundColors) == null ? void 0 : n[t],
|
|
75
|
-
cellAlignment: (o = e.cellAlignments) == null ? void 0 : o[t],
|
|
76
|
-
cellClasses: (r = e.cellClasses) == null ? void 0 : r[t],
|
|
77
|
-
omnibusText: (s = e.omnibusTexts) == null ? void 0 : s[t],
|
|
78
|
-
styleTemplate: (i = e.styleTemplates) == null ? void 0 : i[t]
|
|
79
|
-
};
|
|
36
|
+
}), s;
|
|
80
37
|
}
|
|
81
|
-
const
|
|
38
|
+
const x = {
|
|
82
39
|
TITLE: "You May Also Like!"
|
|
83
|
-
},
|
|
84
|
-
|
|
40
|
+
}, v = [
|
|
41
|
+
b,
|
|
85
42
|
T,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
43
|
+
g,
|
|
44
|
+
_,
|
|
45
|
+
f,
|
|
89
46
|
p,
|
|
90
|
-
|
|
91
|
-
],
|
|
92
|
-
[
|
|
47
|
+
m
|
|
48
|
+
], F = {
|
|
49
|
+
[b]: !0,
|
|
93
50
|
[T]: !0,
|
|
94
|
-
[
|
|
95
|
-
[
|
|
96
|
-
[
|
|
51
|
+
[_]: !0,
|
|
52
|
+
[g]: !0,
|
|
53
|
+
[f]: !1,
|
|
97
54
|
[p]: !1,
|
|
98
|
-
[
|
|
99
|
-
},
|
|
100
|
-
function
|
|
55
|
+
[m]: !0
|
|
56
|
+
}, I = 10;
|
|
57
|
+
function $(t = I) {
|
|
101
58
|
return `
|
|
102
59
|
<tr>
|
|
103
60
|
<td class="spacer" style="height: ${t}px;"></td>
|
|
104
61
|
</tr>
|
|
105
62
|
`;
|
|
106
63
|
}
|
|
107
|
-
const
|
|
108
|
-
function w(t,
|
|
109
|
-
return
|
|
64
|
+
const L = $();
|
|
65
|
+
function w(t, n) {
|
|
66
|
+
return n ? n.pStyle ?? "" : t;
|
|
110
67
|
}
|
|
111
|
-
function
|
|
112
|
-
const o = w(
|
|
113
|
-
return `<p contenteditable="false" style="${o}">${
|
|
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>`;
|
|
114
71
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
return t &&
|
|
72
|
+
function H(t, n) {
|
|
73
|
+
const e = [];
|
|
74
|
+
return t && e.push(t), n && e.push(`background-color: ${n};`), e.join(" ");
|
|
118
75
|
}
|
|
119
|
-
function
|
|
120
|
-
return t ? ` background-color: ${t}
|
|
121
|
-
}
|
|
122
|
-
function Z(t) {
|
|
123
|
-
const e = N(t);
|
|
124
|
-
return e ? ` style="${e.trim()}"` : "";
|
|
76
|
+
function Y(t) {
|
|
77
|
+
return t ? ` style="background-color: ${t};"` : "";
|
|
125
78
|
}
|
|
126
|
-
function
|
|
79
|
+
function G(t, n = "") {
|
|
127
80
|
return {
|
|
128
|
-
before: (t == null ? void 0 : t.before) ??
|
|
81
|
+
before: (t == null ? void 0 : t.before) ?? n,
|
|
129
82
|
after: (t == null ? void 0 : t.after) ?? ""
|
|
130
83
|
};
|
|
131
84
|
}
|
|
132
|
-
function
|
|
133
|
-
return `${(
|
|
85
|
+
function z(t, n) {
|
|
86
|
+
return `${(n == null ? void 0 : n.openTags) ?? ""}${t}${(n == null ? void 0 : n.closeTags) ?? ""}`;
|
|
134
87
|
}
|
|
135
|
-
function
|
|
88
|
+
function X(t) {
|
|
136
89
|
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
137
90
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
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;
|
|
141
94
|
}
|
|
142
|
-
function
|
|
95
|
+
function B(t) {
|
|
143
96
|
return {
|
|
144
97
|
name: "Product Name",
|
|
145
|
-
image_url:
|
|
98
|
+
image_url: h,
|
|
146
99
|
price: { USD: 18 },
|
|
147
100
|
original_price: { USD: 20 },
|
|
148
101
|
discount: { USD: 2 },
|
|
@@ -154,19 +107,19 @@ function F(t) {
|
|
|
154
107
|
category: []
|
|
155
108
|
};
|
|
156
109
|
}
|
|
157
|
-
function
|
|
110
|
+
function J(t = 6) {
|
|
158
111
|
return Array.from(
|
|
159
112
|
{ length: t },
|
|
160
|
-
(
|
|
113
|
+
(n, e) => B(String(e + 1))
|
|
161
114
|
);
|
|
162
115
|
}
|
|
163
|
-
function
|
|
164
|
-
const
|
|
165
|
-
data-layout="list"` : "", o =
|
|
116
|
+
function Q(t = "grid", n) {
|
|
117
|
+
const e = t === "list" ? `
|
|
118
|
+
data-layout="list"` : "", o = n ? ` ${n}` : "";
|
|
166
119
|
return `
|
|
167
120
|
<td
|
|
168
121
|
align="left"
|
|
169
|
-
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${
|
|
122
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${e}>
|
|
170
123
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
171
124
|
<tr>
|
|
172
125
|
<td align="center">
|
|
@@ -198,7 +151,7 @@ function lt(t = "grid", e) {
|
|
|
198
151
|
</table>
|
|
199
152
|
</td>
|
|
200
153
|
</tr>
|
|
201
|
-
${
|
|
154
|
+
${L}
|
|
202
155
|
<tr>
|
|
203
156
|
<td>
|
|
204
157
|
<table
|
|
@@ -237,37 +190,31 @@ function lt(t = "grid", e) {
|
|
|
237
190
|
`;
|
|
238
191
|
}
|
|
239
192
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
Y as isSamePrice,
|
|
260
|
-
et as renderButtonLabel,
|
|
261
|
-
J as renderStyledParagraph,
|
|
262
|
-
nt as resolveButtonBorderClass,
|
|
263
|
-
G as resolveInlinePriceOrder,
|
|
264
|
-
tt as resolveOmnibusText,
|
|
193
|
+
P as CUSTOM_CELL_HTML,
|
|
194
|
+
x as DEFAULTS,
|
|
195
|
+
K as DEFAULT_BUTTON_ANCHOR_STYLE,
|
|
196
|
+
V as DEFAULT_BUTTON_BORDER_STYLE,
|
|
197
|
+
v as DEFAULT_CARD_COMPOSITION,
|
|
198
|
+
F as DEFAULT_CARD_VISIBILITY,
|
|
199
|
+
j as DEFAULT_IMG_STYLE,
|
|
200
|
+
I as DEFAULT_ROW_SPACING_PX,
|
|
201
|
+
h as PLACEHOLDER_IMAGE,
|
|
202
|
+
k as buildElementRenderer,
|
|
203
|
+
$ as buildSpacer,
|
|
204
|
+
Y as cellBgStyleAttr,
|
|
205
|
+
Q as createBlockTemplate,
|
|
206
|
+
J as getDefaultProducts,
|
|
207
|
+
C as isDefaultAttribute,
|
|
208
|
+
z as renderButtonLabel,
|
|
209
|
+
W as renderStyledParagraph,
|
|
210
|
+
X as resolveButtonBorderClass,
|
|
211
|
+
G as resolveOmnibusText,
|
|
265
212
|
w as resolvePStyle,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
|
273
220
|
};
|
|
@@ -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;
|
|
@@ -117,16 +117,6 @@ export declare class RecommendationBlock extends Block {
|
|
|
117
117
|
* added classes via setAttribute.
|
|
118
118
|
*/
|
|
119
119
|
private _assignRecommendationId;
|
|
120
|
-
/**
|
|
121
|
-
* Stamps the `hide-price` attribute (read by email-service at send time) on
|
|
122
|
-
* the block element from the config flag.
|
|
123
|
-
*/
|
|
124
|
-
private _stampHidePrice;
|
|
125
|
-
/**
|
|
126
|
-
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
127
|
-
* heals templates saved before this feature without dirtying current ones.
|
|
128
|
-
*/
|
|
129
|
-
private _healHidePriceAttr;
|
|
130
120
|
/**
|
|
131
121
|
* Gets the recommendation-id from a block node
|
|
132
122
|
*/
|
|
@@ -50,15 +50,6 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
50
50
|
*/
|
|
51
51
|
private _tryReorderInPlace;
|
|
52
52
|
private _createBuiltInItemHtml;
|
|
53
|
-
/**
|
|
54
|
-
* Inline mode: the merged "Product Prices" group item. It moves as a unit in
|
|
55
|
-
* the main list (both keys stay adjacent) and contains a nested 2-item drag
|
|
56
|
-
* to reorder Product Price ↔ Product Original Price — which flips the inline
|
|
57
|
-
* render order via `resolveInlinePriceOrder`. The group keeps a single
|
|
58
|
-
* visibility toggle (`data-action-for="productPrice"`). Nested sub-items use a
|
|
59
|
-
* plain drag handle (no UE button → untouched by the reorder-icon rescue).
|
|
60
|
-
*/
|
|
61
|
-
private _createPriceGroupItemHtml;
|
|
62
53
|
private _createCustomItemHtml;
|
|
63
54
|
/**
|
|
64
55
|
* Builds select options from the store's filterList.
|
|
@@ -114,23 +105,7 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
114
105
|
*/
|
|
115
106
|
private _rescueReorderIconsToStore;
|
|
116
107
|
private _setupEventListeners;
|
|
117
|
-
/**
|
|
118
|
-
* Builds the composition key order from the orderable list, expanding the
|
|
119
|
-
* inline "Product Prices" group into its two sub-keys (in nested DOM order)
|
|
120
|
-
* so both price keys stay adjacent and in the user-chosen order.
|
|
121
|
-
*/
|
|
122
|
-
private _extractCompositionOrder;
|
|
123
108
|
private _setupDragAndDrop;
|
|
124
|
-
/**
|
|
125
|
-
* Wires drag/drop reordering for one item level on the shared list. Both the
|
|
126
|
-
* top-level items and the nested price sub-items use this; they never fight
|
|
127
|
-
* because each only sets its `dragged` ref when its own `itemSelector` matches
|
|
128
|
-
* at dragstart (and the top-level one additionally ignores drags originating
|
|
129
|
-
* inside `ignoreSelector`). Every drop re-reads the full composition via
|
|
130
|
-
* `_extractCompositionOrder`, so both levels commit through `_onReorder`
|
|
131
|
-
* identically.
|
|
132
|
-
*/
|
|
133
|
-
private _registerDragHandlers;
|
|
134
109
|
private _setupDeleteHandler;
|
|
135
110
|
private _onAddAttribute;
|
|
136
111
|
/**
|
|
@@ -187,10 +162,9 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
187
162
|
private _extractSegmentBgFromCard;
|
|
188
163
|
private _getControlContainer;
|
|
189
164
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* disabled state.)
|
|
165
|
+
* Adds/removes orderable-disabled class based on layout orientation.
|
|
166
|
+
* List layout hides drag handles via CSS and disables draggable attribute
|
|
167
|
+
* to prevent native browser drag-and-drop from working without the handle.
|
|
194
168
|
*/
|
|
195
169
|
private _updateOrderableState;
|
|
196
170
|
/**
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* // Or individual imports
|
|
10
10
|
* import { NameAlignControl, ButtonColorControl } from './controls';
|
|
11
11
|
*/
|
|
12
|
-
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID,
|
|
12
|
+
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, } from './main';
|
|
13
13
|
export * from './main/utils';
|
|
14
14
|
export { NameControls } from './name';
|
|
15
15
|
export { PriceControls } from './price';
|
|
@@ -5,12 +5,11 @@ import { CurrencyControl, CURRENCY_CONTROL_ID } from './currency';
|
|
|
5
5
|
import { FiltersControl, FILTERS_CONTROL_ID } from './filters';
|
|
6
6
|
import { LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID } from './layoutOrientation';
|
|
7
7
|
import { LocaleControl, LOCALE_CONTROL_ID } from './locale';
|
|
8
|
-
import { PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID } from './pricePlacement';
|
|
9
8
|
import { ProductCountControl, PRODUCT_COUNT_CONTROL_ID } from './productCount';
|
|
10
9
|
import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
|
|
11
10
|
import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
|
|
12
11
|
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
13
|
-
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID,
|
|
12
|
+
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, };
|
|
14
13
|
export * from './utils';
|
|
15
14
|
/**
|
|
16
15
|
* Main recommendation block control that composes all sub-controls
|
|
@@ -27,7 +26,6 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
27
26
|
private productLayoutControl;
|
|
28
27
|
private filtersControl;
|
|
29
28
|
private shuffleControl;
|
|
30
|
-
private pricePlacementControl;
|
|
31
29
|
private layoutOrientationControl;
|
|
32
30
|
getId(): string;
|
|
33
31
|
getTemplate(): string;
|
|
@@ -25,8 +25,6 @@ export interface PerBlockConfigs {
|
|
|
25
25
|
unresponsive: boolean;
|
|
26
26
|
size: string;
|
|
27
27
|
customAttributes: string[];
|
|
28
|
-
priceMovedToNextLine: boolean;
|
|
29
|
-
priceHideIfSameAsDiscounted: boolean;
|
|
30
28
|
}
|
|
31
29
|
interface PerBlockState {
|
|
32
30
|
recommendationConfigs: PerBlockConfigs;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type ElementRenderer, type CellRenderOptions } from '../utils';
|
|
1
|
+
import { type ElementRenderer } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* Grid element renderer
|
|
5
4
|
* Each element returns a `<td>` containing a nested table structure:
|
|
@@ -25,15 +24,4 @@ export declare const ATTRIBUTE_CELL_CLASS = "attribute-cell";
|
|
|
25
24
|
* card-composition control so both render identical filler markup.
|
|
26
25
|
*/
|
|
27
26
|
export declare function buildFillerCell(columnWidth: string, padding?: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* Renders the inline price cell used when "Move to next line" is OFF: the sale
|
|
30
|
-
* price and original price sit side by side in a single attribute cell, each
|
|
31
|
-
* keeping its own `esd-extension-block-id` + `product-*` class so the per-element
|
|
32
|
-
* style controls and the compiler keep working.
|
|
33
|
-
*
|
|
34
|
-
* `originalFirst` preserves the card-composition order (original before sale when
|
|
35
|
-
* `productOldPrice` precedes `productPrice` in the composition) so the side-by-side
|
|
36
|
-
* order matches the stacked order.
|
|
37
|
-
*/
|
|
38
|
-
export declare function renderInlineGridPriceCell(product: RecommendationProduct, originalFirst?: boolean, priceOptions?: CellRenderOptions, oldPriceOptions?: CellRenderOptions, cardBackgroundColor?: string): string;
|
|
39
27
|
export declare const gridElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type ElementRenderer, type
|
|
2
|
+
import { type ElementRenderer, type RenderOptions } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates attribute-aligned product rows for grid layout.
|
|
5
5
|
* Creates rows where each row contains one attribute type from all products.
|
|
@@ -9,7 +9,7 @@ import { type ElementRenderer, type PricePlacementFlags, type RenderOptions } fr
|
|
|
9
9
|
* @param composition - Array defining order of card elements
|
|
10
10
|
* @returns HTML string for attribute-aligned rows
|
|
11
11
|
*/
|
|
12
|
-
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions
|
|
12
|
+
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): string;
|
|
13
13
|
/**
|
|
14
14
|
* Prepares grid product rows with attribute-aligned structure
|
|
15
15
|
* Groups products into rows, then generates attribute-aligned HTML for each group
|
|
@@ -19,7 +19,7 @@ export declare function prepareGridAttributeRows(products: RecommendationProduct
|
|
|
19
19
|
* @param composition - Array defining order of card elements
|
|
20
20
|
* @returns HTML string for all product rows
|
|
21
21
|
*/
|
|
22
|
-
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions
|
|
22
|
+
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): string;
|
|
23
23
|
/**
|
|
24
24
|
* Prepares grid product rows with attribute-aligned structure.
|
|
25
25
|
* Uses row-based rendering where each attribute type forms a single row across all products.
|
|
@@ -28,6 +28,6 @@ export declare function prepareGridProductRows(products: RecommendationProduct[]
|
|
|
28
28
|
* @param composition - Array defining element order
|
|
29
29
|
* @returns HTML string for product rows
|
|
30
30
|
*/
|
|
31
|
-
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions
|
|
31
|
+
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): string;
|
|
32
32
|
export declare function getDefaultTemplate(recommendationId?: number): string;
|
|
33
33
|
export declare function generateBlockTemplate(products: RecommendationProduct[], productsPerRow: number, title?: string, composition?: string[], mobileProductsPerRow?: number): string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
8
8
|
import { type Orientation, type PrepareProductRowsOptions } from './utils';
|
|
9
|
-
export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts,
|
|
9
|
+
export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, type AttributeStyleTemplate, type AttributeStyleTemplates, type CellBackgroundColors, type CellAlignments, type CellClasses, type OmnibusTexts, } from './utils';
|
|
10
10
|
/**
|
|
11
11
|
* Unified function to prepare product rows for any layout.
|
|
12
12
|
* Delegates to the appropriate layout-specific implementation.
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type ElementRenderer, type CellRenderOptions } from '../utils';
|
|
1
|
+
import { type ElementRenderer } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* List element renderer
|
|
5
4
|
* - Image and Button return `<td>` cells for the 3-column layout
|
|
6
5
|
* - Name and Prices return `<tr><td>` rows for the info cell table
|
|
7
6
|
* All elements have esd-block-* classes for Stripo selection
|
|
8
7
|
*/
|
|
9
|
-
/**
|
|
10
|
-
* Inline price info row used when "Move to next line" is OFF: the sale price and
|
|
11
|
-
* original price sit in two cells of one row. Each keeps its block id + class so
|
|
12
|
-
* style controls and the compiler keep working. `originalFirst` preserves the
|
|
13
|
-
* card-composition order (original before sale by default) so it matches the
|
|
14
|
-
* stacked order.
|
|
15
|
-
*/
|
|
16
|
-
export declare function renderInlineListPriceRow(product: RecommendationProduct, originalFirst?: boolean, priceOptions?: CellRenderOptions, oldPriceOptions?: CellRenderOptions): string;
|
|
17
8
|
export declare const listElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type
|
|
2
|
+
import { type RenderOptions } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates a list product card with 3-column layout
|
|
5
5
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -12,7 +12,7 @@ import { type PricePlacementFlags, type RenderOptions } from '../utils';
|
|
|
12
12
|
* @param composition - Array defining order of card elements
|
|
13
13
|
* @returns HTML string for a single product card row
|
|
14
14
|
*/
|
|
15
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions
|
|
15
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): string;
|
|
16
16
|
/**
|
|
17
17
|
* Prepares list product rows
|
|
18
18
|
* Each product is a full-width row with 3-column layout
|
|
@@ -20,6 +20,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
20
20
|
* @param composition - Array defining order of card elements
|
|
21
21
|
* @returns HTML string for product rows
|
|
22
22
|
*/
|
|
23
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions
|
|
23
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions): string;
|
|
24
24
|
export declare function getDefaultTemplate(): string;
|
|
25
25
|
export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
|