pih-appointment-widget 0.0.37 → 0.0.39
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.
- package/README.md +70 -70
- package/babel.config.js +5 -5
- package/dist/App.js +10 -9
- package/dist/assets/icons/icdIcons.js +30 -0
- package/dist/components/AppointmentPage.js +87 -62
- package/dist/components/ICD10Assistant.js +144 -63
- package/dist/doctor-appointments-widget.umd.js +115 -119
- package/dist/doctor-appointments-widget.umd.min.js +1 -1
- package/dist/hooks/useClipboard.js +3 -3
- package/dist/pih-appointment-widget.umd.js +309 -208
- package/dist/pih-appointment-widget.umd.min.js +1 -1
- package/dist/services/appointmentService.js +20 -20
- package/dist/services/httpService.js +14 -18
- package/dist/services/icdService.js +21 -23
- package/package.json +67 -67
- package/public/index.html +43 -43
- package/public/manifest.json +25 -25
- package/public/robots.txt +3 -3
- package/rollup.config.js +43 -43
- package/src/App.js +50 -50
- package/src/Example.js +14 -14
- package/src/assets/icons/icdIcon.png +0 -0
- package/src/assets/icons/icdIcons.js +23 -0
- package/src/components/AppointmentPage.js +2502 -2498
- package/src/components/ICD10Assistant.jsx +923 -855
- package/src/constants/apiConfig.js +29 -29
- package/src/hooks/useClipboard.js +35 -35
- package/src/index.js +6 -6
- package/src/services/appointmentService.js +92 -92
- package/src/services/httpService.js +103 -103
- package/src/services/icdService.js +76 -76
|
@@ -6,20 +6,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ICD_MODE = void 0;
|
|
7
7
|
exports.getICDSuggestions = getICDSuggestions;
|
|
8
8
|
var _apiConfig = require("../constants/apiConfig");
|
|
9
|
-
/**
|
|
10
|
-
* icdService.js
|
|
11
|
-
* Calls the Afiya ICD suggestion API.
|
|
12
|
-
*
|
|
13
|
-
* POST /insurance/api/icd/suggest
|
|
14
|
-
* Body: { query: string, mode: ICD_MODE }
|
|
9
|
+
/**
|
|
10
|
+
* icdService.js
|
|
11
|
+
* Calls the Afiya ICD suggestion API.
|
|
12
|
+
*
|
|
13
|
+
* POST /insurance/api/icd/suggest
|
|
14
|
+
* Body: { query: string, mode: ICD_MODE }
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Enum for ICD suggest API modes.
|
|
19
|
-
* Use these constants everywhere — never hardcode the string values.
|
|
20
|
-
*
|
|
21
|
-
* @readonly
|
|
22
|
-
* @enum {string}
|
|
17
|
+
/**
|
|
18
|
+
* Enum for ICD suggest API modes.
|
|
19
|
+
* Use these constants everywhere — never hardcode the string values.
|
|
20
|
+
*
|
|
21
|
+
* @readonly
|
|
22
|
+
* @enum {string}
|
|
23
23
|
*/
|
|
24
24
|
const ICD_MODE = exports.ICD_MODE = Object.freeze({
|
|
25
25
|
/** Real-time ICD-10 code lookup (fast, no AI) */
|
|
@@ -29,15 +29,14 @@ const ICD_MODE = exports.ICD_MODE = Object.freeze({
|
|
|
29
29
|
/** Backend decides best strategy automatically */
|
|
30
30
|
AUTO: "AUTO"
|
|
31
31
|
});
|
|
32
|
-
const SUGGEST_URL =
|
|
32
|
+
const SUGGEST_URL = `${_apiConfig.API_BASE_URL}/insurance/api/icd/suggest`;
|
|
33
33
|
|
|
34
|
-
/**
|
|
35
|
-
* @param {string} query - Plain-language diagnosis / procedure
|
|
36
|
-
* @param {"ICD_ONLY"|"CLAUDE_ONLY"|"AUTO"} mode
|
|
37
|
-
* @returns {Promise<{ matches: Array<{ code, description, reason }>, note: string }>}
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} query - Plain-language diagnosis / procedure
|
|
36
|
+
* @param {"ICD_ONLY"|"CLAUDE_ONLY"|"AUTO"} mode
|
|
37
|
+
* @returns {Promise<{ matches: Array<{ code, description, reason }>, note: string }>}
|
|
38
38
|
*/
|
|
39
39
|
async function getICDSuggestions(query, mode) {
|
|
40
|
-
var _data$data;
|
|
41
40
|
if (!query || !query.trim()) throw new Error("Query cannot be empty");
|
|
42
41
|
const response = await fetch(SUGGEST_URL, {
|
|
43
42
|
method: "POST",
|
|
@@ -50,18 +49,17 @@ async function getICDSuggestions(query, mode) {
|
|
|
50
49
|
})
|
|
51
50
|
});
|
|
52
51
|
if (!response.ok) {
|
|
53
|
-
var _errBody$error;
|
|
54
52
|
const errBody = await response.json().catch(() => ({}));
|
|
55
|
-
const msg =
|
|
53
|
+
const msg = errBody?.message || errBody?.error?.message || `API error: ${response.status} ${response.statusText}`;
|
|
56
54
|
throw new Error(msg);
|
|
57
55
|
}
|
|
58
56
|
const data = await response.json();
|
|
59
57
|
|
|
60
58
|
// API wraps response in { data: { matches, note, ... }, resultInfo }
|
|
61
|
-
const payload =
|
|
59
|
+
const payload = data?.data ?? data;
|
|
62
60
|
|
|
63
61
|
// Normalise response → always return { matches, note }
|
|
64
|
-
if (Array.isArray(payload
|
|
62
|
+
if (Array.isArray(payload?.matches)) {
|
|
65
63
|
return {
|
|
66
64
|
matches: payload.matches,
|
|
67
65
|
note: payload.note || ""
|
|
@@ -73,7 +71,7 @@ async function getICDSuggestions(query, mode) {
|
|
|
73
71
|
note: ""
|
|
74
72
|
};
|
|
75
73
|
}
|
|
76
|
-
if (Array.isArray(payload
|
|
74
|
+
if (Array.isArray(payload?.results)) {
|
|
77
75
|
return {
|
|
78
76
|
matches: payload.results.map(r => ({
|
|
79
77
|
code: r.code,
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pih-appointment-widget",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"main": "dist/App.js",
|
|
5
|
-
"module": "dist/App.js",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": {
|
|
8
|
-
"require": "./dist/App.js",
|
|
9
|
-
"import": "./dist/App.js"
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@babel/cli": "^7.25.9",
|
|
14
|
-
"@testing-library/jest-dom": "^5.17.0",
|
|
15
|
-
"@testing-library/react": "^13.4.0",
|
|
16
|
-
"@testing-library/user-event": "^13.5.0",
|
|
17
|
-
"@zoom/videosdk": "^2.1.10",
|
|
18
|
-
"@zoomus/websdk": "^2.18.3",
|
|
19
|
-
"crypto": "^1.0.1",
|
|
20
|
-
"crypto-js": "^4.2.0",
|
|
21
|
-
"react": "^18.3.1",
|
|
22
|
-
"react-dom": "^18.3.1",
|
|
23
|
-
"react-scripts": "5.0.1",
|
|
24
|
-
"web-vitals": "^2.1.4"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "babel src -d dist",
|
|
28
|
-
"build:roll": "rollup -c",
|
|
29
|
-
"prepublishOnly": "npm run build",
|
|
30
|
-
"start": "react-scripts start",
|
|
31
|
-
"test": "react-scripts test",
|
|
32
|
-
"eject": "react-scripts eject"
|
|
33
|
-
},
|
|
34
|
-
"eslintConfig": {
|
|
35
|
-
"extends": [
|
|
36
|
-
"react-app",
|
|
37
|
-
"react-app/jest"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"browserslist": {
|
|
41
|
-
"production": [
|
|
42
|
-
">0.2%",
|
|
43
|
-
"not dead",
|
|
44
|
-
"not op_mini all"
|
|
45
|
-
],
|
|
46
|
-
"development": [
|
|
47
|
-
"last 1 chrome version",
|
|
48
|
-
"last 1 firefox version",
|
|
49
|
-
"last 1 safari version"
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
"peerDependencies": {
|
|
53
|
-
"axios": "^1.8.4"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@babel/core": "^7.26.0",
|
|
57
|
-
"@babel/preset-env": "^7.26.0",
|
|
58
|
-
"@babel/preset-react": "^7.26.3",
|
|
59
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
60
|
-
"@rollup/plugin-commonjs": "^28.0.9",
|
|
61
|
-
"@rollup/plugin-image": "^3.0.3",
|
|
62
|
-
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
63
|
-
"axios": "1.8.4",
|
|
64
|
-
"rollup": "^2.79.2",
|
|
65
|
-
"rollup-plugin-terser": "^7.0.2"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pih-appointment-widget",
|
|
3
|
+
"version": "0.0.39",
|
|
4
|
+
"main": "dist/App.js",
|
|
5
|
+
"module": "dist/App.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./dist/App.js",
|
|
9
|
+
"import": "./dist/App.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@babel/cli": "^7.25.9",
|
|
14
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
15
|
+
"@testing-library/react": "^13.4.0",
|
|
16
|
+
"@testing-library/user-event": "^13.5.0",
|
|
17
|
+
"@zoom/videosdk": "^2.1.10",
|
|
18
|
+
"@zoomus/websdk": "^2.18.3",
|
|
19
|
+
"crypto": "^1.0.1",
|
|
20
|
+
"crypto-js": "^4.2.0",
|
|
21
|
+
"react": "^18.3.1",
|
|
22
|
+
"react-dom": "^18.3.1",
|
|
23
|
+
"react-scripts": "5.0.1",
|
|
24
|
+
"web-vitals": "^2.1.4"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "babel src -d dist",
|
|
28
|
+
"build:roll": "rollup -c",
|
|
29
|
+
"prepublishOnly": "npm run build",
|
|
30
|
+
"start": "react-scripts start",
|
|
31
|
+
"test": "react-scripts test",
|
|
32
|
+
"eject": "react-scripts eject"
|
|
33
|
+
},
|
|
34
|
+
"eslintConfig": {
|
|
35
|
+
"extends": [
|
|
36
|
+
"react-app",
|
|
37
|
+
"react-app/jest"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"browserslist": {
|
|
41
|
+
"production": [
|
|
42
|
+
">0.2%",
|
|
43
|
+
"not dead",
|
|
44
|
+
"not op_mini all"
|
|
45
|
+
],
|
|
46
|
+
"development": [
|
|
47
|
+
"last 1 chrome version",
|
|
48
|
+
"last 1 firefox version",
|
|
49
|
+
"last 1 safari version"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"axios": "^1.8.4"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@babel/core": "^7.26.0",
|
|
57
|
+
"@babel/preset-env": "^7.26.0",
|
|
58
|
+
"@babel/preset-react": "^7.26.3",
|
|
59
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
60
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
61
|
+
"@rollup/plugin-image": "^3.0.3",
|
|
62
|
+
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
63
|
+
"axios": "1.8.4",
|
|
64
|
+
"rollup": "^2.79.2",
|
|
65
|
+
"rollup-plugin-terser": "^7.0.2"
|
|
66
|
+
}
|
|
67
|
+
}
|
package/public/index.html
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<meta name="theme-color" content="#000000" />
|
|
8
|
-
<meta
|
|
9
|
-
name="description"
|
|
10
|
-
content="Web site created using create-react-app"
|
|
11
|
-
/>
|
|
12
|
-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
-
<!--
|
|
14
|
-
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
-
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
-
-->
|
|
17
|
-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
-
<!--
|
|
19
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
-
|
|
23
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
-
-->
|
|
27
|
-
<title>React App</title>
|
|
28
|
-
</head>
|
|
29
|
-
<body style="margin: 0;">
|
|
30
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
-
<div id="root"></div>
|
|
32
|
-
<!--
|
|
33
|
-
This HTML file is a template.
|
|
34
|
-
If you open it directly in the browser, you will see an empty page.
|
|
35
|
-
|
|
36
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
-
|
|
39
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
-
-->
|
|
42
|
-
</body>
|
|
43
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<meta name="theme-color" content="#000000" />
|
|
8
|
+
<meta
|
|
9
|
+
name="description"
|
|
10
|
+
content="Web site created using create-react-app"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
13
|
+
<!--
|
|
14
|
+
manifest.json provides metadata used when your web app is installed on a
|
|
15
|
+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
16
|
+
-->
|
|
17
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
18
|
+
<!--
|
|
19
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
+
|
|
23
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
+
-->
|
|
27
|
+
<title>React App</title>
|
|
28
|
+
</head>
|
|
29
|
+
<body style="margin: 0;">
|
|
30
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
31
|
+
<div id="root"></div>
|
|
32
|
+
<!--
|
|
33
|
+
This HTML file is a template.
|
|
34
|
+
If you open it directly in the browser, you will see an empty page.
|
|
35
|
+
|
|
36
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
37
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
38
|
+
|
|
39
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
40
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
41
|
+
-->
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
package/public/manifest.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
package/public/robots.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# https://www.robotstxt.org/robotstxt.html
|
|
2
|
-
User-agent: *
|
|
3
|
-
Disallow:
|
|
1
|
+
# https://www.robotstxt.org/robotstxt.html
|
|
2
|
+
User-agent: *
|
|
3
|
+
Disallow:
|
package/rollup.config.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { terser } from 'rollup-plugin-terser'; // For minification
|
|
2
|
-
import resolve from '@rollup/plugin-node-resolve'; // To resolve npm dependencies
|
|
3
|
-
import commonjs from '@rollup/plugin-commonjs'; // To handle CommonJS modules
|
|
4
|
-
import babel from '@rollup/plugin-babel'; // To transpile with Babel
|
|
5
|
-
import image from '@rollup/plugin-image';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
input: 'src/App.js', // Path to your package's main entry point
|
|
9
|
-
output: [
|
|
10
|
-
{
|
|
11
|
-
file: 'dist/pih-appointment-widget.umd.js', // UMD build output file
|
|
12
|
-
format: 'umd', // UMD format
|
|
13
|
-
name: 'MyPackage', // Global variable name (use a unique name)
|
|
14
|
-
globals: {
|
|
15
|
-
react: 'React', // Define global variable for React
|
|
16
|
-
'react-dom': 'ReactDOM', // Define global variable for ReactDOM
|
|
17
|
-
axios: 'axios', // Add axios here as well if you want to expose it globally
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
file: 'dist/pih-appointment-widget.umd.min.js', // UMD minified output
|
|
22
|
-
format: 'umd',
|
|
23
|
-
name: 'MyPackage',
|
|
24
|
-
plugins: [terser()], // Minify the output
|
|
25
|
-
globals: {
|
|
26
|
-
react: 'React', // Define global variable for React
|
|
27
|
-
'react-dom': 'ReactDOM', // Define global variable for ReactDOM
|
|
28
|
-
axios: 'axios', // Minified version should still handle axios externally
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
plugins: [
|
|
33
|
-
image(),
|
|
34
|
-
resolve(), // Resolve modules from node_modules
|
|
35
|
-
babel({
|
|
36
|
-
exclude: 'node_modules/**', // Exclude transpiling node_modules
|
|
37
|
-
presets: ['@babel/preset-env', '@babel/preset-react'], // Use Babel presets
|
|
38
|
-
babelHelpers: 'bundled', // Ensure the correct Babel helper functions are included
|
|
39
|
-
}),
|
|
40
|
-
commonjs(), // Convert CommonJS modules to ES6
|
|
41
|
-
],
|
|
42
|
-
external: ['react', 'react-dom', 'axios'], // Mark react, react-dom, and axios as external dependencies
|
|
43
|
-
};
|
|
1
|
+
import { terser } from 'rollup-plugin-terser'; // For minification
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve'; // To resolve npm dependencies
|
|
3
|
+
import commonjs from '@rollup/plugin-commonjs'; // To handle CommonJS modules
|
|
4
|
+
import babel from '@rollup/plugin-babel'; // To transpile with Babel
|
|
5
|
+
import image from '@rollup/plugin-image';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: 'src/App.js', // Path to your package's main entry point
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
file: 'dist/pih-appointment-widget.umd.js', // UMD build output file
|
|
12
|
+
format: 'umd', // UMD format
|
|
13
|
+
name: 'MyPackage', // Global variable name (use a unique name)
|
|
14
|
+
globals: {
|
|
15
|
+
react: 'React', // Define global variable for React
|
|
16
|
+
'react-dom': 'ReactDOM', // Define global variable for ReactDOM
|
|
17
|
+
axios: 'axios', // Add axios here as well if you want to expose it globally
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
file: 'dist/pih-appointment-widget.umd.min.js', // UMD minified output
|
|
22
|
+
format: 'umd',
|
|
23
|
+
name: 'MyPackage',
|
|
24
|
+
plugins: [terser()], // Minify the output
|
|
25
|
+
globals: {
|
|
26
|
+
react: 'React', // Define global variable for React
|
|
27
|
+
'react-dom': 'ReactDOM', // Define global variable for ReactDOM
|
|
28
|
+
axios: 'axios', // Minified version should still handle axios externally
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
plugins: [
|
|
33
|
+
image(),
|
|
34
|
+
resolve(), // Resolve modules from node_modules
|
|
35
|
+
babel({
|
|
36
|
+
exclude: 'node_modules/**', // Exclude transpiling node_modules
|
|
37
|
+
presets: ['@babel/preset-env', '@babel/preset-react'], // Use Babel presets
|
|
38
|
+
babelHelpers: 'bundled', // Ensure the correct Babel helper functions are included
|
|
39
|
+
}),
|
|
40
|
+
commonjs(), // Convert CommonJS modules to ES6
|
|
41
|
+
],
|
|
42
|
+
external: ['react', 'react-dom', 'axios'], // Mark react, react-dom, and axios as external dependencies
|
|
43
|
+
};
|
package/src/App.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import ReactDOM from "react-dom";
|
|
3
|
-
import AppointmentPage, { PIH_APPOINTMENT_WIDGET_CLASS } from "./components/AppointmentPage.js";
|
|
4
|
-
import ICD10Assistant from "./components/ICD10Assistant.jsx";
|
|
5
|
-
|
|
6
|
-
let bookingWidgetInstance = null;
|
|
7
|
-
|
|
8
|
-
// SDK for embedding appointment widget
|
|
9
|
-
const BookingSDK = {
|
|
10
|
-
/**
|
|
11
|
-
* Show appointment widget with configuration
|
|
12
|
-
* @param {object} config - Configuration object
|
|
13
|
-
* @param {string} config.apiBaseUrl - Base URL for API
|
|
14
|
-
* @param {string} config.hospitalId - Hospital ID
|
|
15
|
-
* @param {number} config.doctorId - Doctor ID
|
|
16
|
-
* @param {string} config.joinCallUrl - Video call URL
|
|
17
|
-
* @param {function} onAction - Optional callback for actions
|
|
18
|
-
*/
|
|
19
|
-
showWidget: (config, onAction) => {
|
|
20
|
-
if (!bookingWidgetInstance) {
|
|
21
|
-
bookingWidgetInstance = document.createElement("div");
|
|
22
|
-
document.body.appendChild(bookingWidgetInstance);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const PopupWrapper = () => {
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<AppointmentPage config={config} />
|
|
29
|
-
{config.showIcdAssistant && <ICD10Assistant />}
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
ReactDOM.render(<PopupWrapper />, bookingWidgetInstance);
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
closePopup: () => {
|
|
38
|
-
if (bookingWidgetInstance) {
|
|
39
|
-
ReactDOM.unmountComponentAtNode(bookingWidgetInstance);
|
|
40
|
-
bookingWidgetInstance = null;
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Expose SDK globally for non-React apps
|
|
46
|
-
window.BookingSDK = BookingSDK;
|
|
47
|
-
|
|
48
|
-
// Export for React/module usage
|
|
49
|
-
export { AppointmentPage, ICD10Assistant, PIH_APPOINTMENT_WIDGET_CLASS };
|
|
50
|
-
export default BookingSDK;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import AppointmentPage, { PIH_APPOINTMENT_WIDGET_CLASS } from "./components/AppointmentPage.js";
|
|
4
|
+
import ICD10Assistant from "./components/ICD10Assistant.jsx";
|
|
5
|
+
|
|
6
|
+
let bookingWidgetInstance = null;
|
|
7
|
+
|
|
8
|
+
// SDK for embedding appointment widget
|
|
9
|
+
const BookingSDK = {
|
|
10
|
+
/**
|
|
11
|
+
* Show appointment widget with configuration
|
|
12
|
+
* @param {object} config - Configuration object
|
|
13
|
+
* @param {string} config.apiBaseUrl - Base URL for API
|
|
14
|
+
* @param {string} config.hospitalId - Hospital ID
|
|
15
|
+
* @param {number} config.doctorId - Doctor ID
|
|
16
|
+
* @param {string} config.joinCallUrl - Video call URL
|
|
17
|
+
* @param {function} onAction - Optional callback for actions
|
|
18
|
+
*/
|
|
19
|
+
showWidget: (config, onAction) => {
|
|
20
|
+
if (!bookingWidgetInstance) {
|
|
21
|
+
bookingWidgetInstance = document.createElement("div");
|
|
22
|
+
document.body.appendChild(bookingWidgetInstance);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const PopupWrapper = () => {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<AppointmentPage config={config} />
|
|
29
|
+
{config.showIcdAssistant && <ICD10Assistant />}
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
ReactDOM.render(<PopupWrapper />, bookingWidgetInstance);
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
closePopup: () => {
|
|
38
|
+
if (bookingWidgetInstance) {
|
|
39
|
+
ReactDOM.unmountComponentAtNode(bookingWidgetInstance);
|
|
40
|
+
bookingWidgetInstance = null;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Expose SDK globally for non-React apps
|
|
46
|
+
window.BookingSDK = BookingSDK;
|
|
47
|
+
|
|
48
|
+
// Export for React/module usage
|
|
49
|
+
export { AppointmentPage, ICD10Assistant, PIH_APPOINTMENT_WIDGET_CLASS };
|
|
50
|
+
export default BookingSDK;
|
package/src/Example.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import AppointmentPage from "./components/AppointmentPage.js";
|
|
2
|
-
import ICD10Assistant from "./components/ICD10Assistant.jsx";
|
|
3
|
-
|
|
4
|
-
const Example = () => {
|
|
5
|
-
return (
|
|
6
|
-
<div>
|
|
7
|
-
<AppointmentPage />
|
|
8
|
-
{/* ICD-10 Coding Assistant — floating pill button, always available */}
|
|
9
|
-
<ICD10Assistant />
|
|
10
|
-
</div>
|
|
11
|
-
);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default Example;
|
|
1
|
+
import AppointmentPage from "./components/AppointmentPage.js";
|
|
2
|
+
import ICD10Assistant from "./components/ICD10Assistant.jsx";
|
|
3
|
+
|
|
4
|
+
const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<AppointmentPage />
|
|
8
|
+
{/* ICD-10 Coding Assistant — floating pill button, always available */}
|
|
9
|
+
<ICD10Assistant />
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Example;
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// ─── Image assets ─────────────────────────────────────────────────────────────
|
|
2
|
+
import icdIconImg from "./icdIcon.png";
|
|
3
|
+
|
|
4
|
+
export const IMG = {
|
|
5
|
+
/** Main ICD-10 Assistant branding icon (floating button + panel header) */
|
|
6
|
+
icdIcon: icdIconImg,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// ─── Emoji / text icons ───────────────────────────────────────────────────────
|
|
10
|
+
export const ICON = {
|
|
11
|
+
/** Reason / tip indicator on result cards */
|
|
12
|
+
reason: "💡",
|
|
13
|
+
/** Search history chip prefix */
|
|
14
|
+
history: "🕐",
|
|
15
|
+
/** Footer medical disclaimer */
|
|
16
|
+
medical: "⚕️",
|
|
17
|
+
/** Coding note (currently commented out) */
|
|
18
|
+
codingNote: "📋",
|
|
19
|
+
/** Copy success checkmark */
|
|
20
|
+
copied: "✓",
|
|
21
|
+
/** Copy action */
|
|
22
|
+
copy: "⎘",
|
|
23
|
+
};
|