@eka-care/abha-stg 0.1.36 → 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 (116) 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/.turbo/daemon/7f0c6427972069cb-turbo.log.2025-11-12 +0 -0
  6. package/package/styles/pds2/border.ts +0 -69
  7. package/package/styles/pds2/colors.ts +0 -70
  8. package/package/styles/pds2/spacing.ts +0 -1007
  9. package/package/tailwind/tailwind.config.ts +0 -124
  10. package/postcss.config.js +0 -6
  11. package/scripts/build-purged-css.cjs +0 -70
  12. package/src/App.css +0 -0
  13. package/src/App.tsx +0 -43
  14. package/src/api-queries/aorta-go/v3/get-profile-patient.ts +0 -32
  15. package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +0 -26
  16. package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +0 -34
  17. package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +0 -32
  18. package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +0 -38
  19. package/src/api-queries/aorta-go/v3/post-profile-switch.ts +0 -39
  20. package/src/api-queries/ndhm/get-abdm-register-suggest.ts +0 -37
  21. package/src/api-queries/ndhm/get-pincode-details.ts +0 -28
  22. package/src/api-queries/ndhm/post-abdm-login-init.ts +0 -37
  23. package/src/api-queries/ndhm/post-abdm-login-phr.ts +0 -37
  24. package/src/api-queries/ndhm/post-abdm-login-verify.ts +0 -37
  25. package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +0 -40
  26. package/src/api-queries/ndhm/post-abdm-profile-eka.ts +0 -66
  27. package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +0 -37
  28. package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +0 -66
  29. package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +0 -32
  30. package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +0 -38
  31. package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +0 -34
  32. package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +0 -37
  33. package/src/api-queries/ndhm/post-register-aadhaar-init.ts +0 -34
  34. package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +0 -34
  35. package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +0 -37
  36. package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +0 -34
  37. package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +0 -40
  38. package/src/api-queries/ndhm/post-register-mobile-init.ts +0 -34
  39. package/src/api-queries/use-get-profiles-patient.ts +0 -12
  40. package/src/api-queries/use-get-profiles-phr-user.ts +0 -28
  41. package/src/api-queries/use-post-abdm-login-verify-v1.ts +0 -26
  42. package/src/api-queries/use-post-auth-verify-v2.ts +0 -50
  43. package/src/api-queries/use-post-profile-switch.ts +0 -58
  44. package/src/api-queries/use-post-register-mobile-create-phr.ts +0 -39
  45. package/src/api-queries/user-post-abdm-profile-login-phr.ts +0 -26
  46. package/src/assets/Success.json +0 -1
  47. package/src/assets/react.svg +0 -1
  48. package/src/atoms/button/custom-button.tsx +0 -32
  49. package/src/atoms/button/index.tsx +0 -40
  50. package/src/atoms/button/types.d.ts +0 -31
  51. package/src/atoms/header.tsx +0 -25
  52. package/src/atoms/input-field/index.tsx +0 -63
  53. package/src/atoms/input-field/patient-input-field.tsx +0 -16
  54. package/src/atoms/input-field/types.ts +0 -24
  55. package/src/atoms/pds2-otp-input/index.tsx +0 -35
  56. package/src/atoms/pds2-otp-input/types.d.ts +0 -3
  57. package/src/atoms/single-input-chip/index.tsx +0 -32
  58. package/src/atoms/single-input-chip/types.ts +0 -6
  59. package/src/atoms/spinner.tsx +0 -33
  60. package/src/atoms/text-separator.tsx +0 -11
  61. package/src/atoms/ui/spinner.tsx +0 -75
  62. package/src/constants/constants.ts +0 -376
  63. package/src/fetch-client/index.ts +0 -164
  64. package/src/index.css +0 -152
  65. package/src/main.tsx +0 -374
  66. package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +0 -40
  67. package/src/molecules/abha/bottom-sheet/index.tsx +0 -66
  68. package/src/molecules/abha/spaced-input-component.tsx +0 -168
  69. package/src/molecules/copyright-year.tsx +0 -16
  70. package/src/molecules/exit-popup/index.tsx +0 -101
  71. package/src/molecules/pds2-otp-component/index.tsx +0 -147
  72. package/src/organisms/abha/abha-header.tsx +0 -25
  73. package/src/organisms/abha/abha-stepper.tsx +0 -83
  74. package/src/organisms/abha/error-bottom-sheet.tsx +0 -27
  75. package/src/organisms/abha/otp-card.tsx +0 -99
  76. package/src/organisms/abha/verification-status.tsx +0 -30
  77. package/src/organisms/choose-language/choose-language.tsx +0 -53
  78. package/src/organisms/choose-language/types.ts +0 -10
  79. package/src/organisms/screen-switcher/screen-switcher.tsx +0 -80
  80. package/src/routes/abha-aadhaar-verification-status-screen.tsx +0 -246
  81. package/src/routes/abha-created-screen.tsx +0 -45
  82. package/src/routes/abha-login-otp-verify-screen.tsx +0 -519
  83. package/src/routes/abha-mobile-linking-status-screen.tsx +0 -267
  84. package/src/routes/abha-otp-and-mobile-screen.tsx +0 -435
  85. package/src/routes/abha-phone-number-verification-screen.tsx +0 -388
  86. package/src/routes/create-abha-address-screen.tsx +0 -928
  87. package/src/routes/create-abha-with-aadhaar-screen.tsx +0 -986
  88. package/src/routes/create-eka-profile-screen.tsx +0 -831
  89. package/src/routes/get-all-profiles-screen.tsx +0 -161
  90. package/src/routes/login-or-create-abha-address-screen.tsx +0 -1056
  91. package/src/routes/login-with-abha-screen.tsx +0 -454
  92. package/src/routes/select-abha-from-list-screen.tsx +0 -792
  93. package/src/routes/select-eka-profile-screen.tsx +0 -446
  94. package/src/routes/utils/trackAbhaEvent.ts +0 -41
  95. package/src/stores/auth-abha-store/index.ts +0 -152
  96. package/src/stores/auth-abha-store/types.ts +0 -217
  97. package/src/utils/mock-auth-response.ts +0 -29
  98. package/src/utils/send-event-utils.ts +0 -76
  99. package/src/utils/validations.ts +0 -89
  100. package/src/vite-env.d.ts +0 -1
  101. package/tailwind.config.ts +0 -9
  102. package/tsconfig.json +0 -25
  103. package/tsconfig.node.json +0 -10
  104. package/tsconfig.node.tsbuildinfo +0 -1
  105. package/tsconfig.tsbuildinfo +0 -1
  106. package/vite.config.d.ts +0 -2
  107. package/vite.config.js +0 -30
  108. package/vite.config.ts +0 -35
  109. /package/{public → dist}/images/adhaar.webp +0 -0
  110. /package/{public → dist}/images/at-the-rate.webp +0 -0
  111. /package/{public → dist}/images/avatar.webp +0 -0
  112. /package/{public → dist}/images/ayushman-bharat.webp +0 -0
  113. /package/{public → dist}/images/circle-checkmark.webp +0 -0
  114. /package/{public → dist}/images/link-abha.webp +0 -0
  115. /package/{public → dist}/images/national-authority.webp +0 -0
  116. /package/{public → dist}/images/three-dots.webp +0 -0
