Skip to content

Commit

Permalink
Fix Prettier issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Apr 5, 2024
1 parent 6767053 commit d31b742
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
24 changes: 17 additions & 7 deletions nielsen/src/integration/NielsenHandler.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import type { Ad, AddTrackEvent, ChromelessPlayer, TextTrack, TextTrackEnterCueEvent, VolumeChangeEvent } from 'theoplayer';
import type {
Ad,
AddTrackEvent,
ChromelessPlayer,
TextTrack,
TextTrackEnterCueEvent,
VolumeChangeEvent
} from 'theoplayer';
import { loadNielsenLibrary } from '../nielsen/NOLBUNDLE';
import { AdMetadata, ContentMetadata, NielsenOptions } from '../nielsen/Types';
import { getAdType } from '../utils/Util';

const EMSG_PRIV_SUFFIX = "PRIV{";
const EMSG_PAYLOAD_SUFFIX = "payload=";
const EMSG_PRIV_SUFFIX = 'PRIV{';
const EMSG_PAYLOAD_SUFFIX = 'payload=';

export class NielsenHandler {
private player: ChromelessPlayer;
Expand Down Expand Up @@ -121,7 +128,7 @@ export class NielsenHandler {
if (content.id === 'PRIV' && content.ownerIdentifier.indexOf('www.nielsen.com') !== -1) {
this.nSdkInstance.ggPM('sendID3', content.ownerIdentifier);
}
}
};

private handleNielsenEmsgPayload = (content: any) => {
const cueContentText = this.decoder.decode(content);
Expand All @@ -143,16 +150,19 @@ export class NielsenHandler {
// - drop everything before ID3 PRIV{
let sanitizedPayload = payload.replace(/[^ -~]|\D+$/g, '');
const privIndex = sanitizedPayload.indexOf(EMSG_PRIV_SUFFIX);
sanitizedPayload = privIndex !== -1 ? sanitizedPayload.substring(privIndex + EMSG_PRIV_SUFFIX.length) : sanitizedPayload;
sanitizedPayload =
privIndex !== -1
? sanitizedPayload.substring(privIndex + EMSG_PRIV_SUFFIX.length)
: sanitizedPayload;

// send payload. Note that there is no separate method for sending emsg content.
this.nSdkInstance.ggPM('sendID3', sanitizedPayload);
}
} catch (error) {
console.error("NielsenConnector", "Failed to parse Nielsen payload", error);
console.error('NielsenConnector', 'Failed to parse Nielsen payload', error);
}
}
}
};

private onAdBegin = () => {
const currentAd = this.player.ads!.currentAds.filter((ad: Ad) => ad.type === 'linear');
Expand Down
6 changes: 5 additions & 1 deletion yospace/src/utils/YospaceUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type { YospaceServerSideAdInsertionConfiguration, YospaceSSAIIntegrationID, YospaceTypedSource } from 'theoplayer';
import type {
YospaceServerSideAdInsertionConfiguration,
YospaceSSAIIntegrationID,
YospaceTypedSource
} from 'theoplayer';
import { implementsInterface, isTypedSource } from './SourceUtils';
import { YospaceWindow } from '../yospace/YospaceWindow';

Expand Down
2 changes: 1 addition & 1 deletion yospace/src/yospace/SessionProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export interface SessionProperties {
}

export interface SessionPropertiesConstructor {
new(): SessionProperties;
new (): SessionProperties;
}

0 comments on commit d31b742

Please sign in to comment.