@devix-technologies/react-gjirafa-vp-player 1.0.10 → 1.0.12

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 (40) hide show
  1. package/dist/react-gjirafa-vp-player.es.js +196 -201
  2. package/dist/react-gjirafa-vp-player.umd.js +5 -5
  3. package/package.json +1 -1
  4. package/dist/App.d.ts +0 -2
  5. package/dist/components/Feedback.d.ts +0 -25
  6. package/dist/components/VPPlayer/index.d.ts +0 -2
  7. package/dist/components/VPPlayer/ui/index.d.ts +0 -1
  8. package/dist/components/VPPlayer/ui/styled.d.ts +0 -42
  9. package/dist/config/index.d.ts +0 -1
  10. package/dist/config/vpPlayerConfig.d.ts +0 -9
  11. package/dist/constants/configs.d.ts +0 -22
  12. package/dist/constants/index.d.ts +0 -1
  13. package/dist/constants/storybook.d.ts +0 -11
  14. package/dist/constants/styles.d.ts +0 -11
  15. package/dist/constants/urls.d.ts +0 -18
  16. package/dist/constants/vpPlayer.d.ts +0 -29
  17. package/dist/contexts/VPPlayerContext.d.ts +0 -53
  18. package/dist/contexts/index.d.ts +0 -1
  19. package/dist/features/VPPlayer.d.ts +0 -27
  20. package/dist/features/stories/ads/Ads.stories.d.ts +0 -20
  21. package/dist/features/stories/context/Context.stories.d.ts +0 -10
  22. package/dist/features/stories/index.d.ts +0 -3
  23. package/dist/features/stories/playback/Playback.stories.d.ts +0 -33
  24. package/dist/fixtures/index.d.ts +0 -1
  25. package/dist/fixtures/playlist.d.ts +0 -11
  26. package/dist/hooks/index.d.ts +0 -3
  27. package/dist/hooks/useVPPlayerLogic.d.ts +0 -22
  28. package/dist/hooks/useVPPlayerScript.d.ts +0 -13
  29. package/dist/hooks/useVideoData.d.ts +0 -21
  30. package/dist/index.d.ts +0 -9
  31. package/dist/interfaces/config.d.ts +0 -311
  32. package/dist/interfaces/index.d.ts +0 -3
  33. package/dist/interfaces/instance.d.ts +0 -73
  34. package/dist/interfaces/props.d.ts +0 -54
  35. package/dist/main.d.ts +0 -1
  36. package/dist/types/api.types.d.ts +0 -50
  37. package/dist/types/index.d.ts +0 -1
  38. package/dist/utils/index.d.ts +0 -2
  39. package/dist/utils/vpPlayerConfigBuilder.d.ts +0 -30
  40. package/dist/utils/vpPlayerUtils.d.ts +0 -8
