@eka-care/abha 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/{index.html → dist/index.html} +2 -1
  2. package/dist/sdk/abha/css/abha.css +1 -0
  3. package/dist/sdk/abha/js/abha.js +136 -0
  4. package/package.json +2 -4
  5. package/.eslintignore +0 -3
  6. package/.eslintrc +0 -29
  7. package/.prettierrc +0 -7
  8. package/dev-abha-ios-android.zip +0 -0
  9. package/postcss.config.js +0 -6
  10. package/prod-abha-mixpanel.zip +0 -0
  11. package/scripts/build-purged-css.cjs +0 -70
  12. package/src/App.css +0 -0
  13. package/src/App.tsx +0 -32
  14. package/src/api-queries/use-get-profiles-patient.ts +0 -12
  15. package/src/api-queries/use-get-profiles-phr-user.ts +0 -27
  16. package/src/api-queries/use-post-abdm-login-verify-v1.ts +0 -25
  17. package/src/api-queries/use-post-auth-verify-v2.ts +0 -74
  18. package/src/api-queries/use-post-profile-switch.ts +0 -57
  19. package/src/api-queries/use-post-register-mobile-create-phr.ts +0 -39
  20. package/src/api-queries/user-post-abdm-profile-login-phr.ts +0 -25
  21. package/src/assets/react.svg +0 -1
  22. package/src/atoms/button/custom-button.tsx +0 -32
  23. package/src/atoms/button/index.tsx +0 -40
  24. package/src/atoms/button/types.d.ts +0 -31
  25. package/src/atoms/header.tsx +0 -25
  26. package/src/atoms/input-field/index.tsx +0 -62
  27. package/src/atoms/input-field/patient-input-field.tsx +0 -16
  28. package/src/atoms/input-field/types.ts +0 -24
  29. package/src/atoms/pds2-otp-input/index.tsx +0 -35
  30. package/src/atoms/pds2-otp-input/types.d.ts +0 -3
  31. package/src/atoms/single-input-chip/index.tsx +0 -32
  32. package/src/atoms/single-input-chip/types.ts +0 -6
  33. package/src/atoms/spinner.tsx +0 -33
  34. package/src/atoms/text-separator.tsx +0 -11
  35. package/src/index.css +0 -118
  36. package/src/main.tsx +0 -313
  37. package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +0 -40
  38. package/src/molecules/abha/bottom-sheet/index.tsx +0 -66
  39. package/src/molecules/abha/spaced-input-component.tsx +0 -150
  40. package/src/molecules/copyright-year.tsx +0 -16
  41. package/src/molecules/exit-popup/index.tsx +0 -99
  42. package/src/molecules/pds2-otp-component/index.tsx +0 -148
  43. package/src/organisms/abha/abha-header.tsx +0 -25
  44. package/src/organisms/abha/error-bottom-sheet.tsx +0 -27
  45. package/src/organisms/abha/otp-card.tsx +0 -99
  46. package/src/organisms/abha/verification-status.tsx +0 -40
  47. package/src/organisms/choose-language/choose-language.tsx +0 -53
  48. package/src/organisms/choose-language/types.ts +0 -10
  49. package/src/organisms/screen-switcher/screen-switcher.tsx +0 -80
  50. package/src/routes/abha-aadhaar-verification-status-screen.tsx +0 -209
  51. package/src/routes/abha-created-screen.tsx +0 -45
  52. package/src/routes/abha-login-otp-verify-screen.tsx +0 -523
  53. package/src/routes/abha-mobile-linking-status-screen.tsx +0 -267
  54. package/src/routes/abha-otp-and-mobile-screen.tsx +0 -429
  55. package/src/routes/abha-phone-number-verification-screen.tsx +0 -373
  56. package/src/routes/create-abha-address-screen.tsx +0 -928
  57. package/src/routes/create-abha-with-aadhaar-screen.tsx +0 -984
  58. package/src/routes/create-eka-profile-screen.tsx +0 -777
  59. package/src/routes/get-all-profiles-screen.tsx +0 -161
  60. package/src/routes/login-or-create-abha-address-screen.tsx +0 -953
  61. package/src/routes/login-with-abha-screen.tsx +0 -448
  62. package/src/routes/select-abha-from-list-screen.tsx +0 -718
  63. package/src/routes/select-eka-profile-screen.tsx +0 -444
  64. package/src/routes/utils/trackAbhaEvent.ts +0 -41
  65. package/src/stores/auth-abha-store/index.ts +0 -138
  66. package/src/stores/auth-abha-store/types.ts +0 -204
  67. package/src/utils/mock-auth-response.ts +0 -31
  68. package/src/vite-env.d.ts +0 -1
  69. package/tailwind.config.ts +0 -9
  70. package/tsconfig.app.json +0 -26
  71. package/tsconfig.json +0 -25
  72. package/tsconfig.node.json +0 -10
  73. package/tsconfig.node.tsbuildinfo +0 -1
  74. package/tsconfig.tsbuildinfo +0 -1
  75. package/vite.config.d.ts +0 -2
  76. package/vite.config.js +0 -30
  77. package/vite.config.ts +0 -35
  78. /package/{public → dist}/images/adhaar.webp +0 -0
  79. /package/{public → dist}/images/at-the-rate.webp +0 -0
  80. /package/{public → dist}/images/avatar.webp +0 -0
  81. /package/{public → dist}/images/ayushman-bharat.webp +0 -0
  82. /package/{public → dist}/images/circle-checkmark.webp +0 -0
  83. /package/{public → dist}/images/link-abha.webp +0 -0
  84. /package/{public → dist}/images/national-authority.webp +0 -0
  85. /package/{public → dist}/images/three-dots.webp +0 -0
