Skip to content

Commit

Permalink
fix(FEC-11863): default kava details are reported with no player vers…
Browse files Browse the repository at this point in the history
…ion (#513)

**the issue:**
When reporting to kava under the default partner id - it seems that the player version is missing.

**the solution:**
adding productVersion to source.url from __kalturaplayerdata instead of options obj

Solves FEC-11863
  • Loading branch information
lianbenjamin authored Jan 12, 2022
1 parent b548f9d commit 42425b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/common/utils/setup-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ function addProductVersion(url: string, productVersion: ?string): string {
* @returns {void}
*/
function validateProviderConfig(options: KPOptionsObject): void {
const {provider: providerOptions, productVersion}: {provider: ProviderOptionsObject, productVersion?: string} = options;
const {provider: providerOptions}: {provider: ProviderOptionsObject} = options;
const productVersion: string = getServerUIConf()?.productVersion;
if (!providerOptions.partnerId || providerOptions.partnerId === KAVA_DEFAULT_PARTNER) {
//create source object as a 'hack' to be able to use utility functions on url
const source = {
Expand Down
18 changes: 17 additions & 1 deletion test/src/common/utils/setup-helpers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,23 @@ describe('error handling', function () {
div.id = 'test-id';
document.body.appendChild(div);
(navigator.sendBeacon.getCall(0) === null).should.be.true;
SetupHelpers.validateProviderConfig({targetId: div.id, provider: {partnerId: 2504201}, productVersion: '7.37'});
SetupHelpers.validateProviderConfig({targetId: div.id, provider: {partnerId: 2504201}});
document.body.removeChild(div);
navigator.sendBeacon
.getCall(0)
.args[0].should.include(
'https://analytics.kaltura.com/api_v3/index.php?service=analytics&action=trackEvent&apiVersion=3.3.0&format=1&eventType=1&partnerId=2504201&entryId=1_3bwzbc9o&&eventIndex=1&position=0&referrer'
);
done();
});

it('should the beacon include clientVer', function (done) {
const div = document.createElement('DIV');
window.__kalturaplayerdata = {productVersion: '7.37'};
div.id = 'test-id';
document.body.appendChild(div);
(navigator.sendBeacon.getCall(0) === null).should.be.true;
SetupHelpers.validateProviderConfig({targetId: div.id, provider: {partnerId: 2504201}});
document.body.removeChild(div);
navigator.sendBeacon
.getCall(0)
Expand Down

0 comments on commit 42425b8

Please sign in to comment.