@nylas/react 1.0.2-prealpha1 → 1.1.0-canary.3

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 (133) hide show
  1. package/dist/add-circle-icon_22.entry-8d0ac489.cjs +1 -0
  2. package/dist/add-circle-icon_22.entry-da31fa71.js +1733 -0
  3. package/dist/{archive-icon_7.entry-84d70dbf.cjs → archive-icon_7.entry-7aad8104.cjs} +1 -1
  4. package/dist/{archive-icon_7.entry-91aaa1aa.js → archive-icon_7.entry-bc2418f7.js} +20 -20
  5. package/dist/{arrow-icon.entry-400a08fa.cjs → arrow-icon.entry-6eba68a9.cjs} +1 -1
  6. package/dist/arrow-icon.entry-9a932082.js +15 -0
  7. package/dist/{bold-icon_3.entry-4b2798a8.js → bold-icon_3.entry-5f7e3755.js} +4 -4
  8. package/dist/{bold-icon_3.entry-9ad35153.cjs → bold-icon_3.entry-db17d481.cjs} +1 -1
  9. package/dist/{calendar-cancel-icon.entry-83ba884a.js → calendar-cancel-icon.entry-1ff7845a.js} +4 -4
  10. package/dist/{calendar-cancel-icon.entry-fcb66929.cjs → calendar-cancel-icon.entry-a5141f82.cjs} +1 -1
  11. package/dist/calendar-check-icon_2.entry-c3add652.cjs +1 -0
  12. package/dist/calendar-check-icon_2.entry-d7421059.js +25 -0
  13. package/dist/{calendar-icon.entry-8f38af4a.js → calendar-icon.entry-4458997f.js} +2 -2
  14. package/dist/{calendar-icon.entry-7bae38d7.cjs → calendar-icon.entry-445d624a.cjs} +1 -1
  15. package/dist/chevron-icon_3.entry-8961e6bb.cjs +1 -0
  16. package/dist/chevron-icon_3.entry-f7f3d487.js +117 -0
  17. package/dist/close-icon.entry-6dd5ff0a.js +15 -0
  18. package/dist/close-icon.entry-ebc527c5.cjs +1 -0
  19. package/dist/{nylas-booked-event-card_10.entry-7e66a648.js → constants-6ee60d6d-4cd16450.js} +1656 -2374
  20. package/dist/{nylas-booked-event-card_10.entry-ed515326.cjs → constants-6ee60d6d-6c0540db.cjs} +6 -6
  21. package/dist/document-refresh-icon.entry-298b2133.cjs +1 -0
  22. package/dist/document-refresh-icon.entry-bdc323b5.js +15 -0
  23. package/dist/elements/index.d.ts +31 -2
  24. package/dist/{forward-icon_6.entry-3345af84.cjs → forward-icon_6.entry-15208ea9.cjs} +3 -3
  25. package/dist/{forward-icon_6.entry-b60fcb35.js → forward-icon_6.entry-62759373.js} +127 -127
  26. package/dist/{globe-icon.entry-e3fd373f.js → globe-icon.entry-9e082178.js} +4 -4
  27. package/dist/{globe-icon.entry-8325e73e.cjs → globe-icon.entry-c8302bf5.cjs} +1 -1
  28. package/dist/google-logo-icon_3.entry-0c095209.js +258 -0
  29. package/dist/google-logo-icon_3.entry-f8433ff9.cjs +1 -0
  30. package/dist/index-0f3bd8df.js +1824 -0
  31. package/dist/index-7a55dc33.cjs +30 -0
  32. package/dist/index.d.ts +3 -1
  33. package/dist/index.es-2578c6a5-098d48d0.cjs +7 -0
  34. package/dist/{index-b30d446a-a90f84b2.js → index.es-2578c6a5-71441142.js} +833 -933
  35. package/dist/info-icon_2.entry-73106882.js +34 -0
  36. package/dist/info-icon_2.entry-ca224a3b.cjs +1 -0
  37. package/dist/{loading-icon.entry-27410cf8.js → loading-icon.entry-012644b7.js} +4 -4
  38. package/dist/{loading-icon.entry-b2096d2b.cjs → loading-icon.entry-f9f5e66f.cjs} +1 -1
  39. package/dist/mailbox-store-bb21512c-045c3ea0.cjs +1 -0
  40. package/dist/{mailbox-store-19f0c6c9-e3e8b4e5.js → mailbox-store-bb21512c-615660ef.js} +17 -16
  41. package/dist/nylas-additional-participants.entry-a50ef8e2.cjs +1 -0
  42. package/dist/nylas-additional-participants.entry-db85836a.js +83 -0
  43. package/dist/nylas-booked-event-card_10.entry-b49b2369.js +784 -0
  44. package/dist/nylas-booked-event-card_10.entry-fccb783c.cjs +1 -0
  45. package/dist/nylas-form-card.entry-090a4d3b.js +56 -0
  46. package/dist/nylas-form-card.entry-f5230005.cjs +1 -0
  47. package/dist/nylas-if-state.entry-7924dde0.js +96 -0
  48. package/dist/nylas-if-state.entry-ff9c9a85.cjs +1 -0
  49. package/dist/{nylas-list-folders.entry-a5437201.js → nylas-list-folders.entry-9dd96530.js} +9 -8
  50. package/dist/nylas-list-folders.entry-dbfc2cf8.cjs +1 -0
  51. package/dist/nylas-list-threads.entry-6bcc0328.cjs +1 -0
  52. package/dist/{nylas-list-threads.entry-fd6cda61.js → nylas-list-threads.entry-b435eaae.js} +5 -4
  53. package/dist/nylas-login.entry-1623d309.cjs +1 -0
  54. package/dist/nylas-login.entry-97350c76.js +75 -0
  55. package/dist/nylas-mailbox-pagination.entry-1776eb16.cjs +1 -0
  56. package/dist/{nylas-mailbox-pagination.entry-988214bc.js → nylas-mailbox-pagination.entry-ceef8be2.js} +4 -3
  57. package/dist/nylas-mailbox-toolbar-button.entry-7d3f79b9.cjs +1 -0
  58. package/dist/{nylas-mailbox-toolbar-button.entry-c720e22a.js → nylas-mailbox-toolbar-button.entry-e6b3d3a4.js} +11 -10
  59. package/dist/nylas-mailbox.entry-06d8014a.js +136 -0
  60. package/dist/nylas-mailbox.entry-ae8da6ff.cjs +1 -0
  61. package/dist/{nylas-provider.entry-70721009.js → nylas-provider.entry-8b9c2b69.js} +46 -33
  62. package/dist/nylas-provider.entry-97c9e272.cjs +1 -0
  63. package/dist/nylas-scheduler-editor.entry-c3791787.js +2181 -0
  64. package/dist/nylas-scheduler-editor.entry-f6cf1cd9.cjs +7 -0
  65. package/dist/nylas-scheduling.entry-08ae840a.cjs +1 -0
  66. package/dist/nylas-scheduling.entry-6380509a.js +237 -0
  67. package/dist/nylas-threads-refresh.entry-246e6d77.cjs +1 -0
  68. package/dist/{nylas-threads-refresh.entry-b7f9e93f.js → nylas-threads-refresh.entry-eaee86fb.js} +6 -5
  69. package/dist/nylas-threads-search.entry-42a2acb1.cjs +1 -0
  70. package/dist/{nylas-threads-search.entry-95afea9c.js → nylas-threads-search.entry-7e12758e.js} +15 -14
  71. package/dist/nylas-view-thread.entry-78e6927a.cjs +1 -0
  72. package/dist/{nylas-view-thread.entry-165173b1.js → nylas-view-thread.entry-b936e76a.js} +5 -4
  73. package/dist/people-icon.entry-5c8ee696.js +15 -0
  74. package/dist/people-icon.entry-bcf848c0.cjs +1 -0
  75. package/dist/play-icon_2.entry-356e63cc.js +25 -0
  76. package/dist/play-icon_2.entry-92e78f1b.cjs +1 -0
  77. package/dist/react.cjs +1 -1
  78. package/dist/react.js +92 -61
  79. package/dist/{refresh-icon.entry-e48a338f.js → refresh-icon.entry-77f0c377.js} +2 -2
  80. package/dist/{refresh-icon.entry-601cac89.cjs → refresh-icon.entry-bec053b6.cjs} +1 -1
  81. package/dist/{register-component-152c6ad2-a06f58c2.js → register-component-dc659dc3-0fdb18dc.js} +2 -2
  82. package/dist/{register-component-152c6ad2-0df7215b.cjs → register-component-dc659dc3-f58bf25b.cjs} +1 -1
  83. package/dist/scheduler-config-store-51ee4f42-ce3a9b0e.cjs +1 -0
  84. package/dist/scheduler-config-store-51ee4f42-e02895da.js +14 -0
  85. package/dist/{scheduler-store-7d48e682-0c0c3991.js → scheduler-store-72116723-3ba2480c.js} +100 -95
  86. package/dist/scheduler-store-72116723-db9d91f6.cjs +1 -0
  87. package/dist/time-period-selector.entry-decd251b.js +78 -0
  88. package/dist/time-period-selector.entry-f25fad77.cjs +1 -0
  89. package/dist/translate-icon.entry-cac02c46.js +15 -0
  90. package/dist/translate-icon.entry-dd5b707c.cjs +1 -0
  91. package/dist/utils-c00bdc3c-89ab163d.js +2111 -0
  92. package/dist/utils-c00bdc3c-94b9c3b6.cjs +8 -0
  93. package/dist/warning-icon.entry-370b9cf0.js +15 -0
  94. package/dist/warning-icon.entry-8af8a742.cjs +1 -0
  95. package/package.json +7 -4
  96. package/dist/add-circle-icon.entry-2ccb238b.cjs +0 -1
  97. package/dist/add-circle-icon.entry-35d6aa07.js +0 -15
  98. package/dist/arrow-icon.entry-8b2e96a6.js +0 -15
  99. package/dist/calendar-check-icon_3.entry-903e2d82.js +0 -35
  100. package/dist/calendar-check-icon_3.entry-a16ce05e.cjs +0 -1
  101. package/dist/chevron-icon.entry-58366662.cjs +0 -1
  102. package/dist/chevron-icon.entry-5e11cef5.js +0 -15
  103. package/dist/close-icon_2.entry-011d9cf4.js +0 -25
  104. package/dist/close-icon_2.entry-83088b9a.cjs +0 -1
  105. package/dist/document-refresh-icon.entry-071ffd66.cjs +0 -1
  106. package/dist/document-refresh-icon.entry-9083a2e9.js +0 -15
  107. package/dist/duration-bddc4a13-05d3e3e2.cjs +0 -1
  108. package/dist/duration-bddc4a13-179ce826.js +0 -41
  109. package/dist/index-3b6f5cd5.cjs +0 -30
  110. package/dist/index-630f4e87.js +0 -1498
  111. package/dist/index-b30d446a-cbbef925.cjs +0 -7
  112. package/dist/mailbox-store-19f0c6c9-a0cbfa97.cjs +0 -1
  113. package/dist/nylas-if-state_3.entry-504be976.cjs +0 -1
  114. package/dist/nylas-if-state_3.entry-e96d01f1.js +0 -291
  115. package/dist/nylas-list-folders.entry-866361cc.cjs +0 -1
  116. package/dist/nylas-list-threads.entry-04989295.cjs +0 -1
  117. package/dist/nylas-mailbox-pagination.entry-e0bd4aef.cjs +0 -1
  118. package/dist/nylas-mailbox-toolbar-button.entry-3d772b26.cjs +0 -1
  119. package/dist/nylas-open-hours-picker.entry-6bdc7c73.js +0 -186
  120. package/dist/nylas-open-hours-picker.entry-881b6db7.cjs +0 -1
  121. package/dist/nylas-provider.entry-8d9a844b.cjs +0 -1
  122. package/dist/nylas-scheduler.entry-7321e18f.js +0 -230
  123. package/dist/nylas-scheduler.entry-e82977fb.cjs +0 -1
  124. package/dist/nylas-threads-refresh.entry-477e68e4.cjs +0 -1
  125. package/dist/nylas-threads-search.entry-c5854641.cjs +0 -1
  126. package/dist/nylas-view-thread.entry-8b72cbdb.cjs +0 -1
  127. package/dist/play-icon_2.entry-ed5877e3.js +0 -25
  128. package/dist/play-icon_2.entry-f23ed6c1.cjs +0 -1
  129. package/dist/scheduler-store-7d48e682-674705ef.cjs +0 -1
  130. package/dist/search-icon_3.entry-292138c3.js +0 -101
  131. package/dist/search-icon_3.entry-8e555357.cjs +0 -1
  132. package/dist/utils-5074a070-ce33ee6b.js +0 -119
  133. package/dist/utils-5074a070-d5ba6add.cjs +0 -2
