{"version":3,"file":"chunk-f1edq5d0.js","sources":["packages/virtualsports-app/src/shared/teaser.service.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { BehaviorSubject, Observable } from 'rxjs';\n\nimport { ApiService } from '../api/api.service';\nimport { TeasersClientConfig } from '../client-config/virtualsports-client-config.models';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TeaserService {\n headerTeasers: any;\n globalTeaserSettings: any;\n private teaserDataPublisher = new BehaviorSubject(null);\n teaserDataObservable: Observable = this.teaserDataPublisher.asObservable();\n teaserMap: Map = new Map();\n\n constructor(\n public api: ApiService,\n private teasersClientConfig: TeasersClientConfig,\n ) {}\n setTeasers(navItems: string[]) {\n if (this.teasersClientConfig.teaserOptimization) {\n this.api.get('teasers/GetTeaserData', { navItems: navItems }).subscribe((response) => {\n if (response) {\n this.globalTeaserSettings = response.globalTeaserSettings;\n if (response.optimizedTeaserContents && response.optimizedTeaserContents.length > 0) {\n for (const teaserItem of response.optimizedTeaserContents) {\n const parentId = teaserItem.metadata.id.parent.itemName;\n this.setTeaserMap(parentId, teaserItem);\n }\n\n this.teaserDataPublisher.next(this.teaserMap);\n }\n }\n });\n }\n }\n\n setTeaserMap(parentId: string, teaserItem: any) {\n let teaserArr: any[];\n if (!this.teaserMap.get(parentId)) {\n teaserArr = [];\n } else {\n teaserArr = this.teaserMap.get(parentId);\n }\n teaserArr.push(teaserItem);\n this.teaserMap.set(parentId, teaserArr);\n }\n\n getTeasersForGameName(gameName: string) {\n return this.teaserMap.get(gameName);\n }\n\n getGlobalTeaserSettings() {\n return this.globalTeaserSettings;\n }\n}\n"],"names":["TeaserService","constructor","api","teasersClientConfig","teaserDataPublisher","BehaviorSubject","teaserDataObservable","asObservable","teaserMap","Map","setTeasers","navItems","teaserOptimization","get","subscribe","response","globalTeaserSettings","optimizedTeaserContents","length","teaserItem","parentId","metadata","id","parent","itemName","setTeaserMap","next","teaserArr","push","set","getTeasersForGameName","gameName","getGlobalTeaserSettings","ɵɵinject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