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

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,688 +1,2 @@
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;
1
+ "use strict";var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),n=require("@cleartrip/ct-design-toast"),a=require("@cleartrip/ct-design-spacer"),o=require("@cleartrip/ct-platform-drawer"),r=require("@cleartrip/ct-design-theme"),l=require("@cleartrip/ct-platform-constants"),s=require("@cleartrip/ct-platform-utils"),c=require("@cleartrip/ct-design-field"),d=require("@cleartrip/ct-design-spinner"),_=require("@cleartrip/ct-design-typography"),u=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,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===i&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}var E={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%}");var S="index-module_loader__container__VX-VO",b="index-module_three-dots-loader__i7R-R";T('.index-module_loader__container__VX-VO{align-items:center;background:#fff;border-radius:32px;box-shadow:0 8px 24px 0 rgba(26,26,26,.1);display:flex;height:34px;justify-content:center;left:50%;padding:12px;position:absolute;top:50%;transform:translate(-50%,-50%);width:66px}.index-module_loader__container__VX-VO .index-module_three-dots-loader__i7R-R{animation:index-module_three-dots-loader__i7R-R 1s linear infinite alternate;animation-delay:.5s;background-color:#1a1a1a;border-radius:5px;height:8px;position:relative;width:8px}.index-module_loader__container__VX-VO .index-module_three-dots-loader__i7R-R:after,.index-module_loader__container__VX-VO .index-module_three-dots-loader__i7R-R:before{content:"";display:inline-block;position:absolute;top:0}.index-module_loader__container__VX-VO .index-module_three-dots-loader__i7R-R:before{animation:index-module_three-dots-loader__i7R-R 1s infinite alternate;animation-delay:0s;background-color:#1a1a1a;border-radius:5px;height:8px;left:-15px;width:8px}.index-module_loader__container__VX-VO .index-module_three-dots-loader__i7R-R:after{animation:index-module_three-dots-loader__i7R-R 1s infinite alternate;animation-delay:1s;background-color:#1a1a1a;border-radius:5px;height:8px;left:15px;width:8px}@keyframes index-module_three-dots-loader__i7R-R{0%{background-color:#1a1a1a}50%,to{background-color:grey}}');var O,y=function(){return t.jsx("div",e.__assign({className:S},{children:t.jsx("div",{className:b})}))};!function(e){e[e.DETECTING=0]="DETECTING",e[e.FAILED=1]="FAILED",e[e.DETECTED=2]="DETECTED"}(O||(O={}));var w=function(n){var o=n.mobileNumber,r=n.errorCallout,p=n.ravenPayload,m=n.otpInputHeight,f=n.skipProfileFlow,x=n.otpResendDisabled,v=n.hotelsLoyaltyFlow,h=n.getOTP,N=n.setCtaDisabled,A=n.setErrorCallout,C=n.setMobileNumber,T=n.setShowMobilePage,S=n.handleLoginSuccess,b=n.handleLoginFailure,w=i.useRef(Array(4).fill(null)),I=i.useState(O.DETECTING),j=I[0],D=I[1],P=i.useState(l.LOGIN_CONSTANTS.OTP_COUNTDOWN),k=P[0],R=P[1],F=i.useState(""),G=F[0],L=F[1],B=i.useState(!0),Q=B[0],U=B[1],q=i.useState(!1),X=q[0],M=q[1],V=i.useState(""),z=V[0],K=V[1],J=i.useState(!0),W=J[0],Z=J[1],H=i.useState(!1),Y=H[0],$=H[1],ee=i.useRef(),te=i.useRef(),ie="CT";i.useEffect((function(){ne();var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"login_otp_screen_opened",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))}),[]),i.useEffect((function(){s.isIOSApp()&&Z(!1)}),[]),i.useEffect((function(){ne()}),[]),i.useEffect((function(){Y||(w.current[0].focus(),w.current[0].click())}),[Y]),i.useEffect((function(){0===k&&U(!1)}),[k]),i.useEffect((function(){var e;return Q&&k>0&&(e=setInterval((function(){R((function(e){return e-1}))}),1e3)),function(){clearInterval(e)}}),[Q,k]);var ne=i.useCallback((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,s.autoReadOtp()];case 1:return t=e.sent(),L(t),D(O.DETECTED),(null==t?void 0:t.length)===l.LOGIN_CONSTANTS.OTP_LENGTH&&oe&&oe(t,!0),[3,3];case 2:return"NOT_SUPPORTED"===e.sent()&&Z(!1),[3,3];case 3:return[2]}}))}))}),[W]),ae=i.useCallback((function(t){var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_error",e.__assign({action_name:"otp_incorrect",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));var n=null==t?void 0:t.message;"OTP_VALIDATE_LIMIT_EXCEEDED"!==n&&L(""),w.current[0].focus(),w.current[0].click();var a=l.LOGIN_CONSTANTS[n],o="string"==typeof a?a:l.LOGIN_CONSTANTS.INVALID_OTP;K(o)}),[w]),oe=i.useCallback((function(t,i){return e.__awaiter(void 0,void 0,void 0,(function(){var n,a,r,c,d;return e.__generator(this,(function(_){switch(_.label){case 0:return _.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:i?"autodetected":"manual_entry",vertical:null==n?void 0:n.vertical,page_name:null==n?void 0:n.pageName},p)),t===ee.current&&te.current&&te.current-Date.now()<=100?[2]:(ee.current=t,te.current=Date.now(),v&&$(!0),[4,s.validateOtp(o,t)]);case 1:return a=_.sent(),r=a.status,c=a.action,200!==Number(r)||s.isEmpty(c)?(v&&$(!1),b(ie)):(M(!0),K(""),s.updateNativeOnLogin(),"SIGNUP"===c?(f||(window.location.href=l.NAVIGATION_ROUTES.PERSONAL_DETAILS+"?onboardingFlow=true"),S(ie,!0)):S(ie)),[3,3];case 2:return d=_.sent(),v&&$(!1),b(ie),ae(d),[3,3];case 3:return[2]}}))}))}),[ee,te,M,D,K,ae]),re=function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,i,n,a,o;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.readText()];case 1:return(t=e.sent())&&s.isNumeric(t)&&(i=t.slice(0,l.LOGIN_CONSTANTS.OTP_LENGTH).split(""),null===(a=w.current[l.LOGIN_CONSTANTS.OTP_LENGTH-1])||void 0===a||a.focus(),null===(o=w.current[l.LOGIN_CONSTANTS.OTP_LENGTH-1])||void 0===o||o.click(),n=i.join(""),L(n),n.length===l.LOGIN_CONSTANTS.OTP_LENGTH&&oe(n,!1)),[2]}}))}))},le=i.useCallback((function(e,t){var i,n;A(""),""!==e.target.value&&t<w.current.length-1&&(null===(i=w.current[t+1])||void 0===i||i.focus(),null===(n=w.current[t+1])||void 0===n||n.click());var a=w.current.map((function(e){return s.isHTMLInputElement(e)?e.value:""})).join("").slice(0,4);L(a),a.length===l.LOGIN_CONSTANTS.OTP_LENGTH&&oe(a,!1)}),[L,oe]),se=i.useCallback((function(e,t){var i,n,a;"Backspace"===e.key&&t>0&&""===(null===(i=w.current[t])||void 0===i?void 0:i.value)&&(e.preventDefault(),null===(n=w.current[t-1])||void 0===n||n.focus(),null===(a=w.current[t-1])||void 0===a||a.click())}),[w]),ce=i.useCallback((function(){R(l.LOGIN_CONSTANTS.OTP_COUNTDOWN),U(!0),h(o);var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_error",e.__assign({action_name:"resend_otp_clicked",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))}),[R,U]),de=i.useCallback((function(){N(!0),T(!0),C("")}),[T]);return t.jsxs("div",e.__assign({className:"flex flex-column bg-neutral-100",style:{height:m}},{children:[r&&t.jsx(u.AlertCallout,{variant:"error",textNode:r,prefixIconNode:t.jsx(g.InfoIcon,{fill:"red"}),style:{color:"#ffff",backgroundColor:"#db201e"},className:"fs-12"}),t.jsxs("div",e.__assign({className:"flex flex-bottom"},{children:[t.jsxs(_.Typography,e.__assign({variant:"HM1",color:"heading"},{children:[l.LOGIN_CONSTANTS.OTP_TEXT," ",t.jsx("br",{}),o]})),t.jsx("div",e.__assign({className:"pl-2",onClick:de},{children:t.jsx(g.Edit,{})}))]})),t.jsxs("div",e.__assign({className:E.otp_container},{children:[t.jsxs("div",e.__assign({className:"flex",style:v?{width:"max-content",position:"relative"}:{}},{children:[e.__spreadArray([],Array(l.LOGIN_CONSTANTS.OTP_LENGTH),!0).map((function(i,n){return t.jsx("div",e.__assign({className:E.otp_box_wrapper},{children:t.jsx(c.FieldV2,{prompt:{hasError:!!z},type:"number",placeholder:"",value:G[n],max:1,inputMode:"numeric",className:E.login_otp_input,variant:"md",ref:function(e){e&&(w.current[n]=e)},onKeyDown:function(e){return se(e,n)},onChange:function(e){return le(e,n)},onPaste:re,autoFocus:0===n,disabled:!(!v||!Y)})}),n)})),v&&Y&&t.jsx(y,{})]})),!!z&&t.jsx(_.Typography,e.__assign({variant:"P1",color:"warning",className:E.login_otp_error},{children:z}))]})),t.jsx(a.Spacer,{className:"pt-2"}),j===O.DETECTING&&!X&&W&&k>l.LOGIN_CONSTANTS.RESEND_OTP_COUNTDOWN&&t.jsxs("div",e.__assign({className:"flex flex-middle"},{children:[t.jsx(d.Spinner,{width:"20px",height:"20px",borderColor:"#11a670",className:"bg-neutral-900 bc-black"}),t.jsx(_.Typography,e.__assign({variant:"B3",className:"fs-12 fw-500 ml-1 c-neutral-700"},{children:l.LOGIN_CONSTANTS.AUTO_DETECTING_TEXT}))]})),j===O.DETECTING&&k<=l.LOGIN_CONSTANTS.RESEND_OTP_COUNTDOWN&&W&&!X&&t.jsx(t.Fragment,{children:t.jsxs("div",e.__assign({className:"flex"},{children:[t.jsx(_.Typography,e.__assign({variant:"B3",className:"fs-12 fw-500 c-neutral-700 "},{children:l.LOGIN_CONSTANTS.OTP_RESEND_TEXT})),t.jsx(a.Spacer,{className:"ml-1"}),x?t.jsx(_.Typography,e.__assign({className:"color-neutral-200 fw-500",variant:"B3"},{children:l.LOGIN_CONSTANTS.RESEND_CTA})):t.jsxs(t.Fragment,{children:[0===k&&t.jsx(t.Fragment,{children:t.jsx(_.Typography,e.__assign({isClickable:!0,variant:"B3",onClick:ce,color:"link",className:"\n fs-12 fw-500 c-pointer"},{children:l.LOGIN_CONSTANTS.RESEND_CTA}))}),k>0&&t.jsx(_.Typography,e.__assign({color:"disabled",variant:"B3"},{children:" Resend ("+k+"s)"}))]})]}))}),!z&&X&&t.jsx(t.Fragment,{children:t.jsxs("div",e.__assign({className:"flex flex-middle"},{children:[t.jsx(g.CheckCircle,{}),t.jsx(_.Typography,e.__assign({variant:"P1",color:"success",className:"fs-12"},{children:j===O.DETECTED?l.LOGIN_CONSTANTS.AUTO_DETECTED_TEXT:l.LOGIN_CONSTANTS.VERIFIED_MESSAGE}))]}))}),t.jsx(a.Spacer,{className:"mt-24"})]}))},I={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 j=function(i){var n=i.title,a=i.message,o=i.className;return t.jsx("div",e.__assign({className:"".concat(I.utilswrapper," utilswrapper")},{children:t.jsx("div",e.__assign({className:A.default(I.loader,o)},{children:t.jsxs("div",e.__assign({className:I.loader__content},{children:[t.jsx("div",{className:I.loader__spinner}),t.jsx("h5",e.__assign({className:I.loader__heading},{children:n})),t.jsx("p",e.__assign({className:I.loader__text},{children:a}))]}))}))}))},D=function(n){var a=n.sendingOtp,o=n.ctaDisabled,r=n.getOTP,d=n.setErrorCallout,p=n.errorCallout,v=n.mobileNumber,h=n.setMobileInputHeight,N=n.setMobileNumber,A=n.fallbackUri,C=n.skipProfileFlow,T=n.currentPageUri,S=n.ravenPayload,b=n.hotelsLoyaltyFlow,O=i.useState(s.isFKSSOEnabled)[0],y=i.useState(!1),w=y[0],I=y[1],j=i.useRef(null),D=i.useRef(null);i.useEffect((function(){if(D.current){var e=D.current.clientHeight;h(e)}}),[D.current]),i.useEffect((function(){var e;return j.current&&(e=setTimeout((function(){var e;null===(e=j.current)||void 0===e||e.focus()}),100)),function(){clearTimeout(e)}}),[]),i.useEffect((function(){s.isAndroidApp()&&R()}),[]);var P=i.useCallback((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,i;return e.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=s.getRavenEventProps(),s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"login_with_flipkart_clicked",login_form:null==t?void 0:t.loginForm,login_type:"fk_sso",vertical:null==t?void 0:t.vertical,page_name:null==t?void 0:t.pageName},S)),I(!0),[4,s.handleFKSSO(A,C?T:l.NAVIGATION_ROUTES.PERSONAL_DETAILS+"?onboardingFlow=true",T)];case 1:return i=n.sent(),b||I(!1),s.isPwa()&&(window.location.href=i),[3,3];case 2:return n.sent(),I(!1),[3,3];case 3:return[2]}}))}))}),[]),k=i.useCallback((function(t,i){void 0===i&&(i=!1),d("");var n=t.target.value||"";if(n=n.replace(s.MULTI_SPACE," ").trimStart(),N(n),s.isValidMobileNumber(t.target.value)){r(n);var a=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"get_otp_clicked",login_form:null==a?void 0:a.loginForm,login_type:"native",entry_type:"auto_click",vertical:null==a?void 0:a.vertical,page_name:null==a?void 0:a.pageName},S)),i?s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"phone_number_autodetected",login_form:null==a?void 0:a.loginForm,login_type:"native",entry_type:"autodetected",vertical:null==a?void 0:a.vertical,page_name:null==a?void 0:a.pageName},S)):s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"phone_number_entered",login_form:null==a?void 0:a.loginForm,login_type:"native",entry_type:"manual_entry",vertical:null==a?void 0:a.vertical,page_name:null==a?void 0:a.pageName},S))}}),[N]),R=i.useCallback((function(){return e.__awaiter(void 0,void 0,void 0,(function(){var t,i;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,s.showMobileNumberHint()];case 1:return t=e.sent(),i={target:{value:t}},t&&k(i,!0),[2]}}))}))}),[k]),F=i.useCallback((function(){var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"policy_click",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},S)),window.location.href=l.NAVIGATION_ROUTES.PRIVACY_POLICY}),[]),G=i.useCallback((function(){var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"tnc_click",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},S)),window.location.href=l.NAVIGATION_ROUTES.TERMS}),[]);return t.jsxs("div",e.__assign({className:"flex flex-column",ref:D},{children:[p&&t.jsx(u.AlertCallout,{variant:"error",textNode:p,prefixIconNode:t.jsx(g.InfoIcon,{fill:"red"}),style:{color:"#ffff",backgroundColor:"#db201e"},className:"fs-12"}),t.jsx(_.Typography,e.__assign({variant:"HM1",color:"heading",className:"mb-4 fs-24"},{children:l.LOGIN_CONSTANTS.LOGIN_TO_CT})),t.jsx("label",e.__assign({style:{visibility:"hidden",width:"0.1px",height:"0.1px"},htmlFor:"phonenumber"},{children:"Phone number"})),t.jsx(c.PhoneField,{onChange:k,value:v,name:"phonenumber",placeholder:"",inputMode:"numeric",ref:j,min:0,max:10,autoFocus:!0,countryCode:l.LOGIN_CONSTANTS.COUNTRY_CODE}),t.jsx(m.Button,e.__assign({color:"primary",size:"medium",minWidth:"160px",disabled:o,loading:a,className:"my-6",onClick:function(){return r(v)}},{children:l.LOGIN_CONSTANTS.GET_OTP})),O&&t.jsxs(t.Fragment,{children:[t.jsxs("div",e.__assign({className:"my-6 p-relative"},{children:[t.jsx(f.Divider,{}),t.jsx("span",e.__assign({className:"".concat(E.mobileinput_seperatortext)},{children:"or"}))]})),t.jsx(m.Button,e.__assign({variant:"outline",size:"medium",className:"my-6",loading:w,onClick:P,showLeftIcon:!w,LeftIcon:t.jsx("img",{src:x.FlipkartLogo})},{children:l.LOGIN_CONSTANTS.FK_LOGIN_CTA}))]}),t.jsxs("div",e.__assign({className:"pt-8 pb-6"},{children:[t.jsx(f.Divider,{}),t.jsxs("div",e.__assign({className:"flex flex-middle \n flex-center flex-wrap pt-2"},{children:[t.jsx(_.Typography,e.__assign({variant:"P1",className:E.footer_text},{children:l.LOGIN_CONSTANTS.FOOTER_TEXT})),t.jsx(_.Typography,e.__assign({variant:"P1",color:"link",className:"pl-1 fs-12",isClickable:!0,onClick:F},{children:l.LOGIN_CONSTANTS.PRIVACY_CTA})),t.jsx(_.Typography,e.__assign({className:"px-1 fs-12 c-neutral-700",variant:"P1"},{children:"& "})),t.jsx(_.Typography,e.__assign({variant:"P1",color:"link",isClickable:!0,onClick:G,className:"fs-12"},{children:l.LOGIN_CONSTANTS.TNC_CTA}))]}))]}))]}))};const P="data:image/png;base64,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",k=[{src:"https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel1.png",placeholder:P},{src:"https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel2.png",placeholder:P},{src:"https://fastui.cltpstatic.com/image/upload/offermgmt/images/carousel3.png",placeholder:P}];var R=function(n){var a=n.src,o=n.placeholderSrc,r=n.onLoad,l=e.__rest(n,["src","placeholderSrc","onLoad"]),s=i.useState(o||a),c=s[0],d=s[1],_=i.useRef(r);return i.useEffect((function(){_.current=r}),[r]),i.useEffect((function(){var e=new Image;e.onload=function(){d(a),_.current&&_.current()},e.src=a}),[a]),t.jsx("img",e.__assign({src:c},l))},F="index-module_slides__container__9XVd4",G="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 L=function(i){var n=i.textData,a=i.bgColor,o=i.imageUrl,r=i.altText;return t.jsxs("div",e.__assign({className:F,style:{backgroundColor:a}},{children:[t.jsx("div",e.__assign({className:G},{children:t.jsx(R,{width:128,height:128,alt:r,src:o})})),t.jsx("div",{children:null==n?void 0:n.map((function(i,n){return t.jsx(_.Typography,e.__assign({variant:_.TypographyVariant.HM2,style:{color:i.textColor,lineHeight:"24px"}},{children:i.text}),n)}))})]}))},B=function(){return[t.jsx(L,{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),t.jsx(L,{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),t.jsx(L,{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),t.jsx(L,{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 Q=function(n){var a=n.customSlides,o=n.carouselImages,r=i.useMemo((function(){return s.isEmpty(o)?k:o}),[o]);return t.jsx("div",e.__assign({className:" o-hidden p-relative ".concat(E.slider_carousel_wrapper)},{children:t.jsx(v.Swiper,e.__assign({autoplay:!0,slidesPerView:1,navigation:!1,loop:!0,pagination:{clickable:!0},className:"".concat(E.swiper," ").concat(E["swiper-custom-pagination"]),lazy:{loadPrevNextAmount:1}},{children:o&&o.length>0?null==r?void 0:r.map((function(i,n){return t.jsx(v.SwiperSlide,e.__assign({className:E["swiper-slide"]},{children:t.jsx(t.Fragment,{children:n<1?t.jsx(R,{src:i.src,placeholderSrc:i.placeholder,alt:"Slide ".concat(n+1),rel:"preload",fetchPriority:"high"}):t.jsx(R,{src:i.src,placeholderSrc:i.placeholder,alt:"Slide ".concat(n+1),loading:"lazy",className:"lazy"})})}),n)})):a&&a.length>0?null==a?void 0:a.map((function(i,n){return t.jsx(v.SwiperSlide,e.__assign({className:E["swiper-slide"]},{children:i}),n)})):B().length&&B().map((function(i,n){return t.jsx(v.SwiperSlide,e.__assign({className:E["swiper-slide"]},{children:i}),n)}))}))}))};exports.LoginModule=function(c){var d=c.fallbackUri,_=c.isDrawerOpen,u=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.hotelsLoyaltyFlow,S=void 0!==T&&T,b=c.closeOnOutsideClick,O=void 0!==b&&b,y=i.useState(!0),I=y[0],P=y[1],k=i.useState(!0),R=k[0],F=k[1],G=i.useState(!1),L=G[0],B=G[1],U=i.useState(_),q=U[0],X=U[1],M=i.useState(""),V=M[0],z=M[1],K=i.useState(0),J=K[0],W=K[1],Z=i.useState(!1),H=Z[0],Y=Z[1],$=i.useState(""),ee=$[0],te=$[1],ie=i.useState(!1),ne=ie[0],ae=ie[1],oe=i.useState(!1),re=oe[0],le=oe[1],se=i.useState((function(){return s.getCurrentPathName()}))[0],ce=function(){le(!0)};i.useEffect((function(){window&&(window.showSigninLoaderScreen=ce);var e=s.getQueryParam("fkSSOstatus"),t="FK";"signin"===e&&(s.isAndroidApp()&&s.updateNativeAndroidOnSignIn(),_e(t)),"signup"===e&&(s.isAndroidApp()&&s.updateNativeAndroidOnSignIn(),_e(t,!0)),"failure"===e&&ue(t)}),[]);var de=i.useCallback((function(t){return e.__awaiter(void 0,void 0,void 0,(function(){var i,n,a,o;return e.__generator(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),F(!1),B(!0),s.triggerOTPListener(),[4,s.sendLoginOtp(t)];case 1:return i=e.sent(),"SUCCESS"===(i||{}).status&&(P(!1),B(!1)),[3,3];case 2:return n=e.sent(),console.error(n),a=(n||{}).message,B(!1),o=a&&l.LOGIN_CONSTANTS[a],te(String(o||l.LOGIN_CONSTANTS.GENERIC_ERROR_MESSAGE)),"OTP_SEND_LIMIT_EXCEEDED"===a&&Y(!0),[3,3];case 3:return[2]}}))}))}),[I,P]),_e=i.useCallback((function(t,i){var n=s.getRavenEventProps();s.ravenSDKTrigger("u_login_success",e.__assign({action_name:"login_successful",login_form:null==n?void 0:n.loginForm,login_type:"native",login_new:i?"sign_up":"sign_in",vertical:null==n?void 0:n.vertical,page_name:null==n?void 0:n.pageName},f)),S?v(ge):(v(),i&&!u||(ge(),ae(!0)))}),[]),ue=i.useCallback((function(e){h(e)}),[]),ge=function(t){null==t||t.stopPropagation(),X(!1),z(""),F(!0);var i=s.getRavenEventProps();s.ravenSDKTrigger("u_login_click",e.__assign({action_name:"login_prompt_dismissed",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)),x&&"function"==typeof x&&x()};return i.useEffect((function(){if(_){P(!0),X(!0);var t=s.getRavenEventProps();s.ravenSDKTrigger("u_login_popup",e.__assign({action_name:"login_prompt_opened",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))}else X(!1)}),[_]),t.jsx(r.ThemeProvider,{children:t.jsxs(t.Fragment,{children:[t.jsx(o.Drawer,e.__assign({direction:"bottom",isOpen:q,showClose:!0,overlay:!0,handleClose:ge,onClose:function(){},closeOnOutsideClick:O},{children:t.jsx("div",e.__assign({className:"".concat(E.utilswrapper," utilswrapper")},{children:t.jsxs("div",e.__assign({style:{maxHeight:"calc(100dvh - 60px)",overflowY:"auto",borderRadius:"16px 16px 0 0"}},{children:[p&&t.jsx(Q,{customSlides:N,carouselImages:C}),t.jsxs("div",e.__assign({className:E.login_form},{children:[t.jsx("div",{children:t.jsx(a.Spacer,{className:"pt-6"})}),I?t.jsx(D,{device:"PWA",ctaDisabled:R,sendingOtp:L,getOTP:de,mobileNumber:V,setMobileNumber:z,setMobileInputHeight:W,fallbackUri:d,skipProfileFlow:u,currentPageUri:se,setErrorCallout:te,errorCallout:ee,ravenPayload:f,hotelsLoyaltyFlow:S}):t.jsx(w,{mobileNumber:V,getOTP:de,setCtaDisabled:F,setShowMobilePage:P,handleLoginSuccess:_e,handleLoginFailure:ue,otpInputHeight:J,setMobileNumber:z,setErrorCallout:te,errorCallout:ee,otpResendDisabled:H,ravenPayload:f,skipProfileFlow:u,hotelsLoyaltyFlow:S})]}))]}))}))})),ne&&t.jsx(n.Toast,{text:"Logged in successfully!",show:ne,className:"".concat(E.nonUtilsSelector_toast),closeTimeout:2e3}),re&&t.jsx(j,{title:"Please wait",message:"Signing in...",className:"z-10 bg-white"})]})})};
688
2
  //# sourceMappingURL=ct-platform-login-module.cjs.js.map