{"version":3,"file":"webflow-CSiX0KeJ.js","sources":["../../../app/frontend/javascript/webflow/newsletter-signup_controller.js","../../../app/frontend/javascript/webflow/webflow-iframe_controller.js","../../../app/frontend/javascript/app/features/SteadyCheckoutWidget.js","../../../app/frontend/javascript/webflow/index.js"],"sourcesContent":["import { Controller } from '@hotwired/stimulus';\nimport { extract as extractQueryParams } from '@frontend/utils/query-params';\nimport MatomoTracker from '@frontend/app/features/MatomoTracker';\n\nexport default class extends Controller {\n static values = {\n trackMatomoGoalId: { type: Number, default: -1 },\n };\n\n static targets = [\n 'utmCampaignInputField',\n 'failureMessage',\n 'successMessage',\n ];\n\n connect() {\n this.form = this.element.querySelector('form');\n this.form.addEventListener('ajax:success', this.handleSuccess.bind(this));\n this.form.addEventListener('ajax:error', this.handleError.bind(this));\n this.form.addEventListener('ajax:before', this.handleBefore.bind(this));\n const utmCampaign = extractQueryParams(window.top.location.href)[\n 'utm_campaign'\n ];\n if (utmCampaign) {\n this.utmCampaignInputFieldTarget.value = utmCampaign;\n }\n }\n\n handleBefore() {\n this.form.hidden = true;\n }\n\n handleSuccess(event) {\n const [data] = event.detail;\n if (data.status == 'ok') {\n this.successMessageTarget.hidden = false;\n this.successMessageTarget.innerHTML = data.messages.join('. ');\n if (this.hasTrackMatomoGoalIdValue && this.trackMatomoGoalIdValue > 0) {\n MatomoTracker.trackGoal(this.trackMatomoGoalIdValue);\n }\n }\n }\n\n handleError(event) {\n const [data] = event.detail;\n let failureMessage = '';\n if (data.error_messages) {\n failureMessage = data.error_messages.join('\\n<br/>');\n } else {\n failureMessage =\n 'Da ist etwas schiefgegangen. Kontaktiere unseren Support.';\n }\n this.failureMessageTarget.hidden = false;\n this.failureMessageTarget.innerHTML = failureMessage;\n }\n}\n","import { Controller } from '@hotwired/stimulus';\nimport { runWhenDomLoaded } from '@frontend/utils/dom';\n\nexport default class extends Controller {\n connect() {\n runWhenDomLoaded(() => {\n const iframe = window.frameElement;\n if (iframe) {\n iframe.allowTransparency = true;\n iframe.frameBorder = 0;\n const body = this.element;\n const iframeContentHeight = body.scrollHeight + 'px';\n iframe.style.height = iframeContentHeight;\n }\n });\n }\n}\n","import CampaignTracking from '@frontend/app/features/CampaignTracking';\nimport ConvertedWithTracking from '@frontend/app/features/ConvertedWithTracking';\nimport MatomoTracker from '@frontend/app/features/MatomoTracker';\nimport queryString from 'query-string';\n\nexport default class SteadyCheckoutWidget {\n static init() {\n if (window.top.__steadyCheckoutWidgetInitiated === true) return true;\n window.top.__steadyCheckoutWidgetInitiated = true;\n this.start();\n }\n\n static start() {\n this.maxInitAttempts = 5;\n this.initAttempt = this.initAttempt || 0;\n this.initAttempt += 1;\n\n if (!this.isReady() && this.initAttempt <= this.maxInitAttempts) {\n setTimeout(() => this.start(), 500);\n } else if (this.getSteadyCheckoutWidgetPlaceholder()) {\n this.maybeAddUTMCampaignDataAttributes();\n this.loadSteadyCheckoutWidgetJs();\n }\n }\n\n static getSteadyCheckoutWidgetPlaceholderId() {\n return 'insert_steady_checkout_here';\n }\n\n static isReady() {\n return (\n this.checkoutIsConfiguredAndEnabled() &&\n this.getSteadyCheckoutWidgetPlaceholder() !== undefined &&\n this.matomoTrackerIsReady()\n );\n }\n\n static matomoTrackerIsReady() {\n return MatomoTracker.isReady();\n }\n\n static checkoutIsConfiguredAndEnabled() {\n return (\n window &&\n window.ENV &&\n window.ENV.steady &&\n window.ENV.steady.checkoutWidget.enabled &&\n window.ENV.steady.checkoutWidget.url\n );\n }\n\n static getSteadyCheckoutWidgetJsUrl() {\n return window.ENV.steady.checkoutWidget.url;\n }\n\n static getSteadyOAuthAccessToken() {\n return window.ENV.steady.checkoutWidget.oauthAccessToken;\n }\n\n static getSteadyCheckoutWidgetPlaceholder() {\n return window.top.document.querySelector(\n `#${this.getSteadyCheckoutWidgetPlaceholderId()}`\n );\n }\n\n static maybeAddUTMCampaignDataAttributes() {\n const steadyWidgetPlaceholder = this.getSteadyCheckoutWidgetPlaceholder();\n steadyWidgetPlaceholder.dataset.utmCampaign =\n this.currentSteadyPublisherUtmCampaignOrBuildUtmCampaign();\n }\n\n static currentSteadyPublisherUtmCampaignOrBuildUtmCampaign() {\n const query = queryString.parse(window.top.location.search);\n const overlayUrl = query['steady_overlay_url'];\n\n if (overlayUrl) {\n const overlayQuery = queryString.parse(overlayUrl);\n\n if (overlayQuery['steady_publisher_utm_campaign']) {\n return overlayQuery['steady_publisher_utm_campaign'];\n }\n }\n\n return this.generateUtmCampaignTracking();\n }\n\n // Defines the custom utm_campaign-value we pass to steady as the `steady_publisher_utm_campaign`\n // This special utm_campaign-value carries multiple dimensions of information.\n //\n // a) The original utm_campaign which was present when a user visited an article\n // b) A converted_with value which identifies the article and an optional share-url\n static generateUtmCampaignTracking() {\n return [\n this.getCurrentCampaignTracking(),\n ConvertedWithTracking.getCurrentConvertedWith(),\n ]\n .filter((x) => x.length > 1)\n .join('__');\n }\n\n static getCurrentCampaignTracking() {\n const activeCampaign = CampaignTracking.getCurrentCampaign();\n if (activeCampaign) {\n return activeCampaign.replace('__', '--').substr(0, 200);\n } else {\n return '';\n }\n }\n\n static loadSteadyCheckoutWidgetJs() {\n if (window.___steadyCheckoutWidgetJsLoading) return true;\n\n var script = document.createElement('script');\n script.src = this.getSteadyCheckoutWidgetJsUrl();\n if (this.getSteadyOAuthAccessToken()) {\n script.dataset.steadyOauthAccessToken = this.getSteadyOAuthAccessToken();\n }\n window.top.document.body.appendChild(script);\n\n window.___steadyCheckoutWidgetJsLoading = true;\n }\n}\n","import { Application } from '@hotwired/stimulus';\nimport NavbarComponentController from '@components/navbar/component_controller';\nimport NewsletterSignupController from './newsletter-signup_controller';\nimport WebflowIframeController from './webflow-iframe_controller';\nimport { runWhenDomLoaded } from '@frontend/utils/dom';\n\nconst application = Application.start();\napplication.register('navbar--component', NavbarComponentController);\napplication.register('newsletter-signup', NewsletterSignupController);\napplication.register('webflow-iframe', WebflowIframeController);\n\nimport Rails from '@rails/ujs';\nimport CampaignTracking from '@frontend/app/features/CampaignTracking';\nimport ConvertedWithTracking from '@frontend/app/features/ConvertedWithTracking';\nimport ImgixHelper from '@frontend/app/features/ImgixHelper';\nimport SteadyCheckoutWidget from '@frontend/app/features/SteadyCheckoutWidget';\n\nrunWhenDomLoaded(() => {\n if (window._rails_loaded !== true) {\n Rails.start();\n }\n\n ImgixHelper.init();\n CampaignTracking.init();\n ConvertedWithTracking.init();\n SteadyCheckoutWidget.init();\n});\n"],"names":["NewsletterSignupController","Controller","utmCampaign","extractQueryParams","event","data","MatomoTracker","failureMessage","__publicField","WebflowIframeController","runWhenDomLoaded","iframe","iframeContentHeight","SteadyCheckoutWidget","steadyWidgetPlaceholder","overlayUrl","queryString","overlayQuery","ConvertedWithTracking","x","activeCampaign","CampaignTracking","script","application","Application","NavbarComponentController","Rails","ImgixHelper"],"mappings":"miBAIe,MAAKA,UAASC,CAAW,CAWtC,SAAU,CACR,KAAK,KAAO,KAAK,QAAQ,cAAc,MAAM,EAC7C,KAAK,KAAK,iBAAiB,eAAgB,KAAK,cAAc,KAAK,IAAI,CAAC,EACxE,KAAK,KAAK,iBAAiB,aAAc,KAAK,YAAY,KAAK,IAAI,CAAC,EACpE,KAAK,KAAK,iBAAiB,cAAe,KAAK,aAAa,KAAK,IAAI,CAAC,EACtE,MAAMC,EAAcC,EAAmB,OAAO,IAAI,SAAS,IAAI,EAC7D,aAEED,IACF,KAAK,4BAA4B,MAAQA,EAE/C,CAEE,cAAe,CACb,KAAK,KAAK,OAAS,EACvB,CAEE,cAAcE,EAAO,CACnB,KAAM,CAACC,CAAI,EAAID,EAAM,OACjBC,EAAK,QAAU,OACjB,KAAK,qBAAqB,OAAS,GACnC,KAAK,qBAAqB,UAAYA,EAAK,SAAS,KAAK,IAAI,EACzD,KAAK,2BAA6B,KAAK,uBAAyB,GAClEC,EAAc,UAAU,KAAK,sBAAsB,EAG3D,CAEE,YAAYF,EAAO,CACjB,KAAM,CAACC,CAAI,EAAID,EAAM,OACrB,IAAIG,EAAiB,GACjBF,EAAK,eACPE,E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