@nylas/react 1.1.0-canary.9 → 1.1.1

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 (154) hide show
  1. package/README.md +110 -2
  2. package/dist/add-circle-icon_2.entry-b14ecb5c.js +25 -0
  3. package/dist/add-circle-icon_2.entry-c6211866.cjs +1 -0
  4. package/dist/archive-icon_7.entry-3fe7721a.js +75 -0
  5. package/dist/archive-icon_7.entry-54fc1f03.cjs +1 -0
  6. package/dist/arrow-icon.entry-1dfee3bc.cjs +1 -0
  7. package/dist/arrow-icon.entry-cc936041.js +15 -0
  8. package/dist/bold-icon_3.entry-4b9de887.cjs +1 -0
  9. package/dist/bold-icon_3.entry-e2a1d434.js +35 -0
  10. package/dist/button-component_2.entry-3639ade6.js +26 -0
  11. package/dist/button-component_2.entry-5666fdfa.cjs +1 -0
  12. package/dist/calendar-agenda-fill-icon_48.entry-56e364cd.js +5256 -0
  13. package/dist/calendar-agenda-fill-icon_48.entry-bf278e34.cjs +7 -0
  14. package/dist/calendar-cancel-icon.entry-ac1cb5dd.cjs +1 -0
  15. package/dist/calendar-cancel-icon.entry-dcd777cd.js +15 -0
  16. package/dist/calendar-check-icon_2.entry-6330bd2d.js +25 -0
  17. package/dist/calendar-check-icon_2.entry-7ad1b2a0.cjs +1 -0
  18. package/dist/calendar-icon.entry-5849a547.cjs +1 -0
  19. package/dist/calendar-icon.entry-8559fa0d.js +15 -0
  20. package/dist/checkbox-component_2.entry-1474c465.js +79 -0
  21. package/dist/checkbox-component_2.entry-6cf5da6b.cjs +1 -0
  22. package/dist/chevron-icon_3.entry-41170718.cjs +1 -0
  23. package/dist/chevron-icon_3.entry-cb757aa3.js +132 -0
  24. package/dist/clock-icon_4.entry-36a33de5.cjs +1 -0
  25. package/dist/clock-icon_4.entry-642f4dc6.js +45 -0
  26. package/dist/constants-50c3e067-4e027da4.cjs +15 -0
  27. package/dist/constants-50c3e067-83f1d865.js +3883 -0
  28. package/dist/copy-icon.entry-60740516.js +15 -0
  29. package/dist/copy-icon.entry-fb63cf53.cjs +1 -0
  30. package/dist/core-js-38e53e34.cjs +4 -0
  31. package/dist/core-js-a9d3b6e1.js +3297 -0
  32. package/dist/delete-icon_2.entry-45851bc5.js +25 -0
  33. package/dist/delete-icon_2.entry-d1af0606.cjs +1 -0
  34. package/dist/document-refresh-icon.entry-1731d4d9.cjs +1 -0
  35. package/dist/document-refresh-icon.entry-5db0830a.js +15 -0
  36. package/dist/dom-68f08be9.cjs +15 -0
  37. package/dist/dom-86e17616.js +664 -0
  38. package/dist/{types/elements → elements}/index.d.ts +48 -1
  39. package/dist/elements-dc5b338e-3099ee02.js +28031 -0
  40. package/dist/elements-dc5b338e-ab9afb63.cjs +16516 -0
  41. package/dist/flow-40ff9cea-6f8c30e2.cjs +9 -0
  42. package/dist/flow-40ff9cea-ee70fdf5.js +505 -0
  43. package/dist/focus-visible-e8093c16-067a8f23.js +84 -0
  44. package/dist/focus-visible-e8093c16-811f50fa.cjs +1 -0
  45. package/dist/forward-icon_6.entry-4e9c9686.cjs +3 -0
  46. package/dist/forward-icon_6.entry-e7c5fa46.js +953 -0
  47. package/dist/globe-icon.entry-74f79652.cjs +1 -0
  48. package/dist/globe-icon.entry-aa3f3ea3.js +15 -0
  49. package/dist/google-logo-icon_4.entry-0332a181.cjs +1 -0
  50. package/dist/google-logo-icon_4.entry-3fe41d69.js +673 -0
  51. package/dist/index-2a53b6a8.cjs +82 -0
  52. package/dist/index-a134f625.js +12842 -0
  53. package/dist/index.es-79f5b771-64a1baf0.cjs +7 -0
  54. package/dist/index.es-79f5b771-ce07d6fc.js +3135 -0
  55. package/dist/info-icon_2.entry-a3f40027.cjs +1 -0
  56. package/dist/info-icon_2.entry-fed731f4.js +34 -0
  57. package/dist/input-color-picker.entry-37826630.js +48 -0
  58. package/dist/input-color-picker.entry-cbdce7a1.cjs +1 -0
  59. package/dist/input-component.entry-b83b7103.js +70 -0
  60. package/dist/input-component.entry-e71b7062.cjs +1 -0
  61. package/dist/input-dropdown.entry-150819cd.cjs +1 -0
  62. package/dist/input-dropdown.entry-db0dae5f.js +134 -0
  63. package/dist/mailbox-store-9c52a3fa-04f22f60.cjs +1 -0
  64. package/dist/mailbox-store-9c52a3fa-80fe343c.js +380 -0
  65. package/dist/multi-select-dropdown.entry-629329d7.cjs +1 -0
  66. package/dist/multi-select-dropdown.entry-6b429b39.js +95 -0
  67. package/dist/nylas-booked-event-card_12.entry-660af56a.cjs +1 -0
  68. package/dist/nylas-booked-event-card_12.entry-c22c02b4.js +1133 -0
  69. package/dist/nylas-form-card.entry-2ced5eef.cjs +1 -0
  70. package/dist/nylas-form-card.entry-f3d6a1e4.js +57 -0
  71. package/dist/nylas-if-state.entry-55c32c0c.cjs +1 -0
  72. package/dist/nylas-if-state.entry-862ad978.js +94 -0
  73. package/dist/nylas-list-folders.entry-544fd38d.js +120 -0
  74. package/dist/nylas-list-folders.entry-77e936f7.cjs +1 -0
  75. package/dist/nylas-list-threads.entry-71411da7.js +70 -0
  76. package/dist/nylas-list-threads.entry-82e04782.cjs +1 -0
  77. package/dist/nylas-login.entry-3ccc2bef.cjs +1 -0
  78. package/dist/nylas-login.entry-48179c01.js +73 -0
  79. package/dist/nylas-mailbox-pagination.entry-77cf03b5.js +101 -0
  80. package/dist/nylas-mailbox-pagination.entry-d31f9aa4.cjs +1 -0
  81. package/dist/nylas-mailbox-toolbar-button.entry-33aad610.cjs +1 -0
  82. package/dist/nylas-mailbox-toolbar-button.entry-40e3c373.js +82 -0
  83. package/dist/nylas-mailbox.entry-963de1c3.cjs +1 -0
  84. package/dist/nylas-mailbox.entry-f4066fb2.js +134 -0
  85. package/dist/nylas-provider.entry-08767da3.cjs +1 -0
  86. package/dist/nylas-provider.entry-c61428b1.js +145 -0
  87. package/dist/nylas-reminder-emails.entry-cd8e1d2e.js +129 -0
  88. package/dist/nylas-reminder-emails.entry-d42a7f1d.cjs +4 -0
  89. package/dist/nylas-reminder-time_2.entry-d7115393.js +105 -0
  90. package/dist/nylas-reminder-time_2.entry-e5540fdd.cjs +1 -0
  91. package/dist/nylas-scheduler-editor.entry-65eb4938.js +1447 -0
  92. package/dist/nylas-scheduler-editor.entry-67904653.cjs +2 -0
  93. package/dist/nylas-scheduling.entry-50e41d85.cjs +1 -0
  94. package/dist/nylas-scheduling.entry-7aad4f63.js +345 -0
  95. package/dist/nylas-threads-refresh.entry-1b8befab.cjs +1 -0
  96. package/dist/nylas-threads-refresh.entry-d025575a.js +74 -0
  97. package/dist/nylas-threads-search.entry-78c06183.cjs +1 -0
  98. package/dist/nylas-threads-search.entry-a254c36e.js +69 -0
  99. package/dist/nylas-time-window-picker.entry-30baeb50.cjs +1 -0
  100. package/dist/nylas-time-window-picker.entry-89c15823.js +316 -0
  101. package/dist/nylas-view-thread.entry-939a4561.cjs +1 -0
  102. package/dist/nylas-view-thread.entry-c8d56573.js +203 -0
  103. package/dist/person-icon.entry-5ab75598.cjs +1 -0
  104. package/dist/person-icon.entry-8aef4041.js +15 -0
  105. package/dist/play-icon_2.entry-392ad303.cjs +1 -0
  106. package/dist/play-icon_2.entry-4b068c1b.js +25 -0
  107. package/dist/react.cjs +1 -0
  108. package/dist/react.js +145 -0
  109. package/dist/refresh-icon.entry-9ea254c9.cjs +1 -0
  110. package/dist/refresh-icon.entry-a754a2b5.js +15 -0
  111. package/dist/register-component-ea95564d-ab3d630f.cjs +1 -0
  112. package/dist/register-component-ea95564d-e19ec159.js +109 -0
  113. package/dist/scheduler-config-store-2a3b403d-4e10b542.cjs +1 -0
  114. package/dist/scheduler-config-store-2a3b403d-581c70cf.js +27 -0
  115. package/dist/scheduler-store-9ff4914b-6e28240e.cjs +1 -0
  116. package/dist/scheduler-store-9ff4914b-b71a0aca.js +474 -0
  117. package/dist/textarea-component.entry-70bb02bf.cjs +1 -0
  118. package/dist/textarea-component.entry-a5daab6c.js +37 -0
  119. package/dist/time-period-selector.entry-25348de7.js +80 -0
  120. package/dist/time-period-selector.entry-6306e456.cjs +1 -0
  121. package/dist/translate-icon.entry-785fa109.cjs +1 -0
  122. package/dist/translate-icon.entry-b6094ecc.js +15 -0
  123. package/dist/warning-icon.entry-4b400ee2.js +15 -0
  124. package/dist/warning-icon.entry-94e34c58.cjs +1 -0
  125. package/package.json +12 -8
  126. package/dist/elements/index.js +0 -92
  127. package/dist/elements/index.js.map +0 -1
  128. package/dist/elements/react-component-lib/createComponent.js +0 -65
  129. package/dist/elements/react-component-lib/createComponent.js.map +0 -1
  130. package/dist/elements/react-component-lib/createOverlayComponent.js +0 -98
  131. package/dist/elements/react-component-lib/createOverlayComponent.js.map +0 -1
  132. package/dist/elements/react-component-lib/index.js +0 -3
  133. package/dist/elements/react-component-lib/index.js.map +0 -1
  134. package/dist/elements/react-component-lib/interfaces.js +0 -2
  135. package/dist/elements/react-component-lib/interfaces.js.map +0 -1
  136. package/dist/elements/react-component-lib/utils/attachProps.js +0 -92
  137. package/dist/elements/react-component-lib/utils/attachProps.js.map +0 -1
  138. package/dist/elements/react-component-lib/utils/case.js +0 -7
  139. package/dist/elements/react-component-lib/utils/case.js.map +0 -1
  140. package/dist/elements/react-component-lib/utils/dev.js +0 -13
  141. package/dist/elements/react-component-lib/utils/dev.js.map +0 -1
  142. package/dist/elements/react-component-lib/utils/index.js +0 -31
  143. package/dist/elements/react-component-lib/utils/index.js.map +0 -1
  144. package/dist/index.js +0 -29
  145. package/dist/index.js.map +0 -1
  146. /package/dist/{types/elements → elements}/react-component-lib/createComponent.d.ts +0 -0
  147. /package/dist/{types/elements → elements}/react-component-lib/createOverlayComponent.d.ts +0 -0
  148. /package/dist/{types/elements → elements}/react-component-lib/index.d.ts +0 -0
  149. /package/dist/{types/elements → elements}/react-component-lib/interfaces.d.ts +0 -0
  150. /package/dist/{types/elements → elements}/react-component-lib/utils/attachProps.d.ts +0 -0
  151. /package/dist/{types/elements → elements}/react-component-lib/utils/case.d.ts +0 -0
  152. /package/dist/{types/elements → elements}/react-component-lib/utils/dev.d.ts +0 -0
  153. /package/dist/{types/elements → elements}/react-component-lib/utils/index.d.ts +0 -0
  154. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
