@nylas/react 1.0.1-prealpha1 → 1.0.2-canary.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.
Files changed (124) hide show
  1. package/dist/add-circle-icon_13.entry-6dccb5e5.cjs +1 -0
  2. package/dist/add-circle-icon_13.entry-ab84be80.js +1050 -0
  3. package/dist/{archive-icon_7.entry-baecb43c.cjs → archive-icon_7.entry-0deb31c2.cjs} +1 -1
  4. package/dist/{archive-icon_7.entry-9f3eca2c.js → archive-icon_7.entry-187a3484.js} +20 -20
  5. package/dist/arrow-icon.entry-b782e05a.js +15 -0
  6. package/dist/{arrow-icon.entry-9ab0c414.cjs → arrow-icon.entry-fb0ebc89.cjs} +1 -1
  7. package/dist/auth-store-764d3768-3e9c24a0.js +66 -0
  8. package/dist/auth-store-764d3768-ce84fc6a.cjs +1 -0
  9. package/dist/{bold-icon_3.entry-50406bc7.cjs → bold-icon_3.entry-49e5a1d0.cjs} +1 -1
  10. package/dist/{bold-icon_3.entry-b0d81839.js → bold-icon_3.entry-8aebbbdb.js} +4 -4
  11. package/dist/{calendar-cancel-icon.entry-0d07e33c.js → calendar-cancel-icon.entry-305c099c.js} +2 -2
  12. package/dist/{calendar-cancel-icon.entry-8f498984.cjs → calendar-cancel-icon.entry-3f4d6cf2.cjs} +1 -1
  13. package/dist/calendar-check-icon_2.entry-1bf4163c.js +25 -0
  14. package/dist/calendar-check-icon_2.entry-fa7c033a.cjs +1 -0
  15. package/dist/{calendar-icon.entry-219efd7a.cjs → calendar-icon.entry-78433555.cjs} +1 -1
  16. package/dist/{calendar-icon.entry-e5f20598.js → calendar-icon.entry-b5678535.js} +7 -7
  17. package/dist/chevron-icon.entry-49b0d3e7.cjs +1 -0
  18. package/dist/{chevron-icon.entry-f5d5d1b1.js → chevron-icon.entry-f484c9a3.js} +5 -5
  19. package/dist/close-icon.entry-24d5c268.js +15 -0
  20. package/dist/close-icon.entry-37965d55.cjs +1 -0
  21. package/dist/{nylas-booked-event-card_10.entry-f2481a57.js → constants-d93cf397-dd67263d.js} +1636 -2376
  22. package/dist/{nylas-booked-event-card_10.entry-27efa654.cjs → constants-d93cf397-e3587f5c.cjs} +6 -6
  23. package/dist/document-refresh-icon.entry-0e8935fa.cjs +1 -0
  24. package/dist/{document-refresh-icon.entry-89ad42fa.js → document-refresh-icon.entry-8791ab16.js} +5 -5
  25. package/dist/elements/index.d.ts +16 -0
  26. package/dist/{forward-icon_6.entry-ce725f05.cjs → forward-icon_6.entry-903ccd33.cjs} +3 -3
  27. package/dist/{forward-icon_6.entry-0a6dff18.js → forward-icon_6.entry-cb605bfc.js} +82 -82
  28. package/dist/globe-icon_3.entry-71d83904.js +109 -0
  29. package/dist/globe-icon_3.entry-c6aefc52.cjs +1 -0
  30. package/dist/{index-b30d446a-e0eaccad.js → index-10914bc1-1a809477.js} +2 -2
  31. package/dist/{index-b30d446a-3d69a3cc.cjs → index-10914bc1-93ff6f46.cjs} +1 -1
  32. package/dist/index-cee193d2.cjs +30 -0
  33. package/dist/index-e834697b.js +1562 -0
  34. package/dist/index.d.ts +1 -1
  35. package/dist/info-icon.entry-3774a4e3.js +15 -0
  36. package/dist/info-icon.entry-85bf3fbc.cjs +1 -0
  37. package/dist/loading-icon.entry-8941102c.js +15 -0
  38. package/dist/{loading-icon.entry-d2680046.cjs → loading-icon.entry-ae6c7b74.cjs} +1 -1
  39. package/dist/mailbox-store-6b9425dc-a0366cf2.cjs +1 -0
  40. package/dist/{mailbox-store-19f0c6c9-23a4e72f.js → mailbox-store-6b9425dc-c249fa99.js} +59 -121
  41. package/dist/nylas-booked-event-card_10.entry-a166d51d.js +739 -0
  42. package/dist/nylas-booked-event-card_10.entry-b181a874.cjs +1 -0
  43. package/dist/nylas-form-card.entry-7173dd4a.js +56 -0
  44. package/dist/nylas-form-card.entry-8fdbefa6.cjs +1 -0
  45. package/dist/nylas-if-state_3.entry-2093c593.cjs +1 -0
  46. package/dist/{nylas-if-state_3.entry-d805d4c6.js → nylas-if-state_3.entry-e7b615a1.js} +12 -10
  47. package/dist/{nylas-list-folders.entry-472bd255.js → nylas-list-folders.entry-744293ae.js} +9 -8
  48. package/dist/nylas-list-folders.entry-dff7a835.cjs +1 -0
  49. package/dist/{nylas-list-threads.entry-f3266bf7.js → nylas-list-threads.entry-85ad1b74.js} +5 -4
  50. package/dist/nylas-list-threads.entry-edb1d265.cjs +1 -0
  51. package/dist/{nylas-mailbox-pagination.entry-bd0d3bda.js → nylas-mailbox-pagination.entry-55ef4b8c.js} +4 -3
  52. package/dist/nylas-mailbox-pagination.entry-5b888a0e.cjs +1 -0
  53. package/dist/nylas-mailbox-toolbar-button.entry-bb42156a.cjs +1 -0
  54. package/dist/{nylas-mailbox-toolbar-button.entry-9641b5cd.js → nylas-mailbox-toolbar-button.entry-bdcf7d17.js} +9 -8
  55. package/dist/nylas-open-hours-picker.entry-0f4f34f6.cjs +1 -0
  56. package/dist/{nylas-open-hours-picker.entry-42942946.js → nylas-open-hours-picker.entry-7e7060fe.js} +59 -58
  57. package/dist/nylas-provider.entry-1dc58829.js +155 -0
  58. package/dist/nylas-provider.entry-cb1ef04e.cjs +1 -0
  59. package/dist/nylas-scheduler-config.entry-2382ac1b.js +114 -0
  60. package/dist/nylas-scheduler-config.entry-477d2171.cjs +1 -0
  61. package/dist/nylas-scheduler-editor.entry-1a95d313.cjs +1 -0
  62. package/dist/nylas-scheduler-editor.entry-c0479087.js +140 -0
  63. package/dist/nylas-scheduler.entry-69ecc3ae.cjs +1 -0
  64. package/dist/{nylas-scheduler.entry-3b7cb841.js → nylas-scheduler.entry-7084c148.js} +20 -19
  65. package/dist/nylas-threads-refresh.entry-b35f1b68.cjs +1 -0
  66. package/dist/{nylas-threads-refresh.entry-7d567ed1.js → nylas-threads-refresh.entry-ef5d6dfd.js} +13 -12
  67. package/dist/nylas-threads-search.entry-2dda7524.cjs +1 -0
  68. package/dist/{nylas-threads-search.entry-c881d54b.js → nylas-threads-search.entry-e570bf8e.js} +13 -12
  69. package/dist/nylas-view-thread.entry-1ee0680f.cjs +1 -0
  70. package/dist/{nylas-view-thread.entry-d8de6c83.js → nylas-view-thread.entry-3939c913.js} +5 -4
  71. package/dist/people-icon.entry-4a88822e.cjs +1 -0
  72. package/dist/people-icon.entry-69465395.js +15 -0
  73. package/dist/{play-icon_2.entry-cae94826.js → play-icon_2.entry-bc24fda7.js} +6 -6
  74. package/dist/play-icon_2.entry-bd9f650e.cjs +1 -0
  75. package/dist/react.cjs +1 -1
  76. package/dist/react.js +74 -58
  77. package/dist/{refresh-icon.entry-3e0aef26.cjs → refresh-icon.entry-678f92e7.cjs} +1 -1
  78. package/dist/{refresh-icon.entry-9563850b.js → refresh-icon.entry-bd2bf7ce.js} +4 -4
  79. package/dist/{register-component-152c6ad2-418db864.js → register-component-486ea571-1f151779.js} +2 -2
  80. package/dist/{register-component-152c6ad2-b0d34c36.cjs → register-component-486ea571-cdfe1ef9.cjs} +1 -1
  81. package/dist/scheduler-config-store-a059f30b-06c1aa21.cjs +1 -0
  82. package/dist/scheduler-config-store-a059f30b-ff3efc00.js +33 -0
  83. package/dist/{scheduler-store-7d48e682-39104219.js → scheduler-store-81058220-263a5f44.js} +53 -45
  84. package/dist/scheduler-store-81058220-a20698af.cjs +1 -0
  85. package/dist/translate-icon.entry-0c0dbba6.cjs +1 -0
  86. package/dist/translate-icon.entry-c1fcd2f8.js +15 -0
  87. package/dist/utils-df5c1963-1c47e21c.cjs +8 -0
  88. package/dist/utils-df5c1963-d9833bcb.js +2114 -0
  89. package/dist/warning-icon.entry-9631cd2e.js +15 -0
  90. package/dist/warning-icon.entry-dbd44cdb.cjs +1 -0
  91. package/package.json +6 -3
  92. package/dist/add-circle-icon.entry-4b8debfa.js +0 -15
  93. package/dist/add-circle-icon.entry-c5fdaa6f.cjs +0 -1
  94. package/dist/arrow-icon.entry-a3b36218.js +0 -15
  95. package/dist/calendar-check-icon_3.entry-5415e916.cjs +0 -1
  96. package/dist/calendar-check-icon_3.entry-cfb612c6.js +0 -35
  97. package/dist/chevron-icon.entry-3c709061.cjs +0 -1
  98. package/dist/close-icon_2.entry-eca351c4.js +0 -25
  99. package/dist/close-icon_2.entry-fa4f6d3e.cjs +0 -1
  100. package/dist/document-refresh-icon.entry-3a29a6e6.cjs +0 -1
  101. package/dist/globe-icon.entry-71414bc6.js +0 -15
  102. package/dist/globe-icon.entry-a0c9599a.cjs +0 -1
  103. package/dist/index-586a4206.cjs +0 -30
  104. package/dist/index-98d3a4da.js +0 -1498
  105. package/dist/loading-icon.entry-15debb7d.js +0 -15
  106. package/dist/mailbox-store-19f0c6c9-9a3ef58a.cjs +0 -1
  107. package/dist/nylas-if-state_3.entry-6c0bf8eb.cjs +0 -1
  108. package/dist/nylas-list-folders.entry-cc04a07e.cjs +0 -1
  109. package/dist/nylas-list-threads.entry-795c5a2b.cjs +0 -1
  110. package/dist/nylas-mailbox-pagination.entry-f701fd83.cjs +0 -1
  111. package/dist/nylas-mailbox-toolbar-button.entry-b9d6a3c8.cjs +0 -1
  112. package/dist/nylas-open-hours-picker.entry-aa103daf.cjs +0 -1
  113. package/dist/nylas-provider.entry-5bb55b2d.cjs +0 -1
  114. package/dist/nylas-provider.entry-b94198a1.js +0 -134
  115. package/dist/nylas-scheduler.entry-ea6fb146.cjs +0 -1
  116. package/dist/nylas-threads-refresh.entry-4002608b.cjs +0 -1
  117. package/dist/nylas-threads-search.entry-556f1219.cjs +0 -1
  118. package/dist/nylas-view-thread.entry-6faf1b51.cjs +0 -1
  119. package/dist/play-icon_2.entry-2e21b8b9.cjs +0 -1
  120. package/dist/scheduler-store-7d48e682-449277d4.cjs +0 -1
  121. package/dist/search-icon_3.entry-9b027cfc.cjs +0 -1
  122. package/dist/search-icon_3.entry-e36548ec.js +0 -101
  123. package/dist/utils-5074a070-ce33ee6b.js +0 -119
  124. package/dist/utils-5074a070-d5ba6add.cjs +0 -2
