@vouchfor/embeds 0.0.0-experiment.f726309 → 0.0.0-experiment.f7614ec
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/browser-0a211a9c.js +433 -0
- package/dist/es/browser-0a211a9c.js.map +1 -0
- package/dist/es/embeds.js +7 -1596
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/index-b6636843.js +9984 -0
- package/dist/es/index-b6636843.js.map +1 -0
- package/dist/es/src/components/{Embed → PlayerEmbed}/controllers/fetcher.d.ts +5 -4
- package/dist/es/src/components/{Embed/controllers/tracking.d.ts → PlayerEmbed/controllers/tracking/index.d.ts} +14 -11
- package/dist/es/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
- package/dist/es/src/components/{Embed → PlayerEmbed}/index.d.ts +23 -18
- package/dist/es/src/components/PlayerEmbed/tests/data.d.ts +3 -0
- package/dist/es/src/index.d.ts +1 -1
- package/dist/iife/embeds.iife.js +342 -315
- package/dist/iife/embeds.iife.js.map +1 -1
- package/package.json +7 -4
- package/src/components/{Embed/Embed.stories.ts → PlayerEmbed/PlayerEmbed.stories.ts} +26 -14
- package/src/components/{Embed → PlayerEmbed}/controllers/event-forwarder.ts +4 -4
- package/src/components/{Embed → PlayerEmbed}/controllers/fetcher.ts +33 -14
- package/src/components/{Embed/controllers/tracking.ts → PlayerEmbed/controllers/tracking/index.ts} +47 -115
- package/src/components/PlayerEmbed/controllers/tracking/utils.ts +95 -0
- package/src/components/{Embed → PlayerEmbed}/index.ts +63 -22
- package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +80 -0
- package/src/components/PlayerEmbed/tests/data.ts +183 -0
- package/src/index.ts +1 -1
@@ -1,13 +1,14 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PlayerEmbed } from '..';
|
2
2
|
import type { ReactiveControllerHost } from 'lit';
|
3
|
-
type
|
3
|
+
type PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;
|
4
4
|
declare class FetcherController {
|
5
|
-
host:
|
5
|
+
host: PlayerEmbedHost;
|
6
6
|
private _fetching;
|
7
|
+
private _vouch;
|
7
8
|
set fetching(value: boolean);
|
8
9
|
get fetching(): boolean;
|
9
10
|
private getVouch;
|
10
11
|
private getTemplate;
|
11
|
-
constructor(host:
|
12
|
+
constructor(host: PlayerEmbedHost);
|
12
13
|
}
|
13
14
|
export { FetcherController };
|
@@ -1,22 +1,24 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PlayerEmbed } from '../..';
|
2
2
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
3
|
-
type
|
3
|
+
type PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;
|
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
|
-
host:
|
6
|
-
private
|
7
|
-
private _clientId;
|
8
|
-
private _visitorId;
|
12
|
+
host: PlayerEmbedHost;
|
13
|
+
private _batchedEvents;
|
9
14
|
private _hasPlayed;
|
10
15
|
private _hasLoaded;
|
11
16
|
private _answersViewed;
|
12
17
|
private _streamStartTime;
|
13
18
|
private _streamLatestTime;
|
14
19
|
private _currentlyPlayingVideo;
|
15
|
-
constructor(host:
|
16
|
-
private
|
17
|
-
private _createVisitor;
|
18
|
-
private _getUids;
|
19
|
-
private _getReportingMetadata;
|
20
|
+
constructor(host: PlayerEmbedHost);
|
21
|
+
private _createTrackingEvent;
|
20
22
|
private _sendTrackingEvent;
|
21
23
|
private _streamEnded;
|
22
24
|
private _handleVouchLoaded;
|
@@ -31,3 +33,4 @@ declare class TrackingController implements ReactiveController {
|
|
31
33
|
hostDisconnected(): void;
|
32
34
|
}
|
33
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 };
|
@@ -2,34 +2,38 @@ import { LitElement } from 'lit';
|
|
2
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
|
-
type
|
5
|
+
type PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {
|
6
6
|
env: Environment;
|
7
7
|
apiKey: string;
|
8
8
|
disableTracking?: boolean;
|
9
9
|
trackingSource?: string;
|
10
10
|
vouchId?: string;
|
11
11
|
templateId?: string;
|
12
|
+
questions?: number[];
|
12
13
|
};
|
13
|
-
declare class
|
14
|
+
declare class PlayerEmbed extends LitElement {
|
15
|
+
static styles: import("lit").CSSResult[];
|
14
16
|
private _mediaPlayerRef;
|
15
|
-
data:
|
16
|
-
vouchId:
|
17
|
-
templateId:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
data: PlayerEmbedProps['data'];
|
18
|
+
vouchId: PlayerEmbedProps['vouchId'];
|
19
|
+
templateId: PlayerEmbedProps['templateId'];
|
20
|
+
questions: PlayerEmbedProps['questions'];
|
21
|
+
env: PlayerEmbedProps['env'];
|
22
|
+
apiKey: PlayerEmbedProps['apiKey'];
|
23
|
+
disableTracking: PlayerEmbedProps['disableTracking'];
|
24
|
+
trackingSource: PlayerEmbedProps['trackingSource'];
|
25
|
+
controls: PlayerEmbedProps['controls'];
|
26
|
+
preload: PlayerEmbedProps['preload'];
|
27
|
+
autoplay: PlayerEmbedProps['autoplay'];
|
28
|
+
aspectRatio: PlayerEmbedProps['aspectRatio'];
|
26
29
|
private eventController;
|
27
30
|
private _fetcherController;
|
28
31
|
private _trackingController;
|
29
|
-
vouch:
|
32
|
+
vouch: PlayerEmbedProps['data'];
|
30
33
|
template: TemplateInstance | undefined;
|
31
34
|
get fetching(): boolean;
|
32
35
|
get waiting(): boolean | undefined;
|
36
|
+
get initialised(): Promise<boolean> | undefined;
|
33
37
|
get seeking(): boolean | undefined;
|
34
38
|
get paused(): boolean | undefined;
|
35
39
|
get captions(): boolean | undefined;
|
@@ -51,17 +55,18 @@ declare class Embed extends LitElement {
|
|
51
55
|
play(): void;
|
52
56
|
pause(): void;
|
53
57
|
setScene(index: number): void;
|
58
|
+
private _renderStyles;
|
54
59
|
render(): import("lit").TemplateResult<1>;
|
55
60
|
}
|
56
61
|
declare global {
|
57
62
|
interface HTMLElementTagNameMap {
|
58
|
-
'vouch-embed':
|
63
|
+
'vouch-embed-player': PlayerEmbed;
|
59
64
|
}
|
60
65
|
namespace JSX {
|
61
66
|
interface IntrinsicElements {
|
62
|
-
'vouch-embed':
|
67
|
+
'vouch-embed-player': PlayerEmbed;
|
63
68
|
}
|
64
69
|
}
|
65
70
|
}
|
66
|
-
export {
|
67
|
-
export type {
|
71
|
+
export { PlayerEmbed };
|
72
|
+
export type { PlayerEmbedProps };
|
package/dist/es/src/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export {
|
1
|
+
export { PlayerEmbed } from './components/PlayerEmbed';
|