@timum/booking 0.4.2 → 0.6.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/index.html ADDED
@@ -0,0 +1,568 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=1080, initial-scale=1, user-scalable=0, maximum-scale=1, minimum-scale=0.6" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta name="description" content="Web site created using create-react-app" />
9
+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png" />
10
+ <link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png" />
11
+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png" />
12
+ <link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png" />
13
+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png" />
14
+ <link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png" />
15
+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png" />
16
+ <link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png" />
17
+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png" />
18
+ <link rel="icon" href="/favicon.ico" />
19
+ <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
20
+ <link rel="icon" type="image/png" href="/favicon-194x194.png" sizes="194x194" />
21
+ <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
22
+ <link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192" />
23
+ <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
24
+
25
+ <meta name="msapplication-TileColor" content="#2b5797" />
26
+ <meta name="msapplication-TileImage" content="/mstile-144x144.png" />
27
+ <meta name="theme-color" content="#ffffff" />
28
+ <!--
29
+ manifest.json provides metadata used when your web app is installed on a
30
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
31
+ -->
32
+ <link rel="manifest" href="/manifest.json" />
33
+ <title>timum booking</title>
34
+ </head>
35
+
36
+ <body>
37
+ <noscript>You need to enable JavaScript to run this app.</noscript>
38
+ <div id="bookingjs" style="margin: 15px;"></div>
39
+ <script type="module" src="./src/index.jsx"></script>
40
+ <script type="text/javascript">
41
+ init(
42
+ {
43
+ // Reference of the resource to show the appointments of
44
+ // This is the only prop that is mandatory. Everything else is optional.
45
+ // Can also be a url parameter.
46
+ ref: "booking-widget-demo-resource@timum",
47
+
48
+ // height of timum in your page. 500px is standard.
49
+ height: '500px',
50
+
51
+ // timum has, as of now, 4 different channels through which you can share your resource's appointments.
52
+ // You can find them in the timum frontend under <resource name> -> Calendar Sharing (Terminbuchung freigeben)
53
+ // Every channel has its own settings allowing you to control whom of your customers can see certain appointments,
54
+ // whether they book directly or create an request first and other settings.
55
+ // Valid values for this attribute are:
56
+ // * RESOURCE_PUBLIC -> referring to "Public Booking Link" (Öffentlicher Buchungs-Link)
57
+ // * RESOURCE_EXCLUSIVE -> referring to "Exclusive Booking Access" (Exklusiver Buchungs-Zugang)
58
+ // * RESOURCE_REFERENCE -> referring to "Embedded booking calendars" (Eingebettete Buchungskalender)
59
+ // * CALENDAR_PUBLIC -> referring to "In all Website Plugin Views and your General Calendar" (In Website-Plugin Ansichten sowie Ihrem Gesamtkalender)
60
+ // RESOURCE_PUBLIC is the default, used if you specify nothing else.
61
+ // Can also be a url parameter.
62
+ channelKey: 'RESOURCE_PUBLIC',
63
+
64
+ // either fullCalendar or pureListView or detailsListView
65
+ calendarFrontend: 'detailsListView',
66
+
67
+ // The localisation to use. If not specified the browser language is used.
68
+ // Can also be a url parameter.
69
+ culture: "de",
70
+
71
+ // Data indentifying the customer, so that they don't have to input their data again.
72
+ // Works in conjunction with timum and select, supported plaforms like OnOffice, Immosolve etc.
73
+ // Can also be a url parameter. -> the params are named differently though: pDataPlatform, pDataId
74
+ pData: {
75
+ platform: 'timum',
76
+ personId: 'some-id'
77
+ },
78
+
79
+ // here are various callbacks which allow you to run custom code
80
+ // here is the reference for the RTKQ portions: https://redux-toolkit.js.org/rtk-query/usage-with-typescript#type-safe-error-handling
81
+ callbacks: {
82
+ // makeup of timeslot:
83
+ /*
84
+ {
85
+ "start": luxon Datetime object. Internal state. "2023-01-27T09:05:00.000Z",
86
+ "end": luxon Datetime object. Internal state. "2023-01-27T09:35:00.000Z",
87
+ "timeslot_uuid": uuid of the booked timeslot. e.g. "82ec5220-9d55-11ed-8617-e4a7a0ca32e8",
88
+ "product_uuid": uuid of the booked product e.g. "92867f70-4836-11e5-bc04-021a52c25043",
89
+ "product_name": string. e.g. "Meeting",
90
+ "resource_name": string. e.g. "Booking Widget DEMO",
91
+ "capacity": number e.g. 1,
92
+ "capacity_left": number e.g. 1,
93
+ "kind": either "models.Bookable" or "models.LotAppointment",
94
+ "untouchedStart": ISO String e.g: "2023-01-27T09:05:00+01:00" as the server sent it,
95
+ "untouchedEnd": ISO String e.g: "2023-01-27T09:35:00+01:00" as the server sent it
96
+ }
97
+ */
98
+
99
+ // makeup of data. Contains properties named after the 'fields' property placed right after 'callbacks'.
100
+ // e.g if you defined field.creditCard : {title: ..., <...>} then it's input value is stored under "creditCard".
101
+ // the fields you see here are hose present if you use timum's standard configuration.
102
+ //
103
+ // --> this allows you to evaluate the input data of your custom fields in these callbacks and act accordingly.
104
+ /*
105
+ {
106
+ "firstName": "Sebastian",
107
+ "lastName": "Müller",
108
+ "email": "sebastian@timum.de",
109
+ "agbs": true
110
+ }
111
+
112
+ */
113
+ createBookingStarted: ({ timeslot, data }) => { },
114
+ createBookingSuccessful: ({ timeslot, response /* an RTKQ response object */, data }) => { },
115
+ createBookingFailed: ({ timeslot, response/* an RTKQ response object */, data }) => { },
116
+
117
+ cancelationgStarted: ({ timeslot, response /* an RTKQ response object */ }) => { },
118
+ cancelationSuccessful: ({ timeslot, response /* an RTKQ response object */ }) => { },
119
+ cancelationFailed: ({ timeslot, response /* an RTKQ response object */ }) => { },
120
+
121
+ // these are requests collecting the necessary information to
122
+ // display the booking frontend
123
+ fetchingPublicDataSucceeded: (publicData) => { },
124
+ fetchingProductsSucceeded: (products) => { },
125
+ fetchingBookablesSucceeded: (bookables) => { },
126
+
127
+ fetchingPublicDataFailed: (error /* an RTKQ error object */) => { },
128
+ fetchingProductsFailed: (error /* an RTKQ error object */) => { },
129
+ fetchingBookablesFailed: (error /* an RTKQ error object */) => { },
130
+ },
131
+
132
+ // The standard fields displayed for unknown customers.
133
+ // You can customise what information is demanded of your customers prior to booking.
134
+ // timum only ever needs firstName, lastName, email and agbs to function (meaning you can savely remove fields 'mobile' and 'message').
135
+ // But you can also add fields of your own.
136
+ //
137
+ // See 'callbacks' to see how you can process input data of your custom fields.
138
+
139
+
140
+ /*
141
+ How to do custom fields
142
+
143
+ Anatomy of a field
144
+ <fieldName> : {
145
+ title: string or JSXElement;
146
+ validation: yup based validation. See https://github.com/jquense/yup. Re-exported and accessible via timum.yup
147
+ type: string; either 'text' (default), 'phoneNumber', 'textarea', 'checkbox' or 'select',
148
+ prefilled: string; value a fiels is initiated with. Not that for fields of type 'select' you must use the 'key' of on of it's options.
149
+ }
150
+
151
+ Depending on the type there are additional properties you can/must specify:
152
+ Type 'text':
153
+ -> format: string; the native input fields 'type' (... don't judge ^^). Can be 'email', 'number' etc.
154
+
155
+ Type 'phoneNumber':
156
+ -> does NOT support 'validation'. Phone number validation is hard. So timum does it for you.
157
+ This does mean that field validaion localisation is currently not supported for fields of this type.
158
+ This will be fixed in a future update.
159
+ -> isRequired: boolean; if true, this field must be filled with a valid number
160
+
161
+ Type 'textArea':
162
+ -> limit: number; sets the maximum number of characters customers may enter.
163
+
164
+ Type 'checkbox':
165
+ -> no special properties here
166
+
167
+ Type 'select':
168
+ -> options: array of objects. Structure { title: string, key: string };
169
+ 'title' is displayed. 'key' is what you get in the 'data' object passed into callbacks.
170
+
171
+ */
172
+
173
+ fields: {
174
+ firstName: {
175
+ title: 'fields.firstName',
176
+ validation: timum.yup.string().required('validation.field_required'), // <- compare with key in 'localisation'
177
+ },
178
+ lastName: {
179
+ title: 'fields.lastName',
180
+ validation: timum.yup.string().required('validation.field_required'),
181
+ },
182
+ email: {
183
+ title: 'fields.email',
184
+ format: 'email',
185
+ type: 'text',
186
+ validation: timum.yup
187
+ .string()
188
+ .email('validation.email_field_must_be_valid')
189
+ .required('validation.field_required'),
190
+ },
191
+ mobile: {
192
+ title: 'fields.mobile',
193
+ type: 'phoneNumber',
194
+ isRequired: false,
195
+ // validation: is in built and ignored
196
+ },
197
+ message: {
198
+ title: 'fields.message',
199
+ type: 'textarea',
200
+ validation: timum.yup.string().max(1024),
201
+ limit: 1024,
202
+ },
203
+ agbs: {
204
+ title: 'fields.accept_timum_privacy',
205
+ type: 'checkbox',
206
+ validation: timum.yup
207
+ .boolean()
208
+ .required('validation.field_required')
209
+ .test(
210
+ 'privacyAccepted',
211
+ 'validation.privacy_field_required',
212
+ (value) => value === true
213
+ ),
214
+ },
215
+ },
216
+
217
+ // Here are all localization variables and their standard texts.
218
+ // You may change the texts as you see fit.
219
+ // timum supports de and en out of the box.
220
+ // You can easily expand this with fr or it (or any other language)
221
+ // by adding it to the localization object below and translating all of the variables.
222
+ localization: {
223
+ de: {
224
+ product_selection_headline: 'Terminart wählen',
225
+ booked_successfully_header: 'Termin gebucht',
226
+ booked_successfully_message:
227
+ 'Sie erhalten eine E-Mail mit den Termindetails an {{mail}}',
228
+ requested_successfully_header: 'Termin angefragt',
229
+ requested_successfully_message:
230
+ 'Sie erhalten eine E-Mail mit den Termindetails an {{mail}}. Sie werden unter der gleichen Adresse benachrichtigt, sobald Ihre Anfrage bearbeitet wurde.',
231
+ submit_button_book: 'Buchen',
232
+ submit_button_request: 'Verbindlich Anfragen',
233
+
234
+ noEventsMessage:
235
+ 'Zur Zeit sind leider keine buchbaren Termine verfügbar.',
236
+ appoinment_at_capacity: 'vollständig ausgebucht',
237
+ add_to_calendar_btn: 'Zu Kalender hinzufügen',
238
+ until_reservation_expiration:
239
+ '{{expiration}} bis zum Ablauf der Reservierung',
240
+ reservation_expired: 'Reservierung abgelaufen.',
241
+ identified_customer_hint:
242
+ 'Sie wurden mit persönlichem Link eingeladen und können direkt Ihren Termin buchen.',
243
+ cancellation: {
244
+ cancelation_successfull_message: 'Termin erfolgreich abgesagt',
245
+ cancellable_appointment_highlight: 'Mein Termin',
246
+ submit_button_cancel: 'Absagen',
247
+ cancel_appointment_header: 'Ihr Termin',
248
+ message_label: 'Nachricht zur Terminabsage',
249
+ },
250
+ // if you have additional fields with their own validation texts you can add
251
+ // translation keys here and reference them in your custom fields validation.
252
+ // e.g. If you were to add the key 'valid_credit_card' here, you could reference it in your credit card field with 'validation.valid_credit_card'.
253
+ validation: {
254
+ field_required: 'Notwendig',
255
+ privacy_field_required:
256
+ 'Sie müssen die Datenschutzbestimmungen akzeptieren bevor Sie buchen können.',
257
+ email_field_must_be_valid: 'Geben Sie eine valide E-Mail Adresse ein',
258
+ },
259
+ // Similarly to additional validation texts for your custom fields above,
260
+ // Similarly to additional validation texts for your custom fields above,
261
+ // Similarly to additional validation texts for your custom fields above,
262
+ // you can also add custom labels for them.
263
+ // you can also add custom labels for them.
264
+ // you can also add custom labels for them.
265
+ // e.g. add creditCard here and reference it in your custom field's 'title' with 'fields.creditCard'
266
+ fields: {
267
+ firstName: 'Vorname',
268
+ lastName: 'Nachname',
269
+ name: 'Name',
270
+ email: 'E-Mail',
271
+ mobile: 'Mobil',
272
+ message: 'Ihre Nachricht',
273
+ accept_timum_privacy:
274
+ 'Datenschutzbestimmungen gelesen und akzeptiert',
275
+ },
276
+ },
277
+ // the same for english.
278
+ en: {
279
+ product_selection_headline: 'Choose Product',
280
+ booked_successfully_header: 'Appoinment Booked',
281
+ booked_successfully_message:
282
+ 'You will receive an email with appointment details to {{mail}}',
283
+ requested_successfully_header: 'Appointment Requested',
284
+ requested_successfully_message:
285
+ 'You will receive an email with appointment details to {{mail}}. You will be notified at the same address once your request has been processed.',
286
+ submit_button_book: 'Book',
287
+ submit_button_request: 'Request',
288
+
289
+ noEventsMessage:
290
+ 'Unfortunately, there are no bookable dates available at the moment.',
291
+ appoinment_at_capacity: 'fully booked',
292
+ add_to_calendar_btn: 'Add to Calendar',
293
+ until_reservation_expiration:
294
+ '{{expiration}} until reservation expiration.',
295
+ reservation_expired: 'Reservation expired.',
296
+ identified_customer_hint:
297
+ 'You have been invited with a personal link and can book your appointment directly.',
298
+ cancellation: {
299
+ cancelation_successfull_message: 'Appointment canceled sucessfully.',
300
+ cancellable_appointment_highlight: 'My Appointment',
301
+ submit_button_cancel: 'Cancel',
302
+ cancel_appointment_header: 'Your Appointment',
303
+ message_label: 'You may enter a reason here.',
304
+ },
305
+ validation: {
306
+ field_required: 'Required',
307
+ privacy_field_required:
308
+ 'You must accept the privacy policy prior to booking.',
309
+ email_field_must_be_valid: 'Enter a valid email address',
310
+ },
311
+ fields: {
312
+ firstName: 'First name',
313
+ lastName: 'Last name',
314
+ name: 'name',
315
+ email: 'E-mail',
316
+ mobile: 'Mobile',
317
+ message: 'Your Message',
318
+ accept_timum_privacy: '<0>Privacy policy</0> read and accepted.',
319
+ },
320
+ },
321
+ },
322
+ },
323
+ {
324
+ // This is a mui theme object. Documentation: https://mui.com/material-ui/customization/default-theme/
325
+ // If you are in a professional plan you can customise the look and feel of timum booking to your hearts content.
326
+ // otherwise timum's standard theme is used.
327
+
328
+ // Here is an example which alters some aspects of the standard timum theme.
329
+ // (Based on https://github.com/app-generator/react-berry-dashboard)
330
+ palette: {
331
+ common: {
332
+ black: '#000000'
333
+ },
334
+ primary: {
335
+ light: '#b39ddb',
336
+ main: '#5e35b1',
337
+ },
338
+ secondary: {
339
+ light: '#ede7f6',
340
+ main: '#673ab7',
341
+ dark: '#5e35b1'
342
+ },
343
+ error: {
344
+ main: '#f44336',
345
+ },
346
+ warning: {
347
+ main: '#ffe57f',
348
+ },
349
+ success: {
350
+ main: '#00e676',
351
+ },
352
+ grey: {
353
+ 50: '#fafafa',
354
+ 100: '#f5f5f5',
355
+ 500: '#9e9e9e',
356
+ 600: '#757575',
357
+ 700: '#616161',
358
+ 900: '#212121'
359
+ },
360
+ text: {
361
+ primary: '#616161',
362
+ secondary: '#9e9e9e',
363
+ dark: '#212121',
364
+ hint: '#f5f5f5'
365
+ },
366
+ },
367
+ typography: {
368
+ fontFamily: "'Inter', sans-serif",
369
+ fontSize: "16px",
370
+ h6: {
371
+ fontWeight: 500,
372
+ color: '#757575',
373
+ fontSize: '0.75rem'
374
+ },
375
+ h5: {
376
+ fontSize: '0.875rem',
377
+ color: '#757575',
378
+ fontWeight: 500
379
+ },
380
+ h4: {
381
+ fontSize: '1rem',
382
+ color: '#757575',
383
+ fontWeight: 600
384
+ },
385
+ h3: {
386
+ fontSize: '1.25rem',
387
+ color: '#757575',
388
+ fontWeight: 600
389
+ },
390
+ h2: {
391
+ fontSize: '1.5rem',
392
+ color: '#757575',
393
+ fontWeight: 700
394
+ },
395
+ h1: {
396
+ fontSize: '2.125rem',
397
+ color: '#757575',
398
+ fontWeight: 700
399
+ },
400
+ subtitle1: {
401
+ fontSize: '0.875rem',
402
+ fontWeight: 500,
403
+ color: '#212121'
404
+ },
405
+ subtitle2: {
406
+ fontSize: '0.75rem',
407
+ fontWeight: 400,
408
+ color: '#9e9e9e'
409
+ },
410
+ caption: {
411
+ fontSize: '0.75rem',
412
+ color: '#9e9e9e',
413
+ fontWeight: 400
414
+ },
415
+ body1: {
416
+ fontSize: '0.875rem',
417
+ fontWeight: 400,
418
+ lineHeight: '1.334'
419
+ },
420
+ body2: {
421
+ fontSize: '0.800rem',
422
+ letterSpacing: '0em',
423
+ fontWeight: 400,
424
+ lineHeight: '1.5',
425
+ color: '#616161'
426
+ },
427
+ },
428
+ components: {
429
+ MuiButton: {
430
+ styleOverrides: {
431
+ root: {
432
+ fontWeight: 500,
433
+ textTransform: 'capitalize',
434
+ borderRadius: '16px'
435
+ }
436
+ }
437
+ },
438
+ MuiPaper: {
439
+ defaultProps: {
440
+ elevation: 0
441
+ },
442
+ styleOverrides: {
443
+ root: {
444
+ backgroundImage: 'none'
445
+ },
446
+ rounded: {
447
+ borderRadius: '16px'
448
+ }
449
+ }
450
+ },
451
+
452
+ MuiCardContent: {
453
+ styleOverrides: {
454
+ root: {
455
+ padding: '12px'
456
+ }
457
+ }
458
+ },
459
+ MuiCardActions: {
460
+ styleOverrides: {
461
+ root: {
462
+ padding: '12px'
463
+ }
464
+ }
465
+ },
466
+ MuiListItem: {
467
+ styleOverrides: {
468
+ root: {
469
+ borderRadius: '16px'
470
+ }
471
+ }
472
+ },
473
+ MuiListItemButton: {
474
+ styleOverrides: {
475
+ root: {
476
+ color: '#616161',
477
+ paddingTop: '10px',
478
+ paddingBottom: '10px',
479
+ borderRadius: '16px',
480
+ '&:hover': {
481
+ backgroundColor: '#ede7f6',
482
+ color: '#ede7f6',
483
+ '& .MuiListItemIcon-root': {
484
+ color: '#5e35b1'
485
+ }
486
+ }
487
+ }
488
+ }
489
+ },
490
+ MuiListItemIcon: {
491
+ styleOverrides: {
492
+ root: {
493
+ color: '#616161',
494
+ minWidth: '36px'
495
+ }
496
+ }
497
+ },
498
+ MuiListItemText: {
499
+ styleOverrides: {
500
+ primary: {
501
+ color: '#212121'
502
+ },
503
+ borderRadius: '16px',
504
+ }
505
+ },
506
+ MuiInputBase: {
507
+ styleOverrides: {
508
+ input: {
509
+ color: '#212121',
510
+ '&::placeholder': {
511
+ color: '#212121',
512
+ fontSize: '0.875rem'
513
+ }
514
+ }
515
+ }
516
+ },
517
+ MuiOutlinedInput: {
518
+ styleOverrides: {
519
+ root: {
520
+ background: '#fafafa',
521
+ borderRadius: '16px',
522
+ '& .MuiOutlinedInput-notchedOutline': {
523
+ borderColor: '#bdbdbd'
524
+ },
525
+ '&:hover $notchedOutline': {
526
+ borderColor: '#e3f2fd'
527
+ },
528
+ '&.MuiInputBase-multiline': {
529
+ padding: 1
530
+ }
531
+ },
532
+ input: {
533
+ fontWeight: 500,
534
+ background: '#fafafa',
535
+ padding: '15.5px 14px',
536
+ borderRadius: '16px',
537
+ '&.MuiInputBase-inputSizeSmall': {
538
+ padding: '10px 14px',
539
+ '&.MuiInputBase-inputAdornedStart': {
540
+ paddingLeft: 0
541
+ }
542
+ }
543
+ },
544
+ inputAdornedStart: {
545
+ paddingLeft: 4
546
+ },
547
+ notchedOutline: {
548
+ borderRadius: '16px'
549
+ }
550
+ }
551
+ },
552
+ }
553
+ }
554
+ );
555
+ </script>
556
+ <!--
557
+ This HTML file is a template.
558
+ If you open it directly in the browser, you will see an empty page.
559
+
560
+ You can add webfonts, meta tags, or analytics to this file.
561
+ The build step will place the bundled scripts into the <body> tag.
562
+
563
+ To begin the development, run `npm start` or `yarn start`.
564
+ To create a production bundle, use `npm run build` or `yarn build`.
565
+ -->
566
+ </body>
567
+
568
+ </html>
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@timum/booking",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "license": "CC-BY-ND-4.0",
5
- "main": "build/timum-booking.js",
5
+ "main": "build/timum-booking.umd.js",
6
6
  "module": "build/timum-booking.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./build/timum-booking.mjs",
