@useinsider/guido 2.1.0-beta.e13d291 → 2.1.0-beta.e2d48fe
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/config/migrator/itemsBlockMigrator.js +140 -123
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/extensions/Blocks/Items/block.js +19 -28
- package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +124 -85
- package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +34 -46
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +45 -50
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +40 -51
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -35
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -62
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/template.js +181 -175
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
- package/dist/extensions/Blocks/Recommendation/block.js +6 -40
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +187 -0
- package/dist/extensions/Blocks/Recommendation/constants.js +13 -0
- package/dist/extensions/Blocks/Recommendation/control.js +336 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +68 -0
- package/dist/extensions/Blocks/Recommendation/controls/index.js +245 -0
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +74 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textAfter.js → omnibusDiscountTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscount/textBefore.js → omnibusDiscountTextBeforeControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textAfter.js → omnibusPriceTextAfterControl.js} +14 -16
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPrice/textBefore.js → omnibusPriceTextBeforeControl.js} +12 -14
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +188 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +17 -40
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +3 -19
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -13
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +10 -21
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +36 -41
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +181 -0
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +189 -0
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +209 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +16 -27
- package/dist/extensions/Blocks/common-control.js +91 -92
- package/dist/extensions/Blocks/controlFactories.js +93 -125
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +169 -223
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +9 -10
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -34
- package/dist/src/extensions/Blocks/Recommendation/{controls/cardComposition/index.d.ts → cardCompositionControl.d.ts} +3 -23
- package/dist/src/extensions/Blocks/Recommendation/{constants/controlIds.d.ts → constants.d.ts} +24 -0
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +38 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +589 -21
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +16 -17
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{grid/migration.d.ts → migrationTemplate.d.ts} +4 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +52 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -5
- package/dist/static/styles/customEditorStyle.css.js +2 -25
- package/package.json +2 -2
- package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +0 -4
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +0 -64
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +0 -20
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +0 -64
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +0 -80
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +0 -232
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +0 -19
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +0 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +0 -110
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +0 -204
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +0 -54
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +0 -205
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +0 -118
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +0 -71
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -286
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +0 -46
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +0 -76
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +0 -48
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +0 -44
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +0 -222
- package/dist/extensions/Blocks/Recommendation/services/configService.js +0 -239
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +0 -233
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +0 -69
- package/dist/extensions/Blocks/Recommendation/templates/index.js +0 -12
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +0 -174
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +0 -73
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +0 -121
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +0 -6
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +0 -29
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +0 -46
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -49
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -143
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +0 -31
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +0 -37
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +0 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +0 -45
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +0 -22
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -57
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +0 -24
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -42
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +0 -23
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -214
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -97
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -100
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -95
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +0 -83
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +0 -151
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +0 -39
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +0 -18
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -54
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -154
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +0 -33
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +0 -77
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
var n = Object.defineProperty;
|
|
2
|
-
var o = (i, e, t) => e in i ? n(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
-
var r = (i, e, t) => o(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { CommonControl as s } from "../../../common-control.js";
|
|
5
|
-
import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
|
|
6
|
-
const d = "recommendation-filters-control", a = {
|
|
7
|
-
FILTERS: "filterStatus"
|
|
8
|
-
};
|
|
9
|
-
class h extends s {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments);
|
|
12
|
-
r(this, "store", l());
|
|
13
|
-
r(this, "addFilterListener", () => {
|
|
14
|
-
});
|
|
15
|
-
r(this, "addFilterButton", null);
|
|
16
|
-
}
|
|
17
|
-
getId() {
|
|
18
|
-
return d;
|
|
19
|
-
}
|
|
20
|
-
getTemplate() {
|
|
21
|
-
return `
|
|
22
|
-
<div class="filters-control-container">
|
|
23
|
-
${this._GuTwoColumns([
|
|
24
|
-
this._GuLabel({ text: "Filters" }),
|
|
25
|
-
this._GuButton({
|
|
26
|
-
name: a.FILTERS,
|
|
27
|
-
label: "Add Filter",
|
|
28
|
-
id: "guido__btn-add-filter"
|
|
29
|
-
})
|
|
30
|
-
])}
|
|
31
|
-
</div>
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
onRender() {
|
|
35
|
-
this._setupButtonListener();
|
|
36
|
-
}
|
|
37
|
-
onDestroy() {
|
|
38
|
-
var t;
|
|
39
|
-
(t = this.addFilterButton) == null || t.removeEventListener("click", this.addFilterListener);
|
|
40
|
-
}
|
|
41
|
-
_onFilterSelectClick() {
|
|
42
|
-
this.store.$patch({
|
|
43
|
-
filterSelectionDrawerStatus: !0
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
_setupButtonListener() {
|
|
47
|
-
var t;
|
|
48
|
-
this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (t = this.addFilterButton) == null || t.addEventListener("click", this.addFilterListener);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
d as FILTERS_CONTROL_ID,
|
|
53
|
-
h as FiltersControl
|
|
54
|
-
};
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
var g = Object.defineProperty;
|
|
2
|
-
var y = (n, s, t) => s in n ? g(n, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[s] = t;
|
|
3
|
-
var r = (n, s, t) => y(n, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { CommonControl as R } from "../../../common-control.js";
|
|
5
|
-
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
6
|
-
import { AlgorithmControl as _ } from "./algorithm.js";
|
|
7
|
-
import { ALGORITHM_CONTROL_ID as j } from "./algorithm.js";
|
|
8
|
-
import { CurrencyControl as b } from "./currency.js";
|
|
9
|
-
import { CURRENCY_CONTROL_ID as q } from "./currency.js";
|
|
10
|
-
import { FiltersControl as L } from "./filters.js";
|
|
11
|
-
import { FILTERS_CONTROL_ID as Q } from "./filters.js";
|
|
12
|
-
import { LocaleControl as N } from "./locale.js";
|
|
13
|
-
import { LOCALE_CONTROL_ID as X } from "./locale.js";
|
|
14
|
-
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
15
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as tt } from "./productLayout.js";
|
|
16
|
-
import { ShuffleControl as O } from "./shuffle.js";
|
|
17
|
-
import { SHUFFLE_CONTROL_ID as ot } from "./shuffle.js";
|
|
18
|
-
import { regenerateProductRowsWithStyles as D, updateProductContentInPlace as S } from "./utils.js";
|
|
19
|
-
import { formatProductPrice as st, getBlockElement as nt, getCardComposition as it, getCurrentLayout as at, reapplySpacing as ct, regenerateProductRows as lt, setCurrencyAttributes as ut, updatePricesInPlace as dt, updateSingleProductContent as ht } from "./utils.js";
|
|
20
|
-
import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
21
|
-
const I = /* @__PURE__ */ new Set([
|
|
22
|
-
"size",
|
|
23
|
-
"strategy",
|
|
24
|
-
"filters",
|
|
25
|
-
"productIds",
|
|
26
|
-
"language",
|
|
27
|
-
"shuffleProducts"
|
|
28
|
-
]), w = "ui-elements-recommendation-block";
|
|
29
|
-
class B extends R {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
r(this, "store", P());
|
|
33
|
-
r(this, "storeUnsubscription", () => {
|
|
34
|
-
});
|
|
35
|
-
// Track if initial data has been fetched to avoid redundant API calls
|
|
36
|
-
r(this, "hasInitializedData", !1);
|
|
37
|
-
// Sub-control instances for lifecycle management
|
|
38
|
-
r(this, "algorithmControl", null);
|
|
39
|
-
r(this, "localeControl", null);
|
|
40
|
-
r(this, "currencyControl", null);
|
|
41
|
-
r(this, "productLayoutControl", null);
|
|
42
|
-
r(this, "filtersControl", null);
|
|
43
|
-
r(this, "shuffleControl", null);
|
|
44
|
-
/**
|
|
45
|
-
* Debounced product fetch to prevent rapid API calls during config changes
|
|
46
|
-
*/
|
|
47
|
-
r(this, "_debouncedFetchProducts", h(() => {
|
|
48
|
-
this.store.fetchRecommendationProducts();
|
|
49
|
-
}, 500));
|
|
50
|
-
/**
|
|
51
|
-
* Debounced regeneration when products arrive from API
|
|
52
|
-
* Tries in-place update first to preserve styles, falls back to full regeneration
|
|
53
|
-
*/
|
|
54
|
-
r(this, "_debouncedRegenerateWithProducts", h(() => {
|
|
55
|
-
const t = this.store.recommendationProducts;
|
|
56
|
-
if (!this.currentNode || !this.api)
|
|
57
|
-
return;
|
|
58
|
-
const e = this.api.getDocumentModifier();
|
|
59
|
-
S({
|
|
60
|
-
currentNode: this.currentNode,
|
|
61
|
-
documentModifier: e,
|
|
62
|
-
products: t
|
|
63
|
-
}) || this._regenerateWithProducts(t);
|
|
64
|
-
}, 100));
|
|
65
|
-
}
|
|
66
|
-
getId() {
|
|
67
|
-
return w;
|
|
68
|
-
}
|
|
69
|
-
getTemplate() {
|
|
70
|
-
return this.algorithmControl = new _(), this.localeControl = new N(), this.currencyControl = new b(), this.productLayoutControl = new T(), this.filtersControl = new L(), this.shuffleControl = new O(), `
|
|
71
|
-
<div class="recommendation-controls-container">
|
|
72
|
-
${this.algorithmControl.getTemplate()}
|
|
73
|
-
${this.localeControl.getTemplate()}
|
|
74
|
-
${this.currencyControl.getTemplate()}
|
|
75
|
-
${this.filtersControl.getTemplate()}
|
|
76
|
-
${this.productLayoutControl.getTemplate()}
|
|
77
|
-
${this.shuffleControl.getTemplate()}
|
|
78
|
-
</div>
|
|
79
|
-
`;
|
|
80
|
-
}
|
|
81
|
-
async onRender() {
|
|
82
|
-
if (this._listenStateUpdates(), this.hasInitializedData) {
|
|
83
|
-
this._initializeSubControls();
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
(await Promise.allSettled([
|
|
87
|
-
this.store.fetchRecommendationFilters(),
|
|
88
|
-
this.store.fetchRecommendationCreateData(),
|
|
89
|
-
this.store.fetchRecommendationProducts()
|
|
90
|
-
])).forEach((e, o) => {
|
|
91
|
-
e.status === "rejected" && console.warn(`Recommendation block: ${[
|
|
92
|
-
"fetchRecommendationFilters",
|
|
93
|
-
"fetchRecommendationCreateData",
|
|
94
|
-
"fetchRecommendationProducts"
|
|
95
|
-
][o]} failed`, e.reason);
|
|
96
|
-
}), this.hasInitializedData = !0, this._initializeSubControls();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Immediately regenerate products with styles (no debounce)
|
|
100
|
-
* Used for initial load after fetch completes
|
|
101
|
-
*/
|
|
102
|
-
_regenerateWithProducts(t) {
|
|
103
|
-
if (!this.currentNode || !this.api) {
|
|
104
|
-
console.warn("[Recommendation] Cannot regenerate - missing currentNode or api");
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
D({
|
|
108
|
-
currentNode: this.currentNode,
|
|
109
|
-
documentModifier: this.api.getDocumentModifier(),
|
|
110
|
-
products: t
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
onTemplateNodeUpdated(t) {
|
|
114
|
-
super.onTemplateNodeUpdated(t), [
|
|
115
|
-
this.algorithmControl,
|
|
116
|
-
this.localeControl,
|
|
117
|
-
this.currencyControl,
|
|
118
|
-
this.productLayoutControl,
|
|
119
|
-
this.filtersControl,
|
|
120
|
-
this.shuffleControl
|
|
121
|
-
].forEach((o) => {
|
|
122
|
-
var i;
|
|
123
|
-
o != null && o.api && (o.currentNode = t, (i = o.onTemplateNodeUpdated) == null || i.call(o, t));
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
onDestroy() {
|
|
127
|
-
this.storeUnsubscription(), [
|
|
128
|
-
this.algorithmControl,
|
|
129
|
-
this.localeControl,
|
|
130
|
-
this.currencyControl,
|
|
131
|
-
this.productLayoutControl,
|
|
132
|
-
this.filtersControl,
|
|
133
|
-
this.shuffleControl
|
|
134
|
-
].forEach((e) => {
|
|
135
|
-
var o;
|
|
136
|
-
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Initialize all sub-controls with the shared API context
|
|
141
|
-
* Each sub-control manages its own form values and event listeners
|
|
142
|
-
*/
|
|
143
|
-
_initializeSubControls() {
|
|
144
|
-
[
|
|
145
|
-
this.algorithmControl,
|
|
146
|
-
this.localeControl,
|
|
147
|
-
this.currencyControl,
|
|
148
|
-
this.productLayoutControl,
|
|
149
|
-
this.filtersControl,
|
|
150
|
-
this.shuffleControl
|
|
151
|
-
].forEach((e) => {
|
|
152
|
-
var o;
|
|
153
|
-
e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Listen to store changes that require product refresh or regeneration
|
|
158
|
-
* - Config changes (size, strategy, filters, etc.) trigger API refetch
|
|
159
|
-
* - Currency code changes trigger API refetch (formatting changes are handled in-place)
|
|
160
|
-
* - Products array changes (API response) trigger HTML regeneration
|
|
161
|
-
*/
|
|
162
|
-
_listenStateUpdates() {
|
|
163
|
-
const { store: t } = this;
|
|
164
|
-
let e = t.recommendationProducts, o = t.recommendationConfigs.currencySettings.value;
|
|
165
|
-
this.storeUnsubscription = t.$subscribe((i) => {
|
|
166
|
-
var u;
|
|
167
|
-
if ("payload" in i) {
|
|
168
|
-
const c = i.payload.recommendationConfigs;
|
|
169
|
-
if (c) {
|
|
170
|
-
const f = Object.keys(c).some((p) => I.has(p)), l = (u = c.currencySettings) == null ? void 0 : u.value, d = l !== void 0 && l !== o;
|
|
171
|
-
d && (o = l), (f || d) && this._debouncedFetchProducts();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const a = t.recommendationProducts, m = a !== e, C = Array.isArray(a) && a.length > 0;
|
|
175
|
-
m && C && (e = a, this._debouncedRegenerateWithProducts());
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
export {
|
|
180
|
-
j as ALGORITHM_CONTROL_ID,
|
|
181
|
-
_ as AlgorithmControl,
|
|
182
|
-
w as CONTROL_BLOCK_ID,
|
|
183
|
-
q as CURRENCY_CONTROL_ID,
|
|
184
|
-
b as CurrencyControl,
|
|
185
|
-
Q as FILTERS_CONTROL_ID,
|
|
186
|
-
L as FiltersControl,
|
|
187
|
-
X as LOCALE_CONTROL_ID,
|
|
188
|
-
N as LocaleControl,
|
|
189
|
-
tt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
190
|
-
T as ProductLayoutControl,
|
|
191
|
-
B as RecommendationBlockControl,
|
|
192
|
-
ot as SHUFFLE_CONTROL_ID,
|
|
193
|
-
O as ShuffleControl,
|
|
194
|
-
st as formatProductPrice,
|
|
195
|
-
nt as getBlockElement,
|
|
196
|
-
it as getCardComposition,
|
|
197
|
-
at as getCurrentLayout,
|
|
198
|
-
ct as reapplySpacing,
|
|
199
|
-
lt as regenerateProductRows,
|
|
200
|
-
D as regenerateProductRowsWithStyles,
|
|
201
|
-
ut as setCurrencyAttributes,
|
|
202
|
-
dt as updatePricesInPlace,
|
|
203
|
-
S as updateProductContentInPlace,
|
|
204
|
-
ht as updateSingleProductContent
|
|
205
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var s = Object.defineProperty;
|
|
2
|
-
var r = (o, t, e) => t in o ? s(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
-
var a = (o, t, e) => r(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as m } from "../../../common-control.js";
|
|
6
|
-
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
7
|
-
import { useRecommendationExtensionStore as c } from "../../store/recommendation.js";
|
|
8
|
-
const g = "recommendation-locale-control", n = {
|
|
9
|
-
LOCALE: "language"
|
|
10
|
-
};
|
|
11
|
-
class C extends m {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
// Store is used ONLY for API-fetched data (language options), not for config
|
|
15
|
-
a(this, "store", c());
|
|
16
|
-
}
|
|
17
|
-
getId() {
|
|
18
|
-
return g;
|
|
19
|
-
}
|
|
20
|
-
getTemplate() {
|
|
21
|
-
return `
|
|
22
|
-
<div class="locale-control-container">
|
|
23
|
-
${this._GuTwoColumns([
|
|
24
|
-
this._GuLabel({ text: "Recommendation Locale" }),
|
|
25
|
-
this._GuSelect({
|
|
26
|
-
name: n.LOCALE,
|
|
27
|
-
placeholder: "Select Recommendation Locale",
|
|
28
|
-
options: this.store.getLanguages
|
|
29
|
-
})
|
|
30
|
-
])}
|
|
31
|
-
</div>
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
onRender() {
|
|
35
|
-
this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
|
|
36
|
-
}
|
|
37
|
-
onTemplateNodeUpdated(e) {
|
|
38
|
-
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
39
|
-
}
|
|
40
|
-
_setFormValues() {
|
|
41
|
-
const e = i.getConfig(this.currentNode);
|
|
42
|
-
this.api.updateValues({
|
|
43
|
-
[n.LOCALE]: e.language
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
_initializeSelectItems() {
|
|
47
|
-
this.api.setUIEAttribute(
|
|
48
|
-
n.LOCALE,
|
|
49
|
-
l.SELECTPICKER.items,
|
|
50
|
-
this.store.getLanguages
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
_onLocaleChange(e) {
|
|
54
|
-
this.currentNode && (i.updateConfig(
|
|
55
|
-
this.api,
|
|
56
|
-
this.currentNode,
|
|
57
|
-
{ language: e },
|
|
58
|
-
`Changed language to ${e}`
|
|
59
|
-
), this.store.$patch({
|
|
60
|
-
recommendationConfigs: {
|
|
61
|
-
language: e
|
|
62
|
-
}
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
_listenToFormUpdates() {
|
|
66
|
-
this.api.onValueChanged(n.LOCALE, (e) => {
|
|
67
|
-
this._onLocaleChange(e);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
g as LOCALE_CONTROL_ID,
|
|
73
|
-
C as LocaleControl
|
|
74
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
var u = Object.defineProperty;
|
|
2
|
-
var a = (i, e, t) => e in i ? u(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
-
var n = (i, e, t) => a(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { CommonControl as c } from "../../../common-control.js";
|
|
5
|
-
import { MAX_PRODUCT_COUNT as _, MAX_PRODUCTS_PER_ROW as h } from "../../constants/layout.js";
|
|
6
|
-
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
7
|
-
import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
|
|
8
|
-
import { getCurrentLayout as C, regenerateProductRowsWithStyles as m } from "./utils.js";
|
|
9
|
-
import { useDebounceFn as p } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
10
|
-
const O = "recommendation-product-layout-control", o = {
|
|
11
|
-
PRODUCT_COUNT: "size",
|
|
12
|
-
PRODUCT_IN_ROW: "cardsInRow",
|
|
13
|
-
PRODUCT_IN_ROW_LABEL: "cardsInRowLabel"
|
|
14
|
-
};
|
|
15
|
-
class I extends c {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
// Store is used for backward compatibility with product fetching and regeneration
|
|
19
|
-
n(this, "store", R());
|
|
20
|
-
n(this, "storeUnsubscription", () => {
|
|
21
|
-
});
|
|
22
|
-
n(this, "_debouncedRegenerateProductRows", p(() => {
|
|
23
|
-
this._regenerateProductRows();
|
|
24
|
-
}, 500));
|
|
25
|
-
}
|
|
26
|
-
getId() {
|
|
27
|
-
return O;
|
|
28
|
-
}
|
|
29
|
-
getTemplate() {
|
|
30
|
-
return `
|
|
31
|
-
<div class="product-layout-control-container">
|
|
32
|
-
${this._GuTwoColumns([
|
|
33
|
-
this._GuLabel({ text: "Number of Products" }),
|
|
34
|
-
this._GuCounter({ name: o.PRODUCT_COUNT, maxValue: _ }),
|
|
35
|
-
this._GuLabel({ text: "Products in One Row", name: o.PRODUCT_IN_ROW_LABEL }),
|
|
36
|
-
this._GuCounter({ name: o.PRODUCT_IN_ROW, maxValue: h })
|
|
37
|
-
])}
|
|
38
|
-
</div>
|
|
39
|
-
`;
|
|
40
|
-
}
|
|
41
|
-
onRender() {
|
|
42
|
-
this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates();
|
|
43
|
-
}
|
|
44
|
-
onTemplateNodeUpdated(t) {
|
|
45
|
-
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
|
|
46
|
-
}
|
|
47
|
-
onDestroy() {
|
|
48
|
-
this.storeUnsubscription();
|
|
49
|
-
}
|
|
50
|
-
_setFormValues() {
|
|
51
|
-
const t = s.getConfig(this.currentNode);
|
|
52
|
-
this.api.updateValues({
|
|
53
|
-
[o.PRODUCT_COUNT]: t.size,
|
|
54
|
-
[o.PRODUCT_IN_ROW]: t.cardsInRow
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Updates "Products in One Row" visibility based on layout orientation
|
|
59
|
-
* This control is hidden for list layout (products always take full width)
|
|
60
|
-
* Reads from node config first, falls back to DOM
|
|
61
|
-
*/
|
|
62
|
-
_updateProductsInRowVisibility() {
|
|
63
|
-
const d = (s.getConfig(this.currentNode).layout || C(this.currentNode)) === "grid";
|
|
64
|
-
this.api.setVisibility(o.PRODUCT_IN_ROW, d), this.api.setVisibility(o.PRODUCT_IN_ROW_LABEL, d);
|
|
65
|
-
}
|
|
66
|
-
_onProductCountChange(t) {
|
|
67
|
-
this.currentNode && (s.updateConfig(
|
|
68
|
-
this.api,
|
|
69
|
-
this.currentNode,
|
|
70
|
-
{ size: t },
|
|
71
|
-
`Changed product count to ${t}`
|
|
72
|
-
), this.store.$patch({
|
|
73
|
-
recommendationConfigs: {
|
|
74
|
-
size: t
|
|
75
|
-
}
|
|
76
|
-
}), this._debouncedRegenerateProductRows());
|
|
77
|
-
}
|
|
78
|
-
_onProductsInRowChange(t) {
|
|
79
|
-
this.currentNode && (s.updateConfig(
|
|
80
|
-
this.api,
|
|
81
|
-
this.currentNode,
|
|
82
|
-
{ cardsInRow: t },
|
|
83
|
-
`Changed products per row to ${t}`
|
|
84
|
-
), this.store.$patch({
|
|
85
|
-
recommendationConfigs: {
|
|
86
|
-
cardsInRow: t
|
|
87
|
-
}
|
|
88
|
-
}), this._debouncedRegenerateProductRows());
|
|
89
|
-
}
|
|
90
|
-
_regenerateProductRows() {
|
|
91
|
-
m({
|
|
92
|
-
currentNode: this.currentNode,
|
|
93
|
-
documentModifier: this.api.getDocumentModifier()
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
_listenToFormUpdates() {
|
|
97
|
-
this.api.onValueChanged(o.PRODUCT_COUNT, (t) => {
|
|
98
|
-
this._onProductCountChange(t.toString());
|
|
99
|
-
}), this.api.onValueChanged(o.PRODUCT_IN_ROW, (t) => {
|
|
100
|
-
this._onProductsInRowChange(Number(t));
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Subscribe to store changes to update visibility when layout changes
|
|
105
|
-
* This is still needed because layout changes come from LayoutControl
|
|
106
|
-
*/
|
|
107
|
-
_listenStateUpdates() {
|
|
108
|
-
let t = this.store.recommendationConfigs.orientation;
|
|
109
|
-
this.storeUnsubscription = this.store.$subscribe(() => {
|
|
110
|
-
const r = this.store.recommendationConfigs.orientation;
|
|
111
|
-
r !== t && (t = r, this._updateProductsInRowVisibility());
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
export {
|
|
116
|
-
O as PRODUCT_LAYOUT_CONTROL_ID,
|
|
117
|
-
I as ProductLayoutControl
|
|
118
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var r = Object.defineProperty;
|
|
2
|
-
var u = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
-
var n = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { UEAttr as f } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as l } from "../../../common-control.js";
|
|
6
|
-
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
7
|
-
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
8
|
-
const a = "recommendation-shuffle-control", s = {
|
|
9
|
-
SHUFFLE_PRODUCTS: "shuffleProducts"
|
|
10
|
-
};
|
|
11
|
-
class C extends l {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
// Store is used for backward compatibility with product fetching
|
|
15
|
-
n(this, "store", d());
|
|
16
|
-
}
|
|
17
|
-
getId() {
|
|
18
|
-
return a;
|
|
19
|
-
}
|
|
20
|
-
getTemplate() {
|
|
21
|
-
return `
|
|
22
|
-
<div class="shuffle-control-container">
|
|
23
|
-
${this._GuTwoColumns([
|
|
24
|
-
this._GuLabel({ text: "Shuffle Recommended Products" }),
|
|
25
|
-
this._GuToggle(s.SHUFFLE_PRODUCTS)
|
|
26
|
-
])}
|
|
27
|
-
</div>
|
|
28
|
-
`;
|
|
29
|
-
}
|
|
30
|
-
onRender() {
|
|
31
|
-
this._initializeToggle(), this._setFormValues(), this._listenToFormUpdates();
|
|
32
|
-
}
|
|
33
|
-
onTemplateNodeUpdated(e) {
|
|
34
|
-
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
35
|
-
}
|
|
36
|
-
_setFormValues() {
|
|
37
|
-
const e = i.getConfig(this.currentNode);
|
|
38
|
-
this.api.updateValues({
|
|
39
|
-
[s.SHUFFLE_PRODUCTS]: e.shuffleProducts
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
_initializeToggle() {
|
|
43
|
-
const e = i.getConfig(this.currentNode);
|
|
44
|
-
this.api.setUIEAttribute(
|
|
45
|
-
s.SHUFFLE_PRODUCTS,
|
|
46
|
-
f.SELECTPICKER.items,
|
|
47
|
-
e.shuffleProducts
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
_onShuffleChange(e) {
|
|
51
|
-
this.currentNode && (i.updateConfig(
|
|
52
|
-
this.api,
|
|
53
|
-
this.currentNode,
|
|
54
|
-
{ shuffleProducts: e },
|
|
55
|
-
`${e ? "Enabled" : "Disabled"} product shuffle`
|
|
56
|
-
), this.store.$patch({
|
|
57
|
-
recommendationConfigs: {
|
|
58
|
-
shuffleProducts: e
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
_listenToFormUpdates() {
|
|
63
|
-
this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
|
|
64
|
-
this._onShuffleChange(!!e);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
a as SHUFFLE_CONTROL_ID,
|
|
70
|
-
C as ShuffleControl
|
|
71
|
-
};
|