{ "version": 3, "sources": ["apps/partner-center-client/src/app/core/guards/hide-pricing-guard.service.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\nimport { Observable, of as observableOf } from 'rxjs';\n\nimport { map } from 'rxjs/operators';\nimport { VConfigService } from '../../vconfig/vconfig.service';\nimport { PartnerService } from '../partner.service';\n\nconst HIDE_PRICING = 'hide_pricing';\n\n@Injectable({ providedIn: 'root' })\nexport class HidePricingGuard {\n constructor(\n private vconfig: VConfigService,\n private partner: PartnerService,\n ) {}\n\n hidePricing: boolean = null;\n\n canActivate(): Observable {\n if (this.hidePricing !== null) {\n return observableOf(this.hidePricing);\n }\n return this.checkHidePricing();\n }\n\n checkHidePricing(): Observable {\n // Even super admins must respect the “Hide wholesale prices in Partner Center” option. Otherwise when we\n // are doing demoes, the wholesale costs shows up in pages like Discover Products and Activation page when\n // we switch into PIDs, which frequently has caused awkward conversations with customers.\n return this.vconfig.getConfigurations(this.partner.partnerId, [HIDE_PRICING]).pipe(\n map((result) => {\n this.hidePricing = !!result[HIDE_PRICING];\n return this.hidePricing;\n }),\n );\n }\n}\n"], "mappings": "0IAOA,IAAMA,EAAe,eAGRC,GAAgB,IAAA,CAAvB,IAAOA,EAAP,MAAOA,CAAgB,CAC3BC,YACUC,EACAC,EAAuB,CADvB,KAAAD,QAAAA,EACA,KAAAC,QAAAA,EAGV,KAAAC,YAAuB,IAFpB,CAIHC,aAAW,CACT,OAAI,KAAKD,cAAgB,KAChBE,EAAa,KAAKF,WAAW,EAE/B,KAAKG,iBAAgB,CAC9B,CAEAA,kBAAgB,CAId,OAAO,KAAKL,QAAQM,kBAAkB,KAAKL,QAAQM,UAAW,CAACV,CAAY,CAAC,EAAEW,KAC5EC,EAAKC,IACH,KAAKR,YAAc,CAAC,CAACQ,EAAOb,CAAY,EACjC,KAAKK,YACb,CAAC,CAEN,yCAzBWJ,GAAgBa,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAAhBf,EAAgBgB,QAAhBhB,EAAgBiB,UAAAC,WADH,MAAM,CAAA,EAC1B,IAAOlB,EAAPmB,SAAOnB,CAAgB,GAAA", "names": ["HIDE_PRICING", "HidePricingGuard", "constructor", "vconfig", "partner", "hidePricing", "canActivate", "observableOf", "checkHidePricing", "getConfigurations", "partnerId", "pipe", "map", "result", "\u0275\u0275inject", "VConfigService", "PartnerService", "factory", "\u0275fac", "providedIn", "_HidePricingGuard"] }