@empathyco/x-components 6.0.0-alpha.6 → 6.0.0-alpha.61

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 (833) hide show
  1. package/CHANGELOG.md +531 -0
  2. package/core/index.js +9 -1
  3. package/core/index.js.map +1 -1
  4. package/design-system/deprecated-full-theme.css +2371 -2371
  5. package/docs/API-reference/api/x-adapter-platform.md +12 -0
  6. package/docs/API-reference/api/x-adapter-platform.nextqueriesrelatedpromptsschema.md +11 -0
  7. package/docs/API-reference/api/x-adapter-platform.platformadapter.relatedprompts.md +1 -1
  8. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.md +23 -0
  9. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.nextqueries.md +11 -0
  10. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.suggestiontext.md +11 -0
  11. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.tagging.md +11 -0
  12. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.type.md +11 -0
  13. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.md +22 -0
  14. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplay.md +11 -0
  15. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplayadd2cart.md +11 -0
  16. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplayclick.md +11 -0
  17. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsrequest.md +15 -0
  18. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.data.md +13 -0
  19. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.md +21 -0
  20. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.status.md +11 -0
  21. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.md +22 -0
  22. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.nextqueries.md +11 -0
  23. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.toolingdisplay.md +11 -0
  24. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.toolingdisplayclick.md +11 -0
  25. package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.catalog.md +6 -0
  26. package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.md +1 -1
  27. package/docs/API-reference/api/x-adapter-platform.relatedpromptschema.md +13 -0
  28. package/docs/API-reference/api/x-adapter-platform.relatedpromptsendpointadapter.md +13 -0
  29. package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestmapper.md +13 -0
  30. package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestschema.md +13 -0
  31. package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponsemapper.md +13 -0
  32. package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponseschema.md +13 -0
  33. package/docs/API-reference/api/x-components.animationprop.md +6 -1
  34. package/docs/API-reference/api/x-components.bannerslist.md +3 -3
  35. package/docs/API-reference/api/x-components.baseaddtocart.md +1 -0
  36. package/docs/API-reference/api/x-components.basedropdown.md +5 -5
  37. package/docs/API-reference/api/x-components.baseeventsmodal.md +2 -2
  38. package/docs/API-reference/api/x-components.basegrid.md +3 -3
  39. package/docs/API-reference/api/x-components.baseheadertogglepanel.md +5 -5
  40. package/docs/API-reference/api/x-components.baseidmodal.md +2 -2
  41. package/docs/API-reference/api/x-components.baseidtogglepanel.md +5 -5
  42. package/docs/API-reference/api/x-components.basemodal.md +10 -10
  43. package/docs/API-reference/api/x-components.baseresultimage.md +9 -9
  44. package/docs/API-reference/api/x-components.baseslider.md +70 -0
  45. package/docs/API-reference/api/x-components.basesuggestions.md +3 -3
  46. package/docs/API-reference/api/x-components.baseswitch.md +1 -1
  47. package/docs/API-reference/api/x-components.basetabspanel.md +8 -8
  48. package/docs/API-reference/api/x-components.baseteleport.md +21 -0
  49. package/docs/API-reference/api/x-components.basetogglepanel.md +3 -3
  50. package/docs/API-reference/api/x-components.basevariablecolumngrid.md +3 -3
  51. package/docs/API-reference/api/x-components.cancelfetchandsaverelatedprompts.md +13 -0
  52. package/docs/API-reference/api/x-components.configmutations.config.md +11 -0
  53. package/docs/API-reference/api/x-components.configmutations.md +29 -0
  54. package/docs/API-reference/api/x-components.configmutations.mergeconfig.md +24 -0
  55. package/docs/API-reference/api/x-components.configmutations.setconfig.md +24 -0
  56. package/docs/API-reference/api/x-components.createrelatedtagsquerygetter.md +26 -0
  57. package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.getrelatedtags.md +13 -0
  58. package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.md +20 -0
  59. package/docs/API-reference/api/x-components.createtrackrelatedprompttoolingdisplayclickwire.md +19 -0
  60. package/docs/API-reference/api/x-components.createtracktoolingadd2cartwire.md +19 -0
  61. package/docs/API-reference/api/x-components.createtracktoolingdisplaywire.md +19 -0
  62. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice._constructor_.md → x-components.defaultexternaltaggingservice._constructor_.md} +3 -3
  63. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.add_to_cart_id_key.md +13 -0
  64. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.instance.md +13 -0
  65. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.localstorageservice.md +11 -0
  66. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.md +43 -0
  67. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.movetosessionstorage.md → x-components.defaultexternaltaggingservice.movetosessionstorage.md} +2 -2
  68. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.result_clicked_id_key.md +13 -0
  69. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.sessionstorageservice.md +11 -0
  70. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storagekey.md +11 -0
  71. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storagettlms.md +11 -0
  72. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.store.md → x-components.defaultexternaltaggingservice.store.md} +2 -2
  73. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storeaddtocart.md +24 -0
  74. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.storeresultclicked.md → x-components.defaultexternaltaggingservice.storeresultclicked.md} +3 -3
  75. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.trackaddtocart.md → x-components.defaultexternaltaggingservice.trackaddtocart.md} +3 -3
  76. package/docs/API-reference/api/x-components.displayclickprovider.md +66 -0
  77. package/docs/API-reference/api/x-components.empathize.md +6 -6
  78. package/docs/API-reference/api/x-components.empathizemutations.md +1 -1
  79. package/docs/API-reference/api/x-components.externaltaggingservice.md +23 -0
  80. package/docs/API-reference/api/{x-components.pdpaddtocartservice.movetosessionstorage.md → x-components.externaltaggingservice.movetosessionstorage.md} +2 -2
  81. package/docs/API-reference/api/x-components.externaltaggingservice.storeaddtocart.md +24 -0
  82. package/docs/API-reference/api/{x-components.pdpaddtocartservice.storeresultclicked.md → x-components.externaltaggingservice.storeresultclicked.md} +3 -3
  83. package/docs/API-reference/api/{x-components.pdpaddtocartservice.trackaddtocart.md → x-components.externaltaggingservice.trackaddtocart.md} +3 -3
  84. package/docs/API-reference/api/x-components.facets.md +3 -3
  85. package/docs/API-reference/api/x-components.facetsmutations.md +1 -1
  86. package/docs/API-reference/api/x-components.featurelocation.md +1 -1
  87. package/docs/API-reference/api/x-components.fetchandsaverelatedprompts.md +13 -0
  88. package/docs/API-reference/api/x-components.fetchrelatedprompts.md +13 -0
  89. package/docs/API-reference/api/x-components.filterslist.md +3 -3
  90. package/docs/API-reference/api/x-components.globalxbus.md +14 -0
  91. package/docs/API-reference/api/x-components.hierarchicalfilter.md +9 -2
  92. package/docs/API-reference/api/x-components.historyqueriesmutations.md +1 -1
  93. package/docs/API-reference/api/x-components.historyqueriesstate.md +1 -1
  94. package/docs/API-reference/api/x-components.identifierresults.md +3 -3
  95. package/docs/API-reference/api/x-components.identifierresultsmutations.md +1 -1
  96. package/docs/API-reference/api/x-components.identifierresultsstate.md +1 -1
  97. package/docs/API-reference/api/x-components.installxoptions.domelement.md +1 -1
  98. package/docs/API-reference/api/x-components.installxoptions.installextraplugins.md +2 -2
  99. package/docs/API-reference/api/x-components.installxoptions.md +1 -1
  100. package/docs/API-reference/api/x-components.itemslist.md +3 -3
  101. package/docs/API-reference/api/x-components.mainmodal.md +2 -2
  102. package/docs/API-reference/api/x-components.md +39 -3
  103. package/docs/API-reference/api/x-components.mergeconfig.md +27 -0
  104. package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +5 -5
  105. package/docs/API-reference/api/x-components.myhistory.md +3 -3
  106. package/docs/API-reference/api/x-components.nextqueriesgroup.md +22 -0
  107. package/docs/API-reference/api/x-components.nextqueriesgroup.modelname.md +11 -0
  108. package/docs/API-reference/api/x-components.nextqueriesgroup.nextqueries.md +11 -0
  109. package/docs/API-reference/api/x-components.nextquerieslist.md +3 -3
  110. package/docs/API-reference/api/x-components.nextqueriesmutations.md +1 -1
  111. package/docs/API-reference/api/x-components.nextqueriesstate.md +1 -1
  112. package/docs/API-reference/api/x-components.pageselector.md +80 -0
  113. package/docs/API-reference/api/x-components.partialresultslist.md +3 -3
  114. package/docs/API-reference/api/x-components.popularsearchesmutations.md +1 -1
  115. package/docs/API-reference/api/x-components.promotedslist.md +3 -3
  116. package/docs/API-reference/api/x-components.queriespreviewmutations.md +1 -1
  117. package/docs/API-reference/api/x-components.queryfeature.md +1 -1
  118. package/docs/API-reference/api/x-components.querymutations.md +20 -0
  119. package/docs/API-reference/api/x-components.querymutations.setquery.md +24 -0
  120. package/docs/API-reference/api/x-components.querypreviewlist.md +3 -3
  121. package/docs/API-reference/api/x-components.querystate.md +20 -0
  122. package/docs/API-reference/api/x-components.querystate.query.md +13 -0
  123. package/docs/API-reference/api/x-components.querysuggestionsmutations.md +1 -1
  124. package/docs/API-reference/api/x-components.querysuggestionsstate.md +1 -1
  125. package/docs/API-reference/api/x-components.recommendations.md +3 -3
  126. package/docs/API-reference/api/x-components.recommendationsmutations.md +1 -1
  127. package/docs/API-reference/api/x-components.relatedprompt.md +33 -0
  128. package/docs/API-reference/api/x-components.relatedpromptsactioncontext.md +15 -0
  129. package/docs/API-reference/api/x-components.relatedpromptsactions.cancelfetchandsaverelatedprompts.md +17 -0
  130. package/docs/API-reference/api/x-components.relatedpromptsactions.fetchandsaverelatedprompts.md +24 -0
  131. package/docs/API-reference/api/x-components.relatedpromptsactions.fetchrelatedprompts.md +24 -0
  132. package/docs/API-reference/api/x-components.relatedpromptsactions.md +23 -0
  133. package/docs/API-reference/api/x-components.relatedpromptsactions.seturlparams.md +24 -0
  134. package/docs/API-reference/api/x-components.relatedpromptsgetters.md +21 -0
  135. package/docs/API-reference/api/x-components.relatedpromptsgetters.query.md +13 -0
  136. package/docs/API-reference/api/x-components.relatedpromptsgetters.request.md +13 -0
  137. package/docs/API-reference/api/x-components.relatedpromptslist.md +72 -0
  138. package/docs/API-reference/api/x-components.relatedpromptsmutations.md +27 -0
  139. package/docs/API-reference/api/x-components.relatedpromptsmutations.resetrelatedpromptsstate.md +17 -0
  140. package/docs/API-reference/api/x-components.relatedpromptsmutations.resetselectedprompt.md +17 -0
  141. package/docs/API-reference/api/x-components.relatedpromptsmutations.setparams.md +24 -0
  142. package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsproducts.md +24 -0
  143. package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsrelatedtags.md +24 -0
  144. package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedprompt.md +24 -0
  145. package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedquery.md +24 -0
  146. package/docs/API-reference/api/x-components.relatedpromptsstate.md +25 -0
  147. package/docs/API-reference/api/x-components.relatedpromptsstate.params.md +13 -0
  148. package/docs/API-reference/api/x-components.relatedpromptsstate.relatedprompts.md +13 -0
  149. package/docs/API-reference/api/x-components.relatedpromptsstate.relatedtags.md +13 -0
  150. package/docs/API-reference/api/x-components.relatedpromptsstate.selectedprompt.md +13 -0
  151. package/docs/API-reference/api/x-components.relatedpromptsstate.selectedquery.md +13 -0
  152. package/docs/API-reference/api/x-components.relatedpromptstaglist.md +72 -0
  153. package/docs/API-reference/api/x-components.relatedpromptsxevents.md +25 -0
  154. package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md +13 -0
  155. package/docs/API-reference/api/x-components.relatedpromptsxevents.selectedrelatedpromptchanged.md +13 -0
  156. package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptadd2cart.md +13 -0
  157. package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptresult.md +13 -0
  158. package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedprompt.md +13 -0
  159. package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedpromptquery.md +13 -0
  160. package/docs/API-reference/api/x-components.relatedpromptsxmodule.md +13 -0
  161. package/docs/API-reference/api/x-components.relatedpromptsxstoremodule.md +15 -0
  162. package/docs/API-reference/api/x-components.relatedtags.md +3 -3
  163. package/docs/API-reference/api/x-components.relatedtagsmutations.md +1 -1
  164. package/docs/API-reference/api/x-components.relatedtagsstate.md +1 -1
  165. package/docs/API-reference/api/x-components.resultfeature.md +1 -1
  166. package/docs/API-reference/api/x-components.resultslist.md +3 -3
  167. package/docs/API-reference/api/x-components.scrolltotop.md +5 -5
  168. package/docs/API-reference/api/x-components.searchboxmutations.md +1 -1
  169. package/docs/API-reference/api/x-components.searchboxstate.md +1 -1
  170. package/docs/API-reference/api/x-components.searchconfig.md +1 -0
  171. package/docs/API-reference/api/x-components.searchconfig.pagemode.md +11 -0
  172. package/docs/API-reference/api/x-components.searchinputplaceholder.md +3 -3
  173. package/docs/API-reference/api/x-components.searchmutations.md +2 -1
  174. package/docs/API-reference/api/x-components.searchmutations.setstats.md +24 -0
  175. package/docs/API-reference/api/x-components.searchstate.md +2 -1
  176. package/docs/API-reference/api/x-components.searchstate.stats.md +13 -0
  177. package/docs/API-reference/api/x-components.searchxevents.md +1 -0
  178. package/docs/API-reference/api/x-components.searchxevents.userselectedapage.md +13 -0
  179. package/docs/API-reference/api/x-components.selectedfilterslist.md +3 -3
  180. package/docs/API-reference/api/x-components.semanticqueriesgetters.md +1 -0
  181. package/docs/API-reference/api/x-components.semanticqueriesgetters.query.md +13 -0
  182. package/docs/API-reference/api/x-components.semanticqueriesmutations.md +2 -1
  183. package/docs/API-reference/api/x-components.semanticqueriesmutations.setsemanticqueriesrelatedtags.md +24 -0
  184. package/docs/API-reference/api/x-components.semanticqueriesstate.md +2 -1
  185. package/docs/API-reference/api/x-components.semanticqueriesstate.relatedtags.md +13 -0
  186. package/docs/API-reference/api/x-components.setconfig.md +27 -0
  187. package/docs/API-reference/api/x-components.setquery.md +25 -0
  188. package/docs/API-reference/api/x-components.seturlprompt.md +13 -0
  189. package/docs/API-reference/api/x-components.simplefilter.md +7 -0
  190. package/docs/API-reference/api/x-components.singlecolumnlayout.md +3 -3
  191. package/docs/API-reference/api/x-components.slidingpanel.md +13 -5
  192. package/docs/API-reference/api/x-components.snippetcallbacks.md +7 -0
  193. package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
  194. package/docs/API-reference/api/x-components.tagging.md +6 -6
  195. package/docs/API-reference/api/x-components.taggingconfig.md +2 -2
  196. package/docs/API-reference/api/{x-components.taggingconfig.clickedresultstoragekey.md → x-components.taggingconfig.storagekey.md} +3 -3
  197. package/docs/API-reference/api/x-components.taggingconfig.storagettlms.md +13 -0
  198. package/docs/API-reference/api/x-components.taggingmutations.md +1 -1
  199. package/docs/API-reference/api/x-components.taggingxevents.md +1 -1
  200. package/docs/API-reference/api/x-components.taggingxevents.resulturltrackingenabled.md +1 -1
  201. package/docs/API-reference/api/x-components.trackrelatedprompttoolingdisplayclickwire.md +13 -0
  202. package/docs/API-reference/api/x-components.tracktoolingadd2cartwire.md +13 -0
  203. package/docs/API-reference/api/x-components.tracktoolingdisplayclickedwire.md +13 -0
  204. package/docs/API-reference/api/x-components.typing.md +13 -0
  205. package/docs/API-reference/api/x-components.typingoptions.md +22 -0
  206. package/docs/API-reference/api/x-components.typingoptions.speed.md +13 -0
  207. package/docs/API-reference/api/x-components.typingoptions.targetattr.md +18 -0
  208. package/docs/API-reference/api/x-components.typingoptions.text.md +13 -0
  209. package/docs/API-reference/api/x-components.urlmutations.md +2 -1
  210. package/docs/API-reference/api/x-components.urlmutations.setprompt.md +24 -0
  211. package/docs/API-reference/api/x-components.urlparams.md +1 -0
  212. package/docs/API-reference/api/x-components.urlparams.prompt.md +11 -0
  213. package/docs/API-reference/api/x-components.urlstate.md +1 -1
  214. package/docs/API-reference/api/x-components.usealiasapi.md +1 -0
  215. package/docs/API-reference/api/x-components.usealiasapi.pricestats.md +16 -0
  216. package/docs/API-reference/api/x-components.xeventstypes.md +3 -3
  217. package/docs/API-reference/api/x-components.xmodulestree.md +1 -0
  218. package/docs/API-reference/api/x-components.xmodulestree.relatedprompts.md +11 -0
  219. package/docs/API-reference/api/x-types.md +2 -0
  220. package/docs/API-reference/api/x-types.relatedprompt.md +4 -1
  221. package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +1 -1
  222. package/docs/API-reference/api/x-types.relatedprompt.relatedpromptnextqueries.md +13 -0
  223. package/docs/API-reference/api/x-types.relatedprompt.tagging.md +17 -0
  224. package/docs/API-reference/api/x-types.relatedprompt.toolingdisplaytagging.md +13 -0
  225. package/docs/API-reference/api/x-types.relatedpromptnextquery.md +23 -0
  226. package/docs/API-reference/api/x-types.relatedpromptnextquery.query.md +13 -0
  227. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayadd2carttagging.md +13 -0
  228. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayclicktagging.md +13 -0
  229. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplaytagging.md +13 -0
  230. package/docs/API-reference/api/x-types.searchresponse.md +1 -0
  231. package/docs/API-reference/api/x-types.searchresponse.stats.md +11 -0
  232. package/docs/API-reference/api/x-types.stats.md +22 -0
  233. package/docs/API-reference/api/x-types.stats.price.md +14 -0
  234. package/docs/API-reference/components/common/result/x-components.base-result-image.md +2 -2
  235. package/docs/API-reference/components/common/x-components.base-slider.md +189 -0
  236. package/docs/API-reference/components/common/x-components.base-teleport.md +19 -0
  237. package/docs/API-reference/components/common/x-components.display-click-provider.md +17 -0
  238. package/docs/API-reference/components/common/x-components.items-list.md +1 -1
  239. package/docs/API-reference/components/common/x-components.page-selector.md +136 -0
  240. package/docs/API-reference/components/common/x-components.sliding-panel.md +7 -7
  241. package/docs/API-reference/components/facets/x-components.facets/facets.md +1 -1
  242. package/docs/API-reference/components/facets/x-components.lists/selected-filters-list.md +1 -1
  243. package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +22 -0
  244. package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +196 -0
  245. package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +32 -0
  246. package/docs/API-reference/components/search/x-components.results-list.md +1 -1
  247. package/docs/API-reference/components/tagging/x-components.tagging.md +15 -16
  248. package/js/components/animations/fade-and-slide.vue.js +1 -2
  249. package/js/components/animations/fade-and-slide.vue.js.map +1 -1
  250. package/js/components/base-dropdown.vue.js +1 -3
  251. package/js/components/base-dropdown.vue.js.map +1 -1
  252. package/js/components/base-dropdown.vue2.js +1 -7
  253. package/js/components/base-dropdown.vue2.js.map +1 -1
  254. package/js/components/base-event-button.vue.js +1 -2
  255. package/js/components/base-event-button.vue.js.map +1 -1
  256. package/js/components/base-grid.vue.js +11 -18
  257. package/js/components/base-grid.vue.js.map +1 -1
  258. package/js/components/base-grid.vue2.js.map +1 -1
  259. package/js/components/base-grid.vue3.js +1 -1
  260. package/js/components/base-keyboard-navigation.vue.js +1 -2
  261. package/js/components/base-keyboard-navigation.vue.js.map +1 -1
  262. package/js/components/base-rating.vue.js +1 -3
  263. package/js/components/base-rating.vue.js.map +1 -1
  264. package/js/components/base-slider.vue.js +65 -0
  265. package/js/components/base-slider.vue.js.map +1 -0
  266. package/js/components/base-slider.vue2.js +109 -0
  267. package/js/components/base-slider.vue2.js.map +1 -0
  268. package/js/components/base-slider.vue3.js +7 -0
  269. package/js/components/base-slider.vue3.js.map +1 -0
  270. package/js/components/base-switch.vue.js.map +1 -1
  271. package/js/components/base-switch.vue2.js +3 -7
  272. package/js/components/base-switch.vue2.js.map +1 -1
  273. package/js/components/base-teleport.vue.js +17 -0
  274. package/js/components/base-teleport.vue.js.map +1 -0
  275. package/js/components/base-teleport.vue2.js +14 -0
  276. package/js/components/base-teleport.vue2.js.map +1 -0
  277. package/js/components/base-teleport.vue3.js +7 -0
  278. package/js/components/base-teleport.vue3.js.map +1 -0
  279. package/js/components/base-variable-column-grid.vue.js +1 -2
  280. package/js/components/base-variable-column-grid.vue.js.map +1 -1
  281. package/js/components/column-picker/base-column-picker-dropdown.vue.js +1 -3
  282. package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
  283. package/js/components/column-picker/base-column-picker-list.vue.js +1 -3
  284. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  285. package/js/components/display-click-provider.vue.js +74 -0
  286. package/js/components/display-click-provider.vue.js.map +1 -0
  287. package/js/components/display-click-provider.vue2.js +6 -0
  288. package/js/components/display-click-provider.vue2.js.map +1 -0
  289. package/js/components/filters/labels/base-rating-filter-label.vue.js +1 -3
  290. package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
  291. package/js/components/icons/cross-tiny.vue.js +2 -2
  292. package/js/components/icons/plus.vue.js +2 -2
  293. package/js/components/items-list.vue.js +1 -2
  294. package/js/components/items-list.vue.js.map +1 -1
  295. package/js/components/items-list.vue2.js +2 -2
  296. package/js/components/items-list.vue2.js.map +1 -1
  297. package/js/components/layouts/fixed-header-and-asides-layout.vue.js +1 -7
  298. package/js/components/layouts/fixed-header-and-asides-layout.vue.js.map +1 -1
  299. package/js/components/layouts/multi-column-max-width-layout.vue.js +1 -9
  300. package/js/components/layouts/multi-column-max-width-layout.vue.js.map +1 -1
  301. package/js/components/layouts/single-column-layout.vue.js +1 -9
  302. package/js/components/layouts/single-column-layout.vue.js.map +1 -1
  303. package/js/components/modals/base-events-modal-close.vue.js +1 -2
  304. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  305. package/js/components/modals/base-events-modal-open.vue.js +1 -2
  306. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  307. package/js/components/modals/base-id-modal-close.vue.js +1 -2
  308. package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
  309. package/js/components/modals/base-id-modal-open.vue.js +1 -2
  310. package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
  311. package/js/components/modals/base-modal.vue.js +1 -2
  312. package/js/components/modals/base-modal.vue.js.map +1 -1
  313. package/js/components/modals/base-modal.vue2.js +13 -6
  314. package/js/components/modals/base-modal.vue2.js.map +1 -1
  315. package/js/components/page-loader-button.vue.js +8 -10
  316. package/js/components/page-loader-button.vue.js.map +1 -1
  317. package/js/components/page-loader-button.vue2.js.map +1 -1
  318. package/js/components/page-loader-button.vue3.js +7 -0
  319. package/js/components/page-loader-button.vue3.js.map +1 -0
  320. package/js/components/page-selector.vue.js +78 -0
  321. package/js/components/page-selector.vue.js.map +1 -0
  322. package/js/components/page-selector.vue2.js +128 -0
  323. package/js/components/page-selector.vue2.js.map +1 -0
  324. package/js/components/page-selector.vue3.js +7 -0
  325. package/js/components/page-selector.vue3.js.map +1 -0
  326. package/js/components/panels/base-header-toggle-panel.vue.js +1 -5
  327. package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
  328. package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -2
  329. package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
  330. package/js/components/panels/base-id-toggle-panel.vue.js +1 -2
  331. package/js/components/panels/base-id-toggle-panel.vue.js.map +1 -1
  332. package/js/components/panels/base-tabs-panel.vue.js +1 -4
  333. package/js/components/panels/base-tabs-panel.vue.js.map +1 -1
  334. package/js/components/panels/base-toggle-panel.vue.js +1 -2
  335. package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
  336. package/js/components/result/base-result-add-to-cart.vue.js +3 -3
  337. package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
  338. package/js/components/result/base-result-add-to-cart.vue2.js +19 -5
  339. package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
  340. package/js/components/result/base-result-current-price.vue.js +1 -2
  341. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  342. package/js/components/result/base-result-image.vue.js +39 -59
  343. package/js/components/result/base-result-image.vue.js.map +1 -1
  344. package/js/components/result/base-result-image.vue2.js +5 -5
  345. package/js/components/result/base-result-image.vue2.js.map +1 -1
  346. package/js/components/result/base-result-link.vue.js +1 -2
  347. package/js/components/result/base-result-link.vue.js.map +1 -1
  348. package/js/components/result/base-result-previous-price.vue.js +1 -2
  349. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  350. package/js/components/result/base-result-rating.vue.js +1 -4
  351. package/js/components/result/base-result-rating.vue.js.map +1 -1
  352. package/js/components/result/result-variant-selector.vue.js +1 -3
  353. package/js/components/result/result-variant-selector.vue.js.map +1 -1
  354. package/js/components/sliding-panel.vue.js +3 -6
  355. package/js/components/sliding-panel.vue.js.map +1 -1
  356. package/js/components/sliding-panel.vue2.js +2 -2
  357. package/js/components/sliding-panel.vue2.js.map +1 -1
  358. package/js/components/suggestions/base-suggestion.vue.js +1 -2
  359. package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
  360. package/js/components/suggestions/base-suggestions.vue.js +1 -2
  361. package/js/components/suggestions/base-suggestions.vue.js.map +1 -1
  362. package/js/composables/use-alias-api.js +4 -1
  363. package/js/composables/use-alias-api.js.map +1 -1
  364. package/js/composables/use-getter.js +1 -1
  365. package/js/composables/use-state.js +1 -1
  366. package/js/directives/typing.js +58 -0
  367. package/js/directives/typing.js.map +1 -0
  368. package/js/index.js +21 -4
  369. package/js/index.js.map +1 -1
  370. package/js/types/animation-prop.js +5 -0
  371. package/js/types/animation-prop.js.map +1 -1
  372. package/js/x-installer/x-installer/x-installer.js +3 -3
  373. package/js/x-installer/x-installer/x-installer.js.map +1 -1
  374. package/js/x-modules/device/store/emitters.js +1 -0
  375. package/js/x-modules/device/store/emitters.js.map +1 -1
  376. package/js/x-modules/empathize/components/empathize.vue.js +1 -2
  377. package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
  378. package/js/x-modules/empathize/components/empathize.vue2.js +10 -3
  379. package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
  380. package/js/x-modules/empathize/store/emitters.js +1 -0
  381. package/js/x-modules/empathize/store/emitters.js.map +1 -1
  382. package/js/x-modules/experience-controls/store/emitters.js +1 -0
  383. package/js/x-modules/experience-controls/store/emitters.js.map +1 -1
  384. package/js/x-modules/extra-params/components/extra-params.vue.js +1 -1
  385. package/js/x-modules/extra-params/components/extra-params.vue.js.map +1 -1
  386. package/js/x-modules/extra-params/store/emitters.js +1 -0
  387. package/js/x-modules/extra-params/store/emitters.js.map +1 -1
  388. package/js/x-modules/facets/components/facets/facets.vue.js +20 -33
  389. package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
  390. package/js/x-modules/facets/components/facets/facets.vue2.js +2 -2
  391. package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
  392. package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -2
  393. package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
  394. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +1 -6
  395. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  396. package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js +1 -3
  397. package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js.map +1 -1
  398. package/js/x-modules/facets/components/filters/number-range-filter.vue.js +1 -3
  399. package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
  400. package/js/x-modules/facets/components/filters/simple-filter.vue.js +1 -3
  401. package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
  402. package/js/x-modules/facets/components/lists/filters-list.vue.js +1 -2
  403. package/js/x-modules/facets/components/lists/filters-list.vue.js.map +1 -1
  404. package/js/x-modules/facets/components/lists/filters-search.vue.js +1 -3
  405. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  406. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js +11 -18
  407. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
  408. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js +2 -2
  409. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
  410. package/js/x-modules/facets/components/lists/sliced-filters.vue.js +1 -4
  411. package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
  412. package/js/x-modules/history-queries/components/clear-history-queries.vue.js +1 -2
  413. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  414. package/js/x-modules/history-queries/components/history-queries.vue.js +1 -10
  415. package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
  416. package/js/x-modules/history-queries/components/history-query.vue.js +1 -6
  417. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  418. package/js/x-modules/history-queries/components/my-history.vue.js +1 -4
  419. package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
  420. package/js/x-modules/history-queries/components/remove-history-query.vue.js +1 -2
  421. package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
  422. package/js/x-modules/history-queries/store/emitters.js +1 -0
  423. package/js/x-modules/history-queries/store/emitters.js.map +1 -1
  424. package/js/x-modules/identifier-results/components/identifier-results.vue.js +1 -2
  425. package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
  426. package/js/x-modules/identifier-results/store/emitters.js +1 -0
  427. package/js/x-modules/identifier-results/store/emitters.js.map +1 -1
  428. package/js/x-modules/next-queries/components/next-queries.vue.js +1 -7
  429. package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
  430. package/js/x-modules/next-queries/components/next-query-preview.vue.js +1 -3
  431. package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -1
  432. package/js/x-modules/next-queries/components/next-query.vue.js +1 -4
  433. package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
  434. package/js/x-modules/next-queries/store/emitters.js +1 -0
  435. package/js/x-modules/next-queries/store/emitters.js.map +1 -1
  436. package/js/x-modules/popular-searches/components/popular-search.vue.js +1 -4
  437. package/js/x-modules/popular-searches/components/popular-search.vue.js.map +1 -1
  438. package/js/x-modules/popular-searches/components/popular-searches.vue.js +1 -7
  439. package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
  440. package/js/x-modules/queries-preview/components/query-preview-button.vue.js +1 -2
  441. package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
  442. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +8 -0
  443. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
  444. package/js/x-modules/queries-preview/components/query-preview-list.vue.js.map +1 -1
  445. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +15 -2
  446. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
  447. package/js/x-modules/queries-preview/components/query-preview.vue.js +1 -2
  448. package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
  449. package/js/x-modules/queries-preview/components/query-preview.vue2.js +9 -1
  450. package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
  451. package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js +2 -1
  452. package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map +1 -1
  453. package/js/x-modules/queries-preview/store/emitters.js +1 -0
  454. package/js/x-modules/queries-preview/store/emitters.js.map +1 -1
  455. package/js/x-modules/queries-preview/store/module.js +1 -1
  456. package/js/x-modules/queries-preview/store/module.js.map +1 -1
  457. package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js +6 -4
  458. package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js.map +1 -1
  459. package/js/x-modules/query-suggestions/components/query-suggestion.vue.js +1 -4
  460. package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
  461. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js +1 -7
  462. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
  463. package/js/x-modules/query-suggestions/store/emitters.js +1 -0
  464. package/js/x-modules/query-suggestions/store/emitters.js.map +1 -1
  465. package/js/x-modules/recommendations/components/recommendations.vue.js +1 -2
  466. package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
  467. package/js/x-modules/recommendations/store/emitters.js +1 -0
  468. package/js/x-modules/recommendations/store/emitters.js.map +1 -1
  469. package/js/x-modules/related-prompts/components/related-prompt.vue.js +27 -0
  470. package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -0
  471. package/js/x-modules/related-prompts/components/related-prompt.vue2.js +31 -0
  472. package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -0
  473. package/js/x-modules/related-prompts/components/related-prompt.vue3.js +7 -0
  474. package/js/x-modules/related-prompts/components/related-prompt.vue3.js.map +1 -0
  475. package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +154 -0
  476. package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -0
  477. package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js +6 -0
  478. package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js.map +1 -0
  479. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +101 -0
  480. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -0
  481. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +221 -0
  482. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -0
  483. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +7 -0
  484. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js.map +1 -0
  485. package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js +29 -0
  486. package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js.map +1 -0
  487. package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js +20 -0
  488. package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js.map +1 -0
  489. package/js/x-modules/related-prompts/store/actions/set-url-params.action.js +15 -0
  490. package/js/x-modules/related-prompts/store/actions/set-url-params.action.js.map +1 -0
  491. package/js/x-modules/related-prompts/store/emitters.js +16 -0
  492. package/js/x-modules/related-prompts/store/emitters.js.map +1 -0
  493. package/js/x-modules/related-prompts/store/getters/related-prompts-query.getter.js +18 -0
  494. package/js/x-modules/related-prompts/store/getters/related-prompts-query.getter.js.map +1 -0
  495. package/js/x-modules/related-prompts/store/getters/request.getter.js +17 -0
  496. package/js/x-modules/related-prompts/store/getters/request.getter.js.map +1 -0
  497. package/js/x-modules/related-prompts/store/module.js +64 -0
  498. package/js/x-modules/related-prompts/store/module.js.map +1 -0
  499. package/js/x-modules/related-prompts/wiring.js +82 -0
  500. package/js/x-modules/related-prompts/wiring.js.map +1 -0
  501. package/js/x-modules/related-prompts/x-module.js +21 -0
  502. package/js/x-modules/related-prompts/x-module.js.map +1 -0
  503. package/js/x-modules/related-tags/components/related-tag.vue.js +1 -2
  504. package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
  505. package/js/x-modules/related-tags/components/related-tags.vue.js +1 -4
  506. package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
  507. package/js/x-modules/related-tags/store/emitters.js +1 -0
  508. package/js/x-modules/related-tags/store/emitters.js.map +1 -1
  509. package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -2
  510. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  511. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +8 -0
  512. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  513. package/js/x-modules/scroll/store/emitters.js +1 -0
  514. package/js/x-modules/scroll/store/emitters.js.map +1 -1
  515. package/js/x-modules/search/components/partial-results-list.vue.js +1 -2
  516. package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
  517. package/js/x-modules/search/components/results-list.vue.js +2 -2
  518. package/js/x-modules/search/components/results-list.vue.js.map +1 -1
  519. package/js/x-modules/search/components/sort-dropdown.vue.js +1 -3
  520. package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
  521. package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js +10 -3
  522. package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js.map +1 -1
  523. package/js/x-modules/search/store/actions/save-search-response.action.js +3 -1
  524. package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -1
  525. package/js/x-modules/search/store/emitters.js +1 -0
  526. package/js/x-modules/search/store/emitters.js.map +1 -1
  527. package/js/x-modules/search/store/module.js +9 -3
  528. package/js/x-modules/search/store/module.js.map +1 -1
  529. package/js/x-modules/search/wiring.js +4 -0
  530. package/js/x-modules/search/wiring.js.map +1 -1
  531. package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -2
  532. package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
  533. package/js/x-modules/search-box/components/search-button.vue.js +1 -2
  534. package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
  535. package/js/x-modules/search-box/store/emitters.js +1 -0
  536. package/js/x-modules/search-box/store/emitters.js.map +1 -1
  537. package/js/x-modules/semantic-queries/components/semantic-queries.vue.js +1 -3
  538. package/js/x-modules/semantic-queries/components/semantic-queries.vue.js.map +1 -1
  539. package/js/x-modules/semantic-queries/components/semantic-query.vue.js +1 -4
  540. package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
  541. package/js/x-modules/semantic-queries/store/getters/normalized-query.getter.js +1 -1
  542. package/js/x-modules/semantic-queries/store/getters/normalized-query.getter.js.map +1 -1
  543. package/js/x-modules/semantic-queries/store/getters/request.getter.js +5 -4
  544. package/js/x-modules/semantic-queries/store/getters/request.getter.js.map +1 -1
  545. package/js/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.js +18 -0
  546. package/js/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.js.map +1 -0
  547. package/js/x-modules/semantic-queries/store/module.js +8 -2
  548. package/js/x-modules/semantic-queries/store/module.js.map +1 -1
  549. package/js/x-modules/semantic-queries/wiring.js +5 -0
  550. package/js/x-modules/semantic-queries/wiring.js.map +1 -1
  551. package/js/x-modules/tagging/components/tagging.vue.js +8 -7
  552. package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
  553. package/js/x-modules/tagging/service/{pdp-add-to-cart.service.js → external-tagging.service.js} +56 -25
  554. package/js/x-modules/tagging/service/external-tagging.service.js.map +1 -0
  555. package/js/x-modules/tagging/store/emitters.js +1 -1
  556. package/js/x-modules/tagging/store/emitters.js.map +1 -1
  557. package/js/x-modules/tagging/store/module.js +7 -3
  558. package/js/x-modules/tagging/store/module.js.map +1 -1
  559. package/js/x-modules/tagging/wiring.js +110 -9
  560. package/js/x-modules/tagging/wiring.js.map +1 -1
  561. package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
  562. package/js/x-modules/url/components/url-handler.vue2.js +4 -5
  563. package/js/x-modules/url/components/url-handler.vue2.js.map +1 -1
  564. package/js/x-modules/url/store/emitters.js +1 -0
  565. package/js/x-modules/url/store/emitters.js.map +1 -1
  566. package/js/x-modules/url/store/getters/url-params.getter.js +2 -3
  567. package/js/x-modules/url/store/getters/url-params.getter.js.map +1 -1
  568. package/js/x-modules/url/store/initial-state.js +2 -1
  569. package/js/x-modules/url/store/initial-state.js.map +1 -1
  570. package/js/x-modules/url/store/module.js +3 -0
  571. package/js/x-modules/url/store/module.js.map +1 -1
  572. package/js/x-modules/url/wiring.js +10 -1
  573. package/js/x-modules/url/wiring.js.map +1 -1
  574. package/package.json +50 -49
  575. package/related-prompts/index.d.ts +1 -0
  576. package/related-prompts/index.js +9 -0
  577. package/report/x-adapter-platform.api.json +895 -67
  578. package/report/x-components.api.json +16491 -17162
  579. package/report/x-components.api.md +847 -215
  580. package/report/x-types.api.json +320 -4
  581. package/tagging/index.js +2 -2
  582. package/types/adapter/mocked-responses.d.ts +3 -0
  583. package/types/adapter/mocked-responses.d.ts.map +1 -1
  584. package/types/components/base-dropdown.vue.d.ts +5 -5
  585. package/types/components/base-dropdown.vue.d.ts.map +1 -1
  586. package/types/components/base-grid.vue.d.ts +3 -3
  587. package/types/components/base-slider.vue.d.ts +74 -0
  588. package/types/components/base-slider.vue.d.ts.map +1 -0
  589. package/types/components/base-switch.vue.d.ts +2 -1
  590. package/types/components/base-switch.vue.d.ts.map +1 -1
  591. package/types/components/base-teleport.vue.d.ts +13 -0
  592. package/types/components/base-teleport.vue.d.ts.map +1 -0
  593. package/types/components/base-variable-column-grid.vue.d.ts +3 -3
  594. package/types/components/display-click-provider.vue.d.ts +61 -0
  595. package/types/components/display-click-provider.vue.d.ts.map +1 -0
  596. package/types/components/global-x-bus.vue.d.ts +14 -0
  597. package/types/components/global-x-bus.vue.d.ts.map +1 -1
  598. package/types/components/index.d.ts +4 -0
  599. package/types/components/index.d.ts.map +1 -1
  600. package/types/components/items-list.vue.d.ts +3 -3
  601. package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +5 -5
  602. package/types/components/layouts/single-column-layout.vue.d.ts +3 -3
  603. package/types/components/modals/base-events-modal.vue.d.ts +2 -2
  604. package/types/components/modals/base-id-modal.vue.d.ts +2 -2
  605. package/types/components/modals/base-modal.vue.d.ts +10 -10
  606. package/types/components/modals/base-modal.vue.d.ts.map +1 -1
  607. package/types/components/modals/main-modal.vue.d.ts +2 -2
  608. package/types/components/page-selector.vue.d.ts +125 -0
  609. package/types/components/page-selector.vue.d.ts.map +1 -0
  610. package/types/components/panels/base-header-toggle-panel.vue.d.ts +5 -5
  611. package/types/components/panels/base-id-toggle-panel.vue.d.ts +5 -5
  612. package/types/components/panels/base-tabs-panel.vue.d.ts +8 -8
  613. package/types/components/panels/base-toggle-panel.vue.d.ts +3 -3
  614. package/types/components/result/base-result-add-to-cart.vue.d.ts +2 -0
  615. package/types/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
  616. package/types/components/result/base-result-image.vue.d.ts +10 -10
  617. package/types/components/result/base-result-image.vue.d.ts.map +1 -1
  618. package/types/components/sliding-panel.vue.d.ts +15 -5
  619. package/types/components/sliding-panel.vue.d.ts.map +1 -1
  620. package/types/components/snippet-callbacks.vue.d.ts +7 -0
  621. package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
  622. package/types/components/suggestions/base-suggestions.vue.d.ts +3 -3
  623. package/types/composables/use-alias-api.d.ts +5 -0
  624. package/types/composables/use-alias-api.d.ts.map +1 -1
  625. package/types/composables/use-store.d.ts +2 -2
  626. package/types/composables/use-store.d.ts.map +1 -1
  627. package/types/directives/index.d.ts +1 -0
  628. package/types/directives/index.d.ts.map +1 -1
  629. package/types/directives/typing.d.ts +35 -0
  630. package/types/directives/typing.d.ts.map +1 -0
  631. package/types/index.d.ts +1 -0
  632. package/types/index.d.ts.map +1 -1
  633. package/types/store/index.d.ts +4 -1
  634. package/types/store/index.d.ts.map +1 -1
  635. package/types/tailwind/plugin-options.d.ts +1 -2
  636. package/types/tailwind/plugin-options.d.ts.map +1 -1
  637. package/types/types/animation-prop.d.ts +6 -2
  638. package/types/types/animation-prop.d.ts.map +1 -1
  639. package/types/types/origin.d.ts +3 -3
  640. package/types/types/origin.d.ts.map +1 -1
  641. package/types/types/page-mode.d.ts +2 -0
  642. package/types/types/page-mode.d.ts.map +1 -0
  643. package/types/types/url-params.d.ts +1 -0
  644. package/types/types/url-params.d.ts.map +1 -1
  645. package/types/views/home/types.d.ts +3 -0
  646. package/types/views/home/types.d.ts.map +1 -1
  647. package/types/wiring/events.types.d.ts +3 -1
  648. package/types/wiring/events.types.d.ts.map +1 -1
  649. package/types/x-installer/x-installer/types.d.ts +2 -2
  650. package/types/x-installer/x-installer/types.d.ts.map +1 -1
  651. package/types/x-installer/x-installer/x-installer.d.ts +4 -4
  652. package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
  653. package/types/x-modules/empathize/components/empathize.vue.d.ts +6 -6
  654. package/types/x-modules/empathize/components/empathize.vue.d.ts.map +1 -1
  655. package/types/x-modules/facets/components/facets/facets.vue.d.ts +3 -3
  656. package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +9 -2
  657. package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
  658. package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +7 -0
  659. package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
  660. package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +3 -3
  661. package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +3 -3
  662. package/types/x-modules/history-queries/components/my-history.vue.d.ts +3 -3
  663. package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +3 -3
  664. package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +3 -3
  665. package/types/x-modules/next-queries/index.d.ts +1 -0
  666. package/types/x-modules/next-queries/index.d.ts.map +1 -1
  667. package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +3 -3
  668. package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts.map +1 -1
  669. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -1
  670. package/types/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.d.ts.map +1 -1
  671. package/types/x-modules/queries-preview/store/module.d.ts.map +1 -1
  672. package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts +4 -2
  673. package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts.map +1 -1
  674. package/types/x-modules/recommendations/components/recommendations.vue.d.ts +3 -3
  675. package/types/x-modules/related-prompts/components/index.d.ts +4 -0
  676. package/types/x-modules/related-prompts/components/index.d.ts.map +1 -0
  677. package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +28 -0
  678. package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -0
  679. package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +106 -0
  680. package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -0
  681. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +131 -0
  682. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -0
  683. package/types/x-modules/related-prompts/events.types.d.ts +41 -0
  684. package/types/x-modules/related-prompts/events.types.d.ts.map +1 -0
  685. package/types/x-modules/related-prompts/index.d.ts +6 -0
  686. package/types/x-modules/related-prompts/index.d.ts.map +1 -0
  687. package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts +17 -0
  688. package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts.map +1 -0
  689. package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts +13 -0
  690. package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts.map +1 -0
  691. package/types/x-modules/related-prompts/store/actions/set-url-params.action.d.ts +11 -0
  692. package/types/x-modules/related-prompts/store/actions/set-url-params.action.d.ts.map +1 -0
  693. package/types/x-modules/related-prompts/store/emitters.d.ts +10 -0
  694. package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -0
  695. package/types/x-modules/related-prompts/store/getters/index.d.ts +3 -0
  696. package/types/x-modules/related-prompts/store/getters/index.d.ts.map +1 -0
  697. package/types/x-modules/related-prompts/store/getters/related-prompts-query.getter.d.ts +13 -0
  698. package/types/x-modules/related-prompts/store/getters/related-prompts-query.getter.d.ts.map +1 -0
  699. package/types/x-modules/related-prompts/store/getters/request.getter.d.ts +14 -0
  700. package/types/x-modules/related-prompts/store/getters/request.getter.d.ts.map +1 -0
  701. package/types/x-modules/related-prompts/store/index.d.ts +6 -0
  702. package/types/x-modules/related-prompts/store/index.d.ts.map +1 -0
  703. package/types/x-modules/related-prompts/store/module.d.ts +8 -0
  704. package/types/x-modules/related-prompts/store/module.d.ts.map +1 -0
  705. package/types/x-modules/related-prompts/store/types.d.ts +125 -0
  706. package/types/x-modules/related-prompts/store/types.d.ts.map +1 -0
  707. package/types/x-modules/related-prompts/types.d.ts +10 -0
  708. package/types/x-modules/related-prompts/types.d.ts.map +1 -0
  709. package/types/x-modules/related-prompts/wiring.d.ts +42 -0
  710. package/types/x-modules/related-prompts/wiring.d.ts.map +1 -0
  711. package/types/x-modules/related-prompts/x-module.d.ts +16 -0
  712. package/types/x-modules/related-prompts/x-module.d.ts.map +1 -0
  713. package/types/x-modules/related-tags/components/related-tags.vue.d.ts +3 -3
  714. package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +5 -5
  715. package/types/x-modules/search/components/banners-list.vue.d.ts +3 -3
  716. package/types/x-modules/search/components/partial-results-list.vue.d.ts +3 -3
  717. package/types/x-modules/search/components/promoteds-list.vue.d.ts +3 -3
  718. package/types/x-modules/search/components/results-list.vue.d.ts +3 -3
  719. package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
  720. package/types/x-modules/search/config.types.d.ts +2 -0
  721. package/types/x-modules/search/config.types.d.ts.map +1 -1
  722. package/types/x-modules/search/events.types.d.ts +4 -0
  723. package/types/x-modules/search/events.types.d.ts.map +1 -1
  724. package/types/x-modules/search/store/actions/fetch-and-save-search-response.action.d.ts.map +1 -1
  725. package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -1
  726. package/types/x-modules/search/store/module.d.ts +2 -0
  727. package/types/x-modules/search/store/module.d.ts.map +1 -1
  728. package/types/x-modules/search/store/types.d.ts +9 -1
  729. package/types/x-modules/search/store/types.d.ts.map +1 -1
  730. package/types/x-modules/search/wiring.d.ts +4 -0
  731. package/types/x-modules/search/wiring.d.ts.map +1 -1
  732. package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +3 -3
  733. package/types/x-modules/semantic-queries/store/getters/index.d.ts +1 -0
  734. package/types/x-modules/semantic-queries/store/getters/index.d.ts.map +1 -1
  735. package/types/x-modules/semantic-queries/store/getters/normalized-query.getter.d.ts +1 -1
  736. package/types/x-modules/semantic-queries/store/getters/request.getter.d.ts +2 -1
  737. package/types/x-modules/semantic-queries/store/getters/request.getter.d.ts.map +1 -1
  738. package/types/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.d.ts +13 -0
  739. package/types/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.d.ts.map +1 -0
  740. package/types/x-modules/semantic-queries/store/module.d.ts.map +1 -1
  741. package/types/x-modules/semantic-queries/store/types.d.ts +13 -1
  742. package/types/x-modules/semantic-queries/store/types.d.ts.map +1 -1
  743. package/types/x-modules/semantic-queries/wiring.d.ts +3 -0
  744. package/types/x-modules/semantic-queries/wiring.d.ts.map +1 -1
  745. package/types/x-modules/tagging/components/tagging.vue.d.ts +14 -12
  746. package/types/x-modules/tagging/components/tagging.vue.d.ts.map +1 -1
  747. package/types/x-modules/tagging/config.types.d.ts +3 -3
  748. package/types/x-modules/tagging/config.types.d.ts.map +1 -1
  749. package/types/x-modules/tagging/events.types.d.ts +2 -2
  750. package/types/x-modules/tagging/service/{pdp-add-to-cart.service.d.ts → external-tagging.service.d.ts} +31 -13
  751. package/types/x-modules/tagging/service/external-tagging.service.d.ts.map +1 -0
  752. package/types/x-modules/tagging/service/index.d.ts +1 -1
  753. package/types/x-modules/tagging/service/index.d.ts.map +1 -1
  754. package/types/x-modules/tagging/service/types.d.ts +13 -4
  755. package/types/x-modules/tagging/service/types.d.ts.map +1 -1
  756. package/types/x-modules/tagging/store/module.d.ts.map +1 -1
  757. package/types/x-modules/tagging/wiring.d.ts +54 -2
  758. package/types/x-modules/tagging/wiring.d.ts.map +1 -1
  759. package/types/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
  760. package/types/x-modules/url/store/getters/url-params.getter.d.ts +2 -3
  761. package/types/x-modules/url/store/getters/url-params.getter.d.ts.map +1 -1
  762. package/types/x-modules/url/store/initial-state.d.ts.map +1 -1
  763. package/types/x-modules/url/store/module.d.ts.map +1 -1
  764. package/types/x-modules/url/store/types.d.ts +6 -0
  765. package/types/x-modules/url/store/types.d.ts.map +1 -1
  766. package/types/x-modules/url/wiring.d.ts +9 -0
  767. package/types/x-modules/url/wiring.d.ts.map +1 -1
  768. package/types/x-modules/x-modules.types.d.ts +2 -0
  769. package/types/x-modules/x-modules.types.d.ts.map +1 -1
  770. package/url/index.js +1 -1
  771. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.clickedresultstoragekey.md +0 -11
  772. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.clickedresultstoragettlms.md +0 -11
  773. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.instance.md +0 -13
  774. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.localstorageservice.md +0 -11
  775. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.md +0 -41
  776. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.result_clicked_id_key.md +0 -13
  777. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.sessionstorageservice.md +0 -11
  778. package/docs/API-reference/api/x-components.pdpaddtocartservice.md +0 -22
  779. package/docs/API-reference/api/x-components.taggingconfig.clickedresultstoragettlms.md +0 -13
  780. package/docs/API-reference/api/x-components.usestore.md +0 -19
  781. package/docs/assets/features/overview-my-history.svg +0 -279
  782. package/docs/assets/features/overview-product-results-card.svg +0 -128
  783. package/docs/assets/interface/build-search-ui.svg +0 -167
  784. package/docs/assets/interface/experience-search-intro.svg +0 -1
  785. package/docs/assets/interface/integration-guide.svg +0 -1
  786. package/docs/assets/interface/integration-video.png +0 -0
  787. package/docs/assets/interface/x-architecture.svg +0 -1
  788. package/docs/assets/interface/x-empathize.gif +0 -0
  789. package/docs/assets/interface/x-facets.gif +0 -0
  790. package/docs/assets/interface/x-facets.svg +0 -189
  791. package/docs/assets/interface/x-history-queries.gif +0 -0
  792. package/docs/assets/interface/x-id-results.gif +0 -0
  793. package/docs/assets/interface/x-next-queries.gif +0 -0
  794. package/docs/assets/interface/x-popular-searches.gif +0 -0
  795. package/docs/assets/interface/x-query-suggestions.gif +0 -0
  796. package/docs/assets/interface/x-recommendations.gif +0 -0
  797. package/docs/assets/interface/x-recommendations.svg +0 -472
  798. package/docs/assets/interface/x-related-tags.gif +0 -0
  799. package/docs/assets/interface/x-results-layout.svg +0 -259
  800. package/docs/assets/interface/x-search-box-elements.svg +0 -1
  801. package/docs/assets/interface/x-search-box.svg +0 -60
  802. package/docs/build-search-ui/README.md +0 -127
  803. package/docs/build-search-ui/sidebar.js +0 -7
  804. package/docs/build-search-ui/web-archetype-development-guide.md +0 -186
  805. package/docs/build-search-ui/web-archetype-integration-guide.md +0 -458
  806. package/docs/build-search-ui/web-how-to-use-x-components-guide.md +0 -200
  807. package/docs/build-search-ui/web-x-architecture.md +0 -83
  808. package/docs/build-search-ui/web-x-components-development-guide.md +0 -157
  809. package/docs/experience-search-and-discovery/README.md +0 -132
  810. package/docs/experience-search-and-discovery/empathize.md +0 -119
  811. package/docs/experience-search-and-discovery/facets-and-filters.md +0 -154
  812. package/docs/experience-search-and-discovery/history-queries.md +0 -70
  813. package/docs/experience-search-and-discovery/id-results.md +0 -49
  814. package/docs/experience-search-and-discovery/my-history.md +0 -60
  815. package/docs/experience-search-and-discovery/next-queries.md +0 -72
  816. package/docs/experience-search-and-discovery/popular-searches.md +0 -50
  817. package/docs/experience-search-and-discovery/product-results-ui.md +0 -82
  818. package/docs/experience-search-and-discovery/query-suggestions.md +0 -48
  819. package/docs/experience-search-and-discovery/recommendations.md +0 -134
  820. package/docs/experience-search-and-discovery/related-tags.md +0 -66
  821. package/docs/experience-search-and-discovery/search-box.md +0 -99
  822. package/docs/experience-search-and-discovery/serp-ui.md +0 -125
  823. package/docs/experience-search-and-discovery/sidebar.js +0 -17
  824. package/docs/experience-search-and-discovery/web-local-storage.md +0 -30
  825. package/docs/input-status-machine-state.png +0 -0
  826. package/js/composables/use-store.js +0 -15
  827. package/js/composables/use-store.js.map +0 -1
  828. package/js/utils/options-api.js +0 -4
  829. package/js/utils/options-api.js.map +0 -1
  830. package/js/x-modules/tagging/service/pdp-add-to-cart.service.js.map +0 -1
  831. package/types/utils/options-api.d.ts +0 -3
  832. package/types/utils/options-api.d.ts.map +0 -1
  833. package/types/x-modules/tagging/service/pdp-add-to-cart.service.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button ref=\"el\" @click=\"emitEvents\" :class=\"dynamicCSSClasses\">\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {String} query - The query that the suggestion belongs to\n @binding {Filter} filter - Suggestion's filter\n -->\n <slot v-bind=\"{ query, suggestion, filter }\">\n <Highlight class=\"x-suggestion__query\" :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\" class=\"x-suggestion__filter\">{{ filter.label }}</span>\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { BooleanFilter, Suggestion } from '@empathyco/x-types';\n import { forEach } from '@empathyco/x-utils';\n import { computed, defineComponent, PropType, ref } from 'vue';\n import { QueryFeature } from '../../types';\n import { VueCSSClasses } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n import Highlight from '../highlight.vue';\n import { use$x } from '../../composables/index';\n\n /**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n export default defineComponent({\n components: { Highlight },\n props: {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n query: {\n type: String,\n default: ''\n },\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true\n },\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n //TODO: set to true when the suggestions components pass it.\n feature: {\n type: String as PropType<QueryFeature>\n },\n\n /**\n * The {@link XEvent} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n suggestionSelectedEvents: {\n type: Object as PropType<Partial<XEventsTypes>>,\n required: true\n },\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean\n }\n },\n\n setup(props) {\n const el = ref<HTMLElement | null>(null);\n\n const $x = use$x();\n\n /**\n * Returns the suggestion filter object.\n * It is a BooleanFilter because the label is needed.\n * It returns only the first element because the facets and filters are being planned\n * in the BaseSuggestions component.\n *\n * @returns The filter.\n * @public\n */\n const filter = computed<BooleanFilter | undefined>(\n () => props.suggestion.facets?.[0]?.filters[0] as BooleanFilter\n );\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * UserAcceptedAQuery: suggestion.query\n * UserSelectedASuggestion: suggestion\n * UserClickedAFilter: suggestion.facets[0].filters[0]\n * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => {\n const filterEvent: Partial<XEventsTypes> = filter.value\n ? { UserClickedAFilter: filter.value }\n : {};\n return {\n UserAcceptedAQuery: props.suggestion.query,\n UserSelectedASuggestion: props.suggestion,\n ...props.suggestionSelectedEvents,\n ...filterEvent\n };\n });\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n const emitEvents = (): void => {\n forEach(events.value, (event, payload): void => {\n $x.emit(event, payload, {\n target: el.value!,\n feature: props.feature\n });\n });\n };\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed<boolean>(\n () => props.highlightCurated && !!props.suggestion.isCurated\n );\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n const dynamicCSSClasses = computed<VueCSSClasses>(() => ({\n 'x-suggestion--is-curated': shouldHighlightCurated.value\n }));\n\n return {\n el,\n filter,\n emitEvents,\n dynamicCSSClasses\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserAcceptedAQuery`](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 button. The event payload is the suggestion query\n data.\n- [`UserSelectedASuggestion`](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 button. The event payload is the suggestion data.\n- [`UserClickedAFilter`](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 button if the suggestion includes a filter. The\n event payload is the suggestion filter.\n- The component can emit more events on click using the `suggestionSelectedEvents` prop.\n\n## See it in action\n\nThis suggestion component expects a suggestion to render and pass to its default slot, a normalized\nquery to compare with the suggestion's query and highlight its matching parts, and events to emit\nwhen the suggestion is selected.\n\nIf the suggestion contains a filter, it is displayed next to the suggestion.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" />\n</template>\n<script>\n import { BaseSuggestion } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak',\n facet: {\n namedModel: 'SimpleFacet',\n id: 'category',\n label: 'Category',\n filters: [\n {\n id: 'category:groceries',\n modelName: 'SimpleFilter',\n facetId: 'category-facet',\n label: 'Groceries',\n selected: false,\n totalResults: 10\n }\n ]\n }\n }\n };\n }\n };\n</script>\n```\n\n### Customise the content\n\nYou can make this component render any content you want by using the `default` slot.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" #default=\"{ suggestion, query, filter }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\">{{ filter.label }}</span>\n </BaseSuggestion>\n</template>\n<script>\n import { BaseSuggestion } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak'\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_normalizeClass","_createCommentVNode","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode","suggestion","filter"],"mappings":";;;;MAU0B,UAAM,GAAA;AAAA,EAAA,GAAA,EAAA,CAAA;;;;+BAT9BA,gBAWS,CAAA,WAAA,CAAA,CAAA;SAXSC,SAAK,EAAA,EAAAC,kBAAA;AAAA,IAAA,QAAA;AAAA,IAAE;AAAA,MAAa,GAAK,EAAA,IAAA;AAAA,MAAA,OAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AACzC,MAAA,KAAA,EAAAC,cAAA,CAAA,IAAA,CAAA,iBAAA,CAAA;AAAA,KAAA;AAMA,IAAA;AAAA,MACuFC,kBAAA,CAAA,4OAAA,CAAA;AAAA,MAAAC,UAAA,CAApE,IAAqB,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,KAAA,EAAA,IAAA,CAAA,KAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,EAAA,MAAA,EAAA,IAAA,CAAA,MAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAAQC,oBAAgB,EAAA;AAAA,UAAG,KAAA,EAAA,qBAAA;AAAA,UAAA,IAAA,EAAA,IAAA,CAAA,UAAA,CAAA,KAAA;UACrDC,SAAM,EAAA,IAAA,CAAA,KAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAlB,CAA0E,MAAA,EAAA,WAAA,CAAA,CAAA;AAAA,QAVhF,IAAA,CAAA,MAAA,IAAAT,SAAA,EAAA,EAAAC,kBAAA;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button ref=\"el\" @click=\"emitEvents\" :class=\"dynamicCSSClasses\">\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {String} query - The query that the suggestion belongs to\n @binding {Filter} filter - Suggestion's filter\n -->\n <slot v-bind=\"{ query, suggestion, filter }\">\n <Highlight class=\"x-suggestion__query\" :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\" class=\"x-suggestion__filter\">{{ filter.label }}</span>\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { BooleanFilter, Suggestion } from '@empathyco/x-types';\n import { forEach } from '@empathyco/x-utils';\n import { computed, defineComponent, PropType, ref } from 'vue';\n import { QueryFeature } from '../../types';\n import { VueCSSClasses } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n import Highlight from '../highlight.vue';\n import { use$x } from '../../composables/index';\n\n /**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n export default defineComponent({\n components: { Highlight },\n props: {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n query: {\n type: String,\n default: ''\n },\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true\n },\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n //TODO: set to true when the suggestions components pass it.\n feature: {\n type: String as PropType<QueryFeature>\n },\n\n /**\n * The {@link XEvent} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n suggestionSelectedEvents: {\n type: Object as PropType<Partial<XEventsTypes>>,\n required: true\n },\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean\n }\n },\n\n setup(props) {\n const el = ref<HTMLElement | null>(null);\n\n const $x = use$x();\n\n /**\n * Returns the suggestion filter object.\n * It is a BooleanFilter because the label is needed.\n * It returns only the first element because the facets and filters are being planned\n * in the BaseSuggestions component.\n *\n * @returns The filter.\n * @public\n */\n const filter = computed<BooleanFilter | undefined>(\n () => props.suggestion.facets?.[0]?.filters[0] as BooleanFilter\n );\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * UserAcceptedAQuery: suggestion.query\n * UserSelectedASuggestion: suggestion\n * UserClickedAFilter: suggestion.facets[0].filters[0]\n * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => {\n const filterEvent: Partial<XEventsTypes> = filter.value\n ? { UserClickedAFilter: filter.value }\n : {};\n return {\n UserAcceptedAQuery: props.suggestion.query,\n UserSelectedASuggestion: props.suggestion,\n ...props.suggestionSelectedEvents,\n ...filterEvent\n };\n });\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n const emitEvents = (): void => {\n forEach(events.value, (event, payload): void => {\n $x.emit(event, payload, {\n target: el.value!,\n feature: props.feature\n });\n });\n };\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed<boolean>(\n () => props.highlightCurated && !!props.suggestion.isCurated\n );\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n const dynamicCSSClasses = computed<VueCSSClasses>(() => ({\n 'x-suggestion--is-curated': shouldHighlightCurated.value\n }));\n\n return {\n el,\n filter,\n emitEvents,\n dynamicCSSClasses\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserAcceptedAQuery`](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 button. The event payload is the suggestion query\n data.\n- [`UserSelectedASuggestion`](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 button. The event payload is the suggestion data.\n- [`UserClickedAFilter`](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 button if the suggestion includes a filter. The\n event payload is the suggestion filter.\n- The component can emit more events on click using the `suggestionSelectedEvents` prop.\n\n## See it in action\n\nThis suggestion component expects a suggestion to render and pass to its default slot, a normalized\nquery to compare with the suggestion's query and highlight its matching parts, and events to emit\nwhen the suggestion is selected.\n\nIf the suggestion contains a filter, it is displayed next to the suggestion.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" />\n</template>\n<script>\n import { BaseSuggestion } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak',\n facet: {\n namedModel: 'SimpleFacet',\n id: 'category',\n label: 'Category',\n filters: [\n {\n id: 'category:groceries',\n modelName: 'SimpleFilter',\n facetId: 'category-facet',\n label: 'Groceries',\n selected: false,\n totalResults: 10\n }\n ]\n }\n }\n };\n }\n };\n</script>\n```\n\n### Customise the content\n\nYou can make this component render any content you want by using the `default` slot.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" #default=\"{ suggestion, query, filter }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\">{{ filter.label }}</span>\n </BaseSuggestion>\n</template>\n<script>\n import { BaseSuggestion } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak'\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_normalizeClass","_normalizeProps","_guardReactiveProps","_createVNode","suggestion","filter"],"mappings":";;;;MAU0B,UAAM,GAAA;AAAA,EAAA,GAAA,EAAA,CAAA;;;;+BAT9BA,gBAWS,CAAA,WAAA,CAAA,CAAA;SAXSC,SAAK,EAAA,EAAAC,kBAAA;AAAA,IAAA,QAAA;AAAA,IAAE;AAAA,MAAa,GAAK,EAAA,IAAA;AAAA,MAAA,OAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAOzC,MAAA,KAAA,EAAAC,cAAA,CAGO,IAXX,CAAA,iBAAA,CAAA;AAAA,KAAA;;iBASuB,IAAqB,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,KAAA,EAAA,IAAA,CAAA,KAAA,EAAA,UAAA,EAAA,IAAA,CAAA,UAAA,EAAA,MAAA,EAAA,IAAA,CAAA,MAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAAQC,oBAAgB,EAAA;AAAA,UAAG,KAAA,EAAA,qBAAA;AAAA,UAAA,IAAA,EAAA,IAAA,CAAA,UAAA,CAAA,KAAA;UACrDC,SAAM,EAAA,IAAA,CAAA,KAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAlB,CAA0E,MAAA,EAAA,WAAA,CAAA,CAAA;AAAA,QAVhF,IAAA,CAAA,MAAA,IAAAP,SAAA,EAAA,EAAAC,kBAAA;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from './base-suggestions.vue2.js';
