@useinsider/guido 3.20.0-beta.e801a3b → 3.20.1-beta.04cd240
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/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +11 -10
- package/dist/composables/useVersionHistoryApi.js +42 -37
- package/dist/config/compiler/itemsCompilerRules.js +21 -5
- package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
- package/dist/config/migrator/itemsBlockMigrator.js +112 -108
- package/dist/extensions/Blocks/Items/block.js +76 -64
- package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +60 -49
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +152 -150
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +102 -78
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +313 -210
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +17 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +92 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +219 -193
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +12 -9
- package/dist/extensions/Blocks/Recommendation/extension.js +4 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +240 -190
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
- package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/followUpApply.js +34 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +73 -28
- package/dist/extensions/Blocks/Recommendation/utils/restoreRefresh.js +36 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +39 -20
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
- package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +22 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +1 -18
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +10 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +28 -6
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/followUpApply.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +15 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/restoreRefresh.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/src/stores/editor.d.ts +3 -1
- package/dist/src/utils/liquidProtection.d.ts +3 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/editor.js +5 -0
- package/dist/utils/liquidProtection.js +5 -0
- package/dist/utils/templatePreparation.js +61 -85
- package/package.json +3 -3
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ACADEMY_LINKS as
|
|
5
|
-
import { UIElementType as f, UEAttr as
|
|
6
|
-
import { CommonControl as
|
|
7
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
8
|
-
import { DEFAULT_COMPOSITION as
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { ATTRIBUTE_CELL_CLASS as
|
|
12
|
-
import { listElementRenderer as
|
|
13
|
-
import { buildTitleRows as
|
|
14
|
-
import { resolveInlinePriceOrder as
|
|
15
|
-
import { normalizeCompositionKeys as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
1
|
+
var ct = Object.defineProperty;
|
|
2
|
+
var dt = (_, g, t) => g in _ ? ct(_, g, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[g] = t;
|
|
3
|
+
var $ = (_, g, t) => dt(_, typeof g != "symbol" ? g + "" : g, t);
|
|
4
|
+
import { ACADEMY_LINKS as ut } from "../../../../../enums/academy.js";
|
|
5
|
+
import { UIElementType as f, UEAttr as L, ModificationDescription as k } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as mt } from "../../../common-control.js";
|
|
7
|
+
import { ATTR_PRODUCT_IMAGE as F, ATTR_PRODUCT_NAME as ht, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as A, ATTR_PRODUCT_OMNIBUS_PRICE as pt, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _t, ATTR_PRODUCT_BUTTON as x, ATTR_RECOMMENDATION_TITLE as I, ATTR_DATA_CARD_COMPOSITION as W, ATTR_DATA_CUSTOM_ATTRIBUTES as z, ATTR_CUSTOM_PREFIX as v, SELECTOR_ATTRIBUTE_ROW as N, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as O, ATTR_DATA_ATTRIBUTE_TYPE as E, CSS_CLASS_ATTRIBUTE_ROW as Y, CSS_CLASS_SPACER as gt, BUILT_IN_DEFAULT_ATTRIBUTES as ft } from "../../constants/selectors.js";
|
|
8
|
+
import { DEFAULT_COMPOSITION as X, DEFAULT_VISIBILITY as J } from "../../constants/defaultConfig.js";
|
|
9
|
+
import { RecommendationConfigService as y } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as bt } from "../../store/recommendation.js";
|
|
11
|
+
import { ATTRIBUTE_CELL_CLASS as yt, gridElementRenderer as Tt, DEFAULT_CELL_PADDING as Ct, buildFillerCell as St } from "../../templates/grid/elementRenderer.js";
|
|
12
|
+
import { listElementRenderer as At } from "../../templates/list/elementRenderer.js";
|
|
13
|
+
import { buildTitleRows as It, DEFAULT_TITLE_PARAGRAPH as $t, DEFAULT_TITLE_TEXT as vt } from "../../templates/titleRows.js";
|
|
14
|
+
import { resolveInlinePriceOrder as Nt, toDisplayName as Et, toDisplayableAttributeValue as Rt, buildElementRenderer as Q } from "../../templates/utils.js";
|
|
15
|
+
import { normalizeCompositionKeys as Lt, normalizeCustomAttrValues as Ot, compositionKeyToProductAttr as M, resolveRowVisibilityKeys as Dt, filterToProductAttrValue as T, findAttributeRow as Ht, rewriteLegacyRowKeyHtml as Z, bareAttributeName as D, isDefaultProductAttr as Pt, productAttrToCompositionKey as U } from "../../utils/compositionKeys.js";
|
|
16
|
+
import { applyFollowUp as H } from "../../utils/followUpApply.js";
|
|
17
|
+
import { getTableDisplayValue as wt } from "../../utils/tagName.js";
|
|
18
|
+
import { isPartnerManagedBlock as Bt, regenerateProductRowsWithStyles as kt, getMainContainerTbody as Mt, getCurrentLayout as Ut } from "../main/utils.js";
|
|
19
|
+
const qt = "ui-elements-recommendation-card-composition", q = ".product-card-wrapper > tbody", tt = ".product-info-cell > table > tbody", et = {
|
|
19
20
|
ADD_ATTRIBUTE: "addAttribute"
|
|
20
|
-
}, b = 5, P = "reorderIcon_",
|
|
21
|
-
{ key:
|
|
22
|
-
{ key:
|
|
21
|
+
}, b = 5, P = "reorderIcon_", Ft = '<svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2.5" r="1.2"/><circle cx="7" cy="2.5" r="1.2"/><circle cx="12" cy="2.5" r="1.2"/><circle cx="2" cy="7.5" r="1.2"/><circle cx="7" cy="7.5" r="1.2"/><circle cx="12" cy="7.5" r="1.2"/></svg>', m = [
|
|
22
|
+
{ key: F, label: "Product Image" },
|
|
23
|
+
{ key: ht, label: "Product Name" },
|
|
23
24
|
{ key: p, label: "Product Price" },
|
|
24
|
-
{ key:
|
|
25
|
-
{ key:
|
|
26
|
-
{ key:
|
|
27
|
-
{ key:
|
|
28
|
-
],
|
|
29
|
-
class
|
|
25
|
+
{ key: A, label: "Product Original Price" },
|
|
26
|
+
{ key: pt, label: "Omnibus Price" },
|
|
27
|
+
{ key: _t, label: "Omnibus Discount" },
|
|
28
|
+
{ key: x, label: "Product Button" }
|
|
29
|
+
], R = { key: I, label: "Title" }, xt = new Set(m.map((_) => _.key)), S = "customAttr_", w = "deleteAttr_";
|
|
30
|
+
class ne extends mt {
|
|
30
31
|
constructor() {
|
|
31
32
|
super(...arguments);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
$(this, "store", bt());
|
|
34
|
+
$(this, "unsubscribeStore", null);
|
|
35
|
+
$(this, "eventController", null);
|
|
35
36
|
/**
|
|
36
37
|
* Guard flag: when true, onTemplateNodeUpdated skips _initializeComposition.
|
|
37
38
|
* Used during _onReorder to prevent multiple intermediate rebuilds.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
$(this, "reorderInProgress", !1);
|
|
40
41
|
}
|
|
41
42
|
getId() {
|
|
42
|
-
return
|
|
43
|
+
return qt;
|
|
43
44
|
}
|
|
44
45
|
// ========================================================================
|
|
45
46
|
// Lifecycle
|
|
@@ -52,9 +53,9 @@ class se extends ut {
|
|
|
52
53
|
`).join(""), e = Array.from(
|
|
53
54
|
{ length: b },
|
|
54
55
|
(d, c) => `
|
|
55
|
-
<div data-custom-select-key="${
|
|
56
|
+
<div data-custom-select-key="${S}${c}" style="display: none;">
|
|
56
57
|
${this._GuSelect({
|
|
57
|
-
name: `${
|
|
58
|
+
name: `${S}${c}`,
|
|
58
59
|
placeholder: this.api.translate("Select Attribute"),
|
|
59
60
|
options: [],
|
|
60
61
|
// A partner's attribute list runs long; search beats scrolling.
|
|
@@ -68,7 +69,7 @@ class se extends ut {
|
|
|
68
69
|
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
69
70
|
<${f.BUTTON}
|
|
70
71
|
class="guido-drag-handle-btn flat-inline flat-white"
|
|
71
|
-
${
|
|
72
|
+
${L.BUTTON.name}="${P}${c}"
|
|
72
73
|
>
|
|
73
74
|
<${f.ICON}
|
|
74
75
|
src="reorder"
|
|
@@ -83,7 +84,7 @@ class se extends ut {
|
|
|
83
84
|
<div data-custom-delete-key="${w}${c}" style="display: none;">
|
|
84
85
|
<${f.BUTTON}
|
|
85
86
|
class="custom-attr-delete flat-inline flat-white"
|
|
86
|
-
${
|
|
87
|
+
${L.BUTTON.name}="${w}${c}"
|
|
87
88
|
>
|
|
88
89
|
<${f.ICON}
|
|
89
90
|
src="delete"
|
|
@@ -92,7 +93,7 @@ class se extends ut {
|
|
|
92
93
|
</${f.BUTTON}>
|
|
93
94
|
</div>
|
|
94
95
|
`
|
|
95
|
-
).join(""), o =
|
|
96
|
+
).join(""), o = ut.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
|
|
96
97
|
"Drag and drop the card elements to reorder them, adjust their visibility or add new attributes up to 5."
|
|
97
98
|
), l = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
|
|
98
99
|
return `
|
|
@@ -123,10 +124,10 @@ class se extends ut {
|
|
|
123
124
|
</div>
|
|
124
125
|
|
|
125
126
|
<div class="orderable-list">
|
|
126
|
-
<div class="orderable-item title-item" data-key="${
|
|
127
|
-
<span class="item-label">${this.api.translate(
|
|
127
|
+
<div class="orderable-item title-item" data-key="${R.key}">
|
|
128
|
+
<span class="item-label">${this.api.translate(R.label)}</span>
|
|
128
129
|
<div class="item-action">
|
|
129
|
-
${this._GuToggle(`visibility_${
|
|
130
|
+
${this._GuToggle(`visibility_${R.key}`)}
|
|
130
131
|
</div>
|
|
131
132
|
</div>
|
|
132
133
|
</div>
|
|
@@ -134,7 +135,7 @@ class se extends ut {
|
|
|
134
135
|
<div class="orderable-list" data-composition-list></div>
|
|
135
136
|
|
|
136
137
|
${this._GuButton({
|
|
137
|
-
name:
|
|
138
|
+
name: et.ADD_ATTRIBUTE,
|
|
138
139
|
label: this.api.translate("Add Attribute"),
|
|
139
140
|
id: "guido__btn-add-attribute"
|
|
140
141
|
})}
|
|
@@ -155,7 +156,7 @@ class se extends ut {
|
|
|
155
156
|
const t = (r = this.getContainer()) == null ? void 0 : r.querySelector("[data-card-composition-control]");
|
|
156
157
|
if (!t)
|
|
157
158
|
return;
|
|
158
|
-
const e =
|
|
159
|
+
const e = Bt(this.currentNode);
|
|
159
160
|
t.style.pointerEvents = e ? "none" : "", t.style.opacity = e ? "0.5" : "";
|
|
160
161
|
}
|
|
161
162
|
onTemplateNodeUpdated(t) {
|
|
@@ -172,13 +173,13 @@ class se extends ut {
|
|
|
172
173
|
this.api.updateValues(s), i && this._initializeCustomSelects(e), this._updateAddButtonState();
|
|
173
174
|
}
|
|
174
175
|
_registerValueChangeListeners() {
|
|
175
|
-
[
|
|
176
|
+
[R, ...m].forEach((t) => {
|
|
176
177
|
this.api.onValueChanged(`visibility_${t.key}`, (e) => {
|
|
177
178
|
this._applyVisibilityToBlock(t.key, e);
|
|
178
179
|
});
|
|
179
180
|
});
|
|
180
181
|
for (let t = 0; t < b; t++) {
|
|
181
|
-
const e = `${
|
|
182
|
+
const e = `${S}${t}`, r = t;
|
|
182
183
|
this.api.onValueChanged(e, (i) => {
|
|
183
184
|
this._onCustomAttributeChanged(r, i);
|
|
184
185
|
});
|
|
@@ -189,24 +190,24 @@ class se extends ut {
|
|
|
189
190
|
// ========================================================================
|
|
190
191
|
_readCompositionFromNode() {
|
|
191
192
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
192
|
-
return [...
|
|
193
|
-
const t = this.currentNode.getAttribute(
|
|
193
|
+
return [...X];
|
|
194
|
+
const t = this.currentNode.getAttribute(W);
|
|
194
195
|
if (t)
|
|
195
196
|
return this._normalizeComposition(t.split(",").filter(Boolean));
|
|
196
|
-
const { composition: e } =
|
|
197
|
-
return e != null && e.length ? this._normalizeComposition([...e]) : [...
|
|
197
|
+
const { composition: e } = y.getConfig(this.currentNode);
|
|
198
|
+
return e != null && e.length ? this._normalizeComposition([...e]) : [...X];
|
|
198
199
|
}
|
|
199
200
|
/** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
|
|
200
201
|
_normalizeComposition(t) {
|
|
201
|
-
return
|
|
202
|
+
return Lt(t, this.currentNode, this.store.filterList);
|
|
202
203
|
}
|
|
203
204
|
_readCustomAttributesFromNode() {
|
|
204
205
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
205
206
|
return [];
|
|
206
|
-
const t = this.currentNode.getAttribute(
|
|
207
|
+
const t = this.currentNode.getAttribute(z);
|
|
207
208
|
if (t)
|
|
208
209
|
try {
|
|
209
|
-
return
|
|
210
|
+
return Ot(
|
|
210
211
|
JSON.parse(t).map((e) => String(e)),
|
|
211
212
|
this.currentNode,
|
|
212
213
|
this.store.filterList
|
|
@@ -214,34 +215,34 @@ class se extends ut {
|
|
|
214
215
|
} catch {
|
|
215
216
|
return [];
|
|
216
217
|
}
|
|
217
|
-
return this._readCompositionFromNode().filter((e) => e.startsWith(
|
|
218
|
+
return this._readCompositionFromNode().filter((e) => e.startsWith(v)).map(M);
|
|
218
219
|
}
|
|
219
220
|
_readVisibilityFromRows() {
|
|
220
221
|
if (!this.currentNode)
|
|
221
222
|
return this._getDefaultVisibilities();
|
|
222
|
-
const t = Array.from(this.currentNode.querySelectorAll(
|
|
223
|
+
const t = Array.from(this.currentNode.querySelectorAll(N)), e = this._extractVisibilityFromRows(t);
|
|
223
224
|
if (Object.keys(e).length > 0)
|
|
224
225
|
return this._withTitlePresence(this._mergeWithDefaults(e));
|
|
225
|
-
const r =
|
|
226
|
+
const r = y.getConfig(this.currentNode).visibility;
|
|
226
227
|
return this._withTitlePresence(this._mergeWithDefaults({ ...r }));
|
|
227
228
|
}
|
|
228
229
|
_withTitlePresence(t) {
|
|
229
|
-
return t[
|
|
230
|
+
return t[I] = this._hasTitle(), t;
|
|
230
231
|
}
|
|
231
232
|
_hasTitle() {
|
|
232
233
|
var t;
|
|
233
|
-
return !!((t = this.currentNode) != null && t.querySelector(
|
|
234
|
+
return !!((t = this.currentNode) != null && t.querySelector(G));
|
|
234
235
|
}
|
|
235
236
|
_getDefaultVisibilities() {
|
|
236
|
-
return { ...
|
|
237
|
+
return { ...J };
|
|
237
238
|
}
|
|
238
239
|
_extractVisibilityFromRows(t) {
|
|
239
240
|
const e = {};
|
|
240
241
|
return t.forEach((r) => {
|
|
241
242
|
if (!("getAttribute" in r))
|
|
242
243
|
return;
|
|
243
|
-
const i = r.getAttribute(
|
|
244
|
-
i !== null &&
|
|
244
|
+
const i = r.getAttribute(O);
|
|
245
|
+
i !== null && Dt(r).forEach((s) => {
|
|
245
246
|
e[s] = this._parseVisibilityValue(i);
|
|
246
247
|
});
|
|
247
248
|
}), e;
|
|
@@ -250,12 +251,12 @@ class se extends ut {
|
|
|
250
251
|
return t === "1" || t === "true";
|
|
251
252
|
}
|
|
252
253
|
_mergeWithDefaults(t) {
|
|
253
|
-
return Object.entries(
|
|
254
|
+
return Object.entries(J).forEach(([e, r]) => {
|
|
254
255
|
e in t || (t[e] = r);
|
|
255
256
|
}), t;
|
|
256
257
|
}
|
|
257
258
|
_buildVisibilityValues(t) {
|
|
258
|
-
return [
|
|
259
|
+
return [R, ...m].reduce((e, r) => (e[`visibility_${r.key}`] = t[r.key] ?? !0, e), {});
|
|
259
260
|
}
|
|
260
261
|
// ========================================================================
|
|
261
262
|
// UI Rendering (Orderable List)
|
|
@@ -276,17 +277,17 @@ class se extends ut {
|
|
|
276
277
|
if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
|
|
277
278
|
return !1;
|
|
278
279
|
i.dataset.inlinePrices = String(s);
|
|
279
|
-
const n = new Set(e), l =
|
|
280
|
+
const n = new Set(e), l = Nt(t);
|
|
280
281
|
let a = 0, d = 0;
|
|
281
282
|
const c = t.map((u) => {
|
|
282
|
-
if (s && (u === p || u ===
|
|
283
|
+
if (s && (u === p || u === A))
|
|
283
284
|
return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
|
|
284
|
-
if (
|
|
285
|
-
const h = m.find((
|
|
285
|
+
if (xt.has(u)) {
|
|
286
|
+
const h = m.find((C) => C.key === u);
|
|
286
287
|
return this._createBuiltInItemHtml(h, d++);
|
|
287
288
|
}
|
|
288
|
-
if (u.startsWith(
|
|
289
|
-
const h =
|
|
289
|
+
if (u.startsWith(v)) {
|
|
290
|
+
const h = M(u);
|
|
290
291
|
if (n.has(h))
|
|
291
292
|
return this._createCustomItemHtml(u, a++, d++);
|
|
292
293
|
}
|
|
@@ -308,7 +309,7 @@ class se extends ut {
|
|
|
308
309
|
if (i.length !== e.length)
|
|
309
310
|
return !1;
|
|
310
311
|
const s = [...i].sort().join(","), o = [...e].sort().join(",");
|
|
311
|
-
if (s !== o || e.some((a) => a.startsWith(
|
|
312
|
+
if (s !== o || e.some((a) => a.startsWith(v)))
|
|
312
313
|
return !1;
|
|
313
314
|
const n = /* @__PURE__ */ new Map();
|
|
314
315
|
r.forEach((a) => {
|
|
@@ -346,11 +347,11 @@ class se extends ut {
|
|
|
346
347
|
*/
|
|
347
348
|
_createPriceGroupItemHtml(t, e) {
|
|
348
349
|
var n, l;
|
|
349
|
-
const r = ((n = m.find((a) => a.key === p)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key ===
|
|
350
|
+
const r = ((n = m.find((a) => a.key === p)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === A)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
|
|
350
351
|
<div class="price-suborderable-item" draggable="true" data-subkey="${a}">
|
|
351
|
-
<span class="sub-drag-handle">${
|
|
352
|
+
<span class="sub-drag-handle">${Ft}</span>
|
|
352
353
|
<span class="item-label">${this.api.translate(d)}</span>
|
|
353
|
-
</div>`, o = e ? s(
|
|
354
|
+
</div>`, o = e ? s(A, i) + s(p, r) : s(p, r) + s(A, i);
|
|
354
355
|
return `
|
|
355
356
|
<div class="orderable-item price-group-item" draggable="true"
|
|
356
357
|
data-key="${p}" data-group="prices">
|
|
@@ -397,13 +398,13 @@ class se extends ut {
|
|
|
397
398
|
const i = /* @__PURE__ */ new Map();
|
|
398
399
|
r.forEach((o) => i.set(o.attributeName, (i.get(o.attributeName) ?? 0) + 1));
|
|
399
400
|
const s = new Set(e);
|
|
400
|
-
return s.delete(t), r.filter((o) => !s.has(
|
|
401
|
+
return s.delete(t), r.filter((o) => !s.has(T(o))).map((o) => ({
|
|
401
402
|
text: this._toOptionLabel(
|
|
402
403
|
o.displayName,
|
|
403
404
|
o.type === "defaultAttribute",
|
|
404
405
|
(i.get(o.attributeName) ?? 0) > 1
|
|
405
406
|
),
|
|
406
|
-
value:
|
|
407
|
+
value: T(o)
|
|
407
408
|
}));
|
|
408
409
|
}
|
|
409
410
|
/**
|
|
@@ -414,8 +415,8 @@ class se extends ut {
|
|
|
414
415
|
_initializeCustomSelects(t) {
|
|
415
416
|
t.length !== 0 && setTimeout(() => {
|
|
416
417
|
t.forEach((e, r) => {
|
|
417
|
-
const i = `${
|
|
418
|
-
this.api.setUIEAttribute(i,
|
|
418
|
+
const i = `${S}${r}`, s = this._getSelectOptions(e, t);
|
|
419
|
+
this.api.setUIEAttribute(i, L.SELECTPICKER.items, s), this.api.updateValues({ [i]: e });
|
|
419
420
|
});
|
|
420
421
|
}, 0);
|
|
421
422
|
}
|
|
@@ -438,7 +439,7 @@ class se extends ut {
|
|
|
438
439
|
*/
|
|
439
440
|
_moveSelectsIntoItems(t, e) {
|
|
440
441
|
for (let r = 0; r < e; r++) {
|
|
441
|
-
const i = `${
|
|
442
|
+
const i = `${S}${r}`, s = t.querySelector(`[data-custom-select-key="${i}"]`), o = t.querySelector(`[data-custom-select-slot="${r}"]`);
|
|
442
443
|
if (s && o) {
|
|
443
444
|
const n = s.querySelector("ue-select");
|
|
444
445
|
n && o.appendChild(n);
|
|
@@ -466,7 +467,7 @@ class se extends ut {
|
|
|
466
467
|
*/
|
|
467
468
|
_rescueSelectsToStore(t) {
|
|
468
469
|
for (let e = 0; e < b; e++) {
|
|
469
|
-
const r = `${
|
|
470
|
+
const r = `${S}${e}`, i = t.querySelector(`[data-custom-select-key="${r}"]`), s = t.querySelector(`[data-custom-select-slot="${e}"]`);
|
|
470
471
|
if (s) {
|
|
471
472
|
const o = s.querySelector("ue-select");
|
|
472
473
|
o && i && i.appendChild(o);
|
|
@@ -536,8 +537,8 @@ class se extends ut {
|
|
|
536
537
|
return;
|
|
537
538
|
const r = e.querySelector("[data-composition-list]"), i = e.querySelector("#guido__btn-add-attribute");
|
|
538
539
|
r && (this._setupDragAndDrop(r, t), this._setupDeleteHandler(r, t)), i && i.addEventListener("click", () => {
|
|
539
|
-
const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(
|
|
540
|
-
o && this._onAddAttribute(
|
|
540
|
+
const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(T(n)));
|
|
541
|
+
o && this._onAddAttribute(T(o), o.displayName);
|
|
541
542
|
}, { signal: t });
|
|
542
543
|
}
|
|
543
544
|
/**
|
|
@@ -618,7 +619,7 @@ class se extends ut {
|
|
|
618
619
|
// Actions (Add, Delete, Reorder)
|
|
619
620
|
// ========================================================================
|
|
620
621
|
_onAddAttribute(t, e) {
|
|
621
|
-
const r =
|
|
622
|
+
const r = U(t), i = this._readCompositionFromNode();
|
|
622
623
|
i.push(r);
|
|
623
624
|
const s = [...this._readCustomAttributesFromNode(), t];
|
|
624
625
|
this._updateBothAttributes(i, s), this._injectCustomAttributeHtml(t, e, r, i), this._renderOrderableItems(i, s), this._initializeCustomSelects(s), this._updateAddButtonState();
|
|
@@ -642,20 +643,21 @@ class se extends ut {
|
|
|
642
643
|
const r = this._readCustomAttributesFromNode(), i = r[t];
|
|
643
644
|
if (i === void 0 || i === e)
|
|
644
645
|
return;
|
|
645
|
-
const s =
|
|
646
|
+
const s = U(e), o = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(o, t);
|
|
646
647
|
n !== -1 && (o[n] = s), r[t] = e;
|
|
647
648
|
const l = this._getDisplayNameForAttribute(e);
|
|
648
649
|
this._updateBothAttributes(o, r), this._injectCustomAttributeHtml(e, l, s, o), this._renderOrderableItems(o, r), this._initializeCustomSelects(r);
|
|
649
650
|
}
|
|
650
651
|
_onReorder(t) {
|
|
651
|
-
const e = t.filter((r) => r.startsWith(
|
|
652
|
+
const e = t.filter((r) => r.startsWith(v)).map(M);
|
|
652
653
|
this.reorderInProgress = !0;
|
|
653
654
|
try {
|
|
654
655
|
this._updateBothAttributes(t, e);
|
|
655
656
|
const r = this._isInlinePrices();
|
|
656
|
-
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode &&
|
|
657
|
+
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && kt({
|
|
657
658
|
currentNode: this.currentNode,
|
|
658
|
-
documentModifier: this.api.getDocumentModifier()
|
|
659
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
660
|
+
hidden: !0
|
|
659
661
|
});
|
|
660
662
|
} finally {
|
|
661
663
|
this.reorderInProgress = !1;
|
|
@@ -671,13 +673,13 @@ class se extends ut {
|
|
|
671
673
|
* DOM converge on the next composition change without writing on open.
|
|
672
674
|
*/
|
|
673
675
|
_getExistingRowHtml(t, e) {
|
|
674
|
-
const r =
|
|
676
|
+
const r = Ht(t, e);
|
|
675
677
|
if (r && "getOuterHTML" in r)
|
|
676
|
-
return
|
|
678
|
+
return Z(r.getOuterHTML(), e);
|
|
677
679
|
const i = t.querySelector(
|
|
678
|
-
`${
|
|
680
|
+
`${N}[${E}="${e}"]`
|
|
679
681
|
);
|
|
680
|
-
return i && "getOuterHTML" in i ?
|
|
682
|
+
return i && "getOuterHTML" in i ? Z(i.getOuterHTML(), e) : "";
|
|
681
683
|
}
|
|
682
684
|
_injectCustomAttributeHtml(t, e, r, i) {
|
|
683
685
|
if (!this.currentNode)
|
|
@@ -685,45 +687,45 @@ class se extends ut {
|
|
|
685
687
|
this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, e, r, i) : this._injectListAttributeRow(t, e, r, i);
|
|
686
688
|
}
|
|
687
689
|
_injectGridAttributeRow(t, e, r, i) {
|
|
688
|
-
const s = this.currentNode.querySelectorAll(
|
|
690
|
+
const s = this.currentNode.querySelectorAll(q);
|
|
689
691
|
if (!(s != null && s.length))
|
|
690
692
|
return;
|
|
691
|
-
const o =
|
|
693
|
+
const o = y.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
|
|
692
694
|
let c = 0;
|
|
693
695
|
s.forEach((u) => {
|
|
694
|
-
var
|
|
695
|
-
const h = u.querySelector(
|
|
696
|
-
if (
|
|
697
|
-
const
|
|
696
|
+
var j;
|
|
697
|
+
const h = u.querySelector(N), C = ((j = h == null ? void 0 : h.querySelectorAll(`.${yt}`)) == null ? void 0 : j.length) || 1, V = (100 / C).toFixed(2), { bgStyle: rt, bgAttr: it } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(C, d - c) : C, st = i.map((K) => {
|
|
698
|
+
if (K === r) {
|
|
699
|
+
const ot = Array.from(
|
|
698
700
|
{ length: B },
|
|
699
|
-
(
|
|
700
|
-
const
|
|
701
|
+
(Vt, lt) => {
|
|
702
|
+
const at = this._resolveAttributeContent(
|
|
701
703
|
t,
|
|
702
704
|
e,
|
|
703
|
-
c +
|
|
705
|
+
c + lt
|
|
704
706
|
);
|
|
705
707
|
return this._getGridCellHtml(
|
|
706
708
|
t,
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
et,
|
|
709
|
+
at,
|
|
710
|
+
V,
|
|
710
711
|
rt,
|
|
712
|
+
it,
|
|
711
713
|
l
|
|
712
714
|
);
|
|
713
715
|
}
|
|
714
|
-
).join(""),
|
|
715
|
-
return `<tr class="${
|
|
716
|
+
).join(""), nt = St(V, l).repeat(C - B);
|
|
717
|
+
return `<tr class="${Y}" ${E}="${r}" ${O}="1">${ot}${nt}</tr>`;
|
|
716
718
|
}
|
|
717
|
-
return this._getExistingRowHtml(u,
|
|
719
|
+
return this._getExistingRowHtml(u, K);
|
|
718
720
|
}).join("");
|
|
719
|
-
c += B, d > 0 && c >= d && (c = 0), a.modifyHtml(u).setInnerHtml(
|
|
720
|
-
}), a
|
|
721
|
+
c += B, d > 0 && c >= d && (c = 0), a.modifyHtml(u).setInnerHtml(st);
|
|
722
|
+
}), H(a, `${this.api.translate("Add custom attribute")}: ${e}`, !0);
|
|
721
723
|
}
|
|
722
724
|
_injectListAttributeRow(t, e, r, i) {
|
|
723
|
-
const s = this.currentNode.querySelectorAll(
|
|
725
|
+
const s = this.currentNode.querySelectorAll(tt);
|
|
724
726
|
if (!(s != null && s.length))
|
|
725
727
|
return;
|
|
726
|
-
const o = i.filter((l) => l !==
|
|
728
|
+
const o = i.filter((l) => l !== F && l !== x), n = this.api.getDocumentModifier();
|
|
727
729
|
s.forEach((l, a) => {
|
|
728
730
|
const d = o.map((c) => {
|
|
729
731
|
if (c === r) {
|
|
@@ -733,7 +735,7 @@ class se extends ut {
|
|
|
733
735
|
return this._getExistingRowHtml(l, c);
|
|
734
736
|
}).join("");
|
|
735
737
|
n.modifyHtml(l).setInnerHtml(d);
|
|
736
|
-
}), n
|
|
738
|
+
}), H(n, `${this.api.translate("Add custom attribute")}: ${e}`, !0);
|
|
737
739
|
}
|
|
738
740
|
/**
|
|
739
741
|
* Removes a custom attribute by rebuilding product card content without it.
|
|
@@ -744,19 +746,19 @@ class se extends ut {
|
|
|
744
746
|
return;
|
|
745
747
|
const e = this._getCurrentLayout(), r = this.api.getDocumentModifier();
|
|
746
748
|
if (e === "grid") {
|
|
747
|
-
const i = this.currentNode.querySelectorAll(
|
|
749
|
+
const i = this.currentNode.querySelectorAll(q);
|
|
748
750
|
i == null || i.forEach((s) => {
|
|
749
751
|
const o = this._buildCompositionHtml(s, t);
|
|
750
752
|
r.modifyHtml(s).setInnerHtml(o);
|
|
751
753
|
});
|
|
752
754
|
} else {
|
|
753
|
-
const i = t.filter((o) => o !==
|
|
755
|
+
const i = t.filter((o) => o !== F && o !== x), s = this.currentNode.querySelectorAll(tt);
|
|
754
756
|
s == null || s.forEach((o) => {
|
|
755
757
|
const n = this._buildCompositionHtml(o, i);
|
|
756
758
|
r.modifyHtml(o).setInnerHtml(n);
|
|
757
759
|
});
|
|
758
760
|
}
|
|
759
|
-
r
|
|
761
|
+
H(r, this.api.translate("Remove custom attribute"), !0);
|
|
760
762
|
}
|
|
761
763
|
// ========================================================================
|
|
762
764
|
// DOM Mutation (Block Root Attributes, Reorder)
|
|
@@ -772,10 +774,10 @@ class se extends ut {
|
|
|
772
774
|
if (!this.currentNode)
|
|
773
775
|
return;
|
|
774
776
|
const r = {
|
|
775
|
-
...
|
|
777
|
+
...y.getConfig(this.currentNode),
|
|
776
778
|
composition: t
|
|
777
779
|
};
|
|
778
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(
|
|
780
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(W, t.join(",")).setAttribute(z, JSON.stringify(e)).setNodeConfig(r).apply(new k(this.api.translate("Update card composition")));
|
|
779
781
|
}
|
|
780
782
|
/**
|
|
781
783
|
* Reorders attribute rows within each product card based on composition order.
|
|
@@ -784,14 +786,14 @@ class se extends ut {
|
|
|
784
786
|
_reorderProductAttributes(t) {
|
|
785
787
|
if (!this.currentNode)
|
|
786
788
|
return;
|
|
787
|
-
const e = this.currentNode.querySelectorAll(
|
|
789
|
+
const e = this.currentNode.querySelectorAll(q);
|
|
788
790
|
if (!(e != null && e.length))
|
|
789
791
|
return;
|
|
790
792
|
const r = this.api.getDocumentModifier();
|
|
791
793
|
e.forEach((i) => {
|
|
792
794
|
const s = this._buildCompositionHtml(i, t);
|
|
793
795
|
r.modifyHtml(i).setInnerHtml(s);
|
|
794
|
-
}), r
|
|
796
|
+
}), H(r, this.api.translate("Reorder product attributes"), !0);
|
|
795
797
|
}
|
|
796
798
|
/**
|
|
797
799
|
* Builds HTML string with attributes ordered according to composition.
|
|
@@ -806,54 +808,54 @@ class se extends ut {
|
|
|
806
808
|
_applyVisibilityToBlock(t, e) {
|
|
807
809
|
if (!this.currentNode)
|
|
808
810
|
return;
|
|
809
|
-
if (t ===
|
|
811
|
+
if (t === I) {
|
|
810
812
|
this._applyTitleVisibilityToBlock(e);
|
|
811
813
|
return;
|
|
812
814
|
}
|
|
813
|
-
const r = this._resolveVisibilityKeys(t), { currentNode: i } = this, s = r.flatMap((c) => Array.from(i.querySelectorAll(`${
|
|
815
|
+
const r = this._resolveVisibilityKeys(t), { currentNode: i } = this, s = r.flatMap((c) => Array.from(i.querySelectorAll(`${N}[${E}="${c}"]`) ?? []));
|
|
814
816
|
if (!s.length)
|
|
815
817
|
return;
|
|
816
818
|
const o = e ? "1" : "0", n = e ? this.api.translate("visible") : this.api.translate("hidden"), l = `${this.api.translate("Set visibility")}: ${t} → ${n}`, a = this.api.getDocumentModifier();
|
|
817
819
|
s.forEach((c) => {
|
|
818
|
-
const u =
|
|
819
|
-
a.modifyHtml(c).setStyle("display", h).setAttribute(
|
|
820
|
+
const u = wt(c), h = e ? u : "none";
|
|
821
|
+
a.modifyHtml(c).setStyle("display", h).setAttribute(O, o);
|
|
820
822
|
});
|
|
821
823
|
const d = {
|
|
822
|
-
...
|
|
824
|
+
...y.getConfig(this.currentNode),
|
|
823
825
|
visibility: {
|
|
824
826
|
...this._readVisibilityFromRows(),
|
|
825
827
|
...Object.fromEntries(r.map((c) => [c, e]))
|
|
826
828
|
}
|
|
827
829
|
};
|
|
828
|
-
a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new
|
|
830
|
+
a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new k(l));
|
|
829
831
|
}
|
|
830
832
|
/** Inline "Product Prices" group row is tagged with whichever price comes first, so it drives both keys. */
|
|
831
833
|
_resolveVisibilityKeys(t) {
|
|
832
|
-
return this._isInlinePrices() && t === p ? [p,
|
|
834
|
+
return this._isInlinePrices() && t === p ? [p, A] : [t];
|
|
833
835
|
}
|
|
834
836
|
_isInlinePrices() {
|
|
835
|
-
return !
|
|
837
|
+
return !y.getConfig(this.currentNode).priceMovedToNextLine;
|
|
836
838
|
}
|
|
837
839
|
_applyTitleVisibilityToBlock(t) {
|
|
838
|
-
const e =
|
|
840
|
+
const e = y.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
|
|
839
841
|
if (!this.currentNode || s)
|
|
840
842
|
return;
|
|
841
843
|
const o = this.api.getDocumentModifier();
|
|
842
844
|
r ? o.modifyHtml(r.containerBody).setInnerHtml(r.html) : i.forEach((l) => o.modifyHtml(l).delete()), o.modifyHtml(this.currentNode).setNodeConfig({
|
|
843
845
|
...e,
|
|
844
846
|
previousTitleHtml: t ? e.previousTitleHtml : this._readTitleHtml(i),
|
|
845
|
-
visibility: { ...this._readVisibilityFromRows(), [
|
|
847
|
+
visibility: { ...this._readVisibilityFromRows(), [I]: t }
|
|
846
848
|
});
|
|
847
849
|
const n = t ? this.api.translate("visible") : this.api.translate("hidden");
|
|
848
|
-
o.apply(new
|
|
849
|
-
`${this.api.translate("Set visibility")}: ${
|
|
850
|
+
o.apply(new k(
|
|
851
|
+
`${this.api.translate("Set visibility")}: ${I} → ${n}`
|
|
850
852
|
));
|
|
851
853
|
}
|
|
852
854
|
_resolveTitleInjection(t) {
|
|
853
855
|
const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
|
|
854
856
|
if (!e || r === null)
|
|
855
857
|
return null;
|
|
856
|
-
const i = t.previousTitleHtml ||
|
|
858
|
+
const i = t.previousTitleHtml || It(this._defaultTitleParagraph(), !0, t.rowSpacing);
|
|
857
859
|
return { containerBody: e, html: i + r };
|
|
858
860
|
}
|
|
859
861
|
_readTitleHtml(t) {
|
|
@@ -862,28 +864,28 @@ class se extends ut {
|
|
|
862
864
|
_findTitleRows() {
|
|
863
865
|
var e;
|
|
864
866
|
const t = Array.from(((e = this.currentNode) == null ? void 0 : e.querySelectorAll(
|
|
865
|
-
`${
|
|
867
|
+
`${N}[${E}="${I}"]`
|
|
866
868
|
)) ?? []);
|
|
867
869
|
return t.length > 0 ? t : this._findTitleRowsByClass();
|
|
868
870
|
}
|
|
869
871
|
_findTitleRowsByClass() {
|
|
870
|
-
const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(
|
|
872
|
+
const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(G));
|
|
871
873
|
if (r === -1)
|
|
872
874
|
return [];
|
|
873
875
|
const i = e[r + 1];
|
|
874
876
|
return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
|
|
875
877
|
}
|
|
876
878
|
_isSpacerRow(t) {
|
|
877
|
-
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(
|
|
879
|
+
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(gt));
|
|
878
880
|
}
|
|
879
881
|
_findTitleContainerBody() {
|
|
880
|
-
return (this.currentNode ?
|
|
882
|
+
return (this.currentNode ? Mt(this.currentNode) : null) ?? void 0;
|
|
881
883
|
}
|
|
882
884
|
_readInnerHtml(t) {
|
|
883
885
|
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
|
|
884
886
|
}
|
|
885
887
|
_defaultTitleParagraph() {
|
|
886
|
-
return
|
|
888
|
+
return $t.replace("{-{-TITLE-}-}", this.api.translate(vt));
|
|
887
889
|
}
|
|
888
890
|
// ========================================================================
|
|
889
891
|
// Utilities
|
|
@@ -896,7 +898,7 @@ class se extends ut {
|
|
|
896
898
|
_findNthCustomKeyIndex(t, e) {
|
|
897
899
|
let r = 0;
|
|
898
900
|
for (let i = 0; i < t.length; i++)
|
|
899
|
-
if (t[i].startsWith(
|
|
901
|
+
if (t[i].startsWith(v)) {
|
|
900
902
|
if (r === e)
|
|
901
903
|
return i;
|
|
902
904
|
r++;
|
|
@@ -904,7 +906,7 @@ class se extends ut {
|
|
|
904
906
|
return -1;
|
|
905
907
|
}
|
|
906
908
|
_getCurrentLayout() {
|
|
907
|
-
return this.store.recommendationConfigs.orientation ||
|
|
909
|
+
return this.store.recommendationConfigs.orientation || Ut(this.currentNode);
|
|
908
910
|
}
|
|
909
911
|
/**
|
|
910
912
|
* Extracts background color properties from existing card elements.
|
|
@@ -956,10 +958,10 @@ class se extends ut {
|
|
|
956
958
|
* or when all available filters have already been added (no unused attributes left).
|
|
957
959
|
*/
|
|
958
960
|
_updateAddButtonState() {
|
|
959
|
-
const t = this._readCustomAttributesFromNode(), e = t.length >= b, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(
|
|
961
|
+
const t = this._readCustomAttributesFromNode(), e = t.length >= b, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(T(o)));
|
|
960
962
|
this.api.setUIEAttribute(
|
|
961
|
-
|
|
962
|
-
|
|
963
|
+
et.ADD_ATTRIBUTE,
|
|
964
|
+
L.BUTTON.disabled,
|
|
963
965
|
e || s ? "true" : "false"
|
|
964
966
|
);
|
|
965
967
|
}
|
|
@@ -988,8 +990,8 @@ class se extends ut {
|
|
|
988
990
|
*/
|
|
989
991
|
_getAddableFilters() {
|
|
990
992
|
const t = /* @__PURE__ */ new Set();
|
|
991
|
-
return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" &&
|
|
992
|
-
const r =
|
|
993
|
+
return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && ft.has(e.attributeName))).filter((e) => {
|
|
994
|
+
const r = T(e);
|
|
993
995
|
return t.has(r) ? !1 : (t.add(r), !0);
|
|
994
996
|
});
|
|
995
997
|
}
|
|
@@ -999,8 +1001,8 @@ class se extends ut {
|
|
|
999
1001
|
* resolve to their own entry. Falls back to Title Case of the bare name.
|
|
1000
1002
|
*/
|
|
1001
1003
|
_getDisplayNameForAttribute(t) {
|
|
1002
|
-
const e = Object.values(this.store.filterList).find((r) =>
|
|
1003
|
-
return e ? e.displayName :
|
|
1004
|
+
const e = Object.values(this.store.filterList).find((r) => T(r) === t);
|
|
1005
|
+
return e ? e.displayName : Et(D(t));
|
|
1004
1006
|
}
|
|
1005
1007
|
/**
|
|
1006
1008
|
* Resolves the display content for a custom attribute cell.
|
|
@@ -1008,29 +1010,29 @@ class se extends ut {
|
|
|
1008
1010
|
*/
|
|
1009
1011
|
_resolveAttributeContent(t, e, r) {
|
|
1010
1012
|
var l;
|
|
1011
|
-
const s = this.store.recommendationProducts[r], o =
|
|
1012
|
-
return
|
|
1013
|
+
const s = this.store.recommendationProducts[r], o = D(t), n = Pt(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
|
|
1014
|
+
return Rt(n) ?? e;
|
|
1013
1015
|
}
|
|
1014
1016
|
_getGridCellHtml(t, e, r, i = "", s = "", o = "") {
|
|
1015
|
-
const n =
|
|
1017
|
+
const n = U(t), l = D(t), a = Q(Tt, [n], this.store.filterList), d = {
|
|
1016
1018
|
[l]: e,
|
|
1017
1019
|
product_attributes: { [l]: e }
|
|
1018
1020
|
};
|
|
1019
1021
|
let c = a[n](d);
|
|
1020
1022
|
return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
|
|
1021
|
-
`padding: ${
|
|
1023
|
+
`padding: ${Ct}`,
|
|
1022
1024
|
`padding: ${o}`
|
|
1023
1025
|
)), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), s && (c = c.replace(/border="0"/, `border="0" bgcolor="${s}"`)), c;
|
|
1024
1026
|
}
|
|
1025
1027
|
_getListRowHtml(t, e, r) {
|
|
1026
|
-
const i =
|
|
1028
|
+
const i = D(t), s = Q(At, [r], this.store.filterList), o = {
|
|
1027
1029
|
[i]: e,
|
|
1028
1030
|
product_attributes: { [i]: e }
|
|
1029
1031
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1030
|
-
return `<tr class="${
|
|
1032
|
+
return `<tr class="${Y}" ${E}="${r}" ${O}="1">${l}</tr>`;
|
|
1031
1033
|
}
|
|
1032
1034
|
}
|
|
1033
1035
|
export {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
+
qt as COMPOSITION_CONTROL_BLOCK_ID,
|
|
1037
|
+
ne as RecommendationCardCompositionControl
|
|
1036
1038
|
};
|