@vouchfor/embeds 0.0.0-experiment.e828084 → 0.0.0-experiment.f112aaa
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/browser-f5bec026.js +433 -0
- package/dist/es/browser-f5bec026.js.map +1 -0
- package/dist/es/embeds.js +8 -13
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/index-6ce8276f.js +9947 -0
- package/dist/es/index-6ce8276f.js.map +1 -0
- package/dist/es/src/components/Embed/controllers/fetcher.d.ts +14 -0
- package/dist/es/src/components/Embed/controllers/tracking.d.ts +33 -0
- package/dist/es/src/components/Embed/index.d.ts +70 -0
- package/dist/es/src/index.d.ts +1 -0
- package/dist/es/src/utils/env.d.ts +12 -0
- package/dist/es/src/utils/events.d.ts +2 -0
- package/dist/iife/embeds.iife.js +486 -279
- package/dist/iife/embeds.iife.js.map +1 -1
- package/package.json +7 -5
- package/src/components/Embed/Embed.stories.ts +79 -0
- package/src/components/Embed/controllers/event-forwarder.ts +47 -0
- package/src/components/Embed/controllers/fetcher.ts +152 -0
- package/src/components/Embed/controllers/tracking.ts +294 -0
- package/src/components/Embed/index.ts +217 -0
- package/src/index.ts +1 -1
- package/src/utils/env.ts +64 -0
- package/src/utils/events.ts +13 -0
- package/dist/es/components/InlineEmbed/index.d.ts +0 -17
- package/dist/es/index.d.ts +0 -1
- package/src/components/InlineEmbed/InlineEmbed.stories.ts +0 -119
- package/src/components/InlineEmbed/index.ts +0 -24
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { Embed } from '..';
|
2
|
+
import type { ReactiveControllerHost } from 'lit';
|
3
|
+
type EmbedHost = ReactiveControllerHost & Embed;
|
4
|
+
declare class FetcherController {
|
5
|
+
host: EmbedHost;
|
6
|
+
private _fetching;
|
7
|
+
private _vouch;
|
8
|
+
set fetching(value: boolean);
|
9
|
+
get fetching(): boolean;
|
10
|
+
private getVouch;
|
11
|
+
private getTemplate;
|
12
|
+
constructor(host: EmbedHost);
|
13
|
+
}
|
14
|
+
export { FetcherController };
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import type { Embed } from '..';
|
2
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
3
|
+
type EmbedHost = ReactiveControllerHost & Embed;
|
4
|
+
declare class TrackingController implements ReactiveController {
|
5
|
+
host: EmbedHost;
|
6
|
+
private _tabId;
|
7
|
+
private _clientId;
|
8
|
+
private _visitorId;
|
9
|
+
private _hasPlayed;
|
10
|
+
private _hasLoaded;
|
11
|
+
private _answersViewed;
|
12
|
+
private _streamStartTime;
|
13
|
+
private _streamLatestTime;
|
14
|
+
private _currentlyPlayingVideo;
|
15
|
+
constructor(host: EmbedHost);
|
16
|
+
private _findVouchId;
|
17
|
+
private _createVisitor;
|
18
|
+
private _getUids;
|
19
|
+
private _getReportingMetadata;
|
20
|
+
private _sendTrackingEvent;
|
21
|
+
private _streamEnded;
|
22
|
+
private _handleVouchLoaded;
|
23
|
+
private _handlePlay;
|
24
|
+
private _handleVideoPlay;
|
25
|
+
private _handleVideoTimeUpdate;
|
26
|
+
private _handleVideoPause;
|
27
|
+
private _pageUnloading;
|
28
|
+
private _handleVisibilityChange;
|
29
|
+
private _handlePageHide;
|
30
|
+
hostConnected(): void;
|
31
|
+
hostDisconnected(): void;
|
32
|
+
}
|
33
|
+
export { TrackingController };
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
import type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';
|
3
|
+
import type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';
|
4
|
+
import type { Environment } from '../../utils/env';
|
5
|
+
type EmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {
|
6
|
+
env: Environment;
|
7
|
+
apiKey: string;
|
8
|
+
disableTracking?: boolean;
|
9
|
+
trackingSource?: string;
|
10
|
+
vouchId?: string;
|
11
|
+
templateId?: string;
|
12
|
+
questions?: number[];
|
13
|
+
};
|
14
|
+
declare class Embed extends LitElement {
|
15
|
+
static styles: import("lit").CSSResult[];
|
16
|
+
private _mediaPlayerRef;
|
17
|
+
data: EmbedProps['data'];
|
18
|
+
vouchId: EmbedProps['vouchId'];
|
19
|
+
templateId: EmbedProps['templateId'];
|
20
|
+
questions: EmbedProps['questions'];
|
21
|
+
env: EmbedProps['env'];
|
22
|
+
apiKey: EmbedProps['apiKey'];
|
23
|
+
disableTracking: EmbedProps['disableTracking'];
|
24
|
+
trackingSource: EmbedProps['trackingSource'];
|
25
|
+
controls: EmbedProps['controls'];
|
26
|
+
preload: EmbedProps['preload'];
|
27
|
+
autoplay: EmbedProps['autoplay'];
|
28
|
+
aspectRatio: EmbedProps['aspectRatio'];
|
29
|
+
private eventController;
|
30
|
+
private _fetcherController;
|
31
|
+
private _trackingController;
|
32
|
+
vouch: EmbedProps['data'];
|
33
|
+
template: TemplateInstance | undefined;
|
34
|
+
get fetching(): boolean;
|
35
|
+
get waiting(): boolean | undefined;
|
36
|
+
get seeking(): boolean | undefined;
|
37
|
+
get paused(): boolean | undefined;
|
38
|
+
get captions(): boolean | undefined;
|
39
|
+
get fullscreen(): boolean | undefined;
|
40
|
+
get duration(): number | undefined;
|
41
|
+
set currentTime(value: number);
|
42
|
+
get currentTime(): number;
|
43
|
+
set playbackRate(value: number);
|
44
|
+
get playbackRate(): number;
|
45
|
+
set volume(value: number);
|
46
|
+
get volume(): number;
|
47
|
+
set muted(value: boolean);
|
48
|
+
get muted(): boolean;
|
49
|
+
get scene(): Scene | null;
|
50
|
+
get scenes(): Scene[];
|
51
|
+
get sceneConfig(): Scenes | null;
|
52
|
+
get videoState(): import("@vouchfor/media-player/dist/src/components/MediaPlayer/controllers/scenes").VideoStateMap | undefined;
|
53
|
+
get mediaPlayer(): MediaPlayer | undefined;
|
54
|
+
play(): void;
|
55
|
+
pause(): void;
|
56
|
+
setScene(index: number): void;
|
57
|
+
render(): import("lit").TemplateResult<1>;
|
58
|
+
}
|
59
|
+
declare global {
|
60
|
+
interface HTMLElementTagNameMap {
|
61
|
+
'vouch-embed': Embed;
|
62
|
+
}
|
63
|
+
namespace JSX {
|
64
|
+
interface IntrinsicElements {
|
65
|
+
'vouch-embed': Embed;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}
|
69
|
+
export { Embed };
|
70
|
+
export type { EmbedProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Embed } from './components/Embed';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
type Environment = 'local' | 'dev' | 'staging' | 'prod';
|
2
|
+
type GetEnvUrlsReturn = {
|
3
|
+
videoUrl: string;
|
4
|
+
publicApiUrl: string;
|
5
|
+
embedApiUrl: string;
|
6
|
+
};
|
7
|
+
declare const devEmbedApiUrl = "https://embed-dev.vouchfor.com/v2";
|
8
|
+
declare const stagingEmbedApiUrl = "https://embed-staging.vouchfor.com/v2";
|
9
|
+
declare const prodEmbedApiUrl = "https://embed.vouchfor.com/v2";
|
10
|
+
declare function getEnvUrls(env: Environment): GetEnvUrlsReturn;
|
11
|
+
export { devEmbedApiUrl, stagingEmbedApiUrl, prodEmbedApiUrl, getEnvUrls };
|
12
|
+
export type { Environment };
|