@vouchfor/embeds 0.0.0-experiment.f80a91a → 0.0.0-experiment.f90d920

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/dist/es/embeds.js +1142 -9
  2. package/dist/es/embeds.js.map +1 -1
  3. package/dist/es/src/components/DialogEmbed/DialogOverlay.d.ts +2 -1
  4. package/dist/es/src/components/DialogEmbed/DialogPortal.d.ts +2 -1
  5. package/dist/es/src/components/DialogEmbed/index.d.ts +4 -1
  6. package/dist/es/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +1 -1
  7. package/dist/es/src/components/PlayerEmbed/index.d.ts +75 -0
  8. package/dist/es/src/components/PlayerEmbed/tests/data.d.ts +3 -2
  9. package/dist/es/src/components/PlayerEmbed/tests/media-data.d.ts +19 -0
  10. package/dist/iife/dialog-embed/embed.iife.js +2732 -411
  11. package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
  12. package/dist/iife/embeds.iife.js +2732 -411
  13. package/dist/iife/embeds.iife.js.map +1 -1
  14. package/dist/iife/player-embed/embed.iife.js +2706 -387
  15. package/dist/iife/player-embed/embed.iife.js.map +1 -1
  16. package/package.json +36 -31
  17. package/src/components/DialogEmbed/Dialog.stories.ts +12 -0
  18. package/src/components/DialogEmbed/DialogOverlay.ts +2 -1
  19. package/src/components/DialogEmbed/DialogPortal.ts +22 -10
  20. package/src/components/DialogEmbed/index.ts +5 -1
  21. package/src/components/PlayerEmbed/MultiEmbed.stories.ts +135 -0
  22. package/src/components/PlayerEmbed/PlayerEmbed.stories.ts +15 -1
  23. package/src/components/PlayerEmbed/controllers/tracking/index.ts +7 -7
  24. package/src/components/PlayerEmbed/controllers/tracking/utils.ts +1 -1
  25. package/src/components/PlayerEmbed/index.ts +120 -7
  26. package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +14 -7
  27. package/src/components/PlayerEmbed/tests/data.ts +121 -77
  28. package/src/components/PlayerEmbed/tests/media-data.ts +22 -0
  29. package/dist/es/browser-07a8b7dc.js +0 -433
  30. package/dist/es/browser-07a8b7dc.js.map +0 -1
  31. package/dist/es/index-0c298932.js +0 -10473
  32. package/dist/es/index-0c298932.js.map +0 -1
  33. package/dist/iife/dialog-embed/browser-450a324f.js +0 -433
  34. package/dist/iife/dialog-embed/browser-450a324f.js.map +0 -1
  35. package/dist/iife/dialog-embed/embed.js +0 -5
  36. package/dist/iife/dialog-embed/embed.js.map +0 -1
  37. package/dist/iife/dialog-embed/index-62750303.js +0 -32932
  38. package/dist/iife/dialog-embed/index-62750303.js.map +0 -1
  39. package/dist/iife/dialog-embed/src/components/DialogEmbed/DialogOverlay.d.ts +0 -19
  40. package/dist/iife/dialog-embed/src/components/DialogEmbed/DialogPortal.d.ts +0 -35
  41. package/dist/iife/dialog-embed/src/components/DialogEmbed/index.d.ts +0 -35
  42. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +0 -15
  43. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/fetcher.d.ts +0 -14
  44. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/tracking/index.d.ts +0 -36
  45. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +0 -17
  46. package/dist/iife/dialog-embed/src/components/PlayerEmbed/tests/data.d.ts +0 -3
  47. package/dist/iife/dialog-embed/src/index.d.ts +0 -2
  48. package/dist/iife/dialog-embed/src/utils/env.d.ts +0 -12
  49. package/dist/iife/dialog-embed/src/utils/events.d.ts +0 -2
  50. package/dist/iife/player-embed/browser-c51cdddb.js +0 -433
  51. package/dist/iife/player-embed/browser-c51cdddb.js.map +0 -1
  52. package/dist/iife/player-embed/embed.js +0 -5
  53. package/dist/iife/player-embed/embed.js.map +0 -1
  54. package/dist/iife/player-embed/index-0d71c577.js +0 -32489
  55. package/dist/iife/player-embed/index-0d71c577.js.map +0 -1
  56. package/dist/iife/player-embed/src/components/DialogEmbed/DialogOverlay.d.ts +0 -19
  57. package/dist/iife/player-embed/src/components/DialogEmbed/DialogPortal.d.ts +0 -35
  58. package/dist/iife/player-embed/src/components/DialogEmbed/index.d.ts +0 -35
  59. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +0 -15
  60. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/fetcher.d.ts +0 -14
  61. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/tracking/index.d.ts +0 -36
  62. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +0 -17
  63. package/dist/iife/player-embed/src/components/PlayerEmbed/tests/data.d.ts +0 -3
  64. package/dist/iife/player-embed/src/index.d.ts +0 -2
  65. package/dist/iife/player-embed/src/utils/env.d.ts +0 -12
  66. package/dist/iife/player-embed/src/utils/events.d.ts +0 -2
  67. package/src/mixins/media-player-proxy.ts +0 -116
