@empathyco/x-components 8.1.1 → 8.3.0

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 (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/docs/API-reference/api/x-components.baseaddtocart.md +12 -2
  3. package/docs/API-reference/api/x-components.baseresultlink.md +12 -2
  4. package/docs/API-reference/api/x-components.hierarchicalfilter.md +3 -0
  5. package/docs/API-reference/api/x-components.md +9 -0
  6. package/docs/API-reference/api/x-components.simplefilter.md +3 -0
  7. package/docs/API-reference/api/x-components.snippetcallbacks.md +3 -0
  8. package/docs/API-reference/api/x-components.vendorresult.md +21 -2
  9. package/docs/API-reference/api/x-components.vendorresult.tagging.md +11 -0
  10. package/docs/API-reference/api/x-components.vendorresulttagging.add2carturl.md +11 -0
  11. package/docs/API-reference/api/x-components.vendorresulttagging.clickurl.md +11 -0
  12. package/docs/API-reference/api/x-components.vendorresulttagging.md +88 -0
  13. package/docs/API-reference/api/x-components.vendorresulttagging.viewurl.md +11 -0
  14. package/docs/API-reference/api/x-components.vendorxevents.md +57 -0
  15. package/docs/API-reference/api/x-components.vendorxevents.userclickedavendorresult.md +13 -0
  16. package/docs/API-reference/api/x-components.vendorxevents.userclickedvendorresultaddtocart.md +13 -0
  17. package/docs/API-reference/api/x-components.vendorxevents.userviewedavendorresult.md +13 -0
  18. package/docs/API-reference/components/common/result/x-components.base-result-add-to-cart.md +4 -3
  19. package/docs/API-reference/components/common/result/x-components.base-result-link.md +4 -3
  20. package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
  21. package/js/components/result/base-result-add-to-cart.vue2.js +6 -2
  22. package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
  23. package/js/components/result/base-result-link.vue.js +8 -12
  24. package/js/components/result/base-result-link.vue.js.map +1 -1
  25. package/js/components/result/base-result-link.vue2.js +7 -3
  26. package/js/components/result/base-result-link.vue2.js.map +1 -1
  27. package/js/x-modules/url/wiring.js +1 -0
  28. package/js/x-modules/url/wiring.js.map +1 -1
  29. package/js/x-modules/vendor/wiring.js +14 -0
  30. package/js/x-modules/vendor/wiring.js.map +1 -1
  31. package/package.json +2 -2
  32. package/report/x-components.api.json +451 -15
  33. package/report/x-components.api.md +59 -5
  34. package/types/src/components/result/base-result-add-to-cart.vue.d.ts +13 -2
  35. package/types/src/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
  36. package/types/src/components/result/base-result-link.vue.d.ts +14 -2
  37. package/types/src/components/result/base-result-link.vue.d.ts.map +1 -1
  38. package/types/src/components/snippet-callbacks.vue.d.ts +3 -0
  39. package/types/src/components/snippet-callbacks.vue.d.ts.map +1 -1
  40. package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +3 -0
  41. package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
  42. package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts +3 -0
  43. package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
  44. package/types/src/x-modules/url/wiring.d.ts +1 -0
  45. package/types/src/x-modules/url/wiring.d.ts.map +1 -1
  46. package/types/src/x-modules/vendor/events.types.d.ts +15 -0
  47. package/types/src/x-modules/vendor/events.types.d.ts.map +1 -1
  48. package/types/src/x-modules/vendor/types.d.ts +7 -1
  49. package/types/src/x-modules/vendor/types.d.ts.map +1 -1
  50. package/types/src/x-modules/vendor/wiring.d.ts +9 -0
  51. package/types/src/x-modules/vendor/wiring.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"base-result-link.vue2.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n v-on=\"\n result.modelName === 'Result'\n ? {\n click: emitUserClickedAResult,\n contextmenu: emitUserClickedAResult,\n auxclick: (event: { button: number }) => event.button === 1 && emitUserClickedAResult(),\n }\n : {}\n \"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { WireMetadata } from '../../wiring'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { defineComponent, inject, ref } from 'vue'\nimport { use$x } from '../../composables/index'\n\n/**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref()\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component. This component can emit\n * have extra events so this record pairs each event to its metadata.\n */\n const resultLinkMetadataPerEvent = inject<\n // TODO: Refactor this inject key to the constants when doing EMP-909\n Partial<\n Record<\n PropsWithType<XEventsTypes, Result>,\n Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>\n >\n >\n >('resultLinkMetadataPerEvent', {})\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, {\n target: el.value!,\n ...resultLinkMetadataPerEvent.UserClickedAResult,\n })\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value!, ...resultLinkMetadataPerEvent[event] })\n })\n }\n\n return {\n el,\n emitUserClickedAResult,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-link {\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## Examples\n\nThis component is a wrapper for the result contents (images, name, price...). It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide these events.\n\nThe result prop is required. It will render an anchor element with the href to the result URL:\n\n```vue\n<template>\n <BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\" alt=\"Result image\" />\n <span>{{ result.name }}</span>\n </template>\n </BaseResultLink>\n</template>\n\n<script setup>\nimport { BaseResultLink } from '@empathyco/x-components'\nconst result = {\n name: 'Jacket',\n url: 'https://shop.com/jacket',\n images: ['https://shop.com/jacket.jpg'],\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;AAiCA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;AACF,QAAA,MAAM,KAAK,GAAG,EAAC;AAEf;;;;AAIE;QACF,MAAM,sBAAqB,GAAI,MAAM,CACnC,wBAAwB,EACxB,EAAE,CACJ;AAEA;;;AAGE;QACF,MAAM,0BAAyB,GAAI,MAAM,CAQvC,4BAA4B,EAAE,EAAE,CAAA;AAElC;;;;;AAKE;QACF,MAAM,sBAAqB,GAAI,MAAU;YACvC,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE;gBAC1C,MAAM,EAAE,EAAE,CAAC,KAAM;gBACjB,GAAG,0BAA0B,CAAC,kBAAkB;AACjD,aAAA,CAAA;AACD,YAAA,sBAAsB,CAAC,OAAO,CAAC,KAAI,IAAG;gBACpC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,KAAM,EAAE,GAAG,0BAA0B,CAAC,KAAK,GAAG,CAAA;AAC1F,YAAA,CAAC,CAAA;AACH,QAAA,CAAA;QAEA,OAAO;YACL,EAAE;YACF,sBAAsB;SACxB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"base-result-link.vue2.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n @click=\"onClick\"\n @contextmenu=\"onClick\"\n @auxclick=\"({ button }) => button === 1 && onClick()\"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { WireMetadata, XEvent } from '../../wiring'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { defineComponent, inject, ref } from 'vue'\nimport { use$x } from '../../composables/index'\n\n/**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n clickEvent: {\n type: String as PropType<XEvent>,\n default: 'UserClickedAResult',\n },\n },\n setup(props) {\n const $x = use$x()\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref()\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component. This component can emit\n * have extra events so this record pairs each event to its metadata.\n */\n const resultLinkMetadataPerEvent = inject<\n // TODO: Refactor this inject key to the constants when doing EMP-909\n Partial<\n Record<\n PropsWithType<XEventsTypes, Result>,\n Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>\n >\n >\n >('resultLinkMetadataPerEvent', {})\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const onClick = (): void => {\n $x.emit(props.clickEvent, props.result, {\n target: el.value!,\n ...resultLinkMetadataPerEvent.UserClickedAResult,\n })\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value!, ...resultLinkMetadataPerEvent[event] })\n })\n }\n\n return {\n el,\n onClick,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-link {\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## Examples\n\nThis component is a wrapper for the result contents (images, name, price...). It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide these events.\n\nThe result prop is required. It will render an anchor element with the href to the result URL:\n\n```vue\n<template>\n <BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\" alt=\"Result image\" />\n <span>{{ result.name }}</span>\n </template>\n </BaseResultLink>\n</template>\n\n<script setup>\nimport { BaseResultLink } from '@empathyco/x-components'\nconst result = {\n name: 'Jacket',\n url: 'https://shop.com/jacket',\n images: ['https://shop.com/jacket.jpg'],\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;AA2BA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,OAAO,EAAE,oBAAoB;AAC9B,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;AACF,QAAA,MAAM,KAAK,GAAG,EAAC;AAEf;;;;AAIE;QACF,MAAM,sBAAqB,GAAI,MAAM,CACnC,wBAAwB,EACxB,EAAE,CACJ;AAEA;;;AAGE;QACF,MAAM,0BAAyB,GAAI,MAAM,CAQvC,4BAA4B,EAAE,EAAE,CAAA;AAElC;;;;;AAKE;QACF,MAAM,UAAU,MAAU;YACxB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,EAAE;gBACtC,MAAM,EAAE,EAAE,CAAC,KAAM;gBACjB,GAAG,0BAA0B,CAAC,kBAAkB;AACjD,aAAA,CAAA;AACD,YAAA,sBAAsB,CAAC,OAAO,CAAC,KAAI,IAAG;gBACpC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,KAAM,EAAE,GAAG,0BAA0B,CAAC,KAAK,GAAG,CAAA;AAC1F,YAAA,CAAC,CAAA;AACH,QAAA,CAAA;QAEA,OAAO;YACL,EAAE;YACF,OAAO;SACT;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -106,6 +106,7 @@ const urlWiring = createWiring({
106
106
  },
