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

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 (823) hide show
  1. package/CHANGELOG.md +522 -0
  2. package/core/index.js +8 -1
  3. package/core/index.js.map +1 -1
  4. package/design-system/deprecated-full-theme.css +1647 -1648
  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.basetogglepanel.md +3 -3
  49. package/docs/API-reference/api/x-components.basevariablecolumngrid.md +3 -3
  50. package/docs/API-reference/api/x-components.cancelfetchandsaverelatedprompts.md +13 -0
  51. package/docs/API-reference/api/x-components.configmutations.config.md +11 -0
  52. package/docs/API-reference/api/x-components.configmutations.md +29 -0
  53. package/docs/API-reference/api/x-components.configmutations.mergeconfig.md +24 -0
  54. package/docs/API-reference/api/x-components.configmutations.setconfig.md +24 -0
  55. package/docs/API-reference/api/x-components.createrelatedtagsquerygetter.md +26 -0
  56. package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.getrelatedtags.md +13 -0
  57. package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.md +20 -0
  58. package/docs/API-reference/api/x-components.createtrackrelatedprompttoolingdisplayclickwire.md +19 -0
  59. package/docs/API-reference/api/x-components.createtracktoolingadd2cartwire.md +19 -0
  60. package/docs/API-reference/api/x-components.createtracktoolingdisplaywire.md +19 -0
  61. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice._constructor_.md → x-components.defaultexternaltaggingservice._constructor_.md} +3 -3
  62. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.add_to_cart_id_key.md +13 -0
  63. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.instance.md +13 -0
  64. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.localstorageservice.md +11 -0
  65. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.md +43 -0
  66. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.movetosessionstorage.md → x-components.defaultexternaltaggingservice.movetosessionstorage.md} +2 -2
  67. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.result_clicked_id_key.md +13 -0
  68. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.sessionstorageservice.md +11 -0
  69. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storagekey.md +11 -0
  70. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storagettlms.md +11 -0
  71. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.store.md → x-components.defaultexternaltaggingservice.store.md} +2 -2
  72. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storeaddtocart.md +24 -0
  73. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.storeresultclicked.md → x-components.defaultexternaltaggingservice.storeresultclicked.md} +3 -3
  74. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.trackaddtocart.md → x-components.defaultexternaltaggingservice.trackaddtocart.md} +3 -3
  75. package/docs/API-reference/api/x-components.displayclickprovider.md +66 -0
  76. package/docs/API-reference/api/x-components.empathize.md +6 -6
  77. package/docs/API-reference/api/x-components.empathizemutations.md +1 -1
  78. package/docs/API-reference/api/x-components.externaltaggingservice.md +23 -0
  79. package/docs/API-reference/api/{x-components.pdpaddtocartservice.movetosessionstorage.md → x-components.externaltaggingservice.movetosessionstorage.md} +2 -2
  80. package/docs/API-reference/api/x-components.externaltaggingservice.storeaddtocart.md +24 -0
  81. package/docs/API-reference/api/{x-components.pdpaddtocartservice.storeresultclicked.md → x-components.externaltaggingservice.storeresultclicked.md} +3 -3
  82. package/docs/API-reference/api/{x-components.pdpaddtocartservice.trackaddtocart.md → x-components.externaltaggingservice.trackaddtocart.md} +3 -3
  83. package/docs/API-reference/api/x-components.facets.md +3 -3
  84. package/docs/API-reference/api/x-components.facetsmutations.md +1 -1
  85. package/docs/API-reference/api/x-components.featurelocation.md +1 -1
  86. package/docs/API-reference/api/x-components.fetchandsaverelatedprompts.md +13 -0
  87. package/docs/API-reference/api/x-components.fetchrelatedprompts.md +13 -0
  88. package/docs/API-reference/api/x-components.filterslist.md +3 -3
  89. package/docs/API-reference/api/x-components.globalxbus.md +14 -0
  90. package/docs/API-reference/api/x-components.hierarchicalfilter.md +9 -2
  91. package/docs/API-reference/api/x-components.historyqueriesmutations.md +1 -1
  92. package/docs/API-reference/api/x-components.historyqueriesstate.md +1 -1
  93. package/docs/API-reference/api/x-components.identifierresults.md +3 -3
  94. package/docs/API-reference/api/x-components.identifierresultsmutations.md +1 -1
  95. package/docs/API-reference/api/x-components.identifierresultsstate.md +1 -1
  96. package/docs/API-reference/api/x-components.installxoptions.domelement.md +1 -1
  97. package/docs/API-reference/api/x-components.installxoptions.installextraplugins.md +2 -2
  98. package/docs/API-reference/api/x-components.installxoptions.md +1 -1
  99. package/docs/API-reference/api/x-components.itemslist.md +3 -3
  100. package/docs/API-reference/api/x-components.mainmodal.md +2 -2
  101. package/docs/API-reference/api/x-components.md +38 -3
  102. package/docs/API-reference/api/x-components.mergeconfig.md +27 -0
  103. package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +5 -5
  104. package/docs/API-reference/api/x-components.myhistory.md +3 -3
  105. package/docs/API-reference/api/x-components.nextqueriesgroup.md +22 -0
  106. package/docs/API-reference/api/x-components.nextqueriesgroup.modelname.md +11 -0
  107. package/docs/API-reference/api/x-components.nextqueriesgroup.nextqueries.md +11 -0
  108. package/docs/API-reference/api/x-components.nextquerieslist.md +3 -3
  109. package/docs/API-reference/api/x-components.nextqueriesmutations.md +1 -1
  110. package/docs/API-reference/api/x-components.nextqueriesstate.md +1 -1
  111. package/docs/API-reference/api/x-components.pageselector.md +80 -0
  112. package/docs/API-reference/api/x-components.partialresultslist.md +3 -3
  113. package/docs/API-reference/api/x-components.popularsearchesmutations.md +1 -1
  114. package/docs/API-reference/api/x-components.promotedslist.md +3 -3
  115. package/docs/API-reference/api/x-components.queriespreviewmutations.md +1 -1
  116. package/docs/API-reference/api/x-components.queryfeature.md +1 -1
  117. package/docs/API-reference/api/x-components.querymutations.md +20 -0
  118. package/docs/API-reference/api/x-components.querymutations.setquery.md +24 -0
  119. package/docs/API-reference/api/x-components.querypreviewlist.md +3 -3
  120. package/docs/API-reference/api/x-components.querystate.md +20 -0
  121. package/docs/API-reference/api/x-components.querystate.query.md +13 -0
  122. package/docs/API-reference/api/x-components.querysuggestionsmutations.md +1 -1
  123. package/docs/API-reference/api/x-components.querysuggestionsstate.md +1 -1
  124. package/docs/API-reference/api/x-components.recommendations.md +3 -3
  125. package/docs/API-reference/api/x-components.recommendationsmutations.md +1 -1
  126. package/docs/API-reference/api/x-components.relatedprompt.md +33 -0
  127. package/docs/API-reference/api/x-components.relatedpromptsactioncontext.md +15 -0
  128. package/docs/API-reference/api/x-components.relatedpromptsactions.cancelfetchandsaverelatedprompts.md +17 -0
  129. package/docs/API-reference/api/x-components.relatedpromptsactions.fetchandsaverelatedprompts.md +24 -0
  130. package/docs/API-reference/api/x-components.relatedpromptsactions.fetchrelatedprompts.md +24 -0
  131. package/docs/API-reference/api/x-components.relatedpromptsactions.md +23 -0
  132. package/docs/API-reference/api/x-components.relatedpromptsactions.seturlparams.md +24 -0
  133. package/docs/API-reference/api/x-components.relatedpromptsgetters.md +21 -0
  134. package/docs/API-reference/api/x-components.relatedpromptsgetters.query.md +13 -0
  135. package/docs/API-reference/api/x-components.relatedpromptsgetters.request.md +13 -0
  136. package/docs/API-reference/api/x-components.relatedpromptslist.md +72 -0
  137. package/docs/API-reference/api/x-components.relatedpromptsmutations.md +27 -0
  138. package/docs/API-reference/api/x-components.relatedpromptsmutations.resetrelatedpromptsstate.md +17 -0
  139. package/docs/API-reference/api/x-components.relatedpromptsmutations.resetselectedprompt.md +17 -0
  140. package/docs/API-reference/api/x-components.relatedpromptsmutations.setparams.md +24 -0
  141. package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsproducts.md +24 -0
  142. package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsrelatedtags.md +24 -0
  143. package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedprompt.md +24 -0
  144. package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedquery.md +24 -0
  145. package/docs/API-reference/api/x-components.relatedpromptsstate.md +25 -0
  146. package/docs/API-reference/api/x-components.relatedpromptsstate.params.md +13 -0
  147. package/docs/API-reference/api/x-components.relatedpromptsstate.relatedprompts.md +13 -0
  148. package/docs/API-reference/api/x-components.relatedpromptsstate.relatedtags.md +13 -0
  149. package/docs/API-reference/api/x-components.relatedpromptsstate.selectedprompt.md +13 -0
  150. package/docs/API-reference/api/x-components.relatedpromptsstate.selectedquery.md +13 -0
  151. package/docs/API-reference/api/x-components.relatedpromptstaglist.md +72 -0
  152. package/docs/API-reference/api/x-components.relatedpromptsxevents.md +25 -0
  153. package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md +13 -0
  154. package/docs/API-reference/api/x-components.relatedpromptsxevents.selectedrelatedpromptchanged.md +13 -0
  155. package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptadd2cart.md +13 -0
  156. package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptresult.md +13 -0
  157. package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedprompt.md +13 -0
  158. package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedpromptquery.md +13 -0
  159. package/docs/API-reference/api/x-components.relatedpromptsxmodule.md +13 -0
  160. package/docs/API-reference/api/x-components.relatedpromptsxstoremodule.md +15 -0
  161. package/docs/API-reference/api/x-components.relatedtags.md +3 -3
  162. package/docs/API-reference/api/x-components.relatedtagsmutations.md +1 -1
  163. package/docs/API-reference/api/x-components.relatedtagsstate.md +1 -1
  164. package/docs/API-reference/api/x-components.resultfeature.md +1 -1
  165. package/docs/API-reference/api/x-components.resultslist.md +3 -3
  166. package/docs/API-reference/api/x-components.scrolltotop.md +5 -5
  167. package/docs/API-reference/api/x-components.searchboxmutations.md +1 -1
  168. package/docs/API-reference/api/x-components.searchboxstate.md +1 -1
  169. package/docs/API-reference/api/x-components.searchconfig.md +1 -0
  170. package/docs/API-reference/api/x-components.searchconfig.pagemode.md +11 -0
  171. package/docs/API-reference/api/x-components.searchinputplaceholder.md +3 -3
  172. package/docs/API-reference/api/x-components.searchmutations.md +2 -1
  173. package/docs/API-reference/api/x-components.searchmutations.setstats.md +24 -0
  174. package/docs/API-reference/api/x-components.searchstate.md +2 -1
  175. package/docs/API-reference/api/x-components.searchstate.stats.md +13 -0
  176. package/docs/API-reference/api/x-components.searchxevents.md +1 -0
  177. package/docs/API-reference/api/x-components.searchxevents.userselectedapage.md +13 -0
  178. package/docs/API-reference/api/x-components.selectedfilterslist.md +3 -3
  179. package/docs/API-reference/api/x-components.semanticqueriesgetters.md +1 -0
  180. package/docs/API-reference/api/x-components.semanticqueriesgetters.query.md +13 -0
  181. package/docs/API-reference/api/x-components.semanticqueriesmutations.md +2 -1
  182. package/docs/API-reference/api/x-components.semanticqueriesmutations.setsemanticqueriesrelatedtags.md +24 -0
  183. package/docs/API-reference/api/x-components.semanticqueriesstate.md +2 -1
  184. package/docs/API-reference/api/x-components.semanticqueriesstate.relatedtags.md +13 -0
  185. package/docs/API-reference/api/x-components.setconfig.md +27 -0
  186. package/docs/API-reference/api/x-components.setquery.md +25 -0
  187. package/docs/API-reference/api/x-components.seturlprompt.md +13 -0
  188. package/docs/API-reference/api/x-components.simplefilter.md +7 -0
  189. package/docs/API-reference/api/x-components.singlecolumnlayout.md +3 -3
  190. package/docs/API-reference/api/x-components.slidingpanel.md +13 -5
  191. package/docs/API-reference/api/x-components.snippetcallbacks.md +7 -0
  192. package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
  193. package/docs/API-reference/api/x-components.tagging.md +6 -6
  194. package/docs/API-reference/api/x-components.taggingconfig.md +2 -2
  195. package/docs/API-reference/api/{x-components.taggingconfig.clickedresultstoragekey.md → x-components.taggingconfig.storagekey.md} +3 -3
  196. package/docs/API-reference/api/x-components.taggingconfig.storagettlms.md +13 -0
  197. package/docs/API-reference/api/x-components.taggingmutations.md +1 -1
  198. package/docs/API-reference/api/x-components.taggingxevents.md +1 -1
  199. package/docs/API-reference/api/x-components.taggingxevents.resulturltrackingenabled.md +1 -1
  200. package/docs/API-reference/api/x-components.trackrelatedprompttoolingdisplayclickwire.md +13 -0
  201. package/docs/API-reference/api/x-components.tracktoolingadd2cartwire.md +13 -0
  202. package/docs/API-reference/api/x-components.tracktoolingdisplayclickedwire.md +13 -0
  203. package/docs/API-reference/api/x-components.typing.md +13 -0
  204. package/docs/API-reference/api/x-components.typingoptions.md +22 -0
  205. package/docs/API-reference/api/x-components.typingoptions.speed.md +13 -0
  206. package/docs/API-reference/api/x-components.typingoptions.targetattr.md +18 -0
  207. package/docs/API-reference/api/x-components.typingoptions.text.md +13 -0
  208. package/docs/API-reference/api/x-components.urlmutations.md +2 -1
  209. package/docs/API-reference/api/x-components.urlmutations.setprompt.md +24 -0
  210. package/docs/API-reference/api/x-components.urlparams.md +1 -0
  211. package/docs/API-reference/api/x-components.urlparams.prompt.md +11 -0
  212. package/docs/API-reference/api/x-components.urlstate.md +1 -1
  213. package/docs/API-reference/api/x-components.usealiasapi.md +1 -0
  214. package/docs/API-reference/api/x-components.usealiasapi.pricestats.md +16 -0
  215. package/docs/API-reference/api/x-components.xeventstypes.md +3 -3
  216. package/docs/API-reference/api/x-components.xmodulestree.md +1 -0
  217. package/docs/API-reference/api/x-components.xmodulestree.relatedprompts.md +11 -0
  218. package/docs/API-reference/api/x-types.md +2 -0
  219. package/docs/API-reference/api/x-types.relatedprompt.md +4 -1
  220. package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +1 -1
  221. package/docs/API-reference/api/x-types.relatedprompt.relatedpromptnextqueries.md +13 -0
  222. package/docs/API-reference/api/x-types.relatedprompt.tagging.md +17 -0
  223. package/docs/API-reference/api/x-types.relatedprompt.toolingdisplaytagging.md +13 -0
  224. package/docs/API-reference/api/x-types.relatedpromptnextquery.md +23 -0
  225. package/docs/API-reference/api/x-types.relatedpromptnextquery.query.md +13 -0
  226. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayadd2carttagging.md +13 -0
  227. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayclicktagging.md +13 -0
  228. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplaytagging.md +13 -0
  229. package/docs/API-reference/api/x-types.searchresponse.md +1 -0
  230. package/docs/API-reference/api/x-types.searchresponse.stats.md +11 -0
  231. package/docs/API-reference/api/x-types.stats.md +22 -0
  232. package/docs/API-reference/api/x-types.stats.price.md +14 -0
  233. package/docs/API-reference/components/common/result/x-components.base-result-image.md +2 -2
  234. package/docs/API-reference/components/common/x-components.base-slider.md +189 -0
  235. package/docs/API-reference/components/common/x-components.display-click-provider.md +17 -0
  236. package/docs/API-reference/components/common/x-components.items-list.md +1 -1
  237. package/docs/API-reference/components/common/x-components.page-selector.md +136 -0
  238. package/docs/API-reference/components/common/x-components.sliding-panel.md +7 -7
  239. package/docs/API-reference/components/facets/x-components.facets/facets.md +1 -1
  240. package/docs/API-reference/components/facets/x-components.lists/selected-filters-list.md +1 -1
  241. package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +22 -0
  242. package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +196 -0
  243. package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +32 -0
  244. package/docs/API-reference/components/search/x-components.results-list.md +1 -1
  245. package/docs/API-reference/components/tagging/x-components.tagging.md +15 -16
  246. package/js/components/animations/fade-and-slide.vue.js +1 -2
  247. package/js/components/animations/fade-and-slide.vue.js.map +1 -1
  248. package/js/components/base-dropdown.vue.js +1 -3
  249. package/js/components/base-dropdown.vue.js.map +1 -1
  250. package/js/components/base-dropdown.vue2.js +1 -7
  251. package/js/components/base-dropdown.vue2.js.map +1 -1
  252. package/js/components/base-event-button.vue.js +1 -2
  253. package/js/components/base-event-button.vue.js.map +1 -1
  254. package/js/components/base-grid.vue.js +11 -18
  255. package/js/components/base-grid.vue.js.map +1 -1
  256. package/js/components/base-grid.vue2.js.map +1 -1
  257. package/js/components/base-grid.vue3.js +1 -1
  258. package/js/components/base-keyboard-navigation.vue.js +1 -2
  259. package/js/components/base-keyboard-navigation.vue.js.map +1 -1
  260. package/js/components/base-rating.vue.js +1 -3
  261. package/js/components/base-rating.vue.js.map +1 -1
  262. package/js/components/base-slider.vue.js +65 -0
  263. package/js/components/base-slider.vue.js.map +1 -0
  264. package/js/components/base-slider.vue2.js +109 -0
  265. package/js/components/base-slider.vue2.js.map +1 -0
  266. package/js/components/base-slider.vue3.js +7 -0
  267. package/js/components/base-slider.vue3.js.map +1 -0
  268. package/js/components/base-switch.vue.js.map +1 -1
  269. package/js/components/base-switch.vue2.js +3 -7
  270. package/js/components/base-switch.vue2.js.map +1 -1
  271. package/js/components/base-variable-column-grid.vue.js +1 -2
  272. package/js/components/base-variable-column-grid.vue.js.map +1 -1
  273. package/js/components/column-picker/base-column-picker-dropdown.vue.js +1 -3
  274. package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
  275. package/js/components/column-picker/base-column-picker-list.vue.js +1 -3
  276. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  277. package/js/components/display-click-provider.vue.js +74 -0
  278. package/js/components/display-click-provider.vue.js.map +1 -0
  279. package/js/components/display-click-provider.vue2.js +6 -0
  280. package/js/components/display-click-provider.vue2.js.map +1 -0
  281. package/js/components/filters/labels/base-rating-filter-label.vue.js +1 -3
  282. package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
  283. package/js/components/icons/cross-tiny.vue.js +2 -2
  284. package/js/components/icons/plus.vue.js +2 -2
  285. package/js/components/items-list.vue.js +1 -2
  286. package/js/components/items-list.vue.js.map +1 -1
  287. package/js/components/items-list.vue2.js +2 -2
  288. package/js/components/items-list.vue2.js.map +1 -1
  289. package/js/components/layouts/fixed-header-and-asides-layout.vue.js +1 -7
  290. package/js/components/layouts/fixed-header-and-asides-layout.vue.js.map +1 -1
  291. package/js/components/layouts/multi-column-max-width-layout.vue.js +1 -9
  292. package/js/components/layouts/multi-column-max-width-layout.vue.js.map +1 -1
  293. package/js/components/layouts/single-column-layout.vue.js +1 -9
  294. package/js/components/layouts/single-column-layout.vue.js.map +1 -1
  295. package/js/components/modals/base-events-modal-close.vue.js +1 -2
  296. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  297. package/js/components/modals/base-events-modal-open.vue.js +1 -2
  298. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  299. package/js/components/modals/base-id-modal-close.vue.js +1 -2
  300. package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
  301. package/js/components/modals/base-id-modal-open.vue.js +1 -2
  302. package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
  303. package/js/components/modals/base-modal.vue.js +1 -2
  304. package/js/components/modals/base-modal.vue.js.map +1 -1
  305. package/js/components/modals/base-modal.vue2.js +13 -6
  306. package/js/components/modals/base-modal.vue2.js.map +1 -1
  307. package/js/components/page-loader-button.vue.js +8 -10
  308. package/js/components/page-loader-button.vue.js.map +1 -1
  309. package/js/components/page-loader-button.vue2.js.map +1 -1
  310. package/js/components/page-loader-button.vue3.js +7 -0
  311. package/js/components/page-loader-button.vue3.js.map +1 -0
  312. package/js/components/page-selector.vue.js +78 -0
  313. package/js/components/page-selector.vue.js.map +1 -0
  314. package/js/components/page-selector.vue2.js +128 -0
  315. package/js/components/page-selector.vue2.js.map +1 -0
  316. package/js/components/page-selector.vue3.js +7 -0
  317. package/js/components/page-selector.vue3.js.map +1 -0
  318. package/js/components/panels/base-header-toggle-panel.vue.js +1 -5
  319. package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
  320. package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -2
  321. package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
  322. package/js/components/panels/base-id-toggle-panel.vue.js +1 -2
  323. package/js/components/panels/base-id-toggle-panel.vue.js.map +1 -1
  324. package/js/components/panels/base-tabs-panel.vue.js +1 -4
  325. package/js/components/panels/base-tabs-panel.vue.js.map +1 -1
  326. package/js/components/panels/base-toggle-panel.vue.js +1 -2
  327. package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
  328. package/js/components/result/base-result-add-to-cart.vue.js +3 -3
  329. package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
  330. package/js/components/result/base-result-add-to-cart.vue2.js +19 -5
  331. package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
  332. package/js/components/result/base-result-current-price.vue.js +1 -2
  333. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  334. package/js/components/result/base-result-image.vue.js +39 -59
  335. package/js/components/result/base-result-image.vue.js.map +1 -1
  336. package/js/components/result/base-result-image.vue2.js +5 -5
  337. package/js/components/result/base-result-image.vue2.js.map +1 -1
  338. package/js/components/result/base-result-link.vue.js +1 -2
  339. package/js/components/result/base-result-link.vue.js.map +1 -1
  340. package/js/components/result/base-result-previous-price.vue.js +1 -2
  341. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  342. package/js/components/result/base-result-rating.vue.js +1 -4
  343. package/js/components/result/base-result-rating.vue.js.map +1 -1
  344. package/js/components/result/result-variant-selector.vue.js +1 -3
  345. package/js/components/result/result-variant-selector.vue.js.map +1 -1
  346. package/js/components/sliding-panel.vue.js +3 -6
  347. package/js/components/sliding-panel.vue.js.map +1 -1
  348. package/js/components/sliding-panel.vue2.js +2 -2
  349. package/js/components/sliding-panel.vue2.js.map +1 -1
  350. package/js/components/suggestions/base-suggestion.vue.js +1 -2
  351. package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
  352. package/js/components/suggestions/base-suggestions.vue.js +1 -2
  353. package/js/components/suggestions/base-suggestions.vue.js.map +1 -1
  354. package/js/composables/use-alias-api.js +4 -1
  355. package/js/composables/use-alias-api.js.map +1 -1
  356. package/js/composables/use-getter.js +1 -1
  357. package/js/composables/use-state.js +1 -1
  358. package/js/directives/typing.js +58 -0
  359. package/js/directives/typing.js.map +1 -0
  360. package/js/index.js +20 -4
  361. package/js/index.js.map +1 -1
  362. package/js/types/animation-prop.js +5 -0
  363. package/js/types/animation-prop.js.map +1 -1
  364. package/js/x-installer/x-installer/x-installer.js +3 -3
  365. package/js/x-installer/x-installer/x-installer.js.map +1 -1
  366. package/js/x-modules/device/store/emitters.js +1 -0
  367. package/js/x-modules/device/store/emitters.js.map +1 -1
  368. package/js/x-modules/empathize/components/empathize.vue.js +1 -2
  369. package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
  370. package/js/x-modules/empathize/components/empathize.vue2.js +8 -3
  371. package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
  372. package/js/x-modules/empathize/store/emitters.js +1 -0
  373. package/js/x-modules/empathize/store/emitters.js.map +1 -1
  374. package/js/x-modules/experience-controls/store/emitters.js +1 -0
  375. package/js/x-modules/experience-controls/store/emitters.js.map +1 -1
  376. package/js/x-modules/extra-params/components/extra-params.vue.js +1 -1
  377. package/js/x-modules/extra-params/components/extra-params.vue.js.map +1 -1
  378. package/js/x-modules/extra-params/store/emitters.js +1 -0
  379. package/js/x-modules/extra-params/store/emitters.js.map +1 -1
  380. package/js/x-modules/facets/components/facets/facets.vue.js +20 -33
  381. package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
  382. package/js/x-modules/facets/components/facets/facets.vue2.js +2 -2
  383. package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
  384. package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -2
  385. package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
  386. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +1 -6
  387. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  388. package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js +1 -3
  389. package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js.map +1 -1
  390. package/js/x-modules/facets/components/filters/number-range-filter.vue.js +1 -3
  391. package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
  392. package/js/x-modules/facets/components/filters/simple-filter.vue.js +1 -3
  393. package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
  394. package/js/x-modules/facets/components/lists/filters-list.vue.js +1 -2
  395. package/js/x-modules/facets/components/lists/filters-list.vue.js.map +1 -1
  396. package/js/x-modules/facets/components/lists/filters-search.vue.js +1 -3
  397. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  398. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js +11 -18
  399. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
  400. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js +2 -2
  401. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
  402. package/js/x-modules/facets/components/lists/sliced-filters.vue.js +1 -4
  403. package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
  404. package/js/x-modules/history-queries/components/clear-history-queries.vue.js +1 -2
  405. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  406. package/js/x-modules/history-queries/components/history-queries.vue.js +1 -10
  407. package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
  408. package/js/x-modules/history-queries/components/history-query.vue.js +1 -6
  409. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  410. package/js/x-modules/history-queries/components/my-history.vue.js +1 -4
  411. package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
  412. package/js/x-modules/history-queries/components/remove-history-query.vue.js +1 -2
  413. package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
  414. package/js/x-modules/history-queries/store/emitters.js +1 -0
  415. package/js/x-modules/history-queries/store/emitters.js.map +1 -1
  416. package/js/x-modules/identifier-results/components/identifier-results.vue.js +1 -2
  417. package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
  418. package/js/x-modules/identifier-results/store/emitters.js +1 -0
  419. package/js/x-modules/identifier-results/store/emitters.js.map +1 -1
  420. package/js/x-modules/next-queries/components/next-queries.vue.js +1 -7
  421. package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
  422. package/js/x-modules/next-queries/components/next-query-preview.vue.js +1 -3
  423. package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -1
  424. package/js/x-modules/next-queries/components/next-query.vue.js +1 -4
  425. package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
  426. package/js/x-modules/next-queries/store/emitters.js +1 -0
  427. package/js/x-modules/next-queries/store/emitters.js.map +1 -1
  428. package/js/x-modules/popular-searches/components/popular-search.vue.js +1 -4
  429. package/js/x-modules/popular-searches/components/popular-search.vue.js.map +1 -1
  430. package/js/x-modules/popular-searches/components/popular-searches.vue.js +1 -7
  431. package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
  432. package/js/x-modules/queries-preview/components/query-preview-button.vue.js +1 -2
  433. package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
  434. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +6 -0
  435. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
  436. package/js/x-modules/queries-preview/components/query-preview-list.vue.js.map +1 -1
  437. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +15 -2
  438. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
  439. package/js/x-modules/queries-preview/components/query-preview.vue.js +1 -2
  440. package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
  441. package/js/x-modules/queries-preview/components/query-preview.vue2.js +7 -1
  442. package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
  443. package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js +2 -1
  444. package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map +1 -1
  445. package/js/x-modules/queries-preview/store/emitters.js +1 -0
  446. package/js/x-modules/queries-preview/store/emitters.js.map +1 -1
  447. package/js/x-modules/queries-preview/store/module.js +1 -1
  448. package/js/x-modules/queries-preview/store/module.js.map +1 -1
  449. package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js +6 -4
  450. package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js.map +1 -1
  451. package/js/x-modules/query-suggestions/components/query-suggestion.vue.js +1 -4
  452. package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
  453. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js +1 -7
  454. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
  455. package/js/x-modules/query-suggestions/store/emitters.js +1 -0
  456. package/js/x-modules/query-suggestions/store/emitters.js.map +1 -1
  457. package/js/x-modules/recommendations/components/recommendations.vue.js +1 -2
  458. package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
  459. package/js/x-modules/recommendations/store/emitters.js +1 -0
  460. package/js/x-modules/recommendations/store/emitters.js.map +1 -1
  461. package/js/x-modules/related-prompts/components/related-prompt.vue.js +27 -0
  462. package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -0
  463. package/js/x-modules/related-prompts/components/related-prompt.vue2.js +31 -0
  464. package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -0
  465. package/js/x-modules/related-prompts/components/related-prompt.vue3.js +7 -0
  466. package/js/x-modules/related-prompts/components/related-prompt.vue3.js.map +1 -0
  467. package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +154 -0
  468. package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -0
  469. package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js +6 -0
  470. package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js.map +1 -0
  471. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +101 -0
  472. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -0
  473. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +221 -0
  474. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -0
  475. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +7 -0
  476. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js.map +1 -0
  477. package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js +29 -0
  478. package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js.map +1 -0
  479. package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js +20 -0
  480. package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js.map +1 -0
  481. package/js/x-modules/related-prompts/store/actions/set-url-params.action.js +15 -0
  482. package/js/x-modules/related-prompts/store/actions/set-url-params.action.js.map +1 -0
  483. package/js/x-modules/related-prompts/store/emitters.js +16 -0
  484. package/js/x-modules/related-prompts/store/emitters.js.map +1 -0
  485. package/js/x-modules/related-prompts/store/getters/related-prompts-query.getter.js +18 -0
  486. package/js/x-modules/related-prompts/store/getters/related-prompts-query.getter.js.map +1 -0
  487. package/js/x-modules/related-prompts/store/getters/request.getter.js +17 -0
  488. package/js/x-modules/related-prompts/store/getters/request.getter.js.map +1 -0
  489. package/js/x-modules/related-prompts/store/module.js +64 -0
  490. package/js/x-modules/related-prompts/store/module.js.map +1 -0
  491. package/js/x-modules/related-prompts/wiring.js +82 -0
  492. package/js/x-modules/related-prompts/wiring.js.map +1 -0
  493. package/js/x-modules/related-prompts/x-module.js +21 -0
  494. package/js/x-modules/related-prompts/x-module.js.map +1 -0
  495. package/js/x-modules/related-tags/components/related-tag.vue.js +1 -2
  496. package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
  497. package/js/x-modules/related-tags/components/related-tags.vue.js +1 -4
  498. package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
  499. package/js/x-modules/related-tags/store/emitters.js +1 -0
  500. package/js/x-modules/related-tags/store/emitters.js.map +1 -1
  501. package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -2
  502. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  503. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +6 -0
  504. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  505. package/js/x-modules/scroll/store/emitters.js +1 -0
  506. package/js/x-modules/scroll/store/emitters.js.map +1 -1
  507. package/js/x-modules/search/components/partial-results-list.vue.js +1 -2
  508. package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
  509. package/js/x-modules/search/components/results-list.vue.js +2 -2
  510. package/js/x-modules/search/components/results-list.vue.js.map +1 -1
  511. package/js/x-modules/search/components/sort-dropdown.vue.js +1 -3
  512. package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
  513. package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js +10 -3
  514. package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js.map +1 -1
  515. package/js/x-modules/search/store/actions/save-search-response.action.js +3 -1
  516. package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -1
  517. package/js/x-modules/search/store/emitters.js +1 -0
  518. package/js/x-modules/search/store/emitters.js.map +1 -1
  519. package/js/x-modules/search/store/module.js +9 -3
  520. package/js/x-modules/search/store/module.js.map +1 -1
  521. package/js/x-modules/search/wiring.js +4 -0
  522. package/js/x-modules/search/wiring.js.map +1 -1
  523. package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -2
  524. package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
  525. package/js/x-modules/search-box/components/search-button.vue.js +1 -2
  526. package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
  527. package/js/x-modules/search-box/store/emitters.js +1 -0
  528. package/js/x-modules/search-box/store/emitters.js.map +1 -1
  529. package/js/x-modules/semantic-queries/components/semantic-queries.vue.js +1 -3
  530. package/js/x-modules/semantic-queries/components/semantic-queries.vue.js.map +1 -1
  531. package/js/x-modules/semantic-queries/components/semantic-query.vue.js +1 -4
  532. package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
  533. package/js/x-modules/semantic-queries/store/getters/normalized-query.getter.js +1 -1
  534. package/js/x-modules/semantic-queries/store/getters/normalized-query.getter.js.map +1 -1
  535. package/js/x-modules/semantic-queries/store/getters/request.getter.js +5 -4
  536. package/js/x-modules/semantic-queries/store/getters/request.getter.js.map +1 -1
  537. package/js/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.js +18 -0
  538. package/js/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.js.map +1 -0
  539. package/js/x-modules/semantic-queries/store/module.js +8 -2
  540. package/js/x-modules/semantic-queries/store/module.js.map +1 -1
  541. package/js/x-modules/semantic-queries/wiring.js +5 -0
  542. package/js/x-modules/semantic-queries/wiring.js.map +1 -1
  543. package/js/x-modules/tagging/components/tagging.vue.js +8 -7
  544. package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
  545. package/js/x-modules/tagging/service/{pdp-add-to-cart.service.js → external-tagging.service.js} +56 -25
  546. package/js/x-modules/tagging/service/external-tagging.service.js.map +1 -0
  547. package/js/x-modules/tagging/store/emitters.js +1 -1
  548. package/js/x-modules/tagging/store/emitters.js.map +1 -1
  549. package/js/x-modules/tagging/store/module.js +7 -3
  550. package/js/x-modules/tagging/store/module.js.map +1 -1
  551. package/js/x-modules/tagging/wiring.js +110 -9
  552. package/js/x-modules/tagging/wiring.js.map +1 -1
  553. package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
  554. package/js/x-modules/url/components/url-handler.vue2.js +4 -5
  555. package/js/x-modules/url/components/url-handler.vue2.js.map +1 -1
  556. package/js/x-modules/url/store/emitters.js +1 -0
  557. package/js/x-modules/url/store/emitters.js.map +1 -1
  558. package/js/x-modules/url/store/getters/url-params.getter.js +2 -3
  559. package/js/x-modules/url/store/getters/url-params.getter.js.map +1 -1
  560. package/js/x-modules/url/store/initial-state.js +2 -1
  561. package/js/x-modules/url/store/initial-state.js.map +1 -1
  562. package/js/x-modules/url/store/module.js +3 -0
  563. package/js/x-modules/url/store/module.js.map +1 -1
  564. package/js/x-modules/url/wiring.js +10 -1
  565. package/js/x-modules/url/wiring.js.map +1 -1
  566. package/package.json +50 -49
  567. package/related-prompts/index.d.ts +1 -0
  568. package/related-prompts/index.js +9 -0
  569. package/report/x-adapter-platform.api.json +895 -67
  570. package/report/x-components.api.json +16383 -17149
  571. package/report/x-components.api.md +834 -215
  572. package/report/x-types.api.json +320 -4
  573. package/tagging/index.js +2 -2
  574. package/types/adapter/mocked-responses.d.ts +3 -0
  575. package/types/adapter/mocked-responses.d.ts.map +1 -1
  576. package/types/components/base-dropdown.vue.d.ts +5 -5
  577. package/types/components/base-dropdown.vue.d.ts.map +1 -1
  578. package/types/components/base-grid.vue.d.ts +3 -3
  579. package/types/components/base-slider.vue.d.ts +74 -0
  580. package/types/components/base-slider.vue.d.ts.map +1 -0
  581. package/types/components/base-switch.vue.d.ts +2 -1
  582. package/types/components/base-switch.vue.d.ts.map +1 -1
  583. package/types/components/base-variable-column-grid.vue.d.ts +3 -3
  584. package/types/components/display-click-provider.vue.d.ts +61 -0
  585. package/types/components/display-click-provider.vue.d.ts.map +1 -0
  586. package/types/components/global-x-bus.vue.d.ts +14 -0
  587. package/types/components/global-x-bus.vue.d.ts.map +1 -1
  588. package/types/components/index.d.ts +3 -0
  589. package/types/components/index.d.ts.map +1 -1
  590. package/types/components/items-list.vue.d.ts +3 -3
  591. package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +5 -5
  592. package/types/components/layouts/single-column-layout.vue.d.ts +3 -3
  593. package/types/components/modals/base-events-modal.vue.d.ts +2 -2
  594. package/types/components/modals/base-id-modal.vue.d.ts +2 -2
  595. package/types/components/modals/base-modal.vue.d.ts +10 -10
  596. package/types/components/modals/base-modal.vue.d.ts.map +1 -1
  597. package/types/components/modals/main-modal.vue.d.ts +2 -2
  598. package/types/components/page-selector.vue.d.ts +125 -0
  599. package/types/components/page-selector.vue.d.ts.map +1 -0
  600. package/types/components/panels/base-header-toggle-panel.vue.d.ts +5 -5
  601. package/types/components/panels/base-id-toggle-panel.vue.d.ts +5 -5
  602. package/types/components/panels/base-tabs-panel.vue.d.ts +8 -8
  603. package/types/components/panels/base-toggle-panel.vue.d.ts +3 -3
  604. package/types/components/result/base-result-add-to-cart.vue.d.ts +2 -0
  605. package/types/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
  606. package/types/components/result/base-result-image.vue.d.ts +10 -10
  607. package/types/components/result/base-result-image.vue.d.ts.map +1 -1
  608. package/types/components/sliding-panel.vue.d.ts +15 -5
  609. package/types/components/sliding-panel.vue.d.ts.map +1 -1
  610. package/types/components/snippet-callbacks.vue.d.ts +7 -0
  611. package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
  612. package/types/components/suggestions/base-suggestions.vue.d.ts +3 -3
  613. package/types/composables/use-alias-api.d.ts +5 -0
  614. package/types/composables/use-alias-api.d.ts.map +1 -1
  615. package/types/composables/use-store.d.ts +2 -2
  616. package/types/composables/use-store.d.ts.map +1 -1
  617. package/types/directives/index.d.ts +1 -0
  618. package/types/directives/index.d.ts.map +1 -1
  619. package/types/directives/typing.d.ts +35 -0
  620. package/types/directives/typing.d.ts.map +1 -0
  621. package/types/index.d.ts +1 -0
  622. package/types/index.d.ts.map +1 -1
  623. package/types/store/index.d.ts +4 -1
  624. package/types/store/index.d.ts.map +1 -1
  625. package/types/tailwind/plugin-options.d.ts +1 -2
  626. package/types/tailwind/plugin-options.d.ts.map +1 -1
  627. package/types/types/animation-prop.d.ts +6 -2
  628. package/types/types/animation-prop.d.ts.map +1 -1
  629. package/types/types/origin.d.ts +3 -3
  630. package/types/types/origin.d.ts.map +1 -1
  631. package/types/types/page-mode.d.ts +2 -0
  632. package/types/types/page-mode.d.ts.map +1 -0
  633. package/types/types/url-params.d.ts +1 -0
  634. package/types/types/url-params.d.ts.map +1 -1
  635. package/types/views/home/types.d.ts +3 -0
  636. package/types/views/home/types.d.ts.map +1 -1
  637. package/types/wiring/events.types.d.ts +3 -1
  638. package/types/wiring/events.types.d.ts.map +1 -1
  639. package/types/x-installer/x-installer/types.d.ts +2 -2
  640. package/types/x-installer/x-installer/types.d.ts.map +1 -1
  641. package/types/x-installer/x-installer/x-installer.d.ts +4 -4
  642. package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
  643. package/types/x-modules/empathize/components/empathize.vue.d.ts +6 -6
  644. package/types/x-modules/empathize/components/empathize.vue.d.ts.map +1 -1
  645. package/types/x-modules/facets/components/facets/facets.vue.d.ts +3 -3
  646. package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +9 -2
  647. package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
  648. package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +7 -0
  649. package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
  650. package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +3 -3
  651. package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +3 -3
  652. package/types/x-modules/history-queries/components/my-history.vue.d.ts +3 -3
  653. package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +3 -3
  654. package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +3 -3
  655. package/types/x-modules/next-queries/index.d.ts +1 -0
  656. package/types/x-modules/next-queries/index.d.ts.map +1 -1
  657. package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +3 -3
  658. package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts.map +1 -1
  659. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -1
  660. package/types/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.d.ts.map +1 -1
  661. package/types/x-modules/queries-preview/store/module.d.ts.map +1 -1
  662. package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts +4 -2
  663. package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts.map +1 -1
  664. package/types/x-modules/recommendations/components/recommendations.vue.d.ts +3 -3
  665. package/types/x-modules/related-prompts/components/index.d.ts +4 -0
  666. package/types/x-modules/related-prompts/components/index.d.ts.map +1 -0
  667. package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +28 -0
  668. package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -0
  669. package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +106 -0
  670. package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -0
  671. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +131 -0
  672. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -0
  673. package/types/x-modules/related-prompts/events.types.d.ts +41 -0
  674. package/types/x-modules/related-prompts/events.types.d.ts.map +1 -0
  675. package/types/x-modules/related-prompts/index.d.ts +6 -0
  676. package/types/x-modules/related-prompts/index.d.ts.map +1 -0
  677. package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts +17 -0
  678. package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts.map +1 -0
  679. package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts +13 -0
  680. package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts.map +1 -0
  681. package/types/x-modules/related-prompts/store/actions/set-url-params.action.d.ts +11 -0
  682. package/types/x-modules/related-prompts/store/actions/set-url-params.action.d.ts.map +1 -0
  683. package/types/x-modules/related-prompts/store/emitters.d.ts +10 -0
  684. package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -0
  685. package/types/x-modules/related-prompts/store/getters/index.d.ts +3 -0
  686. package/types/x-modules/related-prompts/store/getters/index.d.ts.map +1 -0
  687. package/types/x-modules/related-prompts/store/getters/related-prompts-query.getter.d.ts +13 -0
  688. package/types/x-modules/related-prompts/store/getters/related-prompts-query.getter.d.ts.map +1 -0
  689. package/types/x-modules/related-prompts/store/getters/request.getter.d.ts +14 -0
  690. package/types/x-modules/related-prompts/store/getters/request.getter.d.ts.map +1 -0
  691. package/types/x-modules/related-prompts/store/index.d.ts +6 -0
  692. package/types/x-modules/related-prompts/store/index.d.ts.map +1 -0
  693. package/types/x-modules/related-prompts/store/module.d.ts +8 -0
  694. package/types/x-modules/related-prompts/store/module.d.ts.map +1 -0
  695. package/types/x-modules/related-prompts/store/types.d.ts +125 -0
  696. package/types/x-modules/related-prompts/store/types.d.ts.map +1 -0
  697. package/types/x-modules/related-prompts/types.d.ts +10 -0
  698. package/types/x-modules/related-prompts/types.d.ts.map +1 -0
  699. package/types/x-modules/related-prompts/wiring.d.ts +42 -0
  700. package/types/x-modules/related-prompts/wiring.d.ts.map +1 -0
  701. package/types/x-modules/related-prompts/x-module.d.ts +16 -0
  702. package/types/x-modules/related-prompts/x-module.d.ts.map +1 -0
  703. package/types/x-modules/related-tags/components/related-tags.vue.d.ts +3 -3
  704. package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +5 -5
  705. package/types/x-modules/search/components/banners-list.vue.d.ts +3 -3
  706. package/types/x-modules/search/components/partial-results-list.vue.d.ts +3 -3
  707. package/types/x-modules/search/components/promoteds-list.vue.d.ts +3 -3
  708. package/types/x-modules/search/components/results-list.vue.d.ts +3 -3
  709. package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
  710. package/types/x-modules/search/config.types.d.ts +2 -0
  711. package/types/x-modules/search/config.types.d.ts.map +1 -1
  712. package/types/x-modules/search/events.types.d.ts +4 -0
  713. package/types/x-modules/search/events.types.d.ts.map +1 -1
  714. package/types/x-modules/search/store/actions/fetch-and-save-search-response.action.d.ts.map +1 -1
  715. package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -1
  716. package/types/x-modules/search/store/module.d.ts +2 -0
  717. package/types/x-modules/search/store/module.d.ts.map +1 -1
  718. package/types/x-modules/search/store/types.d.ts +9 -1
  719. package/types/x-modules/search/store/types.d.ts.map +1 -1
  720. package/types/x-modules/search/wiring.d.ts +4 -0
  721. package/types/x-modules/search/wiring.d.ts.map +1 -1
  722. package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +3 -3
  723. package/types/x-modules/semantic-queries/store/getters/index.d.ts +1 -0
  724. package/types/x-modules/semantic-queries/store/getters/index.d.ts.map +1 -1
  725. package/types/x-modules/semantic-queries/store/getters/normalized-query.getter.d.ts +1 -1
  726. package/types/x-modules/semantic-queries/store/getters/request.getter.d.ts +2 -1
  727. package/types/x-modules/semantic-queries/store/getters/request.getter.d.ts.map +1 -1
  728. package/types/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.d.ts +13 -0
  729. package/types/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.d.ts.map +1 -0
  730. package/types/x-modules/semantic-queries/store/module.d.ts.map +1 -1
  731. package/types/x-modules/semantic-queries/store/types.d.ts +13 -1
  732. package/types/x-modules/semantic-queries/store/types.d.ts.map +1 -1
  733. package/types/x-modules/semantic-queries/wiring.d.ts +3 -0
  734. package/types/x-modules/semantic-queries/wiring.d.ts.map +1 -1
  735. package/types/x-modules/tagging/components/tagging.vue.d.ts +14 -12
  736. package/types/x-modules/tagging/components/tagging.vue.d.ts.map +1 -1
  737. package/types/x-modules/tagging/config.types.d.ts +3 -3
  738. package/types/x-modules/tagging/config.types.d.ts.map +1 -1
  739. package/types/x-modules/tagging/events.types.d.ts +2 -2
  740. package/types/x-modules/tagging/service/{pdp-add-to-cart.service.d.ts → external-tagging.service.d.ts} +31 -13
  741. package/types/x-modules/tagging/service/external-tagging.service.d.ts.map +1 -0
  742. package/types/x-modules/tagging/service/index.d.ts +1 -1
  743. package/types/x-modules/tagging/service/index.d.ts.map +1 -1
  744. package/types/x-modules/tagging/service/types.d.ts +13 -4
  745. package/types/x-modules/tagging/service/types.d.ts.map +1 -1
  746. package/types/x-modules/tagging/store/module.d.ts.map +1 -1
  747. package/types/x-modules/tagging/wiring.d.ts +54 -2
  748. package/types/x-modules/tagging/wiring.d.ts.map +1 -1
  749. package/types/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
  750. package/types/x-modules/url/store/getters/url-params.getter.d.ts +2 -3
  751. package/types/x-modules/url/store/getters/url-params.getter.d.ts.map +1 -1
  752. package/types/x-modules/url/store/initial-state.d.ts.map +1 -1
  753. package/types/x-modules/url/store/module.d.ts.map +1 -1
  754. package/types/x-modules/url/store/types.d.ts +6 -0
  755. package/types/x-modules/url/store/types.d.ts.map +1 -1
  756. package/types/x-modules/url/wiring.d.ts +9 -0
  757. package/types/x-modules/url/wiring.d.ts.map +1 -1
  758. package/types/x-modules/x-modules.types.d.ts +2 -0
  759. package/types/x-modules/x-modules.types.d.ts.map +1 -1
  760. package/url/index.js +1 -1
  761. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.clickedresultstoragekey.md +0 -11
  762. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.clickedresultstoragettlms.md +0 -11
  763. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.instance.md +0 -13
  764. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.localstorageservice.md +0 -11
  765. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.md +0 -41
  766. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.result_clicked_id_key.md +0 -13
  767. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.sessionstorageservice.md +0 -11
  768. package/docs/API-reference/api/x-components.pdpaddtocartservice.md +0 -22
  769. package/docs/API-reference/api/x-components.taggingconfig.clickedresultstoragettlms.md +0 -13
  770. package/docs/API-reference/api/x-components.usestore.md +0 -19
  771. package/docs/assets/features/overview-my-history.svg +0 -279
  772. package/docs/assets/features/overview-product-results-card.svg +0 -128
  773. package/docs/assets/interface/build-search-ui.svg +0 -167
  774. package/docs/assets/interface/experience-search-intro.svg +0 -1
  775. package/docs/assets/interface/integration-guide.svg +0 -1
  776. package/docs/assets/interface/integration-video.png +0 -0
  777. package/docs/assets/interface/x-architecture.svg +0 -1
  778. package/docs/assets/interface/x-empathize.gif +0 -0
  779. package/docs/assets/interface/x-facets.gif +0 -0
  780. package/docs/assets/interface/x-facets.svg +0 -189
  781. package/docs/assets/interface/x-history-queries.gif +0 -0
  782. package/docs/assets/interface/x-id-results.gif +0 -0
  783. package/docs/assets/interface/x-next-queries.gif +0 -0
  784. package/docs/assets/interface/x-popular-searches.gif +0 -0
  785. package/docs/assets/interface/x-query-suggestions.gif +0 -0
  786. package/docs/assets/interface/x-recommendations.gif +0 -0
  787. package/docs/assets/interface/x-recommendations.svg +0 -472
  788. package/docs/assets/interface/x-related-tags.gif +0 -0
  789. package/docs/assets/interface/x-results-layout.svg +0 -259
  790. package/docs/assets/interface/x-search-box-elements.svg +0 -1
  791. package/docs/assets/interface/x-search-box.svg +0 -60
  792. package/docs/build-search-ui/README.md +0 -127
  793. package/docs/build-search-ui/sidebar.js +0 -7
  794. package/docs/build-search-ui/web-archetype-development-guide.md +0 -186
  795. package/docs/build-search-ui/web-archetype-integration-guide.md +0 -458
  796. package/docs/build-search-ui/web-how-to-use-x-components-guide.md +0 -200
  797. package/docs/build-search-ui/web-x-architecture.md +0 -83
  798. package/docs/build-search-ui/web-x-components-development-guide.md +0 -157
  799. package/docs/experience-search-and-discovery/README.md +0 -132
  800. package/docs/experience-search-and-discovery/empathize.md +0 -119
  801. package/docs/experience-search-and-discovery/facets-and-filters.md +0 -154
  802. package/docs/experience-search-and-discovery/history-queries.md +0 -70
  803. package/docs/experience-search-and-discovery/id-results.md +0 -49
  804. package/docs/experience-search-and-discovery/my-history.md +0 -60
  805. package/docs/experience-search-and-discovery/next-queries.md +0 -72
  806. package/docs/experience-search-and-discovery/popular-searches.md +0 -50
  807. package/docs/experience-search-and-discovery/product-results-ui.md +0 -82
  808. package/docs/experience-search-and-discovery/query-suggestions.md +0 -48
  809. package/docs/experience-search-and-discovery/recommendations.md +0 -134
  810. package/docs/experience-search-and-discovery/related-tags.md +0 -66
  811. package/docs/experience-search-and-discovery/search-box.md +0 -99
  812. package/docs/experience-search-and-discovery/serp-ui.md +0 -125
  813. package/docs/experience-search-and-discovery/sidebar.js +0 -17
  814. package/docs/experience-search-and-discovery/web-local-storage.md +0 -30
  815. package/docs/input-status-machine-state.png +0 -0
  816. package/js/composables/use-store.js +0 -15
  817. package/js/composables/use-store.js.map +0 -1
  818. package/js/utils/options-api.js +0 -4
  819. package/js/utils/options-api.js.map +0 -1
  820. package/js/x-modules/tagging/service/pdp-add-to-cart.service.js.map +0 -1
  821. package/types/utils/options-api.d.ts +0 -3
  822. package/types/utils/options-api.d.ts.map +0 -1
  823. package/types/x-modules/tagging/service/pdp-add-to-cart.service.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"search-button.vue.js","sources":["../../../../../src/x-modules/search-box/components/search-button.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonRef\"\n @click=\"emitEvents\"\n class=\"x-search-button x-button\"\n :class=\"dynamicClasses\"\n data-test=\"search-button\"\n >\n <!-- @slot _Required_. Button content (text, icon, or both) -->\n <slot><span class=\"x-icon\">⌕</span></slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { computed, ComputedRef, defineComponent, ref } from 'vue';\n import { VueCSSClasses } from '../../../utils/types';\n import { WireMetadata } from '../../../wiring/wiring.types';\n import { use$x } from '../../../composables/use-$x';\n import { useState } from '../../../composables/use-state';\n import { searchBoxXModule } from '../x-module';\n\n /**\n * This component renders a button to submit the query.\n *\n * @remarks\n * If query is not empty, it emits {@link XEventsTypes.UserAcceptedAQuery} and\n * {@link SearchBoxXEvents.UserPressedSearchButton} events with the query as payload.\n * It also adds `x-search-button--has-empty-query` as class when there is no query.\n *\n * @public\n */\n export default defineComponent({\n name: 'SearchButton',\n xModule: searchBoxXModule.name,\n setup: function () {\n const $x = use$x();\n\n const buttonRef = ref<HTMLElement | null>(null);\n\n const query: ComputedRef<string> = useState('searchBox', ['query']).query;\n\n const isQueryEmpty = computed(() => query.value.length === 0);\n\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-search-button--has-empty-query': isQueryEmpty.value\n }));\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n function createEventMetadata(): Omit<WireMetadata, 'moduleName'> {\n return {\n target: buttonRef.value,\n feature: 'search_box'\n };\n }\n\n /**\n * Emits events when the button is clicked.\n *\n * @public\n */\n function emitEvents() {\n if (!isQueryEmpty.value) {\n $x.emit('UserAcceptedAQuery', query.value, createEventMetadata());\n $x.emit('UserPressedSearchButton', query.value, createEventMetadata());\n }\n }\n\n return {\n dynamicClasses,\n buttonRef,\n emitEvents\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- [`UserPressedSearchButton`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n<!-- prettier-ignore-start -->\n:::warning\nNote that no events are emitted if the query is empty.\n:::\n<!-- prettier-ignore-end -->\n\n## Dynamic classes\n\n`SearchButton` uses the `x-search-button--has-empty-query` dynamic CSS class to modify the HTML\nbutton style when the query is empty.\n\n## See it in action\n\nIn this example, a clickable button is rendered.\n\n_Click the Search button to try it out!_\n\n```vue live\n<template>\n <SearchButton />\n</template>\n\n<script>\n import { SearchButton } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchButton\n }\n };\n</script>\n```\n\n### Play with default slot\n\nHere text is passed in the default slot instead of an icon to customize the button content.\n\n_Click the icon button to try it out!_\n\n```vue live\n<template>\n <SearchButton>Search</SearchButton>\n</template>\n\n<script>\n import { SearchButton } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchButton\n }\n };\n</script>\n```\n\n### Play with events\n\nIn this example, the `UserPressedSearchButton` event has been implemented so that when you enter a\nsearch term and click the Search button, the search term is displayed as a message.\n\n_Type any term in the input field and then click the Search button to try it out!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex;\">\n <SearchInput />\n <SearchButton\n @UserPressedSearchButton=\"\n query => {\n message = query;\n }\n \"\n />\n </div>\n {{ message }}\n </div>\n</template>\n\n<script>\n import { SearchInput, SearchButton } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchInput,\n SearchButton\n },\n data() {\n return {\n message: ''\n };\n }\n };\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `SearchButton` component\ncommunicates with the [`SearchInput`](./search-input.md) to submit the query. In this example, when\nyou enter a search term and click the Search button, the “Looking for results” message is displayed.\n\n_Type any term in the input field and then click the Search button to try it out!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex;\">\n <SearchInput />\n <SearchButton @UserAcceptedAQuery=\"message = 'looking for results'\">Search</SearchButton>\n </div>\n {{ message }}\n </div>\n</template>\n\n<script>\n import { SearchButton, SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchButton,\n SearchInput\n },\n data() {\n return {\n message: ''\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_createCommentVNode","_renderSlot"],"mappings":";;;;;;;;;;;SAEQ,WAAW,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;SACdA,SAAK,EAAA,EAAAC,kBAAA;AAAA,IAAA,QAAA;AAAA,IAAE;AAAA,MACR,GAAK,EAAA,WAAA;AAAA,MAEL,gBAAU,CAAe,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,MAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,0BAAA,EAAA,IAAA,CAAA,cAAA,CAAA,CAAA;AAEzB,MAAA,WAAA,EAAA,eAAA;AAAA,KAAA;AACA,IAAA;AAAA,MAAmCC,kBAAA,CAAA,0DAAA,CAAA;AAAA,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,EAAA,MAAA;;;;;;;;;;;;"}
