@useinsider/guido 3.16.0-beta.efbb91f → 3.16.0-beta.fe1df65
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 +8 -8
- package/dist/components/Guido.vue2.js +76 -78
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +23 -45
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useHtmlValidator.js +0 -1
- package/dist/composables/useRecommendation.js +20 -19
- package/dist/composables/useSave.js +41 -84
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- 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 +18 -15
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/recommendation.js +17 -17
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
- 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 +23 -22
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +29 -26
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +306 -238
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +29 -28
- 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 +26 -32
- 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/productIds.js +6 -0
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/composables/useHtmlValidator.d.ts +0 -14
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +1 -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 +4 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- 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 +0 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
- package/dist/src/stores/config.d.ts +0 -5
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/stores/config.js +6 -13
- package/dist/utils/templatePreparation.js +25 -28
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -61
- package/dist/composables/useSaveValidation.js +0 -276
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var h = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
|
+
var c = (r, s, t) => h(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as g } from "../../../common-control.js";
|
|
6
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
|
|
8
|
-
import { mapLegacyStrategy as
|
|
9
|
-
const
|
|
8
|
+
import { mapLegacyStrategy as u } from "../../utils/legacyStrategyMap.js";
|
|
9
|
+
const p = "recommendation-algorithm-control", i = {
|
|
10
10
|
ALGORITHM: "strategy",
|
|
11
11
|
PRODUCT_IDS: "productIds"
|
|
12
12
|
};
|
|
13
|
-
class R extends
|
|
13
|
+
class R extends g {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(...arguments);
|
|
16
16
|
// Store is used ONLY for API-fetched data (algorithms list), not for config
|
|
17
|
-
|
|
17
|
+
c(this, "store", m());
|
|
18
18
|
}
|
|
19
19
|
getId() {
|
|
20
|
-
return
|
|
20
|
+
return p;
|
|
21
21
|
}
|
|
22
22
|
getTemplate() {
|
|
23
23
|
return `
|
|
@@ -46,11 +46,10 @@ class R extends d {
|
|
|
46
46
|
super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
|
|
47
47
|
}
|
|
48
48
|
_setFormValues() {
|
|
49
|
-
const t = n.getConfig(this.currentNode), e =
|
|
50
|
-
this._setProductIdsVisibility(e)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
49
|
+
const t = n.getConfig(this.currentNode), e = u(t.strategy) ?? t.strategy;
|
|
50
|
+
this._setProductIdsVisibility(e);
|
|
51
|
+
const o = { [i.ALGORITHM]: e }, a = t.productIds.join(",");
|
|
52
|
+
this.api.getValues()[i.PRODUCT_IDS] !== a && (o[i.PRODUCT_IDS] = a), this.api.updateValues(o);
|
|
54
53
|
}
|
|
55
54
|
_initializeSelectItems() {
|
|
56
55
|
var e;
|
|
@@ -59,35 +58,47 @@ class R extends d {
|
|
|
59
58
|
try {
|
|
60
59
|
this.api.setUIEAttribute(
|
|
61
60
|
i.ALGORITHM,
|
|
62
|
-
|
|
61
|
+
l.SELECTPICKER.items,
|
|
63
62
|
t
|
|
64
63
|
);
|
|
65
|
-
} catch (
|
|
66
|
-
console.warn("[AlgorithmControl] Failed to set algorithm options:",
|
|
64
|
+
} catch (o) {
|
|
65
|
+
console.warn("[AlgorithmControl] Failed to set algorithm options:", o);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
_setProductIdsVisibility(t) {
|
|
70
|
-
const
|
|
71
|
-
this.api.setVisibility(i.PRODUCT_IDS,
|
|
69
|
+
const o = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
|
|
70
|
+
this.api.setVisibility(i.PRODUCT_IDS, o), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, o);
|
|
72
71
|
}
|
|
73
72
|
_onAlgorithmChange(t) {
|
|
74
|
-
|
|
73
|
+
if (!this.currentNode)
|
|
74
|
+
return;
|
|
75
|
+
const e = n.getConfig(this.currentNode);
|
|
76
|
+
if (e.strategy === t) {
|
|
77
|
+
this.store.recommendationConfigs.strategy !== t && this.store.patchCurrentBlockConfig({ strategy: e.strategy, filters: e.filters });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
n.updateConfig(
|
|
75
81
|
this.api,
|
|
76
82
|
this.currentNode,
|
|
77
83
|
{ strategy: t },
|
|
78
84
|
`Changed algorithm to ${t}`
|
|
79
|
-
), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t)
|
|
85
|
+
), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t);
|
|
80
86
|
}
|
|
81
87
|
_onProductIdsChange(t) {
|
|
82
88
|
if (!this.currentNode)
|
|
83
89
|
return;
|
|
84
|
-
const e =
|
|
90
|
+
const e = n.getConfig(this.currentNode);
|
|
91
|
+
if (e.productIds.join(",") === t) {
|
|
92
|
+
this.store.recommendationConfigs.productIds.join(",") !== t && this.store.patchCurrentBlockConfig({ productIds: e.productIds, filters: e.filters });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const o = t === "" ? [] : t.split(",");
|
|
85
96
|
n.updateConfig(
|
|
86
97
|
this.api,
|
|
87
98
|
this.currentNode,
|
|
88
|
-
{ productIds:
|
|
99
|
+
{ productIds: o },
|
|
89
100
|
"Updated product IDs"
|
|
90
|
-
), this.store.patchCurrentBlockConfig({ productIds:
|
|
101
|
+
), this.store.patchCurrentBlockConfig({ productIds: o });
|
|
91
102
|
}
|
|
92
103
|
_listenToFormUpdates() {
|
|
93
104
|
this.api.onValueChanged(i.ALGORITHM, (t) => {
|
|
@@ -98,6 +109,6 @@ class R extends d {
|
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
111
|
export {
|
|
101
|
-
|
|
112
|
+
p as ALGORITHM_CONTROL_ID,
|
|
102
113
|
R as AlgorithmControl
|
|
103
114
|
};
|
|
@@ -3,7 +3,7 @@ var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
5
|
import { DEFAULT_NODE_CONFIG as c } from "../../constants/defaultConfig.js";
|
|
6
|
-
import { RecommendationConfigService as
|
|
6
|
+
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
8
|
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
9
|
import { ALGORITHM_CONTROL_ID as tt } from "./algorithm.js";
|
|
@@ -11,21 +11,21 @@ import { CurrencyControl as R } from "./currency.js";
|
|
|
11
11
|
import { CURRENCY_CONTROL_ID as ot } from "./currency.js";
|
|
12
12
|
import { FiltersControl as I } from "./filters.js";
|
|
13
13
|
import { FILTERS_CONTROL_ID as nt } from "./filters.js";
|
|
14
|
-
import { LayoutOrientationControl as
|
|
14
|
+
import { LayoutOrientationControl as b } from "./layoutOrientation.js";
|
|
15
15
|
import { LAYOUT_ORIENTATION_CONTROL_ID as st } from "./layoutOrientation.js";
|
|
16
|
-
import { LocaleControl as
|
|
16
|
+
import { LocaleControl as _ } from "./locale.js";
|
|
17
17
|
import { LOCALE_CONTROL_ID as lt } from "./locale.js";
|
|
18
18
|
import { PricePlacementControl as T } from "./pricePlacement.js";
|
|
19
19
|
import { PRICE_PLACEMENT_CONTROL_ID as ut } from "./pricePlacement.js";
|
|
20
|
-
import { ProductCountControl as
|
|
21
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
22
|
-
import { ProductLayoutControl as
|
|
20
|
+
import { ProductCountControl as O } from "./productCount.js";
|
|
21
|
+
import { PRODUCT_COUNT_CONTROL_ID as ht } from "./productCount.js";
|
|
22
|
+
import { ProductLayoutControl as P } from "./productLayout.js";
|
|
23
23
|
import { PRODUCT_LAYOUT_CONTROL_ID as Ct } from "./productLayout.js";
|
|
24
|
-
import { ShuffleControl as
|
|
24
|
+
import { ShuffleControl as S } from "./shuffle.js";
|
|
25
25
|
import { SHUFFLE_CONTROL_ID as pt } from "./shuffle.js";
|
|
26
|
-
import { setCurrencyAttributes as
|
|
27
|
-
import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It, regenerateMobileProductRows as _t, updatePricesInPlace as
|
|
28
|
-
import { useDebounceFn as
|
|
26
|
+
import { setCurrencyAttributes as L, getBlockElement as k, isPartnerManagedBlock as D, updateProductContentInPlace as E, regenerateProductRowsWithStyles as A } from "./utils.js";
|
|
27
|
+
import { adjustProductsToSize as yt, formatProductPrice as Nt, getCardComposition as Rt, getCurrentLayout as It, getMainContainerTbody as bt, regenerateMobileProductRows as _t, updatePricesInPlace as Tt, updateSingleProductContent as Ot } from "./utils.js";
|
|
28
|
+
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
29
29
|
const v = "recommendation-id", w = "ui-elements-recommendation-block";
|
|
30
30
|
class Q extends g {
|
|
31
31
|
constructor() {
|
|
@@ -47,7 +47,7 @@ class Q extends g {
|
|
|
47
47
|
/**
|
|
48
48
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
49
49
|
*/
|
|
50
|
-
s(this, "_debouncedFetchProducts",
|
|
50
|
+
s(this, "_debouncedFetchProducts", m(() => {
|
|
51
51
|
this.store.fetchRecommendationProducts();
|
|
52
52
|
}, 500));
|
|
53
53
|
/**
|
|
@@ -61,7 +61,7 @@ class Q extends g {
|
|
|
61
61
|
* count. The store pads products to the configured size, so in-place only
|
|
62
62
|
* fails when the size actually changed.
|
|
63
63
|
*/
|
|
64
|
-
s(this, "_debouncedRegenerateWithProducts",
|
|
64
|
+
s(this, "_debouncedRegenerateWithProducts", m(() => {
|
|
65
65
|
const t = this.store.recommendationProducts;
|
|
66
66
|
if (!this.currentNode || !this.api || D(this.currentNode))
|
|
67
67
|
return;
|
|
@@ -81,7 +81,7 @@ class Q extends g {
|
|
|
81
81
|
return w;
|
|
82
82
|
}
|
|
83
83
|
getTemplate() {
|
|
84
|
-
return this.algorithmControl = new N(), this.localeControl = new
|
|
84
|
+
return this.algorithmControl = new N(), this.localeControl = new _(), this.currencyControl = new R(), this.productCountControl = new O(), this.productLayoutControl = new P(), this.filtersControl = new I(), this.shuffleControl = new S(), this.pricePlacementControl = new T(), this.layoutOrientationControl = new b(), [
|
|
85
85
|
this.algorithmControl,
|
|
86
86
|
this.localeControl,
|
|
87
87
|
this.currencyControl,
|
|
@@ -186,7 +186,7 @@ class Q extends g {
|
|
|
186
186
|
*/
|
|
187
187
|
_syncNodeConfigToStore() {
|
|
188
188
|
var r;
|
|
189
|
-
const t =
|
|
189
|
+
const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
190
190
|
this.store.patchCurrentBlockConfig({
|
|
191
191
|
strategy: t.strategy,
|
|
192
192
|
language: t.language,
|
|
@@ -249,7 +249,7 @@ class Q extends g {
|
|
|
249
249
|
_applySmartDefaults() {
|
|
250
250
|
if (!this.currentNode || !this.api)
|
|
251
251
|
return;
|
|
252
|
-
const t =
|
|
252
|
+
const t = h.getConfig(this.currentNode), e = {};
|
|
253
253
|
let o = null, r = null, n = null;
|
|
254
254
|
if (t.currency.code === c.currency.code) {
|
|
255
255
|
const { currencyList: i } = this.store;
|
|
@@ -273,12 +273,12 @@ class Q extends g {
|
|
|
273
273
|
(u) => u.value === c.language
|
|
274
274
|
) || (n = i[0].value, e.language = n));
|
|
275
275
|
}
|
|
276
|
-
!o && !r && !n || (
|
|
276
|
+
!o && !r && !n || (h.updateConfig(
|
|
277
277
|
this.api,
|
|
278
278
|
this.currentNode,
|
|
279
279
|
e,
|
|
280
280
|
"Applied smart defaults"
|
|
281
|
-
), o && e.currency &&
|
|
281
|
+
), o && e.currency && L({
|
|
282
282
|
currentNode: this.currentNode,
|
|
283
283
|
documentModifier: this.api.getDocumentModifier(),
|
|
284
284
|
currency: e.currency
|
|
@@ -346,8 +346,8 @@ class Q extends g {
|
|
|
346
346
|
_persistFiltersToNodeConfig() {
|
|
347
347
|
if (!this.currentNode || !this.api)
|
|
348
348
|
return;
|
|
349
|
-
const { filters: t } = this.store.recommendationConfigs;
|
|
350
|
-
|
|
349
|
+
const { filters: t } = this.store.recommendationConfigs, e = h.getConfig(this.currentNode).filters;
|
|
350
|
+
JSON.stringify(e) !== JSON.stringify(t) && h.updateConfig(
|
|
351
351
|
this.api,
|
|
352
352
|
this.currentNode,
|
|
353
353
|
{ filters: t },
|
|
@@ -365,27 +365,28 @@ export {
|
|
|
365
365
|
I as FiltersControl,
|
|
366
366
|
st as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
367
367
|
lt as LOCALE_CONTROL_ID,
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
b as LayoutOrientationControl,
|
|
369
|
+
_ as LocaleControl,
|
|
370
370
|
ut as PRICE_PLACEMENT_CONTROL_ID,
|
|
371
|
-
|
|
371
|
+
ht as PRODUCT_COUNT_CONTROL_ID,
|
|
372
372
|
Ct as PRODUCT_LAYOUT_CONTROL_ID,
|
|
373
373
|
T as PricePlacementControl,
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
O as ProductCountControl,
|
|
375
|
+
P as ProductLayoutControl,
|
|
376
376
|
Q as RecommendationBlockControl,
|
|
377
377
|
pt as SHUFFLE_CONTROL_ID,
|
|
378
|
-
|
|
378
|
+
S as ShuffleControl,
|
|
379
379
|
yt as adjustProductsToSize,
|
|
380
380
|
Nt as formatProductPrice,
|
|
381
381
|
k as getBlockElement,
|
|
382
382
|
Rt as getCardComposition,
|
|
383
383
|
It as getCurrentLayout,
|
|
384
|
+
bt as getMainContainerTbody,
|
|
384
385
|
D as isPartnerManagedBlock,
|
|
385
386
|
_t as regenerateMobileProductRows,
|
|
386
387
|
A as regenerateProductRowsWithStyles,
|
|
387
|
-
|
|
388
|
-
|
|
388
|
+
L as setCurrencyAttributes,
|
|
389
|
+
Tt as updatePricesInPlace,
|
|
389
390
|
E as updateProductContentInPlace,
|
|
390
|
-
|
|
391
|
+
Ot as updateSingleProductContent
|
|
391
392
|
};
|
|
@@ -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,
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as P } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as F, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
|
|
7
7
|
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
8
8
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
9
9
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
10
|
-
import { getPartnerRecommendationParams as
|
|
10
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
11
|
+
import { sanitizeProductIds as N } from "../utils/productIds.js";
|
|
11
12
|
import { isFilterValid as x } from "../validation/filterSchema.js";
|
|
12
|
-
import { isConfigValid as
|
|
13
|
-
const h =
|
|
13
|
+
import { isConfigValid as L } from "../validation/requiredFields.js";
|
|
14
|
+
const h = y();
|
|
14
15
|
let m = null, u = null, d = null;
|
|
15
|
-
function
|
|
16
|
+
function k() {
|
|
16
17
|
return {
|
|
17
|
-
cardsInRow:
|
|
18
|
+
cardsInRow: D,
|
|
18
19
|
currencySettings: {
|
|
19
20
|
name: "USD",
|
|
20
21
|
value: "USD",
|
|
@@ -28,7 +29,7 @@ function R() {
|
|
|
28
29
|
productIds: [],
|
|
29
30
|
id: 1,
|
|
30
31
|
language: "en_US",
|
|
31
|
-
mobileCardsInRow:
|
|
32
|
+
mobileCardsInRow: F,
|
|
32
33
|
mobileLayoutEnabled: !1,
|
|
33
34
|
orientation: "grid",
|
|
34
35
|
recommendedProducts: [],
|
|
@@ -43,9 +44,9 @@ function R() {
|
|
|
43
44
|
priceHideIfSameAsDiscounted: !1
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function I() {
|
|
47
48
|
return {
|
|
48
|
-
recommendationConfigs:
|
|
49
|
+
recommendationConfigs: k(),
|
|
49
50
|
recommendationProducts: [],
|
|
50
51
|
filterStatus: !1,
|
|
51
52
|
filterSelectionDrawerStatus: !1,
|
|
@@ -54,7 +55,7 @@ function k() {
|
|
|
54
55
|
filterSnapshot: null
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
+
const U = () => ({
|
|
58
59
|
recommendationCampaignUrls: {},
|
|
59
60
|
activePredictiveAlgorithms: [],
|
|
60
61
|
languages: {},
|
|
@@ -63,8 +64,8 @@ const L = () => ({
|
|
|
63
64
|
blockStates: {},
|
|
64
65
|
currentRecommendationId: null,
|
|
65
66
|
configVersion: 0
|
|
66
|
-
}),
|
|
67
|
-
state: () =>
|
|
67
|
+
}), H = P("guidoRecommendationExtension", {
|
|
68
|
+
state: () => U(),
|
|
68
69
|
getters: {
|
|
69
70
|
// ====================================================================
|
|
70
71
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -74,7 +75,7 @@ const L = () => ({
|
|
|
74
75
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
75
76
|
*/
|
|
76
77
|
recommendationConfigs(t) {
|
|
77
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
78
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
|
|
78
79
|
},
|
|
79
80
|
/**
|
|
80
81
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -138,7 +139,7 @@ const L = () => ({
|
|
|
138
139
|
getFilterList() {
|
|
139
140
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
140
141
|
let e;
|
|
141
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
142
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
142
143
|
text: t.displayName,
|
|
143
144
|
value: e,
|
|
144
145
|
type: t.attributeType
|
|
@@ -160,7 +161,7 @@ const L = () => ({
|
|
|
160
161
|
setCurrentBlock(t) {
|
|
161
162
|
this.blockStates[t] || (this.blockStates = {
|
|
162
163
|
...this.blockStates,
|
|
163
|
-
[t]:
|
|
164
|
+
[t]: I()
|
|
164
165
|
}), this.currentRecommendationId = t;
|
|
165
166
|
},
|
|
166
167
|
/**
|
|
@@ -228,7 +229,7 @@ const L = () => ({
|
|
|
228
229
|
decimalCount: String(e.currencyDecimalCount),
|
|
229
230
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
230
231
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
231
|
-
}, c = !this.blockStates[t], i = c ?
|
|
232
|
+
}, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
|
|
232
233
|
i.recommendationConfigs = {
|
|
233
234
|
...i.recommendationConfigs,
|
|
234
235
|
strategy: e.strategy,
|
|
@@ -266,7 +267,7 @@ const L = () => ({
|
|
|
266
267
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
267
268
|
*/
|
|
268
269
|
createDefaultFilter(t, e) {
|
|
269
|
-
const [r] = this.getFilterList, [n] =
|
|
270
|
+
const [r] = this.getFilterList, [n] = R(r == null ? void 0 : r.type);
|
|
270
271
|
return {
|
|
271
272
|
type: "standardFilter",
|
|
272
273
|
attribute: (r == null ? void 0 : r.value) ?? "",
|
|
@@ -429,14 +430,7 @@ const L = () => ({
|
|
|
429
430
|
* every block's recommendationConfigs across user edits.
|
|
430
431
|
*/
|
|
431
432
|
hasInvalidBlock() {
|
|
432
|
-
return Object.values(this.blockStates).some((t) => !
|
|
433
|
-
},
|
|
434
|
-
/**
|
|
435
|
-
* Per-instance counterpart to `hasInvalidBlock`: the ids of every block
|
|
436
|
-
* that fails required-field validation, one drawer row each (SD-147430).
|
|
437
|
-
*/
|
|
438
|
-
invalidBlockIds() {
|
|
439
|
-
return Object.entries(this.blockStates).filter(([, t]) => !I(t.recommendationConfigs, this)).map(([t]) => t);
|
|
433
|
+
return Object.values(this.blockStates).some((t) => !L(t.recommendationConfigs, this));
|
|
440
434
|
},
|
|
441
435
|
// ====================================================================
|
|
442
436
|
// Per-Block Product Fetching
|
|
@@ -457,7 +451,7 @@ const L = () => ({
|
|
|
457
451
|
},
|
|
458
452
|
async _doFetchProducts() {
|
|
459
453
|
var p;
|
|
460
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o =
|
|
454
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = G(), s = parseInt(r.size) || 6, a = {
|
|
461
455
|
locale: r.language,
|
|
462
456
|
currency: r.currencySettings.value,
|
|
463
457
|
partnerName: o.partnerName,
|
|
@@ -465,9 +459,9 @@ const L = () => ({
|
|
|
465
459
|
details: !0,
|
|
466
460
|
campaignId: o.variationId
|
|
467
461
|
};
|
|
468
|
-
r.strategy === "manualMerchandising" ? a.productId = r.productIds
|
|
462
|
+
r.strategy === "manualMerchandising" ? a.productId = N(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
469
463
|
a,
|
|
470
|
-
|
|
464
|
+
v(o.partnerName, r.strategy)
|
|
471
465
|
);
|
|
472
466
|
let f;
|
|
473
467
|
try {
|
|
@@ -486,5 +480,5 @@ const L = () => ({
|
|
|
486
480
|
}
|
|
487
481
|
});
|
|
488
482
|
export {
|
|
489
|
-
|
|
483
|
+
H as useRecommendationExtensionStore
|
|
490
484
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
|
|
2
2
|
import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
|
|
3
|
-
import {
|
|
3
|
+
import { createBlockTemplate as A, getDefaultProducts as g, DEFAULTS as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
|
|
4
4
|
import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
|
|
5
5
|
const G = `
|
|
6
6
|
<tr class="recommendation-product-row">
|
|
@@ -69,8 +69,8 @@ function M(t, r, o, e = {}, c = {}) {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
function Q(t) {
|
|
72
|
-
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o =
|
|
73
|
-
return o.replace("{-{-TITLE-}-}",
|
|
72
|
+
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = A("grid", r), e = g(), c = M(e, w);
|
|
73
|
+
return o.replace("{-{-TITLE-}-}", U.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
76
|
Q as getDefaultTemplate,
|