@getlupa/vue 0.2.1 → 0.2.2
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/dist/lupaSearch.js +15 -10
- package/dist/lupaSearch.mjs +15 -10
- package/dist/src/components/search-results/products/SearchResultsToolbar.vue.d.ts +3 -3
- package/dist/src/components/search-results/products/sort/SearchResultsSort.vue.d.ts +9 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/types/search-results/SearchResultsOptions.d.ts +4 -0
- package/package.json +1 -1
package/dist/lupaSearch.js
CHANGED
|
@@ -7629,7 +7629,8 @@ const _hoisted_4$9 = ["value"];
|
|
|
7629
7629
|
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
7630
7630
|
__name: "SearchResultsSort",
|
|
7631
7631
|
props: {
|
|
7632
|
-
options: {}
|
|
7632
|
+
options: {},
|
|
7633
|
+
callbacks: {}
|
|
7633
7634
|
},
|
|
7634
7635
|
setup(__props) {
|
|
7635
7636
|
const props = __props;
|
|
@@ -7657,11 +7658,12 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
7657
7658
|
setSortValue();
|
|
7658
7659
|
});
|
|
7659
7660
|
const handleSelect = () => {
|
|
7660
|
-
var _a;
|
|
7661
|
+
var _a, _b;
|
|
7661
7662
|
const value = (_a = sortItems.value.find((x) => x.key === selectedKey.value)) == null ? void 0 : _a.key;
|
|
7662
7663
|
if (!value) {
|
|
7663
7664
|
return;
|
|
7664
7665
|
}
|
|
7666
|
+
(_b = props.callbacks) == null ? void 0 : _b.onSortChange({ selectedSortKey: value });
|
|
7665
7667
|
paramStore.appendParams({
|
|
7666
7668
|
params: [{ name: QUERY_PARAMS.SORT, value }],
|
|
7667
7669
|
paramsToRemove: [QUERY_PARAMS.PAGE]
|
|
@@ -7707,12 +7709,10 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7707
7709
|
},
|
|
7708
7710
|
setup(__props) {
|
|
7709
7711
|
const props = __props;
|
|
7710
|
-
const optionsValue = vue.computed(
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
}
|
|
7715
|
-
);
|
|
7712
|
+
const optionsValue = vue.computed(() => {
|
|
7713
|
+
var _a;
|
|
7714
|
+
return (_a = props.options) != null ? _a : { labels: {} };
|
|
7715
|
+
});
|
|
7716
7716
|
const paramStore = useParamsStore();
|
|
7717
7717
|
const searchResultStore = useSearchResultStore();
|
|
7718
7718
|
const optionsStore = useOptionsStore();
|
|
@@ -7788,6 +7788,10 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7788
7788
|
const hasResults = vue.computed(() => {
|
|
7789
7789
|
return searchResult.value.total > 0;
|
|
7790
7790
|
});
|
|
7791
|
+
const callbacks = vue.computed(() => {
|
|
7792
|
+
var _a;
|
|
7793
|
+
return (_a = props.options.callbacks) != null ? _a : {};
|
|
7794
|
+
});
|
|
7791
7795
|
const handleClearAll = () => {
|
|
7792
7796
|
paramStore.removeAllFilters();
|
|
7793
7797
|
};
|
|
@@ -7823,8 +7827,9 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7823
7827
|
}, null, 8, ["options", "label"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$2)),
|
|
7824
7828
|
sortOptions.value ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
|
|
7825
7829
|
key: 2,
|
|
7826
|
-
options: sortOptions.value
|
|
7827
|
-
|
|
7830
|
+
options: sortOptions.value,
|
|
7831
|
+
callbacks: callbacks.value
|
|
7832
|
+
}, null, 8, ["options", "callbacks"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$2))
|
|
7828
7833
|
])
|
|
7829
7834
|
], 2);
|
|
7830
7835
|
};
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -7627,7 +7627,8 @@ const _hoisted_4$9 = ["value"];
|
|
|
7627
7627
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
7628
7628
|
__name: "SearchResultsSort",
|
|
7629
7629
|
props: {
|
|
7630
|
-
options: {}
|
|
7630
|
+
options: {},
|
|
7631
|
+
callbacks: {}
|
|
7631
7632
|
},
|
|
7632
7633
|
setup(__props) {
|
|
7633
7634
|
const props = __props;
|
|
@@ -7655,11 +7656,12 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
7655
7656
|
setSortValue();
|
|
7656
7657
|
});
|
|
7657
7658
|
const handleSelect = () => {
|
|
7658
|
-
var _a;
|
|
7659
|
+
var _a, _b;
|
|
7659
7660
|
const value = (_a = sortItems.value.find((x) => x.key === selectedKey.value)) == null ? void 0 : _a.key;
|
|
7660
7661
|
if (!value) {
|
|
7661
7662
|
return;
|
|
7662
7663
|
}
|
|
7664
|
+
(_b = props.callbacks) == null ? void 0 : _b.onSortChange({ selectedSortKey: value });
|
|
7663
7665
|
paramStore.appendParams({
|
|
7664
7666
|
params: [{ name: QUERY_PARAMS.SORT, value }],
|
|
7665
7667
|
paramsToRemove: [QUERY_PARAMS.PAGE]
|
|
@@ -7705,12 +7707,10 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7705
7707
|
},
|
|
7706
7708
|
setup(__props) {
|
|
7707
7709
|
const props = __props;
|
|
7708
|
-
const optionsValue = computed(
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
}
|
|
7713
|
-
);
|
|
7710
|
+
const optionsValue = computed(() => {
|
|
7711
|
+
var _a;
|
|
7712
|
+
return (_a = props.options) != null ? _a : { labels: {} };
|
|
7713
|
+
});
|
|
7714
7714
|
const paramStore = useParamsStore();
|
|
7715
7715
|
const searchResultStore = useSearchResultStore();
|
|
7716
7716
|
const optionsStore = useOptionsStore();
|
|
@@ -7786,6 +7786,10 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7786
7786
|
const hasResults = computed(() => {
|
|
7787
7787
|
return searchResult.value.total > 0;
|
|
7788
7788
|
});
|
|
7789
|
+
const callbacks = computed(() => {
|
|
7790
|
+
var _a;
|
|
7791
|
+
return (_a = props.options.callbacks) != null ? _a : {};
|
|
7792
|
+
});
|
|
7789
7793
|
const handleClearAll = () => {
|
|
7790
7794
|
paramStore.removeAllFilters();
|
|
7791
7795
|
};
|
|
@@ -7821,8 +7825,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7821
7825
|
}, null, 8, ["options", "label"])) : (openBlock(), createElementBlock("div", _hoisted_6$2)),
|
|
7822
7826
|
sortOptions.value ? (openBlock(), createBlock(_sfc_main$u, {
|
|
7823
7827
|
key: 2,
|
|
7824
|
-
options: sortOptions.value
|
|
7825
|
-
|
|
7828
|
+
options: sortOptions.value,
|
|
7829
|
+
callbacks: callbacks.value
|
|
7830
|
+
}, null, 8, ["options", "callbacks"])) : (openBlock(), createElementBlock("div", _hoisted_7$2))
|
|
7826
7831
|
])
|
|
7827
7832
|
], 2);
|
|
7828
7833
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PropType as __PropType } from 'vue';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SearchResultsOptions } from '../../../types/search-results/SearchResultsOptions';
|
|
3
3
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
4
4
|
options: {
|
|
5
|
-
type: __PropType<
|
|
5
|
+
type: __PropType<SearchResultsOptions>;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
8
|
paginationLocation: {
|
|
@@ -11,7 +11,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
11
11
|
};
|
|
12
12
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
13
|
options: {
|
|
14
|
-
type: __PropType<
|
|
14
|
+
type: __PropType<SearchResultsOptions>;
|
|
15
15
|
required: true;
|
|
16
16
|
};
|
|
17
17
|
paginationLocation: {
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import type { PropType as __PropType } from 'vue';
|
|
2
2
|
import type { SortOptions } from '../../../../types/search-results/SearchResultsSort';
|
|
3
|
+
import { SearchResultEventCallbacks } from '../../../../types/search-results/SearchResultsOptions';
|
|
3
4
|
declare const _sfc_main: import("vue").DefineComponent<{
|
|
4
5
|
options: {
|
|
5
6
|
type: __PropType<SortOptions>;
|
|
6
7
|
required: true;
|
|
7
8
|
};
|
|
9
|
+
callbacks: {
|
|
10
|
+
type: __PropType<SearchResultEventCallbacks>;
|
|
11
|
+
required: false;
|
|
12
|
+
};
|
|
8
13
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
14
|
options: {
|
|
10
15
|
type: __PropType<SortOptions>;
|
|
11
16
|
required: true;
|
|
12
17
|
};
|
|
18
|
+
callbacks: {
|
|
19
|
+
type: __PropType<SearchResultEventCallbacks>;
|
|
20
|
+
required: false;
|
|
21
|
+
};
|
|
13
22
|
}>>, {}, {}>;
|
|
14
23
|
export default _sfc_main;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { SearchContainerOptions, SearchContainerConfigOptions } from './typ
|
|
|
10
10
|
import type { SearchResultBadgeType, SearchResultBadgeElement, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions } from './types/search-results/BadgeOptions';
|
|
11
11
|
import { BadgeType } from './types/search-results/BadgeOptions';
|
|
12
12
|
import type { RoutingBehavior } from './types/search-results/RoutingBehavior';
|
|
13
|
-
import type { SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData, SsrOptions } from './types/search-results/SearchResultsOptions';
|
|
13
|
+
import type { SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, SortCallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData, SsrOptions } from './types/search-results/SearchResultsOptions';
|
|
14
14
|
import type { AnchorPosition } from './types/search-results/SearchResultsProductCardOptions';
|
|
15
15
|
import type { SortOptions, SearchResultsSortOptions } from './types/search-results/SearchResultsSort';
|
|
16
16
|
import SearchBox from './components/search-box/SearchBox.vue';
|
|
@@ -25,4 +25,4 @@ declare const LupaSearch: {
|
|
|
25
25
|
install: (app: any, options: any) => void;
|
|
26
26
|
};
|
|
27
27
|
export { SearchBox, SearchResults, ProductList, Recommendations, SearchContainer, DocumentElementType, SearchBoxPanelType, BadgeType, setupTracking, LupaSearch, initPinia, getInitialSearchResults };
|
|
28
|
-
export type { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, FacetStyle, Environment, RoutingBehavior, AnchorPosition, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, CategoryFilterOptions, SearchResultsFilterOptions, SearchResultBadgeType, SearchResultBadgeElement, ResultFacetOptions, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, SearchContainerOptions, SearchContainerConfigOptions, SingleStarRatingElement, DynamicData, ProductRecommendationOptions, RecommendationABTestingOptions, SsrOptions };
|
|
28
|
+
export type { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, FacetStyle, Environment, RoutingBehavior, AnchorPosition, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, SortCallbackContext, FacetFilterQuery, CategoryFilterOptions, SearchResultsFilterOptions, SearchResultBadgeType, SearchResultBadgeElement, ResultFacetOptions, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, SearchContainerOptions, SearchContainerConfigOptions, SingleStarRatingElement, DynamicData, ProductRecommendationOptions, RecommendationABTestingOptions, SsrOptions };
|
|
@@ -33,12 +33,16 @@ export type CallbackContext = {
|
|
|
33
33
|
urlQueryString?: string;
|
|
34
34
|
productId?: string;
|
|
35
35
|
};
|
|
36
|
+
export type SortCallbackContext = {
|
|
37
|
+
selectedSortKey: string;
|
|
38
|
+
};
|
|
36
39
|
export type SearchResultEventCallbacks = {
|
|
37
40
|
onSearchResults?: (context: CallbackContext) => unknown;
|
|
38
41
|
onAdditionalPanelResults?: (context: CallbackContext) => unknown;
|
|
39
42
|
onCategoryFilterResults?: (context: CallbackContext) => unknown;
|
|
40
43
|
onProductClick?: (context: CallbackContext) => unknown;
|
|
41
44
|
onUrlQueryChange?: (context: CallbackContext) => unknown;
|
|
45
|
+
onSortChange?: (context: SortCallbackContext) => unknown;
|
|
42
46
|
onMounted?: () => unknown;
|
|
43
47
|
};
|
|
44
48
|
export type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
|