@vouchfor/embeds-legacy 0.0.0-experiment.978cfad → 0.0.0-experiment.99aa8a4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vouchfor/embeds-legacy",
3
- "version": "0.0.0-experiment.978cfad",
3
+ "version": "0.0.0-experiment.99aa8a4",
4
4
  "license": "MIT",
5
5
  "author": "Aaron Williams",
6
6
  "main": "dist/es/embeds-legacy.js",
@@ -44,8 +44,8 @@
44
44
  "dependencies": {
45
45
  "@a11y/focus-trap": "^1.0.5",
46
46
  "@lit/task": "^1.0.2",
47
- "@vouchfor/canvas-video-legacy": "0.0.0-experiment.978cfad",
48
- "@vouchfor/media-player-legacy": "0.0.0-experiment.978cfad",
47
+ "@vouchfor/canvas-video-legacy": "0.0.0-experiment.99aa8a4",
48
+ "@vouchfor/media-player-legacy": "0.0.0-experiment.99aa8a4",
49
49
  "uuid": "^9.0.1"
50
50
  },
51
51
  "peerDependencies": {
@@ -64,7 +64,7 @@
64
64
  "@types/mocha": "^10.0.10",
65
65
  "@vouchfor/eslint-config": "^1.0.5",
66
66
  "@vouchfor/prettier-config": "^1.0.1",
67
- "@vouchfor/video-utils-legacy": "0.0.0-experiment.978cfad",
67
+ "@vouchfor/video-utils-legacy": "0.0.0-experiment.99aa8a4",
68
68
  "@web/dev-server-esbuild": "^1.0.4",
69
69
  "@web/test-runner": "^0.20.1",
70
70
  "@web/test-runner-browserstack": "^0.8.0",
@@ -1,3 +1,4 @@
1
+ import { resolveDefaultLanguage } from '@vouchfor/media-player-legacy';
1
2
  import { css, html, LitElement } from 'lit';
2
3
  import { customElement, property, state } from 'lit/decorators.js';
3
4
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -11,13 +12,11 @@ import type { Environment } from '~/utils/env';
11
12
  import { EventForwardController } from './controllers/event-forwarder';
12
13
  import { FetcherController } from './controllers/fetcher';
13
14
  import { TrackingController } from './controllers/tracking';
15
+ import { getEnvUrls } from '~/utils/env';
14
16
 
15
17
  import '@vouchfor/media-player-legacy';
16
18
 
17
- type PlayerEmbedProps = Pick<
18
- MediaPlayerProps,
19
- 'data' | 'aspectRatio' | 'language' | 'preload' | 'autoplay' | 'controls'
20
- > & {
19
+ type PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {
21
20
  env: Environment;
22
21
  apiKey: string;
23
22
  disableTracking?: boolean;
@@ -53,7 +52,6 @@ class PlayerEmbed extends LitElement {
53
52
  @property({ type: String }) preload: PlayerEmbedProps['preload'] = 'auto';
54
53
  @property({ type: Boolean }) autoplay: PlayerEmbedProps['autoplay'] = false;
55
54
  @property({ type: Number }) aspectRatio: PlayerEmbedProps['aspectRatio'] = 0;
56
- @property({ type: String }) language?: MediaPlayerProps['language'];
57
55
  @property({ type: String }) senderId?: PlayerEmbedProps['senderId'];
58
56
 
59
57
  private eventController = new EventForwardController(this, [
@@ -242,9 +240,12 @@ class PlayerEmbed extends LitElement {
242
240
  ?loading=${this.fetching}
243
241
  .data=${this.vouch}
244
242
  .template=${this.template}
243
+ .translateBaseUrl=${getEnvUrls(this.env).translateApiUrl}
244
+ .defaultLanguage=${this.vouch?.questions?.items?.[0]?.answer?.transcription?.language
245
+ ? resolveDefaultLanguage(this.vouch.questions.items[0].answer.transcription.language)
246
+ : undefined}
245
247
  aspectRatio=${ifDefined(this.aspectRatio)}
246
248
  preload=${ifDefined(this.preload)}
247
- language=${ifDefined(this.language)}
248
249
  .controls=${this.controls}
249
250
  ></vmp-legacy-media-player>
250
251
  `;
package/src/utils/env.ts CHANGED
@@ -4,6 +4,7 @@ type GetEnvUrlsReturn = {
4
4
  videoUrl: string;
5
5
  publicApiUrl: string;
6
6
  embedApiUrl: string;
7
+ translateApiUrl: string;
7
8
  };
8
9
 
9
10
  const devVideoUrl = 'https://d2rxhdlm2q91uk.cloudfront.net';
@@ -19,6 +20,10 @@ const devEmbedApiUrl = 'https://embed-dev.vouchfor.com/v2';
19
20
  const stagingEmbedApiUrl = 'https://embed-staging.vouchfor.com/v2';
20
21
  const prodEmbedApiUrl = 'https://embed.vouchfor.com/v2';
21
22
 
23
+ const devTranslateApiUrl = 'https://public-dev.vouchfor.com';
24
+ const stagingTranslateApiUrl = 'https://public-staging.vouchfor.com';
25
+ const prodTranslateApiUrl = 'https://public.vouchfor.com';
26
+
22
27
  // We are handling the case where env is an unknown string so the ts error is a lie
23
28
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
29
  // @ts-ignore
@@ -31,7 +36,8 @@ function getEnvUrls(env: Environment): GetEnvUrlsReturn {
31
36
  return {
32
37
  videoUrl: devVideoUrl,
33
38
  publicApiUrl: devPublicApiUrl,
34
- embedApiUrl: localEmbedApiUrl
39
+ embedApiUrl: localEmbedApiUrl,
40
+ translateApiUrl: devTranslateApiUrl
35
41
  };
36
42
  }
37
43
 
@@ -39,7 +45,8 @@ function getEnvUrls(env: Environment): GetEnvUrlsReturn {
39
45
  return {
40
46
  videoUrl: devVideoUrl,
41
47
  publicApiUrl: devPublicApiUrl,
42
- embedApiUrl: devEmbedApiUrl
48
+ embedApiUrl: devEmbedApiUrl,
49
+ translateApiUrl: devTranslateApiUrl
43
50
  };
44
51
  }
45
52
 
@@ -47,7 +54,8 @@ function getEnvUrls(env: Environment): GetEnvUrlsReturn {
47
54
  return {
48
55
  videoUrl: stagingVideoUrl,
49
56
  publicApiUrl: stagingPublicApiUrl,
50
- embedApiUrl: stagingEmbedApiUrl
57
+ embedApiUrl: stagingEmbedApiUrl,
58
+ translateApiUrl: stagingTranslateApiUrl
51
59
  };
52
60
  }
53
61
 
@@ -55,7 +63,8 @@ function getEnvUrls(env: Environment): GetEnvUrlsReturn {
55
63
  return {
56
64
  videoUrl: prodVideoUrl,
57
65
  publicApiUrl: prodPublicApiUrl,
58
- embedApiUrl: prodEmbedApiUrl
66
+ embedApiUrl: prodEmbedApiUrl,
67
+ translateApiUrl: prodTranslateApiUrl
59
68
  };
60
69
  }
61
70
  }