@empathyco/x-components 6.0.0-alpha.2 → 6.0.0-alpha.20
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.
- package/CHANGELOG.md +202 -1
- package/core/index.js +1 -0
- package/core/index.js.map +1 -1
- package/design-system/deprecated-full-theme.css +1555 -1555
- package/docs/API-reference/api/x-adapter-platform.md +9 -0
- package/docs/API-reference/api/x-adapter-platform.platformadapter.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.md +22 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.nextqueries.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.suggestiontext.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.type.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsrequest.md +15 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.data.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.md +21 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.status.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.catalog.md +6 -0
- package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.relatedpromptschema.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsendpointadapter.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestmapper.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestschema.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponsemapper.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponseschema.md +13 -0
- package/docs/API-reference/api/x-components.animationprop.md +6 -1
- package/docs/API-reference/api/x-components.bannerslist.md +3 -3
- package/docs/API-reference/api/x-components.basedropdown.md +5 -5
- package/docs/API-reference/api/x-components.baseeventsmodal.md +2 -2
- package/docs/API-reference/api/x-components.basegrid.md +3 -3
- package/docs/API-reference/api/x-components.baseheadertogglepanel.md +5 -5
- package/docs/API-reference/api/x-components.baseidmodal.md +2 -2
- package/docs/API-reference/api/x-components.baseidtogglepanel.md +5 -5
- package/docs/API-reference/api/x-components.basemodal.md +10 -10
- package/docs/API-reference/api/x-components.baseresultimage.md +9 -9
- package/docs/API-reference/api/x-components.baseslider.md +70 -0
- package/docs/API-reference/api/x-components.basesuggestions.md +3 -3
- package/docs/API-reference/api/x-components.basetabspanel.md +8 -8
- package/docs/API-reference/api/x-components.basetogglepanel.md +3 -3
- package/docs/API-reference/api/x-components.basevariablecolumngrid.md +3 -3
- package/docs/API-reference/api/x-components.cancelfetchandsaverelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.empathize.md +5 -5
- package/docs/API-reference/api/x-components.facets.md +3 -3
- package/docs/API-reference/api/x-components.fetchandsaverelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.fetchrelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.filterslist.md +3 -3
- package/docs/API-reference/api/x-components.globalxbus.md +6 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +5 -2
- package/docs/API-reference/api/x-components.identifierresults.md +3 -3
- package/docs/API-reference/api/x-components.itemslist.md +3 -3
- package/docs/API-reference/api/x-components.mainmodal.md +2 -2
- package/docs/API-reference/api/x-components.md +17 -0
- package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +5 -5
- package/docs/API-reference/api/x-components.myhistory.md +3 -3
- package/docs/API-reference/api/x-components.nextqueriesgroup.md +22 -0
- package/docs/API-reference/api/x-components.nextqueriesgroup.modelname.md +11 -0
- package/docs/API-reference/api/x-components.nextqueriesgroup.nextqueries.md +11 -0
- package/docs/API-reference/api/x-components.nextquerieslist.md +3 -3
- package/docs/API-reference/api/x-components.partialresultslist.md +3 -3
- package/docs/API-reference/api/x-components.promotedslist.md +3 -3
- package/docs/API-reference/api/x-components.querypreviewlist.md +3 -3
- package/docs/API-reference/api/x-components.recommendations.md +3 -3
- package/docs/API-reference/api/x-components.relatedprompt.md +38 -0
- package/docs/API-reference/api/x-components.relatedpromptrequest.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsactioncontext.md +15 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.cancelfetchandsaverelatedprompts.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.fetchandsaverelatedprompts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.fetchrelatedprompts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsgetters.md +20 -0
- package/docs/API-reference/api/x-components.relatedpromptsgetters.request.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptslist.md +72 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.md +25 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.resetrelatedpromptsstate.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setparams.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsproducts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedprompt.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedquery.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.params.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.relatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.selectedprompt.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.selectedquery.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedprompt.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedpromptquery.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxmodule.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxstoremodule.md +15 -0
- package/docs/API-reference/api/x-components.relatedtags.md +3 -3
- package/docs/API-reference/api/x-components.resultslist.md +3 -3
- package/docs/API-reference/api/x-components.scrolltotop.md +5 -5
- package/docs/API-reference/api/x-components.searchinputplaceholder.md +3 -3
- package/docs/API-reference/api/x-components.searchmutations.md +1 -0
- package/docs/API-reference/api/x-components.searchmutations.setstats.md +24 -0
- package/docs/API-reference/api/x-components.searchstate.md +1 -0
- package/docs/API-reference/api/x-components.searchstate.stats.md +13 -0
- package/docs/API-reference/api/x-components.selectedfilterslist.md +3 -3
- package/docs/API-reference/api/x-components.simplefilter.md +3 -0
- package/docs/API-reference/api/x-components.singlecolumnlayout.md +3 -3
- package/docs/API-reference/api/x-components.snippetcallbacks.md +3 -0
- package/docs/API-reference/api/x-components.snippetconfigextraparams.md +1 -1
- package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
- package/docs/API-reference/api/x-components.tagging.md +17 -4
- package/docs/API-reference/api/x-components.usealiasapi.md +1 -0
- package/docs/API-reference/api/x-components.usealiasapi.pricestats.md +16 -0
- package/docs/API-reference/api/x-components.xeventstypes.md +3 -3
- package/docs/API-reference/api/x-components.xmodulestree.md +1 -0
- package/docs/API-reference/api/x-components.xmodulestree.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-types.md +4 -0
- package/docs/API-reference/api/x-types.relatedprompt.md +23 -0
- package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.suggestiontext.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.type.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptsrequest.md +15 -0
- package/docs/API-reference/api/x-types.relatedpromptsresponse.md +20 -0
- package/docs/API-reference/api/x-types.relatedpromptsresponse.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-types.searchresponse.md +1 -0
- package/docs/API-reference/api/x-types.searchresponse.stats.md +11 -0
- package/docs/API-reference/api/x-types.stats.md +22 -0
- package/docs/API-reference/api/x-types.stats.price.md +14 -0
- package/docs/API-reference/api/x-types.xcomponentsadapter.md +1 -0
- package/docs/API-reference/api/x-types.xcomponentsadapter.relatedprompts.md +11 -0
- package/docs/API-reference/components/common/result/x-components.base-result-image.md +2 -2
- package/docs/API-reference/components/common/x-components.base-slider.md +189 -0
- package/docs/API-reference/components/common/x-components.items-list.md +1 -1
- package/docs/API-reference/components/facets/x-components.facets/facets.md +1 -1
- package/docs/API-reference/components/facets/x-components.lists/selected-filters-list.md +1 -1
- package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +29 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +196 -0
- package/docs/API-reference/components/search/x-components.results-list.md +1 -1
- package/docs/API-reference/components/tagging/x-components.tagging.md +2 -2
- package/js/components/base-grid.vue.js.map +1 -1
- package/js/components/base-grid.vue2.js.map +1 -1
- package/js/components/base-grid.vue3.js +1 -1
- package/js/components/base-slider.vue.js +66 -0
- package/js/components/base-slider.vue.js.map +1 -0
- package/js/components/base-slider.vue2.js +109 -0
- package/js/components/base-slider.vue2.js.map +1 -0
- package/js/components/base-slider.vue3.js +7 -0
- package/js/components/base-slider.vue3.js.map +1 -0
- package/js/components/icons/cross-tiny.vue.js +2 -2
- package/js/components/icons/plus.vue.js +2 -2
- package/js/components/items-list.vue.js.map +1 -1
- package/js/components/items-list.vue2.js +2 -2
- package/js/components/items-list.vue2.js.map +1 -1
- package/js/components/result/base-result-image.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue2.js +3 -3
- package/js/components/result/base-result-image.vue2.js.map +1 -1
- package/js/components/scroll/use-scroll.js +1 -1
- package/js/components/scroll/use-scroll.js.map +1 -1
- package/js/components/sliding-panel.vue.js +2 -2
- package/js/composables/use-alias-api.js +3 -0
- package/js/composables/use-alias-api.js.map +1 -1
- package/js/index.js +10 -0
- package/js/index.js.map +1 -1
- package/js/types/animation-prop.js +5 -0
- package/js/types/animation-prop.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js +2 -0
- package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue2.js +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue2.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js +2 -2
- package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js +2 -2
- package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +2 -0
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +15 -2
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js +3 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js +2 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map +1 -1
- package/js/x-modules/queries-preview/store/module.js +1 -1
- package/js/x-modules/queries-preview/store/module.js.map +1 -1
- package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js +6 -4
- package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue.js +90 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js +54 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js +7 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +154 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js +6 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js +29 -0
- package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js.map +1 -0
- package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js +20 -0
- package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js.map +1 -0
- package/js/x-modules/related-prompts/store/emitters.js +14 -0
- package/js/x-modules/related-prompts/store/emitters.js.map +1 -0
- package/js/x-modules/related-prompts/store/getters/request.getter.js +16 -0
- package/js/x-modules/related-prompts/store/getters/request.getter.js.map +1 -0
- package/js/x-modules/related-prompts/store/module.js +53 -0
- package/js/x-modules/related-prompts/store/module.js.map +1 -0
- package/js/x-modules/related-prompts/wiring.js +88 -0
- package/js/x-modules/related-prompts/wiring.js.map +1 -0
- package/js/x-modules/related-prompts/x-module.js +21 -0
- package/js/x-modules/related-prompts/x-module.js.map +1 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js +2 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/search/components/results-list.vue.js +2 -2
- package/js/x-modules/search/components/results-list.vue.js.map +1 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js +2 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -1
- package/js/x-modules/search/store/module.js +5 -1
- package/js/x-modules/search/store/module.js.map +1 -1
- package/js/x-modules/tagging/components/tagging.vue.js +8 -2
- package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
- package/package.json +7 -6
- package/related-prompts/index.d.ts +1 -0
- package/related-prompts/index.js +9 -0
- package/report/x-adapter-platform.api.json +575 -1
- package/report/x-components.api.json +4236 -7917
- package/report/x-components.api.md +445 -155
- package/report/x-types.api.json +334 -0
- package/tools/inject-css.js +5 -3
- package/types/adapter/e2e-adapter.d.ts.map +1 -1
- package/types/adapter/mocked-responses.d.ts +3 -0
- package/types/adapter/mocked-responses.d.ts.map +1 -1
- package/types/components/base-dropdown.vue.d.ts +5 -5
- package/types/components/base-grid.vue.d.ts +3 -3
- package/types/components/base-slider.vue.d.ts +74 -0
- package/types/components/base-slider.vue.d.ts.map +1 -0
- package/types/components/base-variable-column-grid.vue.d.ts +3 -3
- package/types/components/global-x-bus.vue.d.ts +6 -0
- package/types/components/global-x-bus.vue.d.ts.map +1 -1
- package/types/components/index.d.ts +1 -0
- package/types/components/index.d.ts.map +1 -1
- package/types/components/items-list.vue.d.ts +3 -3
- package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +5 -5
- package/types/components/layouts/single-column-layout.vue.d.ts +3 -3
- package/types/components/modals/base-events-modal.vue.d.ts +2 -2
- package/types/components/modals/base-id-modal.vue.d.ts +2 -2
- package/types/components/modals/base-modal.vue.d.ts +10 -10
- package/types/components/modals/main-modal.vue.d.ts +2 -2
- package/types/components/panels/base-header-toggle-panel.vue.d.ts +5 -5
- package/types/components/panels/base-id-toggle-panel.vue.d.ts +5 -5
- package/types/components/panels/base-tabs-panel.vue.d.ts +8 -8
- package/types/components/panels/base-toggle-panel.vue.d.ts +3 -3
- package/types/components/result/base-result-image.vue.d.ts +10 -10
- package/types/components/result/base-result-image.vue.d.ts.map +1 -1
- package/types/components/snippet-callbacks.vue.d.ts +3 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/components/suggestions/base-suggestions.vue.d.ts +3 -3
- package/types/composables/use-alias-api.d.ts +5 -0
- package/types/composables/use-alias-api.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/tailwind/plugin-options.d.ts +1 -2
- package/types/tailwind/plugin-options.d.ts.map +1 -1
- package/types/types/animation-prop.d.ts +6 -2
- package/types/types/animation-prop.d.ts.map +1 -1
- package/types/views/home/types.d.ts +3 -0
- package/types/views/home/types.d.ts.map +1 -1
- package/types/wiring/events.types.d.ts +3 -1
- package/types/wiring/events.types.d.ts.map +1 -1
- package/types/x-modules/empathize/components/empathize.vue.d.ts +5 -5
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +3 -3
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +5 -2
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +3 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +3 -3
- package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +3 -3
- package/types/x-modules/history-queries/components/my-history.vue.d.ts +3 -3
- package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +3 -3
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +3 -3
- package/types/x-modules/next-queries/index.d.ts +1 -0
- package/types/x-modules/next-queries/index.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +3 -3
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.d.ts.map +1 -1
- package/types/x-modules/queries-preview/store/module.d.ts.map +1 -1
- package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts +4 -2
- package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts.map +1 -1
- package/types/x-modules/recommendations/components/recommendations.vue.d.ts +3 -3
- package/types/x-modules/related-prompts/components/index.d.ts +3 -0
- package/types/x-modules/related-prompts/components/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +37 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +106 -0
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/events.types.d.ts +26 -0
- package/types/x-modules/related-prompts/events.types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/index.d.ts +6 -0
- package/types/x-modules/related-prompts/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts +17 -0
- package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts +13 -0
- package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts +9 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/getters/request.getter.d.ts +13 -0
- package/types/x-modules/related-prompts/store/getters/request.getter.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/index.d.ts +7 -0
- package/types/x-modules/related-prompts/store/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/module.d.ts +8 -0
- package/types/x-modules/related-prompts/store/module.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/types.d.ts +104 -0
- package/types/x-modules/related-prompts/store/types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/types.d.ts +10 -0
- package/types/x-modules/related-prompts/types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/wiring.d.ts +31 -0
- package/types/x-modules/related-prompts/wiring.d.ts.map +1 -0
- package/types/x-modules/related-prompts/x-module.d.ts +16 -0
- package/types/x-modules/related-prompts/x-module.d.ts.map +1 -0
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts +3 -3
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +5 -5
- package/types/x-modules/search/components/banners-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/partial-results-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/promoteds-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/results-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
- package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -1
- package/types/x-modules/search/store/module.d.ts +2 -0
- package/types/x-modules/search/store/module.d.ts.map +1 -1
- package/types/x-modules/search/store/types.d.ts +9 -1
- package/types/x-modules/search/store/types.d.ts.map +1 -1
- package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +3 -3
- package/types/x-modules/tagging/components/tagging.vue.d.ts +17 -4
- package/types/x-modules/tagging/components/tagging.vue.d.ts.map +1 -1
- package/types/x-modules/x-modules.types.d.ts +2 -0
- package/types/x-modules/x-modules.types.d.ts.map +1 -1
- package/js/utils/options-api.js +0 -4
- package/js/utils/options-api.js.map +0 -1
- package/types/utils/options-api.d.ts +0 -3
- package/types/utils/options-api.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-preview.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\n import {\n computed,\n ComputedRef,\n defineComponent,\n inject,\n onBeforeUnmount,\n PropType,\n provide,\n Ref,\n watch\n } from 'vue';\n import { SearchRequest, Filter } from '@empathyco/x-types';\n import { deepEqual, Dictionary } from '@empathyco/x-utils';\n import { LIST_ITEMS_KEY } from '../../../components';\n import { QueryFeature, FeatureLocation } from '../../../types';\n import { QueryPreviewInfo, QueryPreviewItem } from '../store/types';\n import { QueriesPreviewConfig } from '../config.types';\n import { queriesPreviewXModule } from '../x-module';\n import {\n DebouncedFunction,\n debounceFunction,\n createOrigin,\n createRawFilters\n } from '../../../utils';\n import { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview';\n import { useXBus, useState } from '../../../composables';\n\n /**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\n export default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false\n }\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus();\n\n const queriesPreviewState = useState('queriesPreview', [\n 'queriesPreview',\n 'params',\n 'config'\n ]);\n\n /**\n * The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n */\n const previewResults: ComputedRef<Dictionary<QueryPreviewItem>> =\n queriesPreviewState.queriesPreview;\n\n /**\n * As the request is handled in this component, we need\n * the extra params that will be used in the request.\n */\n const params: ComputedRef<Dictionary<unknown>> = queriesPreviewState.params;\n\n /**\n * As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const config: ComputedRef<QueriesPreviewConfig> = queriesPreviewState.config;\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() => getHashFromQueryPreviewInfo(props.queryPreviewInfo));\n\n provide('queryPreviewHash', queryPreviewHash);\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value];\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender)\n }\n : undefined;\n });\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results);\n provide(LIST_ITEMS_KEY as string, results);\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none');\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation;\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location: location\n });\n const filters = props.queryPreviewInfo.filters?.reduce((filtersList, filterId) => {\n const facetId = filterId.split(':')[0];\n const rawFilter = createRawFilters([filterId])[0];\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter];\n\n return filtersList;\n }, {} as Record<string, Filter[]>);\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams\n },\n filters: filters,\n ...(origin && { origin })\n };\n });\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false });\n }, props.debounceTimeMs)\n );\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest)) {\n emitQueryPreviewRequestUpdated.value(newRequest);\n }\n });\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value];\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value);\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false\n });\n } else {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value);\n }\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n emitQueryPreviewRequestUpdated.value.cancel();\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false\n }\n );\n });\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel();\n }\n );\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status);\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value);\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value);\n }\n });\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0);\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no results, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging\n };\n\n return hasResults.value ? slots.default?.(slotProps)[0] : '';\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults };\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps;\n }\n });\n</script>\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script>\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'QueryPreviewDemo',\n components: {\n QueryPreview\n },\n data() {\n return {\n queryPreviewInfo: { query: 'sandals' }\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script>\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n import { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'QueryPreviewDemoOverridingSlot',\n components: {\n BaseResultImage,\n BaseResultLink,\n QueryPreview,\n SlidingPanel\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' }\n };\n }\n };\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script>\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'QueryPreviewDemoOverridingResultSlot',\n components: {\n QueryPreview\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' }\n };\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script>\n import { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components';\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'QueryPreviewDemo',\n components: {\n BaseGrid,\n BaseResultImage,\n BaseResultLink,\n QueryPreview\n },\n data() {\n return {\n maxItemsToRender: 4,\n queryPreviewInfo: { query: 'flip-flops' }\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["debounceFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CE;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,KAAK,EAAE;;AAEL,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAoC;AAC1C,YAAA,QAAQ,EAAE,IAAG;AACd,SAAA;;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAA+B;AACtC,SAAA;;AAED,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAK;AACZ,SAAA;AACD;;;;AAIE;AACF,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;AACD;;;AAGE;AACF,QAAA,cAAc,EAAE;AACd,YAAA,IAAI,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,KAAK,EAAE,cAAc;AACzD,gBAAA,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE,YAAW;aACrD,CAAA;YAED,OAAO,UAAU,CAAC,KAAM,GAAE,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA,GAAI,EAAE,CAAA;SAC9D;AAEA;AAC6E;AAC7E,QAAA,MAAM,cAAa,GAAI,EAAE,UAAU,EAAE,mBAAkB,EAAG,CAAA;AAC1D,QAAA,QAAQ,KAAK,CAAC,OAAM,GAAI,iBAAgB,GAAI,cAAc,EAA0B;KACtF;AACD,CAAA,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"query-preview.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\n import {\n computed,\n ComputedRef,\n defineComponent,\n inject,\n onBeforeUnmount,\n PropType,\n provide,\n Ref,\n watch\n } from 'vue';\n import { SearchRequest, Filter } from '@empathyco/x-types';\n import { deepEqual, Dictionary } from '@empathyco/x-utils';\n import { LIST_ITEMS_KEY } from '../../../components';\n import { QueryFeature, FeatureLocation } from '../../../types';\n import { QueryPreviewInfo, QueryPreviewItem } from '../store/types';\n import { QueriesPreviewConfig } from '../config.types';\n import { queriesPreviewXModule } from '../x-module';\n import {\n DebouncedFunction,\n debounceFunction,\n createOrigin,\n createRawFilters\n } from '../../../utils';\n import { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview';\n import { useXBus, useState } from '../../../composables';\n\n /**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\n export default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false\n }\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus();\n\n const queriesPreviewState = useState('queriesPreview', [\n 'queriesPreview',\n 'params',\n 'config'\n ]);\n\n /**\n * The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n */\n const previewResults: ComputedRef<Dictionary<QueryPreviewItem>> =\n queriesPreviewState.queriesPreview;\n\n /**\n * As the request is handled in this component, we need\n * the extra params that will be used in the request.\n */\n const params: ComputedRef<Dictionary<unknown>> = queriesPreviewState.params;\n\n /**\n * As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const config: ComputedRef<QueriesPreviewConfig> = queriesPreviewState.config;\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, params.value.lang as string)\n );\n\n provide('queryPreviewHash', queryPreviewHash);\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value];\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender)\n }\n : undefined;\n });\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results);\n provide(LIST_ITEMS_KEY as string, results);\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none');\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation;\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location: location\n });\n const filters = props.queryPreviewInfo.filters?.reduce((filtersList, filterId) => {\n const facetId = filterId.split(':')[0];\n const rawFilter = createRawFilters([filterId])[0];\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter];\n\n return filtersList;\n }, {} as Record<string, Filter[]>);\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams\n },\n filters: filters,\n ...(origin && { origin })\n };\n });\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false });\n }, props.debounceTimeMs)\n );\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest)) {\n emitQueryPreviewRequestUpdated.value(newRequest);\n }\n });\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value];\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value);\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false\n });\n } else {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value);\n }\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n emitQueryPreviewRequestUpdated.value.cancel();\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false\n }\n );\n });\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel();\n }\n );\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status);\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value);\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value);\n }\n });\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0);\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no results, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging\n };\n\n return hasResults.value ? slots.default?.(slotProps)[0] : '';\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults };\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps;\n }\n });\n</script>\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script>\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'QueryPreviewDemo',\n components: {\n QueryPreview\n },\n data() {\n return {\n queryPreviewInfo: { query: 'sandals' }\n };\n }\n };\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script>\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n import { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components';\n\n export default {\n name: 'QueryPreviewDemoOverridingSlot',\n components: {\n BaseResultImage,\n BaseResultLink,\n QueryPreview,\n SlidingPanel\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' }\n };\n }\n };\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script>\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'QueryPreviewDemoOverridingResultSlot',\n components: {\n QueryPreview\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' }\n };\n }\n };\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script>\n import { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components';\n import { QueryPreview } from '@empathyco/x-components/queries-preview';\n\n export default {\n name: 'QueryPreviewDemo',\n components: {\n BaseGrid,\n BaseResultImage,\n BaseResultLink,\n QueryPreview\n },\n data() {\n return {\n maxItemsToRender: 4,\n que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39
39
|
.catch(error => {
|
|
40
40
|
// eslint-disable-next-line no-console
|
|
41
41
|
console.error(error);
|
|
42
|
-
const
|
|
42
|
+
const lang = request.extraParams ? request.extraParams.lang : '';
|
|
43
|
+
const queryPreviewHash = getHashFromQueryPreviewItem(queryPreviewItem, lang);
|
|
43
44
|
commit('setStatus', { queryPreviewHash, status: 'error' });
|
|
44
45
|
});
|
|
45
46
|
};
|
package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-and-save-query-preview.action.js","sources":["../../../../../../src/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.ts"],"sourcesContent":["import { QueriesPreviewXStoreModule, QueryPreviewItem } from '../types';\nimport { getHashFromQueryPreviewItem } from '../../utils/get-hash-from-query-preview';\n\n/**\n * Default implementation for the {@link QueriesPreviewActions.fetchAndSaveQueryPreview}.\n *\n * @param _context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n * @param request - The query preview request to make.\n * @returns A Promise of a SearchResponse when it fetches the results.\n *\n * @public\n */\n// eslint-disable-next-line max-len\nexport const fetchAndSaveQueryPreview: QueriesPreviewXStoreModule['actions']['fetchAndSaveQueryPreview'] =\n ({ dispatch, commit }, request) => {\n const { query } = request;\n\n if (!query) {\n return;\n }\n\n const queryPreviewItem: QueryPreviewItem = {\n request,\n results: [],\n status: 'loading',\n totalResults: 0,\n instances: 1\n };\n\n commit('setQueryPreviewCached', queryPreviewItem);\n\n return dispatch('fetchQueryPreview', request)\n .then(response => {\n commit('setQueryPreviewCached', {\n request,\n results: response?.results ?? [],\n status: 'success',\n totalResults: response?.totalResults ?? 0,\n instances: 1,\n displayTagging: response?.displayTagging ?? undefined,\n queryTagging: response?.queryTagging ?? undefined\n });\n })\n .catch(error => {\n // eslint-disable-next-line no-console\n console.error(error);\n const queryPreviewHash = getHashFromQueryPreviewItem(queryPreviewItem);\n commit('setStatus', { queryPreviewHash, status: 'error' });\n });\n };\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACH;AACO,MAAM,wBAAwB,GACnC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,KAAI;AAChC,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;AACR,KAAA;AAED,IAAA,MAAM,gBAAgB,GAAqB;QACzC,OAAO;AACP,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,YAAY,EAAE,CAAC;AACf,QAAA,SAAS,EAAE,CAAC;KACb,CAAC;AAEF,IAAA,MAAM,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,CAAC;AAElD,IAAA,OAAO,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;SAC1C,IAAI,CAAC,QAAQ,IAAG;QACf,MAAM,CAAC,uBAAuB,EAAE;YAC9B,OAAO;AACP,YAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,EAAE;AAChC,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,YAAY,EAAE,QAAQ,EAAE,YAAY,IAAI,CAAC;AACzC,YAAA,SAAS,EAAE,CAAC;AACZ,YAAA,cAAc,EAAE,QAAQ,EAAE,cAAc,IAAI,SAAS;AACrD,YAAA,YAAY,EAAE,QAAQ,EAAE,YAAY,IAAI,SAAS;AAClD,SAAA,CAAC,CAAC;AACL,KAAC,CAAC;SACD,KAAK,CAAC,KAAK,IAAG;;AAEb,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,QAAA,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-and-save-query-preview.action.js","sources":["../../../../../../src/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.ts"],"sourcesContent":["import { QueriesPreviewXStoreModule, QueryPreviewItem } from '../types';\nimport { getHashFromQueryPreviewItem } from '../../utils/get-hash-from-query-preview';\n\n/**\n * Default implementation for the {@link QueriesPreviewActions.fetchAndSaveQueryPreview}.\n *\n * @param _context - The {@link https://vuex.vuejs.org/guide/actions.html | context} of the actions,\n * provided by Vuex.\n * @param request - The query preview request to make.\n * @returns A Promise of a SearchResponse when it fetches the results.\n *\n * @public\n */\n// eslint-disable-next-line max-len\nexport const fetchAndSaveQueryPreview: QueriesPreviewXStoreModule['actions']['fetchAndSaveQueryPreview'] =\n ({ dispatch, commit }, request) => {\n const { query } = request;\n\n if (!query) {\n return;\n }\n\n const queryPreviewItem: QueryPreviewItem = {\n request,\n results: [],\n status: 'loading',\n totalResults: 0,\n instances: 1\n };\n\n commit('setQueryPreviewCached', queryPreviewItem);\n\n return dispatch('fetchQueryPreview', request)\n .then(response => {\n commit('setQueryPreviewCached', {\n request,\n results: response?.results ?? [],\n status: 'success',\n totalResults: response?.totalResults ?? 0,\n instances: 1,\n displayTagging: response?.displayTagging ?? undefined,\n queryTagging: response?.queryTagging ?? undefined\n });\n })\n .catch(error => {\n // eslint-disable-next-line no-console\n console.error(error);\n const lang = request.extraParams ? request.extraParams.lang : '';\n const queryPreviewHash = getHashFromQueryPreviewItem(queryPreviewItem, lang as string);\n commit('setStatus', { queryPreviewHash, status: 'error' });\n });\n };\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACH;AACO,MAAM,wBAAwB,GACnC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,OAAO,KAAI;AAChC,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1B,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;AACR,KAAA;AAED,IAAA,MAAM,gBAAgB,GAAqB;QACzC,OAAO;AACP,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,YAAY,EAAE,CAAC;AACf,QAAA,SAAS,EAAE,CAAC;KACb,CAAC;AAEF,IAAA,MAAM,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,CAAC;AAElD,IAAA,OAAO,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;SAC1C,IAAI,CAAC,QAAQ,IAAG;QACf,MAAM,CAAC,uBAAuB,EAAE;YAC9B,OAAO;AACP,YAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,EAAE;AAChC,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,YAAY,EAAE,QAAQ,EAAE,YAAY,IAAI,CAAC;AACzC,YAAA,SAAS,EAAE,CAAC;AACZ,YAAA,cAAc,EAAE,QAAQ,EAAE,cAAc,IAAI,SAAS;AACrD,YAAA,YAAY,EAAE,QAAQ,EAAE,YAAY,IAAI,SAAS;AAClD,SAAA,CAAC,CAAC;AACL,KAAC,CAAC;SACD,KAAK,CAAC,KAAK,IAAG;;AAEb,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;QACjE,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,gBAAgB,EAAE,IAAc,CAAC,CAAC;QACvF,MAAM,CAAC,WAAW,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7D,KAAC,CAAC,CAAC;AACP;;;;"}
|
|
@@ -31,7 +31,7 @@ const queriesPreviewXStoreModule = {
|
|
|
31
31
|
state.params = params;
|
|
32
32
|
},
|
|
33
33
|
setQueryPreviewCached(state, queryPreview) {
|
|
34
|
-
state.queriesPreview[getHashFromQueryPreviewItem(queryPreview)] = queryPreview;
|
|
34
|
+
state.queriesPreview[getHashFromQueryPreviewItem(queryPreview, queryPreview.request.extraParams?.lang)] = queryPreview;
|
|
35
35
|
},
|
|
36
36
|
setStatus(state, { queryPreviewHash, status }) {
|
|
37
37
|
state.queriesPreview[queryPreviewHash].status = status;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/queries-preview/store/module.ts"],"sourcesContent":["import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { getHashFromQueryPreviewItem } from '../utils/get-hash-from-query-preview';\nimport { QueriesPreviewXStoreModule } from './types';\nimport { fetchQueryPreview } from './actions/fetch-query-preview.action';\nimport { fetchAndSaveQueryPreview } from './actions/fetch-and-save-query-preview.action';\nimport { loadedQueriesPreview } from './getters/loaded-queries-preview.getter';\n\n/**\n * {@link XStoreModule} For the `queries-preview` module.\n *\n * @internal\n */\nexport const queriesPreviewXStoreModule: QueriesPreviewXStoreModule = {\n state: () => ({\n config: {\n maxItemsToRequest: 24\n },\n queriesPreview: {},\n selectedQueryPreview: {\n query: '',\n extraParams: undefined,\n filters: undefined\n },\n params: {}\n }),\n getters: { loadedQueriesPreview },\n mutations: {\n clearQueryPreview(state, queryPreviewHash) {\n delete state.queriesPreview[queryPreviewHash];\n },\n setParams(state, params) {\n state.params = params;\n },\n setQueryPreviewCached(state, queryPreview) {\n state.queriesPreview[getHashFromQueryPreviewItem(queryPreview)] = queryPreview;\n },\n setStatus(state, { queryPreviewHash, status }) {\n state.queriesPreview[queryPreviewHash].status = status;\n },\n setSelectedQueryPreview(state, selectedQueryPreview) {\n state.selectedQueryPreview = selectedQueryPreview;\n },\n setConfig,\n mergeConfig,\n addQueryPreviewInstance(state, queryPreviewHash) {\n if (state.queriesPreview[queryPreviewHash]) {\n state.queriesPreview[queryPreviewHash].instances += 1;\n }\n },\n removeQueryPreviewInstance(state, { queryPreviewHash, cache }) {\n if (state.queriesPreview[queryPreviewHash]) {\n state.queriesPreview[queryPreviewHash].instances -= 1;\n\n if (!cache && state.queriesPreview[queryPreviewHash].instances === 0) {\n delete state.queriesPreview[queryPreviewHash];\n }\n }\n },\n updateAQueryPreviewResult(state, { result, queryPreviewHash }) {\n const queryPreviewResult = state.queriesPreview[queryPreviewHash.value]?.results.find(\n resultPreview => resultPreview.id === result.id\n );\n if (queryPreviewResult) {\n Object.assign(queryPreviewResult, result);\n }\n }\n },\n actions: {\n fetchQueryPreview,\n fetchAndSaveQueryPreview\n }\n};\n"],"names":[],"mappings":";;;;;;AAOA;;;;AAIG;AACU,MAAA,0BAA0B,GAA+B;AACpE,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,iBAAiB,EAAE,EAAE;AACtB,SAAA;AACD,QAAA,cAAc,EAAE,EAAE;AAClB,QAAA,oBAAoB,EAAE;AACpB,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,WAAW,EAAE,SAAS;AACtB,YAAA,OAAO,EAAE,SAAS;AACnB,SAAA;AACD,QAAA,MAAM,EAAE,EAAE;KACX,CAAC;IACF,OAAO,EAAE,EAAE,oBAAoB,EAAE;AACjC,IAAA,SAAS,EAAE;QACT,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAA;AACvC,YAAA,OAAO,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;SAC/C;QACD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAA;AACrB,YAAA,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;SACvB;QACD,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAA;
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/queries-preview/store/module.ts"],"sourcesContent":["import { mergeConfig, setConfig } from '../../../store/utils/config-store.utils';\nimport { getHashFromQueryPreviewItem } from '../utils/get-hash-from-query-preview';\nimport { QueriesPreviewXStoreModule } from './types';\nimport { fetchQueryPreview } from './actions/fetch-query-preview.action';\nimport { fetchAndSaveQueryPreview } from './actions/fetch-and-save-query-preview.action';\nimport { loadedQueriesPreview } from './getters/loaded-queries-preview.getter';\n\n/**\n * {@link XStoreModule} For the `queries-preview` module.\n *\n * @internal\n */\nexport const queriesPreviewXStoreModule: QueriesPreviewXStoreModule = {\n state: () => ({\n config: {\n maxItemsToRequest: 24\n },\n queriesPreview: {},\n selectedQueryPreview: {\n query: '',\n extraParams: undefined,\n filters: undefined\n },\n params: {}\n }),\n getters: { loadedQueriesPreview },\n mutations: {\n clearQueryPreview(state, queryPreviewHash) {\n delete state.queriesPreview[queryPreviewHash];\n },\n setParams(state, params) {\n state.params = params;\n },\n setQueryPreviewCached(state, queryPreview) {\n state.queriesPreview[\n getHashFromQueryPreviewItem(queryPreview, queryPreview.request.extraParams?.lang as string)\n ] = queryPreview;\n },\n setStatus(state, { queryPreviewHash, status }) {\n state.queriesPreview[queryPreviewHash].status = status;\n },\n setSelectedQueryPreview(state, selectedQueryPreview) {\n state.selectedQueryPreview = selectedQueryPreview;\n },\n setConfig,\n mergeConfig,\n addQueryPreviewInstance(state, queryPreviewHash) {\n if (state.queriesPreview[queryPreviewHash]) {\n state.queriesPreview[queryPreviewHash].instances += 1;\n }\n },\n removeQueryPreviewInstance(state, { queryPreviewHash, cache }) {\n if (state.queriesPreview[queryPreviewHash]) {\n state.queriesPreview[queryPreviewHash].instances -= 1;\n\n if (!cache && state.queriesPreview[queryPreviewHash].instances === 0) {\n delete state.queriesPreview[queryPreviewHash];\n }\n }\n },\n updateAQueryPreviewResult(state, { result, queryPreviewHash }) {\n const queryPreviewResult = state.queriesPreview[queryPreviewHash.value]?.results.find(\n resultPreview => resultPreview.id === result.id\n );\n if (queryPreviewResult) {\n Object.assign(queryPreviewResult, result);\n }\n }\n },\n actions: {\n fetchQueryPreview,\n fetchAndSaveQueryPreview\n }\n};\n"],"names":[],"mappings":";;;;;;AAOA;;;;AAIG;AACU,MAAA,0BAA0B,GAA+B;AACpE,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE;AACN,YAAA,iBAAiB,EAAE,EAAE;AACtB,SAAA;AACD,QAAA,cAAc,EAAE,EAAE;AAClB,QAAA,oBAAoB,EAAE;AACpB,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,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C,SAAS,IAAI,CAAC,CAAC;AAEtD,gBAAA,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,SAAS,KAAK,CAAC,EAAE;AACpE,oBAAA,OAAO,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAC/C,iBAAA;AACF,aAAA;SACF;AACD,QAAA,yBAAyB,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAA;YAC3D,MAAM,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,CACnF,aAAa,IAAI,aAAa,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAChD,CAAC;AACF,YAAA,IAAI,kBAAkB,EAAE;AACtB,gBAAA,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAC3C,aAAA;SACF;AACF,KAAA;AACD,IAAA,OAAO,EAAE;QACP,iBAAiB;QACjB,wBAAwB;AACzB,KAAA;;;;;"}
|
|
@@ -5,26 +5,28 @@ import { md5 } from 'js-md5';
|
|
|
5
5
|
* with different filters can be saved more than once in the state.
|
|
6
6
|
*
|
|
7
7
|
* @param queryPreview - The {@link QueryPreviewItem | QueryPreviewItem} used in the request.
|
|
8
|
+
* @param lang - The language used in the request.
|
|
8
9
|
* @returns A unique id that will be used as a key to store the QueryPreviewItem in the state.
|
|
9
10
|
*/
|
|
10
|
-
const getHashFromQueryPreviewItem = (queryPreview) => {
|
|
11
|
+
const getHashFromQueryPreviewItem = (queryPreview, lang) => {
|
|
11
12
|
const queryPreviewFilters = queryPreview.request.filters
|
|
12
13
|
? Object.values(queryPreview.request.filters)
|
|
13
14
|
.flat()
|
|
14
15
|
.map(filter => filter.id.toString())
|
|
15
16
|
.join('-')
|
|
16
17
|
: '';
|
|
17
|
-
return md5(queryPreview.request.query.concat(queryPreviewFilters));
|
|
18
|
+
return md5(queryPreview.request.query.concat(queryPreviewFilters).concat(lang));
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
* Creates a query hash to check if a QueryPreview has already been saved in the state.
|
|
21
22
|
*
|
|
22
23
|
* @param queryPreviewInfo - The {@link QueryPreviewInfo | QueryPreviewInfo} of a QueryPreview.
|
|
24
|
+
* @param lang - The language used in the request.
|
|
23
25
|
* @returns A unique id that will be used as a key to check the QueryPreview in the state.
|
|
24
26
|
*/
|
|
25
|
-
const getHashFromQueryPreviewInfo = (queryPreviewInfo) => {
|
|
27
|
+
const getHashFromQueryPreviewInfo = (queryPreviewInfo, lang) => {
|
|
26
28
|
const queryPreviewFilters = queryPreviewInfo.filters ? queryPreviewInfo.filters.join('-') : '';
|
|
27
|
-
return md5(queryPreviewInfo.query.concat(queryPreviewFilters));
|
|
29
|
+
return md5(queryPreviewInfo.query.concat(queryPreviewFilters).concat(lang));
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
export { getHashFromQueryPreviewInfo, getHashFromQueryPreviewItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-hash-from-query-preview.js","sources":["../../../../../src/x-modules/queries-preview/utils/get-hash-from-query-preview.ts"],"sourcesContent":["import { md5 } from 'js-md5';\nimport { QueryPreviewInfo, QueryPreviewItem } from '../store/index';\n\n/**\n * Creates a query hash to store a QueryPreview, so the same query\n * with different filters can be saved more than once in the state.\n *\n * @param queryPreview - The {@link QueryPreviewItem | QueryPreviewItem} used in the request.\n * @returns A unique id that will be used as a key to store the QueryPreviewItem in the state.\n */\nexport const getHashFromQueryPreviewItem = (queryPreview: QueryPreviewItem): string => {\n const queryPreviewFilters = queryPreview.request.filters\n ? Object.values(queryPreview.request.filters)\n .flat()\n .map(filter => filter.id.toString())\n .join('-')\n : '';\n\n return md5(queryPreview.request.query.concat(queryPreviewFilters));\n};\n\n/**\n * Creates a query hash to check if a QueryPreview has already been saved in the state.\n *\n * @param queryPreviewInfo - The {@link QueryPreviewInfo | QueryPreviewInfo} of a QueryPreview.\n * @returns A unique id that will be used as a key to check the QueryPreview in the state.\n */\nexport const getHashFromQueryPreviewInfo = (queryPreviewInfo: QueryPreviewInfo): string => {\n const queryPreviewFilters = queryPreviewInfo.filters ? queryPreviewInfo.filters.join('-') : '';\n\n return md5(queryPreviewInfo.query.concat(queryPreviewFilters));\n};\n"],"names":[],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"get-hash-from-query-preview.js","sources":["../../../../../src/x-modules/queries-preview/utils/get-hash-from-query-preview.ts"],"sourcesContent":["import { md5 } from 'js-md5';\nimport { QueryPreviewInfo, QueryPreviewItem } from '../store/index';\n\n/**\n * Creates a query hash to store a QueryPreview, so the same query\n * with different filters can be saved more than once in the state.\n *\n * @param queryPreview - The {@link QueryPreviewItem | QueryPreviewItem} used in the request.\n * @param lang - The language used in the request.\n * @returns A unique id that will be used as a key to store the QueryPreviewItem in the state.\n */\nexport const getHashFromQueryPreviewItem = (\n queryPreview: QueryPreviewItem,\n lang: string\n): string => {\n const queryPreviewFilters = queryPreview.request.filters\n ? Object.values(queryPreview.request.filters)\n .flat()\n .map(filter => filter.id.toString())\n .join('-')\n : '';\n\n return md5(queryPreview.request.query.concat(queryPreviewFilters).concat(lang));\n};\n\n/**\n * Creates a query hash to check if a QueryPreview has already been saved in the state.\n *\n * @param queryPreviewInfo - The {@link QueryPreviewInfo | QueryPreviewInfo} of a QueryPreview.\n * @param lang - The language used in the request.\n * @returns A unique id that will be used as a key to check the QueryPreview in the state.\n */\nexport const getHashFromQueryPreviewInfo = (\n queryPreviewInfo: QueryPreviewInfo,\n lang: string\n): string => {\n const queryPreviewFilters = queryPreviewInfo.filters ? queryPreviewInfo.filters.join('-') : '';\n\n return md5(queryPreviewInfo.query.concat(queryPreviewFilters).concat(lang));\n};\n"],"names":[],"mappings":";;AAGA;;;;;;;AAOG;MACU,2BAA2B,GAAG,CACzC,YAA8B,EAC9B,IAAY,KACF;AACV,IAAA,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO;UACpD,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC;AACxC,aAAA,IAAI,EAAE;aACN,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;aACnC,IAAI,CAAC,GAAG,CAAC;UACZ,EAAE,CAAC;AAEP,IAAA,OAAO,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAClF,EAAE;AAEF;;;;;;AAMG;MACU,2BAA2B,GAAG,CACzC,gBAAkC,EAClC,IAAY,KACF;IACV,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AAE/F,IAAA,OAAO,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9E;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import _sfc_main from './related-prompt.vue2.js';
|
|
2
|
+
import { resolveComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createVNode, withCtx, Fragment, renderList, normalizeClass, createBlock } from 'vue';
|
|
3
|
+
import './related-prompt.vue3.js';
|
|
4
|
+
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.js';
|
|
5
|
+
|
|
6
|
+
const _hoisted_1 = {
|
|
7
|
+
class: "x-related-prompt",
|
|
8
|
+
"data-test": "related-prompt"
|
|
9
|
+
};
|
|
10
|
+
const _hoisted_2 = { class: "x-related-prompt__info" };
|
|
11
|
+
const _hoisted_3 = { class: "x-related-prompt__sliding-panel-content" };
|
|
12
|
+
const _hoisted_4 = ["onClick"];
|
|
13
|
+
const _hoisted_5 = { class: "x-related-prompt__query-preview" };
|
|
14
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
15
|
+
const _component_CrossTinyIcon = resolveComponent("CrossTinyIcon");
|
|
16
|
+
const _component_PlusIcon = resolveComponent("PlusIcon");
|
|
17
|
+
const _component_SlidingPanel = resolveComponent("SlidingPanel");
|
|
18
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
19
|
+
createElementVNode("div", _hoisted_2, [
|
|
20
|
+
renderSlot(_ctx.$slots, "header", {
|
|
21
|
+
suggestionText: _ctx.relatedPrompt.suggestionText
|
|
22
|
+
}, () => [
|
|
23
|
+
createTextVNode(
|
|
24
|
+
toDisplayString(_ctx.relatedPrompt.suggestionText),
|
|
25
|
+
1
|
|
26
|
+
/* TEXT */
|
|
27
|
+
)
|
|
28
|
+
], true),
|
|
29
|
+
renderSlot(_ctx.$slots, "next-queries", {
|
|
30
|
+
nextQueries: _ctx.relatedPrompt.nextQueries
|
|
31
|
+
}, () => [
|
|
32
|
+
createVNode(_component_SlidingPanel, { resetOnContentChange: false }, {
|
|
33
|
+
default: withCtx(() => [
|
|
34
|
+
createElementVNode("div", _hoisted_3, [
|
|
35
|
+
(openBlock(true), createElementBlock(
|
|
36
|
+
Fragment,
|
|
37
|
+
null,
|
|
38
|
+
renderList(_ctx.relatedPrompt.nextQueries, (nextQuery, index) => {
|
|
39
|
+
return openBlock(), createElementBlock("button", {
|
|
40
|
+
key: index,
|
|
41
|
+
onClick: ($event) => _ctx.onClick(nextQuery),
|
|
42
|
+
class: normalizeClass([
|
|
43
|
+
"x-button",
|
|
44
|
+
{ "x-selected": _ctx.selectedNextQuery === nextQuery },
|
|
45
|
+
_ctx.nextQueryButtonClass
|
|
46
|
+
])
|
|
47
|
+
}, [
|
|
48
|
+
renderSlot(_ctx.$slots, "next-query", { nextQuery }, () => [
|
|
49
|
+
createElementVNode(
|
|
50
|
+
"span",
|
|
51
|
+
null,
|
|
52
|
+
toDisplayString(nextQuery),
|
|
53
|
+
1
|
|
54
|
+
/* TEXT */
|
|
55
|
+
),
|
|
56
|
+
_ctx.selectedNextQuery === nextQuery ? (openBlock(), createBlock(_component_CrossTinyIcon, {
|
|
57
|
+
key: 0,
|
|
58
|
+
class: "x-icon"
|
|
59
|
+
})) : (openBlock(), createBlock(_component_PlusIcon, {
|
|
60
|
+
key: 1,
|
|
61
|
+
class: "x-icon"
|
|
62
|
+
}))
|
|
63
|
+
], true)
|
|
64
|
+
], 10, _hoisted_4);
|
|
65
|
+
}),
|
|
66
|
+
128
|
|
67
|
+
/* KEYED_FRAGMENT */
|
|
68
|
+
))
|
|
69
|
+
])
|
|
70
|
+
]),
|
|
71
|
+
_: 3
|
|
72
|
+
/* FORWARDED */
|
|
73
|
+
})
|
|
74
|
+
], true)
|
|
75
|
+
]),
|
|
76
|
+
createElementVNode("div", _hoisted_5, [
|
|
77
|
+
renderSlot(_ctx.$slots, "selected-query", { selectedQuery: _ctx.selectedNextQuery }, () => [
|
|
78
|
+
createTextVNode(
|
|
79
|
+
toDisplayString(_ctx.selectedNextQuery),
|
|
80
|
+
1
|
|
81
|
+
/* TEXT */
|
|
82
|
+
)
|
|
83
|
+
], true)
|
|
84
|
+
])
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
var relatedPrompt = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-44e318df"]]);
|
|
88
|
+
|
|
89
|
+
export { relatedPrompt as default };
|
|
90
|
+
//# sourceMappingURL=related-prompt.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <div class=\"x-related-prompt\" data-test=\"related-prompt\">\n <div class=\"x-related-prompt__info\">\n <slot name=\"header\" :suggestionText=\"relatedPrompt.suggestionText\">\n {{ relatedPrompt.suggestionText }}\n </slot>\n <slot name=\"next-queries\" :nextQueries=\"relatedPrompt.nextQueries\">\n <SlidingPanel :resetOnContentChange=\"false\">\n <div class=\"x-related-prompt__sliding-panel-content\">\n <button\n v-for=\"(nextQuery, index) in relatedPrompt.nextQueries\"\n :key=\"index\"\n @click=\"onClick(nextQuery)\"\n :class=\"[\n 'x-button',\n { 'x-selected': selectedNextQuery === nextQuery },\n nextQueryButtonClass\n ]\"\n >\n <slot name=\"next-query\" :nextQuery=\"nextQuery\">\n <span>{{ nextQuery }}</span>\n <CrossTinyIcon v-if=\"selectedNextQuery === nextQuery\" class=\"x-icon\" />\n <PlusIcon v-else class=\"x-icon\" />\n </slot>\n </button>\n </div>\n </SlidingPanel>\n </slot>\n </div>\n <div class=\"x-related-prompt__query-preview\">\n <slot name=\"selected-query\" :selectedQuery=\"selectedNextQuery\">\n {{ selectedNextQuery }}\n </slot>\n </div>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, PropType, ref } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import { relatedPromptsXModule } from '../x-module';\n import CrossTinyIcon from '../../../components/icons/cross-tiny.vue';\n import PlusIcon from '../../../components/icons/plus.vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n\n /**\n * This component shows a suggested related prompt with the associated next queries.\n * It allows to select one of the next query and show it.\n *\n * It provide slots to customize the header, the next queries list,\n * the individual next query inside the list and the selected query.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPrompt',\n components: {\n SlidingPanel,\n CrossTinyIcon,\n PlusIcon\n },\n xModule: relatedPromptsXModule.name,\n props: {\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true\n },\n nextQueryButtonClass: {\n type: String,\n default: 'x-button-outlined'\n }\n },\n setup(props) {\n const selectedNextQuery = ref(props.relatedPrompt.nextQueries[0]);\n\n /**\n * Handles the click event on a next query button.\n *\n * @param nextQuery - The clicked next query.\n */\n function onClick(nextQuery: string): void {\n if (selectedNextQuery.value === nextQuery) {\n selectedNextQuery.value = '';\n } else {\n selectedNextQuery.value = nextQuery;\n }\n }\n\n return { selectedNextQuery, onClick };\n }\n });\n</script>\n<style lang=\"css\" scoped>\n .x-related-prompt__info {\n display: flex;\n flex-direction: column;\n }\n\n .x-related-prompt__sliding-panel-content {\n display: flex;\n gap: 8px;\n }\n</style>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_createElementVNode","relatedPrompt","_renderSlot","_createTextVNode","_toDisplayString","_createVNode","_withCtx","_Fragment","_renderList","onClick","selectedNextQuery","nextQueryButtonClass","_createBlock"],"mappings":";;;;;MACgC,UAAU,GAAA;AAAA,EAAA,KAAA,EAAA,kBAAA;;;AAD1C,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,wBAAA,EAAA,CAAA;AA6BS,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,yCAAiC,EAAA,CAAA;;;;;;kCA5B9CA,gBAiCM,CAAA,cAAA,CAAA,CAAA;SA/BFC,SAEO,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA,UAAA,EAAA;AAAA,IAAAC,kBAAA,CAF8BC,KAAc,EAAA,UAAA,EAAA;AAAA,MAE5CC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA;AAAA,QALb,cAIWD,EAAAA,IAAAA,CAAAA,aAAAA,CAAAA,cAAAA;AAAAA,OAAAA,EAAAA,MAAAA;AAEL,QAAAE,eAAA;AAAA,UAqBOC,eAAA,CAAA,IAAA,CAAA,aAAA,CAAA,cAAA,CAAA;AAAA,UAAA,CAAA;AAAA;AAAA,SAAA;AAAA,OArBoB,EAAA,IAAA,CAAA;AAAA,MAqBpBF,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,cAAA,EAAA;AAAA,QApBL,WAmBe,EAAA,IAAA,CAAA,aAAA,CAAA,WAAA;AAAA,OA1BvB,EAAA,MAAA;AAAA,QAAAG,WAAA,CAQU,uBAiBM,EAAA,EAAA,oBAAA,EAAA,KAAA,EAAA,EAAA;AAAA,UAh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AA,IAAAA,CAAAA,iBAAAA,EAAAA,EAAAA,MAAAA;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineComponent, ref } from 'vue';
|
|
2
|
+
import { relatedPromptsXModule } from '../x-module.js';
|
|
3
|
+
import CrossTinyIcon from '../../../components/icons/cross-tiny.vue.js';
|
|
4
|
+
import PlusIcon from '../../../components/icons/plus.vue.js';
|
|
5
|
+
import SlidingPanel from '../../../components/sliding-panel.vue.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This component shows a suggested related prompt with the associated next queries.
|
|
9
|
+
* It allows to select one of the next query and show it.
|
|
10
|
+
*
|
|
11
|
+
* It provide slots to customize the header, the next queries list,
|
|
12
|
+
* the individual next query inside the list and the selected query.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
var _sfc_main = defineComponent({
|
|
17
|
+
name: 'RelatedPrompt',
|
|
18
|
+
components: {
|
|
19
|
+
SlidingPanel,
|
|
20
|
+
CrossTinyIcon,
|
|
21
|
+
PlusIcon
|
|
22
|
+
},
|
|
23
|
+
xModule: relatedPromptsXModule.name,
|
|
24
|
+
props: {
|
|
25
|
+
relatedPrompt: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
nextQueryButtonClass: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'x-button-outlined'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setup(props) {
|
|
35
|
+
const selectedNextQuery = ref(props.relatedPrompt.nextQueries[0]);
|
|
36
|
+
/**
|
|
37
|
+
* Handles the click event on a next query button.
|
|
38
|
+
*
|
|
39
|
+
* @param nextQuery - The clicked next query.
|
|
40
|
+
*/
|
|
41
|
+
function onClick(nextQuery) {
|
|
42
|
+
if (selectedNextQuery.value === nextQuery) {
|
|
43
|
+
selectedNextQuery.value = '';
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
selectedNextQuery.value = nextQuery;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return { selectedNextQuery, onClick };
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { _sfc_main as default };
|
|
54
|
+
//# sourceMappingURL=related-prompt.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompt.vue2.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <div class=\"x-related-prompt\" data-test=\"related-prompt\">\n <div class=\"x-related-prompt__info\">\n <slot name=\"header\" :suggestionText=\"relatedPrompt.suggestionText\">\n {{ relatedPrompt.suggestionText }}\n </slot>\n <slot name=\"next-queries\" :nextQueries=\"relatedPrompt.nextQueries\">\n <SlidingPanel :resetOnContentChange=\"false\">\n <div class=\"x-related-prompt__sliding-panel-content\">\n <button\n v-for=\"(nextQuery, index) in relatedPrompt.nextQueries\"\n :key=\"index\"\n @click=\"onClick(nextQuery)\"\n :class=\"[\n 'x-button',\n { 'x-selected': selectedNextQuery === nextQuery },\n nextQueryButtonClass\n ]\"\n >\n <slot name=\"next-query\" :nextQuery=\"nextQuery\">\n <span>{{ nextQuery }}</span>\n <CrossTinyIcon v-if=\"selectedNextQuery === nextQuery\" class=\"x-icon\" />\n <PlusIcon v-else class=\"x-icon\" />\n </slot>\n </button>\n </div>\n </SlidingPanel>\n </slot>\n </div>\n <div class=\"x-related-prompt__query-preview\">\n <slot name=\"selected-query\" :selectedQuery=\"selectedNextQuery\">\n {{ selectedNextQuery }}\n </slot>\n </div>\n </div>\n</template>\n<script lang=\"ts\">\n import { defineComponent, PropType, ref } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import { relatedPromptsXModule } from '../x-module';\n import CrossTinyIcon from '../../../components/icons/cross-tiny.vue';\n import PlusIcon from '../../../components/icons/plus.vue';\n import SlidingPanel from '../../../components/sliding-panel.vue';\n\n /**\n * This component shows a suggested related prompt with the associated next queries.\n * It allows to select one of the next query and show it.\n *\n * It provide slots to customize the header, the next queries list,\n * the individual next query inside the list and the selected query.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPrompt',\n components: {\n SlidingPanel,\n CrossTinyIcon,\n PlusIcon\n },\n xModule: relatedPromptsXModule.name,\n props: {\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true\n },\n nextQueryButtonClass: {\n type: String,\n default: 'x-button-outlined'\n }\n },\n setup(props) {\n const selectedNextQuery = ref(props.relatedPrompt.nextQueries[0]);\n\n /**\n * Handles the click event on a next query button.\n *\n * @param nextQuery - The clicked next query.\n */\n function onClick(nextQuery: string): void {\n if (selectedNextQuery.value === nextQuery) {\n selectedNextQuery.value = '';\n } else {\n selectedNextQuery.value = nextQuery;\n }\n }\n\n return { selectedNextQuery, onClick };\n }\n });\n</script>\n<style lang=\"css\" scoped>\n .x-related-prompt__info {\n display: flex;\n flex-direction: column;\n }\n\n .x-related-prompt__sliding-panel-content {\n display: flex;\n gap: 8px;\n }\n</style>\n"],"names":[],"mappings":";;;;;;AA4CE;;;;;;;;AAQE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,UAAU,EAAE;QACV,YAAY;QACZ,aAAa;QACb,QAAO;AACR,KAAA;IACD,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE;AACb,YAAA,IAAI,EAAE,MAAiC;AACvC,YAAA,QAAQ,EAAE,IAAG;AACd,SAAA;AACD,QAAA,oBAAoB,EAAE;AACpB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,mBAAkB;AAC7B,SAAA;AACD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,iBAAkB,GAAE,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;AAEjE;;;;AAIE;QACF,SAAS,OAAO,CAAC,SAAiB,EAAA;AAChC,YAAA,IAAI,iBAAiB,CAAC,KAAI,KAAM,SAAS,EAAE;AACzC,gBAAA,iBAAiB,CAAC,KAAI,GAAI,EAAE,CAAA;AAC5B,aAAA;AAAK,iBAAA;AACL,gBAAA,iBAAiB,CAAC,QAAQ,SAAS,CAAA;AACrC,aAAA;SACF;AAEA,QAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,CAAA;KACvC;AACD,CAAA,CAAC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import injectCss from '../../../../tools/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".x-related-prompt__info[data-v-44e318df]{display:flex;flex-direction:column}.x-related-prompt__sliding-panel-content[data-v-44e318df]{display:flex;gap:8px}";
|
|
4
|
+
injectCss(css);
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
7
|
+
//# sourceMappingURL=related-prompt.vue3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompt.vue3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, provide, h } from 'vue';
|
|
2
|
+
import { AnimationProp } from '../../../types/animation-prop.js';
|
|
3
|
+
import { groupItemsBy } from '../../../utils/array.js';
|
|
4
|
+
import ItemsList from '../../../components/items-list.vue.js';
|
|
5
|
+
import { QUERY_KEY, HAS_MORE_ITEMS_KEY, LIST_ITEMS_KEY } from '../../../components/decorators/injection.consts.js';
|
|
6
|
+
import { relatedPromptsXModule } from '../x-module.js';
|
|
7
|
+
import { useState } from '../../../composables/use-state.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Component that inserts groups of related prompts in different positions of the injected search
|
|
11
|
+
* items list, based on the provided configuration.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
var _sfc_main = defineComponent({
|
|
16
|
+
name: 'RelatedPromptsList',
|
|
17
|
+
xModule: relatedPromptsXModule.name,
|
|
18
|
+
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Animation component that will be used to animate the related prompts groups.
|
|
21
|
+
*/
|
|
22
|
+
animation: {
|
|
23
|
+
type: AnimationProp,
|
|
24
|
+
default: 'ul'
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* The first index to insert a group of related prompts at.
|
|
28
|
+
*/
|
|
29
|
+
offset: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: 24
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* The items cycle size to keep inserting related prompts groups at.
|
|
35
|
+
*/
|
|
36
|
+
frequency: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 24
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* The maximum amount of related prompts to add in a single group.
|
|
42
|
+
*/
|
|
43
|
+
maxRelatedPromptsPerGroup: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 4
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* The maximum number of groups to insert into the injected list items list.
|
|
49
|
+
*/
|
|
50
|
+
maxGroups: {
|
|
51
|
+
type: Number,
|
|
52
|
+
default: undefined
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Determines if a group is added to the injected items list in case the number
|
|
56
|
+
* of items is smaller than the offset.
|
|
57
|
+
*/
|
|
58
|
+
showOnlyAfterOffset: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
setup(props, { slots }) {
|
|
64
|
+
const { query, status } = useState('relatedPrompts', ['query', 'status']);
|
|
65
|
+
/**
|
|
66
|
+
* The state related prompts.
|
|
67
|
+
*/
|
|
68
|
+
const relatedPrompts = useState('relatedPrompts', [
|
|
69
|
+
'relatedPrompts'
|
|
70
|
+
]).relatedPrompts;
|
|
71
|
+
/**
|
|
72
|
+
* Injected query, updated when the related request(s) have succeeded.
|
|
73
|
+
*/
|
|
74
|
+
const injectedQuery = inject(QUERY_KEY);
|
|
75
|
+
/**
|
|
76
|
+
* Indicates if there are more available results than the injected.
|
|
77
|
+
*/
|
|
78
|
+
const hasMoreItems = inject(HAS_MORE_ITEMS_KEY);
|
|
79
|
+
/**
|
|
80
|
+
* The grouped related prompts based on the given config.
|
|
81
|
+
*
|
|
82
|
+
* @returns A list of related prompts groups.
|
|
83
|
+
*/
|
|
84
|
+
const relatedPromptsGroups = computed(() => Object.values(groupItemsBy(relatedPrompts.value, (_, index) => Math.floor(index / props.maxRelatedPromptsPerGroup)))
|
|
85
|
+
.slice(0, props.maxGroups)
|
|
86
|
+
.map((relatedPrompts, index) => ({
|
|
87
|
+
modelName: 'RelatedPromptsGroup',
|
|
88
|
+
id: `related-prompts-group-${index}`,
|
|
89
|
+
relatedPrompts
|
|
90
|
+
})));
|
|
91
|
+
/**
|
|
92
|
+
* It injects {@link ListItem} provided by an ancestor as injectedListItems.
|
|
93
|
+
*/
|
|
94
|
+
const injectedListItems = inject(LIST_ITEMS_KEY);
|
|
95
|
+
/**
|
|
96
|
+
* Checks if the related prompts are outdated taking into account the injected query.
|
|
97
|
+
*
|
|
98
|
+
* @returns True if the related prompts are outdated, false if not.
|
|
99
|
+
*/
|
|
100
|
+
const relatedPromptsAreOutdated = computed(() => !!injectedQuery?.value &&
|
|
101
|
+
(query.value !== injectedQuery.value || status.value !== 'success'));
|
|
102
|
+
/**
|
|
103
|
+
* Checks if the number of items is smaller than the offset so a group
|
|
104
|
+
* should be added to the injected items list.
|
|
105
|
+
*
|
|
106
|
+
* @returns True if a group should be added, false if not.
|
|
107
|
+
*/
|
|
108
|
+
const hasNotEnoughListItems = computed(() => !props.showOnlyAfterOffset &&
|
|
109
|
+
!hasMoreItems?.value &&
|
|
110
|
+
injectedListItems !== undefined &&
|
|
111
|
+
injectedListItems.value.length > 0 &&
|
|
112
|
+
props.offset > injectedListItems.value.length);
|
|
113
|
+
/**
|
|
114
|
+
* New list of {@link ListItem}s to render.
|
|
115
|
+
*
|
|
116
|
+
* @returns The new list of {@link ListItem}s with the related prompts groups inserted.
|
|
117
|
+
*/
|
|
118
|
+
const items = computed(() => {
|
|
119
|
+
if (!injectedListItems?.value) {
|
|
120
|
+
return relatedPromptsGroups.value;
|
|
121
|
+
}
|
|
122
|
+
if (relatedPromptsAreOutdated.value) {
|
|
123
|
+
return injectedListItems.value;
|
|
124
|
+
}
|
|
125
|
+
if (hasNotEnoughListItems.value) {
|
|
126
|
+
return injectedListItems.value.concat(relatedPromptsGroups.value[0] ?? []);
|
|
127
|
+
}
|
|
128
|
+
return relatedPromptsGroups?.value.reduce((items, relatedPromptsGroup, index) => {
|
|
129
|
+
const targetIndex = props.offset + props.frequency * index;
|
|
130
|
+
if (targetIndex <= items.length) {
|
|
131
|
+
items.splice(targetIndex, 0, relatedPromptsGroup);
|
|
132
|
+
}
|
|
133
|
+
return items;
|
|
134
|
+
}, [...injectedListItems.value]);
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* The computed list items of the entity that uses the mixin.
|
|
138
|
+
*
|
|
139
|
+
* @remarks It should be overridden in the component that uses the mixin and
|
|
140
|
+
* it's intended to be filled with items from the state. Vue doesn't allow
|
|
141
|
+
* mixins as abstract classes.
|
|
142
|
+
* @returns An empty array as fallback in case it is not overridden.
|
|
143
|
+
*/
|
|
144
|
+
provide(LIST_ITEMS_KEY, items);
|
|
145
|
+
return () => {
|
|
146
|
+
const innerProps = { items: items.value, animation: props.animation };
|
|
147
|
+
// https://vue-land.github.io/faq/forwarding-slots#passing-all-slots
|
|
148
|
+
return slots.default?.(innerProps)[0] ?? h(ItemsList, innerProps, slots);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export { _sfc_main as default };
|
|
154
|
+
//# sourceMappingURL=related-prompts-list.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-prompts-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-list.vue"],"sourcesContent":["<script lang=\"ts\">\n import { computed, ComputedRef, defineComponent, h, inject, provide, Ref } from 'vue';\n import { RelatedPrompt } from '@empathyco/x-types';\n import { AnimationProp } from '../../../types/animation-prop';\n import { groupItemsBy } from '../../../utils/array';\n import ItemsList from '../../../components/items-list.vue';\n import { ListItem } from '../../../utils/types';\n import {\n HAS_MORE_ITEMS_KEY,\n LIST_ITEMS_KEY,\n QUERY_KEY\n } from '../../../components/decorators/injection.consts';\n import { relatedPromptsXModule } from '../x-module';\n import { useState } from '../../../composables/use-state';\n import { RelatedPromptsGroup } from '../types';\n\n /**\n * Component that inserts groups of related prompts in different positions of the injected search\n * items list, based on the provided configuration.\n *\n * @public\n */\n export default defineComponent({\n name: 'RelatedPromptsList',\n xModule: relatedPromptsXModule.name,\n props: {\n /**\n * Animation component that will be used to animate the related prompts groups.\n */\n animation: {\n type: AnimationProp,\n default: 'ul'\n },\n /**\n * The first index to insert a group of related prompts at.\n */\n offset: {\n type: Number,\n default: 24\n },\n /**\n * The items cycle size to keep inserting related prompts groups at.\n */\n frequency: {\n type: Number,\n default: 24\n },\n /**\n * The maximum amount of related prompts to add in a single group.\n */\n maxRelatedPromptsPerGroup: {\n type: Number,\n default: 4\n },\n /**\n * The maximum number of groups to insert into the injected list items list.\n */\n maxGroups: {\n type: Number,\n default: undefined\n },\n /**\n * Determines if a group is added to the injected items list in case the number\n * of items is smaller than the offset.\n */\n showOnlyAfterOffset: {\n type: Boolean,\n default: false\n }\n },\n setup(props, { slots }) {\n const { query, status } = useState('relatedPrompts', ['query', 'status']);\n\n /**\n * The state related prompts.\n */\n const relatedPrompts: ComputedRef<RelatedPrompt[]> = useState('relatedPrompts', [\n 'relatedPrompts'\n ]).relatedPrompts;\n\n /**\n * Injected query, updated when the related request(s) have succeeded.\n */\n const injectedQuery = inject<Ref<string | undefined>>(QUERY_KEY as string);\n\n /**\n * Indicates if there are more available results than the injected.\n */\n const hasMoreItems = inject<Ref<boolean | undefined>>(HAS_MORE_ITEMS_KEY as string);\n\n /**\n * The grouped related prompts based on the given config.\n *\n * @returns A list of related prompts groups.\n */\n const relatedPromptsGroups = computed<RelatedPromptsGroup[]>(() =>\n Object.values(\n groupItemsBy(relatedPrompts.value, (_, index) =>\n Math.floor(index / props.maxRelatedPromptsPerGroup)\n )\n )\n .slice(0, props.maxGroups)\n .map((relatedPrompts, index) => ({\n modelName: 'RelatedPromptsGroup' as const,\n id: `related-prompts-group-${index}`,\n relatedPrompts\n }))\n );\n\n /**\n * It injects {@link ListItem} provided by an ancestor as injectedListItems.\n */\n const injectedListItems = inject<Ref<ListItem[]>>(LIST_ITEMS_KEY as string);\n\n /**\n * Checks if the related prompts are outdated taking into account the injected query.\n *\n * @returns True if the related prompts are outdated, false if not.\n */\n const relatedPromptsAreOutdated = computed(\n () =>\n !!injectedQuery?.value &&\n (query.value !== injectedQuery.value || status.value !== 'success')\n );\n\n /**\n * Checks if the number of items is smaller than the offset so a group\n * should be added to the injected items list.\n *\n * @returns True if a group should be added, false if not.\n */\n const hasNotEnoughListItems = computed(\n () =>\n !props.showOnlyAfterOffset &&\n !hasMoreItems?.value &&\n injectedListItems !== undefined &&\n injectedListItems.value.length > 0 &&\n props.offset > injectedListItems.value.length\n );\n\n /**\n * New list of {@link ListItem}s to render.\n *\n * @returns The new list of {@link ListItem}s with the related prompts groups inserted.\n */\n const items = computed((): ListItem[] => {\n if (!injectedListItems?.value) {\n return relatedPromptsGroups.value;\n }\n if (relatedPromptsAreOutdated.value) {\n return injectedListItems.value;\n }\n if (hasNotEnoughListItems.value) {\n return injectedListItems.value.concat(relatedPromptsGroups.value[0] ?? []);\n }\n return relatedPromptsGroups?.value.reduce(\n (items, relatedPromptsGroup, index) => {\n const targetIndex = props.offset + props.frequency * index;\n if (targetIndex <= items.length) {\n items.splice(targetIndex, 0, relatedPromptsGroup);\n }\n return items;\n },\n [...injectedListItems.value]\n );\n });\n\n /**\n * The computed list items of the entity that uses the mixin.\n *\n * @remarks It should be overridden in the component that uses the mixin and\n * it's intended to be filled with items from the state. Vue doesn't allow\n * mixins as abstract classes.\n * @returns An empty array as fallback in case it is not overridden.\n */\n provide(LIST_ITEMS_KEY as string, items);\n\n return () => {\n const innerProps = { items: items.value, animation: props.animation };\n // https://vue-land.github.io/faq/forwarding-slots#passing-all-slots\n return slots.default?.(innerProps)[0] ?? h(ItemsList, innerProps, slots);\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\n <!-- prettier-ignore-start -->\n\n:::warning Backend microservice required To use this component, the <b>QuerySignals</b> microservice\nmust be implemented. :::\n\n <!-- prettier-ignore-end -->\n\nUsually, this component is going to be used together with the `ResultsList` one. Related prompts\ngroups will be inserted between the results, guiding users to discover new searches directly from\nthe results list.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList />\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput\n }\n };\n</script>\n```\n\n### Play with the index that related prompts groups are inserted at\n\nThe component allows to customise where are the related prompts groups inserted. In the following\nexample, the first group of related prompts will be inserted at the index `48` (`offset`), and then\na second group will be inserted at index `120` because of the `frequency` prop configured to `72`.\nFinally, a third group will be inserted at index `192`. Because `maxGroups` is configured to `3`, no\nmore groups will be inserted. Each one of this groups will have up to `6` related prompts\n(`maxRelatedPromptsPerGroup`).\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList\n :offset=\"48\"\n :frequency=\"72\"\n :maxRelatedPromptsPerGroup=\"6\"\n :maxGroups=\"3\"\n />\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput\n }\n };\n</script>\n```\n\n### Showing/hiding first related prompts group when no more items\n\nBy default, the first related prompts group will be inserted when the total number of results is\nsmaller than the offset, but this behavior can be deactivated by setting the `showOnlyAfterOffset`\nto `true`.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList\n :offset=\"48\"\n :frequency=\"72\"\n :maxRelatedPromptsPerGroup=\"1\"\n :showOnlyAfterOffset=\"true\"\n />\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsList,\n ResultsList,\n SearchInput\n }\n };\n</script>\n```\n\n### Customise the layout of the component\n\nThis component will render by default the `id` of each search item, both the injected, and for the\ngroups of related prompts generated, but the common case is to integrate it with another layout\ncomponent, for example the `BaseGrid`. To do so, you can use the `default` slot\n\n```vue\n<template>\n <div>\n <SearchInput />\n <ResultsList>\n <RelatedPromptsList\n :offset=\"48\"\n :frequency=\"72\"\n :maxRelatedPromptsPerGroup=\"6\"\n :maxGroups=\"3\"\n #default=\"{ items }\"\n >\n <BaseGrid :items=\"items\" :animation=\"animation\">\n <template #related-prompts-group=\"{ item }\">\n <span v-for=\"const prompt of items.relatedPrompts\">\n RelatedPromptsGroup:\n <pre>{{ prompt }}</pre>\n </span>\n </template>\n <template #result=\"{ item }\">\n <span>Result: {{ item.name }}</span>\n </template>\n <template #default=\"{ item }\">\n <span>Default: {{ item }}</span>\n </template>\n </BaseGrid>\n </RelatedPromptsList>\n </ResultsList>\n </div>\n</template>\n\n<script>\n import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';\n import { ResultsList } from '@empathyco/x-components/search';\n import { SearchInput } from '@empathyco/x-components/search-box';\n import { BaseGrid } from '@empathyco/x-components';\n\n export default {\n name: 'RelatedPromptsListDemo',\n components: {\n RelatedPromptsLis,\n ResultsList,\n BaseGrid,\n SearchInput\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;AAgBE;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,qBAAqB,CAAC,IAAI;AACnC,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,IAAG;AACb,SAAA;AACD;;AAEE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAC;AACX,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAC;AACX,SAAA;AACD;;AAEE;AACF,QAAA,yBAAyB,EAAE;AACzB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,SAAQ;AAClB,SAAA;AACD;;;AAGE;AACF,QAAA,mBAAmB,EAAE;AACnB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAI;AACf,SAAA;AACD,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAI,EAAG,EAAA;AACpB,QAAA,MAAM,EAAE,KAAK,EAAE,MAAO,EAAA,GAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAA;AAEzE;;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