@cleartrip/ct-platform-login-module 3.0.0-beta.6 → 3.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,688 @@
1
- "use strict";var e=require("tslib"),i=require("react/jsx-runtime"),t=require("react"),n=require("@cleartrip/ct-design-toast"),r=require("@cleartrip/ct-design-spacer"),a=require("@cleartrip/ct-platform-drawer"),o=require("@cleartrip/ct-design-theme"),l=require("@cleartrip/ct-platform-constants"),s=require("@cleartrip/ct-platform-utils"),c=require("@cleartrip/ct-design-field"),_=require("@cleartrip/ct-design-spinner"),u=require("@cleartrip/ct-design-typography"),d=require("@cleartrip/ct-design-alert-callout"),g=require("@cleartrip/ct-design-icons"),p=require("classnames"),m=require("@cleartrip/ct-design-button"),f=require("@cleartrip/ct-design-divider"),x=require("@cleartrip/ct-platform-assets"),v=require("swiper/react"),h=require("swiper");function N(e){return e&&e.__esModule?e:{default:e}}var A=N(p),C=N(h);function T(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}var E,S={mobileinput_footertext:"index-module_mobileinput_footertext__jPQ-g","mobileinput-seperator":"index-module_mobileinput-seperator__7Ewok",mobileinput_seperatortext:"index-module_mobileinput_seperatortext__-KDOp",slider_carousel_wrapper:"index-module_slider_carousel_wrapper__0SuGB",login_form:"index-module_login_form__tpSDz",nonUtilsSelector_toast:"index-module_nonUtilsSelector_toast__lvWmB",login_otp_error:"index-module_login_otp_error__o3y2L",login_otp_input:"index-module_login_otp_input__L-3P8",footer_text:"index-module_footer_text__nkeJv","swiper-custom-pagination":"index-module_swiper-custom-pagination__Ma1gV",otp_box_wrapper:"index-module_otp_box_wrapper__sM2Ba",otp_container:"index-module_otp_container__1CE4N",swiper:"index-module_swiper__r5-8U","swiper-slide":"index-module_swiper-slide__Zchn0"};T(".index-module_mobileinput_footertext__jPQ-g a{color:#0f6bff;text-decoration:none}.index-module_mobileinput-seperator__7Ewok{position:relative}.index-module_mobileinput_seperatortext__-KDOp{background:#fff;left:0;margin:0 auto;position:absolute;right:0;text-align:center;top:-10px;width:40px}.index-module_slider_carousel_wrapper__0SuGB{border-top-left-radius:16px;border-top-right-radius:16px;width:100dvw}.index-module_login_form__tpSDz{background-color:#fff;padding-left:16px;padding-right:16px}.index-module_nonUtilsSelector_toast__lvWmB{bottom:12px!important;margin-bottom:12px;margin:0 auto!important;padding:12px 16px!important;width:calc(100% - 48px)!important;z-index:2000}.index-module_login_otp_error__o3y2L{padding-top:4px}.index-module_login_otp_input__L-3P8{font-size:24px!important;font-style:normal;font-weight:600!important;height:56px!important;line-height:28px;padding:auto;text-align:center;width:56px!important}.index-module_footer_text__nkeJv{color:grey!important;font-size:12px!important}.index-module_swiper-custom-pagination__Ma1gV{--swiper-theme-color:#fff;--swiper-pagination-color:#fff;--swiper-pagination-bullet-inactive-color:#999;--swiper-pagination-bullet-inactive-opacity:1}.index-module_swiper-custom-pagination__Ma1gV *>span{height:6px;width:6px}.index-module_otp_box_wrapper__sM2Ba{margin-right:8px}.index-module_otp_container__1CE4N{display:flex;flex-direction:column;margin-top:24px}.index-module_swiper__r5-8U{height:100%;width:100%}.index-module_swiper__r5-8U .index-module_swiper-slide__Zchn0{height:auto}.index-module_swiper-slide__Zchn0 img{display:block;height:100%;object-fit:fill;width:100%}"),function(e){e[e.DETECTING=0]="DETECTING",e[e.FAILED=1]="FAILED",e[e.DETECTED=2]="DETECTED"}(E||(E={}));var b=function(n){var a=n.mobileNumber,o=n.errorCallout,p=n.ravenPayload,m=n.otpInputHeight,f=n.skipProfileFlow,x=n.otpResendDisabled,v=n.getOTP,h=n.setCtaDisabled,N=n.setErrorCallout,A=n.setMobileNumber,C=n.setShowMobilePage,T=n.handleLoginSuccess,b=n.handleLoginFailure,O=t.useRef(Array(4).fill(null)),I=t.useState(E.DETECTING),y=I[0],w=I[1],j=t.useState(l.LOGIN_CONSTANTS.OTP_COUNTDOWN),D=j[0],P=j[1],k=t.useState(""),G=k[0],F=k[1],L=t.useState(!0),B=L[0],R=L[1],Q=t.useState(!1),U=Q[0],q=Q[1],M=t.useState(""),z=M[0],X=M[1],K=t.useState(!0),J=K[0],W=K[1],Z=t.useRef(),V=t.useRef(),H="CT";t.useEffect((function(){Y();var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"login_otp_screen_opened",login_form:null==i?void 0:i.loginForm,login_type:"native",vertical:null==i?void 0:i.vertical,page_name:null==i?void 0:i.pageName},p))}),[]),t.useEffect((function(){s.isIOSApp()&&W(!1)}),[]),t.useEffect((function(){Y()}),[]),t.useEffect((function(){0===D&&R(!1)}),[D]),t.useEffect((function(){var e;return B&&D>0&&(e=setInterval((function(){P((function(e){return e-1}))}),1e3)),function(){clearInterval(e)}}),[B,D]);var Y=t.useCallback((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var i;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s.autoReadOtp()];case 1:return i=e.sent(),F(i),w(E.DETECTED),(null==i?void 0:i.length)===l.LOGIN_CONSTANTS.OTP_LENGTH&&ee&&ee(i,!0),[3,3];case 2:return"NOT_SUPPORTED"===e.sent()&&W(!1),[3,3];case 3:return[2]}}))}))}),[J]),$=t.useCallback((function(i){var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_error",e.__assign({action_name:"otp_incorrect",login_form:null==t?void 0:t.loginForm,login_type:"native",vertical:null==t?void 0:t.vertical,page_name:null==t?void 0:t.pageName},p));var n=null==i?void 0:i.message;"OTP_VALIDATE_LIMIT_EXCEEDED"!==n&&F(""),O.current[0].focus(),O.current[0].click();var r=l.LOGIN_CONSTANTS[n],a="string"==typeof r?r:l.LOGIN_CONSTANTS.INVALID_OTP;X(a)}),[O]),ee=t.useCallback((function(i,t){return e.__awaiter(void 0,void 0,void 0,(function(){var n,r,o,c,_;return e.__generator(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),n=s.getRavenEventProps(),s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"otp_entered",login_form:null==n?void 0:n.loginForm,login_type:"native",entry_type:t?"autodetected":"manual_entry",vertical:null==n?void 0:n.vertical,page_name:null==n?void 0:n.pageName},p)),i===Z.current&&V.current&&V.current-Date.now()<=100?[2]:(Z.current=i,V.current=Date.now(),[4,s.validateOtp(a,i)]);case 1:return r=u.sent(),o=r.status,c=r.action,200!==Number(o)||s.isEmpty(c)?b(H):(q(!0),X(""),s.updateNativeOnLogin(),"SIGNUP"===c?(f||(window.location.href=l.NAVIGATION_ROUTES.PERSONAL_DETAILS+"?onboardingFlow=true"),T(H,!0)):T(H)),[3,3];case 2:return _=u.sent(),b(H),$(_),[3,3];case 3:return[2]}}))}))}),[Z,V,q,w,X,$]),ie=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var i,t,n,r,a;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.readText()];case 1:return(i=e.sent())&&s.isNumeric(i)&&(t=i.slice(0,l.LOGIN_CONSTANTS.OTP_LENGTH).split(""),null===(r=O.current[l.LOGIN_CONSTANTS.OTP_LENGTH-1])||void 0===r||r.focus(),null===(a=O.current[l.LOGIN_CONSTANTS.OTP_LENGTH-1])||void 0===a||a.click(),n=t.join(""),F(n),n.length===l.LOGIN_CONSTANTS.OTP_LENGTH&&ee(n,!1)),[2]}}))}))},te=t.useCallback((function(e,i){var t,n;N(""),""!==e.target.value&&i<O.current.length-1&&(null===(t=O.current[i+1])||void 0===t||t.focus(),null===(n=O.current[i+1])||void 0===n||n.click());var r=O.current.map((function(e){return s.isHTMLInputElement(e)?e.value:""})).join("").slice(0,4);F(r),r.length===l.LOGIN_CONSTANTS.OTP_LENGTH&&ee(r,!1)}),[F,ee]),ne=t.useCallback((function(e,i){var t,n,r;"Backspace"===e.key&&i>0&&""===(null===(t=O.current[i])||void 0===t?void 0:t.value)&&(e.preventDefault(),null===(n=O.current[i-1])||void 0===n||n.focus(),null===(r=O.current[i-1])||void 0===r||r.click())}),[O]),re=t.useCallback((function(){P(l.LOGIN_CONSTANTS.OTP_COUNTDOWN),R(!0),v(a);var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_error",e.__assign({action_name:"resend_otp_clicked",login_form:null==i?void 0:i.loginForm,login_type:"native",vertical:null==i?void 0:i.vertical,page_name:null==i?void 0:i.pageName},p))}),[P,R]),ae=t.useCallback((function(){h(!0),C(!0),A("")}),[C]);return i.jsxs("div",e.__assign({className:"flex flex-column bg-neutral-100",style:{height:m}},{children:[o&&i.jsx(d.AlertCallout,{variant:"error",textNode:o,prefixIconNode:i.jsx(g.InfoIcon,{fill:"red"}),style:{color:"#ffff",backgroundColor:"#db201e"},className:"fs-12"}),i.jsxs("div",e.__assign({className:"flex flex-bottom"},{children:[i.jsxs(u.Typography,e.__assign({variant:"HM1",color:"heading"},{children:[l.LOGIN_CONSTANTS.OTP_TEXT," ",i.jsx("br",{}),a]})),i.jsx("div",e.__assign({className:"pl-2",onClick:ae},{children:i.jsx(g.Edit,{})}))]})),i.jsxs("div",e.__assign({className:S.otp_container},{children:[i.jsx("div",e.__assign({className:"flex"},{children:e.__spreadArray([],Array(l.LOGIN_CONSTANTS.OTP_LENGTH),!0).map((function(t,n){return i.jsx("div",e.__assign({className:S.otp_box_wrapper},{children:i.jsx(c.FieldV2,{prompt:{hasError:!!z},type:"number",placeholder:"",value:G[n],max:1,inputMode:"numeric",className:S.login_otp_input,variant:"md",ref:function(e){e&&(O.current[n]=e)},onKeyDown:function(e){return ne(e,n)},onChange:function(e){return te(e,n)},onPaste:ie,autoFocus:0===n})}),n)}))})),!!z&&i.jsx(u.Typography,e.__assign({variant:"P1",color:"warning",className:S.login_otp_error},{children:z}))]})),i.jsx(r.Spacer,{className:"pt-2"}),y===E.DETECTING&&!U&&J&&D>l.LOGIN_CONSTANTS.RESEND_OTP_COUNTDOWN&&i.jsxs("div",e.__assign({className:"flex flex-middle"},{children:[i.jsx(_.Spinner,{width:"20px",height:"20px",borderColor:"#11a670",className:"bg-neutral-900 bc-black"}),i.jsx(u.Typography,e.__assign({variant:"B3",className:"fs-12 fw-500 ml-1 c-neutral-700"},{children:l.LOGIN_CONSTANTS.AUTO_DETECTING_TEXT}))]})),y===E.DETECTING&&D<=l.LOGIN_CONSTANTS.RESEND_OTP_COUNTDOWN&&J&&!U&&i.jsx(i.Fragment,{children:i.jsxs("div",e.__assign({className:"flex"},{children:[i.jsx(u.Typography,e.__assign({variant:"B3",className:"fs-12 fw-500 c-neutral-700 "},{children:l.LOGIN_CONSTANTS.OTP_RESEND_TEXT})),i.jsx(r.Spacer,{className:"ml-1"}),x?i.jsx(u.Typography,e.__assign({className:"color-neutral-200 fw-500",variant:"B3"},{children:l.LOGIN_CONSTANTS.RESEND_CTA})):i.jsxs(i.Fragment,{children:[0===D&&i.jsx(i.Fragment,{children:i.jsx(u.Typography,e.__assign({isClickable:!0,variant:"B3",onClick:re,color:"link",className:"\n fs-12 fw-500 c-pointer"},{children:l.LOGIN_CONSTANTS.RESEND_CTA}))}),D>0&&i.jsx(u.Typography,e.__assign({color:"disabled",variant:"B3"},{children:" Resend ("+D+"s)"}))]})]}))}),!z&&U&&i.jsx(i.Fragment,{children:i.jsxs("div",e.__assign({className:"flex flex-middle"},{children:[i.jsx(g.CheckCircle,{}),i.jsx(u.Typography,e.__assign({variant:"P1",color:"success",className:"fs-12"},{children:y===E.DETECTED?l.LOGIN_CONSTANTS.AUTO_DETECTED_TEXT:l.LOGIN_CONSTANTS.VERIFIED_MESSAGE}))]}))}),i.jsx(r.Spacer,{className:"mt-24"})]}))},O={loader:"index-module_loader__63LeU","With-full-opacity":"index-module_With-full-opacity__ZSY-U",loader__content:"index-module_loader__content__Q6kJl",loader__spinner:"index-module_loader__spinner__6B3AR","loader-rotate":"index-module_loader-rotate__efcf3",loader__heading:"index-module_loader__heading__7YZ3N",loader__text:"index-module_loader__text__1QcLi"};T(".index-module_loader__63LeU{align-items:center;background-color:hsla(0,0%,100%,.95);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:0}.index-module_loader__63LeU.index-module_With-full-opacity__ZSY-U{background-color:#fff}.index-module_loader__content__Q6kJl{max-width:280px;text-align:center}.index-module_loader__spinner__6B3AR{animation:index-module_loader-rotate__efcf3 .8s linear infinite;border:2px solid rgba(51,102,204,.3);border-radius:50%;border-top-color:#36c;display:inline-block;height:30px;margin-bottom:10px;position:relative;width:30px}.index-module_loader__heading__7YZ3N{color:#000;font-size:18px;font-weight:600;margin-bottom:5px}.index-module_loader__text__1QcLi{color:rgba(0,0,0,.8);font-size:16px;line-height:1.5}");var I=function(t){var n=t.title,r=t.message,a=t.className;return i.jsx("div",e.__assign({className:"".concat(O.utilswrapper," utilswrapper")},{children:i.jsx("div",e.__assign({className:A.default(O.loader,a)},{children:i.jsxs("div",e.__assign({className:O.loader__content},{children:[i.jsx("div",{className:O.loader__spinner}),i.jsx("h5",e.__assign({className:O.loader__heading},{children:n})),i.jsx("p",e.__assign({className:O.loader__text},{children:r}))]}))}))}))},y=function(n){var r=n.sendingOtp,a=n.ctaDisabled,o=n.getOTP,_=n.setErrorCallout,p=n.errorCallout,v=n.mobileNumber,h=n.setMobileInputHeight,N=n.setMobileNumber,A=n.fallbackUri,C=n.skipProfileFlow,T=n.currentPageUri,E=n.ravenPayload,b=t.useState(s.isFKSSOEnabled)[0],O=t.useState(!1),I=O[0],y=O[1],w=t.useRef(null),j=t.useRef(null);t.useEffect((function(){if(j.current){var e=j.current.clientHeight;h(e)}}),[j.current]),t.useEffect((function(){var e;return w.current&&(e=setTimeout((function(){var e;null===(e=w.current)||void 0===e||e.focus()}),100)),function(){clearTimeout(e)}}),[]),t.useEffect((function(){s.isAndroidApp()&&k()}),[]);var D=t.useCallback((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var i,t;return e.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),i=s.getRavenEventProps(),s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"login_with_flipkart_clicked",login_form:null==i?void 0:i.loginForm,login_type:"fk_sso",vertical:null==i?void 0:i.vertical,page_name:null==i?void 0:i.pageName},E)),y(!0),[4,s.handleFKSSO(A,C?T:l.NAVIGATION_ROUTES.PERSONAL_DETAILS+"?onboardingFlow=true",T)];case 1:return t=n.sent(),y(!1),s.isPwa()&&(window.location.href=t),[3,3];case 2:return n.sent(),y(!1),[3,3];case 3:return[2]}}))}))}),[]),P=t.useCallback((function(i,t){void 0===t&&(t=!1),_("");var n=i.target.value||"";if(n=n.replace(s.MULTI_SPACE," ").trimStart(),N(n),s.isValidMobileNumber(i.target.value)){o(n);var r=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"get_otp_clicked",login_form:null==r?void 0:r.loginForm,login_type:"native",entry_type:"auto_click",vertical:null==r?void 0:r.vertical,page_name:null==r?void 0:r.pageName},E)),t?s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"phone_number_autodetected",login_form:null==r?void 0:r.loginForm,login_type:"native",entry_type:"autodetected",vertical:null==r?void 0:r.vertical,page_name:null==r?void 0:r.pageName},E)):s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"phone_number_entered",login_form:null==r?void 0:r.loginForm,login_type:"native",entry_type:"manual_entry",vertical:null==r?void 0:r.vertical,page_name:null==r?void 0:r.pageName},E))}}),[N]),k=t.useCallback((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var i,t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.showMobileNumberHint()];case 1:return i=e.sent(),t={target:{value:i}},i&&P(t,!0),[2]}}))}))}),[P]),G=t.useCallback((function(){var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"policy_click",login_form:null==i?void 0:i.loginForm,login_type:"native",vertical:null==i?void 0:i.vertical,page_name:null==i?void 0:i.pageName},E)),window.location.href=l.NAVIGATION_ROUTES.PRIVACY_POLICY}),[]),F=t.useCallback((function(){var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"tnc_click",login_form:null==i?void 0:i.loginForm,login_type:"native",vertical:null==i?void 0:i.vertical,page_name:null==i?void 0:i.pageName},E)),window.location.href=l.NAVIGATION_ROUTES.TERMS}),[]);return i.jsxs("div",e.__assign({className:"flex flex-column",ref:j},{children:[p&&i.jsx(d.AlertCallout,{variant:"error",textNode:p,prefixIconNode:i.jsx(g.InfoIcon,{fill:"red"}),style:{color:"#ffff",backgroundColor:"#db201e"},className:"fs-12"}),i.jsx(u.Typography,e.__assign({variant:"HM1",color:"heading",className:"mb-4 fs-24"},{children:l.LOGIN_CONSTANTS.LOGIN_TO_CT})),i.jsx("label",e.__assign({style:{visibility:"hidden",width:"0.1px",height:"0.1px"},htmlFor:"phonenumber"},{children:"Phone number"})),i.jsx(c.PhoneField,{onChange:P,value:v,name:"phonenumber",placeholder:"",inputMode:"numeric",ref:w,min:0,max:10,autoFocus:!0,countryCode:l.LOGIN_CONSTANTS.COUNTRY_CODE}),i.jsx(m.Button,e.__assign({color:"primary",size:"medium",minWidth:"160px",disabled:a,loading:r,className:"my-6",onClick:function(){return o(v)}},{children:l.LOGIN_CONSTANTS.GET_OTP})),b&&i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({className:"my-6 p-relative"},{children:[i.jsx(f.Divider,{}),i.jsx("span",e.__assign({className:"".concat(S.mobileinput_seperatortext)},{children:"or"}))]})),i.jsx(m.Button,e.__assign({variant:"outline",size:"medium",className:"my-6",loading:I,onClick:D,showLeftIcon:!I,LeftIcon:i.jsx("img",{src:x.FlipkartLogo})},{children:l.LOGIN_CONSTANTS.FK_LOGIN_CTA}))]}),i.jsxs("div",e.__assign({className:"pt-8 pb-6"},{children:[i.jsx(f.Divider,{}),i.jsxs("div",e.__assign({className:"flex flex-middle \n flex-center flex-wrap pt-2"},{children:[i.jsx(u.Typography,e.__assign({variant:"P1",className:S.footer_text},{children:l.LOGIN_CONSTANTS.FOOTER_TEXT})),i.jsx(u.Typography,e.__assign({variant:"P1",color:"link",className:"pl-1 fs-12",isClickable:!0,onClick:G},{children:l.LOGIN_CONSTANTS.PRIVACY_CTA})),i.jsx(u.Typography,e.__assign({className:"px-1 fs-12 c-neutral-700",variant:"P1"},{children:"& "})),i.jsx(u.Typography,e.__assign({variant:"P1",color:"link",isClickable:!0,onClick:F,className:"fs-12"},{children:l.LOGIN_CONSTANTS.TNC_CTA}))]}))]}))]}))};const w="data:image/png;base64,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",j=[{src:"https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel1.png",placeholder:w},{src:"https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel2.png",placeholder:w},{src:"https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel3.png",placeholder:w}];var D=function(n){var r=n.src,a=n.placeholderSrc,o=n.onLoad,l=e.__rest(n,["src","placeholderSrc","onLoad"]),s=t.useState(a||r),c=s[0],_=s[1],u=t.useRef(o);return t.useEffect((function(){u.current=o}),[o]),t.useEffect((function(){var e=new Image;e.onload=function(){_(r),u.current&&u.current()},e.src=r}),[r]),i.jsx("img",e.__assign({src:c},l))},P="index-module_slides__container__9XVd4",k="index-module_slides__container--imageContainer__q0RuP";T(".index-module_slides__container__9XVd4{align-items:center;box-sizing:border-box;display:flex;gap:1.5rem;height:197px;justify-content:center;width:100%}.index-module_slides__container--imageContainer__q0RuP{align-self:flex-start;margin-top:2rem;width:128px}");var G=function(t){var n=t.textData,r=t.bgColor,a=t.imageUrl,o=t.altText;return i.jsxs("div",e.__assign({className:P,style:{backgroundColor:r}},{children:[i.jsx("div",e.__assign({className:k},{children:i.jsx(D,{width:128,height:128,alt:o,src:a})})),i.jsx("div",{children:null==n?void 0:n.map((function(t,n){return i.jsx(u.Typography,e.__assign({variant:u.TypographyVariant.HM2,style:{color:t.textColor,lineHeight:"24px"}},{children:t.text}),n)}))})]}))},F=function(){return[i.jsx(G,{bgColor:"#4F8EF0",imageUrl:"https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_128,h_128,dpr_2/offermgmt/images/banner/Login%20Frame.png",altText:"Dhonicampaign_icon",textData:[{text:"Use code CTMAHI",textColor:"#fff"},{text:"& get flat 777 off,",textColor:"#fff"},{text:"on your first",textColor:"#032529"},{text:"flight booking",textColor:"#032529"}]},1),i.jsx(G,{bgColor:"#FF8D71",imageUrl:"https://fastui.cltpstatic.com/image/upload/f_auto,w_128,h_128,dpr_2/offermgmt/images/loginSheetMyntra.webp",altText:"loyality_benefits_icon",textData:[{text:"Loyalty benefits",textColor:"#fff"},{text:"and discounts",textColor:"#fff"},{text:"for Flipkart and",textColor:"#331005"},{text:"Myntra members",textColor:"#331005"}]},2),i.jsx(G,{bgColor:"#FFC142",imageUrl:"https://fastui.cltpstatic.com/image/upload/f_auto,w_128,h_128,dpr_2/offermgmt/images/loginSheetCoupon.webp",altText:"CTLogin_icon",textData:[{text:"Flat 25% off",textColor:"#fff"},{text:"on your first",textColor:"#fff"},{text:"hotel booking",textColor:"#fff"},{text:"Code: CTMAHI",textColor:"#332504"}]},3),i.jsx(G,{bgColor:"#61C149",imageUrl:"https://fastui.cltpstatic.com/image/upload/f_auto,w_128,h_128,dpr_2/offermgmt/images/loginSheetWallet.webp",altText:"EarnAndRedeem_icon",textData:[{text:"Earn and",textColor:"#fff"},{text:"redeem up to",textColor:"#fff"},{text:"650 Flipkart",textColor:"#13270F"},{text:"Supercoins",textColor:"#13270F"}]},4)]};C.default.use([h.Autoplay,h.Navigation,h.Pagination]);var L=function(n){var r=n.customSlides,a=n.carouselImages,o=t.useMemo((function(){return s.isEmpty(a)?j:a}),[a]);return i.jsx("div",e.__assign({className:" o-hidden p-relative ".concat(S.slider_carousel_wrapper)},{children:i.jsx(v.Swiper,e.__assign({autoplay:!0,slidesPerView:1,navigation:!1,loop:!0,pagination:{clickable:!0},className:"".concat(S.swiper," ").concat(S["swiper-custom-pagination"]),lazy:{loadPrevNextAmount:1}},{children:a&&a.length>0?null==o?void 0:o.map((function(t,n){return i.jsx(v.SwiperSlide,e.__assign({className:S["swiper-slide"]},{children:i.jsx(i.Fragment,{children:n<1?i.jsx(D,{src:t.src,placeholderSrc:t.placeholder,alt:"Slide ".concat(n+1),rel:"preload",fetchPriority:"high"}):i.jsx(D,{src:t.src,placeholderSrc:t.placeholder,alt:"Slide ".concat(n+1),loading:"lazy",className:"lazy"})})}),n)})):r&&r.length>0?null==r?void 0:r.map((function(t,n){return i.jsx(v.SwiperSlide,e.__assign({className:S["swiper-slide"]},{children:t}),n)})):F().length&&F().map((function(t,n){return i.jsx(v.SwiperSlide,e.__assign({className:S["swiper-slide"]},{children:t}),n)}))}))}))};exports.LoginModule=function(c){var _=c.fallbackUri,u=c.isDrawerOpen,d=c.skipProfileFlow,g=c.showCarousel,p=void 0===g||g,m=c.ravenPayload,f=void 0===m?{}:m,x=c.handleLoginClose,v=c.onAuthSuccess,h=c.onAuthFailure,N=c.customSlides,A=c.carouselImages,C=void 0===A?[]:A,T=c.closeOnOutsideClick,E=void 0!==T&&T,O=c.sendUserInsights,w=void 0===O||O,j=t.useState(!0),D=j[0],P=j[1],k=t.useState(!0),G=k[0],F=k[1],B=t.useState(!1),R=B[0],Q=B[1],U=t.useState(u),q=U[0],M=U[1],z=t.useState(""),X=z[0],K=z[1],J=t.useState(0),W=J[0],Z=J[1],V=t.useState(!1),H=V[0],Y=V[1],$=t.useState(""),ee=$[0],ie=$[1],te=t.useState(!1),ne=te[0],re=te[1],ae=t.useState(!1),oe=ae[0],le=ae[1],se=t.useState((function(){return s.getCurrentPathName()}))[0],ce=function(){le(!0)};t.useEffect((function(){window&&(window.showSigninLoaderScreen=ce);var e=s.getQueryParam("fkSSOstatus"),i="FK";"signin"===e&&(s.isAndroidApp()&&s.updateNativeAndroidOnSignIn(),ue(i)),"signup"===e&&(s.isAndroidApp()&&s.updateNativeAndroidOnSignIn(),ue(i,!0)),"failure"===e&&de(i)}),[]);var _e=t.useCallback((function(i){return e.__awaiter(void 0,void 0,void 0,(function(){var t,n,r,a;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),F(!1),Q(!0),s.triggerOTPListener(),[4,s.sendLoginOtp(i)];case 1:return t=e.sent(),"SUCCESS"===(t||{}).status&&(P(!1),Q(!1)),[3,3];case 2:return n=e.sent(),console.error(n),r=(n||{}).message,Q(!1),a=r&&l.LOGIN_CONSTANTS[r],ie(String(a||l.LOGIN_CONSTANTS.GENERIC_ERROR_MESSAGE)),"OTP_SEND_LIMIT_EXCEEDED"===r&&Y(!0),[3,3];case 3:return[2]}}))}))}),[D,P]),ue=t.useCallback((function(i,t){var n=s.getRavenEventProps(),r=e.__assign({action_name:"login_successful",login_form:null==n?void 0:n.loginForm,login_type:"native",login_new:t?"sign_up":"sign_in",vertical:null==n?void 0:n.vertical,page_name:null==n?void 0:n.pageName},f);w?s.sendEventWithUserInsights("u_login_success",r):s.ravenSDKTrigger("u_login_success",r),v(i,t),t&&!d||(ge(),re(!0))}),[w]),de=t.useCallback((function(e){h(e)}),[]),ge=function(i){null==i||i.stopPropagation(),M(!1),K(""),F(!0);var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"login_prompt_dismissed",login_form:null==t?void 0:t.loginForm,login_type:"native",vertical:null==t?void 0:t.vertical,page_name:null==t?void 0:t.pageName},f)),x&&"function"==typeof x&&x()};return t.useEffect((function(){if(u){P(!0),M(!0);var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_popup",e.__assign({action_name:"login_prompt_opened",login_form:null==i?void 0:i.loginForm,login_type:"native",vertical:null==i?void 0:i.vertical,page_name:null==i?void 0:i.pageName},f))}else M(!1)}),[u]),i.jsx(o.ThemeProvider,{children:i.jsxs(i.Fragment,{children:[i.jsx(a.Drawer,e.__assign({direction:"bottom",isOpen:q,showClose:!0,overlay:!0,handleClose:ge,onClose:function(){},closeOnOutsideClick:E},{children:i.jsx("div",e.__assign({className:"".concat(S.utilswrapper," utilswrapper")},{children:i.jsxs("div",e.__assign({style:{maxHeight:"calc(100dvh - 60px)",overflowY:"auto",borderRadius:"16px 16px 0 0"}},{children:[p&&i.jsx(L,{customSlides:N,carouselImages:C}),i.jsxs("div",e.__assign({className:S.login_form},{children:[i.jsx("div",{children:i.jsx(r.Spacer,{className:"pt-6"})}),D?i.jsx(y,{device:"PWA",ctaDisabled:G,sendingOtp:R,getOTP:_e,mobileNumber:X,setMobileNumber:K,setMobileInputHeight:Z,fallbackUri:_,skipProfileFlow:d,currentPageUri:se,setErrorCallout:ie,errorCallout:ee,ravenPayload:f}):i.jsx(b,{mobileNumber:X,getOTP:_e,setCtaDisabled:F,setShowMobilePage:P,handleLoginSuccess:ue,handleLoginFailure:de,otpInputHeight:W,setMobileNumber:K,setErrorCallout:ie,errorCallout:ee,otpResendDisabled:H,ravenPayload:f,skipProfileFlow:d})]}))]}))}))})),ne&&i.jsx(n.Toast,{text:"Logged in successfully!",show:ne,className:"".concat(S.nonUtilsSelector_toast),closeTimeout:2e3}),oe&&i.jsx(I,{title:"Please wait",message:"Signing in...",className:"z-10 bg-white"})]})})};
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var react = require('react');
6
+ var ctDesignToast = require('@cleartrip/ct-design-toast');
7
+ var ctDesignSpacer = require('@cleartrip/ct-design-spacer');
8
+ var ctPlatformDrawer = require('@cleartrip/ct-platform-drawer');
9
+ var ctDesignTheme = require('@cleartrip/ct-design-theme');
10
+ var ctPlatformConstants = require('@cleartrip/ct-platform-constants');
11
+ var ctPlatformUtils = require('@cleartrip/ct-platform-utils');
12
+ var ctDesignField = require('@cleartrip/ct-design-field');
13
+ var ctDesignSpinner = require('@cleartrip/ct-design-spinner');
14
+ var ctDesignTypography = require('@cleartrip/ct-design-typography');
15
+ var ctDesignAlertCallout = require('@cleartrip/ct-design-alert-callout');
16
+ var ctDesignIcons = require('@cleartrip/ct-design-icons');
17
+ var classNames = require('classnames');
18
+ var ctDesignButton = require('@cleartrip/ct-design-button');
19
+ var ctDesignDivider = require('@cleartrip/ct-design-divider');
20
+ var ctPlatformAssets = require('@cleartrip/ct-platform-assets');
21
+ var react$1 = require('swiper/react');
22
+ var SwiperCore = require('swiper');
23
+
24
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
25
+
26
+ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
27
+ var SwiperCore__default = /*#__PURE__*/_interopDefault(SwiperCore);
28
+
29
+ function styleInject(css, ref) {
30
+ if (ref === void 0) ref = {};
31
+ var insertAt = ref.insertAt;
32
+ if (!css || typeof document === 'undefined') {
33
+ return;
34
+ }
35
+ var head = document.head || document.getElementsByTagName('head')[0];
36
+ var style = document.createElement('style');
37
+ style.type = 'text/css';
38
+ if (insertAt === 'top') {
39
+ if (head.firstChild) {
40
+ head.insertBefore(style, head.firstChild);
41
+ } else {
42
+ head.appendChild(style);
43
+ }
44
+ } else {
45
+ head.appendChild(style);
46
+ }
47
+ if (style.styleSheet) {
48
+ style.styleSheet.cssText = css;
49
+ } else {
50
+ style.appendChild(document.createTextNode(css));
51
+ }
52
+ }
53
+
54
+ var css_248z$2 = ".index-module_mobileinput_footertext__jPQ-g a{color:#0f6bff;text-decoration:none}.index-module_mobileinput-seperator__7Ewok{position:relative}.index-module_mobileinput_seperatortext__-KDOp{background:#fff;left:0;margin:0 auto;position:absolute;right:0;text-align:center;top:-10px;width:40px}.index-module_slider_carousel_wrapper__0SuGB{border-top-left-radius:16px;border-top-right-radius:16px;width:100dvw}.index-module_login_form__tpSDz{background-color:#fff;padding-left:16px;padding-right:16px}.index-module_nonUtilsSelector_toast__lvWmB{bottom:12px!important;margin-bottom:12px;margin:0 auto!important;padding:12px 16px!important;width:calc(100% - 48px)!important;z-index:2000}.index-module_login_otp_error__o3y2L{padding-top:4px}.index-module_login_otp_input__L-3P8{font-size:24px!important;font-style:normal;font-weight:600!important;height:56px!important;line-height:28px;padding:auto;text-align:center;width:56px!important}.index-module_footer_text__nkeJv{color:grey!important;font-size:12px!important}.index-module_swiper-custom-pagination__Ma1gV{--swiper-theme-color:#fff;--swiper-pagination-color:#fff;--swiper-pagination-bullet-inactive-color:#999;--swiper-pagination-bullet-inactive-opacity:1}.index-module_swiper-custom-pagination__Ma1gV *>span{height:6px;width:6px}.index-module_otp_box_wrapper__sM2Ba{margin-right:8px}.index-module_otp_container__1CE4N{display:flex;flex-direction:column;margin-top:24px}.index-module_swiper__r5-8U{height:100%;width:100%}.index-module_swiper__r5-8U .index-module_swiper-slide__Zchn0{height:auto}.index-module_swiper-slide__Zchn0 img{display:block;height:100%;object-fit:fill;width:100%}";
55
+ var styles$1 = {"mobileinput_footertext":"index-module_mobileinput_footertext__jPQ-g","mobileinput-seperator":"index-module_mobileinput-seperator__7Ewok","mobileinput_seperatortext":"index-module_mobileinput_seperatortext__-KDOp","slider_carousel_wrapper":"index-module_slider_carousel_wrapper__0SuGB","login_form":"index-module_login_form__tpSDz","nonUtilsSelector_toast":"index-module_nonUtilsSelector_toast__lvWmB","login_otp_error":"index-module_login_otp_error__o3y2L","login_otp_input":"index-module_login_otp_input__L-3P8","footer_text":"index-module_footer_text__nkeJv","swiper-custom-pagination":"index-module_swiper-custom-pagination__Ma1gV","otp_box_wrapper":"index-module_otp_box_wrapper__sM2Ba","otp_container":"index-module_otp_container__1CE4N","swiper":"index-module_swiper__r5-8U","swiper-slide":"index-module_swiper-slide__Zchn0"};
56
+ styleInject(css_248z$2);
57
+
58
+ var AutoDetectState;
59
+ (function (AutoDetectState) {
60
+ AutoDetectState[AutoDetectState["DETECTING"] = 0] = "DETECTING";
61
+ AutoDetectState[AutoDetectState["FAILED"] = 1] = "FAILED";
62
+ AutoDetectState[AutoDetectState["DETECTED"] = 2] = "DETECTED";
63
+ })(AutoDetectState || (AutoDetectState = {}));
64
+ var OtpInput = function (_a) {
65
+ var mobileNumber = _a.mobileNumber, errorCallout = _a.errorCallout, ravenPayload = _a.ravenPayload, otpInputHeight = _a.otpInputHeight, skipProfileFlow = _a.skipProfileFlow, otpResendDisabled = _a.otpResendDisabled, getOTP = _a.getOTP, setCtaDisabled = _a.setCtaDisabled, setErrorCallout = _a.setErrorCallout, setMobileNumber = _a.setMobileNumber, setShowMobilePage = _a.setShowMobilePage, handleLoginSuccess = _a.handleLoginSuccess, handleLoginFailure = _a.handleLoginFailure;
66
+ var inputRefs = react.useRef(Array(4).fill(null));
67
+ var _b = react.useState(AutoDetectState.DETECTING), autoDetecting = _b[0], setAutoDetecting = _b[1];
68
+ var _c = react.useState(ctPlatformConstants.LOGIN_CONSTANTS.OTP_COUNTDOWN), countdown = _c[0], setCountdown = _c[1];
69
+ var _d = react.useState(''), otp = _d[0], setOtp = _d[1];
70
+ var _f = react.useState(true), countdownEnabled = _f[0], setCountdownEnabled = _f[1];
71
+ var _g = react.useState(false), verifiedOtp = _g[0], setVerifiedOtp = _g[1];
72
+ var _h = react.useState(''), otpErrorMessage = _h[0], setOtpErrorMessage = _h[1];
73
+ var _j = react.useState(true), enableAutoDetect = _j[0], setEnableAutoDetect = _j[1];
74
+ var lastOtpRequest = react.useRef();
75
+ var lastOtpRequestTimeStamp = react.useRef();
76
+ var loginMethod = 'CT';
77
+ react.useEffect(function () {
78
+ autoDetect();
79
+ var eventProps = ctPlatformUtils.getRavenEventProps();
80
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'login_otp_screen_opened', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
81
+ }, []);
82
+ react.useEffect(function () {
83
+ if (ctPlatformUtils.isIOSApp()) {
84
+ setEnableAutoDetect(false);
85
+ }
86
+ }, []);
87
+ react.useEffect(function () {
88
+ autoDetect();
89
+ }, []);
90
+ react.useEffect(function () {
91
+ if (countdown === 0) {
92
+ setCountdownEnabled(false);
93
+ }
94
+ }, [countdown]);
95
+ react.useEffect(function () {
96
+ var interval;
97
+ if (countdownEnabled && countdown > 0) {
98
+ interval = setInterval(function () {
99
+ setCountdown(function (prevCountdown) { return prevCountdown - 1; });
100
+ }, 1000);
101
+ }
102
+ return function () {
103
+ clearInterval(interval);
104
+ };
105
+ }, [countdownEnabled, countdown]);
106
+ var autoDetect = react.useCallback(function () { return tslib.__awaiter(void 0, void 0, void 0, function () {
107
+ var otp_1, _e_1;
108
+ return tslib.__generator(this, function (_a) {
109
+ switch (_a.label) {
110
+ case 0:
111
+ _a.trys.push([0, 2, , 3]);
112
+ return [4, ctPlatformUtils.autoReadOtp()];
113
+ case 1:
114
+ otp_1 = _a.sent();
115
+ setOtp(otp_1);
116
+ setAutoDetecting(AutoDetectState.DETECTED);
117
+ if ((otp_1 === null || otp_1 === void 0 ? void 0 : otp_1.length) === ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH &&
118
+ handleOtpComplete) {
119
+ handleOtpComplete(otp_1, true);
120
+ }
121
+ return [3, 3];
122
+ case 2:
123
+ _e_1 = _a.sent();
124
+ if (_e_1 === 'NOT_SUPPORTED') {
125
+ setEnableAutoDetect(false);
126
+ }
127
+ return [3, 3];
128
+ case 3: return [2];
129
+ }
130
+ });
131
+ }); }, [enableAutoDetect]);
132
+ var handleOtpValidationError = react.useCallback(function (e) {
133
+ var eventProps = ctPlatformUtils.getRavenEventProps();
134
+ ctPlatformUtils.ravenSDKTrigger('u_login_error', tslib.__assign({ action_name: 'otp_incorrect', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
135
+ var message = e === null || e === void 0 ? void 0 : e.message;
136
+ if (message !== 'OTP_VALIDATE_LIMIT_EXCEEDED') {
137
+ setOtp('');
138
+ }
139
+ inputRefs.current[0].focus();
140
+ inputRefs.current[0].click();
141
+ var messageValue = ctPlatformConstants.LOGIN_CONSTANTS[message];
142
+ var toastMessage = typeof messageValue === 'string'
143
+ ? messageValue
144
+ : ctPlatformConstants.LOGIN_CONSTANTS.INVALID_OTP;
145
+ setOtpErrorMessage(toastMessage);
146
+ }, [inputRefs]);
147
+ var handleOtpComplete = react.useCallback(function (otp, autodetected) { return tslib.__awaiter(void 0, void 0, void 0, function () {
148
+ var eventProps, response, status_1, action, e_1;
149
+ return tslib.__generator(this, function (_a) {
150
+ switch (_a.label) {
151
+ case 0:
152
+ _a.trys.push([0, 2, , 3]);
153
+ eventProps = ctPlatformUtils.getRavenEventProps();
154
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'otp_entered', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', entry_type: !autodetected ? 'manual_entry' : 'autodetected', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
155
+ if (otp === lastOtpRequest.current &&
156
+ lastOtpRequestTimeStamp.current &&
157
+ lastOtpRequestTimeStamp.current - Date.now() <= 100) {
158
+ return [2];
159
+ }
160
+ lastOtpRequest.current = otp;
161
+ lastOtpRequestTimeStamp.current = Date.now();
162
+ return [4, ctPlatformUtils.validateOtp(mobileNumber, otp)];
163
+ case 1:
164
+ response = _a.sent();
165
+ status_1 = response.status, action = response.action;
166
+ if (Number(status_1) === 200 && !ctPlatformUtils.isEmpty(action)) {
167
+ setVerifiedOtp(true);
168
+ setOtpErrorMessage('');
169
+ ctPlatformUtils.updateNativeOnLogin();
170
+ if (action === 'SIGNUP') {
171
+ if (!skipProfileFlow) {
172
+ window.location.href =
173
+ ctPlatformConstants.NAVIGATION_ROUTES.PERSONAL_DETAILS +
174
+ '?onboardingFlow=true';
175
+ }
176
+ handleLoginSuccess(loginMethod, true);
177
+ }
178
+ else {
179
+ handleLoginSuccess(loginMethod);
180
+ }
181
+ }
182
+ else {
183
+ handleLoginFailure(loginMethod);
184
+ }
185
+ return [3, 3];
186
+ case 2:
187
+ e_1 = _a.sent();
188
+ handleLoginFailure(loginMethod);
189
+ handleOtpValidationError(e_1);
190
+ return [3, 3];
191
+ case 3: return [2];
192
+ }
193
+ });
194
+ }); }, [
195
+ lastOtpRequest,
196
+ lastOtpRequestTimeStamp,
197
+ setVerifiedOtp,
198
+ setAutoDetecting,
199
+ setOtpErrorMessage,
200
+ handleOtpValidationError,
201
+ ]);
202
+ var handleOnPaste = function () { return tslib.__awaiter(void 0, void 0, void 0, function () {
203
+ var clipboardData, pastedArr, pastedString;
204
+ var _a, _b;
205
+ return tslib.__generator(this, function (_c) {
206
+ switch (_c.label) {
207
+ case 0: return [4, navigator.clipboard.readText()];
208
+ case 1:
209
+ clipboardData = _c.sent();
210
+ if (clipboardData && ctPlatformUtils.isNumeric(clipboardData)) {
211
+ pastedArr = clipboardData
212
+ .slice(0, ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH)
213
+ .split('');
214
+ (_a = inputRefs.current[ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH - 1]) === null || _a === void 0 ? void 0 : _a.focus();
215
+ (_b = inputRefs.current[ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH - 1]) === null || _b === void 0 ? void 0 : _b.click();
216
+ pastedString = pastedArr.join('');
217
+ setOtp(pastedString);
218
+ if (pastedString.length === ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH) {
219
+ handleOtpComplete(pastedString, false);
220
+ }
221
+ }
222
+ return [2];
223
+ }
224
+ });
225
+ }); };
226
+ var handleInput = react.useCallback(function (event, index) {
227
+ var _a, _b;
228
+ setErrorCallout('');
229
+ var value = event.target.value;
230
+ if (value !== '' && index < inputRefs.current.length - 1) {
231
+ (_a = inputRefs.current[index + 1]) === null || _a === void 0 ? void 0 : _a.focus();
232
+ (_b = inputRefs.current[index + 1]) === null || _b === void 0 ? void 0 : _b.click();
233
+ }
234
+ var inputValues = inputRefs.current.map(function (ref) {
235
+ if (ctPlatformUtils.isHTMLInputElement(ref)) {
236
+ return ref.value;
237
+ }
238
+ return '';
239
+ });
240
+ var otpValue = inputValues.join('').slice(0, 4);
241
+ setOtp(otpValue);
242
+ if (otpValue.length === ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH) {
243
+ handleOtpComplete(otpValue, false);
244
+ }
245
+ }, [setOtp, handleOtpComplete]);
246
+ var handleKeyDown = react.useCallback(function (e, index) {
247
+ var _a, _b, _c;
248
+ if (e.key === 'Backspace' &&
249
+ index > 0 &&
250
+ ((_a = inputRefs.current[index]) === null || _a === void 0 ? void 0 : _a.value) === '') {
251
+ e.preventDefault();
252
+ (_b = inputRefs.current[index - 1]) === null || _b === void 0 ? void 0 : _b.focus();
253
+ (_c = inputRefs.current[index - 1]) === null || _c === void 0 ? void 0 : _c.click();
254
+ }
255
+ }, [inputRefs]);
256
+ var onResendOtpClick = react.useCallback(function () {
257
+ setCountdown(ctPlatformConstants.LOGIN_CONSTANTS.OTP_COUNTDOWN);
258
+ setCountdownEnabled(true);
259
+ getOTP(mobileNumber);
260
+ var eventProps = ctPlatformUtils.getRavenEventProps();
261
+ ctPlatformUtils.ravenSDKTrigger('u_login_error', tslib.__assign({ action_name: 'resend_otp_clicked', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
262
+ }, [setCountdown, setCountdownEnabled]);
263
+ var onEditCLick = react.useCallback(function () {
264
+ setCtaDisabled(true);
265
+ setShowMobilePage(true);
266
+ setMobileNumber('');
267
+ }, [setShowMobilePage]);
268
+ return (jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex flex-column bg-neutral-100', style: { height: otpInputHeight } }, { children: [errorCallout && (jsxRuntime.jsx(ctDesignAlertCallout.AlertCallout, { variant: 'error', textNode: errorCallout, prefixIconNode: jsxRuntime.jsx(ctDesignIcons.InfoIcon, { fill: 'red' }), style: {
269
+ color: '#ffff',
270
+ backgroundColor: '#db201e',
271
+ }, className: 'fs-12' })), jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex flex-bottom' }, { children: [jsxRuntime.jsxs(ctDesignTypography.Typography, tslib.__assign({ variant: 'HM1', color: 'heading' }, { children: [ctPlatformConstants.LOGIN_CONSTANTS.OTP_TEXT, " ", jsxRuntime.jsx("br", {}), mobileNumber] })), jsxRuntime.jsx("div", tslib.__assign({ className: 'pl-2', onClick: onEditCLick }, { children: jsxRuntime.jsx(ctDesignIcons.Edit, {}) }))] })), jsxRuntime.jsxs("div", tslib.__assign({ className: styles$1.otp_container }, { children: [jsxRuntime.jsx("div", tslib.__assign({ className: 'flex' }, { children: tslib.__spreadArray([], Array(ctPlatformConstants.LOGIN_CONSTANTS.OTP_LENGTH), true).map(function (_, i) { return (jsxRuntime.jsx("div", tslib.__assign({ className: styles$1.otp_box_wrapper }, { children: jsxRuntime.jsx(ctDesignField.FieldV2, { prompt: {
272
+ hasError: !!otpErrorMessage,
273
+ }, type: 'number', placeholder: '', value: otp[i], max: 1, inputMode: 'numeric', className: styles$1.login_otp_input, variant: 'md', ref: function (ref) {
274
+ if (ref) {
275
+ inputRefs.current[i] = ref;
276
+ }
277
+ }, onKeyDown: function (e) { return handleKeyDown(e, i); }, onChange: function (e) { return handleInput(e, i); }, onPaste: handleOnPaste, autoFocus: i === 0 }) }), i)); }) })), !!otpErrorMessage && (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', color: 'warning', className: styles$1.login_otp_error }, { children: otpErrorMessage })))] })), jsxRuntime.jsx(ctDesignSpacer.Spacer, { className: 'pt-2' }), autoDetecting === AutoDetectState.DETECTING &&
278
+ !verifiedOtp &&
279
+ enableAutoDetect &&
280
+ countdown >
281
+ ctPlatformConstants.LOGIN_CONSTANTS.RESEND_OTP_COUNTDOWN && (jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex flex-middle' }, { children: [jsxRuntime.jsx(ctDesignSpinner.Spinner, { width: '20px', height: '20px', borderColor: '#11a670', className: 'bg-neutral-900 bc-black' }), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3', className: 'fs-12 fw-500 ml-1 c-neutral-700' }, { children: ctPlatformConstants.LOGIN_CONSTANTS.AUTO_DETECTING_TEXT }))] }))), autoDetecting === AutoDetectState.DETECTING &&
282
+ countdown <= ctPlatformConstants.LOGIN_CONSTANTS.RESEND_OTP_COUNTDOWN &&
283
+ enableAutoDetect &&
284
+ !verifiedOtp && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex' }, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3', className: 'fs-12 fw-500 c-neutral-700 ' }, { children: ctPlatformConstants.LOGIN_CONSTANTS.OTP_RESEND_TEXT })), jsxRuntime.jsx(ctDesignSpacer.Spacer, { className: 'ml-1' }), otpResendDisabled ? (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ className: 'color-neutral-200 fw-500', variant: 'B3' }, { children: ctPlatformConstants.LOGIN_CONSTANTS.RESEND_CTA }))) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [countdown === 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ isClickable: true, variant: 'B3', onClick: onResendOtpClick, color: 'link', className: '\n fs-12 fw-500 c-pointer' }, { children: ctPlatformConstants.LOGIN_CONSTANTS.RESEND_CTA })) })), countdown > 0 && (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ color: 'disabled', variant: 'B3' }, { children: ' Resend (' + countdown + 's)' })))] }))] })) })), !otpErrorMessage && verifiedOtp && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex flex-middle' }, { children: [jsxRuntime.jsx(ctDesignIcons.CheckCircle, {}), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', color: 'success', className: 'fs-12' }, { children: autoDetecting === AutoDetectState.DETECTED
285
+ ? ctPlatformConstants.LOGIN_CONSTANTS.AUTO_DETECTED_TEXT
286
+ : ctPlatformConstants.LOGIN_CONSTANTS.VERIFIED_MESSAGE }))] })) })), jsxRuntime.jsx(ctDesignSpacer.Spacer, { className: 'mt-24' })] })));
287
+ };
288
+
289
+ var css_248z$1 = ".index-module_loader__63LeU{align-items:center;background-color:hsla(0,0%,100%,.95);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:0}.index-module_loader__63LeU.index-module_With-full-opacity__ZSY-U{background-color:#fff}.index-module_loader__content__Q6kJl{max-width:280px;text-align:center}.index-module_loader__spinner__6B3AR{animation:index-module_loader-rotate__efcf3 .8s linear infinite;border:2px solid rgba(51,102,204,.3);border-radius:50%;border-top-color:#36c;display:inline-block;height:30px;margin-bottom:10px;position:relative;width:30px}.index-module_loader__heading__7YZ3N{color:#000;font-size:18px;font-weight:600;margin-bottom:5px}.index-module_loader__text__1QcLi{color:rgba(0,0,0,.8);font-size:16px;line-height:1.5}";
290
+ var Styles = {"loader":"index-module_loader__63LeU","With-full-opacity":"index-module_With-full-opacity__ZSY-U","loader__content":"index-module_loader__content__Q6kJl","loader__spinner":"index-module_loader__spinner__6B3AR","loader-rotate":"index-module_loader-rotate__efcf3","loader__heading":"index-module_loader__heading__7YZ3N","loader__text":"index-module_loader__text__1QcLi"};
291
+ styleInject(css_248z$1);
292
+
293
+ var Loader = function (_a) {
294
+ var title = _a.title, message = _a.message, className = _a.className;
295
+ return (jsxRuntime.jsx("div", tslib.__assign({ className: "".concat(Styles['utilswrapper'], " utilswrapper") }, { children: jsxRuntime.jsx("div", tslib.__assign({ className: classNames__default.default(Styles['loader'], className) }, { children: jsxRuntime.jsxs("div", tslib.__assign({ className: Styles['loader__content'] }, { children: [jsxRuntime.jsx("div", { className: Styles['loader__spinner'] }), jsxRuntime.jsx("h5", tslib.__assign({ className: Styles['loader__heading'] }, { children: title })), jsxRuntime.jsx("p", tslib.__assign({ className: Styles['loader__text'] }, { children: message }))] })) })) })));
296
+ };
297
+
298
+ var MobileInput = function (_a) {
299
+ var sendingOtp = _a.sendingOtp, ctaDisabled = _a.ctaDisabled, getOTP = _a.getOTP, setErrorCallout = _a.setErrorCallout, errorCallout = _a.errorCallout, mobileNumber = _a.mobileNumber, setMobileInputHeight = _a.setMobileInputHeight, setMobileNumber = _a.setMobileNumber, fallbackUri = _a.fallbackUri, skipProfileFlow = _a.skipProfileFlow, currentPageUri = _a.currentPageUri, ravenPayload = _a.ravenPayload;
300
+ var fkSSOEnabled = react.useState(ctPlatformUtils.isFKSSOEnabled)[0];
301
+ var _b = react.useState(false), fkButtonLoading = _b[0], setFkButtonLoading = _b[1];
302
+ var inputRef = react.useRef(null);
303
+ var mobileViewRef = react.useRef(null);
304
+ react.useEffect(function () {
305
+ if (mobileViewRef.current) {
306
+ var height = mobileViewRef.current.clientHeight;
307
+ setMobileInputHeight(height);
308
+ }
309
+ }, [mobileViewRef.current]);
310
+ react.useEffect(function () {
311
+ var timeout;
312
+ if (inputRef.current) {
313
+ timeout = setTimeout(function () {
314
+ var _a;
315
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
316
+ }, 100);
317
+ }
318
+ return function () {
319
+ clearTimeout(timeout);
320
+ };
321
+ }, []);
322
+ react.useEffect(function () {
323
+ if (ctPlatformUtils.isAndroidApp()) {
324
+ autoDetectMobileNumber();
325
+ }
326
+ }, []);
327
+ var handleFKSSOClick = react.useCallback(function () { return tslib.__awaiter(void 0, void 0, void 0, function () {
328
+ var eventProps, redirectUrl;
329
+ return tslib.__generator(this, function (_a) {
330
+ switch (_a.label) {
331
+ case 0:
332
+ _a.trys.push([0, 2, , 3]);
333
+ eventProps = ctPlatformUtils.getRavenEventProps();
334
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'login_with_flipkart_clicked', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'fk_sso', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
335
+ setFkButtonLoading(true);
336
+ return [4, ctPlatformUtils.handleFKSSO(fallbackUri, skipProfileFlow
337
+ ? currentPageUri
338
+ : ctPlatformConstants.NAVIGATION_ROUTES.PERSONAL_DETAILS +
339
+ '?onboardingFlow=true', currentPageUri)];
340
+ case 1:
341
+ redirectUrl = _a.sent();
342
+ setFkButtonLoading(false);
343
+ if (ctPlatformUtils.isPwa()) {
344
+ window.location.href = redirectUrl;
345
+ }
346
+ return [3, 3];
347
+ case 2:
348
+ _a.sent();
349
+ setFkButtonLoading(false);
350
+ return [3, 3];
351
+ case 3: return [2];
352
+ }
353
+ });
354
+ }); }, []);
355
+ var handleInputChange = react.useCallback(function (event, autoDetected) {
356
+ if (autoDetected === void 0) { autoDetected = false; }
357
+ setErrorCallout('');
358
+ var value = event.target.value || '';
359
+ value = value.replace(ctPlatformUtils.MULTI_SPACE, ' ').trimStart();
360
+ setMobileNumber(value);
361
+ var validMobileNo = ctPlatformUtils.isValidMobileNumber(event.target.value);
362
+ if (validMobileNo) {
363
+ getOTP(value);
364
+ var eventProps = ctPlatformUtils.getRavenEventProps();
365
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'get_otp_clicked', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', entry_type: 'auto_click', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
366
+ if (!autoDetected) {
367
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'phone_number_entered', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', entry_type: 'manual_entry', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
368
+ }
369
+ else {
370
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'phone_number_autodetected', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', entry_type: 'autodetected', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
371
+ }
372
+ }
373
+ }, [setMobileNumber]);
374
+ var autoDetectMobileNumber = react.useCallback(function () { return tslib.__awaiter(void 0, void 0, void 0, function () {
375
+ var autoDetectedNumber, simulatedEvent;
376
+ return tslib.__generator(this, function (_a) {
377
+ switch (_a.label) {
378
+ case 0: return [4, ctPlatformUtils.showMobileNumberHint()];
379
+ case 1:
380
+ autoDetectedNumber = _a.sent();
381
+ simulatedEvent = {
382
+ target: {
383
+ value: autoDetectedNumber,
384
+ },
385
+ };
386
+ if (autoDetectedNumber) {
387
+ handleInputChange(simulatedEvent, true);
388
+ }
389
+ return [2];
390
+ }
391
+ });
392
+ }); }, [handleInputChange]);
393
+ var handlePrivacyPolicyClick = react.useCallback(function () {
394
+ var eventProps = ctPlatformUtils.getRavenEventProps();
395
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'policy_click', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
396
+ window.location.href = ctPlatformConstants.NAVIGATION_ROUTES.PRIVACY_POLICY;
397
+ }, []);
398
+ var handleTermsOfUseClick = react.useCallback(function () {
399
+ var eventProps = ctPlatformUtils.getRavenEventProps();
400
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'tnc_click', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
401
+ window.location.href = ctPlatformConstants.NAVIGATION_ROUTES.TERMS;
402
+ }, []);
403
+ return (jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex flex-column', ref: mobileViewRef }, { children: [errorCallout && (jsxRuntime.jsx(ctDesignAlertCallout.AlertCallout, { variant: 'error', textNode: errorCallout, prefixIconNode: jsxRuntime.jsx(ctDesignIcons.InfoIcon, { fill: 'red' }), style: {
404
+ color: '#ffff',
405
+ backgroundColor: '#db201e',
406
+ }, className: 'fs-12' })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'HM1', color: 'heading', className: 'mb-4 fs-24' }, { children: ctPlatformConstants.LOGIN_CONSTANTS.LOGIN_TO_CT })), jsxRuntime.jsx("label", tslib.__assign({ style: {
407
+ visibility: 'hidden',
408
+ width: '0.1px',
409
+ height: '0.1px',
410
+ }, htmlFor: 'phonenumber' }, { children: "Phone number" })), jsxRuntime.jsx(ctDesignField.PhoneField, { onChange: handleInputChange, value: mobileNumber, name: 'phonenumber', placeholder: '', inputMode: 'numeric', ref: inputRef, min: 0, max: 10, autoFocus: true, countryCode: ctPlatformConstants.LOGIN_CONSTANTS.COUNTRY_CODE }), jsxRuntime.jsx(ctDesignButton.Button, tslib.__assign({ color: 'primary', size: 'medium', minWidth: '160px', disabled: ctaDisabled, loading: sendingOtp, className: 'my-6', onClick: function () { return getOTP(mobileNumber); } }, { children: ctPlatformConstants.LOGIN_CONSTANTS.GET_OTP })), fkSSOEnabled && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", tslib.__assign({ className: 'my-6 p-relative' }, { children: [jsxRuntime.jsx(ctDesignDivider.Divider, {}), jsxRuntime.jsx("span", tslib.__assign({ className: "".concat(styles$1.mobileinput_seperatortext) }, { children: "or" }))] })), jsxRuntime.jsx(ctDesignButton.Button, tslib.__assign({ variant: 'outline', size: 'medium', className: 'my-6', loading: fkButtonLoading, onClick: handleFKSSOClick, showLeftIcon: !fkButtonLoading, LeftIcon: jsxRuntime.jsx("img", { src: ctPlatformAssets.FlipkartLogo }) }, { children: ctPlatformConstants.LOGIN_CONSTANTS.FK_LOGIN_CTA }))] })), jsxRuntime.jsxs("div", tslib.__assign({ className: 'pt-8 pb-6' }, { children: [jsxRuntime.jsx(ctDesignDivider.Divider, {}), jsxRuntime.jsxs("div", tslib.__assign({ className: 'flex flex-middle \n flex-center flex-wrap pt-2' }, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', className: styles$1.footer_text }, { children: ctPlatformConstants.LOGIN_CONSTANTS.FOOTER_TEXT })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', color: 'link', className: 'pl-1 fs-12', isClickable: true, onClick: handlePrivacyPolicyClick }, { children: ctPlatformConstants.LOGIN_CONSTANTS.PRIVACY_CTA })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ className: 'px-1 fs-12 c-neutral-700', variant: 'P1' }, { children: '& ' })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', color: 'link', isClickable: true, onClick: handleTermsOfUseClick, className: 'fs-12' }, { children: ctPlatformConstants.LOGIN_CONSTANTS.TNC_CTA }))] }))] }))] })));
411
+ };
412
+
413
+ const imagePlaceHolderURI =
414
+ // eslint-disable-next-line max-len
415
+ 'data:image/png;base64,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';
416
+ const ImageUrls = [{
417
+ src: 'https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel1.png',
418
+ placeholder: imagePlaceHolderURI
419
+ }, {
420
+ src: 'https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel2.png',
421
+ placeholder: imagePlaceHolderURI
422
+ }, {
423
+ src: 'https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel3.png',
424
+ placeholder: imagePlaceHolderURI
425
+ }];
426
+
427
+ var ImageWithPlaceholder = function (_a) {
428
+ var src = _a.src, placeholderSrc = _a.placeholderSrc, onLoad = _a.onLoad, props = tslib.__rest(_a, ["src", "placeholderSrc", "onLoad"]);
429
+ var _b = react.useState(placeholderSrc || src), imgSrc = _b[0], setImgSrc = _b[1];
430
+ var onLoadRef = react.useRef(onLoad);
431
+ react.useEffect(function () {
432
+ onLoadRef.current = onLoad;
433
+ }, [onLoad]);
434
+ react.useEffect(function () {
435
+ var img = new Image();
436
+ img.onload = function () {
437
+ setImgSrc(src);
438
+ if (onLoadRef.current) {
439
+ onLoadRef.current();
440
+ }
441
+ };
442
+ img.src = src;
443
+ }, [src]);
444
+ return jsxRuntime.jsx("img", tslib.__assign({ src: imgSrc }, props));
445
+ };
446
+
447
+ var css_248z = ".index-module_slides__container__9XVd4{align-items:center;box-sizing:border-box;display:flex;gap:1.5rem;height:197px;justify-content:center;width:100%}.index-module_slides__container--imageContainer__q0RuP{align-self:flex-start;margin-top:2rem;width:128px}";
448
+ var styles = {"slides__container":"index-module_slides__container__9XVd4","slides__container--imageContainer":"index-module_slides__container--imageContainer__q0RuP"};
449
+ styleInject(css_248z);
450
+
451
+ var Slide = function (_a) {
452
+ var textData = _a.textData, bgColor = _a.bgColor, imageUrl = _a.imageUrl, altText = _a.altText;
453
+ return (jsxRuntime.jsxs("div", tslib.__assign({ className: styles['slides__container'], style: {
454
+ backgroundColor: bgColor,
455
+ } }, { children: [jsxRuntime.jsx("div", tslib.__assign({ className: styles['slides__container--imageContainer'] }, { children: jsxRuntime.jsx(ImageWithPlaceholder, { width: 128, height: 128, alt: altText, src: imageUrl }) })), jsxRuntime.jsx("div", { children: textData === null || textData === void 0 ? void 0 : textData.map(function (item, index) {
456
+ return (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: ctDesignTypography.TypographyVariant.HM2, style: {
457
+ color: item.textColor,
458
+ lineHeight: '24px',
459
+ } }, { children: item.text }), index));
460
+ }) })] })));
461
+ };
462
+ var getSlides = function () {
463
+ return [
464
+ jsxRuntime.jsx(Slide, { bgColor: '#4F8EF0', imageUrl: 'https://fastui.cltpstatic.com/image/upload/f_auto,q_auto,w_128,h_128,dpr_2/offermgmt/images/banner/Login%20Frame.png', altText: 'Dhonicampaign_icon', textData: [
465
+ {
466
+ text: 'Use code CTMAHI',
467
+ textColor: '#fff',
468
+ },
469
+ {
470
+ text: '& get flat 777 off,',
471
+ textColor: '#fff',
472
+ },
473
+ {
474
+ text: 'on your first',
475
+ textColor: '#032529',
476
+ },
477
+ {
478
+ text: 'flight booking',
479
+ textColor: '#032529',
480
+ },
481
+ ] }, 1),
482
+ jsxRuntime.jsx(Slide, { bgColor: '#FF8D71', imageUrl: 'https://fastui.cltpstatic.com/image/upload/f_auto,w_128,h_128,dpr_2/offermgmt/images/loginSheetMyntra.webp', altText: 'loyality_benefits_icon', textData: [
483
+ {
484
+ text: 'Loyalty benefits',
485
+ textColor: '#fff',
486
+ },
487
+ {
488
+ text: 'and discounts',
489
+ textColor: '#fff',
490
+ },
491
+ {
492
+ text: 'for Flipkart and',
493
+ textColor: '#331005',
494
+ },
495
+ {
496
+ text: 'Myntra members',
497
+ textColor: '#331005',
498
+ },
499
+ ] }, 2),
500
+ jsxRuntime.jsx(Slide, { bgColor: '#FFC142', imageUrl: 'https://fastui.cltpstatic.com/image/upload/f_auto,w_128,h_128,dpr_2/offermgmt/images/loginSheetCoupon.webp', altText: 'CTLogin_icon', textData: [
501
+ {
502
+ text: 'Flat 25% off',
503
+ textColor: '#fff',
504
+ },
505
+ {
506
+ text: 'on your first',
507
+ textColor: '#fff',
508
+ },
509
+ {
510
+ text: 'hotel booking',
511
+ textColor: '#fff',
512
+ },
513
+ {
514
+ text: 'Code: CTMAHI',
515
+ textColor: '#332504',
516
+ },
517
+ ] }, 3),
518
+ jsxRuntime.jsx(Slide, { bgColor: '#61C149', imageUrl: 'https://fastui.cltpstatic.com/image/upload/f_auto,w_128,h_128,dpr_2/offermgmt/images/loginSheetWallet.webp', altText: 'EarnAndRedeem_icon', textData: [
519
+ {
520
+ text: 'Earn and',
521
+ textColor: '#fff',
522
+ },
523
+ {
524
+ text: 'redeem up to',
525
+ textColor: '#fff',
526
+ },
527
+ {
528
+ text: '650 Flipkart',
529
+ textColor: '#13270F',
530
+ },
531
+ {
532
+ text: 'Supercoins',
533
+ textColor: '#13270F',
534
+ },
535
+ ] }, 4),
536
+ ];
537
+ };
538
+
539
+ SwiperCore__default.default.use([SwiperCore.Autoplay, SwiperCore.Navigation, SwiperCore.Pagination]);
540
+ var CarouselWrapper = function (_a) {
541
+ var customSlides = _a.customSlides, carouselImages = _a.carouselImages;
542
+ var imageUrls = react.useMemo(function () {
543
+ if (!ctPlatformUtils.isEmpty(carouselImages))
544
+ return carouselImages;
545
+ return ImageUrls;
546
+ }, [carouselImages]);
547
+ return (jsxRuntime.jsx("div", tslib.__assign({ className: " o-hidden p-relative ".concat(styles$1.slider_carousel_wrapper) }, { children: jsxRuntime.jsx(react$1.Swiper, tslib.__assign({ autoplay: true, slidesPerView: 1, navigation: false, loop: true, pagination: { clickable: true }, className: "".concat(styles$1['swiper'], " ").concat(styles$1['swiper-custom-pagination']), lazy: {
548
+ loadPrevNextAmount: 1,
549
+ } }, { children: carouselImages && carouselImages.length > 0
550
+ ? imageUrls === null || imageUrls === void 0 ? void 0 : imageUrls.map(function (item, index) {
551
+ return (jsxRuntime.jsx(react$1.SwiperSlide, tslib.__assign({ className: styles$1['swiper-slide'] }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: index < 1 ? (jsxRuntime.jsx(ImageWithPlaceholder, { src: item.src, placeholderSrc: item.placeholder, alt: "Slide ".concat(index + 1), rel: 'preload', fetchPriority: 'high' })) : (jsxRuntime.jsx(ImageWithPlaceholder, { src: item.src, placeholderSrc: item.placeholder, alt: "Slide ".concat(index + 1), loading: 'lazy', className: 'lazy' })) }) }), index));
552
+ })
553
+ : customSlides && customSlides.length > 0
554
+ ? customSlides === null || customSlides === void 0 ? void 0 : customSlides.map(function (item, index) {
555
+ return (jsxRuntime.jsx(react$1.SwiperSlide, tslib.__assign({ className: styles$1['swiper-slide'] }, { children: item }), index));
556
+ })
557
+ : getSlides().length &&
558
+ getSlides().map(function (item, index) {
559
+ return (jsxRuntime.jsx(react$1.SwiperSlide, tslib.__assign({ className: styles$1['swiper-slide'] }, { children: item }), index));
560
+ }) })) })));
561
+ };
562
+
563
+ var LoginModule = function (_a) {
564
+ var fallbackUri = _a.fallbackUri, isDrawerOpen = _a.isDrawerOpen, skipProfileFlow = _a.skipProfileFlow, _b = _a.showCarousel, showCarousel = _b === void 0 ? true : _b, _c = _a.ravenPayload, ravenPayload = _c === void 0 ? {} : _c, handleLoginClose = _a.handleLoginClose, onAuthSuccess = _a.onAuthSuccess, onAuthFailure = _a.onAuthFailure, customSlides = _a.customSlides, _d = _a.carouselImages, carouselImages = _d === void 0 ? [] : _d, _e = _a.closeOnOutsideClick, closeOnOutsideClick = _e === void 0 ? false : _e, _f = _a.sendUserInsights, sendUserInsights = _f === void 0 ? true : _f;
565
+ var _g = react.useState(true), showMobilePage = _g[0], setShowMobilePage = _g[1];
566
+ var _h = react.useState(true), ctaDisabled = _h[0], setCtaDisabled = _h[1];
567
+ var _j = react.useState(false), sendingOtp = _j[0], setSendingOtp = _j[1];
568
+ var _k = react.useState(isDrawerOpen), showLoginForm = _k[0], setShowLoginForm = _k[1];
569
+ var _l = react.useState(''), mobileNumber = _l[0], setMobileNumber = _l[1];
570
+ var _m = react.useState(0), mobileInputHeight = _m[0], setMobileInputHeight = _m[1];
571
+ var _o = react.useState(false), otpResendDisabled = _o[0], setOtpResendDisabled = _o[1];
572
+ var _p = react.useState(''), errorCallout = _p[0], setErrorCallout = _p[1];
573
+ var _q = react.useState(false), showSuccess = _q[0], setShowSuccess = _q[1];
574
+ var _r = react.useState(false), showSigninLoader = _r[0], setShowSigninLoader = _r[1];
575
+ var currentPageUri = react.useState(function () { return ctPlatformUtils.getCurrentPathName(); })[0];
576
+ var showSigninLoaderScreen = function () {
577
+ setShowSigninLoader(true);
578
+ };
579
+ react.useEffect(function () {
580
+ if (window) {
581
+ window['showSigninLoaderScreen'] = showSigninLoaderScreen;
582
+ }
583
+ var queryValue = ctPlatformUtils.getQueryParam('fkSSOstatus');
584
+ var loginMethod = 'FK';
585
+ if (queryValue === 'signin') {
586
+ if (ctPlatformUtils.isAndroidApp()) {
587
+ ctPlatformUtils.updateNativeAndroidOnSignIn();
588
+ }
589
+ handleLoginSuccess(loginMethod);
590
+ }
591
+ if (queryValue === 'signup') {
592
+ if (ctPlatformUtils.isAndroidApp()) {
593
+ ctPlatformUtils.updateNativeAndroidOnSignIn();
594
+ }
595
+ handleLoginSuccess(loginMethod, true);
596
+ }
597
+ if (queryValue === 'failure') {
598
+ handleLoginFailure(loginMethod);
599
+ }
600
+ }, []);
601
+ var getOTP = react.useCallback(function (mobileNumber) { return tslib.__awaiter(void 0, void 0, void 0, function () {
602
+ var res, status_1, err_1, message, errorMessage;
603
+ return tslib.__generator(this, function (_a) {
604
+ switch (_a.label) {
605
+ case 0:
606
+ _a.trys.push([0, 2, , 3]);
607
+ setCtaDisabled(false);
608
+ setSendingOtp(true);
609
+ ctPlatformUtils.triggerOTPListener();
610
+ return [4, ctPlatformUtils.sendLoginOtp(mobileNumber)];
611
+ case 1:
612
+ res = _a.sent();
613
+ status_1 = (res || {}).status;
614
+ if (status_1 === 'SUCCESS') {
615
+ setShowMobilePage(false);
616
+ setSendingOtp(false);
617
+ }
618
+ return [3, 3];
619
+ case 2:
620
+ err_1 = _a.sent();
621
+ console.error(err_1);
622
+ message = (err_1 || {}).message;
623
+ setSendingOtp(false);
624
+ errorMessage = message && ctPlatformConstants.LOGIN_CONSTANTS[message];
625
+ if (errorMessage) {
626
+ setErrorCallout(String(errorMessage));
627
+ }
628
+ else {
629
+ setErrorCallout(String(ctPlatformConstants.LOGIN_CONSTANTS.GENERIC_ERROR_MESSAGE));
630
+ }
631
+ if (message === 'OTP_SEND_LIMIT_EXCEEDED') {
632
+ setOtpResendDisabled(true);
633
+ }
634
+ return [3, 3];
635
+ case 3: return [2];
636
+ }
637
+ });
638
+ }); }, [showMobilePage, setShowMobilePage]);
639
+ var handleLoginSuccess = react.useCallback(function (loginMethod, action) {
640
+ var eventProps = ctPlatformUtils.getRavenEventProps();
641
+ var payload = tslib.__assign({ action_name: 'login_successful', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', login_new: action ? 'sign_up' : 'sign_in', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload);
642
+ if (sendUserInsights) {
643
+ ctPlatformUtils.sendEventWithUserInsights('u_login_success', payload);
644
+ }
645
+ else {
646
+ ctPlatformUtils.ravenSDKTrigger('u_login_success', payload);
647
+ }
648
+ onAuthSuccess(loginMethod, action);
649
+ if (action && !skipProfileFlow) ;
650
+ else {
651
+ handleDrawerClose();
652
+ setShowSuccess(true);
653
+ }
654
+ }, [sendUserInsights]);
655
+ var handleLoginFailure = react.useCallback(function (loginMethod) {
656
+ onAuthFailure(loginMethod);
657
+ }, []);
658
+ var handleDrawerClose = function (evt) {
659
+ evt === null || evt === void 0 ? void 0 : evt.stopPropagation();
660
+ setShowLoginForm(false);
661
+ setMobileNumber('');
662
+ setCtaDisabled(true);
663
+ var eventProps = ctPlatformUtils.getRavenEventProps();
664
+ ctPlatformUtils.ravenSDKTrigger('u_login_click', tslib.__assign({ action_name: 'login_prompt_dismissed', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
665
+ if (handleLoginClose && typeof handleLoginClose === 'function') {
666
+ handleLoginClose();
667
+ }
668
+ };
669
+ react.useEffect(function () {
670
+ if (isDrawerOpen) {
671
+ setShowMobilePage(true);
672
+ setShowLoginForm(true);
673
+ var eventProps = ctPlatformUtils.getRavenEventProps();
674
+ ctPlatformUtils.ravenSDKTrigger('u_login_popup', tslib.__assign({ action_name: 'login_prompt_opened', login_form: eventProps === null || eventProps === void 0 ? void 0 : eventProps.loginForm, login_type: 'native', vertical: eventProps === null || eventProps === void 0 ? void 0 : eventProps.vertical, page_name: eventProps === null || eventProps === void 0 ? void 0 : eventProps.pageName }, ravenPayload));
675
+ }
676
+ else {
677
+ setShowLoginForm(false);
678
+ }
679
+ }, [isDrawerOpen]);
680
+ return (jsxRuntime.jsx(ctDesignTheme.ThemeProvider, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ctPlatformDrawer.Drawer, tslib.__assign({ direction: 'bottom', isOpen: showLoginForm, showClose: true, overlay: true, handleClose: handleDrawerClose, onClose: function () { }, closeOnOutsideClick: closeOnOutsideClick }, { children: jsxRuntime.jsx("div", tslib.__assign({ className: "".concat(styles$1['utilswrapper'], " utilswrapper") }, { children: jsxRuntime.jsxs("div", tslib.__assign({ style: {
681
+ maxHeight: 'calc(100dvh - 60px)',
682
+ overflowY: 'auto',
683
+ borderRadius: '16px 16px 0 0',
684
+ } }, { children: [showCarousel && (jsxRuntime.jsx(CarouselWrapper, { customSlides: customSlides, carouselImages: carouselImages })), jsxRuntime.jsxs("div", tslib.__assign({ className: styles$1['login_form'] }, { children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(ctDesignSpacer.Spacer, { className: 'pt-6' }) }), showMobilePage ? (jsxRuntime.jsx(MobileInput, { device: 'PWA', ctaDisabled: ctaDisabled, sendingOtp: sendingOtp, getOTP: getOTP, mobileNumber: mobileNumber, setMobileNumber: setMobileNumber, setMobileInputHeight: setMobileInputHeight, fallbackUri: fallbackUri, skipProfileFlow: skipProfileFlow, currentPageUri: currentPageUri, setErrorCallout: setErrorCallout, errorCallout: errorCallout, ravenPayload: ravenPayload })) : (jsxRuntime.jsx(OtpInput, { mobileNumber: mobileNumber, getOTP: getOTP, setCtaDisabled: setCtaDisabled, setShowMobilePage: setShowMobilePage, handleLoginSuccess: handleLoginSuccess, handleLoginFailure: handleLoginFailure, otpInputHeight: mobileInputHeight, setMobileNumber: setMobileNumber, setErrorCallout: setErrorCallout, errorCallout: errorCallout, otpResendDisabled: otpResendDisabled, ravenPayload: ravenPayload, skipProfileFlow: skipProfileFlow }))] }))] })) })) })), showSuccess && (jsxRuntime.jsx(ctDesignToast.Toast, { text: 'Logged in successfully!', show: showSuccess, className: "".concat(styles$1.nonUtilsSelector_toast), closeTimeout: 2000 })), showSigninLoader && (jsxRuntime.jsx(Loader, { title: 'Please wait', message: 'Signing in...', className: 'z-10 bg-white' }))] }) }));
685
+ };
686
+
687
+ exports.LoginModule = LoginModule;
2
688
  //# sourceMappingURL=ct-platform-login-module.cjs.js.map