@useinsider/guido 3.8.1 → 3.8.2-beta.189e91c
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/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +42 -37
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +40 -37
- package/dist/composables/useHtmlCompiler.js +13 -10
- package/dist/composables/useHtmlValidator.js +180 -133
- package/dist/composables/usePreviewInteractionGuard.js +17 -0
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +111 -0
- package/dist/composables/useSave.js +14 -14
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
- package/dist/config/compiler/htmlCompilerRules.js +38 -10
- package/dist/config/compiler/recommendationCompilerRules.js +84 -109
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +98 -89
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +170 -163
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/block.js +60 -41
- 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/constants/selectors.js +26 -20
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +359 -264
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -83
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +43 -31
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +55 -45
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +175 -166
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -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/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +6 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -53
- package/dist/extensions/Blocks/Recommendation/templates/index.js +20 -16
- 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/Unsubscribe/block.js +40 -37
- package/dist/extensions/Blocks/Unsubscribe/control.js +19 -16
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +36 -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/layoutOrientation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
- 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/stores/config.d.ts +36 -0
- package/dist/src/stores/unsubscribe.d.ts +11 -1
- package/dist/src/utils/ampErrorFilter.d.ts +1 -0
- package/dist/stores/unsubscribe.js +8 -7
- package/dist/utils/ampErrorFilter.js +6 -5
- package/package.json +1 -1
|
@@ -1,200 +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
|
|
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
|
|
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
|
+
}
|
|
21
|
+
function z(t) {
|
|
22
|
+
const e = A(t);
|
|
23
|
+
return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(F);
|
|
20
24
|
}
|
|
21
|
-
function C(
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
25
|
+
function C(t) {
|
|
26
|
+
const e = A(t);
|
|
27
|
+
if (!e || !("getAttribute" in e))
|
|
24
28
|
return "grid";
|
|
25
|
-
const n =
|
|
29
|
+
const n = e.getAttribute("data-layout");
|
|
26
30
|
return n === "list" || n === "horizontal" ? "list" : "grid";
|
|
27
31
|
}
|
|
28
|
-
function x(
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
return
|
|
32
|
-
const n =
|
|
33
|
-
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;
|
|
34
38
|
}
|
|
35
|
-
function D(
|
|
36
|
-
if (!
|
|
39
|
+
function D(t) {
|
|
40
|
+
if (!t || !("childNodes" in t))
|
|
37
41
|
return null;
|
|
38
|
-
const
|
|
42
|
+
const e = t.childNodes(), n = e.find(
|
|
39
43
|
(o) => "getType" in o && o.getType() === "text"
|
|
40
44
|
);
|
|
41
|
-
return n ||
|
|
45
|
+
return n || e.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : D(r), null);
|
|
42
46
|
}
|
|
43
|
-
function b(
|
|
44
|
-
const o = D(
|
|
45
|
-
return o ? (
|
|
47
|
+
function b(t, e, n) {
|
|
48
|
+
const o = D(e);
|
|
49
|
+
return o ? (t.modifyHtml(o).setText(n), !0) : !1;
|
|
46
50
|
}
|
|
47
|
-
function H(
|
|
48
|
-
return
|
|
51
|
+
function H(t, e) {
|
|
52
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : k();
|
|
49
53
|
}
|
|
50
|
-
function U(
|
|
51
|
-
if (typeof
|
|
52
|
-
return `0 ${
|
|
54
|
+
function U(t) {
|
|
55
|
+
if (typeof t == "number")
|
|
56
|
+
return `0 ${t / 2}px`;
|
|
53
57
|
}
|
|
54
|
-
function
|
|
55
|
-
const { currentNode:
|
|
56
|
-
if (!
|
|
58
|
+
function J(t) {
|
|
59
|
+
const { currentNode: e, documentModifier: n } = t;
|
|
60
|
+
if (!e || !("querySelector" in e))
|
|
57
61
|
return !1;
|
|
58
|
-
const o =
|
|
62
|
+
const o = e.querySelector(w);
|
|
59
63
|
return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
|
|
60
64
|
}
|
|
61
|
-
function
|
|
62
|
-
return "getOuterHTML" in
|
|
65
|
+
function Q(t) {
|
|
66
|
+
return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
|
|
63
67
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
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;
|
|
67
71
|
}
|
|
68
|
-
function
|
|
69
|
-
const o =
|
|
72
|
+
function ee(t, e, n) {
|
|
73
|
+
const o = Z(t);
|
|
70
74
|
if (!o || !("childNodes" in o))
|
|
71
75
|
return;
|
|
72
|
-
const r = o.childNodes().map(
|
|
73
|
-
|
|
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"));
|
|
74
78
|
}
|
|
75
|
-
function $(
|
|
79
|
+
function $(t, e = {}) {
|
|
76
80
|
const {
|
|
77
81
|
currentNode: n,
|
|
78
82
|
documentModifier: o,
|
|
79
83
|
products: r,
|
|
80
84
|
layout: s,
|
|
81
85
|
composition: i
|
|
82
|
-
} =
|
|
86
|
+
} = t;
|
|
83
87
|
if (!n || !("querySelector" in n))
|
|
84
88
|
return !1;
|
|
85
89
|
const u = s ?? C(n), c = S.getConfig(n);
|
|
86
90
|
if (u === "list" || !c.mobileLayoutEnabled)
|
|
87
|
-
return
|
|
88
|
-
const l = P(), a = H(r, l.recommendationProducts), d = i ?? x(n),
|
|
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, {
|
|
89
93
|
productsPerRow: c.mobileCardsInRow,
|
|
90
94
|
composition: d,
|
|
91
95
|
filterList: l.filterList,
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
priceInline: !c.priceMovedToNextLine,
|
|
97
|
+
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
98
|
+
cellPadding: U(c.mobileColumnSpacing),
|
|
94
99
|
rowSpacingPx: c.mobileRowSpacing,
|
|
95
|
-
...
|
|
96
|
-
})}</table></td>`, E = n.querySelector(
|
|
97
|
-
return E ? (o.modifyHtml(E).setInnerHtml(
|
|
100
|
+
...e
|
|
101
|
+
})}</table></td>`, E = n.querySelector(w);
|
|
102
|
+
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (ee(n, o, p), !1);
|
|
98
103
|
}
|
|
99
|
-
function
|
|
100
|
-
$(
|
|
104
|
+
function ye(t) {
|
|
105
|
+
$(t, _(t.currentNode)) && t.documentModifier.apply(new g("Updated mobile product rows"));
|
|
101
106
|
}
|
|
102
|
-
function
|
|
107
|
+
function te(t, e = {}) {
|
|
103
108
|
const {
|
|
104
109
|
currentNode: n,
|
|
105
110
|
documentModifier: o,
|
|
106
111
|
products: r,
|
|
107
112
|
layout: s,
|
|
108
113
|
composition: i
|
|
109
|
-
} =
|
|
114
|
+
} = t;
|
|
110
115
|
if (!n || !("querySelector" in n))
|
|
111
116
|
return !1;
|
|
112
|
-
const u = n.querySelector(
|
|
117
|
+
const u = n.querySelector(N) ?? n.querySelector(G);
|
|
113
118
|
if (!u)
|
|
114
119
|
return !1;
|
|
115
|
-
const c = P(), l = H(r, c.recommendationProducts), { cardsInRow: a } = S.getConfig(n), d = i ?? x(n), f = s ?? C(n),
|
|
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, {
|
|
116
121
|
productsPerRow: a,
|
|
117
122
|
composition: d,
|
|
118
123
|
filterList: c.filterList,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
priceInline: !p.priceMovedToNextLine,
|
|
125
|
+
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
126
|
+
cellPadding: U(p.columnSpacing),
|
|
127
|
+
rowSpacingPx: p.rowSpacing,
|
|
128
|
+
...e
|
|
123
129
|
});
|
|
124
130
|
return o.modifyHtml(u).setInnerHtml(E), !0;
|
|
125
131
|
}
|
|
126
|
-
function
|
|
132
|
+
function be(t) {
|
|
127
133
|
const {
|
|
128
|
-
currentNode:
|
|
134
|
+
currentNode: e,
|
|
129
135
|
documentModifier: n,
|
|
130
136
|
afterRegenerate: o,
|
|
131
137
|
products: r,
|
|
132
138
|
layout: s,
|
|
133
139
|
composition: i,
|
|
134
140
|
skipStylePreservation: u
|
|
135
|
-
} =
|
|
136
|
-
if (!
|
|
141
|
+
} = t;
|
|
142
|
+
if (!e)
|
|
137
143
|
return;
|
|
138
|
-
const c = u ? {} :
|
|
139
|
-
currentNode:
|
|
144
|
+
const c = u ? {} : _(e), l = {
|
|
145
|
+
currentNode: e,
|
|
140
146
|
documentModifier: n,
|
|
141
147
|
products: r,
|
|
142
148
|
layout: s,
|
|
143
149
|
composition: i
|
|
144
150
|
};
|
|
145
|
-
let a =
|
|
151
|
+
let a = te(l, c);
|
|
146
152
|
a = $(l, c) || a, a && n.apply(new g("Regenerate products with styles")), o == null || o();
|
|
147
153
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
154
|
+
function ge(t, e) {
|
|
155
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...k(e - t.length)];
|
|
150
156
|
}
|
|
151
157
|
function B() {
|
|
152
|
-
const
|
|
158
|
+
const t = P(), { currencySettings: e } = t.recommendationConfigs, n = parseInt(e.decimalCount);
|
|
153
159
|
return {
|
|
154
|
-
code:
|
|
155
|
-
symbol:
|
|
156
|
-
alignment:
|
|
160
|
+
code: e.value,
|
|
161
|
+
symbol: e.symbol,
|
|
162
|
+
alignment: e.alignment === "0" ? "before" : "after",
|
|
157
163
|
decimalCount: Number.isNaN(n) ? 2 : n,
|
|
158
|
-
decimalSeparator:
|
|
159
|
-
thousandSeparator:
|
|
164
|
+
decimalSeparator: e.decimalSeparator,
|
|
165
|
+
thousandSeparator: e.thousandSeparator
|
|
160
166
|
};
|
|
161
167
|
}
|
|
162
|
-
function
|
|
163
|
-
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;
|
|
164
170
|
return V({
|
|
165
171
|
price: r,
|
|
166
172
|
currency: n
|
|
167
173
|
});
|
|
168
174
|
}
|
|
169
|
-
function
|
|
175
|
+
function ne(t) {
|
|
170
176
|
var s, i;
|
|
171
|
-
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;
|
|
172
178
|
return r > 0 ? `-${r}%` : "0%";
|
|
173
179
|
}
|
|
174
|
-
function v(
|
|
175
|
-
const { documentModifier:
|
|
180
|
+
function v(t) {
|
|
181
|
+
const { documentModifier: e, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: i } = t;
|
|
176
182
|
let u = !1;
|
|
177
183
|
if (o && "querySelector" in o) {
|
|
178
|
-
const c = o.querySelector("strong") ?? o.querySelector("p"), l =
|
|
179
|
-
b(
|
|
184
|
+
const c = o.querySelector("strong") ?? o.querySelector("p"), l = q(n, "price");
|
|
185
|
+
b(e, c ?? null, l) && (u = !0);
|
|
180
186
|
}
|
|
181
187
|
if (r && "querySelector" in r) {
|
|
182
|
-
const c = r.querySelector("strong") ?? r.querySelector("p"), l =
|
|
183
|
-
b(
|
|
188
|
+
const c = r.querySelector("strong") ?? r.querySelector("p"), l = q(n, "original_price");
|
|
189
|
+
b(e, c ?? null, l) && (u = !0), e.modifyHtml(r).setAttribute("data-same-price", String(Y(n))), u = !0;
|
|
184
190
|
}
|
|
185
191
|
if (s && "querySelector" in s) {
|
|
186
|
-
const c = s.querySelector(".omnibus-price-value") ?? null, l =
|
|
187
|
-
b(
|
|
192
|
+
const c = s.querySelector(".omnibus-price-value") ?? null, l = q(n, "original_price");
|
|
193
|
+
b(e, c, l) && (u = !0);
|
|
188
194
|
}
|
|
189
195
|
if (i && "querySelector" in i) {
|
|
190
|
-
const c = i.querySelector(".omnibus-discount-value") ?? null, l =
|
|
191
|
-
b(
|
|
196
|
+
const c = i.querySelector(".omnibus-discount-value") ?? null, l = ne(n);
|
|
197
|
+
b(e, c, l) && (u = !0);
|
|
192
198
|
}
|
|
193
199
|
return u;
|
|
194
200
|
}
|
|
195
|
-
function
|
|
201
|
+
function oe(t) {
|
|
196
202
|
const {
|
|
197
|
-
documentModifier:
|
|
203
|
+
documentModifier: e,
|
|
198
204
|
product: n,
|
|
199
205
|
imageEl: o,
|
|
200
206
|
nameEl: r,
|
|
@@ -203,20 +209,20 @@ function ee(e) {
|
|
|
203
209
|
omnibusPriceEl: u,
|
|
204
210
|
omnibusDiscountEl: c,
|
|
205
211
|
buttonEl: l
|
|
206
|
-
} =
|
|
212
|
+
} = t;
|
|
207
213
|
let a = !1;
|
|
208
214
|
if (o && "querySelector" in o) {
|
|
209
215
|
const d = o.querySelector("img");
|
|
210
|
-
d && (
|
|
216
|
+
d && (e.modifyHtml(d).setAttribute("src", W(n.image_url)).setAttribute("alt", n.name), a = !0);
|
|
211
217
|
const f = o.querySelector("a");
|
|
212
|
-
f && (
|
|
218
|
+
f && (e.modifyHtml(f).setAttribute("href", n.url), a = !0);
|
|
213
219
|
}
|
|
214
220
|
if (r && "querySelector" in r) {
|
|
215
221
|
const d = r.querySelector("strong") ?? r.querySelector("p");
|
|
216
|
-
b(
|
|
222
|
+
b(e, d ?? null, n.name) && (a = !0);
|
|
217
223
|
}
|
|
218
224
|
if (v({
|
|
219
|
-
documentModifier:
|
|
225
|
+
documentModifier: e,
|
|
220
226
|
product: n,
|
|
221
227
|
priceEl: s,
|
|
222
228
|
oldPriceEl: i,
|
|
@@ -224,27 +230,27 @@ function ee(e) {
|
|
|
224
230
|
omnibusDiscountEl: c
|
|
225
231
|
}) && (a = !0), l && "querySelector" in l) {
|
|
226
232
|
const d = l.querySelector("a.es-button") || l.querySelector("a");
|
|
227
|
-
d && (
|
|
233
|
+
d && (e.modifyHtml(d).setAttribute("href", n.url), a = !0);
|
|
228
234
|
}
|
|
229
235
|
return a;
|
|
230
236
|
}
|
|
231
|
-
function j(
|
|
232
|
-
return "querySelector" in
|
|
237
|
+
function j(t) {
|
|
238
|
+
return "querySelector" in t ? t.querySelector(N) ?? t : t;
|
|
233
239
|
}
|
|
234
|
-
function
|
|
240
|
+
function re(t, e) {
|
|
235
241
|
var o;
|
|
236
242
|
let n;
|
|
237
|
-
if (
|
|
238
|
-
const r =
|
|
239
|
-
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];
|
|
240
246
|
} else
|
|
241
|
-
n = t
|
|
242
|
-
return
|
|
247
|
+
n = e[t];
|
|
248
|
+
return X(n) || null;
|
|
243
249
|
}
|
|
244
|
-
function
|
|
245
|
-
if (!("querySelectorAll" in
|
|
250
|
+
function ie(t, e, n) {
|
|
251
|
+
if (!("querySelectorAll" in t))
|
|
246
252
|
return !1;
|
|
247
|
-
const o =
|
|
253
|
+
const o = t.querySelectorAll(
|
|
248
254
|
`[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
|
|
249
255
|
);
|
|
250
256
|
if (o.length === 0)
|
|
@@ -253,7 +259,7 @@ function ne(e, t, n) {
|
|
|
253
259
|
o.forEach((i) => {
|
|
254
260
|
if (!("getAttribute" in i))
|
|
255
261
|
return;
|
|
256
|
-
const u = i.getAttribute(
|
|
262
|
+
const u = i.getAttribute(K);
|
|
257
263
|
if (!u)
|
|
258
264
|
return;
|
|
259
265
|
const c = r.get(u) ?? [];
|
|
@@ -265,36 +271,36 @@ function ne(e, t, n) {
|
|
|
265
271
|
i.slice(0, c).forEach((l, a) => {
|
|
266
272
|
if (!("querySelector" in l))
|
|
267
273
|
return;
|
|
268
|
-
const d =
|
|
274
|
+
const d = re(u, n[a]);
|
|
269
275
|
if (d === null)
|
|
270
276
|
return;
|
|
271
277
|
const f = l.querySelector("p") ?? null;
|
|
272
|
-
b(
|
|
278
|
+
b(e, f, d) && (s = !0);
|
|
273
279
|
});
|
|
274
280
|
}), s;
|
|
275
281
|
}
|
|
276
|
-
function
|
|
277
|
-
if (!("querySelectorAll" in
|
|
282
|
+
function I(t, e, n) {
|
|
283
|
+
if (!("querySelectorAll" in t))
|
|
278
284
|
return !1;
|
|
279
|
-
const o =
|
|
285
|
+
const o = t.querySelectorAll(
|
|
280
286
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
281
|
-
), r =
|
|
287
|
+
), r = t.querySelectorAll(
|
|
282
288
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
283
|
-
), s =
|
|
289
|
+
), s = t.querySelectorAll(
|
|
284
290
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
285
|
-
), i =
|
|
291
|
+
), i = t.querySelectorAll(
|
|
286
292
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
287
|
-
), u =
|
|
293
|
+
), u = t.querySelectorAll(
|
|
288
294
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
289
|
-
), c =
|
|
295
|
+
), c = t.querySelectorAll(
|
|
290
296
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
291
|
-
), l =
|
|
297
|
+
), l = t.querySelectorAll(
|
|
292
298
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
293
299
|
), a = Math.min(o.length, n.length);
|
|
294
300
|
let d = !1;
|
|
295
301
|
for (let f = 0; f < a; f++) {
|
|
296
|
-
const
|
|
297
|
-
documentModifier:
|
|
302
|
+
const p = oe({
|
|
303
|
+
documentModifier: e,
|
|
298
304
|
product: n[f],
|
|
299
305
|
imageEl: o[f] ?? null,
|
|
300
306
|
nameEl: r[f] ?? null,
|
|
@@ -304,25 +310,25 @@ function h(e, t, n) {
|
|
|
304
310
|
omnibusDiscountEl: c[f] ?? null,
|
|
305
311
|
buttonEl: l[f] ?? null
|
|
306
312
|
});
|
|
307
|
-
d = d ||
|
|
313
|
+
d = d || p;
|
|
308
314
|
}
|
|
309
|
-
return
|
|
315
|
+
return ie(t, e, n) && (d = !0), d;
|
|
310
316
|
}
|
|
311
|
-
function
|
|
312
|
-
const { currentNode:
|
|
313
|
-
if (!
|
|
317
|
+
function Se(t) {
|
|
318
|
+
const { currentNode: e, documentModifier: n, products: o } = t;
|
|
319
|
+
if (!e || !("querySelectorAll" in e))
|
|
314
320
|
return !1;
|
|
315
|
-
const r = j(
|
|
321
|
+
const r = j(e);
|
|
316
322
|
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
317
323
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
318
324
|
).length !== o.length)
|
|
319
325
|
return !1;
|
|
320
|
-
let i =
|
|
321
|
-
const u = C(
|
|
322
|
-
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in
|
|
323
|
-
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);
|
|
324
330
|
if (l) {
|
|
325
|
-
const a =
|
|
331
|
+
const a = I(
|
|
326
332
|
l,
|
|
327
333
|
n,
|
|
328
334
|
o
|
|
@@ -332,22 +338,22 @@ function pe(e) {
|
|
|
332
338
|
}
|
|
333
339
|
return i && n.apply(new g("Updated product content in-place")), !0;
|
|
334
340
|
}
|
|
335
|
-
function
|
|
336
|
-
if (!("querySelectorAll" in
|
|
341
|
+
function h(t, e, n) {
|
|
342
|
+
if (!("querySelectorAll" in t))
|
|
337
343
|
return !1;
|
|
338
|
-
const o =
|
|
344
|
+
const o = t.querySelectorAll(
|
|
339
345
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
340
|
-
), r =
|
|
346
|
+
), r = t.querySelectorAll(
|
|
341
347
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
342
|
-
), s =
|
|
348
|
+
), s = t.querySelectorAll(
|
|
343
349
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
344
|
-
), i =
|
|
350
|
+
), i = t.querySelectorAll(
|
|
345
351
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
346
352
|
), u = Math.min(o.length, n.length);
|
|
347
353
|
let c = !1;
|
|
348
354
|
for (let l = 0; l < u; l++)
|
|
349
355
|
v({
|
|
350
|
-
documentModifier:
|
|
356
|
+
documentModifier: e,
|
|
351
357
|
product: n[l],
|
|
352
358
|
priceEl: o[l] ?? null,
|
|
353
359
|
oldPriceEl: r[l] ?? null,
|
|
@@ -356,44 +362,47 @@ function I(e, t, n) {
|
|
|
356
362
|
}) && (c = !0);
|
|
357
363
|
return c;
|
|
358
364
|
}
|
|
359
|
-
function
|
|
360
|
-
const { currentNode:
|
|
361
|
-
if (!
|
|
365
|
+
function Ee(t) {
|
|
366
|
+
const { currentNode: e, documentModifier: n } = t;
|
|
367
|
+
if (!e || !("querySelectorAll" in e))
|
|
362
368
|
return !1;
|
|
369
|
+
if (z(e))
|
|
370
|
+
return !0;
|
|
363
371
|
const r = P().recommendationProducts;
|
|
364
372
|
if (r.length === 0)
|
|
365
373
|
return !1;
|
|
366
|
-
const s = j(
|
|
367
|
-
let i =
|
|
368
|
-
const u = C(
|
|
369
|
-
if (u !== "list" && c.mobileLayoutEnabled && "querySelector" in
|
|
370
|
-
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);
|
|
371
379
|
if (l) {
|
|
372
|
-
const a =
|
|
380
|
+
const a = h(l, n, r);
|
|
373
381
|
i = i || a;
|
|
374
382
|
}
|
|
375
383
|
}
|
|
376
384
|
return i && n.apply(new g("Updated price formatting in-place")), i;
|
|
377
385
|
}
|
|
378
|
-
function
|
|
379
|
-
const { currentNode:
|
|
386
|
+
function Pe(t) {
|
|
387
|
+
const { currentNode: e, documentModifier: n, currency: o } = t, r = A(e);
|
|
380
388
|
if (!r)
|
|
381
389
|
return;
|
|
382
390
|
const s = o.alignment === "before" ? "0" : "1", i = (u, c) => {
|
|
383
391
|
n.modifyHtml(r).setAttribute(u, c);
|
|
384
392
|
};
|
|
385
|
-
i(
|
|
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"));
|
|
386
394
|
}
|
|
387
395
|
export {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
396
|
+
ge as adjustProductsToSize,
|
|
397
|
+
q as formatProductPrice,
|
|
398
|
+
A as getBlockElement,
|
|
391
399
|
x as getCardComposition,
|
|
392
400
|
C as getCurrentLayout,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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
|
|
399
408
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var a = (o, e, t) =>
|
|
4
|
-
import { UIElementType as c, UEAttr as
|
|
2
|
+
var p = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var a = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UIElementType as c, UEAttr as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as d } from "../../common-control.js";
|
|
6
6
|
import { RecommendationControlId as C } from "../constants/controlIds.js";
|
|
7
|
+
import "../constants/selectors.js";
|
|
7
8
|
const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
|
|
8
|
-
class
|
|
9
|
+
class O extends d {
|
|
9
10
|
constructor() {
|
|
10
11
|
super(...arguments);
|
|
11
12
|
a(this, "_repositionedElement", null);
|
|
@@ -17,7 +18,7 @@ class h extends d {
|
|
|
17
18
|
return `
|
|
18
19
|
<div class="${r}">
|
|
19
20
|
<${c.ICON}
|
|
20
|
-
${
|
|
21
|
+
${_.ICON.src}="migration-info-icon"
|
|
21
22
|
class="${r}__icon">
|
|
22
23
|
</${c.ICON}>
|
|
23
24
|
<p class="${r}__text">
|
|
@@ -61,5 +62,5 @@ class h extends d {
|
|
|
61
62
|
}
|
|
62
63
|
export {
|
|
63
64
|
S as SYNC_INFO_MESSAGE_CONTROL_ID,
|
|
64
|
-
|
|
65
|
+
O as SyncInfoMessageControl
|
|
65
66
|
};
|