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AG,QAAQ,CAAC,aAAa,CAAC,6CAA6C,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;YAC1H,IAAI,uBAAuB,EAAE;gBAC3B,uBAA2C,CAAC,KAAK,EAAE,CAAC;aACrD;SACD;KACD;IAyED,MAAM;;QACL,QACC,EAAC,IAAI,uDACJ,4DACC,KAAK,EAAC,wDAAwD,EAC9D,GAAG,EAAE,IAAI,CAAC,cAAc,GACvB,EACF,4DAAK,KAAK,EAAC,0DAA0D,IACpE,4DAAK,KAAK,EAAC,+CAA+C,IACzD,4DAAK,KAAK,EAAC,2DAA2D,IACrE,2DAAI,KAAK,EAAC,iDAAiD,IACzD,MAAA,IAAI,CAAC,aAAa,0CAAE,KAAK,CACtB,EACJ,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,WAAW;eAC5B,2DAAI,KAAK,EAAC,qDAAqD,IAChE,IAAI,CAAC,aAAa,CAAC,WAAW,CAC3B,EAEL,IAAI,CAAC,6BAA6B,EAAE;eACjC,4DAAK,KAAK,EAAC,oDAAoD,IAAC,4DAAI,IAAI,CAAC,mBAAmB,CAAK,CAAM,CAEtG,EACN,4DAAK,KAAK,EAAC,qDAAqD,IAC/D,qFAA4B,MAAA,IAAI,CAAC,aAAa,0CAAE,SAAS,GAAG,CACvD,CACD,EACN,4DAAK,KAAK,EAAC,+CAA+C,IACxD,IAAI,CAAC,iBAAiB,EAAE,EACxB,IAAI,CAAC,kCAAkC,CAAC,IAAI,CAAC,UAAU,CAAC,CACpD,CACD,CACA,EACN;KACF;;;;;;;;;;","names":[],"sources":["src/components/myifx-gated-document/components/myifx-gated-document-registration-cta/myifx-gated-document-registration-cta.scss?tag=myifx-gated-document-registration-cta","src/components/myifx-gated-document/components/myifx-gated-document-registration-cta/myifx-gated-document-registration-cta.tsx"],"sourcesContent":["@import '../../../../global/ifx/variables';\n\n:host {\n\tdisplay: block;\n}\n\nmyifx-gated-document-registration-cta {\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground-color: #fff;\n\tposition: absolute;\n\ttop: 120px;\n\tleft: 0;\n\tpadding: 24px;\n\tmargin: 18px;\n\tborder: 1px solid $ifx_button_grey;\n\n\t// tablet\n\t@media screen and (min-width: $screen-sm) {\n\t\tflex-direction: row;\n\t\ttop: 70px;\n\t\tleft: calc(50% - 110px);\n\t\tpadding: 44px 20px 34px;\n\t\tmargin: 20px;\n\t}\n\n\t// desktop\n\t@media screen and (min-width: $screen-md) {\n\t\tpadding: 62px 36px 48px;\n\t\tleft: 40%;\n\t}\n}\n\n.myifx-gated-document-registration-cta {\n\t&__content-container {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tjustify-content: space-between;\n\t}\n\n\t&__header {\n\t\tdisplay: flex;\n\t\tpadding-bottom: 10px;\n\t}\n\n\t&__headline {\n\t\tfont-weight: 600;\n\t\tmargin-bottom: 0;\n\t\tfont-size: 18px;\n\t\tline-height: 22px;\n\n\t\t// tablet\n\t\t@media only screen and (min-width: $screen-sm) {\n\t\t\tfont-size: 20px;\n\t\t\tline-height: 20px;\n\t\t}\n\n\t\t// small desktop\n\t\t@media only screen and (min-width: $screen-md) {\n\t\t\tfont-size: 24px;\n\t\t\tline-height: 26px;\n\t\t}\n\n\t\t// large desktop\n\t\t@media only screen and (min-width: $screen-lg) {\n\t\t\tfont-size: 28px;\n\t\t\tline-height: 34px;\n\t\t}\n\t}\n\n\t&__description {\n\t\tmargin-top: 15px;\n\n\t\t// tablet\n\t\t@media only screen and (max-width: $screen-sm) {\n\t\t\tdisplay: block;\n\t\t}\n\n\t\t// desktop\n\t\t@media only screen and (min-width: $screen-sm) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t&__sub-headline {\n\t\tfont-weight: 600;\n\t\tmargin-bottom: 0;\n\t\tfont-size: 16px;\n\t\tline-height: 16px;\n\n\t\t// tablet\n\t\t@media only screen and (min-width: $screen-sm) {\n\t\t\tfont-size: 18px;\n\t\t\tline-height: 18px;\n\t\t}\n\n\t\t// desktp\n\t\t@media only screen and (min-width: $screen-md) {\n\t\t\tfont-size: 20px;\n\t\t\tline-height: 22px;\n\t\t}\n\t}\n\n\t&__share-button {\n\t\tpadding: 0 0 0 10px;\n\n\t\tifx-share-button .button.share-file .icon-wrapper {\n\t\t\theight: 30px;\n\t\t\twidth: 30px;\n\t\t\tfill: #000;\n\t\t}\n\n\t\t// desktop\n\t\t@media only screen and (min-width: $screen-lg) {\n\t\t\tpadding: 0 16px;\n\t\t}\n\t}\n\n\t&__image-container {\n\t\tdisplay: flex;\n\t\twidth: 100%;\n\t\theight: 200px;\n\t\tborder: 1px solid #888;\n\t\tobject-fit: cover;\n\t\tobject-position: top;\n\t\tmargin-bottom: 24px;\n\n\t\t// tablet\n\t\t@media screen and (min-width: $screen-sm) {\n\t\t\tmargin-right: 12px;\n\t\t\tmargin-bottom: 0;\n\t\t\tmax-width: 158px;\n\t\t\theight: 186px;\n\t\t}\n\n\t\t// desktop\n\t\t@media screen and (min-width: $screen-md) {\n\t\t\tmargin-right: 26px;\n\t\t\tmax-width: 262px;\n\t\t}\n\t}\n\n\t&__footer {\n\t\tdisplay: flex;\n\t\tflex-flow: column;\n\t\tz-index: 1;\n\n\t\tifx-primary-download-button {\n\t\t\twidth: 100%;\n\t\t\tmax-width: 100%;\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\t// tablet\n\t\t@media only screen and (min-width: $screen-sm) {\n\t\t\tifx-primary-download-button {\n\t\t\t\twidth: fit-content;\n\t\t\t\tmax-width: 250px;\n\t\t\t}\n\t\t}\n\t}\n\n\t&__teaser-text {\n\t\tmargin: 10px 0 0;\n\t\tfont-size: 13px;\n\n\t\t// tablet\n\t\t@media only screen and (min-width: $screen-sm) {\n\t\t\tfont-size: 16px;\n\t\t\tmargin: 10px 0 0;\n\t\t}\n\n\t\t.link::before {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n}\n","import {\n\tComponent, Env, getAssetPath, h, Host, Prop, State, Watch\n} from '@stencil/core';\nimport { getConfiguration } from '../../../../global/environment-variable-helper';\nimport { getStringedObjectContainingSingleQuotesAsJSON } from '../../../../global/helper/text-helper';\nimport { getTranslation } from '../../../../global/helper/translation-helper';\nimport { getParameterFromUrl } from '../../../../global/helper/url-helper';\nimport { hasUserLoggedInOrRegisteredBefore } from '../../../../global/login-detection-helper';\nimport { GatedDocumentData } from '../../../../global/models/gated-document-data.model';\nimport { RegistrationCtaTranslations } from './models/translations.model';\nimport { AccessModes } from '../../../../global/tracking/tracking-helper';\nimport { RegistrationSource } from '../../../../global/models/registration-source.model';\nimport { GatedContentLoginOrRegisterModalClickData } from '../../../../global/models/login-or-register-click-data.model';\nimport { redirectToPingActionPageByAppendingHiddenCtaComponentToBody } from '../../../../global/helper/login-or-register-cta-helper';\nimport { ActionType, ActionTypeValue } from '../../../vi-myifx-login-or-registration-cta/model/action-type.model';\n\n@Component({\n\tassetsDirs: ['assets/images'],\n\tshadow: false,\n\tstyleUrl: 'myifx-gated-document-registration-cta.scss',\n\ttag: 'myifx-gated-document-registration-cta'\n})\nexport class MyifxGatedDocumentRegistrationCta {\n\t_documentData: GatedDocumentData;\n\tbuttonText: string;\n\tdownloadButton: HTMLButtonElement;\n\tteaserImageBaseUrl: string;\n\ttranslation: RegistrationCtaTranslations;\n\n\t@State() isLoggedIn = false;\n\t@State() teaserImageUrl: string;\n\n\t@Prop() documentDescription: string;\n\t@Prop({ mutable: true, reflect: true }) downloadUrl: string;\n\t@Prop() language = 'en';\n\n\t@Prop() documentData: GatedDocumentData | string;\n\n\t@Watch('documentData')\n\tdocumentDataWatcher(newValue: GatedDocumentData | string): void {\n\t\tif (typeof newValue === 'string') {\n\t\t\tthis._documentData = getStringedObjectContainingSingleQuotesAsJSON(newValue);\n\t\t} else {\n\t\t\tthis._documentData = newValue;\n\t\t}\n\t}\n\n\tasync componentWillLoad() {\n\t\tthis.documentDataWatcher(this.documentData);\n\t\tthis.downloadUrl = this._documentData?.downloadUrl;\n\t\tthis.isLoggedIn = hasUserLoggedInOrRegisteredBefore();\n\t\tthis.translation = getTranslation(this.language);\n\t\tthis.teaserImageBaseUrl = getConfiguration(Env.environment).teaserImageBaseUrl;\n\t\tthis.teaserImageUrl = getAssetPath('assets/images/default-preview.jpg');\n\t\tawait this.getTeaserImageUrl();\n\t}\n\n\tcomponentDidRender() {\n\t\tthis.openDocumentIfRequestedAndUserIsLoggedIn();\n\t}\n\n\tprivate openDocumentIfRequestedAndUserIsLoggedIn() {\n\t\tconst loggedInFromValue = getParameterFromUrl(window.location.href, 'loggedInFrom');\n\t\tif (this.isLoggedIn && loggedInFromValue && loggedInFromValue === 'gatedDocument') {\n\t\t\tconst gatedContentLinkElement = document.querySelector(`a[data-track-name*=\"downloadLink\"][href*=\"${this.downloadUrl}\"]`);\n\t\t\tif (gatedContentLinkElement) {\n\t\t\t\t(gatedContentLinkElement as HTMLLinkElement).click();\n\t\t\t}\n\t\t}\n\t}\n\n\tonCtaClickHandler = (event: Event, actionType: ActionTypeValue): void => {\n\t\tconst extraClickParameters = JSON.stringify(this.mapToRegistrationClickParametersModel(this._documentData));\n\t\tredirectToPingActionPageByAppendingHiddenCtaComponentToBody(actionType, extraClickParameters, this.language);\n\t\tevent.preventDefault();\n\t};\n\n\tmapToRegistrationClickParametersModel = (documentData: GatedDocumentData): GatedContentLoginOrRegisterModalClickData => {\n\t\treturn {\n\t\t\titemOfInterestId: documentData?.id,\n\t\t\titemOfInterestTitle: documentData?.title,\n\t\t\titemOfInterestUrl: documentData?.downloadUrl,\n\t\t\tonSearchResultPage: false,\n\t\t\tregistrationSource: RegistrationSource.GATED_CONTENT_PROMOPAGES\n\t\t};\n\t};\n\n\tcheckTeaserImageUrlStatus = async (imageUrl: string): Promise<boolean> => {\n\t\treturn (await fetch(imageUrl)).ok;\n\t};\n\n\tgetDownloadButton = (): HTMLElement => {\n\t\tlet downloadUrl: string;\n\t\tlet target: string;\n\t\tlet clickHandler: (event: Event) => void;\n\t\tif (this.isLoggedIn) {\n\t\t\tthis.buttonText = this.translation.gatedDocumentCtaButtonLogin;\n\t\t\tdownloadUrl = this.downloadUrl;\n\t\t\tclickHandler = () => {};\n\t\t\ttarget = '_blank';\n\t\t} else {\n\t\t\tthis.buttonText = this.translation.gatedDocumentCtaButton;\n\t\t\tdownloadUrl = '';\n\t\t\tclickHandler = (event: Event) => this.onCtaClickHandler(event, ActionType.REGISTER);\n\t\t\ttarget = '_self';\n\t\t}\n\t\treturn <ifx-primary-download-button\n\t\t\tref={ (el: HTMLButtonElement) => { this.downloadButton = el; }}\n\t\t\tonClick={clickHandler}\n\t\t\taccessMode={AccessModes.GATED_CONTENT} // this component is used exclusively by documents having access mode GATED_CONTENT\n\t\t\tbutton-text={this.buttonText}\n\t\t\thref={downloadUrl} target={target}/>;\n\t};\n\n\tgetLoginRequestTextWhenNotLoggedIn = (isLoggedIn: boolean): HTMLElement => {\n\t\tif (!isLoggedIn) {\n\t\t\treturn <div class='myifx-gated-document-registration-cta__teaser-text'>\n\t\t\t\t<span><a class='link' onClick={(event: Event) => this.onCtaClickHandler(event, ActionType.LOGIN)} href=\"\" target=\"_blank\">{this.translation.loginLink.linkText}</a> {this.translation.loginLink.spanText}</span>\n\t\t\t</div>;\n\t\t}\n\t\treturn null;\n\t};\n\n\tgetTeaserImageUrl = async (): Promise<string> => {\n\t\tlet teaserImageUrl: string;\n\t\tlet doesImageExist: boolean;\n\n\t\tif (this._documentData?.id) {\n\t\t\tteaserImageUrl = `${this.teaserImageBaseUrl}${this._documentData.id}&size=mobile`;\n\t\t\tdoesImageExist = await this.checkTeaserImageUrlStatus(teaserImageUrl);\n\n\t\t\tif (doesImageExist) {\n\t\t\t\tthis.teaserImageUrl = teaserImageUrl;\n\t\t\t}\n\t\t}\n\t\treturn this.teaserImageUrl;\n\t};\n\n\tisDocumentDescriptionProvided = (): boolean => {\n\t\treturn this.documentDescription?.length > 0;\n\t};\n\n\trender() {\n\t\treturn (\n\t\t\t<Host>\n\t\t\t\t<img\n\t\t\t\t\tclass=\"myifx-gated-document-registration-cta__image-container\"\n\t\t\t\t\tsrc={this.teaserImageUrl}\n\t\t\t\t/>\n\t\t\t\t<div class=\"myifx-gated-document-registration-cta__content-container\">\n\t\t\t\t\t<div class=\"myifx-gated-document-registration-cta__header\">\n\t\t\t\t\t\t<div class=\"myifx-gated-document-registration-cta__headline-container\">\n\t\t\t\t\t\t\t<h1 class=\"myifx-gated-document-registration-cta__headline\">\n\t\t\t\t\t\t\t\t{this._documentData?.title}\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t{this._documentData?.subHeadline\n\t\t\t\t\t\t\t\t&& <h2 class=\"myifx-gated-document-registration-cta__sub-headline\">\n\t\t\t\t\t\t\t\t\t{this._documentData.subHeadline}\n\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t{this.isDocumentDescriptionProvided()\n\t\t\t\t\t\t\t\t&& <div class=\"myifx-gated-document-registration-cta__description\"><p>{this.documentDescription}</p></div>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"myifx-gated-document-registration-cta__share-button\">\n\t\t\t\t\t\t\t<ifx-share-button file-url={this._documentData?.shareLink}/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"myifx-gated-document-registration-cta__footer\">\n\t\t\t\t\t\t{this.getDownloadButton()}\n\t\t\t\t\t\t{this.getLoginRequestTextWhenNotLoggedIn(this.isLoggedIn)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t);\n\t}\n}\n"],"version":3}