@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.
Files changed (119) 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 +63 -0
  4. package/package.json +1 -1
  5. package/.eslintignore +0 -3
  6. package/.eslintrc +0 -29
  7. package/.prettierrc +0 -7
  8. package/.turbo/daemon/da13e0828a6aedf8-turbo.log.2025-10-30 +0 -0
  9. package/package/styles/pds2/border.ts +0 -69
  10. package/package/styles/pds2/colors.ts +0 -70
  11. package/package/styles/pds2/spacing.ts +0 -1007
  12. package/package/tailwind/tailwind.config.ts +0 -124
  13. package/postcss.config.js +0 -6
  14. package/scripts/build-purged-css.cjs +0 -70
  15. package/src/App.css +0 -0
  16. package/src/App.tsx +0 -43
  17. package/src/api-queries/aorta-go/v3/get-profile-patient.ts +0 -32
  18. package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +0 -26
  19. package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +0 -34
  20. package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +0 -32
  21. package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +0 -38
  22. package/src/api-queries/aorta-go/v3/post-profile-switch.ts +0 -39
  23. package/src/api-queries/ndhm/get-abdm-register-suggest.ts +0 -37
  24. package/src/api-queries/ndhm/get-pincode-details.ts +0 -28
  25. package/src/api-queries/ndhm/post-abdm-login-init.ts +0 -37
  26. package/src/api-queries/ndhm/post-abdm-login-phr.ts +0 -37
  27. package/src/api-queries/ndhm/post-abdm-login-verify.ts +0 -37
  28. package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +0 -40
  29. package/src/api-queries/ndhm/post-abdm-profile-eka.ts +0 -66
  30. package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +0 -37
  31. package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +0 -66
  32. package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +0 -32
  33. package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +0 -38
  34. package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +0 -34
  35. package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +0 -37
  36. package/src/api-queries/ndhm/post-register-aadhaar-init.ts +0 -34
  37. package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +0 -34
  38. package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +0 -37
  39. package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +0 -34
  40. package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +0 -40
  41. package/src/api-queries/ndhm/post-register-mobile-init.ts +0 -34
  42. package/src/api-queries/use-get-profiles-patient.ts +0 -12
  43. package/src/api-queries/use-get-profiles-phr-user.ts +0 -28
  44. package/src/api-queries/use-post-abdm-login-verify-v1.ts +0 -26
  45. package/src/api-queries/use-post-auth-verify-v2.ts +0 -50
  46. package/src/api-queries/use-post-profile-switch.ts +0 -58
  47. package/src/api-queries/use-post-register-mobile-create-phr.ts +0 -39
  48. package/src/api-queries/user-post-abdm-profile-login-phr.ts +0 -26
  49. package/src/assets/Success.json +0 -1
  50. package/src/assets/react.svg +0 -1
  51. package/src/atoms/button/custom-button.tsx +0 -32
  52. package/src/atoms/button/index.tsx +0 -40
  53. package/src/atoms/button/types.d.ts +0 -31
  54. package/src/atoms/header.tsx +0 -25
  55. package/src/atoms/input-field/index.tsx +0 -63
  56. package/src/atoms/input-field/patient-input-field.tsx +0 -16
  57. package/src/atoms/input-field/types.ts +0 -24
  58. package/src/atoms/pds2-otp-input/index.tsx +0 -35
  59. package/src/atoms/pds2-otp-input/types.d.ts +0 -3
  60. package/src/atoms/single-input-chip/index.tsx +0 -32
  61. package/src/atoms/single-input-chip/types.ts +0 -6
  62. package/src/atoms/spinner.tsx +0 -33
  63. package/src/atoms/text-separator.tsx +0 -11
  64. package/src/atoms/ui/spinner.tsx +0 -75
  65. package/src/constants/constants.ts +0 -376
  66. package/src/fetch-client/index.ts +0 -164
  67. package/src/index.css +0 -152
  68. package/src/main.tsx +0 -374
  69. package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +0 -40
  70. package/src/molecules/abha/bottom-sheet/index.tsx +0 -66
  71. package/src/molecules/abha/spaced-input-component.tsx +0 -168
  72. package/src/molecules/copyright-year.tsx +0 -16
  73. package/src/molecules/exit-popup/index.tsx +0 -101
  74. package/src/molecules/pds2-otp-component/index.tsx +0 -147
  75. package/src/organisms/abha/abha-header.tsx +0 -25
  76. package/src/organisms/abha/abha-stepper.tsx +0 -83
  77. package/src/organisms/abha/error-bottom-sheet.tsx +0 -27
  78. package/src/organisms/abha/otp-card.tsx +0 -99
  79. package/src/organisms/abha/verification-status.tsx +0 -30
  80. package/src/organisms/choose-language/choose-language.tsx +0 -53
  81. package/src/organisms/choose-language/types.ts +0 -10
  82. package/src/organisms/screen-switcher/screen-switcher.tsx +0 -80
  83. package/src/routes/abha-aadhaar-verification-status-screen.tsx +0 -246
  84. package/src/routes/abha-created-screen.tsx +0 -45
  85. package/src/routes/abha-login-otp-verify-screen.tsx +0 -519
  86. package/src/routes/abha-mobile-linking-status-screen.tsx +0 -267
  87. package/src/routes/abha-otp-and-mobile-screen.tsx +0 -435
  88. package/src/routes/abha-phone-number-verification-screen.tsx +0 -388
  89. package/src/routes/create-abha-address-screen.tsx +0 -928
  90. package/src/routes/create-abha-with-aadhaar-screen.tsx +0 -986
  91. package/src/routes/create-eka-profile-screen.tsx +0 -831
  92. package/src/routes/get-all-profiles-screen.tsx +0 -161
  93. package/src/routes/login-or-create-abha-address-screen.tsx +0 -1056
  94. package/src/routes/login-with-abha-screen.tsx +0 -454
  95. package/src/routes/select-abha-from-list-screen.tsx +0 -792
  96. package/src/routes/select-eka-profile-screen.tsx +0 -446
  97. package/src/routes/utils/trackAbhaEvent.ts +0 -41
  98. package/src/stores/auth-abha-store/index.ts +0 -152
  99. package/src/stores/auth-abha-store/types.ts +0 -217
  100. package/src/utils/mock-auth-response.ts +0 -29
  101. package/src/utils/send-event-utils.ts +0 -76
  102. package/src/utils/validations.ts +0 -89
  103. package/src/vite-env.d.ts +0 -1
  104. package/tailwind.config.ts +0 -9
  105. package/tsconfig.json +0 -25
  106. package/tsconfig.node.json +0 -10
  107. package/tsconfig.node.tsbuildinfo +0 -1
  108. package/tsconfig.tsbuildinfo +0 -1
  109. package/vite.config.d.ts +0 -2
  110. package/vite.config.js +0 -45
  111. package/vite.config.ts +0 -50
  112. /package/{public → dist}/images/adhaar.webp +0 -0
  113. /package/{public → dist}/images/at-the-rate.webp +0 -0
  114. /package/{public → dist}/images/avatar.webp +0 -0
  115. /package/{public → dist}/images/ayushman-bharat.webp +0 -0
  116. /package/{public → dist}/images/circle-checkmark.webp +0 -0
  117. /package/{public → dist}/images/link-abha.webp +0 -0
  118. /package/{public → dist}/images/national-authority.webp +0 -0
  119. /package/{public → dist}/images/three-dots.webp +0 -0
