@eka-care/abha-stg 0.1.0 → 0.1.2
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/{index.html → dist/index.html} +2 -1
- package/dist/sdk/abha/css/abha.css +1 -0
- package/dist/sdk/abha/js/abha.js +63 -0
- package/package.json +1 -1
- package/.eslintignore +0 -3
- package/.eslintrc +0 -29
- package/.prettierrc +0 -7
- package/.turbo/daemon/da13e0828a6aedf8-turbo.log.2025-10-30 +0 -0
- package/package/styles/pds2/border.ts +0 -69
- package/package/styles/pds2/colors.ts +0 -70
- package/package/styles/pds2/spacing.ts +0 -1007
- package/package/tailwind/tailwind.config.ts +0 -124
- package/postcss.config.js +0 -6
- package/scripts/build-purged-css.cjs +0 -70
- package/src/App.css +0 -0
- package/src/App.tsx +0 -43
- package/src/api-queries/aorta-go/v3/get-profile-patient.ts +0 -32
- package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +0 -26
- package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +0 -34
- package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +0 -32
- package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +0 -38
- package/src/api-queries/aorta-go/v3/post-profile-switch.ts +0 -39
- package/src/api-queries/ndhm/get-abdm-register-suggest.ts +0 -37
- package/src/api-queries/ndhm/get-pincode-details.ts +0 -28
- package/src/api-queries/ndhm/post-abdm-login-init.ts +0 -37
- package/src/api-queries/ndhm/post-abdm-login-phr.ts +0 -37
- package/src/api-queries/ndhm/post-abdm-login-verify.ts +0 -37
- package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +0 -40
- package/src/api-queries/ndhm/post-abdm-profile-eka.ts +0 -66
- package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +0 -37
- package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +0 -66
- package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +0 -32
- package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +0 -38
- package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +0 -34
- package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +0 -37
- package/src/api-queries/ndhm/post-register-aadhaar-init.ts +0 -34
- package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +0 -34
- package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +0 -37
- package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +0 -34
- package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +0 -40
- package/src/api-queries/ndhm/post-register-mobile-init.ts +0 -34
- package/src/api-queries/use-get-profiles-patient.ts +0 -12
- package/src/api-queries/use-get-profiles-phr-user.ts +0 -28
- package/src/api-queries/use-post-abdm-login-verify-v1.ts +0 -26
- package/src/api-queries/use-post-auth-verify-v2.ts +0 -50
- package/src/api-queries/use-post-profile-switch.ts +0 -58
- package/src/api-queries/use-post-register-mobile-create-phr.ts +0 -39
- package/src/api-queries/user-post-abdm-profile-login-phr.ts +0 -26
- package/src/assets/Success.json +0 -1
- package/src/assets/react.svg +0 -1
- package/src/atoms/button/custom-button.tsx +0 -32
- package/src/atoms/button/index.tsx +0 -40
- package/src/atoms/button/types.d.ts +0 -31
- package/src/atoms/header.tsx +0 -25
- package/src/atoms/input-field/index.tsx +0 -63
- package/src/atoms/input-field/patient-input-field.tsx +0 -16
- package/src/atoms/input-field/types.ts +0 -24
- package/src/atoms/pds2-otp-input/index.tsx +0 -35
- package/src/atoms/pds2-otp-input/types.d.ts +0 -3
- package/src/atoms/single-input-chip/index.tsx +0 -32
- package/src/atoms/single-input-chip/types.ts +0 -6
- package/src/atoms/spinner.tsx +0 -33
- package/src/atoms/text-separator.tsx +0 -11
- package/src/atoms/ui/spinner.tsx +0 -75
- package/src/constants/constants.ts +0 -376
- package/src/fetch-client/index.ts +0 -164
- package/src/index.css +0 -152
- package/src/main.tsx +0 -374
- package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +0 -40
- package/src/molecules/abha/bottom-sheet/index.tsx +0 -66
- package/src/molecules/abha/spaced-input-component.tsx +0 -168
- package/src/molecules/copyright-year.tsx +0 -16
- package/src/molecules/exit-popup/index.tsx +0 -101
- package/src/molecules/pds2-otp-component/index.tsx +0 -147
- package/src/organisms/abha/abha-header.tsx +0 -25
- package/src/organisms/abha/abha-stepper.tsx +0 -83
- package/src/organisms/abha/error-bottom-sheet.tsx +0 -27
- package/src/organisms/abha/otp-card.tsx +0 -99
- package/src/organisms/abha/verification-status.tsx +0 -30
- package/src/organisms/choose-language/choose-language.tsx +0 -53
- package/src/organisms/choose-language/types.ts +0 -10
- package/src/organisms/screen-switcher/screen-switcher.tsx +0 -80
- package/src/routes/abha-aadhaar-verification-status-screen.tsx +0 -246
- package/src/routes/abha-created-screen.tsx +0 -45
- package/src/routes/abha-login-otp-verify-screen.tsx +0 -519
- package/src/routes/abha-mobile-linking-status-screen.tsx +0 -267
- package/src/routes/abha-otp-and-mobile-screen.tsx +0 -435
- package/src/routes/abha-phone-number-verification-screen.tsx +0 -388
- package/src/routes/create-abha-address-screen.tsx +0 -928
- package/src/routes/create-abha-with-aadhaar-screen.tsx +0 -986
- package/src/routes/create-eka-profile-screen.tsx +0 -831
- package/src/routes/get-all-profiles-screen.tsx +0 -161
- package/src/routes/login-or-create-abha-address-screen.tsx +0 -1056
- package/src/routes/login-with-abha-screen.tsx +0 -454
- package/src/routes/select-abha-from-list-screen.tsx +0 -792
- package/src/routes/select-eka-profile-screen.tsx +0 -446
- package/src/routes/utils/trackAbhaEvent.ts +0 -41
- package/src/stores/auth-abha-store/index.ts +0 -152
- package/src/stores/auth-abha-store/types.ts +0 -217
- package/src/utils/mock-auth-response.ts +0 -29
- package/src/utils/send-event-utils.ts +0 -76
- package/src/utils/validations.ts +0 -89
- package/src/vite-env.d.ts +0 -1
- package/tailwind.config.ts +0 -9
- package/tsconfig.json +0 -25
- package/tsconfig.node.json +0 -10
- package/tsconfig.node.tsbuildinfo +0 -1
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.d.ts +0 -2
- package/vite.config.js +0 -45
- package/vite.config.ts +0 -50
- /package/{public → dist}/images/adhaar.webp +0 -0
- /package/{public → dist}/images/at-the-rate.webp +0 -0
- /package/{public → dist}/images/avatar.webp +0 -0
- /package/{public → dist}/images/ayushman-bharat.webp +0 -0
- /package/{public → dist}/images/circle-checkmark.webp +0 -0
- /package/{public → dist}/images/link-abha.webp +0 -0
- /package/{public → dist}/images/national-authority.webp +0 -0
- /package/{public → dist}/images/three-dots.webp +0 -0
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import { ArrowLeftRegularIcon, PlusRegularIcon } from '@eka-care/icons';
|
|
2
|
-
import {
|
|
3
|
-
ABHA_V3_SKIP_STATES,
|
|
4
|
-
GET_EXTRA_HEADERS,
|
|
5
|
-
LOADING_STATE,
|
|
6
|
-
TGetProfilePhrUserResponse,
|
|
7
|
-
TProfileRecord,
|
|
8
|
-
} from '../constants/constants';
|
|
9
|
-
import { useState, useEffect } from 'react';
|
|
10
|
-
import usePostProfileSwitch from '../api-queries/use-post-profile-switch';
|
|
11
|
-
import { queryClient } from '../App';
|
|
12
|
-
import Pds2Button from '../atoms/button';
|
|
13
|
-
import Pds2CustomButton from '../atoms/button/custom-button';
|
|
14
|
-
import Pds2Header from '../atoms/header';
|
|
15
|
-
import TextSeparator from '../atoms/text-separator';
|
|
16
|
-
import ExitPopup from '../molecules/exit-popup';
|
|
17
|
-
import AbhaErrorBottomSheet from '../organisms/abha/error-bottom-sheet';
|
|
18
|
-
import useAuthAbhaStore from '../stores/auth-abha-store';
|
|
19
|
-
import { SCREEN_NAMES } from '../stores/auth-abha-store/types';
|
|
20
|
-
|
|
21
|
-
import AbhaStepper from '../organisms/abha/abha-stepper';
|
|
22
|
-
import handleSendEvent from '../utils/send-event-utils';
|
|
23
|
-
import postAbdmProfileEkaLinkPhr from '../api-queries/ndhm/post-abdm-profile-eka-link-phr';
|
|
24
|
-
|
|
25
|
-
const SelectEkaProfileScreen = () => {
|
|
26
|
-
const setScreen = useAuthAbhaStore((state) => state.setScreen);
|
|
27
|
-
const setEkaProfileInfo = useAuthAbhaStore((state) => state.setEkaProfileInfo);
|
|
28
|
-
const registrationType = useAuthAbhaStore((state) => state.registrationType);
|
|
29
|
-
const goBackLoginScreen = useAuthAbhaStore((state) => state.goBackLoginScreen);
|
|
30
|
-
const [selectedProfileOid, setSelectedProfileOid] = useState<string | null>(null);
|
|
31
|
-
const setBottomsheetErrorInfo = useAuthAbhaStore((state) => state.setBottomsheetErrorInfo);
|
|
32
|
-
const clearAbhaAuthStore = useAuthAbhaStore((state) => state.clearAbhaAuthStore);
|
|
33
|
-
const [isLoading, setIsLoading] = useState<LOADING_STATE>(LOADING_STATE.IDLE);
|
|
34
|
-
const [isExitPopupOpen, setIsExitPopupOpen] = useState<boolean>(false);
|
|
35
|
-
const [error, setError] = useState<string | null>(null);
|
|
36
|
-
const dummyEkaProfiles: TProfileRecord[] = [
|
|
37
|
-
{
|
|
38
|
-
oid: '1',
|
|
39
|
-
fln: 'Eka Profile 1',
|
|
40
|
-
dob: '1990-01-01',
|
|
41
|
-
gen: 'M',
|
|
42
|
-
fn: 'Eka',
|
|
43
|
-
ln: 'Profile 1',
|
|
44
|
-
at: 'eka',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
oid: '2',
|
|
48
|
-
fln: 'Eka Profile 2',
|
|
49
|
-
dob: '1992-02-02',
|
|
50
|
-
gen: 'F',
|
|
51
|
-
fn: 'Eka',
|
|
52
|
-
ln: 'Profile 2',
|
|
53
|
-
at: 'eka',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
oid: '3',
|
|
57
|
-
fln: 'Eka Profile 3',
|
|
58
|
-
dob: '1994-03-03',
|
|
59
|
-
gen: 'M',
|
|
60
|
-
fn: 'Eka',
|
|
61
|
-
ln: 'Profile 3',
|
|
62
|
-
at: 'eka',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
oid: '4',
|
|
66
|
-
fln: 'Eka Profile 4',
|
|
67
|
-
dob: '1996-04-04',
|
|
68
|
-
gen: 'F',
|
|
69
|
-
fn: 'Eka',
|
|
70
|
-
ln: 'Profile 4',
|
|
71
|
-
at: 'eka',
|
|
72
|
-
},
|
|
73
|
-
];
|
|
74
|
-
const selectedAbhaAddress = useAuthAbhaStore((state) => state.selectedAbhaAddress);
|
|
75
|
-
const aadhaarVerificationSkipStateStatus = useAuthAbhaStore(
|
|
76
|
-
(state) => state.aadhaarVerificationSkipStateStatus
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const { mutateAsync: postProfileSwitchMutate } = usePostProfileSwitch();
|
|
80
|
-
const profilesPhrResponse = queryClient.getQueryData<TGetProfilePhrUserResponse>([
|
|
81
|
-
'profilesPhrUserResponse',
|
|
82
|
-
]);
|
|
83
|
-
|
|
84
|
-
const clientId = useAuthAbhaStore((state) => state.clientId);
|
|
85
|
-
const isEkaAppLogin = useAuthAbhaStore((state) => state.isEkaAppLogin);
|
|
86
|
-
const isNewLoginOrCreateFlow = useAuthAbhaStore((state) => state.isNewLoginOrCreateFlow);
|
|
87
|
-
const txnId = useAuthAbhaStore((state) => state.txnId);
|
|
88
|
-
const extra_headers = GET_EXTRA_HEADERS();
|
|
89
|
-
const selectedMethod = useAuthAbhaStore((state) => state.abhaAuthFlowMethod);
|
|
90
|
-
|
|
91
|
-
// Analytics event tracker
|
|
92
|
-
const trackAbhaEvent = ({ name, data = {} }: { name: string; data?: Record<string, any> }) => {
|
|
93
|
-
const baseProps = {
|
|
94
|
-
login_platform: clientId,
|
|
95
|
-
is_eka_app_login: isEkaAppLogin ? 'true' : 'false',
|
|
96
|
-
is_new_login_or_create_flow: isNewLoginOrCreateFlow ? 'true' : 'false',
|
|
97
|
-
txn_id: txnId || 'missing txnId',
|
|
98
|
-
oid: extra_headers?.['X-User-ID'] ? 'true' : 'false',
|
|
99
|
-
access_token: extra_headers?.['auth'] ? 'true' : 'false',
|
|
100
|
-
flow: selectedMethod ?? ""
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const eventData = {
|
|
104
|
-
...baseProps,
|
|
105
|
-
...data,
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
handleSendEvent({
|
|
109
|
-
eventName: name,
|
|
110
|
-
eventData,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
window.curio?.pushToMixpanel?.(name, eventData);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
// Track page view event when component mounts or clientId changes
|
|
118
|
-
trackAbhaEvent({
|
|
119
|
-
name: 'choose_eka_profile_screen',
|
|
120
|
-
data: {
|
|
121
|
-
platform: clientId,
|
|
122
|
-
type: 'select',
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
}, [clientId]);
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Handler for clicking on "Create Family Profile" button.
|
|
129
|
-
* Tracks user intent and navigates to the appropriate screen based on ABHA skip state.
|
|
130
|
-
*/
|
|
131
|
-
const handleCreateFamilyClick = () => {
|
|
132
|
-
// Track the click on create family profile button with skip state info
|
|
133
|
-
trackAbhaEvent({
|
|
134
|
-
name: 'create_family_profile_clicks',
|
|
135
|
-
data: {
|
|
136
|
-
platform: clientId,
|
|
137
|
-
type: 'create',
|
|
138
|
-
skip_state: aadhaarVerificationSkipStateStatus,
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// Conditional navigation based on ABHA skip state
|
|
143
|
-
if (aadhaarVerificationSkipStateStatus === ABHA_V3_SKIP_STATES.ABHA_END) {
|
|
144
|
-
// User has completed ABHA verification, navigate to PHR Eka profile creation
|
|
145
|
-
trackAbhaEvent({
|
|
146
|
-
name: 'navigate_to_create_phr_profile_screen',
|
|
147
|
-
data: {
|
|
148
|
-
platform: clientId,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
setScreen(SCREEN_NAMES.CREATE_PHR_EKA_PROFILE);
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
// Otherwise, navigate to standard Eka profile creation screen
|
|
155
|
-
trackAbhaEvent({
|
|
156
|
-
name: 'navigate_to_create_eka_profile_screen',
|
|
157
|
-
data: {
|
|
158
|
-
platform: clientId,
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
setScreen(SCREEN_NAMES.CREATE_EKA_PROFILE);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Handler when the user selects an existing profile from the list.
|
|
166
|
-
* Tracks the selected profile's OID.
|
|
167
|
-
*/
|
|
168
|
-
const handleSelectProfile = async ({ profile }: { profile: TProfileRecord }) => {
|
|
169
|
-
// Track profile selection event with profile OID and platform info
|
|
170
|
-
trackAbhaEvent({
|
|
171
|
-
name: 'select_profile_clicks',
|
|
172
|
-
data: {
|
|
173
|
-
platform: clientId,
|
|
174
|
-
oid: profile.oid,
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
setSelectedProfileOid(profile.oid);
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Handler for the Continue button click after selecting a profile.
|
|
182
|
-
* Handles profile creation, linking, and switching with detailed event tracking.
|
|
183
|
-
*/
|
|
184
|
-
const handleContinueClick = async () => {
|
|
185
|
-
// Track continue click event with selected profile and registration context
|
|
186
|
-
trackAbhaEvent({
|
|
187
|
-
name: 'continue_click_on_choose_eka_profile',
|
|
188
|
-
data: {
|
|
189
|
-
platform: clientId,
|
|
190
|
-
selectedProfileOid,
|
|
191
|
-
registrationType,
|
|
192
|
-
skip_state: aadhaarVerificationSkipStateStatus,
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
// If ABHA skip state requires profile creation flow, prepare profile info and navigate
|
|
196
|
-
if (
|
|
197
|
-
selectedProfileOid &&
|
|
198
|
-
aadhaarVerificationSkipStateStatus === ABHA_V3_SKIP_STATES.ABHA_CREATE
|
|
199
|
-
) {
|
|
200
|
-
// Find profile details in response by OID
|
|
201
|
-
const profileToStore = profilesPhrResponse?.profiles.find(
|
|
202
|
-
(profile) => profile.oid === selectedProfileOid
|
|
203
|
-
);
|
|
204
|
-
// Track missing profile case and abort if profile not found
|
|
205
|
-
if (!profileToStore) {
|
|
206
|
-
trackAbhaEvent({
|
|
207
|
-
name: 'continue_click_profile_not_found',
|
|
208
|
-
data: {
|
|
209
|
-
platform: clientId,
|
|
210
|
-
oid: selectedProfileOid || 'unknown_oid',
|
|
211
|
-
oid_exists: !!selectedProfileOid,
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
// Track navigation intent to create Eka profile screen from ABHA create flow
|
|
217
|
-
trackAbhaEvent({
|
|
218
|
-
name: 'navigate_to_create_eka_profile_screen_from_abha_create',
|
|
219
|
-
data: {
|
|
220
|
-
platform: clientId,
|
|
221
|
-
oid: profileToStore.oid,
|
|
222
|
-
},
|
|
223
|
-
});
|
|
224
|
-
// Set Eka profile info state for further steps
|
|
225
|
-
setEkaProfileInfo({
|
|
226
|
-
oid: profileToStore.oid,
|
|
227
|
-
date_of_birth: profileToStore.dob as string,
|
|
228
|
-
firstname: profileToStore.fn,
|
|
229
|
-
lastname: profileToStore.ln as string,
|
|
230
|
-
pincode: '',
|
|
231
|
-
gender: profileToStore.gen as string,
|
|
232
|
-
mobile: profileToStore.mobile as string,
|
|
233
|
-
name: profileToStore.fln as string,
|
|
234
|
-
middlename: profileToStore.mn as string,
|
|
235
|
-
abha_address: profileToStore?.['health-ids']?.[0],
|
|
236
|
-
abha_number: profileToStore.abha_number,
|
|
237
|
-
});
|
|
238
|
-
// Navigate to profile creation screen
|
|
239
|
-
setScreen(SCREEN_NAMES.CREATE_EKA_PROFILE);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
// If essential inputs missing, track and abort early
|
|
243
|
-
if (!selectedAbhaAddress || !selectedProfileOid) {
|
|
244
|
-
trackAbhaEvent({
|
|
245
|
-
name: 'continue_click_missing_profile_or_abha',
|
|
246
|
-
data: {
|
|
247
|
-
platform: clientId,
|
|
248
|
-
oid: selectedProfileOid || 'missing_oid',
|
|
249
|
-
oid_exists: !!selectedProfileOid,
|
|
250
|
-
},
|
|
251
|
-
});
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
// Track the start of linking ABHA address to selected profile
|
|
255
|
-
trackAbhaEvent({
|
|
256
|
-
name: 'linking_abha_to_profile_start',
|
|
257
|
-
data: {
|
|
258
|
-
platform: clientId,
|
|
259
|
-
oid: selectedProfileOid || 'missing_oid',
|
|
260
|
-
oid_exists: !!selectedProfileOid,
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
setIsLoading(LOADING_STATE.LOADING);
|
|
265
|
-
|
|
266
|
-
// Attempt linking the ABHA profile
|
|
267
|
-
const {
|
|
268
|
-
error: linkPhrError,
|
|
269
|
-
action: errorAction,
|
|
270
|
-
eka,
|
|
271
|
-
} = await postAbdmProfileEkaLinkPhr({
|
|
272
|
-
abha_address: selectedAbhaAddress,
|
|
273
|
-
oid: selectedProfileOid,
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
// Handle any error action returned by the API and track it
|
|
277
|
-
if (errorAction) {
|
|
278
|
-
trackAbhaEvent({
|
|
279
|
-
name: 'linking_abha_to_profile_error_action',
|
|
280
|
-
data: {
|
|
281
|
-
platform: clientId,
|
|
282
|
-
oid: selectedProfileOid || 'missing_oid',
|
|
283
|
-
oid_exists: !!selectedProfileOid,
|
|
284
|
-
},
|
|
285
|
-
});
|
|
286
|
-
setBottomsheetErrorInfo(errorAction);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Handle linking errors or missing eka data, track failure event
|
|
291
|
-
if (linkPhrError || !eka || !eka.oid) {
|
|
292
|
-
trackAbhaEvent({
|
|
293
|
-
name: 'linking_abha_to_profile_failed',
|
|
294
|
-
data: {
|
|
295
|
-
platform: clientId,
|
|
296
|
-
oid: selectedProfileOid || 'missing_oid',
|
|
297
|
-
oid_exists: !!selectedProfileOid,
|
|
298
|
-
error: linkPhrError || 'No EKA/OID',
|
|
299
|
-
error_exists: !!linkPhrError,
|
|
300
|
-
},
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
setIsLoading(LOADING_STATE.REJECTED);
|
|
304
|
-
setError(linkPhrError || 'Something went wrong. Please try again.');
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Attempt to switch profile after successful linking
|
|
309
|
-
const profileSwitchResponse = await postProfileSwitchMutate({
|
|
310
|
-
oid: eka.oid,
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
// Track failure if profile switch errors out
|
|
314
|
-
if (profileSwitchResponse.error) {
|
|
315
|
-
trackAbhaEvent({
|
|
316
|
-
name: 'profile_switch_failed_after_link',
|
|
317
|
-
data: {
|
|
318
|
-
platform: clientId,
|
|
319
|
-
oid: eka?.oid || 'missing_oid',
|
|
320
|
-
oid_exists: !!eka?.oid,
|
|
321
|
-
error: profileSwitchResponse.error?.message || 'unknown_error',
|
|
322
|
-
error_exists: !!profileSwitchResponse.error?.message,
|
|
323
|
-
},
|
|
324
|
-
});
|
|
325
|
-
setIsLoading(LOADING_STATE.REJECTED);
|
|
326
|
-
setError(profileSwitchResponse.error?.message || 'Something went wrong, please try again');
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// Track success of linking and profile switch
|
|
331
|
-
trackAbhaEvent({
|
|
332
|
-
name: 'linking_abha_to_profile_success',
|
|
333
|
-
data: {
|
|
334
|
-
platform: clientId,
|
|
335
|
-
oid: eka.oid,
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
// Mark loading as resolved to allow next steps
|
|
340
|
-
setIsLoading(LOADING_STATE.RESOLVED);
|
|
341
|
-
return;
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const handleErrorBottomsheetButtonClick = () => {
|
|
345
|
-
goBackLoginScreen();
|
|
346
|
-
const isAppLogin = useAuthAbhaStore.getState().isEkaAppLogin;
|
|
347
|
-
clearAbhaAuthStore();
|
|
348
|
-
useAuthAbhaStore.setState({ isEkaAppLogin: isAppLogin });
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
return (
|
|
352
|
-
<div className="pds2-w-full pds2-h-full pds2-flex pds2-flex-col pds2-bg-bg-01">
|
|
353
|
-
<Pds2Header
|
|
354
|
-
title="Select Eka Profile"
|
|
355
|
-
prefixIcon={
|
|
356
|
-
<button
|
|
357
|
-
className="pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple"
|
|
358
|
-
onClick={() => setIsExitPopupOpen(true)}
|
|
359
|
-
>
|
|
360
|
-
<ArrowLeftRegularIcon />
|
|
361
|
-
</button>
|
|
362
|
-
}
|
|
363
|
-
className="pds2-border-b pds2-border-bg-seperator-dark pds2-bg-bg-white"
|
|
364
|
-
/>
|
|
365
|
-
<AbhaStepper/>
|
|
366
|
-
{/* Main content */}
|
|
367
|
-
<div className="pds2-flex-1 pds2-flex pds2-flex-col pds2-relative pds2-bg-bg-01 pds2-overflow-y-auto">
|
|
368
|
-
{/* Scrollable section constrained to avoid covering sticky button */}
|
|
369
|
-
<div className="pds2-flex-1 pds2-overflow-y-auto pds2-px-16 pds2-pt-24 pds2-pb-32">
|
|
370
|
-
<div className="pds2-space-y-16 pds2-flex pds2-flex-col pds2-items-center pds2-text-center">
|
|
371
|
-
<img
|
|
372
|
-
src="https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp"
|
|
373
|
-
alt="Link ABHA"
|
|
374
|
-
className="pds2-w-163"
|
|
375
|
-
/>
|
|
376
|
-
<div className="pds2-space-y-4">
|
|
377
|
-
<div className="pds2-text-text-01 Heading3Semibold">Choose an Eka Profile</div>
|
|
378
|
-
<span className="Body1Regular pds2-text-text-03">
|
|
379
|
-
Select the person for whom you want to create an ABHA address.
|
|
380
|
-
</span>
|
|
381
|
-
</div>
|
|
382
|
-
</div>
|
|
383
|
-
<div className="pds2-w-full pds2-flex pds2-flex-col pds2-justify-center pds2-space-y-12 pds2-mt-24">
|
|
384
|
-
<div className="pds2-text-text-03 Body2Medium pds2-text-center">Select Eka Profile</div>
|
|
385
|
-
|
|
386
|
-
<div className="pds2-space-y-8">
|
|
387
|
-
{profilesPhrResponse?.profiles?.map((profile) => {
|
|
388
|
-
const isSelected = selectedProfileOid === profile.oid;
|
|
389
|
-
return (
|
|
390
|
-
<label
|
|
391
|
-
key={profile.oid}
|
|
392
|
-
className="pds2-flex pds2-items-center pds2-gap-x-8 pds2-cursor-pointer pds2-p-16 pds2-rounded-16 pds2-bg-bg-white pds2-border
|
|
393
|
-
pds2-border-border-03 hover:pds2-bg-bg-hover-01
|
|
394
|
-
pds2-transition-colors"
|
|
395
|
-
>
|
|
396
|
-
<input
|
|
397
|
-
type="radio"
|
|
398
|
-
name="ekaProfile"
|
|
399
|
-
value={profile.oid}
|
|
400
|
-
checked={isSelected}
|
|
401
|
-
onChange={() => handleSelectProfile({ profile })}
|
|
402
|
-
className="pds2-self-start pds2-mt-4 pds2-w-14 pds2-h-14"
|
|
403
|
-
onKeyDown={(e)=> e.key==="Enter" && handleContinueClick()}
|
|
404
|
-
/>
|
|
405
|
-
<div className="pds2-flex pds2-flex-row pds2-items-center pds2-gap-x-8 pds2-flex-1">
|
|
406
|
-
<div className="TitlesSubheadline pds2-text-text-primary">{profile.fln}</div>
|
|
407
|
-
<span className="pds2-ml-auto pds2-text-text-brand pds2-text-14 pds2-font-600">
|
|
408
|
-
Link
|
|
409
|
-
</span>
|
|
410
|
-
</div>
|
|
411
|
-
</label>
|
|
412
|
-
);
|
|
413
|
-
})}
|
|
414
|
-
</div>
|
|
415
|
-
|
|
416
|
-
{/* Create new family member option - Now properly at the end of all profiles */}
|
|
417
|
-
<TextSeparator title="or" />
|
|
418
|
-
<Pds2CustomButton
|
|
419
|
-
title="Create new Family Member"
|
|
420
|
-
prefixIcon={<PlusRegularIcon />}
|
|
421
|
-
className="pds2-justify-center pds2-text-text-brand pds2-border-bg-fab-bg-brand-04 Body1Semibold"
|
|
422
|
-
onClick={handleCreateFamilyClick}
|
|
423
|
-
/>
|
|
424
|
-
</div>
|
|
425
|
-
</div>
|
|
426
|
-
|
|
427
|
-
{/* Sticky bottom button */}
|
|
428
|
-
<div className="pds2-sticky pds2-bottom-0 pds2-left-0 pds2-right-0 pds2-bg-bg-white pds2-shadow-lg pds2-p-16">
|
|
429
|
-
{error && <div className="pds2-text-text-error pds2-text-center pds2-mb-8">{error}</div>}
|
|
430
|
-
<Pds2Button
|
|
431
|
-
title="Continue"
|
|
432
|
-
state={selectedProfileOid === null || isLoading === LOADING_STATE.LOADING ? 'disabled' : 'enabled'}
|
|
433
|
-
isLoading={isLoading === LOADING_STATE.LOADING}
|
|
434
|
-
className="pds2-w-full"
|
|
435
|
-
onClick={handleContinueClick}
|
|
436
|
-
/>
|
|
437
|
-
</div>
|
|
438
|
-
</div>
|
|
439
|
-
|
|
440
|
-
<AbhaErrorBottomSheet onSubmitClick={handleErrorBottomsheetButtonClick} />
|
|
441
|
-
<ExitPopup open={isExitPopupOpen} setOpen={setIsExitPopupOpen} />
|
|
442
|
-
</div>
|
|
443
|
-
);
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
export default SelectEkaProfileScreen;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import useAuthAbhaStore from '../../stores/auth-abha-store';
|
|
2
|
-
import { GET_EXTRA_HEADERS } from '../../constants/constants';
|
|
3
|
-
import handleSendEvent from '../../utils/send-event-utils';
|
|
4
|
-
|
|
5
|
-
type TrackAbhaEventParams = {
|
|
6
|
-
name: string;
|
|
7
|
-
data?: Record<string, any>;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const useTrackAbhaEvent = () => {
|
|
11
|
-
const isNewLoginOrCreateFlow = useAuthAbhaStore((state) => state.isNewLoginOrCreateFlow);
|
|
12
|
-
const isEkaAppLogin = useAuthAbhaStore((state) => state.isEkaAppLogin);
|
|
13
|
-
const clientId = useAuthAbhaStore((state) => state.clientId);
|
|
14
|
-
|
|
15
|
-
return ({ name, data = {} }: TrackAbhaEventParams) => {
|
|
16
|
-
const extraHeaders: Record<string, string> | null = GET_EXTRA_HEADERS();
|
|
17
|
-
|
|
18
|
-
const authToken = extraHeaders?.['auth'] || '';
|
|
19
|
-
const xId = extraHeaders?.['X-User-ID'] || '';
|
|
20
|
-
|
|
21
|
-
const baseProps = {
|
|
22
|
-
auth: authToken || 'missing authToken',
|
|
23
|
-
x_id: xId || 'missing xId',
|
|
24
|
-
login_platform: clientId,
|
|
25
|
-
is_eka_app_login: isEkaAppLogin ? 'true' : 'false',
|
|
26
|
-
is_new_login_or_create_flow: isNewLoginOrCreateFlow ? 'true' : 'false',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const eventData = {
|
|
30
|
-
...baseProps,
|
|
31
|
-
...data,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// Analytics calls
|
|
35
|
-
window.curio?.pushToMixpanel?.(name, eventData);
|
|
36
|
-
handleSendEvent?.({
|
|
37
|
-
eventName: name,
|
|
38
|
-
eventData,
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { ABHA_AUTH_FLOW_METHOD } from '../../constants/constants';
|
|
2
|
-
import { create } from 'zustand';
|
|
3
|
-
import { SCREEN_NAMES, TAbhaAuthStore, TAbhaAuthStoreInitValues } from './types';
|
|
4
|
-
|
|
5
|
-
const storeInitState: TAbhaAuthStoreInitValues = {
|
|
6
|
-
screen: [SCREEN_NAMES.LOGIN_WITH_ABHA],
|
|
7
|
-
authTxnId: null,
|
|
8
|
-
txnId: null,
|
|
9
|
-
aadhaarOtpSentToHint: null,
|
|
10
|
-
mobileOtpSentToHint: null,
|
|
11
|
-
aadhaarVerificationSkipStateStatus: null,
|
|
12
|
-
ekaSmallToken: null,
|
|
13
|
-
bottomsheetErrorInfo: null,
|
|
14
|
-
abhaAddressList: null,
|
|
15
|
-
loginIdentifierValue: null,
|
|
16
|
-
abhaAuthFlowMethod: null,
|
|
17
|
-
selectedAbhaAddress: null,
|
|
18
|
-
ekaProfileInfo: null,
|
|
19
|
-
registrationType: null,
|
|
20
|
-
initAbhaAppMethod: 'login_or_create_abha',
|
|
21
|
-
initAbhaAppMobileNumber: null,
|
|
22
|
-
initAbhaAppIdentifier: null,
|
|
23
|
-
initAbhaAppIdentifierType: null,
|
|
24
|
-
isEkaAppLogin: false,
|
|
25
|
-
isDocAppRequest: false,
|
|
26
|
-
// this is when user has try login then we no abha error, then show bottomsheet and redirect to create with aadhaar screen,
|
|
27
|
-
isLoggedInFromRedirect: false,
|
|
28
|
-
clientId: '',
|
|
29
|
-
oid: '',
|
|
30
|
-
isApiTriggered: false,
|
|
31
|
-
isNewLoginOrCreateFlow: false,
|
|
32
|
-
selectedAbhaFlow: '',
|
|
33
|
-
isInitApiTriggered: false,
|
|
34
|
-
identityValue : '',
|
|
35
|
-
currentStepperIndex: 1,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const useAuthAbhaStore = create<TAbhaAuthStore>((set, get) => ({
|
|
39
|
-
screen: [SCREEN_NAMES.LOGIN_WITH_ABHA],
|
|
40
|
-
setScreen: (screen) => set((state) => ({ screen: [...state.screen, screen] })),
|
|
41
|
-
goBackScreen: () => {
|
|
42
|
-
const { screen } = get();
|
|
43
|
-
if (screen.length === 0) return null;
|
|
44
|
-
set({ screen: screen.slice(0, -1) });
|
|
45
|
-
return;
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
goBackLoginScreen: () => {
|
|
49
|
-
const { isNewLoginOrCreateFlow } = get();
|
|
50
|
-
const targetScreen = isNewLoginOrCreateFlow
|
|
51
|
-
? SCREEN_NAMES.LOGIN_OR_CREATE_ABHA
|
|
52
|
-
: SCREEN_NAMES.LOGIN_WITH_ABHA;
|
|
53
|
-
|
|
54
|
-
set({ screen: [targetScreen] });
|
|
55
|
-
set({ currentStepperIndex: 1 });
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
setUrlParams: (urlParams) => set({ urlParams }),
|
|
59
|
-
|
|
60
|
-
authTxnId: null,
|
|
61
|
-
|
|
62
|
-
txnId: null,
|
|
63
|
-
setTxnId: (txnId) => set({ txnId }),
|
|
64
|
-
|
|
65
|
-
aadhaarOtpSentToHint: null,
|
|
66
|
-
|
|
67
|
-
setAadhaarInitResponse: (params) => set(params),
|
|
68
|
-
|
|
69
|
-
mobileOtpSentToHint: null,
|
|
70
|
-
|
|
71
|
-
setMobileInitResponse: (params) => set(params),
|
|
72
|
-
|
|
73
|
-
registrationType: null,
|
|
74
|
-
setRegistrationType: (val) => set({ registrationType: val }),
|
|
75
|
-
|
|
76
|
-
aadhaarVerificationSkipStateStatus: null,
|
|
77
|
-
setAadhaarVerificationSkipStateStatus: (status) =>
|
|
78
|
-
set({ aadhaarVerificationSkipStateStatus: status }),
|
|
79
|
-
|
|
80
|
-
bottomsheetErrorInfo: null,
|
|
81
|
-
setBottomsheetErrorInfo: (info) => set({ bottomsheetErrorInfo: info }),
|
|
82
|
-
|
|
83
|
-
ekaSmallToken: null,
|
|
84
|
-
setEkaSmallToken: (token) => set({ ekaSmallToken: token }),
|
|
85
|
-
|
|
86
|
-
abhaAddressList: null,
|
|
87
|
-
setAbhaAddressList: (info) => set({ abhaAddressList: info }),
|
|
88
|
-
|
|
89
|
-
loginIdentifierValue: null,
|
|
90
|
-
setLoginIdentifierValue: (val) => set({ loginIdentifierValue: val }),
|
|
91
|
-
|
|
92
|
-
abhaAuthFlowMethod: ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER,
|
|
93
|
-
setAbhaAuthFlowMethod: (val) => set({ abhaAuthFlowMethod: val }),
|
|
94
|
-
|
|
95
|
-
selectedAbhaAddress: null,
|
|
96
|
-
setSelectedAbhaAddress: (val) => set({ selectedAbhaAddress: val }),
|
|
97
|
-
|
|
98
|
-
ekaProfileInfo: null,
|
|
99
|
-
setEkaProfileInfo: (info) => set({ ekaProfileInfo: info }),
|
|
100
|
-
|
|
101
|
-
initAbhaAppMethod: 'login_or_create_abha',
|
|
102
|
-
setInitAbhaAppMethod: (method) => set({ initAbhaAppMethod: method }),
|
|
103
|
-
|
|
104
|
-
initAbhaAppMobileNumber: null,
|
|
105
|
-
setInitAbhaAppMobileNumber: (val) => set({ initAbhaAppMobileNumber: val }),
|
|
106
|
-
|
|
107
|
-
initAbhaAppIdentifier: null,
|
|
108
|
-
setInitAbhaAppIdentifier: (val) => set({ initAbhaAppIdentifier: val }),
|
|
109
|
-
|
|
110
|
-
initAbhaAppIdentifierType: null,
|
|
111
|
-
setInitAbhaAppIdentifierType: (val) => set({ initAbhaAppIdentifierType: val }),
|
|
112
|
-
|
|
113
|
-
isEkaAppLogin: false,
|
|
114
|
-
setIsEkaAppLogin: (val) => set({ isEkaAppLogin: val }),
|
|
115
|
-
|
|
116
|
-
isDocAppRequest: false,
|
|
117
|
-
setIsDocAppRequest: (val) => set({ isDocAppRequest: val }),
|
|
118
|
-
|
|
119
|
-
setInitState: (initState) => set(initState),
|
|
120
|
-
|
|
121
|
-
isLoggedInFromRedirect: false,
|
|
122
|
-
setIsLoggedInFromRedirect: (val) => set({ isLoggedInFromRedirect: val }),
|
|
123
|
-
|
|
124
|
-
clientId: '',
|
|
125
|
-
setClientId: (val) => set({ clientId: val }),
|
|
126
|
-
|
|
127
|
-
isApiTriggered: false,
|
|
128
|
-
setIsApiTriggered: (val) => set({ isApiTriggered: val }),
|
|
129
|
-
|
|
130
|
-
oid: '',
|
|
131
|
-
setOid: (val) => set({ oid: val }),
|
|
132
|
-
|
|
133
|
-
isNewLoginOrCreateFlow: false,
|
|
134
|
-
setIsNewLoginOrCreateFlow: (val) => set({ isNewLoginOrCreateFlow: val }),
|
|
135
|
-
|
|
136
|
-
selectedAbhaFlow: '',
|
|
137
|
-
setSelectedAbhaFlow: (val) => set({ selectedAbhaFlow: val }),
|
|
138
|
-
|
|
139
|
-
isInitApiTriggered: false,
|
|
140
|
-
setIsInitApiTriggered: (val) => set({ isInitApiTriggered: val }),
|
|
141
|
-
|
|
142
|
-
identityValue : '',
|
|
143
|
-
setIdentityValue: (val) => set({ identityValue: val }),
|
|
144
|
-
|
|
145
|
-
currentStepperIndex: 1,
|
|
146
|
-
setCurrentStepperIndex: (val:number) => set({ currentStepperIndex: val }),
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
clearAbhaAuthStore: () => set(storeInitState),
|
|
150
|
-
}));
|
|
151
|
-
|
|
152
|
-
export default useAuthAbhaStore;
|