@vouchfor/embeds 0.0.0-experiment.1f98c5e → 0.0.0-experiment.20e29ac

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/dist/es/embeds.js +1151 -7
  2. package/dist/es/embeds.js.map +1 -1
  3. package/dist/es/src/components/DialogEmbed/DialogOverlay.d.ts +20 -0
  4. package/dist/es/src/components/DialogEmbed/DialogPortal.d.ts +36 -0
  5. package/dist/es/src/components/DialogEmbed/index.d.ts +38 -0
  6. package/dist/es/src/components/PlayerEmbed/controllers/event-forwarder.d.ts +15 -0
  7. package/dist/es/src/components/{Embed → PlayerEmbed}/controllers/fetcher.d.ts +4 -4
  8. package/dist/es/src/components/{Embed/controllers/tracking.d.ts → PlayerEmbed/controllers/tracking/index.d.ts} +14 -11
  9. package/dist/es/src/components/PlayerEmbed/controllers/tracking/utils.d.ts +17 -0
  10. package/dist/es/src/components/{Embed → PlayerEmbed}/index.d.ts +29 -22
  11. package/dist/es/src/components/PlayerEmbed/tests/data.d.ts +4 -0
  12. package/dist/es/src/components/PlayerEmbed/tests/media-data.d.ts +19 -0
  13. package/dist/es/src/index.d.ts +2 -1
  14. package/dist/iife/dialog-embed/embed.iife.js +1757 -0
  15. package/dist/iife/dialog-embed/embed.iife.js.map +1 -0
  16. package/dist/iife/embeds.iife.js +580 -381
  17. package/dist/iife/embeds.iife.js.map +1 -1
  18. package/dist/iife/player-embed/embed.iife.js +1619 -0
  19. package/dist/iife/player-embed/embed.iife.js.map +1 -0
  20. package/package.json +43 -32
  21. package/src/components/DialogEmbed/Dialog.stories.ts +91 -0
  22. package/src/components/DialogEmbed/DialogOverlay.ts +131 -0
  23. package/src/components/DialogEmbed/DialogPortal.ts +126 -0
  24. package/src/components/DialogEmbed/index.ts +97 -0
  25. package/src/components/PlayerEmbed/MultiEmbed.stories.ts +135 -0
  26. package/src/components/{Embed/Embed.stories.ts → PlayerEmbed/PlayerEmbed.stories.ts} +30 -16
  27. package/src/components/{Embed → PlayerEmbed}/controllers/event-forwarder.ts +6 -5
  28. package/src/components/{Embed → PlayerEmbed}/controllers/fetcher.ts +11 -11
  29. package/src/components/{Embed/controllers/tracking.ts → PlayerEmbed/controllers/tracking/index.ts} +47 -118
  30. package/src/components/PlayerEmbed/controllers/tracking/utils.ts +95 -0
  31. package/src/components/{Embed → PlayerEmbed}/index.ts +71 -23
  32. package/src/components/PlayerEmbed/tests/PlayerEmbed.spec.ts +87 -0
  33. package/src/components/PlayerEmbed/tests/data.ts +227 -0
  34. package/src/components/PlayerEmbed/tests/media-data.ts +22 -0
  35. package/src/index.ts +2 -1
  36. package/dist/es/browser-95c87c48.js +0 -433
  37. package/dist/es/browser-95c87c48.js.map +0 -1
  38. package/dist/es/index-9dd8a4fa.js +0 -9950
  39. package/dist/es/index-9dd8a4fa.js.map +0 -1
  40. package/src/components/Embed/Embed.spec.ts +0 -17
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@vouchfor/embeds",
3
- "version": "0.0.0-experiment.1f98c5e",
3
+ "version": "0.0.0-experiment.20e29ac",
4
4
  "license": "MIT",
5
5
  "author": "Aaron Williams",
6
6
  "main": "dist/es/embeds.js",
7
7
  "module": "dist/es/embeds.js",
8
8
  "type": "module",
9
- "types": "dist/es/index.d.ts",
9
+ "types": "dist/es/src/index.d.ts",
10
10
  "exports": {
11
11
  ".": "./dist/es/embeds.js"
12
12
  },
@@ -15,9 +15,13 @@
15
15
  "tag": "experiment",
16
16
  "access": "public"
17
17
  },
