@useinsider/guido 3.18.0-beta.41e529d → 3.18.0-beta.599df29
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/@types/config/schemas.js +1 -3
- package/dist/components/Guido.vue.js +2 -2
- package/dist/components/Guido.vue2.js +87 -85
- 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/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
- package/dist/composables/useActionsApi.js +82 -67
- package/dist/composables/useAutoSave.js +31 -26
- package/dist/composables/useCustomInterfaceAppearance.js +42 -46
- package/dist/composables/useEditorLock.js +20 -0
- package/dist/composables/useGuidoStateBridge.js +37 -31
- package/dist/composables/useSave.js +42 -39
- package/dist/enums/extensions/recommendationBlock.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +69 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +31 -66
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +49 -90
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +52 -61
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useEditorLock.d.ts +10 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -54
- package/dist/src/services/recommendationApi.d.ts +1 -2
- package/dist/src/stores/config.d.ts +0 -160
- package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
- package/dist/stores/config.js +59 -66
- package/package.json +1 -1
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
- package/dist/composables/useLegacyStrategyConversion.js +0 -52
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -58
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.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 -39
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
- package/dist/static/assets/icons/line-info.svg.js +0 -5
|
@@ -1,52 +1,55 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
const { prepareTemplateDetails:
|
|
21
|
-
if (!
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as q } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as C } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as L, useSaveComplete as M } from "./useGuidoActions.js";
|
|
5
|
+
import { useSyncModuleExtractor as D } from "./useSyncModuleExtractor.js";
|
|
6
|
+
import { ToasterTypeOptions as P } from "../enums/toaster.js";
|
|
7
|
+
import { useStripoApi as U } from "../services/stripoApi.js";
|
|
8
|
+
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
9
|
+
import { useAllowlist as h } from "./useAllowlist.js";
|
|
10
|
+
import { useHtmlValidator as F } from "./useHtmlValidator.js";
|
|
11
|
+
import { useToaster as O } from "./useToaster.js";
|
|
12
|
+
import { useCouponBlockValidator as W } from "./validators/useCouponBlockValidator.js";
|
|
13
|
+
import { useLiquidValidator as j } from "./validators/useLiquidValidator.js";
|
|
14
|
+
import { useSyncModuleBlockValidator as z } from "./validators/useSyncModuleBlockValidator.js";
|
|
15
|
+
import { useUnsubscribeBlockValidator as G } from "./validators/useUnsubscribeBlockValidator.js";
|
|
16
|
+
const rt = () => {
|
|
17
|
+
const n = L(), c = M(), { validateHtml: d } = F(), { validateLiquidSyntax: m } = j(), { validateCouponBlockTags: u } = W(), { validateUnsubscribeBlockUniqueness: p, validateUnsubscribeBlockHasTemplate: f } = G(), { validateSyncModuleBlocks: v } = z(), { callbacks: s, isFeatureEnabled: r } = q(), { extractSyncModuleData: S } = D(), { setSyncModuleUnsubscriptionPages: b } = U(), { editorSave: w } = T(), { showToaster: V } = O(), { getBlockedDomains: y, resolveToast: k } = h(), { runExclusive: x } = C(), H = async (a, o) => {
|
|
18
|
+
var l;
|
|
19
|
+
n();
|
|
20
|
+
const { prepareTemplateDetails: B } = A(), t = await B();
|
|
21
|
+
if (!v(t.rawHtml, o) || !u(t.compiledHtml) || !p(t.compiledHtml) || !f(t.compiledHtml))
|
|
22
22
|
return;
|
|
23
|
-
if (
|
|
24
|
-
if (!await
|
|
23
|
+
if (r("liquidSyntax")) {
|
|
24
|
+
if (!await m(t.compiledHtml))
|
|
25
25
|
return;
|
|
26
|
-
} else if (!await
|
|
26
|
+
} else if (!await d(t.compiledHtml, t.dynamicContentList, !0))
|
|
27
27
|
return;
|
|
28
|
-
if ((
|
|
28
|
+
if ((l = s.value) != null && l.externalValidation && !await s.value.externalValidation(t))
|
|
29
29
|
return;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
type:
|
|
37
|
-
message:
|
|
38
|
-
actionButton:
|
|
30
|
+
if (r("allowlistEnabled")) {
|
|
31
|
+
const i = await y(t.compiledHtml, t.css);
|
|
32
|
+
if (i.length) {
|
|
33
|
+
if (!o) {
|
|
34
|
+
const e = await k(i);
|
|
35
|
+
e != null && e.message && V({
|
|
36
|
+
type: P.Warning,
|
|
37
|
+
message: e.message,
|
|
38
|
+
actionButton: e.actionButton
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
if (!await
|
|
44
|
+
if (!await w())
|
|
45
45
|
return;
|
|
46
|
-
const { unsubscribePayload:
|
|
47
|
-
return await
|
|
48
|
-
}
|
|
46
|
+
const { unsubscribePayload: E, stripoModules: g } = S(t.rawHtml);
|
|
47
|
+
return await b(E), t.modules = g, a || c({ ...t, silent: o }), t;
|
|
48
|
+
};
|
|
49
|
+
return { save: (a = !1, o = !1) => x(
|
|
50
|
+
() => H(a, o)
|
|
51
|
+
) };
|
|
49
52
|
};
|
|
50
53
|
export {
|
|
51
|
-
|
|
54
|
+
rt as useSave
|
|
52
55
|
};
|
|
@@ -4,8 +4,7 @@ const l = {
|
|
|
4
4
|
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
|
-
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
8
|
-
NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations"
|
|
7
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
9
8
|
}, c = {
|
|
10
9
|
CLIENT_ID: "clientId"
|
|
11
10
|
}, d = () => {
|
|
@@ -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,9 +12,9 @@ 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";
|
|
@@ -29,38 +29,38 @@ import { ShuffleControl as F } 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 kt, formatProductPrice as Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows 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 Dt, getCardComposition as Ft, 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
|
// blockId -> fingerprint of the node config as it looked at the last sync.
|
|
43
|
-
|
|
43
|
+
n(this, "syncedConfigs", /* @__PURE__ */ new Map());
|
|
44
44
|
// A config change waiting to reach the node config. Deferred so it can ride the
|
|
45
45
|
// re-render's single apply() — one user action must cost one undo press.
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
n(this, "pendingNodeConfigWrite", null);
|
|
47
|
+
n(this, "pendingConfigFlushTimer", null);
|
|
48
48
|
// Sub-control instances for lifecycle management
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
n(this, "algorithmControl", null);
|
|
50
|
+
n(this, "localeControl", null);
|
|
51
|
+
n(this, "currencyControl", null);
|
|
52
|
+
n(this, "productCountControl", null);
|
|
53
|
+
n(this, "productLayoutControl", null);
|
|
54
|
+
n(this, "filtersControl", null);
|
|
55
|
+
n(this, "shuffleControl", null);
|
|
56
|
+
n(this, "pricePlacementControl", null);
|
|
57
|
+
n(this, "layoutOrientationControl", null);
|
|
58
|
+
n(this, "strategyControl", null);
|
|
59
|
+
n(this, "rrsEnabled", !1);
|
|
60
60
|
/**
|
|
61
61
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
n(this, "_debouncedFetchProducts", f(async () => {
|
|
64
64
|
try {
|
|
65
65
|
await this.store.fetchRecommendationProducts();
|
|
66
66
|
} finally {
|
|
@@ -78,16 +78,16 @@ class at extends N {
|
|
|
78
78
|
* count. The store pads products to the configured size, so in-place only
|
|
79
79
|
* fails when the size actually changed.
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
n(this, "_debouncedRegenerateWithProducts", f(() => {
|
|
82
82
|
const t = this.store.recommendationProducts;
|
|
83
83
|
if (!this.currentNode || !this.api)
|
|
84
84
|
return;
|
|
85
85
|
const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
|
|
86
|
-
if (
|
|
86
|
+
if (x(this.currentNode)) {
|
|
87
87
|
o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
B({
|
|
91
91
|
currentNode: this.currentNode,
|
|
92
92
|
documentModifier: e,
|
|
93
93
|
products: t
|
|
@@ -142,8 +142,8 @@ class at extends N {
|
|
|
142
142
|
const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
|
|
143
143
|
if (!e)
|
|
144
144
|
return;
|
|
145
|
-
const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t),
|
|
146
|
-
e.classList.toggle("strategy-block",
|
|
145
|
+
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) >= _);
|
|
146
|
+
e.classList.toggle("strategy-block", r);
|
|
147
147
|
}
|
|
148
148
|
async onRender() {
|
|
149
149
|
var o;
|
|
@@ -161,9 +161,9 @@ class at extends N {
|
|
|
161
161
|
const e = this._getRecommendationIdFromNode(t);
|
|
162
162
|
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(() => {
|
|
163
163
|
this._initializeSubControls();
|
|
164
|
-
}), this._subControls.forEach((
|
|
165
|
-
var
|
|
166
|
-
|
|
164
|
+
}), this._subControls.forEach((r) => {
|
|
165
|
+
var i;
|
|
166
|
+
r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
onDestroy() {
|
|
@@ -210,11 +210,11 @@ class at extends N {
|
|
|
210
210
|
const t = this.store.currentRecommendationId;
|
|
211
211
|
if (!this.currentNode || !this.api || t === null)
|
|
212
212
|
return;
|
|
213
|
-
const { filters: e, strategyId: o, size:
|
|
213
|
+
const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
|
|
214
214
|
this.pendingNodeConfigWrite = {
|
|
215
215
|
blockId: t,
|
|
216
216
|
node: this.currentNode,
|
|
217
|
-
updates: { filters: e, strategyId: o, size:
|
|
217
|
+
updates: { filters: e, strategyId: o, size: r }
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
@@ -257,12 +257,11 @@ class at extends N {
|
|
|
257
257
|
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");
|
|
258
258
|
}
|
|
259
259
|
_syncNodeConfigToStore() {
|
|
260
|
-
var
|
|
261
|
-
const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((
|
|
260
|
+
var r;
|
|
261
|
+
const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
262
262
|
this.store.patchCurrentBlockConfig({
|
|
263
263
|
strategy: t.strategy,
|
|
264
264
|
strategyId: t.strategyId,
|
|
265
|
-
nodeConfigVersion: t.configVersion,
|
|
266
265
|
language: t.language,
|
|
267
266
|
size: t.size,
|
|
268
267
|
productIds: t.productIds,
|
|
@@ -301,8 +300,8 @@ class at extends N {
|
|
|
301
300
|
t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
|
|
302
301
|
this.store.fetchRecommendationCreateData(),
|
|
303
302
|
this.store.fetchRecommendationFilters()
|
|
304
|
-
])).forEach((o,
|
|
305
|
-
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][
|
|
303
|
+
])).forEach((o, r) => {
|
|
304
|
+
o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
|
|
306
305
|
}), this._applySmartDefaults();
|
|
307
306
|
try {
|
|
308
307
|
await this.store.fetchRecommendationProducts();
|
|
@@ -324,30 +323,30 @@ class at extends N {
|
|
|
324
323
|
if (!this.currentNode || !this.api)
|
|
325
324
|
return;
|
|
326
325
|
const t = c.getConfig(this.currentNode), e = {};
|
|
327
|
-
let o = null,
|
|
326
|
+
let o = null, r = null, i = null;
|
|
328
327
|
if (t.currency.code === a.currency.code) {
|
|
329
|
-
const { currencyList:
|
|
330
|
-
|
|
328
|
+
const { currencyList: s } = this.store;
|
|
329
|
+
s.length > 0 && (s.some(
|
|
331
330
|
(d) => d.value === `price.${a.currency.code}`
|
|
332
|
-
) || (o =
|
|
331
|
+
) || (o = s[0].value.replace("price.", ""), e.currency = {
|
|
333
332
|
...a.currency,
|
|
334
333
|
code: o,
|
|
335
334
|
symbol: o
|
|
336
335
|
}));
|
|
337
336
|
}
|
|
338
337
|
if (t.strategy === a.strategy) {
|
|
339
|
-
const
|
|
340
|
-
|
|
338
|
+
const s = this.store.getActivePredictiveAlgorithms;
|
|
339
|
+
s.length > 0 && (s.some(
|
|
341
340
|
(d) => d.value === a.strategy
|
|
342
|
-
) || (
|
|
341
|
+
) || (r = s[0].value, e.strategy = r));
|
|
343
342
|
}
|
|
344
343
|
if (t.language === a.language) {
|
|
345
|
-
const
|
|
346
|
-
|
|
344
|
+
const s = this.store.getLanguages;
|
|
345
|
+
s.length > 0 && (s.some(
|
|
347
346
|
(d) => d.value === a.language
|
|
348
|
-
) || (
|
|
347
|
+
) || (i = s[0].value, e.language = i));
|
|
349
348
|
}
|
|
350
|
-
!o && !
|
|
349
|
+
!o && !r && !i || (c.updateConfig(
|
|
351
350
|
this.api,
|
|
352
351
|
this.currentNode,
|
|
353
352
|
e,
|
|
@@ -368,22 +367,22 @@ class at extends N {
|
|
|
368
367
|
thousandSeparator: a.currency.thousandSeparator
|
|
369
368
|
}
|
|
370
369
|
} : {},
|
|
371
|
-
...
|
|
372
|
-
...
|
|
370
|
+
...r ? { strategy: r } : {},
|
|
371
|
+
...i ? { language: i } : {}
|
|
373
372
|
}, { triggerRefetch: !1 }));
|
|
374
373
|
}
|
|
375
374
|
/**
|
|
376
375
|
* Reads the recommendation-id attribute from the block element within the node
|
|
377
376
|
*/
|
|
378
377
|
_getRecommendationIdFromNode(t) {
|
|
379
|
-
const e =
|
|
378
|
+
const e = v(t);
|
|
380
379
|
if (!e || !("getAttribute" in e))
|
|
381
380
|
return null;
|
|
382
381
|
const o = e.getAttribute(I);
|
|
383
382
|
if (!o)
|
|
384
383
|
return null;
|
|
385
|
-
const
|
|
386
|
-
return Number.isNaN(
|
|
384
|
+
const r = parseInt(o);
|
|
385
|
+
return Number.isNaN(r) ? null : r;
|
|
387
386
|
}
|
|
388
387
|
/**
|
|
389
388
|
* Listen to store changes that require product refresh or regeneration.
|
|
@@ -400,17 +399,17 @@ class at extends N {
|
|
|
400
399
|
*/
|
|
401
400
|
_listenStateUpdates() {
|
|
402
401
|
const { store: t } = this;
|
|
403
|
-
let e = t.recommendationProducts, o = t.$state.configVersion,
|
|
402
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
|
|
404
403
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
407
|
-
|
|
404
|
+
const i = t.currentRecommendationId;
|
|
405
|
+
if (i !== r) {
|
|
406
|
+
r = i, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
408
407
|
return;
|
|
409
408
|
}
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
const u = t.recommendationProducts, d = u !== e,
|
|
413
|
-
d &&
|
|
409
|
+
const s = t.$state.configVersion;
|
|
410
|
+
s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
|
|
411
|
+
const u = t.recommendationProducts, d = u !== e, g = Array.isArray(u) && u.length > 0;
|
|
412
|
+
d && g && (e = u, this._debouncedRegenerateWithProducts());
|
|
414
413
|
});
|
|
415
414
|
}
|
|
416
415
|
}
|
|
@@ -418,9 +417,9 @@ export {
|
|
|
418
417
|
ut as ALGORITHM_CONTROL_ID,
|
|
419
418
|
T as AlgorithmControl,
|
|
420
419
|
$ as CONTROL_BLOCK_ID,
|
|
421
|
-
|
|
420
|
+
ht as CURRENCY_CONTROL_ID,
|
|
422
421
|
P as CurrencyControl,
|
|
423
|
-
|
|
422
|
+
gt as FILTERS_CONTROL_ID,
|
|
424
423
|
S as FiltersControl,
|
|
425
424
|
Ct as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
426
425
|
yt as LOCALE_CONTROL_ID,
|
|
@@ -439,15 +438,15 @@ export {
|
|
|
439
438
|
w as StrategyControl,
|
|
440
439
|
kt as adjustProductsToSize,
|
|
441
440
|
Dt as formatProductPrice,
|
|
442
|
-
|
|
441
|
+
v as getBlockElement,
|
|
443
442
|
Ft as getCardComposition,
|
|
444
443
|
wt as getCurrentLayout,
|
|
445
444
|
At as getMainContainerTbody,
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
x as isPartnerManagedBlock,
|
|
446
|
+
vt as regenerateMobileProductRows,
|
|
448
447
|
U as regenerateProductRowsWithStyles,
|
|
449
448
|
A as setCurrencyAttributes,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
xt as updatePricesInPlace,
|
|
450
|
+
B as updateProductContentInPlace,
|
|
451
|
+
Bt as updateSingleProductContent
|
|
453
452
|
};
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class R 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 {
|
|
10
9
|
constructor() {
|
|
11
10
|
super(...arguments);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
c(this, "storeUnsubscription", () => {
|
|
11
|
+
o(this, "store", u());
|
|
12
|
+
o(this, "storeUnsubscription", () => {
|
|
15
13
|
});
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
o(this, "listeners", []);
|
|
15
|
+
o(this, "lastPaintedState", null);
|
|
18
16
|
}
|
|
19
17
|
getId() {
|
|
20
|
-
return
|
|
18
|
+
return p;
|
|
21
19
|
}
|
|
22
20
|
getTemplate() {
|
|
23
21
|
const t = this.api.translate(
|
|
24
22
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
25
|
-
), e = this.api.translate("For more information, you can"),
|
|
26
|
-
"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."
|
|
27
|
-
);
|
|
23
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
|
|
28
24
|
return `
|
|
29
25
|
<div class="strategy-control-container">
|
|
30
26
|
<div class="strategy-control-header">
|
|
@@ -35,9 +31,9 @@ class R extends f {
|
|
|
35
31
|
${t}
|
|
36
32
|
${e}
|
|
37
33
|
<a
|
|
38
|
-
href="${
|
|
34
|
+
href="${m.EMAIL_RECOMMENDATION_BLOCK}"
|
|
39
35
|
target="_blank"
|
|
40
|
-
rel="noopener noreferrer">${
|
|
36
|
+
rel="noopener noreferrer">${a}</a>.
|
|
41
37
|
</p>
|
|
42
38
|
</div>
|
|
43
39
|
<div data-strategy-empty-state>
|
|
@@ -57,28 +53,6 @@ class R extends f {
|
|
|
57
53
|
})
|
|
58
54
|
], "strategy-control-cta-row")}
|
|
59
55
|
</div>
|
|
60
|
-
<div data-strategy-legacy-state style="display: none;">
|
|
61
|
-
<div class="strategy-control-notice-row">
|
|
62
|
-
<div class="strategy-control-notice">
|
|
63
|
-
<p class="strategy-control-notice-text">${n}</p>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="strategy-control-name-band">
|
|
67
|
-
<span class="strategy-control-name">${r}</span>
|
|
68
|
-
${this._strategyAction({
|
|
69
|
-
id: "guido__btn-update-legacy-strategy",
|
|
70
|
-
label: this.api.translate("Update"),
|
|
71
|
-
modifier: "update"
|
|
72
|
-
})}
|
|
73
|
-
</div>
|
|
74
|
-
<div class="strategy-control-actions">
|
|
75
|
-
${this._strategyAction({
|
|
76
|
-
id: "guido__btn-change-legacy-strategy",
|
|
77
|
-
label: this.api.translate("Change"),
|
|
78
|
-
modifier: "change"
|
|
79
|
-
})}
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
56
|
<div data-strategy-assigned-state style="display: none;">
|
|
83
57
|
<div class="strategy-control-name-band">
|
|
84
58
|
<span class="strategy-control-name" data-strategy-name></span>
|
|
@@ -99,12 +73,12 @@ class R extends f {
|
|
|
99
73
|
</div>
|
|
100
74
|
`;
|
|
101
75
|
}
|
|
102
|
-
_strategyAction({ id: t, label: e, modifier:
|
|
76
|
+
_strategyAction({ id: t, label: e, modifier: a }) {
|
|
103
77
|
return `
|
|
104
78
|
<button
|
|
105
79
|
id="${t}"
|
|
106
80
|
type="button"
|
|
107
|
-
class="strategy-control-action strategy-control-action--${
|
|
81
|
+
class="strategy-control-action strategy-control-action--${a}">
|
|
108
82
|
<span>${e}</span>
|
|
109
83
|
</button>
|
|
110
84
|
`;
|
|
@@ -126,34 +100,25 @@ class R extends f {
|
|
|
126
100
|
const t = this.getContainer();
|
|
127
101
|
if (!t)
|
|
128
102
|
return;
|
|
129
|
-
const e = (
|
|
130
|
-
const
|
|
131
|
-
|
|
103
|
+
const e = (a, n) => {
|
|
104
|
+
const i = t.querySelector(a);
|
|
105
|
+
i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
|
|
132
106
|
};
|
|
133
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-
|
|
134
|
-
this.legacyConversion.convertLegacyStrategy();
|
|
135
|
-
});
|
|
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());
|
|
136
108
|
}
|
|
137
109
|
_renderState() {
|
|
138
|
-
var
|
|
139
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
140
|
-
if (
|
|
141
|
-
return;
|
|
142
|
-
const g = this.getContainer();
|
|
143
|
-
if (!g)
|
|
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)
|
|
144
113
|
return;
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
114
|
+
const n = this.getContainer();
|
|
115
|
+
if (!n)
|
|
147
116
|
return;
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
l.style.display = l === p ? "" : "none";
|
|
151
|
-
}), i.querySelectorAll("button").forEach((l) => {
|
|
152
|
-
l.disabled = s;
|
|
153
|
-
}), i.classList.toggle("is-converting", s), m && t && (m.textContent = e || `#${t}`), this.lastPaintedState = h;
|
|
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);
|
|
154
119
|
}
|
|
155
120
|
}
|
|
156
121
|
export {
|
|
157
|
-
|
|
158
|
-
|
|
122
|
+
p as STRATEGY_CONTROL_ID,
|
|
123
|
+
f as StrategyControl
|
|
159
124
|
};
|