2
- import { openBlock, createBlock, resolveDynamicComponent, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createCommentVNode, renderSlot, mergeProps } from 'vue';
2
+ import { openBlock, createBlock, resolveDynamicComponent, withCtx, createElementBlock, Fragment, renderList, normalizeClass, renderSlot, mergeProps, createCommentVNode } from 'vue';
3
3
  import './base-suggestions.vue3.js';
4
4
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
5
5
 
@@ -22,7 +22,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
22
22
  "data-test": "suggestion-item"
23
23
  },
24
24
  [
25
- createCommentVNode("\n @slot (Required) List item content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {number} index - Suggestion index\n @binding {Filter | undefined} filter - Suggestion's filter\n "),
26
25
  renderSlot(_ctx.$slots, "default", mergeProps({ ref_for: true }, { suggestion, index, filter: _ctx.getSuggestionFilter(suggestion) }), void 0, true)
27
26
  ],
28
27
  2
@@ -1 +1 @@
1
- {"version":3,"file":"base-suggestions.vue.js","sources":["../../../../src/components/suggestions/base-suggestions.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" v-if=\"suggestions.length\" tag=\"ul\" class=\"x-suggestions\">\n <li\n v-for=\"(suggestion, index) in suggestionsToRender\"\n :key=\"suggestionsKeys[index]\"\n class=\"x-suggestions__item\"\n :class=\"suggestionItemClass\"\n data-test=\"suggestion-item\"\n >\n <!--\n @slot (Required) List item content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {number} index - Suggestion index\n @binding {Filter | undefined} filter - Suggestion's filter\n -->\n <slot v-bind=\"{ suggestion, index, filter: getSuggestionFilter(suggestion) }\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { Suggestion, Facet } from '@empathyco/x-types';\n import { isArrayEmpty } from '../../utils/array';\n import { AnimationProp } from '../../types';\n\n /**\n * Paints a list of suggestions passed in by prop. Requires a component for a single suggestion\n * in the default slot for working.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseSuggestions',\n props: {\n /**\n * The list of suggestions to render.\n *\n * @public\n */\n suggestions: {\n type: Array as PropType<Suggestion[]>,\n required: true\n },\n /**\n * Animation component that will be used to animate the suggestion.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /**\n * Number of suggestions to be rendered.\n *\n * @public\n */\n maxItemsToRender: Number,\n /**\n * Boolean value to indicate if the facets should be rendered.\n *\n * @public\n */\n showFacets: {\n type: Boolean,\n default: false\n },\n /**\n * When `showFacets` property of `BaseSuggestions` component is true, it indicates if the suggestion without\n * filter should be rendered.\n *\n * @public\n */\n showPlainSuggestion: {\n type: Boolean,\n default: false\n },\n /** Class inherited by content element. */\n suggestionItemClass: String\n },\n setup: function (props) {\n /**\n * Creates a suggestion for each one of the filter inside each facet.\n *\n * @param suggestion - Suggestion to expand.\n * @returns A list of suggestions, each one with a single filter.\n *\n * @internal\n */\n const expandSuggestionFilters = (suggestion: Suggestion): Suggestion[] => {\n return (\n suggestion.facets?.flatMap(facet =>\n facet.filters.map(filter => ({\n ...suggestion,\n facets: [{ ...facet, filters: [filter] }]\n }))\n ) ?? []\n );\n };\n\n /**\n * Creates a list of suggestions to render based on the configuration of this component.\n *\n * @returns - The list of suggestions to be rendered by this component.\n *\n * @internal\n */\n const suggestionsToRender = computed(() =>\n props.suggestions\n .flatMap(suggestion =>\n props.showFacets && suggestion.facets?.length\n ? props.showPlainSuggestion\n ? [{ ...suggestion, facets: [] }, ...expandSuggestionFilters(suggestion)]\n : expandSuggestionFilters(suggestion)\n : { ...suggestion, facets: [] }\n )\n .slice(0, props.maxItemsToRender)\n );\n\n /**\n * Generates a string from the given facet.\n *\n * @param facet - The facet to reduce to a string.\n * @returns - A string representing the facet.\n * @internal\n */\n const getFacetKey = (facet: Facet) => facet.filters.map(filter => filter.id).join('&');\n\n /**\n * Generates a string from the given facets.\n *\n * @param facets - The list of facets to reduce to a string.\n * @returns - A string representing the list of facets.\n * @internal\n */\n const getFacetsKey = (facets: Facet[]) => facets.map(getFacetKey).join('&');\n\n /**\n * An array with the unique keys for each suggestion. Required by the `v-for` loop.\n *\n * @returns An array with the unique keys of the suggestions.\n * @internal\n */\n const suggestionsKeys = computed(() =>\n suggestionsToRender.value.map(suggestion =>\n isArrayEmpty(suggestion.facets)\n ? suggestion.query\n : `${suggestion.query}-in-${getFacetsKey(suggestion.facets)}`\n )\n );\n\n /**\n * Returns the filter contained by the suggestion.\n *\n * @param suggestion - Suggestion containing the filter.\n * @returns The suggestion filter.\n * @internal\n */\n const getSuggestionFilter = (suggestion: Suggestion) => suggestion.facets?.[0]?.filters[0];\n\n return { suggestionsToRender, suggestionsKeys, getSuggestionFilter };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-suggestions {\n list-style-type: none;\n }\n\n .x-suggestions,\n .x-suggestions__item {\n display: flex;\n flex-flow: column nowrap;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nFor this component to work, you will need to set a list of suggestions as prop, and also to\nimplement the component for single suggestion, which handles the click event. In the following\nexample, the suggestions are retrieved from a property called `suggestions`, and the implementation\nof the suggestion component is a simple `button`, that calls the `emitSuggestionSelected` method\nwhen clicked.\n\n```vue\n<BaseSuggestions :suggestions=\"suggestions\">\n <template #default=\"{ suggestion }\">\n <button @click=\"emitSuggestionSelected($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </template>\n</BaseSuggestions>\n```\n\nFollowing the previous example, the component options object could be something like this:\n\n```js\nexport default {\n computed: {\n ...mapGetters(['x', 'querySuggestions'], { suggestions: 'suggestions' })\n },\n methods: {\n emitSuggestionSelected(event, suggestion) {\n this.$x.emit('UserAcceptedAQuery', suggestion.query, { target: event.target });\n this.$x.emit('UserSelectedAQuerySuggestion', suggestion, { target: event.target });\n }\n }\n};\n```\n\n### Play with props\n\nIn this example, the suggestions has been limited to render a maximum of 3 items. _Type \"puzzle\" or\nanother toy in the input field to try it out!_\n\n```vue\n<template>\n <BaseSuggestions :suggestions=\"suggestions\" :maxItemsToRender=\"3\" />\n</template>\n\n<script>\n import { BaseSuggestions } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionsDemo',\n components: {\n BaseSuggestions\n },\n data() {\n return {\n suggestions: [\n {\n facets: [],\n key: 'chips',\n query: 'Chips',\n totalResults: 10,\n results: [],\n modelName: 'PopularSearch'\n }\n ]\n };\n }\n };\n</script>\n```\n\nIn this example, the filters of the suggestion will be rendered along with the query.\n\nThe `showPlainSuggestion` prop can be used to indicate if the suggestion without filter must be\nrendered along with the suggestion with filters.\n\nThis will render:\n\n- Chips //If `showPlainSuggestion` is true\n- Chips EXAMPLE\n\n```vue\n<template>\n <BaseSuggestions :suggestions=\"suggestions\" showFacets showPlainSuggestion />\n</template>\n\n<script>\n import { BaseSuggestions } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionsDemo',\n components: {\n BaseSuggestions\n },\n data() {\n return {\n suggestions: [\n {\n facets: [\n {\n id: 'exampleFacet',\n label: 'exampleFacet',\n modelName: 'SimpleFacet',\n filters: [\n {\n facetId: 'exampleFacet',\n id: '{!tag=exampleFacet}exampleFacet_60361120_64009600:\"EXAMPLE\"',\n label: 'EXAMPLE',\n selected: false,\n totalResults: 10,\n modelName: 'SimpleFilter'\n }\n ]\n }\n ],\n key: 'chips',\n query: 'Chips',\n totalResults: 10,\n results: [],\n modelName: 'PopularSearch'\n }\n ]\n };\n }\n };\n</script>\n```\n\nIn this example, the `contentClass` prop can be used to add classes to the suggestion item.\n\n```vue\n<template>\n <BaseSuggestions :suggestions=\"suggestions\" suggestionItemClass=\"x-custom-class\" />\n</template>\n\n<script>\n import { BaseSuggestions } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionsDemo',\n components: {\n BaseSuggestions\n },\n data() {\n return {\n suggestions: [\n {\n facets: [],\n key: 'chips',\n query: 'Chips',\n totalResults: 10,\n results: [],\n modelName: 'PopularSearch'\n }\n ]\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["animation","_openBlock","_createBlock","_resolveDynamicComponent","suggestionsKeys","_Fragment","_renderList","_createElementBlock","_normalizeClass","_createCommentVNode"],"mappings":";;;;;AACE,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EADF,MACkBA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,QAAAA,EAAAA;SADlB,IAC+D,CAAA,WAAA,CAAA,MAAA,IAAAC,SAAA,EAAA,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA;AAAA,IAAC,GAAK,EAAA,CAAA;AAAA,IAAA,GAAA,EAAA,IAAA;AADrE,IAAA,KAAA,EAAA,eAAA;AAAA,GAAA,EAAA;;AAIYC,OAAAA,SAAAA,CAAAA,IAAAA,CAAAA,EAAAA,kBAAAA;AAAAA,QAAqBC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAAA,IAAA,CAAA,mBAAA,EAAA,CAAA,UAAA,EAAA,KAAA,KAAA;iBACtBL,SALX,EAAA,EAAAM,kBAAA;AAAA,YAKY,IAAA;AAAA,YAAqB;AAAA,cAE3B,0BAAU,KAAiB,CAAA;AAAA,cAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,qBAAA,EAAA,IAAA,CAAA,mBAAA,CAAA,CAAA;AAE3B,cAAA,WAAA,EAAA,iBAAA;AAAA,aAAA;AAMA,YAAA;AAAA,cAAAC,kBAAA,CAAA,uPAAA,CAAA;;;;;;AAfN,SAAA,CAAA;AAAA,QAAA,GAAA;AAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,IAAAA,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
1
+ {"version":3,"file":"base-suggestions.vue.js","sources":["../../../../src/components/suggestions/base-suggestions.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" v-if=\"suggestions.length\" tag=\"ul\" class=\"x-suggestions\">\n <li\n v-for=\"(suggestion, index) in suggestionsToRender\"\n :key=\"suggestionsKeys[index]\"\n class=\"x-suggestions__item\"\n :class=\"suggestionItemClass\"\n data-test=\"suggestion-item\"\n >\n <!--\n @slot (Required) List item content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {number} index - Suggestion index\n @binding {Filter | undefined} filter - Suggestion's filter\n -->\n <slot v-bind=\"{ suggestion, index, filter: getSuggestionFilter(suggestion) }\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { Suggestion, Facet } from '@empathyco/x-types';\n import { isArrayEmpty } from '../../utils/array';\n import { AnimationProp } from '../../types';\n\n /**\n * Paints a list of suggestions passed in by prop. Requires a component for a single suggestion\n * in the default slot for working.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseSuggestions',\n props: {\n /**\n * The list of suggestions to render.\n *\n * @public\n */\n suggestions: {\n type: Array as PropType<Suggestion[]>,\n required: true\n },\n /**\n * Animation component that will be used to animate the suggestion.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /**\n * Number of suggestions to be rendered.\n *\n * @public\n */\n maxItemsToRender: Number,\n /**\n * Boolean value to indicate if the facets should be rendered.\n *\n * @public\n */\n showFacets: {\n type: Boolean,\n default: false\n },\n /**\n * When `showFacets` property of `BaseSuggestions` component is true, it indicates if the suggestion without\n * filter should be rendered.\n *\n * @public\n */\n showPlainSuggestion: {\n type: Boolean,\n default: false\n },\n /** Class inherited by content element. */\n suggestionItemClass: String\n },\n setup: function (props) {\n /**\n * Creates a suggestion for each one of the filter inside each facet.\n *\n * @param suggestion - Suggestion to expand.\n * @returns A list of suggestions, each one with a single filter.\n *\n * @internal\n */\n const expandSuggestionFilters = (suggestion: Suggestion): Suggestion[] => {\n return (\n suggestion.facets?.flatMap(facet =>\n facet.filters.map(filter => ({\n ...suggestion,\n facets: [{ ...facet, filters: [filter] }]\n }))\n ) ?? []\n );\n };\n\n /**\n * Creates a list of suggestions to render based on the configuration of this component.\n *\n * @returns - The list of suggestions to be rendered by this component.\n *\n * @internal\n */\n const suggestionsToRender = computed(() =>\n props.suggestions\n .flatMap(suggestion =>\n props.showFacets && suggestion.facets?.length\n ? props.showPlainSuggestion\n ? [{ ...suggestion, facets: [] }, ...expandSuggestionFilters(suggestion)]\n : expandSuggestionFilters(suggestion)\n : { ...suggestion, facets: [] }\n )\n .slice(0, props.maxItemsToRender)\n );\n\n /**\n * Generates a string from the given facet.\n *\n * @param facet - The facet to reduce to a string.\n * @returns - A string representing the facet.\n * @internal\n */\n const getFacetKey = (facet: Facet) => facet.filters.map(filter => filter.id).join('&');\n\n /**\n * Generates a string from the given facets.\n *\n * @param facets - The list of facets to reduce to a string.\n * @returns - A string representing the list of facets.\n * @internal\n */\n const getFacetsKey = (facets: Facet[]) => facets.map(getFacetKey).join('&');\n\n /**\n * An array with the unique keys for each suggestion. Required by the `v-for` loop.\n *\n * @returns An array with the unique keys of the suggestions.\n * @internal\n */\n const suggestionsKeys = computed(() =>\n suggestionsToRender.value.map(suggestion =>\n isArrayEmpty(suggestion.facets)\n ? suggestion.query\n : `${suggestion.query}-in-${getFacetsKey(suggestion.facets)}`\n )\n );\n\n /**\n * Returns the filter contained by the suggestion.\n *\n * @param suggestion - Suggestion containing the filter.\n * @returns The suggestion filter.\n * @internal\n */\n const getSuggestionFilter = (suggestion: Suggestion) => suggestion.facets?.[0]?.filters[0];\n\n return { suggestionsToRender, suggestionsKeys, getSuggestionFilter };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-suggestions {\n list-style-type: none;\n }\n\n .x-suggestions,\n .x-suggestions__item {\n display: flex;\n flex-flow: column nowrap;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nFor this component to work, you will need to set a list of suggestions as prop, and also to\nimplement the component for single suggestion, which handles the click event. In the following\nexample, the suggestions are retrieved from a property called `suggestions`, and the implementation\nof the suggestion component is a simple `button`, that calls the `emitSuggestionSelected` method\nwhen clicked.\n\n```vue\n<BaseSuggestions :suggestions=\"suggestions\">\n <template #default=\"{ suggestion }\">\n <button @click=\"emitSuggestionSelected($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </template>\n</BaseSuggestions>\n```\n\nFollowing the previous example, the component options object could be something like this:\n\n```js\nexport default {\n computed: {\n ...mapGetters(['x', 'querySuggestions'], { suggestions: 'suggestions' })\n },\n methods: {\n emitSuggestionSelected(event, suggestion) {\n this.$x.emit('UserAcceptedAQuery', suggestion.query, { target: event.target });\n this.$x.emit('UserSelectedAQuerySuggestion', suggestion, { target: event.target });\n }\n }\n};\n```\n\n### Play with props\n\nIn this example, the suggestions has been limited to render a maximum of 3 items. _Type \"puzzle\" or\nanother toy in the input field to try it out!_\n\n```vue\n<template>\n <BaseSuggestions :suggestions=\"suggestions\" :maxItemsToRender=\"3\" />\n</template>\n\n<script>\n import { BaseSuggestions } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionsDemo',\n components: {\n BaseSuggestions\n },\n data() {\n return {\n suggestions: [\n {\n facets: [],\n key: 'chips',\n query: 'Chips',\n totalResults: 10,\n results: [],\n modelName: 'PopularSearch'\n }\n ]\n };\n }\n };\n</script>\n```\n\nIn this example, the filters of the suggestion will be rendered along with the query.\n\nThe `showPlainSuggestion` prop can be used to indicate if the suggestion without filter must be\nrendered along with the suggestion with filters.\n\nThis will render:\n\n- Chips //If `showPlainSuggestion` is true\n- Chips EXAMPLE\n\n```vue\n<template>\n <BaseSuggestions :suggestions=\"suggestions\" showFacets showPlainSuggestion />\n</template>\n\n<script>\n import { BaseSuggestions } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionsDemo',\n components: {\n BaseSuggestions\n },\n data() {\n return {\n suggestions: [\n {\n facets: [\n {\n id: 'exampleFacet',\n label: 'exampleFacet',\n modelName: 'SimpleFacet',\n filters: [\n {\n facetId: 'exampleFacet',\n id: '{!tag=exampleFacet}exampleFacet_60361120_64009600:\"EXAMPLE\"',\n label: 'EXAMPLE',\n selected: false,\n totalResults: 10,\n modelName: 'SimpleFilter'\n }\n ]\n }\n ],\n key: 'chips',\n query: 'Chips',\n totalResults: 10,\n results: [],\n modelName: 'PopularSearch'\n }\n ]\n };\n }\n };\n</script>\n```\n\nIn this example, the `contentClass` prop can be used to add classes to the suggestion item.\n\n```vue\n<template>\n <BaseSuggestions :suggestions=\"suggestions\" suggestionItemClass=\"x-custom-class\" />\n</template>\n\n<script>\n import { BaseSuggestions } from '@empathyco/x-components';\n\n export default {\n name: 'BaseSuggestionsDemo',\n components: {\n BaseSuggestions\n },\n data() {\n return {\n suggestions: [\n {\n facets: [],\n key: 'chips',\n query: 'Chips',\n totalResults: 10,\n results: [],\n modelName: 'PopularSearch'\n }\n ]\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["animation","_openBlock","_createBlock","_resolveDynamicComponent","suggestionsKeys","_Fragment","_renderList","_createElementBlock","_normalizeClass","_createCommentVNode"],"mappings":";;;;;AACE,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EADF,MACkBA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,QAAAA,EAAAA;SADlB,IAC+D,CAAA,WAAA,CAAA,MAAA,IAAAC,SAAA,EAAA,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA;AAAA,IAAC,GAAK,EAAA,CAAA;AAAA,IAAA,GAAA,EAAA,IAAA;AADrE,IAAA,KAAA,EAAA,eAAA;AAAA,GAAA,EAAA;;AAIYC,OAAAA,SAAAA,CAAAA,IAAAA,CAAAA,EAAAA,kBAAAA;AAAAA,QAAqBC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAAA,IAAA,CAAA,mBAAA,EAAA,CAAA,UAAA,EAAA,KAAA,KAAA;iBACtBL,SALX,EAAA,EAAAM,kBAAA;AAAA,YAKY,IAAA;AAAA,YAAqB;AAAA,cAE3B,0BAAU,KAAiB,CAAA;AAAA,cAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,qBAAA,EAAA,IAAA,CAAA,mBAAA,CAAA,CAAA;cAQ3B,WAAgF,EAAA,iBAAA;AAAA,aAAA;;;;;;;AAftF,SAAA,CAAA;AAAA,QAAA,GAAA;AAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
@@ -7,7 +7,7 @@ import '../plugins/devtools/colors.utils.js';
7
7
  import '../plugins/x-bus.js';
8
8
  import '../plugins/x-plugin.js';
9
9
  import { getGetterPath } from '../plugins/x-plugin.utils.js';
10
- import { useStore } from './use-store.js';
10
+ import { useStore } from 'vuex';
11
11
 
12
12
  /**
13
13
  * Creates an object containing the alias part of {@link XComponentAPI}.
@@ -134,6 +134,9 @@ function useAliasApi() {
134
134
  },
135
135
  get selectedSort() {
136
136
  return store.state.x.search?.sort ?? '';
137
+ },
138
+ get priceStats() {
139
+ return store.state.x.search?.stats?.price ?? {};
137
140
  }
138
141
  };
139
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-alias-api.js","sources":["../../../src/composables/use-alias-api.ts"],"sourcesContent":["import {\n Facet,\n Filter,\n HistoryQuery,\n NextQuery,\n PartialResult,\n Redirection,\n RelatedTag,\n Result,\n SemanticQuery,\n Suggestion\n} from '@empathyco/x-types';\nimport { ScrollComponentState } from '../x-modules/scroll/store/types';\nimport { InputStatus } from '../x-modules/search-box/store/types';\nimport { RequestStatus } from '../store/utils/status-store.utils';\nimport { getGetterPath } from '../plugins/index';\nimport { useStore } from './use-store';\n\n/**\n * Creates an object containing the alias part of {@link XComponentAPI}.\n *\n * @returns An object containing the alias part of the {@link XComponentAPI}.\n *\n * @internal\n */\nexport function useAliasApi(): UseAliasAPI {\n const queryModules = [\n 'facets',\n 'searchBox',\n 'nextQueries',\n 'querySuggestions',\n 'relatedTags',\n 'search'\n ] as const;\n const statusModules = [\n 'identifierResults',\n 'nextQueries',\n 'popularSearches',\n 'querySuggestions',\n 'recommendations',\n 'relatedTags',\n 'search'\n ] as const;\n\n const store = useStore();\n\n const query = queryModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): string {\n return store.state.x[moduleName]?.query ?? '';\n },\n enumerable: true\n });\n }, {} as UseAliasQueryAPI);\n\n const status = statusModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): RequestStatus | undefined {\n return store.state.x[moduleName]?.status;\n },\n enumerable: true\n });\n }, {} as UseAliasStatusAPI);\n\n return {\n query,\n status,\n get device() {\n return store.state.x.device?.name ?? null;\n },\n get facets() {\n return store.getters[getGetterPath('facets', 'facets')] ?? {};\n },\n get historyQueries() {\n return store.getters[getGetterPath('historyQueries', 'historyQueries')] ?? [];\n },\n get historyQueriesWithResults() {\n return store.getters[getGetterPath('historyQueries', 'historyQueriesWithResults')] ?? [];\n },\n get fullHistoryQueries() {\n return store.state.x.historyQueries?.historyQueries ?? [];\n },\n get isHistoryQueriesEnabled() {\n return store.state.x.historyQueries?.isEnabled ?? false;\n },\n get fromNoResultsWithFilters() {\n return store.state.x.search?.fromNoResultsWithFilters ?? false;\n },\n get identifierResults() {\n return store.state.x.identifierResults?.identifierResults ?? [];\n },\n get searchBoxStatus() {\n return store.state.x.searchBox?.inputStatus ?? undefined;\n },\n get isEmpathizeOpen() {\n return store.state.x.empathize?.isOpen ?? false;\n },\n get nextQueries() {\n return store.getters[getGetterPath('nextQueries', 'nextQueries')] ?? [];\n },\n get noResults() {\n return store.state.x.search?.isNoResults ?? false;\n },\n get partialResults() {\n return store.state.x.search?.partialResults ?? [];\n },\n get popularSearches() {\n return store.state.x.popularSearches?.popularSearches ?? [];\n },\n get querySuggestions() {\n return store.getters[getGetterPath('querySuggestions', 'querySuggestions')] ?? [];\n },\n get fullQuerySuggestions() {\n return store.state.x.querySuggestions?.suggestions ?? [];\n },\n get recommendations() {\n return store.state.x.recommendations?.recommendations ?? [];\n },\n get redirections() {\n return store.state.x.search?.redirections ?? [];\n },\n get relatedTags() {\n return store.getters[getGetterPath('relatedTags', 'relatedTags')] ?? [];\n },\n get results() {\n return store.state.x.search?.results ?? [];\n },\n get scroll() {\n return store.state.x.scroll?.data ?? {};\n },\n get selectedFilters() {\n return store.getters[getGetterPath('facets', 'selectedFilters')] ?? [];\n },\n get selectedRelatedTags() {\n return store.state.x.relatedTags?.selectedRelatedTags ?? [];\n },\n get semanticQueries() {\n return store.state.x.semanticQueries?.semanticQueries ?? [];\n },\n get spellcheckedQuery() {\n return store.state.x.search?.spellcheckedQuery ?? null;\n },\n get totalResults() {\n return store.state.x.search?.totalResults ?? 0;\n },\n get selectedSort() {\n return store.state.x.search?.sort ?? '';\n }\n };\n}\n\n/**\n * Alias to facilitate retrieving values from the store.\n *\n * @public\n */\nexport interface UseAliasAPI {\n /** The {@link DeviceXModule} detected device. */\n readonly device: string | null;\n /** The {@link FacetsXModule} facets. */\n readonly facets: Record<Facet['id'], Facet>;\n /** The {@link HistoryQueriesXModule} history queries matching the query. */\n readonly historyQueries: ReadonlyArray<HistoryQuery>;\n /** The {@link HistoryQueriesXModule} history queries with 1 or more results. */\n readonly historyQueriesWithResults: ReadonlyArray<HistoryQuery>;\n /** The {@link HistoryQueriesXModule} history queries. */\n readonly fullHistoryQueries: ReadonlyArray<HistoryQuery>;\n /** The {@link HistoryQueriesXModule} history queries enabled flag. */\n readonly isHistoryQueriesEnabled: Readonly<boolean>;\n /** The {@link SearchXModule} no results with filters flag. */\n readonly fromNoResultsWithFilters: Readonly<boolean>;\n /** The {@link IdentifierResultsXModule} results. */\n readonly identifierResults: ReadonlyArray<Result>;\n /** The {@link SearchBoxXModule } input status. */\n readonly searchBoxStatus: InputStatus | undefined;\n /** The {@link Empathize} is open state. */\n readonly isEmpathizeOpen: boolean;\n /** The {@link NextQueriesXModule} next queries. */\n readonly nextQueries: ReadonlyArray<NextQuery>;\n /** The {@link SearchXModule} no results situation. */\n readonly noResults: boolean;\n /** The {@link SearchXModule} partial results. */\n readonly partialResults: ReadonlyArray<PartialResult>;\n /** The {@link PopularSearchesXModule} popular searches. */\n readonly popularSearches: ReadonlyArray<Suggestion>;\n /** The query value of the different modules. */\n readonly query: UseAliasQueryAPI;\n /** The {@link QuerySuggestionsXModule} query suggestions that should be displayed. */\n readonly querySuggestions: ReadonlyArray<Suggestion>;\n /** The {@link QuerySuggestionsXModule} query suggestions. */\n readonly fullQuerySuggestions: ReadonlyArray<Suggestion>;\n /** The {@link RecommendationsXModule} recommendations. */\n readonly recommendations: ReadonlyArray<Result>;\n /** The {@link SearchXModule} redirections. */\n readonly redirections: ReadonlyArray<Redirection>;\n /** The {@link RelatedTagsXModule} related tags (Both selected and deselected). */\n readonly relatedTags: ReadonlyArray<RelatedTag>;\n /** The {@link SearchXModule} search results. */\n readonly results: ReadonlyArray<Result>;\n /** The {@link ScrollXModule} data state. */\n readonly scroll: Record<string, ScrollComponentState>;\n /** The {@link FacetsXModule} selected filters. */\n readonly selectedFilters: Filter[];\n /** The {@link RelatedTagsXModule} selected related tags. */\n readonly selectedRelatedTags: ReadonlyArray<RelatedTag>;\n /** The {@link SemanticQueriesXModule} queries. */\n readonly semanticQueries: ReadonlyArray<SemanticQuery>;\n /** The {@link SearchXModule} spellchecked query. */\n readonly spellcheckedQuery: string | null;\n /** The status value of the different modules. */\n readonly status: UseAliasStatusAPI;\n /** The {@link SearchXModule} total results. */\n readonly totalResults: number;\n /** The {@link SearchXModule} selected sort. */\n readonly selectedSort: string;\n}\n\n/**\n * Alias to facilitate retrieving the modules with query.\n *\n * @public\n */\nexport interface UseAliasQueryAPI {\n /** The {@link FacetsXModule} query. */\n readonly facets: string;\n /** The {@link SearchBoxXModule} query. */\n readonly searchBox: string;\n /** The {@link NextQueriesXModule} query. */\n readonly nextQueries: string;\n /** The {@link QuerySuggestionsXModule} query. */\n readonly querySuggestions: string;\n /** The {@link RelatedTagsXModule} query. */\n readonly relatedTags: string;\n /** The {@link SearchXModule} query. */\n readonly search: string;\n}\n\n/**\n * Alias to facilitate retrieving the modules with status.\n *\n * @public\n */\nexport interface UseAliasStatusAPI {\n /** The {@link IdentifierResultsXModule} status. */\n readonly identifierResults: RequestStatus | undefined;\n /** The {@link NextQueriesXModule} status. */\n readonly nextQueries: RequestStatus | undefined;\n /** The {@link PopularSearchesXModule} status. */\n readonly popularSearches: RequestStatus | undefined;\n /** The {@link QuerySuggestionsXModule} status. */\n readonly querySuggestions: RequestStatus | undefined;\n /** The {@link RecommendationsXModule} status. */\n readonly recommendations: RequestStatus | undefined;\n /** The {@link RelatedTagsXModule} status. */\n readonly relatedTags: RequestStatus | undefined;\n /** The {@link SearchXModule} status. */\n readonly search: RequestStatus | undefined;\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAkBA;;;;;;AAMG;SACa,WAAW,GAAA;AACzB,IAAA,MAAM,YAAY,GAAG;QACnB,QAAQ;QACR,WAAW;QACX,aAAa;QACb,kBAAkB;QAClB,aAAa;QACb,QAAQ;KACA,CAAC;AACX,IAAA,MAAM,aAAa,GAAG;QACpB,mBAAmB;QACnB,aAAa;QACb,iBAAiB;QACjB,kBAAkB;QAClB,iBAAiB;QACjB,aAAa;QACb,QAAQ;KACA,CAAC;AAEX,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,UAAU,KAAI;AACpD,QAAA,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE;YAC5C,GAAG,GAAA;AACD,gBAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;aAC/C;AACD,YAAA,UAAU,EAAE,IAAI;AACjB,SAAA,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D;AACD,QAAA,IAAI,YAAY,GAAA;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;SACzC;KACF,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"use-alias-api.js","sources":["../../../src/composables/use-alias-api.ts"],"sourcesContent":["import {\n Facet,\n Filter,\n HistoryQuery,\n NextQuery,\n PartialResult,\n Redirection,\n RelatedTag,\n Result,\n SemanticQuery,\n Suggestion\n} from '@empathyco/x-types';\nimport { ScrollComponentState } from '../x-modules/scroll/store/types';\nimport { InputStatus } from '../x-modules/search-box/store/types';\nimport { RequestStatus } from '../store/utils/status-store.utils';\nimport { getGetterPath } from '../plugins/index';\nimport { useStore } from './use-store';\n\n/**\n * Creates an object containing the alias part of {@link XComponentAPI}.\n *\n * @returns An object containing the alias part of the {@link XComponentAPI}.\n *\n * @internal\n */\nexport function useAliasApi(): UseAliasAPI {\n const queryModules = [\n 'facets',\n 'searchBox',\n 'nextQueries',\n 'querySuggestions',\n 'relatedTags',\n 'search'\n ] as const;\n const statusModules = [\n 'identifierResults',\n 'nextQueries',\n 'popularSearches',\n 'querySuggestions',\n 'recommendations',\n 'relatedTags',\n 'search'\n ] as const;\n\n const store = useStore();\n\n const query = queryModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): string {\n return store.state.x[moduleName]?.query ?? '';\n },\n enumerable: true\n });\n }, {} as UseAliasQueryAPI);\n\n const status = statusModules.reduce((acc, moduleName) => {\n return Object.defineProperty(acc, moduleName, {\n get(): RequestStatus | undefined {\n return store.state.x[moduleName]?.status;\n },\n enumerable: true\n });\n }, {} as UseAliasStatusAPI);\n\n return {\n query,\n status,\n get device() {\n return store.state.x.device?.name ?? null;\n },\n get facets() {\n return store.getters[getGetterPath('facets', 'facets')] ?? {};\n },\n get historyQueries() {\n return store.getters[getGetterPath('historyQueries', 'historyQueries')] ?? [];\n },\n get historyQueriesWithResults() {\n return store.getters[getGetterPath('historyQueries', 'historyQueriesWithResults')] ?? [];\n },\n get fullHistoryQueries() {\n return store.state.x.historyQueries?.historyQueries ?? [];\n },\n get isHistoryQueriesEnabled() {\n return store.state.x.historyQueries?.isEnabled ?? false;\n },\n get fromNoResultsWithFilters() {\n return store.state.x.search?.fromNoResultsWithFilters ?? false;\n },\n get identifierResults() {\n return store.state.x.identifierResults?.identifierResults ?? [];\n },\n get searchBoxStatus() {\n return store.state.x.searchBox?.inputStatus ?? undefined;\n },\n get isEmpathizeOpen() {\n return store.state.x.empathize?.isOpen ?? false;\n },\n get nextQueries() {\n return store.getters[getGetterPath('nextQueries', 'nextQueries')] ?? [];\n },\n get noResults() {\n return store.state.x.search?.isNoResults ?? false;\n },\n get partialResults() {\n return store.state.x.search?.partialResults ?? [];\n },\n get popularSearches() {\n return store.state.x.popularSearches?.popularSearches ?? [];\n },\n get querySuggestions() {\n return store.getters[getGetterPath('querySuggestions', 'querySuggestions')] ?? [];\n },\n get fullQuerySuggestions() {\n return store.state.x.querySuggestions?.suggestions ?? [];\n },\n get recommendations() {\n return store.state.x.recommendations?.recommendations ?? [];\n },\n get redirections() {\n return store.state.x.search?.redirections ?? [];\n },\n get relatedTags() {\n return store.getters[getGetterPath('relatedTags', 'relatedTags')] ?? [];\n },\n get results() {\n return store.state.x.search?.results ?? [];\n },\n get scroll() {\n return store.state.x.scroll?.data ?? {};\n },\n get selectedFilters() {\n return store.getters[getGetterPath('facets', 'selectedFilters')] ?? [];\n },\n get selectedRelatedTags() {\n return store.state.x.relatedTags?.selectedRelatedTags ?? [];\n },\n get semanticQueries() {\n return store.state.x.semanticQueries?.semanticQueries ?? [];\n },\n get spellcheckedQuery() {\n return store.state.x.search?.spellcheckedQuery ?? null;\n },\n get totalResults() {\n return store.state.x.search?.totalResults ?? 0;\n },\n get selectedSort() {\n return store.state.x.search?.sort ?? '';\n },\n get priceStats() {\n return store.state.x.search?.stats?.price ?? {};\n }\n };\n}\n\n/**\n * Alias to facilitate retrieving values from the store.\n *\n * @public\n */\nexport interface UseAliasAPI {\n /** The {@link DeviceXModule} detected device. */\n readonly device: string | null;\n /** The {@link FacetsXModule} facets. */\n readonly facets: Record<Facet['id'], Facet>;\n /** The {@link HistoryQueriesXModule} history queries matching the query. */\n readonly historyQueries: ReadonlyArray<HistoryQuery>;\n /** The {@link HistoryQueriesXModule} history queries with 1 or more results. */\n readonly historyQueriesWithResults: ReadonlyArray<HistoryQuery>;\n /** The {@link HistoryQueriesXModule} history queries. */\n readonly fullHistoryQueries: ReadonlyArray<HistoryQuery>;\n /** The {@link HistoryQueriesXModule} history queries enabled flag. */\n readonly isHistoryQueriesEnabled: Readonly<boolean>;\n /** The {@link SearchXModule} no results with filters flag. */\n readonly fromNoResultsWithFilters: Readonly<boolean>;\n /** The {@link IdentifierResultsXModule} results. */\n readonly identifierResults: ReadonlyArray<Result>;\n /** The {@link SearchBoxXModule } input status. */\n readonly searchBoxStatus: InputStatus | undefined;\n /** The {@link Empathize} is open state. */\n readonly isEmpathizeOpen: boolean;\n /** The {@link NextQueriesXModule} next queries. */\n readonly nextQueries: ReadonlyArray<NextQuery>;\n /** The {@link SearchXModule} no results situation. */\n readonly noResults: boolean;\n /** The {@link SearchXModule} partial results. */\n readonly partialResults: ReadonlyArray<PartialResult>;\n /** The {@link PopularSearchesXModule} popular searches. */\n readonly popularSearches: ReadonlyArray<Suggestion>;\n /** The query value of the different modules. */\n readonly query: UseAliasQueryAPI;\n /** The {@link QuerySuggestionsXModule} query suggestions that should be displayed. */\n readonly querySuggestions: ReadonlyArray<Suggestion>;\n /** The {@link QuerySuggestionsXModule} query suggestions. */\n readonly fullQuerySuggestions: ReadonlyArray<Suggestion>;\n /** The {@link RecommendationsXModule} recommendations. */\n readonly recommendations: ReadonlyArray<Result>;\n /** The {@link SearchXModule} redirections. */\n readonly redirections: ReadonlyArray<Redirection>;\n /** The {@link RelatedTagsXModule} related tags (Both selected and deselected). */\n readonly relatedTags: ReadonlyArray<RelatedTag>;\n /** The {@link SearchXModule} search results. */\n readonly results: ReadonlyArray<Result>;\n /** The {@link ScrollXModule} data state. */\n readonly scroll: Record<string, ScrollComponentState>;\n /** The {@link FacetsXModule} selected filters. */\n readonly selectedFilters: Filter[];\n /** The {@link RelatedTagsXModule} selected related tags. */\n readonly selectedRelatedTags: ReadonlyArray<RelatedTag>;\n /** The {@link SemanticQueriesXModule} queries. */\n readonly semanticQueries: ReadonlyArray<SemanticQuery>;\n /** The {@link SearchXModule} spellchecked query. */\n readonly spellcheckedQuery: string | null;\n /** The status value of the different modules. */\n readonly status: UseAliasStatusAPI;\n /** The {@link SearchXModule} total results. */\n readonly totalResults: number;\n /** The {@link SearchXModule} selected sort. */\n readonly selectedSort: string;\n /** The {@link SearchXModule} price specific stats. */\n readonly priceStats: { min: number; max: number };\n}\n\n/**\n * Alias to facilitate retrieving the modules with query.\n *\n * @public\n */\nexport interface UseAliasQueryAPI {\n /** The {@link FacetsXModule} query. */\n readonly facets: string;\n /** The {@link SearchBoxXModule} query. */\n readonly searchBox: string;\n /** The {@link NextQueriesXModule} query. */\n readonly nextQueries: string;\n /** The {@link QuerySuggestionsXModule} query. */\n readonly querySuggestions: string;\n /** The {@link RelatedTagsXModule} query. */\n readonly relatedTags: string;\n /** The {@link SearchXModule} query. */\n readonly search: string;\n}\n\n/**\n * Alias to facilitate retrieving the modules with status.\n *\n * @public\n */\nexport interface UseAliasStatusAPI {\n /** The {@link IdentifierResultsXModule} status. */\n readonly identifierResults: RequestStatus | undefined;\n /** The {@link NextQueriesXModule} status. */\n readonly nextQueries: RequestStatus | undefined;\n /** The {@link PopularSearchesXModule} status. */\n readonly popularSearches: RequestStatus | undefined;\n /** The {@link QuerySuggestionsXModule} status. */\n readonly querySuggestions: RequestStatus | undefined;\n /** The {@link RecommendationsXModule} status. */\n readonly recommendations: RequestStatus | undefined;\n /** The {@link RelatedTagsXModule} status. */\n readonly relatedTags: RequestStatus | undefined;\n /** The {@link SearchXModule} status. */\n readonly search: RequestStatus | undefined;\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AAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;SACzC;AACD,QAAA,IAAI,eAAe,GAAA;AACjB,YAAA,OAAO,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;SACxE;AACD,QAAA,IAAI,mBAAmB,GAAA;YACrB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,mBAAmB,IAAI,EAAE,CAAC;SAC7D;AACD,QAAA,IAAI,eAAe,GAAA;YACjB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,EAAE,eAAe,IAAI,EAAE,CAAC;SAC7D;AACD,QAAA,IAAI,iBAAiB,GAAA;YACnB,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,iBAAiB,IAAI,IAAI,CAAC;SACxD;AACD,QAAA,IAAI,YAAY,GAAA;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,YAAY,IAAI,CAAC,CAAC;SAChD;AACD,QAAA,IAAI,YAAY,GAAA;YACd,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;SACzC;AACD,QAAA,IAAI,UAAU,GAAA;AACZ,YAAA,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;SACjD;KACF,CAAC;AACJ;;;;"}
@@ -8,7 +8,7 @@ import '../plugins/devtools/colors.utils.js';
8
8
  import '../plugins/x-bus.js';
9
9
  import '../plugins/x-plugin.js';
10
10
  import { getGetterPath } from '../plugins/x-plugin.utils.js';
11
- import { useStore } from './use-store.js';
11
+ import { useStore } from 'vuex';
12
12
 
13
13
  /**
14
14
  * Function which returns the requested getters as a dictionary of getters.
@@ -1,5 +1,5 @@
1
1
  import { computed } from 'vue';
2
- import { useStore } from './use-store.js';
2
+ import { useStore } from 'vuex';
3
3
 
4
4
  /**
5
5
  * Function which returns the requested state's properties as a dictionary.
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Typing directive.
3
+ *
4
+ * @public
5
+ */
6
+ const typing = {
7
+ mounted(el, binding) {
8
+ execute(el, binding.value);
9
+ },
10
+ updated(el, binding) {
11
+ if (binding.value.text !== binding.oldValue?.text) {
12
+ clearTimeout(el.__timeoutId);
13
+ execute(el, binding.value);
14
+ }
15
+ },
16
+ unmounted(el) {
17
+ clearTimeout(el.__timeoutId);
18
+ }
19
+ };
20
+ /**
21
+ * Execute a typing animation in an HTML element.
22
+ *
23
+ * @param el - The HTML element where the typing animation will be displayed.
24
+ * @param options - Options for the behavior of the animation.
25
+ */
26
+ function execute(el, options) {
27
+ const { text, speed = 1, targetAttr = '' } = options;
28
+ if (!text) {
29
+ // eslint-disable-next-line no-console
30
+ console.error('v-typing: "text" is required.');
31
+ return;
32
+ }
33
+ let index = 0;
34
+ const updateContent = (value) => {
35
+ if (targetAttr) {
36
+ el.setAttribute(targetAttr, value);
37
+ }
38
+ else {
39
+ el.innerHTML = value;
40
+ }
41
+ };
42
+ const type = () => {
43
+ if (index < text.length) {
44
+ updateContent(text.slice(0, index + 1));
45
+ index++;
46
+ el.__timeoutId = setTimeout(type, speed);
47
+ }
48
+ else {
49
+ updateContent(text);
50
+ clearTimeout(el.__timeoutId);
51
+ el.__timeoutId = undefined;
52
+ }
53
+ };
54
+ type();
55
+ }
56
+
57
+ export { typing };
58
+ //# sourceMappingURL=typing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typing.js","sources":["../../../src/directives/typing.ts"],"sourcesContent":["import type { Directive } from 'vue';\n\n/**\n * TypingOptions interface.\n *\n * @public\n */\nexport interface TypingOptions {\n /**\n * The text (plain or html) that will be typed into the target element.\n */\n text: string;\n /**\n * The typing speed in milliseconds per character.\n *\n */\n speed?: number;\n /**\n * The attribute of the HTML element where the typed text will be placed.\n * If not specified, the text will be set as content (innerHTML).\n *\n * @example 'placeholder'\n */\n targetAttr?: string;\n}\n\ninterface TypingHTMLElement extends HTMLElement {\n __timeoutId?: number;\n}\n\n/**\n * Typing directive.\n *\n * @public\n */\nexport const typing: Directive<TypingHTMLElement, TypingOptions> = {\n mounted(el, binding) {\n execute(el, binding.value);\n },\n\n updated(el, binding) {\n if (binding.value.text !== binding.oldValue?.text) {\n clearTimeout(el.__timeoutId);\n execute(el, binding.value);\n }\n },\n\n unmounted(el) {\n clearTimeout(el.__timeoutId);\n }\n};\n\n/**\n * Execute a typing animation in an HTML element.\n *\n * @param el - The HTML element where the typing animation will be displayed.\n * @param options - Options for the behavior of the animation.\n */\nfunction execute(el: TypingHTMLElement, options: TypingOptions) {\n const { text, speed = 1, targetAttr = '' } = options;\n\n if (!text) {\n // eslint-disable-next-line no-console\n console.error('v-typing: \"text\" is required.');\n return;\n }\n\n let index = 0;\n\n const updateContent = (value: string) => {\n if (targetAttr) {\n el.setAttribute(targetAttr, value);\n } else {\n el.innerHTML = value;\n }\n };\n\n const type = () => {\n if (index < text.length) {\n updateContent(text.slice(0, index + 1));\n index++;\n el.__timeoutId = setTimeout(type, speed) as unknown as number;\n } else {\n updateContent(text);\n clearTimeout(el.__timeoutId);\n el.__timeoutId = undefined;\n }\n };\n\n type();\n}\n"],"names":[],"mappings":"AA8BA;;;;AAIG;AACU,MAAA,MAAM,GAAgD;IACjE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAA;AACjB,QAAA,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;KAC5B;IAED,OAAO,CAAC,EAAE,EAAE,OAAO,EAAA;QACjB,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE;AACjD,YAAA,YAAY,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAC7B,YAAA,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;A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as BaseEventButton } from './components/base-event-button.vue.j
128
128
  export { default as BaseGrid } from './components/base-grid.vue.js';
129
129
  export { default as BaseKeyboardNavigation } from './components/base-keyboard-navigation.vue.js';
130
130
  export { default as BaseRating } from './components/base-rating.vue.js';
131
+ export { default as BaseSlider } from './components/base-slider.vue.js';
131
132
  export { default as BaseSwitch } from './components/base-switch.vue.js';
132
133
  export { default as BaseVariableColumnGrid } from './components/base-variable-column-grid.vue.js';
133
134
  export { default as DisplayEmitter } from './components/display-emitter.vue.js';
@@ -138,6 +139,9 @@ export { default as LocationProvider } from './components/location-provider.vue.
138
139
  export { default as SlidingPanel } from './components/sliding-panel.vue.js';
139
140
  export { default as SnippetCallbacks } from './components/snippet-callbacks.vue.js';
140
141
  export { default as PageLoaderButton } from './components/page-loader-button.vue.js';
142
+ export { default as PageSelector } from './components/page-selector.vue.js';
143
+ export { default as DisplayClickProvider } from './components/display-click-provider.vue.js';
144
+ export { default as BaseTeleport } from './components/base-teleport.vue.js';
141
145
  export { DISABLE_ANIMATIONS_KEY, HAS_MORE_ITEMS_KEY, LIST_ITEMS_KEY, QUERY_KEY, RESULT_WITH_VARIANTS_KEY, SELECTED_VARIANTS_KEY, SELECT_RESULT_VARIANT_KEY } from './components/decorators/injection.consts.js';
142
146
  export { getRootXComponent, getXComponentXModuleName, isXComponent } from './components/x-component.utils.js';
143
147
  export { createUseDevice } from './composables/create-use-device.js';
@@ -147,16 +151,20 @@ export { useDebounce } from './composables/use-debounce.js';
147
151
  export { useGetter } from './composables/use-getter.js';
148
152
  export { useEmitDisplayEvent, useOnDisplay } from './composables/use-on-display.js';
149
153
  export { useState } from './composables/use-state.js';
150
- export { useStore } from './composables/use-store.js';
154
+ export { useStore } from 'vuex';
151
155
  export { useXBus } from './composables/use-x-bus.js';
152
156
  export { infiniteScroll } from './directives/infinite-scroll.js';
157
+ export { typing } from './directives/typing.js';
153
158
  export { setupDevtools } from './plugins/devtools/devtools.plugin.js';
154
159
  export { bus } from './plugins/x-bus.js';
155
160
  export { isSimpleSelector, registerStoreEmitters } from './plugins/x-emitters.js';
156
161
  export { XPlugin, xPlugin } from './plugins/x-plugin.js';
157
162
  export { assertXPluginOptionsAreValid, getGetterPath } from './plugins/x-plugin.utils.js';
158
163
  export { DirectionalFocusNavigationService } from './services/directional-focus-navigation.service.js';
164
+ export { mergeConfig, setConfig } from './store/utils/config-store.utils.js';
159
165
  export { createFetchAndSaveActions } from './store/utils/fetch-and-save-action.utils.js';
166
+ export { cleanGettersProxyCache, getGettersProxy, getGettersProxyFromModule } from './store/utils/getters-proxy.utils.js';
167
+ export { createRelatedTagsQueryGetter, setQuery } from './store/utils/query.utils.js';
160
168
  export { setStatus } from './store/utils/status-store.utils.js';
161
169
  export { createStoreEmitters } from './store/utils/store-emitters.utils.js';
162
170
  export { RootXStoreModule } from './store/x.module.js';
@@ -325,6 +333,15 @@ export { request as recommendationsRequest } from './x-modules/recommendations/s
325
333
  export { recommendationsXStoreModule } from './x-modules/recommendations/store/module.js';
326
334
  export { recommendationsWiring, setRecommendationsExtraParams } from './x-modules/recommendations/wiring.js';
327
335
  export { recommendationsXModule } from './x-modules/recommendations/x-module.js';
336
+ export { default as RelatedPrompt } from './x-modules/related-prompts/components/related-prompt.vue.js';
337
+ export { default as RelatedPromptsList } from './x-modules/related-prompts/components/related-prompts-list.vue.js';
338
+ export { default as RelatedPromptsTagList } from './x-modules/related-prompts/components/related-prompts-tag-list.vue.js';
339
+ export { cancelFetchAndSaveRelatedPrompts, fetchAndSaveRelatedPrompts } from './x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js';
340
+ export { fetchRelatedPrompts } from './x-modules/related-prompts/store/actions/fetch-related-prompts.action.js';
341
+ export { relatedPromptsStoreEmitters } from './x-modules/related-prompts/store/emitters.js';
342
+ export { relatedPromptsXStoreModule } from './x-modules/related-prompts/store/module.js';
343
+ export { relatedPromptsWiring } from './x-modules/related-prompts/wiring.js';
344
+ export { relatedPromptsXModule } from './x-modules/related-prompts/x-module.js';
328
345
  export { default as RelatedTag } from './x-modules/related-tags/components/related-tag.vue.js';
329
346
  export { default as RelatedTags } from './x-modules/related-tags/components/related-tags.vue.js';
330
347
  export { cancelFetchAndSaveRelatedTags, fetchAndSaveRelatedTags } from './x-modules/related-tags/store/actions/fetch-and-save-related-tags.action.js';
@@ -390,16 +407,16 @@ export { semanticQueriesXStoreModule } from './x-modules/semantic-queries/store/
390
407
  export { semanticQueriesXModule } from './x-modules/semantic-queries/x-module.js';
391
408
  export { clearQueryWire, fetchAndSaveSemanticQueryWire, semanticQueriesWiring, setQueryFromSearchResponseChangedWire, setQueryWire, setSemanticQueriesExtraParamsWire, setTotalResultsFromSearchResponseChangedWire, setTotalResultsWire } from './x-modules/semantic-queries/wiring.js';
392
409
  export { default as Tagging } from './x-modules/tagging/components/tagging.vue.js';
393
- export { DefaultPDPAddToCartService } from './x-modules/tagging/service/pdp-add-to-cart.service.js';
410
+ export { DefaultExternalTaggingService } from './x-modules/tagging/service/external-tagging.service.js';
394
411
  export { track } from './x-modules/tagging/store/actions/track.action.js';
395
412
  export { taggingEmitters } from './x-modules/tagging/store/emitters.js';
396
413
  export { taggingXStoreModule } from './x-modules/tagging/store/module.js';
397
- export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackResultClickedWire } from './x-modules/tagging/wiring.js';
414
+ export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackRelatedPromptToolingDisplayClickWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire } from './x-modules/tagging/wiring.js';
398
415
  export { taggingXModule } from './x-modules/tagging/x-module.js';
