@overlap.ai/react-video-subtitles 2.2.0 → 2.3.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/hooks/useRefreshSubtitlesComponent.d.ts +33 -0
- package/dist/hooks/useUpdatePersistentSubtitleConfig.d.ts +31 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +278 -116
- package/dist/index.js +278 -114
- package/dist/types/subtitles.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StyleConfig } from '../types/subtitles';
|
|
2
|
+
interface RefreshSubtitlesComponentParams {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
companyId: string;
|
|
5
|
+
clipId: string;
|
|
6
|
+
onConfigRefreshed?: (config: StyleConfig) => void;
|
|
7
|
+
}
|
|
8
|
+
interface RefreshSubtitlesComponentResult {
|
|
9
|
+
refresh: () => Promise<StyleConfig | null>;
|
|
10
|
+
isRefreshing: boolean;
|
|
11
|
+
lastRefreshedConfig: StyleConfig | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook to refresh subtitle configuration from the database
|
|
15
|
+
*
|
|
16
|
+
* @param params - Object containing apiKey, companyId, clipId, and optional onConfigRefreshed callback
|
|
17
|
+
* @returns Object with refresh function, isRefreshing state, and lastRefreshedConfig
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { refresh, isRefreshing, lastRefreshedConfig } = useRefreshSubtitlesComponent({
|
|
22
|
+
* apiKey: 'your-api-key',
|
|
23
|
+
* companyId: 'company123',
|
|
24
|
+
* clipId: 'clip456',
|
|
25
|
+
* onConfigRefreshed: (config) => console.log('Config refreshed:', config)
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Refresh subtitle config
|
|
29
|
+
* const newConfig = await refresh();
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const useRefreshSubtitlesComponent: ({ apiKey, companyId, clipId, onConfigRefreshed, }: RefreshSubtitlesComponentParams) => RefreshSubtitlesComponentResult;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { StyleConfig } from '../types/subtitles';
|
|
2
|
+
interface UpdatePersistentSubtitleConfigParams {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
companyId: string;
|
|
5
|
+
clipId: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook to update persistent subtitle configuration in the database
|
|
9
|
+
*
|
|
10
|
+
* @param params - Object containing apiKey, companyId, and clipId
|
|
11
|
+
* @returns Object with updateConfig function and isUpdating state
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const { updateConfig } = useUpdatePersistentSubtitleConfig({
|
|
16
|
+
* apiKey: 'your-api-key',
|
|
17
|
+
* companyId: 'company123',
|
|
18
|
+
* clipId: 'clip456'
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Update subtitle config
|
|
22
|
+
* await updateConfig({
|
|
23
|
+
* fontSize: 24,
|
|
24
|
+
* color: '#FF0000'
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const useUpdatePersistentSubtitleConfig: ({ apiKey, companyId, clipId, }: UpdatePersistentSubtitleConfigParams) => {
|
|
29
|
+
updateConfig: (subtitleConfig: Partial<StyleConfig>) => Promise<any>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ import { useStyleConfig } from './hooks/useStyleConfig';
|
|
|
4
4
|
import { useAdjustedPosition } from './hooks/useAdjustedPosition';
|
|
5
5
|
import { useAdjustedPhrases } from './hooks/useAdjustedPhrases';
|
|
6
6
|
import { useTextStyle } from './hooks/useTextStyle';
|
|
7
|
+
import { useUpdatePersistentSubtitleConfig } from './hooks/useUpdatePersistentSubtitleConfig';
|
|
8
|
+
import { useRefreshSubtitlesComponent } from './hooks/useRefreshSubtitlesComponent';
|
|
7
9
|
import { loadSubtitlePreset } from './utils/loadSubtitlePreset';
|
|
8
10
|
import type { StyleConfig, SubtitlesProps, Phrase, SegmentWord, SubtitleComponent, SubtitleTextProps } from './types';
|
|
9
|
-
export { Subtitles, SubtitleText, useStyleConfig, useAdjustedPosition, useAdjustedPhrases, useTextStyle, loadSubtitlePreset, };
|
|
11
|
+
export { Subtitles, SubtitleText, useStyleConfig, useAdjustedPosition, useAdjustedPhrases, useTextStyle, useUpdatePersistentSubtitleConfig, useRefreshSubtitlesComponent, loadSubtitlePreset, };
|
|
10
12
|
export type { StyleConfig, SubtitlesProps, Phrase, SegmentWord, SubtitleComponent, SubtitleTextProps, };
|