Wir benötigen Ihre Zustimmung, um einen Service zu laden!
\r\n\r\n Wir verwenden an dieser Stelle einen Service, um Inhalte einzubetten. \r\n Dieser Service kann Daten zu Ihren Aktivitäten sammeln. Bitte lesen Sie die Details durch und stimmen Sie der Nutzung des Service zu, um diese Inhalte anzuzeigen.\r\n
\r\n Zustimmen\r\n Mehr Informationen\r\nzurück
\");\r\n $(\".backLink\").each(function () {\r\n var parentMenuText = $(this).parent(\"ul\").parent(\"li\").children(\".wrapper\").children(\"a.mobNavLink\").text();\r\n $(this).next(\"p.parentNode\").text(parentMenuText);\r\n });\r\n\r\n $(\"a.mobNavLink\").click(function (event) {\r\n var currentParent = $(event.target).closest(\".sideBarBody\");\r\n /*in case of popover find poover header and hide it*/\r\n var findPopupHeader = $(this).closest(\".mobMenu\").parent(\".sideBarBody\").parents(\"div.popover-body \").prev(\".popover-header\");\r\n $(findPopupHeader).hide(0);\r\n /**/\r\n var getWrapper = $(this).parent(\".wrapper\");\r\n if ($(getWrapper).next(\"ul\").length > 0) {\r\n event.preventDefault();\r\n\r\n $(\".mobile-caps-menu ul\").each(function () {\r\n $(this).removeClass(\"currentM\");\r\n });\r\n var subUl = $(getWrapper).next(\"ul.mobSubMenu\");\r\n var getChildLevel = $(getWrapper).next(\"ul.mobSubMenu\").attr(\"level\");\r\n var getParentLevel = getChildLevel - 1;\r\n subUl.addClass(\"currentM\");\r\n if (subUl && !subUl.hasClass(\"open\")) {\r\n subUl.addClass(\"open\");\r\n currentParent.find(\"ul[level='\" + getParentLevel + \"']\").children(\"li\").children(\".wrapper\").hide(0);\r\n currentParent.find(\"ul[level='\" + getParentLevel + \"']\").children(\".backLink\").hide(0);\r\n currentParent.find(\"ul[level='\" + getParentLevel + \"']\").children(\".parentNode\").hide(0);\r\n currentParent.find(\"ul[level='\" + getChildLevel + \"']\").children(\".backLink\").show(0);\r\n\r\n subUl.animate({\r\n left: 0,\r\n opacity: 1.0\r\n }, 0, \"linear\");\r\n }\r\n }\r\n //$(\".mobile-caps-menu\").height($(\"ul.currentM\").height());\r\n });\r\n\r\n $(\".backLink\").click(function () {\r\n $(\".mobile-caps-menu ul\").each(function () {\r\n $(this).removeClass(\"currentM\");\r\n });\r\n\r\n var getChildLevel = $(this).parent(\"ul\").attr(\"level\");\r\n var getParentLevel = getChildLevel - 1;\r\n var grandParentLevel = getParentLevel - 1;\r\n $(this).parent(\"ul\").parent(\"li\").parent(\"ul\").addClass(\"currentM\");\r\n $(this).parent(\"ul.mobSubMenu\").removeClass(\"open\").animate({ left: \"100%\", opacity: 0.0 }, 0, \"linear\");\r\n\r\n $(this).hide();\r\n $(\"ul[level='\" + getParentLevel + \"']\").children(\".backLink\").show(0);\r\n $(\"ul[level='\" + getParentLevel + \"']\").children(\".parentNode\").show(0);\r\n $(\"ul[level='\" + getParentLevel + \"']\").children(\"li\").children(\".wrapper\").show(0);\r\n /*in case of popover find popover header and display it when link's parent level is 0*/\r\n if (getParentLevel == 0) {\r\n var findPopupHeader = $(this).closest(\".mobMenu\").parent(\".sideBarBody\").parents(\"div.popover-body \").prev(\".popover-header\");\r\n $(findPopupHeader).show(0);\r\n }\r\n });\r\n $(function () {\r\n naviSlimScroll();\r\n $(\".slimScrollDiv\").css(\"display\", \"none\");\r\n $(\".katNaviScroll\").each(function () {\r\n if ($(this).hasClass(\"active\")) {\r\n //$(this).parent(\".slimScrollDiv\").css(\"display\",\"block\");\r\n //console.log($(this).parent(\".slimScrollDiv\"));\r\n $(this).parent(\".slimScrollDiv\").css(\"display\", \"block\");\r\n //$(this).parent().addClass(\"test\");\r\n }\r\n });\r\n });\r\n\r\n $(\".searchResult-filter-menue .categorie > p\").click(function () {\r\n toggleCatMenu($(this.parentElement));\r\n });\r\n\r\n cutTextWholeWords();\r\n}\r\n\r\nfunction toggleCatMenu(doc) {\r\n var changeCurIcon = doc.children(\"p\").children(\"i.fa\");\r\n $.fn.switchChevron(changeCurIcon, \"fa-angle-down\", \"fa-angle-up\");\r\n if (doc.children(\"p\").next(\"div.slimScrollDiv\").length > 0) {\r\n doc.children(\"div.slimScrollDiv\").slideToggle(0);\r\n } else {\r\n doc.find(\".categorySubMenu\").slideToggle(0);\r\n }\r\n}\r\n\r\nfunction naviSlimScroll() {\r\n $(\".katNaviScroll\").slimScroll({\r\n color: '#8f7747',\r\n size: '8px',\r\n height: '300px',\r\n alwaysVisible: true,\r\n railVisible: true,\r\n railColor: '#f1efee',\r\n railOpacity: 1.0\r\n });\r\n}\r\n\r\n$(\".submitGewinnspiel\").click(function (event) {\r\n\r\n if (grecaptcha == undefined) {\r\n $('#gewinnspiel_Recaptcha_Validation').removeClass('hide');\r\n return false;\r\n }\r\n try {\r\n var recaptchaResponse = grecaptcha.getResponse();\r\n } catch {\r\n $('#gewinnspiel_Recaptcha_Validation').removeClass('hide');\r\n return false;\r\n }\r\n if (recaptchaResponse.length == 0) {\r\n $('#gewinnspiel_Recaptcha_Validation').removeClass('hide');\r\n return false;\r\n }\r\n\r\n var id = $(this).data(\"id\");\r\n var addressform = $(this).data(\"addressform\");\r\n var gewinnspielForm = $(\"#gewinnspielForm_\" + id);\r\n //Blendet die ValidationMessages aus\r\n gewinnspielForm.find(\".validationMessage\").addClass(\"hide\");\r\n var antwort = gewinnspielForm.find(\"#gewinnspiel_Answer\").val();\r\n var salutation = gewinnspielForm.find(\"#gewinnspiel_Salutation\").val();\r\n var title = gewinnspielForm.find(\"#gewinnspiel_Title\").val();\r\n var vorname = gewinnspielForm.find(\"#gewinnspiel_Vorname\").val();\r\n var nachname = gewinnspielForm.find(\"#gewinnspiel_Nachname\").val();\r\n var email = gewinnspielForm.find(\"#gewinnspiel_Email\").val();\r\n var street = gewinnspielForm.find(\"#gewinnspiel_Street\").val();\r\n var city = gewinnspielForm.find(\"#gewinnspiel_City\").val();\r\n var postalCode = gewinnspielForm.find(\"#gewinnspiel_PostalCode\").val();\r\n var dataUsageAccepted = gewinnspielForm.find(\"#gewinnspiel_DataUsageAccepted\").prop('checked');\r\n var newsletterAccepted = gewinnspielForm.find(\"#gewinnspiel_NewsletterAccepted\").prop('checked');\r\n var gewinnspielEntry = {};\r\n gewinnspielEntry[\"Addressform\"] = addressform;\r\n gewinnspielEntry[\"GewinnspielId\"] = id;\r\n gewinnspielEntry[\"Antwort\"] = antwort;\r\n gewinnspielEntry[\"Salutation\"] = salutation;\r\n gewinnspielEntry[\"Title\"] = title;\r\n gewinnspielEntry[\"Vorname\"] = vorname;\r\n gewinnspielEntry[\"Nachname\"] = nachname;\r\n gewinnspielEntry[\"Email\"] = email;\r\n gewinnspielEntry[\"Street\"] = street;\r\n gewinnspielEntry[\"City\"] = city;\r\n gewinnspielEntry[\"PostalCode\"] = postalCode;\r\n gewinnspielEntry[\"DataUsageAccepted\"] = dataUsageAccepted;\r\n gewinnspielEntry[\"NewsletterAccepted\"] = newsletterAccepted;\r\n gewinnspielEntry[\"RecaptchaResponse\"] = recaptchaResponse;\r\n\r\n $.post(\"/Umbraco/Api/Gewinnspiel/SendGewinnspielEntry\", gewinnspielEntry,\r\n function (data, status) {\r\n //success\r\n $(\"#gewinnspielForm_\" + id).addClass(\"hide\");\r\n $(\"#confirmation_\" + id).removeClass(\"hide\");\r\n }).fail(function (data) {\r\n setModelstateErrorsGewinnspiel(data.responseJSON.ModelState, gewinnspielForm);\r\n });\r\n});\r\n/**\r\n * Schreibt die Meldungen aus dem Modelstate in die daf�r vorgesehenen Spans und zeigt diese an\r\n * @param {any} modelstate\r\n * @param {any} gewinnspielForm\r\n */\r\nfunction setModelstateErrorsGewinnspiel(modelstate, gewinnspielForm) {\r\n if (modelstate !== undefined) {\r\n if (modelstate[\"entryJson.Antwort\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_Answer_Validation\").html(modelstate[\"entryJson.Antwort\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.DataUsageAccepted\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_DataUsageAccepted_Validation\").html(modelstate[\"entryJson.DataUsageAccepted\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.Email\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_Email_Validation\").html(modelstate[\"entryJson.Email\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.Nachname\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_Nachname_Validation\").html(modelstate[\"entryJson.Nachname\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.Vorname\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_Vorname_Validation\").html(modelstate[\"entryJson.Vorname\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.City\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_City_Validation\").html(modelstate[\"entryJson.City\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.PostalCode\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_PostalCode_Validation\").html(modelstate[\"entryJson.PostalCode\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.Street\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_Street_Validation\").html(modelstate[\"entryJson.Street\"][0]).removeClass(\"hide\");\r\n }\r\n if (modelstate[\"entryJson.Salutation\"] !== undefined) {\r\n gewinnspielForm.find(\"#gewinnspiel_Salutation_Validation\").html(modelstate[\"entryJson.Salutation\"][0]).removeClass(\"hide\");\r\n }\r\n }\r\n}\r\nexport function cutTextWholeWords() {\r\n //Schneidet den Inhalt der Titel,publisher und descriptions bei der Trefferliste nach dem letzten vom Platz her passenden Wort ab und erg�nz drei Punkte\r\n const allElementsToCut = $(\".FFTrefferlistenProdukt .publisher, .FFTrefferlistenProdukt .title, .FFTrefferlistenProdukt .description\");\r\n Array.prototype.forEach.call(allElementsToCut,\r\n (cutElement) => { // Loop through each container\r\n var span = cutElement.getElementsByClassName(\"cutSpan\")[0];\r\n if (!span) {\r\n return;\r\n }\r\n var p = cutElement.clientHeight;\r\n while (span.offsetHeight > p) {\r\n // Check if the paragraph's height is taller than the container's height. If it is:\r\n span.textContent =\r\n span.textContent.replace(/\\W*\\s(\\S)*$/, '...'); // add an ellipsis at the last shown space\r\n }\r\n });\r\n}\r\n/*Ellipsis-trunket*/\r\n//$(document).ready(function () {\r\n// function ellipsizeTextBox(class_name) {\r\n// var el = document.getElementsByClassName(class_name);\r\n// var wordArray = el.innerHTML.split(' ');\r\n// while (el.scrollHeight > el.offsetHeight) {\r\n// wordArray.pop();\r\n// el.innerHTML = wordArray.join(' ') + '...';\r\n// }\r\n// }\r\n// ellipsizeTextBox(\"listingDescription\");\r\n//});\r\n/**/","import { formatPrice2Digits } from '../Shared/PriceHelper';\r\n\r\ndeclare var dataLayer: any[];\r\ndeclare var UC_UI: any;\r\n\r\n/**\r\n * Googletracking für ein Promotionevent\r\n */\r\nexport function productGoogleTracking() {\r\n if (window['UC_UI'] !== undefined && UC_UI.isInitialized) {\r\n let productsGoogleTrackingContainer = $('#productGoogleTracking');\r\n let name =\r\n productsGoogleTrackingContainer.data('name') !== '' ? productsGoogleTrackingContainer.data('name') : null;\r\n let id = productsGoogleTrackingContainer.data('id') !== '' ? productsGoogleTrackingContainer.data('id') : null;\r\n let price =\r\n productsGoogleTrackingContainer.data('price') !== ''\r\n ? formatPrice2Digits(parseFloat(productsGoogleTrackingContainer.data('price')))\r\n : null;\r\n let brand =\r\n productsGoogleTrackingContainer.data('brand') !== '' ? productsGoogleTrackingContainer.data('brand') : null;\r\n let category =\r\n productsGoogleTrackingContainer.data('category') !== ''\r\n ? productsGoogleTrackingContainer.data('category')\r\n : 'Produkt ohne Kategorie';\r\n let displayFormat =\r\n productsGoogleTrackingContainer.data('displayformat') !== ''\r\n ? productsGoogleTrackingContainer.data('displayformat')\r\n : null;\r\n let variant = null;\r\n if (productsGoogleTrackingContainer.data('producttype') == 'SEMINAR') {\r\n variant = 'Seminar/Tagung';\r\n } else {\r\n if (productsGoogleTrackingContainer.data('variant') !== '') {\r\n variant = productsGoogleTrackingContainer.data('variant');\r\n }\r\n }\r\n\r\n dataLayer.push({\r\n event: 'eec.productDetailImpression',\r\n ecommerce: {\r\n detail: {\r\n products: [\r\n {\r\n name: name, // Name or ID is required.\r\n id: id,\r\n price: price,\r\n brand: brand,\r\n category: category,\r\n variant: variant,\r\n dimension8: displayFormat,\r\n },\r\n ],\r\n },\r\n },\r\n });\r\n } else {\r\n setTimeout(productGoogleTracking, 100);\r\n }\r\n}\r\n\r\nexport function availabilityReminderSubmitTracking(productId: string, eventAction: string) {\r\n dataLayer.push({\r\n event: 'event',\r\n eventCategory: 'product data',\r\n eventAction: eventAction,\r\n eventLabel: `reminder_${productId}`,\r\n });\r\n\r\n dataLayer.push({\r\n event: 'econdaEvent',\r\n ecCustomProperties: {\r\n Target: ['product data', eventAction + '/' + `reminder_${productId}`, 0, 'd'],\r\n rqtype: 'hiddenpi',\r\n },\r\n });\r\n}\r\n","import ILineItem = CheckoutflowReponse.ILineItem;\r\nimport IPrice = CheckoutflowReponse.IPrice;\r\nimport { IPriceCalculation } from '../models/pricecalculation';\r\nexport var summeProbeAbosWerte: number = 0;\r\nexport var summeProbeAbosGrossWerte: number = 0;\r\n\r\nexport function getProductGrossPrice(lineItem: ILineItem): number {\r\n /*Anpassung für Probe-Abos (Gross)\r\n \r\n Hier die Formel für den errechneten Wert eines Probe-Abos (BYTE-261):\r\n\r\n Höchster verfügbarer Produktpreis * Wandlungsrate (0.2) * Faktor für angenommene Laufzeit\r\n\r\n > Höchster, verfügbarer Produktpreis > max(PriceGross)\r\n > Wandlungsrate > aus der Datenanalyse gehen wir von einer Wandlungsrate von 20% aus\r\n > Faktor für die angenommene Laufzeit (2 Jahre) > richtet sich nach den Abrechnungszeiträumen der Abos. Hier die Regeln dazu:\r\n\r\n Faktor 4 (4 Halbjahre sind 2 Jahre) > Wenn das Feld \"Preisbeschreibung\" \"halbjährlich\" ODER \"Halbjahr\"enthält\r\n Faktor 2 (2 ganze Jahre sind 2 Jahre) > Wenn das Feld nichts enthält, \"^jährlich.\", \"\\sjährlich.\" oder \"^Jahres.*\" enthält*/\r\n if (lineItem.currentPriceType.priceTypeId.toString()[0] === '4' && lineItem.singleItemGrossPrice.amount == 0) {\r\n const wandlungsrate = 0.2;\r\n let hoechsterPreis = getHighestValidPriceFromLineItem(lineItem.product.prices);\r\n let laufzeitFaktor = getLaufzeitFaktor(hoechsterPreis.priceGross, hoechsterPreis.description);\r\n if (hoechsterPreis && laufzeitFaktor) {\r\n let aboWert = hoechsterPreis.priceGross * wandlungsrate * laufzeitFaktor;\r\n summeProbeAbosGrossWerte += aboWert;\r\n\r\n return aboWert;\r\n }\r\n }\r\n\r\n return lineItem.singleItemGrossPrice ? lineItem.singleItemGrossPrice.amount : null;\r\n}\r\n\r\n/**\r\n * Im priceCalculation müssen die Preise valid übergeben werden.\r\n * @param priceCalculation\r\n * @param lineItem\r\n */\r\nexport function getProductNetPrice(lineItem: ILineItem, priceCalculation?: IPriceCalculation): number {\r\n /*Anpassung für Probe-Abos (Net)\r\n \r\n Hier die Formel für den errechneten Wert eines Probe-Abos (BYTE-261):\r\n\r\n Höchster verfügbarer Produktpreis * Wandlungsrate (0.2) * Faktor für angenommene Laufzeit\r\n\r\n > Höchster, verfügbarer Produktpreis > max(PriceGross)\r\n > Wandlungsrate > aus der Datenanalyse gehen wir von einer Wandlungsrate von 20% aus\r\n > Faktor für die angenommene Laufzeit (2 Jahre) > richtet sich nach den Abrechnungszeiträumen der Abos. Hier die Regeln dazu:\r\n\r\n Faktor 4 (4 Halbjahre sind 2 Jahre) > Wenn das Feld \"Preisbeschreibung\" \"halbjährlich\" ODER \"Halbjahr\"enthält\r\n Faktor 2 (2 ganze Jahre sind 2 Jahre) > Wenn das Feld nichts enthält, \"^jährlich.\", \"\\sjährlich.\" oder \"^Jahres.*\" enthält*/\r\n try {\r\n if (!lineItem && !priceCalculation) {\r\n return null;\r\n }\r\n\r\n if (lineItem) {\r\n return CalculatePriceFromLineItem(lineItem);\r\n }\r\n return CalculatePriceFromPriceCalculationModel(priceCalculation);\r\n } catch (error) {\r\n console.error(error);\r\n return null;\r\n }\r\n}\r\n\r\nexport function buildVar5(trackingProduct: CheckoutflowReponse.IProduct): string {\r\n let firstPart = 'none';\r\n if (trackingProduct.isTopArticle === true) {\r\n firstPart = 'isTop';\r\n } else if (trackingProduct.isStandard === true) {\r\n firstPart = 'isStandardwerk';\r\n }\r\n\r\n let secondPart = 'none';\r\n if (trackingProduct.isNew == true) {\r\n secondPart = 'isNew';\r\n } else if (trackingProduct.isPreview == true) {\r\n secondPart = 'isPreview';\r\n }\r\n\r\n return `${firstPart}_${secondPart}`;\r\n}\r\n\r\nfunction CalculatePriceFromPriceCalculationModel(priceCalculation: IPriceCalculation) {\r\n return CalculatePrice(\r\n priceCalculation.currentPrice,\r\n priceCalculation.currentPricetypeId,\r\n priceCalculation.highestPriceDescription,\r\n priceCalculation.highestPrice\r\n );\r\n}\r\n\r\nfunction CalculatePriceFromLineItem(lineItem: ILineItem): number {\r\n let currentPrice: number = lineItem.singleItemNetPrice.amount;\r\n let currentPriceTypeId: number = lineItem.currentPriceType.priceTypeId;\r\n let highestPrice: IPrice = getHighestValidPriceFromLineItem(lineItem.product.prices);\r\n if (!highestPrice) {\r\n return null;\r\n }\r\n let highestPriceDescription: string = highestPrice.description;\r\n let highestPriceAmount: number = highestPrice.priceNet;\r\n return CalculatePrice(currentPrice, currentPriceTypeId, highestPriceDescription, highestPriceAmount);\r\n}\r\n\r\nfunction CalculatePrice(\r\n currentPrice: number,\r\n currentPriceTypeId: number,\r\n highestPriceDescription: string,\r\n highestPrice: number\r\n): number {\r\n if (currentPriceTypeId.toString()[0] === '4' && currentPrice == 0) {\r\n const wandlungsrate = 0.2;\r\n let laufzeitFaktor = getLaufzeitFaktor(highestPrice, highestPriceDescription);\r\n if (highestPrice && laufzeitFaktor) {\r\n let aboWert = highestPrice * wandlungsrate * laufzeitFaktor;\r\n summeProbeAbosWerte += aboWert;\r\n\r\n return aboWert;\r\n }\r\n }\r\n\r\n return currentPrice;\r\n}\r\n\r\nfunction getHighestValidPriceFromLineItem(prices: IPrice[]): IPrice {\r\n let currentDate = new Date();\r\n let validPrices = prices.filter(\r\n x =>\r\n (x.validFrom == null || new Date(x.validFrom) < currentDate) &&\r\n (x.validUntil == null || new Date(x.validUntil) > currentDate)\r\n );\r\n if (!validPrices) {\r\n return null;\r\n }\r\n return validPrices.filter(x => x.priceGross == Math.max(...validPrices.map(y => y.priceGross)))[0];\r\n}\r\n\r\nfunction getLaufzeitFaktor(highestPrice: number, highestPriceDescription: string): number {\r\n if (!highestPrice) {\r\n return null;\r\n }\r\n if (highestPriceDescription.includes('halbjährlich') || highestPriceDescription.includes('Halbjahr')) {\r\n return 4;\r\n }\r\n\r\n return 2;\r\n}\r\n","import ProductHelper = require('../Shared/ProductHelper');\r\nimport { CheckoutService } from './checkoutService';\r\nimport { getItemCountForBasket } from './checkoutShared';\r\nimport { getFittingImage } from '../Shared/lazyImageLoader';\r\nimport 'bootstrap';\r\nimport IPrice = CheckoutflowReponse.IPrice;\r\nimport CheckoutActionResponseModel = require('./Models/Api/CheckoutActionResponseModel');\r\nimport ICheckoutActionResponseModel = CheckoutActionResponseModel.ICheckoutActionResponseModel;\r\nimport { buildTrboRequestUrl } from '../Shared/Trbo/TrboRequestBuilder';\r\nimport { isTrboAllowed } from '../Shared/userCentrics';\r\nimport { ProduktkarussellModel } from '../Produktdetails/Models/Produktkarussell';\r\nimport { mapTrboResponseToProduktkarussellModel } from '../Shared/Trbo/TrboResponseMapper';\r\nimport { trackGooglePromotionEvent_view } from '../Tracking/GoogleTracking';\r\nimport { activeButtonClickTracking } from '../OneClickCheckout/oneClickCheckoutTracking';\r\nconst checkoutService = new CheckoutService();\r\nconst spinnerModal = $('#spinnerModal');\r\nconst similarProductsTrackingEvent = 'Product_Reco_cart-modal_s2s';\r\nimport * as Cookies from 'js-cookie';\r\nimport { AddToCartTrackingLineItem, TrackBasketOverlayInteraction } from './Tracking/checkoutTrackingGlobal';\r\n\r\n$(() => {\r\n //Funktionen, die beim Seitenstart aufgerufen werden müssen\r\n getItemCountForBasket();\r\n\r\n $('body').on('click', '.basketLink', function() {\r\n if (window.innerWidth >= 992 && $('.headerBasket.notify').hasClass('hide') === false) {\r\n TrackBasketOverlayInteraction('meta-cart_view');\r\n $('.basket-menu-bubble').show();\r\n return false;\r\n }\r\n });\r\n\r\n $('.basket-menu-bubble').on('click', '.closeIcon', function() {\r\n $('.basket-menu-bubble').hide();\r\n });\r\n\r\n $('.basket-menu-bubble').on('click', '.basket-menu-bubble-tracking', function() {\r\n TrackBasketOverlayInteraction($(this).data('label'));\r\n });\r\n\r\n /**\r\n * Triggert onClick das hinzufügen eines Produktes zum Warenkorb und blendet in der Ladezeit einen Spinner ein\r\n */\r\n $('body').on('click', '.ajax_checkout_add', function() {\r\n let button = $(this);\r\n let noModal = button.hasClass('noModal');\r\n let isExpressKauf = button.hasClass('active_express');\r\n checkoutAdd(button, !noModal, null, isExpressKauf);\r\n });\r\n $('.ajax_checkout_add_mobile').on('click', function() {\r\n let button = $(this);\r\n button.addClass('hide');\r\n spinnerModal.removeClass('hide');\r\n let pricetypeId = $('#mobilePriceSelect')\r\n .find('option:selected')\r\n .data('pricetypeid');\r\n let showModal = !$(this).hasClass('noModal');\r\n addItemToBasket(button, pricetypeId, showModal);\r\n });\r\n\r\n $('body').on('click', '.ajax_checkout_bezugsart', function() {\r\n let elem = $(this);\r\n let productId = elem.data('productid');\r\n let pricetypeId = elem.data('pricetypeid');\r\n let showModal = elem.hasClass('showModal');\r\n let auswahlButton = $('#modalBezugsart-01 .bezugsart_auswahl');\r\n auswahlButton.data('productid', productId);\r\n auswahlButton.data('pricetypeid', pricetypeId);\r\n auswahlButton.addClass('showModal');\r\n });\r\n $('.bezugsart_auswahl').on('click', function() {\r\n let elem = $(this);\r\n var productId = elem.data('productid');\r\n var pricetypeId = elem.data('pricetypeid');\r\n var chosenDeliveryType = elem.data('chosendelivertype') as number;\r\n var showModal = elem.hasClass('showModal');\r\n spinnerModal.removeClass('hide');\r\n addItemToBasket(elem, pricetypeId, showModal, chosenDeliveryType);\r\n });\r\n\r\n $('#login-forbidden-order').on('click', function(event) {\r\n event.preventDefault();\r\n if ($('.headerBasket.notify').not('.hide').length > 0) {\r\n window.location.href = $(this).data('basketlink');\r\n } else {\r\n window.location.href = '/';\r\n }\r\n });\r\n});\r\n\r\n/**\r\n * Fügt ein Produkt dem Warenkorb hinzu. Während der Prozess läuft wird der Warenkorbbutton durch einen Spinner ersetzt\r\n * @param element\r\n */\r\nexport function checkoutAdd(button: JQuery, showModal: boolean, ChosenDeliveryType?: number, isExpressKauf?: boolean) {\r\n if (isExpressKauf) {\r\n activeButtonClickTracking();\r\n }\r\n button.addClass('hide');\r\n spinnerModal.removeClass('hide');\r\n let pricetypeId = +button.data('pricetypeid');\r\n addItemToBasket(button, pricetypeId, showModal, ChosenDeliveryType, isExpressKauf);\r\n}\r\n\r\n/**\r\n * Fügt ein Produkt dem Warenkorb hinzu\r\n * @param e\r\n */\r\nfunction addItemToBasket(\r\n button: JQuery,\r\n pricetypeId: number,\r\n showModal: boolean,\r\n chosenDeliveryType?: number,\r\n isExpressKauf?: boolean\r\n) {\r\n const productId = button.data('productid');\r\n checkoutService\r\n .addProductToBasket(productId, pricetypeId, chosenDeliveryType)\r\n .then(async (response: ICheckoutActionResponseModel) => {\r\n await getItemCountForBasket();\r\n AddToCartTrackingLineItem(response.lineItem);\r\n if (isExpressKauf) {\r\n Cookies.set('IsExpressKauf', 'true');\r\n checkoutService\r\n .expressKauf()\r\n .then(() => {\r\n window.location.href = '/pruefen-bestellen/';\r\n spinnerModal.addClass('hide');\r\n button.removeClass('hide');\r\n })\r\n .catch(error => {\r\n window.location.href = '/zahlung-versand/?ErrorOneClickCheckout=true';\r\n spinnerModal.addClass('hide');\r\n button.removeClass('hide');\r\n });\r\n } else {\r\n if (showModal) {\r\n fillModalWeiterShoppen(response);\r\n } else {\r\n window.location.href = '/warenkorb';\r\n }\r\n }\r\n })\r\n .catch(() => {})\r\n .then(() => {\r\n spinnerModal.addClass('hide');\r\n button.removeClass('hide');\r\n });\r\n}\r\n\r\n/**\r\n * Füllt das WeiterShoppen-Modal mit den Daten des hinzugefügten Produkt\r\n * @param data\r\n */\r\nasync function fillModalWeiterShoppen(response: ICheckoutActionResponseModel) {\r\n try {\r\n let lineItem = response.lineItem;\r\n let product = lineItem.product;\r\n if (product != null) {\r\n let modal = $('#modalWeiterShoppen');\r\n\r\n if (product.prices != null) {\r\n let price = product.prices.filter(\r\n x => x.priceType.priceTypeId == lineItem.currentPriceType.priceTypeId\r\n )[0] as IPrice;\r\n if (price != null) {\r\n modal.find('.results-main .price').html(\r\n (price.priceGross / 100).toLocaleString('de-De', {\r\n style: 'currency',\r\n currency: price.currency.currencyIsoCode,\r\n })\r\n );\r\n if (price.isApproximatePrice) {\r\n modal.find('.results-main .price').prepend('ca. ');\r\n }\r\n modal.find('.results-main .priceTypeDescription').html(price.priceType.priceTypeDescription);\r\n }\r\n modal\r\n .find('.results-main .ProductImage')\r\n .attr('src', getFittingImage(response.imageSizeOptions.SizeOptions));\r\n modal.find('.results-main .author').html(product.authorList);\r\n modal.find('.results-main .title').html(product.titleMain);\r\n if (product.isbnIssn) {\r\n modal.find('.results-main .isbn-webcode').html('ISBN ' + product.isbnIssn);\r\n } else {\r\n modal.find('.results-main .isbn-webcode').addClass('hide');\r\n }\r\n modal\r\n .find('.results-main .availabilityStatus')\r\n .html(await ProductHelper.getAvailabilityStatus(product.availabilityStatusId));\r\n if (product.availabilityStatusId == 1 || product.availabilityStatusId == 4) {\r\n modal.find('.results-main .availabilityStatus').addClass('availabilityStatusColorGreen');\r\n modal.find('.results-main .availability img').removeClass('hide');\r\n }\r\n modal.find('.validationMessage.success').html(response.message);\r\n spinnerModal.addClass('hide');\r\n $(modal).modal();\r\n\r\n fillModalWeiterShoppenRecomendation(product.productId);\r\n }\r\n }\r\n } catch (e) {\r\n spinnerModal.addClass('hide');\r\n $('.ajax_checkout_add').removeClass('hide');\r\n }\r\n}\r\n\r\nconst fillModalWeiterShoppenRecomendation = (productId: number) => {\r\n hideRecommandation();\r\n if (isTrboAllowed()) {\r\n const url = buildTrboRequestUrl('Product_Reco_cart-modal_s2s', productId);\r\n $.ajax({\r\n method: 'GET',\r\n dataType: 'JSON',\r\n url: encodeURI(url),\r\n success: data => {\r\n try {\r\n const trboProducts = mapTrboResponseToProduktkarussellModel(data) as ProduktkarussellModel;\r\n if (trboProducts.karussellItems.length === 0) {\r\n return;\r\n }\r\n const productContainer = $('.similar-products');\r\n trboProducts.karussellItems.slice(0, 4).forEach(trboProduct => {\r\n let productPrototype = $('#similar-products-proto').clone();\r\n productPrototype\r\n .find('.title a')\r\n .html(trboProduct.title)\r\n .attr('href', trboProduct.productDetailUrl)\r\n .addClass('similarProductTracking')\r\n .attr('data-trackingevent', similarProductsTrackingEvent);\r\n\r\n productPrototype.find('.author').html(trboProduct.authorstring);\r\n\r\n productPrototype.find('.imgWrapper img').attr('src', replaceImageHeight(trboProduct.imageUrl));\r\n productPrototype\r\n .find('.imgLink')\r\n .attr('href', trboProduct.productDetailUrl)\r\n .addClass('similarProductTracking')\r\n .attr('data-trackingevent', similarProductsTrackingEvent);\r\n\r\n productPrototype.find('.price').html(trboProduct.pricePrefix + trboProduct.price);\r\n productPrototype.find('.year').html(trboProduct.releaseYear);\r\n productPrototype.find('.edition').html(trboProduct.auflage);\r\n productPrototype.find('.medium').html(trboProduct.medium);\r\n productPrototype.find('.publisher').html(trboProduct.publisher);\r\n\r\n if (trboProduct.warenkorbAnzeigen) {\r\n productPrototype.find('.ajax_checkout_add').data('productid', trboProduct.productId);\r\n productPrototype.find('.ajax_checkout_add').removeClass('hide');\r\n }\r\n\r\n productContainer.append(productPrototype);\r\n });\r\n\r\n trackGooglePromotionEvent_view(similarProductsTrackingEvent);\r\n $('.similar-products').show();\r\n } catch {\r\n hideRecommandation();\r\n }\r\n },\r\n });\r\n }\r\n};\r\n\r\nfunction replaceImageHeight(productDetailUrl: string) {\r\n if (!productDetailUrl) {\r\n return productDetailUrl;\r\n }\r\n return productDetailUrl.replace('height=180', 'width=105');\r\n}\r\n\r\nconst hideRecommandation = () => {\r\n $('.similar-products .row').remove();\r\n $('.similar-products').hide();\r\n};\r\n","$(() => {\r\n var lazyloadImages = document.querySelectorAll