@empathyco/x-components 6.0.0-alpha.63 → 6.0.0-alpha.65
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 +269 -902
- package/design-system/deprecated-full-theme.css +348 -348
- package/docs/API-reference/api/x-components.fallbackdisclaimer.md +2 -2
- package/docs/API-reference/api/x-components.historyqueriesswitch.md +1 -1
- package/docs/API-reference/api/x-components.identifierresult.md +1 -1
- package/docs/API-reference/api/x-components.identifierresults.md +1 -1
- package/docs/API-reference/api/x-components.md +1 -1
- package/docs/API-reference/api/x-components.myhistory.md +1 -1
- package/docs/API-reference/api/x-components.partialresultslist.md +1 -1
- package/docs/API-reference/api/x-components.querypreview.md +2 -2
- package/docs/API-reference/api/x-components.recommendations.md +1 -1
- package/docs/API-reference/api/x-components.relatedpromptstaglist.md +2 -2
- package/docs/API-reference/api/x-components.relatedtag.md +3 -3
- package/docs/API-reference/api/x-components.scrolltotop.md +1 -1
- package/docs/API-reference/api/x-components.searchbutton.md +1 -1
- package/docs/API-reference/api/x-components.searchinput.md +1 -1
- package/docs/API-reference/api/x-components.semanticqueries.md +1 -1
- package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
- package/docs/API-reference/api/x-components.sortlist.md +1 -1
- package/docs/API-reference/api/x-components.sortpickerlist.md +1 -1
- package/docs/API-reference/api/x-components.spellcheck.md +2 -2
- package/docs/API-reference/api/x-components.spellcheckbutton.md +1 -1
- package/docs/API-reference/api/x-components.usestate.md +5 -4
- package/js/composables/use-state.js +7 -9
- package/js/composables/use-state.js.map +1 -1
- package/js/x-modules/extra-params/components/extra-params.vue.js +1 -1
- package/js/x-modules/extra-params/components/extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/renderless-extra-param.vue.js +1 -1
- package/js/x-modules/extra-params/components/renderless-extra-param.vue.js.map +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 +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-switch.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries-switch.vue2.js +1 -4
- package/js/x-modules/history-queries/components/history-queries-switch.vue2.js.map +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 +1 -1
- package/js/x-modules/history-queries/components/my-history.vue2.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue2.js +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue2.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue2.js +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue2.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue.js +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query-preview.vue2.js +1 -1
- package/js/x-modules/next-queries/components/next-query-preview.vue2.js.map +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 +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.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js +6 -11
- package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue2.js +1 -3
- package/js/x-modules/recommendations/components/recommendations.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +1 -4
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +1 -6
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +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/main-scroll-item.vue.js.map +1 -1
- package/js/x-modules/scroll/components/main-scroll-item.vue2.js +1 -1
- package/js/x-modules/scroll/components/main-scroll-item.vue2.js.map +1 -1
- package/js/x-modules/scroll/components/main-scroll.vue.js +1 -1
- package/js/x-modules/scroll/components/main-scroll.vue.js.map +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 +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/search/components/banners-list.vue.js +1 -1
- package/js/x-modules/search/components/banners-list.vue.js.map +1 -1
- package/js/x-modules/search/components/fallback-disclaimer.vue.js.map +1 -1
- package/js/x-modules/search/components/fallback-disclaimer.vue2.js +1 -4
- package/js/x-modules/search/components/fallback-disclaimer.vue2.js.map +1 -1
- package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/partial-results-list.vue2.js +1 -3
- package/js/x-modules/search/components/partial-results-list.vue2.js.map +1 -1
- package/js/x-modules/search/components/promoteds-list.vue.js +1 -1
- package/js/x-modules/search/components/promoteds-list.vue.js.map +1 -1
- package/js/x-modules/search/components/redirection.vue.js.map +1 -1
- package/js/x-modules/search/components/redirection.vue2.js +1 -1
- package/js/x-modules/search/components/redirection.vue2.js.map +1 -1
- package/js/x-modules/search/components/results-list.vue.js +1 -7
- package/js/x-modules/search/components/results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-dropdown.vue2.js +1 -1
- package/js/x-modules/search/components/sort-dropdown.vue2.js.map +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 +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/components/spellcheck-button.vue.js.map +1 -1
- package/js/x-modules/search/components/spellcheck-button.vue2.js +1 -1
- package/js/x-modules/search/components/spellcheck-button.vue2.js.map +1 -1
- package/js/x-modules/search/components/spellcheck.vue.js.map +1 -1
- package/js/x-modules/search/components/spellcheck.vue2.js +1 -1
- package/js/x-modules/search/components/spellcheck.vue2.js.map +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 +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.map +1 -1
- package/js/x-modules/search-box/components/search-button.vue2.js +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.map +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue2.js +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.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input.vue2.js +1 -1
- package/js/x-modules/search-box/components/search-input.vue2.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-queries.vue.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js +1 -3
- package/js/x-modules/semantic-queries/components/semantic-queries.vue2.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue2.js +1 -1
- package/js/x-modules/url/components/url-handler.vue2.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +63 -70
- package/report/x-components.api.md +21 -19
- package/types/composables/use-state.d.ts +4 -5
- package/types/composables/use-state.d.ts.map +1 -1
- package/types/x-modules/extra-params/components/extra-params.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-queries-switch.vue.d.ts +1 -1
- package/types/x-modules/history-queries/components/history-queries-switch.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/my-history.vue.d.ts +1 -1
- package/types/x-modules/identifier-results/components/identifier-result.vue.d.ts +1 -1
- package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +1 -1
- package/types/x-modules/queries-preview/components/query-preview.vue.d.ts +3 -3
- package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -1
- package/types/x-modules/recommendations/components/recommendations.vue.d.ts +1 -2
- package/types/x-modules/recommendations/components/recommendations.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +3 -3
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/x-modules/related-tags/components/related-tag.vue.d.ts +4 -4
- package/types/x-modules/related-tags/components/related-tag.vue.d.ts.map +1 -1
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +1 -1
- package/types/x-modules/search/components/banners-list.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/fallback-disclaimer.vue.d.ts +2 -2
- package/types/x-modules/search/components/fallback-disclaimer.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/partial-results-list.vue.d.ts +1 -3
- package/types/x-modules/search/components/partial-results-list.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/promoteds-list.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/results-list.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
- package/types/x-modules/search/components/sort-list.vue.d.ts +1 -1
- package/types/x-modules/search/components/sort-picker-list.vue.d.ts +1 -1
- package/types/x-modules/search/components/spellcheck-button.vue.d.ts +1 -1
- package/types/x-modules/search/components/spellcheck.vue.d.ts +2 -2
- package/types/x-modules/search-box/components/search-button.vue.d.ts +1 -2
- package/types/x-modules/search-box/components/search-button.vue.d.ts.map +1 -1
- package/types/x-modules/search-box/components/search-input.vue.d.ts +1 -1
- package/types/x-modules/semantic-queries/components/semantic-queries.vue.d.ts +1 -3
- package/types/x-modules/semantic-queries/components/semantic-queries.vue.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-queries.vue.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n v-if=\"suggestions.length\"\n v-slot=\"baseSuggestionsScope\"\n class=\"x-semantic-queries\"\n :suggestions=\"suggestions\"\n >\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n -->\n <slot name=\"suggestion\" v-bind=\"baseSuggestionsScope\">\n <SemanticQuery v-slot=\"baseSuggestionScope\" :suggestion=\"baseSuggestionsScope.suggestion\">\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n -->\n <slot name=\"suggestion-content\" v-bind=\"baseSuggestionScope\" />\n </SemanticQuery>\n </slot>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport
|
|
1
|
+
{"version":3,"file":"semantic-queries.vue.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n v-if=\"suggestions.length\"\n v-slot=\"baseSuggestionsScope\"\n class=\"x-semantic-queries\"\n :suggestions=\"suggestions\"\n >\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n -->\n <slot name=\"suggestion\" v-bind=\"baseSuggestionsScope\">\n <SemanticQuery v-slot=\"baseSuggestionScope\" :suggestion=\"baseSuggestionsScope.suggestion\">\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n -->\n <slot name=\"suggestion-content\" v-bind=\"baseSuggestionScope\" />\n </SemanticQuery>\n </slot>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useState } from '../../../composables'\nimport { semanticQueriesXModule } from '../x-module'\nimport SemanticQuery from './semantic-query.vue'\n\n/**\n * Retrieves a list of semantic queries from the state and exposes them in the slots.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SemanticQueries',\n xModule: semanticQueriesXModule.name,\n components: { BaseSuggestions, SemanticQuery },\n setup(_, { slots }) {\n /** The semantic queries from the state. */\n const suggestions = useState('semanticQueries').semanticQueries\n\n /**\n * Maps the list of semantic queries to a list of queries, to make it compatible with\n * other components.\n */\n const queries = computed(() => suggestions.value.map(suggestion => suggestion.query))\n\n /**\n * Finds a {@link @empathyco/x-types#Suggestion} given a query.\n *\n * @param query - The query to search.\n * @returns The {@link @empathyco/x-types#Suggestion} or undefined if not found.\n */\n function findSemanticQuery(query: string) {\n return suggestions.value.find(suggestion => suggestion.query === query)\n }\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no suggestions, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are\n * no suggestions.\n */\n function renderDefaultSlot() {\n const slotProps = {\n suggestions: suggestions.value,\n queries: queries.value,\n findSemanticQuery,\n }\n return suggestions.value.length ? slots.default?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { suggestions }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nBy default, the `SemanticQueries` component will render a list of semantic queries.\n\n```vue\n<template>\n <SemanticQueries />\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\n\nexport default {\n name: 'SemanticQueriesDemo',\n components: {\n SemanticQueries,\n },\n}\n</script>\n```\n\n### Play with props\n\nThe component has the following props:\n\n- maxItemsToRender to limit the number of semantic queries to render.\n- animation to specify the animation to be used to animate the semantic queries.\n\n```vue live\n<template>\n <SemanticQueries :animation=\"animation\" :maxItemsToRender=\"3\" />\n</template>\n\n<script>\nimport { FadeAndSlide } from '@empathyco/x-components'\n\nexport default {\n name: 'SemanticQueriesPropsDemo',\n data() {\n return {\n animation: FadeAndSlide,\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nThe default slot is used to overwrite the whole content of the component.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ suggestions }\">\n <section>\n <SlidingPanel>\n <div v-for=\"suggestion in suggestions\">\n {{ suggestion.query }}\n {{ suggestion.distance }}\n </div>\n </SlidingPanel>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SemanticQueriesDefaultSlotDemo',\n components: {\n SemanticQueries,\n SlidingPanel,\n },\n}\n</script>\n```\n\nThe default slot also exposes an array of semantic queries mapped to strings, and a method to find a\nsemantic query given a string query.\n\nThis is useful if you need an array of string queries, but also need to retrieve the original\nsemantic query to use it in another element.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ queries, findSemanticQuery }\">\n <section>\n <QueryPreviewList :queries=\"queries\" #slot=\"{ query, results }\">\n <div>\n <SemanticQuery :semanticQuery=\"findSemanticQuery(query)\" #default=\"{ query }\">\n {{ query.query }} ({{ query.distance }})\n </SemanticQuery>\n <ul>\n <li v-for=\"result in results\" :key=\"result.id\">\n {{ result.name }}\n </li>\n </ul>\n </div>\n </QueryPreviewList>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries, SemanticQuery } from '@empathyco/x-components/semantic-queries'\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'SemanticQueriesDefaultSlotDemo2',\n components: {\n SemanticQueries,\n SemanticQuery,\n QueryPreviewList,\n },\n}\n</script>\n```\n\n### Play with the suggestion slot\n\nThe suggestion slot can be used to override each semantic query item.\n\nIn this example, the query will be rendered along with the distance.\n\n```vue live\n<template>\n <SemanticQueries #suggestion=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\nexport default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries,\n },\n}\n</script>\n```\n\n### Play with the suggestion content slot\n\nThe suggsetion content slot can be used to override only the content, but keep using the\nSemanticQuery component internally.\n\n```vue live\n<template>\n <SemanticQueries #suggestion-content=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\nexport default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode","_createCommentVNode"],"mappings":";;;;;;AAE4B,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AAF5B,EAAA,OAAA,IAAA,CAAA,WAAA,CAAA,MAAA,IAAAC,SAAA,EAI8B,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IACzB,GAAA,EAAA,CAAA;AAAA,IAAA,KAAA,EAAA,oBAAA;IALL,WAYI,EAAA,IAAA,CAAA,WAAA;AAAA,GAAA,EAAA;aACEC,OAOgB,CAAA,CAAA,oBAAA,KAAA;AAAA,MAP6BC,UAAA,CAAA,IAAA,CAAY,sBAAqBC,cAAU,CAAAC,kBAAA,CAAA,oBAAA,CAAA,CAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAAA,wBAAA,EAAA;UAb9F,UAa6B,EAAA,oBAAA,CAAA,UAAA;AAAA,SAAA,EAAA;;AAb7B,YAAAH,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,mBAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;AAAA,OAAA,CAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,EAAA,CAAA,EAAA,CAAA,aAAA,CAAA,CAAA,IAAAE,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -26,9 +26,7 @@ var _sfc_main = defineComponent({
|
|
|
26
26
|
components: { BaseSuggestions, SemanticQuery },
|
|
27
27
|
setup(_, { slots }) {
|
|
28
28
|
/** The semantic queries from the state. */
|
|
29
|
-
const suggestions = useState('semanticQueries'
|
|
30
|
-
'semanticQueries',
|
|
31
|
-
]).semanticQueries;
|
|
29
|
+
const suggestions = useState('semanticQueries').semanticQueries;
|
|
32
30
|
/**
|
|
33
31
|
* Maps the list of semantic queries to a list of queries, to make it compatible with
|
|
34
32
|
* other components.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantic-queries.vue2.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n v-if=\"suggestions.length\"\n v-slot=\"baseSuggestionsScope\"\n class=\"x-semantic-queries\"\n :suggestions=\"suggestions\"\n >\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n -->\n <slot name=\"suggestion\" v-bind=\"baseSuggestionsScope\">\n <SemanticQuery v-slot=\"baseSuggestionScope\" :suggestion=\"baseSuggestionsScope.suggestion\">\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n -->\n <slot name=\"suggestion-content\" v-bind=\"baseSuggestionScope\" />\n </SemanticQuery>\n </slot>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport
|
|
1
|
+
{"version":3,"file":"semantic-queries.vue2.js","sources":["../../../../../src/x-modules/semantic-queries/components/semantic-queries.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n v-if=\"suggestions.length\"\n v-slot=\"baseSuggestionsScope\"\n class=\"x-semantic-queries\"\n :suggestions=\"suggestions\"\n >\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, index: number - Suggestion index}} v-bind\n BaseSuggestion bindings\n -->\n <slot name=\"suggestion\" v-bind=\"baseSuggestionsScope\">\n <SemanticQuery v-slot=\"baseSuggestionScope\" :suggestion=\"baseSuggestionsScope.suggestion\">\n <!--\n @slot Semantic Query content\n @binding {{suggestion: object - Suggestion data, query: string - The query that the\n suggestion belongs to}} v-bind SemanticQuery bindings\n -->\n <slot name=\"suggestion-content\" v-bind=\"baseSuggestionScope\" />\n </SemanticQuery>\n </slot>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useState } from '../../../composables'\nimport { semanticQueriesXModule } from '../x-module'\nimport SemanticQuery from './semantic-query.vue'\n\n/**\n * Retrieves a list of semantic queries from the state and exposes them in the slots.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SemanticQueries',\n xModule: semanticQueriesXModule.name,\n components: { BaseSuggestions, SemanticQuery },\n setup(_, { slots }) {\n /** The semantic queries from the state. */\n const suggestions = useState('semanticQueries').semanticQueries\n\n /**\n * Maps the list of semantic queries to a list of queries, to make it compatible with\n * other components.\n */\n const queries = computed(() => suggestions.value.map(suggestion => suggestion.query))\n\n /**\n * Finds a {@link @empathyco/x-types#Suggestion} given a query.\n *\n * @param query - The query to search.\n * @returns The {@link @empathyco/x-types#Suggestion} or undefined if not found.\n */\n function findSemanticQuery(query: string) {\n return suggestions.value.find(suggestion => suggestion.query === query)\n }\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no suggestions, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are\n * no suggestions.\n */\n function renderDefaultSlot() {\n const slotProps = {\n suggestions: suggestions.value,\n queries: queries.value,\n findSemanticQuery,\n }\n return suggestions.value.length ? slots.default?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { suggestions }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nBy default, the `SemanticQueries` component will render a list of semantic queries.\n\n```vue\n<template>\n <SemanticQueries />\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\n\nexport default {\n name: 'SemanticQueriesDemo',\n components: {\n SemanticQueries,\n },\n}\n</script>\n```\n\n### Play with props\n\nThe component has the following props:\n\n- maxItemsToRender to limit the number of semantic queries to render.\n- animation to specify the animation to be used to animate the semantic queries.\n\n```vue live\n<template>\n <SemanticQueries :animation=\"animation\" :maxItemsToRender=\"3\" />\n</template>\n\n<script>\nimport { FadeAndSlide } from '@empathyco/x-components'\n\nexport default {\n name: 'SemanticQueriesPropsDemo',\n data() {\n return {\n animation: FadeAndSlide,\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nThe default slot is used to overwrite the whole content of the component.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ suggestions }\">\n <section>\n <SlidingPanel>\n <div v-for=\"suggestion in suggestions\">\n {{ suggestion.query }}\n {{ suggestion.distance }}\n </div>\n </SlidingPanel>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SemanticQueriesDefaultSlotDemo',\n components: {\n SemanticQueries,\n SlidingPanel,\n },\n}\n</script>\n```\n\nThe default slot also exposes an array of semantic queries mapped to strings, and a method to find a\nsemantic query given a string query.\n\nThis is useful if you need an array of string queries, but also need to retrieve the original\nsemantic query to use it in another element.\n\n```vue live\n<template>\n <SemanticQueries #default=\"{ queries, findSemanticQuery }\">\n <section>\n <QueryPreviewList :queries=\"queries\" #slot=\"{ query, results }\">\n <div>\n <SemanticQuery :semanticQuery=\"findSemanticQuery(query)\" #default=\"{ query }\">\n {{ query.query }} ({{ query.distance }})\n </SemanticQuery>\n <ul>\n <li v-for=\"result in results\" :key=\"result.id\">\n {{ result.name }}\n </li>\n </ul>\n </div>\n </QueryPreviewList>\n </section>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries, SemanticQuery } from '@empathyco/x-components/semantic-queries'\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'SemanticQueriesDefaultSlotDemo2',\n components: {\n SemanticQueries,\n SemanticQuery,\n QueryPreviewList,\n },\n}\n</script>\n```\n\n### Play with the suggestion slot\n\nThe suggestion slot can be used to override each semantic query item.\n\nIn this example, the query will be rendered along with the distance.\n\n```vue live\n<template>\n <SemanticQueries #suggestion=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\nexport default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries,\n },\n}\n</script>\n```\n\n### Play with the suggestion content slot\n\nThe suggsetion content slot can be used to override only the content, but keep using the\nSemanticQuery component internally.\n\n```vue live\n<template>\n <SemanticQueries #suggestion-content=\"{ suggestion: { query, distance } }\">\n <span>\n ({{ distance }})\n {{ query }}\n </span>\n </SemanticQueries>\n</template>\n\n<script>\nimport { SemanticQueries } from '@empathyco/x-components/semantic-queries'\nexport default {\n name: 'SemanticQueriesItemSlotDemo',\n components: {\n SemanticQueries,\n },\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,sBAAsB,CAAC,IAAI;AACpC,IAAA,UAAU,EAAE,EAAE,eAAe,EAAE,eAAe;AAC9C,IAAA,KAAK,CAAC,CAAC,EAAE,EAAE,KAAI,EAAG,EAAA;;QAEhB,MAAM,WAAY,GAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,eAAc,CAAA;AAE9D;;;AAGE;QACF,MAAM,OAAQ,GAAE,QAAQ,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,UAAS,IAAK,UAAU,CAAC,KAAK,CAAC,CAAA,CAAA;AAEpF;;;;;AAKE;QACF,SAAS,iBAAiB,CAAC,KAAa,EAAA;AACtC,YAAA,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,UAAW,IAAG,UAAU,CAAC,KAAI,KAAM,KAAK,CAAA,CAAA;SACxE;AAEA;;;;;;;;;;AAUE;AACF,QAAA,SAAS,iBAAiB,GAAA;AACxB,YAAA,MAAM,YAAY;gBAChB,WAAW,EAAE,WAAW,CAAC,KAAK;gBAC9B,OAAO,EAAE,OAAO,CAAC,KAAK;gBACtB,iBAAiB;aACnB,CAAA;YACA,OAAO,WAAW,CAAC,KAAK,CAAC,MAAO,GAAE,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAE,GAAE,EAAC,CAAA;SACrE;AAEA;AAC+E;AAC/E,QAAA,MAAM,cAAe,GAAE,EAAE,WAAY,EAAA,CAAA;AACrC,QAAA,QAAQ,KAAK,CAAC,OAAM,GAAI,iBAAkB,GAAE,cAAc,EAAyB;KACpF;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-handler.vue.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents target=\"window\" @pageshow=\"onPageShow\" @popstate=\"emitEvents\" />\n</template>\n\n<script lang=\"ts\">\nimport type { Dictionary } from '@empathyco/x-utils'\nimport type { FeatureLocation } from '../../../types/origin'\nimport type { UrlParams } from '../../../types/url-params'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport type { SnippetConfig } from '../../../x-installer/api/api.types'\nimport type { UrlParamValue } from '../store/types'\nimport { objectFilter } from '@empathyco/x-utils'\nimport { computed, defineComponent, inject, onMounted, ref } from 'vue'\nimport { GlobalEvents } from 'vue-global-events'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { initialUrlState } from '../store/initial-state'\nimport { urlXModule } from '../x-module'\n\ninterface ParsedUrlParams {\n all: UrlParams\n extra: Dictionary<unknown>\n}\n\n/**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\nexport default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents,\n },\n xModule: urlXModule.name,\n setup(_, { attrs }) {\n const $x = use$x()\n\n const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig')\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false)\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined)\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false)\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }))\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string) => {\n const paramValue = attrs[paramName]\n return typeof paramValue === 'string' ? paramValue : paramName\n }\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL) => {\n managedParamsNames.value.forEach(paramName => url.searchParams.delete(getUrlKey(paramName)))\n }\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1\n })\n }\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string),\n )\n const sortedParameters = sortParams(filteredParams)\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName)\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value))\n })\n } else {\n url.searchParams.set(urlParamKey, String(paramValue))\n }\n })\n }\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState'],\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href)\n deleteUrlParameters(newUrl)\n setUrlParameters(newUrl, newUrlParams)\n\n // Normalize '+' characters into '%20' for spaces in url params.\n newUrl.search = newUrl.search.replace(/\\+/g, '%20')\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href)\n }\n url.value = newUrl\n }\n }\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history))\n })\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history))\n })\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined\n }\n }\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0])\n case 'boolean':\n return value[0].toLowerCase() === 'true'\n case 'string':\n return value[0]\n default:\n // array\n return value\n }\n }\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name)\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey)\n params.all[name] = parseUrlParam(name, urlValue)\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey)\n }\n }\n return params\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } },\n )\n }\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value\n const navigationEntries = window.performance.getEntriesByType('navigation')\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload')\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n }\n }\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href)\n const previousUrl = url.value\n url.value = currentUrl\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search && previousUrl?.pathname === currentUrl.pathname\n if (isInternalNavigation) {\n return 'url_history'\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp'\n }\n\n return 'external'\n }\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation(),\n }\n }\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams()\n const metadata = createWireMetadata()\n $x.emit('ParamsLoadedFromUrl', all, metadata)\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata)\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata)\n }\n urlLoaded.value = true\n }\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents()\n })\n\n return {\n onPageShow,\n emitEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nThis component manages the browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock"],"mappings":";;;;;kCACEA,gBAA8E,CAAA,cAAA,CAAA,CAAA;AAA/C,EAAA,OAAAC,SAAA,EAAoB,EAAAC,WAAA,CAAA,uBAAA,EAAA;AAAA,IAAG,MAAA,EAAA,QAAA;AAAA,IAAA,UAAA,EAAA,IAAA,CAAA,UAAA;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"url-handler.vue.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents target=\"window\" @pageshow=\"onPageShow\" @popstate=\"emitEvents\" />\n</template>\n\n<script lang=\"ts\">\nimport type { Dictionary } from '@empathyco/x-utils'\nimport type { FeatureLocation } from '../../../types/origin'\nimport type { UrlParams } from '../../../types/url-params'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport type { SnippetConfig } from '../../../x-installer/api/api.types'\nimport type { UrlParamValue } from '../store/types'\nimport { objectFilter } from '@empathyco/x-utils'\nimport { computed, defineComponent, inject, onMounted, ref } from 'vue'\nimport { GlobalEvents } from 'vue-global-events'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { initialUrlState } from '../store/initial-state'\nimport { urlXModule } from '../x-module'\n\ninterface ParsedUrlParams {\n all: UrlParams\n extra: Dictionary<unknown>\n}\n\n/**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\nexport default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents,\n },\n xModule: urlXModule.name,\n setup(_, { attrs }) {\n const $x = use$x()\n\n const { initialExtraParams } = useState('url')\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig')\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false)\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined)\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false)\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }))\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string) => {\n const paramValue = attrs[paramName]\n return typeof paramValue === 'string' ? paramValue : paramName\n }\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL) => {\n managedParamsNames.value.forEach(paramName => url.searchParams.delete(getUrlKey(paramName)))\n }\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1\n })\n }\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string),\n )\n const sortedParameters = sortParams(filteredParams)\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName)\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value))\n })\n } else {\n url.searchParams.set(urlParamKey, String(paramValue))\n }\n })\n }\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState'],\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href)\n deleteUrlParameters(newUrl)\n setUrlParameters(newUrl, newUrlParams)\n\n // Normalize '+' characters into '%20' for spaces in url params.\n newUrl.search = newUrl.search.replace(/\\+/g, '%20')\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href)\n }\n url.value = newUrl\n }\n }\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history))\n })\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history))\n })\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined\n }\n }\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0])\n case 'boolean':\n return value[0].toLowerCase() === 'true'\n case 'string':\n return value[0]\n default:\n // array\n return value\n }\n }\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name)\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey)\n params.all[name] = parseUrlParam(name, urlValue)\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey)\n }\n }\n return params\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } },\n )\n }\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value\n const navigationEntries = window.performance.getEntriesByType('navigation')\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload')\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n }\n }\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href)\n const previousUrl = url.value\n url.value = currentUrl\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search && previousUrl?.pathname === currentUrl.pathname\n if (isInternalNavigation) {\n return 'url_history'\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp'\n }\n\n return 'external'\n }\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation(),\n }\n }\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams()\n const metadata = createWireMetadata()\n $x.emit('ParamsLoadedFromUrl', all, metadata)\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata)\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata)\n }\n urlLoaded.value = true\n }\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents()\n })\n\n return {\n onPageShow,\n emitEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nThis component manages the browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock"],"mappings":";;;;;kCACEA,gBAA8E,CAAA,cAAA,CAAA,CAAA;AAA/C,EAAA,OAAAC,SAAA,EAAoB,EAAAC,WAAA,CAAA,uBAAA,EAAA;AAAA,IAAG,MAAA,EAAA,QAAA;AAAA,IAAA,UAAA,EAAA,IAAA,CAAA,UAAA;;;;;;;;"}
|
|
@@ -22,7 +22,7 @@ var _sfc_main = defineComponent({
|
|
|
22
22
|
xModule: urlXModule.name,
|
|
23
23
|
setup(_, { attrs }) {
|
|
24
24
|
const $x = use$x();
|
|
25
|
-
const initialExtraParams = useState('url'
|
|
25
|
+
const { initialExtraParams } = useState('url');
|
|
26
26
|
/**
|
|
27
27
|
* The {@link SnippetConfig} provided by an ancestor.
|
|
28
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-handler.vue2.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents target=\"window\" @pageshow=\"onPageShow\" @popstate=\"emitEvents\" />\n</template>\n\n<script lang=\"ts\">\nimport type { Dictionary } from '@empathyco/x-utils'\nimport type { FeatureLocation } from '../../../types/origin'\nimport type { UrlParams } from '../../../types/url-params'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport type { SnippetConfig } from '../../../x-installer/api/api.types'\nimport type { UrlParamValue } from '../store/types'\nimport { objectFilter } from '@empathyco/x-utils'\nimport { computed, defineComponent, inject, onMounted, ref } from 'vue'\nimport { GlobalEvents } from 'vue-global-events'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { initialUrlState } from '../store/initial-state'\nimport { urlXModule } from '../x-module'\n\ninterface ParsedUrlParams {\n all: UrlParams\n extra: Dictionary<unknown>\n}\n\n/**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\nexport default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents,\n },\n xModule: urlXModule.name,\n setup(_, { attrs }) {\n const $x = use$x()\n\n const initialExtraParams = useState('url', ['initialExtraParams']).initialExtraParams\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig')\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false)\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined)\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false)\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }))\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string) => {\n const paramValue = attrs[paramName]\n return typeof paramValue === 'string' ? paramValue : paramName\n }\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL) => {\n managedParamsNames.value.forEach(paramName => url.searchParams.delete(getUrlKey(paramName)))\n }\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1\n })\n }\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string),\n )\n const sortedParameters = sortParams(filteredParams)\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName)\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value))\n })\n } else {\n url.searchParams.set(urlParamKey, String(paramValue))\n }\n })\n }\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState'],\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href)\n deleteUrlParameters(newUrl)\n setUrlParameters(newUrl, newUrlParams)\n\n // Normalize '+' characters into '%20' for spaces in url params.\n newUrl.search = newUrl.search.replace(/\\+/g, '%20')\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href)\n }\n url.value = newUrl\n }\n }\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history))\n })\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history))\n })\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined\n }\n }\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0])\n case 'boolean':\n return value[0].toLowerCase() === 'true'\n case 'string':\n return value[0]\n default:\n // array\n return value\n }\n }\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name)\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey)\n params.all[name] = parseUrlParam(name, urlValue)\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey)\n }\n }\n return params\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } },\n )\n }\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value\n const navigationEntries = window.performance.getEntriesByType('navigation')\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload')\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n }\n }\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href)\n const previousUrl = url.value\n url.value = currentUrl\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search && previousUrl?.pathname === currentUrl.pathname\n if (isInternalNavigation) {\n return 'url_history'\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp'\n }\n\n return 'external'\n }\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation(),\n }\n }\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams()\n const metadata = createWireMetadata()\n $x.emit('ParamsLoadedFromUrl', all, metadata)\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata)\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata)\n }\n urlLoaded.value = true\n }\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents()\n })\n\n return {\n onPageShow,\n emitEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nThis component manages the browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;AAyBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,UAAU,EAAE;QACV,YAAY;AACb,KAAA;IACD,OAAO,EAAE,UAAU,CAAC,IAAI;AACxB,IAAA,KAAK,CAAC,CAAC,EAAE,EAAE,KAAI,EAAG,EAAA;AAChB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC,CAAA;AAEjB,QAAA,MAAM,kBAAmB,GAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,kBAAiB,CAAA;AAEpF;;;;AAIE;AACF,QAAA,MAAM,aAAY,GAAI,MAAM,CAA4B,eAAe,CAAA,CAAA;AAEvE;;;;AAIE;AACF,QAAA,MAAM,SAAU,GAAE,GAAG,CAAC,KAAK,CAAA,CAAA;AAE3B;;;;AAIE;AACF,QAAA,MAAM,GAAE,GAAI,GAAG,CAAkB,SAAS,CAAA,CAAA;AAE1C;;;;AAIE;AACF,QAAA,MAAM,eAAgB,GAAE,GAAG,CAAC,KAAK,CAAA,CAAA;AAEjC;;;;;;;;AAQE;QACF,MAAM,kBAAmB,GAAE,QAAQ,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,eAAe,EAAE,GAA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AE,KAAM,EAAA,GAAI,cAAc,EAAC,CAAA;AACtC,YAAA,MAAM,QAAO,GAAI,kBAAkB,EAAC,CAAA;YACpC,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,QAAQ,CAAA,CAAA;YAC5C,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,EAAE,QAAQ,CAAA,CAAA;YACnD,IAAI,GAAG,CAAC,KAAK,EAAE;gBACb,EAAE,CAAC,IAAI,CAAC,2BAA2B,EAAE,SAAS,EAAE,QAAQ,CAAA,CAAA;AAC1D,aAAA;AACA,YAAA,SAAS,CAAC,QAAQ,IAAG,CAAA;AACvB,SAAA,CAAA;AAEA;;;AAGE;QACF,SAAS,CAAC,MAAM;AACd,YAAA,UAAU,EAAC,CAAA;AACb,SAAC,CAAA,CAAA;QAED,OAAO;YACL,UAAU;YACV,UAAU;SACZ,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"url-handler.vue2.js","sources":["../../../../../src/x-modules/url/components/url-handler.vue"],"sourcesContent":["<template>\n <GlobalEvents target=\"window\" @pageshow=\"onPageShow\" @popstate=\"emitEvents\" />\n</template>\n\n<script lang=\"ts\">\nimport type { Dictionary } from '@empathyco/x-utils'\nimport type { FeatureLocation } from '../../../types/origin'\nimport type { UrlParams } from '../../../types/url-params'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport type { SnippetConfig } from '../../../x-installer/api/api.types'\nimport type { UrlParamValue } from '../store/types'\nimport { objectFilter } from '@empathyco/x-utils'\nimport { computed, defineComponent, inject, onMounted, ref } from 'vue'\nimport { GlobalEvents } from 'vue-global-events'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { isArrayEmpty } from '../../../utils/array'\nimport { initialUrlState } from '../store/initial-state'\nimport { urlXModule } from '../x-module'\n\ninterface ParsedUrlParams {\n all: UrlParams\n extra: Dictionary<unknown>\n}\n\n/**\n * This component manages the browser URL parameters to preserve them through reloads and browser\n * history navigation. It allow to configure the default url parameter names using its attributes.\n * This component doesn't render elements to the DOM.\n *\n * @public\n */\nexport default defineComponent({\n name: 'UrlHandler',\n components: {\n GlobalEvents,\n },\n xModule: urlXModule.name,\n setup(_, { attrs }) {\n const $x = use$x()\n\n const { initialExtraParams } = useState('url')\n\n /**\n * The {@link SnippetConfig} provided by an ancestor.\n *\n * @internal\n */\n const snippetConfig = inject<SnippetConfig | undefined>('snippetConfig')\n\n /**\n * Flag to know if the params were already loaded from the URL.\n *\n * @internal\n */\n const urlLoaded = ref(false)\n\n /**\n * The page URL. It is used to compare against the current URL to check navigation state.\n *\n * @internal\n */\n const url = ref<URL | undefined>(undefined)\n\n /**\n * Flag to know if the page has been persisted by the browser's back-forward cache.\n *\n * @internal\n */\n const isPagePersisted = ref(false)\n\n /**\n * Computed to know which params we must get from URL. It gets the params names from the initial\n * state, to get all default params names, and also from the `$attrs` to get the extra params\n * names to take into account.\n *\n * @returns An array with the name of the params.\n *\n * @internal\n */\n const managedParamsNames = computed(() => Object.keys({ ...initialUrlState, ...attrs }))\n\n /**\n * Returns the mapping of the param keys used in the URL is configured through $attrs. This way\n * we can support any param and extra param, no matters its name.\n *\n * @param paramName - The param name to get the Url key.\n * @returns The key used in the URL for the `paramName` passed.\n *\n * @internal\n */\n const getUrlKey = (paramName: string) => {\n const paramValue = attrs[paramName]\n return typeof paramValue === 'string' ? paramValue : paramName\n }\n\n /**\n * Deletes all the parameters in the passed URL.\n *\n * @param url - The URL to remove parameters from.\n * @internal\n */\n const deleteUrlParameters = (url: URL) => {\n managedParamsNames.value.forEach(paramName => url.searchParams.delete(getUrlKey(paramName)))\n }\n\n /**\n * Sorts the params in a tuple array [key,value] to generate always the same URL with the params\n * in the same order.\n *\n * @param urlParams - The {@link UrlParams} to sort.\n * @returns An array of tuples with the key-value of each paramter, sorted by key.\n * @internal\n */\n const sortParams = (urlParams: UrlParams): Array<[string, unknown]> => {\n return Object.entries(urlParams).sort(([param1], [param2]) => {\n return param1 < param2 ? -1 : 1\n })\n }\n\n /**\n * Set all the provided parameters to the url with the mapped key.\n *\n * @param url - The current URL.\n * @param urlParams - The list of parameters to add.\n * @remarks The params are filtered because there maybe received extra params which will not be\n * managed by URL. This is defined by the `managedParamsNames` computed. Also, the parameters\n * are sorted Alphabetically to produce always the same URL with the same parameters.This is\n * important for SEO purposes.\n *\n * @internal\n */\n const setUrlParameters = (url: URL, urlParams: UrlParams): void => {\n // Only when there is a query the rest of the parameters are valid.\n if (!urlParams.query) {\n return\n }\n const filteredParams = objectFilter(urlParams, paramName =>\n managedParamsNames.value.includes(paramName as string),\n )\n const sortedParameters = sortParams(filteredParams)\n sortedParameters.forEach(([paramName, paramValue]) => {\n const urlParamKey = getUrlKey(paramName)\n if (Array.isArray(paramValue)) {\n paramValue.forEach(value => {\n url.searchParams.append(urlParamKey, String(value))\n })\n } else {\n url.searchParams.set(urlParamKey, String(paramValue))\n }\n })\n }\n\n /**\n * Updates the browser URL with the passed `newUrlParams` and using the browser history method\n * passed as `historyMethod`. It only updates the browser history if the new URL is different\n * from the current.\n *\n * @param newUrlParams - The new params to add to the browser URL.\n * @param historyMethod - The browser history method used to add the new URL.\n *\n * @internal\n */\n const updateUrl = (\n newUrlParams: UrlParams,\n historyMethod: History['pushState'] | History['replaceState'],\n ): void => {\n if (urlLoaded.value) {\n const newUrl = new URL(window.location.href)\n deleteUrlParameters(newUrl)\n setUrlParameters(newUrl, newUrlParams)\n\n // Normalize '+' characters into '%20' for spaces in url params.\n newUrl.search = newUrl.search.replace(/\\+/g, '%20')\n\n if (newUrl.href !== window.location.href) {\n historyMethod({ ...window.history.state }, document.title, newUrl.href)\n }\n url.value = newUrl\n }\n }\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `pushState` method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('PushableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.pushState.bind(window.history))\n })\n\n /**\n * Updates the browser URL with the new {@link UrlParams} using the history `replaceState`\n * method.\n *\n * @param newUrlParams - The new params to update browser URL.\n */\n $x.on('ReplaceableUrlStateUpdated', false).subscribe((newUrlParams: UrlParams) => {\n updateUrl(newUrlParams, window.history.replaceState.bind(window.history))\n })\n\n /**\n * Handler of the\n * [pageshow](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event)\n * event.\n *\n * @remarks The pageshow event is listened to check if the browser has performed a navigation\n * using the back-forward cache. This information is available in the\n * PageTransitionEvent.persisted property.\n *\n * @param event - The page transition event.\n * @internal\n */\n const onPageShow = (event: PageTransitionEvent) => {\n isPagePersisted.value = event.persisted\n if (event.persisted) {\n // The internal url is reset due to the back-forward cache storing the previous value which\n // is no longer valid.\n url.value = undefined\n }\n }\n\n /**\n * Returns the URL param value parsed depending on its type in the initial store state. As we\n * can not know what type can have an extra param, all extra params are parsed as strings. We\n * know if it is an extra param because it is not in the initial state.\n *\n * @param name - The name of the param in {@link UrlParams}.\n * @param value - The `URLSearchParams` value as an arry of strings.\n * @returns The parsed value.\n *\n * @internal\n */\n const parseUrlParam = (name: string, value: string[]): UrlParamValue => {\n switch (typeof initialUrlState[name]) {\n case 'number':\n return Number(value[0])\n case 'boolean':\n return value[0].toLowerCase() === 'true'\n case 'string':\n return value[0]\n default:\n // array\n return value\n }\n }\n\n /**\n * Gets the {@link UrlParams} from the URL, including only the params defined by `paramsNames`.\n *\n * @returns ParsedUrlParams obtained from URL.\n * @internal\n */\n const parseUrlParams = (): ParsedUrlParams => {\n const urlSearchParams = new URL(window.location.href).searchParams\n return managedParamsNames.value.reduce<ParsedUrlParams>(\n (params, name) => {\n const urlKey = getUrlKey(name)\n if (urlSearchParams.has(urlKey)) {\n if (name in initialUrlState) {\n const urlValue = urlSearchParams.getAll(urlKey)\n params.all[name] = parseUrlParam(name, urlValue)\n } else {\n params.all[name] = params.extra[name] = urlSearchParams.get(urlKey)\n }\n }\n return params\n },\n { all: { ...initialUrlState }, extra: { ...initialExtraParams.value } },\n )\n }\n\n /**\n * Check if the navigation is from a product page.\n *\n * @remarks Due to Safari 14 not supporting the new and standard PerformanceNavigationTiming\n * API, we are falling back to the deprecated one, PerformanceNavigation. We also fallback to\n * this API whenever we get a navigationType equal to reload, because Safari has a bug that the\n * navigationType is permanently set to reload after you have reload the page and it never\n * resets. As some browsers have a back-forward cache implemented, we also take into account if\n * the page is persisted.\n *\n * @returns True if the navigation is from a product page, false otherwise.\n * @internal\n */\n const isNavigatingFromPdp = (): boolean => {\n const isPagePersistedValue = isPagePersisted.value\n const navigationEntries = window.performance.getEntriesByType('navigation')\n const navigationType = (navigationEntries[0] as PerformanceNavigationTiming)?.type\n const useFallbackStrategy =\n !navigationEntries.length &&\n (isArrayEmpty(navigationEntries) || navigationType === 'reload')\n\n // Reset internal isPagePersisted property value\n isPagePersisted.value = false\n\n if (useFallbackStrategy) {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n } else {\n const isNavigatingInSpa = !!snippetConfig?.isSpa && navigationType === 'navigate'\n return navigationType === 'back_forward' || isNavigatingInSpa || isPagePersistedValue\n }\n }\n\n /**\n * Detects the {@link FeatureLocation} used to build the\n * {@link QueryOriginInit} data.\n *\n * @returns The {@link FeatureLocation}.\n * @internal\n */\n const detectLocation = (): FeatureLocation => {\n const currentUrl = new URL(window.location.href)\n const previousUrl = url.value\n url.value = currentUrl\n\n const isInternalNavigation =\n previousUrl?.search !== currentUrl.search && previousUrl?.pathname === currentUrl.pathname\n if (isInternalNavigation) {\n return 'url_history'\n }\n\n if (isNavigatingFromPdp()) {\n return 'url_history_pdp'\n }\n\n return 'external'\n }\n\n /**\n * Creates the wire metadata to include in every emitted {@link XEvent}.\n *\n * @returns The {@link WireMetadata}.\n * @internal\n */\n const createWireMetadata = (): Pick<WireMetadata, 'feature' | 'location'> => {\n return {\n feature: 'url',\n location: detectLocation(),\n }\n }\n\n /**\n * Emits the {@link UrlXEvents.ParamsLoadedFromUrl} XEvent,\n * the {@link UrlXEvents.ExtraParamsLoadedFromUrl} XEvent and, if there is query, also emits\n * the {@link XEventsTypes.UserOpenXProgrammatically}.\n *\n * @internal\n */\n const emitEvents = () => {\n const { all, extra } = parseUrlParams()\n const metadata = createWireMetadata()\n $x.emit('ParamsLoadedFromUrl', all, metadata)\n $x.emit('ExtraParamsLoadedFromUrl', extra, metadata)\n if (all.query) {\n $x.emit('UserOpenXProgrammatically', undefined, metadata)\n }\n urlLoaded.value = true\n }\n\n /**\n * To emit the Url events just when the URL is load, and before the components mounted events\n * and state changes, we do it in the created of this component.\n */\n onMounted(() => {\n emitEvents()\n })\n\n return {\n onPageShow,\n emitEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`ParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`ExtraParamsLoadedFromUrl`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserOpenXProgrammatically`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nThis component manages the browser URL parameters to preserve them through reloads and browser\nhistory navigation. It allow to configure the default url parameter names using its attributes. This\ncomponent doesn't render elements to the DOM.\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the `UrlHandler` component changes the following query parameter names:\n\n- `query` to be `q`.\n- `page` to be `p`.\n- `filter` to be `f`\n- `sort` to be `s`\n\n_Try to make some requests and take a look to the url!_\n\n```vue\n<template>\n <UrlHandler query=\"q\" page=\"p\" filter=\"f\" sort=\"s\" />\n</template>\n\n<script>\nimport { UrlHandler } from '@empathyco/x-components/url-handler'\n\nexport default {\n name: 'UrlHandlerDemo',\n components: {\n UrlHandler,\n },\n}\n</script>\n```\n\n### Play with events\n\nThe `UrlHandler` will emit the `ParamsLoadedFromUrl` when the page is loaded.\n\nThe `UrlHandler` will emit the `ExtraParamsLoadedFromUrl` when the page is loaded with an extra\nparam configured and with a value in URL.\n\nThe `UrlHandler` will emit the `UserOpenXProgrammatically` when the page is loaded with a query in\nthe URL.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;AAyBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,UAAU,EAAE;QACV,YAAY;AACb,KAAA;IACD,OAAO,EAAE,UAAU,CAAC,IAAI;AACxB,IAAA,KAAK,CAAC,CAAC,EAAE,EAAE,KAAI,EAAG,EAAA;AAChB,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC,CAAA;QAEjB,MAAM,EAAE,kBAAmB,EAAA,GAAI,QAAQ,CAAC,KAAK,CAAA,CAAA;AAE7C;;;;AAIE;AACF,QAAA,MAAM,aAAY,GAAI,MAAM,CAA4B,eAAe,CAAA,CAAA;AAEvE;;;;AAIE;AACF,QAAA,MAAM,SAAU,GAAE,GAAG,CAAC,KAAK,CAAA,CAAA;AAE3B;;;;AAIE;AACF,QAAA,MAAM,GAAE,GAAI,GAAG,CAAkB,SAAS,CAAA,CAAA;AAE1C;;;;AAIE;AACF,QAAA,MAAM,eAAgB,GAAE,GAAG,CAAC,KAAK,CAAA,CAAA;AAEjC;;;;;;;;AAQE;QACF,MAAM,kBAAmB,GAAE,QAAQ,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,eAAe,EAAE,GAAG,KAAI,EAAG,CAAC,CAAA,CAAA;AAEvF;;;;;;;;AAQE;AACF,QAAA,MAAM,SAAQ,GAAI,CAAC,SAAiB,KAAK;AACvC,YAAA,MAAM,UAAS,GAAI,KAAK,CAAC,SAAS,CAAA,CAAA;A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;YAC5C,EAAE,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,EAAE,QAAQ,CAAA,CAAA;YACnD,IAAI,GAAG,CAAC,KAAK,EAAE;gBACb,EAAE,CAAC,IAAI,CAAC,2BAA2B,EAAE,SAAS,EAAE,QAAQ,CAAA,CAAA;AAC1D,aAAA;AACA,YAAA,SAAS,CAAC,QAAQ,IAAG,CAAA;AACvB,SAAA,CAAA;AAEA;;;AAGE;QACF,SAAS,CAAC,MAAM;AACd,YAAA,UAAU,EAAC,CAAA;AACb,SAAC,CAAA,CAAA;QAED,OAAO;YACL,UAAU;YACV,UAAU;SACZ,CAAA;KACD;AACF,CAAA,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.65",
|
|
4
4
|
"description": "Empathy X Components",
|
|
5
5
|
"author": "Empathy Systems Corporation S.L.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"access": "public",
|
|
144
144
|
"directory": "dist"
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "c031e4d607c1bcb0b450b12db03b257546b1ff99"
|
|
147
147
|
}
|