{"version":3,"file":"html-jq4qiz7x.js","sources":["packages/vanilla/lib/features/html/src/html-bootstrap.service.ts","packages/vanilla/lib/features/html/src/html.feature.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport {\n DeviceService,\n HtmlNode,\n NativeAppService,\n OnFeatureInit,\n Page,\n ProductMetadata,\n ProductService,\n UserService,\n UserUpdateEvent,\n} from '@frontend/vanilla/core';\nimport { filter } from 'rxjs/operators';\n\n@Injectable()\nexport class HtmlBootstrapService implements OnFeatureInit {\n constructor(\n private user: UserService,\n private htmlNode: HtmlNode,\n private page: Page,\n private productService: ProductService,\n private deviceService: DeviceService,\n private nativeAppService: NativeAppService,\n ) {}\n\n onFeatureInit() {\n this.htmlNode.setAttribute('data-domain', this.page.domain);\n this.htmlNode.setCssClass(`th-${this.page.theme}`, true);\n this.htmlNode.setCssClass('device-mobile', this.deviceService.isMobile);\n this.htmlNode.setCssClass('device-mobile-phone', this.deviceService.isMobilePhone);\n this.htmlNode.setCssClass('device-tablet', this.deviceService.isTablet);\n this.htmlNode.setCssClass('device-desktop', !this.deviceService.isMobile);\n this.htmlNode.setCssClass('device-touch', this.deviceService.isTouch);\n\n this.htmlNode.setCssClass('native-download-client-app', this.nativeAppService.isDownloadClientApp);\n this.htmlNode.setCssClass('native-download-client-wrapper', this.nativeAppService.isDownloadClientWrapper);\n this.htmlNode.setCssClass('native-app', this.nativeAppService.isNativeApp);\n this.htmlNode.setCssClass('native-wrapper', this.nativeAppService.isNativeWrapper && !this.nativeAppService.isNativeWrapperODR);\n this.htmlNode.setCssClass('native-wrapper-odr', this.nativeAppService.isNativeWrapperODR);\n\n if (!this.productService.isSingleDomainApp) {\n this.htmlNode.setCssClass(`product-${this.page.product}`, true);\n } else {\n this.productService.productChanged.subscribe((product: ProductMetadata) => {\n this.htmlNode.removeClassStartsWith(`product-`);\n this.htmlNode.setCssClass(`product-${product.name}`, true);\n });\n }\n if (this.nativeAppService.isNative) {\n this.htmlNode.setCssClass(`native-${this.nativeAppService.applicationName}`, true);\n }\n\n this.setCountryAttribute();\n this.setHtmlClass();\n\n this.user.events.pipe(filter((e): e is UserUpdateEvent => e instanceof UserUpdateEvent)).subscribe((e: UserUpdateEvent) => {\n const diff = e.diff;\n\n if (diff.has('workflowType') || diff.has('isAuthenticated')) {\n this.setHtmlClass();\n }\n\n if (diff.has('country') || diff.has('isAuthenticated')) {\n this.setCountryAttribute();\n }\n });\n }\n\n private setCountryAttribute() {\n if (this.user.isAuthenticated) {\n this.htmlNode.setAttribute('data-country', this.user.country);\n } else {\n this.htmlNode.setAttribute('data-country', null);\n }\n }\n\n private setHtmlClass() {\n const hasWorkflow = this.user.workflowType !== 0;\n\n this.htmlNode.setCssClass('has-workflow', hasWorkflow);\n this.htmlNode.setCssClass('unauthenticated', !this.user.isAuthenticated);\n this.htmlNode.setCssClass('authenticated', this.user.isAuthenticated);\n }\n}\n","import { runOnFeatureInit } from '@frontend/vanilla/core';\n\nimport { HtmlBootstrapService } from './html-bootstrap.service';\n\nexport function provide() {\n return [runOnFeatureInit(HtmlBootstrapService)];\n}\n"],"names":["HtmlBootstrapService","constructor","user","htmlNode","page","productService","deviceService","nativeAppService","onFeatureInit","setAttribute","domain","setCssClass","theme","isMobile","isMobilePhone","isTablet","isTouch","isDownloadClientApp","isDownloadClientWrapper","isNativeApp","isNativeWrapper","isNativeWrapperODR","isSingleDomainApp","productChanged","subscribe","product","removeClassStartsWith","name","isNative","applicationName","setCountryAttribute","setHtmlClass","events","pipe","filter","e","UserUpdateEvent","diff","has","isAuthenticated","country","hasWorkflow","workflowType","ɵɵinject","UserService","HtmlNode","Page","ProductService","DeviceService","NativeAppService","factory","ɵfac","_HtmlBootstrapService","provide","runOnFeatureInit"],"mappings":"kIAgBA,IAAaA,GAAoB,IAAA,CAA3B,IAAOA,CAAAA,CAAP,MAAOA,CAAoB,CAC7BC,WACYC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CAA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