From 5947d89af12c79095ff970167c07fa09ab2f695b Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Mon, 8 Apr 2024 15:39:11 +0200 Subject: [PATCH 1/5] Fix error in Conviva type definitions when Yospace is not installed --- conviva/src/integration/ConvivaConnector.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/conviva/src/integration/ConvivaConnector.ts b/conviva/src/integration/ConvivaConnector.ts index 28660836..9d6787ad 100644 --- a/conviva/src/integration/ConvivaConnector.ts +++ b/conviva/src/integration/ConvivaConnector.ts @@ -1,5 +1,6 @@ import type { ChromelessPlayer } from 'theoplayer'; import type { ConvivaMetadata } from '@convivainc/conviva-js-coresdk'; +/** @ts-ignore Optional dependency, will become `any` if not installed. */ import type { YospaceConnector } from '@theoplayer/yospace-connector-web'; import { ConvivaConfiguration, ConvivaHandler } from './ConvivaHandler'; From 1991dfff24b126cad9675859a4e514f7c431b836 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Mon, 8 Apr 2024 15:45:40 +0200 Subject: [PATCH 2/5] Add changeset --- .changeset/nine-buckets-smoke.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/nine-buckets-smoke.md diff --git a/.changeset/nine-buckets-smoke.md b/.changeset/nine-buckets-smoke.md new file mode 100644 index 00000000..dfabb374 --- /dev/null +++ b/.changeset/nine-buckets-smoke.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/conviva-connector-web": patch +--- + +Fixed an issue where TypeScript could throw a TS2307 type error on the generated type definitions when the optional `@theoplayer/yospace-connector-web` peer dependency is not installed. From 7731b8e64381aad667e6bd438077980e8dac7fc9 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Mon, 8 Apr 2024 18:06:30 +0200 Subject: [PATCH 3/5] Remove runtime dependency on Yospace connector --- conviva/src/integration/ads/YospaceAdReporter.ts | 8 +++++++- yospace/src/yospace/AnalyticEventObserver.ts | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/conviva/src/integration/ads/YospaceAdReporter.ts b/conviva/src/integration/ads/YospaceAdReporter.ts index df79b883..8d5d7964 100644 --- a/conviva/src/integration/ads/YospaceAdReporter.ts +++ b/conviva/src/integration/ads/YospaceAdReporter.ts @@ -99,7 +99,8 @@ export class YospaceAdReporter { }; private readonly onYospaceSessionError = (code: SessionErrorCode) => { - if (code === SessionErrorCode.TIMEOUT) { + const yospaceCode = code as number as YospaceSessionErrorCode; + if (yospaceCode === YospaceSessionErrorCode.TIMEOUT) { this.convivaVideoAnalytics.reportPlaybackError('The Yospace session has timed out.'); } else { this.convivaVideoAnalytics.reportPlaybackError('The Yospace session has errored.'); @@ -121,3 +122,8 @@ export class YospaceAdReporter { this.yospaceConnector.unregisterAnalyticEventObserver(this.observer); } } + +// Keep this in sync with SessionErrorCode from yospace-connector-web +enum YospaceSessionErrorCode { + TIMEOUT = 0 +} diff --git a/yospace/src/yospace/AnalyticEventObserver.ts b/yospace/src/yospace/AnalyticEventObserver.ts index 6d5ab86a..139371ab 100644 --- a/yospace/src/yospace/AnalyticEventObserver.ts +++ b/yospace/src/yospace/AnalyticEventObserver.ts @@ -2,8 +2,9 @@ import { AdBreak, AdVert } from './AdBreak'; import { TrackingError } from './TrackingError'; import { YospaceSessionManager } from './YospaceSessionManager'; +// Keep this in sync with YospaceSessionErrorCode from conviva-connector-web export enum SessionErrorCode { - TIMEOUT + TIMEOUT = 0 } export interface AnalyticEventObserver { From 961c7c744f95963d9995672ec5f3b0911a486523 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Mon, 8 Apr 2024 18:14:02 +0200 Subject: [PATCH 4/5] Make Conviva SDK a peer dependency --- conviva/package.json | 7 ++++--- package-lock.json | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conviva/package.json b/conviva/package.json index e2276817..a46e8e44 100644 --- a/conviva/package.json +++ b/conviva/package.json @@ -33,10 +33,8 @@ "LICENSE.md", "package.json" ], - "dependencies": { - "@convivainc/conviva-js-coresdk": "^4.7.4" - }, "peerDependencies": { + "@convivainc/conviva-js-coresdk": "^4.7.4", "@theoplayer/yospace-connector-web": "^2.1.1", "theoplayer": "^5.0.0 || ^6.0.0 || ^7.0.0" }, @@ -44,5 +42,8 @@ "@theoplayer/yospace-connector-web": { "optional": true } + }, + "devDependencies": { + "@convivainc/conviva-js-coresdk": "^4.7.4" } } diff --git a/package-lock.json b/package-lock.json index 2015104e..464f6951 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,10 +53,11 @@ "name": "@theoplayer/conviva-connector-web", "version": "2.0.2", "license": "MIT", - "dependencies": { + "devDependencies": { "@convivainc/conviva-js-coresdk": "^4.7.4" }, "peerDependencies": { + "@convivainc/conviva-js-coresdk": "^4.7.4", "@theoplayer/yospace-connector-web": "^2.1.1", "theoplayer": "^5.0.0 || ^6.0.0 || ^7.0.0" }, @@ -1247,6 +1248,7 @@ }, "node_modules/@convivainc/conviva-js-coresdk": { "version": "4.7.4", + "dev": true, "license": "MIT" }, "node_modules/@cspotcode/source-map-support": { From 8044537b7bd1665b97de4646888c6d2046bfe499 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Mon, 8 Apr 2024 18:15:44 +0200 Subject: [PATCH 5/5] Add changeset --- .changeset/proud-bottles-reflect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/proud-bottles-reflect.md diff --git a/.changeset/proud-bottles-reflect.md b/.changeset/proud-bottles-reflect.md new file mode 100644 index 00000000..5fd24d12 --- /dev/null +++ b/.changeset/proud-bottles-reflect.md @@ -0,0 +1,5 @@ +--- +"@theoplayer/conviva-connector-web": minor +--- + +Changed Conviva SDK to a peer dependency, enabling users to update it independently from the Conviva connector.