@eka-care/abha-stg 0.1.35 → 0.1.37

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 (115) 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/package/styles/pds2/border.ts +0 -69
  6. package/package/styles/pds2/colors.ts +0 -70
  7. package/package/styles/pds2/spacing.ts +0 -1007
  8. package/package/tailwind/tailwind.config.ts +0 -124
  9. package/postcss.config.js +0 -6
  10. package/scripts/build-purged-css.cjs +0 -70
  11. package/src/App.css +0 -0
  12. package/src/App.tsx +0 -43
  13. package/src/api-queries/aorta-go/v3/get-profile-patient.ts +0 -32
  14. package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +0 -26
  15. package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +0 -34
  16. package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +0 -32
  17. package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +0 -38
  18. package/src/api-queries/aorta-go/v3/post-profile-switch.ts +0 -39
  19. package/src/api-queries/ndhm/get-abdm-register-suggest.ts +0 -37
  20. package/src/api-queries/ndhm/get-pincode-details.ts +0 -28
  21. package/src/api-queries/ndhm/post-abdm-login-init.ts +0 -37
  22. package/src/api-queries/ndhm/post-abdm-login-phr.ts +0 -37
  23. package/src/api-queries/ndhm/post-abdm-login-verify.ts +0 -37
  24. package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +0 -40
  25. package/src/api-queries/ndhm/post-abdm-profile-eka.ts +0 -66
  26. package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +0 -37
  27. package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +0 -66
  28. package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +0 -32
  29. package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +0 -38
  30. package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +0 -34
  31. package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +0 -37
  32. package/src/api-queries/ndhm/post-register-aadhaar-init.ts +0 -34
  33. package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +0 -34
  34. package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +0 -37
  35. package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +0 -34
  36. package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +0 -40
  37. package/src/api-queries/ndhm/post-register-mobile-init.ts +0 -34
  38. package/src/api-queries/use-get-profiles-patient.ts +0 -12
  39. package/src/api-queries/use-get-profiles-phr-user.ts +0 -28
  40. package/src/api-queries/use-post-abdm-login-verify-v1.ts +0 -26
  41. package/src/api-queries/use-post-auth-verify-v2.ts +0 -50
  42. package/src/api-queries/use-post-profile-switch.ts +0 -58
  43. package/src/api-queries/use-post-register-mobile-create-phr.ts +0 -39
  44. package/src/api-queries/user-post-abdm-profile-login-phr.ts +0 -26
  45. package/src/assets/Success.json +0 -1
  46. package/src/assets/react.svg +0 -1
  47. package/src/atoms/button/custom-button.tsx +0 -32
  48. package/src/atoms/button/index.tsx +0 -40
  49. package/src/atoms/button/types.d.ts +0 -31
  50. package/src/atoms/header.tsx +0 -25
  51. package/src/atoms/input-field/index.tsx +0 -63
  52. package/src/atoms/input-field/patient-input-field.tsx +0 -16
  53. package/src/atoms/input-field/types.ts +0 -24
  54. package/src/atoms/pds2-otp-input/index.tsx +0 -35
  55. package/src/atoms/pds2-otp-input/types.d.ts +0 -3
  56. package/src/atoms/single-input-chip/index.tsx +0 -32
  57. package/src/atoms/single-input-chip/types.ts +0 -6
  58. package/src/atoms/spinner.tsx +0 -33
  59. package/src/atoms/text-separator.tsx +0 -11
  60. package/src/atoms/ui/spinner.tsx +0 -75
  61. package/src/constants/constants.ts +0 -376
  62. package/src/fetch-client/index.ts +0 -164
  63. package/src/index.css +0 -152
  64. package/src/main.tsx +0 -374
  65. package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +0 -40
  66. package/src/molecules/abha/bottom-sheet/index.tsx +0 -66
  67. package/src/molecules/abha/spaced-input-component.tsx +0 -168
  68. package/src/molecules/copyright-year.tsx +0 -16
  69. package/src/molecules/exit-popup/index.tsx +0 -101
  70. package/src/molecules/pds2-otp-component/index.tsx +0 -147
  71. package/src/organisms/abha/abha-header.tsx +0 -25
  72. package/src/organisms/abha/abha-stepper.tsx +0 -83
  73. package/src/organisms/abha/error-bottom-sheet.tsx +0 -27
  74. package/src/organisms/abha/otp-card.tsx +0 -99
  75. package/src/organisms/abha/verification-status.tsx +0 -30
  76. package/src/organisms/choose-language/choose-language.tsx +0 -53
  77. package/src/organisms/choose-language/types.ts +0 -10
  78. package/src/organisms/screen-switcher/screen-switcher.tsx +0 -80
  79. package/src/routes/abha-aadhaar-verification-status-screen.tsx +0 -246
  80. package/src/routes/abha-created-screen.tsx +0 -45
  81. package/src/routes/abha-login-otp-verify-screen.tsx +0 -519
  82. package/src/routes/abha-mobile-linking-status-screen.tsx +0 -267
  83. package/src/routes/abha-otp-and-mobile-screen.tsx +0 -435
  84. package/src/routes/abha-phone-number-verification-screen.tsx +0 -388
  85. package/src/routes/create-abha-address-screen.tsx +0 -928
  86. package/src/routes/create-abha-with-aadhaar-screen.tsx +0 -986
  87. package/src/routes/create-eka-profile-screen.tsx +0 -831
  88. package/src/routes/get-all-profiles-screen.tsx +0 -161
  89. package/src/routes/login-or-create-abha-address-screen.tsx +0 -1056
  90. package/src/routes/login-with-abha-screen.tsx +0 -454
  91. package/src/routes/select-abha-from-list-screen.tsx +0 -792
  92. package/src/routes/select-eka-profile-screen.tsx +0 -446
  93. package/src/routes/utils/trackAbhaEvent.ts +0 -41
  94. package/src/stores/auth-abha-store/index.ts +0 -152
  95. package/src/stores/auth-abha-store/types.ts +0 -217
  96. package/src/utils/mock-auth-response.ts +0 -29
  97. package/src/utils/send-event-utils.ts +0 -76
  98. package/src/utils/validations.ts +0 -89
  99. package/src/vite-env.d.ts +0 -1
  100. package/tailwind.config.ts +0 -9
  101. package/tsconfig.json +0 -25
  102. package/tsconfig.node.json +0 -10
  103. package/tsconfig.node.tsbuildinfo +0 -1
  104. package/tsconfig.tsbuildinfo +0 -1
  105. package/vite.config.d.ts +0 -2
  106. package/vite.config.js +0 -30
  107. package/vite.config.ts +0 -35
  108. /package/{public → dist}/images/adhaar.webp +0 -0
  109. /package/{public → dist}/images/at-the-rate.webp +0 -0
  110. /package/{public → dist}/images/avatar.webp +0 -0
  111. /package/{public → dist}/images/ayushman-bharat.webp +0 -0
  112. /package/{public → dist}/images/circle-checkmark.webp +0 -0
  113. /package/{public → dist}/images/link-abha.webp +0 -0
  114. /package/{public → dist}/images/national-authority.webp +0 -0
  115. /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;