@nylas/web-elements 2.5.16 → 2.5.18

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 (64) hide show
  1. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +1 -1
  2. package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +316 -270
  3. package/dist/cjs/google-logo-icon_6.cjs.entry.js +1 -1
  4. package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js +15 -3
  5. package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js.map +1 -1
  6. package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
  7. package/dist/cjs/nylas-scheduling.cjs.entry.js +44 -1
  8. package/dist/cjs/nylas-scheduling.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nylas-scheduling.entry.cjs.js.map +1 -1
  10. package/dist/cjs/{version-Cc3rTMtG.js → version-Xu0ORQw8.js} +3 -3
  11. package/dist/cjs/{version-Cc3rTMtG.js.map → version-Xu0ORQw8.js.map} +1 -1
  12. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +48 -3
  13. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -1
  14. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js +20 -1
  15. package/dist/collection/components/scheduler/nylas-scheduling/nylas-scheduling.js.map +1 -1
  16. package/dist/collection/connector/shared/api/scheduler.js +24 -0
  17. package/dist/collection/connector/shared/api/scheduler.js.map +1 -1
  18. package/dist/collection/version.js +1 -1
  19. package/dist/collection/version.js.map +1 -1
  20. package/dist/components/nylas-booking-form.js +1 -1
  21. package/dist/components/nylas-editor-tabs-group.js +1 -1
  22. package/dist/components/nylas-editor-tabs.js +1 -1
  23. package/dist/components/nylas-scheduler-editor.js +3 -3
  24. package/dist/components/nylas-scheduling.js +45 -2
  25. package/dist/components/nylas-scheduling.js.map +1 -1
  26. package/dist/components/{p-BJsBeE4_.js → p-BGCZ4yg1.js} +3 -3
  27. package/dist/components/{p-BJsBeE4_.js.map → p-BGCZ4yg1.js.map} +1 -1
  28. package/dist/components/{p-DRMxunL6.js → p-DQNm7dzQ.js} +3 -3
  29. package/dist/components/{p-DRMxunL6.js.map → p-DQNm7dzQ.js.map} +1 -1
  30. package/dist/components/{p-KzMRmaBa.js → p-DRXHxMKj.js} +3 -3
  31. package/dist/components/{p-KzMRmaBa.js.map → p-DRXHxMKj.js.map} +1 -1
  32. package/dist/components/{p-B3cnALr8.js → p-WABPA0YV.js} +17 -5
  33. package/dist/components/p-WABPA0YV.js.map +1 -0
  34. package/dist/esm/google-logo-icon_6.entry.js +1 -1
  35. package/dist/esm/nylas-booked-event-card_11.entry.js +15 -3
  36. package/dist/esm/nylas-booked-event-card_11.entry.js.map +1 -1
  37. package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
  38. package/dist/esm/nylas-scheduling.entry.js +44 -1
  39. package/dist/esm/nylas-scheduling.entry.js.map +1 -1
  40. package/dist/esm/{version-Ce04N_Lo.js → version-iQhY7wWk.js} +3 -3
  41. package/dist/esm/{version-Ce04N_Lo.js.map → version-iQhY7wWk.js.map} +1 -1
  42. package/dist/nylas-web-elements/nylas-scheduling.entry.esm.js.map +1 -1
  43. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  44. package/dist/nylas-web-elements/{p-ff693a85.entry.js → p-1401a68f.entry.js} +2 -2
  45. package/dist/nylas-web-elements/p-4d04cfe9.entry.js +2 -0
  46. package/dist/nylas-web-elements/p-4d04cfe9.entry.js.map +1 -0
  47. package/dist/nylas-web-elements/{p-71137e94.entry.js → p-7b8b7718.entry.js} +2 -2
  48. package/dist/nylas-web-elements/p-cb33346f.entry.js +2 -0
  49. package/dist/nylas-web-elements/p-cb33346f.entry.js.map +1 -0
  50. package/dist/nylas-web-elements/{p-Ce04N_Lo.js → p-iQhY7wWk.js} +2 -2
  51. package/dist/nylas-web-elements/{p-Ce04N_Lo.js.map → p-iQhY7wWk.js.map} +1 -1
  52. package/dist/types/components/scheduler/nylas-booking-form/nylas-booking-form.d.ts +2 -0
  53. package/dist/types/components/scheduler/nylas-scheduling/nylas-scheduling.d.ts +1 -0
  54. package/dist/types/components.d.ts +10 -0
  55. package/dist/types/connector/shared/api/scheduler.d.ts +2 -0
  56. package/dist/types/version.d.ts +1 -1
  57. package/package.json +1 -1
  58. package/dist/components/p-B3cnALr8.js.map +0 -1
  59. package/dist/nylas-web-elements/p-b607eace.entry.js +0 -2
  60. package/dist/nylas-web-elements/p-b607eace.entry.js.map +0 -1
  61. package/dist/nylas-web-elements/p-c7f4c268.entry.js +0 -2
  62. package/dist/nylas-web-elements/p-c7f4c268.entry.js.map +0 -1
  63. /package/dist/nylas-web-elements/{p-ff693a85.entry.js.map → p-1401a68f.entry.js.map} +0 -0
  64. /package/dist/nylas-web-elements/{p-71137e94.entry.js.map → p-7b8b7718.entry.js.map} +0 -0
