@eka-care/abha-stg 0.1.34 → 0.1.36

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 (117) hide show
  1. package/.turbo/daemon/7f0c6427972069cb-turbo.log.2025-11-12 +0 -0
  2. package/README.md +369 -101
  3. package/{dist/index.html → index.html} +1 -2
  4. package/package/styles/pds2/border.ts +69 -0
  5. package/package/styles/pds2/colors.ts +70 -0
  6. package/package/styles/pds2/spacing.ts +1007 -0
  7. package/package/tailwind/tailwind.config.ts +124 -0
  8. package/package.json +9 -8
  9. package/postcss.config.js +6 -0
  10. package/scripts/build-purged-css.cjs +70 -0
  11. package/src/App.css +0 -0
  12. package/src/App.tsx +43 -0
  13. package/src/api-queries/aorta-go/v3/get-profile-patient.ts +32 -0
  14. package/src/api-queries/aorta-go/v3/get-profiles-phr-user.ts +26 -0
  15. package/src/api-queries/aorta-go/v3/post-auth-init-v2.ts +34 -0
  16. package/src/api-queries/aorta-go/v3/post-auth-logout-v2.ts +32 -0
  17. package/src/api-queries/aorta-go/v3/post-auth-verify-v2.ts +38 -0
  18. package/src/api-queries/aorta-go/v3/post-profile-switch.ts +39 -0
  19. package/src/api-queries/ndhm/get-abdm-register-suggest.ts +37 -0
  20. package/src/api-queries/ndhm/get-pincode-details.ts +28 -0
  21. package/src/api-queries/ndhm/post-abdm-login-init.ts +37 -0
  22. package/src/api-queries/ndhm/post-abdm-login-phr.ts +37 -0
  23. package/src/api-queries/ndhm/post-abdm-login-verify.ts +37 -0
  24. package/src/api-queries/ndhm/post-abdm-profile-eka-link-phr.ts +40 -0
  25. package/src/api-queries/ndhm/post-abdm-profile-eka.ts +66 -0
  26. package/src/api-queries/ndhm/post-abdm-register-abha-number-create-phr.ts +37 -0
  27. package/src/api-queries/ndhm/post-abdm-register-mobile-create-phr.ts +66 -0
  28. package/src/api-queries/ndhm/post-abdm-register-mobile-resend-otp.ts +32 -0
  29. package/src/api-queries/ndhm/post-abdm-register-mobile-verify.ts +38 -0
  30. package/src/api-queries/ndhm/post-abdm-register-phr-check.ts +34 -0
  31. package/src/api-queries/ndhm/post-register-aadhaar-create-phr.ts +37 -0
  32. package/src/api-queries/ndhm/post-register-aadhaar-init.ts +34 -0
  33. package/src/api-queries/ndhm/post-register-aadhaar-mobile-resend-otp.ts +34 -0
  34. package/src/api-queries/ndhm/post-register-aadhaar-mobile-verify.ts +37 -0
  35. package/src/api-queries/ndhm/post-register-aadhaar-resend-otp.ts +34 -0
  36. package/src/api-queries/ndhm/post-register-aadhaar-verify.ts +40 -0
  37. package/src/api-queries/ndhm/post-register-mobile-init.ts +34 -0
  38. package/src/api-queries/use-get-profiles-patient.ts +12 -0
  39. package/src/api-queries/use-get-profiles-phr-user.ts +28 -0
  40. package/src/api-queries/use-post-abdm-login-verify-v1.ts +26 -0
  41. package/src/api-queries/use-post-auth-verify-v2.ts +50 -0
  42. package/src/api-queries/use-post-profile-switch.ts +58 -0
  43. package/src/api-queries/use-post-register-mobile-create-phr.ts +39 -0
  44. package/src/api-queries/user-post-abdm-profile-login-phr.ts +26 -0
  45. package/src/assets/Success.json +1 -0
  46. package/src/assets/react.svg +1 -0
  47. package/src/atoms/button/custom-button.tsx +32 -0
  48. package/src/atoms/button/index.tsx +40 -0
  49. package/src/atoms/button/types.d.ts +31 -0
  50. package/src/atoms/header.tsx +25 -0
  51. package/src/atoms/input-field/index.tsx +63 -0
  52. package/src/atoms/input-field/patient-input-field.tsx +16 -0
  53. package/src/atoms/input-field/types.ts +24 -0
  54. package/src/atoms/pds2-otp-input/index.tsx +35 -0
  55. package/src/atoms/pds2-otp-input/types.d.ts +3 -0
  56. package/src/atoms/single-input-chip/index.tsx +32 -0
  57. package/src/atoms/single-input-chip/types.ts +6 -0
  58. package/src/atoms/spinner.tsx +33 -0
  59. package/src/atoms/text-separator.tsx +11 -0
  60. package/src/atoms/ui/spinner.tsx +75 -0
  61. package/src/constants/constants.ts +376 -0
  62. package/src/fetch-client/index.ts +164 -0
  63. package/src/index.css +152 -0
  64. package/src/main.tsx +374 -0
  65. package/src/molecules/abha/bottom-sheet/bottom-sheet-wrapper.tsx +40 -0
  66. package/src/molecules/abha/bottom-sheet/index.tsx +66 -0
  67. package/src/molecules/abha/spaced-input-component.tsx +168 -0
  68. package/src/molecules/copyright-year.tsx +16 -0
  69. package/src/molecules/exit-popup/index.tsx +101 -0
  70. package/src/molecules/pds2-otp-component/index.tsx +147 -0
  71. package/src/organisms/abha/abha-header.tsx +25 -0
  72. package/src/organisms/abha/abha-stepper.tsx +83 -0
  73. package/src/organisms/abha/error-bottom-sheet.tsx +27 -0
  74. package/src/organisms/abha/otp-card.tsx +99 -0
  75. package/src/organisms/abha/verification-status.tsx +30 -0
  76. package/src/organisms/choose-language/choose-language.tsx +53 -0
  77. package/src/organisms/choose-language/types.ts +10 -0
  78. package/src/organisms/screen-switcher/screen-switcher.tsx +80 -0
  79. package/src/routes/abha-aadhaar-verification-status-screen.tsx +246 -0
  80. package/src/routes/abha-created-screen.tsx +45 -0
  81. package/src/routes/abha-login-otp-verify-screen.tsx +519 -0
  82. package/src/routes/abha-mobile-linking-status-screen.tsx +267 -0
  83. package/src/routes/abha-otp-and-mobile-screen.tsx +435 -0
  84. package/src/routes/abha-phone-number-verification-screen.tsx +388 -0
  85. package/src/routes/create-abha-address-screen.tsx +928 -0
  86. package/src/routes/create-abha-with-aadhaar-screen.tsx +986 -0
  87. package/src/routes/create-eka-profile-screen.tsx +831 -0
  88. package/src/routes/get-all-profiles-screen.tsx +161 -0
  89. package/src/routes/login-or-create-abha-address-screen.tsx +1056 -0
  90. package/src/routes/login-with-abha-screen.tsx +454 -0
  91. package/src/routes/select-abha-from-list-screen.tsx +792 -0
  92. package/src/routes/select-eka-profile-screen.tsx +446 -0
  93. package/src/routes/utils/trackAbhaEvent.ts +41 -0
  94. package/src/stores/auth-abha-store/index.ts +152 -0
  95. package/src/stores/auth-abha-store/types.ts +217 -0
  96. package/src/utils/mock-auth-response.ts +29 -0
  97. package/src/utils/send-event-utils.ts +76 -0
  98. package/src/utils/validations.ts +89 -0
  99. package/src/vite-env.d.ts +1 -0
  100. package/tailwind.config.ts +9 -0
  101. package/tsconfig.json +25 -0
  102. package/tsconfig.node.json +10 -0
  103. package/tsconfig.node.tsbuildinfo +1 -0
  104. package/tsconfig.tsbuildinfo +1 -0
  105. package/vite.config.d.ts +2 -0
  106. package/vite.config.js +30 -0
  107. package/vite.config.ts +35 -0
  108. package/dist/sdk/abha/css/abha.css +0 -1
  109. package/dist/sdk/abha/js/abha.js +0 -146
  110. /package/{dist → public}/images/adhaar.webp +0 -0
  111. /package/{dist → public}/images/at-the-rate.webp +0 -0
  112. /package/{dist → public}/images/avatar.webp +0 -0
  113. /package/{dist → public}/images/ayushman-bharat.webp +0 -0
  114. /package/{dist → public}/images/circle-checkmark.webp +0 -0
  115. /package/{dist → public}/images/link-abha.webp +0 -0
  116. /package/{dist → public}/images/national-authority.webp +0 -0
  117. /package/{dist → public}/images/three-dots.webp +0 -0
