@useinsider/guido 3.21.2-beta.4c14c74 → 3.21.2-beta.5a809f7
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 +22 -22
- package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
- package/dist/config/migrator/recommendation/extractors.js +74 -26
- package/dist/config/migrator/recommendation/htmlBuilder.js +279 -202
- package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
- package/dist/config/migrator/recommendationMigrator.js +65 -59
- package/dist/extensions/Blocks/Items/controls/button/link.js +17 -14
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +17 -14
- package/dist/extensions/Blocks/Items/controls/image/link.js +17 -14
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +10 -9
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +13 -12
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -29
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +16 -15
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +26 -25
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +28 -27
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +80 -75
- package/dist/extensions/Blocks/Recommendation/block.js +33 -24
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +27 -26
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +216 -236
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
- package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
- package/dist/extensions/Blocks/common-control.js +55 -62
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
- package/dist/src/config/migrator/recommendation/extractors.d.ts +26 -0
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +4 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
- package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as f, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as b, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as y, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
|
|
2
2
|
import { useRecommendationExtensionStore as L } from "../store/recommendation.js";
|
|
3
|
-
import { compositionKeyToProductAttr as
|
|
3
|
+
import { compositionKeyToProductAttr as p, isDefaultProductAttr as d, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as R } from "../utils/compositionKeys.js";
|
|
4
4
|
import { formatPrice as B } from "../utils/priceFormatter.js";
|
|
5
5
|
import { buildTitleRows as k } from "./titleRows.js";
|
|
6
|
-
function
|
|
6
|
+
function N() {
|
|
7
7
|
const t = L(), { currencySettings: e } = t.recommendationConfigs;
|
|
8
8
|
return {
|
|
9
9
|
code: e.value,
|
|
@@ -14,91 +14,83 @@ function x() {
|
|
|
14
14
|
thousandSeparator: e.thousandSeparator
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const o =
|
|
17
|
+
function g(t, e = "price") {
|
|
18
|
+
const o = N(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
19
19
|
return B({
|
|
20
20
|
price: c,
|
|
21
21
|
currency: o
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function q(t) {
|
|
25
|
-
return
|
|
25
|
+
return g(t, "price") === g(t, "original_price");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function w(t) {
|
|
28
28
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const e = t.indexOf(l), o = t.indexOf(a), n = o !== -1 && (e === -1 || o < e);
|
|
32
|
-
return {
|
|
33
|
-
originalFirst: n,
|
|
34
|
-
anchor: n ? a : l,
|
|
35
|
-
skip: n ? l : a
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function F(t) {
|
|
30
|
+
function x(t) {
|
|
39
31
|
const e = Array.isArray(t) ? t[t.length - 1] : t;
|
|
40
32
|
if (typeof e == "string")
|
|
41
33
|
return e;
|
|
42
34
|
if (typeof e == "number")
|
|
43
35
|
return String(e);
|
|
44
36
|
}
|
|
45
|
-
function
|
|
37
|
+
function F(t, e) {
|
|
46
38
|
var o;
|
|
47
39
|
return ((o = $(t, e)) == null ? void 0 : o.type) === "defaultAttribute";
|
|
48
40
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
41
|
+
function M(t, e) {
|
|
42
|
+
return F(t, e) ? t : `${I}${t}`;
|
|
51
43
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
44
|
+
function J(t) {
|
|
45
|
+
return R(t);
|
|
54
46
|
}
|
|
55
|
-
const
|
|
56
|
-
function
|
|
57
|
-
const n = t[
|
|
47
|
+
const v = Symbol("customCellHtml");
|
|
48
|
+
function Q(t, e, o = {}) {
|
|
49
|
+
const n = t[v];
|
|
58
50
|
if (!n)
|
|
59
51
|
return { ...t };
|
|
60
52
|
const c = { ...t };
|
|
61
|
-
return e.filter((
|
|
62
|
-
const
|
|
63
|
-
c[
|
|
64
|
-
var
|
|
65
|
-
const
|
|
66
|
-
return n(r,
|
|
53
|
+
return e.filter((s) => s.startsWith(f) && !c[s]).forEach((s) => {
|
|
54
|
+
const i = p(s), r = d(i) ? M(i, o) : i, l = S(r), h = w(l), D = d(r);
|
|
55
|
+
c[s] = (a, U) => {
|
|
56
|
+
var u;
|
|
57
|
+
const E = D ? a[l] : (u = a.product_attributes) == null ? void 0 : u[l], O = x(E) ?? h;
|
|
58
|
+
return n(r, O, U);
|
|
67
59
|
};
|
|
68
60
|
}), c;
|
|
69
61
|
}
|
|
70
|
-
function
|
|
71
|
-
const n = t.startsWith(
|
|
62
|
+
function Z(t, e, o = []) {
|
|
63
|
+
const n = t.startsWith(f) ? R(S(p(t))) : t, s = n !== t && !o.includes(n) ? n : t, i = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[s]);
|
|
72
64
|
return {
|
|
73
65
|
cellPadding: e.cellPadding,
|
|
74
66
|
cardBackgroundColor: e.cardBackgroundColor,
|
|
75
|
-
cellBackgroundColor:
|
|
76
|
-
cellAlignment:
|
|
77
|
-
cellClasses:
|
|
78
|
-
omnibusText:
|
|
79
|
-
styleTemplate:
|
|
67
|
+
cellBackgroundColor: i(e.cellBackgroundColors),
|
|
68
|
+
cellAlignment: i(e.cellAlignments),
|
|
69
|
+
cellClasses: i(e.cellClasses),
|
|
70
|
+
omnibusText: i(e.omnibusTexts),
|
|
71
|
+
styleTemplate: i(e.styleTemplates)
|
|
80
72
|
};
|
|
81
73
|
}
|
|
82
|
-
const
|
|
74
|
+
const tt = {
|
|
83
75
|
TITLE: "You May Also Like!"
|
|
84
|
-
},
|
|
76
|
+
}, et = [
|
|
77
|
+
m,
|
|
78
|
+
T,
|
|
85
79
|
b,
|
|
86
80
|
_,
|
|
87
|
-
a,
|
|
88
|
-
l,
|
|
89
81
|
C,
|
|
90
82
|
A,
|
|
91
|
-
|
|
92
|
-
],
|
|
93
|
-
[
|
|
83
|
+
y
|
|
84
|
+
], ot = {
|
|
85
|
+
[m]: !0,
|
|
86
|
+
[T]: !0,
|
|
94
87
|
[_]: !0,
|
|
95
|
-
[
|
|
96
|
-
[a]: !0,
|
|
88
|
+
[b]: !0,
|
|
97
89
|
[C]: !1,
|
|
98
90
|
[A]: !1,
|
|
99
|
-
[
|
|
91
|
+
[y]: !0
|
|
100
92
|
}, W = 10;
|
|
101
|
-
function
|
|
93
|
+
function nt(t = W) {
|
|
102
94
|
return `
|
|
103
95
|
<tr>
|
|
104
96
|
<td class="spacer" style="height: ${t}px;"></td>
|
|
@@ -108,9 +100,9 @@ function rt(t = W) {
|
|
|
108
100
|
function H(t, e) {
|
|
109
101
|
return e ? e.pStyle ?? "" : t;
|
|
110
102
|
}
|
|
111
|
-
function
|
|
112
|
-
const n = H(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags,
|
|
113
|
-
return `<p contenteditable="false" style="${n}">${c}${t}${
|
|
103
|
+
function rt(t, e, o) {
|
|
104
|
+
const n = H(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, s = o ? o.closeTags ?? "" : e.closeTags;
|
|
105
|
+
return `<p contenteditable="false" style="${n}">${c}${t}${s}</p>`;
|
|
114
106
|
}
|
|
115
107
|
function st(t, e) {
|
|
116
108
|
const o = [];
|
|
@@ -119,30 +111,30 @@ function st(t, e) {
|
|
|
119
111
|
function V(t) {
|
|
120
112
|
return t ? ` background-color: ${t};` : "";
|
|
121
113
|
}
|
|
122
|
-
function
|
|
114
|
+
function it(t) {
|
|
123
115
|
const e = V(t);
|
|
124
116
|
return e ? ` style="${e.trim()}"` : "";
|
|
125
117
|
}
|
|
126
|
-
function
|
|
118
|
+
function ct(t, e = "") {
|
|
127
119
|
return {
|
|
128
120
|
before: (t == null ? void 0 : t.before) ?? e,
|
|
129
121
|
after: (t == null ? void 0 : t.after) ?? ""
|
|
130
122
|
};
|
|
131
123
|
}
|
|
132
|
-
function
|
|
124
|
+
function lt(t, e) {
|
|
133
125
|
return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
|
|
134
126
|
}
|
|
135
|
-
function
|
|
127
|
+
function at(t) {
|
|
136
128
|
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
137
129
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
130
|
+
const ut = "display: block; max-width: 100%; height: auto;", dt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", gt = "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;", P = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
131
|
+
function ft(t) {
|
|
132
|
+
return !t || typeof t != "string" || t.trim() === "" ? P : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
141
133
|
}
|
|
142
134
|
function Y(t) {
|
|
143
135
|
return {
|
|
144
136
|
name: "Product Name",
|
|
145
|
-
image_url:
|
|
137
|
+
image_url: P,
|
|
146
138
|
price: { USD: 18 },
|
|
147
139
|
original_price: { USD: 20 },
|
|
148
140
|
discount: { USD: 2 },
|
|
@@ -154,20 +146,20 @@ function Y(t) {
|
|
|
154
146
|
category: []
|
|
155
147
|
};
|
|
156
148
|
}
|
|
157
|
-
function
|
|
149
|
+
function mt(t = 6) {
|
|
158
150
|
return Array.from(
|
|
159
151
|
{ length: t },
|
|
160
152
|
(e, o) => Y(String(o + 1))
|
|
161
153
|
);
|
|
162
154
|
}
|
|
163
|
-
function
|
|
155
|
+
function Tt(t = "grid", e) {
|
|
164
156
|
const o = t === "list" ? `
|
|
165
|
-
data-layout="list"` : "", n = e ? ` ${e}` : "",
|
|
157
|
+
data-layout="list"` : "", n = e ? ` ${e}` : "", s = `recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`, i = t === "list" ? "" : `
|
|
166
158
|
{-{-MOBILE_PRODUCT_ROWS-}-}`, r = t === "list" ? ' style="display: none;"' : "";
|
|
167
159
|
return `
|
|
168
160
|
<td
|
|
169
161
|
align="left"
|
|
170
|
-
class="${
|
|
162
|
+
class="${s}"${o}>
|
|
171
163
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
172
164
|
<tr>
|
|
173
165
|
<td align="center">
|
|
@@ -203,7 +195,7 @@ function bt(t = "grid", e) {
|
|
|
203
195
|
cellspacing="0"
|
|
204
196
|
border="0"
|
|
205
197
|
style="display: none;"
|
|
206
|
-
>${
|
|
198
|
+
>${i}
|
|
207
199
|
</table>
|
|
208
200
|
</td>
|
|
209
201
|
</tr>
|
|
@@ -216,36 +208,35 @@ function bt(t = "grid", e) {
|
|
|
216
208
|
`;
|
|
217
209
|
}
|
|
218
210
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
211
|
+
v as CUSTOM_CELL_HTML,
|
|
212
|
+
tt as DEFAULTS,
|
|
213
|
+
gt as DEFAULT_BUTTON_ANCHOR_STYLE,
|
|
214
|
+
dt as DEFAULT_BUTTON_BORDER_STYLE,
|
|
215
|
+
et as DEFAULT_CARD_COMPOSITION,
|
|
216
|
+
ot as DEFAULT_CARD_VISIBILITY,
|
|
217
|
+
ut as DEFAULT_IMG_STYLE,
|
|
226
218
|
W as DEFAULT_ROW_SPACING_PX,
|
|
227
|
-
|
|
219
|
+
P as PLACEHOLDER_IMAGE,
|
|
228
220
|
V as bgColorFragment,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
221
|
+
Z as buildCellOptions,
|
|
222
|
+
Q as buildElementRenderer,
|
|
223
|
+
nt as buildSpacer,
|
|
224
|
+
it as cellBgStyleAttr,
|
|
225
|
+
Tt as createBlockTemplate,
|
|
226
|
+
g as formatProductPrice,
|
|
227
|
+
N as getCurrentCurrencyConfig,
|
|
228
|
+
mt as getDefaultProducts,
|
|
229
|
+
F as isDefaultAttribute,
|
|
238
230
|
q as isSamePrice,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
lt as resolveOmnibusText,
|
|
231
|
+
lt as renderButtonLabel,
|
|
232
|
+
rt as renderStyledParagraph,
|
|
233
|
+
at as resolveButtonBorderClass,
|
|
234
|
+
ct as resolveOmnibusText,
|
|
244
235
|
H as resolvePStyle,
|
|
245
|
-
|
|
236
|
+
M as resolveProductAttrValue,
|
|
246
237
|
st as resolveSegmentBgStyle,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
238
|
+
ft as sanitizeImageUrl,
|
|
239
|
+
J as toCustomCompositionKey,
|
|
240
|
+
w as toDisplayName,
|
|
241
|
+
x as toDisplayableAttributeValue
|
|
251
242
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ATTR_PRODUCT_PRICE as n, ATTR_PRODUCT_OLD_PRICE as e } from "../constants/selectors.js";
|
|
2
|
+
function d(i) {
|
|
3
|
+
const o = i.indexOf(n), t = i.indexOf(e), r = t !== -1 && (o === -1 || t < o);
|
|
4
|
+
return {
|
|
5
|
+
originalFirst: r,
|
|
6
|
+
anchor: r ? e : n,
|
|
7
|
+
skip: r ? n : e
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
d as resolveInlinePriceOrder
|
|
12
|
+
};
|
|
@@ -3,9 +3,10 @@ function r(e) {
|
|
|
3
3
|
return e;
|
|
4
4
|
switch (e) {
|
|
5
5
|
case "viewedTogether":
|
|
6
|
-
return "similarViewed";
|
|
7
6
|
case "purchasedTogether":
|
|
8
|
-
|
|
7
|
+
case "similarViewed":
|
|
8
|
+
case "similarBought":
|
|
9
|
+
return "mostPopular";
|
|
9
10
|
case "trending":
|
|
10
11
|
return "trendingProducts";
|
|
11
12
|
case "mostValuable":
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var i = (l, a, e) => a in l ? c(l, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[a] = e;
|
|
3
|
+
var T = (l, a, e) => i(l, typeof a != "symbol" ? a + "" : a, e);
|
|
4
4
|
import { Control as I, UIElementType as n, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
class _ extends I {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// Set until the control handles the node Stripo hands a freshly rendered panel.
|
|
11
|
-
i(this, "isAwaitingPanelNode", !1);
|
|
8
|
+
T(this, "currentNode");
|
|
9
|
+
T(this, "lastBlockInstanceId", null);
|
|
12
10
|
}
|
|
13
11
|
getContainer() {
|
|
14
12
|
var e;
|
|
@@ -20,11 +18,6 @@ class _ extends I {
|
|
|
20
18
|
onDestroy() {
|
|
21
19
|
this.lastBlockInstanceId = null;
|
|
22
20
|
}
|
|
23
|
-
// Stripo renders a panel before it hands that panel its node, so a node still held is the last
|
|
24
|
-
// panel's and may be disposed. Controls Stripo renders call this first in onRender.
|
|
25
|
-
forgetLastPanelNode() {
|
|
26
|
-
this.currentNode = void 0, this.isAwaitingPanelNode = !0;
|
|
27
|
-
}
|
|
28
21
|
/**
|
|
29
22
|
* Gets the Items block container element from the current node.
|
|
30
23
|
* @returns The container element or null if not found
|
|
@@ -51,18 +44,18 @@ class _ extends I {
|
|
|
51
44
|
* @returns true if block instance changed, false otherwise
|
|
52
45
|
*/
|
|
53
46
|
handleBlockInstanceChange(e) {
|
|
54
|
-
const t = this.getBlockInstanceId()
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
57
|
-
const
|
|
58
|
-
return e(),
|
|
47
|
+
const t = this.getBlockInstanceId();
|
|
48
|
+
if (!t)
|
|
49
|
+
return !1;
|
|
50
|
+
const E = t !== this.lastBlockInstanceId;
|
|
51
|
+
return e(), E && (this.lastBlockInstanceId = t), E;
|
|
59
52
|
}
|
|
60
|
-
_GuLabel({ text: e, name: t = "", hint:
|
|
53
|
+
_GuLabel({ text: e, name: t = "", hint: E }) {
|
|
61
54
|
return `
|
|
62
55
|
<${n.LABEL}
|
|
63
56
|
${$.LABEL.text}="${e}"
|
|
64
57
|
${$.LABEL.name}="${t || `${e} Label`}"
|
|
65
|
-
${
|
|
58
|
+
${E ? `${$.LABEL.hint}="${E}"` : ""}>
|
|
66
59
|
</${n.LABEL}>
|
|
67
60
|
`;
|
|
68
61
|
}
|
|
@@ -80,7 +73,7 @@ class _ extends I {
|
|
|
80
73
|
* Use in getTemplate() — the icon is registered in a hidden store so Stripo initializes it.
|
|
81
74
|
* Pair with _setInfoMessageValue() in onRender() to set the text content.
|
|
82
75
|
*/
|
|
83
|
-
_GuOnPageMessage({ name: e, icon: t = "not-found", type:
|
|
76
|
+
_GuOnPageMessage({ name: e, icon: t = "not-found", type: E = "info" }) {
|
|
84
77
|
return `
|
|
85
78
|
<div data-info-message="${e}" style="display: none; padding: 16px 16px 0;">
|
|
86
79
|
<div class="icon-store" style="display: none;">
|
|
@@ -88,7 +81,7 @@ class _ extends I {
|
|
|
88
81
|
${this._GuIcon({ src: t, className: "icon" })}
|
|
89
82
|
</div>
|
|
90
83
|
</div>
|
|
91
|
-
${this._GuMessage({ name: e, type:
|
|
84
|
+
${this._GuMessage({ name: e, type: E })}
|
|
92
85
|
</div>
|
|
93
86
|
`;
|
|
94
87
|
}
|
|
@@ -98,21 +91,21 @@ class _ extends I {
|
|
|
98
91
|
* and combines it with the text in Stripo's alert-message layout.
|
|
99
92
|
*/
|
|
100
93
|
_setInfoMessageValue(e, t) {
|
|
101
|
-
const
|
|
94
|
+
const E = this.getContainer(), o = E.querySelector(`[data-icon-key="${e}"]`), r = o == null ? void 0 : o.querySelector("ue-icon-component"), s = (r == null ? void 0 : r.outerHTML) ?? "";
|
|
102
95
|
this.api.setUIEAttribute(
|
|
103
96
|
e,
|
|
104
97
|
"value",
|
|
105
98
|
`
|
|
106
99
|
<div class="service-element alert-message-main" style="align-items: start;">
|
|
107
|
-
${
|
|
100
|
+
${s}
|
|
108
101
|
<div class="service-element alert-message-text">
|
|
109
102
|
${t}
|
|
110
103
|
</div>
|
|
111
104
|
</div>
|
|
112
105
|
`
|
|
113
106
|
);
|
|
114
|
-
const
|
|
115
|
-
|
|
107
|
+
const u = E.querySelector(`[data-info-message="${e}"]`);
|
|
108
|
+
u && (u.style.display = "");
|
|
116
109
|
}
|
|
117
110
|
_GuToggle(e) {
|
|
118
111
|
return `
|
|
@@ -131,66 +124,66 @@ class _ extends I {
|
|
|
131
124
|
_GuSelect({
|
|
132
125
|
name: e,
|
|
133
126
|
placeholder: t,
|
|
134
|
-
options:
|
|
135
|
-
className:
|
|
136
|
-
searchable:
|
|
127
|
+
options: E,
|
|
128
|
+
className: o = "es-180w",
|
|
129
|
+
searchable: r = !1
|
|
137
130
|
}) {
|
|
138
131
|
return `
|
|
139
132
|
<${n.SELECTPICKER}
|
|
140
|
-
class="${
|
|
133
|
+
class="${o}"
|
|
141
134
|
${$.SELECTPICKER.name}="${e}"
|
|
142
|
-
${
|
|
135
|
+
${r ? `${$.SELECTPICKER.searchable}="true"` : ""}
|
|
143
136
|
${$.SELECTPICKER.placeholder}="${t}">
|
|
144
|
-
${
|
|
137
|
+
${E.map((s) => this._GuSelectItem(s)).join("")}
|
|
145
138
|
</${n.SELECTPICKER}>
|
|
146
139
|
`;
|
|
147
140
|
}
|
|
148
|
-
_GuTextInput({ name: e, placeholder: t, className:
|
|
141
|
+
_GuTextInput({ name: e, placeholder: t, className: E = "", disabled: o = !1 }) {
|
|
149
142
|
return `
|
|
150
143
|
<${n.TEXT}
|
|
151
|
-
class=${
|
|
144
|
+
class=${E}
|
|
152
145
|
${$.TEXT.name}="${e}"
|
|
153
146
|
placeholder="${t || e}"
|
|
154
|
-
${
|
|
147
|
+
${o ? `${$.TEXT.disabled}="true"` : ""}>
|
|
155
148
|
</${n.TEXT}>
|
|
156
149
|
`;
|
|
157
150
|
}
|
|
158
|
-
_GuCounter({ name: e, maxValue: t, minValue:
|
|
151
|
+
_GuCounter({ name: e, maxValue: t, minValue: E = 1, step: o = 1 }) {
|
|
159
152
|
return `
|
|
160
153
|
<${n.COUNTER}
|
|
161
154
|
${$.COUNTER.name}="${e}"
|
|
162
|
-
${$.COUNTER.minValue}="${
|
|
155
|
+
${$.COUNTER.minValue}="${E}"
|
|
163
156
|
${$.COUNTER.maxValue}="${t}"
|
|
164
|
-
${$.COUNTER.step}="${
|
|
157
|
+
${$.COUNTER.step}="${o}">
|
|
165
158
|
</${n.COUNTER}>
|
|
166
159
|
`;
|
|
167
160
|
}
|
|
168
|
-
_GuRadioButtonItem({ text: e, value: t, icon:
|
|
161
|
+
_GuRadioButtonItem({ text: e, value: t, icon: E }) {
|
|
169
162
|
return `
|
|
170
163
|
<${n.RADIO_ITEM}
|
|
171
164
|
${$.RADIO_ITEM.value}="${t}"
|
|
172
165
|
${e ? `${$.RADIO_ITEM.text}="${e}"` : ""}
|
|
173
|
-
${
|
|
166
|
+
${E ? `${$.RADIO_ITEM.icon}="${E}"` : ""}>
|
|
174
167
|
</${n.RADIO_ITEM}>
|
|
175
168
|
`;
|
|
176
169
|
}
|
|
177
|
-
_GuRadioButton({ name: e, buttons: t, id:
|
|
170
|
+
_GuRadioButton({ name: e, buttons: t, id: E = "" }) {
|
|
178
171
|
return `
|
|
179
172
|
<${n.RADIO_BUTTONS}
|
|
180
|
-
${
|
|
173
|
+
${E ? `id="${E}"` : ""}
|
|
181
174
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
182
|
-
${t.map((
|
|
175
|
+
${t.map((o) => this._GuRadioButtonItem(o)).join("")}
|
|
183
176
|
</${n.RADIO_BUTTONS}>
|
|
184
177
|
`;
|
|
185
178
|
}
|
|
186
|
-
_GuButton({ name: e, label: t, id:
|
|
179
|
+
_GuButton({ name: e, label: t, id: E = "", className: o = "", icon: r = "", disabled: s = !1 }) {
|
|
187
180
|
return `
|
|
188
181
|
<${n.BUTTON}
|
|
189
182
|
${$.BUTTON.name}="${e}"
|
|
190
|
-
${
|
|
191
|
-
${
|
|
192
|
-
${
|
|
193
|
-
${
|
|
183
|
+
${E ? `id="${E}"` : ""}
|
|
184
|
+
${o ? `class="${o}"` : ""}
|
|
185
|
+
${r ? `${$.BUTTON.icon}="${r}"` : ""}
|
|
186
|
+
${s ? `${$.BUTTON.disabled}="true"` : ""}
|
|
194
187
|
${$.BUTTON.caption}="${t}">
|
|
195
188
|
</${n.BUTTON}>
|
|
196
189
|
`;
|
|
@@ -208,10 +201,10 @@ class _ extends I {
|
|
|
208
201
|
* @param param0
|
|
209
202
|
* @returns It returns a button with an icon.
|
|
210
203
|
*/
|
|
211
|
-
_GuIconButton({ name: e, icon: t, className:
|
|
204
|
+
_GuIconButton({ name: e, icon: t, className: E = "" }) {
|
|
212
205
|
return `
|
|
213
206
|
<${n.BUTTON}
|
|
214
|
-
class="${
|
|
207
|
+
class="${E}"
|
|
215
208
|
${$.BUTTON.name}="${e}"
|
|
216
209
|
${$.BUTTON.icon}="${t}">
|
|
217
210
|
</${n.BUTTON}>
|
|
@@ -239,19 +232,19 @@ class _ extends I {
|
|
|
239
232
|
* @returns HTML string for the orderable control
|
|
240
233
|
*/
|
|
241
234
|
_GuOrderable(e, t) {
|
|
242
|
-
let
|
|
243
|
-
t.forEach((
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
<${n.ORDERABLE_ITEM} ${
|
|
247
|
-
${
|
|
235
|
+
let E = "";
|
|
236
|
+
t.forEach((r) => {
|
|
237
|
+
const s = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
238
|
+
E += `
|
|
239
|
+
<${n.ORDERABLE_ITEM} ${s}="${r.key}">
|
|
240
|
+
${r.content}
|
|
248
241
|
</${n.ORDERABLE_ITEM}>
|
|
249
242
|
`;
|
|
250
243
|
});
|
|
251
|
-
const
|
|
244
|
+
const o = $.ORDERABLE && "name" in $.ORDERABLE ? $.ORDERABLE.name : "name";
|
|
252
245
|
return `
|
|
253
|
-
<${n.ORDERABLE} ${
|
|
254
|
-
${
|
|
246
|
+
<${n.ORDERABLE} ${o}="${e}">
|
|
247
|
+
${E}
|
|
255
248
|
</${n.ORDERABLE}>
|
|
256
249
|
`;
|
|
257
250
|
}
|
|
@@ -292,16 +285,16 @@ class _ extends I {
|
|
|
292
285
|
`;
|
|
293
286
|
}
|
|
294
287
|
_GuRadioButtons(e, t) {
|
|
295
|
-
const
|
|
288
|
+
const E = t.map((o) => `
|
|
296
289
|
<${n.RADIO_ITEM}
|
|
297
|
-
${$.RADIO_ITEM.text}="${
|
|
298
|
-
${$.RADIO_ITEM.value}="${
|
|
290
|
+
${$.RADIO_ITEM.text}="${o.text}"
|
|
291
|
+
${$.RADIO_ITEM.value}="${o.value}">
|
|
299
292
|
</${n.RADIO_ITEM}>
|
|
300
293
|
`).join("");
|
|
301
294
|
return `
|
|
302
295
|
<${n.RADIO_BUTTONS}
|
|
303
296
|
${$.RADIO_BUTTONS.name}="${e}">
|
|
304
|
-
${
|
|
297
|
+
${E}
|
|
305
298
|
</${n.RADIO_BUTTONS}>
|
|
306
299
|
`;
|
|
307
300
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { type LegacyVariable, type MappedComposition } from './types';
|
|
2
|
-
export declare function mapComposition(variables: LegacyVariable[] | undefined
|
|
2
|
+
export declare function mapComposition(variables: LegacyVariable[] | undefined, { oldPriceFirst }?: {
|
|
3
|
+
oldPriceFirst?: boolean;
|
|
4
|
+
}): MappedComposition;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LegacyVariable } from './types';
|
|
1
2
|
export declare function extractTitleText(block: Element): string;
|
|
2
3
|
/**
|
|
3
4
|
* Fallback for legacy configs that carry no `p_recommendation_title` variable:
|
|
@@ -7,6 +8,31 @@ export declare function extractTitleText(block: Element): string;
|
|
|
7
8
|
* @returns True when the legacy block renders a visible title
|
|
8
9
|
*/
|
|
9
10
|
export declare function hasVisibleTitle(block: Element): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* A rendered title container with no text showed the user no title, whatever the config's `hidden` flag says.
|
|
13
|
+
* @param block - The legacy recommendation block element
|
|
14
|
+
* @returns True when the legacy block renders an empty title container
|
|
15
|
+
*/
|
|
16
|
+
export declare function hasEmptyTitle(block: Element): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Reads which price the legacy card renders first. Prices sharing a `positionIdx` are ordered by this.
|
|
19
|
+
* @param block - The legacy recommendation block element
|
|
20
|
+
* @returns True only when both prices render and the original price comes first
|
|
21
|
+
*/
|
|
22
|
+
export declare function isOldPriceFirst(block: Element): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Reads the legacy "Move to next line" state from the rendered card, for blocks whose config does not carry it.
|
|
25
|
+
* @param block - The legacy recommendation block element
|
|
26
|
+
* @returns True only when both prices render in separate rows and neither row is laid out inline (`table-cell`)
|
|
27
|
+
*/
|
|
28
|
+
export declare function isPriceOnNextLine(block: Element): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Legacy keeps the text color and the name's trim toggle in the rendered `<p>`, not in the config theme.
|
|
31
|
+
* @param variables - The legacy composition variables
|
|
32
|
+
* @param block - The legacy recommendation block element
|
|
33
|
+
* @returns The variables, with `textColor` / `textTrimming` filled from the rendered HTML where the theme lacks them
|
|
34
|
+
*/
|
|
35
|
+
export declare function withRenderedTextTheme(variables: LegacyVariable[] | undefined, block: Element): LegacyVariable[] | undefined;
|
|
10
36
|
/**
|
|
11
37
|
* Card background lives on either the block (`bgcolor`/`style`) or per-card
|
|
12
38
|
* cells (`.product-card`). Returns empty string when no background is set —
|
|
@@ -65,6 +65,7 @@ export declare class RecommendationBlock extends Block {
|
|
|
65
65
|
*/
|
|
66
66
|
onDelete(node: ImmutableHtmlNode): void;
|
|
67
67
|
private _ensureMobileFitRule;
|
|
68
|
+
private _ensureTextTrimCss;
|
|
68
69
|
private _syncHeightBound;
|
|
69
70
|
/**
|
|
70
71
|
* Warns (dark advisory toaster) when the design holds more than one live
|