@@ -1,24 +1,25 @@
1
- import { r as y, c as D, h, H as M, g as H } from "./index-98d3a4da.js";
2
- import { d as f, g as b, c as w } from "./utils-5074a070-ce33ee6b.js";
3
- import { t as p, d as c, a as T, b as m } from "./duration-bddc4a13-179ce826.js";
1
+ import { r as y, c as D, h, H as M, g as H } from "./index-e834697b.js";
2
+ import { d as p, g as b, c as w } from "./utils-df5c1963-d9833bcb.js";
3
+ import { t as f, d as c, a as T, b as m } from "./duration-bddc4a13-179ce826.js";
4
4
  import "react";
5
5
  import "react-dom";
6
- const S = p((t) => {
6
+ import "./_commonjsHelpers-57e89916-af061c86.js";
7
+ const S = f((t) => {
7
8
  t.setTime(t - t.getMilliseconds() - t.getSeconds() * T);
8
9
  }, (t, e) => {
9
10
  t.setTime(+t + e * c);
10
11
  }, (t, e) => (e - t) / c, (t) => t.getMinutes()), k = S.range;
11
- p((t) => {
12
+ f((t) => {
12
13
  t.setUTCSeconds(0, 0);
13
14
  }, (t, e) => {
14
15
  t.setTime(+t + e * c);
15
16
  }, (t, e) => (e - t) / c, (t) => t.getUTCMinutes());
16
- const x = p((t) => {
17
+ const x = f((t) => {
17
18
  t.setTime(t - t.getMilliseconds() - t.getSeconds() * T - t.getMinutes() * c);
18
19
  }, (t, e) => {
19
20
  t.setTime(+t + e * m);
20
21
  }, (t, e) => (e - t) / m, (t) => t.getHours()), v = x.range;
21
- p((t) => {
22
+ f((t) => {
22
23
  t.setUTCMinutes(0, 0, 0);
23
24
  }, (t, e) => {
24
25
  t.setTime(+t + e * m);
@@ -27,12 +28,12 @@ const C = ':host{display:block;font-size:inherit;font-family:inherit;--nylas-gri
27
28
  constructor(t) {
28
29
  y(this, t), this.openHoursChanged = D(this, "openHoursChanged", 7), this.dragStartTime = 0, this.onSelectedHoursWeel = (e) => {
29
30
  e.preventDefault(), e.stopPropagation();
30
- const { deltaY: s } = e, a = s > 0 ? -1 : 1;
31
- if (this.intervalMinutes === this.stepMinutes && a === -1 || this.intervalMinutes === 60 && a === 1)
31
+ const { deltaY: s } = e, i = s > 0 ? -1 : 1;
32
+ if (this.intervalMinutes === this.stepMinutes && i === -1 || this.intervalMinutes === 60 && i === 1)
32
33
  return;
33
- this.intervalMinutes = this.intervalMinutes + a * this.stepMinutes;
34
- const i = new Date(this.startTime);
35
- i.setHours(this.endTime.getHours(), 0, 0, 0), this.intervalMinutes < 60 ? this.times = k(this.startTime, i, this.intervalMinutes) : this.times = v(this.startTime, i, this.intervalMinutes / 60);
34
+ this.intervalMinutes = this.intervalMinutes + i * this.stepMinutes;
35
+ const a = new Date(this.startTime);
36
+ a.setHours(this.endTime.getHours(), 0, 0, 0), this.intervalMinutes < 60 ? this.times = k(this.startTime, a, this.intervalMinutes) : this.times = v(this.startTime, a, this.intervalMinutes / 60);
36
37
  }, this.onContextMenu = (e) => {
37
38
  e.preventDefault(), e.stopPropagation(), this.inverse = !this.inverse;
38
39
  }, this.onMouseDown = (e, s) => {
@@ -40,92 +41,92 @@ const C = ':host{display:block;font-size:inherit;font-family:inherit;--nylas-gri
40
41
  }, this.onMouseOver = (e, s) => {
41
42
  this.isDragging() && (this.draggingEndDate = s);
42
43
  }, this.onMouseUp = (e, s) => {
43
- if (this.host.querySelectorAll(".hovered").forEach((i) => {
44
- i.classList.remove("hovered");
44
+ if (this.host.querySelectorAll(".hovered").forEach((a) => {
45
+ a.classList.remove("hovered");
45
46
  }), this.isDragging() && this.draggingStartDate && this.draggingEndDate) {
46
- const i = [];
47
+ const a = [];
47
48
  let r = this.draggingStartDate, o = this.draggingEndDate;
48
49
  o.setMinutes(o.getMinutes() + this.intervalMinutes);
49
50
  const n = r.getDay(), u = o.getDay();
50
51
  if (n === u)
51
- i.push({ start: r, end: o });
52
+ a.push({ start: r, end: o });
52
53
  else if (u > n)
53
54
  for (let l = 0; l <= u - n; l++) {
54
55
  const d = new Date(r), g = new Date(r);
55
- d.setDate(r.getDate() + l), g.setDate(r.getDate() + l), g.setHours(o.getHours()), i.push({ start: d, end: g });
56
+ d.setDate(r.getDate() + l), g.setDate(r.getDate() + l), g.setHours(o.getHours()), a.push({ start: d, end: g });
56
57
  }
57
- for (let l of i)
58
+ for (let l of a)
58
59
  this.updateAvailableTimes(l.start, l.end);
59
60
  }
60
61
  this.draggingStartDate = null, this.draggingEndDate = null, e.preventDefault(), e.stopPropagation();
61
62
  }, this.onTimeClick = (e) => {
62
63
  if (this.isDragging()) {
63
- f("dragging for more than threshold, skipping click event");
64
+ p("dragging for more than threshold, skipping click event");
64
65
  return;
65
66
  }
66
67
  this.draggingStartDate = null;
67
- const s = new Date(e), a = new Date(e);
68
- a.setMinutes(a.getMinutes() + this.intervalMinutes), this.updateAvailableTimes(s, a);
68
+ const s = new Date(e), i = new Date(e);
69
+ i.setMinutes(i.getMinutes() + this.intervalMinutes), this.updateAvailableTimes(s, i);
69
70
  }, this.isDragging = () => {
70
71
  const e = (/* @__PURE__ */ new Date()).getTime();
71
72
  return this.draggingStartDate && e - this.dragStartTime > this.dragThreshold;
72
73
  }, this.updateAvailableTimes = (e, s) => {
73
- const { availableTimes: a } = this, i = a.findIndex((n) => e.getTime() >= n.start.getTime() && s.getTime() <= n.end.getTime());
74
- if (i !== -1) {
75
- a.splice(i, 1), this.availableTimes = [...a];
74
+ const { availableTimes: i } = this, a = i.findIndex((n) => e.getTime() >= n.start.getTime() && s.getTime() <= n.end.getTime());
75
+ if (a !== -1) {
76
+ i.splice(a, 1), this.availableTimes = [...i];
76
77
  return;
77
78
  }
78
- const r = a.findIndex((n) => e.getTime() === n.end.getTime());
79
+ const r = i.findIndex((n) => e.getTime() === n.end.getTime());
79
80
  if (r !== -1) {
80
- a[r].end = s, this.availableTimes = [...a];
81
+ i[r].end = s, this.availableTimes = [...i];
81
82
  return;
82
83
  }
83
- const o = a.findIndex((n) => s.getTime() === n.start.getTime());
84
+ const o = i.findIndex((n) => s.getTime() === n.start.getTime());
84
85
  if (o !== -1) {
85
- a[o].start = e, this.availableTimes = [...a];
86
+ i[o].start = e, this.availableTimes = [...i];
86
87
  return;
87
88
  }
88
- this.availableTimes = [...a, { start: e, end: s }];
89
+ this.availableTimes = [...i, { start: e, end: s }];
89
90
  }, this.isAvailableTime = (e) => this.availableTimes.some((s) => s.start.getTime() <= e.getTime() && s.end.getTime() > e.getTime()), this.getSelectedDate = (e) => {
90
91
  const s = new Date(this.startTime);
91
92
  s.setDate(e % 7 + 1);
92
- const a = Math.floor(e / 7);
93
- return s.setHours(this.times[a].getHours()), s.setMinutes(this.times[a].getMinutes()), s;
93
+ const i = Math.floor(e / 7);
94
+ return s.setHours(this.times[i].getHours()), s.setMinutes(this.times[i].getMinutes()), s;
94
95
  }, this.isHovering = (e) => !this.draggingStartDate || !this.draggingEndDate ? !1 : e.getDay() >= this.draggingStartDate.getDay() && e.getHours() >= this.draggingStartDate.getHours() && e.getHours() <= this.draggingEndDate.getHours() && e.getDay() <= this.draggingEndDate.getDay(), this.calculateAvailableTimes = (e) => {
95
96
  const s = [];
96
- for (const a of e)
97
- for (const i of a.days) {
98
- if (a.start === a.end)
97
+ for (const i of e)
98
+ for (const a of i.days) {
99
+ if (i.start === i.end)
99
100
  continue;
100
- const [r, o] = a.start.split(":").map((g) => parseInt(g, 10)), [n, u] = a.end.split(":").map((g) => parseInt(g, 10)), l = new Date(this.startTime);
101
- l.setDate(l.getDate() + i), l.setHours(r), l.setMinutes(o);
101
+ const [r, o] = i.start.split(":").map((g) => parseInt(g, 10)), [n, u] = i.end.split(":").map((g) => parseInt(g, 10)), l = new Date(this.startTime);
102
+ l.setDate(l.getDate() + a), l.setHours(r), l.setMinutes(o);
102
103
  const d = new Date(this.startTime);
103
- d.setDate(d.getDate() + i), d.setHours(n), d.setMinutes(u), s.push({ start: l, end: d });
104
+ d.setDate(d.getDate() + a), d.setHours(n), d.setMinutes(u), s.push({ start: l, end: d });
104
105
  }
105
- return s.sort((a, i) => a.start.getTime() - i.start.getTime()), f("availableTimes", s), s;
106
+ return s.sort((i, a) => i.start.getTime() - a.start.getTime()), p("availableTimes", s), s;
106
107
  }, this.calculateOpenHours = () => {
107
108
  const e = {}, s = [];
108
- let a = [...this.availableTimes];
109
- if (a.sort((i, r) => i.start.getTime() - r.start.getTime()), this.inverse) {
110
- const i = [...a];
111
- a = [];
109
+ let i = [...this.availableTimes];
110
+ if (i.sort((a, r) => a.start.getTime() - r.start.getTime()), this.inverse) {
111
+ const a = [...i];
112
+ i = [];
112
113
  let r = this.startTime;
113
- for (const o of i) {
114
+ for (const o of a) {
114
115
  const n = o.start;
115
- a.push({ start: r, end: n }), r = o.end;
116
+ i.push({ start: r, end: n }), r = o.end;
116
117
  }
117
- a.push({ start: r, end: this.endTime });
118
+ i.push({ start: r, end: this.endTime });
118
119
  }
119
- a.sort((i, r) => i.start.getTime() - r.start.getTime());
120
- for (const i of a) {
121
- const r = i.start.getDay(), o = i.end.getDay(), n = new Date(i.start);
122
- n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), (r > o || o > r) && (a.push({ start: n, end: i.end }), i.end = new Date(i.start), i.end.setHours(23, 0, 0, 0));
123
- const u = b(i.start), l = b(i.end), d = `${u}-${l}`;
120
+ i.sort((a, r) => a.start.getTime() - r.start.getTime());
121
+ for (const a of i) {
122
+ const r = a.start.getDay(), o = a.end.getDay(), n = new Date(a.start);
123
+ n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), (r > o || o > r) && (i.push({ start: n, end: a.end }), a.end = new Date(a.start), a.end.setHours(23, 0, 0, 0));
124
+ const u = b(a.start), l = b(a.end), d = `${u}-${l}`;
124
125
  e[d] ? e[d].push(r) : e[d] = [r];
125
126
  }
126
- for (const i in e) {
127
- const [r, o] = i.split("-"), u = {
128
- days: e[i],
127
+ for (const a in e) {
128
+ const [r, o] = a.split("-"), u = {
129
+ days: e[a],
129
130
  start: r,
130
131
  end: o,
131
132
  timezone: w()
@@ -134,8 +135,8 @@ const C = ':host{display:block;font-size:inherit;font-family:inherit;--nylas-gri
134
135
  }
135
136
  this.openHoursChanged.emit(s);
136
137
  }, this.getNumberOfDatesBetween = (e, s) => {
137
- const a = Math.abs(s.getTime() - e.getTime());
138
- return Math.ceil(a / (1e3 * 60 * 60 * 24));
138
+ const i = Math.abs(s.getTime() - e.getTime());
139
+ return Math.ceil(i / (1e3 * 60 * 60 * 24));
139
140
  }, this.openHours = [], this.startTime = new Date(2024, 8, 1, 8, 0, 0, 0), this.endTime = new Date(2024, 8, 7, 18, 0, 0, 0), this.stepMinutes = 15, this.dragThreshold = 150, this.mobileViewPortWidth = 768, this.intervalMinutes = 60, this.times = [], this.availableTimes = [], this.draggingStartDate = null, this.draggingEndDate = null, this.inverse = !1, this.isMobile = !1;
140
141
  }
141
142
  componentWillLoad() {
@@ -157,17 +158,17 @@ const C = ':host{display:block;font-size:inherit;font-family:inherit;--nylas-gri
157
158
  this.isMobile = t <= this.mobileViewPortWidth;
158
159
  }
159
160
  render() {
160
- return h(M, { key: "d5bbd9de6ab37f3f65d15b3dc5707b01a851956d" }, h("div", { key: "5ff3bdae2037ba3899332c0aca490c2b4cc80196", class: "open-hours", part: "open-hours" }, h("div", { key: "c8de6bcc08a63326182fad04ea4e1808c628c609", class: "days", part: "days" }, Array.from({ length: this.getNumberOfDatesBetween(this.startTime, this.endTime) }).map((t, e) => {
161
+ return h(M, { key: "7d7260510342c7d666f9596eddee704088451dbb" }, h("div", { key: "8ebc305e29157af40c432ec8ff0e182c206cfda0", class: "open-hours", part: "open-hours" }, h("div", { key: "df2e84e8387773ff864c56b78d5fbb3f8f7db606", class: "days", part: "days" }, Array.from({ length: this.getNumberOfDatesBetween(this.startTime, this.endTime) }).map((t, e) => {
161
162
  const s = new Date(this.startTime);
162
163
  return s.setDate(s.getDate() + e), h("span", null, s.toLocaleDateString(void 0, { weekday: this.isMobile ? "short" : "long" }));
163
- })), h("div", { key: "3592ca8e4b4de1302cca7fdca24cfb6ed09c7d41", class: "hours", part: "hours" }, this.times.map((t) => h("span", null, t.toLocaleTimeString(void 0, { timeStyle: "short" })))), h("div", { key: "48ead6932850e177cfbd43a6227720c8c86145ea", class: {
164
+ })), h("div", { key: "88dff2631e52fed25458d0545dfaba0e0586b8ec", class: "hours", part: "hours" }, this.times.map((t) => h("span", null, t.toLocaleTimeString(void 0, { timeStyle: "short" })))), h("div", { key: "53f658bf52ea9367376fb297ce50d8849bf99841", class: {
164
165
  "selected-hours": !0,
165
166
  inverse: this.inverse
166
167
  }, part: "selected-hours", onWheel: this.onSelectedHoursWeel, onContextMenu: this.onContextMenu }, Array.from({ length: this.getNumberOfDatesBetween(this.startTime, this.endTime) * this.times.length }).map((t, e) => h("div", { part: "hour", class: {
167
168
  hour: !0,
168
169
  selected: this.isAvailableTime(this.getSelectedDate(e)),
169
170
  hovered: this.isHovering(this.getSelectedDate(e))
170
- }, onMouseDown: (s) => this.onMouseDown(s, this.getSelectedDate(e)), onMouseUp: (s) => this.onMouseUp(s, this.getSelectedDate(e)), onMouseOver: (s) => this.onMouseOver(s, this.getSelectedDate(e)), onClick: () => this.onTimeClick(this.getSelectedDate(e)) }, " ")))), h("div", { key: "ca2aa5bef7a0e31b29b4a1a759fcefcabc6f0785", class: "legend", part: "legend" }, h("div", { key: "a7b3b3a0a02c8dfbac69f8cad10c392e3a2e3e84", class: "available", part: "available" }, h("span", { key: "dcfcd5d5fd2934672fb0069825ab98e50c886682", class: "box", part: "box" }), h("span", { key: "37cc29e78d063c1087d46a1cc5de6dbe46677031", class: "label", part: "label" }, "Available")), h("div", { key: "9db85b0c8c208aa764f2ea0c6e3371dcea0594e0", class: "unavailable", part: "unavailable" }, h("span", { key: "c0a3ef91cc2a8f418329d2c6d91feb7d90e4658f", class: "box", part: "box" }), h("span", { key: "0f21587a4222836b2273e19094b8c0c35b88de20", class: "label", part: "label" }, "Unavailable"))));
171
+ }, onMouseDown: (s) => this.onMouseDown(s, this.getSelectedDate(e)), onMouseUp: (s) => this.onMouseUp(s, this.getSelectedDate(e)), onMouseOver: (s) => this.onMouseOver(s, this.getSelectedDate(e)), onClick: () => this.onTimeClick(this.getSelectedDate(e)) }, " ")))), h("div", { key: "2f0459102a39a37ee38ff550b7fe7d303bfa9fef", class: "legend", part: "legend" }, h("div", { key: "b2ce6eb4496270ae2577164f2fecb9145e7120d5", class: "available", part: "available" }, h("span", { key: "0fe60c643e3d9cee77509109bbb99059f1900716", class: "box", part: "box" }), h("span", { key: "3f03d82fe8b20dab316910ced828682880057a4d", class: "label", part: "label" }, "Available")), h("div", { key: "188ea3df5640bcd2fe197bf00e2dfd4ede0189cf", class: "unavailable", part: "unavailable" }, h("span", { key: "9b313c8a36f2752a8327612efd665ea275175fb5", class: "box", part: "box" }), h("span", { key: "772d25822bd93b80d434f8bb501b4487b5d6a04a", class: "label", part: "label" }, "Unavailable"))));
171
172
  }
172
173
  get host() {
173
174
  return H(this);
@@ -0,0 +1,155 @@
1
+ import { r as C, c as h, h as g, H as S, g as f } from "./index-e834697b.js";
2
+ import { N as m, e as A } from "./index-10914bc1-1a809477.js";
3
+ import { d as a } from "./utils-df5c1963-d9833bcb.js";
4
+ import { C as b, N as p } from "./auth-store-764d3768-3e9c24a0.js";
5
+ import { C as v, H as P, N as _, a as N, b as w } from "./mailbox-store-6b9425dc-c249fa99.js";
6
+ import { C as I, N as x } from "./scheduler-store-81058220-263a5f44.js";
7
+ import { C as M, N as E } from "./scheduler-config-store-a059f30b-ff3efc00.js";
8
+ import "react";
9
+ import "react-dom";
10
+ import "./_commonjsHelpers-57e89916-af061c86.js";
11
+ class L {
12
+ constructor(t, s, r, o, l, n, i = "https://api.us.nylas.com") {
13
+ this.router = t, this.schedulerAPIURL = i, this.nylasAuth = s, this.nylasAuthStore = r, this.nylasMailboxStore = o, this.nylasSchedulerStore = l, this.nylasSchedulerConfigStore = n;
14
+ }
15
+ init() {
16
+ a("NylasConnector init");
17
+ }
18
+ get authStore() {
19
+ return this.nylasAuthStore;
20
+ }
21
+ get mailboxStore() {
22
+ return this.nylasMailboxStore;
23
+ }
24
+ get schedulerStore() {
25
+ return this.nylasSchedulerStore;
26
+ }
27
+ get schedulerConfigStore() {
28
+ return this.nylasSchedulerConfigStore;
29
+ }
30
+ get auth() {
31
+ return this._authConnector ? this._authConnector : (this._authConnector = new p(this.nylasAuth, this.nylasAuthStore), this._authConnector);
32
+ }
33
+ get threads() {
34
+ return this._threadConnector ? this._threadConnector : (this._threadConnector = new _(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore, this.router), this._threadConnector);
35
+ }
36
+ get messages() {
37
+ return this._messageConnector ? this._messageConnector : (this._messageConnector = new N(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._messageConnector);
38
+ }
39
+ get folders() {
40
+ return this._foldersConnector ? this._foldersConnector : (this._foldersConnector = new w(this.nylasAuth, this.nylasAuthStore, this.nylasMailboxStore), this._foldersConnector);
41
+ }
42
+ get scheduler() {
43
+ return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new x({
44
+ schedulerAPIURL: this.schedulerAPIURL,
45
+ schedulerStore: this.schedulerStore
46
+ }), this._schedulerAPIConnector);
47
+ }
48
+ get schedulerConfig() {
49
+ return this._schedulerConfigConnector ? this._schedulerConfigConnector : (this._schedulerConfigConnector = new E({
50
+ nylasAuth: this.nylasAuth,
51
+ nylasAuthStore: this.nylasAuthStore,
52
+ nylasSchedulerConfigStore: this.nylasSchedulerConfigStore
53
+ }), this._schedulerConfigConnector);
54
+ }
55
+ getAuth() {
56
+ return this.nylasAuth;
57
+ }
58
+ resetStores() {
59
+ this.nylasAuthStore.reset(), this.nylasMailboxStore.reset();
60
+ }
61
+ async logout() {
62
+ await this.nylasAuth.logout(), this.resetStores();
63
+ }
64
+ }
65
+ const R = ":host{display:contents}", T = R, U = class {
66
+ constructor(e) {
67
+ C(this, e), this.init = h(this, "init", 7), this.loggedIn = h(this, "loggedIn", 7), this.loggedOut = h(this, "loggedOut", 7), this.handleAuthChange = async (t) => {
68
+ t ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host);
69
+ }, this.authConfig = void 0, this.eventOverrides = {}, this.automaticComponentRegistration = !0;
70
+ }
71
+ connectedCallback() {
72
+ a("[nylas-provider] connectedCallback");
73
+ }
74
+ async componentWillLoad() {
75
+ var n, i, c, u, d, y;
76
+ a("[nylas-provider] componentWillLoad"), this.stores = {
77
+ auth: b(),
78
+ mailbox: v(),
79
+ scheduler: I(),
80
+ schedulerConfig: M()
81
+ }, this.baseProvider = new m(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
82
+ const e = new P();
83
+ this.nylasAuth = A({
84
+ apiUri: "https://api.us.nylas.com",
85
+ elementsApiUri: "https://elements.us.nylas.com",
86
+ storageType: "indexeddb",
87
+ clientId: "YOUR_CLIENT_ID",
88
+ defaultScopes: [],
89
+ redirectURI: "/",
90
+ ...this.authConfig
91
+ });
92
+ const t = (n = this.baseProvider) == null ? void 0 : n.getStore("mailbox");
93
+ if (!t)
94
+ throw new Error("The mailbox store is not set");
95
+ const s = (i = this.baseProvider) == null ? void 0 : i.getStore("auth");
96
+ if (!s)
97
+ throw new Error("The auth store is not set");
98
+ const r = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler");
99
+ if (!r)
100
+ throw new Error("The scheduler store is not set");
101
+ const o = (u = this.baseProvider) == null ? void 0 : u.getStore("schedulerConfig");
102
+ if (!o)
103
+ throw new Error("The scheduler config store is not set");
104
+ this.nylasConnector = new L(e, this.nylasAuth, s, t, r, o), this.init.emit(this.host).defaultPrevented || await ((d = this.nylasConnector) == null ? void 0 : d.auth.validateSession()), this.handleAuthChange(s.state.isAuthenticated), (y = this.baseProvider) == null || y.componentWillLoad(this.nylasConnector);
105
+ }
106
+ componentDidLoad() {
107
+ var t, s;
108
+ const e = (t = this.baseProvider) == null ? void 0 : t.getStore("auth");
109
+ e == null || e.onChange("isAuthenticated", this.handleAuthChange), (s = this.baseProvider) == null || s.componentDidLoad();
110
+ }
111
+ componentDisconnected() {
112
+ var e;
113
+ (e = this.baseProvider) == null || e.componentDisconnected();
114
+ }
115
+ async registerComponentHandler(e) {
116
+ var t;
117
+ (t = this.baseProvider) == null || t.registerComponent(e.detail);
118
+ }
119
+ async unregisterComponentHandler(e) {
120
+ var t;
121
+ (t = this.baseProvider) == null || t.unregisterComponent(e.detail);
122
+ }
123
+ async getNylasAuth() {
124
+ return this.nylasAuth;
125
+ }
126
+ async getNylasConnector() {
127
+ return this.nylasConnector;
128
+ }
129
+ async getMailboxStore() {
130
+ var e;
131
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("mailbox");
132
+ }
133
+ async getAuthStore() {
134
+ var e;
135
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("auth");
136
+ }
137
+ async getNylasSchedulerStore() {
138
+ var e;
139
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler");
140
+ }
141
+ async getNylasSchedulerConfigStore() {
142
+ var e;
143
+ return (e = this.baseProvider) == null ? void 0 : e.getStore("schedulerConfig");
144
+ }
145
+ render() {
146
+ return g(S, { key: "1994d94960cafdb4c1dc7b54f155a2a65190a3d9" }, g("slot", { key: "d2a28ba4a86d0df9bd1ceeaf450f376c80ad2ea6" }));
147
+ }
148
+ get host() {
149
+ return f(this);
150
+ }
151
+ };
152
+ U.style = T;
153
+ export {
154
+ U as nylas_provider
155
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-cee193d2.cjs"),C=require("./index-10914bc1-93ff6f46.cjs"),l=require("./utils-df5c1963-1c47e21c.cjs"),S=require("./auth-store-764d3768-ce84fc6a.cjs"),o=require("./mailbox-store-6b9425dc-a0366cf2.cjs"),f=require("./scheduler-store-81058220-a20698af.cjs"),b=require("./scheduler-config-store-a059f30b-06c1aa21.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class m{constructor(t,s,n,i,c,h,a="https://api.us.nylas.com"){this.router=t,this.schedulerAPIURL=a,this.nylasAuth=s,this.nylasAuthStore=n,this.nylasMailboxStore=i,this.nylasSchedulerStore=c,this.nylasSchedulerConfigStore=h}init(){l.debug("NylasConnector init")}get authStore(){return this.nylasAuthStore}get mailboxStore(){return this.nylasMailboxStore}get schedulerStore(){return this.nylasSchedulerStore}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new S.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get threads(){return this._threadConnector?this._threadConnector:(this._threadConnector=new o.NylasThreadsConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore,this.router),this._threadConnector)}get messages(){return this._messageConnector?this._messageConnector:(this._messageConnector=new o.NylasMessagesConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._messageConnector)}get folders(){return this._foldersConnector?this._foldersConnector:(this._foldersConnector=new o.NylasFoldersConnector(this.nylasAuth,this.nylasAuthStore,this.nylasMailboxStore),this._foldersConnector)}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new f.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore}),this._schedulerAPIConnector)}get schedulerConfig(){return this._schedulerConfigConnector?this._schedulerConfigConnector:(this._schedulerConfigConnector=new b.NylasSchedulerConfigAPIConnector({nylasAuth:this.nylasAuth,nylasAuthStore:this.nylasAuthStore,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore}),this._schedulerConfigConnector)}getAuth(){return this.nylasAuth}resetStores(){this.nylasAuthStore.reset(),this.nylasMailboxStore.reset()}async logout(){await this.nylasAuth.logout(),this.resetStores()}}const v=":host{display:contents}",P=v,A=class{constructor(e){r.registerInstance(this,e),this.init=r.createEvent(this,"init",7),this.loggedIn=r.createEvent(this,"loggedIn",7),this.loggedOut=r.createEvent(this,"loggedOut",7),this.handleAuthChange=async t=>{t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.automaticComponentRegistration=!0}connectedCallback(){l.debug("[nylas-provider] connectedCallback")}async componentWillLoad(){var h,a,u,d,g,y;l.debug("[nylas-provider] componentWillLoad"),this.stores={auth:S.CreateNylasAuthStore(),mailbox:o.CreateNylasMailboxStore(),scheduler:f.CreateNylasSchedulerStore(),schedulerConfig:b.CreateNylasSchedulerConfigStore()},this.baseProvider=new C.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const e=new o.HashRouter;this.nylasAuth=C.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const t=(h=this.baseProvider)==null?void 0:h.getStore("mailbox");if(!t)throw new Error("The mailbox store is not set");const s=(a=this.baseProvider)==null?void 0:a.getStore("auth");if(!s)throw new Error("The auth store is not set");const n=(u=this.baseProvider)==null?void 0:u.getStore("scheduler");if(!n)throw new Error("The scheduler store is not set");const i=(d=this.baseProvider)==null?void 0:d.getStore("schedulerConfig");if(!i)throw new Error("The scheduler config store is not set");this.nylasConnector=new m(e,this.nylasAuth,s,t,n,i),this.init.emit(this.host).defaultPrevented||await((g=this.nylasConnector)==null?void 0:g.auth.validateSession()),this.handleAuthChange(s.state.isAuthenticated),(y=this.baseProvider)==null||y.componentWillLoad(this.nylasConnector)}componentDidLoad(){var t,s;const e=(t=this.baseProvider)==null?void 0:t.getStore("auth");e==null||e.onChange("isAuthenticated",this.handleAuthChange),(s=this.baseProvider)==null||s.componentDidLoad()}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async getNylasAuth(){return this.nylasAuth}async getNylasConnector(){return this.nylasConnector}async getMailboxStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("mailbox")}async getAuthStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("auth")}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConfigStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("schedulerConfig")}render(){return r.h(r.Host,{key:"1994d94960cafdb4c1dc7b54f155a2a65190a3d9"},r.h("slot",{key:"d2a28ba4a86d0df9bd1ceeaf450f376c80ad2ea6"}))}get host(){return r.getElement(this)}};A.style=P;exports.nylas_provider=A;
@@ -0,0 +1,114 @@
1
+ import { r as u, c as r, h as s, H as c, g } from "./index-e834697b.js";
2
+ import { N as f, e as y } from "./index-10914bc1-1a809477.js";
3
+ import { C, N as p } from "./auth-store-764d3768-3e9c24a0.js";
4
+ import { d as o } from "./utils-df5c1963-d9833bcb.js";
5
+ import { C as S, N as m } from "./scheduler-config-store-a059f30b-ff3efc00.js";
6
+ import "react";
7
+ import "react-dom";
8
+ import "./_commonjsHelpers-57e89916-af061c86.js";
9
+ class b {
10
+ constructor({ nylasAuth: t, nylasAuthStore: n, nylasSchedulerConfigStore: i }) {
11
+ this.nylasAuth = t, this.nylasAuthStore = n, this.nylasSchedulerConfigStore = i;
12
+ }
13
+ init() {
14
+ o("NylasSchedulerConfigConnector init");
15
+ }
16
+ get authStore() {
17
+ return this.nylasAuthStore;
18
+ }
19
+ get auth() {
20
+ return this._authConnector ? this._authConnector : (this._authConnector = new p(this.nylasAuth, this.nylasAuthStore), this._authConnector);
21
+ }
22
+ get schedulerConfigStore() {
23
+ return this.nylasSchedulerConfigStore;
24
+ }
25
+ get schedulerConfig() {
26
+ return this._schedulerConfigConnector ? this._schedulerConfigConnector : (this._schedulerConfigConnector = new m({
27
+ nylasAuth: this.nylasAuth,
28
+ nylasAuthStore: this.nylasAuthStore,
29
+ nylasSchedulerConfigStore: this.nylasSchedulerConfigStore
30
+ }), this._schedulerConfigConnector);
31
+ }
32
+ getAuth() {
33
+ return this.nylasAuth;
34
+ }
35
+ getTokenInfo() {
36
+ return this.nylasAuth.getTokenInfo();
37
+ }
38
+ resetStores() {
39
+ o("NylasSchedulerConfigConnector resetStores"), this.nylasAuthStore.reset(), this.nylasSchedulerConfigStore.reset();
40
+ }
41
+ async logout() {
42
+ o("NylasSchedulerConfigConnector logout"), await this.auth.logout(), this.resetStores();
43
+ }
44
+ }
45
+ const v = ":host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-scheduler-editor{width:100%}", x = v, w = class {
46
+ constructor(e) {
47
+ u(this, e), this.init = r(this, "init", 7), this.loggedIn = r(this, "loggedIn", 7), this.loggedOut = r(this, "loggedOut", 7), this.schedulerConfigCloseClicked = r(this, "schedulerConfigCloseClicked", 7), this.handleAuthChange = async (t) => {
48
+ var n;
49
+ t ? this.loggedIn.emit(this.host) : this.loggedOut.emit(this.host).defaultPrevented || await ((n = this.nylasSchedulerConfigConnector) == null ? void 0 : n.logout());
50
+ }, this.handleSchedulerConfigCloseClicked = (t) => {
51
+ this.schedulerConfigCloseClicked.emit(this.host);
52
+ }, this.authConfig = void 0, this.eventOverrides = {}, this.defaultAuthStoreState = void 0, this.defaultSchedulerConfigStoreState = void 0, this.mode = "app", this.automaticComponentRegistration = !0, this.loggedInUser = "";
53
+ }
54
+ connectedCallback() {
55
+ o("[nylas-scheduler-config] connectedCallback");
56
+ }
57
+ async componentWillLoad() {
58
+ var i, a, l, h;
59
+ o("[nylas-scheduler-config] componentWillLoad"), this.stores = {
60
+ auth: C(this.defaultAuthStoreState),
61
+ schedulerConfig: S({
62
+ ...this.defaultSchedulerConfigStoreState
63
+ })
64
+ }, this.baseProvider = new f(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.nylasAuth = y({
65
+ apiUri: "https://api.us.nylas.com",
66
+ elementsApiUri: "https://elements.us.nylas.com",
67
+ storageType: "indexeddb",
68
+ clientId: "YOUR_CLIENT_ID",
69
+ defaultScopes: [],
70
+ redirectURI: "/",
71
+ ...this.authConfig
72
+ });
73
+ const e = (i = this.baseProvider) == null ? void 0 : i.getStore("auth"), t = this.baseProvider.getStore("schedulerConfig");
74
+ if (this.nylasSchedulerConfigConnector = new b({
75
+ nylasAuth: this.nylasAuth,
76
+ nylasAuthStore: this.stores.auth,
77
+ nylasSchedulerConfigStore: t
78
+ }), !this.init.emit(this.host).defaultPrevented) {
79
+ await ((a = this.nylasSchedulerConfigConnector) == null ? void 0 : a.auth.validateSession());
80
+ const d = await ((l = this.nylasSchedulerConfigConnector) == null ? void 0 : l.auth.getTokenInfo());
81
+ d && (this.loggedInUser = d.email);
82
+ }
83
+ this.handleAuthChange(e.state.isAuthenticated), (h = this.baseProvider) == null || h.componentWillLoad(this.nylasSchedulerConfigConnector);
84
+ }
85
+ async componentDidLoad() {
86
+ var e, t, n;
87
+ o("[nylas-scheduler-config] componentDidLoad"), (e = this.baseProvider) == null || e.componentDidLoad(), await ((n = (t = this.nylasSchedulerConfigConnector) == null ? void 0 : t.schedulerConfig) == null ? void 0 : n.getCalendars());
88
+ }
89
+ componentDisconnected() {
90
+ var e;
91
+ (e = this.baseProvider) == null || e.componentDisconnected();
92
+ }
93
+ async registerComponentHandler(e) {
94
+ var t;
95
+ (t = this.baseProvider) == null || t.registerComponent(e.detail);
96
+ }
97
+ async unregisterComponentHandler(e) {
98
+ var t;
99
+ (t = this.baseProvider) == null || t.unregisterComponent(e.detail);
100
+ }
101
+ async schedulerConfigChangedHandler(e) {
102
+ console.log("schedulerConfigChanged", e.detail);
103
+ }
104
+ render() {
105
+ return this.mode === "app" ? s(c, null, s("div", { class: "scheduler-editor-header" }, s("h1", { class: "scheduler-editor-title" }, s("calendar-icon", { width: "18", height: "18" }), "Schedule editor"), s("button", { class: "scheduler-editor-close", onClick: (t) => this.handleSchedulerConfigCloseClicked(t), part: "nsc-close-button" }, s("close-icon", { width: "18", height: "18" }))), s("nylas-scheduler-editor", null)) : s(c, null, s("slot", null));
106
+ }
107
+ get host() {
108
+ return g(this);
109
+ }
110
+ };
111
+ w.style = x;
112
+ export {
113
+ w as nylas_scheduler_config
114
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-cee193d2.cjs"),d=require("./index-10914bc1-93ff6f46.cjs"),c=require("./auth-store-764d3768-ce84fc6a.cjs"),o=require("./utils-df5c1963-1c47e21c.cjs"),u=require("./scheduler-config-store-a059f30b-06c1aa21.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");class f{constructor({nylasAuth:t,nylasAuthStore:n,nylasSchedulerConfigStore:r}){this.nylasAuth=t,this.nylasAuthStore=n,this.nylasSchedulerConfigStore=r}init(){o.debug("NylasSchedulerConfigConnector init")}get authStore(){return this.nylasAuthStore}get auth(){return this._authConnector?this._authConnector:(this._authConnector=new c.NylasAuthConnector(this.nylasAuth,this.nylasAuthStore),this._authConnector)}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){return this._schedulerConfigConnector?this._schedulerConfigConnector:(this._schedulerConfigConnector=new u.NylasSchedulerConfigAPIConnector({nylasAuth:this.nylasAuth,nylasAuthStore:this.nylasAuthStore,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore}),this._schedulerConfigConnector)}getAuth(){return this.nylasAuth}getTokenInfo(){return this.nylasAuth.getTokenInfo()}resetStores(){o.debug("NylasSchedulerConfigConnector resetStores"),this.nylasAuthStore.reset(),this.nylasSchedulerConfigStore.reset()}async logout(){o.debug("NylasSchedulerConfigConnector logout"),await this.auth.logout(),this.resetStores()}}const y=":host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-scheduler-editor{width:100%}",C=y,g=class{constructor(e){s.registerInstance(this,e),this.init=s.createEvent(this,"init",7),this.loggedIn=s.createEvent(this,"loggedIn",7),this.loggedOut=s.createEvent(this,"loggedOut",7),this.schedulerConfigCloseClicked=s.createEvent(this,"schedulerConfigCloseClicked",7),this.handleAuthChange=async t=>{var n;t?this.loggedIn.emit(this.host):this.loggedOut.emit(this.host).defaultPrevented||await((n=this.nylasSchedulerConfigConnector)==null?void 0:n.logout())},this.handleSchedulerConfigCloseClicked=t=>{this.schedulerConfigCloseClicked.emit(this.host)},this.authConfig=void 0,this.eventOverrides={},this.defaultAuthStoreState=void 0,this.defaultSchedulerConfigStoreState=void 0,this.mode="app",this.automaticComponentRegistration=!0,this.loggedInUser=""}connectedCallback(){o.debug("[nylas-scheduler-config] connectedCallback")}async componentWillLoad(){var r,i,a,l;o.debug("[nylas-scheduler-config] componentWillLoad"),this.stores={auth:c.CreateNylasAuthStore(this.defaultAuthStoreState),schedulerConfig:u.CreateNylasSchedulerConfigStore({...this.defaultSchedulerConfigStoreState})},this.baseProvider=new d.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.nylasAuth=d.es({apiUri:"https://api.us.nylas.com",elementsApiUri:"https://elements.us.nylas.com",storageType:"indexeddb",clientId:"YOUR_CLIENT_ID",defaultScopes:[],redirectURI:"/",...this.authConfig});const e=(r=this.baseProvider)==null?void 0:r.getStore("auth"),t=this.baseProvider.getStore("schedulerConfig");if(this.nylasSchedulerConfigConnector=new f({nylasAuth:this.nylasAuth,nylasAuthStore:this.stores.auth,nylasSchedulerConfigStore:t}),!this.init.emit(this.host).defaultPrevented){await((i=this.nylasSchedulerConfigConnector)==null?void 0:i.auth.validateSession());const h=await((a=this.nylasSchedulerConfigConnector)==null?void 0:a.auth.getTokenInfo());h&&(this.loggedInUser=h.email)}this.handleAuthChange(e.state.isAuthenticated),(l=this.baseProvider)==null||l.componentWillLoad(this.nylasSchedulerConfigConnector)}async componentDidLoad(){var e,t,n;o.debug("[nylas-scheduler-config] componentDidLoad"),(e=this.baseProvider)==null||e.componentDidLoad(),await((n=(t=this.nylasSchedulerConfigConnector)==null?void 0:t.schedulerConfig)==null?void 0:n.getCalendars())}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}async registerComponentHandler(e){var t;(t=this.baseProvider)==null||t.registerComponent(e.detail)}async unregisterComponentHandler(e){var t;(t=this.baseProvider)==null||t.unregisterComponent(e.detail)}async schedulerConfigChangedHandler(e){console.log("schedulerConfigChanged",e.detail)}render(){return this.mode==="app"?s.h(s.Host,null,s.h("div",{class:"scheduler-editor-header"},s.h("h1",{class:"scheduler-editor-title"},s.h("calendar-icon",{width:"18",height:"18"}),"Schedule editor"),s.h("button",{class:"scheduler-editor-close",onClick:t=>this.handleSchedulerConfigCloseClicked(t),part:"nsc-close-button"},s.h("close-icon",{width:"18",height:"18"}))),s.h("nylas-scheduler-editor",null)):s.h(s.Host,null,s.h("slot",null))}get host(){return s.getElement(this)}};g.style=C;exports.nylas_scheduler_config=g;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-cee193d2.cjs"),g=require("./register-component-486ea571-cdfe1ef9.cjs"),h=require("./utils-df5c1963-1c47e21c.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");const v=":host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;width:inherit}.scheduler-editor{display:flex;flex-direction:column}.scheduler-editor .form-contents{display:grid;grid-template-columns:minmax(224px, 25%) 1fr}@media screen and (max-width: 768px){.scheduler-editor .form-contents{display:table-column-group}}.scheduler-editor .form-contents .tabs{display:flex;flex-direction:column;border-right:1px solid var(--nylas-base-200);background-color:var(--nylas-base-25)}.scheduler-editor .form-contents .tabs .tab{display:flex;align-items:center;gap:0.5rem;padding:0.5rem 1rem;color:var(--nylas-base-900);background:var(--nylas-base-0);border:none;height:56px;cursor:pointer}.scheduler-editor .form-contents .tabs .tab:not(:first-of-type){margin-top:0.25rem}.scheduler-editor .form-contents .tabs .tab.active{background:var(--nylas-base-0);color:var(--nylas-primary);border-left:4px solid var(--nylas-primary);box-shadow:0px 1px 2px 0px rgba(0, 0, 0, 0.0588235294);box-shadow:0px 1px 3px 0px rgba(0, 0, 0, 0.1019607843)}.scheduler-editor .form-contents .tab-content{max-width:692px}.footer{display:flex;justify-content:flex-end;align-items:center;height:80px;padding:0 1rem;border-top:1px solid var(--nylas-base-200)}.footer button{background:var(--nylas-primary);color:var(--nylas-base-0);height:48px;border:none;border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;cursor:pointer}.footer button:hover{background:var(--nylas-base-600)}.footer button:active{background:var(--nylas-base-800)}.footer button:disabled{background:var(--nylas-base-300);cursor:not-allowed}",x=v;var S=function(e,t,n,r){var l=arguments.length,i=l<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,r);else for(var o=e.length-1;o>=0;o--)(s=e[o])&&(i=(l<3?s(i):l>3?s(t,n,i):s(t,n))||i);return l>3&&i&&Object.defineProperty(t,n,i),i},p=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)};const y=class{constructor(e){a.registerInstance(this,e),this.schedulerConfigChanged=a.createEvent(this,"schedulerConfigChanged",7),this.formSubmissionHandler=async t=>{var d,f;t.preventDefault(),this.updateFormState();const{title:n,description:r,duration:l,availability:i,calendarIds:s,participants:o}=this.formState;console.log("participants: ",o);const c=(f=(d=this.config)==null?void 0:d.participants)==null?void 0:f.find(u=>u.is_organizer),b={availability:{duration_minutes:parseInt(l)},participants:[{name:(c==null?void 0:c.name)??"",email:(c==null?void 0:c.email)??"",is_organizer:!0,availability:{calendar_ids:s.length?s:["primary"],open_hours:i??[]}}],event_booking:{title:(n==null?void 0:n.toString())??"",description:(r==null?void 0:r.toString())??""}};this.schedulerConfigChanged.emit(b)},this.calendars=void 0,this.config=void 0,this.activeTab="eventInfo",this.formState=this.getFormStateFromConfig()}configChangedHandler(e){h.debug("nylas-scheduler-editor","configChangedHandler",e),this.formState=this.getFormStateFromConfig()}connectedCallback(){h.debug("nylas-scheduler-editor","connectedCallback")}componentWillLoad(){h.debug("nylas-scheduler-editor","componentWillLoad")}componentDidLoad(){h.debug("nylas-scheduler-editor","componentDidLoad")}disconnectedCallback(){h.debug("nylas-scheduler-editor","disconnectedCallback")}getFormStateFromConfig(){var t,n,r,l,i,s,o,c,b,d,f,u;const e=(n=(t=this.config)==null?void 0:t.participants)==null?void 0:n.find(m=>m.is_organizer);return{title:((l=(r=this.config)==null?void 0:r.event_booking)==null?void 0:l.title)??"",description:((s=(i=this.config)==null?void 0:i.event_booking)==null?void 0:s.description)??"",duration:((b=(c=(o=this.config)==null?void 0:o.availability)==null?void 0:c.duration_minutes)==null?void 0:b.toString())??"10",availability:((d=e==null?void 0:e.availability)==null?void 0:d.open_hours)??void 0,calendarIds:((f=e==null?void 0:e.availability)==null?void 0:f.calendar_ids)??[],participants:((u=this.config)==null?void 0:u.participants)??[]}}updateFormState(){new FormData(this.formRef).forEach((t,n)=>{switch(n){case"title":this.formState.title=t.toString();break;case"description":this.formState.description=t.toString();break;case"duration":this.formState.duration=t.toString();break;case"availability":this.formState.availability=JSON.parse(t.toString());break;case"participants":this.formState.participants=JSON.parse(t.toString());break;case"calendars":this.formState.calendarIds=t.toString().split(",");break}}),this.formState={...this.formState}}setActiveTab(e,t){e.preventDefault(),this.updateFormState(),this.activeTab=t}renderTabContent(e){var t;switch(this.activeTab){case"eventInfo":const n=e.title,r=e.description,l=parseInt(e.duration),i=e.participants;return a.h("div",null,a.h("nylas-event-info",null,a.h("div",{slot:"inputs"},a.h("nylas-event-title",{name:"title",eventTitle:n}),a.h("nylas-event-duration",{name:"duration",eventDurationMinutes:l}),a.h("nylas-event-description",{name:"description",eventDescription:r}))),a.h("nylas-additional-participants",{name:"participants",eventParticipants:i}));case"availability":const s=e.availability,o=(t=e.participants)==null?void 0:t.find(d=>d.is_organizer),c=(o==null?void 0:o.email)??"primary",b=e.calendarIds.length>0?e.calendarIds:[c];return a.h("div",null,a.h("nylas-calendar-picker",{name:"calendars",calendars:this.calendars??[],defaultSelectedCalendars:b,organizerEmail:c}),a.h("nylas-availability-picker",{name:"availability",openHours:s}))}}render(){return a.h(a.Host,{key:"5041540c34973d7e3e4ea881f9ae0312d116910d"},a.h("form",{key:"e97d08f968108913f8313fc7c155646abc40f9b0",onSubmit:this.formSubmissionHandler,class:"scheduler-editor",ref:e=>this.formRef=e},a.h("div",{key:"10b20fef8c742f4ef50a4d41baccff514b661a9f",class:"form-contents"},a.h("div",{key:"abaef8139309661b1398aea8e0c7ff8378b3bec5",class:"tabs"},a.h("button",{key:"6d40952899d50e48ffe8531e4d7bfe70dedb5882",class:{tab:!0,active:this.activeTab=="eventInfo"},onClick:e=>this.setActiveTab(e,"eventInfo")},a.h("calendar-info-icon",{key:"fe8510f782a12d6e755d1656fe9af67b86314bf0",width:"16",height:"16"}),"Event Info"),a.h("button",{key:"4d821f8550f8e36e6a421a783034c0500fd178c6",class:{tab:!0,active:this.activeTab=="availability"},onClick:e=>this.setActiveTab(e,"availability")},a.h("calendar-patterns-icon",{key:"93c0b506aeac709c6e39c6a514fc46bec052dcc7",width:"16",height:"16"}),"Availability")),a.h("div",{key:"843934d16b0208234e400be7f1c92b5f67c36884",class:"tab-content"},this.renderTabContent(this.formState))),a.h("div",{key:"0a5b6a63138970cc1cc876894d7ec2340f5ab107",class:"footer"},a.h("button",{key:"ed49e3934719b08b08a81f095565249f109d64fb",type:"submit"},"Save changes"))))}static get watchers(){return{config:["configChangedHandler"]}}};S([g.RegisterComponent({name:"nylas-scheduler-editor",stateToProps:new Map([["schedulerConfig.calendars","calendars"],["schedulerConfig.config","config"]]),fireRegisterEvent:!0}),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",void 0)],y.prototype,"render",null);y.style=x;exports.nylas_scheduler_editor=y;