@timum/booking 0.7.2 → 0.7.4
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/README.md +54 -52
- package/build/timum-booking.js +504 -493
- package/build/timum-booking.umd.cjs +24 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
## Content
|
|
4
4
|
|
|
5
5
|
- [Features](#features)
|
|
6
|
-
- [Basic Usage](#
|
|
7
|
-
- [In a Script Tag](#
|
|
8
|
-
- [As ESM import](#
|
|
9
|
-
- [Advanced Usage](#
|
|
10
|
-
- [muiTheme](#
|
|
11
|
-
- [fcConfig](#
|
|
12
|
-
- [appConfig](#
|
|
13
|
-
- [How to use Callbacks](#
|
|
14
|
-
- [Booking Related](#
|
|
15
|
-
- [Cancelation Related](#
|
|
16
|
-
- [Data Fetching Related](#
|
|
6
|
+
- [Basic Usage](#basic_usage)
|
|
7
|
+
- [In a Script Tag](#in_a_script_tag)
|
|
8
|
+
- [As ESM import](#as_esm_import)
|
|
9
|
+
- [Advanced Usage](#advanced_usage)
|
|
10
|
+
- [muiTheme](#mui_theme)
|
|
11
|
+
- [fcConfig](#fc_config)
|
|
12
|
+
- [appConfig](#app_config)
|
|
13
|
+
- [How to use Callbacks](#how_to_use_callbacks)
|
|
14
|
+
- [Booking Related](#booking_related)
|
|
15
|
+
- [Cancelation Related](#cancelation_related)
|
|
16
|
+
- [Data Fetching Related](#data_fetching_related)
|
|
17
17
|
- [Localisation](#localisation)
|
|
18
|
-
- [How to Define Fields](#
|
|
19
|
-
- [Anatomy of a Field](#
|
|
20
|
-
- [An Example](#
|
|
21
|
-
- [The Scenario](#
|
|
22
|
-
- [The Implementation](#
|
|
18
|
+
- [How to Define Fields](#how_to_define_fields)
|
|
19
|
+
- [Anatomy of a Field](#anatomy_of_a_field)
|
|
20
|
+
- [An Example](#an_example)
|
|
21
|
+
- [The Scenario](#the_scenario)
|
|
22
|
+
- [The Implementation](#the_implementation)
|
|
23
23
|
|
|
24
24
|
<a name=”features”></a>
|
|
25
25
|
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
- Dynamic definition of input fields with localized labels and validation
|
|
38
38
|
- Therefore, ability to request additional information from customers during booking process
|
|
39
39
|
|
|
40
|
-
<a name=”
|
|
40
|
+
<a name=”basic_usage”></a>
|
|
41
41
|
|
|
42
42
|
## Basic Usage
|
|
43
43
|
|
|
44
|
-
<a name=”
|
|
44
|
+
<a name=”in_a_script_tag”></a>
|
|
45
45
|
|
|
46
46
|
### In a Script Tag
|
|
47
47
|
|
|
@@ -50,7 +50,7 @@ Add the following code to your webpage:
|
|
|
50
50
|
```html
|
|
51
51
|
<div id="bookingjs" style="margin: 32px"></div>
|
|
52
52
|
<script type="module">
|
|
53
|
-
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.
|
|
53
|
+
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.4/build/timum-booking.js';
|
|
54
54
|
|
|
55
55
|
timum.init({ ref: 'booking-widget-demo-resource@timum' });
|
|
56
56
|
</script>
|
|
@@ -65,13 +65,13 @@ Alternatively, you can add `ref` to your url as a parameter. This allows you to
|
|
|
65
65
|
```html
|
|
66
66
|
<div id="bookingjs" style="margin: 32px"></div>
|
|
67
67
|
<script type="module">
|
|
68
|
-
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.
|
|
68
|
+
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.4/build/timum-booking.js';
|
|
69
69
|
|
|
70
70
|
timum.init(); //<- no need for the reference here
|
|
71
71
|
</script>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
<a name=”
|
|
74
|
+
<a name=”as_esm_import”></a>
|
|
75
75
|
|
|
76
76
|
### As ESM import
|
|
77
77
|
|
|
@@ -94,7 +94,7 @@ A example project can be found [here](https://stackblitz.com/edit/react-8q6r8b?f
|
|
|
94
94
|
|
|
95
95
|
---
|
|
96
96
|
|
|
97
|
-
<a name=”
|
|
97
|
+
<a name=”advanced_usage”></a>
|
|
98
98
|
|
|
99
99
|
## Advanced usage
|
|
100
100
|
|
|
@@ -109,7 +109,7 @@ The following table gives a rough overview over each.
|
|
|
109
109
|
| muiTheme | object, mui theme allowing you to change the look and feel of timum. Requires a professional plan. |
|
|
110
110
|
| fcConfig | object, only used if you use full calendar as a booking frontend (settable in appConfig). |
|
|
111
111
|
|
|
112
|
-
<a name=”
|
|
112
|
+
<a name=”mui_theme”></a>
|
|
113
113
|
|
|
114
114
|
### muiTheme
|
|
115
115
|
|
|
@@ -118,7 +118,7 @@ See [here](https://mui.com/) for a general overview. <br> See [here](https://mui
|
|
|
118
118
|
|
|
119
119
|
When you open the file `config.js` in [this](https://stackblitz.com/edit/react-8q6r8b?file=src/index.js) example, you can find an elaborate custom configuration which includes a redesign of the standard timum theme.
|
|
120
120
|
|
|
121
|
-
<a name=”
|
|
121
|
+
<a name=”fc_config”></a>
|
|
122
122
|
|
|
123
123
|
### fcConfig
|
|
124
124
|
|
|
@@ -127,7 +127,7 @@ See [here](https://fullcalendar.io/docs#toc) for a full list of configuration op
|
|
|
127
127
|
|
|
128
128
|
> Note that since fullCalendar isn't mui based, it does not consider the muiTheme object.
|
|
129
129
|
|
|
130
|
-
<a name=”
|
|
130
|
+
<a name=”app_config”></a>
|
|
131
131
|
|
|
132
132
|
### appConfig
|
|
133
133
|
|
|
@@ -183,13 +183,13 @@ This object's options directly affect timum's behaviour or allow you to react to
|
|
|
183
183
|
</tr>
|
|
184
184
|
</table>
|
|
185
185
|
|
|
186
|
-
<a name=”
|
|
186
|
+
<a name=”how_to_use_callbacks”></a>
|
|
187
187
|
|
|
188
188
|
#### How to use callbacks
|
|
189
189
|
|
|
190
190
|
The callbacks object may contain any of the following functions.
|
|
191
191
|
|
|
192
|
-
<a name=”
|
|
192
|
+
<a name=”booking_related”></a>
|
|
193
193
|
|
|
194
194
|
##### Booking related
|
|
195
195
|
|
|
@@ -202,17 +202,17 @@ All Booking related callbacks receive a <em>single obejct</em> as argument conta
|
|
|
202
202
|
- a `timeslot` looking like this:
|
|
203
203
|
```
|
|
204
204
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
205
|
+
start: luxon Datetime object. Internal state. "2023-01-27T09:05:00.000Z",
|
|
206
|
+
end: luxon Datetime object. Internal state. "2023-01-27T09:35:00.000Z",
|
|
207
|
+
timeslot_uuid: uuid of the booked timeslot. e.g. "82ec5220-9d55-11ed-8617-e4a7a0ca32e8",
|
|
208
|
+
product_uuid: uuid of the booked product e.g. "92867f70-4836-11e5-bc04-021a52c25043",
|
|
209
|
+
product_name: string. e.g. "Meeting",
|
|
210
|
+
resource_name: string. e.g. "Booking Widget DEMO",
|
|
211
|
+
capacity: number e.g. 1,
|
|
212
|
+
capacity_left: number e.g. 1,
|
|
213
|
+
kind: either "models.Bookable" or "models.LotAppointment",
|
|
214
|
+
untouchedStart: ISO String e.g: "2023-01-27T09:05:00+01:00" as the server sent it,
|
|
215
|
+
untouchedEnd: ISO String e.g: "2023-01-27T09:35:00+01:00" as the server sent it
|
|
216
216
|
}
|
|
217
217
|
```
|
|
218
218
|
- a `data` looking like this:
|
|
@@ -232,9 +232,9 @@ All Booking related callbacks receive a <em>single obejct</em> as argument conta
|
|
|
232
232
|
|
|
233
233
|
Additionally, `createBookingFailed` and `createBookingSuccessfull` also have a RTKQ `response` object in their respecive argument. See [here](https://redux-toolkit.js.org/rtk-query/usage-with-typescript#type-safe-error-handling) for a reference.
|
|
234
234
|
|
|
235
|
-
<a name=”
|
|
235
|
+
<a name=”cancelation_related”></a>
|
|
236
236
|
|
|
237
|
-
##### Cancelation Related
|
|
237
|
+
##### Cancelation Related
|
|
238
238
|
|
|
239
239
|
- `cancelationStarted`
|
|
240
240
|
- `cancelationSuccessful`
|
|
@@ -244,9 +244,9 @@ All cancelation related callbacks receive a single obejct as argument containing
|
|
|
244
244
|
|
|
245
245
|
Additionally, `cancelationSuccessful` and `cancelationFailed` also have a RTKQ response object in their respecive argument. See here for a reference.
|
|
246
246
|
|
|
247
|
-
<a name=”
|
|
247
|
+
<a name=”data_fetching_related”></a>
|
|
248
248
|
|
|
249
|
-
##### Data Fetching Related
|
|
249
|
+
##### Data Fetching Related
|
|
250
250
|
|
|
251
251
|
In order to display public appointments, resource and calendar information timum sends several requests.
|
|
252
252
|
|
|
@@ -435,7 +435,9 @@ localization: {
|
|
|
435
435
|
},
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
-
|
|
438
|
+
<a name=”how_to_define_fields”></a>
|
|
439
|
+
|
|
440
|
+
#### How to define fields
|
|
439
441
|
|
|
440
442
|
You can customize the information required from customers before booking by defining fields. The minimum required fields for timum are firstName, lastName, email, and agbs. By default, timum also requests mobile and message fields, but you can add your own fields as well.
|
|
441
443
|
|
|
@@ -496,7 +498,7 @@ The standard configuration can be overridden except for the aforementioned field
|
|
|
496
498
|
},
|
|
497
499
|
```
|
|
498
500
|
|
|
499
|
-
<a name=”
|
|
501
|
+
<a name=”anatomy_of_a_field”></a>
|
|
500
502
|
|
|
501
503
|
##### Anatomy of a field
|
|
502
504
|
|
|
@@ -533,31 +535,31 @@ Type `select`:
|
|
|
533
535
|
|
|
534
536
|
- options: array of objects with structure { title: string, key: string }. The title is displayed and the key is passed in the data object to callbacks.
|
|
535
537
|
|
|
536
|
-
<a name=”
|
|
538
|
+
<a name=”an_example”></a>
|
|
537
539
|
|
|
538
|
-
### An Example
|
|
540
|
+
### An Example
|
|
539
541
|
|
|
540
542
|
Here is an example Tying all of the aforementioned concepts together.
|
|
541
543
|
|
|
542
|
-
<a name=”
|
|
544
|
+
<a name=”the_scenario”></a>
|
|
543
545
|
|
|
544
|
-
#### The Scenario
|
|
546
|
+
#### The Scenario
|
|
545
547
|
|
|
546
548
|
For whatever reason it is important to know the gender of customers.
|
|
547
549
|
On the other side the optional fields `mobile` and `message` aren't important for you and you wish to remove them.
|
|
548
550
|
This new gender field must be filled, therefore a validation is required.
|
|
549
551
|
Both the title of the field and it's validations must be localized.
|
|
550
552
|
|
|
551
|
-
<a name=”
|
|
553
|
+
<a name=”the_implementation”></a>
|
|
552
554
|
|
|
553
|
-
#### The Implementation
|
|
555
|
+
#### The Implementation
|
|
554
556
|
|
|
555
557
|
This is the base configuration. As it is it uses the standard field configuration shown in [How to define fields](#howToDefineFields).
|
|
556
558
|
|
|
557
559
|
```html
|
|
558
560
|
<div id="bookingjs" style="margin: 32px"></div>
|
|
559
561
|
<script type="module">
|
|
560
|
-
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.
|
|
562
|
+
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.4/build/timum-booking.js';
|
|
561
563
|
|
|
562
564
|
timum.init({ ref: 'booking-widget-demo-resource@timum' });
|
|
563
565
|
</script>
|
|
@@ -568,7 +570,7 @@ Let's add the necessary changes:
|
|
|
568
570
|
```html
|
|
569
571
|
<div id="bookingjs" style="margin: 32px"></div>
|
|
570
572
|
<script type="module">
|
|
571
|
-
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.
|
|
573
|
+
import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.7.4/build/timum-booking.js';
|
|
572
574
|
|
|
573
575
|
timum.init(
|
|
574
576
|
{
|