1"use strict";(self.webpackChunkweb=self.webpackChunkweb||[]).push([[965],{5945(e,t,n){n.d(t,{Zp:()=>f});var s=n(1882),a=n(4223),o=n(2176),i=n(7480),r=n(812);const l=["className"],c=["className"],d=["className"],m=["className"],u=["className"],p=["className"],f=o.forwardRef((e,t)=>{let{className:n}=e,o=(0,a.A)(e,l);return(0,r.jsx)("div",(0,s.A)({ref:t,className:(0,i.cn)("rounded-xl border bg-card text-card-foreground shadow",n)},o))});f.displayName="Card";o.forwardRef((e,t)=>{let{className:n}=e,o=(0,a.A)(e,c);return(0,r.jsx)("div",(0,s.A)({ref:t,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",n)},o))}).displayName="CardHeader";o.forwardRef((e,t)=>{let{className:n}=e,o=(0,a.A)(e,d);return(0,r.jsx)("div",(0,s.A)({ref:t,className:(0,i.cn)("font-semibold leading-none tracking-tight",n)},o))}).displayName="CardTitle";o.forwardRef((e,t)=>{let{className:n}=e,o=(0,a.A)(e,m);return(0,r.jsx)("div",(0,s.A)({ref:t,className:(0,i.cn)("text-sm text-muted-foreground",n)},o))}).displayName="CardDescription";o.forwardRef((e,t)=>{let{className:n}=e,o=(0,a.A)(e,u);return(0,r.jsx)("div",(0,s.A)({ref:t,className:(0,i.cn)("p-6 pt-0",n)},o))}).displayName="CardContent";o.forwardRef((e,t)=>{let{className:n}=e,o=(0,a.A)(e,p);return(0,r.jsx)("div",(0,s.A)({ref:t,className:(0,i.cn)("flex items-center p-6 pt-0",n)},o))}).displayName="CardFooter"},164(e,t,n){n.d(t,{no:()=>A,p5:()=>S});var s=n(2176),a=n(6959),o=n(2563),i=n(6483),r=n(2631),l=n(1978),c=n(5945),d=n(5931),m=n(4970),u=n(951),p=n(2857),f=n(9633),x=n(1665),h=n(40),g=n(8370),v=n(4339),w=n(9796),y=n(4441),N=n(2773),b=n(812);const _={percentage:w.A,flat:y.A,first_booking:g.A};function j(e){let{offer:t,onApply:n,applied:a=!1,showCode:i=!0}=e;const r=_[t.type]||y.A,[l,c]=(0,s.useState)(!1);let u="";return"percentage"===t.type||"first_booking"===t.type?(u="".concat(t.value,"% OFF"),t.max_discount&&(u+=" (up to \u20b9".concat(t.max_discount,")"))):u="\u20b9".concat(t.value," OFF"),(0,b.jsxs)(o.P.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"relative p-3 rounded-xl border ".concat(a?"border-emerald-500/50 bg-emerald-500/5":"border-border bg-muted/30 hover:border-violet-500/30"," transition-colors"),children:[a&&(0,b.jsx)("div",{className:"absolute -top-2 -right-2 w-5 h-5 rounded-full bg-emerald-500 flex items-center justify-center",children:(0,b.jsx)(f.A,{className:"h-3 w-3 text-white"})}),(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0 ".concat("first_booking"===t.type?"bg-gradient-to-br from-amber-500 to-orange-500":"bg-gradient-to-br from-violet-500 to-fuchsia-500"),children:(0,b.jsx)(r,{className:"h-5 w-5 text-white"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,b.jsx)("span",{className:"font-semibold text-sm",children:u}),"first_booking"===t.type&&(0,b.jsx)(m.E,{className:"bg-amber-500/10 text-amber-600 border-amber-500/20 text-[10px]",children:"First Booking"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:t.title}),i&&t.code&&(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,b.jsx)("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded border border-dashed border-border",children:t.code}),(0,b.jsxs)("button",{onClick:()=>{t.code&&(navigator.clipboard.writeText(t.code),c(!0),p.oR.success("Code copied!"),setTimeout(()=>c(!1),2e3))},className:"text-xs text-violet-500 hover:text-violet-600 flex items-center gap-1",children:[l?(0,b.jsx)(f.A,{className:"h-3 w-3"}):(0,b.jsx)(h.A,{className:"h-3 w-3"}),l?"Copied":"Copy"]})]}),t.min_order_value&&(0,b.jsxs)("p",{className:"text-[10px] text-muted-foreground mt-1",children:["Min. order: \u20b9",t.min_order_value]})]}),n&&!a&&(0,b.jsx)(d.$,{size:"sm",variant:"ghost",onClick:()=>n(t),className:"text-violet-500 hover:text-violet-600 hover:bg-violet-500/10",children:"Apply"})]})]})}function A(e){let{listingId:t,orderValue:n,onApply:a,appliedOffer:o}=e;const{user:c}
1=(0,l.As)(),[x,h]=(0,s.useState)(""),[g,v]=(0,s.useState)(!1),[w,y]=(0,s.useState)(""),_=()=>{null===a||void 0===a||a(null,0),h(""),y("")};return o?(0,b.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-xl bg-emerald-500/10 border border-emerald-500/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(f.A,{className:"h-4 w-4 text-emerald-500"}),(0,b.jsx)("span",{className:"text-sm font-medium text-emerald-600",children:o.code||o.title}),(0,b.jsxs)(m.E,{className:"bg-emerald-500 text-white text-[10px]",children:["-","percentage"===o.type?"".concat(o.value,"%"):"\u20b9".concat(o.value)]})]}),(0,b.jsx)("button",{onClick:_,className:"text-muted-foreground hover:text-foreground",children:(0,b.jsx)(N.A,{className:"h-4 w-4"})})]}):(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(u.p,{value:x,onChange:e=>{h(e.target.value.toUpperCase()),y("")},placeholder:"Enter promo code",className:"font-mono"}),(0,b.jsx)(d.$,{onClick:async()=>{if(x.trim()){v(!0),y("");try{const e=await i.api.post(r.Ay.OFFERS.VALIDATE,{code:x.trim().toUpperCase(),listing_id:t,user_id:null===c||void 0===c?void 0:c.id,order_value:n});e.data.valid&&(null===a||void 0===a||a(e.data.offer,e.data.discount),p.oR.success("Promo code applied! You save \u20b9".concat(e.data.discount)),h(""))}catch(o){var e,s;y((null===(e=o.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.detail)||"Invalid promo code")}finally{v(!1)}}},disabled:!x.trim()||g,variant:"outline",children:g?"...":"Apply"})]}),w&&(0,b.jsx)("p",{className:"text-xs text-red-500",children:w})]})}function S(e){let{listingId:t,orderValue:n=0,onSelectOffer:o}=e;const{user:d}=(0,l.As)(),[u,p]=(0,s.useState)([]),[f,h]=(0,s.useState)(!0),[g,w]=(0,s.useState)(!1);(0,s.useEffect)(()=>{y()},[t,n]);const y=async()=>{try{let e=r.Ay.OFFERS.AVAILABLE(t);null!==d&&void 0!==d&&d.id&&(e=r.Ay.OFFERS.AVAILABLE_WITH_USER(t,d.id,n));const s=await i.api.get(e);p(s.data.offers)}catch(e){p([])}finally{h(!1)}};if(f)return(0,b.jsx)("div",{className:"animate-pulse",children:(0,b.jsx)("div",{className:"h-16 bg-muted rounded-xl"})});if(0===u.length)return null;const N=g?u:u.slice(0,2);return(0,b.jsxs)(c.Zp,{className:"rounded-2xl border-border overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 bg-gradient-to-r from-violet-500/10 via-fuchsia-500/10 to-transparent border-b border-border/50",children:(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-violet-500 to-fuchsia-500 flex items-center justify-center",children:(0,b.jsx)(v.A,{className:"h-4 w-4 text-white"})}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("h3",{className:"font-semibold text-sm flex items-center gap-2",children:["Available Offers",(0,b.jsx)(m.E,{variant:"secondary",className:"text-[10px]",children:u.length})]}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground",children:"Apply at checkout"})]})]})}),(0,b.jsxs)("div",{className:"p-3 space-y-2",children:[(0,b.jsx)(a.N,{children:N.map((e,t)=>(0,b.jsx)(j,{offer:e,onApply:o},e.id))}),u.length>2&&(0,b.jsxs)("button",{onClick:()=>w(!g),className:"w-full text-center text-xs text-violet-500 hover:text-violet-600 py-2 flex items-center justify-center gap-1",children:[g?"Show Less":"+".concat(u.length-2," more offers"),(0,b.jsx)(x.A,{className:"h-3 w-3 transition-transform ".concat(g?"rotate-90":"")})]})]})]})}},2678(e,t,n){n.d(t,{Du:()=>b,Ml:()=>y,lA:()=>w,sx:()=>x,xS:()=>N});var s=n(1882);const a="rayy_user_journey";let o=[],i=null,r=null,l=null,c={25:!1,50:!1,75:!1,100:!1},d=Date.now();function m(){let e=sessionStorage.getItem("rayy_session_id");return e||(e="s_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,8)),sessionStorage.setItem("rayy_session_id",e)),e}function u(){return localStorage.getItem("rayy_user_id")||null}function p(){const e=navigator.userAgent;return{platform:/iPad|iPhone|iPod/.test(e)?"ios":/Android/.test(e)?"android":"web",screen:"".concat(window.screen.width,"x").concat(window.screen.height),viewport:"".concat(window.innerWidth,"x").concat(window.innerHeight),standalone:window.matchMedia("(display-mode: standalone)").matches,touch:"ontouchstart"in window,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}function f(){const e=new URLSearchParams(window.location.search),t={};for(const n of["utm_source","utm_medium","utm_campaign","utm_content","utm_term","ref","gclid","fbclid"]){const s=e.get(n);s&&(t[n]=s)}return Object.keys(t).length>0&&sessionStorage.setItem("rayy_utm",JSON.stringify(t)),sessionStorage.getItem("rayy_utm")?JSON.parse(sessionStorage.getItem("rayy_utm")):null}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={event:e,properties:(0,s.A)((0,s.A)({},t),{},{page_path:window.location.pathname,page_title:document.title}),user_id:u(),session_id:m(),device:p(),utm:f(),timestamp:(new Date).toISOString(),url:window.location.href};o.push(n),function(e,t){try{const n=JSON.parse(sessionStorage.getItem(a)||"[]");n.push({event:e,timestamp:(new Date).toISOString(),path:window.location.pathname,properties:Object.keys(t).slice(0,5).reduce((e,n)=>(0,s.A)((0,s.A)({},e),{},{[n]:t[n]}),{})}),sessionStorage.setItem(a,JSON.stringify(n.slice(-100)))}catch(n){}}(e,t),d=Date.now(),o.length>=100?_():i||(i=setTimeout(_,5e3))}function h(){try{return JSON.parse(sessionStorage.getItem(a)||"[]")}catch(e){return[]}}function g(){return c[100]?100:c[75]?75:c[50]?50:c[25]?25:0}function v(){if("undefined"===typeof window)return;let e=!1;window.addEventListener("scroll",()=>{e||(window.requestAnimationFrame(()=>{!function(){const e=window.scrollY,t=document.documentElement.scrollHeight-window.innerHeight;if(t<=0)return;const n=Math.round(e/t*100),s=[25,50,75,100];for(const a of s)n>=a&&!c[a]&&(c[a]=!0,x("scroll_depth",{depth_percent:a,page_name:l}))}(),e=!1}),e=!0)},{passive:!0})}function w(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};x("listing_view",(0,s.A)({listing_id:e},t))}function y(){x("add_to_cart",arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}function N(){x("begin_checkout",arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}function b(){x("purchase",arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}async function _(){if(i&&(clearTimeout(i),i=null),0===o.length)return;const e=[...o];o=[];try{const{api:t}=await Promise.resolve().then(n.bind(n,6483));await t.post("/analytics/events",{events:e})}catch(t){o=[...e.slice(-100),...o].slice(0,100)}}"undefined"!==typeof window&&(v(),"undefined"!==typeof window&&document.addEventListener("click",e=>{var t,n;const s=e.target.closest("[data-testid], button, a, [role='button']");s&&x("element_click",{test_id:s.getAttribute("data-testid"),tag:s.tagName.toLowerCase(),text:null===(t=s.textContent)||void 0===t||null===(n=t.slice(0,50))||void 0===n?void 0:n.trim(),href:s.getAttribute("href"),page_name:l,x:e.clientX,y:e.clientY})},{passive:!0}),function(){if("undefined"===typeof window)return;let e=!1;document.addEventListener("mouseout",t=>
1{e||t.clientY<=0&&null===t.relatedTarget&&(e=!0,x("exit_intent",{page_name:l,time_on_page:r?Math.round((Date.now()-r)/1e3):0,scroll_depth:g()}),setTimeout(()=>{e=!1},3e4))})}(),x("app_open",{referrer:document.referrer||null,landing_page:window.location.pathname}),window.addEventListener("visibilitychange",()=>{if("hidden"===document.visibilityState){if(l&&r){const e=Math.round((Date.now()-r)/1e3);x("page_exit",{page_name:l,duration_seconds:e,scroll_depth:g()})}_()}}),window.addEventListener("beforeunload",()=>{if(l&&r){const e=Math.round((Date.now()-r)/1e3),t=JSON.stringify({events:[{event:"session_end",properties:{last_page:l,total_duration:e,journey_length:h().length},user_id:u(),session_id:m(),timestamp:(new Date).toISOString()}]}),n="https://api.rayy.io";navigator.sendBeacon("".concat(n,"/api/analytics/events"),t)}}))}}]); 2//# sourceMappingURL=965.cb80a91e.chunk.js.map
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.