@useinsider/guido 3.21.0 → 3.21.1-beta.18ab939
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 +34 -4
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +118 -108
- package/dist/composables/useEditorOpenMetrics.js +164 -0
- package/dist/composables/useStripo.js +94 -82
- package/dist/config/compiler/htmlCompilerRules.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +209 -139
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +18 -23
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +171 -141
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +68 -59
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +249 -248
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +62 -45
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +52 -31
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -10
- package/dist/package.json.js +6 -4
- package/dist/public/prefetchRuntime.js +4 -0
- package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +23 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +5 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +11 -0
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/prefetchRuntime.d.ts +1 -0
- package/dist/src/utils/runtimePrefetch.d.ts +4 -0
- package/dist/src/utils/stripoRuntime.d.ts +2 -0
- package/dist/static/stripo-runtime-manifest.json.js +9 -0
- package/dist/static/styles/components/tabs.css.js +5 -0
- package/dist/utils/runtimePrefetch.js +26 -0
- package/dist/utils/stripoRuntime.js +9 -0
- package/package.json +7 -2
|
@@ -1,79 +1,79 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var N = (u, d, e) => d in u ? _(u, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[d] = e;
|
|
3
|
+
var s = (u, d, e) => N(u, typeof d != "symbol" ? d + "" : d, e);
|
|
4
4
|
import { useConfig as g } from "../../../../../composables/useConfig.js";
|
|
5
|
-
import { ModificationDescription as
|
|
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";
|
|
7
7
|
import { RRS_CONFIG_VERSION as R, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
8
|
-
import { RECOMMENDATION_ID_ATTR as
|
|
8
|
+
import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
|
|
9
9
|
import { RecommendationConfigService as l } from "../../services/configService.js";
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
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 b } from "../../utils/nodeConfigWriter.js";
|
|
13
|
-
import { AlgorithmControl as
|
|
14
|
-
import { ALGORITHM_CONTROL_ID as
|
|
15
|
-
import { CurrencyControl as
|
|
16
|
-
import { CURRENCY_CONTROL_ID as
|
|
17
|
-
import { FiltersControl as
|
|
18
|
-
import { FILTERS_CONTROL_ID as
|
|
19
|
-
import { LayoutOrientationControl as
|
|
20
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
21
|
-
import { LocaleControl as
|
|
22
|
-
import { LOCALE_CONTROL_ID as
|
|
23
|
-
import { PricePlacementControl as
|
|
24
|
-
import { PRICE_PLACEMENT_CONTROL_ID as
|
|
25
|
-
import { ProductCountControl as
|
|
26
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
27
|
-
import { ProductLayoutControl as
|
|
28
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
29
|
-
import { ShuffleControl as
|
|
30
|
-
import { SHUFFLE_CONTROL_ID as
|
|
31
|
-
import { StrategyControl as
|
|
32
|
-
import { STRATEGY_CONTROL_ID as
|
|
33
|
-
import { setCurrencyAttributes as
|
|
34
|
-
import { adjustProductsToSize as
|
|
12
|
+
import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as m, hasEditedConfigChange as O, pickConfigDescription as b, isProductIdsChange as B, PRODUCT_IDS_DESCRIPTION as F } from "../../utils/nodeConfigWriter.js";
|
|
13
|
+
import { AlgorithmControl as E } from "./algorithm.js";
|
|
14
|
+
import { ALGORITHM_CONTROL_ID as _e } from "./algorithm.js";
|
|
15
|
+
import { CurrencyControl as L } from "./currency.js";
|
|
16
|
+
import { CURRENCY_CONTROL_ID as ye } from "./currency.js";
|
|
17
|
+
import { FiltersControl as D } from "./filters.js";
|
|
18
|
+
import { FILTERS_CONTROL_ID as Re } from "./filters.js";
|
|
19
|
+
import { LayoutOrientationControl as U } from "./layoutOrientation.js";
|
|
20
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as ke } from "./layoutOrientation.js";
|
|
21
|
+
import { LocaleControl as v } from "./locale.js";
|
|
22
|
+
import { LOCALE_CONTROL_ID as Te } from "./locale.js";
|
|
23
|
+
import { PricePlacementControl as w } from "./pricePlacement.js";
|
|
24
|
+
import { PRICE_PLACEMENT_CONTROL_ID as be } from "./pricePlacement.js";
|
|
25
|
+
import { ProductCountControl as A } from "./productCount.js";
|
|
26
|
+
import { PRODUCT_COUNT_CONTROL_ID as Fe } from "./productCount.js";
|
|
27
|
+
import { ProductLayoutControl as V } from "./productLayout.js";
|
|
28
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as Le } from "./productLayout.js";
|
|
29
|
+
import { ShuffleControl as W } from "./shuffle.js";
|
|
30
|
+
import { SHUFFLE_CONTROL_ID as Ue } from "./shuffle.js";
|
|
31
|
+
import { StrategyControl as x } from "./strategy.js";
|
|
32
|
+
import { STRATEGY_CONTROL_ID as we } from "./strategy.js";
|
|
33
|
+
import { setCurrencyAttributes as M, getBlockElement as G, isPartnerManagedBlock as z, updateProductContentInPlace as $, 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 ze, updatePricesInPlace as $e, updateSingleProductContent as He } from "./utils.js";
|
|
35
35
|
import { useDebounceFn as C } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
36
|
-
const f = "Update recommendation filters",
|
|
37
|
-
class
|
|
36
|
+
const f = "Update recommendation filters", Y = "ui-elements-recommendation-block";
|
|
37
|
+
class me extends P {
|
|
38
38
|
constructor() {
|
|
39
39
|
super(...arguments);
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
s(this, "store", k());
|
|
41
|
+
s(this, "storeUnsubscription", () => {
|
|
42
42
|
});
|
|
43
43
|
// A config change waiting to reach the node config. Deferred so it can ride the
|
|
44
44
|
// re-render's single apply() — one user action must cost one undo press.
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
s(this, "pendingNodeConfigWrite", null);
|
|
46
|
+
s(this, "pendingConfigFlushTimer", null);
|
|
47
47
|
// What the panel still owes the block it watches — finished outside the panel on teardown
|
|
48
48
|
// and block switch. A new generation tells debounced work queued for the old one to stand down.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
s(this, "trackedBlockId", null);
|
|
50
|
+
s(this, "fetchedConfigVersion", 0);
|
|
51
|
+
s(this, "hasUnrenderedProducts", !1);
|
|
52
|
+
s(this, "panelGeneration", 0);
|
|
53
|
+
s(this, "isPanelAlive", !0);
|
|
54
54
|
// Sub-control instances for lifecycle management
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
s(this, "algorithmControl", null);
|
|
56
|
+
s(this, "localeControl", null);
|
|
57
|
+
s(this, "currencyControl", null);
|
|
58
|
+
s(this, "productCountControl", null);
|
|
59
|
+
s(this, "productLayoutControl", null);
|
|
60
|
+
s(this, "filtersControl", null);
|
|
61
|
+
s(this, "shuffleControl", null);
|
|
62
|
+
s(this, "pricePlacementControl", null);
|
|
63
|
+
s(this, "layoutOrientationControl", null);
|
|
64
|
+
s(this, "strategyControl", null);
|
|
65
|
+
s(this, "rrsEnabled", !1);
|
|
66
66
|
/**
|
|
67
67
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
s(this, "_debouncedFetchProducts", C(async (e, t) => {
|
|
70
70
|
if (t !== this.panelGeneration)
|
|
71
71
|
return;
|
|
72
72
|
const o = this._getBlockConfigVersion(e);
|
|
73
73
|
try {
|
|
74
74
|
await (e === null ? this.store.fetchRecommendationProducts() : this.store.fetchRecommendationProductsForBlock(e)), t === this.panelGeneration && (this.fetchedConfigVersion = Math.max(this.fetchedConfigVersion, o));
|
|
75
75
|
} finally {
|
|
76
|
-
t === this.panelGeneration && this._scheduleConfigFlush();
|
|
76
|
+
t === this.panelGeneration && o === this._getBlockConfigVersion(e) && this._scheduleConfigFlush();
|
|
77
77
|
}
|
|
78
78
|
}, 500));
|
|
79
79
|
/**
|
|
@@ -87,7 +87,7 @@ class he extends P {
|
|
|
87
87
|
* count. The store pads products to the configured size, so in-place only
|
|
88
88
|
* fails when the size actually changed.
|
|
89
89
|
*/
|
|
90
|
-
|
|
90
|
+
s(this, "_debouncedRegenerateWithProducts", C((e) => {
|
|
91
91
|
if (e !== this.panelGeneration || !this.currentNode || !this.api)
|
|
92
92
|
return;
|
|
93
93
|
const t = this._getRecommendationIdFromNode(this.currentNode), o = this.store.currentRecommendationId;
|
|
@@ -106,7 +106,7 @@ class he extends P {
|
|
|
106
106
|
}, 100));
|
|
107
107
|
}
|
|
108
108
|
getId() {
|
|
109
|
-
return
|
|
109
|
+
return Y;
|
|
110
110
|
}
|
|
111
111
|
get _subControls() {
|
|
112
112
|
return [
|
|
@@ -127,7 +127,7 @@ class he extends P {
|
|
|
127
127
|
return this.rrsEnabled = g().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
|
|
128
128
|
var o;
|
|
129
129
|
return (o = t == null ? void 0 : t.onDestroy) == null ? void 0 : o.call(t);
|
|
130
|
-
}), this.algorithmControl = new
|
|
130
|
+
}), this.algorithmControl = new E(), this.localeControl = new v(), this.currencyControl = new L(), this.productCountControl = new A(), this.productLayoutControl = new V(), this.filtersControl = new D(), this.shuffleControl = new W(), this.pricePlacementControl = new w(), 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">
|
|
@@ -145,12 +145,12 @@ class he extends P {
|
|
|
145
145
|
`;
|
|
146
146
|
}
|
|
147
147
|
_showControlsForBlock(e) {
|
|
148
|
-
var
|
|
149
|
-
const t = (
|
|
148
|
+
var r;
|
|
149
|
+
const t = (r = this.getContainer()) == null ? void 0 : r.querySelector(".recommendation-controls-container");
|
|
150
150
|
if (!t)
|
|
151
151
|
return;
|
|
152
|
-
const o = this._getRecommendationIdFromNode(e) === null ? null : l.getConfig(e), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= R),
|
|
153
|
-
t.classList.toggle("strategy-block", n), t.classList.toggle("legacy-strategy-block",
|
|
152
|
+
const o = this._getRecommendationIdFromNode(e) === null ? null : l.getConfig(e), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= R), i = this.rrsEnabled && !!o && !n;
|
|
153
|
+
t.classList.toggle("strategy-block", n), t.classList.toggle("legacy-strategy-block", i);
|
|
154
154
|
}
|
|
155
155
|
async onRender() {
|
|
156
156
|
var o;
|
|
@@ -169,8 +169,8 @@ class he extends P {
|
|
|
169
169
|
t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), t !== null && !((o = this.store.blockStates[t]) != null && o.isInitialized) && this._fetchBlockData(t).then(() => {
|
|
170
170
|
this._initializeSubControls();
|
|
171
171
|
}), this._subControls.forEach((n) => {
|
|
172
|
-
var
|
|
173
|
-
n != null && n.api && (n.currentNode = e, (
|
|
172
|
+
var i;
|
|
173
|
+
n != null && n.api && (n.currentNode = e, (i = n.onTemplateNodeUpdated) == null || i.call(n, e));
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
onDestroy() {
|
|
@@ -214,13 +214,13 @@ class he extends P {
|
|
|
214
214
|
* state was rebuilt with (SD-150347).
|
|
215
215
|
*/
|
|
216
216
|
_syncNodeConfigIfChanged(e) {
|
|
217
|
-
var
|
|
217
|
+
var i;
|
|
218
218
|
this.pendingNodeConfigWrite && this.pendingNodeConfigWrite.blockId !== e && this._flushPendingNodeConfig();
|
|
219
219
|
const t = this.store.blockStates[e];
|
|
220
220
|
if (!t)
|
|
221
221
|
return;
|
|
222
222
|
const o = JSON.stringify(l.getConfig(this.currentNode)), n = t.syncedConfigFingerprint;
|
|
223
|
-
t.syncedConfigFingerprint = o, n !== o && ((
|
|
223
|
+
t.syncedConfigFingerprint = o, n !== o && ((i = this.pendingNodeConfigWrite) == null ? void 0 : i.blockId) !== e && this._syncNodeConfigToStore();
|
|
224
224
|
}
|
|
225
225
|
/** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
|
|
226
226
|
_isPendingStrategyIdChange() {
|
|
@@ -229,20 +229,26 @@ class he extends P {
|
|
|
229
229
|
}
|
|
230
230
|
_capturePendingNodeConfigWrite() {
|
|
231
231
|
const e = this.store.currentRecommendationId, t = e === null ? void 0 : this.store.blockStates[e];
|
|
232
|
-
!this.currentNode || !this.api || e === null || !t || (this.pendingNodeConfigWrite = {
|
|
232
|
+
!this.currentNode || !this.api || e === null || !t || (this._clearConfigFlush(), this.pendingNodeConfigWrite = {
|
|
233
233
|
blockId: e,
|
|
234
234
|
updates: this._getNodeConfigUpdates(t.recommendationConfigs)
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
+
/** The pending write only when it belongs to the node this panel draws: a duplicate focuses the copy. */
|
|
238
|
+
_pendingWriteForNode() {
|
|
239
|
+
const e = this.pendingNodeConfigWrite, t = this._getRecommendationIdFromNode(this.currentNode);
|
|
240
|
+
return !e || t !== null && e.blockId !== t ? null : e;
|
|
241
|
+
}
|
|
237
242
|
_getNodeConfigUpdates(e) {
|
|
238
|
-
const { filters: t, strategy: o, strategyId: n, size: r, nodeConfigVersion:
|
|
243
|
+
const { filters: t, strategy: o, strategyId: n, size: i, productIds: r, nodeConfigVersion: h } = e, { partnerName: c } = g();
|
|
239
244
|
return {
|
|
240
245
|
filters: t,
|
|
241
246
|
strategy: o,
|
|
242
247
|
strategyId: n,
|
|
243
|
-
size:
|
|
244
|
-
|
|
245
|
-
|
|
248
|
+
size: i,
|
|
249
|
+
productIds: r,
|
|
250
|
+
configVersion: h,
|
|
251
|
+
...c.value ? { partnerName: c.value } : {}
|
|
246
252
|
};
|
|
247
253
|
}
|
|
248
254
|
/**
|
|
@@ -256,7 +262,7 @@ class he extends P {
|
|
|
256
262
|
* @returns Whether anything was staged
|
|
257
263
|
*/
|
|
258
264
|
_stagePendingNodeConfig(e) {
|
|
259
|
-
const t = this.
|
|
265
|
+
const t = this._pendingWriteForNode();
|
|
260
266
|
return !t || !this.currentNode ? !1 : (l.stageConfig(e, this.currentNode, t.updates), !0);
|
|
261
267
|
}
|
|
262
268
|
/**
|
|
@@ -285,14 +291,24 @@ class he extends P {
|
|
|
285
291
|
!m(t, o, f) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
|
|
286
292
|
return;
|
|
287
293
|
}
|
|
288
|
-
|
|
294
|
+
O(this.currentNode, e.updates) && l.updateConfig(
|
|
289
295
|
this.api,
|
|
290
296
|
this.currentNode,
|
|
291
297
|
e.updates,
|
|
292
|
-
f
|
|
298
|
+
b(this.currentNode, e.updates, f)
|
|
293
299
|
);
|
|
294
300
|
}
|
|
295
301
|
}
|
|
302
|
+
_cardsPredatePendingWrite() {
|
|
303
|
+
const e = this._pendingWriteForNode();
|
|
304
|
+
return e !== null && this.fetchedConfigVersion < this._getBlockConfigVersion(e.blockId);
|
|
305
|
+
}
|
|
306
|
+
/** The Product Ids label when the pending write moves the node's ids; the caller's default otherwise. */
|
|
307
|
+
_pendingDescription() {
|
|
308
|
+
const e = this._pendingWriteForNode();
|
|
309
|
+
if (!(!e || !this.currentNode || !B(this.currentNode, e.updates)))
|
|
310
|
+
return F;
|
|
311
|
+
}
|
|
296
312
|
_syncNodeConfigToStore() {
|
|
297
313
|
var n;
|
|
298
314
|
const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId, o = t !== null && ((n = this.store.blockStates[t]) == null ? void 0 : n.isInitialized);
|
|
@@ -338,8 +354,8 @@ class he extends P {
|
|
|
338
354
|
if (e !== null && this.store.markBlockInitialized(e), (await Promise.allSettled([
|
|
339
355
|
this.store.fetchRecommendationCreateData(),
|
|
340
356
|
this.store.fetchRecommendationFilters()
|
|
341
|
-
])).forEach((n,
|
|
342
|
-
n.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][
|
|
357
|
+
])).forEach((n, i) => {
|
|
358
|
+
n.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][i]} failed`, n.reason);
|
|
343
359
|
}), e !== null && this.store.currentRecommendationId !== e) {
|
|
344
360
|
this._refreshOutsidePanel(e, !0);
|
|
345
361
|
return;
|
|
@@ -370,35 +386,35 @@ class he extends P {
|
|
|
370
386
|
if (!this.currentNode || !this.api)
|
|
371
387
|
return;
|
|
372
388
|
const e = l.getConfig(this.currentNode), t = {};
|
|
373
|
-
let o = null, n = null,
|
|
389
|
+
let o = null, n = null, i = null;
|
|
374
390
|
if (e.currency.code === a.currency.code) {
|
|
375
|
-
const { currencyList:
|
|
376
|
-
|
|
377
|
-
(
|
|
378
|
-
) || (o =
|
|
391
|
+
const { currencyList: r } = this.store;
|
|
392
|
+
r.length > 0 && (r.some(
|
|
393
|
+
(c) => c.value === `price.${a.currency.code}`
|
|
394
|
+
) || (o = r[0].value.replace("price.", ""), t.currency = {
|
|
379
395
|
...a.currency,
|
|
380
396
|
code: o,
|
|
381
397
|
symbol: o
|
|
382
398
|
}));
|
|
383
399
|
}
|
|
384
400
|
if (e.strategy === a.strategy) {
|
|
385
|
-
const
|
|
386
|
-
|
|
387
|
-
(
|
|
388
|
-
) || (n =
|
|
401
|
+
const r = this.store.getActivePredictiveAlgorithms;
|
|
402
|
+
r.length > 0 && (r.some(
|
|
403
|
+
(c) => c.value === a.strategy
|
|
404
|
+
) || (n = r[0].value, t.strategy = n));
|
|
389
405
|
}
|
|
390
406
|
if (e.language === a.language) {
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
(
|
|
394
|
-
) || (
|
|
407
|
+
const r = this.store.getLanguages;
|
|
408
|
+
r.length > 0 && (r.some(
|
|
409
|
+
(c) => c.value === a.language
|
|
410
|
+
) || (i = r[0].value, t.language = i));
|
|
395
411
|
}
|
|
396
|
-
!o && !n && !
|
|
412
|
+
!o && !n && !i || (l.updateConfig(
|
|
397
413
|
this.api,
|
|
398
414
|
this.currentNode,
|
|
399
415
|
t,
|
|
400
416
|
"Applied smart defaults"
|
|
401
|
-
), o && t.currency &&
|
|
417
|
+
), o && t.currency && M({
|
|
402
418
|
currentNode: this.currentNode,
|
|
403
419
|
documentModifier: this.api.getDocumentModifier(),
|
|
404
420
|
currency: t.currency
|
|
@@ -415,17 +431,17 @@ class he extends P {
|
|
|
415
431
|
}
|
|
416
432
|
} : {},
|
|
417
433
|
...n ? { strategy: n } : {},
|
|
418
|
-
...
|
|
434
|
+
...i ? { language: i } : {}
|
|
419
435
|
}, { triggerRefetch: !1 }));
|
|
420
436
|
}
|
|
421
437
|
/**
|
|
422
438
|
* Reads the recommendation-id attribute from the block element within the node
|
|
423
439
|
*/
|
|
424
440
|
_getRecommendationIdFromNode(e) {
|
|
425
|
-
const t =
|
|
441
|
+
const t = G(e);
|
|
426
442
|
if (!t || !("getAttribute" in t))
|
|
427
443
|
return null;
|
|
428
|
-
const o = t.getAttribute(
|
|
444
|
+
const o = t.getAttribute(I);
|
|
429
445
|
if (!o)
|
|
430
446
|
return null;
|
|
431
447
|
const n = parseInt(o);
|
|
@@ -441,12 +457,12 @@ class he extends P {
|
|
|
441
457
|
const n = e === null ? void 0 : this.store.blockStates[e];
|
|
442
458
|
if (e === null || !n)
|
|
443
459
|
return;
|
|
444
|
-
const
|
|
445
|
-
|
|
460
|
+
const i = t !== n.configVersion;
|
|
461
|
+
i && !m(
|
|
446
462
|
e,
|
|
447
463
|
this._getNodeConfigUpdates(n.recommendationConfigs),
|
|
448
464
|
f
|
|
449
|
-
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (
|
|
465
|
+
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || o) && this._refreshOutsidePanel(e, i);
|
|
450
466
|
} catch (n) {
|
|
451
467
|
console.error("[recommendation] finishing the block outside the panel failed", n);
|
|
452
468
|
}
|
|
@@ -477,20 +493,34 @@ class he extends P {
|
|
|
477
493
|
_regenerateWithProducts() {
|
|
478
494
|
if (!this.currentNode || !this.api)
|
|
479
495
|
return;
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
496
|
+
if (this._cardsPredatePendingWrite()) {
|
|
497
|
+
this.hasUnrenderedProducts = !0;
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(), o = this._pendingDescription(), n = this._stagePendingNodeConfig(t);
|
|
501
|
+
if (z(this.currentNode)) {
|
|
502
|
+
n && (t.apply(
|
|
503
|
+
new y(o ?? "Update recommendation configuration")
|
|
504
|
+
), this._consumePendingNodeConfig());
|
|
483
505
|
return;
|
|
484
506
|
}
|
|
485
|
-
|
|
507
|
+
$({
|
|
486
508
|
currentNode: this.currentNode,
|
|
487
509
|
documentModifier: t,
|
|
488
|
-
products: e
|
|
489
|
-
|
|
510
|
+
products: e,
|
|
511
|
+
description: o,
|
|
512
|
+
onApplied: n ? () => this._consumePendingNodeConfig() : void 0
|
|
513
|
+
}) || H({
|
|
490
514
|
currentNode: this.currentNode,
|
|
491
515
|
documentModifier: t,
|
|
492
|
-
products: e
|
|
493
|
-
|
|
516
|
+
products: e,
|
|
517
|
+
description: o
|
|
518
|
+
}) && n && this._consumePendingNodeConfig();
|
|
519
|
+
}
|
|
520
|
+
// Spent only once it landed with the cards (never when another block's write stayed unstaged):
|
|
521
|
+
// kept alive, it blocks the store resync an Undo needs and the flush writes the undone ids back.
|
|
522
|
+
_consumePendingNodeConfig() {
|
|
523
|
+
this.pendingNodeConfigWrite = null, this._clearConfigFlush();
|
|
494
524
|
}
|
|
495
525
|
/**
|
|
496
526
|
* Listen to store changes that require product refresh or regeneration.
|
|
@@ -515,47 +545,47 @@ class he extends P {
|
|
|
515
545
|
this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(p);
|
|
516
546
|
return;
|
|
517
547
|
}
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
|
|
548
|
+
const i = this._getBlockConfigVersion(n);
|
|
549
|
+
i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(n, this.panelGeneration));
|
|
550
|
+
const r = e.recommendationProducts, h = r !== t, c = Array.isArray(r) && r.length > 0;
|
|
551
|
+
h && c && (t = r, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
|
|
522
552
|
});
|
|
523
553
|
}
|
|
524
554
|
}
|
|
525
555
|
export {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
556
|
+
_e as ALGORITHM_CONTROL_ID,
|
|
557
|
+
E as AlgorithmControl,
|
|
558
|
+
Y as CONTROL_BLOCK_ID,
|
|
559
|
+
ye as CURRENCY_CONTROL_ID,
|
|
560
|
+
L as CurrencyControl,
|
|
561
|
+
Re as FILTERS_CONTROL_ID,
|
|
562
|
+
D as FiltersControl,
|
|
563
|
+
ke as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
564
|
+
Te as LOCALE_CONTROL_ID,
|
|
565
|
+
U as LayoutOrientationControl,
|
|
566
|
+
v as LocaleControl,
|
|
567
|
+
be as PRICE_PLACEMENT_CONTROL_ID,
|
|
568
|
+
Fe as PRODUCT_COUNT_CONTROL_ID,
|
|
569
|
+
Le as PRODUCT_LAYOUT_CONTROL_ID,
|
|
570
|
+
w as PricePlacementControl,
|
|
571
|
+
A as ProductCountControl,
|
|
572
|
+
V as ProductLayoutControl,
|
|
573
|
+
me as RecommendationBlockControl,
|
|
574
|
+
Ue as SHUFFLE_CONTROL_ID,
|
|
575
|
+
we as STRATEGY_CONTROL_ID,
|
|
576
|
+
W as ShuffleControl,
|
|
577
|
+
x as StrategyControl,
|
|
578
|
+
Ve as adjustProductsToSize,
|
|
579
|
+
We as formatProductPrice,
|
|
580
|
+
G as getBlockElement,
|
|
581
|
+
xe as getCardComposition,
|
|
582
|
+
Me as getCurrentLayout,
|
|
583
|
+
Ge as getMainContainerTbody,
|
|
584
|
+
z as isPartnerManagedBlock,
|
|
585
|
+
ze as regenerateMobileProductRows,
|
|
586
|
+
H as regenerateProductRowsWithStyles,
|
|
587
|
+
M as setCurrencyAttributes,
|
|
588
|
+
$e as updatePricesInPlace,
|
|
589
|
+
$ as updateProductContentInPlace,
|
|
590
|
+
He as updateSingleProductContent
|
|
561
591
|
};
|