const SELFBOOK_BASE_URL="https://sdk.selfbook.com",SELFBOOK_BASE_URL_V3="https://sdk-v3.selfbook.com";let SELFBOOK_BACKEND_URL="https://api.selfbook.com/api/v2",SELFBOOK_APP_VERSION="v2",SELFBOOK_APP_BASE_URL=SELFBOOK_BASE_URL;const SELFBOOK_SCRIPT_ID="selfbook_jssdk",SELFBOOK_HOTEL_ID_PROP="hotelId",SELFBOOK_API_KEY_PROP="apiKey",SELFBOOK_WIDGET_ELEMENT_ID="selfbook_sdkwidget",SELFBOOK_WIDGET_WRAPPER_ELEMENT_ID="selfbook_sdkwidget_wrapper",SELFBOOK_WIDGET_LOADING_ELEMENT="selfbook-loading",SELFBOOK_WIDGET_RESUME="selfbook-sdkwidget-resume",SELFBOOK_WIDGET_RESUME_TEXT="selfbook-sdkwidget-resume-text",BOOTSTRAP_ACTION="WIDGET/BOOTSTRAP",SELFBOOK_HOTEL_GROUP_INFO="selfbook_hotel_group_info",BLACK_SQUARE_THEME_HOTELS=["6739"],THE_LINE_HOTELS=["68711","71661","2427"],COMPLETE_BOOKING_BTN_CLICK="Complete your reservation button click",ROUTE_PATHS={app:{confirmation:"/confirmation",wallet:"/wallet",account:"/account",settings:"/settings",reservations:"/reservations",reservationDetail:"/reservation-detail",editBooking:"/edit-booking",bookingConfirmed:"/booking-confirmed"}},INITIAL_PERSISTED_DATA={isExpired:!0,all:null,booking:null,core:null,router:null},GUEST_TYPE={ADULT:"adult",CHILD:"child",INFANT:"infants"};let initialV35AvailabilityStartEndDates={},initialCalendarResponse=null;function initSDKBus(){const t={},e={};window.sb_sdkBus={emit(n,o){e[n]||(e[n]=[]),e[n].push(o),t[n]?.length&&t[n].forEach(t=>t(o))},on(e,n){t[e]||(t[e]=[]),t[e].push(n)},off(e,n){t[e]&&(t[e]=t[e].filter(t=>t!==n))},pull(t){const n=e[t]||[];return e[t]=[],n}}}function checkStatus(t){if(t.status>=200&&t.status<300)return t;const e=new Error(t.statusText);throw e.response=t,e}async function parseJSON(t){try{const e=await t.text();if(!e)return;return JSON.parse(e)}catch(t){console.error("parseJSON: err: ",t)}}function intervalWrapper(t,e){const n=setInterval(t,e);return function(){clearInterval(n)}}function getHotelBasicData(t,e){try{const n=getFromLocalStorage(t,SELFBOOK_HOTEL_GROUP_INFO).hotels?.filter(t=>t.id==e),o=n?.[0]||{};return getIsEnableV35(o)&&(o.app_version="v3",o.enable_v3_new_ui_version=!0),o}catch(t){return console.error("getHotelBasicData: err: ",t),{}}}function getFromLocalStorage(t,e){try{return JSON.parse(t.getItem(e))}catch(t){return console.error("getFromLocalStorage: err: ",{e:t}),{}}}function getPersistedData(t){try{const e=JSON.parse(t.getItem("persist:root"));if(!e)return INITIAL_PERSISTED_DATA;const n=JSON.parse(e.booking||"{}"),o=JSON.parse(e.core||"{}"),a=JSON.parse(e?.router||"{}"),{expireTime:r}=o,s=(Date.now()-new Date(o.interactionTime))/1e3;return{isExpired:s>r,all:e,booking:n,core:o,router:a}}catch(t){return console.error("getPersistedData: err: ",t),INITIAL_PERSISTED_DATA}}function fillGuestsFields(t=[],e){const n=e.default_adult_occupancy?e.default_adult_occupancy:2;return t?.map(t=>t.type===GUEST_TYPE.ADULT?{type:GUEST_TYPE.ADULT,count:parseInt(t.count)||n}:t.type===GUEST_TYPE.CHILD&&parseInt(t.count)>0?{type:GUEST_TYPE.CHILD,count:parseInt(t.count),age:parseInt(t.age)||1,special_request:t.special_request||""}:t.type===GUEST_TYPE.INFANT&&parseInt(t.count)>0?{type:GUEST_TYPE.INFANT,count:parseInt(t.count)||1,age:parseInt(t.age)||1,special_request:t.special_request||""}:void 0).filter(Boolean)}function buildRoomsGuests(t,e){const n=e.default_adult_occupancy?e.default_adult_occupancy:2,o=()=>Math.random().toString(36).slice(2),a=["adult","child","childAges","room2Adult","room3Adult","room4Adult"].some(e=>!!t[e]);if(t.guests?.length&&!a)return Array.from({length:4},(e,a)=>{const r=0===a?"guests":`guestsRoom${a+1}`;if(!t[r])return null;const s=t[r]?.map(t=>{const e=t?.type===GUEST_TYPE.ADULT?t?.count||n:t?.count,a=t?.type===GUEST_TYPE.CHILD&&"number"==typeof t?.age;return{type:t?.type,count:Number(e),guest_details:a?[{key:o(),age:Number(t?.age)}]:void 0}});return{key:0===a?"room1":o(),data:s}}).filter(Boolean);const r=e=>Number(t[e]||0),[s,i,l,d]=["roomCount","adult","child","infants"].map(r);if(s>1&&!r("room2Adult")){const t=i||n,e=Math.floor(t/s);let a=t%s;return Array.from({length:s},(t,n)=>{const r=a>=n+1?1:0;return{key:0===n?"room1":o(),data:[{type:GUEST_TYPE.ADULT,count:e+r}]}})}const c=[];return Array.from({length:4}).forEach((e,a)=>{const s=a+1,u=0===a?i||n:r(`room${s}Adult`);if(u){const e=[{type:GUEST_TYPE.ADULT,count:u}],n=0===a?l:r(`room${s}Child`),i=t[0===a?"childAges":`room${s}ChildAges`];i?i.split(",").forEach(t=>{e.push({type:GUEST_TYPE.CHILD,count:1,guest_details:[{key:o(),age:Number(t)}]})}):n&&e.push({type:GUEST_TYPE.CHILD,count:n}),0===a&&d>0&&e.push({type:GUEST_TYPE.INFANT,count:d}),c.push({key:0===a?"room1":o(),data:e})}}),c}function buildRedirectSynxisLink(t,e){let n=`https://be.synxis.com/?hotel=${e.id}&theme=${e.synxis_theme}&config=${e.synxis_config}`;try{if(t){const{startDate:e,endDate:o,promoCode:a,groupCode:r,guests:s,iataNumber:i,couponCode:l,destinationId:d,nights:c,rate:u,hotelId:p,roomCategory:m}=t;c&&(n+=`&nights=${c}`),e&&(n+=`&arrive=${e}`),o&&(n+=`&depart=${o}`),a&&(n+=`&promo=${a}`),r&&(n+=`&group=${r}`),i&&(n+=`&iataNumber=${i}`),l&&(n+=`&couponCode=${l}`),u&&(n+=`&rate=${u}`),d&&(n+=`&destinationId=${d}`),Array.isArray(m)?n+=`&roomCategory=${m.map(t=>t).join(",")}`:m&&(n+=`&roomCategory=${m}`),s&&s.length>0?("adult"===s[0].type&&(n+=`&adult=${s[0].count}`),s[1]&&"child"===s[1].type&&(n+=`&child=${s[1].count}`)):n+="&adult=1"}}catch(t){console.error("buildRedirectSynxisLink: err: ",t)}return n}function selectShowWidgetButtonCopies(t){return t.core.showWidgetButtonCopies||{}}function selectRoute(t){return t?.router?.location?t.router.location.pathname:ROUTE_PATHS.app.editBooking}function isObjectEqual(t,e){return JSON.stringify(t)===JSON.stringify(e)}function isTemplateDomainMatch(t,e){return t?.booking_template_domain&&e?.target?.href?.includes(t.booking_template_domain)}function getElementById(t){return document?.getElementById(t)}function getIsEnableV35(t){return"v3.5"===SELFBOOK_APP_VERSION||(SELFBOOK_APP_VERSION.match(/^v3/i)&&t?.enable_v3_new_ui_version||!1)}function runDirectApplication(){console.info("(!) selfbook: widget initialization started");let t,e,n,o,a,r=!1,s=!1,i=!1,l=!1,d=!1;async function c({url:t,method:e,data:n,headers:o}){try{const a=await fetch(t,{method:e,body:n,headers:o});checkStatus(a);return await parseJSON(a)}catch(t){console.error("There was a problem with the fetch operation:",t)}}function u(){try{const t=n||{},e=o||ROUTE_PATHS.app.editBooking;n=selectShowWidgetButtonCopies(window.selfbookWidgetStore.getState()),o=selectRoute(window.selfbookWidgetStore.getState());const a=getElementById(SELFBOOK_WIDGET_RESUME_TEXT);let r=t.COMPLETE_BOOKING;isObjectEqual(t,n)&&o===e||(r=o===ROUTE_PATHS.app.reservations?n.VIEW_RESERVATIONS:o===ROUTE_PATHS.app.confirmation||o===ROUTE_PATHS.app.reservationDetail?n.VIEW_RESERVATION:o===ROUTE_PATHS.app.account?n.VIEW_ACCOUNT:o===ROUTE_PATHS.app.wallet?n.VIEW_WALLET:o===ROUTE_PATHS.app.bookingConfirmed?n.RETURN_BOOKING:n.COMPLETE_BOOKING,a&&(a.innerHTML=r))}catch(t){console.error("handleStoreChange: err: ",t)}}function p(){return THE_LINE_HOTELS.includes(t)?"Lydian BT":"Main"}function m(e){const n=e?.colors||{},o=`\n position: fixed;\n overflow: hidden;\n cursor: pointer;\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n width: 217px;\n height: 46px;\n box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.25), 0px 4px 4px rgba(0, 0, 0, 0.1);\n right: 30px;\n z-index: 100000000000;\n bottom: 40px;\n font-family: ${p()}!important;\n font-size: 14px;\n line-height: 142%;\n letter-spacing: 0.02em;\n text-transform: capitalize!important;\n border: none;\n transform: translateX(300px);\n `,a="\n background: #343A40;\n color: #FFFFFF;\n ",r=`\n ${a}\n border-radius: 23px;\n `,s=`\n background: ${n.primary_color||n.primary};\n color: ${n.secondary_color||n.secondary}!important;\n `;return i=e?.id||t,BLACK_SQUARE_THEME_HOTELS.includes(i)?`${o}${a}`:n.primary_color&&n.secondary_color||n.primary&&n.secondary?`${o}${s}`:`${o}${r}`;var i}function y(t){const e=document.createElement("style");e.textContent=t,document.head.append(e)}function _(n,o,r){if(!a)return;getIsEnableV35(o)&&(n.hotelId=n?.hotelId||o?.id),y(`#${SELFBOOK_WIDGET_RESUME} {\n ${m(o)}\n }`),document.body.style.overflow="hidden";const s=getElementById("selfbook_sdkwidget"),l=getElementById("selfbook_sdkwidget_wrapper"),d=getElementById(SELFBOOK_WIDGET_RESUME),c=d?d.getAttribute("class"):null;c&&c.includes("dismiss-btn")&&(d.removeAttribute("class"),d.setAttribute("class","dismiss-btn-slide-out")),window.selfbookWidgetStore||(l.appendChild(function(){const t=document.createElement("div");return t.id="selfbook-loading",t.style.color="white",t.style.marginRight="-50%",t.style.position="absolute",t.style.top="50%",t.style.left="50%",t.style.fontFamily="sans-serif",t.style.transform="translate(-50%, -50%)",t.innerHTML='
',t}()),l.style.zIndex=1e11,l.style.height="100%",l.style.background="v2"===SELFBOOK_APP_VERSION?"rgba(0, 0, 0, .74)":"rgba(39, 39, 39, 0.74)",document.body.style.overflow="hidden"),function(){if(!0===i)return;a&&a.length>0&&a.forEach(t=>{if(t.includes(".js")){const e=document.createElement("script");e.type="text/javascript",e.src=`${SELFBOOK_APP_BASE_URL}/${t}`,document.body.appendChild(e)}});(function(){try{const t=document.createElement("script");t.innerHTML='\n !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","identify","reset","group","track","ready","alias","debug","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e{if(window.selfbookWidgetStore){window.selfbookWidgetStore.subscribe(u);!function(){const t=document.getElementById("selfbook-loading");t&&getElementById("selfbook_sdkwidget_wrapper").removeChild(t)}(),clearInterval(p),window.selfbookWidgetStore.dispatch({type:BOOTSTRAP_ACTION,payload:{hotelInfo:{apiKey:n.apiKey||e,hotelId:n.hotelId||t,hotelIdAsArg:!!n.hotelId},bookingData:{...r&&"v2"!==n.version&&(!n.startDate||!n.nights)&&initialV35AvailabilityStartEndDates,...n},hotelGroupInfo:getFromLocalStorage(localStorage,SELFBOOK_HOTEL_GROUP_INFO),roomsGuests:n.roomsGuests||void 0,shouldExecuteRegularFlow:r,version:n.version}}),"none"===s.style.display&&(l.style.zIndex=1e11,l.style.height="100%",l.style.background="v2"===SELFBOOK_APP_VERSION?"rgba(0, 0, 0, .74)":"rgba(39, 39, 39, 0.74)",document.body.style.overflow="hidden"),setTimeout(()=>{s.style.display="block",s.setAttribute("class","slide-in")},20),setTimeout(()=>{const t=l.querySelector('[aria-modal="true"]');t&&t.focus()},250),function(){const t=getElementById("selfbook_sdkwidget"),e=getElementById("selfbook_sdkwidget_wrapper"),n=getElementById(SELFBOOK_WIDGET_RESUME);n.addEventListener("click",o=>{try{if(n){const o=n?n.getAttribute("class"):null;o&&o.includes("dismiss-btn")&&(n.removeAttribute("class"),n.setAttribute("class","dismiss-btn-slide-out")),document.body.style.overflow="hidden",e.style.zIndex=1e11,e.style.height="100%",e.style.background="v2"===SELFBOOK_APP_VERSION?"rgba(0, 0, 0, .74)":"rgba(39, 39, 39, 0.74)",t.style.display="block",t.setAttribute("class","slide-in"),window.selfbookWidgetStore.dispatch({type:"ANALYTICS/TRACK_EVENT",payload:{eventType:COMPLETE_BOOKING_BTN_CLICK,eventPayload:null}}),setTimeout(()=>{const t=e.querySelector('[aria-modal="true"]');t&&t.focus()},500)}}catch(t){console.error("handleWidgetCloseListeneres: err: ",t)}})}()}},100)}function g(){try{const{isExpired:t,core:e,booking:n}=getPersistedData(localStorage);if(t||!e?.hotel?.data?.id)return void function(){try{localStorage.removeItem("persist:root")}catch(t){console.error("removePersistedData: err",t)}}();const o=e.bootstrapArgs;h({...o,startDate:n.bookingForm.start_date.slice(0,10),endDate:n.bookingForm.end_date?.slice(0,10)||null,guests:n.bookingForm.guests,propertyId:n.bookingForm.property_id,persistActive:!0,hotelId:e.hotel.data.id})}catch(t){console.error("openPersistWidget: err",t)}}const f=async()=>await fetch(`${SELFBOOK_APP_BASE_URL}/asset-manifest.json`,{headers:{"content-type":"application/json"}}).then(t=>t.json()).then(t=>function(t){a=t.entrypoints}(t));function E(t,e){const n=new Date(t);return n.setDate(n.getDate()+e),n}async function h(e={}){try{let n=!1;e.apiKey&&await I(e.apiKey,e.hotelId);const o=getHotelBasicData(localStorage,e.hotelId||t),a=getIsEnableV35(o);if(!a||a&&function(t,e=[]){if(!t||"object"!=typeof t||Array.isArray(t))return!1;for(const n in t){if(e.includes(n))continue;const o=t[n];if(null!=o&&!("string"==typeof o&&""===o.trim()||Array.isArray(o)&&0===o.length||"object"==typeof o&&!Array.isArray(o)&&0===Object.keys(o).length))return!0}return!1}(e,["selfbook","version"])){if(!e.startDate&&initialCalendarResponse?.data){const t=T(A(initialCalendarResponse.data));initialV35AvailabilityStartEndDates={startDate:t.startDate,endDate:e.nights?k(E(t.startDate,e.nights)):t.endDate}}n=!0,e.guests?e.guests=fillGuestsFields(e.guests,o):e.guests=[{type:GUEST_TYPE.ADULT,count:o.default_adult_occupancy?o.default_adult_occupancy:2}]}if(o.redirect_to_synxis){const t=buildRedirectSynxisLink(e,o);return void window.open(t,"_blank").focus()}getIsEnableV35(o)&&(e.roomsGuests=buildRoomsGuests(e,o)),_(e,o,n),document.getElementsByTagName("html")[0].setAttribute("translate","no")}catch(t){console.error("bookNow: err: ",t)}}function S(t){const e={startdate:"startDate",enddate:"endDate",rateplancode:"ratePlanCode",rate:"rate",roomid:"roomId",propertyid:"propertyId",destinationid:"destinationId",room:"room",room_count:"roomCount",adult:"adult",child:"child",child_ages:"childAges",infants:"infants",room2_adult:"room2Adult",room2_child:"room2Child",room2_child_ages:"room2ChildAges",room3_adult:"room3Adult",room3_child:"room3Child",room3_child_ages:"room3ChildAges",room4_adult:"room4Adult",room4_child:"room4Child",room4_child_ages:"room4ChildAges",currency:"currency",group:"group",locale:"locale",hotel:"hotel",promo:"promo",promocode:"promocode",selfbook:"selfbook",iatanumber:"iataNumber",couponcode:"couponCode",nights:"nights",reservationid:"reservationId",lastname:"lastName",search:"search",sbsearch:"sbsearch",threeDsContinueId:"three_ds_continue_id",status:"status",roomcategory:"roomCategory",properties:"properties",source:"source",include_inclusive_fees:"includeInclusiveFees",hotelid:"hotelId",version:"version"};return Array.from(t.entries()).reduce((t,[n,o])=>({...t,[e[n.toLowerCase()]]:o}),{})}function b(){setTimeout(()=>{const e=setInterval(()=>{if(r)return;clearInterval(e);const n=S(new URLSearchParams(window.location.search));if("true"!==n.selfbook)return;const o=getHotelBasicData(localStorage,n.hotel||n.hotelId||t);SELFBOOK_APP_VERSION=n.version?.toLowerCase?.()||o?.app_version||"v2",O(n,o)},100)},500)}function O(t,e={}){const n=parseInt(e?.default_adult_occupancy)||2,o=[{type:"adult",count:t.adult||n},{type:"child",count:t.child||0},{type:"infants",count:t.infants||0}];h({...t,guests:o,groupCode:t.group,promoCode:t.promo||t.promocode,hotelId:t.hotel||t.hotelId||void 0,roomCategory:"string"==typeof t.roomCategory?t.roomCategory.split(",").map(t=>t.trim()):void 0})}async function w(){!function(){const t=document.createElement("div"),e=document.createElement("div"),n=document.createElement("button"),o=document.createElement("span"),a=document.createElement("img");n.id=SELFBOOK_WIDGET_RESUME,n.style.cursor="pointer",a.src="https://sdk.selfbook.com/assets/resume-icon-black.png",a.alt="Resume booking",a.width="16",a.height="16",o.innerHTML="Complete your booking",o.id=SELFBOOK_WIDGET_RESUME_TEXT,n.appendChild(o),n.appendChild(a),t.setAttribute("id","selfbook_sdkwidget"),t.style.display="none",e.setAttribute("id","selfbook_sdkwidget_wrapper"),e.style.background="rgba(0, 0, 0, 0)",e.style.position="fixed",e.style.top="0",e.style.right="0",e.style.width="100%",e.style.transition="background .5s ease-out",e.appendChild(t),document.body.appendChild(e),document.body.appendChild(n)}(),await f(),function(){if(!0!==l){if(a&&a.length>0){const t=document.getElementsByTagName("head")[0];a.forEach(e=>{if(e.includes(".css")){const n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.media="all",n.href=`${SELFBOOK_APP_BASE_URL}/${e}`,t.appendChild(n)}})}l=!0}}(),g(),document?.querySelectorAll("a").forEach(e=>{e.addEventListener("click",e=>{try{"A"!==e.target.tagName&&"A"===e.target.parentNode?.tagName&&(e.target.href=e.target.parentNode.href);const n=e.target.href||"";if(-1===n.indexOf("?"))return;const o=S(new URLSearchParams(n.substring(n.indexOf("?")))),a=getHotelBasicData(localStorage,o.hotel,o.hotelId||t);if(SELFBOOK_APP_VERSION=o.version?.toLowerCase?.()||a?.app_version||"v2",a?.mobile_display_only&&window.innerWidth>=768)return;(isTemplateDomainMatch(a,e)||"true"===o.selfbook)&&(e.preventDefault(),O(o,a))}catch(t){console.error("a-element: err: ",t)}})}),"complete"===document?.readyState?b():window?.addEventListener("load",b)}function k(t){return t.toISOString()}async function I(e,n){try{r=!0;const o=n?`?id=${n}`:"",a=await c({url:`${SELFBOOK_BACKEND_URL}/hotels/info${o}`,headers:{"content-type":"application/json","API-Key":e}});localStorage.setItem(SELFBOOK_HOTEL_GROUP_INFO,JSON.stringify(a));const i=getHotelBasicData(localStorage,n),l=S(new URLSearchParams(window.location.search));if(SELFBOOK_APP_VERSION=l.version?.toLowerCase?.()||i?.app_version||"v2",SELFBOOK_APP_BASE_URL=SELFBOOK_APP_VERSION.match(/^v3/i)?SELFBOOK_BASE_URL_V3:SELFBOOK_BASE_URL,!d&&getIsEnableV35(i)){d=!0;const o=await async function(e,n,o){try{const a=function(){const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),1),n=new Date(t.getFullYear(),t.getMonth()+2,0);return{startDate:L(e),endDate:L(n)}}(),r={start_date:a.startDate,end_date:a.endDate,currency_code:o?.currency_code||"USD",guests:[{type:"adult",count:o?.default_adult_occupancy||2}]};window.sb_sdkBus.emit("sdk-calendar-status",{type:"loading",payload:r});const s=await c({url:`${"v2"===SELFBOOK_APP_VERSION?SELFBOOK_BACKEND_URL:SELFBOOK_BACKEND_URL.replace("v2","v3")}/hotels/${n||t}/calendar`,headers:{"content-type":"application/json","API-Key":e},data:JSON.stringify(r),method:"POST"});return initialCalendarResponse=s,window.sb_sdkBus.emit("sdk-calendar-status",{type:"success",payload:s}),s.data}catch(t){window.sb_sdkBus.emit("sdk-calendar-status",{type:"error",error:t.message}),console.log(t)}}(e,n,i),a=T(A(o));initialV35AvailabilityStartEndDates={startDate:a.startDate,endDate:a.endDate},async function(e,n,o,a){try{const r={start_date:a.startDate?.replace(/T.*$/,""),end_date:a.endDate?.replace(/T.*$/,""),currency_code:o?.currency_code||"USD",guests:[{type:"adult",count:o?.default_adult_occupancy||2}]};window.sb_sdkBus.emit("sdk-availability-status",{type:"loading",payload:{bodydata:r}});const s=await c({url:`${"v2"===SELFBOOK_APP_VERSION?SELFBOOK_BACKEND_URL:SELFBOOK_BACKEND_URL.replace("v2","v3")}/hotels/${n||t}/availability`,headers:{"content-type":"application/json","API-Key":e},data:JSON.stringify(r),method:"POST"});return void window.sb_sdkBus.emit("sdk-availability-status",{type:"success",payload:{response:s,bodydata:r}})}catch(t){window.sb_sdkBus.emit("sdk-availability-status",{type:"error",error:t.message}),console.log(t)}}(e,n,i,a)}return s||w(),s=!0,void(r=!1)}catch(t){console.log(t)}}function T(t){const e=new Date(t?.date),n=new Date(e);return n.setDate(e.getDate()+(t?.min_stay?t?.min_stay:1)),{startDate:k(e),endDate:k(n)}}function A(t){const e=new Date,n=e.getUTCFullYear(),o=e.getUTCMonth(),a=e.getUTCDate(),r=new Date(Date.UTC(n,o,a+14)),s=t.filter(t=>function(t){const[e,n,o]=t.split("-").map(Number);return new Date(Date.UTC(e,n-1,o))}(t.date)>r&&null!=t.price);return 0===s.length?null:s.reduce((t,e)=>e.price`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;const D=document?.getElementById("selfbook_jssdk");if(D){const n=new URL(D.getAttribute("src"));if(t=n.searchParams.get("hotelId"),e=n.searchParams.get("apiKey"),"?11howard"===window.location.search&&window.location.href.includes("staging")&&(t="66350",e="x9GTqyGB8Pboi5Tkk3fuQUrQ8qAecxzxNY0"),!e||!t)throw new Error("(!) selfbook: ApiKey and HotelId are required.");window.isSelfbookSDKActive=!0,initSDKBus(),I(e,t),intervalWrapper(()=>{I(e,t)},3e5),function(){const t=`\n #selfbook_sdkwidget {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0px;\n right: 0px;\n }\n\n #${SELFBOOK_WIDGET_RESUME} {\n ${m()}\n }\n\n #${SELFBOOK_WIDGET_RESUME_TEXT} {\n display: block!important;\n font-family: ${p()}!important;\n font-size: 14px!important;\n font-weight: 400!important;\n color: #ffffff!important;\n }\n\n .dismiss-btn-slide-in {\n -webkit-transition: 500ms;\n -moz-transition: 500ms;\n transition: 500ms;\n transform: translateX(0)!important\n }\n\n .dismiss-btn-slide-out {\n -webkit-transition: 500ms;\n -moz-transition: 500ms;\n transition: 500ms;\n transform: translateX(300px)!important\n }\n\n .dismiss-btn-slide-out span {\n display: none;\n }\n\n .payment-summary-wrapper {\n overflow: scroll!important;\n -ms-overflow-style: none!important;\n scrollbar-width: none!important;\n }\n .payment-summary-wrapper::-webkit-scrollbar {\n display: none!important;\n }\n\n .dismiss-btn-resize-in {\n width: 46px!important;\n height: 46px!important;\n transition: 500ms;\n right: 30px!important;\n }\n\n .dismiss-btn-resize-in span {\n display: none;\n }\n\n .dismiss-btn-resize-in:hover {\n width: 217px!important;\n height: 46px!important;\n transition: all 300ms linear;\n cursor: pointer;\n }\n\n .dismiss-btn-resize-in:hover span {\n display: inline;\n height: 20px!important;\n overflow: hidden;\n }\n\n .dismiss-btn-resize-out {\n width: 46px!important;\n height: 46px!important;\n transition: 500ms;\n right: -100px!important;\n }\n\n .slide-in {\n transform: translateX(100%);\n -webkit-transform: translateX(100%);\n animation: slide-in 0.8s forwards !important;\n -webkit-animation: slide-in 0.8s forwards !important;\n z-index: 1000000000000;\n }\n\n .slide-out {\n transform: translateX(100%);\n -webkit-transform: translateX(100%);\n animation: slide-out 1s forwards !important;\n -webkit-animation: slide-out 1s forwards !important;\n z-index: -1000000000000;\n }\n\n @media screen and (max-width:495px) {\n .slide-in {\n transform: translateY(100%);\n -webkit-transform: translateY(100%);\n animation: slide-up 0.8s forwards !important;\n -webkit-animation: slide-up 0.8s forwards !important;\n z-index: 1000000000000;\n }\n .slide-out {\n transform: translateY(100%);\n -webkit-transform: translateY(100%);\n animation: slide-down 0.5s forwards !important;\n -webkit-animation: slide-down 1s forwards !important;\n z-index: -1000000000000;\n }\n }\n\n @keyframes slide-in {\n 100% {\n transform: translateX(0%);\n }\n }\n\n @-webkit-keyframes slide-in {\n 100% {\n -webkit-transform: translateX(0%);\n }\n }\n\n @keyframes slide-up {\n 100% {\n transform: translateY(0%);\n }\n }\n\n @-webkit-keyframes slide-up {\n 100% {\n -webkit-transform: translateY(0%);\n }\n }\n\n @keyframes slide-out {\n 0% {\n transform: translateX(0%);\n }\n 100% {\n transform: translateX(100%);\n }\n }\n\n @-webkit-keyframes slide-out {\n 0% {\n -webkit-transform: translateX(0%);\n }\n 100% {\n -webkit-transform: translateX(100%);\n }\n }\n\n @keyframes slide-down {\n 0% {\n transform: translateY(0%);\n }\n 100% {\n transform: translateY(100%);\n }\n }\n\n @-webkit-keyframes slide-down {\n 0% {\n -webkit-transform: translateY(0%);\n }\n 100% {\n -webkit-transform: translateY(100%);\n }\n }\n `,e=document.createElement("style");e.textContent=t,document.head.append(e),y(t)}()}window&&(window.sbApiLogger=function(n,o){getHotelBasicData(localStorage,o||t);try{c({url:`${"v2"===SELFBOOK_APP_VERSION?SELFBOOK_BACKEND_URL:SELFBOOK_BACKEND_URL.replace("v2","v3")}/hotels/${o||t}/events`,method:"POST",headers:{"content-type":"application/json","API-Key":e},data:JSON.stringify({generated_at:(new Date).toISOString(),event_source:"SDK",body:n})})}catch(t){console.log(t)}},window.book=function(t,e,n,o,a,r,s,i,l,d,c="fr",u,p,m){h({startDate:t,endDate:e,guests:n,propertyId:o,currency:a,roomId:r,ratePlanCode:s,rate:i,promoCode:l,groupCode:d,locale:c,destinationId:p,hotelId:u,roomCategory:m})},window.bookNow=h,window.closeSelfbookWidget=function(){const t=getElementById("selfbook_sdkwidget"),e=getElementById("selfbook_sdkwidget_wrapper"),n=getElementById(SELFBOOK_WIDGET_RESUME);document.body.style.overflow="initial",t.setAttribute("class","slide-out"),e.style.background="rgba(0, 0, 0, 0)",window.selfbookWidgetStore.dispatch({type:"WIDGET/SELFBOOK_WIDGET_CLOSED"}),window.selfbookWidgetStore.dispatch({type:"ANALYTICS/TRACK_EVENT",payload:{eventType:"widget closed"}}),setTimeout(()=>{t.style.display="none",e.style.zIndex=-1e11;const o=getFromLocalStorage(localStorage,SELFBOOK_HOTEL_GROUP_INFO);o&&(o.maintenance_mode||(n.setAttribute("class","dismiss-btn-slide-in"),n.focus()))},800)})}runDirectApplication();
// AutoCamp
// https://www.autocamp.com
// if (window.location.href.includes("selfbook-staging") ||
// localStorage.getItem("selfbook-staging") === "true"
// ) {
// localStorage.setItem("selfbook-staging", "true");
console.log(
'%cCustom script has been initialized',
'background: green; color: white;',
);
function modifyExistingSbLinks() {
const links = document.querySelectorAll(`a[href*='selfbook=true']`);
for (const link of links) {
const href = link.getAttribute('href');
if (href) {
const updatedHref = href.toString().toLowerCase();
const linkObj = hrefToObj(updatedHref);
const finalParams = assignObjectVals(linkObj)
// link.setAttribute('href', window.location.href);
link.addEventListener("click", (e) => {
e.preventDefault();
e.stopImmediatePropagation();
bookNow(finalParams);
console.log('modifyExistingSbLinks()', finalParams)
});
}
}
}
function setLocale(locale) {
const localeList = {
"fr-FR": "fr", "fr-fr": "fr", "fr": "fr", /* French */
"de-DE": "de", "de-de": "de", "de": "de", /* German */
"it-IT": "it", "it-it": "it", "it": "it", /* Italian */
"es-ES": "es", "es-es": "es", "es": "es", /* Spanish (Spain) */
"es-MX": "es-MX", "es-mx": "es-MX", /* Spanish (Mexico) */
"pt-PT": "pt-PT", "pt-pt": "pt-PT", "pt": "pt-PT", /* Portuguese */
"zh-CN": "zh-CN", "zh-cn": "zh-CN", /* Simplified Chinese */
"zh-TW": "zh-TW", "zh-tw": "zh-TW", /* Traditional Chinese */
"ja-JP": "ja", "ja-jp": "ja", /* Japan */
}
return localeList[locale] || localeList[document.documentElement.lang] || "en";
};
// Checks the format of the inputted date and puts it in the correct order format (YYYY-MM-DD)
function convertDate(date) {
try {
const inputDate = new Date(date);
const year = inputDate.getFullYear();
const month = (inputDate.getMonth() + 1).toString().padStart(2, '0');
const day = inputDate.getDate().toString().padStart(2, '0');
return [year, month, day].join('-');
} catch (error) {
console.log(error, 'convertDate');
}
};
// Validates date format is 'YYYY-MM-DD'
function checkDateIsISOformat(inputString) {
try {
const regexPattern = /^\d{4}-\d{2}-\d{2}$/;
return regexPattern.test(inputString);
} catch (error) {
console.log(error, 'checkDateIsISOformat');
}
}
/* Verifies these date formats: 'DD MONTH YYYY', 'YYYY-MM-DD', 'YYYY/MM/DD', 'MM/DD/YYYY' */
function verifyFutureDate(date) {
try {
if (date) {
if (checkDateIsISOformat(date)) {
const inputDate = new Date(date);
const today = new Date();
today.setHours(0, 0, 0, 0);
if (inputDate >= today) {
const formattedDate = inputDate.toISOString().split('T')[0];
return formattedDate;
}
} else {
const inputDate = new Date(date);
const today = new Date();
today.setHours(0, 0, 0, 0);
if (inputDate >= today) {
return convertDate(inputDate);
}
}
}
return '';
} catch (error) {
console.log(error, 'verifyFutureDate');
}
}
// arrival > departure, return new departure
function compareDates(arrive, depart) {
try {
let arrivalDate = new Date(arrive);
let departureDate = new Date(depart);
arrivalDate.setHours(0, 0, 0, 0);
departureDate.setHours(0, 0, 0, 0);
if (arrivalDate > departureDate) {
arrivalDate.setDate(arrivalDate.getDate() + 1);
departureDate = arrivalDate;
}
return departureDate.toLocaleDateString('en-US', {
year: 'numeric',
month: '2-digit',
day: '2-digit'
});
} catch (error) {
console.log(error, 'compareDates');
}
}
/* This function flattens the array / object within guests */
function pruneGuests(object) {
try {
const pruneObject = object;
if (pruneObject.guests && Array.isArray(pruneObject.guests)) {
const guests = pruneObject.guests;
for (const guest of guests) {
if (guest.type === 'adult' && guest.count > 0) {
pruneObject.adult = guest.count;
} else if (guest.type === 'child' && guest.count > 0) {
pruneObject.child = guest.count;
}
// else if (guest.type === 'infants' && guest.count > 0) {
// pruneObject.infants = guest.count;
// }
}
delete pruneObject.guests;
}
// console.log('pruneObject', pruneObject);
return pruneObject;
} catch (error) {
console.log(error, 'pruneGuests');
}
}
/* Fix for Currency Case Bug */
function upperCaseCurrency(currency) {
try {
if (!currency) {
return null;
}
const currencyCode = currency.toUpperCase();
return currencyCode;
} catch (error) {
console.log(error, 'upperCaseCurrency');
}
};
/* This function defines the bookNow() Object and assigns the values */
function assignObjectVals(param) {
try {
const urlData = param;
const updatedLocale = setLocale(urlData.locale);
const updatedCurrency = upperCaseCurrency(urlData.currency);
delete urlData.locale;
delete urlData.currency;
const arrive = urlData.arrive || urlData.startdate;
const depart = urlData.depart || urlData.enddate;
const bookNowParams = {
startDate: verifyFutureDate(arrive),
endDate: verifyFutureDate(depart),
guests: [
{
type: 'adult',
count: (!urlData.adult ? null : parseInt(urlData.adult, 10)),
},
{
type: 'child',
count: (!urlData.child ? null : parseInt(urlData.child, 10)),
}
],
propertyId: urlData.propertyId,
currency: updatedCurrency,
roomId: urlData.room || urlData.roomid,
ratePlanCode: urlData.rate || urlData.rateplancode,
promoCode: urlData.promo || urlData.promocode,
groupCode: urlData.group,
locale: updatedLocale,
hotel: urlData.hotel || urlData.hotelid,
hotelId: urlData.hotel || urlData.hotelid,
iataNumber: urlData.agencyid,
...urlData
};
// Remove any properties with null or undefined values
Object.keys(bookNowParams).forEach((key) => {
if (bookNowParams[key] === null || bookNowParams[key] === undefined || bookNowParams[key] === "") {
delete bookNowParams[key];
}
});
return bookNowParams;
} catch (error) {
console.log(error, 'assignObjectVals');
}
};
// Create a function that parses the URL and returns an object with the params
function hrefToObj(url) {
try {
let href = url.replace(/%20/g, '')
const params = (href.indexOf('?') == -1)
? {}
: Object.fromEntries(new URLSearchParams(
href.substring(href.indexOf('?')),
));
return params;
} catch (error) {
console.log(error, 'hrefToObj');
}
}
// Create a direct link
function objToSBlinks(params) {
try {
let siteUrl = `${window.location.pathname}?selfbook=true`;
let sbObj = assignObjectVals(params);
let prunedSBobj = pruneGuests(sbObj);
let urlParams = decodeURIComponent(
new URLSearchParams(prunedSBobj),
).toString();
return `${siteUrl}&${urlParams}`;
} catch (error) {
console.log(error, 'objToSBlinks');
}
}
/* Find booking links with specific keywords, then point them to Selfbook */
function linkReplacer() {
// const allSynxisLinks = document.querySelectorAll(`a[href*='synxis']`);
const allSynxisLinks = document.querySelectorAll(`a[href*='reservations.autocamp.com'], a[href*='synxis']`);
if (allSynxisLinks.length > 0) {
for (let i = 0; i < allSynxisLinks.length; i++) {
allSynxisLinks[i].removeAttribute('target');
const link = allSynxisLinks[i].href.toString().toLowerCase();
const linkObj = hrefToObj(link);
// const sbLink = objToSBlinks(linkObj);
if (link.indexOf("signin") === -1) {
let finalParams = assignObjectVals(linkObj);
// allSynxisLinks[i].href = sbLink;
// allSynxisLinks[i].href = "?book-now";
allSynxisLinks[i].addEventListener('click', (e) => {
e.preventDefault();
e.stopImmediatePropagation();
bookNow(finalParams);
});
}
else {
allSynxisLinks[i].href = `/?selfbook=true&sbsearch=true&hotel=${linkObj.hotel}`;
allSynxisLinks[i].addEventListener('click', (e) => {
e.preventDefault();
})
}
}
}
};
linkReplacer();
modifyExistingSbLinks();
const roomsByProp = {
"35147": {
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"CAS2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"VXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"VAS2S": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"VXX2S": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
},
"36041": {
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"PXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"VAS2T": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed",
},
"TTN1": {
bedCount: 1,
info: "1 Queen",
},
"MHC1": {
bedCount: 1,
info: "1 Full",
},
},
"36042": {
"TTN1": {
bedCount: 1,
info: "1 King & 1 Sofa Bed"
},
"TTN1A": {
bedCount: 1,
info: "1 King & 1 Sofa Bed"
},
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
}
},
"36044": {
"TTN1": {
bedCount: 1,
info: "1 King & 1 Sofa Bed"
},
"TTN1A": {
bedCount: 1,
info: "1 King & 1 Sofa Bed"
},
"PBC4": {
bedCount: 1,
info: "1 Queen, 1 King & 2 Sofa Beds"
},
"CCB4": {
bedCount: 1,
info: "1 Queen, 1 Sofa Bed & 2 Twins"
},
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
}
},
"36413": {
"TTN1": {
bedCount: 1,
info: "1 King & 1 Sofa Bed"
},
"PBC4": {
bedCount: 1,
info: "1 Queen, 1 King & 2 Sofa Beds"
},
"PCB4": {
bedCount: 1,
info: "1 Queen, 1 Sofa Bed & 2 Twins"
},
"VCB4": {
bedCount: 1,
info: "1 Queen, 1 Sofa Bed & 2 Twins"
},
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
}
},
"40277": {
"CCB4": {
bedCount: 1,
info: "1 Queen, 1 King, & 2 Sofa Beds"
},
"PBC4": {
bedCount: 1,
info: "1 Queen, 1 King & 2 Sofa Beds"
},
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
}
},
"40278": {
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CBB2": {
bedCount: 1,
info: "1 Full & 1 Sofa Bed"
},
"CXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PBC4": {
bedCount: 2,
info: "1 Queen, 1 Full, 1 Sofa Bed"
}
},
"45907": {
"CKSS4": {
bedCount: 1,
info: "1 King & 2 Twins"
},
"CK1AD": {
bedCount: 1,
info: "1 King"
},
"CAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CXX2A": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"EAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"PAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VAS2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"VXX2": {
bedCount: 1,
info: "1 Queen & 1 Sofa Bed"
},
"CCB4": {
bedCount: 2,
info: "1 Queen, 1 King, & 2 Sofa Beds"
},
"PBC4": {
bedCount: 2,
info: "1 Queen, 1 King, & 2 Sofa Beds"
},
"VBC4": {
bedCount: 2,
info: "1 Queen, 1 King, & 2 Sofa Beds"
},
"CQQSS4": {
bedCount: 2,
info: "2 Queens & 2 Twins"
}
}
}
setInterval(() => {
if (typeof selfbookWidgetStore !== 'undefined' && selfbookWidgetStore?.getState()?.core?.hotel?.data?.id) {
let hotelId = selfbookWidgetStore?.getState()?.core?.hotel?.data?.id;
let roomId = selfbookWidgetStore?.getState()?.rooms?.roomDetail?.room?.id;
if (document.querySelector('#sb-screen #room-detail-description + div')) {
if (document.querySelector('#sb-screen #room-detail-description + div svg[title="bed"]') && !document.querySelector('#sb-screen #room-detail-description + div svg[title="bed"][data-sb-updated]')) {
// add bed info
let bedText = "";
document.querySelector('#sb-screen #room-detail-description + div svg[title="bed"]').setAttribute("data-sb-updated", "true");
if (roomsByProp[hotelId] && roomsByProp[hotelId][roomId]) {
bedText = roomsByProp[hotelId][roomId].bedCount > 1 ? "BEDS" : "BED"
}
document.querySelector('#sb-screen #room-detail-description + div svg[title="bed"] + div').textContent = roomsByProp[hotelId][roomId].info;
}
}
if (document.querySelector('li.sb-room-item') && !document.querySelector('.sb-room-item[data-sb-updated]')) {
document.querySelector('li.sb-room-item').setAttribute("data-sb-updated", "true")
document.querySelectorAll('li.sb-room-item').forEach(room => {
let tempRoomId = room.getAttribute("data-roomid");
if (roomsByProp[hotelId][tempRoomId].bedCount && room.querySelector('div svg[title="bed"] + div')) {
if (roomsByProp[hotelId] && roomsByProp[hotelId][tempRoomId]) {
let roomInfoInCaps = roomsByProp[hotelId][tempRoomId].info.toString().toUpperCase();
room.querySelector('div svg[title="bed"] + div').textContent = roomInfoInCaps;
}
}
}
)
}
}
if (document.querySelector('[aria-label="Selfbook Main Menu"] ul li button')
&& !document.querySelector('[aria-label="Selfbook Main Menu"] ul li button[data-sb-updated]')) {
document.querySelector('[aria-label="Selfbook Main Menu"] ul li button').setAttribute("data-sb-updated", "true");
document.querySelectorAll('[aria-label="Selfbook Main Menu"] ul li button').forEach((button) => {
if (button.textContent.toLowerCase().includes("sign")) {
button.remove();
}
})
}
if (document.querySelector('#sb-screen #have-an-account')
&& !document.querySelector('#sb-screen #have-an-account[data-sb-updated]')) {
document.querySelector('#sb-screen #have-an-account').setAttribute("data-sb-updated", "true");
document.querySelector('#sb-screen #have-an-account').style = "visibility: hidden !important;";
document.querySelector('#sb-screen #have-an-account + button').style = "visibility: hidden !important;";
}
if (document.querySelector('[aria-label="Selfbook Main Menu"] div h2')
&& !document.querySelector('[aria-label="Selfbook Main Menu"] div h2[data-sb-updated]')) {
document.querySelector('[aria-label="Selfbook Main Menu"] div h2').setAttribute("data-sb-updated", "true");
if (document.querySelector('[aria-label="Selfbook Main Menu"] div h2').textContent.toLowerCase().includes("guest")) {
document.querySelector('[aria-label="Selfbook Main Menu"] div h2').textContent = "Menu";
}
}
if (document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-select"] label[id*="sb-select"]') && !document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-select"] label[id*="sb-select"][data-sb-updated]')) {
document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-select"] label[id*="sb-select"]').setAttribute("data-sb-updated", "true");
if (document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-select"] label[id*="sb-select"]').textContent.toLowerCase().includes("booking or itinerary no")) {
document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-select"] label[id*="sb-select"]').textContent = "Confirmation No.";
}
}
if (document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-dropdown-menu"] [data-testid="sb-dropdown-option"] div')
&& !document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-dropdown-menu"] [data-testid="sb-dropdown-option"][data-sb-updated]')) {
document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-dropdown-menu"] [data-testid="sb-dropdown-option"] div').setAttribute("data-sb-updated", "true");
if (document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-dropdown-menu"] [data-testid="sb-dropdown-option"] div').textContent.toLowerCase().includes("booking id")) {
document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-dropdown-menu"] [data-testid="sb-dropdown-option"] div').textContent = "Confirmation No.";
}
}
if (document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-input-container"] button label')
&& !document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-input-container"] button label[data-sb-updated]')) {
document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-input-container"] button label').setAttribute("data-sb-updated", "true");
if (document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-input-container"] button label').textContent.toLowerCase().includes("booking id")) {
document.querySelector('[aria-label="Find Bookings"] [data-testid="sb-input-container"] button label').textContent = "Confirmation No.";
}
}
linkReplacer();
}, 500);
function bookNowByHotel() {
if (window.location.href.includes('asheville')) {
bookNow({ hotelId: '40278' });
} else if (window.location.href.includes('cape')) {
bookNow({ hotelId: '36042' });
} else if (window.location.href.includes('catskills')) {
bookNow({ hotelId: '36413' });
} else if (window.location.href.includes('joshua')) {
bookNow({ hotelId: '35147' });
} else if (window.location.href.includes('russian')) {
bookNow({ hotelId: '36041' });
} else if (window.location.href.includes('sequoia')) {
bookNow({ hotelId: '45907' });
} else if (window.location.href.includes('yosemite')) {
bookNow({ hotelId: '36044' });
} else if (window.location.href.includes('zion')) {
bookNow({ hotelId: '40277' });
} else {
bookNow();
}
}
// Clone a CTA
function bookNowCloner(selector) {
const bookNowButton = document.querySelector(selector);
if (bookNowButton !== null) {
const bookNowButtonClone = bookNowButton.cloneNode(true);
bookNowButton.parentNode.replaceChild(bookNowButtonClone, bookNowButton);
bookNowButtonClone.addEventListener('click', (e) => {
e.preventDefault();
e.stopImmediatePropagation();
// eslint-disable-next-line no-undef
bookNowByHotel();
});
}
}
bookNowCloner('header.site-header button');
// Example usage of assignObjectVals(obj), leverages existing validation
if (document.querySelector('form.booking-widget-form')) {
document.querySelector('form.booking-widget-form').removeAttribute("action");
document.querySelector('form.booking-widget-form').removeAttribute("target");
document.querySelector('form.booking-widget-form').removeAttribute("method");
document.querySelector('form.booking-widget-form button.button--primary')
.addEventListener('click', function (e) {
try {
e.preventDefault();
e.stopImmediatePropagation();
let obj = {}; // Create an obj with SynXis booking properties
obj.hotelId = document.querySelector('[aria-selected="true"]').value;
obj.startDate = document.querySelector('form.booking-widget-form [name="startDate"]')?.value;
obj.endDate = document.querySelector('form.booking-widget-form [name="endDate"]')?.value;
let adult = document.querySelector('form.booking-widget-form [name="adults"]')?.value;
let child = document.querySelector('form.booking-widget-form [name="children"]')?.value;
obj.guests = [
{
type: 'adult',
count: (!adult ? null : parseInt(adult, 10)),
},
{
type: 'child',
count: (!child ? null : parseInt(child, 10)),
}
];
bookNow(obj);
console.log('form');
} catch (error) {
console.log(error, "formInputs");
}
});
}
const customStyles = document.createElement("style");
customStyles.innerText = `
#sb-post-booking-auth {
display:none !important;
}
#selfbook-loading {
max-width: 150px !important;
}
ul[data-testid="properties-list"] img[alt*="Catskills"] + div > div:nth-child(2) {
display: none !important;
}
#sb-screen [data-testid="sb-screen-footer"] button,
#sb-screen [data-testid="sb-text-area"] + div > button:nth-child(2),
#sb-screen form + div button,
#sb-screen #sb-pay {
background-color: #FFFF00 !important;
color: #2C261B !important;
font-weight: 500 !important;
}
#sb-screen [data-testid="sb-screen-footer"] button[disabled] {
background-color: rgb(248, 249, 250) !important;
color: gray !important;
}
[aria-label="Select a location"] [data-testid="sb-screen-body"] #sb-screen-content {
background-color: #FFFAEB !important;
}
#sb-upgrade-container > button:last-child{
background-color: #FFFAEB !important;
color: #2C261B !important;
}
/* Room image issue */
#selfbook_sdkwidget li.sb-room-item img {
object-fit: cover !important;
object-position: center bottom !important;
}
[aria-label="Room details"] div[aria-label="carousel"] img {
object-fit: cover !important;
object-position: 50% 100% !important;
}
/* Links in room description */
#selfbook_sdkwidget #room-detail-description a {
color: #00308F !important;
text-decoration: underline !important;
}
#selfbook_sdkwidget #room-detail-description a:hover {
cursor: pointer !important;
}
/* hide property descriptions */
ul[data-testid="properties-list"] li button img[src*="s3.amazonaws.com"] + div div:nth-child(2) {
display: none !important;
}
`;
document.head.appendChild(customStyles);
// } else {
// console.log("SB not loaded");
// }