pih-appointment-widget 0.0.26 → 0.0.27
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 +9 -10
- package/dist/components/AppointmentPage.js +54 -75
- package/dist/pih-appointment-widget.umd.js +113 -109
- package/dist/pih-appointment-widget.umd.min.js +1 -1
- package/dist/services/appointmentService.js +20 -20
- package/dist/services/httpService.js +18 -14
- 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 +48 -48
- package/src/Example.js +11 -11
- package/src/components/AppointmentPage.js +2455 -2455
- package/src/constants/apiConfig.js +28 -28
- package/src/index.js +6 -6
- package/src/services/appointmentService.js +88 -88
- package/src/services/httpService.js +103 -103
package/README.md
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# Getting Started with Create React App
|
|
2
|
-
|
|
3
|
-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
4
|
-
|
|
5
|
-
## Available Scripts
|
|
6
|
-
|
|
7
|
-
In the project directory, you can run:
|
|
8
|
-
|
|
9
|
-
### `npm start`
|
|
10
|
-
|
|
11
|
-
Runs the app in the development mode.\
|
|
12
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
|
13
|
-
|
|
14
|
-
The page will reload when you make changes.\
|
|
15
|
-
You may also see any lint errors in the console.
|
|
16
|
-
|
|
17
|
-
### `npm test`
|
|
18
|
-
|
|
19
|
-
Launches the test runner in the interactive watch mode.\
|
|
20
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
21
|
-
|
|
22
|
-
### `npm run build`
|
|
23
|
-
|
|
24
|
-
Builds the app for production to the `build` folder.\
|
|
25
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
26
|
-
|
|
27
|
-
The build is minified and the filenames include the hashes.\
|
|
28
|
-
Your app is ready to be deployed!
|
|
29
|
-
|
|
30
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
31
|
-
|
|
32
|
-
### `npm run eject`
|
|
33
|
-
|
|
34
|
-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
|
35
|
-
|
|
36
|
-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
-
|
|
38
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
|
39
|
-
|
|
40
|
-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
|
41
|
-
|
|
42
|
-
## Learn More
|
|
43
|
-
|
|
44
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
-
|
|
46
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
47
|
-
|
|
48
|
-
### Code Splitting
|
|
49
|
-
|
|
50
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
51
|
-
|
|
52
|
-
### Analyzing the Bundle Size
|
|
53
|
-
|
|
54
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
55
|
-
|
|
56
|
-
### Making a Progressive Web App
|
|
57
|
-
|
|
58
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
59
|
-
|
|
60
|
-
### Advanced Configuration
|
|
61
|
-
|
|
62
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
63
|
-
|
|
64
|
-
### Deployment
|
|
65
|
-
|
|
66
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
67
|
-
|
|
68
|
-
### `npm run build` fails to minify
|
|
69
|
-
|
|
70
|
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
1
|
+
# Getting Started with Create React App
|
|
2
|
+
|
|
3
|
+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
4
|
+
|
|
5
|
+
## Available Scripts
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### `npm start`
|
|
10
|
+
|
|
11
|
+
Runs the app in the development mode.\
|
|
12
|
+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
|
13
|
+
|
|
14
|
+
The page will reload when you make changes.\
|
|
15
|
+
You may also see any lint errors in the console.
|
|
16
|
+
|
|
17
|
+
### `npm test`
|
|
18
|
+
|
|
19
|
+
Launches the test runner in the interactive watch mode.\
|
|
20
|
+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
21
|
+
|
|
22
|
+
### `npm run build`
|
|
23
|
+
|
|
24
|
+
Builds the app for production to the `build` folder.\
|
|
25
|
+
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
26
|
+
|
|
27
|
+
The build is minified and the filenames include the hashes.\
|
|
28
|
+
Your app is ready to be deployed!
|
|
29
|
+
|
|
30
|
+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
31
|
+
|
|
32
|
+
### `npm run eject`
|
|
33
|
+
|
|
34
|
+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
|
35
|
+
|
|
36
|
+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
+
|
|
38
|
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
|
39
|
+
|
|
40
|
+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
|
41
|
+
|
|
42
|
+
## Learn More
|
|
43
|
+
|
|
44
|
+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
+
|
|
46
|
+
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
47
|
+
|
|
48
|
+
### Code Splitting
|
|
49
|
+
|
|
50
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
51
|
+
|
|
52
|
+
### Analyzing the Bundle Size
|
|
53
|
+
|
|
54
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
55
|
+
|
|
56
|
+
### Making a Progressive Web App
|
|
57
|
+
|
|
58
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
59
|
+
|
|
60
|
+
### Advanced Configuration
|
|
61
|
+
|
|
62
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
63
|
+
|
|
64
|
+
### Deployment
|
|
65
|
+
|
|
66
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
67
|
+
|
|
68
|
+
### `npm run build` fails to minify
|
|
69
|
+
|
|
70
|
+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
package/babel.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
'@babel/preset-env',
|
|
4
|
-
'@babel/preset-react'
|
|
5
|
-
],
|
|
1
|
+
module.exports = {
|
|
2
|
+
presets: [
|
|
3
|
+
'@babel/preset-env',
|
|
4
|
+
'@babel/preset-react'
|
|
5
|
+
],
|
|
6
6
|
};
|
package/dist/App.js
CHANGED
|
@@ -19,21 +19,20 @@ exports.default = void 0;
|
|
|
19
19
|
var _react = _interopRequireDefault(require("react"));
|
|
20
20
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
21
21
|
var _AppointmentPage = _interopRequireWildcard(require("./components/AppointmentPage.js"));
|
|
22
|
-
function
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
24
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
24
|
let bookingWidgetInstance = null;
|
|
26
25
|
|
|
27
26
|
// SDK for embedding appointment widget
|
|
28
27
|
const BookingSDK = {
|
|
29
|
-
/**
|
|
30
|
-
* Show appointment widget with configuration
|
|
31
|
-
* @param {object} config - Configuration object
|
|
32
|
-
* @param {string} config.apiBaseUrl - Base URL for API
|
|
33
|
-
* @param {string} config.hospitalId - Hospital ID
|
|
34
|
-
* @param {number} config.doctorId - Doctor ID
|
|
35
|
-
* @param {string} config.joinCallUrl - Video call URL
|
|
36
|
-
* @param {function} onAction - Optional callback for actions
|
|
28
|
+
/**
|
|
29
|
+
* Show appointment widget with configuration
|
|
30
|
+
* @param {object} config - Configuration object
|
|
31
|
+
* @param {string} config.apiBaseUrl - Base URL for API
|
|
32
|
+
* @param {string} config.hospitalId - Hospital ID
|
|
33
|
+
* @param {number} config.doctorId - Doctor ID
|
|
34
|
+
* @param {string} config.joinCallUrl - Video call URL
|
|
35
|
+
* @param {function} onAction - Optional callback for actions
|
|
37
36
|
*/
|
|
38
37
|
showWidget: (config, onAction) => {
|
|
39
38
|
if (!bookingWidgetInstance) {
|
|
@@ -8,8 +8,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _appointmentService = require("../services/appointmentService");
|
|
9
9
|
var _httpService = require("../services/httpService");
|
|
10
10
|
var _apiConfig = require("../constants/apiConfig");
|
|
11
|
-
function
|
|
12
|
-
function
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
15
|
// Decode JWT payload (no verification; for display only). Returns {} on invalid/missing.
|
|
14
16
|
function getJwtPayload(token) {
|
|
15
17
|
if (!token || typeof token !== "string") return {};
|
|
@@ -19,7 +21,7 @@ function getJwtPayload(token) {
|
|
|
19
21
|
const base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
20
22
|
const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
|
|
21
23
|
return JSON.parse(atob(padded));
|
|
22
|
-
} catch {
|
|
24
|
+
} catch (_unused) {
|
|
23
25
|
return {};
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -39,26 +41,32 @@ const PIH_APPOINTMENT_WIDGET_DATA_ATTR = "data-pih-widget";
|
|
|
39
41
|
|
|
40
42
|
// Extract from SSO login response (not from appToken JWT — these are only in login response)
|
|
41
43
|
function extractAppToken(response) {
|
|
44
|
+
var _ref, _ref2, _ref3, _response$data$access, _response$data, _response$data2;
|
|
42
45
|
if (!response || response.err) return null;
|
|
43
|
-
return response.data
|
|
46
|
+
return (_ref = (_ref2 = (_ref3 = (_response$data$access = (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.access_token) !== null && _response$data$access !== void 0 ? _response$data$access : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.token) !== null && _ref3 !== void 0 ? _ref3 : response.token) !== null && _ref2 !== void 0 ? _ref2 : response.accessToken) !== null && _ref !== void 0 ? _ref : null;
|
|
44
47
|
}
|
|
45
48
|
function extractDoctorIdFromLoginResponse(response) {
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
var _ref4, _response$data$doctor;
|
|
50
|
+
if (!(response !== null && response !== void 0 && response.data)) return null;
|
|
51
|
+
const id = (_ref4 = (_response$data$doctor = response.data.doctor_id) !== null && _response$data$doctor !== void 0 ? _response$data$doctor : response.data.doctorId) !== null && _ref4 !== void 0 ? _ref4 : null;
|
|
48
52
|
console.log(id, 'extractDoctorIdFromLoginResponse -> id');
|
|
49
53
|
return id != null ? String(id) : null;
|
|
50
54
|
}
|
|
51
55
|
function extractUserNameFromLoginResponse(response) {
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
var _ref5, _ref6, _response$data$name;
|
|
57
|
+
if (!(response !== null && response !== void 0 && response.data)) return null;
|
|
58
|
+
const name = (_ref5 = (_ref6 = (_response$data$name = response.data.name) !== null && _response$data$name !== void 0 ? _response$data$name : response.data.doctor_name) !== null && _ref6 !== void 0 ? _ref6 : response.data.userName) !== null && _ref5 !== void 0 ? _ref5 : null;
|
|
54
59
|
return name != null ? String(name) : null;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
// Error boundary so a render error never shows a blank screen
|
|
58
63
|
class AppointmentErrorBoundary extends _react.Component {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
_defineProperty(this, "state", {
|
|
67
|
+
hasError: false
|
|
68
|
+
});
|
|
69
|
+
}
|
|
62
70
|
static getDerivedStateFromError() {
|
|
63
71
|
return {
|
|
64
72
|
hasError: true
|
|
@@ -115,21 +123,21 @@ class AppointmentErrorBoundary extends _react.Component {
|
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
// SDK Component - accepts configuration from parent app
|
|
118
|
-
const AppointmentPage =
|
|
126
|
+
const AppointmentPage = _ref7 => {
|
|
119
127
|
let {
|
|
120
128
|
config = {}
|
|
121
|
-
} =
|
|
129
|
+
} = _ref7;
|
|
122
130
|
const [storedApiBaseUrl, setStoredApiBaseUrl] = (0, _react.useState)(() => {
|
|
123
131
|
try {
|
|
124
132
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_API_BASE_URL) : null;
|
|
125
|
-
} catch {
|
|
133
|
+
} catch (_unused2) {
|
|
126
134
|
return null;
|
|
127
135
|
}
|
|
128
136
|
});
|
|
129
137
|
const [storedHospitalId, setStoredHospitalId] = (0, _react.useState)(() => {
|
|
130
138
|
try {
|
|
131
139
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_HOSPITAL_ID) : null;
|
|
132
|
-
} catch {
|
|
140
|
+
} catch (_unused3) {
|
|
133
141
|
return null;
|
|
134
142
|
}
|
|
135
143
|
});
|
|
@@ -140,14 +148,14 @@ const AppointmentPage = _ref => {
|
|
|
140
148
|
const [storedIdToken, setStoredIdToken] = (0, _react.useState)(() => {
|
|
141
149
|
try {
|
|
142
150
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_ID_TOKEN) : null;
|
|
143
|
-
} catch {
|
|
151
|
+
} catch (_unused4) {
|
|
144
152
|
return null;
|
|
145
153
|
}
|
|
146
154
|
});
|
|
147
155
|
const [storedEmail, setStoredEmail] = (0, _react.useState)(() => {
|
|
148
156
|
try {
|
|
149
157
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_EMAIL) : null;
|
|
150
|
-
} catch {
|
|
158
|
+
} catch (_unused5) {
|
|
151
159
|
return null;
|
|
152
160
|
}
|
|
153
161
|
});
|
|
@@ -190,21 +198,21 @@ const AppointmentPage = _ref => {
|
|
|
190
198
|
const [appToken, setAppToken] = (0, _react.useState)(() => {
|
|
191
199
|
try {
|
|
192
200
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_APP_TOKEN) : null;
|
|
193
|
-
} catch {
|
|
201
|
+
} catch (_unused6) {
|
|
194
202
|
return null;
|
|
195
203
|
}
|
|
196
204
|
});
|
|
197
205
|
const [doctorIdFromLogin, setDoctorIdFromLogin] = (0, _react.useState)(() => {
|
|
198
206
|
try {
|
|
199
207
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_DOCTOR_ID) : null;
|
|
200
|
-
} catch {
|
|
208
|
+
} catch (_unused7) {
|
|
201
209
|
return null;
|
|
202
210
|
}
|
|
203
211
|
});
|
|
204
212
|
const [userName, setUserName] = (0, _react.useState)(() => {
|
|
205
213
|
try {
|
|
206
214
|
return typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY_USER_NAME) : null;
|
|
207
|
-
} catch {
|
|
215
|
+
} catch (_unused8) {
|
|
208
216
|
return null;
|
|
209
217
|
}
|
|
210
218
|
});
|
|
@@ -215,7 +223,7 @@ const AppointmentPage = _ref => {
|
|
|
215
223
|
const hasId = localStorage.getItem(STORAGE_KEY_ID_TOKEN);
|
|
216
224
|
const hasEmail = localStorage.getItem(STORAGE_KEY_EMAIL);
|
|
217
225
|
return !hasApp && !!(hasId && hasEmail);
|
|
218
|
-
} catch {
|
|
226
|
+
} catch (_unused9) {
|
|
219
227
|
return false;
|
|
220
228
|
}
|
|
221
229
|
});
|
|
@@ -277,7 +285,7 @@ const AppointmentPage = _ref => {
|
|
|
277
285
|
const y = date.getFullYear();
|
|
278
286
|
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
279
287
|
const d = String(date.getDate()).padStart(2, "0");
|
|
280
|
-
return
|
|
288
|
+
return "".concat(y, "-").concat(m, "-").concat(d);
|
|
281
289
|
};
|
|
282
290
|
const getDateRange = option => {
|
|
283
291
|
const today = new Date();
|
|
@@ -308,8 +316,8 @@ const AppointmentPage = _ref => {
|
|
|
308
316
|
to = formatLocalDate(lastOfMonth);
|
|
309
317
|
break;
|
|
310
318
|
case "currentYear":
|
|
311
|
-
from =
|
|
312
|
-
to =
|
|
319
|
+
from = "".concat(today.getFullYear(), "-01-01");
|
|
320
|
+
to = "".concat(today.getFullYear(), "-12-31");
|
|
313
321
|
break;
|
|
314
322
|
default:
|
|
315
323
|
from = to = getTodayDate();
|
|
@@ -334,7 +342,7 @@ const AppointmentPage = _ref => {
|
|
|
334
342
|
case "currentYear":
|
|
335
343
|
return "Current Year";
|
|
336
344
|
case "custom":
|
|
337
|
-
return isMobile ? "Custom" :
|
|
345
|
+
return isMobile ? "Custom" : "".concat(fromDate, " to ").concat(toDate);
|
|
338
346
|
default:
|
|
339
347
|
return "Today";
|
|
340
348
|
}
|
|
@@ -419,12 +427,12 @@ const AppointmentPage = _ref => {
|
|
|
419
427
|
|
|
420
428
|
// Helper to get unique identifier from appointment
|
|
421
429
|
const getAppointmentId = appointment => {
|
|
422
|
-
return appointment
|
|
430
|
+
return (appointment === null || appointment === void 0 ? void 0 : appointment.id) || (appointment === null || appointment === void 0 ? void 0 : appointment._id) || (appointment === null || appointment === void 0 ? void 0 : appointment.appointmentId) || (appointment === null || appointment === void 0 ? void 0 : appointment.patientId) || JSON.stringify(appointment);
|
|
423
431
|
};
|
|
424
432
|
|
|
425
433
|
// Generate avatar with first letter if no image
|
|
426
434
|
const getPatientAvatar = appointment => {
|
|
427
|
-
if (appointment
|
|
435
|
+
if (appointment !== null && appointment !== void 0 && appointment.image) {
|
|
428
436
|
return appointment.image;
|
|
429
437
|
}
|
|
430
438
|
// Return null to use the letter avatar component
|
|
@@ -543,6 +551,7 @@ const AppointmentPage = _ref => {
|
|
|
543
551
|
setCallLoading(true);
|
|
544
552
|
setCallError(null);
|
|
545
553
|
try {
|
|
554
|
+
var _response$data3;
|
|
546
555
|
const callConfig = {
|
|
547
556
|
apiBaseUrl,
|
|
548
557
|
hospitalId,
|
|
@@ -570,7 +579,7 @@ const AppointmentPage = _ref => {
|
|
|
570
579
|
setCallError("Session expired. Re-authenticating...");
|
|
571
580
|
return;
|
|
572
581
|
}
|
|
573
|
-
if (response.err || !response.data
|
|
582
|
+
if (response.err || !((_response$data3 = response.data) !== null && _response$data3 !== void 0 && _response$data3.token)) {
|
|
574
583
|
setCallError(String(response.err || "Failed to initiate call"));
|
|
575
584
|
return;
|
|
576
585
|
}
|
|
@@ -863,32 +872,7 @@ const AppointmentPage = _ref => {
|
|
|
863
872
|
|
|
864
873
|
// Add responsive styles and animations
|
|
865
874
|
const style = document.createElement("style");
|
|
866
|
-
style.innerHTML =
|
|
867
|
-
@keyframes spin {
|
|
868
|
-
0% { transform: rotate(0deg); }
|
|
869
|
-
100% { transform: rotate(360deg); }
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
@media (max-width: 768px) {
|
|
873
|
-
.appointments-grid {
|
|
874
|
-
grid-template-columns: 1.5fr 1fr 0.8fr !important;
|
|
875
|
-
}
|
|
876
|
-
.appointments-header-grid {
|
|
877
|
-
grid-template-columns: 1.5fr 1fr 0.8fr !important;
|
|
878
|
-
}
|
|
879
|
-
.hide-on-mobile {
|
|
880
|
-
display: none !important;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
@media (max-width: 480px) {
|
|
884
|
-
.appointments-header-grid {
|
|
885
|
-
font-size: 10px !important;
|
|
886
|
-
}
|
|
887
|
-
.appointments-grid {
|
|
888
|
-
font-size: 11px !important;
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
`;
|
|
875
|
+
style.innerHTML = "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n \n @media (max-width: 768px) {\n .appointments-grid {\n grid-template-columns: 1.5fr 1fr 0.8fr !important;\n }\n .appointments-header-grid {\n grid-template-columns: 1.5fr 1fr 0.8fr !important;\n }\n .hide-on-mobile {\n display: none !important;\n }\n }\n @media (max-width: 480px) {\n .appointments-header-grid {\n font-size: 10px !important;\n }\n .appointments-grid {\n font-size: 11px !important;\n }\n }\n ";
|
|
892
876
|
document.head.appendChild(style);
|
|
893
877
|
|
|
894
878
|
// Handle window resize
|
|
@@ -941,7 +925,7 @@ const AppointmentPage = _ref => {
|
|
|
941
925
|
justifyContent: "center",
|
|
942
926
|
padding: "24px"
|
|
943
927
|
}
|
|
944
|
-
}, /*#__PURE__*/_react.default.createElement("style", null,
|
|
928
|
+
}, /*#__PURE__*/_react.default.createElement("style", null, "@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }"), /*#__PURE__*/_react.default.createElement("div", {
|
|
945
929
|
style: {
|
|
946
930
|
width: "40px",
|
|
947
931
|
height: "40px",
|
|
@@ -1692,7 +1676,7 @@ const AppointmentPage = _ref => {
|
|
|
1692
1676
|
style: {
|
|
1693
1677
|
fontSize: "13px"
|
|
1694
1678
|
}
|
|
1695
|
-
}, searchQuery ?
|
|
1679
|
+
}, searchQuery ? "No appointments found for \"".concat(searchQuery, "\"") : "No appointments found"), searchQuery && /*#__PURE__*/_react.default.createElement("button", {
|
|
1696
1680
|
onClick: () => setSearchQuery(""),
|
|
1697
1681
|
style: {
|
|
1698
1682
|
marginTop: "12px",
|
|
@@ -1971,7 +1955,7 @@ const AppointmentPage = _ref => {
|
|
|
1971
1955
|
fontWeight: "700",
|
|
1972
1956
|
fontSize: isMobile ? "12px" : "13px"
|
|
1973
1957
|
}
|
|
1974
|
-
}, selectedAppointment
|
|
1958
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.specialisation) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.speciality) || "N/A")), /*#__PURE__*/_react.default.createElement("div", {
|
|
1975
1959
|
style: {
|
|
1976
1960
|
textAlign: "right"
|
|
1977
1961
|
}
|
|
@@ -1986,7 +1970,7 @@ const AppointmentPage = _ref => {
|
|
|
1986
1970
|
fontWeight: "700",
|
|
1987
1971
|
fontSize: isMobile ? "12px" : "13px"
|
|
1988
1972
|
}
|
|
1989
|
-
}, selectedAppointment
|
|
1973
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.type) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.appointmentType) || "Online"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
1990
1974
|
style: {
|
|
1991
1975
|
display: "flex",
|
|
1992
1976
|
justifyContent: "space-between"
|
|
@@ -2006,7 +1990,7 @@ const AppointmentPage = _ref => {
|
|
|
2006
1990
|
fontWeight: "700",
|
|
2007
1991
|
fontSize: isMobile ? "12px" : "13px"
|
|
2008
1992
|
}
|
|
2009
|
-
}, selectedAppointment
|
|
1993
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.date) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.appointmentDate) || "N/A")), /*#__PURE__*/_react.default.createElement("div", {
|
|
2010
1994
|
style: {
|
|
2011
1995
|
textAlign: "right"
|
|
2012
1996
|
}
|
|
@@ -2021,7 +2005,7 @@ const AppointmentPage = _ref => {
|
|
|
2021
2005
|
fontWeight: "700",
|
|
2022
2006
|
fontSize: isMobile ? "12px" : "13px"
|
|
2023
2007
|
}
|
|
2024
|
-
}, selectedAppointment
|
|
2008
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.time) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.appointmentTime) || "N/A"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
2025
2009
|
style: {
|
|
2026
2010
|
display: "flex",
|
|
2027
2011
|
justifyContent: "space-between"
|
|
@@ -2041,7 +2025,7 @@ const AppointmentPage = _ref => {
|
|
|
2041
2025
|
fontWeight: "700",
|
|
2042
2026
|
fontSize: isMobile ? "12px" : "13px"
|
|
2043
2027
|
}
|
|
2044
|
-
}, selectedAppointment
|
|
2028
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.doctor) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.doctorName) || "N/A"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
2045
2029
|
style: {
|
|
2046
2030
|
display: "flex",
|
|
2047
2031
|
justifyContent: "space-between"
|
|
@@ -2061,7 +2045,7 @@ const AppointmentPage = _ref => {
|
|
|
2061
2045
|
fontWeight: "700",
|
|
2062
2046
|
fontSize: isMobile ? "12px" : "13px"
|
|
2063
2047
|
}
|
|
2064
|
-
}, selectedAppointment
|
|
2048
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.hospital) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.hospitalName) || "N/A"))), /*#__PURE__*/_react.default.createElement("div", {
|
|
2065
2049
|
style: {
|
|
2066
2050
|
display: "flex",
|
|
2067
2051
|
justifyContent: "space-between"
|
|
@@ -2082,7 +2066,7 @@ const AppointmentPage = _ref => {
|
|
|
2082
2066
|
fontSize: isMobile ? "11px" : "12px",
|
|
2083
2067
|
lineHeight: "1.4"
|
|
2084
2068
|
}
|
|
2085
|
-
}, selectedAppointment
|
|
2069
|
+
}, (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.reason) || (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.reasonForAppointment) || "No reason provided"))), activeTab === "upcoming" && /*#__PURE__*/_react.default.createElement("div", {
|
|
2086
2070
|
style: {
|
|
2087
2071
|
display: "flex",
|
|
2088
2072
|
flexDirection: isMobile ? "column" : "row",
|
|
@@ -2135,12 +2119,12 @@ const AppointmentPage = _ref => {
|
|
|
2135
2119
|
}, "Select an appointment to view details"))))))), showPipVideo && /*#__PURE__*/_react.default.createElement("div", {
|
|
2136
2120
|
style: {
|
|
2137
2121
|
position: "fixed",
|
|
2138
|
-
left: isPipFullscreen ? "0" : isMobile ? "10px" :
|
|
2139
|
-
top: isPipFullscreen ? "0" : isMobile ? "70px" :
|
|
2122
|
+
left: isPipFullscreen ? "0" : isMobile ? "10px" : "".concat(pipPosition.x, "px"),
|
|
2123
|
+
top: isPipFullscreen ? "0" : isMobile ? "70px" : "".concat(pipPosition.y, "px"),
|
|
2140
2124
|
right: isPipFullscreen ? "0" : isMobile ? "10px" : "auto",
|
|
2141
2125
|
bottom: isPipFullscreen ? "0" : "auto",
|
|
2142
|
-
width: isPipFullscreen ? "100vw" : isMobile ? "calc(100vw - 20px)" : isPipMinimized ? "350px" :
|
|
2143
|
-
height: isPipFullscreen ? "100vh" : isPipMinimized ? "auto" : isMobile ? "300px" :
|
|
2126
|
+
width: isPipFullscreen ? "100vw" : isMobile ? "calc(100vw - 20px)" : isPipMinimized ? "350px" : "".concat(pipSize.width, "px"),
|
|
2127
|
+
height: isPipFullscreen ? "100vh" : isPipMinimized ? "auto" : isMobile ? "300px" : "".concat(pipSize.height, "px"),
|
|
2144
2128
|
background: "#FFFFFF",
|
|
2145
2129
|
borderRadius: isPipFullscreen ? "0" : "8px",
|
|
2146
2130
|
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.3)",
|
|
@@ -2191,7 +2175,7 @@ const AppointmentPage = _ref => {
|
|
|
2191
2175
|
textOverflow: "ellipsis",
|
|
2192
2176
|
whiteSpace: "nowrap"
|
|
2193
2177
|
}
|
|
2194
|
-
}, "Video Call - ", selectedAppointment
|
|
2178
|
+
}, "Video Call - ", (selectedAppointment === null || selectedAppointment === void 0 ? void 0 : selectedAppointment.patientName) || "Patient")), /*#__PURE__*/_react.default.createElement("div", {
|
|
2195
2179
|
style: {
|
|
2196
2180
|
display: "flex",
|
|
2197
2181
|
gap: isMobile ? "4px" : "6px",
|
|
@@ -2320,7 +2304,7 @@ const AppointmentPage = _ref => {
|
|
|
2320
2304
|
src: (() => {
|
|
2321
2305
|
if (!callToken) return "";
|
|
2322
2306
|
const base = String(joinCallUrlBase || "").replace(/\/?$/, "/");
|
|
2323
|
-
return
|
|
2307
|
+
return "".concat(base).concat(callToken);
|
|
2324
2308
|
})(),
|
|
2325
2309
|
style: {
|
|
2326
2310
|
width: "100%",
|
|
@@ -2391,12 +2375,7 @@ const AppointmentPage = _ref => {
|
|
|
2391
2375
|
background: "transparent",
|
|
2392
2376
|
zIndex: 10001
|
|
2393
2377
|
}
|
|
2394
|
-
})), /*#__PURE__*/_react.default.createElement("style", null,
|
|
2395
|
-
@keyframes pulse {
|
|
2396
|
-
0%, 100% { opacity: 1; }
|
|
2397
|
-
50% { opacity: 0.5; }
|
|
2398
|
-
}
|
|
2399
|
-
`))), showAuthError && /*#__PURE__*/_react.default.createElement("div", {
|
|
2378
|
+
})), /*#__PURE__*/_react.default.createElement("style", null, "\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n "))), showAuthError && /*#__PURE__*/_react.default.createElement("div", {
|
|
2400
2379
|
style: {
|
|
2401
2380
|
position: "fixed",
|
|
2402
2381
|
inset: 0,
|