@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.
Files changed (62) hide show
  1. package/dist/@types/config/schemas.js +70 -66
  2. package/dist/composables/usePreviewMode.js +15 -14
  3. package/dist/composables/useRecommendationPreview.js +100 -0
  4. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  5. package/dist/config/compiler/utils/recommendationCompilerUtils.js +92 -78
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
  7. package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
  8. package/dist/extensions/Blocks/Recommendation/block.js +60 -41
  9. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
  10. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
  11. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
  12. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +369 -288
  13. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -82
  14. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
  15. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
  16. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
  17. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +338 -288
  18. package/dist/extensions/Blocks/Recommendation/extension.js +30 -30
  19. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
  20. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
  21. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
  22. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
  23. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +217 -155
  24. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -56
  25. package/dist/extensions/Blocks/Recommendation/templates/index.js +10 -29
  26. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +135 -145
  27. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -43
  28. package/dist/extensions/Blocks/Recommendation/templates/utils.js +96 -109
  29. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
  30. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
  31. package/dist/extensions/Blocks/controlFactories.js +133 -159
  32. package/dist/src/@types/config/schemas.d.ts +16 -0
  33. package/dist/src/composables/useConfig.d.ts +4 -0
  34. package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
  35. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  36. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  37. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  38. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  39. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
  40. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  41. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
  42. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  43. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
  47. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  48. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +16 -0
  49. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  50. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +13 -0
  52. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  53. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +47 -163
  54. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
  55. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
  56. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  57. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
  58. package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
  59. package/dist/src/stores/config.d.ts +36 -0
  60. package/package.json +1 -1
  61. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -216
  62. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
@@ -1,45 +1,45 @@
1
1
  import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlock as m } from "./block.js";
3
- import { RecommendationBlockControl as n } from "./controls/main/index.js";
3
+ import n from "./canvasPreview.css.js";
4
+ import { RecommendationBlockControl as i } from "./controls/main/index.js";
4
5
  import "./store/recommendation.js";
5
- import "./utils/captureStyleTemplates.js";
6
- import { NameControls as i } from "./controls/name/index.js";
7
- import { PriceControls as e } from "./controls/price/index.js";
8
- import { OldPriceControls as s } from "./controls/oldPrice/index.js";
9
- import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
6
+ import { NameControls as e } from "./controls/name/index.js";
7
+ import { PriceControls as s } from "./controls/price/index.js";
8
+ import { OldPriceControls as l } from "./controls/oldPrice/index.js";
9
+ import { OmnibusPriceControls as a } from "./controls/omnibusPrice/index.js";
10
10
  import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
11
- import { ButtonControls as a } from "./controls/button/index.js";
12
- import { ImageControls as c } from "./controls/image/index.js";
11
+ import { ButtonControls as c } from "./controls/button/index.js";
12
+ import { ImageControls as f } from "./controls/image/index.js";
13
13
  import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
14
- import { SpacingControl as f } from "./controls/spacing/index.js";
15
- import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
16
- import { RecommendationCardCompositionControl as u } from "./controls/cardComposition/index.js";
17
- import { SyncInfoMessageControl as g } from "./controls/syncInfoMessage.js";
18
- import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
19
- import y from "./recommendation.css.js";
20
- import { SettingsPanel as B } from "./settingsPanel.js";
21
- const b = [
22
- i,
14
+ import { SpacingControl as d } from "./controls/spacing/index.js";
15
+ import { CardBackgroundColorControl as u } from "./controls/cardBackground/index.js";
16
+ import { RecommendationCardCompositionControl as g } from "./controls/cardComposition/index.js";
17
+ import { SyncInfoMessageControl as y } from "./controls/syncInfoMessage.js";
18
+ import { RecommendationIconsRegistry as P } from "./iconsRegistry.js";
19
+ import R from "./recommendation.css.js";
20
+ import { SettingsPanel as S } from "./settingsPanel.js";
21
+ const w = [
23
22
  e,
24
23
  s,
25
24
  l,
26
- p,
27
25
  a,
26
+ p,
28
27
  c,
29
- C
30
- ], P = [
31
- n,
32
- d,
33
28
  f,
29
+ C
30
+ ], B = [
31
+ i,
34
32
  u,
35
- g
36
- ], S = [
37
- ...P,
38
- ...b.flatMap((o) => Object.values(o))
39
- ], L = S.reduce(
33
+ d,
34
+ g,
35
+ y
36
+ ], b = [
37
+ ...B,
38
+ ...w.flatMap((o) => Object.values(o))
39
+ ], Q = b.reduce(
40
40
  (o, t) => o.addControl(t),
41
- new r().addBlock(m).withSettingsPanelRegistry(B)
42
- ).addStyles(y).withIconsRegistry(R).build();
41
+ new r().addBlock(m).withSettingsPanelRegistry(S)
42
+ ).addStyles(R).withPreviewStyles(n).withIconsRegistry(P).build();
43
43
  export {
44
- L as default
44
+ Q as default
45
45
  };
