@cleartrip/ct-platform-recent-search-widget 1.0.5 → 1.0.7
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/RecentSearchCard.d.ts +1 -1
- package/dist/RecentSearchCard.d.ts.map +1 -1
- package/dist/RecentSearchWidget.d.ts +1 -1
- package/dist/RecentSearchWidget.d.ts.map +1 -1
- package/dist/RecentSearchWidgetContainer.d.ts +4 -0
- package/dist/RecentSearchWidgetContainer.d.ts.map +1 -0
- 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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IRecentSearchWidgetCardProps } from '@cleartrip/ct-platform-types';
|
|
2
|
-
declare const RecentSearchCard: ({ card, vertical, isPwa, isRemoving, onRemove, onClick, }: IRecentSearchWidgetCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const RecentSearchCard: ({ cardIndex, card, vertical, isPwa, isRemoving, onRemove, onClick, }: IRecentSearchWidgetCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default RecentSearchCard;
|
|
4
4
|
//# sourceMappingURL=RecentSearchCard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecentSearchCard.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/RecentSearchCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecentSearchCard.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/RecentSearchCard.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAU5E,QAAA,MAAM,gBAAgB,yEAQnB,4BAA4B,4CAsI9B,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IRecentSearchWidgetProps } from '@cleartrip/ct-platform-types';
|
|
2
|
-
declare const RecentSearchWidget: ({ pageName, vertical, isPwa,
|
|
2
|
+
declare const RecentSearchWidget: ({ pageName, vertical, isPwa, ravenPayload, data, setData, abVariant, }: IRecentSearchWidgetProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
3
|
export default RecentSearchWidget;
|
|
4
4
|
//# sourceMappingURL=RecentSearchWidget.d.ts.map
|
|
@@ -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;AAetC,QAAA,MAAM,kBAAkB,2EAQrB,wBAAwB,mDAiM1B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IRecentSearchWidgetContainerProps } from '@cleartrip/ct-platform-types';
|
|
2
|
+
declare const RecentSearchWidgetContainer: ({ pageName, vertical, isPwa, cutoff, onDataReady, onDataRemoved, ravenPayload, additionalHeaders, additionalParams, abVariant, }: IRecentSearchWidgetContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default RecentSearchWidgetContainer;
|
|
4
|
+
//# sourceMappingURL=RecentSearchWidgetContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecentSearchWidgetContainer.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/RecentSearchWidgetContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,iCAAiC,EACpC,MAAM,8BAA8B,CAAC;AAKtC,QAAA,MAAM,2BAA2B,qIAW9B,iCAAiC,4CA2DnC,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -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"),r=require("@cleartrip/ct-platform-constants"),a=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",v="index-module_cysWrapperDesktop__nb0PL",m="index-module_cysTitle__Lz1Rw",x="index-module_cysTitleDesktop__mS-mq",h="index-module_cysTitlePWA__j28bR",f="index-module_cysContentWrapper__E91-z",g="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",D="index-module_cysCardTextWrapper__XjGQC",k="index-module_cysCardIconWrapper__GC4rs",R="index-module_cysCardIconDesktop__GIDrz",A="index-module_cysCardIconPWA__yuB1A",j="index-module_cysCardRemoving__fo6Kp",P="index-module_cysTextEllipsis__o0FhM",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],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_cysLobTag__p-D23{background-color:#fff1ec;border-radius:4px;color:#ff4f17;padding:4px 6px;text-transform:"uppercase"}');var W=function(t){var o,s,u,_,p=t.card,v=t.vertical,m=t.isPwa,x=t.isRemoving,h=t.onRemove,f=t.onClick,g=i.useMemo((function(){return c.default(C,m?b:w,x?j:"")}),[m,x]),y=i.useMemo((function(){return a.getLOBType(null==p?void 0:p.type)}),[null==p?void 0:p.type]),W=i.useMemo((function(){return a.truncateText(null==p?void 0:p.title,r.TITLE_MAX_LENGTH)}),[null==p?void 0:p.title]),S=i.useMemo((function(){return(null==p?void 0:p.subtitle)?a.truncateText(null==p?void 0:p.subtitle,r.SUBTITLE_MAX_LENGTH):""}),[null==p?void 0:p.subtitle]),N=i.useMemo((function(){var e,n,i,t,o,r,d,l,s=Boolean(S),c=Boolean(null===(n=null===(e=null==p?void 0:p.metaData)||void 0===e?void 0:e.travelDates)||void 0===n?void 0:n.start)&&Boolean(null===(t=null===(i=null==p?void 0:p.metaData)||void 0===i?void 0:i.travelDates)||void 0===t?void 0:t.end);if(!s&&!c)return"";var u=c?a.formatDateRange(null===(r=null===(o=null==p?void 0:p.metaData)||void 0===o?void 0:o.travelDates)||void 0===r?void 0:r.start,null===(l=null===(d=null==p?void 0:p.metaData)||void 0===d?void 0:d.travelDates)||void 0===l?void 0:l.end):"";return s&&c?"".concat(S,", ").concat(u):S||u}),[S,null===(s=null===(o=null==p?void 0:p.metaData)||void 0===o?void 0:o.travelDates)||void 0===s?void 0:s.start,null===(_=null===(u=null==p?void 0:p.metaData)||void 0===u?void 0:u.travelDates)||void 0===_?void 0:_.end]),I=i.useCallback((function(e){e.stopPropagation(),null==f||f(p)}),[f,p]),B=i.useCallback((function(e){e.stopPropagation(),m&&(null==h||h(p))}),[h,p,m]);return n.jsx("div",e.__assign({className:g,onClick:I},{children:n.jsxs("div",e.__assign({className:T},{children:[n.jsxs("div",e.__assign({className:D},{children:[v===r.UAR_VERTICAL&&(null==p?void 0:p.type)&&y&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.TAG,className:E},{children:y})),n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.HM4,className:P},{children:W})),N&&n.jsx(d.Typography,e.__assign({variant:d.TypographyVariant.P3,className:P},{children:N}))]})),n.jsx("div",e.__assign({className:c.default(k,m?A:R),onClick:B},{children:m?n.jsx(l.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(l.ChevronRight,{width:20,height:20})}))]}))}))};exports.RecentSearchCard=W,exports.RecentSearchWidget=function(t){var d,l,s,C,b=t.pageName,w=t.vertical,T=t.isPwa,D=void 0===T||T,k=t.cutoff,R=void 0===k?5e3:k,A=t.onDataReady,j=void 0===A?function(){}:A,P=t.onDataRemoved,E=void 0===P?function(){}:P,S=t.ravenPayload,N=t.additionalHeaders,I=t.additionalParams,B=i.useState(),M=B[0],z=B[1],L=i.useState(new Set),q=L[0],G=L[1],F=i.useRef([]),U=i.useRef(!1),K=i.useRef(N),V=i.useRef(I),O=i.useMemo((function(){var n=e.__assign({page_name:b,vertical:w},a.isEmpty(S)?{}:e.__assign({},S));return D||(n.platform="desktop"),n}),[S,D,b,w]),X=i.useCallback((function(n){if(!U.current&&0!==n){U.current=!0;var i=e.__assign(e.__assign(e.__assign({},O),{action_name:"recentsearch_impression",recent_searches_result_count:n}),a.getUtmSourceEventData(w)),t=a.getEventNameByVertical(w,"recent_searches_widget_impression");a.ravenSDKTrigger(t,i)}}),[O,w]),Y=i.useCallback((function(e){var n=a.createRecentSearchCardRavenPayload("recentsearch_click",O,e),i=a.getEventNameByVertical(w,"recent_searches_card_click");a.ravenSDKTrigger(i,n)}),[O,w]),H=i.useCallback((function(e){var n=a.createRecentSearchCardRavenPayload("recentsearch_dismiss_click",O,e),i=a.getEventNameByVertical(w,"recent_searches_card_dismiss_click");a.ravenSDKTrigger(i,n)}),[O,w]),J=i.useCallback((function(n){try{a.removeCYSCardByID(null==n?void 0:n.id,null==n?void 0:n.type,w,K.current,V.current),G((function(e){return new Set(e).add(null==n?void 0:n.id)}));var i=setTimeout((function(){z((function(i){var t;if(i)return e.__assign(e.__assign({},i),{content:null===(t=null==i?void 0:i.content)||void 0===t?void 0:t.filter((function(e){return(null==e?void 0:e.id)!==(null==n?void 0:n.id)}))})})),G((function(e){var i=new Set(e);return i.delete(null==n?void 0:n.id),i}))}),250);H(n),F.current.push(i)}catch(e){console.error("Error removing CYS card:",e)}}),[H,w]),Q=i.useCallback((function(){var e;(null==M?void 0:M.content)&&(null===(e=M.content)||void 0===e?void 0:e.length)>0&&X(M.content.length)}),[null===(d=null==M?void 0:M.content)||void 0===d?void 0:d.length,X]),Z=i.useCallback((function(e){Y(e);var n=null==e?void 0:e.landingUrl;n&&!a.isServer()&&(window.location.href=n)}),[Y]);return i.useEffect((function(){var e=F.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),i.useEffect((function(){e.__awaiter(void 0,void 0,void 0,(function(){var n,i,t,o,d;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.fetchRecentSearchesData(w,R,K.current,V.current)];case 1:return n=e.sent(),i=null==n?void 0:n.content,Array.isArray(i)&&i.length>0&&(t=D&&w===r.UAR_VERTICAL?r.MAX_DISPLAYED_CARDS:r.MIN_DISPLAYED_CARDS,o=null==i?void 0:i.slice(0,t),z({usecase:null==n?void 0:n.usecase,content:null==o?void 0:o.filter((function(e){return null==e?void 0:e.title}))}),null==j||j()),[3,3];case 2:return d=e.sent(),console.error("Error fetching recent searches",d),[3,3];case 3:return[2]}}))}))}),[w,R,D,j]),i.useEffect((function(){var e;(null==M?void 0:M.content)&&0===(null===(e=M.content)||void 0===e?void 0:e.length)&&(null==E||E())}),[null===(l=null==M?void 0:M.content)||void 0===l?void 0:l.length,E]),(null==M?void 0:M.content)&&0!==(null===(s=null==M?void 0:M.content)||void 0===s?void 0:s.length)?n.jsx(o.IntersectionObserverHOC,e.__assign({onIntersection:Q},{children:n.jsx("div",e.__assign({className:u},{children:n.jsxs("div",e.__assign({className:c.default(_,D?p:v)},{children:[n.jsx("div",e.__assign({className:c.default(m,D?h:x)},{children:"Recent searches"})),n.jsx("div",e.__assign({className:f},{children:n.jsx("div",e.__assign({className:D?g:y},{children:null===(C=null==M?void 0:M.content)||void 0===C?void 0:C.map((function(e){return n.jsx(W,{card:e,isPwa:D,vertical:w,isRemoving:q.has(e.id),onRemove:J,onClick:Z},null==e?void 0:e.id)}))}))}))]}))}))})):n.jsx(n.Fragment,{})};
|
|
1
|
+
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("@cleartrip/ct-platform-utils"),a=require("classnames"),r=require("@cleartrip/ct-platform-io-hoc"),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(a);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",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",N="index-module_cysCardIconDesktop__GIDrz",j="index-module_cysCardIconPWA__yuB1A",E="index-module_cysCardRemoving__fo6Kp",A="index-module_cysTextEllipsis__o0FhM",W="index-module_cysFlightTitle__MIdTw",D="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 P=function(a){var r=a.cardIndex,l=a.card,u=a.vertical,_=a.isPwa,p=a.isRemoving,x=a.onRemove,m=a.onClick,v=i.useMemo((function(){return c.default(C,_?w:b,p?E:"")}),[_,p]),h=i.useMemo((function(){return(null==l?void 0:l.type)?t.getLOBType(l.type):""}),[null==l?void 0:l.type]),g=i.useMemo((function(){switch(null==l?void 0:l.type){case s.AIR_FUNNEL_JOURNEY:var i=t.getFlightsTitleParts(null==l?void 0:l.title,null==l?void 0:l.metaData,s.FLIGHTS_LOCATION_TITLE_MAX_LENGTH);if(i){var a=i.origin,r=i.destination,o=i.isOneWay;return n.jsxs("span",e.__assign({className:W},{children:[a,o?n.jsx(d.OneWayArrow,{}):n.jsx(d.TwoWayArrow,{}),r]}))}return"";case s.HOTEL_FUNNEL_JOURNEY:return t.truncateText(null==l?void 0:l.title,s.HOTEL_TITLE_MAX_LENGTH);default:return""}}),[l]),y=i.useMemo((function(){return(null==l?void 0:l.subtitle)?t.truncateText(null==l?void 0:l.subtitle,s.SUBTITLE_MAX_LENGTH):""}),[null==l?void 0:l.subtitle]),f=i.useMemo((function(){var e,n,i=Boolean(y),a=t.getRecentSearchCardTravelDateText({cardType:null==l?void 0:l.type,journeyType:(null==l?void 0:l.type)===s.AIR_FUNNEL_JOURNEY?null===(e=null==l?void 0:l.metaData)||void 0===e?void 0:e.journeyType:"",travelDates:null===(n=null==l?void 0:l.metaData)||void 0===n?void 0:n.travelDates});return i||a?i&&a?"".concat(y,", ").concat(a):y||a:""}),[y,null==l?void 0:l.type,null==l?void 0:l.metaData]),P=i.useCallback((function(e){e.stopPropagation(),null==m||m(l,r)}),[m,l,r]),I=i.useCallback((function(e){e.stopPropagation(),_&&(null==x||x(l,r))}),[x,l,r,_]);return n.jsx("div",e.__assign({className:v,onClick:P},{children:n.jsxs("div",e.__assign({className:T},{children:[n.jsxs("div",e.__assign({className:k},{children:[u===s.UAR_VERTICAL&&h&&n.jsx(o.Typography,e.__assign({variant:o.TypographyVariant.TAG,className:D},{children:h})),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,_?j:N),onClick:I},{children:_?n.jsx(d.CrossIcon,{width:16,height:16,color:"#1A1A1A"}):n.jsx(d.ChevronRight,{width:20,height:20})}))]}))}))},I=function(a){var o,d,s=a.pageName,l=a.vertical,C=a.isPwa,w=void 0===C||C,b=a.ravenPayload,T=a.data,k=a.setData,R=a.abVariant,N=i.useState(new Set),j=N[0],E=N[1],A=i.useRef([]),W=i.useRef(!1),D=i.useMemo((function(){var n=e.__assign({page_name:s,vertical:l,ab_variant:R||"na"},t.isEmpty(b)?{}:e.__assign({},b));return w||(n.platform="desktop"),n}),[b,w,s,l]),I=i.useCallback((function(n){if(!W.current&&0!==n){W.current=!0;var i=e.__assign(e.__assign(e.__assign({},D),{action_name:"recentsearch_impression",recent_searches_result_count:n}),t.getUtmSourceEventData(l)),a=t.getEventNameByVertical(l,"recent_searches_widget_impression");t.ravenSDKTrigger(a,i)}}),[D,l]),S=i.useCallback((function(e,n){var i=t.createRecentSearchCardRavenPayload("recentsearch_click",D,e,n),a=t.getEventNameByVertical(l,"recent_searches_card_click");t.ravenSDKTrigger(a,i)}),[D,l]),L=i.useCallback((function(e,n){var i=t.createRecentSearchCardRavenPayload("recentsearch_dismiss_click",D,e,n),a=t.getEventNameByVertical(l,"recent_searches_card_dismiss_click");t.ravenSDKTrigger(a,i)}),[D,l]),M=i.useCallback((function(e,n){try{t.removeRecentSearchCardViaApi(null==e?void 0:e.id,null==e?void 0:e.type,l),E((function(n){return new Set(n).add(null==e?void 0:e.id)}));var i=setTimeout((function(){var n,i=t.removeCardFromContentById(null!==(n=null==T?void 0:T.content)&&void 0!==n?n:[],null==e?void 0:e.id),a={usecase:null==T?void 0:T.usecase,content:i};null==k||k(a),E((function(n){var i=new Set(n);return i.delete(null==e?void 0:e.id),i}))}),250);L(e,n),A.current.push(i)}catch(e){console.error("Error removing CYS card:",e)}}),[L,k,T,l]),B=i.useCallback((function(){var e;(null==T?void 0:T.content)&&(null===(e=T.content)||void 0===e?void 0:e.length)>0&&I(T.content.length)}),[null===(o=null==T?void 0:T.content)||void 0===o?void 0:o.length,I]),F=i.useCallback((function(e,n){S(e,n);var i=null==e?void 0:e.landingUrl;i&&!t.isServer()&&(window.location.href=i)}),[S]);return i.useEffect((function(){var e=A.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),(null==T?void 0:T.content)&&0!==T.content.length?n.jsx(r.IntersectionObserverHOC,e.__assign({onIntersection:B},{children:n.jsx("div",e.__assign({className:u},{children:n.jsxs("div",e.__assign({className:c.default(_,w?p:x)},{children:[n.jsx("div",e.__assign({className:c.default(m,w?h:v)},{children:"Recent searches"})),n.jsx("div",e.__assign({className:g},{children:n.jsx("div",e.__assign({className:w?y:f},{children:null===(d=null==T?void 0:T.content)||void 0===d?void 0:d.map((function(e,i){return n.jsx(P,{cardIndex:i,card:e,isPwa:w,vertical:l,isRemoving:j.has(e.id),onRemove:M,onClick:F},null==e?void 0:e.id)}))}))}))]}))}))})):null};exports.RecentSearchCard=P,exports.RecentSearchWidget=I,exports.RecentSearchWidgetContainer=function(a){var r,o=a.pageName,d=a.vertical,s=a.isPwa,l=void 0===s||s,c=a.cutoff,u=void 0===c?5e3:c,_=a.onDataReady,p=void 0===_?function(){}:_,x=a.onDataRemoved,m=void 0===x?function(){}:x,v=a.ravenPayload,h=a.additionalHeaders,g=a.additionalParams,y=a.abVariant,f=i.useState(),C=f[0],w=f[1],b=i.useRef(h),T=i.useRef(g);return i.useEffect((function(){e.__awaiter(void 0,void 0,void 0,(function(){var n,i,a,r,o,s;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t.fetchRecentSearchesData(l,d,u,b.current,T.current)];case 1:return n=e.sent(),i=null==n?void 0:n.content,Array.isArray(i)&&i.length>0&&(a=t.getSize(l,d),r=null==i?void 0:i.slice(0,a),o={usecase:null==n?void 0:n.usecase,content:r},w(o),null==p||p()),[3,3];case 2:return s=e.sent(),console.error("Error fetching recent searches",s),[3,3];case 3:return[2]}}))}))}),[d,u,l,p]),i.useEffect((function(){var e;(null==C?void 0:C.content)&&0===(null===(e=C.content)||void 0===e?void 0:e.length)&&(null==m||m("cysWidget"))}),[null===(r=null==C?void 0:C.content)||void 0===r?void 0:r.length,m]),n.jsx(I,{pageName:o,vertical:d,isPwa:l,ravenPayload:v,data:C,setData:w,abVariant:y})};
|
|
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","card","vertical","isPwa","isRemoving","onRemove","onClick","cardClassName","useMemo","classNames","default","styles","lobTypeText","getLOBType","truncatedTitle","truncateText","title","TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","hasDate","_b","metaData","travelDates","start","_d","_c","end","dateRange","formatDateRange","_f","_e","_h","_g","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","_jsx","jsx","__assign","className","children","_jsxs","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","pageName","cutoff","onDataReady","_j","onDataRemoved","ravenPayload","additionalHeaders","additionalParams","_k","useState","cysData","setCysData","_l","Set","removingCardIds","setRemovingCardIds","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","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","usecase","error_1","IntersectionObserverHOC","onIntersection","jsxs","map","has"],"mappings":"krCAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GA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ent-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","../packages/components/RecentSearchWidget/src/RecentSearchWidgetContainer.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null],"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_LOCATION_TITLE_MAX_LENGTH","origin_1","origin","destination","isOneWay","_jsxs","jsxs","__assign","className","children","_jsx","OneWayArrow","jsx","TwoWayArrow","HOTEL_FUNNEL_JOURNEY","truncateText","HOTEL_TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","dateRange","getRecentSearchCardTravelDateText","cardType","journeyType","travelDates","_b","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","RecentSearchWidget","pageName","_d","ravenPayload","data","setData","abVariant","_e","useState","Set","removingCardIds","setRemovingCardIds","removeTimeoutsRef","useRef","hasImpressionFiredRef","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","newContent","removeCardFromContentById","content","newData","usecase","newSet","delete","push","error","console","handleIntersection","length","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","IntersectionObserverHOC","onIntersection","_c","map","has","cutoff","onDataReady","_f","onDataRemoved","additionalHeaders","additionalParams","_g","cysData","setCysData","additionalHeadersRef","additionalParamsRef","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","getSize","displayedItems","slice","error_1"],"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,swGCGM,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,EAAcJ,EAAAA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EAAA4I,kBACjBC,EAAgB7I,EAAA6I,iBAChBnE,EAAS1E,EAAA0E,UAEHoE,EAAwBlE,aAAvBmE,EAAOD,EAAA,GAAEE,EAAUF,EAAA,GAIpBG,EAAuBhE,SAAO2D,GAC9BM,EAAsBjE,SAAO4D,GA0CnC,OAxCAd,EAAAA,WAAU,WACYoB,EAAAA,eAAA,OAAA,OAAA,GAAA,yFAEO,6BAAA,CAAA,EAAMC,0BACnBhJ,EACAD,EACAqI,EACAS,EAAqBtD,QACrBuD,EAAoBvD,wBALlB0D,EAAWrJ,EAMhBsJ,OACKxC,EAAUuC,eAAAA,EAAUvC,QACPyC,MAAMC,QAAQ1C,IAAYA,EAAQS,OAAS,IAIpDkC,EAAaC,EAAOA,QAACtJ,EAAOD,GAC5BwJ,EAAiB7C,aAAA,EAAAA,EAAS8C,MAAM,EAAGH,GACnCjF,EAAO,CACTwC,QAASqC,aAAA,EAAAA,EAAUrC,QACnBF,QAAS6C,GAGbX,EAAWxE,GACXiE,SAAAA,oCAGJpB,QAAQD,MAAM,iCAAkCyC,gCAK3D,GAAE,CAAC1J,EAAUqI,EAAQpI,EAAOqI,IAG7BV,EAAAA,WAAU,kBACFgB,aAAA,EAAAA,EAASjC,UAAuC,aAA5B9G,EAAA+I,EAAQjC,8BAASS,UACrCoB,SAAAA,EAAgB,aAExB,GAAG,SAAC1F,EAAA8F,aAAA,EAAAA,EAASjC,8BAASS,OAAQoB,IAG1B5G,EAAAA,IAACqC,EAAkB,CACfC,SAAUA,EACVlE,SAAUA,EACVC,MAAOA,EACPmE,aAAcA,EACdC,KAAMuE,EACNtE,QAASuE,EACTtE,UAAWA,GAGvB","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as i,__generator as n}from"tslib";import{jsx as o,jsxs as t,Fragment as d}from"react/jsx-runtime";import{useMemo as r,useCallback as l,useState as a,useRef as c,useEffect as s}from"react";import u from"classnames";import{IntersectionObserverHOC as _}from"@cleartrip/ct-platform-io-hoc";import{TITLE_MAX_LENGTH as p,SUBTITLE_MAX_LENGTH as m,UAR_VERTICAL as v,MAX_DISPLAYED_CARDS as x,MIN_DISPLAYED_CARDS as h}from"@cleartrip/ct-platform-constants";import{getLOBType as f,truncateText as y,formatDateRange as g,isEmpty as w,getUtmSourceEventData as b,getEventNameByVertical as C,ravenSDKTrigger as k,createRecentSearchCardRavenPayload as D,removeCYSCardByID as W,isServer as P,fetchRecentSearchesData as T}from"@cleartrip/ct-platform-utils";import{Typography as A,TypographyVariant as R}from"@cleartrip/ct-design-typography";import{ChevronRight as N,CrossIcon as z}from"@cleartrip/ct-platform-assets";var B="index-module_cysContainer__IxX-G",I="index-module_cysWrapper__1ce0P",j="index-module_cysWrapperPWA__WgM-l",E="index-module_cysWrapperDesktop__nb0PL",F="index-module_cysTitle__Lz1Rw",G="index-module_cysTitleDesktop__mS-mq",S="index-module_cysTitlePWA__j28bR",M="index-module_cysContentWrapper__E91-z",L="index-module_cysCardsPWA__R8Fka",K="index-module_cysCardsDesktop__JIMk8",U="index-module_cysCard__-4dBh",q="index-module_cysCardPWA__Yjxjo",O="index-module_cysCardDesktop__ToN9t",X="index-module_cysCardContent__xUEFU",Y="index-module_cysCardTextWrapper__XjGQC",H="index-module_cysCardIconWrapper__GC4rs",J="index-module_cysCardIconDesktop__GIDrz",Q="index-module_cysCardIconPWA__yuB1A",Z="index-module_cysCardRemoving__fo6Kp",V="index-module_cysTextEllipsis__o0FhM",$="index-module_cysLobTag__p-D23";!function(e,i){void 0===i&&(i={});var n=i.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css","top"===n&&o.firstChild?o.insertBefore(t,o.firstChild):o.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.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_cysLobTag__p-D23{background-color:#fff1ec;border-radius:4px;color:#ff4f17;padding:4px 6px;text-transform:"uppercase"}');var ee=function(i){var n,d,a,c,s=i.card,_=i.vertical,x=i.isPwa,h=i.isRemoving,w=i.onRemove,b=i.onClick,C=r((function(){return u(U,x?q:O,h?Z:"")}),[x,h]),k=r((function(){return f(null==s?void 0:s.type)}),[null==s?void 0:s.type]),D=r((function(){return y(null==s?void 0:s.title,p)}),[null==s?void 0:s.title]),W=r((function(){return(null==s?void 0:s.subtitle)?y(null==s?void 0:s.subtitle,m):""}),[null==s?void 0:s.subtitle]),P=r((function(){var e,i,n,o,t,d,r,l,a=Boolean(W),c=Boolean(null===(i=null===(e=null==s?void 0:s.metaData)||void 0===e?void 0:e.travelDates)||void 0===i?void 0:i.start)&&Boolean(null===(o=null===(n=null==s?void 0:s.metaData)||void 0===n?void 0:n.travelDates)||void 0===o?void 0:o.end);if(!a&&!c)return"";var u=c?g(null===(d=null===(t=null==s?void 0:s.metaData)||void 0===t?void 0:t.travelDates)||void 0===d?void 0:d.start,null===(l=null===(r=null==s?void 0:s.metaData)||void 0===r?void 0:r.travelDates)||void 0===l?void 0:l.end):"";return a&&c?"".concat(W,", ").concat(u):W||u}),[W,null===(d=null===(n=null==s?void 0:s.metaData)||void 0===n?void 0:n.travelDates)||void 0===d?void 0:d.start,null===(c=null===(a=null==s?void 0:s.metaData)||void 0===a?void 0:a.travelDates)||void 0===c?void 0:c.end]),T=l((function(e){e.stopPropagation(),null==b||b(s)}),[b,s]),B=l((function(e){e.stopPropagation(),x&&(null==w||w(s))}),[w,s,x]);return o("div",e({className:C,onClick:T},{children:t("div",e({className:X},{children:[t("div",e({className:Y},{children:[_===v&&(null==s?void 0:s.type)&&k&&o(A,e({variant:R.TAG,className:$},{children:k})),o(A,e({variant:R.HM4,className:V},{children:D})),P&&o(A,e({variant:R.P3,className:V},{children:P}))]})),o("div",e({className:u(H,x?Q:J),onClick:B},{children:x?o(z,{width:16,height:16,color:"#1A1A1A"}):o(N,{width:20,height:20})}))]}))}))},ie=function(p){var m,f,y,g,A=p.pageName,R=p.vertical,N=p.isPwa,z=void 0===N||N,U=p.cutoff,q=void 0===U?5e3:U,O=p.onDataReady,X=void 0===O?function(){}:O,Y=p.onDataRemoved,H=void 0===Y?function(){}:Y,J=p.ravenPayload,Q=p.additionalHeaders,Z=p.additionalParams,V=a(),$=V[0],ie=V[1],ne=a(new Set),oe=ne[0],te=ne[1],de=c([]),re=c(!1),le=c(Q),ae=c(Z),ce=r((function(){var i=e({page_name:A,vertical:R},w(J)?{}:e({},J));return z||(i.platform="desktop"),i}),[J,z,A,R]),se=l((function(i){if(!re.current&&0!==i){re.current=!0;var n=e(e(e({},ce),{action_name:"recentsearch_impression",recent_searches_result_count:i}),b(R)),o=C(R,"recent_searches_widget_impression");k(o,n)}}),[ce,R]),ue=l((function(e){var i=D("recentsearch_click",ce,e),n=C(R,"recent_searches_card_click");k(n,i)}),[ce,R]),_e=l((function(e){var i=D("recentsearch_dismiss_click",ce,e),n=C(R,"recent_searches_card_dismiss_click");k(n,i)}),[ce,R]),pe=l((function(i){try{W(null==i?void 0:i.id,null==i?void 0:i.type,R,le.current,ae.current),te((function(e){return new Set(e).add(null==i?void 0:i.id)}));var n=setTimeout((function(){ie((function(n){var o;if(n)return e(e({},n),{content:null===(o=null==n?void 0:n.content)||void 0===o?void 0:o.filter((function(e){return(null==e?void 0:e.id)!==(null==i?void 0:i.id)}))})})),te((function(e){var n=new Set(e);return n.delete(null==i?void 0:i.id),n}))}),250);_e(i),de.current.push(n)}catch(e){console.error("Error removing CYS card:",e)}}),[_e,R]),me=l((function(){var e;(null==$?void 0:$.content)&&(null===(e=$.content)||void 0===e?void 0:e.length)>0&&se($.content.length)}),[null===(m=null==$?void 0:$.content)||void 0===m?void 0:m.length,se]),ve=l((function(e){ue(e);var i=null==e?void 0:e.landingUrl;i&&!P()&&(window.location.href=i)}),[ue]);return s((function(){var e=de.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),s((function(){i(void 0,void 0,void 0,(function(){var e,i,o,t,d;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,T(R,q,le.current,ae.current)];case 1:return e=n.sent(),i=null==e?void 0:e.content,Array.isArray(i)&&i.length>0&&(o=z&&R===v?x:h,t=null==i?void 0:i.slice(0,o),ie({usecase:null==e?void 0:e.usecase,content:null==t?void 0:t.filter((function(e){return null==e?void 0:e.title}))}),null==X||X()),[3,3];case 2:return d=n.sent(),console.error("Error fetching recent searches",d),[3,3];case 3:return[2]}}))}))}),[R,q,z,X]),s((function(){var e;(null==$?void 0:$.content)&&0===(null===(e=$.content)||void 0===e?void 0:e.length)&&(null==H||H())}),[null===(f=null==$?void 0:$.content)||void 0===f?void 0:f.length,H]),(null==$?void 0:$.content)&&0!==(null===(y=null==$?void 0:$.content)||void 0===y?void 0:y.length)?o(_,e({onIntersection:me},{children:o("div",e({className:B},{children:t("div",e({className:u(I,z?j:E)},{children:[o("div",e({className:u(F,z?S:G)},{children:"Recent searches"})),o("div",e({className:M},{children:o("div",e({className:z?L:K},{children:null===(g=null==$?void 0:$.content)||void 0===g?void 0:g.map((function(e){return o(ee,{card:e,isPwa:z,vertical:R,isRemoving:oe.has(e.id),onRemove:pe,onClick:ve},null==e?void 0:e.id)}))}))}))]}))}))})):o(d,{})};export{ee as RecentSearchCard,ie 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 r,useCallback as d,useState as a,useRef as l,useEffect as c}from"react";import{getLOBType as s,truncateText as u,getFlightsTitleParts as _,getRecentSearchCardTravelDateText as p,isEmpty as m,getUtmSourceEventData as x,getEventNameByVertical as v,ravenSDKTrigger as h,createRecentSearchCardRavenPayload as f,removeRecentSearchCardViaApi as y,removeCardFromContentById as g,isServer as w,getSize as b,fetchRecentSearchesData as C}from"@cleartrip/ct-platform-utils";import k from"classnames";import{IntersectionObserverHOC as T}from"@cleartrip/ct-platform-io-hoc";import{Typography as P,TypographyVariant as W}from"@cleartrip/ct-design-typography";import{OneWayArrow as D,TwoWayArrow as A,ChevronRight as N,CrossIcon as R}from"@cleartrip/ct-platform-assets";import{HOTEL_FUNNEL_JOURNEY as I,HOTEL_TITLE_MAX_LENGTH as z,AIR_FUNNEL_JOURNEY as j,FLIGHTS_LOCATION_TITLE_MAX_LENGTH as B,SUBTITLE_MAX_LENGTH as F,UAR_VERTICAL as E}from"@cleartrip/ct-platform-constants";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",V="index-module_cysCard__-4dBh",H="index-module_cysCardPWA__Yjxjo",J="index-module_cysCardDesktop__ToN9t",Q="index-module_cysCardContent__xUEFU",Z="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",re="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,a=n.card,l=n.vertical,c=n.isPwa,m=n.isRemoving,x=n.onRemove,v=n.onClick,h=r((function(){return k(V,c?H:J,m?ie:"")}),[c,m]),f=r((function(){return(null==a?void 0:a.type)?s(a.type):""}),[null==a?void 0:a.type]),y=r((function(){switch(null==a?void 0:a.type){case j:var n=_(null==a?void 0:a.title,null==a?void 0:a.metaData,B);if(n){var i=n.origin,r=n.destination,d=n.isOneWay;return t("span",e({className:oe},{children:[i,o(d?D:A,{}),r]}))}return"";case I:return u(null==a?void 0:a.title,z);default:return""}}),[a]),g=r((function(){return(null==a?void 0:a.subtitle)?u(null==a?void 0:a.subtitle,F):""}),[null==a?void 0:a.subtitle]),w=r((function(){var e,n,i=Boolean(g),t=p({cardType:null==a?void 0:a.type,journeyType:(null==a?void 0:a.type)===j?null===(e=null==a?void 0:a.metaData)||void 0===e?void 0:e.journeyType:"",travelDates:null===(n=null==a?void 0:a.metaData)||void 0===n?void 0:n.travelDates});return i||t?i&&t?"".concat(g,", ").concat(t):g||t:""}),[g,null==a?void 0:a.type,null==a?void 0:a.metaData]),b=d((function(e){e.stopPropagation(),null==v||v(a,i)}),[v,a,i]),C=d((function(e){e.stopPropagation(),c&&(null==x||x(a,i))}),[x,a,i,c]);return o("div",e({className:h,onClick:b},{children:t("div",e({className:Q},{children:[t("div",e({className:Z},{children:[l===E&&f&&o(P,e({variant:W.TAG,className:re},{children:f})),o(P,e({variant:W.HM4,className:te},{children:y})),w&&o(P,e({variant:W.P3,className:te},{children:w}))]})),o("div",e({className:k($,c?ne:ee),onClick:C},{children:c?o(R,{width:16,height:16,color:"#1A1A1A"}):o(N,{width:20,height:20})}))]}))}))},ae=function(n){var i,s,u=n.pageName,_=n.vertical,p=n.isPwa,b=void 0===p||p,C=n.ravenPayload,P=n.data,W=n.setData,D=n.abVariant,A=a(new Set),N=A[0],R=A[1],I=l([]),z=l(!1),j=r((function(){var n=e({page_name:u,vertical:_,ab_variant:D||"na"},m(C)?{}:e({},C));return b||(n.platform="desktop"),n}),[C,b,u,_]),B=d((function(n){if(!z.current&&0!==n){z.current=!0;var i=e(e(e({},j),{action_name:"recentsearch_impression",recent_searches_result_count:n}),x(_)),t=v(_,"recent_searches_widget_impression");h(t,i)}}),[j,_]),F=d((function(e,n){var i=f("recentsearch_click",j,e,n),t=v(_,"recent_searches_card_click");h(t,i)}),[j,_]),E=d((function(e,n){var i=f("recentsearch_dismiss_click",j,e,n),t=v(_,"recent_searches_card_dismiss_click");h(t,i)}),[j,_]),V=d((function(e,n){try{y(null==e?void 0:e.id,null==e?void 0:e.type,_),R((function(n){return new Set(n).add(null==e?void 0:e.id)}));var i=setTimeout((function(){var n,i=g(null!==(n=null==P?void 0:P.content)&&void 0!==n?n:[],null==e?void 0:e.id),t={usecase:null==P?void 0:P.usecase,content:i};null==W||W(t),R((function(n){var i=new Set(n);return i.delete(null==e?void 0:e.id),i}))}),250);E(e,n),I.current.push(i)}catch(e){console.error("Error removing CYS card:",e)}}),[E,W,P,_]),H=d((function(){var e;(null==P?void 0:P.content)&&(null===(e=P.content)||void 0===e?void 0:e.length)>0&&B(P.content.length)}),[null===(i=null==P?void 0:P.content)||void 0===i?void 0:i.length,B]),J=d((function(e,n){F(e,n);var i=null==e?void 0:e.landingUrl;i&&!w()&&(window.location.href=i)}),[F]);return c((function(){var e=I.current;return function(){e&&(null==e?void 0:e.length)>0&&(e.forEach((function(e){return clearTimeout(e)})),e.length=0)}}),[]),(null==P?void 0:P.content)&&0!==P.content.length?o(T,e({onIntersection:H},{children:o("div",e({className:M},{children:t("div",e({className:k(G,b?S:L)},{children:[o("div",e({className:k(K,b?U:O)},{children:"Recent searches"})),o("div",e({className:q},{children:o("div",e({className:b?X:Y},{children:null===(s=null==P?void 0:P.content)||void 0===s?void 0:s.map((function(e,n){return o(de,{cardIndex:n,card:e,isPwa:b,vertical:_,isRemoving:N.has(e.id),onRemove:V,onClick:J},null==e?void 0:e.id)}))}))}))]}))}))})):null},le=function(e){var t,r=e.pageName,d=e.vertical,s=e.isPwa,u=void 0===s||s,_=e.cutoff,p=void 0===_?5e3:_,m=e.onDataReady,x=void 0===m?function(){}:m,v=e.onDataRemoved,h=void 0===v?function(){}:v,f=e.ravenPayload,y=e.additionalHeaders,g=e.additionalParams,w=e.abVariant,k=a(),T=k[0],P=k[1],W=l(y),D=l(g);return c((function(){n(void 0,void 0,void 0,(function(){var e,n,t,o,r,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,C(u,d,p,W.current,D.current)];case 1:return e=i.sent(),n=null==e?void 0:e.content,Array.isArray(n)&&n.length>0&&(t=b(u,d),o=null==n?void 0:n.slice(0,t),r={usecase:null==e?void 0:e.usecase,content:o},P(r),null==x||x()),[3,3];case 2:return a=i.sent(),console.error("Error fetching recent searches",a),[3,3];case 3:return[2]}}))}))}),[d,p,u,x]),c((function(){var e;(null==T?void 0:T.content)&&0===(null===(e=T.content)||void 0===e?void 0:e.length)&&(null==h||h("cysWidget"))}),[null===(t=null==T?void 0:T.content)||void 0===t?void 0:t.length,h]),o(ae,{pageName:r,vertical:d,isPwa:u,ravenPayload:f,data:T,setData:P,abVariant:w})};export{de as RecentSearchCard,ae as RecentSearchWidget,le as RecentSearchWidgetContainer};
|
|
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","card","vertical","isPwa","isRemoving","onRemove","onClick","cardClassName","useMemo","classNames","styles","lobTypeText","getLOBType","truncatedTitle","
|
|
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","../packages/components/RecentSearchWidget/src/RecentSearchWidgetContainer.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null],"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_LOCATION_TITLE_MAX_LENGTH","origin_1","origin","destination","isOneWay","_jsxs","__assign","className","children","_jsx","OneWayArrow","TwoWayArrow","HOTEL_FUNNEL_JOURNEY","truncateText","HOTEL_TITLE_MAX_LENGTH","truncatedSubtitle","subtitle","SUBTITLE_MAX_LENGTH","subtitleWithDate","hasSubtitle","Boolean","dateRange","getRecentSearchCardTravelDateText","cardType","journeyType","travelDates","_b","concat","handleCardClick","useCallback","e","stopPropagation","cardIconClickHandler","UAR_VERTICAL","Typography","variant","TypographyVariant","TAG","HM4","P3","CrossIcon","width","height","color","ChevronRight","RecentSearchWidget","pageName","_d","ravenPayload","data","setData","abVariant","_e","useState","Set","removingCardIds","setRemovingCardIds","removeTimeoutsRef","useRef","hasImpressionFiredRef","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","newContent","removeCardFromContentById","content","newData","usecase","newSet","delete","push","error","console","handleIntersection","length","handleItemClick","url","landingUrl","isServer","window","location","href","useEffect","timeoutsMap","forEach","clearTimeout","IntersectionObserverHOC","onIntersection","_c","map","has","RecentSearchWidgetContainer","cutoff","onDataReady","_f","onDataRemoved","additionalHeaders","additionalParams","_g","cysData","setCysData","additionalHeadersRef","additionalParamsRef","__awaiter","fetchRecentSearchesData","response","sent","Array","isArray","cardlength","getSize","displayedItems","slice","error_1"],"mappings":"85DAAA,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,EAA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AAA,GAIpBG,EAAuBjE,EAAO4D,GAC9BM,EAAsBlE,EAAO6D,GA0CnC,OAxCAf,GAAU,WACYqB,OAAA,OAAA,OAAA,GAAA,6EAEO,6BAAA,CAAA,EAAMC,EACnB9I,EACAD,EACAmI,EACAS,EAAqBvD,QACrBwD,EAAoBxD,wBALlB2D,EAAWnJ,EAMhBoJ,OACKzC,EAAUwC,eAAAA,EAAUxC,QACP0C,MAAMC,QAAQ3C,IAAYA,EAAQS,OAAS,IAIpDmC,EAAaC,EAAQpJ,EAAOD,GAC5BsJ,EAAiB9C,aAAA,EAAAA,EAAS+C,MAAM,EAAGH,GACnClF,EAAO,CACTwC,QAASsC,aAAA,EAAAA,EAAUtC,QACnBF,QAAS8C,GAGbX,EAAWzE,GACXkE,SAAAA,oCAGJrB,QAAQD,MAAM,iCAAkC0C,gCAK3D,GAAE,CAACxJ,EAAUmI,EAAQlI,EAAOmI,IAG7BX,GAAU,kBACFiB,aAAA,EAAAA,EAASlC,UAAuC,aAA5B3G,EAAA6I,EAAQlC,8BAASS,UACrCqB,SAAAA,EAAgB,aAExB,GAAG,SAAC3F,EAAA+F,aAAA,EAAAA,EAASlC,8BAASS,OAAQqB,IAG1B5G,EAACoC,GAAkB,CACfC,SAAUA,EACV/D,SAAUA,EACVC,MAAOA,EACPgE,aAAcA,EACdC,KAAMwE,EACNvE,QAASwE,EACTvE,UAAWA,GAGvB","x_google_ignoreList":[0]}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/components/RecentSearchWidget/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-platform-recent-search-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
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-utils": "4.3.
|
|
19
|
-
"@cleartrip/ct-platform-
|
|
20
|
-
"@cleartrip/ct-platform-
|
|
21
|
-
"@cleartrip/ct-platform-
|
|
22
|
-
"@cleartrip/ct-platform-
|
|
18
|
+
"@cleartrip/ct-platform-utils": "4.3.26",
|
|
19
|
+
"@cleartrip/ct-platform-assets": "4.3.26",
|
|
20
|
+
"@cleartrip/ct-platform-types": "4.3.26",
|
|
21
|
+
"@cleartrip/ct-platform-io-hoc": "4.3.26",
|
|
22
|
+
"@cleartrip/ct-platform-constants": "4.3.26"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": ">=16.8.0",
|