@getlupa/vue 0.2.0 → 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 +17 -11
- package/dist/lupaSearch.mjs +17 -11
- 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
|
@@ -4698,8 +4698,9 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
|
|
|
4698
4698
|
}
|
|
4699
4699
|
};
|
|
4700
4700
|
const handleInput = (value) => {
|
|
4701
|
+
var _a2;
|
|
4701
4702
|
opened.value = true;
|
|
4702
|
-
inputValue.value = value.replace(/\s+$/, "");
|
|
4703
|
+
inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
|
|
4703
4704
|
suggestedValue.value = defaultSuggestedValue;
|
|
4704
4705
|
trackSearchQuery(value);
|
|
4705
4706
|
if (props.isSearchContainer) {
|
|
@@ -7628,7 +7629,8 @@ const _hoisted_4$9 = ["value"];
|
|
|
7628
7629
|
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
7629
7630
|
__name: "SearchResultsSort",
|
|
7630
7631
|
props: {
|
|
7631
|
-
options: {}
|
|
7632
|
+
options: {},
|
|
7633
|
+
callbacks: {}
|
|
7632
7634
|
},
|
|
7633
7635
|
setup(__props) {
|
|
7634
7636
|
const props = __props;
|
|
@@ -7656,11 +7658,12 @@ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
|
7656
7658
|
setSortValue();
|
|
7657
7659
|
});
|
|
7658
7660
|
const handleSelect = () => {
|
|
7659
|
-
var _a;
|
|
7661
|
+
var _a, _b;
|
|
7660
7662
|
const value = (_a = sortItems.value.find((x) => x.key === selectedKey.value)) == null ? void 0 : _a.key;
|
|
7661
7663
|
if (!value) {
|
|
7662
7664
|
return;
|
|
7663
7665
|
}
|
|
7666
|
+
(_b = props.callbacks) == null ? void 0 : _b.onSortChange({ selectedSortKey: value });
|
|
7664
7667
|
paramStore.appendParams({
|
|
7665
7668
|
params: [{ name: QUERY_PARAMS.SORT, value }],
|
|
7666
7669
|
paramsToRemove: [QUERY_PARAMS.PAGE]
|
|
@@ -7706,12 +7709,10 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7706
7709
|
},
|
|
7707
7710
|
setup(__props) {
|
|
7708
7711
|
const props = __props;
|
|
7709
|
-
const optionsValue = vue.computed(
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
}
|
|
7714
|
-
);
|
|
7712
|
+
const optionsValue = vue.computed(() => {
|
|
7713
|
+
var _a;
|
|
7714
|
+
return (_a = props.options) != null ? _a : { labels: {} };
|
|
7715
|
+
});
|
|
7715
7716
|
const paramStore = useParamsStore();
|
|
7716
7717
|
const searchResultStore = useSearchResultStore();
|
|
7717
7718
|
const optionsStore = useOptionsStore();
|
|
@@ -7787,6 +7788,10 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7787
7788
|
const hasResults = vue.computed(() => {
|
|
7788
7789
|
return searchResult.value.total > 0;
|
|
7789
7790
|
});
|
|
7791
|
+
const callbacks = vue.computed(() => {
|
|
7792
|
+
var _a;
|
|
7793
|
+
return (_a = props.options.callbacks) != null ? _a : {};
|
|
7794
|
+
});
|
|
7790
7795
|
const handleClearAll = () => {
|
|
7791
7796
|
paramStore.removeAllFilters();
|
|
7792
7797
|
};
|
|
@@ -7822,8 +7827,9 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
|
|
|
7822
7827
|
}, null, 8, ["options", "label"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$2)),
|
|
7823
7828
|
sortOptions.value ? (vue.openBlock(), vue.createBlock(_sfc_main$u, {
|
|
7824
7829
|
key: 2,
|
|
7825
|
-
options: sortOptions.value
|
|
7826
|
-
|
|
7830
|
+
options: sortOptions.value,
|
|
7831
|
+
callbacks: callbacks.value
|
|
7832
|
+
}, null, 8, ["options", "callbacks"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$2))
|
|
7827
7833
|
])
|
|
7828
7834
|
], 2);
|
|
7829
7835
|
};
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -4696,8 +4696,9 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
4696
4696
|
}
|
|
4697
4697
|
};
|
|
4698
4698
|
const handleInput = (value) => {
|
|
4699
|
+
var _a2;
|
|
4699
4700
|
opened.value = true;
|
|
4700
|
-
inputValue.value = value.replace(/\s+$/, "");
|
|
4701
|
+
inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
|
|
4701
4702
|
suggestedValue.value = defaultSuggestedValue;
|
|
4702
4703
|
trackSearchQuery(value);
|
|
4703
4704
|
if (props.isSearchContainer) {
|
|
@@ -7626,7 +7627,8 @@ const _hoisted_4$9 = ["value"];
|
|
|
7626
7627
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
7627
7628
|
__name: "SearchResultsSort",
|
|
7628
7629
|
props: {
|
|
7629
|
-
options: {}
|
|
7630
|
+
options: {},
|
|
7631
|
+
callbacks: {}
|
|
7630
7632
|
},
|
|
7631
7633
|
setup(__props) {
|
|
7632
7634
|
const props = __props;
|
|
@@ -7654,11 +7656,12 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
7654
7656
|
setSortValue();
|
|
7655
7657
|
});
|
|
7656
7658
|
const handleSelect = () => {
|
|
7657
|
-
var _a;
|
|
7659
|
+
var _a, _b;
|
|
7658
7660
|
const value = (_a = sortItems.value.find((x) => x.key === selectedKey.value)) == null ? void 0 : _a.key;
|
|
7659
7661
|
if (!value) {
|
|
7660
7662
|
return;
|
|
7661
7663
|
}
|
|
7664
|
+
(_b = props.callbacks) == null ? void 0 : _b.onSortChange({ selectedSortKey: value });
|
|
7662
7665
|
paramStore.appendParams({
|
|
7663
7666
|
params: [{ name: QUERY_PARAMS.SORT, value }],
|
|
7664
7667
|
paramsToRemove: [QUERY_PARAMS.PAGE]
|
|
@@ -7704,12 +7707,10 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7704
7707
|
},
|
|
7705
7708
|
setup(__props) {
|
|
7706
7709
|
const props = __props;
|
|
7707
|
-
const optionsValue = computed(
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
}
|
|
7712
|
-
);
|
|
7710
|
+
const optionsValue = computed(() => {
|
|
7711
|
+
var _a;
|
|
7712
|
+
return (_a = props.options) != null ? _a : { labels: {} };
|
|
7713
|
+
});
|
|
7713
7714
|
const paramStore = useParamsStore();
|
|
7714
7715
|
const searchResultStore = useSearchResultStore();
|
|
7715
7716
|
const optionsStore = useOptionsStore();
|
|
@@ -7785,6 +7786,10 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7785
7786
|
const hasResults = computed(() => {
|
|
7786
7787
|
return searchResult.value.total > 0;
|
|
7787
7788
|
});
|
|
7789
|
+
const callbacks = computed(() => {
|
|
7790
|
+
var _a;
|
|
7791
|
+
return (_a = props.options.callbacks) != null ? _a : {};
|
|
7792
|
+
});
|
|
7788
7793
|
const handleClearAll = () => {
|
|
7789
7794
|
paramStore.removeAllFilters();
|
|
7790
7795
|
};
|
|
@@ -7820,8 +7825,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
7820
7825
|
}, null, 8, ["options", "label"])) : (openBlock(), createElementBlock("div", _hoisted_6$2)),
|
|
7821
7826
|
sortOptions.value ? (openBlock(), createBlock(_sfc_main$u, {
|
|
7822
7827
|
key: 2,
|
|
7823
|
-
options: sortOptions.value
|
|
7824
|
-
|
|
7828
|
+
options: sortOptions.value,
|
|
7829
|
+
callbacks: callbacks.value
|
|
7830
|
+
}, null, 8, ["options", "callbacks"])) : (openBlock(), createElementBlock("div", _hoisted_7$2))
|
|
7825
7831
|
])
|
|
7826
7832
|
], 2);
|
|
7827
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 & {
|