{ "version": 3, "sources": ["apps/partner-center-client/src/app/core/tag.service.ts"], "sourcesContent": ["import { Inject, Injectable } from '@angular/core';\nimport { AccountGroupSdkService, AggregationSupportedFields } from '@vendasta/account-group';\nimport { combineLatest, Observable, ReplaySubject } from 'rxjs';\nimport { shareReplay, switchMap, take } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class TagService {\n private tags$$: ReplaySubject = new ReplaySubject();\n private _tags$: Observable = this.tags$$.asObservable();\n\n constructor(\n @Inject('PARTNER_ID') private readonly partnerId$: Observable,\n @Inject('MARKET_ID') private readonly marketId$: Observable,\n private accountGroupService: AccountGroupSdkService,\n ) {}\n\n get tags(): Observable {\n return this._tags$;\n }\n\n loadAllTags(): void {\n combineLatest([this.partnerId$, this.marketId$])\n .pipe(\n take(1),\n switchMap(([partnerId, marketId]) => {\n return this.accountGroupService.listOptionsForField({\n partnerId: partnerId,\n marketId: marketId,\n field: AggregationSupportedFields.AGGREGATION_TAGS,\n });\n }),\n shareReplay(1),\n )\n .subscribe((tags) => this.tags$$.next(tags));\n }\n}\n"], "mappings": "iIAMA,IAAaA,GAAU,IAAA,CAAjB,IAAOA,EAAP,MAAOA,CAAU,CAIrBC,YACyCC,EACDC,EAC9BC,EAA2C,CAFZ,KAAAF,WAAAA,EACD,KAAAC,UAAAA,EAC9B,KAAAC,oBAAAA,EANF,KAAAC,OAAkC,IAAIC,EACtC,KAAAC,OAA+B,KAAKF,OAAOG,aAAY,CAM5D,CAEH,IAAIC,MAAI,CACN,OAAO,KAAKF,MACd,CAEAG,aAAW,CACTC,EAAc,CAAC,KAAKT,WAAY,KAAKC,SAAS,CAAC,EAC5CS,KACCC,EAAK,CAAC,EACNC,EAAU,CAAC,CAACC,EAAWC,CAAQ,IACtB,KAAKZ,oBAAoBa,oBAAoB,CAClDF,UAAWA,EACXC,SAAUA,EACVE,MAAOC,EAA2BC,iBACnC,CACF,EACDC,EAAY,CAAC,CAAC,EAEfC,UAAWb,GAAS,KAAKJ,OAAOkB,KAAKd,CAAI,CAAC,CAC/C,yCA5BWT,GAAUwB,EAKX,YAAY,EAAAA,EACZ,WAAW,EAAAA,EAAAC,CAAA,CAAA,CAAA,wBANVzB,EAAU0B,QAAV1B,EAAU2B,UAAAC,WADG,MAAM,CAAA,EAC1B,IAAO5B,EAAP6B,SAAO7B,CAAU,GAAA", "names": ["TagService", "constructor", "partnerId$", "marketId$", "accountGroupService", "tags$$", "ReplaySubject", "_tags$", "asObservable", "tags", "loadAllTags", "combineLatest", "pipe", "take", "switchMap", "partnerId", "marketId", "listOptionsForField", "field", "AggregationSupportedFields", "AGGREGATION_TAGS", "shareReplay", "subscribe", "next", "\u0275\u0275inject", "AccountGroupSdkService", "factory", "\u0275fac", "providedIn", "_TagService"] }