@car-cutter/wc-webplayer 0.4.2 → 0.6.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/index.d.ts CHANGED
@@ -1,11 +1,26 @@
1
+ declare type AspectRatio = `${number}:${number}`;
2
+
1
3
  declare type CamelToKebab<S extends string> = S extends `${infer T}${infer U}` ? `${T extends Lowercase<T> ? "" : "-"}${Lowercase<T>}${CamelToKebab<U>}` : S;
2
4
 
5
+ declare type Category = {
6
+ id: string;
7
+ title: string;
8
+ items: Item[];
9
+ };
10
+
3
11
  /**
4
12
  * Checks if WebPlayer's custom elements are defined and usable in the DOM.
5
13
  */
6
14
  export declare function checkCustomElementsDefinition(): boolean;
7
15
 
8
- export declare const DEFAULT_EVENT_PREFIX = "cc-webplayer:";
16
+ export declare type Composition = {
17
+ aspectRatio: AspectRatio;
18
+ imageHdWidth: ImageWidth;
19
+ imageSubWidths: ImageWidth[];
20
+ categories: Category[];
21
+ };
22
+
23
+ export declare const DEFAULT_EVENT_PREFIX: string = "cc-webplayer:";
9
24
 
10
25
  /**
11
26
  * Defines WebPlayer's custom elements in the DOM.
@@ -36,10 +51,60 @@ export declare const EVENT_HOTSPOTS_OFF = "hotspots-off";
36
51
 
37
52
  export declare const EVENT_HOTSPOTS_ON = "hotspots-on";
38
53
 
54
+ /**
55
+ * Generates a URL for fetching the composition JSON for a given customer and vehicle.
56
+ *
57
+ * @param {string} customerId - The ID of the customer.
58
+ * @param {string} vin - The Vehicle Identification Number.
59
+ * @returns {string} The URL to fetch the composition JSON.
60
+ */
61
+ export declare function generateCompositionUrl(
62
+ customerId: string,
63
+ vin: string
64
+ ): string {
65
+ return `https://cdn.car-cutter.com/gallery/${customerId}/${vin}/composition_v3.json`;
66
+ }
67
+
68
+ declare type Hotspot = {
69
+ title: string;
70
+ icon?: string;
71
+ description?: string;
72
+ position: {
73
+ x: number;
74
+ y: number;
75
+ };
76
+ detail?: {
77
+ type: "image" | "link" | "pdf";
78
+ src: string;
79
+ };
80
+ };
81
+
82
+ declare type ImageItem = { type: "image" } & ImageWithHotspots;
83
+
39
84
  declare type ImageLoadStrategy = "quality" | "speed";
40
85
 
41
86
  declare type ImageLoadStrategy_2 = "quality" | "speed";
42
87
 
88
+ declare type ImageWidth = number;
89
+
90
+ declare type ImageWithHotspots = {
91
+ src: string;
92
+ hotspots?: Hotspot[];
93
+ };
94
+
95
+ declare type Item = ImageItem | VideoItem | ThreeSixtyItem;
96
+
97
+ declare type ThreeSixtyItem = {
98
+ type: "360";
99
+ images: ImageWithHotspots[];
100
+ };
101
+
102
+ declare type VideoItem = {
103
+ type: "video";
104
+ src: string;
105
+ poster: string;
106
+ };
107
+
43
108
  export declare const WEB_PLAYER_ICON_WC_TAG = "cc-webplayer-icon";
44
109
 
45
110
  export declare const WEB_PLAYER_WC_TAG = "cc-webplayer";
@@ -62,7 +127,7 @@ export declare const webPlayerIconPropsToAttributes: (props: WebPlayerIconProps_
62
127
 
63
128
  export declare type WebPlayerProps = {
64
129
  compositionUrl: string;
65
- flatten?: boolean;
130
+ hideCategories?: boolean;
66
131
  infiniteCarrousel?: boolean;
67
132
  permanentGallery?: boolean;
68
133
  imageLoadStrategy?: ImageLoadStrategy;
@@ -75,7 +140,7 @@ export declare type WebPlayerProps = {
75
140
 
76
141
  declare type WebPlayerProps_2 = {
77
142
  compositionUrl: string;
78
- flatten?: boolean;
143
+ hideCategories?: boolean;
79
144
  infiniteCarrousel?: boolean;
80
145
  permanentGallery?: boolean;
81
146
  imageLoadStrategy?: ImageLoadStrategy_2;