{"version":3,"file":"chunk-dbnv2u1b.js","sources":["packages/vanilla/lib/features/clock/src/clock.client-config.ts","packages/vanilla/lib/features/clock/src/clock.html","packages/vanilla/lib/features/clock/src/clock.component.ts","packages/vanilla/lib/features/clock/src/clock-bootstrap.service.ts","packages/vanilla/lib/features/clock/src/clock.feature.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { ClientConfigProductName, LazyClientConfig, LazyClientConfigBase, LazyClientConfigService } from '@frontend/vanilla/core';\n\n/**\n * @stable\n */\n@LazyClientConfig({ key: 'vnClock', product: ClientConfigProductName.SF })\n@Injectable({\n providedIn: 'root',\n useFactory: clockConfigFactory,\n deps: [LazyClientConfigService],\n})\nexport class ClockConfig extends LazyClientConfigBase {\n slotName: string;\n dateTimeFormat: string;\n useWithTimeZone: boolean;\n}\n\nexport function clockConfigFactory(service: LazyClientConfigService) {\n return service.get(ClockConfig);\n}\n","@if (commonMessages.ClockText; as clockText) {\n {{ clockText }}\n}\n{{ time | date: format }}\n","import { CommonModule } from '@angular/common';\nimport { ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';\n\nimport {\n CommonMessages,\n DateTimeService,\n HtmlNode,\n LocalStoreKey,\n LocalStoreService,\n SlotName,\n WebWorkerService,\n WorkerType,\n} from '@frontend/vanilla/core';\nimport { firstValueFrom } from 'rxjs';\n\nimport { ClockConfig } from './clock.client-config';\n\n@Component({\n standalone: true,\n imports: [CommonModule],\n selector: 'vn-clock',\n templateUrl: 'clock.html',\n styleUrls: ['../../../../../themepark/themes/whitelabel/components/clock/styles.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class ClockComponent implements OnInit, OnDestroy {\n @Input() format: string;\n @Input() slotName: SlotName;\n\n time: Date = new Date();\n\n private htmlNodeClassName: string;\n\n constructor(\n public commonMessages: CommonMessages,\n private clockConfig: ClockConfig,\n private htmlNode: HtmlNode,\n private localStoreService: LocalStoreService,\n private webWorkerService: WebWorkerService,\n private dateTimeService: DateTimeService,\n private changeDetectorRef: ChangeDetectorRef,\n ) {}\n\n async ngOnInit() {\n await firstValueFrom(this.clockConfig.whenReady);\n\n if (this.clockConfig.dateTimeFormat) {\n this.format = this.clockConfig.dateTimeFormat;\n } else if (!this.format) {\n this.format = 'mediumTime';\n }\n\n this.htmlNodeClassName = `${this.slotName?.toLowerCase() ?? 'custom'}-clock-shown`;\n this.htmlNode.setCssClass(this.htmlNodeClassName, true);\n\n this.storeSownCount();\n\n this.webWorkerService.createWorker(WorkerType.ClockInterval, { interval: 1000 }, () => {\n if (this.clockConfig.useWithTimeZone) {\n this.time = this.dateTimeService.convertLocalToUserTimezone(new Date());\n } else {\n this.time = new Date();\n }\n this.changeDetectorRef.detectChanges();\n });\n }\n\n ngOnDestroy() {\n this.webWorkerService.removeWorker(WorkerType.ClockInterval);\n this.htmlNode.setCssClass(this.htmlNodeClassName, false);\n }\n\n private storeSownCount() {\n let clockShowCounter = this.localStoreService.get(LocalStoreKey.ClockShowTimes);\n\n if (clockShowCounter) {\n if (clockShowCounter > 2) {\n this.localStoreService.set(LocalStoreKey.ClockShowTimes, 0);\n } else {\n this.localStoreService.set(LocalStoreKey.ClockShowTimes, clockShowCounter++);\n }\n } else {\n this.localStoreService.set(LocalStoreKey.ClockShowTimes, 1);\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\nimport { DynamicLayoutService, EmbeddableComponentsService, OnFeatureInit } from '@frontend/vanilla/core';\nimport { first } from 'rxjs/operators';\n\nimport { ClockConfig } from './clock.client-config';\nimport { ClockComponent } from './clock.component';\n\n@Injectable()\nexport class ClockBootstrapService implements OnFeatureInit {\n constructor(\n private config: ClockConfig,\n private dynamicLayoutService: DynamicLayoutService,\n private embeddableComponentsService: EmbeddableComponentsService,\n ) {}\n\n onFeatureInit() {\n this.embeddableComponentsService.registerEmbeddableComponent(ClockComponent, 100);\n this.config.whenReady.pipe(first()).subscribe(() => {\n if (this.config.slotName) {\n this.dynamicLayoutService.addFirstComponent(this.config.slotName, ClockComponent, {\n slotName: this.config.slotName,\n format: this.config.dateTimeFormat,\n });\n }\n });\n }\n}\n","import { runOnFeatureInit } from '@frontend/vanilla/core';\n\nimport { ClockBootstrapService } from './clock-bootstrap.service';\n\nexport function provide() {\n return [runOnFeatureInit(ClockBootstrapService)];\n}\n"],"names":["ClockConfig","_a","LazyClientConfigBase","t","factory","r","clockConfigFactory","ɵɵinject","LazyClientConfigService","__decorate","LazyClientConfig","key","product","ClientConfigProductName","SF","service","get","ɵɵtext","ɵɵelementStart","ɵɵelementEnd","ɵɵadvance","ɵɵtextInterpolate","ctx","ClockComponent","constructor","commonMessages","clockConfig","htmlNode","localStoreService","webWorkerService","dateTimeService","changeDetectorRef","time","Date","ngOnInit","__async","firstValueFrom","whenReady","dateTimeFormat","format","htmlNodeClassName","slotName","toLowerCase","setCssClass","storeSownCount","createWorker","WorkerType","ClockInterval","interval","useWithTimeZone","convertLocalToUserTimezone","detectChanges","ngOnDestroy","removeWorker","clockShowCounter","LocalStoreKey","ClockShowTimes","set","ɵɵdirectiveInject","CommonMessages","HtmlNode","LocalStoreService","WebWorkerService","DateTimeService","ChangeDetectorRef","selectors","inputs","standalone","features","ɵɵStandaloneFeature","decls","vars","consts","template","rf","ɵɵtemplate","ClockComponent_Conditional_0_Template","x","ɵɵconditional","ClockComponent_contFlowTmp","ClockText","ɵɵpipeBind2","CommonModule","DatePipe","styles","encapsulation","_ClockComponent","ClockBootstrapService","config","dynamicLayoutService","embeddableComponentsService","onFeatureInit","registerEmbeddableComponent","pipe","first","subscribe","addFirstComponent","DynamicLayoutService","EmbeddableComponentsService","ɵfac","_ClockBootstrapService","provide","runOnFeatureInit"],"mappings":"+UAaaA,CAANC,EAAAA,CAAAA,CAAA,cAA0BC,EAAoB,EAAxCF,CAAAA,CAAAA,CAAAA,SAAAA,CAAAA,CAAAA,IAAAA,CAAAA,IAAAA,CAAAA,CAAAA,OAAAA,SAAAA,CAAAA,CAAAA,CAAAA,OAAAA,CAAAA,CAAAA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