@vouchfor/embeds 0.0.0-experiment.0796c7f → 0.0.0-experiment.0a5555c
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/es/embeds.js +12 -5
- package/dist/es/embeds.js.map +1 -1
- package/dist/es/src/components/PlayerEmbed/index.d.ts +2 -0
- package/dist/iife/dialog-embed/embed.iife.js +165 -167
- package/dist/iife/dialog-embed/embed.iife.js.map +1 -1
- package/dist/iife/embeds.iife.js +164 -166
- package/dist/iife/embeds.iife.js.map +1 -1
- package/dist/iife/player-embed/embed.iife.js +154 -156
- package/dist/iife/player-embed/embed.iife.js.map +1 -1
- package/package.json +6 -5
- package/src/components/PlayerEmbed/MultiEmbed.stories.ts +135 -0
- package/src/components/PlayerEmbed/index.ts +9 -0
- package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +1 -1
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.0a5555c",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "Aaron Williams",
|
6
6
|
"main": "dist/es/embeds.js",
|
@@ -33,7 +33,8 @@
|
|
33
33
|
"storybook": "yarn prebuild && storybook dev -p 6007",
|
34
34
|
"prebuild": "yarn build:deps && yarn generate:manifest",
|
35
35
|
"test": "rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner",
|
36
|
-
"test:ci": "yarn test --config web-test-runner.ci.config.js"
|
36
|
+
"test:ci": "yarn test --config web-test-runner.ci.config.js",
|
37
|
+
"test:watch": "yarn test --watch"
|
37
38
|
},
|
38
39
|
"lint-staged": {
|
39
40
|
"**/*.{ts,tsx,js}": "eslint --fix --quiet",
|
@@ -42,8 +43,8 @@
|
|
42
43
|
"dependencies": {
|
43
44
|
"@a11y/focus-trap": "^1.0.5",
|
44
45
|
"@lit/task": "^1.0.0",
|
45
|
-
"@vouchfor/canvas-video": "0.0.0-experiment.
|
46
|
-
"@vouchfor/media-player": "0.0.0-experiment.
|
46
|
+
"@vouchfor/canvas-video": "0.0.0-experiment.0a5555c",
|
47
|
+
"@vouchfor/media-player": "0.0.0-experiment.0a5555c",
|
47
48
|
"uuid": "^9.0.1"
|
48
49
|
},
|
49
50
|
"peerDependencies": {
|
@@ -62,7 +63,7 @@
|
|
62
63
|
"@types/mocha": "^10.0.6",
|
63
64
|
"@vouchfor/eslint-config": "^1.0.1",
|
64
65
|
"@vouchfor/prettier-config": "^1.0.1",
|
65
|
-
"@vouchfor/video-utils": "0.0.0-experiment.
|
66
|
+
"@vouchfor/video-utils": "0.0.0-experiment.0a5555c",
|
66
67
|
"@web/dev-server-esbuild": "^1.0.2",
|
67
68
|
"@web/test-runner": "^0.18.1",
|
68
69
|
"@web/test-runner-browserstack": "^0.7.1",
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import { html } from 'lit';
|
2
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
3
|
+
|
4
|
+
import type { PlayerEmbedProps } from '.';
|
5
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
6
|
+
|
7
|
+
import '.';
|
8
|
+
|
9
|
+
type MultiEmbedArgs = PlayerEmbedProps & {
|
10
|
+
apiKey1?: string;
|
11
|
+
apiKey2?: string;
|
12
|
+
apiKey3?: string;
|
13
|
+
vouchId1?: string;
|
14
|
+
vouchId2?: string;
|
15
|
+
vouchId3?: string;
|
16
|
+
showVouch?: boolean;
|
17
|
+
};
|
18
|
+
|
19
|
+
const _MultiEmbed = ({
|
20
|
+
vouchId1,
|
21
|
+
vouchId2,
|
22
|
+
vouchId3,
|
23
|
+
templateId,
|
24
|
+
questions,
|
25
|
+
preload,
|
26
|
+
autoplay,
|
27
|
+
env,
|
28
|
+
apiKey1,
|
29
|
+
apiKey2,
|
30
|
+
apiKey3,
|
31
|
+
controls,
|
32
|
+
aspectRatio
|
33
|
+
}: MultiEmbedArgs) => {
|
34
|
+
return html`
|
35
|
+
<div style="height: 33vh">
|
36
|
+
<vouch-embed-player
|
37
|
+
env=${ifDefined(env)}
|
38
|
+
apiKey=${ifDefined(apiKey1)}
|
39
|
+
vouchId=${ifDefined(vouchId1)}
|
40
|
+
templateId=${ifDefined(templateId)}
|
41
|
+
.questions=${questions}
|
42
|
+
.controls=${controls}
|
43
|
+
?autoplay=${autoplay}
|
44
|
+
preload=${ifDefined(preload)}
|
45
|
+
aspectRatio=${ifDefined(aspectRatio)}
|
46
|
+
@error=${console.log}
|
47
|
+
></vouch-embed-player>
|
48
|
+
</div>
|
49
|
+
<div style="height: 33vh">
|
50
|
+
<vouch-embed-player
|
51
|
+
env=${ifDefined(env)}
|
52
|
+
apiKey=${ifDefined(apiKey2)}
|
53
|
+
vouchId=${ifDefined(vouchId2)}
|
54
|
+
templateId=${ifDefined(templateId)}
|
55
|
+
.questions=${questions}
|
56
|
+
.controls=${controls}
|
57
|
+
?autoplay=${autoplay}
|
58
|
+
preload=${ifDefined(preload)}
|
59
|
+
aspectRatio=${ifDefined(aspectRatio)}
|
60
|
+
@error=${console.log}
|
61
|
+
></vouch-embed-player>
|
62
|
+
</div>
|
63
|
+
<div style="height: 33vh">
|
64
|
+
<vouch-embed-player
|
65
|
+
env=${ifDefined(env)}
|
66
|
+
apiKey=${ifDefined(apiKey3)}
|
67
|
+
vouchId=${ifDefined(vouchId3)}
|
68
|
+
templateId=${ifDefined(templateId)}
|
69
|
+
.questions=${questions}
|
70
|
+
.controls=${controls}
|
71
|
+
?autoplay=${autoplay}
|
72
|
+
preload=${ifDefined(preload)}
|
73
|
+
aspectRatio=${ifDefined(aspectRatio)}
|
74
|
+
@error=${console.log}
|
75
|
+
></vouch-embed-player>
|
76
|
+
</div>
|
77
|
+
`;
|
78
|
+
};
|
79
|
+
|
80
|
+
// More on how to set up stories at: https://storybook.js.org/docs/web-components/writing-stories/introduction
|
81
|
+
const meta = {
|
82
|
+
title: 'Embeds',
|
83
|
+
tags: ['autodocs'],
|
84
|
+
render: (args) => _MultiEmbed(args),
|
85
|
+
component: 'vouch-embed-player'
|
86
|
+
} satisfies Meta<PlayerEmbedProps>;
|
87
|
+
|
88
|
+
type Story = StoryObj<MultiEmbedArgs>;
|
89
|
+
|
90
|
+
const MultiPlayer: Story = {
|
91
|
+
args: {
|
92
|
+
env: 'dev',
|
93
|
+
apiKey1: 'TVik9uTMgE-PD25UTHIS6gyl0hMBWC7AT4dkpdlLBT4VIfDWZJrQiCk6Ak7m1',
|
94
|
+
vouchId1: '6JQEIPeStt',
|
95
|
+
apiKey2: 'TVik9uTMgE-PD25UTHIS6gyl0hMBWC7AT4dkpdlLBT4VIfDWZJrQiCk6Ak7m1',
|
96
|
+
vouchId2: '6JQEIPeStt',
|
97
|
+
apiKey3: 'TVik9uTMgE-PD25UTHIS6gyl0hMBWC7AT4dkpdlLBT4VIfDWZJrQiCk6Ak7m1',
|
98
|
+
vouchId3: '6JQEIPeStt',
|
99
|
+
templateId: '357fc118-e179-4171-9446-ff2b8e9d1b29',
|
100
|
+
questions: [],
|
101
|
+
aspectRatio: 0,
|
102
|
+
preload: 'none',
|
103
|
+
autoplay: false,
|
104
|
+
controls: [
|
105
|
+
'progress',
|
106
|
+
'play-large',
|
107
|
+
'navigation',
|
108
|
+
'play',
|
109
|
+
'volume',
|
110
|
+
'current-time',
|
111
|
+
'duration',
|
112
|
+
'speed',
|
113
|
+
'captions',
|
114
|
+
'fullscreen',
|
115
|
+
'preview',
|
116
|
+
'languages'
|
117
|
+
]
|
118
|
+
},
|
119
|
+
argTypes: {
|
120
|
+
env: {
|
121
|
+
control: 'radio',
|
122
|
+
options: ['local', 'dev', 'staging', 'prod']
|
123
|
+
},
|
124
|
+
preload: {
|
125
|
+
control: 'radio',
|
126
|
+
options: ['auto', 'none']
|
127
|
+
}
|
128
|
+
},
|
129
|
+
parameters: {
|
130
|
+
layout: 'fullscreen'
|
131
|
+
}
|
132
|
+
};
|
133
|
+
|
134
|
+
export default meta;
|
135
|
+
export { MultiPlayer };
|
@@ -5,6 +5,7 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
5
|
|
6
6
|
import type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';
|
7
7
|
import type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';
|
8
|
+
import type { PropertyValueMap } from 'lit';
|
8
9
|
import type { Environment } from '~/utils/env';
|
9
10
|
|
10
11
|
import { EventForwardController } from './controllers/event-forwarder';
|
@@ -69,6 +70,7 @@ class PlayerEmbed extends LitElement {
|
|
69
70
|
'seeked',
|
70
71
|
'timeupdate',
|
71
72
|
'volumechange',
|
73
|
+
'processing',
|
72
74
|
'waiting',
|
73
75
|
|
74
76
|
'video:loadeddata',
|
@@ -221,6 +223,13 @@ class PlayerEmbed extends LitElement {
|
|
221
223
|
return null;
|
222
224
|
}
|
223
225
|
|
226
|
+
protected willUpdate(changedProperties: PropertyValueMap<PlayerEmbedProps>) {
|
227
|
+
// If the vouch this embed is pointing to changes then reset the player
|
228
|
+
if (changedProperties.has('vouchId') && this.vouchId !== changedProperties.get('vouchId')) {
|
229
|
+
this.reset(0, false);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
224
233
|
render() {
|
225
234
|
return html`
|
226
235
|
${this._renderStyles()}
|
@@ -28,7 +28,7 @@ function playerLoaded(player: PlayerEmbed) {
|
|
28
28
|
}
|
29
29
|
|
30
30
|
describe('Embeds', () => {
|
31
|
-
it('
|
31
|
+
it('Sends correct tracking events', async () => {
|
32
32
|
const player = await fixture<PlayerEmbed>(
|
33
33
|
html`<vouch-embed-player env="dev" .data=${data} aspectratio=${1}></vouch-embed-player>`
|
34
34
|
);
|