@cleartrip/ct-platform-recent-search-widget 1.0.1-beta.32 → 1.0.1-beta.33
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"),n=require("react/jsx-runtime"),i=require("react"),t=require("classnames"),o=require("@cleartrip/ct-platform-io-hoc"),a=require("@cleartrip/ct-platform-constants"),r=require("@cleartrip/ct-platform-utils"),d=require("@cleartrip/ct-design-typography"),l=require("@cleartrip/ct-platform-assets");function s(e){return e&&e.__esModule?e:{default:e}}var c=s(t);var u="index-module_cysContainer__IxX-G",_="index-module_cysWrapper__1ce0P",p="index-module_cysWrapperPWA__WgM-l",x="index-module_cysWrapperDesktop__nb0PL",m="index-module_cysTitle__Lz1Rw",h="index-module_cysTitleDesktop__mS-mq",v="index-module_cysTitlePWA__j28bR",g="index-module_cysContentWrapper__E91-z",f="index-module_cysCardsPWA__R8Fka",y="index-module_cysCardsDesktop__JIMk8",C="index-module_cysCard__-4dBh",b="index-module_cysCardPWA__Yjxjo",w="index-module_cysCardDesktop__ToN9t",T="index-module_cysCardContent__xUEFU",k="index-module_cysCardTextWrapper__XjGQC",D="index-module_cysCardIconWrapper__GC4rs",R="index-module_cysCardIconDesktop__GIDrz",A="index-module_cysCardIconPWA__yuB1A",S="index-module_cysCardRemoving__fo6Kp",j="index-module_cysTextEllipsis__o0FhM",I="index-module_cysFlightTitle__MIdTw",W="index-module_cysLobTag__p-D23";!function(e,n){void 0===n&&(n={});var i=n.insertAt;if("undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&t.firstChild?t.insertBefore(o,t.firstChild):t.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:16px 0;width:100%}.index-module_cysWrapperDesktop__nb0PL{padding:32px 0 16px}.index-module_cysTitle__Lz1Rw{color:#1a1a1a;font-weight:600;margin:0;padding-bottom:12px;width:100%}.index-module_cysTitleDesktop__mS-mq{font-size:24px;line-height:28px}.index-module_cysTitlePWA__j28bR{font-size:16px;line-height:22px;padding-left:16px}.index-module_cysContentWrapper__E91-z{height:100%;position:relative;width:100%}.index-module_cysCardsPWA__R8Fka{-webkit-overflow-scrolling:touch;-ms-overflow-style:none;display:flex;left:0;overflow-x:auto;padding-left:16px;position:absolute;scroll-behavior:smooth;scrollbar-width:none;top:0;width:100%}.index-module_cysCardsPWA__R8Fka::-webkit-scrollbar{display:none;height:0;width:0}.index-module_cysCardsDesktop__JIMk8{display:flex;flex:1;gap:12px;padding:0 2px;width:100%}.index-module_cysCard__-4dBh{backface-visibility:hidden;border:1px solid #e2e2e2;border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;max-width:272px;min-width:188px;opacity:1;outline:none;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,box-shadow .3s cubic-bezier(.4,0,.2,1)}.index-module_cysCard__-4dBh:focus,.index-module_cysCard__-4dBh:focus-visible{outline:none}.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_cysCardDesktop__ToN9t:hover{box-shadow:0 4px 16px 0 rgba(26,26,26,.08)}.index-module_cysCardContent__xUEFU{display:flex;gap:8px;justify-content:space-between}.index-module_cysCardTextWrapper__XjGQC{align-items:flex-start;display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;overflow:hidden}.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{-webkit-tap-highlight-color:transparent;animation:index-module_cardFadeOut__TqBOB .2s cubic-bezier(.25,.46,.45,.94) forwards;border-color:#e2e2e2;box-shadow:none;outline:none;pointer-events:none}.index-module_cysCardRemoving__fo6Kp:active,.index-module_cysCardRemoving__fo6Kp:focus,.index-module_cysCardRemoving__fo6Kp:focus-visible{box-shadow:none;outline: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(-20px,0,0)}}.index-module_cysTextEllipsis__o0FhM{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.index-module_cysFlightTitle__MIdTw{align-items:center;display:inline-flex;gap:.2em;max-width:100%;min-width:0}.index-module_cysFlightTitle__MIdTw svg{flex-shrink:0;margin:0 4px}.index-module_cysLobTag__p-D23{background-color:#fff1ec;border-radius:4px;color:#ff4f17;padding:4px 6px;text-transform:uppercase}.index-module_cysSkeletonTitle__FdbOy{margin-bottom:12px;max-width:160px}.index-module_cysSkeletonTitleDesktop__xhD8b{max-width:200px}.index-module_cysSkeletonCard__-cU9a{border:1px solid #e2e2e2;border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;flex-shrink:0}.index-module_cysSkeletonCardPWA__bUS3v{margin-right:12px;max-width:272px;min-width:188px;padding:12px}.index-module_cysSkeletonCardPWA__bUS3v:last-child{margin-right:16px}.index-module_cysSkeletonCardDesktop__3TLGb{flex:1;min-width:0;padding:16px 12px 16px 16px}.index-module_cysSkeletonCardInner__7AgGe{align-items:flex-start;display:flex;gap:8px;justify-content:space-between}.index-module_cysSkeletonLines__4eKR3{display:flex;flex:1;flex-direction:column;gap:8px;min-width:0}");var E=function(t){var o=t.cardIndex,s=t.card,u=t.vertical,_=t.isPwa,p=t.isRemoving,x=t.onRemove,m=t.onClick,h=i.useMemo((function(){return c.default(C,_?b:w,p?S:"")}),[_,p]),v=(null==s?void 0:s.type)?r.getLOBType(s.type):"",g=i.useMemo((function(){if((null==s?void 0:s.type)===a.AIR_FUNNEL_JOURNEY){var i=r.getFlightsTitleParts(s.title,s.metaData,a.FLIGHTS_TITLE_MAX_LENGTH);if(i)return n.jsxs("span",e.__assign({className:I},{children:[i.origin,i.isOneWay?n.jsx(l.FlightOneWayArrowIcon,{}):n.jsx(l.FlightsTwoWayArrowIcon,{}),i.destination]}))}return r.truncateText(null==s?void 0:s.title,a.HOTEL_TITLE_MAX_LENGTH)}),[null==s?void 0:s.title,null==s?void 0:s.type,null==s?void 0:s.metaData]),f=i.useMemo((function(){return(null==s?void 0:s.subtitle)?r.truncateText(null==s?void 0:s.subtitle,a.SUBTITLE_MAX_LENGTH):""}),[null==s?void 0:s.subtitle]),y=i.useMemo((function(){var e,n=Boolean(f),i=null==s?void 0:s.metaData,t=r.formatRecentSearchCardTravelDates({cardType:null==s?void 0:s.type,journeyType:null==i?void 0:i.journey_type,travelDates:null===(e=null==s?void 0:s.metaData)||void 0===e?void 0:e.travelDates});return n||t?n&&t?"".concat(f,", ").concat(t):f||t:""}),[f,null==s?void 0:s.type,null==s?void 0:s.metaData]),E=i.useCallback((function(e){e.stopPropagation(),null==m||m(s,o)}),[m,s,o]),P=i.useCallback((function(e){e.stopPropagation(),_&&(null==x||x(s,o))}),[x,s,o,_]);return n.jsx("div",e.__assign({className:h,onClick:E},{children:n.jsxs("div",e.__assign({className:T},{children:[n.jsxs("div",e.__assign({className:k},{children:[u===a.UAR_VERTICAL&&(null==s?void 0:s.type)&&v&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.TAG,className:W},{children:v})),n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.HM4,className:j},{children:g})),y&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.P3,className:j},{children:y}))]})),n.jsx("div",e.__assign({className:c.default(D,_?A:R),onClick:P},{children:_?n.jsx(l.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(l.ChevronRight,{width:20,height:20})}))]}))}))};exports.RecentSearchCard=E,exports.RecentSearchWidget=function(t){var d,l,s,C=t.pageName,b=t.vertical,w=t.isPwa,T=void 0===w||w,k=t.cutoff,D=void 0===k?5e3:k,R=t.onDataReady,A=void 0===R?function(){}:R,S=t.onDataRemoved,j=void 0===S?function(){}:S,I=t.ravenPayload,W=t.additionalHeaders,P=t.additionalParams,N=t.setData,L=t.data,M=t.shouldFetchData,B=void 0===M||M,F=i.useState(),z=F[0],G=F[1],U=i.useState(new Set),q=U[0],O=U[1],K=B?z:L,H=i.useRef([]),V=i.useRef(!1),X=i.useRef(W),Y=i.useRef(P),J=i.useMemo((function(){var n=e.__assign({page_name:C,vertical:b},r.isEmpty(I)?{}:e.__assign({},I));return T||(n.platform="desktop"),n}),[I,T,C,b]),Q=i.useCallback((function(n){if(!V.current&&0!==n){V.current=!0;var i=e.__assign(e.__assign(e.__assign({},J),{action_name:"recentsearch_impression",recent_searches_result_count:n}),r.getUtmSourceEventData(b)),t=r.getEventNameByVertical(b,"recent_searches_widget_impression");r.ravenSDKTrigger(t,i)}}),[J,b]),Z=i.useCallback((function(e,n){var i=r.createRecentSearchCardRavenPayload("recentsearch_click",J,e,n),t=r.getEventNameByVertical(b,"recent_searches_card_click");r.ravenSDKTrigger(t,i)}),[J,b]),$=i.useCallback((function(e,n){var i=r.createRecentSearchCardRavenPayload("recentsearch_dismiss_click",J,e,n),t=r.getEventNameByVertical(b,"recent_searches_card_dismiss_click");r.ravenSDKTrigger(t,i)}),[J,b]),ee=i.useCallback((function(n,i){try{r.removeCYSCardByID(null==n?void 0:n.id,null==n?void 0:n.type,b,X.current,Y.current),O((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){var i,t;if(B&&N&&K){var o=null!==(t=null===(i=K.content)||void 0===i?void 0:i.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)})))&&void 0!==t?t:[];N(e.__assign(e.__assign({},K),{content:o}))}else G((function(i){var t,o;return i?e.__assign(e.__assign({},i),{content:null!==(o=null===(t=i.content)||void 0===t?void 0:t.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)})))&&void 0!==o?o:[]}):i}));O((function(e){var i=new Set(e);return i.delete(null==n?void 0:n.id),i}))}),250);$(n,i),H.current.push(t)}catch(e){console.error("Error removing CYS card:",e)}}),[$,B,N,K,b]),ne=i.useCallback((function(){var e;(null==K?void 0:K.content)&&(null===(e=K.content)||void 0===e?void 0:e.length)>0&&Q(K.content.length)}),[null===(d=null==K?void 0:K.content)||void 0===d?void 0:d.length,Q]),ie=i.useCallback((function(e,n){Z(e,n);var i=null==e?void 0:e.landingUrl;i&&!r.isServer()&&(window.location.href=i)}),[Z]);return i.useEffect((function(){var e=H.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),i.useEffect((function(){B&&e.__awaiter(void 0,void 0,void 0,(function(){var n,i,t,o,d,l;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,r.fetchRecentSearchesData(b,D,X.current,Y.current)];case 1:return n=e.sent(),i=null==n?void 0:n.content,Array.isArray(i)&&i.length>0&&(t=T&&b===a.UAR_VERTICAL?a.MAX_DISPLAYED_CARDS:a.MIN_DISPLAYED_CARDS,o=null==i?void 0:i.slice(0,t),d={usecase:null==n?void 0:n.usecase,content:o},G(d),null==A||A()),[3,3];case 2:return l=e.sent(),console.error("Error fetching recent searches",l),[3,3];case 3:return[2]}}))}))}),[b,D,T,A,B]),i.useEffect((function(){var e;B&&(null==K?void 0:K.content)&&0===(null===(e=K.content)||void 0===e?void 0:e.length)&&(null==j||j("cysWidget"))}),[null===(l=null==K?void 0:K.content)||void 0===l?void 0:l.length,j]),(null==K?void 0:K.content)&&0!==K.content.length?n.jsx(o.IntersectionObserverHOC,e.__assign({onIntersection:ne},{children:n.jsx("div",e.__assign({className:u},{children:n.jsxs("div",e.__assign({className:c.default(_,T?p:x)},{children:[n.jsx("div",e.__assign({className:c.default(m,T?v:h)},{children:"Recent searches"})),n.jsx("div",e.__assign({className:g},{children:n.jsx("div",e.__assign({className:T?f:y},{children:null===(s=null==K?void 0:K.content)||void 0===s?void 0:s.map((function(e,i){return n.jsx(E,{cardIndex:i,card:e,isPwa:T,vertical:b,isRemoving:q.has(e.id),onRemove:ee,onClick:ie},null==e?void 0:e.id)}))}))}))]}))}))})):null};
|
|
1
|
+
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("classnames"),r=require("@cleartrip/ct-platform-io-hoc"),a=require("@cleartrip/ct-platform-constants"),o=require("@cleartrip/ct-platform-utils"),d=require("@cleartrip/ct-design-typography"),l=require("@cleartrip/ct-platform-assets");function s(e){return e&&e.__esModule?e:{default:e}}var c=s(t);var u="index-module_cysContainer__IxX-G",_="index-module_cysWrapper__1ce0P",p="index-module_cysWrapperPWA__WgM-l",x="index-module_cysWrapperDesktop__nb0PL",m="index-module_cysTitle__Lz1Rw",v="index-module_cysTitleDesktop__mS-mq",h="index-module_cysTitlePWA__j28bR",g="index-module_cysContentWrapper__E91-z",f="index-module_cysCardsPWA__R8Fka",y="index-module_cysCardsDesktop__JIMk8",C="index-module_cysCard__-4dBh",w="index-module_cysCardPWA__Yjxjo",b="index-module_cysCardDesktop__ToN9t",T="index-module_cysCardContent__xUEFU",k="index-module_cysCardTextWrapper__XjGQC",R="index-module_cysCardIconWrapper__GC4rs",D="index-module_cysCardIconDesktop__GIDrz",A="index-module_cysCardIconPWA__yuB1A",j="index-module_cysCardRemoving__fo6Kp",I="index-module_cysTextEllipsis__o0FhM",E="index-module_cysFlightTitle__MIdTw",W="index-module_cysLobTag__p-D23";!function(e,n){void 0===n&&(n={});var i=n.insertAt;if("undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.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:16px 0;width:100%}.index-module_cysWrapperDesktop__nb0PL{padding:32px 0 16px}.index-module_cysTitle__Lz1Rw{color:#1a1a1a;font-weight:600;margin:0;padding-bottom:12px;width:100%}.index-module_cysTitleDesktop__mS-mq{font-size:24px;line-height:28px}.index-module_cysTitlePWA__j28bR{font-size:16px;line-height:22px;padding-left:16px}.index-module_cysContentWrapper__E91-z{height:100%;position:relative;width:100%}.index-module_cysCardsPWA__R8Fka{-webkit-overflow-scrolling:touch;-ms-overflow-style:none;display:flex;left:0;overflow-x:auto;padding-left:16px;position:absolute;scroll-behavior:smooth;scrollbar-width:none;top:0;width:100%}.index-module_cysCardsPWA__R8Fka::-webkit-scrollbar{display:none;height:0;width:0}.index-module_cysCardsDesktop__JIMk8{display:flex;flex:1;gap:12px;padding:0 2px;width:100%}.index-module_cysCard__-4dBh{backface-visibility:hidden;border:1px solid #e2e2e2;border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;max-width:272px;min-width:188px;opacity:1;outline:none;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,box-shadow .3s cubic-bezier(.4,0,.2,1)}.index-module_cysCard__-4dBh:focus,.index-module_cysCard__-4dBh:focus-visible{outline:none}.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_cysCardDesktop__ToN9t:hover{box-shadow:0 4px 16px 0 rgba(26,26,26,.08)}.index-module_cysCardContent__xUEFU{display:flex;gap:8px;justify-content:space-between}.index-module_cysCardTextWrapper__XjGQC{align-items:flex-start;display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;overflow:hidden}.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{-webkit-tap-highlight-color:transparent;animation:index-module_cardFadeOut__TqBOB .2s cubic-bezier(.25,.46,.45,.94) forwards;border-color:#e2e2e2;box-shadow:none;outline:none;pointer-events:none}.index-module_cysCardRemoving__fo6Kp:active,.index-module_cysCardRemoving__fo6Kp:focus,.index-module_cysCardRemoving__fo6Kp:focus-visible{box-shadow:none;outline: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(-20px,0,0)}}.index-module_cysTextEllipsis__o0FhM{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.index-module_cysFlightTitle__MIdTw{align-items:center;display:inline-flex;gap:.2em;max-width:100%;min-width:0}.index-module_cysFlightTitle__MIdTw svg{flex-shrink:0;margin:0 4px}.index-module_cysLobTag__p-D23{background-color:#fff1ec;border-radius:4px;color:#ff4f17;padding:4px 6px;text-transform:uppercase}");var N=function(t){var r=t.cardIndex,s=t.card,u=t.vertical,_=t.isPwa,p=t.isRemoving,x=t.onRemove,m=t.onClick,v=i.useMemo((function(){return c.default(C,_?w:b,p?j:"")}),[_,p]),h=(null==s?void 0:s.type)?o.getLOBType(s.type):"",g=i.useMemo((function(){if((null==s?void 0:s.type)===a.AIR_FUNNEL_JOURNEY){var i=o.getFlightsTitleParts(s.title,s.metaData,a.FLIGHTS_TITLE_MAX_LENGTH);if(i)return n.jsxs("span",e.__assign({className:E},{children:[i.origin,i.isOneWay?n.jsx(l.FlightOneWayArrowIcon,{}):n.jsx(l.FlightsTwoWayArrowIcon,{}),i.destination]}))}return o.truncateText(null==s?void 0:s.title,a.HOTEL_TITLE_MAX_LENGTH)}),[null==s?void 0:s.title,null==s?void 0:s.type,null==s?void 0:s.metaData]),f=i.useMemo((function(){return(null==s?void 0:s.subtitle)?o.truncateText(null==s?void 0:s.subtitle,a.SUBTITLE_MAX_LENGTH):""}),[null==s?void 0:s.subtitle]),y=i.useMemo((function(){var e,n=Boolean(f),i=null==s?void 0:s.metaData,t=o.formatRecentSearchCardTravelDates({cardType:null==s?void 0:s.type,journeyType:null==i?void 0:i.journey_type,travelDates:null===(e=null==s?void 0:s.metaData)||void 0===e?void 0:e.travelDates});return n||t?n&&t?"".concat(f,", ").concat(t):f||t:""}),[f,null==s?void 0:s.type,null==s?void 0:s.metaData]),N=i.useCallback((function(e){e.stopPropagation(),null==m||m(s,r)}),[m,s,r]),P=i.useCallback((function(e){e.stopPropagation(),_&&(null==x||x(s,r))}),[x,s,r,_]);return n.jsx("div",e.__assign({className:v,onClick:N},{children:n.jsxs("div",e.__assign({className:T},{children:[n.jsxs("div",e.__assign({className:k},{children:[u===a.UAR_VERTICAL&&(null==s?void 0:s.type)&&h&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.TAG,className:W},{children:h})),n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.HM4,className:I},{children:g})),y&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.P3,className:I},{children:y}))]})),n.jsx("div",e.__assign({className:c.default(R,_?A:D),onClick:P},{children:_?n.jsx(l.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(l.ChevronRight,{width:20,height:20})}))]}))}))};exports.RecentSearchCard=N,exports.RecentSearchWidget=function(t){var d,l,s,C=t.pageName,w=t.vertical,b=t.isPwa,T=void 0===b||b,k=t.cutoff,R=void 0===k?5e3:k,D=t.onDataReady,A=void 0===D?function(){}:D,j=t.onDataRemoved,I=void 0===j?function(){}:j,E=t.ravenPayload,W=t.additionalHeaders,P=t.additionalParams,S=t.setData,M=t.data,L=t.shouldFetchData,B=void 0===L||L,F=i.useState(),z=F[0],q=F[1],G=i.useState(new Set),O=G[0],U=G[1],H=B?z:M,K=i.useRef([]),V=i.useRef(!1),X=i.useRef(W),Y=i.useRef(P),J=i.useMemo((function(){var n=e.__assign({page_name:C,vertical:w},o.isEmpty(E)?{}:e.__assign({},E));return T||(n.platform="desktop"),n}),[E,T,C,w]),Q=i.useCallback((function(n){if(!V.current&&0!==n){V.current=!0;var i=e.__assign(e.__assign(e.__assign({},J),{action_name:"recentsearch_impression",recent_searches_result_count:n}),o.getUtmSourceEventData(w)),t=o.getEventNameByVertical(w,"recent_searches_widget_impression");o.ravenSDKTrigger(t,i)}}),[J,w]),Z=i.useCallback((function(e,n){var i=o.createRecentSearchCardRavenPayload("recentsearch_click",J,e,n),t=o.getEventNameByVertical(w,"recent_searches_card_click");o.ravenSDKTrigger(t,i)}),[J,w]),$=i.useCallback((function(e,n){var i=o.createRecentSearchCardRavenPayload("recentsearch_dismiss_click",J,e,n),t=o.getEventNameByVertical(w,"recent_searches_card_dismiss_click");o.ravenSDKTrigger(t,i)}),[J,w]),ee=i.useCallback((function(n,i){try{o.removeCYSCardByID(null==n?void 0:n.id,null==n?void 0:n.type,w,X.current,Y.current),U((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){var i,t;if(!B&&(null==H?void 0:H.content)){var r=null!==(t=null===(i=H.content)||void 0===i?void 0:i.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)})))&&void 0!==t?t:[];null==S||S(e.__assign(e.__assign({},H),{content:r}))}else q((function(i){var t,r;return i?e.__assign(e.__assign({},i),{content:null!==(r=null===(t=i.content)||void 0===t?void 0:t.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)})))&&void 0!==r?r:[]}):i}));U((function(e){var i=new Set(e);return i.delete(null==n?void 0:n.id),i}))}),250);$(n,i),K.current.push(t)}catch(e){console.error("Error removing CYS card:",e)}}),[$,B,S,H,w]),ne=i.useCallback((function(){var e;(null==H?void 0:H.content)&&(null===(e=H.content)||void 0===e?void 0:e.length)>0&&Q(H.content.length)}),[null===(d=null==H?void 0:H.content)||void 0===d?void 0:d.length,Q]),ie=i.useCallback((function(e,n){Z(e,n);var i=null==e?void 0:e.landingUrl;i&&!o.isServer()&&(window.location.href=i)}),[Z]);return i.useEffect((function(){var e=K.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),i.useEffect((function(){B&&e.__awaiter(void 0,void 0,void 0,(function(){var n,i,t,r,d,l;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,o.fetchRecentSearchesData(w,R,X.current,Y.current)];case 1:return n=e.sent(),i=null==n?void 0:n.content,Array.isArray(i)&&i.length>0&&(t=T&&w===a.UAR_VERTICAL?a.MAX_DISPLAYED_CARDS:a.MIN_DISPLAYED_CARDS,r=null==i?void 0:i.slice(0,t),d={usecase:null==n?void 0:n.usecase,content:r},q(d),null==A||A()),[3,3];case 2:return l=e.sent(),console.error("Error fetching recent searches",l),[3,3];case 3:return[2]}}))}))}),[w,R,T,A,B]),i.useEffect((function(){var e;B&&(null==H?void 0:H.content)&&0===(null===(e=H.content)||void 0===e?void 0:e.length)&&(null==I||I("cysWidget"))}),[null===(l=null==H?void 0:H.content)||void 0===l?void 0:l.length,I]),(null==H?void 0:H.content)&&0!==H.content.length?n.jsx(r.IntersectionObserverHOC,e.__assign({onIntersection:ne},{children:n.jsx("div",e.__assign({className:u},{children:n.jsxs("div",e.__assign({className:c.default(_,T?p:x)},{children:[n.jsx("div",e.__assign({className:c.default(m,T?h:v)},{children:"Recent searches"})),n.jsx("div",e.__assign({className:g},{children:n.jsx("div",e.__assign({className:T?f:y},{children:null===(s=null==H?void 0:H.content)||void 0===s?void 0:s.map((function(e,i){return n.jsx(N,{cardIndex:i,card:e,isPwa:T,vertical:w,isRemoving:O.has(e.id),onRemove:ee,onClick:ie},null==e?void 0: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/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],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","RecentSearchCard","_a","cardIndex","card","vertical","isPwa","isRemoving","onRemove","onClick","cardClassName","useMemo","classNames","default","styles","lobTypeText","getLOBType","truncatedTitle","AIR_FUNNEL_JOURNEY","parts","getFlightsTitleParts","title","metaData","FLIGHTS_TITLE_MAX_LENGTH","_jsxs","__assign","className","children","origin","isOneWay","_jsx","FlightOneWayArrowIcon","FlightsTwoWayArrowIcon","destination","truncateText","HOTEL_TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","flightsMeta","dateRange","formatRecentSearchCardTravelDates","cardType","journeyType","journey_type","travelDates","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","jsx","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","pageName","_e","_f","cutoff","_g","onDataReady","_h","onDataRemoved","ravenPayload","additionalHeaders","additionalParams","setData","data","_j","shouldFetchData","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeCYSCardByID","id","prev","add","timeout","setTimeout","newContent","_b","content","filter","c","newSet","delete","push","error","console","handleIntersection","length","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","MAX_DISPLAYED_CARDS","MIN_DISPLAYED_CARDS","displayedItems","slice","data_1","usecase","error_1","_c","IntersectionObserverHOC","onIntersection","jsxs","_d","map","has"],"mappings":"ytCAAA,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,mgICKM,IAAAe,EAAmB,SAACC,GACtB,IAA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EACVE,WAAYkF,EAAgB2E,IAAIhK,EAAKgH,IACrC5G,SAAU0G,GACVzG,QAAS4H,IAPJjI,aAAI,EAAJA,EAAMgH,GASlB,oBA3Cd,IAkDf","x_google_ignoreList":[0]}
|
|
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/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],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","RecentSearchCard","_a","cardIndex","card","vertical","isPwa","isRemoving","onRemove","onClick","cardClassName","useMemo","classNames","default","styles","lobTypeText","getLOBType","truncatedTitle","AIR_FUNNEL_JOURNEY","parts","getFlightsTitleParts","title","metaData","FLIGHTS_TITLE_MAX_LENGTH","_jsxs","__assign","className","children","origin","isOneWay","_jsx","FlightOneWayArrowIcon","FlightsTwoWayArrowIcon","destination","truncateText","HOTEL_TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","flightsMeta","dateRange","formatRecentSearchCardTravelDates","cardType","journeyType","journey_type","travelDates","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","jsx","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","pageName","_e","_f","cutoff","_g","onDataReady","_h","onDataRemoved","ravenPayload","additionalHeaders","additionalParams","setData","data","_j","shouldFetchData","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeCYSCardByID","id","prev","add","timeout","setTimeout","content","newContent","_b","filter","c","newSet","delete","push","error","console","handleIntersection","length","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","MAX_DISPLAYED_CARDS","MIN_DISPLAYED_CARDS","displayedItems","slice","data_1","usecase","error_1","_c","IntersectionObserverHOC","onIntersection","jsxs","_d","map","has"],"mappings":"ytCAAA,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,swGCKM,IAAAe,EAAmB,SAACC,GACtB,IAAAC,cACAC,SACAC,aACAC,EAAKJ,EAAAI,MACLC,EAAUL,EAAAK,WACVC,EAAQN,EAAAM,SACRC,EAAOP,EA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EAAKgH,IACrC5G,SAAU0G,GACVzG,QAAS4H,IAPJjI,aAAI,EAAJA,EAAMgH,GASlB,oBA3Cd,IAkDf","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as i,__generator as n}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useMemo as d,useCallback as r,useState as l,useRef as a,useEffect as c}from"react";import s from"classnames";import{IntersectionObserverHOC as u}from"@cleartrip/ct-platform-io-hoc";import{AIR_FUNNEL_JOURNEY as _,FLIGHTS_TITLE_MAX_LENGTH as p,HOTEL_TITLE_MAX_LENGTH as m,SUBTITLE_MAX_LENGTH as x,UAR_VERTICAL as h,MAX_DISPLAYED_CARDS as v,MIN_DISPLAYED_CARDS as f}from"@cleartrip/ct-platform-constants";import{getLOBType as y,getFlightsTitleParts as g,truncateText as w,formatRecentSearchCardTravelDates as b,isEmpty as C,getUtmSourceEventData as k,getEventNameByVertical as T,ravenSDKTrigger as W,createRecentSearchCardRavenPayload as D,removeCYSCardByID as P,isServer as A,fetchRecentSearchesData as R}from"@cleartrip/ct-platform-utils";import{Typography as I,TypographyVariant as N}from"@cleartrip/ct-design-typography";import{FlightOneWayArrowIcon as S,FlightsTwoWayArrowIcon as z,ChevronRight as j,CrossIcon as F}from"@cleartrip/ct-platform-assets";var B="index-module_cysContainer__IxX-G",E="index-module_cysWrapper__1ce0P",G="index-module_cysWrapperPWA__WgM-l",M="index-module_cysWrapperDesktop__nb0PL",L="index-module_cysTitle__Lz1Rw",U="index-module_cysTitleDesktop__mS-mq",K="index-module_cysTitlePWA__j28bR",O="index-module_cysContentWrapper__E91-z",q="index-module_cysCardsPWA__R8Fka",X="index-module_cysCardsDesktop__JIMk8",Y="index-module_cysCard__-4dBh",H="index-module_cysCardPWA__Yjxjo",J="index-module_cysCardDesktop__ToN9t",Q="index-module_cysCardContent__xUEFU",Z="index-module_cysCardTextWrapper__XjGQC",V="index-module_cysCardIconWrapper__GC4rs",$="index-module_cysCardIconDesktop__GIDrz",ee="index-module_cysCardIconPWA__yuB1A",ie="index-module_cysCardRemoving__fo6Kp",ne="index-module_cysTextEllipsis__o0FhM",te="index-module_cysFlightTitle__MIdTw",oe="index-module_cysLobTag__p-D23";!function(e,i){void 0===i&&(i={});var n=i.insertAt;if("undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&t.firstChild?t.insertBefore(o,t.firstChild):t.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:16px 0;width:100%}.index-module_cysWrapperDesktop__nb0PL{padding:32px 0 16px}.index-module_cysTitle__Lz1Rw{color:#1a1a1a;font-weight:600;margin:0;padding-bottom:12px;width:100%}.index-module_cysTitleDesktop__mS-mq{font-size:24px;line-height:28px}.index-module_cysTitlePWA__j28bR{font-size:16px;line-height:22px;padding-left:16px}.index-module_cysContentWrapper__E91-z{height:100%;position:relative;width:100%}.index-module_cysCardsPWA__R8Fka{-webkit-overflow-scrolling:touch;-ms-overflow-style:none;display:flex;left:0;overflow-x:auto;padding-left:16px;position:absolute;scroll-behavior:smooth;scrollbar-width:none;top:0;width:100%}.index-module_cysCardsPWA__R8Fka::-webkit-scrollbar{display:none;height:0;width:0}.index-module_cysCardsDesktop__JIMk8{display:flex;flex:1;gap:12px;padding:0 2px;width:100%}.index-module_cysCard__-4dBh{backface-visibility:hidden;border:1px solid #e2e2e2;border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;max-width:272px;min-width:188px;opacity:1;outline:none;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,box-shadow .3s cubic-bezier(.4,0,.2,1)}.index-module_cysCard__-4dBh:focus,.index-module_cysCard__-4dBh:focus-visible{outline:none}.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_cysCardDesktop__ToN9t:hover{box-shadow:0 4px 16px 0 rgba(26,26,26,.08)}.index-module_cysCardContent__xUEFU{display:flex;gap:8px;justify-content:space-between}.index-module_cysCardTextWrapper__XjGQC{align-items:flex-start;display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;overflow:hidden}.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{-webkit-tap-highlight-color:transparent;animation:index-module_cardFadeOut__TqBOB .2s cubic-bezier(.25,.46,.45,.94) forwards;border-color:#e2e2e2;box-shadow:none;outline:none;pointer-events:none}.index-module_cysCardRemoving__fo6Kp:active,.index-module_cysCardRemoving__fo6Kp:focus,.index-module_cysCardRemoving__fo6Kp:focus-visible{box-shadow:none;outline: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(-20px,0,0)}}.index-module_cysTextEllipsis__o0FhM{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.index-module_cysFlightTitle__MIdTw{align-items:center;display:inline-flex;gap:.2em;max-width:100%;min-width:0}.index-module_cysFlightTitle__MIdTw svg{flex-shrink:0;margin:0 4px}.index-module_cysLobTag__p-D23{background-color:#fff1ec;border-radius:4px;color:#ff4f17;padding:4px 6px;text-transform:uppercase}.index-module_cysSkeletonTitle__FdbOy{margin-bottom:12px;max-width:160px}.index-module_cysSkeletonTitleDesktop__xhD8b{max-width:200px}.index-module_cysSkeletonCard__-cU9a{border:1px solid #e2e2e2;border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;flex-shrink:0}.index-module_cysSkeletonCardPWA__bUS3v{margin-right:12px;max-width:272px;min-width:188px;padding:12px}.index-module_cysSkeletonCardPWA__bUS3v:last-child{margin-right:16px}.index-module_cysSkeletonCardDesktop__3TLGb{flex:1;min-width:0;padding:16px 12px 16px 16px}.index-module_cysSkeletonCardInner__7AgGe{align-items:flex-start;display:flex;gap:8px;justify-content:space-between}.index-module_cysSkeletonLines__4eKR3{display:flex;flex:1;flex-direction:column;gap:8px;min-width:0}");var de=function(i){var n=i.cardIndex,l=i.card,a=i.vertical,c=i.isPwa,u=i.isRemoving,v=i.onRemove,f=i.onClick,C=d((function(){return s(Y,c?H:J,u?ie:"")}),[c,u]),k=(null==l?void 0:l.type)?y(l.type):"",T=d((function(){if((null==l?void 0:l.type)===_){var i=g(l.title,l.metaData,p);if(i)return t("span",e({className:te},{children:[i.origin,i.isOneWay?o(S,{}):o(z,{}),i.destination]}))}return w(null==l?void 0:l.title,m)}),[null==l?void 0:l.title,null==l?void 0:l.type,null==l?void 0:l.metaData]),W=d((function(){return(null==l?void 0:l.subtitle)?w(null==l?void 0:l.subtitle,x):""}),[null==l?void 0:l.subtitle]),D=d((function(){var e,i=Boolean(W),n=null==l?void 0:l.metaData,t=b({cardType:null==l?void 0:l.type,journeyType:null==n?void 0:n.journey_type,travelDates:null===(e=null==l?void 0:l.metaData)||void 0===e?void 0:e.travelDates});return i||t?i&&t?"".concat(W,", ").concat(t):W||t:""}),[W,null==l?void 0:l.type,null==l?void 0:l.metaData]),P=r((function(e){e.stopPropagation(),null==f||f(l,n)}),[f,l,n]),A=r((function(e){e.stopPropagation(),c&&(null==v||v(l,n))}),[v,l,n,c]);return o("div",e({className:C,onClick:P},{children:t("div",e({className:Q},{children:[t("div",e({className:Z},{children:[a===h&&(null==l?void 0:l.type)&&k&&o(I,e({variant:N.TAG,className:oe},{children:k})),o(I,e({variant:N.HM4,className:ne},{children:T})),D&&o(I,e({variant:N.P3,className:ne},{children:D}))]})),o("div",e({className:s(V,c?ee:$),onClick:A},{children:c?o(F,{width:16,height:16,color:"#1A1A1A"}):o(j,{width:20,height:20})}))]}))}))},re=function(_){var p,m,x,y=_.pageName,g=_.vertical,w=_.isPwa,b=void 0===w||w,I=_.cutoff,N=void 0===I?5e3:I,S=_.onDataReady,z=void 0===S?function(){}:S,j=_.onDataRemoved,F=void 0===j?function(){}:j,Y=_.ravenPayload,H=_.additionalHeaders,J=_.additionalParams,Q=_.setData,Z=_.data,V=_.shouldFetchData,$=void 0===V||V,ee=l(),ie=ee[0],ne=ee[1],te=l(new Set),oe=te[0],re=te[1],le=$?ie:Z,ae=a([]),ce=a(!1),se=a(H),ue=a(J),_e=d((function(){var i=e({page_name:y,vertical:g},C(Y)?{}:e({},Y));return b||(i.platform="desktop"),i}),[Y,b,y,g]),pe=r((function(i){if(!ce.current&&0!==i){ce.current=!0;var n=e(e(e({},_e),{action_name:"recentsearch_impression",recent_searches_result_count:i}),k(g)),t=T(g,"recent_searches_widget_impression");W(t,n)}}),[_e,g]),me=r((function(e,i){var n=D("recentsearch_click",_e,e,i),t=T(g,"recent_searches_card_click");W(t,n)}),[_e,g]),xe=r((function(e,i){var n=D("recentsearch_dismiss_click",_e,e,i),t=T(g,"recent_searches_card_dismiss_click");W(t,n)}),[_e,g]),he=r((function(i,n){try{P(null==i?void 0:i.id,null==i?void 0:i.type,g,se.current,ue.current),re((function(e){return new Set(e).add(null==i?void 0:i.id)}));var t=setTimeout((function(){var n,t;if($&&Q&&le){var o=null!==(t=null===(n=le.content)||void 0===n?void 0:n.filter((function(e){return(null==e?void 0:e.id)!==(null==i?void 0:i.id)})))&&void 0!==t?t:[];Q(e(e({},le),{content:o}))}else ne((function(n){var t,o;return n?e(e({},n),{content:null!==(o=null===(t=n.content)||void 0===t?void 0:t.filter((function(e){return(null==e?void 0:e.id)!==(null==i?void 0:i.id)})))&&void 0!==o?o:[]}):n}));re((function(e){var n=new Set(e);return n.delete(null==i?void 0:i.id),n}))}),250);xe(i,n),ae.current.push(t)}catch(e){console.error("Error removing CYS card:",e)}}),[xe,$,Q,le,g]),ve=r((function(){var e;(null==le?void 0:le.content)&&(null===(e=le.content)||void 0===e?void 0:e.length)>0&&pe(le.content.length)}),[null===(p=null==le?void 0:le.content)||void 0===p?void 0:p.length,pe]),fe=r((function(e,i){me(e,i);var n=null==e?void 0:e.landingUrl;n&&!A()&&(window.location.href=n)}),[me]);return c((function(){var e=ae.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),c((function(){$&&i(void 0,void 0,void 0,(function(){var e,i,t,o,d,r;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,R(g,N,se.current,ue.current)];case 1:return e=n.sent(),i=null==e?void 0:e.content,Array.isArray(i)&&i.length>0&&(t=b&&g===h?v:f,o=null==i?void 0:i.slice(0,t),d={usecase:null==e?void 0:e.usecase,content:o},ne(d),null==z||z()),[3,3];case 2:return r=n.sent(),console.error("Error fetching recent searches",r),[3,3];case 3:return[2]}}))}))}),[g,N,b,z,$]),c((function(){var e;$&&(null==le?void 0:le.content)&&0===(null===(e=le.content)||void 0===e?void 0:e.length)&&(null==F||F("cysWidget"))}),[null===(m=null==le?void 0:le.content)||void 0===m?void 0:m.length,F]),(null==le?void 0:le.content)&&0!==le.content.length?o(u,e({onIntersection:ve},{children:o("div",e({className:B},{children:t("div",e({className:s(E,b?G:M)},{children:[o("div",e({className:s(L,b?K:U)},{children:"Recent searches"})),o("div",e({className:O},{children:o("div",e({className:b?q:X},{children:null===(x=null==le?void 0:le.content)||void 0===x?void 0:x.map((function(e,i){return o(de,{cardIndex:i,card:e,isPwa:b,vertical:g,isRemoving:oe.has(e.id),onRemove:he,onClick:fe},null==e?void 0:e.id)}))}))}))]}))}))})):null};export{de as RecentSearchCard,re as RecentSearchWidget};
|
|
1
|
+
import{__assign as e,__awaiter as n,__generator as i}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useMemo as d,useCallback as r,useState as l,useRef as a,useEffect as c}from"react";import s from"classnames";import{IntersectionObserverHOC as u}from"@cleartrip/ct-platform-io-hoc";import{AIR_FUNNEL_JOURNEY as _,FLIGHTS_TITLE_MAX_LENGTH as p,HOTEL_TITLE_MAX_LENGTH as m,SUBTITLE_MAX_LENGTH as x,UAR_VERTICAL as v,MAX_DISPLAYED_CARDS as h,MIN_DISPLAYED_CARDS as f}from"@cleartrip/ct-platform-constants";import{getLOBType as y,getFlightsTitleParts as g,truncateText as w,formatRecentSearchCardTravelDates as b,isEmpty as C,getUtmSourceEventData as k,getEventNameByVertical as T,ravenSDKTrigger as W,createRecentSearchCardRavenPayload as D,removeCYSCardByID as P,isServer as A,fetchRecentSearchesData as N}from"@cleartrip/ct-platform-utils";import{Typography as R,TypographyVariant as I}from"@cleartrip/ct-design-typography";import{FlightOneWayArrowIcon as z,FlightsTwoWayArrowIcon as j,ChevronRight as B,CrossIcon as F}from"@cleartrip/ct-platform-assets";var E="index-module_cysContainer__IxX-G",M="index-module_cysWrapper__1ce0P",G="index-module_cysWrapperPWA__WgM-l",S="index-module_cysWrapperDesktop__nb0PL",L="index-module_cysTitle__Lz1Rw",K="index-module_cysTitleDesktop__mS-mq",O="index-module_cysTitlePWA__j28bR",U="index-module_cysContentWrapper__E91-z",q="index-module_cysCardsPWA__R8Fka",X="index-module_cysCardsDesktop__JIMk8",Y="index-module_cysCard__-4dBh",H="index-module_cysCardPWA__Yjxjo",J="index-module_cysCardDesktop__ToN9t",Q="index-module_cysCardContent__xUEFU",Z="index-module_cysCardTextWrapper__XjGQC",V="index-module_cysCardIconWrapper__GC4rs",$="index-module_cysCardIconDesktop__GIDrz",ee="index-module_cysCardIconPWA__yuB1A",ne="index-module_cysCardRemoving__fo6Kp",ie="index-module_cysTextEllipsis__o0FhM",te="index-module_cysFlightTitle__MIdTw",oe="index-module_cysLobTag__p-D23";!function(e,n){void 0===n&&(n={});var i=n.insertAt;if("undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&t.firstChild?t.insertBefore(o,t.firstChild):t.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:16px 0;width:100%}.index-module_cysWrapperDesktop__nb0PL{padding:32px 0 16px}.index-module_cysTitle__Lz1Rw{color:#1a1a1a;font-weight:600;margin:0;padding-bottom:12px;width:100%}.index-module_cysTitleDesktop__mS-mq{font-size:24px;line-height:28px}.index-module_cysTitlePWA__j28bR{font-size:16px;line-height:22px;padding-left:16px}.index-module_cysContentWrapper__E91-z{height:100%;position:relative;width:100%}.index-module_cysCardsPWA__R8Fka{-webkit-overflow-scrolling:touch;-ms-overflow-style:none;display:flex;left:0;overflow-x:auto;padding-left:16px;position:absolute;scroll-behavior:smooth;scrollbar-width:none;top:0;width:100%}.index-module_cysCardsPWA__R8Fka::-webkit-scrollbar{display:none;height:0;width:0}.index-module_cysCardsDesktop__JIMk8{display:flex;flex:1;gap:12px;padding:0 2px;width:100%}.index-module_cysCard__-4dBh{backface-visibility:hidden;border:1px solid #e2e2e2;border-radius:12px;box-sizing:border-box;display:flex;flex-direction:column;max-width:272px;min-width:188px;opacity:1;outline:none;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,box-shadow .3s cubic-bezier(.4,0,.2,1)}.index-module_cysCard__-4dBh:focus,.index-module_cysCard__-4dBh:focus-visible{outline:none}.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_cysCardDesktop__ToN9t:hover{box-shadow:0 4px 16px 0 rgba(26,26,26,.08)}.index-module_cysCardContent__xUEFU{display:flex;gap:8px;justify-content:space-between}.index-module_cysCardTextWrapper__XjGQC{align-items:flex-start;display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;overflow:hidden}.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{-webkit-tap-highlight-color:transparent;animation:index-module_cardFadeOut__TqBOB .2s cubic-bezier(.25,.46,.45,.94) forwards;border-color:#e2e2e2;box-shadow:none;outline:none;pointer-events:none}.index-module_cysCardRemoving__fo6Kp:active,.index-module_cysCardRemoving__fo6Kp:focus,.index-module_cysCardRemoving__fo6Kp:focus-visible{box-shadow:none;outline: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(-20px,0,0)}}.index-module_cysTextEllipsis__o0FhM{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.index-module_cysFlightTitle__MIdTw{align-items:center;display:inline-flex;gap:.2em;max-width:100%;min-width:0}.index-module_cysFlightTitle__MIdTw svg{flex-shrink:0;margin:0 4px}.index-module_cysLobTag__p-D23{background-color:#fff1ec;border-radius:4px;color:#ff4f17;padding:4px 6px;text-transform:uppercase}");var de=function(n){var i=n.cardIndex,l=n.card,a=n.vertical,c=n.isPwa,u=n.isRemoving,h=n.onRemove,f=n.onClick,C=d((function(){return s(Y,c?H:J,u?ne:"")}),[c,u]),k=(null==l?void 0:l.type)?y(l.type):"",T=d((function(){if((null==l?void 0:l.type)===_){var n=g(l.title,l.metaData,p);if(n)return t("span",e({className:te},{children:[n.origin,n.isOneWay?o(z,{}):o(j,{}),n.destination]}))}return w(null==l?void 0:l.title,m)}),[null==l?void 0:l.title,null==l?void 0:l.type,null==l?void 0:l.metaData]),W=d((function(){return(null==l?void 0:l.subtitle)?w(null==l?void 0:l.subtitle,x):""}),[null==l?void 0:l.subtitle]),D=d((function(){var e,n=Boolean(W),i=null==l?void 0:l.metaData,t=b({cardType:null==l?void 0:l.type,journeyType:null==i?void 0:i.journey_type,travelDates:null===(e=null==l?void 0:l.metaData)||void 0===e?void 0:e.travelDates});return n||t?n&&t?"".concat(W,", ").concat(t):W||t:""}),[W,null==l?void 0:l.type,null==l?void 0:l.metaData]),P=r((function(e){e.stopPropagation(),null==f||f(l,i)}),[f,l,i]),A=r((function(e){e.stopPropagation(),c&&(null==h||h(l,i))}),[h,l,i,c]);return o("div",e({className:C,onClick:P},{children:t("div",e({className:Q},{children:[t("div",e({className:Z},{children:[a===v&&(null==l?void 0:l.type)&&k&&o(R,e({variant:I.TAG,className:oe},{children:k})),o(R,e({variant:I.HM4,className:ie},{children:T})),D&&o(R,e({variant:I.P3,className:ie},{children:D}))]})),o("div",e({className:s(V,c?ee:$),onClick:A},{children:c?o(F,{width:16,height:16,color:"#1A1A1A"}):o(B,{width:20,height:20})}))]}))}))},re=function(_){var p,m,x,y=_.pageName,g=_.vertical,w=_.isPwa,b=void 0===w||w,R=_.cutoff,I=void 0===R?5e3:R,z=_.onDataReady,j=void 0===z?function(){}:z,B=_.onDataRemoved,F=void 0===B?function(){}:B,Y=_.ravenPayload,H=_.additionalHeaders,J=_.additionalParams,Q=_.setData,Z=_.data,V=_.shouldFetchData,$=void 0===V||V,ee=l(),ne=ee[0],ie=ee[1],te=l(new Set),oe=te[0],re=te[1],le=$?ne:Z,ae=a([]),ce=a(!1),se=a(H),ue=a(J),_e=d((function(){var n=e({page_name:y,vertical:g},C(Y)?{}:e({},Y));return b||(n.platform="desktop"),n}),[Y,b,y,g]),pe=r((function(n){if(!ce.current&&0!==n){ce.current=!0;var i=e(e(e({},_e),{action_name:"recentsearch_impression",recent_searches_result_count:n}),k(g)),t=T(g,"recent_searches_widget_impression");W(t,i)}}),[_e,g]),me=r((function(e,n){var i=D("recentsearch_click",_e,e,n),t=T(g,"recent_searches_card_click");W(t,i)}),[_e,g]),xe=r((function(e,n){var i=D("recentsearch_dismiss_click",_e,e,n),t=T(g,"recent_searches_card_dismiss_click");W(t,i)}),[_e,g]),ve=r((function(n,i){try{P(null==n?void 0:n.id,null==n?void 0:n.type,g,se.current,ue.current),re((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){var i,t;if(!$&&(null==le?void 0:le.content)){var o=null!==(t=null===(i=le.content)||void 0===i?void 0:i.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)})))&&void 0!==t?t:[];null==Q||Q(e(e({},le),{content:o}))}else ie((function(i){var t,o;return i?e(e({},i),{content:null!==(o=null===(t=i.content)||void 0===t?void 0:t.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)})))&&void 0!==o?o:[]}):i}));re((function(e){var i=new Set(e);return i.delete(null==n?void 0:n.id),i}))}),250);xe(n,i),ae.current.push(t)}catch(e){console.error("Error removing CYS card:",e)}}),[xe,$,Q,le,g]),he=r((function(){var e;(null==le?void 0:le.content)&&(null===(e=le.content)||void 0===e?void 0:e.length)>0&&pe(le.content.length)}),[null===(p=null==le?void 0:le.content)||void 0===p?void 0:p.length,pe]),fe=r((function(e,n){me(e,n);var i=null==e?void 0:e.landingUrl;i&&!A()&&(window.location.href=i)}),[me]);return c((function(){var e=ae.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),c((function(){$&&n(void 0,void 0,void 0,(function(){var e,n,t,o,d,r;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,N(g,I,se.current,ue.current)];case 1:return e=i.sent(),n=null==e?void 0:e.content,Array.isArray(n)&&n.length>0&&(t=b&&g===v?h:f,o=null==n?void 0:n.slice(0,t),d={usecase:null==e?void 0:e.usecase,content:o},ie(d),null==j||j()),[3,3];case 2:return r=i.sent(),console.error("Error fetching recent searches",r),[3,3];case 3:return[2]}}))}))}),[g,I,b,j,$]),c((function(){var e;$&&(null==le?void 0:le.content)&&0===(null===(e=le.content)||void 0===e?void 0:e.length)&&(null==F||F("cysWidget"))}),[null===(m=null==le?void 0:le.content)||void 0===m?void 0:m.length,F]),(null==le?void 0:le.content)&&0!==le.content.length?o(u,e({onIntersection:he},{children:o("div",e({className:E},{children:t("div",e({className:s(M,b?G:S)},{children:[o("div",e({className:s(L,b?O:K)},{children:"Recent searches"})),o("div",e({className:U},{children:o("div",e({className:b?q:X},{children:null===(x=null==le?void 0:le.content)||void 0===x?void 0:x.map((function(e,n){return o(de,{cardIndex:n,card:e,isPwa:b,vertical:g,isRemoving:oe.has(e.id),onRemove:ve,onClick:fe},null==e?void 0:e.id)}))}))}))]}))}))})):null};export{de as RecentSearchCard,re 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/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],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","RecentSearchCard","_a","cardIndex","card","vertical","isPwa","isRemoving","onRemove","onClick","cardClassName","useMemo","classNames","styles","lobTypeText","getLOBType","truncatedTitle","AIR_FUNNEL_JOURNEY","parts","getFlightsTitleParts","title","metaData","FLIGHTS_TITLE_MAX_LENGTH","_jsxs","__assign","className","children","origin","isOneWay","_jsx","FlightOneWayArrowIcon","FlightsTwoWayArrowIcon","destination","truncateText","HOTEL_TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","flightsMeta","dateRange","formatRecentSearchCardTravelDates","cardType","journeyType","journey_type","travelDates","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","RecentSearchWidget","pageName","_e","_f","cutoff","_g","onDataReady","_h","onDataRemoved","ravenPayload","additionalHeaders","additionalParams","setData","data","_j","shouldFetchData","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeCYSCardByID","id","prev","add","timeout","setTimeout","
|
|
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/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],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","RecentSearchCard","_a","cardIndex","card","vertical","isPwa","isRemoving","onRemove","onClick","cardClassName","useMemo","classNames","styles","lobTypeText","getLOBType","truncatedTitle","AIR_FUNNEL_JOURNEY","parts","getFlightsTitleParts","title","metaData","FLIGHTS_TITLE_MAX_LENGTH","_jsxs","__assign","className","children","origin","isOneWay","_jsx","FlightOneWayArrowIcon","FlightsTwoWayArrowIcon","destination","truncateText","HOTEL_TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","flightsMeta","dateRange","formatRecentSearchCardTravelDates","cardType","journeyType","journey_type","travelDates","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","RecentSearchWidget","pageName","_e","_f","cutoff","_g","onDataReady","_h","onDataRemoved","ravenPayload","additionalHeaders","additionalParams","setData","data","_j","shouldFetchData","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeCYSCardByID","id","prev","add","timeout","setTimeout","content","newContent","_b","filter","c","newSet","delete","push","error","console","handleIntersection","length","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","MAX_DISPLAYED_CARDS","MIN_DISPLAYED_CARDS","displayedItems","slice","data_1","usecase","error_1","_c","IntersectionObserverHOC","onIntersection","_d","map","has"],"mappings":"04DAAA,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,swGCKM,IAAAe,GAAmB,SAACC,GACtB,IAAAC,cACAC,SACAC,aACAC,EAAKJ,EAAAI,MACLC,EAAUL,EAAAK,WACVC,EAAQN,EAAAM,SACRC,EAAOP,EAAAO,QAEDC,EAAgBC,GAClB,WACI,OAAAC,EACIC,EACCP,EAAgCO,EAAxBA,EACTN,EAAaM,GAAyB,GAH1C,GAKJ,CAACP,EAAOC,IAGNO,GAAcV,aAAI,EAAJA,EAAMV,MAAOqB,EAAWX,EAAKV,MAAQ,GAEnDsB,EAAiBL,GAAQ,WAC3B,IAAIP,aAAI,EAAJA,EAAMV,QAASuB,EAAoB,CACnC,IAAMC,EAAQC,EACVf,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IVgB,EACI,MAAAL,EAAA,CAAAC,UAAWb,EACPC,EACCP,EAEKO,EADAA,IAET,CAAAa,SAAA,qBAILG,EAAK,MAAAL,EAAA,CAAAC,UAAWZ,GAAwB,CAAAa,SACpCG,WACIJ,UACKnB,EAEKO,EADAA,GACkB,CAAAa,SAGN,UAArBgE,cAAU,EAAVA,GAAY8B,eAAS,IAAAwC,OAAA,EAAAA,EAAAC,KAAI,SAAC7J,EAAMD,GAAc,OAC3C0B,EAAC5B,IAEGE,UAAWA,EACXC,KAAMA,EACNE,MAAOA,EACPD,SAAUA,EACVE,WAAYiF,GAAgB0E,IAAI9J,EAAK+G,IACrC3G,SAAUyG,GACVxG,QAAS2H,IAPJhI,aAAI,EAAJA,EAAM+G,GASlB,oBA3Cd,IAkDf","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.33",
|
|
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-assets": "4.2.0-beta.
|
|
19
|
-
"@cleartrip/ct-platform-
|
|
20
|
-
"@cleartrip/ct-platform-
|
|
21
|
-
"@cleartrip/ct-platform-
|
|
22
|
-
"@cleartrip/ct-platform-
|
|
18
|
+
"@cleartrip/ct-platform-assets": "4.2.0-beta.64",
|
|
19
|
+
"@cleartrip/ct-platform-utils": "4.2.0-beta.64",
|
|
20
|
+
"@cleartrip/ct-platform-io-hoc": "4.2.0-beta.64",
|
|
21
|
+
"@cleartrip/ct-platform-constants": "4.2.0-beta.64",
|
|
22
|
+
"@cleartrip/ct-platform-types": "4.2.0-beta.64"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=16.8.0",
|