@lifestreamdynamics/booking-widget 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Lifestream Dynamics
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,122 @@
1
+ # @lifestreamdynamics/booking-widget
2
+
3
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+
5
+ Embeddable `<lsv-booking>` Web Component that renders a complete booking flow for Lifestream Vault.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @lifestreamdynamics/booking-widget
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Script tag (UMD via unpkg)
16
+
17
+ ```html
18
+ <script src="https://unpkg.com/@lifestreamdynamics/booking-widget"></script>
19
+ <lsv-booking
20
+ api-url="https://your-vault.example.com"
21
+ profile-slug="jane"
22
+ vault-slug="consulting"
23
+ theme="auto"
24
+ ></lsv-booking>
25
+ ```
26
+
27
+ ### ESM import
28
+
29
+ ```js
30
+ import '@lifestreamdynamics/booking-widget';
31
+ ```
32
+
33
+ Then use the element in your HTML or JSX:
34
+
35
+ ```html
36
+ <lsv-booking
37
+ api-url="https://your-vault.example.com"
38
+ profile-slug="jane"
39
+ vault-slug="consulting"
40
+ ></lsv-booking>
41
+ ```
42
+
43
+ ## Attributes
44
+
45
+ | Attribute | Required | Default | Description |
46
+ |----------------|----------|----------|--------------------------------------------------------------------|
47
+ | `api-url` | Yes | — | Base URL of your Lifestream Vault API instance. |
48
+ | `profile-slug` | Yes | — | Profile slug identifying the booking page host. |
49
+ | `vault-slug` | Yes | — | Vault slug identifying the booking page. |
50
+ | `theme` | No | `"dark"` | Color theme: `"dark"`, `"light"`, or `"auto"` (system preference).|
51
+
52
+ ## Events
53
+
54
+ The component dispatches custom events on the host element.
55
+
56
+ ### `lsv-booking-submitted`
57
+
58
+ Fired when a booking is successfully created.
59
+
60
+ ```js
61
+ element.addEventListener('lsv-booking-submitted', (event) => {
62
+ const { bookingId, startAt, endAt, slotTitle } = event.detail;
63
+ });
64
+ ```
65
+
66
+ | Field | Type | Description |
67
+ |--------------|----------|------------------------------------|
68
+ | `bookingId` | `string` | ID of the created booking. |
69
+ | `startAt` | `string` | ISO 8601 start timestamp. |
70
+ | `endAt` | `string` | ISO 8601 end timestamp. |
71
+ | `slotTitle` | `string` | Title of the booked slot. |
72
+
73
+ ### `lsv-booking-error`
74
+
75
+ Fired when an error occurs during the booking flow.
76
+
77
+ ```js
78
+ element.addEventListener('lsv-booking-error', (event) => {
79
+ const { message, step } = event.detail;
80
+ });
81
+ ```
82
+
83
+ | Field | Type | Description |
84
+ |-----------|----------|--------------------------------------------------|
85
+ | `message` | `string` | Human-readable error description. |
86
+ | `step` | `string` | Flow step where the error occurred. |
87
+
88
+ ## Styling
89
+
90
+ The component exposes CSS custom properties on `:host` for theming.
91
+
92
+ | Property | Default | Description |
93
+ |------------------------|-------------|----------------------------------------------|
94
+ | `--lsv-primary-color` | `#06b6d4` | Primary accent color (buttons, highlights). |
95
+ | `--lsv-border-radius` | `0.5rem` | Border radius applied to UI elements. |
96
+ | `--lsv-bg-color` | *(theme)* | Background color of the widget. |
97
+ | `--lsv-text-color` | *(theme)* | Primary text color. |
98
+ | `--lsv-surface-color` | *(theme)* | Surface/card background color. |
99
+ | `--lsv-border-color` | *(theme)* | Border color. |
100
+ | `--lsv-muted-color` | *(theme)* | Muted/secondary text color. |
101
+ | `--lsv-input-bg` | *(theme)* | Input field background color. |
102
+
103
+ Example:
104
+
105
+ ```css
106
+ lsv-booking {
107
+ --lsv-primary-color: #7c3aed;
108
+ --lsv-border-radius: 0.25rem;
109
+ }
110
+ ```
111
+
112
+ ## Build Outputs
113
+
114
+ | Format | File |
115
+ |--------|----------------------------|
116
+ | ESM | `dist/lsv-booking.js` |
117
+ | UMD | `dist/lsv-booking.umd.cjs` |
118
+ | Types | `dist/index.d.ts` |
119
+
120
+ ## License
121
+
122
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,44 @@
1
+ export declare class LsvBooking extends HTMLElement {
2
+ static observedAttributes: string[];
3
+ private root;
4
+ private step;
5
+ private slots;
6
+ private selectedSlot;
7
+ private selectedDate;
8
+ private selectedTime;
9
+ private availableTimes;
10
+ private isLoading;
11
+ private errorMsg;
12
+ constructor();
13
+ connectedCallback(): void;
14
+ attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
15
+ private get apiUrl();
16
+ private get profileSlug();
17
+ private get vaultSlug();
18
+ private get baseApiPath();
19
+ private reset;
20
+ private setLoading;
21
+ private setError;
22
+ private loadSlots;
23
+ private loadTimes;
24
+ private submitBooking;
25
+ private getNextDates;
26
+ private isDateAllowed;
27
+ private formatTime;
28
+ private formatDate;
29
+ private render;
30
+ private renderStepIndicator;
31
+ private renderLoading;
32
+ private renderError;
33
+ private renderSlots;
34
+ private formatDayList;
35
+ private renderDate;
36
+ private renderTime;
37
+ private renderForm;
38
+ private makeField;
39
+ private renderSuccess;
40
+ private attachEvents;
41
+ private handleAction;
42
+ }
43
+
44
+ export { }