@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.
Files changed (47) hide show
  1. package/README.md +0 -14
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +72 -75
  4. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  5. package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
  6. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +9 -9
  8. package/dist/composables/useRecommendation.js +34 -33
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -12
  10. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +24 -32
  11. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -40
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -329
  13. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  14. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  15. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -9
  16. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +139 -168
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -30
  18. package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -8
  19. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
  20. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +98 -55
  22. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +207 -0
  23. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
  24. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  25. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +20 -16
  26. package/dist/extensions/Blocks/controlFactories.js +159 -133
  27. package/dist/guido.css +1 -1
  28. package/dist/src/components/Guido.vue.d.ts +0 -1
  29. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
  32. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.test.d.ts +1 -0
  33. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  34. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  35. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.test.d.ts +1 -0
  36. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  37. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +158 -11
  38. package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
  39. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +85 -0
  40. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.test.d.ts +1 -0
  41. package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
  42. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  43. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.test.d.ts +1 -0
  44. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +20 -9
  45. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  46. package/package.json +1 -1
  47. 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 O, PreviewDeviceMode as f, UEAttr as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as T } from "../../../common-control.js";
6
- import { MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as L, DEFAULT_COLUMN_SPACING as P, DEFAULT_MOBILE_COLUMN_SPACING as y } from "../../constants/layout.js";
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 D } from "../../store/recommendation.js";
9
- import { setMobileLayoutOptOut as m, ensureMobileCssRulesExist as C } from "../mobileLayout/cssRules.js";
10
- import { getCurrentLayout as w, getBlockElement as U, regenerateProductRowsWithStyles as b, regenerateMobileProductRows as g, adjustProductsToSize as A } from "./utils.js";
11
- import { useDebounceFn as B } from "../../../../../node_modules/@vueuse/shared/index.js";
12
- const S = "recommendation-product-layout-control", e = {
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 v extends T {
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", D());
30
+ u(this, "store", P());
31
31
  u(this, "storeUnsubscription", () => {
32
32
  });
33
- u(this, "_debouncedRegenerateProductRows", B(() => {
33
+ u(this, "_debouncedRegenerateProductRows", U(() => {
34
34
  this._regenerateProductRows();
35
35
  }, 500));
36
36
  }
37
37
  getId() {
38
- return S;
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: p }),
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: p }),
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()[O.previewDeviceMode] === f.MOBILE;
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 || w(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, d = this._isMobilePreview();
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, _ = o && r && !d, l = 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, _), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, _), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, l), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, l);
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
- N.SELECTPICKER.items,
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 = U(this.currentNode);
143
+ const o = D(this.currentNode);
144
144
  if (t) {
145
- const r = s.previousMobileCardsInRow || L;
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 && m(this.api, o, !1), C(this.api), b({
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: L
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 && m(this.api, o, !0), g({
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
- if (!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t)
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, columnSpacing: o },
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
- if (!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t)
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, mobileColumnSpacing: o },
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 = A(this.store.recommendationProducts, s);
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
- O.previewDeviceMode,
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
- S as PRODUCT_LAYOUT_CONTROL_ID,
253
- v as ProductLayoutControl
246
+ B as PRODUCT_LAYOUT_CONTROL_ID,
247
+ Y as ProductLayoutControl
254
248
  };