@vouchfor/embeds 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/es/embeds.js CHANGED
@@ -196,7 +196,7 @@ class FetcherController {
196
196
  }
197
197
  }
198
198
  const name = "@vouchfor/embeds";
199
- const version = "2.1.0";
199
+ const version = "3.0.0";
200
200
  const license = "MIT";
201
201
  const author = "Aaron Williams";
202
202
  const main = "dist/es/embeds.js";
@@ -238,8 +238,8 @@ const scripts = {
238
238
  const dependencies = {
239
239
  "@a11y/focus-trap": "^1.0.5",
240
240
  "@lit/task": "^1.0.0",
241
- "@vouchfor/canvas-video": "^8.1.0",
242
- "@vouchfor/media-player": "^3.1.0",
241
+ "@vouchfor/canvas-video": "^8.2.0",
242
+ "@vouchfor/media-player": "^4.0.0",
243
243
  uuid: "^9.0.1"
244
244
  };
245
245
  const peerDependencies = {
@@ -258,7 +258,7 @@ const devDependencies = {
258
258
  "@types/mocha": "^10.0.6",
259
259
  "@vouchfor/eslint-config": "^1.0.1",
260
260
  "@vouchfor/prettier-config": "^1.0.1",
261
- "@vouchfor/video-utils": "^1.1.0",
261
+ "@vouchfor/video-utils": "^1.2.0",
262
262
  "@web/dev-server-esbuild": "^1.0.2",
263
263
  "@web/test-runner": "^0.18.1",
264
264
  "@web/test-runner-browserstack": "^0.7.1",
@@ -560,10 +560,12 @@ let PlayerEmbed = class extends LitElement {
560
560
  "playing",
561
561
  "ratechange",
562
562
  "scenechange",
563
+ "scenesupdate",
563
564
  "seeking",
564
565
  "seeked",
565
566
  "timeupdate",
566
567
  "volumechange",
568
+ "processing",
567
569
  "waiting",
568
570
  "video:loadeddata",
569
571
  "video:seeking",
@@ -704,6 +706,11 @@ let PlayerEmbed = class extends LitElement {
704
706
  }
705
707
  return null;
706
708
  }
709
+ willUpdate(changedProperties) {
710
+ if (changedProperties.has("vouchId") && this.vouchId !== changedProperties.get("vouchId")) {
711
+ this.reset(0, false);
712
+ }
713
+ }
707
714
  render() {
708
715
  return html`
709
716
  ${this._renderStyles()}
@@ -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<\n MediaPlayerProps,\n 'data' | 'aspectRatio' | 'language' | 'preload' | 'autoplay' | 'controls'\n> & {\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 @property({ type: String }) language?: MediaPlayerProps['language'];\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 language=${ifDefined(this.language)}\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,K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Q;AAAA,GApBtB,YAoBwB,WAAA,UAAA,CAAA;AACC,gBAAA;AAAA,EAA5B,SAAS,EAAE,MAAM,SAAS;AAAA,GArBvB,YAqByB,WAAA,mBAAA,CAAA;AACD,gBAAA;AAAA,EAA3B,SAAS,EAAE,MAAM,QAAQ;AAAA,GAtBtB,YAsBwB,WAAA,kBAAA,CAAA;AAED,gBAAA;AAAA,EAA1B,SAAS,EAAE,MAAM,OAAO;AAAA,GAxBrB,YAwBuB,WAAA,YAAA,CAAA;AACC,gBAAA;AAAA,EAA3B,SAAS,EAAE,MAAM,QAAQ;AAAA,GAzBtB,YAyBwB,WAAA,WAAA,CAAA;AACC,gBAAA;AAAA,EAA5B,SAAS,EAAE,MAAM,SAAS;AAAA,GA1BvB,YA0ByB,WAAA,mBAAA,CAAA;AACD,gBAAA;AAAA,EAA3B,SAAS,EAAE,MAAM,QAAQ;AAAA,GA3BtB,YA2BwB,WAAA,eAAA,CAAA;AA3BxB,cAAN,gBAAA;AAAA,EADC,cAAc,oBAAoB;AAAA,GAC7B,WAAA;"}
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 { PropertyValueMap } from 'lit';\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<\n MediaPlayerProps,\n 'data' | 'aspectRatio' | 'language' | 'preload' | 'autoplay' | 'controls'\n> & {\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 @property({ type: String }) language?: MediaPlayerProps['language'];\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 'scenesupdate',\n 'seeking',\n 'seeked',\n 'timeupdate',\n 'volumechange',\n 'processing',\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 protected willUpdate(changedProperties: PropertyValueMap<PlayerEmbedProps>) {\n // If the vouch this embed is pointing to changes then reset the player\n if (changedProperties.has('vouchId') && this.vouchId !== changedProperties.get('vouchId')) {\n this.reset(0, false);\n }\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 language=${ifDefined(this.language)}\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,OAAO;AACzB;IAAA,CACJ;AACD,SAAK,WAAW;EAClB;AACF;ACrCA,MAAM,cAAc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BAAA,CAAA;AAED,gBAAA;AAAA,EAA1B,SAAS,EAAE,MAAM,OAAO;AAAA,GAxBrB,YAwBuB,WAAA,YAAA,CAAA;AACC,gBAAA;AAAA,EAA3B,SAAS,EAAE,MAAM,QAAQ;AAAA,GAzBtB,YAyBwB,WAAA,WAAA,CAAA;AACC,gBAAA;AAAA,EAA5B,SAAS,EAAE,MAAM,SAAS;AAAA,GA1BvB,YA0ByB,WAAA,mBAAA,CAAA;AACD,gBAAA;AAAA,EAA3B,SAAS,EAAE,MAAM,QAAQ;AAAA,GA3BtB,YA2BwB,WAAA,eAAA,CAAA;AA3BxB,cAAN,gBAAA;AAAA,EADC,cAAc,oBAAoB;AAAA,GAC7B,WAAA;"}
@@ -1,6 +1,7 @@
1
1
  import { LitElement } from 'lit';
2
2
  import type { Scene, Scenes, TemplateInstance } from '@vouchfor/canvas-video';
3
3
  import type { MediaPlayer, MediaPlayerProps } from '@vouchfor/media-player';
4
+ import type { PropertyValueMap } from 'lit';
4
5
  import type { Environment } from '../../utils/env';
5
6
  import '@vouchfor/media-player';
6
7
  type PlayerEmbedProps = Pick<MediaPlayerProps, 'data' | 'aspectRatio' | 'language' | 'preload' | 'autoplay' | 'controls'> & {
@@ -59,6 +60,7 @@ declare class PlayerEmbed extends LitElement {
59
60
  reset(time?: number, play?: boolean): void;
60
61
  setScene(index: number): void;
61
62
  private _renderStyles;
63
+ protected willUpdate(changedProperties: PropertyValueMap<PlayerEmbedProps>): void;
62
64
  render(): import("lit-html").TemplateResult<1>;
63
65
  }
64
66
  declare global {