@@ -1,8 +1,8 @@
1
1
  import r from "../../../static/assets/info.svg.js";
2
- import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- class h extends t {
4
- registerIconsSvg(C) {
5
- C["recommendation-icon"] = `
2
+ import { IconsRegistry as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ class h extends C {
4
+ registerIconsSvg(t) {
5
+ t["recommendation-icon"] = `
6
6
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
7
7
  <path d="M10 4.4C10 4.73137 9.73012 4.99622 9.40108 5.0355C6.92202 5.33143 5 7.44126 5 10C5 12.5587
8
8
  6.92202 14.6686 9.40108 14.9645C9.73012 15.0038 10 15.2686 10 15.6V18.4C10 18.7314 9.73137 19 9.4
@@ -44,14 +44,14 @@ class h extends t {
44
44
  3.40029 12.0082 3.25285 11.7656 3.15234C11.365 2.98638 11.0001 2.64849 11 2.21484V2Z"
45
45
  fill="currentColor"/>
46
46
  </svg>
47
- `, C["grid-orientation"] = `
47
+ `, t["grid-orientation"] = `
48
48
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
49
49
  <rect x="1" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
50
50
  <rect x="12" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
51
51
  <rect x="1" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
52
52
  <rect x="12" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
53
53
  </svg>
54
- `, C["list-orientation"] = `
54
+ `, t["list-orientation"] = `
55
55
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
56
56
  <circle cx="3" cy="4" r="1" stroke="currentColor" stroke-width="1"/>
57
57
  <rect x="7" y="3" width="11" height="2" rx="1"/>
@@ -60,7 +60,21 @@ class h extends t {
60
60
  <circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
61
61
  <rect x="7" y="15" width="11" height="2" rx="1"/>
62
62
  </svg>
63
- `, C["migration-info-icon"] = r;
63
+ `, t["vertical-orientation"] = `
64
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
65
+ <path d="M19 10V16C19 16.5523 18.5523 17 18 17H2C1.44772 17 1 16.5523 1 16V10H19Z"
66
+ stroke="currentColor" stroke-width="2" fill="none"/>
67
+ <path d="M2 3H18C18.5523 3 19 3.44772 19 4V10H1V4C1 3.44772 1.44772 3 2 3Z" stroke="currentColor"
68
+ stroke-width="2" fill="none"/>
69
+ </svg>
70
+ `, t["horizontal-orientation"] = `
71
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
72
+ <path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
73
+ stroke-width="2" fill="none"/>
74
+ <path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
75
+ stroke-width="2" fill="none"/>
76
+ </svg>
77
+ `, t["migration-info-icon"] = r;
64
78
  }
65
79
  }
66
80
  export {
@@ -18,6 +18,13 @@ const n = `/* Utils */
18
18
  padding: 0
19
19
  }
20
20
 
21
+ /* Group the two price-placement rows (orientation + hide-if-same) into one
22
+ container — drop the divider the editor adds between stacked setting rows.
23
+ Ancestor added so this out-specifies the editor's \`.two-columns:not(:first-child)\`. */
24
+ .recommendation-controls-container .price-placement-control-container .container.two-columns {
25
+ border-top: none;
26
+ }
27
+
21
28
  /* Right-align the mobile layout toggle within the two-column grid */
22
29
  .product-layout-control-container ue-switcher {
23
30
  justify-self: end;
@@ -143,15 +150,68 @@ ue-orderable.orderable-disabled .droppable-icon {
143
150
  color: var(--guido-color-danger-500);
144
151
  }
145
152
 
146
- /* Disable drag for list layout */
147
- .orderable-list.orderable-disabled .drag-handle {
148
- display: none;
153
+ /* ─── Inline "Product Prices" group: nested 2-item sub-drag ───────────── */
154
+ .orderable-item.price-group-item {
155
+ flex-direction: column;
156
+ align-items: stretch;
157
+ gap: 8px;
149
158
  }
150
159
 
151
- .orderable-list.orderable-disabled .orderable-item {
160
+ .price-group-header {
161
+ display: flex;
162
+ align-items: center;
163
+ gap: 4px;
164
+ }
165
+
166
+ .price-suborderable-list {
167
+ display: flex;
168
+ flex-direction: column;
169
+ margin-left: 4px;
170
+ padding-left: 8px;
171
+ border-left: 2px solid #eee;
172
+ }
173
+
174
+ .price-suborderable-item {
175
+ display: flex;
176
+ align-items: center;
177
+ gap: 4px;
178
+ padding: 8px 0;
179
+ background: var(--guido-color-white);
152
180
  cursor: default;
181
+ transition: background 0.15s;
182
+ box-sizing: border-box;
183
+ }
184
+
185
+ .price-suborderable-item:hover {
186
+ background: #fafafa;
187
+ }
188
+
189
+ .price-suborderable-item.dragging {
190
+ opacity: 0.5;
191
+ background: var(--guido-color-gray-1);
192
+ }
193
+
194
+ .price-suborderable-item.drag-over {
195
+ border-top: 2px solid var(--guido-color-primary-500, #0A2ECC);
196
+ }
197
+
198
+ .price-suborderable-item .item-label {
199
+ font-size: 13px;
153
200
  }
154
201
 
202
+ .sub-drag-handle {
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ flex-shrink: 0;
207
+ width: 24px;
208
+ height: 24px;
209
+ cursor: move;
210
+ user-select: none;
211
+ color: var(--guido-color-gray-600);
212
+ }
213
+
214
+
155
215
  /* ─── Migration Info Box ─────────────────────────────────────────────── */
156
216
  /* Shown in the settings panel title when a block was migrated from legacy */
157
217
 
@@ -4,7 +4,6 @@ import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
5
  import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
6
6
  import "./store/recommendation.js";
7
- import "./utils/captureStyleTemplates.js";
8
7
  import "./controls/name/index.js";
9
8
  import "./controls/price/index.js";
10
9
  import "./controls/oldPrice/index.js";
@@ -16,7 +15,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
16
15
  import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
17
16
  import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
18
17
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
19
- class a extends E {
18
+ class Z extends E {
20
19
  registerBlockControls(I) {
21
20
  I[U] = [
22
21
  new _(
@@ -195,5 +194,5 @@ class a extends E {
195
194
  }
196
195
  }
197
196
  export {
198
- a as SettingsPanel
197
+ Z as SettingsPanel
199
198
  };
@@ -3,10 +3,10 @@ import { useRecommendationApi as y } from "../../../../services/recommendationAp
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
4
  import { defineStore as P } from "pinia";
5
5
  import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
- import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
6
+ import { EXCLUDED_ALGORITHM_IDS as v } from "../constants/defaultConfig.js";
7
7
  import { getDefaultProducts as S } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
- import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
9
+ import { getPartnerRecommendationParams as w } from "../utils/partnerCustomizations.js";
10
10
  import { isFilterValid as N } from "../validation/filterSchema.js";
11
11
  import { isConfigValid as x } from "../validation/requiredFields.js";
12
12
  const h = y();
@@ -37,7 +37,9 @@ function k() {
37
37
  textTrimming: !0,
38
38
  unresponsive: !1,
39
39
  size: "6",
40
- customAttributes: []
40
+ customAttributes: [],
41
+ priceMovedToNextLine: !0,
42
+ priceHideIfSameAsDiscounted: !1
41
43
  };
42
44
  }
43
45
  function I() {
@@ -117,7 +119,7 @@ const L = () => ({
117
119
  },
118
120
  getActivePredictiveAlgorithms: (t) => {
119
121
  const e = g(), r = [];
120
- return t.activePredictiveAlgorithms.filter((n) => !w.includes(n)).forEach((n) => {
122
+ return t.activePredictiveAlgorithms.filter((n) => !v.includes(n)).forEach((n) => {
121
123
  r.push(...e.filter((c) => c.id === n));
122
124
  }), r.map((n) => ({
123
125
  text: n.name,
@@ -457,7 +459,7 @@ const L = () => ({
457
459
  };
458
460
  r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
459
461
  a,
460
- v(o.partnerName, r.strategy)
462
+ w(o.partnerName, r.strategy)
461
463
  );
462
464
  let f;
463
465
  try {