@eka-care/abha-stg 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +369 -101
- package/{dist/index.html → index.html} +1 -2
- package/package/styles/pds2/border.ts +69 -0
- package/package/styles/pds2/colors.ts +70 -0
- package/package/styles/pds2/spacing.ts +1007 -0
- package/package/tailwind/tailwind.config.ts +124 -0
- package/package.json +9 -8
- package/postcss.config.js +6 -0
- package/scripts/build-purged-css.cjs +70 -0
- package/src/App.css +0 -0
- package/src/App.tsx +43 -0
- package/src/api-queries/aorta-go/v3/get-profile-patient.ts +32 -0
- package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +26 -0
- package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +34 -0
- package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +32 -0
- package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +38 -0
- package/src/api-queries/aorta-go/v3/post-profile-switch.ts +39 -0
- package/src/api-queries/ndhm/get-abdm-register-suggest.ts +37 -0
- package/src/api-queries/ndhm/get-pincode-details.ts +28 -0
- package/src/api-queries/ndhm/post-abdm-login-init.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-login-phr.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-login-verify.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +40 -0
- package/src/api-queries/ndhm/post-abdm-profile-eka.ts +66 -0
- package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +37 -0
- package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +66 -0
- package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +32 -0
- package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +38 -0
- package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +37 -0
- package/src/api-queries/ndhm/post-register-aadhaar-init.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +37 -0
- package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +34 -0
- package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +40 -0
- package/src/api-queries/ndhm/post-register-mobile-init.ts +34 -0
- package/src/api-queries/use-get-profiles-patient.ts +12 -0
- package/src/api-queries/use-get-profiles-phr-user.ts +28 -0
- package/src/api-queries/use-post-abdm-login-verify-v1.ts +26 -0
- package/src/api-queries/use-post-auth-verify-v2.ts +50 -0
- package/src/api-queries/use-post-profile-switch.ts +58 -0
- package/src/api-queries/use-post-register-mobile-create-phr.ts +39 -0
- package/src/api-queries/user-post-abdm-profile-login-phr.ts +26 -0
- package/src/assets/Success.json +1 -0
- package/src/assets/react.svg +1 -0
- package/src/atoms/button/custom-button.tsx +32 -0
- package/src/atoms/button/index.tsx +40 -0
- package/src/atoms/button/types.d.ts +31 -0
- package/src/atoms/header.tsx +25 -0
- package/src/atoms/input-field/index.tsx +63 -0
- package/src/atoms/input-field/patient-input-field.tsx +16 -0
- package/src/atoms/input-field/types.ts +24 -0
- package/src/atoms/pds2-otp-input/index.tsx +35 -0
- package/src/atoms/pds2-otp-input/types.d.ts +3 -0
- package/src/atoms/single-input-chip/index.tsx +32 -0
- package/src/atoms/single-input-chip/types.ts +6 -0
- package/src/atoms/spinner.tsx +33 -0
- package/src/atoms/text-separator.tsx +11 -0
- package/src/atoms/ui/spinner.tsx +75 -0
- package/src/constants/constants.ts +376 -0
- package/src/fetch-client/index.ts +164 -0
- package/src/index.css +152 -0
- package/src/main.tsx +374 -0
- package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +40 -0
- package/src/molecules/abha/bottom-sheet/index.tsx +66 -0
- package/src/molecules/abha/spaced-input-component.tsx +168 -0
- package/src/molecules/copyright-year.tsx +16 -0
- package/src/molecules/exit-popup/index.tsx +101 -0
- package/src/molecules/pds2-otp-component/index.tsx +147 -0
- package/src/organisms/abha/abha-header.tsx +25 -0
- package/src/organisms/abha/abha-stepper.tsx +83 -0
- package/src/organisms/abha/error-bottom-sheet.tsx +27 -0
- package/src/organisms/abha/otp-card.tsx +99 -0
- package/src/organisms/abha/verification-status.tsx +30 -0
- package/src/organisms/choose-language/choose-language.tsx +53 -0
- package/src/organisms/choose-language/types.ts +10 -0
- package/src/organisms/screen-switcher/screen-switcher.tsx +80 -0
- package/src/routes/abha-aadhaar-verification-status-screen.tsx +246 -0
- package/src/routes/abha-created-screen.tsx +45 -0
- package/src/routes/abha-login-otp-verify-screen.tsx +519 -0
- package/src/routes/abha-mobile-linking-status-screen.tsx +267 -0
- package/src/routes/abha-otp-and-mobile-screen.tsx +435 -0
- package/src/routes/abha-phone-number-verification-screen.tsx +388 -0
- package/src/routes/create-abha-address-screen.tsx +928 -0
- package/src/routes/create-abha-with-aadhaar-screen.tsx +986 -0
- package/src/routes/create-eka-profile-screen.tsx +831 -0
- package/src/routes/get-all-profiles-screen.tsx +161 -0
- package/src/routes/login-or-create-abha-address-screen.tsx +1056 -0
- package/src/routes/login-with-abha-screen.tsx +454 -0
- package/src/routes/select-abha-from-list-screen.tsx +792 -0
- package/src/routes/select-eka-profile-screen.tsx +446 -0
- package/src/routes/utils/trackAbhaEvent.ts +41 -0
- package/src/stores/auth-abha-store/index.ts +152 -0
- package/src/stores/auth-abha-store/types.ts +217 -0
- package/src/utils/mock-auth-response.ts +29 -0
- package/src/utils/send-event-utils.ts +76 -0
- package/src/utils/validations.ts +89 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.ts +9 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/tsconfig.node.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.d.ts +2 -0
- package/vite.config.js +30 -0
- package/vite.config.ts +35 -0
- package/dist/sdk/abha/css/abha.css +0 -1
- package/dist/sdk/abha/js/abha.js +0 -146
- /package/{dist → public}/images/adhaar.webp +0 -0
- /package/{dist → public}/images/at-the-rate.webp +0 -0
- /package/{dist → public}/images/avatar.webp +0 -0
- /package/{dist → public}/images/ayushman-bharat.webp +0 -0
- /package/{dist → public}/images/circle-checkmark.webp +0 -0
- /package/{dist → public}/images/link-abha.webp +0 -0
- /package/{dist → public}/images/national-authority.webp +0 -0
- /package/{dist → public}/images/three-dots.webp +0 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { GET_EXTRA_HEADERS, LOADING_STATE } from '../constants/constants';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Pds2Button from '../atoms/button';
|
|
4
|
+
import AbhaHeader from '../organisms/abha/abha-header';
|
|
5
|
+
import AbhaErrorBottomSheet from '../organisms/abha/error-bottom-sheet';
|
|
6
|
+
import AbhaOtpCard from '../organisms/abha/otp-card';
|
|
7
|
+
import useAuthAbhaStore from '../stores/auth-abha-store';
|
|
8
|
+
import { SCREEN_NAMES } from '../stores/auth-abha-store/types';
|
|
9
|
+
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
import { ArrowLeftRegularIcon, CircleInfoSolidIcon } from '@eka-care/icons';
|
|
12
|
+
import AbhaStepper from '../organisms/abha/abha-stepper';
|
|
13
|
+
import ExitPopup from '../molecules/exit-popup';
|
|
14
|
+
import handleSendEvent from '../utils/send-event-utils';
|
|
15
|
+
import postAbdmRegisterMobileResendOtp from '../api-queries/ndhm/post-abdm-register-mobile-resend-otp';
|
|
16
|
+
import postRegisterAadhaarMobileResendOtp from '../api-queries/ndhm/post-register-aadhaar-mobile-resend-otp';
|
|
17
|
+
import postAbdmRegisterMobileVerify from '../api-queries/ndhm/post-abdm-register-mobile-verify';
|
|
18
|
+
import postRegisterAadhaarMobileVerify from '../api-queries/ndhm/post-register-aadhaar-mobile-verify';
|
|
19
|
+
|
|
20
|
+
const AbhaPhoneNumberVerificationScreen = () => {
|
|
21
|
+
const txnId = useAuthAbhaStore((state) => state.txnId);
|
|
22
|
+
const clearAbhaAuthStore = useAuthAbhaStore((state) => state.clearAbhaAuthStore);
|
|
23
|
+
const setBottomsheetErrorInfo = useAuthAbhaStore((state) => state.setBottomsheetErrorInfo);
|
|
24
|
+
const setEkaSmallToken = useAuthAbhaStore((state) => state.setEkaSmallToken);
|
|
25
|
+
const setOid = useAuthAbhaStore((state) => state.setOid);
|
|
26
|
+
const setAadhaarVerificationSkipStateStatus = useAuthAbhaStore(
|
|
27
|
+
(state) => state.setAadhaarVerificationSkipStateStatus
|
|
28
|
+
);
|
|
29
|
+
const setSelectedAbhaAddress = useAuthAbhaStore((state) => state.setSelectedAbhaAddress);
|
|
30
|
+
|
|
31
|
+
const setAbhaAddressList = useAuthAbhaStore((state) => state.setAbhaAddressList);
|
|
32
|
+
const setScreen = useAuthAbhaStore((state) => state.setScreen);
|
|
33
|
+
const selectedMethod = useAuthAbhaStore((state) => state.abhaAuthFlowMethod);
|
|
34
|
+
|
|
35
|
+
const [otp, setOtp] = useState('');
|
|
36
|
+
const [isOtpValid, setIsOtpValid] = useState(false);
|
|
37
|
+
const [error, setError] = useState<string | null>('');
|
|
38
|
+
|
|
39
|
+
const [aadhaarMobileVerifyApiStatus, setAadhaarMobileVerifyApiStatus] = useState<LOADING_STATE>(
|
|
40
|
+
LOADING_STATE.IDLE
|
|
41
|
+
);
|
|
42
|
+
const setTxnId = useAuthAbhaStore((state) => state.setTxnId);
|
|
43
|
+
|
|
44
|
+
const setEkaProfileInfo = useAuthAbhaStore((state) => state.setEkaProfileInfo);
|
|
45
|
+
const clientId = useAuthAbhaStore((state) => state.clientId);
|
|
46
|
+
const selectedAbhaFlow = useAuthAbhaStore((state) => state.selectedAbhaFlow);
|
|
47
|
+
const isNewLoginOrCreateFlow = useAuthAbhaStore((state) => state.isNewLoginOrCreateFlow);
|
|
48
|
+
const isEkaAppLogin = useAuthAbhaStore((state) => state.isEkaAppLogin);
|
|
49
|
+
const extra_headers = GET_EXTRA_HEADERS();
|
|
50
|
+
const [isExitPopupOpen, setIsExitPopupOpen] = useState<boolean>(false);
|
|
51
|
+
|
|
52
|
+
console.log('selectedAbhaFlow is : ', selectedAbhaFlow);
|
|
53
|
+
|
|
54
|
+
// Analytics event tracker
|
|
55
|
+
const trackAbhaEvent = ({ name, data = {} }: { name: string; data?: Record<string, any> }) => {
|
|
56
|
+
const baseProps = {
|
|
57
|
+
login_platform: clientId,
|
|
58
|
+
is_eka_app_login: isEkaAppLogin ? 'true' : 'false',
|
|
59
|
+
is_new_login_or_create_flow: isNewLoginOrCreateFlow ? 'true' : 'false',
|
|
60
|
+
txn_id: txnId || 'missing txnId',
|
|
61
|
+
oid: extra_headers?.['X-User-ID'] ? 'true' : 'false',
|
|
62
|
+
access_token: extra_headers?.['auth'] ? 'true' : 'false',
|
|
63
|
+
flow: selectedMethod ?? ""
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const eventData = {
|
|
67
|
+
...baseProps,
|
|
68
|
+
...data,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
handleSendEvent({
|
|
72
|
+
eventName: name,
|
|
73
|
+
eventData,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
window.curio?.pushToMixpanel?.(name, eventData);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
trackAbhaEvent({
|
|
81
|
+
name: 'page_view',
|
|
82
|
+
data: {
|
|
83
|
+
page_view: 'abha_mobile_otp_verify',
|
|
84
|
+
platform: clientId,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}, []);
|
|
88
|
+
|
|
89
|
+
const handleOtpCompletion = ({ otp: newOtp }: { otp: string }) => {
|
|
90
|
+
setOtp(newOtp);
|
|
91
|
+
trackAbhaEvent({
|
|
92
|
+
name: 'abha_mobile_otp_completion',
|
|
93
|
+
data: {
|
|
94
|
+
platform: clientId,
|
|
95
|
+
type: 'verify',
|
|
96
|
+
otp_entered: true,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
handleVerifyClick(newOtp);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const handleResendOtpClick = async () => {
|
|
103
|
+
if (!txnId) {
|
|
104
|
+
trackAbhaEvent({
|
|
105
|
+
name: 'abha_mobile_otp_resend_clicked_no_txnId',
|
|
106
|
+
data: {
|
|
107
|
+
type: 'resend',
|
|
108
|
+
platform: clientId,
|
|
109
|
+
txn_id: 'missing_txnId',
|
|
110
|
+
txn_id_exists: false,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
trackAbhaEvent({
|
|
117
|
+
name: 'abha_mobile_otp_verify_clicks',
|
|
118
|
+
data: {
|
|
119
|
+
type: 'resend',
|
|
120
|
+
platform: clientId,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
console.log('selectedMethod', selectedMethod);
|
|
125
|
+
let response;
|
|
126
|
+
if (selectedAbhaFlow === 'mobile') {
|
|
127
|
+
trackAbhaEvent({
|
|
128
|
+
name: 'abha_mobile_otp_resend_initiated',
|
|
129
|
+
data: {
|
|
130
|
+
platform: clientId,
|
|
131
|
+
type: 'verify',
|
|
132
|
+
flow_type: selectedAbhaFlow,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
console.log('selectedFlow is mobile, so triggering mobile resend otp api', selectedAbhaFlow);
|
|
136
|
+
response = await postAbdmRegisterMobileResendOtp({
|
|
137
|
+
txn_id: txnId,
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
trackAbhaEvent({
|
|
141
|
+
name: 'aadhaar_mobile_otp_resend_initiated',
|
|
142
|
+
data: {
|
|
143
|
+
platform: clientId,
|
|
144
|
+
type: 'verify',
|
|
145
|
+
flow_type: selectedAbhaFlow,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
console.log(
|
|
149
|
+
'selectedFlow is aadhaar, so triggering aadhaar resend otp api',
|
|
150
|
+
selectedAbhaFlow
|
|
151
|
+
);
|
|
152
|
+
response = await postRegisterAadhaarMobileResendOtp({
|
|
153
|
+
txn_id: txnId,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const { txn_id, error: resendOtpError, action: errorAction } = response;
|
|
158
|
+
|
|
159
|
+
if (!txn_id) {
|
|
160
|
+
trackAbhaEvent({
|
|
161
|
+
name: 'abha_mobile_otp_resend_failed',
|
|
162
|
+
data: {
|
|
163
|
+
platform: clientId,
|
|
164
|
+
reason: resendOtpError || 'no_txn_id',
|
|
165
|
+
reason_exists: !!resendOtpError,
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
setError(resendOtpError || 'Something went wrong, please try again');
|
|
169
|
+
if (errorAction) {
|
|
170
|
+
setBottomsheetErrorInfo(errorAction);
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (txn_id) {
|
|
176
|
+
setTxnId(txn_id);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
trackAbhaEvent({
|
|
180
|
+
name: 'abha_mobile_otp_resend_success',
|
|
181
|
+
data: {
|
|
182
|
+
platform: clientId,
|
|
183
|
+
txn_id: txn_id,
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const handleVerifyClick = async (otpToSubmit: string) => {
|
|
189
|
+
if (!txnId) {
|
|
190
|
+
trackAbhaEvent({
|
|
191
|
+
name: 'abha_mobile_verify_no_txnId',
|
|
192
|
+
data: {
|
|
193
|
+
type: 'verify',
|
|
194
|
+
platform: clientId,
|
|
195
|
+
txn_id: 'missing_txnId',
|
|
196
|
+
txn_id_exists: false,
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
trackAbhaEvent({
|
|
203
|
+
name: 'abha_mobile_otp_submitted',
|
|
204
|
+
data: {
|
|
205
|
+
type: 'verify',
|
|
206
|
+
platform: clientId,
|
|
207
|
+
txn_id: txnId,
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
setAadhaarMobileVerifyApiStatus(LOADING_STATE.LOADING);
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
let response;
|
|
215
|
+
if (selectedAbhaFlow === 'mobile') {
|
|
216
|
+
trackAbhaEvent({
|
|
217
|
+
name: 'abha_mobile_otp_verification_started',
|
|
218
|
+
data: {
|
|
219
|
+
platform: clientId,
|
|
220
|
+
flow_type: selectedAbhaFlow,
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
response = await postAbdmRegisterMobileVerify({
|
|
224
|
+
otp: otpToSubmit,
|
|
225
|
+
txn_id: txnId,
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
trackAbhaEvent({
|
|
229
|
+
name: 'aadhaar_otp_verification_started',
|
|
230
|
+
data: {
|
|
231
|
+
platform: clientId,
|
|
232
|
+
flow_type: selectedAbhaFlow,
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
response = await postRegisterAadhaarMobileVerify({
|
|
237
|
+
otp: otpToSubmit,
|
|
238
|
+
txn_id: txnId,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const {
|
|
243
|
+
txn_id,
|
|
244
|
+
skip_state,
|
|
245
|
+
eka,
|
|
246
|
+
profile,
|
|
247
|
+
error: verifyError,
|
|
248
|
+
action: errorAction,
|
|
249
|
+
abha_profiles,
|
|
250
|
+
} = response;
|
|
251
|
+
|
|
252
|
+
if (!txn_id || !skip_state) {
|
|
253
|
+
trackAbhaEvent({
|
|
254
|
+
name: 'abha_mobile_otp_verification_failed',
|
|
255
|
+
data: {
|
|
256
|
+
platform: clientId,
|
|
257
|
+
reason: verifyError || 'missing_txn_id_or_skip_state',
|
|
258
|
+
txn_id_exists: !!txn_id,
|
|
259
|
+
skip_state_exists: !!skip_state,
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
setAadhaarMobileVerifyApiStatus(LOADING_STATE.REJECTED);
|
|
263
|
+
setError(verifyError || 'Something went wrong, please try again');
|
|
264
|
+
if (errorAction) {
|
|
265
|
+
setBottomsheetErrorInfo(errorAction);
|
|
266
|
+
}
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
setAadhaarMobileVerifyApiStatus(LOADING_STATE.RESOLVED);
|
|
270
|
+
setAadhaarVerificationSkipStateStatus(skip_state);
|
|
271
|
+
if (eka?.min_token) {
|
|
272
|
+
setEkaSmallToken(eka.min_token);
|
|
273
|
+
}
|
|
274
|
+
if (eka?.oid) {
|
|
275
|
+
setOid(eka.oid);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (profile && profile.abha_address) {
|
|
279
|
+
setSelectedAbhaAddress(profile.abha_address);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (profile) {
|
|
283
|
+
setEkaProfileInfo({
|
|
284
|
+
// date_of_birth: `${profile.day_of_birth}-${profile.month_of_birth}-${profile.year_of_birth}` as string,
|
|
285
|
+
date_of_birth: `${profile.year_of_birth}-${String(profile.month_of_birth).padStart(2, '0')}-${String(profile.day_of_birth).padStart(2, '0')}`,
|
|
286
|
+
firstname: profile.first_name as string,
|
|
287
|
+
lastname: profile.last_name as string,
|
|
288
|
+
pincode: profile.pincode,
|
|
289
|
+
gender: profile.gender as string,
|
|
290
|
+
oid: eka?.oid,
|
|
291
|
+
abha_address: profile?.abha_address,
|
|
292
|
+
abha_number: profile?.abha_number,
|
|
293
|
+
middlename: profile?.middle_name,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// abha -> create abha with mobile
|
|
298
|
+
// HMIS -> when we are creating a new patient profile, we wont have oid in the headers.
|
|
299
|
+
// so server will send oid in the eka object.
|
|
300
|
+
// set the oid in the headers and redirect to abha mobile linking status screen
|
|
301
|
+
|
|
302
|
+
console.log('remove oid from set indvidual env')
|
|
303
|
+
|
|
304
|
+
trackAbhaEvent({
|
|
305
|
+
name: 'abha_mobile_otp_verification_success',
|
|
306
|
+
data: {
|
|
307
|
+
platform: clientId,
|
|
308
|
+
skip_state,
|
|
309
|
+
},
|
|
310
|
+
});
|
|
311
|
+
if (abha_profiles?.length) {
|
|
312
|
+
setAbhaAddressList(abha_profiles);
|
|
313
|
+
setScreen(SCREEN_NAMES.SELECT_ABHA_FROM_LIST);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
setScreen(SCREEN_NAMES.ABHA_MOBILE_LINKING_STATUS);
|
|
317
|
+
} catch (error) {
|
|
318
|
+
trackAbhaEvent({
|
|
319
|
+
name: 'abha_mobile_otp_verification_exception',
|
|
320
|
+
data: {
|
|
321
|
+
platform: clientId,
|
|
322
|
+
reason: 'exception_thrown',
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
setAadhaarMobileVerifyApiStatus(LOADING_STATE.REJECTED);
|
|
327
|
+
setError('Something went wrong, please try again');
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const handleErrorBottomsheetButtonClick = () => {
|
|
332
|
+
setScreen(SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR);
|
|
333
|
+
const isAppLogin = useAuthAbhaStore.getState().isEkaAppLogin;
|
|
334
|
+
clearAbhaAuthStore();
|
|
335
|
+
useAuthAbhaStore.setState({ isEkaAppLogin: isAppLogin });
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
return (
|
|
339
|
+
<div className="pds2-flex pds2-flex-col pds2-w-full pds2-h-full pds2-bg-bg-white">
|
|
340
|
+
<AbhaHeader
|
|
341
|
+
prefixIcon={
|
|
342
|
+
<button
|
|
343
|
+
className="pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple"
|
|
344
|
+
onClick={() => setIsExitPopupOpen(true)}
|
|
345
|
+
>
|
|
346
|
+
<ArrowLeftRegularIcon className="" />
|
|
347
|
+
</button>
|
|
348
|
+
}
|
|
349
|
+
title="Phone Number Verification"
|
|
350
|
+
className="pds2-border-b-1 pds2-border-bg-seperator-dark"
|
|
351
|
+
/>
|
|
352
|
+
|
|
353
|
+
<AbhaStepper/>
|
|
354
|
+
<div className="pds2-p-16 pds2-space-y-16 pds2-overflow-y-auto pds2-flex-1 pds2-bg-bg-01">
|
|
355
|
+
<AbhaOtpCard
|
|
356
|
+
otpSentToText="Enter OTP received through ABDM to verify mobile number"
|
|
357
|
+
onOtpCompletion={handleOtpCompletion}
|
|
358
|
+
onResendOtpClick={handleResendOtpClick}
|
|
359
|
+
error={error}
|
|
360
|
+
setIsValid={(val) => {
|
|
361
|
+
error && setError(null);
|
|
362
|
+
setIsOtpValid(val);
|
|
363
|
+
}}
|
|
364
|
+
prefixIcon={
|
|
365
|
+
<img
|
|
366
|
+
src="https://cdn.eka.care/vagus/cm6hreldp000b0tfwf0nj156l.webp"
|
|
367
|
+
alt="abha"
|
|
368
|
+
className="pds2-w-48"
|
|
369
|
+
/>
|
|
370
|
+
}
|
|
371
|
+
/>
|
|
372
|
+
</div>
|
|
373
|
+
<div className="pds2-p-16 pds2-sticky pds2-bottom-0 pds2-bg-bg-white pds2-w-full pds2-border pds2-border-border-brand-02">
|
|
374
|
+
<Pds2Button
|
|
375
|
+
title="Verify"
|
|
376
|
+
state={(!isOtpValid || aadhaarMobileVerifyApiStatus === LOADING_STATE.LOADING )? 'disabled' : 'enabled'}
|
|
377
|
+
className="pds2-w-full"
|
|
378
|
+
onClick={() => handleVerifyClick(otp)}
|
|
379
|
+
isLoading={aadhaarMobileVerifyApiStatus === LOADING_STATE.LOADING}
|
|
380
|
+
/>
|
|
381
|
+
</div>
|
|
382
|
+
<AbhaErrorBottomSheet onSubmitClick={handleErrorBottomsheetButtonClick} />
|
|
383
|
+
<ExitPopup open={isExitPopupOpen} setOpen={setIsExitPopupOpen} />
|
|
384
|
+
</div>
|
|
385
|
+
);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
export default AbhaPhoneNumberVerificationScreen;
|