@timum/booking 1.2.7 → 1.3.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.
Files changed (31) hide show
  1. package/README.md +92 -39
  2. package/build/{timum-booking.js → booking.js} +1 -1
  3. package/build/booking.umd.cjs +1252 -0
  4. package/build/{index-203f7a6c.js → index-356f483c.js} +1 -1
  5. package/build/{index-a5d163ff.js → index-3fa2925e.js} +1 -1
  6. package/build/{index-abd09dcb.js → index-5e17393f.js} +1 -1
  7. package/build/{index-ce93f3a6.js → index-628aaacf.js} +28061 -27924
  8. package/build/{index-ea0cf155.js → index-6df16bb2.js} +1 -1
  9. package/build/{index-be92daab.js → index-832f173a.js} +1 -1
  10. package/build/{index-2aaa432f.js → index-8352ceb4.js} +1 -1
  11. package/build/{index-90d17811.js → index-8a94e46d.js} +1 -1
  12. package/build/{index-8ff7ccf7.js → index-a50b4f1d.js} +1 -1
  13. package/build/{index-6c98a490.js → index-d8836ffe.js} +1 -1
  14. package/build/{index-d0ca0177.js → index-ecb46392.js} +1 -1
  15. package/examples/callbacks.htm +1 -1
  16. package/examples/docuExample.htm +1 -1
  17. package/examples/fields.htm +1 -1
  18. package/examples/fullExample.htm +1 -1
  19. package/examples/list-view.htm +1 -1
  20. package/examples/local-language.htm +1 -1
  21. package/examples/local-preset.htm +1 -1
  22. package/examples/local-strings.htm +1 -1
  23. package/examples/multiple.htm +1 -1
  24. package/examples/selectable-product.htm +1 -1
  25. package/examples/usingChannelId.htm +1 -1
  26. package/examples/usingChannelKeyAndResourceRef.htm +1 -1
  27. package/examples/usingFullCalendar.htm +1 -1
  28. package/package.json +16 -7
  29. package/remTags.bat +14 -0
  30. package/vite.config.js +2 -1
  31. package/build/timum-booking.umd.cjs +0 -1238
