@useinsider/guido 3.17.0-beta.978ff7e → 3.17.0-beta.a0d17c2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +10 -10
- package/dist/components/Guido.vue2.js +82 -76
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +5 -4
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Recommendation/block.js +26 -21
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +30 -30
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +60 -59
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +246 -187
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +2 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +2 -1
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
2
|
var ct = (h, p, t) => p in h ? at(h, p, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[p] = t;
|
|
3
3
|
var $ = (h, p, t) => ct(h, typeof p != "symbol" ? p + "" : p, t);
|
|
4
|
+
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
4
5
|
import { UIElementType as _, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as
|
|
6
|
+
import { CommonControl as ut } from "../../../common-control.js";
|
|
7
|
+
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as C, ATTR_PRODUCT_OLD_PRICE as L, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as x, ATTR_RECOMMENDATION_TITLE as I, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as v, SELECTOR_ATTRIBUTE_ROW as N, SELECTOR_TITLE_CELL as z, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as E, CSS_CLASS_ATTRIBUTE_ROW as G, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
7
8
|
import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
|
|
8
9
|
import { RecommendationConfigService as g } from "../../services/configService.js";
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import { ATTRIBUTE_CELL_CLASS as
|
|
11
|
-
import { listElementRenderer as
|
|
12
|
-
import { buildTitleRows as
|
|
13
|
-
import { resolveInlinePriceOrder as
|
|
14
|
-
import { normalizeCompositionKeys as Rt, normalizeCustomAttrValues as
|
|
15
|
-
import { getTableDisplayValue as
|
|
16
|
-
import { isPartnerManagedBlock as
|
|
17
|
-
const Ut = "ui-elements-recommendation-card-composition",
|
|
10
|
+
import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
|
|
11
|
+
import { ATTRIBUTE_CELL_CLASS as bt, gridElementRenderer as yt, DEFAULT_CELL_PADDING as Tt, buildFillerCell as Ct } from "../../templates/grid/elementRenderer.js";
|
|
12
|
+
import { listElementRenderer as St } from "../../templates/list/elementRenderer.js";
|
|
13
|
+
import { buildTitleRows as At, DEFAULT_TITLE_PARAGRAPH as It, DEFAULT_TITLE_TEXT as $t } from "../../templates/titleRows.js";
|
|
14
|
+
import { resolveInlinePriceOrder as vt, toDisplayName as Nt, toDisplayableAttributeValue as Et, buildElementRenderer as J } from "../../templates/utils.js";
|
|
15
|
+
import { normalizeCompositionKeys as Rt, normalizeCustomAttrValues as Lt, compositionKeyToProductAttr as k, resolveRowCompositionKey as Ot, filterToProductAttrValue as T, findAttributeRow as Dt, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as Ht, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
|
|
16
|
+
import { getTableDisplayValue as Pt } from "../../utils/tagName.js";
|
|
17
|
+
import { isPartnerManagedBlock as wt, regenerateProductRowsWithStyles as Bt, getMainContainerTbody as kt, getCurrentLayout as Mt } from "../main/utils.js";
|
|
18
|
+
const Ut = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
|
|
18
19
|
ADD_ATTRIBUTE: "addAttribute"
|
|
19
|
-
}, f = 5, P = "reorderIcon_",
|
|
20
|
+
}, f = 5, P = "reorderIcon_", qt = '<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 = [
|
|
20
21
|
{ key: q, label: "Product Image" },
|
|
21
|
-
{ key:
|
|
22
|
+
{ key: mt, label: "Product Name" },
|
|
22
23
|
{ key: C, label: "Product Price" },
|
|
23
24
|
{ key: L, label: "Product Original Price" },
|
|
24
|
-
{ key:
|
|
25
|
-
{ key:
|
|
25
|
+
{ key: ht, label: "Omnibus Price" },
|
|
26
|
+
{ key: pt, label: "Omnibus Discount" },
|
|
26
27
|
{ key: x, label: "Product Button" }
|
|
27
|
-
],
|
|
28
|
-
class
|
|
28
|
+
], R = { key: I, label: "Title" }, xt = new Set(m.map((h) => h.key)), A = "customAttr_", w = "deleteAttr_";
|
|
29
|
+
class se extends ut {
|
|
29
30
|
constructor() {
|
|
30
31
|
super(...arguments);
|
|
31
|
-
$(this, "store",
|
|
32
|
+
$(this, "store", ft());
|
|
32
33
|
$(this, "unsubscribeStore", null);
|
|
33
34
|
$(this, "eventController", null);
|
|
34
35
|
/**
|
|
@@ -91,7 +92,7 @@ class re extends dt {
|
|
|
91
92
|
</${_.BUTTON}>
|
|
92
93
|
</div>
|
|
93
94
|
`
|
|
94
|
-
).join(""), o =
|
|
95
|
+
).join(""), o = dt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
|
|
95
96
|
"Drag and drop the card elements to reorder them, adjust their visibility or add new attributes up to 5."
|
|
96
97
|
), l = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
|
|
97
98
|
return `
|
|
@@ -122,10 +123,10 @@ class re extends dt {
|
|
|
122
123
|
</div>
|
|
123
124
|
|
|
124
125
|
<div class="orderable-list">
|
|
125
|
-
<div class="orderable-item title-item" data-key="${
|
|
126
|
-
<span class="item-label">${this.api.translate(
|
|
126
|
+
<div class="orderable-item title-item" data-key="${R.key}">
|
|
127
|
+
<span class="item-label">${this.api.translate(R.label)}</span>
|
|
127
128
|
<div class="item-action">
|
|
128
|
-
${this._GuToggle(`visibility_${
|
|
129
|
+
${this._GuToggle(`visibility_${R.key}`)}
|
|
129
130
|
</div>
|
|
130
131
|
</div>
|
|
131
132
|
</div>
|
|
@@ -154,7 +155,7 @@ class re extends dt {
|
|
|
154
155
|
const t = (r = this.getContainer()) == null ? void 0 : r.querySelector("[data-card-composition-control]");
|
|
155
156
|
if (!t)
|
|
156
157
|
return;
|
|
157
|
-
const e =
|
|
158
|
+
const e = wt(this.currentNode);
|
|
158
159
|
t.style.pointerEvents = e ? "none" : "", t.style.opacity = e ? "0.5" : "";
|
|
159
160
|
}
|
|
160
161
|
onTemplateNodeUpdated(t) {
|
|
@@ -171,7 +172,7 @@ class re extends dt {
|
|
|
171
172
|
this.api.updateValues(s), i && this._initializeCustomSelects(e), this._updateAddButtonState();
|
|
172
173
|
}
|
|
173
174
|
_registerValueChangeListeners() {
|
|
174
|
-
[
|
|
175
|
+
[R, ...m].forEach((t) => {
|
|
175
176
|
this.api.onValueChanged(`visibility_${t.key}`, (e) => {
|
|
176
177
|
this._applyVisibilityToBlock(t.key, e);
|
|
177
178
|
});
|
|
@@ -205,7 +206,7 @@ class re extends dt {
|
|
|
205
206
|
const t = this.currentNode.getAttribute(W);
|
|
206
207
|
if (t)
|
|
207
208
|
try {
|
|
208
|
-
return
|
|
209
|
+
return Lt(
|
|
209
210
|
JSON.parse(t).map((e) => String(e)),
|
|
210
211
|
this.currentNode,
|
|
211
212
|
this.store.filterList
|
|
@@ -239,7 +240,7 @@ class re extends dt {
|
|
|
239
240
|
return t.forEach((r) => {
|
|
240
241
|
if (!("getAttribute" in r))
|
|
241
242
|
return;
|
|
242
|
-
const i =
|
|
243
|
+
const i = Ot(r), s = r.getAttribute(D);
|
|
243
244
|
i && s !== null && (e[i] = this._parseVisibilityValue(s));
|
|
244
245
|
}), e;
|
|
245
246
|
}
|
|
@@ -252,7 +253,7 @@ class re extends dt {
|
|
|
252
253
|
}), t;
|
|
253
254
|
}
|
|
254
255
|
_buildVisibilityValues(t) {
|
|
255
|
-
return [
|
|
256
|
+
return [R, ...m].reduce((e, r) => (e[`visibility_${r.key}`] = t[r.key] ?? !0, e), {});
|
|
256
257
|
}
|
|
257
258
|
// ========================================================================
|
|
258
259
|
// UI Rendering (Orderable List)
|
|
@@ -273,12 +274,12 @@ class re extends dt {
|
|
|
273
274
|
if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
|
|
274
275
|
return !1;
|
|
275
276
|
i.dataset.inlinePrices = String(s);
|
|
276
|
-
const n = new Set(e), l =
|
|
277
|
+
const n = new Set(e), l = vt(t);
|
|
277
278
|
let a = 0, d = 0;
|
|
278
279
|
const c = t.map((u) => {
|
|
279
280
|
if (s && (u === C || u === L))
|
|
280
281
|
return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
|
|
281
|
-
if (
|
|
282
|
+
if (xt.has(u)) {
|
|
282
283
|
const b = m.find((S) => S.key === u);
|
|
283
284
|
return this._createBuiltInItemHtml(b, d++);
|
|
284
285
|
}
|
|
@@ -345,7 +346,7 @@ class re extends dt {
|
|
|
345
346
|
var n, l;
|
|
346
347
|
const r = ((n = m.find((a) => a.key === C)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === L)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
|
|
347
348
|
<div class="price-suborderable-item" draggable="true" data-subkey="${a}">
|
|
348
|
-
<span class="sub-drag-handle">${
|
|
349
|
+
<span class="sub-drag-handle">${qt}</span>
|
|
349
350
|
<span class="item-label">${this.api.translate(d)}</span>
|
|
350
351
|
</div>`, o = e ? s(L, i) + s(C, r) : s(C, r) + s(L, i);
|
|
351
352
|
return `
|
|
@@ -615,7 +616,7 @@ class re extends dt {
|
|
|
615
616
|
// Actions (Add, Delete, Reorder)
|
|
616
617
|
// ========================================================================
|
|
617
618
|
_onAddAttribute(t, e) {
|
|
618
|
-
const r =
|
|
619
|
+
const r = M(t), i = this._readCompositionFromNode();
|
|
619
620
|
i.push(r);
|
|
620
621
|
const s = [...this._readCustomAttributesFromNode(), t];
|
|
621
622
|
this._updateBothAttributes(i, s), this._injectCustomAttributeHtml(t, e, r, i), this._renderOrderableItems(i, s), this._initializeCustomSelects(s), this._updateAddButtonState();
|
|
@@ -639,7 +640,7 @@ class re extends dt {
|
|
|
639
640
|
const r = this._readCustomAttributesFromNode(), i = r[t];
|
|
640
641
|
if (i === void 0 || i === e)
|
|
641
642
|
return;
|
|
642
|
-
const s =
|
|
643
|
+
const s = M(e), o = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(o, t);
|
|
643
644
|
n !== -1 && (o[n] = s), r[t] = e;
|
|
644
645
|
const l = this._getDisplayNameForAttribute(e);
|
|
645
646
|
this._updateBothAttributes(o, r), this._injectCustomAttributeHtml(e, l, s, o), this._renderOrderableItems(o, r), this._initializeCustomSelects(r);
|
|
@@ -650,7 +651,7 @@ class re extends dt {
|
|
|
650
651
|
try {
|
|
651
652
|
this._updateBothAttributes(t, e);
|
|
652
653
|
const r = !g.getConfig(this.currentNode).priceMovedToNextLine;
|
|
653
|
-
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode &&
|
|
654
|
+
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Bt({
|
|
654
655
|
currentNode: this.currentNode,
|
|
655
656
|
documentModifier: this.api.getDocumentModifier()
|
|
656
657
|
});
|
|
@@ -668,11 +669,11 @@ class re extends dt {
|
|
|
668
669
|
* DOM converge on the next composition change without writing on open.
|
|
669
670
|
*/
|
|
670
671
|
_getExistingRowHtml(t, e) {
|
|
671
|
-
const r =
|
|
672
|
+
const r = Dt(t, e);
|
|
672
673
|
if (r && "getOuterHTML" in r)
|
|
673
674
|
return Q(r.getOuterHTML(), e);
|
|
674
675
|
const i = t.querySelector(
|
|
675
|
-
`${N}[${
|
|
676
|
+
`${N}[${E}="${e}"]`
|
|
676
677
|
);
|
|
677
678
|
return i && "getOuterHTML" in i ? Q(i.getOuterHTML(), e) : "";
|
|
678
679
|
}
|
|
@@ -682,18 +683,18 @@ class re extends dt {
|
|
|
682
683
|
this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, e, r, i) : this._injectListAttributeRow(t, e, r, i);
|
|
683
684
|
}
|
|
684
685
|
_injectGridAttributeRow(t, e, r, i) {
|
|
685
|
-
const s = this.currentNode.querySelectorAll(
|
|
686
|
+
const s = this.currentNode.querySelectorAll(U);
|
|
686
687
|
if (!(s != null && s.length))
|
|
687
688
|
return;
|
|
688
689
|
const o = g.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
|
|
689
690
|
let c = 0;
|
|
690
691
|
s.forEach((u) => {
|
|
691
692
|
var V;
|
|
692
|
-
const b = u.querySelector(N), S = ((V = b == null ? void 0 : b.querySelectorAll(`.${
|
|
693
|
+
const b = u.querySelector(N), S = ((V = b == null ? void 0 : b.querySelectorAll(`.${bt}`)) == null ? void 0 : V.length) || 1, F = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
|
|
693
694
|
if (j === r) {
|
|
694
695
|
const st = Array.from(
|
|
695
696
|
{ length: B },
|
|
696
|
-
(
|
|
697
|
+
(Ft, nt) => {
|
|
697
698
|
const lt = this._resolveAttributeContent(
|
|
698
699
|
t,
|
|
699
700
|
e,
|
|
@@ -708,8 +709,8 @@ class re extends dt {
|
|
|
708
709
|
l
|
|
709
710
|
);
|
|
710
711
|
}
|
|
711
|
-
).join(""), ot =
|
|
712
|
-
return `<tr class="${G}" ${
|
|
712
|
+
).join(""), ot = Ct(F, l).repeat(S - B);
|
|
713
|
+
return `<tr class="${G}" ${E}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
713
714
|
}
|
|
714
715
|
return this._getExistingRowHtml(u, j);
|
|
715
716
|
}).join("");
|
|
@@ -741,7 +742,7 @@ class re extends dt {
|
|
|
741
742
|
return;
|
|
742
743
|
const e = this._getCurrentLayout(), r = this.api.getDocumentModifier();
|
|
743
744
|
if (e === "grid") {
|
|
744
|
-
const i = this.currentNode.querySelectorAll(
|
|
745
|
+
const i = this.currentNode.querySelectorAll(U);
|
|
745
746
|
i == null || i.forEach((s) => {
|
|
746
747
|
const o = this._buildCompositionHtml(s, t);
|
|
747
748
|
r.modifyHtml(s).setInnerHtml(o);
|
|
@@ -781,7 +782,7 @@ class re extends dt {
|
|
|
781
782
|
_reorderProductAttributes(t) {
|
|
782
783
|
if (!this.currentNode)
|
|
783
784
|
return;
|
|
784
|
-
const e = this.currentNode.querySelectorAll(
|
|
785
|
+
const e = this.currentNode.querySelectorAll(U);
|
|
785
786
|
if (!(e != null && e.length))
|
|
786
787
|
return;
|
|
787
788
|
const r = this.api.getDocumentModifier();
|
|
@@ -807,12 +808,12 @@ class re extends dt {
|
|
|
807
808
|
this._applyTitleVisibilityToBlock(e);
|
|
808
809
|
return;
|
|
809
810
|
}
|
|
810
|
-
const r = this.currentNode.querySelectorAll(`${N}[${
|
|
811
|
+
const r = this.currentNode.querySelectorAll(`${N}[${E}="${t}"]`);
|
|
811
812
|
if (!(r != null && r.length))
|
|
812
813
|
return;
|
|
813
814
|
const i = e ? "1" : "0", s = e ? this.api.translate("visible") : this.api.translate("hidden"), o = `${this.api.translate("Set visibility")}: ${t} → ${s}`, n = this.api.getDocumentModifier();
|
|
814
815
|
r.forEach((a) => {
|
|
815
|
-
const d =
|
|
816
|
+
const d = Pt(a), c = e ? d : "none";
|
|
816
817
|
n.modifyHtml(a).setStyle("display", c).setAttribute(D, i);
|
|
817
818
|
});
|
|
818
819
|
const l = {
|
|
@@ -840,7 +841,7 @@ class re extends dt {
|
|
|
840
841
|
const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
|
|
841
842
|
if (!e || r === null)
|
|
842
843
|
return null;
|
|
843
|
-
const i = t.previousTitleHtml ||
|
|
844
|
+
const i = t.previousTitleHtml || At(this._defaultTitleParagraph(), !0, t.rowSpacing);
|
|
844
845
|
return { containerBody: e, html: i + r };
|
|
845
846
|
}
|
|
846
847
|
_readTitleHtml(t) {
|
|
@@ -849,7 +850,7 @@ class re extends dt {
|
|
|
849
850
|
_findTitleRows() {
|
|
850
851
|
var e;
|
|
851
852
|
const t = Array.from(((e = this.currentNode) == null ? void 0 : e.querySelectorAll(
|
|
852
|
-
`${N}[${
|
|
853
|
+
`${N}[${E}="${I}"]`
|
|
853
854
|
)) ?? []);
|
|
854
855
|
return t.length > 0 ? t : this._findTitleRowsByClass();
|
|
855
856
|
}
|
|
@@ -861,16 +862,16 @@ class re extends dt {
|
|
|
861
862
|
return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
|
|
862
863
|
}
|
|
863
864
|
_isSpacerRow(t) {
|
|
864
|
-
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(
|
|
865
|
+
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(_t));
|
|
865
866
|
}
|
|
866
867
|
_findTitleContainerBody() {
|
|
867
|
-
return (this.currentNode ?
|
|
868
|
+
return (this.currentNode ? kt(this.currentNode) : null) ?? void 0;
|
|
868
869
|
}
|
|
869
870
|
_readInnerHtml(t) {
|
|
870
871
|
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
|
|
871
872
|
}
|
|
872
873
|
_defaultTitleParagraph() {
|
|
873
|
-
return
|
|
874
|
+
return It.replace("{-{-TITLE-}-}", this.api.translate($t));
|
|
874
875
|
}
|
|
875
876
|
// ========================================================================
|
|
876
877
|
// Utilities
|
|
@@ -891,7 +892,7 @@ class re extends dt {
|
|
|
891
892
|
return -1;
|
|
892
893
|
}
|
|
893
894
|
_getCurrentLayout() {
|
|
894
|
-
return this.store.recommendationConfigs.orientation ||
|
|
895
|
+
return this.store.recommendationConfigs.orientation || Mt(this.currentNode);
|
|
895
896
|
}
|
|
896
897
|
/**
|
|
897
898
|
* Extracts background color properties from existing card elements.
|
|
@@ -975,7 +976,7 @@ class re extends dt {
|
|
|
975
976
|
*/
|
|
976
977
|
_getAddableFilters() {
|
|
977
978
|
const t = /* @__PURE__ */ new Set();
|
|
978
|
-
return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" &&
|
|
979
|
+
return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && gt.has(e.attributeName))).filter((e) => {
|
|
979
980
|
const r = T(e);
|
|
980
981
|
return t.has(r) ? !1 : (t.add(r), !0);
|
|
981
982
|
});
|
|
@@ -987,7 +988,7 @@ class re extends dt {
|
|
|
987
988
|
*/
|
|
988
989
|
_getDisplayNameForAttribute(t) {
|
|
989
990
|
const e = Object.values(this.store.filterList).find((r) => T(r) === t);
|
|
990
|
-
return e ? e.displayName :
|
|
991
|
+
return e ? e.displayName : Nt(H(t));
|
|
991
992
|
}
|
|
992
993
|
/**
|
|
993
994
|
* Resolves the display content for a custom attribute cell.
|
|
@@ -995,29 +996,29 @@ class re extends dt {
|
|
|
995
996
|
*/
|
|
996
997
|
_resolveAttributeContent(t, e, r) {
|
|
997
998
|
var l;
|
|
998
|
-
const s = this.store.recommendationProducts[r], o = H(t), n =
|
|
999
|
-
return
|
|
999
|
+
const s = this.store.recommendationProducts[r], o = H(t), n = Ht(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
|
|
1000
|
+
return Et(n) ?? e;
|
|
1000
1001
|
}
|
|
1001
1002
|
_getGridCellHtml(t, e, r, i = "", s = "", o = "") {
|
|
1002
|
-
const n =
|
|
1003
|
+
const n = M(t), l = H(t), a = J(yt, [n], this.store.filterList), d = {
|
|
1003
1004
|
[l]: e,
|
|
1004
1005
|
product_attributes: { [l]: e }
|
|
1005
1006
|
};
|
|
1006
1007
|
let c = a[n](d);
|
|
1007
1008
|
return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
|
|
1008
|
-
`padding: ${
|
|
1009
|
+
`padding: ${Tt}`,
|
|
1009
1010
|
`padding: ${o}`
|
|
1010
1011
|
)), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), s && (c = c.replace(/border="0"/, `border="0" bgcolor="${s}"`)), c;
|
|
1011
1012
|
}
|
|
1012
1013
|
_getListRowHtml(t, e, r) {
|
|
1013
|
-
const i = H(t), s = J(
|
|
1014
|
+
const i = H(t), s = J(St, [r], this.store.filterList), o = {
|
|
1014
1015
|
[i]: e,
|
|
1015
1016
|
product_attributes: { [i]: e }
|
|
1016
1017
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1017
|
-
return `<tr class="${G}" ${
|
|
1018
|
+
return `<tr class="${G}" ${E}="${r}" ${D}="1">${l}</tr>`;
|
|
1018
1019
|
}
|
|
1019
1020
|
}
|
|
1020
1021
|
export {
|
|
1021
1022
|
Ut as COMPOSITION_CONTROL_BLOCK_ID,
|
|
1022
|
-
|
|
1023
|
+
se as RecommendationCardCompositionControl
|
|
1023
1024
|
};
|