mtolives-book-now — Technical Specification

Version: 1.0.0
Owner: Mount of Olives Hotel
License: MIT (widget). Flatpickr assets MIT under their own license.

1) Overview

The mtolives-book-now widget is a lightweight, self-hosted Web Component (Custom Element + Shadow DOM) that renders a two-field date-range picker (Check-in / Check-out) and a BOOK NOW button. It navigates to the Cloudbeds booking engine with the selected dates passed as query parameters. It was built to closely match the visual and behavioral feel of the original Site Editor/Cloudbeds header widget, while removing platform lock-in so it can be hosted on your own cPanel or any standard web server.

Purpose

2) Feature Set (v1.0.0)

3) Technology & Architecture

4) Directory Layout (recommended)

widgets/
└─ mtolives-book-now/
   ├─ mtolives-book-now.js
   ├─ vendor/
   │  └─ flatpickr/
   │     ├─ flatpickr.min.css
   │     ├─ flatpickr.min.js
   │     ├─ plugins/
   │     │  └─ rangePlugin.js
   │     └─ l10n/ (optional locales: he.js, ar.js, tr.js, ru.js, ko.js …)
   ├─ demo/
   │  └─ index.html
   ├─ VERSION
   ├─ CHANGELOG.md
   ├─ LICENSE
   └─ README.md

5) Usage

Include on a page

<script defer src="/widgets/mtolives-book-now/mtolives-book-now.js?v=1.0.0"></script>

<mtolives-book-now
  book-url="https://www.mtoliveshotel.com/book-now"
  show-months="2"
  popup="above"
  display-format="d M Y"
  locale="en">
</mtolives-book-now>

Public Attributes (Component API)

URL Contract (Navigation)

On BOOK NOW, the widget navigates to:

{book-url}?checkin=YYYY-MM-DD&checkout=YYYY-MM-DD

6) Styling & Theming

CSS variables on :host allow easy theming:

All other styles are isolated in Shadow DOM. The only global CSS is a small calendar “polish” style injected to <head> to style the popup appended to <body>.

7) Accessibility (A11y)

8) Internationalization (i18n) & RTL

9) Security Considerations

10) Performance

11) Versioning & Release

12) Limitations & Known Issues (v1.0.0)

13) Troubleshooting

14) Roadmap (Proposed)

15) Core Example (Simplified)

await ensureFlatpickrLoaded(locale);

this.fpRange = flatpickr(checkin, {
  locale,
  dateFormat: displayFormat,
  showMonths,
  position,
  plugins: [ new rangePlugin({ input: checkout }) ],
  onChange: (dates) => {
    const [ci, co] = dates;
    checkin.value  = ci ? flatpickr.formatDate(ci, displayFormat) : '';
    checkout.value = co ? flatpickr.formatDate(co, displayFormat) : '';
  },
});

// on click:
const url = new URL(bookUrl, location.origin);
url.searchParams.set('checkin',  toYMD(checkIn));
url.searchParams.set('checkout', toYMD(checkOut));
location.href = url.toString();

16) Licensing

17) Change History (Excerpt)


Generated for internal use — mtolives-book-now v1.0.0