@useinsider/guido 3.18.2-beta.32d291d → 3.18.2-beta.345283a
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 +3 -21
- package/dist/@types/config/schemas.js +51 -59
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +53 -55
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +22 -24
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +24 -28
- package/dist/composables/useCustomInterfaceAppearance.js +42 -46
- package/dist/enums/extensions/recommendationBlock.js +31 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +76 -77
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +28 -72
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -45
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +46 -110
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +37 -46
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -4
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -70
- package/dist/src/services/recommendationApi.d.ts +1 -2
- package/dist/src/stores/config.d.ts +0 -322
- package/dist/src/stores/onboarding.d.ts +10 -808
- package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
- package/dist/stores/config.js +60 -74
- package/dist/stores/onboarding.js +36 -46
- package/package.json +2 -2
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +0 -46
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -46
- package/dist/composables/useLegacyStrategyConversion.js +0 -61
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -42
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -32
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
- package/dist/static/assets/icons/line-info.svg.js +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var C = (
|
|
3
|
-
var
|
|
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 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";
|
|
@@ -12,16 +12,16 @@ import { registerNodeConfigWriter as b } from "../../utils/nodeConfigWriter.js";
|
|
|
12
12
|
import { AlgorithmControl as T } from "./algorithm.js";
|
|
13
13
|
import { ALGORITHM_CONTROL_ID as ut } from "./algorithm.js";
|
|
14
14
|
import { CurrencyControl as P } from "./currency.js";
|
|
15
|
-
import { CURRENCY_CONTROL_ID as
|
|
15
|
+
import { CURRENCY_CONTROL_ID as ht } from "./currency.js";
|
|
16
16
|
import { FiltersControl as S } from "./filters.js";
|
|
17
|
-
import { FILTERS_CONTROL_ID as
|
|
17
|
+
import { FILTERS_CONTROL_ID as gt } from "./filters.js";
|
|
18
18
|
import { LayoutOrientationControl as O } from "./layoutOrientation.js";
|
|
19
19
|
import { LAYOUT_ORIENTATION_CONTROL_ID as Ct } from "./layoutOrientation.js";
|
|
20
20
|
import { LocaleControl as L } from "./locale.js";
|
|
21
21
|
import { LOCALE_CONTROL_ID as yt } from "./locale.js";
|
|
22
|
-
import { PricePlacementControl as
|
|
22
|
+
import { PricePlacementControl as E } from "./pricePlacement.js";
|
|
23
23
|
import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
|
|
24
|
-
import { ProductCountControl as
|
|
24
|
+
import { ProductCountControl as k } from "./productCount.js";
|
|
25
25
|
import { PRODUCT_COUNT_CONTROL_ID as Rt } from "./productCount.js";
|
|
26
26
|
import { ProductLayoutControl as F } from "./productLayout.js";
|
|
27
27
|
import { PRODUCT_LAYOUT_CONTROL_ID as Tt } from "./productLayout.js";
|
|
@@ -29,36 +29,36 @@ import { ShuffleControl as D } from "./shuffle.js";
|
|
|
29
29
|
import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
|
|
30
30
|
import { StrategyControl as w } from "./strategy.js";
|
|
31
31
|
import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
|
|
32
|
-
import { setCurrencyAttributes as A, getBlockElement as
|
|
33
|
-
import { adjustProductsToSize as
|
|
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";
|
|
34
34
|
import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
35
35
|
const $ = "ui-elements-recommendation-block";
|
|
36
36
|
class at extends N {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments);
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
n(this, "store", R());
|
|
40
|
+
n(this, "storeUnsubscription", () => {
|
|
41
41
|
});
|
|
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
|
-
|
|
61
|
+
n(this, "_debouncedFetchProducts", f(async () => {
|
|
62
62
|
try {
|
|
63
63
|
await this.store.fetchRecommendationProducts();
|
|
64
64
|
} finally {
|
|
@@ -76,16 +76,16 @@ class at extends N {
|
|
|
76
76
|
* count. The store pads products to the configured size, so in-place only
|
|
77
77
|
* fails when the size actually changed.
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
n(this, "_debouncedRegenerateWithProducts", f(() => {
|
|
80
80
|
const t = this.store.recommendationProducts;
|
|
81
81
|
if (!this.currentNode || !this.api)
|
|
82
82
|
return;
|
|
83
83
|
const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
|
|
84
|
-
if (
|
|
84
|
+
if (x(this.currentNode)) {
|
|
85
85
|
o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
B({
|
|
89
89
|
currentNode: this.currentNode,
|
|
90
90
|
documentModifier: e,
|
|
91
91
|
products: t
|
|
@@ -118,7 +118,7 @@ class at extends N {
|
|
|
118
118
|
return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
|
|
119
119
|
var o;
|
|
120
120
|
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
121
|
-
}), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = 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) => {
|
|
122
122
|
e && (e.api = this.api);
|
|
123
123
|
}), `
|
|
124
124
|
<div class="recommendation-controls-container">
|
|
@@ -140,8 +140,8 @@ class at extends N {
|
|
|
140
140
|
const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
|
|
141
141
|
if (!e)
|
|
142
142
|
return;
|
|
143
|
-
const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t),
|
|
144
|
-
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);
|
|
145
145
|
}
|
|
146
146
|
async onRender() {
|
|
147
147
|
var o;
|
|
@@ -159,9 +159,9 @@ class at extends N {
|
|
|
159
159
|
const e = this._getRecommendationIdFromNode(t);
|
|
160
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(() => {
|
|
161
161
|
this._initializeSubControls();
|
|
162
|
-
}), this._subControls.forEach((
|
|
163
|
-
var
|
|
164
|
-
|
|
162
|
+
}), this._subControls.forEach((r) => {
|
|
163
|
+
var i;
|
|
164
|
+
r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
onDestroy() {
|
|
@@ -209,18 +209,18 @@ class at extends N {
|
|
|
209
209
|
const e = this.store.blockStates[t];
|
|
210
210
|
if (!e)
|
|
211
211
|
return;
|
|
212
|
-
const o = JSON.stringify(c.getConfig(this.currentNode)),
|
|
213
|
-
e.syncedConfigFingerprint = o,
|
|
212
|
+
const o = JSON.stringify(c.getConfig(this.currentNode)), r = e.syncedConfigFingerprint;
|
|
213
|
+
e.syncedConfigFingerprint = o, r !== o && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
|
|
214
214
|
}
|
|
215
215
|
_capturePendingNodeConfigWrite() {
|
|
216
216
|
const t = this.store.currentRecommendationId;
|
|
217
217
|
if (!this.currentNode || !this.api || t === null)
|
|
218
218
|
return;
|
|
219
|
-
const { filters: e, strategyId: o, size:
|
|
219
|
+
const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
|
|
220
220
|
this.pendingNodeConfigWrite = {
|
|
221
221
|
blockId: t,
|
|
222
222
|
node: this.currentNode,
|
|
223
|
-
updates: { filters: e, strategyId: o, size:
|
|
223
|
+
updates: { filters: e, strategyId: o, size: r }
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -263,12 +263,11 @@ class at extends N {
|
|
|
263
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");
|
|
264
264
|
}
|
|
265
265
|
_syncNodeConfigToStore() {
|
|
266
|
-
var
|
|
267
|
-
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);
|
|
268
268
|
this.store.patchCurrentBlockConfig({
|
|
269
269
|
strategy: t.strategy,
|
|
270
270
|
strategyId: t.strategyId,
|
|
271
|
-
nodeConfigVersion: t.configVersion,
|
|
272
271
|
language: t.language,
|
|
273
272
|
size: t.size,
|
|
274
273
|
productIds: t.productIds,
|
|
@@ -307,8 +306,8 @@ class at extends N {
|
|
|
307
306
|
t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
|
|
308
307
|
this.store.fetchRecommendationCreateData(),
|
|
309
308
|
this.store.fetchRecommendationFilters()
|
|
310
|
-
])).forEach((o,
|
|
311
|
-
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);
|
|
312
311
|
}), this._applySmartDefaults();
|
|
313
312
|
try {
|
|
314
313
|
await this.store.fetchRecommendationProducts();
|
|
@@ -330,30 +329,30 @@ class at extends N {
|
|
|
330
329
|
if (!this.currentNode || !this.api)
|
|
331
330
|
return;
|
|
332
331
|
const t = c.getConfig(this.currentNode), e = {};
|
|
333
|
-
let o = null,
|
|
332
|
+
let o = null, r = null, i = null;
|
|
334
333
|
if (t.currency.code === a.currency.code) {
|
|
335
|
-
const { currencyList:
|
|
336
|
-
|
|
334
|
+
const { currencyList: s } = this.store;
|
|
335
|
+
s.length > 0 && (s.some(
|
|
337
336
|
(d) => d.value === `price.${a.currency.code}`
|
|
338
|
-
) || (o =
|
|
337
|
+
) || (o = s[0].value.replace("price.", ""), e.currency = {
|
|
339
338
|
...a.currency,
|
|
340
339
|
code: o,
|
|
341
340
|
symbol: o
|
|
342
341
|
}));
|
|
343
342
|
}
|
|
344
343
|
if (t.strategy === a.strategy) {
|
|
345
|
-
const
|
|
346
|
-
|
|
344
|
+
const s = this.store.getActivePredictiveAlgorithms;
|
|
345
|
+
s.length > 0 && (s.some(
|
|
347
346
|
(d) => d.value === a.strategy
|
|
348
|
-
) || (
|
|
347
|
+
) || (r = s[0].value, e.strategy = r));
|
|
349
348
|
}
|
|
350
349
|
if (t.language === a.language) {
|
|
351
|
-
const
|
|
352
|
-
|
|
350
|
+
const s = this.store.getLanguages;
|
|
351
|
+
s.length > 0 && (s.some(
|
|
353
352
|
(d) => d.value === a.language
|
|
354
|
-
) || (
|
|
353
|
+
) || (i = s[0].value, e.language = i));
|
|
355
354
|
}
|
|
356
|
-
!o && !
|
|
355
|
+
!o && !r && !i || (c.updateConfig(
|
|
357
356
|
this.api,
|
|
358
357
|
this.currentNode,
|
|
359
358
|
e,
|
|
@@ -374,22 +373,22 @@ class at extends N {
|
|
|
374
373
|
thousandSeparator: a.currency.thousandSeparator
|
|
375
374
|
}
|
|
376
375
|
} : {},
|
|
377
|
-
...
|
|
378
|
-
...
|
|
376
|
+
...r ? { strategy: r } : {},
|
|
377
|
+
...i ? { language: i } : {}
|
|
379
378
|
}, { triggerRefetch: !1 }));
|
|
380
379
|
}
|
|
381
380
|
/**
|
|
382
381
|
* Reads the recommendation-id attribute from the block element within the node
|
|
383
382
|
*/
|
|
384
383
|
_getRecommendationIdFromNode(t) {
|
|
385
|
-
const e =
|
|
384
|
+
const e = v(t);
|
|
386
385
|
if (!e || !("getAttribute" in e))
|
|
387
386
|
return null;
|
|
388
387
|
const o = e.getAttribute(I);
|
|
389
388
|
if (!o)
|
|
390
389
|
return null;
|
|
391
|
-
const
|
|
392
|
-
return Number.isNaN(
|
|
390
|
+
const r = parseInt(o);
|
|
391
|
+
return Number.isNaN(r) ? null : r;
|
|
393
392
|
}
|
|
394
393
|
/**
|
|
395
394
|
* Listen to store changes that require product refresh or regeneration.
|
|
@@ -406,17 +405,17 @@ class at extends N {
|
|
|
406
405
|
*/
|
|
407
406
|
_listenStateUpdates() {
|
|
408
407
|
const { store: t } = this;
|
|
409
|
-
let e = t.recommendationProducts, o = t.$state.configVersion,
|
|
408
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
|
|
410
409
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
|
|
410
|
+
const i = t.currentRecommendationId;
|
|
411
|
+
if (i !== r) {
|
|
412
|
+
r = i, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
414
413
|
return;
|
|
415
414
|
}
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
const u = t.recommendationProducts, d = u !== e,
|
|
419
|
-
d &&
|
|
415
|
+
const s = t.$state.configVersion;
|
|
416
|
+
s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
|
|
417
|
+
const u = t.recommendationProducts, d = u !== e, g = Array.isArray(u) && u.length > 0;
|
|
418
|
+
d && g && (e = u, this._debouncedRegenerateWithProducts());
|
|
420
419
|
});
|
|
421
420
|
}
|
|
422
421
|
}
|
|
@@ -424,9 +423,9 @@ export {
|
|
|
424
423
|
ut as ALGORITHM_CONTROL_ID,
|
|
425
424
|
T as AlgorithmControl,
|
|
426
425
|
$ as CONTROL_BLOCK_ID,
|
|
427
|
-
|
|
426
|
+
ht as CURRENCY_CONTROL_ID,
|
|
428
427
|
P as CurrencyControl,
|
|
429
|
-
|
|
428
|
+
gt as FILTERS_CONTROL_ID,
|
|
430
429
|
S as FiltersControl,
|
|
431
430
|
Ct as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
432
431
|
yt as LOCALE_CONTROL_ID,
|
|
@@ -435,25 +434,25 @@ export {
|
|
|
435
434
|
_t as PRICE_PLACEMENT_CONTROL_ID,
|
|
436
435
|
Rt as PRODUCT_COUNT_CONTROL_ID,
|
|
437
436
|
Tt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
438
|
-
|
|
439
|
-
|
|
437
|
+
E as PricePlacementControl,
|
|
438
|
+
k as ProductCountControl,
|
|
440
439
|
F as ProductLayoutControl,
|
|
441
440
|
at as RecommendationBlockControl,
|
|
442
441
|
St as SHUFFLE_CONTROL_ID,
|
|
443
442
|
Lt as STRATEGY_CONTROL_ID,
|
|
444
443
|
D as ShuffleControl,
|
|
445
444
|
w as StrategyControl,
|
|
446
|
-
|
|
445
|
+
kt as adjustProductsToSize,
|
|
447
446
|
Ft as formatProductPrice,
|
|
448
|
-
|
|
447
|
+
v as getBlockElement,
|
|
449
448
|
Dt as getCardComposition,
|
|
450
449
|
wt as getCurrentLayout,
|
|
451
450
|
At as getMainContainerTbody,
|
|
452
|
-
|
|
453
|
-
|
|
451
|
+
x as isPartnerManagedBlock,
|
|
452
|
+
vt as regenerateMobileProductRows,
|
|
454
453
|
U as regenerateProductRowsWithStyles,
|
|
455
454
|
A as setCurrencyAttributes,
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
xt as updatePricesInPlace,
|
|
456
|
+
B as updateProductContentInPlace,
|
|
457
|
+
Bt as updateSingleProductContent
|
|
459
458
|
};
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const C = "recommendation-strategy-control";
|
|
10
|
-
class N extends f {
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var y = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var o = (r, s, t) => y(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ACADEMY_LINKS as m } from "../../../../../enums/academy.js";
|
|
5
|
+
import { CommonControl as h } from "../../../common-control.js";
|
|
6
|
+
import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
|
|
7
|
+
const p = "recommendation-strategy-control";
|
|
8
|
+
class f extends h {
|
|
11
9
|
constructor() {
|
|
12
10
|
super(...arguments);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
r(this, "legacyConversion", _());
|
|
16
|
-
r(this, "storeUnsubscription", () => {
|
|
11
|
+
o(this, "store", u());
|
|
12
|
+
o(this, "storeUnsubscription", () => {
|
|
17
13
|
});
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
o(this, "listeners", []);
|
|
15
|
+
o(this, "lastPaintedState", null);
|
|
20
16
|
}
|
|
21
17
|
getId() {
|
|
22
|
-
return
|
|
18
|
+
return p;
|
|
23
19
|
}
|
|
24
20
|
getTemplate() {
|
|
25
21
|
const t = this.api.translate(
|
|
26
22
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
27
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy")
|
|
28
|
-
"Note that this is an older version of the Recommendation Strategy. We recommend you update it to the new Recommendation Strategy for an improved experience."
|
|
29
|
-
);
|
|
23
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
|
|
30
24
|
return `
|
|
31
25
|
<div class="strategy-control-container">
|
|
32
26
|
<div class="strategy-control-header">
|
|
@@ -37,7 +31,7 @@ class N extends f {
|
|
|
37
31
|
${t}
|
|
38
32
|
${e}
|
|
39
33
|
<a
|
|
40
|
-
href="${
|
|
34
|
+
href="${m.EMAIL_RECOMMENDATION_BLOCK}"
|
|
41
35
|
target="_blank"
|
|
42
36
|
rel="noopener noreferrer">${a}</a>.
|
|
43
37
|
</p>
|
|
@@ -59,33 +53,6 @@ class N extends f {
|
|
|
59
53
|
})
|
|
60
54
|
], "strategy-control-cta-row")}
|
|
61
55
|
</div>
|
|
62
|
-
<div data-strategy-legacy-state style="display: none;">
|
|
63
|
-
<div class="strategy-control-notice-row">
|
|
64
|
-
<div class="strategy-control-notice">
|
|
65
|
-
<p class="strategy-control-notice-text">${n}</p>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
<div class="strategy-control-name-band">
|
|
69
|
-
<span class="strategy-control-name">${o}</span>
|
|
70
|
-
${this._strategyAction({
|
|
71
|
-
id: "guido__btn-update-legacy-strategy",
|
|
72
|
-
label: this.api.translate("Update"),
|
|
73
|
-
modifier: "update"
|
|
74
|
-
})}
|
|
75
|
-
</div>
|
|
76
|
-
<div class="strategy-control-actions">
|
|
77
|
-
${this._strategyAction({
|
|
78
|
-
id: "guido__btn-change-legacy-strategy",
|
|
79
|
-
label: this.api.translate("Change"),
|
|
80
|
-
modifier: "change"
|
|
81
|
-
})}
|
|
82
|
-
${this._strategyAction({
|
|
83
|
-
id: "guido__btn-remove-legacy-strategy",
|
|
84
|
-
label: this.api.translate("Remove"),
|
|
85
|
-
modifier: "remove"
|
|
86
|
-
})}
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
56
|
<div data-strategy-assigned-state style="display: none;">
|
|
90
57
|
<div class="strategy-control-name-band">
|
|
91
58
|
<span class="strategy-control-name" data-strategy-name></span>
|
|
@@ -121,8 +88,6 @@ class N extends f {
|
|
|
121
88
|
this._renderState();
|
|
122
89
|
}), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
|
|
123
90
|
});
|
|
124
|
-
const t = this.store.currentRecommendationId, e = t !== null && !!this.store.blockStates[t], a = this.store.isLegacyStrategyBlock;
|
|
125
|
-
e && !this.store.recommendationConfigs.strategyId && !a && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding"), e && a && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding");
|
|
126
91
|
}
|
|
127
92
|
onDestroy() {
|
|
128
93
|
this._teardown();
|
|
@@ -135,34 +100,25 @@ class N extends f {
|
|
|
135
100
|
const t = this.getContainer();
|
|
136
101
|
if (!t)
|
|
137
102
|
return;
|
|
138
|
-
const e = (a,
|
|
139
|
-
const
|
|
140
|
-
|
|
103
|
+
const e = (a, n) => {
|
|
104
|
+
const i = t.querySelector(a);
|
|
105
|
+
i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
|
|
141
106
|
};
|
|
142
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-
|
|
143
|
-
this.legacyConversion.convertLegacyStrategy();
|
|
144
|
-
});
|
|
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());
|
|
145
108
|
}
|
|
146
109
|
_renderState() {
|
|
147
|
-
var
|
|
148
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
149
|
-
if (
|
|
150
|
-
return;
|
|
151
|
-
const c = this.getContainer();
|
|
152
|
-
if (!c)
|
|
110
|
+
var l;
|
|
111
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
|
|
112
|
+
if (a === this.lastPaintedState)
|
|
153
113
|
return;
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
114
|
+
const n = this.getContainer();
|
|
115
|
+
if (!n)
|
|
156
116
|
return;
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
l.style.display = l === u ? "" : "none";
|
|
160
|
-
}), g.querySelectorAll("button").forEach((l) => {
|
|
161
|
-
l.disabled = a;
|
|
162
|
-
}), g.classList.toggle("is-converting", a), m && t && (m.textContent = e || `#${t}`), this.lastPaintedState = n;
|
|
117
|
+
const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
|
|
118
|
+
!i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
|
|
163
119
|
}
|
|
164
120
|
}
|
|
165
121
|
export {
|
|
166
|
-
|
|
167
|
-
|
|
122
|
+
p as STRATEGY_CONTROL_ID,
|
|
123
|
+
f as StrategyControl
|
|
168
124
|
};
|