@useinsider/guido 2.1.0-beta.e2153c2 → 2.1.0-beta.e4c3fa1
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/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/composables/useRecommendation.js +9 -9
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +13 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +37 -27
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +173 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +269 -215
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +225 -102
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +94 -53
- package/dist/guido.css +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +33 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +24 -14
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +49 -17
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,307 +1,361 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
1
|
+
import { ModificationDescription as y } 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 { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as p, DESKTOP_CONTAINER_SELECTOR as C, CONTAINER_SELECTOR as $ } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as k } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as b } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
if (!
|
|
6
|
+
import { prepareProductRows as N } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as H } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as B } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as T, DEFAULT_CARD_COMPOSITION as q, sanitizeImageUrl as v } from "../../templates/utils.js";
|
|
10
|
+
const M = "ins-recommendation-v3-block-v2";
|
|
11
|
+
function A(t) {
|
|
12
|
+
if (!t)
|
|
13
13
|
return null;
|
|
14
|
-
if ("getAttribute" in
|
|
15
|
-
const e =
|
|
16
|
-
if (e && e.includes(
|
|
17
|
-
return
|
|
14
|
+
if ("getAttribute" in t) {
|
|
15
|
+
const e = t.getAttribute("class");
|
|
16
|
+
if (e && e.includes(M))
|
|
17
|
+
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${M}`) : null;
|
|
20
20
|
}
|
|
21
|
-
function P(
|
|
22
|
-
const e =
|
|
21
|
+
function P(t) {
|
|
22
|
+
const e = A(t);
|
|
23
23
|
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const o = e.getAttribute("data-layout");
|
|
26
|
+
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const e =
|
|
28
|
+
function w(t) {
|
|
29
|
+
const e = A(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
32
|
-
const
|
|
33
|
-
return
|
|
31
|
+
return q;
|
|
32
|
+
const o = e.getAttribute("data-card-composition");
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : q;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function S(t, e, o) {
|
|
36
36
|
if (!e || !("childNodes" in e))
|
|
37
37
|
return !1;
|
|
38
|
-
const
|
|
39
|
-
(
|
|
38
|
+
const i = e.childNodes().find(
|
|
39
|
+
(c) => "getType" in c && c.getType() === "text"
|
|
40
40
|
);
|
|
41
|
-
return
|
|
41
|
+
return i ? (t.modifyHtml(i).setText(o), !0) : !1;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function _(t, e) {
|
|
44
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : T();
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const { currentNode: e, documentModifier:
|
|
46
|
+
function j(t) {
|
|
47
|
+
const { currentNode: e, documentModifier: o, products: n, layout: i } = t;
|
|
48
48
|
if (!e || !("querySelector" in e))
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
50
|
+
const c = e.querySelector(g);
|
|
51
|
+
if (!c)
|
|
52
52
|
return;
|
|
53
|
-
const
|
|
54
|
-
productsPerRow:
|
|
55
|
-
composition:
|
|
53
|
+
const r = b(), s = k.getConfig(e), u = _(n, r.recommendationProducts), l = w(e), f = i ?? P(e), a = N(u, f, {
|
|
54
|
+
productsPerRow: s.mobileCardsInRow,
|
|
55
|
+
composition: l
|
|
56
56
|
});
|
|
57
|
-
|
|
57
|
+
o.modifyHtml(c).setInnerHtml(a).apply(new y("Updated mobile product rows"));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function V(t) {
|
|
60
60
|
const {
|
|
61
61
|
currentNode: e,
|
|
62
|
-
documentModifier:
|
|
63
|
-
afterRegenerate:
|
|
64
|
-
products:
|
|
65
|
-
layout:
|
|
66
|
-
} =
|
|
62
|
+
documentModifier: o,
|
|
63
|
+
afterRegenerate: n,
|
|
64
|
+
products: i,
|
|
65
|
+
layout: c
|
|
66
|
+
} = t;
|
|
67
67
|
if (!e || !("querySelector" in e))
|
|
68
68
|
return;
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
69
|
+
const r = e.querySelector(C) ?? e.querySelector($);
|
|
70
|
+
if (!r)
|
|
71
71
|
return;
|
|
72
|
-
const
|
|
73
|
-
productsPerRow:
|
|
74
|
-
composition:
|
|
72
|
+
const s = b(), u = _(i, s.recommendationProducts), { cardsInRow: l } = s.recommendationConfigs, f = w(e), a = c ?? P(e), d = N(u, a, {
|
|
73
|
+
productsPerRow: l,
|
|
74
|
+
composition: f
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
o.modifyHtml(r).setInnerHtml(d).apply(new y("Updated product")), j(t), n == null || n();
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
).forEach((
|
|
84
|
-
e.modifyHtml(
|
|
78
|
+
function h(t, e, o, n) {
|
|
79
|
+
const c = `0 ${Math.floor(o / 2)}px`;
|
|
80
|
+
let r = !1;
|
|
81
|
+
return n === "grid" ? Array.from(
|
|
82
|
+
t.querySelectorAll(".attribute-cell")
|
|
83
|
+
).forEach((u) => {
|
|
84
|
+
e.modifyHtml(u).setStyle("padding", c), r = !0;
|
|
85
85
|
}) : Array.from(
|
|
86
|
-
|
|
87
|
-
).forEach((
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
}),
|
|
86
|
+
t.querySelectorAll(".product-card-wrapper")
|
|
87
|
+
).forEach((u) => {
|
|
88
|
+
const l = "parentNode" in u ? u.parentNode : null;
|
|
89
|
+
l && B(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
|
|
90
|
+
}), r;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
const
|
|
94
|
-
let
|
|
95
|
-
return
|
|
96
|
-
e.modifyHtml(
|
|
97
|
-
}),
|
|
92
|
+
function R(t, e, o) {
|
|
93
|
+
const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
|
|
94
|
+
let c = !1;
|
|
95
|
+
return i.forEach((r) => {
|
|
96
|
+
e.modifyHtml(r).setStyle("height", n), c = !0;
|
|
97
|
+
}), c;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
const { currentNode: e, documentModifier:
|
|
99
|
+
function G(t) {
|
|
100
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
101
101
|
if (!e)
|
|
102
102
|
return;
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
103
|
+
const n = k.getConfig(e), i = P(e);
|
|
104
|
+
let c = !1;
|
|
105
|
+
const r = e.querySelector(C);
|
|
106
|
+
if (r) {
|
|
107
|
+
c = h(
|
|
108
|
+
r,
|
|
109
|
+
o,
|
|
110
|
+
n.columnSpacing,
|
|
111
|
+
i
|
|
112
|
+
);
|
|
113
|
+
const l = R(
|
|
114
|
+
r,
|
|
115
|
+
o,
|
|
116
|
+
n.rowSpacing
|
|
117
|
+
);
|
|
118
|
+
c = c || l;
|
|
116
119
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
const s = e.querySelector(g);
|
|
121
|
+
if (s) {
|
|
122
|
+
const u = h(
|
|
123
|
+
s,
|
|
124
|
+
o,
|
|
125
|
+
n.mobileColumnSpacing,
|
|
126
|
+
i
|
|
127
|
+
);
|
|
128
|
+
c = c || u;
|
|
129
|
+
const l = R(
|
|
130
|
+
s,
|
|
131
|
+
o,
|
|
132
|
+
n.mobileRowSpacing
|
|
133
|
+
);
|
|
134
|
+
c = c || l;
|
|
123
135
|
}
|
|
124
|
-
|
|
136
|
+
c && o.apply(new y("Reapply spacing after regeneration"));
|
|
125
137
|
}
|
|
126
|
-
function
|
|
127
|
-
const { currentNode: e, documentModifier:
|
|
128
|
-
e &&
|
|
138
|
+
function oe(t) {
|
|
139
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c } = t;
|
|
140
|
+
e && V({
|
|
129
141
|
currentNode: e,
|
|
130
|
-
documentModifier:
|
|
131
|
-
products:
|
|
132
|
-
layout:
|
|
142
|
+
documentModifier: o,
|
|
143
|
+
products: i,
|
|
144
|
+
layout: c,
|
|
133
145
|
afterRegenerate: () => {
|
|
134
146
|
setTimeout(() => {
|
|
135
|
-
|
|
136
|
-
}, 0),
|
|
147
|
+
G({ currentNode: e, documentModifier: o });
|
|
148
|
+
}, 0), n == null || n();
|
|
137
149
|
}
|
|
138
150
|
});
|
|
139
151
|
}
|
|
140
|
-
function
|
|
141
|
-
|
|
152
|
+
function ne(t, e) {
|
|
153
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...T(e - t.length)];
|
|
154
|
+
}
|
|
155
|
+
function x() {
|
|
156
|
+
const t = b(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
142
157
|
return {
|
|
143
158
|
code: e.value,
|
|
144
159
|
symbol: e.symbol,
|
|
145
160
|
alignment: e.alignment === "0" ? "before" : "after",
|
|
146
|
-
decimalCount:
|
|
161
|
+
decimalCount: Number.isNaN(o) ? 2 : o,
|
|
147
162
|
decimalSeparator: e.decimalSeparator,
|
|
148
163
|
thousandSeparator: e.thousandSeparator
|
|
149
164
|
};
|
|
150
165
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
return
|
|
154
|
-
price:
|
|
155
|
-
currency:
|
|
166
|
+
function E(t, e = "price") {
|
|
167
|
+
const o = x(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
168
|
+
return H({
|
|
169
|
+
price: i,
|
|
170
|
+
currency: o
|
|
156
171
|
});
|
|
157
172
|
}
|
|
158
|
-
function
|
|
159
|
-
var
|
|
160
|
-
const e =
|
|
161
|
-
return
|
|
173
|
+
function W(t) {
|
|
174
|
+
var c, r;
|
|
175
|
+
const e = x(), 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;
|
|
176
|
+
return i > 0 ? `-${i}%` : "0%";
|
|
162
177
|
}
|
|
163
|
-
function
|
|
164
|
-
const { documentModifier: e, product:
|
|
165
|
-
let
|
|
166
|
-
if (r && "querySelector" in r) {
|
|
167
|
-
const l = r.querySelector("strong"), s = A(t, "price");
|
|
168
|
-
g(e, l, s) && (u = !0);
|
|
169
|
-
}
|
|
178
|
+
function D(t) {
|
|
179
|
+
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: c, omnibusDiscountEl: r } = t;
|
|
180
|
+
let s = !1;
|
|
170
181
|
if (n && "querySelector" in n) {
|
|
171
|
-
const
|
|
172
|
-
|
|
182
|
+
const u = n.querySelector("strong"), l = E(o, "price");
|
|
183
|
+
S(e, u, l) && (s = !0);
|
|
173
184
|
}
|
|
174
185
|
if (i && "querySelector" in i) {
|
|
175
|
-
const
|
|
176
|
-
|
|
186
|
+
const u = i.querySelector("strong"), l = E(o, "original_price");
|
|
187
|
+
S(e, u, l) && (s = !0);
|
|
177
188
|
}
|
|
178
189
|
if (c && "querySelector" in c) {
|
|
179
|
-
const
|
|
180
|
-
|
|
190
|
+
const u = c.querySelector(".omnibus-price-value"), l = E(o, "original_price");
|
|
191
|
+
S(e, u, l) && (s = !0);
|
|
181
192
|
}
|
|
182
|
-
|
|
193
|
+
if (r && "querySelector" in r) {
|
|
194
|
+
const u = r.querySelector(".omnibus-discount-value"), l = W(o);
|
|
195
|
+
S(e, u, l) && (s = !0);
|
|
196
|
+
}
|
|
197
|
+
return s;
|
|
183
198
|
}
|
|
184
|
-
function
|
|
199
|
+
function Y(t) {
|
|
185
200
|
const {
|
|
186
201
|
documentModifier: e,
|
|
187
|
-
product:
|
|
188
|
-
imageEl:
|
|
189
|
-
nameEl:
|
|
190
|
-
priceEl:
|
|
191
|
-
oldPriceEl:
|
|
192
|
-
omnibusPriceEl:
|
|
193
|
-
omnibusDiscountEl:
|
|
194
|
-
buttonEl:
|
|
195
|
-
} =
|
|
196
|
-
let
|
|
197
|
-
if (r && "querySelector" in r) {
|
|
198
|
-
const a = r.querySelector("img");
|
|
199
|
-
a && (e.modifyHtml(a).setAttribute("src", U(t.image_url)).setAttribute("alt", t.name), d = !0);
|
|
200
|
-
const p = r.querySelector("a");
|
|
201
|
-
p && (e.modifyHtml(p).setAttribute("href", t.url), d = !0);
|
|
202
|
-
}
|
|
202
|
+
product: o,
|
|
203
|
+
imageEl: n,
|
|
204
|
+
nameEl: i,
|
|
205
|
+
priceEl: c,
|
|
206
|
+
oldPriceEl: r,
|
|
207
|
+
omnibusPriceEl: s,
|
|
208
|
+
omnibusDiscountEl: u,
|
|
209
|
+
buttonEl: l
|
|
210
|
+
} = t;
|
|
211
|
+
let f = !1;
|
|
203
212
|
if (n && "querySelector" in n) {
|
|
204
|
-
const a = n.querySelector("
|
|
205
|
-
|
|
213
|
+
const a = n.querySelector("img");
|
|
214
|
+
a && (e.modifyHtml(a).setAttribute("src", v(o.image_url)).setAttribute("alt", o.name), f = !0);
|
|
215
|
+
const d = n.querySelector("a");
|
|
216
|
+
d && (e.modifyHtml(d).setAttribute("href", o.url), f = !0);
|
|
217
|
+
}
|
|
218
|
+
if (i && "querySelector" in i) {
|
|
219
|
+
const a = i.querySelector("strong");
|
|
220
|
+
S(e, a, o.name) && (f = !0);
|
|
206
221
|
}
|
|
207
|
-
if (
|
|
222
|
+
if (D({
|
|
208
223
|
documentModifier: e,
|
|
209
|
-
product:
|
|
210
|
-
priceEl:
|
|
211
|
-
oldPriceEl:
|
|
212
|
-
omnibusPriceEl:
|
|
213
|
-
omnibusDiscountEl:
|
|
214
|
-
}) && (
|
|
215
|
-
const a =
|
|
216
|
-
a && (e.modifyHtml(a).setAttribute("href",
|
|
224
|
+
product: o,
|
|
225
|
+
priceEl: c,
|
|
226
|
+
oldPriceEl: r,
|
|
227
|
+
omnibusPriceEl: s,
|
|
228
|
+
omnibusDiscountEl: u
|
|
229
|
+
}) && (f = !0), l && "querySelector" in l) {
|
|
230
|
+
const a = l.querySelector("a.es-button") || l.querySelector("a");
|
|
231
|
+
a && (e.modifyHtml(a).setAttribute("href", o.url), f = !0);
|
|
217
232
|
}
|
|
218
|
-
return
|
|
233
|
+
return f;
|
|
219
234
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
222
|
-
|
|
235
|
+
function L(t) {
|
|
236
|
+
return "querySelector" in t ? t.querySelector(C) ?? t : t;
|
|
237
|
+
}
|
|
238
|
+
function I(t, e, o) {
|
|
239
|
+
if (!("querySelectorAll" in t))
|
|
223
240
|
return !1;
|
|
224
|
-
const n =
|
|
241
|
+
const n = t.querySelectorAll(
|
|
225
242
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
226
|
-
), i =
|
|
243
|
+
), i = t.querySelectorAll(
|
|
227
244
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
228
|
-
), c =
|
|
245
|
+
), c = t.querySelectorAll(
|
|
229
246
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
230
|
-
),
|
|
247
|
+
), r = t.querySelectorAll(
|
|
231
248
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
232
|
-
),
|
|
249
|
+
), s = t.querySelectorAll(
|
|
233
250
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
234
|
-
),
|
|
251
|
+
), u = t.querySelectorAll(
|
|
235
252
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
236
|
-
),
|
|
253
|
+
), l = t.querySelectorAll(
|
|
237
254
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
238
|
-
);
|
|
239
|
-
if (n.length !== r.length)
|
|
240
|
-
return !1;
|
|
255
|
+
), f = Math.min(n.length, o.length);
|
|
241
256
|
let a = !1;
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
documentModifier:
|
|
245
|
-
product:
|
|
246
|
-
imageEl: n[
|
|
247
|
-
nameEl: i[
|
|
248
|
-
priceEl: c[
|
|
249
|
-
oldPriceEl:
|
|
250
|
-
omnibusPriceEl:
|
|
251
|
-
omnibusDiscountEl:
|
|
252
|
-
buttonEl: d
|
|
257
|
+
for (let d = 0; d < f; d++) {
|
|
258
|
+
const U = Y({
|
|
259
|
+
documentModifier: e,
|
|
260
|
+
product: o[d],
|
|
261
|
+
imageEl: n[d] ?? null,
|
|
262
|
+
nameEl: i[d] ?? null,
|
|
263
|
+
priceEl: c[d] ?? null,
|
|
264
|
+
oldPriceEl: r[d] ?? null,
|
|
265
|
+
omnibusPriceEl: s[d] ?? null,
|
|
266
|
+
omnibusDiscountEl: u[d] ?? null,
|
|
267
|
+
buttonEl: l[d] ?? null
|
|
253
268
|
});
|
|
254
|
-
a = a ||
|
|
255
|
-
}
|
|
269
|
+
a = a || U;
|
|
270
|
+
}
|
|
271
|
+
return a;
|
|
256
272
|
}
|
|
257
|
-
function
|
|
258
|
-
const { currentNode: e, documentModifier:
|
|
273
|
+
function re(t) {
|
|
274
|
+
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
259
275
|
if (!e || !("querySelectorAll" in e))
|
|
260
276
|
return !1;
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
277
|
+
const i = L(e);
|
|
278
|
+
if (!("querySelectorAll" in i) || i.querySelectorAll(
|
|
279
|
+
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
280
|
+
).length !== n.length)
|
|
281
|
+
return !1;
|
|
282
|
+
let r = I(i, o, n);
|
|
283
|
+
if ("querySelector" in e) {
|
|
284
|
+
const s = e.querySelector(g);
|
|
285
|
+
if (s) {
|
|
286
|
+
const u = I(
|
|
287
|
+
s,
|
|
288
|
+
o,
|
|
289
|
+
n
|
|
290
|
+
);
|
|
291
|
+
r = r || u;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return r && o.apply(new y("Updated product content in-place")), !0;
|
|
295
|
+
}
|
|
296
|
+
function O(t, e, o) {
|
|
297
|
+
if (!("querySelectorAll" in t))
|
|
263
298
|
return !1;
|
|
264
|
-
const
|
|
299
|
+
const n = t.querySelectorAll(
|
|
265
300
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
266
|
-
),
|
|
301
|
+
), i = t.querySelectorAll(
|
|
267
302
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
268
|
-
),
|
|
303
|
+
), c = t.querySelectorAll(
|
|
269
304
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
270
|
-
),
|
|
305
|
+
), r = t.querySelectorAll(
|
|
271
306
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
272
|
-
);
|
|
273
|
-
let
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
documentModifier:
|
|
277
|
-
product:
|
|
278
|
-
priceEl:
|
|
279
|
-
oldPriceEl:
|
|
280
|
-
omnibusPriceEl:
|
|
281
|
-
omnibusDiscountEl: l
|
|
282
|
-
}) && (
|
|
283
|
-
|
|
307
|
+
), s = Math.min(n.length, o.length);
|
|
308
|
+
let u = !1;
|
|
309
|
+
for (let l = 0; l < s; l++)
|
|
310
|
+
D({
|
|
311
|
+
documentModifier: e,
|
|
312
|
+
product: o[l],
|
|
313
|
+
priceEl: n[l] ?? null,
|
|
314
|
+
oldPriceEl: i[l] ?? null,
|
|
315
|
+
omnibusPriceEl: c[l] ?? null,
|
|
316
|
+
omnibusDiscountEl: r[l] ?? null
|
|
317
|
+
}) && (u = !0);
|
|
318
|
+
return u;
|
|
284
319
|
}
|
|
285
|
-
function
|
|
286
|
-
const { currentNode: e, documentModifier:
|
|
287
|
-
if (!
|
|
320
|
+
function ie(t) {
|
|
321
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
322
|
+
if (!e || !("querySelectorAll" in e))
|
|
323
|
+
return !1;
|
|
324
|
+
const i = b().recommendationProducts;
|
|
325
|
+
if (i.length === 0)
|
|
326
|
+
return !1;
|
|
327
|
+
const c = L(e);
|
|
328
|
+
let r = O(c, o, i);
|
|
329
|
+
if ("querySelector" in e) {
|
|
330
|
+
const s = e.querySelector(g);
|
|
331
|
+
if (s) {
|
|
332
|
+
const u = O(s, o, i);
|
|
333
|
+
r = r || u;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return r && o.apply(new y("Updated price formatting in-place")), r;
|
|
337
|
+
}
|
|
338
|
+
function ce(t) {
|
|
339
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, i = A(e);
|
|
340
|
+
if (!i)
|
|
288
341
|
return;
|
|
289
|
-
const
|
|
290
|
-
|
|
342
|
+
const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
|
|
343
|
+
o.modifyHtml(i).setAttribute(s, u);
|
|
291
344
|
};
|
|
292
|
-
|
|
345
|
+
r(p.CURRENCY, n.code), r(p.SYMBOL, n.symbol), r(p.ALIGNMENT, c), r(p.THOUSAND_SEPARATOR, n.thousandSeparator), r(p.DECIMAL_SEPARATOR, n.decimalSeparator), r(p.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new y("Update currency attributes"));
|
|
293
346
|
}
|
|
294
347
|
export {
|
|
295
|
-
|
|
296
|
-
E as
|
|
297
|
-
|
|
348
|
+
ne as adjustProductsToSize,
|
|
349
|
+
E as formatProductPrice,
|
|
350
|
+
A as getBlockElement,
|
|
351
|
+
w as getCardComposition,
|
|
298
352
|
P as getCurrentLayout,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
353
|
+
G as reapplySpacing,
|
|
354
|
+
j as regenerateMobileProductRows,
|
|
355
|
+
V as regenerateProductRows,
|
|
356
|
+
oe as regenerateProductRowsWithStyles,
|
|
357
|
+
ce as setCurrencyAttributes,
|
|
358
|
+
ie as updatePricesInPlace,
|
|
359
|
+
re as updateProductContentInPlace,
|
|
360
|
+
Y as updateSingleProductContent
|
|
307
361
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as l, createTextStyleControl as C, createTextSizeControl as c, createTextColorControl as
|
|
1
|
+
import { createPaddingsControl as n, createTextBackgroundColorControl as e, createTextFontFamilyControl as l, createTextStyleControl as C, createTextSizeControl as c, createTextColorControl as a, createTextAlignControl as i } from "../../../controlFactories.js";
|
|
2
2
|
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
3
|
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
-
import {
|
|
5
|
-
import { NameTextTrimControl as
|
|
6
|
-
const
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as r } from "../../constants/selectors.js";
|
|
5
|
+
import { NameTextTrimControl as m } from "./textTrim.js";
|
|
6
|
+
const A = i(
|
|
7
7
|
t.NAME_ALIGN,
|
|
8
8
|
o.NAME,
|
|
9
9
|
r
|
|
10
|
-
),
|
|
10
|
+
), N = a(
|
|
11
11
|
t.NAME_COLOR,
|
|
12
12
|
o.NAME,
|
|
13
13
|
r
|
|
@@ -31,16 +31,16 @@ const m = a(
|
|
|
31
31
|
t.NAME_PADDINGS,
|
|
32
32
|
o.NAME,
|
|
33
33
|
r
|
|
34
|
-
),
|
|
35
|
-
align:
|
|
36
|
-
color:
|
|
34
|
+
), p = {
|
|
35
|
+
align: A,
|
|
36
|
+
color: N,
|
|
37
37
|
size: E,
|
|
38
38
|
style: M,
|
|
39
39
|
fontFamily: s,
|
|
40
40
|
background: d,
|
|
41
41
|
paddings: T,
|
|
42
|
-
textTrim:
|
|
42
|
+
textTrim: m
|
|
43
43
|
};
|
|
44
44
|
export {
|
|
45
|
-
|
|
45
|
+
p as NameControls
|
|
46
46
|
};
|
|
@@ -2,11 +2,11 @@ import { ModificationDescription as a } from "../../../../../node_modules/@strip
|
|
|
2
2
|
import { CommonControl as c } from "../../../common-control.js";
|
|
3
3
|
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as m } from "../../constants/controlIds.js";
|
|
5
|
-
import {
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as u } from "../../constants/selectors.js";
|
|
6
6
|
const i = {
|
|
7
7
|
TEXT_TRIM_ENABLED: "textTrimEnabled"
|
|
8
|
-
}, o = "text-trim-enabled", d = `.${o}`, T = `.${o} p`,
|
|
9
|
-
class
|
|
8
|
+
}, o = "text-trim-enabled", d = `.${o}`, T = `.${o} p`, _ = `.${o} { max-width: 0; }`, f = `.${o} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
|
|
9
|
+
class N extends c {
|
|
10
10
|
getId() {
|
|
11
11
|
return m.NAME_TEXT_TRIM;
|
|
12
12
|
}
|
|
@@ -74,7 +74,7 @@ class g extends c {
|
|
|
74
74
|
return;
|
|
75
75
|
const t = this.api.getDocumentModifier();
|
|
76
76
|
let s = !1;
|
|
77
|
-
this._findCssRule(d) || (t.modifyCss(e).appendRule(
|
|
77
|
+
this._findCssRule(d) || (t.modifyCss(e).appendRule(_), s = !0), this._hasParagraphRule() || (t.modifyCss(e).appendRule(f), s = !0), s && t.apply(new a("Add text trim CSS rules"));
|
|
78
78
|
}
|
|
79
79
|
_onTextTrimChange(e) {
|
|
80
80
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
@@ -104,5 +104,5 @@ class g extends c {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
N as NameTextTrimControl
|
|
108
108
|
};
|