@useinsider/guido 3.2.0-beta.caa22bf → 3.2.0-beta.ccaf9f5
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 +0 -92
- package/dist/@types/config/schemas.js +94 -150
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +75 -75
- package/dist/composables/useCortexBlueprintBridge.js +38 -0
- package/dist/composables/useEmailTemplateApplier.js +41 -0
- package/dist/composables/useRecommendation.js +26 -46
- package/dist/composables/useSave.js +18 -21
- package/dist/composables/useStripo.js +16 -14
- package/dist/config/compiler/recommendationCompilerRules.js +27 -27
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/radioButtonMigrator.js +44 -64
- package/dist/config/migrator/recommendationMigrator.js +290 -74
- package/dist/enums/displayConditions.js +80 -0
- package/dist/enums/extensions/recommendationBlock.js +1 -2
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +32 -35
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +24 -25
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +181 -228
- package/dist/extensions/Blocks/Recommendation/services/configService.js +29 -65
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +90 -130
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +22 -13
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +235 -450
- package/dist/src/@types/config/defaults.d.ts +1 -5
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +0 -213
- package/dist/src/@types/config/types.d.ts +1 -9
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +0 -56
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +17 -0
- package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -10
- package/dist/src/config/migrator/index.d.ts +1 -2
- package/dist/src/config/migrator/recommendationMigrator.d.ts +1 -13
- package/dist/src/enums/displayConditions.d.ts +2 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -34
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +3 -0
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/config.d.ts +0 -504
- package/dist/utils/templatePreparation.js +32 -72
- package/package.json +1 -5
- package/dist/composables/validators/useCouponBlockValidator.js +0 -24
- package/dist/config/migrator/recommendation/compositionMapper.js +0 -98
- package/dist/config/migrator/recommendation/extractors.js +0 -27
- package/dist/config/migrator/recommendation/htmlBuilder.js +0 -496
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +0 -33
- package/dist/config/migrator/recommendation/settingsMapper.js +0 -70
- package/dist/config/migrator/recommendation/themeMapper.js +0 -93
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +0 -21
- package/dist/src/composables/useRecommendation.test.d.ts +0 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +0 -2
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -7
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -11
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +0 -15
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +0 -7
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +0 -5
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +0 -1
- package/dist/src/config/migrator/recommendation/types.d.ts +0 -205
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +0 -1
- package/dist/src/utils/htmlEscape.d.ts +0 -5
- package/dist/src/utils/htmlEscape.test.d.ts +0 -1
- package/dist/utils/htmlEscape.js +0 -13
|
@@ -1,184 +1,180 @@
|
|
|
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 { MOBILE_CONTAINER_SELECTOR as
|
|
3
|
+
import { MOBILE_CONTAINER_SELECTOR as P, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as q, CONTAINER_SELECTOR as $ } 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
|
-
import { prepareProductRows as
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
6
|
+
import { prepareProductRows as T } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as B } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as v } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as j } from "../../templates/utils.js";
|
|
10
|
+
const h = "recommendation-block-v2";
|
|
11
|
+
function M(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
|
-
function
|
|
22
|
-
const e =
|
|
21
|
+
function g(t) {
|
|
22
|
+
const e = M(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 _(t) {
|
|
29
|
+
const e = M(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
31
|
return R;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
33
|
return o ? o.split(",").filter(Boolean) : R;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
if (!
|
|
37
|
-
return
|
|
38
|
-
const
|
|
39
|
-
(
|
|
35
|
+
function b(t, e, o) {
|
|
36
|
+
if (!e || !("childNodes" in e))
|
|
37
|
+
return !1;
|
|
38
|
+
const i = e.childNodes().find(
|
|
39
|
+
(l) => "getType" in l && l.getType() === "text"
|
|
40
40
|
);
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
function S(t, e, o) {
|
|
44
|
-
const n = D(e);
|
|
45
|
-
return n ? (t.modifyHtml(n).setText(o), !0) : !1;
|
|
41
|
+
return i ? (t.modifyHtml(i).setText(o), !0) : !1;
|
|
46
42
|
}
|
|
47
|
-
function
|
|
43
|
+
function x(t, e) {
|
|
48
44
|
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
49
45
|
}
|
|
50
|
-
function
|
|
46
|
+
function V(t) {
|
|
51
47
|
const { currentNode: e, documentModifier: o } = t;
|
|
52
48
|
if (!e || !("querySelector" in e))
|
|
53
49
|
return;
|
|
54
50
|
const n = e.querySelector(k);
|
|
55
51
|
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
56
52
|
}
|
|
57
|
-
function
|
|
53
|
+
function W(t) {
|
|
58
54
|
const {
|
|
59
55
|
currentNode: e,
|
|
60
56
|
documentModifier: o,
|
|
61
57
|
products: n,
|
|
62
58
|
layout: i,
|
|
63
|
-
composition:
|
|
59
|
+
composition: l
|
|
64
60
|
} = t;
|
|
65
61
|
if (!e || !("querySelector" in e))
|
|
66
62
|
return;
|
|
67
|
-
const r = i ??
|
|
68
|
-
if (r === "list" || !
|
|
69
|
-
|
|
63
|
+
const r = i ?? g(e), u = E.getConfig(e);
|
|
64
|
+
if (r === "list" || !u.mobileLayoutEnabled) {
|
|
65
|
+
V({ currentNode: e, documentModifier: o });
|
|
70
66
|
return;
|
|
71
67
|
}
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
68
|
+
const s = e.querySelector(k);
|
|
69
|
+
if (!s)
|
|
74
70
|
return;
|
|
75
|
-
const
|
|
76
|
-
productsPerRow:
|
|
77
|
-
composition:
|
|
78
|
-
filterList:
|
|
71
|
+
const c = C(), a = x(n, c.recommendationProducts), f = l ?? _(e), S = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${T(a, r, {
|
|
72
|
+
productsPerRow: u.mobileCardsInRow,
|
|
73
|
+
composition: f,
|
|
74
|
+
filterList: c.filterList
|
|
79
75
|
})}</table></td>`;
|
|
80
|
-
o.modifyHtml(
|
|
76
|
+
o.modifyHtml(s).setInnerHtml(S), o.apply(new p("Updated mobile product rows"));
|
|
81
77
|
}
|
|
82
|
-
function
|
|
78
|
+
function G(t) {
|
|
83
79
|
const {
|
|
84
80
|
currentNode: e,
|
|
85
81
|
documentModifier: o,
|
|
86
82
|
afterRegenerate: n,
|
|
87
83
|
products: i,
|
|
88
|
-
layout:
|
|
84
|
+
layout: l,
|
|
89
85
|
composition: r
|
|
90
86
|
} = t;
|
|
91
87
|
if (!e || !("querySelector" in e))
|
|
92
88
|
return;
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
89
|
+
const u = e.querySelector(q) ?? e.querySelector($);
|
|
90
|
+
if (!u)
|
|
95
91
|
return;
|
|
96
|
-
const
|
|
97
|
-
productsPerRow:
|
|
98
|
-
composition:
|
|
99
|
-
filterList:
|
|
92
|
+
const s = C(), c = x(i, s.recommendationProducts), { cardsInRow: a } = s.recommendationConfigs, f = r ?? _(e), d = l ?? g(e), S = T(c, d, {
|
|
93
|
+
productsPerRow: a,
|
|
94
|
+
composition: f,
|
|
95
|
+
filterList: s.filterList
|
|
100
96
|
});
|
|
101
|
-
o.modifyHtml(
|
|
97
|
+
o.modifyHtml(u).setInnerHtml(S).apply(new p("Updated product")), W(t), n == null || n();
|
|
102
98
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
99
|
+
function I(t, e, o, n) {
|
|
100
|
+
const l = `0 ${Math.floor(o / 2)}px`;
|
|
105
101
|
let r = !1;
|
|
106
102
|
return n === "grid" ? Array.from(
|
|
107
103
|
t.querySelectorAll(".attribute-cell")
|
|
108
|
-
).forEach((
|
|
109
|
-
e.modifyHtml(
|
|
104
|
+
).forEach((s) => {
|
|
105
|
+
e.modifyHtml(s).setStyle("padding", l), r = !0;
|
|
110
106
|
}) : Array.from(
|
|
111
107
|
t.querySelectorAll(".product-card-wrapper")
|
|
112
|
-
).forEach((
|
|
113
|
-
const
|
|
114
|
-
|
|
108
|
+
).forEach((s) => {
|
|
109
|
+
const c = "parentNode" in s ? s.parentNode : null;
|
|
110
|
+
c && v(c) && (e.modifyHtml(c).setStyle("padding", l), r = !0);
|
|
115
111
|
}), r;
|
|
116
112
|
}
|
|
117
|
-
function
|
|
113
|
+
function O(t, e, o) {
|
|
118
114
|
const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
|
|
119
|
-
let
|
|
115
|
+
let l = !1;
|
|
120
116
|
return i.forEach((r) => {
|
|
121
|
-
e.modifyHtml(r).setStyle("height", n),
|
|
122
|
-
}),
|
|
117
|
+
e.modifyHtml(r).setStyle("height", n), l = !0;
|
|
118
|
+
}), l;
|
|
123
119
|
}
|
|
124
|
-
function
|
|
120
|
+
function Y(t) {
|
|
125
121
|
const { currentNode: e, documentModifier: o } = t;
|
|
126
122
|
if (!e)
|
|
127
123
|
return;
|
|
128
|
-
const n = E.getConfig(e), i =
|
|
129
|
-
let
|
|
130
|
-
const r = e.querySelector(
|
|
124
|
+
const n = E.getConfig(e), i = g(e);
|
|
125
|
+
let l = !1;
|
|
126
|
+
const r = e.querySelector(q);
|
|
131
127
|
if (r) {
|
|
132
|
-
|
|
128
|
+
l = I(
|
|
133
129
|
r,
|
|
134
130
|
o,
|
|
135
131
|
n.columnSpacing,
|
|
136
132
|
i
|
|
137
133
|
);
|
|
138
|
-
const
|
|
134
|
+
const c = O(
|
|
139
135
|
r,
|
|
140
136
|
o,
|
|
141
137
|
n.rowSpacing
|
|
142
138
|
);
|
|
143
|
-
|
|
139
|
+
l = l || c;
|
|
144
140
|
}
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
const
|
|
148
|
-
|
|
141
|
+
const u = e.querySelector(P);
|
|
142
|
+
if (u) {
|
|
143
|
+
const s = I(
|
|
144
|
+
u,
|
|
149
145
|
o,
|
|
150
146
|
n.mobileColumnSpacing,
|
|
151
147
|
i
|
|
152
148
|
);
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
149
|
+
l = l || s;
|
|
150
|
+
const c = O(
|
|
151
|
+
u,
|
|
156
152
|
o,
|
|
157
153
|
n.mobileRowSpacing
|
|
158
154
|
);
|
|
159
|
-
|
|
155
|
+
l = l || c;
|
|
160
156
|
}
|
|
161
|
-
|
|
157
|
+
l && o.apply(new p("Reapply spacing after regeneration"));
|
|
162
158
|
}
|
|
163
|
-
function
|
|
164
|
-
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout:
|
|
165
|
-
e &&
|
|
159
|
+
function re(t) {
|
|
160
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: l, composition: r } = t;
|
|
161
|
+
e && G({
|
|
166
162
|
currentNode: e,
|
|
167
163
|
documentModifier: o,
|
|
168
164
|
products: i,
|
|
169
|
-
layout:
|
|
165
|
+
layout: l,
|
|
170
166
|
composition: r,
|
|
171
167
|
afterRegenerate: () => {
|
|
172
168
|
setTimeout(() => {
|
|
173
|
-
|
|
169
|
+
Y({ currentNode: e, documentModifier: o });
|
|
174
170
|
}, 0), n == null || n();
|
|
175
171
|
}
|
|
176
172
|
});
|
|
177
173
|
}
|
|
178
|
-
function
|
|
174
|
+
function ie(t, e) {
|
|
179
175
|
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
180
176
|
}
|
|
181
|
-
function
|
|
177
|
+
function D() {
|
|
182
178
|
const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
183
179
|
return {
|
|
184
180
|
code: e.value,
|
|
@@ -190,119 +186,76 @@ function H() {
|
|
|
190
186
|
};
|
|
191
187
|
}
|
|
192
188
|
function A(t, e = "price") {
|
|
193
|
-
const o =
|
|
194
|
-
return
|
|
189
|
+
const o = D(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
190
|
+
return B({
|
|
195
191
|
price: i,
|
|
196
192
|
currency: o
|
|
197
193
|
});
|
|
198
194
|
}
|
|
199
|
-
function
|
|
200
|
-
var
|
|
201
|
-
const e =
|
|
195
|
+
function F(t) {
|
|
196
|
+
var l, r;
|
|
197
|
+
const e = D(), o = ((l = t.original_price) == null ? void 0 : l[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
198
|
return i > 0 ? `-${i}%` : "0%";
|
|
203
199
|
}
|
|
204
|
-
function
|
|
205
|
-
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl:
|
|
206
|
-
let
|
|
200
|
+
function H(t) {
|
|
201
|
+
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: l, omnibusDiscountEl: r } = t;
|
|
202
|
+
let u = !1;
|
|
207
203
|
if (n && "querySelector" in n) {
|
|
208
|
-
const
|
|
209
|
-
|
|
204
|
+
const s = n.querySelector("strong") ?? null, c = A(o, "price");
|
|
205
|
+
b(e, s, c) && (u = !0);
|
|
210
206
|
}
|
|
211
207
|
if (i && "querySelector" in i) {
|
|
212
|
-
const
|
|
213
|
-
|
|
208
|
+
const s = i.querySelector("strong") ?? null, c = A(o, "original_price");
|
|
209
|
+
b(e, s, c) && (u = !0);
|
|
214
210
|
}
|
|
215
|
-
if (
|
|
216
|
-
const
|
|
217
|
-
|
|
211
|
+
if (l && "querySelector" in l) {
|
|
212
|
+
const s = l.querySelector(".omnibus-price-value") ?? null, c = A(o, "original_price");
|
|
213
|
+
b(e, s, c) && (u = !0);
|
|
218
214
|
}
|
|
219
215
|
if (r && "querySelector" in r) {
|
|
220
|
-
const
|
|
221
|
-
|
|
216
|
+
const s = r.querySelector(".omnibus-discount-value") ?? null, c = F(o);
|
|
217
|
+
b(e, s, c) && (u = !0);
|
|
222
218
|
}
|
|
223
|
-
return
|
|
219
|
+
return u;
|
|
224
220
|
}
|
|
225
|
-
function
|
|
221
|
+
function K(t) {
|
|
226
222
|
const {
|
|
227
223
|
documentModifier: e,
|
|
228
224
|
product: o,
|
|
229
225
|
imageEl: n,
|
|
230
226
|
nameEl: i,
|
|
231
|
-
priceEl:
|
|
227
|
+
priceEl: l,
|
|
232
228
|
oldPriceEl: r,
|
|
233
|
-
omnibusPriceEl:
|
|
234
|
-
omnibusDiscountEl:
|
|
235
|
-
buttonEl:
|
|
229
|
+
omnibusPriceEl: u,
|
|
230
|
+
omnibusDiscountEl: s,
|
|
231
|
+
buttonEl: c
|
|
236
232
|
} = t;
|
|
237
|
-
let
|
|
233
|
+
let a = !1;
|
|
238
234
|
if (n && "querySelector" in n) {
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
235
|
+
const f = n.querySelector("img");
|
|
236
|
+
f && (e.modifyHtml(f).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), a = !0);
|
|
237
|
+
const d = n.querySelector("a");
|
|
238
|
+
d && (e.modifyHtml(d).setAttribute("href", o.url), a = !0);
|
|
243
239
|
}
|
|
244
240
|
if (i && "querySelector" in i) {
|
|
245
|
-
const
|
|
246
|
-
|
|
241
|
+
const f = i.querySelector("strong") ?? null;
|
|
242
|
+
b(e, f, o.name) && (a = !0);
|
|
247
243
|
}
|
|
248
|
-
if (
|
|
244
|
+
if (H({
|
|
249
245
|
documentModifier: e,
|
|
250
246
|
product: o,
|
|
251
|
-
priceEl:
|
|
247
|
+
priceEl: l,
|
|
252
248
|
oldPriceEl: r,
|
|
253
|
-
omnibusPriceEl:
|
|
254
|
-
omnibusDiscountEl:
|
|
255
|
-
}) && (
|
|
256
|
-
const
|
|
257
|
-
|
|
249
|
+
omnibusPriceEl: u,
|
|
250
|
+
omnibusDiscountEl: s
|
|
251
|
+
}) && (a = !0), c && "querySelector" in c) {
|
|
252
|
+
const f = c.querySelector("a.es-button") || c.querySelector("a");
|
|
253
|
+
f && (e.modifyHtml(f).setAttribute("href", o.url), a = !0);
|
|
258
254
|
}
|
|
259
|
-
return
|
|
260
|
-
}
|
|
261
|
-
function B(t) {
|
|
262
|
-
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
255
|
+
return a;
|
|
263
256
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
var n;
|
|
267
|
-
let o;
|
|
268
|
-
if (t.startsWith(O)) {
|
|
269
|
-
const i = t.slice(O.length);
|
|
270
|
-
o = (n = e.product_attributes) == null ? void 0 : n[i];
|
|
271
|
-
} else
|
|
272
|
-
o = e[t];
|
|
273
|
-
return typeof o == "string" && o.length > 0 ? o : typeof o == "number" ? String(o) : null;
|
|
274
|
-
}
|
|
275
|
-
function Z(t, e, o) {
|
|
276
|
-
if (!("querySelectorAll" in t))
|
|
277
|
-
return !1;
|
|
278
|
-
const n = t.querySelectorAll(
|
|
279
|
-
`[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
|
|
280
|
-
);
|
|
281
|
-
if (n.length === 0)
|
|
282
|
-
return !1;
|
|
283
|
-
const i = /* @__PURE__ */ new Map();
|
|
284
|
-
n.forEach((r) => {
|
|
285
|
-
if (!("getAttribute" in r))
|
|
286
|
-
return;
|
|
287
|
-
const s = r.getAttribute(W);
|
|
288
|
-
if (!s)
|
|
289
|
-
return;
|
|
290
|
-
const u = i.get(s) ?? [];
|
|
291
|
-
u.push(r), i.set(s, u);
|
|
292
|
-
});
|
|
293
|
-
let c = !1;
|
|
294
|
-
return i.forEach((r, s) => {
|
|
295
|
-
const u = Math.min(r.length, o.length);
|
|
296
|
-
r.slice(0, u).forEach((l, d) => {
|
|
297
|
-
if (!("querySelector" in l))
|
|
298
|
-
return;
|
|
299
|
-
const a = Q(s, o[d]);
|
|
300
|
-
if (a === null)
|
|
301
|
-
return;
|
|
302
|
-
const f = l.querySelector("p") ?? null;
|
|
303
|
-
S(e, f, a) && (c = !0);
|
|
304
|
-
});
|
|
305
|
-
}), c;
|
|
257
|
+
function U(t) {
|
|
258
|
+
return "querySelector" in t ? t.querySelector(q) ?? t : t;
|
|
306
259
|
}
|
|
307
260
|
function w(t, e, o) {
|
|
308
261
|
if (!("querySelectorAll" in t))
|
|
@@ -311,54 +264,54 @@ function w(t, e, o) {
|
|
|
311
264
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
312
265
|
), i = t.querySelectorAll(
|
|
313
266
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
314
|
-
),
|
|
267
|
+
), l = t.querySelectorAll(
|
|
315
268
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
316
269
|
), r = t.querySelectorAll(
|
|
317
270
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
318
|
-
), s = t.querySelectorAll(
|
|
319
|
-
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
320
271
|
), u = t.querySelectorAll(
|
|
272
|
+
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
273
|
+
), s = t.querySelectorAll(
|
|
321
274
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
322
|
-
),
|
|
275
|
+
), c = t.querySelectorAll(
|
|
323
276
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
324
|
-
),
|
|
325
|
-
let
|
|
326
|
-
for (let
|
|
327
|
-
const
|
|
277
|
+
), a = Math.min(n.length, o.length);
|
|
278
|
+
let f = !1;
|
|
279
|
+
for (let d = 0; d < a; d++) {
|
|
280
|
+
const S = K({
|
|
328
281
|
documentModifier: e,
|
|
329
|
-
product: o[
|
|
330
|
-
imageEl: n[
|
|
331
|
-
nameEl: i[
|
|
332
|
-
priceEl:
|
|
333
|
-
oldPriceEl: r[
|
|
334
|
-
omnibusPriceEl:
|
|
335
|
-
omnibusDiscountEl:
|
|
336
|
-
buttonEl:
|
|
282
|
+
product: o[d],
|
|
283
|
+
imageEl: n[d] ?? null,
|
|
284
|
+
nameEl: i[d] ?? null,
|
|
285
|
+
priceEl: l[d] ?? null,
|
|
286
|
+
oldPriceEl: r[d] ?? null,
|
|
287
|
+
omnibusPriceEl: u[d] ?? null,
|
|
288
|
+
omnibusDiscountEl: s[d] ?? null,
|
|
289
|
+
buttonEl: c[d] ?? null
|
|
337
290
|
});
|
|
338
|
-
|
|
291
|
+
f = f || S;
|
|
339
292
|
}
|
|
340
|
-
return
|
|
293
|
+
return f;
|
|
341
294
|
}
|
|
342
|
-
function
|
|
295
|
+
function le(t) {
|
|
343
296
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
344
297
|
if (!e || !("querySelectorAll" in e))
|
|
345
298
|
return !1;
|
|
346
|
-
const i =
|
|
299
|
+
const i = U(e);
|
|
347
300
|
if (!("querySelectorAll" in i) || i.querySelectorAll(
|
|
348
301
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
349
302
|
).length !== n.length)
|
|
350
303
|
return !1;
|
|
351
304
|
let r = w(i, o, n);
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
const
|
|
355
|
-
if (
|
|
356
|
-
const
|
|
357
|
-
|
|
305
|
+
const u = g(e), s = E.getConfig(e);
|
|
306
|
+
if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
|
|
307
|
+
const c = e.querySelector(P);
|
|
308
|
+
if (c) {
|
|
309
|
+
const a = w(
|
|
310
|
+
c,
|
|
358
311
|
o,
|
|
359
312
|
n
|
|
360
313
|
);
|
|
361
|
-
r = r ||
|
|
314
|
+
r = r || a;
|
|
362
315
|
}
|
|
363
316
|
}
|
|
364
317
|
return r && o.apply(new p("Updated product content in-place")), !0;
|
|
@@ -370,63 +323,63 @@ function N(t, e, o) {
|
|
|
370
323
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
371
324
|
), i = t.querySelectorAll(
|
|
372
325
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
373
|
-
),
|
|
326
|
+
), l = t.querySelectorAll(
|
|
374
327
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
375
328
|
), r = t.querySelectorAll(
|
|
376
329
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
377
|
-
),
|
|
378
|
-
let
|
|
379
|
-
for (let
|
|
380
|
-
|
|
330
|
+
), u = Math.min(n.length, o.length);
|
|
331
|
+
let s = !1;
|
|
332
|
+
for (let c = 0; c < u; c++)
|
|
333
|
+
H({
|
|
381
334
|
documentModifier: e,
|
|
382
|
-
product: o[
|
|
383
|
-
priceEl: n[
|
|
384
|
-
oldPriceEl: i[
|
|
385
|
-
omnibusPriceEl: c
|
|
386
|
-
omnibusDiscountEl: r[
|
|
387
|
-
}) && (
|
|
388
|
-
return
|
|
335
|
+
product: o[c],
|
|
336
|
+
priceEl: n[c] ?? null,
|
|
337
|
+
oldPriceEl: i[c] ?? null,
|
|
338
|
+
omnibusPriceEl: l[c] ?? null,
|
|
339
|
+
omnibusDiscountEl: r[c] ?? null
|
|
340
|
+
}) && (s = !0);
|
|
341
|
+
return s;
|
|
389
342
|
}
|
|
390
|
-
function
|
|
343
|
+
function ce(t) {
|
|
391
344
|
const { currentNode: e, documentModifier: o } = t;
|
|
392
345
|
if (!e || !("querySelectorAll" in e))
|
|
393
346
|
return !1;
|
|
394
347
|
const i = C().recommendationProducts;
|
|
395
348
|
if (i.length === 0)
|
|
396
349
|
return !1;
|
|
397
|
-
const
|
|
398
|
-
let r = N(
|
|
399
|
-
const
|
|
400
|
-
if (
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
403
|
-
const
|
|
404
|
-
r = r ||
|
|
350
|
+
const l = U(e);
|
|
351
|
+
let r = N(l, o, i);
|
|
352
|
+
const u = g(e), s = E.getConfig(e);
|
|
353
|
+
if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
|
|
354
|
+
const c = e.querySelector(P);
|
|
355
|
+
if (c) {
|
|
356
|
+
const a = N(c, o, i);
|
|
357
|
+
r = r || a;
|
|
405
358
|
}
|
|
406
359
|
}
|
|
407
360
|
return r && o.apply(new p("Updated price formatting in-place")), r;
|
|
408
361
|
}
|
|
409
|
-
function
|
|
410
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, i =
|
|
362
|
+
function se(t) {
|
|
363
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, i = M(e);
|
|
411
364
|
if (!i)
|
|
412
365
|
return;
|
|
413
|
-
const
|
|
414
|
-
o.modifyHtml(i).setAttribute(
|
|
366
|
+
const l = n.alignment === "before" ? "0" : "1", r = (u, s) => {
|
|
367
|
+
o.modifyHtml(i).setAttribute(u, s);
|
|
415
368
|
};
|
|
416
|
-
r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT,
|
|
369
|
+
r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, l), 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
370
|
}
|
|
418
371
|
export {
|
|
419
|
-
|
|
372
|
+
ie as adjustProductsToSize,
|
|
420
373
|
A as formatProductPrice,
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
374
|
+
M as getBlockElement,
|
|
375
|
+
_ as getCardComposition,
|
|
376
|
+
g as getCurrentLayout,
|
|
377
|
+
Y as reapplySpacing,
|
|
378
|
+
W as regenerateMobileProductRows,
|
|
379
|
+
G as regenerateProductRows,
|
|
380
|
+
re as regenerateProductRowsWithStyles,
|
|
381
|
+
se as setCurrencyAttributes,
|
|
382
|
+
ce as updatePricesInPlace,
|
|
383
|
+
le as updateProductContentInPlace,
|
|
384
|
+
K as updateSingleProductContent
|
|
432
385
|
};
|