@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
@@ -10,7 +10,7 @@ const taggingEmitters = createStoreEmitters(taggingXStoreModule, {
10
10
  ConsentChanged: state => state.consent,
11
11
  SearchTaggingReceived: state => state.queryTaggingInfo,
12
12
  ResultURLTrackingEnabled: {
13
- selector: state => state.config.clickedResultStorageKey,
13
+ selector: state => state.config.storageKey,
14
14
  filter: newValue => newValue === 'url'
15
15
  }
16
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/tagging/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store/utils/store-emitters.utils';\nimport { taggingXStoreModule } from './module';\n\n/**\n * {@link StoreEmitters} For the tagging module.\n *\n * @internal\n */\nexport const taggingEmitters = createStoreEmitters(taggingXStoreModule, {\n ConsentChanged: state => state.consent!,\n SearchTaggingReceived: state => state.queryTaggingInfo!,\n ResultURLTrackingEnabled: {\n selector: state => state.config.clickedResultStorageKey!,\n filter: newValue => newValue === 'url'\n }\n});\n"],"names":[],"mappings":";;;AAGA;;;;AAIG;AACU,MAAA,eAAe,GAAG,mBAAmB,CAAC,mBAAmB,EAAE;AACtE,IAAA,cAAc,EAAE,KAAK,IAAI,KAAK,CAAC,OAAQ;AACvC,IAAA,qBAAqB,EAAE,KAAK,IAAI,KAAK,CAAC,gBAAiB;AACvD,IAAA,wBAAwB,EAAE;QACxB,QAAQ,EAAE,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,uBAAwB;AACxD,QAAA,MAAM,EAAE,QAAQ,IAAI,QAAQ,KAAK,KAAK;AACvC,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/tagging/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store/utils/store-emitters.utils';\nimport { taggingXStoreModule } from './module';\n\n/**\n * {@link StoreEmitters} For the tagging module.\n *\n * @internal\n */\nexport const taggingEmitters = createStoreEmitters(taggingXStoreModule, {\n ConsentChanged: state => state.consent!,\n SearchTaggingReceived: state => state.queryTaggingInfo!,\n ResultURLTrackingEnabled: {\n selector: state => state.config.storageKey!,\n filter: newValue => newValue === 'url'\n }\n});\n"],"names":[],"mappings":";;;AAGA;;;;AAIG;AACU,MAAA,eAAe,GAAG,mBAAmB,CAAC,mBAAmB,EAAE;AACtE,IAAA,cAAc,EAAE,KAAK,IAAI,KAAK,CAAC,OAAQ;AACvC,IAAA,qBAAqB,EAAE,KAAK,IAAI,KAAK,CAAC,gBAAiB;AACvD,IAAA,wBAAwB,EAAE;QACxB,QAAQ,EAAE,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,UAAW;AAC3C,QAAA,MAAM,EAAE,QAAQ,IAAI,QAAQ,KAAK,KAAK;AACvC,KAAA;AACF,CAAA;;;;"}
@@ -11,12 +11,16 @@ const taggingXStoreModule = {
11
11
  config: {
12
12
  sessionTTLMs: 30 * 60 * 1000,
13
13
  queryTaggingDebounceMs: 2000,
14
- clickedResultStorageKey: null,
15
- clickedResultStorageTTLMs: null
14
+ storageKey: null,
15
+ storageTTLMs: null
16
16
  },
17
17
  consent: null,
18
18
  noResultsTaggingEnabled: false,
19
- queryTaggingInfo: null
19
+ queryTaggingInfo: null,
20
+ toolingTaggingInfo: {
21
+ toolingDisplayClick: null,
22
+ toolingDisplayAdd2Cart: null
23
+ }
20
24
  }),
21
25
  getters: {},
22
26
  mutations: {
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/tagging/store/module.ts"],"sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { track } from './actions/track.action';\nimport { TaggingXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the tagging module.\n *\n * @internal\n */\nexport const taggingXStoreModule: TaggingXStoreModule = {\n state: () => ({\n config: {\n sessionTTLMs: 30 * 60 * 1000,\n queryTaggingDebounceMs: 2000,\n clickedResultStorageKey: null,\n clickedResultStorageTTLMs: null\n },\n consent: null,\n noResultsTaggingEnabled: false,\n queryTaggingInfo: null\n }),\n getters: {},\n mutations: {\n setConsent(state, consent) {\n state.consent = consent;\n },\n setQueryTaggingInfo(state, queryTaggingInfo: TaggingRequest) {\n state.queryTaggingInfo = queryTaggingInfo;\n },\n setNoResultsTaggingEnabled(state, module) {\n if (module === 'semanticQueries') {\n state.noResultsTaggingEnabled = true;\n }\n },\n setConfig,\n mergeConfig\n },\n actions: {\n track\n }\n};\n"],"names":[],"mappings":";;;AAKA;;;;AAIG;AACU,MAAA,mBAAmB,GAAwB;AACtD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;AAC5B,YAAA,sBAAsB,EAAE,IAAI;AAC5B,YAAA,uBAAuB,EAAE,IAAI;AAC7B,YAAA,yBAAyB,EAAE,IAAI;AAChC,SAAA;AACD,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,uBAAuB,EAAE,KAAK;AAC9B,QAAA,gBAAgB,EAAE,IAAI;KACvB,CAAC;AACF,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE;QACT,UAAU,CAAC,KAAK,EAAE,OAAO,EAAA;AACvB,YAAA,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgC,EAAA;AACzD,YAAA,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;SAC3C;QACD,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAA;YACtC,IAAI,MAAM,KAAK,iBAAiB,EAAE;AAChC,gBAAA,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC;AACtC,aAAA;SACF;QACD,SAAS;QACT,WAAW;AACZ,KAAA;AACD,IAAA,OAAO,EAAE;QACP,KAAK;AACN,KAAA;;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../../../../../src/x-modules/tagging/store/module.ts"],"sourcesContent":["import { TaggingRequest } from '@empathyco/x-types';\nimport { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { track } from './actions/track.action';\nimport { TaggingXStoreModule } from './types';\n\n/**\n * {@link XStoreModule} For the tagging module.\n *\n * @internal\n */\nexport const taggingXStoreModule: TaggingXStoreModule = {\n state: () => ({\n config: {\n sessionTTLMs: 30 * 60 * 1000,\n queryTaggingDebounceMs: 2000,\n storageKey: null,\n storageTTLMs: null\n },\n consent: null,\n noResultsTaggingEnabled: false,\n queryTaggingInfo: null,\n toolingTaggingInfo: {\n toolingDisplayClick: null,\n toolingDisplayAdd2Cart: null\n }\n }),\n getters: {},\n mutations: {\n setConsent(state, consent) {\n state.consent = consent;\n },\n setQueryTaggingInfo(state, queryTaggingInfo: TaggingRequest) {\n state.queryTaggingInfo = queryTaggingInfo;\n },\n setNoResultsTaggingEnabled(state, module) {\n if (module === 'semanticQueries') {\n state.noResultsTaggingEnabled = true;\n }\n },\n setConfig,\n mergeConfig\n },\n actions: {\n track\n }\n};\n"],"names":[],"mappings":";;;AAKA;;;;AAIG;AACU,MAAA,mBAAmB,GAAwB;AACtD,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,YAAY,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;AAC5B,YAAA,sBAAsB,EAAE,IAAI;AAC5B,YAAA,UAAU,EAAE,IAAI;AAChB,YAAA,YAAY,EAAE,IAAI;AACnB,SAAA;AACD,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,uBAAuB,EAAE,KAAK;AAC9B,QAAA,gBAAgB,EAAE,IAAI;AACtB,QAAA,kBAAkB,EAAE;AAClB,YAAA,mBAAmB,EAAE,IAAI;AACzB,YAAA,sBAAsB,EAAE,IAAI;AAC7B,SAAA;KACF,CAAC;AACF,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE;QACT,UAAU,CAAC,KAAK,EAAE,OAAO,EAAA;AACvB,YAAA,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;SACzB;QACD,mBAAmB,CAAC,KAAK,EAAE,gBAAgC,EAAA;AACzD,YAAA,KAAK,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;SAC3C;QACD,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAA;YACtC,IAAI,MAAM,KAAK,iBAAiB,EAAE;AAChC,gBAAA,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC;AACtC,aAAA;SACF;QACD,SAAS;QACT,WAAW;AACZ,KAAA;AACD,IAAA,OAAO,EAAE;QACP,KAAK;AACN,KAAA;;;;;"}
@@ -6,7 +6,7 @@ import { filter, mapWire } from '../../wiring/wires.operators.js';
6
6
  import { createWiring } from '../../wiring/wiring.utils.js';
7
7
  import { createOrigin } from '../../utils/origin.js';
8
8
  import '../../utils/storage.js';
9
- import { DefaultPDPAddToCartService } from './service/pdp-add-to-cart.service.js';
9
+ import { DefaultExternalTaggingService } from './service/external-tagging.service.js';
10
10
 
11
11
  /**
12
12
  * `tagging` {@link XModuleName | XModule name}.
@@ -35,21 +35,27 @@ const wireDispatch = namespacedWireDispatch(moduleName);
35
35
  */
36
36
  const wireSessionServiceWithoutPayload = wireServiceWithoutPayload(DefaultSessionService.instance);
37
37
  /**
38
- * Wires factory for {@link DefaultPDPAddToCartService}.
38
+ * Wires factory for {@link DefaultExternalTaggingService}.
39
39
  */
40
- const wirePDPAddToCartService = wireService(DefaultPDPAddToCartService.instance);
40
+ const wireExternalTaggingService = wireService(DefaultExternalTaggingService.instance);
41
41
  /**
42
42
  * Stores the given result on the local storage.
43
43
  *
44
44
  * @public
45
45
  */
46
- const storeClickedResultWire = wirePDPAddToCartService('storeResultClicked');
46
+ const storeClickedResultWire = wireExternalTaggingService('storeResultClicked');
47
+ /**
48
+ * Stores the result added to cart on the local storage.
49
+ *
50
+ * @public
51
+ */
52
+ const storeAddToCartWire = wireExternalTaggingService('storeAddToCart');
47
53
  /**
48
54
  * Moves the result information from the local storage to session storage.
49
55
  *
50
56
  * @public
51
57
  */
52
- const moveClickedResultToSessionWire = mapWire(wirePDPAddToCartService('moveToSessionStorage'), (payload) => {
58
+ const moveClickedResultToSessionWire = mapWire(wireExternalTaggingService('moveToSessionStorage'), (payload) => {
53
59
  return payload === 'url' ? undefined : payload;
54
60
  });
55
61
  /**
@@ -57,7 +63,7 @@ const moveClickedResultToSessionWire = mapWire(wirePDPAddToCartService('moveToSe
57
63
  *
58
64
  * @public
59
65
  */
60
- const trackAddToCartFromSessionStorage = wirePDPAddToCartService('trackAddToCart');
66
+ const trackAddToCartFromSessionStorage = wireExternalTaggingService('trackAddToCart');
61
67
  /**
62
68
  * Clears the session id.
63
69
  *
@@ -135,6 +141,24 @@ const trackAddToCartWire = createTrackWire('add2cart');
135
141
  * @public
136
142
  */
137
143
  const trackDisplayClickedWire = createTrackDisplayWire('displayClick');
144
+ /**
145
+ * Performs a track of a display result being clicked.
146
+ *
147
+ * @public
148
+ */
149
+ const trackToolingDisplayClickedWire = createTrackToolingDisplayWire();
150
+ /**
151
+ * Performs a track of a display result being clicked.
152
+ *
153
+ * @public
154
+ */
155
+ const trackToolingAdd2CartWire = createTrackToolingAdd2CartWire();
156
+ /**
157
+ * Performs a track of a clicked related prompt.
158
+ *
159
+ * @public
160
+ */
161
+ const trackRelatedPromptToolingDisplayClickWire = createTrackRelatedPromptToolingDisplayClickWire();
138
162
  /**
139
163
  * Performs a track of a display element appearing.
140
164
  *
@@ -196,7 +220,74 @@ function createTrackDisplayWire(property) {
196
220
  });
197
221
  taggingInfo.params.q = metadata.displayOriginalQuery;
198
222
  return taggingInfo;
199
- }), ({ eventPayload: { tagging } }) => !!tagging?.[property]);
223
+ }), ({ eventPayload: { tagging } }) => !!tagging?.[property]?.url);
224
+ }
225
+ /**
226
+ * Update the tooling tagging params with the result information.
227
+ *
228
+ * @param taggingRequest - The tooling tagging request to be updated.
229
+ * @param result - The clicked result.
230
+ * @returns The tagging request updated.
231
+ *
232
+ * @internal
233
+ */
234
+ function updateToolingTaggingWithResult(taggingRequest, result) {
235
+ taggingRequest.params.productId = result.id;
236
+ taggingRequest.params.title = result.name;
237
+ taggingRequest.params.url = result.url;
238
+ return taggingRequest;
239
+ }
240
+ /**
241
+ * Factory helper to create a wire for the track of the tooling display click.
242
+ *
243
+ * @returns A new wire for the tooling display click of the taggable element.
244
+ *
245
+ * @public
246
+ */
247
+ function createTrackToolingDisplayWire() {
248
+ return filter(wireDispatch('track', ({ eventPayload, metadata }) => {
249
+ const taggingInfo = metadata.toolingTagging;
250
+ const resultInfo = eventPayload;
251
+ updateToolingTaggingWithResult(taggingInfo, resultInfo);
252
+ return taggingInfo;
253
+ }), ({ metadata }) => !!metadata?.toolingTagging);
254
+ }
255
+ /**
256
+ * Factory helper to create a wire for the track of the tooling display add to cart.
257
+ *
258
+ * @returns A new wire for the tooling display add to cart of the taggable element.
259
+ *
260
+ * @public
261
+ */
262
+ function createTrackToolingAdd2CartWire() {
263
+ return filter(wireDispatch('track', ({ eventPayload, metadata }) => {
264
+ const taggingInfo = metadata.toolingAdd2CartTagging;
265
+ const resultInfo = eventPayload;
266
+ updateToolingTaggingWithResult(taggingInfo, resultInfo);
267
+ return taggingInfo;
268
+ }), ({ metadata }) => !!metadata?.toolingAdd2CartTagging);
269
+ }
270
+ /**
271
+ * Factory helper to create a wire for the track of the tooling display click in a related prompt.
272
+ *
273
+ * @returns A new wire for the tooling display click of the taggable element.
274
+ *
275
+ * @public
276
+ */
277
+ function createTrackRelatedPromptToolingDisplayClickWire() {
278
+ return filter(wireDispatch('track', ({ metadata }) => {
279
+ const relatedPrompt = metadata.relatedPrompt;
280
+ const taggingInfo = relatedPrompt.tagging.toolingDisplayClickTagging;
281
+ taggingInfo.params.productId = 'EXPAND';
282
+ taggingInfo.params.title = relatedPrompt.suggestionText;
283
+ taggingInfo.params.url = 'none';
284
+ return taggingInfo;
285
+ }), ({ metadata }) => {
286
+ const relatedPrompt = metadata.relatedPrompt;
287
+ const isUnselected = metadata?.selectedPrompt === -1;
288
+ const taggingInfo = relatedPrompt?.tagging?.toolingDisplayClickTagging;
289
+ return isUnselected && !!taggingInfo;
290
+ });
200
291
  }
201
292
  /**
202
293
  * Factory helper to create a wire to set the queryTagging.
@@ -244,7 +335,8 @@ const taggingWiring = createWiring({
244
335
  },
245
336
  UserClickedResultAddToCart: {
246
337
  trackAddToCartWire,
247
- trackResultClickedWire
338
+ trackResultClickedWire,
339
+ storeAddToCartWire
248
340
  },
249
341
  UserClickedPDPAddToCart: {
250
342
  trackAddToCartFromSessionStorage
@@ -261,8 +353,17 @@ const taggingWiring = createWiring({
261
353
  },
262
354
  ModuleRegistered: {
263
355
  setNoResultsTaggingEnabledWire
356
+ },
357
+ UserClickedARelatedPromptResult: {
358
+ trackToolingDisplayClickedWire
359
+ },
360
+ UserClickedARelatedPromptAdd2Cart: {
361
+ trackToolingAdd2CartWire
362
+ },
363
+ UserSelectedARelatedPrompt: {
364
+ trackRelatedPromptToolingDisplayClickWire
264
365
  }
265
366
  });
266
367
 
267
- export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackResultClickedWire };
368
+ export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackRelatedPromptToolingDisplayClickWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire };
268
369
  //# sourceMappingURL=wiring.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/tagging/wiring.ts"],"sourcesContent":["import { SemanticQuery, Taggable, Tagging, TaggingRequest } from '@empathyco/x-types';\nimport { DefaultSessionService } from '@empathyco/x-utils';\nimport {\n namespacedWireCommit,\n namespacedWireDispatch\n} from '../../wiring/namespaced-wires.factory';\nimport { namespacedDebounce } from '../../wiring/namespaced-wires.operators';\nimport { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory';\nimport { filter, mapWire } from '../../wiring/wires.operators';\nimport { DisplayWireMetadata, Wire } from '../../wiring/wiring.types';\nimport { createWiring } from '../../wiring/wiring.utils';\nimport { createOrigin } from '../../utils/index';\nimport { FeatureLocation } from '../../types/index';\nimport { DefaultPDPAddToCartService } from './service/pdp-add-to-cart.service';\n\n/**\n * `tagging` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'tagging';\n\n/**\n * Debounce function for the module.\n */\nconst moduleDebounce = namespacedDebounce(moduleName);\n\n/**\n * WireCommit for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName);\n\n/**\n * WireDispatch for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName);\n\n/**\n * Wires without payload factory for {@link DefaultSessionService}.\n */\nconst wireSessionServiceWithoutPayload = wireServiceWithoutPayload(DefaultSessionService.instance);\n\n/**\n * Wires factory for {@link DefaultPDPAddToCartService}.\n */\nconst wirePDPAddToCartService = wireService(DefaultPDPAddToCartService.instance);\n\n/**\n * Stores the given result on the local storage.\n *\n * @public\n */\nconst storeClickedResultWire = wirePDPAddToCartService('storeResultClicked');\n\n/**\n * Moves the result information from the local storage to session storage.\n *\n * @public\n */\nconst moveClickedResultToSessionWire = mapWire(\n wirePDPAddToCartService('moveToSessionStorage'),\n (payload: string) => {\n return payload === 'url' ? undefined : payload;\n }\n);\n\n/**\n * Triggers the add to cart tracking.\n *\n * @public\n */\nconst trackAddToCartFromSessionStorage = wirePDPAddToCartService('trackAddToCart');\n\n/**\n * Clears the session id.\n *\n * @public\n */\nconst clearSessionWire = filter(\n wireSessionServiceWithoutPayload('clearSessionId'),\n ({ eventPayload: consent }) => !consent\n);\n\n/**\n * Sets the tagging state `consent`.\n *\n * @public\n */\nexport const setConsent = wireCommit('setConsent');\n\n/**\n * Sets the tagging state `noResultsTaggingEnabled`.\n *\n * @public\n */\nexport const setNoResultsTaggingEnabledWire = wireCommit('setNoResultsTaggingEnabled');\n\n/**\n * Sets the tagging config state.\n *\n * @public\n */\nexport const setTaggingConfig = wireCommit('mergeConfig');\n\n/**\n * Tracks the tagging of the query.\n *\n * @public\n */\nexport const trackQueryWire = filter(\n wireDispatch('track'),\n ({ eventPayload, store }) =>\n (eventPayload as TaggingRequest).params.totalHits > 0 ||\n !store.state.x.tagging.noResultsTaggingEnabled\n);\n\n/**\n * Sets the tagging state of the query tagging info using a debounce which ends if the user\n * accepts a query.\n *\n * @public\n */\nexport const setQueryTaggingInfo = moduleDebounce(\n wireCommit('setQueryTaggingInfo'),\n ({ state }) => state.config.queryTaggingDebounceMs,\n {\n cancelOn: 'UserClearedQuery',\n forceOn: [\n 'UserClickedAResult',\n 'UserClickedAPromoted',\n 'UserClickedABanner',\n 'UserClickedARedirection',\n 'UserReachedResultsListEnd'\n ]\n }\n);\n\n/**\n * Sets the tagging state of the query tagging info using.\n *\n * @public\n */\nexport const setQueryTaggingFromQueryPreview = createSetQueryTaggingFromQueryPreview();\n\n/**\n * Tracks the tagging of the result.\n *\n * @public\n */\nexport const trackResultClickedWire = createTrackWire('click');\n\n/**\n * Tracks the tagging of the banner.\n *\n * @public\n */\nexport const trackBannerClickedWire = createTrackWire('click');\n\n/**\n * Performs a track of a result added to the cart.\n *\n * @public\n */\nexport const trackAddToCartWire = createTrackWire('add2cart');\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackDisplayClickedWire = createTrackDisplayWire('displayClick');\n\n/**\n * Performs a track of a display element appearing.\n *\n * @public\n */\nexport const trackElementDisplayedWire = createTrackDisplayWire('display');\n\n/**\n * Factory helper to create a wire for the track of a taggable element.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the given property of the taggable element.\n *\n * @public\n */\nexport function createTrackWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata: { location } }) => {\n const taggingInfo: TaggingRequest = tagging[property];\n taggingInfo.params.location = location as string;\n return taggingInfo;\n }),\n ({ eventPayload: { tagging }, metadata: { ignoreInModules } }) =>\n !!tagging?.[property] && !ignoreInModules?.includes(moduleName)\n );\n}\n\n/**\n * Performs a track of a query with no results that used semantics as fallback.\n * The totalHits will be changed to -1 if semantic queries are found in order to differentiate\n * it from scenarios where the user encounters a no-results page without any semantic queries.\n *\n * @public\n */\nexport const trackNoResultsQueryWithSemanticsWire = filter(\n wireDispatch('track', ({ eventPayload, state }) => {\n const { queryTaggingInfo } = state;\n const totalHits = (eventPayload as SemanticQuery[]).length > 0 ? -1 : 0;\n return {\n params: { ...queryTaggingInfo?.params, totalHits },\n url: queryTaggingInfo?.url ?? ''\n };\n }),\n ({ store }) => Number(store.state.x.tagging.queryTaggingInfo?.params.totalHits)! === 0\n);\n\n/**.\n * Debounced version of {@link trackNoResultsQueryWithSemanticsWire}\n *\n * @public\n */\nexport const trackNoResultsQueryWithSemanticsWireDebounced = moduleDebounce(\n trackNoResultsQueryWithSemanticsWire,\n ({ state }) => state.config.queryTaggingDebounceMs,\n { cancelOn: 'QueryPreviewUnmounted' }\n);\n\n/**\n * Factory helper to create a wire for the track of the display click.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the display click of the taggable element.\n *\n * @public\n */\nexport function createTrackDisplayWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata }) => {\n const taggingInfo: TaggingRequest = tagging[property];\n const location = metadata.location as FeatureLocation;\n\n taggingInfo.params.location = location;\n taggingInfo.params.displayFamily = createOrigin({\n feature: metadata.feature,\n location\n })!;\n taggingInfo.params.q = (metadata as DisplayWireMetadata).displayOriginalQuery;\n\n return taggingInfo;\n }),\n ({ eventPayload: { tagging } }) => !!tagging?.[property]\n );\n}\n\n/**\n * Factory helper to create a wire to set the queryTagging.\n *\n * @returns A new wire for the query of a result of a queryPreview.\n *\n * @public\n */\nexport function createSetQueryTaggingFromQueryPreview(): Wire<Taggable> {\n return filter(\n wireCommit(\n 'setQueryTaggingInfo',\n ({ metadata: { queryTagging } }) => queryTagging as TaggingRequest\n ),\n ({ metadata: { queryTagging } }) => !!queryTagging\n );\n}\n\n/**\n * Wiring configuration for the {@link TaggingXModule | tagging module}.\n *\n * @internal\n */\nexport const taggingWiring = createWiring({\n ConsentProvided: {\n setConsent\n },\n ConsentChanged: {\n clearSessionWire\n },\n PDPIsLoaded: {\n moveClickedResultToSessionWire\n },\n ResultURLTrackingEnabled: {\n moveClickedResultToSessionWire\n },\n SearchTaggingChanged: {\n setQueryTaggingInfo\n },\n SearchTaggingReceived: {\n trackQueryWire\n },\n TrackableElementDisplayed: {\n trackElementDisplayedWire\n },\n TaggingConfigProvided: {\n setTaggingConfig\n },\n UserClickedAResult: {\n trackResultClickedWire,\n storeClickedResultWire\n },\n UserClickedResultAddToCart: {\n trackAddToCartWire,\n trackResultClickedWire\n },\n UserClickedPDPAddToCart: {\n trackAddToCartFromSessionStorage\n },\n UserClickedABanner: {\n trackBannerClickedWire\n },\n UserClickedADisplayResult: {\n trackDisplayClickedWire,\n setQueryTaggingFromQueryPreview\n },\n SemanticQueriesResponseChanged: {\n trackNoResultsQueryWithSemanticsWireDebounced\n },\n ModuleRegistered: {\n setNoResultsTaggingEnabledWire\n }\n});\n"],"names":[],"mappings":";;;;;;;;;;AAeA;;;;AAIG;AACH,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;AAEG;AACH,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,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AACvB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,uBAAuB;QACvB,+BAA+B;AAChC,KAAA;AACD,IAAA,8BAA8B,EAAE;QAC9B,6CAA6C;AAC9C,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,8BAA8B;AAC/B,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/tagging/wiring.ts"],"sourcesContent":["import {\n RelatedPrompt,\n Result,\n SemanticQuery,\n Taggable,\n Tagging,\n TaggingRequest\n} from '@empathyco/x-types';\nimport { DefaultSessionService } from '@empathyco/x-utils';\nimport {\n namespacedWireCommit,\n namespacedWireDispatch\n} from '../../wiring/namespaced-wires.factory';\nimport { namespacedDebounce } from '../../wiring/namespaced-wires.operators';\nimport { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory';\nimport { filter, mapWire } from '../../wiring/wires.operators';\nimport { DisplayWireMetadata, Wire } from '../../wiring/wiring.types';\nimport { createWiring } from '../../wiring/wiring.utils';\nimport { createOrigin } from '../../utils/index';\nimport { FeatureLocation } from '../../types/index';\nimport { DefaultExternalTaggingService } from './service/external-tagging.service';\n\n/**\n * `tagging` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'tagging';\n\n/**\n * Debounce function for the module.\n */\nconst moduleDebounce = namespacedDebounce(moduleName);\n\n/**\n * WireCommit for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName);\n\n/**\n * WireDispatch for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName);\n\n/**\n * Wires without payload factory for {@link DefaultSessionService}.\n */\nconst wireSessionServiceWithoutPayload = wireServiceWithoutPayload(DefaultSessionService.instance);\n\n/**\n * Wires factory for {@link DefaultExternalTaggingService}.\n */\nconst wireExternalTaggingService = wireService(DefaultExternalTaggingService.instance);\n\n/**\n * Stores the given result on the local storage.\n *\n * @public\n */\nconst storeClickedResultWire = wireExternalTaggingService('storeResultClicked');\n\n/**\n * Stores the result added to cart on the local storage.\n *\n * @public\n */\nconst storeAddToCartWire = wireExternalTaggingService('storeAddToCart');\n\n/**\n * Moves the result information from the local storage to session storage.\n *\n * @public\n */\nconst moveClickedResultToSessionWire = mapWire(\n wireExternalTaggingService('moveToSessionStorage'),\n (payload: string) => {\n return payload === 'url' ? undefined : payload;\n }\n);\n\n/**\n * Triggers the add to cart tracking.\n *\n * @public\n */\nconst trackAddToCartFromSessionStorage = wireExternalTaggingService('trackAddToCart');\n\n/**\n * Clears the session id.\n *\n * @public\n */\nconst clearSessionWire = filter(\n wireSessionServiceWithoutPayload('clearSessionId'),\n ({ eventPayload: consent }) => !consent\n);\n\n/**\n * Sets the tagging state `consent`.\n *\n * @public\n */\nexport const setConsent = wireCommit('setConsent');\n\n/**\n * Sets the tagging state `noResultsTaggingEnabled`.\n *\n * @public\n */\nexport const setNoResultsTaggingEnabledWire = wireCommit('setNoResultsTaggingEnabled');\n\n/**\n * Sets the tagging config state.\n *\n * @public\n */\nexport const setTaggingConfig = wireCommit('mergeConfig');\n\n/**\n * Tracks the tagging of the query.\n *\n * @public\n */\nexport const trackQueryWire = filter(\n wireDispatch('track'),\n ({ eventPayload, store }) =>\n ((eventPayload as TaggingRequest).params.totalHits as number) > 0 ||\n !store.state.x.tagging.noResultsTaggingEnabled\n);\n\n/**\n * Sets the tagging state of the query tagging info using a debounce which ends if the user\n * accepts a query.\n *\n * @public\n */\nexport const setQueryTaggingInfo = moduleDebounce(\n wireCommit('setQueryTaggingInfo'),\n ({ state }) => state.config.queryTaggingDebounceMs,\n {\n cancelOn: 'UserClearedQuery',\n forceOn: [\n 'UserClickedAResult',\n 'UserClickedAPromoted',\n 'UserClickedABanner',\n 'UserClickedARedirection',\n 'UserReachedResultsListEnd'\n ]\n }\n);\n\n/**\n * Sets the tagging state of the query tagging info using.\n *\n * @public\n */\nexport const setQueryTaggingFromQueryPreview = createSetQueryTaggingFromQueryPreview();\n\n/**\n * Tracks the tagging of the result.\n *\n * @public\n */\nexport const trackResultClickedWire = createTrackWire('click');\n\n/**\n * Tracks the tagging of the banner.\n *\n * @public\n */\nexport const trackBannerClickedWire = createTrackWire('click');\n\n/**\n * Performs a track of a result added to the cart.\n *\n * @public\n */\nexport const trackAddToCartWire = createTrackWire('add2cart');\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackDisplayClickedWire = createTrackDisplayWire('displayClick');\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackToolingDisplayClickedWire = createTrackToolingDisplayWire();\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackToolingAdd2CartWire = createTrackToolingAdd2CartWire();\n\n/**\n * Performs a track of a clicked related prompt.\n *\n * @public\n */\nexport const trackRelatedPromptToolingDisplayClickWire =\n createTrackRelatedPromptToolingDisplayClickWire();\n\n/**\n * Performs a track of a display element appearing.\n *\n * @public\n */\nexport const trackElementDisplayedWire = createTrackDisplayWire('display');\n\n/**\n * Factory helper to create a wire for the track of a taggable element.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the given property of the taggable element.\n *\n * @public\n */\nexport function createTrackWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata: { location } }) => {\n const taggingInfo: TaggingRequest = tagging[property];\n taggingInfo.params.location = location as string;\n return taggingInfo;\n }),\n ({ eventPayload: { tagging }, metadata: { ignoreInModules } }) =>\n !!tagging?.[property] && !ignoreInModules?.includes(moduleName)\n );\n}\n\n/**\n * Performs a track of a query with no results that used semantics as fallback.\n * The totalHits will be changed to -1 if semantic queries are found in order to differentiate\n * it from scenarios where the user encounters a no-results page without any semantic queries.\n *\n * @public\n */\nexport const trackNoResultsQueryWithSemanticsWire = filter(\n wireDispatch('track', ({ eventPayload, state }) => {\n const { queryTaggingInfo } = state;\n const totalHits = (eventPayload as SemanticQuery[]).length > 0 ? -1 : 0;\n return {\n params: { ...queryTaggingInfo?.params, totalHits },\n url: queryTaggingInfo?.url ?? ''\n };\n }),\n ({ store }) => Number(store.state.x.tagging.queryTaggingInfo?.params.totalHits)! === 0\n);\n\n/**.\n * Debounced version of {@link trackNoResultsQueryWithSemanticsWire}\n *\n * @public\n */\nexport const trackNoResultsQueryWithSemanticsWireDebounced = moduleDebounce(\n trackNoResultsQueryWithSemanticsWire,\n ({ state }) => state.config.queryTaggingDebounceMs,\n { cancelOn: 'QueryPreviewUnmounted' }\n);\n\n/**\n * Factory helper to create a wire for the track of the display click.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the display click of the taggable element.\n *\n * @public\n */\nexport function createTrackDisplayWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata }) => {\n const taggingInfo: TaggingRequest = tagging[property];\n const location = metadata.location as FeatureLocation;\n\n taggingInfo.params.location = location;\n taggingInfo.params.displayFamily = createOrigin({\n feature: metadata.feature,\n location\n })!;\n taggingInfo.params.q = (metadata as DisplayWireMetadata).displayOriginalQuery;\n\n return taggingInfo;\n }),\n ({ eventPayload: { tagging } }) => !!tagging?.[property]?.url\n );\n}\n\n/**\n * Update the tooling tagging params with the result information.\n *\n * @param taggingRequest - The tooling tagging request to be updated.\n * @param result - The clicked result.\n * @returns The tagging request updated.\n *\n * @internal\n */\nfunction updateToolingTaggingWithResult(\n taggingRequest: TaggingRequest,\n result: Result\n): TaggingRequest {\n taggingRequest.params.productId = result.id;\n taggingRequest.params.title = result.name!;\n taggingRequest.params.url = result.url!;\n\n return taggingRequest;\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display click.\n *\n * @returns A new wire for the tooling display click of the taggable element.\n *\n * @public\n */\nexport function createTrackToolingDisplayWire(): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload, metadata }) => {\n const taggingInfo: TaggingRequest = metadata.toolingTagging as TaggingRequest;\n const resultInfo = eventPayload as Result;\n\n updateToolingTaggingWithResult(taggingInfo, resultInfo);\n\n return taggingInfo;\n }),\n ({ metadata }) => !!metadata?.toolingTagging\n );\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display add to cart.\n *\n * @returns A new wire for the tooling display add to cart of the taggable element.\n *\n * @public\n */\nexport function createTrackToolingAdd2CartWire(): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload, metadata }) => {\n const taggingInfo: TaggingRequest = metadata.toolingAdd2CartTagging as TaggingRequest;\n const resultInfo = eventPayload as Result;\n\n updateToolingTaggingWithResult(taggingInfo, resultInfo);\n\n return taggingInfo;\n }),\n ({ metadata }) => !!metadata?.toolingAdd2CartTagging\n );\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display click in a related prompt.\n *\n * @returns A new wire for the tooling display click of the taggable element.\n *\n * @public\n */\nexport function createTrackRelatedPromptToolingDisplayClickWire() {\n return filter(\n wireDispatch('track', ({ metadata }) => {\n const relatedPrompt = metadata.relatedPrompt as RelatedPrompt;\n const taggingInfo = relatedPrompt.tagging!.toolingDisplayClickTagging as TaggingRequest;\n\n taggingInfo.params.productId = 'EXPAND';\n taggingInfo.params.title = relatedPrompt.suggestionText;\n taggingInfo.params.url = 'none';\n\n return taggingInfo;\n }),\n ({ metadata }) => {\n const relatedPrompt = metadata.relatedPrompt as RelatedPrompt | undefined;\n const isUnselected = metadata?.selectedPrompt === -1;\n const taggingInfo = relatedPrompt?.tagging?.toolingDisplayClickTagging;\n return isUnselected && !!taggingInfo;\n }\n );\n}\n\n/**\n * Factory helper to create a wire to set the queryTagging.\n *\n * @returns A new wire for the query of a result of a queryPreview.\n *\n * @public\n */\nexport function createSetQueryTaggingFromQueryPreview(): Wire<Taggable> {\n return filter(\n wireCommit(\n 'setQueryTaggingInfo',\n ({ metadata: { queryTagging } }) => queryTagging as TaggingRequest\n ),\n ({ metadata: { queryTagging } }) => !!queryTagging\n );\n}\n\n/**\n * Wiring configuration for the {@link TaggingXModule | tagging module}.\n *\n * @internal\n */\nexport const taggingWiring = createWiring({\n ConsentProvided: {\n setConsent\n },\n ConsentChanged: {\n clearSessionWire\n },\n PDPIsLoaded: {\n moveClickedResultToSessionWire\n },\n ResultURLTrackingEnabled: {\n moveClickedResultToSessionWire\n },\n SearchTaggingChanged: {\n setQueryTaggingInfo\n },\n SearchTaggingReceived: {\n trackQueryWire\n },\n TrackableElementDisplayed: {\n trackElementDisplayedWire\n },\n TaggingConfigProvided: {\n setTaggingConfig\n },\n UserClickedAResult: {\n trackResultClickedWire,\n storeClickedResultWire\n },\n UserClickedResultAddToCart: {\n trackAddToCartWire,\n trackResultClickedWire,\n storeAddToCartWire\n },\n UserClickedPDPAddToCart: {\n trackAddToCartFromSessionStorage\n },\n UserClickedABanner: {\n trackBannerClickedWire\n },\n UserClickedADisplayResult: {\n trackDisplayClickedWire,\n setQueryTaggingFromQueryPreview\n },\n SemanticQueriesResponseChanged: {\n trackNoResultsQueryWithSemanticsWireDebounced\n },\n ModuleRegistered: {\n setNoResultsTaggingEnabledWire\n },\n UserClickedARelatedPromptResult: {\n trackToolingDisplayClickedWire\n },\n UserClickedARelatedPromptAdd2Cart: {\n trackToolingAdd2CartWire\n },\n UserSelectedARelatedPrompt: {\n trackRelatedPromptToolingDisplayClickWire\n }\n});\n"],"names":[],"mappings":";;;;;;;;;;AAsBA;;;;AAIG;AACH,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;AAEG;AACH,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEtD;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAEpD;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAExD;;AAEG;AACH,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAEnG;;AAEG;AACH,MAAM,0BAA0B,GAAG,WAAW,CAAC,6BAA6B,CAAC,QAAQ,CAAC,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AAC;AAED;;;;AAIG;AACI,MAAM,aAAa,GAAG,YAAY,CAAC;AACxC,IAAA,eAAe,EAAE;QACf,UAAU;AACX,KAAA;AACD,IAAA,cAAc,EAAE;QACd,gBAAgB;AACjB,KAAA;AACD,IAAA,WAAW,EAAE;QACX,8BAA8B;AAC/B,KAAA;AACD,IAAA,wBAAwB,EAAE;QACxB,8BAA8B;AAC/B,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,mBAAmB;AACpB,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,cAAc;AACf,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,yBAAyB;AAC1B,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,gBAAgB;AACjB,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,sBAAsB;QACtB,sBAAsB;AACvB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,kBAAkB;QAClB,sBAAsB;QACtB,kBAAkB;AACnB,KAAA;AACD,IAAA,uBAAuB,EAAE;QACvB,gCAAgC;AACjC,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,sBAAsB;AACvB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,uBAAuB;QACvB,+BAA+B;AAChC,KAAA;AACD,IAAA,8BAA8B,EAAE;QAC9B,6CAA6C;AAC9C,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,8BAA8B;AAC/B,KAAA;AACD,IAAA,+BAA+B,EAAE;QAC/B,8BAA8B;AAC/B,KAAA;AACD,IAAA,iCAAiC,EAAE;QACjC,wBAAwB;AACzB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,yCAAyC;AAC1C,KAAA;AACF,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"url-handler.vue.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents @pageshow=\"onPageShow\" @popstate=\"emitEvents\" target=\"window\" />\n</template>\n\n<script lang=\"ts\">\n import { Dictionary, objectFilter } from '@empathyco/x-utils';\n import { computed, defineComponent, inject, onMounted, ref } from 'vue';\n import { GlobalEvents } from 'vue-global-events';\n import { FeatureLocation } from '../../../types/origin';\n import { UrlParams } from '../../../types/url-params';\n import { isArrayEmpty } from '../../../utils/array';\n import { WireMetadata } from '../../../wiring/wiring.types';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n import { initialUrlState } from '../store/initial-state';\n import { UrlParamValue } from '../store/types';\n import { urlXModule } from '../x-module';\n import { use$x } from '../../../composables/use-$x';\n import { useState } from '../../../composables/use-state';\n\n interface ParsedUrlParams {\n all: UrlParams;\n extra: Dictionary<unknown>;\n }\n\n /**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\n export default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents\n },\n xModule: urlXModule.name,\n setup: function (props, { attrs }) {\n const $x = use$x();\n\n const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams;\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig');\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false);\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined);\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false);\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => {\n return Object.keys({ ...initialUrlState, ...attrs });\n });\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string): string => {\n const paramValue = attrs[paramName];\n return typeof paramValue === 'string' ? paramValue : paramName;\n };\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL): void => {\n managedParamsNames.value.forEach(paramName =>\n url.searchParams.delete(getUrlKey(paramName))\n );\n };\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1;\n });\n };\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return;\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string)\n );\n const sortedParameters = sortParams(filteredParams);\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName);\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value));\n });\n } else {\n url.searchParams.set(urlParamKey, String(paramValue));\n }\n });\n };\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState']\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href);\n deleteUrlParameters(newUrl);\n setUrlParameters(newUrl, newUrlParams);\n\n newUrl.href = newUrl.href.replace(/\\+/g, '%20');\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href);\n }\n url.value = newUrl;\n }\n };\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history));\n });\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history));\n });\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted;\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined;\n }\n };\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0]);\n case 'boolean':\n return value[0].toLowerCase() === 'true';\n case 'string':\n return value[0];\n default:\n // array\n return value;\n }\n };\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams;\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name);\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey);\n params.all[name] = parseUrlParam(name, urlValue);\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey);\n }\n }\n return params;\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } }\n );\n };\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value;\n const navigationEntries = window.performance.getEntriesByType('navigation');\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type;\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload');\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false;\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n }\n };\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href);\n const previousUrl = url.value;\n url.value = currentUrl;\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search &&\n previousUrl?.pathname === currentUrl.pathname;\n if (isInternalNavigation) {\n return 'url_history';\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp';\n }\n\n return 'external';\n };\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation()\n };\n };\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams();\n const metadata = createWireMetadata();\n $x.emit('ParamsLoadedFromUrl', all, metadata);\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata);\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata);\n }\n urlLoaded.value = true;\n };\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents();\n });\n\n return {\n onPageShow,\n emitEvents\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](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 browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock"],"mappings":";;;;;kCACEA,gBAA8E,CAAA,cAAA,CAAA,CAAA;AAAxC,EAAA,OAAAC,SAAA,EAAoB,EAAAC,WAAA,CAAA,uBAAA,EAAA;AAAA,IAAE,YAAO,IAAQ,CAAA,UAAA;AAAA,IAAA,UAAA,EAAA,IAAA,CAAA,UAAA;;;;;;;;"}
1
+ {"version":3,"file":"url-handler.vue.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents @pageshow=\"onPageShow\" @popstate=\"emitEvents\" target=\"window\" />\n</template>\n\n<script lang=\"ts\">\n import { Dictionary, objectFilter } from '@empathyco/x-utils';\n import { computed, defineComponent, inject, onMounted, ref } from 'vue';\n import { GlobalEvents } from 'vue-global-events';\n import { FeatureLocation } from '../../../types/origin';\n import { UrlParams } from '../../../types/url-params';\n import { isArrayEmpty } from '../../../utils/array';\n import { WireMetadata } from '../../../wiring/wiring.types';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n import { initialUrlState } from '../store/initial-state';\n import { UrlParamValue } from '../store/types';\n import { urlXModule } from '../x-module';\n import { use$x } from '../../../composables/use-$x';\n import { useState } from '../../../composables/use-state';\n\n interface ParsedUrlParams {\n all: UrlParams;\n extra: Dictionary<unknown>;\n }\n\n /**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\n export default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents\n },\n xModule: urlXModule.name,\n setup: function (_, { attrs }) {\n const $x = use$x();\n\n const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams;\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig');\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false);\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined);\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false);\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }));\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string) => {\n const paramValue = attrs[paramName];\n return typeof paramValue === 'string' ? paramValue : paramName;\n };\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL) => {\n managedParamsNames.value.forEach(paramName =>\n url.searchParams.delete(getUrlKey(paramName))\n );\n };\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1;\n });\n };\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return;\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string)\n );\n const sortedParameters = sortParams(filteredParams);\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName);\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value));\n });\n } else {\n url.searchParams.set(urlParamKey, String(paramValue));\n }\n });\n };\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState']\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href);\n deleteUrlParameters(newUrl);\n setUrlParameters(newUrl, newUrlParams);\n\n // Normalize '+' characters into '%20' for spaces in url params.\n newUrl.search = newUrl.search.replace(/\\+/g, '%20');\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href);\n }\n url.value = newUrl;\n }\n };\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history));\n });\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history));\n });\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted;\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined;\n }\n };\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0]);\n case 'boolean':\n return value[0].toLowerCase() === 'true';\n case 'string':\n return value[0];\n default:\n // array\n return value;\n }\n };\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams;\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name);\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey);\n params.all[name] = parseUrlParam(name, urlValue);\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey);\n }\n }\n return params;\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } }\n );\n };\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value;\n const navigationEntries = window.performance.getEntriesByType('navigation');\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type;\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload');\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false;\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n }\n };\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href);\n const previousUrl = url.value;\n url.value = currentUrl;\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search &&\n previousUrl?.pathname === currentUrl.pathname;\n if (isInternalNavigation) {\n return 'url_history';\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp';\n }\n\n return 'external';\n };\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation()\n };\n };\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams();\n const metadata = createWireMetadata();\n $x.emit('ParamsLoadedFromUrl', all, metadata);\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata);\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata);\n }\n urlLoaded.value = true;\n };\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents();\n });\n\n return {\n onPageShow,\n emitEvents\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](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 browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock"],"mappings":";;;;;kCACEA,gBAA8E,CAAA,cAAA,CAAA,CAAA;AAAxC,EAAA,OAAAC,SAAA,EAAoB,EAAAC,WAAA,CAAA,uBAAA,EAAA;AAAA,IAAE,YAAO,IAAQ,CAAA,UAAA;AAAA,IAAA,UAAA,EAAA,IAAA,CAAA,UAAA;;;;;;;;"}
@@ -20,7 +20,7 @@ var _sfc_main = defineComponent({
20
20
  GlobalEvents
21
21
  },
22
22
  xModule: urlXModule.name,
23
- setup: function (props, { attrs }) {
23
+ setup: function (_, { attrs }) {
24
24
  const $x = use$x();
25
25
  const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams;
26
26
  /**
@@ -56,9 +56,7 @@ var _sfc_main = defineComponent({
56
56
  *
57
57
  * @internal
58
58
  */
59
- const managedParamsNames = computed(() => {
60
- return Object.keys({ ...initialUrlState, ...attrs });
61
- });
59
+ const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }));
62
60
  /**
63
61
  * Returns the mapping of the param keys used in the URL is configured through $attrs. This way
64
62
  * we can support any param and extra param, no matters its name.
@@ -140,7 +138,8 @@ var _sfc_main = defineComponent({
140
138
  const newUrl = new URL(window.location.href);
141
139
  deleteUrlParameters(newUrl);
142
140
  setUrlParameters(newUrl, newUrlParams);
143
- newUrl.href = newUrl.href.replace(/\+/g, '%20');
141
+ // Normalize '+' characters into '%20' for spaces in url params.
142
+ newUrl.search = newUrl.search.replace(/\+/g, '%20');
144
143
  if (newUrl.href !== window.location.href) {
145
144
  historyMethod({ ...window.history.state }, document.title, newUrl.href);
146
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"url-handler.vue2.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents @pageshow=\"onPageShow\" @popstate=\"emitEvents\" target=\"window\" />\n</template>\n\n<script lang=\"ts\">\n import { Dictionary, objectFilter } from '@empathyco/x-utils';\n import { computed, defineComponent, inject, onMounted, ref } from 'vue';\n import { GlobalEvents } from 'vue-global-events';\n import { FeatureLocation } from '../../../types/origin';\n import { UrlParams } from '../../../types/url-params';\n import { isArrayEmpty } from '../../../utils/array';\n import { WireMetadata } from '../../../wiring/wiring.types';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n import { initialUrlState } from '../store/initial-state';\n import { UrlParamValue } from '../store/types';\n import { urlXModule } from '../x-module';\n import { use$x } from '../../../composables/use-$x';\n import { useState } from '../../../composables/use-state';\n\n interface ParsedUrlParams {\n all: UrlParams;\n extra: Dictionary<unknown>;\n }\n\n /**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\n export default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents\n },\n xModule: urlXModule.name,\n setup: function (props, { attrs }) {\n const $x = use$x();\n\n const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams;\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig');\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false);\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined);\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false);\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => {\n return Object.keys({ ...initialUrlState, ...attrs });\n });\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string): string => {\n const paramValue = attrs[paramName];\n return typeof paramValue === 'string' ? paramValue : paramName;\n };\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL): void => {\n managedParamsNames.value.forEach(paramName =>\n url.searchParams.delete(getUrlKey(paramName))\n );\n };\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1;\n });\n };\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return;\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string)\n );\n const sortedParameters = sortParams(filteredParams);\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName);\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value));\n });\n } else {\n url.searchParams.set(urlParamKey, String(paramValue));\n }\n });\n };\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState']\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href);\n deleteUrlParameters(newUrl);\n setUrlParameters(newUrl, newUrlParams);\n\n newUrl.href = newUrl.href.replace(/\\+/g, '%20');\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href);\n }\n url.value = newUrl;\n }\n };\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history));\n });\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history));\n });\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted;\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined;\n }\n };\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0]);\n case 'boolean':\n return value[0].toLowerCase() === 'true';\n case 'string':\n return value[0];\n default:\n // array\n return value;\n }\n };\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams;\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name);\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey);\n params.all[name] = parseUrlParam(name, urlValue);\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey);\n }\n }\n return params;\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } }\n );\n };\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value;\n const navigationEntries = window.performance.getEntriesByType('navigation');\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type;\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload');\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false;\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n }\n };\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href);\n const previousUrl = url.value;\n url.value = currentUrl;\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search &&\n previousUrl?.pathname === currentUrl.pathname;\n if (isInternalNavigation) {\n return 'url_history';\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp';\n }\n\n return 'external';\n };\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation()\n };\n };\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams();\n const metadata = createWireMetadata();\n $x.emit('ParamsLoadedFromUrl', all, metadata);\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata);\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata);\n }\n urlLoaded.value = true;\n };\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents();\n });\n\n return {\n onPageShow,\n emitEvents\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](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 browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;AAwBE;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,UAAU,EAAE;QACV,YAAW;AACZ,KAAA;IACD,OAAO,EAAE,UAAU,CAAC,IAAI;AACxB,IAAA,KAAK,EAAE,UAAU,KAAK,EAAE,EAAE,KAAM,EAAC,EAAA;AAC/B,QAAA,MAAM,EAAC,GAAI,KAAK,EAAE,CAAA;AAElB,QAAA,MAAM,kBAAmB,GAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,kBAAkB,CAAA;AAErF;;;;AAIE;AACF,QAAA,MAAM,aAAY,GAAI,MAAM,CAA4B,eAAe,CAAC,CAAA;AAExE;;;;AAIE;AACF,QAAA,MAAM,SAAU,GAAE,GAAG,CAAC,KAAK,CAAC,CAAA;AAE5B;;;;AAIE;AACF,QAAA,MAAM,GAAI,GAAE,GAAG,CAAkB,SAAS,CAAC,CAAA;AAE3C;;;;AAIE;AACF,QAAA,MAAM,eAAgB,GAAE,GAAG,CAAC,KAAK,CAAC,CAAA;AAElC;;;;;;;;AAQE;AACF,QAAA,MAAM,kBAAiB,GAAI,QAAQ,CAAC,MAAM;AACxC,YAAA,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,eAAe,EAAE,GAAG,KAAM,EAAC,CAAC,CAAA;AACtD,SAAC,CAAC,CAAA;AAEF;;;;;;;;AAQE;AACF,QAAA,MAAM,SAAU,GAAE,CAAC,SAAiB,KAAa;AAC/C,YAAA,MAAM,UAAW,GAAE,KAAK,CAAC,SAAS,CAAC,CAAA;AACnC,YAAA,OAAO,OAAO,UAAW,KAAI,QAAS,GAAE,UAAS,GAAI,SAAS,CAAA;AAChE,SAAC,CAAA;AAED;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GAAG,CAAC,KAAK,EAAE;gBACb,EAAE,CAAC,IAAI,CAAC,2BAA2B,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC3D,aAAA;AACA,YAAA,SAAS,CAAC,KAAI,GAAI,IAAI,CAAA;AACxB,SAAC,CAAA;AAED;;;AAGE;QACF,SAAS,CAAC,MAAM;AACd,YAAA,UAAU,EAAE,CAAA;AACd,SAAC,CAAC,CAAA;QAEF,OAAO;YACL,UAAU;YACV,UAAS;SACV,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"url-handler.vue2.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents @pageshow=\"onPageShow\" @popstate=\"emitEvents\" target=\"window\" />\n</template>\n\n<script lang=\"ts\">\n import { Dictionary, objectFilter } from '@empathyco/x-utils';\n import { computed, defineComponent, inject, onMounted, ref } from 'vue';\n import { GlobalEvents } from 'vue-global-events';\n import { FeatureLocation } from '../../../types/origin';\n import { UrlParams } from '../../../types/url-params';\n import { isArrayEmpty } from '../../../utils/array';\n import { WireMetadata } from '../../../wiring/wiring.types';\n import { SnippetConfig } from '../../../x-installer/api/api.types';\n import { initialUrlState } from '../store/initial-state';\n import { UrlParamValue } from '../store/types';\n import { urlXModule } from '../x-module';\n import { use$x } from '../../../composables/use-$x';\n import { useState } from '../../../composables/use-state';\n\n interface ParsedUrlParams {\n all: UrlParams;\n extra: Dictionary<unknown>;\n }\n\n /**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\n export default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents\n },\n xModule: urlXModule.name,\n setup: function (_, { attrs }) {\n const $x = use$x();\n\n const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams;\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig');\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false);\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined);\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false);\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }));\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string) => {\n const paramValue = attrs[paramName];\n return typeof paramValue === 'string' ? paramValue : paramName;\n };\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL) => {\n managedParamsNames.value.forEach(paramName =>\n url.searchParams.delete(getUrlKey(paramName))\n );\n };\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1;\n });\n };\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return;\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string)\n );\n const sortedParameters = sortParams(filteredParams);\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName);\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value));\n });\n } else {\n url.searchParams.set(urlParamKey, String(paramValue));\n }\n });\n };\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState']\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href);\n deleteUrlParameters(newUrl);\n setUrlParameters(newUrl, newUrlParams);\n\n // Normalize '+' characters into '%20' for spaces in url params.\n newUrl.search = newUrl.search.replace(/\\+/g, '%20');\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href);\n }\n url.value = newUrl;\n }\n };\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history));\n });\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history));\n });\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted;\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined;\n }\n };\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0]);\n case 'boolean':\n return value[0].toLowerCase() === 'true';\n case 'string':\n return value[0];\n default:\n // array\n return value;\n }\n };\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams;\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name);\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey);\n params.all[name] = parseUrlParam(name, urlValue);\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey);\n }\n }\n return params;\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } }\n );\n };\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value;\n const navigationEntries = window.performance.getEntriesByType('navigation');\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type;\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload');\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false;\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate';\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue;\n }\n };\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href);\n const previousUrl = url.value;\n url.value = currentUrl;\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search &&\n previousUrl?.pathname === currentUrl.pathname;\n if (isInternalNavigation) {\n return 'url_history';\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp';\n }\n\n return 'external';\n };\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation()\n };\n };\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams();\n const metadata = createWireMetadata();\n $x.emit('ParamsLoadedFromUrl', all, metadata);\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata);\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata);\n }\n urlLoaded.value = true;\n };\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents();\n });\n\n return {\n onPageShow,\n emitEvents\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](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 browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\n import { UrlHandler } from '@empathyco/x-components/url-handler';\n\n export default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler\n }\n };\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loa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,SAAS,CAAC,KAAI,GAAI,IAAI,CAAA;AACxB,SAAC,CAAA;AAED;;;AAGE;QACF,SAAS,CAAC,MAAM;AACd,YAAA,UAAU,EAAE,CAAA;AACd,SAAC,CAAC,CAAA;QAEF,OAAO;YACL,UAAU;YACV,UAAS;SACV,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
@@ -1,3 +1,4 @@
1
+ import '@empathyco/x-utils';
1
2
  import { createStoreEmitters } from '../../../store/utils/store-emitters.utils.js';
2
3
  import { urlXStoreModule } from './module.js';
3
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/url/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { UrlParams } from '../../../types/url-params';\nimport { urlXStoreModule } from './module';\nimport { UrlParamKey } from './types';\n\n/**\n * The params from {@link UrlParams} that provokes a replace instead of a push in the browser URL\n * state.\n *\n * @internal\n */\nexport const replaceableParams: UrlParamKey[] = ['scroll', 'page'];\n\n/**\n * Compares new and old {@link UrlParams} to know if not replaceable params have changed.\n *\n * @param newParams - The new {@link UrlParams} to compare.\n * @param oldParams - The old {@link UrlParams} to compare.\n *\n * @returns True if is pushable change, false otherwise.\n */\nfunction shouldPushUrl(\n newParams: Partial<UrlParams> = {},\n oldParams: Partial<UrlParams> = {}\n): boolean {\n const keys = Object.keys({ ...oldParams, ...newParams });\n return keys.some(key => !replaceableParams.includes(key) && oldParams[key] !== newParams[key]);\n}\n\n/**\n * Compares new and old {@link UrlParams} to know if replaceable params have changed.\n *\n * @param newParams - The new {@link UrlParams} to compare.\n * @param oldParams - The old {@link UrlParams} to compare.\n *\n * @returns True if is pushable change, false otherwise.\n */\nfunction shouldReplaceUrl(\n newParams: Partial<UrlParams> = {},\n oldParams: Partial<UrlParams> = {}\n): boolean {\n const keys = Object.keys({ ...oldParams, ...newParams });\n return (\n keys.some(key => replaceableParams.includes(key) && oldParams[key] !== newParams[key]) &&\n !shouldPushUrl(newParams, oldParams)\n );\n}\n\n/**\n * {@link StoreEmitters} For the URL module.\n *\n * @internal\n */\nexport const urlEmitters = createStoreEmitters(urlXStoreModule, {\n PushableUrlStateUpdated: {\n selector: (_, getters) => getters.urlParams,\n filter: shouldPushUrl,\n metadata: { replaceable: false }\n },\n ReplaceableUrlStateUpdated: {\n selector: (_, getters) => getters.urlParams,\n filter: shouldReplaceUrl,\n metadata: { replaceable: false }\n }\n});\n"],"names":[],"mappings":";;;AAKA;;;;;AAKG;MACU,iBAAiB,GAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE;AAEnE;;;;;;;AAOG;AACH,SAAS,aAAa,CACpB,SAAA,GAAgC,EAAE,EAClC,YAAgC,EAAE,EAAA;AAElC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACjG,CAAC;AAED;;;;;;;AAOG;AACH,SAAS,gBAAgB,CACvB,SAAA,GAAgC,EAAE,EAClC,YAAgC,EAAE,EAAA;AAElC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IACzD,QACE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC;AACtF,QAAA,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,EACpC;AACJ,CAAC;AAED;;;;AAIG;AACU,MAAA,WAAW,GAAG,mBAAmB,CAAC,eAAe,EAAE;AAC9D,IAAA,uBAAuB,EAAE;QACvB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS;AAC3C,QAAA,MAAM,EAAE,aAAa;AACrB,QAAA,QAAQ,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;AACjC,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS;AAC3C,QAAA,MAAM,EAAE,gBAAgB;AACxB,QAAA,QAAQ,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;AACjC,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/url/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store';\nimport { UrlParams } from '../../../types/url-params';\nimport { urlXStoreModule } from './module';\nimport { UrlParamKey } from './types';\n\n/**\n * The params from {@link UrlParams} that provokes a replace instead of a push in the browser URL\n * state.\n *\n * @internal\n */\nexport const replaceableParams: UrlParamKey[] = ['scroll', 'page'];\n\n/**\n * Compares new and old {@link UrlParams} to know if not replaceable params have changed.\n *\n * @param newParams - The new {@link UrlParams} to compare.\n * @param oldParams - The old {@link UrlParams} to compare.\n *\n * @returns True if is pushable change, false otherwise.\n */\nfunction shouldPushUrl(\n newParams: Partial<UrlParams> = {},\n oldParams: Partial<UrlParams> = {}\n): boolean {\n const keys = Object.keys({ ...oldParams, ...newParams });\n return keys.some(key => !replaceableParams.includes(key) && oldParams[key] !== newParams[key]);\n}\n\n/**\n * Compares new and old {@link UrlParams} to know if replaceable params have changed.\n *\n * @param newParams - The new {@link UrlParams} to compare.\n * @param oldParams - The old {@link UrlParams} to compare.\n *\n * @returns True if is pushable change, false otherwise.\n */\nfunction shouldReplaceUrl(\n newParams: Partial<UrlParams> = {},\n oldParams: Partial<UrlParams> = {}\n): boolean {\n const keys = Object.keys({ ...oldParams, ...newParams });\n return (\n keys.some(key => replaceableParams.includes(key) && oldParams[key] !== newParams[key]) &&\n !shouldPushUrl(newParams, oldParams)\n );\n}\n\n/**\n * {@link StoreEmitters} For the URL module.\n *\n * @internal\n */\nexport const urlEmitters = createStoreEmitters(urlXStoreModule, {\n PushableUrlStateUpdated: {\n selector: (_, getters) => getters.urlParams,\n filter: shouldPushUrl,\n metadata: { replaceable: false }\n },\n ReplaceableUrlStateUpdated: {\n selector: (_, getters) => getters.urlParams,\n filter: shouldReplaceUrl,\n metadata: { replaceable: false }\n }\n});\n"],"names":[],"mappings":";;;;AAKA;;;;;AAKG;MACU,iBAAiB,GAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE;AAEnE;;;;;;;AAOG;AACH,SAAS,aAAa,CACpB,SAAA,GAAgC,EAAE,EAClC,YAAgC,EAAE,EAAA;AAElC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AACjG,CAAC;AAED;;;;;;;AAOG;AACH,SAAS,gBAAgB,CACvB,SAAA,GAAgC,EAAE,EAClC,YAAgC,EAAE,EAAA;AAElC,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IACzD,QACE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,CAAC;AACtF,QAAA,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,EACpC;AACJ,CAAC;AAED;;;;AAIG;AACU,MAAA,WAAW,GAAG,mBAAmB,CAAC,eAAe,EAAE;AAC9D,IAAA,uBAAuB,EAAE;QACvB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS;AAC3C,QAAA,MAAM,EAAE,aAAa;AACrB,QAAA,QAAQ,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;AACjC,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,SAAS;AAC3C,QAAA,MAAM,EAAE,gBAAgB;AACxB,QAAA,QAAQ,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;AACjC,KAAA;AACF,CAAA;;;;"}
@@ -2,12 +2,11 @@ import { objectFilter } from '@empathyco/x-utils';
2
2
  import { initialUrlState } from '../initial-state.js';
