medos-sdk 1.1.6 → 1.1.8
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/dist/components/AppointmentCalender.js +13 -2
- package/dist/components/AppointmentConfirmationStep.d.ts +24 -0
- package/dist/components/AppointmentConfirmationStep.js +110 -0
- package/dist/components/Icons/SuccessIcon.d.ts +8 -0
- package/dist/components/Icons/SuccessIcon.js +14 -0
- package/dist/components/SuccessStep.js +1 -1
- package/dist/services/EnquiryService.d.ts +1 -1
- package/dist/services/EnquiryService.js +5 -8
- package/dist/services/WorkspaceService.d.ts +9 -0
- package/dist/services/WorkspaceService.js +17 -0
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +12 -0
- package/dist/vanilla/AppointmentCalendarWidget.js +573 -167
- package/dist/vanilla/EnquiryFormWidget.d.ts +3 -0
- package/dist/vanilla/EnquiryFormWidget.js +229 -120
- package/dist/vanilla/components/AppointmentConfirmationStep.d.ts +24 -0
- package/dist/vanilla/components/Icons/SuccessIcon.d.ts +8 -0
- package/dist/vanilla/components/VanillaCalendar.d.ts +32 -0
- package/dist/vanilla/components/VanillaCalendar.js +366 -0
- package/dist/vanilla/components/VanillaIcons.d.ts +17 -0
- package/dist/vanilla/components/VanillaIcons.js +268 -0
- package/dist/vanilla/components/VanillaSelect.d.ts +46 -0
- package/dist/vanilla/components/VanillaSelect.js +523 -0
- package/dist/vanilla/components/index.d.ts +3 -0
- package/dist/vanilla/components/index.js +3 -0
- package/dist/vanilla/components/theme-injector.d.ts +1 -0
- package/dist/vanilla/components/theme-injector.js +447 -0
- package/dist/vanilla/enquiry-widget.js +1445 -128
- package/dist/vanilla/services/EnquiryService.d.ts +1 -1
- package/dist/vanilla/services/WorkspaceService.d.ts +9 -0
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +12 -0
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +3 -0
- package/dist/vanilla/vanilla/components/VanillaCalendar.d.ts +32 -0
- package/dist/vanilla/vanilla/components/VanillaIcons.d.ts +17 -0
- package/dist/vanilla/vanilla/components/VanillaSelect.d.ts +46 -0
- package/dist/vanilla/vanilla/components/index.d.ts +3 -0
- package/dist/vanilla/vanilla/components/theme-injector.d.ts +1 -0
- package/dist/vanilla/vanilla/widget.d.ts +2 -0
- package/dist/vanilla/widget.d.ts +2 -0
- package/dist/vanilla/widget.js +2402 -294
- package/package.json +1 -1
|
@@ -6,12 +6,12 @@ import { AppointmentDateTimeModal } from "./AppointmentDateTimeModal";
|
|
|
6
6
|
import { DoctorSelectModal } from "./DoctorSelectModal";
|
|
7
7
|
import { PhoneVerificationStep } from "./PhoneVerificationStep";
|
|
8
8
|
import { PatientDetailsStep } from "./PatientDetailsStep";
|
|
9
|
-
import { SuccessStep } from "./SuccessStep";
|
|
10
9
|
import { INITIAL_STATE, } from "./types";
|
|
11
10
|
import { validatePhoneNumber, validateCountryCode } from "./validation";
|
|
12
11
|
import { formatDateToISO, parsePatientName } from "./utils";
|
|
13
12
|
import { useTheme } from "../react/hooks/useTheme";
|
|
14
13
|
import MedosLogo from "./Icons/MedosLogo";
|
|
14
|
+
import AppointmentConfirmationStep from "./AppointmentConfirmationStep";
|
|
15
15
|
const appointmentReducer = (state, action) => {
|
|
16
16
|
switch (action.type) {
|
|
17
17
|
case "SET_STEP":
|
|
@@ -365,7 +365,18 @@ export const AppointmentCalender = ({ onError, }) => {
|
|
|
365
365
|
}, []);
|
|
366
366
|
const theme = useTheme();
|
|
367
367
|
const styles = getStyles(theme);
|
|
368
|
-
return (_jsx("div", { style: styles.container, children: _jsxs("div", { style: styles.card, children: [_jsx("div", { style: styles.header, children: _jsx("h2", { style: styles.title, children: "Book Appointment" }) }), _jsx("hr", {}), _jsxs("div", { style: styles.content, children: [state.loading && _jsx("div", { style: { marginBottom: 12 }, children: "Loading..." }), state.error && _jsx("div", { style: styles.errorMessage, children: state.error }), state.step === 0 && (_jsx(DoctorSelectModal, { onCancel: () => dispatch({ type: "SET_STEP", payload: 0 }), onContinue: handleDoctorSelect })), state.step === 1 && (_jsx(AppointmentDateTimeModal, { onlineFee: 500, offlineFee: 300, slots: state.slots, onCancel: goBack, onDateChange: handleDateChange, onContinue: handleDateTimeModalContinue })), state.step === 3 && (_jsx(PhoneVerificationStep, { state: state, dispatch: dispatch, onSendOtp: sendOtp, onVerifyOtp: verifyOtp, onBack: goBack, onContinue: goToNext })), state.step === 4 && (_jsx(PatientDetailsStep, { state: state, dispatch: dispatch, onBack: goBack, onSubmit: submitAppointment })), state.step === 5 &&
|
|
368
|
+
return (_jsx("div", { style: styles.container, children: _jsxs("div", { style: styles.card, children: [_jsx("div", { style: styles.header, children: _jsx("h2", { style: styles.title, children: "Book Appointment" }) }), _jsx("hr", {}), _jsxs("div", { style: styles.content, children: [state.loading && _jsx("div", { style: { marginBottom: 12 }, children: "Loading..." }), state.error && _jsx("div", { style: styles.errorMessage, children: state.error }), state.step === 0 && (_jsx(DoctorSelectModal, { onCancel: () => dispatch({ type: "SET_STEP", payload: 0 }), onContinue: handleDoctorSelect })), state.step === 1 && (_jsx(AppointmentDateTimeModal, { onlineFee: 500, offlineFee: 300, slots: state.slots, onCancel: goBack, onDateChange: handleDateChange, onContinue: handleDateTimeModalContinue })), state.step === 3 && (_jsx(PhoneVerificationStep, { state: state, dispatch: dispatch, onSendOtp: sendOtp, onVerifyOtp: verifyOtp, onBack: goBack, onContinue: goToNext })), state.step === 4 && (_jsx(PatientDetailsStep, { state: state, dispatch: dispatch, onBack: goBack, onSubmit: submitAppointment })), state.step === 5 && (_jsx(AppointmentConfirmationStep, { appointment: {
|
|
369
|
+
patientName: state.patientName,
|
|
370
|
+
visitationType: state.consultationMode === "ONLINE" ? "Online Consultation" : "In-Person Visit",
|
|
371
|
+
appointmentDate: formatDateToISO(state.selectedDate),
|
|
372
|
+
fromTime: state.selectedSlot?.start ? new Date(state.selectedSlot.start).toTimeString().slice(0, 5) : "",
|
|
373
|
+
toTime: state.selectedSlot?.end ? new Date(state.selectedSlot.end).toTimeString().slice(0, 5) : "",
|
|
374
|
+
location: state.addresses.find(addr => addr.id === state.selectedAddress)?.label || "Clinic",
|
|
375
|
+
mode: state.consultationMode,
|
|
376
|
+
paymentMode: "Cash"
|
|
377
|
+
}, patient: {
|
|
378
|
+
patientName: state.patientName
|
|
379
|
+
}, onClose: resetForm })), _jsxs("div", { style: styles.branding, children: [_jsx("span", { style: styles.poweredBy, children: "Powered by" }), _jsx("a", { href: "https://medos.one", target: "_blank", rel: "noopener noreferrer", children: _jsx(MedosLogo, { style: { height: 50, width: "auto" } }) })] })] })] }) }));
|
|
369
380
|
};
|
|
370
381
|
const getStyles = (theme) => ({
|
|
371
382
|
container: {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface AppointmentDetails {
|
|
3
|
+
patientName?: string;
|
|
4
|
+
visitationType?: string;
|
|
5
|
+
appointmentDate?: string;
|
|
6
|
+
fromTime?: string;
|
|
7
|
+
toTime?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
location?: string;
|
|
10
|
+
mode?: string;
|
|
11
|
+
paymentMode?: string;
|
|
12
|
+
}
|
|
13
|
+
interface AppointmentConfirmationStepProps {
|
|
14
|
+
appointment: AppointmentDetails;
|
|
15
|
+
patient: {
|
|
16
|
+
firstName?: string;
|
|
17
|
+
middleName?: string;
|
|
18
|
+
lastName?: string;
|
|
19
|
+
patientName?: string;
|
|
20
|
+
};
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
}
|
|
23
|
+
declare const AppointmentConfirmationStep: React.FC<AppointmentConfirmationStepProps>;
|
|
24
|
+
export default AppointmentConfirmationStep;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "../react/hooks/useTheme";
|
|
3
|
+
import { SuccessIcon } from "./Icons/SuccessIcon";
|
|
4
|
+
const AppointmentConfirmationStep = ({ appointment, patient, onClose, }) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
const calculateDuration = () => {
|
|
7
|
+
if (appointment.duration)
|
|
8
|
+
return appointment.duration;
|
|
9
|
+
if (appointment.fromTime && appointment.toTime) {
|
|
10
|
+
const start = new Date(`2000-01-01T${appointment.fromTime}`);
|
|
11
|
+
const end = new Date(`2000-01-01T${appointment.toTime}`);
|
|
12
|
+
const diffMs = end.getTime() - start.getTime();
|
|
13
|
+
const diffMinutes = Math.round(diffMs / (1000 * 60));
|
|
14
|
+
return diffMinutes;
|
|
15
|
+
}
|
|
16
|
+
return 60;
|
|
17
|
+
};
|
|
18
|
+
const getPatientName = () => {
|
|
19
|
+
if (appointment.patientName)
|
|
20
|
+
return appointment.patientName;
|
|
21
|
+
if (patient.patientName)
|
|
22
|
+
return patient.patientName;
|
|
23
|
+
const parts = [patient.firstName, patient.middleName, patient.lastName].filter(Boolean);
|
|
24
|
+
return parts.join(" ") || "Patient";
|
|
25
|
+
};
|
|
26
|
+
const formatDate = (dateStr) => {
|
|
27
|
+
try {
|
|
28
|
+
const date = new Date(dateStr);
|
|
29
|
+
return date.toLocaleDateString('en-US', {
|
|
30
|
+
weekday: 'long',
|
|
31
|
+
year: 'numeric',
|
|
32
|
+
month: 'long',
|
|
33
|
+
day: 'numeric'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return dateStr;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const formatTime = (timeStr) => {
|
|
41
|
+
try {
|
|
42
|
+
const time = new Date(`2000-01-01T${timeStr}`);
|
|
43
|
+
return time.toLocaleTimeString('en-US', {
|
|
44
|
+
hour: 'numeric',
|
|
45
|
+
minute: '2-digit',
|
|
46
|
+
hour12: true
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return timeStr;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const duration = calculateDuration();
|
|
54
|
+
const patientName = getPatientName();
|
|
55
|
+
return (_jsxs("div", { style: {
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
padding: "0",
|
|
59
|
+
fontFamily: theme.typography.fontFamily,
|
|
60
|
+
background: theme.colors.background,
|
|
61
|
+
minHeight: "500px"
|
|
62
|
+
}, children: [_jsx("div", { style: {
|
|
63
|
+
padding: "20px 24px",
|
|
64
|
+
fontSize: 24,
|
|
65
|
+
fontWeight: "bold",
|
|
66
|
+
color: theme.colors.primary,
|
|
67
|
+
borderBottom: `2px solid ${theme.colors.border}`,
|
|
68
|
+
background: theme.colors.surface
|
|
69
|
+
}, children: "Appointment Confirmed" }), _jsxs("div", { style: {
|
|
70
|
+
flex: 1,
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexDirection: "column",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
justifyContent: "center",
|
|
75
|
+
padding: "40px 24px",
|
|
76
|
+
border: `2px solid ${theme.colors.border}`,
|
|
77
|
+
borderTop: "none",
|
|
78
|
+
background: theme.colors.surface,
|
|
79
|
+
textAlign: "center"
|
|
80
|
+
}, children: [_jsx("h2", { style: {
|
|
81
|
+
fontSize: 20,
|
|
82
|
+
fontWeight: "600",
|
|
83
|
+
color: theme.colors.success,
|
|
84
|
+
margin: "0 0 24px 0"
|
|
85
|
+
}, children: "Appointment Confirmed" }), _jsx("div", { style: { marginBottom: 32 }, children: _jsx(SuccessIcon, { size: 64, checkColor: "white", shapeColor: theme.colors.success }) }), _jsxs("div", { style: {
|
|
86
|
+
width: "100%",
|
|
87
|
+
maxWidth: 500,
|
|
88
|
+
marginBottom: 32
|
|
89
|
+
}, children: [_jsx("h3", { style: {
|
|
90
|
+
fontSize: 18,
|
|
91
|
+
fontWeight: "600",
|
|
92
|
+
color: theme.colors.success,
|
|
93
|
+
marginBottom: 24
|
|
94
|
+
}, children: "Appointment Details" }), _jsxs("div", { style: {
|
|
95
|
+
display: "flex",
|
|
96
|
+
flexDirection: "column",
|
|
97
|
+
gap: 12,
|
|
98
|
+
fontSize: 16,
|
|
99
|
+
lineHeight: 1.6,
|
|
100
|
+
color: theme.colors.text
|
|
101
|
+
}, children: [_jsxs("div", { children: [_jsx("strong", { style: { color: theme.colors.success }, children: "Patient:" }), " ", patientName] }), appointment.visitationType && (_jsxs("div", { children: [_jsx("strong", { style: { color: theme.colors.success }, children: "Visitation Type:" }), " ", appointment.visitationType] })), appointment.appointmentDate && (_jsxs("div", { children: [_jsx("strong", { style: { color: theme.colors.success }, children: "Date:" }), " ", formatDate(appointment.appointmentDate)] })), appointment.fromTime && (_jsxs("div", { children: [_jsx("strong", { style: { color: theme.colors.success }, children: "Time:" }), " ", formatTime(appointment.fromTime)] })), _jsxs("div", { children: [_jsx("strong", { style: { color: theme.colors.success }, children: "Duration:" }), " ~", duration, " minutes"] }), appointment.location && (_jsxs("div", { children: [_jsx("strong", { style: { color: theme.colors.success }, children: "Location:" }), " ", appointment.location] }))] })] }), _jsx("div", { style: {
|
|
102
|
+
fontSize: 16,
|
|
103
|
+
fontStyle: "italic",
|
|
104
|
+
color: theme.colors.textSecondary,
|
|
105
|
+
textAlign: "center",
|
|
106
|
+
maxWidth: 600,
|
|
107
|
+
lineHeight: 1.5
|
|
108
|
+
}, children: "A confirmation email has been sent to the Patient's Email address." })] })] }));
|
|
109
|
+
};
|
|
110
|
+
export default AppointmentConfirmationStep;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const SuccessIcon = ({ size = 64, checkColor = "white", shapeColor = "#006E0F", }) => {
|
|
3
|
+
const checkScale = size / 41;
|
|
4
|
+
const checkSize = {
|
|
5
|
+
width: 16 * checkScale,
|
|
6
|
+
height: 12 * checkScale,
|
|
7
|
+
};
|
|
8
|
+
return (_jsxs("div", { style: { position: "relative", display: "inline-block" }, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 41 41", fill: "none", children: _jsx("path", { d: "M31.1309 4.90254C32.388 4.98797 33.0166 5.03069 33.5247 5.25288C34.2598 5.57438 34.8467 6.16126 35.1682 6.8964C35.3904 7.40445 35.4331 8.03302 35.5185 9.29016L35.7135 12.159C35.748 12.6674 35.7653 12.9217 35.8206 13.1645C35.9004 13.5154 36.0391 13.8503 36.2308 14.1549C36.3634 14.3657 36.531 14.5576 36.8661 14.9416L38.7568 17.108C39.5853 18.0574 39.9996 18.532 40.2017 19.0484C40.4942 19.7955 40.4942 20.6255 40.2017 21.3727C39.9996 21.889 39.5853 22.3637 38.7568 23.313L36.8661 25.4795C36.531 25.8634 36.3634 26.0554 36.2308 26.2662C36.0391 26.5708 35.9004 26.9056 35.8206 27.2566C35.7653 27.4994 35.748 27.7536 35.7135 28.2621L35.5185 31.1309C35.4331 32.388 35.3904 33.0166 35.1682 33.5247C34.8467 34.2598 34.2598 34.8467 33.5247 35.1682C33.0166 35.3904 32.388 35.4331 31.1309 35.5185L28.2621 35.7135C27.7536 35.748 27.4994 35.7653 27.2566 35.8206C26.9056 35.9004 26.5708 36.0391 26.2662 36.2308C26.0554 36.3634 25.8634 36.531 25.4795 36.8661L23.313 38.7568C22.3637 39.5853 21.889 39.9996 21.3727 40.2017C20.6255 40.4942 19.7955 40.4942 19.0484 40.2017C18.532 39.9996 18.0574 39.5853 17.108 38.7568L14.9416 36.8661C14.5576 36.531 14.3657 36.3634 14.1549 36.2308C13.8503 36.0391 13.5154 35.9004 13.1645 35.8206C12.9217 35.7653 12.6674 35.748 12.159 35.7135L9.29016 35.5185C8.03302 35.4331 7.40445 35.3904 6.8964 35.1682C6.16126 34.8467 5.57438 34.2598 5.25288 33.5247C5.03069 33.0166 4.98797 32.388 4.90254 31.1309L4.70759 28.2621C4.67304 27.7536 4.65576 27.4994 4.60049 27.2566C4.52063 26.9056 4.38193 26.5708 4.19028 26.2662C4.05764 26.0554 3.89009 25.8634 3.555 25.4795L1.66428 23.313C0.83576 22.3637 0.421499 21.889 0.219363 21.3727C-0.073121 20.6255 -0.0731209 19.7955 0.219363 19.0484C0.421499 18.532 0.83576 18.0574 1.66428 17.108L3.555 14.9416C3.89009 14.5576 4.05764 14.3657 4.19027 14.1549C4.38193 13.8503 4.52063 13.5154 4.60049 13.1645C4.65576 12.9217 4.67304 12.6674 4.70759 12.159L4.90254 9.29016C4.98797 8.03302 5.03069 7.40445 5.25288 6.8964C5.57438 6.16126 6.16126 5.57438 6.8964 5.25288C7.40445 5.03069 8.03302 4.98797 9.29016 4.90254L12.159 4.70759C12.6674 4.67304 12.9217 4.65577 13.1645 4.6005C13.5154 4.52063 13.8503 4.38193 14.1549 4.19028C14.3657 4.05764 14.5576 3.89009 14.9416 3.555L17.108 1.66428C18.0574 0.83576 18.532 0.421499 19.0484 0.219363C19.7955 -0.073121 20.6255 -0.073121 21.3727 0.219363C21.889 0.421499 22.3637 0.83576 23.313 1.66428L25.4795 3.555C25.8634 3.89009 26.0554 4.05764 26.2662 4.19028C26.5708 4.38193 26.9056 4.52063 27.2566 4.6005C27.4994 4.65577 27.7536 4.67304 28.2621 4.70759L31.1309 4.90254Z", fill: shapeColor }) }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: checkSize.width, height: checkSize.height, viewBox: "0 0 16 12", fill: "none", style: {
|
|
9
|
+
position: "absolute",
|
|
10
|
+
top: "50%",
|
|
11
|
+
left: "50%",
|
|
12
|
+
transform: "translate(-50%, -50%)",
|
|
13
|
+
}, children: _jsx("path", { d: "M5.472 11.544L0 6.072L1.368 4.704L5.472 8.808L14.28 0L15.648 1.368L5.472 11.544Z", fill: checkColor }) })] }));
|
|
14
|
+
};
|
|
@@ -5,5 +5,5 @@ export const SuccessStep = ({ onReset }) => {
|
|
|
5
5
|
const theme = useTheme();
|
|
6
6
|
const SUCCESS_STYLES = getSuccessStyles(theme);
|
|
7
7
|
const BUTTON_STYLES = getButtonStyles(theme);
|
|
8
|
-
return (_jsxs("div", { style: SUCCESS_STYLES.container, children: [_jsx("div", { style: SUCCESS_STYLES.iconContainer, children: _jsx("div", { style: { fontSize: "48px", color: theme.colors.success }, children: "\u2713" }) }), _jsxs("div", { style: SUCCESS_STYLES.detailsContainer, children: [_jsx("h3", { style: SUCCESS_STYLES.detailsTitle, children: "Inquiry Submitted Successfully" }), _jsx("p", { style: SUCCESS_STYLES.confirmationNote, children: "Thank you for your inquiry. We will get back to you soon." })] }), _jsx("div", { style: SUCCESS_STYLES.actionContainer, children: _jsx("button", { onClick: onReset, style: BUTTON_STYLES.primary, children: "Submit Another Inquiry" }) })] }));
|
|
8
|
+
return (_jsxs("div", { style: SUCCESS_STYLES.container, children: [_jsx("div", { style: SUCCESS_STYLES.iconContainer, children: _jsx("div", { style: { fontSize: "48px", color: theme.colors.success }, children: "\u2713" }) }), _jsxs("div", { style: SUCCESS_STYLES.detailsContainer, children: [_jsx("h3", { style: SUCCESS_STYLES.detailsTitle, children: "Inquiry Submitted Successfully" }), _jsx("p", { style: SUCCESS_STYLES.confirmationNote, children: "Thank you for your inquiry. We will get back to you soon." })] }), _jsx("div", { style: { ...SUCCESS_STYLES.actionContainer, textAlign: "center" }, children: _jsx("button", { onClick: onReset, style: BUTTON_STYLES.primary, children: "Submit Another Inquiry" }) })] }));
|
|
9
9
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnquirySubmission } from "../enquiry-form/types";
|
|
2
2
|
declare const EnquiryService: {
|
|
3
|
-
submitEnquiry(payload: EnquirySubmission
|
|
3
|
+
submitEnquiry(payload: EnquirySubmission): Promise<any>;
|
|
4
4
|
};
|
|
5
5
|
export { EnquiryService };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MedosClient } from "../client/MedosClient";
|
|
2
2
|
const EnquiryService = {
|
|
3
|
-
async submitEnquiry(payload
|
|
3
|
+
async submitEnquiry(payload) {
|
|
4
4
|
try {
|
|
5
5
|
const client = await MedosClient.ensureInitialized();
|
|
6
6
|
const enquiryPayload = {
|
|
@@ -11,14 +11,11 @@ const EnquiryService = {
|
|
|
11
11
|
senderEmail: payload.patientEmail,
|
|
12
12
|
senderPhone: `${payload.countryCode}${payload.patientPhone}`,
|
|
13
13
|
};
|
|
14
|
-
if (workspaceId !== undefined)
|
|
15
|
-
enquiryPayload.workspaceId = workspaceId;
|
|
16
|
-
if (addressId !== undefined)
|
|
17
|
-
enquiryPayload.addressId = addressId;
|
|
18
|
-
if (doctorId !== undefined)
|
|
19
|
-
enquiryPayload.doctorId = doctorId;
|
|
20
14
|
const formData = new FormData();
|
|
21
|
-
|
|
15
|
+
const jsonBlob = new Blob([JSON.stringify(enquiryPayload)], {
|
|
16
|
+
type: "application/json",
|
|
17
|
+
});
|
|
18
|
+
formData.append("payload", jsonBlob);
|
|
22
19
|
const res = await client.post("/inbox/create", formData);
|
|
23
20
|
return res.data;
|
|
24
21
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MedosClient } from "../client/MedosClient";
|
|
2
|
+
const WorkspaceService = {
|
|
3
|
+
async fetchWorkspace() {
|
|
4
|
+
try {
|
|
5
|
+
const client = await MedosClient.ensureInitialized();
|
|
6
|
+
const res = await client.get("/workspaces");
|
|
7
|
+
if (!res.data || typeof res.data.id !== "number") {
|
|
8
|
+
throw new Error("Invalid workspace response");
|
|
9
|
+
}
|
|
10
|
+
return res.data;
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
throw new Error(`Failed to fetch workspace: ${error.message}`);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export { WorkspaceService };
|
|
@@ -12,12 +12,19 @@ declare class AppointmentCalendarWidget {
|
|
|
12
12
|
private mounted;
|
|
13
13
|
private state;
|
|
14
14
|
private doctors;
|
|
15
|
+
private addressSelect;
|
|
16
|
+
private doctorSelect;
|
|
17
|
+
private calendar;
|
|
18
|
+
private countryCodeSelect;
|
|
19
|
+
private genderSelect;
|
|
20
|
+
private bloodGroupSelect;
|
|
15
21
|
constructor(container: HTMLElement | string, options: AppointmentCalendarWidgetOptions);
|
|
16
22
|
private init;
|
|
17
23
|
private loadAddresses;
|
|
18
24
|
private handleAddressChange;
|
|
19
25
|
private loadSlots;
|
|
20
26
|
private canProceedFromMergedStep;
|
|
27
|
+
private updateSubmitButtonState;
|
|
21
28
|
private sendOtp;
|
|
22
29
|
private verifyOtp;
|
|
23
30
|
private submitAppointment;
|
|
@@ -26,12 +33,17 @@ declare class AppointmentCalendarWidget {
|
|
|
26
33
|
private reset;
|
|
27
34
|
private setState;
|
|
28
35
|
private render;
|
|
36
|
+
private initializeCustomComponents;
|
|
29
37
|
private renderStep;
|
|
30
38
|
private renderStep0;
|
|
31
39
|
private renderStep1;
|
|
32
40
|
private renderStep2;
|
|
33
41
|
private renderStep3;
|
|
34
42
|
private renderStep4;
|
|
43
|
+
private renderSuccessIcon;
|
|
44
|
+
private formatDate;
|
|
45
|
+
private formatTime;
|
|
46
|
+
private calculateDuration;
|
|
35
47
|
private renderStep5;
|
|
36
48
|
private attachEventListeners;
|
|
37
49
|
private escapeHtml;
|