@timum/booking 1.9.0 → 1.10.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/README.md CHANGED
@@ -60,6 +60,9 @@ This documentation guides you through all the customization capabilities.
60
60
 
61
61
  <a name=”in-a-script-tag”></a>
62
62
 
63
+ These are some minimal examples. BookingJs is highly customizable.
64
+ An overview over all configuration options can be found in [Advanced Customisation](#advanced-usage)
65
+
63
66
  ### In a Script Tag
64
67
 
65
68
  Add the following code to your webpage:
@@ -109,6 +112,30 @@ init({ ref: 'booking-widget-demo-resource@timum' });
109
112
 
110
113
  A example project can be found [here](https://stackblitz.com/edit/react-8q6r8b?file=src/index.js)
111
114
 
115
+ ### As React component import
116
+
117
+ 1. Add timum booking to your project with
118
+ `yarn add @timum/booking`
119
+ or use npm with
120
+ `npm install @timum/booking`
121
+ <br>
122
+ 2. Add the following code anywhere in your jsx:
123
+
124
+ ```javascript
125
+ import { TimumBooking } from '@timum/booking';
126
+
127
+ // other code
128
+
129
+ <TimumBooking
130
+ appConfig={{
131
+ ref: 'booking-widget-demo-resource@timum'
132
+ // other options
133
+ }}
134
+ />;
135
+
136
+ // other code
137
+ ```
138
+
112
139
  <a name="entity-referencing"></a>
113
140
 
114
141
  ### Entity Referencing
@@ -335,10 +362,6 @@ This object's options directly affect timum's behaviour or allow you to react to
335
362
  <tr>
336
363
  <td>sendCustomValuesInMessage</td>
337
364
  <td>boolean, whether values of custom fields are concatenated and comma-separated into a single string which is then sent to the backend as <code>message</code>. If field <code>message</code> is defined its input is concatenated to the generated string as well.</td>
338
- </tr>
339
- <tr>
340
- <td>gatherAddressData</td>
341
- <td>boolean, adds the fields <code>street</code>, <code>zipCode</code> and <code>city</code> in their default configuration to the booking page. You may also redefine/override them in the <code>fields</code> object, which supersedes this setting (needs professional plan). timum handles address data in a best effort basis, meaning it tries to parse the data and sync it to connected CRM systems, if possible.</td>
342
365
  </tr>
343
366
  <tr>
344
367
  <td>channelKey</td>
@@ -351,7 +374,13 @@ This object's options directly affect timum's behaviour or allow you to react to
351
374
  </tr>
352
375
  <tr>
353
376
  <td>calendarFrontend</td>
354
- <td>string, one of <code>fullCalendar</code> (that's what `init`'s 3rd parameter is for), <code>pureListView</code> or <code>detailsListView</code></td>
377
+ <td>string, one of <code>fullCalendar</code>, <code>detailsFullCalendar</code> (these are what `init`'s 3rd parameter is for), <code>pureListView</code>, <code>detailsListView</code>, <code>condensedView</code> or <code>detailsCondensedView</code>
378
+ <br>
379
+ <br>
380
+ <blockquote>
381
+ Note: the <code>details</code> variants show details about the resource, like the description and the external url, as well as public information about the assigned consultant, if the channel allows that.
382
+ </blockquote>
383
+ </td>
355
384
  </tr>
356
385
  <tr>
357
386
  <td>culture</td>
@@ -672,8 +701,6 @@ localization: {
672
701
 
673
702
  You can customize the information you request from customers before booking by defining fields. The minimum required fields for timum are <code>firstName</code>, <code>lastName</code>, <code>email</code>, and <code>agbs</code>. By default, timum also requests <code>mobile</code> and <code>message</code> fields, but you can add your own fields as well.
674
703
 
675
- Supported, but not present by default are the fields <code>street</code>, <code>zipCode</code> and <code>city</code>. You can activate them setting <code>gatherAddressData</code>, or by redefining fields with the same name as custom fields (see below).
676
-
677
704
  Fields, including custom ones, support validation and localization.
678
705
  Validation is realized using the yup library, which is included with timum. You can import it using the following code:
679
706
 
@@ -683,7 +710,7 @@ import { yup } from '@timum/booking';
683
710
 
684
711
  Localization is achieved by using the title property in the field definition. You can specify a translation key and add the corresponding translation to the localization object. The same process can be applied to custom field validations.
685
712
 
686
- The standard configuration can be overridden except for the aforementioned fields. The following is the standard configuration:
713
+ The standard configuration can be overridden except for the aforementioned, required fields. The following is the standard configuration:
687
714
 
688
715
  ```javascript
689
716
  fields: {
@@ -716,24 +743,6 @@ fields: {
716
743
  preferredCountries: ['DE', 'CH', 'AT'],
717
744
  // validation: is in built and ignored
718
745
  },
719
- street: {
720
- index: 4,
721
- title: 'fields.street',
722
- validation: yup.string().required('validation.field_required'),
723
- ignore: true, // gets filtered by default. Set gatherAddressData: true to activate this field. Or just add it to your custom field config.
724
- },
725
- zipCode: {
726
- index: 5,
727
- title: 'fields.zipCode',
728
- validation: yup.string().required('validation.field_required'),
729
- ignore: true, // gets filtered by default. Set gatherAddressData: true to activate this field. Or just add it to your custom field config.
730
- },
731
- city: {
732
- index: 6,
733
- title: 'fields.city',
734
- validation: yup.string().required('validation.field_required'),
735
- ignore: true, // gets filtered by default. Set gatherAddressData: true to activate this field. Or just add it to your custom field config.
736
- },
737
746
  message: {
738
747
  index: 7,
739
748
  title: 'fields.message',
@@ -779,25 +788,52 @@ If the values retrieved via custom fields need to be transferred to timum backen
779
788
 
780
789
  Anatomy of a custom booking form field:
781
790
 
782
- ```
783
- <fieldName> : {
784
- index: number, index defines the order in which the fields get displayed.
785
- (If you want to reorder the default fields or
786
- want to inject a custom field between them,
787
- you must redefine them as custom fields and manually change their indexes.)
788
- title: string or JSXElement;
789
- validation: yup based validation. See https://github.com/jquense/yup. Re-exported and accessible via timum.yup
790
- type: string; either 'text' (default), 'phoneNumber', 'textarea', 'checkbox' or 'select',
791
- onChange: function, allows to execute code whenever the user changes the fields value. Gets 'value' as function parameter.
792
- prefilled: string; value a field is initiated with.
793
- Note that for fields of type 'select' you must use the 'key' of one of it's options.
794
- preventRendering: boolean, default false;
795
- if true the field is not visible to the user.
796
- Useful in conjunction with sendCustomValuesInMessage allowing you to
797
- enrich booked appointments with internal data
798
- without the customer becoming aware of your internal processes.
799
- }
800
- ```
791
+ `<fieldName> : {`
792
+
793
+ <blockquote>
794
+ <code>index</code>: number, index defines the order in which the fields get displayed.
795
+ (If you want to reorder the default fields or
796
+ want to inject a custom field between them,
797
+ you must redefine them as custom fields and manually change their indexes.)
798
+ </blockquote>
799
+ <br>
800
+ <blockquote>
801
+ <code>title</code>: string or JSXElement;
802
+ validation: yup based validation. See <a href="https://github.com/jquense/yup">yup docu</a>. Re-exported and accessible via timum.yup
803
+
804
+ </blockquote>
805
+ <br>
806
+ <blockquote>
807
+ <code>type</code>: string; either 'text' (default), 'phoneNumber', 'textarea', 'checkbox' or 'select'. Depending on the chosen type additional properties are available. See below.
808
+ </blockquote>
809
+ <br>
810
+ <blockquote>
811
+ <code>onChange</code>: function, allows to execute code whenever the user changes the fields value. Gets 'value' as function parameter.
812
+ </blockquote>
813
+ <br>
814
+ <blockquote>
815
+ <code>prefilled</code>: string; value a field is initiated with.
816
+ Note that for fields of type 'select' you must use the 'key' of one of it's options.
817
+ </blockquote>
818
+ <br>
819
+ <blockquote>
820
+ <code>preventRendering</code>: boolean, default false;
821
+ if true the field is not visible to the user.
822
+ Useful in conjunction with sendCustomValuesInMessage allowing you to
823
+ enrich booked appointments with internal data
824
+ without the customer becoming aware of your internal processes.
825
+ </blockquote>
826
+ <br>
827
+ <blockquote>
828
+ <code>preventRenderingFor</code>: array, prevents rendering of the field on the set booking screens. Valid values are
829
+ 'identifiedCustomers' or 'unknownCustomers', which prevents rendering on the booking
830
+ screen shown to identified/unidentified customers, respectively. If both
831
+ 'identifiedCustomers' and 'unknownCustomers' are set the behaviour is equal to
832
+ preventRendering.
833
+ Note that fields hidden in this manner get their validation disabled. This
834
+ ensures that the booking doesn't fail with a validation error the end user is unable to fix.
835
+ </blockquote>
836
+ `}`
801
837
 
802
838
  fieldName
803
839
 
@@ -807,23 +843,23 @@ Depending on the type there are additional properties you can/must specify:
807
843
 
808
844
  - Type `text`:
809
845
 
810
- - `format`: string; the native input field's 'type' (e.g. 'email', 'number', etc.).
846
+ - `format`: string; the native input field's 'type' (e.g. 'email', 'number', etc.).
811
847
 
812
848
  - Type `phoneNumber`:
813
849
 
814
- - does NOT support `validation`. Phone number validation is complex, so timum handles it for you.
815
- This does mean that field validation localisation is currently not supported for fields of this type.
816
- This will be fixed in a future update.
817
- - isRequired: boolean; if true, this field must be filled with a valid number
818
- - defaultCountry: string, denotes the country code which is preselected when first rendering the component. Default is 'DE',
819
- - preferredCountries: list of strings; denotes which countries are displayed first in the country drop down. Defaults are ['DE', 'CH', 'AT'],
850
+ - does NOT support `validation`. Phone number validation is complex, so timum handles it for you.
851
+ This does mean that field validation localisation is currently not supported for fields of this type.
852
+ This will be fixed in a future update.
853
+ - isRequired: boolean; if true, this field must be filled with a valid number
854
+ - defaultCountry: string, denotes the country code which is preselected when first rendering the component. Default is 'DE',
855
+ - preferredCountries: list of strings; denotes which countries are displayed first in the country drop down. Defaults are ['DE', 'CH', 'AT'],
820
856
 
821
857
  - Type `textArea`:
822
858
 
823
- - limit: number; sets the maximum number of characters customers can enter.
859
+ - limit: number; sets the maximum number of characters customers can enter.
824
860
 
825
861
  - Type `checkbox`:
826
- - no special properties.
862
+ - no special properties.
827
863
 
828
864
  Type `select`:
829
865