@useinsider/guido 3.20.1-beta.68ebd35 → 3.20.1-beta.816316b
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
2
|
var y = (h, c, e) => c in h ? _(h, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[c] = e;
|
|
3
3
|
var i = (h, c, e) => y(h, typeof c != "symbol" ? c + "" : c, e);
|
|
4
|
-
import { useConfig as
|
|
4
|
+
import { useConfig as m } from "../../../../../composables/useConfig.js";
|
|
5
5
|
import { ModificationDescription as N } 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";
|
|
@@ -9,7 +9,7 @@ import { RECOMMENDATION_ID_ATTR as k } from "../../constants/selectors.js";
|
|
|
9
9
|
import { RecommendationConfigService as l } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as I } from "../../store/recommendation.js";
|
|
11
11
|
import { refreshBlockOutsidePanel as S } from "../../utils/blockRefresh.js";
|
|
12
|
-
import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as
|
|
12
|
+
import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as C, hasEditedConfigChange as b } from "../../utils/nodeConfigWriter.js";
|
|
13
13
|
import { AlgorithmControl as O } from "./algorithm.js";
|
|
14
14
|
import { ALGORITHM_CONTROL_ID as me } from "./algorithm.js";
|
|
15
15
|
import { CurrencyControl as B } from "./currency.js";
|
|
@@ -32,8 +32,8 @@ import { StrategyControl as A } from "./strategy.js";
|
|
|
32
32
|
import { STRATEGY_CONTROL_ID as De } from "./strategy.js";
|
|
33
33
|
import { setCurrencyAttributes as V, getBlockElement as x, isPartnerManagedBlock as W, updateProductContentInPlace as M, regenerateProductRowsWithStyles as G } from "./utils.js";
|
|
34
34
|
import { adjustProductsToSize as ve, formatProductPrice as we, getCardComposition as Ae, getCurrentLayout as Ve, getMainContainerTbody as xe, regenerateMobileProductRows as We, updatePricesInPlace as Me, updateSingleProductContent as Ge } from "./utils.js";
|
|
35
|
-
import { useDebounceFn as
|
|
36
|
-
const
|
|
35
|
+
import { useDebounceFn as p } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
36
|
+
const g = "Update recommendation filters", z = "ui-elements-recommendation-block";
|
|
37
37
|
class he extends P {
|
|
38
38
|
constructor() {
|
|
39
39
|
super(...arguments);
|
|
@@ -66,7 +66,7 @@ class he extends P {
|
|
|
66
66
|
/**
|
|
67
67
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
68
68
|
*/
|
|
69
|
-
i(this, "_debouncedFetchProducts",
|
|
69
|
+
i(this, "_debouncedFetchProducts", p(async (e, t) => {
|
|
70
70
|
if (t !== this.panelGeneration)
|
|
71
71
|
return;
|
|
72
72
|
const o = this._getBlockConfigVersion(e);
|
|
@@ -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
|
-
i(this, "_debouncedRegenerateWithProducts",
|
|
90
|
+
i(this, "_debouncedRegenerateWithProducts", p((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;
|
|
@@ -124,7 +124,7 @@ class he extends P {
|
|
|
124
124
|
}
|
|
125
125
|
getTemplate() {
|
|
126
126
|
var e;
|
|
127
|
-
return this.rrsEnabled =
|
|
127
|
+
return this.rrsEnabled = m().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
130
|
}), this.algorithmControl = new O(), this.localeControl = new F(), this.currencyControl = new B(), this.productCountControl = new U(), this.productLayoutControl = new v(), this.filtersControl = new L(), this.shuffleControl = new w(), this.pricePlacementControl = new D(), this.layoutOrientationControl = new E(), this.strategyControl = this.rrsEnabled ? new A() : null, this._subControls.forEach((t) => {
|
|
@@ -235,7 +235,7 @@ class he extends P {
|
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
_getNodeConfigUpdates(e) {
|
|
238
|
-
const { filters: t, strategy: o, strategyId: n, size: r, nodeConfigVersion: s } = e, { partnerName: d } =
|
|
238
|
+
const { filters: t, strategy: o, strategyId: n, size: r, nodeConfigVersion: s } = e, { partnerName: d } = m();
|
|
239
239
|
return {
|
|
240
240
|
filters: t,
|
|
241
241
|
strategy: o,
|
|
@@ -282,14 +282,14 @@ class he extends P {
|
|
|
282
282
|
if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !(!e || !this.api)) {
|
|
283
283
|
if (e.blockId !== this.store.currentRecommendationId || !this.currentNode) {
|
|
284
284
|
const { blockId: t, updates: o } = e;
|
|
285
|
-
!
|
|
285
|
+
!C(t, o, g) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
288
|
b(this.currentNode, e.updates) && l.updateConfig(
|
|
289
289
|
this.api,
|
|
290
290
|
this.currentNode,
|
|
291
291
|
e.updates,
|
|
292
|
-
|
|
292
|
+
g
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
@@ -442,10 +442,10 @@ class he extends P {
|
|
|
442
442
|
if (e === null || !n)
|
|
443
443
|
return;
|
|
444
444
|
const r = t !== n.configVersion;
|
|
445
|
-
r && !
|
|
445
|
+
r && !C(
|
|
446
446
|
e,
|
|
447
447
|
this._getNodeConfigUpdates(n.recommendationConfigs),
|
|
448
|
-
|
|
448
|
+
g
|
|
449
449
|
) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (r || o) && this._refreshOutsidePanel(e, r);
|
|
450
450
|
} catch (n) {
|
|
451
451
|
console.error("[recommendation] finishing the block outside the panel failed", n);
|
|
@@ -511,14 +511,18 @@ class he extends P {
|
|
|
511
511
|
this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this.storeUnsubscription = e.$subscribe(() => {
|
|
512
512
|
const n = e.currentRecommendationId;
|
|
513
513
|
if (n !== this.trackedBlockId) {
|
|
514
|
-
const
|
|
515
|
-
this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(
|
|
514
|
+
const f = this._trackedBlockSnapshot();
|
|
515
|
+
this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(f);
|
|
516
516
|
return;
|
|
517
517
|
}
|
|
518
518
|
const r = this._getBlockConfigVersion(n);
|
|
519
519
|
r !== o && (o = r, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(n, this.panelGeneration));
|
|
520
520
|
const s = e.recommendationProducts, d = s !== t, u = Array.isArray(s) && s.length > 0;
|
|
521
|
-
d && u
|
|
521
|
+
if (d && u) {
|
|
522
|
+
t = s;
|
|
523
|
+
const f = this._getRecommendationIdFromNode(this.currentNode);
|
|
524
|
+
(f === null || f === n) && (this.hasUnrenderedProducts = !0), this._debouncedRegenerateWithProducts(this.panelGeneration);
|
|
525
|
+
}
|
|
522
526
|
});
|
|
523
527
|
}
|
|
524
528
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.20.1-beta.
|
|
3
|
+
"version": "3.20.1-beta.816316b",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|