107
107
  UserAcceptedAQuery: {
108
108
  setUrlQuery,
109
+ resetUrlBrowseCategory,
109
110
  },
110
111
  UserAcceptedAQueryPreview: {
111
112
  setUrlQueryFromPreview,
@@ -1 +1 @@
1
- {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/url/wiring.ts"],"sourcesContent":["import { createRawFilters } from '../../utils/filters'\nimport { namespacedWireCommit } from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * WireCommit for {@link UrlXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit('url')\n\n/**\n * Sets the {@link RelatedTag | related tags }.\n *\n * @public\n */\nexport const setUrlRelatedTags = wireCommit('setRelatedTags')\n\n/**\n * Sets the related prompt of the URL module.\n *\n * @public\n */\nexport const setUrlPrompt = wireCommit('setPrompt')\n\n/**\n * Sets the query of the url module.\n *\n * @public\n */\nexport const setUrlQuery = wireCommit('setQuery')\n\n/**\n * Sets the url state `query` with a selectedQueryPreview's query.\n *\n * @public\n */\nexport const setUrlQueryFromPreview = wireCommit('setQuery', ({ eventPayload: { query } }) => query)\n\n/**\n * Sets the page of the url module.\n *\n * @public\n */\nexport const setUrlPage = wireCommit('setPage')\n\n/**\n * Sets the sort of the url module.\n *\n * @public\n */\nexport const setUrlSort = wireCommit('setSort')\n\n/**\n * Sets the extra params of the url module.\n *\n * @public\n */\nexport const setParams = wireCommit('setParams')\n\n/**\n * Sets the extra params of the url module from a selectedQueryPreview's extraParams.\n *\n * @public\n */\nexport const setUrlParamsFromPreview = wireCommit(\n 'setParams',\n ({ eventPayload: { extraParams } }) => extraParams,\n)\n\n/**\n * Sets the filters of the url module from a selectedQueryPreview's filters.\n *\n * @public\n */\nexport const setUrlSelectedFiltersFromPreview = wireCommit(\n 'setFilters',\n ({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : []),\n)\n\n/**\n * Sets the scroll of the url module.\n *\n * @public\n */\nexport const setUrlScroll = wireCommit('setScroll')\n\n/**\n * Sets the browseCategory of the url module.\n *\n * @public\n */\nexport const resetUrlBrowseCategory = wireCommit('setBrowseCategory', {\n browseField: '',\n browseValue: '',\n})\n\n/**\n * Sets the browseCategory of the url module.\n *\n * @public\n */\nexport const setUrlBrowseCategory = wireCommit('setBrowseCategory')\n\n/**\n * Sets the initial provided extra params.\n *\n * @public\n */\nexport const setInitialExtraParams = wireCommit('setInitialExtraParams')\n\n/**\n * Sets the filters of the url module.\n *\n * @public\n */\nexport const setUrlFilters = wireCommit('setFilters')\n\n/**\n * Wiring configuration for the {@link UrlXModule | url module}.\n *\n * @internal\n */\nexport const urlWiring = createWiring({\n ParamsLoadedFromUrl: {\n setParams,\n },\n UserAcceptedAQuery: {\n setUrlQuery,\n },\n UserAcceptedAQueryPreview: {\n setUrlQueryFromPreview,\n setUrlParamsFromPreview,\n setUrlSelectedFiltersFromPreview,\n },\n UserClearedQuery: {\n setUrlQuery,\n },\n SelectedRelatedTagsChanged: {\n setUrlRelatedTags,\n },\n SelectedRelatedPromptChanged: {\n setUrlPrompt,\n },\n SelectedFiltersForRequestChanged: {\n setUrlFilters,\n },\n PageChanged: {\n setUrlPage,\n },\n SortChanged: {\n setUrlSort,\n },\n ExtraParamsChanged: {\n setParams,\n },\n ExtraParamsInitialized: {\n setInitialExtraParams,\n },\n UserScrolledToElement: {\n setUrlScroll,\n },\n UserBrowsedToCategory: {\n setUrlBrowseCategory,\n },\n UserClickedCloseX: {\n resetUrlBrowseCategory,\n },\n UserClickedOpenX: {\n resetUrlBrowseCategory,\n },\n SelectedBrowseSortProvided: {\n setUrlSort,\n },\n UserClickedABrowseSort: {\n setUrlSort,\n },\n UserSelectedABrowsePage: {\n setUrlPage,\n },\n})\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;AACH,MAAM,UA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BAAkB,EAAE;QAClB,WAAW;AACZ,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,sBAAsB;QACtB,uBAAuB;QACvB,gCAAgC;AACjC,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,WAAW;AACZ,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,iBAAiB;AAClB,KAAA;AACD,IAAA,4BAA4B,EAAE;QAC5B,YAAY;AACb,KAAA;AACD,IAAA,gCAAgC,EAAE;QAChC,aAAa;AACd,KAAA;AACD,IAAA,WAAW,EAAE;QACX,UAAU;AACX,KAAA;AACD,IAAA,WAAW,EAAE;QACX,UAAU;AACX,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,SAAS;AACV,KAAA;AACD,IAAA,sBAAsB,EAAE;QACtB,qBAAqB;AACtB,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,YAAY;AACb,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,oBAAoB;AACrB,KAAA;AACD,IAAA,iBAAiB,EAAE;QACjB,sBAAsB;AACvB,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,sBAAsB;AACvB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,UAAU;AACX,KAAA;AACD,IAAA,sBAAsB,EAAE;QACtB,UAAU;AACX,KAAA;AACD,IAAA,uBAAuB,EAAE;QACvB,UAAU;AACX,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/url/wiring.ts"],"sourcesContent":["import { createRawFilters } from '../../utils/filters'\nimport { namespacedWireCommit } from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * WireCommit for {@link UrlXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit('url')\n\n/**\n * Sets the {@link RelatedTag | related tags }.\n *\n * @public\n */\nexport const setUrlRelatedTags = wireCommit('setRelatedTags')\n\n/**\n * Sets the related prompt of the URL module.\n *\n * @public\n */\nexport const setUrlPrompt = wireCommit('setPrompt')\n\n/**\n * Sets the query of the url module.\n *\n * @public\n */\nexport const setUrlQuery = wireCommit('setQuery')\n\n/**\n * Sets the url state `query` with a selectedQueryPreview's query.\n *\n * @public\n */\nexport const setUrlQueryFromPreview = wireCommit('setQuery', ({ eventPayload: { query } }) => query)\n\n/**\n * Sets the page of the url module.\n *\n * @public\n */\nexport const setUrlPage = wireCommit('setPage')\n\n/**\n * Sets the sort of the url module.\n *\n * @public\n */\nexport const setUrlSort = wireCommit('setSort')\n\n/**\n * Sets the extra params of the url module.\n *\n * @public\n */\nexport const setParams = wireCommit('setParams')\n\n/**\n * Sets the extra params of the url module from a selectedQueryPreview's extraParams.\n *\n * @public\n */\nexport const setUrlParamsFromPreview = wireCommit(\n 'setParams',\n ({ eventPayload: { extraParams } }) => extraParams,\n)\n\n/**\n * Sets the filters of the url module from a selectedQueryPreview's filters.\n *\n * @public\n */\nexport const setUrlSelectedFiltersFromPreview = wireCommit(\n 'setFilters',\n ({ eventPayload: { filters } }) => (filters ? createRawFilters(filters) : []),\n)\n\n/**\n * Sets the scroll of the url module.\n *\n * @public\n */\nexport const setUrlScroll = wireCommit('setScroll')\n\n/**\n * Sets the browseCategory of the url module.\n *\n * @public\n */\nexport const resetUrlBrowseCategory = wireCommit('setBrowseCategory', {\n browseField: '',\n browseValue: '',\n})\n\n/**\n * Sets the browseCategory of the url module.\n *\n * @public\n */\nexport const setUrlBrowseCategory = wireCommit('setBrowseCategory')\n\n/**\n * Sets the initial provided extra params.\n *\n * @public\n */\nexport const setInitialExtraParams = wireCommit('setInitialExtraParams')\n\n/**\n * Sets the filters of the url module.\n *\n * @public\n */\nexport const setUrlFilters = wireCommit('setFilters')\n\n/**\n * Wiring configuration for the {@link UrlXModule | url module}.\n *\n * @internal\n */\nexport const urlWiring = createWiring({\n ParamsLoadedFromUrl: {\n setParams,\n },\n UserAcceptedAQuery: {\n setUrlQuery,\n resetUrlBrowseCategory,\n },\n UserAcceptedAQueryPreview: {\n setUrlQueryFromPreview,\n setUrlParamsFromPreview,\n setUrlSelectedFiltersFromPreview,\n },\n UserClearedQuery: {\n setUrlQuery,\n },\n SelectedRelatedTagsChanged: {\n setUrlRelatedTags,\n },\n SelectedRelatedPromptChanged: {\n setUrlPrompt,\n },\n SelectedFiltersForRequestChanged: {\n setUrlFilters,\n },\n PageChanged: {\n setUrlPage,\n },\n SortChanged: {\n setUrlSort,\n },\n ExtraParamsChanged: {\n setParams,\n },\n ExtraParamsInitialized: {\n setInitialExtraParams,\n },\n UserScrolledToElement: {\n setUrlScroll,\n },\n UserBrowsedToCategory: {\n setUrlBrowseCategory,\n },\n UserClickedCloseX: {\n resetUrlBrowseCategory,\n },\n UserClickedOpenX: {\n resetUrlBrowseCategory,\n },\n SelectedBrowseSortProvided: {\n setUrlSort,\n },\n UserClickedABrowseSort: {\n setUrlSort,\n },\n UserSelectedABrowsePage: {\n setUrlPage,\n },\n})\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,CAAC;AAE9C;;;;AAIG;MACU,iBAAiB,GAAG,UAAU,CAAC,gBAAgB;AAE5D;;;;AAIG;MACU,YAAY,GAAG,UAAU,CAAC,WAAW;AAElD;;;;AAIG;MACU,WAAW,GAAG,UAAU,CAAC,UAAU;AAEhD;;;;AAIG;MACU,sBAAsB,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,KAAK;AAEnG;;;;AAIG;MACU,UAAU,GAAG,UAAU,CAAC,SAAS;AAE9C;;;;AAIG;MACU,UAAU,GAAG,UAAU,CAAC,SAAS;AAE9C;;;;AAIG;MACU,SAAS,GAAG,UAAU,CAAC,WAAW;AAE/C;;;;AAIG;MACU,uBAAuB,GAAG,UAAU,CAC/C,WAAW,EACX,CAAC,EAAE,YAAY,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,WAAW;AAGpD;;;;A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AoB;AACrB,KAAA;AACD,IAAA,iBAAiB,EAAE;QACjB,sBAAsB;AACvB,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,sBAAsB;AACvB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,UAAU;AACX,KAAA;AACD,IAAA,sBAAsB,EAAE;QACtB,UAAU;AACX,KAAA;AACD,IAAA,uBAAuB,EAAE;QACvB,UAAU;AACX,KAAA;AACF,CAAA;;;;"}
@@ -2,6 +2,7 @@ import { namespacedWireCommit } from '../../wiring/namespaced-wires.factory.js';
2
2
  import 'rxjs/operators';
3
3
  import 'rxjs';
4
4
  import { createWiring } from '../../wiring/wiring.utils.js';
5
+ import { createWireFromFunction } from '../../wiring/wires.factory.js';
5
6
 
6
7
  /**
7
8
  * WireCommit for {@link VendorXModule}.
@@ -9,6 +10,10 @@ import { createWiring } from '../../wiring/wiring.utils.js';
9
10
  * @internal
10
11
  */
11
12
  const wireCommit = namespacedWireCommit('vendor');
13
+ const fetchTagging = async (url) => fetch(url, { method: 'GET', keepalive: true });
14
+ const trackResultView = createWireFromFunction(({ eventPayload: { tagging } }) => tagging?.viewUrl && void fetchTagging(tagging.viewUrl));
15
+ const trackResultClick = createWireFromFunction(({ eventPayload: { tagging } }) => tagging?.clickUrl && void fetchTagging(tagging.clickUrl));
16
+ const trackResultAddToCart = createWireFromFunction(({ eventPayload: { tagging } }) => tagging?.add2cartUrl && void fetchTagging(tagging.add2cartUrl));
12
17
  /**
13
18
  * Sets the vendor results of the {@link VendorXModule}.
14
19
  *
@@ -33,6 +38,15 @@ const vendorWiring = createWiring({
33
38
  VendorResultsChanged: {
34
39
  setResults,
35
40
  },
41
+ UserViewedAVendorResult: {
42
+ trackResultView,
43
+ },
44
+ UserClickedAVendorResult: {
45
+ trackResultClick,
46
+ },
47
+ UserClickedVendorResultAddToCart: {
48
+ trackResultAddToCart,
49
+ },
36
50
  SearchRequestChanged: {
37
51
  resetResults,
38
52
  },
@@ -1 +1 @@
1
- {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/vendor/wiring.ts"],"sourcesContent":["import type { WirePayload, XEventPayload } from '../../wiring'\nimport { createWiring, namespacedWireCommit } from '../../wiring'\n\n/**\n * WireCommit for {@link VendorXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit('vendor')\n\n/**\n * Sets the vendor results of the {@link VendorXModule}.\n *\n * @public\n */\nexport const setResults = wireCommit(\n 'setResults',\n ({ eventPayload }: WirePayload<XEventPayload<'VendorResultsChanged'>>) =>\n eventPayload.map(vendorResult => ({\n ...vendorResult,\n modelName: 'VendorResult' as const,\n })),\n)\n\n/**\n * Resets the vendor results of the {@link VendorXModule}.\n *\n * @public\n */\nconst resetResults = wireCommit('setResults', [])\n\n/**\n * Wiring configuration for the {@link VendorXModule | vendor module}.\n *\n * @internal\n */\nexport const vendorWiring = createWiring({\n VendorResultsChanged: {\n setResults,\n },\n SearchRequestChanged: {\n resetResults,\n },\n})\n"],"names":[],"mappings":";;;;;AAGA;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,QAAQ,CAAC;AAEjD;;;;AAIG;MACU,UAAU,GAAG,UAAU,CAClC,YAAY,EACZ,CAAC,EAAE,YAAY,EAAsD,KACnE,YAAY,CAAC,GAAG,CAAC,YAAY,KAAK;AAChC,IAAA,GAAG,YAAY;AACf,IAAA,SAAS,EAAE,cAAuB;CACnC,CAAC,CAAC;AAGP;;;;AAIG;AACH,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC;AAEjD;;;;AAIG;AACI,MAAM,YAAY,GAAG,YAAY,CAAC;AACvC,IAAA,oBAAoB,EAAE;QACpB,UAAU;AACX,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,YAAY;AACb,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/vendor/wiring.ts"],"sourcesContent":["import type { WirePayload, XEventPayload } from '../../wiring'\nimport { createWireFromFunction, createWiring, namespacedWireCommit } from '../../wiring'\n\n/**\n * WireCommit for {@link VendorXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit('vendor')\n\nconst fetchTagging = async (url: string) => fetch(url, { method: 'GET', keepalive: true })\n\nconst trackResultView = createWireFromFunction<XEventPayload<'UserViewedAVendorResult'>>(\n ({ eventPayload: { tagging } }) => tagging?.viewUrl && void fetchTagging(tagging.viewUrl),\n)\nconst trackResultClick = createWireFromFunction<XEventPayload<'UserClickedAVendorResult'>>(\n ({ eventPayload: { tagging } }) => tagging?.clickUrl && void fetchTagging(tagging.clickUrl),\n)\nconst trackResultAddToCart = createWireFromFunction<\n XEventPayload<'UserClickedVendorResultAddToCart'>\n>(({ eventPayload: { tagging } }) => tagging?.add2cartUrl && void fetchTagging(tagging.add2cartUrl))\n/**\n * Sets the vendor results of the {@link VendorXModule}.\n *\n * @public\n */\nexport const setResults = wireCommit(\n 'setResults',\n ({ eventPayload }: WirePayload<XEventPayload<'VendorResultsChanged'>>) =>\n eventPayload.map(vendorResult => ({\n ...vendorResult,\n modelName: 'VendorResult' as const,\n })),\n)\n\n/**\n * Resets the vendor results of the {@link VendorXModule}.\n *\n * @public\n */\nconst resetResults = wireCommit('setResults', [])\n\n/**\n * Wiring configuration for the {@link VendorXModule | vendor module}.\n *\n * @internal\n */\nexport const vendorWiring = createWiring({\n VendorResultsChanged: {\n setResults,\n },\n UserViewedAVendorResult: {\n trackResultView,\n },\n UserClickedAVendorResult: {\n trackResultClick,\n },\n UserClickedVendorResultAddToCart: {\n trackResultAddToCart,\n },\n SearchRequestChanged: {\n resetResults,\n },\n})\n"],"names":[],"mappings":";;;;;;AAGA;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,QAAQ,CAAC;AAEjD,MAAM,YAAY,GAAG,OAAO,GAAW,KAAK,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE1F,MAAM,eAAe,GAAG,sBAAsB,CAC5C,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,EAAE,OAAO,IAAI,KAAK,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAC1F;AACD,MAAM,gBAAgB,GAAG,sBAAsB,CAC7C,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,EAAE,QAAQ,IAAI,KAAK,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAC5F;AACD,MAAM,oBAAoB,GAAG,sBAAsB,CAEjD,CAAC,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,EAAE,WAAW,IAAI,KAAK,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACpG;;;;AAIG;MACU,UAAU,GAAG,UAAU,CAClC,YAAY,EACZ,CAAC,EAAE,YAAY,EAAsD,KACnE,YAAY,CAAC,GAAG,CAAC,YAAY,KAAK;AAChC,IAAA,GAAG,YAAY;AACf,IAAA,SAAS,EAAE,cAAuB;CACnC,CAAC,CAAC;AAGP;;;;AAIG;AACH,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC;AAEjD;;;;AAIG;AACI,MAAM,YAAY,GAAG,YAAY,CAAC;AACvC,IAAA,oBAAoB,EAAE;QACpB,UAAU;AACX,KAAA;AACD,IAAA,uBAAuB,EAAE;QACvB,eAAe;AAChB,KAAA;AACD,IAAA,wBAAwB,EAAE;QACxB,gBAAgB;AACjB,KAAA;AACD,IAAA,gCAAgC,EAAE;QAChC,oBAAoB;AACrB,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,YAAY;AACb,KAAA;AACF,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "8.1.1",
3
+ "version": "8.3.0",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -117,5 +117,5 @@
117
117
  "access": "public",
118
118
  "directory": "dist"
119
119
  },
120
- "gitHead": "cbe63502170afaf9e0b078201d50d3106740268a"
120
+ "gitHead": "ad499c5844842c3a6b831444274ee6c02b5ab0db"
121
121
  }