@useinsider/guido 3.15.0 → 3.16.0-beta.089654a
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 +108 -92
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +78 -75
- package/dist/composables/useActionsApi.js +30 -22
- package/dist/composables/useEmailTemplateApplier.js +25 -23
- package/dist/composables/useHtmlValidator.js +108 -106
- package/dist/composables/useRecommendation.js +20 -19
- package/dist/composables/useTimerClone.js +21 -19
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/enums/recommendation.js +17 -17
- package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +10 -9
- package/dist/extensions/Blocks/Items/block.js +44 -42
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
- package/dist/extensions/Blocks/Items/template.js +86 -86
- package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/RadioButton/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/RadioButton/extension.js +5 -4
- package/dist/extensions/Blocks/RadioButton/settingsPanel.js +12 -11
- package/dist/extensions/Blocks/RadioButton/template.js +16 -9
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +5 -9
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +21 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +98 -113
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +21 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -12
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/extensions/Blocks/controlFactories.js +117 -115
- package/dist/guido.css +1 -1
- package/dist/library.js +11 -7
- package/dist/node_modules/valibot/dist/index.js +230 -216
- package/dist/package.json.js +1 -1
- package/dist/public/trackingIds.js +8 -0
- package/dist/src/@types/config/schemas.d.ts +20 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/trackingIds.d.ts +9 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/utils/linkTrackingIds.d.ts +30 -0
- package/dist/stores/editor.js +4 -1
- package/dist/stores/onboarding.js +11 -7
- package/dist/utils/linkTrackingIds.js +56 -0
- package/dist/utils/pairProductVariables.js +105 -99
- package/dist/utils/templatePreparation.js +72 -61
- package/package.json +6 -2
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_PRICE as
|
|
2
|
-
import { useRecommendationExtensionStore as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as C, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as y, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
|
|
2
|
+
import { useRecommendationExtensionStore as L } from "../store/recommendation.js";
|
|
3
|
+
import { compositionKeyToProductAttr as A, isDefaultProductAttr as b, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as h } from "../utils/compositionKeys.js";
|
|
4
|
+
import { formatPrice as B } from "../utils/priceFormatter.js";
|
|
5
|
+
function k() {
|
|
6
|
+
const t = L(), { currencySettings: e } = t.recommendationConfigs;
|
|
6
7
|
return {
|
|
7
8
|
code: e.value,
|
|
8
9
|
symbol: e.symbol,
|
|
@@ -12,137 +13,136 @@ function E() {
|
|
|
12
13
|
thousandSeparator: e.thousandSeparator
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
price:
|
|
19
|
-
currency:
|
|
16
|
+
function f(t, e = "price") {
|
|
17
|
+
const o = k(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
18
|
+
return B({
|
|
19
|
+
price: c,
|
|
20
|
+
currency: o
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
23
|
+
function q(t) {
|
|
24
|
+
return f(t, "price") === f(t, "original_price");
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function x(t) {
|
|
26
27
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
const e = t.indexOf(
|
|
29
|
+
function J(t) {
|
|
30
|
+
const e = t.indexOf(l), o = t.indexOf(a), n = o !== -1 && (e === -1 || o < e);
|
|
30
31
|
return {
|
|
31
|
-
originalFirst:
|
|
32
|
-
anchor:
|
|
33
|
-
skip:
|
|
32
|
+
originalFirst: n,
|
|
33
|
+
anchor: n ? a : l,
|
|
34
|
+
skip: n ? l : a
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function N(t) {
|
|
37
38
|
const e = Array.isArray(t) ? t[t.length - 1] : t;
|
|
38
39
|
if (typeof e == "string")
|
|
39
40
|
return e;
|
|
40
41
|
if (typeof e == "number")
|
|
41
42
|
return String(e);
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
return (
|
|
44
|
+
function w(t, e) {
|
|
45
|
+
var o;
|
|
46
|
+
return ((o = $(t, e)) == null ? void 0 : o.type) === "defaultAttribute";
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
48
|
+
function F(t, e) {
|
|
49
|
+
return w(t, e) ? t : `${I}${t}`;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
return `${a}${e}`;
|
|
51
|
+
function Q(t) {
|
|
52
|
+
return h(t);
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
54
|
+
const v = Symbol("customCellHtml");
|
|
55
|
+
function Z(t, e, o = {}) {
|
|
56
|
+
const n = t[v];
|
|
57
|
+
if (!n)
|
|
58
58
|
return { ...t };
|
|
59
|
-
const
|
|
60
|
-
return e.filter((s) => s.startsWith(
|
|
61
|
-
const i = s
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
const
|
|
65
|
-
return
|
|
59
|
+
const c = { ...t };
|
|
60
|
+
return e.filter((s) => s.startsWith(T) && !c[s]).forEach((s) => {
|
|
61
|
+
const i = A(s), r = b(i) ? F(i, o) : i, u = S(r), R = x(u), D = b(r);
|
|
62
|
+
c[s] = (d, U) => {
|
|
63
|
+
var g;
|
|
64
|
+
const E = D ? d[u] : (g = d.product_attributes) == null ? void 0 : g[u], O = N(E) ?? R;
|
|
65
|
+
return n(r, O, U);
|
|
66
66
|
};
|
|
67
|
-
}),
|
|
67
|
+
}), c;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
69
|
+
function tt(t, e, o = []) {
|
|
70
|
+
const n = t.startsWith(T) ? h(S(A(t))) : t, s = n !== t && !o.includes(n) ? n : t, i = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[s]);
|
|
71
71
|
return {
|
|
72
72
|
cellPadding: e.cellPadding,
|
|
73
73
|
cardBackgroundColor: e.cardBackgroundColor,
|
|
74
|
-
cellBackgroundColor: (
|
|
75
|
-
cellAlignment: (
|
|
76
|
-
cellClasses: (
|
|
77
|
-
omnibusText: (
|
|
78
|
-
styleTemplate: (
|
|
74
|
+
cellBackgroundColor: i(e.cellBackgroundColors),
|
|
75
|
+
cellAlignment: i(e.cellAlignments),
|
|
76
|
+
cellClasses: i(e.cellClasses),
|
|
77
|
+
omnibusText: i(e.omnibusTexts),
|
|
78
|
+
styleTemplate: i(e.styleTemplates)
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const et = {
|
|
82
82
|
TITLE: "You May Also Like!"
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
T,
|
|
86
|
-
l,
|
|
87
|
-
c,
|
|
83
|
+
}, ot = [
|
|
84
|
+
m,
|
|
88
85
|
C,
|
|
86
|
+
a,
|
|
87
|
+
l,
|
|
88
|
+
_,
|
|
89
89
|
p,
|
|
90
|
-
|
|
91
|
-
],
|
|
92
|
-
[
|
|
93
|
-
[
|
|
94
|
-
[c]: !0,
|
|
90
|
+
y
|
|
91
|
+
], nt = {
|
|
92
|
+
[m]: !0,
|
|
93
|
+
[C]: !0,
|
|
95
94
|
[l]: !0,
|
|
96
|
-
[
|
|
95
|
+
[a]: !0,
|
|
96
|
+
[_]: !1,
|
|
97
97
|
[p]: !1,
|
|
98
|
-
[
|
|
99
|
-
},
|
|
100
|
-
function
|
|
98
|
+
[y]: !0
|
|
99
|
+
}, M = 10;
|
|
100
|
+
function W(t = M) {
|
|
101
101
|
return `
|
|
102
102
|
<tr>
|
|
103
103
|
<td class="spacer" style="height: ${t}px;"></td>
|
|
104
104
|
</tr>
|
|
105
105
|
`;
|
|
106
106
|
}
|
|
107
|
-
const
|
|
108
|
-
function
|
|
107
|
+
const H = W();
|
|
108
|
+
function V(t, e) {
|
|
109
109
|
return e ? e.pStyle ?? "" : t;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
const
|
|
113
|
-
return `<p contenteditable="false" style="${
|
|
111
|
+
function rt(t, e, o) {
|
|
112
|
+
const n = V(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, s = o ? o.closeTags ?? "" : e.closeTags;
|
|
113
|
+
return `<p contenteditable="false" style="${n}">${c}${t}${s}</p>`;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
return t &&
|
|
115
|
+
function st(t, e) {
|
|
116
|
+
const o = [];
|
|
117
|
+
return t && o.push(t), e && o.push(`background-color: ${e};`), o.join(" ");
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Y(t) {
|
|
120
120
|
return t ? ` background-color: ${t};` : "";
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const e =
|
|
122
|
+
function it(t) {
|
|
123
|
+
const e = Y(t);
|
|
124
124
|
return e ? ` style="${e.trim()}"` : "";
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function ct(t, e = "") {
|
|
127
127
|
return {
|
|
128
128
|
before: (t == null ? void 0 : t.before) ?? e,
|
|
129
129
|
after: (t == null ? void 0 : t.after) ?? ""
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function lt(t, e) {
|
|
133
133
|
return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function at(t) {
|
|
136
136
|
return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
138
|
+
const ut = "display: block; max-width: 100%; height: auto;", dt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", gt = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", P = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
139
|
+
function bt(t) {
|
|
140
|
+
return !t || typeof t != "string" || t.trim() === "" ? P : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function G(t) {
|
|
143
143
|
return {
|
|
144
144
|
name: "Product Name",
|
|
145
|
-
image_url:
|
|
145
|
+
image_url: P,
|
|
146
146
|
price: { USD: 18 },
|
|
147
147
|
original_price: { USD: 20 },
|
|
148
148
|
discount: { USD: 2 },
|
|
@@ -154,19 +154,19 @@ function F(t) {
|
|
|
154
154
|
category: []
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function ft(t = 6) {
|
|
158
158
|
return Array.from(
|
|
159
159
|
{ length: t },
|
|
160
|
-
(e,
|
|
160
|
+
(e, o) => G(String(o + 1))
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
const
|
|
165
|
-
data-layout="list"` : "",
|
|
163
|
+
function Tt(t = "grid", e) {
|
|
164
|
+
const o = t === "list" ? `
|
|
165
|
+
data-layout="list"` : "", n = e ? ` ${e}` : "";
|
|
166
166
|
return `
|
|
167
167
|
<td
|
|
168
168
|
align="left"
|
|
169
|
-
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${
|
|
169
|
+
class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`}"${o}>
|
|
170
170
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
171
171
|
<tr>
|
|
172
172
|
<td align="center">
|
|
@@ -198,7 +198,7 @@ function lt(t = "grid", e) {
|
|
|
198
198
|
</table>
|
|
199
199
|
</td>
|
|
200
200
|
</tr>
|
|
201
|
-
${
|
|
201
|
+
${H}
|
|
202
202
|
<tr>
|
|
203
203
|
<td>
|
|
204
204
|
<table
|
|
@@ -237,37 +237,37 @@ function lt(t = "grid", e) {
|
|
|
237
237
|
`;
|
|
238
238
|
}
|
|
239
239
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
240
|
+
v as CUSTOM_CELL_HTML,
|
|
241
|
+
et as DEFAULTS,
|
|
242
|
+
gt as DEFAULT_BUTTON_ANCHOR_STYLE,
|
|
243
|
+
dt as DEFAULT_BUTTON_BORDER_STYLE,
|
|
244
|
+
ot as DEFAULT_CARD_COMPOSITION,
|
|
245
|
+
nt as DEFAULT_CARD_VISIBILITY,
|
|
246
|
+
ut as DEFAULT_IMG_STYLE,
|
|
247
|
+
M as DEFAULT_ROW_SPACING_PX,
|
|
248
|
+
P as PLACEHOLDER_IMAGE,
|
|
249
|
+
Y as bgColorFragment,
|
|
250
|
+
tt as buildCellOptions,
|
|
251
|
+
Z as buildElementRenderer,
|
|
252
|
+
W as buildSpacer,
|
|
253
|
+
it as cellBgStyleAttr,
|
|
254
|
+
Tt as createBlockTemplate,
|
|
255
|
+
f as formatProductPrice,
|
|
256
|
+
k as getCurrentCurrencyConfig,
|
|
257
|
+
ft as getDefaultProducts,
|
|
258
|
+
w as isDefaultAttribute,
|
|
259
|
+
q as isSamePrice,
|
|
260
|
+
lt as renderButtonLabel,
|
|
261
|
+
rt as renderStyledParagraph,
|
|
262
|
+
at as resolveButtonBorderClass,
|
|
263
|
+
J as resolveInlinePriceOrder,
|
|
264
|
+
ct as resolveOmnibusText,
|
|
265
|
+
V as resolvePStyle,
|
|
266
|
+
F as resolveProductAttrValue,
|
|
267
|
+
st as resolveSegmentBgStyle,
|
|
268
|
+
bt as sanitizeImageUrl,
|
|
269
|
+
H as spacer,
|
|
270
|
+
Q as toCustomCompositionKey,
|
|
271
|
+
x as toDisplayName,
|
|
272
|
+
N as toDisplayableAttributeValue
|
|
273
273
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { extractWrapperTags as C } from "../../../../utils/preserveTextStyles.js";
|
|
2
2
|
import { RecommendationBlockId as c } from "../constants/blockIds.js";
|
|
3
3
|
import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_OMNIBUS_PRICE as A, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as x } from "../constants/selectors.js";
|
|
4
|
-
import { CSS_CLASS_TEXT_TRIM as
|
|
5
|
-
import { toCustomCompositionKey as
|
|
6
|
-
import {
|
|
4
|
+
import { CSS_CLASS_TEXT_TRIM as v } from "../controls/shared/textTrimCssRules.js";
|
|
5
|
+
import { toCustomCompositionKey as B } from "../templates/utils.js";
|
|
6
|
+
import { resolveRowCompositionKey as U } from "./compositionKeys.js";
|
|
7
|
+
import { hasQuerySelectorAll as _, hasGetAttribute as l, hasGetStyle as I, hasGetComputedStyle as N } from "./tagName.js";
|
|
7
8
|
const s = [
|
|
8
9
|
"font-size",
|
|
9
10
|
"font-family",
|
|
@@ -13,14 +14,14 @@ const s = [
|
|
|
13
14
|
"text-align",
|
|
14
15
|
"line-height",
|
|
15
16
|
"text-decoration"
|
|
16
|
-
],
|
|
17
|
+
], M = [
|
|
17
18
|
"background",
|
|
18
19
|
"background-color",
|
|
19
20
|
"border-width",
|
|
20
21
|
"border-color",
|
|
21
22
|
"border-style",
|
|
22
23
|
"border-radius"
|
|
23
|
-
],
|
|
24
|
+
], D = [
|
|
24
25
|
...s,
|
|
25
26
|
"background",
|
|
26
27
|
"background-color",
|
|
@@ -31,14 +32,14 @@ const s = [
|
|
|
31
32
|
"width",
|
|
32
33
|
"mso-border-alt",
|
|
33
34
|
"mso-padding-alt"
|
|
34
|
-
],
|
|
35
|
+
], G = [
|
|
35
36
|
"display",
|
|
36
37
|
"width",
|
|
37
38
|
"height",
|
|
38
39
|
"max-width",
|
|
39
40
|
"border-radius",
|
|
40
41
|
"margin"
|
|
41
|
-
],
|
|
42
|
+
], g = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), L = [
|
|
42
43
|
{ attrKey: E, blockId: c.NAME, kind: "text" },
|
|
43
44
|
{ attrKey: p, blockId: c.PRICE, kind: "text" },
|
|
44
45
|
{ attrKey: y, blockId: c.OLD_PRICE, kind: "text" },
|
|
@@ -50,7 +51,7 @@ const s = [
|
|
|
50
51
|
function O(t) {
|
|
51
52
|
return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function w(t) {
|
|
54
55
|
return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
|
|
55
56
|
}
|
|
56
57
|
function a(t, e, r) {
|
|
@@ -66,20 +67,20 @@ function k(t) {
|
|
|
66
67
|
if (!t || !I(t))
|
|
67
68
|
return;
|
|
68
69
|
const e = t.getStyle("background-color") || t.getStyle("background");
|
|
69
|
-
return e && !
|
|
70
|
+
return e && !g.has(e) ? e : void 0;
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function b(t, e) {
|
|
72
73
|
const r = {};
|
|
73
74
|
return a(r, t, e), h(r);
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function K(t) {
|
|
76
77
|
const e = t.querySelector("p"), r = {};
|
|
77
78
|
a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
|
|
78
79
|
const n = h(r), { openTags: o, closeTags: i } = C(O(e));
|
|
79
80
|
return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
|
|
80
81
|
}
|
|
81
82
|
function $(t) {
|
|
82
|
-
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n =
|
|
83
|
+
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = b(e, M), o = b(r, D), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = C(O(r)), m = w(r);
|
|
83
84
|
return !n && !o && !u && !T && !m ? null : {
|
|
84
85
|
buttonBorderStyle: n || void 0,
|
|
85
86
|
buttonAnchorStyle: o || void 0,
|
|
@@ -89,18 +90,18 @@ function $(t) {
|
|
|
89
90
|
closeTags: d
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
const e =
|
|
93
|
+
function H(t) {
|
|
94
|
+
const e = b(t.querySelector("img"), G);
|
|
94
95
|
return e ? { imgStyle: e } : null;
|
|
95
96
|
}
|
|
96
|
-
function
|
|
97
|
-
return e === "button" ? $(t) : e === "image" ?
|
|
97
|
+
function F(t, e) {
|
|
98
|
+
return e === "button" ? $(t) : e === "image" ? H(t) : K(t);
|
|
98
99
|
}
|
|
99
100
|
function f(t, e) {
|
|
100
101
|
if (!t || !("querySelector" in t))
|
|
101
102
|
return;
|
|
102
103
|
const r = t.querySelector(S) ?? t;
|
|
103
|
-
if (
|
|
104
|
+
if (L.forEach(({ attrKey: i, blockId: u, kind: T }) => {
|
|
104
105
|
const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
|
|
105
106
|
d && e(d, i, T);
|
|
106
107
|
}), !_(r))
|
|
@@ -110,46 +111,46 @@ function f(t, e) {
|
|
|
110
111
|
`[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
|
|
111
112
|
).forEach((i) => {
|
|
112
113
|
const u = l(i) ? i.getAttribute(x) : null;
|
|
113
|
-
!u || n.has(u) || (n.add(u), e(i,
|
|
114
|
+
!u || n.has(u) || (n.add(u), e(i, B(u), "text"));
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function j(t) {
|
|
117
118
|
const e = {};
|
|
118
119
|
return f(t, (r, n, o) => {
|
|
119
120
|
if (!("querySelector" in r))
|
|
120
121
|
return;
|
|
121
|
-
const i =
|
|
122
|
+
const i = F(r, o);
|
|
122
123
|
i && (e[n] = i);
|
|
123
124
|
}), e;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function X(t) {
|
|
126
127
|
if (!t || !("querySelector" in t))
|
|
127
128
|
return;
|
|
128
129
|
const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
|
|
129
130
|
return k(r);
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
+
function z(t) {
|
|
132
133
|
if (!t)
|
|
133
134
|
return;
|
|
134
135
|
const e = l(t) ? t.getAttribute("bgcolor") : null;
|
|
135
|
-
if (e && !
|
|
136
|
+
if (e && !g.has(e))
|
|
136
137
|
return e;
|
|
137
138
|
const r = k(t);
|
|
138
139
|
if (r)
|
|
139
140
|
return r;
|
|
140
|
-
const n =
|
|
141
|
-
return n && !
|
|
141
|
+
const n = N(t) ? t.getComputedStyle("background-color") : void 0;
|
|
142
|
+
return n && !g.has(n) ? n : void 0;
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function Q(t) {
|
|
144
145
|
const e = {};
|
|
145
146
|
return f(t, (r, n, o) => {
|
|
146
147
|
if (o !== "text")
|
|
147
148
|
return;
|
|
148
|
-
const i =
|
|
149
|
+
const i = z(r);
|
|
149
150
|
i && (e[n] = i);
|
|
150
151
|
}), e;
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function V(t) {
|
|
153
154
|
const e = {};
|
|
154
155
|
return f(t, (r, n, o) => {
|
|
155
156
|
if (o === "image")
|
|
@@ -158,30 +159,30 @@ function Q(t) {
|
|
|
158
159
|
i && (e[n] = i);
|
|
159
160
|
}), e;
|
|
160
161
|
}
|
|
161
|
-
const
|
|
162
|
-
function
|
|
162
|
+
const W = /^es-[pm]\d+[trbl]?$/;
|
|
163
|
+
function Y(t) {
|
|
163
164
|
const e = l(t) ? t.getAttribute("class") : null;
|
|
164
165
|
if (!e)
|
|
165
166
|
return;
|
|
166
|
-
const r = e.split(/\s+/).filter((n) =>
|
|
167
|
+
const r = e.split(/\s+/).filter((n) => W.test(n) || n === v);
|
|
167
168
|
return r.length ? r.join(" ") : void 0;
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
+
function J(t) {
|
|
170
171
|
if (!t || !("querySelector" in t))
|
|
171
172
|
return !1;
|
|
172
173
|
const e = t.querySelector(S) ?? t, r = (n) => !!(n && "querySelector" in n && n.querySelector(".product-price") && n.querySelector(".product-old-price"));
|
|
173
174
|
return r(e.querySelector(`[data-attribute-type="${p}"]`)) || r(e.querySelector(`[data-attribute-type="${y}"]`));
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
-
const e = {}, r =
|
|
176
|
+
function Z(t) {
|
|
177
|
+
const e = {}, r = J(t);
|
|
177
178
|
return f(t, (n, o, i) => {
|
|
178
179
|
if (i === "image" || r && (o === p || o === y))
|
|
179
180
|
return;
|
|
180
|
-
const u =
|
|
181
|
+
const u = Y(n);
|
|
181
182
|
u && (e[o] = u);
|
|
182
183
|
}), e;
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
+
function tt(t) {
|
|
185
186
|
const e = {};
|
|
186
187
|
return f(t, (r, n) => {
|
|
187
188
|
if (n !== A && n !== R || !l(r))
|
|
@@ -190,7 +191,7 @@ function Z(t) {
|
|
|
190
191
|
(o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
|
|
191
192
|
}), e;
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function et(t) {
|
|
194
195
|
const e = {};
|
|
195
196
|
if (!t || !("querySelector" in t))
|
|
196
197
|
return e;
|
|
@@ -198,28 +199,28 @@ function tt(t) {
|
|
|
198
199
|
return _(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
|
|
199
200
|
if (!l(n))
|
|
200
201
|
return;
|
|
201
|
-
const o = n
|
|
202
|
+
const o = U(n), i = n.getAttribute("data-visibility");
|
|
202
203
|
o && i != null && (e[o] = i !== "0");
|
|
203
204
|
}), e;
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
+
function at(t) {
|
|
206
207
|
return {
|
|
207
|
-
styleTemplates:
|
|
208
|
-
cardBackgroundColor:
|
|
209
|
-
cellBackgroundColors:
|
|
210
|
-
cellAlignments:
|
|
211
|
-
cellClasses:
|
|
212
|
-
omnibusTexts:
|
|
213
|
-
visibility:
|
|
208
|
+
styleTemplates: j(t),
|
|
209
|
+
cardBackgroundColor: X(t),
|
|
210
|
+
cellBackgroundColors: Q(t),
|
|
211
|
+
cellAlignments: V(t),
|
|
212
|
+
cellClasses: Z(t),
|
|
213
|
+
omnibusTexts: tt(t),
|
|
214
|
+
visibility: et(t)
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
217
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
j as captureAttributeStyleTemplates,
|
|
219
|
+
X as captureCardBackgroundColor,
|
|
220
|
+
V as captureCellAlignments,
|
|
221
|
+
Q as captureCellBackgroundColors,
|
|
222
|
+
Z as captureCellClasses,
|
|
223
|
+
tt as captureOmnibusTexts,
|
|
224
|
+
at as captureStyles,
|
|
225
|
+
et as captureVisibility
|
|
225
226
|
};
|