medos-sdk 1.0.2 → 1.1.0

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.
Files changed (167) hide show
  1. package/README.md +39 -0
  2. package/dist/client/MedosClient.d.ts +3 -5
  3. package/dist/client/MedosClient.js +4 -4
  4. package/dist/components/AppointmentCalender.d.ts +1 -4
  5. package/dist/components/AppointmentCalender.js +323 -530
  6. package/dist/components/AppointmentDateTimeModal.d.ts +14 -0
  7. package/dist/components/AppointmentDateTimeModal.js +220 -0
  8. package/dist/components/ConfigurableCard.d.ts +12 -0
  9. package/dist/components/ConfigurableCard.js +29 -0
  10. package/dist/components/ContactInformationStep.d.ts +13 -0
  11. package/dist/components/ContactInformationStep.js +14 -0
  12. package/dist/components/ContactPreferenceStep.d.ts +9 -0
  13. package/dist/components/ContactPreferenceStep.js +16 -0
  14. package/dist/components/DoctorSelectModal.d.ts +7 -0
  15. package/dist/components/DoctorSelectModal.js +93 -0
  16. package/dist/components/EnquiryForm.d.ts +7 -0
  17. package/dist/components/EnquiryForm.js +212 -0
  18. package/dist/components/Icons/Check.d.ts +6 -0
  19. package/dist/components/Icons/Check.js +2 -0
  20. package/dist/components/Icons/ChevronDownIcon.d.ts +4 -0
  21. package/dist/components/Icons/ChevronDownIcon.js +2 -0
  22. package/dist/components/Icons/ChevronLeft.d.ts +3 -0
  23. package/dist/components/Icons/ChevronLeft.js +3 -0
  24. package/dist/components/Icons/ChevronRight.d.ts +3 -0
  25. package/dist/components/Icons/ChevronRight.js +3 -0
  26. package/dist/components/Icons/ConfirmationCheck.d.ts +1 -0
  27. package/dist/components/Icons/ConfirmationCheck.js +9 -0
  28. package/dist/components/Icons/ConsultationType.d.ts +1 -0
  29. package/dist/components/Icons/ConsultationType.js +2 -0
  30. package/dist/components/Icons/Date&TimeIcon.d.ts +1 -0
  31. package/dist/components/Icons/Date&TimeIcon.js +2 -0
  32. package/dist/components/Icons/MapIcon.d.ts +1 -0
  33. package/dist/components/Icons/MapIcon.js +2 -0
  34. package/dist/components/Icons/PaymentMethodIcon.d.ts +1 -0
  35. package/dist/components/Icons/PaymentMethodIcon.js +2 -0
  36. package/dist/components/Icons/UserIcon.d.ts +1 -0
  37. package/dist/components/Icons/UserIcon.js +2 -0
  38. package/dist/components/InquiryDetailsStep.d.ts +10 -0
  39. package/dist/components/InquiryDetailsStep.js +15 -0
  40. package/dist/components/PatientDetailsStep.d.ts +3 -0
  41. package/dist/components/PatientDetailsStep.js +84 -0
  42. package/dist/components/PhoneVerificationStep.d.ts +3 -0
  43. package/dist/components/PhoneVerificationStep.js +49 -0
  44. package/dist/components/SuccessStep.d.ts +5 -0
  45. package/dist/components/SuccessStep.js +9 -0
  46. package/dist/components/custom-calendar.d.ts +5 -0
  47. package/dist/components/custom-calendar.js +171 -0
  48. package/dist/components/styles.d.ts +6 -0
  49. package/dist/components/styles.js +257 -0
  50. package/dist/components/theme-styles.d.ts +12 -0
  51. package/dist/components/theme-styles.js +319 -0
  52. package/dist/components/types.d.ts +181 -0
  53. package/dist/components/types.js +55 -0
  54. package/dist/components/ui/select.d.ts +10 -0
  55. package/dist/components/ui/select.js +21 -0
  56. package/dist/components/uiComponents/SelectDropdown.d.ts +41 -0
  57. package/dist/components/uiComponents/SelectDropdown.js +302 -0
  58. package/dist/components/utils.d.ts +5 -0
  59. package/dist/components/utils.js +15 -0
  60. package/dist/components/validation.d.ts +2 -0
  61. package/dist/components/validation.js +7 -0
  62. package/dist/context/TemplateContext.d.ts +12 -0
  63. package/dist/context/TemplateContext.js +19 -0
  64. package/dist/core/index.d.ts +4 -0
  65. package/dist/core/index.js +4 -0
  66. package/dist/core/theme/index.d.ts +3 -0
  67. package/dist/core/theme/index.js +3 -0
  68. package/dist/core/theme/themes.d.ts +8 -0
  69. package/dist/core/theme/themes.js +178 -0
  70. package/dist/core/theme/types.d.ts +106 -0
  71. package/dist/core/theme/types.js +1 -0
  72. package/dist/core/theme/utils.d.ts +8 -0
  73. package/dist/core/theme/utils.js +135 -0
  74. package/dist/enquiry-form/index.d.ts +4 -0
  75. package/dist/enquiry-form/index.js +4 -0
  76. package/dist/enquiry-form/provider.d.ts +3 -0
  77. package/dist/enquiry-form/provider.js +9 -0
  78. package/dist/enquiry-form/serialization.d.ts +4 -0
  79. package/dist/enquiry-form/serialization.js +57 -0
  80. package/dist/enquiry-form/types.d.ts +38 -0
  81. package/dist/enquiry-form/types.js +1 -0
  82. package/dist/enquiry-form/validation.d.ts +6 -0
  83. package/dist/enquiry-form/validation.js +21 -0
  84. package/dist/index.d.ts +9 -0
  85. package/dist/index.js +7 -0
  86. package/dist/lib/templateUtils.d.ts +3 -0
  87. package/dist/lib/templateUtils.js +28 -0
  88. package/dist/react/ThemeProvider.d.ts +18 -0
  89. package/dist/react/ThemeProvider.js +45 -0
  90. package/dist/react/hooks/useTheme.d.ts +1 -0
  91. package/dist/react/hooks/useTheme.js +1 -0
  92. package/dist/react/index.d.ts +5 -0
  93. package/dist/react/index.js +3 -0
  94. package/dist/services/AppointmentService.d.ts +4 -5
  95. package/dist/services/AppointmentService.js +12 -10
  96. package/dist/services/EnquiryService.d.ts +5 -0
  97. package/dist/services/EnquiryService.js +30 -0
  98. package/dist/templates/registry.d.ts +12 -0
  99. package/dist/templates/registry.js +58 -0
  100. package/dist/vanilla/AppointmentCalendarWidget.d.ts +2 -34
  101. package/dist/vanilla/AppointmentCalendarWidget.js +264 -275
  102. package/dist/vanilla/EnquiryFormWidget.d.ts +35 -0
  103. package/dist/vanilla/EnquiryFormWidget.js +425 -0
  104. package/dist/vanilla/client/MedosClient.d.ts +3 -5
  105. package/dist/vanilla/components/AppointmentCalender.d.ts +1 -4
  106. package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +14 -0
  107. package/dist/vanilla/components/ConfigurableCard.d.ts +12 -0
  108. package/dist/vanilla/components/ContactInformationStep.d.ts +13 -0
  109. package/dist/vanilla/components/ContactPreferenceStep.d.ts +9 -0
  110. package/dist/vanilla/components/DoctorSelectModal.d.ts +7 -0
  111. package/dist/vanilla/components/EnquiryForm.d.ts +7 -0
  112. package/dist/vanilla/components/Icons/Check.d.ts +6 -0
  113. package/dist/vanilla/components/Icons/ChevronDownIcon.d.ts +4 -0
  114. package/dist/vanilla/components/Icons/ChevronLeft.d.ts +3 -0
  115. package/dist/vanilla/components/Icons/ChevronRight.d.ts +3 -0
  116. package/dist/vanilla/components/Icons/ConfirmationCheck.d.ts +1 -0
  117. package/dist/vanilla/components/Icons/ConsultationType.d.ts +1 -0
  118. package/dist/vanilla/components/Icons/Date&TimeIcon.d.ts +1 -0
  119. package/dist/vanilla/components/Icons/MapIcon.d.ts +1 -0
  120. package/dist/vanilla/components/Icons/PaymentMethodIcon.d.ts +1 -0
  121. package/dist/vanilla/components/Icons/UserIcon.d.ts +1 -0
  122. package/dist/vanilla/components/InquiryDetailsStep.d.ts +10 -0
  123. package/dist/vanilla/components/PatientDetailsStep.d.ts +3 -0
  124. package/dist/vanilla/components/PhoneVerificationStep.d.ts +3 -0
  125. package/dist/vanilla/components/SuccessStep.d.ts +5 -0
  126. package/dist/vanilla/components/custom-calendar.d.ts +5 -0
  127. package/dist/vanilla/components/styles.d.ts +6 -0
  128. package/dist/vanilla/components/theme-styles.d.ts +12 -0
  129. package/dist/vanilla/components/types.d.ts +181 -0
  130. package/dist/vanilla/components/ui/select.d.ts +10 -0
  131. package/dist/vanilla/components/uiComponents/SelectDropdown.d.ts +41 -0
  132. package/dist/vanilla/components/utils.d.ts +5 -0
  133. package/dist/vanilla/components/validation.d.ts +2 -0
  134. package/dist/vanilla/context/TemplateContext.d.ts +12 -0
  135. package/dist/vanilla/core/index.d.ts +4 -0
  136. package/dist/vanilla/core/theme/index.d.ts +3 -0
  137. package/dist/vanilla/core/theme/themes.d.ts +8 -0
  138. package/dist/vanilla/core/theme/types.d.ts +106 -0
  139. package/dist/vanilla/core/theme/utils.d.ts +8 -0
  140. package/dist/vanilla/enquiry-form/index.d.ts +4 -0
  141. package/dist/vanilla/enquiry-form/provider.d.ts +3 -0
  142. package/dist/vanilla/enquiry-form/serialization.d.ts +4 -0
  143. package/dist/vanilla/enquiry-form/types.d.ts +38 -0
  144. package/dist/vanilla/enquiry-form/validation.d.ts +6 -0
  145. package/dist/vanilla/enquiry-widget.js +4650 -0
  146. package/dist/vanilla/index.d.ts +9 -0
  147. package/dist/vanilla/index.js +3 -1
  148. package/dist/vanilla/lib/templateUtils.d.ts +3 -0
  149. package/dist/vanilla/react/ThemeProvider.d.ts +18 -0
  150. package/dist/vanilla/react/hooks/useTheme.d.ts +1 -0
  151. package/dist/vanilla/react/index.d.ts +5 -0
  152. package/dist/vanilla/services/AppointmentService.d.ts +4 -5
  153. package/dist/vanilla/services/EnquiryService.d.ts +5 -0
  154. package/dist/vanilla/templates/alternative.css +13 -0
  155. package/dist/vanilla/templates/default.css +13 -0
  156. package/dist/vanilla/templates/registry.d.ts +12 -0
  157. package/dist/vanilla/theme-injector.d.ts +6 -0
  158. package/dist/vanilla/theme-injector.js +44 -0
  159. package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +2 -34
  160. package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +35 -0
  161. package/dist/vanilla/vanilla/index.d.ts +3 -1
  162. package/dist/vanilla/vanilla/theme-injector.d.ts +6 -0
  163. package/dist/vanilla/vanilla/widget.d.ts +6 -1
  164. package/dist/vanilla/widget.css +173 -0
  165. package/dist/vanilla/widget.d.ts +6 -1
  166. package/dist/vanilla/widget.js +813 -288
  167. package/package.json +9 -4
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Slot } from "../services/AppointmentService";
3
+ export type AppointmentMode = "ONLINE" | "OFFLINE";
4
+ export type PaymentMode = "CASH" | "CARD" | "UPI";
5
+ type AppointmentModalProps = {
6
+ onlineFee?: number | null;
7
+ offlineFee?: number | null;
8
+ slots: Slot[];
9
+ onCancel: () => void;
10
+ onContinue: (mode: AppointmentMode, date: Date, slot: Slot, charge: string, paymentMode: PaymentMode) => void;
11
+ onDateChange?: (date: Date) => void;
12
+ };
13
+ export declare const AppointmentDateTimeModal: React.FC<AppointmentModalProps>;
14
+ export {};
@@ -0,0 +1,220 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState, useCallback, useMemo } from "react";
3
+ import { CustomCalendarWithDateSelector } from "./custom-calendar";
4
+ import { PaymentMethodIcon } from "./Icons/PaymentMethodIcon";
5
+ import { DateTimeIcon } from "./Icons/Date&TimeIcon";
6
+ import { ConsultationTypeIcon } from "./Icons/ConsultationType";
7
+ import { useTheme } from "../react/hooks/useTheme";
8
+ const MONTHS = [
9
+ "January",
10
+ "February",
11
+ "March",
12
+ "April",
13
+ "May",
14
+ "June",
15
+ "July",
16
+ "August",
17
+ "September",
18
+ "October",
19
+ "November",
20
+ "December",
21
+ ];
22
+ const getOrdinalSuffix = (day) => {
23
+ if (day > 3 && day < 21)
24
+ return "th";
25
+ switch (day % 10) {
26
+ case 1:
27
+ return "st";
28
+ case 2:
29
+ return "nd";
30
+ case 3:
31
+ return "rd";
32
+ default:
33
+ return "th";
34
+ }
35
+ };
36
+ const formatDate = (date) => {
37
+ const day = date.getDate();
38
+ const month = MONTHS[date.getMonth()];
39
+ const year = date.getFullYear();
40
+ return `${day}${getOrdinalSuffix(day)} ${month} ${year}`;
41
+ };
42
+ export const AppointmentDateTimeModal = ({ onlineFee, offlineFee, slots, onCancel, onContinue, onDateChange, }) => {
43
+ const theme = useTheme();
44
+ const [mode, setMode] = useState("OFFLINE");
45
+ const [consultationCharge, setConsultationCharge] = useState("");
46
+ const [paymentMode, setPaymentMode] = useState("CASH");
47
+ const [selectedDate, setSelectedDate] = useState(new Date());
48
+ const [selectedSlot, setSelectedSlot] = useState(null);
49
+ const handleDateSelect = useCallback((date) => {
50
+ setSelectedDate(date);
51
+ setSelectedSlot(null);
52
+ onDateChange?.(date);
53
+ }, [onDateChange]);
54
+ useEffect(() => {
55
+ const charge = mode === "ONLINE" && onlineFee
56
+ ? String(onlineFee)
57
+ : mode === "OFFLINE" && offlineFee
58
+ ? String(offlineFee)
59
+ : "";
60
+ setConsultationCharge(charge);
61
+ }, [mode, onlineFee, offlineFee]);
62
+ const handleContinue = useCallback(() => {
63
+ if (!selectedSlot)
64
+ return;
65
+ onContinue(mode, selectedDate, selectedSlot, consultationCharge, paymentMode);
66
+ }, [
67
+ mode,
68
+ selectedDate,
69
+ selectedSlot,
70
+ consultationCharge,
71
+ paymentMode,
72
+ onContinue,
73
+ ]);
74
+ const isSlotSelected = useCallback((slot) => selectedSlot?.start === slot.start && selectedSlot?.end === slot.end, [selectedSlot]);
75
+ const formattedDate = useMemo(() => formatDate(selectedDate), [selectedDate]);
76
+ const isFormValid = selectedDate && selectedSlot && consultationCharge;
77
+ const STYLES = getStyles(theme);
78
+ return (_jsxs("div", { style: STYLES.modalWrapper, children: [_jsx(ConsultationTypeSection, { mode: mode, onlineFee: onlineFee, offlineFee: offlineFee, onModeChange: setMode, STYLES: STYLES }), _jsx(ChargesSection, { charge: consultationCharge, STYLES: STYLES }), _jsx(DateTimeSection, { selectedDate: selectedDate, formattedDate: formattedDate, slots: slots, selectedSlot: selectedSlot, onDateSelect: handleDateSelect, onSlotSelect: setSelectedSlot, isSlotSelected: isSlotSelected, STYLES: STYLES }), _jsx(FooterSection, { onCancel: onCancel, onContinue: handleContinue, isValid: !!isFormValid, STYLES: STYLES })] }));
79
+ };
80
+ const ConsultationTypeSection = ({ mode, onlineFee, offlineFee, onModeChange, STYLES }) => (_jsxs("div", { style: STYLES.sectionCard, children: [_jsxs("div", { style: STYLES.sectionHeader, children: [_jsx(ConsultationTypeIcon, {}), _jsx("span", { style: STYLES.sectionTitle, children: "Consultation Type" })] }), _jsxs("div", { style: STYLES.sectionBody, children: [_jsx("p", { style: STYLES.label, children: "Consultation Mode" }), _jsx("div", { style: STYLES.modeContainer, children: ["ONLINE", "OFFLINE"].map((item) => {
81
+ const disabled = (item === "ONLINE" && (!onlineFee || onlineFee <= 0)) ||
82
+ (item === "OFFLINE" && (!offlineFee || offlineFee <= 0));
83
+ return (_jsxs("label", { style: { ...STYLES.radioLabel, opacity: disabled ? 0.5 : 1 }, children: [_jsx("input", { type: "radio", name: "mode", value: item, checked: mode === item, disabled: disabled, onChange: () => !disabled && onModeChange(item), style: STYLES.radioInput }), item === "ONLINE" ? "Online" : "Offline"] }, item));
84
+ }) })] })] }));
85
+ const ChargesSection = ({ charge, STYLES }) => (_jsxs("div", { style: STYLES.sectionCard, children: [_jsxs("div", { style: STYLES.sectionHeader, children: [_jsx(PaymentMethodIcon, {}), _jsx("span", { style: STYLES.sectionTitle, children: "Charges & Mode of Payment" })] }), _jsx("div", { style: STYLES.sectionBody, children: _jsxs("span", { style: STYLES.rupee, children: ["\u20B9 ", charge] }) })] }));
86
+ const DateTimeSection = ({ selectedDate, formattedDate, slots, selectedSlot, onDateSelect, onSlotSelect, isSlotSelected, STYLES, }) => (_jsxs("div", { style: STYLES.sectionCard, children: [_jsxs("div", { style: STYLES.sectionHeader, children: [_jsx(DateTimeIcon, {}), _jsx("span", { style: STYLES.sectionTitle, children: "Date & Time" })] }), _jsx("div", { style: STYLES.sectionBody, children: _jsxs("div", { style: STYLES.dateTimeContainer, children: [_jsx("div", { style: STYLES.calendarBox, children: _jsx(CustomCalendarWithDateSelector, { selectedDate: selectedDate, onSelect: onDateSelect, pastDisabled: true }) }), _jsxs("div", { style: STYLES.timesContainer, children: [_jsxs("p", { style: STYLES.timesLabel, children: ["Available times ", _jsx("br", {}), _jsx("span", { style: STYLES.dateLabel, children: formattedDate })] }), slots.length === 0 ? (_jsx("p", { style: STYLES.noSlots, children: "No available slots" })) : (_jsx("div", { style: STYLES.slotGrid, children: slots.map((slot) => (_jsx(SlotButton, { slot: slot, isSelected: isSlotSelected(slot), onSelect: onSlotSelect }, slot.id))) }))] })] }) })] }));
87
+ const SlotButton = ({ slot, isSelected, onSelect }) => {
88
+ const startTime = useMemo(() => new Date(slot.start).toLocaleTimeString([], {
89
+ hour: "2-digit",
90
+ minute: "2-digit",
91
+ }), [slot.start]);
92
+ const theme = useTheme();
93
+ const STYLES = getStyles(theme);
94
+ return (_jsx("button", { onClick: () => onSelect(slot), style: {
95
+ ...STYLES.slotButton,
96
+ background: isSelected
97
+ ? theme.colors.secondary
98
+ : theme.colors.background,
99
+ color: isSelected
100
+ ? theme.colors.textOnSecondary
101
+ : theme.colors.secondary,
102
+ borderColor: theme.colors.secondary,
103
+ }, children: startTime }));
104
+ };
105
+ const FooterSection = ({ onCancel, onContinue, isValid, STYLES }) => (_jsxs("div", { style: STYLES.footer, children: [_jsx("button", { style: STYLES.backBtn, onClick: onCancel, children: "Back" }), _jsx("button", { style: { ...STYLES.continueBtn, opacity: isValid ? 1 : 0.6 }, onClick: onContinue, disabled: !isValid, children: "Continue" })] }));
106
+ const getStyles = (theme) => ({
107
+ modalWrapper: {
108
+ backgroundColor: theme.colors.background,
109
+ borderRadius: theme.radii.lg,
110
+ padding: "20px 24px 24px 24px",
111
+ maxWidth: 800,
112
+ margin: "0 auto",
113
+ fontFamily: theme.typography.fontFamily,
114
+ color: theme.colors.text,
115
+ boxSizing: "border-box",
116
+ },
117
+ sectionCard: {
118
+ border: `1px solid ${theme.colors.border}`,
119
+ borderRadius: theme.radii.lg,
120
+ marginBottom: 20,
121
+ position: "relative",
122
+ },
123
+ sectionHeader: {
124
+ background: theme.colors.primary,
125
+ color: theme.colors.textOnPrimary,
126
+ borderBottom: `1px solid ${theme.colors.border}`,
127
+ padding: "12px 16px",
128
+ display: "flex",
129
+ alignItems: "center",
130
+ gap: 8,
131
+ },
132
+ sectionTitle: { fontSize: 15, fontWeight: 600 },
133
+ sectionBody: { padding: 16, position: "relative" },
134
+ label: {
135
+ fontSize: 14,
136
+ fontWeight: 500,
137
+ marginBottom: 4,
138
+ display: "block",
139
+ },
140
+ modeContainer: {
141
+ display: "flex",
142
+ gap: 24,
143
+ marginTop: 4,
144
+ },
145
+ radioLabel: {
146
+ display: "flex",
147
+ alignItems: "center",
148
+ gap: 8,
149
+ cursor: "pointer",
150
+ fontSize: 14,
151
+ },
152
+ radioInput: {
153
+ width: 18,
154
+ height: 18,
155
+ accentColor: theme.colors.secondary,
156
+ cursor: "pointer",
157
+ },
158
+ rupee: {
159
+ fontWeight: 600,
160
+ fontSize: 16,
161
+ marginRight: 6,
162
+ },
163
+ dateTimeContainer: { display: "flex", gap: 24 },
164
+ calendarBox: {
165
+ border: `1px solid ${theme.colors.border}`,
166
+ borderRadius: theme.radii.lg,
167
+ padding: 8,
168
+ },
169
+ timesContainer: { flexGrow: 1 },
170
+ timesLabel: { fontWeight: 500 },
171
+ dateLabel: {
172
+ color: theme.colors.textSecondary,
173
+ fontSize: 13,
174
+ },
175
+ noSlots: {
176
+ color: theme.colors.textSecondary,
177
+ fontSize: 14,
178
+ marginTop: 8,
179
+ },
180
+ slotGrid: {
181
+ display: "grid",
182
+ gridTemplateColumns: "repeat(auto-fit,minmax(100px,1fr))",
183
+ gap: 8,
184
+ marginTop: 12,
185
+ },
186
+ slotButton: {
187
+ borderRadius: theme.radii.md,
188
+ padding: "8px 10px",
189
+ border: `1px solid ${theme.colors.secondary}`,
190
+ fontSize: 13,
191
+ fontWeight: 500,
192
+ cursor: "pointer",
193
+ transition: "0.2s",
194
+ },
195
+ footer: {
196
+ display: "flex",
197
+ justifyContent: "flex-end",
198
+ alignItems: "center",
199
+ marginTop: 20,
200
+ gap: 12,
201
+ },
202
+ backBtn: {
203
+ border: `1px solid ${theme.colors.primary}`,
204
+ background: theme.colors.background,
205
+ color: theme.colors.primary,
206
+ borderRadius: theme.radii.md,
207
+ fontWeight: 600,
208
+ padding: "8px 20px",
209
+ cursor: "pointer",
210
+ },
211
+ continueBtn: {
212
+ background: theme.colors.secondary,
213
+ color: theme.colors.textOnSecondary,
214
+ border: "none",
215
+ borderRadius: theme.radii.md,
216
+ fontWeight: 600,
217
+ padding: "8px 20px",
218
+ cursor: "pointer",
219
+ },
220
+ });
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type ConfigurableCardProps = {
3
+ title: string;
4
+ subtitle?: string;
5
+ content?: React.ReactNode;
6
+ ctaLabel?: string;
7
+ onCta?: () => void;
8
+ variant?: "filled" | "outline";
9
+ className?: string;
10
+ };
11
+ export declare const ConfigurableCard: React.FC<ConfigurableCardProps>;
12
+ export default ConfigurableCard;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTemplate } from "../context/TemplateContext";
3
+ export const ConfigurableCard = ({ title, subtitle, content, ctaLabel = "Action", onCta, variant = "outline", className, }) => {
4
+ useTemplate();
5
+ const filled = variant === "filled";
6
+ const containerStyle = {
7
+ background: filled
8
+ ? "var(--medos-primary-color)"
9
+ : "var(--medos-background-color)",
10
+ color: filled ? "#fff" : "var(--medos-text-color)",
11
+ border: filled ? "none" : "1px solid var(--medos-border-color)",
12
+ padding: 16,
13
+ borderRadius: 10,
14
+ boxShadow: "0 6px 18px rgba(16,24,40,0.06)",
15
+ };
16
+ const ctaStyle = {
17
+ padding: "8px 12px",
18
+ borderRadius: 8,
19
+ background: filled
20
+ ? "rgba(255,255,255,0.12)"
21
+ : "var(--medos-primary-color)",
22
+ color: "#fff",
23
+ border: "none",
24
+ cursor: "pointer",
25
+ fontWeight: 600,
26
+ };
27
+ return (_jsxs("div", { className: className, style: containerStyle, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 8 }, children: [_jsxs("div", { children: [_jsx("div", { style: { fontSize: 16, fontWeight: 700 }, children: title }), subtitle && (_jsx("div", { style: { fontSize: 13, opacity: 0.95, marginTop: 4 }, children: subtitle }))] }), _jsx("div", { style: { display: "flex", alignItems: "center" }, children: _jsx("button", { style: ctaStyle, onClick: onCta, "aria-label": ctaLabel, children: ctaLabel }) })] }), content && _jsx("div", { style: { marginTop: 12 }, children: content })] }));
28
+ };
29
+ export default ConfigurableCard;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ export interface ContactInformationStepProps {
3
+ patientName: string;
4
+ patientEmail: string;
5
+ countryCode: string;
6
+ patientPhone: string;
7
+ onNameChange: (value: string) => void;
8
+ onEmailChange: (value: string) => void;
9
+ onCountryCodeChange: (value: string) => void;
10
+ onPhoneChange: (value: string) => void;
11
+ onNext: () => void;
12
+ }
13
+ export declare const ContactInformationStep: React.FC<ContactInformationStepProps>;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "../react/hooks/useTheme";
3
+ import { getContainerStyles, getPhoneVerifyStyles, getButtonStyles, } from "./theme-styles";
4
+ export const ContactInformationStep = ({ patientName, patientEmail, countryCode, patientPhone, onNameChange, onEmailChange, onCountryCodeChange, onPhoneChange, onNext, }) => {
5
+ const theme = useTheme();
6
+ const PHONE_VERIFY_STYLES = getPhoneVerifyStyles(theme);
7
+ const BUTTON_STYLES = getButtonStyles(theme);
8
+ const CONTAINER_STYLES = getContainerStyles(theme);
9
+ return (_jsxs("div", { children: [_jsxs("div", { style: { marginBottom: "16px" }, children: [_jsx("label", { style: PHONE_VERIFY_STYLES.label, children: "Name" }), _jsx("input", { type: "text", value: patientName, onChange: (e) => onNameChange(e.target.value), placeholder: "Enter your full name", style: PHONE_VERIFY_STYLES.phoneInput })] }), _jsxs("div", { style: { marginBottom: "16px" }, children: [_jsx("label", { style: PHONE_VERIFY_STYLES.label, children: "Email" }), _jsx("input", { type: "email", value: patientEmail, onChange: (e) => onEmailChange(e.target.value), placeholder: "Enter your email", style: PHONE_VERIFY_STYLES.phoneInput })] }), _jsxs("div", { style: { marginBottom: "16px" }, children: [_jsx("label", { style: PHONE_VERIFY_STYLES.label, children: "Phone Number" }), _jsxs("div", { style: PHONE_VERIFY_STYLES.phoneInputContainer, children: [_jsx("input", { type: "text", value: countryCode, onChange: (e) => onCountryCodeChange(e.target.value), placeholder: "+91", style: {
10
+ ...PHONE_VERIFY_STYLES.phoneInput,
11
+ width: "80px",
12
+ flex: "none",
13
+ } }), _jsx("input", { type: "tel", value: patientPhone, onChange: (e) => onPhoneChange(e.target.value), placeholder: "Enter phone number", style: PHONE_VERIFY_STYLES.phoneInput })] })] }), _jsx("div", { style: CONTAINER_STYLES.actions, children: _jsx("button", { onClick: onNext, style: BUTTON_STYLES.primary, children: "Next" }) })] }));
14
+ };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export interface ContactPreferenceStepProps {
3
+ preferredContactMethod: "PHONE" | "EMAIL" | "BOTH";
4
+ onContactMethodChange: (method: "PHONE" | "EMAIL" | "BOTH") => void;
5
+ onBack: () => void;
6
+ onSubmit: () => void;
7
+ isLoading?: boolean;
8
+ }
9
+ export declare const ContactPreferenceStep: React.FC<ContactPreferenceStepProps>;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from "../react/hooks/useTheme";
3
+ import { getPhoneVerifyStyles, getButtonStyles, getContainerStyles, } from "./theme-styles";
4
+ export const ContactPreferenceStep = ({ preferredContactMethod, onContactMethodChange, onBack, onSubmit, isLoading = false, }) => {
5
+ const theme = useTheme();
6
+ const PHONE_VERIFY_STYLES = getPhoneVerifyStyles(theme);
7
+ const BUTTON_STYLES = getButtonStyles(theme);
8
+ const CONTAINER_STYLES = getContainerStyles(theme);
9
+ return (_jsxs("div", { children: [_jsxs("div", { style: { marginBottom: "16px" }, children: [_jsx("label", { style: PHONE_VERIFY_STYLES.label, children: "Preferred Contact Method" }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "PHONE", checked: preferredContactMethod === "PHONE", onChange: (e) => onContactMethodChange(e.target.value) }), "Phone"] }), _jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "EMAIL", checked: preferredContactMethod === "EMAIL", onChange: (e) => onContactMethodChange(e.target.value) }), "Email"] }), _jsxs("label", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [_jsx("input", { type: "radio", name: "contactMethod", value: "BOTH", checked: preferredContactMethod === "BOTH", onChange: (e) => onContactMethodChange(e.target.value) }), "Both"] })] })] }), _jsxs("div", { style: CONTAINER_STYLES.actions, children: [_jsx("button", { onClick: onBack, style: BUTTON_STYLES.secondary, children: "Back" }), _jsx("button", { onClick: onSubmit, disabled: isLoading, style: {
10
+ ...BUTTON_STYLES.primary,
11
+ backgroundColor: isLoading
12
+ ? "#ccc"
13
+ : BUTTON_STYLES.primary.backgroundColor,
14
+ cursor: isLoading ? "not-allowed" : "pointer",
15
+ }, children: isLoading ? "Submitting..." : "Submit" })] })] }));
16
+ };
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ type DoctorSelectModalProps = {
3
+ onCancel: () => void;
4
+ onContinue: (addressId: number, doctorId: number, notes?: string) => void;
5
+ };
6
+ export declare const DoctorSelectModal: React.FC<DoctorSelectModalProps>;
7
+ export {};
@@ -0,0 +1,93 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { AppointmentService, } from "../services/AppointmentService";
4
+ import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, } from "./uiComponents/SelectDropdown";
5
+ import { useTheme } from "../react/hooks/useTheme";
6
+ export const DoctorSelectModal = ({ onCancel, onContinue, }) => {
7
+ const theme = useTheme();
8
+ const [addresses, setAddresses] = useState([]);
9
+ const [addressDoctorsMap, setAddressDoctorsMap] = useState({});
10
+ const [selectedAddressId, setSelectedAddressId] = useState("");
11
+ const [selectedDoctorId, setSelectedDoctorId] = useState("");
12
+ const [appointmentNotes, setAppointmentNotes] = useState("");
13
+ useEffect(() => {
14
+ (async () => {
15
+ const res = await AppointmentService.getAddresses();
16
+ const map = {};
17
+ res.addresses.forEach((addr) => {
18
+ map[addr.id] = addr.doctors || [];
19
+ });
20
+ setAddresses(res.addresses);
21
+ setAddressDoctorsMap(map);
22
+ })();
23
+ }, []);
24
+ const doctorsForAddress = selectedAddressId
25
+ ? addressDoctorsMap[Number(selectedAddressId)] || []
26
+ : [];
27
+ const canContinue = !!selectedAddressId && !!selectedDoctorId;
28
+ const styles = getStyles(theme);
29
+ return (_jsx("div", { style: {
30
+ border: `1px solid ${theme.colors.border}`,
31
+ borderRadius: "2px",
32
+ }, children: _jsxs("div", { style: styles.modalWrapper, children: [_jsx("div", { style: styles.headerWrapper, children: _jsx("h3", { style: styles.title, children: "Location & Doctor" }) }), _jsx("div", { style: { borderBottom: `1px solid ${theme.colors.border}` } }), _jsxs("div", { style: styles.contentWrapper, children: [_jsxs("div", { style: styles.fieldGroup, children: [_jsxs("label", { style: styles.label, children: ["Preferred Location ", _jsx("span", { style: styles.mandatory, children: "*" })] }), _jsxs(Select, { value: selectedAddressId, onValueChange: (value) => {
33
+ setSelectedAddressId(value);
34
+ setSelectedDoctorId("");
35
+ }, children: [_jsx(SelectTrigger, { style: { width: "100%" }, children: _jsx(SelectValue, { placeholder: "Select Address" }) }), _jsx(SelectContent, { children: addresses.map((a) => (_jsx(SelectItem, { value: String(a.id), children: a.completeAddress || a.label || `Address ${a.id}` }, a.id))) })] })] }), _jsxs("div", { style: styles.fieldGroup, children: [_jsxs("label", { style: styles.label, children: ["Preferred Doctor ", _jsx("span", { style: styles.mandatory, children: "*" })] }), _jsxs(Select, { value: selectedDoctorId, onValueChange: setSelectedDoctorId, disabled: !selectedAddressId, children: [_jsx(SelectTrigger, { style: { width: "100%" }, children: _jsx(SelectValue, { placeholder: "Select Doctor" }) }), _jsx(SelectContent, { children: doctorsForAddress.length > 0 ? (doctorsForAddress.map((d) => (_jsxs(SelectItem, { value: String(d.id), children: [d.name, " ", d.specialty ? `- ${d.specialty}` : ""] }, d.id)))) : (_jsx(SelectItem, { value: "no-doctors", disabled: true, children: "No doctors available" })) })] })] }), _jsxs("div", { style: styles.fieldGroup, children: [_jsxs("label", { style: styles.label, children: ["Chief Complaint ", _jsx("span", { style: styles.optional, children: "(optional)" })] }), _jsx("textarea", { style: styles.textarea, placeholder: "Enter Chief Complaint or Appointment Notes", value: appointmentNotes, onChange: (e) => setAppointmentNotes(e.target.value) })] }), _jsx("div", { style: styles.footer, children: _jsx("button", { style: {
36
+ ...styles.continueBtn,
37
+ opacity: canContinue ? 1 : 0.6,
38
+ }, disabled: !canContinue, onClick: () => onContinue(Number(selectedAddressId), Number(selectedDoctorId), appointmentNotes), children: "Next" }) })] })] }) }));
39
+ };
40
+ const getStyles = (theme) => ({
41
+ modalWrapper: {
42
+ backgroundColor: theme.colors.background,
43
+ borderRadius: 12,
44
+ maxWidth: 840,
45
+ margin: "0 auto",
46
+ fontFamily: theme.typography.fontFamily,
47
+ color: theme.colors.text,
48
+ },
49
+ headerWrapper: {
50
+ padding: "20px 24px 10px 24px",
51
+ },
52
+ contentWrapper: {
53
+ padding: "20px 24px 0px 24px",
54
+ },
55
+ title: { fontSize: 20, fontWeight: 600, margin: 0 },
56
+ fieldGroup: { marginBottom: 18 },
57
+ label: { fontSize: 15, fontWeight: 500, marginBottom: 6, display: "block" },
58
+ mandatory: { color: theme.colors.error, marginLeft: 4 },
59
+ optional: {
60
+ color: theme.colors.textSecondary,
61
+ fontWeight: 400,
62
+ marginLeft: 4,
63
+ fontSize: 13,
64
+ },
65
+ textarea: {
66
+ width: "100%",
67
+ border: `1px solid ${theme.colors.border}`,
68
+ borderRadius: theme.radii.md,
69
+ minHeight: 80,
70
+ padding: "10px",
71
+ fontSize: 14,
72
+ resize: "vertical",
73
+ boxSizing: "border-box",
74
+ },
75
+ footer: {
76
+ marginTop: 24,
77
+ marginBottom: 10,
78
+ display: "flex",
79
+ justifyContent: "flex-end",
80
+ alignItems: "center",
81
+ gap: 10,
82
+ },
83
+ brand: { color: theme.colors.primary, fontWeight: 600 },
84
+ continueBtn: {
85
+ background: theme.colors.secondary,
86
+ color: theme.colors.textOnSecondary,
87
+ border: "none",
88
+ borderRadius: theme.radii.md,
89
+ fontWeight: 600,
90
+ padding: "8px 22px",
91
+ cursor: "pointer",
92
+ },
93
+ });
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { EnquirySubmission } from "../enquiry-form/types";
3
+ export interface EnquiryFormProps {
4
+ onSuccess?: (enquiry: EnquirySubmission) => void;
5
+ onError?: (error: Error) => void;
6
+ }
7
+ export declare const EnquiryForm: React.FC<EnquiryFormProps>;