@useinsider/guido 3.7.2-beta.6f556cb → 3.7.2-beta.a114aa7
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/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +45 -47
- package/dist/composables/useHtmlValidator.js +180 -133
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
- 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 +175 -169
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +43 -42
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +44 -33
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +59 -49
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +89 -82
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +13 -12
- package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
- package/dist/guido.css +1 -1
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -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/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 +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -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/package.json +1 -1
|
@@ -1,36 +1,40 @@
|
|
|
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
|
|
3
|
+
import { CURRENCY_ATTR as S, CSS_CLASS_SKIP_COMPILE as v, MOBILE_CONTAINER_SELECTOR as P, MOBILE_ROW_SELECTOR as _, DESKTOP_CONTAINER_SELECTOR as M, CONTAINER_SELECTOR as j, ATTR_PRODUCT_ATTR as V } 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 L, DEFAULT_CARD_COMPOSITION as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
6
|
+
import { prepareProductRows as k } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as W } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as F } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as G, toDisplayableAttributeValue as K } from "../../templates/utils.js";
|
|
10
|
+
const T = "recommendation-block-v2";
|
|
11
|
+
function A(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(T))
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${T}`) ?? null : null;
|
|
20
|
+
}
|
|
21
|
+
function Y(t) {
|
|
22
|
+
const e = A(t);
|
|
23
|
+
return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(v);
|
|
20
24
|
}
|
|
21
25
|
function E(t) {
|
|
22
|
-
const e =
|
|
26
|
+
const e = A(t);
|
|
23
27
|
if (!e || !("getAttribute" in e))
|
|
24
28
|
return "grid";
|
|
25
29
|
const o = e.getAttribute("data-layout");
|
|
26
30
|
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
31
|
}
|
|
28
32
|
function H(t) {
|
|
29
|
-
const e =
|
|
33
|
+
const e = A(t);
|
|
30
34
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
35
|
+
return R;
|
|
32
36
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
37
|
+
return o ? o.split(",").filter(Boolean) : R;
|
|
34
38
|
}
|
|
35
39
|
function x(t) {
|
|
36
40
|
if (!t || !("childNodes" in t))
|
|
@@ -40,35 +44,35 @@ function x(t) {
|
|
|
40
44
|
);
|
|
41
45
|
return o || e.reduce((n, r) => n || !("getType" in r) || r.getType() === "text" ? n : x(r), null);
|
|
42
46
|
}
|
|
43
|
-
function
|
|
47
|
+
function g(t, e, o) {
|
|
44
48
|
const n = x(e);
|
|
45
49
|
return n ? (t.modifyHtml(n).setText(o), !0) : !1;
|
|
46
50
|
}
|
|
47
51
|
function D(t, e) {
|
|
48
52
|
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
49
53
|
}
|
|
50
|
-
function
|
|
54
|
+
function X(t) {
|
|
51
55
|
const { currentNode: e, documentModifier: o } = t;
|
|
52
56
|
if (!e || !("querySelector" in e))
|
|
53
57
|
return;
|
|
54
|
-
const n = e.querySelector(
|
|
58
|
+
const n = e.querySelector(_);
|
|
55
59
|
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
56
60
|
}
|
|
57
|
-
function
|
|
61
|
+
function z(t) {
|
|
58
62
|
return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
|
|
59
63
|
}
|
|
60
|
-
function
|
|
64
|
+
function J(t) {
|
|
61
65
|
const e = t.querySelector(".container");
|
|
62
66
|
return !e || !("childNodes" in e) ? null : e.childNodes().find((n) => "getTagName" in n && n.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
|
|
63
67
|
}
|
|
64
|
-
function
|
|
65
|
-
const n =
|
|
68
|
+
function Q(t, e, o) {
|
|
69
|
+
const n = J(t);
|
|
66
70
|
if (!n || !("childNodes" in n))
|
|
67
71
|
return;
|
|
68
|
-
const r = n.childNodes().map(
|
|
72
|
+
const r = n.childNodes().map(z).join(""), l = `<tr class="ins-recommendation-mobile-row">${o}</tr>`;
|
|
69
73
|
e.modifyHtml(n).setInnerHtml(r + l), e.apply(new p("Added mobile product row"));
|
|
70
74
|
}
|
|
71
|
-
function
|
|
75
|
+
function Z(t) {
|
|
72
76
|
const {
|
|
73
77
|
currentNode: e,
|
|
74
78
|
documentModifier: o,
|
|
@@ -80,21 +84,21 @@ function J(t) {
|
|
|
80
84
|
return;
|
|
81
85
|
const i = r ?? E(e), s = b.getConfig(e);
|
|
82
86
|
if (i === "list" || !s.mobileLayoutEnabled) {
|
|
83
|
-
|
|
87
|
+
X({ currentNode: e, documentModifier: o });
|
|
84
88
|
return;
|
|
85
89
|
}
|
|
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">${
|
|
90
|
+
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">${k(c, i, {
|
|
87
91
|
productsPerRow: s.mobileCardsInRow,
|
|
88
92
|
composition: d,
|
|
89
93
|
filterList: u.filterList
|
|
90
|
-
})}</table></td>`, y = e.querySelector(
|
|
94
|
+
})}</table></td>`, y = e.querySelector(_);
|
|
91
95
|
if (!y) {
|
|
92
|
-
|
|
96
|
+
Q(e, o, a);
|
|
93
97
|
return;
|
|
94
98
|
}
|
|
95
99
|
o.modifyHtml(y).setInnerHtml(a), o.apply(new p("Updated mobile product rows"));
|
|
96
100
|
}
|
|
97
|
-
function
|
|
101
|
+
function ee(t) {
|
|
98
102
|
const {
|
|
99
103
|
currentNode: e,
|
|
100
104
|
documentModifier: o,
|
|
@@ -105,17 +109,17 @@ function Q(t) {
|
|
|
105
109
|
} = t;
|
|
106
110
|
if (!e || !("querySelector" in e))
|
|
107
111
|
return;
|
|
108
|
-
const s = e.querySelector(
|
|
112
|
+
const s = e.querySelector(M) ?? e.querySelector(j);
|
|
109
113
|
if (!s)
|
|
110
114
|
return;
|
|
111
|
-
const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ?? H(e), a = l ?? E(e), y =
|
|
115
|
+
const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ?? H(e), a = l ?? E(e), y = k(c, a, {
|
|
112
116
|
productsPerRow: d,
|
|
113
117
|
composition: f,
|
|
114
118
|
filterList: u.filterList
|
|
115
119
|
});
|
|
116
|
-
o.modifyHtml(s).setInnerHtml(y).apply(new p("Updated product")),
|
|
120
|
+
o.modifyHtml(s).setInnerHtml(y).apply(new p("Updated product")), Z(t), n == null || n();
|
|
117
121
|
}
|
|
118
|
-
function
|
|
122
|
+
function h(t, e, o, n) {
|
|
119
123
|
const l = `0 ${Math.floor(o / 2)}px`;
|
|
120
124
|
let i = !1;
|
|
121
125
|
return n === "grid" ? Array.from(
|
|
@@ -126,7 +130,7 @@ function M(t, e, o, n) {
|
|
|
126
130
|
t.querySelectorAll(".product-card-wrapper")
|
|
127
131
|
).forEach((u) => {
|
|
128
132
|
const c = "parentNode" in u ? u.parentNode : null;
|
|
129
|
-
c &&
|
|
133
|
+
c && F(c) && (e.modifyHtml(c).setStyle("padding", l), i = !0);
|
|
130
134
|
}), i;
|
|
131
135
|
}
|
|
132
136
|
function I(t, e, o) {
|
|
@@ -136,15 +140,15 @@ function I(t, e, o) {
|
|
|
136
140
|
e.modifyHtml(i).setStyle("height", n), l = !0;
|
|
137
141
|
}), l;
|
|
138
142
|
}
|
|
139
|
-
function
|
|
143
|
+
function te(t) {
|
|
140
144
|
const { currentNode: e, documentModifier: o } = t;
|
|
141
145
|
if (!e)
|
|
142
146
|
return;
|
|
143
147
|
const n = b.getConfig(e), r = E(e);
|
|
144
148
|
let l = !1;
|
|
145
|
-
const i = e.querySelector(
|
|
149
|
+
const i = e.querySelector(M);
|
|
146
150
|
if (i) {
|
|
147
|
-
l =
|
|
151
|
+
l = h(
|
|
148
152
|
i,
|
|
149
153
|
o,
|
|
150
154
|
n.columnSpacing,
|
|
@@ -157,9 +161,9 @@ function Z(t) {
|
|
|
157
161
|
);
|
|
158
162
|
l = l || c;
|
|
159
163
|
}
|
|
160
|
-
const s = e.querySelector(
|
|
164
|
+
const s = e.querySelector(P);
|
|
161
165
|
if (s) {
|
|
162
|
-
const u =
|
|
166
|
+
const u = h(
|
|
163
167
|
s,
|
|
164
168
|
o,
|
|
165
169
|
n.mobileColumnSpacing,
|
|
@@ -175,9 +179,9 @@ function Z(t) {
|
|
|
175
179
|
}
|
|
176
180
|
l && o.apply(new p("Reapply spacing after regeneration"));
|
|
177
181
|
}
|
|
178
|
-
function
|
|
182
|
+
function ye(t) {
|
|
179
183
|
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: l, composition: i } = t;
|
|
180
|
-
e &&
|
|
184
|
+
e && ee({
|
|
181
185
|
currentNode: e,
|
|
182
186
|
documentModifier: o,
|
|
183
187
|
products: r,
|
|
@@ -185,12 +189,12 @@ function me(t) {
|
|
|
185
189
|
composition: i,
|
|
186
190
|
afterRegenerate: () => {
|
|
187
191
|
setTimeout(() => {
|
|
188
|
-
|
|
192
|
+
te({ currentNode: e, documentModifier: o });
|
|
189
193
|
}, 0), n == null || n();
|
|
190
194
|
}
|
|
191
195
|
});
|
|
192
196
|
}
|
|
193
|
-
function
|
|
197
|
+
function Se(t, e) {
|
|
194
198
|
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
195
199
|
}
|
|
196
200
|
function U() {
|
|
@@ -204,14 +208,14 @@ function U() {
|
|
|
204
208
|
thousandSeparator: e.thousandSeparator
|
|
205
209
|
};
|
|
206
210
|
}
|
|
207
|
-
function
|
|
211
|
+
function q(t, e = "price") {
|
|
208
212
|
const o = U(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
209
|
-
return
|
|
213
|
+
return W({
|
|
210
214
|
price: r,
|
|
211
215
|
currency: o
|
|
212
216
|
});
|
|
213
217
|
}
|
|
214
|
-
function
|
|
218
|
+
function oe(t) {
|
|
215
219
|
var l, i;
|
|
216
220
|
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;
|
|
217
221
|
return r > 0 ? `-${r}%` : "0%";
|
|
@@ -220,24 +224,24 @@ function $(t) {
|
|
|
220
224
|
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: l, omnibusDiscountEl: i } = t;
|
|
221
225
|
let s = !1;
|
|
222
226
|
if (n && "querySelector" in n) {
|
|
223
|
-
const u = n.querySelector("strong") ?? n.querySelector("p"), c =
|
|
224
|
-
|
|
227
|
+
const u = n.querySelector("strong") ?? n.querySelector("p"), c = q(o, "price");
|
|
228
|
+
g(e, u ?? null, c) && (s = !0);
|
|
225
229
|
}
|
|
226
230
|
if (r && "querySelector" in r) {
|
|
227
|
-
const u = r.querySelector("strong") ?? r.querySelector("p"), c =
|
|
228
|
-
|
|
231
|
+
const u = r.querySelector("strong") ?? r.querySelector("p"), c = q(o, "original_price");
|
|
232
|
+
g(e, u ?? null, c) && (s = !0);
|
|
229
233
|
}
|
|
230
234
|
if (l && "querySelector" in l) {
|
|
231
|
-
const u = l.querySelector(".omnibus-price-value") ?? null, c =
|
|
232
|
-
|
|
235
|
+
const u = l.querySelector(".omnibus-price-value") ?? null, c = q(o, "original_price");
|
|
236
|
+
g(e, u, c) && (s = !0);
|
|
233
237
|
}
|
|
234
238
|
if (i && "querySelector" in i) {
|
|
235
|
-
const u = i.querySelector(".omnibus-discount-value") ?? null, c =
|
|
236
|
-
|
|
239
|
+
const u = i.querySelector(".omnibus-discount-value") ?? null, c = oe(o);
|
|
240
|
+
g(e, u, c) && (s = !0);
|
|
237
241
|
}
|
|
238
242
|
return s;
|
|
239
243
|
}
|
|
240
|
-
function
|
|
244
|
+
function ne(t) {
|
|
241
245
|
const {
|
|
242
246
|
documentModifier: e,
|
|
243
247
|
product: o,
|
|
@@ -252,13 +256,13 @@ function te(t) {
|
|
|
252
256
|
let d = !1;
|
|
253
257
|
if (n && "querySelector" in n) {
|
|
254
258
|
const f = n.querySelector("img");
|
|
255
|
-
f && (e.modifyHtml(f).setAttribute("src",
|
|
259
|
+
f && (e.modifyHtml(f).setAttribute("src", G(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
256
260
|
const a = n.querySelector("a");
|
|
257
261
|
a && (e.modifyHtml(a).setAttribute("href", o.url), d = !0);
|
|
258
262
|
}
|
|
259
263
|
if (r && "querySelector" in r) {
|
|
260
264
|
const f = r.querySelector("strong") ?? r.querySelector("p");
|
|
261
|
-
|
|
265
|
+
g(e, f ?? null, o.name) && (d = !0);
|
|
262
266
|
}
|
|
263
267
|
if ($({
|
|
264
268
|
documentModifier: e,
|
|
@@ -274,10 +278,10 @@ function te(t) {
|
|
|
274
278
|
return d;
|
|
275
279
|
}
|
|
276
280
|
function B(t) {
|
|
277
|
-
return "querySelector" in t ? t.querySelector(
|
|
281
|
+
return "querySelector" in t ? t.querySelector(M) ?? t : t;
|
|
278
282
|
}
|
|
279
283
|
const O = "product_attribute.";
|
|
280
|
-
function
|
|
284
|
+
function re(t, e) {
|
|
281
285
|
var n;
|
|
282
286
|
let o;
|
|
283
287
|
if (t.startsWith(O)) {
|
|
@@ -285,9 +289,9 @@ function oe(t, e) {
|
|
|
285
289
|
o = (n = e.product_attributes) == null ? void 0 : n[r];
|
|
286
290
|
} else
|
|
287
291
|
o = e[t];
|
|
288
|
-
return
|
|
292
|
+
return K(o) || null;
|
|
289
293
|
}
|
|
290
|
-
function
|
|
294
|
+
function ie(t, e, o) {
|
|
291
295
|
if (!("querySelectorAll" in t))
|
|
292
296
|
return !1;
|
|
293
297
|
const n = t.querySelectorAll(
|
|
@@ -299,7 +303,7 @@ function ne(t, e, o) {
|
|
|
299
303
|
n.forEach((i) => {
|
|
300
304
|
if (!("getAttribute" in i))
|
|
301
305
|
return;
|
|
302
|
-
const s = i.getAttribute(
|
|
306
|
+
const s = i.getAttribute(V);
|
|
303
307
|
if (!s)
|
|
304
308
|
return;
|
|
305
309
|
const u = r.get(s) ?? [];
|
|
@@ -311,11 +315,11 @@ function ne(t, e, o) {
|
|
|
311
315
|
i.slice(0, u).forEach((c, d) => {
|
|
312
316
|
if (!("querySelector" in c))
|
|
313
317
|
return;
|
|
314
|
-
const f =
|
|
318
|
+
const f = re(s, o[d]);
|
|
315
319
|
if (f === null)
|
|
316
320
|
return;
|
|
317
321
|
const a = c.querySelector("p") ?? null;
|
|
318
|
-
|
|
322
|
+
g(e, a, f) && (l = !0);
|
|
319
323
|
});
|
|
320
324
|
}), l;
|
|
321
325
|
}
|
|
@@ -339,7 +343,7 @@ function w(t, e, o) {
|
|
|
339
343
|
), d = Math.min(n.length, o.length);
|
|
340
344
|
let f = !1;
|
|
341
345
|
for (let a = 0; a < d; a++) {
|
|
342
|
-
const y =
|
|
346
|
+
const y = ne({
|
|
343
347
|
documentModifier: e,
|
|
344
348
|
product: o[a],
|
|
345
349
|
imageEl: n[a] ?? null,
|
|
@@ -352,9 +356,9 @@ function w(t, e, o) {
|
|
|
352
356
|
});
|
|
353
357
|
f = f || y;
|
|
354
358
|
}
|
|
355
|
-
return
|
|
359
|
+
return ie(t, e, o) && (f = !0), f;
|
|
356
360
|
}
|
|
357
|
-
function
|
|
361
|
+
function ge(t) {
|
|
358
362
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
359
363
|
if (!e || !("querySelectorAll" in e))
|
|
360
364
|
return !1;
|
|
@@ -366,7 +370,7 @@ function ye(t) {
|
|
|
366
370
|
let i = w(r, o, n);
|
|
367
371
|
const s = E(e), u = b.getConfig(e);
|
|
368
372
|
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
369
|
-
const c = e.querySelector(
|
|
373
|
+
const c = e.querySelector(P);
|
|
370
374
|
if (c) {
|
|
371
375
|
const d = w(
|
|
372
376
|
c,
|
|
@@ -402,10 +406,12 @@ function N(t, e, o) {
|
|
|
402
406
|
}) && (u = !0);
|
|
403
407
|
return u;
|
|
404
408
|
}
|
|
405
|
-
function
|
|
409
|
+
function be(t) {
|
|
406
410
|
const { currentNode: e, documentModifier: o } = t;
|
|
407
411
|
if (!e || !("querySelectorAll" in e))
|
|
408
412
|
return !1;
|
|
413
|
+
if (Y(e))
|
|
414
|
+
return !0;
|
|
409
415
|
const r = C().recommendationProducts;
|
|
410
416
|
if (r.length === 0)
|
|
411
417
|
return !1;
|
|
@@ -413,7 +419,7 @@ function ge(t) {
|
|
|
413
419
|
let i = N(l, o, r);
|
|
414
420
|
const s = E(e), u = b.getConfig(e);
|
|
415
421
|
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
416
|
-
const c = e.querySelector(
|
|
422
|
+
const c = e.querySelector(P);
|
|
417
423
|
if (c) {
|
|
418
424
|
const d = N(c, o, r);
|
|
419
425
|
i = i || d;
|
|
@@ -421,27 +427,28 @@ function ge(t) {
|
|
|
421
427
|
}
|
|
422
428
|
return i && o.apply(new p("Updated price formatting in-place")), i;
|
|
423
429
|
}
|
|
424
|
-
function
|
|
425
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, r =
|
|
430
|
+
function Ee(t) {
|
|
431
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, r = A(e);
|
|
426
432
|
if (!r)
|
|
427
433
|
return;
|
|
428
434
|
const l = n.alignment === "before" ? "0" : "1", i = (s, u) => {
|
|
429
435
|
o.modifyHtml(r).setAttribute(s, u);
|
|
430
436
|
};
|
|
431
|
-
i(
|
|
437
|
+
i(S.CURRENCY, n.code), i(S.SYMBOL, n.symbol), i(S.ALIGNMENT, l), i(S.THOUSAND_SEPARATOR, n.thousandSeparator), i(S.DECIMAL_SEPARATOR, n.decimalSeparator), i(S.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
432
438
|
}
|
|
433
439
|
export {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
440
|
+
Se as adjustProductsToSize,
|
|
441
|
+
q as formatProductPrice,
|
|
442
|
+
A as getBlockElement,
|
|
437
443
|
H as getCardComposition,
|
|
438
444
|
E as getCurrentLayout,
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
Y as isPartnerManagedBlock,
|
|
446
|
+
te as reapplySpacing,
|
|
447
|
+
Z as regenerateMobileProductRows,
|
|
448
|
+
ee as regenerateProductRows,
|
|
449
|
+
ye as regenerateProductRowsWithStyles,
|
|
450
|
+
Ee as setCurrencyAttributes,
|
|
451
|
+
be as updatePricesInPlace,
|
|
452
|
+
ge as updateProductContentInPlace,
|
|
453
|
+
ne as updateSingleProductContent
|
|
447
454
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var a = (o, e, t) =>
|
|
4
|
-
import { UIElementType as c, UEAttr as
|
|
2
|
+
var p = (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) => p(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UIElementType as c, UEAttr as _ } 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";
|
|
7
8
|
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.";
|
|
8
|
-
class
|
|
9
|
+
class O extends d {
|
|
9
10
|
constructor() {
|
|
10
11
|
super(...arguments);
|
|
11
12
|
a(this, "_repositionedElement", null);
|
|
@@ -17,7 +18,7 @@ class h extends d {
|
|
|
17
18
|
return `
|
|
18
19
|
<div class="${r}">
|
|
19
20
|
<${c.ICON}
|
|
20
|
-
${
|
|
21
|
+
${_.ICON.src}="migration-info-icon"
|
|
21
22
|
class="${r}__icon">
|
|
22
23
|
</${c.ICON}>
|
|
23
24
|
<p class="${r}__text">
|
|
@@ -61,5 +62,5 @@ class h extends d {
|
|
|
61
62
|
}
|
|
62
63
|
export {
|
|
63
64
|
S as SYNC_INFO_MESSAGE_CONTROL_ID,
|
|
64
|
-
|
|
65
|
+
O as SyncInfoMessageControl
|
|
65
66
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
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";
|
|
4
5
|
import "./store/recommendation.js";
|
|
5
6
|
import { NameControls as i } from "./controls/name/index.js";
|
|
6
7
|
import { PriceControls as e } from "./controls/price/index.js";
|
|
7
8
|
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
8
9
|
import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
|
|
9
|
-
import { OmnibusDiscountControls as
|
|
10
|
-
import { ButtonControls as
|
|
10
|
+
import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
|
|
11
|
+
import { ButtonControls as a } from "./controls/button/index.js";
|
|
11
12
|
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
13
|
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
13
14
|
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
@@ -22,8 +23,8 @@ const b = [
|
|
|
22
23
|
e,
|
|
23
24
|
s,
|
|
24
25
|
l,
|
|
25
|
-
a,
|
|
26
26
|
p,
|
|
27
|
+
a,
|
|
27
28
|
c,
|
|
28
29
|
C
|
|
29
30
|
], P = [
|
|
@@ -35,10 +36,10 @@ const b = [
|
|
|
35
36
|
], S = [
|
|
36
37
|
...P,
|
|
37
38
|
...b.flatMap((o) => Object.values(o))
|
|
38
|
-
],
|
|
39
|
+
], L = S.reduce(
|
|
39
40
|
(o, t) => o.addControl(t),
|
|
40
41
|
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
42
|
).addStyles(y).withIconsRegistry(R).build();
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
L as default
|
|
44
45
|
};
|
|
@@ -2,6 +2,7 @@ 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";
|
|
5
6
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
6
7
|
import "./store/recommendation.js";
|
|
7
8
|
import "./controls/name/index.js";
|
|
@@ -15,7 +16,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
|
15
16
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
16
17
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
17
18
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
18
|
-
class
|
|
19
|
+
class a extends E {
|
|
19
20
|
registerBlockControls(I) {
|
|
20
21
|
I[U] = [
|
|
21
22
|
new _(
|
|
@@ -194,5 +195,5 @@ class Z extends E {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
export {
|
|
197
|
-
|
|
198
|
+
a as SettingsPanel
|
|
198
199
|
};
|
|
@@ -2,6 +2,7 @@ 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 P } from "pinia";
|
|
5
|
+
import "../constants/selectors.js";
|
|
5
6
|
import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
7
|
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
7
8
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
@@ -60,7 +61,7 @@ const L = () => ({
|
|
|
60
61
|
blockStates: {},
|
|
61
62
|
currentRecommendationId: null,
|
|
62
63
|
configVersion: 0
|
|
63
|
-
}),
|
|
64
|
+
}), $ = P("guidoRecommendationExtension", {
|
|
64
65
|
state: () => L(),
|
|
65
66
|
getters: {
|
|
66
67
|
// ====================================================================
|
|
@@ -476,5 +477,5 @@ const L = () => ({
|
|
|
476
477
|
}
|
|
477
478
|
});
|
|
478
479
|
export {
|
|
479
|
-
|
|
480
|
+
$ as useRecommendationExtensionStore
|
|
480
481
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../constants/selectors.js";
|
|
1
2
|
import { DEFAULT_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
|
|
2
3
|
import { getDefaultProducts as I, DEFAULTS as b, createBlockTemplate as E, DEFAULT_CARD_COMPOSITION as L, spacer as S, buildElementRenderer as _, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
|
|
3
4
|
import { buildFillerCell as w, gridElementRenderer as A } from "./elementRenderer.js";
|
|
@@ -28,36 +29,36 @@ const D = `
|
|
|
28
29
|
</tr>
|
|
29
30
|
`;
|
|
30
31
|
function O(t, e, n, r = L, c = {}) {
|
|
31
|
-
const
|
|
32
|
-
return r.filter((o) =>
|
|
33
|
-
const
|
|
34
|
-
return C.replace("{-{-ATTR_TYPE-}-}", o).replace("{-{-VISIBILITY-}-}",
|
|
32
|
+
const i = (100 / e).toFixed(2), s = e - t.length, l = s > 0 ? w(i).repeat(s) : "", a = _(n, r, c);
|
|
33
|
+
return r.filter((o) => a[o]).map((o) => {
|
|
34
|
+
const d = f[o] ?? !0, u = d ? "" : 'style="display: none;"', T = t.map((R) => a[o](R).replace("<td", `<td width="${i}%"`)).join("");
|
|
35
|
+
return C.replace("{-{-ATTR_TYPE-}-}", o).replace("{-{-VISIBILITY-}-}", d ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", T + l);
|
|
35
36
|
}).join("");
|
|
36
37
|
}
|
|
37
38
|
function g(t, e, n, r, c = {}) {
|
|
38
|
-
const
|
|
39
|
+
const i = [];
|
|
39
40
|
for (let l = 0; l < t.length; l += e)
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
const
|
|
41
|
+
i.push(t.slice(l, l + e));
|
|
42
|
+
return i.map((l, a) => {
|
|
43
|
+
const p = O(
|
|
43
44
|
l,
|
|
44
45
|
e,
|
|
45
46
|
n,
|
|
46
47
|
r,
|
|
47
48
|
c
|
|
48
|
-
), o = D.replace("{-{-ATTRIBUTE_ROWS-}-}",
|
|
49
|
-
return
|
|
49
|
+
), o = D.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
|
|
50
|
+
return a > 0 ? S + o : o;
|
|
50
51
|
}).join("");
|
|
51
52
|
}
|
|
52
53
|
function P(t, e, n, r = {}) {
|
|
53
54
|
return g(t, e, A, n, r);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function W(t) {
|
|
56
57
|
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, n = E("grid", e), r = I(), c = P(r, m);
|
|
57
58
|
return n.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
58
59
|
}
|
|
59
60
|
export {
|
|
60
|
-
|
|
61
|
+
W as getDefaultTemplate,
|
|
61
62
|
O as prepareGridAttributeRows,
|
|
62
63
|
g as prepareGridProductRows,
|
|
63
64
|
P as prepareProductRows
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import "../constants/selectors.js";
|
|
1
2
|
import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
|
|
2
3
|
import { prepareProductRows as c } from "./grid/template.js";
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
function
|
|
4
|
+
import { prepareProductRows as m } from "./list/template.js";
|
|
5
|
+
function f(o, t, r = {}) {
|
|
5
6
|
if (t === "list")
|
|
6
|
-
return
|
|
7
|
+
return m(o, r.composition, r.filterList);
|
|
7
8
|
const { productsPerRow: e = s, composition: p, filterList: i } = r;
|
|
8
9
|
return c(o, e, p, i);
|
|
9
10
|
}
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
f as prepareProductRows
|
|
12
13
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-f6a8cb4c]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-f6a8cb4c]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-f6a8cb4c]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-f6a8cb4c]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-f6a8cb4c]{object-fit:cover;transform:scale(1)}[data-v-
|
|
1
|
+
.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-82128f7d]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-50dac6de]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-50dac6de]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-50dac6de]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-f6a8cb4c]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-f6a8cb4c]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-f6a8cb4c]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-f6a8cb4c]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-f6a8cb4c]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-7419ae06] .vueperslides__bullets,[data-v-796d193b] .vueperslides__bullets{pointer-events:none!important}[data-v-796d193b] .vueperslides__parallax-wrapper{height:110px!important}[data-v-cadfc82d] .vueperslides__bullets{pointer-events:none!important}[data-v-cadfc82d] .vueperslides__parallax-wrapper{height:110px!important}
|