@getlupa/client 0.13.0-alpha-6 → 0.14.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.
Files changed (46) hide show
  1. package/dist/cjs/components/product-list/CategoryFilter.vue.d.ts +1 -0
  2. package/dist/cjs/components/search-box/products/SearchBoxProductsWrapper.vue.d.ts +6 -0
  3. package/dist/cjs/components/search-box/products/elements/SearchBoxProductElement.vue.d.ts +4 -0
  4. package/dist/cjs/components/search-results/SearchResults.vue.d.ts +4 -1
  5. package/dist/cjs/components/search-results/filters/SearchResultsFilters.vue.d.ts +1 -0
  6. package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +3 -1
  7. package/dist/cjs/components/search-results/products/product-card/elements/SearchResultsProductCardElement.vue.d.ts +4 -0
  8. package/dist/cjs/components/search-results/products/product-card/elements/SearchResultsProductSingleStarRating.vue.d.ts +11 -0
  9. package/dist/cjs/constants/global.const.d.ts +1 -0
  10. package/dist/cjs/index.d.ts +3 -3
  11. package/dist/cjs/index.min.js +1181 -879
  12. package/dist/cjs/store/modules/dynamicData.d.ts +22 -0
  13. package/dist/cjs/types/DocumentElement.d.ts +12 -1
  14. package/dist/cjs/types/search-box/SearchBoxOptions.d.ts +2 -0
  15. package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +6 -0
  16. package/dist/es/components/product-list/CategoryFilter.vue.d.ts +1 -0
  17. package/dist/es/components/search-box/products/SearchBoxProductsWrapper.vue.d.ts +6 -0
  18. package/dist/es/components/search-box/products/elements/SearchBoxProductElement.vue.d.ts +4 -0
  19. package/dist/es/components/search-results/SearchResults.vue.d.ts +4 -1
  20. package/dist/es/components/search-results/filters/SearchResultsFilters.vue.d.ts +1 -0
  21. package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +3 -1
  22. package/dist/es/components/search-results/products/product-card/elements/SearchResultsProductCardElement.vue.d.ts +4 -0
  23. package/dist/es/components/search-results/products/product-card/elements/SearchResultsProductSingleStarRating.vue.d.ts +11 -0
  24. package/dist/es/constants/global.const.d.ts +1 -0
  25. package/dist/es/index.d.ts +3 -3
  26. package/dist/es/index.min.js +1181 -879
  27. package/dist/es/store/modules/dynamicData.d.ts +22 -0
  28. package/dist/es/types/DocumentElement.d.ts +12 -1
  29. package/dist/es/types/search-box/SearchBoxOptions.d.ts +2 -0
  30. package/dist/es/types/search-results/SearchResultsOptions.d.ts +6 -0
  31. package/dist/iife/components/product-list/CategoryFilter.vue.d.ts +1 -0
  32. package/dist/iife/components/search-box/products/SearchBoxProductsWrapper.vue.d.ts +6 -0
  33. package/dist/iife/components/search-box/products/elements/SearchBoxProductElement.vue.d.ts +4 -0
  34. package/dist/iife/components/search-results/SearchResults.vue.d.ts +4 -1
  35. package/dist/iife/components/search-results/filters/SearchResultsFilters.vue.d.ts +1 -0
  36. package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +3 -1
  37. package/dist/iife/components/search-results/products/product-card/elements/SearchResultsProductCardElement.vue.d.ts +4 -0
  38. package/dist/iife/components/search-results/products/product-card/elements/SearchResultsProductSingleStarRating.vue.d.ts +11 -0
  39. package/dist/iife/constants/global.const.d.ts +1 -0
  40. package/dist/iife/index.d.ts +3 -3
  41. package/dist/iife/index.min.js +1 -1
  42. package/dist/iife/store/modules/dynamicData.d.ts +22 -0
  43. package/dist/iife/types/DocumentElement.d.ts +12 -1
  44. package/dist/iife/types/search-box/SearchBoxOptions.d.ts +2 -0
  45. package/dist/iife/types/search-results/SearchResultsOptions.d.ts +6 -0
  46. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ import { SearchBoxOptions } from "@/types/search-box/SearchBoxOptions";
2
+ import { DynamicData, SearchResultsOptions } from "@/types/search-results/SearchResultsOptions";
3
+ import { Document, SearchQueryResult } from "@getlupa/client-sdk/Types";
4
+ import { VuexModule } from "vuex-module-decorators";
5
+ export default class DynamicDataModule extends VuexModule {
6
+ loading: boolean;
7
+ dynamicDataIdMap: Record<string, Document>;
8
+ get loadedIds(): string[];
9
+ get searchResultOptions(): SearchResultsOptions;
10
+ get searchBoxOptions(): SearchBoxOptions;
11
+ get dynamicSearchResultData(): DynamicData | undefined;
12
+ get dynamicSearchBoxData(): DynamicData | undefined;
13
+ get isDynamicDataEnabledForSearchResults(): boolean;
14
+ get isDynamicDataEnabledForSearchBox(): boolean;
15
+ get isCacheEnabled(): boolean;
16
+ enhanceSearchResultsWithDynamicData({ result, mode, }: {
17
+ result?: SearchQueryResult;
18
+ mode?: "searchBox" | "searchResults";
19
+ }): Promise<Record<string, Document>>;
20
+ save(newData: Record<string, Document>): void;
21
+ setLoading(state: boolean): void;
22
+ }
@@ -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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "0.13.0-alpha-6",
3
+ "version": "0.14.1",
4
4
  "main": "dist/cjs/index.min.js",
5
5
  "module": "dist/es/index.min.js",
6
6
  "types": "dist/es/index.d.ts",