@useinsider/guido 3.7.2-beta.af89512 → 3.7.2-beta.b445a7a
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/composables/useHtmlCompiler.js +6 -8
- package/dist/config/compiler/htmlCompilerRules.js +7 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +19 -25
- package/dist/config/migrator/index.js +7 -8
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -10
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +24 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +30 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +28 -34
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +285 -333
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -30
- package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +219 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
- package/dist/extensions/Blocks/controlFactories.js +159 -133
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
- 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/template.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
- package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
- package/package.json +1 -1
- package/dist/config/migrator/fontTagMigrator.js +0 -7
- package/dist/src/config/migrator/fontTagMigrator.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
- package/dist/src/utils/stripFontTags.d.ts +0 -13
- package/dist/utils/stripFontTags.js +0 -13
|
@@ -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 T, UEAttr as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as P } from "../../../common-control.js";
|
|
6
|
+
import { MAX_PRODUCTS_PER_ROW as m, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as l } 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 w } from "../../store/recommendation.js";
|
|
9
|
+
import { setMobileLayoutOptOut as C, ensureMobileCssRulesExist as b } from "../mobileLayout/cssRules.js";
|
|
10
|
+
import { getCurrentLayout as y, getBlockElement as D, adjustProductsToSize as L, regenerateProductRowsWithStyles as g, regenerateMobileProductRows as I } from "./utils.js";
|
|
11
|
+
import { useDebounceFn as U } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
|
+
const B = "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 S = "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 P {
|
|
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", w());
|
|
31
31
|
c(this, "storeUnsubscription", () => {
|
|
32
32
|
});
|
|
33
|
-
c(this, "_debouncedRegenerateProductRows",
|
|
33
|
+
c(this, "_debouncedRegenerateProductRows", U(() => {
|
|
34
34
|
this._regenerateProductRows();
|
|
35
35
|
}, 500));
|
|
36
36
|
}
|
|
37
37
|
getId() {
|
|
38
|
-
return
|
|
38
|
+
return B;
|
|
39
39
|
}
|
|
40
40
|
getTemplate() {
|
|
41
41
|
return `
|
|
@@ -57,7 +57,7 @@ class v extends M {
|
|
|
57
57
|
}),
|
|
58
58
|
this._GuCounter({
|
|
59
59
|
name: e.MOBILE_CARDS_IN_ROW,
|
|
60
|
-
maxValue:
|
|
60
|
+
maxValue: M
|
|
61
61
|
}),
|
|
62
62
|
this._GuLabel({
|
|
63
63
|
text: this.api.translate("Mobile Layout Optimization"),
|
|
@@ -95,7 +95,7 @@ class v extends M {
|
|
|
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] === T.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 M {
|
|
|
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 || y(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 M {
|
|
|
125
125
|
const t = s.getConfig(this.currentNode);
|
|
126
126
|
this.api.setUIEAttribute(
|
|
127
127
|
e.MOBILE_LAYOUT_TOGGLE,
|
|
128
|
-
|
|
128
|
+
N.SELECTPICKER.items,
|
|
129
129
|
t.mobileLayoutEnabled
|
|
130
130
|
);
|
|
131
131
|
}
|
|
@@ -140,7 +140,7 @@ class v extends M {
|
|
|
140
140
|
const i = s.getConfig(this.currentNode);
|
|
141
141
|
if (i.mobileLayoutEnabled === t)
|
|
142
142
|
return;
|
|
143
|
-
const o =
|
|
143
|
+
const o = D(this.currentNode);
|
|
144
144
|
if (t) {
|
|
145
145
|
const r = i.previousMobileCardsInRow || l;
|
|
146
146
|
s.updateConfig(
|
|
@@ -157,8 +157,8 @@ class v extends M {
|
|
|
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), b(this.api);
|
|
161
|
+
const u = parseInt(i.size) || 6, d = L(this.store.recommendationProducts, u);
|
|
162
162
|
g({
|
|
163
163
|
currentNode: this.currentNode,
|
|
164
164
|
documentModifier: this.api.getDocumentModifier(),
|
|
@@ -189,35 +189,29 @@ class v extends M {
|
|
|
189
189
|
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
190
190
|
}
|
|
191
191
|
_onProductsInRowChange(t) {
|
|
192
|
-
|
|
193
|
-
return;
|
|
194
|
-
const o = t === 1 ? 0 : w;
|
|
195
|
-
s.updateConfig(
|
|
192
|
+
!this.currentNode || s.getConfig(this.currentNode).cardsInRow === t || (s.updateConfig(
|
|
196
193
|
this.api,
|
|
197
194
|
this.currentNode,
|
|
198
|
-
{ cardsInRow: t
|
|
195
|
+
{ cardsInRow: t },
|
|
199
196
|
`Changed products per row to ${t}`
|
|
200
|
-
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
|
|
197
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows());
|
|
201
198
|
}
|
|
202
199
|
_onMobileCardsInRowChange(t) {
|
|
203
|
-
|
|
204
|
-
return;
|
|
205
|
-
const o = t === 1 ? 0 : y;
|
|
206
|
-
s.updateConfig(
|
|
200
|
+
!this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t || (s.updateConfig(
|
|
207
201
|
this.api,
|
|
208
202
|
this.currentNode,
|
|
209
|
-
{ mobileCardsInRow: t
|
|
203
|
+
{ mobileCardsInRow: t },
|
|
210
204
|
`Changed mobile products per row to ${t}`
|
|
211
|
-
),
|
|
205
|
+
), b(this.api), this.store.patchCurrentBlockConfig(
|
|
212
206
|
{ mobileCardsInRow: t },
|
|
213
207
|
{ triggerRefetch: !1 }
|
|
214
208
|
), I({
|
|
215
209
|
currentNode: this.currentNode,
|
|
216
210
|
documentModifier: this.api.getDocumentModifier()
|
|
217
|
-
});
|
|
211
|
+
}));
|
|
218
212
|
}
|
|
219
213
|
_regenerateProductRows() {
|
|
220
|
-
const t = s.getConfig(this.currentNode), i = parseInt(t.size) || 6, o =
|
|
214
|
+
const t = s.getConfig(this.currentNode), i = parseInt(t.size) || 6, o = L(this.store.recommendationProducts, i);
|
|
221
215
|
g({
|
|
222
216
|
currentNode: this.currentNode,
|
|
223
217
|
documentModifier: this.api.getDocumentModifier(),
|
|
@@ -261,6 +255,6 @@ class v extends M {
|
|
|
261
255
|
}
|
|
262
256
|
}
|
|
263
257
|
export {
|
|
264
|
-
|
|
258
|
+
B as PRODUCT_LAYOUT_CONTROL_ID,
|
|
265
259
|
v as ProductLayoutControl
|
|
266
260
|
};
|