From 743af3e4b855fed61178f2b8f52757edeb944e6f Mon Sep 17 00:00:00 2001 From: Carina Dragan Date: Tue, 4 Jul 2023 11:53:01 +0200 Subject: [PATCH 1/8] feat: av --- public/jwpltx.js | 2 ++ types/env.d.ts | 1 + vite.config.ts | 3 +++ 3 files changed, 6 insertions(+) diff --git a/public/jwpltx.js b/public/jwpltx.js index 2399e0ae6..d515287dd 100644 --- a/public/jwpltx.js +++ b/public/jwpltx.js @@ -97,6 +97,8 @@ window.jwpltx = window.jwpltx || {}; uri.fed = fed; uri.id = id; uri.t = t; + // eslint-disable-next-line no-undef + uri.av = APP_VERSION; // Send oaid only for logged in users if (oaid) { diff --git a/types/env.d.ts b/types/env.d.ts index 5f2aef65a..c1371e2fb 100644 --- a/types/env.d.ts +++ b/types/env.d.ts @@ -7,6 +7,7 @@ interface ImportMetaEnv { readonly APP_GITHUB_PUBLIC_BASE_URL: string | undefined; readonly APP_DEFAULT_LANGUAGE: string | undefined; readonly APP_ENABLED_LANGUAGES: string | undefined; + readonly APP_VERSION: string | undefined; } interface ImportMeta { diff --git a/vite.config.ts b/vite.config.ts index a63447c9e..09c89b358 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -61,6 +61,9 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => { targets: fileCopyTargets, }), ], + define: { + APP_VERSION: JSON.stringify(process.env.npm_package_version), + }, publicDir: './public', envPrefix: 'APP_', server: { From 898f94a6683dfcc18020deef90fc8a1bc987b6b3 Mon Sep 17 00:00:00 2001 From: Carina Dragan Date: Tue, 4 Jul 2023 15:31:34 +0200 Subject: [PATCH 2/8] feat: oiid for analytics --- public/jwpltx.js | 3 ++- src/hooks/useOttAnalytics.ts | 8 ++++++-- types/jwpltx.d.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/public/jwpltx.js b/public/jwpltx.js index d515287dd..19014bba5 100644 --- a/public/jwpltx.js +++ b/public/jwpltx.js @@ -90,13 +90,14 @@ window.jwpltx = window.jwpltx || {}; } // Process a player ready event - o.ready = function (aid, bun, fed, id, t, oaid) { + o.ready = function (aid, bun, fed, id, t, oaid, oiid) { uri = JSON.parse(JSON.stringify(URI)); uri.aid = aid; uri.bun = bun; uri.fed = fed; uri.id = id; uri.t = t; + uri.oiid = oiid; // eslint-disable-next-line no-undef uri.av = APP_VERSION; diff --git a/src/hooks/useOttAnalytics.ts b/src/hooks/useOttAnalytics.ts index 4d39e8cc1..76317f8ce 100644 --- a/src/hooks/useOttAnalytics.ts +++ b/src/hooks/useOttAnalytics.ts @@ -7,10 +7,14 @@ import { useAccountStore } from '#src/stores/AccountStore'; const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { const analyticsToken = useConfigStore((s) => s.config.analyticsToken); const user = useAccountStore((state) => state.user); + const { config } = useConfigStore((s) => s); // ott app user id (oaid) const oaid: number | undefined = user?.id ? Number(user.id) : undefined; + // app config id (oiid) + const oiid = config?.id; + const [player, setPlayer] = useState(null); useEffect(() => { @@ -38,7 +42,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { return; } - window.jwpltx.ready(analyticsToken, window.location.hostname, feedId, item.mediaid, item.title, oaid); + window.jwpltx.ready(analyticsToken, window.location.hostname, feedId, item.mediaid, item.title, oaid, oiid); }; const completeHandler = () => { @@ -66,7 +70,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { player.off('seeked', seekedHandler); player.off('adImpression', adImpressionHandler); }; - }, [player, item, analyticsToken, feedId, oaid]); + }, [player, item, analyticsToken, feedId, oaid, oiid]); return setPlayer; }; diff --git a/types/jwpltx.d.ts b/types/jwpltx.d.ts index f28fd073a..39dad7b62 100644 --- a/types/jwpltx.d.ts +++ b/types/jwpltx.d.ts @@ -1,5 +1,5 @@ interface Jwpltx { - ready: (analyticsid: string, hostname: string, feedid: string, mediaid: string, title: string, accountid?: number) => void; + ready: (analyticsid: string, hostname: string, feedid: string, mediaid: string, title: string, accountid?: number, appid?: string) => void; adImpression: () => void; seek: (offset: number, duration: number) => void; seeked: () => void; From 13a1e2120adf9486fb4e34b8544726811331c4c3 Mon Sep 17 00:00:00 2001 From: Carina Dragan Date: Wed, 5 Jul 2023 09:12:17 +0200 Subject: [PATCH 3/8] feat: code cleanup --- public/jwpltx.js | 5 ++--- src/hooks/useOttAnalytics.ts | 7 +++++-- types/jwpltx.d.ts | 11 ++++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/public/jwpltx.js b/public/jwpltx.js index 19014bba5..991b2eaf9 100644 --- a/public/jwpltx.js +++ b/public/jwpltx.js @@ -90,7 +90,7 @@ window.jwpltx = window.jwpltx || {}; } // Process a player ready event - o.ready = function (aid, bun, fed, id, t, oaid, oiid) { + o.ready = function (aid, bun, fed, id, t, oaid, oiid, av) { uri = JSON.parse(JSON.stringify(URI)); uri.aid = aid; uri.bun = bun; @@ -98,8 +98,7 @@ window.jwpltx = window.jwpltx || {}; uri.id = id; uri.t = t; uri.oiid = oiid; - // eslint-disable-next-line no-undef - uri.av = APP_VERSION; + uri.av = av; // Send oaid only for logged in users if (oaid) { diff --git a/src/hooks/useOttAnalytics.ts b/src/hooks/useOttAnalytics.ts index 76317f8ce..1b421c83c 100644 --- a/src/hooks/useOttAnalytics.ts +++ b/src/hooks/useOttAnalytics.ts @@ -15,6 +15,9 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { // app config id (oiid) const oiid = config?.id; + // app version number (av) + const av = import.meta.env.APP_VERSION; + const [player, setPlayer] = useState(null); useEffect(() => { @@ -42,7 +45,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { return; } - window.jwpltx.ready(analyticsToken, window.location.hostname, feedId, item.mediaid, item.title, oaid, oiid); + window.jwpltx.ready(analyticsToken, window.location.hostname, feedId, item.mediaid, item.title, oaid, oiid, av); }; const completeHandler = () => { @@ -70,7 +73,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { player.off('seeked', seekedHandler); player.off('adImpression', adImpressionHandler); }; - }, [player, item, analyticsToken, feedId, oaid, oiid]); + }, [player, item, analyticsToken, feedId, oaid, oiid, av]); return setPlayer; }; diff --git a/types/jwpltx.d.ts b/types/jwpltx.d.ts index 39dad7b62..1babd5222 100644 --- a/types/jwpltx.d.ts +++ b/types/jwpltx.d.ts @@ -1,5 +1,14 @@ interface Jwpltx { - ready: (analyticsid: string, hostname: string, feedid: string, mediaid: string, title: string, accountid?: number, appid?: string) => void; + ready: ( + analyticsid: string, + hostname: string, + feedid: string, + mediaid: string, + title: string, + accountid?: number, + appid?: string, + appversion?: string, + ) => void; adImpression: () => void; seek: (offset: number, duration: number) => void; seeked: () => void; From 2d772ed52ae835485fe48ffc4a0b3352ab9edcb5 Mon Sep 17 00:00:00 2001 From: Carina Dragan Date: Wed, 5 Jul 2023 10:00:41 +0200 Subject: [PATCH 4/8] feat: fix vite config definition --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 09c89b358..fb6152d41 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -62,7 +62,7 @@ export default ({ mode, command }: ConfigEnv): UserConfigExport => { }), ], define: { - APP_VERSION: JSON.stringify(process.env.npm_package_version), + 'import.meta.env.APP_VERSION': JSON.stringify(process.env.npm_package_version), }, publicDir: './public', envPrefix: 'APP_', From 6ab4dcbff33f95539cbf8c20fc18b67976463f07 Mon Sep 17 00:00:00 2001 From: Carina Dragan Date: Wed, 5 Jul 2023 10:03:42 +0200 Subject: [PATCH 5/8] feat: comment fix --- src/hooks/useOttAnalytics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useOttAnalytics.ts b/src/hooks/useOttAnalytics.ts index 1b421c83c..f95cfcd08 100644 --- a/src/hooks/useOttAnalytics.ts +++ b/src/hooks/useOttAnalytics.ts @@ -30,7 +30,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => { }; const seekHandler = ({ offset }: jwplayer.SeekParam) => { - // TODO: according JWPlayer typings, the seek params doesn't contain a `duration` property, but it actually does + // TODO: according to JWPlayer typings, the seek param doesn't contain a `duration` property, but it actually does window.jwpltx.seek(offset, player.getDuration()); }; From 1fa1bcf093ff24514ead4e2a4ae943badf6f0871 Mon Sep 17 00:00:00 2001 From: Carina Dragan Date: Wed, 5 Jul 2023 12:32:18 +0200 Subject: [PATCH 6/8] feat: update docs --- docs/features/video-analytics.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/features/video-analytics.md b/docs/features/video-analytics.md index 7a0a7d334..1546e6d1b 100644 --- a/docs/features/video-analytics.md +++ b/docs/features/video-analytics.md @@ -79,12 +79,12 @@ These metrics are described below. ### App Metrics -| Name | Key | Rqd | Values | Example | Description | -| ----------------------- | ---- | --- | ------------------- | ---------------------------------------- | --------------------------------------------------- | -| App Version | av | Yes | A string | 1.0.0 | Version of the App | -| App Bundle ID | bun | Yes | Reverse domain name | com.apple.calculator | Unique ID to the App; persists through uninstalls. | -| App User ID | oaid | Yes | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | Hash of the app user account login ID. 1 | -| App Install Instance ID | oiid | No | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | App install instance ID. Resets with reinstalls | +| Name | Key | Rqd | Values | Example | Description | +| ------------- | ---- | --- | ------------------- | ---------------------------------------- | --------------------------------------------------- | +| App Version | av | Yes | A string | 1.0.0 | Version of the App | +| App Bundle ID | bun | Yes | Reverse domain name | com.apple.calculator | Unique ID to the App; persists through uninstalls. | +| App User ID | oaid | Yes | \[0-9a-z\]{40} | 51f8cf1797aac87ede45c2883797f124fed0258d | Hash of the app user account login ID. 1 | +| App Config ID | oiid | No | \[0-9a-z\]{8} | dGSUzs9o | Unique ID of app config. | 1 For Cleeng `oaid` maps to the `subscriberId` From 7d4eabea91c63433e44517afe2941e1847fd9c32 Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 5 Jul 2023 17:27:38 +0200 Subject: [PATCH 7/8] chore: e2e test for payment types (#329) --- test-e2e/tests/payments/subscription_test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-e2e/tests/payments/subscription_test.ts b/test-e2e/tests/payments/subscription_test.ts index c9ca29b8e..b39077f93 100644 --- a/test-e2e/tests/payments/subscription_test.ts +++ b/test-e2e/tests/payments/subscription_test.ts @@ -127,7 +127,7 @@ function runTestSuite(props: ProviderProps, providerName: string) { I.see('Credit card'); I.see('PayPal'); - + I.see(props.paymentFields.creditCardholder); I.see('Card number'); I.see('Expiry date'); I.see('Security code'); From ca67ada708bca5496e37d8e88c94af1890d540bf Mon Sep 17 00:00:00 2001 From: Conventional Changelog Action Date: Thu, 6 Jul 2023 07:57:14 +0000 Subject: [PATCH 8/8] chore(release): v4.23.0 [skip ci] --- CHANGELOG.md | 14 ++++++++++++++ package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a72752165..597043fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# [4.23.0](https://github.com/jwplayer/ott-web-app/compare/v4.22.0...v4.23.0) (2023-07-06) + + +### Features + +* av ([743af3e](https://github.com/jwplayer/ott-web-app/commit/743af3e4b855fed61178f2b8f52757edeb944e6f)) +* code cleanup ([13a1e21](https://github.com/jwplayer/ott-web-app/commit/13a1e2120adf9486fb4e34b8544726811331c4c3)) +* comment fix ([6ab4dcb](https://github.com/jwplayer/ott-web-app/commit/6ab4dcbff33f95539cbf8c20fc18b67976463f07)) +* fix vite config definition ([2d772ed](https://github.com/jwplayer/ott-web-app/commit/2d772ed52ae835485fe48ffc4a0b3352ab9edcb5)) +* oiid for analytics ([898f94a](https://github.com/jwplayer/ott-web-app/commit/898f94a6683dfcc18020deef90fc8a1bc987b6b3)) +* update docs ([1fa1bcf](https://github.com/jwplayer/ott-web-app/commit/1fa1bcf093ff24514ead4e2a4ae943badf6f0871)) + + + # [4.22.0](https://github.com/jwplayer/ott-web-app/compare/v4.21.0...v4.22.0) (2023-07-05) diff --git a/package.json b/package.json index 2483b629d..da7a48089 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jw-ott-webapp", - "version": "4.22.0", + "version": "4.23.0", "main": "index.js", "repository": "https://github.com/jwplayer/ott-web-app.git", "author": "JW Player",