@jaaq/jaaq-sdk-js 1.0.1 → 1.1.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.
Files changed (41) hide show
  1. package/README.md +733 -92
  2. package/dist/embed/embed-collection.html +275 -0
  3. package/dist/embed/embed.html +270 -0
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/jaaq-sdk.min.js.map +1 -1
  7. package/dist/ui/index.cjs +5051 -0
  8. package/dist/ui/index.cjs.map +1 -0
  9. package/dist/ui/index.d.ts +378 -0
  10. package/dist/ui/index.mjs +5044 -0
  11. package/dist/ui/index.mjs.map +1 -0
  12. package/dist/ui/jaaq-ui-bundled.min.js +8 -0
  13. package/dist/ui/jaaq-ui-bundled.min.js.map +1 -0
  14. package/dist/ui/jaaq-ui.min.js +8 -0
  15. package/dist/ui/jaaq-ui.min.js.map +1 -0
  16. package/dist/ui/react/index.cjs +4756 -0
  17. package/dist/ui/react/index.cjs.map +1 -0
  18. package/dist/ui/react/index.d.ts +182 -0
  19. package/dist/ui/react/index.mjs +4735 -0
  20. package/dist/ui/react/index.mjs.map +1 -0
  21. package/dist/ui/react/jaaq-ui-react.min.js +8 -0
  22. package/dist/ui/react/jaaq-ui-react.min.js.map +1 -0
  23. package/dist/ui/vanilla/index.cjs +5052 -0
  24. package/dist/ui/vanilla/index.cjs.map +1 -0
  25. package/dist/ui/vanilla/index.d.ts +465 -0
  26. package/dist/ui/vanilla/index.mjs +5044 -0
  27. package/dist/ui/vanilla/index.mjs.map +1 -0
  28. package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js +8 -0
  29. package/dist/ui/vanilla/jaaq-vanilla-bundled.min.js.map +1 -0
  30. package/dist/ui/vanilla/jaaq-vanilla.min.js +8 -0
  31. package/dist/ui/vanilla/jaaq-vanilla.min.js.map +1 -0
  32. package/dist/ui/webcomponents/index.cjs +4619 -0
  33. package/dist/ui/webcomponents/index.cjs.map +1 -0
  34. package/dist/ui/webcomponents/index.d.ts +288 -0
  35. package/dist/ui/webcomponents/index.mjs +4614 -0
  36. package/dist/ui/webcomponents/index.mjs.map +1 -0
  37. package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js +8 -0
  38. package/dist/ui/webcomponents/jaaq-webcomponents-bundled.min.js.map +1 -0
  39. package/dist/ui/webcomponents/jaaq-webcomponents.min.js +8 -0
  40. package/dist/ui/webcomponents/jaaq-webcomponents.min.js.map +1 -0
  41. package/package.json +42 -2
