@vouchfor/embeds 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/es/{browser-4d54600e.js → browser-97265c29.js} +2 -2
  2. package/dist/es/{browser-4d54600e.js.map → browser-97265c29.js.map} +1 -1
  3. package/dist/es/embeds.js +1 -1
  4. package/dist/es/{index-14868944.js → index-d15aeb56.js} +632 -640
  5. package/dist/es/index-d15aeb56.js.map +1 -0
  6. package/dist/es/src/components/PlayerEmbed/index.d.ts +73 -0
  7. package/dist/iife/dialog-embed/{browser-d8ab928d.js → browser-c8adca59.js} +2 -2
  8. package/dist/iife/dialog-embed/{browser-d8ab928d.js.map → browser-c8adca59.js.map} +1 -1
  9. package/dist/iife/dialog-embed/embed.iife.js +38 -38
  10. package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
  11. package/dist/iife/dialog-embed/embed.js +1 -1
  12. package/dist/iife/dialog-embed/{index-568f189c.js → index-eb3ec3b3.js} +667 -675
  13. package/dist/iife/dialog-embed/index-eb3ec3b3.js.map +1 -0
  14. package/dist/iife/dialog-embed/src/components/PlayerEmbed/index.d.ts +73 -0
  15. package/dist/iife/embeds.iife.js +38 -38
  16. package/dist/iife/embeds.iife.js.map +1 -1
  17. package/dist/iife/player-embed/{browser-951710ee.js → browser-7e2003a9.js} +2 -2
  18. package/dist/iife/player-embed/{browser-951710ee.js.map → browser-7e2003a9.js.map} +1 -1
  19. package/dist/iife/player-embed/embed.iife.js +34 -34
  20. package/dist/iife/player-embed/embed.iife.js.map +1 -1
  21. package/dist/iife/player-embed/embed.js +1 -1
  22. package/dist/iife/player-embed/{index-86dfade0.js → index-4541048e.js} +3343 -3351
  23. package/dist/iife/player-embed/index-4541048e.js.map +1 -0
  24. package/dist/iife/player-embed/src/components/PlayerEmbed/index.d.ts +73 -0
  25. package/package.json +2 -2
  26. package/src/components/PlayerEmbed/index.ts +106 -5
  27. package/dist/es/index-14868944.js.map +0 -1
  28. package/dist/iife/dialog-embed/index-568f189c.js.map +0 -1
  29. package/dist/iife/player-embed/index-86dfade0.js.map +0 -1
  30. package/src/mixins/media-player-proxy.ts +0 -116
@@ -0,0 +1,73 @@
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 PlayerEmbedProps = 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 PlayerEmbed extends LitElement {
15
+ static styles: import("lit").CSSResult[];
16
+ data: PlayerEmbedProps['data'];
17
+ vouchId: PlayerEmbedProps['vouchId'];
18
+ templateId: PlayerEmbedProps['templateId'];
19
+ questions: PlayerEmbedProps['questions'];
20
+ env: PlayerEmbedProps['env'];
21
+ apiKey: PlayerEmbedProps['apiKey'];
22
+ disableTracking: PlayerEmbedProps['disableTracking'];
23
+ trackingSource: PlayerEmbedProps['trackingSource'];
24
+ controls: PlayerEmbedProps['controls'];
25
+ preload: PlayerEmbedProps['preload'];
26
+ autoplay: PlayerEmbedProps['autoplay'];
27
+ aspectRatio: PlayerEmbedProps['aspectRatio'];
28
+ private eventController;
29
+ private _fetcherController;
30
+ private _trackingController;
31
+ vouch: PlayerEmbedProps['data'];
32
+ template: TemplateInstance | undefined;
33
+ get fetching(): boolean;
34
+ private _mediaPlayerRef;
35
+ get waiting(): boolean | undefined;
36
+ get initialised(): Promise<boolean> | undefined;
37
+ get seeking(): boolean | undefined;
38
+ get paused(): boolean | undefined;
39
+ get captions(): boolean | undefined;
40
+ get fullscreen(): boolean | undefined;
41
+ get duration(): number | undefined;
42
+ set currentTime(value: number);
43
+ get currentTime(): number;
44
+ set playbackRate(value: number);
45
+ get playbackRate(): number;
46
+ set volume(value: number);
47
+ get volume(): number;
48
+ set muted(value: boolean);
49
+ get muted(): boolean;
50
+ get scene(): Scene | null;
51
+ get scenes(): Scene[];
52
+ get sceneConfig(): Scenes | null;
53
+ get videoState(): import("@vouchfor/media-player/dist/src/components/MediaPlayer/controllers/scenes").VideoStateMap | undefined;
54
+ get mediaPlayer(): MediaPlayer | undefined;
55
+ play(): void;
56
+ pause(): void;
57
+ reset(time?: number, play?: boolean): void;
58
+ setScene(index: number): void;
59
+ private _renderStyles;
60
+ render(): import("lit").TemplateResult<1>;
61
+ }
62
+ declare global {
63
+ interface HTMLElementTagNameMap {
64
+ 'vouch-embed-player': PlayerEmbed;
65
+ }
66
+ namespace JSX {
67
+ interface IntrinsicElements {
68
+ 'vouch-embed-player': PlayerEmbed;
69
+ }
70
+ }
71
+ }
72
+ export { PlayerEmbed };
73
+ export type { PlayerEmbedProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/embeds",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "license": "MIT",
5
5
  "author": "Aaron Williams",
6
6
  "main": "dist/es/embeds.js",
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@a11y/focus-trap": "^1.0.5",
44
44
  "@lit/task": "^1.0.0",
45
- "@vouchfor/media-player": "^2.1.0",
45
+ "@vouchfor/media-player": "^2.1.2",
46
46
  "uuid": "^9.0.1"
47
47
  },
