@vouchfor/embeds 0.0.0-experiment.8c5a3f8 → 0.0.0-experiment.8cafed9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/dist/es/browser-DfO9Pnu7.js +921 -0
  2. package/dist/es/browser-DfO9Pnu7.js.map +1 -0
  3. package/dist/es/embeds.js +1 -1599
  4. package/dist/es/embeds.js.map +1 -1
  5. package/dist/es/index-5G8orrrP.js +2609 -0
  6. package/dist/es/index-5G8orrrP.js.map +1 -0
  7. package/dist/es/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
  8. package/dist/es/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
  9. package/dist/es/src/components/DialogEmbed/index.d.ts +38 -0
  10. package/dist/es/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
  11. package/dist/es/src/components/{Embed → PlayerEmbed}/controllers/fetcher.d.ts +5 -4
  12. package/dist/es/src/components/{Embed/controllers/tracking.d.ts → PlayerEmbed/controllers/tracking/index.d.ts} +14 -11
  13. package/dist/es/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
  14. package/dist/es/src/components/{Embed → PlayerEmbed}/index.d.ts +28 -21
  15. package/dist/es/src/components/PlayerEmbed/tests/data.d.ts +3 -0
  16. package/dist/es/src/index.d.ts +2 -1
  17. package/dist/iife/dialog-embed/browser-DCzTItVw.js +429 -0
  18. package/dist/iife/dialog-embed/browser-DCzTItVw.js.map +1 -0
  19. package/dist/iife/dialog-embed/embed.iife.js +1750 -0
  20. package/dist/iife/dialog-embed/embed.iife.js.map +1 -0
  21. package/dist/iife/dialog-embed/embed.js +5 -0
  22. package/dist/iife/dialog-embed/embed.js.map +1 -0
  23. package/dist/iife/dialog-embed/index-CgdXxP5z.js +27698 -0
  24. package/dist/iife/dialog-embed/index-CgdXxP5z.js.map +1 -0
  25. package/dist/iife/dialog-embed/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
  26. package/dist/iife/dialog-embed/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
  27. package/dist/iife/dialog-embed/src/components/DialogEmbed/index.d.ts +38 -0
  28. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
  29. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/fetcher.d.ts +14 -0
  30. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/tracking/index.d.ts +36 -0
  31. package/dist/iife/dialog-embed/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
  32. package/dist/iife/dialog-embed/src/components/PlayerEmbed/index.d.ts +74 -0
  33. package/dist/iife/dialog-embed/src/components/PlayerEmbed/tests/data.d.ts +3 -0
  34. package/dist/iife/dialog-embed/src/index.d.ts +2 -0
  35. package/dist/iife/dialog-embed/src/utils/env.d.ts +12 -0
  36. package/dist/iife/dialog-embed/src/utils/events.d.ts +2 -0
  37. package/dist/iife/embeds.iife.js +661 -456
  38. package/dist/iife/embeds.iife.js.map +1 -1
  39. package/dist/iife/player-embed/browser-BBSMddCs.js +429 -0
  40. package/dist/iife/player-embed/browser-BBSMddCs.js.map +1 -0
  41. package/dist/iife/player-embed/embed.iife.js +1612 -0
  42. package/dist/iife/player-embed/embed.iife.js.map +1 -0
  43. package/dist/iife/player-embed/embed.js +5 -0
  44. package/dist/iife/player-embed/embed.js.map +1 -0
  45. package/dist/iife/player-embed/index-BGZl_iqR.js +27255 -0
  46. package/dist/iife/player-embed/index-BGZl_iqR.js.map +1 -0
  47. package/dist/iife/player-embed/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
  48. package/dist/iife/player-embed/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
  49. package/dist/iife/player-embed/src/components/DialogEmbed/index.d.ts +38 -0
  50. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
  51. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/fetcher.d.ts +14 -0
  52. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/tracking/index.d.ts +36 -0
  53. package/dist/iife/player-embed/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
  54. package/dist/iife/player-embed/src/components/PlayerEmbed/index.d.ts +74 -0
  55. package/dist/iife/player-embed/src/components/PlayerEmbed/tests/data.d.ts +3 -0
  56. package/dist/iife/player-embed/src/index.d.ts +2 -0
  57. package/dist/iife/player-embed/src/utils/env.d.ts +12 -0
  58. package/dist/iife/player-embed/src/utils/events.d.ts +2 -0
  59. package/package.json +43 -31
  60. package/src/components/DialogEmbed/Dialog.stories.ts +91 -0
  61. package/src/components/DialogEmbed/DialogOverlay.ts +131 -0
  62. package/src/components/DialogEmbed/DialogPortal.ts +126 -0
  63. package/src/components/DialogEmbed/index.ts +97 -0
  64. package/src/components/{Embed/Embed.stories.ts → PlayerEmbed/PlayerEmbed.stories.ts} +26 -14
  65. package/src/components/{Embed → PlayerEmbed}/controllers/event-forwarder.ts +6 -5
  66. package/src/components/{Embed → PlayerEmbed}/controllers/fetcher.ts +33 -14
  67. package/src/components/{Embed/controllers/tracking.ts → PlayerEmbed/controllers/tracking/index.ts} +47 -115
  68. package/src/components/PlayerEmbed/controllers/tracking/utils.ts +95 -0
  69. package/src/components/{Embed → PlayerEmbed}/index.ts +71 -27
  70. package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +80 -0
  71. package/src/components/PlayerEmbed/tests/data.ts +183 -0
  72. package/src/index.ts +2 -1
