@useinsider/guido 3.6.0-beta.4f2bf14 → 3.6.0-beta.596b70e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/useRecommendation.js +34 -33
- package/dist/composables/useStripoEventHandler.js +11 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +50 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +24 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +310 -338
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +117 -146
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +49 -30
- package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +110 -83
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +90 -54
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +139 -0
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +20 -16
- package/dist/extensions/Blocks/controlFactories.js +159 -133
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +127 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +44 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +20 -9
- package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
- package/package.json +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- /package/dist/src/{composables/useStripoEventHandler.test.d.ts → extensions/Blocks/Recommendation/templates/grid/elementRenderer.test.d.ts} +0 -0
|
@@ -2,12 +2,13 @@ import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-edito
|
|
|
2
2
|
import { RecommendationBlock as m } from "./block.js";
|
|
3
3
|
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
4
4
|
import "./store/recommendation.js";
|
|
5
|
+
import "./utils/captureStyleTemplates.js";
|
|
5
6
|
import { NameControls as i } from "./controls/name/index.js";
|
|
6
7
|
import { PriceControls as e } from "./controls/price/index.js";
|
|
7
8
|
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
8
9
|
import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
|
|
9
|
-
import { OmnibusDiscountControls as
|
|
10
|
-
import { ButtonControls as
|
|
10
|
+
import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
|
|
11
|
+
import { ButtonControls as a } from "./controls/button/index.js";
|
|
11
12
|
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
13
|
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
13
14
|
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
@@ -22,8 +23,8 @@ const b = [
|
|
|
22
23
|
e,
|
|
23
24
|
s,
|
|
24
25
|
l,
|
|
25
|
-
a,
|
|
26
26
|
p,
|
|
27
|
+
a,
|
|
27
28
|
c,
|
|
28
29
|
C
|
|
29
30
|
], P = [
|
|
@@ -35,10 +36,10 @@ const b = [
|
|
|
35
36
|
], S = [
|
|
36
37
|
...P,
|
|
37
38
|
...b.flatMap((o) => Object.values(o))
|
|
38
|
-
],
|
|
39
|
+
], L = S.reduce(
|
|
39
40
|
(o, t) => o.addControl(t),
|
|
40
41
|
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
42
|
).addStyles(y).withIconsRegistry(R).build();
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
L as default
|
|
44
45
|
};
|
|
@@ -4,6 +4,7 @@ import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
6
6
|
import "./store/recommendation.js";
|
|
7
|
+
import "./utils/captureStyleTemplates.js";
|
|
7
8
|
import "./controls/name/index.js";
|
|
8
9
|
import "./controls/price/index.js";
|
|
9
10
|
import "./controls/oldPrice/index.js";
|
|
@@ -15,7 +16,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
|
15
16
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
16
17
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
17
18
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
18
|
-
class
|
|
19
|
+
class a extends E {
|
|
19
20
|
registerBlockControls(I) {
|
|
20
21
|
I[U] = [
|
|
21
22
|
new _(
|
|
@@ -194,5 +195,5 @@ class Z extends E {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
export {
|
|
197
|
-
|
|
198
|
+
a as SettingsPanel
|
|
198
199
|
};
|
|
@@ -6,8 +6,9 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
10
|
+
import { isFilterValid as w } from "../validation/filterSchema.js";
|
|
11
|
+
import { isConfigValid as N } from "../validation/requiredFields.js";
|
|
11
12
|
const h = y();
|
|
12
13
|
let m = null, u = null, d = null;
|
|
13
14
|
function I() {
|
|
@@ -49,7 +50,7 @@ function k() {
|
|
|
49
50
|
filterSnapshot: null
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
+
const x = () => ({
|
|
53
54
|
recommendationCampaignUrls: {},
|
|
54
55
|
activePredictiveAlgorithms: [],
|
|
55
56
|
languages: {},
|
|
@@ -58,8 +59,8 @@ const N = () => ({
|
|
|
58
59
|
blockStates: {},
|
|
59
60
|
currentRecommendationId: null,
|
|
60
61
|
configVersion: 0
|
|
61
|
-
}),
|
|
62
|
-
state: () =>
|
|
62
|
+
}), T = P("guidoRecommendationExtension", {
|
|
63
|
+
state: () => x(),
|
|
63
64
|
getters: {
|
|
64
65
|
// ====================================================================
|
|
65
66
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -378,7 +379,7 @@ const N = () => ({
|
|
|
378
379
|
const n = [...e.recommendationConfigs.filters];
|
|
379
380
|
n[r] = {
|
|
380
381
|
...t,
|
|
381
|
-
isValid:
|
|
382
|
+
isValid: w(t)
|
|
382
383
|
}, e.recommendationConfigs.filters = n;
|
|
383
384
|
}
|
|
384
385
|
},
|
|
@@ -424,7 +425,7 @@ const N = () => ({
|
|
|
424
425
|
* every block's recommendationConfigs across user edits.
|
|
425
426
|
*/
|
|
426
427
|
hasInvalidBlock() {
|
|
427
|
-
return Object.values(this.blockStates).some((t) => !
|
|
428
|
+
return Object.values(this.blockStates).some((t) => !N(t.recommendationConfigs, this));
|
|
428
429
|
},
|
|
429
430
|
// ====================================================================
|
|
430
431
|
// Per-Block Product Fetching
|
|
@@ -453,7 +454,10 @@ const N = () => ({
|
|
|
453
454
|
details: !0,
|
|
454
455
|
campaignId: o.variationId
|
|
455
456
|
};
|
|
456
|
-
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0)
|
|
457
|
+
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
458
|
+
a,
|
|
459
|
+
v(o.partnerName, r.strategy)
|
|
460
|
+
);
|
|
457
461
|
let f;
|
|
458
462
|
try {
|
|
459
463
|
f = await h.fetchRecommendationProducts(i, a);
|
|
@@ -471,5 +475,5 @@ const N = () => ({
|
|
|
471
475
|
}
|
|
472
476
|
});
|
|
473
477
|
export {
|
|
474
|
-
|
|
478
|
+
T as useRecommendationExtensionStore
|
|
475
479
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { formatPrice as
|
|
5
|
-
import { CUSTOM_CELL_HTML as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const
|
|
1
|
+
import { RecommendationBlockId as c } from "../../constants/blockIds.js";
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as x, ATTR_PRODUCT_BUTTON as B, CSS_CLASS_RECO_BUTTON as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as k, ATTR_PRODUCT_OMNIBUS_PRICE as R, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_PRICE as O, ATTR_PRODUCT_NAME as U, ATTR_PRODUCT_IMAGE as A } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
4
|
+
import { formatPrice as v } from "../../utils/priceFormatter.js";
|
|
5
|
+
import { CUSTOM_CELL_HTML as I, renderStyledParagraph as u, cellBgStyleAttr as s, DEFAULT_BUTTON_BORDER_STYLE as L, DEFAULT_BUTTON_ANCHOR_STYLE as i, renderButtonLabel as D, resolveButtonBorderClass as N, resolvePStyle as S, DEFAULT_IMG_STYLE as M, sanitizeImageUrl as z, resolveSegmentBgStyle as F } from "../utils.js";
|
|
6
|
+
const d = "0 5px", g = "attribute-cell";
|
|
7
|
+
function n(r, e = "") {
|
|
8
|
+
const l = F(e, r);
|
|
9
|
+
return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
|
|
10
|
+
}
|
|
11
|
+
function P() {
|
|
12
|
+
const r = E(), { currencySettings: e } = r.recommendationConfigs;
|
|
9
13
|
return {
|
|
10
14
|
code: e.value,
|
|
11
15
|
symbol: e.symbol,
|
|
@@ -15,34 +19,31 @@ function g() {
|
|
|
15
19
|
thousandSeparator: e.thousandSeparator
|
|
16
20
|
};
|
|
17
21
|
}
|
|
18
|
-
function
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
price:
|
|
22
|
-
currency:
|
|
22
|
+
function y(r, e = "price") {
|
|
23
|
+
const l = P(), a = r[e], t = (a == null ? void 0 : a[l.code]) ?? Object.values(a ?? {})[0] ?? 0;
|
|
24
|
+
return v({
|
|
25
|
+
price: t,
|
|
26
|
+
currency: l
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
|
-
const
|
|
26
|
-
[
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cellpadding="0"
|
|
33
|
-
cellspacing="0"
|
|
34
|
-
border="0">
|
|
29
|
+
const V = {
|
|
30
|
+
[A]: (r, e) => {
|
|
31
|
+
var t;
|
|
32
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = ((t = e == null ? void 0 : e.styleTemplate) == null ? void 0 : t.imgStyle) ?? M;
|
|
33
|
+
return `
|
|
34
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
|
|
35
|
+
${n(e == null ? void 0 : e.cardBackgroundColor)}
|
|
35
36
|
<tbody>
|
|
36
37
|
<tr valign="top">
|
|
37
38
|
<td
|
|
38
39
|
class="esd-block-image product-image"
|
|
39
40
|
align="center"
|
|
40
|
-
esd-extension-block-id="${
|
|
41
|
-
<a target="_blank" href="${
|
|
41
|
+
esd-extension-block-id="${c.IMAGE}">
|
|
42
|
+
<a target="_blank" href="${r.url}" class="${C}">
|
|
42
43
|
<img
|
|
43
|
-
src="${
|
|
44
|
-
alt="${
|
|
45
|
-
style="
|
|
44
|
+
src="${z(r.image_url)}"
|
|
45
|
+
alt="${r.name}"
|
|
46
|
+
style="${a}"
|
|
46
47
|
class="adapt-img">
|
|
47
48
|
</a>
|
|
48
49
|
</td>
|
|
@@ -50,89 +51,82 @@ const S = {
|
|
|
50
51
|
</tbody>
|
|
51
52
|
</table>
|
|
52
53
|
</td>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
`;
|
|
55
|
+
},
|
|
56
|
+
[U]: (r, e) => {
|
|
57
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = u(
|
|
58
|
+
r.name,
|
|
59
|
+
{ pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
|
|
60
|
+
e == null ? void 0 : e.styleTemplate
|
|
61
|
+
);
|
|
62
|
+
return `
|
|
63
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="middle">
|
|
64
|
+
${n(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
|
|
64
65
|
<tbody>
|
|
65
66
|
<tr valign="top">
|
|
66
67
|
<td
|
|
67
68
|
class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
|
|
68
69
|
align="center"
|
|
69
|
-
esd-extension-block-id="${
|
|
70
|
-
|
|
71
|
-
<strong>${t.name}</strong>
|
|
72
|
-
</p>
|
|
70
|
+
esd-extension-block-id="${c.NAME}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
71
|
+
${a}
|
|
73
72
|
</td>
|
|
74
73
|
</tr>
|
|
75
74
|
</tbody>
|
|
76
75
|
</table>
|
|
77
76
|
</td>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
77
|
+
`;
|
|
78
|
+
},
|
|
79
|
+
[O]: (r, e) => {
|
|
80
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = u(
|
|
81
|
+
y(r, "price"),
|
|
82
|
+
{ pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
|
|
83
|
+
e == null ? void 0 : e.styleTemplate
|
|
84
|
+
);
|
|
85
|
+
return `
|
|
86
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
|
|
87
|
+
${n(e == null ? void 0 : e.cardBackgroundColor)}
|
|
88
88
|
<tbody>
|
|
89
89
|
<tr valign="top">
|
|
90
90
|
<td
|
|
91
91
|
class="esd-block-text product-price es-p15l es-p15r"
|
|
92
92
|
align="center"
|
|
93
|
-
esd-extension-block-id="${
|
|
94
|
-
|
|
95
|
-
<strong>${i(t, "price")}</strong>
|
|
96
|
-
</p>
|
|
93
|
+
esd-extension-block-id="${c.PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
94
|
+
${a}
|
|
97
95
|
</td>
|
|
98
96
|
</tr>
|
|
99
97
|
</tbody>
|
|
100
98
|
</table>
|
|
101
99
|
</td>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
`;
|
|
101
|
+
},
|
|
102
|
+
[h]: (r, e) => {
|
|
103
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = u(
|
|
104
|
+
y(r, "original_price"),
|
|
105
|
+
{ pStyle: "font-size: 14px; color: #999999;", openTags: "<strong>", closeTags: "</strong>" },
|
|
106
|
+
e == null ? void 0 : e.styleTemplate
|
|
107
|
+
);
|
|
108
|
+
return `
|
|
109
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
|
|
110
|
+
${n(e == null ? void 0 : e.cardBackgroundColor)}
|
|
112
111
|
<tbody>
|
|
113
112
|
<tr valign="top">
|
|
114
113
|
<td
|
|
115
114
|
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
116
115
|
align="center"
|
|
117
|
-
esd-extension-block-id="${
|
|
118
|
-
|
|
119
|
-
<strong>${i(t, "original_price")}</strong>
|
|
120
|
-
</p>
|
|
116
|
+
esd-extension-block-id="${c.OLD_PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
117
|
+
${a}
|
|
121
118
|
</td>
|
|
122
119
|
</tr>
|
|
123
120
|
</tbody>
|
|
124
121
|
</table>
|
|
125
122
|
</td>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
cellpadding="0"
|
|
134
|
-
cellspacing="0"
|
|
135
|
-
border="0">
|
|
123
|
+
`;
|
|
124
|
+
},
|
|
125
|
+
[R]: (r, e) => {
|
|
126
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = S("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate);
|
|
127
|
+
return `
|
|
128
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
|
|
129
|
+
${n(e == null ? void 0 : e.cardBackgroundColor)}
|
|
136
130
|
<tbody>
|
|
137
131
|
<tr valign="top">
|
|
138
132
|
<td
|
|
@@ -140,10 +134,10 @@ const S = {
|
|
|
140
134
|
align="center"
|
|
141
135
|
data-text-before="Lowest 30-day price: "
|
|
142
136
|
data-text-after=""
|
|
143
|
-
esd-extension-block-id="${
|
|
144
|
-
<p contenteditable="false" style="
|
|
137
|
+
esd-extension-block-id="${c.OMNIBUS_PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
138
|
+
<p contenteditable="false" style="${a}">
|
|
145
139
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
146
|
-
<span class="omnibus-price-value">${
|
|
140
|
+
<span class="omnibus-price-value">${y(r, "original_price")}</span>
|
|
147
141
|
<span class="omnibus-text-after"></span>
|
|
148
142
|
</p>
|
|
149
143
|
</td>
|
|
@@ -151,19 +145,14 @@ const S = {
|
|
|
151
145
|
</tbody>
|
|
152
146
|
</table>
|
|
153
147
|
</td>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
`;
|
|
149
|
+
},
|
|
150
|
+
[k]: (r, e) => {
|
|
151
|
+
var m, _;
|
|
152
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = S("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), t = P(), b = ((m = r.original_price) == null ? void 0 : m[t.code]) ?? Object.values(r.original_price ?? {})[0] ?? 0, T = ((_ = r.price) == null ? void 0 : _[t.code]) ?? Object.values(r.price ?? {})[0] ?? 0, $ = b > 0 ? Math.round((b - T) / b * 100) : 0, f = $ > 0 ? `-${$}%` : "0%";
|
|
158
153
|
return `
|
|
159
|
-
<td class="${
|
|
160
|
-
|
|
161
|
-
class="product-card-segment"
|
|
162
|
-
width="100%"
|
|
163
|
-
height="100%"
|
|
164
|
-
cellpadding="0"
|
|
165
|
-
cellspacing="0"
|
|
166
|
-
border="0">
|
|
154
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
|
|
155
|
+
${n(e == null ? void 0 : e.cardBackgroundColor)}
|
|
167
156
|
<tbody>
|
|
168
157
|
<tr valign="top">
|
|
169
158
|
<td
|
|
@@ -171,10 +160,10 @@ const S = {
|
|
|
171
160
|
align="center"
|
|
172
161
|
data-text-before=""
|
|
173
162
|
data-text-after=""
|
|
174
|
-
esd-extension-block-id="${
|
|
175
|
-
<p contenteditable="false" style="
|
|
163
|
+
esd-extension-block-id="${c.OMNIBUS_DISCOUNT}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
164
|
+
<p contenteditable="false" style="${a}">
|
|
176
165
|
<span class="omnibus-text-before"></span>
|
|
177
|
-
<span class="omnibus-discount-value">${
|
|
166
|
+
<span class="omnibus-discount-value">${f}</span>
|
|
178
167
|
<span class="omnibus-text-after"></span>
|
|
179
168
|
</p>
|
|
180
169
|
</td>
|
|
@@ -184,43 +173,24 @@ const S = {
|
|
|
184
173
|
</td>
|
|
185
174
|
`;
|
|
186
175
|
},
|
|
187
|
-
[
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
height="100%"
|
|
193
|
-
cellpadding="0"
|
|
194
|
-
cellspacing="0"
|
|
195
|
-
border="0">
|
|
176
|
+
[B]: (r, e) => {
|
|
177
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = e == null ? void 0 : e.styleTemplate, t = (a == null ? void 0 : a.buttonBorderStyle) ?? L, b = (a == null ? void 0 : a.buttonAnchorStyle) ?? i, T = D("Buy", a);
|
|
178
|
+
return `
|
|
179
|
+
<td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
|
|
180
|
+
${n(e == null ? void 0 : e.cardBackgroundColor)}
|
|
196
181
|
<tbody>
|
|
197
182
|
<tr valign="top">
|
|
198
183
|
<td
|
|
199
184
|
class="esd-block-button product-button es-p10t es-p10b"
|
|
200
185
|
align="center"
|
|
201
|
-
esd-extension-block-id="${
|
|
202
|
-
<span
|
|
203
|
-
class="es-button-border"
|
|
204
|
-
style="
|
|
205
|
-
border-width: 1px;
|
|
206
|
-
background: rgb(217, 234, 211);
|
|
207
|
-
border-color: rgb(106, 168, 79);
|
|
208
|
-
">
|
|
186
|
+
esd-extension-block-id="${c.BUTTON}">
|
|
187
|
+
<span class="${N(a)}" style="${t}">
|
|
209
188
|
<a
|
|
210
189
|
href="#"
|
|
211
|
-
class="es-button ${
|
|
190
|
+
class="es-button ${C}"
|
|
212
191
|
target="_blank"
|
|
213
|
-
style="
|
|
214
|
-
|
|
215
|
-
background: rgb(217, 234, 211);
|
|
216
|
-
font-family: arial, 'helvetica neue', helvetica, sans-serif;
|
|
217
|
-
font-size: 16px;
|
|
218
|
-
font-weight: normal;
|
|
219
|
-
line-height: 120%;
|
|
220
|
-
mso-border-alt: 10px solid rgb(217, 234, 211);
|
|
221
|
-
mso-padding-alt: 0;
|
|
222
|
-
">
|
|
223
|
-
Buy
|
|
192
|
+
style="${b}">
|
|
193
|
+
${T}
|
|
224
194
|
</a>
|
|
225
195
|
</span>
|
|
226
196
|
</td>
|
|
@@ -228,7 +198,8 @@ const S = {
|
|
|
228
198
|
</tbody>
|
|
229
199
|
</table>
|
|
230
200
|
</td>
|
|
231
|
-
|
|
201
|
+
`;
|
|
202
|
+
},
|
|
232
203
|
/**
|
|
233
204
|
* Custom attribute cell template — same structure as built-in entries
|
|
234
205
|
* (outer td → inner product-card-segment table).
|
|
@@ -236,33 +207,33 @@ const S = {
|
|
|
236
207
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
237
208
|
* @param content - Display content for the cell
|
|
238
209
|
*/
|
|
239
|
-
[
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
style="table-layout: fixed;">
|
|
210
|
+
[I]: (r, e, l) => {
|
|
211
|
+
const a = (l == null ? void 0 : l.cellPadding) ?? d, t = u(
|
|
212
|
+
e,
|
|
213
|
+
{ pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
|
|
214
|
+
l == null ? void 0 : l.styleTemplate
|
|
215
|
+
);
|
|
216
|
+
return `
|
|
217
|
+
<td class="${g}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
218
|
+
${n(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
|
|
249
219
|
<tbody>
|
|
250
220
|
<tr valign="top">
|
|
251
221
|
<td
|
|
252
|
-
${
|
|
222
|
+
${x}="${r}"
|
|
253
223
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
254
224
|
align="center"
|
|
255
|
-
esd-extension-block-id="${
|
|
256
|
-
|
|
225
|
+
esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"${s(l == null ? void 0 : l.cellBackgroundColor)}>
|
|
226
|
+
${t}
|
|
257
227
|
</td>
|
|
258
228
|
</tr>
|
|
259
229
|
</tbody>
|
|
260
230
|
</table>
|
|
261
231
|
</td>
|
|
262
|
-
|
|
232
|
+
`;
|
|
233
|
+
}
|
|
263
234
|
};
|
|
264
235
|
export {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
236
|
+
g as ATTRIBUTE_CELL_CLASS,
|
|
237
|
+
d as DEFAULT_CELL_PADDING,
|
|
238
|
+
V as gridElementRenderer
|
|
268
239
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { getDefaultProducts as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as b } from "../../constants/layout.js";
|
|
2
|
+
import { getDefaultProducts as w, DEFAULTS as A, createBlockTemplate as f, buildSpacer as C, DEFAULT_CARD_COMPOSITION as D, buildElementRenderer as g, DEFAULT_CARD_VISIBILITY as P } from "../utils.js";
|
|
3
|
+
import { DEFAULT_CELL_PADDING as O, ATTRIBUTE_CELL_CLASS as U, gridElementRenderer as h } from "./elementRenderer.js";
|
|
4
|
+
const B = `
|
|
5
5
|
<tr class="recommendation-product-row">
|
|
6
6
|
<td>
|
|
7
7
|
<table
|
|
@@ -18,7 +18,7 @@ const O = `
|
|
|
18
18
|
</table>
|
|
19
19
|
</td>
|
|
20
20
|
</tr>
|
|
21
|
-
`,
|
|
21
|
+
`, Y = `
|
|
22
22
|
<tr
|
|
23
23
|
class="recommendation-attribute-row"
|
|
24
24
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -27,38 +27,57 @@ const O = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
function y(t, e, o, l = D, c = {}, s = {}) {
|
|
31
|
+
const {
|
|
32
|
+
cellPadding: a = O,
|
|
33
|
+
styleTemplates: i,
|
|
34
|
+
cardBackgroundColor: T,
|
|
35
|
+
cellBackgroundColors: r
|
|
36
|
+
} = s, d = (100 / e).toFixed(2), p = e - t.length, u = `<td class="${U}" style="padding: ${a};" width="${d}%"></td>`, L = p > 0 ? u.repeat(p) : "", R = g(o, l, c);
|
|
37
|
+
return l.filter((n) => R[n]).map((n) => {
|
|
38
|
+
const m = P[n] ?? !0, E = m ? "" : 'style="display: none;"', I = {
|
|
39
|
+
cellPadding: a,
|
|
40
|
+
cardBackgroundColor: T,
|
|
41
|
+
cellBackgroundColor: r == null ? void 0 : r[n],
|
|
42
|
+
styleTemplate: i == null ? void 0 : i[n]
|
|
43
|
+
}, S = t.map((_) => R[n](_, I).replace("<td", `<td width="${d}%"`)).join("");
|
|
44
|
+
return Y.replace("{-{-ATTR_TYPE-}-}", n).replace("{-{-VISIBILITY-}-}", m ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", E).replace("{-{-CELLS-}-}", S + L);
|
|
35
45
|
}).join("");
|
|
36
46
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
for (let
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
function W(t, e, o, l, c = {}, s = {}) {
|
|
48
|
+
const a = [];
|
|
49
|
+
for (let r = 0; r < t.length; r += e)
|
|
50
|
+
a.push(t.slice(r, r + e));
|
|
51
|
+
const i = C(s.rowSpacingPx);
|
|
52
|
+
return a.map((r, d) => {
|
|
53
|
+
const p = y(
|
|
54
|
+
r,
|
|
44
55
|
e,
|
|
45
56
|
o,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
l,
|
|
58
|
+
c,
|
|
59
|
+
s
|
|
60
|
+
), u = B.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
|
|
61
|
+
return d > 0 ? i + u : u;
|
|
50
62
|
}).join("");
|
|
51
63
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
64
|
+
function F(t, e, o, l = {}, c = {}) {
|
|
65
|
+
return W(
|
|
66
|
+
t,
|
|
67
|
+
e,
|
|
68
|
+
h,
|
|
69
|
+
o,
|
|
70
|
+
l,
|
|
71
|
+
c
|
|
72
|
+
);
|
|
54
73
|
}
|
|
55
|
-
function
|
|
56
|
-
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o =
|
|
57
|
-
return o.replace("{-{-TITLE-}-}",
|
|
74
|
+
function j(t) {
|
|
75
|
+
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = f("grid", e), l = w(), c = F(l, b);
|
|
76
|
+
return o.replace("{-{-TITLE-}-}", A.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
58
77
|
}
|
|
59
78
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
j as getDefaultTemplate,
|
|
80
|
+
y as prepareGridAttributeRows,
|
|
81
|
+
W as prepareGridProductRows,
|
|
82
|
+
F as prepareProductRows
|
|
64
83
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { prepareProductRows as
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
function
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as u } from "../constants/layout.js";
|
|
2
|
+
import { prepareProductRows as P } from "./grid/template.js";
|
|
3
|
+
import { prepareProductRows as m } from "./list/template.js";
|
|
4
|
+
function g(o, t, r = {}) {
|
|
5
|
+
const { cellPadding: c, rowSpacingPx: p, styleTemplates: s, cardBackgroundColor: i, cellBackgroundColors: a } = r, e = { cellPadding: c, rowSpacingPx: p, styleTemplates: s, cardBackgroundColor: i, cellBackgroundColors: a };
|
|
5
6
|
if (t === "list")
|
|
6
|
-
return
|
|
7
|
-
const { productsPerRow:
|
|
8
|
-
return
|
|
7
|
+
return m(o, r.composition, r.filterList, e);
|
|
8
|
+
const { productsPerRow: n = u, composition: d, filterList: l } = r;
|
|
9
|
+
return P(o, n, d, l, e);
|
|
9
10
|
}
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
g as prepareProductRows
|
|
12
13
|
};
|