@@ -0,0 +1,124 @@
1
+ import type { Config } from 'tailwindcss';
2
+ import colors from "./../styles/pds2/colors";
3
+ import border from "./../styles/pds2/border";
4
+ import spacing from "./../styles/pds2/spacing";
5
+
6
+ export default {
7
+ prefix: 'pds2-',
8
+ content: [],
9
+ theme: {
10
+ colors: {
11
+ transparent: 'transparent',
12
+ ...colors,
13
+ platformBgColor: 'var(--platform-bg-color)',
14
+ platformTextColor: 'var(--platform-text-color)',
15
+ platformBorderColor: 'var(--platform-border-color)',
16
+ red: '#FF0000',
17
+ },
18
+ backgroundColor: ({ theme }) => ({
19
+ ...theme('colors'),
20
+ inherit: 'inherit',
21
+ }),
22
+ fill: ({ theme }) => ({ ...theme('colors'), current: 'currentColor' }),
23
+ spacing: { ...spacing },
24
+ fontSize: ({ theme }) => ({ ...theme('spacing') }),
25
+ lineHeight: ({ theme }) => ({ ...theme('spacing') }),
26
+ padding: ({ theme }) => ({ ...theme('spacing') }),
27
+ borderWidth: {
28
+ ...border,
29
+ },
30
+ borderRadius: ({ theme }) => ({ ...theme('borderWidth') }),
31
+ boxShadow: {
32
+ none: 'none',
33
+ 'elevation-5': '0px 1px 3px 0px rgba(0, 0, 0, 0.10)',
34
+ 'elevation-10': '0px 3px 9px 0px rgba(0, 59, 168, 0.10)',
35
+ 'elevation-50': '-4px 4px 8px 0px rgba(0, 0, 0, 0.12)',
36
+ 'elevation-100': '0px 12px 36px 0px rgba(0, 0, 0, 0.25)',
37
+ 'elevation-200': '0px 2px 8px 0px rgba(0, 0, 0, 0.16)',
38
+ 'elevation-300': '12px 0px 50px 0px rgba(0, 0, 0, 0.15)',
39
+ 'elevation-600': '0px -2px 4px 0px rgba(0, 0, 0, 0.16)',
40
+ 'elevation-900': '0px 12px 50px 0px rgba(0, 0, 0, 0.15)',
41
+ 'elevation-1000': '0px 0px 8px 0px rgba(0, 0, 0, 0.16)',
42
+ 'elevation-1100': '0px 12px 16px 0px rgba(0, 0, 0, 0.16)',
43
+ 'elevation-only-top': '0px -4px 14.8px 0px rgba(0, 0, 0, 0.05)',
44
+ 'M3-1': '0px 4px 4px 0px rgba(0, 0, 0, 0.25), 0px 1px 2px 0px rgba(0, 0, 0, 0.30)',
45
+ },
46
+ fontWeight: {
47
+ 300: '300',
48
+ 400: '400',
49
+ 500: '500',
50
+ 600: '600',
51
+ 700: '700',
52
+ 800: '800',
53
+ 900: '900',
54
+ },
55
+ opacity: {
56
+ 0: '0',
57
+ 5: '0.05',
58
+ 10: '0.1',
59
+ 20: '0.2',
60
+ 25: '0.25',
61
+ 30: '0.3',
62
+ 40: '0.4',
63
+ 50: '0.5',
64
+ 60: '0.6',
65
+ 65: '0.65',
66
+ 70: '0.7',
67
+ 75: '0.75',
68
+ 80: '0.8',
69
+ 85: '0.85',
70
+ 90: '0.9',
71
+ 95: '0.95',
72
+ 100: '1',
73
+ },
74
+ outlineWidth: ({ theme }) => ({ ...theme('spacing') }),
75
+ fontFamily: {
76
+ lato: ['Lato', 'sans-serif'],
77
+ },
78
+ maxWidth: ({ theme, breakpoints }) => ({
79
+ none: 'none',
80
+ '3/5': '60%',
81
+ half: '50%',
82
+ full: '100%',
83
+ min: 'min-content',
84
+ max: 'max-content',
85
+ ...breakpoints(theme('screens')),
86
+ ...theme('spacing'),
87
+ }),
88
+ minWidth: ({ theme }) => ({
89
+ ...theme('spacing'),
90
+ half: '50%',
91
+ full: '100%',
92
+ screen: '100vw',
93
+ min: 'min-content',
94
+ max: 'max-content',
95
+ auto: 'auto',
96
+ }),
97
+ keyframes: {
98
+ spin: {
99
+ to: {
100
+ transform: 'rotate(360deg)',
101
+ },
102
+ },
103
+ 'fade-in': {
104
+ '0%': { opacity: '0' },
105
+ '100%': { opacity: '1' },
106
+ },
107
+ 'slide-up': {
108
+ '0%': { transform: 'translateY(10px)' },
109
+ '100%': { transform: 'translateY(0)' },
110
+ },
111
+ },
112
+ animation: {
113
+ spin: 'spin 1s linear infinite',
114
+ 'fade-in': 'fade-in 0.2s ease-out',
115
+ 'slide-up': 'slide-up 0.2s ease-out',
116
+ },
117
+ extend: {
118
+ maxHeight: {
119
+ '1/2': '50vh',
120
+ },
121
+ },
122
+ },
123
+ plugins: [],
124
+ } satisfies Config;
package/package.json CHANGED
@@ -1,32 +1,31 @@
1
1
  {
2
2
  "name": "@eka-care/abha-stg",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "VITE_APP_MODE=DEBUG vite",
7
7
  "build": "tsc -b && vite build",
8
8
  "lint": "eslint .",
9
- "preview": "vite preview"
9
+ "preview": "vite preview",
10
+ "build-abha:stg": "VITE_APP_ENV=DEV turbo run build && node scripts/build-purged-css.cjs"
10
11
  },
