@empathyco/x-components 6.0.0-alpha.75 → 6.0.0-alpha.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/design-system/deprecated-full-theme.css +1624 -1624
- package/docs/API-reference/api/x-components.allfilter.md +3 -3
- package/docs/API-reference/api/x-components.baseeventsmodalclose.md +3 -3
- package/docs/API-reference/api/x-components.baseeventsmodalopen.md +3 -3
- package/docs/API-reference/api/x-components.facets.md +3 -3
- package/docs/API-reference/api/x-components.globalxbus.md +4 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +2 -0
- package/docs/API-reference/api/x-components.historyqueries.md +1 -1
- package/docs/API-reference/api/x-components.historyquery.md +1 -1
- package/docs/API-reference/api/x-components.identifierresult.md +2 -2
- package/docs/API-reference/api/x-components.md +5 -3
- package/docs/API-reference/api/x-components.nextqueries.md +1 -1
- package/docs/API-reference/api/x-components.popularsearches.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestion.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestions.md +1 -1
- package/docs/API-reference/api/x-components.relatedpromptsxevents.md +2 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsresponsechanged.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsunmounted.md +13 -0
- package/docs/API-reference/api/x-components.semanticquery.md +1 -1
- package/docs/API-reference/api/x-components.simplefilter.md +2 -0
- package/docs/API-reference/api/x-components.snippetcallbacks.md +2 -0
- package/docs/API-reference/api/x-components.tracknoresultsquerywithfallbackwire.md +13 -0
- package/docs/API-reference/api/x-components.tracknoresultsquerywithfallbackwiredebounced.md +13 -0
- package/docs/API-reference/api/x-components.tracknoresultsquerywithsemanticswire.md +6 -1
- package/docs/API-reference/api/x-components.tracknoresultsquerywithsemanticswiredebounced.md +6 -1
- package/docs/API-reference/api/x-components.usegetter.md +3 -17
- package/js/composables/use-getter.js +11 -11
- package/js/composables/use-getter.js.map +1 -1
- package/js/index.js +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue2.js +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue2.js.map +1 -1
- package/js/x-modules/facets/composables/use-facets.js +1 -4
- package/js/x-modules/facets/composables/use-facets.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue2.js +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue2.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue2.js +1 -1
- package/js/x-modules/history-queries/components/history-query.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 -3
- package/js/x-modules/identifier-results/components/identifier-result.vue2.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries-list.vue.js +1 -3
- package/js/x-modules/next-queries/components/next-queries-list.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue2.js +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue2.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue2.js +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue2.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue2.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue2.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 +4 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -1
- package/js/x-modules/related-prompts/store/emitters.js +1 -0
- package/js/x-modules/related-prompts/store/emitters.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue2.js +1 -3
- package/js/x-modules/related-tags/components/related-tags.vue2.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-query.vue2.js +2 -2
- package/js/x-modules/semantic-queries/components/semantic-query.vue2.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +27 -8
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +293 -144
- package/report/x-components.api.md +42 -18
- package/tagging/index.js +1 -1
- package/types/components/global-x-bus.vue.d.ts +4 -0
- package/types/components/global-x-bus.vue.d.ts.map +1 -1
- package/types/components/modals/base-events-modal-close.vue.d.ts +3 -3
- package/types/components/modals/base-events-modal-open.vue.d.ts +3 -3
- package/types/components/snippet-callbacks.vue.d.ts +2 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/composables/use-getter.d.ts +13 -3
- package/types/composables/use-getter.d.ts.map +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +4 -4
- package/types/x-modules/facets/components/facets/facets.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/all-filter.vue.d.ts +4 -4
- package/types/x-modules/facets/components/filters/all-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +2 -0
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +2 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-queries.vue.d.ts +1 -1
- package/types/x-modules/history-queries/components/history-query.vue.d.ts +1 -1
- package/types/x-modules/identifier-results/components/identifier-result.vue.d.ts +3 -3
- package/types/x-modules/identifier-results/components/identifier-result.vue.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-queries.vue.d.ts +1 -1
- package/types/x-modules/popular-searches/components/popular-searches.vue.d.ts +1 -1
- package/types/x-modules/query-suggestions/components/query-suggestion.vue.d.ts +1 -1
- package/types/x-modules/query-suggestions/components/query-suggestions.vue.d.ts +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/events.types.d.ts +10 -1
- package/types/x-modules/related-prompts/events.types.d.ts.map +1 -1
- package/types/x-modules/related-prompts/store/emitters.d.ts +1 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -1
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts.map +1 -1
- package/types/x-modules/semantic-queries/components/semantic-query.vue.d.ts +1 -1
- package/types/x-modules/tagging/wiring.d.ts +23 -4
- package/types/x-modules/tagging/wiring.d.ts.map +1 -1
|
@@ -15,11 +15,11 @@ _default: import("vue").DefineComponent<{
|
|
|
15
15
|
required: true;
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
18
|
-
clickEvent: ComputedRef<Partial<XEventsTypes>>;
|
|
19
|
-
cssClasses: ComputedRef<{
|
|
18
|
+
clickEvent: import("vue").ComputedRef<Partial<XEventsTypes>>;
|
|
19
|
+
cssClasses: import("vue").ComputedRef<{
|
|
20
20
|
'x-selected x-all-filter--is-selected': boolean;
|
|
21
21
|
}>;
|
|
22
|
-
isSelected: ComputedRef<boolean>;
|
|
22
|
+
isSelected: import("vue").ComputedRef<boolean>;
|
|
23
23
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
24
|
facet: {
|
|
25
25
|
type: PropType<Facet>;
|
|
@@ -11,17 +11,17 @@ Component contains an event button that emits [XEventsTypes.UserClickedCloseEven
|
|
|
11
11
|
```typescript
|
|
12
12
|
_default: import("vue").DefineComponent<{
|
|
13
13
|
closingEvent: {
|
|
14
|
-
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection">;
|
|
14
|
+
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection" | "RelatedPromptsUnmounted">;
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
18
18
|
events: import("vue").ComputedRef<Partial<XEventsTypes>>;
|
|
19
19
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
20
|
closingEvent: {
|
|
21
|
-
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection">;
|
|
21
|
+
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection" | "RelatedPromptsUnmounted">;
|
|
22
22
|
default: string;
|
|
23
23
|
};
|
|
24
24
|
}>>, {
|
|
25
|
-
closingEvent: "UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection";
|
|
25
|
+
closingEvent: "UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection" | "RelatedPromptsUnmounted";
|
|
26
26
|
}, {}>
|
|
27
27
|
```
|
|
@@ -11,17 +11,17 @@ Component contains an event button that emits [XEventsTypes.UserClickedOpenEvent
|
|
|
11
11
|
```typescript
|
|
12
12
|
_default: import("vue").DefineComponent<{
|
|
13
13
|
openingEvent: {
|
|
14
|
-
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection">;
|
|
14
|
+
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection" | "RelatedPromptsUnmounted">;
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
18
18
|
events: import("vue").ComputedRef<Partial<XEventsTypes>>;
|
|
19
19
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
20
|
openingEvent: {
|
|
21
|
-
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection">;
|
|
21
|
+
type: PropType<"UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection" | "RelatedPromptsUnmounted">;
|
|
22
22
|
default: string;
|
|
23
23
|
};
|
|
24
24
|
}>>, {
|
|
25
|
-
openingEvent: "UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection";
|
|
25
|
+
openingEvent: "UserClickedCloseEventsModal" | "UserClickedCloseX" | "UserClickedOutOfMainModal" | "UserClickedOpenEventsModal" | "UserClickedOpenX" | "UserClickedOutOfEventsModal" | "UserOpenXProgrammatically" | "UserReachedEmpathizeTop" | "EmpathizeClosed" | "EmpathizeOpened" | "UserClosedEmpathize" | "UserPressedClearHistoryQueries" | "UserClickedEnableHistoryQueries" | "UserClickedDisableHistoryQueries" | "UserClickedConfirmDisableHistoryQueries" | "UserClickedDismissDisableHistoryQueries" | "ScrollRestoreSucceeded" | "ScrollRestoreFailed" | "UserHoveredInSearchBox" | "UserHoveredOutSearchBox" | "UserBlurredSearchBox" | "UserClickedSearchBox" | "UserFocusedSearchBox" | "UserPressedClearSearchBoxButton" | "ReloadSearchRequested" | "UserReachedResultsListEnd" | "UserClickedAbortARedirection" | "RelatedPromptsUnmounted";
|
|
26
26
|
}, {}>
|
|
27
27
|
```
|
|
@@ -18,9 +18,9 @@ _default: import("vue").DefineComponent<{
|
|
|
18
18
|
};
|
|
19
19
|
renderableFacets: StringConstructor;
|
|
20
20
|
}, {
|
|
21
|
-
selectedFiltersByFacet: ComputedRef<import("../..").FiltersByFacet>;
|
|
22
|
-
hasFacets: ComputedRef<boolean>;
|
|
23
|
-
mappedFacets: ComputedRef<Dictionary<RenderFacet>>;
|
|
21
|
+
selectedFiltersByFacet: import("vue").ComputedRef<import("../..").FiltersByFacet>;
|
|
22
|
+
hasFacets: import("vue").ComputedRef<boolean>;
|
|
23
|
+
mappedFacets: import("vue").ComputedRef<Dictionary<RenderFacet>>;
|
|
24
24
|
hasSlot: (name: string) => boolean;
|
|
25
25
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
26
|
facetsIds: PropType<(string | number)[]>;
|
|
@@ -178,6 +178,8 @@ _default: import("vue").DefineComponent<{
|
|
|
178
178
|
UserSelectedARelatedPromptQuery: (payload: number, metadata: import("..").WireMetadata) => unknown;
|
|
179
179
|
UserClickedARelatedPromptResult: (payload: import("@empathyco/x-types").Result, metadata: import("..").WireMetadata) => unknown;
|
|
180
180
|
UserClickedARelatedPromptAdd2Cart: (payload: import("@empathyco/x-types").Result, metadata: import("..").WireMetadata) => unknown;
|
|
181
|
+
RelatedPromptsResponseChanged: (payload: import("@empathyco/x-types").RelatedPrompt[], metadata: import("..").WireMetadata) => unknown;
|
|
182
|
+
RelatedPromptsUnmounted: (payload: undefined, metadata: import("..").WireMetadata) => unknown;
|
|
181
183
|
}>>;
|
|
182
184
|
required: true;
|
|
183
185
|
};
|
|
@@ -350,6 +352,8 @@ _default: import("vue").DefineComponent<{
|
|
|
350
352
|
UserSelectedARelatedPromptQuery: (payload: number, metadata: import("..").WireMetadata) => unknown;
|
|
351
353
|
UserClickedARelatedPromptResult: (payload: import("@empathyco/x-types").Result, metadata: import("..").WireMetadata) => unknown;
|
|
352
354
|
UserClickedARelatedPromptAdd2Cart: (payload: import("@empathyco/x-types").Result, metadata: import("..").WireMetadata) => unknown;
|
|
355
|
+
RelatedPromptsResponseChanged: (payload: import("@empathyco/x-types").RelatedPrompt[], metadata: import("..").WireMetadata) => unknown;
|
|
356
|
+
RelatedPromptsUnmounted: (payload: undefined, metadata: import("..").WireMetadata) => unknown;
|
|
353
357
|
}>>;
|
|
354
358
|
required: true;
|
|
355
359
|
};
|
|
@@ -190,6 +190,8 @@ _default: import("vue").DefineComponent<{
|
|
|
190
190
|
UserSelectedARelatedPromptQuery?: number | undefined;
|
|
191
191
|
UserClickedARelatedPromptResult?: import("@empathyco/x-types").Result | undefined;
|
|
192
192
|
UserClickedARelatedPromptAdd2Cart?: import("@empathyco/x-types").Result | undefined;
|
|
193
|
+
RelatedPromptsResponseChanged?: import("@empathyco/x-types").RelatedPrompt[] | undefined;
|
|
194
|
+
RelatedPromptsUnmounted?: void | undefined;
|
|
193
195
|
}>;
|
|
194
196
|
innerCssClasses: import("vue").ComputedRef<(string | Dictionary<boolean>)[]>;
|
|
195
197
|
renderedChildrenFilters: import("vue").ComputedRef<HierarchicalFilterModel[]>;
|
|
@@ -10,6 +10,6 @@ This component renders a list of suggestions coming from the user queries histor
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
_default: import("vue").DefineComponent<{}, {
|
|
13
|
-
historyQueriesWithResults: import("vue").ComputedRef<
|
|
13
|
+
historyQueriesWithResults: import("vue").ComputedRef<import("@empathyco/x-types").HistoryQuery[]>;
|
|
14
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
|
|
15
15
|
```
|
|
@@ -17,7 +17,7 @@ _default: import("vue").DefineComponent<{
|
|
|
17
17
|
removeButtonClass: StringConstructor;
|
|
18
18
|
suggestionClass: StringConstructor;
|
|
19
19
|
}, {
|
|
20
|
-
query: import("vue").ComputedRef<
|
|
20
|
+
query: import("vue").ComputedRef<string>;
|
|
21
21
|
suggestionSelectedEvents: import("vue").ComputedRef<Partial<XEventsTypes>>;
|
|
22
22
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
23
|
suggestion: {
|
|
@@ -15,8 +15,8 @@ _default: import("vue").DefineComponent<{
|
|
|
15
15
|
required: true;
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
18
|
-
query: ComputedRef<string>;
|
|
19
|
-
highlightedQueryHTML: ComputedRef<string>;
|
|
18
|
+
query: import("vue").ComputedRef<string>;
|
|
19
|
+
highlightedQueryHTML: import("vue").ComputedRef<string>;
|
|
20
20
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
21
|
result: {
|
|
22
22
|
type: PropType<Result>;
|
|
@@ -87,7 +87,6 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
87
87
|
| [useEmitDisplayEvent({ element, taggingRequest, eventMetadata, })](./x-components.useemitdisplayevent.md) | Composable that emits a <code>TrackableElementDisplayed</code> event whenever the provided element appears in the viewport for the first time. |
|
|
88
88
|
| [useFacets(props)](./x-components.usefacets.md) | Composable to share Facets logic. |
|
|
89
89
|
| [useFiltersInjection(props)](./x-components.usefiltersinjection.md) | Composable to share filters injection logic. |
|
|
90
|
-
| [useGetter(module, getters)](./x-components.usegetter.md) | Function which returns the requested getters as a dictionary of getters. |
|
|
91
90
|
| [useOnDisplay({ element, callback, triggerOnce, })](./x-components.useondisplay.md) | Composable that triggers a callback whenever the provided element appears in the viewport. It can trigger the first time only or every time the element appears in the viewport. |
|
|
92
91
|
| [useScroll(props, { emit }, scrollEl)](./x-components.usescroll.md) | Composable to share Scroll logic. |
|
|
93
92
|
| [useState(module)](./x-components.usestate.md) | Function which returns the requested state's properties as a dictionary. |
|
|
@@ -650,8 +649,10 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
650
649
|
| [trackBannerClickedWire](./x-components.trackbannerclickedwire.md) | Tracks the tagging of the banner. |
|
|
651
650
|
| [trackDisplayClickedWire](./x-components.trackdisplayclickedwire.md) | Performs a track of a display result being clicked. |
|
|
652
651
|
| [trackElementDisplayedWire](./x-components.trackelementdisplayedwire.md) | Performs a track of a display element appearing. |
|
|
653
|
-
| [
|
|
654
|
-
| [
|
|
652
|
+
| [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md) | Performs a track of a query with no results that used related prompts or semantic queries as fallback. The totalHits will be changed to -1 if related prompts or semantic queries are found in order to differentiate it from scenarios where the user encounters a no-results page without any related prompts or semantic queries. |
|
|
653
|
+
| [trackNoResultsQueryWithFallbackWireDebounced](./x-components.tracknoresultsquerywithfallbackwiredebounced.md) | . Debounced version of [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md) |
|
|
654
|
+
| [trackNoResultsQueryWithSemanticsWire](./x-components.tracknoresultsquerywithsemanticswire.md) | Performs a track of a query with no results that used semantic queries as fallback. The totalHits will be changed to -1 if semantic queries are found in order to differentiate it from scenarios where the user encounters a no-results page without any semantic queries. |
|
|
655
|
+
| [trackNoResultsQueryWithSemanticsWireDebounced](./x-components.tracknoresultsquerywithsemanticswiredebounced.md) | Debounced version of [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md) |
|
|
655
656
|
| [trackQueryWire](./x-components.trackquerywire.md) | Tracks the tagging of the query. |
|
|
656
657
|
| [trackRelatedPromptToolingDisplayClickWire](./x-components.trackrelatedprompttoolingdisplayclickwire.md) | Performs a track of a clicked related prompt. |
|
|
657
658
|
| [trackResultClickedWire](./x-components.trackresultclickedwire.md) | Tracks the tagging of the result. |
|
|
@@ -661,6 +662,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
661
662
|
| [updateHistoryQueriesWithSearchResponse](./x-components.updatehistoryquerieswithsearchresponse.md) | Updates the history queries with the relevant info included in a search response. |
|
|
662
663
|
| [UrlHandler](./x-components.urlhandler.md) | This component manages the browser URL parameters to preserve them through reloads and browser history navigation. It allow to configure the default url parameter names using its attributes. This component doesn't render elements to the DOM. |
|
|
663
664
|
| [urlXModule](./x-components.urlxmodule.md) | URL [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the <code>url</code> entry point. |
|
|
665
|
+
| [useGetter](./x-components.usegetter.md) | Function which returns the requested getter's properties as a dictionary. |
|
|
664
666
|
| [useQueriesPreview](./x-components.usequeriespreview.md) | Composable helpers for the QueriesPreview module. |
|
|
665
667
|
| [xPlugin](./x-components.xplugin.md) | Vue plugin that modifies each component instance, extending them with the [X Component API](./x-components.xcomponentapi.md)<!-- -->. |
|
|
666
668
|
|
|
@@ -16,7 +16,7 @@ _default: import("vue").DefineComponent<{
|
|
|
16
16
|
};
|
|
17
17
|
suggestions: PropType<NextQueryModel[]>;
|
|
18
18
|
}, {
|
|
19
|
-
renderedNextQueries: import("vue").ComputedRef<
|
|
19
|
+
renderedNextQueries: import("vue").ComputedRef<NextQueryModel[]>;
|
|
20
20
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
21
|
highlightCurated: {
|
|
22
22
|
type: BooleanConstructor;
|
|
@@ -10,6 +10,6 @@ Simple popular-searches component that renders a list of suggestions, allowing t
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
_default: import("vue").DefineComponent<{}, {
|
|
13
|
-
popularSearches: import("vue").ComputedRef<
|
|
13
|
+
popularSearches: import("vue").ComputedRef<import("@empathyco/x-types").Suggestion[]>;
|
|
14
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
|
|
15
15
|
```
|
|
@@ -10,6 +10,6 @@ This component renders a list of possible search queries to select from as a que
|
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
12
|
_default: import("vue").DefineComponent<{}, {
|
|
13
|
-
suggestions: import("vue").ComputedRef<
|
|
13
|
+
suggestions: import("vue").ComputedRef<import("@empathyco/x-types").Suggestion[]>;
|
|
14
14
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
|
|
15
15
|
```
|
|
@@ -17,6 +17,8 @@ export interface RelatedPromptsXEvents
|
|
|
17
17
|
| Property | Modifiers | Type | Description |
|
|
18
18
|
| --- | --- | --- | --- |
|
|
19
19
|
| [RelatedPromptsRequestUpdated](./x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md) | | RelatedPromptsRequest \| null | Any property of the related-prompts request has changed Payload: The new related-prompts request or <code>null</code> if there is not enough data in the state to conform a valid request. |
|
|
20
|
+
| [RelatedPromptsResponseChanged](./x-components.relatedpromptsxevents.relatedpromptsresponsechanged.md) | | RelatedPrompt\[\] | The response list of related prompts has changed. Payload: The new related-prompts list. |
|
|
21
|
+
| [RelatedPromptsUnmounted](./x-components.relatedpromptsxevents.relatedpromptsunmounted.md) | | void | The related prompts has been unmounted. |
|
|
20
22
|
| [SelectedRelatedPromptChanged](./x-components.relatedpromptsxevents.selectedrelatedpromptchanged.md) | | number | Selected Related Prompt has been changed. Payload: Selected Related Prompt index. -1 is deselected. |
|
|
21
23
|
| [UserClickedARelatedPromptAdd2Cart](./x-components.relatedpromptsxevents.userclickedarelatedpromptadd2cart.md) | | Result | The user has clicked one add to cart from a prompt. Payload: The result that the user clicked. |
|
|
22
24
|
| [UserClickedARelatedPromptResult](./x-components.relatedpromptsxevents.userclickedarelatedpromptresult.md) | | Result | The user has clicked one prompt. Payload: The result that the user clicked. |
|
package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsresponsechanged.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [RelatedPromptsXEvents](./x-components.relatedpromptsxevents.md) > [RelatedPromptsResponseChanged](./x-components.relatedpromptsxevents.relatedpromptsresponsechanged.md)
|
|
4
|
+
|
|
5
|
+
## RelatedPromptsXEvents.RelatedPromptsResponseChanged property
|
|
6
|
+
|
|
7
|
+
The response list of related prompts has changed. Payload: The new related-prompts list.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
RelatedPromptsResponseChanged: RelatedPrompt[];
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [RelatedPromptsXEvents](./x-components.relatedpromptsxevents.md) > [RelatedPromptsUnmounted](./x-components.relatedpromptsxevents.relatedpromptsunmounted.md)
|
|
4
|
+
|
|
5
|
+
## RelatedPromptsXEvents.RelatedPromptsUnmounted property
|
|
6
|
+
|
|
7
|
+
The related prompts has been unmounted.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
RelatedPromptsUnmounted: void;
|
|
13
|
+
```
|
|
@@ -187,6 +187,8 @@ _default: import("vue").DefineComponent<{
|
|
|
187
187
|
UserSelectedARelatedPromptQuery?: number | undefined;
|
|
188
188
|
UserClickedARelatedPromptResult?: import("@empathyco/x-types").Result | undefined;
|
|
189
189
|
UserClickedARelatedPromptAdd2Cart?: import("@empathyco/x-types").Result | undefined;
|
|
190
|
+
RelatedPromptsResponseChanged?: import("@empathyco/x-types").RelatedPrompt[] | undefined;
|
|
191
|
+
RelatedPromptsUnmounted?: void | undefined;
|
|
190
192
|
}>;
|
|
191
193
|
innerCssClasses: import("vue").ComputedRef<(string | Dictionary<boolean>)[]>;
|
|
192
194
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -177,6 +177,8 @@ _default: import("vue").DefineComponent<{}, {
|
|
|
177
177
|
UserSelectedARelatedPromptQuery: (payload: number, metadata: WireMetadata) => unknown;
|
|
178
178
|
UserClickedARelatedPromptResult: (payload: import("@empathyco/x-types").Result, metadata: WireMetadata) => unknown;
|
|
179
179
|
UserClickedARelatedPromptAdd2Cart: (payload: import("@empathyco/x-types").Result, metadata: WireMetadata) => unknown;
|
|
180
|
+
RelatedPromptsResponseChanged: (payload: import("@empathyco/x-types").RelatedPrompt[], metadata: WireMetadata) => unknown;
|
|
181
|
+
RelatedPromptsUnmounted: (payload: undefined, metadata: WireMetadata) => unknown;
|
|
180
182
|
}>>;
|
|
181
183
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
|
|
182
184
|
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md)
|
|
4
|
+
|
|
5
|
+
## trackNoResultsQueryWithFallbackWire variable
|
|
6
|
+
|
|
7
|
+
Performs a track of a query with no results that used related prompts or semantic queries as fallback. The totalHits will be changed to -1 if related prompts or semantic queries are found in order to differentiate it from scenarios where the user encounters a no-results page without any related prompts or semantic queries.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
trackNoResultsQueryWithFallbackWire: Wire<any>
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [trackNoResultsQueryWithFallbackWireDebounced](./x-components.tracknoresultsquerywithfallbackwiredebounced.md)
|
|
4
|
+
|
|
5
|
+
## trackNoResultsQueryWithFallbackWireDebounced variable
|
|
6
|
+
|
|
7
|
+
. Debounced version of [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md)
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
trackNoResultsQueryWithFallbackWireDebounced: Wire<any>
|
|
13
|
+
```
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## trackNoResultsQueryWithSemanticsWire variable
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> Warning: This API is now obsolete.
|
|
8
|
+
>
|
|
9
|
+
> - Use [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md) instead.
|
|
10
|
+
>
|
|
11
|
+
|
|
12
|
+
Performs a track of a query with no results that used semantic queries as fallback. The totalHits will be changed to -1 if semantic queries are found in order to differentiate it from scenarios where the user encounters a no-results page without any semantic queries.
|
|
8
13
|
|
|
9
14
|
**Signature:**
|
|
10
15
|
|
package/docs/API-reference/api/x-components.tracknoresultsquerywithsemanticswiredebounced.md
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
## trackNoResultsQueryWithSemanticsWireDebounced variable
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> Warning: This API is now obsolete.
|
|
8
|
+
>
|
|
9
|
+
> - Use [trackNoResultsQueryWithFallbackWireDebounced](./x-components.tracknoresultsquerywithfallbackwiredebounced.md) instead.
|
|
10
|
+
>
|
|
11
|
+
|
|
12
|
+
Debounced version of [trackNoResultsQueryWithFallbackWire](./x-components.tracknoresultsquerywithfallbackwire.md)
|
|
8
13
|
|
|
9
14
|
**Signature:**
|
|
10
15
|
|
|
@@ -2,26 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [useGetter](./x-components.usegetter.md)
|
|
4
4
|
|
|
5
|
-
## useGetter
|
|
5
|
+
## useGetter variable
|
|
6
6
|
|
|
7
|
-
Function which returns the requested
|
|
7
|
+
Function which returns the requested getter's properties as a dictionary.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
|
|
12
|
+
useGetter: UseGetter
|
|
13
13
|
```
|
|
14
|
-
|
|
15
|
-
## Parameters
|
|
16
|
-
|
|
17
|
-
| Parameter | Type | Description |
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| module | Module | The [XModuleName](./x-components.xmodulename.md) of the getter. |
|
|
20
|
-
| getters | GetterName\[\] | List of getters names. |
|
|
21
|
-
|
|
22
|
-
**Returns:**
|
|
23
|
-
|
|
24
|
-
Dictionary<ComputedRef>
|
|
25
|
-
|
|
26
|
-
The requested getters from the module.
|
|
27
|
-
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed } from 'vue';
|
|
2
|
+
import { useStore } from 'vuex';
|
|
2
3
|
import '@vue/devtools-api';
|
|
3
4
|
import '../plugins/devtools/timeline.devtools.js';
|
|
4
5
|
import '@empathyco/x-utils';
|
|
@@ -8,25 +9,24 @@ import '../plugins/devtools/colors.utils.js';
|
|
|
8
9
|
import '../plugins/x-bus.js';
|
|
9
10
|
import '../plugins/x-plugin.js';
|
|
10
11
|
import { getGetterPath } from '../plugins/x-plugin.utils.js';
|
|
11
|
-
import { useStore } from 'vuex';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Function which returns the requested
|
|
14
|
+
* Function which returns the requested getter's properties as a dictionary.
|
|
15
15
|
*
|
|
16
16
|
* @param module - The {@link XModuleName} of the getter.
|
|
17
|
-
* @param getters - List of getters names.
|
|
18
17
|
* @returns The requested getters from the module.
|
|
19
18
|
* @public
|
|
20
19
|
*/
|
|
21
|
-
function useGetter(module
|
|
20
|
+
const useGetter = function useGetter(module) {
|
|
22
21
|
const store = useStore();
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
22
|
+
return new Proxy({}, {
|
|
23
|
+
get(_obj, getterName) {
|
|
24
|
+
const path = getGetterPath(module, getterName);
|
|
25
|
+
// eslint-disable-next-line ts/no-unsafe-member-access,ts/no-unsafe-return
|
|
26
|
+
return computed(() => store.getters[path]);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
30
|
|
|
31
31
|
export { useGetter };
|
|
32
32
|
//# sourceMappingURL=use-getter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-getter.js","sources":["../../../src/composables/use-getter.ts"],"sourcesContent":["import type { Dictionary } from '@empathyco/x-utils'\nimport type { ComputedRef } from 'vue'\nimport type { ExtractGetters, XModuleName } from '../x-modules/x-modules.types'\nimport { computed } from 'vue'\nimport { getGetterPath } from '../plugins/index'\
|
|
1
|
+
{"version":3,"file":"use-getter.js","sources":["../../../src/composables/use-getter.ts"],"sourcesContent":["import type { Dictionary } from '@empathyco/x-utils'\nimport type { ComputedRef } from 'vue'\nimport type { RootXStoreState } from '../store/index'\nimport type { ExtractGetters, XModuleName } from '../x-modules/x-modules.types'\nimport { computed } from 'vue'\nimport { useStore } from 'vuex'\nimport { getGetterPath } from '../plugins/index'\n\ninterface UseGetter {\n /** @deprecated Use the single-argument overload instead. */\n <Module extends XModuleName, Getters = keyof ExtractGetters<Module> & string[]>(\n module: Module,\n getters: Getters,\n ): Dictionary<ComputedRef>\n\n /**\n * Preferred. Use this signature for better type inference and future compatibility.\n */\n <Module extends XModuleName, Getters = ExtractGetters<Module>>(\n module: Module,\n ): { [P in keyof Getters]: ComputedRef<Getters[P]> }\n}\n\n/**\n * Function which returns the requested getter's properties as a dictionary.\n *\n * @param module - The {@link XModuleName} of the getter.\n * @returns The requested getters from the module.\n * @public\n */\nexport const useGetter: UseGetter = function useGetter<\n Module extends XModuleName,\n Getters = ExtractGetters<Module>,\n>(module: Module): { [P in keyof Getters]: ComputedRef<Getters[P]> } {\n const store = useStore<RootXStoreState>()\n return new Proxy({} as { [P in keyof Getters]: ComputedRef<Getters[P]> }, {\n get(_obj, getterName) {\n const path = getGetterPath(module, getterName as keyof ExtractGetters<Module>)\n // eslint-disable-next-line ts/no-unsafe-member-access,ts/no-unsafe-return\n return computed(() => store.getters[path as typeof getterName])\n },\n })\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAuBA;;;;;;AAMG;AACU,MAAA,SAAS,GAAc,SAAS,SAAS,CAGpD,MAAc,EAAA;AACd,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAmB,CAAA;AACzC,IAAA,OAAO,IAAI,KAAK,CAAC,EAAuD,EAAE;QACxE,GAAG,CAAC,IAAI,EAAE,UAAU,EAAA;YAClB,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,EAAE,UAA0C,CAAC,CAAA;;AAE9E,YAAA,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAyB,CAAC,CAAC,CAAA;SAChE;AACF,KAAA,CAAC,CAAA;AACJ;;;;"}
|
package/js/index.js
CHANGED
|
@@ -420,7 +420,7 @@ export { DefaultExternalTaggingService } from './x-modules/tagging/service/exter
|
|
|
420
420
|
export { track } from './x-modules/tagging/store/actions/track.action.js';
|
|
421
421
|
export { taggingEmitters } from './x-modules/tagging/store/emitters.js';
|
|
422
422
|
export { taggingXStoreModule } from './x-modules/tagging/store/module.js';
|
|
423
|
-
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackRelatedPromptToolingDisplayClickWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire } from './x-modules/tagging/wiring.js';
|
|
423
|
+
export { createSetQueryTaggingFromQueryPreview, createTrackDisplayWire, createTrackRelatedPromptToolingDisplayClickWire, createTrackToolingAdd2CartWire, createTrackToolingDisplayWire, createTrackWire, setConsent, setNoResultsTaggingEnabledWire, setQueryTaggingFromQueryPreview, setQueryTaggingInfo, setTaggingConfig, taggingWiring, trackAddToCartWire, trackBannerClickedWire, trackDisplayClickedWire, trackElementDisplayedWire, trackNoResultsQueryWithFallbackWire, trackNoResultsQueryWithFallbackWireDebounced, trackNoResultsQueryWithSemanticsWire, trackNoResultsQueryWithSemanticsWireDebounced, trackQueryWire, trackRelatedPromptToolingDisplayClickWire, trackResultClickedWire, trackToolingAdd2CartWire, trackToolingDisplayClickedWire } from './x-modules/tagging/wiring.js';
|
|
424
424
|
export { taggingXModule } from './x-modules/tagging/x-module.js';
|
|
425
425
|
export { default as UrlHandler } from './x-modules/url/components/url-handler.vue.js';
|
|
426
426
|
export { replaceableParams, urlEmitters } from './x-modules/url/store/emitters.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facets.vue.js","sources":["../../../../../../src/x-modules/facets/components/facets/facets.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" v-if=\"hasFacets\" class=\"x-facets-list\" data-test=\"facets\" tag=\"ul\">\n <li\n v-for=\"({ facet, slotNameById, slotNameByModelName }, facetId) in mappedFacets\"\n :key=\"facetId\"\n class=\"x-facets-list__item\"\n data-test=\"facets-facet\"\n >\n <!--\n @slot Customized Facet rendering. Specifying a slot with the facet's name will result in the\n facet using that slot composition to render.\n @binding {Facet} facet - Facet to render\n @binding {Filter[]} selectedFilters - List of selected filters of the given facet\n -->\n <slot\n v-if=\"hasSlot(slotNameById)\"\n v-bind=\"{\n facet,\n selectedFilters: selectedFiltersByFacet[facetId] || [],\n }\"\n :name=\"slotNameById\"\n />\n <!--\n @slot Customized Facet rendering. Specifying a slot with the facet's modelName will result\n in the facet using that slot composition to render.\n @binding {Facet} facet - Facet to render\n @binding {Filter[]} selectedFilters - List of selected filters of the given facet\n -->\n <slot\n v-else-if=\"hasSlot(slotNameByModelName)\"\n v-bind=\"{\n facet,\n selectedFilters: selectedFiltersByFacet[facetId] || [],\n }\"\n :name=\"slotNameByModelName\"\n />\n <!--\n @slot (required) Default Facet rendering. This slot will be used by default for rendering\n the facets without an specific slot implementation.\n @binding {Facet} facet - Facet to render\n @binding {Filter[]} selectedFilters - List of selected filters of the given facet\n -->\n <slot\n v-else\n v-bind=\"{\n facet,\n selectedFilters: selectedFiltersByFacet[facetId] || [],\n }\"\n >\n This is the {{ facet.label }} facet. Pass something into its slot to display content.\n </slot>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Facet } from '@empathyco/x-types'\nimport type { Dictionary } from '@empathyco/x-utils'\nimport type { ComputedRef, PropType } from 'vue'\nimport { map, objectFilter } from '@empathyco/x-utils'\nimport { computed, defineComponent } from 'vue'\nimport { useGetter } from '../../../../composables/use-getter'\nimport { AnimationProp } from '../../../../types'\nimport { toKebabCase } from '../../../../utils/string'\nimport { useFacets } from '../../composables/use-facets'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Custom interface to provide a slot name to a Facet.\n *\n * @internal\n */\ninterface RenderFacet {\n slotNameById: string\n slotNameByModelName: string\n facet: Facet\n}\n\n/**\n * This component renders the list of facets stored in the Facets module. Facets can be rendered\n * differently based on their purpose and this can be achieved using the exposed slots:\n * - A default and required slot.\n * - A custom slot for each facet with the facetId as its name. This allows each facet to be\n * rendered differently based on its needs.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Facets',\n xModule: facetsXModule.name,\n props: {\n /** Array of facets ids used to get the selected filters for those facets. */\n facetsIds: Array as PropType<Array<Facet['id']>>,\n /** Flag to render the component even if there are no filters selected. */\n alwaysVisible: Boolean,\n /** Animation component that will be used to animate the facets. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /**\n * Discriminates the facets rendered by this component. It expects a string containing facets\n * ids, comma separated. This property will include or exclude facets based on its value.\n * The default value is an empty string and the component will render all existing facets.\n *\n * @remarks\n * To behave as a `include`, simply set the facets ids, comma separated:\n * `existingFacets=[{ brand: ... }, category: { ... }, color: { ... }, price: { ... }]`\n * `renderableFacets=\"brand, category\"`\n *\n * The component will render brand and category facets.\n *\n * On the other hand, to simulate an `exclude` behaviour and exclude a facet from being\n * rendered, append a '!' before its id:\n * `existingFacets=[{ brand: ... }, category: { ... }, color: { ... }, price: { ... }]`\n * `renderableFacets=\"!brand,!price\"`\n *\n * The component will render category and color facets.\n */\n renderableFacets: String,\n },\n setup(props, { slots }) {\n const { selectedFiltersByFacet } = useFacets(props)\n\n const { facets } = useGetter('facets', ['facets']) as {\n /** Dictionary of facets in the state. */\n facets: ComputedRef<Record<Facet['id'], Facet>>\n }\n\n /**\n * The facets to be rendered after filtering {@link Facets.facets} by\n * {@link Facets.renderableFacets} content.\n *\n * @returns The list of facets to be rendered.\n */\n const facetsToRender = computed<Dictionary<Facet>>(() => {\n if (!props.renderableFacets) {\n return facets.value\n } else {\n const excludedRegExp = /^!/\n const facetIds: string[] = props.renderableFacets.split(',').map(facetId => facetId.trim())\n const included: string[] = []\n const excluded: string[] = []\n facetIds.forEach(facetId => {\n if (excludedRegExp.test(facetId)) {\n excluded.push(facetId.replace(excludedRegExp, ''))\n } else {\n included.push(facetId)\n }\n })\n\n return filterFacetsToRender(included, excluded)\n }\n })\n\n /**\n * Transforms a dictionary of Facets including the slot name.\n *\n * @returns A dictionary of facets with the slot name.\n */\n const mappedFacets = computed<Dictionary<RenderFacet>>(() => {\n return map(facetsToRender.value, (facetId, facet) => ({\n slotNameById: toKebabCase(facetId),\n slotNameByModelName: toKebabCase(facet.modelName),\n facet,\n }))\n })\n\n /**\n * Indicates if there are facets available to show.\n *\n * @returns True if there are facets available and false otherwise.\n */\n const hasFacets = computed<boolean>(() => !!Object.keys(facetsToRender.value).length)\n\n /**\n * Filter facets dictionary retrieving those included and/or removing excluded.\n *\n * @param included - List of facets to render.\n * @param excluded - List of not renderable facets.\n *\n * @returns The filtered list of facets to render.\n */\n function filterFacetsToRender(included: string[], excluded: string[]): Dictionary<Facet> {\n const hasAnyFacetIncluded = included.length > 0\n return objectFilter(facets.value, facetKey => {\n const isIncluded = included.includes(String(facetKey))\n const isExcluded = excluded.includes(String(facetKey))\n\n return hasAnyFacetIncluded ? isIncluded && !isExcluded : !isExcluded\n })\n }\n\n /**\n * Whether the slot is present in the template or not.\n *\n * @param name - The slot name.\n *\n * @returns True is the slot is present in the template. False otherwise.\n */\n function hasSlot(name: string): boolean {\n return !!slots[name]\n }\n\n return {\n selectedFiltersByFacet,\n hasFacets,\n mappedFacets,\n hasSlot,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-facets-list {\n display: flex;\n flex-flow: column nowrap;\n list-style-type: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThis component renders the list of facets stored in the Facets module. Facets can be rendered\ndifferently based on their purpose and this can be achieved using the exposed slots:\n\n- A default and required slot.\n- A custom slot for each facet with the facetId as its name. This allows each facet to be rendered\n differently based on its needs.\n\nBelow, there are some examples showing how to use the component with its different configurations.\n\n### Default usage\n\nThe default slot of this component is mandatory. If no other slot is defined, every Facet will be\nrendered as specified in the default slot.\n\n```vue\n<template>\n <Facets>\n <template #default=\"{ facet, selectedFilters }\">\n <h1>{{ ${facet.label} }}</h1>\n <span v-if=\"selectedFilters.length > 0\">{{ `${selectedFilters.length} selected` }}</span>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Customized usage\n\nCustomized compositions for a specific Facet can be achieved by using a slot with the same id as the\nfacet to customize. For example, the Facet with the id \"color\" requires a composition that differs\nfrom the rest of the Facets. Doing it in a slot with the name \"color\" will apply this customization\njust to the \"color\" Facet. The other facets will fallback to the composition of the default slot.\n\nIt is also possible to customize the Facet content by the facet \"model name\". For example, to\nconfigure different content for \"Hierarchical Facets\" the \"hierarchical-facet\" slot will apply that\ncustomization. This can be combined with the facets by facet id. If some hierarchical facet needs\nsome different customization from the rest of the hierarchical, it can be achieve using the slot\nwith the facet id.\n\n```vue\n<template>\n <Facets>\n <template #color=\"{ facet, selectedFilters }\">\n <span v-if=\"selectedFilters.length > 0\">{{ `${selectedFilters.length} colors chosen` }}</span>\n\n <ul v-for=\"filter in facet.filters\" :key=\"filter.id\">\n <li v-if=\"!filter.selected\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n\n <template #hierarchical-facet=\"{ facet, selectedFilters }\">\n <span v-if=\"selectedFilters.length > 0\">{{ `${selectedFilters.length} colors chosen` }}</span>\n\n <ul v-for=\"filter in facet.filters\" :key=\"filter.id\">\n <li v-if=\"!filter.selected\">\n {{ filter.label }}\n <ul v-for=\"childFilter in filter.children\" :key=\"filter.id\">\n <li v-if=\"!childFilter.selected\">\n {{ childFilter.label }}\n </li>\n </ul>\n </li>\n </ul>\n </template>\n\n <template #default=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Render specific facets I\n\nBy default, this component will render all existing facets. However, it has the renderableFacets\nprop to filter which facets will be rendered. Its value is a string containing the different facets\nids. This value is treated as an include or exclude list (to exclude a facet from being rendered,\njust prefix its id with a `!`). The component will only render included facets and discard excluded\nones. In the following example, the component will only render color and category facets.\n\n```vue\n<template>\n <Facets renderableFacets=\"color, category\">\n <template #default=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Render specific facets II\n\nExclude facets so the component does not render them. In the following example, the component will\nrender every facet except color and price.\n\n```vue\n<template>\n <Facets renderableFacets=\"!color, !price\">\n <template #default=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Integrating with the filters components\n\nThere are many components that will help you build your own awesome filters list. `Facets` just\nrenders the list, but what to render for each facet is up to you. Below you can see an example. of\nthe `Facets` component using the `FiltersSearch` `MultiSelectFilters`, `SimpleFilter`, `Filters`,\n`HierarchicalFilter`, `NumberRangeFilter` and `BasePriceFilterLabel`.\n\n```vue\n<template>\n <Facets>\n <template #default=\"{ facet, selectedFilters }\">\n <h1>{{ facet.label }}</h1>\n <FiltersSearch :filters=\"facet.filters\">\n <MultiSelectFilters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" />\n </MultiSelectFilters>\n </FiltersSearch>\n </template>\n\n <template #category=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <HierarchicalFilter :filter=\"filter\" />\n </Filters>\n </template>\n\n <template #price=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\">\n <BasePriceFilterLabel :filter=\"filter\" />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script>\nimport {\n Facets,\n Filters,\n FiltersSearch,\n HierarchicalFilter,\n MultiSelectFilters,\n NumberRangeFilter,\n SimpleFilter,\n} from '@empathyco/x-components/facets'\n\nimport { BasePriceFilterLabel } from '@empathyco/x-components'\n\nexport default {\n components: {\n Facets,\n MultiSelectFilters,\n FiltersSearch,\n SimpleFilter,\n Filters,\n HierarchicalFilter,\n NumberRangeFilter,\n BasePriceFilterLabel,\n },\n}\n</script>\n```\n</docs>\n"],"names":["animation","_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","hasSlot","_createCommentVNode"],"mappings":";;;;;AACE,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EADF,MACkBA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,QAAAA,EAAAA;AADlB,EAAA,OAAA,IAAA,CAAA,SAAA,IAAAC,SAAA,EACmE,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA;AAAA,IAAC,GAAA,EAAA,CAAA;AAAA,IAAmB,KAAI,EAAA,eAAA;AAAA,IAAA,WAAA,EAAA,QAAA;AAD3F,IAAA,GAAA,EAAA,IAAA;AAAA,GAAA,EAAA;;iBAIY,IAAO,CAAA,EAAAC,kBAAA;AAAA,QAAAC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAAA,IAAA,CAAA,YAAA,EAAA,CAAA,EAAA,KAAA,EAAA,YAAA,EAAA,mBAAA,EAAA,EAAA,OAAA,KAAA;AACR,UAAA,OAAAL,SAAA,EAAsB,EAAAG,kBAAA,CAAA,IAAA,EAAA;AAAA,YAC3B,GAAA,EAAA,OAAA;AAAA,YAAA,KAAA,EAAA,qBAAA;AASe,YAAA,WAAA,EAAA,cAAA;AAAA,WAAA,EAAA;AAfrB,YAAA,IAAA,CAAA,OAAA,CAAA,YAAA,CAAA,GAAAG,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,UAAA,CAAA;AAAA,cAAA,GAAA,EAAA,CAAA;AAgBiC,cAAA,OAAA,EAAA,IAAA;AAAA,aAAA,EAAA;;AAadC,cAAAA,eAAAA,EAAAA,IAAAA,CAAQ,sBAAmB,CAAA,OAAA,CAAA,IAAA,EAAA;AAAA,aAAA,CAAA,EAAA,KAAA,CAAA,EADxC,IA5BN,CAAA,GAAA,IAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAAF,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,mBAAA,EAAAC,UAAA,CAAA;AAAA,cAAA,GAAA,EAAA,CAAA;AA8BiC,cAAA,OAAA,EAAA,IAAA;AAAA,aAAA,EAAA;;AAY3B,cAAA,eAAA,EAAA,IAAA,CAQO,8BARP,CAQO,IAAA,EAAA;AAAA,aAlDb,CAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA,GAAAD,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,UAAA,CAAA;AAAA,cAAA,GAAA,EAAA,CAAA;AA4CiC,cAAA,OAAA,EAAA,IAAA;AAAA,aAAA,EAAA;;+BA5CjC,IAiDoB,CAAA,sBAAA,CAAA,OAAA,CAAA,IAAA,EAAA;AAAA,aAAA,CAAA,EAAA,MAAA;;;;;;;;AAjDpB,SAAA,CAAA;AAAA,QAAA,GAAA;AAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,IAAAE,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"facets.vue.js","sources":["../../../../../../src/x-modules/facets/components/facets/facets.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" v-if=\"hasFacets\" class=\"x-facets-list\" data-test=\"facets\" tag=\"ul\">\n <li\n v-for=\"({ facet, slotNameById, slotNameByModelName }, facetId) in mappedFacets\"\n :key=\"facetId\"\n class=\"x-facets-list__item\"\n data-test=\"facets-facet\"\n >\n <!--\n @slot Customized Facet rendering. Specifying a slot with the facet's name will result in the\n facet using that slot composition to render.\n @binding {Facet} facet - Facet to render\n @binding {Filter[]} selectedFilters - List of selected filters of the given facet\n -->\n <slot\n v-if=\"hasSlot(slotNameById)\"\n v-bind=\"{\n facet,\n selectedFilters: selectedFiltersByFacet[facetId] || [],\n }\"\n :name=\"slotNameById\"\n />\n <!--\n @slot Customized Facet rendering. Specifying a slot with the facet's modelName will result\n in the facet using that slot composition to render.\n @binding {Facet} facet - Facet to render\n @binding {Filter[]} selectedFilters - List of selected filters of the given facet\n -->\n <slot\n v-else-if=\"hasSlot(slotNameByModelName)\"\n v-bind=\"{\n facet,\n selectedFilters: selectedFiltersByFacet[facetId] || [],\n }\"\n :name=\"slotNameByModelName\"\n />\n <!--\n @slot (required) Default Facet rendering. This slot will be used by default for rendering\n the facets without an specific slot implementation.\n @binding {Facet} facet - Facet to render\n @binding {Filter[]} selectedFilters - List of selected filters of the given facet\n -->\n <slot\n v-else\n v-bind=\"{\n facet,\n selectedFilters: selectedFiltersByFacet[facetId] || [],\n }\"\n >\n This is the {{ facet.label }} facet. Pass something into its slot to display content.\n </slot>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Facet } from '@empathyco/x-types'\nimport type { Dictionary } from '@empathyco/x-utils'\nimport type { PropType } from 'vue'\nimport { map, objectFilter } from '@empathyco/x-utils'\nimport { computed, defineComponent } from 'vue'\nimport { useGetter } from '../../../../composables/use-getter'\nimport { AnimationProp } from '../../../../types'\nimport { toKebabCase } from '../../../../utils/string'\nimport { useFacets } from '../../composables/use-facets'\nimport { facetsXModule } from '../../x-module'\n\n/**\n * Custom interface to provide a slot name to a Facet.\n *\n * @internal\n */\ninterface RenderFacet {\n slotNameById: string\n slotNameByModelName: string\n facet: Facet\n}\n\n/**\n * This component renders the list of facets stored in the Facets module. Facets can be rendered\n * differently based on their purpose and this can be achieved using the exposed slots:\n * - A default and required slot.\n * - A custom slot for each facet with the facetId as its name. This allows each facet to be\n * rendered differently based on its needs.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Facets',\n xModule: facetsXModule.name,\n props: {\n /** Array of facets ids used to get the selected filters for those facets. */\n facetsIds: Array as PropType<Array<Facet['id']>>,\n /** Flag to render the component even if there are no filters selected. */\n alwaysVisible: Boolean,\n /** Animation component that will be used to animate the facets. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /**\n * Discriminates the facets rendered by this component. It expects a string containing facets\n * ids, comma separated. This property will include or exclude facets based on its value.\n * The default value is an empty string and the component will render all existing facets.\n *\n * @remarks\n * To behave as a `include`, simply set the facets ids, comma separated:\n * `existingFacets=[{ brand: ... }, category: { ... }, color: { ... }, price: { ... }]`\n * `renderableFacets=\"brand, category\"`\n *\n * The component will render brand and category facets.\n *\n * On the other hand, to simulate an `exclude` behaviour and exclude a facet from being\n * rendered, append a '!' before its id:\n * `existingFacets=[{ brand: ... }, category: { ... }, color: { ... }, price: { ... }]`\n * `renderableFacets=\"!brand,!price\"`\n *\n * The component will render category and color facets.\n */\n renderableFacets: String,\n },\n setup(props, { slots }) {\n const { selectedFiltersByFacet } = useFacets(props)\n const { facets } = useGetter('facets')\n\n /**\n * The facets to be rendered after filtering {@link Facets.facets} by\n * {@link Facets.renderableFacets} content.\n *\n * @returns The list of facets to be rendered.\n */\n const facetsToRender = computed<Dictionary<Facet>>(() => {\n if (!props.renderableFacets) {\n return facets.value\n } else {\n const excludedRegExp = /^!/\n const facetIds: string[] = props.renderableFacets.split(',').map(facetId => facetId.trim())\n const included: string[] = []\n const excluded: string[] = []\n facetIds.forEach(facetId => {\n if (excludedRegExp.test(facetId)) {\n excluded.push(facetId.replace(excludedRegExp, ''))\n } else {\n included.push(facetId)\n }\n })\n\n return filterFacetsToRender(included, excluded)\n }\n })\n\n /**\n * Transforms a dictionary of Facets including the slot name.\n *\n * @returns A dictionary of facets with the slot name.\n */\n const mappedFacets = computed<Dictionary<RenderFacet>>(() => {\n return map(facetsToRender.value, (facetId, facet) => ({\n slotNameById: toKebabCase(facetId),\n slotNameByModelName: toKebabCase(facet.modelName),\n facet,\n }))\n })\n\n /**\n * Indicates if there are facets available to show.\n *\n * @returns True if there are facets available and false otherwise.\n */\n const hasFacets = computed<boolean>(() => !!Object.keys(facetsToRender.value).length)\n\n /**\n * Filter facets dictionary retrieving those included and/or removing excluded.\n *\n * @param included - List of facets to render.\n * @param excluded - List of not renderable facets.\n *\n * @returns The filtered list of facets to render.\n */\n function filterFacetsToRender(included: string[], excluded: string[]): Dictionary<Facet> {\n const hasAnyFacetIncluded = included.length > 0\n return objectFilter(facets.value, facetKey => {\n const isIncluded = included.includes(String(facetKey))\n const isExcluded = excluded.includes(String(facetKey))\n\n return hasAnyFacetIncluded ? isIncluded && !isExcluded : !isExcluded\n })\n }\n\n /**\n * Whether the slot is present in the template or not.\n *\n * @param name - The slot name.\n *\n * @returns True is the slot is present in the template. False otherwise.\n */\n function hasSlot(name: string): boolean {\n return !!slots[name]\n }\n\n return {\n selectedFiltersByFacet,\n hasFacets,\n mappedFacets,\n hasSlot,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-facets-list {\n display: flex;\n flex-flow: column nowrap;\n list-style-type: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThis component renders the list of facets stored in the Facets module. Facets can be rendered\ndifferently based on their purpose and this can be achieved using the exposed slots:\n\n- A default and required slot.\n- A custom slot for each facet with the facetId as its name. This allows each facet to be rendered\n differently based on its needs.\n\nBelow, there are some examples showing how to use the component with its different configurations.\n\n### Default usage\n\nThe default slot of this component is mandatory. If no other slot is defined, every Facet will be\nrendered as specified in the default slot.\n\n```vue\n<template>\n <Facets>\n <template #default=\"{ facet, selectedFilters }\">\n <h1>{{ ${facet.label} }}</h1>\n <span v-if=\"selectedFilters.length > 0\">{{ `${selectedFilters.length} selected` }}</span>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Customized usage\n\nCustomized compositions for a specific Facet can be achieved by using a slot with the same id as the\nfacet to customize. For example, the Facet with the id \"color\" requires a composition that differs\nfrom the rest of the Facets. Doing it in a slot with the name \"color\" will apply this customization\njust to the \"color\" Facet. The other facets will fallback to the composition of the default slot.\n\nIt is also possible to customize the Facet content by the facet \"model name\". For example, to\nconfigure different content for \"Hierarchical Facets\" the \"hierarchical-facet\" slot will apply that\ncustomization. This can be combined with the facets by facet id. If some hierarchical facet needs\nsome different customization from the rest of the hierarchical, it can be achieve using the slot\nwith the facet id.\n\n```vue\n<template>\n <Facets>\n <template #color=\"{ facet, selectedFilters }\">\n <span v-if=\"selectedFilters.length > 0\">{{ `${selectedFilters.length} colors chosen` }}</span>\n\n <ul v-for=\"filter in facet.filters\" :key=\"filter.id\">\n <li v-if=\"!filter.selected\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n\n <template #hierarchical-facet=\"{ facet, selectedFilters }\">\n <span v-if=\"selectedFilters.length > 0\">{{ `${selectedFilters.length} colors chosen` }}</span>\n\n <ul v-for=\"filter in facet.filters\" :key=\"filter.id\">\n <li v-if=\"!filter.selected\">\n {{ filter.label }}\n <ul v-for=\"childFilter in filter.children\" :key=\"filter.id\">\n <li v-if=\"!childFilter.selected\">\n {{ childFilter.label }}\n </li>\n </ul>\n </li>\n </ul>\n </template>\n\n <template #default=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Render specific facets I\n\nBy default, this component will render all existing facets. However, it has the renderableFacets\nprop to filter which facets will be rendered. Its value is a string containing the different facets\nids. This value is treated as an include or exclude list (to exclude a facet from being rendered,\njust prefix its id with a `!`). The component will only render included facets and discard excluded\nones. In the following example, the component will only render color and category facets.\n\n```vue\n<template>\n <Facets renderableFacets=\"color, category\">\n <template #default=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Render specific facets II\n\nExclude facets so the component does not render them. In the following example, the component will\nrender every facet except color and price.\n\n```vue\n<template>\n <Facets renderableFacets=\"!color, !price\">\n <template #default=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n\n <ul>\n <li v-for=\"filter in facet.filters\" :key=\"filter.id\">\n {{ filter.label }}\n </li>\n </ul>\n </template>\n </Facets>\n</template>\n\n<script>\nimport { Facets } from '@empathyco/x-components/facets'\n\nexport default {\n components: {\n Facets,\n },\n}\n</script>\n```\n\n### Integrating with the filters components\n\nThere are many components that will help you build your own awesome filters list. `Facets` just\nrenders the list, but what to render for each facet is up to you. Below you can see an example. of\nthe `Facets` component using the `FiltersSearch` `MultiSelectFilters`, `SimpleFilter`, `Filters`,\n`HierarchicalFilter`, `NumberRangeFilter` and `BasePriceFilterLabel`.\n\n```vue\n<template>\n <Facets>\n <template #default=\"{ facet, selectedFilters }\">\n <h1>{{ facet.label }}</h1>\n <FiltersSearch :filters=\"facet.filters\">\n <MultiSelectFilters v-slot=\"{ filter }\">\n <SimpleFilter :filter=\"filter\" />\n </MultiSelectFilters>\n </FiltersSearch>\n </template>\n\n <template #category=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <HierarchicalFilter :filter=\"filter\" />\n </Filters>\n </template>\n\n <template #price=\"{ facet }\">\n <h1>{{ facet.label }}</h1>\n <Filters v-slot=\"{ filter }\" :filters=\"facet.filters\">\n <NumberRangeFilter :filter=\"filter\">\n <BasePriceFilterLabel :filter=\"filter\" />\n </NumberRangeFilter>\n </Filters>\n </template>\n </Facets>\n</template>\n\n<script>\nimport {\n Facets,\n Filters,\n FiltersSearch,\n HierarchicalFilter,\n MultiSelectFilters,\n NumberRangeFilter,\n SimpleFilter,\n} from '@empathyco/x-components/facets'\n\nimport { BasePriceFilterLabel } from '@empathyco/x-components'\n\nexport default {\n components: {\n Facets,\n MultiSelectFilters,\n FiltersSearch,\n SimpleFilter,\n Filters,\n HierarchicalFilter,\n NumberRangeFilter,\n BasePriceFilterLabel,\n },\n}\n</script>\n```\n</docs>\n"],"names":["animation","_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","hasSlot","_createCommentVNode"],"mappings":";;;;;AACE,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EADF,MACkBA,EAAAA,MAAAA,EAAAA,KAAAA,EAAAA,QAAAA,EAAAA;AADlB,EAAA,OAAA,IAAA,CAAA,SAAA,IAAAC,SAAA,EACmE,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA;AAAA,IAAC,GAAA,EAAA,CAAA;AAAA,IAAmB,KAAI,EAAA,eAAA;AAAA,IAAA,WAAA,EAAA,QAAA;AAD3F,IAAA,GAAA,EAAA,IAAA;AAAA,GAAA,EAAA;;iBAIY,IAAO,CAAA,EAAAC,kBAAA;AAAA,QAAAC,QAAA;AAAA,QAAA,IAAA;AAAA,QAAAC,UAAA,CAAA,IAAA,CAAA,YAAA,EAAA,CAAA,EAAA,KAAA,EAAA,YAAA,EAAA,mBAAA,EAAA,EAAA,OAAA,KAAA;AACR,UAAA,OAAAL,SAAA,EAAsB,EAAAG,kBAAA,CAAA,IAAA,EAAA;AAAA,YAC3B,GAAA,EAAA,OAAA;AAAA,YAAA,KAAA,EAAA,qBAAA;AASe,YAAA,WAAA,EAAA,cAAA;AAAA,WAAA,EAAA;AAfrB,YAAA,IAAA,CAAA,OAAA,CAAA,YAAA,CAAA,GAAAG,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,UAAA,CAAA;AAAA,cAAA,GAAA,EAAA,CAAA;AAgBiC,cAAA,OAAA,EAAA,IAAA;AAAA,aAAA,EAAA;;AAadC,cAAAA,eAAAA,EAAAA,IAAAA,CAAQ,sBAAmB,CAAA,OAAA,CAAA,IAAA,EAAA;AAAA,aAAA,CAAA,EAAA,KAAA,CAAA,EADxC,IA5BN,CAAA,GAAA,IAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAAF,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,mBAAA,EAAAC,UAAA,CAAA;AAAA,cAAA,GAAA,EAAA,CAAA;AA8BiC,cAAA,OAAA,EAAA,IAAA;AAAA,aAAA,EAAA;;AAY3B,cAAA,eAAA,EAAA,IAAA,CAQO,8BARP,CAQO,IAAA,EAAA;AAAA,aAlDb,CAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA,GAAAD,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAAC,UAAA,CAAA;AAAA,cAAA,GAAA,EAAA,CAAA;AA4CiC,cAAA,OAAA,EAAA,IAAA;AAAA,aAAA,EAAA;;+BA5CjC,IAiDoB,CAAA,sBAAA,CAAA,OAAA,CAAA,IAAA,EAAA;AAAA,aAAA,CAAA,EAAA,MAAA;;;;;;;;AAjDpB,SAAA,CAAA;AAAA,QAAA,GAAA;AAAA;AAAA,OAAA;AAAA,KAAA,CAAA;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,IAAAE,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -51,7 +51,7 @@ var _sfc_main = defineComponent({
|
|
|
51
51
|
},
|
|
52
52
|
setup(props, { slots }) {
|
|
53
53
|
const { selectedFiltersByFacet } = useFacets(props);
|
|
54
|
-
const { facets } = useGetter('facets'
|
|
54
|
+
const { facets } = useGetter('facets');
|
|
55
55
|
/**
|
|
56
56
|
* The facets to be rendered after filtering {@link Facets.facets} by
|
|
57
57
|
* {@link Facets.renderableFacets} content.
|