@@ -4,7 +4,7 @@ var index$1 = require('./index-9TuL48qE.js');
4
4
  var abstractProvider = require('./abstract-provider-EX4lu0u8.js');
5
5
  var nylasApiRequest = require('./nylas-api-request-8qsFHWUt.js');
6
6
  var utils = require('./utils-BDriE9YY.js');
7
- var version = require('./version-Cc3rTMtG.js');
7
+ var version = require('./version-Xu0ORQw8.js');
8
8
  var index = require('./index-CwlXqyvH.js');
9
9
 
10
10
  utils.dayjs.extend(utils.utc);
@@ -3,7 +3,7 @@
3
3
  var index$1 = require('./index-9TuL48qE.js');
4
4
  var abstractProvider = require('./abstract-provider-EX4lu0u8.js');
5
5
  var utils = require('./utils-BDriE9YY.js');
6
- var version = require('./version-Cc3rTMtG.js');
6
+ var version = require('./version-Xu0ORQw8.js');
7
7
  var index = require('./index-CwlXqyvH.js');
8
8
  var feedbackSync = require('./feedbackSync-Bcx7mZ9-.js');
9
9
 
@@ -177,6 +177,9 @@ class NylaSchedulerAPIConnector {
177
177
  body,
178
178
  signal,
179
179
  });
180
+ if (response.status === 204) {
181
+ return { data: undefined };
182
+ }
180
183
  const data = await response.json();
181
184
  return data;
182
185
  }
@@ -253,6 +256,27 @@ class NylaSchedulerAPIConnector {
253
256
  },
254
257
  });
255
258
  }
259
+ setGuests(guestEmails) {
260
+ const { bookingInfo } = this.schedulerStore.state;
261
+ this.schedulerStore.set('bookingInfo', {
262
+ ...bookingInfo,
263
+ primaryParticipant: bookingInfo?.primaryParticipant,
264
+ guests: guestEmails.map(email => ({ name: email, email })),
265
+ });
266
+ }
267
+ setAdditionalFields(additionalFields) {
268
+ const { bookingInfo } = this.schedulerStore.state;
269
+ const existing = bookingInfo?.additionalFields ?? {};
270
+ const merged = { ...existing };
271
+ Object.entries(additionalFields).forEach(([key, value]) => {
272
+ merged[key] = { ...existing[key], value };
273
+ });
274
+ this.schedulerStore.set('bookingInfo', {
275
+ ...bookingInfo,
276
+ primaryParticipant: bookingInfo?.primaryParticipant,
277
+ additionalFields: merged,
278
+ });
279
+ }
256
280
  async refetchAvailability() {
257
281
  const today = new Date();
258
282
  const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;
@@ -1340,6 +1364,21 @@ const NylasScheduling = class {
1340
1364
  }
1341
1365
  const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(bookingData);
1342
1366
  if (!result || 'error' in result) {
1367
+ if (this.isTimeslotUnavailableError(result?.error)) {
1368
+ this.nylasSchedulerInfo.emit({
1369
+ notification: {
1370
+ title: 'Timeslot no longer available',
1371
+ category: version.ErrorCategory.Component,
1372
+ type: version.u.Info,
1373
+ description: 'That time was just booked. Here are the latest available times.',
1374
+ id: new Date().getTime().toString(),
1375
+ ttl: 3000,
1376
+ },
1377
+ host: this.host,
1378
+ });
1379
+ await this.nylasSchedulerConnector?.scheduler.toggleAdditionalData(false);
1380
+ return;
1381
+ }
1343
1382
  this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });
1344
1383
  }
1345
1384
  const resultData = result?.data;
@@ -1437,6 +1476,10 @@ const NylasScheduling = class {
1437
1476
  async getRef() {
1438
1477
  return this.host;
1439
1478
  }
1479
+ isTimeslotUnavailableError(error) {
1480
+ const message = error?.message?.toLowerCase().trim() ?? '';
1481
+ return message.includes('the selected timeslot is unavailable');
1482
+ }
1440
1483
  getErrorObject(error) {
1441
1484
  return {
1442
1485
  title: error?.title || genericError.title,