11
12
  "dependencies": {
12
- "@elixir/icons": "*",
13
- "@elixir/utils": "*",
13
+ "@eka-care/icons": "^0.0.1",
14
14
  "@node-minify/clean-css": "^9.0.1",
15
15
  "@node-minify/core": "^9.0.2",
16
16
  "@tanstack/react-query": "^5.63.0",
17
- "apis": "*",
18
17
  "glob-all": "^3.3.1",
19
18
  "lottie-react": "^2.4.1",
20
19
  "purgecss": "^7.0.2",
21
20
  "react": "^18.2.0",
22
21
  "react-dom": "^18.2.0",
22
+ "react-otp-input": "^3.1.1",
23
23
  "react-router-dom": "^6.28.0",
24
- "ui": "*",
25
24
  "zustand": "^5.0.1"
26
25
  },
27
26
  "devDependencies": {
28
- "@elixir/tailwind-config": "*",
29
27
  "@eslint/js": "^9.13.0",
28
+ "@types/node": "^24.9.2",
30
29
  "@types/react": "^18.3.12",
31
30
  "@types/react-dom": "^18.3.1",
32
31
  "@vitejs/plugin-react-swc": "^3.5.0",
@@ -38,8 +37,10 @@
38
37
  "postcss": "^8.4.49",
39
38
  "prettier": "^3.3.3",
40
39
  "tailwindcss": "^3.4.15",
40
+ "turbo": "1.13.2",
41
41
  "typescript": "~5.6.2",
42
42
  "typescript-eslint": "^8.11.0",
43
- "vite": "^5.4.10"
43
+ "vite": "^5.4.10",
44
+ "vite-plugin-svgr": "^4.5.0"
44
45
  }
