@useinsider/guido 3.6.0 → 3.7.0-beta.509616e
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/README.md +14 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +75 -72
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +9 -9
- package/dist/composables/useActionsApi.js +16 -15
- package/dist/composables/useHtmlCompiler.js +40 -22
- package/dist/composables/useRecommendation.js +34 -33
- package/dist/enums/toaster.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +35 -16
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +127 -123
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +51 -47
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +46 -46
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +35 -29
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +28 -28
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +56 -49
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +16 -0
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -17
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +9 -0
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -0
- package/dist/src/composables/useHtmlCompiler.d.ts +1 -0
- package/dist/src/enums/toaster.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/block.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/useRecommendationBlockWarning.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +28 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +1 -0
- package/dist/src/utils/ampErrorFilter.d.ts +2 -0
- package/dist/src/utils/ampErrorFilter.test.d.ts +1 -0
- package/dist/src/utils/templatePreparation.d.ts +16 -0
- package/dist/src/utils/templatePreparation.test.d.ts +1 -0
- package/dist/utils/ampErrorFilter.js +8 -0
- package/dist/utils/templatePreparation.js +59 -58
- package/package.json +1 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var p = (d,
|
|
3
|
-
var s = (d,
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
|
|
3
|
+
var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
5
|
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
6
|
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
|
-
import { AlgorithmControl as
|
|
9
|
-
import { ALGORITHM_CONTROL_ID as
|
|
10
|
-
import { CurrencyControl as
|
|
11
|
-
import { CURRENCY_CONTROL_ID as
|
|
8
|
+
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
|
|
10
|
+
import { CurrencyControl as R } from "./currency.js";
|
|
11
|
+
import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
|
|
12
12
|
import { FiltersControl as _ } from "./filters.js";
|
|
13
|
-
import { FILTERS_CONTROL_ID as
|
|
13
|
+
import { FILTERS_CONTROL_ID as et } from "./filters.js";
|
|
14
14
|
import { LayoutOrientationControl as b } from "./layoutOrientation.js";
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
|
|
16
16
|
import { LocaleControl as O } from "./locale.js";
|
|
17
|
-
import { LOCALE_CONTROL_ID as
|
|
17
|
+
import { LOCALE_CONTROL_ID as it } from "./locale.js";
|
|
18
18
|
import { ProductCountControl as I } from "./productCount.js";
|
|
19
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
19
|
+
import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
|
|
20
20
|
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
21
21
|
import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
|
|
22
22
|
import { ShuffleControl as S } from "./shuffle.js";
|
|
23
|
-
import { SHUFFLE_CONTROL_ID as
|
|
24
|
-
import {
|
|
25
|
-
import { adjustProductsToSize as
|
|
23
|
+
import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
|
|
24
|
+
import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as D, regenerateProductRowsWithStyles as k } from "./utils.js";
|
|
25
|
+
import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Nt, updatePricesInPlace as Rt, updateSingleProductContent as _t } from "./utils.js";
|
|
26
26
|
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
27
|
-
const
|
|
28
|
-
class
|
|
27
|
+
const E = "recommendation-id", v = "ui-elements-recommendation-block";
|
|
28
|
+
class K extends g {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
s(this, "store", y());
|
|
@@ -62,11 +62,11 @@ class H extends g {
|
|
|
62
62
|
if (!this.currentNode || !this.api)
|
|
63
63
|
return;
|
|
64
64
|
const e = this.api.getDocumentModifier();
|
|
65
|
-
|
|
65
|
+
D({
|
|
66
66
|
currentNode: this.currentNode,
|
|
67
67
|
documentModifier: e,
|
|
68
68
|
products: t
|
|
69
|
-
}) ||
|
|
69
|
+
}) || k({
|
|
70
70
|
currentNode: this.currentNode,
|
|
71
71
|
documentModifier: e,
|
|
72
72
|
products: t
|
|
@@ -74,10 +74,10 @@ class H extends g {
|
|
|
74
74
|
}, 100));
|
|
75
75
|
}
|
|
76
76
|
getId() {
|
|
77
|
-
return
|
|
77
|
+
return v;
|
|
78
78
|
}
|
|
79
79
|
getTemplate() {
|
|
80
|
-
return this.algorithmControl = new
|
|
80
|
+
return this.algorithmControl = new N(), this.localeControl = new O(), this.currencyControl = new R(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
|
|
81
81
|
this.algorithmControl,
|
|
82
82
|
this.localeControl,
|
|
83
83
|
this.currencyControl,
|
|
@@ -263,7 +263,11 @@ class H extends g {
|
|
|
263
263
|
this.currentNode,
|
|
264
264
|
e,
|
|
265
265
|
"Applied smart defaults"
|
|
266
|
-
),
|
|
266
|
+
), o && e.currency && L({
|
|
267
|
+
currentNode: this.currentNode,
|
|
268
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
269
|
+
currency: e.currency
|
|
270
|
+
}), this.store.patchCurrentBlockConfig({
|
|
267
271
|
...o ? {
|
|
268
272
|
currencySettings: {
|
|
269
273
|
name: o,
|
|
@@ -283,10 +287,10 @@ class H extends g {
|
|
|
283
287
|
* Reads the recommendation-id attribute from the block element within the node
|
|
284
288
|
*/
|
|
285
289
|
_getRecommendationIdFromNode(t) {
|
|
286
|
-
const e =
|
|
290
|
+
const e = P(t);
|
|
287
291
|
if (!e || !("getAttribute" in e))
|
|
288
292
|
return null;
|
|
289
|
-
const o = e.getAttribute(
|
|
293
|
+
const o = e.getAttribute(E);
|
|
290
294
|
if (!o)
|
|
291
295
|
return null;
|
|
292
296
|
const r = parseInt(o);
|
|
@@ -316,8 +320,8 @@ class H extends g {
|
|
|
316
320
|
}
|
|
317
321
|
const i = t.$state.configVersion;
|
|
318
322
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
319
|
-
const
|
|
320
|
-
u &&
|
|
323
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
324
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
321
325
|
});
|
|
322
326
|
}
|
|
323
327
|
/**
|
|
@@ -337,35 +341,35 @@ class H extends g {
|
|
|
337
341
|
}
|
|
338
342
|
}
|
|
339
343
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
Q as ALGORITHM_CONTROL_ID,
|
|
345
|
+
N as AlgorithmControl,
|
|
346
|
+
v as CONTROL_BLOCK_ID,
|
|
347
|
+
Z as CURRENCY_CONTROL_ID,
|
|
348
|
+
R as CurrencyControl,
|
|
349
|
+
et as FILTERS_CONTROL_ID,
|
|
346
350
|
_ as FiltersControl,
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
rt as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
352
|
+
it as LOCALE_CONTROL_ID,
|
|
349
353
|
b as LayoutOrientationControl,
|
|
350
354
|
O as LocaleControl,
|
|
351
|
-
|
|
355
|
+
at as PRODUCT_COUNT_CONTROL_ID,
|
|
352
356
|
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
353
357
|
I as ProductCountControl,
|
|
354
358
|
T as ProductLayoutControl,
|
|
355
|
-
|
|
356
|
-
|
|
359
|
+
K as RecommendationBlockControl,
|
|
360
|
+
dt as SHUFFLE_CONTROL_ID,
|
|
357
361
|
S as ShuffleControl,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
362
|
+
mt as adjustProductsToSize,
|
|
363
|
+
ft as formatProductPrice,
|
|
364
|
+
P as getBlockElement,
|
|
361
365
|
Ct as getCardComposition,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
pt as getCurrentLayout,
|
|
367
|
+
gt as reapplySpacing,
|
|
368
|
+
yt as regenerateMobileProductRows,
|
|
369
|
+
Nt as regenerateProductRows,
|
|
370
|
+
k as regenerateProductRowsWithStyles,
|
|
371
|
+
L as setCurrencyAttributes,
|
|
372
|
+
Rt as updatePricesInPlace,
|
|
373
|
+
D as updateProductContentInPlace,
|
|
370
374
|
_t as updateSingleProductContent
|
|
371
375
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var r = (o, e, t) =>
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var A = (o, e, t) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var r = (o, e, t) => A(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as N } from "../../../common-control.js";
|
|
6
6
|
import { ATTR_DATA_CUSTOM_ATTRIBUTES as L } from "../../constants/selectors.js";
|
|
@@ -9,9 +9,9 @@ import { DEFAULT_COMPOSITION as _ } from "../../constants/defaultConfig.js";
|
|
|
9
9
|
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as f } from "../../store/recommendation.js";
|
|
11
11
|
import { getCurrentLayout as C, getBlockElement as I, regenerateProductRowsWithStyles as S } from "./utils.js";
|
|
12
|
-
const U = "recommendation-layout-orientation-control",
|
|
12
|
+
const U = "recommendation-layout-orientation-control", O = "recommendationInfoBannerTest", a = {
|
|
13
13
|
LAYOUT: "layout"
|
|
14
|
-
}, y = "data-card-composition",
|
|
14
|
+
}, y = "data-card-composition", n = {
|
|
15
15
|
LAYOUT: "data-layout",
|
|
16
16
|
COLUMN_SPACING: "data-column-spacing",
|
|
17
17
|
ROW_SPACING: "data-row-spacing",
|
|
@@ -30,7 +30,7 @@ class Y extends N {
|
|
|
30
30
|
getTemplate() {
|
|
31
31
|
return `
|
|
32
32
|
<div class="layout-control-container">
|
|
33
|
-
${this._GuOnPageMessage({ name:
|
|
33
|
+
${this._GuOnPageMessage({ name: O })}
|
|
34
34
|
|
|
35
35
|
${this._GuTwoColumns([
|
|
36
36
|
this._GuLabel({ text: this.api.translate("Layout Orientation") }),
|
|
@@ -44,10 +44,11 @@ class Y extends N {
|
|
|
44
44
|
}
|
|
45
45
|
onRender() {
|
|
46
46
|
this._setInfoMessageValue(
|
|
47
|
-
|
|
47
|
+
O,
|
|
48
48
|
this.api.translate(
|
|
49
|
-
`Note that updating the Layout Orientation, Number of Products
|
|
50
|
-
Products in One Row
|
|
49
|
+
`Note that updating the Layout Orientation, Number of Products,
|
|
50
|
+
Products in One Row and Mobile Layout Optimization settings
|
|
51
|
+
resets the style of your Recommendation block.`
|
|
51
52
|
)
|
|
52
53
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
53
54
|
}
|
|
@@ -83,8 +84,8 @@ class Y extends N {
|
|
|
83
84
|
},
|
|
84
85
|
`Changed layout to ${t}`
|
|
85
86
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
86
|
-
const
|
|
87
|
-
t === "list" ? (
|
|
87
|
+
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, g.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
|
|
88
|
+
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.setAttribute(y, _.join(",")).setAttribute(L, "[]"), i.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t);
|
|
88
89
|
} finally {
|
|
89
90
|
this.isChangingLayout = !1;
|
|
90
91
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
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 {
|
|
3
|
+
import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as V } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as E } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
6
|
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as
|
|
7
|
+
import { formatPrice as W } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as j } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as h, sanitizeImageUrl as F, toDisplayableAttributeValue as G } from "../../templates/utils.js";
|
|
10
10
|
const M = "recommendation-block-v2";
|
|
11
|
-
function
|
|
11
|
+
function R(t) {
|
|
12
12
|
if (!t)
|
|
13
13
|
return null;
|
|
14
14
|
if ("getAttribute" in t) {
|
|
@@ -19,18 +19,18 @@ function h(t) {
|
|
|
19
19
|
return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
|
|
20
20
|
}
|
|
21
21
|
function b(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
28
|
function x(t) {
|
|
29
|
-
const e =
|
|
29
|
+
const e = R(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
31
|
+
return h;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : h;
|
|
34
34
|
}
|
|
35
35
|
function D(t) {
|
|
36
36
|
if (!t || !("childNodes" in t))
|
|
@@ -47,14 +47,14 @@ function S(t, e, o) {
|
|
|
47
47
|
function U(t, e) {
|
|
48
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
|
const {
|
|
59
59
|
currentNode: e,
|
|
60
60
|
documentModifier: o,
|
|
@@ -66,7 +66,7 @@ function Y(t) {
|
|
|
66
66
|
return;
|
|
67
67
|
const r = i ?? b(e), s = E.getConfig(e);
|
|
68
68
|
if (r === "list" || !s.mobileLayoutEnabled) {
|
|
69
|
-
|
|
69
|
+
Y({ currentNode: e, documentModifier: o });
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
const u = e.querySelector(k);
|
|
@@ -79,7 +79,7 @@ function Y(t) {
|
|
|
79
79
|
})}</table></td>`;
|
|
80
80
|
o.modifyHtml(u).setInnerHtml(g), o.apply(new p("Updated mobile product rows"));
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function X(t) {
|
|
83
83
|
const {
|
|
84
84
|
currentNode: e,
|
|
85
85
|
documentModifier: o,
|
|
@@ -98,7 +98,7 @@ function K(t) {
|
|
|
98
98
|
composition: a,
|
|
99
99
|
filterList: u.filterList
|
|
100
100
|
});
|
|
101
|
-
o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")),
|
|
101
|
+
o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), K(t), n == null || n();
|
|
102
102
|
}
|
|
103
103
|
function T(t, e, o, n) {
|
|
104
104
|
const c = `0 ${Math.floor(o / 2)}px`;
|
|
@@ -111,7 +111,7 @@ function T(t, e, o, n) {
|
|
|
111
111
|
t.querySelectorAll(".product-card-wrapper")
|
|
112
112
|
).forEach((u) => {
|
|
113
113
|
const l = "parentNode" in u ? u.parentNode : null;
|
|
114
|
-
l &&
|
|
114
|
+
l && j(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
|
|
115
115
|
}), r;
|
|
116
116
|
}
|
|
117
117
|
function I(t, e, o) {
|
|
@@ -121,7 +121,7 @@ function I(t, e, o) {
|
|
|
121
121
|
e.modifyHtml(r).setStyle("height", n), c = !0;
|
|
122
122
|
}), c;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function z(t) {
|
|
125
125
|
const { currentNode: e, documentModifier: o } = t;
|
|
126
126
|
if (!e)
|
|
127
127
|
return;
|
|
@@ -160,9 +160,9 @@ function X(t) {
|
|
|
160
160
|
}
|
|
161
161
|
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function ae(t) {
|
|
164
164
|
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
|
|
165
|
-
e &&
|
|
165
|
+
e && X({
|
|
166
166
|
currentNode: e,
|
|
167
167
|
documentModifier: o,
|
|
168
168
|
products: i,
|
|
@@ -170,12 +170,12 @@ function se(t) {
|
|
|
170
170
|
composition: r,
|
|
171
171
|
afterRegenerate: () => {
|
|
172
172
|
setTimeout(() => {
|
|
173
|
-
|
|
173
|
+
z({ currentNode: e, documentModifier: o });
|
|
174
174
|
}, 0), n == null || n();
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function de(t, e) {
|
|
179
179
|
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
180
180
|
}
|
|
181
181
|
function H() {
|
|
@@ -191,12 +191,12 @@ function H() {
|
|
|
191
191
|
}
|
|
192
192
|
function A(t, e = "price") {
|
|
193
193
|
const o = H(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
194
|
-
return
|
|
194
|
+
return W({
|
|
195
195
|
price: i,
|
|
196
196
|
currency: o
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function J(t) {
|
|
200
200
|
var c, r;
|
|
201
201
|
const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
202
202
|
return i > 0 ? `-${i}%` : "0%";
|
|
@@ -217,12 +217,12 @@ function $(t) {
|
|
|
217
217
|
S(e, u, l) && (s = !0);
|
|
218
218
|
}
|
|
219
219
|
if (r && "querySelector" in r) {
|
|
220
|
-
const u = r.querySelector(".omnibus-discount-value") ?? null, l =
|
|
220
|
+
const u = r.querySelector(".omnibus-discount-value") ?? null, l = J(o);
|
|
221
221
|
S(e, u, l) && (s = !0);
|
|
222
222
|
}
|
|
223
223
|
return s;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function Q(t) {
|
|
226
226
|
const {
|
|
227
227
|
documentModifier: e,
|
|
228
228
|
product: o,
|
|
@@ -237,7 +237,7 @@ function J(t) {
|
|
|
237
237
|
let d = !1;
|
|
238
238
|
if (n && "querySelector" in n) {
|
|
239
239
|
const a = n.querySelector("img");
|
|
240
|
-
a && (e.modifyHtml(a).setAttribute("src",
|
|
240
|
+
a && (e.modifyHtml(a).setAttribute("src", F(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
241
241
|
const f = n.querySelector("a");
|
|
242
242
|
f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
|
|
243
243
|
}
|
|
@@ -262,7 +262,7 @@ function B(t) {
|
|
|
262
262
|
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
263
263
|
}
|
|
264
264
|
const O = "product_attribute.";
|
|
265
|
-
function
|
|
265
|
+
function Z(t, e) {
|
|
266
266
|
var n;
|
|
267
267
|
let o;
|
|
268
268
|
if (t.startsWith(O)) {
|
|
@@ -270,9 +270,9 @@ function Q(t, e) {
|
|
|
270
270
|
o = (n = e.product_attributes) == null ? void 0 : n[i];
|
|
271
271
|
} else
|
|
272
272
|
o = e[t];
|
|
273
|
-
return
|
|
273
|
+
return G(o) || null;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function ee(t, e, o) {
|
|
276
276
|
if (!("querySelectorAll" in t))
|
|
277
277
|
return !1;
|
|
278
278
|
const n = t.querySelectorAll(
|
|
@@ -284,7 +284,7 @@ function Z(t, e, o) {
|
|
|
284
284
|
n.forEach((r) => {
|
|
285
285
|
if (!("getAttribute" in r))
|
|
286
286
|
return;
|
|
287
|
-
const s = r.getAttribute(
|
|
287
|
+
const s = r.getAttribute(V);
|
|
288
288
|
if (!s)
|
|
289
289
|
return;
|
|
290
290
|
const u = i.get(s) ?? [];
|
|
@@ -296,7 +296,7 @@ function Z(t, e, o) {
|
|
|
296
296
|
r.slice(0, u).forEach((l, d) => {
|
|
297
297
|
if (!("querySelector" in l))
|
|
298
298
|
return;
|
|
299
|
-
const a =
|
|
299
|
+
const a = Z(s, o[d]);
|
|
300
300
|
if (a === null)
|
|
301
301
|
return;
|
|
302
302
|
const f = l.querySelector("p") ?? null;
|
|
@@ -324,7 +324,7 @@ function w(t, e, o) {
|
|
|
324
324
|
), d = Math.min(n.length, o.length);
|
|
325
325
|
let a = !1;
|
|
326
326
|
for (let f = 0; f < d; f++) {
|
|
327
|
-
const g =
|
|
327
|
+
const g = Q({
|
|
328
328
|
documentModifier: e,
|
|
329
329
|
product: o[f],
|
|
330
330
|
imageEl: n[f] ?? null,
|
|
@@ -337,9 +337,9 @@ function w(t, e, o) {
|
|
|
337
337
|
});
|
|
338
338
|
a = a || g;
|
|
339
339
|
}
|
|
340
|
-
return
|
|
340
|
+
return ee(t, e, o) && (a = !0), a;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function fe(t) {
|
|
343
343
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
344
344
|
if (!e || !("querySelectorAll" in e))
|
|
345
345
|
return !1;
|
|
@@ -387,7 +387,7 @@ function N(t, e, o) {
|
|
|
387
387
|
}) && (u = !0);
|
|
388
388
|
return u;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function me(t) {
|
|
391
391
|
const { currentNode: e, documentModifier: o } = t;
|
|
392
392
|
if (!e || !("querySelectorAll" in e))
|
|
393
393
|
return !1;
|
|
@@ -406,8 +406,8 @@ function fe(t) {
|
|
|
406
406
|
}
|
|
407
407
|
return r && o.apply(new p("Updated price formatting in-place")), r;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, i =
|
|
409
|
+
function pe(t) {
|
|
410
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, i = R(e);
|
|
411
411
|
if (!i)
|
|
412
412
|
return;
|
|
413
413
|
const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
|
|
@@ -416,17 +416,17 @@ function me(t) {
|
|
|
416
416
|
r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, c), r(y.THOUSAND_SEPARATOR, n.thousandSeparator), r(y.DECIMAL_SEPARATOR, n.decimalSeparator), r(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
417
417
|
}
|
|
418
418
|
export {
|
|
419
|
-
|
|
419
|
+
de as adjustProductsToSize,
|
|
420
420
|
A as formatProductPrice,
|
|
421
|
-
|
|
421
|
+
R as getBlockElement,
|
|
422
422
|
x as getCardComposition,
|
|
423
423
|
b as getCurrentLayout,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
424
|
+
z as reapplySpacing,
|
|
425
|
+
K as regenerateMobileProductRows,
|
|
426
|
+
X as regenerateProductRows,
|
|
427
|
+
ae as regenerateProductRowsWithStyles,
|
|
428
|
+
pe as setCurrencyAttributes,
|
|
429
|
+
me as updatePricesInPlace,
|
|
430
|
+
fe as updateProductContentInPlace,
|
|
431
|
+
Q as updateSingleProductContent
|
|
432
432
|
};
|
|
@@ -6,8 +6,9 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } 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 {
|
|
10
|
-
import {
|
|
9
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
10
|
+
import { isFilterValid as w } from "../validation/filterSchema.js";
|
|
11
|
+
import { isConfigValid as N } from "../validation/requiredFields.js";
|
|
11
12
|
const h = y();
|
|
12
13
|
let m = null, u = null, d = null;
|
|
13
14
|
function I() {
|
|
@@ -49,7 +50,7 @@ function k() {
|
|
|
49
50
|
filterSnapshot: null
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
+
const x = () => ({
|
|
53
54
|
recommendationCampaignUrls: {},
|
|
54
55
|
activePredictiveAlgorithms: [],
|
|
55
56
|
languages: {},
|
|
@@ -58,8 +59,8 @@ const N = () => ({
|
|
|
58
59
|
blockStates: {},
|
|
59
60
|
currentRecommendationId: null,
|
|
60
61
|
configVersion: 0
|
|
61
|
-
}),
|
|
62
|
-
state: () =>
|
|
62
|
+
}), T = P("guidoRecommendationExtension", {
|
|
63
|
+
state: () => x(),
|
|
63
64
|
getters: {
|
|
64
65
|
// ====================================================================
|
|
65
66
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -378,7 +379,7 @@ const N = () => ({
|
|
|
378
379
|
const n = [...e.recommendationConfigs.filters];
|
|
379
380
|
n[r] = {
|
|
380
381
|
...t,
|
|
381
|
-
isValid:
|
|
382
|
+
isValid: w(t)
|
|
382
383
|
}, e.recommendationConfigs.filters = n;
|
|
383
384
|
}
|
|
384
385
|
},
|
|
@@ -424,7 +425,7 @@ const N = () => ({
|
|
|
424
425
|
* every block's recommendationConfigs across user edits.
|
|
425
426
|
*/
|
|
426
427
|
hasInvalidBlock() {
|
|
427
|
-
return Object.values(this.blockStates).some((t) => !
|
|
428
|
+
return Object.values(this.blockStates).some((t) => !N(t.recommendationConfigs, this));
|
|
428
429
|
},
|
|
429
430
|
// ====================================================================
|
|
430
431
|
// Per-Block Product Fetching
|
|
@@ -453,7 +454,10 @@ const N = () => ({
|
|
|
453
454
|
details: !0,
|
|
454
455
|
campaignId: o.variationId
|
|
455
456
|
};
|
|
456
|
-
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)
|
|
457
|
+
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(
|
|
458
|
+
a,
|
|
459
|
+
v(o.partnerName, r.strategy)
|
|
460
|
+
);
|
|
457
461
|
let f;
|
|
458
462
|
try {
|
|
459
463
|
f = await h.fetchRecommendationProducts(i, a);
|
|
@@ -471,5 +475,5 @@ const N = () => ({
|
|
|
471
475
|
}
|
|
472
476
|
});
|
|
473
477
|
export {
|
|
474
|
-
|
|
478
|
+
T as useRecommendationExtensionStore
|
|
475
479
|
};
|