@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
@@ -2,7 +2,7 @@ import { h, F as Fragment, r as registerInstance, c as createEvent, H as Host, a
2
2
  import { N as NylasBaseProvider } from './abstract-provider-C4xP8KoA.js';
3
3
  import { N as NylasIdentityRequestWrapper } from './nylas-api-request-CWLncKIc.js';
4
4
  import { d as dayjs, u as utc, t as timezone, a as debug, b as dataResponse, g as getCalendarRange, e as error, C as CONFIGURATION_EVENT_TYPE, L as LANGUAGE_CODE, i as instance, c as LANGUAGE_MAP } from './utils-DfIu4gMZ.js';
5
- import { o as o$1, v as version, E as ErrorCategory, N as NotificationType } from './version-Ce04N_Lo.js';
5
+ import { o as o$1, v as version, E as ErrorCategory, N as NotificationType } from './version-iQhY7wWk.js';
6
6
  import { c as createStore } from './index-DVBNi-yR.js';
7
7
 
8
8
  dayjs.extend(utc);
@@ -1,7 +1,7 @@
1
1
  import { h, F as Fragment, r as registerInstance, c as createEvent, H as Host, a as getElement } from './index-0EQQA0nE.js';
2
2
  import { N as NylasBaseProvider } from './abstract-provider-C4xP8KoA.js';
3
3
  import { n as normalizeSupportedLanguageCode, L as LANGUAGE_CODE, i as instance, f as normalizeDateInput, h as addDaysToCurrentDate, a as debug, j as detectBrowserLanguageCode, k as compactStringToUUIDs, l as LANGUAGE_CODE_TO_LOCALE_MAP, m as capitalizeFirstLetter, c as LANGUAGE_MAP } from './utils-DfIu4gMZ.js';
4
- import { E as ErrorCategory, v as version, u } from './version-Ce04N_Lo.js';
4
+ import { E as ErrorCategory, v as version, u } from './version-iQhY7wWk.js';
5
5
  import { c as createStore } from './index-DVBNi-yR.js';
6
6
  import { i as isInitialized, a as init, f as feedbackSyncIntegration, c as captureMessage, b as captureFeedback } from './feedbackSync-B8tfyAQm.js';
7
7
 
@@ -175,6 +175,9 @@ class NylaSchedulerAPIConnector {
175
175
  body,
176
176
  signal,
177
177
  });
178
+ if (response.status === 204) {
179
+ return { data: undefined };
180
+ }
178
181
  const data = await response.json();
179
182
  return data;
180
183
  }
@@ -251,6 +254,27 @@ class NylaSchedulerAPIConnector {
251
254
  },
252
255
  });
253
256
  }
257
+ setGuests(guestEmails) {
258
+ const { bookingInfo } = this.schedulerStore.state;
259
+ this.schedulerStore.set('bookingInfo', {
260
+ ...bookingInfo,
261
+ primaryParticipant: bookingInfo?.primaryParticipant,
262
+ guests: guestEmails.map(email => ({ name: email, email })),
263
+ });
264
+ }
265
+ setAdditionalFields(additionalFields) {
266
+ const { bookingInfo } = this.schedulerStore.state;
267
+ const existing = bookingInfo?.additionalFields ?? {};
268
+ const merged = { ...existing };
269
+ Object.entries(additionalFields).forEach(([key, value]) => {
270
+ merged[key] = { ...existing[key], value };
271
+ });
272
+ this.schedulerStore.set('bookingInfo', {
273
+ ...bookingInfo,
274
+ primaryParticipant: bookingInfo?.primaryParticipant,
275
+ additionalFields: merged,
276
+ });
277
+ }
254
278
  async refetchAvailability() {
255
279
  const today = new Date();
256
280
  const startTime = new Date(today.getFullYear(), today.getMonth(), 1).getTime() / 1000;
@@ -1338,6 +1362,21 @@ const NylasScheduling = class {
1338
1362
  }
1339
1363
  const result = await this.nylasSchedulerConnector?.scheduler.bookTimeslot(bookingData);
1340
1364
  if (!result || 'error' in result) {
1365
+ if (this.isTimeslotUnavailableError(result?.error)) {
1366
+ this.nylasSchedulerInfo.emit({
1367
+ notification: {
1368
+ title: 'Timeslot no longer available',
1369
+ category: ErrorCategory.Component,
1370
+ type: u.Info,
1371
+ description: 'That time was just booked. Here are the latest available times.',
1372
+ id: new Date().getTime().toString(),
1373
+ ttl: 3000,
1374
+ },
1375
+ host: this.host,
1376
+ });
1377
+ await this.nylasSchedulerConnector?.scheduler.toggleAdditionalData(false);
1378
+ return;
1379
+ }
1341
1380
  this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(result?.error) }, host: this.host });
1342
1381
  }
1343
1382
  const resultData = result?.data;
@@ -1435,6 +1474,10 @@ const NylasScheduling = class {
1435
1474
  async getRef() {
1436
1475
  return this.host;
1437
1476
  }
1477
+ isTimeslotUnavailableError(error) {
1478
+ const message = error?.message?.toLowerCase().trim() ?? '';
1479
+ return message.includes('the selected timeslot is unavailable');
1480
+ }
1438
1481
  getErrorObject(error) {
1439
1482
  return {
1440
1483
  title: error?.title || genericError.title,