@vouchfor/embeds 0.0.0-experiment.93ea548 → 0.0.0-experiment.9821b79
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/browser-8d4ae80d.js +433 -0
- package/dist/es/browser-8d4ae80d.js.map +1 -0
- package/dist/es/embeds.js +7 -1521
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/index-74d4cefa.js +9980 -0
- package/dist/es/index-74d4cefa.js.map +1 -0
- package/dist/es/{components → src/components}/Embed/controllers/fetcher.d.ts +1 -0
- package/dist/es/{components/Embed/controllers/tracking.d.ts → src/components/Embed/controllers/tracking/index.d.ts} +17 -11
- package/dist/es/src/components/Embed/controllers/tracking/utils.d.ts +17 -0
- package/dist/es/{components → src/components}/Embed/index.d.ts +6 -1
- package/dist/es/src/components/Embed/tests/data.d.ts +3 -0
- package/dist/iife/embeds.iife.js +455 -313
- package/dist/iife/embeds.iife.js.map +1 -1
- package/package.json +6 -3
- package/src/components/Embed/Embed.stories.ts +15 -2
- package/src/components/Embed/controllers/fetcher.ts +27 -8
- package/src/components/Embed/controllers/tracking/index.ts +224 -0
- package/src/components/Embed/controllers/tracking/utils.ts +95 -0
- package/src/components/Embed/index.ts +47 -6
- package/src/components/Embed/tests/Embed.spec.ts +78 -0
- package/src/components/Embed/tests/data.ts +183 -0
- package/src/components/Embed/controllers/tracking.ts +0 -306
- /package/dist/es/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/es/{utils → src/utils}/env.d.ts +0 -0
- /package/dist/es/{utils → src/utils}/events.d.ts +0 -0
@@ -1,30 +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
|
7
|
-
private _clientId;
|
8
|
-
private _visitorId;
|
13
|
+
private _batchedEvents;
|
9
14
|
private _hasPlayed;
|
10
15
|
private _hasLoaded;
|
11
16
|
private _answersViewed;
|
12
|
-
private
|
17
|
+
private _streamStartTime;
|
13
18
|
private _streamLatestTime;
|
14
|
-
private
|
19
|
+
private _currentlyPlayingVideo;
|
15
20
|
constructor(host: EmbedHost);
|
16
|
-
private
|
17
|
-
private _createVisitor;
|
18
|
-
private _getUids;
|
19
|
-
private _getReportingMetadata;
|
21
|
+
private _createTrackingEvent;
|
20
22
|
private _sendTrackingEvent;
|
23
|
+
private _streamEnded;
|
21
24
|
private _handleVouchLoaded;
|
22
25
|
private _handlePlay;
|
23
26
|
private _handleVideoPlay;
|
24
|
-
private _handleVideoSeeking;
|
25
27
|
private _handleVideoTimeUpdate;
|
26
28
|
private _handleVideoPause;
|
29
|
+
private _pageUnloading;
|
30
|
+
private _handleVisibilityChange;
|
31
|
+
private _handlePageHide;
|
27
32
|
hostConnected(): void;
|
28
33
|
hostDisconnected(): void;
|
29
34
|
}
|
30
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,5 +1,5 @@
|
|
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'> & {
|
@@ -9,12 +9,15 @@ type EmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'a
|
|
9
9
|
trackingSource?: string;
|
10
10
|
vouchId?: string;
|
11
11
|
templateId?: string;
|
12
|
+
questions?: number[];
|
12
13
|
};
|
13
14
|
declare class Embed extends LitElement {
|
15
|
+
static styles: import("lit").CSSResult[];
|
14
16
|
private _mediaPlayerRef;
|
15
17
|
data: EmbedProps['data'];
|
16
18
|
vouchId: EmbedProps['vouchId'];
|
17
19
|
templateId: EmbedProps['templateId'];
|
20
|
+
questions: EmbedProps['questions'];
|
18
21
|
env: EmbedProps['env'];
|
19
22
|
apiKey: EmbedProps['apiKey'];
|
20
23
|
disableTracking: EmbedProps['disableTracking'];
|
@@ -45,11 +48,13 @@ declare class Embed extends LitElement {
|
|
45
48
|
get muted(): boolean;
|
46
49
|
get scene(): Scene | null;
|
47
50
|
get scenes(): Scene[];
|
51
|
+
get sceneConfig(): Scenes | null;
|
48
52
|
get videoState(): import("@vouchfor/media-player/dist/src/components/MediaPlayer/controllers/scenes").VideoStateMap | undefined;
|
49
53
|
get mediaPlayer(): MediaPlayer | undefined;
|
50
54
|
play(): void;
|
51
55
|
pause(): void;
|
52
56
|
setScene(index: number): void;
|
57
|
+
private _renderStyles;
|
53
58
|
render(): import("lit").TemplateResult<1>;
|
54
59
|
}
|
55
60
|
declare global {
|