@empathyco/x-components 7.2.0 → 7.2.2

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 (29) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/docs/API-reference/api/x-adapter-platform.browseendpointadapter.md +13 -0
  3. package/docs/API-reference/api/x-adapter-platform.browserequestmapper.md +13 -0
  4. package/docs/API-reference/api/x-adapter-platform.browserequestschema.md +13 -0
  5. package/docs/API-reference/api/x-adapter-platform.browseresponsemapper.md +13 -0
  6. package/docs/API-reference/api/x-adapter-platform.browseresponseschema.md +13 -0
  7. package/docs/API-reference/api/x-adapter-platform.md +55 -0
  8. package/docs/API-reference/api/x-types.browsablerequest.browsefield.md +11 -0
  9. package/docs/API-reference/api/x-types.browsablerequest.browsevalue.md +11 -0
  10. package/docs/API-reference/api/x-types.browsablerequest.md +73 -0
  11. package/docs/API-reference/api/x-types.browserequest.md +15 -0
  12. package/docs/API-reference/api/x-types.browseresponse.banners.md +11 -0
  13. package/docs/API-reference/api/x-types.browseresponse.browsetagging.md +11 -0
  14. package/docs/API-reference/api/x-types.browseresponse.displaybrowsetagging.md +11 -0
  15. package/docs/API-reference/api/x-types.browseresponse.facets.md +11 -0
  16. package/docs/API-reference/api/x-types.browseresponse.md +187 -0
  17. package/docs/API-reference/api/x-types.browseresponse.promoteds.md +11 -0
  18. package/docs/API-reference/api/x-types.browseresponse.results.md +11 -0
  19. package/docs/API-reference/api/x-types.browseresponse.stats.md +11 -0
  20. package/docs/API-reference/api/x-types.browseresponse.totalresults.md +11 -0
  21. package/docs/API-reference/api/x-types.md +33 -0
  22. package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
  23. package/js/x-modules/recommendations/components/recommendations.vue2.js +2 -0
  24. package/js/x-modules/recommendations/components/recommendations.vue2.js.map +1 -1
  25. package/package.json +4 -4
  26. package/report/x-adapter-platform.api.json +250 -0
  27. package/report/x-types.api.json +425 -0
  28. package/types/src/x-modules/recommendations/components/recommendations.vue.d.ts.map +1 -1
  29. package/types/src/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.2.2](https://github.com/empathyco/x/compare/@empathyco/x-components@7.2.1...@empathyco/x-components@7.2.2) (2026-06-30)
7
+
8
+ **Note:** Version bump only for package @empathyco/x-components
9
+
10
+
11
+
12
+
13
+
14
+ ## [7.2.1](https://github.com/empathyco/x/compare/@empathyco/x-components@7.2.0...@empathyco/x-components@7.2.1) (2026-06-26)
15
+
16
+ ### Code Refactoring
17
+
18
+ * **recommendations:** provide `LIST_ITEMS_KEY` injection token (#2124)
19
+
20
+
6
21
  ## [7.2.0](https://github.com/empathyco/x/compare/@empathyco/x-components@7.1.1...@empathyco/x-components@7.2.0) (2026-06-18)
7
22
 
8
23
  ### Features
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-adapter-platform](./x-adapter-platform.md) &gt; [browseEndpointAdapter](./x-adapter-platform.browseendpointadapter.md)
4
+
5
+ ## browseEndpointAdapter variable
6
+
7
+ Default adapter for the browse endpoint.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ browseEndpointAdapter: import("@empathyco/x-adapter").ExtendableEndpointAdapter<BrowseRequest, BrowseResponse>
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-adapter-platform](./x-adapter-platform.md) &gt; [browseRequestMapper](./x-adapter-platform.browserequestmapper.md)
4
+
5
+ ## browseRequestMapper variable
6
+
7
+ Default implementation for the BrowseRequestMapper.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ browseRequestMapper: import("@empathyco/x-adapter").Mapper<BrowseRequest, PlatformBrowseRequest>
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-adapter-platform](./x-adapter-platform.md) &gt; [browseRequestSchema](./x-adapter-platform.browserequestschema.md)
4
+
5
+ ## browseRequestSchema variable
6
+
7
+ Default implementation for the BrowseRequestSchema.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ browseRequestSchema: import("@empathyco/x-adapter").MutableSchema<BrowseRequest, PlatformBrowseRequest>
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-adapter-platform](./x-adapter-platform.md) &gt; [browseResponseMapper](./x-adapter-platform.browseresponsemapper.md)
4
+
5
+ ## browseResponseMapper variable
6
+
7
+ Default implementation for the BrowseResponseMapper.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ browseResponseMapper: import("@empathyco/x-adapter").Mapper<PlatformBrowseResponse, BrowseResponse>
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-adapter-platform](./x-adapter-platform.md) &gt; [browseResponseSchema](./x-adapter-platform.browseresponseschema.md)
4
+
5
+ ## browseResponseSchema variable
6
+
7
+ Default implementation for the BrowseResponseSchema.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ browseResponseSchema: import("@empathyco/x-adapter").MutableSchema<PlatformBrowseResponse, BrowseResponse>
13
+ ```
@@ -695,6 +695,61 @@ Default implementation for the AIOverviewSuggestionsSearchSchema.
695
695
  Default implementation for the BannerSchema.
696
696
 
697
697
 
698
+ </td></tr>
699
+ <tr><td>
700
+
701
+ [browseEndpointAdapter](./x-adapter-platform.browseendpointadapter.md)
702
+
703
+
704
+ </td><td>
705
+
706
+ Default adapter for the browse endpoint.
707
+
708
+
709
+ </td></tr>
710
+ <tr><td>
711
+
712
+ [browseRequestMapper](./x-adapter-platform.browserequestmapper.md)
713
+
714
+
715
+ </td><td>
716
+
717
+ Default implementation for the BrowseRequestMapper.
718
+
719
+
720
+ </td></tr>
721
+ <tr><td>
722
+
723
+ [browseRequestSchema](./x-adapter-platform.browserequestschema.md)
724
+
725
+
726
+ </td><td>
727
+
728
+ Default implementation for the BrowseRequestSchema.
729
+
730
+
731
+ </td></tr>
732
+ <tr><td>
733
+
734
+ [browseResponseMapper](./x-adapter-platform.browseresponsemapper.md)
735
+
736
+
737
+ </td><td>
738
+
739
+ Default implementation for the BrowseResponseMapper.
740
+
741
+
742
+ </td></tr>
743
+ <tr><td>
744
+
745
+ [browseResponseSchema](./x-adapter-platform.browseresponseschema.md)
746
+
747
+
748
+ </td><td>
749
+
750
+ Default implementation for the BrowseResponseSchema.
751
+
752
+
698
753
  </td></tr>
699
754
  <tr><td>
700
755
 
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowsableRequest](./x-types.browsablerequest.md) &gt; [browseField](./x-types.browsablerequest.browsefield.md)
4
+
5
+ ## BrowsableRequest.browseField property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ browseField: string;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowsableRequest](./x-types.browsablerequest.md) &gt; [browseValue](./x-types.browsablerequest.browsevalue.md)
4
+
5
+ ## BrowsableRequest.browseValue property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ browseValue: string;
11
+ ```
@@ -0,0 +1,73 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowsableRequest](./x-types.browsablerequest.md)
4
+
5
+ ## BrowsableRequest interface
6
+
7
+ Interface for any Request with a `browseField` and `browseValue` parameters.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface BrowsableRequest
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Property
20
+
21
+
22
+ </th><th>
23
+
24
+ Modifiers
25
+
26
+
27
+ </th><th>
28
+
29
+ Type
30
+
31
+
32
+ </th><th>
33
+
34
+ Description
35
+
36
+
37
+ </th></tr></thead>
38
+ <tbody><tr><td>
39
+
40
+ [browseField](./x-types.browsablerequest.browsefield.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td><td>
47
+
48
+ string
49
+
50
+
51
+ </td><td>
52
+
53
+
54
+ </td></tr>
55
+ <tr><td>
56
+
57
+ [browseValue](./x-types.browsablerequest.browsevalue.md)
58
+
59
+
60
+ </td><td>
61
+
62
+
63
+ </td><td>
64
+
65
+ string
66
+
67
+
68
+ </td><td>
69
+
70
+
71
+ </td></tr>
72
+ </tbody></table>
73
+
@@ -0,0 +1,15 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseRequest](./x-types.browserequest.md)
4
+
5
+ ## BrowseRequest interface
6
+
7
+ The Request for the Browse endpoint.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface BrowseRequest extends BrowsableRequest, FilterableRequest, PageableRequest, SortableRequest, TrackableRequest, ExtraParamsRequest
13
+ ```
14
+ **Extends:** [BrowsableRequest](./x-types.browsablerequest.md)<!-- -->, [FilterableRequest](./x-types.filterablerequest.md)<!-- -->, [PageableRequest](./x-types.pageablerequest.md)<!-- -->, [SortableRequest](./x-types.sortablerequest.md)<!-- -->, [TrackableRequest](./x-types.trackablerequest.md)<!-- -->, [ExtraParamsRequest](./x-types.extraparamsrequest.md)
15
+
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [banners](./x-types.browseresponse.banners.md)
4
+
5
+ ## BrowseResponse.banners property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ banners?: Banner[];
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [browseTagging](./x-types.browseresponse.browsetagging.md)
4
+
5
+ ## BrowseResponse.browseTagging property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ browseTagging?: TaggingRequest;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [displayBrowseTagging](./x-types.browseresponse.displaybrowsetagging.md)
4
+
5
+ ## BrowseResponse.displayBrowseTagging property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ displayBrowseTagging?: TaggingRequest;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [facets](./x-types.browseresponse.facets.md)
4
+
5
+ ## BrowseResponse.facets property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ facets?: Facet[];
11
+ ```
@@ -0,0 +1,187 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md)
4
+
5
+ ## BrowseResponse interface
6
+
7
+ Response for the browse endpoint.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface BrowseResponse
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Property
20
+
21
+
22
+ </th><th>
23
+
24
+ Modifiers
25
+
26
+
27
+ </th><th>
28
+
29
+ Type
30
+
31
+
32
+ </th><th>
33
+
34
+ Description
35
+
36
+
37
+ </th></tr></thead>
38
+ <tbody><tr><td>
39
+
40
+ [banners?](./x-types.browseresponse.banners.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td><td>
47
+
48
+ [Banner](./x-types.banner.md)<!-- -->\[\]
49
+
50
+
51
+ </td><td>
52
+
53
+ _(Optional)_
54
+
55
+
56
+ </td></tr>
57
+ <tr><td>
58
+
59
+ [browseTagging?](./x-types.browseresponse.browsetagging.md)
60
+
61
+
62
+ </td><td>
63
+
64
+
65
+ </td><td>
66
+
67
+ [TaggingRequest](./x-types.taggingrequest.md)
68
+
69
+
70
+ </td><td>
71
+
72
+ _(Optional)_
73
+
74
+
75
+ </td></tr>
76
+ <tr><td>
77
+
78
+ [displayBrowseTagging?](./x-types.browseresponse.displaybrowsetagging.md)
79
+
80
+
81
+ </td><td>
82
+
83
+
84
+ </td><td>
85
+
86
+ [TaggingRequest](./x-types.taggingrequest.md)
87
+
88
+
89
+ </td><td>
90
+
91
+ _(Optional)_
92
+
93
+
94
+ </td></tr>
95
+ <tr><td>
96
+
97
+ [facets?](./x-types.browseresponse.facets.md)
98
+
99
+
100
+ </td><td>
101
+
102
+
103
+ </td><td>
104
+
105
+ [Facet](./x-types.facet.md)<!-- -->\[\]
106
+
107
+
108
+ </td><td>
109
+
110
+ _(Optional)_
111
+
112
+
113
+ </td></tr>
114
+ <tr><td>
115
+
116
+ [promoteds?](./x-types.browseresponse.promoteds.md)
117
+
118
+
119
+ </td><td>
120
+
121
+
122
+ </td><td>
123
+
124
+ [Promoted](./x-types.promoted.md)<!-- -->\[\]
125
+
126
+
127
+ </td><td>
128
+
129
+ _(Optional)_
130
+
131
+
132
+ </td></tr>
133
+ <tr><td>
134
+
135
+ [results](./x-types.browseresponse.results.md)
136
+
137
+
138
+ </td><td>
139
+
140
+
141
+ </td><td>
142
+
143
+ [Result](./x-types.result.md)<!-- -->\[\]
144
+
145
+
146
+ </td><td>
147
+
148
+
149
+ </td></tr>
150
+ <tr><td>
151
+
152
+ [stats?](./x-types.browseresponse.stats.md)
153
+
154
+
155
+ </td><td>
156
+
157
+
158
+ </td><td>
159
+
160
+ [Stats](./x-types.stats.md)
161
+
162
+
163
+ </td><td>
164
+
165
+ _(Optional)_
166
+
167
+
168
+ </td></tr>
169
+ <tr><td>
170
+
171
+ [totalResults](./x-types.browseresponse.totalresults.md)
172
+
173
+
174
+ </td><td>
175
+
176
+
177
+ </td><td>
178
+
179
+ number
180
+
181
+
182
+ </td><td>
183
+
184
+
185
+ </td></tr>
186
+ </tbody></table>
187
+
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [promoteds](./x-types.browseresponse.promoteds.md)
4
+
5
+ ## BrowseResponse.promoteds property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ promoteds?: Promoted[];
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [results](./x-types.browseresponse.results.md)
4
+
5
+ ## BrowseResponse.results property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ results: Result[];
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [stats](./x-types.browseresponse.stats.md)
4
+
5
+ ## BrowseResponse.stats property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ stats?: Stats;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-types](./x-types.md) &gt; [BrowseResponse](./x-types.browseresponse.md) &gt; [totalResults](./x-types.browseresponse.totalresults.md)
4
+
5
+ ## BrowseResponse.totalResults property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ totalResults: number;
11
+ ```
@@ -301,6 +301,39 @@ A banner is an image with a title, that when clicked redirect the user to an URL
301
301
  A boolean filter used in a [FacetFilter](./x-types.facetfilter.md)<!-- -->, which status can be selected or not and it may contains the total results number that the filter should return.
302
302
 
303
303
 
304
+ </td></tr>
305
+ <tr><td>
306
+
307
+ [BrowsableRequest](./x-types.browsablerequest.md)
308
+
309
+
310
+ </td><td>
311
+
312
+ Interface for any Request with a `browseField` and `browseValue` parameters.
313
+
314
+
315
+ </td></tr>
316
+ <tr><td>
317
+
318
+ [BrowseRequest](./x-types.browserequest.md)
319
+
320
+
321
+ </td><td>
322
+
323
+ The Request for the Browse endpoint.
324
+
325
+
326
+ </td></tr>
327
+ <tr><td>
328
+
329
+ [BrowseResponse](./x-types.browseresponse.md)
330
+
331
+
332
+ </td><td>
333
+
334
+ Response for the browse endpoint.
335
+
336
+
304
337
  </td></tr>
305
338
  <tr><td>
306
339
 
@@ -1 +1 @@
1
- {"version":3,"file":"recommendations.vue.js","sources":["../../../../../src/x-modules/recommendations/components/recommendations.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"recommendations.length\"\n tag=\"ul\"\n data-test=\"recommendations\"\n class=\"x-recommendations\"\n >\n <li\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n class=\"x-recommendations__item\"\n data-test=\"recommendation-item\"\n >\n <!--\n @slot (Required) Recommendation content.\n @binding {recommendation} recommendation - Recommendation data.\n -->\n <slot :recommendation=\"recommendation\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropsWithType } from '../../../utils'\nimport type { XEventsTypes } from '../../../wiring'\nimport { computed, defineComponent, provide } from 'vue'\nimport { useState } from '../../../composables'\nimport { AnimationProp } from '../../../types'\nimport { recommendationsXModule } from '../x-module'\n\n/**\n * It renders a list of recommendations from the\n * {@link RecommendationsState.recommendations} state by default.\n * The component provides the slot layout which wraps the whole component with the\n * recommendations bounded. It also provides the default slot to customize the item, which is\n * within the layout slot, with the recommendation bounded. Each recommendation should be\n * represented by a {@link BaseResultLink} component besides any other component.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Recommendations',\n xModule: recommendationsXModule.name,\n props: {\n /** Animation component that will be used to animate the recommendations. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /** Number of recommendations to be rendered. */\n maxItemsToRender: Number,\n },\n setup(props, { slots }) {\n /** The module's list of recommendations. */\n const storedRecommendations = useState('recommendations').recommendations\n\n /** The additional events to be emitted by the mandatory {@link BaseResultLink} component. */\n provide<PropsWithType<XEventsTypes, Result>[]>('resultClickExtraEvents', [\n 'UserClickedARecommendation',\n ])\n\n /**\n * Slices the recommendations from the state.\n *\n * @returns - The list of recommendations slice by the number of items to render.\n */\n const recommendations = computed<Result[]>(() =>\n storedRecommendations.value.slice(0, props.maxItemsToRender),\n )\n\n /**\n * Render function to execute the `layout` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no recommendations, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `layout` slot or empty string if there are\n * no recommendations.\n */\n function renderLayoutSlot() {\n const slotProps = {\n animation: props.animation,\n recommendations: recommendations.value,\n }\n return recommendations.value.length ? slots.layout?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `layout` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { recommendations }\n return (slots.layout ? renderLayoutSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-recommendations {\n display: flex;\n list-style-type: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events, but it makes components such as `BaseResultLink` emit additional\nevents:\n\n- [`UserClickedARecommendation`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the link of a recommendation.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Topclicked service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example on how the recommendations are rendered. You can customize how each\nresult is rendered by using the `default` slot. It is highly recommended to use base components such\nas the `BaseResultLink` or the `BaseResultAddToCart`, as they provide integration with other\nmodules such as the `tagging` one.\n\n```vue live\n<template>\n <Recommendations v-slot=\"{ recommendation }\">\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img\n :src=\"recommendation.images[0]\"\n :alt=\"recommendation.name\"\n class=\"x-recommendations__image\"\n />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart :result=\"recommendation\">Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n\n<script setup>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n</script>\n```\n\n### Play with props\n\nIn this example, the component will render a maximum of 4 result recommendations, and will use the\n`StaggeredFadeAndSlide` animation for the results, smoothing the entrance.\n\n```vue live\n<template>\n <Recommendations\n v-slot=\"{ recommendation }\"\n :maxItemsToRender=\"4\"\n :animation=\"StaggeredFadeAndSlide\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img\n :src=\"recommendation.images[0]\"\n :alt=\"recommendation.name\"\n class=\"x-recommendations__image\"\n />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart :result=\"recommendation\">Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n\n<script setup>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\nimport StaggeredFadeAndSlide from '@empathyco/x-components/animations/staggered-fade-and-slide.vue'\n</script>\n```\n\n### Play with the layout\n\nIn this example you can build your own layout, and the `Recommendations` component will just act as\na provider of the result recommendations data. Using the component this way, you can render any\nlayout you want using the `layout` slot.\n\n```vue live\n<template>\n <Recommendations v-slot:layout=\"{ recommendations }\">\n <div class=\"x-recommendations\">\n <article\n class=\"x-recommendations-list\"\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img\n :src=\"recommendation.images[0]\"\n :alt=\"recommendation.name\"\n class=\"x-recommendations__image\"\n />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart :result=\"recommendation\">Add to cart</BaseResultAddToCart>\n </article>\n </div>\n </Recommendations>\n</template>\n\n<script setup>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_renderSlot"],"mappings":";;;;;;SAGU,IAAA,CAAA,eAAA,CAAgB,MAAA,IAAAA,SAAA,EAAA,EAFxBC,WAAA,CAmBYC,uBAAA,CAlBL,IAAA,CAAA,SAAS,CAAA,EAAA;AAAA,IAAA,GAAA,EAAA,CAAA;IAEd,GAAA,EAAI,IAAA;AAAA,IACJ,WAAA,EAAU,iBAAA;AAAA,IACV,KAAA,EAAM;AAAA,GAAA,EAAA;qBAGJ,MAAyC;AAAA,OAAAF,SAAA,CAAA,IAAA,CAAA,EAD3CG,kBAAA;AAAA,QAWKC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAVsB,IAAA,CAAA,eAAA,EAAe,CAAjC,cAAA,KAAc;8BADvBF,kBAAA,CAWK,IAAA,EAAA;AAAA,YATF,KAAK,cAAA,CAAe,EAAA;AAAA,YACrB,KAAA,EAAM,yBAAA;AAAA,YACN,WAAA,EAAU;AAAA,WAAA,EAAA;AAMV,YAAAG,UAAA,CAAyC,0BAAlC,cAAA,EAA8B,EAAA,MAAA,EAAA,IAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"recommendations.vue.js","sources":["../../../../../src/x-modules/recommendations/components/recommendations.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"recommendations.length\"\n tag=\"ul\"\n data-test=\"recommendations\"\n class=\"x-recommendations\"\n >\n <li\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n class=\"x-recommendations__item\"\n data-test=\"recommendation-item\"\n >\n <!--\n @slot (Required) Recommendation content.\n @binding {recommendation} recommendation - Recommendation data.\n -->\n <slot :recommendation=\"recommendation\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropsWithType } from '../../../utils'\nimport type { XEventsTypes } from '../../../wiring'\nimport { computed, defineComponent, provide } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts'\nimport { useState } from '../../../composables'\nimport { AnimationProp } from '../../../types'\nimport { recommendationsXModule } from '../x-module'\n\n/**\n * It renders a list of recommendations from the\n * {@link RecommendationsState.recommendations} state by default.\n * The component provides the slot layout which wraps the whole component with the\n * recommendations bounded. It also provides the default slot to customize the item, which is\n * within the layout slot, with the recommendation bounded. Each recommendation should be\n * represented by a {@link BaseResultLink} component besides any other component.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Recommendations',\n xModule: recommendationsXModule.name,\n props: {\n /** Animation component that will be used to animate the recommendations. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /** Number of recommendations to be rendered. */\n maxItemsToRender: Number,\n },\n setup(props, { slots }) {\n /** The module's list of recommendations. */\n const storedRecommendations = useState('recommendations').recommendations\n\n /** The additional events to be emitted by the mandatory {@link BaseResultLink} component. */\n provide<PropsWithType<XEventsTypes, Result>[]>('resultClickExtraEvents', [\n 'UserClickedARecommendation',\n ])\n\n /**\n * Slices the recommendations from the state.\n *\n * @returns - The list of recommendations slice by the number of items to render.\n */\n const recommendations = computed<Result[]>(() =>\n storedRecommendations.value.slice(0, props.maxItemsToRender),\n )\n\n provide(LIST_ITEMS_KEY as string, recommendations)\n\n /**\n * Render function to execute the `layout` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no recommendations, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `layout` slot or empty string if there are\n * no recommendations.\n */\n function renderLayoutSlot() {\n const slotProps = {\n animation: props.animation,\n recommendations: recommendations.value,\n }\n return recommendations.value.length ? slots.layout?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `layout` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { recommendations }\n return (slots.layout ? renderLayoutSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-recommendations {\n display: flex;\n list-style-type: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events, but it makes components such as `BaseResultLink` emit additional\nevents:\n\n- [`UserClickedARecommendation`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the link of a recommendation.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Topclicked service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example on how the recommendations are rendered. You can customize how each\nresult is rendered by using the `default` slot. It is highly recommended to use base components such\nas the `BaseResultLink` or the `BaseResultAddToCart`, as they provide integration with other\nmodules such as the `tagging` one.\n\n```vue live\n<template>\n <Recommendations v-slot=\"{ recommendation }\">\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img\n :src=\"recommendation.images[0]\"\n :alt=\"recommendation.name\"\n class=\"x-recommendations__image\"\n />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart :result=\"recommendation\">Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n\n<script setup>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n</script>\n```\n\n### Play with props\n\nIn this example, the component will render a maximum of 4 result recommendations, and will use the\n`StaggeredFadeAndSlide` animation for the results, smoothing the entrance.\n\n```vue live\n<template>\n <Recommendations\n v-slot=\"{ recommendation }\"\n :maxItemsToRender=\"4\"\n :animation=\"StaggeredFadeAndSlide\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img\n :src=\"recommendation.images[0]\"\n :alt=\"recommendation.name\"\n class=\"x-recommendations__image\"\n />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart :result=\"recommendation\">Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n\n<script setup>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\nimport StaggeredFadeAndSlide from '@empathyco/x-components/animations/staggered-fade-and-slide.vue'\n</script>\n```\n\n### Play with the layout\n\nIn this example you can build your own layout, and the `Recommendations` component will just act as\na provider of the result recommendations data. Using the component this way, you can render any\nlayout you want using the `layout` slot.\n\n```vue live\n<template>\n <Recommendations v-slot:layout=\"{ recommendations }\">\n <div class=\"x-recommendations\">\n <article\n class=\"x-recommendations-list\"\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img\n :src=\"recommendation.images[0]\"\n :alt=\"recommendation.name\"\n class=\"x-recommendations__image\"\n />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart :result=\"recommendation\">Add to cart</BaseResultAddToCart>\n </article>\n </div>\n </Recommendations>\n</template>\n\n<script setup>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_renderSlot"],"mappings":";;;;;;SAGU,IAAA,CAAA,eAAA,CAAgB,MAAA,IAAAA,SAAA,EAAA,EAFxBC,WAAA,CAmBYC,uBAAA,CAlBL,IAAA,CAAA,SAAS,CAAA,EAAA;AAAA,IAAA,GAAA,EAAA,CAAA;IAEd,GAAA,EAAI,IAAA;AAAA,IACJ,WAAA,EAAU,iBAAA;AAAA,IACV,KAAA,EAAM;AAAA,GAAA,EAAA;qBAGJ,MAAyC;AAAA,OAAAF,SAAA,CAAA,IAAA,CAAA,EAD3CG,kBAAA;AAAA,QAWKC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAVsB,IAAA,CAAA,eAAA,EAAe,CAAjC,cAAA,KAAc;8BADvBF,kBAAA,CAWK,IAAA,EAAA;AAAA,YATF,KAAK,cAAA,CAAe,EAAA;AAAA,YACrB,KAAA,EAAM,yBAAA;AAAA,YACN,WAAA,EAAU;AAAA,WAAA,EAAA;AAMV,YAAAG,UAAA,CAAyC,0BAAlC,cAAA,EAA8B,EAAA,MAAA,EAAA,IAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { defineComponent, provide, computed } from 'vue';
2
+ import { LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts.js';
2
3
  import '../../../composables/create-use-device.js';
3
4
  import 'vuex';
4
5
  import '../../../plugins/x-bus.js';
@@ -45,6 +46,7 @@ var _sfc_main = defineComponent({
45
46
  * @returns - The list of recommendations slice by the number of items to render.
46
47
  */
47
48
  const recommendations = computed(() => storedRecommendations.value.slice(0, props.maxItemsToRender));
49
+ provide(LIST_ITEMS_KEY, recommendations);
48
50
  /**
49
51
  * Render function to execute the `layout` slot, binding `slotsProps` and getting only the
50
52
  * first `vNode` to avoid Fragments and Text root nodes.