-
Notifications
You must be signed in to change notification settings - Fork 1
/
src_app_custom-elements_announcement-bar_announcement-bar_module_ts.832088749075f16b.js.map
1 lines (1 loc) · 5.5 KB
/
src_app_custom-elements_announcement-bar_announcement-bar_module_ts.832088749075f16b.js.map
1
{"version":3,"file":"src_app_custom-elements_announcement-bar_announcement-bar_module_ts.832088749075f16b.js","mappings":"sTA8CEA,MAAA,UAAAA,CAAqD,WAEjDA,MAAA,UAAAA,CAAmC,SAEnCA,MAAA,SAAgDA,MAAA,gBAAUA,kCAFrDA,MAAA,GAAAA,MAAA,MAAAC,EAAAC,aAAAC,SAAAH,OACFA,cAAA,YAAAC,EAAAC,aAAAE,QAAAJ,OACeA,cAAA,OAAAC,EAAAC,aAAAG,QAAAL,QA7CxB,MAAMM,EAAoBC,KAAqB,qBAiDxC,IAAMC,EAAwB,UAAAC,EAA/B,MAAOD,EAGTE,YAAoBC,EAA0BC,GAA1BC,KAAAF,OAA0BE,KAAAD,QAAiB,CAE/DE,WACID,KAAKF,KAAKI,IAAoBT,GACzBU,QACGC,KAAWC,IACPL,KAAKD,OAAOM,MAAM,IAAIC,MAAM,GAAGb,qBAAqCY,EAAMd,YACnE,MACV,EACDgB,KAAIC,GAAiBR,KAAKS,wBAAwBD,KAAc,EAChEJ,KAAWC,IACPL,KAAKD,OAAOM,MAAM,IAAIC,MAAM,GAAGb,4BAA4CY,EAAMd,YAC1E,MAGdmB,UAAUrB,GAAgBW,KAAKX,aAAeA,EACvD,CAKQoB,wBAAwBD,GAC5B,OAAOA,EACFG,OAAOtB,GAAgB,IAAIuB,KAAKvB,EAAawB,WAAWC,UAAYF,KAAKG,OACzEJ,OAAOtB,GAAgB,IAAIuB,KAAKvB,EAAa2B,SAASF,UAAYF,KAAKG,OAAO,EACvF,WA5BSpB,0CAAwBR,MAAA8B,MAAA9B,MAAA+B,KAAA,0BAAxBvB,EAAwBwB,UAAA,2BAAAC,MAAA,EAAAC,KAAA,EAAAC,OAAA,0IAAAC,SAAA,SAAAC,EAAAC,GAAA,EAAAD,GARnCrC,MAAA,EAAAuC,EAAA,kBAAiCvC,MAAA,OAAAsC,EAAApC,qDAQtBM,CAAwB,KC3CxBgC,EAAqB,UAAAC,EAA5B,MAAOD,EAJb9B,cAKIG,KAAA6B,uBAAoClC,YAD3BgC,yCAAqB,0BAArBA,gCAHCG,KAAcC,IAAcC,QAG7BL,CAAqB","names":["i0","ctx_r0","announcement","imageUrl","message","linkUrl","announcementsPath","CONTENT_URL_PREFIX","AnnouncementBarComponent","_AnnouncementBarComponent","constructor","http","logger","this","ngOnInit","get","pipe","catchError","error","Error","map","announcements","findCurrentAnnouncement","subscribe","filter","Date","startDate","valueOf","now","endDate","i1","i2","selectors","decls","vars","consts","template","rf","ctx","AnnouncementBarComponent_div_0_Template","AnnouncementBarModule","_AnnouncementBarModule","customElementComponent","CommonModule","SharedModule","HttpClientModule"],"sourceRoot":"webpack:///","sources":["./src/app/custom-elements/announcement-bar/announcement-bar.component.ts","./src/app/custom-elements/announcement-bar/announcement-bar.module.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { catchError, map } from 'rxjs/operators';\nimport { Logger } from 'app/shared/logger.service';\nimport { CONTENT_URL_PREFIX } from 'app/documents/document.service';\nconst announcementsPath = CONTENT_URL_PREFIX + 'announcements.json';\n\nexport interface Announcement {\n imageUrl: string;\n message: string;\n linkUrl: string;\n startDate: string;\n endDate: string;\n}\n\n/**\n * Display the latest live announcement. This is used on the homepage.\n *\n * The data for the announcements is kept in `aio/content/marketing/announcements.json`.\n *\n * The format for that data file looks like:\n *\n * ```\n * [\n * {\n * \"startDate\": \"2018-02-01\",\n * \"endDate\": \"2018-03-01\",\n * \"message\": \"This is an <b>important</b> announcement\",\n * \"imageUrl\": \"url/to/image\",\n * \"linkUrl\": \"url/to/website\"\n * },\n * ...\n * ]\n * ```\n *\n * Only one announcement will be shown at any time. This is determined as the first \"live\"\n * announcement in the file, where \"live\" means that its start date is before today, and its\n * end date is after today.\n *\n * **Security Note:**\n * The `message` field can contain unsanitized HTML but this field should only updated by\n * verified members of the Angular team.\n */\n@Component({\n selector: 'aio-announcement-bar',\n template: `\n <div class=\"homepage-container\" *ngIf=\"announcement\">\n <div class=\"announcement-bar\">\n <img [src]=\"announcement.imageUrl\">\n <p [innerHTML]=\"announcement.message\"></p>\n <a class=\"button\" [href]=\"announcement.linkUrl\">Learn More</a>\n </div>\n </div>`\n})\nexport class AnnouncementBarComponent implements OnInit {\n announcement: Announcement;\n\n constructor(private http: HttpClient, private logger: Logger) {}\n\n ngOnInit() {\n this.http.get<Announcement[]>(announcementsPath)\n .pipe(\n catchError(error => {\n this.logger.error(new Error(`${announcementsPath} request failed: ${error.message}`));\n return [];\n }),\n map(announcements => this.findCurrentAnnouncement(announcements)),\n catchError(error => {\n this.logger.error(new Error(`${announcementsPath} contains invalid data: ${error.message}`));\n return [];\n }),\n )\n .subscribe(announcement => this.announcement = announcement);\n }\n\n /**\n * Get the first date in the list that is \"live\" now\n */\n private findCurrentAnnouncement(announcements: Announcement[]) {\n return announcements\n .filter(announcement => new Date(announcement.startDate).valueOf() < Date.now())\n .filter(announcement => new Date(announcement.endDate).valueOf() > Date.now())[0];\n }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { SharedModule } from '../../shared/shared.module';\nimport { AnnouncementBarComponent } from './announcement-bar.component';\nimport { WithCustomElementComponent } from '../element-registry';\n\n@NgModule({\n imports: [CommonModule, SharedModule, HttpClientModule],\n declarations: [AnnouncementBarComponent],\n})\nexport class AnnouncementBarModule implements WithCustomElementComponent {\n customElementComponent: Type<any> = AnnouncementBarComponent;\n}\n"],"x_google_ignoreList":[]}