@playkit-js/transcript 3.5.10 → 3.5.11-canary.0-d04edb6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/transcript",
3
- "version": "3.5.10",
3
+ "version": "3.5.11-canary.0-d04edb6",
4
4
  "main": "dist/playkit-transcript.js",
5
5
  "license": "AGPL-3.0",
6
6
  "private": false,
@@ -12,7 +12,7 @@ import {TranscriptMenu} from '../transcript-menu';
12
12
  import {SmallScreenSlate} from '../small-screen-slate';
13
13
  import {Button, ButtonType, ButtonSize} from '@playkit-js/common/dist/components/button';
14
14
  import {OnClickEvent, OnClick} from '@playkit-js/common/dist/hoc/a11y-wrapper';
15
- import { TranscriptEvents } from "../../events";
15
+ import {TranscriptEvents} from '../../events/events';
16
16
 
17
17
  const {ENTER, SPACE, TAB} = ui.utils.KeyMap;
18
18
  const {withText, Text} = ui.preacti18n;
@@ -21,6 +21,8 @@ const {SidePanelModes} = ui;
21
21
  const {PLAYER_BREAK_POINTS} = ui.Components;
22
22
  const {connect} = ui.redux;
23
23
 
24
+ const SEARCH_EVENT_DISPATCH_TIMEOUT = 2000;
25
+
24
26
  const translates = {
25
27
  skipTranscript: <Text id="transcript.skip_transcript">Skip transcript</Text>,
26
28
  errorTitle: <Text id="transcript.whoops">Whoops!</Text>,
@@ -170,7 +172,7 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
170
172
  searchMap[caption.id] = {...searchMap[caption.id], [index]: i};
171
173
  });
172
174
  });
173
- this.props.dispatcher(TranscriptEvents.TRANSCRIPT_SEARCH, {search: state.search});
175
+ this._debounced.searchEventDispatcher(state);
174
176
  return {
175
177
  searchMap,
176
178
  totalSearchResults: index,
@@ -180,6 +182,10 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
180
182
  });
181
183
  };
182
184
 
185
+ private _dispatchSearchEvent = (state: TranscriptState) => {
186
+ this.props.dispatcher(TranscriptEvents.TRANSCRIPT_SEARCH, {search: this.state.search});
187
+ }
188
+
183
189
  private _setActiveSearchIndex = (index: number) => {
184
190
  this._scrollToSearchMatchEnabled = true;
185
191
  this.setState({
@@ -373,7 +379,8 @@ export class Transcript extends Component<TranscriptProps, TranscriptState> {
373
379
 
374
380
  private _debounced = {
375
381
  findSearchMatches: debounce(this._findSearchMatches, this.props.searchDebounceTimeout),
376
- onActiveSearchIndexChange: debounce(this._setActiveSearchIndex, this.props.searchNextPrevDebounceTimeout)
382
+ onActiveSearchIndexChange: debounce(this._setActiveSearchIndex, this.props.searchNextPrevDebounceTimeout),
383
+ searchEventDispatcher: debounce(this._dispatchSearchEvent, SEARCH_EVENT_DISPATCH_TIMEOUT)
377
384
  };
378
385
 
379
386
  render(props: TranscriptProps) {
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { pluginName, TranscriptPlugin } from "./transcript-plugin";
1
+ import {pluginName, TranscriptPlugin} from './transcript-plugin';
2
2
 
3
3
  declare var __VERSION__: string;
4
4
  declare var __NAME__: string;
@@ -6,7 +6,7 @@ declare var __NAME__: string;
6
6
  const VERSION = __VERSION__;
7
7
  const NAME = __NAME__;
8
8
 
9
- export { TranscriptEvents} from './events'
9
+ export {TranscriptEvents} from './events/events';
10
10
  export {TranscriptPlugin as Plugin};
11
11
  export {VERSION, NAME};
12
12
 
@@ -9,7 +9,7 @@ import {PluginButton} from './components/plugin-button/plugin-button';
9
9
  import {Transcript} from './components/transcript';
10
10
  import {getConfigValue, isBoolean, makePlainText, prepareCuePoint} from './utils';
11
11
  import {TranscriptConfig, PluginStates, HighlightedMap, CuePointData, ItemTypes, CuePoint} from './types';
12
- import { TranscriptEvents } from "./events";
12
+ import {TranscriptEvents} from './events/events';
13
13
 
14
14
  export const pluginName: string = 'playkit-js-transcript';
15
15
 
@@ -1 +0,0 @@
1
- export {TranscriptEvents} from './events';