@cleartrip/ct-platform-hotel-recommendations 1.10.0-beta.22 → 1.10.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("tslib"),a=require("react/jsx-runtime"),i=require("react"),o=require("@cleartrip/ct-platform-utils"),n=require("@cleartrip/ct-design-button"),t=require("@cleartrip/ct-platform-io-hoc"),r=require("@cleartrip/ct-design-typography"),d=require("@cleartrip/ct-platform-assets"),l=require("@cleartrip/ct-design-theme"),s=require("uuid"),c="https://fastui.cltpstatic.com/image/upload/f_auto,q_auto/offermgmt/images/banner/Image-placholder-1.jpg";function _(e,a){void 0===a&&(a={});var i=a.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var p="index-module_hRecoBanner__CyUB8",h="index-module_hRecoBannerIcon__cFmbk",u="index-module_hRecoBannerTextsWrapper__0P-pK",x="index-module_hRecoBannerTextRow__qbE8k",m="index-module_hRecoBannerImg__eC0hA";_(".index-module_hRecoBanner__CyUB8{aspect-ratio:304/180;background:#fff;border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);display:flex;height:180px;margin:0 16px 24px 40px;overflow:hidden;width:calc(100% - 56px)}.index-module_hRecoBannerIcon__cFmbk{margin-right:8px;min-width:16px;padding-top:1px}.index-module_hRecoBannerTextsWrapper__0P-pK{display:flex;flex-direction:column;justify-content:center;padding:18px 8px 18px 12px}.index-module_hRecoBannerTextRow__qbE8k{display:flex;padding-bottom:16px}.index-module_hRecoBannerTextRow__qbE8k:last-of-type{padding-bottom:0}.index-module_hRecoBannerImg__eC0hA{height:100%}");var g=function(){return a.jsxs("div",e.__assign({className:p},{children:[a.jsxs("div",e.__assign({className:u},{children:[a.jsxs("div",e.__assign({className:x},{children:[a.jsx(d.CheckIcon,{className:h}),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3},{children:"Free cancellation till check-in time"}))]})),a.jsxs("div",e.__assign({className:x},{children:[a.jsx(d.CheckIcon,{className:h}),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3},{children:"Exclusive member discount for Flipkart & Myntra"}))]})),a.jsxs("div",e.__assign({className:x},{children:[a.jsx(d.CheckIcon,{className:h}),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3},{children:"Earn and redeem SuperCoins"}))]}))]})),a.jsx("img",{src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_274,h_360/offermgmt/images/Hero-Image.png",className:m})]}))},v="index-module_hRecoCardWrapper__FhtJN",f="index-module_hRecoInfoWrapper__4EAyB",y="index-module_hRecoTitleRow__97dd5",R="index-module_hRecoTitle__3Uxkj",b="index-module_hRecoRatingWrapper__mGwia",C="index-module_hRecoPriceWrapper__49o5u",j="index-module_hRecoLoaderWrapper__KXG-6",k="index-module_hidden__CdBrr",N="index-module_hRecoLoaderGradient__c7400",w="index-module_hRecoLoaderTitleRow__cWktU",T="index-module_hRecoLoaderTitle__-Onou",L="index-module_hRecoLoaderRating__Qy5b-",B="index-module_hRecoLoaderSubtitle__l1X3H",W="index-module_hRecoLoaderPricing__KsQ-o";_(".index-module_hRecoCardWrapper__FhtJN{background:#fff;border-radius:16px;display:flex;flex-direction:column;height:180px;overflow:hidden;width:200px}.index-module_hRecoInfoWrapper__4EAyB{padding:8px 8px 0}.index-module_hRecoTitleRow__97dd5{display:flex;justify-content:space-between}.index-module_hRecoTitle__3Uxkj{padding-right:4px}.index-module_hRecoRatingWrapper__mGwia{align-items:center;background-color:#ecf3ff;border-radius:4px;box-sizing:border-box;display:flex;justify-content:center;margin-left:4px;min-width:28px;padding:0 4px}.index-module_hRecoPriceWrapper__49o5u{align-items:baseline;display:flex;padding:4px 8px 8px}.index-module_hRecoLoaderWrapper__KXG-6{opacity:1;pointer-events:none;position:absolute;top:0;transition:opacity .15s ease-in-out}.index-module_hRecoLoaderWrapper__KXG-6.index-module_hidden__CdBrr{opacity:0}.index-module_hRecoLoaderGradient__c7400{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%)}.index-module_hRecoLoaderTitleRow__cWktU{align-items:center;display:flex;margin-bottom:4px}.index-module_hRecoLoaderTitle__-Onou{border-radius:6px;height:20px;width:152px}.index-module_hRecoLoaderRating__Qy5b-{border-radius:6px;height:16px;margin-left:8px;width:20px}.index-module_hRecoLoaderSubtitle__l1X3H{border-radius:4px;height:8px;margin-bottom:8px;width:138px}.index-module_hRecoLoaderPricing__KsQ-o{border-radius:6px;height:16px;width:120px}");var P=function(i){var o=i.loading,n=i.priority,t=void 0===n?"low":n;return a.jsxs("div",e.__assign({className:"".concat(v," ").concat(j," ").concat(o?"":k)},{children:[a.jsx("img",{width:200,height:104,fetchPriority:t,src:c,alt:"Hotel recommendation placeholder"}),a.jsxs("div",e.__assign({className:f},{children:[a.jsxs("div",e.__assign({className:w},{children:[a.jsx("div",{className:"".concat(T," ").concat(N)}),a.jsx("div",{className:"".concat(L," ").concat(N)})]})),a.jsx("div",{className:"".concat(B," ").concat(N)}),a.jsx("div",{className:"".concat(W," ").concat(N)})]}))]}))},V=function(n){var d,l=n.rank,s=n.coupon,_=n.tripId,p=n.hotelId,h=n.vertical,u=n.location,x=n.pageName,m=n.abVariant,g=n.heroImage,j=n.staticData,k=n.pricingData,N=n.imgPriority,w=n.departureDate,T=n.hotelLandingUrl,L=n.onRecoCardClick,B=i.useRef(!1),W=i.useState("".concat("https://fastui.cltpstatic.com/image/upload/t_h_seo_srp/hotels/places/hotels/").concat(null==g?void 0:g.mediaUrl)),P=W[0],V=W[1],I=i.useCallback((function(){null==L||L(),o.ravenSDKTrigger("u_ui_action",{vertical:h,a_trip_id:_,h_hotel_rank:l,h_hotel_id:p,page_name:x,ab_variant:m,child_product:"hotel",a_destination:u,ct_coupon_applied:s,transaction_id_ca:_,onward_date:w,search_destination:u,a_departure_date:w,object_name:null==j?void 0:j.hotelName,h_hotel_name:null==j?void 0:j.hotelName,action_name:"hotel_cross_sell_click",personalised_callout:"hotel_card_click"}),T&&(window.location.href=T)}),[T]),H=i.useCallback((function(){B.current||(B.current=!0,V(c))}),[]),S=i.useCallback((function(){o.batchRavenEvent("u_impression",{vertical:h,a_trip_id:_,h_hotel_rank:l,h_hotel_id:p,page_name:x,ab_variant:m,child_product:"hotel",a_destination:u,ct_coupon_applied:s,transaction_id_ca:_,onward_date:w,search_destination:u,a_departure_date:w,object_name:null==j?void 0:j.hotelName,h_hotel_name:null==j?void 0:j.hotelName,action_name:"hotel_cross_sell_impression",personalised_callout:"hotel_card_impression"})}),[p]);return a.jsx(t.IntersectionObserverHOC,e.__assign({onIntersection:S},{children:a.jsxs("div",e.__assign({className:v,onClick:I},{children:[a.jsx("img",{width:200,height:104,src:P,onError:H,fetchPriority:N}),a.jsxs("div",e.__assign({className:f},{children:[a.jsxs("div",e.__assign({className:y},{children:[a.jsx(r.Typography,e.__assign({lineClamp:1,className:R,variant:r.TypographyVariant.B2},{children:null==j?void 0:j.hotelName})),(null==j?void 0:j.userRating)&&a.jsx("div",e.__assign({className:b},{children:a.jsx(r.Typography,e.__assign({color:"link",variant:r.TypographyVariant.B3},{children:null===(d=null==j?void 0:j.userRating)||void 0===d?void 0:d.toFixed(1)}))}))]})),a.jsxs(r.Typography,e.__assign({variant:r.TypographyVariant.P3,lineClamp:1,color:"subheading"},{children:[null==j?void 0:j.starRating," star hotel in"," ",null==j?void 0:j.locality]}))]})),a.jsxs("div",e.__assign({className:C},{children:[(null==k?void 0:k.perNightPrice)&&a.jsxs(r.Typography,e.__assign({variant:r.TypographyVariant.HM4},{children:[o.formatCurrency(k.perNightPrice)," "]})),(null==k?void 0:k.slashedPrice)&&a.jsx(r.Typography,e.__assign({isStriked:!0,color:"subheading",variant:r.TypographyVariant.B4},{children:o.formatCurrency(k.slashedPrice,!1)})),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.B4,color:"subheading"},{children:" / night"}))]}))]}))}))},I={hRecoWrapper:"index-module_hRecoWrapper__AeUoH",hRecoHeader:"index-module_hRecoHeader__5xuYV",hRecoContent:"index-module_hRecoContent__0kDhm",hRecoSidebar:"index-module_hRecoSidebar__UjWWx",connectedLine:"index-module_connectedLine__Z9VpQ",dottedLine:"index-module_dottedLine__6K0LJ",hRecoCardsWrapper:"index-module_hRecoCardsWrapper__tc4sW",hRecoCardWrapper:"index-module_hRecoCardWrapper__5lhlY",hRecoOfferCallout:"index-module_hRecoOfferCallout__FBOgY",hRecoCouponCallout:"index-module_hRecoCouponCallout__77bdL",hRecoBookingCallout:"index-module_hRecoBookingCallout__GGryo",exploreButton:"index-module_exploreButton__--vcq",sidebarCircle:"index-module_sidebarCircle__-dZZH",hRecoHeaderTextLoader:"index-module_hRecoHeaderTextLoader__tyYPe"};_(".index-module_hRecoWrapper__AeUoH{background:linear-gradient(215deg,#e5fce3 8%,#fff 85.78%);display:flex;padding:16px 0;position:relative}.index-module_hRecoHeader__5xuYV{left:8px;position:relative}.index-module_hRecoContent__0kDhm{left:0;position:absolute;width:100%}.index-module_hRecoSidebar__UjWWx{align-items:center;display:flex;flex-direction:column;padding-left:12px}.index-module_connectedLine__Z9VpQ{border-left:1px solid grey;height:18px;left:-.5px;opacity:.3;position:relative}.index-module_dottedLine__6K0LJ{border-left:1px dotted grey;height:272px;left:-.5px;opacity:.5;position:relative}.index-module_hRecoCardsWrapper__tc4sW{-ms-overflow-style:none;box-sizing:content-box;display:flex;height:180px;overflow:auto;padding:0 16px 16px 40px;scrollbar-width:none;width:calc(100% - 56px)}.index-module_hRecoCardWrapper__5lhlY{border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);margin-right:12px;min-width:200px;position:relative}.index-module_hRecoCardWrapper__5lhlY:last-child{margin-right:0}.index-module_hRecoCardsWrapper__tc4sW::-webkit-scrollbar{display:none}.index-module_hRecoOfferCallout__FBOgY{background:linear-gradient(90deg,#cafbcc 5.15%,rgba(212,255,218,.62) 41.66%,rgba(218,255,224,.23) 77.81%,hsla(0,0%,100%,0));border-radius:24px;padding:10px 12px}.index-module_hRecoCouponCallout__77bdL{padding:8px 0 20px}.index-module_hRecoBookingCallout__GGryo{padding-bottom:12px;padding-top:4px}.index-module_exploreButton__--vcq{left:40px;margin-top:8px;position:relative;width:calc(100% - 56px)}.index-module_sidebarCircle__-dZZH{border:1px solid #1a1a1a;border-radius:50%;height:8px;width:8px}.index-module_hRecoHeaderTextLoader__tyYPe{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%);border-radius:4px}");var H=function(d){var l=d.data,s=d.tripId,c=d.loading,_=d.pageName,p=d.vertical,h=d.location,u=d.abVariant,x=d.maxCardsCount,m=d.departureDate,v=d.destroyLoaders,f=d.fallbackPageLandingURL,y=d.ctaTitle,R=void 0===y?"View all hotels":y,b=d.triggerViewTransitionOnClick,C=i.useState(!1),j=C[0],k=C[1],N=i.useMemo((function(){return o.formatFullDateString(m)}),[m]),w=i.useMemo((function(){var i,o,n=null!==(o=null===(i=null==l?void 0:l.recommendations)||void 0===i?void 0:i.length)&&void 0!==o?o:0,t=Array.from({length:x},(function(e,a){return a+1}));return c||n>=2?a.jsx("div",e.__assign({className:I.hRecoCardsWrapper},{children:t.map((function(i,o){var n,t,r;return c||!v||(null===(n=null==l?void 0:l.recommendations)||void 0===n?void 0:n[o])?a.jsxs("div",e.__assign({className:I.hRecoCardWrapper},{children:[(null===(t=null==l?void 0:l.recommendations)||void 0===t?void 0:t[o])&&a.jsx(V,e.__assign({tripId:s,rank:o+1,location:h,pageName:_,vertical:p,abVariant:u,coupon:null==l?void 0:l.couponCode,departureDate:N},null===(r=null==l?void 0:l.recommendations)||void 0===r?void 0:r[o],{imgPriority:0===o?"high":"auto",onRecoCardClick:b})),!v&&a.jsx(P,{loading:c,priority:0===o?"high":"auto"})]}),i):a.jsx(a.Fragment,{})}))})):a.jsx(g,{})}),[l,c,v]),T=i.useCallback((function(){k(!0)}),[]),L=i.useCallback((function(){var e,a,i;null==b||b();var n=null!==(a=null===(e=null==l?void 0:l.recommendations)||void 0===e?void 0:e.length)&&void 0!==a?a:0;o.ravenSDKTrigger("u_ui_action",{vertical:p,a_trip_id:s,page_name:_,action_type:"click",ab_variant:u,child_product:"hotel",a_destination:h,transaction_id_ca:s,onward_date:N,search_destination:h,a_departure_date:N,action_name:"hotel_cross_sell_click",personalised_callout:"Book hotel now",result_count:n<x?n:x});var t=null!==(i=null==l?void 0:l.pageLandingUrl)&&void 0!==i?i:f;t&&(window.location.href=t)}),[l]);return i.useEffect((function(){var e,a;if(j&&!c){var i=null!==(a=null===(e=null==l?void 0:l.recommendations)||void 0===e?void 0:e.length)&&void 0!==a?a:0;o.batchRavenEvent("u_impression",{vertical:p,a_trip_id:s,page_name:_,ab_variant:u,child_product:"hotel",a_destination:h,transaction_id_ca:s,onward_date:N,search_destination:h,a_departure_date:N,action_name:"hotel_cross_sell_impression",result_count:i<x?i:x})}}),[c,l,j]),a.jsx(t.IntersectionObserverHOC,e.__assign({onIntersection:T},{children:a.jsxs("div",e.__assign({className:I.hRecoWrapper},{children:[a.jsxs("div",e.__assign({className:I.hRecoSidebar},{children:[a.jsx("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Flight%20%281%29.png",fetchPriority:"low"}),a.jsx("div",{className:I.connectedLine}),a.jsx("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Gift%20%281%29.png",fetchPriority:"low"}),a.jsx("div",{className:I.dottedLine}),a.jsx("div",{className:I.sidebarCircle})]})),a.jsxs("div",e.__assign({className:I.hRecoMainWrapper},{children:[a.jsxs("div",e.__assign({className:I.hRecoHeader},{children:[c?a.jsx("div",e.__assign({style:{padding:"4px 0",marginBottom:"16px"}},{children:a.jsx("div",{className:I.hRecoHeaderTextLoader,style:{height:"8px",width:"170px"}})})):a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3,className:I.hRecoBookingCallout},{children:null==l?void 0:l.bookingCallOut})),c?a.jsx("div",e.__assign({style:{padding:"8px 0 6px",marginBottom:"8px"}},{children:a.jsx("div",{className:I.hRecoHeaderTextLoader,style:{height:"18px",width:"270px"}})})):a.jsx("div",e.__assign({className:I.hRecoOfferCallout},{children:a.jsx(r.Typography,e.__assign({color:"success",variant:r.TypographyVariant.B4CAPS},{children:null==l?void 0:l.offerCallOut}))})),c?a.jsx("div",e.__assign({style:{marginBottom:"24px"}},{children:a.jsx("div",{className:I.hRecoHeaderTextLoader,style:{height:"16px",width:"260px"}})})):a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.HM4,className:I.hRecoCouponCallout},{children:null==l?void 0:l.couponCallOut}))]})),a.jsxs("div",e.__assign({className:I.hRecoContent},{children:[w,a.jsx(n.Button,e.__assign({disabled:c,onClick:L,variant:n.ButtonVariant.OUTLINE,className:I.exploreButton},{children:R}))]}))]}))]}))}))};exports.HotelRecoPlaceholderImg=c,exports.HotelRecommendationContainer=function(n){var t=n.location,r=n.pageName,d=n.abVariant,c=n.cutoff,_=void 0===c?450:c,p=n.vertical,h=void 0===p?"AIR":p,u=n.fallbackPageLandingURL,x=n.maxCardsCount,m=void 0===x?5:x,g=n.triggerViewTransition,v=e.__rest(n,["location","pageName","abVariant","cutoff","vertical","fallbackPageLandingURL","maxCardsCount","triggerViewTransition"]),f=i.useState(!0),y=f[0],R=f[1],b=i.useState(!1),C=b[0],j=b[1],k=i.useState(),N=k[0],w=k[1],T=i.useCallback((function(a){var i;return e.__assign(e.__assign({},a),{bookingCallOut:t?"Since you are flying to ".concat(t,"!"):"Since you are flying for your trip",recommendations:null!==(i=a.recommendations)&&void 0!==i?i:[]})}),[]);return i.useEffect((function(){var e,a=u||"",i=o.extractQueryParamsAsObj(a),n=i.locationCode,t=void 0===n?"":n,r=i.baseLocation,d=void 0===r?"":r,l=i.chk_in,c=void 0===l?"":l,p=i.chk_out,x=void 0===p?"":p,m={destinationCode:t||(null===(e=d.split("-"))||void 0===e?void 0:e[1])||"",hotelId:"",checkInDate:c,checkOutDate:x,paxInfo:[{adults:{count:2,metadata:[]},children:{count:0,metadata:[]}}]};o.setCookie({cookieName:"hotelsSC",cookieValue:JSON.stringify(m),expiryInDay:1}),o.setCookie({cookieName:"x-lineage-id",cookieValue:s.v4(),expiryInDay:1}),o.getHotelCrossSellRecos(h,u,_).then((function(e){var a=T(e);w(a),setTimeout((function(){R(!1)}),10),setTimeout((function(){j(!0)}),180)}))}),[]),a.jsx(l.ThemeProvider,{children:a.jsx(H,e.__assign({data:N,loading:y,pageName:r,vertical:h,location:t,abVariant:d,maxCardsCount:m,destroyLoaders:C,fallbackPageLandingURL:u,triggerViewTransitionOnClick:g},v))})},exports.HotelRecommendationsWidget=H;
1
+ "use strict";var e=require("tslib"),a=require("react/jsx-runtime"),i=require("react"),o=require("@cleartrip/ct-platform-utils"),n=require("@cleartrip/ct-design-button"),t=require("@cleartrip/ct-platform-io-hoc"),r=require("@cleartrip/ct-design-typography"),d=require("@cleartrip/ct-platform-assets"),l=require("@cleartrip/ct-design-theme"),s=require("uuid"),c="https://fastui.cltpstatic.com/image/upload/f_auto,q_auto/offermgmt/images/banner/Image-placholder-1.jpg";function _(e,a){void 0===a&&(a={});var i=a.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var p="index-module_hRecoBanner__C4cX5",h="index-module_hRecoBannerIcon__FqS9c",u="index-module_hRecoBannerTextsWrapper__i7eza",x="index-module_hRecoBannerTextRow__dAYvH",m="index-module_hRecoBannerImg__CnjlE";_(".index-module_hRecoBanner__C4cX5{aspect-ratio:304/180;background:#fff;border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);display:flex;height:180px;margin:0 16px 24px 40px;overflow:hidden;width:calc(100% - 56px)}.index-module_hRecoBannerIcon__FqS9c{margin-right:8px;min-width:16px;padding-top:1px}.index-module_hRecoBannerTextsWrapper__i7eza{display:flex;flex-direction:column;justify-content:center;padding:18px 8px 18px 12px}.index-module_hRecoBannerTextRow__dAYvH{display:flex;padding-bottom:16px}.index-module_hRecoBannerTextRow__dAYvH:last-of-type{padding-bottom:0}.index-module_hRecoBannerImg__CnjlE{height:100%}");var g=function(){return a.jsxs("div",e.__assign({className:p},{children:[a.jsxs("div",e.__assign({className:u},{children:[a.jsxs("div",e.__assign({className:x},{children:[a.jsx(d.CheckIcon,{className:h}),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3},{children:"Free cancellation till check-in time"}))]})),a.jsxs("div",e.__assign({className:x},{children:[a.jsx(d.CheckIcon,{className:h}),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3},{children:"Exclusive member discount for Flipkart & Myntra"}))]})),a.jsxs("div",e.__assign({className:x},{children:[a.jsx(d.CheckIcon,{className:h}),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3},{children:"Earn and redeem SuperCoins"}))]}))]})),a.jsx("img",{src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_274,h_360/offermgmt/images/Hero-Image.png",className:m})]}))},v="index-module_hRecoCardWrapper__TJ8B3",f="index-module_hRecoInfoWrapper__5eV6Y",y="index-module_hRecoTitleRow__TM1b7",R="index-module_hRecoTitle__eo77E",b="index-module_hRecoRatingWrapper__7P6j5",C="index-module_hRecoPriceWrapper__sNFLP",j="index-module_hRecoLoaderWrapper__1CVM5",T="index-module_hidden__OoQJS",N="index-module_hRecoLoaderGradient__emhI2",k="index-module_hRecoLoaderTitleRow__BZenv",w="index-module_hRecoLoaderTitle__53iJf",L="index-module_hRecoLoaderRating__7Leyu",B="index-module_hRecoLoaderSubtitle__WncMd",P="index-module_hRecoLoaderPricing__jJD8g";_(".index-module_hRecoCardWrapper__TJ8B3{background:#fff;border-radius:16px;display:flex;flex-direction:column;height:180px;overflow:hidden;width:200px}.index-module_hRecoInfoWrapper__5eV6Y{padding:8px 8px 0}.index-module_hRecoTitleRow__TM1b7{display:flex;justify-content:space-between}.index-module_hRecoTitle__eo77E{padding-right:4px}.index-module_hRecoRatingWrapper__7P6j5{align-items:center;background-color:#ecf3ff;border-radius:4px;box-sizing:border-box;display:flex;justify-content:center;margin-left:4px;min-width:28px;padding:0 4px}.index-module_hRecoPriceWrapper__sNFLP{align-items:baseline;display:flex;padding:4px 8px 8px}.index-module_hRecoLoaderWrapper__1CVM5{opacity:1;pointer-events:none;position:absolute;top:0;transition:opacity .15s ease-in-out}.index-module_hRecoLoaderWrapper__1CVM5.index-module_hidden__OoQJS{opacity:0}.index-module_hRecoLoaderGradient__emhI2{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%)}.index-module_hRecoLoaderTitleRow__BZenv{align-items:center;display:flex;margin-bottom:4px}.index-module_hRecoLoaderTitle__53iJf{border-radius:6px;height:20px;width:152px}.index-module_hRecoLoaderRating__7Leyu{border-radius:6px;height:16px;margin-left:8px;width:20px}.index-module_hRecoLoaderSubtitle__WncMd{border-radius:4px;height:8px;margin-bottom:8px;width:138px}.index-module_hRecoLoaderPricing__jJD8g{border-radius:6px;height:16px;width:120px}");var I=function(i){var o=i.loading,n=i.priority,t=void 0===n?"low":n;return a.jsxs("div",e.__assign({className:"".concat(v," ").concat(j," ").concat(o?"":T)},{children:[a.jsx("img",{width:200,height:104,fetchPriority:t,src:c,alt:"Hotel recommendation placeholder"}),a.jsxs("div",e.__assign({className:f},{children:[a.jsxs("div",e.__assign({className:k},{children:[a.jsx("div",{className:"".concat(w," ").concat(N)}),a.jsx("div",{className:"".concat(L," ").concat(N)})]})),a.jsx("div",{className:"".concat(B," ").concat(N)}),a.jsx("div",{className:"".concat(P," ").concat(N)})]}))]}))},V=function(n){var d,l=n.rank,s=n.coupon,_=n.tripId,p=n.hotelId,h=n.vertical,u=n.location,x=n.pageName,m=n.abVariant,g=n.heroImage,j=n.staticData,T=n.pricingData,N=n.imgPriority,k=n.departureDate,w=n.hotelLandingUrl,L=n.onRecoCardClick,B=i.useRef(!1),P=i.useState("".concat("https://fastui.cltpstatic.com/image/upload/t_h_seo_srp/hotels/places/hotels/").concat(null==g?void 0:g.mediaUrl)),I=P[0],V=P[1],W=i.useCallback((function(){null==L||L(),o.ravenSDKTrigger("u_ui_action",{vertical:h,a_trip_id:_,h_hotel_rank:l,h_hotel_id:p,page_name:x,ab_variant:m,child_product:"hotel",a_destination:u,ct_coupon_applied:s,transaction_id_ca:_,onward_date:k,search_destination:u,a_departure_date:k,object_name:null==j?void 0:j.hotelName,h_hotel_name:null==j?void 0:j.hotelName,action_name:"hotel_cross_sell_click",personalised_callout:"hotel_card_click"}),w&&(window.location.href=w)}),[w]),S=i.useCallback((function(){B.current||(B.current=!0,V(c))}),[]),H=i.useCallback((function(){o.batchRavenEvent("u_impression",{vertical:h,a_trip_id:_,h_hotel_rank:l,h_hotel_id:p,page_name:x,ab_variant:m,child_product:"hotel",a_destination:u,ct_coupon_applied:s,transaction_id_ca:_,onward_date:k,search_destination:u,a_departure_date:k,object_name:null==j?void 0:j.hotelName,h_hotel_name:null==j?void 0:j.hotelName,action_name:"hotel_cross_sell_impression",personalised_callout:"hotel_card_impression"})}),[p]);return a.jsx(t.IntersectionObserverHOC,e.__assign({onIntersection:H},{children:a.jsxs("div",e.__assign({className:v,onClick:W},{children:[a.jsx("img",{width:200,height:104,src:I,onError:S,fetchPriority:N}),a.jsxs("div",e.__assign({className:f},{children:[a.jsxs("div",e.__assign({className:y},{children:[a.jsx(r.Typography,e.__assign({lineClamp:1,className:R,variant:r.TypographyVariant.B2},{children:null==j?void 0:j.hotelName})),(null==j?void 0:j.userRating)&&a.jsx("div",e.__assign({className:b},{children:a.jsx(r.Typography,e.__assign({color:"link",variant:r.TypographyVariant.B3},{children:null===(d=null==j?void 0:j.userRating)||void 0===d?void 0:d.toFixed(1)}))}))]})),a.jsxs(r.Typography,e.__assign({variant:r.TypographyVariant.P3,lineClamp:1,color:"subheading"},{children:[null==j?void 0:j.starRating," star hotel in"," ",null==j?void 0:j.locality]}))]})),a.jsxs("div",e.__assign({className:C},{children:[(null==T?void 0:T.perNightPrice)&&a.jsxs(r.Typography,e.__assign({variant:r.TypographyVariant.HM4},{children:[o.formatCurrency(T.perNightPrice)," "]})),(null==T?void 0:T.slashedPrice)&&a.jsx(r.Typography,e.__assign({isStriked:!0,color:"subheading",variant:r.TypographyVariant.B4},{children:o.formatCurrency(T.slashedPrice,!1)})),a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.B4,color:"subheading"},{children:" / night"}))]}))]}))}))},W={hRecoWrapper:"index-module_hRecoWrapper__BYtDJ",hRecoHeader:"index-module_hRecoHeader__ryP5R",hRecoContent:"index-module_hRecoContent__HTEk-",hRecoSidebar:"index-module_hRecoSidebar__rnPDI",connectedLine:"index-module_connectedLine__7OYBV",dottedLine:"index-module_dottedLine__t7fxL",hRecoCardsWrapper:"index-module_hRecoCardsWrapper__m3mDF",hRecoCardWrapper:"index-module_hRecoCardWrapper__7PrJr",hRecoOfferCallout:"index-module_hRecoOfferCallout__IIuQk",hRecoCouponCallout:"index-module_hRecoCouponCallout__sD6oN",hRecoBookingCallout:"index-module_hRecoBookingCallout__TtzWr",exploreButton:"index-module_exploreButton__Z1HXE",sidebarCircle:"index-module_sidebarCircle__-mzn4",hRecoHeaderTextLoader:"index-module_hRecoHeaderTextLoader__2pCib"};_(".index-module_hRecoWrapper__BYtDJ{background:linear-gradient(215deg,#e5fce3 8%,#fff 85.78%);display:flex;padding:16px 0;position:relative}.index-module_hRecoHeader__ryP5R{left:8px;position:relative}.index-module_hRecoContent__HTEk-{left:0;position:absolute;width:100%}.index-module_hRecoSidebar__rnPDI{align-items:center;display:flex;flex-direction:column;padding-left:12px}.index-module_connectedLine__7OYBV{border-left:1px solid grey;height:18px;left:-.5px;opacity:.3;position:relative}.index-module_dottedLine__t7fxL{border-left:1px dotted grey;height:272px;left:-.5px;opacity:.5;position:relative}.index-module_hRecoCardsWrapper__m3mDF{-ms-overflow-style:none;box-sizing:content-box;display:flex;height:180px;overflow:auto;padding:0 16px 16px 40px;scrollbar-width:none;width:calc(100% - 56px)}.index-module_hRecoCardWrapper__7PrJr{border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);margin-right:12px;min-width:200px;position:relative}.index-module_hRecoCardWrapper__7PrJr:last-child{margin-right:0}.index-module_hRecoCardsWrapper__m3mDF::-webkit-scrollbar{display:none}.index-module_hRecoOfferCallout__IIuQk{background:linear-gradient(90deg,#cafbcc 5.15%,rgba(212,255,218,.62) 41.66%,rgba(218,255,224,.23) 77.81%,hsla(0,0%,100%,0));border-radius:24px;padding:10px 12px}.index-module_hRecoCouponCallout__sD6oN{padding:8px 0 20px}.index-module_hRecoBookingCallout__TtzWr{padding-bottom:12px;padding-top:4px}.index-module_exploreButton__Z1HXE{left:40px;margin-top:8px;position:relative;width:calc(100% - 56px)}.index-module_sidebarCircle__-mzn4{border:1px solid #1a1a1a;border-radius:50%;height:8px;width:8px}.index-module_hRecoHeaderTextLoader__2pCib{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%);border-radius:4px}");var S=function(d){var l=d.data,s=d.tripId,c=d.loading,_=d.pageName,p=d.vertical,h=d.location,u=d.abVariant,x=d.maxCardsCount,m=d.departureDate,v=d.destroyLoaders,f=d.fallbackPageLandingURL,y=d.ctaTitle,R=void 0===y?"View all hotels":y,b=d.triggerViewTransitionOnClick,C=i.useState(!1),j=C[0],T=C[1],N=i.useMemo((function(){return o.formatFullDateString(m)}),[m]),k=i.useMemo((function(){var i,o,n=null!==(o=null===(i=null==l?void 0:l.recommendations)||void 0===i?void 0:i.length)&&void 0!==o?o:0,t=Array.from({length:x},(function(e,a){return a+1}));return c||n>=2?a.jsx("div",e.__assign({className:W.hRecoCardsWrapper},{children:t.map((function(i,o){var n,t,r;return c||!v||(null===(n=null==l?void 0:l.recommendations)||void 0===n?void 0:n[o])?a.jsxs("div",e.__assign({className:W.hRecoCardWrapper},{children:[(null===(t=null==l?void 0:l.recommendations)||void 0===t?void 0:t[o])&&a.jsx(V,e.__assign({tripId:s,rank:o+1,location:h,pageName:_,vertical:p,abVariant:u,coupon:null==l?void 0:l.couponCode,departureDate:N},null===(r=null==l?void 0:l.recommendations)||void 0===r?void 0:r[o],{imgPriority:0===o?"high":"auto",onRecoCardClick:b})),!v&&a.jsx(I,{loading:c,priority:0===o?"high":"auto"})]}),i):a.jsx(a.Fragment,{})}))})):a.jsx(g,{})}),[l,c,v]),w=i.useCallback((function(){T(!0)}),[]),L=i.useCallback((function(){var e,a,i;null==b||b();var n=null!==(a=null===(e=null==l?void 0:l.recommendations)||void 0===e?void 0:e.length)&&void 0!==a?a:0;o.ravenSDKTrigger("u_ui_action",{vertical:p,a_trip_id:s,page_name:_,action_type:"click",ab_variant:u,child_product:"hotel",a_destination:h,transaction_id_ca:s,onward_date:N,search_destination:h,a_departure_date:N,action_name:"hotel_cross_sell_click",personalised_callout:"Book hotel now",result_count:n<x?n:x});var t=null!==(i=null==l?void 0:l.pageLandingUrl)&&void 0!==i?i:f;t&&(window.location.href=t)}),[l]);return i.useEffect((function(){var e,a;if(j&&!c){var i=null!==(a=null===(e=null==l?void 0:l.recommendations)||void 0===e?void 0:e.length)&&void 0!==a?a:0;o.batchRavenEvent("u_impression",{vertical:p,a_trip_id:s,page_name:_,ab_variant:u,child_product:"hotel",a_destination:h,transaction_id_ca:s,onward_date:N,search_destination:h,a_departure_date:N,action_name:"hotel_cross_sell_impression",result_count:i<x?i:x})}}),[c,l,j]),a.jsx(t.IntersectionObserverHOC,e.__assign({onIntersection:w},{children:a.jsxs("div",e.__assign({className:W.hRecoWrapper},{children:[a.jsxs("div",e.__assign({className:W.hRecoSidebar},{children:[a.jsx("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Flight%20%281%29.png",fetchPriority:"low"}),a.jsx("div",{className:W.connectedLine}),a.jsx("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Gift%20%281%29.png",fetchPriority:"low"}),a.jsx("div",{className:W.dottedLine}),a.jsx("div",{className:W.sidebarCircle})]})),a.jsxs("div",e.__assign({className:W.hRecoMainWrapper},{children:[a.jsxs("div",e.__assign({className:W.hRecoHeader},{children:[c?a.jsx("div",e.__assign({style:{padding:"4px 0",marginBottom:"16px"}},{children:a.jsx("div",{className:W.hRecoHeaderTextLoader,style:{height:"8px",width:"170px"}})})):a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.P3,className:W.hRecoBookingCallout},{children:null==l?void 0:l.bookingCallOut})),c?a.jsx("div",e.__assign({style:{padding:"8px 0 6px",marginBottom:"8px"}},{children:a.jsx("div",{className:W.hRecoHeaderTextLoader,style:{height:"18px",width:"270px"}})})):a.jsx("div",e.__assign({className:W.hRecoOfferCallout},{children:a.jsx(r.Typography,e.__assign({color:"success",variant:r.TypographyVariant.B4CAPS},{children:null==l?void 0:l.offerCallOut}))})),c?a.jsx("div",e.__assign({style:{marginBottom:"24px"}},{children:a.jsx("div",{className:W.hRecoHeaderTextLoader,style:{height:"16px",width:"260px"}})})):a.jsx(r.Typography,e.__assign({variant:r.TypographyVariant.HM4,className:W.hRecoCouponCallout},{children:null==l?void 0:l.couponCallOut}))]})),a.jsxs("div",e.__assign({className:W.hRecoContent},{children:[k,a.jsx(n.Button,e.__assign({disabled:c,onClick:L,variant:n.ButtonVariant.OUTLINE,className:W.exploreButton},{children:R}))]}))]}))]}))}))};exports.HotelRecoPlaceholderImg=c,exports.HotelRecommendationContainer=function(n){var t=n.location,r=n.pageName,d=n.abVariant,c=n.cutoff,_=void 0===c?450:c,p=n.vertical,h=void 0===p?"AIR":p,u=n.fallbackPageLandingURL,x=n.maxCardsCount,m=void 0===x?5:x,g=n.triggerViewTransition,v=e.__rest(n,["location","pageName","abVariant","cutoff","vertical","fallbackPageLandingURL","maxCardsCount","triggerViewTransition"]),f=i.useState(!0),y=f[0],R=f[1],b=i.useState(!1),C=b[0],j=b[1],T=i.useState(),N=T[0],k=T[1],w=i.useCallback((function(a){var i;return e.__assign(e.__assign({},a),{bookingCallOut:t?"Since you are flying to ".concat(t,"!"):"Since you are flying for your trip",recommendations:null!==(i=a.recommendations)&&void 0!==i?i:[]})}),[]);return i.useEffect((function(){var e,a=u||"",i=o.extractQueryParamsAsObj(a),n=i.locationCode,t=void 0===n?"":n,r=i.baseLocation,d=void 0===r?"":r,l=i.chk_in,c=void 0===l?"":l,p=i.chk_out,x=void 0===p?"":p,m={destinationCode:t||(null===(e=d.split("-"))||void 0===e?void 0:e[1])||"",hotelId:"",checkInDate:c,checkOutDate:x,paxInfo:[{adults:{count:2,metadata:[]},children:{count:0,metadata:[]}}]};o.setCookie({cookieName:"hotelsSC",cookieValue:JSON.stringify(m),expiryInDay:1}),o.setCookie({cookieName:"x-lineage-id",cookieValue:s.v4(),expiryInDay:1}),o.getHotelCrossSellRecos(h,u,_).then((function(e){var a=w(e);k(a),setTimeout((function(){R(!1)}),10),setTimeout((function(){j(!0)}),180)}))}),[]),a.jsx(l.ThemeProvider,{children:a.jsx(S,e.__assign({data:N,loading:y,pageName:r,vertical:h,location:t,abVariant:d,maxCardsCount:m,destroyLoaders:C,fallbackPageLandingURL:u,triggerViewTransitionOnClick:g},v))})},exports.HotelRecommendationsWidget=S;
2
2
  //# sourceMappingURL=ct-platform-hotel-recommendations.cjs.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__rest as i}from"tslib";import{jsxs as o,jsx as a,Fragment as t}from"react/jsx-runtime";import{useRef as n,useState as d,useCallback as r,useMemo as l,useEffect as c}from"react";import{ravenSDKTrigger as _,batchRavenEvent as p,formatCurrency as s,formatFullDateString as h,extractQueryParamsAsObj as u,setCookie as m,getHotelCrossSellRecos as x}from"@cleartrip/ct-platform-utils";import{Button as g,ButtonVariant as f}from"@cleartrip/ct-design-button";import{IntersectionObserverHOC as v}from"@cleartrip/ct-platform-io-hoc";import{Typography as R,TypographyVariant as b}from"@cleartrip/ct-design-typography";import{CheckIcon as C}from"@cleartrip/ct-platform-assets";import{ThemeProvider as y}from"@cleartrip/ct-design-theme";import{v4 as N}from"uuid";var w="https://fastui.cltpstatic.com/image/upload/f_auto,q_auto/offermgmt/images/banner/Image-placholder-1.jpg";function k(e,i){void 0===i&&(i={});var o=i.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===o&&a.firstChild?a.insertBefore(t,a.firstChild):a.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}}var L="index-module_hRecoBanner__CyUB8",B="index-module_hRecoBannerIcon__cFmbk",W="index-module_hRecoBannerTextsWrapper__0P-pK",T="index-module_hRecoBannerTextRow__qbE8k",P="index-module_hRecoBannerImg__eC0hA";k(".index-module_hRecoBanner__CyUB8{aspect-ratio:304/180;background:#fff;border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);display:flex;height:180px;margin:0 16px 24px 40px;overflow:hidden;width:calc(100% - 56px)}.index-module_hRecoBannerIcon__cFmbk{margin-right:8px;min-width:16px;padding-top:1px}.index-module_hRecoBannerTextsWrapper__0P-pK{display:flex;flex-direction:column;justify-content:center;padding:18px 8px 18px 12px}.index-module_hRecoBannerTextRow__qbE8k{display:flex;padding-bottom:16px}.index-module_hRecoBannerTextRow__qbE8k:last-of-type{padding-bottom:0}.index-module_hRecoBannerImg__eC0hA{height:100%}");var H=function(){return o("div",e({className:L},{children:[o("div",e({className:W},{children:[o("div",e({className:T},{children:[a(C,{className:B}),a(R,e({variant:b.P3},{children:"Free cancellation till check-in time"}))]})),o("div",e({className:T},{children:[a(C,{className:B}),a(R,e({variant:b.P3},{children:"Exclusive member discount for Flipkart & Myntra"}))]})),o("div",e({className:T},{children:[a(C,{className:B}),a(R,e({variant:b.P3},{children:"Earn and redeem SuperCoins"}))]}))]})),a("img",{src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_274,h_360/offermgmt/images/Hero-Image.png",className:P})]}))},I="index-module_hRecoCardWrapper__FhtJN",U="index-module_hRecoInfoWrapper__4EAyB",O="index-module_hRecoTitleRow__97dd5",V="index-module_hRecoTitle__3Uxkj",S="index-module_hRecoRatingWrapper__mGwia",G="index-module_hRecoPriceWrapper__49o5u",j="index-module_hRecoLoaderWrapper__KXG-6",D="index-module_hidden__CdBrr",E="index-module_hRecoLoaderGradient__c7400",A="index-module_hRecoLoaderTitleRow__cWktU",F="index-module_hRecoLoaderTitle__-Onou",q="index-module_hRecoLoaderRating__Qy5b-",K="index-module_hRecoLoaderSubtitle__l1X3H",Y="index-module_hRecoLoaderPricing__KsQ-o";k(".index-module_hRecoCardWrapper__FhtJN{background:#fff;border-radius:16px;display:flex;flex-direction:column;height:180px;overflow:hidden;width:200px}.index-module_hRecoInfoWrapper__4EAyB{padding:8px 8px 0}.index-module_hRecoTitleRow__97dd5{display:flex;justify-content:space-between}.index-module_hRecoTitle__3Uxkj{padding-right:4px}.index-module_hRecoRatingWrapper__mGwia{align-items:center;background-color:#ecf3ff;border-radius:4px;box-sizing:border-box;display:flex;justify-content:center;margin-left:4px;min-width:28px;padding:0 4px}.index-module_hRecoPriceWrapper__49o5u{align-items:baseline;display:flex;padding:4px 8px 8px}.index-module_hRecoLoaderWrapper__KXG-6{opacity:1;pointer-events:none;position:absolute;top:0;transition:opacity .15s ease-in-out}.index-module_hRecoLoaderWrapper__KXG-6.index-module_hidden__CdBrr{opacity:0}.index-module_hRecoLoaderGradient__c7400{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%)}.index-module_hRecoLoaderTitleRow__cWktU{align-items:center;display:flex;margin-bottom:4px}.index-module_hRecoLoaderTitle__-Onou{border-radius:6px;height:20px;width:152px}.index-module_hRecoLoaderRating__Qy5b-{border-radius:6px;height:16px;margin-left:8px;width:20px}.index-module_hRecoLoaderSubtitle__l1X3H{border-radius:4px;height:8px;margin-bottom:8px;width:138px}.index-module_hRecoLoaderPricing__KsQ-o{border-radius:6px;height:16px;width:120px}");var Q=function(i){var t=i.loading,n=i.priority,d=void 0===n?"low":n;return o("div",e({className:"".concat(I," ").concat(j," ").concat(t?"":D)},{children:[a("img",{width:200,height:104,fetchPriority:d,src:w,alt:"Hotel recommendation placeholder"}),o("div",e({className:U},{children:[o("div",e({className:A},{children:[a("div",{className:"".concat(F," ").concat(E)}),a("div",{className:"".concat(q," ").concat(E)})]})),a("div",{className:"".concat(K," ").concat(E)}),a("div",{className:"".concat(Y," ").concat(E)})]}))]}))},Z=function(i){var t,l=i.rank,c=i.coupon,h=i.tripId,u=i.hotelId,m=i.vertical,x=i.location,g=i.pageName,f=i.abVariant,C=i.heroImage,y=i.staticData,N=i.pricingData,k=i.imgPriority,L=i.departureDate,B=i.hotelLandingUrl,W=i.onRecoCardClick,T=n(!1),P=d("".concat("https://fastui.cltpstatic.com/image/upload/t_h_seo_srp/hotels/places/hotels/").concat(null==C?void 0:C.mediaUrl)),H=P[0],j=P[1],D=r((function(){null==W||W(),_("u_ui_action",{vertical:m,a_trip_id:h,h_hotel_rank:l,h_hotel_id:u,page_name:g,ab_variant:f,child_product:"hotel",a_destination:x,ct_coupon_applied:c,transaction_id_ca:h,onward_date:L,search_destination:x,a_departure_date:L,object_name:null==y?void 0:y.hotelName,h_hotel_name:null==y?void 0:y.hotelName,action_name:"hotel_cross_sell_click",personalised_callout:"hotel_card_click"}),B&&(window.location.href=B)}),[B]),E=r((function(){T.current||(T.current=!0,j(w))}),[]),A=r((function(){p("u_impression",{vertical:m,a_trip_id:h,h_hotel_rank:l,h_hotel_id:u,page_name:g,ab_variant:f,child_product:"hotel",a_destination:x,ct_coupon_applied:c,transaction_id_ca:h,onward_date:L,search_destination:x,a_departure_date:L,object_name:null==y?void 0:y.hotelName,h_hotel_name:null==y?void 0:y.hotelName,action_name:"hotel_cross_sell_impression",personalised_callout:"hotel_card_impression"})}),[u]);return a(v,e({onIntersection:A},{children:o("div",e({className:I,onClick:D},{children:[a("img",{width:200,height:104,src:H,onError:E,fetchPriority:k}),o("div",e({className:U},{children:[o("div",e({className:O},{children:[a(R,e({lineClamp:1,className:V,variant:b.B2},{children:null==y?void 0:y.hotelName})),(null==y?void 0:y.userRating)&&a("div",e({className:S},{children:a(R,e({color:"link",variant:b.B3},{children:null===(t=null==y?void 0:y.userRating)||void 0===t?void 0:t.toFixed(1)}))}))]})),o(R,e({variant:b.P3,lineClamp:1,color:"subheading"},{children:[null==y?void 0:y.starRating," star hotel in"," ",null==y?void 0:y.locality]}))]})),o("div",e({className:G},{children:[(null==N?void 0:N.perNightPrice)&&o(R,e({variant:b.HM4},{children:[s(N.perNightPrice)," "]})),(null==N?void 0:N.slashedPrice)&&a(R,e({isStriked:!0,color:"subheading",variant:b.B4},{children:s(N.slashedPrice,!1)})),a(R,e({variant:b.B4,color:"subheading"},{children:" / night"}))]}))]}))}))},J={hRecoWrapper:"index-module_hRecoWrapper__AeUoH",hRecoHeader:"index-module_hRecoHeader__5xuYV",hRecoContent:"index-module_hRecoContent__0kDhm",hRecoSidebar:"index-module_hRecoSidebar__UjWWx",connectedLine:"index-module_connectedLine__Z9VpQ",dottedLine:"index-module_dottedLine__6K0LJ",hRecoCardsWrapper:"index-module_hRecoCardsWrapper__tc4sW",hRecoCardWrapper:"index-module_hRecoCardWrapper__5lhlY",hRecoOfferCallout:"index-module_hRecoOfferCallout__FBOgY",hRecoCouponCallout:"index-module_hRecoCouponCallout__77bdL",hRecoBookingCallout:"index-module_hRecoBookingCallout__GGryo",exploreButton:"index-module_exploreButton__--vcq",sidebarCircle:"index-module_sidebarCircle__-dZZH",hRecoHeaderTextLoader:"index-module_hRecoHeaderTextLoader__tyYPe"};k(".index-module_hRecoWrapper__AeUoH{background:linear-gradient(215deg,#e5fce3 8%,#fff 85.78%);display:flex;padding:16px 0;position:relative}.index-module_hRecoHeader__5xuYV{left:8px;position:relative}.index-module_hRecoContent__0kDhm{left:0;position:absolute;width:100%}.index-module_hRecoSidebar__UjWWx{align-items:center;display:flex;flex-direction:column;padding-left:12px}.index-module_connectedLine__Z9VpQ{border-left:1px solid grey;height:18px;left:-.5px;opacity:.3;position:relative}.index-module_dottedLine__6K0LJ{border-left:1px dotted grey;height:272px;left:-.5px;opacity:.5;position:relative}.index-module_hRecoCardsWrapper__tc4sW{-ms-overflow-style:none;box-sizing:content-box;display:flex;height:180px;overflow:auto;padding:0 16px 16px 40px;scrollbar-width:none;width:calc(100% - 56px)}.index-module_hRecoCardWrapper__5lhlY{border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);margin-right:12px;min-width:200px;position:relative}.index-module_hRecoCardWrapper__5lhlY:last-child{margin-right:0}.index-module_hRecoCardsWrapper__tc4sW::-webkit-scrollbar{display:none}.index-module_hRecoOfferCallout__FBOgY{background:linear-gradient(90deg,#cafbcc 5.15%,rgba(212,255,218,.62) 41.66%,rgba(218,255,224,.23) 77.81%,hsla(0,0%,100%,0));border-radius:24px;padding:10px 12px}.index-module_hRecoCouponCallout__77bdL{padding:8px 0 20px}.index-module_hRecoBookingCallout__GGryo{padding-bottom:12px;padding-top:4px}.index-module_exploreButton__--vcq{left:40px;margin-top:8px;position:relative;width:calc(100% - 56px)}.index-module_sidebarCircle__-dZZH{border:1px solid #1a1a1a;border-radius:50%;height:8px;width:8px}.index-module_hRecoHeaderTextLoader__tyYPe{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%);border-radius:4px}");var X=function(i){var n=i.data,s=i.tripId,u=i.loading,m=i.pageName,x=i.vertical,C=i.location,y=i.abVariant,N=i.maxCardsCount,w=i.departureDate,k=i.destroyLoaders,L=i.fallbackPageLandingURL,B=i.ctaTitle,W=void 0===B?"View all hotels":B,T=i.triggerViewTransitionOnClick,P=d(!1),I=P[0],U=P[1],O=l((function(){return h(w)}),[w]),V=l((function(){var i,d,r=null!==(d=null===(i=null==n?void 0:n.recommendations)||void 0===i?void 0:i.length)&&void 0!==d?d:0,l=Array.from({length:N},(function(e,i){return i+1}));return u||r>=2?a("div",e({className:J.hRecoCardsWrapper},{children:l.map((function(i,d){var r,l,c;return u||!k||(null===(r=null==n?void 0:n.recommendations)||void 0===r?void 0:r[d])?o("div",e({className:J.hRecoCardWrapper},{children:[(null===(l=null==n?void 0:n.recommendations)||void 0===l?void 0:l[d])&&a(Z,e({tripId:s,rank:d+1,location:C,pageName:m,vertical:x,abVariant:y,coupon:null==n?void 0:n.couponCode,departureDate:O},null===(c=null==n?void 0:n.recommendations)||void 0===c?void 0:c[d],{imgPriority:0===d?"high":"auto",onRecoCardClick:T})),!k&&a(Q,{loading:u,priority:0===d?"high":"auto"})]}),i):a(t,{})}))})):a(H,{})}),[n,u,k]),S=r((function(){U(!0)}),[]),G=r((function(){var e,i,o;null==T||T();var a=null!==(i=null===(e=null==n?void 0:n.recommendations)||void 0===e?void 0:e.length)&&void 0!==i?i:0;_("u_ui_action",{vertical:x,a_trip_id:s,page_name:m,action_type:"click",ab_variant:y,child_product:"hotel",a_destination:C,transaction_id_ca:s,onward_date:O,search_destination:C,a_departure_date:O,action_name:"hotel_cross_sell_click",personalised_callout:"Book hotel now",result_count:a<N?a:N});var t=null!==(o=null==n?void 0:n.pageLandingUrl)&&void 0!==o?o:L;t&&(window.location.href=t)}),[n]);return c((function(){var e,i;if(I&&!u){var o=null!==(i=null===(e=null==n?void 0:n.recommendations)||void 0===e?void 0:e.length)&&void 0!==i?i:0;p("u_impression",{vertical:x,a_trip_id:s,page_name:m,ab_variant:y,child_product:"hotel",a_destination:C,transaction_id_ca:s,onward_date:O,search_destination:C,a_departure_date:O,action_name:"hotel_cross_sell_impression",result_count:o<N?o:N})}}),[u,n,I]),a(v,e({onIntersection:S},{children:o("div",e({className:J.hRecoWrapper},{children:[o("div",e({className:J.hRecoSidebar},{children:[a("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Flight%20%281%29.png",fetchPriority:"low"}),a("div",{className:J.connectedLine}),a("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Gift%20%281%29.png",fetchPriority:"low"}),a("div",{className:J.dottedLine}),a("div",{className:J.sidebarCircle})]})),o("div",e({className:J.hRecoMainWrapper},{children:[o("div",e({className:J.hRecoHeader},{children:[u?a("div",e({style:{padding:"4px 0",marginBottom:"16px"}},{children:a("div",{className:J.hRecoHeaderTextLoader,style:{height:"8px",width:"170px"}})})):a(R,e({variant:b.P3,className:J.hRecoBookingCallout},{children:null==n?void 0:n.bookingCallOut})),a("div",u?e({style:{padding:"8px 0 6px",marginBottom:"8px"}},{children:a("div",{className:J.hRecoHeaderTextLoader,style:{height:"18px",width:"270px"}})}):e({className:J.hRecoOfferCallout},{children:a(R,e({color:"success",variant:b.B4CAPS},{children:null==n?void 0:n.offerCallOut}))})),u?a("div",e({style:{marginBottom:"24px"}},{children:a("div",{className:J.hRecoHeaderTextLoader,style:{height:"16px",width:"260px"}})})):a(R,e({variant:b.HM4,className:J.hRecoCouponCallout},{children:null==n?void 0:n.couponCallOut}))]})),o("div",e({className:J.hRecoContent},{children:[V,a(g,e({disabled:u,onClick:G,variant:f.OUTLINE,className:J.exploreButton},{children:W}))]}))]}))]}))}))},M=function(o){var t=o.location,n=o.pageName,l=o.abVariant,_=o.cutoff,p=void 0===_?450:_,s=o.vertical,h=void 0===s?"AIR":s,g=o.fallbackPageLandingURL,f=o.maxCardsCount,v=void 0===f?5:f,R=o.triggerViewTransition,b=i(o,["location","pageName","abVariant","cutoff","vertical","fallbackPageLandingURL","maxCardsCount","triggerViewTransition"]),C=d(!0),w=C[0],k=C[1],L=d(!1),B=L[0],W=L[1],T=d(),P=T[0],H=T[1],I=r((function(i){var o;return e(e({},i),{bookingCallOut:t?"Since you are flying to ".concat(t,"!"):"Since you are flying for your trip",recommendations:null!==(o=i.recommendations)&&void 0!==o?o:[]})}),[]);return c((function(){var e,i=u(g||""),o=i.locationCode,a=void 0===o?"":o,t=i.baseLocation,n=void 0===t?"":t,d=i.chk_in,r=void 0===d?"":d,l=i.chk_out,c=void 0===l?"":l,_={destinationCode:a||(null===(e=n.split("-"))||void 0===e?void 0:e[1])||"",hotelId:"",checkInDate:r,checkOutDate:c,paxInfo:[{adults:{count:2,metadata:[]},children:{count:0,metadata:[]}}]};m({cookieName:"hotelsSC",cookieValue:JSON.stringify(_),expiryInDay:1}),m({cookieName:"x-lineage-id",cookieValue:N(),expiryInDay:1}),x(h,g,p).then((function(e){var i=I(e);H(i),setTimeout((function(){k(!1)}),10),setTimeout((function(){W(!0)}),180)}))}),[]),a(y,{children:a(X,e({data:P,loading:w,pageName:n,vertical:h,location:t,abVariant:l,maxCardsCount:v,destroyLoaders:B,fallbackPageLandingURL:g,triggerViewTransitionOnClick:R},b))})};export{w as HotelRecoPlaceholderImg,M as HotelRecommendationContainer,X as HotelRecommendationsWidget};
1
+ import{__assign as e,__rest as i}from"tslib";import{jsxs as o,jsx as a,Fragment as n}from"react/jsx-runtime";import{useRef as t,useState as d,useCallback as r,useMemo as l,useEffect as c}from"react";import{ravenSDKTrigger as _,batchRavenEvent as p,formatCurrency as s,formatFullDateString as h,extractQueryParamsAsObj as m,setCookie as u,getHotelCrossSellRecos as x}from"@cleartrip/ct-platform-utils";import{Button as g,ButtonVariant as f}from"@cleartrip/ct-design-button";import{IntersectionObserverHOC as v}from"@cleartrip/ct-platform-io-hoc";import{Typography as R,TypographyVariant as b}from"@cleartrip/ct-design-typography";import{CheckIcon as C}from"@cleartrip/ct-platform-assets";import{ThemeProvider as y}from"@cleartrip/ct-design-theme";import{v4 as N}from"uuid";var w="https://fastui.cltpstatic.com/image/upload/f_auto,q_auto/offermgmt/images/banner/Image-placholder-1.jpg";function k(e,i){void 0===i&&(i={});var o=i.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}var L="index-module_hRecoBanner__C4cX5",B="index-module_hRecoBannerIcon__FqS9c",T="index-module_hRecoBannerTextsWrapper__i7eza",P="index-module_hRecoBannerTextRow__dAYvH",W="index-module_hRecoBannerImg__CnjlE";k(".index-module_hRecoBanner__C4cX5{aspect-ratio:304/180;background:#fff;border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);display:flex;height:180px;margin:0 16px 24px 40px;overflow:hidden;width:calc(100% - 56px)}.index-module_hRecoBannerIcon__FqS9c{margin-right:8px;min-width:16px;padding-top:1px}.index-module_hRecoBannerTextsWrapper__i7eza{display:flex;flex-direction:column;justify-content:center;padding:18px 8px 18px 12px}.index-module_hRecoBannerTextRow__dAYvH{display:flex;padding-bottom:16px}.index-module_hRecoBannerTextRow__dAYvH:last-of-type{padding-bottom:0}.index-module_hRecoBannerImg__CnjlE{height:100%}");var I=function(){return o("div",e({className:L},{children:[o("div",e({className:T},{children:[o("div",e({className:P},{children:[a(C,{className:B}),a(R,e({variant:b.P3},{children:"Free cancellation till check-in time"}))]})),o("div",e({className:P},{children:[a(C,{className:B}),a(R,e({variant:b.P3},{children:"Exclusive member discount for Flipkart & Myntra"}))]})),o("div",e({className:P},{children:[a(C,{className:B}),a(R,e({variant:b.P3},{children:"Earn and redeem SuperCoins"}))]}))]})),a("img",{src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_274,h_360/offermgmt/images/Hero-Image.png",className:W})]}))},H="index-module_hRecoCardWrapper__TJ8B3",D="index-module_hRecoInfoWrapper__5eV6Y",V="index-module_hRecoTitleRow__TM1b7",S="index-module_hRecoTitle__eo77E",O="index-module_hRecoRatingWrapper__7P6j5",E="index-module_hRecoPriceWrapper__sNFLP",J="index-module_hRecoLoaderWrapper__1CVM5",j="index-module_hidden__OoQJS",F="index-module_hRecoLoaderGradient__emhI2",M="index-module_hRecoLoaderTitleRow__BZenv",Y="index-module_hRecoLoaderTitle__53iJf",z="index-module_hRecoLoaderRating__7Leyu",U="index-module_hRecoLoaderSubtitle__WncMd",A="index-module_hRecoLoaderPricing__jJD8g";k(".index-module_hRecoCardWrapper__TJ8B3{background:#fff;border-radius:16px;display:flex;flex-direction:column;height:180px;overflow:hidden;width:200px}.index-module_hRecoInfoWrapper__5eV6Y{padding:8px 8px 0}.index-module_hRecoTitleRow__TM1b7{display:flex;justify-content:space-between}.index-module_hRecoTitle__eo77E{padding-right:4px}.index-module_hRecoRatingWrapper__7P6j5{align-items:center;background-color:#ecf3ff;border-radius:4px;box-sizing:border-box;display:flex;justify-content:center;margin-left:4px;min-width:28px;padding:0 4px}.index-module_hRecoPriceWrapper__sNFLP{align-items:baseline;display:flex;padding:4px 8px 8px}.index-module_hRecoLoaderWrapper__1CVM5{opacity:1;pointer-events:none;position:absolute;top:0;transition:opacity .15s ease-in-out}.index-module_hRecoLoaderWrapper__1CVM5.index-module_hidden__OoQJS{opacity:0}.index-module_hRecoLoaderGradient__emhI2{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%)}.index-module_hRecoLoaderTitleRow__BZenv{align-items:center;display:flex;margin-bottom:4px}.index-module_hRecoLoaderTitle__53iJf{border-radius:6px;height:20px;width:152px}.index-module_hRecoLoaderRating__7Leyu{border-radius:6px;height:16px;margin-left:8px;width:20px}.index-module_hRecoLoaderSubtitle__WncMd{border-radius:4px;height:8px;margin-bottom:8px;width:138px}.index-module_hRecoLoaderPricing__jJD8g{border-radius:6px;height:16px;width:120px}");var q=function(i){var n=i.loading,t=i.priority,d=void 0===t?"low":t;return o("div",e({className:"".concat(H," ").concat(J," ").concat(n?"":j)},{children:[a("img",{width:200,height:104,fetchPriority:d,src:w,alt:"Hotel recommendation placeholder"}),o("div",e({className:D},{children:[o("div",e({className:M},{children:[a("div",{className:"".concat(Y," ").concat(F)}),a("div",{className:"".concat(z," ").concat(F)})]})),a("div",{className:"".concat(U," ").concat(F)}),a("div",{className:"".concat(A," ").concat(F)})]}))]}))},Q=function(i){var n,l=i.rank,c=i.coupon,h=i.tripId,m=i.hotelId,u=i.vertical,x=i.location,g=i.pageName,f=i.abVariant,C=i.heroImage,y=i.staticData,N=i.pricingData,k=i.imgPriority,L=i.departureDate,B=i.hotelLandingUrl,T=i.onRecoCardClick,P=t(!1),W=d("".concat("https://fastui.cltpstatic.com/image/upload/t_h_seo_srp/hotels/places/hotels/").concat(null==C?void 0:C.mediaUrl)),I=W[0],J=W[1],j=r((function(){null==T||T(),_("u_ui_action",{vertical:u,a_trip_id:h,h_hotel_rank:l,h_hotel_id:m,page_name:g,ab_variant:f,child_product:"hotel",a_destination:x,ct_coupon_applied:c,transaction_id_ca:h,onward_date:L,search_destination:x,a_departure_date:L,object_name:null==y?void 0:y.hotelName,h_hotel_name:null==y?void 0:y.hotelName,action_name:"hotel_cross_sell_click",personalised_callout:"hotel_card_click"}),B&&(window.location.href=B)}),[B]),F=r((function(){P.current||(P.current=!0,J(w))}),[]),M=r((function(){p("u_impression",{vertical:u,a_trip_id:h,h_hotel_rank:l,h_hotel_id:m,page_name:g,ab_variant:f,child_product:"hotel",a_destination:x,ct_coupon_applied:c,transaction_id_ca:h,onward_date:L,search_destination:x,a_departure_date:L,object_name:null==y?void 0:y.hotelName,h_hotel_name:null==y?void 0:y.hotelName,action_name:"hotel_cross_sell_impression",personalised_callout:"hotel_card_impression"})}),[m]);return a(v,e({onIntersection:M},{children:o("div",e({className:H,onClick:j},{children:[a("img",{width:200,height:104,src:I,onError:F,fetchPriority:k}),o("div",e({className:D},{children:[o("div",e({className:V},{children:[a(R,e({lineClamp:1,className:S,variant:b.B2},{children:null==y?void 0:y.hotelName})),(null==y?void 0:y.userRating)&&a("div",e({className:O},{children:a(R,e({color:"link",variant:b.B3},{children:null===(n=null==y?void 0:y.userRating)||void 0===n?void 0:n.toFixed(1)}))}))]})),o(R,e({variant:b.P3,lineClamp:1,color:"subheading"},{children:[null==y?void 0:y.starRating," star hotel in"," ",null==y?void 0:y.locality]}))]})),o("div",e({className:E},{children:[(null==N?void 0:N.perNightPrice)&&o(R,e({variant:b.HM4},{children:[s(N.perNightPrice)," "]})),(null==N?void 0:N.slashedPrice)&&a(R,e({isStriked:!0,color:"subheading",variant:b.B4},{children:s(N.slashedPrice,!1)})),a(R,e({variant:b.B4,color:"subheading"},{children:" / night"}))]}))]}))}))},X={hRecoWrapper:"index-module_hRecoWrapper__BYtDJ",hRecoHeader:"index-module_hRecoHeader__ryP5R",hRecoContent:"index-module_hRecoContent__HTEk-",hRecoSidebar:"index-module_hRecoSidebar__rnPDI",connectedLine:"index-module_connectedLine__7OYBV",dottedLine:"index-module_dottedLine__t7fxL",hRecoCardsWrapper:"index-module_hRecoCardsWrapper__m3mDF",hRecoCardWrapper:"index-module_hRecoCardWrapper__7PrJr",hRecoOfferCallout:"index-module_hRecoOfferCallout__IIuQk",hRecoCouponCallout:"index-module_hRecoCouponCallout__sD6oN",hRecoBookingCallout:"index-module_hRecoBookingCallout__TtzWr",exploreButton:"index-module_exploreButton__Z1HXE",sidebarCircle:"index-module_sidebarCircle__-mzn4",hRecoHeaderTextLoader:"index-module_hRecoHeaderTextLoader__2pCib"};k(".index-module_hRecoWrapper__BYtDJ{background:linear-gradient(215deg,#e5fce3 8%,#fff 85.78%);display:flex;padding:16px 0;position:relative}.index-module_hRecoHeader__ryP5R{left:8px;position:relative}.index-module_hRecoContent__HTEk-{left:0;position:absolute;width:100%}.index-module_hRecoSidebar__rnPDI{align-items:center;display:flex;flex-direction:column;padding-left:12px}.index-module_connectedLine__7OYBV{border-left:1px solid grey;height:18px;left:-.5px;opacity:.3;position:relative}.index-module_dottedLine__t7fxL{border-left:1px dotted grey;height:272px;left:-.5px;opacity:.5;position:relative}.index-module_hRecoCardsWrapper__m3mDF{-ms-overflow-style:none;box-sizing:content-box;display:flex;height:180px;overflow:auto;padding:0 16px 16px 40px;scrollbar-width:none;width:calc(100% - 56px)}.index-module_hRecoCardWrapper__7PrJr{border-radius:16px;box-shadow:0 4px 16px 0 rgba(26,26,26,.08);margin-right:12px;min-width:200px;position:relative}.index-module_hRecoCardWrapper__7PrJr:last-child{margin-right:0}.index-module_hRecoCardsWrapper__m3mDF::-webkit-scrollbar{display:none}.index-module_hRecoOfferCallout__IIuQk{background:linear-gradient(90deg,#cafbcc 5.15%,rgba(212,255,218,.62) 41.66%,rgba(218,255,224,.23) 77.81%,hsla(0,0%,100%,0));border-radius:24px;padding:10px 12px}.index-module_hRecoCouponCallout__sD6oN{padding:8px 0 20px}.index-module_hRecoBookingCallout__TtzWr{padding-bottom:12px;padding-top:4px}.index-module_exploreButton__Z1HXE{left:40px;margin-top:8px;position:relative;width:calc(100% - 56px)}.index-module_sidebarCircle__-mzn4{border:1px solid #1a1a1a;border-radius:50%;height:8px;width:8px}.index-module_hRecoHeaderTextLoader__2pCib{background:linear-gradient(90deg,#f1efef -24.18%,#f9f8f8 50.26%,#e7e5e5 114.84%);border-radius:4px}");var Z=function(i){var t=i.data,s=i.tripId,m=i.loading,u=i.pageName,x=i.vertical,C=i.location,y=i.abVariant,N=i.maxCardsCount,w=i.departureDate,k=i.destroyLoaders,L=i.fallbackPageLandingURL,B=i.ctaTitle,T=void 0===B?"View all hotels":B,P=i.triggerViewTransitionOnClick,W=d(!1),H=W[0],D=W[1],V=l((function(){return h(w)}),[w]),S=l((function(){var i,d,r=null!==(d=null===(i=null==t?void 0:t.recommendations)||void 0===i?void 0:i.length)&&void 0!==d?d:0,l=Array.from({length:N},(function(e,i){return i+1}));return m||r>=2?a("div",e({className:X.hRecoCardsWrapper},{children:l.map((function(i,d){var r,l,c;return m||!k||(null===(r=null==t?void 0:t.recommendations)||void 0===r?void 0:r[d])?o("div",e({className:X.hRecoCardWrapper},{children:[(null===(l=null==t?void 0:t.recommendations)||void 0===l?void 0:l[d])&&a(Q,e({tripId:s,rank:d+1,location:C,pageName:u,vertical:x,abVariant:y,coupon:null==t?void 0:t.couponCode,departureDate:V},null===(c=null==t?void 0:t.recommendations)||void 0===c?void 0:c[d],{imgPriority:0===d?"high":"auto",onRecoCardClick:P})),!k&&a(q,{loading:m,priority:0===d?"high":"auto"})]}),i):a(n,{})}))})):a(I,{})}),[t,m,k]),O=r((function(){D(!0)}),[]),E=r((function(){var e,i,o;null==P||P();var a=null!==(i=null===(e=null==t?void 0:t.recommendations)||void 0===e?void 0:e.length)&&void 0!==i?i:0;_("u_ui_action",{vertical:x,a_trip_id:s,page_name:u,action_type:"click",ab_variant:y,child_product:"hotel",a_destination:C,transaction_id_ca:s,onward_date:V,search_destination:C,a_departure_date:V,action_name:"hotel_cross_sell_click",personalised_callout:"Book hotel now",result_count:a<N?a:N});var n=null!==(o=null==t?void 0:t.pageLandingUrl)&&void 0!==o?o:L;n&&(window.location.href=n)}),[t]);return c((function(){var e,i;if(H&&!m){var o=null!==(i=null===(e=null==t?void 0:t.recommendations)||void 0===e?void 0:e.length)&&void 0!==i?i:0;p("u_impression",{vertical:x,a_trip_id:s,page_name:u,ab_variant:y,child_product:"hotel",a_destination:C,transaction_id_ca:s,onward_date:V,search_destination:C,a_departure_date:V,action_name:"hotel_cross_sell_impression",result_count:o<N?o:N})}}),[m,t,H]),a(v,e({onIntersection:O},{children:o("div",e({className:X.hRecoWrapper},{children:[o("div",e({className:X.hRecoSidebar},{children:[a("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Flight%20%281%29.png",fetchPriority:"low"}),a("div",{className:X.connectedLine}),a("img",{width:20,height:20,src:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_20,h_20,dpr_2/offermgmt/images/banner/Gift%20%281%29.png",fetchPriority:"low"}),a("div",{className:X.dottedLine}),a("div",{className:X.sidebarCircle})]})),o("div",e({className:X.hRecoMainWrapper},{children:[o("div",e({className:X.hRecoHeader},{children:[m?a("div",e({style:{padding:"4px 0",marginBottom:"16px"}},{children:a("div",{className:X.hRecoHeaderTextLoader,style:{height:"8px",width:"170px"}})})):a(R,e({variant:b.P3,className:X.hRecoBookingCallout},{children:null==t?void 0:t.bookingCallOut})),a("div",m?e({style:{padding:"8px 0 6px",marginBottom:"8px"}},{children:a("div",{className:X.hRecoHeaderTextLoader,style:{height:"18px",width:"270px"}})}):e({className:X.hRecoOfferCallout},{children:a(R,e({color:"success",variant:b.B4CAPS},{children:null==t?void 0:t.offerCallOut}))})),m?a("div",e({style:{marginBottom:"24px"}},{children:a("div",{className:X.hRecoHeaderTextLoader,style:{height:"16px",width:"260px"}})})):a(R,e({variant:b.HM4,className:X.hRecoCouponCallout},{children:null==t?void 0:t.couponCallOut}))]})),o("div",e({className:X.hRecoContent},{children:[S,a(g,e({disabled:m,onClick:E,variant:f.OUTLINE,className:X.exploreButton},{children:T}))]}))]}))]}))}))},G=function(o){var n=o.location,t=o.pageName,l=o.abVariant,_=o.cutoff,p=void 0===_?450:_,s=o.vertical,h=void 0===s?"AIR":s,g=o.fallbackPageLandingURL,f=o.maxCardsCount,v=void 0===f?5:f,R=o.triggerViewTransition,b=i(o,["location","pageName","abVariant","cutoff","vertical","fallbackPageLandingURL","maxCardsCount","triggerViewTransition"]),C=d(!0),w=C[0],k=C[1],L=d(!1),B=L[0],T=L[1],P=d(),W=P[0],I=P[1],H=r((function(i){var o;return e(e({},i),{bookingCallOut:n?"Since you are flying to ".concat(n,"!"):"Since you are flying for your trip",recommendations:null!==(o=i.recommendations)&&void 0!==o?o:[]})}),[]);return c((function(){var e,i=m(g||""),o=i.locationCode,a=void 0===o?"":o,n=i.baseLocation,t=void 0===n?"":n,d=i.chk_in,r=void 0===d?"":d,l=i.chk_out,c=void 0===l?"":l,_={destinationCode:a||(null===(e=t.split("-"))||void 0===e?void 0:e[1])||"",hotelId:"",checkInDate:r,checkOutDate:c,paxInfo:[{adults:{count:2,metadata:[]},children:{count:0,metadata:[]}}]};u({cookieName:"hotelsSC",cookieValue:JSON.stringify(_),expiryInDay:1}),u({cookieName:"x-lineage-id",cookieValue:N(),expiryInDay:1}),x(h,g,p).then((function(e){var i=H(e);I(i),setTimeout((function(){k(!1)}),10),setTimeout((function(){T(!0)}),180)}))}),[]),a(y,{children:a(Z,e({data:W,loading:w,pageName:t,vertical:h,location:n,abVariant:l,maxCardsCount:v,destroyLoaders:B,fallbackPageLandingURL:g,triggerViewTransitionOnClick:R},b))})};export{w as HotelRecoPlaceholderImg,G as HotelRecommendationContainer,Z as HotelRecommendationsWidget};
2
2
  //# sourceMappingURL=ct-platform-hotel-recommendations.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleartrip/ct-platform-hotel-recommendations",
3
- "version": "1.10.0-beta.22",
3
+ "version": "1.10.0-beta.23",
4
4
  "description": "Hotel Recommendations Component",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/ct-platform-hotel-recommendations.cjs.js",
@@ -14,10 +14,10 @@
14
14
  "@cleartrip/ct-design-theme": "3.7.0",
15
15
  "@cleartrip/ct-design-typography": "3.7.0",
16
16
  "classnames": "^2.5.1",
17
- "@cleartrip/ct-platform-assets": "3.3.0-beta.17",
18
- "@cleartrip/ct-platform-utils": "3.12.0-beta.21",
19
- "@cleartrip/ct-platform-io-hoc": "3.0.2",
20
- "@cleartrip/ct-platform-types": "3.3.2"
17
+ "@cleartrip/ct-platform-assets": "3.3.0-beta.18",
18
+ "@cleartrip/ct-platform-types": "3.3.3-beta.0",
19
+ "@cleartrip/ct-platform-io-hoc": "3.0.3-beta.0",
20
+ "@cleartrip/ct-platform-utils": "3.12.0-beta.22"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=16.8.0",