10
+ "require": "./build/timum-booking.umd.js"
11
+ }
12
+ },
7
13
  "publishConfig": {
8
14
  "access": "public"
9
15
  },
@@ -31,7 +37,6 @@
31
37
  "@testing-library/user-event": "^13.5.0",
32
38
  "@timum/timum_pdk": "^2.0.2",
33
39
  "add-to-calendar-button": "^1.18.8",
34
- "create-react-app": "^5.0.1",
35
40
  "i18next": "^21.10.0",
36
41
  "i18next-browser-languagedetector": "^6.1.5",
37
42
  "lodash": "4.17.21",
@@ -52,14 +57,15 @@
52
57
  "react-virtualized-auto-sizer": "^1.0.6",
53
58
  "react-window": "^1.8.6",
54
59
  "reactjs-localstorage": "^1.0.1",
55
- "rewire": "^6.0.0",
56
60
  "uuid": "^8.3.2",
57
61
  "web-vitals": "^2.1.4",
58
62
  "yup": "^0.32.11"
59
63
  },
60
64
  "scripts": {
61
- "start": "react-scripts start",
62
- "build": "node ./build.js && rollup --config",
65
+ "start": "vite",
66
+ "build": "vite build",
67
+ "buildDev": "vite build --mode development",
68
+ "serve": "vite preview",
63
69
  "np:preview": "np --no-cleanup --preview",
64
70
  "np:publish": "yarn build && np --no-cleanup",
65
71
  "co:login": "aws codeartifact login --tool npm --repository timum --domain timum --domain-owner 075866820991 --namespace @timum-private",
@@ -99,25 +105,16 @@
99
105
  ]
