@useinsider/guido 3.2.0-beta.e01b42a → 3.2.0-beta.f0d4ffd
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 +1 -0
- package/dist/@types/config/schemas.js +66 -54
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +10 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useSave.js +23 -15
- package/dist/composables/useStripo.js +44 -41
- package/dist/composables/validators/useLiquidValidator.js +42 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/recommendationCompilerRules.js +158 -44
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/radioButtonMigrator.js +14 -12
- package/dist/enums/extensions/recommendationBlock.js +14 -11
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +94 -92
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +31 -31
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/config/index.d.ts +1 -1
- package/dist/src/@types/config/schemas.d.ts +28 -0
- package/dist/src/@types/config/types.d.ts +3 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/composables/useConfig.d.ts +12 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/config.d.ts +108 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/genericUtil.d.ts +1 -1
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/components/button.css.js +3 -2
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/stores/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/templatePreparation.js +36 -25
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +3 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { RecommendationBlockId as
|
|
2
|
+
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
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
6
|
import { prepareProductRows as T } from "../../templates/index.js";
|
|
7
7
|
import { formatPrice as B } from "../../utils/priceFormatter.js";
|
|
8
8
|
import { isTdNode as v } from "../../utils/tagName.js";
|
|
9
|
-
import { getDefaultProducts as
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as j } from "../../templates/utils.js";
|
|
10
10
|
const h = "recommendation-block-v2";
|
|
11
11
|
function M(t) {
|
|
12
12
|
if (!t)
|
|
@@ -25,7 +25,7 @@ function g(t) {
|
|
|
25
25
|
const o = e.getAttribute("data-layout");
|
|
26
26
|
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function _(t) {
|
|
29
29
|
const e = M(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
31
|
return R;
|
|
@@ -36,12 +36,12 @@ function b(t, e, o) {
|
|
|
36
36
|
if (!e || !("childNodes" in e))
|
|
37
37
|
return !1;
|
|
38
38
|
const i = e.childNodes().find(
|
|
39
|
-
(
|
|
39
|
+
(l) => "getType" in l && l.getType() === "text"
|
|
40
40
|
);
|
|
41
41
|
return i ? (t.modifyHtml(i).setText(o), !0) : !1;
|
|
42
42
|
}
|
|
43
43
|
function x(t, e) {
|
|
44
|
-
return t && t.length > 0 ? t : e.length > 0 ? e :
|
|
44
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
45
45
|
}
|
|
46
46
|
function V(t) {
|
|
47
47
|
const { currentNode: e, documentModifier: o } = t;
|
|
@@ -56,7 +56,7 @@ function W(t) {
|
|
|
56
56
|
documentModifier: o,
|
|
57
57
|
products: n,
|
|
58
58
|
layout: i,
|
|
59
|
-
composition:
|
|
59
|
+
composition: l
|
|
60
60
|
} = t;
|
|
61
61
|
if (!e || !("querySelector" in e))
|
|
62
62
|
return;
|
|
@@ -68,9 +68,10 @@ function W(t) {
|
|
|
68
68
|
const s = e.querySelector(k);
|
|
69
69
|
if (!s)
|
|
70
70
|
return;
|
|
71
|
-
const
|
|
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
72
|
productsPerRow: u.mobileCardsInRow,
|
|
73
|
-
composition:
|
|
73
|
+
composition: f,
|
|
74
|
+
filterList: c.filterList
|
|
74
75
|
})}</table></td>`;
|
|
75
76
|
o.modifyHtml(s).setInnerHtml(S), o.apply(new p("Updated mobile product rows"));
|
|
76
77
|
}
|
|
@@ -80,7 +81,7 @@ function G(t) {
|
|
|
80
81
|
documentModifier: o,
|
|
81
82
|
afterRegenerate: n,
|
|
82
83
|
products: i,
|
|
83
|
-
layout:
|
|
84
|
+
layout: l,
|
|
84
85
|
composition: r
|
|
85
86
|
} = t;
|
|
86
87
|
if (!e || !("querySelector" in e))
|
|
@@ -88,53 +89,54 @@ function G(t) {
|
|
|
88
89
|
const u = e.querySelector(q) ?? e.querySelector($);
|
|
89
90
|
if (!u)
|
|
90
91
|
return;
|
|
91
|
-
const s = C(),
|
|
92
|
+
const s = C(), c = x(i, s.recommendationProducts), { cardsInRow: a } = s.recommendationConfigs, f = r ?? _(e), d = l ?? g(e), S = T(c, d, {
|
|
92
93
|
productsPerRow: a,
|
|
93
|
-
composition:
|
|
94
|
+
composition: f,
|
|
95
|
+
filterList: s.filterList
|
|
94
96
|
});
|
|
95
97
|
o.modifyHtml(u).setInnerHtml(S).apply(new p("Updated product")), W(t), n == null || n();
|
|
96
98
|
}
|
|
97
99
|
function I(t, e, o, n) {
|
|
98
|
-
const
|
|
100
|
+
const l = `0 ${Math.floor(o / 2)}px`;
|
|
99
101
|
let r = !1;
|
|
100
102
|
return n === "grid" ? Array.from(
|
|
101
103
|
t.querySelectorAll(".attribute-cell")
|
|
102
104
|
).forEach((s) => {
|
|
103
|
-
e.modifyHtml(s).setStyle("padding",
|
|
105
|
+
e.modifyHtml(s).setStyle("padding", l), r = !0;
|
|
104
106
|
}) : Array.from(
|
|
105
107
|
t.querySelectorAll(".product-card-wrapper")
|
|
106
108
|
).forEach((s) => {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
+
const c = "parentNode" in s ? s.parentNode : null;
|
|
110
|
+
c && v(c) && (e.modifyHtml(c).setStyle("padding", l), r = !0);
|
|
109
111
|
}), r;
|
|
110
112
|
}
|
|
111
113
|
function O(t, e, o) {
|
|
112
114
|
const n = `${o}px`, i = Array.from(t.querySelectorAll(".spacer"));
|
|
113
|
-
let
|
|
115
|
+
let l = !1;
|
|
114
116
|
return i.forEach((r) => {
|
|
115
|
-
e.modifyHtml(r).setStyle("height", n),
|
|
116
|
-
}),
|
|
117
|
+
e.modifyHtml(r).setStyle("height", n), l = !0;
|
|
118
|
+
}), l;
|
|
117
119
|
}
|
|
118
120
|
function Y(t) {
|
|
119
121
|
const { currentNode: e, documentModifier: o } = t;
|
|
120
122
|
if (!e)
|
|
121
123
|
return;
|
|
122
124
|
const n = E.getConfig(e), i = g(e);
|
|
123
|
-
let
|
|
125
|
+
let l = !1;
|
|
124
126
|
const r = e.querySelector(q);
|
|
125
127
|
if (r) {
|
|
126
|
-
|
|
128
|
+
l = I(
|
|
127
129
|
r,
|
|
128
130
|
o,
|
|
129
131
|
n.columnSpacing,
|
|
130
132
|
i
|
|
131
133
|
);
|
|
132
|
-
const
|
|
134
|
+
const c = O(
|
|
133
135
|
r,
|
|
134
136
|
o,
|
|
135
137
|
n.rowSpacing
|
|
136
138
|
);
|
|
137
|
-
|
|
139
|
+
l = l || c;
|
|
138
140
|
}
|
|
139
141
|
const u = e.querySelector(P);
|
|
140
142
|
if (u) {
|
|
@@ -144,23 +146,23 @@ function Y(t) {
|
|
|
144
146
|
n.mobileColumnSpacing,
|
|
145
147
|
i
|
|
146
148
|
);
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
+
l = l || s;
|
|
150
|
+
const c = O(
|
|
149
151
|
u,
|
|
150
152
|
o,
|
|
151
153
|
n.mobileRowSpacing
|
|
152
154
|
);
|
|
153
|
-
|
|
155
|
+
l = l || c;
|
|
154
156
|
}
|
|
155
|
-
|
|
157
|
+
l && o.apply(new p("Reapply spacing after regeneration"));
|
|
156
158
|
}
|
|
157
159
|
function re(t) {
|
|
158
|
-
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout:
|
|
160
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: l, composition: r } = t;
|
|
159
161
|
e && G({
|
|
160
162
|
currentNode: e,
|
|
161
163
|
documentModifier: o,
|
|
162
164
|
products: i,
|
|
163
|
-
layout:
|
|
165
|
+
layout: l,
|
|
164
166
|
composition: r,
|
|
165
167
|
afterRegenerate: () => {
|
|
166
168
|
setTimeout(() => {
|
|
@@ -170,7 +172,7 @@ function re(t) {
|
|
|
170
172
|
});
|
|
171
173
|
}
|
|
172
174
|
function ie(t, e) {
|
|
173
|
-
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...
|
|
175
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
174
176
|
}
|
|
175
177
|
function D() {
|
|
176
178
|
const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
@@ -191,28 +193,28 @@ function A(t, e = "price") {
|
|
|
191
193
|
});
|
|
192
194
|
}
|
|
193
195
|
function F(t) {
|
|
194
|
-
var
|
|
195
|
-
const e = D(), o = ((
|
|
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;
|
|
196
198
|
return i > 0 ? `-${i}%` : "0%";
|
|
197
199
|
}
|
|
198
200
|
function H(t) {
|
|
199
|
-
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl:
|
|
201
|
+
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: i, omnibusPriceEl: l, omnibusDiscountEl: r } = t;
|
|
200
202
|
let u = !1;
|
|
201
203
|
if (n && "querySelector" in n) {
|
|
202
|
-
const s = n.querySelector("strong"),
|
|
203
|
-
b(e, s,
|
|
204
|
+
const s = n.querySelector("strong") ?? null, c = A(o, "price");
|
|
205
|
+
b(e, s, c) && (u = !0);
|
|
204
206
|
}
|
|
205
207
|
if (i && "querySelector" in i) {
|
|
206
|
-
const s = i.querySelector("strong"),
|
|
207
|
-
b(e, s,
|
|
208
|
+
const s = i.querySelector("strong") ?? null, c = A(o, "original_price");
|
|
209
|
+
b(e, s, c) && (u = !0);
|
|
208
210
|
}
|
|
209
|
-
if (
|
|
210
|
-
const s =
|
|
211
|
-
b(e, s,
|
|
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);
|
|
212
214
|
}
|
|
213
215
|
if (r && "querySelector" in r) {
|
|
214
|
-
const s = r.querySelector(".omnibus-discount-value"),
|
|
215
|
-
b(e, s,
|
|
216
|
+
const s = r.querySelector(".omnibus-discount-value") ?? null, c = F(o);
|
|
217
|
+
b(e, s, c) && (u = !0);
|
|
216
218
|
}
|
|
217
219
|
return u;
|
|
218
220
|
}
|
|
@@ -222,33 +224,33 @@ function K(t) {
|
|
|
222
224
|
product: o,
|
|
223
225
|
imageEl: n,
|
|
224
226
|
nameEl: i,
|
|
225
|
-
priceEl:
|
|
227
|
+
priceEl: l,
|
|
226
228
|
oldPriceEl: r,
|
|
227
229
|
omnibusPriceEl: u,
|
|
228
230
|
omnibusDiscountEl: s,
|
|
229
|
-
buttonEl:
|
|
231
|
+
buttonEl: c
|
|
230
232
|
} = t;
|
|
231
233
|
let a = !1;
|
|
232
234
|
if (n && "querySelector" in n) {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
+
const f = n.querySelector("img");
|
|
236
|
+
f && (e.modifyHtml(f).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), a = !0);
|
|
235
237
|
const d = n.querySelector("a");
|
|
236
238
|
d && (e.modifyHtml(d).setAttribute("href", o.url), a = !0);
|
|
237
239
|
}
|
|
238
240
|
if (i && "querySelector" in i) {
|
|
239
|
-
const
|
|
240
|
-
b(e,
|
|
241
|
+
const f = i.querySelector("strong") ?? null;
|
|
242
|
+
b(e, f, o.name) && (a = !0);
|
|
241
243
|
}
|
|
242
244
|
if (H({
|
|
243
245
|
documentModifier: e,
|
|
244
246
|
product: o,
|
|
245
|
-
priceEl:
|
|
247
|
+
priceEl: l,
|
|
246
248
|
oldPriceEl: r,
|
|
247
249
|
omnibusPriceEl: u,
|
|
248
250
|
omnibusDiscountEl: s
|
|
249
|
-
}) && (a = !0),
|
|
250
|
-
const
|
|
251
|
-
|
|
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);
|
|
252
254
|
}
|
|
253
255
|
return a;
|
|
254
256
|
}
|
|
@@ -259,53 +261,53 @@ function w(t, e, o) {
|
|
|
259
261
|
if (!("querySelectorAll" in t))
|
|
260
262
|
return !1;
|
|
261
263
|
const n = t.querySelectorAll(
|
|
262
|
-
`[esd-extension-block-id="${
|
|
264
|
+
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
263
265
|
), i = t.querySelectorAll(
|
|
264
|
-
`[esd-extension-block-id="${
|
|
265
|
-
),
|
|
266
|
-
`[esd-extension-block-id="${
|
|
266
|
+
`[esd-extension-block-id="${m.NAME}"]`
|
|
267
|
+
), l = t.querySelectorAll(
|
|
268
|
+
`[esd-extension-block-id="${m.PRICE}"]`
|
|
267
269
|
), r = t.querySelectorAll(
|
|
268
|
-
`[esd-extension-block-id="${
|
|
270
|
+
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
269
271
|
), u = t.querySelectorAll(
|
|
270
|
-
`[esd-extension-block-id="${
|
|
272
|
+
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
271
273
|
), s = t.querySelectorAll(
|
|
272
|
-
`[esd-extension-block-id="${
|
|
273
|
-
),
|
|
274
|
-
`[esd-extension-block-id="${
|
|
274
|
+
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
275
|
+
), c = t.querySelectorAll(
|
|
276
|
+
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
275
277
|
), a = Math.min(n.length, o.length);
|
|
276
|
-
let
|
|
278
|
+
let f = !1;
|
|
277
279
|
for (let d = 0; d < a; d++) {
|
|
278
280
|
const S = K({
|
|
279
281
|
documentModifier: e,
|
|
280
282
|
product: o[d],
|
|
281
283
|
imageEl: n[d] ?? null,
|
|
282
284
|
nameEl: i[d] ?? null,
|
|
283
|
-
priceEl:
|
|
285
|
+
priceEl: l[d] ?? null,
|
|
284
286
|
oldPriceEl: r[d] ?? null,
|
|
285
287
|
omnibusPriceEl: u[d] ?? null,
|
|
286
288
|
omnibusDiscountEl: s[d] ?? null,
|
|
287
|
-
buttonEl:
|
|
289
|
+
buttonEl: c[d] ?? null
|
|
288
290
|
});
|
|
289
|
-
|
|
291
|
+
f = f || S;
|
|
290
292
|
}
|
|
291
|
-
return
|
|
293
|
+
return f;
|
|
292
294
|
}
|
|
293
|
-
function
|
|
295
|
+
function le(t) {
|
|
294
296
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
295
297
|
if (!e || !("querySelectorAll" in e))
|
|
296
298
|
return !1;
|
|
297
299
|
const i = U(e);
|
|
298
300
|
if (!("querySelectorAll" in i) || i.querySelectorAll(
|
|
299
|
-
`[esd-extension-block-id="${
|
|
301
|
+
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
300
302
|
).length !== n.length)
|
|
301
303
|
return !1;
|
|
302
304
|
let r = w(i, o, n);
|
|
303
305
|
const u = g(e), s = E.getConfig(e);
|
|
304
306
|
if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
+
const c = e.querySelector(P);
|
|
308
|
+
if (c) {
|
|
307
309
|
const a = w(
|
|
308
|
-
|
|
310
|
+
c,
|
|
309
311
|
o,
|
|
310
312
|
n
|
|
311
313
|
);
|
|
@@ -318,40 +320,40 @@ function N(t, e, o) {
|
|
|
318
320
|
if (!("querySelectorAll" in t))
|
|
319
321
|
return !1;
|
|
320
322
|
const n = t.querySelectorAll(
|
|
321
|
-
`[esd-extension-block-id="${
|
|
323
|
+
`[esd-extension-block-id="${m.PRICE}"]`
|
|
322
324
|
), i = t.querySelectorAll(
|
|
323
|
-
`[esd-extension-block-id="${
|
|
324
|
-
),
|
|
325
|
-
`[esd-extension-block-id="${
|
|
325
|
+
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
326
|
+
), l = t.querySelectorAll(
|
|
327
|
+
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
326
328
|
), r = t.querySelectorAll(
|
|
327
|
-
`[esd-extension-block-id="${
|
|
329
|
+
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
328
330
|
), u = Math.min(n.length, o.length);
|
|
329
331
|
let s = !1;
|
|
330
|
-
for (let
|
|
332
|
+
for (let c = 0; c < u; c++)
|
|
331
333
|
H({
|
|
332
334
|
documentModifier: e,
|
|
333
|
-
product: o[
|
|
334
|
-
priceEl: n[
|
|
335
|
-
oldPriceEl: i[
|
|
336
|
-
omnibusPriceEl: c
|
|
337
|
-
omnibusDiscountEl: r[
|
|
335
|
+
product: o[c],
|
|
336
|
+
priceEl: n[c] ?? null,
|
|
337
|
+
oldPriceEl: i[c] ?? null,
|
|
338
|
+
omnibusPriceEl: l[c] ?? null,
|
|
339
|
+
omnibusDiscountEl: r[c] ?? null
|
|
338
340
|
}) && (s = !0);
|
|
339
341
|
return s;
|
|
340
342
|
}
|
|
341
|
-
function
|
|
343
|
+
function ce(t) {
|
|
342
344
|
const { currentNode: e, documentModifier: o } = t;
|
|
343
345
|
if (!e || !("querySelectorAll" in e))
|
|
344
346
|
return !1;
|
|
345
347
|
const i = C().recommendationProducts;
|
|
346
348
|
if (i.length === 0)
|
|
347
349
|
return !1;
|
|
348
|
-
const
|
|
349
|
-
let r = N(
|
|
350
|
+
const l = U(e);
|
|
351
|
+
let r = N(l, o, i);
|
|
350
352
|
const u = g(e), s = E.getConfig(e);
|
|
351
353
|
if (u !== "list" && s.mobileLayoutEnabled && "querySelector" in e) {
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
354
|
-
const a = N(
|
|
354
|
+
const c = e.querySelector(P);
|
|
355
|
+
if (c) {
|
|
356
|
+
const a = N(c, o, i);
|
|
355
357
|
r = r || a;
|
|
356
358
|
}
|
|
357
359
|
}
|
|
@@ -361,23 +363,23 @@ function se(t) {
|
|
|
361
363
|
const { currentNode: e, documentModifier: o, currency: n } = t, i = M(e);
|
|
362
364
|
if (!i)
|
|
363
365
|
return;
|
|
364
|
-
const
|
|
366
|
+
const l = n.alignment === "before" ? "0" : "1", r = (u, s) => {
|
|
365
367
|
o.modifyHtml(i).setAttribute(u, s);
|
|
366
368
|
};
|
|
367
|
-
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"));
|
|
368
370
|
}
|
|
369
371
|
export {
|
|
370
372
|
ie as adjustProductsToSize,
|
|
371
373
|
A as formatProductPrice,
|
|
372
374
|
M as getBlockElement,
|
|
373
|
-
|
|
375
|
+
_ as getCardComposition,
|
|
374
376
|
g as getCurrentLayout,
|
|
375
377
|
Y as reapplySpacing,
|
|
376
378
|
W as regenerateMobileProductRows,
|
|
377
379
|
G as regenerateProductRows,
|
|
378
380
|
re as regenerateProductRowsWithStyles,
|
|
379
381
|
se as setCurrencyAttributes,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
+
ce as updatePricesInPlace,
|
|
383
|
+
le as updateProductContentInPlace,
|
|
382
384
|
K as updateSingleProductContent
|
|
383
385
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var C = (
|
|
1
|
+
var G = Object.defineProperty;
|
|
2
|
+
var P = (u, s, t) => s in u ? G(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
|
|
3
|
+
var C = (u, s, t) => P(u, typeof s != "symbol" ? s + "" : s, t);
|
|
4
4
|
import { ModificationDescription as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as g, DEFAULT_ROW_SPACING as
|
|
5
|
+
import { CommonControl as R } from "../../../common-control.js";
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as M } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as g, DEFAULT_ROW_SPACING as E } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as p } from "../../services/configService.js";
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import { safeGetStyle as L, safeGetParent as
|
|
9
|
+
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
10
|
+
import { safeGetStyle as L, safeGetParent as V } from "../../utils/tagName.js";
|
|
11
11
|
import { getCurrentLayout as f, getBlockElement as B } from "../main/utils.js";
|
|
12
12
|
import { useDebounceFn as O } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
13
|
const U = "recommendation-spacing-control", n = {
|
|
@@ -25,16 +25,16 @@ const U = "recommendation-spacing-control", n = {
|
|
|
25
25
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
26
26
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
27
27
|
};
|
|
28
|
-
function
|
|
29
|
-
if (!
|
|
28
|
+
function I(u, s) {
|
|
29
|
+
if (!u)
|
|
30
30
|
return s;
|
|
31
|
-
const t = parseFloat(
|
|
31
|
+
const t = parseFloat(u);
|
|
32
32
|
return Number.isNaN(t) ? s : t;
|
|
33
33
|
}
|
|
34
|
-
class j extends
|
|
34
|
+
class j extends R {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
C(this, "store",
|
|
37
|
+
C(this, "store", w());
|
|
38
38
|
C(this, "unsubscribeOrientation", null);
|
|
39
39
|
/**
|
|
40
40
|
* Debounced version of _onColumnSpacingChange
|
|
@@ -168,17 +168,17 @@ class j extends w {
|
|
|
168
168
|
return g;
|
|
169
169
|
const t = this.currentNode.querySelector(S) ?? this.currentNode;
|
|
170
170
|
if (f(this.currentNode) === "grid") {
|
|
171
|
-
const h = t.querySelector(".recommendation-attribute-row"),
|
|
171
|
+
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d = L(l, "padding");
|
|
172
172
|
if (!d)
|
|
173
173
|
return g;
|
|
174
|
-
const
|
|
175
|
-
return
|
|
174
|
+
const y = d.trim().split(/\s+/);
|
|
175
|
+
return y.length < 2 ? g : I(y[1], g / 2) * 2;
|
|
176
176
|
}
|
|
177
|
-
const o = t.querySelector(".product-card-wrapper"), i =
|
|
177
|
+
const o = t.querySelector(".product-card-wrapper") ?? null, i = V(o), a = L(i, "padding");
|
|
178
178
|
if (!a)
|
|
179
179
|
return g;
|
|
180
180
|
const r = a.trim().split(/\s+/);
|
|
181
|
-
return r.length < 2 ? g :
|
|
181
|
+
return r.length < 2 ? g : I(r[1], g / 2) * 2;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -186,9 +186,9 @@ class j extends w {
|
|
|
186
186
|
*/
|
|
187
187
|
_getStoredRowSpacing() {
|
|
188
188
|
if (!this.currentNode)
|
|
189
|
-
return
|
|
190
|
-
const e = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer"), o = L(e, "height");
|
|
191
|
-
return
|
|
189
|
+
return E;
|
|
190
|
+
const e = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer") ?? null, o = L(e, "height");
|
|
191
|
+
return I(o, E);
|
|
192
192
|
}
|
|
193
193
|
// ========================================================================
|
|
194
194
|
// Desktop Spacing Handlers
|
|
@@ -209,12 +209,12 @@ class j extends w {
|
|
|
209
209
|
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(S);
|
|
210
210
|
c && (o === "grid" ? Array.from(
|
|
211
211
|
c.querySelectorAll(".attribute-cell")
|
|
212
|
-
).forEach((
|
|
213
|
-
i.modifyHtml(
|
|
212
|
+
).forEach((l) => {
|
|
213
|
+
i.modifyHtml(l).setStyle("padding", r);
|
|
214
214
|
}) : Array.from(
|
|
215
215
|
c.querySelectorAll(".product-card-wrapper")
|
|
216
|
-
).forEach((
|
|
217
|
-
const d =
|
|
216
|
+
).forEach((l) => {
|
|
217
|
+
const d = "parent" in l ? l.parent() : void 0;
|
|
218
218
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
219
219
|
}), i.apply(new m(`Update column spacing to ${t}px`)));
|
|
220
220
|
}
|
|
@@ -260,15 +260,15 @@ class j extends w {
|
|
|
260
260
|
{ mobileColumnSpacing: t },
|
|
261
261
|
`Changed mobile column spacing to ${t}px`
|
|
262
262
|
), this._storeDataAttribute(A.MOBILE_COLUMN_SPACING, t);
|
|
263
|
-
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(
|
|
263
|
+
const o = p.getConfig(this.currentNode).layout || f(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(M);
|
|
264
264
|
c && (o === "grid" ? Array.from(
|
|
265
265
|
c.querySelectorAll(".attribute-cell")
|
|
266
|
-
).forEach((
|
|
267
|
-
i.modifyHtml(
|
|
266
|
+
).forEach((l) => {
|
|
267
|
+
i.modifyHtml(l).setStyle("padding", r);
|
|
268
268
|
}) : Array.from(
|
|
269
269
|
c.querySelectorAll(".product-card-wrapper")
|
|
270
|
-
).forEach((
|
|
271
|
-
const d =
|
|
270
|
+
).forEach((l) => {
|
|
271
|
+
const d = "parent" in l ? l.parent() : void 0;
|
|
272
272
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
273
273
|
}), i.apply(new m(`Update mobile column spacing to ${t}px`)));
|
|
274
274
|
}
|
|
@@ -285,7 +285,7 @@ class j extends w {
|
|
|
285
285
|
{ mobileRowSpacing: t },
|
|
286
286
|
`Changed mobile row spacing to ${t}px`
|
|
287
287
|
), this._storeDataAttribute(A.MOBILE_ROW_SPACING, t);
|
|
288
|
-
const e = this.currentNode.querySelector(
|
|
288
|
+
const e = this.currentNode.querySelector(M);
|
|
289
289
|
if (!e)
|
|
290
290
|
return;
|
|
291
291
|
const o = Array.from(
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RecommendationBlockId as s } from "../../constants/blockIds.js";
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as $ } from "../../utils/priceFormatter.js";
|
|
5
5
|
import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as R } from "../utils.js";
|
|
6
6
|
const a = "0 5px", l = "attribute-cell";
|
|
7
7
|
function p() {
|
|
8
|
-
const t =
|
|
8
|
+
const t = _(), { currencySettings: e } = t.recommendationConfigs;
|
|
9
9
|
return {
|
|
10
10
|
code: e.value,
|
|
11
11
|
symbol: e.symbol,
|
|
@@ -23,7 +23,7 @@ function r(t, e = "price") {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
const I = {
|
|
26
|
-
[
|
|
26
|
+
[x]: (t) => `
|
|
27
27
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
28
28
|
<table
|
|
29
29
|
class="product-card-segment"
|
|
@@ -224,6 +224,8 @@ const I = {
|
|
|
224
224
|
* Custom attribute cell template — same structure as built-in entries
|
|
225
225
|
* (outer td → inner product-card-segment table).
|
|
226
226
|
* Used by `buildElementRenderer` for `customAttr:*` composition entries.
|
|
227
|
+
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
228
|
+
* @param content - Display content for the cell
|
|
227
229
|
*/
|
|
228
230
|
[R]: (t, e) => `
|
|
229
231
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
@@ -238,7 +240,7 @@ const I = {
|
|
|
238
240
|
<tbody>
|
|
239
241
|
<tr valign="top">
|
|
240
242
|
<td
|
|
241
|
-
${g}="
|
|
243
|
+
${g}="${t}"
|
|
242
244
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
243
245
|
align="center"
|
|
244
246
|
esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
|