@useinsider/guido 3.18.3-beta.ec88281 → 3.19.0-beta.f02eaa1
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 +41 -3
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +55 -53
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -49
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
- package/dist/composables/useCustomInterfaceAppearance.js +46 -42
- package/dist/composables/useGuidoStateBridge.js +29 -24
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useStripo.js +7 -7
- package/dist/enums/extensions/recommendationBlock.js +40 -31
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +77 -76
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +6 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +110 -46
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/library.js +15 -13
- package/dist/package.json.js +1 -1
- package/dist/public/editorState.js +4 -0
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useGuidoStateBridge.d.ts +11 -7
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +70 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/library.d.ts +2 -0
- package/dist/src/public/editorState.d.ts +14 -0
- package/dist/src/public/trackingIds.d.ts +6 -2
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/stores/guido-email-editor.d.ts +27 -27
- package/dist/src/stores/onboarding.d.ts +808 -10
- package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +70 -5
- package/dist/stores/config.js +74 -60
- package/dist/stores/editor.js +4 -0
- package/dist/stores/guido-email-editor.js +0 -4
- package/dist/stores/onboarding.js +46 -36
- package/dist/utils/genericUtil.js +64 -61
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/package.json +10 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var C = (
|
|
3
|
-
var
|
|
2
|
+
var C = (g, l, t) => l in g ? m(g, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[l] = t;
|
|
3
|
+
var r = (g, l, t) => C(g, 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 gt } from "./currency.js";
|
|
16
16
|
import { FiltersControl as S } from "./filters.js";
|
|
17
|
-
import { FILTERS_CONTROL_ID as
|
|
17
|
+
import { FILTERS_CONTROL_ID as ht } 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 k } from "./pricePlacement.js";
|
|
23
23
|
import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
|
|
24
|
-
import { ProductCountControl as
|
|
24
|
+
import { ProductCountControl as E } 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 B, isPartnerManagedBlock as v, updateProductContentInPlace as x, regenerateProductRowsWithStyles as U } from "./utils.js";
|
|
33
|
+
import { adjustProductsToSize as Et, formatProductPrice as Ft, getCardComposition as Dt, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as Bt, updatePricesInPlace as vt, updateSingleProductContent as xt } 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
|
+
r(this, "store", R());
|
|
40
|
+
r(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
|
+
r(this, "pendingNodeConfigWrite", null);
|
|
45
|
+
r(this, "pendingConfigFlushTimer", null);
|
|
46
46
|
// Sub-control instances for lifecycle management
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
r(this, "algorithmControl", null);
|
|
48
|
+
r(this, "localeControl", null);
|
|
49
|
+
r(this, "currencyControl", null);
|
|
50
|
+
r(this, "productCountControl", null);
|
|
51
|
+
r(this, "productLayoutControl", null);
|
|
52
|
+
r(this, "filtersControl", null);
|
|
53
|
+
r(this, "shuffleControl", null);
|
|
54
|
+
r(this, "pricePlacementControl", null);
|
|
55
|
+
r(this, "layoutOrientationControl", null);
|
|
56
|
+
r(this, "strategyControl", null);
|
|
57
|
+
r(this, "rrsEnabled", !1);
|
|
58
58
|
/**
|
|
59
59
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
r(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
|
+
r(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 (v(this.currentNode)) {
|
|
85
85
|
o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
x({
|
|
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 E(), this.productLayoutControl = new F(), this.filtersControl = new S(), this.shuffleControl = new D(), this.pricePlacementControl = new k(), 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), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _), s = this.rrsEnabled && !!o && !n;
|
|
144
|
+
e.classList.toggle("strategy-block", n), e.classList.toggle("legacy-strategy-block", s);
|
|
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((n) => {
|
|
163
|
+
var s;
|
|
164
|
+
n != null && n.api && (n.currentNode = t, (s = n.onTemplateNodeUpdated) == null || s.call(n, 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)), n = e.syncedConfigFingerprint;
|
|
213
|
+
e.syncedConfigFingerprint = o, n !== 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: n, nodeConfigVersion: s } = 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: n, configVersion: s }
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
/**
|
|
@@ -263,11 +263,12 @@ 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 n;
|
|
267
|
+
const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((n = this.store.blockStates[e]) == null ? void 0 : n.isInitialized);
|
|
268
268
|
this.store.patchCurrentBlockConfig({
|
|
269
269
|
strategy: t.strategy,
|
|
270
270
|
strategyId: t.strategyId,
|
|
271
|
+
nodeConfigVersion: t.configVersion,
|
|
271
272
|
language: t.language,
|
|
272
273
|
size: t.size,
|
|
273
274
|
productIds: t.productIds,
|
|
@@ -306,8 +307,8 @@ class at extends N {
|
|
|
306
307
|
t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
|
|
307
308
|
this.store.fetchRecommendationCreateData(),
|
|
308
309
|
this.store.fetchRecommendationFilters()
|
|
309
|
-
])).forEach((o,
|
|
310
|
-
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][
|
|
310
|
+
])).forEach((o, n) => {
|
|
311
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][n]} failed`, o.reason);
|
|
311
312
|
}), this._applySmartDefaults();
|
|
312
313
|
try {
|
|
313
314
|
await this.store.fetchRecommendationProducts();
|
|
@@ -329,30 +330,30 @@ class at extends N {
|
|
|
329
330
|
if (!this.currentNode || !this.api)
|
|
330
331
|
return;
|
|
331
332
|
const t = c.getConfig(this.currentNode), e = {};
|
|
332
|
-
let o = null,
|
|
333
|
+
let o = null, n = null, s = null;
|
|
333
334
|
if (t.currency.code === a.currency.code) {
|
|
334
|
-
const { currencyList:
|
|
335
|
-
|
|
335
|
+
const { currencyList: i } = this.store;
|
|
336
|
+
i.length > 0 && (i.some(
|
|
336
337
|
(d) => d.value === `price.${a.currency.code}`
|
|
337
|
-
) || (o =
|
|
338
|
+
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
338
339
|
...a.currency,
|
|
339
340
|
code: o,
|
|
340
341
|
symbol: o
|
|
341
342
|
}));
|
|
342
343
|
}
|
|
343
344
|
if (t.strategy === a.strategy) {
|
|
344
|
-
const
|
|
345
|
-
|
|
345
|
+
const i = this.store.getActivePredictiveAlgorithms;
|
|
346
|
+
i.length > 0 && (i.some(
|
|
346
347
|
(d) => d.value === a.strategy
|
|
347
|
-
) || (
|
|
348
|
+
) || (n = i[0].value, e.strategy = n));
|
|
348
349
|
}
|
|
349
350
|
if (t.language === a.language) {
|
|
350
|
-
const
|
|
351
|
-
|
|
351
|
+
const i = this.store.getLanguages;
|
|
352
|
+
i.length > 0 && (i.some(
|
|
352
353
|
(d) => d.value === a.language
|
|
353
|
-
) || (
|
|
354
|
+
) || (s = i[0].value, e.language = s));
|
|
354
355
|
}
|
|
355
|
-
!o && !
|
|
356
|
+
!o && !n && !s || (c.updateConfig(
|
|
356
357
|
this.api,
|
|
357
358
|
this.currentNode,
|
|
358
359
|
e,
|
|
@@ -373,22 +374,22 @@ class at extends N {
|
|
|
373
374
|
thousandSeparator: a.currency.thousandSeparator
|
|
374
375
|
}
|
|
375
376
|
} : {},
|
|
376
|
-
...
|
|
377
|
-
...
|
|
377
|
+
...n ? { strategy: n } : {},
|
|
378
|
+
...s ? { language: s } : {}
|
|
378
379
|
}, { triggerRefetch: !1 }));
|
|
379
380
|
}
|
|
380
381
|
/**
|
|
381
382
|
* Reads the recommendation-id attribute from the block element within the node
|
|
382
383
|
*/
|
|
383
384
|
_getRecommendationIdFromNode(t) {
|
|
384
|
-
const e =
|
|
385
|
+
const e = B(t);
|
|
385
386
|
if (!e || !("getAttribute" in e))
|
|
386
387
|
return null;
|
|
387
388
|
const o = e.getAttribute(I);
|
|
388
389
|
if (!o)
|
|
389
390
|
return null;
|
|
390
|
-
const
|
|
391
|
-
return Number.isNaN(
|
|
391
|
+
const n = parseInt(o);
|
|
392
|
+
return Number.isNaN(n) ? null : n;
|
|
392
393
|
}
|
|
393
394
|
/**
|
|
394
395
|
* Listen to store changes that require product refresh or regeneration.
|
|
@@ -405,17 +406,17 @@ class at extends N {
|
|
|
405
406
|
*/
|
|
406
407
|
_listenStateUpdates() {
|
|
407
408
|
const { store: t } = this;
|
|
408
|
-
let e = t.recommendationProducts, o = t.$state.configVersion,
|
|
409
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
|
|
409
410
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
|
|
411
|
+
const s = t.currentRecommendationId;
|
|
412
|
+
if (s !== n) {
|
|
413
|
+
n = s, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
413
414
|
return;
|
|
414
415
|
}
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const u = t.recommendationProducts, d = u !== e,
|
|
418
|
-
d &&
|
|
416
|
+
const i = t.$state.configVersion;
|
|
417
|
+
i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
|
|
418
|
+
const u = t.recommendationProducts, d = u !== e, h = Array.isArray(u) && u.length > 0;
|
|
419
|
+
d && h && (e = u, this._debouncedRegenerateWithProducts());
|
|
419
420
|
});
|
|
420
421
|
}
|
|
421
422
|
}
|
|
@@ -423,9 +424,9 @@ export {
|
|
|
423
424
|
ut as ALGORITHM_CONTROL_ID,
|
|
424
425
|
T as AlgorithmControl,
|
|
425
426
|
$ as CONTROL_BLOCK_ID,
|
|
426
|
-
|
|
427
|
+
gt as CURRENCY_CONTROL_ID,
|
|
427
428
|
P as CurrencyControl,
|
|
428
|
-
|
|
429
|
+
ht as FILTERS_CONTROL_ID,
|
|
429
430
|
S as FiltersControl,
|
|
430
431
|
Ct as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
431
432
|
yt as LOCALE_CONTROL_ID,
|
|
@@ -434,25 +435,25 @@ export {
|
|
|
434
435
|
_t as PRICE_PLACEMENT_CONTROL_ID,
|
|
435
436
|
Rt as PRODUCT_COUNT_CONTROL_ID,
|
|
436
437
|
Tt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
k as PricePlacementControl,
|
|
439
|
+
E as ProductCountControl,
|
|
439
440
|
F as ProductLayoutControl,
|
|
440
441
|
at as RecommendationBlockControl,
|
|
441
442
|
St as SHUFFLE_CONTROL_ID,
|
|
442
443
|
Lt as STRATEGY_CONTROL_ID,
|
|
443
444
|
D as ShuffleControl,
|
|
444
445
|
w as StrategyControl,
|
|
445
|
-
|
|
446
|
+
Et as adjustProductsToSize,
|
|
446
447
|
Ft as formatProductPrice,
|
|
447
|
-
|
|
448
|
+
B as getBlockElement,
|
|
448
449
|
Dt as getCardComposition,
|
|
449
450
|
wt as getCurrentLayout,
|
|
450
451
|
At as getMainContainerTbody,
|
|
451
|
-
|
|
452
|
-
|
|
452
|
+
v as isPartnerManagedBlock,
|
|
453
|
+
Bt as regenerateMobileProductRows,
|
|
453
454
|
U as regenerateProductRowsWithStyles,
|
|
454
455
|
A as setCurrencyAttributes,
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
456
|
+
vt as updatePricesInPlace,
|
|
457
|
+
x as updateProductContentInPlace,
|
|
458
|
+
xt as updateSingleProductContent
|
|
458
459
|
};
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var v = (i, s, t) => s in i ? p(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
|
|
3
|
+
var r = (i, s, t) => v(i, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { useLegacyStrategyConversion as _ } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as b } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as S } from "../../../../../stores/onboarding.js";
|
|
7
|
+
import { CommonControl as f } from "../../../common-control.js";
|
|
8
|
+
import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
|
|
9
|
+
const C = "recommendation-strategy-control";
|
|
10
|
+
class N extends f {
|
|
9
11
|
constructor() {
|
|
10
12
|
super(...arguments);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
r(this, "store", $());
|
|
14
|
+
r(this, "onboardingStore", S());
|
|
15
|
+
r(this, "legacyConversion", _());
|
|
16
|
+
r(this, "storeUnsubscription", () => {
|
|
13
17
|
});
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
r(this, "listeners", []);
|
|
19
|
+
r(this, "lastPaintedState", null);
|
|
16
20
|
}
|
|
17
21
|
getId() {
|
|
18
|
-
return
|
|
22
|
+
return C;
|
|
19
23
|
}
|
|
20
24
|
getTemplate() {
|
|
21
25
|
const t = this.api.translate(
|
|
22
26
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
23
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy")
|
|
27
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), o = this.api.translate("Legacy Strategy"), n = this.api.translate(
|
|
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
|
+
);
|
|
24
30
|
return `
|
|
25
31
|
<div class="strategy-control-container">
|
|
26
32
|
<div class="strategy-control-header">
|
|
@@ -31,7 +37,7 @@ class f extends h {
|
|
|
31
37
|
${t}
|
|
32
38
|
${e}
|
|
33
39
|
<a
|
|
34
|
-
href="${
|
|
40
|
+
href="${b.EMAIL_RECOMMENDATION_BLOCK}"
|
|
35
41
|
target="_blank"
|
|
36
42
|
rel="noopener noreferrer">${a}</a>.
|
|
37
43
|
</p>
|
|
@@ -53,6 +59,33 @@ class f extends h {
|
|
|
53
59
|
})
|
|
54
60
|
], "strategy-control-cta-row")}
|
|
55
61
|
</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>
|
|
56
89
|
<div data-strategy-assigned-state style="display: none;">
|
|
57
90
|
<div class="strategy-control-name-band">
|
|
58
91
|
<span class="strategy-control-name" data-strategy-name></span>
|
|
@@ -88,6 +121,8 @@ class f extends h {
|
|
|
88
121
|
this._renderState();
|
|
89
122
|
}), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
|
|
90
123
|
});
|
|
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");
|
|
91
126
|
}
|
|
92
127
|
onDestroy() {
|
|
93
128
|
this._teardown();
|
|
@@ -100,25 +135,34 @@ class f extends h {
|
|
|
100
135
|
const t = this.getContainer();
|
|
101
136
|
if (!t)
|
|
102
137
|
return;
|
|
103
|
-
const e = (a,
|
|
104
|
-
const
|
|
105
|
-
|
|
138
|
+
const e = (a, o) => {
|
|
139
|
+
const n = t.querySelector(a);
|
|
140
|
+
n && (n.addEventListener("click", o), this.listeners.push({ element: n, handler: o }));
|
|
106
141
|
};
|
|
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())
|
|
142
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
143
|
+
this.legacyConversion.convertLegacyStrategy();
|
|
144
|
+
});
|
|
108
145
|
}
|
|
109
146
|
_renderState() {
|
|
110
|
-
var
|
|
111
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
112
|
-
if (
|
|
147
|
+
var h;
|
|
148
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((h = this.store.assignedStrategy) == null ? void 0 : h.name) ?? "" : "", a = this.store.legacyConversionLoading, o = this.store.isLegacyStrategyBlock, n = `${t}\0${e}\0${a}\0${o}`;
|
|
149
|
+
if (n === this.lastPaintedState)
|
|
150
|
+
return;
|
|
151
|
+
const c = this.getContainer();
|
|
152
|
+
if (!c)
|
|
113
153
|
return;
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
154
|
+
const d = c.querySelector("[data-strategy-empty-state]"), y = c.querySelector("[data-strategy-assigned-state]"), g = c.querySelector("[data-strategy-legacy-state]"), m = c.querySelector("[data-strategy-name]");
|
|
155
|
+
if (!d || !y || !g)
|
|
116
156
|
return;
|
|
117
|
-
const
|
|
118
|
-
|
|
157
|
+
const u = t ? y : o ? g : d;
|
|
158
|
+
[d, y, g].forEach((l) => {
|
|
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;
|
|
119
163
|
}
|
|
120
164
|
}
|
|
121
165
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
166
|
+
C as STRATEGY_CONTROL_ID,
|
|
167
|
+
N as StrategyControl
|
|
124
168
|
};
|