@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.1e8f93e
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 +41 -60
- 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 +84 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +80 -82
- 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/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -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
|
*/
|
|
@@ -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
|
*/
|
|
@@ -43,15 +43,6 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
43
43
|
*/
|
|
44
44
|
private _tryReorderInPlace;
|
|
45
45
|
private _createBuiltInItemHtml;
|
|
46
|
-
/**
|
|
47
|
-
* Inline mode: the merged "Product Prices" group item. It moves as a unit in
|
|
48
|
-
* the main list (both keys stay adjacent) and contains a nested 2-item drag
|
|
49
|
-
* to reorder Product Price ↔ Product Original Price — which flips the inline
|
|
50
|
-
* render order via `resolveInlinePriceOrder`. The group keeps a single
|
|
51
|
-
* visibility toggle (`data-action-for="productPrice"`). Nested sub-items use a
|
|
52
|
-
* plain drag handle (no UE button → untouched by the reorder-icon rescue).
|
|
53
|
-
*/
|
|
54
|
-
private _createPriceGroupItemHtml;
|
|
55
46
|
private _createCustomItemHtml;
|
|
56
47
|
/**
|
|
57
48
|
* Builds select options from the store's filterList.
|
|
@@ -107,23 +98,7 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
107
98
|
*/
|
|
108
99
|
private _rescueReorderIconsToStore;
|
|
109
100
|
private _setupEventListeners;
|
|
110
|
-
/**
|
|
111
|
-
* Builds the composition key order from the orderable list, expanding the
|
|
112
|
-
* inline "Product Prices" group into its two sub-keys (in nested DOM order)
|
|
113
|
-
* so both price keys stay adjacent and in the user-chosen order.
|
|
114
|
-
*/
|
|
115
|
-
private _extractCompositionOrder;
|
|
116
101
|
private _setupDragAndDrop;
|
|
117
|
-
/**
|
|
118
|
-
* Wires drag/drop reordering for one item level on the shared list. Both the
|
|
119
|
-
* top-level items and the nested price sub-items use this; they never fight
|
|
120
|
-
* because each only sets its `dragged` ref when its own `itemSelector` matches
|
|
121
|
-
* at dragstart (and the top-level one additionally ignores drags originating
|
|
122
|
-
* inside `ignoreSelector`). Every drop re-reads the full composition via
|
|
123
|
-
* `_extractCompositionOrder`, so both levels commit through `_onReorder`
|
|
124
|
-
* identically.
|
|
125
|
-
*/
|
|
126
|
-
private _registerDragHandlers;
|
|
127
102
|
private _setupDeleteHandler;
|
|
128
103
|
private _onAddAttribute;
|
|
129
104
|
/**
|
|
@@ -180,10 +155,9 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
180
155
|
private _extractSegmentBgFromCard;
|
|
181
156
|
private _getControlContainer;
|
|
182
157
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* disabled state.)
|
|
158
|
+
* Adds/removes orderable-disabled class based on layout orientation.
|
|
159
|
+
* List layout hides drag handles via CSS and disables draggable attribute
|
|
160
|
+
* to prevent native browser drag-and-drop from working without the handle.
|
|
187
161
|
*/
|
|
188
162
|
private _updateOrderableState;
|
|
189
163
|
/**
|
|
@@ -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,4 +1,3 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
2
1
|
import { type ElementRenderer } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* Grid element renderer
|
|
@@ -25,19 +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): string;
|
|
39
|
-
/**
|
|
40
|
-
* Standalone (stacked) original-price cell.
|
|
41
|
-
*/
|
|
42
|
-
export declare function renderGridOldPriceCell(product: RecommendationProduct): string;
|
|
43
27
|
export declare const gridElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type ElementRenderer
|
|
2
|
+
import { type ElementRenderer } 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 } from '../utils';
|
|
|
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
|
|
12
|
+
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse): 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
|
|
22
|
+
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse): 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
|
|
31
|
+
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse): 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;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
2
1
|
import { type ElementRenderer } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* List element renderer
|
|
@@ -6,16 +5,4 @@ import { type ElementRenderer } from '../utils';
|
|
|
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
|
-
* Standalone (stacked) original-price info row.
|
|
11
|
-
*/
|
|
12
|
-
export declare function renderListOldPriceRow(product: RecommendationProduct): string;
|
|
13
|
-
/**
|
|
14
|
-
* Inline price info row used when "Move to next line" is OFF: the sale price and
|
|
15
|
-
* original price sit in two cells of one row. Each keeps its block id + class so
|
|
16
|
-
* style controls and the compiler keep working. `originalFirst` preserves the
|
|
17
|
-
* card-composition order (original before sale by default) so it matches the
|
|
18
|
-
* stacked order.
|
|
19
|
-
*/
|
|
20
|
-
export declare function renderInlineListPriceRow(product: RecommendationProduct, originalFirst?: boolean): string;
|
|
21
8
|
export declare const listElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type PricePlacementFlags } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* Generates a list product card with 3-column layout
|
|
5
4
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -12,7 +11,7 @@ import { type PricePlacementFlags } from '../utils';
|
|
|
12
11
|
* @param composition - Array defining order of card elements
|
|
13
12
|
* @returns HTML string for a single product card row
|
|
14
13
|
*/
|
|
15
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse
|
|
14
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse): string;
|
|
16
15
|
/**
|
|
17
16
|
* Prepares list product rows
|
|
18
17
|
* Each product is a full-width row with 3-column layout
|
|
@@ -20,6 +19,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
20
19
|
* @param composition - Array defining order of card elements
|
|
21
20
|
* @returns HTML string for product rows
|
|
22
21
|
*/
|
|
23
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse
|
|
22
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse): string;
|
|
24
23
|
export declare function getDefaultTemplate(): string;
|
|
25
24
|
export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
|