{ "version": 3, "sources": ["src/app/content/guards/content-page-meta.guard.ts"], "sourcesContent": ["import { Injectable } from '@angular/core';\r\n\r\nimport { Store } from '@ngrx/store';\r\nimport { tap, filter, take, switchMap, catchError, map } from 'rxjs/operators';\r\n\r\nimport * as fromStore from '../store';\r\nimport { Observable, of } from 'rxjs';\r\nimport { SetTitle, SetTags } from '../../store';\r\nimport { StringUtility } from '@teamfoster/sdk/text-utility';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ContentPageMetaGuard {\r\n constructor(private store: Store) {}\r\n\r\n canActivate(): Observable {\r\n return this.checkStore().pipe(\r\n switchMap(() => of(true)),\r\n catchError(() => of(false))\r\n );\r\n }\r\n\r\n checkStore(): Observable {\r\n return this.store.select(fromStore.getSelectedContentPage).pipe(\r\n tap(page => {\r\n this.store.dispatch(SetTitle({ title: `${page.title} - KCAP` }));\r\n this.store.dispatch(\r\n SetTags({\r\n properties: {\r\n 'description':\r\n StringUtility.Truncate(StringUtility.StripHTML(page.intro), 157, '...') ||\r\n StringUtility.Truncate(StringUtility.StripHTML(page.text), 157, '...'),\r\n 'og:image': page.imageUrl,\r\n 'og:title': `${page.title} - KCAP`,\r\n 'og:description':\r\n StringUtility.Truncate(StringUtility.StripHTML(page.intro), 157, '...') ||\r\n StringUtility.Truncate(StringUtility.StripHTML(page.text), 157, '...'),\r\n },\r\n })\r\n );\r\n }),\r\n map(a => true),\r\n take(1)\r\n );\r\n }\r\n}\r\n"], "mappings": "iMAWA,IAAaA,GAAoB,IAAA,CAA3B,IAAOA,EAAP,MAAOA,CAAoB,CAC/BC,YAAoBC,EAAoC,CAApC,KAAAA,MAAAA,CAAuC,CAE3DC,aAAW,CACT,OAAO,KAAKC,WAAU,EAAGC,KACvBC,EAAU,IAAMC,EAAG,EAAI,CAAC,EACxBC,EAAW,IAAMD,EAAG,EAAK,CAAC,CAAC,CAE/B,CAEAH,YAAU,CACR,OAAO,KAAKF,MAAMO,OAAiBC,CAAsB,EAAEL,KACzDM,EAAIC,GAAO,CACT,KAAKV,MAAMW,SAASC,EAAS,CAAEC,MAAO,GAAGH,EAAKG,KAAK,SAAS,CAAE,CAAC,EAC/D,KAAKb,MAAMW,SACTG,EAAQ,CACNC,WAAY,CACV,YACEC,EAAcC,SAASD,EAAcE,UAAUR,EAAKS,KAAK,EAAG,IAAK,KAAK,GACtEH,EAAcC,SAASD,EAAcE,UAAUR,EAAKU,IAAI,EAAG,IAAK,KAAK,EACvE,WAAYV,EAAKW,SACjB,WAAY,GAAGX,EAAKG,KAAK,UACzB,iBACEG,EAAcC,SAASD,EAAcE,UAAUR,EAAKS,KAAK,EAAG,IAAK,KAAK,GACtEH,EAAcC,SAASD,EAAcE,UAAUR,EAAKU,IAAI,EAAG,IAAK,KAAK,GAE1E,CAAC,CAEN,CAAC,EACDE,EAAIC,GAAK,EAAI,EACbC,EAAK,CAAC,CAAC,CAEX,yCAhCW1B,GAAoB2B,EAAAC,CAAA,CAAA,CAAA,wBAApB5B,EAAoB6B,QAApB7B,EAAoB8B,UAAAC,WADP,MAAM,CAAA,EAC1B,IAAO/B,EAAPgC,SAAOhC,CAAoB,GAAA", "names": ["ContentPageMetaGuard", "constructor", "store", "canActivate", "checkStore", "pipe", "switchMap", "of", "catchError", "select", "getSelectedContentPage", "tap", "page", "dispatch", "SetTitle", "title", "SetTags", "properties", "StringUtility", "Truncate", "StripHTML", "intro", "text", "imageUrl", "map", "a", "take", "\u0275\u0275inject", "Store", "factory", "\u0275fac", "providedIn", "_ContentPageMetaGuard"] }