PageSourceSearch

https://www.houseofreservations.com/_next/static/chunks/519.175ac13a03bc73dc.js

js houseofreservations.com collected 2026-10-08 23:43:30 UTC 13,004 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[519],{87242:function(e,t,a){a.r(t);var n=a(26085),r=a(91221),l=a(25495),s=a(998),i=a(45402),o=a(48831),c=a(9611),u=a(79549),d=a(42341),m=a(82286),f=a(82461);t.default=e=>{let{isOpen:t,setOpen:a,checkout:h,setCheckout:x}=e,{isFetchingRates:p,fetchError:g,latestRate:v,setFetchingRates:y,setFetchError:b,setLatestRate:j}=(0,l.T)(),{selectedCurrency:D,currencies:w}=(0,u.U)(),[N,k]=(0,c.useState)(!1),[E,_]=(0,c.useState)([]),[C,S]=(0,c.useState)([]),[A,F]=(0,c.useState)([]),[M,T]=(0,c.useState)([new Date,new Date]),[L,I]=(0,c.useState)([]),[B,R]=(0,c.useState)([new Date,new Date]),V=(0,c.useCallback)(e=>{let t=Date.UTC(e[0].getFullYear(),e[0].getMonth(),e[0].getDate());return Math.floor((Date.UTC(e[1].getFullYear(),e[1].getMonth(),e[1].getDate())-t)/864e5)},[]),U=(0,c.useMemo)(()=>M[0].getTime()!==B[0].getTime()||M[1].getTime()!==B[1].getTime(),[M,B]),P=(0,c.useMemo)(()=>U?L:A,[U,L,A]);(0,c.useMemo)(()=>U?B:M,[U,B,M]);let z=(0,c.useCallback)(e=>{let t=(0,d.Lk)(e.price,D,w),a=(0,d.pA)(e.name,D,w);return null===t||0===t?null:(0,n.jsxs)("div",{className:"flex flex-row justify-between font-medium text-neutral-600 dar
1k:text-neutral-300",children:[(0,n.jsx)("span",{className:"w-1/2",children:a}),(0,n.jsx)("span",{className:"w-1/2 text-right",children:(0,d.xG)(t,D)})]},e.name)},[D,w]),H=(0,c.useMemo)(()=>P.reduce((e,t)=>e+((0,d.Lk)(t.price,D,w)||0),0),[P,D,w]),O=(0,c.useCallback)(()=>{a(!1)},[a]),Y=(0,c.useCallback)(async e=>{b(null),y(!0);try{var t;let a=(0,i.p)(e[0]),n=(0,i.p)(e[1]),r=(0,m.dg)("rates?id_room=".concat(null==h?void 0:h.room.roomId,"&startDate=").concat(a,"&endDate=").concat(n,"&numAdult=").concat(null==h?void 0:h.guests.adult)),l=localStorage.getItem("token")||"",s=await fetch(r,{headers:{Authorization:"Bearer ".concat(l)}}),o=await s.json();if(!s.ok)throw Error((null==o?void 0:o.message)||"Failed to fetch room rates");let c=(0,f.m)(o),u=c.rate,d=c.serviceFee,x=null!==(t=c.serviceFeePercentage)&&void 0!==t?t:0;if(isNaN(u))return!1;j({currency:"IDR",rate:u,serviceFee:d,serviceFeePercentage:x,promos:c.promos});let p=V(e),g=[];return g.push({name:"IDR ".concat((u/p).toLocaleString()," x ").concat(p," night(s)"),price:u,type:"room"}),d&&d>0&&g.push({name:"Service fee".concat(x?" (".concat(x,"%)"):""),price:d,type:"other"}),I(g),!0}catch(e){return console.error("Error fetching rates:",e),b(e.message||"Error getting live price"),!1}finally{y(!1)}},[h,V,b,y,j]),Z=(0,c.useCallback)(async e=>{e[0]&&e[1]&&(R(e),await Y(e))},[Y]),G=(0,c.useCallback)(()=>{if(!x||!h){console.error("No setCheckout function supplied");return}x({...h,items:L,arrival:B[0],departure:B[1]}),O()},[h,x,L,B,O]);return(0,c.useEffect)(()=>{if(!h||h.items.length<1)return;let e=new Date(h.arrival),t=new Date(h.departure);F(h.items),T([e,t]),R([e,t]),b(null)},[h,t,b]),(0,c.useEffect)(()=>{if(!(null==h?void 0:h.room.roomId))return;let e=h.room.roomId,t=new Date;t.setHours(0,0,0,0);let a=((e,t)=>{let a=new Date(e);return a.setMonth(a.getMonth()+t),a})(t,6);(async()=>{k(!0);try{let n=await fetch("".concat("https://api.houseofreservations.com/v1","/rooms/").concat(e));if(!n.ok)throw Error("Room data not found");let r=(await n.json()).availability.map(e=>({...e,date:new Date(e.date)})).filter(e=>e.date>=t&&e.date<=a);S(r);let l=r.filter(e=>e.numAvail<1).map(e=>{let t=new Date(e.date);return t.setHours(0,0,0,0),t}).sort((e,t)=>e.getTime()-t.getTime()),s=[];if(l.length){let e=l[0],t=l[0];for(let a=1;a<l.length;a++){let n=l[a],r=new Date(t);r.setDate(t.getDate()+1),n.getTime()===r.getTime()||(s.push({startDate:e,endDate:new Date(t.getTime()+864e5)}),e=n),t=n}s.push({startDate:e,endDate:new Date(t.getTime()+864e5)})}_(s)}catch(e){console.error("Error fetching room or availability:",e)}finally{k(!1)}})()},[null==h?void 0:h.room.roomId]),(0,n.jsxs)(o.Vq,{open:t,as:"div",className:"relative z-50 focus:outline-none",onClose:O,children:[(0,n.jsx)(o.ZR,{className:"fixed inset-0 bg-black/60"}),(0,n.jsx)("div",{className:"fixed inset-0 z-10 w-screen overflow-y-auto",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center p-4",children:(0,n.jsxs)(o.EM,{transition:!0,className:"data-[closed]:transform-[scale(95%)] w-full max-w-2xl rounded-xl bg-white p-6 backdrop-blur-2xl duration-300 ease-out data-[closed]:opacity-0 dark:bg-neutral-800",children:[(0,n.jsx)(o.$N,{as:"h3",className:"text-xl font-semibold",children:"Change staying dates"}),(0,n.jsx)("span",{className:"text-sm text-neutral-500",children:"Alter your staying dates. With dates changed, the rate for this room might also change"}),(0,n.jsxs)("div",{className:"my-4 flex flex-1 flex-col lg:flex-row lg:space-x-3",children:[(0,n.jsxs)("div",{className:"mt-6 flex w-full flex-col space-y-2 lg:max-w-max",children:[(0,n.jsx)("span",{className:"text-md",children:"Chosen dates"}),(0,n.jsxs)("div",{className:"h-full max-h-max w-full rounded-lg border border-neutral-200 dark:border-neutral-700 lg:max-w-max",children:[(0,n.jsx)("div",{className:"hidden md:flex",children:(0,n.jsx)(r.Z,{availability:C,centered:!0,defaultArrival:B[0],defaultDeparture:B[1],bookedDates:E,onDateChange:Z})}),(0,n.jsx)("div",{className:"flex md:hidden",children:(0,n.jsx)(r.Z,{availability:C,centered:!0,monthShown:1,bookedDates:E,defaultArrival:B[0],defaultDeparture:B[1],onDateChange:Z})})]})]}),(0,n.jsxs)("div",{className:"mt-6 flex h-full flex-1 flex-grow flex-col space-y-2",children:[(0,n.jsx)("span",{className:"text-md",children:"Rate Summary"}),(0,n.jsx)("div",{className:"rounded-lg border border-neutral-200 dark:border-neutral-700 p-4 ".concat(p&&"animate-pulse bg-neutral-200 dark:bg-neutral-700"),children:p?(0,n.jsx)("div",{className:"flex items-center justify-center h-20 w-full",children:(0,n.jsxs)("svg",{className:"w-8 h-8 animate-spin text-primary-500",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}):g?(0,n.jsxs)("div",{className:"flex items-start gap-3 p-2",children:[(0,n.jsx)("svg",{className:"w-5 h-5 text-red-500 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})}),(0,n.jsx)("span",{className:"text-sm text-red-600 dark:text-red-400",children:g})]}):(0,n.jsxs)("div",{className:"space-y-3 divide-y divide-neutral-200 dark:divide-neutral-700",children:[(0,n.jsx)("div",{className:"flex flex-col space-y-2",children:P.map(e=>z(e))}),(0,n.jsx)("div",{className:"flex flex-col space-y-2 pt-3",children:(0,n.jsxs)("div",{className:"flex flex-row justify-between font-semibold",children:[(0,n.jsx)("span",{children:"Total"}),(0,n.jsx)("span",{children:(0,d.xG)(H,D)})]})})]})}),"IDR"!==D&&!p&&!g&&(0,n.jsx)("p",{className:"text-xs italic text-neutral-600 dar
1k:text-neutral-400 mt-2",children:"* Rates are for reference only. All payments are made in IDR."})]})]}),(0,n.jsxs)("div",{className:"flex w-full justify-end space-x-3",children:[(0,n.jsx)(s.default,{onClick:O,className:"bg-neutral-200/80 dark:bg-neutral-700",sizeClass:"py-2 px-3",children:(0,n.jsx)("span",{className:"text-sm",children:"Cancel changes"})}),U&&!p&&!g&&(0,n.jsx)(s.default,{onClick:G,className:"bg-primary-500 !px-4 !py-2 text-white",children:"Confirm new dates"})]})]})})})]})}},33296:function(e,t,a){var n=a(26085),r=a(5017),l=a(76079);a(9611),t.Z=e=>{let{monthDate:t,customHeaderCount:a,decreaseMonth:s,increaseMonth:i}=e;return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{"aria-label":"Previous Month",className:"react-datepicker__navigation react-datepicker__navigation--previous absolute -top-1 left-0 flex items-center justify-center rounded-lg p-2 hover:bg-gray-100 dark:hover:bg-gray-700",style:1===a?{visibility:"hidden"}:{},onClick:s,type:"button",children:(0,n.jsx)("span",{className:"react-datepicker__navigation-icon react-datepicker__navigation-icon--previous",children:(0,n.jsx)(r.Z,{className:"h-5 w-5"})})}),(0,n.jsx)("span",{className:"react-datepicker__current-month",children:t.toLocaleString("en-US",{month:"long",year:"numeric"})}),(0,n.jsx)("button",{"aria-label":"Next Month",className:"react-datepicker__navigation react-datepicker__navigation--next absolute -top-1 right-0 flex items-center justify-center rounded-lg p-2 hover:bg-gray-100 dark:hover:bg-gray-700",type:"button",onClick:i,children:(0,n.jsx)("span",{className:"react-datepicker__navigation-icon react-datepicker__navigation-icon--next",children:(0,n.jsx)(l.Z,{className:"h-5 w-5"})})})]})}},82461:function(e,t,a){a.d(t,{m:function(){return o}});let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a="number"==typeof e?e:Number(e);return Number.isFinite(a)?a:t},r=e=>{if(null==e||""===e)return null;let t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:null},l=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null==e?t:"string"==typeof e?e:String(e)},s=e=>{let t=null!=e?e:{},a="FIXED_VALUE"===t.discountType?"FIXED_VALUE":"PERCENTAGE_VALUE",s=n(t.discountValue,0);return{id:n(t.id,0),name:l(t.name,"Promo"),code:null==t.code?null:l(t.code),discountType:a,discountValue:s,fixedValue:n(t.fixedValue,"FIXED_VALUE"===a?s:0),minLengthOfStay:r(t.minLengthOfStay),purchaseStartDate:null==t.purchaseStartDate?null:l(t.purchaseStartDate),purchaseEndDate:null==t.purchaseEndDate?null:l(t.purchaseEndDate),stayStartDate:null==t.stayStartDate?null:l(t.stayStartDate),stayEndDate:null==t.stayEndDate?null:l(t.stayEndDate),mustBeBookedType:"LAST_MINUTE_BOOKING"===t.mustBeBookedType||"EARLY_BOOKING"===t.mustBeBookedType?t.mustBeBookedType:null,mustBeBookedDays:r(t.mustBeBookedDays),active:null==t.active||!!t.active,overlapping:null==t.overlapping||!!t.overlapping}},i=e=>Array.isArray(e)?e.map(s).sort((e,t)=>t.fixedValue-e.fixedValue):[],o=e=>{var t;let a=null!=e?e:{};return{roomId:l(null!==(t=a.roomId)&&void 0!==t?t:a.id_room),rate:n(a.rate,0),serviceFee:n(a.serviceFee,0),serviceFeePercentage:r(a.serviceFeePercentage),promos:i(a.promos)}}},45402:function(e,t,a){a.d(t,{p:function(){return n}});let n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"iso",n=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),l=String(e.getDate()).padStart(2,"0");return"iso"==a?"".concat(n).concat(t).concat(r).concat(t).concat(l):"".concat(l).concat(t).concat(r).concat(t).concat(n)}},97351:function(e,t,a){var n=a(9611);let r=n.forwardRef(function(e,t){let{title:a,titleId:r,...l}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":r},l),a?n.createElement("title",{id:r},a):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))});t.Z=r},21220:function(e,t,a){a.d(t,{D:function(){return r}});var n=a(33279);function r(e){let t=(0,n.Q)(e),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return a.setUTCFullYear(t.getFullYear()),+e-+a}},94136:function(e,t,a){a.d(t,{d:function(){return r}});var n=a(65871);function r(e){for(var t=arguments.length,a=Array(t>1?t-1:0),r=1;r<t;r++)a[r-1]=arguments[r];let l=n.L.bind(null,e||a.find(e=>"object"==typeof e));return a.map(l)}},41469:function(e,t,a){a.d(t,{H_:function(){return s},I7:function(){return i},dP:function(){return r},fH:function(){return l},jE:function(){return n}});let n=6048e5,r=864e5,l=43200,s=1440,i=Symbol.for("constructDateFrom")},65871:function(e,t,a){a.d(t,{L:function(){return r}});var n=a(41469);function r(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&n.I7 in e?e[n.I7](t):e instanceof Date?new e.constructor(t):new Date(t)}},25691:function(e,t,a){a.d(t,{w:function(){return i}});var n=a(21220),r=a(94136),l=a(41469),s=a(10909);function i(e,t,a){let[i,o]=(0,r.d)(null==a?void 0:a.in,e,t),c=(0,s.b)(i),u=(0,s.b)(o);return Math.round((+c-(0,n.D)(c)-(+u-(0,n.D)(u)))/l.dP)}},10909:function(e,t,a){a.d(t,{b:function(){return r}});var n=a(33279);function r(e,t){let a=(0,n.Q)(e,null==t?void 0:t.in);return a.setHours(0,0,0,0),a}},33279:function(e,t,a){a.d(t,{Q:function(){return r}});var n=a(65871);function r(e,t){return(0,n.L)(t||e,e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.