100
106
  },
101
107
  "devDependencies": {
102
- "@babel/plugin-transform-modules-amd": "^7.16.7",
103
- "@babel/plugin-transform-runtime": "^7.19.6",
104
- "@babel/preset-env": "^7.20.2",
105
- "@babel/preset-react": "^7.18.6",
106
108
  "@faker-js/faker": "^7.5.0",
107
- "@rollup/plugin-babel": "^6.0.3",
108
- "@rollup/plugin-commonjs": "^23.0.5",
109
- "@rollup/plugin-node-resolve": "^15.0.1",
110
- "@rollup/plugin-terser": "^0.4.0",
111
109
  "@storybook/addon-actions": "^6.5.7",
112
110
  "@storybook/addon-essentials": "^6.5.7",
113
111
  "@storybook/addon-interactions": "^6.5.7",
114
112
  "@storybook/addon-links": "^6.5.7",
115
- "@storybook/builder-webpack5": "^6.5.7",
116
- "@storybook/manager-webpack5": "^6.5.7",
113
+ "@storybook/builder-vite": "^0.4.0",
117
114
  "@storybook/node-logger": "^6.5.7",
118
- "@storybook/preset-create-react-app": "^4.1.2",
119
115
  "@storybook/react": "^6.5.7",
120
116
  "@storybook/testing-library": "^0.0.13",
117
+ "@vitejs/plugin-react": "^3.1.0",
121
118
  "css-loader": "^6.7.1",
122
119
  "eslint": "^8.17.0",
123
120
  "eslint-config-prettier": "^8.5.0",
@@ -127,13 +124,8 @@
127
124
  "mini-css-extract-plugin": "^1.2.0",
128
125
  "msw": "^0.39.2",
129
126
  "msw-storybook-addon": "^1.6.3",
130
- "rollup": "^3.7.4",
131
- "rollup-plugin-peer-deps-external": "^2.2.4"
132
- },
133
- "babel": {
134
- "presets": [
135
- "@babel/preset-env"
136
- ]
127
+ "vite": "^4.1.1",
128
+ "vite-plugin-svgr": "^2.4.0"
137
129
  },
138
130
  "msw": {
139
131
  "workerDirectory": "public"
package/vite.config.js ADDED
@@ -0,0 +1,29 @@
1
+ import { defineConfig } from 'vite';
2
+ import { resolve } from 'path';
3
+ import react from '@vitejs/plugin-react';
4
+ import svgrPlugin from 'vite-plugin-svgr';
5
+
6
+ export default defineConfig({
7
+ define: { 'process.env.NODE_ENV': '"production"' },
8
+ plugins: [react(), svgrPlugin()],
9
+ build: {
10
+ outDir: 'build',
11
+ lib: {
12
+ entry: resolve(__dirname, './src/index.jsx'),
13
+ name: 'timum',
14
+ fileName: 'timum-booking',
15
+ },
16
+ server: {
17
+ open: true,
18
+ },
19
+ // rollupOptions: {
20
+ // external: ['react', 'react-dom'],
21
+ // output: {
22
+ // globals: {
23
+ // react: 'React',
24
+ // 'react-dom': 'ReactDOM',
25
+ // },
26
+ // },
27
+ // },
28
+ },
29
+ });