package/README.md CHANGED
@@ -28,9 +28,9 @@ This documentation guides you through all the customization capabilities.
28
28
  - [Cancelation Related](#cancelation_related)
29
29
  - [Data Fetching Related](#data_fetching_related)
30
30
  - [Localisation](#localisation)
31
- - [How to Define Fields](#how_to_define_fields)
32
- - [Anatomy of a Field](#anatomy_of_a_field)
33
- - [An Example](#an_example)
31
+ - [Booking Form Fields](#bookingFormFields)
32
+ - [Custom Fields](#customFields)
33
+ - [Custom Field Example](#CustomFieldExample)
34
34
  - [The Scenario](#the_scenario)
35
35
  - [The Implementation](#the_implementation)
36
36
 
@@ -67,7 +67,7 @@ Add the following code to your webpage:
67
67
  ```html
68
68
  <div id="bookingjs" style="margin: 32px"></div>
69
69
  <script type="module">
70
- import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.8.0/build/timum-booking.js';
70
+ import * as timum from 'https://cdn.timum.de/bookingjs/booking.js';
71
71
 
72
72
  timum.init({ ref: 'booking-widget-demo-resource@timum' });
73
73
  </script>
@@ -82,7 +82,7 @@ Alternatively, you can add `ref` to your url as a parameter. This allows you to
82
82
  ```html
83
83
  <div id="bookingjs" style="margin: 32px"></div>
84
84
  <script type="module">
85
- import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.8.0/build/timum-booking.js';
85
+ import * as timum from 'https://cdn.timum.de/bookingjs/booking.js';
86
86
 
87
87
  timum.init(); //<- no need for the reference here
88
88
  </script>
@@ -92,7 +92,7 @@ Alternatively, you can add `ref` to your url as a parameter. This allows you to
92
92
 
93
93
  ### As ESM import
94
94
 
95
- 1. Add timum-booking to your project with
95
+ 1. Add timum booking to your project with
96
96
  `yarn add @timum/booking`
97
97
  or use npm with
98
98
  `npm install @timum/booking`
@@ -223,6 +223,29 @@ See [here](https://fullcalendar.io/docs#toc) for a full list of configuration op
223
223
 
224
224
  > Note that since fullCalendar isn't mui based, it does not consider the muiTheme object.
225
225
 
226
+ There are also some options specific to bookingjs. In addition to the configuration options of fullcalendar the following options are also available (all of them are optional):
227
+
228
+ <table>
229
+ <tr>
230
+ <th>Property</th>
231
+ <th>Description</th>
232
+ </tr>
233
+ <tr>
234
+ <td>largeView</td>
235
+ <td>string, Determines which <code>view</code> is displayed for screen widths <i>greater</i> 601px. <br>Please refer to the fullcalendar docs linked above for an overview of applicable values. </td>
236
+ </tr>
237
+ <tr>
238
+ <td>smallView</td>
239
+ <td>string, Determines which <code>view</code> is displayed for screen widths <i>smaller</i> 601px. <br> Please refer to the fullcalendar docs linked above for an overview of applicable values.
240
+ </td>
241
+ </tr>
242
+ <tr>
243
+ <td>useCustomTimumCss</td>
244
+ <td>boolean, to increase responsiveness, timum overrides some fullcalendar css classes. Set this to <code>false</code> to gain total control over fullcalendar's css.
245
+ </td>
246
+ </tr>
247
+ </table>
248
+
226
249
  <a name=”app_config”></a>
227
250
 
228
251
  ### appConfig
@@ -238,6 +261,25 @@ This object's options directly affect timum's behaviour or allow you to react to
238
261
  <td>ref</td>
239
262
  <td>string, Reference of the resource to show the appointments of. <br><em> This is the only prop that is mandatory.</em><br> Everything else is optional. <br>Can also be a url parameter.</td>
240
263
  </tr>
264
+ <tr>
265
+ <td>platform</td>
266
+ <td>string, A fully qualified reference (<code>id@someUuid@platform</code>) can be unwieldy especially if used as a url param. This prop allows you to hardcode the <code>platform</code> part.
267
+ <br><br>Note that this prop is ignored if <code>ref</code> is both:
268
+ <ul>
269
+ <li>used as a url param </li>
270
+ <li>contains an @.</li>
271
+ </ul>
272
+ </td>
273
+ </tr>
274
+ <tr>
275
+ <td>prvUuid</td>
276
+ <td>string, A fully qualified reference (<code>id@someUuid@platform</code>) can be unwieldy especially if used as a url param. This prop allows you to hardcode the <code>someUuid</code> part. This part is only sometimes necessary to uniquely identify a resource in timum. <br><br>Note that this prop is ignored if <code>ref</code> is both:
277
+ <ul>
278
+ <li>used as a url param </li>
279
+ <li>contains an @.</li>
280
+ </ul>
281
+ </td>
282
+ </tr>
241
283
  <tr>
242
284
  <td>height</td>
243
285
  <td> string, Height of timum on your page. `500px` is standard.</td>
@@ -334,7 +376,7 @@ All Booking related callbacks receive a <em>single obejct</em> as argument conta
334
376
  untouchedEnd: ISO String e.g: "2023-01-27T09:35:00+01:00" as the server sent it
335
377
  }
336
378
  ```
337
- - a `data` looking like this:
379
+ - a `data` object looking like this:
338
380
 
339
381
  ```javascript
340
382
  {
@@ -343,13 +385,13 @@ All Booking related callbacks receive a <em>single obejct</em> as argument conta
343
385
  email: 'string',
344
386
  agbs: 'bool'
345
387
 
346
- // plus whatever optional and/or custom fields you yourself has defined.
388
+ // plus whatever optional and/or custom fields you yourself have defined.
347
389
  // -> so the makeup of this object changes depending on your settings.
348
390
  }
349
391
 
350
392
  ```
351
393
 
352
- 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.
394
+ Additionally, `createBookingFailed` and `createBookingSuccessfull` 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.
353
395
 
354
396
  <a name=”cancelation_related”></a>
355
397
 
@@ -559,9 +601,9 @@ localization: {
559
601
  },
560
602
  ```
561
603
 
562
- <a name=”how_to_define_fields”></a>
604
+ <a name=”bookingFormFields”></a>
563
605
 
564
- #### How to define fields
606
+ #### Booking Form Fields
565
607
 
566
608
  You can customize the information you request 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.
567
609
 
@@ -622,9 +664,15 @@ The standard configuration can be overridden except for the aforementioned field
622
664
  },
623
665
  ```
624
666
 
625
- <a name=”anatomy_of_a_field”></a>
667
+ <a name=”customFields”></a>
626
668
 
627
- ##### Anatomy of a field
669
+ ##### Custom Fields
670
+
671
+ If the values retrieved via custom fields need to be transferred to timum backend as additional booking information, set the parameter `sendCustomValuesInMessage`. With this, the values of custom fields are attached to the customer message. They will be visible to the customer as well in booking confirmation mailings.
672
+
673
+ `sendCustomValuesInMessage: true, // necessary to transmit custom field values as part of the customer message`
674
+
675
+ Anatomy of a custom booking form field:
628
676
 
629
677
  ```
630
678
  <fieldName> : {
@@ -641,6 +689,10 @@ The standard configuration can be overridden except for the aforementioned field
641
689
  }
642
690
  ```
643
691
 
692
+ fieldName
693
+
694
+ - define a field name
695
+
644
696
  Depending on the type there are additional properties you can/must specify:
645
697
 
646
698
  - Type `text`:
@@ -665,9 +717,9 @@ Type `select`:
665
717
 
666
718
  - 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.
667
719
 
668
- <a name=”an_example”></a>
720
+ <a name=”CustomFieldExample”></a>
669
721
 
670
- ### An Example
722
+ ### Custom Field Example
671
723
 
672
724
  Here is an example tying all of the aforementioned concepts together.
673
725
  And [here](https://jsfiddle.net/timum/wov6pLk7/) is a fiddle containing the very example detailed in this chapter.
@@ -682,12 +734,12 @@ It is necessary to determine the gender of customers for a specific purpose. The
682
734
 
683
735
  #### The Implementation
684
736
 
685
- This is the base configuration. As it is it uses the standard field configuration shown in [How to define fields](#howToDefineFields).
737
+ This is the base configuration. As it uses the standard field configuration shown in [Booking form fields](#bookingFormFields) :
686
738
 
687
739
  ```html
688
740
  <div id="bookingjs" style="margin: 32px"></div>
689
741
  <script type="module">
690
- import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.8.0/build/timum-booking.js';
742
+ import * as timum from 'https://cdn.timum.de/bookingjs/1/booking.js';
691
743
 
692
744
  timum.init({ ref: 'booking-widget-demo-resource@timum' });
693
745
  </script>
@@ -698,11 +750,11 @@ Let's add the necessary changes:
698
750
  ```html
699
751
  <div id="bookingjs" style="margin: 32px"></div>
700
752
  <script type="module">
701
- import * as timum from 'https://cdn.jsdelivr.net/npm/@timum/booking@0.8.0/build/timum-booking.js';
753
+ import * as timum from 'https://cdn.timum.de/bookingjs/1/booking.js';
702
754
 
703
- timum.init(
704
- {
755
+ timum.init({
705
756
  ref: 'booking-widget-demo-resource@timum',
757
+
706
758
  fields: {
707
759
  // set these fields to undefined explicitly in order to remove them
708
760
  message: undefined,
@@ -711,12 +763,12 @@ Let's add the necessary changes:
711
763
  // index defines the order in which the fields get displayed
712
764
  index: 0,
713
765
  title: 'fields.firstName',
714
- validation: yup.string().required('validation.field_required'), // <- compare with key in localisation
766
+ validation: yup.string().required('validation.field_required') // <- compare with key in localisation
715
767
  },
716
768
  lastName: {
717
769
  index: 1,
718
770
  title: 'fields.lastName',
719
- validation: yup.string().required('validation.field_required'),
771
+ validation: yup.string().required('validation.field_required')
720
772
  },
721
773
  email: {
722
774
  index: 2,
@@ -726,7 +778,7 @@ Let's add the necessary changes:
726
778
  validation: yup
727
779
  .string()
728
780
  .email('validation.email_field_must_be_valid')
729
- .required('validation.field_required'),
781
+ .required('validation.field_required')
730
782
  },
731
783
  gender: {
732
784
  index: 3,
@@ -740,8 +792,8 @@ Let's add the necessary changes:
740
792
  options: [
741
793
  { key: 'm', title: 'fields.gender.male' },
742
794
  { key: 'w', title: 'fields.gender.female' },
743
- { key: 'd', title: 'fields.gender.other' },
744
- ],
795
+ { key: 'd', title: 'fields.gender.other' }
796
+ ]
745
797
  },
746
798
  agbs: {
747
799
  index: 4,
@@ -754,9 +806,10 @@ Let's add the necessary changes:
754
806
  'privacyAccepted',
755
807
  'validation.privacy_field_required',
756
808
  (value) => value === true
757
- ),
758
- },
759
- }
809
+ )
810
+ }
811
+ },
812
+ sendCustomValuesInMessage: true, // necessary to transmit custom field values as part of the customer message
760
813
 
761
814
  // now we need to add the new translation keys and their translations.
762
815
 
@@ -771,28 +824,28 @@ Let's add the necessary changes:
771
824
  male: 'Männlich',
772
825
  female: 'Weiblich',
773
826
  other: 'Divers'
774
- },
827
+ }
775
828
  }
776
829
  },
777
830
  en: {
778
- validation: {
831
+ validation: {
779
832
  gender_field_required: 'Please select an option.'
780
833
  },
781
- fields: {
782
- gender: {
783
- title: 'Gender',
784
- male: 'Male',
785
- female: 'Female',
786
- other: 'Others'
787
- },
834
+ fields: {
835
+ gender: {
836
+ title: 'Gender',
837
+ male: 'Male',
838
+ female: 'Female',
839
+ other: 'Others'
840
+ }
788
841
  }
789
842
  }
790
- }
843
+ },
791
844
 
792
845
  // the following callback consumes the customers input, allowing you to act on
793
846
  //the entered gender value.
794
847
  callback: {
795
- createBookingStarted: ({data}) => {
848
+ createBookingStarted: ({ data }) => {
796
849
  console.log(data.gender);
797
850
  }
798
851
  }
@@ -1,4 +1,4 @@
1
- import { R as s, H as o, J as t, G as e, I as m } from "./index-ce93f3a6.js";
1
+ import { R as s, H as o, J as t, G as e, I as m } from "./index-628aaacf.js";
2
2
  export {
3
3
  s as React,
4
4
  o as TimumBooking,