medos-sdk 1.1.9 → 1.1.11
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 +7 -0
- package/dist/components/AppointmentCalender.js +22 -8
- package/dist/components/AppointmentConfirmationStep.d.ts +4 -0
- package/dist/components/AppointmentConfirmationStep.js +50 -52
- package/dist/components/AppointmentDateTimeModal.d.ts +4 -0
- package/dist/components/AppointmentDateTimeModal.js +216 -165
- 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 +13 -6
- package/dist/components/ContactPreferenceStep.js +16 -6
- package/dist/components/DoctorSelectModal.d.ts +5 -0
- package/dist/components/DoctorSelectModal.js +169 -74
- package/dist/components/EnquiryForm.js +84 -72
- package/dist/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/components/Icons/CloseIcon.js +5 -0
- package/dist/components/InquiryDetailsStep.js +11 -6
- 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.d.ts +5 -0
- package/dist/components/appointment-booking/AppointmentCalender.js +247 -0
- package/dist/components/appointment-booking/hooks/index.d.ts +3 -0
- package/dist/components/appointment-booking/hooks/index.js +3 -0
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.d.ts +8 -0
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.js +318 -0
- package/dist/components/appointment-booking/hooks/useAppointmentState.d.ts +9 -0
- package/dist/components/appointment-booking/hooks/useAppointmentState.js +125 -0
- package/dist/components/appointment-booking/hooks/useInitializeAddresses.d.ts +1 -0
- package/dist/components/appointment-booking/hooks/useInitializeAddresses.js +55 -0
- package/dist/components/appointment-booking/index.d.ts +5 -0
- package/dist/components/appointment-booking/index.js +3 -0
- package/dist/components/appointment-booking/types.d.ts +291 -0
- package/dist/components/appointment-booking/types.js +49 -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/custom-calendar.js +20 -11
- package/dist/components/styles.js +93 -52
- package/dist/components/theme-styles.d.ts +5 -4
- package/dist/components/theme-styles.js +221 -125
- package/dist/components/types.d.ts +12 -139
- package/dist/components/types.js +15 -32
- package/dist/components/uiComponents/SelectDropdown.d.ts +1 -1
- package/dist/components/uiComponents/SelectDropdown.js +24 -24
- package/dist/components/utils.d.ts +3 -0
- package/dist/components/utils.js +59 -0
- package/dist/components/validation.d.ts +2 -0
- package/dist/components/validation.js +41 -0
- 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/enquiry-form/validation.js +1 -1
- package/dist/index.d.ts +3 -1
- 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 +2 -1
- package/dist/react/index.js +1 -1
- package/dist/services/AppointmentService.d.ts +80 -2
- package/dist/services/AppointmentService.js +114 -5
- package/dist/services/WorkspaceService.d.ts +58 -3
- package/dist/services/WorkspaceService.js +10 -1
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +9 -7
- package/dist/vanilla/AppointmentCalendarWidget.js +834 -384
- 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 +4 -0
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +4 -0
- package/dist/vanilla/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/vanilla/components/BookingOptionStep.d.ts +14 -0
- package/dist/vanilla/components/DoctorSelectModal.d.ts +5 -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/AppointmentCalender.d.ts +5 -0
- package/dist/vanilla/components/appointment-booking/hooks/index.d.ts +3 -0
- package/dist/vanilla/components/appointment-booking/hooks/useAppointmentFlow.d.ts +8 -0
- package/dist/vanilla/components/appointment-booking/hooks/useAppointmentState.d.ts +9 -0
- package/dist/vanilla/components/appointment-booking/hooks/useInitializeAddresses.d.ts +1 -0
- package/dist/vanilla/components/appointment-booking/index.d.ts +5 -0
- package/dist/vanilla/components/appointment-booking/types.d.ts +291 -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/theme-styles.d.ts +5 -4
- package/dist/vanilla/components/types.d.ts +12 -139
- package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +1 -1
- package/dist/vanilla/components/utils.d.ts +3 -0
- package/dist/vanilla/components/validation.d.ts +2 -0
- 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 +374 -53
- package/dist/vanilla/index.d.ts +3 -1
- package/dist/vanilla/react/ThemeProvider.d.ts +2 -1
- package/dist/vanilla/react/index.d.ts +2 -1
- 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 +9 -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 +833 -207
- package/dist/vanilla/widget.js +6463 -5687
- package/package.json +1 -1
|
@@ -36,10 +36,12 @@ function injectSelectStyles() {
|
|
|
36
36
|
text-align: left;
|
|
37
37
|
box-sizing: border-box;
|
|
38
38
|
color: var(--medos-color-text, #111827);
|
|
39
|
+
min-height: 40px;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.medos-select-trigger:hover:not(:disabled) {
|
|
42
43
|
border-color: var(--medos-color-border-hover, #d1d5db);
|
|
44
|
+
background-color: #f8fafc;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
.medos-select-trigger:focus:not(:disabled) {
|
|
@@ -73,6 +75,8 @@ function injectSelectStyles() {
|
|
|
73
75
|
overflow: hidden;
|
|
74
76
|
text-overflow: ellipsis;
|
|
75
77
|
white-space: nowrap;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
.medos-select-placeholder {
|
|
@@ -112,6 +116,7 @@ function injectSelectStyles() {
|
|
|
112
116
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
113
117
|
animation: medos-select-show 0.15s ease-out;
|
|
114
118
|
box-sizing: border-box;
|
|
119
|
+
min-width: 180px;
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
@keyframes medos-select-show {
|
|
@@ -147,6 +152,7 @@ function injectSelectStyles() {
|
|
|
147
152
|
transition: background-color 0.1s ease;
|
|
148
153
|
box-sizing: border-box;
|
|
149
154
|
color: #1e293b;
|
|
155
|
+
min-height: 36px;
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
.medos-select-item:hover:not(.medos-select-item-disabled) {
|
|
@@ -159,6 +165,7 @@ function injectSelectStyles() {
|
|
|
159
165
|
|
|
160
166
|
.medos-select-item-selected {
|
|
161
167
|
background-color: #f3f4f6;
|
|
168
|
+
font-weight: 500;
|
|
162
169
|
}
|
|
163
170
|
|
|
164
171
|
.medos-select-item-disabled {
|
|
@@ -182,6 +189,8 @@ function injectSelectStyles() {
|
|
|
182
189
|
/* Item Text */
|
|
183
190
|
.medos-select-item-text {
|
|
184
191
|
flex: 1;
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
185
194
|
}
|
|
186
195
|
|
|
187
196
|
/* Scrollbar styling */
|
|
@@ -202,6 +211,24 @@ function injectSelectStyles() {
|
|
|
202
211
|
.medos-select-viewport::-webkit-scrollbar-thumb:hover {
|
|
203
212
|
background: #94a3b8;
|
|
204
213
|
}
|
|
214
|
+
|
|
215
|
+
/* Label styling for forms */
|
|
216
|
+
.medos-form-label {
|
|
217
|
+
display: block;
|
|
218
|
+
font-size: 14px;
|
|
219
|
+
font-weight: 500;
|
|
220
|
+
margin-bottom: 6px;
|
|
221
|
+
color: #374151;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.medos-form-group {
|
|
225
|
+
margin-bottom: 16px;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Contact method specific styling */
|
|
229
|
+
.medos-contact-method-container {
|
|
230
|
+
margin-top: 8px;
|
|
231
|
+
}
|
|
205
232
|
`;
|
|
206
233
|
document.head.appendChild(styleElement);
|
|
207
234
|
}
|
|
@@ -245,6 +272,7 @@ export class VanillaSelect {
|
|
|
245
272
|
button.className = `medos-select-trigger ${this.config.error ? "medos-select-trigger-error" : ""}`;
|
|
246
273
|
button.setAttribute("aria-expanded", this.isOpen.toString());
|
|
247
274
|
button.setAttribute("aria-haspopup", "listbox");
|
|
275
|
+
button.setAttribute("aria-label", "Select option");
|
|
248
276
|
if (this.config.disabled) {
|
|
249
277
|
button.disabled = true;
|
|
250
278
|
}
|
|
@@ -276,6 +304,10 @@ export class VanillaSelect {
|
|
|
276
304
|
e.preventDefault();
|
|
277
305
|
this.open();
|
|
278
306
|
}
|
|
307
|
+
else if (e.key === "ArrowUp") {
|
|
308
|
+
e.preventDefault();
|
|
309
|
+
this.open();
|
|
310
|
+
}
|
|
279
311
|
});
|
|
280
312
|
}
|
|
281
313
|
toggleOpen() {
|
|
@@ -323,9 +355,17 @@ export class VanillaSelect {
|
|
|
323
355
|
this.contentElement = document.createElement("div");
|
|
324
356
|
this.contentElement.className = "medos-select-content";
|
|
325
357
|
this.contentElement.setAttribute("role", "listbox");
|
|
326
|
-
this.contentElement.
|
|
358
|
+
this.contentElement.setAttribute("aria-label", "Options");
|
|
359
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
360
|
+
const spaceAbove = rect.top;
|
|
361
|
+
const dropdownHeight = Math.min(256, this.options.length * 36 + 8);
|
|
362
|
+
let top = rect.bottom + scrollTop + 4;
|
|
363
|
+
if (spaceBelow < dropdownHeight && spaceAbove > dropdownHeight) {
|
|
364
|
+
top = rect.top + scrollTop - dropdownHeight - 4;
|
|
365
|
+
}
|
|
366
|
+
this.contentElement.style.top = `${top}px`;
|
|
327
367
|
this.contentElement.style.left = `${rect.left + scrollLeft}px`;
|
|
328
|
-
this.contentElement.style.width = `${rect.width}px`;
|
|
368
|
+
this.contentElement.style.width = `${Math.max(rect.width, 180)}px`;
|
|
329
369
|
this.contentElement.innerHTML = `
|
|
330
370
|
<div class="medos-select-viewport">
|
|
331
371
|
${this.options
|
|
@@ -340,6 +380,7 @@ export class VanillaSelect {
|
|
|
340
380
|
data-label="${this.escapeHtml(option.label)}"
|
|
341
381
|
${option.disabled ? 'data-disabled="true"' : ""}
|
|
342
382
|
tabindex="${option.disabled ? "-1" : "0"}"
|
|
383
|
+
aria-label="${this.escapeHtml(option.label)}"
|
|
343
384
|
>
|
|
344
385
|
${this.selectedValue === option.value
|
|
345
386
|
? `
|
|
@@ -366,9 +407,16 @@ export class VanillaSelect {
|
|
|
366
407
|
const rect = this.triggerElement.getBoundingClientRect();
|
|
367
408
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
368
409
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
369
|
-
|
|
410
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
411
|
+
const spaceAbove = rect.top;
|
|
412
|
+
const dropdownHeight = Math.min(256, this.options.length * 36 + 8);
|
|
413
|
+
let top = rect.bottom + scrollTop + 4;
|
|
414
|
+
if (spaceBelow < dropdownHeight && spaceAbove > dropdownHeight) {
|
|
415
|
+
top = rect.top + scrollTop - dropdownHeight - 4;
|
|
416
|
+
}
|
|
417
|
+
this.contentElement.style.top = `${top}px`;
|
|
370
418
|
this.contentElement.style.left = `${rect.left + scrollLeft}px`;
|
|
371
|
-
this.contentElement.style.width = `${rect.width}px`;
|
|
419
|
+
this.contentElement.style.width = `${Math.max(rect.width, 180)}px`;
|
|
372
420
|
}
|
|
373
421
|
attachPortalEvents() {
|
|
374
422
|
this.handleDocumentClick = (e) => {
|
|
@@ -419,6 +467,14 @@ export class VanillaSelect {
|
|
|
419
467
|
this.selectValue(value, label);
|
|
420
468
|
}
|
|
421
469
|
}
|
|
470
|
+
else if (e.key === "Home") {
|
|
471
|
+
e.preventDefault();
|
|
472
|
+
this.focusFirstItem();
|
|
473
|
+
}
|
|
474
|
+
else if (e.key === "End") {
|
|
475
|
+
e.preventDefault();
|
|
476
|
+
this.focusLastItem();
|
|
477
|
+
}
|
|
422
478
|
});
|
|
423
479
|
}
|
|
424
480
|
}
|
|
@@ -444,6 +500,11 @@ export class VanillaSelect {
|
|
|
444
500
|
return;
|
|
445
501
|
const currentFocused = document.activeElement;
|
|
446
502
|
let currentIndex = items.indexOf(currentFocused);
|
|
503
|
+
if (currentIndex === -1) {
|
|
504
|
+
const targetIndex = direction > 0 ? 0 : items.length - 1;
|
|
505
|
+
items[targetIndex]?.focus();
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
447
508
|
let nextIndex = currentIndex + direction;
|
|
448
509
|
if (nextIndex < 0)
|
|
449
510
|
nextIndex = items.length - 1;
|
|
@@ -451,6 +512,19 @@ export class VanillaSelect {
|
|
|
451
512
|
nextIndex = 0;
|
|
452
513
|
items[nextIndex]?.focus();
|
|
453
514
|
}
|
|
515
|
+
focusFirstItem() {
|
|
516
|
+
if (!this.contentElement)
|
|
517
|
+
return;
|
|
518
|
+
const firstItem = this.contentElement.querySelector(".medos-select-item:not(.medos-select-item-disabled)");
|
|
519
|
+
firstItem?.focus();
|
|
520
|
+
}
|
|
521
|
+
focusLastItem() {
|
|
522
|
+
if (!this.contentElement)
|
|
523
|
+
return;
|
|
524
|
+
const items = this.contentElement.querySelectorAll(".medos-select-item:not(.medos-select-item-disabled)");
|
|
525
|
+
const lastItem = items[items.length - 1];
|
|
526
|
+
lastItem?.focus();
|
|
527
|
+
}
|
|
454
528
|
selectValue(value, label) {
|
|
455
529
|
this.selectedValue = value;
|
|
456
530
|
this.selectedLabel = label;
|
|
@@ -480,7 +554,6 @@ export class VanillaSelect {
|
|
|
480
554
|
setDisabled(disabled) {
|
|
481
555
|
this.config.disabled = disabled;
|
|
482
556
|
this.renderTrigger();
|
|
483
|
-
this.attachTriggerEvents();
|
|
484
557
|
}
|
|
485
558
|
setError(error) {
|
|
486
559
|
this.config.error = error;
|
|
@@ -496,6 +569,21 @@ export class VanillaSelect {
|
|
|
496
569
|
return div.innerHTML;
|
|
497
570
|
}
|
|
498
571
|
}
|
|
572
|
+
export function createContactMethodSelect(container, currentValue = "PHONE", onValueChange) {
|
|
573
|
+
const contactOptions = [
|
|
574
|
+
{ value: "PHONE", label: "Phone" },
|
|
575
|
+
{ value: "EMAIL", label: "Email" },
|
|
576
|
+
{ value: "BOTH", label: "Both" },
|
|
577
|
+
];
|
|
578
|
+
const select = new VanillaSelect(container, contactOptions, {
|
|
579
|
+
placeholder: "Select contact method",
|
|
580
|
+
onValueChange: (value) => {
|
|
581
|
+
onValueChange?.(value);
|
|
582
|
+
},
|
|
583
|
+
});
|
|
584
|
+
select.setValue(currentValue);
|
|
585
|
+
return select;
|
|
586
|
+
}
|
|
499
587
|
export function upgradeNativeSelect(selectElement, config = {}) {
|
|
500
588
|
const options = Array.from(selectElement.options).map((opt) => ({
|
|
501
589
|
value: opt.value,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppointmentState } from "../types";
|
|
2
|
+
export declare const useAppointmentFlow: (state: AppointmentState, dispatch: React.Dispatch<any>, onError?: (error: Error) => void) => {
|
|
3
|
+
goBack: () => void;
|
|
4
|
+
handleDateChange: (date: Date) => Promise<(() => void) | undefined>;
|
|
5
|
+
sendOtp: () => Promise<void>;
|
|
6
|
+
verifyOtp: () => Promise<void>;
|
|
7
|
+
submitAppointment: () => Promise<void>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppointmentState, AppointmentAction } from "../types";
|
|
2
|
+
export declare const useAppointmentState: () => {
|
|
3
|
+
state: AppointmentState;
|
|
4
|
+
dispatch: import("react").Dispatch<AppointmentAction>;
|
|
5
|
+
setStep: (step: number) => void;
|
|
6
|
+
setError: (error: string | null) => void;
|
|
7
|
+
setLoading: (loading: boolean) => void;
|
|
8
|
+
resetForm: () => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useInitializeAddresses: (dispatch: React.Dispatch<any>, onError?: (error: Error) => void) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AppointmentCalender } from "./AppointmentCalender";
|
|
2
|
+
export type { AppointmentCalenderProps } from "./AppointmentCalender";
|
|
3
|
+
export { useAppointmentState, useAppointmentFlow, useInitializeAddresses, } from "./hooks";
|
|
4
|
+
export type { AppointmentState, AppointmentAction } from "./types";
|
|
5
|
+
export { INITIAL_STATE } from "./types";
|
|
@@ -0,0 +1,291 @@
|
|
|
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
|
+
}
|
|
100
|
+
export type BookingOptionType = "session-pack" | "new-appointment" | "explore-packages" | null;
|
|
101
|
+
export interface AppointmentState {
|
|
102
|
+
step: number;
|
|
103
|
+
loading: boolean;
|
|
104
|
+
error: string | null;
|
|
105
|
+
workspaceId: number | null;
|
|
106
|
+
addresses: AddressItem[];
|
|
107
|
+
addressDoctorsMap: Record<number, Doctor[]>;
|
|
108
|
+
selectedAddress: number | null;
|
|
109
|
+
selectedDoctor: number | null;
|
|
110
|
+
selectedDate: Date;
|
|
111
|
+
slots: Slot[];
|
|
112
|
+
selectedSlot: Slot | null;
|
|
113
|
+
consultationMode: "ONLINE" | "OFFLINE";
|
|
114
|
+
consultationCharge: string;
|
|
115
|
+
patientName: string;
|
|
116
|
+
patientAge: string;
|
|
117
|
+
patientEmail: string;
|
|
118
|
+
patientGender: string;
|
|
119
|
+
bloodGroup: string;
|
|
120
|
+
patientDob: string;
|
|
121
|
+
patientAddress: string;
|
|
122
|
+
patientCity: string;
|
|
123
|
+
patientState: string;
|
|
124
|
+
patientCountry: string;
|
|
125
|
+
patientZipcode: string;
|
|
126
|
+
patientLandmark: string;
|
|
127
|
+
countryCode: string;
|
|
128
|
+
patientPhone: string;
|
|
129
|
+
otpCode: string;
|
|
130
|
+
otpSent: boolean;
|
|
131
|
+
otpVerified: boolean;
|
|
132
|
+
otpSending: boolean;
|
|
133
|
+
otpVerifying: boolean;
|
|
134
|
+
verifiedPatients: Patient[];
|
|
135
|
+
selectedPatient: Patient | null;
|
|
136
|
+
useExistingPatient: boolean;
|
|
137
|
+
userSessionPacks: SessionPack[];
|
|
138
|
+
availablePackages: AvailablePackage[];
|
|
139
|
+
selectedSessionPack: SessionPack | null;
|
|
140
|
+
selectedNewPackage: AvailablePackage | null;
|
|
141
|
+
bookingOptionType: BookingOptionType;
|
|
142
|
+
showPackageExplorer: boolean;
|
|
143
|
+
packagesLoading: boolean;
|
|
144
|
+
bookingType: "PACKAGE_PURCHASE" | "ONE_TIME_APPOINTMENT" | "USE_ACTIVE_PACKAGE";
|
|
145
|
+
paymentMode: "CASH" | "CARD" | string;
|
|
146
|
+
packageConfigId?: number;
|
|
147
|
+
patientPackageId?: number;
|
|
148
|
+
packageAmount?: number;
|
|
149
|
+
}
|
|
150
|
+
export type AppointmentAction = {
|
|
151
|
+
type: "SET_STEP";
|
|
152
|
+
payload: number;
|
|
153
|
+
} | {
|
|
154
|
+
type: "SET_LOADING";
|
|
155
|
+
payload: boolean;
|
|
156
|
+
} | {
|
|
157
|
+
type: "SET_ERROR";
|
|
158
|
+
payload: string | null;
|
|
159
|
+
} | {
|
|
160
|
+
type: "SET_WORKSPACE";
|
|
161
|
+
payload: {
|
|
162
|
+
id: number;
|
|
163
|
+
addresses: AddressItem[];
|
|
164
|
+
};
|
|
165
|
+
} | {
|
|
166
|
+
type: "SET_SELECTED_ADDRESS";
|
|
167
|
+
payload: number | null;
|
|
168
|
+
} | {
|
|
169
|
+
type: "SET_SELECTED_DOCTOR";
|
|
170
|
+
payload: number | null;
|
|
171
|
+
} | {
|
|
172
|
+
type: "SET_SELECTED_DATE";
|
|
173
|
+
payload: Date;
|
|
174
|
+
} | {
|
|
175
|
+
type: "SET_SLOTS";
|
|
176
|
+
payload: Slot[];
|
|
177
|
+
} | {
|
|
178
|
+
type: "SET_SELECTED_SLOT";
|
|
179
|
+
payload: Slot | null;
|
|
180
|
+
} | {
|
|
181
|
+
type: "SET_CONSULTATION_MODE";
|
|
182
|
+
payload: "ONLINE" | "OFFLINE";
|
|
183
|
+
} | {
|
|
184
|
+
type: "SET_CONSULTATION_CHARGE";
|
|
185
|
+
payload: string;
|
|
186
|
+
} | {
|
|
187
|
+
type: "SET_PATIENT_NAME";
|
|
188
|
+
payload: string;
|
|
189
|
+
} | {
|
|
190
|
+
type: "SET_PATIENT_AGE";
|
|
191
|
+
payload: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: "SET_PATIENT_EMAIL";
|
|
194
|
+
payload: string;
|
|
195
|
+
} | {
|
|
196
|
+
type: "SET_PATIENT_GENDER";
|
|
197
|
+
payload: string;
|
|
198
|
+
} | {
|
|
199
|
+
type: "SET_BLOOD_GROUP";
|
|
200
|
+
payload: string;
|
|
201
|
+
} | {
|
|
202
|
+
type: "SET_PATIENT_DOB";
|
|
203
|
+
payload: string;
|
|
204
|
+
} | {
|
|
205
|
+
type: "SET_PATIENT_ADDRESS";
|
|
206
|
+
payload: string;
|
|
207
|
+
} | {
|
|
208
|
+
type: "SET_PATIENT_CITY";
|
|
209
|
+
payload: string;
|
|
210
|
+
} | {
|
|
211
|
+
type: "SET_PATIENT_STATE";
|
|
212
|
+
payload: string;
|
|
213
|
+
} | {
|
|
214
|
+
type: "SET_PATIENT_COUNTRY";
|
|
215
|
+
payload: string;
|
|
216
|
+
} | {
|
|
217
|
+
type: "SET_PATIENT_ZIPCODE";
|
|
218
|
+
payload: string;
|
|
219
|
+
} | {
|
|
220
|
+
type: "SET_PATIENT_LANDMARK";
|
|
221
|
+
payload: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: "SET_COUNTRY_CODE";
|
|
224
|
+
payload: string;
|
|
225
|
+
} | {
|
|
226
|
+
type: "SET_PATIENT_PHONE";
|
|
227
|
+
payload: string;
|
|
228
|
+
} | {
|
|
229
|
+
type: "SET_OTP_CODE";
|
|
230
|
+
payload: string;
|
|
231
|
+
} | {
|
|
232
|
+
type: "SET_OTP_SENT";
|
|
233
|
+
payload: boolean;
|
|
234
|
+
} | {
|
|
235
|
+
type: "SET_OTP_VERIFIED";
|
|
236
|
+
payload: boolean;
|
|
237
|
+
} | {
|
|
238
|
+
type: "SET_OTP_SENDING";
|
|
239
|
+
payload: boolean;
|
|
240
|
+
} | {
|
|
241
|
+
type: "SET_OTP_VERIFYING";
|
|
242
|
+
payload: boolean;
|
|
243
|
+
} | {
|
|
244
|
+
type: "SET_VERIFIED_PATIENTS";
|
|
245
|
+
payload: Patient[];
|
|
246
|
+
} | {
|
|
247
|
+
type: "SET_SELECTED_PATIENT";
|
|
248
|
+
payload: Patient | null;
|
|
249
|
+
} | {
|
|
250
|
+
type: "SET_USE_EXISTING_PATIENT";
|
|
251
|
+
payload: boolean;
|
|
252
|
+
} | {
|
|
253
|
+
type: "SET_USER_SESSION_PACKS";
|
|
254
|
+
payload: SessionPack[];
|
|
255
|
+
} | {
|
|
256
|
+
type: "SET_AVAILABLE_PACKAGES";
|
|
257
|
+
payload: AvailablePackage[];
|
|
258
|
+
} | {
|
|
259
|
+
type: "SET_SELECTED_SESSION_PACK";
|
|
260
|
+
payload: SessionPack | null;
|
|
261
|
+
} | {
|
|
262
|
+
type: "SET_SELECTED_NEW_PACKAGE";
|
|
263
|
+
payload: AvailablePackage | null;
|
|
264
|
+
} | {
|
|
265
|
+
type: "SET_BOOKING_OPTION_TYPE";
|
|
266
|
+
payload: BookingOptionType;
|
|
267
|
+
} | {
|
|
268
|
+
type: "SET_SHOW_PACKAGE_EXPLORER";
|
|
269
|
+
payload: boolean;
|
|
270
|
+
} | {
|
|
271
|
+
type: "SET_PACKAGES_LOADING";
|
|
272
|
+
payload: boolean;
|
|
273
|
+
} | {
|
|
274
|
+
type: "SET_BOOKING_TYPE";
|
|
275
|
+
payload: "PACKAGE_PURCHASE" | "ONE_TIME_APPOINTMENT" | "USE_ACTIVE_PACKAGE";
|
|
276
|
+
} | {
|
|
277
|
+
type: "SET_PAYMENT_MODE";
|
|
278
|
+
payload: "CASH" | "CARD" | string;
|
|
279
|
+
} | {
|
|
280
|
+
type: "SET_PACKAGE_CONFIG_ID";
|
|
281
|
+
payload: number | undefined;
|
|
282
|
+
} | {
|
|
283
|
+
type: "SET_PATIENT_PACKAGE_ID";
|
|
284
|
+
payload: number | undefined;
|
|
285
|
+
} | {
|
|
286
|
+
type: "SET_PACKAGE_AMOUNT";
|
|
287
|
+
payload: number | undefined;
|
|
288
|
+
} | {
|
|
289
|
+
type: "RESET_FORM";
|
|
290
|
+
};
|
|
291
|
+
export declare const INITIAL_STATE: AppointmentState;
|