@getlupa/vue 0.9.6 → 0.10.1
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 +670 -584
- package/dist/lupaSearch.mjs +671 -585
- package/dist/src/constants/queryParams.const.d.ts +2 -6
- package/dist/src/stores/dynamicData.d.ts +4 -1
- package/dist/src/stores/options.d.ts +5 -2
- package/dist/src/stores/screen.d.ts +3 -3
- package/dist/src/types/General.d.ts +2 -0
- package/dist/src/types/search-box/SearchBoxBadgeOptions.d.ts +6 -0
- package/dist/src/types/search-box/SearchBoxOptions.d.ts +2 -1
- package/dist/src/types/search-box/SearchBoxPanel.d.ts +2 -0
- package/dist/src/types/search-results/BadgeOptions.d.ts +2 -1
- package/dist/src/utils/filter.toggle.utils.d.ts +4 -3
- package/dist/src/utils/link.utils.d.ts +2 -1
- package/dist/src/utils/params.utils.d.ts +3 -2
- package/dist/src/utils/routing.utils.d.ts +2 -1
- package/dist/src/utils/ssr.utils.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
PAGE: string;
|
|
4
|
-
LIMIT: string;
|
|
5
|
-
SORT: string;
|
|
6
|
-
};
|
|
1
|
+
import { LupaQueryParamName, LupaQueryParamValue } from '../types/General';
|
|
2
|
+
export declare const QUERY_PARAMS: Record<LupaQueryParamName, LupaQueryParamValue>;
|
|
7
3
|
export declare const QUERY_PARAMS_PARSED: {
|
|
8
4
|
QUERY: string;
|
|
9
5
|
PAGE: string;
|
|
@@ -3,13 +3,15 @@ import type { SearchQueryResult } from '@getlupa/client-sdk/Types';
|
|
|
3
3
|
export declare const useDynamicDataStore: import("pinia").StoreDefinition<"dynamicData", import("pinia")._UnwrapAll<Pick<{
|
|
4
4
|
dynamicDataIdMap: Ref<Record<string, Document>>;
|
|
5
5
|
loading: Ref<boolean>;
|
|
6
|
+
loadingIds: Ref<Record<string, boolean>>;
|
|
6
7
|
enhanceSearchResultsWithDynamicData: ({ result, mode }: {
|
|
7
8
|
result?: SearchQueryResult;
|
|
8
9
|
mode?: 'searchBox' | 'searchResults';
|
|
9
10
|
}) => Promise<{}>;
|
|
10
|
-
}, "dynamicDataIdMap" | "loading">>, Pick<{
|
|
11
|
+
}, "dynamicDataIdMap" | "loading" | "loadingIds">>, Pick<{
|
|
11
12
|
dynamicDataIdMap: Ref<Record<string, Document>>;
|
|
12
13
|
loading: Ref<boolean>;
|
|
14
|
+
loadingIds: Ref<Record<string, boolean>>;
|
|
13
15
|
enhanceSearchResultsWithDynamicData: ({ result, mode }: {
|
|
14
16
|
result?: SearchQueryResult;
|
|
15
17
|
mode?: 'searchBox' | 'searchResults';
|
|
@@ -17,6 +19,7 @@ export declare const useDynamicDataStore: import("pinia").StoreDefinition<"dynam
|
|
|
17
19
|
}, never>, Pick<{
|
|
18
20
|
dynamicDataIdMap: Ref<Record<string, Document>>;
|
|
19
21
|
loading: Ref<boolean>;
|
|
22
|
+
loadingIds: Ref<Record<string, boolean>>;
|
|
20
23
|
enhanceSearchResultsWithDynamicData: ({ result, mode }: {
|
|
21
24
|
result?: SearchQueryResult;
|
|
22
25
|
mode?: 'searchBox' | 'searchResults';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import type { SearchBoxOptions } from '../types/search-box/SearchBoxOptions';
|
|
3
3
|
import type { SearchResultsOptions } from '../types/search-results/SearchResultsOptions';
|
|
4
|
-
import type { TrackingOptions } from '../types/General';
|
|
4
|
+
import type { LupaQueryParamValue, TrackingOptions } from '../types/General';
|
|
5
5
|
import type { FilterGroup } from '@getlupa/client-sdk/Types';
|
|
6
6
|
export declare const useOptionsStore: import("pinia").StoreDefinition<"options", import("pinia")._UnwrapAll<Pick<{
|
|
7
7
|
searchBoxOptions: Ref<SearchBoxOptions>;
|
|
@@ -26,6 +26,7 @@ export declare const useOptionsStore: import("pinia").StoreDefinition<"options",
|
|
|
26
26
|
setInitialFilters: ({ initialFilters }: {
|
|
27
27
|
initialFilters: FilterGroup;
|
|
28
28
|
}) => void;
|
|
29
|
+
getQueryParamName: (param: LupaQueryParamValue) => string;
|
|
29
30
|
}, "searchBoxOptions" | "searchResultOptions" | "trackingOptions">>, Pick<{
|
|
30
31
|
searchBoxOptions: Ref<SearchBoxOptions>;
|
|
31
32
|
searchResultOptions: Ref<SearchResultsOptions>;
|
|
@@ -49,6 +50,7 @@ export declare const useOptionsStore: import("pinia").StoreDefinition<"options",
|
|
|
49
50
|
setInitialFilters: ({ initialFilters }: {
|
|
50
51
|
initialFilters: FilterGroup;
|
|
51
52
|
}) => void;
|
|
53
|
+
getQueryParamName: (param: LupaQueryParamValue) => string;
|
|
52
54
|
}, "initialFilters" | "envOptions" | "classMap" | "boxRoutingBehavior" | "searchResultsRoutingBehavior" | "defaultSearchResultPageSize" | "currentResolutionPageSizes">, Pick<{
|
|
53
55
|
searchBoxOptions: Ref<SearchBoxOptions>;
|
|
54
56
|
searchResultOptions: Ref<SearchResultsOptions>;
|
|
@@ -72,4 +74,5 @@ export declare const useOptionsStore: import("pinia").StoreDefinition<"options",
|
|
|
72
74
|
setInitialFilters: ({ initialFilters }: {
|
|
73
75
|
initialFilters: FilterGroup;
|
|
74
76
|
}) => void;
|
|
75
|
-
|
|
77
|
+
getQueryParamName: (param: LupaQueryParamValue) => string;
|
|
78
|
+
}, "setSearchBoxOptions" | "setTrackingOptions" | "setSearchResultOptions" | "setInitialFilters" | "getQueryParamName">>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export declare const useScreenStore: import("pinia").StoreDefinition<"screen", import("pinia")._UnwrapAll<Pick<{
|
|
2
2
|
screenWidth: import("vue").Ref<number>;
|
|
3
|
-
currentScreenWidth: import("vue").ComputedRef<"
|
|
3
|
+
currentScreenWidth: import("vue").ComputedRef<"l" | "xs" | "sm" | "md" | "xl">;
|
|
4
4
|
isMobileWidth: import("vue").ComputedRef<boolean>;
|
|
5
5
|
setScreenWidth: ({ width }: {
|
|
6
6
|
width: number;
|
|
7
7
|
}) => void;
|
|
8
8
|
}, "screenWidth">>, Pick<{
|
|
9
9
|
screenWidth: import("vue").Ref<number>;
|
|
10
|
-
currentScreenWidth: import("vue").ComputedRef<"
|
|
10
|
+
currentScreenWidth: import("vue").ComputedRef<"l" | "xs" | "sm" | "md" | "xl">;
|
|
11
11
|
isMobileWidth: import("vue").ComputedRef<boolean>;
|
|
12
12
|
setScreenWidth: ({ width }: {
|
|
13
13
|
width: number;
|
|
14
14
|
}) => void;
|
|
15
15
|
}, "currentScreenWidth" | "isMobileWidth">, Pick<{
|
|
16
16
|
screenWidth: import("vue").Ref<number>;
|
|
17
|
-
currentScreenWidth: import("vue").ComputedRef<"
|
|
17
|
+
currentScreenWidth: import("vue").ComputedRef<"l" | "xs" | "sm" | "md" | "xl">;
|
|
18
18
|
isMobileWidth: import("vue").ComputedRef<boolean>;
|
|
19
19
|
setScreenWidth: ({ width }: {
|
|
20
20
|
width: number;
|
|
@@ -19,3 +19,5 @@ export type TrackingOptions = {
|
|
|
19
19
|
export type Environment = SdkEnvironment;
|
|
20
20
|
export type SortDirection = 'asc' | 'desc';
|
|
21
21
|
export type ScreenSize = 'xs' | 'sm' | 'md' | 'l' | 'xl';
|
|
22
|
+
export type LupaQueryParamName = 'QUERY' | 'PAGE' | 'LIMIT' | 'SORT';
|
|
23
|
+
export type LupaQueryParamValue = 'q' | 'p' | 'l' | 's';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SearchQueryResult } from '@getlupa/client-sdk/Types';
|
|
2
|
-
import type { SdkOptions } from '../General';
|
|
2
|
+
import type { LupaQueryParamValue, SdkOptions } from '../General';
|
|
3
3
|
import type { RoutingBehavior } from '../search-results/RoutingBehavior';
|
|
4
4
|
import type { DynamicData } from '../search-results/SearchResultsOptions';
|
|
5
5
|
import type { SearchBoxHistory } from './SearchBoxHistory';
|
|
@@ -14,6 +14,7 @@ export type SearchBoxOptions = SearchBoxPanelOptions & {
|
|
|
14
14
|
dynamicData?: DynamicData;
|
|
15
15
|
callbacks?: SearchBoxEventCallbacks;
|
|
16
16
|
redirections?: RedirectionOptions;
|
|
17
|
+
queryParameterNames?: Record<LupaQueryParamValue, string>;
|
|
17
18
|
};
|
|
18
19
|
export type SearchBoxOptionLabels = {
|
|
19
20
|
placeholder: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DocumentElement } from '../DocumentElement';
|
|
2
2
|
import type { Document } from '@getlupa/client-sdk/Types';
|
|
3
3
|
import { CustomDocumentHtmlAttributes } from '../General';
|
|
4
|
+
import { SearchBoxBadgeOptions } from './SearchBoxBadgeOptions';
|
|
4
5
|
export declare enum SearchBoxPanelType {
|
|
5
6
|
SUGGESTION = "suggestion",
|
|
6
7
|
DOCUMENT = "document",
|
|
@@ -30,6 +31,7 @@ export type DocumentSearchBoxPanel = SearchBoxPanelBase & {
|
|
|
30
31
|
idKey?: string;
|
|
31
32
|
customClassName?: string;
|
|
32
33
|
searchBySuggestion?: boolean;
|
|
34
|
+
badges?: SearchBoxBadgeOptions;
|
|
33
35
|
isInStock?: (doc: Document) => boolean;
|
|
34
36
|
customDocumentHtmlAttributes?: CustomDocumentHtmlAttributes;
|
|
35
37
|
};
|
|
@@ -15,10 +15,11 @@ export type BadgeGenerateOptions<T = Record<string, any>> = {
|
|
|
15
15
|
customClass?: (field: BadgeGenerateSeed) => string | undefined;
|
|
16
16
|
};
|
|
17
17
|
export type BadgeOptions = {
|
|
18
|
-
anchor
|
|
18
|
+
anchor?: AnchorPosition;
|
|
19
19
|
elements: BadgeElement[];
|
|
20
20
|
generate?: BadgeGenerateOptions;
|
|
21
21
|
product?: any;
|
|
22
|
+
anchorElementKey?: string;
|
|
22
23
|
};
|
|
23
24
|
export type SearchResultBadgeElement<T = any> = {
|
|
24
25
|
type: SearchResultBadgeType;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HierarchyFacetAction, RangeFacetAction, TermFacetAction } from '../types/search-results/FacetAction';
|
|
2
2
|
import type { FilterType } from '../types/search-results/Filters';
|
|
3
3
|
import type { FilterGroup } from '@getlupa/client-sdk/Types';
|
|
4
|
+
import { LupaQueryParamValue } from '../types/General';
|
|
4
5
|
type AppendParams = ({ params, paramsToRemove, encode }: {
|
|
5
6
|
params: {
|
|
6
7
|
name: string;
|
|
@@ -14,9 +15,9 @@ export declare const getFacetParam: (key: string, value: string[] | string, type
|
|
|
14
15
|
name: string;
|
|
15
16
|
value: string[] | string;
|
|
16
17
|
};
|
|
17
|
-
export declare const toggleTermFilter: (appendParams: AppendParams, facetAction: TermFacetAction, currentFilters?: FilterGroup) => void;
|
|
18
|
-
export declare const toggleHierarchyFilter: (appendParams: AppendParams, facetAction: HierarchyFacetAction, currentFilters?: FilterGroup, removeAllLevels?: boolean) => void;
|
|
19
|
-
export declare const toggleRangeFilter: (appendParams: AppendParams, facetAction: RangeFacetAction, currentFilters?: FilterGroup) => void;
|
|
18
|
+
export declare const toggleTermFilter: (appendParams: AppendParams, facetAction: TermFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup) => void;
|
|
19
|
+
export declare const toggleHierarchyFilter: (appendParams: AppendParams, facetAction: HierarchyFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup, removeAllLevels?: boolean) => void;
|
|
20
|
+
export declare const toggleRangeFilter: (appendParams: AppendParams, facetAction: RangeFacetAction, getQueryParamName?: (param: LupaQueryParamValue) => string, currentFilters?: FilterGroup) => void;
|
|
20
21
|
export declare const toggleTermParam: (params?: string[], param?: string) => string[];
|
|
21
22
|
export declare const toggleLastPram: (params?: string[], param?: string) => string[];
|
|
22
23
|
export declare const toggleHierarchyParam: (params?: string[], param?: string, removeAllLevels?: boolean) => string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InputSuggestionFacet } from '../types/search-box/Common';
|
|
2
|
+
import { LupaQueryParamValue } from '../types/General';
|
|
2
3
|
export declare const generateLink: (linkPattern: string, document: Record<string, unknown>) => string;
|
|
3
|
-
export declare const generateResultLink: (link: string, searchText?: string, facet?: InputSuggestionFacet) => string;
|
|
4
|
+
export declare const generateResultLink: (link: string, getQueryParamName?: (param: LupaQueryParamValue) => string, searchText?: string, facet?: InputSuggestionFacet) => string;
|
|
4
5
|
export declare const getPathName: (resultPageLink: string) => string;
|
|
5
6
|
export declare const getRelativePath: (link: string) => string;
|
|
6
7
|
export declare const linksMatch: (link1?: string, link2?: string) => boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { QueryParams } from '../types/search-results/QueryParams';
|
|
2
|
-
|
|
2
|
+
import { LupaQueryParamValue } from '../types/General';
|
|
3
|
+
export declare const parseParams: (getQueryParamName?: (param: LupaQueryParamValue) => string, searchParams?: URLSearchParams) => QueryParams;
|
|
3
4
|
export declare const appendParam: (url: URL, { name, value }: {
|
|
4
5
|
name: string;
|
|
5
6
|
value: string | string[];
|
|
6
7
|
}, encode?: boolean) => void;
|
|
7
|
-
export declare const getRemovableParams: (url: URL, paramsToRemove?: 'all' | string[]) => string[] | undefined;
|
|
8
|
+
export declare const getRemovableParams: (url: URL, getQueryParamName?: (param: LupaQueryParamValue) => string, paramsToRemove?: 'all' | string[]) => string[] | undefined;
|
|
8
9
|
export declare const removeParams: (url: URL, params?: string[]) => void;
|
|
9
10
|
export declare const encodeParam: (param: string) => string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InputSuggestionFacet } from '../types/search-box/Common';
|
|
2
2
|
import type { RoutingBehavior, SsrOptions } from '..';
|
|
3
|
+
import { LupaQueryParamValue } from '../types/General';
|
|
3
4
|
export declare const emitRoutingEvent: (url: string) => void;
|
|
4
5
|
export declare const handleRoutingEvent: (link: string, event?: Event, hasEventRouting?: boolean) => void;
|
|
5
|
-
export declare const redirectToResultsPage: (link: string, searchText: string, facet?: InputSuggestionFacet, routingBehavior?: RoutingBehavior) => void;
|
|
6
|
+
export declare const redirectToResultsPage: (link: string, searchText: string, getQueryParamName: (param: LupaQueryParamValue) => string, facet?: InputSuggestionFacet, routingBehavior?: RoutingBehavior) => void;
|
|
6
7
|
export declare const getPageUrl: (pathnameOverride?: string, ssr?: SsrOptions) => URL;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SearchResultsOptions } from '..';
|
|
2
2
|
import { FilterGroup } from '@getlupa/client-sdk/Types';
|
|
3
|
+
import { LupaQueryParamValue } from '../types/General';
|
|
3
4
|
export declare const getSearchParams: (url?: string, params?: URLSearchParams, baseUrl?: string) => URLSearchParams;
|
|
4
|
-
export declare const getInitialSearchResults: (options: SearchResultsOptions, defaultData?: {
|
|
5
|
+
export declare const getInitialSearchResults: (options: SearchResultsOptions, getQueryParamName: (param: LupaQueryParamValue) => string, defaultData?: {
|
|
5
6
|
filters?: FilterGroup;
|
|
6
7
|
pageSize?: number;
|
|
7
8
|
}) => Promise<import("@getlupa/client-sdk/Types").SearchQueryResult | import("@getlupa/client-sdk/Types").SdkError>;
|