@@ -1,161 +0,0 @@
1
- import { ABHA_V3_SKIP_STATES, GET_EXTRA_HEADERS } from '../constants/constants';
2
- import { useEffect, useState } from 'react';
3
- import useGetProfilesPhrUser from '../api-queries/use-get-profiles-phr-user';
4
- import AbhaVerificationStatus from '../organisms/abha/verification-status';
5
- import useAuthAbhaStore from '../stores/auth-abha-store';
6
- import { SCREEN_NAMES } from '../stores/auth-abha-store/types';
7
-
8
- import handleSendEvent from '../utils/send-event-utils';
9
-
10
- const GetAllProfilesScreen = () => {
11
- const setScreen = useAuthAbhaStore((state) => state.setScreen);
12
- const screen = useAuthAbhaStore((state) => state.screen);
13
- const goBackLoginScreen = useAuthAbhaStore((state) => state.goBackLoginScreen);
14
- const clearAbhaAuthStore = useAuthAbhaStore((state) => state.clearAbhaAuthStore);
15
- const [loadingStatus, setLoadingStatus] = useState<boolean>(false);
16
- const [targetScreen, setTargetScreen] = useState('');
17
- const clientId = useAuthAbhaStore((state) => state.clientId);
18
- const aadhaarVerificationSkipStateStatus = useAuthAbhaStore(
19
- (state) => state.aadhaarVerificationSkipStateStatus
20
- );
21
- const isEkaAppLogin = useAuthAbhaStore((state) => state.isEkaAppLogin);
22
- const isNewLoginOrCreateFlow = useAuthAbhaStore((state) => state.isNewLoginOrCreateFlow);
23
- const txnId = useAuthAbhaStore((state) => state.txnId);
24
- const extra_headers = GET_EXTRA_HEADERS();
25
- const selectedMethod = useAuthAbhaStore((state) => state.abhaAuthFlowMethod);
26
-
27
- const trackAbhaEvent = ({ name, data = {} }: { name: string; data?: Record<string, any> }) => {
28
- const baseProps = {
29
- login_platform: clientId,
30
- is_eka_app_login: isEkaAppLogin ? 'true' : 'false',
31
- is_new_login_or_create_flow: isNewLoginOrCreateFlow ? 'true' : 'false',
32
- txn_id: txnId || 'missing txnId',
33
- oid: extra_headers?.['X-User-ID'] ? 'true' : 'false',
34
- access_token: extra_headers?.['auth'] ? 'true' : 'false',
35
- flow: selectedMethod ?? ""
36
- };
37
-
38
- const eventData = {
39
- ...baseProps,
40
- ...data,
41
- };
42
-
43
- handleSendEvent({
44
- eventName: name,
45
- eventData,
46
- });
47
-
48
- window.curio?.pushToMixpanel?.(name, eventData);
49
- };
50
-
51
- useEffect(() => {
52
- // If the client is a doctor, redirect to CREATE_EKA_PROFILE screen directly
53
- if (clientId === 'doctor') {
54
- // Track page view event for doctor clients
55
- trackAbhaEvent({
56
- name: 'page_view',
57
- data: {
58
- platform: clientId,
59
- page_view: 'get-all-profiles-screen',
60
- },
61
- });
62
- // Redirect to Eka profile creation screen
63
- trackAbhaEvent({
64
- name: 'redirect_to_create_eka_profile_screen',
65
- data: {
66
- type: 'next',
67
- },
68
- });
69
- setScreen(SCREEN_NAMES.CREATE_EKA_PROFILE);
70
- return;
71
- }
72
- }, [clientId]);
73
-
74
- // Determine if profiles should be fetched based on client type and login context
75
- // if the isEkaAppLogin is false, and client is not doc, then fetch profiles
76
- let shouldFetchProfiles = false;
77
-
78
- if (isEkaAppLogin) {
79
- // If the login is from Eka app, do not fetch profiles
80
- shouldFetchProfiles = false;
81
- } else if (!isEkaAppLogin) {
82
- if (clientId === 'doctor') {
83
- // If the client is doctor, do not fetch profiles
84
- shouldFetchProfiles = false;
85
- } else {
86
- // All other clients (not Eka, not doctor) should fetch profiles
87
- shouldFetchProfiles = true;
88
- }
89
- }
90
-
91
- // Fetch PHR profiles conditionally
92
- const {
93
- data: profilePhrResponse,
94
- error: phrError,
95
- isLoading,
96
- } = shouldFetchProfiles ? useGetProfilesPhrUser() : { data: null, error: null, isLoading: false };
97
-
98
- useEffect(() => {
99
- // Skip the effect logic for doctor clients
100
- if (clientId === 'doctor') {
101
- return; // prevent overriding screen logic for doc clients
102
- }
103
-
104
- const fetchProfileResponse = async () => {
105
- // Wait for API loading to complete and data to be available
106
- if (!isLoading && profilePhrResponse) {
107
- setLoadingStatus(true); // Start showing loading spinner
108
-
109
- // Optional 2-second delay to create smoother UI transitions
110
- await new Promise((resolve) => setTimeout(resolve, 2000));
111
-
112
- setLoadingStatus(false); // Hide loading spinner
113
-
114
- // If no profiles exist, determine where to redirect
115
- if (!profilePhrResponse.profiles || profilePhrResponse.profiles.length < 1) {
116
- if (aadhaarVerificationSkipStateStatus === ABHA_V3_SKIP_STATES.ABHA_END) {
117
- // Create both PHR and Eka profile
118
- trackAbhaEvent({
119
- name: 'redirect_to_create_phr_eka_profile_screen',
120
- data: {
121
- type: 'next',
122
- skip_state: aadhaarVerificationSkipStateStatus,
123
- },
124
- });
125
- setScreen(SCREEN_NAMES.CREATE_PHR_EKA_PROFILE);
126
- } else {
127
- // Create only Eka profile
128
- trackAbhaEvent({
129
- name: 'redirect_to_create_eka_profile_screen',
130
- data: {
131
- type: 'next',
132
- skip_state: aadhaarVerificationSkipStateStatus,
133
- },
134
- });
135
- setScreen(SCREEN_NAMES.CREATE_EKA_PROFILE);
136
- }
137
- } else {
138
- // Profiles exist, redirect to profile selection screen
139
- trackAbhaEvent({
140
- name: 'redirect_to_select_eka_profile_screen',
141
- data: {
142
- type: 'next',
143
- skip_state: aadhaarVerificationSkipStateStatus,
144
- },
145
- });
146
- setScreen(SCREEN_NAMES.SELECT_EKA_PROFILE);
147
- }
148
- }
149
- };
150
- // Invoke the response handler
151
- fetchProfileResponse();
152
- }, [isLoading, profilePhrResponse]);
153
-
154
- // If loading status is active, show verification screen with spinner
155
- if (loadingStatus) {
156
- return <AbhaVerificationStatus loading={true} loadingText="In progress..." successText="" />;
157
- }
158
- // If nothing to render (e.g., waiting for redirect), return null
159
- return null;
160
- };
161
- export default GetAllProfilesScreen;