45
46
  }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -0,0 +1,70 @@
1
+ const path = require('path');
2
+ const glob = require('glob-all');
3
+ const { PurgeCSS } = require('purgecss');
4
+ const fs = require('fs');
5
+ const minify = require('@node-minify/core');
6
+ const cleanCSS = require('@node-minify/clean-css');
7
+
8
+ const moduleName = 'abha';
9
+ const paths = [];
10
+ const cssPath = path.resolve(__dirname, '../dist/sdk/abha/css/abha.css');
11
+ const outputPath = path.resolve(__dirname, '../dist/sdk/abha/css/abha.css');
12
+ const finalOutputPath = path.resolve(__dirname, '../dist/sdk/abha/css/abha.css');
13
+
14
+ // Collect all relevant files for the abha module
15
+ const modulePath = path.resolve(__dirname, `../../${moduleName}`);
16
+ paths.push(path.resolve(modulePath, 'public/index.html'));
17
+ paths.push(
18
+ ...glob.sync(`${path.resolve(modulePath, 'src')}/**/*`, { nodir: true })
19
+ );
20
+
21
+ // Tailwind extractor to match class names
22
+ const TailwindExtractor = (content) => {
23
+ return content.match(/[\w-/:]+(?<!:)/g) || [];
24
+ };
25
+
26
+ async function purgeCss() {
27
+ console.log('Purging unused CSS for abha module...');
28
+
29
+ const result = await new PurgeCSS().purge({
30
+ content: [...paths],
31
+ keyframes: true,
32
+ extractors: [
33
+ {
34
+ extractor: TailwindExtractor,
35
+ extensions: ['html', 'js', 'php', 'vue', 'tsx', 'ts'],
36
+ },
37
+ ],
38
+ safelist: {
39
+ standard: [], // Remove all safelisted patterns
40
+ deep: [],
41
+ greedy: [],
42
+ },
43
+ css: [cssPath],
44
+ });
45
+
46
+ // Write the purged CSS to a file
47
+ fs.writeFileSync(outputPath, result[0].css);
48
+ console.log('Purged CSS written to ' + outputPath);
49
+
50
+ // Minify the purged CSS
51
+ await new Promise((resolve, reject) =>
52
+ minify({
53
+ compressor: cleanCSS,
54
+ input: outputPath,
55
+ output: finalOutputPath,
56
+ callback: function (err, min) {
57
+ if (err) {
58
+ reject(err);
59
+ return;
60
+ }
61
+ console.log('Minified CSS written to ' + finalOutputPath);
62
+ resolve();
63
+ },
64
+ })
65
+ );
66
+ }
67
+
68
+ purgeCss().catch((err) => {
69
+ console.error('Error during CSS purging:', err);
70
+ });
package/src/App.css ADDED
File without changes
package/src/App.tsx ADDED
@@ -0,0 +1,43 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
+ import { useEffect } from 'react';
3
+ import './App.css';
4
+ import { unMount } from './main';
5
+ import ScreenStack from './organisms/screen-switcher/screen-switcher';
6
+ import { GET_CLIENT_ID } from './constants/constants';
7
+
8
+
9
+ export const queryClient = new QueryClient();
10
+
11
+ function App() {
12
+ useEffect(() => {
13
+ return () => {
14
+ unMount();
15
+ };
16
+ }, []);
17
+
18
+ return (
19
+ <QueryClientProvider client={queryClient}>
20
+ <div
21
+ className="pds2-h-full pds2-w-full pds2-bg-bg-white"
22
+ style={{
23
+ borderRadius: GET_CLIENT_ID() === 'www-eka' ? '1.5rem' : undefined,
24
+ position: 'relative',
25
+ height:
26
+ GET_CLIENT_ID() === 'www-eka'
27
+ ? '75vh'
28
+ : GET_CLIENT_ID() === 'doc-web'
29
+ ? '100%'
30
+ : '100vh',
31
+ overflowY: 'auto',
32
+ paddingTop :(GET_CLIENT_ID() === 'androiddoc' ||
33
+ GET_CLIENT_ID() === 'doctor-app-ios' ||
34
+ GET_CLIENT_ID() === 'doctor-ipad-ios') ? "1rem" :"0rem",
35
+ }}
36
+ >
37
+ <ScreenStack />
38
+ </div>
39
+ </QueryClientProvider>
40
+ );
41
+ }
42
+
43
+ export default App;
@@ -0,0 +1,32 @@
1
+
2
+ import { GET_AORTA_GO_HOST, GET_EXTRA_HEADERS, TGetProfilesPatientResponse } from "../../../constants/constants";
3
+ import fetch from "../../../fetch-client";
4
+
5
+ export default async function getProfilesPatient(): Promise<TGetProfilesPatientResponse> {
6
+ const myHeaders = new Headers();
7
+ myHeaders.append("Content-Type", "application/json");
8
+ const requestOptions: RequestInit = {
9
+ method: "GET",
10
+ headers: myHeaders,
11
+ redirect: "follow",
12
+ credentials: "include",
13
+ };
14
+
15
+ const extraHeaders = GET_EXTRA_HEADERS();
16
+ const oid = extraHeaders?.["X-User-ID"];
17
+
18
+ if (!oid) return {} as TGetProfilesPatientResponse;
19
+
20
+ try {
21
+ const AORTA_GO_HOST = GET_AORTA_GO_HOST();
22
+ const response = await fetch(
23
+ `${AORTA_GO_HOST}/profiles/v1/patient/${oid}`,
24
+ requestOptions
25
+ );
26
+
27
+ return await response.json();
28
+ } catch (error) {
29
+ console.error("profilePhrUser error =>", error);
30
+ return {} as TGetProfilesPatientResponse;
31
+ }
32
+ }
@@ -0,0 +1,26 @@
1
+ import { GET_AORTA_GO_HOST, TGetProfilesPhrResponse } from "../../../constants/constants";
2
+ import fetch from "../../../fetch-client";
3
+
4
+
5
+ export default async function getProfilePhrUser(): Promise<TGetProfilesPhrResponse> {
6
+ const myHeaders = new Headers();
7
+ myHeaders.append("Content-Type", "application/json");
8
+ const requestOptions: RequestInit = {
9
+ method: "GET",
10
+ headers: myHeaders,
11
+ redirect: "follow",
12
+ credentials: "include",
13
+ };
14
+
15
+ try {
16
+ const AORTA_GO_HOST = GET_AORTA_GO_HOST();
17
+ const response = await fetch(
18
+ `${AORTA_GO_HOST}/profiles/v1/patient`,
19
+ requestOptions
20
+ );
21
+ return await response.json();
22
+ } catch (error) {
23
+ console.error("profilePhrUser error =>", error);
24
+ return [] as TGetProfilesPhrResponse;
25
+ }
26
+ }
@@ -0,0 +1,34 @@
1
+ import { AUTH_METHOD, GET_AORTA_GO_HOST, TAuthInitV2Response } from "../../../constants/constants";
2
+ import fetch from "../../../fetch-client";
3
+
4
+ export default async function postAuthInitV2({
5
+ method,
6
+ identifier,
7
+ }: {
8
+ method: AUTH_METHOD;
9
+ identifier?: string;
10
+ }): Promise<TAuthInitV2Response> {
11
+ const myHeaders = new Headers();
12
+ myHeaders.append("Content-Type", "application/json");
13
+ const raw = JSON.stringify({
14
+ method,
15
+ identifier,
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 AORTA_GO_HOST = GET_AORTA_GO_HOST();
28
+ const response = await fetch(`${AORTA_GO_HOST}/v2/auth/init`, requestOptions);
29
+ return await response.json();
30
+ } catch (error) {
31
+ console.error(error);
32
+ }
33
+ return {} as TAuthInitV2Response;
34
+ }
@@ -0,0 +1,32 @@
1
+
2
+ import { GET_AORTA_GO_HOST } from "../../../constants/constants";
3
+ import fetch from "../../../fetch-client";
4
+
5
+ export default async function postAuthLogoutV2() {
6
+ console.log('inside postAuthLogoutV2 api call');
7
+ const myHeaders = new Headers();
8
+ myHeaders.append("Content-Type", "application/json");
9
+ const raw = JSON.stringify({});
10
+ const AORTA_GO_HOST = GET_AORTA_GO_HOST();
11
+ const url = `${AORTA_GO_HOST}/v2/auth/logout`;
12
+
13
+ const requestOptions: RequestInit = {
14
+ method: "POST",
15
+ headers: myHeaders,
16
+ body: raw,
17
+ redirect: "follow",
18
+ credentials: "include",
19
+ };
20
+
21
+ try {
22
+ const response = await fetch(url, requestOptions);
23
+ if (!response.ok) {
24
+ console.log("Logout failed with status", response?.status);
25
+ return false;
26
+ }
27
+ return true; // success
28
+ } catch (error) {
29
+ console.error("Logout API failed:", error);
30
+ return false;
31
+ }
32
+ }
@@ -0,0 +1,38 @@
1
+
2
+ import { GET_AORTA_GO_HOST, TAuthVerifyV2Request, TAuthVerifyV2Response } from "../../../constants/constants";
3
+ import fetch from "../../../fetch-client";
4
+
5
+
6
+ export default async function postAuthVerifyV2({
7
+ txn_id,
8
+ code,
9
+ token,
10
+ }: TAuthVerifyV2Request): Promise<TAuthVerifyV2Response> {
11
+ const myHeaders = new Headers();
12
+ myHeaders.append("Content-Type", "application/json");
13
+ const raw = JSON.stringify({
14
+ txn_id,
15
+ ...(code ? { code } : {}),
16
+ ...(token ? { token } : {}),
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 AORTA_GO_HOST = GET_AORTA_GO_HOST();
29
+ const response = await fetch(
30
+ `${AORTA_GO_HOST}/v2/auth/verify`,
31
+ requestOptions
32
+ );
33
+ return await response.json();
34
+ } catch (error) {
35
+ console.error(error);
36
+ }
37
+ return {} as TAuthVerifyV2Response;
38
+ }
@@ -0,0 +1,39 @@
1
+
2
+ import { GET_AORTA_GO_HOST, TProfileSwitchResponse } from "../../../constants/constants";
3
+ import fetch from "../../../fetch-client";
4
+
5
+
6
+ export default async function postProfileSwitch({
7
+ oid,
8
+ // token,
9
+ }: {
10
+ oid: string;
11
+ // token?: string;
12
+ }): Promise<TProfileSwitchResponse> {
13
+ const myHeaders = new Headers();
14
+ myHeaders.append("Content-Type", "application/json");
15
+ // if (token) myHeaders.append("auth", token);
16
+ const raw = JSON.stringify({
17
+ oid,
18
+ });
19
+
20
+ const requestOptions: RequestInit = {
21
+ method: "POST",
22
+ headers: myHeaders,
23
+ body: raw,
24
+ redirect: "follow",
25
+ credentials: "include",
26
+ };
27
+
28
+ try {
29
+ const AORTA_GO_HOST = GET_AORTA_GO_HOST();
30
+ const response = await fetch(
31
+ `${AORTA_GO_HOST}/v1/profile/switch`,
32
+ requestOptions
33
+ );
34
+ return await response.json();
35
+ } catch (error) {
36
+ console.error("postProfileSwitchError: ", error);
37
+ }
38
+ return {} as TProfileSwitchResponse;
39
+ }
@@ -0,0 +1,37 @@
1
+ import { GET_NDHM_HOST, TGetAbdmRegisterSuggestResponse } from "../../constants/constants";
2
+ import fetch from "../../fetch-client";
3
+
4
+ export default async function getAbdmRegisterSuggest({
5
+ txn_id,
6
+ fn,
7
+ mn,
8
+ ln,
9
+ dob,
10
+ }: {
11
+ txn_id: string;
12
+ fn?: string;
13
+ mn?: string;
14
+ ln?: string;
15
+ dob?: string;
16
+ }): Promise<TGetAbdmRegisterSuggestResponse> {
17
+ const myHeaders = new Headers();
18
+ myHeaders.append("Content-Type", "application/json");
19
+ const requestOptions: RequestInit = {
20
+ method: "GET",
21
+ headers: myHeaders,
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/suggest?transactionId=${txn_id}&fn=${fn || ""}&mn=${mn || ""}&ln=${ln || ""}&dob=${dob || ""}`,
30
+ requestOptions
31
+ );
32
+ return await response.json();
33
+ } catch (error) {
34
+ console.error("postAbdmLoginVerify error =>", error);
35
+ }
36
+ return {} as TGetAbdmRegisterSuggestResponse;
37
+ }
@@ -0,0 +1,28 @@
1
+
2
+ import { GET_NDHM_HOST, TGetAbdhmPincodeDetailsResponse } from "../../constants/constants";
3
+ import fetch from "../../fetch-client";
4
+
5
+ export default async function getPincodeDetails({
6
+ pincode,
7
+ }: {
8
+ pincode: number;
9
+ }): Promise<TGetAbdhmPincodeDetailsResponse> {
10
+ const NDHM_HOST = GET_NDHM_HOST();
11
+ const url = `${NDHM_HOST}/abdm/na/v1/registration/pincode/${pincode}`;
12
+ const myHeaders = new Headers();
13
+ myHeaders.append("Content-Type", "application/json");
14
+ const requestOptions: RequestInit = {
15
+ method: "GET",
16
+ headers: myHeaders,
17
+ redirect: "follow",
18
+ credentials: "include",
19
+ };
20
+
21
+ try {
22
+ const response = await fetch(url, requestOptions);
23
+ return await response.json();
24
+ } catch (error) {
25
+ console.error(error);
26
+ }
27
+ return {} as any;
28
+ }
@@ -0,0 +1,37 @@
1
+ import fetch from "../../fetch-client";
2
+ import { ABHA_AUTH_FLOW_METHOD, GET_NDHM_HOST, TPostAbdmLoginInitResponse } from "../../constants/constants";
3
+
4
+ export default async function postAbdmLoginInit({
5
+ method,
6
+ identifier,
7
+ }: {
8
+ method: ABHA_AUTH_FLOW_METHOD;
9
+ identifier: string;
10
+ }): Promise<TPostAbdmLoginInitResponse> {
11
+ const myHeaders = new Headers();
12
+ myHeaders.append("Content-Type", "application/json");
13
+ const raw = JSON.stringify({
14
+ method,
15
+ identifier,
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/profile/login/init`,
30
+ requestOptions
31
+ );
32
+ return await response.json();
33
+ } catch (error) {
34
+ console.error("postAbdmLoginInit error =>", error);
35
+ }
36
+ return {} as TPostAbdmLoginInitResponse;
37
+ }
@@ -0,0 +1,37 @@
1
+ import fetch from "../../fetch-client";
2
+ import { GET_NDHM_HOST, TPostAbdmProfileLoginPhrResponse } from "../../constants/constants";
3
+
4
+ export default async function postAbdmProfileLoginPhr({
5
+ txn_id,
6
+ phr_address,
7
+ }: {
8
+ txn_id: string;
9
+ phr_address: string;
10
+ }): Promise<TPostAbdmProfileLoginPhrResponse> {
11
+ const myHeaders = new Headers();
12
+ myHeaders.append("Content-Type", "application/json");
13
+ const raw = JSON.stringify({
14
+ txn_id,
15
+ phr_address,
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/profile/login/phr`,
30
+ requestOptions
31
+ );
32
+ return await response.json();
33
+ } catch (error) {
34
+ console.error("postAbdmProfileLoginPhr error =>", error);
35
+ }
36
+ return {} as TPostAbdmProfileLoginPhrResponse;
37
+ }
@@ -0,0 +1,37 @@
1
+ import fetch from "../../fetch-client";
2
+ import { GET_NDHM_HOST, TPostAbdmLoginVerifyResponse } from "../../constants/constants";
3
+
4
+ export default async function postAbdmLoginVerify({
5
+ txn_id,
6
+ otp,
7
+ }: {
8
+ txn_id: string;
9
+ otp: string;
10
+ }): Promise<TPostAbdmLoginVerifyResponse> {
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/profile/login/verify`,
30
+ requestOptions
31
+ );
32
+ return await response.json();
33
+ } catch (error) {
34
+ console.error("postAbdmLoginVerify error =>", error);
35
+ }
36
+ return {} as TPostAbdmLoginVerifyResponse;
37
+ }