18
+ "engines": {
19
+ "node": ">=18.18.0"
20
+ },
18
21
  "scripts": {
19
- "build": "rm -rf dist && tsc && vite build --mode iife && vite build --mode es",
22
+ "build": "rm -rf dist && tsc && yarn build:self",
20
23
  "build:deps": "yarn --cwd ../media-player build",
24
+ "build:self": "vite build --mode iife && vite build --mode es && node scripts/build.cjs",
21
25
  "build:package": "yarn build",
22
26
  "build:storybook": "yarn prebuild && storybook build",
23
27
  "generate:manifest": "wca src --outFile custom-elements.json",
@@ -29,49 +33,56 @@
29
33
  "storybook": "yarn prebuild && storybook dev -p 6007",
30
34
  "prebuild": "yarn build:deps && yarn generate:manifest",
31
35
  "test": "rm -rf test/lib && yarn prebuild && vite build --mode test && web-test-runner",
32
- "test:ci": "yarn test"
36
+ "test:ci": "yarn test --config web-test-runner.ci.config.js",
37
+ "test:watch": "yarn test --watch"
33
38
  },
34
39
  "lint-staged": {
35
40
  "**/*.{ts,tsx,js}": "eslint --fix --quiet",
36
41
  "**/*.{md,json,yml}": "prettier --write"
37
42
  },
38
43
  "dependencies": {
44
+ "@a11y/focus-trap": "^1.0.5",
39
45
  "@lit/task": "^1.0.0",
40
- "@vouchfor/media-player": "0.0.0-experiment.1f98c5e",
46
+ "@vouchfor/canvas-video": "0.0.0-experiment.20e29ac",
47
+ "@vouchfor/media-player": "0.0.0-experiment.20e29ac",
41
48
  "uuid": "^9.0.1"
42
49
  },
43
50
  "peerDependencies": {
44
- "lit": "^3.1.0"
51
+ "lit": "^3.1.2"
45
52
  },
46
53
  "devDependencies": {
47
54
  "@esm-bundle/chai": "^4.3.4-fix.0",
48
- "@open-wc/testing": "^3.2.0",
49
- "@storybook/addon-essentials": "^7.4.5",
50
- "@storybook/addon-links": "^7.4.5",
51
- "@storybook/blocks": "^7.4.5",
52
- "@storybook/web-components": "^7.4.5",
53
- "@storybook/web-components-vite": "^7.4.5",
54
- "@types/mocha": "^10.0.1",
55
- "@vouchfor/eslint-config": "^1.0.0",
56
- "@vouchfor/prettier-config": "^1.0.0",
57
- "@web/dev-server-esbuild": "^0.4.1",
58
- "@web/test-runner": "^0.17.1",
59
- "@web/test-runner-browserstack": "^0.6.1",
60
- "@web/test-runner-mocha": "^0.8.1",
61
- "@web/test-runner-playwright": "^0.10.1",
62
- "dotenv": "^16.3.1",
63
- "eslint": "^8.50.0",
64
- "eslint-plugin-import": "^2.28.1",
65
- "lint-staged": "^14.0.1",
66
- "lit": "^3.1.0",
67
- "prettier": "^3.0.3",
55
+ "@open-wc/testing": "^4.0.0",
56
+ "@storybook/addon-essentials": "^8.0.4",
57
+ "@storybook/addon-links": "^8.0.4",
58
+ "@storybook/blocks": "^8.0.4",
59
+ "@storybook/web-components": "^8.0.4",
60
+ "@storybook/web-components-vite": "^8.0.4",
61
+ "@svgr/core": "^8.1.0",
62
+ "@types/flat": "^5.0.5",
63
+ "@types/mocha": "^10.0.6",
64
+ "@vouchfor/eslint-config": "^1.0.1",
65
+ "@vouchfor/prettier-config": "^1.0.1",
66
+ "@vouchfor/video-utils": "0.0.0-experiment.20e29ac",
67
+ "@web/dev-server-esbuild": "^1.0.2",
68
+ "@web/test-runner": "^0.18.1",
69
+ "@web/test-runner-browserstack": "^0.7.1",
70
+ "@web/test-runner-mocha": "^0.9.0",
71
+ "@web/test-runner-playwright": "^0.11.0",
72
+ "glob": "^10.3.10",
73
+ "lint-staged": "^15.2.2",
74
+ "lit": "^3.1.2",
75
+ "lodash": "^4.17.21",
68
76
  "react": "^18.2.0",
69
77
  "react-dom": "^18.2.0",
70
- "storybook": "^7.4.5",
71
- "typescript": "^5.1.3",
72
- "vite": "^4.4.9",
73
- "vite-plugin-commonjs": "^0.10.0",
74
- "vite-plugin-dts": "^3.6.0",
75
- "web-component-analyzer": "^1.1.7"
78
+ "rollup-plugin-tla": "^0.0.2",
79
+ "sinon": "^17.0.1",
80
+ "storybook": "^8.0.4",
81
+ "svgson": "^5.3.1",
82
+ "typescript": "^5.4.3",
83
+ "vite": "^5.2.2",
84
+ "vite-plugin-commonjs": "^0.10.1",
85
+ "vite-plugin-dts": "^3.7.3",
86
+ "web-component-analyzer": "^2.0.0"
76
87
  }
