@empathyco/x-components 3.0.0-alpha.75 → 3.0.0-alpha.78
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 +40 -0
- package/README.md +27 -8
- package/core/index.js +0 -1
- package/core/index.js.map +1 -1
- package/design-system/default-theme.css +73 -73
- package/design-system/full-theme.css +54 -55
- package/docs/API-reference/api/x-components.actionstree.md +1 -1
- package/docs/API-reference/api/x-components.anyactionstree.md +1 -1
- package/docs/API-reference/api/x-components.anygetterstree.md +1 -1
- package/docs/API-reference/api/x-components.anymutationstree.md +1 -1
- package/docs/API-reference/api/x-components.compilemessage.md +1 -1
- package/docs/API-reference/api/x-components.debounce.md +1 -1
- package/docs/API-reference/api/x-components.deeppartial.md +1 -1
- package/docs/API-reference/api/x-components.extraparams.md +2 -2
- package/docs/API-reference/api/x-components.extraparamsmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.extraparamsstate.md +1 -1
- package/docs/API-reference/api/x-components.extraparamsxevents.md +4 -4
- package/docs/API-reference/api/x-components.firstparameter.md +0 -2
- package/docs/API-reference/api/x-components.getterstree.md +1 -1
- package/docs/API-reference/api/x-components.identifierresultsmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.identifierresultsstate.md +1 -1
- package/docs/API-reference/api/x-components.md +0 -11
- package/docs/API-reference/api/x-components.mutationstree.md +1 -1
- package/docs/API-reference/api/x-components.nextqueriesmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.nextqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.popularsearchesmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.popularsearchesstate.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestionsmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestionsstate.md +1 -1
- package/docs/API-reference/api/x-components.recommendationsmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.recommendationsstate.md +1 -1
- package/docs/API-reference/api/x-components.relatedtagsmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.relatedtagsstate.md +1 -1
- package/docs/API-reference/api/x-components.renderlessextraparams.md +1 -1
- package/docs/API-reference/api/x-components.returns.md +0 -2
- package/docs/API-reference/api/x-components.scrollstate.md +1 -1
- package/docs/API-reference/api/x-components.searchmutations.setparams.md +1 -1
- package/docs/API-reference/api/x-components.searchstate.md +2 -2
- package/docs/API-reference/api/x-components.setextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setidentifierresultsextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setinitialextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setnextqueriesextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setpopularsearchesextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setquerysuggestionsextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setrecommendationsextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setrelatedtagsextraparams.md +1 -1
- package/docs/API-reference/api/x-components.setsearchextraparams.md +1 -1
- package/docs/API-reference/api/x-components.simplestateselector.md +0 -2
- package/docs/API-reference/api/x-components.snippetconfigextraparams.md +1 -1
- package/docs/API-reference/api/x-components.urlhandler.md +1 -1
- package/docs/API-reference/api/x-components.urlmutations.setinitialextraparams.md +1 -1
- package/docs/API-reference/api/x-components.urlstate.md +1 -1
- package/docs/API-reference/api/x-components.urlxevents.extraparamsloadedfromurl.md +1 -1
- package/docs/API-reference/api/x-components.urlxevents.md +1 -1
- package/docs/API-reference/api/x-components.vuecssclasses.md +0 -2
- package/docs/API-reference/api/x-components.wiring.md +1 -1
- package/js/components/decorators/bus.decorators.js.map +1 -1
- package/js/components/decorators/debounce.decorators.js.map +1 -1
- package/js/components/global-x-bus.vue.js.map +1 -1
- package/js/components/global-x-bus.vue_rollup-plugin-vue_script.vue.js +1 -1
- package/js/components/global-x-bus.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/components/snippet-callbacks.vue.js.map +1 -1
- package/js/components/snippet-callbacks.vue_rollup-plugin-vue_script.vue.js +1 -1
- package/js/components/snippet-callbacks.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestion.vue_rollup-plugin-vue_script.vue.js +1 -1
- package/js/components/suggestions/base-suggestion.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/filters/compile-message.filter.js.map +1 -1
- package/js/index.js +0 -1
- package/js/index.js.map +1 -1
- package/js/plugins/x-emitters.js +1 -1
- package/js/plugins/x-emitters.js.map +1 -1
- package/js/plugins/x-plugin.js +1 -2
- package/js/plugins/x-plugin.js.map +1 -1
- package/js/store/utils/getters-proxy.utils.js +1 -1
- package/js/store/utils/getters-proxy.utils.js.map +1 -1
- package/js/store/utils/store-emitters.utils.js.map +1 -1
- package/js/x-installer/x-installer/x-installer.js +1 -1
- package/js/x-installer/x-installer/x-installer.js.map +1 -1
- package/js/x-modules/extra-params/components/extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/extra-params.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/renderless-extra-param.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/renderless-extra-param.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue_rollup-plugin-vue_script.vue.js +1 -2
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js +2 -2
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue_rollup-plugin-vue_script.vue.js +1 -1
- package/js/x-modules/facets/components/facets/facets.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/store/getters/facets.getter.js +1 -1
- package/js/x-modules/facets/store/getters/facets.getter.js.map +1 -1
- package/js/x-modules/facets/store/getters/selected-filters-by-facet.getter.js +1 -1
- package/js/x-modules/facets/store/getters/selected-filters-by-facet.getter.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.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/search/store/actions/reset-state.action.js +1 -1
- package/js/x-modules/search/store/actions/reset-state.action.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.vue_rollup-plugin-vue_script.vue.js +1 -1
- package/js/x-modules/url/components/url-handler.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/url/store/getters/url-params.getter.js +1 -1
- package/js/x-modules/url/store/getters/url-params.getter.js.map +1 -1
- package/js/x-modules/url/store/mutations/set-params.mutation.js +1 -1
- package/js/x-modules/url/store/mutations/set-params.mutation.js.map +1 -1
- package/package.json +5 -4
- package/report/x-components.api.json +75 -843
- package/report/x-components.api.md +3 -33
- package/types/components/decorators/bus.decorators.d.ts.map +1 -1
- package/types/components/decorators/debounce.decorators.d.ts +2 -1
- package/types/components/decorators/debounce.decorators.d.ts.map +1 -1
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/components/suggestions/base-suggestion.vue.d.ts.map +1 -1
- package/types/filters/compile-message.filter.d.ts +1 -1
- package/types/filters/compile-message.filter.d.ts.map +1 -1
- package/types/plugins/x-emitters.d.ts.map +1 -1
- package/types/plugins/x-plugin.d.ts.map +1 -1
- package/types/store/actions.types.d.ts +2 -1
- package/types/store/actions.types.d.ts.map +1 -1
- package/types/store/getters.types.d.ts +1 -1
- package/types/store/getters.types.d.ts.map +1 -1
- package/types/store/mutations.types.d.ts +1 -1
- package/types/store/mutations.types.d.ts.map +1 -1
- package/types/store/utils/getters-proxy.utils.d.ts.map +1 -1
- package/types/store/utils/store-emitters.utils.d.ts +2 -1
- package/types/store/utils/store-emitters.utils.d.ts.map +1 -1
- package/types/utils/index.d.ts +0 -1
- package/types/utils/index.d.ts.map +1 -1
- package/types/utils/types.d.ts +1 -26
- package/types/utils/types.d.ts.map +1 -1
- package/types/wiring/wiring.types.d.ts +2 -1
- package/types/wiring/wiring.types.d.ts.map +1 -1
- package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
- package/types/x-modules/extra-params/components/extra-params.vue.d.ts +1 -1
- package/types/x-modules/extra-params/components/extra-params.vue.d.ts.map +1 -1
- package/types/x-modules/extra-params/components/renderless-extra-param.vue.d.ts +1 -1
- package/types/x-modules/extra-params/components/renderless-extra-param.vue.d.ts.map +1 -1
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts +1 -1
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts.map +1 -1
- package/types/x-modules/extra-params/events.types.d.ts +1 -1
- package/types/x-modules/extra-params/events.types.d.ts.map +1 -1
- package/types/x-modules/extra-params/store/emitters.d.ts +1 -1
- package/types/x-modules/extra-params/store/types.d.ts +1 -1
- package/types/x-modules/extra-params/store/types.d.ts.map +1 -1
- package/types/x-modules/extra-params/wiring.d.ts +4 -4
- package/types/x-modules/extra-params/wiring.d.ts.map +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts.map +1 -1
- package/types/x-modules/identifier-results/store/types.d.ts +1 -1
- package/types/x-modules/identifier-results/store/types.d.ts.map +1 -1
- package/types/x-modules/identifier-results/wiring.d.ts +2 -2
- package/types/x-modules/identifier-results/wiring.d.ts.map +1 -1
- package/types/x-modules/next-queries/store/types.d.ts +1 -1
- package/types/x-modules/next-queries/store/types.d.ts.map +1 -1
- package/types/x-modules/next-queries/wiring.d.ts +2 -2
- package/types/x-modules/next-queries/wiring.d.ts.map +1 -1
- package/types/x-modules/popular-searches/store/types.d.ts +1 -1
- package/types/x-modules/popular-searches/store/types.d.ts.map +1 -1
- package/types/x-modules/popular-searches/wiring.d.ts +2 -2
- package/types/x-modules/popular-searches/wiring.d.ts.map +1 -1
- package/types/x-modules/query-suggestions/store/types.d.ts +1 -1
- package/types/x-modules/query-suggestions/store/types.d.ts.map +1 -1
- package/types/x-modules/query-suggestions/wiring.d.ts +2 -2
- package/types/x-modules/query-suggestions/wiring.d.ts.map +1 -1
- package/types/x-modules/recommendations/store/types.d.ts +1 -1
- package/types/x-modules/recommendations/store/types.d.ts.map +1 -1
- package/types/x-modules/recommendations/wiring.d.ts +2 -2
- package/types/x-modules/recommendations/wiring.d.ts.map +1 -1
- package/types/x-modules/related-tags/store/types.d.ts +1 -1
- package/types/x-modules/related-tags/store/types.d.ts.map +1 -1
- package/types/x-modules/related-tags/wiring.d.ts +2 -2
- package/types/x-modules/related-tags/wiring.d.ts.map +1 -1
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +1 -1
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts.map +1 -1
- package/types/x-modules/scroll/store/types.d.ts +1 -1
- package/types/x-modules/scroll/store/types.d.ts.map +1 -1
- package/types/x-modules/search/store/types.d.ts +1 -1
- package/types/x-modules/search/store/types.d.ts.map +1 -1
- package/types/x-modules/search/wiring.d.ts +2 -2
- package/types/x-modules/search/wiring.d.ts.map +1 -1
- package/types/x-modules/url/components/url-handler.vue.d.ts +1 -1
- package/types/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
- package/types/x-modules/url/events.types.d.ts +3 -2
- package/types/x-modules/url/events.types.d.ts.map +1 -1
- package/types/x-modules/url/store/types.d.ts +1 -1
- package/types/x-modules/url/store/types.d.ts.map +1 -1
- package/types/x-modules/url/wiring.d.ts +2 -2
- package/types/x-modules/url/wiring.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.anyfunction.md +0 -13
- package/docs/API-reference/api/x-components.cleanundefined.md +0 -26
- package/docs/API-reference/api/x-components.dictionary.md +0 -13
- package/docs/API-reference/api/x-components.every.md +0 -27
- package/docs/API-reference/api/x-components.foreach.md +0 -25
- package/docs/API-reference/api/x-components.getnewandupdatedkeys.md +0 -27
- package/docs/API-reference/api/x-components.map.md +0 -27
- package/docs/API-reference/api/x-components.nonprimitive.md +0 -13
- package/docs/API-reference/api/x-components.objectfilter.md +0 -27
- package/docs/API-reference/api/x-components.primitive.md +0 -15
- package/docs/API-reference/api/x-components.reduce.md +0 -28
- package/js/utils/object.js +0 -115
- package/js/utils/object.js.map +0 -1
- package/types/utils/object.d.ts +0 -70
- package/types/utils/object.d.ts.map +0 -1
|
@@ -13,5 +13,5 @@ export declare type MutationsTree<State extends Dictionary, Mutations extends Mu
|
|
|
13
13
|
[Key in keyof Mutations]: (state: State, payload: ExtractPayload<Mutations[Key]>) => void;
|
|
14
14
|
};
|
|
15
15
|
```
|
|
16
|
-
<b>References:</b> [
|
|
16
|
+
<b>References:</b> [MutationsDictionary](./x-components.mutationsdictionary.md)<!-- -->, [ExtractPayload](./x-components.extractpayload.md)
|
|
17
17
|
|
|
@@ -16,7 +16,7 @@ setParams(params: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| params |
|
|
19
|
+
| params | Dictionary<unknown> | The new extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -19,7 +19,7 @@ export interface NextQueriesState extends StatusState, QueryState
|
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| [config](./x-components.nextqueriesstate.config.md) | [NextQueriesConfig](./x-components.nextqueriesconfig.md) | Configuration options of the next queries module. |
|
|
21
21
|
| [nextQueries](./x-components.nextqueriesstate.nextqueries.md) | NextQuery\[\] | The list of the next queries, related to the <code>query</code> property of the state. |
|
|
22
|
-
| [params](./x-components.nextqueriesstate.params.md) |
|
|
22
|
+
| [params](./x-components.nextqueriesstate.params.md) | Dictionary<unknown> | The extra params property of the state. |
|
|
23
23
|
| [query](./x-components.nextqueriesstate.query.md) | string | The internal query of the module. Used to request the next queries. |
|
|
24
24
|
| [searchedQueries](./x-components.nextqueriesstate.searchedqueries.md) | HistoryQuery\[\] | The list of the searched queries, related to the <code>query</code> property of the state. |
|
|
25
25
|
|
|
@@ -16,7 +16,7 @@ setParams(params: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| params |
|
|
19
|
+
| params | Dictionary<unknown> | The new extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -18,7 +18,7 @@ export interface PopularSearchesState extends StatusState
|
|
|
18
18
|
| Property | Type | Description |
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| [config](./x-components.popularsearchesstate.config.md) | [PopularSearchesConfig](./x-components.popularsearchesconfig.md) | The popular searches module configuration. |
|
|
21
|
-
| [params](./x-components.popularsearchesstate.params.md) |
|
|
21
|
+
| [params](./x-components.popularsearchesstate.params.md) | Dictionary<unknown> | The extra params property of the state. |
|
|
22
22
|
| [popularSearches](./x-components.popularsearchesstate.popularsearches.md) | Suggestion\[\] | The suggestions list. These suggestions represent the most searched queries. |
|
|
23
23
|
| [searchedQueries](./x-components.popularsearchesstate.searchedqueries.md) | HistoryQuery\[\] | The list of the searched queries, related to the <code>query</code> property of the state. |
|
|
24
24
|
|
|
@@ -16,7 +16,7 @@ setParams(params: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| params |
|
|
19
|
+
| params | Dictionary<unknown> | The new extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -18,7 +18,7 @@ export interface QuerySuggestionsState extends StatusState, QueryState
|
|
|
18
18
|
| Property | Type | Description |
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| [config](./x-components.querysuggestionsstate.config.md) | [QuerySuggestionsConfig](./x-components.querysuggestionsconfig.md) | The configuration of the query suggestions module. |
|
|
21
|
-
| [params](./x-components.querysuggestionsstate.params.md) |
|
|
21
|
+
| [params](./x-components.querysuggestionsstate.params.md) | Dictionary<unknown> | The extra params property of the state. |
|
|
22
22
|
| [query](./x-components.querysuggestionsstate.query.md) | string | The query of the query suggestions module. Used to request the suggestions. |
|
|
23
23
|
| [suggestions](./x-components.querysuggestionsstate.suggestions.md) | Suggestion\[\] | The suggestions for the query of the state. |
|
|
24
24
|
|
|
@@ -16,7 +16,7 @@ setParams(params: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| params |
|
|
19
|
+
| params | Dictionary<unknown> | The new extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -19,6 +19,6 @@ export interface RecommendationsState extends StatusState
|
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| [config](./x-components.recommendationsstate.config.md) | [RecommendationsConfig](./x-components.recommendationsconfig.md) | Configuration for the <code>Recommendations</code> module. |
|
|
21
21
|
| [origin](./x-components.recommendationsstate.origin.md) | string | Param to be sent on the recommendations request. |
|
|
22
|
-
| [params](./x-components.recommendationsstate.params.md) |
|
|
22
|
+
| [params](./x-components.recommendationsstate.params.md) | Dictionary<unknown> | The extra params property of the state. |
|
|
23
23
|
| [recommendations](./x-components.recommendationsstate.recommendations.md) | Result\[\] | The recommendations of the module. |
|
|
24
24
|
|
|
@@ -16,7 +16,7 @@ setParams(params: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| params |
|
|
19
|
+
| params | Dictionary<unknown> | The new extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -18,7 +18,7 @@ export interface RelatedTagsState extends StatusState, QueryState
|
|
|
18
18
|
| Property | Type | Description |
|
|
19
19
|
| --- | --- | --- |
|
|
20
20
|
| [config](./x-components.relatedtagsstate.config.md) | [RelatedTagsConfig](./x-components.relatedtagsconfig.md) | The configuration of the related tags module. |
|
|
21
|
-
| [params](./x-components.relatedtagsstate.params.md) |
|
|
21
|
+
| [params](./x-components.relatedtagsstate.params.md) | Dictionary<unknown> | The extra params property of the state. |
|
|
22
22
|
| [relatedTags](./x-components.relatedtagsstate.relatedtags.md) | RelatedTag\[\] | The list of the related tags, related to the <code>query</code> property of the state. |
|
|
23
23
|
| [selectedRelatedTags](./x-components.relatedtagsstate.selectedrelatedtags.md) | RelatedTag\[\] | The list of the selected related tags. |
|
|
24
24
|
|
|
@@ -18,5 +18,5 @@ export default class RenderlessExtraParam extends Vue
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
20
|
| [name](./x-components.renderlessextraparams.name.md) | | string | The extra param's name. |
|
|
21
|
-
| [stateParams](./x-components.renderlessextraparams.stateparams.md) | |
|
|
21
|
+
| [stateParams](./x-components.renderlessextraparams.stateparams.md) | | Dictionary<unknown> | A dictionary with the extra params in the store state. |
|
|
22
22
|
|
|
@@ -16,6 +16,6 @@ export interface ScrollState
|
|
|
16
16
|
|
|
17
17
|
| Property | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| [data](./x-components.scrollstate.data.md) |
|
|
19
|
+
| [data](./x-components.scrollstate.data.md) | Dictionary<[ScrollComponentState](./x-components.scrollcomponentstate.md)<!-- -->> | State data of the scroll components. |
|
|
20
20
|
| [pendingScrollTo](./x-components.scrollstate.pendingscrollto.md) | string | The <code>[data-scroll]</code> value of the pending to restore scroll. |
|
|
21
21
|
|
|
@@ -16,7 +16,7 @@ setParams(params: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| params |
|
|
19
|
+
| params | Dictionary<unknown> | The new extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -23,7 +23,7 @@ export interface SearchState extends StatusState, QueryState
|
|
|
23
23
|
| [isAppendResults](./x-components.searchstate.isappendresults.md) | boolean | A flag to indicate if new results are append to the current instead of replacing them. |
|
|
24
24
|
| [origin](./x-components.searchstate.origin.md) | [QueryOrigin](./x-components.queryorigin.md) \| null | The origin property of the request. |
|
|
25
25
|
| [page](./x-components.searchstate.page.md) | number | The current page of the request. |
|
|
26
|
-
| [params](./x-components.searchstate.params.md) |
|
|
26
|
+
| [params](./x-components.searchstate.params.md) | Dictionary<unknown> | The extra params property of the state. |
|
|
27
27
|
| [partialResults](./x-components.searchstate.partialresults.md) | PartialResult\[\] | The list of the partial results, related to the <code>query</code> property of the state. |
|
|
28
28
|
| [promoteds](./x-components.searchstate.promoteds.md) | Promoted\[\] | The list of the promoted, related to the <code>query</code> property of the state. |
|
|
29
29
|
| [query](./x-components.searchstate.query.md) | string | The internal query of the module. Used to request the search results. |
|
|
@@ -31,7 +31,7 @@ export interface SearchState extends StatusState, QueryState
|
|
|
31
31
|
| [redirections](./x-components.searchstate.redirections.md) | Redirection\[\] | The redirections associated to the <code>query</code>. |
|
|
32
32
|
| [relatedTags](./x-components.searchstate.relatedtags.md) | RelatedTag\[\] | The list of the related tags, related to the <code>query</code> property of the state. |
|
|
33
33
|
| [results](./x-components.searchstate.results.md) | Result\[\] | The list of the results, related to the <code>query</code> property of the state. |
|
|
34
|
-
| [selectedFilters](./x-components.searchstate.selectedfilters.md) |
|
|
34
|
+
| [selectedFilters](./x-components.searchstate.selectedfilters.md) | Dictionary<Filter\[\]> | The dictionary of selected filters, used to perform the search request. The key is the facet id, and the value the list of filters for that facet. |
|
|
35
35
|
| [sort](./x-components.searchstate.sort.md) | Sort | The way of ordering the results. |
|
|
36
36
|
| [spellcheckedQuery](./x-components.searchstate.spellcheckedquery.md) | string | The spellcheckedQuery property of the state. |
|
|
37
37
|
| [totalResults](./x-components.searchstate.totalresults.md) | number | The total number of results, related to the <code>query</code> property of the state. |
|
|
@@ -9,5 +9,5 @@ Sets the extra params of the [ExtraParamsXModule](./x-components.extraparamsxmod
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setExtraParams: import("../../wiring").Wire<import("
|
|
12
|
+
setExtraParams: import("../../wiring").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the identifier result state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setIdentifierResultsExtraParams: import("../..").Wire<import("
|
|
12
|
+
setIdentifierResultsExtraParams: import("../..").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the next queries state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setNextQueriesExtraParams: import("../..").Wire<import("
|
|
12
|
+
setNextQueriesExtraParams: import("../..").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the popular searches state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setPopularSearchesExtraParams: import("../..").Wire<import("
|
|
12
|
+
setPopularSearchesExtraParams: import("../..").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the query suggestions state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setQuerySuggestionsExtraParams: import("../..").Wire<import("
|
|
12
|
+
setQuerySuggestionsExtraParams: import("../..").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the recommendations state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setRecommendationsExtraParams: import("../..").Wire<import("
|
|
12
|
+
setRecommendationsExtraParams: import("../..").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the related tags state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setRelatedTagsExtraParams: import("../..").Wire<import("
|
|
12
|
+
setRelatedTagsExtraParams: import("../..").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ Sets the search state `params`<!-- -->.
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
setSearchExtraParams: import("../../wiring/wiring.types").Wire<import("
|
|
12
|
+
setSearchExtraParams: import("../../wiring/wiring.types").Wire<import("@empathyco/x-utils").Dictionary<unknown>>
|
|
13
13
|
```
|
|
@@ -11,5 +11,3 @@ Selects a part of the store state or getters (AKA "getter" inside [Vuex](https:/
|
|
|
11
11
|
```typescript
|
|
12
12
|
export declare type SimpleStateSelector<ReturnType, State extends Dictionary, Getters extends Dictionary> = (state: State, getters: Getters) => ReturnType;
|
|
13
13
|
```
|
|
14
|
-
<b>References:</b> [Dictionary](./x-components.dictionary.md)
|
|
15
|
-
|
|
@@ -17,5 +17,5 @@ export default class SnippetConfigExtraParams extends Vue
|
|
|
17
17
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
|
-
| [values?](./x-components.snippetconfigextraparams.values.md) | |
|
|
20
|
+
| [values?](./x-components.snippetconfigextraparams.values.md) | | Dictionary<unknown> | <i>(Optional)</i> A Dictionary where the keys are the extra param names and its values. |
|
|
21
21
|
|
|
@@ -17,7 +17,7 @@ export default class UrlHandler extends Vue
|
|
|
17
17
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
|
-
| [initialExtraParams](./x-components.urlhandler.initialextraparams.md) | |
|
|
20
|
+
| [initialExtraParams](./x-components.urlhandler.initialextraparams.md) | | Dictionary<unknown> | |
|
|
21
21
|
|
|
22
22
|
## Methods
|
|
23
23
|
|
|
@@ -16,7 +16,7 @@ setInitialExtraParams(extraParams: Dictionary<unknown>): void;
|
|
|
16
16
|
|
|
17
17
|
| Parameter | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| extraParams |
|
|
19
|
+
| extraParams | Dictionary<unknown> | The new initial extra params. |
|
|
20
20
|
|
|
21
21
|
<b>Returns:</b>
|
|
22
22
|
|
|
@@ -17,5 +17,5 @@ export interface UrlState extends QueryState, UrlParams
|
|
|
17
17
|
|
|
18
18
|
| Property | Type | Description |
|
|
19
19
|
| --- | --- | --- |
|
|
20
|
-
| [initialExtraParams](./x-components.urlstate.initialextraparams.md) |
|
|
20
|
+
| [initialExtraParams](./x-components.urlstate.initialextraparams.md) | Dictionary<unknown> | |
|
|
21
21
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## UrlXEvents.ExtraParamsLoadedFromUrl property
|
|
6
6
|
|
|
7
|
-
Url loaded. \* Payload: The extra params form URL in form of
|
|
7
|
+
Url loaded. \* Payload: The extra params form URL in form of with `unknown` values.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ export interface UrlXEvents
|
|
|
16
16
|
|
|
17
17
|
| Property | Type | Description |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| [ExtraParamsLoadedFromUrl](./x-components.urlxevents.extraparamsloadedfromurl.md) |
|
|
19
|
+
| [ExtraParamsLoadedFromUrl](./x-components.urlxevents.extraparamsloadedfromurl.md) | Dictionary<unknown> | Url loaded. \* Payload: The extra params form URL in form of with <code>unknown</code> values. |
|
|
20
20
|
| [ParamsLoadedFromUrl](./x-components.urlxevents.paramsloadedfromurl.md) | [UrlParams](./x-components.urlparams.md) | Url loaded. \* Payload: The new [UrlParams](./x-components.urlparams.md) params. |
|
|
21
21
|
| [PushableUrlStateChanged](./x-components.urlxevents.pushableurlstatechanged.md) | [UrlParams](./x-components.urlparams.md) | Url state changed with a change to add new entry to browser URL History State. \* Payload: The new URL params. |
|
|
22
22
|
| [ReplaceableUrlStateChanged](./x-components.urlxevents.replaceableurlstatechanged.md) | [UrlParams](./x-components.urlparams.md) | Url state changed with a change to replace the current entry to browser URL History State. \* Payload: The new URL params. |
|
|
@@ -13,5 +13,5 @@ export declare type Wiring = {
|
|
|
13
13
|
[Event in XEvent]: Dictionary<WireForEvent<Event>>;
|
|
14
14
|
};
|
|
15
15
|
```
|
|
16
|
-
<b>References:</b> [XEvent](./x-components.xevent.md)<!-- -->, [
|
|
16
|
+
<b>References:</b> [XEvent](./x-components.xevent.md)<!-- -->, [WireForEvent](./x-components.wireforevent.md)
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bus.decorators.js","sources":["../../../../src/components/decorators/bus.decorators.ts"],"sourcesContent":["import { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport Vue, { WatchOptions } from 'vue';\nimport { createDecorator } from 'vue-class-component';\nimport { clone } from '../../utils/clone';\nimport {
|
|
1
|
+
{"version":3,"file":"bus.decorators.js","sources":["../../../../src/components/decorators/bus.decorators.ts"],"sourcesContent":["import { AnyFunction } from '@empathyco/x-utils';\nimport { Subscription } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport Vue, { WatchOptions } from 'vue';\nimport { createDecorator } from 'vue-class-component';\nimport { clone } from '../../utils/clone';\nimport { DecoratorFor } from '../../utils/types';\nimport { XEvent, XEventPayload } from '../../wiring/events.types';\nimport { WireMetadata } from '../../wiring/wiring.types';\n\n/**\n * Creates a subscription to an {@link XEvent}, an array of {@link XEvent} or a component property (\n * reacting to its changes via a watcher) filtering out the passed metadata, if any, and\n * un-subscribes on the beforeDestroy hook.\n *\n * @remarks\n * The decorated property needs to be public for type inference to work.\n *\n * @param xEvent - The {@link XEvent}, an array of {@link XEvent} or a component property.\n * @param metadataFilteringOptions - The {@link WireMetadata} options to filter out a callback\n * execution.\n * @returns Decorator that creates a subscription to an {@link XEvent} and un-subscribes on the\n * beforeDestroy hook.\n * @public\n */\nexport function XOn<Event extends XEvent>(\n xEvent: Event | Event[] | ((component: Vue) => Event | Event[]),\n metadataFilteringOptions: Partial<WireMetadata> = {}\n): DecoratorFor<(payload: XEventPayload<Event>, metadata: WireMetadata) => void> {\n return createDecorator((options, key) => {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalCreated = options.created;\n Object.assign(options, {\n created(this: Vue) {\n originalCreated?.apply(this);\n const componentCreateSubscription = createSubscription.bind(this);\n const subscriptionMetadata: SubscriptionMetadata<Event> = {\n event: [],\n callback: (this as any)[key], // `this` isn't correctly typed here\n metadataFilteringOptions\n };\n\n let subscription: Subscription;\n if (typeof xEvent === 'function') {\n this.$watch(\n () => xEvent(this),\n newEvents => {\n subscription?.unsubscribe();\n subscriptionMetadata.event = newEvents;\n subscription = componentCreateSubscription(subscriptionMetadata);\n },\n { immediate: true }\n );\n } else {\n subscriptionMetadata.event = xEvent;\n subscription = componentCreateSubscription(subscriptionMetadata);\n }\n\n this.$on('hook:beforeDestroy', () => subscription.unsubscribe()); // Using Vue\n // bus to subscribe to the lifecycle hook 'beforeDestroy' instead of 'capturing' the\n // original component's 'beforeDestroy' method to override it plus calling\n // originalBeforeDestroy.apply(this) to preserve the existing original hook functionality\n }\n });\n });\n}\n\n/**\n * Create a subscription for the given events executing the passed callback and filtering out based\n * on the passed metadata options.\n *\n * @param this - The vue component.\n * @param subscriptionMetadata - The {@link SubscriptionMetadata}.\n * @returns A\n * {@link https://www.learnrxjs.io/learn-rxjs/concepts/rxjs-primer#subscription | subscription}.\n * @internal\n */\nfunction createSubscription<Event extends XEvent>(\n this: Vue,\n subscriptionMetadata: SubscriptionMetadata<Event>\n): Subscription {\n const { event, callback, metadataFilteringOptions } = subscriptionMetadata;\n const eventArray = Array.isArray(event) ? event : [event];\n const subscription = new Subscription();\n eventArray.forEach(xEvent => {\n subscription.add(\n this.$x\n .on(xEvent, true)\n .pipe(filter(({ metadata }) => filterMetadataOptions(metadataFilteringOptions, metadata)))\n .subscribe(({ eventPayload, metadata }) => callback(eventPayload, metadata))\n );\n });\n return subscription;\n}\n\n/**\n * Checks if the metadata options passed to the decorator match the metadata of the emitted event.\n *\n * @param filteringOptions - The decorator options.\n * @param eventOptions - The emitted event metadata.\n * @returns True if options are empty or match the metadata.\n * @internal\n */\nfunction filterMetadataOptions<WireMetadataKey extends keyof WireMetadata>(\n filteringOptions: Partial<WireMetadata>,\n eventOptions: WireMetadata\n): boolean {\n return (Object.keys(filteringOptions) as WireMetadataKey[])\n .filter(key => filteringOptions[key] !== undefined)\n .every(key => filteringOptions[key] === eventOptions[key]);\n}\n\n/**\n * The subscription metadata containing an/a list of {@link XEvent}, the callback function to\n * execute and the metadataOptions to filter out the execution of the callback.\n *\n * @internal\n */\ninterface SubscriptionMetadata<Event extends XEvent> {\n /**\n * An {@link XEvent} or a list of them.\n */\n event: Event | Event[];\n /**\n * A callback function to execute in the subscription.\n */\n callback: AnyFunction;\n /**\n * The metadataFilteringOptions to filter out the execution of the callback.\n */\n metadataFilteringOptions: Partial<WireMetadata>;\n}\n\n/**\n * Emits the provided event whenever the decorated property changes.\n *\n * @param xEvent - The event to emit.\n * @param watcherOptions - Options for Vue's watcher.\n * @returns Decorator that makes the component emit an event when the decorated property changes.\n * @public\n */\nexport function XEmit<Event extends XEvent>(\n xEvent: Event,\n { immediate = true, deep = false }: WatchOptions = {}\n): DecoratorFor<XEventPayload<Event> | undefined> {\n return createDecorator((options, key) => {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalCreated = options.created;\n options.created = function (this: Vue) {\n originalCreated?.apply(this);\n if ((this as any)[key] !== undefined) {\n this.$watch(\n key,\n newValue => {\n this.$x.emit(\n xEvent,\n typeof newValue === 'object' && newValue !== null ? clone(newValue) : newValue\n );\n },\n { immediate, deep }\n );\n }\n };\n });\n}\n"],"names":[],"mappings":";;;;;AAUA;;;;;;;;;;;;;;;SAegB,GAAG,CACjB,MAA+D,EAC/D,2BAAkD,EAAE;IAEpD,OAAO,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG;;QAElC,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB,OAAO;gBACL,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClE,MAAM,oBAAoB,GAAgC;oBACxD,KAAK,EAAE,EAAE;oBACT,QAAQ,EAAG,IAAY,CAAC,GAAG,CAAC;oBAC5B,wBAAwB;iBACzB,CAAC;gBAEF,IAAI,YAA0B,CAAC;gBAC/B,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;oBAChC,IAAI,CAAC,MAAM,CACT,MAAM,MAAM,CAAC,IAAI,CAAC,EAClB,SAAS;wBACP,YAAY,EAAE,WAAW,EAAE,CAAC;wBAC5B,oBAAoB,CAAC,KAAK,GAAG,SAAS,CAAC;wBACvC,YAAY,GAAG,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;qBAClE,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;iBACH;qBAAM;oBACL,oBAAoB,CAAC,KAAK,GAAG,MAAM,CAAC;oBACpC,YAAY,GAAG,2BAA2B,CAAC,oBAAoB,CAAC,CAAC;iBAClE;gBAED,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;;;;aAIlE;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;AAUA,SAAS,kBAAkB,CAEzB,oBAAiD;IAEjD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,wBAAwB,EAAE,GAAG,oBAAoB,CAAC;IAC3E,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IACxC,UAAU,CAAC,OAAO,CAAC,MAAM;QACvB,YAAY,CAAC,GAAG,CACd,IAAI,CAAC,EAAE;aACJ,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC;aAChB,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,qBAAqB,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC,CAAC;aACzF,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,CAC/E,CAAC;KACH,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;;AAQA,SAAS,qBAAqB,CAC5B,gBAAuC,EACvC,YAA0B;IAE1B,OAAQ,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAuB;SACxD,MAAM,CAAC,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;SAClD,KAAK,CAAC,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC;AAuBD;;;;;;;;SAQgB,KAAK,CACnB,MAAa,EACb,EAAE,SAAS,GAAG,IAAI,EAAE,IAAI,GAAG,KAAK,KAAmB,EAAE;IAErD,OAAO,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG;;QAElC,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;QACxC,OAAO,CAAC,OAAO,GAAG;YAChB,eAAe,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAK,IAAY,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;gBACpC,IAAI,CAAC,MAAM,CACT,GAAG,EACH,QAAQ;oBACN,IAAI,CAAC,EAAE,CAAC,IAAI,CACV,MAAM,EACN,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAC/E,CAAC;iBACH,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CAAC;aACH;SACF,CAAC;KACH,CAAC,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.decorators.js","sources":["../../../../src/components/decorators/debounce.decorators.ts"],"sourcesContent":["import { createDecorator } from 'vue-class-component';\nimport { debounce } from '../../utils/debounce';\nimport {
|
|
1
|
+
{"version":3,"file":"debounce.decorators.js","sources":["../../../../src/components/decorators/debounce.decorators.ts"],"sourcesContent":["import { AnyFunction } from '@empathyco/x-utils';\nimport { createDecorator } from 'vue-class-component';\nimport { debounce } from '../../utils/debounce';\nimport { DebounceOptions, DecoratorFor } from '../../utils/types';\n\n/**\n * Adds debounce to the method that the decorator is applied to.\n *\n * @remarks Pending debounced execution is cancelled when the component is destroyed.\n *\n * @param debounceTimeInMs - The time of debounce in ms.\n * @param debounceOptions - The options for the debounce strategy.\n *\n * @returns Decorator that applies debounce.\n *\n * @public\n */\nexport function Debounce(\n debounceTimeInMs: number,\n debounceOptions: DebounceOptions = {}\n): DecoratorFor<AnyFunction> {\n return createDecorator((options, key) => {\n const originalMethod = options.methods![key];\n const debouncedMethod = debounce(\n (context: Vue, args: unknown[]) => originalMethod.call(context, ...args),\n debounceTimeInMs,\n debounceOptions\n );\n\n options.methods![key] = function debouncedWrapper(...args: unknown[]) {\n debouncedMethod(this, args);\n };\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const originalBeforeDestroy = options.beforeDestroy;\n Object.assign(options, {\n beforeDestroy(this: Vue) {\n originalBeforeDestroy?.apply(this);\n debouncedMethod.cancel();\n }\n });\n });\n}\n"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;;SAYgB,QAAQ,CACtB,gBAAwB,EACxB,kBAAmC,EAAE;IAErC,OAAO,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG;QAClC,MAAM,cAAc,GAAG,OAAO,CAAC,OAAQ,CAAC,GAAG,CAAC,CAAC;QAC7C,MAAM,eAAe,GAAG,QAAQ,CAC9B,CAAC,OAAY,EAAE,IAAe,KAAK,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,EACxE,gBAAgB,EAChB,eAAe,CAChB,CAAC;QAEF,OAAO,CAAC,OAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,gBAAgB,CAAC,GAAG,IAAe;YAClE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAC7B,CAAC;;QAGF,MAAM,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;YACrB,aAAa;gBACX,qBAAqB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnC,eAAe,CAAC,MAAM,EAAE,CAAC;aAC1B;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;AACL;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-x-bus.vue.js","sources":["../../../src/components/global-x-bus.vue"],"sourcesContent":["<script lang=\"ts\">\n import {
|
|
1
|
+
{"version":3,"file":"global-x-bus.vue.js","sources":["../../../src/components/global-x-bus.vue"],"sourcesContent":["<script lang=\"ts\">\n import { reduce } from '@empathyco/x-utils';\n import { Component } from 'vue-property-decorator';\n import { Subscription } from 'rxjs';\n import { XEventListeners } from '../x-installer/api/api.types';\n import { NoElement } from './no-element';\n\n /**\n * This component helps subscribing to any {@link XEvent} with custom callbacks using Vue\n * listeners API.\n *\n * @public\n */\n @Component\n export default class GlobalXBus extends NoElement {\n /**\n * Object with the {@link XEvent} listeners.\n *\n * @internal\n */\n public $listeners!: XEventListeners;\n\n created(): void {\n this.handleXEventSubscription();\n }\n\n /**\n * Handles a subscription to all the events provided in the listeners with the function that\n * will execute the callback. Also unsubscribes on beforeDestroy.\n *\n * @internal\n */\n protected handleXEventSubscription(): void {\n const subscription = reduce(\n this.$listeners,\n (subscription, eventName, callback) => {\n subscription.add(\n this.$x.on(eventName, true).subscribe(({ eventPayload, metadata }) => {\n callback(eventPayload as never, metadata);\n })\n );\n return subscription;\n },\n new Subscription()\n );\n\n this.$on('hook:beforeDestroy', () => {\n subscription.unsubscribe();\n });\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no own events, but you can subscribe to any X Event using Vue listeners\n\n## See it in action\n\nThis component does not render anything. Its only responsibility is to facilitate listening to any X\nEvent by using Vue component listeners.\n\n```vue\n<template>\n <GlobalXBus @UserAcceptedAQuery=\"printQuery\" />\n</template>\n\n<script>\n import { GlobalXBus } from '@empathyco/x-components';\n export default {\n name: 'GlobalXBusTest',\n components: {\n GlobalXBus\n },\n methods: {\n printQuery(query, metadata) {\n console.log('My new query is:', query);\n console.log('And has been triggered by this DOM element:', metadata.target);\n }\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
+
import { reduce } from '@empathyco/x-utils';
|
|
2
3
|
import { Component } from 'vue-property-decorator';
|
|
3
4
|
import { Subscription } from 'rxjs';
|
|
4
|
-
import { reduce } from '../utils/object.js';
|
|
5
5
|
import { NoElement } from './no-element.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-x-bus.vue_rollup-plugin-vue_script.vue.js","sources":["../../../src/components/global-x-bus.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\nimport {
|
|
1
|
+
{"version":3,"file":"global-x-bus.vue_rollup-plugin-vue_script.vue.js","sources":["../../../src/components/global-x-bus.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\nimport { reduce } from '@empathyco/x-utils';\nimport { Component } from 'vue-property-decorator';\nimport { Subscription } from 'rxjs';\nimport { XEventListeners } from '../x-installer/api/api.types';\nimport { NoElement } from './no-element';\n\n/**\n * This component helps subscribing to any {@link XEvent} with custom callbacks using Vue\n * listeners API.\n *\n * @public\n */\n@Component\nexport default class GlobalXBus extends NoElement {\n /**\n * Object with the {@link XEvent} listeners.\n *\n * @internal\n */\n public $listeners!: XEventListeners;\n\n created(): void {\n this.handleXEventSubscription();\n }\n\n /**\n * Handles a subscription to all the events provided in the listeners with the function that\n * will execute the callback. Also unsubscribes on beforeDestroy.\n *\n * @internal\n */\n protected handleXEventSubscription(): void {\n const subscription = reduce(\n this.$listeners,\n (subscription, eventName, callback) => {\n subscription.add(\n this.$x.on(eventName, true).subscribe(({ eventPayload, metadata }) => {\n callback(eventPayload as never, metadata);\n })\n );\n return subscription;\n },\n new Subscription()\n );\n\n this.$on('hook:beforeDestroy', () => {\n subscription.unsubscribe();\n });\n }\n}\n"],"names":[],"mappings":";;;;;;AAOA;;;;;;AAOA,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,SAAS;IAQ/C,OAAO;QACL,IAAI,CAAC,wBAAwB,EAAE,CAAC;KACjC;;;;;;;IAQS,wBAAwB;QAChC,MAAM,YAAY,GAAG,MAAM,CACzB,IAAI,CAAC,UAAU,EACf,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ;YAChC,YAAY,CAAC,GAAG,CACd,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE;gBAC/D,QAAQ,CAAC,YAAqB,EAAE,QAAQ,CAAC,CAAC;aAC3C,CAAC,CACH,CAAC;YACF,OAAO,YAAY,CAAC;SACrB,EACD,IAAI,YAAY,EAAE,CACnB,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,oBAAoB,EAAE;YAC7B,YAAY,CAAC,WAAW,EAAE,CAAC;SAC5B,CAAC,CAAC;KACJ;CACF,CAAA;AApCoB,UAAU;IAD9B,SAAS;GACW,UAAU,CAoC9B;aApCoB,UAAU;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-callbacks.vue.js","sources":["../../../src/components/snippet-callbacks.vue"],"sourcesContent":["<template>\n <GlobalXBus v-on=\"eventListeners\" />\n</template>\n\n<script lang=\"ts\">\n import {
|
|
1
|
+
{"version":3,"file":"snippet-callbacks.vue.js","sources":["../../../src/components/snippet-callbacks.vue"],"sourcesContent":["<template>\n <GlobalXBus v-on=\"eventListeners\" />\n</template>\n\n<script lang=\"ts\">\n import { map } from '@empathyco/x-utils';\n import { Component, Inject } from 'vue-property-decorator';\n import Vue from 'vue';\n import { WireMetadata } from '../wiring';\n import { SnippetConfig, XEventListeners } from '../x-installer/api/api.types';\n import GlobalXBus from './global-x-bus.vue';\n\n /**\n * This component subscribes to any {@link XEvent} with a custom callbacks provided by the snippet\n * configuration.\n *\n * @public\n */\n @Component({\n components: { GlobalXBus }\n })\n export default class SnippetCallbacks extends Vue {\n /**\n * Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject('snippetConfig')\n public snippetConfig!: SnippetConfig;\n\n /**\n * It maps all the callbacks provided by the snippetConfig and adds an emit to each one.\n *\n * @returns The event listeners with the {@link XEventsTypes.SnippetCallbackExecuted} emit in\n * the callback.\n *\n * @internal\n *\n */\n protected get eventListeners(): XEventListeners {\n const { callbacks } = this.snippetConfig;\n return callbacks\n ? map(callbacks, (eventName, callback) => {\n return (payload: unknown, metadata: WireMetadata) => {\n const callbackReturn = callback(payload as never, metadata);\n this.$x.emit('SnippetCallbackExecuted', {\n event: eventName,\n callbackReturn,\n payload: payload as never,\n metadata\n });\n };\n })\n : ({} as XEventListeners);\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThe `SnippetCallbacks` will emit the `SnippetCallbackExecuted` each time a callback provided by the\nsnippetConfig is fired.\n\n## See it in action\n\nThis component does not render anything. Its only responsibility is to receive any callback that\nwill be triggered once its listened event is emitted.\n\n```vue\n<template>\n <SnippetCallbacks />\n</template>\n\n<script>\n import { SnippetCallbacks } from '@empathyco/x-components';\n export default {\n name: 'SnippetCallbacksTest',\n components: {\n SnippetCallbacks\n }\n };\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
+
import { map } from '@empathyco/x-utils';
|
|
2
3
|
import { Inject, Component } from 'vue-property-decorator';
|
|
3
4
|
import Vue from 'vue';
|
|
4
|
-
import { map } from '../utils/object.js';
|
|
5
5
|
import __vue_component__ from './global-x-bus.vue.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippet-callbacks.vue_rollup-plugin-vue_script.vue.js","sources":["../../../src/components/snippet-callbacks.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\nimport { Component, Inject } from 'vue-property-decorator';\nimport Vue from 'vue';\nimport {
|
|
1
|
+
{"version":3,"file":"snippet-callbacks.vue_rollup-plugin-vue_script.vue.js","sources":["../../../src/components/snippet-callbacks.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\nimport { map } from '@empathyco/x-utils';\nimport { Component, Inject } from 'vue-property-decorator';\nimport Vue from 'vue';\nimport { WireMetadata } from '../wiring';\nimport { SnippetConfig, XEventListeners } from '../x-installer/api/api.types';\nimport GlobalXBus from './global-x-bus.vue';\n\n/**\n * This component subscribes to any {@link XEvent} with a custom callbacks provided by the snippet\n * configuration.\n *\n * @public\n */\n@Component({\n components: { GlobalXBus }\n})\nexport default class SnippetCallbacks extends Vue {\n /**\n * Injects {@link SnippetConfig} provided by an ancestor as snippetConfig.\n *\n * @internal\n */\n @Inject('snippetConfig')\n public snippetConfig!: SnippetConfig;\n\n /**\n * It maps all the callbacks provided by the snippetConfig and adds an emit to each one.\n *\n * @returns The event listeners with the {@link XEventsTypes.SnippetCallbackExecuted} emit in\n * the callback.\n *\n * @internal\n *\n */\n protected get eventListeners(): XEventListeners {\n const { callbacks } = this.snippetConfig;\n return callbacks\n ? map(callbacks, (eventName, callback) => {\n return (payload: unknown, metadata: WireMetadata) => {\n const callbackReturn = callback(payload as never, metadata);\n this.$x.emit('SnippetCallbackExecuted', {\n event: eventName,\n callbackReturn,\n payload: payload as never,\n metadata\n });\n };\n })\n : ({} as XEventListeners);\n }\n}\n"],"names":["GlobalXBus"],"mappings":";;;;;;AAYA;;;;;;AASA,IAAqB,gBAAgB,GAArC,MAAqB,gBAAiB,SAAQ,GAAG;;;;;;;;;;IAkB/C,IAAc,cAAc;QAC1B,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,OAAO,SAAS;cACZ,GAAG,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,QAAQ;gBACjC,OAAO,CAAC,OAAgB,EAAE,QAAsB;oBAC9C,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAgB,EAAE,QAAQ,CAAC,CAAC;oBAC5D,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE;wBACtC,KAAK,EAAE,SAAS;wBAChB,cAAc;wBACd,OAAO,EAAE,OAAgB;wBACzB,QAAQ;qBACT,CAAC,CAAC;iBACJ,CAAC;aACH,CAAC;cACD,EAAsB,CAAC;KAC7B;CACF,CAAA;AA3BC;IADC,MAAM,CAAC,eAAe,CAAC;uDACa;AAPlB,gBAAgB;IAHpC,SAAS,CAAC;QACT,UAAU,EAAE,cAAEA,iBAAU,EAAE;KAC3B,CAAC;GACmB,gBAAgB,CAkCpC;aAlCoB,gBAAgB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button @click=\"emitEvents\" :class=\"dynamicCSSClasses\" class=\"x-suggestion\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {string} queryHTML - Suggestion's query with the matching part inside a `<span>` tag\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ suggestion, queryHTML }\">\n <span v-html=\"queryHTML\" :aria-label=\"suggestion.query\" class=\"x-suggestion__query\" />\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { Suggestion } from '@empathyco/x-types';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { QueryFeature } from '../../types/origin';\n import {
|
|
1
|
+
{"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button @click=\"emitEvents\" :class=\"dynamicCSSClasses\" class=\"x-suggestion\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {string} queryHTML - Suggestion's query with the matching part inside a `<span>` tag\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ suggestion, queryHTML }\">\n <span v-html=\"queryHTML\" :aria-label=\"suggestion.query\" class=\"x-suggestion__query\" />\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\n import { Suggestion } from '@empathyco/x-types';\n import { forEach } from '@empathyco/x-utils';\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { QueryFeature } from '../../types/origin';\n import { normalizeString } from '../../utils/normalize';\n import { sanitize } from '../../utils/sanitize';\n import { VueCSSClasses } from '../../utils/types';\n import { XEventsTypes } from '../../wiring/events.types';\n\n /**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent | XEvents} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n @Component\n export default class BaseSuggestion extends Vue {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n @Prop({ default: '' })\n protected query!: string;\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestion!: Suggestion;\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n @Prop() //TODO: set to true when the suggestions components pass it.\n protected feature?: QueryFeature;\n\n /**\n * The {@link XEvent | XEvents} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestionSelectedEvents!: Partial<XEventsTypes>;\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n @Prop({ default: false, type: Boolean })\n protected highlightCurated!: boolean;\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * * UserAcceptedAQuery: suggestion.query\n * * UserSelectedASuggestion: suggestion\n * * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent | XEvents} to emit.\n * @public\n */\n protected get events(): Partial<XEventsTypes> {\n return {\n UserAcceptedAQuery: this.suggestion.query,\n UserSelectedASuggestion: this.suggestion,\n ...this.suggestionSelectedEvents\n };\n }\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n protected emitEvents(): void {\n forEach(this.events, (event, payload) => {\n this.$x.emit(event, payload, {\n target: this.$el as HTMLElement,\n feature: this.feature\n });\n });\n }\n\n /**\n * Checks if the normalized suggestion query matches with the module's query so it has a\n * matching part.\n *\n * @returns If the query has a matching part or not.\n * @internal\n */\n protected get hasMatchingQuery(): boolean {\n return !!this.query && normalizeString(this.suggestion.query).includes(this.query);\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n protected get shouldHighlightCurated(): boolean {\n return this.highlightCurated && !!this.suggestion.isCurated;\n }\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n protected get dynamicCSSClasses(): VueCSSClasses {\n return {\n 'x-suggestion--matching': this.hasMatchingQuery,\n 'x-suggestion--is-curated': this.shouldHighlightCurated\n };\n }\n\n /**\n * Highlights the matching part of the suggestion query with the query passed as prop of the\n * component putting it inside a `<span>` tag.\n *\n * @remarks\n * The query prop should be normalized.\n *\n * @returns The suggestion's query with the matching part inside a `<span>` tag.\n * @public\n */\n protected get queryHTML(): string {\n if (this.hasMatchingQuery) {\n const matcherIndex = normalizeString(this.suggestion.query).indexOf(this.query);\n\n const [beginning, matching, end] = this.splitAt(\n this.suggestion.query,\n matcherIndex,\n this.query.length\n );\n\n const attrsMatching = 'data-test=\"matching-part\" class=\"x-suggestion__matching-part\"';\n return `${beginning}<span ${attrsMatching}>${matching}</span>${end}`;\n }\n\n return sanitize(this.suggestion.query);\n }\n\n /**\n * Splits the label in three parts based on two indexes.\n *\n * @param label - The string that will be divided in three parts.\n * @param start - The first index that the label will be divided by.\n * @param skip - The second index that the label will be divided by.\n *\n * @returns The three parts of the divided label.\n * @internal\n */\n protected splitAt(label: string, start: number, skip: number): [string, string, string] {\n const startPart = label.substr(0, start);\n const matchingPart = label.substr(start, skip);\n const endPart = label.substr(start + skip);\n\n return [sanitize(startPart), sanitize(matchingPart), sanitize(endPart)];\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThis default suggestion component expects a suggestion to render and pass to its default slot, a\nnormalized query to compare with the suggestion's query and highlight its matching parts and events\nto emit when the suggestion is selected.\n\n### Default usage\n\n```vue\n<BaseSuggestion v-bind=\"{ query, suggestion, suggestionSelectedEvents }\" />\n```\n\n### Customized usage\n\n```vue\n<BaseSuggestion v-bind=\"{ query, suggestion, suggestionSelectedEvents }\">\n <template #default=\"{ suggestion, queryHTML }\">\n <span\n class=\"my-suggestion\"\n v-html=\"queryHTML\"\n :aria-label=\"suggestion.query\"\n />\n </template>\n</BaseSuggestion>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQuery`: the event is emitted after the user clicks the button. The event payload is\n the suggestion query data.\n- `UserSelectedASuggestion`: the event is emitted after the user clicks the button. The event\n payload is the suggestion data.\n- The component can emit more events on click using the `suggestionSelectedEvents` prop.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
+
import { forEach } from '@empathyco/x-utils';
|
|
2
3
|
import Vue from 'vue';
|
|
3
4
|
import { Prop, Component } from 'vue-property-decorator';
|
|
4
|
-
import { forEach } from '../../utils/object.js';
|
|
5
5
|
import { normalizeString } from '../../utils/normalize.js';
|
|
6
6
|
import { sanitize } from '../../utils/sanitize.js';
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-suggestion.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Suggestion } from '@empathyco/x-types';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { QueryFeature } from '../../types/origin';\nimport {
|
|
1
|
+
{"version":3,"file":"base-suggestion.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Suggestion } from '@empathyco/x-types';\nimport { forEach } from '@empathyco/x-utils';\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { QueryFeature } from '../../types/origin';\nimport { normalizeString } from '../../utils/normalize';\nimport { sanitize } from '../../utils/sanitize';\nimport { VueCSSClasses } from '../../utils/types';\nimport { XEventsTypes } from '../../wiring/events.types';\n\n/**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent | XEvents} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\n@Component\nexport default class BaseSuggestion extends Vue {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n @Prop({ default: '' })\n protected query!: string;\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestion!: Suggestion;\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n @Prop() //TODO: set to true when the suggestions components pass it.\n protected feature?: QueryFeature;\n\n /**\n * The {@link XEvent | XEvents} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n @Prop({ required: true })\n protected suggestionSelectedEvents!: Partial<XEventsTypes>;\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n @Prop({ default: false, type: Boolean })\n protected highlightCurated!: boolean;\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * * UserAcceptedAQuery: suggestion.query\n * * UserSelectedASuggestion: suggestion\n * * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent | XEvents} to emit.\n * @public\n */\n protected get events(): Partial<XEventsTypes> {\n return {\n UserAcceptedAQuery: this.suggestion.query,\n UserSelectedASuggestion: this.suggestion,\n ...this.suggestionSelectedEvents\n };\n }\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n protected emitEvents(): void {\n forEach(this.events, (event, payload) => {\n this.$x.emit(event, payload, {\n target: this.$el as HTMLElement,\n feature: this.feature\n });\n });\n }\n\n /**\n * Checks if the normalized suggestion query matches with the module's query so it has a\n * matching part.\n *\n * @returns If the query has a matching part or not.\n * @internal\n */\n protected get hasMatchingQuery(): boolean {\n return !!this.query && normalizeString(this.suggestion.query).includes(this.query);\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n protected get shouldHighlightCurated(): boolean {\n return this.highlightCurated && !!this.suggestion.isCurated;\n }\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n protected get dynamicCSSClasses(): VueCSSClasses {\n return {\n 'x-suggestion--matching': this.hasMatchingQuery,\n 'x-suggestion--is-curated': this.shouldHighlightCurated\n };\n }\n\n /**\n * Highlights the matching part of the suggestion query with the query passed as prop of the\n * component putting it inside a `<span>` tag.\n *\n * @remarks\n * The query prop should be normalized.\n *\n * @returns The suggestion's query with the matching part inside a `<span>` tag.\n * @public\n */\n protected get queryHTML(): string {\n if (this.hasMatchingQuery) {\n const matcherIndex = normalizeString(this.suggestion.query).indexOf(this.query);\n\n const [beginning, matching, end] = this.splitAt(\n this.suggestion.query,\n matcherIndex,\n this.query.length\n );\n\n const attrsMatching = 'data-test=\"matching-part\" class=\"x-suggestion__matching-part\"';\n return `${beginning}<span ${attrsMatching}>${matching}</span>${end}`;\n }\n\n return sanitize(this.suggestion.query);\n }\n\n /**\n * Splits the label in three parts based on two indexes.\n *\n * @param label - The string that will be divided in three parts.\n * @param start - The first index that the label will be divided by.\n * @param skip - The second index that the label will be divided by.\n *\n * @returns The three parts of the divided label.\n * @internal\n */\n protected splitAt(label: string, start: number, skip: number): [string, string, string] {\n const startPart = label.substr(0, start);\n const matchingPart = label.substr(start, skip);\n const endPart = label.substr(start + skip);\n\n return [sanitize(startPart), sanitize(matchingPart), sanitize(endPart)];\n }\n}\n"],"names":[],"mappings":";;;;;;;AA0BA;;;;;;;;;AAUA,IAAqB,cAAc,GAAnC,MAAqB,cAAe,SAAQ,GAAG;;;;;;;;;;;;IAoD7C,IAAc,MAAM;QAClB,OAAO;YACL,kBAAkB,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK;YACzC,uBAAuB,EAAE,IAAI,CAAC,UAAU;YACxC,GAAG,IAAI,CAAC,wBAAwB;SACjC,CAAC;KACH;;;;;;IAOS,UAAU;QAClB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO;YAClC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;gBAC3B,MAAM,EAAE,IAAI,CAAC,GAAkB;gBAC/B,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ;;;;;;;;IASD,IAAc,gBAAgB;QAC5B,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACpF;;;;;;;;IASD,IAAc,sBAAsB;QAClC,OAAO,IAAI,CAAC,gBAAgB,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;KAC7D;;;;;;;;;;IAWD,IAAc,iBAAiB;QAC7B,OAAO;YACL,wBAAwB,EAAE,IAAI,CAAC,gBAAgB;YAC/C,0BAA0B,EAAE,IAAI,CAAC,sBAAsB;SACxD,CAAC;KACH;;;;;;;;;;;IAYD,IAAc,SAAS;QACrB,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEhF,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAC7C,IAAI,CAAC,UAAU,CAAC,KAAK,EACrB,YAAY,EACZ,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,CAAC;YAEF,MAAM,aAAa,GAAG,+DAA+D,CAAC;YACtF,OAAO,GAAG,SAAS,SAAS,aAAa,IAAI,QAAQ,UAAU,GAAG,EAAE,CAAC;SACtE;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;KACxC;;;;;;;;;;;IAYS,OAAO,CAAC,KAAa,EAAE,KAAa,EAAE,IAAY;QAC1D,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACzC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAE3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;KACzE;CACF,CAAA;AArJC;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;6CACG;AAQzB;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACS;AAQlC;IADC,IAAI,EAAE;+CAC0B;AAQjC;IADC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gEACkC;AAQ3D;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDACH;AAvClB,cAAc;IADlC,SAAS;GACW,cAAc,CA4JlC;aA5JoB,cAAc;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-message.filter.js","sources":["../../../src/filters/compile-message.filter.ts"],"sourcesContent":["import { Dictionary } from '
|
|
1
|
+
{"version":3,"file":"compile-message.filter.js","sources":["../../../src/filters/compile-message.filter.ts"],"sourcesContent":["import { Dictionary } from '@empathyco/x-utils';\n\n/**\n * Replaces a key in compiledMessage for the provided key's value.\n *\n * @param compiledMessage - String containing the key to be replaced.\n * @param keyValueEntry - Key would be the string replaced in compiledMessage and value the\n * string that will get replaced with.\n * @returns Formatted string.\n * @internal\n */\nconst replaceParams = (compiledMessage: string, [key, value]: [string, string | number]): string =>\n compiledMessage.replace(new RegExp(`{${key}}`, 'g'), value.toString());\n\n/**\n * Replaces each key in compiledMessage for the provided key's value.\n *\n * @param message - String containing the keys to be replaced.\n * @param params - Dictionary of key-values that will be used to format compiledMessage.\n * @returns Formatted string.\n * @public\n */\nexport function compileMessage(message: string, params: Dictionary<string | number>): string {\n return message && params\n ? Object.entries<string | number>(params).reduce(replaceParams, message)\n : message;\n}\n"],"names":[],"mappings":"AAEA;;;;;;;;;AASA,MAAM,aAAa,GAAG,CAAC,eAAuB,EAAE,CAAC,GAAG,EAAE,KAAK,CAA4B,KACrF,eAAe,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEzE;;;;;;;;SAQgB,cAAc,CAAC,OAAe,EAAE,MAAmC;IACjF,OAAO,OAAO,IAAI,MAAM;UACpB,MAAM,CAAC,OAAO,CAAkB,MAAM,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC;UACtE,OAAO,CAAC;AACd;;;;"}
|
package/js/index.js
CHANGED
|
@@ -136,7 +136,6 @@ export { getURLParameter } from './utils/get-url-parameters.js';
|
|
|
136
136
|
export { isElementEqualOrContained } from './utils/html.js';
|
|
137
137
|
export { normalizeString } from './utils/normalize.js';
|
|
138
138
|
export { isInRange } from './utils/number.js';
|
|
139
|
-
export { cleanUndefined, every, forEach, getNewAndUpdatedKeys, map, objectFilter, reduce } from './utils/object.js';
|
|
140
139
|
export { createOrigin } from './utils/origin.js';
|
|
141
140
|
export { sanitize } from './utils/sanitize.js';
|
|
142
141
|
export { localStorageService } from './utils/storage.js';
|