@getlupa/client 0.7.0-alpha-1 → 0.7.0-alpha-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.
@@ -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,10 +9,10 @@ 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 = Record<string, unknown>> = {
14
13
  type: DocumentElementType;
15
14
  key?: string;
16
- display?: <T>(document: T) => boolean;
15
+ display?: (document: T) => boolean;
17
16
  isHtml?: boolean;
18
17
  };
19
18
  export declare type ImageDocumentElement = DocumentElementBase & {
@@ -47,12 +46,12 @@ export declare type RegularPriceDocumentElement = DocumentElementBase & {
47
46
  type: DocumentElementType.REGULARPRICE;
48
47
  key: string;
49
48
  };
50
- export declare type RatingElement = DocumentElementBase & {
49
+ export declare type RatingElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
51
50
  type: DocumentElementType.RATING;
52
51
  labels: RatingLabels;
53
52
  links: RatingLinks;
54
53
  totalKey: string;
55
- getRatingPercentage?: (doc: Document) => number;
54
+ getRatingPercentage?: (doc: T) => number;
56
55
  key: string;
57
56
  };
58
57
  export declare type RatingLabels = {
@@ -61,16 +60,16 @@ export declare type RatingLabels = {
61
60
  export declare type RatingLinks = {
62
61
  ratingDetails?: string;
63
62
  };
64
- export declare type AddToCartElement = DocumentElementBase & {
63
+ export declare type AddToCartElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
65
64
  type: DocumentElementType.ADDTOCART;
66
- action: (document: Document, amount: number) => Promise<unknown> | undefined;
65
+ action: (document: T, amount: number) => Promise<unknown> | undefined;
67
66
  labels: {
68
67
  addToCart: string;
69
68
  };
70
69
  };
71
- export declare type CustomHtmlElement = DocumentElementBase & {
70
+ export declare type CustomHtmlElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
72
71
  type: DocumentElementType.CUSTOM_HTML;
73
- html: (document: Document) => string;
72
+ html: (document: T) => string;
74
73
  className: string;
75
74
  };
76
75
  export declare type DocumentElement = ImageDocumentElement | TitleDocumentElement | DescriptionDocumentElement | CustomDocumentElement | PriceElement | RegularPriceDocumentElement | RatingElement | AddToCartElement | CustomHtmlElement;
@@ -6,13 +6,14 @@ export declare type BadgeOptions = {
6
6
  elements: BadgeElement[];
7
7
  product?: Document;
8
8
  };
9
- export declare type SearchResultBadgeElement = {
9
+ export declare type SearchResultBadgeElement<T = Record<string, unknown>> = {
10
10
  type: SearchResultBadgeType;
11
11
  key: string;
12
12
  isHtml?: boolean;
13
- className?: boolean;
14
- product?: Document;
15
- display?: (document: Record<string, unknown>) => boolean;
13
+ className?: string;
14
+ product?: T;
15
+ display?: (document: T) => boolean;
16
+ rootImageUrl?: string;
16
17
  };
17
18
  export declare type BaseBadgeElement = SearchResultBadgeElement & {
18
19
  value?: string;
@@ -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,10 +9,10 @@ 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 = Record<string, unknown>> = {
14
13
  type: DocumentElementType;
15
14
  key?: string;
16
- display?: <T>(document: T) => boolean;
15
+ display?: (document: T) => boolean;
17
16
  isHtml?: boolean;
18
17
  };
19
18
  export declare type ImageDocumentElement = DocumentElementBase & {
@@ -47,12 +46,12 @@ export declare type RegularPriceDocumentElement = DocumentElementBase & {
47
46
  type: DocumentElementType.REGULARPRICE;
48
47
  key: string;
49
48
  };
50
- export declare type RatingElement = DocumentElementBase & {
49
+ export declare type RatingElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
51
50
  type: DocumentElementType.RATING;
52
51
  labels: RatingLabels;
53
52
  links: RatingLinks;
54
53
  totalKey: string;
55
- getRatingPercentage?: (doc: Document) => number;
54
+ getRatingPercentage?: (doc: T) => number;
56
55
  key: string;
57
56
  };
58
57
  export declare type RatingLabels = {
@@ -61,16 +60,16 @@ export declare type RatingLabels = {
61
60
  export declare type RatingLinks = {
62
61
  ratingDetails?: string;
63
62
  };
64
- export declare type AddToCartElement = DocumentElementBase & {
63
+ export declare type AddToCartElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
65
64
  type: DocumentElementType.ADDTOCART;
66
- action: (document: Document, amount: number) => Promise<unknown> | undefined;
65
+ action: (document: T, amount: number) => Promise<unknown> | undefined;
67
66
  labels: {
68
67
  addToCart: string;
69
68
  };
70
69
  };
71
- export declare type CustomHtmlElement = DocumentElementBase & {
70
+ export declare type CustomHtmlElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
72
71
  type: DocumentElementType.CUSTOM_HTML;
73
- html: (document: Document) => string;
72
+ html: (document: T) => string;
74
73
  className: string;
75
74
  };
76
75
  export declare type DocumentElement = ImageDocumentElement | TitleDocumentElement | DescriptionDocumentElement | CustomDocumentElement | PriceElement | RegularPriceDocumentElement | RatingElement | AddToCartElement | CustomHtmlElement;
@@ -6,13 +6,14 @@ export declare type BadgeOptions = {
6
6
  elements: BadgeElement[];
7
7
  product?: Document;
8
8
  };
9
- export declare type SearchResultBadgeElement = {
9
+ export declare type SearchResultBadgeElement<T = Record<string, unknown>> = {
10
10
  type: SearchResultBadgeType;
11
11
  key: string;
12
12
  isHtml?: boolean;
13
- className?: boolean;
14
- product?: Document;
15
- display?: (document: Record<string, unknown>) => boolean;
13
+ className?: string;
14
+ product?: T;
15
+ display?: (document: T) => boolean;
16
+ rootImageUrl?: string;
16
17
  };
17
18
  export declare type BaseBadgeElement = SearchResultBadgeElement & {
18
19
  value?: string;
@@ -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,10 +9,10 @@ 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 = Record<string, unknown>> = {
14
13
  type: DocumentElementType;
15
14
  key?: string;
16
- display?: <T>(document: T) => boolean;
15
+ display?: (document: T) => boolean;
17
16
  isHtml?: boolean;
18
17
  };
19
18
  export declare type ImageDocumentElement = DocumentElementBase & {
@@ -47,12 +46,12 @@ export declare type RegularPriceDocumentElement = DocumentElementBase & {
47
46
  type: DocumentElementType.REGULARPRICE;
48
47
  key: string;
49
48
  };
50
- export declare type RatingElement = DocumentElementBase & {
49
+ export declare type RatingElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
51
50
  type: DocumentElementType.RATING;
52
51
  labels: RatingLabels;
53
52
  links: RatingLinks;
54
53
  totalKey: string;
55
- getRatingPercentage?: (doc: Document) => number;
54
+ getRatingPercentage?: (doc: T) => number;
56
55
  key: string;
57
56
  };
58
57
  export declare type RatingLabels = {
@@ -61,16 +60,16 @@ export declare type RatingLabels = {
61
60
  export declare type RatingLinks = {
62
61
  ratingDetails?: string;
63
62
  };
64
- export declare type AddToCartElement = DocumentElementBase & {
63
+ export declare type AddToCartElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
65
64
  type: DocumentElementType.ADDTOCART;
66
- action: (document: Document, amount: number) => Promise<unknown> | undefined;
65
+ action: (document: T, amount: number) => Promise<unknown> | undefined;
67
66
  labels: {
68
67
  addToCart: string;
69
68
  };
70
69
  };
71
- export declare type CustomHtmlElement = DocumentElementBase & {
70
+ export declare type CustomHtmlElement<T = Record<string, unknown>> = DocumentElementBase<T> & {
72
71
  type: DocumentElementType.CUSTOM_HTML;
73
- html: (document: Document) => string;
72
+ html: (document: T) => string;
74
73
  className: string;
75
74
  };
76
75
  export declare type DocumentElement = ImageDocumentElement | TitleDocumentElement | DescriptionDocumentElement | CustomDocumentElement | PriceElement | RegularPriceDocumentElement | RatingElement | AddToCartElement | CustomHtmlElement;
@@ -6,13 +6,14 @@ export declare type BadgeOptions = {
6
6
  elements: BadgeElement[];
7
7
  product?: Document;
8
8
  };
9
- export declare type SearchResultBadgeElement = {
9
+ export declare type SearchResultBadgeElement<T = Record<string, unknown>> = {
10
10
  type: SearchResultBadgeType;
11
11
  key: string;
12
12
  isHtml?: boolean;
13
- className?: boolean;
14
- product?: Document;
15
- display?: (document: Record<string, unknown>) => boolean;
13
+ className?: string;
14
+ product?: T;
15
+ display?: (document: T) => boolean;
16
+ rootImageUrl?: string;
16
17
  };
17
18
  export declare type BaseBadgeElement = SearchResultBadgeElement & {
18
19
  value?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "0.7.0-alpha-1",
3
+ "version": "0.7.0-alpha-2",
4
4
  "main": "dist/cjs/index.min.js",
5
5
  "module": "dist/es/index.min.js",
6
6
  "types": "dist/es/index.d.ts",