3
3
 
4
4
  /**
5
- * Default implementation for the {@link UrlGetters.urlParams} getter.
5
+ * Default implementation for the getter.
6
6
  *
7
- * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the url module.
7
+ * @param state - Current state of the url module.
8
8
  *
9
9
  * @returns The url params.
10
- *
11
10
  * @public
12
11
  */
13
12
  const urlParams = ({ initialExtraParams, ...params }) => objectFilter(params, (paramKey, paramValue) => {
@@ -1 +1 @@
1
- {"version":3,"file":"url-params.getter.js","sources":["../../../../../../src/x-modules/url/store/getters/url-params.getter.ts"],"sourcesContent":["import { objectFilter } from '@empathyco/x-utils';\nimport { initialUrlState } from '../initial-state';\nimport { UrlParamValue, UrlXStoreModule } from '../types';\n\n/**\n * Default implementation for the {@link UrlGetters.urlParams} getter.\n *\n * @param state - Current {@link https://vuex.vuejs.org/guide/state.html | state} of the url module.\n *\n * @returns The url params.\n *\n * @public\n */\nexport const urlParams: UrlXStoreModule['getters']['urlParams'] = ({\n initialExtraParams,\n ...params\n}) =>\n objectFilter(params, (paramKey, paramValue) => {\n return paramKey in initialUrlState\n ? isNotDefaultValue(paramKey, paramValue, initialUrlState)\n : isNotEmptyParam(paramValue) && isNotDefaultValue(paramKey, paramValue, initialExtraParams);\n });\n\n/**\n * Checks if a parameter is not empty to avoid adding it to the URL.\n *\n * @param value - The value of the key parameter.\n *\n * @returns True if is not empty, False otherwise.\n */\nfunction isNotEmptyParam(value: UrlParamValue | unknown): boolean {\n return Array.isArray(value) ? value.length > 0 : value != null && value !== '';\n}\n\n/**\n * Checks if a parameter is not the default state value to avoid adding it to the URL.\n *\n * @param key - The key parameter.\n * @param value - The value of the key parameter.\n * @param defaultValues - The default values to compare.\n *\n * @returns True if is not the default state value, False otherwise.\n */\nfunction isNotDefaultValue<Key extends string | number, Value extends UrlParamValue | unknown>(\n key: Key,\n value: Value,\n defaultValues: Record<Key, Value>\n): boolean {\n return Array.isArray(value) ? value.length > 0 : defaultValues[key] !== value;\n}\n"],"names":[],"mappings":";;;AAIA;;;;;;;;AAQG;MACU,SAAS,GAA4C,CAAC,EACjE,kBAAkB,EAClB,GAAG,MAAM,EACV,KACC,YAAY,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAI;IAC5C,OAAO,QAAQ,IAAI,eAAe;UAC9B,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC;AAC1D,UAAE,eAAe,CAAC,UAAU,CAAC,IAAI,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;AACjG,CAAC,EAAE;AAEL;;;;;;AAMG;AACH,SAAS,eAAe,CAAC,KAA8B,EAAA;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;AACjF,CAAC;AAED;;;;;;;;AAQG;AACH,SAAS,iBAAiB,CACxB,GAAQ,EACR,KAAY,EACZ,aAAiC,EAAA;IAEjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;AAChF;;;;"}
1
+ {"version":3,"file":"url-params.getter.js","sources":["../../../../../../src/x-modules/url/store/getters/url-params.getter.ts"],"sourcesContent":["import { objectFilter } from '@empathyco/x-utils';\nimport { initialUrlState } from '../initial-state';\nimport { UrlParamValue, UrlXStoreModule } from '../types';\n\n/**\n * Default implementation for the getter.\n *\n * @param state - Current state of the url module.\n *\n * @returns The url params.\n * @public\n */\nexport const urlParams: UrlXStoreModule['getters']['urlParams'] = ({\n initialExtraParams,\n ...params\n}) =>\n objectFilter(params, (paramKey, paramValue) => {\n return paramKey in initialUrlState\n ? isNotDefaultValue(paramKey, paramValue, initialUrlState)\n : isNotEmptyParam(paramValue) && isNotDefaultValue(paramKey, paramValue, initialExtraParams);\n });\n\n/**\n * Checks if a parameter is not empty to avoid adding it to the URL.\n *\n * @param value - The value of the key parameter.\n *\n * @returns True if is not empty, False otherwise.\n */\nfunction isNotEmptyParam(value: UrlParamValue | unknown): boolean {\n return Array.isArray(value) ? value.length > 0 : value != null && value !== '';\n}\n\n/**\n * Checks if a parameter is not the default state value to avoid adding it to the URL.\n *\n * @param key - The key parameter.\n * @param value - The value of the key parameter.\n * @param defaultValues - The default values to compare.\n *\n * @returns True if is not the default state value, False otherwise.\n */\nfunction isNotDefaultValue<Key extends string | number, Value extends UrlParamValue | unknown>(\n key: Key,\n value: Value,\n defaultValues: Record<Key, Value>\n): boolean {\n return Array.isArray(value) ? value.length > 0 : defaultValues[key] !== value;\n}\n"],"names":[],"mappings":";;;AAIA;;;;;;;AAOG;MACU,SAAS,GAA4C,CAAC,EACjE,kBAAkB,EAClB,GAAG,MAAM,EACV,KACC,YAAY,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAI;IAC5C,OAAO,QAAQ,IAAI,eAAe;UAC9B,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC;AAC1D,UAAE,eAAe,CAAC,UAAU,CAAC,IAAI,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;AACjG,CAAC,EAAE;AAEL;;;;;;AAMG;AACH,SAAS,eAAe,CAAC,KAA8B,EAAA;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;AACjF,CAAC;AAED;;;;;;;;AAQG;AACH,SAAS,iBAAiB,CACxB,GAAQ,EACR,KAAY,EACZ,aAAiC,EAAA;IAEjC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;AAChF;;;;"}
@@ -10,7 +10,8 @@ const initialUrlState = {
10
10
  filter: [],
11
11
  sort: '',
12
12
  scroll: '',
13
- tag: []
13
+ tag: [],
14
+ prompt: -1
14
15
  };
15
16
 
16
17
  export { initialUrlState };