@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,24 +0,0 @@
1
- export type InputFieldProps = {
2
- borderRadius?: string;
3
- borderStyle?: string;
4
- padding?: string;
5
- textColor?: string;
6
- textStyle?: string;
7
- placeholder?: string;
8
- PrefixComponent?: React.ReactNode;
9
- onChange?: React.ChangeEventHandler<HTMLInputElement>;
10
- onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
11
- value: string;
12
- type?: React.HTMLInputTypeAttribute;
13
- label?: string;
14
- isMandatory?: boolean;
15
- maxDate?: string;
16
- error?: string;
17
- autoCapitalize?: string;
18
- autoCorrect?: string;
19
- disabled?: boolean;
20
- inputMode?: 'email' | 'search' | 'tel' | 'text' | 'url' | 'none' | 'numeric' | 'decimal';
21
- autoFocus?: boolean;
22
- pattern?: string;
23
- maxLength?: number;
24
- };
@@ -1,35 +0,0 @@
1
- import { InputHTMLAttributes, useState } from 'react';
2
- import { TOtpInputProps } from './types';
3
-
4
- const Pds2OtpInput = ({
5
- value,
6
- isError,
7
- ...restProps
8
- }: InputHTMLAttributes<HTMLInputElement> & TOtpInputProps) => {
9
- const [isFocused, setIsFocused] = useState(false);
10
-
11
- return (
12
- <input
13
- {...restProps}
14
- value={value}
15
- placeholder="."
16
- onFocus={(e) => {
17
- setIsFocused(true);
18
- restProps.onFocus?.(e);
19
- }}
20
- onBlur={(e) => {
21
- setIsFocused(false);
22
- restProps.onBlur?.(e);
23
- }}
24
- className={`pds2-rounded-16 pds2-border-1 pds2-p-16 ${
25
- isError
26
- ? 'pds2-border-border-error'
27
- : isFocused
28
- ? 'pds2-border-border-doc'
29
- : 'pds2-border-border-03'
30
- } pds2-w-48 pds2-bg-bg-white pds2-text-text-primary pds2-text-center placeholder:pds2-text-text-04 Body1Regular pds2-outline-none`}
31
- />
32
- );
33
- };
34
-
35
- export default Pds2OtpInput;
@@ -1,3 +0,0 @@
1
- export type TOtpInputProps = {
2
- isError?: boolean;
3
- };
@@ -1,32 +0,0 @@
1
- import { useRef } from 'react';
2
- import { TSingleInputChipProps } from './types';
3
-
4
- export default function Pds2SingleInputChip({
5
- title,
6
- isDisabled,
7
- isSelected,
8
- onSelect,
9
- }: TSingleInputChipProps) {
10
- const divRef = useRef<HTMLInputElement>(null);
11
- return (
12
- <div
13
- onClick={!isDisabled ? onSelect : undefined}
14
- className={`pds2-flex pds2-items-center pds2-cursor-pointer pds2-py-12 pds2-px-16 pds2-border-1 pds2-rounded-12 pds2-bg-bg-white
15
- ${isSelected ? 'pds2-border-border-brand-01' : 'pds2-border-border-03'}
16
- focus-within:pds2-ring-2 focus-within:pds2-ring-border-brand-01 focus-within:pds2-ring-offset-2
17
- active:pds2-bg-bg-brand-02 hover:pds2-bg-bg-hover-01
18
- pds2-transition-colors pds2-duration-200
19
- `}
20
- tabIndex={-1}
21
- ref={divRef}
22
- >
23
- <p
24
- className={`${
25
- isSelected ? 'pds2-text-text-brand Body2Semibold' : 'pds2-text-text-01 Body2Medium'
26
- }`}
27
- >
28
- {title}
29
- </p>
30
- </div>
31
- );
32
- }
@@ -1,6 +0,0 @@
1
- export type TSingleInputChipProps = {
2
- title: string;
3
- isSelected?: boolean;
4
- isDisabled?: boolean;
5
- onSelect?: () => void;
6
- };
@@ -1,33 +0,0 @@
1
- type TSpinner = {
2
- className?: string;
3
- size?: number;
4
- };
5
-
6
- const Pds2Spinner = ({ className = '', size = 40 }: TSpinner): JSX.Element => {
7
- return (
8
- <div className={`pds2-w-fit pds2-flex pds2-justify-center pds2-items-center ${className}`}>
9
- <svg
10
- className="pds2-animate-spin"
11
- id="svg-spinner"
12
- xmlns="http://www.w3.org/2000/svg"
13
- width={size}
14
- height={size}
15
- viewBox="0 0 48 48"
16
- fill="currentColor"
17
- >
18
- <circle cx="24" cy="4" r="2.5" className="fill-current opacity-100" />
19
- <circle cx="12.19" cy="7.86" r="2.5" className="fill-current opacity-90" />
20
- <circle cx="5.02" cy="17.68" r="2.5" className="fill-current opacity-80" />
21
- <circle cx="5.02" cy="30.32" r="2.5" className="fill-current opacity-70" />
22
- <circle cx="12.19" cy="40.14" r="2.5" className="fill-current opacity-60" />
23
- <circle cx="24" cy="44" r="2.5" className="fill-current opacity-50" />
24
- <circle cx="35.81" cy="40.14" r="2.5" className="fill-current opacity-40" />
25
- <circle cx="42.98" cy="30.32" r="2.5" className="fill-current opacity-30" />
26
- <circle cx="42.98" cy="17.68" r="2.5" className="fill-current opacity-20" />
27
- <circle cx="35.81" cy="7.86" r="2.5" className="fill-current opacity-10" />
28
- </svg>
29
- </div>
30
- );
31
- };
32
-
33
- export default Pds2Spinner;
@@ -1,11 +0,0 @@
1
- const TextSeparator = ({ title }: { title: string }) => {
2
- return (
3
- <div className="pds2-relative pds2-flex pds2-flex-row pds2-items-center pds2-gap-16">
4
- <div className="pds2-w-full pds2-h-1 pds2-bg-border-03"></div>
5
- <div className="pds2-text-text-04 Body2Regular pds2-text-center pds2-min-w-max">{title}</div>
6
- <div className="pds2-w-full pds2-h-1 pds2-bg-border-03"></div>
7
- </div>
8
- );
9
- };
10
-
11
- export default TextSeparator;
package/src/index.css DELETED
@@ -1,118 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- body {
6
- @apply pds2-font-lato;
7
- }
8
-
9
- @layer base {
10
- .TitlesSubheadline {
11
- @apply pds2-font-700 pds2-text-16 pds2-leading-20;
12
- }
13
- .BodyBody {
14
- @apply pds2-font-400 pds2-text-16 pds2-leading-22;
15
- }
16
- .DisplayRegular {
17
- @apply pds2-font-400 pds2-text-34 pds2-leading-44;
18
- }
19
- .DisplayMedium {
20
- @apply pds2-font-500 pds2-text-32 pds2-leading-40;
21
- }
22
- .DisplaySemibold {
23
- @apply pds2-font-600 pds2-text-32 pds2-leading-40;
24
- }
25
- .Heading2Medium {
26
- @apply pds2-font-500 pds2-text-24 pds2-leading-32;
27
- }
28
- .Heading2Semibold {
29
- @apply pds2-font-600 pds2-text-24 pds2-leading-32;
30
- }
31
- .Heading3Semibold {
32
- @apply pds2-font-600 pds2-text-20 pds2-leading-28;
33
- }
34
- .Heading4Semibold {
35
- @apply pds2-font-600 pds2-text-18 pds2-leading-24;
36
- }
37
-
38
- .Body1Semibold {
39
- @apply pds2-font-600 pds2-text-16 pds2-leading-24;
40
- }
41
- .Body2Semibold {
42
- @apply pds2-font-600 pds2-text-14 pds2-leading-20;
43
- }
44
-
45
- .Body1Regular {
46
- @apply pds2-font-400 pds2-text-16 pds2-leading-24;
47
- }
48
- .Body2Regular {
49
- @apply pds2-font-400 pds2-text-14 pds2-leading-20;
50
- }
51
- .Body2Medium {
52
- @apply pds2-font-500 pds2-text-14 pds2-leading-20;
53
- }
54
- .Body3Regular {
55
- @apply pds2-font-400 pds2-text-12 pds2-leading-16;
56
- }
57
-
58
- .Body3Medium {
59
- @apply pds2-font-500 pds2-text-12 pds2-leading-16;
60
- }
61
-
62
- .Body3Semibold {
63
- @apply pds2-font-600 pds2-text-12 pds2-leading-16;
64
- }
65
-
66
- .Body3CapsRegular {
67
- @apply pds2-font-400 pds2-text-12 pds2-leading-16 pds2-uppercase pds2-tracking-[0.96px];
68
- }
69
- .Body3CapsSemibold {
70
- @apply pds2-font-600 pds2-text-12 pds2-leading-16 pds2-uppercase pds2-tracking-[0.96px];
71
- }
72
-
73
- .BodyFootnote {
74
- @apply pds2-font-400 pds2-text-13 pds2-leading-18;
75
- }
76
-
77
- .BodyInputLabel {
78
- @apply pds2-font-400 pds2-text-12 pds2-leading-12;
79
- }
80
- .Label1Semibold {
81
- @apply pds2-font-600 pds2-text-10 pds2-leading-14;
82
- }
83
- .SubheadlineRegular {
84
- @apply pds2-font-400 pds2-text-14 pds2-leading-20;
85
- }
86
- }
87
-
88
- @layer utilities {
89
- @variants responsive {
90
- .ripple {
91
- @apply pds2-relative pds2-overflow-hidden pds2-transform;
92
- }
93
-
94
- .ripple::after {
95
- @apply pds2-absolute pds2-inset-0 pds2-block pds2-bg-center pds2-bg-no-repeat pds2-opacity-0 pds2-pointer-events-none;
96
- content: '';
97
- background-image: radial-gradient(circle, #000 10%, transparent 10.01%);
98
- transform: scale(10, 10);
99
- transition:
100
- transform 0.3s,
101
- opacity 1s;
102
- }
103
-
104
- .ripple:active::after {
105
- transform: scale(0, 0);
106
- opacity: 0.3;
107
- transition: 0s;
108
- }
109
- }
110
- }
111
-
112
- input[type="date"]::-webkit-calendar-picker-indicator {
113
- display: inline !important;
114
- -webkit-appearance: auto !important;
115
- width: 16px;
116
- padding: 0px;
117
- margin: 0px;
118
- }
package/src/main.tsx DELETED
@@ -1,313 +0,0 @@
1
- import { ABHA_AUTH_FLOW_METHOD } from '@elixir/types';
2
- import { setEnv } from 'apis';
3
- import { TAuthVerifyV2Response } from 'apis/src/types/aorta-go';
4
- import { createRoot, Root } from 'react-dom/client';
5
- import 'ui/styles.css';
6
- import App, { queryClient } from './App';
7
- import './index.css';
8
- import useAuthAbhaStore from './stores/auth-abha-store';
9
- import { SCREEN_NAMES } from './stores/auth-abha-store/types';
10
- import { handleSendEvent } from '@elixir/utils';
11
-
12
- const trackAbhaEvent = ({ name, data = {} }: { name: string; data?: Record<string, any> }) => {
13
-
14
- const eventData = {
15
- ...data,
16
- };
17
-
18
- handleSendEvent({
19
- eventName: name,
20
- eventData,
21
- });
22
-
23
- window.curio?.pushToMixpanel?.(name, eventData);
24
- };
25
-
26
- export type TMethod = 'login_with_abha' | 'create_abha_with_mobile' | 'login_or_create_abha';
27
-
28
- const getScreenName = ({ method = 'login_with_abha' }: { method?: TMethod }): SCREEN_NAMES => {
29
- switch (method) {
30
- case 'login_with_abha':
31
- return SCREEN_NAMES.LOGIN_WITH_ABHA;
32
- case 'create_abha_with_mobile':
33
- return SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR;
34
- case 'login_or_create_abha':
35
- return SCREEN_NAMES.LOGIN_OR_CREATE_ABHA;
36
- default:
37
- return SCREEN_NAMES.LOGIN_WITH_ABHA;
38
- }
39
- };
40
-
41
- type TInitAbhaAppParams = {
42
- clientId: string;
43
- containerId: string;
44
- urlParams?: {
45
- nextUrl: string;
46
- };
47
- method?: TMethod;
48
- data?: {
49
- mobile?: string;
50
- accessToken?: string;
51
- oid?: string;
52
- };
53
- appVersion?: string;
54
- onSuccess: (params: TOnAbhaSuccessParams) => void;
55
- onError: (params: TOnAbhaFailureParams) => void;
56
- onAbhaClose: () => void;
57
- };
58
-
59
- declare global {
60
- interface Window {
61
- initAbhaApp: (params: TInitAbhaAppParams) => void;
62
- closeAbhaApp: () => void;
63
- EkaAbha?: {
64
- mobileNumber?: string;
65
- onAbhaSuccess: (params: string) => void;
66
- onAbhaError: (params: string) => void;
67
- onAbhaClose: () => void;
68
- changeStatusBarColor?: (params: string) => void;
69
- };
70
- curio?: {
71
- pushToMixpanel?: (eventName: string, eventProps: Record<string, any>) => void;
72
- };
73
- }
74
- }
75
-
76
- // TODO: Move all the rendering functions to a separate file
77
-
78
- let PopupReactNode: Root | null = null;
79
-
80
- export let unMount: () => void;
81
-
82
- type TOnAbhaSuccessParams = {
83
- response: TAuthVerifyV2Response;
84
- };
85
-
86
- export let onAbhaSuccess: (params: TOnAbhaSuccessParams) => void;
87
-
88
- type TOnAbhaFailureParams = { error?: string; response?: TAuthVerifyV2Response };
89
-
90
- export let onAbhaFailure: (params: TOnAbhaFailureParams) => void;
91
-
92
- function initAbhaApp(params: TInitAbhaAppParams) {
93
- // clear abha auth store at the very start
94
- console.log('clear the abha auth store for every sdk invocation', params);
95
- useAuthAbhaStore.getState().clearAbhaAuthStore();
96
-
97
- const {
98
- clientId,
99
- containerId,
100
- urlParams,
101
- method,
102
- data: abhaData,
103
- appVersion,
104
- onSuccess,
105
- onError,
106
- onAbhaClose,
107
- } = params;
108
- const { mobile, accessToken, oid } = abhaData || {};
109
- const headers: Record<string, string> = {};
110
-
111
- if (accessToken) {
112
- headers.auth = accessToken;
113
- }
114
-
115
- if (oid) {
116
- headers['X-User-ID'] = oid;
117
- }
118
- console.log('set headers in headers');
119
-
120
- console.log('invoked initAbhaApp', headers);
121
-
122
- // adding a check of oid in headers, in stetho, only oid is passed, auth is not passed.
123
-
124
- const isEkaAppLogin = headers !== null && ('auth' in headers || 'X-User-ID' in headers);
125
- useAuthAbhaStore.getState().setIsEkaAppLogin(isEkaAppLogin);
126
-
127
- // set true to isEkaAppLogin if clientId is doc-web
128
- if (clientId === 'doc-web') {
129
- useAuthAbhaStore.getState().setIsEkaAppLogin(true);
130
- }
131
- console.log('clientId ', clientId);
132
- console.log('isEkaAppLogin', useAuthAbhaStore.getState().isEkaAppLogin);
133
-
134
- if (
135
- clientId === 'androiddoc' ||
136
- clientId === 'doctor-app-ios' ||
137
- clientId === 'doctor-ipad-ios' ||
138
- clientId === 'doc-web'
139
- ) {
140
- useAuthAbhaStore.getState().setClientId('doctor');
141
- } else if (clientId === 'androidp' || clientId === 'patient-app-ios') {
142
- useAuthAbhaStore.getState().setClientId('phr');
143
- } else if (clientId === 'www-eka') {
144
- useAuthAbhaStore.getState().setClientId('eka-web');
145
- } else {
146
- console.log('here');
147
- useAuthAbhaStore.getState().setClientId('phr');
148
- }
149
-
150
- let isDocAppRequest = false;
151
-
152
- // publish an mix panel event
153
- handleSendEvent({
154
- eventName: 'init_abha_app',
155
- eventData: {
156
- platform: clientId,
157
- method: method || '',
158
- mobile: mobile || '',
159
- accessToken: accessToken || '',
160
- oid: oid || '',
161
- appVersion: appVersion || '',
162
- isEkaAppLogin: isEkaAppLogin.toString(),
163
- container_id: containerId,
164
- },
165
- });
166
-
167
- // use onTrack
168
- onTrack('init_abha_app', {
169
- platform: clientId,
170
- method: method || '',
171
- mobile: mobile || '',
172
- accessToken: headers.auth || '',
173
- oid: headers['X-User-ID'] || '',
174
- appVersion: appVersion || '',
175
- isEkaAppLogin: isEkaAppLogin.toString(),
176
- container_id: containerId,
177
- });
178
-
179
- if (
180
- clientId === 'androiddoc' ||
181
- clientId === 'doctor-app-ios' ||
182
- clientId === 'doctor-ipad-ios' ||
183
- clientId === 'doc-web'
184
- ) {
185
- isDocAppRequest = true;
186
- useAuthAbhaStore.getState().setIsDocAppRequest(isDocAppRequest);
187
- }
188
-
189
- useAuthAbhaStore
190
- .getState()
191
- .setInitAbhaAppMethod(
192
- method === 'create_abha_with_mobile' ? 'create_abha_with_mobile' : 'login_with_abha'
193
- );
194
-
195
- setEnv({
196
- // TODO: Change this to the actual client id
197
- clientId,
198
- env: import.meta.env.VITE_APP_ENV === 'PROD' ? 'PROD' : 'DEV',
199
- ...(headers && { extraHeaders: headers }),
200
- });
201
-
202
- const screenName = SCREEN_NAMES.LOGIN_OR_CREATE_ABHA;
203
-
204
- useAuthAbhaStore.getState().setInitState({
205
- screen: [screenName],
206
- urlParams,
207
- });
208
-
209
- useAuthAbhaStore.getState().setAbhaAuthFlowMethod(ABHA_AUTH_FLOW_METHOD.MOBILE);
210
- const regex = /[^0-9]/g;
211
- const mobileNumber = mobile || window.EkaAbha?.mobileNumber;
212
- const regexMobileNumber = mobileNumber?.replace(regex, '');
213
- const validMobile = regexMobileNumber?.slice(-10);
214
-
215
- if (validMobile && validMobile.length === 10) {
216
- // if it valid mobile number then set it in the store
217
- useAuthAbhaStore.getState().setInitAbhaAppMobileNumber(validMobile);
218
- }
219
-
220
- const closeAbhaApp = () => {
221
-
222
- trackAbhaEvent({
223
- name: 'connectivity-debug-onclose',
224
- data: {
225
- platform: clientId,
226
- line: 226,
227
- function: "closeAbhaApp",
228
- page: "main.tsx.tsx",
229
- flow: "debug",
230
- },
231
- });
232
- useAuthAbhaStore.getState().clearAbhaAuthStore();
233
- queryClient.removeQueries();
234
- PopupReactNode?.unmount();
235
- onAbhaClose();
236
- };
237
-
238
- const rootElement = document.getElementById(containerId);
239
- if (!rootElement) {
240
- const errorMessage = `Element with id ${containerId} not found`;
241
- console.error(errorMessage);
242
- onError({ error: errorMessage });
243
- closeAbhaApp();
244
- return;
245
- }
246
-
247
- onAbhaSuccess = onSuccess;
248
- onAbhaFailure = onError;
249
-
250
- PopupReactNode = createRoot(rootElement);
251
- PopupReactNode.render(<App />);
252
-
253
- unMount = closeAbhaApp;
254
- window.closeAbhaApp = closeAbhaApp;
255
-
256
- return closeAbhaApp;
257
- }
258
-
259
- window.initAbhaApp = initAbhaApp;
260
-
261
- let eventQueue: Array<{ eventName: string; eventProps: Record<string, any> }> = [];
262
-
263
- function onTrack(eventName: string, eventProperties: Record<string, any> = {}) {
264
- const platform = useAuthAbhaStore.getState().clientId || 'unknown-platform';
265
-
266
- const finalEventProps = {
267
- ...eventProperties,
268
- platform,
269
- };
270
-
271
- console.log('Tracking Event:', eventName, finalEventProps);
272
-
273
- if (window.curio?.pushToMixpanel) {
274
- console.log('Pushing to Mixpanel:', eventName, finalEventProps);
275
- window.curio.pushToMixpanel(eventName, finalEventProps);
276
- } else {
277
- console.log('Curio not available. Queuing event:', eventName, finalEventProps);
278
- console.error('Curio not available. Could not push event to Mixpanel.');
279
- }
280
- }
281
-
282
- if (import.meta.env.VITE_APP_MODE === 'DEBUG') {
283
- initAbhaApp({
284
- clientId: 'www-eka',
285
- containerId: 'lofe_root',
286
- method: 'login_or_create_abha',
287
- data: {
288
- // mobile: '8709459003',
289
- // accessToken:
290
- // 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhbmRyb2lkZG9jIiwiYi1pZCI6Ijc3MjM3NjM3NzYzODE3IiwiY2MiOnt9LCJkb2IiOiIxOTk4LTAyLTEwIiwiZXhwIjoxNzQxODY3NDMyLCJmbiI6IlN0YWdlIiwiZ2VuIjoiTSIsImlhdCI6MTc0MTg2NjgzMiwiaXNzIjoiZW1yLmVrYS5jYXJlIiwibG4iOiJHb2QiLCJvaWQiOiIxNzQxMTY3MTMwMjk3NjgiLCJwcyI6IkQiLCJ1dWlkIjoiZGRjMGVmNDUtNDZmOS00ZGE5LTlhNTgtNjcwZjc1N2YyYzc3In0.ZHpMNQuolWQ-MqzbYAHnZGVz1CqFTofm7sV-7ARlfug',
291
- // oid: '17418668693032712',
292
- },
293
- // urlParams: { from: 'dr', next: 'https://www.google.com' },
294
- // workspaceName: 'hell',
295
- onSuccess: (params) => {
296
- handleSendEvent({
297
- eventName: 'abha_on_success',
298
- eventData: {
299
- params: JSON.stringify(params),
300
- oid: params?.response?.data?.profile?.oid ?? '',
301
- uuid: params?.response?.data?.profile?.uuid ?? '',
302
- },
303
- });
304
- console.log('%c Line:117 🍕 onSuccessParams', 'color:#465975', params);
305
- },
306
- onError: (params) => {
307
- console.log('%c Line:121 🥟 onErrorParams', 'color:#6ec1c2', params);
308
- },
309
- onAbhaClose: () => {
310
- console.log('%c Line:121 🥟 onAbhaClose', 'color:#6ec1c2');
311
- },
312
- });
313
- }
@@ -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'
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 '@elixir/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;