@useinsider/guido 3.8.0-beta.eb4074b → 3.8.1-beta.2ee94c2
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/useHtmlValidator.js +133 -180
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +57 -58
- package/dist/config/migrator/recommendation/extractors.js +22 -44
- package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
- package/dist/config/migrator/recommendationMigrator.js +31 -30
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +20 -26
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +41 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +57 -58
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +31 -43
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +45 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +56 -63
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
- package/dist/extensions/Blocks/Recommendation/extension.js +2 -3
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +12 -13
- package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -7
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/src/composables/useHtmlValidator.d.ts +0 -27
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
- package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import { CURRENCY_ATTR as
|
|
3
|
+
import { CURRENCY_ATTR as p, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as F, MOBILE_ROW_SELECTOR as N, ATTR_PRODUCT_ATTR as G, PRODUCT_ATTRIBUTE_PREFIX as R } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as S } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
6
6
|
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
@@ -8,7 +8,7 @@ import { captureStyles as k } from "../../utils/captureStyleTemplates.js";
|
|
|
8
8
|
import { formatPrice as V } from "../../utils/priceFormatter.js";
|
|
9
9
|
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as T, sanitizeImageUrl as W, toDisplayableAttributeValue as Y } from "../../templates/utils.js";
|
|
10
10
|
const M = "recommendation-block-v2";
|
|
11
|
-
function
|
|
11
|
+
function q(e) {
|
|
12
12
|
if (!e)
|
|
13
13
|
return null;
|
|
14
14
|
if ("getAttribute" in e) {
|
|
@@ -18,19 +18,15 @@ function A(e) {
|
|
|
18
18
|
}
|
|
19
19
|
return "querySelector" in e ? e.querySelector(`.${M}`) ?? null : null;
|
|
20
20
|
}
|
|
21
|
-
function X(e) {
|
|
22
|
-
const t = A(e);
|
|
23
|
-
return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(F);
|
|
24
|
-
}
|
|
25
21
|
function C(e) {
|
|
26
|
-
const t =
|
|
22
|
+
const t = q(e);
|
|
27
23
|
if (!t || !("getAttribute" in t))
|
|
28
24
|
return "grid";
|
|
29
25
|
const n = t.getAttribute("data-layout");
|
|
30
26
|
return n === "list" || n === "horizontal" ? "list" : "grid";
|
|
31
27
|
}
|
|
32
28
|
function x(e) {
|
|
33
|
-
const t =
|
|
29
|
+
const t = q(e);
|
|
34
30
|
if (!t || !("getAttribute" in t))
|
|
35
31
|
return T;
|
|
36
32
|
const n = t.getAttribute("data-card-composition");
|
|
@@ -55,25 +51,25 @@ function U(e) {
|
|
|
55
51
|
if (typeof e == "number")
|
|
56
52
|
return `0 ${e / 2}px`;
|
|
57
53
|
}
|
|
58
|
-
function
|
|
54
|
+
function K(e) {
|
|
59
55
|
const { currentNode: t, documentModifier: n } = e;
|
|
60
56
|
if (!t || !("querySelector" in t))
|
|
61
57
|
return !1;
|
|
62
58
|
const o = t.querySelector(N);
|
|
63
59
|
return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
|
|
64
60
|
}
|
|
65
|
-
function
|
|
61
|
+
function X(e) {
|
|
66
62
|
return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
|
|
67
63
|
}
|
|
68
|
-
function
|
|
64
|
+
function z(e) {
|
|
69
65
|
const t = e.querySelector(".container");
|
|
70
66
|
return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
|
|
71
67
|
}
|
|
72
|
-
function
|
|
73
|
-
const o =
|
|
68
|
+
function J(e, t, n) {
|
|
69
|
+
const o = z(e);
|
|
74
70
|
if (!o || !("childNodes" in o))
|
|
75
71
|
return;
|
|
76
|
-
const r = o.childNodes().map(
|
|
72
|
+
const r = o.childNodes().map(X).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
|
|
77
73
|
t.modifyHtml(o).setInnerHtml(r + s), t.apply(new g("Added mobile product row"));
|
|
78
74
|
}
|
|
79
75
|
function $(e, t = {}) {
|
|
@@ -88,8 +84,8 @@ function $(e, t = {}) {
|
|
|
88
84
|
return !1;
|
|
89
85
|
const u = s ?? C(n), c = S.getConfig(n);
|
|
90
86
|
if (u === "list" || !c.mobileLayoutEnabled)
|
|
91
|
-
return
|
|
92
|
-
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n),
|
|
87
|
+
return K({ currentNode: n, documentModifier: o });
|
|
88
|
+
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), y = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(a, u, {
|
|
93
89
|
productsPerRow: c.mobileCardsInRow,
|
|
94
90
|
composition: d,
|
|
95
91
|
filterList: l.filterList,
|
|
@@ -98,12 +94,12 @@ function $(e, t = {}) {
|
|
|
98
94
|
rowSpacingPx: c.mobileRowSpacing,
|
|
99
95
|
...t
|
|
100
96
|
})}</table></td>`, E = n.querySelector(N);
|
|
101
|
-
return E ? (o.modifyHtml(E).setInnerHtml(
|
|
97
|
+
return E ? (o.modifyHtml(E).setInnerHtml(y), !0) : (J(n, o, y), !1);
|
|
102
98
|
}
|
|
103
|
-
function
|
|
99
|
+
function fe(e) {
|
|
104
100
|
$(e, k(e.currentNode)) && e.documentModifier.apply(new g("Updated mobile product rows"));
|
|
105
101
|
}
|
|
106
|
-
function
|
|
102
|
+
function Q(e, t = {}) {
|
|
107
103
|
const {
|
|
108
104
|
currentNode: n,
|
|
109
105
|
documentModifier: o,
|
|
@@ -113,21 +109,21 @@ function ee(e, t = {}) {
|
|
|
113
109
|
} = e;
|
|
114
110
|
if (!n || !("querySelector" in n))
|
|
115
111
|
return !1;
|
|
116
|
-
const u = n.querySelector(w) ?? n.querySelector(
|
|
112
|
+
const u = n.querySelector(w) ?? n.querySelector(F);
|
|
117
113
|
if (!u)
|
|
118
114
|
return !1;
|
|
119
|
-
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n),
|
|
115
|
+
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), y = S.getConfig(n), E = _(l, f, {
|
|
120
116
|
productsPerRow: a,
|
|
121
117
|
composition: d,
|
|
122
118
|
filterList: c.filterList,
|
|
123
119
|
// One product per row has no gutter — suppress padding without clobbering the stored value.
|
|
124
|
-
cellPadding: a === 1 ? "0" : U(
|
|
125
|
-
rowSpacingPx:
|
|
120
|
+
cellPadding: a === 1 ? "0" : U(y.columnSpacing),
|
|
121
|
+
rowSpacingPx: y.rowSpacing,
|
|
126
122
|
...t
|
|
127
123
|
});
|
|
128
124
|
return o.modifyHtml(u).setInnerHtml(E), !0;
|
|
129
125
|
}
|
|
130
|
-
function
|
|
126
|
+
function me(e) {
|
|
131
127
|
const {
|
|
132
128
|
currentNode: t,
|
|
133
129
|
documentModifier: n,
|
|
@@ -146,10 +142,10 @@ function ye(e) {
|
|
|
146
142
|
layout: s,
|
|
147
143
|
composition: i
|
|
148
144
|
};
|
|
149
|
-
let a =
|
|
145
|
+
let a = Q(l, c);
|
|
150
146
|
a = $(l, c) || a, a && n.apply(new g("Regenerate products with styles")), o == null || o();
|
|
151
147
|
}
|
|
152
|
-
function
|
|
148
|
+
function ye(e, t) {
|
|
153
149
|
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...L(t - e.length)];
|
|
154
150
|
}
|
|
155
151
|
function B() {
|
|
@@ -163,14 +159,14 @@ function B() {
|
|
|
163
159
|
thousandSeparator: t.thousandSeparator
|
|
164
160
|
};
|
|
165
161
|
}
|
|
166
|
-
function
|
|
162
|
+
function A(e, t = "price") {
|
|
167
163
|
const n = B(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
|
|
168
164
|
return V({
|
|
169
165
|
price: r,
|
|
170
166
|
currency: n
|
|
171
167
|
});
|
|
172
168
|
}
|
|
173
|
-
function
|
|
169
|
+
function Z(e) {
|
|
174
170
|
var s, i;
|
|
175
171
|
const t = B(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((i = e.price) == null ? void 0 : i[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
176
172
|
return r > 0 ? `-${r}%` : "0%";
|
|
@@ -179,24 +175,24 @@ function v(e) {
|
|
|
179
175
|
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = e;
|
|
180
176
|
let u = !1;
|
|
181
177
|
if (o && "querySelector" in o) {
|
|
182
|
-
const c = o.querySelector("strong") ?? o.querySelector("p"), l =
|
|
178
|
+
const c = o.querySelector("strong") ?? o.querySelector("p"), l = A(n, "price");
|
|
183
179
|
b(t, c ?? null, l) && (u = !0);
|
|
184
180
|
}
|
|
185
181
|
if (r && "querySelector" in r) {
|
|
186
|
-
const c = r.querySelector("strong") ?? r.querySelector("p"), l =
|
|
182
|
+
const c = r.querySelector("strong") ?? r.querySelector("p"), l = A(n, "original_price");
|
|
187
183
|
b(t, c ?? null, l) && (u = !0);
|
|
188
184
|
}
|
|
189
185
|
if (s && "querySelector" in s) {
|
|
190
|
-
const c = s.querySelector(".omnibus-price-value") ?? null, l =
|
|
186
|
+
const c = s.querySelector(".omnibus-price-value") ?? null, l = A(n, "original_price");
|
|
191
187
|
b(t, c, l) && (u = !0);
|
|
192
188
|
}
|
|
193
189
|
if (i && "querySelector" in i) {
|
|
194
|
-
const c = i.querySelector(".omnibus-discount-value") ?? null, l =
|
|
190
|
+
const c = i.querySelector(".omnibus-discount-value") ?? null, l = Z(n);
|
|
195
191
|
b(t, c, l) && (u = !0);
|
|
196
192
|
}
|
|
197
193
|
return u;
|
|
198
194
|
}
|
|
199
|
-
function
|
|
195
|
+
function ee(e) {
|
|
200
196
|
const {
|
|
201
197
|
documentModifier: t,
|
|
202
198
|
product: n,
|
|
@@ -235,7 +231,7 @@ function ne(e) {
|
|
|
235
231
|
function j(e) {
|
|
236
232
|
return "querySelector" in e ? e.querySelector(w) ?? e : e;
|
|
237
233
|
}
|
|
238
|
-
function
|
|
234
|
+
function te(e, t) {
|
|
239
235
|
var o;
|
|
240
236
|
let n;
|
|
241
237
|
if (e.startsWith(R)) {
|
|
@@ -245,7 +241,7 @@ function oe(e, t) {
|
|
|
245
241
|
n = t[e];
|
|
246
242
|
return Y(n) || null;
|
|
247
243
|
}
|
|
248
|
-
function
|
|
244
|
+
function ne(e, t, n) {
|
|
249
245
|
if (!("querySelectorAll" in e))
|
|
250
246
|
return !1;
|
|
251
247
|
const o = e.querySelectorAll(
|
|
@@ -257,7 +253,7 @@ function re(e, t, n) {
|
|
|
257
253
|
o.forEach((i) => {
|
|
258
254
|
if (!("getAttribute" in i))
|
|
259
255
|
return;
|
|
260
|
-
const u = i.getAttribute(
|
|
256
|
+
const u = i.getAttribute(G);
|
|
261
257
|
if (!u)
|
|
262
258
|
return;
|
|
263
259
|
const c = r.get(u) ?? [];
|
|
@@ -269,7 +265,7 @@ function re(e, t, n) {
|
|
|
269
265
|
i.slice(0, c).forEach((l, a) => {
|
|
270
266
|
if (!("querySelector" in l))
|
|
271
267
|
return;
|
|
272
|
-
const d =
|
|
268
|
+
const d = te(u, n[a]);
|
|
273
269
|
if (d === null)
|
|
274
270
|
return;
|
|
275
271
|
const f = l.querySelector("p") ?? null;
|
|
@@ -277,7 +273,7 @@ function re(e, t, n) {
|
|
|
277
273
|
});
|
|
278
274
|
}), s;
|
|
279
275
|
}
|
|
280
|
-
function
|
|
276
|
+
function h(e, t, n) {
|
|
281
277
|
if (!("querySelectorAll" in e))
|
|
282
278
|
return !1;
|
|
283
279
|
const o = e.querySelectorAll(
|
|
@@ -297,7 +293,7 @@ function I(e, t, n) {
|
|
|
297
293
|
), a = Math.min(o.length, n.length);
|
|
298
294
|
let d = !1;
|
|
299
295
|
for (let f = 0; f < a; f++) {
|
|
300
|
-
const
|
|
296
|
+
const y = ee({
|
|
301
297
|
documentModifier: t,
|
|
302
298
|
product: n[f],
|
|
303
299
|
imageEl: o[f] ?? null,
|
|
@@ -308,11 +304,11 @@ function I(e, t, n) {
|
|
|
308
304
|
omnibusDiscountEl: c[f] ?? null,
|
|
309
305
|
buttonEl: l[f] ?? null
|
|
310
306
|
});
|
|
311
|
-
d = d ||
|
|
307
|
+
d = d || y;
|
|
312
308
|
}
|
|
313
|
-
return
|
|
309
|
+
return ne(e, t, n) && (d = !0), d;
|
|
314
310
|
}
|
|
315
|
-
function
|
|
311
|
+
function pe(e) {
|
|
316
312
|
const { currentNode: t, documentModifier: n, products: o } = e;
|
|
317
313
|
if (!t || !("querySelectorAll" in t))
|
|
318
314
|
return !1;
|
|
@@ -321,12 +317,12 @@ function ge(e) {
|
|
|
321
317
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
322
318
|
).length !== o.length)
|
|
323
319
|
return !1;
|
|
324
|
-
let i =
|
|
320
|
+
let i = h(r, n, o);
|
|
325
321
|
const u = C(t), c = S.getConfig(t);
|
|
326
322
|
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
327
323
|
const l = t.querySelector(O);
|
|
328
324
|
if (l) {
|
|
329
|
-
const a =
|
|
325
|
+
const a = h(
|
|
330
326
|
l,
|
|
331
327
|
n,
|
|
332
328
|
o
|
|
@@ -336,7 +332,7 @@ function ge(e) {
|
|
|
336
332
|
}
|
|
337
333
|
return i && n.apply(new g("Updated product content in-place")), !0;
|
|
338
334
|
}
|
|
339
|
-
function
|
|
335
|
+
function I(e, t, n) {
|
|
340
336
|
if (!("querySelectorAll" in e))
|
|
341
337
|
return !1;
|
|
342
338
|
const o = e.querySelectorAll(
|
|
@@ -360,47 +356,44 @@ function h(e, t, n) {
|
|
|
360
356
|
}) && (c = !0);
|
|
361
357
|
return c;
|
|
362
358
|
}
|
|
363
|
-
function
|
|
359
|
+
function be(e) {
|
|
364
360
|
const { currentNode: t, documentModifier: n } = e;
|
|
365
361
|
if (!t || !("querySelectorAll" in t))
|
|
366
362
|
return !1;
|
|
367
|
-
if (X(t))
|
|
368
|
-
return !0;
|
|
369
363
|
const r = P().recommendationProducts;
|
|
370
364
|
if (r.length === 0)
|
|
371
365
|
return !1;
|
|
372
366
|
const s = j(t);
|
|
373
|
-
let i =
|
|
367
|
+
let i = I(s, n, r);
|
|
374
368
|
const u = C(t), c = S.getConfig(t);
|
|
375
369
|
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
376
370
|
const l = t.querySelector(O);
|
|
377
371
|
if (l) {
|
|
378
|
-
const a =
|
|
372
|
+
const a = I(l, n, r);
|
|
379
373
|
i = i || a;
|
|
380
374
|
}
|
|
381
375
|
}
|
|
382
376
|
return i && n.apply(new g("Updated price formatting in-place")), i;
|
|
383
377
|
}
|
|
384
|
-
function
|
|
385
|
-
const { currentNode: t, documentModifier: n, currency: o } = e, r =
|
|
378
|
+
function ge(e) {
|
|
379
|
+
const { currentNode: t, documentModifier: n, currency: o } = e, r = q(t);
|
|
386
380
|
if (!r)
|
|
387
381
|
return;
|
|
388
382
|
const s = o.alignment === "before" ? "0" : "1", i = (u, c) => {
|
|
389
383
|
n.modifyHtml(r).setAttribute(u, c);
|
|
390
384
|
};
|
|
391
|
-
i(
|
|
385
|
+
i(p.CURRENCY, o.code), i(p.SYMBOL, o.symbol), i(p.ALIGNMENT, s), i(p.THOUSAND_SEPARATOR, o.thousandSeparator), i(p.DECIMAL_SEPARATOR, o.decimalSeparator), i(p.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new g("Update currency attributes"));
|
|
392
386
|
}
|
|
393
387
|
export {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
388
|
+
ye as adjustProductsToSize,
|
|
389
|
+
A as formatProductPrice,
|
|
390
|
+
q as getBlockElement,
|
|
397
391
|
x as getCardComposition,
|
|
398
392
|
C as getCurrentLayout,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
ne as updateSingleProductContent
|
|
393
|
+
fe as regenerateMobileProductRows,
|
|
394
|
+
me as regenerateProductRowsWithStyles,
|
|
395
|
+
ge as setCurrencyAttributes,
|
|
396
|
+
be as updatePricesInPlace,
|
|
397
|
+
pe as updateProductContentInPlace,
|
|
398
|
+
ee as updateSingleProductContent
|
|
406
399
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var a = (o, e, t) =>
|
|
4
|
-
import { UIElementType as c, UEAttr as
|
|
2
|
+
var _ = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UIElementType as c, UEAttr as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as d } from "../../common-control.js";
|
|
6
6
|
import { RecommendationControlId as C } from "../constants/controlIds.js";
|
|
7
|
-
import "../constants/selectors.js";
|
|
8
7
|
const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
|
|
9
|
-
class
|
|
8
|
+
class h extends d {
|
|
10
9
|
constructor() {
|
|
11
10
|
super(...arguments);
|
|
12
11
|
a(this, "_repositionedElement", null);
|
|
@@ -18,7 +17,7 @@ class O extends d {
|
|
|
18
17
|
return `
|
|
19
18
|
<div class="${r}">
|
|
20
19
|
<${c.ICON}
|
|
21
|
-
${
|
|
20
|
+
${p.ICON.src}="migration-info-icon"
|
|
22
21
|
class="${r}__icon">
|
|
23
22
|
</${c.ICON}>
|
|
24
23
|
<p class="${r}__text">
|
|
@@ -62,5 +61,5 @@ class O extends d {
|
|
|
62
61
|
}
|
|
63
62
|
export {
|
|
64
63
|
S as SYNC_INFO_MESSAGE_CONTROL_ID,
|
|
65
|
-
|
|
64
|
+
h as SyncInfoMessageControl
|
|
66
65
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlock as m } from "./block.js";
|
|
3
3
|
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
4
|
-
import "./constants/selectors.js";
|
|
5
4
|
import "./store/recommendation.js";
|
|
6
5
|
import "./utils/captureStyleTemplates.js";
|
|
7
6
|
import { NameControls as i } from "./controls/name/index.js";
|
|
@@ -37,10 +36,10 @@ const b = [
|
|
|
37
36
|
], S = [
|
|
38
37
|
...P,
|
|
39
38
|
...b.flatMap((o) => Object.values(o))
|
|
40
|
-
],
|
|
39
|
+
], L = S.reduce(
|
|
41
40
|
(o, t) => o.addControl(t),
|
|
42
41
|
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
43
42
|
).addStyles(y).withIconsRegistry(R).build();
|
|
44
43
|
export {
|
|
45
|
-
|
|
44
|
+
L as default
|
|
46
45
|
};
|
|
@@ -2,7 +2,6 @@ import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, Co
|
|
|
2
2
|
import { BLOCK_ID as U } from "./block.js";
|
|
3
3
|
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
|
-
import "./constants/selectors.js";
|
|
6
5
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
7
6
|
import "./store/recommendation.js";
|
|
8
7
|
import "./utils/captureStyleTemplates.js";
|
|
@@ -17,7 +16,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
|
17
16
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
18
17
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
19
18
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
20
|
-
class
|
|
19
|
+
class a extends E {
|
|
21
20
|
registerBlockControls(I) {
|
|
22
21
|
I[U] = [
|
|
23
22
|
new _(
|
|
@@ -196,5 +195,5 @@ class d extends E {
|
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
export {
|
|
199
|
-
|
|
198
|
+
a as SettingsPanel
|
|
200
199
|
};
|
|
@@ -2,7 +2,6 @@ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAtt
|
|
|
2
2
|
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as F } from "pinia";
|
|
5
|
-
import "../constants/selectors.js";
|
|
6
5
|
import { DEFAULT_MOBILE_CARDS_IN_ROW as P, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
|
|
7
6
|
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
8
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
@@ -61,7 +60,7 @@ const L = () => ({
|
|
|
61
60
|
blockStates: {},
|
|
62
61
|
currentRecommendationId: null,
|
|
63
62
|
configVersion: 0
|
|
64
|
-
}),
|
|
63
|
+
}), K = F("guidoRecommendationExtension", {
|
|
65
64
|
state: () => L(),
|
|
66
65
|
getters: {
|
|
67
66
|
// ====================================================================
|
|
@@ -477,5 +476,5 @@ const L = () => ({
|
|
|
477
476
|
}
|
|
478
477
|
});
|
|
479
478
|
export {
|
|
480
|
-
|
|
479
|
+
K as useRecommendationExtensionStore
|
|
481
480
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../../constants/selectors.js";
|
|
2
1
|
import { DEFAULT_PRODUCTS_PER_ROW as f } from "../../constants/layout.js";
|
|
3
2
|
import { getDefaultProducts as A, DEFAULTS as C, createBlockTemplate as g, buildSpacer as P, DEFAULT_CARD_COMPOSITION as O, buildElementRenderer as U, DEFAULT_CARD_VISIBILITY as Y } from "../utils.js";
|
|
4
3
|
import { DEFAULT_CELL_PADDING as h, buildFillerCell as B, gridElementRenderer as F } from "./elementRenderer.js";
|
|
@@ -30,34 +29,34 @@ const W = `
|
|
|
30
29
|
`;
|
|
31
30
|
function H(e, r, c, o = O, n = {}, p = {}) {
|
|
32
31
|
const {
|
|
33
|
-
cellPadding:
|
|
32
|
+
cellPadding: i = h,
|
|
34
33
|
styleTemplates: s,
|
|
35
34
|
cardBackgroundColor: T,
|
|
36
35
|
cellBackgroundColors: l,
|
|
37
36
|
cellAlignments: d,
|
|
38
37
|
cellClasses: u,
|
|
39
|
-
omnibusTexts:
|
|
38
|
+
omnibusTexts: a,
|
|
40
39
|
visibility: R
|
|
41
|
-
} = p, m = (100 / r).toFixed(2), I = r - e.length, S = I > 0 ? B(m,
|
|
40
|
+
} = p, m = (100 / r).toFixed(2), I = r - e.length, S = I > 0 ? B(m, i).repeat(I) : "", L = U(c, o, n);
|
|
42
41
|
return o.filter((t) => L[t]).map((t) => {
|
|
43
42
|
const E = (R == null ? void 0 : R[t]) ?? Y[t] ?? !0, b = E ? "" : 'style="display: none;"', _ = {
|
|
44
|
-
cellPadding:
|
|
43
|
+
cellPadding: i,
|
|
45
44
|
cardBackgroundColor: T,
|
|
46
45
|
cellBackgroundColor: l == null ? void 0 : l[t],
|
|
47
46
|
cellAlignment: d == null ? void 0 : d[t],
|
|
48
47
|
cellClasses: u == null ? void 0 : u[t],
|
|
49
|
-
omnibusText:
|
|
48
|
+
omnibusText: a == null ? void 0 : a[t],
|
|
50
49
|
styleTemplate: s == null ? void 0 : s[t]
|
|
51
50
|
}, w = e.map((D) => L[t](D, _).replace("<td", `<td width="${m}%"`)).join("");
|
|
52
51
|
return k.replace("{-{-ATTR_TYPE-}-}", t).replace("{-{-VISIBILITY-}-}", E ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", w + S);
|
|
53
52
|
}).join("");
|
|
54
53
|
}
|
|
55
54
|
function x(e, r, c, o, n = {}, p = {}) {
|
|
56
|
-
const
|
|
55
|
+
const i = [];
|
|
57
56
|
for (let l = 0; l < e.length; l += r)
|
|
58
|
-
|
|
57
|
+
i.push(e.slice(l, l + r));
|
|
59
58
|
const s = P(p.rowSpacingPx);
|
|
60
|
-
return
|
|
59
|
+
return i.map((l, d) => {
|
|
61
60
|
const u = H(
|
|
62
61
|
l,
|
|
63
62
|
r,
|
|
@@ -65,8 +64,8 @@ function x(e, r, c, o, n = {}, p = {}) {
|
|
|
65
64
|
o,
|
|
66
65
|
n,
|
|
67
66
|
p
|
|
68
|
-
),
|
|
69
|
-
return d > 0 ? s +
|
|
67
|
+
), a = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
|
|
68
|
+
return d > 0 ? s + a : a;
|
|
70
69
|
}).join("");
|
|
71
70
|
}
|
|
72
71
|
function V(e, r, c, o = {}, n = {}) {
|
|
@@ -79,12 +78,12 @@ function V(e, r, c, o = {}, n = {}) {
|
|
|
79
78
|
n
|
|
80
79
|
);
|
|
81
80
|
}
|
|
82
|
-
function
|
|
81
|
+
function $(e) {
|
|
83
82
|
const r = e ? `ins-recommendation-v3-block-${e}` : void 0, c = g("grid", r), o = A(), n = V(o, f);
|
|
84
83
|
return c.replace("{-{-TITLE-}-}", C.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
85
84
|
}
|
|
86
85
|
export {
|
|
87
|
-
|
|
86
|
+
$ as getDefaultTemplate,
|
|
88
87
|
H as prepareGridAttributeRows,
|
|
89
88
|
x as prepareGridProductRows,
|
|
90
89
|
V as prepareProductRows
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import "../constants/selectors.js";
|
|
2
1
|
import { DEFAULT_PRODUCTS_PER_ROW as f } from "../constants/layout.js";
|
|
3
2
|
import { prepareProductRows as w } from "./grid/template.js";
|
|
4
3
|
import { prepareProductRows as g } from "./list/template.js";
|
|
5
|
-
function
|
|
4
|
+
function L(o, t, r = {}) {
|
|
6
5
|
const {
|
|
7
6
|
cellPadding: s,
|
|
8
7
|
rowSpacingPx: i,
|
|
@@ -11,8 +10,8 @@ function O(o, t, r = {}) {
|
|
|
11
10
|
cellBackgroundColors: p,
|
|
12
11
|
cellAlignments: n,
|
|
13
12
|
cellClasses: a,
|
|
14
|
-
omnibusTexts:
|
|
15
|
-
visibility:
|
|
13
|
+
omnibusTexts: d,
|
|
14
|
+
visibility: m
|
|
16
15
|
} = r, e = {
|
|
17
16
|
cellPadding: s,
|
|
18
17
|
rowSpacingPx: i,
|
|
@@ -21,8 +20,8 @@ function O(o, t, r = {}) {
|
|
|
21
20
|
cellBackgroundColors: p,
|
|
22
21
|
cellAlignments: n,
|
|
23
22
|
cellClasses: a,
|
|
24
|
-
omnibusTexts:
|
|
25
|
-
visibility:
|
|
23
|
+
omnibusTexts: d,
|
|
24
|
+
visibility: m
|
|
26
25
|
};
|
|
27
26
|
if (t === "list")
|
|
28
27
|
return g(o, r.composition, r.filterList, e);
|
|
@@ -30,5 +29,5 @@ function O(o, t, r = {}) {
|
|
|
30
29
|
return w(o, u, P, R, e);
|
|
31
30
|
}
|
|
32
31
|
export {
|
|
33
|
-
|
|
32
|
+
L as prepareProductRows
|
|
34
33
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ATTR_CUSTOM_PREFIX as c,
|
|
1
|
+
import { ATTR_CUSTOM_PREFIX as c, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as m, PRODUCT_ATTRIBUTE_PREFIX as l } from "../constants/selectors.js";
|
|
2
2
|
function U(t) {
|
|
3
3
|
return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
|
|
4
4
|
}
|
|
@@ -1,31 +1,4 @@
|
|
|
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[];
|
|
29
2
|
export declare const useHtmlValidator: () => {
|
|
30
3
|
validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
|
|
31
4
|
};
|
|
@@ -5,18 +5,3 @@ 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,12 +8,4 @@ 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;
|
|
19
11
|
}): string;
|
|
@@ -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,
|
|
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';
|
|
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';
|