@@ -0,0 +1,20 @@
1
+ import { LitElement } from 'lit';
2
+ import type { DialogEmbedProps } from '.';
3
+ import '@a11y/focus-trap';
4
+ declare class DialogOverlay extends LitElement {
5
+ static styles: import("lit").CSSResult[];
6
+ open: boolean;
7
+ aspectRatio: DialogEmbedProps['aspectRatio'];
8
+ render(): import("lit-html").TemplateResult<1>;
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'vouch-embed-dialog-overlay': DialogOverlay;
13
+ }
14
+ namespace JSX {
15
+ interface IntrinsicElements {
16
+ 'vouch-embed-dialog-overlay': DialogOverlay;
17
+ }
18
+ }
19
+ }
20
+ export { DialogOverlay };
@@ -0,0 +1,36 @@
1
+ import { LitElement } from 'lit';
2
+ import type { DialogEmbedProps } from '.';
3
+ import './DialogOverlay';
4
+ declare class DialogPortal extends LitElement {
5
+ vouchId: DialogEmbedProps['vouchId'];
6
+ templateId: DialogEmbedProps['templateId'];
7
+ questions: DialogEmbedProps['questions'];
8
+ env: DialogEmbedProps['env'];
9
+ apiKey: DialogEmbedProps['apiKey'];
10
+ disableTracking: DialogEmbedProps['disableTracking'];
11
+ trackingSource: DialogEmbedProps['trackingSource'];
12
+ controls: DialogEmbedProps['controls'];
13
+ preload: DialogEmbedProps['preload'];
14
+ disableAutoplay: DialogEmbedProps['disableAutoplay'];
15
+ aspectRatio: DialogEmbedProps['aspectRatio'];
16
+ private _mediaPlayerRef;
17
+ open: boolean;
18
+ private _handleToggle;
19
+ private _handleClose;
20
+ private _handleDocumentKeyUp;
21
+ connectedCallback(): void;
22
+ disconnectedCallback(): void;
23
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
24
+ render(): import("lit-html").TemplateResult<1>;
25
+ }
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ 'vouch-embed-dialog-portal': DialogPortal;
29
+ }
30
+ namespace JSX {
31
+ interface IntrinsicElements {
32
+ 'vouch-embed-dialog-portal': DialogPortal;
33
+ }
34
+ }
35
+ }
36
+ export { DialogPortal };
@@ -0,0 +1,38 @@
1
+ import { LitElement } from 'lit';
2
+ import type { PlayerEmbedProps } from '../PlayerEmbed';
3
+ import '../PlayerEmbed';
4
+ import './DialogPortal';
5
+ type DialogEmbedProps = Omit<PlayerEmbedProps, 'data'> & {
6
+ disableAutoplay?: boolean;
7
+ };
8
+ declare class DialogEmbed extends LitElement {
9
+ static styles: import("lit").CSSResult[];
10
+ vouchId: DialogEmbedProps['vouchId'];
11
+ templateId: DialogEmbedProps['templateId'];
12
+ questions: DialogEmbedProps['questions'];
13
+ env: DialogEmbedProps['env'];
14
+ apiKey: DialogEmbedProps['apiKey'];
15
+ disableTracking: DialogEmbedProps['disableTracking'];
16
+ trackingSource: DialogEmbedProps['trackingSource'];
17
+ controls: DialogEmbedProps['controls'];
18
+ preload: DialogEmbedProps['preload'];
19
+ disableAutoplay: DialogEmbedProps['disableAutoplay'];
20
+ aspectRatio: DialogEmbedProps['aspectRatio'];
21
+ private _id;
22
+ private _handleRootClick;
23
+ connectedCallback(): void;
24
+ disconnectedCallback(): void;
25
+ render(): import("lit-html").TemplateResult<1>;
26
+ }
27
+ declare global {
28
+ interface HTMLElementTagNameMap {
29
+ 'vouch-embed-dialog': DialogEmbed;
30
+ }
31
+ namespace JSX {
32
+ interface IntrinsicElements {
33
+ 'vouch-embed-dialog': DialogEmbed;
34
+ }
35
+ }
36
+ }
37
+ export { DialogEmbed };
38
+ export type { DialogEmbedProps };
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1,14 @@
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 };
@@ -0,0 +1,36 @@
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 };
@@ -0,0 +1,17 @@
1
+ import type { TrackingPayload } from '.';
2
+ import type { Vouch } from '@vouchfor/video-utils';
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 };
@@ -0,0 +1,74 @@
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
+ import '@vouchfor/media-player';
6
+ type PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {
7
+ env: Environment;
8
+ apiKey: string;
9
+ disableTracking?: boolean;
10
+ trackingSource?: string;
11
+ vouchId?: string;
12
+ templateId?: string;
13
+ questions?: number[];
14
+ };
15
+ declare class PlayerEmbed extends LitElement {
16
+ static styles: import("lit").CSSResult[];
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'];
29
+ private eventController;
30
+ private _fetcherController;
31
+ private _trackingController;
32
+ vouch: PlayerEmbedProps['data'];
33
+ template: TemplateInstance | undefined;
34
+ get fetching(): boolean;
35
+ private _mediaPlayerRef;
36
+ get waiting(): boolean | undefined;
37
+ get initialised(): Promise<boolean> | undefined;
38
+ get seeking(): boolean | undefined;
39
+ get paused(): boolean | undefined;
40
+ get captions(): boolean | undefined;
41
+ get fullscreen(): boolean | undefined;
42
+ get duration(): number | undefined;
43
+ set currentTime(value: number);
44
+ get currentTime(): number;
45
+ set playbackRate(value: number);
46
+ get playbackRate(): number;
47
+ set volume(value: number);
48
+ get volume(): number;
49
+ set muted(value: boolean);
50
+ get muted(): boolean;
51
+ get scene(): Scene | null;
52
+ get scenes(): Scene[];
53
+ get sceneConfig(): Scenes | null;
54
+ get videoState(): import("@vouchfor/media-player").VideoStateMap | undefined;
55
+ get mediaPlayer(): MediaPlayer | undefined;
56
+ play(): void;
57
+ pause(): void;
58
+ reset(time?: number, play?: boolean): void;
59
+ setScene(index: number): void;
60
+ private _renderStyles;
61
+ render(): import("lit-html").TemplateResult<1>;
62
+ }
63
+ declare global {
64
+ interface HTMLElementTagNameMap {
65
+ 'vouch-embed-player': PlayerEmbed;
66
+ }
67
+ namespace JSX {
68
+ interface IntrinsicElements {
69
+ 'vouch-embed-player': PlayerEmbed;
70
+ }
71
+ }
72
+ }
73
+ export { PlayerEmbed };
74
+ export type { PlayerEmbedProps };
@@ -0,0 +1,3 @@
1
+ import type { Vouch } from '@vouchfor/video-utils';
2
+ declare const data: Vouch;
3
+ export { data };
@@ -0,0 +1,2 @@
1
+ export { PlayerEmbed } from './components/PlayerEmbed';
2
+ export { DialogEmbed } from './components/DialogEmbed';
@@ -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 };
@@ -0,0 +1,2 @@
1
+ declare function forwardEvent(type: string, fromElement: HTMLElement, toElement: HTMLElement): () => void;
2
+ export { forwardEvent };