package/src/index.css DELETED
@@ -1,152 +0,0 @@
1
- @import url(https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,700;0,900;1,400;1,700;1,900&display=swap);
2
-
3
- @tailwind base;
4
- @tailwind components;
5
- @tailwind utilities;
6
-
7
- :root {
8
- font-family: Lato, Avenir, Helvetica, Arial, sans-serif;
9
- }
10
-
11
- body {
12
- @apply pds2-font-lato;
13
- }
14
-
15
- @layer base {
16
- .TitlesSubheadline {
17
- @apply pds2-font-700 pds2-text-16 pds2-leading-20;
18
- }
19
- .BodyBody {
20
- @apply pds2-font-400 pds2-text-16 pds2-leading-22;
21
- }
22
- .DisplayRegular {
23
- @apply pds2-font-400 pds2-text-34 pds2-leading-44;
24
- }
25
- .DisplayMedium {
26
- @apply pds2-font-500 pds2-text-32 pds2-leading-40;
27
- }
28
- .DisplaySemibold {
29
- @apply pds2-font-600 pds2-text-32 pds2-leading-40;
30
- }
31
- .Heading2Medium {
32
- @apply pds2-font-500 pds2-text-24 pds2-leading-32;
33
- }
34
- .Heading2Semibold {
35
- @apply pds2-font-600 pds2-text-24 pds2-leading-32;
36
- }
37
- .Heading3Semibold {
38
- @apply pds2-font-600 pds2-text-20 pds2-leading-28;
39
- }
40
- .Heading4Semibold {
41
- @apply pds2-font-600 pds2-text-18 pds2-leading-24;
42
- }
43
-
44
- .Body1Semibold {
45
- @apply pds2-font-600 pds2-text-16 pds2-leading-24;
46
- }
47
- .Body2Semibold {
48
- @apply pds2-font-600 pds2-text-14 pds2-leading-20;
49
- }
50
-
51
- .Body1Regular {
52
- @apply pds2-font-400 pds2-text-16 pds2-leading-24;
53
- }
54
- .Body2Regular {
55
- @apply pds2-font-400 pds2-text-14 pds2-leading-20;
56
- }
57
- .Body2Medium {
58
- @apply pds2-font-500 pds2-text-14 pds2-leading-20;
59
- }
60
- .Body3Regular {
61
- @apply pds2-font-400 pds2-text-12 pds2-leading-16;
62
- }
63
-
64
- .Body3Medium {
65
- @apply pds2-font-500 pds2-text-12 pds2-leading-16;
66
- }
67
-
68
- .Body3Semibold {
69
- @apply pds2-font-600 pds2-text-12 pds2-leading-16;
70
- }
71
-
72
- .Body3CapsRegular {
73
- @apply pds2-font-400 pds2-text-12 pds2-leading-16 pds2-uppercase pds2-tracking-[0.96px];
74
- }
75
- .Body3CapsSemibold {
76
- @apply pds2-font-600 pds2-text-12 pds2-leading-16 pds2-uppercase pds2-tracking-[0.96px];
77
- }
78
-
79
- .BodyFootnote {
80
- @apply pds2-font-400 pds2-text-13 pds2-leading-18;
81
- }
82
-
83
- .BodyInputLabel {
84
- @apply pds2-font-400 pds2-text-12 pds2-leading-12;
85
- }
86
- .Label1Semibold {
87
- @apply pds2-font-600 pds2-text-10 pds2-leading-14;
88
- }
89
- .SubheadlineRegular {
90
- @apply pds2-font-400 pds2-text-14 pds2-leading-20;
91
- }
92
- }
93
-
94
- @layer utilities {
95
- @variants responsive {
96
- .ripple {
97
- @apply pds2-relative pds2-overflow-hidden pds2-transform;
98
- }
99
-
100
- .ripple::after {
101
- @apply pds2-absolute pds2-inset-0 pds2-block pds2-bg-center pds2-bg-no-repeat pds2-opacity-0 pds2-pointer-events-none;
102
- content: '';
103
- background-image: radial-gradient(circle, #000 10%, transparent 10.01%);
104
- transform: scale(10, 10);
105
- transition:
106
- transform 0.3s,
107
- opacity 1s;
108
- }
109
-
110
- .ripple:active::after {
111
- transform: scale(0, 0);
112
- opacity: 0.3;
113
- transition: 0s;
114
- }
115
- }
116
- }
117
-
118
- input[type="date"]::-webkit-calendar-picker-indicator {
119
- display: inline !important;
120
- -webkit-appearance: auto !important;
121
- width: 16px;
122
- padding: 0px;
123
- margin: 0px;
124
- }
125
-
126
- .abhaStepper {
127
- -webkit-appearance: none;
128
- appearance: none;
129
- }
130
-
131
- .abhaStepper::-moz-progress-bar {
132
- background-color: green;
133
- }
134
-
135
- .abhaStepper::-webkit-progress-bar {
136
- background-color: #abb7c2;
137
- }
138
-
139
- .abhaStepper::-webkit-progress-value {
140
- background-color: #6b5ce0;
141
- }
142
-
143
- @keyframes pds2-spin { to { transform: rotate(360deg); } }
144
-
145
- .pds2-animate-spin {
146
- animation: pds2-spin 1s linear infinite;
147
- }
148
-
149
- button, input, a {
150
- /* outline: none; */
151
- -webkit-tap-highlight-color: transparent; /* mobile */
152
- }
package/src/main.tsx DELETED
@@ -1,374 +0,0 @@
1
-
2
- import { createRoot, Root } from 'react-dom/client';
3
- import App, { queryClient } from './App';
4
- import './index.css';
5
- import useAuthAbhaStore from './stores/auth-abha-store';
6
- import { SCREEN_NAMES } from './stores/auth-abha-store/types';
7
- import { isValidAadhaar, isValidABHA, isValidMobile } from './utils/validations';
8
- import handleSendEvent from './utils/send-event-utils';
9
- import setEnv, { ABHA_AUTH_FLOW_METHOD, TAuthVerifyV2Response } from './constants/constants';
10
-
11
- export type TMethod = 'login_with_abha' | 'create_abha_with_mobile' | 'login_or_create_abha';
12
-
13
- type IdentifierType = "phr_address" | "aadhaar_number" | "abha_number" | "mobile";
14
-
15
- const setIdentifier = (type: IdentifierType, value: string) => {
16
- useAuthAbhaStore.getState().setInitAbhaAppIdentifierType(type);
17
- useAuthAbhaStore.getState().setInitAbhaAppIdentifier(value);
18
- };
19
-
20
- const handleIdentifier = (
21
- identifier?: string,
22
- identifier_type?: IdentifierType,
23
- isProd?: boolean,
24
- ) => {
25
- if (identifier) {
26
-
27
- const sanitized = identifier.replace(/[\s-]/g, "");
28
-
29
- if (identifier_type) {
30
- // Client already knows the type
31
- if(identifier_type===ABHA_AUTH_FLOW_METHOD.MOBILE){
32
- setIdentifier(ABHA_AUTH_FLOW_METHOD.MOBILE, identifier.slice(-10));
33
- return;
34
- }
35
- setIdentifier(identifier_type, identifier);
36
- return;
37
- }
38
-
39
- // Client provides only identifier, detect type
40
- const isPHR = isProd
41
- ? sanitized.endsWith("@abdm")
42
- : sanitized.endsWith("@sbx");
43
-
44
- if (isPHR) {
45
- setIdentifier(ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS, sanitized);
46
- return;
47
- }
48
-
49
- if (/^\+91\d{10}$/.test(sanitized)) {
50
- const mobileDigits = sanitized.slice(-10);
51
- if (mobileDigits.length === 10 && isValidMobile(mobileDigits)) {
52
- setIdentifier(ABHA_AUTH_FLOW_METHOD.MOBILE, mobileDigits);
53
- return;
54
- }
55
- }
56
- else if (/^\d+$/.test(sanitized)) {
57
- const len = sanitized.length;
58
-
59
- if (len === 10 && isValidMobile(sanitized)) {
60
- setIdentifier(ABHA_AUTH_FLOW_METHOD.MOBILE, sanitized);
61
- return;
62
- }
63
-
64
- if (len === 12 && isValidAadhaar(sanitized)) {
65
- setIdentifier(ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER, sanitized);
66
- return;
67
- }
68
-
69
- if (len === 14 && isValidABHA(sanitized)) {
70
- const formattedABHA = `${sanitized.slice(0,2)}-${sanitized.slice(2,6)}-${sanitized.slice(6,10)}-${sanitized.slice(10,14)}`;
71
- setIdentifier(ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER, formattedABHA);
72
- return;
73
- }
74
-
75
-
76
- console.warn("Unknown numeric identifier type");
77
- return;
78
- }
79
- console.warn("Unknown identifier type");
80
- } else {
81
- console.warn("No identifier provided");
82
- }
83
- };
84
-
85
- const getScreenName = ({ method = 'login_with_abha' }: { method?: TMethod }): SCREEN_NAMES => {
86
- switch (method) {
87
- case 'login_with_abha':
88
- return SCREEN_NAMES.LOGIN_WITH_ABHA;
89
- case 'create_abha_with_mobile':
90
- return SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR;
91
- case 'login_or_create_abha':
92
- return SCREEN_NAMES.LOGIN_OR_CREATE_ABHA;
93
- default:
94
- return SCREEN_NAMES.LOGIN_WITH_ABHA;
95
- }
96
- };
97
-
98
- type TInitAbhaAppParams = {
99
- clientId: string;
100
- containerId: string;
101
- urlParams?: {
102
- nextUrl: string;
103
- };
104
- method?: TMethod;
105
- data?: {
106
- mobile?: string;
107
- accessToken?: string;
108
- oid?: string;
109
- identifier?: string;
110
- identifier_type?: string;
111
- };
112
- appVersion?: string;
113
- onSuccess: (params: TOnAbhaSuccessParams) => void;
114
- onError: (params: TOnAbhaFailureParams) => void;
115
- onAbhaClose: () => void;
116
- };
117
-
118
- declare global {
119
- interface Window {
120
- initAbhaApp: (params: TInitAbhaAppParams) => void;
121
- closeAbhaApp: () => void;
122
- EkaAbha?: {
123
- mobileNumber?: string;
124
- onAbhaSuccess: (params: string) => void;
125
- onAbhaError: (params: string) => void;
126
- onAbhaClose: () => void;
127
- changeStatusBarColor?: (params: string) => void;
128
- };
129
- curio?: {
130
- pushToMixpanel?: (eventName: string, eventProps: Record<string, any>) => void;
131
- };
132
- }
133
- }
134
-
135
- // TODO: Move all the rendering functions to a separate file
136
-
137
- let PopupReactNode: Root | null = null;
138
-
139
- export let unMount: () => void;
140
-
141
- type TOnAbhaSuccessParams = {
142
- response: TAuthVerifyV2Response;
143
- };
144
-
145
- export let onAbhaSuccess: (params: TOnAbhaSuccessParams) => void;
146
-
147
- type TOnAbhaFailureParams = { error?: string; response?: TAuthVerifyV2Response };
148
-
149
- export let onAbhaFailure: (params: TOnAbhaFailureParams) => void;
150
-
151
- function initAbhaApp(params: TInitAbhaAppParams) {
152
- // clear abha auth store at the very start
153
- console.log('clear the abha auth store for every sdk invocation', params);
154
- useAuthAbhaStore.getState().clearAbhaAuthStore();
155
-
156
- const {
157
- clientId,
158
- containerId,
159
- urlParams,
160
- method,
161
- data: abhaData,
162
- appVersion,
163
- onSuccess,
164
- onError,
165
- onAbhaClose,
166
- } = params;
167
- const { mobile, accessToken, oid, identifier, identifier_type} = abhaData || {};
168
-
169
- console.log("recieved identifier, identifier_type",identifier,identifier_type);
170
-
171
- handleSendEvent({
172
- eventName: 'recieved_init_identifiers',
173
- eventData: {
174
- identifier: identifier || "",
175
- identifier_type: identifier_type || "",
176
- },
177
- });
178
-
179
- const headers: Record<string, string> = {};
180
-
181
- if (accessToken) {
182
- headers.auth = accessToken;
183
- }
184
-
185
- if (oid) {
186
- headers['X-User-ID'] = oid;
187
- }
188
- console.log('set headers in headers');
189
-
190
- console.log('invoked initAbhaApp', headers);
191
-
192
- // adding a check of oid in headers, in stetho, only oid is passed, auth is not passed.
193
-
194
- const isEkaAppLogin = headers !== null && ('auth' in headers || 'X-User-ID' in headers);
195
- useAuthAbhaStore.getState().setIsEkaAppLogin(isEkaAppLogin);
196
-
197
- // set true to isEkaAppLogin if clientId is doc-web
198
- if (clientId === 'doc-web') {
199
- useAuthAbhaStore.getState().setIsEkaAppLogin(true);
200
- }
201
- console.log('clientId ', clientId);
202
- console.log('isEkaAppLogin', useAuthAbhaStore.getState().isEkaAppLogin);
203
-
204
- if (
205
- clientId === 'androiddoc' ||
206
- clientId === 'doctor-app-ios' ||
207
- clientId === 'doctor-ipad-ios' ||
208
- clientId === 'doc-web'
209
- ) {
210
- useAuthAbhaStore.getState().setClientId('doctor');
211
- } else if (clientId === 'androidp' || clientId === 'patient-app-ios') {
212
- useAuthAbhaStore.getState().setClientId('phr');
213
- } else if (clientId === 'www-eka') {
214
- useAuthAbhaStore.getState().setClientId('eka-web');
215
- } else {
216
- console.log('here');
217
- useAuthAbhaStore.getState().setClientId('phr');
218
- }
219
-
220
- let isDocAppRequest = false;
221
-
222
- // publish an mix panel event
223
- handleSendEvent({
224
- eventName: 'init_abha_app',
225
- eventData: {
226
- platform: clientId,
227
- method: method || '',
228
- mobile: mobile || '',
229
- accessToken: accessToken || '',
230
- oid: oid || '',
231
- appVersion: appVersion || '',
232
- isEkaAppLogin: isEkaAppLogin.toString(),
233
- container_id: containerId,
234
- },
235
- });
236
-
237
- // use onTrack
238
- onTrack('init_abha_app', {
239
- platform: clientId,
240
- method: method || '',
241
- mobile: mobile || '',
242
- accessToken: headers.auth || '',
243
- oid: headers['X-User-ID'] || '',
244
- appVersion: appVersion || '',
245
- isEkaAppLogin: isEkaAppLogin.toString(),
246
- container_id: containerId,
247
- });
248
-
249
- if (
250
- clientId === 'androiddoc' ||
251
- clientId === 'doctor-app-ios' ||
252
- clientId === 'doctor-ipad-ios' ||
253
- clientId === 'doc-web'
254
- ) {
255
- isDocAppRequest = true;
256
- useAuthAbhaStore.getState().setIsDocAppRequest(isDocAppRequest);
257
- }
258
-
259
- useAuthAbhaStore
260
- .getState()
261
- .setInitAbhaAppMethod(
262
- method === 'create_abha_with_mobile' ? 'create_abha_with_mobile' : 'login_with_abha'
263
- );
264
-
265
- setEnv({
266
- clientId,
267
- env: import.meta.env.VITE_APP_ENV === 'PROD' ? 'PROD' : 'DEV',
268
- ...(headers && { extraHeaders: headers }),
269
- });
270
- const isProd = import.meta.env.VITE_APP_ENV === 'PROD';
271
- console.log("isProd is",isProd)
272
-
273
- const screenName = SCREEN_NAMES.LOGIN_OR_CREATE_ABHA;
274
-
275
- useAuthAbhaStore.getState().setInitState({
276
- screen: [screenName],
277
- urlParams,
278
- });
279
-
280
- // deciding abha sdk mount
281
- const validIdentifierTypes: IdentifierType[] = ["mobile", "aadhaar_number", "abha_number", "phr_address"];
282
-
283
- const typeToUse = identifier_type && validIdentifierTypes.includes(identifier_type as IdentifierType)
284
- ? (identifier_type as IdentifierType)
285
- : undefined;
286
-
287
- handleIdentifier(identifier, typeToUse, isProd);
288
-
289
- useAuthAbhaStore.getState().setAbhaAuthFlowMethod(ABHA_AUTH_FLOW_METHOD.MOBILE);
290
-
291
-
292
- const closeAbhaApp = () => {
293
- useAuthAbhaStore.getState().clearAbhaAuthStore();
294
- queryClient.removeQueries();
295
- PopupReactNode?.unmount();
296
- onAbhaClose();
297
- };
298
-
299
- const rootElement = document.getElementById(containerId);
300
- if (!rootElement) {
301
- const errorMessage = `Element with id ${containerId} not found`;
302
- console.error(errorMessage);
303
- onError({ error: errorMessage });
304
- closeAbhaApp();
305
- return;
306
- }
307
-
308
- onAbhaSuccess = onSuccess;
309
- onAbhaFailure = onError;
310
-
311
- PopupReactNode = createRoot(rootElement);
312
- PopupReactNode.render(<App />);
313
-
314
- unMount = closeAbhaApp;
315
- window.closeAbhaApp = closeAbhaApp;
316
-
317
- return closeAbhaApp;
318
- }
319
-
320
- window.initAbhaApp = initAbhaApp;
321
-
322
- let eventQueue: Array<{ eventName: string; eventProps: Record<string, any> }> = [];
323
-
324
- function onTrack(eventName: string, eventProperties: Record<string, any> = {}) {
325
- const platform = useAuthAbhaStore.getState().clientId || 'unknown-platform';
326
-
327
- const finalEventProps = {
328
- ...eventProperties,
329
- platform,
330
- };
331
-
332
- console.log('Tracking Event:', eventName, finalEventProps);
333
-
334
- if (window.curio?.pushToMixpanel) {
335
- console.log('Pushing to Mixpanel:', eventName, finalEventProps);
336
- window.curio.pushToMixpanel(eventName, finalEventProps);
337
- } else {
338
- console.log('Curio not available. Queuing event:', eventName, finalEventProps);
339
- console.error('Curio not available. Could not push event to Mixpanel.');
340
- }
341
- }
342
-
343
- if (import.meta.env.VITE_APP_MODE === 'DEBUG') {
344
- initAbhaApp({
345
- clientId: 'www-eka',
346
- containerId: 'lofe_root',
347
- method: 'login_or_create_abha',
348
- data: {
349
- // mobile: '8709459003',
350
- // accessToken:
351
- // 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhbmRyb2lkZG9jIiwiYi1pZCI6Ijc3MjM3NjM3NzYzODE3IiwiY2MiOnt9LCJkb2IiOiIxOTk4LTAyLTEwIiwiZXhwIjoxNzQxODY3NDMyLCJmbiI6IlN0YWdlIiwiZ2VuIjoiTSIsImlhdCI6MTc0MTg2NjgzMiwiaXNzIjoiZW1yLmVrYS5jYXJlIiwibG4iOiJHb2QiLCJvaWQiOiIxNzQxMTY3MTMwMjk3NjgiLCJwcyI6IkQiLCJ1dWlkIjoiZGRjMGVmNDUtNDZmOS00ZGE5LTlhNTgtNjcwZjc1N2YyYzc3In0.ZHpMNQuolWQ-MqzbYAHnZGVz1CqFTofm7sV-7ARlfug',
352
- // oid: '17418668693032712',
353
- },
354
- // urlParams: { from: 'dr', next: 'https://www.google.com' },
355
- // workspaceName: 'hell',
356
- onSuccess: (params) => {
357
- handleSendEvent({
358
- eventName: 'abha_on_success',
359
- eventData: {
360
- params: JSON.stringify(params),
361
- oid: params?.response?.data?.profile?.oid ?? '',
362
- uuid: params?.response?.data?.profile?.uuid ?? '',
363
- },
364
- });
365
- console.log('%c Line:117 🍕 onSuccessParams', 'color:#465975', params);
366
- },
367
- onError: (params) => {
368
- console.log('%c Line:121 🥟 onErrorParams', 'color:#6ec1c2', params);
369
- },
370
- onAbhaClose: () => {
371
- console.log('%c Line:121 🥟 onAbhaClose', 'color:#6ec1c2');
372
- },
373
- });
374
- }
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- type BottomSheetWrapperProps = {
3
- isOpen: boolean;
4
- setIsOpen: (open: boolean) => void;
5
- children: React.ReactNode;
6
- shouldCloseOnClickOutside?: boolean;
7
- };
8
- const BottomSheetWrapper = ({
9
- isOpen,
10
- setIsOpen,
11
- children,
12
- shouldCloseOnClickOutside = true,
13
- }: BottomSheetWrapperProps) => {
14
- return (
15
- <div
16
- className={`pds2-absolute pds2-inset-0 pds2-z-50 pds2-transition-opacity pds2-duration-300 ${
17
- isOpen
18
- ? 'pds2-opacity-100 pds2-pointer-events-auto'
19
- : 'pds2-opacity-0 pds2-pointer-events-none pds2-hidden'
20
- }`}
21
- >
22
- {/* Background overlay */}
23
- <div
24
- className="pds2-absolute pds2-inset-0 pds2-bg-text-black pds2-bg-opacity-60 pds2-transition-opacity pds2-duration-300"
25
- onClick={() => shouldCloseOnClickOutside && setIsOpen(false)}
26
- />
27
-
28
- {/* Bottom Sheet Content */}
29
- <div
30
- className="pds2-absolute pds2-bottom-0 pds2-left-0 pds2-right-0 pds2-w-full pds2-bg-bg-white pds2-rounded-t-16 pds2-shadow-lg pds2-p-4 pds2-transition-all pds2-duration-300 pds2-ease-out"
31
- style={{
32
- transform: isOpen ? 'translateY(0)' : 'translateY(100%)',
33
- }}
34
- >
35
- {children}
36
- </div>
37
- </div>
38
- );
39
- };
40
- export default BottomSheetWrapper;
@@ -1,66 +0,0 @@
1
- import { XMarkRegularIcon } from '@eka-care/icons';
2
- import Pds2Button from '../../../atoms/button';
3
- import BottomSheetWrapper from './bottom-sheet-wrapper';
4
-
5
- type TAbhaBottomSheetProps = {
6
- description: string;
7
- subText?: string;
8
- className?: string;
9
- submitText: string;
10
- onSubmitClick: () => void;
11
- iconUrl?: string;
12
- isBottomSheetOpen: boolean;
13
- onBottomSheetClose: () => void;
14
- shouldCloseOnClickOutside?: boolean;
15
- };
16
-
17
- const AbhaBottomSheet = ({
18
- description,
19
- subText,
20
- submitText,
21
- onSubmitClick,
22
- iconUrl,
23
- isBottomSheetOpen,
24
- onBottomSheetClose,
25
- shouldCloseOnClickOutside = true,
26
- }: TAbhaBottomSheetProps) => {
27
- return (
28
- <BottomSheetWrapper
29
- isOpen={isBottomSheetOpen}
30
- setIsOpen={onBottomSheetClose}
31
- shouldCloseOnClickOutside={shouldCloseOnClickOutside}
32
- >
33
- <div className="pds2-flex pds2-flex-col pds2-p-16 pds2-text-center">
34
- {shouldCloseOnClickOutside ? (
35
- <div className="pds2-flex pds2-justify-end pds2-items-center">
36
- <button
37
- onClick={onBottomSheetClose}
38
- className="pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple"
39
- >
40
- <XMarkRegularIcon className="pds2-w-18 pds2-h-18 pds2-text-text-03" />
41
- </button>
42
- </div>
43
- ) : null}
44
- <div className="pds2-space-y-8">
45
- {iconUrl && (
46
- <span className="pds2-flex pds2-justify-center">
47
- <img src={iconUrl} className="pds2-w-64 pds2-h-64" alt="Bottom sheet icon" />
48
- </span>
49
- )}
50
- <div className="Heading4Semibold pds2-text-text-01 pds2-py-16 pds2-text-18">
51
- {description}
52
- </div>
53
- {subText && <div className="Body2Regular pds2-text-text-03">{subText}</div>}
54
- <Pds2Button
55
- title={submitText}
56
- onClick={onSubmitClick}
57
- state={'enabled'}
58
- className="pds2-w-full"
59
- />
60
- </div>
61
- </div>
62
- </BottomSheetWrapper>
63
- );
64
- };
65
-
66
- export default AbhaBottomSheet;