48
48
  "peerDependencies": {
@@ -1,16 +1,15 @@
1
1
  import { css, html, LitElement } from 'lit';
2
2
  import { customElement, property, state } from 'lit/decorators.js';
3
3
  import { ifDefined } from 'lit/directives/if-defined.js';
4
- import { ref } from 'lit/directives/ref.js';
4
+ import { createRef, ref } from 'lit/directives/ref.js';
5
5
 
6
- import type { TemplateInstance } from '@vouchfor/canvas-video';
7
- import type { MediaPlayerProps } from '@vouchfor/media-player';
6
+ import type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';
7
+ import type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';
8
8
  import type { Environment } from '~/utils/env';
9
9
 
10
10
  import { EventForwardController } from './controllers/event-forwarder';
11
11
  import { FetcherController } from './controllers/fetcher';
12
12
  import { TrackingController } from './controllers/tracking';
13
- import { MediaPlayerProxy } from '~/mixins/media-player-proxy';
14
13
 
15
14
  import '@vouchfor/media-player';
16
15
 
@@ -26,7 +25,7 @@ type PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload
26
25
  };
27
26
 
28
27
  @customElement('vouch-embed-player')
29
- class PlayerEmbed extends MediaPlayerProxy(LitElement) {
28
+ class PlayerEmbed extends LitElement {
30
29
  static styles = [
31
30
  css`
32
31
  :host {
@@ -90,6 +89,108 @@ class PlayerEmbed extends MediaPlayerProxy(LitElement) {
90
89
  return this._fetcherController.fetching;
91
90
  }
92
91
 
92
+ private _mediaPlayerRef = createRef<MediaPlayer>();
93
+
94
+ get waiting() {
95
+ return this._mediaPlayerRef.value?.waiting;
96
+ }
97
+
98
+ get initialised() {
99
+ return this._mediaPlayerRef.value?.initialised;
100
+ }
101
+
102
+ get seeking() {
103
+ return this._mediaPlayerRef.value?.seeking;
104
+ }
105
+
106
+ get paused() {
107
+ return this._mediaPlayerRef.value?.paused;
108
+ }
109
+
110
+ get captions() {
111
+ return this._mediaPlayerRef.value?.captions;
112
+ }
113
+
114
+ get fullscreen() {
115
+ return this._mediaPlayerRef.value?.fullscreen;
116
+ }
117
+
118
+ get duration() {
119
+ return this._mediaPlayerRef.value?.duration;
120
+ }
121
+
122
+ set currentTime(value: number) {
123
+ if (this._mediaPlayerRef.value) {
124
+ this._mediaPlayerRef.value.currentTime = value;
125
+ }
126
+ }
127
+ get currentTime() {
128
+ return this._mediaPlayerRef.value?.currentTime ?? 0;
129
+ }
130
+
131
+ set playbackRate(value: number) {
132
+ if (this._mediaPlayerRef.value) {
133
+ this._mediaPlayerRef.value.playbackRate = value;
134
+ }
135
+ }
136
+ get playbackRate() {
137
+ return this._mediaPlayerRef.value?.playbackRate ?? 1;
138
+ }
139
+
140
+ set volume(value: number) {
141
+ if (this._mediaPlayerRef.value) {
142
+ this._mediaPlayerRef.value.volume = value;
143
+ }
144
+ }
145
+ get volume() {
146
+ return this._mediaPlayerRef.value?.volume ?? 1;
147
+ }
148
+
149
+ set muted(value: boolean) {
150
+ if (this._mediaPlayerRef.value) {
151
+ this._mediaPlayerRef.value.muted = value;
152
+ }
153
+ }
154
+ get muted() {
155
+ return this._mediaPlayerRef.value?.muted ?? false;
156
+ }
157
+
158
+ get scene(): Scene | null {
159
+ return this._mediaPlayerRef.value?.scene ?? null;
160
+ }
161
+
162
+ get scenes(): Scene[] {
163
+ return this._mediaPlayerRef.value?.scenes ?? [];
164
+ }
165
+
166
+ get sceneConfig(): Scenes | null {
167
+ return this._mediaPlayerRef.value?.sceneConfig ?? null;
168
+ }
169
+
170
+ get videoState() {
171
+ return this._mediaPlayerRef.value?.videoState;
172
+ }
173
+
174
+ get mediaPlayer() {
175
+ return this._mediaPlayerRef.value;
176
+ }
177
+
178
+ play() {
179
+ this._mediaPlayerRef.value?.play();
180
+ }
181
+
182
+ pause() {
183
+ this._mediaPlayerRef.value?.pause();
184
+ }
185
+
186
+ reset(time = 0, play = false) {
187
+ this._mediaPlayerRef.value?.reset(time, play);
188
+ }
189
+
190
+ setScene(index: number) {
191
+ this._mediaPlayerRef.value?.setScene(index);
192
+ }
193
+
93
194
  private _renderStyles() {
94
195
  if (!this.aspectRatio) {
95
196
  return html`