@cleartrip/ct-platform-recent-search-widget 1.0.1-beta.3 → 1.0.1-beta.4
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"),
|
|
1
|
+
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@cleartrip/ct-design-typography"),a=require("classnames"),r=require("@cleartrip/ct-platform-assets"),o=require("@cleartrip/ct-platform-utils"),s=require("@cleartrip/ct-platform-io-hoc");function l(e){return e&&e.__esModule?e:{default:e}}var c=l(a);var d="index-module_cysContainer__IxX-G",u="index-module_cysWrapper__1ce0P",_="index-module_cysWrapperPWA__WgM-l",p="index-module_cysWrapperDesktop__nb0PL",m="index-module_cysContentWrapper__E91-z",h="index-module_cysCardsPWA__R8Fka",x="index-module_cysCardsDesktop__JIMk8",y="index-module_cysCard__-4dBh",g="index-module_cysCardPWA__Yjxjo",f="index-module_cysCardDesktop__ToN9t",v="index-module_cysCardContent__xUEFU",b="index-module_cysCardTextWrapper__XjGQC",C="index-module_cysCardIconWrapper__GC4rs",k="index-module_cysCardIconDesktop__GIDrz",w="index-module_cysCardIconPWA__yuB1A",T="index-module_cysCardRemoving__fo6Kp",D="index-module_cysTextEllipsis__o0FhM";!function(e,n){void 0===n&&(n={});var t=n.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".index-module_cysContainer__IxX-G{height:100%;position:relative;width:100%}.index-module_cysWrapper__1ce0P{height:100%;width:100%}.index-module_cysWrapperPWA__WgM-l{padding:32px 16px 16px}.index-module_cysWrapperDesktop__nb0PL{padding:32px 0 16px}.index-module_cysContentWrapper__E91-z{display:flex;flex-direction:column;gap:12px;width:100%}.index-module_cysCardsPWA__R8Fka{-webkit-overflow-scrolling:touch;-ms-overflow-style:none;display:flex;overflow-x:auto;scroll-behavior:smooth;scrollbar-width:none;width:100%}.index-module_cysCardsPWA__R8Fka::-webkit-scrollbar{display:none;height:0;width:0}.index-module_cysCardsDesktop__JIMk8{display:flex;flex:1;gap:12px;width:100%}.index-module_cysCard__-4dBh{backface-visibility:hidden;border:1px solid rgba(26,26,26,.122);border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;max-width:272px;min-width:188px;opacity:1;transform:translateZ(0);transition:transform .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1),width .3s cubic-bezier(.4,0,.2,1) .3s,margin-right .3s cubic-bezier(.4,0,.2,1) .3s}.index-module_cysCardPWA__Yjxjo{flex:0 0 auto;margin-right:12px;padding:12px;width:auto}.index-module_cysCardPWA__Yjxjo:last-child{margin-right:16px}.index-module_cysCardDesktop__ToN9t{cursor:pointer;flex:1;padding:16px 12px 16px 16px;width:100%}.index-module_cysCardContent__xUEFU{display:flex;gap:8px;justify-content:space-between}.index-module_cysCardTextWrapper__XjGQC{flex:1;flex-direction:column;min-width:0;overflow:hidden}.index-module_cysCardSubTitleWrapper__2l6Bk,.index-module_cysCardTextWrapper__XjGQC{align-items:flex-start;display:flex;gap:4px}.index-module_cysCardIconWrapper__GC4rs{cursor:pointer;display:flex;flex-shrink:0}.index-module_cysCardIconDesktop__GIDrz{align-items:center}.index-module_cysCardIconPWA__yuB1A{align-items:flex-start}.index-module_cysCardRemoving__fo6Kp{animation:index-module_cardFadeOut__TqBOB .2s cubic-bezier(.4,0,.2,1) forwards;pointer-events:none}@keyframes index-module_cardFadeOut__TqBOB{0%{margin-right:12px;max-width:272px;min-width:188px;opacity:1;transform:translateZ(0)}to{border-width:0;margin-right:0;max-width:0;min-width:0;opacity:0;padding:0;transform:translate3d(-10px,0,0)}}.index-module_cysTextEllipsisOverflow__IVzT0,.index-module_cysTextEllipsis__o0FhM{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes index-module_fadeIn__cZep2{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}");var N=[{id:"1",title:"Tokyo, Shibuya ertyuerty ertyu ewrtyu",subtitle:"Sep 12 - Sep 18",lobType:"Hotel",icon:"hotel-icon",cityName:"Tokyo",hotelName:"Shibuya Grand Hotel",hotelId:"HTL345678",roomCount:1,checkInDate:"Sep 12",checkOutDate:"Sep 18"},{id:"2",title:"New York, Central Park",subtitle:"Oct 25 - Oct 28",lobType:"Hotel",icon:"hotel-icon",cityName:"New York",hotelName:"Central Park Hotel",hotelId:"HTL123456",roomCount:2,checkInDate:"Oct 25",checkOutDate:"Oct 28"},{id:"3",title:"London → Paris",subtitle:"Nov 10 - Nov 15, 2025",lobType:"Flight",icon:"flight-icon",onwardFlight:"London → Paris",returnFlight:"Paris → London",onwardDate:"Nov 10, 2025",returnDate:"Nov 15, 2025"},{id:"4",title:"Mumbai → Pune",subtitle:"Dec 15 - Dec 16, 2025",lobType:"Bus",icon:"bus-icon",cityName:"Mumbai",onwardDate:"Dec 15, 2025",returnDate:"Dec 16, 2025"},{id:"5",title:"Dubai, Palm Jumeirah",subtitle:"Jan 5 - Jan 10",lobType:"Hotel",icon:"hotel-icon",cityName:"Dubai",hotelName:"Palm Jumeirah Resort",hotelId:"HTL789012",roomCount:1,checkInDate:"Jan 5",checkOutDate:"Jan 10"}],P=function(e,n){return e.length>n?"".concat(e.substring(0,n),"..."):e},I=function(e){return{h_search_destination:(null==e?void 0:e.title)||"na",h_search_destination_city:(null==e?void 0:e.cityName)||"na",h_checkin_date:(null==e?void 0:e.checkInDate)||"na",h_checkout_date:(null==e?void 0:e.checkOutDate)||"na",h_room_count:String(null==e?void 0:e.roomCount)||"na",h_hotel_id:(null==e?void 0:e.hotelId)||"na",h_hotel_name:(null==e?void 0:e.hotelName)||"na"}},j=function(a){var o=a.card,s=a.cardIndex,l=a.pageName,d=a.isPwa,u=a.isRemoving,_=a.onRemove,p=a.onClick,m=t.useCallback((function(e){e.stopPropagation(),_(o.id,s)}),[_,o.id,s]),h=t.useCallback((function(e){e.stopPropagation(),null==p||p(o,s)}),[p,o,s]),x=t.useMemo((function(){return c.default(y,d?g:f,u?T:"")}),[d,u]),N=t.useMemo((function(){return P(o.title,32)}),[o.title]);console.log(o.title.length),console.log(N.length);var I=t.useMemo((function(){return o.subtitle?P(o.subtitle,32):""}),[o.subtitle]);return n.jsx("div",e.__assign({className:x,onClick:h},{children:n.jsxs("div",e.__assign({className:v},{children:[n.jsxs("div",e.__assign({className:b},{children:["unified_homepage"===l&&o.lobType&&n.jsx(i.Typography,e.__assign({variant:i.TypographyVariant.B3,colorCode:"#FF4F17",style:{textTransform:"uppercase"}},{children:o.lobType})),n.jsx(i.Typography,e.__assign({variant:i.TypographyVariant.HM4,className:D},{children:N})),o.subtitle&&n.jsx(i.Typography,e.__assign({variant:i.TypographyVariant.P3,className:D},{children:I}))]})),n.jsx("div",e.__assign({className:c.default(C,d?w:k),onClick:d?m:function(){}},{children:d?n.jsx(r.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(r.ChevronRight,{width:16,height:16})}))]}))}))};exports.Card=j,exports.RecentSearchWidget=function(a){var r=a.pageName,l=a.vertical,y=a.isPwa,g=void 0===y||y,f=a.ravenPayload,v=a.apiDelay,b=void 0===v?1e3:v,C=a.onDataReady,k=void 0===C?function(){}:C,w=a.onDataRemoved,T=void 0===w?function(){}:w,D=t.useState(!1),P=D[0],W=D[1],S=t.useState([]),A=S[0],M=S[1],R=t.useState(!1),F=R[0],O=R[1],E=t.useState(new Set),H=E[0],B=E[1],z=t.useRef(!1),q=t.useRef(new Map),G=t.useRef(null),J=t.useMemo((function(){return(null==A?void 0:A.length)>0?g?A:null==A?void 0:A.slice(0,3):[]}),[g,A]),L=t.useMemo((function(){var n=e.__assign({page_name:r,vertical:l,login_status:o.isUserSignedIn()?"yes":"no"},o.isEmpty(f)?{}:e.__assign({},f));return g||(n.platform="desktop"),n}),[f,g,r,l]);t.useEffect((function(){var e=q.current,n=G.current;return function(){e.forEach((function(e){return clearTimeout(e)})),e.clear(),n&&clearTimeout(n)}}),[]),t.useEffect((function(){F||function(e){return new Promise((function(n){setTimeout((function(){return n({data:N})}),e)}))}(b).then((function(e){var n=e.data,t=Array.isArray(n)&&n.length>0;M(t?n:N),W(!0),O(!0),null==k||k(null!=n?n:[])}))}),[F,k]),t.useEffect((function(){if(F&&!(A.length>0))return G.current=setTimeout((function(){W(!1),null==T||T()}),600),function(){G.current&&clearTimeout(G.current)}}),[F,A.length,T]);var Y=t.useCallback((function(n){if(!z.current&&0!==n){z.current=!0;var t=e.__assign(e.__assign({},L),{action_name:"recentsearch_impression",recent_searches_result_count:n});o.ravenSDKTrigger("u_recent_searches_widget_impression",t)}}),[L]),V=t.useCallback((function(n,t){var i=e.__assign(e.__assign({},L),{action_name:"recentsearch_click",card_number:t+1});"Hotel"===n.lobType&&(i=e.__assign(e.__assign({},i),I(n))),o.ravenSDKTrigger("u_ui_action",i)}),[L]),K=t.useCallback((function(n,t){var i=e.__assign(e.__assign({},L),{action_name:"recentsearch_dismiss_click",card_number:String(t+1)});"Hotel"===n.lobType&&(i=e.__assign(e.__assign({},i),I(n))),o.ravenSDKTrigger("u_ui_action",i)}),[L]),U=t.useCallback((function(e,n){B((function(n){return new Set(n).add(e)}));var t=setTimeout((function(){M((function(n){return n.filter((function(n){return n.id!==e}))})),B((function(n){var t=new Set(n);return t.delete(e),t})),q.current.delete(e)}),600);q.current.set(e,t);var i=A.find((function(n){return n.id===e}));i&&K(i,n)}),[A,K]),X=t.useCallback((function(){F&&J.length>0&&Y(J.length)}),[F,J.length,Y]),Q=t.useCallback((function(e,n){V(e,n)}),[V]);return P&&F&&0!==J.length?n.jsx(s.IntersectionObserverHOC,e.__assign({onIntersection:X},{children:n.jsx("div",e.__assign({className:d},{children:n.jsx("div",e.__assign({className:c.default(u,g?_:p)},{children:n.jsxs("div",e.__assign({className:m},{children:[n.jsx(i.Typography,e.__assign({variant:g?i.TypographyVariant.HM3:i.TypographyVariant.HM1},{children:"Recent searches"})),n.jsx("div",e.__assign({className:g?h:x},{children:J.map((function(e,t){return n.jsx(j,{card:e,cardIndex:t,isPwa:g,pageName:r,isRemoving:H.has(e.id),onRemove:U,onClick:Q},e.id)}))}))]}))}))}))})):null};
|
|
2
2
|
//# sourceMappingURL=ct-platform-recent-search-widget.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-recent-search-widget.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/RecentSearchWidget/src/constant.ts","../packages/components/RecentSearchWidget/src/utils.ts","../packages/components/RecentSearchWidget/src/RecentSearchCard.tsx","../packages/components/RecentSearchWidget/src/RecentSearchWidget.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","MOCK_CARDS","id","title","subtitle","lobType","icon","cityName","hotelName","hotelId","roomCount","checkInDate","checkOutDate","onwardFlight","returnFlight","onwardDate","returnDate","truncateText","text","maxLength","length","concat","substring","buildHotelCardRavenPayload","card","h_search_destination","h_search_destination_city","h_checkin_date","h_checkout_date","h_room_count","String","h_hotel_id","h_hotel_name","RecentSearchCard","_a","cardIndex","pageName","isPwa","isRemoving","onRemove","onClick","handleRemoveClick","useCallback","e","stopPropagation","handleCardClick","cardClassName","useMemo","classNames","default","styles","truncatedTitle","console","log","truncatedSubtitle","_jsx","jsx","__assign","className","children","_jsxs","Typography","variant","TypographyVariant","B3","colorCode","textTransform","HM4","P3","CrossIcon","width","height","color","ChevronRight","vertical","_b","ravenPayload","_c","apiDelay","_d","onDataReady","_e","onDataRemoved","_f","useState","shouldRender","setShouldRender","_g","cards","setCards","_h","dataLoaded","setDataLoaded","_j","Set","removingCardIds","setRemovingCardIds","impressionFiredRef","useRef","removeTimeoutsRef","Map","collapseTimeoutRef","displayedCards","slice","commonRavenPayload","payload","page_name","login_status","isUserSignedIn","isEmpty","platform","useEffect","timeoutsMap","current","collapseTimeout","forEach","timeout","clearTimeout","clear","Promise","resolve","setTimeout","data","fetchRecentSearches","then","response","items","hasItems","Array","isArray","fireImpressionEvent","cardCount","action_name","recent_searches_result_count","ravenSDKTrigger","fireCardClickEvent","card_number","fireCardDismissEvent","handleRemoveCard","cardId","prev","add","filter","c","newSet","delete","set","find","handleIntersection","handleItemClick","item","IntersectionObserverHOC","onIntersection","HM3","HM1","map","index","has"],"mappings":"q/BAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,
|
|
1
|
+
{"version":3,"file":"ct-platform-recent-search-widget.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/RecentSearchWidget/src/constant.ts","../packages/components/RecentSearchWidget/src/utils.ts","../packages/components/RecentSearchWidget/src/RecentSearchCard.tsx","../packages/components/RecentSearchWidget/src/RecentSearchWidget.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","MOCK_CARDS","id","title","subtitle","lobType","icon","cityName","hotelName","hotelId","roomCount","checkInDate","checkOutDate","onwardFlight","returnFlight","onwardDate","returnDate","truncateText","text","maxLength","length","concat","substring","buildHotelCardRavenPayload","card","h_search_destination","h_search_destination_city","h_checkin_date","h_checkout_date","h_room_count","String","h_hotel_id","h_hotel_name","RecentSearchCard","_a","cardIndex","pageName","isPwa","isRemoving","onRemove","onClick","handleRemoveClick","useCallback","e","stopPropagation","handleCardClick","cardClassName","useMemo","classNames","default","styles","truncatedTitle","console","log","truncatedSubtitle","_jsx","jsx","__assign","className","children","_jsxs","Typography","variant","TypographyVariant","B3","colorCode","textTransform","HM4","P3","CrossIcon","width","height","color","ChevronRight","vertical","_b","ravenPayload","_c","apiDelay","_d","onDataReady","_e","onDataRemoved","_f","useState","shouldRender","setShouldRender","_g","cards","setCards","_h","dataLoaded","setDataLoaded","_j","Set","removingCardIds","setRemovingCardIds","impressionFiredRef","useRef","removeTimeoutsRef","Map","collapseTimeoutRef","displayedCards","slice","commonRavenPayload","payload","page_name","login_status","isUserSignedIn","isEmpty","platform","useEffect","timeoutsMap","current","collapseTimeout","forEach","timeout","clearTimeout","clear","Promise","resolve","setTimeout","data","fetchRecentSearches","then","response","items","hasItems","Array","isArray","fireImpressionEvent","cardCount","action_name","recent_searches_result_count","ravenSDKTrigger","fireCardClickEvent","card_number","fireCardDismissEvent","handleRemoveCard","cardId","prev","add","filter","c","newSet","delete","set","find","handleIntersection","handleItemClick","item","IntersectionObserverHOC","onIntersection","HM3","HM1","map","index","has"],"mappings":"q/BAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,w7ECtBO,IAAMe,EAAyB,CAClC,CACIC,GAAI,IACJC,MAAO,wCACPC,SAAU,kBACVC,QAAS,QACTC,KAAM,aACNC,SAAU,QACVC,UAAW,sBACXC,QAAS,YACTC,UAAW,EACXC,YAAa,SACbC,aAAc,UAElB,CACIV,GAAI,IACJC,MAAO,yBACPC,SAAU,kBACVC,QAAS,QACTC,KAAM,aACNC,SAAU,WACVC,UAAW,qBACXC,QAAS,YACTC,UAAW,EACXC,YAAa,SACbC,aAAc,UAElB,CACIV,GAAI,IACJC,MAAO,iBACPC,SAAU,wBACVC,QAAS,SACTC,KAAM,cACNO,aAAc,iBACdC,aAAc,iBACdC,WAAY,eACZC,WAAY,gBAEhB,CACId,GAAI,IACJC,MAAO,gBACPC,SAAU,wBACVC,QAAS,MACTC,KAAM,WACNC,SAAU,SACVQ,WAAY,eACZC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,EAAAA,kBAAkB2F,KACG,CAAA/F,SAAA,qBAKnCJ,EAAAA,IACI,MAAAE,EAAAA,SAAA,CAAAC,UACKrB,EAEKa,EADAA,aAIToD,EAAeqD,KAAI,SAACnI,EAAMoI,GAAU,OACjCrG,EAACC,IAAAvB,EAEG,CAAAT,KAAMA,EACNW,UAAWyH,EACXvH,MAAOA,EACPD,SAAUA,EACVE,WAAYyD,EAAgB8D,IAAIrI,EAAKtB,IACrCqC,SAAUmG,EACVlG,QAAS6G,GAPJ7H,EAAKtB,uBAjC/B,IAiDf","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useCallback as i,useMemo as o,useState as r,useRef as a,useEffect as d}from"react";import{Typography as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useCallback as i,useMemo as o,useState as r,useRef as a,useEffect as d}from"react";import{Typography as l,TypographyVariant as c}from"@cleartrip/ct-design-typography";import s from"classnames";import{ChevronRight as u,CrossIcon as _}from"@cleartrip/ct-platform-assets";import{isUserSignedIn as m,isEmpty as p,ravenSDKTrigger as h}from"@cleartrip/ct-platform-utils";import{IntersectionObserverHOC as x}from"@cleartrip/ct-platform-io-hoc";var f="index-module_cysContainer__IxX-G",y="index-module_cysWrapper__1ce0P",g="index-module_cysWrapperPWA__WgM-l",v="index-module_cysWrapperDesktop__nb0PL",b="index-module_cysContentWrapper__E91-z",C="index-module_cysCardsPWA__R8Fka",w="index-module_cysCardsDesktop__JIMk8",k="index-module_cysCard__-4dBh",T="index-module_cysCardPWA__Yjxjo",N="index-module_cysCardDesktop__ToN9t",D="index-module_cysCardContent__xUEFU",P="index-module_cysCardTextWrapper__XjGQC",W="index-module_cysCardIconWrapper__GC4rs",I="index-module_cysCardIconDesktop__GIDrz",A="index-module_cysCardIconPWA__yuB1A",F="index-module_cysCardRemoving__fo6Kp",S="index-module_cysTextEllipsis__o0FhM";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".index-module_cysContainer__IxX-G{height:100%;position:relative;width:100%}.index-module_cysWrapper__1ce0P{height:100%;width:100%}.index-module_cysWrapperPWA__WgM-l{padding:32px 16px 16px}.index-module_cysWrapperDesktop__nb0PL{padding:32px 0 16px}.index-module_cysContentWrapper__E91-z{display:flex;flex-direction:column;gap:12px;width:100%}.index-module_cysCardsPWA__R8Fka{-webkit-overflow-scrolling:touch;-ms-overflow-style:none;display:flex;overflow-x:auto;scroll-behavior:smooth;scrollbar-width:none;width:100%}.index-module_cysCardsPWA__R8Fka::-webkit-scrollbar{display:none;height:0;width:0}.index-module_cysCardsDesktop__JIMk8{display:flex;flex:1;gap:12px;width:100%}.index-module_cysCard__-4dBh{backface-visibility:hidden;border:1px solid rgba(26,26,26,.122);border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;max-width:272px;min-width:188px;opacity:1;transform:translateZ(0);transition:transform .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1),width .3s cubic-bezier(.4,0,.2,1) .3s,margin-right .3s cubic-bezier(.4,0,.2,1) .3s}.index-module_cysCardPWA__Yjxjo{flex:0 0 auto;margin-right:12px;padding:12px;width:auto}.index-module_cysCardPWA__Yjxjo:last-child{margin-right:16px}.index-module_cysCardDesktop__ToN9t{cursor:pointer;flex:1;padding:16px 12px 16px 16px;width:100%}.index-module_cysCardContent__xUEFU{display:flex;gap:8px;justify-content:space-between}.index-module_cysCardTextWrapper__XjGQC{flex:1;flex-direction:column;min-width:0;overflow:hidden}.index-module_cysCardSubTitleWrapper__2l6Bk,.index-module_cysCardTextWrapper__XjGQC{align-items:flex-start;display:flex;gap:4px}.index-module_cysCardIconWrapper__GC4rs{cursor:pointer;display:flex;flex-shrink:0}.index-module_cysCardIconDesktop__GIDrz{align-items:center}.index-module_cysCardIconPWA__yuB1A{align-items:flex-start}.index-module_cysCardRemoving__fo6Kp{animation:index-module_cardFadeOut__TqBOB .2s cubic-bezier(.4,0,.2,1) forwards;pointer-events:none}@keyframes index-module_cardFadeOut__TqBOB{0%{margin-right:12px;max-width:272px;min-width:188px;opacity:1;transform:translateZ(0)}to{border-width:0;margin-right:0;max-width:0;min-width:0;opacity:0;padding:0;transform:translate3d(-10px,0,0)}}.index-module_cysTextEllipsisOverflow__IVzT0,.index-module_cysTextEllipsis__o0FhM{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes index-module_fadeIn__cZep2{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}");var B=[{id:"1",title:"Tokyo, Shibuya ertyuerty ertyu ewrtyu",subtitle:"Sep 12 - Sep 18",lobType:"Hotel",icon:"hotel-icon",cityName:"Tokyo",hotelName:"Shibuya Grand Hotel",hotelId:"HTL345678",roomCount:1,checkInDate:"Sep 12",checkOutDate:"Sep 18"},{id:"2",title:"New York, Central Park",subtitle:"Oct 25 - Oct 28",lobType:"Hotel",icon:"hotel-icon",cityName:"New York",hotelName:"Central Park Hotel",hotelId:"HTL123456",roomCount:2,checkInDate:"Oct 25",checkOutDate:"Oct 28"},{id:"3",title:"London → Paris",subtitle:"Nov 10 - Nov 15, 2025",lobType:"Flight",icon:"flight-icon",onwardFlight:"London → Paris",returnFlight:"Paris → London",onwardDate:"Nov 10, 2025",returnDate:"Nov 15, 2025"},{id:"4",title:"Mumbai → Pune",subtitle:"Dec 15 - Dec 16, 2025",lobType:"Bus",icon:"bus-icon",cityName:"Mumbai",onwardDate:"Dec 15, 2025",returnDate:"Dec 16, 2025"},{id:"5",title:"Dubai, Palm Jumeirah",subtitle:"Jan 5 - Jan 10",lobType:"Hotel",icon:"hotel-icon",cityName:"Dubai",hotelName:"Palm Jumeirah Resort",hotelId:"HTL789012",roomCount:1,checkInDate:"Jan 5",checkOutDate:"Jan 10"}],H=function(e,t){return e.length>t?"".concat(e.substring(0,t),"..."):e},O=function(e){return{h_search_destination:(null==e?void 0:e.title)||"na",h_search_destination_city:(null==e?void 0:e.cityName)||"na",h_checkin_date:(null==e?void 0:e.checkInDate)||"na",h_checkout_date:(null==e?void 0:e.checkOutDate)||"na",h_room_count:String(null==e?void 0:e.roomCount)||"na",h_hotel_id:(null==e?void 0:e.hotelId)||"na",h_hotel_name:(null==e?void 0:e.hotelName)||"na"}},R=function(r){var a=r.card,d=r.cardIndex,m=r.pageName,p=r.isPwa,h=r.isRemoving,x=r.onRemove,f=r.onClick,y=i((function(e){e.stopPropagation(),x(a.id,d)}),[x,a.id,d]),g=i((function(e){e.stopPropagation(),null==f||f(a,d)}),[f,a,d]),v=o((function(){return s(k,p?T:N,h?F:"")}),[p,h]),b=o((function(){return H(a.title,32)}),[a.title]);console.log(a.title.length),console.log(b.length);var C=o((function(){return a.subtitle?H(a.subtitle,32):""}),[a.subtitle]);return t("div",e({className:v,onClick:g},{children:n("div",e({className:D},{children:[n("div",e({className:P},{children:["unified_homepage"===m&&a.lobType&&t(l,e({variant:c.B3,colorCode:"#FF4F17",style:{textTransform:"uppercase"}},{children:a.lobType})),t(l,e({variant:c.HM4,className:S},{children:b})),a.subtitle&&t(l,e({variant:c.P3,className:S},{children:C}))]})),t("div",e({className:s(W,p?A:I),onClick:p?y:function(){}},{children:p?t(_,{width:16,height:16,color:"#1A1A1A"}):t(u,{width:16,height:16})}))]}))}))},M=function(u){var _=u.pageName,k=u.vertical,T=u.isPwa,N=void 0===T||T,D=u.ravenPayload,P=u.apiDelay,W=void 0===P?1e3:P,I=u.onDataReady,A=void 0===I?function(){}:I,F=u.onDataRemoved,S=void 0===F?function(){}:F,H=r(!1),M=H[0],j=H[1],z=r([]),E=z[0],G=z[1],J=r(!1),L=J[0],Y=J[1],X=r(new Set),U=X[0],Q=X[1],Z=a(!1),q=a(new Map),K=a(null),V=o((function(){return(null==E?void 0:E.length)>0?N?E:null==E?void 0:E.slice(0,3):[]}),[N,E]),$=o((function(){var t=e({page_name:_,vertical:k,login_status:m()?"yes":"no"},p(D)?{}:e({},D));return N||(t.platform="desktop"),t}),[D,N,_,k]);d((function(){var e=q.current,t=K.current;return function(){e.forEach((function(e){return clearTimeout(e)})),e.clear(),t&&clearTimeout(t)}}),[]),d((function(){L||function(e){return new Promise((function(t){setTimeout((function(){return t({data:B})}),e)}))}(W).then((function(e){var t=e.data,n=Array.isArray(t)&&t.length>0;G(n?t:B),j(!0),Y(!0),null==A||A(null!=t?t:[])}))}),[L,A]),d((function(){if(L&&!(E.length>0))return K.current=setTimeout((function(){j(!1),null==S||S()}),600),function(){K.current&&clearTimeout(K.current)}}),[L,E.length,S]);var ee=i((function(t){if(!Z.current&&0!==t){Z.current=!0;var n=e(e({},$),{action_name:"recentsearch_impression",recent_searches_result_count:t});h("u_recent_searches_widget_impression",n)}}),[$]),te=i((function(t,n){var i=e(e({},$),{action_name:"recentsearch_click",card_number:n+1});"Hotel"===t.lobType&&(i=e(e({},i),O(t))),h("u_ui_action",i)}),[$]),ne=i((function(t,n){var i=e(e({},$),{action_name:"recentsearch_dismiss_click",card_number:String(n+1)});"Hotel"===t.lobType&&(i=e(e({},i),O(t))),h("u_ui_action",i)}),[$]),ie=i((function(e,t){Q((function(t){return new Set(t).add(e)}));var n=setTimeout((function(){G((function(t){return t.filter((function(t){return t.id!==e}))})),Q((function(t){var n=new Set(t);return n.delete(e),n})),q.current.delete(e)}),600);q.current.set(e,n);var i=E.find((function(t){return t.id===e}));i&&ne(i,t)}),[E,ne]),oe=i((function(){L&&V.length>0&&ee(V.length)}),[L,V.length,ee]),re=i((function(e,t){te(e,t)}),[te]);return M&&L&&0!==V.length?t(x,e({onIntersection:oe},{children:t("div",e({className:f},{children:t("div",e({className:s(y,N?g:v)},{children:n("div",e({className:b},{children:[t(l,e({variant:N?c.HM3:c.HM1},{children:"Recent searches"})),t("div",e({className:N?C:w},{children:V.map((function(e,n){return t(R,{card:e,cardIndex:n,isPwa:N,pageName:_,isRemoving:U.has(e.id),onRemove:ie,onClick:re},e.id)}))}))]}))}))}))})):null};export{R as Card,M as RecentSearchWidget};
|
|
2
2
|
//# sourceMappingURL=ct-platform-recent-search-widget.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-recent-search-widget.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/RecentSearchWidget/src/constant.ts","../packages/components/RecentSearchWidget/src/utils.ts","../packages/components/RecentSearchWidget/src/RecentSearchCard.tsx","../packages/components/RecentSearchWidget/src/RecentSearchWidget.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","MOCK_CARDS","id","title","subtitle","lobType","icon","cityName","hotelName","hotelId","roomCount","checkInDate","checkOutDate","onwardFlight","returnFlight","onwardDate","returnDate","truncateText","text","maxLength","length","concat","substring","buildHotelCardRavenPayload","card","h_search_destination","h_search_destination_city","h_checkin_date","h_checkout_date","h_room_count","String","h_hotel_id","h_hotel_name","RecentSearchCard","_a","cardIndex","pageName","isPwa","isRemoving","onRemove","onClick","handleRemoveClick","useCallback","e","stopPropagation","handleCardClick","cardClassName","useMemo","classNames","styles","truncatedTitle","console","log","truncatedSubtitle","_jsx","__assign","className","children","_jsxs","Typography","variant","TypographyVariant","B3","colorCode","textTransform","HM4","P3","CrossIcon","width","height","color","ChevronRight","RecentSearchWidget","vertical","_b","ravenPayload","_c","apiDelay","_d","onDataReady","_e","onDataRemoved","_f","useState","shouldRender","setShouldRender","_g","cards","setCards","_h","dataLoaded","setDataLoaded","_j","Set","removingCardIds","setRemovingCardIds","impressionFiredRef","useRef","removeTimeoutsRef","Map","collapseTimeoutRef","displayedCards","slice","commonRavenPayload","payload","page_name","login_status","isUserSignedIn","isEmpty","platform","useEffect","timeoutsMap","current","collapseTimeout","forEach","timeout","clearTimeout","clear","Promise","resolve","setTimeout","data","fetchRecentSearches","then","response","items","hasItems","Array","isArray","fireImpressionEvent","cardCount","action_name","recent_searches_result_count","ravenSDKTrigger","fireCardClickEvent","card_number","fireCardDismissEvent","handleRemoveCard","cardId","prev","add","filter","c","newSet","delete","set","find","handleIntersection","handleItemClick","item","IntersectionObserverHOC","onIntersection","HM3","HM1","map","index","has"],"mappings":"2qCAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,
|
|
1
|
+
{"version":3,"file":"ct-platform-recent-search-widget.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/RecentSearchWidget/src/constant.ts","../packages/components/RecentSearchWidget/src/utils.ts","../packages/components/RecentSearchWidget/src/RecentSearchCard.tsx","../packages/components/RecentSearchWidget/src/RecentSearchWidget.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","MOCK_CARDS","id","title","subtitle","lobType","icon","cityName","hotelName","hotelId","roomCount","checkInDate","checkOutDate","onwardFlight","returnFlight","onwardDate","returnDate","truncateText","text","maxLength","length","concat","substring","buildHotelCardRavenPayload","card","h_search_destination","h_search_destination_city","h_checkin_date","h_checkout_date","h_room_count","String","h_hotel_id","h_hotel_name","RecentSearchCard","_a","cardIndex","pageName","isPwa","isRemoving","onRemove","onClick","handleRemoveClick","useCallback","e","stopPropagation","handleCardClick","cardClassName","useMemo","classNames","styles","truncatedTitle","console","log","truncatedSubtitle","_jsx","__assign","className","children","_jsxs","Typography","variant","TypographyVariant","B3","colorCode","textTransform","HM4","P3","CrossIcon","width","height","color","ChevronRight","RecentSearchWidget","vertical","_b","ravenPayload","_c","apiDelay","_d","onDataReady","_e","onDataRemoved","_f","useState","shouldRender","setShouldRender","_g","cards","setCards","_h","dataLoaded","setDataLoaded","_j","Set","removingCardIds","setRemovingCardIds","impressionFiredRef","useRef","removeTimeoutsRef","Map","collapseTimeoutRef","displayedCards","slice","commonRavenPayload","payload","page_name","login_status","isUserSignedIn","isEmpty","platform","useEffect","timeoutsMap","current","collapseTimeout","forEach","timeout","clearTimeout","clear","Promise","resolve","setTimeout","data","fetchRecentSearches","then","response","items","hasItems","Array","isArray","fireImpressionEvent","cardCount","action_name","recent_searches_result_count","ravenSDKTrigger","fireCardClickEvent","card_number","fireCardDismissEvent","handleRemoveCard","cardId","prev","add","filter","c","newSet","delete","set","find","handleIntersection","handleItemClick","item","IntersectionObserverHOC","onIntersection","HM3","HM1","map","index","has"],"mappings":"2qCAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,w7ECtBO,IAAMe,EAAyB,CAClC,CACIC,GAAI,IACJC,MAAO,wCACPC,SAAU,kBACVC,QAAS,QACTC,KAAM,aACNC,SAAU,QACVC,UAAW,sBACXC,QAAS,YACTC,UAAW,EACXC,YAAa,SACbC,aAAc,UAElB,CACIV,GAAI,IACJC,MAAO,yBACPC,SAAU,kBACVC,QAAS,QACTC,KAAM,aACNC,SAAU,WACVC,UAAW,qBACXC,QAAS,YACTC,UAAW,EACXC,YAAa,SACbC,aAAc,UAElB,CACIV,GAAI,IACJC,MAAO,iBACPC,SAAU,wBACVC,QAAS,SACTC,KAAM,cACNO,aAAc,iBACdC,aAAc,iBACdC,WAAY,eACZC,WAAY,gBAEhB,CACId,GAAI,IACJC,MAAO,gBACPC,SAAU,wBACVC,QAAS,MACTC,KAAM,WACNC,SAAU,SACVQ,WAAY,eACZC,WAAY,gBAEhB,CACId,GAAI,IACJC,MAAO,uBACPC,SAA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ACA7C,EAAkBc,QAAQgC,OAAON,EACpC,GAzJiB,KA2JlBxC,EAAkBc,QAAQiC,IAAIP,EAAQvB,GAEtC,IAAM3F,EAAO+D,EAAM2D,MAAK,SAACJ,GAAM,OAAAA,EAAE5I,KAAOwI,CAAT,IAC3BlH,GACAgH,GAAqBhH,EAAMW,EAEnC,GACA,CAACoD,EAAOiD,KAGNW,GAAqBzG,GAAY,WAC/BgD,GAAcW,EAAejF,OAAS,GACtC6G,GAAoB5B,EAAejF,OAE1C,GAAE,CAACsE,EAAYW,EAAejF,OAAQ6G,KAEjCmB,GAAkB1G,GACpB,SAAC2G,EAAgBlH,GACbmG,GAAmBe,EAAMlH,EAC7B,GACA,CAACmG,KAGL,OAAKlD,GAAiBM,GAAwC,IAA1BW,EAAejF,OAK/CkC,EAACgG,EAAwB/F,EAAA,CAAAgG,eAAgBJ,IAAkB,CAAA1F,SACvDH,EAAK,MAAAC,EAAA,CAAAC,UAAWP,GAAmB,CAAAQ,SAC/BH,EACI,MAAAC,EAAA,CAAAC,UAAWR,EACPC,EACCZ,EAEKY,EADAA,IAET,CAAAQ,SAEDC,WAAKF,UAAWP,cACZK,EAACK,KACGC,QACKvB,EAEKwB,EAAkB2F,IADlB3F,EAAkB4F,KACG,CAAAhG,SAAA,qBAKnCH,EACI,MAAAC,EAAA,CAAAC,UACKnB,EAEKY,EADAA,aAIToD,EAAeqD,KAAI,SAAClI,EAAMmI,GAAU,OACjCrG,EAACrB,EAEG,CAAAT,KAAMA,EACNW,UAAWwH,EACXtH,MAAOA,EACPD,SAAUA,EACVE,WAAYwD,EAAgB8D,IAAIpI,EAAKtB,IACrCqC,SAAUkG,GACVjG,QAAS4G,IAPJ5H,EAAKtB,uBAjC/B,IAiDf","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-platform-recent-search-widget",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.4",
|
|
4
4
|
"description": "Recent Search Widget Component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/ct-platform-recent-search-widget.cjs.js",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"@cleartrip/ct-design-typography": "3.7.0",
|
|
16
16
|
"classnames": "^2.5.1",
|
|
17
17
|
"uuid": "^9.0.1",
|
|
18
|
-
"@cleartrip/ct-platform-
|
|
19
|
-
"@cleartrip/ct-platform-
|
|
20
|
-
"@cleartrip/ct-platform-
|
|
21
|
-
"@cleartrip/ct-platform-
|
|
22
|
-
"@cleartrip/ct-platform-
|
|
18
|
+
"@cleartrip/ct-platform-utils": "4.2.0-beta.35",
|
|
19
|
+
"@cleartrip/ct-platform-io-hoc": "4.2.0-beta.35",
|
|
20
|
+
"@cleartrip/ct-platform-assets": "4.2.0-beta.35",
|
|
21
|
+
"@cleartrip/ct-platform-types": "4.2.0-beta.35",
|
|
22
|
+
"@cleartrip/ct-platform-shimmer": "4.2.0-beta.35"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=16.8.0",
|