@clickview/lite 0.104.0-rc.2 → 0.104.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +779 -779
- package/dist/bundles.json +1 -1
- package/dist/en.json +1 -1
- package/dist/scripts/{CXN0_XjU.chunk.js → -KvTbeQV.chunk.js} +2 -2
- package/dist/scripts/{CXN0_XjU.chunk.js.map → -KvTbeQV.chunk.js.map} +1 -1
- package/dist/scripts/{Bu7Sr1dy.chunk.js → 0Fek4oFk.chunk.js} +2 -2
- package/dist/scripts/{Bu7Sr1dy.chunk.js.map → 0Fek4oFk.chunk.js.map} +1 -1
- package/dist/scripts/{CfRQYWGG.chunk.js → 5PKjjI4Y.chunk.js} +2 -2
- package/dist/scripts/{CfRQYWGG.chunk.js.map → 5PKjjI4Y.chunk.js.map} +1 -1
- package/dist/scripts/{z8IWZ1V1.chunk.js → AEOAlemi.chunk.js} +2 -2
- package/dist/scripts/{z8IWZ1V1.chunk.js.map → AEOAlemi.chunk.js.map} +1 -1
- package/dist/scripts/{DBcWjmUy.chunk.js → B1TqilLB.chunk.js} +2 -2
- package/dist/scripts/{DBcWjmUy.chunk.js.map → B1TqilLB.chunk.js.map} +1 -1
- package/dist/scripts/B1hsuVfV2.chunk.js +2 -0
- package/dist/scripts/{BwBWuxjr2.chunk.js.map → B1hsuVfV2.chunk.js.map} +1 -1
- package/dist/scripts/{BiUOH1CR.chunk.js → B2wDqI1S.chunk.js} +2 -2
- package/dist/scripts/{BiUOH1CR.chunk.js.map → B2wDqI1S.chunk.js.map} +1 -1
- package/dist/scripts/{DWJiezgB2.chunk.js → BBWnpWNB2.chunk.js} +2 -2
- package/dist/scripts/{DWJiezgB2.chunk.js.map → BBWnpWNB2.chunk.js.map} +1 -1
- package/dist/scripts/BILyzh0I.chunk.js +1 -0
- package/dist/scripts/{B-k4BlVQ2.chunk.js → BUVko1EF2.chunk.js} +3 -3
- package/dist/scripts/{B-k4BlVQ2.chunk.js.map → BUVko1EF2.chunk.js.map} +1 -1
- package/dist/scripts/{GolowYbA.chunk.js → BYbQI3CA.chunk.js} +2 -2
- package/dist/scripts/{GolowYbA.chunk.js.map → BYbQI3CA.chunk.js.map} +1 -1
- package/dist/scripts/{DFlO2qoz2.chunk.js → Bf9r1ZoF2.chunk.js} +2 -2
- package/dist/scripts/{DFlO2qoz2.chunk.js.map → Bf9r1ZoF2.chunk.js.map} +1 -1
- package/dist/scripts/{BpHA-MkZ.chunk.js → BiWUSyJr.chunk.js} +2 -2
- package/dist/scripts/{BpHA-MkZ.chunk.js.map → BiWUSyJr.chunk.js.map} +1 -1
- package/dist/scripts/{C8tDgg1l2.chunk.js → BlsbWOzw2.chunk.js} +2 -2
- package/dist/scripts/{C8tDgg1l2.chunk.js.map → BlsbWOzw2.chunk.js.map} +1 -1
- package/dist/scripts/{C_tdgSWS2.chunk.js → Bzk4AwVx2.chunk.js} +2 -2
- package/dist/scripts/{C_tdgSWS2.chunk.js.map → Bzk4AwVx2.chunk.js.map} +1 -1
- package/dist/scripts/{uSXjtjlJ.chunk.js → C3PXfYEd.chunk.js} +2 -2
- package/dist/scripts/{uSXjtjlJ.chunk.js.map → C3PXfYEd.chunk.js.map} +1 -1
- package/dist/scripts/{BgPye7Nd2.chunk.js → C46OeU6w2.chunk.js} +2 -2
- package/dist/scripts/{BgPye7Nd2.chunk.js.map → C46OeU6w2.chunk.js.map} +1 -1
- package/dist/scripts/{9oMRc0cb2.chunk.js → CAs2Sere2.chunk.js} +2 -2
- package/dist/scripts/{9oMRc0cb2.chunk.js.map → CAs2Sere2.chunk.js.map} +1 -1
- package/dist/scripts/{Bm5qACA52.chunk.js → CNfmLVE82.chunk.js} +2 -2
- package/dist/scripts/{Bm5qACA52.chunk.js.map → CNfmLVE82.chunk.js.map} +1 -1
- package/dist/scripts/{-7qiRMLt.chunk.js → CW1i-QHv.chunk.js} +2 -2
- package/dist/scripts/{-7qiRMLt.chunk.js.map → CW1i-QHv.chunk.js.map} +1 -1
- package/dist/scripts/{EKwCaE3J2.chunk.js → CX6c7KRp2.chunk.js} +2 -2
- package/dist/scripts/{EKwCaE3J2.chunk.js.map → CX6c7KRp2.chunk.js.map} +1 -1
- package/dist/scripts/{D_uAdX7E2.chunk.js → CaCm4N_d2.chunk.js} +2 -2
- package/dist/scripts/{D_uAdX7E2.chunk.js.map → CaCm4N_d2.chunk.js.map} +1 -1
- package/dist/scripts/{DW_sm5se2.chunk.js → CfNYFxJl2.chunk.js} +2 -2
- package/dist/scripts/{DW_sm5se2.chunk.js.map → CfNYFxJl2.chunk.js.map} +1 -1
- package/dist/scripts/{CVL6bQWp.chunk.js → CpzveYo2.chunk.js} +2 -2
- package/dist/scripts/{CVL6bQWp.chunk.js.map → CpzveYo2.chunk.js.map} +1 -1
- package/dist/scripts/{CFduwlo0.chunk.js → Cqq1N9xw.chunk.js} +2 -2
- package/dist/scripts/{CFduwlo0.chunk.js.map → Cqq1N9xw.chunk.js.map} +1 -1
- package/dist/scripts/{UCiRB6cQ.chunk.js → CwFYdvvA.chunk.js} +2 -2
- package/dist/scripts/{UCiRB6cQ.chunk.js.map → CwFYdvvA.chunk.js.map} +1 -1
- package/dist/scripts/{By9Vb8Wn.chunk.js → CwYg3Mqk.chunk.js} +2 -2
- package/dist/scripts/{By9Vb8Wn.chunk.js.map → CwYg3Mqk.chunk.js.map} +1 -1
- package/dist/scripts/{DLcyKjA7.chunk.js → Cyit3dMk.chunk.js} +2 -2
- package/dist/scripts/{DLcyKjA7.chunk.js.map → Cyit3dMk.chunk.js.map} +1 -1
- package/dist/scripts/{BxjzTnvL2.chunk.js → D-iyHqNw2.chunk.js} +3 -3
- package/dist/scripts/{BxjzTnvL2.chunk.js.map → D-iyHqNw2.chunk.js.map} +1 -1
- package/dist/scripts/{DICsRDM42.chunk.js → DH_0KtTK2.chunk.js} +2 -2
- package/dist/scripts/{DICsRDM42.chunk.js.map → DH_0KtTK2.chunk.js.map} +1 -1
- package/dist/scripts/{BTcLMVw4.chunk.js → DKDWcWxk.chunk.js} +2 -2
- package/dist/scripts/{BTcLMVw4.chunk.js.map → DKDWcWxk.chunk.js.map} +1 -1
- package/dist/scripts/{Df6x5Ekm2.chunk.js → DN82USWW2.chunk.js} +2 -2
- package/dist/scripts/{Df6x5Ekm2.chunk.js.map → DN82USWW2.chunk.js.map} +1 -1
- package/dist/scripts/{C62uevy9.chunk.js → DWo8DfD9.chunk.js} +2 -2
- package/dist/scripts/{C62uevy9.chunk.js.map → DWo8DfD9.chunk.js.map} +1 -1
- package/dist/scripts/{Bh-26cqn.chunk.js → Dnz8CbEu.chunk.js} +3 -3
- package/dist/scripts/{Bh-26cqn.chunk.js.map → Dnz8CbEu.chunk.js.map} +1 -1
- package/dist/scripts/{CukXgE1z.chunk.js → Dt5731Ay.chunk.js} +2 -2
- package/dist/scripts/{CukXgE1z.chunk.js.map → Dt5731Ay.chunk.js.map} +1 -1
- package/dist/scripts/{DCPsmD1m.chunk.js → Dtag-27K.chunk.js} +2 -2
- package/dist/scripts/{DCPsmD1m.chunk.js.map → Dtag-27K.chunk.js.map} +1 -1
- package/dist/scripts/{DOCHl5Sy.chunk.js → DyE6EUDb.chunk.js} +2 -2
- package/dist/scripts/{DOCHl5Sy.chunk.js.map → DyE6EUDb.chunk.js.map} +1 -1
- package/dist/scripts/{app-CuKrDFuc.js → app-CfAhMxn1.js} +4 -4
- package/dist/scripts/{app-CuKrDFuc.js.map → app-CfAhMxn1.js.map} +1 -1
- package/dist/scripts/{DerPQKk6.chunk.js → cDv6zuhh.chunk.js} +2 -2
- package/dist/scripts/{DerPQKk6.chunk.js.map → cDv6zuhh.chunk.js.map} +1 -1
- package/dist/scripts/jAtAipGN.chunk.js +2 -0
- package/dist/scripts/{CpsbRDII.chunk.js.map → jAtAipGN.chunk.js.map} +1 -1
- package/dist/scripts/{CXKdMqPJ.chunk.js → pKtXmGbN.chunk.js} +2 -2
- package/dist/scripts/{CXKdMqPJ.chunk.js.map → pKtXmGbN.chunk.js.map} +1 -1
- package/dist/scripts/{DhdM2yGm.chunk.js → qRLSbnEr.chunk.js} +2 -2
- package/dist/scripts/{DhdM2yGm.chunk.js.map → qRLSbnEr.chunk.js.map} +1 -1
- package/package.json +1 -1
- package/dist/scripts/BwBWuxjr2.chunk.js +0 -2
- package/dist/scripts/CCBk_ENs.chunk.js +0 -1
- package/dist/scripts/CpsbRDII.chunk.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{m as e}from"./
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
import{m as e}from"./DKDWcWxk.chunk.js";var t=e.getPlugin(`plugin`),n=10,r=class extends t{constructor(e,t){if(super(e),t.startTime===void 0)throw Error(`Invalid clip start`);if(t.endTime===void 0)throw Error(`Invalid clip end`);if(t.startTime>t.endTime)throw Error(`Clip start cannot be greater than clip end`);this._clipStart=parseFloat(t.startTime.toPrecision(4)),this._clipEnd=parseFloat(t.endTime.toPrecision(4)),this.playerEndedFn=this.player.ended.bind(e),this.playerDurationFn=this.player.duration.bind(e),this.playerCurrentTimeFn=this.player.currentTime.bind(e),this.playerbufferedFn=this.player.buffered.bind(e),this.player.ended=this.ended.bind(this),this.player.duration=this.duration.bind(this),this.player.currentTime=this.currentTime.bind(this),this.player.buffered=this.buffered.bind(this),this.initialize(),this.player.ready(()=>{this.player.trigger(`durationchange`)})}get clipStart(){let e=this.playerDurationFn();return this._clipStart>e?e:this._clipStart}get clipEnd(){let e=this.playerDurationFn();return e<=0?this._clipEnd:this._clipEnd>e?e:this._clipEnd}dispose(){this.player.off(`timeupdate`,this.onTimeUpdate),this.player.off(`play`,this.onPlay),this.player.ended=this.playerEndedFn,this.player.duration=this.playerDurationFn,this.player.currentTime=this.playerCurrentTimeFn,this.player.buffered=this.playerbufferedFn,this.player.trigger(`durationchange`),super.dispose()}initialize(){this.onTimeUpdate=this.onTimeUpdate.bind(this),this.onPlay=this.onPlay.bind(this),this.player.on(`timeupdate`,this.onTimeUpdate),this.player.on(`play`,this.onPlay)}onPlay(){this._isEnded&&this.player.currentTime(0)}onTimeUpdate(){let e=this.getCurrentTime(!1);if(e>this.clipEnd){this._isEnded||=(this.player.pause(),this.player.trigger(`ended`),!0);return}this._isEnded=!1,e<this.clipStart-n&&this.playerCurrentTimeFn(this.clipStart,!0)}ended(){return this.getCurrentTime(!1)>this.clipEnd}duration(e){return e&&e>0&&(this.playerDurationFn()?console.info(`The duration of the player has already been set. This is a no-op.`):this.playerDurationFn(e)),this.clipEnd-this.clipStart}currentTime(e,...t){if(typeof e!=`number`)return this.getCurrentTime(!0);let n=e+this.clipStart;this.playerCurrentTimeFn(n,...t)}getCurrentTime(e){let t=this.playerCurrentTimeFn(),n=0;return t>=this.clipStart&&(n=t-this.clipStart),this.player.getCache().currentTime=n,e?n:t}buffered(){let t=this.playerbufferedFn(),n=[];for(let e=0;e<t.length;e++)n[e]=[Math.max(0,t.start(e)-this.clipStart),Math.min(Math.max(0,t.end(e)-this.clipStart),this.player.duration())];return e.createTimeRanges(n)}};e.registerPlugin(`clipPlugin`,r);
|
|
2
|
+
//# sourceMappingURL=cDv6zuhh.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"cDv6zuhh.chunk.js","names":[],"sources":["../../../player/src/plugins/clip-plugin/clip-plugin.ts"],"sourcesContent":["import videojs, { VideoJsPlayer } from 'video.js';\n\nconst Plugin = videojs.getPlugin('plugin');\n\n/**\n * TODO:\n * The value below is set quite high to compensate for the ridiculous amount of drift that can occur\n * when casting to a Vivi device. This is a temporary fix until we can get Vivi to fix the issue on their end.\n */\nconst CLIP_SEEK_DRIFT_IN_SECONDS = 10;\n\nexport interface ClipPluginOptions {\n startTime: number;\n endTime: number;\n}\n\nexport class ClipPlugin extends Plugin {\n private _clipStart: number;\n private _clipEnd: number;\n private _isEnded: boolean;\n\n private playerEndedFn: () => boolean;\n private playerDurationFn: (seconds?: number) => number;\n private playerCurrentTimeFn: (seconds?: number, ...args: any[]) => number;\n private playerbufferedFn: () => TimeRanges;\n\n constructor(player: VideoJsPlayer, options: ClipPluginOptions) {\n super(player);\n\n // validate clip start/end\n if (options.startTime === undefined) {\n throw Error('Invalid clip start');\n }\n\n if (options.endTime === undefined) {\n throw Error('Invalid clip end');\n }\n\n if (options.startTime > options.endTime) {\n throw Error('Clip start cannot be greater than clip end');\n }\n\n this._clipStart = parseFloat(options.startTime.toPrecision(4));\n this._clipEnd = parseFloat(options.endTime.toPrecision(4));\n\n // save old player functions\n this.playerEndedFn = this.player.ended.bind(player);\n this.playerDurationFn = this.player.duration.bind(player);\n this.playerCurrentTimeFn = this.player.currentTime.bind(player);\n this.playerbufferedFn = this.player.buffered.bind(player);\n\n // overwrite the base player function with our new fancy ones\n this.player.ended = this.ended.bind(this);\n this.player.duration = this.duration.bind(this);\n this.player.currentTime = this.currentTime.bind(this);\n this.player.buffered = this.buffered.bind(this);\n\n this.initialize();\n\n this.player.ready(() => {\n // manually trigger a duation change since we have a new duration from the clip\n this.player.trigger('durationchange');\n });\n }\n\n /**\n * Ensure that the clip start is not greater than the total video duration\n */\n public get clipStart(): number {\n const videoDuration = this.playerDurationFn();\n\n if (this._clipStart > videoDuration)\n return videoDuration;\n\n return this._clipStart;\n }\n\n /**\n * Ensure that the clip end is not greater than the total video duration\n */\n public get clipEnd(): number {\n const videoDuration = this.playerDurationFn();\n\n // The video duration may not have been determined yet, so we can't do\n // any clamping right now..\n if (videoDuration <= 0)\n return this._clipEnd;\n\n // Clamp the clip end to the video duration\n if (this._clipEnd > videoDuration)\n return videoDuration;\n\n return this._clipEnd;\n }\n\n public dispose(): void {\n this.player.off('timeupdate', this.onTimeUpdate);\n this.player.off('play', this.onPlay);\n\n // put the original functions back\n this.player.ended = this.playerEndedFn;\n this.player.duration = this.playerDurationFn;\n this.player.currentTime = this.playerCurrentTimeFn;\n this.player.buffered = this.playerbufferedFn;\n\n // trigger another durationchange since the duration will now go back to the original\n this.player.trigger('durationchange');\n\n super.dispose();\n }\n\n private initialize(): void {\n this.onTimeUpdate = this.onTimeUpdate.bind(this);\n this.onPlay = this.onPlay.bind(this);\n\n this.player.on('timeupdate', this.onTimeUpdate);\n this.player.on('play', this.onPlay);\n }\n\n private onPlay(): void {\n // if we try to play but the clip has ended, go back to the start\n if (this._isEnded) {\n this.player.currentTime(0);\n }\n }\n\n private onTimeUpdate(): void {\n const currentTime = this.getCurrentTime(false);\n\n // check ended\n if (currentTime > this.clipEnd) {\n if (!this._isEnded) {\n this.player.pause();\n this.player.trigger('ended');\n \n this._isEnded = true;\n }\n\n return;\n }\n\n this._isEnded = false;\n\n // ensure video is playing from the correct clip start (taking into account some seek drift)\n if (currentTime < (this.clipStart - CLIP_SEEK_DRIFT_IN_SECONDS)) {\n this.playerCurrentTimeFn(this.clipStart, true);\n }\n }\n\n private ended(): boolean {\n return this.getCurrentTime(false) > this.clipEnd;\n }\n\n private duration(seconds?: number): number {\n // set the underlying player duration (and cache) if it hasn't been set already\n if (seconds && seconds > 0) {\n const existingDuration = this.playerDurationFn();\n\n if (existingDuration)\n console.info('The duration of the player has already been set. This is a no-op.');\n else\n this.playerDurationFn(seconds);\n }\n \n return this.clipEnd - this.clipStart;\n }\n\n private currentTime(seconds?: number, ...args: any[]): number {\n if (typeof seconds !== 'number') {\n return this.getCurrentTime(true);\n }\n\n const correctedSeconds = seconds + this.clipStart;\n\n this.playerCurrentTimeFn(correctedSeconds, ...args);\n\n return;\n }\n\n /**\n * Gets the current time of the video and updates the videojs currentTime cache\n * @param clipTime Set to true to return the current time in the context of a clip\n */\n private getCurrentTime(clipTime: boolean): number {\n const playerCurrentTime = this.playerCurrentTimeFn();\n let time = 0;\n\n if (playerCurrentTime >= this.clipStart) {\n time = playerCurrentTime - this.clipStart;\n }\n\n // ensure that the videojs currentTime cache reflects our fake time\n this.player.getCache().currentTime = time;\n\n if (clipTime)\n return time;\n\n return playerCurrentTime;\n }\n\n private buffered(): TimeRanges {\n const buff = this.playerbufferedFn();\n const ranges = [];\n\n for (let i = 0; i < buff.length; i++) {\n ranges[i] = [\n Math.max(0, buff.start(i) - this.clipStart),\n Math.min(Math.max(0, buff.end(i) - this.clipStart), this.player.duration())\n ];\n }\n\n return videojs.createTimeRanges(ranges as any);\n }\n}\n\nvideojs.registerPlugin('clipPlugin', ClipPlugin);\n\ndeclare module 'video.js' {\n export interface VideoJsPlayer {\n clipPlugin(options: ClipPluginOptions): void;\n }\n}\n"],"mappings":"wCAEA,IAAM,EAAS,EAAQ,UAAU,QAAQ,EAOnC,EAA6B,GAOtB,EAAb,cAAgC,CAAO,CAUrC,YAAY,EAAuB,EAA4B,CAI7D,GAHA,MAAM,CAAM,EAGR,EAAQ,YAAc,IAAA,GACxB,MAAM,MAAM,oBAAoB,EAGlC,GAAI,EAAQ,UAAY,IAAA,GACtB,MAAM,MAAM,kBAAkB,EAGhC,GAAI,EAAQ,UAAY,EAAQ,QAC9B,MAAM,MAAM,4CAA4C,EAG1D,KAAK,WAAa,WAAW,EAAQ,UAAU,YAAY,CAAC,CAAC,EAC7D,KAAK,SAAW,WAAW,EAAQ,QAAQ,YAAY,CAAC,CAAC,EAGzD,KAAK,cAAgB,KAAK,OAAO,MAAM,KAAK,CAAM,EAClD,KAAK,iBAAmB,KAAK,OAAO,SAAS,KAAK,CAAM,EACxD,KAAK,oBAAsB,KAAK,OAAO,YAAY,KAAK,CAAM,EAC9D,KAAK,iBAAmB,KAAK,OAAO,SAAS,KAAK,CAAM,EAGxD,KAAK,OAAO,MAAQ,KAAK,MAAM,KAAK,IAAI,EACxC,KAAK,OAAO,SAAW,KAAK,SAAS,KAAK,IAAI,EAC9C,KAAK,OAAO,YAAc,KAAK,YAAY,KAAK,IAAI,EACpD,KAAK,OAAO,SAAW,KAAK,SAAS,KAAK,IAAI,EAE9C,KAAK,WAAW,EAEhB,KAAK,OAAO,UAAY,CAEtB,KAAK,OAAO,QAAQ,gBAAgB,CACtC,CAAC,CACH,CAKA,IAAW,WAAoB,CAC7B,IA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,EAAkB,GAAG,EAAqB,CAC5D,GAAI,OAAO,GAAY,SACrB,OAAO,KAAK,eAAe,EAAI,EAGjC,IAAM,EAAmB,EAAU,KAAK,UAExC,KAAK,oBAAoB,EAAkB,GAAG,CAAI,CAGpD,CAMA,eAAuB,EAA2B,CAChD,IAAM,EAAoB,KAAK,oBAAoB,EAC/C,EAAO,EAYX,OAVI,GAAqB,KAAK,YAC5B,EAAO,EAAoB,KAAK,WAIlC,KAAK,OAAO,SAAS,CAAC,CAAC,YAAc,EAEjC,EACK,EAEF,CACT,CAEA,UAA+B,CAC7B,IAAM,EAAO,KAAK,iBAAiB,EAC7B,EAAS,CAAC,EAEhB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,OAAQ,IAC/B,EAAO,GAAK,CACV,KAAK,IAAI,EAAG,EAAK,MAAM,CAAC,EAAI,KAAK,SAAS,EAC1C,KAAK,IAAI,KAAK,IAAI,EAAG,EAAK,IAAI,CAAC,EAAI,KAAK,SAAS,EAAG,KAAK,OAAO,SAAS,CAAC,CAC5E,EAGF,OAAO,EAAQ,iBAAiB,CAAa,CAC/C,CACF,EAEA,EAAQ,eAAe,aAAc,CAAU"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o as e}from"./DAXXjFlN.chunk.js";import{y as t}from"./BftnFbcr.chunk.js";import"./DFZS3Ffo.chunk.js";import{t as n}from"./e57H3T-k.chunk.js";import{t as r}from"./C2w0pmFW.chunk.js";import{t as i}from"./BXTI9cmX.chunk.js";import{n as a}from"./BVnMI-dl.chunk.js";import{t as o}from"./C1SLt-ar.chunk.js";import{U as s,d as c,z as l}from"./NlCAcBdo.chunk.js";import{t as u}from"./1LRpIhCn.chunk.js";import{n as d}from"./DTGfiG8Y.chunk.js";import{t as f}from"./eoAypzU3.chunk.js";import{t as p}from"./7-GJWRH82.chunk.js";import{t as m}from"./DpCWroEe2.chunk.js";import{t as h}from"./DYDxLHiV2.chunk.js";import{t as g}from"./DBkEQkKm2.chunk.js";import{t as _}from"./BUoougrH.chunk.js";import{t as v}from"./CzuHD4Ht.chunk.js";import{n as y,o as b,t as x}from"./CsWeCs8U2.chunk.js";import{t as S}from"./BwelEZs92.chunk.js";import{t as C}from"./HT_TXzUd2.chunk.js";import{t as w}from"./DFIgRAfX2.chunk.js";import{t as T}from"./DBHDBu1Y.chunk.js";import{t as E}from"./ryLD1Tv-.chunk.js";var D=e(r(),1),O={getCompanyAppLink(e,t){return{application:i.MOVIES_AND_TV,action:f.MoviesAndTv.COMPANY_DASHBOARD,args:[t,e.id,n.slugify(e.name)]}},getClassificationAppLink(e,t,n){return _.getAppLink(e,t?{moviesAndTv:!0}:{},n)},getCollectionActions(e,t,n,r){return t?[{svg:E,appLink:{application:i.SHARE,action:f.Share.SHARE,args:[e.id],params:{entityType:n}},analyticsData:{id:e.id},analyticsOptions:{...r,actionType:l.Share,workflowPhase:s.Start,eventVersion:c.V3},button:!0}]:[]},getSeriesAppLink(e,t,n){return h.getSeriesAppLink(e,t?{mtv:!0}:{},n)},getPlaylistAppLink(e,t,r){return{application:i.PLAYLISTS,action:f.Playlists.PLAYLIST,args:[r,e.id,n.slugify(e.name)],params:t?{mtv:!0}:null}},getAppLinks(e,t,n,r){return{getVideoAppLink:(e,t)=>g.getAppLink(e,{...t,moviesAndTv:n},r),getPlaylistAppLink:e=>O.getPlaylistAppLink(e,n,r),getSeriesAppLink:e=>O.getSeriesAppLink(e,n,r),getCompanyAppLink:n=>{let r=u.getPresentationSlugByCompany(n,e,t);return O.getCompanyAppLink(n,r)},getClassificationAppLink:e=>O.getClassificationAppLink(e,n,t),getPreviewQuestionsAppLink:e=>v.getPreviewQuestionsAppLink(e),getCollectionActions:O.getCollectionActions,searchSettings:{application:i.SETTINGS,action:f.Settings.PLATFORM_SETTINGS}}},isSearchAppLink(e){return e.application===i.SEARCH&&e.action===f.Search.HOME},useReferrerAppLink(){let e={application:i.DASHBOARD,action:f.Dashboard.HOME,args:[null]},[t,n]=D.useState(e),r=m.getCurrentRoute();return D.useEffect(()=>{O.isSearchAppLink(r.appLink)||n(r.appLink)},[r.appLink.application,r.appLink.action]),t},useOnFilterChange(e,t){let n={...t};delete n.query;let r=Object.keys(n).map(e=>n[e]).sort((e,t)=>e-t);D.useEffect(()=>{e()},[r.join(`:`)])},triggerAppLink(e,r={},o){let s={};r=o?a.omit(r,[`query`]):{},e&&(s.query=n.removeExtraSpace(e)),Object.keys(r).length&&(s={...s,...r}),t.trigger({application:i.SEARCH,action:f.Search.HOME,params:s},{replace:o})},getInitialQuery(){let e=m.getCurrentRoute().appLink;return O.isSearchAppLink(e)?e.params?.query??``:``},isValidSearch(e,t){if(e?.trim())return!0;if(!O.isSearchAppLink(t))return!1;let n=t?.params?.tagOrClassification,r=t?.params?.rating,i=t?.params?.moviesAndTv,a=t?.params?.source,o=t?.params?.scopeId;return Array.isArray(n)?!!n.length:!!n?.length||!!r?.length||!!i?.length||!!a?.length||!!o?.length},getFirstSeries(e){return o.first(e.items)},getFirstPlaylist(e){return o.first(e.items)},getVideoAppLink(e,t){return{application:i.VIDEOS,action:f.Videos.PLAY_VIDEO,args:[t,e.id,n.slugify(e.name)]}},getQuery(e){return e.query?e.query:e.tagOrClassification?(Array.isArray(e.tagOrClassification)?e.tagOrClassification:[e.tagOrClassification]).join(` `):``},getInaccessibleIndices(e){let{isLearner:t,queryParams:n,hasMoviesAndTv:r}=e,i=[];return(t||n.moviesAndTv)&&(i.push(`clip`),i.push(`interactive`)),r||i.push(`company`),i},getFilters(e){let{data:t,inaccessibleIndices:n,tagsAndClassifications:r,_hasNewSearch:i,_hasPartnerProfiles:a,hasCVFilters:o}=e;if(!t.hasDataLoaded||!i&&r&&!r.hasCompleted)return null;let{moviesAndTvDashboard:s,ratings:c,yearGroups:l,userDetails:u,schoolLevels:d,availableTopics:f,libraries:m,currentUser:h,isLearner:g,hasCustomLibraries:_,hasMoviesAndTv:v,isGuest:S,showStreamableSearchResults:T}=t,E=C.IS_XMAS?y.MoviesAndTv(p.MoviesAndTv.XMAS_SOCK,p.MoviesAndTv.XMAS_GIFTS):y.MoviesAndTv(p.MoviesAndTv.POPCORN_BOX,p.MoviesAndTv.POPCORN_BITS),D=C.IS_XMAS?y.MoviesAndTv(p.MoviesAndTv.POPCORN_BOX,p.MoviesAndTv.POPCORN_BITS):null,O=[];o?(v&&s.data?.id?O.push(E):O.push(D),h.data?.isAuthenticated&&O.push(y.Source(b.getOptions({libraries:m,isLearner:g,isGuest:S,hasCustomLibraries:_,liveStreams:T}))),S||O.push(y.Rating(c.data,l.data&&u.data&&w.getStudentMaxRating(l.data,u.data))),O.push(y.HasResources()),O.push(y.ObjectTypes(n,i,a)),i||O.push(y.TagOrClassification(r.data))):h.data?.isAuthenticated&&O.push(y.Source(b.getOptions({libraries:m,isLearner:g,isGuest:S,hasCustomLibraries:_,hideCVLibrary:!0,liveStreams:T})));let k=y.Presentation(d.data?.schoolLevels,i);x.showPresentationFilter(k)&&O.unshift(k);let A=y.Topics(f.data?.topics.map(e=>({name:e.name,id:e.topicIds.join(`:`)})));A.options&&A.options.length>1&&O.unshift(A);let j=[y.ProductionYear(),y.HasSubtitles(),y.IsHD()];return o&&j.push(y.IsClickViewContent()),j.push(y.Duration()),{mainFilters:O.filter(Boolean),moreFilters:x.getMoreFilters(j)}},getSearchAppLink(e,t){return{application:i.SEARCH,action:f.Search.HOME,params:{...t,query:e}}},getBackendFilters(e){if(!e.hasDataLoaded)return null;let{queryParams:t,ratings:n,currentPresentationId:r,isLearner:i,libraries:a,hasMoviesAndTv:o,streamableLibraryId:s,exchangeLibraryId:c,showExchangeSearchResults:l,showStreamableSearchResults:u}=e,d=x.buildBackendFilterParams(t,n.data,[r],i,a,s),f=`${S.FILTER_PARAM_PREFIX}excludeLibraryExclusive`,p=[];s&&!u&&p.push(s),c&&!l&&p.push(c),d[f]=p;let m=O.getInaccessibleIndices({isLearner:i,hasMoviesAndTv:o,queryParams:t});return{queryParams:t,backendFilters:d,appliedIndices:x.getAppliedIndices(e.queryParams).filter(e=>e!==`classification`&&e!==`company`).filter(e=>!m.find(t=>t===e)),inaccessibleIndices:m}},getBackendFiltersV2(e){if(!e.hasDataLoaded)return null;let{queryParams:t,ratings:n,isLearner:r,libraries:i,hasMoviesAndTv:a,streamableLibraryId:o,exchangeLibraryId:s,showExchangeSearchResults:c,availablePresentations:l,showStreamableSearchResults:u}=e,f=x.buildBackendFilterParams(t,n.data,l?.map(e=>e.id),r,i,o),p=[];o&&!u&&p.push(o),s&&!c&&p.push(s);let m=O.getInaccessibleIndices({isLearner:r,hasMoviesAndTv:a,queryParams:t}),h=`${S.FILTER_PARAM_PREFIX}indicesFilters`,g=x.getAppliedIndices(e.queryParams,!0,e.settings.hasPartnerProfiles).filter(e=>!m.find(t=>t===e)),_=l?.map(e=>e.id);return f[h]=g.map(e=>{let t={index:e};if(e===`video`&&p.length)return{...t,filters:{excludeLibraryExclusive:[...p]}};if(e===`classification`){let e={...t,filters:{classificationType:d.Subject,status:[T.Published,T.ComingSoon]}};return l?.length&&(e.filters.presentation=_),e}return e===`company`?{...t,filters:{presentation:_}}:t}),{queryParams:t,backendFilters:f,appliedIndices:g,inaccessibleIndices:m}}};export{O as t};
|
|
2
|
+
//# sourceMappingURL=jAtAipGN.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CpsbRDII.chunk.js","names":[],"sources":["../../src/apps/search/utils/SearchHelper.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Core } from 'libs/common/core';\nimport { Flight } from 'libs/common/flight';\nimport { HashObject } from 'libs/common/react/interfaces';\nimport { ArrayHelper } from 'libs/common/react/utils/ArrayHelper';\nimport { ObjectHelper } from 'libs/common/react/utils/ObjectHelper';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { AnalyticsOptions, EventVersion, UserAction, WorkflowPhase } from 'libs/analytics/interfaces';\n\nimport { MixedSearchResultAppLinks } from 'libs/shared/apps/search/components/mixed-search-results/MixedSearchResults';\nimport { FilterConstants } from 'libs/shared/apps/search/constants/FilterConstants';\nimport { FilterOption, SearchIndices, SearchResultsObject, TopicResults } from 'libs/shared/apps/search/interfaces';\nimport { FilterHelper, Filters } from 'libs/shared/apps/search/utils/FilterHelper';\nimport { RatingFilterHelper } from 'libs/shared/apps/search/utils/RatingFilterHelper';\nimport { ResultGrouping } from 'libs/shared/apps/search/utils/SharedSearchHelper';\nimport { SourceFilterHelper } from 'libs/shared/apps/search/utils/SourceFilterHelper';\nimport { ActionOptions } from 'libs/shared/components/actions/Actions';\nimport { XmasConstants } from 'libs/shared/constants/XmasConstants';\nimport { ClassificationStatus } from 'libs/shared/enums/ClassificationStatus';\nimport { ClassificationType } from 'libs/shared/enums/ClassificationType';\nimport { SettingsHash } from 'libs/shared/hooks/useSettings';\nimport { ShareSvg } from 'libs/shared/images/svg/actions/ShareSvg';\nimport { Classification, Company, CuratedDashboard, CurrentUser, Library, Playlist, Presentation, Rating, SchoolLevels, Series, User, Video, YearGroup } from 'libs/shared/interfaces';\nimport { GetVideoAppLinkOptions } from 'libs/shared/interfaces/VideoAppLinkOptions';\nimport { ContextService } from 'libs/shared/services/ContextService';\n\nimport { ImageUrls } from 'shared/constants/ImageUrls';\nimport { Actions } from 'shared/constants/LiteActions';\nimport { AppChannels } from 'shared/constants/LiteRadioChannels';\nimport { ClassificationAppLinkHelper } from 'shared/utils/ClassificationAppLinkHelper';\nimport { InteractiveHelpers } from 'shared/utils/InteractiveHelper';\nimport { LitePresentationHelper } from 'shared/utils/LitePresentationHelper';\nimport { VideoAppLinkHelper } from 'shared/utils/VideoAppLinkHelper';\n\nimport { SeriesAppLinkHelper } from 'apps/series/SeriesAppLinkHelper';\n\ninterface GetFiltersOptions {\n data: {\n isLearner: boolean,\n moviesAndTvDashboard: Flight.Response<CuratedDashboard>,\n ratings: Flight.Response<Rating[]>,\n yearGroups: Flight.Response<YearGroup[]>,\n userDetails: Flight.Response<User>,\n schoolLevels: Flight.Response<SchoolLevels>,\n availableTopics: Flight.Response<TopicResults>,\n libraries: Library[],\n currentUser: Flight.Response<CurrentUser>,\n hasDataLoaded: boolean,\n hasCustomLibraries: boolean,\n hasMoviesAndTv: boolean,\n isGuest: boolean,\n showStreamableSearchResults: boolean\n };\n inaccessibleIndices: SearchIndices[];\n tagsAndClassifications?: Flight.Response<string[]>;\n hasCVFilters?: boolean;\n /**\n * Incremental changes flag for search v2\n */\n _hasNewSearch?: boolean;\n \n _hasPartnerProfiles?: boolean;\n}\n\nexport const SearchHelper = {\n getCompanyAppLink(company: Company, presentationSlug: string | null): Core.AppLink {\n return {\n application: AppChannels.MOVIES_AND_TV,\n action: Actions.MoviesAndTv.COMPANY_DASHBOARD,\n args: [ presentationSlug, company.id, TextHelper.slugify(company.name) ]\n };\n },\n\n getClassificationAppLink(\n classification: Classification,\n moviesAndTv: boolean,\n availablePresentations: Presentation[]\n ): Core.AppLink {\n return ClassificationAppLinkHelper.getAppLink(\n classification,\n moviesAndTv ? { moviesAndTv: true } : {},\n availablePresentations\n );\n },\n\n getCollectionActions(\n collection: Series | Playlist,\n showActions: boolean,\n collectionType: 'series' | 'playlist',\n baseAnalyticsOptions: AnalyticsOptions\n ): ActionOptions[] {\n if (!showActions)\n return [];\n \n return [{\n svg: ShareSvg,\n appLink: {\n application: AppChannels.SHARE,\n action: Actions.Share.SHARE,\n args: [collection.id],\n params: { entityType: collectionType }\n },\n analyticsData: { id: collection.id },\n analyticsOptions: {\n ...baseAnalyticsOptions,\n actionType: UserAction.Share,\n workflowPhase: WorkflowPhase.Start,\n eventVersion: EventVersion.V3\n },\n button: true\n }];\n },\n\n getSeriesAppLink(series: Series, moviesAndTv: boolean, presentationSlug: string | null): Core.AppLink {\n return SeriesAppLinkHelper.getSeriesAppLink(series, moviesAndTv ? { mtv: true } : {}, presentationSlug);\n },\n\n getPlaylistAppLink(playlist: Playlist, moviesAndTv: boolean, presentationSlug: string | null): Core.AppLink {\n return {\n application: AppChannels.PLAYLISTS,\n action: Actions.Playlists.PLAYLIST,\n args: [ presentationSlug, playlist.id, TextHelper.slugify(playlist.name) ],\n params: moviesAndTv ? { mtv: true } : null\n };\n },\n\n getAppLinks(\n presentation: Presentation,\n availablePresentations: Presentation[],\n moviesAndTv: boolean,\n presentationSlug: string | null\n ): MixedSearchResultAppLinks {\n return {\n getVideoAppLink: (video, opts: GetVideoAppLinkOptions) =>\n VideoAppLinkHelper.getAppLink(video, { ...opts, moviesAndTv }, presentationSlug),\n getPlaylistAppLink: playlist => SearchHelper.getPlaylistAppLink(playlist, moviesAndTv, presentationSlug),\n getSeriesAppLink: series => SearchHelper.getSeriesAppLink(series, moviesAndTv, presentationSlug),\n getCompanyAppLink: company => {\n const slug = LitePresentationHelper.getPresentationSlugByCompany(\n company,\n presentation,\n availablePresentations\n );\n return SearchHelper.getCompanyAppLink(company, slug);\n },\n getClassificationAppLink:\n classification => SearchHelper.getClassificationAppLink(classification, moviesAndTv, availablePresentations),\n getPreviewQuestionsAppLink: interactive => InteractiveHelpers.getPreviewQuestionsAppLink(interactive),\n getCollectionActions: SearchHelper.getCollectionActions,\n searchSettings: {\n application: AppChannels.SETTINGS,\n action: Actions.Settings.PLATFORM_SETTINGS\n }\n };\n },\n\n isSearchAppLink(currentAppLink: Core.AppLink): boolean {\n return currentAppLink.application === AppChannels.SEARCH && currentAppLink.action === Actions.Search.HOME;\n },\n\n useReferrerAppLink(): Core.AppLink {\n const defaultReferrerAppLink: Core.AppLink = {\n application: AppChannels.DASHBOARD,\n action: Actions.Dashboard.HOME,\n args: [null as string]\n };\n \n const [ referrerApplink, setReferrerAppLink ] = React.useState<Core.AppLink>(defaultReferrerAppLink);\n \n const currentRoute = ContextService.getCurrentRoute();\n \n React.useEffect(() => {\n if (SearchHelper.isSearchAppLink(currentRoute.appLink))\n return;\n\n setReferrerAppLink(currentRoute.appLink);\n }, [ currentRoute.appLink.application, currentRoute.appLink.action ]);\n \n return referrerApplink;\n },\n\n useOnFilterChange(fetchResults: (cursor?: string) => void, queryParams: HashObject): void {\n const params = { ...queryParams };\n delete params.query;\n\n const sortedValues = Object.keys(params).map(filterName => params[filterName]).sort((a, b) => a - b);\n\n React.useEffect(() => {\n fetchResults();\n }, [sortedValues.join(':')]);\n },\n\n triggerAppLink(query: string, otherQueryParams: HashObject = {}, isOnSearchPage: boolean): void {\n let params: HashObject = {};\n\n otherQueryParams = isOnSearchPage ? ObjectHelper.omit(otherQueryParams, ['query']) : {};\n\n if (query)\n params.query = TextHelper.removeExtraSpace(query);\n\n if (Object.keys(otherQueryParams).length) {\n params = {\n ...params,\n ...otherQueryParams\n };\n }\n\n Core.AppLinkHelper.trigger({\n application: AppChannels.SEARCH,\n action: Actions.Search.HOME,\n params\n }, { replace: isOnSearchPage });\n },\n\n getInitialQuery(): string {\n const currentAppLink = ContextService.getCurrentRoute().appLink;\n \n if (!SearchHelper.isSearchAppLink(currentAppLink))\n return '';\n \n return (currentAppLink.params as HashObject)?.query ?? '';\n },\n\n isValidSearch(query: string, currentAppLink: Core.AppLink): boolean {\n if (query?.trim())\n return true;\n\n if (!SearchHelper.isSearchAppLink(currentAppLink))\n return false;\n\n // If there's no search query, but a tag/topic filter is applied, the search is still valid\n const tagOrClassificationParam = (currentAppLink?.params as HashObject)?.tagOrClassification;\n const ratingParam = (currentAppLink?.params as HashObject)?.rating;\n const moviesAndTvParam = (currentAppLink?.params as HashObject)?.moviesAndTv;\n const source = (currentAppLink?.params as HashObject)?.source;\n const scopeId = (currentAppLink?.params as HashObject)?.scopeId;\n\n if (Array.isArray(tagOrClassificationParam))\n return !!tagOrClassificationParam.length;\n\n return (\n !!tagOrClassificationParam?.length ||\n !!ratingParam?.length ||\n !!moviesAndTvParam?.length ||\n !!source?.length ||\n !!scopeId?.length\n );\n },\n \n getFirstSeries(grouping: ResultGrouping) {\n return ArrayHelper.first(grouping.items) as SearchResultsObject<Series>;\n },\n\n getFirstPlaylist(grouping: ResultGrouping) {\n return ArrayHelper.first(grouping.items) as SearchResultsObject<Playlist>;\n },\n\n getVideoAppLink(video: Video, presentationSlug: string | null) {\n return {\n application: AppChannels.VIDEOS,\n action: Actions.Videos.PLAY_VIDEO,\n args: [ presentationSlug, video.id, TextHelper.slugify(video.name) ]\n };\n },\n\n /**\n * Companies and Classifications cannot be filtered well by tags.\n * This is especially evident when a user has searched for only a tag,\n * but has passed no query string. In this case, we populate the `query`\n * param with the names of the selected tags.\n */\n getQuery(queryParams: HashObject): string {\n if (queryParams.query)\n return queryParams.query;\n\n if (!queryParams.tagOrClassification)\n return '';\n\n const tagOrClassificationFilter = Array.isArray(queryParams.tagOrClassification) ?\n queryParams.tagOrClassification :\n [queryParams.tagOrClassification];\n\n return tagOrClassificationFilter.join(' ');\n },\n\n getInaccessibleIndices(options: {\n isLearner: boolean,\n queryParams: HashObject,\n hasMoviesAndTv: boolean\n }): SearchIndices[] {\n const { isLearner, queryParams, hasMoviesAndTv } = options;\n \n const inaccessible: SearchIndices[] = [];\n \n if (isLearner || queryParams.moviesAndTv) {\n inaccessible.push('clip');\n inaccessible.push('interactive');\n }\n \n if (!hasMoviesAndTv)\n inaccessible.push('company');\n \n return inaccessible;\n },\n\n getFilters(options: GetFiltersOptions) {\n const {\n data,\n inaccessibleIndices,\n tagsAndClassifications,\n _hasNewSearch,\n _hasPartnerProfiles,\n hasCVFilters\n } = options;\n \n if (!data.hasDataLoaded || (!_hasNewSearch && tagsAndClassifications && !tagsAndClassifications.hasCompleted))\n return null;\n\n const {\n moviesAndTvDashboard,\n ratings,\n yearGroups,\n userDetails,\n schoolLevels,\n availableTopics,\n libraries,\n currentUser,\n isLearner,\n hasCustomLibraries,\n hasMoviesAndTv,\n isGuest,\n showStreamableSearchResults\n } = data;\n\n const mtvOnFilter = XmasConstants.IS_XMAS ?\n Filters.MoviesAndTv(ImageUrls.MoviesAndTv.XMAS_SOCK, ImageUrls.MoviesAndTv.XMAS_GIFTS) :\n Filters.MoviesAndTv(ImageUrls.MoviesAndTv.POPCORN_BOX, ImageUrls.MoviesAndTv.POPCORN_BITS);\n\n const mtvOffFilter = XmasConstants.IS_XMAS ?\n Filters.MoviesAndTv(ImageUrls.MoviesAndTv.POPCORN_BOX, ImageUrls.MoviesAndTv.POPCORN_BITS) :\n null;\n\n const mainFilters = [];\n\n if (hasCVFilters) {\n if (hasMoviesAndTv && moviesAndTvDashboard.data?.id) {\n mainFilters.push(mtvOnFilter);\n } else {\n mainFilters.push(mtvOffFilter);\n }\n\n if (currentUser.data?.isAuthenticated) {\n mainFilters.push(Filters.Source(SourceFilterHelper.getOptions({\n libraries,\n isLearner,\n isGuest,\n hasCustomLibraries,\n liveStreams: showStreamableSearchResults\n })));\n }\n\n if (!isGuest) {\n mainFilters.push(Filters.Rating(\n ratings.data,\n yearGroups.data && userDetails.data &&\n RatingFilterHelper.getStudentMaxRating(yearGroups.data, userDetails.data)\n ));\n }\n\n mainFilters.push(Filters.HasResources());\n mainFilters.push(Filters.ObjectTypes(inaccessibleIndices, _hasNewSearch, _hasPartnerProfiles));\n \n if (!_hasNewSearch) {\n mainFilters.push(Filters.TagOrClassification(tagsAndClassifications.data));\n }\n } else {\n if (currentUser.data?.isAuthenticated) {\n mainFilters.push(Filters.Source(SourceFilterHelper.getOptions({\n libraries,\n isLearner,\n isGuest,\n hasCustomLibraries,\n hideCVLibrary: true,\n liveStreams: showStreamableSearchResults\n })));\n }\n }\n \n const presentationFilter = Filters.Presentation(schoolLevels.data?.schoolLevels, _hasNewSearch);\n const showPresentationFilter = FilterHelper.showPresentationFilter(presentationFilter);\n \n if (showPresentationFilter) {\n mainFilters.unshift(presentationFilter);\n }\n \n const topicsFilter = Filters.Topics(\n availableTopics.data?.topics.map(t => ({ name: t.name, id: t.topicIds.join(':') })) as FilterOption[]\n );\n \n if (topicsFilter.options && topicsFilter.options.length > 1)\n mainFilters.unshift(topicsFilter);\n \n const moreFilters = [\n Filters.ProductionYear(),\n Filters.HasSubtitles(),\n Filters.IsHD()\n ];\n \n if (hasCVFilters)\n moreFilters.push(Filters.IsClickViewContent());\n\n moreFilters.push(Filters.Duration());\n \n return {\n mainFilters: mainFilters.filter(Boolean),\n moreFilters: FilterHelper.getMoreFilters(moreFilters)\n };\n },\n\n getSearchAppLink(query: string, queryParams: HashObject): Core.AppLink {\n return {\n application: AppChannels.SEARCH,\n action: Actions.Search.HOME,\n params: {\n ...queryParams,\n query\n }\n };\n },\n\n getBackendFilters(options: {\n queryParams: HashObject,\n ratings: Flight.Response<Rating[]>,\n currentPresentationId: string,\n isLearner: boolean,\n hasDataLoaded: boolean,\n libraries: Library[],\n settings: SettingsHash,\n streamableLibraryId: string,\n exchangeLibraryId: string,\n showExchangeSearchResults: boolean,\n hasMoviesAndTv: boolean,\n showStreamableSearchResults: boolean\n }) {\n if (!options.hasDataLoaded)\n return null;\n\n const {\n queryParams,\n ratings,\n currentPresentationId,\n isLearner,\n libraries,\n hasMoviesAndTv,\n streamableLibraryId,\n exchangeLibraryId,\n showExchangeSearchResults,\n showStreamableSearchResults\n } = options;\n \n const backendFilters = FilterHelper.buildBackendFilterParams(\n queryParams,\n ratings.data,\n [currentPresentationId],\n isLearner,\n libraries,\n streamableLibraryId\n );\n\n const excludeLibraryFilter = `${FilterConstants.FILTER_PARAM_PREFIX}excludeLibraryExclusive`;\n const excludeLibraryIds = [];\n\n if (streamableLibraryId && !showStreamableSearchResults) {\n excludeLibraryIds.push(streamableLibraryId);\n }\n\n if (exchangeLibraryId && !showExchangeSearchResults) {\n excludeLibraryIds.push(exchangeLibraryId);\n }\n\n backendFilters[excludeLibraryFilter] = excludeLibraryIds;\n \n const inaccessibleIndices = SearchHelper.getInaccessibleIndices({\n isLearner,\n hasMoviesAndTv,\n queryParams\n });\n \n // Topic search is done separately using `useSearchTopics()`\n // Company search is done separately using `useSearchCompanies()`\n const appliedIndices = FilterHelper.getAppliedIndices(options.queryParams)\n .filter(i => i !== 'classification' && i !== 'company')\n .filter(index => !inaccessibleIndices.find(i => i === index));\n\n return {\n queryParams,\n backendFilters,\n appliedIndices,\n inaccessibleIndices\n };\n },\n\n getBackendFiltersV2(options: {\n queryParams: HashObject,\n ratings: Flight.Response<Rating[]>,\n currentPresentationId: string,\n isLearner: boolean,\n hasDataLoaded: boolean,\n libraries: Library[],\n settings: SettingsHash,\n streamableLibraryId: string,\n exchangeLibraryId: string,\n showExchangeSearchResults: boolean,\n hasMoviesAndTv: boolean,\n availablePresentations: Presentation[],\n showStreamableSearchResults: boolean\n }) {\n if (!options.hasDataLoaded)\n return null;\n\n const {\n queryParams,\n ratings,\n isLearner,\n libraries,\n hasMoviesAndTv,\n streamableLibraryId,\n exchangeLibraryId,\n showExchangeSearchResults,\n availablePresentations,\n showStreamableSearchResults\n } = options;\n\n const backendFilters = FilterHelper.buildBackendFilterParams(\n queryParams,\n ratings.data,\n availablePresentations?.map(p => p.id),\n isLearner,\n libraries,\n streamableLibraryId\n );\n \n const excludeLibraryIds: string[] = [];\n if (streamableLibraryId && !showStreamableSearchResults) {\n excludeLibraryIds.push(streamableLibraryId);\n }\n\n if (exchangeLibraryId && !showExchangeSearchResults) {\n excludeLibraryIds.push(exchangeLibraryId);\n }\n\n const inaccessibleIndices = SearchHelper.getInaccessibleIndices({\n isLearner,\n hasMoviesAndTv,\n queryParams\n });\n\n const indicesFilter = `${FilterConstants.FILTER_PARAM_PREFIX}indicesFilters`;\n\n const appliedIndices = FilterHelper.getAppliedIndices(\n options.queryParams,\n true,\n options.settings.hasPartnerProfiles\n ).filter(index => !inaccessibleIndices.find(i => i === index));\n\n const availablePresentationIds = availablePresentations?.map(p => p.id);\n\n const indicesWithFilters: HashObject[] = appliedIndices.map(index => {\n const indiceFilter = { index };\n \n if (index === 'video' && excludeLibraryIds.length) {\n const indice: HashObject = {\n ...indiceFilter,\n filters: {\n excludeLibraryExclusive: [...excludeLibraryIds]\n }\n };\n\n return indice;\n }\n\n if (index === 'classification') {\n const indice: HashObject = {\n ...indiceFilter,\n filters: {\n classificationType: ClassificationType.Subject,\n status: [ ClassificationStatus.Published, ClassificationStatus.ComingSoon ]\n }\n };\n\n if (availablePresentations?.length) {\n indice.filters.presentation = availablePresentationIds;\n }\n\n return indice;\n }\n\n if (index === 'company') {\n const indice: HashObject = {\n ...indiceFilter,\n filters: {\n presentation: availablePresentationIds\n }\n };\n\n return indice;\n }\n\n return indiceFilter;\n });\n\n backendFilters[indicesFilter] = indicesWithFilters;\n \n return {\n queryParams,\n backendFilters,\n appliedIndices,\n inaccessibleIndices\n };\n }\n};\n"],"mappings":"q+BAkEa,EAAe,CAC1B,kBAAkB,EAAkB,EAA+C,CACjF,MAAO,CACL,YAAa,EAAY,cACzB,OAAQ,EAAQ,YAAY,kBAC5B,KAAM,CAAE,EAAkB,EAAQ,GAAI,EAAW,QAAQ,EAAQ,IAAI,CAAE,CACzE,CACF,EAEA,yBACE,EACA,EACA,EACc,CACd,OAAO,EAA4B,WACjC,EACA,EAAc,CAAE,YAAa,EAAK,EAAI,CAAC,EACvC,CACF,CACF,EAEA,qBACE,EACA,EACA,EACA,EACiB,CAIjB,OAHK,EAGE,CAAC,CACN,IAAK,EACL,QAAS,CACP,YAAa,EAAY,MACzB,OAAQ,EAAQ,MAAM,MACtB,KAAM,CAAC,EAAW,EAAE,EACpB,OAAQ,CAAE,WAAY,CAAe,CACvC,EACA,cAAe,CAAE,GAAI,EAAW,EAAG,EACnC,iBAAkB,CAChB,GAAG,EACH,WAAY,EAAW,MACvB,cAAe,EAAc,MAC7B,aAAc,EAAa,EAC7B,EACA,OAAQ,EACV,CAAC,EAlBQ,CAAC,CAmBZ,EAEA,iBAAiB,EAAgB,EAAsB,EAA+C,CACpG,OAAO,EAAoB,iBAAiB,EAAQ,EAAc,CAAE,IAAK,EAAK,EAAI,CAAC,EAAG,CAAgB,CACxG,EAEA,mBAAmB,EAAoB,EAAsB,EAA+C,CAC1G,MAAO,CACL,YAAa,EAAY,UACzB,OAAQ,EAAQ,UAAU,SAC1B,KAAM,CAAE,EAAkB,EAAS,GAAI,EAAW,QAAQ,EAAS,IAAI,CAAE,EACzE,OAAQ,EAAc,CAAE,IAAK,EAAK,EAAI,IACxC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oB,EAAmB,QACvC,OAAQ,CAAE,EAAqB,UAAW,EAAqB,UAAW,CAC5E,CACF,EAMA,OAJI,GAAwB,SAC1B,EAAO,QAAQ,aAAe,GAGzB,CACT,CAaA,OAXI,IAAU,UAQL,CANL,GAAG,EACH,QAAS,CACP,aAAc,CAChB,CAGK,EAGF,CACT,CAEgC,EAEzB,CACL,cACA,iBACA,iBACA,qBACF,CACF,CACF"}
|
|
1
|
+
{"version":3,"file":"jAtAipGN.chunk.js","names":[],"sources":["../../src/apps/search/utils/SearchHelper.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Core } from 'libs/common/core';\nimport { Flight } from 'libs/common/flight';\nimport { HashObject } from 'libs/common/react/interfaces';\nimport { ArrayHelper } from 'libs/common/react/utils/ArrayHelper';\nimport { ObjectHelper } from 'libs/common/react/utils/ObjectHelper';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { AnalyticsOptions, EventVersion, UserAction, WorkflowPhase } from 'libs/analytics/interfaces';\n\nimport { MixedSearchResultAppLinks } from 'libs/shared/apps/search/components/mixed-search-results/MixedSearchResults';\nimport { FilterConstants } from 'libs/shared/apps/search/constants/FilterConstants';\nimport { FilterOption, SearchIndices, SearchResultsObject, TopicResults } from 'libs/shared/apps/search/interfaces';\nimport { FilterHelper, Filters } from 'libs/shared/apps/search/utils/FilterHelper';\nimport { RatingFilterHelper } from 'libs/shared/apps/search/utils/RatingFilterHelper';\nimport { ResultGrouping } from 'libs/shared/apps/search/utils/SharedSearchHelper';\nimport { SourceFilterHelper } from 'libs/shared/apps/search/utils/SourceFilterHelper';\nimport { ActionOptions } from 'libs/shared/components/actions/Actions';\nimport { XmasConstants } from 'libs/shared/constants/XmasConstants';\nimport { ClassificationStatus } from 'libs/shared/enums/ClassificationStatus';\nimport { ClassificationType } from 'libs/shared/enums/ClassificationType';\nimport { SettingsHash } from 'libs/shared/hooks/useSettings';\nimport { ShareSvg } from 'libs/shared/images/svg/actions/ShareSvg';\nimport { Classification, Company, CuratedDashboard, CurrentUser, Library, Playlist, Presentation, Rating, SchoolLevels, Series, User, Video, YearGroup } from 'libs/shared/interfaces';\nimport { GetVideoAppLinkOptions } from 'libs/shared/interfaces/VideoAppLinkOptions';\nimport { ContextService } from 'libs/shared/services/ContextService';\n\nimport { ImageUrls } from 'shared/constants/ImageUrls';\nimport { Actions } from 'shared/constants/LiteActions';\nimport { AppChannels } from 'shared/constants/LiteRadioChannels';\nimport { ClassificationAppLinkHelper } from 'shared/utils/ClassificationAppLinkHelper';\nimport { InteractiveHelpers } from 'shared/utils/InteractiveHelper';\nimport { LitePresentationHelper } from 'shared/utils/LitePresentationHelper';\nimport { VideoAppLinkHelper } from 'shared/utils/VideoAppLinkHelper';\n\nimport { SeriesAppLinkHelper } from 'apps/series/SeriesAppLinkHelper';\n\ninterface GetFiltersOptions {\n data: {\n isLearner: boolean,\n moviesAndTvDashboard: Flight.Response<CuratedDashboard>,\n ratings: Flight.Response<Rating[]>,\n yearGroups: Flight.Response<YearGroup[]>,\n userDetails: Flight.Response<User>,\n schoolLevels: Flight.Response<SchoolLevels>,\n availableTopics: Flight.Response<TopicResults>,\n libraries: Library[],\n currentUser: Flight.Response<CurrentUser>,\n hasDataLoaded: boolean,\n hasCustomLibraries: boolean,\n hasMoviesAndTv: boolean,\n isGuest: boolean,\n showStreamableSearchResults: boolean\n };\n inaccessibleIndices: SearchIndices[];\n tagsAndClassifications?: Flight.Response<string[]>;\n hasCVFilters?: boolean;\n /**\n * Incremental changes flag for search v2\n */\n _hasNewSearch?: boolean;\n \n _hasPartnerProfiles?: boolean;\n}\n\nexport const SearchHelper = {\n getCompanyAppLink(company: Company, presentationSlug: string | null): Core.AppLink {\n return {\n application: AppChannels.MOVIES_AND_TV,\n action: Actions.MoviesAndTv.COMPANY_DASHBOARD,\n args: [ presentationSlug, company.id, TextHelper.slugify(company.name) ]\n };\n },\n\n getClassificationAppLink(\n classification: Classification,\n moviesAndTv: boolean,\n availablePresentations: Presentation[]\n ): Core.AppLink {\n return ClassificationAppLinkHelper.getAppLink(\n classification,\n moviesAndTv ? { moviesAndTv: true } : {},\n availablePresentations\n );\n },\n\n getCollectionActions(\n collection: Series | Playlist,\n showActions: boolean,\n collectionType: 'series' | 'playlist',\n baseAnalyticsOptions: AnalyticsOptions\n ): ActionOptions[] {\n if (!showActions)\n return [];\n \n return [{\n svg: ShareSvg,\n appLink: {\n application: AppChannels.SHARE,\n action: Actions.Share.SHARE,\n args: [collection.id],\n params: { entityType: collectionType }\n },\n analyticsData: { id: collection.id },\n analyticsOptions: {\n ...baseAnalyticsOptions,\n actionType: UserAction.Share,\n workflowPhase: WorkflowPhase.Start,\n eventVersion: EventVersion.V3\n },\n button: true\n }];\n },\n\n getSeriesAppLink(series: Series, moviesAndTv: boolean, presentationSlug: string | null): Core.AppLink {\n return SeriesAppLinkHelper.getSeriesAppLink(series, moviesAndTv ? { mtv: true } : {}, presentationSlug);\n },\n\n getPlaylistAppLink(playlist: Playlist, moviesAndTv: boolean, presentationSlug: string | null): Core.AppLink {\n return {\n application: AppChannels.PLAYLISTS,\n action: Actions.Playlists.PLAYLIST,\n args: [ presentationSlug, playlist.id, TextHelper.slugify(playlist.name) ],\n params: moviesAndTv ? { mtv: true } : null\n };\n },\n\n getAppLinks(\n presentation: Presentation,\n availablePresentations: Presentation[],\n moviesAndTv: boolean,\n presentationSlug: string | null\n ): MixedSearchResultAppLinks {\n return {\n getVideoAppLink: (video, opts: GetVideoAppLinkOptions) =>\n VideoAppLinkHelper.getAppLink(video, { ...opts, moviesAndTv }, presentationSlug),\n getPlaylistAppLink: playlist => SearchHelper.getPlaylistAppLink(playlist, moviesAndTv, presentationSlug),\n getSeriesAppLink: series => SearchHelper.getSeriesAppLink(series, moviesAndTv, presentationSlug),\n getCompanyAppLink: company => {\n const slug = LitePresentationHelper.getPresentationSlugByCompany(\n company,\n presentation,\n availablePresentations\n );\n return SearchHelper.getCompanyAppLink(company, slug);\n },\n getClassificationAppLink:\n classification => SearchHelper.getClassificationAppLink(classification, moviesAndTv, availablePresentations),\n getPreviewQuestionsAppLink: interactive => InteractiveHelpers.getPreviewQuestionsAppLink(interactive),\n getCollectionActions: SearchHelper.getCollectionActions,\n searchSettings: {\n application: AppChannels.SETTINGS,\n action: Actions.Settings.PLATFORM_SETTINGS\n }\n };\n },\n\n isSearchAppLink(currentAppLink: Core.AppLink): boolean {\n return currentAppLink.application === AppChannels.SEARCH && currentAppLink.action === Actions.Search.HOME;\n },\n\n useReferrerAppLink(): Core.AppLink {\n const defaultReferrerAppLink: Core.AppLink = {\n application: AppChannels.DASHBOARD,\n action: Actions.Dashboard.HOME,\n args: [null as string]\n };\n \n const [ referrerApplink, setReferrerAppLink ] = React.useState<Core.AppLink>(defaultReferrerAppLink);\n \n const currentRoute = ContextService.getCurrentRoute();\n \n React.useEffect(() => {\n if (SearchHelper.isSearchAppLink(currentRoute.appLink))\n return;\n\n setReferrerAppLink(currentRoute.appLink);\n }, [ currentRoute.appLink.application, currentRoute.appLink.action ]);\n \n return referrerApplink;\n },\n\n useOnFilterChange(fetchResults: (cursor?: string) => void, queryParams: HashObject): void {\n const params = { ...queryParams };\n delete params.query;\n\n const sortedValues = Object.keys(params).map(filterName => params[filterName]).sort((a, b) => a - b);\n\n React.useEffect(() => {\n fetchResults();\n }, [sortedValues.join(':')]);\n },\n\n triggerAppLink(query: string, otherQueryParams: HashObject = {}, isOnSearchPage: boolean): void {\n let params: HashObject = {};\n\n otherQueryParams = isOnSearchPage ? ObjectHelper.omit(otherQueryParams, ['query']) : {};\n\n if (query)\n params.query = TextHelper.removeExtraSpace(query);\n\n if (Object.keys(otherQueryParams).length) {\n params = {\n ...params,\n ...otherQueryParams\n };\n }\n\n Core.AppLinkHelper.trigger({\n application: AppChannels.SEARCH,\n action: Actions.Search.HOME,\n params\n }, { replace: isOnSearchPage });\n },\n\n getInitialQuery(): string {\n const currentAppLink = ContextService.getCurrentRoute().appLink;\n \n if (!SearchHelper.isSearchAppLink(currentAppLink))\n return '';\n \n return (currentAppLink.params as HashObject)?.query ?? '';\n },\n\n isValidSearch(query: string, currentAppLink: Core.AppLink): boolean {\n if (query?.trim())\n return true;\n\n if (!SearchHelper.isSearchAppLink(currentAppLink))\n return false;\n\n // If there's no search query, but a tag/topic filter is applied, the search is still valid\n const tagOrClassificationParam = (currentAppLink?.params as HashObject)?.tagOrClassification;\n const ratingParam = (currentAppLink?.params as HashObject)?.rating;\n const moviesAndTvParam = (currentAppLink?.params as HashObject)?.moviesAndTv;\n const source = (currentAppLink?.params as HashObject)?.source;\n const scopeId = (currentAppLink?.params as HashObject)?.scopeId;\n\n if (Array.isArray(tagOrClassificationParam))\n return !!tagOrClassificationParam.length;\n\n return (\n !!tagOrClassificationParam?.length ||\n !!ratingParam?.length ||\n !!moviesAndTvParam?.length ||\n !!source?.length ||\n !!scopeId?.length\n );\n },\n \n getFirstSeries(grouping: ResultGrouping) {\n return ArrayHelper.first(grouping.items) as SearchResultsObject<Series>;\n },\n\n getFirstPlaylist(grouping: ResultGrouping) {\n return ArrayHelper.first(grouping.items) as SearchResultsObject<Playlist>;\n },\n\n getVideoAppLink(video: Video, presentationSlug: string | null) {\n return {\n application: AppChannels.VIDEOS,\n action: Actions.Videos.PLAY_VIDEO,\n args: [ presentationSlug, video.id, TextHelper.slugify(video.name) ]\n };\n },\n\n /**\n * Companies and Classifications cannot be filtered well by tags.\n * This is especially evident when a user has searched for only a tag,\n * but has passed no query string. In this case, we populate the `query`\n * param with the names of the selected tags.\n */\n getQuery(queryParams: HashObject): string {\n if (queryParams.query)\n return queryParams.query;\n\n if (!queryParams.tagOrClassification)\n return '';\n\n const tagOrClassificationFilter = Array.isArray(queryParams.tagOrClassification) ?\n queryParams.tagOrClassification :\n [queryParams.tagOrClassification];\n\n return tagOrClassificationFilter.join(' ');\n },\n\n getInaccessibleIndices(options: {\n isLearner: boolean,\n queryParams: HashObject,\n hasMoviesAndTv: boolean\n }): SearchIndices[] {\n const { isLearner, queryParams, hasMoviesAndTv } = options;\n \n const inaccessible: SearchIndices[] = [];\n \n if (isLearner || queryParams.moviesAndTv) {\n inaccessible.push('clip');\n inaccessible.push('interactive');\n }\n \n if (!hasMoviesAndTv)\n inaccessible.push('company');\n \n return inaccessible;\n },\n\n getFilters(options: GetFiltersOptions) {\n const {\n data,\n inaccessibleIndices,\n tagsAndClassifications,\n _hasNewSearch,\n _hasPartnerProfiles,\n hasCVFilters\n } = options;\n \n if (!data.hasDataLoaded || (!_hasNewSearch && tagsAndClassifications && !tagsAndClassifications.hasCompleted))\n return null;\n\n const {\n moviesAndTvDashboard,\n ratings,\n yearGroups,\n userDetails,\n schoolLevels,\n availableTopics,\n libraries,\n currentUser,\n isLearner,\n hasCustomLibraries,\n hasMoviesAndTv,\n isGuest,\n showStreamableSearchResults\n } = data;\n\n const mtvOnFilter = XmasConstants.IS_XMAS ?\n Filters.MoviesAndTv(ImageUrls.MoviesAndTv.XMAS_SOCK, ImageUrls.MoviesAndTv.XMAS_GIFTS) :\n Filters.MoviesAndTv(ImageUrls.MoviesAndTv.POPCORN_BOX, ImageUrls.MoviesAndTv.POPCORN_BITS);\n\n const mtvOffFilter = XmasConstants.IS_XMAS ?\n Filters.MoviesAndTv(ImageUrls.MoviesAndTv.POPCORN_BOX, ImageUrls.MoviesAndTv.POPCORN_BITS) :\n null;\n\n const mainFilters = [];\n\n if (hasCVFilters) {\n if (hasMoviesAndTv && moviesAndTvDashboard.data?.id) {\n mainFilters.push(mtvOnFilter);\n } else {\n mainFilters.push(mtvOffFilter);\n }\n\n if (currentUser.data?.isAuthenticated) {\n mainFilters.push(Filters.Source(SourceFilterHelper.getOptions({\n libraries,\n isLearner,\n isGuest,\n hasCustomLibraries,\n liveStreams: showStreamableSearchResults\n })));\n }\n\n if (!isGuest) {\n mainFilters.push(Filters.Rating(\n ratings.data,\n yearGroups.data && userDetails.data &&\n RatingFilterHelper.getStudentMaxRating(yearGroups.data, userDetails.data)\n ));\n }\n\n mainFilters.push(Filters.HasResources());\n mainFilters.push(Filters.ObjectTypes(inaccessibleIndices, _hasNewSearch, _hasPartnerProfiles));\n \n if (!_hasNewSearch) {\n mainFilters.push(Filters.TagOrClassification(tagsAndClassifications.data));\n }\n } else {\n if (currentUser.data?.isAuthenticated) {\n mainFilters.push(Filters.Source(SourceFilterHelper.getOptions({\n libraries,\n isLearner,\n isGuest,\n hasCustomLibraries,\n hideCVLibrary: true,\n liveStreams: showStreamableSearchResults\n })));\n }\n }\n \n const presentationFilter = Filters.Presentation(schoolLevels.data?.schoolLevels, _hasNewSearch);\n const showPresentationFilter = FilterHelper.showPresentationFilter(presentationFilter);\n \n if (showPresentationFilter) {\n mainFilters.unshift(presentationFilter);\n }\n \n const topicsFilter = Filters.Topics(\n availableTopics.data?.topics.map(t => ({ name: t.name, id: t.topicIds.join(':') })) as FilterOption[]\n );\n \n if (topicsFilter.options && topicsFilter.options.length > 1)\n mainFilters.unshift(topicsFilter);\n \n const moreFilters = [\n Filters.ProductionYear(),\n Filters.HasSubtitles(),\n Filters.IsHD()\n ];\n \n if (hasCVFilters)\n moreFilters.push(Filters.IsClickViewContent());\n\n moreFilters.push(Filters.Duration());\n \n return {\n mainFilters: mainFilters.filter(Boolean),\n moreFilters: FilterHelper.getMoreFilters(moreFilters)\n };\n },\n\n getSearchAppLink(query: string, queryParams: HashObject): Core.AppLink {\n return {\n application: AppChannels.SEARCH,\n action: Actions.Search.HOME,\n params: {\n ...queryParams,\n query\n }\n };\n },\n\n getBackendFilters(options: {\n queryParams: HashObject,\n ratings: Flight.Response<Rating[]>,\n currentPresentationId: string,\n isLearner: boolean,\n hasDataLoaded: boolean,\n libraries: Library[],\n settings: SettingsHash,\n streamableLibraryId: string,\n exchangeLibraryId: string,\n showExchangeSearchResults: boolean,\n hasMoviesAndTv: boolean,\n showStreamableSearchResults: boolean\n }) {\n if (!options.hasDataLoaded)\n return null;\n\n const {\n queryParams,\n ratings,\n currentPresentationId,\n isLearner,\n libraries,\n hasMoviesAndTv,\n streamableLibraryId,\n exchangeLibraryId,\n showExchangeSearchResults,\n showStreamableSearchResults\n } = options;\n \n const backendFilters = FilterHelper.buildBackendFilterParams(\n queryParams,\n ratings.data,\n [currentPresentationId],\n isLearner,\n libraries,\n streamableLibraryId\n );\n\n const excludeLibraryFilter = `${FilterConstants.FILTER_PARAM_PREFIX}excludeLibraryExclusive`;\n const excludeLibraryIds = [];\n\n if (streamableLibraryId && !showStreamableSearchResults) {\n excludeLibraryIds.push(streamableLibraryId);\n }\n\n if (exchangeLibraryId && !showExchangeSearchResults) {\n excludeLibraryIds.push(exchangeLibraryId);\n }\n\n backendFilters[excludeLibraryFilter] = excludeLibraryIds;\n \n const inaccessibleIndices = SearchHelper.getInaccessibleIndices({\n isLearner,\n hasMoviesAndTv,\n queryParams\n });\n \n // Topic search is done separately using `useSearchTopics()`\n // Company search is done separately using `useSearchCompanies()`\n const appliedIndices = FilterHelper.getAppliedIndices(options.queryParams)\n .filter(i => i !== 'classification' && i !== 'company')\n .filter(index => !inaccessibleIndices.find(i => i === index));\n\n return {\n queryParams,\n backendFilters,\n appliedIndices,\n inaccessibleIndices\n };\n },\n\n getBackendFiltersV2(options: {\n queryParams: HashObject,\n ratings: Flight.Response<Rating[]>,\n currentPresentationId: string,\n isLearner: boolean,\n hasDataLoaded: boolean,\n libraries: Library[],\n settings: SettingsHash,\n streamableLibraryId: string,\n exchangeLibraryId: string,\n showExchangeSearchResults: boolean,\n hasMoviesAndTv: boolean,\n availablePresentations: Presentation[],\n showStreamableSearchResults: boolean\n }) {\n if (!options.hasDataLoaded)\n return null;\n\n const {\n queryParams,\n ratings,\n isLearner,\n libraries,\n hasMoviesAndTv,\n streamableLibraryId,\n exchangeLibraryId,\n showExchangeSearchResults,\n availablePresentations,\n showStreamableSearchResults\n } = options;\n\n const backendFilters = FilterHelper.buildBackendFilterParams(\n queryParams,\n ratings.data,\n availablePresentations?.map(p => p.id),\n isLearner,\n libraries,\n streamableLibraryId\n );\n \n const excludeLibraryIds: string[] = [];\n if (streamableLibraryId && !showStreamableSearchResults) {\n excludeLibraryIds.push(streamableLibraryId);\n }\n\n if (exchangeLibraryId && !showExchangeSearchResults) {\n excludeLibraryIds.push(exchangeLibraryId);\n }\n\n const inaccessibleIndices = SearchHelper.getInaccessibleIndices({\n isLearner,\n hasMoviesAndTv,\n queryParams\n });\n\n const indicesFilter = `${FilterConstants.FILTER_PARAM_PREFIX}indicesFilters`;\n\n const appliedIndices = FilterHelper.getAppliedIndices(\n options.queryParams,\n true,\n options.settings.hasPartnerProfiles\n ).filter(index => !inaccessibleIndices.find(i => i === index));\n\n const availablePresentationIds = availablePresentations?.map(p => p.id);\n\n const indicesWithFilters: HashObject[] = appliedIndices.map(index => {\n const indiceFilter = { index };\n \n if (index === 'video' && excludeLibraryIds.length) {\n const indice: HashObject = {\n ...indiceFilter,\n filters: {\n excludeLibraryExclusive: [...excludeLibraryIds]\n }\n };\n\n return indice;\n }\n\n if (index === 'classification') {\n const indice: HashObject = {\n ...indiceFilter,\n filters: {\n classificationType: ClassificationType.Subject,\n status: [ ClassificationStatus.Published, ClassificationStatus.ComingSoon ]\n }\n };\n\n if (availablePresentations?.length) {\n indice.filters.presentation = availablePresentationIds;\n }\n\n return indice;\n }\n\n if (index === 'company') {\n const indice: HashObject = {\n ...indiceFilter,\n filters: {\n presentation: availablePresentationIds\n }\n };\n\n return indice;\n }\n\n return indiceFilter;\n });\n\n backendFilters[indicesFilter] = indicesWithFilters;\n \n return {\n queryParams,\n backendFilters,\n appliedIndices,\n inaccessibleIndices\n };\n }\n};\n"],"mappings":"u+BAkEa,EAAe,CAC1B,kBAAkB,EAAkB,EAA+C,CACjF,MAAO,CACL,YAAa,EAAY,cACzB,OAAQ,EAAQ,YAAY,kBAC5B,KAAM,CAAE,EAAkB,EAAQ,GAAI,EAAW,QAAQ,EAAQ,IAAI,CAAE,CACzE,CACF,EAEA,yBACE,EACA,EACA,EACc,CACd,OAAO,EAA4B,WACjC,EACA,EAAc,CAAE,YAAa,EAAK,EAAI,CAAC,EACvC,C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