@useinsider/guido 3.8.3-beta.96b5eeb → 3.9.0-beta.ba394b1
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 +70 -66
- package/dist/composables/useCustomInterfaceAppearance.js +16 -18
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +111 -0
- package/dist/composables/useStripo.js +39 -37
- package/dist/composables/useStripoNotifications.js +26 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +88 -80
- package/dist/config/migrator/recommendation/htmlBuilder.js +53 -52
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/enums/toaster.js +2 -2
- package/dist/extensions/Blocks/Items/block.js +48 -29
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
- package/dist/extensions/Blocks/Recommendation/block.js +64 -42
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +461 -363
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +99 -87
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +162 -160
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -54
- package/dist/extensions/Blocks/Recommendation/templates/index.js +17 -14
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -40
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
- package/dist/extensions/Blocks/controlFactories.js +76 -57
- package/dist/services/templateLibraryApi.js +9 -8
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/composables/useStripoNotifications.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/enums/toaster.d.ts +2 -2
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +10 -1
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/toaster.d.ts +2 -3
- package/dist/stores/toaster.js +10 -10
- package/package.json +2 -2
- package/dist/static/styles/components/notification.css.js +0 -74
|
@@ -1,204 +1,206 @@
|
|
|
1
1
|
import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import { CURRENCY_ATTR as y, CSS_CLASS_SKIP_COMPILE as F, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as
|
|
3
|
+
import { CURRENCY_ATTR as y, CSS_CLASS_SKIP_COMPILE as F, MOBILE_CONTAINER_SELECTOR as O, DESKTOP_CONTAINER_SELECTOR as N, CONTAINER_SELECTOR as G, MOBILE_ROW_SELECTOR as w, ATTR_PRODUCT_ATTR as K, PRODUCT_ATTRIBUTE_PREFIX as T } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as S } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import { captureStyles as
|
|
6
|
+
import { prepareProductRows as L } from "../../templates/index.js";
|
|
7
|
+
import { captureStyles as _ } from "../../utils/captureStyleTemplates.js";
|
|
8
8
|
import { formatPrice as V } from "../../utils/priceFormatter.js";
|
|
9
|
-
import { getDefaultProducts as
|
|
9
|
+
import { getDefaultProducts as k, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as W, isSamePrice as Y, toDisplayableAttributeValue as X } from "../../templates/utils.js";
|
|
10
10
|
const M = "recommendation-block-v2";
|
|
11
|
-
function A(
|
|
12
|
-
if (!
|
|
11
|
+
function A(t) {
|
|
12
|
+
if (!t)
|
|
13
13
|
return null;
|
|
14
|
-
if ("getAttribute" in
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
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 : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return !
|
|
21
|
+
function z(t) {
|
|
22
|
+
const e = A(t);
|
|
23
|
+
return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(F);
|
|
24
24
|
}
|
|
25
|
-
function C(
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
25
|
+
function C(t) {
|
|
26
|
+
const e = A(t);
|
|
27
|
+
if (!e || !("getAttribute" in e))
|
|
28
28
|
return "grid";
|
|
29
|
-
const n =
|
|
29
|
+
const n = e.getAttribute("data-layout");
|
|
30
30
|
return n === "list" || n === "horizontal" ? "list" : "grid";
|
|
31
31
|
}
|
|
32
|
-
function x(
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
return
|
|
36
|
-
const n =
|
|
37
|
-
return n ? n.split(",").filter(Boolean) :
|
|
32
|
+
function x(t) {
|
|
33
|
+
const e = A(t);
|
|
34
|
+
if (!e || !("getAttribute" in e))
|
|
35
|
+
return R;
|
|
36
|
+
const n = e.getAttribute("data-card-composition");
|
|
37
|
+
return n ? n.split(",").filter(Boolean) : R;
|
|
38
38
|
}
|
|
39
|
-
function D(
|
|
40
|
-
if (!
|
|
39
|
+
function D(t) {
|
|
40
|
+
if (!t || !("childNodes" in t))
|
|
41
41
|
return null;
|
|
42
|
-
const
|
|
42
|
+
const e = t.childNodes(), n = e.find(
|
|
43
43
|
(o) => "getType" in o && o.getType() === "text"
|
|
44
44
|
);
|
|
45
|
-
return n ||
|
|
45
|
+
return n || e.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : D(r), null);
|
|
46
46
|
}
|
|
47
|
-
function b(
|
|
48
|
-
const o = D(
|
|
49
|
-
return o ? (
|
|
47
|
+
function b(t, e, n) {
|
|
48
|
+
const o = D(e);
|
|
49
|
+
return o ? (t.modifyHtml(o).setText(n), !0) : !1;
|
|
50
50
|
}
|
|
51
|
-
function H(
|
|
52
|
-
return
|
|
51
|
+
function H(t, e) {
|
|
52
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : k();
|
|
53
53
|
}
|
|
54
|
-
function U(
|
|
55
|
-
if (typeof
|
|
56
|
-
return `0 ${
|
|
54
|
+
function U(t) {
|
|
55
|
+
if (typeof t == "number")
|
|
56
|
+
return `0 ${t / 2}px`;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
const { currentNode:
|
|
60
|
-
if (!
|
|
58
|
+
function J(t) {
|
|
59
|
+
const { currentNode: e, documentModifier: n } = t;
|
|
60
|
+
if (!e || !("querySelector" in e))
|
|
61
61
|
return !1;
|
|
62
|
-
const o =
|
|
62
|
+
const o = e.querySelector(w);
|
|
63
63
|
return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return "getOuterHTML" in
|
|
65
|
+
function Q(t) {
|
|
66
|
+
return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
return !
|
|
68
|
+
function Z(t) {
|
|
69
|
+
const e = t.querySelector(".container");
|
|
70
|
+
return !e || !("childNodes" in e) ? null : e.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const o =
|
|
72
|
+
function ee(t, e, n) {
|
|
73
|
+
const o = Z(t);
|
|
74
74
|
if (!o || !("childNodes" in o))
|
|
75
75
|
return;
|
|
76
|
-
const r = o.childNodes().map(
|
|
77
|
-
|
|
76
|
+
const r = o.childNodes().map(Q).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
|
|
77
|
+
e.modifyHtml(o).setInnerHtml(r + s), e.apply(new g("Added mobile product row"));
|
|
78
78
|
}
|
|
79
|
-
function $(
|
|
79
|
+
function $(t, e = {}) {
|
|
80
80
|
const {
|
|
81
81
|
currentNode: n,
|
|
82
82
|
documentModifier: o,
|
|
83
83
|
products: r,
|
|
84
84
|
layout: s,
|
|
85
85
|
composition: i
|
|
86
|
-
} =
|
|
86
|
+
} = t;
|
|
87
87
|
if (!n || !("querySelector" in n))
|
|
88
88
|
return !1;
|
|
89
89
|
const u = s ?? C(n), c = S.getConfig(n);
|
|
90
90
|
if (u === "list" || !c.mobileLayoutEnabled)
|
|
91
|
-
return
|
|
92
|
-
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${
|
|
91
|
+
return J({ currentNode: n, documentModifier: o });
|
|
92
|
+
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${L(a, u, {
|
|
93
93
|
productsPerRow: c.mobileCardsInRow,
|
|
94
94
|
composition: d,
|
|
95
95
|
filterList: l.filterList,
|
|
96
|
-
|
|
96
|
+
priceInline: !c.priceMovedToNextLine,
|
|
97
|
+
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
97
98
|
cellPadding: U(c.mobileColumnSpacing),
|
|
98
99
|
rowSpacingPx: c.mobileRowSpacing,
|
|
99
|
-
...
|
|
100
|
-
})}</table></td>`, E = n.querySelector(
|
|
101
|
-
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (
|
|
100
|
+
...e
|
|
101
|
+
})}</table></td>`, E = n.querySelector(w);
|
|
102
|
+
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (ee(n, o, p), !1);
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
$(
|
|
104
|
+
function ye(t) {
|
|
105
|
+
$(t, _(t.currentNode)) && t.documentModifier.apply(new g("Updated mobile product rows"));
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function te(t, e = {}) {
|
|
107
108
|
const {
|
|
108
109
|
currentNode: n,
|
|
109
110
|
documentModifier: o,
|
|
110
111
|
products: r,
|
|
111
112
|
layout: s,
|
|
112
113
|
composition: i
|
|
113
|
-
} =
|
|
114
|
+
} = t;
|
|
114
115
|
if (!n || !("querySelector" in n))
|
|
115
116
|
return !1;
|
|
116
|
-
const u = n.querySelector(
|
|
117
|
+
const u = n.querySelector(N) ?? n.querySelector(G);
|
|
117
118
|
if (!u)
|
|
118
119
|
return !1;
|
|
119
|
-
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), p = S.getConfig(n), E =
|
|
120
|
+
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n), p = S.getConfig(n), E = L(l, f, {
|
|
120
121
|
productsPerRow: a,
|
|
121
122
|
composition: d,
|
|
122
123
|
filterList: c.filterList,
|
|
123
|
-
|
|
124
|
+
priceInline: !p.priceMovedToNextLine,
|
|
125
|
+
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
124
126
|
cellPadding: U(p.columnSpacing),
|
|
125
127
|
rowSpacingPx: p.rowSpacing,
|
|
126
|
-
...
|
|
128
|
+
...e
|
|
127
129
|
});
|
|
128
130
|
return o.modifyHtml(u).setInnerHtml(E), !0;
|
|
129
131
|
}
|
|
130
|
-
function
|
|
132
|
+
function be(t) {
|
|
131
133
|
const {
|
|
132
|
-
currentNode:
|
|
134
|
+
currentNode: e,
|
|
133
135
|
documentModifier: n,
|
|
134
136
|
afterRegenerate: o,
|
|
135
137
|
products: r,
|
|
136
138
|
layout: s,
|
|
137
139
|
composition: i,
|
|
138
140
|
skipStylePreservation: u
|
|
139
|
-
} =
|
|
140
|
-
if (!
|
|
141
|
+
} = t;
|
|
142
|
+
if (!e)
|
|
141
143
|
return;
|
|
142
|
-
const c = u ? {} :
|
|
143
|
-
currentNode:
|
|
144
|
+
const c = u ? {} : _(e), l = {
|
|
145
|
+
currentNode: e,
|
|
144
146
|
documentModifier: n,
|
|
145
147
|
products: r,
|
|
146
148
|
layout: s,
|
|
147
149
|
composition: i
|
|
148
150
|
};
|
|
149
|
-
let a =
|
|
151
|
+
let a = te(l, c);
|
|
150
152
|
a = $(l, c) || a, a && n.apply(new g("Regenerate products with styles")), o == null || o();
|
|
151
153
|
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
154
|
+
function ge(t, e) {
|
|
155
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...k(e - t.length)];
|
|
154
156
|
}
|
|
155
157
|
function B() {
|
|
156
|
-
const
|
|
158
|
+
const t = P(), { currencySettings: e } = t.recommendationConfigs, n = parseInt(e.decimalCount);
|
|
157
159
|
return {
|
|
158
|
-
code:
|
|
159
|
-
symbol:
|
|
160
|
-
alignment:
|
|
160
|
+
code: e.value,
|
|
161
|
+
symbol: e.symbol,
|
|
162
|
+
alignment: e.alignment === "0" ? "before" : "after",
|
|
161
163
|
decimalCount: Number.isNaN(n) ? 2 : n,
|
|
162
|
-
decimalSeparator:
|
|
163
|
-
thousandSeparator:
|
|
164
|
+
decimalSeparator: e.decimalSeparator,
|
|
165
|
+
thousandSeparator: e.thousandSeparator
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
|
-
function q(
|
|
167
|
-
const n = B(), o = e
|
|
168
|
+
function q(t, e = "price") {
|
|
169
|
+
const n = B(), o = t[e], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
|
|
168
170
|
return V({
|
|
169
171
|
price: r,
|
|
170
172
|
currency: n
|
|
171
173
|
});
|
|
172
174
|
}
|
|
173
|
-
function
|
|
175
|
+
function ne(t) {
|
|
174
176
|
var s, i;
|
|
175
|
-
const
|
|
177
|
+
const e = B(), n = ((s = t.original_price) == null ? void 0 : s[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, o = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
176
178
|
return r > 0 ? `-${r}%` : "0%";
|
|
177
179
|
}
|
|
178
|
-
function v(
|
|
179
|
-
const { documentModifier:
|
|
180
|
+
function v(t) {
|
|
181
|
+
const { documentModifier: e, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = t;
|
|
180
182
|
let u = !1;
|
|
181
183
|
if (o && "querySelector" in o) {
|
|
182
184
|
const c = o.querySelector("strong") ?? o.querySelector("p"), l = q(n, "price");
|
|
183
|
-
b(
|
|
185
|
+
b(e, c ?? null, l) && (u = !0);
|
|
184
186
|
}
|
|
185
187
|
if (r && "querySelector" in r) {
|
|
186
188
|
const c = r.querySelector("strong") ?? r.querySelector("p"), l = q(n, "original_price");
|
|
187
|
-
b(
|
|
189
|
+
b(e, c ?? null, l) && (u = !0), e.modifyHtml(r).setAttribute("data-same-price", String(Y(n))), u = !0;
|
|
188
190
|
}
|
|
189
191
|
if (s && "querySelector" in s) {
|
|
190
192
|
const c = s.querySelector(".omnibus-price-value") ?? null, l = q(n, "original_price");
|
|
191
|
-
b(
|
|
193
|
+
b(e, c, l) && (u = !0);
|
|
192
194
|
}
|
|
193
195
|
if (i && "querySelector" in i) {
|
|
194
|
-
const c = i.querySelector(".omnibus-discount-value") ?? null, l =
|
|
195
|
-
b(
|
|
196
|
+
const c = i.querySelector(".omnibus-discount-value") ?? null, l = ne(n);
|
|
197
|
+
b(e, c, l) && (u = !0);
|
|
196
198
|
}
|
|
197
199
|
return u;
|
|
198
200
|
}
|
|
199
|
-
function
|
|
201
|
+
function oe(t) {
|
|
200
202
|
const {
|
|
201
|
-
documentModifier:
|
|
203
|
+
documentModifier: e,
|
|
202
204
|
product: n,
|
|
203
205
|
imageEl: o,
|
|
204
206
|
nameEl: r,
|
|
@@ -207,20 +209,20 @@ function ne(e) {
|
|
|
207
209
|
omnibusPriceEl: u,
|
|
208
210
|
omnibusDiscountEl: c,
|
|
209
211
|
buttonEl: l
|
|
210
|
-
} =
|
|
212
|
+
} = t;
|
|
211
213
|
let a = !1;
|
|
212
214
|
if (o && "querySelector" in o) {
|
|
213
215
|
const d = o.querySelector("img");
|
|
214
|
-
d && (
|
|
216
|
+
d && (e.modifyHtml(d).setAttribute("src", W(n.image_url)).setAttribute("alt", n.name), a = !0);
|
|
215
217
|
const f = o.querySelector("a");
|
|
216
|
-
f && (
|
|
218
|
+
f && (e.modifyHtml(f).setAttribute("href", n.url), a = !0);
|
|
217
219
|
}
|
|
218
220
|
if (r && "querySelector" in r) {
|
|
219
221
|
const d = r.querySelector("strong") ?? r.querySelector("p");
|
|
220
|
-
b(
|
|
222
|
+
b(e, d ?? null, n.name) && (a = !0);
|
|
221
223
|
}
|
|
222
224
|
if (v({
|
|
223
|
-
documentModifier:
|
|
225
|
+
documentModifier: e,
|
|
224
226
|
product: n,
|
|
225
227
|
priceEl: s,
|
|
226
228
|
oldPriceEl: i,
|
|
@@ -228,27 +230,27 @@ function ne(e) {
|
|
|
228
230
|
omnibusDiscountEl: c
|
|
229
231
|
}) && (a = !0), l && "querySelector" in l) {
|
|
230
232
|
const d = l.querySelector("a.es-button") || l.querySelector("a");
|
|
231
|
-
d && (
|
|
233
|
+
d && (e.modifyHtml(d).setAttribute("href", n.url), a = !0);
|
|
232
234
|
}
|
|
233
235
|
return a;
|
|
234
236
|
}
|
|
235
|
-
function j(
|
|
236
|
-
return "querySelector" in
|
|
237
|
+
function j(t) {
|
|
238
|
+
return "querySelector" in t ? t.querySelector(N) ?? t : t;
|
|
237
239
|
}
|
|
238
|
-
function
|
|
240
|
+
function re(t, e) {
|
|
239
241
|
var o;
|
|
240
242
|
let n;
|
|
241
|
-
if (
|
|
242
|
-
const r =
|
|
243
|
-
n = (o =
|
|
243
|
+
if (t.startsWith(T)) {
|
|
244
|
+
const r = t.slice(T.length);
|
|
245
|
+
n = (o = e.product_attributes) == null ? void 0 : o[r];
|
|
244
246
|
} else
|
|
245
|
-
n = t
|
|
246
|
-
return
|
|
247
|
+
n = e[t];
|
|
248
|
+
return X(n) || null;
|
|
247
249
|
}
|
|
248
|
-
function
|
|
249
|
-
if (!("querySelectorAll" in
|
|
250
|
+
function ie(t, e, n) {
|
|
251
|
+
if (!("querySelectorAll" in t))
|
|
250
252
|
return !1;
|
|
251
|
-
const o =
|
|
253
|
+
const o = t.querySelectorAll(
|
|
252
254
|
`[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
|
|
253
255
|
);
|
|
254
256
|
if (o.length === 0)
|
|
@@ -269,36 +271,36 @@ function re(e, t, n) {
|
|
|
269
271
|
i.slice(0, c).forEach((l, a) => {
|
|
270
272
|
if (!("querySelector" in l))
|
|
271
273
|
return;
|
|
272
|
-
const d =
|
|
274
|
+
const d = re(u, n[a]);
|
|
273
275
|
if (d === null)
|
|
274
276
|
return;
|
|
275
277
|
const f = l.querySelector("p") ?? null;
|
|
276
|
-
b(
|
|
278
|
+
b(e, f, d) && (s = !0);
|
|
277
279
|
});
|
|
278
280
|
}), s;
|
|
279
281
|
}
|
|
280
|
-
function
|
|
281
|
-
if (!("querySelectorAll" in
|
|
282
|
+
function I(t, e, n) {
|
|
283
|
+
if (!("querySelectorAll" in t))
|
|
282
284
|
return !1;
|
|
283
|
-
const o =
|
|
285
|
+
const o = t.querySelectorAll(
|
|
284
286
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
285
|
-
), r =
|
|
287
|
+
), r = t.querySelectorAll(
|
|
286
288
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
287
|
-
), s =
|
|
289
|
+
), s = t.querySelectorAll(
|
|
288
290
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
289
|
-
), i =
|
|
291
|
+
), i = t.querySelectorAll(
|
|
290
292
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
291
|
-
), u =
|
|
293
|
+
), u = t.querySelectorAll(
|
|
292
294
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
293
|
-
), c =
|
|
295
|
+
), c = t.querySelectorAll(
|
|
294
296
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
295
|
-
), l =
|
|
297
|
+
), l = t.querySelectorAll(
|
|
296
298
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
297
299
|
), a = Math.min(o.length, n.length);
|
|
298
300
|
let d = !1;
|
|
299
301
|
for (let f = 0; f < a; f++) {
|
|
300
|
-
const p =
|
|
301
|
-
documentModifier:
|
|
302
|
+
const p = oe({
|
|
303
|
+
documentModifier: e,
|
|
302
304
|
product: n[f],
|
|
303
305
|
imageEl: o[f] ?? null,
|
|
304
306
|
nameEl: r[f] ?? null,
|
|
@@ -310,23 +312,23 @@ function h(e, t, n) {
|
|
|
310
312
|
});
|
|
311
313
|
d = d || p;
|
|
312
314
|
}
|
|
313
|
-
return
|
|
315
|
+
return ie(t, e, n) && (d = !0), d;
|
|
314
316
|
}
|
|
315
|
-
function
|
|
316
|
-
const { currentNode:
|
|
317
|
-
if (!
|
|
317
|
+
function Se(t) {
|
|
318
|
+
const { currentNode: e, documentModifier: n, products: o } = t;
|
|
319
|
+
if (!e || !("querySelectorAll" in e))
|
|
318
320
|
return !1;
|
|
319
|
-
const r = j(
|
|
321
|
+
const r = j(e);
|
|
320
322
|
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
321
323
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
322
324
|
).length !== o.length)
|
|
323
325
|
return !1;
|
|
324
|
-
let i =
|
|
325
|
-
const u = C(
|
|
326
|
-
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in
|
|
327
|
-
const l =
|
|
326
|
+
let i = I(r, n, o);
|
|
327
|
+
const u = C(e), c = S.getConfig(e);
|
|
328
|
+
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in e) {
|
|
329
|
+
const l = e.querySelector(O);
|
|
328
330
|
if (l) {
|
|
329
|
-
const a =
|
|
331
|
+
const a = I(
|
|
330
332
|
l,
|
|
331
333
|
n,
|
|
332
334
|
o
|
|
@@ -336,22 +338,22 @@ function ge(e) {
|
|
|
336
338
|
}
|
|
337
339
|
return i && n.apply(new g("Updated product content in-place")), !0;
|
|
338
340
|
}
|
|
339
|
-
function
|
|
340
|
-
if (!("querySelectorAll" in
|
|
341
|
+
function h(t, e, n) {
|
|
342
|
+
if (!("querySelectorAll" in t))
|
|
341
343
|
return !1;
|
|
342
|
-
const o =
|
|
344
|
+
const o = t.querySelectorAll(
|
|
343
345
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
344
|
-
), r =
|
|
346
|
+
), r = t.querySelectorAll(
|
|
345
347
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
346
|
-
), s =
|
|
348
|
+
), s = t.querySelectorAll(
|
|
347
349
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
348
|
-
), i =
|
|
350
|
+
), i = t.querySelectorAll(
|
|
349
351
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
350
352
|
), u = Math.min(o.length, n.length);
|
|
351
353
|
let c = !1;
|
|
352
354
|
for (let l = 0; l < u; l++)
|
|
353
355
|
v({
|
|
354
|
-
documentModifier:
|
|
356
|
+
documentModifier: e,
|
|
355
357
|
product: n[l],
|
|
356
358
|
priceEl: o[l] ?? null,
|
|
357
359
|
oldPriceEl: r[l] ?? null,
|
|
@@ -360,29 +362,29 @@ function I(e, t, n) {
|
|
|
360
362
|
}) && (c = !0);
|
|
361
363
|
return c;
|
|
362
364
|
}
|
|
363
|
-
function
|
|
364
|
-
const { currentNode:
|
|
365
|
-
if (!
|
|
365
|
+
function Ee(t) {
|
|
366
|
+
const { currentNode: e, documentModifier: n } = t;
|
|
367
|
+
if (!e || !("querySelectorAll" in e))
|
|
366
368
|
return !1;
|
|
367
|
-
if (
|
|
369
|
+
if (z(e))
|
|
368
370
|
return !0;
|
|
369
371
|
const r = P().recommendationProducts;
|
|
370
372
|
if (r.length === 0)
|
|
371
373
|
return !1;
|
|
372
|
-
const s = j(
|
|
373
|
-
let i =
|
|
374
|
-
const u = C(
|
|
375
|
-
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in
|
|
376
|
-
const l =
|
|
374
|
+
const s = j(e);
|
|
375
|
+
let i = h(s, n, r);
|
|
376
|
+
const u = C(e), c = S.getConfig(e);
|
|
377
|
+
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in e) {
|
|
378
|
+
const l = e.querySelector(O);
|
|
377
379
|
if (l) {
|
|
378
|
-
const a =
|
|
380
|
+
const a = h(l, n, r);
|
|
379
381
|
i = i || a;
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
384
|
return i && n.apply(new g("Updated price formatting in-place")), i;
|
|
383
385
|
}
|
|
384
|
-
function
|
|
385
|
-
const { currentNode:
|
|
386
|
+
function Pe(t) {
|
|
387
|
+
const { currentNode: e, documentModifier: n, currency: o } = t, r = A(e);
|
|
386
388
|
if (!r)
|
|
387
389
|
return;
|
|
388
390
|
const s = o.alignment === "before" ? "0" : "1", i = (u, c) => {
|
|
@@ -391,16 +393,16 @@ function Ee(e) {
|
|
|
391
393
|
i(y.CURRENCY, o.code), i(y.SYMBOL, o.symbol), i(y.ALIGNMENT, s), i(y.THOUSAND_SEPARATOR, o.thousandSeparator), i(y.DECIMAL_SEPARATOR, o.decimalSeparator), i(y.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new g("Update currency attributes"));
|
|
392
394
|
}
|
|
393
395
|
export {
|
|
394
|
-
|
|
396
|
+
ge as adjustProductsToSize,
|
|
395
397
|
q as formatProductPrice,
|
|
396
398
|
A as getBlockElement,
|
|
397
399
|
x as getCardComposition,
|
|
398
400
|
C as getCurrentLayout,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
401
|
+
z as isPartnerManagedBlock,
|
|
402
|
+
ye as regenerateMobileProductRows,
|
|
403
|
+
be as regenerateProductRowsWithStyles,
|
|
404
|
+
Pe as setCurrencyAttributes,
|
|
405
|
+
Ee as updatePricesInPlace,
|
|
406
|
+
Se as updateProductContentInPlace,
|
|
407
|
+
oe as updateSingleProductContent
|
|
406
408
|
};
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlock as m } from "./block.js";
|
|
3
|
-
import
|
|
3
|
+
import n from "./canvasPreview.css.js";
|
|
4
|
+
import { RecommendationBlockControl as i } from "./controls/main/index.js";
|
|
4
5
|
import "./constants/selectors.js";
|
|
5
6
|
import "./store/recommendation.js";
|
|
6
7
|
import "./utils/captureStyleTemplates.js";
|
|
7
|
-
import { NameControls as
|
|
8
|
-
import { PriceControls as
|
|
9
|
-
import { OldPriceControls as
|
|
10
|
-
import { OmnibusPriceControls as
|
|
11
|
-
import { OmnibusDiscountControls as
|
|
12
|
-
import { ButtonControls as
|
|
13
|
-
import { ImageControls as
|
|
8
|
+
import { NameControls as e } from "./controls/name/index.js";
|
|
9
|
+
import { PriceControls as s } from "./controls/price/index.js";
|
|
10
|
+
import { OldPriceControls as l } from "./controls/oldPrice/index.js";
|
|
11
|
+
import { OmnibusPriceControls as p } from "./controls/omnibusPrice/index.js";
|
|
12
|
+
import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
|
|
13
|
+
import { ButtonControls as c } from "./controls/button/index.js";
|
|
14
|
+
import { ImageControls as f } from "./controls/image/index.js";
|
|
14
15
|
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
15
|
-
import { SpacingControl as
|
|
16
|
-
import { CardBackgroundColorControl as
|
|
17
|
-
import { RecommendationCardCompositionControl as
|
|
18
|
-
import { SyncInfoMessageControl as
|
|
19
|
-
import { RecommendationIconsRegistry as
|
|
20
|
-
import
|
|
21
|
-
import { SettingsPanel as
|
|
22
|
-
const
|
|
23
|
-
i,
|
|
16
|
+
import { SpacingControl as d } from "./controls/spacing/index.js";
|
|
17
|
+
import { CardBackgroundColorControl as u } from "./controls/cardBackground/index.js";
|
|
18
|
+
import { RecommendationCardCompositionControl as g } from "./controls/cardComposition/index.js";
|
|
19
|
+
import { SyncInfoMessageControl as y } from "./controls/syncInfoMessage.js";
|
|
20
|
+
import { RecommendationIconsRegistry as P } from "./iconsRegistry.js";
|
|
21
|
+
import R from "./recommendation.css.js";
|
|
22
|
+
import { SettingsPanel as S } from "./settingsPanel.js";
|
|
23
|
+
const w = [
|
|
24
24
|
e,
|
|
25
25
|
s,
|
|
26
26
|
l,
|
|
27
27
|
p,
|
|
28
28
|
a,
|
|
29
29
|
c,
|
|
30
|
-
C
|
|
31
|
-
], P = [
|
|
32
|
-
n,
|
|
33
|
-
d,
|
|
34
30
|
f,
|
|
31
|
+
C
|
|
32
|
+
], B = [
|
|
33
|
+
i,
|
|
35
34
|
u,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
d,
|
|
36
|
+
g,
|
|
37
|
+
y
|
|
38
|
+
], b = [
|
|
39
|
+
...B,
|
|
40
|
+
...w.flatMap((o) => Object.values(o))
|
|
41
|
+
], U = b.reduce(
|
|
41
42
|
(o, t) => o.addControl(t),
|
|
42
|
-
new r().addBlock(m).withSettingsPanelRegistry(
|
|
43
|
-
).addStyles(
|
|
43
|
+
new r().addBlock(m).withSettingsPanelRegistry(S)
|
|
44
|
+
).addStyles(R).withPreviewStyles(n).withIconsRegistry(P).build();
|
|
44
45
|
export {
|
|
45
|
-
|
|
46
|
+
U as default
|
|
46
47
|
};
|