@getlupa/client 0.13.0-alpha-6 → 0.14.0
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/cjs/components/search-box/products/SearchBoxProductsWrapper.vue.d.ts +6 -0
- package/dist/cjs/components/search-box/products/elements/SearchBoxProductElement.vue.d.ts +4 -0
- package/dist/cjs/components/search-results/SearchResults.vue.d.ts +4 -1
- package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +3 -1
- package/dist/cjs/components/search-results/products/product-card/elements/SearchResultsProductCardElement.vue.d.ts +4 -0
- package/dist/cjs/components/search-results/products/product-card/elements/SearchResultsProductSingleStarRating.vue.d.ts +11 -0
- package/dist/cjs/constants/global.const.d.ts +1 -0
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.min.js +1163 -879
- package/dist/cjs/store/modules/dynamicData.d.ts +21 -0
- package/dist/cjs/types/DocumentElement.d.ts +12 -1
- package/dist/cjs/types/search-box/SearchBoxOptions.d.ts +2 -0
- package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +6 -0
- package/dist/es/components/search-box/products/SearchBoxProductsWrapper.vue.d.ts +6 -0
- package/dist/es/components/search-box/products/elements/SearchBoxProductElement.vue.d.ts +4 -0
- package/dist/es/components/search-results/SearchResults.vue.d.ts +4 -1
- package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +3 -1
- package/dist/es/components/search-results/products/product-card/elements/SearchResultsProductCardElement.vue.d.ts +4 -0
- package/dist/es/components/search-results/products/product-card/elements/SearchResultsProductSingleStarRating.vue.d.ts +11 -0
- package/dist/es/constants/global.const.d.ts +1 -0
- package/dist/es/index.d.ts +3 -3
- package/dist/es/index.min.js +1163 -879
- package/dist/es/store/modules/dynamicData.d.ts +21 -0
- package/dist/es/types/DocumentElement.d.ts +12 -1
- package/dist/es/types/search-box/SearchBoxOptions.d.ts +2 -0
- package/dist/es/types/search-results/SearchResultsOptions.d.ts +6 -0
- package/dist/iife/components/search-box/products/SearchBoxProductsWrapper.vue.d.ts +6 -0
- package/dist/iife/components/search-box/products/elements/SearchBoxProductElement.vue.d.ts +4 -0
- package/dist/iife/components/search-results/SearchResults.vue.d.ts +4 -1
- package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +3 -1
- package/dist/iife/components/search-results/products/product-card/elements/SearchResultsProductCardElement.vue.d.ts +4 -0
- package/dist/iife/components/search-results/products/product-card/elements/SearchResultsProductSingleStarRating.vue.d.ts +11 -0
- package/dist/iife/constants/global.const.d.ts +1 -0
- package/dist/iife/index.d.ts +3 -3
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/dynamicData.d.ts +21 -0
- package/dist/iife/types/DocumentElement.d.ts +12 -1
- package/dist/iife/types/search-box/SearchBoxOptions.d.ts +2 -0
- package/dist/iife/types/search-results/SearchResultsOptions.d.ts +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DynamicData } from "@/types/search-results/SearchResultsOptions";
|
|
2
|
+
import { Document, SearchQueryResult } from "@getlupa/client-sdk/Types";
|
|
3
|
+
import { VuexModule } from "vuex-module-decorators";
|
|
4
|
+
export default class DynamicDataModule extends VuexModule {
|
|
5
|
+
loading: boolean;
|
|
6
|
+
dynamicDataIdMap: Record<string, Document>;
|
|
7
|
+
get loadedIds(): string[];
|
|
8
|
+
get searchResultOptions(): any;
|
|
9
|
+
get searchBoxOptions(): any;
|
|
10
|
+
get dynamicSearchResultData(): DynamicData | undefined;
|
|
11
|
+
get dynamicSearchBoxData(): DynamicData | undefined;
|
|
12
|
+
get isDynamicDataEnabledForSearchResults(): boolean;
|
|
13
|
+
get isDynamicDataEnabledForSearchBox(): boolean;
|
|
14
|
+
get isCacheEnabled(): boolean;
|
|
15
|
+
enhanceSearchResultsWithDynamicData({ result, mode, }: {
|
|
16
|
+
result?: SearchQueryResult;
|
|
17
|
+
mode?: "searchBox" | "searchResults";
|
|
18
|
+
}): Promise<Record<string, Document>>;
|
|
19
|
+
save(newData: Record<string, Document>): void;
|
|
20
|
+
setLoading(state: boolean): void;
|
|
21
|
+
}
|
|
@@ -6,6 +6,7 @@ export declare enum DocumentElementType {
|
|
|
6
6
|
PRICE = "price",
|
|
7
7
|
REGULARPRICE = "regularPrice",
|
|
8
8
|
RATING = "rating",
|
|
9
|
+
SINGLE_STAR_RATING = "singleStarRating",
|
|
9
10
|
ADDTOCART = "addToCart",
|
|
10
11
|
CUSTOM_HTML = "customHtml"
|
|
11
12
|
}
|
|
@@ -14,6 +15,8 @@ export declare type DocumentElementBase<T = any> = {
|
|
|
14
15
|
key?: string;
|
|
15
16
|
display?: (document: T) => boolean;
|
|
16
17
|
isHtml?: boolean;
|
|
18
|
+
group?: string;
|
|
19
|
+
dynamic?: boolean;
|
|
17
20
|
};
|
|
18
21
|
export declare type ImageDocumentElement<T = any> = DocumentElementBase<T> & {
|
|
19
22
|
type: DocumentElementType.IMAGE;
|
|
@@ -57,6 +60,14 @@ export declare type RatingElement<T = any> = DocumentElementBase<T> & {
|
|
|
57
60
|
getRatingPercentage?: (doc: T) => number;
|
|
58
61
|
key: string;
|
|
59
62
|
};
|
|
63
|
+
export declare type SingleStarRatingElement<T = any> = DocumentElementBase<T> & {
|
|
64
|
+
type: DocumentElementType.SINGLE_STAR_RATING;
|
|
65
|
+
labels: RatingLabels;
|
|
66
|
+
links: RatingLinks;
|
|
67
|
+
key: string;
|
|
68
|
+
totalKey: string;
|
|
69
|
+
displayRating: (doc: T) => string;
|
|
70
|
+
};
|
|
60
71
|
export declare type RatingLabels = {
|
|
61
72
|
numberOfRatings: string;
|
|
62
73
|
};
|
|
@@ -75,4 +86,4 @@ export declare type CustomHtmlElement<T = any> = DocumentElementBase<T> & {
|
|
|
75
86
|
html: (document: T) => string;
|
|
76
87
|
className: string;
|
|
77
88
|
};
|
|
78
|
-
export declare type DocumentElement = ImageDocumentElement | TitleDocumentElement | DescriptionDocumentElement | CustomDocumentElement | PriceElement | RegularPriceDocumentElement | RatingElement | AddToCartElement | CustomHtmlElement;
|
|
89
|
+
export declare type DocumentElement = ImageDocumentElement | TitleDocumentElement | DescriptionDocumentElement | CustomDocumentElement | PriceElement | RegularPriceDocumentElement | RatingElement | SingleStarRatingElement | AddToCartElement | CustomHtmlElement;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { SdkOptions } from "../General";
|
|
2
2
|
import { RoutingBehavior } from "../search-results/RoutingBehavior";
|
|
3
|
+
import { DynamicData } from "../search-results/SearchResultsOptions";
|
|
3
4
|
import { SearchBoxHistory } from "./SearchBoxHistory";
|
|
4
5
|
import { SearchBoxPanel } from "./SearchBoxPanel";
|
|
5
6
|
export declare type SearchBoxOptions = SearchBoxPanelOptions & {
|
|
6
7
|
inputSelector: string;
|
|
7
8
|
searchTriggers?: string[];
|
|
8
9
|
routingBehavior?: RoutingBehavior;
|
|
10
|
+
dynamicData?: DynamicData;
|
|
9
11
|
};
|
|
10
12
|
export declare type SearchBoxOptionLabels = {
|
|
11
13
|
placeholder: string;
|
|
@@ -10,6 +10,7 @@ export declare type SearchResultsOptions = SearchResultsProductOptions & SearchR
|
|
|
10
10
|
disallowEmptyQuery?: boolean;
|
|
11
11
|
callbacks?: SearchResultEventCallbacks;
|
|
12
12
|
categories?: CategoryFilterOptions;
|
|
13
|
+
dynamicData?: DynamicData;
|
|
13
14
|
};
|
|
14
15
|
export declare type SearchTitlePosition = "page-top" | "search-results-top";
|
|
15
16
|
export declare type SearchResultsDidYouMeanLabels = {
|
|
@@ -163,3 +164,8 @@ export declare type SearchResultsBreadcrumb = {
|
|
|
163
164
|
label: string;
|
|
164
165
|
link?: string;
|
|
165
166
|
};
|
|
167
|
+
export declare type DynamicData = {
|
|
168
|
+
enabled?: boolean;
|
|
169
|
+
cache?: boolean;
|
|
170
|
+
handler?: (documentIds: string[]) => Promise<Record<"id" | string, unknown>[]>;
|
|
171
|
+
};
|
|
@@ -19,8 +19,14 @@ export default class SearchBoxProductsWrapper extends Vue {
|
|
|
19
19
|
queryKey: string;
|
|
20
20
|
result?: SearchQueryResult;
|
|
21
21
|
}>;
|
|
22
|
+
enhanceData: ({ result, mode, }: {
|
|
23
|
+
result: SearchQueryResult;
|
|
24
|
+
mode: "searchBox";
|
|
25
|
+
}) => Promise<void>;
|
|
22
26
|
created(): void;
|
|
23
27
|
onInputChange(): void;
|
|
24
28
|
getItemsDebounced: () => unknown;
|
|
29
|
+
enhanceDataDebounced: () => unknown;
|
|
30
|
+
enhancePanelData(): Promise<void>;
|
|
25
31
|
getItems(): void;
|
|
26
32
|
}
|
|
@@ -6,6 +6,10 @@ export default class SearchBoxProductElement extends Vue {
|
|
|
6
6
|
item: Document;
|
|
7
7
|
element: DocumentElement;
|
|
8
8
|
labels?: SearchBoxOptionLabels;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
dynamicDataIdMap: Record<string, Document>;
|
|
9
11
|
get elementComponent(): string;
|
|
10
12
|
get displayElement(): boolean;
|
|
13
|
+
get isLoadingDynamicData(): boolean;
|
|
14
|
+
get enhancedItem(): Document;
|
|
11
15
|
}
|
|
@@ -24,6 +24,9 @@ export default class SearchResults extends Vue {
|
|
|
24
24
|
queryKey: string;
|
|
25
25
|
results: SearchQueryResult;
|
|
26
26
|
}) => void;
|
|
27
|
+
enhanceData: ({ result, }: {
|
|
28
|
+
result: SearchQueryResult;
|
|
29
|
+
}) => Promise<void>;
|
|
27
30
|
searchString: string;
|
|
28
31
|
setDefaultLimit: (defaultLimit: number) => {
|
|
29
32
|
defaultLimit: number;
|
|
@@ -62,7 +65,7 @@ export default class SearchResults extends Vue {
|
|
|
62
65
|
handleResults({ queryKey, results, }: {
|
|
63
66
|
queryKey: string;
|
|
64
67
|
results: SearchQueryResult;
|
|
65
|
-
}): void
|
|
68
|
+
}): Promise<void>;
|
|
66
69
|
setScreenWidth: ({ width, }: {
|
|
67
70
|
width: number;
|
|
68
71
|
}) => void;
|
package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export default class SearchResultsProductCard extends Vue {
|
|
|
11
11
|
product: Document;
|
|
12
12
|
options: SearchResultsProductCardOptions;
|
|
13
13
|
isAdditionalPanel: boolean;
|
|
14
|
+
isInStock: boolean;
|
|
14
15
|
layout: ResultsLayout;
|
|
15
16
|
searchResultsRoutingBehavior: RoutingBehavior;
|
|
16
17
|
searchResultOptions: SearchResultsOptions;
|
|
@@ -26,7 +27,8 @@ export default class SearchResultsProductCard extends Vue {
|
|
|
26
27
|
get labels(): SearchResultsOptionLabels;
|
|
27
28
|
get link(): string;
|
|
28
29
|
get hasEventRouting(): boolean;
|
|
29
|
-
|
|
30
|
+
get elementGroups(): string[];
|
|
31
|
+
getGroupElements(group: string): DocumentElement[];
|
|
30
32
|
mounted(): void;
|
|
31
33
|
checkIfIsInStock(): Promise<void>;
|
|
32
34
|
get id(): string;
|
|
@@ -8,8 +8,12 @@ export default class SearchResultsProductCardElement extends Vue {
|
|
|
8
8
|
labels?: SearchBoxOptionLabels;
|
|
9
9
|
inStock?: boolean;
|
|
10
10
|
link: string;
|
|
11
|
+
dynamicDataIdMap: Record<string, Document>;
|
|
12
|
+
loading: boolean;
|
|
11
13
|
get elementComponent(): string;
|
|
12
14
|
get displayElement(): boolean;
|
|
15
|
+
get isLoadingDynamicData(): boolean;
|
|
16
|
+
get enhancedItem(): Document;
|
|
13
17
|
handleProductEvent(item: {
|
|
14
18
|
type: string;
|
|
15
19
|
}): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
import { Document } from "@getlupa/client-sdk/Types";
|
|
3
|
+
import { SingleStarRatingElement } from "@/types/DocumentElement";
|
|
4
|
+
export default class SearchResultsProductSingleStarRating extends Vue {
|
|
5
|
+
item: Document;
|
|
6
|
+
options: SingleStarRatingElement;
|
|
7
|
+
get totalRatings(): string;
|
|
8
|
+
get ratingLink(): string;
|
|
9
|
+
get rating(): string;
|
|
10
|
+
get star(): string;
|
|
11
|
+
}
|
|
@@ -14,3 +14,4 @@ export declare const DEFAULT_PAGE_SIZE = 12;
|
|
|
14
14
|
export declare const DEFAULT_PAGE_SIZE_SELECTION: number[];
|
|
15
15
|
export declare const LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
16
16
|
export declare const DEFAULT_CONTAINER_STYLE = "containerStyle.css";
|
|
17
|
+
export declare const RATING_STAR_HTML = "☆";
|
package/dist/iife/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
|
|
2
|
-
import { CallbackContext, FacetFilterQuery, FacetStyle, ResultFacetOptions, SearchResultEventCallbacks, SearchResultsFilterOptions, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
2
|
+
import { CallbackContext, DynamicData, FacetFilterQuery, FacetStyle, ResultFacetOptions, SearchResultEventCallbacks, SearchResultsFilterOptions, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
|
|
3
3
|
import { SdkOptions, TrackingOptions, Environment, SortDirection } from "./types/General";
|
|
4
4
|
import { CategoryFilterOptions, ProductListOptions } from "./types/product-list/ProductListOptions";
|
|
5
|
-
import { AddToCartElement, CustomDocumentElement, CustomHtmlElement, DescriptionDocumentElement, DocumentElement, DocumentElementType, ImageDocumentElement, PriceElement, RatingElement, RegularPriceDocumentElement, TitleDocumentElement } from "./types/DocumentElement";
|
|
5
|
+
import { AddToCartElement, CustomDocumentElement, CustomHtmlElement, DescriptionDocumentElement, DocumentElement, DocumentElementType, ImageDocumentElement, PriceElement, RatingElement, RegularPriceDocumentElement, SingleStarRatingElement, TitleDocumentElement } from "./types/DocumentElement";
|
|
6
6
|
import { SearchBoxPanelType } from "./types/search-box/SearchBoxPanel";
|
|
7
7
|
import { RoutingBehavior } from "./types/search-results/RoutingBehavior";
|
|
8
8
|
import { AnchorPosition } from "./types/search-results/SearchResultsProductCardOptions";
|
|
@@ -23,5 +23,5 @@ declare const lupaSearch: {
|
|
|
23
23
|
clearProductList: (selector?: string | undefined) => void;
|
|
24
24
|
clearSearchContainer: (selector?: string | undefined) => void;
|
|
25
25
|
};
|
|
26
|
-
export { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, DocumentElementType, SearchBoxPanelType, FacetStyle, Environment, RoutingBehavior, AnchorPosition, BadgeType, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, CategoryFilterOptions, SearchResultsFilterOptions, SearchResultBadgeType, SearchResultBadgeElement, ResultFacetOptions, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, MountOptions, SearchContainerOptions, SearchContainerConfigOptions, };
|
|
26
|
+
export { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, DocumentElementType, SearchBoxPanelType, FacetStyle, Environment, RoutingBehavior, AnchorPosition, BadgeType, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, CategoryFilterOptions, SearchResultsFilterOptions, SearchResultBadgeType, SearchResultBadgeElement, ResultFacetOptions, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, MountOptions, SearchContainerOptions, SearchContainerConfigOptions, SingleStarRatingElement, DynamicData, };
|
|
27
27
|
export default lupaSearch;
|