@cleartrip/ct-platform-recent-search-widget 1.0.1-beta.35 → 1.0.1-beta.37
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.
- package/dist/RecentSearchWidget.d.ts.map +1 -1
- package/dist/ct-platform-recent-search-widget.cjs.js +1 -1
- package/dist/ct-platform-recent-search-widget.cjs.js.map +1 -1
- package/dist/ct-platform-recent-search-widget.esm.js +1 -1
- package/dist/ct-platform-recent-search-widget.esm.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecentSearchWidget.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/RecentSearchWidget.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecentSearchWidget.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/RecentSearchWidget.tsx"],"names":[],"mappings":"AAUA,OAAO,EAGH,wBAAwB,EAC3B,MAAM,8BAA8B,CAAC;AAiBtC,QAAA,MAAM,kBAAkB,qKAcrB,wBAAwB,mDA0Q1B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("classnames"),a=require("@cleartrip/ct-platform-io-hoc"),r=require("@cleartrip/ct-platform-constants"),o=require("@cleartrip/ct-platform-utils"),d=require("@cleartrip/ct-design-typography"),s=require("@cleartrip/ct-platform-assets");function l(e){return e&&e.__esModule?e:{default:e}}var c=l(t);var u="index-module_cysContainer__IxX-G",_="index-module_cysWrapper__1ce0P",p="index-module_cysWrapperPWA__WgM-l",m="index-module_cysWrapperDesktop__nb0PL",x="index-module_cysTitle__Lz1Rw",h="index-module_cysTitleDesktop__mS-mq",v="index-module_cysTitlePWA__j28bR",g="index-module_cysContentWrapper__E91-z",y="index-module_cysCardsPWA__R8Fka",f="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",I="index-module_cysCardRemoving__fo6Kp",j="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],a=document.createElement("style");a.type="text/css","top"===i&&t.firstChild?t.insertBefore(a,t.firstChild):t.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: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 a=t.cardIndex,l=t.card,u=t.vertical,_=t.isPwa,p=t.isRemoving,m=t.onRemove,x=t.onClick,h=i.useMemo((function(){return c.default(C,_?w:b,p?I:"")}),[_,p]),v=(null==l?void 0:l.type)?o.getLOBType(l.type):"",g=i.useMemo((function(){if((null==l?void 0:l.type)===r.AIR_FUNNEL_JOURNEY){var i=o.getFlightsTitleParts(l.title,l.metaData,r.FLIGHTS_TITLE_MAX_LENGTH);if(i)return n.jsxs("span",e.__assign({className:E},{children:[i.origin,i.isOneWay?n.jsx(s.FlightOneWayArrowIcon,{}):n.jsx(s.FlightsTwoWayArrowIcon,{}),i.destination]}))}return o.truncateText(null==l?void 0:l.title,r.HOTEL_TITLE_MAX_LENGTH)}),[null==l?void 0:l.title,null==l?void 0:l.type,null==l?void 0:l.metaData]),y=i.useMemo((function(){return(null==l?void 0:l.subtitle)?o.truncateText(null==l?void 0:l.subtitle,r.SUBTITLE_MAX_LENGTH):""}),[null==l?void 0:l.subtitle]),f=i.useMemo((function(){var e,n=Boolean(y),i=null==l?void 0:l.metaData,t=o.formatRecentSearchCardTravelDates({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(y,", ").concat(t):y||t:""}),[y,null==l?void 0:l.type,null==l?void 0:l.metaData]),N=i.useCallback((function(e){e.stopPropagation(),null==x||x(l,a)}),[x,l,a]),P=i.useCallback((function(e){e.stopPropagation(),_&&(null==m||m(l,a))}),[m,l,a,_]);return n.jsx("div",e.__assign({className:h,onClick:N},{children:n.jsxs("div",e.__assign({className:T},{children:[n.jsxs("div",e.__assign({className:k},{children:[u===r.UAR_VERTICAL&&(null==l?void 0:l.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})),f&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.P3,className:j},{children:f}))]})),n.jsx("div",e.__assign({className:c.default(R,_?A:D),onClick:P},{children:_?n.jsx(s.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(s.ChevronRight,{width:20,height:20})}))]}))}))};exports.RecentSearchCard=N,exports.RecentSearchWidget=function(t){var d,s,l,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,I=t.onDataRemoved,j=void 0===I?function(){}:I,E=t.ravenPayload,W=t.additionalHeaders,P=t.additionalParams,S=t.setData,M=t.data,B=t.shouldFetchData,F=void 0===B||B,L=t.abVariant,z=i.useState(),q=z[0],G=z[1],O=i.useState(new Set),U=O[0],V=O[1],H=F?q:M,K=i.useRef([]),X=i.useRef(!1),Y=i.useRef(W),J=i.useRef(P),Q=i.useMemo((function(){var n=e.__assign({page_name:C,vertical:w,ab_variant:L||"na"},o.isEmpty(E)?{}:e.__assign({},E));return T||(n.platform="desktop"),n}),[E,T,C,w]),Z=i.useCallback((function(n){if(!X.current&&0!==n){X.current=!0;var i=e.__assign(e.__assign(e.__assign({},Q),{action_name:"recentsearch_impression",recent_searches_result_count:n}),o.getUtmSourceEventData(w)),t=o.getEventNameByVertical(w,"recent_searches_widget_impression");o.ravenSDKTrigger(t,i)}}),[Q,w]),$=i.useCallback((function(e,n){var i=o.createRecentSearchCardRavenPayload("recentsearch_click",Q,e,n),t=o.getEventNameByVertical(w,"recent_searches_card_click");o.ravenSDKTrigger(t,i)}),[Q,w]),ee=i.useCallback((function(e,n){var i=o.createRecentSearchCardRavenPayload("recentsearch_dismiss_click",Q,e,n),t=o.getEventNameByVertical(w,"recent_searches_card_dismiss_click");o.ravenSDKTrigger(t,i)}),[Q,w]),ne=i.useCallback((function(n,i){try{o.removeRecentSearchCardViaApi(null==n?void 0:n.id,null==n?void 0:n.type,w,Y.current,J.current),V((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){!F&&(null==H?void 0:H.content)?null==S||S(e.__assign(e.__assign({},H),{content:o.removeCardFromContentById(H.content,null==n?void 0:n.id)})):G((function(i){return i?e.__assign(e.__assign({},i),{content:o.removeCardFromContentById(i.content,null==n?void 0:n.id)}):i})),V((function(e){var i=new Set(e);return i.delete(null==n?void 0:n.id),i}))}),250);ee(n,i),K.current.push(t)}catch(e){console.error("Error removing CYS card:",e)}}),[ee,F,S,H,w]),ie=i.useCallback((function(){var e;(null==H?void 0:H.content)&&(null===(e=H.content)||void 0===e?void 0:e.length)>0&&Z(H.content.length)}),[null===(d=null==H?void 0:H.content)||void 0===d?void 0:d.length,Z]),te=i.useCallback((function(e,n){$(e,n);var i=null==e?void 0:e.landingUrl;i&&!o.isServer()&&(window.location.href=i)}),[$]);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(){F&&e.__awaiter(void 0,void 0,void 0,(function(){var n,i,t,a,d,s;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,o.fetchRecentSearchesData(w,R,Y.current,J.current)];case 1:return n=e.sent(),i=null==n?void 0:n.content,Array.isArray(i)&&i.length>0&&(t=T&&w===r.UAR_VERTICAL?r.MAX_DISPLAYED_CARDS:r.MIN_DISPLAYED_CARDS,a=null==i?void 0:i.slice(0,t),d={usecase:null==n?void 0:n.usecase,content:a},G(d),null==A||A()),[3,3];case 2:return s=e.sent(),console.error("Error fetching recent searches",s),[3,3];case 3:return[2]}}))}))}),[w,R,T,A,F]),i.useEffect((function(){var e;F&&(null==H?void 0:H.content)&&0===(null===(e=H.content)||void 0===e?void 0:e.length)&&(null==j||j("cysWidget"))}),[null===(s=null==H?void 0:H.content)||void 0===s?void 0:s.length,j]),(null==H?void 0:H.content)&&0!==H.content.length?n.jsx(a.IntersectionObserverHOC,e.__assign({onIntersection:ie},{children:n.jsx("div",e.__assign({className:u},{children:n.jsxs("div",e.__assign({className:c.default(_,T?p:m)},{children:[n.jsx("div",e.__assign({className:c.default(x,T?v:h)},{children:"Recent searches"})),n.jsx("div",e.__assign({className:g},{children:n.jsx("div",e.__assign({className:T?y:f},{children:null===(l=null==H?void 0:H.content)||void 0===l?void 0:l.map((function(e,i){return n.jsx(N,{cardIndex:i,card:e,isPwa:T,vertical:w,isRemoving:U.has(e.id),onRemove:ne,onClick:te},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"),a=require("@cleartrip/ct-platform-io-hoc"),r=require("@cleartrip/ct-platform-utils"),o=require("@cleartrip/ct-design-typography"),d=require("@cleartrip/ct-platform-assets"),s=require("@cleartrip/ct-platform-constants");function l(e){return e&&e.__esModule?e:{default:e}}var c=l(t);var u="index-module_cysContainer__IxX-G",_="index-module_cysWrapper__1ce0P",p="index-module_cysWrapperPWA__WgM-l",m="index-module_cysWrapperDesktop__nb0PL",x="index-module_cysTitle__Lz1Rw",h="index-module_cysTitleDesktop__mS-mq",v="index-module_cysTitlePWA__j28bR",g="index-module_cysContentWrapper__E91-z",y="index-module_cysCardsPWA__R8Fka",f="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",j="index-module_cysCardIconDesktop__GIDrz",D="index-module_cysCardIconPWA__yuB1A",W="index-module_cysCardRemoving__fo6Kp",A="index-module_cysTextEllipsis__o0FhM",I="index-module_cysFlightTitle__MIdTw",E="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],a=document.createElement("style");a.type="text/css","top"===i&&t.firstChild?t.insertBefore(a,t.firstChild):t.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: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 a=t.cardIndex,l=t.card,u=t.vertical,_=t.isPwa,p=t.isRemoving,m=t.onRemove,x=t.onClick,h=i.useMemo((function(){return c.default(C,_?w:b,p?W:"")}),[_,p]),v=(null==l?void 0:l.type)?r.getLOBType(l.type):"",g=i.useMemo((function(){if((null==l?void 0:l.type)===s.AIR_FUNNEL_JOURNEY){var i=r.getFlightsTitleParts(l.title,l.metaData,s.FLIGHTS_TITLE_MAX_LENGTH);if(i)return n.jsxs("span",e.__assign({className:I},{children:[i.origin,i.isOneWay?n.jsx(d.FlightOneWayArrowIcon,{}):n.jsx(d.FlightsTwoWayArrowIcon,{}),i.destination]}))}return r.truncateText(null==l?void 0:l.title,s.HOTEL_TITLE_MAX_LENGTH)}),[null==l?void 0:l.title,null==l?void 0:l.type,null==l?void 0:l.metaData]),y=i.useMemo((function(){return(null==l?void 0:l.subtitle)?r.truncateText(null==l?void 0:l.subtitle,s.SUBTITLE_MAX_LENGTH):""}),[null==l?void 0:l.subtitle]),f=i.useMemo((function(){var e,n=Boolean(y),i=null==l?void 0:l.metaData,t=r.formatRecentSearchCardTravelDates({cardType:null==l?void 0:l.type,journeyType:null==i?void 0:i.journeyType,travelDates:null===(e=null==l?void 0:l.metaData)||void 0===e?void 0:e.travelDates});return n||t?n&&t?"".concat(y,", ").concat(t):y||t:""}),[y,null==l?void 0:l.type,null==l?void 0:l.metaData]),N=i.useCallback((function(e){e.stopPropagation(),null==x||x(l,a)}),[x,l,a]),P=i.useCallback((function(e){e.stopPropagation(),_&&(null==m||m(l,a))}),[m,l,a,_]);return n.jsx("div",e.__assign({className:h,onClick:N},{children:n.jsxs("div",e.__assign({className:T},{children:[n.jsxs("div",e.__assign({className:k},{children:[u===s.UAR_VERTICAL&&(null==l?void 0:l.type)&&v&&n.jsx(o.Typography,e.__assign({variant:o.TypographyVariant.TAG,className:E},{children:v})),n.jsx(o.Typography,e.__assign({variant:o.TypographyVariant.HM4,className:A},{children:g})),f&&n.jsx(o.Typography,e.__assign({variant:o.TypographyVariant.P3,className:A},{children:f}))]})),n.jsx("div",e.__assign({className:c.default(R,_?D:j),onClick:P},{children:_?n.jsx(d.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(d.ChevronRight,{width:20,height:20})}))]}))}))};exports.RecentSearchCard=N,exports.RecentSearchWidget=function(t){var o,d,s,l=t.pageName,C=t.vertical,w=t.isPwa,b=void 0===w||w,T=t.cutoff,k=void 0===T?5e3:T,R=t.onDataReady,j=void 0===R?function(){}:R,D=t.onDataRemoved,W=void 0===D?function(){}:D,A=t.ravenPayload,I=t.additionalHeaders,E=t.additionalParams,P=t.setData,S=t.data,B=t.shouldFetchData,F=void 0===B||B,M=t.abVariant,L=i.useState(),z=L[0],q=L[1],G=i.useState(new Set),O=G[0],U=G[1],V=F?z:S,H=i.useRef([]),K=i.useRef(!1),X=i.useRef(I),Y=i.useRef(E),J=i.useMemo((function(){var n=e.__assign({page_name:l,vertical:C,ab_variant:M||"na"},r.isEmpty(A)?{}:e.__assign({},A));return b||(n.platform="desktop"),n}),[A,b,l,C]),Q=i.useCallback((function(n){if(!K.current&&0!==n){K.current=!0;var i=e.__assign(e.__assign(e.__assign({},J),{action_name:"recentsearch_impression",recent_searches_result_count:n}),r.getUtmSourceEventData(C)),t=r.getEventNameByVertical(C,"recent_searches_widget_impression");r.ravenSDKTrigger(t,i)}}),[J,C]),Z=i.useCallback((function(e,n){var i=r.createRecentSearchCardRavenPayload("recentsearch_click",J,e,n),t=r.getEventNameByVertical(C,"recent_searches_card_click");r.ravenSDKTrigger(t,i)}),[J,C]),$=i.useCallback((function(e,n){var i=r.createRecentSearchCardRavenPayload("recentsearch_dismiss_click",J,e,n),t=r.getEventNameByVertical(C,"recent_searches_card_dismiss_click");r.ravenSDKTrigger(t,i)}),[J,C]),ee=i.useCallback((function(n,i){try{r.removeRecentSearchCardViaApi(null==n?void 0:n.id,null==n?void 0:n.type,C,X.current,Y.current),U((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){!F&&(null==V?void 0:V.content)?null==P||P(e.__assign(e.__assign({},V),{content:r.removeCardFromContentById(V.content,null==n?void 0:n.id)})):q((function(i){return i?e.__assign(e.__assign({},i),{content:r.removeCardFromContentById(i.content,null==n?void 0:n.id)}):i})),U((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)}}),[$,F,P,V,C]),ne=i.useCallback((function(){var e;(null==V?void 0:V.content)&&(null===(e=V.content)||void 0===e?void 0:e.length)>0&&Q(V.content.length)}),[null===(o=null==V?void 0:V.content)||void 0===o?void 0:o.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(){F&&e.__awaiter(void 0,void 0,void 0,(function(){var n,i,t,a,o,d;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,r.fetchRecentSearchesData(b,C,k,X.current,Y.current)];case 1:return n=e.sent(),i=null==n?void 0:n.content,Array.isArray(i)&&i.length>0&&(t=r.getSize(b,C),a=null==i?void 0:i.slice(0,t),o={usecase:null==n?void 0:n.usecase,content:a},q(o),null==j||j()),[3,3];case 2:return d=e.sent(),console.error("Error fetching recent searches",d),[3,3];case 3:return[2]}}))}))}),[C,k,b,j,F]),i.useEffect((function(){var e;F&&(null==V?void 0:V.content)&&0===(null===(e=V.content)||void 0===e?void 0:e.length)&&(null==W||W("cysWidget"))}),[null===(d=null==V?void 0:V.content)||void 0===d?void 0:d.length,W]),(null==V?void 0:V.content)&&0!==V.content.length?n.jsx(a.IntersectionObserverHOC,e.__assign({onIntersection:ne},{children:n.jsx("div",e.__assign({className:u},{children:n.jsxs("div",e.__assign({className:c.default(_,b?p:m)},{children:[n.jsx("div",e.__assign({className:c.default(x,b?v:h)},{children:"Recent searches"})),n.jsx("div",e.__assign({className:g},{children:n.jsx("div",e.__assign({className:b?y:f},{children:null===(s=null==V?void 0:V.content)||void 0===s?void 0:s.map((function(e,i){return n.jsx(N,{cardIndex:i,card:e,isPwa:b,vertical:C,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","abVariant","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","ab_variant","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeRecentSearchCardViaApi","id","prev","add","timeout","setTimeout","content","removeCardFromContentById","newSet","delete","push","error","console","handleIntersection","length","_b","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,EAAAO,QAEDC,EAAgBC,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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","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","abVariant","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","ab_variant","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeRecentSearchCardViaApi","id","prev","add","timeout","setTimeout","content","removeCardFromContentById","newSet","delete","push","error","console","handleIntersection","length","_b","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","getSize","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,EAAAO,QAEDC,EAAgBC,EAAAA,SAClB,WACI,OAAAC,EAAUC,QACNC,EACCR,EAAgCQ,EAAxBA,EACTP,EAAaO,EAAyB,GAH1C,GAKJ,CAACR,EAAOC,IAGNQ,GAAcX,aAAI,EAAJA,EAAMV,MAAOsB,EAAUA,WAACZ,EAAKV,MAAQ,GAEnDuB,EAAiBN,EAAAA,SAAQ,WAC3B,IAA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AACkF,EAAAjE,aAAA,EAAAA,EAAY+B,8BAASQ,OAAQxD,KAE5BiB,aAAU,EAAVA,EAAY+B,UAAyC,IAA9B/B,EAAW+B,QAAQQ,OAK3CpG,MAAC+H,EAAAA,wBAAwBpI,EAAAA,SAAA,CAAAqI,eAAgB7B,IAAkB,CAAAtG,SACvDG,EAAAA,IAAK,MAAAL,EAAAA,SAAA,CAAAC,UAAWZ,GAAmB,CAAAa,SAC/BH,EACIuI,KAAA,MAAAtI,WAAA,CAAAC,UAAWd,EAAUC,QACjBC,EACCR,EAEKQ,EADAA,eAIVgB,EAAAA,IACI,MAAAL,EAAAA,SAAA,CAAAC,UAAWd,EAAAA,QACPE,EACCR,EAEKQ,EADAA,IAET,CAAAa,SAAA,qBAILG,MAAK,MAAAL,EAAAA,SAAA,CAAAC,UAAWZ,GAAwB,CAAAa,SACpCG,wBACIJ,UACKpB,EAEKQ,EADAA,GACkB,CAAAa,SAGN,UAArBgE,aAAU,EAAVA,EAAY+B,eAAS,IAAAsC,OAAA,EAAAA,EAAAC,KAAI,SAAC7J,EAAMD,GAAc,OAC3C2B,EAACwB,IAAArD,GAEGE,UAAWA,EACXC,KAAMA,EACNE,MAAOA,EACPD,SAAUA,EACVE,WAAYkF,EAAgByE,IAAI9J,EAAKiH,IACrC7G,SAAU2G,GACV1G,QAAS2H,IAPJhI,aAAI,EAAJA,EAAMiH,GASlB,oBA3Cd,IAkDf","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
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 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,removeRecentSearchCardViaApi as P,removeCardFromContentById as A,isServer as N,fetchRecentSearchesData as R}from"@cleartrip/ct-platform-utils";import{Typography as I,TypographyVariant as z}from"@cleartrip/ct-design-typography";import{FlightOneWayArrowIcon as j,FlightsTwoWayArrowIcon as B,ChevronRight as F,CrossIcon as E}from"@cleartrip/ct-platform-assets";var M="index-module_cysContainer__IxX-G",G="index-module_cysWrapper__1ce0P",S="index-module_cysWrapperPWA__WgM-l",L="index-module_cysWrapperDesktop__nb0PL",K="index-module_cysTitle__Lz1Rw",O="index-module_cysTitleDesktop__mS-mq",U="index-module_cysTitlePWA__j28bR",q="index-module_cysContentWrapper__E91-z",X="index-module_cysCardsPWA__R8Fka",Y="index-module_cysCardsDesktop__JIMk8",H="index-module_cysCard__-4dBh",J="index-module_cysCardPWA__Yjxjo",Q="index-module_cysCardDesktop__ToN9t",Z="index-module_cysCardContent__xUEFU",V="index-module_cysCardTextWrapper__XjGQC",$="index-module_cysCardIconWrapper__GC4rs",ee="index-module_cysCardIconDesktop__GIDrz",ne="index-module_cysCardIconPWA__yuB1A",ie="index-module_cysCardRemoving__fo6Kp",te="index-module_cysTextEllipsis__o0FhM",oe="index-module_cysFlightTitle__MIdTw",de="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 re=function(n){var i=n.cardIndex,l=n.card,a=n.vertical,c=n.isPwa,u=n.isRemoving,v=n.onRemove,f=n.onClick,C=d((function(){return s(H,c?J:Q,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 n=g(l.title,l.metaData,p);if(n)return t("span",e({className:oe},{children:[n.origin,n.isOneWay?o(j,{}):o(B,{}),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==v||v(l,i))}),[v,l,i,c]);return o("div",e({className:C,onClick:P},{children:t("div",e({className:Z},{children:[t("div",e({className:V},{children:[a===h&&(null==l?void 0:l.type)&&k&&o(I,e({variant:z.TAG,className:de},{children:k})),o(I,e({variant:z.HM4,className:te},{children:T})),D&&o(I,e({variant:z.P3,className:te},{children:D}))]})),o("div",e({className:s($,c?ne:ee),onClick:A},{children:c?o(E,{width:16,height:16,color:"#1A1A1A"}):o(F,{width:20,height:20})}))]}))}))},le=function(_){var p,m,x,y=_.pageName,g=_.vertical,w=_.isPwa,b=void 0===w||w,I=_.cutoff,z=void 0===I?5e3:I,j=_.onDataReady,B=void 0===j?function(){}:j,F=_.onDataRemoved,E=void 0===F?function(){}:F,H=_.ravenPayload,J=_.additionalHeaders,Q=_.additionalParams,Z=_.setData,V=_.data,$=_.shouldFetchData,ee=void 0===$||$,ne=_.abVariant,ie=l(),te=ie[0],oe=ie[1],de=l(new Set),le=de[0],ae=de[1],ce=ee?te:V,se=a([]),ue=a(!1),_e=a(J),pe=a(Q),me=d((function(){var n=e({page_name:y,vertical:g,ab_variant:ne||"na"},C(H)?{}:e({},H));return b||(n.platform="desktop"),n}),[H,b,y,g]),xe=r((function(n){if(!ue.current&&0!==n){ue.current=!0;var i=e(e(e({},me),{action_name:"recentsearch_impression",recent_searches_result_count:n}),k(g)),t=T(g,"recent_searches_widget_impression");W(t,i)}}),[me,g]),he=r((function(e,n){var i=D("recentsearch_click",me,e,n),t=T(g,"recent_searches_card_click");W(t,i)}),[me,g]),ve=r((function(e,n){var i=D("recentsearch_dismiss_click",me,e,n),t=T(g,"recent_searches_card_dismiss_click");W(t,i)}),[me,g]),fe=r((function(n,i){try{P(null==n?void 0:n.id,null==n?void 0:n.type,g,_e.current,pe.current),ae((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){!ee&&(null==ce?void 0:ce.content)?null==Z||Z(e(e({},ce),{content:A(ce.content,null==n?void 0:n.id)})):oe((function(i){return i?e(e({},i),{content:A(i.content,null==n?void 0:n.id)}):i})),ae((function(e){var i=new Set(e);return i.delete(null==n?void 0:n.id),i}))}),250);ve(n,i),se.current.push(t)}catch(e){console.error("Error removing CYS card:",e)}}),[ve,ee,Z,ce,g]),ye=r((function(){var e;(null==ce?void 0:ce.content)&&(null===(e=ce.content)||void 0===e?void 0:e.length)>0&&xe(ce.content.length)}),[null===(p=null==ce?void 0:ce.content)||void 0===p?void 0:p.length,xe]),ge=r((function(e,n){he(e,n);var i=null==e?void 0:e.landingUrl;i&&!N()&&(window.location.href=i)}),[he]);return c((function(){var e=se.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),c((function(){ee&&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,R(g,z,_e.current,pe.current)];case 1:return e=i.sent(),n=null==e?void 0:e.content,Array.isArray(n)&&n.length>0&&(t=b&&g===h?v:f,o=null==n?void 0:n.slice(0,t),d={usecase:null==e?void 0:e.usecase,content:o},oe(d),null==B||B()),[3,3];case 2:return r=i.sent(),console.error("Error fetching recent searches",r),[3,3];case 3:return[2]}}))}))}),[g,z,b,B,ee]),c((function(){var e;ee&&(null==ce?void 0:ce.content)&&0===(null===(e=ce.content)||void 0===e?void 0:e.length)&&(null==E||E("cysWidget"))}),[null===(m=null==ce?void 0:ce.content)||void 0===m?void 0:m.length,E]),(null==ce?void 0:ce.content)&&0!==ce.content.length?o(u,e({onIntersection:ye},{children:o("div",e({className:M},{children:t("div",e({className:s(G,b?S:L)},{children:[o("div",e({className:s(K,b?U:O)},{children:"Recent searches"})),o("div",e({className:q},{children:o("div",e({className:b?X:Y},{children:null===(x=null==ce?void 0:ce.content)||void 0===x?void 0:x.map((function(e,n){return o(re,{cardIndex:n,card:e,isPwa:b,vertical:g,isRemoving:le.has(e.id),onRemove:fe,onClick:ge},null==e?void 0:e.id)}))}))}))]}))}))})):null};export{re as RecentSearchCard,le 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{getLOBType as _,getFlightsTitleParts as p,truncateText as m,formatRecentSearchCardTravelDates as x,isEmpty as h,getUtmSourceEventData as v,getEventNameByVertical as f,ravenSDKTrigger as y,createRecentSearchCardRavenPayload as g,removeRecentSearchCardViaApi as w,removeCardFromContentById as b,isServer as C,getSize as k,fetchRecentSearchesData as T}from"@cleartrip/ct-platform-utils";import{Typography as W,TypographyVariant as D}from"@cleartrip/ct-design-typography";import{FlightOneWayArrowIcon as P,FlightsTwoWayArrowIcon as A,ChevronRight as N,CrossIcon as R}from"@cleartrip/ct-platform-assets";import{AIR_FUNNEL_JOURNEY as I,FLIGHTS_TITLE_MAX_LENGTH as z,HOTEL_TITLE_MAX_LENGTH as j,SUBTITLE_MAX_LENGTH as B,UAR_VERTICAL as F}from"@cleartrip/ct-platform-constants";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,v=n.onClick,f=d((function(){return s(Y,c?H:J,u?ne:"")}),[c,u]),y=(null==l?void 0:l.type)?_(l.type):"",g=d((function(){if((null==l?void 0:l.type)===I){var n=p(l.title,l.metaData,z);if(n)return t("span",e({className:te},{children:[n.origin,n.isOneWay?o(P,{}):o(A,{}),n.destination]}))}return m(null==l?void 0:l.title,j)}),[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)?m(null==l?void 0:l.subtitle,B):""}),[null==l?void 0:l.subtitle]),b=d((function(){var e,n=Boolean(w),i=null==l?void 0:l.metaData,t=x({cardType:null==l?void 0:l.type,journeyType:null==i?void 0:i.journeyType,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]),C=r((function(e){e.stopPropagation(),null==v||v(l,i)}),[v,l,i]),k=r((function(e){e.stopPropagation(),c&&(null==h||h(l,i))}),[h,l,i,c]);return o("div",e({className:f,onClick:C},{children:t("div",e({className:Q},{children:[t("div",e({className:Z},{children:[a===F&&(null==l?void 0:l.type)&&y&&o(W,e({variant:D.TAG,className:oe},{children:y})),o(W,e({variant:D.HM4,className:ie},{children:g})),b&&o(W,e({variant:D.P3,className:ie},{children:b}))]})),o("div",e({className:s(V,c?ee:$),onClick:k},{children:c?o(R,{width:16,height:16,color:"#1A1A1A"}):o(N,{width:20,height:20})}))]}))}))},re=function(_){var p,m,x,W=_.pageName,D=_.vertical,P=_.isPwa,A=void 0===P||P,N=_.cutoff,R=void 0===N?5e3:N,I=_.onDataReady,z=void 0===I?function(){}:I,j=_.onDataRemoved,B=void 0===j?function(){}:j,F=_.ravenPayload,Y=_.additionalHeaders,H=_.additionalParams,J=_.setData,Q=_.data,Z=_.shouldFetchData,V=void 0===Z||Z,$=_.abVariant,ee=l(),ne=ee[0],ie=ee[1],te=l(new Set),oe=te[0],re=te[1],le=V?ne:Q,ae=a([]),ce=a(!1),se=a(Y),ue=a(H),_e=d((function(){var n=e({page_name:W,vertical:D,ab_variant:$||"na"},h(F)?{}:e({},F));return A||(n.platform="desktop"),n}),[F,A,W,D]),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}),v(D)),t=f(D,"recent_searches_widget_impression");y(t,i)}}),[_e,D]),me=r((function(e,n){var i=g("recentsearch_click",_e,e,n),t=f(D,"recent_searches_card_click");y(t,i)}),[_e,D]),xe=r((function(e,n){var i=g("recentsearch_dismiss_click",_e,e,n),t=f(D,"recent_searches_card_dismiss_click");y(t,i)}),[_e,D]),he=r((function(n,i){try{w(null==n?void 0:n.id,null==n?void 0:n.type,D,se.current,ue.current),re((function(e){return new Set(e).add(null==n?void 0:n.id)}));var t=setTimeout((function(){!V&&(null==le?void 0:le.content)?null==J||J(e(e({},le),{content:b(le.content,null==n?void 0:n.id)})):ie((function(i){return i?e(e({},i),{content:b(i.content,null==n?void 0:n.id)}):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,V,J,le,D]),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,n){me(e,n);var i=null==e?void 0:e.landingUrl;i&&!C()&&(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(){V&&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,T(A,D,R,se.current,ue.current)];case 1:return e=i.sent(),n=null==e?void 0:e.content,Array.isArray(n)&&n.length>0&&(t=k(A,D),o=null==n?void 0:n.slice(0,t),d={usecase:null==e?void 0:e.usecase,content:o},ie(d),null==z||z()),[3,3];case 2:return r=i.sent(),console.error("Error fetching recent searches",r),[3,3];case 3:return[2]}}))}))}),[D,R,A,z,V]),c((function(){var e;V&&(null==le?void 0:le.content)&&0===(null===(e=le.content)||void 0===e?void 0:e.length)&&(null==B||B("cysWidget"))}),[null===(m=null==le?void 0:le.content)||void 0===m?void 0:m.length,B]),(null==le?void 0:le.content)&&0!==le.content.length?o(u,e({onIntersection:ve},{children:o("div",e({className:E},{children:t("div",e({className:s(M,A?G:S)},{children:[o("div",e({className:s(L,A?O:K)},{children:"Recent searches"})),o("div",e({className:U},{children:o("div",e({className:A?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:A,vertical:D,isRemoving:oe.has(e.id),onRemove:he,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","
|
|
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","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","abVariant","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","widgetData","removeTimeoutsRef","useRef","hasImpressionFiredRef","additionalHeadersRef","additionalParamsRef","commonRavenPayload","payload","page_name","ab_variant","isEmpty","platform","fireImpressionEvent","cardCount","current","action_name","recent_searches_result_count","getUtmSourceEventData","eventName","getEventNameByVertical","ravenSDKTrigger","fireCardClickEvent","createRecentSearchCardRavenPayload","fireCardDismissEvent","handleRemoveCard","removeRecentSearchCardViaApi","id","prev","add","timeout","setTimeout","content","removeCardFromContentById","newSet","delete","push","error","console","handleIntersection","length","_b","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","getSize","displayedItems","slice","data_1","usecase","error_1","_c","IntersectionObserverHOC","onIntersection","_d","map","has"],"mappings":"+4DAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAA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bjE,GAAWmE,GACXjF,SAAAA,oCAGJwD,QAAQD,MAAM,iCAAkC4B,gCAO5D,GAAG,CAACrJ,EAAUgE,EAAQ/D,EAAOiE,EAAaS,IAG1C0D,GAAU,iBAEF1D,IACAU,cAAU,EAAVA,GAAY+B,UACmB,aAA/BvH,EAAAwF,GAAW+B,8BAASQ,UAEpBxD,SAAAA,EAAgB,aAExB,GAAG,SAACkF,EAAAjE,cAAA,EAAAA,GAAY+B,8BAASQ,OAAQxD,KAE5BiB,cAAU,EAAVA,GAAY+B,UAAyC,IAA9B/B,GAAW+B,QAAQQ,OAK3CpG,EAAC+H,EAAwBpI,EAAA,CAAAqI,eAAgB7B,IAAkB,CAAAtG,SACvDG,EAAK,MAAAL,EAAA,CAAAC,UAAWZ,GAAmB,CAAAa,SAC/BH,EACI,MAAAC,EAAA,CAAAC,UAAWb,EACPC,EACCP,EAEKO,EADAA,eAIVgB,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,GAAY+B,eAAS,IAAAqC,OAAA,EAAAA,EAAAC,KAAI,SAAC3J,EAAMD,GAAc,OAC3C0B,EAAC5B,IAEGE,UAAWA,EACXC,KAAMA,EACNE,MAAOA,EACPD,SAAUA,EACVE,WAAYiF,GAAgBwE,IAAI5J,EAAKgH,IACrC5G,SAAU0G,GACVzG,QAAS0H,IAPJ/H,aAAI,EAAJA,EAAMgH,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.37",
|
|
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-utils": "4.2.0-beta.
|
|
20
|
-
"@cleartrip/ct-platform-io-hoc": "4.2.0-beta.
|
|
21
|
-
"@cleartrip/ct-platform-
|
|
22
|
-
"@cleartrip/ct-platform-
|
|
18
|
+
"@cleartrip/ct-platform-assets": "4.2.0-beta.68",
|
|
19
|
+
"@cleartrip/ct-platform-utils": "4.2.0-beta.68",
|
|
20
|
+
"@cleartrip/ct-platform-io-hoc": "4.2.0-beta.68",
|
|
21
|
+
"@cleartrip/ct-platform-constants": "4.2.0-beta.68",
|
|
22
|
+
"@cleartrip/ct-platform-types": "4.2.0-beta.68"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=16.8.0",
|