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iCjB,KAAKiD,OAAQrD,GACpEI,KAAKiE,WAAWxC,MACpB,CAEA,oBAAAyC,G,MACmB,QAAf,EAAAlE,KAAKiE,kBAAU,SAAEpE,SACrB,EAGJsE,eAAeC,OAAO,kCAAmCtB,GAEzD,iB","sources":["webpack://teaser_mobile-simonly/./app/teaser-service.ts","webpack://teaser_mobile-simonly/./app/teaser-controller.ts","webpack://teaser_mobile-simonly/./app/teaser.ts"],"sourcesContent":["import {TeaserPrices} from './teaser-interfaces';\n\nexport class MobilfunkSimOnlyTeaserService {\n\n    constructor(private host: string | null) {}\n\n    public destroy(): void {}\n\n    public async loadTeaserPrices(): Promise<TeaserPrices | null> {\n        const base = this.host ? `https://${this.host}` : 'https://handytarife.check24.de';\n        const url = base + '/api/v1/app/result/collection/sim/teaser-prices';\n\n        try {\n            const response = await fetch(url, {\n                headers: {\n                    Accept: 'application/json'\n                }\n            });\n            if (response.status !== 200) {\n                throw new Error(`Failed to load teaser prices: ${response.status}`);\n            }\n            const data = await response.json() as Partial<TeaserPrices>;\n            return {\n                defaultMinPrice: String(data.defaultMinPrice ?? ''),\n                esimMinPrice: String(data.esimMinPrice ?? ''),\n                unlimitedMinPrice: String(data.unlimitedMinPrice ?? ''),\n                flexibleMinPrice: String(data.flexibleMinPrice ?? '')\n            };\n        } catch (err) {\n            console.error('[teaser] failed to fetch prices', err);\n            return null;\n        }\n    }\n\n}\n","import {MobilfunkSimOnlyTeaserService} from './teaser-service';\n\nimport {TeaserPrices} from './teaser-interfaces';\n \nexport class MobilfunkSimOnlyTeaserController {\n    private readonly sliderService = new MobilfunkSimOnlyTeaserService(this.host)\n    private teaserPrices: TeaserPrices | null = null;\n\n    private layoutObserver?: ResizeObserver;\n    private readonly onLayoutChange = () => this.updateLayout();\n\n    constructor(\n        private readonly shadowRoot: ShadowRoot,\n        private readonly host: string | null\n    ) {}\n\n    public destroy(): void {\n        this.layoutObserver?.disconnect();\n    }\n\n    public init(): void {\n        this.initLayout();\n        this.loadTeaserPrices();\n    }\n\n    private async loadTeaserPrices(): Promise<void> {\n        this.teaserPrices = await this.sliderService.loadTeaserPrices();\n        this.shadowRoot.querySelectorAll<HTMLElement>('[data-price]').forEach((element) => {\n            const key = element.dataset.price as keyof TeaserPrices;\n            element.textContent = this.teaserPrices?.[key] ?? '';\n        });\n    }\n\n    public updateLayout(): void {\n        const element = this.shadowRoot.host as HTMLElement;\n        const availableWidth = element.clientWidth;\n        const isHero = availableWidth >= 400 && availableWidth <= 559;\n        const headline = this.shadowRoot.querySelector('.headline');\n\n        if (isHero) {\n            element.setAttribute('data-promotion', 'top');\n        } else {\n            element.removeAttribute('data-promotion');\n        }\n\n        headline?.classList.toggle('headline-hero', isHero);\n        headline?.classList.toggle('headline-small', !isHero);\n\n        this.shadowRoot.querySelectorAll('.icon').forEach((icon) => {\n            icon.classList.toggle('icon-hero', isHero);\n            icon.classList.toggle('icon-small', !isHero);\n        });\n    }\n\n    private initLayout(): void {\n        this.layoutObserver = new ResizeObserver(this.onLayoutChange);\n        this.layoutObserver.observe(this.shadowRoot.host);\n        this.updateLayout();\n    }\n}\n","import { MobilfunkSimOnlyTeaserController } from './teaser-controller';\nimport template from './teaser.html';\n\nexport class MobilfunkSimOnlyTeaserV2 extends HTMLElement {\n    private controller?: MobilfunkSimOnlyTeaserController;\n    private shadow: ShadowRoot;\n\n    constructor() {\n        super();\n        this.shadow = this.attachShadow({mode: 'closed'});\n    }\n\n    connectedCallback(): void {\n        const isPreview = this.getAttribute('data-is-preview') === 'true';\n\n        var host = null;\n        if (isPreview && window) {\n            host = window.location.host;\n        } else if (\n            window.location.hostname === 'www.check24-test.de' ||\n            window.location.hostname === 'check24-test.de'\n        ) {\n            host = 'handytarife.check24-test.de';\n        }\n\n        this.shadow.innerHTML = template;\n        const assetsBase = `https://assets.${host ?? 'handytarife.check24.de'}/v1/static/teaser-image/`;\n\n        const flexibleImage = this.shadow.getElementById('c24mfso-flex-image') as HTMLImageElement;\n        const unlimitedImage = this.shadow.getElementById('c24mfso-unlimited-image') as HTMLImageElement;\n        const esimImage = this.shadow.getElementById('c24mfso-esim-image') as HTMLImageElement;\n        const fiveGImage = this.shadow.getElementById('c24mfso-5g-image') as HTMLImageElement;\n        flexibleImage.src = assetsBase + 'teaser-v2-flex.jpg';\n        unlimitedImage.src = assetsBase + 'teaser-v2-unlim.jpg';\n        esimImage.src = assetsBase + 'teaser-v2-esim.jpg';\n        fiveGImage.src = assetsBase + 'teaser-v2-5g.jpg';\n\n        this.controller = new MobilfunkSimOnlyTeaserController(this.shadow, host);\n        this.controller.init();\n    }\n\n    disconnectedCallback(): void {\n        this.controller?.destroy();\n    }\n}\n\ncustomElements.define('mobileservice-simonly-teaser-v2', MobilfunkSimOnlyTeaserV2);\n\nexport default MobilfunkSimOnlyTeaserV2;\n"],"names":["MobilfunkSimOnlyTeaserService","constructor","host","destroy","loadTeaserPrices","url","this","response","fetch","headers","Accept","status","Error","data","json","defaultMinPrice","String","esimMinPrice","unlimitedMinPrice","flexibleMinPrice","err","console","error","MobilfunkSimOnlyTeaserController","shadowRoot","sliderService","teaserPrices","onLayoutChange","updateLayout","layoutObserver","disconnect","init","initLayout","querySelectorAll","forEach","element","key","dataset","price","textContent","availableWidth","clientWidth","isHero","headline","querySelector","setAttribute","removeAttribute","classList","toggle","icon","ResizeObserver","observe","MobilfunkSimOnlyTeaserV2","HTMLElement","super","shadow","attachShadow","mode","connectedCallback","getAttribute","window","location","hostname","innerHTML","assetsBase","flexibleImage","getElementById","unlimitedImage","esimImage","fiveGImage","src","controller","disconnectedCallback","customElements","define"],"ignoreList":[],"sourceRoot":""}