@@ -0,0 +1,474 @@
1
+ import { d as b, e as $, k as d, m as R } from "./index-a134f625.js";
2
+ var w;
3
+ (function(a) {
4
+ a.Component = "component", a.Api = "api", a.Auth = "auth";
5
+ })(w || (w = {}));
6
+ var D;
7
+ (function(a) {
8
+ a.endtime_not_in_future = "endtime_not_in_future", a.no_booking_info = "no_booking_info", a.no_timeslot_selected = "no_timeslot_selected", a.no_timezone_selected = "no_timezone_selected", a.no_booking_id = "no_booking_id", a.no_salt = "no_salt", a.invalid_start_time = "invalid_start_time", a.invalid_end_time = "invalid_end_time", a.invalid_timezone = "invalid_timezone";
9
+ })(D || (D = {}));
10
+ var A;
11
+ (function(a) {
12
+ a.invalid_session = "invalid_session", a.general_error = "general_error", a.internal_error = "internal_error", a.invalid_request_error = "invalid_request_error", a.timeslot_not_available = "timeslot_not_available", a.provider_error = "provider_error", a.not_found_error = "not_found_error";
13
+ })(A || (A = {}));
14
+ class C {
15
+ constructor() {
16
+ this.component = (e) => {
17
+ const t = w.Component, s = `${e} Error`;
18
+ return {
19
+ endtime_not_in_future: (i = '"endtime" can not be in the future') => ({
20
+ title: s,
21
+ message: i,
22
+ category: t
23
+ }),
24
+ no_booking_info: (i = "No booking info provided") => ({
25
+ title: s,
26
+ message: i,
27
+ category: t
28
+ }),
29
+ no_timeslot_selected: (i = "No timeslot selected") => ({
30
+ title: s,
31
+ message: i,
32
+ category: t
33
+ }),
34
+ no_timezone_selected: (i = "No timezone selected") => ({
35
+ title: s,
36
+ message: i,
37
+ category: t
38
+ }),
39
+ no_booking_id: (i = "No booking id provided") => ({
40
+ title: s,
41
+ message: i,
42
+ category: t
43
+ }),
44
+ no_salt: (i = "No salt provided") => ({
45
+ title: s,
46
+ message: i,
47
+ category: t
48
+ }),
49
+ invalid_start_time: (i = "Invalid start time") => ({
50
+ title: s,
51
+ message: i,
52
+ category: t
53
+ }),
54
+ invalid_end_time: (i = "Invalid end time") => ({
55
+ title: s,
56
+ message: i,
57
+ category: t
58
+ }),
59
+ invalid_timezone: (i = "Invalid timezone") => ({
60
+ title: s,
61
+ message: i,
62
+ category: t
63
+ })
64
+ };
65
+ }, this.api = (e) => {
66
+ const t = w.Api, s = `${e} Error`;
67
+ return {
68
+ invalid_session: (i) => ({
69
+ title: s,
70
+ message: i,
71
+ category: t
72
+ }),
73
+ general_error: (i) => ({
74
+ title: s,
75
+ message: i,
76
+ category: t
77
+ }),
78
+ internal_error: (i) => ({
79
+ title: s,
80
+ message: i,
81
+ category: t
82
+ }),
83
+ invalid_request_error: (i) => ({
84
+ title: s,
85
+ message: i,
86
+ category: t
87
+ }),
88
+ timeslot_not_available: (i) => ({
89
+ title: s,
90
+ message: i,
91
+ category: t
92
+ }),
93
+ provider_error: (i) => ({
94
+ title: s,
95
+ message: i,
96
+ category: t
97
+ }),
98
+ not_found_error: (i) => ({
99
+ title: s,
100
+ message: i,
101
+ category: t
102
+ })
103
+ };
104
+ };
105
+ }
106
+ }
107
+ class U {
108
+ constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug: n, clientId: r }) {
109
+ this.errors = new C(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug = n, this.clientId = r;
110
+ }
111
+ getHeaders() {
112
+ return this.sessionId ? {
113
+ Authorization: `Bearer ${this.sessionId}`
114
+ } : {};
115
+ }
116
+ async makeAPIRequest(e, t, s, i = {}) {
117
+ try {
118
+ const n = new URL(this.schedulerAPIURL);
119
+ return n.pathname = e, await (await fetch(decodeURIComponent(n.toString()), {
120
+ method: t,
121
+ headers: {
122
+ "Content-Type": "application/json",
123
+ Origin: window.location.origin,
124
+ ...i
125
+ },
126
+ body: s
127
+ })).json();
128
+ } catch (n) {
129
+ return {
130
+ error: {
131
+ message: n.message,
132
+ title: "API request failed",
133
+ type: "api"
134
+ }
135
+ };
136
+ }
137
+ }
138
+ getErrorMessage(e) {
139
+ var s, i, n, r;
140
+ let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
141
+ return (e == null ? void 0 : e.type) === "provider_error" && (t = ((i = (s = e == null ? void 0 : e.provider_error) == null ? void 0 : s.error) == null ? void 0 : i.message) || ((r = (n = e == null ? void 0 : e.provider_error) == null ? void 0 : n.error) == null ? void 0 : r.title) || "Something went wrong"), t;
142
+ }
143
+ setConfigId(e) {
144
+ this.configId = e;
145
+ }
146
+ selectDate(e) {
147
+ this.schedulerStore.set("selectedDate", e), this.schedulerStore.set("selectedTimeslot", null);
148
+ }
149
+ selectTime(e) {
150
+ this.schedulerStore.set("selectedTimeslot", e);
151
+ }
152
+ selectTimezone(e) {
153
+ this.schedulerStore.set("selectedTimezone", e);
154
+ }
155
+ selectLanguage(e) {
156
+ this.schedulerStore.set("selectedLanguage", e), d.changeLanguage(e);
157
+ }
158
+ async toggleAdditionalData(e) {
159
+ e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
160
+ }
161
+ setParticipantName(e) {
162
+ const { bookingInfo: t } = this.schedulerStore.state;
163
+ this.schedulerStore.set("bookingInfo", {
164
+ ...t,
165
+ primaryParticipant: {
166
+ ...t == null ? void 0 : t.primaryParticipant,
167
+ name: e
168
+ }
169
+ });
170
+ }
171
+ setParticipantEmail(e) {
172
+ const { bookingInfo: t } = this.schedulerStore.state;
173
+ this.schedulerStore.set("bookingInfo", {
174
+ ...t,
175
+ primaryParticipant: {
176
+ ...t == null ? void 0 : t.primaryParticipant,
177
+ email: e
178
+ }
179
+ });
180
+ }
181
+ async refetchAvailability() {
182
+ const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1).getTime() / 1e3, s = t < e.getTime() / 1e3 ? Math.floor(e.getTime() / 1e3) : t, i = new Date(e.getFullYear(), e.getMonth() + 1, 1).getTime() / 1e3;
183
+ return await this.getAvailability(s, i);
184
+ }
185
+ async resetStoreStateAndFetchAvailability() {
186
+ const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((n) => new Date(n.start_time) > /* @__PURE__ */ new Date());
187
+ let i = e;
188
+ return s && (i = s.start_time), this.schedulerStore.set("selectedDate", i), this.schedulerStore.set("eventInfo", null), this.schedulerStore.set("showBookingForm", !1), this.schedulerStore.set("selectedTimeslot", null), t;
189
+ }
190
+ async setReschedule(e) {
191
+ this.schedulerStore.set("isLoading", !0);
192
+ const t = this.schedulerStore.state.eventInfo;
193
+ return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.resetStoreStateAndFetchAvailability().finally(() => {
194
+ this.schedulerStore.set("isLoading", !1);
195
+ });
196
+ }
197
+ async setCancel(e) {
198
+ this.schedulerStore.set("cancelBookingId", e);
199
+ }
200
+ async setReject(e) {
201
+ this.schedulerStore.set("rejectBookingId", e);
202
+ }
203
+ async resetCancel() {
204
+ const e = await this.resetStoreStateAndFetchAvailability();
205
+ return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("rejectBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
206
+ }
207
+ async goBack() {
208
+ this.schedulerStore.set("cancelBookingId", "");
209
+ }
210
+ async resetConfirm() {
211
+ const e = await this.resetStoreStateAndFetchAvailability();
212
+ return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
213
+ }
214
+ async bookTimeslot(e) {
215
+ var v;
216
+ this.schedulerStore.set("isLoading", !0);
217
+ const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: n } = this.schedulerStore.state;
218
+ if (!e && !i)
219
+ return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
220
+ const r = (e == null ? void 0 : e.timeslot) || t;
221
+ if (!r)
222
+ return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
223
+ const o = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s;
224
+ if (!o)
225
+ return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
226
+ const u = this.schedulerStore.get("availabilityOrderEmails");
227
+ let m = "";
228
+ if (u.length > 0) {
229
+ const S = r.emails;
230
+ for (let h = 0; h < u.length; h++)
231
+ if (S.includes(u[h])) {
232
+ m = u[h];
233
+ break;
234
+ }
235
+ }
236
+ const c = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, g = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.guests) || [], f = e ? e == null ? void 0 : e.additionalFields : i == null ? void 0 : i.additionalFields, _ = this.getHeaders(), I = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, l = await this.makeAPIRequest(decodeURIComponent(I), "POST", JSON.stringify({
237
+ participants: m ? [{ email: m }] : void 0,
238
+ additional_fields: f,
239
+ additional_guests: g,
240
+ guest: { ...c },
241
+ start_time: r.start_time.getTime() / 1e3,
242
+ end_time: r.end_time.getTime() / 1e3,
243
+ timezone: o,
244
+ email_language: this.getTwoLetterLanguageCode(n)
245
+ }), _);
246
+ if ("error" in l) {
247
+ this.schedulerStore.set("isLoading", !1);
248
+ const S = (v = l.error) == null ? void 0 : v.type;
249
+ let h = l.error;
250
+ if (S && S in this.errors.api("Create Booking")) {
251
+ const L = this.getErrorMessage(h);
252
+ h = this.errors.api("Create Booking")[S](L);
253
+ }
254
+ return { error: h };
255
+ }
256
+ return "data" in l && this.schedulerStore.set("eventInfo", l == null ? void 0 : l.data), this.schedulerStore.set("isLoading", !1), l;
257
+ }
258
+ async getUISettings() {
259
+ var n;
260
+ this.schedulerStore.set("isLoading", !0);
261
+ const e = this.getHeaders(), s = `/v3/scheduling/ui-settings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, i = await this.makeAPIRequest(s, "GET", void 0, e);
262
+ if ("error" in i) {
263
+ this.schedulerStore.set("isLoading", !1);
264
+ const r = (n = i.error) == null ? void 0 : n.type;
265
+ let o = i.error;
266
+ return r && r in this.errors.api(d.t("getUISettingErrorTitle")) && (o = this.errors.api(d.t("getUISettingErrorTitle"))[r]((o == null ? void 0 : o.message) || (o == null ? void 0 : o.title) || "Something went wrong")), { error: o };
267
+ }
268
+ return "data" in i && this.schedulerStore.set("configSettings", i.data), this.schedulerStore.set("isLoading", !1), i;
269
+ }
270
+ getTwoLetterLanguageCode(e) {
271
+ return e.split("-")[0];
272
+ }
273
+ getStartTimeWithMinBookingNotice(e) {
274
+ var n;
275
+ const t = (n = this.schedulerStore.get("configSettings")) == null ? void 0 : n.scheduler, s = t == null ? void 0 : t.min_booking_notice;
276
+ if (!s)
277
+ return e;
278
+ const i = (/* @__PURE__ */ new Date()).getTime();
279
+ return e < (i + s * 60 * 1e3) / 1e3 ? Math.floor((i + s * 60 * 1e3) / 1e3) : e;
280
+ }
281
+ getEndTimeForAvailableDaysInFuture(e) {
282
+ var r, o;
283
+ const t = /* @__PURE__ */ new Date(), s = (o = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler) == null ? void 0 : o.available_days_in_future, i = Math.floor(R(t, s).getTime() / 1e3);
284
+ return Math.min(i, e);
285
+ }
286
+ async getAvailability(e = 0, t = 0) {
287
+ var f, _, p, I;
288
+ this.schedulerStore.set("isLoading", !0);
289
+ const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), n = i.getTime();
290
+ if (t && t < n / 1e3)
291
+ return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
292
+ if (!e) {
293
+ const l = new Date(i.getFullYear(), i.getMonth(), 1);
294
+ e = Math.floor(l.getTime() / 1e3);
295
+ }
296
+ if (!t) {
297
+ const l = new Date(i.getFullYear(), i.getMonth() + 1, 0);
298
+ t = Math.floor(l.getTime() / 1e3);
299
+ }
300
+ t = this.getEndTimeForAvailableDaysInFuture(t);
301
+ const r = this.getStartTimeWithMinBookingNotice(e);
302
+ e = r, t = r > t ? r + 1 : t, s.append("start_time", encodeURIComponent(e.toString())), s.append("end_time", encodeURIComponent(t.toString())), this.configId && !this.sessionId ? s.append("configuration_id", encodeURIComponent(this.configId)) : this.slug && this.clientId && !this.sessionId && (s.append("slug", encodeURIComponent(this.slug)), s.append("client_id", encodeURIComponent(this.clientId)));
303
+ const o = this.schedulerStore.get("rescheduleBookingId");
304
+ o && s.append("booking_id", encodeURIComponent(o));
305
+ const u = s.toString(), m = `/v3/scheduling/availability${u ? `?${u}` : ""}`, c = this.getHeaders(), g = await this.makeAPIRequest(decodeURIComponent(m), "GET", void 0, c);
306
+ if ("error" in g) {
307
+ this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
308
+ const l = (f = g.error) == null ? void 0 : f.type;
309
+ let v = g.error;
310
+ if (l && l in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
311
+ const S = this.getErrorMessage(v);
312
+ v = this.errors.api(d.t("getAvailabilityErrorTitle"))[l](S);
313
+ }
314
+ return { error: v };
315
+ }
316
+ if ("data" in g) {
317
+ const v = (((p = (_ = g.data) == null ? void 0 : _.time_slots) == null ? void 0 : p.map((h) => ({
318
+ ...h,
319
+ start_time: new Date(h.start_time * 1e3),
320
+ end_time: new Date(h.end_time * 1e3)
321
+ }))) || []).filter((h) => h.start_time.getTime() > n);
322
+ this.schedulerStore.set("availability", v);
323
+ const S = ((I = g.data) == null ? void 0 : I.order) || [];
324
+ this.schedulerStore.set("availabilityOrderEmails", S);
325
+ }
326
+ return this.schedulerStore.set("isLoading", !1), g;
327
+ }
328
+ async cancelBooking(e, t) {
329
+ var o;
330
+ if (this.schedulerStore.set("isLoading", !0), !e)
331
+ return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
332
+ const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", i = `/v3/scheduling/bookings/${e}${s}`, n = this.getHeaders(), r = await this.makeAPIRequest(decodeURIComponent(i), "DELETE", JSON.stringify({
333
+ action: "cancel",
334
+ cancellation_reason: t
335
+ }), n);
336
+ if ("error" in r) {
337
+ this.schedulerStore.set("isLoading", !1);
338
+ const u = (o = r.error) == null ? void 0 : o.type;
339
+ let m = r.error;
340
+ if (u && u in this.errors.api(d.t("cancelBookingErrorTitle"))) {
341
+ const c = this.getErrorMessage(m);
342
+ m = this.errors.api(d.t("cancelBookingErrorTitle"))[u](c);
343
+ }
344
+ return { error: m };
345
+ }
346
+ return this.schedulerStore.set("cancelledEventInfo", {
347
+ booking_id: e
348
+ }), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), r;
349
+ }
350
+ async rescheduleBooking(e, t) {
351
+ var E;
352
+ if (this.schedulerStore.set("isLoading", !0), !e)
353
+ return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
354
+ const s = this.errors.api(d.t("rescheduleBookingErrorTitle")), i = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo: n, selectedTimeslot: r, selectedTimezone: o, selectedLanguage: u } = this.schedulerStore.state, { startTime: m, endTime: c, timezone: g } = t, f = m || (r == null ? void 0 : r.start_time);
355
+ if (!f)
356
+ return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
357
+ const _ = c || (r == null ? void 0 : r.end_time);
358
+ if (!_)
359
+ return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
360
+ const p = this.schedulerStore.get("availabilityOrderEmails");
361
+ let I = "";
362
+ if (p.length > 0) {
363
+ const T = (r == null ? void 0 : r.emails) || [];
364
+ for (let k = 0; k < p.length; k++)
365
+ if (T.includes(p[k])) {
366
+ I = p[k];
367
+ break;
368
+ }
369
+ }
370
+ const l = g || o;
371
+ if (!l)
372
+ return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
373
+ const v = t ? t == null ? void 0 : t.primaryParticipant : n == null ? void 0 : n.primaryParticipant, S = t ? (t == null ? void 0 : t.guests) || [] : (n == null ? void 0 : n.guests) || [], h = t ? t == null ? void 0 : t.additionalFields : n == null ? void 0 : n.additionalFields, L = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", M = `/v3/scheduling/bookings/${e}${L}`, P = this.getHeaders(), y = await this.makeAPIRequest(decodeURIComponent(M), "PATCH", JSON.stringify({
374
+ start_time: f.getTime() / 1e3,
375
+ end_time: _.getTime() / 1e3,
376
+ timezone: l,
377
+ additional_fields: h,
378
+ guest: { ...v },
379
+ additional_guests: S,
380
+ participants: I ? [{ email: I }] : void 0,
381
+ email_language: this.getTwoLetterLanguageCode(u)
382
+ }), P);
383
+ if ("error" in y) {
384
+ this.schedulerStore.set("isLoading", !1);
385
+ const T = (E = y.error) == null ? void 0 : E.type;
386
+ let k = y.error;
387
+ if (T && T in s) {
388
+ const z = this.getErrorMessage(k);
389
+ k = s[T](z);
390
+ }
391
+ return { error: k };
392
+ }
393
+ const B = this.schedulerStore.get("reschedulingEventInfo");
394
+ if ("data" in y)
395
+ this.schedulerStore.set("eventInfo", y == null ? void 0 : y.data);
396
+ else if (B)
397
+ this.schedulerStore.set("eventInfo", B);
398
+ else {
399
+ const T = {
400
+ booking_id: e
401
+ };
402
+ this.schedulerStore.set("eventInfo", T);
403
+ }
404
+ return this.schedulerStore.set("isLoading", !1), y;
405
+ }
406
+ async updateBooking(e) {
407
+ var g;
408
+ this.schedulerStore.set("isLoading", !0);
409
+ const { bookingId: t, status: s, reason: i } = e, n = this.schedulerStore.get("organizerConfirmationSalt"), r = s === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
410
+ if (!t)
411
+ return { error: this.errors.component(r).no_booking_id() };
412
+ if (!n)
413
+ return { error: this.errors.component(r).no_salt() };
414
+ const o = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", u = `/v3/scheduling/bookings/${t}${o}`, m = this.getHeaders(), c = await this.makeAPIRequest(decodeURIComponent(u), "PUT", JSON.stringify({
415
+ status: s,
416
+ cancellation_reason: i,
417
+ salt: n
418
+ }), m);
419
+ if ("error" in c) {
420
+ this.schedulerStore.set("isLoading", !1);
421
+ const f = (g = c.error) == null ? void 0 : g.type;
422
+ let _ = c.error;
423
+ if (f && f in this.errors.api(r)) {
424
+ const p = this.getErrorMessage(_);
425
+ _ = this.errors.api(r)[f](p);
426
+ }
427
+ return { error: _ };
428
+ }
429
+ return "data" in c && s === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", c == null ? void 0 : c.data) : "request_id" in c && s === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
430
+ booking_id: t
431
+ }), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), c;
432
+ }
433
+ }
434
+ function N(a = {}) {
435
+ const e = {
436
+ selectedDate: null,
437
+ selectedLanguage: navigator.language,
438
+ selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
439
+ selectedTimeslot: null,
440
+ showBookingForm: !1,
441
+ availabilityOrderEmails: [],
442
+ selectableDates: null,
443
+ availability: [],
444
+ eventDuration: 0,
445
+ state: "ready",
446
+ eventInfo: null,
447
+ cancelledEventInfo: null,
448
+ isLoading: !1,
449
+ nylasBranding: !0,
450
+ ...a
451
+ };
452
+ b("[defaultNylasStoreState]: ", e);
453
+ const t = $(e);
454
+ return t.onChange("availability", (s) => {
455
+ b("[availability]: ", s);
456
+ const i = s.map((o) => o.start_time);
457
+ b("[selectableDates]: ", i), t.set("selectableDates", i);
458
+ const n = s[0];
459
+ if (!n)
460
+ return;
461
+ const r = Math.floor((n.end_time.getTime() - n.start_time.getTime()) / 6e4);
462
+ b("[durationMinutes]: ", r), t.set("eventDuration", r);
463
+ }), t.reset = () => {
464
+ for (const s in e) {
465
+ const i = e[s];
466
+ t.set(s, i);
467
+ }
468
+ }, t;
469
+ }
470
+ export {
471
+ N as C,
472
+ w as E,
473
+ U as N
474
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2a53b6a8.cjs");require("react");require("react-dom");const s=':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;--nylas-font-family:"Inter", sans-serif;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0;display:flex;gap:4px;align-items:center}label .error{color:var(--nylas-error)}textarea{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;padding:12px 16px;border-width:1;resize:vertical;border-radius:8px;font-family:var(--nylas-font-family);font-size:16px;line-height:24px}textarea:focus{outline-color:var(--nylas-primary)}textarea.error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}textarea.error::placeholder{font-weight:400}textarea::placeholder{color:var(--nylas-base-300)}textarea::-webkit-resizer{display:none}',l=s,r=class{constructor(a){e.registerInstance(this,a),this.nylasFormInputChanged=e.createEvent(this,"nylasFormInputChanged",7),this.name="textarea",this.defaultValue=void 0,this.label="",this.placeholder="",this.required=!1,this.readOnly=!1,this.autoFocus=!1,this.maxLength=255,this.type="multi_line_text",this.tooltip="",this.value="",this.error=""}componentDidLoad(){this.value=e.sanitize(this.defaultValue||"")}handleBookingFormSubmitted(a){this.validate(this.value),this.error&&a.preventDefault()}handletriggerValidation(a){this.validate(this.value),this.error&&a.preventDefault()}handleInput(a){const t=a.target;this.value=e.sanitize(t.value),this.nylasFormInputChanged.emit({value:this.value,name:this.name,error:this.error,label:this.label,type:this.type})}validate(a){this.required&&!a?this.error=`${this.label} is required.`:a.length>this.maxLength?this.error=`${this.label} cannot exceed ${this.maxLength} characters.`:this.error=""}render(){return e.h("label",{key:"fe5c08ffc334bbf3018b5d092cfa3c0dc3493366",part:"tc__label",class:{error:!!this.error}},e.h("p",{key:"7d572a5c200d968902be56c8915d8da4e27454a7"},e.h("span",{key:"ab9b1b67451ed46b4e1d6ccf9403d7cca51b6028",class:"label"},this.label),this.required&&e.h("span",{class:"required"},"*"),this.tooltip&&e.h("tooltip-component",null,e.h("info-icon",{slot:"tooltip-icon"}),e.h("span",{slot:"tooltip-content"},this.tooltip))),e.h("textarea",{key:"c71b3cc7cac22ce0d153f4c6ac57b7cd7f5732c6",name:this.name,placeholder:this.placeholder,readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,onInput:a=>this.handleInput(a),class:{error:!!this.error},part:"tc__textarea"}),this.error&&e.h("span",{class:"error help-text"},this.error))}};r.style=l;exports.textarea_component=r;
@@ -0,0 +1,37 @@
1
+ import { r as s, c as l, E as r, h as a } from "./index-a134f625.js";
2
+ import "react";
3
+ import "react-dom";
4
+ const i = ':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;--nylas-font-family:"Inter", sans-serif;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0;display:flex;gap:4px;align-items:center}label .error{color:var(--nylas-error)}textarea{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;padding:12px 16px;border-width:1;resize:vertical;border-radius:8px;font-family:var(--nylas-font-family);font-size:16px;line-height:24px}textarea:focus{outline-color:var(--nylas-primary)}textarea.error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}textarea.error::placeholder{font-weight:400}textarea::placeholder{color:var(--nylas-base-300)}textarea::-webkit-resizer{display:none}', n = i, o = class {
5
+ constructor(e) {
6
+ s(this, e), this.nylasFormInputChanged = l(this, "nylasFormInputChanged", 7), this.name = "textarea", this.defaultValue = void 0, this.label = "", this.placeholder = "", this.required = !1, this.readOnly = !1, this.autoFocus = !1, this.maxLength = 255, this.type = "multi_line_text", this.tooltip = "", this.value = "", this.error = "";
7
+ }
8
+ componentDidLoad() {
9
+ this.value = r(this.defaultValue || "");
10
+ }
11
+ handleBookingFormSubmitted(e) {
12
+ this.validate(this.value), this.error && e.preventDefault();
13
+ }
14
+ handletriggerValidation(e) {
15
+ this.validate(this.value), this.error && e.preventDefault();
16
+ }
17
+ handleInput(e) {
18
+ const t = e.target;
19
+ this.value = r(t.value), this.nylasFormInputChanged.emit({
20
+ value: this.value,
21
+ name: this.name,
22
+ error: this.error,
23
+ label: this.label,
24
+ type: this.type
25
+ });
26
+ }
27
+ validate(e) {
28
+ this.required && !e ? this.error = `${this.label} is required.` : e.length > this.maxLength ? this.error = `${this.label} cannot exceed ${this.maxLength} characters.` : this.error = "";
29
+ }
30
+ render() {
31
+ return a("label", { key: "fe5c08ffc334bbf3018b5d092cfa3c0dc3493366", part: "tc__label", class: { error: !!this.error } }, a("p", { key: "7d572a5c200d968902be56c8915d8da4e27454a7" }, a("span", { key: "ab9b1b67451ed46b4e1d6ccf9403d7cca51b6028", class: "label" }, this.label), this.required && a("span", { class: "required" }, "*"), this.tooltip && a("tooltip-component", null, a("info-icon", { slot: "tooltip-icon" }), a("span", { slot: "tooltip-content" }, this.tooltip))), a("textarea", { key: "c71b3cc7cac22ce0d153f4c6ac57b7cd7f5732c6", name: this.name, placeholder: this.placeholder, readOnly: this.readOnly, autoFocus: this.autoFocus, value: this.value, maxLength: this.maxLength, onInput: (e) => this.handleInput(e), class: { error: !!this.error }, part: "tc__textarea" }), this.error && a("span", { class: "error help-text" }, this.error));
32
+ }
33
+ };
34
+ o.style = n;
35
+ export {
36
+ o as textarea_component
37
+ };
@@ -0,0 +1,80 @@
1
+ import { r as s, c as n, d, h as o, g as p } from "./index-a134f625.js";
2
+ import "react";
3
+ import "react-dom";
4
+ const l = ".time-period-selector.sc-time-period-selector{display:grid;gap:0.5rem;grid-template-columns:auto 1fr}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector,.time-period-selector.sc-time-period-selector input-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.sc-time-period-selector{width:116px}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{width:84px;display:flex;align-items:center}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){width:100%}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown){width:inherit;height:100%}.time-period-selector.sc-time-period-selector input-dropdown#time-number.sc-time-period-selector::part(id_dropdown-input){border:none;border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-input){padding:17px;gap:1rem}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-content){width:100%;max-height:200px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown){width:inherit}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem;justify-content:space-between}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}", c = l, m = {
5
+ hours: "hour",
6
+ days: "day",
7
+ weeks: "week",
8
+ months: "month"
9
+ }, a = class {
10
+ constructor(r) {
11
+ s(this, r), this.timePeriodChanged = n(this, "timePeriodChanged", 7), this.timePeriods = ["hour", "day", "week", "month"], this.defaultSelectedPeriod = void 0, this.defaultSelectedNumber = void 0, this.selectedPeriod = this.defaultSelectedPeriod, this.selectedNumber = this.defaultSelectedNumber, this.numberOptions = this.calculateOptions(this.defaultSelectedPeriod || "hour").map((e) => ({
12
+ label: e.toString(),
13
+ value: e.toString()
14
+ })), this.timePeriodOptions = this.timePeriods.map((e) => ({
15
+ label: e,
16
+ value: e
17
+ }));
18
+ }
19
+ componentDidLoad() {
20
+ this.selectedNumber = this.defaultSelectedNumber, this.selectedPeriod = this.defaultSelectedPeriod;
21
+ const r = m[this.selectedPeriod] ?? this.selectedPeriod, e = this.calculateOptions(r);
22
+ this.numberOptions = e.map((t) => ({
23
+ label: t.toString(),
24
+ value: t.toString()
25
+ }));
26
+ }
27
+ calculateOptions(r) {
28
+ switch (r) {
29
+ case "hour":
30
+ return Array.from({ length: 23 }, (e, t) => t + 1);
31
+ case "minute":
32
+ return Array.from({ length: 13 }, (e, t) => t * 5);
33
+ case "day":
34
+ return Array.from({ length: 30 }, (e, t) => t + 1);
35
+ case "week":
36
+ return Array.from({ length: 4 }, (e, t) => t + 1);
37
+ case "month":
38
+ return Array.from({ length: 12 }, (e, t) => t + 1);
39
+ default:
40
+ return [];
41
+ }
42
+ }
43
+ inputOptionChangedHandler(r) {
44
+ d("time-period-selector", "inputOptionChangedHandler", r.detail);
45
+ const { value: e, name: t } = r.detail;
46
+ t === "time-number" && (this.selectedNumber = e ? parseInt(e) : this.defaultSelectedNumber);
47
+ const i = {
48
+ number: this.selectedNumber,
49
+ period: this.selectedPeriod
50
+ };
51
+ this.timePeriodChanged.emit(i);
52
+ }
53
+ nylasFormDropdownChangedHandler(r) {
54
+ d("time-period-selector", "nylasFormDropdownChangedHandler", r.detail);
55
+ const { value: e, name: t } = r.detail;
56
+ t === "time-period" ? (this.selectedPeriod = e, this.updateNumberOptionsAndSelectedNumber(e)) : t === "time-number" && (this.selectedNumber = parseInt(e));
57
+ const i = {
58
+ number: this.selectedNumber,
59
+ period: this.selectedPeriod
60
+ };
61
+ this.timePeriodChanged.emit(i);
62
+ }
63
+ updateNumberOptionsAndSelectedNumber(r) {
64
+ const e = this.calculateOptions(r);
65
+ this.numberOptions = e.map((t) => ({
66
+ label: t.toString(),
67
+ value: t.toString()
68
+ })), this.selectedNumber = parseInt(this.numberOptions[0].value);
69
+ }
70
+ render() {
71
+ return o("div", { key: "abc8dbfd41d9a73fb9f4d482785b6804a0149e7c", class: "time-period-selector" }, typeof this.selectedNumber == "number" && o("input-dropdown", { id: "time-number", name: "time-number", inputValue: this.selectedNumber.toString(), exportparts: "id_dropdown: tps__number-dropdown, id_dropdown-input: tps__number-dropdown-button, id_dropdown-content: tps__number-dropdown-content", options: this.numberOptions, defaultInputOption: this.numberOptions.find((r) => r.value == this.selectedNumber.toString()) }), typeof this.selectedPeriod == "string" && o("select-dropdown", { 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((r) => r.value == this.selectedPeriod), withSearch: !1 }));
72
+ }
73
+ get host() {
74
+ return p(this);
75
+ }
76
+ };
77
+ a.style = c;
78
+ export {
79
+ a as time_period_selector
80
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-2a53b6a8.cjs");require("react");require("react-dom");const s=".time-period-selector.sc-time-period-selector{display:grid;gap:0.5rem;grid-template-columns:auto 1fr}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector,.time-period-selector.sc-time-period-selector input-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.sc-time-period-selector{width:116px}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{width:84px;display:flex;align-items:center}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){width:100%}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown){width:inherit;height:100%}.time-period-selector.sc-time-period-selector input-dropdown#time-number.sc-time-period-selector::part(id_dropdown-input){border:none;border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-input){padding:17px;gap:1rem}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-content){width:100%;max-height:200px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown){width:inherit}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem;justify-content:space-between}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}",n=s,p={hours:"hour",days:"day",weeks:"week",months:"month"},d=class{constructor(r){i.registerInstance(this,r),this.timePeriodChanged=i.createEvent(this,"timePeriodChanged",7),this.timePeriods=["hour","day","week","month"],this.defaultSelectedPeriod=void 0,this.defaultSelectedNumber=void 0,this.selectedPeriod=this.defaultSelectedPeriod,this.selectedNumber=this.defaultSelectedNumber,this.numberOptions=this.calculateOptions(this.defaultSelectedPeriod||"hour").map(e=>({label:e.toString(),value:e.toString()})),this.timePeriodOptions=this.timePeriods.map(e=>({label:e,value:e}))}componentDidLoad(){this.selectedNumber=this.defaultSelectedNumber,this.selectedPeriod=this.defaultSelectedPeriod;const r=p[this.selectedPeriod]??this.selectedPeriod,e=this.calculateOptions(r);this.numberOptions=e.map(t=>({label:t.toString(),value:t.toString()}))}calculateOptions(r){switch(r){case"hour":return Array.from({length:23},(e,t)=>t+1);case"minute":return Array.from({length:13},(e,t)=>t*5);case"day":return Array.from({length:30},(e,t)=>t+1);case"week":return Array.from({length:4},(e,t)=>t+1);case"month":return Array.from({length:12},(e,t)=>t+1);default:return[]}}inputOptionChangedHandler(r){i.debug("time-period-selector","inputOptionChangedHandler",r.detail);const{value:e,name:t}=r.detail;t==="time-number"&&(this.selectedNumber=e?parseInt(e):this.defaultSelectedNumber);const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}nylasFormDropdownChangedHandler(r){i.debug("time-period-selector","nylasFormDropdownChangedHandler",r.detail);const{value:e,name:t}=r.detail;t==="time-period"?(this.selectedPeriod=e,this.updateNumberOptionsAndSelectedNumber(e)):t==="time-number"&&(this.selectedNumber=parseInt(e));const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}updateNumberOptionsAndSelectedNumber(r){const e=this.calculateOptions(r);this.numberOptions=e.map(t=>({label:t.toString(),value:t.toString()})),this.selectedNumber=parseInt(this.numberOptions[0].value)}render(){return i.h("div",{key:"abc8dbfd41d9a73fb9f4d482785b6804a0149e7c",class:"time-period-selector"},typeof this.selectedNumber=="number"&&i.h("input-dropdown",{id:"time-number",name:"time-number",inputValue:this.selectedNumber.toString(),exportparts:"id_dropdown: tps__number-dropdown, id_dropdown-input: tps__number-dropdown-button, id_dropdown-content: tps__number-dropdown-content",options:this.numberOptions,defaultInputOption:this.numberOptions.find(r=>r.value==this.selectedNumber.toString())}),typeof this.selectedPeriod=="string"&&i.h("select-dropdown",{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(r=>r.value==this.selectedPeriod),withSearch:!1}))}get host(){return i.getElement(this)}};d.style=n;exports.time_period_selector=d;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./index-2a53b6a8.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:"6db13b0c797d975d04f0bd2d3efd8bcf8856739b",xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height,viewBox:"0 0 20 20",fill:"none"},C.h("path",{key:"33eaa0513504f0853c5cc7f74a9da40b5de59614",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;
@@ -0,0 +1,15 @@
1
+ import { r as s, h as C } from "./index-a134f625.js";
2
+ import "react";
3
+ import "react-dom";
4
+ const e = ".sc-translate-icon-h{display:flex}", i = e, o = class {
5
+ constructor(t) {
6
+ s(this, t), this.width = "16", this.height = "16";
7
+ }
8
+ render() {
9
+ return C("svg", { key: "6db13b0c797d975d04f0bd2d3efd8bcf8856739b", xmlns: "http://www.w3.org/2000/svg", width: this.width, height: this.height, viewBox: "0 0 20 20", fill: "none" }, C("path", { key: "33eaa0513504f0853c5cc7f74a9da40b5de59614", 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
+ };