@vouchfor/embeds 0.0.0-experiment.912c9c8 → 0.0.0-experiment.9821b79

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ type EmbedHost = ReactiveControllerHost & Embed;
4
4
  declare class FetcherController {
5
5
  host: EmbedHost;
6
6
  private _fetching;
7
+ private _vouch;
7
8
  set fetching(value: boolean);
8
9
  get fetching(): boolean;
9
10
  private getVouch;
@@ -1,28 +1,36 @@
1
- import type { Embed } from '..';
1
+ import type { Embed } from '../..';
2
2
  import type { ReactiveController, ReactiveControllerHost } from 'lit';
3
3
  type EmbedHost = ReactiveControllerHost & Embed;
4
+ type TrackingEvent = 'VOUCH_LOADED' | 'VOUCH_RESPONSE_VIEWED' | 'VIDEO_PLAYED' | 'VIDEO_STREAMED';
5
+ type TrackingPayload = {
6
+ vouchId?: string;
7
+ answerId?: string;
8
+ streamStart?: number;
9
+ streamEnd?: number;
10
+ };
4
11
  declare class TrackingController implements ReactiveController {
5
12
  host: EmbedHost;
6
- private _tabId;
7
- private _clientId;
8
- private _visitorId;
13
+ private _batchedEvents;
9
14
  private _hasPlayed;
10
15
  private _hasLoaded;
11
16
  private _answersViewed;
12
- private _streamedTime;
13
- private _streamedPrevTimestamp;
17
+ private _streamStartTime;
18
+ private _streamLatestTime;
19
+ private _currentlyPlayingVideo;
14
20
  constructor(host: EmbedHost);
15
- private _findVouchId;
16
- private _createVisitor;
17
- private _getUids;
18
- private _getReportingMetadata;
21
+ private _createTrackingEvent;
19
22
  private _sendTrackingEvent;
23
+ private _streamEnded;
20
24
  private _handleVouchLoaded;
21
25
  private _handlePlay;
22
26
  private _handleVideoPlay;
23
27
  private _handleVideoTimeUpdate;
24
28
  private _handleVideoPause;
29
+ private _pageUnloading;
30
+ private _handleVisibilityChange;
31
+ private _handlePageHide;
25
32
  hostConnected(): void;
26
33
  hostDisconnected(): void;
27
34
  }
28
35
  export { TrackingController };
36
+ export type { TrackingEvent, TrackingPayload };
@@ -0,0 +1,17 @@
1
+ import type { TrackingPayload } from '.';
2
+ import type { Vouch } from '@vouchfor/media-player';
3
+ import type { Environment } from '../../../../utils/env';
4
+ declare function getUids(env: Environment): {
5
+ client: null;
6
+ tab: null;
7
+ request: string;
8
+ visitor?: undefined;
9
+ } | {
10
+ client: string;
11
+ tab: string;
12
+ request: string;
13
+ visitor: string;
14
+ };
15
+ declare function findVouchId(payload?: TrackingPayload, vouch?: Vouch): string | null | undefined;
16
+ declare function getReportingMetadata(source?: string): any;
17
+ export { getUids, findVouchId, getReportingMetadata };
@@ -1,21 +1,26 @@
1
1
  import { LitElement } from 'lit';
2
- import type { Scene, TemplateInstance } from '@vouchfor/canvas-video';
2
+ import type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';
3
3
  import type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';
4
4
  import type { Environment } from '../../utils/env';
5
5
  type EmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {
6
6
  env: Environment;
7
7
  apiKey: string;
8
+ disableTracking?: boolean;
8
9
  trackingSource?: string;
9
10
  vouchId?: string;
10
11
  templateId?: string;
12
+ questions?: number[];
11
13
  };
12
14
  declare class Embed extends LitElement {
15
+ static styles: import("lit").CSSResult[];
13
16
  private _mediaPlayerRef;
14
17
  data: EmbedProps['data'];
15
18
  vouchId: EmbedProps['vouchId'];
16
19
  templateId: EmbedProps['templateId'];
20
+ questions: EmbedProps['questions'];
17
21
  env: EmbedProps['env'];
18
22
  apiKey: EmbedProps['apiKey'];
23
+ disableTracking: EmbedProps['disableTracking'];
19
24
  trackingSource: EmbedProps['trackingSource'];
20
25
  controls: EmbedProps['controls'];
21
26
  preload: EmbedProps['preload'];
@@ -43,11 +48,13 @@ declare class Embed extends LitElement {
43
48
  get muted(): boolean;
44
49
  get scene(): Scene | null;
45
50
  get scenes(): Scene[];
51
+ get sceneConfig(): Scenes | null;
46
52
  get videoState(): import("@vouchfor/media-player/dist/src/components/MediaPlayer/controllers/scenes").VideoStateMap | undefined;
47
53
  get mediaPlayer(): MediaPlayer | undefined;
48
54
  play(): void;
49
55
  pause(): void;
50
56
  setScene(index: number): void;
57
+ private _renderStyles;
51
58
  render(): import("lit").TemplateResult<1>;
52
59
  }
53
60
  declare global {
@@ -0,0 +1,3 @@
1
+ import type { Vouch } from '@vouchfor/media-player';
2
+ declare const data: Vouch;
3
+ export { data };