@timum/booking 1.24.0 → 1.24.1
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 +41 -39
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ This documentation guides you through all the customization capabilities.
|
|
|
32
32
|
- [Localisation](#localisation)
|
|
33
33
|
- [Booking Form Fields](#booking-form-fields)
|
|
34
34
|
- [Custom Fields](#custom-fields)
|
|
35
|
+
- [Global config override](#global-config-override)
|
|
35
36
|
- [Examples](#examples)
|
|
36
37
|
|
|
37
38
|
- [Multi-Resource Mode for CondensedView](#multi-resource-mode-example)
|
|
@@ -39,7 +40,7 @@ This documentation guides you through all the customization capabilities.
|
|
|
39
40
|
- [Conditionally Hide BookingJS When No Bookables Are Availables](#conditionally-hide-bookingjs-when-no-bookables-are-available)
|
|
40
41
|
- [Custom Field Example](#custom-field-example)
|
|
41
42
|
|
|
42
|
-
<a
|
|
43
|
+
<a id="features"></a>
|
|
43
44
|
|
|
44
45
|
## Features
|
|
45
46
|
|
|
@@ -62,11 +63,11 @@ This documentation guides you through all the customization capabilities.
|
|
|
62
63
|
- Callbacks for custom code execution and event response (e.g. booking created, appointments loaded, booking canceled)
|
|
63
64
|
- Responsive layout handling for embedded views - EyeCandy and PureListView automatically adapt to available space and viewport constraints
|
|
64
65
|
|
|
65
|
-
<a
|
|
66
|
+
<a id="how-to-integrate"></a>
|
|
66
67
|
|
|
67
68
|
## How to Integrate
|
|
68
69
|
|
|
69
|
-
<a
|
|
70
|
+
<a id="in-a-script-tag"></a>
|
|
70
71
|
|
|
71
72
|
These are some minimal examples. BookingJs is highly customizable.
|
|
72
73
|
An overview over all configuration options can be found in [Advanced Customisation](#advanced-usage)
|
|
@@ -99,7 +100,7 @@ Alternatively, you can add `ref` to your url as a parameter. This allows you to
|
|
|
99
100
|
</script>
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
<a
|
|
103
|
+
<a id="as-esm-import"></a>
|
|
103
104
|
|
|
104
105
|
### As ESM import
|
|
105
106
|
|
|
@@ -179,7 +180,7 @@ Each instance:
|
|
|
179
180
|
- Receives configuration updates and postMessages independently
|
|
180
181
|
- Is properly cleaned up when unmounted, preventing memory leaks
|
|
181
182
|
|
|
182
|
-
<a
|
|
183
|
+
<a id="entity-referencing"></a>
|
|
183
184
|
|
|
184
185
|
### Entity Referencing
|
|
185
186
|
|
|
@@ -187,20 +188,20 @@ As shown in [How to Integrate](#how-to-integrate), there are two ways in which t
|
|
|
187
188
|
|
|
188
189
|
Additionally, there are three different kinds of references you can provide, each having their own implications concerning the delivered appointments or whether the booking frontend is shown at all.
|
|
189
190
|
|
|
190
|
-
<a
|
|
191
|
+
<a id="channel-reference"></a>
|
|
191
192
|
|
|
192
193
|
#### Channel Reference
|
|
193
194
|
|
|
194
195
|
Resource channels are entities in Timum, each storing a configuration that changes the booking experience for customers. Each individual resource has four channels that users can distribute to their customers through a link.
|
|
195
196
|
To use these channels in an embed scenario, provide a channel reference in the ref property (either in the URL or as part of the config). In this case, nothing else is required.
|
|
196
197
|
|
|
197
|
-
<a
|
|
198
|
+
<a id="resource-reference"></a>
|
|
198
199
|
|
|
199
200
|
#### Resource Reference
|
|
200
201
|
|
|
201
202
|
A reference that refers to a plain resource, where the channel is unknown. The default channel (and its corresponding configuration) is used instead.
|
|
202
203
|
|
|
203
|
-
<a
|
|
204
|
+
<a id="resource-reference-with-channelKey"></a>
|
|
204
205
|
|
|
205
206
|
#### Resource Reference with ChannelKey
|
|
206
207
|
|
|
@@ -221,7 +222,7 @@ The following table gives an overview of the different permutations and how book
|
|
|
221
222
|
- RESref: short for resource reference.
|
|
222
223
|
- CHref: short for channel reference.
|
|
223
224
|
|
|
224
|
-
<a
|
|
225
|
+
<a id="example"></a>
|
|
225
226
|
|
|
226
227
|
##### Example
|
|
227
228
|
|
|
@@ -231,14 +232,14 @@ The following table gives an overview of the different permutations and how book
|
|
|
231
232
|
|
|
232
233
|
- Fifth row: If a resource reference and a `channelKey` are provided in the config object, and there is nothing in the URL, the config object is used. BookingJs gets displayed using the channel uniquely identified by the resource reference and the `channelKey`.
|
|
233
234
|
|
|
234
|
-
<a
|
|
235
|
+
<a id="customer-pre-identification"></a>
|
|
235
236
|
|
|
236
237
|
#### Customer pre-identification
|
|
237
238
|
|
|
238
239
|
BookingJs can identify customers automatically if configured correctly.
|
|
239
240
|
This means they don't need to input their personal data prior to booking.
|
|
240
241
|
|
|
241
|
-
<a
|
|
242
|
+
<a id="identification-via-pdataid"></a>
|
|
242
243
|
|
|
243
244
|
##### Identification via pDataId
|
|
244
245
|
|
|
@@ -248,7 +249,7 @@ General behaviour: If there is, then visitor is pre identified. If not: provide
|
|
|
248
249
|
</em>
|
|
249
250
|
See [appConfig](#appconfig) for more information about pData.
|
|
250
251
|
|
|
251
|
-
<a
|
|
252
|
+
<a id="identification-via-logged-in-user"></a>
|
|
252
253
|
|
|
253
254
|
##### Identification via Logged-in User
|
|
254
255
|
|
|
@@ -258,7 +259,7 @@ Even customers can register at timum and become registered and logged-in users.
|
|
|
258
259
|
|
|
259
260
|
---
|
|
260
261
|
|
|
261
|
-
<a
|
|
262
|
+
<a id="advanced-usage"></a>
|
|
262
263
|
|
|
263
264
|
## Advanced usage
|
|
264
265
|
|
|
@@ -273,7 +274,7 @@ The following table gives a rough overview over each.
|
|
|
273
274
|
| muiTheme | object, mui theme allowing you to change the look and feel of timum. Requires a professional plan. |
|
|
274
275
|
| fcConfig | object, only used if you use full calendar as a booking frontend (settable in appConfig). |
|
|
275
276
|
|
|
276
|
-
<a
|
|
277
|
+
<a id="muitheme"></a>
|
|
277
278
|
|
|
278
279
|
### muiTheme
|
|
279
280
|
|
|
@@ -288,7 +289,7 @@ Needs professional plan.
|
|
|
288
289
|
|
|
289
290
|
You can set global or per-component fonts via the MUI theme (e.g., typography.fontFamily or component styleOverrides). BookingJS can also load the corresponding font files for you; see [Font Loading](#font-loading) for how to declare font resources in the theme and control the loading strategy. Requires a professional plan for custom theming.
|
|
290
291
|
|
|
291
|
-
<a
|
|
292
|
+
<a id="fcconfig"></a>
|
|
292
293
|
|
|
293
294
|
### fcConfig
|
|
294
295
|
|
|
@@ -320,7 +321,7 @@ There are also some options specific to bookingjs. In addition to the configurat
|
|
|
320
321
|
</tr>
|
|
321
322
|
</table>
|
|
322
323
|
|
|
323
|
-
<a
|
|
324
|
+
<a id="appconfig"></a>
|
|
324
325
|
|
|
325
326
|
### appConfig
|
|
326
327
|
|
|
@@ -526,7 +527,7 @@ This object's options directly affect timum's behaviour or allow you to react to
|
|
|
526
527
|
</tr>
|
|
527
528
|
</table>
|
|
528
529
|
|
|
529
|
-
<a
|
|
530
|
+
<a id="font-loading"></a>
|
|
530
531
|
|
|
531
532
|
#### Font Loading
|
|
532
533
|
|
|
@@ -626,13 +627,13 @@ Notes and best practices
|
|
|
626
627
|
- If fonts are hosted on a different domain, ensure proper CORS headers so the browser can load them.
|
|
627
628
|
- You can still use per-component overrides to mix families (e.g., Sora for Buttons only) by setting components.MuiButton.styleOverrides.root.fontFamily; just ensure the face is declared under fontFaces or provided via fontSource as shown above.
|
|
628
629
|
|
|
629
|
-
<a
|
|
630
|
+
<a id="how-to-use-callbacks"></a>
|
|
630
631
|
|
|
631
632
|
#### How to use callbacks
|
|
632
633
|
|
|
633
634
|
The callbacks object may contain any of the following functions.
|
|
634
635
|
|
|
635
|
-
<a
|
|
636
|
+
<a id="booking-related"></a>
|
|
636
637
|
|
|
637
638
|
##### Booking related
|
|
638
639
|
|
|
@@ -677,7 +678,7 @@ All Booking related callbacks receive a <em>single obejct</em> as argument conta
|
|
|
677
678
|
|
|
678
679
|
Additionally, `createBookingFailed` and `createBookingSuccessful` also have a RTKQ `response` object in their respective argument. See [here](https://redux-toolkit.js.org/rtk-query/usage-with-typescript#type-safe-error-handling) for a reference.
|
|
679
680
|
|
|
680
|
-
<a
|
|
681
|
+
<a id="cancelation-related"></a>
|
|
681
682
|
|
|
682
683
|
##### Cancelation Related
|
|
683
684
|
|
|
@@ -687,11 +688,11 @@ Additionally, `createBookingFailed` and `createBookingSuccessful` also have a RT
|
|
|
687
688
|
- `cancelationSuccessful`
|
|
688
689
|
- `cancelationFailed`
|
|
689
690
|
|
|
690
|
-
All cancelation related callbacks receive a single obejct as argument containing the same properties as described in [Booking related](#
|
|
691
|
+
All cancelation related callbacks receive a single obejct as argument containing the same properties as described in [Booking related](#booking-related)
|
|
691
692
|
|
|
692
693
|
Additionally, `cancelationSuccessful` and `cancelationFailed` also have a RTKQ response object in their respecive argument. See here for a reference.
|
|
693
694
|
|
|
694
|
-
<a
|
|
695
|
+
<a id="dialog_related"></a>
|
|
695
696
|
|
|
696
697
|
##### Dialog related
|
|
697
698
|
|
|
@@ -706,7 +707,7 @@ In addition to the dialog related callbacks already mentioned in [Cancelation Re
|
|
|
706
707
|
|
|
707
708
|
These do not receive any parameters.
|
|
708
709
|
|
|
709
|
-
<a
|
|
710
|
+
<a id="data-fetching-related"></a>
|
|
710
711
|
|
|
711
712
|
##### Data Fetching Related
|
|
712
713
|
|
|
@@ -791,7 +792,7 @@ In order to display public appointments, resource and calendar information timum
|
|
|
791
792
|
receives a single RTKQ error object. See [here](https://redux-toolkit.js.org/rtk-query/usage-with-typescript#type-safe-error-handling) for a reference.
|
|
792
793
|
<br>
|
|
793
794
|
|
|
794
|
-
<a
|
|
795
|
+
<a id="localisation"></a>
|
|
795
796
|
|
|
796
797
|
#### Localisation
|
|
797
798
|
|
|
@@ -908,7 +909,7 @@ localization: {
|
|
|
908
909
|
},
|
|
909
910
|
```
|
|
910
911
|
|
|
911
|
-
<a
|
|
912
|
+
<a id="booking-form-fields"></a>
|
|
912
913
|
|
|
913
914
|
#### Booking Form Fields
|
|
914
915
|
|
|
@@ -985,7 +986,7 @@ fields: {
|
|
|
985
986
|
},
|
|
986
987
|
```
|
|
987
988
|
|
|
988
|
-
<a
|
|
989
|
+
<a id="custom-fields"></a>
|
|
989
990
|
|
|
990
991
|
##### Custom Fields
|
|
991
992
|
|
|
@@ -1071,7 +1072,7 @@ Depending on the type there are additional properties you can/must specify:
|
|
|
1071
1072
|
|
|
1072
1073
|
- 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.
|
|
1073
1074
|
|
|
1074
|
-
<a
|
|
1075
|
+
<a id="global-config-override"></a>
|
|
1075
1076
|
|
|
1076
1077
|
### Global config via `window.timumBookingConfig`
|
|
1077
1078
|
|
|
@@ -1115,13 +1116,11 @@ All four slots are optional. You can set only top-level slots, only per-instance
|
|
|
1115
1116
|
|
|
1116
1117
|
When multiple BookingJS instances live on the same page and you want to give them different overrides, set `appConfig.rootElId` to a stable identifier (typically the ID of the DOM element that hosts the widget) and use that same string as the key in `window.timumBookingConfig`.
|
|
1117
1118
|
|
|
1118
|
-
The snippet generator built into the Timum backend already does this for you: each embed snippet it produces stamps `rootElId: "bookingjs-<uuid>"` into the generated `init()` call, using the same UUID that identifies the Custom URL. That means you can write per-instance overrides using the UUID you were shown when you created the URL, and they will be picked up automatically when the snippet runs — no changes to the snippet or backend required.
|
|
1119
|
-
|
|
1120
1119
|
If you omit `rootElId`, only the top-level slots apply — per-instance lookup is skipped entirely.
|
|
1121
1120
|
|
|
1122
1121
|
#### Scoping config to provider channel snippets
|
|
1123
1122
|
|
|
1124
|
-
Each embed snippet you create in the Timum interface (
|
|
1123
|
+
Each embed snippet you create in the Timum interface (found in "Appointment booking" ("Terminbuchung") in the top bar) represents a **provider channel** identified by a UUID. The generated snippet already stamps `rootElId: "bookingjs-<provider-channel-uuid>"` into its `init()` call. You can use that same key in `window.timumBookingConfig` to scope configuration to a specific snippet:
|
|
1125
1124
|
|
|
1126
1125
|
```js
|
|
1127
1126
|
window.timumBookingConfig = {
|
|
@@ -1143,6 +1142,9 @@ window.timumBookingConfig = {
|
|
|
1143
1142
|
|
|
1144
1143
|
This is useful when you embed multiple booking widgets on the same page and want each one to have different styling or behavior, without having to configure all of that through the Timum interface. You find the provider channel UUID in the embed code that the Custom URL entry generates for you.
|
|
1145
1144
|
|
|
1145
|
+
The configs get merged. Meaning the specific snippet configuration gets properties it doesn't override itself from the general top level config. Any properties not defined in there come either from the config of the snippet, provider or account wide configs or, if nothing else can be found, the timum default values.
|
|
1146
|
+
This is a cascade from most specific to least specific.
|
|
1147
|
+
|
|
1146
1148
|
#### Reserved names
|
|
1147
1149
|
|
|
1148
1150
|
The strings `'appConfig'`, `'muiTheme'`, and `'fcConfig'` are reserved as top-level slot names. If you accidentally set `appConfig.rootElId` to one of these values, BookingJS will log a `console.warn` and skip the per-instance lookup for that instance (only the top-level slots will apply). Pick a less generic identifier for your widgets.
|
|
@@ -1151,7 +1153,7 @@ The strings `'appConfig'`, `'muiTheme'`, and `'fcConfig'` are reserved as top-le
|
|
|
1151
1153
|
|
|
1152
1154
|
The `<TimumBooking>` React component intentionally **ignores** `window.timumBookingConfig`. React consumers pass `appConfig` / `muiTheme` / `fcConfig` directly as props per call and are expected to use React idioms (context, providers) for sharing config across components. The global override layer is therefore a script-tag / snippet feature only.
|
|
1153
1155
|
|
|
1154
|
-
<a
|
|
1156
|
+
<a id="examples"></a>
|
|
1155
1157
|
|
|
1156
1158
|
# Examples
|
|
1157
1159
|
|
|
@@ -1213,7 +1215,7 @@ The example below shows how to set a new default font (`Ysabeau Office`) and the
|
|
|
1213
1215
|
</script>
|
|
1214
1216
|
```
|
|
1215
1217
|
|
|
1216
|
-
<a
|
|
1218
|
+
<a id="restrict-bookingjs-access-to-invited-customers"></a>
|
|
1217
1219
|
|
|
1218
1220
|
## Restrict BookingJS Access to Invited Customers
|
|
1219
1221
|
|
|
@@ -1296,7 +1298,7 @@ The following code demonstrates how to extract the necessary parameters from the
|
|
|
1296
1298
|
|
|
1297
1299
|
The key used within the `pData` object (e.g., `personId`) must match the expected parameter name for your connected platform (onOffice, FlowFact, etc.) to correctly authenticate the user. Consult the platform-specific integration guide for the correct parameter name. (See also: [pData Configuration](#appconfig)
|
|
1298
1300
|
|
|
1299
|
-
<a
|
|
1301
|
+
<a id="conditionally-hide-bookingjs-when-no-bookables-are-available"></a>
|
|
1300
1302
|
|
|
1301
1303
|
## Conditionally Hide BookingJS When No Bookables Are Available
|
|
1302
1304
|
|
|
@@ -1351,7 +1353,7 @@ The following snippet demonstrates how to hide the main bookingjs container by c
|
|
|
1351
1353
|
</script>
|
|
1352
1354
|
```
|
|
1353
1355
|
|
|
1354
|
-
<a
|
|
1356
|
+
<a id="multi-resource-mode-example"></a>
|
|
1355
1357
|
|
|
1356
1358
|
## Multi-Resource Mode for CondensedView
|
|
1357
1359
|
|
|
@@ -1415,7 +1417,7 @@ Customers can click any slot to book with their preferred consultant, without ne
|
|
|
1415
1417
|
- Works seamlessly with other CondensedView options like `forceResourceSelectorDialog`
|
|
1416
1418
|
- Professional plan may be required for additional customizations (custom theming, form fields, etc.)
|
|
1417
1419
|
|
|
1418
|
-
<a
|
|
1420
|
+
<a id="eyecandy-responsive-layout"></a>
|
|
1419
1421
|
|
|
1420
1422
|
## EyeCandy Responsive Layout in DetailsView
|
|
1421
1423
|
|
|
@@ -1473,24 +1475,24 @@ import { TimumBooking } from '@timum/booking';
|
|
|
1473
1475
|
|
|
1474
1476
|
The component respects both DetailsView's viewport assessment and its own container measurements to deliver consistent, responsive layouts across all screen sizes.
|
|
1475
1477
|
|
|
1476
|
-
<a
|
|
1478
|
+
<a id="custom-field-example"></a>
|
|
1477
1479
|
|
|
1478
1480
|
## Custom Field Example
|
|
1479
1481
|
|
|
1480
1482
|
Here is an example tying all of the aforementioned concepts together.
|
|
1481
1483
|
And [here](https://jsfiddle.net/timum/wov6pLk7/) is a fiddle containing the very example detailed in this chapter.
|
|
1482
1484
|
|
|
1483
|
-
<a
|
|
1485
|
+
<a id="the-scenario"></a>
|
|
1484
1486
|
|
|
1485
1487
|
### The Scenario
|
|
1486
1488
|
|
|
1487
1489
|
It is necessary to determine the gender of customers for a specific purpose. The `mobile` and `message` fields are not necessary and will be removed. The new `gender` field must be filled, therefore a validation check is required to ensure it is completed. Both the name of the `gender` field and the validation messages must be translated into different languages.
|
|
1488
1490
|
|
|
1489
|
-
<a
|
|
1491
|
+
<a id="the-implementation"></a>
|
|
1490
1492
|
|
|
1491
1493
|
### The Implementation
|
|
1492
1494
|
|
|
1493
|
-
This is the base configuration. As it uses the standard field configuration shown in [Booking form fields](#
|
|
1495
|
+
This is the base configuration. As it uses the standard field configuration shown in [Booking form fields](#booking-form-fields) :
|
|
1494
1496
|
|
|
1495
1497
|
```html
|
|
1496
1498
|
<div id="bookingjs" style="margin: 32px"></div>
|