@@ -1,3 +0,0 @@
1
- export { useVPPlayerScript } from './useVPPlayerScript';
2
- export { useVideoData } from './useVideoData';
3
- export { useVPPlayerLogic } from './useVPPlayerLogic';
@@ -1,22 +0,0 @@
1
- import { VPPlayerInstance, VPPlayerProps } from "@/interfaces";
2
- declare global {
3
- interface Window {
4
- vpPlayer?: (playerId: string) => VPPlayerInstance | undefined;
5
- vpVerticalPlayer?: (playerId: string) => VPPlayerInstance | undefined;
6
- }
7
- }
8
- /**
9
- * Custom hook to manage VP Player logic, including fetching video data,
10
- * initializing the player, and handling lifecycle events.
11
- *
12
- * @function
13
- * @param {VPPlayerProps} props - The properties required to configure the VP Player.
14
- * @returns {Object} An object containing player references, script loading status, loading state, and errors.
15
- */
16
- export declare const useVPPlayerLogic: ({ playerId, videoId: propVideoId, version, videoUrl, projectId, playlistId, scriptUrl, config, apiKey, isReels, }: VPPlayerProps) => {
17
- playerRef: import("react").RefObject<HTMLDivElement | null>;
18
- playerInstanceRef: import("react").RefObject<VPPlayerInstance | null>;
19
- isScriptLoaded: boolean;
20
- isLoading: boolean;
21
- error: string | null;
22
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * Custom hook to dynamically load the VP Player script into the document.
3
- * It ensures that the script is only loaded once and provides a loading state.
4
- *
5
- * @function
6
- * @param {string | null} [version] - The version of the VP Player script to load (defaults to "latest").
7
- * @param {string} [scriptUrl] - Custom script URL (if provided, it overrides the version-based URL).
8
- * @returns {{ isLoaded: boolean; error: string | null }} Indicates load success and any error message.
9
- */
10
- export declare const useVPPlayerScript: (version?: string | null, scriptUrl?: string) => {
11
- isLoaded: boolean;
12
- error: string | null;
13
- };
@@ -1,21 +0,0 @@
1
- import { VideoDataResult } from "@/types";
2
- /**
3
- * Custom hook for fetching video data, including playback URLs and playlists.
4
- * Supports retry logic, timeout, error handling, and in-memory caching.
5
- *
6
- * @function
7
- * @param {Object} params - The parameters for fetching video data.
8
- * @param {string} [params.projectId] - The project ID required for API calls.
9
- * @param {string} [params.videoId] - The video ID to fetch a single video's playback URL.
10
- * @param {string} [params.playlistId] - The playlist ID to fetch a list of videos.
11
- * @param {string} [params.videoUrl] - The direct video URL (skips API call if provided).
12
- * @param {string} [params.apiKey] - The API key for authentication (optional, defaults to environment variable).
13
- * @returns {VideoDataResult} - Result object with URL, playlist, loading and error states
14
- */
15
- export declare const useVideoData: ({ projectId, videoId, playlistId, videoUrl, apiKey, }: {
16
- projectId?: string;
17
- videoId?: string;
18
- playlistId?: string;
19
- videoUrl?: string;
20
- apiKey?: string;
21
- }) => VideoDataResult;
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export { default as VPPlayer } from './features/VPPlayer';
2
- export * from './components/VPPlayer/ui';
3
- export { VPPlayerProvider, useVPPlayer } from './contexts/VPPlayerContext';
4
- export * from './hooks';
5
- export * from './interfaces';
6
- export * from './types';
7
- export * from './utils';
8
- export * from './constants/configs';
9
- export * from './constants/urls';
@@ -1,311 +0,0 @@
1
- /**
2
- * Interface describing the advertising configuration options for the VP Player.
3
- *
4
- * @interface
5
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/advertising}
6
- */
7
- export interface VPPlayerAdsConfig {
8
- skipAd?: {
9
- state: boolean;
10
- skipFrom: number;
11
- };
12
- vmap?: string;
13
- VPAIDmode?: string;
14
- enableProgrammability?: boolean;
15
- functions?: Array<{
16
- isDynamicKey: boolean;
17
- isDynamicValue: boolean;
18
- key: string;
19
- order: number;
20
- value: string;
21
- }>;
22
- bidding?: boolean;
23
- afterMidrollBacktrack?: {
24
- state: boolean;
25
- seconds: number;
26
- };
27
- adBreaks?: Array<{
28
- adTagUrl: string[];
29
- breakType?: 'preroll' | 'midroll' | 'postroll';
30
- breakTimingType?: 'time' | 'percentage' | 'playlist';
31
- breakTimingValue?: number;
32
- schedule?: {
33
- type?: 'CUSTOM' | 'RECURRING';
34
- ranges?: Array<{
35
- startTime?: number;
36
- endTime?: number;
37
- count?: number;
38
- breaks?: number[];
39
- }>;
40
- algorithm?: 'PASSIVE' | 'AGGRESSIVE' | 'SIMILAR_DISTANCE' | 'CUSTOM';
41
- protectFirst?: number;
42
- protectLast?: number;
43
- occurEvery?: number;
44
- liveCount?: number;
45
- };
46
- }>;
47
- bidders?: Array<{
48
- name: string;
49
- params?: Array<{
50
- paramName?: string;
51
- paramType?: string;
52
- paramValue?: string;
53
- }>;
54
- }>;
55
- adsRequireInteraction?: boolean;
56
- }
57
- /**
58
- * Interface defining the configuration options for the VP Player.
59
- *
60
- * @interface
61
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/configuration}
62
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/playing}
63
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/advertising}
64
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/styling}
65
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/localization}
66
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/full-configuration}
67
- */
68
- export interface VPPlayerConfig {
69
- projectId?: string;
70
- video: {
71
- ads?: VPPlayerAdsConfig;
72
- advertising?: boolean;
73
- file?: string;
74
- title?: string;
75
- description?: string;
76
- publishDate?: string;
77
- duration?: number;
78
- thumbnail?: string;
79
- filmstrip?: string;
80
- author?: string;
81
- source?: string;
82
- tags?: string[];
83
- tracks?: Array<{
84
- file: string;
85
- label: string;
86
- kind: string;
87
- default?: boolean;
88
- }>;
89
- playlist?: {
90
- state: boolean;
91
- playlistVideoIndex: number;
92
- videos: Array<{
93
- videoId: string;
94
- title: string;
95
- thumbnailUrl?: string;
96
- duration?: number;
97
- file?: string;
98
- }>;
99
- };
100
- };
101
- config: {
102
- adAnnouncement?: {
103
- state?: boolean;
104
- timeBeforeAd?: number;
105
- };
106
- autostartOnLoad?: {
107
- state?: boolean;
108
- onMobile?: boolean;
109
- onData?: boolean;
110
- };
111
- adsRequireInteraction?: boolean;
112
- autoplay?: boolean;
113
- pauseOtherVideos?: boolean;
114
- focusOnAutostart?: boolean;
115
- muted?: boolean;
116
- loop?: boolean;
117
- size?: {
118
- sizeType?: string;
119
- aspectRatio?: string;
120
- width?: number | string;
121
- height?: number | string;
122
- };
123
- showRelatedOnPause?: {
124
- state?: boolean;
125
- onMobile?: boolean;
126
- from?: number;
127
- };
128
- float?: {
129
- state: boolean;
130
- onMobile: boolean;
131
- position: string;
132
- dismissible: boolean;
133
- requiresInteraction: boolean;
134
- toVideoThreshold: number;
135
- toFloatThreshold: number;
136
- style: {
137
- width: number;
138
- border: string;
139
- };
140
- };
141
- controls?: {
142
- theaterButton?: boolean;
143
- settingsButton?: boolean;
144
- chromecastButton?: boolean;
145
- nextButton?: boolean;
146
- fullscreenButton?: boolean;
147
- airplayButton?: boolean;
148
- bigPlayButton?: boolean;
149
- autopausePlayButton?: boolean;
150
- pictureInPictureButton?: boolean;
151
- relatedButton?: boolean;
152
- volumeButton?: boolean;
153
- shareButton?: boolean;
154
- subtitlesButton?: boolean;
155
- showCaptions?: boolean;
156
- };
157
- logo?: {
158
- state?: boolean;
159
- file?: string;
160
- position?: string;
161
- defaultOpacity?: number;
162
- inactiveOpacity?: number;
163
- onClickURL?: string;
164
- };
165
- skin?: {
166
- controlBar?: {
167
- background?: string;
168
- spread?: "solid" | "gradient";
169
- gradientMidPoint?: number;
170
- text?: string;
171
- icons?: {
172
- default?: string;
173
- hover?: string;
174
- };
175
- timeslider?: {
176
- progress?: string;
177
- rail?: string;
178
- buffer?: string;
179
- dragger?: string;
180
- };
181
- timesliderOnAd?: {
182
- progress?: string;
183
- rail?: string;
184
- buffer?: string;
185
- dragger?: string;
186
- };
187
- volume?: {
188
- dragger?: string;
189
- progress?: string;
190
- rail?: string;
191
- notifier?: string;
192
- };
193
- };
194
- menus?: {
195
- background?: {
196
- default?: string;
197
- hover?: string;
198
- };
199
- links?: {
200
- default?: string;
201
- hover?: string;
202
- };
203
- autoplay?: {
204
- autoplayOn?: string;
205
- autoplayOff?: string;
206
- };
207
- };
208
- nextVideo?: {
209
- background?: string;
210
- text?: string;
211
- timeslider?: {
212
- rail?: string;
213
- progress?: string;
214
- };
215
- icons?: {
216
- play?: {
217
- default?: string;
218
- hover?: string;
219
- };
220
- close?: string;
221
- };
222
- };
223
- playlist?: {
224
- background?: string;
225
- text?: string;
226
- icons?: {
227
- arrows?: {
228
- active?: string;
229
- inactive?: string;
230
- };
231
- close?: string;
232
- };
233
- card?: {
234
- background?: string;
235
- title?: string;
236
- duration?: {
237
- text?: string;
238
- background?: string;
239
- };
240
- icons?: {
241
- play?: {
242
- default?: string;
243
- hover?: string;
244
- };
245
- };
246
- };
247
- };
248
- };
249
- lang?: {
250
- locale?: string;
251
- controls?: {
252
- play?: string;
253
- pause?: string;
254
- next?: string;
255
- replay?: string;
256
- volume?: string;
257
- mute?: string;
258
- unmute?: string;
259
- settings?: string;
260
- theater?: string;
261
- fullscreen?: string;
262
- chromecast?: string;
263
- airplay?: string;
264
- pictureInPicture?: string;
265
- related?: string;
266
- skipIntro?: string;
267
- skipAd?: string;
268
- playlistTitle?: string;
269
- upNext?: string;
270
- live?: string;
271
- continueAfterPause?: string;
272
- };
273
- settings?: {
274
- quality?: string;
275
- subtitles?: string;
276
- autoplay?: string;
277
- playbackRate?: string;
278
- auto?: string;
279
- off?: string;
280
- normal?: string;
281
- share?: string;
282
- };
283
- ads?: {
284
- ad?: string;
285
- skip?: string;
286
- skipIn?: string;
287
- visit?: string;
288
- info?: string;
289
- simultaneousAds?: string;
290
- adAnnouncement?: string;
291
- };
292
- messages?: {
293
- playbackErrorTitle?: string;
294
- playbackErrorDescription?: string;
295
- geoBlockedTitle?: string;
296
- geoBlockedDescription?: string;
297
- streamInterruptedTitle?: string;
298
- streamInterruptedDescription?: string;
299
- };
300
- };
301
- ads?: VPPlayerAdsConfig;
302
- };
303
- }
304
- /**
305
- * Default configuration object for the VP Player.
306
- *
307
- * @constant
308
- * @type {VPPlayerConfig}
309
- * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/configuration}
310
- */
311
- export declare const defaultVPPlayerConfig: VPPlayerConfig;
@@ -1,3 +0,0 @@
1
- export * from "./props";
2
- export * from "./instance";
3
- export * from "./config";
@@ -1,73 +0,0 @@
1
- import { VPPlayerConfig } from "./config";
2
- /**
3
- * Interface representing an instance of the VP Player.
4
- * Based on VP Player API Reference: https://vp.gjirafa.tech/documentation/docs/web-player/api-reference
5
- * And VP Vertical Player API Reference: https://vp.gjirafa.tech/documentation/docs/vertical-player/api-reference
6
- *
7
- * @interface
8
- */
9
- export interface VPPlayerInstance {
10
- setup: (config: VPPlayerConfig) => void;
11
- destroy?: () => void;
12
- play?: () => void;
13
- pause?: () => void;
14
- forward?: () => void;
15
- rewind?: () => void;
16
- replay?: () => void;
17
- seek?: (position: number) => void;
18
- mute?: () => void;
19
- unmute?: () => void;
20
- enterFullScreen?: () => void;
21
- exitFullScreen?: () => void;
22
- enterFullscreen?: () => void;
23
- exitFullscreen?: () => void;
24
- enterPictureInPicture?: () => void;
25
- exitPictureInPicture?: () => void;
26
- floating?: () => void;
27
- isFloating?: () => boolean;
28
- getFloatStyle?: () => unknown;
29
- setFloatingHlsLevels?: (levels: unknown) => void;
30
- floatingStateCounter?: number;
31
- nextVideo?: () => void;
32
- previousVideo?: () => void;
33
- switchToIndex?: (index: number) => void;
34
- switch?: (video: unknown) => void;
35
- playNewVideo?: (video: unknown) => void;
36
- togglePlay?: () => void;
37
- toggleMute?: () => void;
38
- isMuted?: () => boolean;
39
- isPlaying?: () => boolean;
40
- isPaused?: () => boolean;
41
- isFullscreen?: () => boolean;
42
- isEnded?: () => boolean;
43
- isFocused?: () => boolean;
44
- getPosition?: () => number;
45
- getBuffered?: () => number;
46
- getVolume?: () => number;
47
- getContainer?: () => HTMLElement;
48
- getDuration?: () => number;
49
- getQualityLevels?: () => unknown[];
50
- getCurrentQuality?: () => number;
51
- checkViewability?: () => boolean;
52
- setConfig?: (config: unknown) => void;
53
- setVideo?: (video: unknown) => void;
54
- setPlaylist?: (playlist: unknown) => void;
55
- setVolume?: (volume: number) => void;
56
- setCurrentQuality?: (index: number) => void;
57
- setLevelToAuto?: () => void;
58
- setCuePoint?: (cue: number, callback: () => void) => void;
59
- on?: (event: string, callback: (data?: unknown) => void) => void;
60
- off?: (event: string, callback?: (data?: unknown) => void) => void;
61
- videoIndex?: number;
62
- playlist?: {
63
- state: boolean;
64
- playlistId: string;
65
- playlistVideoIndex: number;
66
- videos: unknown[];
67
- };
68
- multipleVideos?: Map<number, unknown>;
69
- firstInList?: boolean;
70
- lastInList?: boolean;
71
- setupComplete?: boolean;
72
- initialized?: boolean;
73
- }
@@ -1,54 +0,0 @@
1
- import { VPPlayerConfig } from "./config";
2
- /**
3
- * Interface defining the parameters for configuring the VP Player instance.
4
- *
5
- * @interface
6
- */
7
- export interface PlayerParams {
8
- playerId?: string;
9
- videoId?: string;
10
- projectId?: string;
11
- videoUrl?: string;
12
- playlistId?: string;
13
- scriptUrl?: string;
14
- version?: string | null;
15
- config?: Partial<VPPlayerConfig>;
16
- thumbnailUrl?: string;
17
- isReels?: boolean;
18
- hiddenClasses?: string[];
19
- apiKey?: string;
20
- className?: string;
21
- }
22
- /**
23
- * Interface for the VP Player context, providing methods and state for controlling the player.
24
- *
25
- * @interface
26
- */
27
- export interface VPPlayerContextType {
28
- showPlayer: (params: PlayerParams) => void;
29
- hidePlayer: () => void;
30
- isPlayerVisible: boolean;
31
- playerParams: PlayerParams | null;
32
- }
33
- /**
34
- * Interface defining the properties for the VP Player component.
35
- *
36
- * @interface
37
- */
38
- export interface VPPlayerProps {
39
- playerId: string;
40
- videoId?: string;
41
- projectId?: string;
42
- videoUrl?: string;
43
- playlistId?: string;
44
- scriptUrl?: string;
45
- version?: string | null;
46
- config?: Partial<VPPlayerConfig>;
47
- isReels?: boolean;
48
- thumbnailUrl?: string;
49
- onClose?: () => void;
50
- hiddenClasses?: string[];
51
- apiKey?: string;
52
- isPlayerVisible?: boolean;
53
- className?: string;
54
- }
package/dist/main.d.ts DELETED
@@ -1 +0,0 @@
1
- import "./index.css";
@@ -1,50 +0,0 @@
1
- /**
2
- * API response types for VP Player.
3
- *
4
- * @interface VideoApiItem
5
- * Represents an individual video item in the API response.
6
- */
7
- export interface VideoApiItem {
8
- mediaId: string;
9
- playbackUrl: string;
10
- }
11
- /**
12
- * API response structure for fetching video data.
13
- *
14
- * @interface VideoApiResponse
15
- */
16
- export interface VideoApiResponse {
17
- result: {
18
- items: VideoApiItem[];
19
- };
20
- }
21
- /**
22
- * Represents an item in a video playlist.
23
- *
24
- * @interface PlaylistItem
25
- */
26
- export interface PlaylistItem {
27
- title: string;
28
- hlsUrl: string;
29
- thumbnailUrl: string;
30
- duration: number;
31
- }
32
- /**
33
- * API response structure for fetching playlist data.
34
- *
35
- * @interface PlaylistApiResponse
36
- */
37
- export interface PlaylistApiResponse {
38
- result: PlaylistItem[];
39
- }
40
- /**
41
- * Result structure returned by the video data fetching logic.
42
- *
43
- * @interface VideoDataResult
44
- */
45
- export interface VideoDataResult {
46
- fetchedPlaybackUrl: string | null;
47
- fetchedPlaylist: PlaylistItem[] | null;
48
- isLoading: boolean;
49
- error: string | null;
50
- }
@@ -1 +0,0 @@
1
- export * from "./api.types";
@@ -1,2 +0,0 @@
1
- export * from "./vpPlayerConfigBuilder";
2
- export * from "./vpPlayerUtils";
@@ -1,30 +0,0 @@
1
- import { VPPlayerConfig } from "@/interfaces";
2
- import { PlaylistItem } from "@/types";
3
- /**
4
- * Interface for options used in building the VP Player configuration.
5
- *
6
- * @interface ConfigBuilderOptions
7
- */
8
- interface ConfigBuilderOptions {
9
- videoUrl?: string;
10
- fetchedPlaybackUrl?: string;
11
- fetchedPlaylist?: PlaylistItem[];
12
- projectId?: string;
13
- config?: Partial<VPPlayerConfig>;
14
- isVerticalPlayer?: boolean;
15
- }
16
- /**
17
- * Builds the final VP Player configuration based on available data.
18
- * Handles different data sources in priority order:
19
- * 1. Direct video URL
20
- * 2. Single video from API
21
- * 3. Playlist from API
22
- * 4. Playlist from config
23
- *
24
- * @function
25
- * @param {ConfigBuilderOptions} options - Options for building the configuration
26
- * @returns {VPPlayerConfig} - The final configuration object for the player
27
- * @throws {Error} - Throws error if no valid video source is found
28
- */
29
- export declare const buildVPPlayerConfig: ({ videoUrl, fetchedPlaybackUrl, fetchedPlaylist, projectId, config, isVerticalPlayer, }: ConfigBuilderOptions) => VPPlayerConfig;
30
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * Extracts the video ID from a given VP Player script URL.
3
- *
4
- * @function
5
- * @param {string} [scriptUrl] - The script URL containing the video ID.
6
- * @returns {string | undefined} The extracted video ID, or `undefined` if not found.
7
- */
8
- export declare const extractVideoId: (scriptUrl?: string) => string | undefined;