@@ -0,0 +1,182 @@
1
+ import * as React from 'react';
2
+
3
+ type VideoDTO = {
4
+ id: string;
5
+ videoId: string;
6
+ question: string;
7
+ status: number;
8
+ transcription: string;
9
+ subtitle: string;
10
+ createdAt: string;
11
+ videoUrl: string;
12
+ published: boolean;
13
+ tags: string[];
14
+ severity: number | null;
15
+ duration: number;
16
+ description: string;
17
+ };
18
+
19
+ type CollectionDTO = {
20
+ id: string;
21
+ name: string;
22
+ description: string;
23
+ imageUrl: string;
24
+ createdAt: string;
25
+ videos: VideoDTO[];
26
+ };
27
+
28
+ type FetchLike = typeof globalThis.fetch;
29
+ type RequestOptions = Parameters<typeof globalThis.fetch>[1];
30
+ interface HttpClient {
31
+ get<T>(_path: string, _init?: RequestOptions): Promise<T>;
32
+ post<T>(_path: string, _body?: unknown, _init?: RequestOptions): Promise<T>;
33
+ put<T>(_path: string, _body?: unknown, _init?: RequestOptions): Promise<T>;
34
+ patch<T>(_path: string, _body?: unknown, _init?: RequestOptions): Promise<T>;
35
+ delete<T>(_path: string, _init?: RequestOptions): Promise<T>;
36
+ }
37
+
38
+ type VideosResource = {
39
+ getById(_id: string): Promise<VideoDTO>;
40
+ };
41
+
42
+ type CollectionsResource = {
43
+ list(): Promise<CollectionDTO[]>;
44
+ getById(_id: string): Promise<CollectionDTO>;
45
+ };
46
+
47
+ interface SDKConfig {
48
+ baseUrl?: string;
49
+ apiKey: string;
50
+ clientId: string;
51
+ fetch?: FetchLike;
52
+ timeoutMs?: number;
53
+ }
54
+ declare class JaaqClient {
55
+ readonly videos: VideosResource;
56
+ readonly collections: CollectionsResource;
57
+ private constructor();
58
+ /**
59
+ * Public "friend" constructor that remains inside the class boundary.
60
+ * This method is callable from the module-level build function
61
+ * without exposing `new JaaqClient(...)` to consumers.
62
+ */
63
+ static fromHttp(http: HttpClient): JaaqClient;
64
+ /**
65
+ * OO-friendly static initializer.
66
+ * Delegates to the single source of truth: `buildClient`.
67
+ */
68
+ static init(config: SDKConfig): JaaqClient;
69
+ }
70
+
71
+ /**
72
+ * Configuration options for video player components
73
+ */
74
+ type PlayerConfig = {
75
+ /** Video ID to load */
76
+ videoId: string;
77
+ /** API key for authentication (required if no client provided) */
78
+ apiKey?: string;
79
+ /** Client ID for authentication (required if no client provided) */
80
+ clientId?: string;
81
+ /** Existing JaaqClient instance to use instead of creating a new one */
82
+ client?: JaaqClient;
83
+ /** Custom API base URL */
84
+ baseUrl?: string;
85
+ /** Whether to automatically start playback when video loads */
86
+ autoplay?: boolean;
87
+ /** Whether to show player controls */
88
+ controls?: boolean;
89
+ /** CSS width of the player container */
90
+ width?: string;
91
+ /** CSS height of the player container */
92
+ height?: string;
93
+ /** Additional CSS class name(s) to apply to the player */
94
+ className?: string;
95
+ /** Whether to show the JAAQ logo */
96
+ showLogo?: boolean;
97
+ /** Whether to show the video title */
98
+ showTitle?: boolean;
99
+ /** Whether to show the author name */
100
+ showAuthor?: boolean;
101
+ /** Whether to show the description */
102
+ showDescription?: boolean;
103
+ /** Whether to show captions button */
104
+ showCaptions?: boolean;
105
+ };
106
+ /**
107
+ * Current state of the video player
108
+ */
109
+ type PlayerState = {
110
+ /** Whether the video is currently playing */
111
+ isPlaying: boolean;
112
+ /** Current playback time in seconds */
113
+ currentTime: number;
114
+ /** Total video duration in seconds */
115
+ duration: number;
116
+ /** Current volume level (0-1) */
117
+ volume: number;
118
+ /** Whether the audio is muted */
119
+ isMuted: boolean;
120
+ /** Whether the player is in fullscreen mode */
121
+ isFullscreen: boolean;
122
+ /** Whether the video is currently loading */
123
+ isLoading: boolean;
124
+ /** Error message if an error occurred, null otherwise */
125
+ error: string | null;
126
+ /** Loaded video data, null if not yet loaded */
127
+ videoData: VideoDTO | null;
128
+ /** Whether captions are currently enabled */
129
+ captionsEnabled: boolean;
130
+ };
131
+
132
+ type VideoPlayerHandle = {
133
+ play: () => void;
134
+ pause: () => void;
135
+ setVolume: (_volume: number) => void;
136
+ toggleMute: () => void;
137
+ seek: (_time: number) => void;
138
+ getState: () => PlayerState | null;
139
+ destroy: () => void;
140
+ };
141
+ declare const VideoPlayer: React.ForwardRefExoticComponent<PlayerConfig & {
142
+ onPlay?: () => void;
143
+ onPause?: () => void;
144
+ onError?: (_error: Error) => void;
145
+ onLoaded?: (_video: VideoDTO) => void;
146
+ onTimeUpdate?: (_time: number) => void;
147
+ onVolumeChange?: (_volume: number) => void;
148
+ onEnded?: () => void;
149
+ onFullscreenChange?: (_isFullscreen: boolean) => void;
150
+ showInfo?: boolean;
151
+ } & React.RefAttributes<VideoPlayerHandle>>;
152
+
153
+ type CollectionPlayerProps = {
154
+ collectionId: string;
155
+ apiKey?: string;
156
+ clientId?: string;
157
+ subscriptionId?: string;
158
+ client?: JaaqClient;
159
+ baseUrl?: string;
160
+ autoplay?: boolean;
161
+ showArrows?: boolean;
162
+ showDots?: boolean;
163
+ className?: string;
164
+ onLoaded?: (_collection: CollectionDTO) => void;
165
+ onError?: (_error: Error) => void;
166
+ onSlideChange?: (_data: {
167
+ index: number;
168
+ video: CollectionDTO['videos'][0];
169
+ }) => void;
170
+ };
171
+ type CollectionPlayerHandle = {
172
+ refresh: () => void;
173
+ next: () => void;
174
+ prev: () => void;
175
+ go: (_index: number) => void;
176
+ destroy: () => void;
177
+ getCollection: () => CollectionDTO | null;
178
+ };
179
+ declare const CollectionPlayer: React.ForwardRefExoticComponent<CollectionPlayerProps & React.RefAttributes<CollectionPlayerHandle>>;
180
+
181
+ export { CollectionPlayer, VideoPlayer };
182
+ export type { PlayerConfig, PlayerState };