@useinsider/guido 3.21.0-beta.0df5409 → 3.21.0-beta.23f347e
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/useActionsApi.js +63 -80
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useStripo.js +8 -8
- package/dist/config/compiler/htmlCompilerRules.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +29 -33
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +210 -222
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +119 -112
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +231 -257
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +11 -20
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +50 -106
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -5
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +11 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +8 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +11 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +13 -13
- package/dist/src/stores/editor.d.ts +1 -3
- package/dist/static/styles/components/tabs.css.js +5 -0
- package/dist/stores/editor.js +0 -5
- package/package.json +2 -2
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
|
@@ -2,17 +2,17 @@ var at = Object.defineProperty;
|
|
|
2
2
|
var ct = (_, g, t) => g in _ ? at(_, g, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[g] = t;
|
|
3
3
|
var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
|
|
4
4
|
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
5
|
-
import { UIElementType as f, UEAttr as O, ModificationDescription as
|
|
5
|
+
import { UIElementType as f, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
6
|
import { CommonControl as ut } from "../../../common-control.js";
|
|
7
7
|
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as z, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as G, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
8
8
|
import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
|
|
9
|
-
import { RecommendationConfigService as
|
|
9
|
+
import { RecommendationConfigService as T } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
|
|
11
11
|
import { ATTRIBUTE_CELL_CLASS as bt, gridElementRenderer as yt, DEFAULT_CELL_PADDING as Tt, buildFillerCell as Ct } from "../../templates/grid/elementRenderer.js";
|
|
12
12
|
import { listElementRenderer as St } from "../../templates/list/elementRenderer.js";
|
|
13
13
|
import { buildTitleRows as At, DEFAULT_TITLE_PARAGRAPH as It, DEFAULT_TITLE_TEXT as $t } from "../../templates/titleRows.js";
|
|
14
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, resolveRowVisibilityKeys as Ot, filterToProductAttrValue as
|
|
15
|
+
import { normalizeCompositionKeys as Rt, normalizeCustomAttrValues as Lt, compositionKeyToProductAttr as k, resolveRowVisibilityKeys as Ot, filterToProductAttrValue as C, findAttributeRow as Dt, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as Ht, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
|
|
16
16
|
import { getTableDisplayValue as Pt } from "../../utils/tagName.js";
|
|
17
17
|
import { isPartnerManagedBlock as wt, regenerateProductRowsWithStyles as Bt, getMainContainerTbody as kt, getCurrentLayout as Mt } from "../main/utils.js";
|
|
18
18
|
const Ut = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
|
|
@@ -193,7 +193,7 @@ class se extends ut {
|
|
|
193
193
|
const t = this.currentNode.getAttribute(K);
|
|
194
194
|
if (t)
|
|
195
195
|
return this._normalizeComposition(t.split(",").filter(Boolean));
|
|
196
|
-
const { composition: e } =
|
|
196
|
+
const { composition: e } = T.getConfig(this.currentNode);
|
|
197
197
|
return e != null && e.length ? this._normalizeComposition([...e]) : [...Y];
|
|
198
198
|
}
|
|
199
199
|
/** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
|
|
@@ -222,7 +222,7 @@ class se extends ut {
|
|
|
222
222
|
const t = Array.from(this.currentNode.querySelectorAll(E)), e = this._extractVisibilityFromRows(t);
|
|
223
223
|
if (Object.keys(e).length > 0)
|
|
224
224
|
return this._withTitlePresence(this._mergeWithDefaults(e));
|
|
225
|
-
const r =
|
|
225
|
+
const r = T.getConfig(this.currentNode).visibility;
|
|
226
226
|
return this._withTitlePresence(this._mergeWithDefaults({ ...r }));
|
|
227
227
|
}
|
|
228
228
|
_withTitlePresence(t) {
|
|
@@ -282,7 +282,7 @@ class se extends ut {
|
|
|
282
282
|
if (s && (u === p || u === I))
|
|
283
283
|
return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
|
|
284
284
|
if (Ft.has(u)) {
|
|
285
|
-
const h = m.find((
|
|
285
|
+
const h = m.find((S) => S.key === u);
|
|
286
286
|
return this._createBuiltInItemHtml(h, d++);
|
|
287
287
|
}
|
|
288
288
|
if (u.startsWith(N)) {
|
|
@@ -397,13 +397,13 @@ class se extends ut {
|
|
|
397
397
|
const i = /* @__PURE__ */ new Map();
|
|
398
398
|
r.forEach((o) => i.set(o.attributeName, (i.get(o.attributeName) ?? 0) + 1));
|
|
399
399
|
const s = new Set(e);
|
|
400
|
-
return s.delete(t), r.filter((o) => !s.has(
|
|
400
|
+
return s.delete(t), r.filter((o) => !s.has(C(o))).map((o) => ({
|
|
401
401
|
text: this._toOptionLabel(
|
|
402
402
|
o.displayName,
|
|
403
403
|
o.type === "defaultAttribute",
|
|
404
404
|
(i.get(o.attributeName) ?? 0) > 1
|
|
405
405
|
),
|
|
406
|
-
value:
|
|
406
|
+
value: C(o)
|
|
407
407
|
}));
|
|
408
408
|
}
|
|
409
409
|
/**
|
|
@@ -536,8 +536,8 @@ class se extends ut {
|
|
|
536
536
|
return;
|
|
537
537
|
const r = e.querySelector("[data-composition-list]"), i = e.querySelector("#guido__btn-add-attribute");
|
|
538
538
|
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(
|
|
539
|
+
const s = new Set(this._readCustomAttributesFromNode()), o = this._getAddableFilters().find((n) => !s.has(C(n)));
|
|
540
|
+
o && this._onAddAttribute(C(o), o.displayName);
|
|
541
541
|
}, { signal: t });
|
|
542
542
|
}
|
|
543
543
|
/**
|
|
@@ -620,8 +620,8 @@ class se extends ut {
|
|
|
620
620
|
_onAddAttribute(t, e) {
|
|
621
621
|
const r = M(t), i = this._readCompositionFromNode();
|
|
622
622
|
i.push(r);
|
|
623
|
-
const s = [...this._readCustomAttributesFromNode(), t]
|
|
624
|
-
this.
|
|
623
|
+
const s = [...this._readCustomAttributesFromNode(), t];
|
|
624
|
+
this._updateBothAttributes(i, s), this._injectCustomAttributeHtml(t, e, r, i), this._renderOrderableItems(i, s), this._initializeCustomSelects(s), this._updateAddButtonState();
|
|
625
625
|
}
|
|
626
626
|
/**
|
|
627
627
|
* Removes a single custom attribute by its index in the customAttrs array.
|
|
@@ -631,8 +631,8 @@ class se extends ut {
|
|
|
631
631
|
const e = this._readCustomAttributesFromNode();
|
|
632
632
|
if (e[t] === void 0)
|
|
633
633
|
return;
|
|
634
|
-
const i = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(i, t), o = i.filter((
|
|
635
|
-
this.
|
|
634
|
+
const i = this._readCompositionFromNode(), s = this._findNthCustomKeyIndex(i, t), o = i.filter((l, a) => a !== s), n = e.filter((l, a) => a !== t);
|
|
635
|
+
this._updateBothAttributes(o, n), this._removeCustomAttributeHtml(o), this._renderOrderableItems(o, n), this._initializeCustomSelects(n), this._updateAddButtonState();
|
|
636
636
|
}
|
|
637
637
|
/**
|
|
638
638
|
* Handles changing a custom attribute's selection via its inline _GuSelect.
|
|
@@ -644,22 +644,19 @@ class se extends ut {
|
|
|
644
644
|
return;
|
|
645
645
|
const s = M(e), o = this._readCompositionFromNode(), n = this._findNthCustomKeyIndex(o, t);
|
|
646
646
|
n !== -1 && (o[n] = s), r[t] = e;
|
|
647
|
-
const l = this._getDisplayNameForAttribute(e)
|
|
648
|
-
this.
|
|
647
|
+
const l = this._getDisplayNameForAttribute(e);
|
|
648
|
+
this._updateBothAttributes(o, r), this._injectCustomAttributeHtml(e, l, s, o), this._renderOrderableItems(o, r), this._initializeCustomSelects(r);
|
|
649
649
|
}
|
|
650
650
|
_onReorder(t) {
|
|
651
|
-
if (!this.currentNode)
|
|
652
|
-
return;
|
|
653
651
|
const e = t.filter((r) => r.startsWith(N)).map(k);
|
|
654
652
|
this.reorderInProgress = !0;
|
|
655
653
|
try {
|
|
656
|
-
|
|
657
|
-
|
|
654
|
+
this._updateBothAttributes(t, e);
|
|
655
|
+
const r = this._isInlinePrices();
|
|
656
|
+
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && Bt({
|
|
658
657
|
currentNode: this.currentNode,
|
|
659
|
-
documentModifier:
|
|
660
|
-
|
|
661
|
-
stageOnly: !0
|
|
662
|
-
}), this._stageBothAttributes(r, t, e), r.apply(new S(this.api.translate("Reorder product attributes")));
|
|
658
|
+
documentModifier: this.api.getDocumentModifier()
|
|
659
|
+
});
|
|
663
660
|
} finally {
|
|
664
661
|
this.reorderInProgress = !1;
|
|
665
662
|
}
|
|
@@ -682,111 +679,119 @@ class se extends ut {
|
|
|
682
679
|
);
|
|
683
680
|
return i && "getOuterHTML" in i ? Q(i.getOuterHTML(), e) : "";
|
|
684
681
|
}
|
|
685
|
-
_injectCustomAttributeHtml(t, e, r, i
|
|
682
|
+
_injectCustomAttributeHtml(t, e, r, i) {
|
|
686
683
|
if (!this.currentNode)
|
|
687
684
|
return;
|
|
688
|
-
this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, e, r, i
|
|
685
|
+
this._getCurrentLayout() === "grid" ? this._injectGridAttributeRow(t, e, r, i) : this._injectListAttributeRow(t, e, r, i);
|
|
689
686
|
}
|
|
690
|
-
_injectGridAttributeRow(t, e, r, i
|
|
691
|
-
const
|
|
692
|
-
if (!(
|
|
687
|
+
_injectGridAttributeRow(t, e, r, i) {
|
|
688
|
+
const s = this.currentNode.querySelectorAll(U);
|
|
689
|
+
if (!(s != null && s.length))
|
|
693
690
|
return;
|
|
694
|
-
const
|
|
691
|
+
const o = T.getConfig(this.currentNode), l = `0 ${Math.floor(o.columnSpacing / 2)}px`, a = this.api.getDocumentModifier(), d = this.store.recommendationProducts.length;
|
|
695
692
|
let c = 0;
|
|
696
|
-
|
|
693
|
+
s.forEach((u) => {
|
|
697
694
|
var V;
|
|
698
|
-
const h = u.querySelector(E),
|
|
699
|
-
if (j ===
|
|
695
|
+
const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${bt}`)) == null ? void 0 : V.length) || 1, x = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
|
|
696
|
+
if (j === r) {
|
|
700
697
|
const st = Array.from(
|
|
701
698
|
{ length: B },
|
|
702
699
|
(xt, nt) => {
|
|
703
700
|
const lt = this._resolveAttributeContent(
|
|
701
|
+
t,
|
|
704
702
|
e,
|
|
705
|
-
r,
|
|
706
703
|
c + nt
|
|
707
704
|
);
|
|
708
705
|
return this._getGridCellHtml(
|
|
709
|
-
|
|
706
|
+
t,
|
|
710
707
|
lt,
|
|
711
708
|
x,
|
|
712
709
|
et,
|
|
713
710
|
rt,
|
|
714
|
-
|
|
711
|
+
l
|
|
715
712
|
);
|
|
716
713
|
}
|
|
717
|
-
).join(""), ot = Ct(x,
|
|
718
|
-
return `<tr class="${G}" ${R}="${
|
|
714
|
+
).join(""), ot = Ct(x, l).repeat(S - B);
|
|
715
|
+
return `<tr class="${G}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
719
716
|
}
|
|
720
717
|
return this._getExistingRowHtml(u, j);
|
|
721
718
|
}).join("");
|
|
722
|
-
c += B, d > 0 && c >= d && (c = 0),
|
|
723
|
-
});
|
|
719
|
+
c += B, d > 0 && c >= d && (c = 0), a.modifyHtml(u).setInnerHtml(it);
|
|
720
|
+
}), a.apply(new y(`${this.api.translate("Add custom attribute")}: ${e}`));
|
|
724
721
|
}
|
|
725
|
-
_injectListAttributeRow(t, e, r, i
|
|
726
|
-
const
|
|
727
|
-
if (!(
|
|
722
|
+
_injectListAttributeRow(t, e, r, i) {
|
|
723
|
+
const s = this.currentNode.querySelectorAll(Z);
|
|
724
|
+
if (!(s != null && s.length))
|
|
728
725
|
return;
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
const d =
|
|
732
|
-
if (c ===
|
|
733
|
-
const u = this._resolveAttributeContent(
|
|
734
|
-
return this._getListRowHtml(
|
|
726
|
+
const o = i.filter((l) => l !== q && l !== F), n = this.api.getDocumentModifier();
|
|
727
|
+
s.forEach((l, a) => {
|
|
728
|
+
const d = o.map((c) => {
|
|
729
|
+
if (c === r) {
|
|
730
|
+
const u = this._resolveAttributeContent(t, e, a);
|
|
731
|
+
return this._getListRowHtml(t, u, r);
|
|
735
732
|
}
|
|
736
733
|
return this._getExistingRowHtml(l, c);
|
|
737
734
|
}).join("");
|
|
738
|
-
|
|
739
|
-
});
|
|
735
|
+
n.modifyHtml(l).setInnerHtml(d);
|
|
736
|
+
}), n.apply(new y(`${this.api.translate("Add custom attribute")}: ${e}`));
|
|
740
737
|
}
|
|
741
738
|
/**
|
|
742
739
|
* Removes a custom attribute by rebuilding product card content without it.
|
|
743
740
|
* The composition parameter should already have the deleted key removed.
|
|
744
741
|
*/
|
|
745
|
-
_removeCustomAttributeHtml(t
|
|
742
|
+
_removeCustomAttributeHtml(t) {
|
|
746
743
|
if (!this.currentNode)
|
|
747
744
|
return;
|
|
748
|
-
|
|
745
|
+
const e = this._getCurrentLayout(), r = this.api.getDocumentModifier();
|
|
746
|
+
if (e === "grid") {
|
|
749
747
|
const i = this.currentNode.querySelectorAll(U);
|
|
750
748
|
i == null || i.forEach((s) => {
|
|
751
|
-
const o = this._buildCompositionHtml(s,
|
|
752
|
-
|
|
749
|
+
const o = this._buildCompositionHtml(s, t);
|
|
750
|
+
r.modifyHtml(s).setInnerHtml(o);
|
|
753
751
|
});
|
|
754
752
|
} else {
|
|
755
|
-
const i =
|
|
753
|
+
const i = t.filter((o) => o !== q && o !== F), s = this.currentNode.querySelectorAll(Z);
|
|
756
754
|
s == null || s.forEach((o) => {
|
|
757
755
|
const n = this._buildCompositionHtml(o, i);
|
|
758
|
-
|
|
756
|
+
r.modifyHtml(o).setInnerHtml(n);
|
|
759
757
|
});
|
|
760
758
|
}
|
|
759
|
+
r.apply(new y(this.api.translate("Remove custom attribute")));
|
|
761
760
|
}
|
|
762
761
|
// ========================================================================
|
|
763
762
|
// DOM Mutation (Block Root Attributes, Reorder)
|
|
764
763
|
// ========================================================================
|
|
765
764
|
/**
|
|
766
|
-
*
|
|
767
|
-
*
|
|
765
|
+
* Atomically updates both composition and custom-attributes in a single apply()
|
|
766
|
+
* so that onTemplateNodeUpdated fires only once with fully consistent state.
|
|
767
|
+
* Two separate apply() calls would cause an intermediate onTemplateNodeUpdated
|
|
768
|
+
* where composition is updated but customAttributes still has the old order,
|
|
769
|
+
* producing a flicker on the custom attribute dropdowns.
|
|
768
770
|
*/
|
|
769
|
-
|
|
771
|
+
_updateBothAttributes(t, e) {
|
|
770
772
|
if (!this.currentNode)
|
|
771
773
|
return;
|
|
772
|
-
const
|
|
773
|
-
...
|
|
774
|
-
composition:
|
|
774
|
+
const r = {
|
|
775
|
+
...T.getConfig(this.currentNode),
|
|
776
|
+
composition: t
|
|
775
777
|
};
|
|
776
|
-
|
|
778
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(K, t.join(",")).setAttribute(W, JSON.stringify(e)).setNodeConfig(r).apply(new y(this.api.translate("Update card composition")));
|
|
777
779
|
}
|
|
778
780
|
/**
|
|
779
781
|
* Reorders attribute rows within each product card based on composition order.
|
|
780
782
|
* Only used for grid layout (list layout has fixed 3-column structure).
|
|
781
783
|
*/
|
|
782
|
-
_reorderProductAttributes(t
|
|
784
|
+
_reorderProductAttributes(t) {
|
|
783
785
|
if (!this.currentNode)
|
|
784
786
|
return;
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
const e = this.currentNode.querySelectorAll(U);
|
|
788
|
+
if (!(e != null && e.length))
|
|
789
|
+
return;
|
|
790
|
+
const r = this.api.getDocumentModifier();
|
|
791
|
+
e.forEach((i) => {
|
|
792
|
+
const s = this._buildCompositionHtml(i, t);
|
|
793
|
+
r.modifyHtml(i).setInnerHtml(s);
|
|
794
|
+
}), r.apply(new y(this.api.translate("Reorder product attributes")));
|
|
790
795
|
}
|
|
791
796
|
/**
|
|
792
797
|
* Builds HTML string with attributes ordered according to composition.
|
|
@@ -814,23 +819,23 @@ class se extends ut {
|
|
|
814
819
|
a.modifyHtml(c).setStyle("display", h).setAttribute(D, o);
|
|
815
820
|
});
|
|
816
821
|
const d = {
|
|
817
|
-
...
|
|
822
|
+
...T.getConfig(this.currentNode),
|
|
818
823
|
visibility: {
|
|
819
824
|
...this._readVisibilityFromRows(),
|
|
820
825
|
...Object.fromEntries(r.map((c) => [c, e]))
|
|
821
826
|
}
|
|
822
827
|
};
|
|
823
|
-
a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new
|
|
828
|
+
a.modifyHtml(this.currentNode).setNodeConfig(d), a.apply(new y(l));
|
|
824
829
|
}
|
|
825
830
|
/** Inline "Product Prices" group row is tagged with whichever price comes first, so it drives both keys. */
|
|
826
831
|
_resolveVisibilityKeys(t) {
|
|
827
832
|
return this._isInlinePrices() && t === p ? [p, I] : [t];
|
|
828
833
|
}
|
|
829
834
|
_isInlinePrices() {
|
|
830
|
-
return !
|
|
835
|
+
return !T.getConfig(this.currentNode).priceMovedToNextLine;
|
|
831
836
|
}
|
|
832
837
|
_applyTitleVisibilityToBlock(t) {
|
|
833
|
-
const e =
|
|
838
|
+
const e = T.getConfig(this.currentNode), r = t ? this._resolveTitleInjection(e) : null, i = t ? [] : this._findTitleRows(), s = t ? this._hasTitle() || !r : i.length === 0;
|
|
834
839
|
if (!this.currentNode || s)
|
|
835
840
|
return;
|
|
836
841
|
const o = this.api.getDocumentModifier();
|
|
@@ -840,7 +845,7 @@ class se extends ut {
|
|
|
840
845
|
visibility: { ...this._readVisibilityFromRows(), [$]: t }
|
|
841
846
|
});
|
|
842
847
|
const n = t ? this.api.translate("visible") : this.api.translate("hidden");
|
|
843
|
-
o.apply(new
|
|
848
|
+
o.apply(new y(
|
|
844
849
|
`${this.api.translate("Set visibility")}: ${$} → ${n}`
|
|
845
850
|
));
|
|
846
851
|
}
|
|
@@ -951,7 +956,7 @@ class se extends ut {
|
|
|
951
956
|
* or when all available filters have already been added (no unused attributes left).
|
|
952
957
|
*/
|
|
953
958
|
_updateAddButtonState() {
|
|
954
|
-
const t = this._readCustomAttributesFromNode(), e = t.length >= b, r = new Set(t), i = this._getAddableFilters(), s = i.length > 0 && i.every((o) => r.has(
|
|
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(C(o)));
|
|
955
960
|
this.api.setUIEAttribute(
|
|
956
961
|
tt.ADD_ATTRIBUTE,
|
|
957
962
|
O.BUTTON.disabled,
|
|
@@ -984,7 +989,7 @@ class se extends ut {
|
|
|
984
989
|
_getAddableFilters() {
|
|
985
990
|
const t = /* @__PURE__ */ new Set();
|
|
986
991
|
return Object.values(this.store.filterList).filter((e) => !(e.type === "defaultAttribute" && gt.has(e.attributeName))).filter((e) => {
|
|
987
|
-
const r =
|
|
992
|
+
const r = C(e);
|
|
988
993
|
return t.has(r) ? !1 : (t.add(r), !0);
|
|
989
994
|
});
|
|
990
995
|
}
|
|
@@ -994,7 +999,7 @@ class se extends ut {
|
|
|
994
999
|
* resolve to their own entry. Falls back to Title Case of the bare name.
|
|
995
1000
|
*/
|
|
996
1001
|
_getDisplayNameForAttribute(t) {
|
|
997
|
-
const e = Object.values(this.store.filterList).find((r) =>
|
|
1002
|
+
const e = Object.values(this.store.filterList).find((r) => C(r) === t);
|
|
998
1003
|
return e ? e.displayName : Nt(H(t));
|
|
999
1004
|
}
|
|
1000
1005
|
/**
|
|
@@ -78,10 +78,11 @@ class g extends m {
|
|
|
78
78
|
const e = this._getTargetElements();
|
|
79
79
|
if (!e.length)
|
|
80
80
|
return;
|
|
81
|
+
t && c(this.api);
|
|
81
82
|
const r = this.api.getDocumentModifier();
|
|
82
83
|
e.forEach((s) => {
|
|
83
84
|
t ? r.modifyHtml(s).setClass(o) : r.modifyHtml(s).removeClass(o);
|
|
84
|
-
}),
|
|
85
|
+
}), r.apply(
|
|
85
86
|
new T(
|
|
86
87
|
t ? "Enable custom attribute text trimming" : "Disable custom attribute text trimming"
|
|
87
88
|
)
|
|
@@ -77,7 +77,12 @@ class R extends g {
|
|
|
77
77
|
this.store.recommendationConfigs.strategy !== t && this.store.patchCurrentBlockConfig({ strategy: e.strategy, filters: e.filters });
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
n.updateConfig(
|
|
81
|
+
this.api,
|
|
82
|
+
this.currentNode,
|
|
83
|
+
{ strategy: t },
|
|
84
|
+
`Changed algorithm to ${t}`
|
|
85
|
+
), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t);
|
|
81
86
|
}
|
|
82
87
|
_onProductIdsChange(t) {
|
|
83
88
|
if (!this.currentNode)
|
|
@@ -88,7 +93,12 @@ class R extends g {
|
|
|
88
93
|
return;
|
|
89
94
|
}
|
|
90
95
|
const o = t === "" ? [] : t.split(",");
|
|
91
|
-
|
|
96
|
+
n.updateConfig(
|
|
97
|
+
this.api,
|
|
98
|
+
this.currentNode,
|
|
99
|
+
{ productIds: o },
|
|
100
|
+
"Updated product IDs"
|
|
101
|
+
), this.store.patchCurrentBlockConfig({ productIds: o });
|
|
92
102
|
}
|
|
93
103
|
_listenToFormUpdates() {
|
|
94
104
|
this.api.onValueChanged(i.ALGORITHM, (t) => {
|