{ "version": 3, "sources": ["apps/business-center-client/src/app/app-config.service.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\nimport { BrandingV2Service, WhitelabelService } from '@galaxy/partner';\nimport { Observable } from 'rxjs';\nimport { filter, map, shareReplay, switchMap } from 'rxjs/operators';\nimport { partnerId as appPartnerId } from '../globals';\nimport { AccountGroup } from './account-group/account-group';\nimport { Location, LocationsService, isAccountGroup } from './locations';\n\n@Injectable({ providedIn: 'root' })\nexport class AppConfigService {\n readonly branding$ = this.locationService.marketId$.pipe(\n switchMap((marketId) => this.brandingService.getBranding(appPartnerId, marketId)),\n shareReplay(1),\n );\n\n readonly foundationalProductsWhitelabelledNames$ = this.locationService.marketId$.pipe(\n switchMap((marketId) => this.whitelabelService.getBranding(appPartnerId, marketId)),\n map((branding) =>\n Object.keys(branding.apps).reduce((acc, key) => ({ ...acc, [key]: branding.apps[key].name }), {}),\n ),\n shareReplay(1),\n );\n\n readonly businessAppName$ = this.foundationalProductsWhitelabelledNames$.pipe(\n map((apps) => apps['VBC']),\n shareReplay(1),\n );\n\n readonly legacyWhitelabelConfig$ = this.locationService.marketId$.pipe(\n switchMap((marketId) => this.whitelabelService.getConfiguration(appPartnerId, marketId)),\n shareReplay(1),\n );\n\n readonly legacyConfig$ = this.legacyWhitelabelConfig$.pipe(\n map((config) => config?.businessCenterConfiguration || {}),\n shareReplay(1),\n );\n\n constructor(\n private readonly whitelabelService: WhitelabelService,\n private readonly locationService: LocationsService,\n private readonly brandingService: BrandingV2Service,\n ) {}\n\n getMarketLogo(loc: Observable): Observable {\n return loc.pipe(\n filter(isAccountGroup),\n switchMap((location) => this.getMarketLogoForAccountGroup(location)),\n );\n }\n\n getMarketLogoByMarket(partnerId: string, marketId: string): Observable {\n return this.brandingService.getBranding(partnerId, marketId).pipe(map((branding) => branding.logoUrl));\n }\n\n private getMarketLogoForAccountGroup(accountGroup: AccountGroup): Observable {\n const partnerId = accountGroup.partnerId;\n const marketId = accountGroup.marketId;\n return this.getMarketL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,CACvD,OAAO,KAAKL,gBAAgBM,YAAY4B,EAAW7B,CAAQ,EAAEF,KAAKO,EAAKC,GAAaA,EAASwB,OAAO,CAAC,CACvG,CAEQH,6BAA6BI,EAA0B,CAC7D,IAAMF,EAAYE,EAAaF,UACzB7B,EAAW+B,EAAa/B,SAC9B,OAAO,KAAK4B,sBAAsBC,EAAW7B,CAAQ,CACvD,yCAlDWd,GAAgB8C,EAAAC,CAAA,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,CAAA,CAAA,CAAA,wBAAhBjD,EAAgBkD,QAAhBlD,EAAgBmD,UAAAC,WADH,MAAM,CAAA,EAC1B,IAAOpD,EAAPqD,SAAOrD,CAAgB,GAAA", "names": ["AppConfigService", "init_app_config_service", "__esmMin", "init_operators", "init_globals", "init_locations", "constructor", "whitelabelService", "locationService", "brandingService", "branding$", "marketId$", "pipe", "switchMap", "marketId", "getBranding", "appPartnerId", "shareReplay", "foundationalProductsWhitelabelledNames$", "map", "branding", "Object", "keys", "apps", "reduce", "acc", "key", "__spreadProps", "__spreadValues", "name", "businessAppName$", "legacyWhitelabelConfig$", "getConfiguration", "legacyConfig$", "config", "businessCenterConfiguration", "getMarketLogo", "loc", "filter", "isAccountGroup", "location", "getMarketLogoForAccountGroup", "getMarketLogoByMarket", "partnerId", "logoUrl", "accountGroup", "\u0275\u0275inject", "WhitelabelService", "LocationsService", "BrandingV2Service", "factory", "\u0275fac", "providedIn", "_AppConfigService"] }