399
416
  export { default as UrlHandler } from './x-modules/url/components/url-handler.vue.js';
400
417
  export { replaceableParams, urlEmitters } from './x-modules/url/store/emitters.js';
401
418
  export { urlXStoreModule } from './x-modules/url/store/module.js';
402
- export { setInitialExtraParams, setParams, setUrlFilters, setUrlPage, setUrlParamsFromPreview, setUrlQuery, setUrlQueryFromPreview, setUrlRelatedTags, setUrlScroll, setUrlSelectedFiltersFromPreview, setUrlSort, urlWiring } from './x-modules/url/wiring.js';
419
+ export { setInitialExtraParams, setParams, setUrlFilters, setUrlPage, setUrlParamsFromPreview, setUrlPrompt, setUrlQuery, setUrlQueryFromPreview, setUrlRelatedTags, setUrlScroll, setUrlSelectedFiltersFromPreview, setUrlSort, urlWiring } from './x-modules/url/wiring.js';
403
420
  export { urlXModule } from './x-modules/url/x-module.js';
404
421
  export { default as ExperienceControls } from './x-modules/experience-controls/components/experience-controls.vue.js';
405
422
  export { cancelFetchAndSaveControls, fetchAndSaveExperienceControlsResponse } from './x-modules/experience-controls/store/actions/fetch-and-save-experience-controls.action.js';
