@getlupa/client 0.7.0 → 0.8.0-alpha-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 (53) hide show
  1. package/dist/cjs/ProductListEntry.vue.d.ts +1 -0
  2. package/dist/cjs/SearchBoxEntry.vue.d.ts +1 -0
  3. package/dist/cjs/SearchResultsEntry.vue.d.ts +1 -0
  4. package/dist/cjs/components/product-list/ProductList.vue.d.ts +1 -0
  5. package/dist/cjs/components/search-results/SearchResultsTitle.vue.d.ts +1 -0
  6. package/dist/cjs/components/search-results/filters/facets/StatsFacet.vue.d.ts +2 -0
  7. package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +2 -1
  8. package/dist/cjs/components/search-results/products/product-card/badges/SearchResultGeneratedBadge.vue.d.ts +9 -0
  9. package/dist/cjs/components/search-results/products/product-card/badges/SearchResultGeneratedBadges.vue.d.ts +9 -0
  10. package/dist/cjs/components/search-results/products/product-card/badges/SearchResultsBadgeWrapper.vue.d.ts +2 -0
  11. package/dist/cjs/index.d.ts +12 -9
  12. package/dist/cjs/index.min.js +1092 -728
  13. package/dist/cjs/types/DocumentElement.d.ts +16 -15
  14. package/dist/cjs/types/product-list/ProductListOptions.d.ts +5 -4
  15. package/dist/cjs/types/search-results/BadgeOptions.d.ts +29 -12
  16. package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +6 -1
  17. package/dist/cjs/types/search-results/SearchResultsProductCardOptions.d.ts +2 -1
  18. package/dist/es/ProductListEntry.vue.d.ts +1 -0
  19. package/dist/es/SearchBoxEntry.vue.d.ts +1 -0
  20. package/dist/es/SearchResultsEntry.vue.d.ts +1 -0
  21. package/dist/es/components/product-list/ProductList.vue.d.ts +1 -0
  22. package/dist/es/components/search-results/SearchResultsTitle.vue.d.ts +1 -0
  23. package/dist/es/components/search-results/filters/facets/StatsFacet.vue.d.ts +2 -0
  24. package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +2 -1
  25. package/dist/es/components/search-results/products/product-card/badges/SearchResultGeneratedBadge.vue.d.ts +9 -0
  26. package/dist/es/components/search-results/products/product-card/badges/SearchResultGeneratedBadges.vue.d.ts +9 -0
  27. package/dist/es/components/search-results/products/product-card/badges/SearchResultsBadgeWrapper.vue.d.ts +2 -0
  28. package/dist/es/index.d.ts +12 -9
  29. package/dist/es/index.min.js +1092 -728
  30. package/dist/es/types/DocumentElement.d.ts +16 -15
  31. package/dist/es/types/product-list/ProductListOptions.d.ts +5 -4
  32. package/dist/es/types/search-results/BadgeOptions.d.ts +29 -12
  33. package/dist/es/types/search-results/SearchResultsOptions.d.ts +6 -1
  34. package/dist/es/types/search-results/SearchResultsProductCardOptions.d.ts +2 -1
  35. package/dist/iife/ProductListEntry.vue.d.ts +1 -0
  36. package/dist/iife/SearchBoxEntry.vue.d.ts +1 -0
  37. package/dist/iife/SearchResultsEntry.vue.d.ts +1 -0
  38. package/dist/iife/components/product-list/ProductList.vue.d.ts +1 -0
  39. package/dist/iife/components/search-results/SearchResultsTitle.vue.d.ts +1 -0
  40. package/dist/iife/components/search-results/filters/facets/StatsFacet.vue.d.ts +2 -0
  41. package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +2 -1
  42. package/dist/iife/components/search-results/products/product-card/badges/SearchResultGeneratedBadge.vue.d.ts +9 -0
  43. package/dist/iife/components/search-results/products/product-card/badges/SearchResultGeneratedBadges.vue.d.ts +9 -0
  44. package/dist/iife/components/search-results/products/product-card/badges/SearchResultsBadgeWrapper.vue.d.ts +2 -0
  45. package/dist/iife/index.d.ts +12 -9
  46. package/dist/iife/index.min.js +1 -1
  47. package/dist/iife/types/DocumentElement.d.ts +16 -15
  48. package/dist/iife/types/product-list/ProductListOptions.d.ts +5 -4
  49. package/dist/iife/types/search-results/BadgeOptions.d.ts +29 -12
  50. package/dist/iife/types/search-results/SearchResultsOptions.d.ts +6 -1
  51. package/dist/iife/types/search-results/SearchResultsProductCardOptions.d.ts +2 -1
  52. package/dist/style.css +1 -1
  53. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- import { Document } from "@getlupa/client-sdk/Types";
