@vouchfor/embeds 0.0.0-experiment.1b80037 → 0.0.0-experiment.254513d
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/components/Embed/controllers/fetcher.d.ts +6 -6
- package/dist/es/components/Embed/index.d.ts +4 -5
- package/dist/es/embeds.js +62 -66
- package/dist/es/embeds.js.map +1 -1
- package/dist/iife/embeds.iife.js +153 -154
- package/dist/iife/embeds.iife.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Embed/Embed.stories.ts +4 -17
- package/src/components/Embed/controllers/fetcher.ts +4 -4
- package/src/components/Embed/index.ts +3 -9
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vouchfor/embeds",
|
3
|
-
"version": "0.0.0-experiment.
|
3
|
+
"version": "0.0.0-experiment.254513d",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "Aaron Williams",
|
6
6
|
"main": "dist/es/embeds.js",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
38
|
"@lit/task": "1.0.0",
|
39
|
-
"@vouchfor/media-player": "0.0.0-experiment.
|
39
|
+
"@vouchfor/media-player": "0.0.0-experiment.254513d",
|
40
40
|
"uuid": "^9.0.1"
|
41
41
|
},
|
42
42
|
"peerDependencies": {
|
@@ -10,30 +10,18 @@ type EmbedArgs = EmbedProps & {
|
|
10
10
|
showVouch?: boolean;
|
11
11
|
};
|
12
12
|
|
13
|
-
const _Embed = ({
|
14
|
-
vouchId,
|
15
|
-
templateId,
|
16
|
-
preload,
|
17
|
-
autoplay,
|
18
|
-
env,
|
19
|
-
apiKey,
|
20
|
-
controls,
|
21
|
-
|
22
|
-
resolution,
|
23
|
-
aspectRatio
|
24
|
-
}: EmbedArgs) => {
|
13
|
+
const _Embed = ({ vouchId, templateId, preload, autoplay, env, apiKey, controls, aspectRatio }: EmbedArgs) => {
|
25
14
|
return html`
|
26
15
|
<div style="height: 100vh">
|
27
16
|
<vouch-embed
|
28
17
|
env=${ifDefined(env)}
|
29
18
|
apiKey=${ifDefined(apiKey)}
|
30
|
-
?autoplay=${autoplay}
|
31
19
|
vouchId=${ifDefined(vouchId)}
|
32
20
|
templateId=${ifDefined(templateId)}
|
33
|
-
resolution=${ifDefined(resolution)}
|
34
|
-
aspectRatio=${ifDefined(aspectRatio)}
|
35
|
-
preload=${ifDefined(preload)}
|
36
21
|
.controls=${controls}
|
22
|
+
?autoplay=${autoplay}
|
23
|
+
preload=${ifDefined(preload)}
|
24
|
+
aspectRatio=${ifDefined(aspectRatio)}
|
37
25
|
></vouch-embed>
|
38
26
|
</div>
|
39
27
|
`;
|
@@ -55,7 +43,6 @@ const Embed: Story = {
|
|
55
43
|
apiKey: 'TVik9uTMgE-PD25UTHIS6gyl0hMBWC7AT4dkpdlLBT4VIfDWZJrQiCk6Ak7m1',
|
56
44
|
vouchId: '6JQEIPeStt',
|
57
45
|
templateId: '7d0113f7-3f9a-4bdd-97e3-07ee6eec5730',
|
58
|
-
resolution: 1080,
|
59
46
|
aspectRatio: 0,
|
60
47
|
preload: 'none',
|
61
48
|
autoplay: false
|
@@ -21,8 +21,8 @@ class FetcherController {
|
|
21
21
|
host: EmbedHost;
|
22
22
|
|
23
23
|
private _fetching = false;
|
24
|
-
private _vouch
|
25
|
-
private _template
|
24
|
+
private _vouch?: EmbedProps['data'];
|
25
|
+
private _template?: TemplateInstance;
|
26
26
|
|
27
27
|
set fetching(value) {
|
28
28
|
if (this._fetching !== value) {
|
@@ -86,8 +86,8 @@ class FetcherController {
|
|
86
86
|
this.host,
|
87
87
|
async ([env, apiKey, data, vouchId, templateId]: TaskDeps) => {
|
88
88
|
try {
|
89
|
-
this.vouch =
|
90
|
-
this.template =
|
89
|
+
this.vouch = undefined;
|
90
|
+
this.template = undefined;
|
91
91
|
|
92
92
|
if (data) {
|
93
93
|
const template = await this.getTemplate(env, apiKey, templateId);
|
@@ -14,10 +14,7 @@ import { TrackingController } from './controllers/tracking';
|
|
14
14
|
|
15
15
|
import '@vouchfor/media-player';
|
16
16
|
|
17
|
-
type EmbedProps = Pick<
|
18
|
-
MediaPlayerProps,
|
19
|
-
'data' | 'resolution' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'
|
20
|
-
> & {
|
17
|
+
type EmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {
|
21
18
|
env: Environment;
|
22
19
|
apiKey: string;
|
23
20
|
vouchId?: string;
|
@@ -35,12 +32,10 @@ class Embed extends LitElement {
|
|
35
32
|
@property({ type: String }) env: EmbedProps['env'] = 'prod';
|
36
33
|
@property({ type: String }) apiKey: EmbedProps['apiKey'] = '';
|
37
34
|
|
35
|
+
@property({ type: Array }) controls: EmbedProps['controls'];
|
38
36
|
@property({ type: String }) preload: EmbedProps['preload'] = 'auto';
|
39
37
|
@property({ type: Boolean }) autoplay: EmbedProps['autoplay'] = false;
|
40
|
-
|
41
|
-
@property({ type: Number }) resolution: EmbedProps['resolution'] = 1080;
|
42
38
|
@property({ type: Number }) aspectRatio: EmbedProps['aspectRatio'] = 0;
|
43
|
-
@property({ type: Array }) controls: EmbedProps['controls'];
|
44
39
|
|
45
40
|
private eventController = new EventForwardController(this, [
|
46
41
|
'durationchange',
|
@@ -78,7 +73,7 @@ class Embed extends LitElement {
|
|
78
73
|
return this._fetcherController.vouch;
|
79
74
|
}
|
80
75
|
|
81
|
-
get template(): TemplateInstance |
|
76
|
+
get template(): TemplateInstance | undefined {
|
82
77
|
return this._fetcherController.template;
|
83
78
|
}
|
84
79
|
|
@@ -183,7 +178,6 @@ class Embed extends LitElement {
|
|
183
178
|
?loading=${this.fetching}
|
184
179
|
.data=${this.vouch}
|
185
180
|
.template=${this.template}
|
186
|
-
resolution=${ifDefined(this.resolution)}
|
187
181
|
aspectRatio=${ifDefined(this.aspectRatio)}
|
188
182
|
preload=${ifDefined(this.preload)}
|
189
183
|
.controls=${this.controls}
|