@useinsider/guido 2.0.0-beta.e73ba15 → 2.0.0-beta.fb0f99d
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 +53 -39
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +2 -2
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +9 -4
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +21 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +37 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +78 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +72 -70
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +60 -80
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +16 -14
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +27 -16
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/extensions/Blocks/common-control.js +6 -7
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +6 -17
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
- package/dist/src/stores/config.d.ts +147 -1
- package/dist/static/styles/components/button.css.js +1 -1
- package/dist/stores/config.js +7 -0
- package/package.json +1 -1
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var C = (a, n, t) => n in a ?
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ATTR_PRODUCT_IMAGE as O, ATTR_PRODUCT_NAME as
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var C = (a, n, t) => n in a ? T(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
|
+
var l = (a, n, t) => C(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as f } from "../../../common-control.js";
|
|
6
|
+
import { ATTR_PRODUCT_IMAGE as O, ATTR_PRODUCT_NAME as g, ATTR_PRODUCT_PRICE as R, ATTR_PRODUCT_OLD_PRICE as A, ATTR_PRODUCT_OMNIBUS_PRICE as D, ATTR_PRODUCT_OMNIBUS_DISCOUNT as N, ATTR_PRODUCT_BUTTON as V } from "../../constants/selectors.js";
|
|
7
|
+
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
8
|
+
import { getTableDisplayValue as I } from "../../utils/tagName.js";
|
|
9
|
+
import { getCurrentLayout as P } from "../main/utils.js";
|
|
10
|
+
const S = "ui-elements-recommendation-card-composition", k = {
|
|
9
11
|
ORDERABLE: "cardComposition"
|
|
10
|
-
},
|
|
12
|
+
}, c = ".recommendation-attribute-row", v = ".product-card-wrapper > tbody", _ = "data-card-composition", d = "data-attribute-type", m = "data-visibility", s = [
|
|
11
13
|
{ key: O, label: "Product Image", visible: !0 },
|
|
12
|
-
{ key:
|
|
14
|
+
{ key: g, label: "Product Name", visible: !0 },
|
|
13
15
|
{ key: R, label: "Product Price", visible: !0 },
|
|
14
|
-
{ key:
|
|
15
|
-
{ key:
|
|
16
|
-
{ key:
|
|
17
|
-
{ key:
|
|
16
|
+
{ key: A, label: "Product Original Price", visible: !0 },
|
|
17
|
+
{ key: D, label: "Omnibus Price", visible: !1 },
|
|
18
|
+
{ key: N, label: "Omnibus Discount", visible: !1 },
|
|
19
|
+
{ key: V, label: "Product Button", visible: !0 }
|
|
18
20
|
];
|
|
19
|
-
class
|
|
21
|
+
class H extends f {
|
|
20
22
|
constructor() {
|
|
21
23
|
super(...arguments);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
l(this, "store", E());
|
|
25
|
+
l(this, "unsubscribeOrientation", null);
|
|
24
26
|
}
|
|
25
27
|
getId() {
|
|
26
|
-
return
|
|
28
|
+
return S;
|
|
27
29
|
}
|
|
28
30
|
getTemplate() {
|
|
29
31
|
const t = s.map((e) => ({
|
|
@@ -34,7 +36,7 @@ class x extends g {
|
|
|
34
36
|
return `
|
|
35
37
|
<div class="container" data-card-composition-control>
|
|
36
38
|
${this._GuLabel({ text: "Card Element Order & Visibility" })}
|
|
37
|
-
${this._GuOrderable(
|
|
39
|
+
${this._GuOrderable(k.ORDERABLE, t)}
|
|
38
40
|
</div>
|
|
39
41
|
`;
|
|
40
42
|
}
|
|
@@ -85,7 +87,7 @@ class x extends g {
|
|
|
85
87
|
_readCompositionFromNode() {
|
|
86
88
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
87
89
|
return s.map((e) => e.key);
|
|
88
|
-
const t = this.currentNode.getAttribute(
|
|
90
|
+
const t = this.currentNode.getAttribute(_);
|
|
89
91
|
return t ? t.split(",").filter(Boolean) : s.map((e) => e.key);
|
|
90
92
|
}
|
|
91
93
|
/**
|
|
@@ -101,7 +103,7 @@ class x extends g {
|
|
|
101
103
|
_readVisibilityFromRows() {
|
|
102
104
|
if (!this.currentNode)
|
|
103
105
|
return this._getDefaultVisibilities();
|
|
104
|
-
const t = Array.from(this.currentNode.querySelectorAll(
|
|
106
|
+
const t = Array.from(this.currentNode.querySelectorAll(c)), e = this._extractVisibilityFromRows(t);
|
|
105
107
|
return this._mergeWithDefaults(e);
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
@@ -118,7 +120,7 @@ class x extends g {
|
|
|
118
120
|
return t.forEach((i) => {
|
|
119
121
|
if (!("getAttribute" in i))
|
|
120
122
|
return;
|
|
121
|
-
const o = i.getAttribute(
|
|
123
|
+
const o = i.getAttribute(d), r = i.getAttribute(m);
|
|
122
124
|
o && r !== null && (e[o] = this._parseVisibilityValue(r));
|
|
123
125
|
}), e;
|
|
124
126
|
}
|
|
@@ -146,7 +148,7 @@ class x extends g {
|
|
|
146
148
|
if (!this.currentNode)
|
|
147
149
|
return;
|
|
148
150
|
const e = this._getCurrentLayout();
|
|
149
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(
|
|
151
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(_, t.join(",")).apply(new u("Update card composition")), e === "vertical" && this._reorderProductAttributes(t);
|
|
150
152
|
}
|
|
151
153
|
/**
|
|
152
154
|
* Reorders attribute rows within each product card based on composition order
|
|
@@ -155,21 +157,21 @@ class x extends g {
|
|
|
155
157
|
_reorderProductAttributes(t) {
|
|
156
158
|
if (!this.currentNode)
|
|
157
159
|
return;
|
|
158
|
-
const e = this.currentNode.querySelectorAll(
|
|
160
|
+
const e = this.currentNode.querySelectorAll(v);
|
|
159
161
|
if (!(e != null && e.length))
|
|
160
162
|
return;
|
|
161
163
|
const i = this.api.getDocumentModifier();
|
|
162
164
|
e.forEach((o) => {
|
|
163
165
|
const r = this._buildCompositionHtml(o, t);
|
|
164
166
|
i.modifyHtml(o).setInnerHtml(r);
|
|
165
|
-
}), i.apply(new
|
|
167
|
+
}), i.apply(new u("Reorder product attributes"));
|
|
166
168
|
}
|
|
167
169
|
/**
|
|
168
170
|
* Builds HTML string with attributes ordered according to composition
|
|
169
171
|
*/
|
|
170
172
|
_buildCompositionHtml(t, e) {
|
|
171
173
|
return e.reduce((i, o) => {
|
|
172
|
-
const r = t.querySelector(`${
|
|
174
|
+
const r = t.querySelector(`${c}[${d}="${o}"]`);
|
|
173
175
|
return r && "getOuterHTML" in r ? i + r.getOuterHTML() : i;
|
|
174
176
|
}, "");
|
|
175
177
|
}
|
|
@@ -182,33 +184,20 @@ class x extends g {
|
|
|
182
184
|
_applyVisibilityToBlock(t, e) {
|
|
183
185
|
if (!this.currentNode)
|
|
184
186
|
return;
|
|
185
|
-
const i = this.currentNode.querySelectorAll(`${
|
|
187
|
+
const i = this.currentNode.querySelectorAll(`${c}[${d}="${t}"]`);
|
|
186
188
|
if (!(i != null && i.length))
|
|
187
189
|
return;
|
|
188
|
-
const o = e ? "1" : "0", r = `Set ${t} visibility to ${e ? "visible" : "hidden"}`,
|
|
189
|
-
i.forEach((
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
else if ("getTagName" in l) {
|
|
194
|
-
const _ = l;
|
|
195
|
-
typeof _.getTagName == "function" && (u = _.getTagName().toUpperCase());
|
|
196
|
-
}
|
|
197
|
-
const T = e ? u === "TD" || u === "BLOCK_IMAGE" || u === "BLOCK_BUTTON" ? "table-cell" : "table-row" : "none";
|
|
198
|
-
m.modifyHtml(l).setStyle("display", T).setAttribute(h, o);
|
|
199
|
-
}), m.apply(new d(r));
|
|
190
|
+
const o = e ? "1" : "0", r = `Set ${t} visibility to ${e ? "visible" : "hidden"}`, b = this.api.getDocumentModifier();
|
|
191
|
+
i.forEach((p) => {
|
|
192
|
+
const y = I(p), h = e ? y : "none";
|
|
193
|
+
b.modifyHtml(p).setStyle("display", h).setAttribute(m, o);
|
|
194
|
+
}), b.apply(new u(r));
|
|
200
195
|
}
|
|
201
196
|
/**
|
|
202
197
|
* Gets the current layout orientation from store or DOM
|
|
203
198
|
*/
|
|
204
199
|
_getCurrentLayout() {
|
|
205
|
-
|
|
206
|
-
if (t)
|
|
207
|
-
return t;
|
|
208
|
-
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
209
|
-
return "vertical";
|
|
210
|
-
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
211
|
-
return !e || !("getAttribute" in e) ? "vertical" : e.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
|
|
200
|
+
return this.store.recommendationConfigs.orientation || P(this.currentNode);
|
|
212
201
|
}
|
|
213
202
|
/**
|
|
214
203
|
* Updates orderable state based on layout orientation
|
|
@@ -238,6 +227,6 @@ class x extends g {
|
|
|
238
227
|
}
|
|
239
228
|
}
|
|
240
229
|
export {
|
|
241
|
-
|
|
242
|
-
|
|
230
|
+
S as COMPOSITION_CONTROL_BLOCK_ID,
|
|
231
|
+
H as RecommendationCardCompositionControl
|
|
243
232
|
};
|
|
@@ -1,40 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var c = (n, r, o) => r in n ? a(n, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[r] = o;
|
|
3
|
+
var e = (n, r, o) => c(n, typeof r != "symbol" ? r + "" : r, o);
|
|
4
4
|
import { CommonControl as m } from "../../../common-control.js";
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { AlgorithmControl as
|
|
7
|
-
import { ALGORITHM_CONTROL_ID as
|
|
8
|
-
import { CurrencyControl as
|
|
9
|
-
import { CURRENCY_CONTROL_ID as
|
|
10
|
-
import { FiltersControl as
|
|
11
|
-
import { FILTERS_CONTROL_ID as
|
|
12
|
-
import { LocaleControl as
|
|
13
|
-
import { LOCALE_CONTROL_ID as
|
|
14
|
-
import { ProductLayoutControl as
|
|
15
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
16
|
-
import { ShuffleControl as
|
|
5
|
+
import { useRecommendationExtensionStore as h } from "../../store/recommendation.js";
|
|
6
|
+
import { AlgorithmControl as u } from "./algorithm.js";
|
|
7
|
+
import { ALGORITHM_CONTROL_ID as x } from "./algorithm.js";
|
|
8
|
+
import { CurrencyControl as C } from "./currency.js";
|
|
9
|
+
import { CURRENCY_CONTROL_ID as k } from "./currency.js";
|
|
10
|
+
import { FiltersControl as f } from "./filters.js";
|
|
11
|
+
import { FILTERS_CONTROL_ID as A } from "./filters.js";
|
|
12
|
+
import { LocaleControl as d } from "./locale.js";
|
|
13
|
+
import { LOCALE_CONTROL_ID as z } from "./locale.js";
|
|
14
|
+
import { ProductLayoutControl as p } from "./productLayout.js";
|
|
15
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as Y } from "./productLayout.js";
|
|
16
|
+
import { ShuffleControl as R } from "./shuffle.js";
|
|
17
17
|
import { SHUFFLE_CONTROL_ID as B } from "./shuffle.js";
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
import { useDebounceFn as _ } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
19
|
+
const y = /* @__PURE__ */ new Set([
|
|
20
|
+
"size",
|
|
21
|
+
"strategy",
|
|
22
|
+
"filters",
|
|
23
|
+
"productIds",
|
|
24
|
+
"language",
|
|
25
|
+
"shuffleProducts"
|
|
26
|
+
]), L = "ui-elements-recommendation-block";
|
|
27
|
+
class P extends m {
|
|
20
28
|
constructor() {
|
|
21
29
|
super(...arguments);
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
e(this, "store", h());
|
|
31
|
+
e(this, "storeUnsubscription", () => {
|
|
24
32
|
});
|
|
25
33
|
// Sub-control instances for lifecycle management
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
e(this, "algorithmControl", null);
|
|
35
|
+
e(this, "localeControl", null);
|
|
36
|
+
e(this, "currencyControl", null);
|
|
37
|
+
e(this, "productLayoutControl", null);
|
|
38
|
+
e(this, "filtersControl", null);
|
|
39
|
+
e(this, "shuffleControl", null);
|
|
40
|
+
/**
|
|
41
|
+
* Debounced product fetch to prevent rapid API calls during config changes
|
|
42
|
+
*/
|
|
43
|
+
e(this, "_debouncedFetchProducts", _(() => {
|
|
44
|
+
this.store.fetchRecommendationProducts();
|
|
45
|
+
}, 500));
|
|
32
46
|
}
|
|
33
47
|
getId() {
|
|
34
|
-
return
|
|
48
|
+
return L;
|
|
35
49
|
}
|
|
36
50
|
getTemplate() {
|
|
37
|
-
return this.algorithmControl = new
|
|
51
|
+
return this.algorithmControl = new u(), this.localeControl = new d(), this.currencyControl = new C(), this.productLayoutControl = new p(), this.filtersControl = new f(), this.shuffleControl = new R(), `
|
|
38
52
|
<div class="recommendation-controls-container">
|
|
39
53
|
${this.algorithmControl.getTemplate()}
|
|
40
54
|
${this.localeControl.getTemplate()}
|
|
@@ -50,17 +64,26 @@ class I extends m {
|
|
|
50
64
|
this.store.fetchRecommendationFilters(),
|
|
51
65
|
this.store.fetchRecommendationCreateData(),
|
|
52
66
|
this.store.fetchRecommendationProducts()
|
|
53
|
-
])).forEach((
|
|
54
|
-
|
|
67
|
+
])).forEach((t, s) => {
|
|
68
|
+
t.status === "rejected" && console.warn(`Recommendation block: ${[
|
|
55
69
|
"fetchRecommendationFilters",
|
|
56
70
|
"fetchRecommendationCreateData",
|
|
57
71
|
"fetchRecommendationProducts"
|
|
58
|
-
][
|
|
72
|
+
][s]} failed`, t.reason);
|
|
59
73
|
}), this._initializeSubControls(), this._listenStateUpdates();
|
|
60
74
|
}
|
|
61
75
|
onDestroy() {
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
this.storeUnsubscription(), [
|
|
77
|
+
this.algorithmControl,
|
|
78
|
+
this.localeControl,
|
|
79
|
+
this.currencyControl,
|
|
80
|
+
this.productLayoutControl,
|
|
81
|
+
this.filtersControl,
|
|
82
|
+
this.shuffleControl
|
|
83
|
+
].forEach((t) => {
|
|
84
|
+
var s;
|
|
85
|
+
return (s = t == null ? void 0 : t.onDestroy) == null ? void 0 : s.call(t);
|
|
86
|
+
});
|
|
64
87
|
}
|
|
65
88
|
/**
|
|
66
89
|
* Initialize all sub-controls with the shared API context
|
|
@@ -74,33 +97,38 @@ class I extends m {
|
|
|
74
97
|
this.productLayoutControl,
|
|
75
98
|
this.filtersControl,
|
|
76
99
|
this.shuffleControl
|
|
77
|
-
].forEach((
|
|
78
|
-
var
|
|
79
|
-
|
|
100
|
+
].forEach((t) => {
|
|
101
|
+
var s;
|
|
102
|
+
t && (t.api = this.api, t.currentNode = this.currentNode, (s = t.onRender) == null || s.call(t));
|
|
80
103
|
});
|
|
81
104
|
}
|
|
82
105
|
/**
|
|
83
106
|
* Listen to store changes that require product refresh
|
|
107
|
+
* Only triggers for meaningful config changes (size, strategy, filters, etc.)
|
|
108
|
+
* Uses debounce to prevent rapid API calls
|
|
84
109
|
*/
|
|
85
110
|
_listenStateUpdates() {
|
|
86
|
-
this.storeUnsubscription = this.store.$subscribe((
|
|
87
|
-
"payload" in
|
|
111
|
+
this.storeUnsubscription = this.store.$subscribe((o) => {
|
|
112
|
+
if ("payload" in o) {
|
|
113
|
+
const t = o.payload.recommendationConfigs;
|
|
114
|
+
t && Object.keys(t).some((l) => y.has(l)) && this._debouncedFetchProducts();
|
|
115
|
+
}
|
|
88
116
|
});
|
|
89
117
|
}
|
|
90
118
|
}
|
|
91
119
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
120
|
+
x as ALGORITHM_CONTROL_ID,
|
|
121
|
+
u as AlgorithmControl,
|
|
122
|
+
L as CONTROL_BLOCK_ID,
|
|
123
|
+
k as CURRENCY_CONTROL_ID,
|
|
124
|
+
C as CurrencyControl,
|
|
125
|
+
A as FILTERS_CONTROL_ID,
|
|
126
|
+
f as FiltersControl,
|
|
127
|
+
z as LOCALE_CONTROL_ID,
|
|
128
|
+
d as LocaleControl,
|
|
129
|
+
Y as PRODUCT_LAYOUT_CONTROL_ID,
|
|
130
|
+
p as ProductLayoutControl,
|
|
131
|
+
P as RecommendationBlockControl,
|
|
104
132
|
B as SHUFFLE_CONTROL_ID,
|
|
105
|
-
|
|
133
|
+
R as ShuffleControl
|
|
106
134
|
};
|
|
@@ -1,112 +1,114 @@
|
|
|
1
1
|
import { ModificationDescription as s } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { CONTAINER_SELECTOR as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { prepareProductRows as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { CONTAINER_SELECTOR as S } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as A } from "../../store/recommendation.js";
|
|
4
|
+
import { prepareProductRows as b } from "../../templates/index.js";
|
|
5
|
+
import { hasGetStyle as d, isTdNode as C } from "../../utils/tagName.js";
|
|
6
|
+
import { DEFAULT_CARD_COMPOSITION as f, getDefaultProducts as h } from "../../templates/utils.js";
|
|
7
|
+
const m = "ins-recommendation-v3-block-v2";
|
|
8
|
+
function p(r) {
|
|
9
|
+
if (!r)
|
|
9
10
|
return null;
|
|
10
|
-
if ("getAttribute" in
|
|
11
|
-
const t =
|
|
12
|
-
if (t && t.includes(
|
|
13
|
-
return
|
|
11
|
+
if ("getAttribute" in r) {
|
|
12
|
+
const t = r.getAttribute("class");
|
|
13
|
+
if (t && t.includes(m))
|
|
14
|
+
return r;
|
|
14
15
|
}
|
|
15
|
-
return "querySelector" in
|
|
16
|
+
return "querySelector" in r ? r.querySelector(`.${m}`) : null;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
const t = p(
|
|
18
|
+
function g(r) {
|
|
19
|
+
const t = p(r);
|
|
19
20
|
return !t || !("getAttribute" in t) ? "vertical" : t.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
const t = p(
|
|
22
|
+
function w(r) {
|
|
23
|
+
const t = p(r);
|
|
23
24
|
if (!t || !("getAttribute" in t))
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
return f;
|
|
26
|
+
const e = t.getAttribute("data-card-composition");
|
|
27
|
+
return e ? e.split(",").filter(Boolean) : f;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
const { currentNode: t, documentModifier:
|
|
29
|
+
function I(r) {
|
|
30
|
+
const { currentNode: t, documentModifier: e, afterRegenerate: o } = r;
|
|
30
31
|
if (!t || !("querySelector" in t))
|
|
31
32
|
return;
|
|
32
|
-
const a = t.querySelector(
|
|
33
|
+
const a = t.querySelector(S);
|
|
33
34
|
if (!a)
|
|
34
35
|
return;
|
|
35
|
-
const
|
|
36
|
+
const n = A(), c = n.recommendationProducts.length > 0 ? n.recommendationProducts : h(), { cardsInRow: l } = n.recommendationConfigs, i = w(t), u = g(t), y = b(c, u, {
|
|
36
37
|
productsPerRow: l,
|
|
37
|
-
composition:
|
|
38
|
+
composition: i
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
+
e.modifyHtml(a).setInnerHtml(y).apply(new s("Updated product")), o == null || o();
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const
|
|
43
|
-
let
|
|
42
|
+
function E(r, t, e, o) {
|
|
43
|
+
const n = `0 ${Math.floor(e / 2)}px`;
|
|
44
|
+
let c = !1;
|
|
44
45
|
return o === "vertical" ? Array.from(
|
|
45
|
-
|
|
46
|
-
).forEach((
|
|
47
|
-
t.modifyHtml(
|
|
46
|
+
r.querySelectorAll(".attribute-cell")
|
|
47
|
+
).forEach((i) => {
|
|
48
|
+
t.modifyHtml(i).setStyle("padding", n), c = !0;
|
|
48
49
|
}) : Array.from(
|
|
49
|
-
|
|
50
|
-
).forEach((
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
function E(e, t, r) {
|
|
55
|
-
const o = `${r}px`, a = Array.from(e.querySelectorAll(".spacer"));
|
|
56
|
-
let c = !1;
|
|
57
|
-
return a.forEach((i) => {
|
|
58
|
-
t.modifyHtml(i).setStyle("height", o), c = !0;
|
|
50
|
+
r.querySelectorAll(".product-card-wrapper")
|
|
51
|
+
).forEach((i) => {
|
|
52
|
+
const u = "parentNode" in i ? i.parentNode : null;
|
|
53
|
+
u && C(u) && (t.modifyHtml(u).setStyle("padding", n), c = !0);
|
|
59
54
|
}), c;
|
|
60
55
|
}
|
|
61
|
-
function
|
|
62
|
-
const
|
|
56
|
+
function k(r, t, e) {
|
|
57
|
+
const o = `${e}px`, a = Array.from(r.querySelectorAll(".spacer"));
|
|
58
|
+
let n = !1;
|
|
59
|
+
return a.forEach((c) => {
|
|
60
|
+
t.modifyHtml(c).setStyle("height", o), n = !0;
|
|
61
|
+
}), n;
|
|
62
|
+
}
|
|
63
|
+
function v(r) {
|
|
64
|
+
const { currentNode: t, documentModifier: e } = r;
|
|
63
65
|
if (!t)
|
|
64
66
|
return;
|
|
65
67
|
const o = p(t);
|
|
66
68
|
if (!o || !("getAttribute" in o))
|
|
67
69
|
return;
|
|
68
|
-
const a = o.getAttribute("data-column-spacing"),
|
|
70
|
+
const a = o.getAttribute("data-column-spacing"), n = o.getAttribute("data-row-spacing"), c = g(t);
|
|
69
71
|
let l = !1;
|
|
70
72
|
if (a) {
|
|
71
|
-
const
|
|
72
|
-
Number.isNaN(
|
|
73
|
+
const i = parseInt(a);
|
|
74
|
+
Number.isNaN(i) || (l = E(
|
|
73
75
|
t,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
e,
|
|
77
|
+
i,
|
|
78
|
+
c
|
|
77
79
|
));
|
|
78
80
|
}
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
if (!Number.isNaN(
|
|
82
|
-
const u =
|
|
81
|
+
if (n) {
|
|
82
|
+
const i = parseInt(n);
|
|
83
|
+
if (!Number.isNaN(i)) {
|
|
84
|
+
const u = k(t, e, i);
|
|
83
85
|
l = l || u;
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
|
-
l &&
|
|
88
|
+
l && e.apply(new s("Reapply spacing after regeneration"));
|
|
87
89
|
}
|
|
88
|
-
function
|
|
89
|
-
if (!
|
|
90
|
+
function x(r) {
|
|
91
|
+
if (!r)
|
|
90
92
|
return null;
|
|
91
|
-
const t =
|
|
93
|
+
const t = r.querySelector(".product-card-segment"), e = r.querySelector(".product-card-wrapper");
|
|
92
94
|
let o = null;
|
|
93
|
-
return t &&
|
|
95
|
+
return t && d(t) && (o = t.getStyle("background-color") ?? null), (!o || o === "transparent") && e && d(e) && (o = e.getStyle("background-color") ?? null), o;
|
|
94
96
|
}
|
|
95
|
-
function
|
|
96
|
-
const { currentNode: t, documentModifier:
|
|
97
|
+
function O(r) {
|
|
98
|
+
const { currentNode: t, documentModifier: e, bgColor: o, layout: a } = r;
|
|
97
99
|
if (!o || o === "transparent" || !t)
|
|
98
100
|
return;
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}),
|
|
101
|
+
const n = a === "vertical" ? ".product-card-segment" : ".product-card-wrapper", c = Array.from(t.querySelectorAll(n));
|
|
102
|
+
c.length !== 0 && (c.forEach((l) => {
|
|
103
|
+
e.modifyHtml(l).setStyle("background-color", o);
|
|
104
|
+
}), e.apply(new s("Apply card background color")));
|
|
103
105
|
}
|
|
104
106
|
export {
|
|
105
|
-
|
|
107
|
+
O as applyCardBackgroundColor,
|
|
106
108
|
p as getBlockElement,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
w as getCardComposition,
|
|
110
|
+
x as getCurrentCardBackgroundColor,
|
|
111
|
+
g as getCurrentLayout,
|
|
112
|
+
v as reapplySpacing,
|
|
113
|
+
I as regenerateProductRows
|
|
112
114
|
};
|
|
@@ -5,7 +5,7 @@ import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
|
5
5
|
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
6
|
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
7
|
const i = "data-text-before", u = "", p = ".omnibus-text-before";
|
|
8
|
-
class
|
|
8
|
+
class g extends l {
|
|
9
9
|
getId() {
|
|
10
10
|
return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
|
|
11
11
|
}
|
|
@@ -64,10 +64,10 @@ class B extends l {
|
|
|
64
64
|
}
|
|
65
65
|
_listenToFormUpdates() {
|
|
66
66
|
this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
|
|
67
|
-
this._onTextChange(e);
|
|
67
|
+
typeof e == "string" && this._onTextChange(e);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
export {
|
|
72
|
-
|
|
72
|
+
g as OmnibusDiscountTextBeforeControl
|
|
73
73
|
};
|