var d21_uuid='f9d77a78-191e-410a-b8b6-b0c2a1effbf3';var d21_culture='';var d21_widget_url='https://js-sdk.dirs21.de';var d21_allowed_languages='pl-PL,ar-SA,de-DE,de-AT,en-US,en-GB,es-ES,fr-FR,it-IT,nl-NL,ru-RU,zh-CN,da-DK';var d21_app_version='1.1.4.13';var d21_socket_host='https://socket.dirs21.de';var d21_tocc_host='https://api.tocc.dirs21.de';var d21_cdn_url='https://api.tocc.dirs21.de/v1/cdn';var d21_tourdata_url='https://www.dirs21.de/TourData';var d21_ibe_api_host='https://ibe-api-v4-default.dirs21.de';var d21_config='{"_id":22689,"Amenities":[],"AvailCalendar":{"IsActive":false,"IsIBETrigger":false,"WeekCount":0},"CustomCode":{"Code":null,"IsActive":false},"DisplayMode":"2","EventList":{"DefaultPageSize":10,"HasCalendar":true,"HasFilter":false,"IsActive":false},"GoogleAnalytics":{"Code":null,"ForeignType":0,"HasCrossDomainTracking":false,"InvocationType":null,"IsActive":false,"ProviderID":null,"Steps":null,"TrackingGroup":null,"TrackingId":null,"Type":0,"UACode":null},"IBE":{"AddOnLimit":10,"AffiliateID":null,"Broker_Token":"TR9leR","Channel":"www.hotel-papilio.de","Channel_Token":"9xtpgp","City":{"_id":0,"Content":null,"Country":null,"Directory":null,"GeoCoordinate":null,"GroupIDs":null,"PostalCodes":null,"State":null,"WeatherLink":null},"Commission":2.0,"CreditCard":{"HasCvc":null,"IsActive":false,"IsGenerallyDisabled":false,"IsSelectedByHost":true},"CSSSelectors":[],"Currency":{"HasCustomSet":null,"IsConvertActive":false,"Set":null,"Standard":"1"},"Directory":"/hotel-papiliode/","EarliestArrival":null,"FieldtextGroup":"-1","GroupID":-1,"Guests":null,"InputFields":{"Billing":{"IsRequired":null,"IsVisible":null},"City":{"IsRequired":null,"IsVisible":null},"Company":{"IsRequired":null,"IsVisible":null},"Country":{"IsRequired":null,"IsVisible":null},"DateOfBirthAdults":null,"DateOfBirthChildren":null,"Fax":{"IsRequired":null,"IsVisible":null},"FirstName":{"IsRequired":true,"IsVisible":true},"GuestDataAdults":null,"GuestDataChildren":null,"Mail":{"IsRequired":true,"IsVisible":true},"Mobile":{"IsRequired":null,"IsVisible":null},"Name":{"IsRequired":true,"IsVisible":true},"Newsletter":{"IsRequired":null,"IsVisible":null},"PurposeOfTravel":{"IsRequired":null,"IsVisible":null},"Salutation":{"IsRequired":null,"IsVisible":null},"Street":{"IsRequired":null,"IsVisible":null},"Telephone":{"IsRequired":null,"IsVisible":null},"Title":{"IsRequired":null,"IsVisible":null},"ZIP":{"IsRequired":null,"IsVisible":null}},"Insurance":{"AgencyNumber":"False","Channel":null,"IsActive":false},"IsActive":true,"Language":{"Default":null,"HasChangeActive":false,"HasCustomSet":null,"Set":null},"Logo":null,"PartnerCode":null,"PartnerProgrammID":null,"Payment":null,"PopUp":{"IsActive":null},"PriceComparison":null,"Property_Token":"QnYZfn","Region":{"_id":0,"Name":null},"RoomLimit":5,"RoomList":{"OrderBy":null},"Settings":{"DomainsAllowed":["*.dirs21.de"],"Features":[],"HasAddOnsAccordion":null,"HasAffiliate":null,"HasAllGuestsObligatory":null,"HasAlternativeProperties":null,"HasArrivalTimeDropdown":null,"HasBookingConditions":null,"HasCallUsTextIfNoAvailability":null,"HasChargeableButton":null,"HasChildSelectDisabled":null,"HasCustomConfirmationField":null,"HasDataPrivacyRegulation":null,"HasGalleryInGrid":null,"HasGuaranteeFollowUp":null,"HasGuestNotesField":null,"HasGuestQuestions":null,"HasGuestQuestionsOpened":null,"HasHotelAddressFieldActive":false,"HasIBEAsRoomList":null,"HasLeadSourceField":null,"HasMapsLink":null,"HasPriceShownPerNight":null,"HasPromotionCodeVisible":false,"HasRateDescriptionVisible":null,"HasRatesOnlyInRoomGrid":null,"HasRecaptchaField":null,"HasSpecialClassification":false,"HotelierIBE":null,"IsABTestingActive":null,"IsFullAvailabilityVisible":null,"IsQuickbookCalendar":null},"Terms":null},"IsActive":true,"IsGroupSDK":false,"LoyaltyProgram":{"Channel":"","ConfirmationUrl":null,"HasAmazonLogin":false,"HasFacebookLogin":false,"HasGoogleLogin":false,"HasLoginByNumber":false,"HasRegistration":false,"IsActive":false},"Overlay":{"Delay":-1,"Description":"","HasPromotion":false,"IsActive":false},"Preselect":{"AdultCount":2,"DayOffset":0,"DefaultLOS":1,"DefaultOccupancy":"a,a","LOS":1,"MaxLOS":30,"MinLOS":1,"MinNumberOfAdults":1},"PromotionMessage":{"IsActive":false},"QuickBook":{"HasCities":false,"HasHorizontalOrientation":true,"HasMinPriceVisible":true,"HasNoHeadline":null,"HasPackageLink":false,"HasPriceText":false,"HasPromotionCodeVisible":null,"HasPropertyTypeSearch":false,"HasPurposeOfTravelField":false,"HasRadiusSearch":false,"HasRebookLink":false,"HasSearchByPropertyType":false,"IsActive":true,"IsExtended":false,"IsHidden":false,"PriceComparison":{"IsActive":false,"MaxShownPrices":5,"Type":""}},"Reference":{"Version":{"Key":null}},"ReservationIncentive":{"HasBestRateInformation":null,"HasLatestReservationCount":null,"HasLatestRoomReservationCount":null,"IsActive":false,"IsLastBookingTimeVisible":null,"Timespan":"2.00:00:00"},"Settings":{"HasChildrenSelectable":true,"HasOpenInNewTab":false},"ThirdPartyLibraries":{"HasGoogleFonts":true,"HasJQuery":true,"HasMoment":true,"HasHQuery":null},"Type":null,"VenueList":null,"Version":"1.1","ColorSchema":{"Primary":"#000","Secondary":"#000","Tertiary":"#000"},"PriceComparison":{"IsActive":false,"HasBookingLinkDisabled":false,"HasDateSelect":true,"MaxShownPrices":5},"WidgetUrl":"https://js-sdk.dirs21.de"}';var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); } return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); window["endsWith"] = function (text, searchString, position) { var subjectString = text.toString(); if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.indexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }; window["d21LogTime"] = function (key) { if (window["d21_time"]) { } }; var d21_sdk = (function () { function d21_sdk() { var _this = this; this.version = "1.1"; this.widgets = new d21_widgets(); this.handlers = new d21_handlers(); this.config = {}; this.host = null; this.translations = new d21_core_translations(); this.picADayConfig = { months: [], weekdays: [], weekdaysShort: [] }; this.isReady = false; this.scripts = { Pikaday: { then: function (s) { d21.handlers.localization.datePicker = _this.picADayConfig; d21.css(['https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.5.1/css/pikaday.min.css']); } }, io: { then: function (s) { d21_define('https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io', function (io) { d21.registerGlobally('io', io); }); } } }; this.validKeys = { d: false, two: false, one: false }; this.widgets_instances = new d21_widgets_instances(); this.registerGlobally = function (name, val) { document.body.onclick = function () { this; }; if (window[name] === undefined) { window[name] = val; if (_this.scripts[name] !== undefined && _this.scripts[name].then !== undefined) _this.scripts[name].then(); } }; } d21_sdk.prototype.init = function () { var _this = this; d21.config = JSON.parse(d21_config.replace(/[\t\n\r\f\v]/gmi, "")); d21.host = d21.config.WidgetUrl; if (d21.config.DisplayMode === "1" || d21.config.DisplayMode === "2") { if (d21.config.DisplayMode === "1") d21.config.DisplayMode = "ArrivalDeparture"; if (d21.config.DisplayMode === "2") d21.config.DisplayMode = "ArrivalLos"; } this.setKeyListening(); d21.config.Currency = "EUR"; if (!d21.config.IsGroupSDK) { d21.handlers.api.proxy({ url: "/tocc/host/info/" + d21.config.IBE.Property_Token, success: function (r) { if (r && r.length > 0) { d21.config.Property = r[0]; d21.config.Currency = d21.config.Property.Culture.Currency; } }, error: function () { console.log("ERROR"); } }); } this.configure(); this.require(['Vue', 'moment', 'd21.core.handlers', 'd21.helpers'], function (Vue, moment) { d21.registerGlobally("Vue", Vue); d21.registerGlobally("moment", moment); _this.handlers.translations.getTranslations(_this.translations, function () { _this.setPickADayConfig(); }); var quickbook = document.querySelector('#d21-widgets-quickbook'); var roomList = document.querySelector('#d21-roomList'); var hostSearch = document.querySelector('#d21-host-search'); var hostList = document.querySelector('#d21-hostDirectory'); var packageList = document.querySelector('#d21-packageList'); var availCalendarSmall = document.querySelectorAll('.d21-roomAvailability'); if (availCalendarSmall.length === 0) var availCalendarSmall = document.querySelectorAll('.d21-smallAvailabilityCalendar'); var availCalendarBig = document.querySelector('#d21-bigAvailabilityCalendar'); if (availCalendarBig === null) availCalendarBig = document.querySelector('#d21-bigAvailabilityCalendar'); if (quickbook) quickbook.id = 'd21-quickbook'; if (packageList) packageList.id = 'd21-widgets-packages'; if (availCalendarBig) availCalendarBig.id = "d21-widgets-calendar-big"; if (hostSearch) hostSearch.id = "d21-widgets-hosts-form"; if (hostList) hostList.id = "d21-widgets-hosts"; if (roomList) roomList.id = "d21-widgets-rooms"; [].forEach.call(availCalendarSmall, function (div) { div.className = "d21-widgets-calendar-small"; var divContainer = (document.createElement('div')); divContainer.className = "d21-widgets-calendar-small-view"; div.appendChild(divContainer); }); d21.conditionalWiget(d21.config.QuickBook && d21.config.QuickBook.IsActive, 'd21.quickbook', function (args) { _this.widgets_instances.quickbook = new d21_widgets_quickbook(args); }); d21.conditionalWiget(d21.config.PackageList && d21.config.PackageList.IsActive, 'd21.widgets.packages', function (args) { _this.widgets_instances.packages = new d21_widgets_packages(args); }); d21.conditionalWiget(d21.config.RoomList && d21.config.RoomList.IsActive, 'd21.widgets.rooms', function (args) { _this.widgets_instances.rooms = new d21_widgets_rooms(args); }); d21.conditionalWiget(d21.config.VenueList && d21.config.VenueList.IsActive, 'd21.widgets.venues', function (args) { _this.widgets_instances.venues = new d21_widgets_venues(args); }); d21.conditionalWiget(d21.config.HostDirectory && d21.config.HostDirectory.IsActive, 'd21.widgets.hosts', function (args) { _this.widgets_instances.hosts = new d21_widgets_hosts(args); }); d21.conditionalWiget(d21.config.HostDirectory && d21.config.HostDirectory.IsActive, 'd21.widgets.hosts.form', function (args) { _this.widgets_instances.hosts_form = new d21_widgets_hosts_form(args); }); d21.conditionalWiget(d21.config.IBE && d21.config.IBE.IsActive, 'd21.widgets.ibe', function (args) { _this.widgets_instances.ibe = new d21_widgets_ibe(); }, false); d21.conditionalWiget(d21.config.CustomStyle && d21.config.CustomStyle.IsActive, 'd21.widgets.custom.style', function (args) { _this.widgets_instances.custom_style = new d21_widgets_custom_style(); }, false); d21.conditionalWiget(d21.config.GoogleAnalytics && d21.config.GoogleAnalytics.IsActive, 'd21.widgets.google.analytics', function () { _this.widgets_instances.google_analytics = new d21_widgets_google_analytics(); }, false); d21.conditionalWiget(d21.config.IIQ && d21.config.IIQ.IsActive, 'd21.widgets.iiq', function (args) { _this.widgets_instances.iiq = new d21_widgets_iiq(); }); d21.conditionalWiget(d21.config.AvailCalendar && d21.config.AvailCalendar.IsActive, 'd21.widgets.calendar.big', function (args) { _this.widgets_instances.calendar_big = new d21_widgets_calendar_big(args); }); d21.conditionalWiget(d21.config.AvailCalendar && d21.config.AvailCalendar.IsActive, 'd21.widgets.calendar.small', function (args, uuid) { _this.widgets_instances.calendar_small = new d21_widgets_calendar_small(args, uuid); }, true, true); d21.conditionalWiget(d21.config.Overlay && d21.config.Overlay.IsActive, 'd21.widgets.promotion', function (args, uuid) { _this.widgets_instances.promotion = new d21_widgets_promotion(args); }, false); d21.conditionalWiget(true, 'd21.widgets.contact.form', function (args) { var instance = new d21_widgets_contact_form(); }); d21.conditionalWiget(true, 'd21.widgets.yield', function () { var instance = new d21_widgets_yield(); }); d21.conditionalWiget(true, 'd21.widgets.cockpit', function (args) { _this.widgets_instances.cockpit = new d21_widgets_cockpit(); }, false); d21.conditionalWiget(true, 'd21.widgets.login', function (args) { _this.widgets_instances.login = new d21_widgets_login(args); }, false); d21.conditionalWiget(true, 'd21.widgets.metasearch', function (args) { _this.widgets_instances.metasearch = new d21_widgets_metasearch(args); }, false); d21.conditionalWiget(true, 'd21.widgets.availability.comparer', function () { var instance = new d21_widgets_availability_comparer(); }); _this.hasChat = window["hasChat"] || d21.config.IBE.Directory === "/hotel-lexample/"; if (_this.hasChat) { var chatContainer = document.createElement('div'); chatContainer.id = "d21-widgets-chat"; document.body.appendChild(chatContainer); d21.conditionalWiget(true, 'd21.widgets.chat', function (args) { _this.widgets_instances.chat = new d21_widgets_chat(args); }); } window["d21LogTime"]("d21_widgets_core_started"); }); }; d21_sdk.prototype.setPickADayConfig = function () { var _this = this; this.picADayConfig.months = [ this.translations.january, this.translations.february, this.translations.march, this.translations.april, this.translations.may, this.translations.june, this.translations.july, this.translations.august, this.translations.september, this.translations.october, this.translations.november, this.translations.december ]; this.picADayConfig.weekdays = [ this.translations.sunday, this.translations.monday, this.translations.tuesday, this.translations.wednesday, this.translations.thursday, this.translations.friday, this.translations.saturday ]; var list = [ this.translations.sunday, this.translations.monday, this.translations.tuesday, this.translations.wednesday, this.translations.thursday, this.translations.friday, this.translations.saturday ]; list.forEach(function (weekday) { _this.picADayConfig.weekdaysShort.push(d21_helpers.substring(weekday, 0, 2)); }); }; d21_sdk.prototype.setKeyListening = function () { var self = this; window.addEventListener('keydown', function (e) { if (e.keyCode == 68) { self.validKeys.d = true; } if (e.keyCode == 50) { self.validKeys.two = true; } if (e.keyCode == 49) { self.validKeys.one = true; } }); window.addEventListener('keyup', function (e) { if (self.validKeys.d && self.validKeys.one && self.validKeys.two) { window["d21_api"].cockpit.open("widgets", null, { _id: d21.config._id }); } if (e.keyCode == 68) { self.validKeys.d = false; } if (e.keyCode == 50) { self.validKeys.two = false; } if (e.keyCode == 49) { self.validKeys.one = false; } }); }; d21_sdk.prototype.configure = function () { d21_requirejs.config({ waitSeconds: 10, paths: { moment: d21.host + '/Scripts/1.1/libraries/moment.min', Vue: d21.host + '/Scripts/1.1/libraries/vue.min', Pikaday: d21.host + '/Scripts/1.1/libraries/pikaday.min', io: d21.host + '/Scripts/1.1/libraries/socket.io.min' } }); var load = d21_requirejs.load; d21_requirejs.load = function (context, moduleId, url) { if (url.indexOf("js-sdk.dirs21") !== -1) { url += (url.indexOf('?') === -1 ? '?' : '&') + d21.getAppVersion(); } return load(context, moduleId, url); }; }; d21_sdk.prototype.conditionalWiget = function (isActive, id, done, renderable, isMultiWidget) { renderable = renderable == undefined ? true : renderable; isMultiWidget = isMultiWidget == undefined ? false : renderable; var selector = isMultiWidget ? '.' : '#'; selector += id.replace(/\./g, '-'); var args = { id: id, selector: selector }; if (isActive) { if (renderable) { d21.waitFor(args.selector, function (elem) { args.container = isMultiWidget ? elem : [elem[0]]; [].forEach.call(args.container, function (container) { var guid = 'd21-' + d21.handlers.utils.getGuid(); var tagArgs; var getAttributes = function () { tagArgs = container.getAttribute('data-d21'); if (tagArgs === null) tagArgs = container.getAttribute('d21-data'); var classes = args.id + " " + guid; if (container.getAttribute('class')) classes += " " + container.getAttribute('class'); container.setAttribute('class', classes.replace(/\./gmi, "-")); if (tagArgs !== undefined && tagArgs != null && tagArgs !== '') { tagArgs = JSON.parse(tagArgs.split('\'').join('"')); } }; getAttributes(); args.attr = {}; if (tagArgs) { Object.keys(tagArgs).forEach(function (key) { args.attr[key] = tagArgs[key]; }); } d21.widgets.loadTotal(args, function (arg) { done(arg, guid); }); }); }); } else { d21.widgets.loadScript(args, function () { done(null); }); } } }; d21_sdk.prototype.css = function (hrefs, cb) { hrefs.forEach(function (u) { var href = u.indexOf('d21.') !== -1 ? (d21.host + '/Styles/' + u + '.css' + '?' + d21.getAppVersion()) : u; var link = document.createElement('link'); link.href = href; link.type = 'text/css'; link.rel = 'stylesheet'; link.media = 'screen, print'; document.getElementsByTagName("head")[0].appendChild(link); }); if (cb !== undefined) cb(); }; d21_sdk.prototype.P = function (price) { return price ? price.toFixed(2) + ' ' + d21.getCurrencySymbol(d21.config.Currency) : null; }; d21_sdk.prototype.getCurrencySymbol = function (currencyCode) { var result; switch (currencyCode) { case "GBP": result = "£"; break; case "JPY": result = "¥"; break; case "CNY": result = "¥"; break; case "EUR": result = "€"; break; case "USD": result = "$"; break; case "NOK": result = "Kr"; break; case "CHF": result = "Fr"; break; default: result = currencyCode; } return result; }; d21_sdk.prototype.getAppVersion = function () { return "v=" + (window.location.host.indexOf(".local") >= 0 ? Math.random().toString() : d21_app_version); }; d21_sdk.prototype.require = function (keys, cb) { var self = this; var requiredUrls = []; keys.forEach(function (key) { if (key.indexOf('d21.') !== -1) { var additionalDirectory = ""; if (key.indexOf('d21.scheduler') !== -1) additionalDirectory = "scheduler/"; requiredUrls.push(d21.host + '/Scripts/1.1/' + additionalDirectory + key + '.js'); } else { requiredUrls.push(key); } }); d21_requirejs(requiredUrls, function () { var validArguements = []; for (var i = 0; i < arguments.length; i++) { if (arguments[i] !== null) validArguements.push(arguments[i]); } for (var i = 0; i < validArguements.length; i++) { var key = keys[i]; window[key] = validArguements[i]; if (self.scripts[key] !== undefined && self.scripts[key].then !== undefined) { self.scripts[key].then(); } var isWidget = validArguements[i] !== undefined && validArguements[i].id !== undefined && validArguements[i].id.indexOf('d21.widgets.') !== -1; if (isWidget) cb(validArguements[i]); else if (!isWidget && i === validArguements.length - 1) cb(validArguements[i]); } }); }; d21_sdk.prototype.allParentsVisible = function (elem) { if (elem.parentElement && elem.parentElement.style.display === "none") { return false; } else if (elem.parentElement) { return this.allParentsVisible(elem.parentElement); } return true; }; d21_sdk.prototype.waitFor = function (selector, cb) { var _this = this; var counter = 200, waitHandler = window.setInterval(function () { var elem = document.querySelectorAll(selector); if (elem.length > 0 && _this.allParentsVisible(elem[0])) { window.clearInterval(waitHandler); cb(elem); } else if (counter === 0) { window.clearInterval(waitHandler); } counter--; }, 20); }; d21_sdk.prototype.validateFields = function (fields) { var allValid = true; Object.keys(fields).forEach(function (key) { var field = fields[key]; if (field.isRequired) { switch (field.type) { case d21_fieldTypes.text: field.isValid = field.value !== "" && field.value !== null && field.value !== "-1"; break; case d21_fieldTypes.email: var pattern = /^[\w\.]+@\w+?\.[a-zA-Z]{2,3}$/; field.isValid = pattern.test(field.value); break; case d21_fieldTypes.number: var pattern = /^[0-9, /, ]*$/; field.isValid = pattern.test(field.value); break; default: field.isValid = true; break; } } else { field.isValid = true; } allValid = allValid && field.isValid; }); return allValid; }; d21_sdk.prototype.resolveProperty = function (token, cb) { this.handlers.api.proxy({ url: "/tocc/search/new/aggregate/View.HostInfo.Summary/de-DE?$filter=_aid eq " }); }; d21_sdk.prototype.bindWidget = function (widget) { new Vue({ el: widget.el, data: widget.data, methods: widget.methods, computed: widget.computed, beforeCreate: function () { widget.beforeCreate(this); }, created: function () { widget.created(this); }, beforeMount: function () { widget.beforeMount(this); }, mounted: function () { widget.mounted(this); }, beforeUpdate: function () { widget.beforeUpdate(this); }, updated: function () { widget.updated(this); }, beforeDestroy: function () { widget.beforeDestroy(this); }, destroyed: function () { widget.destroyed(this); } }); }; d21_sdk.prototype.getPath = function (fileName) { return this.host + '/Scripts/1.1/' + fileName + ".js"; }; return d21_sdk; }()); var d21_widgets_instances = (function () { function d21_widgets_instances() { this.quickbook = null; this.packages = null; this.google_analytics = null; this.rooms = null; this.hosts = null; this.hosts_form = null; this.calendar_small = null; this.calendar_big = null; this.ibe = null; this.iiq = null; this.contact_form = null; this.yield = null; this.custom_style = null; this.cockpit = null; this.login = null; this.metasearch = null; this.promotion = null; this.chat = null; this.venues = null; } return d21_widgets_instances; }()); var d21_handlers_api = (function () { function d21_handlers_api() { } d21_handlers_api.prototype.proxy = function (opts) { var proxyOpts = { url: d21.host + opts.url, async: opts.async, method: opts.method, data: opts.data, contentType: opts.contentType, success: function (response) { if (response === null) return; var obj = JSON.parse(response); if (opts.raw !== undefined) opts.raw(obj); else if (!obj.Meta) { opts.success(obj); } else if (obj.Meta && obj.Meta.IsValid && opts.success !== undefined) opts.success(obj.Value); else if (!obj.Meta.IsValid && opts.invalid !== undefined) opts.invalid(obj.Meta); else if (!obj.Meta.IsValid) console.error('Invalid response ' + opts.url, obj); }, error: opts.error }; this.request(proxyOpts); }; d21_handlers_api.prototype.request = function (opts) { opts.method = typeof opts.method !== 'undefined' ? opts.method : 'GET'; opts.async = typeof opts.async !== 'undefined' ? opts.async : true; var xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttpRequest"), onError = function () { if (opts.error) { opts.error(xhr.statusText); } console.error(xhr.statusText); }; xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status === 200) { opts.success(xhr.responseText); } else { onError(); } } }; xhr.onerror = function (e) { onError(); }; var setHeaders = function () { if (opts.headers) { Object.keys(opts.headers).forEach(function (key) { xhr.setRequestHeader(key, opts.headers[key]); }); } }; if (opts.method === 'POST') { xhr.open(opts.method, opts.url, opts.async); if (opts.contentType) xhr.setRequestHeader("Content-Type", opts.contentType); setHeaders(); xhr.send(opts.data); } else { xhr.open(opts.method, opts.url, opts.async); setHeaders(); xhr.send(null); } }; d21_handlers_api.prototype.packageMeta = function (id, cb) { this.proxy({ url: "/tocc/search/new/View.Package.Summary/de-DE/hotel-zum-test/?oDataQuery=$filter=_LegacyId li '" + id + "'", success: function (r) { var returnValue = null; var result = r && r.length > 0 ? r[0] : null; if (result) { var firstPeriode = result.Periods[0]; result.Periods.forEach(function (period) { if (moment(period.From).isBefore(firstPeriode.From)) firstPeriode = period; }); if (moment(firstPeriode.From).isBefore(moment())) firstPeriode.From = moment().format("YYYY-MM-DD"); delete firstPeriode.Rooms; returnValue = { MinLOS: result.Duration.MinLOS ? result.Duration.MinLOS : 1, MaxLOS: result.Duration.MaxLOS, DefaultOccupancy: result.DefaultOccupancy ? result.DefaultOccupancy : (result.Duration.MinLOS ? result.Duration.MinLOS : 1), MinOccupancy: result.MinOccupancy ? result.MinOccupancy : 1, MaxOccupancy: result.MaxOccupancy, firstPeriode: firstPeriode }; } if (cb) cb(returnValue); } }); }; d21_handlers_api.prototype.roomMeta = function (id, cb) { this.proxy({ url: "/tocc/search/new/View.Room.Summary/de-DE/hotel-zum-test/?oDataQuery=$filter=_LegacyId li '" + id + "'", success: function (r) { var returnValue = null; var result = r && r.length > 0 ? r[0] : null; if (result) { returnValue = { MinLOS: result.Restrictions.MinNights, MaxLOS: result.Restrictions.MaxNights, DefaultOccupancy: result.Restrictions.DefaultOccupancy, MinOccupancy: result.Restrictions.MinOccupancy, MaxOccupancy: result.Restrictions.MaxOccupancy }; } if (cb) cb(returnValue); } }); }; return d21_handlers_api; }()); var d21_handlers = (function () { function d21_handlers() { this.api = new d21_handlers_api(); this.utils = null; this.ui = null; this.socket = null; this.hub = null; this.ibe = null; this.translations = null; this.localization = null; this.component = null; this.storage = null; this.events = null; } return d21_handlers; }()); var d21_widgets = (function () { function d21_widgets() { var _this = this; this.widgets = {}; this.register = function (manifest) { var parts = manifest.id.split('.'); _this.widgets[parts[2]] = manifest.constructor; }; } d21_widgets.prototype.new = function (id) { var parts = id.split('.'); return new this.widgets[parts[2]](); }; d21_widgets.prototype.loadTotal = function (args, done) { var self = this; var orientation = ""; var attr = JSON.parse(JSON.stringify(args.attr)); if (attr["hasHorizontalOrientation"] !== undefined) orientation = "&hasHorizontalOrientation=" + attr["hasHorizontalOrientation"]; this.loadView(args.id, orientation, function (template) { var fn = function (elem) { var appendTo = function (container) { var div = document.createElement('div'); div.id = args.id.split('.').join('-') + '-view'; div.innerHTML = template; div.classList.add("d21-widgets-view"); div.style.display = 'none'; container.innerHTML = ""; container.appendChild(div); }; if (elem.length > 0) { if (elem.length === 1) { var container = elem[0]; appendTo(container); } else { [].forEach.call(elem, function (container) { appendTo(container); }); } } self.loadScript(args, function () { done(attr); }); }; if (args.container !== undefined && args.container !== null) { fn(args.container); } else { d21.waitFor(args.selector, fn); } }); }; d21_widgets.prototype.loadView = function (id, orientation, onDone) { d21.handlers.api.request({ method: 'POST', data: JSON.stringify(d21.config), url: d21.host + '/template/widget/' + id + '?culture=' + d21.handlers.localization.getCulture() + "&" + d21.getAppVersion() + orientation, success: function (template) { onDone(template); } }); }; d21_widgets.prototype.loadScript = function (args, done) { if (!args) return; d21.require([args.id], function (manifest) { if (manifest && manifest.css) d21.css(manifest.css); done(); }); }; return d21_widgets; }()); var d21 = null; var scriptTagId = "d21-script-requirejs"; var d21_define = null; var d21_requirejs = null; if (!window["d21_sdk_ready"]) { window["d21_sdk_ready"] = true; window.setTimeout(function () { var d21_dependency_interval = window.setInterval(function () { if (!document.body) return; var requireJSOriginalExisting = window['requirejs'] !== undefined; var requireJSD21CustomExisting = window['_requirejs'] !== undefined; if (requireJSOriginalExisting || requireJSD21CustomExisting) { d21_define = requireJSOriginalExisting ? window['define'] : window['_define']; d21_requirejs = requireJSOriginalExisting ? window['requirejs'] : window['_requirejs']; window.clearInterval(d21_dependency_interval); d21 = new d21_sdk(); d21.init(); d21.css(["core/d21.core.base"]); window["d21_api"] = { track: { event: function (category, label, action, value) { } }, ibe: { open: function (data) { if (data) { if (data.arrival && data.departure) { if (d21_moment(data.departure).isBefore(data.arrival)) { var temp = data.arrival; data.arrival = data.departure; data.departure = temp; } } } if (d21.widgets_instances.ibe) d21.widgets_instances.ibe.open(data); }, rebindIbeTrigger: function () { if (d21.widgets_instances.ibe) d21.widgets_instances.ibe.setIbeTrigerHandler(); } }, quickBook: { render: function () { d21.conditionalWiget(d21.config.QuickBook && d21.config.QuickBook.IsActive, 'd21.quickbook', function (args) { var instance = new d21_widgets_quickbook(args); }); } }, packageList: { render: function () { d21.conditionalWiget(d21.config.PackageList && d21.config.PackageList.IsActive, 'd21.widgets.packages', function (args) { var instance = new d21_widgets_packages(args); }); } }, roomList: { render: function () { d21.conditionalWiget(d21.config.RoomList && d21.config.RoomList.IsActive, 'd21.widgets.rooms', function (args) { var instance = new d21_widgets_rooms(args); }); } }, roomAvailCalendar: { render: function () { d21.conditionalWiget(d21.config.AvailCalendar && d21.config.AvailCalendar.IsActive, 'd21.widgets.calendar.big', function (args) { var instance = new d21_widgets_calendar_big(args); }); d21.conditionalWiget(d21.config.AvailCalendar && d21.config.AvailCalendar.IsActive, 'd21.widgets.calendar.small', function (args, uuid) { var instance = new d21_widgets_calendar_small(args, uuid); }, true, true); } }, hostDirectory: { render: function () { d21.conditionalWiget(d21.config.HostDirectory && d21.config.HostDirectory.IsActive, 'd21.widgets.hosts', function (args) { var instance = new d21_widgets_hosts(args); }); d21.conditionalWiget(d21.config.HostDirectory && d21.config.HostDirectory.IsActive, 'd21.widgets.hosts.form', function (args) { var instance = new d21_widgets_hosts_form(args); }); } }, cockpit: { open: function (mode, path, args) { d21.widgets_instances.cockpit.open(mode, path, args); }, close: function () { d21.widgets_instances.cockpit.close(); } } }; } else if (document.getElementById(scriptTagId) === null) { var tagRequireJs = document.createElement('script'); tagRequireJs.id = scriptTagId; tagRequireJs.src = d21_widget_url + '/Scripts/1.1/libraries/require.min.js'; document.head.appendChild(tagRequireJs); } }, 100); }, 200); } var d21_core_translations = (function () { function d21_core_translations() { this.invalid_date_range = null; this.monday = null; this.tuesday = null; this.wednesday = null; this.thursday = null; this.friday = null; this.saturday = null; this.sunday = null; this.january = null; this.february = null; this.march = null; this.april = null; this.may = null; this.june = null; this.july = null; this.august = null; this.september = null; this.october = null; this.november = null; this.december = null; } return d21_core_translations; }()); var vueExtensions = (function () { function vueExtensions() { } return vueExtensions; }()); var baseVueView = (function (_super) { __extends(baseVueView, _super); function baseVueView() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = { isActive: false }; _this.methods = {}; _this.computed = {}; _this.beforeCreate = function (ref) { }; _this.created = function (ref) { }; _this.beforeMount = function (ref) { }; _this.mounted = function (ref) { }; _this.beforeUpdate = function (ref) { }; _this.updated = function (ref) { }; _this.beforeDestroy = function (ref) { }; _this.destroyed = function (ref) { }; return _this; } return baseVueView; }(vueExtensions)); var baseDataImpl = (function () { function baseDataImpl() { this.isActive = false; } ; return baseDataImpl; }());