1
+ {"version":3,"file":"search-button.vue.js","sources":["../../../../../src/x-modules/search-box/components/search-button.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonRef\"\n @click=\"emitEvents\"\n class=\"x-search-button x-button\"\n :class=\"dynamicClasses\"\n data-test=\"search-button\"\n >\n <!-- @slot _Required_. Button content (text, icon, or both) -->\n <slot><span class=\"x-icon\">⌕</span></slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { computed, ComputedRef, defineComponent, ref } from 'vue';\n import { VueCSSClasses } from '../../../utils/types';\n import { WireMetadata } from '../../../wiring/wiring.types';\n import { use$x } from '../../../composables/use-$x';\n import { useState } from '../../../composables/use-state';\n import { searchBoxXModule } from '../x-module';\n\n /**\n * This component renders a button to submit the query.\n *\n * @remarks\n * If query is not empty, it emits {@link XEventsTypes.UserAcceptedAQuery} and\n * {@link SearchBoxXEvents.UserPressedSearchButton} events with the query as payload.\n * It also adds `x-search-button--has-empty-query` as class when there is no query.\n *\n * @public\n */\n export default defineComponent({\n name: 'SearchButton',\n xModule: searchBoxXModule.name,\n setup: function () {\n const $x = use$x();\n\n const buttonRef = ref<HTMLElement | null>(null);\n\n const query: ComputedRef<string> = useState('searchBox', ['query']).query;\n\n const isQueryEmpty = computed(() => query.value.length === 0);\n\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-search-button--has-empty-query': isQueryEmpty.value\n }));\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n function createEventMetadata(): Omit<WireMetadata, 'moduleName'> {\n return {\n target: buttonRef.value,\n feature: 'search_box'\n };\n }\n\n /**\n * Emits events when the button is clicked.\n *\n * @public\n */\n function emitEvents() {\n if (!isQueryEmpty.value) {\n $x.emit('UserAcceptedAQuery', query.value, createEventMetadata());\n $x.emit('UserPressedSearchButton', query.value, createEventMetadata());\n }\n }\n\n return {\n dynamicClasses,\n buttonRef,\n emitEvents\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- [`UserPressedSearchButton`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n<!-- prettier-ignore-start -->\n:::warning\nNote that no events are emitted if the query is empty.\n:::\n<!-- prettier-ignore-end -->\n\n## Dynamic classes\n\n`SearchButton` uses the `x-search-button--has-empty-query` dynamic CSS class to modify the HTML\nbutton style when the query is empty.\n\n## See it in action\n\nIn this example, a clickable button is rendered.\n\n_Click the Search button to try it out!_\n\n```vue live\n<template>\n <SearchButton />\n</template>\n\n<script>\n import { SearchButton } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchButton\n }\n };\n</script>\n```\n\n### Play with default slot\n\nHere text is passed in the default slot instead of an icon to customize the button content.\n\n_Click the icon button to try it out!_\n\n```vue live\n<template>\n <SearchButton>Search</SearchButton>\n</template>\n\n<script>\n import { SearchButton } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchButton\n }\n };\n</script>\n```\n\n### Play with events\n\nIn this example, the `UserPressedSearchButton` event has been implemented so that when you enter a\nsearch term and click the Search button, the search term is displayed as a message.\n\n_Type any term in the input field and then click the Search button to try it out!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex;\">\n <SearchInput />\n <SearchButton\n @UserPressedSearchButton=\"\n query => {\n message = query;\n }\n \"\n />\n </div>\n {{ message }}\n </div>\n</template>\n\n<script>\n import { SearchInput, SearchButton } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchInput,\n SearchButton\n },\n data() {\n return {\n message: ''\n };\n }\n };\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `SearchButton` component\ncommunicates with the [`SearchInput`](./search-input.md) to submit the query. In this example, when\nyou enter a search term and click the Search button, the “Looking for results” message is displayed.\n\n_Type any term in the input field and then click the Search button to try it out!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex;\">\n <SearchInput />\n <SearchButton @UserAcceptedAQuery=\"message = 'looking for results'\">Search</SearchButton>\n </div>\n {{ message }}\n </div>\n</template>\n\n<script>\n import { SearchButton, SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'SearchButtonDemo',\n components: {\n SearchButton,\n SearchInput\n },\n data() {\n return {\n message: ''\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass"],"mappings":";;;;;;;;;;;SAEQ,WAAW,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;SACdA,SAAK,EAAA,EAAAC,kBAAA;AAAA,IAAA,QAAA;AAAA,IAAE;AAAA,MACR,GAAK,EAAA,WAAA;AAAA,MAEL,gBAAU,CAAe,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,MAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,0BAAA,EAAA,IAAA,CAAA,cAAA,CAAA,CAAA;MAGzB,WAA0C,EAAA,eAAA;AAAA,KAAA;;;;;;;;;;;;;;"}
@@ -1,3 +1,4 @@
1
+ import '@empathyco/x-utils';
1
2
  import { createStoreEmitters } from '../../../store/utils/store-emitters.utils.js';