@@ -1,523 +0,0 @@
1
- import { ArrowLeftRegularIcon, EkaIcon } from '@elixir/icons';
2
- import {
3
- ABHA_AUTH_FLOW_METHOD,
4
- ABHA_V3_SKIP_STATES,
5
- LOADING_STATE,
6
- TProfileRecord,
7
- } from '@elixir/types';
8
- import { postAbdmLoginInit } from 'apis';
9
- import { useState, useEffect } from 'react';
10
- import usePostAuthVerifyV2 from '../api-queries/use-post-auth-verify-v2';
11
- import Pds2Button from '../atoms/button';
12
- import AbhaHeader from '../organisms/abha/abha-header';
13
- import AbhaErrorBottomSheet from '../organisms/abha/error-bottom-sheet';
14
- import AbhaOtpCard from '../organisms/abha/otp-card';
15
- import useAuthAbhaStore from '../stores/auth-abha-store';
16
- import { SCREEN_NAMES } from '../stores/auth-abha-store/types';
17
- import usePostAbdmLoginVerify from '../api-queries/use-post-abdm-login-verify-v1';
18
- import ExitPopup from '../molecules/exit-popup';
19
- import { onAbhaSuccess, unMount } from '../main';
20
- import { handleSendEvent } from '@elixir/utils';
21
- import { getMockAuthVerifyResponse } from '../utils/mock-auth-response';
22
- import { GET_EXTRA_HEADERS } from 'apis';
23
-
24
- const AbhaLoginOtpVerifyScreen = () => {
25
- const authTxnId = useAuthAbhaStore((state) => state.authTxnId);
26
- const txnId = useAuthAbhaStore((state) => state.txnId);
27
- const setAbhaAddressList = useAuthAbhaStore((state) => state.setAbhaAddressList);
28
- const clearAbhaAuthStore = useAuthAbhaStore((state) => state.clearAbhaAuthStore);
29
- const aadhaarOtpSentToHint = useAuthAbhaStore((state) => state.aadhaarOtpSentToHint);
30
- const loginIdentifierValue = useAuthAbhaStore((state) => state.loginIdentifierValue);
31
- const abhaAuthFlowMethod = useAuthAbhaStore((state) => state.abhaAuthFlowMethod);
32
- const setScreen = useAuthAbhaStore((state) => state.setScreen);
33
- const goBackLoginScreen = useAuthAbhaStore((state) => state.goBackLoginScreen);
34
- const setTxnId = useAuthAbhaStore((state) => state.setTxnId);
35
- const setBottomsheetErrorInfo = useAuthAbhaStore((state) => state.setBottomsheetErrorInfo);
36
- const [isExitPopupOpen, setIsExitPopupOpen] = useState<boolean>(false);
37
- const setEkaProfileInfo = useAuthAbhaStore((state) => state.setEkaProfileInfo);
38
- const setAadhaarVerificationSkipStateStatus = useAuthAbhaStore(
39
- (state) => state.setAadhaarVerificationSkipStateStatus
40
- );
41
- const setSelectedAbhaAddress = useAuthAbhaStore((state) => state.setSelectedAbhaAddress);
42
-
43
- const [otp, setOtp] = useState('');
44
- const [isOtpValid, setIsOtpValid] = useState(false);
45
- const [error, setError] = useState<string | null>('');
46
- const [abdmLoginVerifyApiStatus, setAbdmLoginVerifyApiStatus] = useState<LOADING_STATE>(
47
- LOADING_STATE.IDLE
48
- );
49
- const validGenders = ['M', 'F', 'O', 'U'] as const;
50
-
51
- const { mutateAsync: postAuthVerifyV2Mutate } = usePostAuthVerifyV2();
52
- const { mutateAsync: postAbdmLoginVerify } = usePostAbdmLoginVerify();
53
- const isEkaAppLogin = useAuthAbhaStore((state) => state.isEkaAppLogin);
54
- const clientId = useAuthAbhaStore((state) => state.clientId);
55
- const oid = useAuthAbhaStore((state) => state.oid);
56
- const isNewLoginOrCreateFlow = useAuthAbhaStore((state) => state.isNewLoginOrCreateFlow);
57
- const extra_headers = GET_EXTRA_HEADERS();
58
-
59
- // Analytics event tracker
60
- const trackAbhaEvent = ({ name, data = {} }: { name: string; data?: Record<string, any> }) => {
61
- const baseProps = {
62
- login_platform: clientId,
63
- is_eka_app_login: isEkaAppLogin ? 'true' : 'false',
64
- is_new_login_or_create_flow: isNewLoginOrCreateFlow ? 'true' : 'false',
65
- txn_id: txnId || 'missing txnId',
66
- oid: extra_headers?.['X-User-ID'] ? 'true' : 'false',
67
- access_token: extra_headers?.['auth'] ? 'true' : 'false',
68
- };
69
-
70
- const eventData = {
71
- ...baseProps,
72
- ...data,
73
- };
74
-
75
- handleSendEvent({
76
- eventName: name,
77
- eventData,
78
- });
79
-
80
- window.curio?.pushToMixpanel?.(name, eventData);
81
- };
82
-
83
- useEffect(() => {
84
- trackAbhaEvent({
85
- name: 'page_view',
86
- data: {
87
- page_view: 'abha_login_otp_verify',
88
- platform: clientId,
89
- },
90
- });
91
- }, []);
92
-
93
- const handleErrorBottomsheetButtonClick = () => {
94
- trackAbhaEvent({
95
- name: 'abha_login_otp_verify_error_bottomsheet_dismissed',
96
- data: { platform: clientId },
97
- });
98
- goBackLoginScreen();
99
- const isAppLogin = useAuthAbhaStore.getState().isEkaAppLogin;
100
- clearAbhaAuthStore();
101
- useAuthAbhaStore.setState({ isEkaAppLogin: isAppLogin });
102
- };
103
-
104
- const handleOtpCompletion = ({ otp: newOtp }: { otp: string }) => {
105
- setOtp(newOtp);
106
- trackAbhaEvent({
107
- name: 'abha_login_otp_completion',
108
- data: {
109
- type: 'verify',
110
- platform: clientId,
111
- txn_id: txnId,
112
- otp_entered: true,
113
- method: abhaAuthFlowMethod,
114
- },
115
- });
116
- handleVerifyClick(newOtp);
117
- };
118
-
119
- const handleVerifyClick = async (otpToSubmit: string) => {
120
- if (!txnId) {
121
- trackAbhaEvent({
122
- name: 'abha_login_otp_verify_txnId_not_found',
123
- data: {
124
- type: 'verify',
125
- platform: clientId,
126
- txn_id: txnId || 'missing_txn_id',
127
- txn_id_exists: !!txnId,
128
- method: abhaAuthFlowMethod?.toLowerCase() || 'unknown_method',
129
- },
130
- });
131
- return;
132
- }
133
- trackAbhaEvent({
134
- name: 'abha_login_otp_verify',
135
- data: {
136
- type: 'verify',
137
- platform: clientId,
138
- txn_id: txnId,
139
- },
140
- });
141
-
142
- setAbdmLoginVerifyApiStatus(LOADING_STATE.LOADING);
143
- const {
144
- abha_profiles = [],
145
- skip_state,
146
- profile,
147
- error: verifyError,
148
- action: errorAction,
149
- eka,
150
- } = await postAbdmLoginVerify({ otp: otpToSubmit, txn_id: txnId });
151
-
152
- if (errorAction) {
153
- trackAbhaEvent({
154
- name: 'abha_login_otp_verify_error_action',
155
- data: {
156
- type: 'verify',
157
- platform: clientId,
158
- error_action: errorAction || 'no_error_action',
159
- error_message: verifyError || 'no_error_message',
160
- error_action_exists: !!errorAction,
161
- error_message_exists: !!verifyError,
162
- },
163
- });
164
- setBottomsheetErrorInfo(errorAction);
165
- return;
166
- }
167
-
168
- if (verifyError) {
169
- trackAbhaEvent({
170
- name: 'abha_login_otp_verify_error',
171
- data: {
172
- type: 'verify',
173
- platform: clientId,
174
- error_message: verifyError || 'unknown_error',
175
- error_message_exists: !!verifyError,
176
- },
177
- });
178
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
179
- setError(verifyError);
180
- return;
181
- }
182
-
183
- if (!skip_state) {
184
- setError('Skip State is missing');
185
- trackAbhaEvent({
186
- name: 'abha_login_skip_state_missing',
187
- data: {
188
- platform: clientId,
189
- skipState: skip_state || 'missing_skip_state',
190
- skipState_exists: !!skip_state,
191
- },
192
- });
193
- return;
194
- }
195
-
196
- setAadhaarVerificationSkipStateStatus(skip_state);
197
- if (profile) {
198
- setSelectedAbhaAddress(profile.abha_address);
199
- }
200
-
201
- // if profile data exists, then set in store
202
- if (profile) {
203
- setEkaProfileInfo({
204
- date_of_birth: `${profile.year_of_birth}-${String(profile.month_of_birth).padStart(2, '0')}-${String(profile.day_of_birth).padStart(2, '0')}`,
205
- firstname: profile.first_name as string,
206
- lastname: profile.last_name as string,
207
- pincode: profile.pincode as string,
208
- gender: profile.gender as string,
209
- name: (profile.first_name + ' ' + profile.last_name) as string,
210
- mobile: profile.mobile,
211
- oid: eka?.oid,
212
- abha_address: profile?.abha_address,
213
- abha_number: profile?.abha_number,
214
- });
215
- }
216
-
217
- const gender = validGenders.includes(profile?.gender as any)
218
- ? (profile?.gender as 'M' | 'F' | 'O' | 'U')
219
- : undefined;
220
-
221
- const authProfile: TProfileRecord = {
222
- oid: eka?.oid || '',
223
- fln: profile?.first_name + ' ' + profile?.last_name,
224
- dob: `${profile?.year_of_birth}-${String(profile?.month_of_birth).padStart(2, '0')}-${String(profile?.day_of_birth).padStart(2, '0')}`,
225
- gen: gender,
226
- mobile: profile?.mobile,
227
- at: '',
228
- fn: profile?.first_name || '',
229
- mn: profile?.middle_name || '',
230
- ln: profile?.last_name || '',
231
- 'health-ids': profile?.abha_address ? [profile.abha_address] : undefined,
232
- abha_number: profile?.abha_number || '',
233
- };
234
-
235
- // ABHA_V3_SKIP_STATES.ABHA_END
236
- if (skip_state === ABHA_V3_SKIP_STATES.ABHA_END) {
237
- /**
238
- * check for min_token and oid
239
- * if min_token is present, call auth verify
240
- * if not show error
241
- */
242
- // if the auth token and oid is present in the headers, then do not trigger auth verify api
243
- if (isEkaAppLogin) {
244
- trackAbhaEvent({
245
- name: 'abha_login_otp_verify_eka_app',
246
- data: {
247
- type: 'verify',
248
- platform: clientId,
249
- txn_id: txnId,
250
- skip_state: skip_state,
251
- },
252
- });
253
- setAbdmLoginVerifyApiStatus(LOADING_STATE.RESOLVED);
254
- if (!eka) {
255
- trackAbhaEvent({
256
- name: 'abha_login_otp_verify_eka_app_error',
257
- data: {
258
- type: 'null_oid',
259
- platform: clientId,
260
- txn_id: txnId || 'missing_txn_id',
261
- txn_id_exists: !!txnId,
262
- eka: eka || 'missing_eka',
263
- eka_exists: !!eka,
264
- skip_state: skip_state || 'missing_skip_state',
265
- skip_state_exists: !!skip_state,
266
- },
267
- });
268
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
269
- setError('Something went wrong, please try again');
270
- return;
271
- }
272
-
273
- const authResponse = getMockAuthVerifyResponse(authProfile);
274
- // for ios specific handling
275
- trackAbhaEvent({
276
- name: 'abha_login_otp_verify_success',
277
- data: {
278
- type: 'verify',
279
- platform: clientId,
280
- txn_id: txnId,
281
- skip_state: skip_state,
282
- method: abhaAuthFlowMethod,
283
- },
284
- });
285
- if (window.EkaAbha && window.EkaAbha.onAbhaSuccess) {
286
- window.EkaAbha?.onAbhaSuccess(JSON.stringify({ response: authResponse }));
287
- return;
288
- }
289
- //@ts-ignore
290
- onAbhaSuccess({ response: authResponse });
291
- unMount();
292
- return;
293
- }
294
- if (!eka || !eka.min_token || !authTxnId) {
295
- trackAbhaEvent({
296
- name: 'abha_login_otp_verify_eka_error',
297
- data: {
298
- type: 'verify',
299
- platform: clientId,
300
- eka: eka || 'missing_eka',
301
- eka_exists: !!eka,
302
- auth_txnId: authTxnId || 'missing_auth_txnId',
303
- auth_txnId_exists: !!authTxnId,
304
- skip_state: skip_state || 'missing_skip_state',
305
- skip_state_exists: !!skip_state,
306
- },
307
- });
308
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
309
- setError('Something went wrong, please try again');
310
- return;
311
- }
312
-
313
- const authVerifyResponse = await postAuthVerifyV2Mutate({
314
- txn_id: authTxnId,
315
- token: eka.min_token,
316
- ...(eka.oid ? { oid: eka.oid } : null),
317
- });
318
-
319
- if (!authVerifyResponse.data) {
320
- trackAbhaEvent({
321
- name: 'abha_login_otp_verify_auth_verify_error',
322
- data: {
323
- type: 'verify',
324
- platform: clientId,
325
- skip_state: skip_state || 'missing_skip_state',
326
- skip_state_exists: !!skip_state,
327
- auth_verify_data_exists: false,
328
- },
329
- });
330
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
331
- setError(authVerifyResponse.error?.message || 'Something went wrong, please try again');
332
- return;
333
- }
334
-
335
- trackAbhaEvent({
336
- name: 'abha_login_otp_verify_abha_end_success',
337
- data: {
338
- type: 'verify',
339
- platform: clientId,
340
- txn_id: txnId,
341
- skip_state: skip_state,
342
- },
343
- });
344
- setAbdmLoginVerifyApiStatus(LOADING_STATE.RESOLVED);
345
- return;
346
- }
347
-
348
- // ABHA_V3_SKIP_STATES.ABHA_SELECT
349
- if (skip_state === ABHA_V3_SKIP_STATES.ABHA_SELECT && abha_profiles.length > 0) {
350
- trackAbhaEvent({
351
- name: 'abha_login_otp_verify_abha_select',
352
- data: {
353
- type: 'verify',
354
- platform: clientId,
355
- },
356
- });
357
- setScreen(SCREEN_NAMES.SELECT_ABHA_FROM_LIST);
358
- setAbhaAddressList(abha_profiles);
359
- return;
360
- }
361
-
362
- // ABHA_V3_SKIP_STATES.ABHA_CREATE && LOGIN METHOD IS MOBILE
363
- if (
364
- skip_state === ABHA_V3_SKIP_STATES.ABHA_CREATE &&
365
- abhaAuthFlowMethod === ABHA_AUTH_FLOW_METHOD.MOBILE
366
- ) {
367
- setScreen(SCREEN_NAMES.CREATE_EKA_PROFILE);
368
- return;
369
- }
370
-
371
- // ABHA_V3_SKIP_STATES.ABHA_CREATE && LOGIN METHOD IS ABHA NUMBER
372
- if (skip_state === ABHA_V3_SKIP_STATES.ABHA_CREATE) {
373
- setScreen(SCREEN_NAMES.CREATE_ABHA_ADDRESS);
374
- return;
375
- }
376
-
377
- // if the auth token and oid is present in the headers, then do not trigger auth verify api
378
- if (isEkaAppLogin) {
379
- if (!eka) {
380
- trackAbhaEvent({
381
- name: 'abha_login_otp_verify_eka_failed',
382
- data: {
383
- type: 'verify',
384
- platform: clientId,
385
- txn_id: authTxnId || 'missing_authTxnId',
386
- txn_id_exists: !!authTxnId,
387
- },
388
- });
389
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
390
- setError('Something went wrong, please try again');
391
- return;
392
- }
393
- const authResponse = getMockAuthVerifyResponse(authProfile);
394
-
395
- setAbdmLoginVerifyApiStatus(LOADING_STATE.RESOLVED);
396
- // for ios specific handling
397
- if (window.EkaAbha && window.EkaAbha.onAbhaSuccess) {
398
- window.EkaAbha?.onAbhaSuccess(JSON.stringify({ response: authResponse }));
399
- return;
400
- }
401
- //@ts-ignore
402
- onAbhaSuccess({ response: authResponse });
403
- unMount();
404
- return;
405
- }
406
-
407
- if (!skip_state || !eka?.min_token) {
408
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
409
- setError(verifyError || 'Something went wrong, please try again');
410
- if (errorAction) {
411
- setBottomsheetErrorInfo(errorAction);
412
- }
413
- return;
414
- }
415
-
416
- if (eka.min_token && authTxnId) {
417
- const authVerifyResponse = await postAuthVerifyV2Mutate({
418
- txn_id: authTxnId,
419
- token: eka.min_token,
420
- });
421
-
422
- if (!authVerifyResponse.data) {
423
- trackAbhaEvent({
424
- name: 'abha_login_auth_verify_failed',
425
- data: {
426
- platform: clientId,
427
- txn_id: authTxnId || 'missing_authTxnId',
428
- txn_id_exists: !!authTxnId,
429
- error_message: authVerifyResponse?.error?.message || 'unknown_error',
430
- error_message_exists: !!authVerifyResponse?.error?.message,
431
- },
432
- });
433
- setAbdmLoginVerifyApiStatus(LOADING_STATE.REJECTED);
434
- setError(authVerifyResponse.error?.message || 'Something went wrong, please try again');
435
- } else {
436
- trackAbhaEvent({
437
- name: 'abha_login_auth_verify_success',
438
- data: {
439
- platform: clientId,
440
- txn_id: authTxnId,
441
- },
442
- });
443
- }
444
- }
445
-
446
- setAbdmLoginVerifyApiStatus(LOADING_STATE.RESOLVED);
447
- };
448
-
449
- const handleResendOtpClick = async () => {
450
- if (loginIdentifierValue && abhaAuthFlowMethod) {
451
- const { txn_id } = await postAbdmLoginInit({
452
- method: abhaAuthFlowMethod,
453
- identifier: loginIdentifierValue,
454
- });
455
- trackAbhaEvent({
456
- name: 'abha_login_verify_resend_otp',
457
- data: {
458
- method: abhaAuthFlowMethod,
459
- platform: clientId,
460
- txn_id: txn_id,
461
- },
462
- });
463
- if (txn_id) {
464
- setTxnId(txn_id);
465
- }
466
- }
467
- };
468
-
469
- return (
470
- <div className="pds2-flex pds2-flex-col pds2-w-full pds2-h-screen pds2-bg-bg-white">
471
- <AbhaHeader
472
- prefixIcon={
473
- <button
474
- className="pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple"
475
- onClick={() => setIsExitPopupOpen(true)}
476
- >
477
- <ArrowLeftRegularIcon className="" />
478
- </button>
479
- }
480
- title="OTP Verification"
481
- suffixIcon={<EkaIcon className="pds2-w-20 pds2-h-20" />}
482
- className="pds2-border-b-1 pds2-border-bg-seperator-dark"
483
- />
484
- <div className="pds2-p-16 pds2-space-y-16 pds2-overflow-y-scroll pds2-flex-1">
485
- <AbhaOtpCard
486
- otpSentToText={
487
- aadhaarOtpSentToHint || 'Enter OTP sent on mobile number linked with your Aadhaar'
488
- }
489
- onOtpCompletion={handleOtpCompletion}
490
- onResendOtpClick={handleResendOtpClick}
491
- error={error}
492
- setIsValid={(val) => {
493
- error && setError(null);
494
- setIsOtpValid(val);
495
- }}
496
- prefixIcon={
497
- <img
498
- src="https://cdn.eka.care/vagus/cm6hreldp000b0tfwf0nj156l.webp"
499
- alt="abha"
500
- className="pds2-w-48"
501
- />
502
- }
503
- />
504
- </div>
505
- {/* removing this error , since it is handled inside otp card */}
506
- {/* {error && <div className="pds2-p-16 pds2-text-text-error pds2-text-center">{error}</div>} */}
507
- <div className="pds2-p-16 pds2-sticky pds2-bottom-0 pds2-bg-bg-white pds2-w-full pds2-border pds2-border-border-brand-02">
508
- <Pds2Button
509
- title="Verify"
510
- state={abdmLoginVerifyApiStatus === LOADING_STATE.LOADING ? 'disabled' : 'enabled'}
511
- className="pds2-w-full"
512
- onClick={() => handleVerifyClick(otp)}
513
- isLoading={abdmLoginVerifyApiStatus === LOADING_STATE.LOADING}
514
- />
515
- </div>
516
-
517
- <AbhaErrorBottomSheet onSubmitClick={handleErrorBottomsheetButtonClick} />
518
- <ExitPopup open={isExitPopupOpen} setOpen={setIsExitPopupOpen} />
519
- </div>
520
- );
521
- };
522
-
523
- export default AbhaLoginOtpVerifyScreen;