@useinsider/guido 3.8.1-beta.2ee94c2 → 3.8.1-beta.5cf94b0
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 +70 -66
- package/dist/composables/useHtmlValidator.js +180 -133
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +111 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +98 -89
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +170 -163
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/block.js +60 -41
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +26 -20
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +359 -264
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -83
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +43 -31
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +55 -45
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +175 -166
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +6 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -53
- package/dist/extensions/Blocks/Recommendation/templates/index.js +20 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -40
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +36 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
- 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 +10 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
|
@@ -1,101 +1,148 @@
|
|
|
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
|
-
|
|
1
|
+
import { ATTR_PRODUCT_PRICE as c, ATTR_PRODUCT_OLD_PRICE as l, ATTR_CUSTOM_PREFIX as a, PRODUCT_ATTRIBUTE_PREFIX as u, ATTR_PRODUCT_IMAGE as f, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as _ } from "../constants/selectors.js";
|
|
2
|
+
import { useRecommendationExtensionStore as D } from "../store/recommendation.js";
|
|
3
|
+
import { formatPrice as O } from "../utils/priceFormatter.js";
|
|
4
|
+
function E() {
|
|
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 m(t, e = "price") {
|
|
16
|
+
const n = E(), o = t[e], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
|
|
17
|
+
return O({
|
|
18
|
+
price: r,
|
|
19
|
+
currency: n
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function Y(t) {
|
|
23
|
+
return m(t, "price") === m(t, "original_price");
|
|
24
|
+
}
|
|
25
|
+
function I(t) {
|
|
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];
|
|
26
57
|
if (!o)
|
|
27
58
|
return { ...t };
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
const i =
|
|
31
|
-
s
|
|
32
|
-
var
|
|
33
|
-
const
|
|
34
|
-
return o(
|
|
59
|
+
const r = { ...t };
|
|
60
|
+
return e.filter((s) => s.startsWith(a) && !r[s]).forEach((s) => {
|
|
61
|
+
const i = s.substring(a.length), d = I(i), S = L(i, n), A = h(i, n);
|
|
62
|
+
r[s] = (g, R) => {
|
|
63
|
+
var b;
|
|
64
|
+
const P = A ? g[i] : (b = g.product_attributes) == null ? void 0 : b[i], U = $(P) ?? d;
|
|
65
|
+
return o(S, U, R);
|
|
35
66
|
};
|
|
36
|
-
}),
|
|
67
|
+
}), r;
|
|
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
|
+
};
|
|
37
80
|
}
|
|
38
|
-
const
|
|
81
|
+
const X = {
|
|
39
82
|
TITLE: "You May Also Like!"
|
|
40
|
-
},
|
|
41
|
-
b,
|
|
42
|
-
T,
|
|
43
|
-
g,
|
|
44
|
-
_,
|
|
83
|
+
}, K = [
|
|
45
84
|
f,
|
|
85
|
+
T,
|
|
86
|
+
l,
|
|
87
|
+
c,
|
|
88
|
+
C,
|
|
46
89
|
p,
|
|
47
|
-
|
|
48
|
-
],
|
|
49
|
-
[
|
|
90
|
+
_
|
|
91
|
+
], q = {
|
|
92
|
+
[f]: !0,
|
|
50
93
|
[T]: !0,
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
94
|
+
[c]: !0,
|
|
95
|
+
[l]: !0,
|
|
96
|
+
[C]: !1,
|
|
54
97
|
[p]: !1,
|
|
55
|
-
[
|
|
56
|
-
},
|
|
57
|
-
function
|
|
98
|
+
[_]: !0
|
|
99
|
+
}, B = 10;
|
|
100
|
+
function k(t = B) {
|
|
58
101
|
return `
|
|
59
102
|
<tr>
|
|
60
103
|
<td class="spacer" style="height: ${t}px;"></td>
|
|
61
104
|
</tr>
|
|
62
105
|
`;
|
|
63
106
|
}
|
|
64
|
-
const
|
|
65
|
-
function w(t,
|
|
66
|
-
return
|
|
107
|
+
const v = k();
|
|
108
|
+
function w(t, e) {
|
|
109
|
+
return e ? e.pStyle ?? "" : t;
|
|
67
110
|
}
|
|
68
|
-
function
|
|
69
|
-
const o = w(
|
|
70
|
-
return `<p contenteditable="false" style="${o}">${
|
|
111
|
+
function J(t, e, n) {
|
|
112
|
+
const o = w(e.pStyle, n), r = n ? n.openTags ?? "" : e.openTags, s = n ? n.closeTags ?? "" : e.closeTags;
|
|
113
|
+
return `<p contenteditable="false" style="${o}">${r}${t}${s}</p>`;
|
|
71
114
|
}
|
|
72
|
-
function
|
|
73
|
-
const
|
|
74
|
-
return t &&
|
|
115
|
+
function Q(t, e) {
|
|
116
|
+
const n = [];
|
|
117
|
+
return t && n.push(t), e && n.push(`background-color: ${e};`), n.join(" ");
|
|
75
118
|
}
|
|
76
|
-
function
|
|
77
|
-
return t ? `
|
|
119
|
+
function N(t) {
|
|
120
|
+
return t ? ` background-color: ${t};` : "";
|
|
121
|
+
}
|
|
122
|
+
function Z(t) {
|
|
123
|
+
const e = N(t);
|
|
124
|
+
return e ? ` style="${e.trim()}"` : "";
|
|
78
125
|
}
|
|
79
|
-
function
|
|
126
|
+
function tt(t, e = "") {
|
|
80
127
|
return {
|
|
81
|
-
before: (t == null ? void 0 : t.before) ??
|
|
128
|
+
before: (t == null ? void 0 : t.before) ?? e,
|
|
82
129
|
after: (t == null ? void 0 : t.after) ?? ""
|
|
83
130
|
};
|
|
84
131
|
}
|
|
85
|
-
function
|
|
86
|
-
return `${(
|
|
132
|
+
function et(t, e) {
|
|
133
|
+
return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
|
|
87
134
|
}
|
|
88
|
-
function
|
|
135
|
+
function nt(t) {
|
|
89
136
|
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
90
137
|
}
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
138
|
+
const ot = "display: block; max-width: 100%; height: auto;", rt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", st = "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;", y = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
139
|
+
function it(t) {
|
|
140
|
+
return !t || typeof t != "string" || t.trim() === "" ? y : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
94
141
|
}
|
|
95
|
-
function
|
|
142
|
+
function F(t) {
|
|
96
143
|
return {
|
|
97
144
|
name: "Product Name",
|
|
98
|
-
image_url:
|
|
145
|
+
image_url: y,
|
|
99
146
|
price: { USD: 18 },
|
|
100
147
|
original_price: { USD: 20 },
|
|
101
148
|
discount: { USD: 2 },
|
|
@@ -107,19 +154,19 @@ function B(t) {
|
|
|
107
154
|
category: []
|
|
108
155
|
};
|
|
109
156
|
}
|
|
110
|
-
function
|
|
157
|
+
function ct(t = 6) {
|
|
111
158
|
return Array.from(
|
|
112
159
|
{ length: t },
|
|
113
|
-
(
|
|
160
|
+
(e, n) => F(String(n + 1))
|
|
114
161
|
);
|
|
115
162
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
118
|
-
data-layout="list"` : "", o =
|
|
163
|
+
function lt(t = "grid", e) {
|
|
164
|
+
const n = t === "list" ? `
|
|
165
|
+
data-layout="list"` : "", o = e ? ` ${e}` : "";
|
|
119
166
|
return `
|
|
120
167
|
<td
|
|
121
168
|
align="left"
|
|
122
|
-
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${
|
|
169
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${n}>
|
|
123
170
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
124
171
|
<tr>
|
|
125
172
|
<td align="center">
|
|
@@ -151,7 +198,7 @@ function Q(t = "grid", n) {
|
|
|
151
198
|
</table>
|
|
152
199
|
</td>
|
|
153
200
|
</tr>
|
|
154
|
-
${
|
|
201
|
+
${v}
|
|
155
202
|
<tr>
|
|
156
203
|
<td>
|
|
157
204
|
<table
|
|
@@ -190,31 +237,37 @@ function Q(t = "grid", n) {
|
|
|
190
237
|
`;
|
|
191
238
|
}
|
|
192
239
|
export {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
240
|
+
x as CUSTOM_CELL_HTML,
|
|
241
|
+
X as DEFAULTS,
|
|
242
|
+
st as DEFAULT_BUTTON_ANCHOR_STYLE,
|
|
243
|
+
rt as DEFAULT_BUTTON_BORDER_STYLE,
|
|
244
|
+
K as DEFAULT_CARD_COMPOSITION,
|
|
245
|
+
q as DEFAULT_CARD_VISIBILITY,
|
|
246
|
+
ot as DEFAULT_IMG_STYLE,
|
|
247
|
+
B as DEFAULT_ROW_SPACING_PX,
|
|
248
|
+
y as PLACEHOLDER_IMAGE,
|
|
249
|
+
N as bgColorFragment,
|
|
250
|
+
V as buildCellOptions,
|
|
251
|
+
z as buildElementRenderer,
|
|
252
|
+
k as buildSpacer,
|
|
253
|
+
Z as cellBgStyleAttr,
|
|
254
|
+
lt as createBlockTemplate,
|
|
255
|
+
m as formatProductPrice,
|
|
256
|
+
E as getCurrentCurrencyConfig,
|
|
257
|
+
ct as getDefaultProducts,
|
|
258
|
+
h as isDefaultAttribute,
|
|
259
|
+
Y as isSamePrice,
|
|
260
|
+
et as renderButtonLabel,
|
|
261
|
+
J as renderStyledParagraph,
|
|
262
|
+
nt as resolveButtonBorderClass,
|
|
263
|
+
G as resolveInlinePriceOrder,
|
|
264
|
+
tt as resolveOmnibusText,
|
|
212
265
|
w as resolvePStyle,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
266
|
+
L as resolveProductAttrValue,
|
|
267
|
+
Q as resolveSegmentBgStyle,
|
|
268
|
+
it as sanitizeImageUrl,
|
|
269
|
+
v as spacer,
|
|
270
|
+
j as toCustomCompositionKey,
|
|
271
|
+
I as toDisplayName,
|
|
272
|
+
$ as toDisplayableAttributeValue
|
|
220
273
|
};
|
|
@@ -139,6 +139,10 @@ 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>;
|
|
142
146
|
}, undefined>;
|
|
143
147
|
/**
|
|
144
148
|
* Migration-only inputs scoped to this template.
|
|
@@ -195,6 +199,10 @@ export declare const TemplateMigrationSchema: v.ObjectSchema<{
|
|
|
195
199
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
196
200
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
197
201
|
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>;
|
|
198
206
|
}, undefined>, undefined>, {}>;
|
|
199
207
|
}, undefined>;
|
|
200
208
|
/**
|
|
@@ -274,6 +282,10 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
274
282
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
275
283
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
276
284
|
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>;
|
|
277
289
|
}, undefined>, undefined>, {}>;
|
|
278
290
|
}, undefined>, {}>;
|
|
279
291
|
}, undefined>;
|
|
@@ -665,6 +677,10 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
665
677
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
666
678
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
667
679
|
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>;
|
|
668
684
|
}, undefined>, undefined>, {}>;
|
|
669
685
|
}, undefined>, {}>;
|
|
670
686
|
}, undefined>, {}>;
|
|
@@ -60,6 +60,8 @@ 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;
|
|
63
65
|
} & {
|
|
64
66
|
[key: string]: unknown;
|
|
65
67
|
};
|
|
@@ -186,6 +188,8 @@ export declare const useConfig: () => {
|
|
|
186
188
|
blockType?: string | undefined;
|
|
187
189
|
size?: string | number | undefined;
|
|
188
190
|
verticalResponsiveness?: boolean | undefined;
|
|
191
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
192
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
189
193
|
} & {
|
|
190
194
|
[key: string]: unknown;
|
|
191
195
|
};
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import type { DynamicContent } from '@@/Types/generic';
|
|
2
|
+
import type { FiltersResponse } from '@@/Types/recommendation';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
|
|
5
|
+
* braces/whitespace) into its recommendation id and attribute name. Returns
|
|
6
|
+
* null for anything that isn't a well-formed recommendation variable.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseRecommendationVariable(field: string): {
|
|
9
|
+
recoId: string;
|
|
10
|
+
attribute: string;
|
|
11
|
+
} | null;
|
|
12
|
+
/**
|
|
13
|
+
* Builds the set of attribute forms valid inside partner-authored
|
|
14
|
+
* `{{recoId_index_attribute}}` variables: the built-in compiler attributes plus
|
|
15
|
+
* each account attribute in its canonical token form — bare for
|
|
16
|
+
* `defaultAttribute`, `product_attribute.<name>` for `productAttribute`. Using
|
|
17
|
+
* `resolveProductAttrValue` (the same producer the block builder uses) keeps the
|
|
18
|
+
* validator's notion of "valid form" identical to what is actually emitted.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse): Set<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the `{{...}}` custom fields in the HTML that are invalid. Partner
|
|
23
|
+
* attributes in `ins-skip-compile` blocks (recoId ∈ ignoredIds) are checked
|
|
24
|
+
* against `ignoredAttributeNames`; Guido-generated reco variables and known merge
|
|
25
|
+
* tags pass. An unrecognized dotted token is ignored: it was never captured
|
|
26
|
+
* before, so flagging it would false-positive on merge tags like `{{user.name}}`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
|
|
2
29
|
export declare const useHtmlValidator: () => {
|
|
3
30
|
validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
|
|
4
31
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Substitutes recommendation product variables in compiled preview HTML with the
|
|
3
|
+
* blocks' fetched sample products, then simulates the email-service hide rule by
|
|
4
|
+
* emptying the original-price cell (DOM kept) for slots with no real discount.
|
|
5
|
+
* Returns the input unchanged when there are no reco blocks or no products.
|
|
6
|
+
*/
|
|
7
|
+
export declare function substituteRecommendationPreview(html: string): string;
|
|
8
|
+
export declare const useRecommendationPreview: () => {
|
|
9
|
+
substituteRecommendationPreview: typeof substituteRecommendationPreview;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true when a recommendation block has opted out of Guido's
|
|
3
|
+
* product-data → template-variable substitution. Partners signal opt-out by
|
|
4
|
+
* adding the `ins-skip-compile` class on the `.recommendation-block-v2`
|
|
5
|
+
* element. Only the variable substitution is skipped — campaign URL building,
|
|
6
|
+
* hidden-row removal, Outlook image widths, discount conditions, text-trim CSS
|
|
7
|
+
* and general HTML optimizations still apply. See `CSS_CLASS_SKIP_COMPILE` for
|
|
8
|
+
* the full scope.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isIgnoredRecommendationBlock(block: Element): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* DOM-parses the HTML once and returns the set of `recommendation-id`
|
|
13
|
+
* values that belong to ignored blocks. Use this in regex/string-based
|
|
14
|
+
* compiler rules where the rule processes flat matches and only has the
|
|
15
|
+
* extracted block ID rather than a DOM Element reference.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getIgnoredRecommendationBlockIds(html: string): Set<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,3 +5,18 @@ export declare function extractTitleText(block: Element): string;
|
|
|
5
5
|
* the caller treats that as "no segment background".
|
|
6
6
|
*/
|
|
7
7
|
export declare function extractCardBgColor(block: Element): string;
|
|
8
|
+
/**
|
|
9
|
+
* Reads the legacy block's own `currency-*` attributes into a
|
|
10
|
+
* `currencySettings`-shaped object that `mapCurrency` understands. Used as a
|
|
11
|
+
* fallback when the external recommendationConfigs map has no entry for this
|
|
12
|
+
* block, so the migrated block keeps its real currency instead of defaulting.
|
|
13
|
+
* Returns undefined when the block carries no `currency` attribute.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractCurrencyFromBlock(block: Element): Record<string, string> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* True when a PM has manually opted the legacy block out of content
|
|
18
|
+
* regeneration by adding the `ins-skip-compile` class. Detected before rebuild
|
|
19
|
+
* so the migrator preserves the partner's markup verbatim (keeping their
|
|
20
|
+
* hand-authored variables) instead of regenerating the block.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isPartnerManagedBlock(block: Element): boolean;
|
|
@@ -8,4 +8,12 @@ export declare function buildBlockHtml(params: {
|
|
|
8
8
|
extraClasses?: string;
|
|
9
9
|
legacyId?: string;
|
|
10
10
|
legacyBgColor?: string;
|
|
11
|
+
/**
|
|
12
|
+
* When set, the block's existing inner HTML is preserved verbatim instead
|
|
13
|
+
* of regenerating product rows — used for partner-customized blocks so
|
|
14
|
+
* their hand-authored `{{...}}` variables survive migration.
|
|
15
|
+
*/
|
|
16
|
+
preserveInnerHtml?: string;
|
|
17
|
+
/** Adds the `ins-skip-compile` opt-out class to the migrated block. */
|
|
18
|
+
skipCompile?: boolean;
|
|
11
19
|
}): string;
|
|
@@ -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' | 'configVersion'>;
|
|
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' | 'priceMovedToNextLine' | 'priceHideIfSameAsDiscounted' | 'configVersion'>;
|
|
7
7
|
export declare function mapSettings(recCfg: LegacyRecommendationConfig, parsed: LegacyProductConfig, id: number): SettingsPartial;
|
|
@@ -117,6 +117,16 @@ 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;
|
|
120
130
|
/**
|
|
121
131
|
* Gets the recommendation-id from a block node
|
|
122
132
|
*/
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { RecommendationBlockId } from './blockIds';
|
|
10
10
|
export { RecommendationControlId } from './controlIds';
|
|
11
|
-
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
|
|
11
|
+
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
|
|
12
12
|
export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
|
|
13
13
|
export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
|
|
@@ -23,6 +23,18 @@ export declare const MOBILE_ROW_SELECTOR = ".ins-recommendation-mobile-row";
|
|
|
23
23
|
* `{{cId_pIdx_url}}` template variable.
|
|
24
24
|
*/
|
|
25
25
|
export declare const CSS_CLASS_RECO_BUTTON = "reco-v3-button";
|
|
26
|
+
/**
|
|
27
|
+
* Opt-out class for partners who want to inject their own template variables
|
|
28
|
+
* into a recommendation block. When present on `.recommendation-block-v2`,
|
|
29
|
+
* Guido skips ONLY its product-data → template-variable substitution
|
|
30
|
+
* (`replaceProductAttributes`) for that block — partners author their own
|
|
31
|
+
* `{{recoId_index_attribute}}` variables. Everything else (campaign URL
|
|
32
|
+
* building, hidden-row removal, Outlook image widths, text-trim CSS, discount
|
|
33
|
+
* conditions, store hydration, store-level config validation, and general HTML
|
|
34
|
+
* optimizations) still applies. The class is preserved in the final compiled
|
|
35
|
+
* output so partners may use it for their own styling.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CSS_CLASS_SKIP_COMPILE = "ins-skip-compile";
|
|
26
38
|
/**
|
|
27
39
|
* Currency HTML attributes set on the block element
|
|
28
40
|
* These are read by the HTML compiler at runtime to format prices
|
|
@@ -63,3 +75,12 @@ export declare const PRODUCT_ATTRIBUTE_PREFIX = "product_attribute.";
|
|
|
63
75
|
* Used to exclude these from the custom attribute dropdown to prevent duplication with toggles.
|
|
64
76
|
*/
|
|
65
77
|
export declare const BUILT_IN_DEFAULT_ATTRIBUTES: Set<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Attribute names valid inside a `{{recoId_index_attributeName}}` template
|
|
80
|
+
* variable regardless of the account's custom attribute list. Every built-in
|
|
81
|
+
* composition attribute is valid, plus `currency` and `discount` which the
|
|
82
|
+
* compiler emits but are not composition toggles. Custom attributes are
|
|
83
|
+
* validated separately against the account's fetched attribute list
|
|
84
|
+
* (`stripo/email-recommendation-attributes`).
|
|
85
|
+
*/
|
|
86
|
+
export declare const RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES: Set<string>;
|
|
@@ -17,6 +17,13 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
17
17
|
getId(): string;
|
|
18
18
|
getTemplate(): string;
|
|
19
19
|
onRender(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Card composition restructures the block (toggles/reorders/adds attribute
|
|
22
|
+
* cells), which would corrupt a partner-managed (`ins-skip-compile`) block's
|
|
23
|
+
* preserved markup. There is no native tab-disable API, so the whole control
|
|
24
|
+
* container is rendered inert (greyed + non-interactive) instead.
|
|
25
|
+
*/
|
|
26
|
+
_syncDisabledState(): void;
|
|
20
27
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
21
28
|
onDestroy(): void;
|
|
22
29
|
private _initializeComposition;
|
|
@@ -43,6 +50,15 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
43
50
|
*/
|
|
44
51
|
private _tryReorderInPlace;
|
|
45
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;
|
|
46
62
|
private _createCustomItemHtml;
|
|
47
63
|
/**
|
|
48
64
|
* Builds select options from the store's filterList.
|
|
@@ -98,7 +114,23 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
98
114
|
*/
|
|
99
115
|
private _rescueReorderIconsToStore;
|
|
100
116
|
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;
|
|
101
123
|
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;
|
|
102
134
|
private _setupDeleteHandler;
|
|
103
135
|
private _onAddAttribute;
|
|
104
136
|
/**
|
|
@@ -155,9 +187,10 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
155
187
|
private _extractSegmentBgFromCard;
|
|
156
188
|
private _getControlContainer;
|
|
157
189
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
190
|
+
* Ensures composition reorder is enabled. Both grid and list layouts now
|
|
191
|
+
* support reordering — top-level items and the nested price sub-items are all
|
|
192
|
+
* draggable. (Items render with `draggable="true"`; this just clears any stale
|
|
193
|
+
* disabled state.)
|
|
161
194
|
*/
|
|
162
195
|
private _updateOrderableState;
|
|
163
196
|
/**
|
|
@@ -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, } from './main';
|
|
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, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, } from './main';
|
|
13
13
|
export * from './main/utils';
|
|
14
14
|
export { NameControls } from './name';
|
|
15
15
|
export { PriceControls } from './price';
|