ti2-ventrata 1.0.34 → 1.0.36

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.js CHANGED
@@ -378,18 +378,22 @@ class Plugin {
378
378
  })) : [];
379
379
  // for answers to custom fields, ventrata suggest to modify the booking
380
380
  if (answers.length) {
381
- const modifierBooking = {
381
+ let modifierBooking = {
382
382
  questionAnswers: booking.questionAnswers.map(o => {
383
383
  const answer = answers.find(a => a.questionId === o.questionId);
384
384
  return answer || o;
385
385
  }),
386
386
  unitItems: booking.unitItems.map(u => ({
387
+ ...u,
387
388
  questionAnswers: u.questionAnswers.map(o => {
388
389
  const answer = answers.find(a => a.questionId === o.questionId);
389
390
  return answer || o;
390
391
  }),
391
- })).filter(u => u.questionAnswers.length),
392
+ })),
392
393
  };
394
+ if (!modifierBooking.unitItems.find(u => u.questionAnswers && u.questionAnswers.length)) {
395
+ modifierBooking = R.omit(['unitItems'], modifierBooking);
396
+ }
393
397
  booking = R.path(['data'], await axios({
394
398
  method: 'patch',
395
399
  url: `${endpoint || this.endpoint}/bookings/${booking.uuid}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-ventrata",
3
- "version": "1.0.34",
3
+ "version": "1.0.36",
4
4
  "description": "Ventrata's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,8 +27,12 @@ const resolvers = {
27
27
  dateTimeStart: root => R.path(['localDateTimeStart'], root) || R.path(['localDate'], root),
28
28
  dateTimeEnd: root => R.path(['localDateTimeEnd'], root) || R.path(['localDate'], root),
29
29
  allDay: R.path(['allDay']),
30
- vacancies: R.prop('vacancies'),
31
- available: root => root.status !== 'SOLD_OUT' && root.vacancies > 0,
30
+ vacancies: R.propOr(99, 'vacancies'),
31
+ available: root => {
32
+ if (root.available === true) return true;
33
+ if (root.status === 'FREESALE') return true;
34
+ return root.status !== 'SOLD_OUT' && root.vacancies > 0;
35
+ },
32
36
  offers: root => R.pathOr([], ['offers'], root).map(o => ({
33
37
  offerId: o.code,
34
38
  title: o.title,