medos-sdk 1.1.10 → 1.1.12
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/client/MedosClient.d.ts +1 -0
- package/dist/client/MedosClient.js +8 -1
- package/dist/components/AppointmentCalender.js +19 -22
- package/dist/components/AppointmentConfirmationStep.d.ts +1 -0
- package/dist/components/AppointmentConfirmationStep.js +34 -42
- package/dist/components/AppointmentDateTimeModal.d.ts +1 -0
- package/dist/components/AppointmentDateTimeModal.js +201 -168
- package/dist/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/components/AppointmentSummaryStep.js +168 -0
- package/dist/components/BookingOptionStep.d.ts +14 -0
- package/dist/components/BookingOptionStep.js +346 -0
- package/dist/components/ContactInformationStep.js +10 -4
- package/dist/components/ContactPreferenceStep.js +10 -1
- package/dist/components/DoctorSelectModal.js +105 -59
- package/dist/components/EnquiryForm.js +81 -69
- package/dist/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/components/Icons/CloseIcon.js +5 -0
- package/dist/components/InquiryDetailsStep.js +5 -1
- package/dist/components/PatientDetailsStep.js +17 -12
- package/dist/components/PatientSelectionStep.d.ts +12 -0
- package/dist/components/PatientSelectionStep.js +254 -0
- package/dist/components/PhoneVerificationStep.js +1 -1
- package/dist/components/SuccessStep.js +1 -1
- package/dist/components/appointment-booking/AppointmentCalender.js +145 -67
- package/dist/components/appointment-booking/appointment-modal-styles.d.ts +272 -0
- package/dist/components/appointment-booking/appointment-modal-styles.js +419 -0
- package/dist/components/appointment-booking/components/AppointmentConfirmationStep.d.ts +28 -0
- package/dist/components/appointment-booking/components/AppointmentConfirmationStep.js +107 -0
- package/dist/components/appointment-booking/components/AppointmentDateTimeModal.d.ts +18 -0
- package/dist/components/appointment-booking/components/AppointmentDateTimeModal.js +306 -0
- package/dist/components/appointment-booking/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/components/appointment-booking/components/AppointmentSummaryStep.js +194 -0
- package/dist/components/appointment-booking/components/BookingOptionStep.d.ts +14 -0
- package/dist/components/appointment-booking/components/BookingOptionStep.js +350 -0
- package/dist/components/appointment-booking/components/DoctorSelectModal.d.ts +14 -0
- package/dist/components/appointment-booking/components/DoctorSelectModal.js +213 -0
- package/dist/components/appointment-booking/components/PatientDetailsStep.d.ts +3 -0
- package/dist/components/appointment-booking/components/PatientDetailsStep.js +96 -0
- package/dist/components/appointment-booking/components/PatientSelectionStep.d.ts +12 -0
- package/dist/components/appointment-booking/components/PatientSelectionStep.js +254 -0
- package/dist/components/appointment-booking/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/components/appointment-booking/components/PhoneVerificationStep.js +49 -0
- package/dist/components/appointment-booking/components/SuccessStep.d.ts +5 -0
- package/dist/components/appointment-booking/components/SuccessStep.js +9 -0
- package/dist/components/appointment-booking/components/index.d.ts +9 -0
- package/dist/components/appointment-booking/components/index.js +9 -0
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.d.ts +0 -1
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.js +111 -25
- package/dist/components/appointment-booking/hooks/useAppointmentState.js +32 -0
- package/dist/components/appointment-booking/hooks/useInitializeAddresses.js +0 -1
- package/dist/components/appointment-booking/index.d.ts +2 -4
- package/dist/components/appointment-booking/index.js +2 -2
- package/dist/components/appointment-booking/types.d.ts +167 -0
- package/dist/components/appointment-booking/types.js +16 -0
- package/dist/components/appointment-modal-styles.d.ts +259 -0
- package/dist/components/appointment-modal-styles.js +395 -0
- package/dist/components/constant.d.ts +2 -0
- package/dist/components/constant.js +15 -0
- package/dist/components/constants/constant.d.ts +2 -0
- package/dist/components/constants/constant.js +15 -0
- package/dist/components/constants/index.d.ts +3 -0
- package/dist/components/constants/index.js +24 -0
- package/dist/components/constants/options.d.ts +13 -0
- package/dist/components/constants/options.js +35 -0
- package/dist/components/constants/validation.d.ts +6 -0
- package/dist/components/constants/validation.js +16 -0
- package/dist/components/custom-calendar.js +20 -11
- package/dist/components/enquiry-form/EnquiryForm.d.ts +7 -0
- package/dist/components/enquiry-form/EnquiryForm.js +238 -0
- package/dist/components/enquiry-form/components/ContactInformationStep.d.ts +13 -0
- package/dist/components/enquiry-form/components/ContactInformationStep.js +21 -0
- package/dist/components/enquiry-form/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/components/enquiry-form/components/ContactPreferenceStep.js +20 -0
- package/dist/components/enquiry-form/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/components/enquiry-form/components/InquiryDetailsStep.js +20 -0
- package/dist/components/enquiry-form/components/index.d.ts +3 -0
- package/dist/components/enquiry-form/components/index.js +3 -0
- package/dist/components/enquiry-form/index.d.ts +2 -0
- package/dist/components/enquiry-form/index.js +2 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +7 -0
- package/dist/components/shared/icons/Check.d.ts +6 -0
- package/dist/components/shared/icons/Check.js +2 -0
- package/dist/components/shared/icons/ChevronDownIcon.d.ts +4 -0
- package/dist/components/shared/icons/ChevronDownIcon.js +2 -0
- package/dist/components/shared/icons/ChevronLeft.d.ts +3 -0
- package/dist/components/shared/icons/ChevronLeft.js +3 -0
- package/dist/components/shared/icons/ChevronRight.d.ts +3 -0
- package/dist/components/shared/icons/ChevronRight.js +3 -0
- package/dist/components/shared/icons/CloseIcon.d.ts +9 -0
- package/dist/components/shared/icons/CloseIcon.js +5 -0
- package/dist/components/shared/icons/ConfirmationCheck.d.ts +1 -0
- package/dist/components/shared/icons/ConfirmationCheck.js +9 -0
- package/dist/components/shared/icons/ConsultationType.d.ts +1 -0
- package/dist/components/shared/icons/ConsultationType.js +2 -0
- package/dist/components/shared/icons/Date&TimeIcon.d.ts +1 -0
- package/dist/components/shared/icons/Date&TimeIcon.js +2 -0
- package/dist/components/shared/icons/MapIcon.d.ts +1 -0
- package/dist/components/shared/icons/MapIcon.js +2 -0
- package/dist/components/shared/icons/MedosLogo.d.ts +3 -0
- package/dist/components/shared/icons/MedosLogo.js +3 -0
- package/dist/components/shared/icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/components/shared/icons/PaymentMethodIcon.js +2 -0
- package/dist/components/shared/icons/SuccessIcon.d.ts +8 -0
- package/dist/components/shared/icons/SuccessIcon.js +14 -0
- package/dist/components/shared/icons/UserIcon.d.ts +1 -0
- package/dist/components/shared/icons/UserIcon.js +2 -0
- package/dist/components/shared/icons/index.d.ts +13 -0
- package/dist/components/shared/icons/index.js +13 -0
- package/dist/components/shared/index.d.ts +2 -0
- package/dist/components/shared/index.js +2 -0
- package/dist/components/shared/ui/Calendar.d.ts +5 -0
- package/dist/components/shared/ui/Calendar.js +167 -0
- package/dist/components/shared/ui/SelectDropdown.d.ts +41 -0
- package/dist/components/shared/ui/SelectDropdown.js +301 -0
- package/dist/components/shared/ui/index.d.ts +2 -0
- package/dist/components/shared/ui/index.js +2 -0
- package/dist/components/styles/appointment.d.ts +4 -0
- package/dist/components/styles/appointment.js +220 -0
- package/dist/components/styles/enquiry.d.ts +2 -0
- package/dist/components/styles/enquiry.js +3 -0
- package/dist/components/styles/index.d.ts +2 -0
- package/dist/components/styles/index.js +2 -0
- package/dist/components/styles/shared.d.ts +3 -0
- package/dist/components/styles/shared.js +78 -0
- package/dist/components/styles.d.ts +1 -6
- package/dist/components/styles.js +1 -257
- package/dist/components/theme-styles.d.ts +5 -4
- package/dist/components/theme-styles.js +239 -125
- package/dist/components/types/appointment.d.ts +42 -0
- package/dist/components/types/appointment.js +1 -0
- package/dist/components/types/common.d.ts +24 -0
- package/dist/components/types/common.js +1 -0
- package/dist/components/types/enquiry.d.ts +59 -0
- package/dist/components/types/enquiry.js +1 -0
- package/dist/components/types/index.d.ts +4 -0
- package/dist/components/types/index.js +4 -0
- package/dist/components/types.d.ts +1 -52
- package/dist/components/types.js +1 -23
- package/dist/components/utils/date.d.ts +4 -0
- package/dist/components/utils/date.js +65 -0
- package/dist/components/utils/formatting.d.ts +4 -0
- package/dist/components/utils/formatting.js +9 -0
- package/dist/components/utils/index.d.ts +3 -0
- package/dist/components/utils/index.js +3 -0
- package/dist/components/utils/validation.d.ts +4 -0
- package/dist/components/utils/validation.js +37 -0
- package/dist/components/utils.d.ts +1 -5
- package/dist/components/utils.js +1 -15
- package/dist/components/validation.d.ts +1 -2
- package/dist/components/validation.js +1 -7
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/core/theme/index.d.ts +1 -0
- package/dist/core/theme/index.js +1 -0
- package/dist/core/theme/responsive.d.ts +15 -0
- package/dist/core/theme/responsive.js +113 -0
- package/dist/core/theme/themes.js +16 -4
- package/dist/core/theme/types.d.ts +8 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/react/ThemeProvider.d.ts +2 -1
- package/dist/react/ThemeProvider.js +49 -10
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +1 -1
- package/dist/services/AppointmentService.d.ts +80 -2
- package/dist/services/AppointmentService.js +131 -5
- package/dist/services/AuthService.js +1 -1
- package/dist/services/WorkspaceService.d.ts +58 -3
- package/dist/services/WorkspaceService.js +10 -1
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +17 -7
- package/dist/vanilla/AppointmentCalendarWidget.js +1401 -380
- package/dist/vanilla/EnquiryFormWidget.d.ts +1 -0
- package/dist/vanilla/EnquiryFormWidget.js +25 -43
- package/dist/vanilla/client/MedosClient.d.ts +1 -0
- package/dist/vanilla/components/AppointmentConfirmationStep.d.ts +1 -0
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +1 -0
- package/dist/vanilla/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/vanilla/components/BookingOptionStep.d.ts +14 -0
- package/dist/vanilla/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/vanilla/components/PatientSelectionStep.d.ts +12 -0
- package/dist/vanilla/components/VanillaCalendar.js +33 -18
- package/dist/vanilla/components/VanillaIcons.d.ts +5 -0
- package/dist/vanilla/components/VanillaIcons.js +92 -0
- package/dist/vanilla/components/VanillaSelect.d.ts +3 -0
- package/dist/vanilla/components/VanillaSelect.js +93 -5
- package/dist/vanilla/components/appointment-booking/appointment-modal-styles.d.ts +272 -0
- package/dist/vanilla/components/appointment-booking/components/AppointmentConfirmationStep.d.ts +28 -0
- package/dist/vanilla/components/appointment-booking/components/AppointmentDateTimeModal.d.ts +18 -0
- package/dist/vanilla/components/appointment-booking/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/vanilla/components/appointment-booking/components/BookingOptionStep.d.ts +14 -0
- package/dist/vanilla/components/appointment-booking/components/DoctorSelectModal.d.ts +14 -0
- package/dist/vanilla/components/appointment-booking/components/PatientDetailsStep.d.ts +3 -0
- package/dist/vanilla/components/appointment-booking/components/PatientSelectionStep.d.ts +12 -0
- package/dist/vanilla/components/appointment-booking/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/vanilla/components/appointment-booking/components/SuccessStep.d.ts +5 -0
- package/dist/vanilla/components/appointment-booking/components/index.d.ts +9 -0
- package/dist/vanilla/components/appointment-booking/hooks/useAppointmentFlow.d.ts +0 -1
- package/dist/vanilla/components/appointment-booking/index.d.ts +2 -4
- package/dist/vanilla/components/appointment-booking/types.d.ts +167 -0
- package/dist/vanilla/components/appointment-modal-styles.d.ts +259 -0
- package/dist/vanilla/components/constant.d.ts +2 -0
- package/dist/vanilla/components/constants/constant.d.ts +2 -0
- package/dist/vanilla/components/constants/index.d.ts +3 -0
- package/dist/vanilla/components/constants/options.d.ts +13 -0
- package/dist/vanilla/components/constants/validation.d.ts +6 -0
- package/dist/vanilla/components/enquiry-form/EnquiryForm.d.ts +7 -0
- package/dist/vanilla/components/enquiry-form/components/ContactInformationStep.d.ts +13 -0
- package/dist/vanilla/components/enquiry-form/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/vanilla/components/enquiry-form/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/vanilla/components/enquiry-form/components/index.d.ts +3 -0
- package/dist/vanilla/components/enquiry-form/index.d.ts +2 -0
- package/dist/vanilla/components/index.d.ts +7 -3
- package/dist/vanilla/components/shared/icons/Check.d.ts +6 -0
- package/dist/vanilla/components/shared/icons/ChevronDownIcon.d.ts +4 -0
- package/dist/vanilla/components/shared/icons/ChevronLeft.d.ts +3 -0
- package/dist/vanilla/components/shared/icons/ChevronRight.d.ts +3 -0
- package/dist/vanilla/components/shared/icons/CloseIcon.d.ts +9 -0
- package/dist/vanilla/components/shared/icons/ConfirmationCheck.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/ConsultationType.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/Date&TimeIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/MapIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/MedosLogo.d.ts +3 -0
- package/dist/vanilla/components/shared/icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/SuccessIcon.d.ts +8 -0
- package/dist/vanilla/components/shared/icons/UserIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/index.d.ts +13 -0
- package/dist/vanilla/components/shared/index.d.ts +2 -0
- package/dist/vanilla/components/shared/ui/Calendar.d.ts +5 -0
- package/dist/vanilla/components/shared/ui/SelectDropdown.d.ts +41 -0
- package/dist/vanilla/components/shared/ui/index.d.ts +2 -0
- package/dist/vanilla/components/styles/appointment.d.ts +4 -0
- package/dist/vanilla/components/styles/enquiry.d.ts +2 -0
- package/dist/vanilla/components/styles/index.d.ts +2 -0
- package/dist/vanilla/components/styles/shared.d.ts +3 -0
- package/dist/vanilla/components/styles.d.ts +1 -6
- package/dist/vanilla/components/theme-styles.d.ts +5 -4
- package/dist/vanilla/components/types/appointment.d.ts +42 -0
- package/dist/vanilla/components/types/common.d.ts +24 -0
- package/dist/vanilla/components/types/enquiry.d.ts +59 -0
- package/dist/vanilla/components/types/index.d.ts +4 -0
- package/dist/vanilla/components/types.d.ts +1 -52
- package/dist/vanilla/components/utils/date.d.ts +4 -0
- package/dist/vanilla/components/utils/formatting.d.ts +4 -0
- package/dist/vanilla/components/utils/index.d.ts +3 -0
- package/dist/vanilla/components/utils/validation.d.ts +4 -0
- package/dist/vanilla/components/utils.d.ts +1 -5
- package/dist/vanilla/components/validation.d.ts +1 -2
- package/dist/vanilla/constants/index.d.ts +1 -1
- package/dist/vanilla/core/theme/index.d.ts +1 -0
- package/dist/vanilla/core/theme/responsive.d.ts +15 -0
- package/dist/vanilla/core/theme/types.d.ts +8 -0
- package/dist/vanilla/enquiry-widget.js +3632 -90
- package/dist/vanilla/index.d.ts +4 -2
- package/dist/vanilla/react/ThemeProvider.d.ts +2 -1
- package/dist/vanilla/react/index.d.ts +3 -3
- package/dist/vanilla/services/AppointmentService.d.ts +80 -2
- package/dist/vanilla/services/WorkspaceService.d.ts +58 -3
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +17 -7
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +1 -0
- package/dist/vanilla/vanilla/components/VanillaIcons.d.ts +5 -0
- package/dist/vanilla/vanilla/components/VanillaSelect.d.ts +3 -0
- package/dist/vanilla/widget.css +1045 -205
- package/dist/vanilla/widget.js +10365 -5737
- package/package.json +2 -2
|
@@ -5,22 +5,27 @@ import { validatePhoneNumber, validateCountryCode, } from "../../../components/v
|
|
|
5
5
|
import { formatDateToISO, parsePatientName } from "../../../components/utils";
|
|
6
6
|
export const useAppointmentFlow = (state, dispatch, onError) => {
|
|
7
7
|
const goBack = useCallback(() => {
|
|
8
|
-
if (state.step ===
|
|
8
|
+
if (state.step === 2) {
|
|
9
9
|
dispatch({ type: "SET_OTP_SENT", payload: false });
|
|
10
10
|
dispatch({ type: "SET_OTP_CODE", payload: "" });
|
|
11
11
|
dispatch({ type: "SET_OTP_VERIFIED", payload: false });
|
|
12
12
|
dispatch({ type: "SET_STEP", payload: 1 });
|
|
13
13
|
}
|
|
14
|
+
else if (state.step === 3) {
|
|
15
|
+
dispatch({ type: "SET_STEP", payload: 2 });
|
|
16
|
+
}
|
|
14
17
|
else if (state.step === 4) {
|
|
15
|
-
|
|
18
|
+
if (state.verifiedPatients && state.verifiedPatients.length > 0) {
|
|
19
|
+
dispatch({ type: "SET_STEP", payload: 3 });
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
dispatch({ type: "SET_STEP", payload: 2 });
|
|
23
|
+
}
|
|
16
24
|
}
|
|
17
25
|
else {
|
|
18
26
|
dispatch({ type: "SET_STEP", payload: Math.max(0, state.step - 1) });
|
|
19
27
|
}
|
|
20
|
-
}, [state.step, dispatch]);
|
|
21
|
-
const goToNext = useCallback(() => {
|
|
22
|
-
dispatch({ type: "SET_STEP", payload: Math.min(5, state.step + 1) });
|
|
23
|
-
}, [state.step, dispatch]);
|
|
28
|
+
}, [state.step, state.verifiedPatients, dispatch]);
|
|
24
29
|
const handleDateChange = useCallback(async (date) => {
|
|
25
30
|
dispatch({ type: "SET_SELECTED_DATE", payload: date });
|
|
26
31
|
if (!state.workspaceId ||
|
|
@@ -120,13 +125,74 @@ export const useAppointmentFlow = (state, dispatch, onError) => {
|
|
|
120
125
|
}
|
|
121
126
|
dispatch({ type: "SET_OTP_VERIFYING", payload: true });
|
|
122
127
|
try {
|
|
123
|
-
await PatientService.verifyPhoneVerificationOtp({
|
|
128
|
+
const response = await PatientService.verifyPhoneVerificationOtp({
|
|
124
129
|
countryCode: state.countryCode,
|
|
125
130
|
phoneNumber: state.patientPhone,
|
|
126
131
|
otpCode: state.otpCode,
|
|
127
132
|
});
|
|
128
133
|
dispatch({ type: "SET_OTP_VERIFIED", payload: true });
|
|
129
134
|
dispatch({ type: "SET_ERROR", payload: null });
|
|
135
|
+
const sessionPacksDetails = response.sessionPacksDetails;
|
|
136
|
+
if (sessionPacksDetails?.associatedPatients &&
|
|
137
|
+
sessionPacksDetails.associatedPatients.length > 0) {
|
|
138
|
+
dispatch({
|
|
139
|
+
type: "SET_VERIFIED_PATIENTS",
|
|
140
|
+
payload: sessionPacksDetails.associatedPatients,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else if (response.patients && response.patients.length > 0) {
|
|
144
|
+
dispatch({ type: "SET_VERIFIED_PATIENTS", payload: response.patients });
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
dispatch({ type: "SET_VERIFIED_PATIENTS", payload: [] });
|
|
148
|
+
}
|
|
149
|
+
if (sessionPacksDetails?.activeSessionPackResponses &&
|
|
150
|
+
sessionPacksDetails.activeSessionPackResponses.length > 0) {
|
|
151
|
+
const userSessionPacks = sessionPacksDetails.activeSessionPackResponses.map((pack) => ({
|
|
152
|
+
id: pack.id,
|
|
153
|
+
name: pack.packageName || pack.name,
|
|
154
|
+
description: pack.description,
|
|
155
|
+
totalSessions: pack.totalSessions,
|
|
156
|
+
remainingSessions: pack.remainingSessions,
|
|
157
|
+
expiryDate: pack.expiryDate,
|
|
158
|
+
purchaseDate: pack.purchaseDate,
|
|
159
|
+
doctorId: pack.doctorId,
|
|
160
|
+
doctorName: pack.doctorName,
|
|
161
|
+
allowedConsultationModes: pack.allowedConsultationModes,
|
|
162
|
+
}));
|
|
163
|
+
dispatch({ type: "SET_USER_SESSION_PACKS", payload: userSessionPacks });
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
dispatch({ type: "SET_USER_SESSION_PACKS", payload: [] });
|
|
167
|
+
}
|
|
168
|
+
if (sessionPacksDetails?.allSessionPackResponses &&
|
|
169
|
+
sessionPacksDetails.allSessionPackResponses.length > 0) {
|
|
170
|
+
const availablePackages = sessionPacksDetails.allSessionPackResponses.map((pack) => ({
|
|
171
|
+
id: pack.id,
|
|
172
|
+
name: pack.packageName,
|
|
173
|
+
description: pack.description,
|
|
174
|
+
totalSessions: pack.totalSessions,
|
|
175
|
+
sessions: pack.totalSessions,
|
|
176
|
+
price: pack.packagePrice,
|
|
177
|
+
discountedPrice: pack.discountedPrice,
|
|
178
|
+
discount: pack.discount,
|
|
179
|
+
discountType: pack.discountType,
|
|
180
|
+
currency: "INR",
|
|
181
|
+
validityDays: pack.validityDays,
|
|
182
|
+
allowedConsultationModes: pack.allowedConsultationModes,
|
|
183
|
+
allowedDoctors: pack.allowedDoctors,
|
|
184
|
+
doctorIds: pack.doctorIds,
|
|
185
|
+
applicableOnline: pack.allowedConsultationModes?.includes("ONLINE"),
|
|
186
|
+
applicableOffline: pack.allowedConsultationModes?.includes("OFFLINE"),
|
|
187
|
+
}));
|
|
188
|
+
dispatch({
|
|
189
|
+
type: "SET_AVAILABLE_PACKAGES",
|
|
190
|
+
payload: availablePackages,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
dispatch({ type: "SET_AVAILABLE_PACKAGES", payload: [] });
|
|
195
|
+
}
|
|
130
196
|
}
|
|
131
197
|
catch (e) {
|
|
132
198
|
const msg = e.message || "Invalid OTP code";
|
|
@@ -156,11 +222,7 @@ export const useAppointmentFlow = (state, dispatch, onError) => {
|
|
|
156
222
|
});
|
|
157
223
|
return;
|
|
158
224
|
}
|
|
159
|
-
if (!state.patientName ||
|
|
160
|
-
!state.patientAge ||
|
|
161
|
-
!state.patientEmail ||
|
|
162
|
-
!state.patientGender ||
|
|
163
|
-
!state.bloodGroup) {
|
|
225
|
+
if (!state.patientName || !state.patientAge || !state.patientGender) {
|
|
164
226
|
dispatch({
|
|
165
227
|
type: "SET_ERROR",
|
|
166
228
|
payload: "Please fill in all patient details.",
|
|
@@ -182,7 +244,24 @@ export const useAppointmentFlow = (state, dispatch, onError) => {
|
|
|
182
244
|
try {
|
|
183
245
|
const { firstName, lastName } = parsePatientName(state.patientName);
|
|
184
246
|
const appointmentDate = formatDateToISO(state.selectedDate);
|
|
185
|
-
|
|
247
|
+
const patientPayload = {
|
|
248
|
+
firstName,
|
|
249
|
+
lastName,
|
|
250
|
+
countryCode: state.countryCode,
|
|
251
|
+
phoneNumber: state.patientPhone,
|
|
252
|
+
age: Number.parseInt(state.patientAge, 10),
|
|
253
|
+
gender: state.patientGender.toUpperCase(),
|
|
254
|
+
};
|
|
255
|
+
if (state.patientEmail) {
|
|
256
|
+
patientPayload.email = state.patientEmail;
|
|
257
|
+
}
|
|
258
|
+
if (state.bloodGroup) {
|
|
259
|
+
patientPayload.bloodGroup = state.bloodGroup;
|
|
260
|
+
}
|
|
261
|
+
if (state.useExistingPatient && state.selectedPatient) {
|
|
262
|
+
patientPayload.id = state.selectedPatient.id;
|
|
263
|
+
}
|
|
264
|
+
const appointmentPayload = {
|
|
186
265
|
workspaceId: state.workspaceId,
|
|
187
266
|
workspaceAddressId: state.selectedAddress,
|
|
188
267
|
doctorId: state.selectedDoctor,
|
|
@@ -193,25 +272,33 @@ export const useAppointmentFlow = (state, dispatch, onError) => {
|
|
|
193
272
|
consultationCharge: state.consultationCharge || "0",
|
|
194
273
|
type: "CONSULTATION",
|
|
195
274
|
source: "SDK_POWERED_WEBSITE",
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
email: state.patientEmail,
|
|
200
|
-
countryCode: state.countryCode,
|
|
201
|
-
phoneNumber: state.patientPhone,
|
|
202
|
-
age: parseInt(state.patientAge, 10),
|
|
203
|
-
gender: state.patientGender.toUpperCase(),
|
|
204
|
-
},
|
|
275
|
+
bookingType: state.bookingType,
|
|
276
|
+
paymentMode: state.paymentMode,
|
|
277
|
+
patientPayload,
|
|
205
278
|
patientAddress: {
|
|
206
279
|
addressLine1: state.patientAddress,
|
|
280
|
+
addressLine2: "",
|
|
207
281
|
city: state.patientCity,
|
|
208
282
|
state: state.patientState,
|
|
209
283
|
country: state.patientCountry,
|
|
210
284
|
zipcode: state.patientZipcode,
|
|
211
285
|
landmark: state.patientLandmark || undefined,
|
|
286
|
+
countryCode: state.countryCode,
|
|
287
|
+
phoneNumber: state.patientPhone,
|
|
288
|
+
patientId: state.selectedPatient?.id || 0,
|
|
212
289
|
},
|
|
213
|
-
}
|
|
214
|
-
|
|
290
|
+
};
|
|
291
|
+
if (state.packageConfigId) {
|
|
292
|
+
appointmentPayload.packageConfigId = state.packageConfigId;
|
|
293
|
+
}
|
|
294
|
+
if (state.patientPackageId) {
|
|
295
|
+
appointmentPayload.patientPackageId = state.patientPackageId;
|
|
296
|
+
}
|
|
297
|
+
if (state.packageAmount) {
|
|
298
|
+
appointmentPayload.packageAmount = state.packageAmount;
|
|
299
|
+
}
|
|
300
|
+
await AppointmentService.createAppointment(appointmentPayload);
|
|
301
|
+
dispatch({ type: "SET_STEP", payload: 7 });
|
|
215
302
|
}
|
|
216
303
|
catch (e) {
|
|
217
304
|
const msg = e.message || "Failed to create appointment";
|
|
@@ -224,7 +311,6 @@ export const useAppointmentFlow = (state, dispatch, onError) => {
|
|
|
224
311
|
}, [state, dispatch, onError]);
|
|
225
312
|
return {
|
|
226
313
|
goBack,
|
|
227
|
-
goToNext,
|
|
228
314
|
handleDateChange,
|
|
229
315
|
sendOtp,
|
|
230
316
|
verifyOtp,
|
|
@@ -70,6 +70,38 @@ const appointmentReducer = (state, action) => {
|
|
|
70
70
|
return { ...state, otpSending: action.payload };
|
|
71
71
|
case "SET_OTP_VERIFYING":
|
|
72
72
|
return { ...state, otpVerifying: action.payload };
|
|
73
|
+
case "SET_VERIFIED_PATIENTS":
|
|
74
|
+
return { ...state, verifiedPatients: action.payload };
|
|
75
|
+
case "SET_SELECTED_PATIENT":
|
|
76
|
+
return { ...state, selectedPatient: action.payload };
|
|
77
|
+
case "SET_USE_EXISTING_PATIENT":
|
|
78
|
+
return { ...state, useExistingPatient: action.payload };
|
|
79
|
+
case "SET_USER_SESSION_PACKS":
|
|
80
|
+
return { ...state, userSessionPacks: action.payload };
|
|
81
|
+
case "SET_AVAILABLE_PACKAGES":
|
|
82
|
+
return { ...state, availablePackages: action.payload };
|
|
83
|
+
case "SET_SELECTED_SESSION_PACK":
|
|
84
|
+
return { ...state, selectedSessionPack: action.payload };
|
|
85
|
+
case "SET_SELECTED_NEW_PACKAGE":
|
|
86
|
+
return { ...state, selectedNewPackage: action.payload };
|
|
87
|
+
case "SET_BOOKING_OPTION_TYPE":
|
|
88
|
+
return { ...state, bookingOptionType: action.payload };
|
|
89
|
+
case "SET_SHOW_PACKAGE_EXPLORER":
|
|
90
|
+
return { ...state, showPackageExplorer: action.payload };
|
|
91
|
+
case "SET_PACKAGES_LOADING":
|
|
92
|
+
return { ...state, packagesLoading: action.payload };
|
|
93
|
+
case "SET_BOOKING_TYPE":
|
|
94
|
+
return { ...state, bookingType: action.payload };
|
|
95
|
+
case "SET_PAYMENT_MODE":
|
|
96
|
+
return { ...state, paymentMode: action.payload };
|
|
97
|
+
case "SET_PACKAGE_CONFIG_ID":
|
|
98
|
+
return { ...state, packageConfigId: action.payload };
|
|
99
|
+
case "SET_PATIENT_PACKAGE_ID":
|
|
100
|
+
return { ...state, patientPackageId: action.payload };
|
|
101
|
+
case "SET_PACKAGE_AMOUNT":
|
|
102
|
+
return { ...state, packageAmount: action.payload };
|
|
103
|
+
case "SET_PATIENT_DOB":
|
|
104
|
+
return { ...state, patientDob: action.payload };
|
|
73
105
|
case "RESET_FORM":
|
|
74
106
|
return INITIAL_STATE;
|
|
75
107
|
default:
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { AppointmentCalender } from "./AppointmentCalender";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export type { AppointmentState, AppointmentAction } from "./types";
|
|
5
|
-
export { INITIAL_STATE } from "./types";
|
|
2
|
+
export * from "./components";
|
|
3
|
+
export * from "./types";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { AppointmentCalender } from "./AppointmentCalender";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export * from "./components";
|
|
3
|
+
export * from "./types";
|
|
@@ -1,4 +1,104 @@
|
|
|
1
1
|
import { Doctor, Slot, AddressItem } from "../../services/AppointmentService";
|
|
2
|
+
export interface Patient {
|
|
3
|
+
id: number;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
email: string;
|
|
7
|
+
countryCode: string;
|
|
8
|
+
phoneNumber: string;
|
|
9
|
+
dob: string;
|
|
10
|
+
age: number;
|
|
11
|
+
gender: string;
|
|
12
|
+
bloodGroup: string;
|
|
13
|
+
mrn: string;
|
|
14
|
+
address: {
|
|
15
|
+
id: number;
|
|
16
|
+
completeAddress: string;
|
|
17
|
+
addressLine1: string;
|
|
18
|
+
addressLine2: string;
|
|
19
|
+
city: string;
|
|
20
|
+
state: string;
|
|
21
|
+
country: string;
|
|
22
|
+
zipcode: string;
|
|
23
|
+
landmark: string;
|
|
24
|
+
phoneNumber: string;
|
|
25
|
+
latitude: number;
|
|
26
|
+
longitude: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface SessionPackDoctor {
|
|
30
|
+
id: number;
|
|
31
|
+
fullName: string;
|
|
32
|
+
profilePicUrl: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface SessionPackResponse {
|
|
35
|
+
id: number;
|
|
36
|
+
workspaceId: number;
|
|
37
|
+
packageName: string;
|
|
38
|
+
description: string;
|
|
39
|
+
totalSessions: number;
|
|
40
|
+
packagePrice: number;
|
|
41
|
+
discount: number;
|
|
42
|
+
discountedPrice: number;
|
|
43
|
+
discountType: "PERCENTAGE" | "FLAT";
|
|
44
|
+
validityDays: number;
|
|
45
|
+
allowedConsultationModes: ("ONLINE" | "OFFLINE")[];
|
|
46
|
+
doctorIds: number[];
|
|
47
|
+
allowFamilyBooking: boolean;
|
|
48
|
+
maxFamilyMembers: number;
|
|
49
|
+
isActive: boolean;
|
|
50
|
+
allowedDoctors: SessionPackDoctor[];
|
|
51
|
+
}
|
|
52
|
+
export interface ActiveSessionPack {
|
|
53
|
+
id: number;
|
|
54
|
+
packageName: string;
|
|
55
|
+
totalSessions: number;
|
|
56
|
+
remainingSessions: number;
|
|
57
|
+
expiryDate: string;
|
|
58
|
+
purchaseDate?: string;
|
|
59
|
+
doctorId?: number;
|
|
60
|
+
doctorName?: string;
|
|
61
|
+
allowedConsultationModes?: ("ONLINE" | "OFFLINE")[];
|
|
62
|
+
}
|
|
63
|
+
export interface SessionPacksDetails {
|
|
64
|
+
associatedPatients: Patient[];
|
|
65
|
+
activeSessionPackResponses: ActiveSessionPack[];
|
|
66
|
+
allSessionPackResponses: SessionPackResponse[];
|
|
67
|
+
}
|
|
68
|
+
export interface SessionPack {
|
|
69
|
+
id: number;
|
|
70
|
+
name: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
totalSessions: number;
|
|
73
|
+
remainingSessions: number;
|
|
74
|
+
price?: number;
|
|
75
|
+
validityDays?: number;
|
|
76
|
+
applicableOnline?: boolean;
|
|
77
|
+
applicableOffline?: boolean;
|
|
78
|
+
expiryDate: string;
|
|
79
|
+
purchaseDate?: string;
|
|
80
|
+
doctorId?: number;
|
|
81
|
+
doctorName?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface AvailablePackage {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
totalSessions: number;
|
|
88
|
+
sessions?: number;
|
|
89
|
+
price: number;
|
|
90
|
+
discountedPrice?: number;
|
|
91
|
+
discount?: number;
|
|
92
|
+
discountType?: "PERCENTAGE" | "FLAT";
|
|
93
|
+
currency?: string;
|
|
94
|
+
validityDays: number;
|
|
95
|
+
applicableOnline?: boolean;
|
|
96
|
+
applicableOffline?: boolean;
|
|
97
|
+
allowedConsultationModes?: ("ONLINE" | "OFFLINE")[];
|
|
98
|
+
allowedDoctors?: SessionPackDoctor[];
|
|
99
|
+
doctorIds?: number[];
|
|
100
|
+
}
|
|
101
|
+
export type BookingOptionType = "session-pack" | "new-appointment" | "explore-packages" | null;
|
|
2
102
|
export interface AppointmentState {
|
|
3
103
|
step: number;
|
|
4
104
|
loading: boolean;
|
|
@@ -18,6 +118,7 @@ export interface AppointmentState {
|
|
|
18
118
|
patientEmail: string;
|
|
19
119
|
patientGender: string;
|
|
20
120
|
bloodGroup: string;
|
|
121
|
+
patientDob: string;
|
|
21
122
|
patientAddress: string;
|
|
22
123
|
patientCity: string;
|
|
23
124
|
patientState: string;
|
|
@@ -31,6 +132,21 @@ export interface AppointmentState {
|
|
|
31
132
|
otpVerified: boolean;
|
|
32
133
|
otpSending: boolean;
|
|
33
134
|
otpVerifying: boolean;
|
|
135
|
+
verifiedPatients: Patient[];
|
|
136
|
+
selectedPatient: Patient | null;
|
|
137
|
+
useExistingPatient: boolean;
|
|
138
|
+
userSessionPacks: SessionPack[];
|
|
139
|
+
availablePackages: AvailablePackage[];
|
|
140
|
+
selectedSessionPack: SessionPack | null;
|
|
141
|
+
selectedNewPackage: AvailablePackage | null;
|
|
142
|
+
bookingOptionType: BookingOptionType;
|
|
143
|
+
showPackageExplorer: boolean;
|
|
144
|
+
packagesLoading: boolean;
|
|
145
|
+
bookingType: "PACKAGE_PURCHASE" | "ONE_TIME_APPOINTMENT" | "USE_ACTIVE_PACKAGE";
|
|
146
|
+
paymentMode: "CASH" | "CARD" | string;
|
|
147
|
+
packageConfigId?: number;
|
|
148
|
+
patientPackageId?: number;
|
|
149
|
+
packageAmount?: number;
|
|
34
150
|
}
|
|
35
151
|
export type AppointmentAction = {
|
|
36
152
|
type: "SET_STEP";
|
|
@@ -83,6 +199,9 @@ export type AppointmentAction = {
|
|
|
83
199
|
} | {
|
|
84
200
|
type: "SET_BLOOD_GROUP";
|
|
85
201
|
payload: string;
|
|
202
|
+
} | {
|
|
203
|
+
type: "SET_PATIENT_DOB";
|
|
204
|
+
payload: string;
|
|
86
205
|
} | {
|
|
87
206
|
type: "SET_PATIENT_ADDRESS";
|
|
88
207
|
payload: string;
|
|
@@ -122,7 +241,55 @@ export type AppointmentAction = {
|
|
|
122
241
|
} | {
|
|
123
242
|
type: "SET_OTP_VERIFYING";
|
|
124
243
|
payload: boolean;
|
|
244
|
+
} | {
|
|
245
|
+
type: "SET_VERIFIED_PATIENTS";
|
|
246
|
+
payload: Patient[];
|
|
247
|
+
} | {
|
|
248
|
+
type: "SET_SELECTED_PATIENT";
|
|
249
|
+
payload: Patient | null;
|
|
250
|
+
} | {
|
|
251
|
+
type: "SET_USE_EXISTING_PATIENT";
|
|
252
|
+
payload: boolean;
|
|
253
|
+
} | {
|
|
254
|
+
type: "SET_USER_SESSION_PACKS";
|
|
255
|
+
payload: SessionPack[];
|
|
256
|
+
} | {
|
|
257
|
+
type: "SET_AVAILABLE_PACKAGES";
|
|
258
|
+
payload: AvailablePackage[];
|
|
259
|
+
} | {
|
|
260
|
+
type: "SET_SELECTED_SESSION_PACK";
|
|
261
|
+
payload: SessionPack | null;
|
|
262
|
+
} | {
|
|
263
|
+
type: "SET_SELECTED_NEW_PACKAGE";
|
|
264
|
+
payload: AvailablePackage | null;
|
|
265
|
+
} | {
|
|
266
|
+
type: "SET_BOOKING_OPTION_TYPE";
|
|
267
|
+
payload: BookingOptionType;
|
|
268
|
+
} | {
|
|
269
|
+
type: "SET_SHOW_PACKAGE_EXPLORER";
|
|
270
|
+
payload: boolean;
|
|
271
|
+
} | {
|
|
272
|
+
type: "SET_PACKAGES_LOADING";
|
|
273
|
+
payload: boolean;
|
|
274
|
+
} | {
|
|
275
|
+
type: "SET_BOOKING_TYPE";
|
|
276
|
+
payload: "PACKAGE_PURCHASE" | "ONE_TIME_APPOINTMENT" | "USE_ACTIVE_PACKAGE";
|
|
277
|
+
} | {
|
|
278
|
+
type: "SET_PAYMENT_MODE";
|
|
279
|
+
payload: "CASH" | "CARD" | string;
|
|
280
|
+
} | {
|
|
281
|
+
type: "SET_PACKAGE_CONFIG_ID";
|
|
282
|
+
payload: number | undefined;
|
|
283
|
+
} | {
|
|
284
|
+
type: "SET_PATIENT_PACKAGE_ID";
|
|
285
|
+
payload: number | undefined;
|
|
286
|
+
} | {
|
|
287
|
+
type: "SET_PACKAGE_AMOUNT";
|
|
288
|
+
payload: number | undefined;
|
|
125
289
|
} | {
|
|
126
290
|
type: "RESET_FORM";
|
|
127
291
|
};
|
|
292
|
+
export interface AppointmentCalenderProps {
|
|
293
|
+
onError?: (err: Error) => void;
|
|
294
|
+
}
|
|
128
295
|
export declare const INITIAL_STATE: AppointmentState;
|
|
@@ -17,6 +17,7 @@ export const INITIAL_STATE = {
|
|
|
17
17
|
patientEmail: "",
|
|
18
18
|
patientGender: "",
|
|
19
19
|
bloodGroup: "",
|
|
20
|
+
patientDob: "",
|
|
20
21
|
patientAddress: "",
|
|
21
22
|
patientCity: "",
|
|
22
23
|
patientState: "",
|
|
@@ -30,4 +31,19 @@ export const INITIAL_STATE = {
|
|
|
30
31
|
otpVerified: false,
|
|
31
32
|
otpSending: false,
|
|
32
33
|
otpVerifying: false,
|
|
34
|
+
verifiedPatients: [],
|
|
35
|
+
selectedPatient: null,
|
|
36
|
+
useExistingPatient: false,
|
|
37
|
+
userSessionPacks: [],
|
|
38
|
+
availablePackages: [],
|
|
39
|
+
selectedSessionPack: null,
|
|
40
|
+
selectedNewPackage: null,
|
|
41
|
+
bookingOptionType: null,
|
|
42
|
+
showPackageExplorer: false,
|
|
43
|
+
packagesLoading: false,
|
|
44
|
+
bookingType: "ONE_TIME_APPOINTMENT",
|
|
45
|
+
paymentMode: "CASH",
|
|
46
|
+
packageConfigId: undefined,
|
|
47
|
+
patientPackageId: undefined,
|
|
48
|
+
packageAmount: undefined,
|
|
33
49
|
};
|