@useinsider/guido 3.17.0-beta.e6704da → 3.17.0-beta.ea65303
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 -1
- package/dist/@types/config/schemas.js +31 -35
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +77 -77
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +74 -43
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +48 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useCustomInterfaceAppearance.js +16 -19
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +2 -0
- package/dist/composables/useRecommendation.js +34 -41
- package/dist/composables/useSave.js +84 -41
- package/dist/composables/useSaveValidation.js +279 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/config/migrator/recommendationMigrator.js +4 -6
- package/dist/enums/academy.js +1 -2
- package/dist/enums/date.js +3 -4
- package/dist/enums/extensions/recommendationBlock.js +23 -25
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +11 -13
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +154 -156
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +82 -223
- package/dist/extensions/Blocks/common-control.js +19 -22
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +29 -78
- package/dist/src/@types/config/schemas.d.ts +4 -12
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- package/dist/src/components/organisms/{extensions/recommendation/AssignStrategyDrawer.vue.d.ts → validation/ValidationErrorDrawer.vue.d.ts} +0 -1
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -14
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +15 -214
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
- package/dist/src/services/recommendationApi.d.ts +1 -4
- package/dist/src/stores/config.d.ts +30 -18
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/stores/config.js +39 -22
- package/dist/stores/save-validation.js +30 -0
- package/dist/utils/dateUtil.js +10 -23
- package/dist/utils/templatePreparation.js +50 -50
- package/package.json +1 -2
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -70
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +0 -20
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +0 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -141
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +0 -24
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -29
- package/dist/src/mock/api/recommendation-strategies.d.ts +0 -43
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -171
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as ut } from "./layoutOrientation.js";
|
|
1
|
+
var f = Object.defineProperty;
|
|
2
|
+
var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
|
|
3
|
+
var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
+
import { CommonControl as g } from "../../../common-control.js";
|
|
5
|
+
import { DEFAULT_NODE_CONFIG as c } from "../../constants/defaultConfig.js";
|
|
6
|
+
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
|
+
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as tt } from "./algorithm.js";
|
|
10
|
+
import { CurrencyControl as R } from "./currency.js";
|
|
11
|
+
import { CURRENCY_CONTROL_ID as ot } from "./currency.js";
|
|
12
|
+
import { FiltersControl as I } from "./filters.js";
|
|
13
|
+
import { FILTERS_CONTROL_ID as nt } from "./filters.js";
|
|
14
|
+
import { LayoutOrientationControl as _ } from "./layoutOrientation.js";
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as st } from "./layoutOrientation.js";
|
|
17
16
|
import { LocaleControl as b } from "./locale.js";
|
|
18
|
-
import { LOCALE_CONTROL_ID as
|
|
19
|
-
import { PricePlacementControl as
|
|
20
|
-
import { PRICE_PLACEMENT_CONTROL_ID as
|
|
21
|
-
import { ProductCountControl as
|
|
22
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
17
|
+
import { LOCALE_CONTROL_ID as lt } from "./locale.js";
|
|
18
|
+
import { PricePlacementControl as T } from "./pricePlacement.js";
|
|
19
|
+
import { PRICE_PLACEMENT_CONTROL_ID as ut } from "./pricePlacement.js";
|
|
20
|
+
import { ProductCountControl as O } from "./productCount.js";
|
|
21
|
+
import { PRODUCT_COUNT_CONTROL_ID as ht } from "./productCount.js";
|
|
23
22
|
import { ProductLayoutControl as P } from "./productLayout.js";
|
|
24
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
25
|
-
import { ShuffleControl as
|
|
26
|
-
import { SHUFFLE_CONTROL_ID as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const x = "recommendation-id", B = "ui-elements-recommendation-block";
|
|
33
|
-
class et extends y {
|
|
23
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as Ct } from "./productLayout.js";
|
|
24
|
+
import { ShuffleControl as S } from "./shuffle.js";
|
|
25
|
+
import { SHUFFLE_CONTROL_ID as pt } from "./shuffle.js";
|
|
26
|
+
import { setCurrencyAttributes as L, getBlockElement as k, isPartnerManagedBlock as D, updateProductContentInPlace as E, regenerateProductRowsWithStyles as A } from "./utils.js";
|
|
27
|
+
import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It, regenerateMobileProductRows as _t, updatePricesInPlace as bt, updateSingleProductContent as Tt } from "./utils.js";
|
|
28
|
+
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
29
|
+
const v = "recommendation-id", w = "ui-elements-recommendation-block";
|
|
30
|
+
class Q extends g {
|
|
34
31
|
constructor() {
|
|
35
32
|
super(...arguments);
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
s(this, "store", y());
|
|
34
|
+
s(this, "storeUnsubscription", () => {
|
|
38
35
|
});
|
|
39
|
-
|
|
36
|
+
s(this, "syncedBlockIds", /* @__PURE__ */ new Set());
|
|
40
37
|
// Sub-control instances for lifecycle management
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
n(this, "strategyControl", null);
|
|
38
|
+
s(this, "algorithmControl", null);
|
|
39
|
+
s(this, "localeControl", null);
|
|
40
|
+
s(this, "currencyControl", null);
|
|
41
|
+
s(this, "productCountControl", null);
|
|
42
|
+
s(this, "productLayoutControl", null);
|
|
43
|
+
s(this, "filtersControl", null);
|
|
44
|
+
s(this, "shuffleControl", null);
|
|
45
|
+
s(this, "pricePlacementControl", null);
|
|
46
|
+
s(this, "layoutOrientationControl", null);
|
|
51
47
|
/**
|
|
52
48
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
53
49
|
*/
|
|
54
|
-
|
|
50
|
+
s(this, "_debouncedFetchProducts", m(() => {
|
|
55
51
|
this.store.fetchRecommendationProducts();
|
|
56
52
|
}, 500));
|
|
57
53
|
/**
|
|
@@ -65,16 +61,16 @@ class et extends y {
|
|
|
65
61
|
* count. The store pads products to the configured size, so in-place only
|
|
66
62
|
* fails when the size actually changed.
|
|
67
63
|
*/
|
|
68
|
-
|
|
64
|
+
s(this, "_debouncedRegenerateWithProducts", m(() => {
|
|
69
65
|
const t = this.store.recommendationProducts;
|
|
70
|
-
if (!this.currentNode || !this.api ||
|
|
66
|
+
if (!this.currentNode || !this.api || D(this.currentNode))
|
|
71
67
|
return;
|
|
72
68
|
const e = this.api.getDocumentModifier();
|
|
73
|
-
|
|
69
|
+
E({
|
|
74
70
|
currentNode: this.currentNode,
|
|
75
71
|
documentModifier: e,
|
|
76
72
|
products: t
|
|
77
|
-
}) ||
|
|
73
|
+
}) || A({
|
|
78
74
|
currentNode: this.currentNode,
|
|
79
75
|
documentModifier: e,
|
|
80
76
|
products: t
|
|
@@ -82,40 +78,22 @@ class et extends y {
|
|
|
82
78
|
}, 100));
|
|
83
79
|
}
|
|
84
80
|
getId() {
|
|
85
|
-
return
|
|
81
|
+
return w;
|
|
86
82
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return [
|
|
90
|
-
this.layoutOrientationControl,
|
|
91
|
-
this.productCountControl,
|
|
83
|
+
getTemplate() {
|
|
84
|
+
return this.algorithmControl = new N(), this.localeControl = new b(), this.currencyControl = new R(), this.productCountControl = new O(), this.productLayoutControl = new P(), this.filtersControl = new I(), this.shuffleControl = new S(), this.pricePlacementControl = new T(), this.layoutOrientationControl = new _(), [
|
|
92
85
|
this.algorithmControl,
|
|
93
86
|
this.localeControl,
|
|
94
87
|
this.currencyControl,
|
|
88
|
+
this.productCountControl,
|
|
95
89
|
this.productLayoutControl,
|
|
96
90
|
this.filtersControl,
|
|
97
91
|
this.shuffleControl,
|
|
98
92
|
this.pricePlacementControl,
|
|
99
|
-
this.
|
|
100
|
-
]
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const t = p().isFeatureEnabled("reusableRecommendationStrategy");
|
|
104
|
-
return this._subControls.forEach((e) => {
|
|
105
|
-
var o;
|
|
106
|
-
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
107
|
-
}), this.algorithmControl = t ? null : new _(), this.localeControl = new b(), this.currencyControl = new I(), this.productCountControl = t ? null : new S(), this.productLayoutControl = new P(), this.filtersControl = t ? null : new R(), this.shuffleControl = t ? null : new L(), this.pricePlacementControl = new O(), this.layoutOrientationControl = new T(), this.strategyControl = t ? new k() : null, this._subControls.forEach((e) => {
|
|
108
|
-
e && (e.api = this.api);
|
|
109
|
-
}), t ? `
|
|
110
|
-
<div class="recommendation-controls-container">
|
|
111
|
-
${this.strategyControl.getTemplate()}
|
|
112
|
-
${this.layoutOrientationControl.getTemplate()}
|
|
113
|
-
${this.localeControl.getTemplate()}
|
|
114
|
-
${this.currencyControl.getTemplate()}
|
|
115
|
-
${this.pricePlacementControl.getTemplate()}
|
|
116
|
-
${this.productLayoutControl.getTemplate()}
|
|
117
|
-
</div>
|
|
118
|
-
` : `
|
|
93
|
+
this.layoutOrientationControl
|
|
94
|
+
].forEach((e) => {
|
|
95
|
+
e.api = this.api;
|
|
96
|
+
}), `
|
|
119
97
|
<div class="recommendation-controls-container">
|
|
120
98
|
${this.layoutOrientationControl.getTemplate()}
|
|
121
99
|
${this.productCountControl.getTemplate()}
|
|
@@ -139,20 +117,40 @@ class et extends y {
|
|
|
139
117
|
await this._fetchBlockData(e), this._initializeSubControls();
|
|
140
118
|
}
|
|
141
119
|
onTemplateNodeUpdated(t) {
|
|
142
|
-
var
|
|
120
|
+
var r;
|
|
143
121
|
super.onTemplateNodeUpdated(t);
|
|
144
122
|
const e = this._getRecommendationIdFromNode(t);
|
|
145
|
-
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && !this.syncedBlockIds.has(e) && (this.syncedBlockIds.add(e), this._syncNodeConfigToStore()), e !== null && !((
|
|
123
|
+
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && !this.syncedBlockIds.has(e) && (this.syncedBlockIds.add(e), this._syncNodeConfigToStore()), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e).then(() => {
|
|
146
124
|
this._initializeSubControls();
|
|
147
|
-
}),
|
|
148
|
-
|
|
149
|
-
|
|
125
|
+
}), [
|
|
126
|
+
this.layoutOrientationControl,
|
|
127
|
+
this.productCountControl,
|
|
128
|
+
this.algorithmControl,
|
|
129
|
+
this.localeControl,
|
|
130
|
+
this.currencyControl,
|
|
131
|
+
this.productLayoutControl,
|
|
132
|
+
this.filtersControl,
|
|
133
|
+
this.shuffleControl,
|
|
134
|
+
this.pricePlacementControl
|
|
135
|
+
].forEach((n) => {
|
|
136
|
+
var i;
|
|
137
|
+
n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
|
|
150
138
|
});
|
|
151
139
|
}
|
|
152
140
|
onDestroy() {
|
|
153
|
-
this.storeUnsubscription(),
|
|
154
|
-
|
|
155
|
-
|
|
141
|
+
this.storeUnsubscription(), [
|
|
142
|
+
this.layoutOrientationControl,
|
|
143
|
+
this.productCountControl,
|
|
144
|
+
this.algorithmControl,
|
|
145
|
+
this.localeControl,
|
|
146
|
+
this.currencyControl,
|
|
147
|
+
this.productLayoutControl,
|
|
148
|
+
this.filtersControl,
|
|
149
|
+
this.shuffleControl,
|
|
150
|
+
this.pricePlacementControl
|
|
151
|
+
].forEach((e) => {
|
|
152
|
+
var o;
|
|
153
|
+
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
156
154
|
});
|
|
157
155
|
}
|
|
158
156
|
/**
|
|
@@ -160,9 +158,19 @@ class et extends y {
|
|
|
160
158
|
* Each sub-control manages its own form values and event listeners
|
|
161
159
|
*/
|
|
162
160
|
_initializeSubControls() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
[
|
|
162
|
+
this.layoutOrientationControl,
|
|
163
|
+
this.productCountControl,
|
|
164
|
+
this.algorithmControl,
|
|
165
|
+
this.localeControl,
|
|
166
|
+
this.currencyControl,
|
|
167
|
+
this.productLayoutControl,
|
|
168
|
+
this.filtersControl,
|
|
169
|
+
this.shuffleControl,
|
|
170
|
+
this.pricePlacementControl
|
|
171
|
+
].forEach((e) => {
|
|
172
|
+
var o;
|
|
173
|
+
e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
|
|
166
174
|
});
|
|
167
175
|
}
|
|
168
176
|
/**
|
|
@@ -178,10 +186,9 @@ class et extends y {
|
|
|
178
186
|
*/
|
|
179
187
|
_syncNodeConfigToStore() {
|
|
180
188
|
var r;
|
|
181
|
-
const t =
|
|
189
|
+
const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
182
190
|
this.store.patchCurrentBlockConfig({
|
|
183
191
|
strategy: t.strategy,
|
|
184
|
-
strategyId: t.strategyId,
|
|
185
192
|
language: t.language,
|
|
186
193
|
size: t.size,
|
|
187
194
|
productIds: t.productIds,
|
|
@@ -242,36 +249,36 @@ class et extends y {
|
|
|
242
249
|
_applySmartDefaults() {
|
|
243
250
|
if (!this.currentNode || !this.api)
|
|
244
251
|
return;
|
|
245
|
-
const t =
|
|
246
|
-
let o = null, r = null,
|
|
247
|
-
if (t.currency.code ===
|
|
252
|
+
const t = h.getConfig(this.currentNode), e = {};
|
|
253
|
+
let o = null, r = null, n = null;
|
|
254
|
+
if (t.currency.code === c.currency.code) {
|
|
248
255
|
const { currencyList: i } = this.store;
|
|
249
256
|
i.length > 0 && (i.some(
|
|
250
|
-
(u) => u.value === `price.${
|
|
257
|
+
(u) => u.value === `price.${c.currency.code}`
|
|
251
258
|
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
252
|
-
...
|
|
259
|
+
...c.currency,
|
|
253
260
|
code: o,
|
|
254
261
|
symbol: o
|
|
255
262
|
}));
|
|
256
263
|
}
|
|
257
|
-
if (t.strategy ===
|
|
264
|
+
if (t.strategy === c.strategy) {
|
|
258
265
|
const i = this.store.getActivePredictiveAlgorithms;
|
|
259
266
|
i.length > 0 && (i.some(
|
|
260
|
-
(u) => u.value ===
|
|
267
|
+
(u) => u.value === c.strategy
|
|
261
268
|
) || (r = i[0].value, e.strategy = r));
|
|
262
269
|
}
|
|
263
|
-
if (t.language ===
|
|
270
|
+
if (t.language === c.language) {
|
|
264
271
|
const i = this.store.getLanguages;
|
|
265
272
|
i.length > 0 && (i.some(
|
|
266
|
-
(u) => u.value ===
|
|
267
|
-
) || (
|
|
273
|
+
(u) => u.value === c.language
|
|
274
|
+
) || (n = i[0].value, e.language = n));
|
|
268
275
|
}
|
|
269
|
-
!o && !r && !
|
|
276
|
+
!o && !r && !n || (h.updateConfig(
|
|
270
277
|
this.api,
|
|
271
278
|
this.currentNode,
|
|
272
279
|
e,
|
|
273
280
|
"Applied smart defaults"
|
|
274
|
-
), o && e.currency &&
|
|
281
|
+
), o && e.currency && L({
|
|
275
282
|
currentNode: this.currentNode,
|
|
276
283
|
documentModifier: this.api.getDocumentModifier(),
|
|
277
284
|
currency: e.currency
|
|
@@ -281,24 +288,24 @@ class et extends y {
|
|
|
281
288
|
name: o,
|
|
282
289
|
value: o,
|
|
283
290
|
symbol: o,
|
|
284
|
-
alignment:
|
|
285
|
-
decimalCount:
|
|
286
|
-
decimalSeparator:
|
|
287
|
-
thousandSeparator:
|
|
291
|
+
alignment: c.currency.alignment === "before" ? "0" : "1",
|
|
292
|
+
decimalCount: c.currency.decimalCount.toString(),
|
|
293
|
+
decimalSeparator: c.currency.decimalSeparator,
|
|
294
|
+
thousandSeparator: c.currency.thousandSeparator
|
|
288
295
|
}
|
|
289
296
|
} : {},
|
|
290
297
|
...r ? { strategy: r } : {},
|
|
291
|
-
...
|
|
298
|
+
...n ? { language: n } : {}
|
|
292
299
|
}, { triggerRefetch: !1 }));
|
|
293
300
|
}
|
|
294
301
|
/**
|
|
295
302
|
* Reads the recommendation-id attribute from the block element within the node
|
|
296
303
|
*/
|
|
297
304
|
_getRecommendationIdFromNode(t) {
|
|
298
|
-
const e =
|
|
305
|
+
const e = k(t);
|
|
299
306
|
if (!e || !("getAttribute" in e))
|
|
300
307
|
return null;
|
|
301
|
-
const o = e.getAttribute(
|
|
308
|
+
const o = e.getAttribute(v);
|
|
302
309
|
if (!o)
|
|
303
310
|
return null;
|
|
304
311
|
const r = parseInt(o);
|
|
@@ -321,73 +328,64 @@ class et extends y {
|
|
|
321
328
|
const { store: t } = this;
|
|
322
329
|
let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
|
|
323
330
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
r =
|
|
331
|
+
const n = t.currentRecommendationId;
|
|
332
|
+
if (n !== r) {
|
|
333
|
+
r = n, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
327
334
|
return;
|
|
328
335
|
}
|
|
329
336
|
const i = t.$state.configVersion;
|
|
330
337
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
331
|
-
const
|
|
332
|
-
u &&
|
|
338
|
+
const a = t.recommendationProducts, u = a !== e, C = Array.isArray(a) && a.length > 0;
|
|
339
|
+
u && C && (e = a, this._debouncedRegenerateWithProducts());
|
|
333
340
|
});
|
|
334
341
|
}
|
|
335
342
|
/**
|
|
336
|
-
* Persists the current filter
|
|
337
|
-
*
|
|
338
|
-
* (strategyId must be in esd-ext-config before any save — SD-149105).
|
|
339
|
-
*
|
|
340
|
-
* `size` rides along because assigning a strategy overwrites it in the
|
|
341
|
-
* store only. Without this write, `_syncNodeConfigToStore` re-seeds the
|
|
342
|
-
* store from the stale node config on the next panel open, and a block
|
|
343
|
-
* whose saved HTML has the strategy's slot count gets rebuilt against the
|
|
344
|
-
* old one — resetting migrator-applied per-element styles.
|
|
343
|
+
* Persists the current filter state from Pinia store to the Stripo node config.
|
|
344
|
+
* This ensures filters survive template save/reload cycles.
|
|
345
345
|
*/
|
|
346
346
|
_persistFiltersToNodeConfig() {
|
|
347
347
|
if (!this.currentNode || !this.api)
|
|
348
348
|
return;
|
|
349
|
-
const { filters: t
|
|
350
|
-
JSON.stringify(
|
|
349
|
+
const { filters: t } = this.store.recommendationConfigs, e = h.getConfig(this.currentNode).filters;
|
|
350
|
+
JSON.stringify(e) !== JSON.stringify(t) && h.updateConfig(
|
|
351
351
|
this.api,
|
|
352
352
|
this.currentNode,
|
|
353
|
-
{ filters: t
|
|
353
|
+
{ filters: t },
|
|
354
354
|
"Update recommendation filters"
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
export {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
359
|
+
tt as ALGORITHM_CONTROL_ID,
|
|
360
|
+
N as AlgorithmControl,
|
|
361
|
+
w as CONTROL_BLOCK_ID,
|
|
362
|
+
ot as CURRENCY_CONTROL_ID,
|
|
363
|
+
R as CurrencyControl,
|
|
364
|
+
nt as FILTERS_CONTROL_ID,
|
|
365
|
+
I as FiltersControl,
|
|
366
|
+
st as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
367
|
+
lt as LOCALE_CONTROL_ID,
|
|
368
|
+
_ as LayoutOrientationControl,
|
|
369
369
|
b as LocaleControl,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
370
|
+
ut as PRICE_PLACEMENT_CONTROL_ID,
|
|
371
|
+
ht as PRODUCT_COUNT_CONTROL_ID,
|
|
372
|
+
Ct as PRODUCT_LAYOUT_CONTROL_ID,
|
|
373
|
+
T as PricePlacementControl,
|
|
374
|
+
O as ProductCountControl,
|
|
375
375
|
P as ProductLayoutControl,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
A as updateProductContentInPlace,
|
|
392
|
-
Dt as updateSingleProductContent
|
|
376
|
+
Q as RecommendationBlockControl,
|
|
377
|
+
pt as SHUFFLE_CONTROL_ID,
|
|
378
|
+
S as ShuffleControl,
|
|
379
|
+
yt as adjustProductsToSize,
|
|
380
|
+
Nt as formatProductPrice,
|
|
381
|
+
k as getBlockElement,
|
|
382
|
+
Rt as getCardComposition,
|
|
383
|
+
It as getCurrentLayout,
|
|
384
|
+
D as isPartnerManagedBlock,
|
|
385
|
+
_t as regenerateMobileProductRows,
|
|
386
|
+
A as regenerateProductRowsWithStyles,
|
|
387
|
+
L as setCurrencyAttributes,
|
|
388
|
+
bt as updatePricesInPlace,
|
|
389
|
+
E as updateProductContentInPlace,
|
|
390
|
+
Tt as updateSingleProductContent
|
|
393
391
|
};
|