@dialiq/calendar-component 1.1.2 → 1.1.3
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/BookingDetailsModal.d.ts +3 -0
- package/dist/BookingDetailsModal.d.ts.map +1 -1
- package/dist/Calendar.d.ts.map +1 -1
- package/dist/api.d.ts +3 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/index.esm.js +46 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7400,6 +7400,17 @@ const getMeetingDetails = (businessId, meetingId, timezone, apiBaseUrl) => __awa
|
|
|
7400
7400
|
}
|
|
7401
7401
|
return response.json();
|
|
7402
7402
|
});
|
|
7403
|
+
const deleteMeeting = (businessId, meetingId, apiBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7404
|
+
const baseUrl = apiBaseUrl || getBaseUrl();
|
|
7405
|
+
const response = yield fetch(`${baseUrl}/businesses/${businessId}/meetings/${meetingId}`, {
|
|
7406
|
+
method: 'DELETE',
|
|
7407
|
+
});
|
|
7408
|
+
if (!response.ok) {
|
|
7409
|
+
const error = yield response.json();
|
|
7410
|
+
throw new Error(error.error || 'Failed to delete meeting');
|
|
7411
|
+
}
|
|
7412
|
+
return response.json();
|
|
7413
|
+
});
|
|
7403
7414
|
|
|
7404
7415
|
function styleInject(css, ref) {
|
|
7405
7416
|
if ( ref === void 0 ) ref = {};
|
|
@@ -7541,20 +7552,48 @@ const CreateBookingModal = ({ businessId, apiBaseUrl, initialDate, participants:
|
|
|
7541
7552
|
React.createElement("button", { type: "submit", className: "modal-btn modal-btn-primary", disabled: loading }, loading ? 'Creating...' : 'Create Booking'))))));
|
|
7542
7553
|
};
|
|
7543
7554
|
|
|
7544
|
-
var css_248z$1 = "/* BookingDetailsModal - extends base modal styles from CreateBookingModal.css */\
|
|
7555
|
+
var css_248z$1 = "/* BookingDetailsModal - extends base modal styles from CreateBookingModal.css */\n\n.booking-details-modal {\n max-width: 500px;\n}\n\n.detail-section {\n padding: 12px 0;\n border-bottom: 1px solid #e9ecef;\n}\n\n.detail-section:last-child {\n border-bottom: none;\n}\n\n.detail-row {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n margin-bottom: 8px;\n}\n\n.detail-row:last-child {\n margin-bottom: 0;\n}\n\n.detail-row.full-width {\n flex-direction: column;\n}\n\n.detail-label {\n font-weight: 500;\n color: #6c757d;\n font-size: 14px;\n min-width: 100px;\n}\n\n.detail-label-muted {\n color: #adb5bd;\n font-size: 12px;\n}\n\n.detail-value {\n font-weight: 500;\n color: #212529;\n font-size: 14px;\n text-align: right;\n}\n\n.detail-value-muted {\n color: #adb5bd;\n font-size: 12px;\n font-family: monospace;\n}\n\n.detail-description {\n margin: 8px 0 0 0;\n color: #495057;\n font-size: 14px;\n line-height: 1.5;\n white-space: pre-wrap;\n}\n\n.participants-list {\n margin: 8px 0 0 0;\n padding-left: 20px;\n list-style-type: disc;\n}\n\n.participant-item {\n color: #495057;\n font-size: 14px;\n margin-bottom: 4px;\n}\n\n.modal-header-actions {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.modal-delete-btn {\n background: none;\n border: none;\n color: #dc3545;\n cursor: pointer;\n padding: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n transition: background-color 0.2s;\n}\n\n.modal-delete-btn:hover:not(:disabled) {\n background: #f8d7da;\n}\n\n.modal-delete-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.delete-confirm-box {\n background: #fff3cd;\n border: 1px solid #ffc107;\n border-radius: 4px;\n padding: 16px;\n margin-bottom: 16px;\n}\n\n.delete-confirm-box p {\n margin: 0 0 12px 0;\n font-size: 14px;\n color: #856404;\n}\n\n.delete-confirm-actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n}\n\n.modal-btn-danger {\n background: #dc3545;\n color: #ffffff;\n}\n\n.modal-btn-danger:hover:not(:disabled) {\n background: #bb2d3b;\n}\n\n@media (max-width: 576px) {\n .booking-details-modal {\n max-width: 100%;\n }\n\n .detail-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .detail-value {\n text-align: left;\n }\n}\n";
|
|
7545
7556
|
styleInject(css_248z$1);
|
|
7546
7557
|
|
|
7547
|
-
const BookingDetailsModal = ({ booking, timezone, onClose, }) => {
|
|
7558
|
+
const BookingDetailsModal = ({ booking, timezone, businessId, apiBaseUrl, onClose, onBookingDeleted, }) => {
|
|
7548
7559
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7560
|
+
const [showConfirm, setShowConfirm] = React.useState(false);
|
|
7561
|
+
const [deleting, setDeleting] = React.useState(false);
|
|
7562
|
+
const [error, setError] = React.useState(null);
|
|
7549
7563
|
const startMoment = moment$1(booking.start).tz(timezone);
|
|
7550
7564
|
const endMoment = moment$1(booking.end).tz(timezone);
|
|
7551
7565
|
const durationMinutes = endMoment.diff(startMoment, 'minutes');
|
|
7566
|
+
const handleDelete = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7567
|
+
setDeleting(true);
|
|
7568
|
+
setError(null);
|
|
7569
|
+
try {
|
|
7570
|
+
yield deleteMeeting(businessId, booking.meeting_id, apiBaseUrl);
|
|
7571
|
+
onBookingDeleted();
|
|
7572
|
+
}
|
|
7573
|
+
catch (err) {
|
|
7574
|
+
setError(err instanceof Error ? err.message : 'Failed to delete meeting');
|
|
7575
|
+
setDeleting(false);
|
|
7576
|
+
}
|
|
7577
|
+
});
|
|
7552
7578
|
return (React.createElement("div", { className: "modal-overlay", onClick: onClose },
|
|
7553
7579
|
React.createElement("div", { className: "modal-content booking-details-modal", onClick: (e) => e.stopPropagation() },
|
|
7554
7580
|
React.createElement("div", { className: "modal-header" },
|
|
7555
7581
|
React.createElement("h3", null, ((_a = booking.metadata) === null || _a === void 0 ? void 0 : _a.title) || 'Untitled Booking'),
|
|
7556
|
-
React.createElement("
|
|
7582
|
+
React.createElement("div", { className: "modal-header-actions" },
|
|
7583
|
+
React.createElement("button", { className: "modal-delete-btn", onClick: () => setShowConfirm(true), title: "Delete meeting", disabled: deleting },
|
|
7584
|
+
React.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
7585
|
+
React.createElement("polyline", { points: "3 6 5 6 21 6" }),
|
|
7586
|
+
React.createElement("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
|
|
7587
|
+
React.createElement("line", { x1: "10", y1: "11", x2: "10", y2: "17" }),
|
|
7588
|
+
React.createElement("line", { x1: "14", y1: "11", x2: "14", y2: "17" }))),
|
|
7589
|
+
React.createElement("button", { className: "modal-close-btn", onClick: onClose }, "\u00D7"))),
|
|
7557
7590
|
React.createElement("div", { className: "modal-body" },
|
|
7591
|
+
error && React.createElement("div", { className: "modal-error" }, error),
|
|
7592
|
+
showConfirm && (React.createElement("div", { className: "delete-confirm-box" },
|
|
7593
|
+
React.createElement("p", null, "Are you sure you want to delete this meeting?"),
|
|
7594
|
+
React.createElement("div", { className: "delete-confirm-actions" },
|
|
7595
|
+
React.createElement("button", { className: "modal-btn modal-btn-secondary", onClick: () => setShowConfirm(false), disabled: deleting }, "Cancel"),
|
|
7596
|
+
React.createElement("button", { className: "modal-btn modal-btn-danger", onClick: handleDelete, disabled: deleting }, deleting ? 'Deleting...' : 'Delete')))),
|
|
7558
7597
|
React.createElement("div", { className: "detail-section" },
|
|
7559
7598
|
React.createElement("div", { className: "detail-row" },
|
|
7560
7599
|
React.createElement("span", { className: "detail-label" }, "Date:"),
|
|
@@ -8116,7 +8155,10 @@ const Calendar = ({ businessId, resourceId, title = 'Calendar', apiBaseUrl, defa
|
|
|
8116
8155
|
loading && React.createElement("div", { className: "calendar-loading" }, "Loading..."),
|
|
8117
8156
|
React.createElement("div", { className: "calendar-content" }, currentView === 'month' ? (React.createElement(MonthView, { currentDate: currentDate, bookings: bookings, timezone: timezone, onBookingClick: handleInternalBookingClick, onDateClick: handleDateClick, businessHours: businessHours })) : (React.createElement(TimeGrid, { currentDate: currentDate, view: currentView, bookings: bookings, timezone: timezone, onBookingClick: handleInternalBookingClick, onTimeSlotClick: handleDateClick, businessHours: businessHours }))),
|
|
8118
8157
|
showCreateModal && selectedDate && (React.createElement(CreateBookingModal, { businessId: businessId, apiBaseUrl: apiBaseUrl, initialDate: selectedDate, participants: participants, onClose: () => setShowCreateModal(false), onBookingCreated: handleBookingCreated, timezone: timezone, businessHours: businessHours })),
|
|
8119
|
-
selectedBooking && (React.createElement(BookingDetailsModal, { booking: selectedBooking, timezone: timezone, onClose: () => setSelectedBooking(null)
|
|
8158
|
+
selectedBooking && (React.createElement(BookingDetailsModal, { booking: selectedBooking, timezone: timezone, businessId: businessId, apiBaseUrl: apiBaseUrl, onClose: () => setSelectedBooking(null), onBookingDeleted: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8159
|
+
setSelectedBooking(null);
|
|
8160
|
+
yield fetchBookings();
|
|
8161
|
+
}) }))));
|
|
8120
8162
|
};
|
|
8121
8163
|
|
|
8122
8164
|
exports.Calendar = Calendar;
|