@useinsider/guido 3.22.0-beta.d4e1d48 → 3.22.0-beta.d762f04
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/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
- package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
- package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +121 -116
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
- package/dist/extensions/Blocks/common-control.js +62 -55
- package/dist/guido.css +1 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
- package/dist/src/stores/unsubscribe.d.ts +0 -10
- package/dist/stores/unsubscribe.js +29 -33
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
|
|
|
4
4
|
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
5
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
|
-
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
|
|
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 G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, 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
9
|
import { RecommendationConfigService as T } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
|
|
@@ -142,7 +142,7 @@ class se extends ut {
|
|
|
142
142
|
`;
|
|
143
143
|
}
|
|
144
144
|
onRender() {
|
|
145
|
-
this.
|
|
145
|
+
this.forgetLastPanelNode(), this._registerValueChangeListeners(), this._setupEventListeners(), this._updateOrderableState(), this._subscribeToStoreChanges();
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Card composition restructures the block (toggles/reorders/adds attribute
|
|
@@ -230,7 +230,7 @@ class se extends ut {
|
|
|
230
230
|
}
|
|
231
231
|
_hasTitle() {
|
|
232
232
|
var t;
|
|
233
|
-
return !!((t = this.currentNode) != null && t.querySelector(
|
|
233
|
+
return !!((t = this.currentNode) != null && t.querySelector(G));
|
|
234
234
|
}
|
|
235
235
|
_getDefaultVisibilities() {
|
|
236
236
|
return { ...X };
|
|
@@ -712,7 +712,7 @@ class se extends ut {
|
|
|
712
712
|
);
|
|
713
713
|
}
|
|
714
714
|
).join(""), ot = Ct(x, l).repeat(S - B);
|
|
715
|
-
return `<tr class="${
|
|
715
|
+
return `<tr class="${z}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
716
716
|
}
|
|
717
717
|
return this._getExistingRowHtml(u, j);
|
|
718
718
|
}).join("");
|
|
@@ -867,7 +867,7 @@ class se extends ut {
|
|
|
867
867
|
return t.length > 0 ? t : this._findTitleRowsByClass();
|
|
868
868
|
}
|
|
869
869
|
_findTitleRowsByClass() {
|
|
870
|
-
const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(
|
|
870
|
+
const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(G));
|
|
871
871
|
if (r === -1)
|
|
872
872
|
return [];
|
|
873
873
|
const i = e[r + 1];
|
|
@@ -974,7 +974,7 @@ class se extends ut {
|
|
|
974
974
|
const r = this.store.recommendationConfigs.orientation;
|
|
975
975
|
r !== t && (t = r, this._updateOrderableState());
|
|
976
976
|
const i = Object.keys(this.store.filterList).sort().join(",");
|
|
977
|
-
i !== e && (e = i, this._initializeComposition());
|
|
977
|
+
i !== e && (e = i, this.currentNode && this._initializeComposition());
|
|
978
978
|
});
|
|
979
979
|
}
|
|
980
980
|
/**
|
|
@@ -1027,7 +1027,7 @@ class se extends ut {
|
|
|
1027
1027
|
[i]: e,
|
|
1028
1028
|
product_attributes: { [i]: e }
|
|
1029
1029
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1030
|
-
return `<tr class="${
|
|
1030
|
+
return `<tr class="${z}" ${R}="${r}" ${D}="1">${l}</tr>`;
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
export {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { CommonControl as
|
|
2
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
3
3
|
import { RecommendationBlockId as n } from "../../constants/blockIds.js";
|
|
4
|
-
import { RecommendationControlId as
|
|
4
|
+
import { RecommendationControlId as m } from "../../constants/controlIds.js";
|
|
5
5
|
import { BLOCK_ROOT_SELECTOR as u, ATTR_PRODUCT_ATTR as a } from "../../constants/selectors.js";
|
|
6
|
-
import { CSS_CLASS_TEXT_TRIM as
|
|
6
|
+
import { CSS_CLASS_TEXT_TRIM as s, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
|
|
7
7
|
const i = {
|
|
8
8
|
TEXT_TRIM_ENABLED: "customAttrTextTrimEnabled"
|
|
9
9
|
};
|
|
10
|
-
class
|
|
10
|
+
class C extends l {
|
|
11
11
|
getId() {
|
|
12
|
-
return
|
|
12
|
+
return m.CUSTOM_ATTR_TEXT_TRIM;
|
|
13
13
|
}
|
|
14
14
|
getTemplate() {
|
|
15
15
|
return `
|
|
@@ -23,7 +23,7 @@ class g extends m {
|
|
|
23
23
|
`;
|
|
24
24
|
}
|
|
25
25
|
onRender() {
|
|
26
|
-
this.
|
|
26
|
+
this.forgetLastPanelNode(), this._listenToFormUpdates();
|
|
27
27
|
}
|
|
28
28
|
onTemplateNodeUpdated(t) {
|
|
29
29
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
@@ -39,10 +39,10 @@ class g extends m {
|
|
|
39
39
|
_getCurrentTrimState() {
|
|
40
40
|
if (!this.currentNode || !("hasClass" in this.currentNode))
|
|
41
41
|
return !1;
|
|
42
|
-
if (this.currentNode.hasClass(
|
|
42
|
+
if (this.currentNode.hasClass(s))
|
|
43
43
|
return !0;
|
|
44
44
|
const t = this._getTargetElements();
|
|
45
|
-
return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(
|
|
45
|
+
return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(s) : !1;
|
|
46
46
|
}
|
|
47
47
|
// ========================================================================
|
|
48
48
|
// Target Element Discovery (per-attribute scoping)
|
|
@@ -62,8 +62,8 @@ class g extends m {
|
|
|
62
62
|
return [];
|
|
63
63
|
const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(a) : null;
|
|
64
64
|
if (e) {
|
|
65
|
-
const
|
|
66
|
-
return Array.from(t.querySelectorAll(
|
|
65
|
+
const o = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
|
|
66
|
+
return Array.from(t.querySelectorAll(o));
|
|
67
67
|
}
|
|
68
68
|
return Array.from(
|
|
69
69
|
t.querySelectorAll(
|
|
@@ -80,8 +80,8 @@ class g extends m {
|
|
|
80
80
|
return;
|
|
81
81
|
t && c(this.api);
|
|
82
82
|
const r = this.api.getDocumentModifier();
|
|
83
|
-
e.forEach((
|
|
84
|
-
t ? r.modifyHtml(
|
|
83
|
+
e.forEach((o) => {
|
|
84
|
+
t ? r.modifyHtml(o).setClass(s) : r.modifyHtml(o).removeClass(s);
|
|
85
85
|
}), r.apply(
|
|
86
86
|
new T(
|
|
87
87
|
t ? "Enable custom attribute text trimming" : "Disable custom attribute text trimming"
|
|
@@ -95,5 +95,5 @@ class g extends m {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
export {
|
|
98
|
-
|
|
98
|
+
C as CustomAttributeTextTrimControl
|
|
99
99
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
|
-
var N = (u,
|
|
3
|
-
var s = (u,
|
|
2
|
+
var N = (u, c, e) => c in u ? _(u, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[c] = e;
|
|
3
|
+
var s = (u, c, e) => N(u, typeof c != "symbol" ? c + "" : c, e);
|
|
4
4
|
import { useConfig as g } from "../../../../../composables/useConfig.js";
|
|
5
5
|
import { ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
6
|
import { CommonControl as P } from "../../../common-control.js";
|
|
@@ -9,10 +9,10 @@ import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
|
|
|
9
9
|
import { RecommendationConfigService as l } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as k } from "../../store/recommendation.js";
|
|
11
11
|
import { refreshBlockOutsidePanel as S } from "../../utils/blockRefresh.js";
|
|
12
|
-
import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as m, hasEditedConfigChange as O, pickConfigDescription as b, isProductIdsChange as B, PRODUCT_IDS_DESCRIPTION as
|
|
12
|
+
import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as m, hasEditedConfigChange as O, pickConfigDescription as b, isProductIdsChange as B, PRODUCT_IDS_DESCRIPTION as L } from "../../utils/nodeConfigWriter.js";
|
|
13
13
|
import { AlgorithmControl as E } from "./algorithm.js";
|
|
14
14
|
import { ALGORITHM_CONTROL_ID as _e } from "./algorithm.js";
|
|
15
|
-
import { CurrencyControl as
|
|
15
|
+
import { CurrencyControl as F } from "./currency.js";
|
|
16
16
|
import { CURRENCY_CONTROL_ID as ye } from "./currency.js";
|
|
17
17
|
import { FiltersControl as D } from "./filters.js";
|
|
18
18
|
import { FILTERS_CONTROL_ID as Re } from "./filters.js";
|
|
@@ -20,18 +20,18 @@ import { LayoutOrientationControl as U } from "./layoutOrientation.js";
|
|
|
20
20
|
import { LAYOUT_ORIENTATION_CONTROL_ID as ke } from "./layoutOrientation.js";
|
|
21
21
|
import { LocaleControl as v } from "./locale.js";
|
|
22
22
|
import { LOCALE_CONTROL_ID as Te } from "./locale.js";
|
|
23
|
-
import { PricePlacementControl as
|
|
23
|
+
import { PricePlacementControl as A } from "./pricePlacement.js";
|
|
24
24
|
import { PRICE_PLACEMENT_CONTROL_ID as be } from "./pricePlacement.js";
|
|
25
|
-
import { ProductCountControl as
|
|
26
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
25
|
+
import { ProductCountControl as w } from "./productCount.js";
|
|
26
|
+
import { PRODUCT_COUNT_CONTROL_ID as Le } from "./productCount.js";
|
|
27
27
|
import { ProductLayoutControl as V } from "./productLayout.js";
|
|
28
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
28
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as Fe } from "./productLayout.js";
|
|
29
29
|
import { ShuffleControl as W } from "./shuffle.js";
|
|
30
30
|
import { SHUFFLE_CONTROL_ID as Ue } from "./shuffle.js";
|
|
31
31
|
import { StrategyControl as x } from "./strategy.js";
|
|
32
|
-
import { STRATEGY_CONTROL_ID as
|
|
33
|
-
import { setCurrencyAttributes as M, getBlockElement as G, isPartnerManagedBlock as
|
|
34
|
-
import { adjustProductsToSize as Ve, formatProductPrice as We, getCardComposition as xe, getCurrentLayout as Me, getMainContainerTbody as Ge, regenerateMobileProductRows as
|
|
32
|
+
import { STRATEGY_CONTROL_ID as Ae } from "./strategy.js";
|
|
33
|
+
import { setCurrencyAttributes as M, getBlockElement as G, isPartnerManagedBlock as $, updateProductContentInPlace as z, regenerateProductRowsWithStyles as H } from "./utils.js";
|
|
34
|
+
import { adjustProductsToSize as Ve, formatProductPrice as We, getCardComposition as xe, getCurrentLayout as Me, getMainContainerTbody as Ge, regenerateMobileProductRows as $e, updatePricesInPlace as ze, updateSingleProductContent as He } from "./utils.js";
|
|
35
35
|
import { useDebounceFn as C } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
36
36
|
const f = "Update recommendation filters", Y = "ui-elements-recommendation-block";
|
|
37
37
|
class me extends P {
|
|
@@ -69,11 +69,11 @@ class me extends P {
|
|
|
69
69
|
s(this, "_debouncedFetchProducts", C(async (e, t) => {
|
|
70
70
|
if (t !== this.panelGeneration)
|
|
71
71
|
return;
|
|
72
|
-
const
|
|
72
|
+
const n = this._getBlockConfigVersion(e);
|
|
73
73
|
try {
|
|
74
|
-
await (e === null ? this.store.fetchRecommendationProducts() : this.store.fetchRecommendationProductsForBlock(e)), t === this.panelGeneration && (this.fetchedConfigVersion = Math.max(this.fetchedConfigVersion,
|
|
74
|
+
await (e === null ? this.store.fetchRecommendationProducts() : this.store.fetchRecommendationProductsForBlock(e)), t === this.panelGeneration && (this.fetchedConfigVersion = Math.max(this.fetchedConfigVersion, n));
|
|
75
75
|
} finally {
|
|
76
|
-
t === this.panelGeneration &&
|
|
76
|
+
t === this.panelGeneration && n === this._getBlockConfigVersion(e) && this._scheduleConfigFlush();
|
|
77
77
|
}
|
|
78
78
|
}, 500));
|
|
79
79
|
/**
|
|
@@ -90,8 +90,8 @@ class me extends P {
|
|
|
90
90
|
s(this, "_debouncedRegenerateWithProducts", C((e) => {
|
|
91
91
|
if (e !== this.panelGeneration || !this.currentNode || !this.api)
|
|
92
92
|
return;
|
|
93
|
-
const t = this._getRecommendationIdFromNode(this.currentNode),
|
|
94
|
-
if (t === null ||
|
|
93
|
+
const t = this._getRecommendationIdFromNode(this.currentNode), n = this.store.currentRecommendationId;
|
|
94
|
+
if (t === null || n === null || t === n || !this.store.blockStates[t]) {
|
|
95
95
|
this.hasUnrenderedProducts = !1, this._regenerateWithProducts();
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
@@ -100,7 +100,7 @@ class me extends P {
|
|
|
100
100
|
try {
|
|
101
101
|
this._regenerateWithProducts();
|
|
102
102
|
} finally {
|
|
103
|
-
this.store.setCurrentBlock(
|
|
103
|
+
this.store.setCurrentBlock(n);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}, 100));
|
|
@@ -125,9 +125,9 @@ class me extends P {
|
|
|
125
125
|
getTemplate() {
|
|
126
126
|
var e;
|
|
127
127
|
return this.rrsEnabled = g().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
|
|
128
|
-
var
|
|
129
|
-
return (
|
|
130
|
-
}), this.algorithmControl = new E(), this.localeControl = new v(), this.currencyControl = new
|
|
128
|
+
var n;
|
|
129
|
+
return (n = t == null ? void 0 : t.onDestroy) == null ? void 0 : n.call(t);
|
|
130
|
+
}), this.algorithmControl = new E(), this.localeControl = new v(), this.currencyControl = new F(), this.productCountControl = new w(), this.productLayoutControl = new V(), this.filtersControl = new D(), this.shuffleControl = new W(), this.pricePlacementControl = new A(), this.layoutOrientationControl = new U(), this.strategyControl = this.rrsEnabled ? new x() : null, this._subControls.forEach((t) => {
|
|
131
131
|
t && (t.api = this.api);
|
|
132
132
|
}), `
|
|
133
133
|
<div class="recommendation-controls-container">
|
|
@@ -149,32 +149,25 @@ class me extends P {
|
|
|
149
149
|
const t = (r = this.getContainer()) == null ? void 0 : r.querySelector(".recommendation-controls-container");
|
|
150
150
|
if (!t)
|
|
151
151
|
return;
|
|
152
|
-
const
|
|
153
|
-
t.classList.toggle("strategy-block",
|
|
152
|
+
const n = this._getRecommendationIdFromNode(e) === null ? null : l.getConfig(e), o = this.rrsEnabled && !!n && (!!(n != null && n.strategyId) || ((n == null ? void 0 : n.configVersion) ?? 0) >= R), i = this.rrsEnabled && !!n && !o;
|
|
153
|
+
t.classList.toggle("strategy-block", o), t.classList.toggle("legacy-strategy-block", i);
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
T(this.api);
|
|
158
|
-
const e = this._getRecommendationIdFromNode(this.currentNode), t = e ?? this.store.currentRecommendationId;
|
|
159
|
-
if (t !== null && this.store.setCurrentBlock(t), e !== null && this._syncNodeConfigIfChanged(e), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender()), t !== null && ((o = this.store.blockStates[t]) != null && o.isInitialized)) {
|
|
160
|
-
this._initializeSubControls();
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
await this._fetchBlockData(t), this._initializeSubControls();
|
|
155
|
+
onRender() {
|
|
156
|
+
T(this.api), this.forgetLastPanelNode(), this._listenStateUpdates();
|
|
164
157
|
}
|
|
165
158
|
onTemplateNodeUpdated(e) {
|
|
166
|
-
var
|
|
159
|
+
var n;
|
|
167
160
|
super.onTemplateNodeUpdated(e);
|
|
168
161
|
const t = this._getRecommendationIdFromNode(e);
|
|
169
|
-
t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), t !== null && !((
|
|
162
|
+
t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), this._renderWithPanelNode(t), t !== null && !((n = this.store.blockStates[t]) != null && n.isInitialized) && this._fetchBlockData(t).then(() => {
|
|
170
163
|
this._initializeSubControls();
|
|
171
|
-
}), this._subControls.forEach((
|
|
164
|
+
}), this._subControls.forEach((o) => {
|
|
172
165
|
var i;
|
|
173
|
-
|
|
166
|
+
o != null && o.api && (o.currentNode = e, (i = o.onTemplateNodeUpdated) == null || i.call(o, e));
|
|
174
167
|
});
|
|
175
168
|
}
|
|
176
169
|
onDestroy() {
|
|
177
|
-
this.panelGeneration++, this.isPanelAlive = !1, this.storeUnsubscription(), this._finishBlockOutsidePanel(), this.hasUnrenderedProducts = !1, this._subControls.forEach((e) => {
|
|
170
|
+
this.panelGeneration++, this.isPanelAlive = !1, this.isAwaitingPanelNode = !1, this.storeUnsubscription(), this._finishBlockOutsidePanel(), this.hasUnrenderedProducts = !1, this._subControls.forEach((e) => {
|
|
178
171
|
var t;
|
|
179
172
|
return (t = e == null ? void 0 : e.onDestroy) == null ? void 0 : t.call(e);
|
|
180
173
|
});
|
|
@@ -184,11 +177,23 @@ class me extends P {
|
|
|
184
177
|
* Each sub-control manages its own form values and event listeners
|
|
185
178
|
*/
|
|
186
179
|
_initializeSubControls() {
|
|
187
|
-
this._subControls.forEach((e) => {
|
|
180
|
+
this.currentNode && this._subControls.forEach((e) => {
|
|
188
181
|
var t;
|
|
189
182
|
e && (e.api = this.api, e.currentNode = this.currentNode, (t = e.onRender) == null || t.call(e));
|
|
190
183
|
});
|
|
191
184
|
}
|
|
185
|
+
// The panel's own node, not the store's last focused block, decides what to render; the caller
|
|
186
|
+
// fetches an uninitialized block once its config is synced.
|
|
187
|
+
_renderWithPanelNode(e) {
|
|
188
|
+
var t;
|
|
189
|
+
if (!(!this.isAwaitingPanelNode || e === null)) {
|
|
190
|
+
if (this.isAwaitingPanelNode = !1, (t = this.store.blockStates[e]) != null && t.isInitialized) {
|
|
191
|
+
this._initializeSubControls();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender());
|
|
195
|
+
}
|
|
196
|
+
}
|
|
192
197
|
/**
|
|
193
198
|
* Syncs persisted node config into the Pinia store's block state.
|
|
194
199
|
*
|
|
@@ -219,8 +224,8 @@ class me extends P {
|
|
|
219
224
|
const t = this.store.blockStates[e];
|
|
220
225
|
if (!t)
|
|
221
226
|
return;
|
|
222
|
-
const
|
|
223
|
-
t.syncedConfigFingerprint =
|
|
227
|
+
const n = JSON.stringify(l.getConfig(this.currentNode)), o = t.syncedConfigFingerprint;
|
|
228
|
+
t.syncedConfigFingerprint = n, o !== n && ((i = this.pendingNodeConfigWrite) == null ? void 0 : i.blockId) !== e && this._syncNodeConfigToStore();
|
|
224
229
|
}
|
|
225
230
|
/** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
|
|
226
231
|
_isPendingStrategyIdChange() {
|
|
@@ -240,15 +245,15 @@ class me extends P {
|
|
|
240
245
|
return !e || t !== null && e.blockId !== t ? null : e;
|
|
241
246
|
}
|
|
242
247
|
_getNodeConfigUpdates(e) {
|
|
243
|
-
const { filters: t, strategy:
|
|
248
|
+
const { filters: t, strategy: n, strategyId: o, size: i, productIds: r, nodeConfigVersion: h } = e, { partnerName: d } = g();
|
|
244
249
|
return {
|
|
245
250
|
filters: t,
|
|
246
|
-
strategy:
|
|
247
|
-
strategyId:
|
|
251
|
+
strategy: n,
|
|
252
|
+
strategyId: o,
|
|
248
253
|
size: i,
|
|
249
254
|
productIds: r,
|
|
250
255
|
configVersion: h,
|
|
251
|
-
...
|
|
256
|
+
...d.value ? { partnerName: d.value } : {}
|
|
252
257
|
};
|
|
253
258
|
}
|
|
254
259
|
/**
|
|
@@ -287,8 +292,8 @@ class me extends P {
|
|
|
287
292
|
const e = this.pendingNodeConfigWrite;
|
|
288
293
|
if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !(!e || !this.api)) {
|
|
289
294
|
if (e.blockId !== this.store.currentRecommendationId || !this.currentNode) {
|
|
290
|
-
const { blockId: t, updates:
|
|
291
|
-
!m(t,
|
|
295
|
+
const { blockId: t, updates: n } = e;
|
|
296
|
+
!m(t, n, f) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
|
|
292
297
|
return;
|
|
293
298
|
}
|
|
294
299
|
O(this.currentNode, e.updates) && l.updateConfig(
|
|
@@ -307,11 +312,11 @@ class me extends P {
|
|
|
307
312
|
_pendingDescription() {
|
|
308
313
|
const e = this._pendingWriteForNode();
|
|
309
314
|
if (!(!e || !this.currentNode || !B(this.currentNode, e.updates)))
|
|
310
|
-
return
|
|
315
|
+
return L;
|
|
311
316
|
}
|
|
312
317
|
_syncNodeConfigToStore() {
|
|
313
|
-
var
|
|
314
|
-
const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId,
|
|
318
|
+
var o;
|
|
319
|
+
const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId, n = t !== null && ((o = this.store.blockStates[t]) == null ? void 0 : o.isInitialized);
|
|
315
320
|
this.store.patchCurrentBlockConfig({
|
|
316
321
|
strategy: e.strategy,
|
|
317
322
|
strategyId: e.strategyId,
|
|
@@ -326,7 +331,7 @@ class me extends P {
|
|
|
326
331
|
// Only sync filters from node config during initial load.
|
|
327
332
|
// After initialization, the Pinia store is the source of truth
|
|
328
333
|
// for filters (edited via the filter drawer).
|
|
329
|
-
...
|
|
334
|
+
...n ? {} : { filters: e.filters },
|
|
330
335
|
shuffleProducts: e.shuffleProducts,
|
|
331
336
|
priceMovedToNextLine: e.priceMovedToNextLine,
|
|
332
337
|
priceHideIfSameAsDiscounted: e.priceHideIfSameAsDiscounted,
|
|
@@ -347,27 +352,27 @@ class me extends P {
|
|
|
347
352
|
* 2. Smart defaults for new blocks (currency, algorithm) — sequential
|
|
348
353
|
* 3. Product data with correct defaults — sequential
|
|
349
354
|
*
|
|
350
|
-
*
|
|
355
|
+
* Called from onTemplateNodeUpdated() once the node config is synced.
|
|
351
356
|
* Marks the block as initialized to prevent redundant fetches on re-selection.
|
|
352
357
|
*/
|
|
353
358
|
async _fetchBlockData(e) {
|
|
354
359
|
if (e !== null && this.store.markBlockInitialized(e), (await Promise.allSettled([
|
|
355
360
|
this.store.fetchRecommendationCreateData(),
|
|
356
361
|
this.store.fetchRecommendationFilters()
|
|
357
|
-
])).forEach((
|
|
358
|
-
|
|
362
|
+
])).forEach((o, i) => {
|
|
363
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][i]} failed`, o.reason);
|
|
359
364
|
}), e !== null && this.store.currentRecommendationId !== e) {
|
|
360
365
|
this._refreshOutsidePanel(e, !0);
|
|
361
366
|
return;
|
|
362
367
|
}
|
|
363
368
|
this._applySmartDefaults();
|
|
364
|
-
const
|
|
369
|
+
const n = this._getBlockConfigVersion(e);
|
|
365
370
|
try {
|
|
366
371
|
await this.store.fetchRecommendationProducts();
|
|
367
|
-
} catch (
|
|
368
|
-
console.warn("Recommendation block: fetchRecommendationProducts failed",
|
|
372
|
+
} catch (o) {
|
|
373
|
+
console.warn("Recommendation block: fetchRecommendationProducts failed", o);
|
|
369
374
|
}
|
|
370
|
-
e !== null && !this._isPanelOn(e) && this._refreshOutsidePanel(e, this._getBlockConfigVersion(e) !==
|
|
375
|
+
e !== null && !this._isPanelOn(e) && this._refreshOutsidePanel(e, this._getBlockConfigVersion(e) !== n);
|
|
371
376
|
}
|
|
372
377
|
_isPanelOn(e) {
|
|
373
378
|
return this.isPanelAlive && this.store.currentRecommendationId === e;
|
|
@@ -386,51 +391,51 @@ class me extends P {
|
|
|
386
391
|
if (!this.currentNode || !this.api)
|
|
387
392
|
return;
|
|
388
393
|
const e = l.getConfig(this.currentNode), t = {};
|
|
389
|
-
let
|
|
394
|
+
let n = null, o = null, i = null;
|
|
390
395
|
if (e.currency.code === a.currency.code) {
|
|
391
396
|
const { currencyList: r } = this.store;
|
|
392
397
|
r.length > 0 && (r.some(
|
|
393
|
-
(
|
|
394
|
-
) || (
|
|
398
|
+
(d) => d.value === `price.${a.currency.code}`
|
|
399
|
+
) || (n = r[0].value.replace("price.", ""), t.currency = {
|
|
395
400
|
...a.currency,
|
|
396
|
-
code:
|
|
397
|
-
symbol:
|
|
401
|
+
code: n,
|
|
402
|
+
symbol: n
|
|
398
403
|
}));
|
|
399
404
|
}
|
|
400
405
|
if (e.strategy === a.strategy) {
|
|
401
406
|
const r = this.store.getActivePredictiveAlgorithms;
|
|
402
407
|
r.length > 0 && (r.some(
|
|
403
|
-
(
|
|
404
|
-
) || (
|
|
408
|
+
(d) => d.value === a.strategy
|
|
409
|
+
) || (o = r[0].value, t.strategy = o));
|
|
405
410
|
}
|
|
406
411
|
if (e.language === a.language) {
|
|
407
412
|
const r = this.store.getLanguages;
|
|
408
413
|
r.length > 0 && (r.some(
|
|
409
|
-
(
|
|
414
|
+
(d) => d.value === a.language
|
|
410
415
|
) || (i = r[0].value, t.language = i));
|
|
411
416
|
}
|
|
412
|
-
!
|
|
417
|
+
!n && !o && !i || (l.updateConfig(
|
|
413
418
|
this.api,
|
|
414
419
|
this.currentNode,
|
|
415
420
|
t,
|
|
416
421
|
"Applied smart defaults"
|
|
417
|
-
),
|
|
422
|
+
), n && t.currency && M({
|
|
418
423
|
currentNode: this.currentNode,
|
|
419
424
|
documentModifier: this.api.getDocumentModifier(),
|
|
420
425
|
currency: t.currency
|
|
421
426
|
}), this.store.patchCurrentBlockConfig({
|
|
422
|
-
...
|
|
427
|
+
...n ? {
|
|
423
428
|
currencySettings: {
|
|
424
|
-
name:
|
|
425
|
-
value:
|
|
426
|
-
symbol:
|
|
429
|
+
name: n,
|
|
430
|
+
value: n,
|
|
431
|
+
symbol: n,
|
|
427
432
|
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
428
433
|
decimalCount: a.currency.decimalCount.toString(),
|
|
429
434
|
decimalSeparator: a.currency.decimalSeparator,
|
|
430
435
|
thousandSeparator: a.currency.thousandSeparator
|
|
431
436
|
}
|
|
432
437
|
} : {},
|
|
433
|
-
...
|
|
438
|
+
...o ? { strategy: o } : {},
|
|
434
439
|
...i ? { language: i } : {}
|
|
435
440
|
}, { triggerRefetch: !1 }));
|
|
436
441
|
}
|
|
@@ -441,30 +446,30 @@ class me extends P {
|
|
|
441
446
|
const t = G(e);
|
|
442
447
|
if (!t || !("getAttribute" in t))
|
|
443
448
|
return null;
|
|
444
|
-
const
|
|
445
|
-
if (!
|
|
449
|
+
const n = t.getAttribute(I);
|
|
450
|
+
if (!n)
|
|
446
451
|
return null;
|
|
447
|
-
const
|
|
448
|
-
return Number.isNaN(
|
|
452
|
+
const o = parseInt(n);
|
|
453
|
+
return Number.isNaN(o) ? null : o;
|
|
449
454
|
}
|
|
450
455
|
/**
|
|
451
456
|
* Lands what the panel still owes its block before it stops watching it: the config now, the
|
|
452
457
|
* products through a block-scoped refresh. Never throws — it runs from Stripo's teardown.
|
|
453
458
|
*/
|
|
454
|
-
_finishBlockOutsidePanel({ blockId: e, fetchedConfigVersion: t, hasUnrenderedProducts:
|
|
459
|
+
_finishBlockOutsidePanel({ blockId: e, fetchedConfigVersion: t, hasUnrenderedProducts: n } = this._trackedBlockSnapshot()) {
|
|
455
460
|
try {
|
|
456
461
|
this._flushPendingNodeConfig();
|
|
457
|
-
const
|
|
458
|
-
if (e === null || !
|
|
462
|
+
const o = e === null ? void 0 : this.store.blockStates[e];
|
|
463
|
+
if (e === null || !o)
|
|
459
464
|
return;
|
|
460
|
-
const i = t !==
|
|
465
|
+
const i = t !== o.configVersion;
|
|
461
466
|
i && !m(
|
|
462
467
|
e,
|
|
463
|
-
this._getNodeConfigUpdates(
|
|
468
|
+
this._getNodeConfigUpdates(o.recommendationConfigs),
|
|
464
469
|
f
|
|
465
|
-
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i ||
|
|
466
|
-
} catch (
|
|
467
|
-
console.error("[recommendation] finishing the block outside the panel failed",
|
|
470
|
+
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || n) && this._refreshOutsidePanel(e, i);
|
|
471
|
+
} catch (o) {
|
|
472
|
+
console.error("[recommendation] finishing the block outside the panel failed", o);
|
|
468
473
|
}
|
|
469
474
|
}
|
|
470
475
|
_trackedBlockSnapshot() {
|
|
@@ -476,13 +481,13 @@ class me extends P {
|
|
|
476
481
|
}
|
|
477
482
|
_refreshOutsidePanel(e, t) {
|
|
478
483
|
S(e, {
|
|
479
|
-
pickUpdates: (
|
|
484
|
+
pickUpdates: (n) => this._getNodeConfigUpdates(n),
|
|
480
485
|
description: "Update recommendation configuration",
|
|
481
486
|
fetch: t
|
|
482
|
-
}).then((
|
|
483
|
-
!
|
|
484
|
-
}).catch((
|
|
485
|
-
console.error("[recommendation] refresh outside the panel failed",
|
|
487
|
+
}).then((n) => {
|
|
488
|
+
!n && this.store.blockStates[e] && console.error("[recommendation] refresh outside the panel did not reach a node", { blockId: e });
|
|
489
|
+
}).catch((n) => {
|
|
490
|
+
console.error("[recommendation] refresh outside the panel failed", n);
|
|
486
491
|
});
|
|
487
492
|
}
|
|
488
493
|
_getBlockConfigVersion(e) {
|
|
@@ -497,25 +502,25 @@ class me extends P {
|
|
|
497
502
|
this.hasUnrenderedProducts = !0;
|
|
498
503
|
return;
|
|
499
504
|
}
|
|
500
|
-
const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(),
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
new y(
|
|
505
|
+
const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(), n = this._pendingDescription(), o = this._stagePendingNodeConfig(t);
|
|
506
|
+
if ($(this.currentNode)) {
|
|
507
|
+
o && (t.apply(
|
|
508
|
+
new y(n ?? "Update recommendation configuration")
|
|
504
509
|
), this._consumePendingNodeConfig());
|
|
505
510
|
return;
|
|
506
511
|
}
|
|
507
|
-
|
|
512
|
+
z({
|
|
508
513
|
currentNode: this.currentNode,
|
|
509
514
|
documentModifier: t,
|
|
510
515
|
products: e,
|
|
511
|
-
description:
|
|
512
|
-
onApplied:
|
|
516
|
+
description: n,
|
|
517
|
+
onApplied: o ? () => this._consumePendingNodeConfig() : void 0
|
|
513
518
|
}) || H({
|
|
514
519
|
currentNode: this.currentNode,
|
|
515
520
|
documentModifier: t,
|
|
516
521
|
products: e,
|
|
517
|
-
description:
|
|
518
|
-
}) &&
|
|
522
|
+
description: n
|
|
523
|
+
}) && o && this._consumePendingNodeConfig();
|
|
519
524
|
}
|
|
520
525
|
// Spent only once it landed with the cards (never when another block's write stayed unstaged):
|
|
521
526
|
// kept alive, it blocks the store resync an Undo needs and the flush writes the undone ids back.
|
|
@@ -537,18 +542,18 @@ class me extends P {
|
|
|
537
542
|
*/
|
|
538
543
|
_listenStateUpdates() {
|
|
539
544
|
const { store: e } = this;
|
|
540
|
-
let t = e.recommendationProducts,
|
|
541
|
-
this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion =
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
545
|
+
let t = e.recommendationProducts, n = this._getBlockConfigVersion(e.currentRecommendationId);
|
|
546
|
+
this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion = n, this.hasUnrenderedProducts = !1, this.storeUnsubscription = e.$subscribe(() => {
|
|
547
|
+
const o = e.currentRecommendationId;
|
|
548
|
+
if (o !== this.trackedBlockId) {
|
|
544
549
|
const p = this._trackedBlockSnapshot();
|
|
545
|
-
this.panelGeneration++, this.trackedBlockId =
|
|
550
|
+
this.panelGeneration++, this.trackedBlockId = o, t = e.recommendationProducts, n = this._getBlockConfigVersion(o), this.fetchedConfigVersion = n, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(p);
|
|
546
551
|
return;
|
|
547
552
|
}
|
|
548
|
-
const i = this._getBlockConfigVersion(
|
|
549
|
-
i !==
|
|
550
|
-
const r = e.recommendationProducts, h = r !== t,
|
|
551
|
-
h &&
|
|
553
|
+
const i = this._getBlockConfigVersion(o);
|
|
554
|
+
i !== n && (n = i, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(o, this.panelGeneration));
|
|
555
|
+
const r = e.recommendationProducts, h = r !== t, d = Array.isArray(r) && r.length > 0;
|
|
556
|
+
h && d && (t = r, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
|
|
552
557
|
});
|
|
553
558
|
}
|
|
554
559
|
}
|
|
@@ -557,7 +562,7 @@ export {
|
|
|
557
562
|
E as AlgorithmControl,
|
|
558
563
|
Y as CONTROL_BLOCK_ID,
|
|
559
564
|
ye as CURRENCY_CONTROL_ID,
|
|
560
|
-
|
|
565
|
+
F as CurrencyControl,
|
|
561
566
|
Re as FILTERS_CONTROL_ID,
|
|
562
567
|
D as FiltersControl,
|
|
563
568
|
ke as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
@@ -565,14 +570,14 @@ export {
|
|
|
565
570
|
U as LayoutOrientationControl,
|
|
566
571
|
v as LocaleControl,
|
|
567
572
|
be as PRICE_PLACEMENT_CONTROL_ID,
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
573
|
+
Le as PRODUCT_COUNT_CONTROL_ID,
|
|
574
|
+
Fe as PRODUCT_LAYOUT_CONTROL_ID,
|
|
575
|
+
A as PricePlacementControl,
|
|
576
|
+
w as ProductCountControl,
|
|
572
577
|
V as ProductLayoutControl,
|
|
573
578
|
me as RecommendationBlockControl,
|
|
574
579
|
Ue as SHUFFLE_CONTROL_ID,
|
|
575
|
-
|
|
580
|
+
Ae as STRATEGY_CONTROL_ID,
|
|
576
581
|
W as ShuffleControl,
|
|
577
582
|
x as StrategyControl,
|
|
578
583
|
Ve as adjustProductsToSize,
|
|
@@ -581,11 +586,11 @@ export {
|
|
|
581
586
|
xe as getCardComposition,
|
|
582
587
|
Me as getCurrentLayout,
|
|
583
588
|
Ge as getMainContainerTbody,
|
|
584
|
-
|
|
585
|
-
|
|
589
|
+
$ as isPartnerManagedBlock,
|
|
590
|
+
$e as regenerateMobileProductRows,
|
|
586
591
|
H as regenerateProductRowsWithStyles,
|
|
587
592
|
M as setCurrencyAttributes,
|
|
588
|
-
|
|
589
|
-
|
|
593
|
+
ze as updatePricesInPlace,
|
|
594
|
+
z as updateProductContentInPlace,
|
|
590
595
|
He as updateSingleProductContent
|
|
591
596
|
};
|