@@ -1,19 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { DialogEmbedProps } from '.';
3
- declare class DialogOverlay extends LitElement {
4
- static styles: import("lit").CSSResult[];
5
- open: boolean;
6
- aspectRatio: DialogEmbedProps['aspectRatio'];
7
- render(): import("lit").TemplateResult<1>;
8
- }
9
- declare global {
10
- interface HTMLElementTagNameMap {
11
- 'vouch-embed-dialog-overlay': DialogOverlay;
12
- }
13
- namespace JSX {
14
- interface IntrinsicElements {
15
- 'vouch-embed-dialog-overlay': DialogOverlay;
16
- }
17
- }
18
- }
19
- export { DialogOverlay };
@@ -1,35 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { DialogEmbedProps } from '.';
3
- declare class DialogPortal extends LitElement {
4
- vouchId: DialogEmbedProps['vouchId'];
5
- templateId: DialogEmbedProps['templateId'];
6
- questions: DialogEmbedProps['questions'];
7
- env: DialogEmbedProps['env'];
8
- apiKey: DialogEmbedProps['apiKey'];
9
- disableTracking: DialogEmbedProps['disableTracking'];
10
- trackingSource: DialogEmbedProps['trackingSource'];
11
- controls: DialogEmbedProps['controls'];
12
- preload: DialogEmbedProps['preload'];
13
- disableAutoplay: DialogEmbedProps['disableAutoplay'];
14
- aspectRatio: DialogEmbedProps['aspectRatio'];
15
- private _mediaPlayerRef;
16
- open: boolean;
17
- private _handleToggle;
18
- private _handleClose;
19
- private _handleDocumentKeyUp;
20
- connectedCallback(): void;
21
- disconnectedCallback(): void;
22
- protected createRenderRoot(): HTMLElement | DocumentFragment;
23
- render(): import("lit").TemplateResult<1>;
24
- }
25
- declare global {
26
- interface HTMLElementTagNameMap {
27
- 'vouch-embed-dialog-portal': DialogPortal;
28
- }
29
- namespace JSX {
30
- interface IntrinsicElements {
31
- 'vouch-embed-dialog-portal': DialogPortal;
32
- }
33
- }
34
- }
35
- export { DialogPortal };
@@ -1,35 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import type { PlayerEmbedProps } from '../PlayerEmbed';
3
- type DialogEmbedProps = Omit<PlayerEmbedProps, 'data'> & {
4
- disableAutoplay?: boolean;
5
- };
6
- declare class DialogEmbed extends LitElement {
7
- static styles: import("lit").CSSResult[];
8
- vouchId: DialogEmbedProps['vouchId'];
9
- templateId: DialogEmbedProps['templateId'];
10
- questions: DialogEmbedProps['questions'];
11
- env: DialogEmbedProps['env'];
12
- apiKey: DialogEmbedProps['apiKey'];
13
- disableTracking: DialogEmbedProps['disableTracking'];
14
- trackingSource: DialogEmbedProps['trackingSource'];
15
- controls: DialogEmbedProps['controls'];
16
- preload: DialogEmbedProps['preload'];
17
- disableAutoplay: DialogEmbedProps['disableAutoplay'];
18
- aspectRatio: DialogEmbedProps['aspectRatio'];
19
- private _handleRootClick;
20
- connectedCallback(): void;
21
- disconnectedCallback(): void;
22
- render(): import("lit").TemplateResult<1>;
23
- }
24
- declare global {
25
- interface HTMLElementTagNameMap {
26
- 'vouch-embed-dialog': DialogEmbed;
27
- }
28
- namespace JSX {
29
- interface IntrinsicElements {
30
- 'vouch-embed-dialog': DialogEmbed;
31
- }
32
- }
33
- }
34
- export { DialogEmbed };
35
- export type { DialogEmbedProps };
@@ -1,15 +0,0 @@
1
- import type { PlayerEmbed } from '..';
2
- import type { ReactiveController, ReactiveControllerHost } from 'lit';
3
- import type { DirectiveResult } from 'lit/directive.js';
4
- type PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;
5
- declare class EventForwardController implements ReactiveController {
6
- host: PlayerEmbedHost;
7
- private _events;
8
- private _cleanup;
9
- private _forwardElementRef;
10
- constructor(host: PlayerEmbedHost, events: string[]);
11
- register(): DirectiveResult;
12
- hostConnected(): void;
13
- hostDisconnected(): void;
14
- }
15
- export { EventForwardController };
@@ -1,14 +0,0 @@
1
- import type { PlayerEmbed } from '..';
2
- import type { ReactiveControllerHost } from 'lit';
3
- type PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;
4
- declare class FetcherController {
5
- host: PlayerEmbedHost;
6
- private _fetching;
7
- private _vouch;
8
- set fetching(value: boolean);
9
- get fetching(): boolean;
10
- private getVouch;
11
- private getTemplate;
12
- constructor(host: PlayerEmbedHost);
13
- }
14
- export { FetcherController };
@@ -1,36 +0,0 @@
1
- import type { PlayerEmbed } from '../..';
2
- import type { ReactiveController, ReactiveControllerHost } from 'lit';
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
- };
11
- declare class TrackingController implements ReactiveController {
12
- host: PlayerEmbedHost;
13
- private _batchedEvents;
14
- private _hasPlayed;
15
- private _hasLoaded;
16
- private _answersViewed;
17
- private _streamStartTime;
18
- private _streamLatestTime;
19
- private _currentlyPlayingVideo;
20
- constructor(host: PlayerEmbedHost);
21
- private _createTrackingEvent;
22
- private _sendTrackingEvent;
23
- private _streamEnded;
24
- private _handleVouchLoaded;
25
- private _handlePlay;
26
- private _handleVideoPlay;
27
- private _handleVideoTimeUpdate;
28
- private _handleVideoPause;
29
- private _pageUnloading;
30
- private _handleVisibilityChange;
31
- private _handlePageHide;
32
- hostConnected(): void;
33
- hostDisconnected(): void;
34
- }
35
- export { TrackingController };
36
- export type { TrackingEvent, TrackingPayload };
@@ -1,17 +0,0 @@
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,3 +0,0 @@
1
- import type { Vouch } from '@vouchfor/media-player';
2
- declare const data: Vouch;
3
- export { data };
@@ -1,2 +0,0 @@
1
- export { PlayerEmbed } from './components/PlayerEmbed';
2
- export { DialogEmbed } from './components/DialogEmbed';
@@ -1,12 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- declare function forwardEvent(type: string, fromElement: HTMLElement, toElement: HTMLElement): () => void;
2
- export { forwardEvent };
@@ -1,116 +0,0 @@
1
- import { createRef } from 'lit/directives/ref.js';
2
-
3
- import type { Scene, Scenes } from '@vouchfor/canvas-video';
4
- import type { MediaPlayer } from '@vouchfor/media-player';
5
- import type { LitElement } from 'lit';
6
-
7
- type Constructor<T = Record<string, never>> = new (...args: any[]) => T;
8
-
9
- const MediaPlayerProxy = <T extends Constructor<LitElement>>(SuperClass: T) => {
10
- class MediaPlayerProxyClass extends SuperClass {
11
- protected _mediaPlayerRef = createRef<MediaPlayer>();
12
-
13
- get waiting() {
14
- return this._mediaPlayerRef.value?.waiting;
15
- }
16
-
17
- get initialised() {
18
- return this._mediaPlayerRef.value?.initialised;
19
- }
20
-
21
- get seeking() {
22
- return this._mediaPlayerRef.value?.seeking;
23
- }
24
-
25
- get paused() {
26
- return this._mediaPlayerRef.value?.paused;
27
- }
28
-
29
- get captions() {
30
- return this._mediaPlayerRef.value?.captions;
31
- }
32
-
33
- get fullscreen() {
34
- return this._mediaPlayerRef.value?.fullscreen;
35
- }
36
-
37
- get duration() {
38
- return this._mediaPlayerRef.value?.duration;
39
- }
40
-
41
- set currentTime(value: number) {
42
- if (this._mediaPlayerRef.value) {
43
- this._mediaPlayerRef.value.currentTime = value;
44
- }
45
- }
46
- get currentTime() {
47
- return this._mediaPlayerRef.value?.currentTime ?? 0;
48
- }
49
-
50
- set playbackRate(value: number) {
51
- if (this._mediaPlayerRef.value) {
52
- this._mediaPlayerRef.value.playbackRate = value;
53
- }
54
- }
55
- get playbackRate() {
56
- return this._mediaPlayerRef.value?.playbackRate ?? 1;
57
- }
58
-
59
- set volume(value: number) {
60
- if (this._mediaPlayerRef.value) {
61
- this._mediaPlayerRef.value.volume = value;
62
- }
63
- }
64
- get volume() {
65
- return this._mediaPlayerRef.value?.volume ?? 1;
66
- }
67
-
68
- set muted(value: boolean) {
69
- if (this._mediaPlayerRef.value) {
70
- this._mediaPlayerRef.value.muted = value;
71
- }
72
- }
73
- get muted() {
74
- return this._mediaPlayerRef.value?.muted ?? false;
75
- }
76
-
77
- get scene(): Scene | null {
78
- return this._mediaPlayerRef.value?.scene ?? null;
79
- }
80
-
81
- get scenes(): Scene[] {
82
- return this._mediaPlayerRef.value?.scenes ?? [];
83
- }
84
-
85
- get sceneConfig(): Scenes | null {
86
- return this._mediaPlayerRef.value?.sceneConfig ?? null;
87
- }
88
-
89
- get videoState() {
90
- return this._mediaPlayerRef.value?.videoState;
91
- }
92
-
93
- get mediaPlayer() {
94
- return this._mediaPlayerRef.value;
95
- }
96
-
97
- play() {
98
- this._mediaPlayerRef.value?.play();
99
- }
100
-
101
- pause() {
102
- this._mediaPlayerRef.value?.pause();
103
- }
104
-
105
- reset(time = 0, play = false) {
106
- this._mediaPlayerRef.value?.reset(time, play);
107
- }
108
-
109
- setScene(index: number) {
110
- this._mediaPlayerRef.value?.setScene(index);
111
- }
112
- }
113
- return MediaPlayerProxyClass;
114
- };
115
-
116
- export { MediaPlayerProxy };