@empathyco/x-components 6.0.0-alpha.237 → 6.0.0-alpha.239
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 +18 -0
- package/core/index.d.ts +0 -1
- package/docs/API-reference/api/x-components.aioverview.md +0 -21
- package/docs/API-reference/api/x-components.allfilter.md +1 -1
- package/docs/API-reference/api/x-components.highlight_2.md +1 -1
- package/docs/API-reference/api/x-components.md +0 -11
- package/docs/API-reference/api/x-components.slidingpanel.md +2 -2
- package/docs/API-reference/components/ai/x-components.ai-overview.md +0 -3
- package/docs/API-reference/components/common/column-picker/x-components.base-column-picker-list.md +1 -1
- package/docs/API-reference/components/common/x-components.base-slider.md +2 -2
- package/js/components/animations/change-height.vue.js.map +1 -1
- package/js/components/animations/change-height.vue2.js.map +1 -1
- package/js/components/auto-progress-bar.vue.js +2 -2
- package/js/components/auto-progress-bar.vue.js.map +1 -1
- package/js/components/auto-progress-bar.vue2.js.map +1 -1
- package/js/components/base-slider.vue.js.map +1 -1
- package/js/components/base-slider.vue2.js.map +1 -1
- package/js/components/base-slider.vue3.js +1 -1
- package/js/components/base-switch.vue.js.map +1 -1
- package/js/components/base-switch.vue2.js +1 -1
- package/js/components/base-switch.vue2.js.map +1 -1
- package/js/components/column-picker/base-column-picker-list.vue.js +2 -2
- package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
- package/js/components/column-picker/base-column-picker-list.vue2.js +1 -1
- package/js/components/column-picker/base-column-picker-list.vue2.js.map +1 -1
- package/js/components/highlight.vue.js +1 -1
- package/js/components/highlight.vue.js.map +1 -1
- package/js/components/highlight.vue2.js +1 -1
- package/js/components/highlight.vue2.js.map +1 -1
- package/js/components/icons/ai-star.vue.js +1 -0
- package/js/components/icons/ai-star.vue.js.map +1 -1
- package/js/components/icons/arrow-down.vue.js +1 -1
- package/js/components/icons/arrow-down.vue.js.map +1 -1
- package/js/components/icons/arrow-left.vue.js +1 -1
- package/js/components/icons/arrow-left.vue.js.map +1 -1
- package/js/components/icons/arrow-right.vue.js +1 -1
- package/js/components/icons/arrow-right.vue.js.map +1 -1
- package/js/components/icons/arrow-up.vue.js +1 -1
- package/js/components/icons/arrow-up.vue.js.map +1 -1
- package/js/components/icons/bag.vue.js +1 -1
- package/js/components/icons/bag.vue.js.map +1 -1
- package/js/components/icons/bar-code.vue.js +1 -1
- package/js/components/icons/bar-code.vue.js.map +1 -1
- package/js/components/icons/barcode-tiny.vue.js +1 -1
- package/js/components/icons/barcode-tiny.vue.js.map +1 -1
- package/js/components/icons/cart-filled.vue.js +1 -1
- package/js/components/icons/cart-filled.vue.js.map +1 -1
- package/js/components/icons/cart.vue.js +1 -1
- package/js/components/icons/cart.vue.js.map +1 -1
- package/js/components/icons/check-tiny.vue.js +1 -1
- package/js/components/icons/check-tiny.vue.js.map +1 -1
- package/js/components/icons/check.vue.js +1 -1
- package/js/components/icons/check.vue.js.map +1 -1
- package/js/components/icons/checkbox-selected-filled.vue.js +1 -1
- package/js/components/icons/checkbox-selected-filled.vue.js.map +1 -1
- package/js/components/icons/checkbox-selected.vue.js +1 -1
- package/js/components/icons/checkbox-selected.vue.js.map +1 -1
- package/js/components/icons/checkbox-unselected-filled.vue.js +1 -1
- package/js/components/icons/checkbox-unselected-filled.vue.js.map +1 -1
- package/js/components/icons/checkbox-unselected.vue.js +1 -1
- package/js/components/icons/checkbox-unselected.vue.js.map +1 -1
- package/js/components/icons/chevron-down.vue.js +1 -1
- package/js/components/icons/chevron-down.vue.js.map +1 -1
- package/js/components/icons/chevron-left.vue.js +1 -1
- package/js/components/icons/chevron-left.vue.js.map +1 -1
- package/js/components/icons/chevron-right.vue.js +1 -1
- package/js/components/icons/chevron-right.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-down.vue.js +1 -1
- package/js/components/icons/chevron-tiny-down.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-left.vue.js +1 -1
- package/js/components/icons/chevron-tiny-left.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-right.vue.js +1 -1
- package/js/components/icons/chevron-tiny-right.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-up.vue.js +1 -1
- package/js/components/icons/chevron-tiny-up.vue.js.map +1 -1
- package/js/components/icons/chevron-up.vue.js +1 -1
- package/js/components/icons/chevron-up.vue.js.map +1 -1
- package/js/components/icons/corner-arrow-left.vue.js +1 -1
- package/js/components/icons/corner-arrow-left.vue.js.map +1 -1
- package/js/components/icons/corner-arrow-right.vue.js +1 -1
- package/js/components/icons/corner-arrow-right.vue.js.map +1 -1
- package/js/components/icons/cross-tiny.vue.js +1 -1
- package/js/components/icons/cross-tiny.vue.js.map +1 -1
- package/js/components/icons/cross.vue.js +1 -1
- package/js/components/icons/cross.vue.js.map +1 -1
- package/js/components/icons/curated-check-filled.vue.js +1 -1
- package/js/components/icons/curated-check-filled.vue.js.map +1 -1
- package/js/components/icons/curated-check-tiny-filled.vue.js +1 -1
- package/js/components/icons/curated-check-tiny-filled.vue.js.map +1 -1
- package/js/components/icons/curated-check-tiny.vue.js +1 -1
- package/js/components/icons/curated-check-tiny.vue.js.map +1 -1
- package/js/components/icons/curated-check.vue.js +1 -1
- package/js/components/icons/curated-check.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-left-down.vue.js +1 -1
- package/js/components/icons/diagonal-arrow-left-down.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-left-top.vue.js +1 -1
- package/js/components/icons/diagonal-arrow-left-top.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-right-down.vue.js +1 -1
- package/js/components/icons/diagonal-arrow-right-down.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-right-top.vue.js +1 -1
- package/js/components/icons/diagonal-arrow-right-top.vue.js.map +1 -1
- package/js/components/icons/filters.vue.js +1 -1
- package/js/components/icons/filters.vue.js.map +1 -1
- package/js/components/icons/grid-1-col.vue.js +1 -1
- package/js/components/icons/grid-1-col.vue.js.map +1 -1
- package/js/components/icons/grid-2-col.vue.js +1 -1
- package/js/components/icons/grid-2-col.vue.js.map +1 -1
- package/js/components/icons/grid-2-rows.vue.js +1 -1
- package/js/components/icons/grid-2-rows.vue.js.map +1 -1
- package/js/components/icons/grid-4-col.vue.js +1 -1
- package/js/components/icons/grid-4-col.vue.js.map +1 -1
- package/js/components/icons/heart-filled.vue.js +1 -1
- package/js/components/icons/heart-filled.vue.js.map +1 -1
- package/js/components/icons/heart.vue.js +1 -1
- package/js/components/icons/heart.vue.js.map +1 -1
- package/js/components/icons/hide.vue.js +1 -1
- package/js/components/icons/hide.vue.js.map +1 -1
- package/js/components/icons/history-tiny.vue.js +1 -1
- package/js/components/icons/history-tiny.vue.js.map +1 -1
- package/js/components/icons/history.vue.js +1 -1
- package/js/components/icons/history.vue.js.map +1 -1
- package/js/components/icons/light-bulb-off.vue.js +1 -1
- package/js/components/icons/light-bulb-off.vue.js.map +1 -1
- package/js/components/icons/light-bulb-on.vue.js +1 -1
- package/js/components/icons/light-bulb-on.vue.js.map +1 -1
- package/js/components/icons/menu.vue.js +1 -1
- package/js/components/icons/menu.vue.js.map +1 -1
- package/js/components/icons/minus-tiny.vue.js +1 -1
- package/js/components/icons/minus-tiny.vue.js.map +1 -1
- package/js/components/icons/minus.vue.js +1 -1
- package/js/components/icons/minus.vue.js.map +1 -1
- package/js/components/icons/plus-tiny.vue.js +1 -1
- package/js/components/icons/plus-tiny.vue.js.map +1 -1
- package/js/components/icons/plus.vue.js +1 -1
- package/js/components/icons/plus.vue.js.map +1 -1
- package/js/components/icons/radiobutton-selected.vue.js +1 -1
- package/js/components/icons/radiobutton-selected.vue.js.map +1 -1
- package/js/components/icons/radiobutton-unselected.vue.js +1 -1
- package/js/components/icons/radiobutton-unselected.vue.js.map +1 -1
- package/js/components/icons/search-tiny.vue.js +1 -1
- package/js/components/icons/search-tiny.vue.js.map +1 -1
- package/js/components/icons/search.vue.js +1 -1
- package/js/components/icons/search.vue.js.map +1 -1
- package/js/components/icons/settings.vue.js +1 -1
- package/js/components/icons/settings.vue.js.map +1 -1
- package/js/components/icons/show.vue.js +1 -1
- package/js/components/icons/show.vue.js.map +1 -1
- package/js/components/icons/sort-az.vue.js +1 -1
- package/js/components/icons/sort-az.vue.js.map +1 -1
- package/js/components/icons/sort-price-down.vue.js +1 -1
- package/js/components/icons/sort-price-down.vue.js.map +1 -1
- package/js/components/icons/sort-price-up.vue.js +1 -1
- package/js/components/icons/sort-price-up.vue.js.map +1 -1
- package/js/components/icons/sort-relevancy.vue.js +1 -1
- package/js/components/icons/sort-relevancy.vue.js.map +1 -1
- package/js/components/icons/sort-za.vue.js +1 -1
- package/js/components/icons/sort-za.vue.js.map +1 -1
- package/js/components/icons/spinner.vue.js +1 -1
- package/js/components/icons/spinner.vue.js.map +1 -1
- package/js/components/icons/star-filled.vue.js +1 -1
- package/js/components/icons/star-filled.vue.js.map +1 -1
- package/js/components/icons/star.vue.js +1 -1
- package/js/components/icons/star.vue.js.map +1 -1
- package/js/components/icons/tag-filled.vue.js +1 -1
- package/js/components/icons/tag-filled.vue.js.map +1 -1
- package/js/components/icons/tag.vue.js +1 -1
- package/js/components/icons/tag.vue.js.map +1 -1
- package/js/components/icons/trash-open.vue.js +1 -1
- package/js/components/icons/trash-open.vue.js.map +1 -1
- package/js/components/icons/trash.vue.js +1 -1
- package/js/components/icons/trash.vue.js.map +1 -1
- package/js/components/icons/trending-tiny.vue.js +1 -1
- package/js/components/icons/trending-tiny.vue.js.map +1 -1
- package/js/components/icons/trending.vue.js +1 -1
- package/js/components/icons/trending.vue.js.map +1 -1
- package/js/components/icons/user-filled.vue.js +1 -1
- package/js/components/icons/user-filled.vue.js.map +1 -1
- package/js/components/icons/user.vue.js +1 -1
- package/js/components/icons/user.vue.js.map +1 -1
- package/js/components/layouts/multi-column-max-width-layout.vue4.js +1 -1
- package/js/components/layouts/single-column-layout.vue3.js +1 -1
- package/js/components/modals/base-events-modal-close.vue.js +1 -1
- package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-close.vue2.js.map +1 -1
- package/js/components/modals/base-events-modal-open.vue.js +1 -1
- package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-open.vue2.js.map +1 -1
- package/js/components/modals/base-id-modal-close.vue.js +1 -1
- package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-id-modal-close.vue2.js.map +1 -1
- package/js/components/modals/base-id-modal-open.vue.js +1 -1
- package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-id-modal-open.vue2.js.map +1 -1
- package/js/components/page-loader-button.vue.js +1 -1
- package/js/components/page-loader-button.vue.js.map +1 -1
- package/js/components/page-loader-button.vue2.js.map +1 -1
- package/js/components/page-selector.vue.js +3 -3
- package/js/components/page-selector.vue.js.map +1 -1
- package/js/components/page-selector.vue2.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue2.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue.js +1 -1
- package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
- package/js/components/result/base-result-image.vue.js +3 -3
- package/js/components/result/base-result-image.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue2.js.map +1 -1
- package/js/components/scroll/base-scroll.vue.js +1 -1
- package/js/components/scroll/base-scroll.vue.js.map +1 -1
- package/js/components/scroll/base-scroll.vue2.js.map +1 -1
- package/js/components/sliding-panel.vue.js +4 -4
- package/js/components/sliding-panel.vue.js.map +1 -1
- package/js/components/sliding-panel.vue2.js +2 -2
- package/js/components/sliding-panel.vue2.js.map +1 -1
- package/js/components/sliding-panel.vue3.js +1 -1
- package/js/index.js +1 -1
- package/js/x-bus/x-bus.js +1 -3
- package/js/x-bus/x-bus.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue.js +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue3.js +1 -1
- package/js/x-modules/ai/components/ai-overview.vue.js +120 -173
- package/js/x-modules/ai/components/ai-overview.vue.js.map +1 -1
- package/js/x-modules/ai/components/ai-overview.vue2.js +2 -38
- package/js/x-modules/ai/components/ai-overview.vue2.js.map +1 -1
- package/js/x-modules/ai/components/ai-overview.vue3.js +1 -1
- package/js/x-modules/ai/wiring.js +2 -6
- package/js/x-modules/ai/wiring.js.map +1 -1
- package/js/x-modules/facets/components/clear-filters.vue.js +1 -1
- package/js/x-modules/facets/components/clear-filters.vue.js.map +1 -1
- package/js/x-modules/facets/components/clear-filters.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue2.js +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +4 -4
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/renderless-filter.vue.js +2 -2
- package/js/x-modules/facets/components/filters/renderless-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue.js +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue2.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue.js +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.map +1 -1
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js +2 -2
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/sliced-filters.vue2.js.map +1 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js +1 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue2.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue2.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue.js +2 -2
- package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue2.js.map +1 -1
- package/js/x-modules/history-queries/components/my-history.vue.js +1 -1
- package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/my-history.vue2.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue2.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue.js +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
- 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.vue3.js +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.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue3.js +1 -1
- package/js/x-modules/related-tags/components/related-tag.vue.js +1 -1
- package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tag.vue2.js +1 -1
- package/js/x-modules/related-tags/components/related-tag.vue2.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/search/components/partial-query-button.vue.js +1 -1
- package/js/x-modules/search/components/partial-query-button.vue.js.map +1 -1
- package/js/x-modules/search/components/partial-query-button.vue2.js.map +1 -1
- package/js/x-modules/search/components/sort-list.vue.js +1 -1
- package/js/x-modules/search/components/sort-list.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-list.vue2.js.map +1 -1
- package/js/x-modules/search/components/sort-picker-list.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-picker-list.vue2.js +1 -1
- package/js/x-modules/search/components/sort-picker-list.vue2.js.map +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue2.js.map +1 -1
- package/js/x-modules/search-box/components/search-button.vue.js +2 -2
- package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-button.vue2.js.map +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue.js +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue2.js.map +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue4.js +1 -1
- package/js/x-modules/search-box/components/search-input.vue.js +1 -1
- package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input.vue2.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +2 -22
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +6 -9
- package/report/x-components.api.json +7 -89
- package/report/x-components.api.md +5 -35
- package/tagging/index.js +1 -1
- package/types/demo/main.d.ts +1 -1
- package/types/demo/main.d.ts.map +1 -1
- package/types/demo/views/base-config.d.ts.map +1 -1
- package/types/demo/views/home/types.d.ts +0 -3
- package/types/demo/views/home/types.d.ts.map +1 -1
- package/types/demo/vite.config.d.ts.map +1 -1
- package/types/src/components/base-grid.types.d.ts.map +1 -1
- package/types/src/components/column-picker/base-column-picker-list.vue.d.ts +8 -1
- package/types/src/components/column-picker/base-column-picker-list.vue.d.ts.map +1 -1
- package/types/src/components/highlight.vue.d.ts +1 -1
- package/types/src/components/sliding-panel.vue.d.ts +2 -2
- package/types/src/index.d.ts +0 -1
- package/types/src/index.d.ts.map +1 -1
- package/types/src/x-bus/x-bus.d.ts.map +1 -1
- package/types/src/x-modules/ai/components/ai-overview.vue.d.ts +0 -21
- package/types/src/x-modules/ai/components/ai-overview.vue.d.ts.map +1 -1
- package/types/src/x-modules/ai/wiring.d.ts +0 -3
- package/types/src/x-modules/ai/wiring.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/all-filter.vue.d.ts +1 -1
- package/types/src/x-modules/tagging/wiring.d.ts +0 -9
- package/types/src/x-modules/tagging/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.trackaioverviewbuttonclickedwire.md +0 -13
- package/types/demo/views/adapter.d.ts +0 -3
- package/types/demo/views/adapter.d.ts.map +0 -1
- package/types/src/components/column-picker/base-column-picker-list.types.d.ts +0 -9
- package/types/src/components/column-picker/base-column-picker-list.types.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input-placeholder.vue.js","sources":["../../../../../src/x-modules/search-box/components/search-input-placeholder.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"isVisible\"\n class=\"x-input-placeholder
|
|
1
|
+
{"version":3,"file":"search-input-placeholder.vue.js","sources":["../../../../../src/x-modules/search-box/components/search-input-placeholder.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"isVisible\"\n class=\"x-search-input-placeholder xds:input-placeholder\"\n mode=\"out-in\"\n >\n <span :key=\"message\" data-test=\"search-input-placeholder\">\n {{ message }}\n </span>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h, onBeforeUnmount, ref, watch } from 'vue'\nimport AnimateTranslate from '../../../components/animations/animate-translate.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types'\nimport { searchBoxXModule } from '../x-module'\n\n/**.\n * This component renders an animated placeholder for the search input in the shape of a list of\n * iterating messages that can be configured to happen always or only when hovering the input\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInputPlaceholder',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * List of messages to animate.\n *\n * @public\n */\n messages: {\n type: Array as PropType<string[]>,\n required: true,\n },\n /**\n * Animation component used for the messages.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: () => h(AnimateTranslate, { animationOrigin: 'bottom-to-top' }),\n },\n /**\n * Time in milliseconds during which each message is visible.\n *\n * @public\n */\n animationIntervalMs: {\n type: Number,\n default: 1500,\n },\n /**\n * Whether the messages animation is active only when hovering the search input or always.\n *\n * @public\n */\n animateOnlyOnHover: Boolean,\n },\n setup(props) {\n const $x = use$x()\n\n /**.\n * The search box written query\n *\n * @internal\n */\n const { query } = useState('searchBox')\n\n /**.\n * The search box hover status\n *\n * @internal\n */\n const isSearchBoxHovered = ref(false)\n\n /**.\n * The search box focus status\n *\n * @internal\n */\n const isSearchBoxFocused = ref(false)\n\n /**\n * The index used to point to the current animation message in the list.\n *\n * @internal\n */\n const animationMessageIndex = ref(0)\n\n /**\n * The interval used for the animation.\n *\n * @internal\n */\n const animationInterval = ref<number | undefined>(undefined)\n\n /**\n * The visibility state of the component.\n *\n * @returns The visibility state based on the search input state (query & focus).\n *\n * @internal\n */\n const isVisible = computed((): boolean => !query.value && !isSearchBoxFocused.value)\n\n /**\n * The animation state of the component.\n *\n * @returns Whether the animation is active or not.\n *\n * @internal\n */\n const isBeingAnimated = computed(\n (): boolean => isVisible.value && (!props.animateOnlyOnHover || isSearchBoxHovered.value),\n )\n\n /**\n * The current placeholder message.\n *\n * @returns The message to display as placeholder at any moment.\n *\n * @internal\n */\n const message = computed((): string | undefined =>\n isBeingAnimated.value ? props.messages[animationMessageIndex.value] : props.messages[0],\n )\n\n /**\n * Clears the interval used for the animation.\n *\n * @internal\n */\n const stopAnimationInterval = (): void => {\n if (animationInterval.value) {\n clearInterval(animationInterval.value)\n animationInterval.value = undefined\n }\n }\n\n /**\n * Increments animation message index; if the new index exceeds the messages list length, it is\n * reset to 0.\n *\n * @internal\n */\n const incrementAnimationMessageIndex = (): void => {\n animationMessageIndex.value = (animationMessageIndex.value + 1) % props.messages.length\n }\n\n $x.on('UserHoveredInSearchBox', false).subscribe(() => (isSearchBoxHovered.value = true))\n\n $x.on('UserHoveredOutSearchBox', false).subscribe(() => (isSearchBoxHovered.value = false))\n\n $x.on('UserFocusedSearchBox', false).subscribe(() => (isSearchBoxFocused.value = true))\n\n $x.on('UserBlurredSearchBox', false).subscribe(() => (isSearchBoxFocused.value = false))\n\n /**\n * Starts or stops the animation depending on the current animation state.\n *\n * @internal\n */\n const resetAnimation = (): void => {\n stopAnimationInterval()\n if (isBeingAnimated.value) {\n animationInterval.value = window.setInterval((): void => {\n incrementAnimationMessageIndex()\n }, props.animationIntervalMs)\n }\n }\n\n watch(() => 'animationIntervalMs', resetAnimation)\n\n /**\n * Resets the animation message index to zero.\n *\n * @internal\n */\n const resetAnimationMessageIndex = (): void => {\n animationMessageIndex.value = 0\n }\n\n watch(\n () => props.messages,\n () => {\n resetAnimationMessageIndex()\n resetAnimation()\n },\n { deep: true },\n )\n\n /**\n * Sets the animation message index with the right value for the next future iteration when the\n * current one stops,assuring the user will see always a new message on each animation state\n * change.\n *\n * @internal\n */\n watch(\n isBeingAnimated,\n () => {\n if (!isBeingAnimated.value) {\n if (props.animateOnlyOnHover) {\n resetAnimationMessageIndex()\n }\n incrementAnimationMessageIndex()\n }\n resetAnimation()\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => {\n stopAnimationInterval()\n })\n\n return {\n isVisible,\n message,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-search-input-placeholder-container {\n position: relative;\n}\n</style>\n\n<style lang=\"css\" scoped>\n.x-search-input-placeholder {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n pointer-events: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere a basic example of how the animated search input placeholder is rendered.\n\n```vue live\n<template>\n <div style=\"position: relative; overflow: hidden;\">\n <SearchInputPlaceholder\n style=\"position: absolute; height: 100%; pointer-events: none;\"\n :messages=\"placeholderMessages\"\n />\n <SearchInput />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, SearchInputPlaceholder } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst placeholderMessages = ref([\n 'Find shirts',\n 'Find shoes',\n 'Find watches',\n 'Find handbags',\n 'Find sunglasses',\n])\n</script>\n```\n\n### Animating only on hover\n\nIn this example, the placeholder is configured to animate only when the user hovers in the search\ninput, showing the first message of the array the rest of the time.\n\n```vue live\n<template>\n <div style=\"position: relative; overflow: hidden;\">\n <SearchInputPlaceholder\n style=\"position: absolute; height: 100%; pointer-events: none;\"\n :messages=\"placeholderMessages\"\n :animate-only-on-hover=\"true\"\n />\n <SearchInput />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, SearchInputPlaceholder } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst placeholderMessages = ref([\n 'Find shirts',\n 'Find shoes',\n 'Find watches',\n 'Find handbags',\n 'Find sunglasses',\n])\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock"],"mappings":";;;;;;;SAGU,IAAA,CAAA,SAAA,IAAAA,SAAA,EAAA,EAFRC,WAAA,CASYC,wBARL,IAAA,CAAA,SAAS,CAAA,EAAA;AAAA,IAAA,GAAA,EAAA,CAAA;IAEd,KAAA,EAAM,kDAAA;AAAA,IACN,IAAA,EAAK;AAAA,GAAA,EAAA;qBAEL,MAEO;AAAA,OAAAF,SAAA,EAAA,EAFPG,kBAAA;AAAA,QAEO,MAAA;AAAA,QAAA;AAAA,UAFA,GAAA,EAAK,IAAA,CAAA,OAAA;AAAA,UAAS,WAAA,EAAU;AAAA,SAAA;wBAC1B,IAAA,CAAA,OAAO,CAAA;AAAA,QAAA;AAAA;AAAA,OAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input-placeholder.vue2.js","sources":["../../../../../src/x-modules/search-box/components/search-input-placeholder.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"isVisible\"\n class=\"x-input-placeholder x-search-input-placeholder\"\n mode=\"out-in\"\n >\n <span :key=\"message\" data-test=\"search-input-placeholder\">\n {{ message }}\n </span>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h, onBeforeUnmount, ref, watch } from 'vue'\nimport AnimateTranslate from '../../../components/animations/animate-translate.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types'\nimport { searchBoxXModule } from '../x-module'\n\n/**.\n * This component renders an animated placeholder for the search input in the shape of a list of\n * iterating messages that can be configured to happen always or only when hovering the input\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInputPlaceholder',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * List of messages to animate.\n *\n * @public\n */\n messages: {\n type: Array as PropType<string[]>,\n required: true,\n },\n /**\n * Animation component used for the messages.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: () => h(AnimateTranslate, { animationOrigin: 'bottom-to-top' }),\n },\n /**\n * Time in milliseconds during which each message is visible.\n *\n * @public\n */\n animationIntervalMs: {\n type: Number,\n default: 1500,\n },\n /**\n * Whether the messages animation is active only when hovering the search input or always.\n *\n * @public\n */\n animateOnlyOnHover: Boolean,\n },\n setup(props) {\n const $x = use$x()\n\n /**.\n * The search box written query\n *\n * @internal\n */\n const { query } = useState('searchBox')\n\n /**.\n * The search box hover status\n *\n * @internal\n */\n const isSearchBoxHovered = ref(false)\n\n /**.\n * The search box focus status\n *\n * @internal\n */\n const isSearchBoxFocused = ref(false)\n\n /**\n * The index used to point to the current animation message in the list.\n *\n * @internal\n */\n const animationMessageIndex = ref(0)\n\n /**\n * The interval used for the animation.\n *\n * @internal\n */\n const animationInterval = ref<number | undefined>(undefined)\n\n /**\n * The visibility state of the component.\n *\n * @returns The visibility state based on the search input state (query & focus).\n *\n * @internal\n */\n const isVisible = computed((): boolean => !query.value && !isSearchBoxFocused.value)\n\n /**\n * The animation state of the component.\n *\n * @returns Whether the animation is active or not.\n *\n * @internal\n */\n const isBeingAnimated = computed(\n (): boolean => isVisible.value && (!props.animateOnlyOnHover || isSearchBoxHovered.value),\n )\n\n /**\n * The current placeholder message.\n *\n * @returns The message to display as placeholder at any moment.\n *\n * @internal\n */\n const message = computed((): string | undefined =>\n isBeingAnimated.value ? props.messages[animationMessageIndex.value] : props.messages[0],\n )\n\n /**\n * Clears the interval used for the animation.\n *\n * @internal\n */\n const stopAnimationInterval = (): void => {\n if (animationInterval.value) {\n clearInterval(animationInterval.value)\n animationInterval.value = undefined\n }\n }\n\n /**\n * Increments animation message index; if the new index exceeds the messages list length, it is\n * reset to 0.\n *\n * @internal\n */\n const incrementAnimationMessageIndex = (): void => {\n animationMessageIndex.value = (animationMessageIndex.value + 1) % props.messages.length\n }\n\n $x.on('UserHoveredInSearchBox', false).subscribe(() => (isSearchBoxHovered.value = true))\n\n $x.on('UserHoveredOutSearchBox', false).subscribe(() => (isSearchBoxHovered.value = false))\n\n $x.on('UserFocusedSearchBox', false).subscribe(() => (isSearchBoxFocused.value = true))\n\n $x.on('UserBlurredSearchBox', false).subscribe(() => (isSearchBoxFocused.value = false))\n\n /**\n * Starts or stops the animation depending on the current animation state.\n *\n * @internal\n */\n const resetAnimation = (): void => {\n stopAnimationInterval()\n if (isBeingAnimated.value) {\n animationInterval.value = window.setInterval((): void => {\n incrementAnimationMessageIndex()\n }, props.animationIntervalMs)\n }\n }\n\n watch(() => 'animationIntervalMs', resetAnimation)\n\n /**\n * Resets the animation message index to zero.\n *\n * @internal\n */\n const resetAnimationMessageIndex = (): void => {\n animationMessageIndex.value = 0\n }\n\n watch(\n () => props.messages,\n () => {\n resetAnimationMessageIndex()\n resetAnimation()\n },\n { deep: true },\n )\n\n /**\n * Sets the animation message index with the right value for the next future iteration when the\n * current one stops,assuring the user will see always a new message on each animation state\n * change.\n *\n * @internal\n */\n watch(\n isBeingAnimated,\n () => {\n if (!isBeingAnimated.value) {\n if (props.animateOnlyOnHover) {\n resetAnimationMessageIndex()\n }\n incrementAnimationMessageIndex()\n }\n resetAnimation()\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => {\n stopAnimationInterval()\n })\n\n return {\n isVisible,\n message,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-search-input-placeholder-container {\n position: relative;\n}\n</style>\n\n<style lang=\"css\" scoped>\n.x-search-input-placeholder {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n pointer-events: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere a basic example of how the animated search input placeholder is rendered.\n\n```vue live\n<template>\n <div style=\"position: relative; overflow: hidden;\">\n <SearchInputPlaceholder\n style=\"position: absolute; height: 100%; pointer-events: none;\"\n :messages=\"placeholderMessages\"\n />\n <SearchInput />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, SearchInputPlaceholder } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst placeholderMessages = ref([\n 'Find shirts',\n 'Find shoes',\n 'Find watches',\n 'Find handbags',\n 'Find sunglasses',\n])\n</script>\n```\n\n### Animating only on hover\n\nIn this example, the placeholder is configured to animate only when the user hovers in the search\ninput, showing the first message of the array the rest of the time.\n\n```vue live\n<template>\n <div style=\"position: relative; overflow: hidden;\">\n <SearchInputPlaceholder\n style=\"position: absolute; height: 100%; pointer-events: none;\"\n :messages=\"placeholderMessages\"\n :animate-only-on-hover=\"true\"\n />\n <SearchInput />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, SearchInputPlaceholder } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst placeholderMessages = ref([\n 'Find shirts',\n 'Find shoes',\n 'Find watches',\n 'Find handbags',\n 'Find sunglasses',\n])\n</script>\n```\n</docs>\n"],"names":["AnimateTranslate"],"mappings":";;;;;;;;AAsBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC9B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,KAA2B;AACjC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAM,CAAC,CAACA,WAAgB,EAAE,EAAE,eAAe,EAAE,eAAc,EAAG,CAAC;AACzE,SAAA;AACD;;;;AAIE;AACF,QAAA,mBAAmB,EAAE;AACnB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;;AAIE;AACF,QAAA,kBAAkB,EAAE,OAAO;AAC5B,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;QACF,MAAM,EAAE,KAAI,EAAE,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A8B,EAAC;YACjC;AACA,YAAA,cAAc,EAAC;AACjB,QAAA,CAAC,EACD,EAAE,SAAS,EAAE,MAAM,CACrB;QAEA,eAAe,CAAC,MAAI;AAClB,YAAA,qBAAqB,EAAC;AACxB,QAAA,CAAC,CAAA;QAED,OAAO;YACL,SAAS;YACT,OAAO;SACT;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"search-input-placeholder.vue2.js","sources":["../../../../../src/x-modules/search-box/components/search-input-placeholder.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"isVisible\"\n class=\"x-search-input-placeholder xds:input-placeholder\"\n mode=\"out-in\"\n >\n <span :key=\"message\" data-test=\"search-input-placeholder\">\n {{ message }}\n </span>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, h, onBeforeUnmount, ref, watch } from 'vue'\nimport AnimateTranslate from '../../../components/animations/animate-translate.vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { AnimationProp } from '../../../types'\nimport { searchBoxXModule } from '../x-module'\n\n/**.\n * This component renders an animated placeholder for the search input in the shape of a list of\n * iterating messages that can be configured to happen always or only when hovering the input\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInputPlaceholder',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * List of messages to animate.\n *\n * @public\n */\n messages: {\n type: Array as PropType<string[]>,\n required: true,\n },\n /**\n * Animation component used for the messages.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: () => h(AnimateTranslate, { animationOrigin: 'bottom-to-top' }),\n },\n /**\n * Time in milliseconds during which each message is visible.\n *\n * @public\n */\n animationIntervalMs: {\n type: Number,\n default: 1500,\n },\n /**\n * Whether the messages animation is active only when hovering the search input or always.\n *\n * @public\n */\n animateOnlyOnHover: Boolean,\n },\n setup(props) {\n const $x = use$x()\n\n /**.\n * The search box written query\n *\n * @internal\n */\n const { query } = useState('searchBox')\n\n /**.\n * The search box hover status\n *\n * @internal\n */\n const isSearchBoxHovered = ref(false)\n\n /**.\n * The search box focus status\n *\n * @internal\n */\n const isSearchBoxFocused = ref(false)\n\n /**\n * The index used to point to the current animation message in the list.\n *\n * @internal\n */\n const animationMessageIndex = ref(0)\n\n /**\n * The interval used for the animation.\n *\n * @internal\n */\n const animationInterval = ref<number | undefined>(undefined)\n\n /**\n * The visibility state of the component.\n *\n * @returns The visibility state based on the search input state (query & focus).\n *\n * @internal\n */\n const isVisible = computed((): boolean => !query.value && !isSearchBoxFocused.value)\n\n /**\n * The animation state of the component.\n *\n * @returns Whether the animation is active or not.\n *\n * @internal\n */\n const isBeingAnimated = computed(\n (): boolean => isVisible.value && (!props.animateOnlyOnHover || isSearchBoxHovered.value),\n )\n\n /**\n * The current placeholder message.\n *\n * @returns The message to display as placeholder at any moment.\n *\n * @internal\n */\n const message = computed((): string | undefined =>\n isBeingAnimated.value ? props.messages[animationMessageIndex.value] : props.messages[0],\n )\n\n /**\n * Clears the interval used for the animation.\n *\n * @internal\n */\n const stopAnimationInterval = (): void => {\n if (animationInterval.value) {\n clearInterval(animationInterval.value)\n animationInterval.value = undefined\n }\n }\n\n /**\n * Increments animation message index; if the new index exceeds the messages list length, it is\n * reset to 0.\n *\n * @internal\n */\n const incrementAnimationMessageIndex = (): void => {\n animationMessageIndex.value = (animationMessageIndex.value + 1) % props.messages.length\n }\n\n $x.on('UserHoveredInSearchBox', false).subscribe(() => (isSearchBoxHovered.value = true))\n\n $x.on('UserHoveredOutSearchBox', false).subscribe(() => (isSearchBoxHovered.value = false))\n\n $x.on('UserFocusedSearchBox', false).subscribe(() => (isSearchBoxFocused.value = true))\n\n $x.on('UserBlurredSearchBox', false).subscribe(() => (isSearchBoxFocused.value = false))\n\n /**\n * Starts or stops the animation depending on the current animation state.\n *\n * @internal\n */\n const resetAnimation = (): void => {\n stopAnimationInterval()\n if (isBeingAnimated.value) {\n animationInterval.value = window.setInterval((): void => {\n incrementAnimationMessageIndex()\n }, props.animationIntervalMs)\n }\n }\n\n watch(() => 'animationIntervalMs', resetAnimation)\n\n /**\n * Resets the animation message index to zero.\n *\n * @internal\n */\n const resetAnimationMessageIndex = (): void => {\n animationMessageIndex.value = 0\n }\n\n watch(\n () => props.messages,\n () => {\n resetAnimationMessageIndex()\n resetAnimation()\n },\n { deep: true },\n )\n\n /**\n * Sets the animation message index with the right value for the next future iteration when the\n * current one stops,assuring the user will see always a new message on each animation state\n * change.\n *\n * @internal\n */\n watch(\n isBeingAnimated,\n () => {\n if (!isBeingAnimated.value) {\n if (props.animateOnlyOnHover) {\n resetAnimationMessageIndex()\n }\n incrementAnimationMessageIndex()\n }\n resetAnimation()\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => {\n stopAnimationInterval()\n })\n\n return {\n isVisible,\n message,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-search-input-placeholder-container {\n position: relative;\n}\n</style>\n\n<style lang=\"css\" scoped>\n.x-search-input-placeholder {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n pointer-events: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere a basic example of how the animated search input placeholder is rendered.\n\n```vue live\n<template>\n <div style=\"position: relative; overflow: hidden;\">\n <SearchInputPlaceholder\n style=\"position: absolute; height: 100%; pointer-events: none;\"\n :messages=\"placeholderMessages\"\n />\n <SearchInput />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, SearchInputPlaceholder } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst placeholderMessages = ref([\n 'Find shirts',\n 'Find shoes',\n 'Find watches',\n 'Find handbags',\n 'Find sunglasses',\n])\n</script>\n```\n\n### Animating only on hover\n\nIn this example, the placeholder is configured to animate only when the user hovers in the search\ninput, showing the first message of the array the rest of the time.\n\n```vue live\n<template>\n <div style=\"position: relative; overflow: hidden;\">\n <SearchInputPlaceholder\n style=\"position: absolute; height: 100%; pointer-events: none;\"\n :messages=\"placeholderMessages\"\n :animate-only-on-hover=\"true\"\n />\n <SearchInput />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, SearchInputPlaceholder } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst placeholderMessages = ref([\n 'Find shirts',\n 'Find shoes',\n 'Find watches',\n 'Find handbags',\n 'Find sunglasses',\n])\n</script>\n```\n</docs>\n"],"names":["AnimateTranslate"],"mappings":";;;;;;;;AAsBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC9B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,KAA2B;AACjC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAM,CAAC,CAACA,WAAgB,EAAE,EAAE,eAAe,EAAE,eAAc,EAAG,CAAC;AACzE,SAAA;AACD;;;;AAIE;AACF,QAAA,mBAAmB,EAAE;AACnB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;;AAIE;AACF,QAAA,kBAAkB,EAAE,OAAO;AAC5B,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;QACF,MAAM,EAAE,KAAI,EAAE,GAAI,QAAQ,CAAC,WAAW,CAAA;AAEtC;;;;AAIE;AACF,QAAA,MAAM,qBAAqB,GAAG,CAAC,KAAK,CAAA;AAEpC;;;;AAIE;AACF,QAAA,MAAM,qBAAqB,GAAG,CAAC,KAAK,CAAA;AAEpC;;;;AAIE;AACF,QAAA,MAAM,qBAAoB,GAAI,GAAG,CAAC,CAAC,CAAA;AAEnC;;;;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 -1,6 +1,6 @@
|
|
|
1
1
|
import injectCss from '../../../../tools/inject-css.js';
|
|
2
2
|
|
|
3
|
-
var css = ".x-search-input-placeholder[data-v-db4f79d1]{align-items:center;
|
|
3
|
+
var css = ".x-search-input-placeholder[data-v-db4f79d1]{align-items:center;display:flex;inset:0;pointer-events:none;position:absolute}";
|
|
4
4
|
injectCss(css);
|
|
5
5
|
|
|
6
6
|
export { css };
|
|
@@ -10,7 +10,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
10
10
|
maxlength: _ctx.maxLength,
|
|
11
11
|
value: _ctx.query,
|
|
12
12
|
autocomplete: "off",
|
|
13
|
-
class: "x-search-input
|
|
13
|
+
class: "x-search-input xds:input",
|
|
14
14
|
enterkeyhint: "search",
|
|
15
15
|
inputmode: "search",
|
|
16
16
|
type: "search",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input.vue.js","sources":["../../../../../src/x-modules/search-box/components/search-input.vue"],"sourcesContent":["<template>\n <input\n ref=\"inputElement\"\n :maxlength=\"maxLength\"\n :value=\"query\"\n autocomplete=\"off\"\n class=\"x-search-input x-input\"\n enterkeyhint=\"search\"\n inputmode=\"search\"\n type=\"search\"\n data-test=\"search-input\"\n aria-label=\"type your query here\"\n @mouseenter=\"emitUserHoveredInSearchBox\"\n @mouseleave=\"emitUserHoveredOutSearchBox\"\n @blur=\"emitUserBlurredSearchBox\"\n @click=\"emitUserClickedSearchBox\"\n @focus=\"emitUserFocusedSearchBox\"\n @input=\"emitUserIsTypingAQueryEvents\"\n @keydown.enter=\"emitUserPressedEnterKey\"\n @keydown.up.down.prevent=\"emitUserPressedArrowKey\"\n @beforeinput=\"preventSpecialKey\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { ArrowKey } from '../../../utils'\nimport type { DebouncedFunction } from '../../../utils/types'\nimport type { XEvent } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { defineComponent, onMounted, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { debounce } from '../../../utils/debounce'\nimport { searchBoxXModule } from '../x-module'\n\n/**\n * This component renders an input field that allows the user to type a query. It also reacts to\n * query changes through event listening.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInput',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * Maximum characters allowed in the input search.\n */\n maxLength: {\n type: Number,\n default: 64,\n },\n /**\n * Allows input autofocus when the search field is rendered.\n */\n autofocus: {\n type: Boolean,\n default: true,\n },\n /**\n * Enables the auto-accept query after debounce.\n */\n instant: {\n type: Boolean,\n default: true,\n },\n /**\n * Debounce time for the instant.\n */\n instantDebounceInMs: {\n type: Number,\n default: 500,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const { query } = useState('searchBox')\n\n const inputElement = ref<HTMLInputElement>()\n\n let debouncedUserAcceptedAQuery: DebouncedFunction<[string]>\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => {\n return {\n target: inputElement.value,\n feature: 'search_box',\n }\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event.\n *\n * @remarks It is necessary in a separated method to use it as the parameter of debounce in\n * emitDebouncedUserAcceptedAQuery method.\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitUserAcceptedAQuery = (query: string): void => {\n $x.emit('UserAcceptedAQuery', query, createEventMetadata())\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event with a debounce configured in\n * `instantDebounceInMs` prop.\n *\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitDebouncedUserAcceptedAQuery = (query: string): void => {\n if (props.instant) {\n if (!debouncedUserAcceptedAQuery) {\n debouncedUserAcceptedAQuery = debounce(emitUserAcceptedAQuery, props.instantDebounceInMs)\n }\n debouncedUserAcceptedAQuery(query)\n }\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredInSearchBox} when search box is hovered in.\n *\n * @internal\n */\n const emitUserHoveredInSearchBox = (): void => {\n $x.emit('UserHoveredInSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredOutSearchBox} when search box is hovered out.\n *\n * @internal\n */\n const emitUserHoveredOutSearchBox = (): void => {\n $x.emit('UserHoveredOutSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserBlurredSearchBox} when search box loses focus.\n *\n * @internal\n */\n const emitUserBlurredSearchBox = (): void => {\n $x.emit('UserBlurredSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserClickedSearchBox} when user clicks the search input.\n *\n * @internal\n */\n const emitUserClickedSearchBox = (): void => {\n $x.emit('UserClickedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserFocusedSearchBox} when search box gains focus.\n *\n * @internal\n */\n const emitUserFocusedSearchBox = (): void => {\n $x.emit('UserFocusedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserIsTypingAQuery} when the user typed/pasted something\n * into the search-box. Also emits event {@link SearchBoxXEvents.UserClearedQuery} when the user\n * removes all characters in the search-box.\n *\n * @internal\n */\n const emitUserIsTypingAQueryEvents = (): void => {\n const query = inputElement.value?.value ?? ''\n\n $x.emit('UserIsTypingAQuery', query, { target: inputElement.value })\n if (query.trim()) {\n emitDebouncedUserAcceptedAQuery(query)\n } else {\n cancelDebouncedUserAcceptedAQuery()\n }\n }\n\n /**\n * Emits event {@link XEventsTypes.UserPressedArrowKey} when the user pressed an arrow key.\n *\n * @param event - The keyboard event with the arrow key pressed.\n * @internal\n */\n const emitUserPressedArrowKey = (event: KeyboardEvent): void => {\n $x.emit('UserPressedArrowKey', event.key as ArrowKey, createEventMetadata())\n }\n\n /**\n * Emits multiple events when the user pressed the enter key.\n *\n * @remarks\n * Emitted events are:\n * {@link SearchBoxXEvents.UserPressedEnterKey}\n * {@link XEventsTypes.UserAcceptedAQuery}\n *\n * @internal\n */\n const emitUserPressedEnterKey = (): void => {\n const query = inputElement.value?.value.trim()\n if (!!query && query.length > 0) {\n $x.emit('UserPressedEnterKey', query, createEventMetadata())\n emitUserAcceptedAQuery(query)\n }\n inputElement.value?.blur()\n }\n\n /**\n * Prevents the user from either typing or pasting special characters in the input field.\n *\n * @internal\n * @param event - The event that will be checked for special characters.\n */\n const preventSpecialKey = (event: InputEvent): void => {\n if (/[<>]/.test(event.data ?? '')) {\n event.preventDefault()\n }\n }\n\n /**\n * When event {@link XEventsTypes.UserReachedEmpathizeTop} or\n * {@link SearchBoxXEvents.UserPressedClearSearchBoxButton}\n * are emitted the search input is focused.\n *\n * @internal\n */\n function focusInput(): void {\n inputElement.value?.focus()\n }\n ;['UserReachedEmpathizeTop', 'UserPressedClearSearchBoxButton'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(focusInput),\n )\n\n /**\n * When event {@link XEventsTypes.UserAcceptedAQuery} or\n * {@link SearchBoxXEvents.UserClearedQuery} are emitted the pending debounced emit\n * {@link XEvent} `UserAcceptedAQuery` is canceled.\n *\n * @internal\n */\n function cancelDebouncedUserAcceptedAQuery(): void {\n debouncedUserAcceptedAQuery?.cancel()\n }\n ;['UserAcceptedAQuery', 'UserClearedQuery'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(cancelDebouncedUserAcceptedAQuery),\n )\n\n onMounted(() => {\n if (props.autofocus) {\n focusInput()\n }\n })\n\n return {\n query,\n inputElement,\n emitUserHoveredInSearchBox,\n emitUserHoveredOutSearchBox,\n emitUserBlurredSearchBox,\n emitUserClickedSearchBox,\n emitUserFocusedSearchBox,\n emitUserIsTypingAQueryEvents,\n emitUserPressedEnterKey,\n emitUserPressedArrowKey,\n preventSpecialKey,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-search-input::-webkit-search-decoration,\n.x-search-input::-webkit-search-cancel-button,\n.x-search-input::-webkit-search-results-button,\n.x-search-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserBlurredSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserFocusedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserIsTypingAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedEnterKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedArrowKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserAcceptedAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Search service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example of how the search input is rendered.\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, the search input has been limited to accept a maximum of 5 characters, including\nspaces, it won't take the focus when it is rendered, and it will emit the `UserAcceptedAQuery` event\nafter 1000 milliseconds without typing.\n\n_Type a term with more than 5 characters to try it out!_\n\n```vue live\n<template>\n <SearchInput :maxLength=\"5\" :autofocus=\"false\" :instant=\"true\" :instantDebounceInMs=\"1000\" />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added below the search input to illustrate the action performed.\nFor example, if you select the search input box, the message “focus” appears. When you start to\nenter a search term, the message “typing” appears. If you press Enter after typing a search term,\nthe message “enter” appears.\n\n<!-- prettier-ignore-start -->\n:::warning X Events are only emitted from the root X Component.\nAt the moment, X Events are only emitted from the root X Component. This means that if you wrap\nthe `SearchInput` with another component of another module like the `MainScroll`, you should add\nthe listeners to the `MainScroll` instead of the `SearchInput`. If you need to subscribe to these\nevents, it is recommended to use the [`GlobalXBus`](../common/x-components.global-x-bus.md)\ncomponent instead.\n:::\n<!-- prettier-ignore-end -->\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput\n @UserPressedEnterKey=\"value = 'enter'\"\n @UserFocusedSearchBox=\"hasFocus = true\"\n @UserBlurredSearchBox=\"hasFocus = false\"\n @UserIsTypingAQuery=\"value = 'typing'\"\n />\n <strong>{{ value }}</strong>\n <span>{{ hasFocus ? 'focused' : 'unfocused' }}</span>\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst value = ref('')\nconst hasFocus = ref(false)\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `SearchInput` component\ncommunicates with the [`SearchButton`](x-components.search-button.md) and the\n[`ClearSearchInput`](x-components.clear-search-input.md) to offer a full query entry experience.\nFurthermore, you can use it together with the [`QuerySuggestions`](query-suggestions.md) component\nto autocomplete the typed search term.\n\n_Type “trousers” or another fashion term in the input field and then click the clear icon to try it\nout!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex; flex-flow: row nowrap;\">\n <SearchInput />\n <ClearSearchInput>\n <img src=\"/assets/icons/cross.svg\" />\n </ClearSearchInput>\n <SearchButton>Search</SearchButton>\n </div>\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, ClearSearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n</script>\n```\n</docs>\n"],"names":["_createElementBlock","_withKeys","_withModifiers"],"mappings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AA,CAAA;AAAA,IACP,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,4BAAA,IAAA,IAAA,CAAA,4BAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,IACP,SAAA,EAAO;AAAA,MAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,QAAA,CAAA,CAAA,GAAA,IAAA,KAAQ,IAAA,CAAA,uBAAA,IAAA,IAAA,CAAA,uBAAA,CAAA,GAAA,IAAA,CAAA,EAAuB,CAAA,OAAA,CAAA,CAAA,CAAA;AAAA,MAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAA,QAAA,CAAAC,aAAA,CAAA,CAAA,GAAA,IAAA,KACb,IAAA,CAAA,uBAAA,IAAA,IAAA,CAAA,uBAAA,CAAA,GAAA,IAAA,CAAA,EAAuB,CAAA,SAAA,CAAA,CAAA,EAAA,CAAA,IAAA,EAAA,MAAA,CAAA,CAAA;AAAA,KAAA;AAChD,IAAA,aAAA,EAAW,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,iBAAA,IAAA,IAAA,CAAA,iBAAA,CAAA,GAAA,IAAA,CAAA;AAAA,GAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"search-input.vue.js","sources":["../../../../../src/x-modules/search-box/components/search-input.vue"],"sourcesContent":["<template>\n <input\n ref=\"inputElement\"\n :maxlength=\"maxLength\"\n :value=\"query\"\n autocomplete=\"off\"\n class=\"x-search-input xds:input\"\n enterkeyhint=\"search\"\n inputmode=\"search\"\n type=\"search\"\n data-test=\"search-input\"\n aria-label=\"type your query here\"\n @mouseenter=\"emitUserHoveredInSearchBox\"\n @mouseleave=\"emitUserHoveredOutSearchBox\"\n @blur=\"emitUserBlurredSearchBox\"\n @click=\"emitUserClickedSearchBox\"\n @focus=\"emitUserFocusedSearchBox\"\n @input=\"emitUserIsTypingAQueryEvents\"\n @keydown.enter=\"emitUserPressedEnterKey\"\n @keydown.up.down.prevent=\"emitUserPressedArrowKey\"\n @beforeinput=\"preventSpecialKey\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { ArrowKey } from '../../../utils'\nimport type { DebouncedFunction } from '../../../utils/types'\nimport type { XEvent } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { defineComponent, onMounted, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { debounce } from '../../../utils/debounce'\nimport { searchBoxXModule } from '../x-module'\n\n/**\n * This component renders an input field that allows the user to type a query. It also reacts to\n * query changes through event listening.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInput',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * Maximum characters allowed in the input search.\n */\n maxLength: {\n type: Number,\n default: 64,\n },\n /**\n * Allows input autofocus when the search field is rendered.\n */\n autofocus: {\n type: Boolean,\n default: true,\n },\n /**\n * Enables the auto-accept query after debounce.\n */\n instant: {\n type: Boolean,\n default: true,\n },\n /**\n * Debounce time for the instant.\n */\n instantDebounceInMs: {\n type: Number,\n default: 500,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const { query } = useState('searchBox')\n\n const inputElement = ref<HTMLInputElement>()\n\n let debouncedUserAcceptedAQuery: DebouncedFunction<[string]>\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => {\n return {\n target: inputElement.value,\n feature: 'search_box',\n }\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event.\n *\n * @remarks It is necessary in a separated method to use it as the parameter of debounce in\n * emitDebouncedUserAcceptedAQuery method.\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitUserAcceptedAQuery = (query: string): void => {\n $x.emit('UserAcceptedAQuery', query, createEventMetadata())\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event with a debounce configured in\n * `instantDebounceInMs` prop.\n *\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitDebouncedUserAcceptedAQuery = (query: string): void => {\n if (props.instant) {\n if (!debouncedUserAcceptedAQuery) {\n debouncedUserAcceptedAQuery = debounce(emitUserAcceptedAQuery, props.instantDebounceInMs)\n }\n debouncedUserAcceptedAQuery(query)\n }\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredInSearchBox} when search box is hovered in.\n *\n * @internal\n */\n const emitUserHoveredInSearchBox = (): void => {\n $x.emit('UserHoveredInSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredOutSearchBox} when search box is hovered out.\n *\n * @internal\n */\n const emitUserHoveredOutSearchBox = (): void => {\n $x.emit('UserHoveredOutSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserBlurredSearchBox} when search box loses focus.\n *\n * @internal\n */\n const emitUserBlurredSearchBox = (): void => {\n $x.emit('UserBlurredSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserClickedSearchBox} when user clicks the search input.\n *\n * @internal\n */\n const emitUserClickedSearchBox = (): void => {\n $x.emit('UserClickedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserFocusedSearchBox} when search box gains focus.\n *\n * @internal\n */\n const emitUserFocusedSearchBox = (): void => {\n $x.emit('UserFocusedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserIsTypingAQuery} when the user typed/pasted something\n * into the search-box. Also emits event {@link SearchBoxXEvents.UserClearedQuery} when the user\n * removes all characters in the search-box.\n *\n * @internal\n */\n const emitUserIsTypingAQueryEvents = (): void => {\n const query = inputElement.value?.value ?? ''\n\n $x.emit('UserIsTypingAQuery', query, { target: inputElement.value })\n if (query.trim()) {\n emitDebouncedUserAcceptedAQuery(query)\n } else {\n cancelDebouncedUserAcceptedAQuery()\n }\n }\n\n /**\n * Emits event {@link XEventsTypes.UserPressedArrowKey} when the user pressed an arrow key.\n *\n * @param event - The keyboard event with the arrow key pressed.\n * @internal\n */\n const emitUserPressedArrowKey = (event: KeyboardEvent): void => {\n $x.emit('UserPressedArrowKey', event.key as ArrowKey, createEventMetadata())\n }\n\n /**\n * Emits multiple events when the user pressed the enter key.\n *\n * @remarks\n * Emitted events are:\n * {@link SearchBoxXEvents.UserPressedEnterKey}\n * {@link XEventsTypes.UserAcceptedAQuery}\n *\n * @internal\n */\n const emitUserPressedEnterKey = (): void => {\n const query = inputElement.value?.value.trim()\n if (!!query && query.length > 0) {\n $x.emit('UserPressedEnterKey', query, createEventMetadata())\n emitUserAcceptedAQuery(query)\n }\n inputElement.value?.blur()\n }\n\n /**\n * Prevents the user from either typing or pasting special characters in the input field.\n *\n * @internal\n * @param event - The event that will be checked for special characters.\n */\n const preventSpecialKey = (event: InputEvent): void => {\n if (/[<>]/.test(event.data ?? '')) {\n event.preventDefault()\n }\n }\n\n /**\n * When event {@link XEventsTypes.UserReachedEmpathizeTop} or\n * {@link SearchBoxXEvents.UserPressedClearSearchBoxButton}\n * are emitted the search input is focused.\n *\n * @internal\n */\n function focusInput(): void {\n inputElement.value?.focus()\n }\n ;['UserReachedEmpathizeTop', 'UserPressedClearSearchBoxButton'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(focusInput),\n )\n\n /**\n * When event {@link XEventsTypes.UserAcceptedAQuery} or\n * {@link SearchBoxXEvents.UserClearedQuery} are emitted the pending debounced emit\n * {@link XEvent} `UserAcceptedAQuery` is canceled.\n *\n * @internal\n */\n function cancelDebouncedUserAcceptedAQuery(): void {\n debouncedUserAcceptedAQuery?.cancel()\n }\n ;['UserAcceptedAQuery', 'UserClearedQuery'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(cancelDebouncedUserAcceptedAQuery),\n )\n\n onMounted(() => {\n if (props.autofocus) {\n focusInput()\n }\n })\n\n return {\n query,\n inputElement,\n emitUserHoveredInSearchBox,\n emitUserHoveredOutSearchBox,\n emitUserBlurredSearchBox,\n emitUserClickedSearchBox,\n emitUserFocusedSearchBox,\n emitUserIsTypingAQueryEvents,\n emitUserPressedEnterKey,\n emitUserPressedArrowKey,\n preventSpecialKey,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-search-input::-webkit-search-decoration,\n.x-search-input::-webkit-search-cancel-button,\n.x-search-input::-webkit-search-results-button,\n.x-search-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserBlurredSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserFocusedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserIsTypingAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedEnterKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedArrowKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserAcceptedAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Search service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example of how the search input is rendered.\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, the search input has been limited to accept a maximum of 5 characters, including\nspaces, it won't take the focus when it is rendered, and it will emit the `UserAcceptedAQuery` event\nafter 1000 milliseconds without typing.\n\n_Type a term with more than 5 characters to try it out!_\n\n```vue live\n<template>\n <SearchInput :maxLength=\"5\" :autofocus=\"false\" :instant=\"true\" :instantDebounceInMs=\"1000\" />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added below the search input to illustrate the action performed.\nFor example, if you select the search input box, the message “focus” appears. When you start to\nenter a search term, the message “typing” appears. If you press Enter after typing a search term,\nthe message “enter” appears.\n\n<!-- prettier-ignore-start -->\n:::warning X Events are only emitted from the root X Component.\nAt the moment, X Events are only emitted from the root X Component. This means that if you wrap\nthe `SearchInput` with another component of another module like the `MainScroll`, you should add\nthe listeners to the `MainScroll` instead of the `SearchInput`. If you need to subscribe to these\nevents, it is recommended to use the [`GlobalXBus`](../common/x-components.global-x-bus.md)\ncomponent instead.\n:::\n<!-- prettier-ignore-end -->\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput\n @UserPressedEnterKey=\"value = 'enter'\"\n @UserFocusedSearchBox=\"hasFocus = true\"\n @UserBlurredSearchBox=\"hasFocus = false\"\n @UserIsTypingAQuery=\"value = 'typing'\"\n />\n <strong>{{ value }}</strong>\n <span>{{ hasFocus ? 'focused' : 'unfocused' }}</span>\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst value = ref('')\nconst hasFocus = ref(false)\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `SearchInput` component\ncommunicates with the [`SearchButton`](x-components.search-button.md) and the\n[`ClearSearchInput`](x-components.clear-search-input.md) to offer a full query entry experience.\nFurthermore, you can use it together with the [`QuerySuggestions`](query-suggestions.md) component\nto autocomplete the typed search term.\n\n_Type “trousers” or another fashion term in the input field and then click the clear icon to try it\nout!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex; flex-flow: row nowrap;\">\n <SearchInput />\n <ClearSearchInput>\n <img src=\"/assets/icons/cross.svg\" />\n </ClearSearchInput>\n <SearchButton>Search</SearchButton>\n </div>\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, ClearSearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n</script>\n```\n</docs>\n"],"names":["_createElementBlock","_withKeys","_withModifiers"],"mappings":";;;;;;;sBACEA,kBAAA,CAoBE,OAAA,EAAA;AAAA,IAnBA,GAAA,EAAI,cAAA;AAAA,IACH,SAAA,EAAW,IAAA,CAAA,SAAA;AAAA,IACX,KAAA,EAAO,IAAA,CAAA,KAAA;AAAA,IACR,YAAA,EAAa,KAAA;AAAA,IACb,KAAA,EAAM,0BAAA;AAAA,IACN,YAAA,EAAa,QAAA;AAAA,IACb,SAAA,EAAU,QAAA;AAAA,IACV,IAAA,EAAK,QAAA;AAAA,IACL,WAAA,EAAU,cAAA;AAAA,IACV,YAAA,EAAW,sBAAA;AAAA,IACV,cAAU,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,0BAAA,IAAA,IAAA,CAAA,0BAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,IACZ,cAAU,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,2BAAA,IAAA,IAAA,CAAA,2BAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,IACZ,QAAI,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,wBAAA,I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AA,CAAA,iBAAA,CAAA,GAAA,IAAA,CAAA;AAAA,GAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,CAAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-input.vue2.js","sources":["../../../../../src/x-modules/search-box/components/search-input.vue"],"sourcesContent":["<template>\n <input\n ref=\"inputElement\"\n :maxlength=\"maxLength\"\n :value=\"query\"\n autocomplete=\"off\"\n class=\"x-search-input x-input\"\n enterkeyhint=\"search\"\n inputmode=\"search\"\n type=\"search\"\n data-test=\"search-input\"\n aria-label=\"type your query here\"\n @mouseenter=\"emitUserHoveredInSearchBox\"\n @mouseleave=\"emitUserHoveredOutSearchBox\"\n @blur=\"emitUserBlurredSearchBox\"\n @click=\"emitUserClickedSearchBox\"\n @focus=\"emitUserFocusedSearchBox\"\n @input=\"emitUserIsTypingAQueryEvents\"\n @keydown.enter=\"emitUserPressedEnterKey\"\n @keydown.up.down.prevent=\"emitUserPressedArrowKey\"\n @beforeinput=\"preventSpecialKey\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { ArrowKey } from '../../../utils'\nimport type { DebouncedFunction } from '../../../utils/types'\nimport type { XEvent } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { defineComponent, onMounted, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { debounce } from '../../../utils/debounce'\nimport { searchBoxXModule } from '../x-module'\n\n/**\n * This component renders an input field that allows the user to type a query. It also reacts to\n * query changes through event listening.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInput',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * Maximum characters allowed in the input search.\n */\n maxLength: {\n type: Number,\n default: 64,\n },\n /**\n * Allows input autofocus when the search field is rendered.\n */\n autofocus: {\n type: Boolean,\n default: true,\n },\n /**\n * Enables the auto-accept query after debounce.\n */\n instant: {\n type: Boolean,\n default: true,\n },\n /**\n * Debounce time for the instant.\n */\n instantDebounceInMs: {\n type: Number,\n default: 500,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const { query } = useState('searchBox')\n\n const inputElement = ref<HTMLInputElement>()\n\n let debouncedUserAcceptedAQuery: DebouncedFunction<[string]>\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => {\n return {\n target: inputElement.value,\n feature: 'search_box',\n }\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event.\n *\n * @remarks It is necessary in a separated method to use it as the parameter of debounce in\n * emitDebouncedUserAcceptedAQuery method.\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitUserAcceptedAQuery = (query: string): void => {\n $x.emit('UserAcceptedAQuery', query, createEventMetadata())\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event with a debounce configured in\n * `instantDebounceInMs` prop.\n *\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitDebouncedUserAcceptedAQuery = (query: string): void => {\n if (props.instant) {\n if (!debouncedUserAcceptedAQuery) {\n debouncedUserAcceptedAQuery = debounce(emitUserAcceptedAQuery, props.instantDebounceInMs)\n }\n debouncedUserAcceptedAQuery(query)\n }\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredInSearchBox} when search box is hovered in.\n *\n * @internal\n */\n const emitUserHoveredInSearchBox = (): void => {\n $x.emit('UserHoveredInSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredOutSearchBox} when search box is hovered out.\n *\n * @internal\n */\n const emitUserHoveredOutSearchBox = (): void => {\n $x.emit('UserHoveredOutSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserBlurredSearchBox} when search box loses focus.\n *\n * @internal\n */\n const emitUserBlurredSearchBox = (): void => {\n $x.emit('UserBlurredSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserClickedSearchBox} when user clicks the search input.\n *\n * @internal\n */\n const emitUserClickedSearchBox = (): void => {\n $x.emit('UserClickedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserFocusedSearchBox} when search box gains focus.\n *\n * @internal\n */\n const emitUserFocusedSearchBox = (): void => {\n $x.emit('UserFocusedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserIsTypingAQuery} when the user typed/pasted something\n * into the search-box. Also emits event {@link SearchBoxXEvents.UserClearedQuery} when the user\n * removes all characters in the search-box.\n *\n * @internal\n */\n const emitUserIsTypingAQueryEvents = (): void => {\n const query = inputElement.value?.value ?? ''\n\n $x.emit('UserIsTypingAQuery', query, { target: inputElement.value })\n if (query.trim()) {\n emitDebouncedUserAcceptedAQuery(query)\n } else {\n cancelDebouncedUserAcceptedAQuery()\n }\n }\n\n /**\n * Emits event {@link XEventsTypes.UserPressedArrowKey} when the user pressed an arrow key.\n *\n * @param event - The keyboard event with the arrow key pressed.\n * @internal\n */\n const emitUserPressedArrowKey = (event: KeyboardEvent): void => {\n $x.emit('UserPressedArrowKey', event.key as ArrowKey, createEventMetadata())\n }\n\n /**\n * Emits multiple events when the user pressed the enter key.\n *\n * @remarks\n * Emitted events are:\n * {@link SearchBoxXEvents.UserPressedEnterKey}\n * {@link XEventsTypes.UserAcceptedAQuery}\n *\n * @internal\n */\n const emitUserPressedEnterKey = (): void => {\n const query = inputElement.value?.value.trim()\n if (!!query && query.length > 0) {\n $x.emit('UserPressedEnterKey', query, createEventMetadata())\n emitUserAcceptedAQuery(query)\n }\n inputElement.value?.blur()\n }\n\n /**\n * Prevents the user from either typing or pasting special characters in the input field.\n *\n * @internal\n * @param event - The event that will be checked for special characters.\n */\n const preventSpecialKey = (event: InputEvent): void => {\n if (/[<>]/.test(event.data ?? '')) {\n event.preventDefault()\n }\n }\n\n /**\n * When event {@link XEventsTypes.UserReachedEmpathizeTop} or\n * {@link SearchBoxXEvents.UserPressedClearSearchBoxButton}\n * are emitted the search input is focused.\n *\n * @internal\n */\n function focusInput(): void {\n inputElement.value?.focus()\n }\n ;['UserReachedEmpathizeTop', 'UserPressedClearSearchBoxButton'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(focusInput),\n )\n\n /**\n * When event {@link XEventsTypes.UserAcceptedAQuery} or\n * {@link SearchBoxXEvents.UserClearedQuery} are emitted the pending debounced emit\n * {@link XEvent} `UserAcceptedAQuery` is canceled.\n *\n * @internal\n */\n function cancelDebouncedUserAcceptedAQuery(): void {\n debouncedUserAcceptedAQuery?.cancel()\n }\n ;['UserAcceptedAQuery', 'UserClearedQuery'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(cancelDebouncedUserAcceptedAQuery),\n )\n\n onMounted(() => {\n if (props.autofocus) {\n focusInput()\n }\n })\n\n return {\n query,\n inputElement,\n emitUserHoveredInSearchBox,\n emitUserHoveredOutSearchBox,\n emitUserBlurredSearchBox,\n emitUserClickedSearchBox,\n emitUserFocusedSearchBox,\n emitUserIsTypingAQueryEvents,\n emitUserPressedEnterKey,\n emitUserPressedArrowKey,\n preventSpecialKey,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-search-input::-webkit-search-decoration,\n.x-search-input::-webkit-search-cancel-button,\n.x-search-input::-webkit-search-results-button,\n.x-search-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserBlurredSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserFocusedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserIsTypingAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedEnterKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedArrowKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserAcceptedAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Search service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example of how the search input is rendered.\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, the search input has been limited to accept a maximum of 5 characters, including\nspaces, it won't take the focus when it is rendered, and it will emit the `UserAcceptedAQuery` event\nafter 1000 milliseconds without typing.\n\n_Type a term with more than 5 characters to try it out!_\n\n```vue live\n<template>\n <SearchInput :maxLength=\"5\" :autofocus=\"false\" :instant=\"true\" :instantDebounceInMs=\"1000\" />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added below the search input to illustrate the action performed.\nFor example, if you select the search input box, the message “focus” appears. When you start to\nenter a search term, the message “typing” appears. If you press Enter after typing a search term,\nthe message “enter” appears.\n\n<!-- prettier-ignore-start -->\n:::warning X Events are only emitted from the root X Component.\nAt the moment, X Events are only emitted from the root X Component. This means that if you wrap\nthe `SearchInput` with another component of another module like the `MainScroll`, you should add\nthe listeners to the `MainScroll` instead of the `SearchInput`. If you need to subscribe to these\nevents, it is recommended to use the [`GlobalXBus`](../common/x-components.global-x-bus.md)\ncomponent instead.\n:::\n<!-- prettier-ignore-end -->\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput\n @UserPressedEnterKey=\"value = 'enter'\"\n @UserFocusedSearchBox=\"hasFocus = true\"\n @UserBlurredSearchBox=\"hasFocus = false\"\n @UserIsTypingAQuery=\"value = 'typing'\"\n />\n <strong>{{ value }}</strong>\n <span>{{ hasFocus ? 'focused' : 'unfocused' }}</span>\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst value = ref('')\nconst hasFocus = ref(false)\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `SearchInput` component\ncommunicates with the [`SearchButton`](x-components.search-button.md) and the\n[`ClearSearchInput`](x-components.clear-search-input.md) to offer a full query entry experience.\nFurthermore, you can use it together with the [`QuerySuggestions`](query-suggestions.md) component\nto autocomplete the typed search term.\n\n_Type “trousers” or another fashion term in the input field and then click the clear icon to try it\nout!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex; flex-flow: row nowrap;\">\n <SearchInput />\n <ClearSearchInput>\n <img src=\"/assets/icons/cross.svg\" />\n </ClearSearchInput>\n <SearchButton>Search</SearchButton>\n </div>\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, ClearSearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;AAmCA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC9B,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IA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uB;YACvB,iBAAiB;SACnB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"search-input.vue2.js","sources":["../../../../../src/x-modules/search-box/components/search-input.vue"],"sourcesContent":["<template>\n <input\n ref=\"inputElement\"\n :maxlength=\"maxLength\"\n :value=\"query\"\n autocomplete=\"off\"\n class=\"x-search-input xds:input\"\n enterkeyhint=\"search\"\n inputmode=\"search\"\n type=\"search\"\n data-test=\"search-input\"\n aria-label=\"type your query here\"\n @mouseenter=\"emitUserHoveredInSearchBox\"\n @mouseleave=\"emitUserHoveredOutSearchBox\"\n @blur=\"emitUserBlurredSearchBox\"\n @click=\"emitUserClickedSearchBox\"\n @focus=\"emitUserFocusedSearchBox\"\n @input=\"emitUserIsTypingAQueryEvents\"\n @keydown.enter=\"emitUserPressedEnterKey\"\n @keydown.up.down.prevent=\"emitUserPressedArrowKey\"\n @beforeinput=\"preventSpecialKey\"\n />\n</template>\n\n<script lang=\"ts\">\nimport type { ArrowKey } from '../../../utils'\nimport type { DebouncedFunction } from '../../../utils/types'\nimport type { XEvent } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { defineComponent, onMounted, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { debounce } from '../../../utils/debounce'\nimport { searchBoxXModule } from '../x-module'\n\n/**\n * This component renders an input field that allows the user to type a query. It also reacts to\n * query changes through event listening.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SearchInput',\n xModule: searchBoxXModule.name,\n props: {\n /**\n * Maximum characters allowed in the input search.\n */\n maxLength: {\n type: Number,\n default: 64,\n },\n /**\n * Allows input autofocus when the search field is rendered.\n */\n autofocus: {\n type: Boolean,\n default: true,\n },\n /**\n * Enables the auto-accept query after debounce.\n */\n instant: {\n type: Boolean,\n default: true,\n },\n /**\n * Debounce time for the instant.\n */\n instantDebounceInMs: {\n type: Number,\n default: 500,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const { query } = useState('searchBox')\n\n const inputElement = ref<HTMLInputElement>()\n\n let debouncedUserAcceptedAQuery: DebouncedFunction<[string]>\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => {\n return {\n target: inputElement.value,\n feature: 'search_box',\n }\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event.\n *\n * @remarks It is necessary in a separated method to use it as the parameter of debounce in\n * emitDebouncedUserAcceptedAQuery method.\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitUserAcceptedAQuery = (query: string): void => {\n $x.emit('UserAcceptedAQuery', query, createEventMetadata())\n }\n\n /**\n * Emits {@link XEventsTypes.UserAcceptedAQuery} event with a debounce configured in\n * `instantDebounceInMs` prop.\n *\n * @internal\n * @param query - The query that will be emitted.\n */\n const emitDebouncedUserAcceptedAQuery = (query: string): void => {\n if (props.instant) {\n if (!debouncedUserAcceptedAQuery) {\n debouncedUserAcceptedAQuery = debounce(emitUserAcceptedAQuery, props.instantDebounceInMs)\n }\n debouncedUserAcceptedAQuery(query)\n }\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredInSearchBox} when search box is hovered in.\n *\n * @internal\n */\n const emitUserHoveredInSearchBox = (): void => {\n $x.emit('UserHoveredInSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserHoveredOutSearchBox} when search box is hovered out.\n *\n * @internal\n */\n const emitUserHoveredOutSearchBox = (): void => {\n $x.emit('UserHoveredOutSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserBlurredSearchBox} when search box loses focus.\n *\n * @internal\n */\n const emitUserBlurredSearchBox = (): void => {\n $x.emit('UserBlurredSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserClickedSearchBox} when user clicks the search input.\n *\n * @internal\n */\n const emitUserClickedSearchBox = (): void => {\n $x.emit('UserClickedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserFocusedSearchBox} when search box gains focus.\n *\n * @internal\n */\n const emitUserFocusedSearchBox = (): void => {\n $x.emit('UserFocusedSearchBox', undefined, { target: inputElement.value })\n }\n\n /**\n * Emits event {@link SearchBoxXEvents.UserIsTypingAQuery} when the user typed/pasted something\n * into the search-box. Also emits event {@link SearchBoxXEvents.UserClearedQuery} when the user\n * removes all characters in the search-box.\n *\n * @internal\n */\n const emitUserIsTypingAQueryEvents = (): void => {\n const query = inputElement.value?.value ?? ''\n\n $x.emit('UserIsTypingAQuery', query, { target: inputElement.value })\n if (query.trim()) {\n emitDebouncedUserAcceptedAQuery(query)\n } else {\n cancelDebouncedUserAcceptedAQuery()\n }\n }\n\n /**\n * Emits event {@link XEventsTypes.UserPressedArrowKey} when the user pressed an arrow key.\n *\n * @param event - The keyboard event with the arrow key pressed.\n * @internal\n */\n const emitUserPressedArrowKey = (event: KeyboardEvent): void => {\n $x.emit('UserPressedArrowKey', event.key as ArrowKey, createEventMetadata())\n }\n\n /**\n * Emits multiple events when the user pressed the enter key.\n *\n * @remarks\n * Emitted events are:\n * {@link SearchBoxXEvents.UserPressedEnterKey}\n * {@link XEventsTypes.UserAcceptedAQuery}\n *\n * @internal\n */\n const emitUserPressedEnterKey = (): void => {\n const query = inputElement.value?.value.trim()\n if (!!query && query.length > 0) {\n $x.emit('UserPressedEnterKey', query, createEventMetadata())\n emitUserAcceptedAQuery(query)\n }\n inputElement.value?.blur()\n }\n\n /**\n * Prevents the user from either typing or pasting special characters in the input field.\n *\n * @internal\n * @param event - The event that will be checked for special characters.\n */\n const preventSpecialKey = (event: InputEvent): void => {\n if (/[<>]/.test(event.data ?? '')) {\n event.preventDefault()\n }\n }\n\n /**\n * When event {@link XEventsTypes.UserReachedEmpathizeTop} or\n * {@link SearchBoxXEvents.UserPressedClearSearchBoxButton}\n * are emitted the search input is focused.\n *\n * @internal\n */\n function focusInput(): void {\n inputElement.value?.focus()\n }\n ;['UserReachedEmpathizeTop', 'UserPressedClearSearchBoxButton'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(focusInput),\n )\n\n /**\n * When event {@link XEventsTypes.UserAcceptedAQuery} or\n * {@link SearchBoxXEvents.UserClearedQuery} are emitted the pending debounced emit\n * {@link XEvent} `UserAcceptedAQuery` is canceled.\n *\n * @internal\n */\n function cancelDebouncedUserAcceptedAQuery(): void {\n debouncedUserAcceptedAQuery?.cancel()\n }\n ;['UserAcceptedAQuery', 'UserClearedQuery'].forEach(event =>\n $x.on(event as XEvent, false).subscribe(cancelDebouncedUserAcceptedAQuery),\n )\n\n onMounted(() => {\n if (props.autofocus) {\n focusInput()\n }\n })\n\n return {\n query,\n inputElement,\n emitUserHoveredInSearchBox,\n emitUserHoveredOutSearchBox,\n emitUserBlurredSearchBox,\n emitUserClickedSearchBox,\n emitUserFocusedSearchBox,\n emitUserIsTypingAQueryEvents,\n emitUserPressedEnterKey,\n emitUserPressedArrowKey,\n preventSpecialKey,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-search-input::-webkit-search-decoration,\n.x-search-input::-webkit-search-cancel-button,\n.x-search-input::-webkit-search-results-button,\n.x-search-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserBlurredSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserFocusedSearchBox`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserIsTypingAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedEnterKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPressedArrowKey`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserAcceptedAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Search service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example of how the search input is rendered.\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, the search input has been limited to accept a maximum of 5 characters, including\nspaces, it won't take the focus when it is rendered, and it will emit the `UserAcceptedAQuery` event\nafter 1000 milliseconds without typing.\n\n_Type a term with more than 5 characters to try it out!_\n\n```vue live\n<template>\n <SearchInput :maxLength=\"5\" :autofocus=\"false\" :instant=\"true\" :instantDebounceInMs=\"1000\" />\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added below the search input to illustrate the action performed.\nFor example, if you select the search input box, the message “focus” appears. When you start to\nenter a search term, the message “typing” appears. If you press Enter after typing a search term,\nthe message “enter” appears.\n\n<!-- prettier-ignore-start -->\n:::warning X Events are only emitted from the root X Component.\nAt the moment, X Events are only emitted from the root X Component. This means that if you wrap\nthe `SearchInput` with another component of another module like the `MainScroll`, you should add\nthe listeners to the `MainScroll` instead of the `SearchInput`. If you need to subscribe to these\nevents, it is recommended to use the [`GlobalXBus`](../common/x-components.global-x-bus.md)\ncomponent instead.\n:::\n<!-- prettier-ignore-end -->\n\n_Type any term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput\n @UserPressedEnterKey=\"value = 'enter'\"\n @UserFocusedSearchBox=\"hasFocus = true\"\n @UserBlurredSearchBox=\"hasFocus = false\"\n @UserIsTypingAQuery=\"value = 'typing'\"\n />\n <strong>{{ value }}</strong>\n <span>{{ hasFocus ? 'focused' : 'unfocused' }}</span>\n </div>\n</template>\n\n<script setup>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { ref } from 'vue'\n\nconst value = ref('')\nconst hasFocus = ref(false)\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `SearchInput` component\ncommunicates with the [`SearchButton`](x-components.search-button.md) and the\n[`ClearSearchInput`](x-components.clear-search-input.md) to offer a full query entry experience.\nFurthermore, you can use it together with the [`QuerySuggestions`](query-suggestions.md) component\nto autocomplete the typed search term.\n\n_Type “trousers” or another fashion term in the input field and then click the clear icon to try it\nout!_\n\n```vue live\n<template>\n <div>\n <div style=\"display: flex; flex-flow: row nowrap;\">\n <SearchInput />\n <ClearSearchInput>\n <img src=\"/assets/icons/cross.svg\" />\n </ClearSearchInput>\n <SearchButton>Search</SearchButton>\n </div>\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { SearchInput, ClearSearchInput, SearchButton } from '@empathyco/x-components/search-box'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;AAmCA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC9B,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,EAAE;AACZ,SAAA;AACD;;AAEE;AACF,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;AAEE;AACF,QAAA,mBAAmB,EAAE;AACnB,YAAA,IA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 -4,7 +4,7 @@ import '../../utils/storage.js';
|
|
|
4
4
|
import { namespacedWireDispatch, namespacedWireCommit } from '../../wiring/namespaced-wires.factory.js';
|
|
5
5
|
import { namespacedDebounce } from '../../wiring/namespaced-wires.operators.js';
|
|
6
6
|
import { wireServiceWithoutPayload, wireService } from '../../wiring/wires.factory.js';
|
|
7
|
-
import {
|
|
7
|
+
import { filter, mapWire } from '../../wiring/wires.operators.js';
|
|
8
8
|
import { createWiring } from '../../wiring/wiring.utils.js';
|
|
9
9
|
import { DefaultExternalTaggingService } from './service/external-tagging.service.js';
|
|
10
10
|
|
|
@@ -225,23 +225,6 @@ const trackNoResultsQueryWithSemanticsWire = trackNoResultsQueryWithFallbackWire
|
|
|
225
225
|
* @deprecated - Use {@link trackNoResultsQueryWithFallbackWireDebounced} instead.
|
|
226
226
|
*/
|
|
227
227
|
const trackNoResultsQueryWithSemanticsWireDebounced = trackNoResultsQueryWithFallbackWireDebounced;
|
|
228
|
-
/**
|
|
229
|
-
* Performs a track of clicking the AI overview expand button when the playload (expanded) is false.
|
|
230
|
-
*
|
|
231
|
-
* @public
|
|
232
|
-
*/
|
|
233
|
-
const trackAiOverviewButtonClickedWire = filterTruthyPayload(wireDispatch('track', ({ metadata: { toolingDisplayClick, suggestionText } }) => {
|
|
234
|
-
const taggingInfo = {
|
|
235
|
-
...toolingDisplayClick,
|
|
236
|
-
params: {
|
|
237
|
-
...toolingDisplayClick.params,
|
|
238
|
-
productId: 'EXPAND',
|
|
239
|
-
title: suggestionText,
|
|
240
|
-
url: 'none',
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
return taggingInfo;
|
|
244
|
-
}));
|
|
245
228
|
/**
|
|
246
229
|
* Factory helper to create a wire for the track of the display click.
|
|
247
230
|
*
|
|
@@ -420,9 +403,6 @@ const taggingWiring = createWiring({
|
|
|
420
403
|
AiSuggestionsSearchChanged: {
|
|
421
404
|
trackAiSuggestionsSearchWire,
|
|
422
405
|
},
|
|
423
|
-
UserClickedAiOverviewExpandButton: {
|
|
424
|
-
trackAiOverviewButtonClickedWire,
|
|
425
|
-
},
|
|
426
406
|
UserClickedAnAiOverviewResult: {
|
|
427
407
|
trackToolingDisplayClickedWire,
|
|
428
408
|
},
|
|
@@ -431,5 +411,5 @@ const taggingWiring = createWiring({
|
|
|
431
411
|
},
|
|
432
412
|
});
|
|
433
413
|
|
|
434
|
-
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire,
|
|
414
|
+
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackAiSuggestionsSearchWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithFallbackWire, trackNoResultsQueryWithFallbackWireDebounced, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackPromotedClickedWire, trackQueryWire, trackRelatedPromptToolingDisplayClickWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire };
|
|
435
415
|
//# sourceMappingURL=wiring.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/tagging/wiring.ts"],"sourcesContent":["import type {\n AiSuggestionSearch,\n RelatedPrompt,\n Result,\n SemanticQuery,\n Taggable,\n Tagging,\n TaggingRequest,\n} from '@empathyco/x-types'\nimport type { FeatureLocation } from '../../types/index'\nimport type { DisplayWireMetadata, Wire } from '../../wiring/wiring.types'\nimport { DefaultSessionService } from '@empathyco/x-utils'\nimport { createOrigin } from '../../utils/index'\nimport { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory'\nimport { namespacedDebounce } from '../../wiring/namespaced-wires.operators'\nimport { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory'\nimport { filter, filterTruthyPayload, mapWire } from '../../wiring/wires.operators'\nimport { createWiring } from '../../wiring/wiring.utils'\nimport { DefaultExternalTaggingService } from './service/external-tagging.service'\n\n/**\n * `tagging` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'tagging'\n\n/**\n * Debounce function for the module.\n */\nconst moduleDebounce = namespacedDebounce(moduleName)\n\n/**\n * WireCommit for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireDispatch for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n\n/**\n * Wires without payload factory for {@link DefaultSessionService}.\n */\nconst wireSessionServiceWithoutPayload = wireServiceWithoutPayload(DefaultSessionService.instance)\n\n/**\n * Wires factory for {@link DefaultExternalTaggingService}.\n */\nconst wireExternalTaggingService = wireService(DefaultExternalTaggingService.instance)\n\n/**\n * Stores the given result on the local storage.\n *\n * @public\n */\nconst storeClickedResultWire = wireExternalTaggingService('storeResultClicked')\n\n/**\n * Stores the result added to cart on the local storage.\n *\n * @public\n */\nconst storeAddToCartWire = wireExternalTaggingService('storeAddToCart')\n\n/**\n * Moves the result information from the local storage to session storage.\n *\n * @public\n */\nconst moveClickedResultToSessionWire = mapWire(\n wireExternalTaggingService('moveToSessionStorage'),\n (payload: string) => {\n return payload === 'url' ? undefined : payload\n },\n)\n\n/**\n * Triggers the add to cart tracking.\n *\n * @public\n */\nconst trackAddToCartFromSessionStorage = wireExternalTaggingService('trackAddToCart')\n\n/**\n * Clears the session id.\n *\n * @public\n */\nconst clearSessionWire = filter(\n wireSessionServiceWithoutPayload('clearSessionId'),\n ({ eventPayload: consent }) => !consent,\n)\n\n/**\n * Sets the tagging state `consent`.\n *\n * @public\n */\nexport const setConsent = wireCommit('setConsent')\n\n/**\n * Sets the tagging state `noResultsTaggingEnabled`.\n *\n * @public\n */\nexport const setNoResultsTaggingEnabledWire = wireCommit('setNoResultsTaggingEnabled')\n\n/**\n * Sets the tagging config state.\n *\n * @public\n */\nexport const setTaggingConfig = wireCommit('mergeConfig')\n\n/**\n * Tracks the tagging of the query.\n *\n * @public\n */\nexport const trackQueryWire = filter(\n wireDispatch('track'),\n ({ eventPayload, store }) =>\n ((eventPayload as TaggingRequest).params.totalHits as number) > 0 ||\n !store.state.x.tagging.noResultsTaggingEnabled,\n)\n\n/**\n * Sets the tagging state of the query tagging info using a debounce which ends if the user\n * accepts a query.\n *\n * @public\n */\nexport const setQueryTaggingInfo = moduleDebounce(\n wireCommit('setQueryTaggingInfo'),\n ({ state }) => state.config.queryTaggingDebounceMs,\n {\n cancelOn: 'UserClearedQuery',\n forceOn: [\n 'UserClickedAResult',\n 'UserClickedAPromoted',\n 'UserClickedABanner',\n 'UserClickedARedirection',\n 'UserReachedResultsListEnd',\n ],\n },\n)\n\n/**\n * Sets the tagging state of the query tagging info using.\n *\n * @public\n */\nexport const setQueryTaggingFromQueryPreview = createSetQueryTaggingFromQueryPreview()\n\n/**\n * Tracks the tagging of the result.\n *\n * @public\n */\nexport const trackResultClickedWire = createTrackWire('click')\n\n/**\n * Tracks the tagging of the banner.\n *\n * @public\n */\nexport const trackBannerClickedWire = createTrackWire('click')\n\n/**\n * Tracks the click on a promoted result.\n *\n * @public\n */\nexport const trackPromotedClickedWire = createTrackWire('click')\n\n/**\n * Performs a track of a result added to the cart.\n *\n * @public\n */\nexport const trackAddToCartWire = createTrackWire('add2cart')\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackDisplayClickedWire = createTrackDisplayWire('displayClick')\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackToolingDisplayClickedWire = createTrackToolingDisplayWire()\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackToolingAdd2CartWire = createTrackToolingAdd2CartWire()\n\n/**\n * Performs a track of a clicked related prompt.\n *\n * @public\n */\nexport const trackRelatedPromptToolingDisplayClickWire =\n createTrackRelatedPromptToolingDisplayClickWire()\n\n/**\n * Performs a track of a display element appearing.\n *\n * @public\n */\nexport const trackElementDisplayedWire = createTrackDisplayWire('display')\n\n/**\n * Factory helper to create a wire for the track of a taggable element.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the given property of the taggable element.\n *\n * @public\n */\nexport function createTrackWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata: { location } }) => {\n const taggingInfo: TaggingRequest = tagging[property]\n taggingInfo.params.location = location as string\n return taggingInfo\n }),\n ({ eventPayload: { tagging }, metadata: { ignoreInModules } }) =>\n // eslint-disable-next-line ts/no-unsafe-member-access\n !!tagging?.[property] && !ignoreInModules?.includes(moduleName),\n )\n}\n\n/**\n * Performs a track of a query with no results that used related prompts or semantic queries as fallback.\n * The totalHits will be changed to -1 if related prompts or semantic queries are found in order to differentiate\n * it from scenarios where the user encounters a no-results page without any related prompts or semantic queries.\n *\n * @public\n */\nexport const trackNoResultsQueryWithFallbackWire = filter(\n wireDispatch('track', ({ eventPayload, state }) => {\n const { queryTaggingInfo } = state\n const totalHits = (eventPayload as RelatedPrompt[] | SemanticQuery[]).length > 0 ? -1 : 0\n return {\n params: { ...queryTaggingInfo?.params, totalHits },\n url: queryTaggingInfo?.url ?? '',\n }\n }),\n ({ store }) => Number(store.state.x.tagging.queryTaggingInfo?.params.totalHits) === 0,\n)\n\n/**.\n * Debounced version of {@link trackNoResultsQueryWithFallbackWire}\n *\n * @public\n */\nexport const trackNoResultsQueryWithFallbackWireDebounced = moduleDebounce(\n trackNoResultsQueryWithFallbackWire,\n ({ state }) => state.config.queryTaggingDebounceMs,\n { cancelOn: ['QueryPreviewUnmounted', 'RelatedPromptsUnmounted'] },\n)\n\n/**\n * Performs a track of a query with no results that used semantic queries as fallback.\n * The totalHits will be changed to -1 if semantic queries are found in order to differentiate\n * it from scenarios where the user encounters a no-results page without any semantic queries.\n *\n * @public\n * @deprecated - Use {@link trackNoResultsQueryWithFallbackWire} instead.\n */\nexport const trackNoResultsQueryWithSemanticsWire = trackNoResultsQueryWithFallbackWire\n\n/**\n * Debounced version of {@link trackNoResultsQueryWithFallbackWire}\n *\n * @public\n * @deprecated - Use {@link trackNoResultsQueryWithFallbackWireDebounced} instead.\n */\nexport const trackNoResultsQueryWithSemanticsWireDebounced =\n trackNoResultsQueryWithFallbackWireDebounced\n\n/**\n * Performs a track of clicking the AI overview expand button when the playload (expanded) is false.\n *\n * @public\n */\nexport const trackAiOverviewButtonClickedWire = filterTruthyPayload(\n wireDispatch('track', ({ metadata: { toolingDisplayClick, suggestionText } }) => {\n const taggingInfo = {\n ...(toolingDisplayClick as TaggingRequest),\n params: {\n ...(toolingDisplayClick as TaggingRequest).params,\n productId: 'EXPAND',\n title: suggestionText as string,\n url: 'none',\n },\n }\n\n return taggingInfo\n }),\n)\n\n/**\n * Factory helper to create a wire for the track of the display click.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the display click of the taggable element.\n *\n * @public\n */\nexport function createTrackDisplayWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata }) => {\n const taggingInfo: TaggingRequest = tagging[property]\n const location = metadata.location as FeatureLocation\n\n taggingInfo.params.location = location\n taggingInfo.params.displayFamily = createOrigin({\n feature: metadata.feature,\n location,\n })!\n taggingInfo.params.q = (metadata as DisplayWireMetadata).displayOriginalQuery\n\n return taggingInfo\n }),\n // eslint-disable-next-line ts/no-unsafe-member-access\n ({ eventPayload: { tagging } }) => !!tagging?.[property]?.url,\n )\n}\n\n/**\n * Update the tooling tagging params with the result information.\n *\n * @param taggingRequest - The tooling tagging request to be updated.\n * @param result - The clicked result.\n * @returns The tagging request updated.\n *\n * @internal\n */\nfunction updateToolingTaggingWithResult(\n taggingRequest: TaggingRequest,\n result: Result,\n): TaggingRequest {\n taggingRequest.params.productId = result.id\n taggingRequest.params.title = result.name!\n taggingRequest.params.url = result.url!\n\n return taggingRequest\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display click.\n *\n * @returns A new wire for the tooling display click of the taggable element.\n *\n * @public\n */\nexport function createTrackToolingDisplayWire(): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload, metadata }) => {\n const taggingInfo: TaggingRequest = metadata.toolingTagging as TaggingRequest\n const resultInfo = eventPayload as Result\n\n updateToolingTaggingWithResult(taggingInfo, resultInfo)\n\n return taggingInfo\n }),\n ({ metadata }) => !!metadata?.toolingTagging,\n )\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display add to cart.\n *\n * @returns A new wire for the tooling display add to cart of the taggable element.\n *\n * @public\n */\nexport function createTrackToolingAdd2CartWire(): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload, metadata }) => {\n const taggingInfo: TaggingRequest = metadata.toolingAdd2CartTagging as TaggingRequest\n const resultInfo = eventPayload as Result\n\n updateToolingTaggingWithResult(taggingInfo, resultInfo)\n\n return taggingInfo\n }),\n ({ metadata }) => !!metadata?.toolingAdd2CartTagging,\n )\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display click in a related prompt.\n *\n * @returns A new wire for the tooling display click of the taggable element.\n *\n * @public\n */\nexport function createTrackRelatedPromptToolingDisplayClickWire() {\n return filter(\n wireDispatch('track', ({ metadata }) => {\n const relatedPrompt = metadata.relatedPrompt as RelatedPrompt\n const taggingInfo = relatedPrompt.tagging!.toolingDisplayClickTagging as TaggingRequest\n\n taggingInfo.params.productId = 'EXPAND'\n taggingInfo.params.title = relatedPrompt.suggestionText\n taggingInfo.params.url = 'none'\n\n return taggingInfo\n }),\n ({ metadata }) => {\n const relatedPrompt = metadata.relatedPrompt as RelatedPrompt | undefined\n const isUnselected = metadata?.selectedPrompt === -1\n const taggingInfo = relatedPrompt?.tagging?.toolingDisplayClickTagging\n return isUnselected && !!taggingInfo\n },\n )\n}\n\n/**\n * Factory helper to create a wire to set the queryTagging.\n *\n * @returns A new wire for the query of a result of a queryPreview.\n *\n * @public\n */\nexport function createSetQueryTaggingFromQueryPreview(): Wire<Taggable> {\n return filter(\n wireCommit(\n 'setQueryTaggingInfo',\n ({ metadata: { queryTagging } }) => queryTagging as TaggingRequest,\n ),\n ({ metadata: { queryTagging } }) => !!queryTagging,\n )\n}\n\n/**\n * Tracks query tagging of the AI suggestions-search.\n * @public\n */\nexport const trackAiSuggestionsSearchWire = wireDispatch('track', ({ eventPayload }) =>\n (eventPayload as AiSuggestionSearch[]).map(({ tagging }) => tagging.query),\n)\n\n/**\n * Wiring configuration for the {@link TaggingXModule | tagging module}.\n *\n * @internal\n */\nexport const taggingWiring = createWiring({\n ConsentProvided: {\n setConsent,\n },\n ConsentChanged: {\n clearSessionWire,\n },\n PDPIsLoaded: {\n moveClickedResultToSessionWire,\n },\n ResultURLTrackingEnabled: {\n moveClickedResultToSessionWire,\n },\n SearchTaggingChanged: {\n setQueryTaggingInfo,\n },\n SearchTaggingReceived: {\n trackQueryWire,\n },\n TrackableElementDisplayed: {\n trackElementDisplayedWire,\n },\n TaggingConfigProvided: {\n setTaggingConfig,\n },\n UserClickedAResult: {\n trackResultClickedWire,\n storeClickedResultWire,\n },\n UserClickedResultAddToCart: {\n trackAddToCartWire,\n trackResultClickedWire,\n storeAddToCartWire,\n },\n UserClickedPDPAddToCart: {\n trackAddToCartFromSessionStorage,\n },\n UserClickedABanner: {\n trackBannerClickedWire,\n },\n UserClickedAPromoted: {\n trackPromotedClickedWire,\n },\n UserClickedADisplayResult: {\n trackDisplayClickedWire,\n setQueryTaggingFromQueryPreview,\n },\n SemanticQueriesResponseChanged: {\n trackNoResultsQueryWithFallbackWireDebounced,\n },\n RelatedPromptsResponseChanged: {\n trackNoResultsQueryWithFallbackWireDebounced,\n },\n ModuleRegistered: {\n setNoResultsTaggingEnabledWire,\n },\n UserClickedARelatedPromptResult: {\n trackToolingDisplayClickedWire,\n },\n UserClickedARelatedPromptAdd2Cart: {\n trackToolingAdd2CartWire,\n },\n UserSelectedARelatedPrompt: {\n trackRelatedPromptToolingDisplayClickWire,\n },\n AiSuggestionsSearchChanged: {\n trackAiSuggestionsSearchWire,\n },\n UserClickedAiOverviewExpandButton: {\n trackAiOverviewButtonClickedWire,\n },\n UserClickedAnAiOverviewResult: {\n trackToolingDisplayClickedWire,\n },\n UserClickedAnAiOverviewAdd2Cart: {\n trackToolingAdd2CartWire,\n },\n})\n"],"names":[],"mappings":";;;;;;;;;;AAoBA;;;;AAIG;AACH,MAAM,UAAU,GAAG,SAAS;AAE5B;;AAEG;AACH,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC;AAErD;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;AAEnD;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC;AAEvD;;AAEG;AACH,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,qBAAqB,CAAC,QAAQ,CAAC;AAElG;;AAEG;AACH,MAAM,0BAA0B,GAAG,WAAW,CAAC,6BAA6B,CAAC,QAAQ,CAAC;AAEtF;;;;AAIG;AACH,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,oBAAoB,CAAC;AAE/E;;;;AAIG;AACH,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,gBAAgB,CAAC;AAEvE;;;;AAIG;AACH,MAAM,8BAA8B,GAAG,OAAO,CAC5C,0BAA0B,CAAC,sBAAsB,CAAC,EAClD,CAAC,OAAe,KAAI;IAClB,OAAO,OAAO,KAAK,KAAK,GAAG,SAAS,GAAG,OAAO;AAChD,CAAC,CACF;AAED;;;;AAIG;AACH,MAAM,gCAAgC,GAAG,0BAA0B,CAAC,gBAAgB,CAAC;AAErF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D,IAAA,6BAA6B,EAAE;QAC7B,8BAA8B;AAC/B,KAAA;AACD,IAAA,+BAA+B,EAAE;QAC/B,wBAAwB;AACzB,KAAA;AACF,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/tagging/wiring.ts"],"sourcesContent":["import type {\n AiSuggestionSearch,\n RelatedPrompt,\n Result,\n SemanticQuery,\n Taggable,\n Tagging,\n TaggingRequest,\n} from '@empathyco/x-types'\nimport type { FeatureLocation } from '../../types/index'\nimport type { DisplayWireMetadata, Wire } from '../../wiring/wiring.types'\nimport { DefaultSessionService } from '@empathyco/x-utils'\nimport { createOrigin } from '../../utils/index'\nimport { namespacedWireCommit, namespacedWireDispatch } from '../../wiring/namespaced-wires.factory'\nimport { namespacedDebounce } from '../../wiring/namespaced-wires.operators'\nimport { wireService, wireServiceWithoutPayload } from '../../wiring/wires.factory'\nimport { filter, mapWire } from '../../wiring/wires.operators'\nimport { createWiring } from '../../wiring/wiring.utils'\nimport { DefaultExternalTaggingService } from './service/external-tagging.service'\n\n/**\n * `tagging` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'tagging'\n\n/**\n * Debounce function for the module.\n */\nconst moduleDebounce = namespacedDebounce(moduleName)\n\n/**\n * WireCommit for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireCommit = namespacedWireCommit(moduleName)\n\n/**\n * WireDispatch for {@link TaggingXModule}.\n *\n * @internal\n */\nconst wireDispatch = namespacedWireDispatch(moduleName)\n\n/**\n * Wires without payload factory for {@link DefaultSessionService}.\n */\nconst wireSessionServiceWithoutPayload = wireServiceWithoutPayload(DefaultSessionService.instance)\n\n/**\n * Wires factory for {@link DefaultExternalTaggingService}.\n */\nconst wireExternalTaggingService = wireService(DefaultExternalTaggingService.instance)\n\n/**\n * Stores the given result on the local storage.\n *\n * @public\n */\nconst storeClickedResultWire = wireExternalTaggingService('storeResultClicked')\n\n/**\n * Stores the result added to cart on the local storage.\n *\n * @public\n */\nconst storeAddToCartWire = wireExternalTaggingService('storeAddToCart')\n\n/**\n * Moves the result information from the local storage to session storage.\n *\n * @public\n */\nconst moveClickedResultToSessionWire = mapWire(\n wireExternalTaggingService('moveToSessionStorage'),\n (payload: string) => {\n return payload === 'url' ? undefined : payload\n },\n)\n\n/**\n * Triggers the add to cart tracking.\n *\n * @public\n */\nconst trackAddToCartFromSessionStorage = wireExternalTaggingService('trackAddToCart')\n\n/**\n * Clears the session id.\n *\n * @public\n */\nconst clearSessionWire = filter(\n wireSessionServiceWithoutPayload('clearSessionId'),\n ({ eventPayload: consent }) => !consent,\n)\n\n/**\n * Sets the tagging state `consent`.\n *\n * @public\n */\nexport const setConsent = wireCommit('setConsent')\n\n/**\n * Sets the tagging state `noResultsTaggingEnabled`.\n *\n * @public\n */\nexport const setNoResultsTaggingEnabledWire = wireCommit('setNoResultsTaggingEnabled')\n\n/**\n * Sets the tagging config state.\n *\n * @public\n */\nexport const setTaggingConfig = wireCommit('mergeConfig')\n\n/**\n * Tracks the tagging of the query.\n *\n * @public\n */\nexport const trackQueryWire = filter(\n wireDispatch('track'),\n ({ eventPayload, store }) =>\n ((eventPayload as TaggingRequest).params.totalHits as number) > 0 ||\n !store.state.x.tagging.noResultsTaggingEnabled,\n)\n\n/**\n * Sets the tagging state of the query tagging info using a debounce which ends if the user\n * accepts a query.\n *\n * @public\n */\nexport const setQueryTaggingInfo = moduleDebounce(\n wireCommit('setQueryTaggingInfo'),\n ({ state }) => state.config.queryTaggingDebounceMs,\n {\n cancelOn: 'UserClearedQuery',\n forceOn: [\n 'UserClickedAResult',\n 'UserClickedAPromoted',\n 'UserClickedABanner',\n 'UserClickedARedirection',\n 'UserReachedResultsListEnd',\n ],\n },\n)\n\n/**\n * Sets the tagging state of the query tagging info using.\n *\n * @public\n */\nexport const setQueryTaggingFromQueryPreview = createSetQueryTaggingFromQueryPreview()\n\n/**\n * Tracks the tagging of the result.\n *\n * @public\n */\nexport const trackResultClickedWire = createTrackWire('click')\n\n/**\n * Tracks the tagging of the banner.\n *\n * @public\n */\nexport const trackBannerClickedWire = createTrackWire('click')\n\n/**\n * Tracks the click on a promoted result.\n *\n * @public\n */\nexport const trackPromotedClickedWire = createTrackWire('click')\n\n/**\n * Performs a track of a result added to the cart.\n *\n * @public\n */\nexport const trackAddToCartWire = createTrackWire('add2cart')\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackDisplayClickedWire = createTrackDisplayWire('displayClick')\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackToolingDisplayClickedWire = createTrackToolingDisplayWire()\n\n/**\n * Performs a track of a display result being clicked.\n *\n * @public\n */\nexport const trackToolingAdd2CartWire = createTrackToolingAdd2CartWire()\n\n/**\n * Performs a track of a clicked related prompt.\n *\n * @public\n */\nexport const trackRelatedPromptToolingDisplayClickWire =\n createTrackRelatedPromptToolingDisplayClickWire()\n\n/**\n * Performs a track of a display element appearing.\n *\n * @public\n */\nexport const trackElementDisplayedWire = createTrackDisplayWire('display')\n\n/**\n * Factory helper to create a wire for the track of a taggable element.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the given property of the taggable element.\n *\n * @public\n */\nexport function createTrackWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata: { location } }) => {\n const taggingInfo: TaggingRequest = tagging[property]\n taggingInfo.params.location = location as string\n return taggingInfo\n }),\n ({ eventPayload: { tagging }, metadata: { ignoreInModules } }) =>\n // eslint-disable-next-line ts/no-unsafe-member-access\n !!tagging?.[property] && !ignoreInModules?.includes(moduleName),\n )\n}\n\n/**\n * Performs a track of a query with no results that used related prompts or semantic queries as fallback.\n * The totalHits will be changed to -1 if related prompts or semantic queries are found in order to differentiate\n * it from scenarios where the user encounters a no-results page without any related prompts or semantic queries.\n *\n * @public\n */\nexport const trackNoResultsQueryWithFallbackWire = filter(\n wireDispatch('track', ({ eventPayload, state }) => {\n const { queryTaggingInfo } = state\n const totalHits = (eventPayload as RelatedPrompt[] | SemanticQuery[]).length > 0 ? -1 : 0\n return {\n params: { ...queryTaggingInfo?.params, totalHits },\n url: queryTaggingInfo?.url ?? '',\n }\n }),\n ({ store }) => Number(store.state.x.tagging.queryTaggingInfo?.params.totalHits) === 0,\n)\n\n/**.\n * Debounced version of {@link trackNoResultsQueryWithFallbackWire}\n *\n * @public\n */\nexport const trackNoResultsQueryWithFallbackWireDebounced = moduleDebounce(\n trackNoResultsQueryWithFallbackWire,\n ({ state }) => state.config.queryTaggingDebounceMs,\n { cancelOn: ['QueryPreviewUnmounted', 'RelatedPromptsUnmounted'] },\n)\n\n/**\n * Performs a track of a query with no results that used semantic queries as fallback.\n * The totalHits will be changed to -1 if semantic queries are found in order to differentiate\n * it from scenarios where the user encounters a no-results page without any semantic queries.\n *\n * @public\n * @deprecated - Use {@link trackNoResultsQueryWithFallbackWire} instead.\n */\nexport const trackNoResultsQueryWithSemanticsWire = trackNoResultsQueryWithFallbackWire\n\n/**\n * Debounced version of {@link trackNoResultsQueryWithFallbackWire}\n *\n * @public\n * @deprecated - Use {@link trackNoResultsQueryWithFallbackWireDebounced} instead.\n */\nexport const trackNoResultsQueryWithSemanticsWireDebounced =\n trackNoResultsQueryWithFallbackWireDebounced\n\n/**\n * Factory helper to create a wire for the track of the display click.\n *\n * @param property - Key of the tagging object to track.\n * @returns A new wire for the display click of the taggable element.\n *\n * @public\n */\nexport function createTrackDisplayWire(property: keyof Tagging): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload: { tagging }, metadata }) => {\n const taggingInfo: TaggingRequest = tagging[property]\n const location = metadata.location as FeatureLocation\n\n taggingInfo.params.location = location\n taggingInfo.params.displayFamily = createOrigin({\n feature: metadata.feature,\n location,\n })!\n taggingInfo.params.q = (metadata as DisplayWireMetadata).displayOriginalQuery\n\n return taggingInfo\n }),\n // eslint-disable-next-line ts/no-unsafe-member-access\n ({ eventPayload: { tagging } }) => !!tagging?.[property]?.url,\n )\n}\n\n/**\n * Update the tooling tagging params with the result information.\n *\n * @param taggingRequest - The tooling tagging request to be updated.\n * @param result - The clicked result.\n * @returns The tagging request updated.\n *\n * @internal\n */\nfunction updateToolingTaggingWithResult(\n taggingRequest: TaggingRequest,\n result: Result,\n): TaggingRequest {\n taggingRequest.params.productId = result.id\n taggingRequest.params.title = result.name!\n taggingRequest.params.url = result.url!\n\n return taggingRequest\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display click.\n *\n * @returns A new wire for the tooling display click of the taggable element.\n *\n * @public\n */\nexport function createTrackToolingDisplayWire(): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload, metadata }) => {\n const taggingInfo: TaggingRequest = metadata.toolingTagging as TaggingRequest\n const resultInfo = eventPayload as Result\n\n updateToolingTaggingWithResult(taggingInfo, resultInfo)\n\n return taggingInfo\n }),\n ({ metadata }) => !!metadata?.toolingTagging,\n )\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display add to cart.\n *\n * @returns A new wire for the tooling display add to cart of the taggable element.\n *\n * @public\n */\nexport function createTrackToolingAdd2CartWire(): Wire<Taggable> {\n return filter(\n wireDispatch('track', ({ eventPayload, metadata }) => {\n const taggingInfo: TaggingRequest = metadata.toolingAdd2CartTagging as TaggingRequest\n const resultInfo = eventPayload as Result\n\n updateToolingTaggingWithResult(taggingInfo, resultInfo)\n\n return taggingInfo\n }),\n ({ metadata }) => !!metadata?.toolingAdd2CartTagging,\n )\n}\n\n/**\n * Factory helper to create a wire for the track of the tooling display click in a related prompt.\n *\n * @returns A new wire for the tooling display click of the taggable element.\n *\n * @public\n */\nexport function createTrackRelatedPromptToolingDisplayClickWire() {\n return filter(\n wireDispatch('track', ({ metadata }) => {\n const relatedPrompt = metadata.relatedPrompt as RelatedPrompt\n const taggingInfo = relatedPrompt.tagging!.toolingDisplayClickTagging as TaggingRequest\n\n taggingInfo.params.productId = 'EXPAND'\n taggingInfo.params.title = relatedPrompt.suggestionText\n taggingInfo.params.url = 'none'\n\n return taggingInfo\n }),\n ({ metadata }) => {\n const relatedPrompt = metadata.relatedPrompt as RelatedPrompt | undefined\n const isUnselected = metadata?.selectedPrompt === -1\n const taggingInfo = relatedPrompt?.tagging?.toolingDisplayClickTagging\n return isUnselected && !!taggingInfo\n },\n )\n}\n\n/**\n * Factory helper to create a wire to set the queryTagging.\n *\n * @returns A new wire for the query of a result of a queryPreview.\n *\n * @public\n */\nexport function createSetQueryTaggingFromQueryPreview(): Wire<Taggable> {\n return filter(\n wireCommit(\n 'setQueryTaggingInfo',\n ({ metadata: { queryTagging } }) => queryTagging as TaggingRequest,\n ),\n ({ metadata: { queryTagging } }) => !!queryTagging,\n )\n}\n\n/**\n * Tracks query tagging of the AI suggestions-search.\n * @public\n */\nexport const trackAiSuggestionsSearchWire = wireDispatch('track', ({ eventPayload }) =>\n (eventPayload as AiSuggestionSearch[]).map(({ tagging }) => tagging.query),\n)\n\n/**\n * Wiring configuration for the {@link TaggingXModule | tagging module}.\n *\n * @internal\n */\nexport const taggingWiring = createWiring({\n ConsentProvided: {\n setConsent,\n },\n ConsentChanged: {\n clearSessionWire,\n },\n PDPIsLoaded: {\n moveClickedResultToSessionWire,\n },\n ResultURLTrackingEnabled: {\n moveClickedResultToSessionWire,\n },\n SearchTaggingChanged: {\n setQueryTaggingInfo,\n },\n SearchTaggingReceived: {\n trackQueryWire,\n },\n TrackableElementDisplayed: {\n trackElementDisplayedWire,\n },\n TaggingConfigProvided: {\n setTaggingConfig,\n },\n UserClickedAResult: {\n trackResultClickedWire,\n storeClickedResultWire,\n },\n UserClickedResultAddToCart: {\n trackAddToCartWire,\n trackResultClickedWire,\n storeAddToCartWire,\n },\n UserClickedPDPAddToCart: {\n trackAddToCartFromSessionStorage,\n },\n UserClickedABanner: {\n trackBannerClickedWire,\n },\n UserClickedAPromoted: {\n trackPromotedClickedWire,\n },\n UserClickedADisplayResult: {\n trackDisplayClickedWire,\n setQueryTaggingFromQueryPreview,\n },\n SemanticQueriesResponseChanged: {\n trackNoResultsQueryWithFallbackWireDebounced,\n },\n RelatedPromptsResponseChanged: {\n trackNoResultsQueryWithFallbackWireDebounced,\n },\n ModuleRegistered: {\n setNoResultsTaggingEnabledWire,\n },\n UserClickedARelatedPromptResult: {\n trackToolingDisplayClickedWire,\n },\n UserClickedARelatedPromptAdd2Cart: {\n trackToolingAdd2CartWire,\n },\n UserSelectedARelatedPrompt: {\n trackRelatedPromptToolingDisplayClickWire,\n },\n AiSuggestionsSearchChanged: {\n trackAiSuggestionsSearchWire,\n },\n UserClickedAnAiOverviewResult: {\n trackToolingDisplayClickedWire,\n },\n UserClickedAnAiOverviewAdd2Cart: {\n trackToolingAdd2CartWire,\n },\n})\n"],"names":[],"mappings":";;;;;;;;;;AAoBA;;;;AAIG;AACH,MAAM,UAAU,GAAG,SAAS;AAE5B;;AAEG;AACH,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC;AAErD;;;;AAIG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC;AAEnD;;;;AAIG;AACH,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC;AAEvD;;AAEG;AACH,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,qBAAqB,CAAC,QAAQ,CAAC;AAElG;;AAEG;AACH,MAAM,0BAA0B,GAAG,WAAW,CAAC,6BAA6B,CAAC,QAAQ,CAAC;AAEtF;;;;AAIG;AACH,MAAM,sBAAsB,GAAG,0BAA0B,CAAC,oBAAoB,CAAC;AAE/E;;;;AAIG;AACH,MAAM,kBAAkB,GAAG,0BAA0B,CAAC,gBAAgB,CAAC;AAEvE;;;;AAIG;AACH,MAAM,8BAA8B,GAAG,OAAO,CAC5C,0BAA0B,CAAC,sBAAsB,CAAC,EAClD,CAAC,OAAe,KAAI;IAClB,OAAO,OAAO,KAAK,KAAK,GAAG,SAAS,GAAG,OAAO;AAChD,CAAC,CACF;AAED;;;;AAIG;AACH,MAAM,gCAAgC,GAAG,0BAA0B,CAAC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A,qBAAqB,EAAE;QACrB,gBAAgB;AACjB,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,sBAAsB;QACtB,sBAAsB;AACvB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,kBAAkB;QAClB,sBAAsB;QACtB,kBAAkB;AACnB,KAAA;AACD,IAAA,uBAAuB,EAAE;QACvB,gCAAgC;AACjC,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,sBAAsB;AACvB,KAAA;AACD,IAAA,oBAAoB,EAAE;QACpB,wBAAwB;AACzB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,uBAAuB;QACvB,+BAA+B;AAChC,KAAA;AACD,IAAA,8BAA8B,EAAE;QAC9B,4CAA4C;AAC7C,KAAA;AACD,IAAA,6BAA6B,EAAE;QAC7B,4CAA4C;AAC7C,KAAA;AACD,IAAA,gBAAgB,EAAE;QAChB,8BAA8B;AAC/B,KAAA;AACD,IAAA,+BAA+B,EAAE;QAC/B,8BAA8B;AAC/B,KAAA;AACD,IAAA,iCAAiC,EAAE;QACjC,wBAAwB;AACzB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,yCAAyC;AAC1C,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,4BAA4B;AAC7B,KAAA;AACD,IAAA,6BAA6B,EAAE;QAC7B,8BAA8B;AAC/B,KAAA;AACD,IAAA,+BAA+B,EAAE;QAC/B,wBAAwB;AACzB,KAAA;AACF,CAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empathyco/x-components",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.239",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -83,9 +83,10 @@
|
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@babel/preset-env": "7.29.2",
|
|
86
|
-
"@empathyco/x-
|
|
86
|
+
"@empathyco/x-design-system": "0.1.0-alpha.3",
|
|
87
87
|
"@microsoft/api-documenter": "7.29.9",
|
|
88
88
|
"@microsoft/api-extractor": "7.58.0",
|
|
89
|
+
"@tailwindcss/vite": "4.2.2",
|
|
89
90
|
"@testing-library/vue": "8.1.0",
|
|
90
91
|
"@types/aria-query": "5.0.4",
|
|
91
92
|
"@types/node": "24.12.2",
|
|
@@ -93,13 +94,9 @@
|
|
|
93
94
|
"@vitest/browser": "4.1.2",
|
|
94
95
|
"@vitest/ui": "4.1.2",
|
|
95
96
|
"@vue/test-utils": "2.4.6",
|
|
96
|
-
"autoprefixer": "10.4.27",
|
|
97
97
|
"convert-source-map": "2.0.0",
|
|
98
98
|
"esbuild": "0.28.0",
|
|
99
99
|
"jsdom": "28.1.0",
|
|
100
|
-
"postcss": "8.5.8",
|
|
101
|
-
"postcss-dir-pseudo-class": "7.0.2",
|
|
102
|
-
"postcss-logical": "4.0.2",
|
|
103
100
|
"rollup": "4.60.1",
|
|
104
101
|
"rollup-plugin-copy": "3.5.0",
|
|
105
102
|
"rollup-plugin-delete": "2.2.0",
|
|
@@ -107,10 +104,10 @@
|
|
|
107
104
|
"rollup-plugin-typescript2": "0.37.0",
|
|
108
105
|
"rollup-plugin-vue": "6.0.0",
|
|
109
106
|
"start-server-and-test": "2.1.5",
|
|
110
|
-
"tailwindcss": "
|
|
107
|
+
"tailwindcss": "4.2.2",
|
|
111
108
|
"ts-node": "10.9.2",
|
|
112
109
|
"typescript": "5.9.3",
|
|
113
|
-
"vite": "6.4.
|
|
110
|
+
"vite": "6.4.2",
|
|
114
111
|
"vite-plugin-vue-inspector": "5.4.0",
|
|
115
112
|
"vitest": "4.1.2",
|
|
116
113
|
"vue": "3.5.32",
|
|
@@ -122,5 +119,5 @@
|
|
|
122
119
|
"access": "public",
|
|
123
120
|
"directory": "dist"
|
|
124
121
|
},
|
|
125
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "cb1002d210e4731704977a5d86193fcc5f2d0406"
|
|
126
123
|
}
|