@useinsider/guido 3.17.0-beta.e23d5cd → 3.17.0-beta.e324492
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/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +59 -57
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/composables/useStripo.js +14 -14
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendationMigrator.js +30 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/extensions/Blocks/Recommendation/block.js +12 -11
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +24 -22
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +329 -257
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +127 -113
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +37 -26
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
- package/dist/guido.css +1 -1
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +38 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/utils/templatePreparation.js +37 -36
- package/package.json +1 -1
|
@@ -1,65 +1,69 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
2
|
var C = (h, l, t) => l in h ? m(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t;
|
|
3
|
-
var
|
|
3
|
+
var n = (h, l, t) => C(h, typeof l != "symbol" ? l + "" : l, t);
|
|
4
4
|
import { useConfig as p } 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 N } from "../../../common-control.js";
|
|
7
7
|
import { CURRENT_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
8
|
+
import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
|
|
8
9
|
import { RecommendationConfigService as c } from "../../services/configService.js";
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
10
|
+
import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
|
|
11
|
+
import { registerNodeConfigWriter as b } from "../../utils/nodeConfigWriter.js";
|
|
12
|
+
import { AlgorithmControl as T } from "./algorithm.js";
|
|
13
|
+
import { ALGORITHM_CONTROL_ID as ut } from "./algorithm.js";
|
|
14
|
+
import { CurrencyControl as P } from "./currency.js";
|
|
15
|
+
import { CURRENCY_CONTROL_ID as ht } from "./currency.js";
|
|
16
|
+
import { FiltersControl as S } from "./filters.js";
|
|
17
|
+
import { FILTERS_CONTROL_ID as gt } from "./filters.js";
|
|
18
|
+
import { LayoutOrientationControl as O } from "./layoutOrientation.js";
|
|
19
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as Ct } from "./layoutOrientation.js";
|
|
20
|
+
import { LocaleControl as L } from "./locale.js";
|
|
21
|
+
import { LOCALE_CONTROL_ID as yt } from "./locale.js";
|
|
22
|
+
import { PricePlacementControl as E } from "./pricePlacement.js";
|
|
23
|
+
import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
|
|
24
|
+
import { ProductCountControl as k } from "./productCount.js";
|
|
25
|
+
import { PRODUCT_COUNT_CONTROL_ID as Rt } from "./productCount.js";
|
|
26
|
+
import { ProductLayoutControl as F } from "./productLayout.js";
|
|
27
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as Tt } from "./productLayout.js";
|
|
28
|
+
import { ShuffleControl as D } from "./shuffle.js";
|
|
29
|
+
import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
|
|
30
|
+
import { StrategyControl as w } from "./strategy.js";
|
|
31
|
+
import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
|
|
32
|
+
import { setCurrencyAttributes as A, getBlockElement as v, isPartnerManagedBlock as x, updateProductContentInPlace as B, regenerateProductRowsWithStyles as U } from "./utils.js";
|
|
33
|
+
import { adjustProductsToSize as kt, formatProductPrice as Ft, getCardComposition as Dt, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
|
|
32
34
|
import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
33
|
-
const
|
|
34
|
-
class
|
|
35
|
+
const $ = "ui-elements-recommendation-block";
|
|
36
|
+
class at extends N {
|
|
35
37
|
constructor() {
|
|
36
38
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
n(this, "store", R());
|
|
40
|
+
n(this, "storeUnsubscription", () => {
|
|
39
41
|
});
|
|
40
|
-
// blockId -> fingerprint of the node config as it looked at the last sync.
|
|
41
|
-
r(this, "syncedConfigs", /* @__PURE__ */ new Map());
|
|
42
42
|
// A config change waiting to reach the node config. Deferred so it can ride the
|
|
43
43
|
// re-render's single apply() — one user action must cost one undo press.
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
n(this, "pendingNodeConfigWrite", null);
|
|
45
|
+
n(this, "pendingConfigFlushTimer", null);
|
|
46
46
|
// Sub-control instances for lifecycle management
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
n(this, "algorithmControl", null);
|
|
48
|
+
n(this, "localeControl", null);
|
|
49
|
+
n(this, "currencyControl", null);
|
|
50
|
+
n(this, "productCountControl", null);
|
|
51
|
+
n(this, "productLayoutControl", null);
|
|
52
|
+
n(this, "filtersControl", null);
|
|
53
|
+
n(this, "shuffleControl", null);
|
|
54
|
+
n(this, "pricePlacementControl", null);
|
|
55
|
+
n(this, "layoutOrientationControl", null);
|
|
56
|
+
n(this, "strategyControl", null);
|
|
57
|
+
n(this, "rrsEnabled", !1);
|
|
58
58
|
/**
|
|
59
59
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
60
60
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
n(this, "_debouncedFetchProducts", f(async () => {
|
|
62
|
+
try {
|
|
63
|
+
await this.store.fetchRecommendationProducts();
|
|
64
|
+
} finally {
|
|
65
|
+
this._scheduleConfigFlush();
|
|
66
|
+
}
|
|
63
67
|
}, 500));
|
|
64
68
|
/**
|
|
65
69
|
* Debounced content update when products arrive from API.
|
|
@@ -72,20 +76,20 @@ class rt extends N {
|
|
|
72
76
|
* count. The store pads products to the configured size, so in-place only
|
|
73
77
|
* fails when the size actually changed.
|
|
74
78
|
*/
|
|
75
|
-
|
|
79
|
+
n(this, "_debouncedRegenerateWithProducts", f(() => {
|
|
76
80
|
const t = this.store.recommendationProducts;
|
|
77
81
|
if (!this.currentNode || !this.api)
|
|
78
82
|
return;
|
|
79
83
|
const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
|
|
80
|
-
if (
|
|
84
|
+
if (x(this.currentNode)) {
|
|
81
85
|
o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
|
|
82
86
|
return;
|
|
83
87
|
}
|
|
84
|
-
|
|
88
|
+
B({
|
|
85
89
|
currentNode: this.currentNode,
|
|
86
90
|
documentModifier: e,
|
|
87
91
|
products: t
|
|
88
|
-
}) ||
|
|
92
|
+
}) || U({
|
|
89
93
|
currentNode: this.currentNode,
|
|
90
94
|
documentModifier: e,
|
|
91
95
|
products: t
|
|
@@ -93,7 +97,7 @@ class rt extends N {
|
|
|
93
97
|
}, 100));
|
|
94
98
|
}
|
|
95
99
|
getId() {
|
|
96
|
-
return
|
|
100
|
+
return $;
|
|
97
101
|
}
|
|
98
102
|
get _subControls() {
|
|
99
103
|
return [
|
|
@@ -114,7 +118,7 @@ class rt extends N {
|
|
|
114
118
|
return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
|
|
115
119
|
var o;
|
|
116
120
|
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
117
|
-
}), this.algorithmControl = new
|
|
121
|
+
}), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new k(), this.productLayoutControl = new F(), this.filtersControl = new S(), this.shuffleControl = new D(), this.pricePlacementControl = new E(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new w() : null, this._subControls.forEach((e) => {
|
|
118
122
|
e && (e.api = this.api);
|
|
119
123
|
}), `
|
|
120
124
|
<div class="recommendation-controls-container">
|
|
@@ -136,11 +140,12 @@ class rt extends N {
|
|
|
136
140
|
const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
|
|
137
141
|
if (!e)
|
|
138
142
|
return;
|
|
139
|
-
const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t),
|
|
140
|
-
e.classList.toggle("strategy-block",
|
|
143
|
+
const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
|
|
144
|
+
e.classList.toggle("strategy-block", r);
|
|
141
145
|
}
|
|
142
146
|
async onRender() {
|
|
143
147
|
var o;
|
|
148
|
+
b(this.api);
|
|
144
149
|
const t = this._getRecommendationIdFromNode(this.currentNode), e = t ?? this.store.currentRecommendationId;
|
|
145
150
|
if (e !== null && this.store.setCurrentBlock(e), t !== null && this._syncNodeConfigIfChanged(t), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
|
|
146
151
|
this._initializeSubControls();
|
|
@@ -154,9 +159,9 @@ class rt extends N {
|
|
|
154
159
|
const e = this._getRecommendationIdFromNode(t);
|
|
155
160
|
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && this._syncNodeConfigIfChanged(e), this._showControlsForBlock(t), e !== null && !((o = this.store.blockStates[e]) != null && o.isInitialized) && this._fetchBlockData(e).then(() => {
|
|
156
161
|
this._initializeSubControls();
|
|
157
|
-
}), this._subControls.forEach((
|
|
162
|
+
}), this._subControls.forEach((r) => {
|
|
158
163
|
var i;
|
|
159
|
-
|
|
164
|
+
r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
|
|
160
165
|
});
|
|
161
166
|
}
|
|
162
167
|
onDestroy() {
|
|
@@ -193,21 +198,29 @@ class rt extends N {
|
|
|
193
198
|
* fingerprint diff on this hook is the only way to notice (SD-149105).
|
|
194
199
|
* An unchanged fingerprint means the move came from us, so runtime store
|
|
195
200
|
* edits are never clobbered (SD-141049).
|
|
201
|
+
*
|
|
202
|
+
* The fingerprint is kept on the block's own store state so deleting the
|
|
203
|
+
* block drops it with the state it describes. A control-owned memo outlived
|
|
204
|
+
* that state and made a re-dropped saved module keep the defaults its wiped
|
|
205
|
+
* state was rebuilt with (SD-150347).
|
|
196
206
|
*/
|
|
197
207
|
_syncNodeConfigIfChanged(t) {
|
|
198
208
|
this.pendingNodeConfigWrite && this.pendingNodeConfigWrite.blockId !== t && this._flushPendingNodeConfig();
|
|
199
|
-
const e =
|
|
200
|
-
|
|
209
|
+
const e = this.store.blockStates[t];
|
|
210
|
+
if (!e)
|
|
211
|
+
return;
|
|
212
|
+
const o = JSON.stringify(c.getConfig(this.currentNode)), r = e.syncedConfigFingerprint;
|
|
213
|
+
e.syncedConfigFingerprint = o, r !== o && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
|
|
201
214
|
}
|
|
202
215
|
_capturePendingNodeConfigWrite() {
|
|
203
216
|
const t = this.store.currentRecommendationId;
|
|
204
217
|
if (!this.currentNode || !this.api || t === null)
|
|
205
218
|
return;
|
|
206
|
-
const { filters: e, strategyId: o, size:
|
|
219
|
+
const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
|
|
207
220
|
this.pendingNodeConfigWrite = {
|
|
208
221
|
blockId: t,
|
|
209
222
|
node: this.currentNode,
|
|
210
|
-
updates: { filters: e, strategyId: o, size:
|
|
223
|
+
updates: { filters: e, strategyId: o, size: r }
|
|
211
224
|
};
|
|
212
225
|
}
|
|
213
226
|
/**
|
|
@@ -225,9 +238,9 @@ class rt extends N {
|
|
|
225
238
|
return !e || !this.currentNode ? !1 : (c.stageConfig(t, this.currentNode, e.updates), !0);
|
|
226
239
|
}
|
|
227
240
|
/**
|
|
228
|
-
* Arms the guaranteed fallback write
|
|
229
|
-
*
|
|
230
|
-
* its own and the undo entry splits in two again.
|
|
241
|
+
* Arms the guaranteed fallback write, once the product fetch has settled. The
|
|
242
|
+
* delay only has to outlast the re-render debounce that fetch triggers — firing
|
|
243
|
+
* earlier writes the config on its own and the undo entry splits in two again.
|
|
231
244
|
*/
|
|
232
245
|
_scheduleConfigFlush() {
|
|
233
246
|
this._clearConfigFlush(), this.pendingConfigFlushTimer = setTimeout(() => {
|
|
@@ -250,8 +263,8 @@ class rt extends N {
|
|
|
250
263
|
JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategyId === t.updates.strategyId && o.size === t.updates.size || c.updateConfig(this.api, e, t.updates, "Update recommendation filters");
|
|
251
264
|
}
|
|
252
265
|
_syncNodeConfigToStore() {
|
|
253
|
-
var
|
|
254
|
-
const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((
|
|
266
|
+
var r;
|
|
267
|
+
const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
255
268
|
this.store.patchCurrentBlockConfig({
|
|
256
269
|
strategy: t.strategy,
|
|
257
270
|
strategyId: t.strategyId,
|
|
@@ -293,8 +306,8 @@ class rt extends N {
|
|
|
293
306
|
t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
|
|
294
307
|
this.store.fetchRecommendationCreateData(),
|
|
295
308
|
this.store.fetchRecommendationFilters()
|
|
296
|
-
])).forEach((o,
|
|
297
|
-
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][
|
|
309
|
+
])).forEach((o, r) => {
|
|
310
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
|
|
298
311
|
}), this._applySmartDefaults();
|
|
299
312
|
try {
|
|
300
313
|
await this.store.fetchRecommendationProducts();
|
|
@@ -316,7 +329,7 @@ class rt extends N {
|
|
|
316
329
|
if (!this.currentNode || !this.api)
|
|
317
330
|
return;
|
|
318
331
|
const t = c.getConfig(this.currentNode), e = {};
|
|
319
|
-
let o = null,
|
|
332
|
+
let o = null, r = null, i = null;
|
|
320
333
|
if (t.currency.code === a.currency.code) {
|
|
321
334
|
const { currencyList: s } = this.store;
|
|
322
335
|
s.length > 0 && (s.some(
|
|
@@ -331,7 +344,7 @@ class rt extends N {
|
|
|
331
344
|
const s = this.store.getActivePredictiveAlgorithms;
|
|
332
345
|
s.length > 0 && (s.some(
|
|
333
346
|
(d) => d.value === a.strategy
|
|
334
|
-
) || (
|
|
347
|
+
) || (r = s[0].value, e.strategy = r));
|
|
335
348
|
}
|
|
336
349
|
if (t.language === a.language) {
|
|
337
350
|
const s = this.store.getLanguages;
|
|
@@ -339,12 +352,12 @@ class rt extends N {
|
|
|
339
352
|
(d) => d.value === a.language
|
|
340
353
|
) || (i = s[0].value, e.language = i));
|
|
341
354
|
}
|
|
342
|
-
!o && !
|
|
355
|
+
!o && !r && !i || (c.updateConfig(
|
|
343
356
|
this.api,
|
|
344
357
|
this.currentNode,
|
|
345
358
|
e,
|
|
346
359
|
"Applied smart defaults"
|
|
347
|
-
), o && e.currency &&
|
|
360
|
+
), o && e.currency && A({
|
|
348
361
|
currentNode: this.currentNode,
|
|
349
362
|
documentModifier: this.api.getDocumentModifier(),
|
|
350
363
|
currency: e.currency
|
|
@@ -360,7 +373,7 @@ class rt extends N {
|
|
|
360
373
|
thousandSeparator: a.currency.thousandSeparator
|
|
361
374
|
}
|
|
362
375
|
} : {},
|
|
363
|
-
...
|
|
376
|
+
...r ? { strategy: r } : {},
|
|
364
377
|
...i ? { language: i } : {}
|
|
365
378
|
}, { triggerRefetch: !1 }));
|
|
366
379
|
}
|
|
@@ -368,14 +381,14 @@ class rt extends N {
|
|
|
368
381
|
* Reads the recommendation-id attribute from the block element within the node
|
|
369
382
|
*/
|
|
370
383
|
_getRecommendationIdFromNode(t) {
|
|
371
|
-
const e =
|
|
384
|
+
const e = v(t);
|
|
372
385
|
if (!e || !("getAttribute" in e))
|
|
373
386
|
return null;
|
|
374
|
-
const o = e.getAttribute(
|
|
387
|
+
const o = e.getAttribute(I);
|
|
375
388
|
if (!o)
|
|
376
389
|
return null;
|
|
377
|
-
const
|
|
378
|
-
return Number.isNaN(
|
|
390
|
+
const r = parseInt(o);
|
|
391
|
+
return Number.isNaN(r) ? null : r;
|
|
379
392
|
}
|
|
380
393
|
/**
|
|
381
394
|
* Listen to store changes that require product refresh or regeneration.
|
|
@@ -392,53 +405,54 @@ class rt extends N {
|
|
|
392
405
|
*/
|
|
393
406
|
_listenStateUpdates() {
|
|
394
407
|
const { store: t } = this;
|
|
395
|
-
let e = t.recommendationProducts, o = t.$state.configVersion,
|
|
408
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
|
|
396
409
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
397
410
|
const i = t.currentRecommendationId;
|
|
398
|
-
if (i !==
|
|
399
|
-
|
|
411
|
+
if (i !== r) {
|
|
412
|
+
r = i, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
400
413
|
return;
|
|
401
414
|
}
|
|
402
415
|
const s = t.$state.configVersion;
|
|
403
|
-
s !== o && (o = s, this._capturePendingNodeConfigWrite(), this.
|
|
416
|
+
s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
|
|
404
417
|
const u = t.recommendationProducts, d = u !== e, g = Array.isArray(u) && u.length > 0;
|
|
405
418
|
d && g && (e = u, this._debouncedRegenerateWithProducts());
|
|
406
419
|
});
|
|
407
420
|
}
|
|
408
421
|
}
|
|
409
422
|
export {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
423
|
+
ut as ALGORITHM_CONTROL_ID,
|
|
424
|
+
T as AlgorithmControl,
|
|
425
|
+
$ as CONTROL_BLOCK_ID,
|
|
426
|
+
ht as CURRENCY_CONTROL_ID,
|
|
427
|
+
P as CurrencyControl,
|
|
428
|
+
gt as FILTERS_CONTROL_ID,
|
|
429
|
+
S as FiltersControl,
|
|
430
|
+
Ct as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
431
|
+
yt as LOCALE_CONTROL_ID,
|
|
432
|
+
O as LayoutOrientationControl,
|
|
433
|
+
L as LocaleControl,
|
|
434
|
+
_t as PRICE_PLACEMENT_CONTROL_ID,
|
|
435
|
+
Rt as PRODUCT_COUNT_CONTROL_ID,
|
|
436
|
+
Tt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
437
|
+
E as PricePlacementControl,
|
|
438
|
+
k as ProductCountControl,
|
|
439
|
+
F as ProductLayoutControl,
|
|
440
|
+
at as RecommendationBlockControl,
|
|
441
|
+
St as SHUFFLE_CONTROL_ID,
|
|
442
|
+
Lt as STRATEGY_CONTROL_ID,
|
|
443
|
+
D as ShuffleControl,
|
|
444
|
+
w as StrategyControl,
|
|
445
|
+
kt as adjustProductsToSize,
|
|
446
|
+
Ft as formatProductPrice,
|
|
447
|
+
v as getBlockElement,
|
|
448
|
+
Dt as getCardComposition,
|
|
449
|
+
wt as getCurrentLayout,
|
|
450
|
+
At as getMainContainerTbody,
|
|
451
|
+
x as isPartnerManagedBlock,
|
|
452
|
+
vt as regenerateMobileProductRows,
|
|
453
|
+
U as regenerateProductRowsWithStyles,
|
|
454
|
+
A as setCurrencyAttributes,
|
|
455
|
+
xt as updatePricesInPlace,
|
|
456
|
+
B as updateProductContentInPlace,
|
|
457
|
+
Bt as updateSingleProductContent
|
|
444
458
|
};
|
|
@@ -104,7 +104,7 @@ class f extends h {
|
|
|
104
104
|
const i = t.querySelector(a);
|
|
105
105
|
i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
|
|
106
106
|
};
|
|
107
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.
|
|
107
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
|
|
108
108
|
}
|
|
109
109
|
_renderState() {
|
|
110
110
|
var l;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createPaddingsControl as r, createTextBackgroundColorControl as T, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as C, createTextColorControl as c, createTextAlignControl as I } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const L = I(
|
|
6
|
+
t.TITLE_ALIGN,
|
|
7
|
+
o.TITLE,
|
|
8
|
+
n
|
|
9
|
+
), a = c(
|
|
10
|
+
t.TITLE_COLOR,
|
|
11
|
+
o.TITLE,
|
|
12
|
+
n
|
|
13
|
+
), i = C(
|
|
14
|
+
t.TITLE_SIZE,
|
|
15
|
+
o.TITLE,
|
|
16
|
+
n
|
|
17
|
+
), E = l(
|
|
18
|
+
t.TITLE_STYLE,
|
|
19
|
+
o.TITLE,
|
|
20
|
+
n
|
|
21
|
+
), m = e(
|
|
22
|
+
t.TITLE_FONT_FAMILY,
|
|
23
|
+
o.TITLE,
|
|
24
|
+
n
|
|
25
|
+
), s = T(
|
|
26
|
+
t.TITLE_BACKGROUND,
|
|
27
|
+
o.TITLE,
|
|
28
|
+
n
|
|
29
|
+
), d = r(
|
|
30
|
+
t.TITLE_PADDINGS,
|
|
31
|
+
o.TITLE,
|
|
32
|
+
n
|
|
33
|
+
), x = {
|
|
34
|
+
align: L,
|
|
35
|
+
color: a,
|
|
36
|
+
size: i,
|
|
37
|
+
style: E,
|
|
38
|
+
fontFamily: m,
|
|
39
|
+
background: s,
|
|
40
|
+
paddings: d
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
x as TitleControls
|
|
44
|
+
};
|
|
@@ -5,23 +5,24 @@ import { RecommendationBlockControl as i } from "./controls/main/index.js";
|
|
|
5
5
|
import "./constants/selectors.js";
|
|
6
6
|
import "./store/recommendation.js";
|
|
7
7
|
import "./utils/captureStyleTemplates.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import R from "./
|
|
23
|
-
import
|
|
24
|
-
|
|
8
|
+
import { TitleControls as e } from "./controls/title/index.js";
|
|
9
|
+
import { NameControls as l } from "./controls/name/index.js";
|
|
10
|
+
import { PriceControls as s } from "./controls/price/index.js";
|
|
11
|
+
import { OldPriceControls as p } from "./controls/oldPrice/index.js";
|
|
12
|
+
import { OmnibusPriceControls as a } from "./controls/omnibusPrice/index.js";
|
|
13
|
+
import { OmnibusDiscountControls as c } from "./controls/omnibusDiscount/index.js";
|
|
14
|
+
import { ButtonControls as C } from "./controls/button/index.js";
|
|
15
|
+
import { ImageControls as f } from "./controls/image/index.js";
|
|
16
|
+
import { CustomAttributeControls as d } from "./controls/customAttribute/index.js";
|
|
17
|
+
import { SpacingControl as u } from "./controls/spacing/index.js";
|
|
18
|
+
import { BlockBackgroundColorControl as g } from "./controls/blockBackground/index.js";
|
|
19
|
+
import { CardBackgroundColorControl as y } from "./controls/cardBackground/index.js";
|
|
20
|
+
import { RecommendationCardCompositionControl as B } from "./controls/cardComposition/index.js";
|
|
21
|
+
import { SyncInfoMessageControl as P } from "./controls/syncInfoMessage.js";
|
|
22
|
+
import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
|
|
23
|
+
import S from "./recommendation.css.js";
|
|
24
|
+
import { SettingsPanel as k } from "./settingsPanel.js";
|
|
25
|
+
const w = [
|
|
25
26
|
e,
|
|
26
27
|
l,
|
|
27
28
|
s,
|
|
@@ -29,21 +30,22 @@ const k = [
|
|
|
29
30
|
a,
|
|
30
31
|
c,
|
|
31
32
|
C,
|
|
32
|
-
f
|
|
33
|
-
|
|
33
|
+
f,
|
|
34
|
+
d
|
|
35
|
+
], b = [
|
|
34
36
|
i,
|
|
35
|
-
u,
|
|
36
37
|
g,
|
|
37
|
-
d,
|
|
38
38
|
y,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
u,
|
|
40
|
+
B,
|
|
41
|
+
P
|
|
42
|
+
], v = [
|
|
43
|
+
...b,
|
|
44
|
+
...w.flatMap((o) => Object.values(o))
|
|
45
|
+
], Y = v.reduce(
|
|
44
46
|
(o, r) => o.addControl(r),
|
|
45
|
-
new t().addBlock(m).withSettingsPanelRegistry(
|
|
46
|
-
).addStyles(
|
|
47
|
+
new t().addBlock(m).withSettingsPanelRegistry(k)
|
|
48
|
+
).addStyles(S).withPreviewStyles(n).withIconsRegistry(R).build();
|
|
47
49
|
export {
|
|
48
|
-
|
|
50
|
+
Y as default
|
|
49
51
|
};
|
|
@@ -3,9 +3,10 @@ import { BLOCK_ID as R } from "./block.js";
|
|
|
3
3
|
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import "./constants/selectors.js";
|
|
6
|
-
import { CONTROL_BLOCK_ID as
|
|
6
|
+
import { CONTROL_BLOCK_ID as L } from "./controls/main/index.js";
|
|
7
7
|
import "./store/recommendation.js";
|
|
8
8
|
import "./utils/captureStyleTemplates.js";
|
|
9
|
+
import "./controls/title/index.js";
|
|
9
10
|
import "./controls/name/index.js";
|
|
10
11
|
import "./controls/price/index.js";
|
|
11
12
|
import "./controls/oldPrice/index.js";
|
|
@@ -15,7 +16,7 @@ import "./controls/button/index.js";
|
|
|
15
16
|
import "./controls/image/index.js";
|
|
16
17
|
import { SPACING_CONTROL_ID as A } from "./controls/spacing/index.js";
|
|
17
18
|
import "./controls/blockBackground/index.js";
|
|
18
|
-
import { CARD_BACKGROUND_COLOR_CONTROL_ID as
|
|
19
|
+
import { CARD_BACKGROUND_COLOR_CONTROL_ID as U } from "./controls/cardBackground/index.js";
|
|
19
20
|
import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
|
|
20
21
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
21
22
|
class s extends E {
|
|
@@ -24,7 +25,7 @@ class s extends E {
|
|
|
24
25
|
new _(
|
|
25
26
|
I.SETTINGS,
|
|
26
27
|
[
|
|
27
|
-
|
|
28
|
+
L,
|
|
28
29
|
C.EXTERNAL_INDENTS
|
|
29
30
|
]
|
|
30
31
|
),
|
|
@@ -32,7 +33,7 @@ class s extends E {
|
|
|
32
33
|
I.STYLES,
|
|
33
34
|
[
|
|
34
35
|
T.BLOCK_BACKGROUND,
|
|
35
|
-
|
|
36
|
+
U,
|
|
36
37
|
A
|
|
37
38
|
]
|
|
38
39
|
),
|
|
@@ -42,6 +43,24 @@ class s extends E {
|
|
|
42
43
|
D
|
|
43
44
|
]
|
|
44
45
|
).withLabel(this.api.translate("Card Composition"))
|
|
46
|
+
], O[S.TITLE] = [
|
|
47
|
+
new _(
|
|
48
|
+
I.SETTINGS,
|
|
49
|
+
[
|
|
50
|
+
T.TITLE_STYLE,
|
|
51
|
+
T.TITLE_ALIGN,
|
|
52
|
+
T.TITLE_PADDINGS
|
|
53
|
+
]
|
|
54
|
+
),
|
|
55
|
+
new _(
|
|
56
|
+
I.STYLES,
|
|
57
|
+
[
|
|
58
|
+
T.TITLE_BACKGROUND,
|
|
59
|
+
T.TITLE_FONT_FAMILY,
|
|
60
|
+
T.TITLE_SIZE,
|
|
61
|
+
T.TITLE_COLOR
|
|
62
|
+
]
|
|
63
|
+
)
|
|
45
64
|
], O[S.NAME] = [
|
|
46
65
|
new _(
|
|
47
66
|
I.SETTINGS,
|