package/js/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,6 +1,11 @@
1
1
  /**
2
2
  * Type for animations props.
3
3
  *
4
+ * @remarks
5
+ * String for 'ul'
6
+ * Object for `DefineComponent` type
7
+ * Function for `() => NoElement`
8
+ *
4
9
  * @public
5
10
  */
6
11
  const AnimationProp = [String, Object, Function];
@@ -1 +1 @@
1
- {"version":3,"file":"animation-prop.js","sources":["../../../src/types/animation-prop.ts"],"sourcesContent":["import { DefineComponent, PropType } from 'vue';\n\n/**\n * Type for animations props.\n *\n * @public\n */\nexport const AnimationProp = [String, Object, Function] as PropType<DefineComponent | string>;\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACU,MAAA,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ;;;;"}
1
+ {"version":3,"file":"animation-prop.js","sources":["../../../src/types/animation-prop.ts"],"sourcesContent":["/**\n * Type for animations props.\n *\n * @remarks\n * String for 'ul'\n * Object for `DefineComponent` type\n * Function for `() => NoElement`\n *\n * @public\n */\nexport const AnimationProp = [String, Object, Function];\n"],"names":[],"mappings":"AAAA;;;;;;;;;AASG;AACU,MAAA,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ;;;;"}
@@ -234,10 +234,10 @@ class XInstaller {
234
234
  * returns an Element or element selector to use.
235
235
  * If it is not present, a new <div> Element is created and appended to the body.
236
236
  *
237
- * @param domElement - {@link InstallXOptions.domElement | Element, string or function} Used
238
- * to mount the Vue Application.
237
+ * @param domElement - {@link InstallXOptions.domElement} Element, ShadowRoot, string or function
238
+ * used to mount the Vue Application.
239
239
  *
240
- * @returns The Element to use as mounting target for the Vue Application.
240
+ * @returns The Element or ShadowRoot to use as mounting target for the Vue Application.
241
241
  * @internal
242
242
  */
243
243
  getMountingTarget(domElement) {
@@ -1 +1 @@
1
- {"version":3,"file":"x-installer.js","sources":["../../../../src/x-installer/x-installer/x-installer.ts"],"sourcesContent":["import { forEach, isFunction } from '@empathyco/x-utils';\nimport { App, createApp, reactive, Plugin } from 'vue';\nimport { XBus } from '@empathyco/x-bus';\nimport { XPlugin } from '../../plugins/x-plugin';\nimport { XPluginOptions } from '../../plugins/x-plugin.types';\nimport { NormalisedSnippetConfig, SnippetConfig, XAPI } from '../api/api.types';\nimport { BaseXAPI } from '../api/base-api';\nimport { WireMetadata, XEventsTypes } from '../../wiring/index';\nimport { bus } from '../../plugins/x-bus';\nimport { InitWrapper, InstallXOptions } from './types';\n\ndeclare global {\n interface Window {\n InterfaceX?: XAPI;\n initX?: (() => SnippetConfig) | SnippetConfig;\n }\n}\n\n/**\n * The purpose of this class is to offer a quick way to initialize the XComponents in a setup\n * project. It allows to receive all the options in {@link InstallXOptions} which is an extension\n * of {@link XPluginOptions} with all the options for the plugin and some options more.\n *\n * This class does multiple things:\n * 1. Install the {@link XPlugin} with the {@link XPluginOptions}.\n * 2. Creates the public {@link XAPI} and add it to global window.\n * 3. Creates the Vue Application for the customer project.\n *\n * The steps 2 & 3 are optional and depends on the options passed in {@link InstallXOptions}.\n *\n * @example The way to use this class is the next:\n * 1. Create the installer passing in the {@link InstallXOptions}. This only save the options:\n *\n * ```\n * const installer = new XInstaller(installXOptions)\n * ```\n *\n * 2. Initialize passing the {@link SnippetConfig}. This installs the plugin and creates the App.\n * There are 3 different ways to do this:\n *\n * 2.1 Using the created installer:\n *\n * ```\n * installer.init(snippetConfig)\n * ```\n *\n * 2.2 If the API option is enabled (`createAPI` is `true` in {@link InstallXOptions}, or\n * is not present as the default value is `true`) then this init step can be done with\n * the Public API:\n *\n * ```\n * window.InterfaceX.init(snippetConfig)\n * ```\n *\n * 2.3 When the script of the project build is loaded it searches for a global `initX`\n * variable that the customer must have in their website. This variable can be a\n * function that returns the {@link SnippetConfig} or an object that contains the\n * {@link SnippetConfig} itself:\n *\n * ```\n * window.initX = function() {\n * return {\n * instance,\n * env,\n * scope,\n * lang,\n * uiLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * };\n * ```\n *\n * ```\n * window.initX = {\n * instance,\n * env,\n * scope,\n * lang,\n * uiLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * ```\n *\n * @public\n */\nexport class XInstaller {\n private app!: App;\n private api?: XAPI;\n\n /**\n * The configuration coming from the snippet {@link SnippetConfig}.\n *\n * @internal\n */\n protected snippetConfig?: NormalisedSnippetConfig;\n\n /**\n * Receives the {@link InstallXOptions} and merges it with the default fallback options. Also\n * creates the public {@link XAPI}.\n *\n * @remarks Auto initializes the Vue application if window.initX is defined as a function or\n * object specifying the {@link SnippetConfig | snippet config}.\n *\n *\n * @param options - The {@link InstallXOptions}.\n *\n * @public\n */\n public constructor(protected readonly options: InstallXOptions) {\n this.createAPI();\n }\n\n /**\n * Creates the public {@link XAPI} using the `api` option from {@link InstallXOptions}. If this\n * `api` option is not passed, then a default {@link BaseXAPI} is created. To disable the API\n * creation the value `false` must be passed in the `api` option.\n *\n * @internal\n */\n protected createAPI(): void {\n const { api } = this.options;\n if (api !== false) {\n this.api = api ?? new BaseXAPI();\n this.api.setInitCallback(this.init.bind(this));\n this.api.setSnippetConfigCallback(this.updateSnippetConfig.bind(this));\n this.api.setSnippetConfigGetter(this.getSnippetConfig.bind(this));\n window.InterfaceX = this.api;\n }\n }\n\n /**\n * Retrieves the {@link SnippetConfig | snippet config} it is defined in the window.initX.\n *\n * @returns The snippet config if it is defined or undefined otherwise.\n *\n * @internal\n */\n private retrieveSnippetConfig(): SnippetConfig | undefined {\n if (typeof window.initX === 'function') {\n return window.initX();\n } else if (typeof window.initX === 'object') {\n return window.initX;\n }\n }\n\n /**\n * Receives the {@link SnippetConfig | snippet config} or retrieves it from window.initX and\n * installs the plugin and initializes the Vue application.\n *\n * @param snippetConfig - The {@link SnippetConfig} that receives from snippet integration.\n *\n * @returns If {@link SnippetConfig | snippet config} is passed or configured in window.initX,\n * returns an object with the {@link XAPI}, the {@link @empathyco/x-bus#XBus}, the {@link XPlugin}\n * and the Vue application instance. Else, a rejected promise is returned.\n *\n * @public\n */\n init(snippetConfig: SnippetConfig): Promise<InitWrapper>;\n init(): Promise<InitWrapper | void>;\n async init(snippetConfig = this.retrieveSnippetConfig()): Promise<InitWrapper | void> {\n if (snippetConfig) {\n this.snippetConfig = reactive(this.normaliseSnippetConfig(snippetConfig));\n this.createApp();\n const bus = this.createBus();\n const pluginOptions = this.getPluginOptions();\n const plugin = this.installPlugin(pluginOptions, bus);\n await this.installExtraPlugins(bus);\n this.api?.setBus(bus);\n this.app.mount(this.getMountingTarget(this.options.domElement));\n\n return {\n api: this.api,\n app: this.app,\n bus,\n plugin\n };\n }\n\n return Promise.resolve();\n }\n\n /**\n * Creates the {@link XPluginOptions} object.\n *\n * @returns The {@link XPluginOptions} object.\n *\n * @internal\n */\n protected getPluginOptions(): XPluginOptions {\n const { adapter, store, initialXModules, xModules, __PRIVATE__xModules } = this.options;\n return {\n adapter,\n store,\n xModules,\n initialXModules,\n __PRIVATE__xModules\n };\n }\n\n /**\n * This method returns the bus instance to be used in the {@link XPlugin} and in the {@link XAPI}.\n * It returns the `bus` parameter in the {@link InstallXOptions} or if not provided, then\n * creates a new instance of {@link @empathyco/x-bus#XPriorityBus | bus}.\n *\n * @returns XBus - The bus instance.\n *\n * @internal\n */\n protected createBus(): XBus<XEventsTypes, WireMetadata> {\n return this.options.bus ?? bus;\n }\n\n /**\n * Creates and install the Vue Plugin. If `plugin` parameter is passed in the\n * {@link InstallXOptions}, then it is used. If not, then a new instance of {@link XPlugin} is\n * created and installed.\n *\n * @param pluginOptions - The {@link XPluginOptions} to passed as parameter to the install method\n * of the plugin.\n * @param bus - The {@link @empathyco/x-bus#XBus} to be used to create the XPlugin.\n *\n * @returns Plugin<XPluginOption> - The plugin instance.\n * @internal\n */\n protected installPlugin(\n pluginOptions: XPluginOptions,\n bus: XBus<XEventsTypes, WireMetadata>\n ): Plugin<XPluginOptions> {\n const plugin = this.options.plugin ?? new XPlugin(bus);\n this.app.use(plugin, pluginOptions);\n return plugin;\n }\n\n /**\n * Runs the installExtraPlugins callback defined in the {@link InstallXOptions}\n * to allow the user to install more plugins to the App.\n *\n * @param bus - The events bus used in the application.\n * @returns An empty promise.\n * @internal\n */\n protected installExtraPlugins(bus: XBus<XEventsTypes, WireMetadata>): Promise<void> {\n return Promise.resolve(\n this.options.installExtraPlugins?.({ app: this.app, snippet: this.snippetConfig!, bus })\n );\n }\n\n /**\n * In the case that the `rootComponent` parameter is present in the {@link InstallXOptions},\n * then a new Vue application is created using that component as root.\n *\n * @internal\n */\n protected createApp(): void {\n if (this.options.rootComponent !== undefined) {\n this.app = createApp(this.options.rootComponent);\n this.app.provide('snippetConfig', this.snippetConfig);\n this.options.onCreateApp?.(this.app);\n }\n }\n\n protected normaliseSnippetConfig(snippetConfig: SnippetConfig): NormalisedSnippetConfig;\n protected normaliseSnippetConfig(snippetConfig: Partial<SnippetConfig>): Partial<SnippetConfig>;\n /**\n * Transforms the snippet configuration.\n * - If `lang` is provided and `uiLang` is not, it sets `uiLang=lang`.\n *\n * @param snippetConfig - The snippet config to normalise.\n * @returns The normalised version of the given snippet config.\n * @internal\n */\n protected normaliseSnippetConfig(\n snippetConfig: SnippetConfig | Partial<SnippetConfig>\n ): NormalisedSnippetConfig | Partial<SnippetConfig> {\n if (snippetConfig.lang) {\n snippetConfig.uiLang ??= snippetConfig.lang;\n }\n return snippetConfig;\n }\n\n /**\n * It returns the HTML element to mount the Vue Application. If the `domElement` parameter in\n * the {@link InstallXOptions} is an Element or an element selector, then this will be used.\n * The `domElement` can also be a function with the {@link SnippetConfig} as parameter which\n * returns an Element or element selector to use.\n * If it is not present, a new <div> Element is created and appended to the body.\n *\n * @param domElement - {@link InstallXOptions.domElement | Element, string or function} Used\n * to mount the Vue Application.\n *\n * @returns The Element to use as mounting target for the Vue Application.\n * @internal\n */\n protected getMountingTarget(domElement?: InstallXOptions['domElement']): Element {\n if (isFunction(domElement)) {\n domElement = domElement(this.snippetConfig!);\n }\n if (typeof domElement === 'string') {\n const target = document.querySelector(domElement);\n if (!target) {\n throw Error(\n `XComponents app couldn't be mounted: Element \"${domElement}\" couldn't be found`\n );\n }\n return target;\n }\n return domElement ?? document.body.appendChild(document.createElement('div'));\n }\n\n /**\n * It updates all the provided properties from the current snippet config.\n *\n * @param newSnippetConfig - All the properties to be updated in the {@link SnippetConfig}.\n *\n * @internal\n */\n protected updateSnippetConfig(newSnippetConfig: Partial<SnippetConfig>): void {\n if (!this.snippetConfig) {\n return;\n }\n forEach(this.normaliseSnippetConfig(newSnippetConfig), (name, value) => {\n this.snippetConfig![name] = value;\n });\n }\n\n /**\n * Getter for the snippet config object.\n *\n * @returns The {@link NormalisedSnippetConfig | snippetConfig} object.\n *\n * @public\n */\n protected getSnippetConfig(): NormalisedSnippetConfig {\n return this.snippetConfig!;\n }\n}\n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9C,SAAA;AACD,QAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAClD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,MAAM,KAAK,CACT,CAAA,8CAAA,EAAiD,UAAU,CAAA,mBAAA,CAAqB,CACjF,CAAC;AACH,aAAA;AACD,YAAA,OAAO,MAAM,CAAC;AACf,SAAA;AACD,QAAA,OAAO,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;KAC/E;AAED;;;;;;AAMG;AACO,IAAA,mBAAmB,CAAC,gBAAwC,EAAA;AACpE,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,OAAO;AACR,SAAA;AACD,QAAA,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAI;AACrE,YAAA,IAAI,CAAC,aAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AACpC,SAAC,CAAC,CAAC;KACJ;AAED;;;;;;AAMG;IACO,gBAAgB,GAAA;QACxB,OAAO,IAAI,CAAC,aAAc,CAAC;KAC5B;AACF;;;;"}
1
+ {"version":3,"file":"x-installer.js","sources":["../../../../src/x-installer/x-installer/x-installer.ts"],"sourcesContent":["import { forEach, isFunction } from '@empathyco/x-utils';\nimport { App, createApp, reactive, Plugin } from 'vue';\nimport { XBus } from '@empathyco/x-bus';\nimport { XPlugin } from '../../plugins/x-plugin';\nimport { XPluginOptions } from '../../plugins/x-plugin.types';\nimport { NormalisedSnippetConfig, SnippetConfig, XAPI } from '../api/api.types';\nimport { BaseXAPI } from '../api/base-api';\nimport { WireMetadata, XEventsTypes } from '../../wiring/index';\nimport { bus } from '../../plugins/x-bus';\nimport { InitWrapper, InstallXOptions } from './types';\n\ndeclare global {\n interface Window {\n InterfaceX?: XAPI;\n initX?: (() => SnippetConfig) | SnippetConfig;\n }\n}\n\n/**\n * The purpose of this class is to offer a quick way to initialize the XComponents in a setup\n * project. It allows to receive all the options in {@link InstallXOptions} which is an extension\n * of {@link XPluginOptions} with all the options for the plugin and some options more.\n *\n * This class does multiple things:\n * 1. Install the {@link XPlugin} with the {@link XPluginOptions}.\n * 2. Creates the public {@link XAPI} and add it to global window.\n * 3. Creates the Vue Application for the customer project.\n *\n * The steps 2 & 3 are optional and depends on the options passed in {@link InstallXOptions}.\n *\n * @example The way to use this class is the next:\n * 1. Create the installer passing in the {@link InstallXOptions}. This only save the options:\n *\n * ```\n * const installer = new XInstaller(installXOptions)\n * ```\n *\n * 2. Initialize passing the {@link SnippetConfig}. This installs the plugin and creates the App.\n * There are 3 different ways to do this:\n *\n * 2.1 Using the created installer:\n *\n * ```\n * installer.init(snippetConfig)\n * ```\n *\n * 2.2 If the API option is enabled (`createAPI` is `true` in {@link InstallXOptions}, or\n * is not present as the default value is `true`) then this init step can be done with\n * the Public API:\n *\n * ```\n * window.InterfaceX.init(snippetConfig)\n * ```\n *\n * 2.3 When the script of the project build is loaded it searches for a global `initX`\n * variable that the customer must have in their website. This variable can be a\n * function that returns the {@link SnippetConfig} or an object that contains the\n * {@link SnippetConfig} itself:\n *\n * ```\n * window.initX = function() {\n * return {\n * instance,\n * env,\n * scope,\n * lang,\n * uiLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * };\n * ```\n *\n * ```\n * window.initX = {\n * instance,\n * env,\n * scope,\n * lang,\n * uiLang,\n * currency,\n * consent,\n * documentDirection\n * };\n * ```\n *\n * @public\n */\nexport class XInstaller {\n private app!: App;\n private api?: XAPI;\n\n /**\n * The configuration coming from the snippet {@link SnippetConfig}.\n *\n * @internal\n */\n protected snippetConfig?: NormalisedSnippetConfig;\n\n /**\n * Receives the {@link InstallXOptions} and merges it with the default fallback options. Also\n * creates the public {@link XAPI}.\n *\n * @remarks Auto initializes the Vue application if window.initX is defined as a function or\n * object specifying the {@link SnippetConfig | snippet config}.\n *\n *\n * @param options - The {@link InstallXOptions}.\n *\n * @public\n */\n public constructor(protected readonly options: InstallXOptions) {\n this.createAPI();\n }\n\n /**\n * Creates the public {@link XAPI} using the `api` option from {@link InstallXOptions}. If this\n * `api` option is not passed, then a default {@link BaseXAPI} is created. To disable the API\n * creation the value `false` must be passed in the `api` option.\n *\n * @internal\n */\n protected createAPI(): void {\n const { api } = this.options;\n if (api !== false) {\n this.api = api ?? new BaseXAPI();\n this.api.setInitCallback(this.init.bind(this));\n this.api.setSnippetConfigCallback(this.updateSnippetConfig.bind(this));\n this.api.setSnippetConfigGetter(this.getSnippetConfig.bind(this));\n window.InterfaceX = this.api;\n }\n }\n\n /**\n * Retrieves the {@link SnippetConfig | snippet config} it is defined in the window.initX.\n *\n * @returns The snippet config if it is defined or undefined otherwise.\n *\n * @internal\n */\n private retrieveSnippetConfig(): SnippetConfig | undefined {\n if (typeof window.initX === 'function') {\n return window.initX();\n } else if (typeof window.initX === 'object') {\n return window.initX;\n }\n }\n\n /**\n * Receives the {@link SnippetConfig | snippet config} or retrieves it from window.initX and\n * installs the plugin and initializes the Vue application.\n *\n * @param snippetConfig - The {@link SnippetConfig} that receives from snippet integration.\n *\n * @returns If {@link SnippetConfig | snippet config} is passed or configured in window.initX,\n * returns an object with the {@link XAPI}, the {@link @empathyco/x-bus#XBus}, the {@link XPlugin}\n * and the Vue application instance. Else, a rejected promise is returned.\n *\n * @public\n */\n init(snippetConfig: SnippetConfig): Promise<InitWrapper>;\n init(): Promise<InitWrapper | void>;\n async init(snippetConfig = this.retrieveSnippetConfig()): Promise<InitWrapper | void> {\n if (snippetConfig) {\n this.snippetConfig = reactive(this.normaliseSnippetConfig(snippetConfig));\n this.createApp();\n const bus = this.createBus();\n const pluginOptions = this.getPluginOptions();\n const plugin = this.installPlugin(pluginOptions, bus);\n await this.installExtraPlugins(bus);\n this.api?.setBus(bus);\n this.app.mount(this.getMountingTarget(this.options.domElement));\n\n return {\n api: this.api,\n app: this.app,\n bus,\n plugin\n };\n }\n\n return Promise.resolve();\n }\n\n /**\n * Creates the {@link XPluginOptions} object.\n *\n * @returns The {@link XPluginOptions} object.\n *\n * @internal\n */\n protected getPluginOptions(): XPluginOptions {\n const { adapter, store, initialXModules, xModules, __PRIVATE__xModules } = this.options;\n return {\n adapter,\n store,\n xModules,\n initialXModules,\n __PRIVATE__xModules\n };\n }\n\n /**\n * This method returns the bus instance to be used in the {@link XPlugin} and in the {@link XAPI}.\n * It returns the `bus` parameter in the {@link InstallXOptions} or if not provided, then\n * creates a new instance of {@link @empathyco/x-bus#XPriorityBus | bus}.\n *\n * @returns XBus - The bus instance.\n *\n * @internal\n */\n protected createBus(): XBus<XEventsTypes, WireMetadata> {\n return this.options.bus ?? bus;\n }\n\n /**\n * Creates and install the Vue Plugin. If `plugin` parameter is passed in the\n * {@link InstallXOptions}, then it is used. If not, then a new instance of {@link XPlugin} is\n * created and installed.\n *\n * @param pluginOptions - The {@link XPluginOptions} to passed as parameter to the install method\n * of the plugin.\n * @param bus - The {@link @empathyco/x-bus#XBus} to be used to create the XPlugin.\n *\n * @returns Plugin<XPluginOption> - The plugin instance.\n * @internal\n */\n protected installPlugin(\n pluginOptions: XPluginOptions,\n bus: XBus<XEventsTypes, WireMetadata>\n ): Plugin<XPluginOptions> {\n const plugin = this.options.plugin ?? new XPlugin(bus);\n this.app.use(plugin, pluginOptions);\n return plugin;\n }\n\n /**\n * Runs the installExtraPlugins callback defined in the {@link InstallXOptions}\n * to allow the user to install more plugins to the App.\n *\n * @param bus - The events bus used in the application.\n * @returns An empty promise.\n * @internal\n */\n protected installExtraPlugins(bus: XBus<XEventsTypes, WireMetadata>): Promise<void> {\n return Promise.resolve(\n this.options.installExtraPlugins?.({ app: this.app, snippet: this.snippetConfig!, bus })\n );\n }\n\n /**\n * In the case that the `rootComponent` parameter is present in the {@link InstallXOptions},\n * then a new Vue application is created using that component as root.\n *\n * @internal\n */\n protected createApp(): void {\n if (this.options.rootComponent !== undefined) {\n this.app = createApp(this.options.rootComponent);\n this.app.provide('snippetConfig', this.snippetConfig);\n this.options.onCreateApp?.(this.app);\n }\n }\n\n protected normaliseSnippetConfig(snippetConfig: SnippetConfig): NormalisedSnippetConfig;\n protected normaliseSnippetConfig(snippetConfig: Partial<SnippetConfig>): Partial<SnippetConfig>;\n /**\n * Transforms the snippet configuration.\n * - If `lang` is provided and `uiLang` is not, it sets `uiLang=lang`.\n *\n * @param snippetConfig - The snippet config to normalise.\n * @returns The normalised version of the given snippet config.\n * @internal\n */\n protected normaliseSnippetConfig(\n snippetConfig: SnippetConfig | Partial<SnippetConfig>\n ): NormalisedSnippetConfig | Partial<SnippetConfig> {\n if (snippetConfig.lang) {\n snippetConfig.uiLang ??= snippetConfig.lang;\n }\n return snippetConfig;\n }\n\n /**\n * It returns the HTML element to mount the Vue Application. If the `domElement` parameter in\n * the {@link InstallXOptions} is an Element or an element selector, then this will be used.\n * The `domElement` can also be a function with the {@link SnippetConfig} as parameter which\n * returns an Element or element selector to use.\n * If it is not present, a new <div> Element is created and appended to the body.\n *\n * @param domElement - {@link InstallXOptions.domElement} Element, ShadowRoot, string or function\n * used to mount the Vue Application.\n *\n * @returns The Element or ShadowRoot to use as mounting target for the Vue Application.\n * @internal\n */\n protected getMountingTarget(domElement?: InstallXOptions['domElement']): Element | ShadowRoot {\n if (isFunction(domElement)) {\n domElement = domElement(this.snippetConfig!);\n }\n if (typeof domElement === 'string') {\n const target = document.querySelector(domElement);\n if (!target) {\n throw Error(\n `XComponents app couldn't be mounted: Element \"${domElement}\" couldn't be found`\n );\n }\n return target;\n }\n return domElement ?? document.body.appendChild(document.createElement('div'));\n }\n\n /**\n * It updates all the provided properties from the current snippet config.\n *\n * @param newSnippetConfig - All the properties to be updated in the {@link SnippetConfig}.\n *\n * @internal\n */\n protected updateSnippetConfig(newSnippetConfig: Partial<SnippetConfig>): void {\n if (!this.snippetConfig) {\n return;\n }\n forEach(this.normaliseSnippetConfig(newSnippetConfig), (name, value) => {\n this.snippetConfig![name] = value;\n });\n }\n\n /**\n * Getter for the snippet config object.\n *\n * @returns The {@link NormalisedSnippetConfig | snippetConfig} object.\n *\n * @public\n */\n protected getSnippetConfig(): NormalisedSnippetConfig {\n return this.snippetConfig!;\n }\n}\n"],"names":[],"mappings":";;;;;;AAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEG;MACU,UAAU,CAAA;AAWrB;;;;;;;;;;;AAWG;AACH,IAAA,WAAA,CAAsC,OAAwB,EAAA;QAAxB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAiB;QAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;KAClB;AAED;;;;;;AAMG;IACO,SAAS,GAAA;AACjB,QAAA,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,QAAQ,EAAE,CAAC;AACjC,YAAA,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/C,YAAA,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACvE,YAAA,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAClE,YAAA,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC;AAC9B,SAAA;KACF;AAED;;;;;;AAMG;IACK,qBAAqB,GAAA;AAC3B,QAAA,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU,EAAE;AACtC,YAAA,OAAO,MAAM,CAAC,KAAK,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CAAC;KACtB;AAED;;;;;;;;;;;;AAYG;AACO,IAAA,iBAAiB,CAAC,UAA0C,EAAA;AACpE,QAAA,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;AAC1B,YAAA,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,aAAc,CAAC,CAAC;AAC9C,SAAA;AACD,QAAA,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAClD,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,MAAM,KAAK,CACT,CAAA,8CAAA,EAAiD,UAAU,CAAA,mBAAA,CAAqB,CACjF,CAAC;AACH,aAAA;AACD,YAAA,OAAO,MAAM,CAAC;AACf,SAAA;AACD,QAAA,OAAO,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;KAC/E;AAED;;;;;;AAMG;AACO,IAAA,mBAAmB,CAAC,gBAAwC,EAAA;AACpE,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,OAAO;AACR,SAAA;AACD,QAAA,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAI;AACrE,YAAA,IAAI,CAAC,aAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;AACpC,SAAC,CAAC,CAAC;KACJ;AAED;;;;;;AAMG;IACO,gBAAgB,GAAA;QACxB,OAAO,IAAI,CAAC,aAAc,CAAC;KAC5B;AACF;;;;"}
@@ -1,3 +1,4 @@
1
+ import '@empathyco/x-utils';
1
2
  import { createStoreEmitters } from '../../../store/utils/store-emitters.utils.js';
2
3
  import { deviceXStoreModule } from './module.js';
3
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/device/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { deviceXStoreModule } from './module';\n\n/**\n * {@link StoreEmitters} For the device module.\n *\n * @internal\n */\nexport const deviceEmitters = createStoreEmitters(deviceXStoreModule, {});\n"],"names":[],"mappings":";;;AAGA;;;;AAIG;AACU,MAAA,cAAc,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,EAAE;;;;"}
1
+ {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/device/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { deviceXStoreModule } from './module';\n\n/**\n * {@link StoreEmitters} For the device module.\n *\n * @internal\n */\nexport const deviceEmitters = createStoreEmitters(deviceXStoreModule, {});\n"],"names":[],"mappings":";;;;AAGA;;;;AAIG;AACU,MAAA,cAAc,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,EAAE;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from './empathize.vue2.js';
2
- import { openBlock, createBlock, resolveDynamicComponent, withCtx, withDirectives, createElementVNode, withModifiers, createCommentVNode, renderSlot, vShow } from 'vue';
2
+ import { openBlock, createBlock, resolveDynamicComponent, withCtx, withDirectives, createElementVNode, withModifiers, renderSlot, vShow } from 'vue';
3
3
  import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
4
4
 
5
5
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -17,7 +17,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
17
17
  "data-test": "empathize"
18
18
  },
19
19
  [
20
- createCommentVNode(" @slot (Required) Modal container content "),
21
20
  renderSlot(_ctx.$slots, "default")
22
21
  ],
23
22
  544
@@ -1 +1 @@
1
- {"version":3,"file":"empathize.vue.js","sources":["../../../../../src/x-modules/empathize/components/empathize.vue"],"sourcesContent":["<template>\n <component :is=\"animation\">\n <div\n v-show=\"isOpen && hasContent\"\n ref=\"empathizeRef\"\n @mousedown.prevent\n @focusin=\"open\"\n @focusout=\"close\"\n class=\"x-empathize\"\n data-test=\"empathize\"\n >\n <!-- @slot (Required) Modal container content -->\n <slot />\n </div>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType, ref } from 'vue';\n import { NoAnimation } from '../../../components';\n import { use$x, useDebounce } from '../../../composables';\n import { AnimationProp } from '../../../types';\n import { XEvent } from '../../../wiring';\n import { empathizeXModule } from '../x-module';\n import { getActiveElement } from '../../../utils/html';\n\n /**\n * Component containing the empathize. It has a required slot to define its content and two props\n * to define when to open and close it: `eventsToOpenEmpathize` and `eventsToCloseEmpathize`.\n *\n * @public\n */\n export default defineComponent({\n name: 'Empathize',\n xModule: empathizeXModule.name,\n props: {\n /** Array of {@link XEvent} to open the empathize. */\n eventsToOpenEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => ['UserFocusedSearchBox', 'UserIsTypingAQuery', 'UserClickedSearchBox']\n },\n /** Array of {@link XEvent} to close the empathize. */\n eventsToCloseEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => [\n 'UserClosedEmpathize',\n 'UserSelectedASuggestion',\n 'UserPressedEnterKey',\n 'UserBlurredSearchBox'\n ]\n },\n /** Animation component that will be used to animate the empathize. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n }\n },\n setup(props) {\n const $x = use$x();\n\n const empathizeRef = ref<HTMLDivElement>();\n\n const isOpen = ref(false);\n const hasContent = ref(!!empathizeRef.value?.children.length);\n\n /**\n * Changes the state of {@link Empathize.isOpen} assigning to it the value of `newOpen`\n * parameter. Also emits the {@link XEvent} `EmpathizeOpened` or `EmpathizeClosed` if\n * the state really changes.\n *\n * @param newOpen - The new open state to assign to {@link Empathize.isOpen}.\n */\n const changeOpen = useDebounce((newOpen: boolean) => {\n if (isOpen.value !== newOpen) {\n isOpen.value = newOpen;\n const empathizeEvent = isOpen.value ? 'EmpathizeOpened' : 'EmpathizeClosed';\n $x.emit(empathizeEvent, undefined, { target: empathizeRef.value });\n }\n }, 0);\n\n /**\n * Open empathize. This method will be executed on any event in\n * {@link Empathize.eventsToOpenEmpathize} and on DOM event `focusin` on Empathize root\n * element.\n */\n function open() {\n hasContent.value = !!empathizeRef.value?.children.length;\n if (hasContent.value) {\n changeOpen(true);\n }\n }\n\n /**\n * Close empathize. This method will be executed on any event in\n * {@link Empathize.eventsToCloseEmpathize} and on DOM event `focusout` on Empathize root\n * element.\n */\n function close() {\n const activeElement = getActiveElement();\n if (!empathizeRef.value?.contains(activeElement)) {\n changeOpen(false);\n }\n }\n\n props.eventsToOpenEmpathize.forEach(event => $x.on(event, false).subscribe(open));\n props.eventsToCloseEmpathize.forEach(event => $x.on(event, false).subscribe(close));\n\n return {\n close,\n empathizeRef,\n hasContent,\n isOpen,\n open\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`EmpathizeOpened`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `true`. The event\n payload is undefined and can have a metadata with the module and the element that emitted it.\n- [`EmpathizeClosed`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `false`. The event\n payload is undefined and can have a metadata with the module and the element that emitted it.\n\n## Examples\n\nThis component will listen to the configured events in `eventsToOpenEmpathize` and\n`eventsToCloseEmpathize` props and open/close itself accordingly. By default, those props values\nare:\n\n- Open: `UserFocusedSearchBox`, `'`UserIsTypingAQuery`, `'`UserClickedSearchBox` and\n- Close: `UserClosedEmpathize`, `UserSelectedASuggestion`, `UserPressedEnter`,\n 'UserBlurredSearchBox`\n\n### Basic examples\n\nThe component rendering the query suggestions, popular searches and history queries with keyboard\nnavigation.\n\n```vue\n<Empathize>\n <template #default>\n <BaseKeyboardNavigation>\n <QuerySuggestions/>\n <PopularSearches/>\n <HistoryQueries/>\n </BaseKeyboardNavigation>\n </template>\n</Empathize>\n```\n\nDefining custom values for the events to open and close the Empathize. For example opening it when\nthe search box loses the focus and closing it when the search box receives the focus:\n\n```vue\n<Empathize\n :eventsToOpenEmpathize=\"['UserBlurredSearchBox']\"\n :eventsToCloseEmpathize=\"['UserFocusedSearchBox']\"\n>\n <template #default>\n Please, type a query in the Search Box.\n </template>\n</Empathize>\n```\n\nAn animation can be used for the opening and closing using the `animation` prop. The animation, must\nbe a Component with a `Transition` with a slot inside:\n\n```vue\n<Empathize :animation=\"collapseFromTop\">\n <template #default>\n <PopularSearches/>\n </template>\n</Empathize>\n```\n</docs>\n"],"names":["_createBlock","_resolveDynamicComponent","_withCtx","_withDirectives","_createElementVNode","_withModifiers","_createCommentVNode","isOpen","hasContent"],"mappings":";;;;SAAA,WAaU,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;sBAXNA,WAWM,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA,IAAA,EAAA;AAAA,IAAA,OAAA,EATAC,OAAc,CAAA,MAAA;AAAA,MACRC,cAAA,CAAAC,kBAAA;AAAA,QAAA,KAAA;AAAA,QALhB;AAAA,UAMO,GAAA,EAAA,cAAA;AAAA,UACA,aAAQ,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,aAAA,CAAA,MAAA;AAAA,WAAA,EAAA,CAAA,SAAA,CAAA,CAAA,CAAA;AAAA,UACX,WAAM,MAAa,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,IAAA,IAAA,IAAA,CAAA,IAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,UACnB,UAAA,EAAS,OAAC,CAAW,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,KAAA,IAAA,IAAA,CAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,UAAA,KAAA,EAAA,aAAA;AAErB,UAAA,WAAA,EAAA,WAAA;AAAA,SAAA;AACA,QAAA;AAAA,UAAAC,kBAAA,CAAA,4CAAA,CAAA;qBATQC,IAAUC,CAAAA,MAAAA,EAAAA,SAAAA,CAAAA;AAAAA,SAAAA;;;;;AAHxB,OAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"empathize.vue.js","sources":["../../../../../src/x-modules/empathize/components/empathize.vue"],"sourcesContent":["<template>\n <component :is=\"animation\">\n <div\n v-show=\"isOpen && hasContent\"\n ref=\"empathizeRef\"\n @mousedown.prevent\n @focusin=\"open\"\n @focusout=\"close\"\n class=\"x-empathize\"\n data-test=\"empathize\"\n >\n <!-- @slot (Required) Modal container content -->\n <slot />\n </div>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType, ref, computed } from 'vue';\n import { NoAnimation } from '../../../components';\n import { use$x, useDebounce } from '../../../composables';\n import { AnimationProp } from '../../../types';\n import { XEvent } from '../../../wiring';\n import { empathizeXModule } from '../x-module';\n import { getActiveElement } from '../../../utils/html';\n\n /**\n * Component containing the empathize. It has a required slot to define its content and two props\n * to define when to open and close it: `eventsToOpenEmpathize` and `eventsToCloseEmpathize`.\n *\n * @public\n */\n export default defineComponent({\n name: 'Empathize',\n xModule: empathizeXModule.name,\n props: {\n /** Array of {@link XEvent} to open the empathize. */\n eventsToOpenEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => ['UserFocusedSearchBox', 'UserIsTypingAQuery', 'UserClickedSearchBox']\n },\n /** Array of {@link XEvent} to close the empathize. */\n eventsToCloseEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => [\n 'UserClosedEmpathize',\n 'UserSelectedASuggestion',\n 'UserPressedEnterKey',\n 'UserBlurredSearchBox'\n ]\n },\n /** Animation component that will be used to animate the empathize. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n }\n },\n setup(props) {\n const $x = use$x();\n\n const empathizeRef = ref<HTMLDivElement>();\n\n const isOpen = ref(false);\n const hasContent = computed(() => !!empathizeRef.value?.children?.length);\n\n /**\n * Changes the state of {@link Empathize.isOpen} assigning to it the value of `newOpen`\n * parameter. Also emits the {@link XEvent} `EmpathizeOpened` or `EmpathizeClosed` if\n * the state really changes.\n *\n * @param newOpen - The new open state to assign to {@link Empathize.isOpen}.\n */\n const changeOpen = useDebounce((newOpen: boolean) => {\n if (isOpen.value !== newOpen) {\n isOpen.value = newOpen;\n const empathizeEvent = isOpen.value ? 'EmpathizeOpened' : 'EmpathizeClosed';\n $x.emit(empathizeEvent, undefined, { target: empathizeRef.value });\n }\n }, 0);\n\n /**\n * Open empathize. This method will be executed on any event in\n * {@link Empathize.eventsToOpenEmpathize} and on DOM event `focusin` on Empathize root\n * element.\n */\n function open() {\n if (hasContent.value) {\n changeOpen(true);\n }\n }\n\n /**\n * Close empathize. This method will be executed on any event in\n * {@link Empathize.eventsToCloseEmpathize} and on DOM event `focusout` on Empathize root\n * element.\n */\n function close() {\n const activeElement = getActiveElement();\n if (!empathizeRef.value?.contains(activeElement)) {\n changeOpen(false);\n }\n }\n\n props.eventsToOpenEmpathize.forEach(event => $x.on(event, false).subscribe(open));\n props.eventsToCloseEmpathize.forEach(event => $x.on(event, false).subscribe(close));\n\n return {\n close,\n empathizeRef,\n hasContent,\n isOpen,\n open\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`EmpathizeOpened`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `true`. The event\n payload is undefined and can have a metadata with the module and the element that emitted it.\n- [`EmpathizeClosed`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `false`. The event\n payload is undefined and can have a metadata with the module and the element that emitted it.\n\n## Examples\n\nThis component will listen to the configured events in `eventsToOpenEmpathize` and\n`eventsToCloseEmpathize` props and open/close itself accordingly. By default, those props values\nare:\n\n- Open: `UserFocusedSearchBox`, `'`UserIsTypingAQuery`, `'`UserClickedSearchBox` and\n- Close: `UserClosedEmpathize`, `UserSelectedASuggestion`, `UserPressedEnter`,\n 'UserBlurredSearchBox`\n\n### Basic examples\n\nThe component rendering the query suggestions, popular searches and history queries with keyboard\nnavigation.\n\n```vue\n<Empathize>\n <template #default>\n <BaseKeyboardNavigation>\n <QuerySuggestions/>\n <PopularSearches/>\n <HistoryQueries/>\n </BaseKeyboardNavigation>\n </template>\n</Empathize>\n```\n\nDefining custom values for the events to open and close the Empathize. For example opening it when\nthe search box loses the focus and closing it when the search box receives the focus:\n\n```vue\n<Empathize\n :eventsToOpenEmpathize=\"['UserBlurredSearchBox']\"\n :eventsToCloseEmpathize=\"['UserFocusedSearchBox']\"\n>\n <template #default>\n Please, type a query in the Search Box.\n </template>\n</Empathize>\n```\n\nAn animation can be used for the opening and closing using the `animation` prop. The animation, must\nbe a Component with a `Transition` with a slot inside:\n\n```vue\n<Empathize :animation=\"collapseFromTop\">\n <template #default>\n <PopularSearches/>\n </template>\n</Empathize>\n```\n</docs>\n"],"names":["_createBlock","_resolveDynamicComponent","_withCtx","_withDirectives","_createElementVNode","_withModifiers","isOpen","hasContent"],"mappings":";;;;SAAA,WAaU,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;sBAXNA,WAWM,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA,IAAA,EAAA;AAAA,IAAA,OAAA,EATAC,OAAc,CAAA,MAAA;AAAA,MACRC,cAAA,CAAAC,kBAAA;AAAA,QAAA,KAAA;AAAA,QALhB;AAAA,UAMO,GAAA,EAAA,cAAA;AAAA,UACA,aAAQ,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,aAAA,CAAA,MAAA;AAAA,WAAA,EAAA,CAAA,SAAA,CAAA,CAAA,CAAA;AAAA,UACX,WAAM,MAAa,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,IAAA,IAAA,IAAA,CAAA,IAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,UACnB,UAAA,EAAS,OAAC,CAAW,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,KAAA,IAAA,IAAA,CAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,UAAA,KAAA,EAAA,aAAA;UAGrB,WAAQ,EAAA,WAAA;AAAA,SAAA;;qBATAC,IAAUC,CAAAA,MAAAA,EAAAA,SAAAA,CAAAA;AAAAA,SAAAA;;;;;AAHxB,OAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}