@vouchfor/embeds 0.0.0-experiment.79ff9cf → 0.0.0-experiment.acfa1ff

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,78 @@
1
+ type Environment = 'dev' | 'staging' | 'prod';
2
+
3
+ type GetEnvUrlsReturn = {
4
+ marketingUrl: string;
5
+ videoUrl: string;
6
+ publicApiUrl: string;
7
+ embedApiUrl: string;
8
+ publicRecorderUrl: string;
9
+ };
10
+
11
+ const marketingUrl = 'https://vouchfor.com';
12
+
13
+ const devVideoUrl = 'https://d2rxhdlm2q91uk.cloudfront.net';
14
+ const stagingVideoUrl = 'https://d1ix11aj5kfygl.cloudfront.net';
15
+ const prodVideoUrl = 'https://d157jlwnudd93d.cloudfront.net';
16
+
17
+ const devPublicApiUrl = 'https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev';
18
+ const stagingPublicApiUrl = 'https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging';
19
+ const prodPublicApiUrl = 'https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod';
20
+
21
+ const devEmbedApiUrl = 'http://localhost:6060/v1';
22
+ const stagingEmbedApiUrl = 'https://embed-staging.vouchfor.com/v1';
23
+ const prodEmbedApiUrl = 'https://embed.vouchfor.com/v1';
24
+
25
+ const devPublicRecorderUrl = 'https://dev.vouchfor.com';
26
+ const stagingPublicRecorderUrl = 'https://staging.vouchfor.com';
27
+ const prodPublicRecorderUrl = 'https://app.vouchfor.com';
28
+
29
+ // We are handling the case where env is an unknown string so the ts error is a lie
30
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
31
+ // @ts-ignore
32
+ function getEnvUrls(env: Environment): GetEnvUrlsReturn {
33
+ if (!['dev', 'staging', 'prod'].includes(env)) {
34
+ throw new Error(`Unknown environment: ${env}`);
35
+ }
36
+
37
+ if (env === 'dev') {
38
+ return {
39
+ marketingUrl,
40
+ videoUrl: devVideoUrl,
41
+ publicApiUrl: devPublicApiUrl,
42
+ embedApiUrl: devEmbedApiUrl,
43
+ publicRecorderUrl: devPublicRecorderUrl
44
+ };
45
+ }
46
+
47
+ if (env === 'staging') {
48
+ return {
49
+ marketingUrl,
50
+ videoUrl: stagingVideoUrl,
51
+ publicApiUrl: stagingPublicApiUrl,
52
+ embedApiUrl: stagingEmbedApiUrl,
53
+ publicRecorderUrl: stagingPublicRecorderUrl
54
+ };
55
+ }
56
+
57
+ if (env === 'prod') {
58
+ return {
59
+ marketingUrl,
60
+ videoUrl: prodVideoUrl,
61
+ publicApiUrl: prodPublicApiUrl,
62
+ embedApiUrl: prodEmbedApiUrl,
63
+ publicRecorderUrl: prodPublicRecorderUrl
64
+ };
65
+ }
66
+ }
67
+
68
+ export {
69
+ marketingUrl,
70
+ devEmbedApiUrl,
71
+ stagingEmbedApiUrl,
72
+ prodEmbedApiUrl,
73
+ devPublicRecorderUrl,
74
+ stagingPublicRecorderUrl,
75
+ prodPublicRecorderUrl,
76
+ getEnvUrls
77
+ };
78
+ export type { Environment };
@@ -0,0 +1,13 @@
1
+ function forwardEvent(type: string, fromElement: HTMLElement, toElement: HTMLElement) {
2
+ function forwarder(event: Event) {
3
+ toElement.dispatchEvent(new CustomEvent(event.type, event));
4
+ }
5
+
6
+ fromElement.addEventListener(type, forwarder);
7
+
8
+ return () => {
9
+ fromElement.removeEventListener(type, forwarder);
10
+ };
11
+ }
12
+
13
+ export { forwardEvent };
@@ -1,12 +0,0 @@
1
- import { MediaPlayer } from '@vouchfor/media-player';
2
- import type { MediaPlayerProps } from '@vouchfor/media-player';
3
- type InlineEmbedProps = MediaPlayerProps;
4
- declare class InlineEmbed extends MediaPlayer {
5
- }
6
- declare global {
7
- interface HTMLElementTagNameMap {
8
- 'vembed-inline': InlineEmbed;
9
- }
10
- }
11
- export { InlineEmbed };
12
- export type { InlineEmbedProps };
@@ -1,2 +0,0 @@
1
- export { InlineEmbed } from './InlineEmbed';
2
- export type { InlineEmbedProps } from './InlineEmbed';