{ "version": 3, "sources": ["apps/partner-center-client/src/app/core/access/access.service.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\nimport { WhitelabelService } from '@galaxy/partner';\nimport { Observable, of } from 'rxjs';\nimport { distinctUntilChanged, map, shareReplay, switchMap } from 'rxjs/operators';\nimport { AppConfigService } from '../../app-config.service';\nimport { AccessService, Feature } from 'marketplace-ui';\n\n@Injectable()\nexport class StubAccessService implements AccessService {\n features: Observable;\n\n constructor(\n private app: AppConfigService,\n private whitelabelService: WhitelabelService,\n ) {\n this.features = this.app.config$.pipe(\n map((config) => config.partnerId),\n switchMap((partnerId) => this.whitelabelService.getConfiguration(partnerId)),\n map((config) => config.enabledFeatures),\n shareReplay(1),\n );\n }\n\n // note: this should not to be confused with `vconfig/vconfig.service.ts`\n // this is for value based pricing feature access checks\n hasAccessToFeature(feature: Feature): Observable {\n return this.features.pipe(\n map((features) => {\n return Boolean(features && features.indexOf(feature) >= 0);\n }),\n distinctUntilChanged(),\n );\n }\n\n // note: this should not to be confused with `vconfig/vconfig.service.ts`\n // this is for value based pricing feature access checks\n hasAccessToFeatures(features: Feature[]): Observable {\n if (!features) {\n return of(true);\n }\n return this.features.pipe(\n map((partnerFeatures) => {\n return features.every((feature) => Boolean(partnerFeatures && partnerFeatures.indexOf(feature) >= 0));\n }),\n distinctUntilChanged(),\n );\n }\n}\n"], "mappings": "mKAQA,IAAaA,GAAiB,IAAA,CAAxB,IAAOA,EAAP,MAAOA,CAAiB,CAG5BC,YACUC,EACAC,EAAoC,CADpC,KAAAD,IAAAA,EACA,KAAAC,kBAAAA,EAER,KAAKC,SAAW,KAAKF,IAAIG,QAAQC,KAC/BC,EAAKC,GAAWA,EAAOC,SAAS,EAChCC,EAAWD,GAAc,KAAKN,kBAAkBQ,iBAAiBF,CAAS,CAAC,EAC3EF,EAAKC,GAAWA,EAAOI,eAAe,EACtCC,EAAY,CAAC,CAAC,CAElB,CAIAC,mBAAmBC,EAAgB,CACjC,OAAO,KAAKX,SAASE,KACnBC,EAAKH,GACIY,GAAQZ,GAAYA,EAASa,QAAQF,CAAO,GAAK,EACzD,EACDG,EAAoB,CAAE,CAE1B,CAIAC,oBAAoBf,EAAmB,CACrC,OAAKA,EAGE,KAAKA,SAASE,KACnBC,EAAKa,GACIhB,EAASiB,MAAON,GAAYC,GAAQI,GAAmBA,EAAgBH,QAAQF,CAAO,GAAK,EAAE,CACrG,EACDG,EAAoB,CAAE,EANfI,EAAG,EAAI,CAQlB,yCAtCWtB,GAAiBuB,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAAjBzB,EAAiB0B,QAAjB1B,EAAiB2B,SAAA,CAAA,EAAxB,IAAO3B,EAAP4B,SAAO5B,CAAiB,GAAA", "names": ["StubAccessService", "constructor", "app", "whitelabelService", "features", "config$", "pipe", "map", "config", "partnerId", "switchMap", "getConfiguration", "enabledFeatures", "shareReplay", "hasAccessToFeature", "feature", "Boolean", "indexOf", "distinctUntilChanged", "hasAccessToFeatures", "partnerFeatures", "every", "of", "\u0275\u0275inject", "AppConfigService", "WhitelabelService", "factory", "\u0275fac", "_StubAccessService"] }