2
3
  import { isStringEmpty } from '../../../utils/string.js';
3
4
  import { searchBoxXStoreModule } from './module.js';
@@ -1 +1 @@
1
- {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/search-box/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { isStringEmpty } from '../../../utils/string';\nimport { searchBoxXStoreModule } from './module';\n\n/**\n * {@link StoreEmitters} For the search-box module.\n *\n * @internal\n */\nexport const searchBoxEmitters = createStoreEmitters(searchBoxXStoreModule, {\n SearchBoxQueryChanged: (_, getters) => getters.trimmedQuery,\n UserClearedQuery: { selector: state => state.query, filter: isStringEmpty }\n});\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;AACU,MAAA,iBAAiB,GAAG,mBAAmB,CAAC,qBAAqB,EAAE;IAC1E,qBAAqB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,YAAY;AAC3D,IAAA,gBAAgB,EAAE,EAAE,QAAQ,EAAE,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE;AAC5E,CAAA;;;;"}
1
+ {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/search-box/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { isStringEmpty } from '../../../utils/string';\nimport { searchBoxXStoreModule } from './module';\n\n/**\n * {@link StoreEmitters} For the search-box module.\n *\n * @internal\n */\nexport const searchBoxEmitters = createStoreEmitters(searchBoxXStoreModule, {\n SearchBoxQueryChanged: (_, getters) => getters.trimmedQuery,\n UserClearedQuery: { selector: state => state.query, filter: isStringEmpty }\n});\n"],"names":[],"mappings":";;;;;AAIA;;;;AAIG;AACU,MAAA,iBAAiB,GAAG,mBAAmB,CAAC,qBAAqB,EAAE;IAC1E,qBAAqB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,YAAY;AAC3D,IAAA,gBAAgB,EAAE,EAAE,QAAQ,EAAE,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE;AAC5E,CAAA;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from './semantic-queries.vue2.js';
2
- import { resolveComponent, openBlock, createBlock, withCtx, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps, createVNode } from 'vue';
2
+ import { resolveComponent, openBlock, createBlock, withCtx, renderSlot, normalizeProps, guardReactiveProps, createVNode, createCommentVNode } 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) {
@@ -11,13 +11,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
11
11
  suggestions: _ctx.suggestions
12
12
  }, {
13
13
  default: withCtx((baseSuggestionsScope) => [
14
- createCommentVNode("\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n "),
15
14
  renderSlot(_ctx.$slots, "suggestion", normalizeProps(guardReactiveProps(baseSuggestionsScope)), () => [
16
15
  createVNode(_component_SemanticQuery, {
17
16
  suggestion: baseSuggestionsScope.suggestion
18
17
  }, {
19
18
  default: withCtx((baseSuggestionScope) => [
20
- createCommentVNode("\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n "),
21
19
  renderSlot(_ctx.$slots, "suggestion-content", normalizeProps(guardReactiveProps(baseSuggestionScope)))
22
20
  ]),
23
21
  _: 2
@@ -1 +1 @@
1
- {"version":3,"file":"semantic-queries.vue.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n v-if=\"suggestions.length\"\n class=\"x-semantic-queries\"\n :suggestions=\"suggestions\"\n #default=\"baseSuggestionsScope\"\n >\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n -->\n <slot name=\"suggestion\" v-bind=\"baseSuggestionsScope\">\n <SemanticQuery :suggestion=\"baseSuggestionsScope.suggestion\" #default=\"baseSuggestionScope\">\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n -->\n <slot name=\"suggestion-content\" v-bind=\"baseSuggestionScope\" />\n </SemanticQuery>\n </slot>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\n import { computed, ComputedRef, defineComponent } from 'vue';\n import { Suggestion } from '@empathyco/x-types';\n import { semanticQueriesXModule } from '../x-module';\n import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue';\n import { useState } from '../../../composables';\n import SemanticQuery from './semantic-query.vue';\n\n /**\n * Retrieves a list of semantic queries from the state and exposes them in the slots.\n *\n * @public\n */\n export default defineComponent({\n name: 'SemanticQueries',\n xModule: semanticQueriesXModule.name,\n components: { BaseSuggestions, SemanticQuery },\n setup(_, { slots }) {\n /** The semantic queries from the state. */\n const suggestions: ComputedRef<Suggestion[]> = useState('semanticQueries', [\n 'semanticQueries'\n ]).semanticQueries;\n\n /**\n * Maps the list of semantic queries to a list of queries, to make it compatible with\n * other components.\n */\n const queries = computed(() => suggestions.value.map(suggestion => suggestion.query));\n\n /**\n * Finds a {@link @empathyco/x-types#Suggestion} given a query.\n *\n * @param query - The query to search.\n * @returns The {@link @empathyco/x-types#Suggestion} or undefined if not found.\n */\n function findSemanticQuery(query: string) {\n return suggestions.value.find(suggestion => suggestion.query === query);\n }\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no suggestions, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are\n * no suggestions.\n */\n function renderDefaultSlot() {\n const slotProps = {\n suggestions: suggestions.value,\n queries: queries.value,\n findSemanticQuery\n };\n return suggestions.value.length ? slots.default?.(slotProps)[0] : '';\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { suggestions };\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps;\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nBy default, the `SemanticQueries` component will render a list of semantic queries.\n\n```vue\n<template>\n <SemanticQueries />\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n\n export default {\n name: 'SemanticQueriesDemo',\n components: {\n SemanticQueries\n }\n };\n</script>\n```\n\n### Play with props\n\nThe component has the following props:\n\n- maxItemsToRender to limit the number of semantic queries to render.\n- animation to specify the animation to be used to animate the semantic queries.\n\n```vue live\n<template>\n <SemanticQueries :animation=\"animation\" :maxItemsToRender=\"3\" />\n</template>\n\n<script>\n import { FadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'SemanticQueriesPropsDemo',\n data() {\n return {\n animation: FadeAndSlide\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nThe default slot is used to overwrite the whole content of the component.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ suggestions }\">\n <section>\n <SlidingPanel>\n <div v-for=\"suggestion in suggestions\">\n {{ suggestion.query }}\n {{ suggestion.distance }}\n </div>\n </SlidingPanel>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SemanticQueriesDefaultSlotDemo',\n components: {\n SemanticQueries,\n SlidingPanel\n }\n };\n</script>\n```\n\nThe default slot also exposes an array of semantic queries mapped to strings, and a method to find a\nsemantic query given a string query.\n\nThis is useful if you need an array of string queries, but also need to retrieve the original\nsemantic query to use it in another element.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ queries, findSemanticQuery }\">\n <section>\n <QueryPreviewList :queries=\"queries\" #slot=\"{ query, results }\">\n <div>\n <SemanticQuery :semanticQuery=\"findSemanticQuery(query)\" #default=\"{ query }\">\n {{ query.query }} ({{ query.distance }})\n </SemanticQuery>\n <ul>\n <li v-for=\"result in results\" :key=\"result.id\">\n {{ result.name }}\n </li>\n </ul>\n </div>\n </QueryPreviewList>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries, SemanticQuery } from '@empathyco/x-components/semantic-queries';\n import { QueryPreviewList } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'SemanticQueriesDefaultSlotDemo2',\n components: {\n SemanticQueries,\n SemanticQuery,\n QueryPreviewList\n }\n };\n</script>\n```\n\n### Play with the suggestion slot\n\nThe suggestion slot can be used to override each semantic query item.\n\nIn this example, the query will be rendered along with the distance.\n\n```vue live\n<template>\n <SemanticQueries #suggestion=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n export default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries\n }\n };\n</script>\n```\n\n### Play with the suggestion content slot\n\nThe suggsetion content slot can be used to override only the content, but keep using the\nSemanticQuery component internally.\n\n```vue live\n<template>\n <SemanticQueries #suggestion-content=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n export default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_createCommentVNode","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;AAE4B,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AAF5B,EAAA,OAAA,IAAA,CAAA,WAAA,CAAA,MAAA,IAAAC,SAAA,EAG8B,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IACzB,GAAA,EAAA,CAAA;AAAA,IAAA,KAAA,EAAA,oBAAA;AACA,IAAA,WAAA,EAAO,IAER,CAAA,WAAA;AAAA,GAAA,EAAA;AAKA,IAAA,OAAA,EAAAC,OAAA,CASO,CArBX,oBAAA,KAAA;AAAA,MAoBsBC,kBAAA,CAAA,+KAAA,CAAA;AAAA,MAPAC,UAAA,CAAA,IAAA,CAAY,sBAAqBC,cAAU,CAAAC,kBAAA,CAAA,oBAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAAA,wBAAA,EAAA;AAAG,UAAA,UAAA,EAAO,oBAAE,CAAA,UAAA;AAAA,SAAA,EAAA;mBAMrEL,OAA+D,CAAA,CAAA,mBAAA,KAAA;AAAA,YAAAC,kBAAA,CAAA,sNAAA,CAAA;AAnBvE,YAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,mBAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,EAAA,CAAA,EAAA,CAAA,aAAA,CAAA,CAAA,IAAAH,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
1
+ {"version":3,"file":"semantic-queries.vue.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n v-if=\"suggestions.length\"\n class=\"x-semantic-queries\"\n :suggestions=\"suggestions\"\n #default=\"baseSuggestionsScope\"\n >\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n -->\n <slot name=\"suggestion\" v-bind=\"baseSuggestionsScope\">\n <SemanticQuery :suggestion=\"baseSuggestionsScope.suggestion\" #default=\"baseSuggestionScope\">\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n -->\n <slot name=\"suggestion-content\" v-bind=\"baseSuggestionScope\" />\n </SemanticQuery>\n </slot>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\n import { computed, ComputedRef, defineComponent } from 'vue';\n import { Suggestion } from '@empathyco/x-types';\n import { semanticQueriesXModule } from '../x-module';\n import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue';\n import { useState } from '../../../composables';\n import SemanticQuery from './semantic-query.vue';\n\n /**\n * Retrieves a list of semantic queries from the state and exposes them in the slots.\n *\n * @public\n */\n export default defineComponent({\n name: 'SemanticQueries',\n xModule: semanticQueriesXModule.name,\n components: { BaseSuggestions, SemanticQuery },\n setup(_, { slots }) {\n /** The semantic queries from the state. */\n const suggestions: ComputedRef<Suggestion[]> = useState('semanticQueries', [\n 'semanticQueries'\n ]).semanticQueries;\n\n /**\n * Maps the list of semantic queries to a list of queries, to make it compatible with\n * other components.\n */\n const queries = computed(() => suggestions.value.map(suggestion => suggestion.query));\n\n /**\n * Finds a {@link @empathyco/x-types#Suggestion} given a query.\n *\n * @param query - The query to search.\n * @returns The {@link @empathyco/x-types#Suggestion} or undefined if not found.\n */\n function findSemanticQuery(query: string) {\n return suggestions.value.find(suggestion => suggestion.query === query);\n }\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no suggestions, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are\n * no suggestions.\n */\n function renderDefaultSlot() {\n const slotProps = {\n suggestions: suggestions.value,\n queries: queries.value,\n findSemanticQuery\n };\n return suggestions.value.length ? slots.default?.(slotProps)[0] : '';\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { suggestions };\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps;\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nBy default, the `SemanticQueries` component will render a list of semantic queries.\n\n```vue\n<template>\n <SemanticQueries />\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n\n export default {\n name: 'SemanticQueriesDemo',\n components: {\n SemanticQueries\n }\n };\n</script>\n```\n\n### Play with props\n\nThe component has the following props:\n\n- maxItemsToRender to limit the number of semantic queries to render.\n- animation to specify the animation to be used to animate the semantic queries.\n\n```vue live\n<template>\n <SemanticQueries :animation=\"animation\" :maxItemsToRender=\"3\" />\n</template>\n\n<script>\n import { FadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'SemanticQueriesPropsDemo',\n data() {\n return {\n animation: FadeAndSlide\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nThe default slot is used to overwrite the whole content of the component.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ suggestions }\">\n <section>\n <SlidingPanel>\n <div v-for=\"suggestion in suggestions\">\n {{ suggestion.query }}\n {{ suggestion.distance }}\n </div>\n </SlidingPanel>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n import { SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'SemanticQueriesDefaultSlotDemo',\n components: {\n SemanticQueries,\n SlidingPanel\n }\n };\n</script>\n```\n\nThe default slot also exposes an array of semantic queries mapped to strings, and a method to find a\nsemantic query given a string query.\n\nThis is useful if you need an array of string queries, but also need to retrieve the original\nsemantic query to use it in another element.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ queries, findSemanticQuery }\">\n <section>\n <QueryPreviewList :queries=\"queries\" #slot=\"{ query, results }\">\n <div>\n <SemanticQuery :semanticQuery=\"findSemanticQuery(query)\" #default=\"{ query }\">\n {{ query.query }} ({{ query.distance }})\n </SemanticQuery>\n <ul>\n <li v-for=\"result in results\" :key=\"result.id\">\n {{ result.name }}\n </li>\n </ul>\n </div>\n </QueryPreviewList>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries, SemanticQuery } from '@empathyco/x-components/semantic-queries';\n import { QueryPreviewList } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'SemanticQueriesDefaultSlotDemo2',\n components: {\n SemanticQueries,\n SemanticQuery,\n QueryPreviewList\n }\n };\n</script>\n```\n\n### Play with the suggestion slot\n\nThe suggestion slot can be used to override each semantic query item.\n\nIn this example, the query will be rendered along with the distance.\n\n```vue live\n<template>\n <SemanticQueries #suggestion=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n export default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries\n }\n };\n</script>\n```\n\n### Play with the suggestion content slot\n\nThe suggsetion content slot can be used to override only the content, but keep using the\nSemanticQuery component internally.\n\n```vue live\n<template>\n <SemanticQueries #suggestion-content=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\n import { SemanticQueries } from '@empathyco/x-components/semantic-queries';\n export default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode","_createCommentVNode"],"mappings":";;;;;;AAE4B,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AAF5B,EAAA,OAAA,IAAA,CAAA,WAAA,CAAA,MAAA,IAAAC,SAAA,EAG8B,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IACzB,GAAA,EAAA,CAAA;AAAA,IAAA,KAAA,EAAA,oBAAA;AACA,IAAA,WAAA,EAAO,IAOR,CAAA,WAAA;AAAA,GAAA,EAAA;aACEC,OAOgB,CAAA,CAAA,oBAAA,KAAA;AAAA,MAPAC,UAAA,CAAA,IAAA,CAAY,sBAAqBC,cAAU,CAAAC,kBAAA,CAAA,oBAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAAA,wBAAA,EAAA;AAAG,UAAA,UAAA,EAAO,oBAAE,CAAA,UAAA;AAAA,SAAA,EAAA;;AAb7E,YAAAH,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,mBAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,EAAA,CAAA,EAAA,CAAA,aAAA,CAAA,CAAA,IAAAE,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from './semantic-query.vue2.js';
2
- import { resolveComponent, openBlock, createBlock, withCtx, createCommentVNode, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
2
+ import { resolveComponent, openBlock, createBlock, withCtx, renderSlot, normalizeProps, guardReactiveProps } 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) {
@@ -12,9 +12,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
12
12
  "data-test": "semantic-query"
13
13
  }, {
14
14
  default: withCtx((baseScope) => [
15
- createCommentVNode(" eslint-disable max-len "),
16
- createCommentVNode("\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the suggestion belongs to}} v-bind BaseSuggestion bindings\n "),
17
- createCommentVNode(" eslint-enable max-len "),
18
15
  renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ ...baseScope })))
19
16
  ]),
20
17
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"semantic-query.vue.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-query.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n :query=\"query\"\n :suggestion=\"suggestion\"\n :suggestionSelectedEvents=\"suggestionSelectedEvents\"\n feature=\"semantics\"\n data-test=\"semantic-query\"\n #default=\"baseScope\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the suggestion belongs to}} v-bind BaseSuggestion bindings\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { SemanticQuery } from '@empathyco/x-types';\n import { semanticQueriesXModule } from '../x-module';\n import BaseSuggestion from '../../../components/suggestions/base-suggestion.vue';\n import { useGetter } from '../../../composables/use-getter';\n\n /**\n * This component renders a semantic query. A semantic query is a recommended query\n * that is similar in its meaning to another one.\n * It contains the query and the distance, which indicates how similar the query is\n * compared to the searched query.\n *\n * @public\n */\n export default defineComponent({\n name: 'SemanticQuery',\n xModule: semanticQueriesXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The {@link @empathyco/x-types#SemanticQuery} to render. */\n suggestion: {\n type: Object as PropType<SemanticQuery>,\n required: true\n }\n },\n setup(props) {\n /** The normalized query of the semantic queries module. */\n const query = useGetter('semanticQueries', ['normalizedQuery']).normalizedQuery;\n\n /** The list of events that are going to be emitted when the button is pressed. */\n const suggestionSelectedEvents = {\n UserSelectedASemanticQuery: props.suggestion\n };\n\n return {\n query,\n suggestionSelectedEvents\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserSelectedASemanticQuery`](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 semantic query button. The event payload is the\n semantic query data.\n\n## See it in action\n\nHere you can see that the semantic query query is rendered.\n\n```vue live\n<template>\n <SemanticQuery :suggestion=\"semanticQuery\" />\n</template>\n\n<script>\n import { SemanticQuery } from '@empathyco/x-components/semantic-queries';\n\n export default {\n name: 'SemanticQueryDemo',\n components: {\n SemanticQuery\n },\n data() {\n return {\n semanticQuery: {\n modelName: 'SemanticQuery',\n query: 'jacket',\n distance: 2\n }\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nIn this example, we add the distance of the semantic query next to the query.\n\n```vue live\n<template>\n <SemanticQuery :suggestion=\"semanticQuery\" #default=\"{ suggestion, query }\">\n <div>Original query: {{ query }}</div>\n <div>Suggested semantic query: {{ suggestion.query }} - {{ suggestion.distance }}</div>\n </SemanticQuery>\n</template>\n\n<script>\n import { SemanticQuery } from '@empathyco/x-components/semantic-queries';\n\n export default {\n name: 'SemanticQueryDemoDefaultSlot',\n components: {\n SemanticQuery\n },\n data() {\n return {\n semanticQuery: {\n modelName: 'SemanticQuery',\n query: 'jacket',\n distance: 2\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_createCommentVNode","_renderSlot","_normalizeProps","_guardReactiveProps"],"mappings":";;;;;oCACEA,gBAeiB,CAAA,gBAAA,CAAA,CAAA;AAbd,EAAA,OAAAC,SAAA,EAAsB,EAAAC,WAAA,CAAA,yBAAA,EAAA;AAAA,IACtB,KAAA,EAAA,IAAA,CAAA,KAAA;AAAA,IACD,UAAQ,EAAA,IAAA,CAAA,UAAA;AAAA,IACR,0BAAU,IAAgB,CAAA,wBAAA;AAAA,IAAA,OAAA,EAAA,WAAA;IACzB,WAAO,EAAA,gBAAA;AAAA,GAAA,EAAA;AAGR,IAAA,OAAA,EAAAC,OAAA,CAAA,CAAA,SAAA,KAAA;AAAA,MAIAC,kBAA8B,CAAA,0BAAA,CAAA;AAAA,MAC9BA,mBAAkC,kMAAN,CAAA;AAAA,MAAAA,kBAAA,CAAA,yBAAA,CAAA;AAfhC,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"semantic-query.vue.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-query.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n :query=\"query\"\n :suggestion=\"suggestion\"\n :suggestionSelectedEvents=\"suggestionSelectedEvents\"\n feature=\"semantics\"\n data-test=\"semantic-query\"\n #default=\"baseScope\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the suggestion belongs to}} v-bind BaseSuggestion bindings\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, PropType } from 'vue';\n import { SemanticQuery } from '@empathyco/x-types';\n import { semanticQueriesXModule } from '../x-module';\n import BaseSuggestion from '../../../components/suggestions/base-suggestion.vue';\n import { useGetter } from '../../../composables/use-getter';\n\n /**\n * This component renders a semantic query. A semantic query is a recommended query\n * that is similar in its meaning to another one.\n * It contains the query and the distance, which indicates how similar the query is\n * compared to the searched query.\n *\n * @public\n */\n export default defineComponent({\n name: 'SemanticQuery',\n xModule: semanticQueriesXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The {@link @empathyco/x-types#SemanticQuery} to render. */\n suggestion: {\n type: Object as PropType<SemanticQuery>,\n required: true\n }\n },\n setup(props) {\n /** The normalized query of the semantic queries module. */\n const query = useGetter('semanticQueries', ['normalizedQuery']).normalizedQuery;\n\n /** The list of events that are going to be emitted when the button is pressed. */\n const suggestionSelectedEvents = {\n UserSelectedASemanticQuery: props.suggestion\n };\n\n return {\n query,\n suggestionSelectedEvents\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserSelectedASemanticQuery`](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 semantic query button. The event payload is the\n semantic query data.\n\n## See it in action\n\nHere you can see that the semantic query query is rendered.\n\n```vue live\n<template>\n <SemanticQuery :suggestion=\"semanticQuery\" />\n</template>\n\n<script>\n import { SemanticQuery } from '@empathyco/x-components/semantic-queries';\n\n export default {\n name: 'SemanticQueryDemo',\n components: {\n SemanticQuery\n },\n data() {\n return {\n semanticQuery: {\n modelName: 'SemanticQuery',\n query: 'jacket',\n distance: 2\n }\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nIn this example, we add the distance of the semantic query next to the query.\n\n```vue live\n<template>\n <SemanticQuery :suggestion=\"semanticQuery\" #default=\"{ suggestion, query }\">\n <div>Original query: {{ query }}</div>\n <div>Suggested semantic query: {{ suggestion.query }} - {{ suggestion.distance }}</div>\n </SemanticQuery>\n</template>\n\n<script>\n import { SemanticQuery } from '@empathyco/x-components/semantic-queries';\n\n export default {\n name: 'SemanticQueryDemoDefaultSlot',\n components: {\n SemanticQuery\n },\n data() {\n return {\n semanticQuery: {\n modelName: 'SemanticQuery',\n query: 'jacket',\n distance: 2\n }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_renderSlot","_normalizeProps","_guardReactiveProps"],"mappings":";;;;;oCACEA,gBAeiB,CAAA,gBAAA,CAAA,CAAA;AAbd,EAAA,OAAAC,SAAA,EAAsB,EAAAC,WAAA,CAAA,yBAAA,EAAA;AAAA,IACtB,KAAA,EAAA,IAAA,CAAA,KAAA;AAAA,IACD,UAAQ,EAAA,IAAA,CAAA,UAAA;AAAA,IACR,0BAAU,IAAgB,CAAA,wBAAA;AAAA,IAAA,OAAA,EAAA,WAAA;IACzB,WAAO,EAAA,gBAAA;AAAA,GAAA,EAAA;;AAPZ,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
@@ -4,7 +4,7 @@ import { normalizeString } from '../../../../utils/normalize.js';
4
4
  * Default implementacion for the {@link SemanticQueriesGetters.normalizedQuery} getter.
5
5
  *
6
6
  * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic
7
- * queries module.
7
+ * queries' module.
8
8
  *
9
9
  * @returns The normalized query.
10
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"normalized-query.getter.js","sources":["../../../../../../src/x-modules/semantic-queries/store/getters/normalized-query.getter.ts"],"sourcesContent":["import { SemanticQueriesXStoreModule } from '../types';\nimport { normalizeString } from '../../../../utils/normalize';\n\n/**\n * Default implementacion for the {@link SemanticQueriesGetters.normalizedQuery} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic\n * queries module.\n *\n * @returns The normalized query.\n *\n * @public\n */\nexport const normalizedQuery: SemanticQueriesXStoreModule['getters']['normalizedQuery'] = ({\n query\n}) => normalizeString(query);\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACI,MAAM,eAAe,GAA8D,CAAC,EACzF,KAAK,EACN,KAAK,eAAe,CAAC,KAAK;;;;"}
1
+ {"version":3,"file":"normalized-query.getter.js","sources":["../../../../../../src/x-modules/semantic-queries/store/getters/normalized-query.getter.ts"],"sourcesContent":["import { SemanticQueriesXStoreModule } from '../types';\nimport { normalizeString } from '../../../../utils/normalize';\n\n/**\n * Default implementacion for the {@link SemanticQueriesGetters.normalizedQuery} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic\n * queries' module.\n *\n * @returns The normalized query.\n *\n * @public\n */\nexport const normalizedQuery: SemanticQueriesXStoreModule['getters']['normalizedQuery'] = ({\n query\n}) => normalizeString(query);\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACI,MAAM,eAAe,GAA8D,CAAC,EACzF,KAAK,EACN,KAAK,eAAe,CAAC,KAAK;;;;"}
@@ -3,15 +3,16 @@
3
3
  *
4
4
  * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic
5
5
  * queries module.
6
- *
6
+ * @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the
7
+ * semantic queries' module.
7
8
  * @returns The semantic queries request to fetch data from the API.
8
9
  *
9
10
  * @public
10
11
  */
11
- const request = ({ query, params, totalResults, config: { threshold, maxItemsToRequest } }) => {
12
- return query && totalResults <= threshold
12
+ const request = ({ params, totalResults, config: { threshold, maxItemsToRequest } }, { normalizedQuery }) => {
13
+ return normalizedQuery && totalResults <= threshold
13
14
  ? {
14
- query,
15
+ query: normalizedQuery,
15
16
  extraParams: {
16
17
  ...params,
17
18
  k: maxItemsToRequest
@@ -1 +1 @@
1
- {"version":3,"file":"request.getter.js","sources":["../../../../../../src/x-modules/semantic-queries/store/getters/request.getter.ts"],"sourcesContent":["import { SemanticQueriesXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link SemanticQueriesGetters.request} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic\n * queries module.\n *\n * @returns The semantic queries request to fetch data from the API.\n *\n * @public\n */\nexport const request: SemanticQueriesXStoreModule['getters']['request'] = ({\n query,\n params,\n totalResults,\n config: { threshold, maxItemsToRequest }\n}) => {\n return query && totalResults <= threshold\n ? {\n query,\n extraParams: {\n ...params,\n k: maxItemsToRequest\n }\n }\n : null;\n};\n"],"names":[],"mappings":"AAEA;;;;;;;;;AASG;MACU,OAAO,GAAsD,CAAC,EACzE,KAAK,EACL,MAAM,EACN,YAAY,EACZ,MAAM,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,EACzC,KAAI;AACH,IAAA,OAAO,KAAK,IAAI,YAAY,IAAI,SAAS;AACvC,UAAE;YACE,KAAK;AACL,YAAA,WAAW,EAAE;AACX,gBAAA,GAAG,MAAM;AACT,gBAAA,CAAC,EAAE,iBAAiB;AACrB,aAAA;AACF,SAAA;UACD,IAAI,CAAC;AACX;;;;"}
1
+ {"version":3,"file":"request.getter.js","sources":["../../../../../../src/x-modules/semantic-queries/store/getters/request.getter.ts"],"sourcesContent":["import { SemanticQueriesXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link SemanticQueriesGetters.request} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic\n * queries module.\n * @param getters - Current {@link https://vuex.vuejs.org/guide/getters.html | getters} of the\n * semantic queries' module.\n * @returns The semantic queries request to fetch data from the API.\n *\n * @public\n */\nexport const request: SemanticQueriesXStoreModule['getters']['request'] = (\n { params, totalResults, config: { threshold, maxItemsToRequest } },\n { normalizedQuery }\n) => {\n return normalizedQuery && totalResults <= threshold\n ? {\n query: normalizedQuery,\n extraParams: {\n ...params,\n k: maxItemsToRequest\n }\n }\n : null;\n};\n"],"names":[],"mappings":"AAEA;;;;;;;;;;AAUG;MACU,OAAO,GAAsD,CACxE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,EAClE,EAAE,eAAe,EAAE,KACjB;AACF,IAAA,OAAO,eAAe,IAAI,YAAY,IAAI,SAAS;AACjD,UAAE;AACE,YAAA,KAAK,EAAE,eAAe;AACtB,YAAA,WAAW,EAAE;AACX,gBAAA,GAAG,MAAM;AACT,gBAAA,CAAC,EAAE,iBAAiB;AACrB,aAAA;AACF,SAAA;UACD,IAAI,CAAC;AACX;;;;"}
@@ -0,0 +1,18 @@
1
+ import { createRelatedTagsQueryGetter } from '../../../../store/utils/query.utils.js';
2
+
3
+ /**
4
+ * Default implementation for the semantic queries query getter.
5
+ *
6
+ * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic
7
+ * queries' module.
8
+ *
9
+ * @returns The query with the selected related tags concatenated.
10
+ *
11
+ * @public
12
+ */
13
+ const query = createRelatedTagsQueryGetter({
14
+ getRelatedTags: state => state.relatedTags
15
+ });
16
+
17
+ export { query };
18
+ //# sourceMappingURL=semanti-queries-query.getter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semanti-queries-query.getter.js","sources":["../../../../../../src/x-modules/semantic-queries/store/getters/semanti-queries-query.getter.ts"],"sourcesContent":["import { createRelatedTagsQueryGetter } from '../../../../store/utils/query.utils';\nimport { SemanticQueriesXStoreModule } from '../types';\n\n/**\n * Default implementation for the semantic queries query getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the semantic\n * queries' module.\n *\n * @returns The query with the selected related tags concatenated.\n *\n * @public\n */\nexport const query: SemanticQueriesXStoreModule['getters']['query'] = createRelatedTagsQueryGetter({\n getRelatedTags: state => state.relatedTags\n});\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACI,MAAM,KAAK,GAAoD,4BAA4B,CAAC;AACjG,IAAA,cAAc,EAAE,KAAK,IAAI,KAAK,CAAC,WAAW;AAC3C,CAAA;;;;"}
@@ -4,6 +4,7 @@ import { fetchSemanticQuery } from './actions/fetch-semantic-query.action.js';
4
4
  import { fetchAndSaveSemanticQuery } from './actions/fetch-and-save-semantic-query.action.js';
5
5
  import { request } from './getters/request.getter.js';
6
6
  import { normalizedQuery } from './getters/normalized-query.getter.js';
7
+ import { query } from './getters/semanti-queries-query.getter.js';
7
8
 
8
9
  /**
9
10
  * {@link XStoreModule} For the `semantic-queries` module.
@@ -19,11 +20,13 @@ const semanticQueriesXStoreModule = {
19
20
  semanticQueries: [],
20
21
  params: {},
21
22
  query: '',
22
- totalResults: 0
23
+ totalResults: 0,
24
+ relatedTags: []
23
25
  }),
24
26
  getters: {
25
27
  request,
26
- normalizedQuery
28
+ normalizedQuery,
29
+ query
27
30
  },
28
31
  mutations: {
29
32
  setParams(state, params) {
@@ -36,6 +39,9 @@ const semanticQueriesXStoreModule = {
36
39
  setTotalResults(state, totalResults) {
37
40
  state.totalResults = totalResults;
38
41
  },
42
+ setSemanticQueriesRelatedTags(state, relatedTags) {
43
+ state.relatedTags = relatedTags;
44
+ },
39
45
  setConfig,
40
46
  mergeConfig
41
47
  },
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/semantic-queries/store/module.ts"],"sourcesContent":["import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { setQuery } from '../../../store/utils/query.utils';\nimport { SemanticQueriesXStoreModule } from './types';\nimport { fetchSemanticQuery } from './actions/fetch-semantic-query.action';\nimport { fetchAndSaveSemanticQuery } from './actions/fetch-and-save-semantic-query.action';\nimport { request } from './getters/request.getter';\nimport { normalizedQuery } from './getters/normalized-query.getter';\n\n/**\n * {@link XStoreModule} For the `semantic-queries` module.\n *\n * @internal\n */\nexport const semanticQueriesXStoreModule: SemanticQueriesXStoreModule = {\n state: () => ({\n config: {\n threshold: 5,\n maxItemsToRequest: 3\n },\n semanticQueries: [],\n params: {},\n query: '',\n totalResults: 0\n }),\n getters: {\n request,\n normalizedQuery\n },\n mutations: {\n setParams(state, params) {\n state.params = params;\n },\n setSemanticQueries(state, queries) {\n state.semanticQueries = queries;\n },\n setQuery,\n setTotalResults(state, totalResults) {\n state.totalResults = totalResults;\n },\n setConfig,\n mergeConfig\n },\n actions: {\n fetchSemanticQuery,\n fetchAndSaveSemanticQuery\n }\n};\n"],"names":[],"mappings":";;;;;;;AAQA;;;;AAIG;AACU,MAAA,2BAA2B,GAAgC;AACtE,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,SAAS,EAAE,CAAC;AACZ,YAAA,iBAAiB,EAAE,CAAC;AACrB,SAAA;AACD,QAAA,eAAe,EAAE,EAAE;AACnB,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,YAAY,EAAE,CAAC;KAChB,CAAC;AACF,IAAA,OAAO,EAAE;QACP,OAAO;QACP,eAAe;AAChB,KAAA;AACD,IAAA,SAAS,EAAE;QACT,SAAS,CAAC,KAAK,EAAE,MAAM,EAAA;AACrB,YAAA,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAA;AAC/B,YAAA,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC;SACjC;QACD,QAAQ;QACR,eAAe,CAAC,KAAK,EAAE,YAAY,EAAA;AACjC,YAAA,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;SACnC;QACD,SAAS;QACT,WAAW;AACZ,KAAA;AACD,IAAA,OAAO,EAAE;QACP,kBAAkB;QAClB,yBAAyB;AAC1B,KAAA;;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/semantic-queries/store/module.ts"],"sourcesContent":["import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { setQuery } from '../../../store/utils/query.utils';\nimport { SemanticQueriesXStoreModule } from './types';\nimport { fetchSemanticQuery } from './actions/fetch-semantic-query.action';\nimport { fetchAndSaveSemanticQuery } from './actions/fetch-and-save-semantic-query.action';\nimport { request } from './getters/request.getter';\nimport { normalizedQuery } from './getters/normalized-query.getter';\nimport { query } from './getters/semanti-queries-query.getter';\n\n/**\n * {@link XStoreModule} For the `semantic-queries` module.\n *\n * @internal\n */\nexport const semanticQueriesXStoreModule: SemanticQueriesXStoreModule = {\n state: () => ({\n config: {\n threshold: 5,\n maxItemsToRequest: 3\n },\n semanticQueries: [],\n params: {},\n query: '',\n totalResults: 0,\n relatedTags: []\n }),\n getters: {\n request,\n normalizedQuery,\n query\n },\n mutations: {\n setParams(state, params) {\n state.params = params;\n },\n setSemanticQueries(state, queries) {\n state.semanticQueries = queries;\n },\n setQuery,\n setTotalResults(state, totalResults) {\n state.totalResults = totalResults;\n },\n setSemanticQueriesRelatedTags(state, relatedTags) {\n state.relatedTags = relatedTags;\n },\n setConfig,\n mergeConfig\n },\n actions: {\n fetchSemanticQuery,\n fetchAndSaveSemanticQuery\n }\n};\n"],"names":[],"mappings":";;;;;;;;AASA;;;;AAIG;AACU,MAAA,2BAA2B,GAAgC;AACtE,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,SAAS,EAAE,CAAC;AACZ,YAAA,iBAAiB,EAAE,CAAC;AACrB,SAAA;AACD,QAAA,eAAe,EAAE,EAAE;AACnB,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,YAAY,EAAE,CAAC;AACf,QAAA,WAAW,EAAE,EAAE;KAChB,CAAC;AACF,IAAA,OAAO,EAAE;QACP,OAAO;QACP,eAAe;QACf,KAAK;AACN,KAAA;AACD,IAAA,SAAS,EAAE;QACT,SAAS,CAAC,KAAK,EAAE,MAAM,EAAA;AACrB,YAAA,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAA;AAC/B,YAAA,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC;SACjC;QACD,QAAQ;QACR,eAAe,CAAC,KAAK,EAAE,YAAY,EAAA;AACjC,YAAA,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;SACnC;QACD,6BAA6B,CAAC,KAAK,EAAE,WAAW,EAAA;AAC9C,YAAA,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;SACjC;QACD,SAAS;QACT,WAAW;AACZ,KAAA;AACD,IAAA,OAAO,EAAE;QACP,kBAAkB;QAClB,yBAAyB;AAC1B,KAAA;;;;;"}
@@ -50,6 +50,8 @@ const clearQueryWire = wireCommit('setQuery', '');
50
50
  * @public
51
51
  */
52
52
  const setTotalResultsWire = wireCommit('setTotalResults');
53
+ /** Sets the related prompts state `relatedTags`. */
54
+ const setSemanticQueriesRelatedTags = wireCommit('setSemanticQueriesRelatedTags');
53
55
  /**
54
56
  * Sets the total results taking the {@link SearchXEvents.SearchResponseChanged} payload.
55
57
  *
@@ -80,6 +82,9 @@ const semanticQueriesWiring = createWiring({
80
82
  SearchResponseChanged: {
81
83
  setQueryFromSearchResponseChangedWire,
82
84
  setTotalResultsFromSearchResponseChangedWire
85
+ },
86
+ SelectedRelatedTagsChanged: {
87
+ setSemanticQueriesRelatedTags
83
88
  }
84
89
  });
85
90
 
@@ -1 +1 @@
1
- {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/semantic-queries/wiring.ts"],"sourcesContent":["import {\n namespacedWireCommit,\n namespacedWireDispatch\n} from '../../wiring/namespaced-wires.factory';\nimport { createWiring } from '../../wiring/wiring.utils';\nimport { mapWire } from '../../wiring/wires.operators';\nimport { SearchXEvents } from '../search/events.types';\nimport { ExtractMutationPayload } from '../../store/store.types';\n\n/**\n * `semanticQueries` {@link XModuleName | name}.\n *\n * @internal\n */\nconst moduleName = 'semanticQueries';\n\n/**\n * WireCommit for {@link SemanticQueriesXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName);\n\n/**\n * WireDispatch for {@link SemanticQueriesXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName);\n\n/**\n * Requests and stores the semantic query results.\n *\n * @public\n */\nexport const fetchAndSaveSemanticQueryWire = wireDispatch('fetchAndSaveSemanticQuery');\n\n/**\n * Sets the query.\n *\n * @public\n */\nexport const setQueryWire = wireCommit('setQuery');\n\n/**\n * Sets the query taking the {@link SearchXEvents.SearchResponseChanged} payload.\n *\n * @public\n */\nexport const setQueryFromSearchResponseChangedWire = mapWire<\n SearchXEvents['SearchResponseChanged'],\n ExtractMutationPayload<'semanticQueries', 'setQuery'>\n>(setQueryWire, ({ request: { query } }) => query);\n\n/**\n * Clears the query.\n *\n * @public\n */\nexport const clearQueryWire = wireCommit('setQuery', '');\n\n/**\n * Sets the total results.\n *\n * @public\n */\nexport const setTotalResultsWire = wireCommit('setTotalResults');\n\n/**\n * Sets the total results taking the {@link SearchXEvents.SearchResponseChanged} payload.\n *\n * @public\n */\nexport const setTotalResultsFromSearchResponseChangedWire = mapWire<\n SearchXEvents['SearchResponseChanged'],\n ExtractMutationPayload<'semanticQueries', 'setTotalResults'>\n>(setTotalResultsWire, ({ totalResults }) => totalResults);\n\n/**\n * Sets the semantic queries state `params`.\n *\n * @public\n */\nexport const setSemanticQueriesExtraParamsWire = wireCommit('setParams');\n\n/**\n * Wiring configuration for the {@link SemanticQueriesXModule | semanticQueries module}.\n *\n * @internal\n */\nexport const semanticQueriesWiring = createWiring({\n UserClearedQuery: {\n clearQueryWire\n },\n SemanticQueryRequestUpdated: {\n fetchAndSaveSemanticQueryWire\n },\n ExtraParamsChanged: {\n setSemanticQueriesExtraParamsWire\n },\n SearchResponseChanged: {\n setQueryFromSearchResponseChangedWire,\n setTotalResultsFromSearchResponseChangedWire\n }\n});\n"],"names":[],"mappings":";;;;AASA;;;;AAIG;AACH,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAErC;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAEpD;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAExD;;;;AAIG;MACU,6BAA6B,GAAG,YAAY,CAAC,2BAA2B,EAAE;AAEvF;;;;AAIG;MACU,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE;AAEnD;;;;AAIG;MACU,qCAAqC,GAAG,OAAO,CAG1D,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,KAAK,EAAE;AAEnD;;;;AAIG;AACU,MAAA,cAAc,GAAG,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE;AAEzD;;;;AAIG;MACU,mBAAmB,GAAG,UAAU,CAAC,iBAAiB,EAAE;AAEjE;;;;AAIG;AACU,MAAA,4CAA4C,GAAG,OAAO,CAGjE,mBAAmB,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE;AAE3D;;;;AAIG;MACU,iCAAiC,GAAG,UAAU,CAAC,WAAW,EAAE;AAEzE;;;;AAIG;AACI,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAChD,IAAA,gBAAgB,EAAE;QAChB,cAAc;AACf,KAAA;AACD,IAAA,2BAA2B,EAAE;QAC3B,6BAA6B;AAC9B,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,iCAAiC;AAClC,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,qCAAqC;QACrC,4CAA4C;AAC7C,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/semantic-queries/wiring.ts"],"sourcesContent":["import {\n namespacedWireCommit,\n namespacedWireDispatch\n} from '../../wiring/namespaced-wires.factory';\nimport { createWiring } from '../../wiring/wiring.utils';\nimport { mapWire } from '../../wiring/wires.operators';\nimport { SearchXEvents } from '../search/events.types';\nimport { ExtractMutationPayload } from '../../store/store.types';\n\n/**\n * `semanticQueries` {@link XModuleName | name}.\n *\n * @internal\n */\nconst moduleName = 'semanticQueries';\n\n/**\n * WireCommit for {@link SemanticQueriesXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName);\n\n/**\n * WireDispatch for {@link SemanticQueriesXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName);\n\n/**\n * Requests and stores the semantic query results.\n *\n * @public\n */\nexport const fetchAndSaveSemanticQueryWire = wireDispatch('fetchAndSaveSemanticQuery');\n\n/**\n * Sets the query.\n *\n * @public\n */\nexport const setQueryWire = wireCommit('setQuery');\n\n/**\n * Sets the query taking the {@link SearchXEvents.SearchResponseChanged} payload.\n *\n * @public\n */\nexport const setQueryFromSearchResponseChangedWire = mapWire<\n SearchXEvents['SearchResponseChanged'],\n ExtractMutationPayload<'semanticQueries', 'setQuery'>\n>(setQueryWire, ({ request: { query } }) => query);\n\n/**\n * Clears the query.\n *\n * @public\n */\nexport const clearQueryWire = wireCommit('setQuery', '');\n\n/**\n * Sets the total results.\n *\n * @public\n */\nexport const setTotalResultsWire = wireCommit('setTotalResults');\n\n/** Sets the related prompts state `relatedTags`. */\nconst setSemanticQueriesRelatedTags = wireCommit('setSemanticQueriesRelatedTags');\n\n/**\n * Sets the total results taking the {@link SearchXEvents.SearchResponseChanged} payload.\n *\n * @public\n */\nexport const setTotalResultsFromSearchResponseChangedWire = mapWire<\n SearchXEvents['SearchResponseChanged'],\n ExtractMutationPayload<'semanticQueries', 'setTotalResults'>\n>(setTotalResultsWire, ({ totalResults }) => totalResults);\n\n/**\n * Sets the semantic queries state `params`.\n *\n * @public\n */\nexport const setSemanticQueriesExtraParamsWire = wireCommit('setParams');\n\n/**\n * Wiring configuration for the {@link SemanticQueriesXModule | semanticQueries module}.\n *\n * @internal\n */\nexport const semanticQueriesWiring = createWiring({\n UserClearedQuery: {\n clearQueryWire\n },\n SemanticQueryRequestUpdated: {\n fetchAndSaveSemanticQueryWire\n },\n ExtraParamsChanged: {\n setSemanticQueriesExtraParamsWire\n },\n SearchResponseChanged: {\n setQueryFromSearchResponseChangedWire,\n setTotalResultsFromSearchResponseChangedWire\n },\n SelectedRelatedTagsChanged: {\n setSemanticQueriesRelatedTags\n }\n});\n"],"names":[],"mappings":";;;;AASA;;;;AAIG;AACH,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAErC;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAEpD;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAExD;;;;AAIG;MACU,6BAA6B,GAAG,YAAY,CAAC,2BAA2B,EAAE;AAEvF;;;;AAIG;MACU,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE;AAEnD;;;;AAIG;MACU,qCAAqC,GAAG,OAAO,CAG1D,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,KAAK,EAAE;AAEnD;;;;AAIG;AACU,MAAA,cAAc,GAAG,UAAU,CAAC,UAAU,EAAE,EAAE,EAAE;AAEzD;;;;AAIG;MACU,mBAAmB,GAAG,UAAU,CAAC,iBAAiB,EAAE;AAEjE;AACA,MAAM,6BAA6B,GAAG,UAAU,CAAC,+BAA+B,CAAC,CAAC;AAElF;;;;AAIG;AACU,MAAA,4CAA4C,GAAG,OAAO,CAGjE,mBAAmB,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE;AAE3D;;;;AAIG;MACU,iCAAiC,GAAG,UAAU,CAAC,WAAW,EAAE;AAEzE;;;;AAIG;AACI,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAChD,IAAA,gBAAgB,EAAE;QAChB,cAAc;AACf,KAAA;AACD,IAAA,2BAA2B,EAAE;QAC3B,6BAA6B;AAC9B,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,iCAAiC;AAClC,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,qCAAqC;QACrC,4CAA4C;AAC7C,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,6BAA6B;AAC9B,KAAA;AACF,CAAA;;;;"}
@@ -14,17 +14,18 @@ var _sfc_main = defineComponent({
14
14
  xModule: taggingXModule.name,
15
15
  props: {
16
16
  /**
17
- * The TTL in milliseconds for storing the clicked result info.
17
+ * The TTL in milliseconds for storing the result info.
18
18
  */
19
- clickedResultStorageTTLMs: {
19
+ storageTTLMs: {
20
20
  type: Number,
21
21
  default: 30000
22
22
  },
23
23
  /**
24
- * The Object key of the {@link @empathyco/x-types#Result} clicked by the user
25
- * that will be used as id for the storage. By default, the Result url will be used.
24
+ * The Object key of the {@link @empathyco/x-types#Result} clicked or added to the cart by the user
25
+ * that will be used as id for the storage.
26
+ * By default, the Result url will be used.
26
27
  */
27
- clickedResultStorageKey: {
28
+ storageKey: {
28
29
  type: String,
29
30
  default: 'url'
30
31
  },
@@ -70,8 +71,8 @@ var _sfc_main = defineComponent({
70
71
  return {
71
72
  queryTaggingDebounceMs: props.queryTaggingDebounceMs,
72
73
  sessionTTLMs: props.sessionTTLMs,
73
- clickedResultStorageTTLMs: props.clickedResultStorageTTLMs,
74
- clickedResultStorageKey: props.clickedResultStorageKey
74
+ storageTTLMs: props.storageTTLMs,
75
+ storageKey: props.storageKey
75
76
  };
76
77
  });
77
78
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"tagging.vue.js","sources":["../../../../../src/x-modules/tagging/components/tagging.vue"],"sourcesContent":["<script lang=\"ts\">\n import { computed, defineComponent, inject, onMounted, watch } from 'vue';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n import { taggingXModule } from '../x-module';\n import { TaggingConfig } from '../config.types';\n import { useXBus } from '../../../composables/use-x-bus';\n /**\n * This component enables and manages the sending of information to the\n * [Empathy Tagging API](https://docs.empathy.co/develop-empathy-platform/api-reference/tagging-api.html).\n * It allows you to activate or deactivate the session id management through the `consent` prop.\n *\n * @public\n */\n export default defineComponent({\n name: 'Tagging',\n xModule: taggingXModule.name,\n props: {\n /**\n * The TTL in milliseconds for storing the clicked result info.\n */\n clickedResultStorageTTLMs: {\n type: Number,\n default: 30000\n },\n /**\n * The Object key of the {@link @empathyco/x-types#Result} clicked by the user\n * that will be used as id for the storage. By default, the Result url will be used.\n */\n clickedResultStorageKey: {\n type: String,\n default: 'url'\n },\n /**\n * The session TTL in milliseconds.\n */\n sessionTTLMs: Number,\n /**\n * The debounce time in milliseconds to track the query.\n */\n queryTaggingDebounceMs: {\n type: Number,\n default: 2000\n },\n /**\n * The consent to be emitted.\n */\n consent: {\n type: Boolean,\n default: null\n }\n },\n setup(props) {\n const xBus = useXBus();\n\n /**\n * It injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig');\n\n /**\n * The active consent, selected from the `consent` prop and the `snippetConfig.consent`\n * property. False by default.\n *\n * @remarks If the consent is undefined in the prop and in the snippetConfig, it will return\n * false.\n *\n * @returns A boolean that represents if the consent is accepted or not.\n */\n const activeConsent = computed(() => props.consent ?? snippetConfig?.consent ?? false);\n\n /**\n * The tagging config to be emitted.\n */\n const taggingConfig = computed<TaggingConfig>(() => {\n return {\n queryTaggingDebounceMs: props.queryTaggingDebounceMs,\n sessionTTLMs: props.sessionTTLMs as number,\n clickedResultStorageTTLMs: props.clickedResultStorageTTLMs,\n clickedResultStorageKey: props.clickedResultStorageKey\n };\n });\n\n /**\n * Emits the {@link TaggingXEvents.PDPIsLoaded} XEvent if the snippet config contains\n * a product id.\n */\n onMounted(() => {\n if (snippetConfig?.productId) {\n xBus.emit('PDPIsLoaded', snippetConfig.productId);\n }\n });\n\n /**\n * Emmits the consent when it changes.\n */\n watch(activeConsent, () => xBus.emit('ConsentProvided', activeConsent.value), {\n immediate: true\n });\n\n /**\n * Emmits the tagging config when it changes.\n */\n watch(taggingConfig, () => xBus.emit('TaggingConfigProvided', taggingConfig.value), {\n immediate: true\n });\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ConsentProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`TaggingConfigProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nThis component manages the tagging of the API to track the different features. This component\ndoesn't render elements to the DOM.\n\n```vue\n<template>\n <Tagging />\n</template>\n\n<script>\n import { Tagging } from '@empathyco/x-components/tagging';\n\n export default {\n name: 'TaggingDemo',\n components: {\n Tagging\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the `Tagging` component will emit `ConsentProvided` with payload false by default\nif the consent is not provided, the `TaggingConfigProvided` event will be emitted only if the props\n`queryTaggingDebounceMs`, `sessionDurationMs`, `clickedResultStorageTTLMs` or\n`clickedResultStorageKey`are defined.\n\nEvery time the user clicks a result the information for the clicked product will be stored on the\nbrowser during 30 seconds which is the default value for the prop `clickedResultStorageTTLMs`. To\ndistinguish the storage information for the different results the product url will be used since\n`clickedResultStorageKey` default value is 'url'.\n\n```vue\n<template>\n <Tagging :consent=\"true\" :queryTaggingDebounceMs=\"300\" :sessionDurationMs=\"30000\" />\n</template>\n\n<script>\n import { Tagging } from '@empathyco/x-components/tagging';\n\n export default {\n name: 'TaggingDemo',\n components: {\n Tagging\n }\n };\n</script>\n```\n\nIn this example, the clicked result information will be stored on the browser during 60 seconds and\nthe product id will be used as storage key.\n\n```vue\n<template>\n <Tagging :clickedResultStorageTTLMs=\"60000\" :clickedResultStorageKey=\"'id'\" />\n</template>\n\n<script>\n import { Tagging } from '@empathyco/x-components/tagging';\n\n export default {\n name: 'TaggingDemo',\n components: {\n Tagging\n }\n };\n</script>\n```\n\n### Play with events\n\nThe `Tagging` will emit the `ConsentProvided` when the component is loaded and the consent is set by\nthe prop or getting the value from the snippet config.\n\nThe `Tagging` will emit the `TaggingConfigProvided` when the component is loaded with the new\n[`TaggingConfig`](./../../api/x-components.taggingconfig.md) using the prop values.\n</docs>\n"],"names":[],"mappings":";;;;AAME;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,cAAc,CAAC,IAAI;AAC5B,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,yBAAyB,EAAE;AACzB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,KAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,uBAAuB,EAAE;AACvB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,KAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,YAAY,EAAE,MAAM;AACpB;;AAEE;AACF,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,IAAG;AACb,SAAA;AACD;;AAEE;AACF,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAG;AACd,SAAA;AACD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,IAAG,GAAI,OAAO,EAAE,CAAA;AAEtB;;AAEE;AACF,QAAA,MAAM,aAAY,GAAI,MAAM,CAA4B,eAAe,CAAC,CAAA;AAExE;;;;;;;;AAQE;AACF,QAAA,MAAM,aAAY,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,OAAM,IAAK,aAAa,EAAE,OAAQ,IAAG,KAAK,CAAC,CAAA;AAEtF;;AAEE;AACF,QAAA,MAAM,gBAAgB,QAAQ,CAAgB,MAAM;YAClD,OAAO;gBACL,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;gBACpD,YAAY,EAAE,KAAK,CAAC,YAAsB;gBAC1C,yBAAyB,EAAE,KAAK,CAAC,yBAAyB;gBAC1D,uBAAuB,EAAE,KAAK,CAAC,uBAAsB;aACtD,CAAA;AACH,SAAC,CAAC,CAAA;AAEF;;;AAGE;QACF,SAAS,CAAC,MAAM;YACd,IAAI,aAAa,EAAE,SAAS,EAAE;gBAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;AACnD,aAAA;AACF,SAAC,CAAC,CAAA;AAEF;;AAEE;AACF,QAAA,KAAK,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;AAC5E,YAAA,SAAS,EAAE,IAAG;AACf,SAAA,CAAC,CAAA;AAEF;;AAEE;AACF,QAAA,KAAK,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;AAClF,YAAA,SAAS,EAAE,IAAG;AACf,SAAA,CAAC,CAAA;;AAGF,QAAA,OAAO,MAAO,GAAC,CAAA;KACjB;AACD,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"tagging.vue.js","sources":["../../../../../src/x-modules/tagging/components/tagging.vue"],"sourcesContent":["<script lang=\"ts\">\n import { computed, defineComponent, inject, onMounted, watch } from 'vue';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n import { taggingXModule } from '../x-module';\n import { TaggingConfig } from '../config.types';\n import { useXBus } from '../../../composables/use-x-bus';\n /**\n * This component enables and manages the sending of information to the\n * [Empathy Tagging API](https://docs.empathy.co/develop-empathy-platform/api-reference/tagging-api.html).\n * It allows you to activate or deactivate the session id management through the `consent` prop.\n *\n * @public\n */\n export default defineComponent({\n name: 'Tagging',\n xModule: taggingXModule.name,\n props: {\n /**\n * The TTL in milliseconds for storing the result info.\n */\n storageTTLMs: {\n type: Number,\n default: 30000\n },\n /**\n * The Object key of the {@link @empathyco/x-types#Result} clicked or added to the cart by the user\n * that will be used as id for the storage.\n * By default, the Result url will be used.\n */\n storageKey: {\n type: String,\n default: 'url'\n },\n /**\n * The session TTL in milliseconds.\n */\n sessionTTLMs: Number,\n /**\n * The debounce time in milliseconds to track the query.\n */\n queryTaggingDebounceMs: {\n type: Number,\n default: 2000\n },\n /**\n * The consent to be emitted.\n */\n consent: {\n type: Boolean,\n default: null\n }\n },\n setup(props) {\n const xBus = useXBus();\n\n /**\n * It injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig');\n\n /**\n * The active consent, selected from the `consent` prop and the `snippetConfig.consent`\n * property. False by default.\n *\n * @remarks If the consent is undefined in the prop and in the snippetConfig, it will return\n * false.\n *\n * @returns A boolean that represents if the consent is accepted or not.\n */\n const activeConsent = computed(() => props.consent ?? snippetConfig?.consent ?? false);\n\n /**\n * The tagging config to be emitted.\n */\n const taggingConfig = computed<TaggingConfig>(() => {\n return {\n queryTaggingDebounceMs: props.queryTaggingDebounceMs,\n sessionTTLMs: props.sessionTTLMs as number,\n storageTTLMs: props.storageTTLMs,\n storageKey: props.storageKey\n };\n });\n\n /**\n * Emits the {@link TaggingXEvents.PDPIsLoaded} XEvent if the snippet config contains\n * a product id.\n */\n onMounted(() => {\n if (snippetConfig?.productId) {\n xBus.emit('PDPIsLoaded', snippetConfig.productId);\n }\n });\n\n /**\n * Emmits the consent when it changes.\n */\n watch(activeConsent, () => xBus.emit('ConsentProvided', activeConsent.value), {\n immediate: true\n });\n\n /**\n * Emmits the tagging config when it changes.\n */\n watch(taggingConfig, () => xBus.emit('TaggingConfigProvided', taggingConfig.value), {\n immediate: true\n });\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ConsentProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`TaggingConfigProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nThis component manages the tagging of the API to track the different features. This component\ndoesn't render elements to the DOM.\n\n```vue\n<template>\n <Tagging />\n</template>\n\n<script>\n import { Tagging } from '@empathyco/x-components/tagging';\n\n export default {\n name: 'TaggingDemo',\n components: {\n Tagging\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the `Tagging` component will emit `ConsentProvided` with payload false by default\nif the consent is not provided, the `TaggingConfigProvided` event will be emitted only if the props\n`queryTaggingDebounceMs`, `sessionDurationMs`, `storageTTLMs` or `storageKey`are defined.\n\nEvery time the user clicks a result or adds a result to the cart, the information for the product\nwill be stored on the browser during 30 seconds which is the default value for the prop\n`storageTTLMs`. To distinguish the storage information for the different results the product url\nwill be used since `storageKey` default value is 'url'.\n\n```vue\n<template>\n <Tagging :consent=\"true\" :queryTaggingDebounceMs=\"300\" :sessionDurationMs=\"30000\" />\n</template>\n\n<script>\n import { Tagging } from '@empathyco/x-components/tagging';\n\n export default {\n name: 'TaggingDemo',\n components: {\n Tagging\n }\n };\n</script>\n```\n\nIn this example, the clicked or added to cart result information will be stored on the browser\nduring 60 seconds and the product id will be used as storage key\n\n```vue\n<template>\n <Tagging :storageTTLMs=\"60000\" :storageKey=\"'id'\" />\n</template>\n\n<script>\n import { Tagging } from '@empathyco/x-components/tagging';\n\n export default {\n name: 'TaggingDemo',\n components: {\n Tagging\n }\n };\n</script>\n```\n\n### Play with events\n\nThe `Tagging` will emit the `ConsentProvided` when the component is loaded and the consent is set by\nthe prop or getting the value from the snippet config.\n\nThe `Tagging` will emit the `TaggingConfigProvided` when the component is loaded with the new\n[`TaggingConfig`](./../../api/x-components.taggingconfig.md) using the prop values.\n</docs>\n"],"names":[],"mappings":";;;;AAME;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,cAAc,CAAC,IAAI;AAC5B,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,KAAI;AACd,SAAA;AACD;;;;AAIE;AACF,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,KAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,YAAY,EAAE,MAAM;AACpB;;AAEE;AACF,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,IAAG;AACb,SAAA;AACD;;AAEE;AACF,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAG;AACd,SAAA;AACD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,IAAG,GAAI,OAAO,EAAE,CAAA;AAEtB;;AAEE;AACF,QAAA,MAAM,aAAY,GAAI,MAAM,CAA4B,eAAe,CAAC,CAAA;AAExE;;;;;;;;AAQE;AACF,QAAA,MAAM,aAAY,GAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,OAAM,IAAK,aAAa,EAAE,OAAQ,IAAG,KAAK,CAAC,CAAA;AAEtF;;AAEE;AACF,QAAA,MAAM,gBAAgB,QAAQ,CAAgB,MAAM;YAClD,OAAO;gBACL,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;gBACpD,YAAY,EAAE,KAAK,CAAC,YAAsB;gBAC1C,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,UAAU,EAAE,KAAK,CAAC,UAAS;aAC5B,CAAA;AACH,SAAC,CAAC,CAAA;AAEF;;;AAGE;QACF,SAAS,CAAC,MAAM;YACd,IAAI,aAAa,EAAE,SAAS,EAAE;gBAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;AACnD,aAAA;AACF,SAAC,CAAC,CAAA;AAEF;;AAEE;AACF,QAAA,KAAK,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;AAC5E,YAAA,SAAS,EAAE,IAAG;AACf,SAAA,CAAC,CAAA;AAEF;;AAEE;AACF,QAAA,KAAK,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE;AAClF,YAAA,SAAS,EAAE,IAAG;AACf,SAAA,CAAC,CAAA;;AAGF,QAAA,OAAO,MAAO,GAAC,CAAA;KACjB;AACD,CAAA,CAAC;;;;"}
@@ -9,11 +9,11 @@ import '../../../plugins/x-bus.js';
9
9
  import { XPlugin } from '../../../plugins/x-plugin.js';
10
10
 
11
11
  /**
12
- * Default implementation for the {@link PDPAddToCartService}.
12
+ * Default implementation for the {@link ExternalTaggingService}.
13
13
  *
14
14
  * @public
15
15
  */
16
- class DefaultPDPAddToCartService {
16
+ class DefaultExternalTaggingService {
17
17
  constructor(localStorageService = new BrowserStorageService(localStorage, 'x'), sessionStorageService = new BrowserStorageService(sessionStorage, 'x')) {
18
18
  this.localStorageService = localStorageService;
19
19
  this.sessionStorageService = sessionStorageService;
@@ -21,25 +21,41 @@ class DefaultPDPAddToCartService {
21
21
  get store() {
22
22
  return XPlugin.store;
23
23
  }
24
- get clickedResultStorageKey() {
25
- return this.store.state.x.tagging.config.clickedResultStorageKey;
24
+ get storageKey() {
25
+ return this.store.state.x.tagging.config.storageKey;
26
26
  }
27
- get clickedResultStorageTTLMs() {
28
- return this.store.state.x.tagging.config.clickedResultStorageTTLMs;
27
+ get storageTTLMs() {
28
+ return this.store.state.x.tagging.config.storageTTLMs;
29
29
  }
30
30
  /**
31
31
  * Stores in the local storage the information from the Result clicked by the user
32
- * in order to be able to track later on.
32
+ * in order to be able to track the add to cart later on the result's PDP.
33
33
  *
34
34
  * @param result - The result to store.
35
35
  *
36
36
  * @public
37
37
  */
38
38
  storeResultClicked(result) {
39
- const key = result[this.clickedResultStorageKey];
40
- const storageId = this.getStorageId(key);
39
+ const key = result[this.storageKey];
40
+ const storageId = this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY, key);
41
41
  if (storageId) {
42
- this.localStorageService.setItem(storageId, result, this.clickedResultStorageTTLMs);
42
+ this.localStorageService.setItem(storageId, result, this.storageTTLMs);
43
+ }
44
+ }
45
+ /**
46
+ * Stores in the local storage the information from the Result added to the cart
47
+ * by the user in order to be able to track the checkout later on when the checkout
48
+ * process has been completed by shopper.
49
+ *
50
+ * @param result - The result to store.
51
+ *
52
+ * @public
53
+ */
54
+ storeAddToCart(result) {
55
+ const key = result[this.storageKey];
56
+ const storageId = this.getStorageId(DefaultExternalTaggingService.ADD_TO_CART_ID_KEY, key);
57
+ if (storageId) {
58
+ this.localStorageService.setItem(storageId, result, this.storageTTLMs);
43
59
  }
44
60
  }
45
61
  /**
@@ -51,7 +67,7 @@ class DefaultPDPAddToCartService {
51
67
  * @public
52
68
  */
53
69
  moveToSessionStorage(id) {
54
- const storageId = this.getStorageId(id);
70
+ const storageId = this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY, id);
55
71
  if (storageId) {
56
72
  const result = this.localStorageService.removeItem(storageId);
57
73
  if (result) {
@@ -60,41 +76,50 @@ class DefaultPDPAddToCartService {
60
76
  }
61
77
  }
62
78
  /**
63
- * Checks if the session storage contains a result information for given id or the current url
64
- * and tracks the add to cart if exists.
79
+ * Checks if the session storage contains a result information for a given id or the current url.
80
+ * If exists, it tracks the add to cart and saves the add to cart information into session
81
+ * storage.
65
82
  *
66
83
  * @param id - The id of the result to track.
67
84
  *
68
85
  * @public
69
86
  */
70
87
  trackAddToCart(id) {
71
- const storageId = this.clickedResultStorageKey === 'url' ? this.getStorageId() : this.getStorageId(id);
88
+ const storageId = this.storageKey === 'url'
89
+ ? this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY)
90
+ : this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY, id);
72
91
  if (storageId) {
73
92
  const result = this.sessionStorageService.getItem(storageId);
74
93
  if (result?.tagging?.add2cart) {
75
94
  result.tagging.add2cart.params.location = 'pdp';
76
95
  this.store.dispatch('x/tagging/track', result.tagging.add2cart);
96
+ /**
97
+ * Done after tracking the add to cart to avoid tracking the checkout without
98
+ * an add to cart, in case the tracking fails.
99
+ */
100
+ this.storeAddToCart(result);
77
101
  }
78
102
  }
79
103
  }
80
104
  /**
81
105
  * Calculates the browser storage key for the given id.
82
106
  *
107
+ * @param keyPrefix - The key prefix to use in the storage.
83
108
  * @param id - The id to be used for the storage key.
84
109
  *
85
110
  * @returns The complete key to be used for storage.
86
111
  *
87
112
  * @internal
88
113
  */
89
- getStorageId(id) {
90
- if (this.clickedResultStorageKey === 'url') {
114
+ getStorageId(keyPrefix, id) {
115
+ if (this.storageKey === 'url') {
91
116
  let url = id ?? window.location.href;
92
117
  url = url.replace(/\s|\+/g, '%20');
93
118
  const pathName = this.getPathName(url);
94
- return `${DefaultPDPAddToCartService.RESULT_CLICKED_ID_KEY}-${pathName}`;
119
+ return `${keyPrefix}-${pathName}`;
95
120
  }
96
121
  else if (id) {
97
- return `${DefaultPDPAddToCartService.RESULT_CLICKED_ID_KEY}-${id}`;
122
+ return `${keyPrefix}-${id}`;
98
123
  }
99
124
  else {
100
125
  this.showWarningMessage();
@@ -107,7 +132,7 @@ class DefaultPDPAddToCartService {
107
132
  * @internal
108
133
  */
109
134
  showWarningMessage() {
110
- if (this.clickedResultStorageKey !== 'url') {
135
+ if (this.storageKey !== 'url') {
111
136
  //TODO: add here logger
112
137
  //eslint-disable-next-line no-console
113
138
  console.warn('No product id was provided but the storage was not configured to use the url');
@@ -143,15 +168,21 @@ class DefaultPDPAddToCartService {
143
168
  }
144
169
  }
145
170
  /**
146
- * Session id key to use as key in the storage.
171
+ * Session id key to use as key in the storage for result clicks.
172
+ *
173
+ * @public
174
+ */
175
+ DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY = 'add-to-cart';
176
+ /**
177
+ * Session id key to use as key in the storage for add to carts.
147
178
  *
148
179
  * @public
149
180
  */
150
- DefaultPDPAddToCartService.RESULT_CLICKED_ID_KEY = 'add-to-cart';
181
+ DefaultExternalTaggingService.ADD_TO_CART_ID_KEY = 'checkout';
151
182
  /**
152
- * Global instance of the {@link PDPAddToCartService}.
183
+ * Global instance of the {@link ExternalTaggingService}.
153
184
  */
154
- DefaultPDPAddToCartService.instance = new DefaultPDPAddToCartService();
185
+ DefaultExternalTaggingService.instance = new DefaultExternalTaggingService();
155
186
 
156
- export { DefaultPDPAddToCartService };
157
- //# sourceMappingURL=pdp-add-to-cart.service.js.map
187
+ export { DefaultExternalTaggingService };
188
+ //# sourceMappingURL=external-tagging.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-tagging.service.js","sources":["../../../../../src/x-modules/tagging/service/external-tagging.service.ts"],"sourcesContent":["import { Store } from 'vuex';\nimport { Result } from '@empathyco/x-types';\nimport { BrowserStorageService, StorageService } from '@empathyco/x-storage-service';\nimport { RootXStoreState } from '../../../store/index';\nimport { XPlugin } from '../../../plugins/index';\nimport { ExternalTaggingService } from './types';\n\n/**\n * Default implementation for the {@link ExternalTaggingService}.\n *\n * @public\n */\nexport class DefaultExternalTaggingService implements ExternalTaggingService {\n /**\n * Session id key to use as key in the storage for result clicks.\n *\n * @public\n */\n public static readonly RESULT_CLICKED_ID_KEY = 'add-to-cart';\n\n /**\n * Session id key to use as key in the storage for add to carts.\n *\n * @public\n */\n public static readonly ADD_TO_CART_ID_KEY = 'checkout';\n\n /**\n * Global instance of the {@link ExternalTaggingService}.\n */\n public static instance: ExternalTaggingService = new DefaultExternalTaggingService();\n\n public constructor(\n protected localStorageService: StorageService = new BrowserStorageService(localStorage, 'x'),\n protected sessionStorageService: StorageService = new BrowserStorageService(sessionStorage, 'x')\n ) {}\n\n protected get store(): Store<RootXStoreState> {\n return XPlugin.store;\n }\n\n protected get storageKey(): string {\n return this.store.state.x.tagging.config.storageKey as string;\n }\n\n protected get storageTTLMs(): number {\n return this.store.state.x.tagging.config.storageTTLMs as number;\n }\n\n /**\n * Stores in the local storage the information from the Result clicked by the user\n * in order to be able to track the add to cart later on the result's PDP.\n *\n * @param result - The result to store.\n *\n * @public\n */\n storeResultClicked(result: Result): void {\n const key = result[this.storageKey as keyof Result] as string;\n const storageId = this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY, key);\n if (storageId) {\n this.localStorageService.setItem(storageId, result, this.storageTTLMs);\n }\n }\n\n /**\n * Stores in the local storage the information from the Result added to the cart\n * by the user in order to be able to track the checkout later on when the checkout\n * process has been completed by shopper.\n *\n * @param result - The result to store.\n *\n * @public\n */\n storeAddToCart(result: Result): void {\n const key = result[this.storageKey as keyof Result] as string;\n const storageId = this.getStorageId(DefaultExternalTaggingService.ADD_TO_CART_ID_KEY, key);\n if (storageId) {\n this.localStorageService.setItem(storageId, result, this.storageTTLMs);\n }\n }\n\n /**\n * Checks if the local storage contains a result information for the given id and moves\n * the result info from the local storage to the session storage.\n *\n * @param id - The id of the result to move to the session storage.\n *\n * @public\n */\n moveToSessionStorage(id?: string): void {\n const storageId = this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY, id);\n if (storageId) {\n const result = this.localStorageService.removeItem(storageId);\n if (result) {\n this.sessionStorageService.setItem(storageId, result);\n }\n }\n }\n\n /**\n * Checks if the session storage contains a result information for a given id or the current url.\n * If exists, it tracks the add to cart and saves the add to cart information into session\n * storage.\n *\n * @param id - The id of the result to track.\n *\n * @public\n */\n trackAddToCart(id?: string): void {\n const storageId =\n this.storageKey === 'url'\n ? this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY)\n : this.getStorageId(DefaultExternalTaggingService.RESULT_CLICKED_ID_KEY, id);\n if (storageId) {\n const result = this.sessionStorageService.getItem<Result>(storageId);\n if (result?.tagging?.add2cart) {\n result.tagging.add2cart.params.location = 'pdp';\n this.store.dispatch('x/tagging/track', result.tagging.add2cart);\n /**\n * Done after tracking the add to cart to avoid tracking the checkout without\n * an add to cart, in case the tracking fails.\n */\n this.storeAddToCart(result);\n }\n }\n }\n\n /**\n * Calculates the browser storage key for the given id.\n *\n * @param keyPrefix - The key prefix to use in the storage.\n * @param id - The id to be used for the storage key.\n *\n * @returns The complete key to be used for storage.\n *\n * @internal\n */\n protected getStorageId(keyPrefix: string, id?: string): string | null {\n if (this.storageKey === 'url') {\n let url = id ?? window.location.href;\n url = url.replace(/\\s|\\+/g, '%20');\n const pathName = this.getPathName(url);\n return `${keyPrefix}-${pathName}`;\n } else if (id) {\n return `${keyPrefix}-${id}`;\n } else {\n this.showWarningMessage();\n return null;\n }\n }\n\n /**\n * Logs a warning message in case the tracking cannot be done.\n *\n * @internal\n */\n protected showWarningMessage(): void {\n if (this.storageKey !== 'url') {\n //TODO: add here logger\n //eslint-disable-next-line no-console\n console.warn('No product id was provided but the storage was not configured to use the url');\n }\n }\n\n /**\n * Returns the pathname for a given url.\n *\n * @param url - The url to get the pathname from.\n *\n * @returns The pathname of the url.\n *\n * @internal\n */\n protected getPathName(url: string): string {\n let urlObject: URL;\n try {\n // Check if the url is relative or absolute path\n if (/^(\\.\\.\\/|\\.\\/|\\/)/.test(url)) {\n urlObject = new URL(url, location.origin);\n } else {\n urlObject = new URL(url);\n }\n return urlObject.pathname;\n } catch (e) {\n //TODO: add here logger\n //eslint-disable-next-line no-console\n console.warn(`There was a problem with url ${url}`);\n return url;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAOA;;;;AAIG;MACU,6BAA6B,CAAA;AAoBxC,IAAA,WAAA,CACY,sBAAsC,IAAI,qBAAqB,CAAC,YAAY,EAAE,GAAG,CAAC,EAClF,qBAAA,GAAwC,IAAI,qBAAqB,CAAC,cAAc,EAAE,GAAG,CAAC,EAAA;QADtF,IAAmB,CAAA,mBAAA,GAAnB,mBAAmB,CAA+D;QAClF,IAAqB,CAAA,qBAAA,GAArB,qBAAqB,CAAiE;KAC9F;AAEJ,IAAA,IAAc,KAAK,GAAA;QACjB,OAAO,OAAO,CAAC,KAAK,CAAC;KACtB;AAED,IAAA,IAAc,UAAU,GAAA;AACtB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,UAAoB,CAAC;KAC/D;AAED,IAAA,IAAc,YAAY,GAAA;AACxB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAsB,CAAC;KACjE;AAED;;;;;;;AAOG;AACH,IAAA,kBAAkB,CAAC,MAAc,EAAA;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAA0B,CAAW,CAAC;AAC9D,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;AAC9F,QAAA,IAAI,SAAS,EAAE;AACb,YAAA,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;AACxE,SAAA;KACF;AAED;;;;;;;;AAQG;AACH,IAAA,cAAc,CAAC,MAAc,EAAA;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,UAA0B,CAAW,CAAC;AAC9D,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;AAC3F,QAAA,IAAI,SAAS,EAAE;AACb,YAAA,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;AACxE,SAAA;KACF;AAED;;;;;;;AAOG;AACH,IAAA,oBAAoB,CAAC,EAAW,EAAA;AAC9B,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AAC7F,QAAA,IAAI,SAAS,EAAE;YACb,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC9D,YAAA,IAAI,MAAM,EAAE;gBACV,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACvD,aAAA;AACF,SAAA;KACF;AAED;;;;;;;;AAQG;AACH,IAAA,cAAc,CAAC,EAAW,EAAA;AACxB,QAAA,MAAM,SAAS,GACb,IAAI,CAAC,UAAU,KAAK,KAAK;cACrB,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,qBAAqB,CAAC;cACtE,IAAI,CAAC,YAAY,CAAC,6BAA6B,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AACjF,QAAA,IAAI,SAAS,EAAE;YACb,MAAM,MAAM,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAS,SAAS,CAAC,CAAC;AACrE,YAAA,IAAI,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE;gBAC7B,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC;AAChD,gBAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChE;;;AAGG;AACH,gBAAA,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAC7B,aAAA;AACF,SAAA;KACF;AAED;;;;;;;;;AASG;IACO,YAAY,CAAC,SAAiB,EAAE,EAAW,EAAA;AACnD,QAAA,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;YAC7B,IAAI,GAAG,GAAG,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACrC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AACvC,YAAA,OAAO,CAAG,EAAA,SAAS,CAAI,CAAA,EAAA,QAAQ,EAAE,CAAC;AACnC,SAAA;AAAM,aAAA,IAAI,EAAE,EAAE;AACb,YAAA,OAAO,CAAG,EAAA,SAAS,CAAI,CAAA,EAAA,EAAE,EAAE,CAAC;AAC7B,SAAA;AAAM,aAAA;YACL,IAAI,CAAC,kBAAkB,EAAE,CAAC;AAC1B,YAAA,OAAO,IAAI,CAAC;AACb,SAAA;KACF;AAED;;;;AAIG;IACO,kBAAkB,GAAA;AAC1B,QAAA,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK,EAAE;;;AAG7B,YAAA,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;AAC9F,SAAA;KACF;AAED;;;;;;;;AAQG;AACO,IAAA,WAAW,CAAC,GAAW,EAAA;AAC/B,QAAA,IAAI,SAAc,CAAC;QACnB,IAAI;;AAEF,YAAA,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACjC,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC3C,aAAA;AAAM,iBAAA;AACL,gBAAA,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1B,aAAA;YACD,OAAO,SAAS,CAAC,QAAQ,CAAC;AAC3B,SAAA;AAAC,QAAA,OAAO,CAAC,EAAE;;;AAGV,YAAA,OAAO,CAAC,IAAI,CAAC,gCAAgC,GAAG,CAAA,CAAE,CAAC,CAAC;AACpD,YAAA,OAAO,GAAG,CAAC;AACZ,SAAA;KACF;;AAjLD;;;;AAIG;AACoB,6BAAqB,CAAA,qBAAA,GAAG,aAAa,CAAC;AAE7D;;;;AAIG;AACoB,6BAAkB,CAAA,kBAAA,GAAG,UAAU,CAAC;AAEvD;;AAEG;AACW,6BAAA,CAAA,QAAQ,GAA2B,IAAI,6BAA6B,EAAE;;;;"}