@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.
- package/dist/es/browser-8d4ae80d.js +433 -0
- package/dist/es/browser-8d4ae80d.js.map +1 -0
- package/dist/es/embeds.js +7 -1499
- 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} +18 -10
- package/dist/es/src/components/Embed/controllers/tracking/utils.d.ts +17 -0
- package/dist/es/{components → src/components}/Embed/index.d.ts +8 -1
- package/dist/es/src/components/Embed/tests/data.d.ts +3 -0
- package/dist/iife/embeds.iife.js +466 -300
- 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 +63 -24
- 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 +50 -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 -261
- /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,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
|
7
|
-
private _clientId;
|
8
|
-
private _visitorId;
|
13
|
+
private _batchedEvents;
|
9
14
|
private _hasPlayed;
|
10
15
|
private _hasLoaded;
|
11
16
|
private _answersViewed;
|
12
|
-
private
|
13
|
-
private
|
17
|
+
private _streamStartTime;
|
18
|
+
private _streamLatestTime;
|
19
|
+
private _currentlyPlayingVideo;
|
14
20
|
constructor(host: EmbedHost);
|
15
|
-
private
|
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 {
|