@vouchfor/embeds 0.0.0-experiment.e7e20dd → 0.0.0-experiment.e8b5a87

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"embeds.js","sources":["../../src/utils/events.ts","../../src/components/PlayerEmbed/controllers/event-forwarder.ts","../../src/utils/env.ts","../../src/components/PlayerEmbed/controllers/fetcher.ts","../../src/components/PlayerEmbed/controllers/tracking/utils.ts","../../src/components/PlayerEmbed/controllers/tracking/index.ts","../../src/components/PlayerEmbed/index.ts","../../src/components/DialogEmbed/DialogOverlay.ts","../../src/components/DialogEmbed/DialogPortal.ts","../../src/components/DialogEmbed/index.ts"],"sourcesContent":["function forwardEvent(type: string, fromElement: HTMLElement, toElement: HTMLElement) {\n function forwarder(event: Event) {\n toElement.dispatchEvent(new CustomEvent(event.type, event));\n }\n\n fromElement.addEventListener(type, forwarder);\n\n return () => {\n fromElement.removeEventListener(type, forwarder);\n };\n}\n\nexport { forwardEvent };\n","import { createRef, ref } from 'lit/directives/ref.js';\n\nimport type { PlayerEmbed } from '..';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport type { DirectiveResult } from 'lit/directive.js';\nimport type { Ref } from 'lit/directives/ref.js';\n\nimport { forwardEvent } from '~/utils/events';\n\ntype PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;\n\nclass EventForwardController implements ReactiveController {\n host: PlayerEmbedHost;\n\n private _events: string[] = [];\n private _cleanup: (() => void)[] = [];\n private _forwardElementRef: Ref<HTMLElement> = createRef();\n\n constructor(host: PlayerEmbedHost, events: string[]) {\n this.host = host;\n this._events = events;\n host.addController(this);\n }\n\n register(): DirectiveResult {\n return ref(this._forwardElementRef);\n }\n\n hostConnected() {\n // Guaranteed to have the element ref in the RAF callback because of how the lit lifecycle works\n requestAnimationFrame(() => {\n this._events.forEach((event) => {\n if (this._forwardElementRef.value) {\n this._cleanup.push(forwardEvent(event, this._forwardElementRef.value, this.host));\n }\n });\n });\n }\n\n hostDisconnected() {\n this._cleanup.forEach((fn) => {\n fn();\n });\n this._cleanup = [];\n }\n}\n\nexport { EventForwardController };\n","type Environment = 'local' | 'dev' | 'staging' | 'prod';\n\ntype GetEnvUrlsReturn = {\n videoUrl: string;\n publicApiUrl: string;\n embedApiUrl: string;\n};\n\nconst devVideoUrl = 'https://d2rxhdlm2q91uk.cloudfront.net';\nconst stagingVideoUrl = 'https://d1ix11aj5kfygl.cloudfront.net';\nconst prodVideoUrl = 'https://d157jlwnudd93d.cloudfront.net';\n\nconst devPublicApiUrl = 'https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev';\nconst stagingPublicApiUrl = 'https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging';\nconst prodPublicApiUrl = 'https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod';\n\nconst localEmbedApiUrl = 'http://localhost:6060/v2';\nconst devEmbedApiUrl = 'https://embed-dev.vouchfor.com/v2';\nconst stagingEmbedApiUrl = 'https://embed-staging.vouchfor.com/v2';\nconst prodEmbedApiUrl = 'https://embed.vouchfor.com/v2';\n\n// We are handling the case where env is an unknown string so the ts error is a lie\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nfunction getEnvUrls(env: Environment): GetEnvUrlsReturn {\n if (!['local', 'dev', 'staging', 'prod'].includes(env)) {\n throw new Error(`Unknown environment: ${env}`);\n }\n\n if (env === 'local') {\n return {\n videoUrl: devVideoUrl,\n publicApiUrl: devPublicApiUrl,\n embedApiUrl: localEmbedApiUrl\n };\n }\n\n if (env === 'dev') {\n return {\n videoUrl: devVideoUrl,\n publicApiUrl: devPublicApiUrl,\n embedApiUrl: devEmbedApiUrl\n };\n }\n\n if (env === 'staging') {\n return {\n videoUrl: stagingVideoUrl,\n publicApiUrl: stagingPublicApiUrl,\n embedApiUrl: stagingEmbedApiUrl\n };\n }\n\n if (env === 'prod') {\n return {\n videoUrl: prodVideoUrl,\n publicApiUrl: prodPublicApiUrl,\n embedApiUrl: prodEmbedApiUrl\n };\n }\n}\n\nexport { devEmbedApiUrl, stagingEmbedApiUrl, prodEmbedApiUrl, getEnvUrls };\nexport type { Environment };\n","import { Task } from '@lit/task';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { PlayerEmbed, PlayerEmbedProps } from '..';\nimport type { ReactiveControllerHost } from 'lit';\nimport type { Environment } from '~/utils/env';\n\nimport { getEnvUrls } from '~/utils/env';\n\ntype PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;\n\ntype FetchTaskDeps = [\n PlayerEmbedProps['env'],\n PlayerEmbedProps['apiKey'],\n PlayerEmbedProps['data'],\n PlayerEmbedProps['vouchId'],\n PlayerEmbedProps['templateId']\n];\n\ntype FilterTaskDeps = [PlayerEmbedProps['data'], PlayerEmbedProps['questions']];\n\nclass FetcherController {\n host: PlayerEmbedHost;\n\n private _fetching = false;\n private _vouch: PlayerEmbedProps['data'];\n\n set fetching(value) {\n if (this._fetching !== value) {\n this._fetching = value;\n this.host.requestUpdate();\n }\n }\n get fetching() {\n return this._fetching;\n }\n\n private getVouch = async (env: Environment, apiKey: string, vouchId: string) => {\n const { embedApiUrl } = getEnvUrls(env);\n\n const cacheCheck = uuidv4();\n const res = await fetch(`${embedApiUrl}/vouches/${vouchId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['X-Cache-Check', cacheCheck]\n ]\n });\n\n const vouch = await res.json();\n this.host.dispatchEvent(new CustomEvent('vouch:loaded', { detail: vouch?.id }));\n\n // HACK: we're currently using API Gateway caching on the embed API without any invalidation logic,\n // so to ensure that the cache stays up to date, whenever we detect a cache hit we trigger another\n // API call with the `Cache-Control` header which will re-fill the cache\n const resCacheCheck = res?.headers?.get('X-Cache-Check');\n if (resCacheCheck !== cacheCheck) {\n fetch(`${embedApiUrl}/vouches/${vouchId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['Cache-Control', 'max-age=0']\n ]\n });\n }\n\n return vouch;\n };\n\n private getTemplate = async (env: Environment, apiKey: string, templateId: string) => {\n const { embedApiUrl } = getEnvUrls(env);\n\n const cacheCheck = uuidv4();\n const res = await fetch(`${embedApiUrl}/templates/${templateId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['X-Cache-Check', cacheCheck]\n ]\n });\n const template = await res.json();\n\n // HACK: we're currently using API Gateway caching on the embed API without any invalidation logic,\n // so to ensure that the cache stays up to date, whenever we detect a cache hit we trigger another\n // API call with the `Cache-Control` header which will re-fill the cache\n const resCacheCheck = res?.headers?.get('X-Cache-Check');\n if (resCacheCheck !== cacheCheck) {\n fetch(`${embedApiUrl}/templates/${templateId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['Cache-Control', 'max-age=0']\n ]\n });\n }\n\n return template;\n };\n\n constructor(host: PlayerEmbedHost) {\n this.host = host;\n new Task<FetchTaskDeps, void>(\n this.host,\n async ([env, apiKey, data, vouchId, templateId]: FetchTaskDeps) => {\n try {\n host.vouch = undefined;\n host.template = undefined;\n\n if (data) {\n let template;\n if (templateId) {\n this.fetching = true;\n template = await this.getTemplate(env, apiKey, templateId);\n }\n this._vouch = data;\n host.template = template ?? data?.settings?.template?.instance;\n } else if (vouchId) {\n this.fetching = true;\n\n const [vouch, template] = await Promise.all([\n this.getVouch(env, apiKey, vouchId),\n templateId ? this.getTemplate(env, apiKey, templateId) : null\n ]);\n this._vouch = vouch;\n host.template = template ?? vouch?.settings?.template?.instance;\n }\n } finally {\n this.fetching = false;\n }\n },\n () => [host.env, host.apiKey, host.data, host.vouchId, host.templateId]\n );\n\n // This second task is to be able to filter the vouch without fetching it again if only the questions changed\n new Task<FilterTaskDeps, void>(\n this.host,\n ([vouch, questions]: FilterTaskDeps) => {\n host.vouch = vouch\n ? {\n ...vouch,\n questions: {\n items: vouch?.questions.items.filter((_, index) => !questions?.length || questions?.includes(index + 1))\n }\n }\n : undefined;\n },\n () => [this._vouch, host.questions]\n );\n }\n}\n\nexport { FetcherController };\n","import { TEMPLATE_VERSION } from '@vouchfor/canvas-video';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { TrackingPayload } from '.';\nimport type { Vouch } from '@vouchfor/video-utils';\nimport type { Environment } from '~/utils/env';\n\nimport packageJson from '~/../package.json';\nimport { getEnvUrls } from '~/utils/env';\n\nfunction createVisitor(env: Environment) {\n const { publicApiUrl } = getEnvUrls(env);\n const visitorId = uuidv4();\n navigator.sendBeacon(`${publicApiUrl}/api/visitor`, JSON.stringify({ visitorId }));\n return visitorId;\n}\n\nfunction getUids(env: Environment) {\n if (typeof window === 'undefined') {\n return {\n client: null,\n tab: null,\n request: uuidv4()\n };\n }\n\n // Persisted for a user for the same device + browser, so we can e.g. search for all logs related to that browser\n let visitorId = window.localStorage?.getItem?.('vouch-uid-visitor');\n // Persisted for a user for the same device + browser, so we can e.g. search for all logs related to that browser\n let clientId = window.localStorage?.getItem?.('vouch-uid-client');\n // Persisted in session storage, so we can search for everything the user has done in a specific tab\n let tabId = window.sessionStorage?.getItem?.('vouch-uid-tab');\n // Not persisted, allows us to search for any logs related to a single FE request\n // E.g. BE should pass this request ID through all other services to be able to group logs\n const requestId = uuidv4();\n\n // Cache uids\n if (!visitorId) {\n visitorId = createVisitor(env);\n window.localStorage?.setItem?.('vouch-uid-visitor', visitorId);\n }\n\n if (!clientId) {\n clientId = uuidv4();\n window.localStorage?.setItem?.('vouch-uid-client', clientId);\n }\n\n if (!tabId) {\n tabId = uuidv4();\n window.sessionStorage?.setItem?.('vouch-uid-tab', tabId);\n }\n\n return {\n client: clientId,\n tab: tabId,\n request: requestId,\n visitor: visitorId\n };\n}\n\nfunction findVouchId(payload?: TrackingPayload, vouch?: Vouch) {\n if (payload && 'vouchId' in payload) {\n return payload.vouchId;\n }\n return vouch?.id ?? null;\n}\n\nfunction getReportingMetadata(source = 'embedded_player') {\n const [country, region] = Intl.DateTimeFormat().resolvedOptions().timeZone?.split?.('/') ?? [];\n\n const utmParams: any = {};\n [...new URLSearchParams(location.search).entries()].forEach(([key, value]) => {\n if (/utm/.test(key)) {\n const param = key.toLowerCase().replace(/[-_][a-z0-9]/g, (group) => group.slice(-1).toUpperCase());\n utmParams[param] = value;\n }\n });\n\n return {\n source,\n time: new Date(),\n region,\n country,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n referrer: document.referrer,\n currentUrl: location.href,\n embedType: 'media-player-embed',\n embedVersion: packageJson.version,\n templateVersion: TEMPLATE_VERSION,\n ...utmParams\n };\n}\n\nexport { getUids, findVouchId, getReportingMetadata };\n","import type { PlayerEmbed } from '../..';\nimport type { VideoEventDetail } from '@vouchfor/media-player';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nimport { findVouchId, getReportingMetadata, getUids } from './utils';\nimport { getEnvUrls } from '~/utils/env';\n\nconst MINIMUM_SEND_THRESHOLD = 1;\n\ntype PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;\n\ntype TrackingEvent = 'VOUCH_LOADED' | 'VOUCH_RESPONSE_VIEWED' | 'VIDEO_PLAYED' | 'VIDEO_STREAMED';\ntype TrackingPayload = {\n vouchId?: string;\n answerId?: string;\n streamStart?: number;\n streamEnd?: number;\n};\n\ntype BatchEvent = {\n event: TrackingEvent;\n payload: TrackingPayload & {\n time: string;\n };\n};\n\ntype TimeMap = {\n [key: string]: number;\n};\n\ntype BooleanMap = {\n [key: string]: boolean;\n};\n\nclass TrackingController implements ReactiveController {\n host: PlayerEmbedHost;\n\n private _batchedEvents: BatchEvent[] = [];\n private _hasPlayed = false;\n private _hasLoaded: BooleanMap = {};\n private _answersViewed: BooleanMap = {};\n private _streamStartTime: TimeMap = {};\n private _streamLatestTime: TimeMap = {};\n private _currentlyPlayingVideo: VideoEventDetail | null = null;\n\n constructor(host: PlayerEmbedHost) {\n this.host = host;\n host.addController(this);\n }\n\n private _createTrackingEvent = (event: TrackingEvent, payload?: TrackingPayload) => {\n const vouchId = findVouchId(payload, this.host.vouch);\n\n if (!vouchId || this.host.disableTracking) {\n return;\n }\n\n this._batchedEvents.push({\n event,\n payload: {\n ...payload,\n vouchId,\n time: new Date().toISOString()\n }\n });\n };\n\n private _sendTrackingEvent = () => {\n if (this._batchedEvents.length <= 0) {\n return;\n }\n\n const { publicApiUrl } = getEnvUrls(this.host.env);\n const { client, tab, request, visitor } = getUids(this.host.env);\n\n navigator.sendBeacon(\n `${publicApiUrl}/api/batchevents`,\n JSON.stringify({\n payload: {\n events: this._batchedEvents\n },\n context: {\n 'x-uid-client': client,\n 'x-uid-tab': tab,\n 'x-uid-request': request,\n 'x-uid-visitor': visitor,\n 'x-reporting-metadata': getReportingMetadata(this.host.trackingSource)\n }\n })\n );\n\n this._batchedEvents = [];\n };\n\n private _streamEnded = () => {\n if (this._currentlyPlayingVideo) {\n const { id, key } = this._currentlyPlayingVideo;\n // Don't send a tracking event when seeking backwards\n if (this._streamLatestTime[key] > this._streamStartTime[key] + MINIMUM_SEND_THRESHOLD) {\n // Send a video streamed event any time the stream ends to capture the time between starting\n // the video and the video stopping for any reason (pausing, deleting the embed node or closing the browser)\n this._createTrackingEvent('VIDEO_STREAMED', {\n answerId: id,\n streamStart: this._streamStartTime[key],\n streamEnd: this._streamLatestTime[key]\n });\n }\n\n // Make sure these events are only sent once by deleting the start and latest times\n delete this._streamStartTime[key];\n delete this._streamLatestTime[key];\n }\n };\n\n private _handleVouchLoaded = ({ detail: vouchId }: CustomEvent<string>) => {\n if (!vouchId) {\n return;\n }\n\n // Only send loaded event once per session\n if (!this._hasLoaded[vouchId]) {\n this._createTrackingEvent('VOUCH_LOADED', { vouchId });\n this._hasLoaded[vouchId] = true;\n }\n };\n\n private _handlePlay = () => {\n // Only send the video played event once per session\n if (!this._hasPlayed) {\n this._createTrackingEvent('VIDEO_PLAYED', {\n streamStart: this.host.currentTime\n });\n this._hasPlayed = true;\n }\n };\n\n private _handleVideoPlay = ({ detail: { id, key } }: CustomEvent<VideoEventDetail>) => {\n // Only increment play count once per session\n if (!this._answersViewed[key]) {\n this._createTrackingEvent('VOUCH_RESPONSE_VIEWED', {\n answerId: id\n });\n this._answersViewed[key] = true;\n }\n };\n\n private _handleVideoTimeUpdate = ({ detail: { id, key, node } }: CustomEvent<VideoEventDetail>) => {\n if (\n // We only want to count any time that the video is actually playing\n !this.host.paused &&\n // Only update the latest time if this event fires for the currently active video\n id === this.host.scene?.video?.id\n ) {\n this._currentlyPlayingVideo = { id, key, node };\n this._streamLatestTime[key] = node.currentTime;\n\n if (!this._streamStartTime[key]) {\n this._streamStartTime[key] = node.currentTime;\n this._streamLatestTime[key] = node.currentTime;\n }\n }\n };\n\n private _handleVideoPause = ({ detail: { id, key } }: CustomEvent<VideoEventDetail>) => {\n if (this._streamLatestTime[key] > this._streamStartTime[key] + MINIMUM_SEND_THRESHOLD) {\n this._createTrackingEvent('VIDEO_STREAMED', {\n answerId: id,\n streamStart: this._streamStartTime[key],\n streamEnd: this._streamLatestTime[key]\n });\n }\n delete this._streamStartTime[key];\n delete this._streamLatestTime[key];\n };\n\n private _pageUnloading = () => {\n this._streamEnded();\n this._sendTrackingEvent();\n };\n\n private _handleVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n this._pageUnloading();\n }\n };\n\n private _handlePageHide = () => {\n this._pageUnloading();\n };\n\n hostConnected() {\n requestAnimationFrame(() => {\n if ('onvisibilitychange' in document) {\n document.addEventListener('visibilitychange', this._handleVisibilityChange);\n } else {\n window.addEventListener('pagehide', this._handlePageHide);\n }\n this.host.addEventListener('vouch:loaded', this._handleVouchLoaded);\n this.host.mediaPlayer?.addEventListener('play', this._handlePlay);\n this.host.mediaPlayer?.addEventListener('video:play', this._handleVideoPlay);\n this.host.mediaPlayer?.addEventListener('video:pause', this._handleVideoPause);\n this.host.mediaPlayer?.addEventListener('video:timeupdate', this._handleVideoTimeUpdate);\n });\n }\n\n hostDisconnected() {\n // Send events if DOM node is destroyed\n this._pageUnloading();\n\n if ('onvisibilitychange' in document) {\n document.removeEventListener('visibilitychange', this._handleVisibilityChange);\n } else {\n window.removeEventListener('pagehide', this._handlePageHide);\n }\n this.host.removeEventListener('vouch:loaded', this._handleVouchLoaded);\n this.host.mediaPlayer?.removeEventListener('play', this._handlePlay);\n this.host.mediaPlayer?.removeEventListener('video:play', this._handleVideoPlay);\n this.host.mediaPlayer?.removeEventListener('video:pause', this._handleVideoPause);\n this.host.mediaPlayer?.removeEventListener('video:timeupdate', this._handleVideoTimeUpdate);\n }\n}\n\nexport { TrackingController };\nexport type { TrackingEvent, TrackingPayload };\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\n\nimport type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';\nimport type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';\nimport type { Environment } from '~/utils/env';\n\nimport { EventForwardController } from './controllers/event-forwarder';\nimport { FetcherController } from './controllers/fetcher';\nimport { TrackingController } from './controllers/tracking';\n\nimport '@vouchfor/media-player';\n\ntype PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {\n env: Environment;\n apiKey: string;\n disableTracking?: boolean;\n trackingSource?: string;\n vouchId?: string;\n templateId?: string;\n // Index of the questions to include starting from 1\n questions?: number[];\n};\n\n@customElement('vouch-embed-player')\nclass PlayerEmbed extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n }\n `\n ];\n\n @property({ type: Object }) data: PlayerEmbedProps['data'];\n @property({ type: String }) vouchId: PlayerEmbedProps['vouchId'];\n @property({ type: String }) templateId: PlayerEmbedProps['templateId'];\n @property({ type: Array }) questions: PlayerEmbedProps['questions'];\n\n @property({ type: String }) env: PlayerEmbedProps['env'] = 'prod';\n @property({ type: String }) apiKey: PlayerEmbedProps['apiKey'] = '';\n @property({ type: Boolean }) disableTracking: PlayerEmbedProps['disableTracking'] = false;\n @property({ type: String }) trackingSource: PlayerEmbedProps['trackingSource'] = 'embedded_player';\n\n @property({ type: Array }) controls: PlayerEmbedProps['controls'];\n @property({ type: String }) preload: PlayerEmbedProps['preload'] = 'auto';\n @property({ type: Boolean }) autoplay: PlayerEmbedProps['autoplay'] = false;\n @property({ type: Number }) aspectRatio: PlayerEmbedProps['aspectRatio'] = 0;\n\n private eventController = new EventForwardController(this, [\n 'durationchange',\n 'ended',\n 'error',\n 'loadeddata',\n 'pause',\n 'stalled',\n 'play',\n 'playing',\n 'ratechange',\n 'scenechange',\n 'seeking',\n 'seeked',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n\n 'video:loadeddata',\n 'video:seeking',\n 'video:seeked',\n 'video:play',\n 'video:playing',\n 'video:pause',\n 'video:stalled',\n 'video:timeupdate',\n 'video:ended',\n 'video:error'\n ]);\n private _fetcherController = new FetcherController(this);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n private _trackingController = new TrackingController(this);\n\n @state() vouch: PlayerEmbedProps['data'];\n @state() template: TemplateInstance | undefined;\n\n get fetching() {\n return this._fetcherController.fetching;\n }\n\n private _mediaPlayerRef = createRef<MediaPlayer>();\n\n get waiting() {\n return this._mediaPlayerRef.value?.waiting;\n }\n\n get initialised() {\n return this._mediaPlayerRef.value?.initialised;\n }\n\n get seeking() {\n return this._mediaPlayerRef.value?.seeking;\n }\n\n get paused() {\n return this._mediaPlayerRef.value?.paused;\n }\n\n get captions() {\n return this._mediaPlayerRef.value?.captions;\n }\n\n get fullscreen() {\n return this._mediaPlayerRef.value?.fullscreen;\n }\n\n get duration() {\n return this._mediaPlayerRef.value?.duration;\n }\n\n set currentTime(value: number) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.currentTime = value;\n }\n }\n get currentTime() {\n return this._mediaPlayerRef.value?.currentTime ?? 0;\n }\n\n set playbackRate(value: number) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.playbackRate = value;\n }\n }\n get playbackRate() {\n return this._mediaPlayerRef.value?.playbackRate ?? 1;\n }\n\n set volume(value: number) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.volume = value;\n }\n }\n get volume() {\n return this._mediaPlayerRef.value?.volume ?? 1;\n }\n\n set muted(value: boolean) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.muted = value;\n }\n }\n get muted() {\n return this._mediaPlayerRef.value?.muted ?? false;\n }\n\n get scene(): Scene | null {\n return this._mediaPlayerRef.value?.scene ?? null;\n }\n\n get scenes(): Scene[] {\n return this._mediaPlayerRef.value?.scenes ?? [];\n }\n\n get sceneConfig(): Scenes | null {\n return this._mediaPlayerRef.value?.sceneConfig ?? null;\n }\n\n get videoState() {\n return this._mediaPlayerRef.value?.videoState;\n }\n\n get mediaPlayer() {\n return this._mediaPlayerRef.value;\n }\n\n play() {\n this._mediaPlayerRef.value?.play();\n }\n\n pause() {\n this._mediaPlayerRef.value?.pause();\n }\n\n reset(time = 0, play = false) {\n this._mediaPlayerRef.value?.reset(time, play);\n }\n\n setScene(index: number) {\n this._mediaPlayerRef.value?.setScene(index);\n }\n\n private _renderStyles() {\n if (!this.aspectRatio) {\n return html`\n <style>\n :host {\n width: 100%;\n height: 100%;\n }\n </style>\n `;\n }\n\n if (typeof this.aspectRatio === 'number') {\n return html`\n <style>\n :host {\n aspect-ratio: ${this.aspectRatio};\n }\n </style>\n `;\n }\n\n return null;\n }\n\n render() {\n return html`\n ${this._renderStyles()}\n <vmp-media-player\n ${ref(this._mediaPlayerRef)}\n ${this.eventController.register()}\n ?autoplay=${this.autoplay}\n ?loading=${this.fetching}\n .data=${this.vouch}\n .template=${this.template}\n aspectRatio=${ifDefined(this.aspectRatio)}\n preload=${ifDefined(this.preload)}\n .controls=${this.controls}\n ></vmp-media-player>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-player': PlayerEmbed;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-player': PlayerEmbed;\n }\n }\n}\n\nexport { PlayerEmbed };\nexport type { PlayerEmbedProps };\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n\nimport type { DialogEmbedProps } from '.';\n\nimport '@a11y/focus-trap';\n\n@customElement('vouch-embed-dialog-overlay')\nclass DialogOverlay extends LitElement {\n static styles = [\n css`\n :host {\n --vouch-media-player-border-radius: var(--vu-media-player-border-radius, 12px);\n --overlay-background-color: var(--vu-overlay-background-color, black);\n --overlay-background-opacity: var(--vu-overlay-background-opacity, 0.4);\n\n --dialog-width: var(--vu-dialog-width, 890px);\n --dialog-height: var(--vu-dialog-height, 500px);\n }\n\n .container {\n position: fixed;\n display: flex;\n inset: 0;\n opacity: 1;\n z-index: 2147483647;\n align-items: center;\n justify-content: center;\n transition: opacity 100ms ease-in;\n }\n\n .hidden {\n opacity: 0;\n pointer-events: none;\n }\n\n .background {\n position: absolute;\n inset: 0;\n opacity: var(--overlay-background-opacity);\n background-color: var(--overlay-background-color);\n }\n\n focus-trap {\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 40px;\n width: var(--dialog-width);\n height: var(--dialog-height);\n max-width: calc(100% - 80px);\n max-height: calc(100% - 80px);\n }\n\n .video-frame {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 100%;\n max-height: 100%;\n }\n\n .video-frame.grow {\n width: 100%;\n height: 100%;\n }\n\n vmp-icon-button {\n position: absolute;\n top: 0;\n right: 0;\n margin: 10px;\n }\n `\n ];\n\n @property({ type: Boolean }) open = false;\n @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;\n\n render() {\n return html`\n <div\n class=${classMap({\n container: true,\n hidden: !this.open\n })}\n >\n <div\n class=\"background\"\n @click=${() => this.dispatchEvent(new CustomEvent('overlay:click', { bubbles: true, composed: true }))}\n ></div>\n <focus-trap>\n <div\n class=${classMap({\n 'video-frame': true,\n grow: this.aspectRatio === 0\n })}\n style=${styleMap({\n aspectRatio: this.aspectRatio\n })}\n >\n <slot></slot>\n <vmp-icon-button\n icon=\"close\"\n rounded=\"full\"\n weight=\"heavy\"\n @click=${() => this.dispatchEvent(new CustomEvent('close:click', { bubbles: true, composed: true }))}\n ></vmp-icon-button>\n </div>\n </focus-trap>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-dialog-overlay': DialogOverlay;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-dialog-overlay': DialogOverlay;\n }\n }\n}\n\nexport { DialogOverlay };\n","import { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n\nimport type { DialogEmbedProps } from '.';\nimport type { MediaPlayer } from '@vouchfor/media-player';\n\nimport './DialogOverlay';\n\n@customElement('vouch-embed-dialog-portal')\nclass DialogPortal extends LitElement {\n @property({ type: String }) vouchId: DialogEmbedProps['vouchId'];\n @property({ type: String }) templateId: DialogEmbedProps['templateId'];\n @property({ type: Array }) questions: DialogEmbedProps['questions'];\n\n @property({ type: String }) env: DialogEmbedProps['env'] = 'prod';\n @property({ type: String }) apiKey: DialogEmbedProps['apiKey'] = '';\n @property({ type: Boolean }) disableTracking: DialogEmbedProps['disableTracking'] = false;\n @property({ type: String }) trackingSource: DialogEmbedProps['trackingSource'] = 'embedded_player';\n\n @property({ type: Array }) controls: DialogEmbedProps['controls'];\n @property({ type: String }) preload: DialogEmbedProps['preload'] = 'none';\n @property({ type: Boolean }) disableAutoplay: DialogEmbedProps['disableAutoplay'] = false;\n @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;\n\n private _mediaPlayerRef = createRef<MediaPlayer>();\n\n @state() open = false;\n\n private _handleToggle = ({ detail }: CustomEvent<string>) => {\n // Because we have to attach this listener to the document since this element is portalled outside of the button,\n // we also have to make sure that this player is actually the one we want to open and play by passing in an ID\n // from the button wrapper parent and checking against that same ID we pass as the event detail\n if (this.id === detail) {\n this.open = !this.open;\n\n if (this.open) {\n if (!this.disableAutoplay && this._mediaPlayerRef?.value) {\n this._mediaPlayerRef.value.muted = false;\n this._mediaPlayerRef.value.play();\n }\n } else {\n this._mediaPlayerRef?.value?.pause();\n }\n }\n };\n\n // We could do the same thing on close and check for the correct ID but it doesn't really matter\n private _handleClose = () => {\n this.open = false;\n this._mediaPlayerRef?.value?.pause();\n };\n\n private _handleDocumentKeyUp = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this._handleClose();\n }\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('dialogembed:click', this._handleToggle);\n document.addEventListener('keyup', this._handleDocumentKeyUp);\n document.addEventListener('close:click', this._handleClose);\n document.addEventListener('overlay:click', this._handleClose);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('dialogembed:click', this._handleToggle);\n document.removeEventListener('keyup', this._handleDocumentKeyUp);\n document.removeEventListener('close:click', this._handleClose);\n document.removeEventListener('overlay:click', this._handleClose);\n }\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n // We must create a new node here because portalling into the same node (document.body) causes the second\n // element to overwrite the first for some reason (not behaviour really stated in the docs)\n // I am fairly certain this function is only run once as the default behaviour creates the open shadow root\n // and returns that shadow root in this function: https://lit.dev/docs/components/shadow-dom/#implementing-createrenderroot\n const newNode = document.createElement('div');\n document.body.appendChild(newNode);\n return newNode;\n }\n\n render() {\n return html`\n <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>\n <vouch-embed-player\n ${ref(this._mediaPlayerRef)}\n style=${styleMap({\n maxWidth: '100%',\n maxHeight: '100%'\n })}\n ?autoplay=${false}\n vouchId=${ifDefined(this.vouchId)}\n templateId=${ifDefined(this.templateId)}\n .questions=${this.questions}\n .controls=${this.controls}\n env=${ifDefined(this.env)}\n apiKey=${ifDefined(this.apiKey)}\n ?disableTracking=${this.disableTracking}\n trackingSource=${ifDefined(this.trackingSource)}\n preload=${ifDefined(this.preload)}\n aspectRatio=${this.aspectRatio}\n ></vouch-embed-player>\n </vouch-embed-dialog-overlay>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-dialog-portal': DialogPortal;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-dialog-portal': DialogPortal;\n }\n }\n}\n\nexport { DialogPortal };\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { PlayerEmbedProps } from '../PlayerEmbed';\n\nimport '../PlayerEmbed';\nimport './DialogPortal';\n\ntype DialogEmbedProps = Omit<PlayerEmbedProps, 'data'> & {\n disableAutoplay?: boolean;\n};\n\n@customElement('vouch-embed-dialog')\nclass DialogEmbed extends LitElement {\n static styles = [\n css`\n :host {\n --vu-button-padding: 10px 20px;\n --vu-button-background: #287179;\n --vu-button-background-hover: #4faab2;\n\n display: flex;\n width: fit-content;\n height: fit-content;\n }\n `\n ];\n\n @property({ type: String }) vouchId: DialogEmbedProps['vouchId'];\n @property({ type: String }) templateId: DialogEmbedProps['templateId'];\n @property({ type: Array }) questions: DialogEmbedProps['questions'];\n\n @property({ type: String }) env: DialogEmbedProps['env'] = 'prod';\n @property({ type: String }) apiKey: DialogEmbedProps['apiKey'] = '';\n @property({ type: Boolean }) disableTracking: DialogEmbedProps['disableTracking'] = false;\n @property({ type: String }) trackingSource: DialogEmbedProps['trackingSource'] = 'embedded_player';\n\n @property({ type: Array }) controls: DialogEmbedProps['controls'];\n @property({ type: String }) preload: DialogEmbedProps['preload'] = 'none';\n @property({ type: Boolean }) disableAutoplay: DialogEmbedProps['disableAutoplay'] = false;\n @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;\n\n private _id = uuidv4();\n\n private _handleRootClick = () => {\n this.dispatchEvent(new CustomEvent('dialogembed:click', { detail: this._id, bubbles: true, composed: true }));\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleRootClick);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('click', this._handleRootClick);\n }\n\n render() {\n return html`\n <slot>\n <vmp-button size=\"large\">Play</vmp-button>\n </slot>\n <vouch-embed-dialog-portal\n id=${this._id}\n ?autoplay=${false}\n vouchId=${ifDefined(this.vouchId)}\n templateId=${ifDefined(this.templateId)}\n .questions=${this.questions}\n .controls=${this.controls}\n env=${ifDefined(this.env)}\n apiKey=${ifDefined(this.apiKey)}\n ?disableTracking=${this.disableTracking}\n trackingSource=${ifDefined(this.trackingSource)}\n preload=${ifDefined(this.preload)}\n aspectRatio=${this.aspectRatio}\n ></vouch-embed-dialog-portal>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-dialog': DialogEmbed;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-dialog': DialogEmbed;\n }\n }\n}\n\nexport { DialogEmbed };\nexport type { DialogEmbedProps };\n"],"names":["uuidv4","__decorateClass"],"mappings":";;;;;;;;;;;;AAAA,SAAS,YAAA,CAAa,IAAc,EAAA,WAAA,EAA0B,SAAwB,EAAA;AACpF,EAAA,SAAS,UAAU,KAAc,EAAA;AAC/B,IAAA,SAAA,CAAU,cAAc,IAAI,WAAA,CAAY,KAAM,CAAA,IAAA,EAAM,KAAK,CAAC,CAAA,CAAA;AAAA,GAC5D;AAEA,EAAY,WAAA,CAAA,gBAAA,CAAiB,MAAM,SAAS,CAAA,CAAA;AAE5C,EAAA,OAAO,MAAM;AACX,IAAY,WAAA,CAAA,mBAAA,CAAoB,MAAM,SAAS,CAAA,CAAA;AAAA,GACjD,CAAA;AACF;;ACCA,MAAM,sBAAqD,CAAA;AAAA,EAOzD,WAAA,CAAY,MAAuB,MAAkB,E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AAA,OAAA,EAAS,CAAA;AAAA,CAAA,EArBvB,WAqByB,CAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,CAAA,CAAA;AACD,eAAA,CAAA;AAAA,EAA3B,QAAS,CAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,CAAA;AAAA,CAAA,EAtBtB,WAsBwB,CAAA,SAAA,EAAA,gBAAA,EAAA,CAAA,CAAA,CAAA;AAED,eAAA,CAAA;AAAA,EAA1B,QAAS,CAAA,EAAE,IAAM,EAAA,KAAA,EAAO,CAAA;AAAA,CAAA,EAxBrB,WAwBuB,CAAA,SAAA,EAAA,UAAA,EAAA,CAAA,CAAA,CAAA;AACC,eAAA,CAAA;AAAA,EAA3B,QAAS,CAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,CAAA;AAAA,CAAA,EAzBtB,WAyBwB,CAAA,SAAA,EAAA,SAAA,EAAA,CAAA,CAAA,CAAA;AACC,eAAA,CAAA;AAAA,EAA5B,QAAS,CAAA,EAAE,IAAM,EAAA,OAAA,EAAS,CAAA;AAAA,CAAA,EA1BvB,WA0ByB,CAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,CAAA,CAAA;AACD,eAAA,CAAA;AAAA,EAA3B,QAAS,CAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,CAAA;AAAA,CAAA,EA3BtB,WA2BwB,CAAA,SAAA,EAAA,aAAA,EAAA,CAAA,CAAA,CAAA;AA3BxB,WAAN,GAAA,eAAA,CAAA;AAAA,EADC,cAAc,oBAAoB,CAAA;AAAA,CAC7B,EAAA,WAAA,CAAA;;;;"}
1
+ {"version":3,"file":"embeds.js","sources":["../../src/utils/events.ts","../../src/components/PlayerEmbed/controllers/event-forwarder.ts","../../src/utils/env.ts","../../src/components/PlayerEmbed/controllers/fetcher.ts","../../src/components/PlayerEmbed/controllers/tracking/utils.ts","../../src/components/PlayerEmbed/controllers/tracking/index.ts","../../src/components/PlayerEmbed/index.ts","../../src/components/DialogEmbed/DialogOverlay.ts","../../src/components/DialogEmbed/DialogPortal.ts","../../src/components/DialogEmbed/index.ts"],"sourcesContent":["function forwardEvent(type: string, fromElement: HTMLElement, toElement: HTMLElement) {\n function forwarder(event: Event) {\n toElement.dispatchEvent(new CustomEvent(event.type, event));\n }\n\n fromElement.addEventListener(type, forwarder);\n\n return () => {\n fromElement.removeEventListener(type, forwarder);\n };\n}\n\nexport { forwardEvent };\n","import { createRef, ref } from 'lit/directives/ref.js';\n\nimport type { PlayerEmbed } from '..';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport type { DirectiveResult } from 'lit/directive.js';\nimport type { Ref } from 'lit/directives/ref.js';\n\nimport { forwardEvent } from '~/utils/events';\n\ntype PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;\n\nclass EventForwardController implements ReactiveController {\n host: PlayerEmbedHost;\n\n private _events: string[] = [];\n private _cleanup: (() => void)[] = [];\n private _forwardElementRef: Ref<HTMLElement> = createRef();\n\n constructor(host: PlayerEmbedHost, events: string[]) {\n this.host = host;\n this._events = events;\n host.addController(this);\n }\n\n register(): DirectiveResult {\n return ref(this._forwardElementRef);\n }\n\n hostConnected() {\n // Guaranteed to have the element ref in the RAF callback because of how the lit lifecycle works\n requestAnimationFrame(() => {\n this._events.forEach((event) => {\n if (this._forwardElementRef.value) {\n this._cleanup.push(forwardEvent(event, this._forwardElementRef.value, this.host));\n }\n });\n });\n }\n\n hostDisconnected() {\n this._cleanup.forEach((fn) => {\n fn();\n });\n this._cleanup = [];\n }\n}\n\nexport { EventForwardController };\n","type Environment = 'local' | 'dev' | 'staging' | 'prod';\n\ntype GetEnvUrlsReturn = {\n videoUrl: string;\n publicApiUrl: string;\n embedApiUrl: string;\n};\n\nconst devVideoUrl = 'https://d2rxhdlm2q91uk.cloudfront.net';\nconst stagingVideoUrl = 'https://d1ix11aj5kfygl.cloudfront.net';\nconst prodVideoUrl = 'https://d157jlwnudd93d.cloudfront.net';\n\nconst devPublicApiUrl = 'https://bshyfw4h5a.execute-api.ap-southeast-2.amazonaws.com/dev';\nconst stagingPublicApiUrl = 'https://gyzw7rpbq3.execute-api.ap-southeast-2.amazonaws.com/staging';\nconst prodPublicApiUrl = 'https://vfcjuim1l3.execute-api.ap-southeast-2.amazonaws.com/prod';\n\nconst localEmbedApiUrl = 'http://localhost:6060/v2';\nconst devEmbedApiUrl = 'https://embed-dev.vouchfor.com/v2';\nconst stagingEmbedApiUrl = 'https://embed-staging.vouchfor.com/v2';\nconst prodEmbedApiUrl = 'https://embed.vouchfor.com/v2';\n\n// We are handling the case where env is an unknown string so the ts error is a lie\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nfunction getEnvUrls(env: Environment): GetEnvUrlsReturn {\n if (!['local', 'dev', 'staging', 'prod'].includes(env)) {\n throw new Error(`Unknown environment: ${env}`);\n }\n\n if (env === 'local') {\n return {\n videoUrl: devVideoUrl,\n publicApiUrl: devPublicApiUrl,\n embedApiUrl: localEmbedApiUrl\n };\n }\n\n if (env === 'dev') {\n return {\n videoUrl: devVideoUrl,\n publicApiUrl: devPublicApiUrl,\n embedApiUrl: devEmbedApiUrl\n };\n }\n\n if (env === 'staging') {\n return {\n videoUrl: stagingVideoUrl,\n publicApiUrl: stagingPublicApiUrl,\n embedApiUrl: stagingEmbedApiUrl\n };\n }\n\n if (env === 'prod') {\n return {\n videoUrl: prodVideoUrl,\n publicApiUrl: prodPublicApiUrl,\n embedApiUrl: prodEmbedApiUrl\n };\n }\n}\n\nexport { devEmbedApiUrl, stagingEmbedApiUrl, prodEmbedApiUrl, getEnvUrls };\nexport type { Environment };\n","import { Task } from '@lit/task';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { PlayerEmbed, PlayerEmbedProps } from '..';\nimport type { ReactiveControllerHost } from 'lit';\nimport type { Environment } from '~/utils/env';\n\nimport { getEnvUrls } from '~/utils/env';\n\ntype PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;\n\ntype FetchTaskDeps = [\n PlayerEmbedProps['env'],\n PlayerEmbedProps['apiKey'],\n PlayerEmbedProps['data'],\n PlayerEmbedProps['vouchId'],\n PlayerEmbedProps['templateId']\n];\n\ntype FilterTaskDeps = [PlayerEmbedProps['data'], PlayerEmbedProps['questions']];\n\nclass FetcherController {\n host: PlayerEmbedHost;\n\n private _fetching = false;\n private _vouch: PlayerEmbedProps['data'];\n\n set fetching(value) {\n if (this._fetching !== value) {\n this._fetching = value;\n this.host.requestUpdate();\n }\n }\n get fetching() {\n return this._fetching;\n }\n\n private getVouch = async (env: Environment, apiKey: string, vouchId: string) => {\n const { embedApiUrl } = getEnvUrls(env);\n\n const cacheCheck = uuidv4();\n const res = await fetch(`${embedApiUrl}/vouches/${vouchId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['X-Cache-Check', cacheCheck]\n ]\n });\n\n const vouch = await res.json();\n this.host.dispatchEvent(new CustomEvent('vouch:loaded', { detail: vouch?.id }));\n\n // HACK: we're currently using API Gateway caching on the embed API without any invalidation logic,\n // so to ensure that the cache stays up to date, whenever we detect a cache hit we trigger another\n // API call with the `Cache-Control` header which will re-fill the cache\n const resCacheCheck = res?.headers?.get('X-Cache-Check');\n if (resCacheCheck !== cacheCheck) {\n fetch(`${embedApiUrl}/vouches/${vouchId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['Cache-Control', 'max-age=0']\n ]\n });\n }\n\n return vouch;\n };\n\n private getTemplate = async (env: Environment, apiKey: string, templateId: string) => {\n const { embedApiUrl } = getEnvUrls(env);\n\n const cacheCheck = uuidv4();\n const res = await fetch(`${embedApiUrl}/templates/${templateId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['X-Cache-Check', cacheCheck]\n ]\n });\n const template = await res.json();\n\n // HACK: we're currently using API Gateway caching on the embed API without any invalidation logic,\n // so to ensure that the cache stays up to date, whenever we detect a cache hit we trigger another\n // API call with the `Cache-Control` header which will re-fill the cache\n const resCacheCheck = res?.headers?.get('X-Cache-Check');\n if (resCacheCheck !== cacheCheck) {\n fetch(`${embedApiUrl}/templates/${templateId}`, {\n method: 'GET',\n headers: [\n ['X-Api-Key', apiKey],\n ['Cache-Control', 'max-age=0']\n ]\n });\n }\n\n return template;\n };\n\n constructor(host: PlayerEmbedHost) {\n this.host = host;\n new Task<FetchTaskDeps, void>(\n this.host,\n async ([env, apiKey, data, vouchId, templateId]: FetchTaskDeps) => {\n try {\n host.vouch = undefined;\n host.template = undefined;\n\n if (data) {\n let template;\n if (templateId) {\n this.fetching = true;\n template = await this.getTemplate(env, apiKey, templateId);\n }\n this._vouch = data;\n host.template = template ?? data?.settings?.template?.instance;\n } else if (vouchId) {\n this.fetching = true;\n\n const [vouch, template] = await Promise.all([\n this.getVouch(env, apiKey, vouchId),\n templateId ? this.getTemplate(env, apiKey, templateId) : null\n ]);\n this._vouch = vouch;\n host.template = template ?? vouch?.settings?.template?.instance;\n }\n } finally {\n this.fetching = false;\n }\n },\n () => [host.env, host.apiKey, host.data, host.vouchId, host.templateId]\n );\n\n // This second task is to be able to filter the vouch without fetching it again if only the questions changed\n new Task<FilterTaskDeps, void>(\n this.host,\n ([vouch, questions]: FilterTaskDeps) => {\n host.vouch = vouch\n ? {\n ...vouch,\n questions: {\n items: vouch?.questions.items.filter((_, index) => !questions?.length || questions?.includes(index + 1))\n }\n }\n : undefined;\n },\n () => [this._vouch, host.questions]\n );\n }\n}\n\nexport { FetcherController };\n","import { TEMPLATE_VERSION } from '@vouchfor/canvas-video';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { TrackingPayload } from '.';\nimport type { Vouch } from '@vouchfor/video-utils';\nimport type { Environment } from '~/utils/env';\n\nimport packageJson from '~/../package.json';\nimport { getEnvUrls } from '~/utils/env';\n\nfunction createVisitor(env: Environment) {\n const { publicApiUrl } = getEnvUrls(env);\n const visitorId = uuidv4();\n navigator.sendBeacon(`${publicApiUrl}/api/visitor`, JSON.stringify({ visitorId }));\n return visitorId;\n}\n\nfunction getUids(env: Environment) {\n if (typeof window === 'undefined') {\n return {\n client: null,\n tab: null,\n request: uuidv4()\n };\n }\n\n // Persisted for a user for the same device + browser, so we can e.g. search for all logs related to that browser\n let visitorId = window.localStorage?.getItem?.('vouch-uid-visitor');\n // Persisted for a user for the same device + browser, so we can e.g. search for all logs related to that browser\n let clientId = window.localStorage?.getItem?.('vouch-uid-client');\n // Persisted in session storage, so we can search for everything the user has done in a specific tab\n let tabId = window.sessionStorage?.getItem?.('vouch-uid-tab');\n // Not persisted, allows us to search for any logs related to a single FE request\n // E.g. BE should pass this request ID through all other services to be able to group logs\n const requestId = uuidv4();\n\n // Cache uids\n if (!visitorId) {\n visitorId = createVisitor(env);\n window.localStorage?.setItem?.('vouch-uid-visitor', visitorId);\n }\n\n if (!clientId) {\n clientId = uuidv4();\n window.localStorage?.setItem?.('vouch-uid-client', clientId);\n }\n\n if (!tabId) {\n tabId = uuidv4();\n window.sessionStorage?.setItem?.('vouch-uid-tab', tabId);\n }\n\n return {\n client: clientId,\n tab: tabId,\n request: requestId,\n visitor: visitorId\n };\n}\n\nfunction findVouchId(payload?: TrackingPayload, vouch?: Vouch) {\n if (payload && 'vouchId' in payload) {\n return payload.vouchId;\n }\n return vouch?.id ?? null;\n}\n\nfunction getReportingMetadata(source = 'embedded_player') {\n const [country, region] = Intl.DateTimeFormat().resolvedOptions().timeZone?.split?.('/') ?? [];\n\n const utmParams: any = {};\n [...new URLSearchParams(location.search).entries()].forEach(([key, value]) => {\n if (/utm/.test(key)) {\n const param = key.toLowerCase().replace(/[-_][a-z0-9]/g, (group) => group.slice(-1).toUpperCase());\n utmParams[param] = value;\n }\n });\n\n return {\n source,\n time: new Date(),\n region,\n country,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n referrer: document.referrer,\n currentUrl: location.href,\n embedType: 'media-player-embed',\n embedVersion: packageJson.version,\n templateVersion: TEMPLATE_VERSION,\n ...utmParams\n };\n}\n\nexport { getUids, findVouchId, getReportingMetadata };\n","import type { PlayerEmbed } from '../..';\nimport type { VideoEventDetail } from '@vouchfor/media-player';\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nimport { findVouchId, getReportingMetadata, getUids } from './utils';\nimport { getEnvUrls } from '~/utils/env';\n\nconst MINIMUM_SEND_THRESHOLD = 1;\n\ntype PlayerEmbedHost = ReactiveControllerHost & PlayerEmbed;\n\ntype TrackingEvent = 'VOUCH_LOADED' | 'VOUCH_RESPONSE_VIEWED' | 'VIDEO_PLAYED' | 'VIDEO_STREAMED';\ntype TrackingPayload = {\n vouchId?: string;\n answerId?: string;\n streamStart?: number;\n streamEnd?: number;\n};\n\ntype BatchEvent = {\n event: TrackingEvent;\n payload: TrackingPayload & {\n time: string;\n };\n};\n\ntype TimeMap = {\n [key: string]: number;\n};\n\ntype BooleanMap = {\n [key: string]: boolean;\n};\n\nclass TrackingController implements ReactiveController {\n host: PlayerEmbedHost;\n\n private _batchedEvents: BatchEvent[] = [];\n private _hasPlayed = false;\n private _hasLoaded: BooleanMap = {};\n private _answersViewed: BooleanMap = {};\n private _streamStartTime: TimeMap = {};\n private _streamLatestTime: TimeMap = {};\n private _currentlyPlayingVideo: VideoEventDetail | null = null;\n\n constructor(host: PlayerEmbedHost) {\n this.host = host;\n host.addController(this);\n }\n\n private _createTrackingEvent = (event: TrackingEvent, payload?: TrackingPayload) => {\n const vouchId = findVouchId(payload, this.host.vouch);\n\n if (!vouchId || this.host.disableTracking) {\n return;\n }\n\n this._batchedEvents.push({\n event,\n payload: {\n ...payload,\n vouchId,\n time: new Date().toISOString()\n }\n });\n };\n\n private _sendTrackingEvent = () => {\n if (this._batchedEvents.length <= 0) {\n return;\n }\n\n const { publicApiUrl } = getEnvUrls(this.host.env);\n const { client, tab, request, visitor } = getUids(this.host.env);\n\n navigator.sendBeacon(\n `${publicApiUrl}/api/batchevents`,\n JSON.stringify({\n payload: {\n events: this._batchedEvents\n },\n context: {\n 'x-uid-client': client,\n 'x-uid-tab': tab,\n 'x-uid-request': request,\n 'x-uid-visitor': visitor,\n 'x-reporting-metadata': getReportingMetadata(this.host.trackingSource)\n }\n })\n );\n\n this._batchedEvents = [];\n };\n\n private _streamEnded = () => {\n if (this._currentlyPlayingVideo) {\n const { id, key } = this._currentlyPlayingVideo;\n // Don't send a tracking event when seeking backwards\n if (this._streamLatestTime[key] > this._streamStartTime[key] + MINIMUM_SEND_THRESHOLD) {\n // Send a video streamed event any time the stream ends to capture the time between starting\n // the video and the video stopping for any reason (pausing, deleting the embed node or closing the browser)\n this._createTrackingEvent('VIDEO_STREAMED', {\n answerId: id,\n streamStart: this._streamStartTime[key],\n streamEnd: this._streamLatestTime[key]\n });\n }\n\n // Make sure these events are only sent once by deleting the start and latest times\n delete this._streamStartTime[key];\n delete this._streamLatestTime[key];\n }\n };\n\n private _handleVouchLoaded = ({ detail: vouchId }: CustomEvent<string>) => {\n if (!vouchId) {\n return;\n }\n\n // Only send loaded event once per session\n if (!this._hasLoaded[vouchId]) {\n this._createTrackingEvent('VOUCH_LOADED', { vouchId });\n this._hasLoaded[vouchId] = true;\n }\n };\n\n private _handlePlay = () => {\n // Only send the video played event once per session\n if (!this._hasPlayed) {\n this._createTrackingEvent('VIDEO_PLAYED', {\n streamStart: this.host.currentTime\n });\n this._hasPlayed = true;\n }\n };\n\n private _handleVideoPlay = ({ detail: { id, key } }: CustomEvent<VideoEventDetail>) => {\n // Only increment play count once per session\n if (!this._answersViewed[key]) {\n this._createTrackingEvent('VOUCH_RESPONSE_VIEWED', {\n answerId: id\n });\n this._answersViewed[key] = true;\n }\n };\n\n private _handleVideoTimeUpdate = ({ detail: { id, key, node } }: CustomEvent<VideoEventDetail>) => {\n if (\n // We only want to count any time that the video is actually playing\n !this.host.paused &&\n // Only update the latest time if this event fires for the currently active video\n id === this.host.scene?.video?.id\n ) {\n this._currentlyPlayingVideo = { id, key, node };\n this._streamLatestTime[key] = node.currentTime;\n\n if (!this._streamStartTime[key]) {\n this._streamStartTime[key] = node.currentTime;\n this._streamLatestTime[key] = node.currentTime;\n }\n }\n };\n\n private _handleVideoPause = ({ detail: { id, key } }: CustomEvent<VideoEventDetail>) => {\n if (this._streamLatestTime[key] > this._streamStartTime[key] + MINIMUM_SEND_THRESHOLD) {\n this._createTrackingEvent('VIDEO_STREAMED', {\n answerId: id,\n streamStart: this._streamStartTime[key],\n streamEnd: this._streamLatestTime[key]\n });\n }\n delete this._streamStartTime[key];\n delete this._streamLatestTime[key];\n };\n\n private _pageUnloading = () => {\n this._streamEnded();\n this._sendTrackingEvent();\n };\n\n private _handleVisibilityChange = () => {\n if (document.visibilityState === 'hidden') {\n this._pageUnloading();\n }\n };\n\n private _handlePageHide = () => {\n this._pageUnloading();\n };\n\n hostConnected() {\n requestAnimationFrame(() => {\n if ('onvisibilitychange' in document) {\n document.addEventListener('visibilitychange', this._handleVisibilityChange);\n } else {\n window.addEventListener('pagehide', this._handlePageHide);\n }\n this.host.addEventListener('vouch:loaded', this._handleVouchLoaded);\n this.host.mediaPlayer?.addEventListener('play', this._handlePlay);\n this.host.mediaPlayer?.addEventListener('video:play', this._handleVideoPlay);\n this.host.mediaPlayer?.addEventListener('video:pause', this._handleVideoPause);\n this.host.mediaPlayer?.addEventListener('video:timeupdate', this._handleVideoTimeUpdate);\n });\n }\n\n hostDisconnected() {\n // Send events if DOM node is destroyed\n this._pageUnloading();\n\n if ('onvisibilitychange' in document) {\n document.removeEventListener('visibilitychange', this._handleVisibilityChange);\n } else {\n window.removeEventListener('pagehide', this._handlePageHide);\n }\n this.host.removeEventListener('vouch:loaded', this._handleVouchLoaded);\n this.host.mediaPlayer?.removeEventListener('play', this._handlePlay);\n this.host.mediaPlayer?.removeEventListener('video:play', this._handleVideoPlay);\n this.host.mediaPlayer?.removeEventListener('video:pause', this._handleVideoPause);\n this.host.mediaPlayer?.removeEventListener('video:timeupdate', this._handleVideoTimeUpdate);\n }\n}\n\nexport { TrackingController };\nexport type { TrackingEvent, TrackingPayload };\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\n\nimport type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';\nimport type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';\nimport type { Environment } from '~/utils/env';\n\nimport { EventForwardController } from './controllers/event-forwarder';\nimport { FetcherController } from './controllers/fetcher';\nimport { TrackingController } from './controllers/tracking';\n\nimport '@vouchfor/media-player';\n\ntype PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'preload' | 'autoplay' | 'controls'> & {\n env: Environment;\n apiKey: string;\n disableTracking?: boolean;\n trackingSource?: string;\n vouchId?: string;\n templateId?: string;\n // Index of the questions to include starting from 1\n questions?: number[];\n};\n\n@customElement('vouch-embed-player')\nclass PlayerEmbed extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n }\n `\n ];\n\n @property({ type: Object }) data: PlayerEmbedProps['data'];\n @property({ type: String }) vouchId: PlayerEmbedProps['vouchId'];\n @property({ type: String }) templateId: PlayerEmbedProps['templateId'];\n @property({ type: Array }) questions: PlayerEmbedProps['questions'];\n\n @property({ type: String }) env: PlayerEmbedProps['env'] = 'prod';\n @property({ type: String }) apiKey: PlayerEmbedProps['apiKey'] = '';\n @property({ type: Boolean }) disableTracking: PlayerEmbedProps['disableTracking'] = false;\n @property({ type: String }) trackingSource: PlayerEmbedProps['trackingSource'] = 'embedded_player';\n\n @property({ type: Array }) controls: PlayerEmbedProps['controls'];\n @property({ type: String }) preload: PlayerEmbedProps['preload'] = 'auto';\n @property({ type: Boolean }) autoplay: PlayerEmbedProps['autoplay'] = false;\n @property({ type: Number }) aspectRatio: PlayerEmbedProps['aspectRatio'] = 0;\n\n private eventController = new EventForwardController(this, [\n 'durationchange',\n 'ended',\n 'error',\n 'loadeddata',\n 'pause',\n 'stalled',\n 'play',\n 'playing',\n 'ratechange',\n 'scenechange',\n 'seeking',\n 'seeked',\n 'timeupdate',\n 'volumechange',\n 'waiting',\n\n 'video:loadeddata',\n 'video:seeking',\n 'video:seeked',\n 'video:play',\n 'video:playing',\n 'video:pause',\n 'video:stalled',\n 'video:timeupdate',\n 'video:ended',\n 'video:error'\n ]);\n private _fetcherController = new FetcherController(this);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n private _trackingController = new TrackingController(this);\n\n @state() vouch: PlayerEmbedProps['data'];\n @state() template: TemplateInstance | undefined;\n\n get fetching() {\n return this._fetcherController.fetching;\n }\n\n private _mediaPlayerRef = createRef<MediaPlayer>();\n\n get waiting() {\n return this._mediaPlayerRef.value?.waiting;\n }\n\n get initialised() {\n return this._mediaPlayerRef.value?.initialised;\n }\n\n get seeking() {\n return this._mediaPlayerRef.value?.seeking;\n }\n\n get paused() {\n return this._mediaPlayerRef.value?.paused;\n }\n\n get captions() {\n return this._mediaPlayerRef.value?.captions;\n }\n\n get fullscreen() {\n return this._mediaPlayerRef.value?.fullscreen;\n }\n\n get duration() {\n return this._mediaPlayerRef.value?.duration;\n }\n\n set currentTime(value: number) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.currentTime = value;\n }\n }\n get currentTime() {\n return this._mediaPlayerRef.value?.currentTime ?? 0;\n }\n\n set playbackRate(value: number) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.playbackRate = value;\n }\n }\n get playbackRate() {\n return this._mediaPlayerRef.value?.playbackRate ?? 1;\n }\n\n set volume(value: number) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.volume = value;\n }\n }\n get volume() {\n return this._mediaPlayerRef.value?.volume ?? 1;\n }\n\n set muted(value: boolean) {\n if (this._mediaPlayerRef.value) {\n this._mediaPlayerRef.value.muted = value;\n }\n }\n get muted() {\n return this._mediaPlayerRef.value?.muted ?? false;\n }\n\n get scene(): Scene | null {\n return this._mediaPlayerRef.value?.scene ?? null;\n }\n\n get scenes(): Scene[] {\n return this._mediaPlayerRef.value?.scenes ?? [];\n }\n\n get sceneConfig(): Scenes | null {\n return this._mediaPlayerRef.value?.sceneConfig ?? null;\n }\n\n get videoState() {\n return this._mediaPlayerRef.value?.videoState;\n }\n\n get mediaPlayer() {\n return this._mediaPlayerRef.value;\n }\n\n play() {\n this._mediaPlayerRef.value?.play();\n }\n\n pause() {\n this._mediaPlayerRef.value?.pause();\n }\n\n reset(time = 0, play = false) {\n this._mediaPlayerRef.value?.reset(time, play);\n }\n\n setScene(index: number) {\n this._mediaPlayerRef.value?.setScene(index);\n }\n\n private _renderStyles() {\n if (!this.aspectRatio) {\n return html`\n <style>\n :host {\n width: 100%;\n height: 100%;\n }\n </style>\n `;\n }\n\n if (typeof this.aspectRatio === 'number') {\n return html`\n <style>\n :host {\n aspect-ratio: ${this.aspectRatio};\n }\n </style>\n `;\n }\n\n return null;\n }\n\n render() {\n return html`\n ${this._renderStyles()}\n <vmp-media-player\n ${ref(this._mediaPlayerRef)}\n ${this.eventController.register()}\n ?autoplay=${this.autoplay}\n ?loading=${this.fetching}\n .data=${this.vouch}\n .template=${this.template}\n aspectRatio=${ifDefined(this.aspectRatio)}\n preload=${ifDefined(this.preload)}\n .controls=${this.controls}\n ></vmp-media-player>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-player': PlayerEmbed;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-player': PlayerEmbed;\n }\n }\n}\n\nexport { PlayerEmbed };\nexport type { PlayerEmbedProps };\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n\nimport type { DialogEmbedProps } from '.';\n\nimport '@a11y/focus-trap';\n\n@customElement('vouch-embed-dialog-overlay')\nclass DialogOverlay extends LitElement {\n static styles = [\n css`\n :host {\n --vouch-media-player-border-radius: var(--vu-media-player-border-radius, 12px);\n --overlay-background-color: var(--vu-overlay-background-color, black);\n --overlay-background-opacity: var(--vu-overlay-background-opacity, 0.4);\n\n --dialog-width: var(--vu-dialog-width, 890px);\n --dialog-height: var(--vu-dialog-height, 500px);\n }\n\n .container {\n position: fixed;\n display: flex;\n inset: 0;\n opacity: 1;\n z-index: 2147483647;\n align-items: center;\n justify-content: center;\n transition: opacity 100ms ease-in;\n }\n\n .hidden {\n opacity: 0;\n pointer-events: none;\n }\n\n .background {\n position: absolute;\n inset: 0;\n opacity: var(--overlay-background-opacity);\n background-color: var(--overlay-background-color);\n }\n\n focus-trap {\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 40px;\n width: var(--dialog-width);\n height: var(--dialog-height);\n max-width: calc(100% - 80px);\n max-height: calc(100% - 80px);\n }\n\n .video-frame {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n max-width: 100%;\n max-height: 100%;\n }\n\n .video-frame.grow {\n width: 100%;\n height: 100%;\n }\n\n vmp-icon-button {\n position: absolute;\n top: 0;\n right: 0;\n margin: 10px;\n }\n `\n ];\n\n @property({ type: Boolean }) open = false;\n @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;\n\n render() {\n return html`\n <div\n class=${classMap({\n container: true,\n hidden: !this.open\n })}\n >\n <div\n class=\"background\"\n @click=${() => this.dispatchEvent(new CustomEvent('overlay:click', { bubbles: true, composed: true }))}\n ></div>\n <focus-trap>\n <div\n class=${classMap({\n 'video-frame': true,\n grow: this.aspectRatio === 0\n })}\n style=${styleMap({\n aspectRatio: this.aspectRatio\n })}\n >\n <slot></slot>\n <vmp-icon-button\n icon=\"close\"\n rounded=\"full\"\n weight=\"heavy\"\n @click=${() => this.dispatchEvent(new CustomEvent('close:click', { bubbles: true, composed: true }))}\n ></vmp-icon-button>\n </div>\n </focus-trap>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-dialog-overlay': DialogOverlay;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-dialog-overlay': DialogOverlay;\n }\n }\n}\n\nexport { DialogOverlay };\n","import { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n\nimport type { DialogEmbedProps } from '.';\nimport type { MediaPlayer } from '@vouchfor/media-player';\n\nimport './DialogOverlay';\n\n@customElement('vouch-embed-dialog-portal')\nclass DialogPortal extends LitElement {\n @property({ type: String }) vouchId: DialogEmbedProps['vouchId'];\n @property({ type: String }) templateId: DialogEmbedProps['templateId'];\n @property({ type: Array }) questions: DialogEmbedProps['questions'];\n\n @property({ type: String }) env: DialogEmbedProps['env'] = 'prod';\n @property({ type: String }) apiKey: DialogEmbedProps['apiKey'] = '';\n @property({ type: Boolean }) disableTracking: DialogEmbedProps['disableTracking'] = false;\n @property({ type: String }) trackingSource: DialogEmbedProps['trackingSource'] = 'embedded_player';\n\n @property({ type: Array }) controls: DialogEmbedProps['controls'];\n @property({ type: String }) preload: DialogEmbedProps['preload'] = 'none';\n @property({ type: Boolean }) disableAutoplay: DialogEmbedProps['disableAutoplay'] = false;\n @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;\n\n private _mediaPlayerRef = createRef<MediaPlayer>();\n\n @state() open = false;\n\n private _handleToggle = ({ detail }: CustomEvent<string>) => {\n // Because we have to attach this listener to the document since this element is portalled outside of the button,\n // we also have to make sure that this player is actually the one we want to open and play by passing in an ID\n // from the button wrapper parent and checking against that same ID we pass as the event detail\n if (this.id === detail) {\n this.open = !this.open;\n\n if (this.open) {\n if (!this.disableAutoplay && this._mediaPlayerRef?.value) {\n this._mediaPlayerRef.value.muted = false;\n this._mediaPlayerRef.value.play();\n }\n } else {\n this._mediaPlayerRef?.value?.pause();\n }\n }\n };\n\n // We could do the same thing on close and check for the correct ID but it doesn't really matter\n private _handleClose = () => {\n this.open = false;\n this._mediaPlayerRef?.value?.pause();\n };\n\n private _handleDocumentKeyUp = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this._handleClose();\n }\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n document.addEventListener('dialogembed:click', this._handleToggle);\n document.addEventListener('keyup', this._handleDocumentKeyUp);\n document.addEventListener('close:click', this._handleClose);\n document.addEventListener('overlay:click', this._handleClose);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener('dialogembed:click', this._handleToggle);\n document.removeEventListener('keyup', this._handleDocumentKeyUp);\n document.removeEventListener('close:click', this._handleClose);\n document.removeEventListener('overlay:click', this._handleClose);\n }\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n // We must create a new node here because portalling into the same node (document.body) causes the second\n // element to overwrite the first for some reason (not behaviour really stated in the docs)\n // I am fairly certain this function is only run once as the default behaviour creates the open shadow root\n // and returns that shadow root in this function: https://lit.dev/docs/components/shadow-dom/#implementing-createrenderroot\n const newNode = document.createElement('div');\n document.body.appendChild(newNode);\n return newNode;\n }\n\n render() {\n return html`\n <vouch-embed-dialog-overlay ?open=${this.open} aspectRatio=${this.aspectRatio}>\n <vouch-embed-player\n ${ref(this._mediaPlayerRef)}\n style=${styleMap({\n maxWidth: '100%',\n maxHeight: '100%'\n })}\n ?autoplay=${false}\n vouchId=${ifDefined(this.vouchId)}\n templateId=${ifDefined(this.templateId)}\n .questions=${this.questions}\n .controls=${this.controls}\n env=${ifDefined(this.env)}\n apiKey=${ifDefined(this.apiKey)}\n ?disableTracking=${this.disableTracking}\n trackingSource=${ifDefined(this.trackingSource)}\n preload=${ifDefined(this.preload)}\n aspectRatio=${this.aspectRatio}\n ></vouch-embed-player>\n </vouch-embed-dialog-overlay>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-dialog-portal': DialogPortal;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-dialog-portal': DialogPortal;\n }\n }\n}\n\nexport { DialogPortal };\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { PlayerEmbedProps } from '../PlayerEmbed';\n\nimport '../PlayerEmbed';\nimport './DialogPortal';\n\ntype DialogEmbedProps = Omit<PlayerEmbedProps, 'data'> & {\n disableAutoplay?: boolean;\n};\n\n@customElement('vouch-embed-dialog')\nclass DialogEmbed extends LitElement {\n static styles = [\n css`\n :host {\n --vu-button-padding: 10px 20px;\n --vu-button-background: #287179;\n --vu-button-background-hover: #4faab2;\n\n display: flex;\n width: fit-content;\n height: fit-content;\n }\n `\n ];\n\n @property({ type: String }) vouchId: DialogEmbedProps['vouchId'];\n @property({ type: String }) templateId: DialogEmbedProps['templateId'];\n @property({ type: Array }) questions: DialogEmbedProps['questions'];\n\n @property({ type: String }) env: DialogEmbedProps['env'] = 'prod';\n @property({ type: String }) apiKey: DialogEmbedProps['apiKey'] = '';\n @property({ type: Boolean }) disableTracking: DialogEmbedProps['disableTracking'] = false;\n @property({ type: String }) trackingSource: DialogEmbedProps['trackingSource'] = 'embedded_player';\n\n @property({ type: Array }) controls: DialogEmbedProps['controls'];\n @property({ type: String }) preload: DialogEmbedProps['preload'] = 'none';\n @property({ type: Boolean }) disableAutoplay: DialogEmbedProps['disableAutoplay'] = false;\n @property({ type: Number }) aspectRatio: DialogEmbedProps['aspectRatio'] = 0;\n\n private _id = uuidv4();\n\n private _handleRootClick = () => {\n this.dispatchEvent(new CustomEvent('dialogembed:click', { detail: this._id, bubbles: true, composed: true }));\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('click', this._handleRootClick);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('click', this._handleRootClick);\n }\n\n render() {\n return html`\n <slot>\n <vmp-button size=\"large\">Play</vmp-button>\n </slot>\n <vouch-embed-dialog-portal\n id=${this._id}\n ?autoplay=${false}\n vouchId=${ifDefined(this.vouchId)}\n templateId=${ifDefined(this.templateId)}\n .questions=${this.questions}\n .controls=${this.controls}\n env=${ifDefined(this.env)}\n apiKey=${ifDefined(this.apiKey)}\n ?disableTracking=${this.disableTracking}\n trackingSource=${ifDefined(this.trackingSource)}\n preload=${ifDefined(this.preload)}\n aspectRatio=${this.aspectRatio}\n ></vouch-embed-dialog-portal>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vouch-embed-dialog': DialogEmbed;\n }\n\n namespace JSX {\n interface IntrinsicElements {\n 'vouch-embed-dialog': DialogEmbed;\n }\n }\n}\n\nexport { DialogEmbed };\nexport type { DialogEmbedProps };\n"],"names":["type","uuidv4","__decorateClass"],"mappings":";;;;;;;;;;;AAAA,SAAS,aAAaA,OAAc,aAA0B,WAAwB;AACpF,WAAS,UAAU,OAAc;AAC/B,cAAU,cAAc,IAAI,YAAY,MAAM,MAAM,KAAK,CAAC;AAAA,EAC5D;AAEY,cAAA,iBAAiBA,OAAM,SAAS;AAE5C,SAAO,MAAM;AACC,gBAAA,oBAAoBA,OAAM,SAAS;AAAA,EAAA;AAEnD;ACCA,MAAM,uBAAqD;AAAA,EAOzD,YAAY,MAAuB,QAAkB;AAJrD,SAAQ,UAAoB;AAC5B,SAAQ,WAA2B;AACnC,SAAQ,qBAAuC;AAG7C,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,cAAc,IAAI;AAAA,EACzB;AAAA,EAEA,WAA4B;AACnB,WAAA,IAAI,KAAK,kBAAkB;AAAA,EACpC;AAAA,EAEA,gBAAgB;AAEd,0BAAsB,MAAM;AACrB,WAAA,QAAQ,QAAQ,CAAC,UAAU;AAC1B,YAAA,KAAK,mBAAmB,OAAO;AAC5B,eAAA,SAAS,KAAK,aAAa,OAAO,KAAK,mBAAmB,OAAO,KAAK,IAAI,CAAC;AAAA,QAClF;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EACH;AAAA,EAEA,mBAAmB;AACZ,SAAA,SAAS,QAAQ,CAAC,OAA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