77
88
  }
@@ -0,0 +1,91 @@
1
+ import { html } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+
4
+ import type { DialogEmbedProps } from '.';
5
+ import type { Meta, StoryObj } from '@storybook/web-components';
6
+
7
+ import '.';
8
+
9
+ type DialogEmbedArgs = DialogEmbedProps & {
10
+ showVouch?: boolean;
11
+ };
12
+
13
+ const _DialogEmbed = ({
14
+ vouchId,
15
+ templateId,
16
+ questions,
17
+ preload,
18
+ autoplay,
19
+ env,
20
+ apiKey,
21
+ controls,
22
+ aspectRatio
23
+ }: DialogEmbedArgs) => {
24
+ return html`
25
+ <div style="padding: 20px;">
26
+ <vouch-embed-dialog
27
+ env=${ifDefined(env)}
28
+ apiKey=${ifDefined(apiKey)}
29
+ vouchId=${ifDefined(vouchId)}
30
+ templateId=${ifDefined(templateId)}
31
+ .questions=${questions}
32
+ .controls=${controls}
33
+ ?autoplay=${autoplay}
34
+ preload=${ifDefined(preload)}
35
+ aspectRatio=${ifDefined(aspectRatio)}
36
+ @error=${console.log}
37
+ ></vouch-embed-dialog>
38
+ <vouch-embed-dialog
39
+ env=${ifDefined(env)}
40
+ apiKey=${ifDefined(apiKey)}
41
+ vouchId=${ifDefined(vouchId)}
42
+ templateId=${ifDefined(templateId)}
43
+ .questions=${questions}
44
+ .controls=${controls}
45
+ ?autoplay=${autoplay}
46
+ preload=${ifDefined(preload)}
47
+ aspectRatio=${ifDefined(aspectRatio)}
48
+ @error=${console.log}
49
+ ></vouch-embed-dialog>
50
+ </div>
51
+ `;
52
+ };
53
+
54
+ // More on how to set up stories at: https://storybook.js.org/docs/web-components/writing-stories/introduction
55
+ const meta = {
56
+ title: 'Dialog',
57
+ tags: ['autodocs'],
58
+ render: (args) => _DialogEmbed(args),
59
+ component: 'vouch-embed-dialog'
60
+ } satisfies Meta<DialogEmbedProps>;
61
+
62
+ type Story = StoryObj<DialogEmbedArgs>;
63
+
64
+ const Dialog: Story = {
65
+ args: {
66
+ env: 'dev',
67
+ apiKey: 'TVik9uTMgE-PD25UTHIS6gyl0hMBWC7AT4dkpdlLBT4VIfDWZJrQiCk6Ak7m1',
68
+ vouchId: '6JQEIPeStt',
69
+ templateId: '357fc118-e179-4171-9446-ff2b8e9d1b29',
70
+ questions: [],
71
+ aspectRatio: 0,
72
+ preload: 'none',
73
+ autoplay: false
74
+ },
75
+ argTypes: {
76
+ env: {
77
+ control: 'radio',
78
+ options: ['local', 'dev', 'staging', 'prod']
79
+ },
80
+ preload: {
81
+ control: 'radio',
82
+ options: ['auto', 'none']
83
+ }
84
+ },
85
+ parameters: {
86
+ layout: 'fullscreen'
87
+ }
88
+ };
89
+
90
+ export default meta;
91
+ export { Dialog };
@@ -0,0 +1,131 @@
1
+ import { css, html, LitElement } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { styleMap } from 'lit/directives/style-map.js';
5
+
6
+ import type { DialogEmbedProps } from '.';
7
+
8
+ import '@a11y/focus-trap';
9
+
10
+ @customElement('vouch-embed-dialog-overlay')
11
+ class DialogOverlay extends LitElement {
12
+ static styles = [
13
+ css`
14
+ :host {
15
+ --vouch-media-player-border-radius: var(--vu-media-player-border-radius, 12px);
16
+ --overlay-background-color: var(--vu-overlay-background-color, black);
17
+ --overlay-background-opacity: var(--vu-overlay-background-opacity, 0.4);
18
+
19
+ --dialog-width: var(--vu-dialog-width, 890px);
20
+ --dialog-height: var(--vu-dialog-height, 500px);
21
+ }
22
+
23
+ .container {
24
+ position: fixed;
25
+ display: flex;
26
+ inset: 0;
27
+ opacity: 1;
28
+ z-index: 2147483647;
29
+ align-items: center;
30
+ justify-content: center;
31
+ transition: opacity 100ms ease-in;
32
+ }
33
+
34
+ .hidden {
35
+ opacity: 0;
36
+ pointer-events: none;
37
+ }
38
+
39
+ .background {
40
+ position: absolute;
41
+ inset: 0;
42
+ opacity: var(--overlay-background-opacity);
43
+ background-color: var(--overlay-background-color);
44
+ }
45
+
46
+ focus-trap {
47
+ display: flex;
48
+ align-items: center;
49
+ justify-content: center;
50
+ margin: 40px;
51
+ width: var(--dialog-width);
52
+ height: var(--dialog-height);
53
+ max-width: calc(100% - 80px);
54
+ max-height: calc(100% - 80px);
55
+ }
56
+
57
+ .video-frame {
58
+ position: relative;
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: center;
62
+ max-width: 100%;
63
+ max-height: 100%;
64
+ }
65
+
66
+ .video-frame.grow {
67
+ width: 100%;
68
+ height: 100%;
69
+ }
70
+
71
+ vmp-icon-button {
72
+ position: absolute;
73
+ top: 0;
74
+ right: 0;
75
+ margin: 10px;
76
+ }
77
+ `
78
+ ];
79
+
80
+ @property({ type: Boolean }) open = false;
81
+ @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;
82
+
83
+ render() {
84
+ return html`
85
+ <div
86
+ class=${classMap({
87
+ container: true,
88
+ hidden: !this.open
89
+ })}
90
+ >
91
+ <div
92
+ class="background"
93
+ @click=${() => this.dispatchEvent(new CustomEvent('overlay:click', { bubbles: true, composed: true }))}
94
+ ></div>
95
+ <focus-trap>
96
+ <div
97
+ class=${classMap({
98
+ 'video-frame': true,
99
+ grow: this.aspectRatio === 0
100
+ })}
101
+ style=${styleMap({
102
+ aspectRatio: this.aspectRatio
103
+ })}
104
+ >
105
+ <slot></slot>
106
+ <vmp-icon-button
107
+ icon="close"
108
+ rounded="full"
109
+ weight="heavy"
110
+ @click=${() => this.dispatchEvent(new CustomEvent('close:click', { bubbles: true, composed: true }))}
111
+ ></vmp-icon-button>
112
+ </div>
113
+ </focus-trap>
114
+ </div>
115
+ `;
116
+ }
117
+ }
118
+
119
+ declare global {
120
+ interface HTMLElementTagNameMap {
121
+ 'vouch-embed-dialog-overlay': DialogOverlay;
122
+ }
123
+
124
+ namespace JSX {
125
+ interface IntrinsicElements {
126
+ 'vouch-embed-dialog-overlay': DialogOverlay;
127
+ }
128
+ }
129
+ }
130
+
131
+ export { DialogOverlay };
@@ -0,0 +1,126 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { customElement, property, state } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { createRef, ref } from 'lit/directives/ref.js';
5
+ import { styleMap } from 'lit/directives/style-map.js';
6
+
7
+ import type { DialogEmbedProps } from '.';
8
+ import type { MediaPlayer } from '@vouchfor/media-player';
9
+
10
+ import './DialogOverlay';
11
+
12
+ @customElement('vouch-embed-dialog-portal')
13
+ class DialogPortal extends LitElement {
14
+ @property({ type: String }) vouchId: DialogEmbedProps['vouchId'];
15
+ @property({ type: String }) templateId: DialogEmbedProps['templateId'];
16
+ @property({ type: Array }) questions: DialogEmbedProps['questions'];
17
+
18
+ @property({ type: String }) env: DialogEmbedProps['env'] = 'prod';
19
+ @property({ type: String }) apiKey: DialogEmbedProps['apiKey'] = '';
20
+ @property({ type: Boolean }) disableTracking: DialogEmbedProps['disableTracking'] = false;
21
+ @property({ type: String }) trackingSource: DialogEmbedProps['trackingSource'] = 'embedded_player';
22
+
23
+ @property({ type: Array }) controls: DialogEmbedProps['controls'];
24
+ @property({ type: String }) preload: DialogEmbedProps['preload'] = 'none';
25
+ @property({ type: Boolean }) disableAutoplay: DialogEmbedProps['disableAutoplay'] = false;
26
+ @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;
27
+
28
+ private _mediaPlayerRef = createRef<MediaPlayer>();
29
+
30
+ @state() open = false;
31
+
32
+ private _handleToggle = ({ detail }: CustomEvent<string>) => {
33
+ // Because we have to attach this listener to the document since this element is portalled outside of the button,
34
+ // we also have to make sure that this player is actually the one we want to open and play by passing in an ID
35
+ // from the button wrapper parent and checking against that same ID we pass as the event detail
36
+ if (this.id === detail) {
37
+ this.open = !this.open;
38
+
39
+ if (this.open) {
40
+ if (!this.disableAutoplay && this._mediaPlayerRef?.value) {
41
+ this._mediaPlayerRef.value.muted = false;
42
+ this._mediaPlayerRef.value.play();
43
+ }
44
+ } else {
45
+ this._mediaPlayerRef?.value?.pause();
46
+ }
47
+ }
48
+ };
49
+
50
+ // We could do the same thing on close and check for the correct ID but it doesn't really matter
51
+ private _handleClose = () => {
52
+ this.open = false;
53
+ this._mediaPlayerRef?.value?.pause();
54
+ };
55
+
56
+ private _handleDocumentKeyUp = (e: KeyboardEvent) => {
57
+ if (e.key === 'Escape') {
58
+ this._handleClose();
59
+ }
60
+ };
61
+
62
+ connectedCallback(): void {
63
+ super.connectedCallback();
64
+ document.addEventListener('dialogembed:click', this._handleToggle);
65
+ document.addEventListener('keyup', this._handleDocumentKeyUp);
66
+ document.addEventListener('close:click', this._handleClose);
67
+ document.addEventListener('overlay:click', this._handleClose);
68
+ }
69
+
70
+ disconnectedCallback(): void {
71
+ super.disconnectedCallback();
72
+ document.removeEventListener('dialogembed:click', this._handleToggle);
73
+ document.removeEventListener('keyup', this._handleDocumentKeyUp);
74
+ document.removeEventListener('close:click', this._handleClose);
75
+ document.removeEventListener('overlay:click', this._handleClose);
76
+ }
77
+
78
+ protected createRenderRoot(): HTMLElement | DocumentFragment {
79
+ // We must create a new node here because portalling into the same node (document.body) causes the second
80
+ // element to overwrite the first for some reason (not behaviour really stated in the docs)
81
+ // I am fairly certain this function is only run once as the default behaviour creates the open shadow root
82
+ // and returns that shadow root in this function: https://lit.dev/docs/components/shadow-dom/#implementing-createrenderroot
83
+ const newNode = document.createElement('div');
84
+ document.body.appendChild(newNode);
85
+ return newNode;
86
+ }
87
+
88
+ render() {
89
+ return html`
90
+ <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>
91
+ <vouch-embed-player
92
+ ${ref(this._mediaPlayerRef)}
93
+ style=${styleMap({
94
+ maxWidth: '100%',
95
+ maxHeight: '100%'
96
+ })}
97
+ ?autoplay=${false}
98
+ vouchId=${ifDefined(this.vouchId)}
99
+ templateId=${ifDefined(this.templateId)}
100
+ .questions=${this.questions}
101
+ .controls=${this.controls}
102
+ env=${ifDefined(this.env)}
103
+ apiKey=${ifDefined(this.apiKey)}
104
+ ?disableTracking=${this.disableTracking}
105
+ trackingSource=${ifDefined(this.trackingSource)}
106
+ preload=${ifDefined(this.preload)}
107
+ aspectRatio=${this.aspectRatio}
108
+ ></vouch-embed-player>
109
+ </vouch-embed-dialog-overlay>
110
+ `;
111
+ }
112
+ }
113
+
114
+ declare global {
115
+ interface HTMLElementTagNameMap {
116
+ 'vouch-embed-dialog-portal': DialogPortal;
117
+ }
118
+
119
+ namespace JSX {
120
+ interface IntrinsicElements {
121
+ 'vouch-embed-dialog-portal': DialogPortal;
122
+ }
123
+ }
124
+ }
125
+
126
+ export { DialogPortal };
@@ -0,0 +1,97 @@
1
+ import { css, html, LitElement } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+
6
+ import type { PlayerEmbedProps } from '../PlayerEmbed';
7
+
8
+ import '../PlayerEmbed';
9
+ import './DialogPortal';
10
+
11
+ type DialogEmbedProps = Omit<PlayerEmbedProps, 'data'> & {
12
+ disableAutoplay?: boolean;
13
+ };
14
+
15
+ @customElement('vouch-embed-dialog')
16
+ class DialogEmbed extends LitElement {
17
+ static styles = [
18
+ css`
19
+ :host {
20
+ --vu-button-padding: 10px 20px;
21
+ --vu-button-background: #287179;
22
+ --vu-button-background-hover: #4faab2;
23
+
24
+ display: flex;
25
+ width: fit-content;
26
+ height: fit-content;
27
+ }
28
+ `
29
+ ];
30
+
31
+ @property({ type: String }) vouchId: DialogEmbedProps['vouchId'];
32
+ @property({ type: String }) templateId: DialogEmbedProps['templateId'];
33
+ @property({ type: Array }) questions: DialogEmbedProps['questions'];
34
+
35
+ @property({ type: String }) env: DialogEmbedProps['env'] = 'prod';
36
+ @property({ type: String }) apiKey: DialogEmbedProps['apiKey'] = '';
37
+ @property({ type: Boolean }) disableTracking: DialogEmbedProps['disableTracking'] = false;
38
+ @property({ type: String }) trackingSource: DialogEmbedProps['trackingSource'] = 'embedded_player';
39
+
40
+ @property({ type: Array }) controls: DialogEmbedProps['controls'];
41
+ @property({ type: String }) preload: DialogEmbedProps['preload'] = 'none';
42
+ @property({ type: Boolean }) disableAutoplay: DialogEmbedProps['disableAutoplay'] = false;
43
+ @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;
44
+
45
+ private _id = uuidv4();
46
+
47
+ private _handleRootClick = () => {
48
+ this.dispatchEvent(new CustomEvent('dialogembed:click', { detail: this._id, bubbles: true, composed: true }));
49
+ };
50
+
51
+ connectedCallback(): void {
52
+ super.connectedCallback();
53
+ this.addEventListener('click', this._handleRootClick);
54
+ }
55
+
56
+ disconnectedCallback(): void {
57
+ super.disconnectedCallback();
58
+ this.removeEventListener('click', this._handleRootClick);
59
+ }
60
+
61
+ render() {
62
+ return html`
63
+ <slot>
64
+ <vmp-button size="large">Play</vmp-button>
65
+ </slot>
66
+ <vouch-embed-dialog-portal
67
+ id=${this._id}
68
+ ?autoplay=${false}
69
+ vouchId=${ifDefined(this.vouchId)}
70
+ templateId=${ifDefined(this.templateId)}
71
+ .questions=${this.questions}
72
+ .controls=${this.controls}
73
+ env=${ifDefined(this.env)}
74
+ apiKey=${ifDefined(this.apiKey)}
75
+ ?disableTracking=${this.disableTracking}
76
+ trackingSource=${ifDefined(this.trackingSource)}
77
+ preload=${ifDefined(this.preload)}
78
+ aspectRatio=${this.aspectRatio}
79
+ ></vouch-embed-dialog-portal>
80
+ `;
81
+ }
82
+ }
83
+
84
+ declare global {
85
+ interface HTMLElementTagNameMap {
86
+ 'vouch-embed-dialog': DialogEmbed;
87
+ }
88
+
89
+ namespace JSX {
90
+ interface IntrinsicElements {
91
+ 'vouch-embed-dialog': DialogEmbed;
92
+ }
93
+ }
94
+ }
95
+
96
+ export { DialogEmbed };
97
+ export type { DialogEmbedProps };