@useinsider/guido 3.6.0-beta.32a6a93 → 3.6.0-beta.3c5ea31
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/README.md +0 -14
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +72 -75
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +9 -9
- package/dist/composables/useRecommendation.js +34 -33
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +24 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -329
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +139 -168
- 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 +98 -55
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +207 -0
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +20 -16
- package/dist/extensions/Blocks/controlFactories.js +159 -133
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.test.d.ts +1 -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.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +158 -11
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +85 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +20 -9
- package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
- package/package.json +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var I = Object.defineProperty;
|
|
2
2
|
var E = (a, n, t) => n in a ? I(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
3
|
var u = (a, n, t) => E(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
-
import { EditorStatePropertyType as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { MAX_PRODUCTS_PER_ROW as
|
|
4
|
+
import { EditorStatePropertyType as p, PreviewDeviceMode as f, UEAttr as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as N } from "../../../common-control.js";
|
|
6
|
+
import { MAX_PRODUCTS_PER_ROW as O, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as m } from "../../constants/layout.js";
|
|
7
7
|
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { setMobileLayoutOptOut as
|
|
10
|
-
import { getCurrentLayout as
|
|
11
|
-
import { useDebounceFn as
|
|
12
|
-
const
|
|
8
|
+
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
9
|
+
import { setMobileLayoutOptOut as L, ensureMobileCssRulesExist as C } from "../mobileLayout/cssRules.js";
|
|
10
|
+
import { getCurrentLayout as y, getBlockElement as D, regenerateProductRowsWithStyles as b, regenerateMobileProductRows as g, adjustProductsToSize as w } 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
|
|
26
|
+
class Y extends N {
|
|
27
27
|
constructor() {
|
|
28
28
|
super(...arguments);
|
|
29
29
|
// Store is used for backward compatibility with product fetching and regeneration
|
|
30
|
-
u(this, "store",
|
|
30
|
+
u(this, "store", P());
|
|
31
31
|
u(this, "storeUnsubscription", () => {
|
|
32
32
|
});
|
|
33
|
-
u(this, "_debouncedRegenerateProductRows",
|
|
33
|
+
u(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 `
|
|
@@ -45,12 +45,12 @@ class v extends T {
|
|
|
45
45
|
text: this.api.translate("Products in One Row"),
|
|
46
46
|
name: e.PRODUCT_IN_ROW_LABEL
|
|
47
47
|
}),
|
|
48
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue:
|
|
48
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: O }),
|
|
49
49
|
this._GuLabel({
|
|
50
50
|
text: this.api.translate("Products in One Row on Desktop"),
|
|
51
51
|
name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
|
|
52
52
|
}),
|
|
53
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue:
|
|
53
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: O }),
|
|
54
54
|
this._GuLabel({
|
|
55
55
|
text: this.api.translate("Products in One Row on Mobile"),
|
|
56
56
|
name: e.MOBILE_CARDS_IN_ROW_LABEL
|
|
@@ -95,7 +95,7 @@ class v extends T {
|
|
|
95
95
|
* Returns true when the editor preview is in mobile mode.
|
|
96
96
|
*/
|
|
97
97
|
_isMobilePreview() {
|
|
98
|
-
return this.api.getEditorState()[
|
|
98
|
+
return this.api.getEditorState()[p.previewDeviceMode] === f.MOBILE;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
|
|
@@ -110,10 +110,10 @@ class v extends T {
|
|
|
110
110
|
*/
|
|
111
111
|
_updateProductsInRowVisibility() {
|
|
112
112
|
var R;
|
|
113
|
-
const t = i.getConfig(this.currentNode), o = (t.layout ||
|
|
113
|
+
const t = i.getConfig(this.currentNode), o = (t.layout || y(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, d = this._isMobilePreview();
|
|
114
114
|
this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, o), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, o);
|
|
115
|
-
const c = o && !r,
|
|
116
|
-
this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP,
|
|
115
|
+
const c = o && !r, l = o && r && !d, _ = o && r && d;
|
|
116
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, l), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, l), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, _), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, _);
|
|
117
117
|
const h = (R = this.getContainer()) == null ? void 0 : R.querySelector("[data-product-layout-control]");
|
|
118
118
|
h && (h.style.display = o ? "" : "none");
|
|
119
119
|
}
|
|
@@ -125,7 +125,7 @@ class v extends T {
|
|
|
125
125
|
const t = i.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,9 +140,9 @@ class v extends T {
|
|
|
140
140
|
const s = i.getConfig(this.currentNode);
|
|
141
141
|
if (s.mobileLayoutEnabled === t)
|
|
142
142
|
return;
|
|
143
|
-
const o =
|
|
143
|
+
const o = D(this.currentNode);
|
|
144
144
|
if (t) {
|
|
145
|
-
const r = s.previousMobileCardsInRow ||
|
|
145
|
+
const r = s.previousMobileCardsInRow || m;
|
|
146
146
|
i.updateConfig(
|
|
147
147
|
this.api,
|
|
148
148
|
this.currentNode,
|
|
@@ -154,7 +154,7 @@ class v extends T {
|
|
|
154
154
|
), this.store.patchCurrentBlockConfig(
|
|
155
155
|
{ mobileLayoutEnabled: !0 },
|
|
156
156
|
{ triggerRefetch: !1 }
|
|
157
|
-
), o &&
|
|
157
|
+
), o && L(this.api, o, !1), C(this.api), b({
|
|
158
158
|
currentNode: this.currentNode,
|
|
159
159
|
documentModifier: this.api.getDocumentModifier()
|
|
160
160
|
});
|
|
@@ -166,13 +166,13 @@ class v extends T {
|
|
|
166
166
|
{
|
|
167
167
|
mobileLayoutEnabled: !1,
|
|
168
168
|
previousMobileCardsInRow: r,
|
|
169
|
-
mobileCardsInRow:
|
|
169
|
+
mobileCardsInRow: m
|
|
170
170
|
},
|
|
171
171
|
"Disabled mobile layout optimization"
|
|
172
172
|
), this.store.patchCurrentBlockConfig(
|
|
173
173
|
{ mobileLayoutEnabled: !1 },
|
|
174
174
|
{ triggerRefetch: !1 }
|
|
175
|
-
), o &&
|
|
175
|
+
), o && L(this.api, o, !0), g({
|
|
176
176
|
currentNode: this.currentNode,
|
|
177
177
|
documentModifier: this.api.getDocumentModifier()
|
|
178
178
|
});
|
|
@@ -180,32 +180,26 @@ class v extends T {
|
|
|
180
180
|
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
181
181
|
}
|
|
182
182
|
_onProductsInRowChange(t) {
|
|
183
|
-
|
|
184
|
-
return;
|
|
185
|
-
const o = t === 1 ? 0 : P;
|
|
186
|
-
i.updateConfig(
|
|
183
|
+
!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t || (i.updateConfig(
|
|
187
184
|
this.api,
|
|
188
185
|
this.currentNode,
|
|
189
|
-
{ cardsInRow: t
|
|
186
|
+
{ cardsInRow: t },
|
|
190
187
|
`Changed products per row to ${t}`
|
|
191
|
-
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
|
|
188
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows());
|
|
192
189
|
}
|
|
193
190
|
_onMobileCardsInRowChange(t) {
|
|
194
|
-
|
|
195
|
-
return;
|
|
196
|
-
const o = t === 1 ? 0 : y;
|
|
197
|
-
i.updateConfig(
|
|
191
|
+
!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t || (i.updateConfig(
|
|
198
192
|
this.api,
|
|
199
193
|
this.currentNode,
|
|
200
|
-
{ mobileCardsInRow: t
|
|
194
|
+
{ mobileCardsInRow: t },
|
|
201
195
|
`Changed mobile products per row to ${t}`
|
|
202
196
|
), C(this.api), g({
|
|
203
197
|
currentNode: this.currentNode,
|
|
204
198
|
documentModifier: this.api.getDocumentModifier()
|
|
205
|
-
});
|
|
199
|
+
}));
|
|
206
200
|
}
|
|
207
201
|
_regenerateProductRows() {
|
|
208
|
-
const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o =
|
|
202
|
+
const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o = w(this.store.recommendationProducts, s);
|
|
209
203
|
b({
|
|
210
204
|
currentNode: this.currentNode,
|
|
211
205
|
documentModifier: this.api.getDocumentModifier(),
|
|
@@ -241,7 +235,7 @@ class v extends T {
|
|
|
241
235
|
*/
|
|
242
236
|
_listenEditorModeChanges() {
|
|
243
237
|
this.api.onEditorStatePropUpdated(
|
|
244
|
-
|
|
238
|
+
p.previewDeviceMode,
|
|
245
239
|
() => {
|
|
246
240
|
i.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
|
|
247
241
|
}
|
|
@@ -249,6 +243,6 @@ class v extends T {
|
|
|
249
243
|
}
|
|
250
244
|
}
|
|
251
245
|
export {
|
|
252
|
-
|
|
253
|
-
|
|
246
|
+
B as PRODUCT_LAYOUT_CONTROL_ID,
|
|
247
|
+
Y as ProductLayoutControl
|
|
254
248
|
};
|