2
1
  export declare enum DocumentElementType {
3
2
  IMAGE = "image",
4
3
  TITLE = "title",
@@ -10,48 +9,50 @@ export declare enum DocumentElementType {
10
9
  ADDTOCART = "addToCart",
11
10
  CUSTOM_HTML = "customHtml"
12
11
  }
13
- export declare type DocumentElementBase = {
12
+ export declare type DocumentElementBase<T = any> = {
14
13
  type: DocumentElementType;
15
14
  key?: string;
16
- display?: (document: Record<string, unknown>) => boolean;
15
+ display?: (document: T) => boolean;
17
16
  isHtml?: boolean;
18
17
  };
19
- export declare type ImageDocumentElement = DocumentElementBase & {
18
+ export declare type ImageDocumentElement<T = any> = DocumentElementBase<T> & {
20
19
  type: DocumentElementType.IMAGE;
21
20
  placeholder: string;
22
21
  baseUrl?: string;
23
22
  key: string;
24
23
  };
25
- export declare type TitleDocumentElement = DocumentElementBase & {
24
+ export declare type TitleDocumentElement<T = any> = DocumentElementBase<T> & {
26
25
  type: DocumentElementType.TITLE;
27
26
  maxLines: number;
28
27
  link?: boolean;
29
28
  key: string;
30
29
  };
31
- export declare type DescriptionDocumentElement = DocumentElementBase & {
30
+ export declare type DescriptionDocumentElement<T = any> = DocumentElementBase<T> & {
32
31
  type: DocumentElementType.DESCRIPTION;
33
32
  maxLines: number;
34
33
  key: string;
34
+ className: string;
35
35
  };
36
- export declare type CustomDocumentElement = DocumentElementBase & {
36
+ export declare type CustomDocumentElement<T = any> = DocumentElementBase<T> & {
37
37
  type: DocumentElementType.CUSTOM;
38
+ maxLines?: number;
38
39
  className: string;
39
40
  key: string;
40
41
  };
41
- export declare type PriceElement = DocumentElementBase & {
42
+ export declare type PriceElement<T = any> = DocumentElementBase<T> & {
42
43
  type: DocumentElementType.PRICE;
43
44
  key: string;
44
45
  };
45
- export declare type RegularPriceDocumentElement = DocumentElementBase & {
46
+ export declare type RegularPriceDocumentElement<T = any> = DocumentElementBase<T> & {
46
47
  type: DocumentElementType.REGULARPRICE;
47
48
  key: string;
48
49
  };
49
- export declare type RatingElement = DocumentElementBase & {
50
+ export declare type RatingElement<T = any> = DocumentElementBase<T> & {
50
51
  type: DocumentElementType.RATING;
51
52
  labels: RatingLabels;
52
53
  links: RatingLinks;
53
54
  totalKey: string;
54
- getRatingPercentage?: (doc: Document) => number;
55
+ getRatingPercentage?: (doc: T) => number;
55
56
  key: string;
56
57
  };
57
58
  export declare type RatingLabels = {
@@ -60,16 +61,16 @@ export declare type RatingLabels = {
60
61
  export declare type RatingLinks = {
61
62
  ratingDetails?: string;
62
63
  };
63
- export declare type AddToCartElement = DocumentElementBase & {
64
+ export declare type AddToCartElement<T = any> = DocumentElementBase<T> & {
64
65
  type: DocumentElementType.ADDTOCART;
65
- action: (document: Document, amount: number) => Promise<unknown> | undefined;
66
+ action: (document: T, amount: number) => Promise<unknown> | undefined;
66
67
  labels: {
67
68
  addToCart: string;
68
69
  };
69
70
  };
70
- export declare type CustomHtmlElement = DocumentElementBase & {
71
+ export declare type CustomHtmlElement<T = any> = DocumentElementBase<T> & {
71
72
  type: DocumentElementType.CUSTOM_HTML;
72
- html: (document: Document) => string;
73
+ html: (document: T) => string;
73
74
  className: string;
74
75
  };
75
76
  export declare type DocumentElement = ImageDocumentElement | TitleDocumentElement | DescriptionDocumentElement | CustomDocumentElement | PriceElement | RegularPriceDocumentElement | RatingElement | AddToCartElement | CustomHtmlElement;
@@ -14,12 +14,13 @@ export declare type CategoryFilterOptions = {
14
14
  title: string;
15
15
  };
16
16
  parent?: {
17
- url: string;
18
- title: string;
17
+ url?: string;
18
+ title?: string;
19
19
  };
20
20
  current?: {
21
- title: string;
22
- description: string;
21
+ title?: string;
22
+ description?: string;
23
+ descriptionTop?: string;
23
24
  };
24
25
  };
25
26
  export declare type ProductListOptions = SearchResultsOptions & {
@@ -1,35 +1,52 @@
1
- import { Document } from "@getlupa/client-sdk/Types";
2
1
  import { AnchorPosition } from "./SearchResultsProductCardOptions";
3
2
  export declare type SearchResultBadgeType = "text" | "image" | "customHtml";
3
+ export declare type BadgeGenerateSeed = {
4
+ id?: string;
5
+ backgroundColor?: string;
6
+ color?: string;
7
+ titleText?: string;
8
+ additionalText?: string;
9
+ };
10
+ export declare type BadgeGenerateOptions<T = Record<string, any>> = {
11
+ key?: string;
12
+ keyMap?: Record<keyof BadgeGenerateSeed, keyof T>;
13
+ image?: (field: BadgeGenerateSeed) => string | undefined;
14
+ };
4
15
  export declare type BadgeOptions = {
5
16
  anchor: AnchorPosition;
6
17
  elements: BadgeElement[];
7
- product: Document;
18
+ generate?: BadgeGenerateOptions;
19
+ product?: any;
8
20
  };
9
- export declare type SearchResultBadgeElement = {
21
+ export declare type SearchResultBadgeElement<T = any> = {
10
22
  type: SearchResultBadgeType;
11
23
  key: string;
12
- isHtml: boolean;
13
- product: Document;
14
- display?: (document: Record<string, unknown>) => boolean;
24
+ isHtml?: boolean;
25
+ className?: string;
26
+ product?: T;
27
+ display?: (document: T) => boolean;
28
+ rootImageUrl?: string;
29
+ maxItems?: number;
30
+ html?: (doc: T) => string;
31
+ position?: "card" | "image";
15
32
  };
16
- export declare type BaseBadgeElement = SearchResultBadgeElement & {
33
+ export declare type BaseBadgeElement<T = any> = SearchResultBadgeElement<T> & {
17
34
  value?: string;
18
35
  };
19
- export declare type TextBadgeElement = BaseBadgeElement & {
36
+ export declare type TextBadgeElement<T = any> = BaseBadgeElement<T> & {
20
37
  type: "text";
21
38
  prefix?: string;
22
39
  maxItems?: number;
23
40
  };
24
- export declare type ImageBadgeElement = BaseBadgeElement & {
41
+ export declare type ImageBadgeElement<T = any> = BaseBadgeElement<T> & {
25
42
  type: "image";
26
43
  rootImageUrl?: string;
27
44
  maxItems?: number;
28
45
  };
29
- export declare type CustomHtmlBadgeElement = BaseBadgeElement & {
46
+ export declare type CustomHtmlBadgeElement<T = any> = BaseBadgeElement<T> & {
30
47
  type: "customHtml";
31
- className: string;
32
- html: (doc: Document) => string;
48
+ className?: string;
49
+ html: (doc: T) => string;
33
50
  };
34
51
  export declare type BadgeElement = BaseBadgeElement | TextBadgeElement;
35
52
  export declare enum BadgeType {
@@ -9,6 +9,7 @@ export declare type SearchResultsOptions = SearchResultsProductOptions & SearchR
9
9
  classMap?: Record<string, string>;
10
10
  disallowEmptyQuery?: boolean;
11
11
  callbacks?: SearchResultEventCallbacks;
12
+ categories?: CategoryFilterOptions;
12
13
  };
13
14
  export declare type SearchTitlePosition = "page-top" | "search-results-top";
14
15
  export declare type SearchResultsDidYouMeanLabels = {
@@ -22,12 +23,15 @@ export declare type SearchResultsSimilarQueriesLabels = {
22
23
  };
23
24
  export declare type CallbackContext = {
24
25
  queryKey: string;
25
- hasResults: boolean;
26
+ hasResults?: boolean;
27
+ urlQueryString?: string;
26
28
  };
27
29
  export declare type SearchResultEventCallbacks = {
28
30
  onSearchResults?: (context: CallbackContext) => unknown;
29
31
  onAdditionalPanelResults?: (context: CallbackContext) => unknown;
30
32
  onCategoryFilterResults?: (context: CallbackContext) => unknown;
33
+ onProductClick?: (context: CallbackContext) => unknown;
34
+ onUrlQueryChange?: (context: CallbackContext) => unknown;
31
35
  onMounted?: () => unknown;
32
36
  };
33
37
  export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
@@ -73,6 +77,7 @@ export declare type ProductGrid = {
73
77
  export declare type SearchResultsPaginationLabels = {
74
78
  pageSize: string;
75
79
  showMore: string;
80
+ showLess?: string;
76
81
  };
77
82
  export declare type ResponsiveSearchResultPageSizes = {
78
83
  xs: number[];
@@ -1,6 +1,6 @@
1
1
  import { Document } from "@getlupa/client-sdk/Types";
2
2
  import { DocumentElement } from "../DocumentElement";
3
- import { BadgeElement } from "./BadgeOptions";
3
+ import { BadgeElement, BadgeGenerateOptions } from "./BadgeOptions";
4
4
  import { RoutingBehavior } from "./RoutingBehavior";
5
5
  import { SearchResultsOptionLabels } from "./SearchResultsOptions";
6
6
  export declare type SearchResultsProductCardOptions = {
@@ -18,5 +18,6 @@ export declare type SearchResultsProductCardOptions = {
18
18
  export declare type SearchResultBadgeOptions = {
19
19
  anchor: AnchorPosition;
20
20
  elements: BadgeElement[];
21
+ generate?: BadgeGenerateOptions;
21
22
  };
22
23
  export declare type AnchorPosition = "tr" | "tl";
@@ -3,4 +3,5 @@ import { ProductListOptions } from "./types/product-list/ProductListOptions";
3
3
  export default class ProductListEntry extends Vue {
4
4
  productListOptions: ProductListOptions;
5
5
  get fullProductListOptions(): ProductListOptions;
6
+ fetch(): void;
6
7
  }
@@ -3,4 +3,5 @@ import Vue from "vue";
3
3
  export default class SearchBoxEntry extends Vue {
4
4
  searchBoxOptions: SearchBoxOptions;
5
5
  get fullSearchBoxOptions(): SearchBoxOptions;
6
+ fetch(): void;
6
7
  }
@@ -3,4 +3,5 @@ import { SearchResultsOptions } from "./types/search-results/SearchResultsOption
3
3
  export default class SearchResultsEntry extends Vue {
4
4
  searchResultsOptions: SearchResultsOptions;
5
5
  get fullSearchResultsOptions(): SearchResultsOptions;
6
+ fetch(): void;
6
7
  }
@@ -3,4 +3,5 @@ import { ProductListOptions } from "@/types/product-list/ProductListOptions";
3
3
  export default class ProductList extends Vue {
4
4
  options: ProductListOptions;
5
5
  get componentOptions(): ProductListOptions;
6
+ fetch(): void;
6
7
  }
@@ -9,5 +9,6 @@ export default class SearchResultsTitle extends Vue {
9
9
  get queryText(): string;
10
10
  get showProductCount(): boolean;
11
11
  get showSearchTitle(): boolean;
12
+ get descriptionTop(): string | undefined;
12
13
  getLabel(label: string): string;
13
14
  }
@@ -26,6 +26,8 @@ export default class TermFacet extends Vue {
26
26
  get facetMin(): number;
27
27
  get facetMax(): number;
28
28
  get statsSummary(): string;
29
+ get separator(): string;
30
+ get sliderInputFormat(): string | undefined;
29
31
  onMinValueChange(): void;
30
32
  onMaxValueChange(): void;
31
33
  handleInputChange(): void;
@@ -3,7 +3,7 @@ import { TrackableEventData } from "@/types/search-box/Common";
3
3
  import { BadgeOptions } from "@/types/search-results/BadgeOptions";
4
4
  import { ResultsLayout } from "@/types/search-results/ResultsLayout";
5
5
  import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
6
- import { SearchResultsOptionLabels } from "@/types/search-results/SearchResultsOptions";
6
+ import { SearchResultsOptionLabels, SearchResultsOptions } from "@/types/search-results/SearchResultsOptions";
7
7
  import { SearchResultsProductCardOptions } from "@/types/search-results/SearchResultsProductCardOptions";
8
8
  import { Document, ReportableEventType } from "@getlupa/client-sdk/Types";
9
9
  import Vue from "vue";
@@ -13,6 +13,7 @@ export default class SearchResultsProductCard extends Vue {
13
13
  isAdditionalPanel: boolean;
14
14
  layout: ResultsLayout;
15
15
  searchResultsRoutingBehavior: RoutingBehavior;
16
+ searchResultOptions: SearchResultsOptions;
16
17
  query: string;
17
18
  trackClick: ({ queryKey, data, }: {
18
19
  queryKey: string;
@@ -0,0 +1,9 @@
1
+ import { BadgeGenerateSeed, BadgeOptions } from "@/types/search-results/BadgeOptions";
2
+ import Vue from "vue";
3
+ export default class SearchResultGeneratedBadge extends Vue {
4
+ options: BadgeOptions;
5
+ badge: BadgeGenerateSeed;
6
+ get image(): string | undefined;
7
+ get hasAdditionalText(): boolean;
8
+ get hasTitleText(): boolean;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { BadgeGenerateSeed, BadgeOptions } from "@/types/search-results/BadgeOptions";
2
+ import Vue from "vue";
3
+ export default class SearchResultGeneratedBadges extends Vue {
4
+ options: BadgeOptions;
5
+ get badgeField(): Record<string, any>[];
6
+ get keyMap(): Record<string, string>;
7
+ get hasBadges(): boolean;
8
+ get badges(): BadgeGenerateSeed[];
9
+ }
@@ -2,8 +2,10 @@ import { BadgeElement, BadgeOptions } from "@/types/search-results/BadgeOptions"
2
2
  import { AnchorPosition } from "@/types/search-results/SearchResultsProductCardOptions";
3
3
  import Vue from "vue";
4
4
  export default class SearchResultsBadgeWrapper extends Vue {
5
+ position: "card" | "image";
5
6
  options: BadgeOptions;
6
7
  get anchorPosition(): AnchorPosition;
7
8
  get badges(): BadgeElement[];
9
+ get displayBadges(): BadgeElement[];
8
10
  getBadgeComponent(type: string): string;
9
11
  }
@@ -1,21 +1,24 @@
1
1
  import { SearchBoxOptions } from "./types/search-box/SearchBoxOptions";
2
- import { CallbackContext, FacetFilterQuery, FacetStyle, SearchResultEventCallbacks, SearchResultsOptions } from "./types/search-results/SearchResultsOptions";
2
+ import { CallbackContext, 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
5
  import { AddToCartElement, CustomDocumentElement, CustomHtmlElement, DescriptionDocumentElement, DocumentElement, DocumentElementType, ImageDocumentElement, PriceElement, RatingElement, RegularPriceDocumentElement, 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";
9
- import { BadgeType } from "./types/search-results/BadgeOptions";
9
+ import { BadgeGenerateOptions, BadgeGenerateSeed, BadgeOptions, BadgeType, SearchResultBadgeElement, SearchResultBadgeType } from "./types/search-results/BadgeOptions";
10
10
  import { SearchResultsSortOptions, SortOptions } from "./types/search-results/SearchResultsSort";
11
+ declare type MountOptions = {
12
+ fetch: boolean;
13
+ };
11
14
  declare const lupaSearch: {
12
- searchBox: (options: SearchBoxOptions) => void;
13
- searchResults: (options: SearchResultsOptions) => void;
15
+ searchBox: (options: SearchBoxOptions, mountOptions?: MountOptions | undefined) => void;
16
+ searchResults: (options: SearchResultsOptions, mountOptions?: MountOptions | undefined) => void;
14
17
  tracking: (options: TrackingOptions) => void;
15
- productList: (options: ProductListOptions) => void;
16
- clearSearchBox: () => void;
17
- clearSearchResults: () => void;
18
- clearProductList: () => void;
18
+ productList: (options: ProductListOptions, mountOptions?: MountOptions | undefined) => void;
19
+ clearSearchBox: (selector?: string | undefined) => void;
20
+ clearSearchResults: (selector?: string | undefined) => void;
21
+ clearProductList: (selector?: string | undefined) => void;
19
22
  };
20
- 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, };
23
+ 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, };
21
24
  export default lupaSearch;