@useinsider/guido 3.17.0-beta.3ff6ea0 → 3.17.0-beta.556d784
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 +6 -5
- 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 +33 -30
- 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 +35 -29
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +28 -27
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +14 -13
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +75 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -181
- 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/constants/selectors.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +1 -0
- 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 +7 -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/src/utils/liquidDynamicContent.d.ts +20 -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 +59 -55
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +3 -2
|
@@ -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
|
|
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
|
|
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";
|
|
15
16
|
import { getTableDisplayValue as Pt } from "../../utils/tagName.js";
|
|
16
|
-
import { isPartnerManagedBlock as wt, regenerateProductRowsWithStyles as
|
|
17
|
-
const Ut = "ui-elements-recommendation-card-composition",
|
|
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,
|
|
20
|
-
{ key:
|
|
21
|
-
{ key:
|
|
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 = [
|
|
21
|
+
{ key: q, label: "Product Image" },
|
|
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:
|
|
26
|
-
{ key:
|
|
27
|
-
],
|
|
28
|
-
class
|
|
25
|
+
{ key: ht, label: "Omnibus Price" },
|
|
26
|
+
{ key: pt, label: "Omnibus Discount" },
|
|
27
|
+
{ key: x, label: "Product Button" }
|
|
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
|
/**
|
|
@@ -64,10 +65,10 @@ class re extends dt {
|
|
|
64
65
|
).join(""), r = m.length + f, i = Array.from(
|
|
65
66
|
{ length: r },
|
|
66
67
|
(d, c) => `
|
|
67
|
-
<div data-reorder-icon-key="${
|
|
68
|
+
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
68
69
|
<${_.BUTTON}
|
|
69
70
|
class="drag-handle-btn flat-inline flat-white"
|
|
70
|
-
${O.BUTTON.name}="${
|
|
71
|
+
${O.BUTTON.name}="${P}${c}"
|
|
71
72
|
>
|
|
72
73
|
<${_.ICON}
|
|
73
74
|
src="reorder"
|
|
@@ -79,10 +80,10 @@ class re extends dt {
|
|
|
79
80
|
).join(""), s = Array.from(
|
|
80
81
|
{ length: f },
|
|
81
82
|
(d, c) => `
|
|
82
|
-
<div data-custom-delete-key="${
|
|
83
|
+
<div data-custom-delete-key="${w}${c}" style="display: none;">
|
|
83
84
|
<${_.BUTTON}
|
|
84
85
|
class="custom-attr-delete flat-inline flat-white"
|
|
85
|
-
${O.BUTTON.name}="${
|
|
86
|
+
${O.BUTTON.name}="${w}${c}"
|
|
86
87
|
>
|
|
87
88
|
<${_.ICON}
|
|
88
89
|
src="delete"
|
|
@@ -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>
|
|
@@ -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,7 +274,7 @@ 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))
|
|
@@ -476,7 +477,7 @@ class re extends dt {
|
|
|
476
477
|
*/
|
|
477
478
|
_moveDeleteButtonsIntoItems(t, e) {
|
|
478
479
|
for (let r = 0; r < e; r++) {
|
|
479
|
-
const i = `${
|
|
480
|
+
const i = `${w}${r}`, s = t.querySelector(`[data-custom-delete-key="${i}"]`), o = t.querySelector(`[data-custom-delete-slot="${r}"]`);
|
|
480
481
|
if (s && o) {
|
|
481
482
|
const n = s.querySelector("ue-button");
|
|
482
483
|
n && o.appendChild(n);
|
|
@@ -489,7 +490,7 @@ class re extends dt {
|
|
|
489
490
|
*/
|
|
490
491
|
_rescueDeleteButtonsToStore(t) {
|
|
491
492
|
for (let e = 0; e < f; e++) {
|
|
492
|
-
const r = `${
|
|
493
|
+
const r = `${w}${e}`, i = t.querySelector(`[data-custom-delete-key="${r}"]`), s = t.querySelector(`[data-custom-delete-slot="${e}"]`);
|
|
493
494
|
if (s) {
|
|
494
495
|
const o = s.querySelector("ue-button");
|
|
495
496
|
o && i && i.appendChild(o);
|
|
@@ -502,7 +503,7 @@ class re extends dt {
|
|
|
502
503
|
*/
|
|
503
504
|
_moveReorderIconsIntoItems(t, e) {
|
|
504
505
|
for (let r = 0; r < e; r++) {
|
|
505
|
-
const i = `${
|
|
506
|
+
const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
|
|
506
507
|
if (s && o) {
|
|
507
508
|
const n = s.querySelector("ue-button");
|
|
508
509
|
n && o.appendChild(n);
|
|
@@ -516,7 +517,7 @@ class re extends dt {
|
|
|
516
517
|
_rescueReorderIconsToStore(t) {
|
|
517
518
|
const e = m.length + f;
|
|
518
519
|
for (let r = 0; r < e; r++) {
|
|
519
|
-
const i = `${
|
|
520
|
+
const i = `${P}${r}`, s = t.querySelector(`[data-reorder-icon-key="${i}"]`), o = t.querySelector(`[data-reorder-icon-slot="${r}"]`);
|
|
520
521
|
if (o) {
|
|
521
522
|
const n = o.querySelector("ue-button");
|
|
522
523
|
n && s && s.appendChild(n);
|
|
@@ -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,14 +683,14 @@ 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 },
|
|
@@ -702,14 +703,14 @@ class re extends dt {
|
|
|
702
703
|
return this._getGridCellHtml(
|
|
703
704
|
t,
|
|
704
705
|
lt,
|
|
705
|
-
|
|
706
|
+
F,
|
|
706
707
|
et,
|
|
707
708
|
rt,
|
|
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("");
|
|
@@ -720,7 +721,7 @@ class re extends dt {
|
|
|
720
721
|
const s = this.currentNode.querySelectorAll(Z);
|
|
721
722
|
if (!(s != null && s.length))
|
|
722
723
|
return;
|
|
723
|
-
const o = i.filter((l) => l !==
|
|
724
|
+
const o = i.filter((l) => l !== q && l !== x), n = this.api.getDocumentModifier();
|
|
724
725
|
s.forEach((l, a) => {
|
|
725
726
|
const d = o.map((c) => {
|
|
726
727
|
if (c === r) {
|
|
@@ -741,13 +742,13 @@ 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);
|
|
748
749
|
});
|
|
749
750
|
} else {
|
|
750
|
-
const i = t.filter((o) => o !==
|
|
751
|
+
const i = t.filter((o) => o !== q && o !== x), s = this.currentNode.querySelectorAll(Z);
|
|
751
752
|
s == null || s.forEach((o) => {
|
|
752
753
|
const n = this._buildCompositionHtml(o, i);
|
|
753
754
|
r.modifyHtml(o).setInnerHtml(n);
|
|
@@ -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,7 +808,7 @@ 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();
|
|
@@ -822,12 +823,13 @@ class re extends dt {
|
|
|
822
823
|
n.modifyHtml(this.currentNode).setNodeConfig(l), n.apply(new y(o));
|
|
823
824
|
}
|
|
824
825
|
_applyTitleVisibilityToBlock(t) {
|
|
825
|
-
const e = g.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e
|
|
826
|
+
const e = g.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
|
|
826
827
|
if (!this.currentNode || s)
|
|
827
828
|
return;
|
|
828
829
|
const o = this.api.getDocumentModifier();
|
|
829
830
|
r ? o.modifyHtml(r.containerBody).setInnerHtml(r.html) : i.forEach((l) => o.modifyHtml(l).delete()), o.modifyHtml(this.currentNode).setNodeConfig({
|
|
830
831
|
...e,
|
|
832
|
+
previousTitleHtml: t ? e.previousTitleHtml : this._readTitleHtml(i),
|
|
831
833
|
visibility: { ...this._readVisibilityFromRows(), [I]: t }
|
|
832
834
|
});
|
|
833
835
|
const n = t ? this.api.translate("visible") : this.api.translate("hidden");
|
|
@@ -837,15 +839,18 @@ class re extends dt {
|
|
|
837
839
|
}
|
|
838
840
|
_resolveTitleInjection(t) {
|
|
839
841
|
const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
};
|
|
842
|
+
if (!e || r === null)
|
|
843
|
+
return null;
|
|
844
|
+
const i = t.previousTitleHtml || At(this._defaultTitleParagraph(), !0, t.rowSpacing);
|
|
845
|
+
return { containerBody: e, html: i + r };
|
|
846
|
+
}
|
|
847
|
+
_readTitleHtml(t) {
|
|
848
|
+
return t.map((e) => "getOuterHTML" in e ? e.getOuterHTML() : "").join("");
|
|
844
849
|
}
|
|
845
850
|
_findTitleRows() {
|
|
846
851
|
var e;
|
|
847
852
|
const t = Array.from(((e = this.currentNode) == null ? void 0 : e.querySelectorAll(
|
|
848
|
-
`${N}[${
|
|
853
|
+
`${N}[${E}="${I}"]`
|
|
849
854
|
)) ?? []);
|
|
850
855
|
return t.length > 0 ? t : this._findTitleRowsByClass();
|
|
851
856
|
}
|
|
@@ -857,16 +862,16 @@ class re extends dt {
|
|
|
857
862
|
return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
|
|
858
863
|
}
|
|
859
864
|
_isSpacerRow(t) {
|
|
860
|
-
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));
|
|
861
866
|
}
|
|
862
867
|
_findTitleContainerBody() {
|
|
863
|
-
return (this.currentNode ?
|
|
868
|
+
return (this.currentNode ? kt(this.currentNode) : null) ?? void 0;
|
|
864
869
|
}
|
|
865
870
|
_readInnerHtml(t) {
|
|
866
871
|
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
|
|
867
872
|
}
|
|
868
873
|
_defaultTitleParagraph() {
|
|
869
|
-
return
|
|
874
|
+
return It.replace("{-{-TITLE-}-}", this.api.translate($t));
|
|
870
875
|
}
|
|
871
876
|
// ========================================================================
|
|
872
877
|
// Utilities
|
|
@@ -887,7 +892,7 @@ class re extends dt {
|
|
|
887
892
|
return -1;
|
|
888
893
|
}
|
|
889
894
|
_getCurrentLayout() {
|
|
890
|
-
return this.store.recommendationConfigs.orientation ||
|
|
895
|
+
return this.store.recommendationConfigs.orientation || Mt(this.currentNode);
|
|
891
896
|
}
|
|
892
897
|
/**
|
|
893
898
|
* Extracts background color properties from existing card elements.
|
|
@@ -971,7 +976,7 @@ class re extends dt {
|
|
|
971
976
|
*/
|
|
972
977
|
_getAddableFilters() {
|
|
973
978
|
const t = /* @__PURE__ */ new Set();
|
|
974
|
-
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) => {
|
|
975
980
|
const r = T(e);
|
|
976
981
|
return t.has(r) ? !1 : (t.add(r), !0);
|
|
977
982
|
});
|
|
@@ -983,7 +988,7 @@ class re extends dt {
|
|
|
983
988
|
*/
|
|
984
989
|
_getDisplayNameForAttribute(t) {
|
|
985
990
|
const e = Object.values(this.store.filterList).find((r) => T(r) === t);
|
|
986
|
-
return e ? e.displayName :
|
|
991
|
+
return e ? e.displayName : Nt(H(t));
|
|
987
992
|
}
|
|
988
993
|
/**
|
|
989
994
|
* Resolves the display content for a custom attribute cell.
|
|
@@ -991,29 +996,29 @@ class re extends dt {
|
|
|
991
996
|
*/
|
|
992
997
|
_resolveAttributeContent(t, e, r) {
|
|
993
998
|
var l;
|
|
994
|
-
const s = this.store.recommendationProducts[r], o =
|
|
995
|
-
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;
|
|
996
1001
|
}
|
|
997
1002
|
_getGridCellHtml(t, e, r, i = "", s = "", o = "") {
|
|
998
|
-
const n =
|
|
1003
|
+
const n = M(t), l = H(t), a = J(yt, [n], this.store.filterList), d = {
|
|
999
1004
|
[l]: e,
|
|
1000
1005
|
product_attributes: { [l]: e }
|
|
1001
1006
|
};
|
|
1002
1007
|
let c = a[n](d);
|
|
1003
1008
|
return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
|
|
1004
|
-
`padding: ${
|
|
1009
|
+
`padding: ${Tt}`,
|
|
1005
1010
|
`padding: ${o}`
|
|
1006
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;
|
|
1007
1012
|
}
|
|
1008
1013
|
_getListRowHtml(t, e, r) {
|
|
1009
|
-
const i =
|
|
1014
|
+
const i = H(t), s = J(St, [r], this.store.filterList), o = {
|
|
1010
1015
|
[i]: e,
|
|
1011
1016
|
product_attributes: { [i]: e }
|
|
1012
1017
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1013
|
-
return `<tr class="${G}" ${
|
|
1018
|
+
return `<tr class="${G}" ${E}="${r}" ${D}="1">${l}</tr>`;
|
|
1014
1019
|
}
|
|
1015
1020
|
}
|
|
1016
1021
|
export {
|
|
1017
1022
|
Ut as COMPOSITION_CONTROL_BLOCK_ID,
|
|
1018
|
-
|
|
1023
|
+
se as RecommendationCardCompositionControl
|
|
1019
1024
|
};
|