@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
@@ -1,66 +0,0 @@
1
- import { GET_NDHM_HOST, TPostAbdmRegisterCreatePhrResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postAbdmProfileEka({
5
- abha_address,
6
- address,
7
- first_name,
8
- last_name,
9
- day_of_birth,
10
- month_of_birth,
11
- year_of_birth,
12
- gender,
13
- middle_name,
14
- pincode,
15
- // token,
16
- }: {
17
- abha_address: string;
18
- address?: string;
19
- day_of_birth: number;
20
- first_name: string;
21
- gender: string;
22
- last_name: string;
23
- month_of_birth: number;
24
- pincode: string;
25
- year_of_birth: number;
26
- middle_name?: string;
27
- // token?: string;
28
- }): Promise<TPostAbdmRegisterCreatePhrResponse> {
29
- const myHeaders = new Headers();
30
- myHeaders.append("Content-Type", "application/json");
31
- // if (token) myHeaders.append("auth", token);
32
- const raw = JSON.stringify({
33
- abha_address,
34
- profile: {
35
- address,
36
- day_of_birth,
37
- first_name,
38
- gender,
39
- last_name,
40
- middle_name,
41
- month_of_birth,
42
- pincode,
43
- year_of_birth,
44
- },
45
- });
46
-
47
- const requestOptions: RequestInit = {
48
- method: "POST",
49
- headers: myHeaders,
50
- body: raw,
51
- redirect: "follow",
52
- credentials: "include",
53
- };
54
-
55
- try {
56
- const NDHM_HOST = GET_NDHM_HOST();
57
- const response = await fetch(
58
- `${NDHM_HOST}/abdm/v1/profile/eka`,
59
- requestOptions
60
- );
61
- return await response.json();
62
- } catch (error) {
63
- console.error("postAbdmProfileEka error =>", error);
64
- }
65
- return {} as TPostAbdmRegisterCreatePhrResponse;
66
- }
@@ -1,37 +0,0 @@
1
- import { GET_NDHM_HOST, TPostAbdmRegisterCreatePhrResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postAbdmRegisterAbhaNumberCreatePhr({
5
- abha_address,
6
- txn_id,
7
- }: {
8
- abha_address: string;
9
- txn_id: string;
10
- }): Promise<TPostAbdmRegisterCreatePhrResponse> {
11
- const myHeaders = new Headers();
12
- myHeaders.append("Content-Type", "application/json");
13
- const raw = JSON.stringify({
14
- abha_address,
15
- txn_id,
16
- });
17
-
18
- const requestOptions: RequestInit = {
19
- method: "POST",
20
- headers: myHeaders,
21
- body: raw,
22
- redirect: "follow",
23
- credentials: "include",
24
- };
25
-
26
- try {
27
- const NDHM_HOST = GET_NDHM_HOST();
28
- const response = await fetch(
29
- `${NDHM_HOST}/abdm/na/v1/registration/abha-number/create-phr`,
30
- requestOptions
31
- );
32
- return await response.json();
33
- } catch (error) {
34
- console.error("postAbdmRegisterAbhaNumberCreatePhr ==>", error);
35
- }
36
- return {} as TPostAbdmRegisterCreatePhrResponse;
37
- }
@@ -1,66 +0,0 @@
1
- import fetch from "../../fetch-client";
2
- import { GET_NDHM_HOST, TPostAbdmRegisterCreatePhrResponse } from '../../constants/constants';
3
-
4
- export default async function postAbdmRegisterMobileCreatePhr({
5
- abha_address,
6
- address,
7
- first_name,
8
- last_name,
9
- day_of_birth,
10
- month_of_birth,
11
- year_of_birth,
12
- gender,
13
- middle_name,
14
- pincode,
15
- txn_id,
16
- }: {
17
- abha_address: string;
18
- address?: string;
19
- day_of_birth: number;
20
- first_name: string;
21
- gender: string;
22
- last_name: string;
23
- month_of_birth: number;
24
- pincode: string;
25
- year_of_birth: number;
26
- middle_name?: string;
27
- txn_id: string;
28
- }): Promise<TPostAbdmRegisterCreatePhrResponse> {
29
- const myHeaders = new Headers();
30
- myHeaders.append('Content-Type', 'application/json');
31
- const raw = JSON.stringify({
32
- abha_address,
33
- profile: {
34
- address,
35
- day_of_birth,
36
- first_name,
37
- gender,
38
- last_name,
39
- middle_name,
40
- month_of_birth,
41
- pincode,
42
- year_of_birth,
43
- },
44
- txn_id,
45
- });
46
-
47
- const requestOptions: RequestInit = {
48
- method: 'POST',
49
- headers: myHeaders,
50
- body: raw,
51
- redirect: 'follow',
52
- credentials: "include",
53
- };
54
-
55
- try {
56
- const NDHM_HOST = GET_NDHM_HOST();
57
- const response = await fetch(
58
- `${NDHM_HOST}/abdm/na/v1/registration/mobile/create-phr`,
59
- requestOptions
60
- );
61
- return await response.json();
62
- } catch (error) {
63
- console.error('postAbdmRegisterMobileCreatePhr error =>', error);
64
- }
65
- return {} as TPostAbdmRegisterCreatePhrResponse;
66
- }
@@ -1,32 +0,0 @@
1
-
2
- import { GET_NDHM_HOST, TPostRegisterInitResponse } from "../../constants/constants";
3
- import fetch from "../../fetch-client";
4
-
5
- export default async function postAbdmRegisterMobileResendOtp({
6
- txn_id,
7
- }: {
8
- txn_id: string;
9
- }): Promise<TPostRegisterInitResponse> {
10
- const myHeaders = new Headers();
11
- myHeaders.append("Content-Type", "application/json");
12
-
13
- const requestOptions: RequestInit = {
14
- method: "POST",
15
- headers: myHeaders,
16
- body: JSON.stringify({ txn_id }),
17
- redirect: "follow",
18
- credentials: "include",
19
- };
20
-
21
- try {
22
- const NDHM_HOST = GET_NDHM_HOST();
23
- const response = await fetch(
24
- `${NDHM_HOST}/abdm/na/v1/registration/mobile/resend`,
25
- requestOptions
26
- );
27
- return await response.json();
28
- } catch (error) {
29
- // console.error(error);
30
- }
31
- return {} as TPostRegisterInitResponse;
32
- }
@@ -1,38 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterVerifyResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postAbdmRegisterMobileVerify({
5
- txn_id,
6
- otp,
7
- }: {
8
- txn_id: string;
9
- otp: string;
10
- }): Promise<TPostRegisterVerifyResponse> {
11
- const myHeaders = new Headers();
12
- myHeaders.append("Content-Type", "application/json");
13
-
14
- const raw = JSON.stringify({
15
- txn_id,
16
- otp,
17
- });
18
-
19
- const requestOptions: RequestInit = {
20
- method: "POST",
21
- headers: myHeaders,
22
- body: raw,
23
- redirect: "follow",
24
- credentials: "include",
25
- };
26
-
27
- try {
28
- const NDHM_HOST = GET_NDHM_HOST();
29
- const response = await fetch(
30
- `${NDHM_HOST}/abdm/na/v1/registration/mobile/verify`,
31
- requestOptions
32
- );
33
- return await response.json();
34
- } catch (error) {
35
- // console.error(error);
36
- }
37
- return {} as TPostRegisterVerifyResponse;
38
- }
@@ -1,34 +0,0 @@
1
- import { GET_NDHM_HOST, TPostAbdmRegisterPhrCheckResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postAbdmRegisterPhrCheck({
5
- abha_address,
6
- }: {
7
- abha_address: string;
8
- }): Promise<TPostAbdmRegisterPhrCheckResponse> {
9
- const myHeaders = new Headers();
10
- myHeaders.append("Content-Type", "application/json");
11
- const raw = JSON.stringify({
12
- abha_address,
13
- });
14
-
15
- const requestOptions: RequestInit = {
16
- method: "POST",
17
- headers: myHeaders,
18
- body: raw,
19
- redirect: "follow",
20
- credentials: "include",
21
- };
22
-
23
- try {
24
- const NDHM_HOST = GET_NDHM_HOST();
25
- const response = await fetch(
26
- `${NDHM_HOST}/abdm/na/v1/registration/phr/check`,
27
- requestOptions
28
- );
29
- return await response.json();
30
- } catch (error) {
31
- console.error("postAbdmRegisterPhrCheck ==>", error);
32
- }
33
- return {} as TPostAbdmRegisterPhrCheckResponse;
34
- }
@@ -1,37 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterAddressCreatePhrResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterAadhaarCreatePhr({
5
- abha_address,
6
- txn_id,
7
- }: {
8
- abha_address: string;
9
- txn_id: string;
10
- }): Promise<TPostRegisterAddressCreatePhrResponse> {
11
- const myHeaders = new Headers();
12
- myHeaders.append("Content-Type", "application/json");
13
- const raw = JSON.stringify({
14
- abha_address,
15
- txn_id,
16
- });
17
-
18
- const requestOptions: RequestInit = {
19
- method: "POST",
20
- headers: myHeaders,
21
- body: raw,
22
- redirect: "follow",
23
- credentials: "include",
24
- };
25
-
26
- try {
27
- const NDHM_HOST = GET_NDHM_HOST();
28
- const response = await fetch(
29
- `${NDHM_HOST}/abdm/na/v1/registration/aadhaar/create-phr`,
30
- requestOptions
31
- );
32
- return await response.json();
33
- } catch (error) {
34
- console.error("postRegisterAadhaarCreatePhr ==>", error);
35
- }
36
- return {} as TPostRegisterAddressCreatePhrResponse;
37
- }
@@ -1,34 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterInitResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterAadhaarInit({
5
- aadhaar_number,
6
- }: {
7
- aadhaar_number: string;
8
- }): Promise<TPostRegisterInitResponse> {
9
- const myHeaders = new Headers();
10
- myHeaders.append("Content-Type", "application/json");
11
- const raw = JSON.stringify({
12
- aadhaar_number,
13
- });
14
-
15
- const requestOptions: RequestInit = {
16
- method: "POST",
17
- headers: myHeaders,
18
- body: raw,
19
- redirect: "follow",
20
- credentials: "include",
21
- };
22
-
23
- try {
24
- const NDHM_HOST = GET_NDHM_HOST();
25
- const response = await fetch(
26
- `${NDHM_HOST}/abdm/na/v1/registration/aadhaar/init`,
27
- requestOptions
28
- );
29
- return await response.json();
30
- } catch (error) {
31
- // console.error(error);
32
- }
33
- return {} as TPostRegisterInitResponse;
34
- }
@@ -1,34 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterInitResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterAadhaarMobileResendOtp({
5
- txn_id,
6
- }: {
7
- txn_id: string;
8
- }): Promise<TPostRegisterInitResponse> {
9
- const myHeaders = new Headers();
10
- myHeaders.append("Content-Type", "application/json");
11
- const raw = JSON.stringify({
12
- txn_id,
13
- });
14
-
15
- const requestOptions: RequestInit = {
16
- method: "POST",
17
- headers: myHeaders,
18
- body: raw,
19
- redirect: "follow",
20
- credentials: "include",
21
- };
22
-
23
- try {
24
- const NDHM_HOST = GET_NDHM_HOST();
25
- const response = await fetch(
26
- `${NDHM_HOST}/abdm/na/v1/registration/aadhaar/mobile/resend`,
27
- requestOptions
28
- );
29
- return await response.json();
30
- } catch (error) {
31
- // console.error(error);
32
- }
33
- return {} as TPostRegisterInitResponse;
34
- }
@@ -1,37 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterVerifyResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterAadhaarMobileVerify({
5
- txn_id,
6
- otp,
7
- }: {
8
- txn_id: string;
9
- otp: string;
10
- }): Promise<TPostRegisterVerifyResponse> {
11
- const myHeaders = new Headers();
12
- myHeaders.append("Content-Type", "application/json");
13
- const raw = JSON.stringify({
14
- txn_id,
15
- otp,
16
- });
17
-
18
- const requestOptions: RequestInit = {
19
- method: "POST",
20
- headers: myHeaders,
21
- body: raw,
22
- redirect: "follow",
23
- credentials: "include",
24
- };
25
-
26
- try {
27
- const NDHM_HOST = GET_NDHM_HOST();
28
- const response = await fetch(
29
- `${NDHM_HOST}/abdm/na/v1/registration/aadhaar/mobile/verify`,
30
- requestOptions
31
- );
32
- return await response.json();
33
- } catch (error) {
34
- // console.error(error);
35
- }
36
- return {} as TPostRegisterVerifyResponse;
37
- }
@@ -1,34 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterInitResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterAadhaarResendOtp({
5
- txn_id,
6
- }: {
7
- txn_id: string;
8
- }): Promise<TPostRegisterInitResponse> {
9
- const myHeaders = new Headers();
10
- myHeaders.append("Content-Type", "application/json");
11
- const raw = JSON.stringify({
12
- txn_id,
13
- });
14
-
15
- const requestOptions: RequestInit = {
16
- method: "POST",
17
- headers: myHeaders,
18
- body: raw,
19
- redirect: "follow",
20
- credentials: "include",
21
- };
22
-
23
- try {
24
- const NDHM_HOST = GET_NDHM_HOST();
25
- const response = await fetch(
26
- `${NDHM_HOST}/abdm/na/v1/registration/aadhaar/resend`,
27
- requestOptions
28
- );
29
- return await response.json();
30
- } catch (error) {
31
- // console.error(error);
32
- }
33
- return {} as TPostRegisterInitResponse;
34
- }
@@ -1,40 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterVerifyResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterAadhaarVerify({
5
- txn_id,
6
- mobile,
7
- otp,
8
- }: {
9
- txn_id: string;
10
- mobile: string;
11
- otp: string;
12
- }): Promise<TPostRegisterVerifyResponse> {
13
- const myHeaders = new Headers();
14
- myHeaders.append("Content-Type", "application/json");
15
- const raw = JSON.stringify({
16
- txn_id,
17
- mobile,
18
- otp,
19
- });
20
-
21
- const requestOptions: RequestInit = {
22
- method: "POST",
23
- headers: myHeaders,
24
- body: raw,
25
- redirect: "follow",
26
- credentials: "include",
27
- };
28
-
29
- try {
30
- const NDHM_HOST = GET_NDHM_HOST();
31
- const response = await fetch(
32
- `${NDHM_HOST}/abdm/na/v1/registration/aadhaar/verify`,
33
- requestOptions
34
- );
35
- return await response.json();
36
- } catch (error) {
37
- // console.error(error);
38
- }
39
- return {} as TPostRegisterVerifyResponse;
40
- }
@@ -1,34 +0,0 @@
1
- import { GET_NDHM_HOST, TPostRegisterInitResponse } from "../../constants/constants";
2
- import fetch from "../../fetch-client";
3
-
4
- export default async function postRegisterMobileInit({
5
- mobile_number,
6
- }: {
7
- mobile_number: string;
8
- }): Promise<TPostRegisterInitResponse> {
9
- const myHeaders = new Headers();
10
- myHeaders.append("Content-Type", "application/json");
11
- const raw = JSON.stringify({
12
- mobile_number,
13
- });
14
-
15
- const requestOptions: RequestInit = {
16
- method: "POST",
17
- headers: myHeaders,
18
- body: raw,
19
- redirect: "follow",
20
- credentials: "include",
21
- };
22
-
23
- try {
24
- const NDHM_HOST = GET_NDHM_HOST();
25
- const response = await fetch(
26
- `${NDHM_HOST}/abdm/na/v1/registration/mobile/init`,
27
- requestOptions
28
- );
29
- return await response.json();
30
- } catch (error) {
31
- console.error(error);
32
- }
33
- return {} as TPostRegisterInitResponse;
34
- }
@@ -1,12 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query';
2
- import getProfilesPatient from './aorta-go/v3/get-profile-patient';
3
-
4
-
5
- const useGetProfilesPatient = () => {
6
- return useQuery({
7
- queryKey: ['profilesPatientResponse'],
8
- queryFn: getProfilesPatient,
9
- });
10
- };
11
-
12
- export default useGetProfilesPatient;
@@ -1,28 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query';
2
- import { TGetProfilesPhrResponse } from '../constants/constants';
3
- import getProfilePhrUser from './aorta-go/v3/get-profiles-phr-user';
4
-
5
-
6
- const useGetProfilesPhrUser = () => {
7
- return useQuery({
8
- queryKey: ['profilesPhrUserResponse'],
9
- queryFn: async () => {
10
- const profilesPhrUserResponse = await getProfilePhrUser();
11
- var filteredProfilesResponse: TGetProfilesPhrResponse;
12
- if (Array.isArray(profilesPhrUserResponse)) {
13
- filteredProfilesResponse = profilesPhrUserResponse?.filter(
14
- (res) => !res['health-ids'] || res['health-ids'].length === 0
15
- );
16
- } else {
17
- filteredProfilesResponse = [];
18
- }
19
- const updatedProfilesPhrResponse = {
20
- profiles: filteredProfilesResponse,
21
- };
22
-
23
- return updatedProfilesPhrResponse;
24
- },
25
- });
26
- };
27
-
28
- export default useGetProfilesPhrUser;
@@ -1,26 +0,0 @@
1
- import { useMutation } from '@tanstack/react-query';
2
-
3
- import { queryClient } from '../App';
4
- import useAuthAbhaStore from '../stores/auth-abha-store';
5
- import postAbdmLoginVerify from './ndhm/post-abdm-login-verify';
6
-
7
- const usePostAbdmLoginVerify = () => {
8
- const setSelectedAbhaAddress = useAuthAbhaStore((state) => state.setSelectedAbhaAddress);
9
- return useMutation({
10
- mutationFn: ({ txn_id, otp }: { txn_id: string; otp: string }) => {
11
- return postAbdmLoginVerify({
12
- otp,
13
- txn_id,
14
- });
15
- },
16
- onSuccess(profileLoginVerifyResponse) {
17
- if (profileLoginVerifyResponse.profile) {
18
- queryClient.setQueryData(['abdmProfilePhrResponse'], profileLoginVerifyResponse.profile);
19
- setSelectedAbhaAddress(profileLoginVerifyResponse.profile.abha_address);
20
- }
21
- return;
22
- },
23
- });
24
- };
25
-
26
- export default usePostAbdmLoginVerify;
@@ -1,50 +0,0 @@
1
- import { useMutation } from '@tanstack/react-query';
2
- import { onAbhaSuccess, unMount } from '../main';
3
- import useAuthAbhaStore from '../stores/auth-abha-store';
4
- import { SCREEN_NAMES } from '../stores/auth-abha-store/types';
5
- import { setIndividualEnv, TAuthVerifyV2Request } from '../constants/constants';
6
- import postAuthVerifyV2 from './aorta-go/v3/post-auth-verify-v2';
7
-
8
- export type TVerifyToken = {
9
- sess: string;
10
- refresh: string;
11
- };
12
-
13
- const usePostAuthVerifyV2 = () => {
14
- const setScreen = useAuthAbhaStore((state) => state.setScreen);
15
-
16
- return useMutation({
17
- mutationFn: (
18
- params: TAuthVerifyV2Request & {
19
- /**
20
- * Send the oid for the selected phr address if present here.
21
- * The oid will be coming from ndhm response.
22
- */
23
- oid?: string;
24
- }
25
- ) => {
26
- return postAuthVerifyV2(params);
27
- },
28
- onSuccess: (verifyDataResponse, { oid }) => {
29
- if (oid) {
30
- if (window.EkaAbha && window.EkaAbha.onAbhaSuccess) {
31
- window.EkaAbha?.onAbhaSuccess(JSON.stringify({ response: verifyDataResponse }));
32
- return;
33
- }
34
- onAbhaSuccess({ response: verifyDataResponse });
35
- unMount();
36
- return;
37
- }
38
- if (verifyDataResponse.data?.tokens.sess) {
39
- setIndividualEnv({
40
- extraHeaders: {
41
- auth: verifyDataResponse.data?.tokens.sess,
42
- },
43
- });
44
- }
45
- setScreen(SCREEN_NAMES.GET_ALL_PROFILES);
46
- },
47
- });
48
- };
49
-
50
- export default usePostAuthVerifyV2;