@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.1e8f93e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +66 -70
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Items/block.js +48 -29
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
- package/dist/extensions/Blocks/Recommendation/block.js +41 -60
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +84 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +80 -82
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/stores/config.d.ts +0 -36
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -100
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
import { ModificationDescription as p } 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 g, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as
|
|
3
|
+
import { CURRENCY_ATTR as g, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as j } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as b } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import { getDefaultProducts as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
6
|
+
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as V } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as W } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as T, sanitizeImageUrl as F, toDisplayableAttributeValue as G } from "../../templates/utils.js";
|
|
10
|
+
const h = "recommendation-block-v2";
|
|
11
|
+
function R(t) {
|
|
12
12
|
if (!t)
|
|
13
13
|
return null;
|
|
14
14
|
if ("getAttribute" in t) {
|
|
15
15
|
const e = t.getAttribute("class");
|
|
16
|
-
if (e && e.includes(
|
|
16
|
+
if (e && e.includes(h))
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${h}`) ?? null : null;
|
|
20
20
|
}
|
|
21
21
|
function E(t) {
|
|
22
|
-
const e =
|
|
22
|
+
const e = R(t);
|
|
23
23
|
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
25
|
const o = e.getAttribute("data-layout");
|
|
26
26
|
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const e =
|
|
28
|
+
function H(t) {
|
|
29
|
+
const e = R(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
31
|
+
return T;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : T;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function x(t) {
|
|
36
36
|
if (!t || !("childNodes" in t))
|
|
37
37
|
return null;
|
|
38
38
|
const e = t.childNodes(), o = e.find(
|
|
39
39
|
(n) => "getType" in n && n.getType() === "text"
|
|
40
40
|
);
|
|
41
|
-
return o || e.reduce((n, r) => n || !("getType" in r) || r.getType() === "text" ? n :
|
|
41
|
+
return o || e.reduce((n, r) => n || !("getType" in r) || r.getType() === "text" ? n : x(r), null);
|
|
42
42
|
}
|
|
43
43
|
function S(t, e, o) {
|
|
44
|
-
const n =
|
|
44
|
+
const n = x(e);
|
|
45
45
|
return n ? (t.modifyHtml(n).setText(o), !0) : !1;
|
|
46
46
|
}
|
|
47
47
|
function D(t, e) {
|
|
48
|
-
return t && t.length > 0 ? t : e.length > 0 ? e :
|
|
48
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Y(t) {
|
|
51
51
|
const { currentNode: e, documentModifier: o } = t;
|
|
52
52
|
if (!e || !("querySelector" in e))
|
|
53
53
|
return;
|
|
54
54
|
const n = e.querySelector(k);
|
|
55
55
|
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function K(t) {
|
|
58
58
|
return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function X(t) {
|
|
61
61
|
const e = t.querySelector(".container");
|
|
62
62
|
return !e || !("childNodes" in e) ? null : e.childNodes().find((n) => "getTagName" in n && n.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const n =
|
|
64
|
+
function z(t, e, o) {
|
|
65
|
+
const n = X(t);
|
|
66
66
|
if (!n || !("childNodes" in n))
|
|
67
67
|
return;
|
|
68
|
-
const r = n.childNodes().map(
|
|
68
|
+
const r = n.childNodes().map(K).join(""), l = `<tr class="ins-recommendation-mobile-row">${o}</tr>`;
|
|
69
69
|
e.modifyHtml(n).setInnerHtml(r + l), e.apply(new p("Added mobile product row"));
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function J(t) {
|
|
72
72
|
const {
|
|
73
73
|
currentNode: e,
|
|
74
74
|
documentModifier: o,
|
|
@@ -80,22 +80,21 @@ function Q(t) {
|
|
|
80
80
|
return;
|
|
81
81
|
const i = r ?? E(e), s = b.getConfig(e);
|
|
82
82
|
if (i === "list" || !s.mobileLayoutEnabled) {
|
|
83
|
-
|
|
83
|
+
Y({ currentNode: e, documentModifier: o });
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
const u = C(), c = D(n, u.recommendationProducts), d = l ??
|
|
86
|
+
const u = C(), c = D(n, u.recommendationProducts), d = l ?? H(e), a = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(c, i, {
|
|
87
87
|
productsPerRow: s.mobileCardsInRow,
|
|
88
88
|
composition: d,
|
|
89
|
-
filterList: u.filterList
|
|
90
|
-
priceInline: !s.priceMovedToNextLine
|
|
89
|
+
filterList: u.filterList
|
|
91
90
|
})}</table></td>`, y = e.querySelector(k);
|
|
92
91
|
if (!y) {
|
|
93
|
-
|
|
92
|
+
z(e, o, a);
|
|
94
93
|
return;
|
|
95
94
|
}
|
|
96
95
|
o.modifyHtml(y).setInnerHtml(a), o.apply(new p("Updated mobile product rows"));
|
|
97
96
|
}
|
|
98
|
-
function
|
|
97
|
+
function Q(t) {
|
|
99
98
|
const {
|
|
100
99
|
currentNode: e,
|
|
101
100
|
documentModifier: o,
|
|
@@ -106,18 +105,17 @@ function Z(t) {
|
|
|
106
105
|
} = t;
|
|
107
106
|
if (!e || !("querySelector" in e))
|
|
108
107
|
return;
|
|
109
|
-
const s = e.querySelector(P) ?? e.querySelector(
|
|
108
|
+
const s = e.querySelector(P) ?? e.querySelector(v);
|
|
110
109
|
if (!s)
|
|
111
110
|
return;
|
|
112
|
-
const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ??
|
|
111
|
+
const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ?? H(e), a = l ?? E(e), y = _(c, a, {
|
|
113
112
|
productsPerRow: d,
|
|
114
113
|
composition: f,
|
|
115
|
-
filterList: u.filterList
|
|
116
|
-
priceInline: !y
|
|
114
|
+
filterList: u.filterList
|
|
117
115
|
});
|
|
118
|
-
o.modifyHtml(s).setInnerHtml(
|
|
116
|
+
o.modifyHtml(s).setInnerHtml(y).apply(new p("Updated product")), J(t), n == null || n();
|
|
119
117
|
}
|
|
120
|
-
function
|
|
118
|
+
function M(t, e, o, n) {
|
|
121
119
|
const l = `0 ${Math.floor(o / 2)}px`;
|
|
122
120
|
let i = !1;
|
|
123
121
|
return n === "grid" ? Array.from(
|
|
@@ -128,7 +126,7 @@ function h(t, e, o, n) {
|
|
|
128
126
|
t.querySelectorAll(".product-card-wrapper")
|
|
129
127
|
).forEach((u) => {
|
|
130
128
|
const c = "parentNode" in u ? u.parentNode : null;
|
|
131
|
-
c &&
|
|
129
|
+
c && W(c) && (e.modifyHtml(c).setStyle("padding", l), i = !0);
|
|
132
130
|
}), i;
|
|
133
131
|
}
|
|
134
132
|
function I(t, e, o) {
|
|
@@ -138,7 +136,7 @@ function I(t, e, o) {
|
|
|
138
136
|
e.modifyHtml(i).setStyle("height", n), l = !0;
|
|
139
137
|
}), l;
|
|
140
138
|
}
|
|
141
|
-
function
|
|
139
|
+
function Z(t) {
|
|
142
140
|
const { currentNode: e, documentModifier: o } = t;
|
|
143
141
|
if (!e)
|
|
144
142
|
return;
|
|
@@ -146,7 +144,7 @@ function ee(t) {
|
|
|
146
144
|
let l = !1;
|
|
147
145
|
const i = e.querySelector(P);
|
|
148
146
|
if (i) {
|
|
149
|
-
l =
|
|
147
|
+
l = M(
|
|
150
148
|
i,
|
|
151
149
|
o,
|
|
152
150
|
n.columnSpacing,
|
|
@@ -161,7 +159,7 @@ function ee(t) {
|
|
|
161
159
|
}
|
|
162
160
|
const s = e.querySelector(q);
|
|
163
161
|
if (s) {
|
|
164
|
-
const u =
|
|
162
|
+
const u = M(
|
|
165
163
|
s,
|
|
166
164
|
o,
|
|
167
165
|
n.mobileColumnSpacing,
|
|
@@ -177,9 +175,9 @@ function ee(t) {
|
|
|
177
175
|
}
|
|
178
176
|
l && o.apply(new p("Reapply spacing after regeneration"));
|
|
179
177
|
}
|
|
180
|
-
function
|
|
178
|
+
function me(t) {
|
|
181
179
|
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: l, composition: i } = t;
|
|
182
|
-
e &&
|
|
180
|
+
e && Q({
|
|
183
181
|
currentNode: e,
|
|
184
182
|
documentModifier: o,
|
|
185
183
|
products: r,
|
|
@@ -187,13 +185,13 @@ function pe(t) {
|
|
|
187
185
|
composition: i,
|
|
188
186
|
afterRegenerate: () => {
|
|
189
187
|
setTimeout(() => {
|
|
190
|
-
|
|
188
|
+
Z({ currentNode: e, documentModifier: o });
|
|
191
189
|
}, 0), n == null || n();
|
|
192
190
|
}
|
|
193
191
|
});
|
|
194
192
|
}
|
|
195
|
-
function
|
|
196
|
-
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...
|
|
193
|
+
function pe(t, e) {
|
|
194
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
197
195
|
}
|
|
198
196
|
function U() {
|
|
199
197
|
const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
@@ -208,12 +206,12 @@ function U() {
|
|
|
208
206
|
}
|
|
209
207
|
function A(t, e = "price") {
|
|
210
208
|
const o = U(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
211
|
-
return
|
|
209
|
+
return V({
|
|
212
210
|
price: r,
|
|
213
211
|
currency: o
|
|
214
212
|
});
|
|
215
213
|
}
|
|
216
|
-
function
|
|
214
|
+
function ee(t) {
|
|
217
215
|
var l, i;
|
|
218
216
|
const e = U(), o = ((l = t.original_price) == null ? void 0 : l[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
219
217
|
return r > 0 ? `-${r}%` : "0%";
|
|
@@ -234,12 +232,12 @@ function $(t) {
|
|
|
234
232
|
S(e, u, c) && (s = !0);
|
|
235
233
|
}
|
|
236
234
|
if (i && "querySelector" in i) {
|
|
237
|
-
const u = i.querySelector(".omnibus-discount-value") ?? null, c =
|
|
235
|
+
const u = i.querySelector(".omnibus-discount-value") ?? null, c = ee(o);
|
|
238
236
|
S(e, u, c) && (s = !0);
|
|
239
237
|
}
|
|
240
238
|
return s;
|
|
241
239
|
}
|
|
242
|
-
function
|
|
240
|
+
function te(t) {
|
|
243
241
|
const {
|
|
244
242
|
documentModifier: e,
|
|
245
243
|
product: o,
|
|
@@ -254,7 +252,7 @@ function oe(t) {
|
|
|
254
252
|
let d = !1;
|
|
255
253
|
if (n && "querySelector" in n) {
|
|
256
254
|
const f = n.querySelector("img");
|
|
257
|
-
f && (e.modifyHtml(f).setAttribute("src",
|
|
255
|
+
f && (e.modifyHtml(f).setAttribute("src", F(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
258
256
|
const a = n.querySelector("a");
|
|
259
257
|
a && (e.modifyHtml(a).setAttribute("href", o.url), d = !0);
|
|
260
258
|
}
|
|
@@ -278,18 +276,18 @@ function oe(t) {
|
|
|
278
276
|
function B(t) {
|
|
279
277
|
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
280
278
|
}
|
|
281
|
-
const
|
|
282
|
-
function
|
|
279
|
+
const O = "product_attribute.";
|
|
280
|
+
function oe(t, e) {
|
|
283
281
|
var n;
|
|
284
282
|
let o;
|
|
285
|
-
if (t.startsWith(
|
|
286
|
-
const r = t.slice(
|
|
283
|
+
if (t.startsWith(O)) {
|
|
284
|
+
const r = t.slice(O.length);
|
|
287
285
|
o = (n = e.product_attributes) == null ? void 0 : n[r];
|
|
288
286
|
} else
|
|
289
287
|
o = e[t];
|
|
290
|
-
return
|
|
288
|
+
return G(o) || null;
|
|
291
289
|
}
|
|
292
|
-
function
|
|
290
|
+
function ne(t, e, o) {
|
|
293
291
|
if (!("querySelectorAll" in t))
|
|
294
292
|
return !1;
|
|
295
293
|
const n = t.querySelectorAll(
|
|
@@ -301,7 +299,7 @@ function re(t, e, o) {
|
|
|
301
299
|
n.forEach((i) => {
|
|
302
300
|
if (!("getAttribute" in i))
|
|
303
301
|
return;
|
|
304
|
-
const s = i.getAttribute(
|
|
302
|
+
const s = i.getAttribute(j);
|
|
305
303
|
if (!s)
|
|
306
304
|
return;
|
|
307
305
|
const u = r.get(s) ?? [];
|
|
@@ -313,7 +311,7 @@ function re(t, e, o) {
|
|
|
313
311
|
i.slice(0, u).forEach((c, d) => {
|
|
314
312
|
if (!("querySelector" in c))
|
|
315
313
|
return;
|
|
316
|
-
const f =
|
|
314
|
+
const f = oe(s, o[d]);
|
|
317
315
|
if (f === null)
|
|
318
316
|
return;
|
|
319
317
|
const a = c.querySelector("p") ?? null;
|
|
@@ -321,7 +319,7 @@ function re(t, e, o) {
|
|
|
321
319
|
});
|
|
322
320
|
}), l;
|
|
323
321
|
}
|
|
324
|
-
function
|
|
322
|
+
function w(t, e, o) {
|
|
325
323
|
if (!("querySelectorAll" in t))
|
|
326
324
|
return !1;
|
|
327
325
|
const n = t.querySelectorAll(
|
|
@@ -341,7 +339,7 @@ function O(t, e, o) {
|
|
|
341
339
|
), d = Math.min(n.length, o.length);
|
|
342
340
|
let f = !1;
|
|
343
341
|
for (let a = 0; a < d; a++) {
|
|
344
|
-
const y =
|
|
342
|
+
const y = te({
|
|
345
343
|
documentModifier: e,
|
|
346
344
|
product: o[a],
|
|
347
345
|
imageEl: n[a] ?? null,
|
|
@@ -354,9 +352,9 @@ function O(t, e, o) {
|
|
|
354
352
|
});
|
|
355
353
|
f = f || y;
|
|
356
354
|
}
|
|
357
|
-
return
|
|
355
|
+
return ne(t, e, o) && (f = !0), f;
|
|
358
356
|
}
|
|
359
|
-
function
|
|
357
|
+
function ye(t) {
|
|
360
358
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
361
359
|
if (!e || !("querySelectorAll" in e))
|
|
362
360
|
return !1;
|
|
@@ -365,12 +363,12 @@ function ge(t) {
|
|
|
365
363
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
366
364
|
).length !== n.length)
|
|
367
365
|
return !1;
|
|
368
|
-
let i =
|
|
366
|
+
let i = w(r, o, n);
|
|
369
367
|
const s = E(e), u = b.getConfig(e);
|
|
370
368
|
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
371
369
|
const c = e.querySelector(q);
|
|
372
370
|
if (c) {
|
|
373
|
-
const d =
|
|
371
|
+
const d = w(
|
|
374
372
|
c,
|
|
375
373
|
o,
|
|
376
374
|
n
|
|
@@ -380,7 +378,7 @@ function ge(t) {
|
|
|
380
378
|
}
|
|
381
379
|
return i && o.apply(new p("Updated product content in-place")), !0;
|
|
382
380
|
}
|
|
383
|
-
function
|
|
381
|
+
function N(t, e, o) {
|
|
384
382
|
if (!("querySelectorAll" in t))
|
|
385
383
|
return !1;
|
|
386
384
|
const n = t.querySelectorAll(
|
|
@@ -404,7 +402,7 @@ function w(t, e, o) {
|
|
|
404
402
|
}) && (u = !0);
|
|
405
403
|
return u;
|
|
406
404
|
}
|
|
407
|
-
function
|
|
405
|
+
function ge(t) {
|
|
408
406
|
const { currentNode: e, documentModifier: o } = t;
|
|
409
407
|
if (!e || !("querySelectorAll" in e))
|
|
410
408
|
return !1;
|
|
@@ -412,19 +410,19 @@ function Se(t) {
|
|
|
412
410
|
if (r.length === 0)
|
|
413
411
|
return !1;
|
|
414
412
|
const l = B(e);
|
|
415
|
-
let i =
|
|
413
|
+
let i = N(l, o, r);
|
|
416
414
|
const s = E(e), u = b.getConfig(e);
|
|
417
415
|
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
418
416
|
const c = e.querySelector(q);
|
|
419
417
|
if (c) {
|
|
420
|
-
const d =
|
|
418
|
+
const d = N(c, o, r);
|
|
421
419
|
i = i || d;
|
|
422
420
|
}
|
|
423
421
|
}
|
|
424
422
|
return i && o.apply(new p("Updated price formatting in-place")), i;
|
|
425
423
|
}
|
|
426
|
-
function
|
|
427
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, r =
|
|
424
|
+
function Se(t) {
|
|
425
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, r = R(e);
|
|
428
426
|
if (!r)
|
|
429
427
|
return;
|
|
430
428
|
const l = n.alignment === "before" ? "0" : "1", i = (s, u) => {
|
|
@@ -433,17 +431,17 @@ function be(t) {
|
|
|
433
431
|
i(g.CURRENCY, n.code), i(g.SYMBOL, n.symbol), i(g.ALIGNMENT, l), i(g.THOUSAND_SEPARATOR, n.thousandSeparator), i(g.DECIMAL_SEPARATOR, n.decimalSeparator), i(g.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
434
432
|
}
|
|
435
433
|
export {
|
|
436
|
-
|
|
434
|
+
pe as adjustProductsToSize,
|
|
437
435
|
A as formatProductPrice,
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
R as getBlockElement,
|
|
437
|
+
H as getCardComposition,
|
|
440
438
|
E as getCurrentLayout,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
439
|
+
Z as reapplySpacing,
|
|
440
|
+
J as regenerateMobileProductRows,
|
|
441
|
+
Q as regenerateProductRows,
|
|
442
|
+
me as regenerateProductRowsWithStyles,
|
|
443
|
+
Se as setCurrencyAttributes,
|
|
444
|
+
ge as updatePricesInPlace,
|
|
445
|
+
ye as updateProductContentInPlace,
|
|
446
|
+
te as updateSingleProductContent
|
|
449
447
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import r from "../../../static/assets/info.svg.js";
|
|
2
|
-
import { IconsRegistry as
|
|
3
|
-
class h extends
|
|
4
|
-
registerIconsSvg(
|
|
5
|
-
|
|
2
|
+
import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
class h extends t {
|
|
4
|
+
registerIconsSvg(C) {
|
|
5
|
+
C["recommendation-icon"] = `
|
|
6
6
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
7
7
|
<path d="M10 4.4C10 4.73137 9.73012 4.99622 9.40108 5.0355C6.92202 5.33143 5 7.44126 5 10C5 12.5587
|
|
8
8
|
6.92202 14.6686 9.40108 14.9645C9.73012 15.0038 10 15.2686 10 15.6V18.4C10 18.7314 9.73137 19 9.4
|
|
@@ -44,14 +44,14 @@ class h extends C {
|
|
|
44
44
|
3.40029 12.0082 3.25285 11.7656 3.15234C11.365 2.98638 11.0001 2.64849 11 2.21484V2Z"
|
|
45
45
|
fill="currentColor"/>
|
|
46
46
|
</svg>
|
|
47
|
-
`,
|
|
47
|
+
`, C["grid-orientation"] = `
|
|
48
48
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
49
49
|
<rect x="1" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
50
50
|
<rect x="12" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
51
51
|
<rect x="1" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
52
52
|
<rect x="12" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
53
53
|
</svg>
|
|
54
|
-
`,
|
|
54
|
+
`, C["list-orientation"] = `
|
|
55
55
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
56
56
|
<circle cx="3" cy="4" r="1" stroke="currentColor" stroke-width="1"/>
|
|
57
57
|
<rect x="7" y="3" width="11" height="2" rx="1"/>
|
|
@@ -60,21 +60,7 @@ class h extends C {
|
|
|
60
60
|
<circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
|
|
61
61
|
<rect x="7" y="15" width="11" height="2" rx="1"/>
|
|
62
62
|
</svg>
|
|
63
|
-
`,
|
|
64
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
65
|
-
<path d="M19 10V16C19 16.5523 18.5523 17 18 17H2C1.44772 17 1 16.5523 1 16V10H19Z"
|
|
66
|
-
stroke="currentColor" stroke-width="2" fill="none"/>
|
|
67
|
-
<path d="M2 3H18C18.5523 3 19 3.44772 19 4V10H1V4C1 3.44772 1.44772 3 2 3Z" stroke="currentColor"
|
|
68
|
-
stroke-width="2" fill="none"/>
|
|
69
|
-
</svg>
|
|
70
|
-
`, t["horizontal-orientation"] = `
|
|
71
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
72
|
-
<path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
|
|
73
|
-
stroke-width="2" fill="none"/>
|
|
74
|
-
<path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
|
|
75
|
-
stroke-width="2" fill="none"/>
|
|
76
|
-
</svg>
|
|
77
|
-
`, t["migration-info-icon"] = r;
|
|
63
|
+
`, C["migration-info-icon"] = r;
|
|
78
64
|
}
|
|
79
65
|
}
|
|
80
66
|
export {
|
|
@@ -18,13 +18,6 @@ const n = `/* Utils */
|
|
|
18
18
|
padding: 0
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/* Group the two price-placement rows (orientation + hide-if-same) into one
|
|
22
|
-
container — drop the divider the editor adds between stacked setting rows.
|
|
23
|
-
Ancestor added so this out-specifies the editor's \`.two-columns:not(:first-child)\`. */
|
|
24
|
-
.recommendation-controls-container .price-placement-control-container .container.two-columns {
|
|
25
|
-
border-top: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
21
|
/* Right-align the mobile layout toggle within the two-column grid */
|
|
29
22
|
.product-layout-control-container ue-switcher {
|
|
30
23
|
justify-self: end;
|
|
@@ -150,68 +143,15 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
150
143
|
color: var(--guido-color-danger-500);
|
|
151
144
|
}
|
|
152
145
|
|
|
153
|
-
/*
|
|
154
|
-
.orderable-
|
|
155
|
-
|
|
156
|
-
align-items: stretch;
|
|
157
|
-
gap: 8px;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.price-group-header {
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
gap: 4px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.price-suborderable-list {
|
|
167
|
-
display: flex;
|
|
168
|
-
flex-direction: column;
|
|
169
|
-
margin-left: 4px;
|
|
170
|
-
padding-left: 8px;
|
|
171
|
-
border-left: 2px solid #eee;
|
|
146
|
+
/* Disable drag for list layout */
|
|
147
|
+
.orderable-list.orderable-disabled .drag-handle {
|
|
148
|
+
display: none;
|
|
172
149
|
}
|
|
173
150
|
|
|
174
|
-
.
|
|
175
|
-
display: flex;
|
|
176
|
-
align-items: center;
|
|
177
|
-
gap: 4px;
|
|
178
|
-
padding: 8px 0;
|
|
179
|
-
background: var(--guido-color-white);
|
|
151
|
+
.orderable-list.orderable-disabled .orderable-item {
|
|
180
152
|
cursor: default;
|
|
181
|
-
transition: background 0.15s;
|
|
182
|
-
box-sizing: border-box;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.price-suborderable-item:hover {
|
|
186
|
-
background: #fafafa;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.price-suborderable-item.dragging {
|
|
190
|
-
opacity: 0.5;
|
|
191
|
-
background: var(--guido-color-gray-1);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.price-suborderable-item.drag-over {
|
|
195
|
-
border-top: 2px solid var(--guido-color-primary-500, #0A2ECC);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.price-suborderable-item .item-label {
|
|
199
|
-
font-size: 13px;
|
|
200
153
|
}
|
|
201
154
|
|
|
202
|
-
.sub-drag-handle {
|
|
203
|
-
display: flex;
|
|
204
|
-
align-items: center;
|
|
205
|
-
justify-content: center;
|
|
206
|
-
flex-shrink: 0;
|
|
207
|
-
width: 24px;
|
|
208
|
-
height: 24px;
|
|
209
|
-
cursor: move;
|
|
210
|
-
user-select: none;
|
|
211
|
-
color: var(--guido-color-gray-600);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
155
|
/* ─── Migration Info Box ─────────────────────────────────────────────── */
|
|
216
156
|
/* Shown in the settings panel title when a block was migrated from legacy */
|
|
217
157
|
|
|
@@ -3,10 +3,10 @@ import { useRecommendationApi as y } from "../../../../services/recommendationAp
|
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as P } from "pinia";
|
|
5
5
|
import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
|
-
import { EXCLUDED_ALGORITHM_IDS as
|
|
6
|
+
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
|
-
import { getPartnerRecommendationParams as
|
|
9
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
10
10
|
import { isFilterValid as N } from "../validation/filterSchema.js";
|
|
11
11
|
import { isConfigValid as x } from "../validation/requiredFields.js";
|
|
12
12
|
const h = y();
|
|
@@ -37,9 +37,7 @@ function k() {
|
|
|
37
37
|
textTrimming: !0,
|
|
38
38
|
unresponsive: !1,
|
|
39
39
|
size: "6",
|
|
40
|
-
customAttributes: []
|
|
41
|
-
priceMovedToNextLine: !0,
|
|
42
|
-
priceHideIfSameAsDiscounted: !1
|
|
40
|
+
customAttributes: []
|
|
43
41
|
};
|
|
44
42
|
}
|
|
45
43
|
function I() {
|
|
@@ -119,7 +117,7 @@ const L = () => ({
|
|
|
119
117
|
},
|
|
120
118
|
getActivePredictiveAlgorithms: (t) => {
|
|
121
119
|
const e = g(), r = [];
|
|
122
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
120
|
+
return t.activePredictiveAlgorithms.filter((n) => !w.includes(n)).forEach((n) => {
|
|
123
121
|
r.push(...e.filter((c) => c.id === n));
|
|
124
122
|
}), r.map((n) => ({
|
|
125
123
|
text: n.name,
|
|
@@ -459,7 +457,7 @@ const L = () => ({
|
|
|
459
457
|
};
|
|
460
458
|
r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
461
459
|
a,
|
|
462
|
-
|
|
460
|
+
v(o.partnerName, r.strategy)
|
|
463
461
|
);
|
|
464
462
|
let f;
|
|
465
463
|
try {
|