@useinsider/guido 3.7.2-beta.1489585 → 3.7.2-beta.2220fb0
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 +70 -66
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +100 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +92 -78
- package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/extensions/Blocks/Recommendation/block.js +60 -41
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +369 -288
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +338 -288
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -30
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +217 -155
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -56
- package/dist/extensions/Blocks/Recommendation/templates/index.js +10 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +135 -145
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -43
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +96 -109
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +47 -163
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -216
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var E = Object.defineProperty;
|
|
2
2
|
var f = (a, n, t) => n in a ? E(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
3
|
var c = (a, n, t) => f(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
-
import { EditorStatePropertyType as O, PreviewDeviceMode as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { MAX_PRODUCTS_PER_ROW as m, MAX_MOBILE_PRODUCTS_PER_ROW as
|
|
4
|
+
import { EditorStatePropertyType as O, PreviewDeviceMode as N, UEAttr as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as M } from "../../../common-control.js";
|
|
6
|
+
import { MAX_PRODUCTS_PER_ROW as m, MAX_MOBILE_PRODUCTS_PER_ROW as P, DEFAULT_MOBILE_CARDS_IN_ROW as l, DEFAULT_COLUMN_SPACING as w, DEFAULT_MOBILE_COLUMN_SPACING as y } from "../../constants/layout.js";
|
|
7
7
|
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { setMobileLayoutOptOut as C, ensureMobileCssRulesExist as
|
|
10
|
-
import { getCurrentLayout as
|
|
11
|
-
import { useDebounceFn as
|
|
12
|
-
const
|
|
8
|
+
import { useRecommendationExtensionStore as D } from "../../store/recommendation.js";
|
|
9
|
+
import { setMobileLayoutOptOut as C, ensureMobileCssRulesExist as L } from "../mobileLayout/cssRules.js";
|
|
10
|
+
import { getCurrentLayout as U, getBlockElement as A, adjustProductsToSize as b, regenerateProductRowsWithStyles as g, regenerateMobileProductRows as I } from "./utils.js";
|
|
11
|
+
import { useDebounceFn as B } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
|
+
const S = "recommendation-product-layout-control", e = {
|
|
13
13
|
// "Products in One Row" — shown when toggle is OFF
|
|
14
14
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
15
15
|
PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
|
|
@@ -23,19 +23,19 @@ const B = "recommendation-product-layout-control", e = {
|
|
|
23
23
|
MOBILE_LAYOUT_TOGGLE: "mobileLayoutEnabled",
|
|
24
24
|
MOBILE_LAYOUT_LABEL: "mobileLayoutLabel"
|
|
25
25
|
};
|
|
26
|
-
class v extends
|
|
26
|
+
class v extends M {
|
|
27
27
|
constructor() {
|
|
28
28
|
super(...arguments);
|
|
29
29
|
// Store is used for backward compatibility with product fetching and regeneration
|
|
30
|
-
c(this, "store",
|
|
30
|
+
c(this, "store", D());
|
|
31
31
|
c(this, "storeUnsubscription", () => {
|
|
32
32
|
});
|
|
33
|
-
c(this, "_debouncedRegenerateProductRows",
|
|
33
|
+
c(this, "_debouncedRegenerateProductRows", B(() => {
|
|
34
34
|
this._regenerateProductRows();
|
|
35
35
|
}, 500));
|
|
36
36
|
}
|
|
37
37
|
getId() {
|
|
38
|
-
return
|
|
38
|
+
return S;
|
|
39
39
|
}
|
|
40
40
|
getTemplate() {
|
|
41
41
|
return `
|
|
@@ -57,7 +57,7 @@ class v extends P {
|
|
|
57
57
|
}),
|
|
58
58
|
this._GuCounter({
|
|
59
59
|
name: e.MOBILE_CARDS_IN_ROW,
|
|
60
|
-
maxValue:
|
|
60
|
+
maxValue: P
|
|
61
61
|
}),
|
|
62
62
|
this._GuLabel({
|
|
63
63
|
text: this.api.translate("Mobile Layout Optimization"),
|
|
@@ -95,7 +95,7 @@ class v extends P {
|
|
|
95
95
|
* Returns true when the editor preview is in mobile mode.
|
|
96
96
|
*/
|
|
97
97
|
_isMobilePreview() {
|
|
98
|
-
return this.api.getEditorState()[O.previewDeviceMode] ===
|
|
98
|
+
return this.api.getEditorState()[O.previewDeviceMode] === N.MOBILE;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
|
|
@@ -110,7 +110,7 @@ class v extends P {
|
|
|
110
110
|
*/
|
|
111
111
|
_updateProductsInRowVisibility() {
|
|
112
112
|
var p;
|
|
113
|
-
const t = s.getConfig(this.currentNode), o = (t.layout ||
|
|
113
|
+
const t = s.getConfig(this.currentNode), o = (t.layout || U(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, u = this._isMobilePreview();
|
|
114
114
|
this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, o), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, o);
|
|
115
115
|
const d = o && !r, _ = o && r && !u, h = o && r && u;
|
|
116
116
|
this.api.setVisibility(e.PRODUCT_IN_ROW, d), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, d), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, _), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, _), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, h);
|
|
@@ -125,7 +125,7 @@ class v extends P {
|
|
|
125
125
|
const t = s.getConfig(this.currentNode);
|
|
126
126
|
this.api.setUIEAttribute(
|
|
127
127
|
e.MOBILE_LAYOUT_TOGGLE,
|
|
128
|
-
|
|
128
|
+
T.SELECTPICKER.items,
|
|
129
129
|
t.mobileLayoutEnabled
|
|
130
130
|
);
|
|
131
131
|
}
|
|
@@ -140,7 +140,7 @@ class v extends P {
|
|
|
140
140
|
const i = s.getConfig(this.currentNode);
|
|
141
141
|
if (i.mobileLayoutEnabled === t)
|
|
142
142
|
return;
|
|
143
|
-
const o =
|
|
143
|
+
const o = A(this.currentNode);
|
|
144
144
|
if (t) {
|
|
145
145
|
const r = i.previousMobileCardsInRow || l;
|
|
146
146
|
s.updateConfig(
|
|
@@ -157,8 +157,8 @@ class v extends P {
|
|
|
157
157
|
mobileCardsInRow: r
|
|
158
158
|
},
|
|
159
159
|
{ triggerRefetch: !1 }
|
|
160
|
-
), o && C(this.api, o, !1),
|
|
161
|
-
const u = parseInt(i.size) || 6, d =
|
|
160
|
+
), o && C(this.api, o, !1), L(this.api);
|
|
161
|
+
const u = parseInt(i.size) || 6, d = b(this.store.recommendationProducts, u);
|
|
162
162
|
g({
|
|
163
163
|
currentNode: this.currentNode,
|
|
164
164
|
documentModifier: this.api.getDocumentModifier(),
|
|
@@ -189,29 +189,35 @@ class v extends P {
|
|
|
189
189
|
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
190
190
|
}
|
|
191
191
|
_onProductsInRowChange(t) {
|
|
192
|
-
!this.currentNode || s.getConfig(this.currentNode).cardsInRow === t
|
|
192
|
+
if (!this.currentNode || s.getConfig(this.currentNode).cardsInRow === t)
|
|
193
|
+
return;
|
|
194
|
+
const o = t === 1 ? 0 : w;
|
|
195
|
+
s.updateConfig(
|
|
193
196
|
this.api,
|
|
194
197
|
this.currentNode,
|
|
195
|
-
{ cardsInRow: t },
|
|
198
|
+
{ cardsInRow: t, columnSpacing: o },
|
|
196
199
|
`Changed products per row to ${t}`
|
|
197
|
-
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows()
|
|
200
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
|
|
198
201
|
}
|
|
199
202
|
_onMobileCardsInRowChange(t) {
|
|
200
|
-
!this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t
|
|
203
|
+
if (!this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t)
|
|
204
|
+
return;
|
|
205
|
+
const o = t === 1 ? 0 : y;
|
|
206
|
+
s.updateConfig(
|
|
201
207
|
this.api,
|
|
202
208
|
this.currentNode,
|
|
203
|
-
{ mobileCardsInRow: t },
|
|
209
|
+
{ mobileCardsInRow: t, mobileColumnSpacing: o },
|
|
204
210
|
`Changed mobile products per row to ${t}`
|
|
205
|
-
),
|
|
211
|
+
), L(this.api), this.store.patchCurrentBlockConfig(
|
|
206
212
|
{ mobileCardsInRow: t },
|
|
207
213
|
{ triggerRefetch: !1 }
|
|
208
214
|
), I({
|
|
209
215
|
currentNode: this.currentNode,
|
|
210
216
|
documentModifier: this.api.getDocumentModifier()
|
|
211
|
-
})
|
|
217
|
+
});
|
|
212
218
|
}
|
|
213
219
|
_regenerateProductRows() {
|
|
214
|
-
const t = s.getConfig(this.currentNode), i = parseInt(t.size) || 6, o =
|
|
220
|
+
const t = s.getConfig(this.currentNode), i = parseInt(t.size) || 6, o = b(this.store.recommendationProducts, i);
|
|
215
221
|
g({
|
|
216
222
|
currentNode: this.currentNode,
|
|
217
223
|
documentModifier: this.api.getDocumentModifier(),
|
|
@@ -255,6 +261,6 @@ class v extends P {
|
|
|
255
261
|
}
|
|
256
262
|
}
|
|
257
263
|
export {
|
|
258
|
-
|
|
264
|
+
S as PRODUCT_LAYOUT_CONTROL_ID,
|
|
259
265
|
v as ProductLayoutControl
|
|
260
266
|
};
|