@@ -1,21 +1,21 @@
1
- import { d as y } from "./utils-5074a070-ce33ee6b.js";
2
- import { c as A } from "./index-b30d446a-a90f84b2.js";
3
- var f;
4
- (function(n) {
5
- n.Component = "component", n.Api = "api", n.Auth = "auth";
6
- })(f || (f = {}));
7
- var k;
8
- (function(n) {
9
- n.endtime_not_in_future = "endtime_not_in_future", n.no_booking_info = "no_booking_info", n.no_timeslot_selected = "no_timeslot_selected", n.no_booking_id = "no_booking_id", n.invalid_start_time = "invalid_start_time", n.invalid_end_time = "invalid_end_time", n.invalid_timezone = "invalid_timezone";
10
- })(k || (k = {}));
11
- var b;
12
- (function(n) {
13
- n.invalid_session = "invalid_session", n.general_error = "general_error", n.internal_error = "internal_error", n.invalid_request_error = "invalid_request_error", n.timeslot_not_available = "timeslot_not_available";
14
- })(b || (b = {}));
15
- class R {
1
+ import { d as y } from "./utils-c00bdc3c-89ab163d.js";
2
+ import { a as R } from "./index-0f3bd8df.js";
3
+ var S;
4
+ (function(r) {
5
+ r.Component = "component", r.Api = "api", r.Auth = "auth";
6
+ })(S || (S = {}));
7
+ var I;
8
+ (function(r) {
9
+ r.endtime_not_in_future = "endtime_not_in_future", r.no_booking_info = "no_booking_info", r.no_timeslot_selected = "no_timeslot_selected", r.no_booking_id = "no_booking_id", r.invalid_start_time = "invalid_start_time", r.invalid_end_time = "invalid_end_time", r.invalid_timezone = "invalid_timezone";
10
+ })(I || (I = {}));
11
+ var P;
12
+ (function(r) {
13
+ r.invalid_session = "invalid_session", r.general_error = "general_error", r.internal_error = "internal_error", r.invalid_request_error = "invalid_request_error", r.timeslot_not_available = "timeslot_not_available";
14
+ })(P || (P = {}));
15
+ class L {
16
16
  constructor() {
17
17
  this.component = (t) => {
18
- const e = f.Component, s = `${t} error`;
18
+ const e = S.Component, s = `${t} error`;
19
19
  return {
20
20
  endtime_not_in_future: (i = '"endtime" can not be in the future') => ({
21
21
  title: s,
@@ -54,7 +54,7 @@ class R {
54
54
  })
55
55
  };
56
56
  }, this.api = (t) => {
57
- const e = f.Api, s = `${t} error`;
57
+ const e = S.Api, s = `${t} error`;
58
58
  return {
59
59
  invalid_session: (i) => ({
60
60
  title: s,
@@ -85,14 +85,19 @@ class R {
85
85
  };
86
86
  }
87
87
  }
88
- class z {
89
- constructor({ schedulerAPIURL: t, schedulerStore: e, sessionId: s }) {
90
- this.errors = new R(), this.schedulerStore = e, this.schedulerAPIURL = t, this.sessionId = s;
88
+ class C {
89
+ constructor({ schedulerAPIURL: t, schedulerStore: e, sessionId: s, configId: i }) {
90
+ this.errors = new L(), this.schedulerStore = e, this.schedulerAPIURL = t, this.sessionId = s, this.configId = i;
91
+ }
92
+ getHeaders() {
93
+ return this.configId ? {} : {
94
+ Authorization: `Bearer ${this.sessionId}`
95
+ };
91
96
  }
92
97
  async makeAPIRequest(t, e, s, i = {}) {
93
98
  try {
94
- const r = new URL(this.schedulerAPIURL);
95
- return r.pathname = t, await (await fetch(decodeURIComponent(r.toString()), {
99
+ const n = new URL(this.schedulerAPIURL);
100
+ return n.pathname = t, await (await fetch(decodeURIComponent(n.toString()), {
96
101
  method: e,
97
102
  headers: {
98
103
  "Content-Type": "application/json",
@@ -100,10 +105,10 @@ class z {
100
105
  },
101
106
  body: s
102
107
  })).json();
103
- } catch (r) {
108
+ } catch (n) {
104
109
  return {
105
110
  error: {
106
- message: r.message,
111
+ message: n.message,
107
112
  title: "API request failed",
108
113
  type: "api"
109
114
  }
@@ -144,10 +149,10 @@ class z {
144
149
  }
145
150
  async setReschedule(t) {
146
151
  const e = /* @__PURE__ */ new Date();
147
- this.schedulerStore.set("rescheduleBookingId", t), this.schedulerStore.set("selectedTimeslot", null), this.schedulerStore.set("showThankYouMessage", !1), this.schedulerStore.set("showBookingForm", !1);
148
- const s = new Date(e.getFullYear(), e.getMonth(), 1).getTime() / 1e3, i = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3, r = await this.getAvailability(s, i), o = this.schedulerStore.get("availability").find((g) => new Date(g.start_time) > /* @__PURE__ */ new Date());
149
- let a = e;
150
- return o && (a = o.start_time), this.schedulerStore.set("selectedDate", a), r;
152
+ this.schedulerStore.set("rescheduleBookingId", t), this.schedulerStore.set("selectedTimeslot", null), this.schedulerStore.set("eventInfo", null), this.schedulerStore.set("showBookingForm", !1);
153
+ const s = new Date(e.getFullYear(), e.getMonth(), 1).getTime() / 1e3, i = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3, n = await this.getAvailability(s, i), a = this.schedulerStore.get("availability").find((l) => new Date(l.start_time) > /* @__PURE__ */ new Date());
154
+ let h = e;
155
+ return a && (h = a.start_time), this.schedulerStore.set("selectedDate", h), n;
151
156
  }
152
157
  async setCancel(t) {
153
158
  this.schedulerStore.set("cancelBookingId", t);
@@ -161,120 +166,120 @@ class z {
161
166
  const i = (t == null ? void 0 : t.timeslot) || e;
162
167
  if (!i)
163
168
  return { error: this.errors.component("Create Booking").no_timeslot_selected() };
164
- const r = t ? t == null ? void 0 : t.primaryParticipant : s == null ? void 0 : s.primaryParticipant, o = t ? (t == null ? void 0 : t.guests) || [] : (s == null ? void 0 : s.guests) || [], a = t ? { ...t == null ? void 0 : t.additionalFields } : { ...s == null ? void 0 : s.additionalFields }, g = {
165
- Authorization: `Bearer ${this.sessionId}`
166
- }, u = "/schedule/bookings", c = await this.makeAPIRequest(decodeURIComponent(u), "POST", JSON.stringify({
167
- participants: [r, ...o],
168
- additional_fields: a,
169
+ const n = t ? t == null ? void 0 : t.primaryParticipant : s == null ? void 0 : s.primaryParticipant, a = t ? (t == null ? void 0 : t.guests) || [] : (s == null ? void 0 : s.guests) || [], h = t ? { ...t == null ? void 0 : t.additionalFields, guests: a } : { ...s == null ? void 0 : s.additionalFields, guests: a }, l = this.getHeaders(), p = `/v3/scheduling/bookings${this.configId ? `?configuration_id=${this.configId}` : ""}`, d = await this.makeAPIRequest(decodeURIComponent(p), "POST", JSON.stringify({
170
+ additional_fields: h,
171
+ guest: { ...n },
169
172
  start_time: i.start_time.getTime() / 1e3,
170
173
  end_time: i.end_time.getTime() / 1e3
171
- }), g);
172
- if ("error" in c) {
174
+ }), l);
175
+ if ("error" in d) {
173
176
  this.schedulerStore.set("isLoading", !1);
174
- const h = (m = c.error) == null ? void 0 : m.type;
175
- let l = c.error;
176
- return h && h in this.errors.api("Create Booking") && (l = this.errors.api("Create Booking")[h]((l == null ? void 0 : l.message) || (l == null ? void 0 : l.title) || "Something went wrong")), { error: l };
177
+ const c = (m = d.error) == null ? void 0 : m.type;
178
+ let o = d.error;
179
+ return c && c in this.errors.api("Create Booking") && (o = this.errors.api("Create Booking")[c]((o == null ? void 0 : o.message) || (o == null ? void 0 : o.title) || "Something went wrong")), { error: o };
177
180
  }
178
- return "data" in c && this.schedulerStore.set("eventInfo", c == null ? void 0 : c.data), this.schedulerStore.set("isLoading", !1), c;
181
+ return "data" in d && this.schedulerStore.set("eventInfo", d == null ? void 0 : d.data), this.schedulerStore.set("isLoading", !1), d;
179
182
  }
180
183
  async getAvailability(t = 0, e = 0) {
181
- var c, m, h;
184
+ var p, d, m;
182
185
  this.schedulerStore.set("isLoading", !0);
183
- const s = new URLSearchParams(), r = (/* @__PURE__ */ new Date()).getTime();
184
- if (e && e < r / 1e3)
186
+ const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), n = i.getTime();
187
+ if (e && e < n / 1e3)
185
188
  return this.schedulerStore.set("isLoading", !1), { error: this.errors.component("Get Availability").endtime_not_in_future() };
186
- t && s.append("start_time", encodeURIComponent(t)), e && s.append("end_time", encodeURIComponent(e));
187
- const o = s.toString(), a = `/schedule/availability${o ? `?${o}` : ""}`, g = {
188
- Authorization: `Bearer ${this.sessionId}`
189
- }, u = await this.makeAPIRequest(decodeURIComponent(a), "GET", void 0, g);
189
+ if (!t) {
190
+ const c = new Date(i.getFullYear(), i.getMonth(), 1);
191
+ t = Math.floor(c.getTime() / 1e3);
192
+ }
193
+ if (!e) {
194
+ const c = new Date(i.getFullYear(), i.getMonth() + 1, 0);
195
+ e = Math.floor(c.getTime() / 1e3);
196
+ }
197
+ s.append("start_time", encodeURIComponent(t.toString())), s.append("end_time", encodeURIComponent(e.toString())), this.configId && s.append("configuration_id", encodeURIComponent(this.configId));
198
+ const a = s.toString(), h = `/v3/scheduling/availability${a ? `?${a}` : ""}`, l = this.getHeaders(), u = await this.makeAPIRequest(decodeURIComponent(h), "GET", void 0, l);
190
199
  if ("error" in u) {
191
200
  this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
192
- const l = (c = u.error) == null ? void 0 : c.type;
193
- let d = u.error;
194
- return l && l in this.errors.api("Get Availability") && (d = this.errors.api("Get Availability")[l]((d == null ? void 0 : d.message) || (d == null ? void 0 : d.title) || "Something went wrong")), { error: d };
201
+ const c = (p = u.error) == null ? void 0 : p.type;
202
+ let o = u.error;
203
+ return c && c in this.errors.api("Get Availability") && (o = this.errors.api("Get Availability")[c]((o == null ? void 0 : o.message) || (o == null ? void 0 : o.title) || "Something went wrong")), { error: o };
195
204
  }
196
205
  if ("data" in u) {
197
- const d = (((h = (m = u.data) == null ? void 0 : m.time_slots) == null ? void 0 : h.map((p) => ({
198
- ...p,
199
- start_time: new Date(p.start_time * 1e3),
200
- end_time: new Date(p.end_time * 1e3)
201
- }))) || []).filter((p) => p.start_time.getTime() > r);
202
- this.schedulerStore.set("availability", d);
206
+ const o = (((m = (d = u.data) == null ? void 0 : d.time_slots) == null ? void 0 : m.map((g) => ({
207
+ ...g,
208
+ start_time: new Date(g.start_time * 1e3),
209
+ end_time: new Date(g.end_time * 1e3)
210
+ }))) || []).filter((g) => g.start_time.getTime() > n);
211
+ this.schedulerStore.set("availability", o);
203
212
  }
204
213
  return this.schedulerStore.set("isLoading", !1), u;
205
214
  }
206
215
  async cancelBooking(t) {
207
- var r;
216
+ var a;
208
217
  if (this.schedulerStore.set("isLoading", !0), !t)
209
218
  return { error: this.errors.component("Cancel Booking").no_booking_id() };
210
- const e = `/schedule/bookings/${t}`, s = {
211
- Authorization: `Bearer ${this.sessionId}`
212
- }, i = await this.makeAPIRequest(decodeURIComponent(e), "PUT", JSON.stringify({
219
+ const e = this.configId ? `?configuration_id=${this.configId}` : "", s = `/v3/scheduling/bookings/${t}${e}`, i = this.getHeaders(), n = await this.makeAPIRequest(decodeURIComponent(s), "DELETE", JSON.stringify({
213
220
  action: "cancel"
214
- }), s);
215
- if ("error" in i) {
221
+ }), i);
222
+ if ("error" in n) {
216
223
  this.schedulerStore.set("isLoading", !1);
217
- const o = (r = i.error) == null ? void 0 : r.type;
218
- let a = i.error;
219
- return o && o in this.errors.api("Cancel Booking") && (a = this.errors.api("Cancel Booking")[o]((a == null ? void 0 : a.message) || (a == null ? void 0 : a.title) || "Something went wrong")), { error: a };
224
+ const h = (a = n.error) == null ? void 0 : a.type;
225
+ let l = n.error;
226
+ return h && h in this.errors.api("Cancel Booking") && (l = this.errors.api("Cancel Booking")[h]((l == null ? void 0 : l.message) || (l == null ? void 0 : l.title) || "Something went wrong")), { error: l };
220
227
  }
221
- return "data" in i && this.schedulerStore.set("cancelledEvent", i == null ? void 0 : i.data), this.schedulerStore.set("isLoading", !1), i;
228
+ return this.schedulerStore.set("cancelledEventInfo", {
229
+ booking_id: t
230
+ }), this.schedulerStore.set("isLoading", !1), n;
222
231
  }
223
232
  async rescheduleBooking(t, e) {
224
233
  var w;
225
234
  if (this.schedulerStore.set("isLoading", !0), !t)
226
235
  return { error: this.errors.component("Reschedule Booking").no_booking_id() };
227
- const s = this.errors.api("Reschedule Booking"), i = this.errors.component("Reschedule Booking"), { bookingInfo: r, selectedTimeslot: o, selectedTimezone: a } = this.schedulerStore.state, { startTime: g, endTime: u, timezone: c } = e, m = g || (o == null ? void 0 : o.start_time);
236
+ const s = this.errors.api("Reschedule Booking"), i = this.errors.component("Reschedule Booking"), { bookingInfo: n, selectedTimeslot: a, selectedTimezone: h } = this.schedulerStore.state, { startTime: l, endTime: u, timezone: p } = e, d = l || (a == null ? void 0 : a.start_time);
237
+ if (!d)
238
+ return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
239
+ const m = u || (a == null ? void 0 : a.end_time);
228
240
  if (!m)
229
- return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerStoreState.') };
230
- const h = u || (o == null ? void 0 : o.end_time);
231
- if (!h)
232
- return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerStoreState.') };
233
- const l = c || a;
234
- if (!l)
235
- return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerStoreState.') };
236
- const d = e ? e == null ? void 0 : e.primaryParticipant : r == null ? void 0 : r.primaryParticipant, p = e ? (e == null ? void 0 : e.guests) || [] : (r == null ? void 0 : r.guests) || [], T = e ? { ...e == null ? void 0 : e.additionalFields } : { ...r == null ? void 0 : r.additionalFields }, P = `/schedule/bookings/${t}`, B = {
237
- Authorization: `Bearer ${this.sessionId}`
238
- }, _ = await this.makeAPIRequest(decodeURIComponent(P), "PATCH", JSON.stringify({
239
- start_time: m.getTime() / 1e3,
240
- end_time: h.getTime() / 1e3,
241
- time_zone: l,
242
- participants: [d, ...p],
243
- additional_fields: T
244
- }), B);
241
+ return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
242
+ const c = p || h;
243
+ if (!c)
244
+ return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
245
+ const o = e ? e == null ? void 0 : e.primaryParticipant : n == null ? void 0 : n.primaryParticipant, g = e ? (e == null ? void 0 : e.guests) || [] : (n == null ? void 0 : n.guests) || [], b = e ? { ...e == null ? void 0 : e.additionalFields, guests: g } : { ...n == null ? void 0 : n.additionalFields, guests: g }, k = this.configId ? `?configuration_id=${this.configId}` : "", T = `/v3/scheduling/bookings/${t}${k}`, D = this.getHeaders(), _ = await this.makeAPIRequest(decodeURIComponent(T), "PATCH", JSON.stringify({
246
+ start_time: d.getTime() / 1e3,
247
+ end_time: m.getTime() / 1e3,
248
+ time_zone: c,
249
+ additional_fields: b,
250
+ guest: { ...o }
251
+ }), D);
245
252
  if ("error" in _) {
246
253
  this.schedulerStore.set("isLoading", !1);
247
254
  const v = (w = _.error) == null ? void 0 : w.type;
248
- let S = _.error;
249
- v && v in s && (S = s[v]((S == null ? void 0 : S.message) || (S == null ? void 0 : S.title) || "Something went wrong"));
255
+ let f = _.error;
256
+ v && v in s && (f = s[v]((f == null ? void 0 : f.message) || (f == null ? void 0 : f.title) || "Something went wrong"));
250
257
  }
251
258
  return "data" in _ && this.schedulerStore.set("eventInfo", _ == null ? void 0 : _.data), this.schedulerStore.set("isLoading", !1), _;
252
259
  }
253
260
  }
254
- function C(n = {}) {
261
+ function z(r = {}) {
255
262
  const t = {
256
263
  selectedDate: null,
257
264
  selectedLanguage: navigator.language,
258
265
  selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
259
266
  selectedTimeslot: null,
260
267
  showBookingForm: !1,
261
- showThankYouMessage: !1,
262
268
  selectableDates: null,
263
269
  availability: [],
264
270
  state: "ready",
265
271
  eventInfo: null,
266
- cancelledEvent: null,
272
+ cancelledEventInfo: null,
267
273
  isLoading: !1,
268
- ...n
274
+ nylasBranding: !0,
275
+ ...r
269
276
  };
270
277
  y("[defaultNylasStoreState]: ", t);
271
- const e = A(t);
278
+ const e = R(t);
272
279
  return e.onChange("availability", (s) => {
273
280
  y("[availability]: ", s);
274
- const i = s.map((r) => r.start_time);
281
+ const i = s.map((n) => n.start_time);
275
282
  y("[selectableDates]: ", i), e.set("selectableDates", i);
276
- }), e.onChange("rescheduleBookingId", (s) => {
277
- s ? e.set("bookingFlow", "rescheduling") : e.set("bookingFlow", "booking");
278
283
  }), e.reset = () => {
279
284
  for (const s in t) {
280
285
  const i = t[s];
@@ -283,7 +288,7 @@ function C(n = {}) {
283
288
  }, e;
284
289
  }
285
290
  export {
286
- C,
287
- f as E,
288
- z as N
291
+ z as C,
292
+ S as E,
293
+ C as N
289
294
  };
@@ -0,0 +1 @@
1
+ "use strict";const v=require("./utils-c00bdc3c-94b9c3b6.cjs"),C=require("./index-7a55dc33.cjs");exports.ErrorCategory=void 0;(function(n){n.Component="component",n.Api="api",n.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var w;(function(n){n.endtime_not_in_future="endtime_not_in_future",n.no_booking_info="no_booking_info",n.no_timeslot_selected="no_timeslot_selected",n.no_booking_id="no_booking_id",n.invalid_start_time="invalid_start_time",n.invalid_end_time="invalid_end_time",n.invalid_timezone="invalid_timezone"})(w||(w={}));var b;(function(n){n.invalid_session="invalid_session",n.general_error="general_error",n.internal_error="internal_error",n.invalid_request_error="invalid_request_error",n.timeslot_not_available="timeslot_not_available"})(b||(b={}));class D{constructor(){this.component=t=>{const e=exports.ErrorCategory.Component,s=`${t} error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:e}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:e}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:e}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:e}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:e}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:e}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:e})}},this.api=t=>{const e=exports.ErrorCategory.Api,s=`${t} error`;return{invalid_session:i=>({title:s,message:i,category:e}),general_error:i=>({title:s,message:i,category:e}),internal_error:i=>({title:s,message:i,category:e}),invalid_request_error:i=>({title:s,message:i,category:e}),timeslot_not_available:i=>({title:s,message:i,category:e})}}}}class R{constructor({schedulerAPIURL:t,schedulerStore:e,sessionId:s,configId:i}){this.errors=new D,this.schedulerStore=e,this.schedulerAPIURL=t,this.sessionId=s,this.configId=i}getHeaders(){return this.configId?{}:{Authorization:`Bearer ${this.sessionId}`}}async makeAPIRequest(t,e,s,i={}){try{const r=new URL(this.schedulerAPIURL);return r.pathname=t,await(await fetch(decodeURIComponent(r.toString()),{method:e,headers:{"Content-Type":"application/json",...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}selectDate(t){this.schedulerStore.set("selectedDate",t),this.schedulerStore.set("selectedTimeslot",null)}selectTime(t){this.schedulerStore.set("selectedTimeslot",t)}selectTimezone(t){this.schedulerStore.set("selectedTimezone",t)}toggleAdditionalData(t){this.schedulerStore.set("showBookingForm",t)}setParticipantName(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e==null?void 0:e.primaryParticipant,name:t}})}setParticipantEmail(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e==null?void 0:e.primaryParticipant,email:t}})}async setReschedule(t){const e=new Date;this.schedulerStore.set("rescheduleBookingId",t),this.schedulerStore.set("selectedTimeslot",null),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1);const s=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3,r=await this.getAvailability(s,i),a=this.schedulerStore.get("availability").find(l=>new Date(l.start_time)>new Date);let u=e;return a&&(u=a.start_time),this.schedulerStore.set("selectedDate",u),r}async setCancel(t){this.schedulerStore.set("cancelBookingId",t)}async bookTimeslot(t){var g;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:e,bookingInfo:s}=this.schedulerStore.state;if(!t&&!s)return{error:this.errors.component("Booking").no_booking_info()};const i=(t==null?void 0:t.timeslot)||e;if(!i)return{error:this.errors.component("Create Booking").no_timeslot_selected()};const r=t?t==null?void 0:t.primaryParticipant:s==null?void 0:s.primaryParticipant,a=t?(t==null?void 0:t.guests)||[]:(s==null?void 0:s.guests)||[],u=t?{...t==null?void 0:t.additionalFields,guests:a}:{...s==null?void 0:s.additionalFields,guests:a},l=this.getHeaders(),p=`/v3/scheduling/bookings${this.configId?`?configuration_id=${this.configId}`:""}`,d=await this.makeAPIRequest(decodeURIComponent(p),"POST",JSON.stringify({additional_fields:u,guest:{...r},start_time:i.start_time.getTime()/1e3,end_time:i.end_time.getTime()/1e3}),l);if("error"in d){this.schedulerStore.set("isLoading",!1);const c=(g=d.error)==null?void 0:g.type;let o=d.error;return c&&c in this.errors.api("Create Booking")&&(o=this.errors.api("Create Booking")[c]((o==null?void 0:o.message)||(o==null?void 0:o.title)||"Something went wrong")),{error:o}}return"data"in d&&this.schedulerStore.set("eventInfo",d==null?void 0:d.data),this.schedulerStore.set("isLoading",!1),d}async getAvailability(t=0,e=0){var p,d,g;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,r=i.getTime();if(e&&e<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component("Get Availability").endtime_not_in_future()};if(!t){const c=new Date(i.getFullYear(),i.getMonth(),1);t=Math.floor(c.getTime()/1e3)}if(!e){const c=new Date(i.getFullYear(),i.getMonth()+1,0);e=Math.floor(c.getTime()/1e3)}s.append("start_time",encodeURIComponent(t.toString())),s.append("end_time",encodeURIComponent(e.toString())),this.configId&&s.append("configuration_id",encodeURIComponent(this.configId));const a=s.toString(),u=`/v3/scheduling/availability${a?`?${a}`:""}`,l=this.getHeaders(),h=await this.makeAPIRequest(decodeURIComponent(u),"GET",void 0,l);if("error"in h){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const c=(p=h.error)==null?void 0:p.type;let o=h.error;return c&&c in this.errors.api("Get Availability")&&(o=this.errors.api("Get Availability")[c]((o==null?void 0:o.message)||(o==null?void 0:o.title)||"Something went wrong")),{error:o}}if("data"in h){const o=(((g=(d=h.data)==null?void 0:d.time_slots)==null?void 0:g.map(m=>({...m,start_time:new Date(m.start_time*1e3),end_time:new Date(m.end_time*1e3)})))||[]).filter(m=>m.start_time.getTime()>r);this.schedulerStore.set("availability",o)}return this.schedulerStore.set("isLoading",!1),h}async cancelBooking(t){var a;if(this.schedulerStore.set("isLoading",!0),!t)return{error:this.errors.component("Cancel Booking").no_booking_id()};const e=this.configId?`?configuration_id=${this.configId}`:"",s=`/v3/scheduling/bookings/${t}${e}`,i=this.getHeaders(),r=await this.makeAPIRequest(decodeURIComponent(s),"DELETE",JSON.stringify({action:"cancel"}),i);if("error"in r){this.schedulerStore.set("isLoading",!1);const u=(a=r.error)==null?void 0:a.type;let l=r.error;return u&&u in this.errors.api("Cancel Booking")&&(l=this.errors.api("Cancel Booking")[u]((l==null?void 0:l.message)||(l==null?void 0:l.title)||"Something went wrong")),{error:l}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:t}),this.schedulerStore.set("isLoading",!1),r}async rescheduleBooking(t,e){var y;if(this.schedulerStore.set("isLoading",!0),!t)return{error:this.errors.component("Reschedule Booking").no_booking_id()};const s=this.errors.api("Reschedule Booking"),i=this.errors.component("Reschedule Booking"),{bookingInfo:r,selectedTimeslot:a,selectedTimezone:u}=this.schedulerStore.state,{startTime:l,endTime:h,timezone:p}=e,d=l||(a==null?void 0:a.start_time);if(!d)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const g=h||(a==null?void 0:a.end_time);if(!g)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const c=p||u;if(!c)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const o=e?e==null?void 0:e.primaryParticipant:r==null?void 0:r.primaryParticipant,m=e?(e==null?void 0:e.guests)||[]:(r==null?void 0:r.guests)||[],I=e?{...e==null?void 0:e.additionalFields,guests:m}:{...r==null?void 0:r.additionalFields,guests:m},P=this.configId?`?configuration_id=${this.configId}`:"",k=`/v3/scheduling/bookings/${t}${P}`,T=this.getHeaders(),_=await this.makeAPIRequest(decodeURIComponent(k),"PATCH",JSON.stringify({start_time:d.getTime()/1e3,end_time:g.getTime()/1e3,time_zone:c,additional_fields:I,guest:{...o}}),T);if("error"in _){this.schedulerStore.set("isLoading",!1);const S=(y=_.error)==null?void 0:y.type;let f=_.error;S&&S in s&&(f=s[S]((f==null?void 0:f.message)||(f==null?void 0:f.title)||"Something went wrong"))}return"data"in _&&this.schedulerStore.set("eventInfo",_==null?void 0:_.data),this.schedulerStore.set("isLoading",!1),_}}function L(n={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,selectableDates:null,availability:[],state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...n};v.debug("[defaultNylasStoreState]: ",t);const e=C.createStore(t);return e.onChange("availability",s=>{v.debug("[availability]: ",s);const i=s.map(r=>r.start_time);v.debug("[selectableDates]: ",i),e.set("selectableDates",i)}),e.reset=()=>{for(const s in t){const i=t[s];e.set(s,i)}},e}exports.CreateNylasSchedulerStore=L;exports.NylaSchedulerAPIConnector=R;
@@ -0,0 +1,78 @@
1
+ import { r as i, c as s, h as d, g as n } from "./index-0f3bd8df.js";
2
+ import { d as l } from "./utils-c00bdc3c-89ab163d.js";
3
+ import "react";
4
+ import "react-dom";
5
+ import "./_commonjsHelpers-57e89916-af061c86.js";
6
+ const c = ".time-period-selector.sc-time-period-selector{display:flex;gap:0.5rem}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){min-width:108px}.time-period-selector.sc-time-period-selector select-dropdown#time-number.sc-time-period-selector::part(sd_dropdown-button){min-width:84px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}", a = c, p = class {
7
+ constructor(e) {
8
+ i(this, e), this.timePeriodChanged = s(this, "timePeriodChanged", 7), this.timePeriods = ["hour", "day", "week", "month"], this.defaultSelectedPeriod = "hour", this.defaultSelectedNumber = 1, this.selectedPeriod = this.defaultSelectedPeriod, this.selectedNumber = this.defaultSelectedNumber, this.numberOptions = this.calculateOptions("hour").map((t) => ({
9
+ label: t.toString(),
10
+ value: t.toString()
11
+ })), this.timePeriodOptions = this.timePeriods.map((t) => ({
12
+ label: t,
13
+ value: t
14
+ }));
15
+ }
16
+ defaultSelectedPeriodChangedHandler(e) {
17
+ this.selectedPeriod = e, this.updateNumberOptionsAndSelectedNumber(e);
18
+ }
19
+ defaultSelectedNumberChangedHandler(e) {
20
+ this.selectedNumber = e;
21
+ }
22
+ timePeriodsChangedHandler(e) {
23
+ this.timePeriodOptions = e.map((t) => ({
24
+ label: t,
25
+ value: t
26
+ }));
27
+ }
28
+ calculateOptions(e) {
29
+ switch (e) {
30
+ case "hour":
31
+ return Array.from({ length: 23 }, (t, r) => r + 1);
32
+ case "minute":
33
+ return Array.from({ length: 60 }, (t, r) => r);
34
+ case "day":
35
+ return Array.from({ length: 30 }, (t, r) => r + 1);
36
+ case "week":
37
+ return Array.from({ length: 4 }, (t, r) => r + 1);
38
+ case "month":
39
+ return Array.from({ length: 12 }, (t, r) => r + 1);
40
+ default:
41
+ return [];
42
+ }
43
+ }
44
+ selectedOptionChangedHandler(e) {
45
+ l("time-period-selector", "selectedOptionChangedHandler", e.detail);
46
+ const { value: t, name: r } = e.detail;
47
+ r === "time-period" ? (this.selectedPeriod = t, this.updateNumberOptionsAndSelectedNumber(t)) : r === "time-number" && (this.selectedNumber = parseInt(t));
48
+ const o = {
49
+ number: this.selectedNumber,
50
+ period: this.selectedPeriod
51
+ };
52
+ this.timePeriodChanged.emit(o);
53
+ }
54
+ updateNumberOptionsAndSelectedNumber(e) {
55
+ const t = this.calculateOptions(e);
56
+ this.numberOptions = t.map((r) => ({
57
+ label: r.toString(),
58
+ value: r.toString()
59
+ })), this.selectedNumber = parseInt(this.numberOptions[0].value);
60
+ }
61
+ render() {
62
+ return d("div", { key: "85937e5b0dbeb32c5f2417fa644744c731b4cd57", class: "time-period-selector" }, d("select-dropdown", { key: "030d52e80b1e1561b517009c14109d4c9ecf2577", id: "time-number", name: "time-number", exportparts: "sd__dropdown: tps__number-dropdown, sd__dropdown-button: tps__number-dropdown-button, sd__dropdown-content: tps__number-dropdown-content", options: this.numberOptions, defaultSelectedOption: this.numberOptions.find((e) => e.value == this.selectedNumber.toString()) ?? this.numberOptions[0], withSearch: !1 }), d("select-dropdown", { key: "ddd959a787e5ff9c4cc25ca239af0e75b4eede66", id: "time-period", name: "time-period", options: this.timePeriodOptions, exportparts: "sd__dropdown: tps__period-dropdown, sd__dropdown-button: tps__period-dropdown-button, sd__dropdown-content: tps__period-dropdown-content", pluralizedLabel: this.selectedNumber > 1 ? "s" : "", defaultSelectedOption: this.timePeriodOptions.find((e) => e.value == this.selectedPeriod) ?? this.timePeriodOptions[0], withSearch: !1 }));
63
+ }
64
+ get host() {
65
+ return n(this);
66
+ }
67
+ static get watchers() {
68
+ return {
69
+ defaultSelectedPeriod: ["defaultSelectedPeriodChangedHandler"],
70
+ defaultSelectedNumber: ["defaultSelectedNumberChangedHandler"],
71
+ timePeriods: ["timePeriodsChangedHandler"]
72
+ };
73
+ }
74
+ };
75
+ p.style = a;
76
+ export {
77
+ p as time_period_selector
78
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-7a55dc33.cjs"),s=require("./utils-c00bdc3c-94b9c3b6.cjs");require("react");require("react-dom");require("./_commonjsHelpers-57e89916-4a3ae7d8.cjs");const n=".time-period-selector.sc-time-period-selector{display:flex;gap:0.5rem}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){min-width:108px}.time-period-selector.sc-time-period-selector select-dropdown#time-number.sc-time-period-selector::part(sd_dropdown-button){min-width:84px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}",l=n,i=class{constructor(e){d.registerInstance(this,e),this.timePeriodChanged=d.createEvent(this,"timePeriodChanged",7),this.timePeriods=["hour","day","week","month"],this.defaultSelectedPeriod="hour",this.defaultSelectedNumber=1,this.selectedPeriod=this.defaultSelectedPeriod,this.selectedNumber=this.defaultSelectedNumber,this.numberOptions=this.calculateOptions("hour").map(t=>({label:t.toString(),value:t.toString()})),this.timePeriodOptions=this.timePeriods.map(t=>({label:t,value:t}))}defaultSelectedPeriodChangedHandler(e){this.selectedPeriod=e,this.updateNumberOptionsAndSelectedNumber(e)}defaultSelectedNumberChangedHandler(e){this.selectedNumber=e}timePeriodsChangedHandler(e){this.timePeriodOptions=e.map(t=>({label:t,value:t}))}calculateOptions(e){switch(e){case"hour":return Array.from({length:23},(t,r)=>r+1);case"minute":return Array.from({length:60},(t,r)=>r);case"day":return Array.from({length:30},(t,r)=>r+1);case"week":return Array.from({length:4},(t,r)=>r+1);case"month":return Array.from({length:12},(t,r)=>r+1);default:return[]}}selectedOptionChangedHandler(e){s.debug("time-period-selector","selectedOptionChangedHandler",e.detail);const{value:t,name:r}=e.detail;r==="time-period"?(this.selectedPeriod=t,this.updateNumberOptionsAndSelectedNumber(t)):r==="time-number"&&(this.selectedNumber=parseInt(t));const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}updateNumberOptionsAndSelectedNumber(e){const t=this.calculateOptions(e);this.numberOptions=t.map(r=>({label:r.toString(),value:r.toString()})),this.selectedNumber=parseInt(this.numberOptions[0].value)}render(){return d.h("div",{key:"85937e5b0dbeb32c5f2417fa644744c731b4cd57",class:"time-period-selector"},d.h("select-dropdown",{key:"030d52e80b1e1561b517009c14109d4c9ecf2577",id:"time-number",name:"time-number",exportparts:"sd__dropdown: tps__number-dropdown, sd__dropdown-button: tps__number-dropdown-button, sd__dropdown-content: tps__number-dropdown-content",options:this.numberOptions,defaultSelectedOption:this.numberOptions.find(e=>e.value==this.selectedNumber.toString())??this.numberOptions[0],withSearch:!1}),d.h("select-dropdown",{key:"ddd959a787e5ff9c4cc25ca239af0e75b4eede66",id:"time-period",name:"time-period",options:this.timePeriodOptions,exportparts:"sd__dropdown: tps__period-dropdown, sd__dropdown-button: tps__period-dropdown-button, sd__dropdown-content: tps__period-dropdown-content",pluralizedLabel:this.selectedNumber>1?"s":"",defaultSelectedOption:this.timePeriodOptions.find(e=>e.value==this.selectedPeriod)??this.timePeriodOptions[0],withSearch:!1}))}get host(){return d.getElement(this)}static get watchers(){return{defaultSelectedPeriod:["defaultSelectedPeriodChangedHandler"],defaultSelectedNumber:["defaultSelectedNumberChangedHandler"],timePeriods:["timePeriodsChangedHandler"]}}};i.style=l;exports.time_period_selector=i;
@@ -0,0 +1,15 @@
1
+ import { r as e, h as C } from "./index-0f3bd8df.js";
2
+ import "react";
3
+ import "react-dom";
4
+ const s = ".sc-translate-icon-h{display:flex}", i = s, o = class {
5
+ constructor(t) {
6
+ e(this, t), this.width = "16", this.height = "16";
7
+ }
8
+ render() {
9
+ return C("svg", { key: "cc28e003f52beddf264e14de210359dbeab11321", xmlns: "http://www.w3.org/2000/svg", width: this.width, height: this.height, viewBox: "0 0 20 20", fill: "none" }, C("path", { key: "887afb698a01900cf408d4db7cd389f3505f8211", fill: "currentColor", d: "M14.1663 4.02867C14.4267 4.12081 14.563 4.40654 14.4709 4.66685C14.3501 5.00788 14.2182 5.4771 14.1178 5.86047C14.6877 5.77587 15.2665 5.65653 15.8867 5.51288C16.1557 5.45058 16.4243 5.61815 16.4866 5.88717C16.5489 6.15619 16.3814 6.42479 16.1123 6.4871C15.339 6.66621 14.6101 6.81289 13.8717 6.90283C13.7759 7.35654 13.7014 7.77084 13.6451 8.15021C14.1202 8.04599 14.5738 8.00553 14.9996 8.02075L14.9996 8C14.9996 7.72386 15.2235 7.5 15.4996 7.5C15.7758 7.5 15.9996 7.72386 15.9996 8C15.9996 8.05657 15.9991 8.11281 15.9979 8.16871C17.1392 8.47838 17.9781 9.23987 18.3435 10.2263C18.9579 11.8853 18.1287 13.8787 15.7027 14.9569C15.4504 15.069 15.1549 14.9554 15.0427 14.7031C14.9306 14.4507 15.0442 14.1552 15.2966 14.0431C17.3705 13.1213 17.7913 11.6147 17.4057 10.5737C17.1874 9.984 16.6776 9.44916 15.9129 9.18633C15.6829 10.7237 15.021 11.9466 14.229 12.7925C14.3126 12.9656 14.3958 13.1436 14.4641 13.3151C14.5662 13.5717 14.441 13.8625 14.1844 13.9646C13.9278 14.0667 13.637 13.9415 13.5349 13.6849C13.5066 13.6137 13.4777 13.5463 13.448 13.4802C13.028 13.7794 12.5905 13.9869 12.1705 14.0835C11.5942 14.2161 10.963 14.1517 10.534 13.6942C9.88917 13.0053 9.84361 11.8611 10.2855 10.8412C10.6652 9.96479 11.4186 9.11781 12.5848 8.54034C12.6387 8.07338 12.7199 7.55894 12.8332 6.98891C12.3926 7.00755 11.9403 7.00326 11.4659 6.97127C11.1904 6.95269 10.9821 6.71428 11.0007 6.43876C11.0192 6.16325 11.2577 5.95496 11.5332 5.97353C12.0633 6.00928 12.5641 6.00772 13.0566 5.97553C13.1605 5.55444 13.3512 4.8331 13.5282 4.33317C13.6203 4.07286 13.906 3.93653 14.1663 4.02867ZM12.501 9.74109C11.8436 10.1821 11.427 10.7219 11.2031 11.2387C10.8542 12.0439 10.9881 12.716 11.2638 13.0105C11.2637 13.0104 11.2639 13.0106 11.2638 13.0105C11.3573 13.11 11.5624 13.1973 11.9463 13.109C12.2578 13.0373 12.6311 12.8571 13.0121 12.5576C12.8658 12.22 12.7272 11.8324 12.6313 11.353C12.5405 10.8996 12.4899 10.3743 12.501 9.74109ZM13.7808 11.7797C14.316 11.0956 14.759 10.1665 14.9271 9.01632C14.539 9.00681 14.1111 9.05601 13.6457 9.17854C13.605 9.19274 13.5647 9.20726 13.525 9.22209C13.4663 10.0545 13.5146 10.671 13.6118 11.1568C13.6578 11.3868 13.7156 11.5913 13.7808 11.7797ZM6.92028 5.2159C5.77942 4.88398 4.78409 5.00841 4.07616 5.21575C3.72264 5.3193 3.439 5.44393 3.24121 5.5443C3.14215 5.59457 3.0641 5.63901 3.00903 5.67212C2.98147 5.68868 2.95962 5.70244 2.9437 5.71271L2.92429 5.72542L2.91797 5.72966L2.91566 5.73123L2.91393 5.73241C2.91384 5.73249 2.91436 5.73325 2.94925 5.78397C3.23698 6.20225 3.1703 6.10548 2.91393 5.73241C2.68634 5.88881 2.62863 6.20009 2.78502 6.42767C2.94134 6.65514 3.25207 6.71313 3.47963 6.55703L3.4788 6.5576L3.48576 6.55305C3.49318 6.54826 3.50608 6.5401 3.52423 6.52919C3.56057 6.50735 3.6177 6.47463 3.69373 6.43605C3.84612 6.35872 4.07228 6.2589 4.35724 6.17544C4.92619 6.0088 5.72242 5.90898 6.64043 6.17595C7.35305 6.38517 7.66747 6.76919 7.82692 7.16112C7.98173 7.54163 8.0026 7.95751 8.00531 8.33243C7.46199 8.18407 6.79336 8.03682 6.08385 8.00744C5.04808 7.96456 3.8874 8.17096 2.87738 9.01102C1.98877 9.75011 1.78345 10.8818 2.07014 11.853C2.35713 12.8252 3.14925 13.692 4.31803 13.9348C5.22351 14.123 6.18016 13.8639 6.9599 13.5212C7.3403 13.354 7.69572 13.1594 8.0057 12.9665V13.5C8.0057 13.7761 8.22956 14 8.5057 14C8.78184 14 9.0057 13.7754 9.0057 13.4993L9.0057 8.44586C9.0058 8.05404 9.00595 7.40554 8.7532 6.78428C8.48142 6.11625 7.93342 5.51313 6.92136 5.21622L6.92028 5.2159ZM6.04249 9.00659C6.76366 9.03645 7.44769 9.209 8.0057 9.37205V11.757C7.65814 12.0182 7.13927 12.35 6.55757 12.6057C5.85264 12.9155 5.12729 13.0816 4.52148 12.9557C3.75127 12.7957 3.22322 12.2271 3.02922 11.5699C2.83491 10.9116 2.98777 10.2199 3.51683 9.77985C4.27958 9.14545 5.16917 8.97043 6.04249 9.00659Z" }));
10
+ }
11
+ };
12
+ o.style = i;
13
+ export {
14
+ o as translate_icon
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./index-7a55dc33.cjs");require("react");require("react-dom");const s=".sc-translate-icon-h{display:flex}",i=s,e=class{constructor(t){C.registerInstance(this,t),this.width="16",this.height="16"}render(){return C.h("svg",{key:"cc28e003f52beddf264e14de210359dbeab11321",xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height,viewBox:"0 0 20 20",fill:"none"},C.h("path",{key:"887afb698a01900cf408d4db7cd389f3505f8211",fill:"currentColor",d:"M14.1663 4.02867C14.4267 4.12081 14.563 4.40654 14.4709 4.66685C14.3501 5.00788 14.2182 5.4771 14.1178 5.86047C14.6877 5.77587 15.2665 5.65653 15.8867 5.51288C16.1557 5.45058 16.4243 5.61815 16.4866 5.88717C16.5489 6.15619 16.3814 6.42479 16.1123 6.4871C15.339 6.66621 14.6101 6.81289 13.8717 6.90283C13.7759 7.35654 13.7014 7.77084 13.6451 8.15021C14.1202 8.04599 14.5738 8.00553 14.9996 8.02075L14.9996 8C14.9996 7.72386 15.2235 7.5 15.4996 7.5C15.7758 7.5 15.9996 7.72386 15.9996 8C15.9996 8.05657 15.9991 8.11281 15.9979 8.16871C17.1392 8.47838 17.9781 9.23987 18.3435 10.2263C18.9579 11.8853 18.1287 13.8787 15.7027 14.9569C15.4504 15.069 15.1549 14.9554 15.0427 14.7031C14.9306 14.4507 15.0442 14.1552 15.2966 14.0431C17.3705 13.1213 17.7913 11.6147 17.4057 10.5737C17.1874 9.984 16.6776 9.44916 15.9129 9.18633C15.6829 10.7237 15.021 11.9466 14.229 12.7925C14.3126 12.9656 14.3958 13.1436 14.4641 13.3151C14.5662 13.5717 14.441 13.8625 14.1844 13.9646C13.9278 14.0667 13.637 13.9415 13.5349 13.6849C13.5066 13.6137 13.4777 13.5463 13.448 13.4802C13.028 13.7794 12.5905 13.9869 12.1705 14.0835C11.5942 14.2161 10.963 14.1517 10.534 13.6942C9.88917 13.0053 9.84361 11.8611 10.2855 10.8412C10.6652 9.96479 11.4186 9.11781 12.5848 8.54034C12.6387 8.07338 12.7199 7.55894 12.8332 6.98891C12.3926 7.00755 11.9403 7.00326 11.4659 6.97127C11.1904 6.95269 10.9821 6.71428 11.0007 6.43876C11.0192 6.16325 11.2577 5.95496 11.5332 5.97353C12.0633 6.00928 12.5641 6.00772 13.0566 5.97553C13.1605 5.55444 13.3512 4.8331 13.5282 4.33317C13.6203 4.07286 13.906 3.93653 14.1663 4.02867ZM12.501 9.74109C11.8436 10.1821 11.427 10.7219 11.2031 11.2387C10.8542 12.0439 10.9881 12.716 11.2638 13.0105C11.2637 13.0104 11.2639 13.0106 11.2638 13.0105C11.3573 13.11 11.5624 13.1973 11.9463 13.109C12.2578 13.0373 12.6311 12.8571 13.0121 12.5576C12.8658 12.22 12.7272 11.8324 12.6313 11.353C12.5405 10.8996 12.4899 10.3743 12.501 9.74109ZM13.7808 11.7797C14.316 11.0956 14.759 10.1665 14.9271 9.01632C14.539 9.00681 14.1111 9.05601 13.6457 9.17854C13.605 9.19274 13.5647 9.20726 13.525 9.22209C13.4663 10.0545 13.5146 10.671 13.6118 11.1568C13.6578 11.3868 13.7156 11.5913 13.7808 11.7797ZM6.92028 5.2159C5.77942 4.88398 4.78409 5.00841 4.07616 5.21575C3.72264 5.3193 3.439 5.44393 3.24121 5.5443C3.14215 5.59457 3.0641 5.63901 3.00903 5.67212C2.98147 5.68868 2.95962 5.70244 2.9437 5.71271L2.92429 5.72542L2.91797 5.72966L2.91566 5.73123L2.91393 5.73241C2.91384 5.73249 2.91436 5.73325 2.94925 5.78397C3.23698 6.20225 3.1703 6.10548 2.91393 5.73241C2.68634 5.88881 2.62863 6.20009 2.78502 6.42767C2.94134 6.65514 3.25207 6.71313 3.47963 6.55703L3.4788 6.5576L3.48576 6.55305C3.49318 6.54826 3.50608 6.5401 3.52423 6.52919C3.56057 6.50735 3.6177 6.47463 3.69373 6.43605C3.84612 6.35872 4.07228 6.2589 4.35724 6.17544C4.92619 6.0088 5.72242 5.90898 6.64043 6.17595C7.35305 6.38517 7.66747 6.76919 7.82692 7.16112C7.98173 7.54163 8.0026 7.95751 8.00531 8.33243C7.46199 8.18407 6.79336 8.03682 6.08385 8.00744C5.04808 7.96456 3.8874 8.17096 2.87738 9.01102C1.98877 9.75011 1.78345 10.8818 2.07014 11.853C2.35713 12.8252 3.14925 13.692 4.31803 13.9348C5.22351 14.123 6.18016 13.8639 6.9599 13.5212C7.3403 13.354 7.69572 13.1594 8.0057 12.9665V13.5C8.0057 13.7761 8.22956 14 8.5057 14C8.78184 14 9.0057 13.7754 9.0057 13.4993L9.0057 8.44586C9.0058 8.05404 9.00595 7.40554 8.7532 6.78428C8.48142 6.11625 7.93342 5.51313 6.92136 5.21622L6.92028 5.2159ZM6.04249 9.00659C6.76366 9.03645 7.44769 9.209 8.0057 9.37205V11.757C7.65814 12.0182 7.13927 12.35 6.55757 12.6057C5.85264 12.9155 5.12729 13.0816 4.52148 12.9557C3.75127 12.7957 3.22322 12.2271 3.02922 11.5699C2.83491 10.9116 2.98777 10.2199 3.51683 9.77985C4.27958 9.14545 5.16917 8.97043 6.04249 9.00659Z"}))}};e.style=i;exports.translate_icon=e;