@nylas/react 1.1.4 → 1.1.5
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.
- package/dist/add-circle-icon_2.entry-1e899552.js +25 -0
- package/dist/add-circle-icon_2.entry-31acee1d.cjs +1 -0
- package/dist/archive-icon.entry-b5f307e8.js +15 -0
- package/dist/archive-icon.entry-e932c9e6.cjs +1 -0
- package/dist/{arrow-icon.entry-20b50784.js → arrow-icon.entry-aae2e22d.js} +2 -2
- package/dist/{arrow-icon.entry-83c3105b.cjs → arrow-icon.entry-e35a6cad.cjs} +1 -1
- package/dist/{bold-icon.entry-0e3d84e1.cjs → bold-icon.entry-1e3c9b1f.cjs} +1 -1
- package/dist/{bold-icon.entry-34b18d0d.js → bold-icon.entry-d5d86b3f.js} +2 -2
- package/dist/{button-component_2.entry-8a5e99da.js → button-component_2.entry-5284316e.js} +6 -6
- package/dist/{button-component_2.entry-54101987.cjs → button-component_2.entry-a86f8dca.cjs} +1 -1
- package/dist/{calendar-agenda-fill-icon_51.entry-a351dca5.js → calendar-agenda-fill-icon_54.entry-5672c589.js} +1943 -1638
- package/dist/calendar-agenda-fill-icon_54.entry-702b29cc.cjs +10 -0
- package/dist/{calendar-cancel-icon.entry-f83e9b41.js → calendar-cancel-icon.entry-7f81de9d.js} +4 -4
- package/dist/{calendar-cancel-icon.entry-00756264.cjs → calendar-cancel-icon.entry-e9792eaa.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-1817540c.js → calendar-check-icon_2.entry-84db1700.js} +7 -7
- package/dist/{calendar-check-icon_2.entry-6ac948fc.cjs → calendar-check-icon_2.entry-ad055b37.cjs} +1 -1
- package/dist/{calendar-icon.entry-68e53f52.cjs → calendar-icon.entry-019f7feb.cjs} +1 -1
- package/dist/{calendar-icon.entry-362428bf.js → calendar-icon.entry-45db1630.js} +2 -2
- package/dist/{checkbox-component_2.entry-5ce9807d.cjs → checkbox-component_2.entry-8325ff88.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-0d7c1916.js → checkbox-component_2.entry-84a053ff.js} +3 -3
- package/dist/{chevron-icon_3.entry-89c52603.cjs → chevron-icon_3.entry-0edde2a6.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-37c087a7.js → chevron-icon_3.entry-ec894a13.js} +6 -6
- package/dist/{clock-icon_4.entry-2e78febe.js → clock-icon_4.entry-8ec9c29b.js} +8 -8
- package/dist/{clock-icon_4.entry-496058ef.cjs → clock-icon_4.entry-935fe48d.cjs} +1 -1
- package/dist/constants-c549b12b-7ea4c7f5.js +763 -0
- package/dist/constants-c549b12b-c85413b1.cjs +1 -0
- package/dist/copy-icon.entry-5a2030da.cjs +1 -0
- package/dist/{copy-icon.entry-6d4e05b0.js → copy-icon.entry-d9405510.js} +7 -7
- package/dist/{delete-icon.entry-ea06b42a.js → delete-icon.entry-1b0a3ba4.js} +7 -7
- package/dist/{delete-icon.entry-e98b336e.cjs → delete-icon.entry-3f3d1ffb.cjs} +1 -1
- package/dist/document-refresh-icon.entry-59a18097.cjs +1 -0
- package/dist/document-refresh-icon.entry-fab58d33.js +15 -0
- package/dist/{feedbackSync-ab657d65-e8b7c001.js → feedbackSync-b56b29ed-7a1f1f75.js} +1 -1
- package/dist/{feedbackSync-ab657d65-e650e46d.cjs → feedbackSync-b56b29ed-b6f352f3.cjs} +1 -1
- package/dist/{folder-icon.entry-6096fbf4.js → folder-icon.entry-b5a123d0.js} +2 -2
- package/dist/{folder-icon.entry-5c3f4e8f.cjs → folder-icon.entry-e85383b6.cjs} +1 -1
- package/dist/{forward-icon.entry-4089e3bb.cjs → forward-icon.entry-7c8ed4c3.cjs} +1 -1
- package/dist/forward-icon.entry-88ab1a85.js +15 -0
- package/dist/{globe-icon.entry-59f4c2f9.js → globe-icon.entry-6fb414ca.js} +4 -4
- package/dist/{globe-icon.entry-e8ca972e.cjs → globe-icon.entry-b1253516.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-ae09d065.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-d4b8926f.js → google-logo-icon_4.entry-fe627741.js} +213 -199
- package/dist/inbox-icon.entry-7dce836e.cjs +1 -0
- package/dist/{inbox-icon.entry-70dae5ec.js → inbox-icon.entry-cec35da1.js} +2 -2
- package/dist/{index-e475e0c0.js → index-3fd31877.js} +3236 -3090
- package/dist/index-bd6fdc8c.cjs +81 -0
- package/dist/{index.es-b475d61f-68a74a28.cjs → index.es-c7ca1bad-0a324dca.cjs} +1 -1
- package/dist/{index.es-b475d61f-bfa2cba2.js → index.es-c7ca1bad-b895d84b.js} +1 -1
- package/dist/{info-icon_2.entry-f1b1dfba.cjs → info-icon_2.entry-1dab6311.cjs} +1 -1
- package/dist/{info-icon_2.entry-2bb60213.js → info-icon_2.entry-f7e6b4aa.js} +5 -5
- package/dist/{input-color-picker.entry-5ae45a9e.js → input-color-picker.entry-30cda4e2.js} +3 -3
- package/dist/{input-color-picker.entry-b669f7fb.cjs → input-color-picker.entry-b6e53c29.cjs} +1 -1
- package/dist/{input-component.entry-eeb95361.cjs → input-component.entry-1f1f8e00.cjs} +1 -1
- package/dist/{input-component.entry-cb958501.js → input-component.entry-7a04bc8b.js} +3 -3
- package/dist/{input-dropdown.entry-0b458f68.cjs → input-dropdown.entry-5e5b67be.cjs} +1 -1
- package/dist/{input-dropdown.entry-962605f8.js → input-dropdown.entry-abf134a8.js} +4 -4
- package/dist/italic-icon.entry-4631c594.js +15 -0
- package/dist/italic-icon.entry-c793243b.cjs +1 -0
- package/dist/{multi-select-dropdown.entry-a66408a2.cjs → multi-select-dropdown.entry-2b8728d5.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-3084e1fc.js → multi-select-dropdown.entry-9a93da56.js} +2 -2
- package/dist/nylas-booked-event-card_12.entry-8d502a3c.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-29e2a4b1.js → nylas-booked-event-card_12.entry-f13f3f54.js} +299 -294
- package/dist/{nylas-form-card.entry-33b4c295.js → nylas-form-card.entry-862519b4.js} +16 -16
- package/dist/{nylas-form-card.entry-8465eccf.cjs → nylas-form-card.entry-af179b96.cjs} +1 -1
- package/dist/{nylas-if-state.entry-9d96fc87.js → nylas-if-state.entry-8803a762.js} +3 -3
- package/dist/{nylas-if-state.entry-adb6103a.cjs → nylas-if-state.entry-c1c1282d.cjs} +1 -1
- package/dist/{nylas-login.entry-3f7c195e.js → nylas-login.entry-3e12f747.js} +7 -7
- package/dist/{nylas-login.entry-78b968d1.cjs → nylas-login.entry-65f8f046.cjs} +1 -1
- package/dist/{nylas-provider.entry-b918d0f6.cjs → nylas-provider.entry-9626b113.cjs} +1 -1
- package/dist/{nylas-provider.entry-19635620.js → nylas-provider.entry-e3501bd1.js} +5 -5
- package/dist/{nylas-scheduler-editor.entry-cfed7ae2.cjs → nylas-scheduler-editor.entry-17cd1514.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-e848771f.js → nylas-scheduler-editor.entry-6df45b05.js} +25 -25
- package/dist/{nylas-scheduling.entry-da987c02.js → nylas-scheduling.entry-08051ba3.js} +138 -126
- package/dist/nylas-scheduling.entry-b1fafd91.cjs +1 -0
- package/dist/{nylas-time-window-picker.entry-1f76b577.cjs → nylas-time-window-picker.entry-4989d421.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-3c6b29d9.js → nylas-time-window-picker.entry-bdc8c6ea.js} +13 -13
- package/dist/{person-icon.entry-79fcd9fb.js → person-icon.entry-d62a16b4.js} +2 -2
- package/dist/{person-icon.entry-82bbb87c.cjs → person-icon.entry-fb7efa8f.cjs} +1 -1
- package/dist/play-icon.entry-01b95392.js +15 -0
- package/dist/{play-icon.entry-3f357ea4.cjs → play-icon.entry-f485a2c8.cjs} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +9 -9
- package/dist/{refresh-icon.entry-1427a5e6.js → refresh-icon.entry-1ff4b39f.js} +2 -2
- package/dist/{refresh-icon.entry-7ce5ec90.cjs → refresh-icon.entry-5f997e86.cjs} +1 -1
- package/dist/{register-component-679c1308-de697ecb.js → register-component-3444af44-854971ad.js} +1 -1
- package/dist/{register-component-679c1308-b5a96acf.cjs → register-component-3444af44-9053e8c3.cjs} +1 -1
- package/dist/{reply-all-icon.entry-cf8114db.cjs → reply-all-icon.entry-1dad6514.cjs} +1 -1
- package/dist/{reply-all-icon.entry-f1165660.js → reply-all-icon.entry-cbafb8a0.js} +2 -2
- package/dist/reply-icon.entry-162d9945.cjs +1 -0
- package/dist/reply-icon.entry-a43bc252.js +15 -0
- package/dist/{scheduler-config-store-2a3b403d-e5210f72.js → scheduler-config-store-ed4a8dfd-22db9285.js} +1 -2
- package/dist/scheduler-config-store-ed4a8dfd-eeaeaa50.cjs +1 -0
- package/dist/{scheduler-store-908886c8-b0f43cb9.js → scheduler-store-d4784b24-9a5f5734.js} +134 -126
- package/dist/scheduler-store-d4784b24-aed474e8.cjs +1 -0
- package/dist/sent-icon.entry-a05486d5.js +15 -0
- package/dist/sent-icon.entry-a1aec7e9.cjs +1 -0
- package/dist/spam-icon.entry-473f11af.js +15 -0
- package/dist/spam-icon.entry-b481a04b.cjs +1 -0
- package/dist/{star-icon.entry-b15601ca.js → star-icon.entry-12fdc345.js} +5 -5
- package/dist/{star-icon.entry-88501c8b.cjs → star-icon.entry-6b1fe3cf.cjs} +1 -1
- package/dist/stop-icon.entry-4bd609f7.js +15 -0
- package/dist/{stop-icon.entry-3475e257.cjs → stop-icon.entry-72481153.cjs} +1 -1
- package/dist/{textarea-component.entry-d1f4dd9a.js → textarea-component.entry-47e1b2e6.js} +2 -2
- package/dist/{textarea-component.entry-683c2959.cjs → textarea-component.entry-f330a755.cjs} +1 -1
- package/dist/{time-period-selector.entry-e97f86fd.js → time-period-selector.entry-a4899368.js} +2 -2
- package/dist/{time-period-selector.entry-8cfdf750.cjs → time-period-selector.entry-c7611563.cjs} +1 -1
- package/dist/{translate-icon.entry-5757c37c.cjs → translate-icon.entry-40dfa8c9.cjs} +1 -1
- package/dist/{translate-icon.entry-09c5574f.js → translate-icon.entry-4517838d.js} +4 -4
- package/dist/trash-fill-icon.entry-86ca3055.cjs +1 -0
- package/dist/{trash-fill-icon.entry-470ec1ff.js → trash-fill-icon.entry-d7e960eb.js} +3 -3
- package/dist/{underline-icon.entry-9fe74ba7.js → underline-icon.entry-352970f5.js} +2 -2
- package/dist/{underline-icon.entry-6d729068.cjs → underline-icon.entry-f16d4943.cjs} +1 -1
- package/dist/{warning-icon.entry-d924f8f9.js → warning-icon.entry-63987dad.js} +5 -5
- package/dist/{warning-icon.entry-c1d48318.cjs → warning-icon.entry-79ef75b2.cjs} +1 -1
- package/package.json +3 -3
- package/dist/add-circle-icon_2.entry-6753bd65.js +0 -25
- package/dist/add-circle-icon_2.entry-cd9a7f37.cjs +0 -1
- package/dist/archive-icon.entry-434d1696.js +0 -15
- package/dist/archive-icon.entry-7cb1c265.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_51.entry-1920adc2.cjs +0 -7
- package/dist/constants-c31dccfe-04b9cd8a.js +0 -3883
- package/dist/constants-c31dccfe-1a739653.cjs +0 -15
- package/dist/copy-icon.entry-a1baee33.cjs +0 -1
- package/dist/document-refresh-icon.entry-09750b52.cjs +0 -1
- package/dist/document-refresh-icon.entry-afae6621.js +0 -15
- package/dist/forward-icon.entry-da319c05.js +0 -15
- package/dist/google-logo-icon_4.entry-e2001f83.cjs +0 -1
- package/dist/inbox-icon.entry-80ee9082.cjs +0 -1
- package/dist/index-6b9d4b01.cjs +0 -81
- package/dist/italic-icon.entry-4a89e289.cjs +0 -1
- package/dist/italic-icon.entry-5be07509.js +0 -15
- package/dist/nylas-booked-event-card_12.entry-227ccf31.cjs +0 -1
- package/dist/nylas-reminder-emails.entry-ec79b757.js +0 -168
- package/dist/nylas-reminder-emails.entry-ee76db24.cjs +0 -4
- package/dist/nylas-reminder-time_2.entry-105de2d0.js +0 -108
- package/dist/nylas-reminder-time_2.entry-83ecc1d4.cjs +0 -1
- package/dist/nylas-scheduling.entry-e989cf9e.cjs +0 -1
- package/dist/play-icon.entry-97b40470.js +0 -15
- package/dist/reply-icon.entry-3a601cff.js +0 -15
- package/dist/reply-icon.entry-3db337c9.cjs +0 -1
- package/dist/scheduler-config-store-2a3b403d-e6f5bcab.cjs +0 -1
- package/dist/scheduler-store-908886c8-62d14677.cjs +0 -1
- package/dist/sent-icon.entry-2c7bd48e.js +0 -15
- package/dist/sent-icon.entry-708b9a2b.cjs +0 -1
- package/dist/spam-icon.entry-3106ed3d.js +0 -15
- package/dist/spam-icon.entry-fa8b80c6.cjs +0 -1
- package/dist/stop-icon.entry-f926a8db.js +0 -15
- package/dist/trash-fill-icon.entry-4bbfabcc.cjs +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
var
|
|
1
|
+
import { d as L, a as F, i as c, j as R } from "./index-3fd31877.js";
|
|
2
|
+
var B;
|
|
3
3
|
(function(a) {
|
|
4
4
|
a.Component = "component", a.Api = "api", a.Auth = "auth";
|
|
5
|
-
})(
|
|
6
|
-
var
|
|
5
|
+
})(B || (B = {}));
|
|
6
|
+
var M;
|
|
7
7
|
(function(a) {
|
|
8
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
|
-
})(
|
|
10
|
-
var
|
|
9
|
+
})(M || (M = {}));
|
|
10
|
+
var P;
|
|
11
11
|
(function(a) {
|
|
12
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
|
-
})(
|
|
13
|
+
})(P || (P = {}));
|
|
14
14
|
class C {
|
|
15
15
|
constructor() {
|
|
16
16
|
this.component = (e) => {
|
|
17
|
-
const t =
|
|
17
|
+
const t = B.Component, s = `${e} Error`;
|
|
18
18
|
return {
|
|
19
19
|
endtime_not_in_future: (i = '"endtime" can not be in the future') => ({
|
|
20
20
|
title: s,
|
|
@@ -63,7 +63,7 @@ class C {
|
|
|
63
63
|
})
|
|
64
64
|
};
|
|
65
65
|
}, this.api = (e) => {
|
|
66
|
-
const t =
|
|
66
|
+
const t = B.Api, s = `${e} Error`;
|
|
67
67
|
return {
|
|
68
68
|
invalid_session: (i) => ({
|
|
69
69
|
title: s,
|
|
@@ -104,7 +104,7 @@ class C {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class O {
|
|
108
108
|
constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug: n, clientId: r }) {
|
|
109
109
|
this.errors = new C(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug = n, this.clientId = r;
|
|
110
110
|
}
|
|
@@ -153,7 +153,7 @@ class U {
|
|
|
153
153
|
this.schedulerStore.set("selectedTimezone", e);
|
|
154
154
|
}
|
|
155
155
|
selectLanguage(e) {
|
|
156
|
-
this.schedulerStore.set("selectedLanguage", e),
|
|
156
|
+
this.schedulerStore.set("selectedLanguage", e), c.changeLanguage(e);
|
|
157
157
|
}
|
|
158
158
|
async toggleAdditionalData(e) {
|
|
159
159
|
e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
|
|
@@ -212,48 +212,52 @@ class U {
|
|
|
212
212
|
return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
|
|
213
213
|
}
|
|
214
214
|
async bookTimeslot(e) {
|
|
215
|
-
var
|
|
215
|
+
var I;
|
|
216
216
|
this.schedulerStore.set("isLoading", !0);
|
|
217
217
|
const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: n } = this.schedulerStore.state;
|
|
218
218
|
if (!e && !i)
|
|
219
|
-
return { error: this.errors.component(
|
|
219
|
+
return { error: this.errors.component(c.t("createBookingErrorTitle")).no_booking_info() };
|
|
220
220
|
const r = (e == null ? void 0 : e.timeslot) || t;
|
|
221
221
|
if (!r)
|
|
222
|
-
return { error: this.errors.component(
|
|
223
|
-
const o = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s;
|
|
222
|
+
return { error: this.errors.component(c.t("createBookingErrorTitle")).no_timeslot_selected() };
|
|
223
|
+
const o = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s, m = n || "en-US";
|
|
224
224
|
if (!o)
|
|
225
|
-
return { error: this.errors.component(
|
|
226
|
-
const
|
|
227
|
-
let
|
|
228
|
-
if (
|
|
229
|
-
const
|
|
230
|
-
for (let
|
|
231
|
-
if (
|
|
232
|
-
|
|
225
|
+
return { error: this.errors.component(c.t("createBookingErrorTitle")).no_timezone_selected() };
|
|
226
|
+
const h = this.schedulerStore.get("availabilityOrderEmails");
|
|
227
|
+
let l = "";
|
|
228
|
+
if (h.length > 0) {
|
|
229
|
+
const k = (r == null ? void 0 : r.emails) || [];
|
|
230
|
+
for (let f = 0; f < h.length; f++)
|
|
231
|
+
if (k.includes(h[f])) {
|
|
232
|
+
l = h[f];
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
const d = {};
|
|
237
|
+
Object.entries((i == null ? void 0 : i.additionalFields) || {}).forEach(([k, f]) => {
|
|
238
|
+
d[k] = f.value;
|
|
239
|
+
});
|
|
240
|
+
const _ = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, S = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.guests) || [], p = e ? e == null ? void 0 : e.additionalFields : d, T = this.getHeaders(), v = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, u = await this.makeAPIRequest(decodeURIComponent(v), "POST", JSON.stringify({
|
|
241
|
+
participants: l ? [{ email: l }] : void 0,
|
|
242
|
+
additional_fields: p,
|
|
243
|
+
additional_guests: S,
|
|
244
|
+
guest: { ..._ },
|
|
241
245
|
start_time: r.start_time.getTime() / 1e3,
|
|
242
246
|
end_time: r.end_time.getTime() / 1e3,
|
|
243
247
|
timezone: o,
|
|
244
|
-
email_language: this.getTwoLetterLanguageCode(
|
|
245
|
-
}),
|
|
246
|
-
if ("error" in
|
|
248
|
+
email_language: this.getTwoLetterLanguageCode(m)
|
|
249
|
+
}), T);
|
|
250
|
+
if ("error" in u) {
|
|
247
251
|
this.schedulerStore.set("isLoading", !1);
|
|
248
|
-
const
|
|
249
|
-
let
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
252
|
-
|
|
252
|
+
const k = (I = u.error) == null ? void 0 : I.type;
|
|
253
|
+
let f = u.error;
|
|
254
|
+
if (k && k in this.errors.api("Create Booking")) {
|
|
255
|
+
const E = this.getErrorMessage(f);
|
|
256
|
+
f = this.errors.api("Create Booking")[k](E);
|
|
253
257
|
}
|
|
254
|
-
return { error:
|
|
258
|
+
return { error: f };
|
|
255
259
|
}
|
|
256
|
-
return "data" in
|
|
260
|
+
return "data" in u && this.schedulerStore.set("eventInfo", u == null ? void 0 : u.data), this.schedulerStore.set("isLoading", !1), u;
|
|
257
261
|
}
|
|
258
262
|
async getUISettings() {
|
|
259
263
|
var n;
|
|
@@ -263,7 +267,7 @@ class U {
|
|
|
263
267
|
this.schedulerStore.set("isLoading", !1);
|
|
264
268
|
const r = (n = i.error) == null ? void 0 : n.type;
|
|
265
269
|
let o = i.error;
|
|
266
|
-
return r && r in this.errors.api(
|
|
270
|
+
return r && r in this.errors.api(c.t("getUISettingErrorTitle")) && (o = this.errors.api(c.t("getUISettingErrorTitle"))[r]((o == null ? void 0 : o.message) || (o == null ? void 0 : o.title) || "Something went wrong")), { error: o };
|
|
267
271
|
}
|
|
268
272
|
return "data" in i && this.schedulerStore.set("configSettings", i.data), this.schedulerStore.set("isLoading", !1), i;
|
|
269
273
|
}
|
|
@@ -284,151 +288,155 @@ class U {
|
|
|
284
288
|
return Math.min(i, e);
|
|
285
289
|
}
|
|
286
290
|
async getAvailability(e = 0, t = 0) {
|
|
287
|
-
var
|
|
291
|
+
var _, S, p, T;
|
|
288
292
|
this.schedulerStore.set("isLoading", !0);
|
|
289
293
|
const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), n = i.getTime();
|
|
290
294
|
if (t && t < n / 1e3)
|
|
291
|
-
return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(
|
|
295
|
+
return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(c.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
|
|
292
296
|
if (!e) {
|
|
293
|
-
const
|
|
294
|
-
e = Math.floor(
|
|
297
|
+
const g = new Date(i.getFullYear(), i.getMonth(), 1);
|
|
298
|
+
e = Math.floor(g.getTime() / 1e3);
|
|
295
299
|
}
|
|
296
300
|
if (!t) {
|
|
297
|
-
const
|
|
298
|
-
t = Math.floor(
|
|
301
|
+
const g = new Date(i.getFullYear(), i.getMonth() + 1, 0);
|
|
302
|
+
t = Math.floor(g.getTime() / 1e3);
|
|
299
303
|
}
|
|
300
304
|
t = this.getEndTimeForAvailableDaysInFuture(t);
|
|
301
305
|
const r = this.getStartTimeWithMinBookingNotice(e);
|
|
302
306
|
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
307
|
const o = this.schedulerStore.get("rescheduleBookingId");
|
|
304
308
|
o && s.append("booking_id", encodeURIComponent(o));
|
|
305
|
-
const
|
|
306
|
-
if ("error" in
|
|
309
|
+
const m = s.toString(), h = `/v3/scheduling/availability${m ? `?${m}` : ""}`, l = this.getHeaders(), d = await this.makeAPIRequest(decodeURIComponent(h), "GET", void 0, l);
|
|
310
|
+
if ("error" in d) {
|
|
307
311
|
this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
|
|
308
|
-
const
|
|
309
|
-
let v =
|
|
310
|
-
if (
|
|
311
|
-
const
|
|
312
|
-
v = this.errors.api(
|
|
312
|
+
const g = (_ = d.error) == null ? void 0 : _.type;
|
|
313
|
+
let v = d.error;
|
|
314
|
+
if (g && g in this.errors.api(c.t("getAvailabilityErrorTitle"))) {
|
|
315
|
+
const u = this.getErrorMessage(v);
|
|
316
|
+
v = this.errors.api(c.t("getAvailabilityErrorTitle"))[g](u);
|
|
313
317
|
}
|
|
314
318
|
return { error: v };
|
|
315
319
|
}
|
|
316
|
-
if ("data" in
|
|
317
|
-
const v = (((p = (
|
|
318
|
-
...
|
|
319
|
-
start_time: new Date(
|
|
320
|
-
end_time: new Date(
|
|
321
|
-
}))) || []).filter((
|
|
320
|
+
if ("data" in d) {
|
|
321
|
+
const v = (((p = (S = d.data) == null ? void 0 : S.time_slots) == null ? void 0 : p.map((I) => ({
|
|
322
|
+
...I,
|
|
323
|
+
start_time: new Date(I.start_time * 1e3),
|
|
324
|
+
end_time: new Date(I.end_time * 1e3)
|
|
325
|
+
}))) || []).filter((I) => I.start_time.getTime() > n);
|
|
322
326
|
this.schedulerStore.set("availability", v);
|
|
323
|
-
const
|
|
324
|
-
this.schedulerStore.set("availabilityOrderEmails",
|
|
327
|
+
const u = ((T = d.data) == null ? void 0 : T.order) || [];
|
|
328
|
+
this.schedulerStore.set("availabilityOrderEmails", u);
|
|
325
329
|
}
|
|
326
|
-
return this.schedulerStore.set("isLoading", !1),
|
|
330
|
+
return this.schedulerStore.set("isLoading", !1), d;
|
|
327
331
|
}
|
|
328
332
|
async cancelBooking(e, t) {
|
|
329
333
|
var o;
|
|
330
334
|
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
331
|
-
return { error: this.errors.component(
|
|
335
|
+
return { error: this.errors.component(c.t("cancelBookingErrorTitle")).no_booking_id() };
|
|
332
336
|
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
337
|
action: "cancel",
|
|
334
338
|
cancellation_reason: t
|
|
335
339
|
}), n);
|
|
336
340
|
if ("error" in r) {
|
|
337
341
|
this.schedulerStore.set("isLoading", !1);
|
|
338
|
-
const
|
|
339
|
-
let
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
|
|
342
|
+
const m = (o = r.error) == null ? void 0 : o.type;
|
|
343
|
+
let h = r.error;
|
|
344
|
+
if (m && m in this.errors.api(c.t("cancelBookingErrorTitle"))) {
|
|
345
|
+
const l = this.getErrorMessage(h);
|
|
346
|
+
h = this.errors.api(c.t("cancelBookingErrorTitle"))[m](l);
|
|
343
347
|
}
|
|
344
|
-
return { error:
|
|
348
|
+
return { error: h };
|
|
345
349
|
}
|
|
346
350
|
return this.schedulerStore.set("cancelledEventInfo", {
|
|
347
351
|
booking_id: e
|
|
348
352
|
}), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), r;
|
|
349
353
|
}
|
|
350
354
|
async rescheduleBooking(e, t) {
|
|
351
|
-
var
|
|
355
|
+
var A;
|
|
352
356
|
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
353
|
-
return { error: this.errors.component(
|
|
354
|
-
const s = this.errors.api(
|
|
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);
|
|
357
|
+
return { error: this.errors.component(c.t("rescheduleBookingErrorTitle")).no_booking_id() };
|
|
358
|
+
const s = this.errors.api(c.t("rescheduleBookingErrorTitle")), i = this.errors.component(c.t("rescheduleBookingErrorTitle")), { bookingInfo: n, selectedTimeslot: r, selectedTimezone: o, selectedLanguage: m } = this.schedulerStore.state, { startTime: h, endTime: l, timezone: d } = t, _ = h || (r == null ? void 0 : r.start_time);
|
|
358
359
|
if (!_)
|
|
360
|
+
return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
361
|
+
const S = l || (r == null ? void 0 : r.end_time);
|
|
362
|
+
if (!S)
|
|
359
363
|
return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
360
364
|
const p = this.schedulerStore.get("availabilityOrderEmails");
|
|
361
|
-
let
|
|
365
|
+
let T = "";
|
|
362
366
|
if (p.length > 0) {
|
|
363
|
-
const
|
|
364
|
-
for (let
|
|
365
|
-
if (
|
|
366
|
-
|
|
367
|
+
const b = (r == null ? void 0 : r.emails) || [];
|
|
368
|
+
for (let y = 0; y < p.length; y++)
|
|
369
|
+
if (b.includes(p[y])) {
|
|
370
|
+
T = p[y];
|
|
367
371
|
break;
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
|
-
const
|
|
371
|
-
if (!
|
|
374
|
+
const g = d || o;
|
|
375
|
+
if (!g)
|
|
372
376
|
return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
|
|
373
|
-
const v =
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
377
|
+
const v = {};
|
|
378
|
+
Object.entries((n == null ? void 0 : n.additionalFields) || {}).forEach(([b, y]) => {
|
|
379
|
+
v[b] = y.value;
|
|
380
|
+
});
|
|
381
|
+
const u = t ? t == null ? void 0 : t.primaryParticipant : n == null ? void 0 : n.primaryParticipant, I = t ? (t == null ? void 0 : t.guests) || [] : (n == null ? void 0 : n.guests) || [], k = t ? t == null ? void 0 : t.additionalFields : v, f = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", E = `/v3/scheduling/bookings/${e}${f}`, z = this.getHeaders(), w = await this.makeAPIRequest(decodeURIComponent(E), "PATCH", JSON.stringify({
|
|
382
|
+
start_time: _.getTime() / 1e3,
|
|
383
|
+
end_time: S.getTime() / 1e3,
|
|
384
|
+
timezone: g,
|
|
385
|
+
additional_fields: k,
|
|
386
|
+
guest: { ...u },
|
|
387
|
+
additional_guests: I,
|
|
388
|
+
participants: T ? [{ email: T }] : void 0,
|
|
389
|
+
email_language: this.getTwoLetterLanguageCode(m)
|
|
390
|
+
}), z);
|
|
391
|
+
if ("error" in w) {
|
|
384
392
|
this.schedulerStore.set("isLoading", !1);
|
|
385
|
-
const
|
|
386
|
-
let
|
|
387
|
-
if (
|
|
388
|
-
const
|
|
389
|
-
|
|
393
|
+
const b = (A = w.error) == null ? void 0 : A.type;
|
|
394
|
+
let y = w.error;
|
|
395
|
+
if (b && b in s) {
|
|
396
|
+
const $ = this.getErrorMessage(y);
|
|
397
|
+
y = s[b]($);
|
|
390
398
|
}
|
|
391
|
-
return { error:
|
|
399
|
+
return { error: y };
|
|
392
400
|
}
|
|
393
|
-
const
|
|
394
|
-
if ("data" in
|
|
395
|
-
this.schedulerStore.set("eventInfo",
|
|
396
|
-
else if (
|
|
397
|
-
this.schedulerStore.set("eventInfo",
|
|
401
|
+
const D = this.schedulerStore.get("reschedulingEventInfo");
|
|
402
|
+
if ("data" in w)
|
|
403
|
+
this.schedulerStore.set("eventInfo", w == null ? void 0 : w.data);
|
|
404
|
+
else if (D)
|
|
405
|
+
this.schedulerStore.set("eventInfo", D);
|
|
398
406
|
else {
|
|
399
|
-
const
|
|
407
|
+
const b = {
|
|
400
408
|
booking_id: e
|
|
401
409
|
};
|
|
402
|
-
this.schedulerStore.set("eventInfo",
|
|
410
|
+
this.schedulerStore.set("eventInfo", b);
|
|
403
411
|
}
|
|
404
|
-
return this.schedulerStore.set("isLoading", !1),
|
|
412
|
+
return this.schedulerStore.set("isLoading", !1), w;
|
|
405
413
|
}
|
|
406
414
|
async updateBooking(e) {
|
|
407
|
-
var
|
|
415
|
+
var d;
|
|
408
416
|
this.schedulerStore.set("isLoading", !0);
|
|
409
|
-
const { bookingId: t, status: s, reason: i } = e, n = this.schedulerStore.get("organizerConfirmationSalt"), r = s === "confirmed" ?
|
|
417
|
+
const { bookingId: t, status: s, reason: i } = e, n = this.schedulerStore.get("organizerConfirmationSalt"), r = s === "confirmed" ? c.t("confirmBookingErrorTitle") : c.t("rejectBookingErrorTitle");
|
|
410
418
|
if (!t)
|
|
411
419
|
return { error: this.errors.component(r).no_booking_id() };
|
|
412
420
|
if (!n)
|
|
413
421
|
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}` : "",
|
|
422
|
+
const o = !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/${t}${o}`, h = this.getHeaders(), l = await this.makeAPIRequest(decodeURIComponent(m), "PUT", JSON.stringify({
|
|
415
423
|
status: s,
|
|
416
424
|
cancellation_reason: i,
|
|
417
425
|
salt: n
|
|
418
|
-
}),
|
|
419
|
-
if ("error" in
|
|
426
|
+
}), h);
|
|
427
|
+
if ("error" in l) {
|
|
420
428
|
this.schedulerStore.set("isLoading", !1);
|
|
421
|
-
const
|
|
422
|
-
let
|
|
423
|
-
if (
|
|
424
|
-
const p = this.getErrorMessage(
|
|
425
|
-
|
|
429
|
+
const _ = (d = l.error) == null ? void 0 : d.type;
|
|
430
|
+
let S = l.error;
|
|
431
|
+
if (_ && _ in this.errors.api(r)) {
|
|
432
|
+
const p = this.getErrorMessage(S);
|
|
433
|
+
S = this.errors.api(r)[_](p);
|
|
426
434
|
}
|
|
427
|
-
return { error:
|
|
435
|
+
return { error: S };
|
|
428
436
|
}
|
|
429
|
-
return "data" in
|
|
437
|
+
return "data" in l && s === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", l == null ? void 0 : l.data) : "request_id" in l && s === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
|
|
430
438
|
booking_id: t
|
|
431
|
-
}), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1),
|
|
439
|
+
}), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), l;
|
|
432
440
|
}
|
|
433
441
|
}
|
|
434
442
|
function N(a = {}) {
|
|
@@ -449,17 +457,17 @@ function N(a = {}) {
|
|
|
449
457
|
nylasBranding: !0,
|
|
450
458
|
...a
|
|
451
459
|
};
|
|
452
|
-
|
|
453
|
-
const t =
|
|
460
|
+
L("[defaultNylasStoreState]: ", e);
|
|
461
|
+
const t = F(e);
|
|
454
462
|
return t.onChange("availability", (s) => {
|
|
455
|
-
|
|
463
|
+
L("[availability]: ", s);
|
|
456
464
|
const i = s.map((o) => o.start_time);
|
|
457
|
-
|
|
465
|
+
L("[selectableDates]: ", i), t.set("selectableDates", i);
|
|
458
466
|
const n = s[0];
|
|
459
467
|
if (!n)
|
|
460
468
|
return;
|
|
461
469
|
const r = Math.floor((n.end_time.getTime() - n.start_time.getTime()) / 6e4);
|
|
462
|
-
|
|
470
|
+
L("[durationMinutes]: ", r), t.set("eventDuration", r);
|
|
463
471
|
}), t.reset = () => {
|
|
464
472
|
for (const s in e) {
|
|
465
473
|
const i = e[s];
|
|
@@ -469,6 +477,6 @@ function N(a = {}) {
|
|
|
469
477
|
}
|
|
470
478
|
export {
|
|
471
479
|
N as C,
|
|
472
|
-
|
|
473
|
-
|
|
480
|
+
B as E,
|
|
481
|
+
O as N
|
|
474
482
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./index-bd6fdc8c.cjs");exports.ErrorCategory=void 0;(function(a){a.Component="component",a.Api="api",a.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var D;(function(a){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"})(D||(D={}));var A;(function(a){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"})(A||(A={}));class M{constructor(){this.component=e=>{const t=exports.ErrorCategory.Component,s=`${e} Error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:t}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:t}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:t}),no_timezone_selected:(i="No timezone selected")=>({title:s,message:i,category:t}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:t}),no_salt:(i="No salt provided")=>({title:s,message:i,category:t}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:t}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:t}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:t})}},this.api=e=>{const t=exports.ErrorCategory.Api,s=`${e} Error`;return{invalid_session:i=>({title:s,message:i,category:t}),general_error:i=>({title:s,message:i,category:t}),internal_error:i=>({title:s,message:i,category:t}),invalid_request_error:i=>({title:s,message:i,category:t}),timeslot_not_available:i=>({title:s,message:i,category:t}),provider_error:i=>({title:s,message:i,category:t}),not_found_error:i=>({title:s,message:i,category:t})}}}}class z{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i,slug:n,clientId:r}){this.errors=new M,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i,this.slug=n,this.clientId=r}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const n=new URL(this.schedulerAPIURL);return n.pathname=e,await(await fetch(decodeURIComponent(n.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,...i},body:s})).json()}catch(n){return{error:{message:n.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var s,i,n,r;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";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}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e),l.instance.changeLanguage(e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=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;return await this.getAvailability(s,i)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),s=this.schedulerStore.get("availability").find(n=>new Date(n.start_time)>new Date);let i=e;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}async setReschedule(e){this.schedulerStore.set("isLoading",!0);const t=this.schedulerStore.state.eventInfo;return t&&this.schedulerStore.set("reschedulingEventInfo",t),this.schedulerStore.set("rescheduleBookingId",e),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("rejectBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async goBack(){this.schedulerStore.set("cancelBookingId","")}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("confirmedEventInfo",void 0),e}async bookTimeslot(e){var I;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i,selectedLanguage:n}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component(l.instance.t("createBookingErrorTitle")).no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component(l.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const o=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s,m=n||"en-US";if(!o)return{error:this.errors.component(l.instance.t("createBookingErrorTitle")).no_timezone_selected()};const h=this.schedulerStore.get("availabilityOrderEmails");let c="";if(h.length>0){const b=(r==null?void 0:r.emails)||[];for(let f=0;f<h.length;f++)if(b.includes(h[f])){c=h[f];break}}const d={};Object.entries((i==null?void 0:i.additionalFields)||{}).forEach(([b,f])=>{d[b]=f.value});const _=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,S=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],p=e?e==null?void 0:e.additionalFields:d,T=this.getHeaders(),v=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`,u=await this.makeAPIRequest(decodeURIComponent(v),"POST",JSON.stringify({participants:c?[{email:c}]:void 0,additional_fields:p,additional_guests:S,guest:{..._},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:o,email_language:this.getTwoLetterLanguageCode(m)}),T);if("error"in u){this.schedulerStore.set("isLoading",!1);const b=(I=u.error)==null?void 0:I.type;let f=u.error;if(b&&b in this.errors.api("Create Booking")){const E=this.getErrorMessage(f);f=this.errors.api("Create Booking")[b](E)}return{error:f}}return"data"in u&&this.schedulerStore.set("eventInfo",u==null?void 0:u.data),this.schedulerStore.set("isLoading",!1),u}async getUISettings(){var n;this.schedulerStore.set("isLoading",!0);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);if("error"in i){this.schedulerStore.set("isLoading",!1);const r=(n=i.error)==null?void 0:n.type;let o=i.error;return r&&r in this.errors.api(l.instance.t("getUISettingErrorTitle"))&&(o=this.errors.api(l.instance.t("getUISettingErrorTitle"))[r]((o==null?void 0:o.message)||(o==null?void 0:o.title)||"Something went wrong")),{error:o}}return"data"in i&&this.schedulerStore.set("configSettings",i.data),this.schedulerStore.set("isLoading",!1),i}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){var n;const t=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler,s=t==null?void 0:t.min_booking_notice;if(!s)return e;const i=new Date().getTime();return e<(i+s*60*1e3)/1e3?Math.floor((i+s*60*1e3)/1e3):e}getEndTimeForAvailableDaysInFuture(e){var r,o;const t=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(l.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var _,S,p,T;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,n=i.getTime();if(t&&t<n/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component(l.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const g=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(g.getTime()/1e3)}if(!t){const g=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(g.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const r=this.getStartTimeWithMinBookingNotice(e);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)));const o=this.schedulerStore.get("rescheduleBookingId");o&&s.append("booking_id",encodeURIComponent(o));const m=s.toString(),h=`/v3/scheduling/availability${m?`?${m}`:""}`,c=this.getHeaders(),d=await this.makeAPIRequest(decodeURIComponent(h),"GET",void 0,c);if("error"in d){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const g=(_=d.error)==null?void 0:_.type;let v=d.error;if(g&&g in this.errors.api(l.instance.t("getAvailabilityErrorTitle"))){const u=this.getErrorMessage(v);v=this.errors.api(l.instance.t("getAvailabilityErrorTitle"))[g](u)}return{error:v}}if("data"in d){const v=(((p=(S=d.data)==null?void 0:S.time_slots)==null?void 0:p.map(I=>({...I,start_time:new Date(I.start_time*1e3),end_time:new Date(I.end_time*1e3)})))||[]).filter(I=>I.start_time.getTime()>n);this.schedulerStore.set("availability",v);const u=((T=d.data)==null?void 0:T.order)||[];this.schedulerStore.set("availabilityOrderEmails",u)}return this.schedulerStore.set("isLoading",!1),d}async cancelBooking(e,t){var o;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(l.instance.t("cancelBookingErrorTitle")).no_booking_id()};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({action:"cancel",cancellation_reason:t}),n);if("error"in r){this.schedulerStore.set("isLoading",!1);const m=(o=r.error)==null?void 0:o.type;let h=r.error;if(m&&m in this.errors.api(l.instance.t("cancelBookingErrorTitle"))){const c=this.getErrorMessage(h);h=this.errors.api(l.instance.t("cancelBookingErrorTitle"))[m](c)}return{error:h}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),r}async rescheduleBooking(e,t){var B;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(l.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const s=this.errors.api(l.instance.t("rescheduleBookingErrorTitle")),i=this.errors.component(l.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:n,selectedTimeslot:r,selectedTimezone:o,selectedLanguage:m}=this.schedulerStore.state,{startTime:h,endTime:c,timezone:d}=t,_=h||(r==null?void 0:r.start_time);if(!_)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const S=c||(r==null?void 0:r.end_time);if(!S)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const p=this.schedulerStore.get("availabilityOrderEmails");let T="";if(p.length>0){const k=(r==null?void 0:r.emails)||[];for(let y=0;y<p.length;y++)if(k.includes(p[y])){T=p[y];break}}const g=d||o;if(!g)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const v={};Object.entries((n==null?void 0:n.additionalFields)||{}).forEach(([k,y])=>{v[k]=y.value});const u=t?t==null?void 0:t.primaryParticipant:n==null?void 0:n.primaryParticipant,I=t?(t==null?void 0:t.guests)||[]:(n==null?void 0:n.guests)||[],b=t?t==null?void 0:t.additionalFields:v,f=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",E=`/v3/scheduling/bookings/${e}${f}`,P=this.getHeaders(),w=await this.makeAPIRequest(decodeURIComponent(E),"PATCH",JSON.stringify({start_time:_.getTime()/1e3,end_time:S.getTime()/1e3,timezone:g,additional_fields:b,guest:{...u},additional_guests:I,participants:T?[{email:T}]:void 0,email_language:this.getTwoLetterLanguageCode(m)}),P);if("error"in w){this.schedulerStore.set("isLoading",!1);const k=(B=w.error)==null?void 0:B.type;let y=w.error;if(k&&k in s){const C=this.getErrorMessage(y);y=s[k](C)}return{error:y}}const L=this.schedulerStore.get("reschedulingEventInfo");if("data"in w)this.schedulerStore.set("eventInfo",w==null?void 0:w.data);else if(L)this.schedulerStore.set("eventInfo",L);else{const k={booking_id:e};this.schedulerStore.set("eventInfo",k)}return this.schedulerStore.set("isLoading",!1),w}async updateBooking(e){var d;this.schedulerStore.set("isLoading",!0);const{bookingId:t,status:s,reason:i}=e,n=this.schedulerStore.get("organizerConfirmationSalt"),r=s==="confirmed"?l.instance.t("confirmBookingErrorTitle"):l.instance.t("rejectBookingErrorTitle");if(!t)return{error:this.errors.component(r).no_booking_id()};if(!n)return{error:this.errors.component(r).no_salt()};const o=!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/${t}${o}`,h=this.getHeaders(),c=await this.makeAPIRequest(decodeURIComponent(m),"PUT",JSON.stringify({status:s,cancellation_reason:i,salt:n}),h);if("error"in c){this.schedulerStore.set("isLoading",!1);const _=(d=c.error)==null?void 0:d.type;let S=c.error;if(_&&_ in this.errors.api(r)){const p=this.getErrorMessage(S);S=this.errors.api(r)[_](p)}return{error:S}}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",{booking_id:t}),this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("isLoading",!1),c}}function $(a={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...a};l.debug("[defaultNylasStoreState]: ",e);const t=l.createStore(e);return t.onChange("availability",s=>{l.debug("[availability]: ",s);const i=s.map(o=>o.start_time);l.debug("[selectableDates]: ",i),t.set("selectableDates",i);const n=s[0];if(!n)return;const r=Math.floor((n.end_time.getTime()-n.start_time.getTime())/6e4);l.debug("[durationMinutes]: ",r),t.set("eventDuration",r)}),t.reset=()=>{for(const s in e){const i=e[s];t.set(s,i)}},t}exports.CreateNylasSchedulerStore=$;exports.NylaSchedulerAPIConnector=z;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r as s, h as t } from "./index-3fd31877.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const o = ".sc-sent-icon-h{display:flex}", i = o, c = class {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
s(this, e), this.width = "15", this.height = "15";
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return t("svg", { key: "ca3a664814e986f46006171c0fb63441478ef5b8", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "e4d9309797e02ca60918d49c55854d51f93c1a2b", d: "M21.5 12L3.5 3.5L3.5 20.5L21.5 12Z", stroke: "auto", "stroke-width": "1.5" }), t("path", { key: "082bf637872a00ba8abe224cc7c8092dc371ea75", d: "M3.5 3.5L12 10.5", stroke: "auto", "stroke-width": "1.5" }), t("path", { key: "dd3f5647d7cdb9dfbdb480ab332917564969f546", d: "M3.5 20.5L12 13.5", stroke: "auto", "stroke-width": "1.5" }));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
c.style = i;
|
|
13
|
+
export {
|
|
14
|
+
c as sent_icon
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-bd6fdc8c.cjs");require("react");require("react-dom");const i=".sc-sent-icon-h{display:flex}",o=i,e=class{constructor(s){t.registerInstance(this,s),this.width="15",this.height="15"}render(){return t.h("svg",{key:"ca3a664814e986f46006171c0fb63441478ef5b8",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"e4d9309797e02ca60918d49c55854d51f93c1a2b",d:"M21.5 12L3.5 3.5L3.5 20.5L21.5 12Z",stroke:"auto","stroke-width":"1.5"}),t.h("path",{key:"082bf637872a00ba8abe224cc7c8092dc371ea75",d:"M3.5 3.5L12 10.5",stroke:"auto","stroke-width":"1.5"}),t.h("path",{key:"dd3f5647d7cdb9dfbdb480ab332917564969f546",d:"M3.5 20.5L12 13.5",stroke:"auto","stroke-width":"1.5"}))}};e.style=o;exports.sent_icon=e;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r as e, h as t } from "./index-3fd31877.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const c = ".sc-spam-icon-h{display:flex}", a = c, o = class {
|
|
5
|
+
constructor(s) {
|
|
6
|
+
e(this, s), this.width = "15", this.height = "15";
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return t("svg", { key: "a8e87346312ed75a47b88790585e07d8c518c3e9", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "5cb3444afa08fc37a8cf2e268c62faf5c97379f5", d: "M20 3H4C2.89543 3 2 3.89543 2 5V19C2 20.1046 2.89543 21 4 21H20C21.1046 21 22 20.1046 22 19V5C22 3.89543 21.1046 3 20 3Z", stroke: "auto", "stroke-width": "1.5" }), t("path", { key: "b695c0e7aa34cf44da99cce51c17ff98b3ad8906", d: "M2 5L12 12.5L22 5", stroke: "auto", "stroke-width": "1.5" }));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
o.style = a;
|
|
13
|
+
export {
|
|
14
|
+
o as spam_icon
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-bd6fdc8c.cjs");require("react");require("react-dom");const c=".sc-spam-icon-h{display:flex}",i=c,t=class{constructor(s){e.registerInstance(this,s),this.width="15",this.height="15"}render(){return e.h("svg",{key:"a8e87346312ed75a47b88790585e07d8c518c3e9",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},e.h("path",{key:"5cb3444afa08fc37a8cf2e268c62faf5c97379f5",d:"M20 3H4C2.89543 3 2 3.89543 2 5V19C2 20.1046 2.89543 21 4 21H20C21.1046 21 22 20.1046 22 19V5C22 3.89543 21.1046 3 20 3Z",stroke:"auto","stroke-width":"1.5"}),e.h("path",{key:"b695c0e7aa34cf44da99cce51c17ff98b3ad8906",d:"M2 5L12 12.5L22 5",stroke:"auto","stroke-width":"1.5"}))}};t.style=i;exports.spam_icon=t;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { r as e, h as t } from "./index-
|
|
1
|
+
import { r as e, h as t } from "./index-3fd31877.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
const
|
|
4
|
+
const a = ".sc-star-icon-h{display:flex}", c = a, i = class {
|
|
5
5
|
constructor(s) {
|
|
6
6
|
e(this, s), this.width = "15", this.height = "15";
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return t("svg", { key: "
|
|
9
|
+
return t("svg", { key: "acc7e88e0901acac79fd0bf4a3a355ea82b46934", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "a3a8ed61cce35a1f67c5aa22cb0aee42c965474e", d: "M9.15316 5.40838C10.4198 3.13613 11.0531 2 12 2C12.9469 2 13.5802 3.13612 14.8468 5.40837L15.1745 5.99623C15.5345 6.64193 15.7144 6.96479 15.9951 7.17781C16.2757 7.39083 16.6251 7.4699 17.3241 7.62805L17.9605 7.77203C20.4201 8.32856 21.65 8.60682 21.9426 9.54773C22.2352 10.4886 21.3968 11.4691 19.7199 13.4299L19.2861 13.9372C18.8096 14.4944 18.5713 14.773 18.4641 15.1177C18.357 15.4624 18.393 15.8341 18.465 16.5776L18.5306 17.2544C18.7841 19.8706 18.9109 21.1787 18.1449 21.7602C17.3788 22.3417 16.2273 21.8115 13.9243 20.7512L13.3285 20.4768C12.6741 20.1755 12.3469 20.0248 12 20.0248C11.6531 20.0248 11.3259 20.1755 10.6715 20.4768L10.0757 20.7512C7.77268 21.8115 6.62118 22.3417 5.85515 21.7602C5.08912 21.1787 5.21588 19.8706 5.4694 17.2544L5.53498 16.5776C5.60703 15.8341 5.64305 15.4624 5.53586 15.1177C5.42868 14.773 5.19043 14.4944 4.71392 13.9372L4.2801 13.4299C2.60325 11.4691 1.76482 10.4886 2.05742 9.54773C2.35002 8.60682 3.57986 8.32856 6.03954 7.77203L6.67589 7.62805C7.37485 7.4699 7.72433 7.39083 8.00494 7.17781C8.28555 6.96479 8.46553 6.64194 8.82547 5.99623L9.15316 5.40838Z", stroke: "auto", "stroke-width": "1.5" }));
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
i.style = c;
|
|
13
13
|
export {
|
|
14
|
-
|
|
14
|
+
i as star_icon
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-bd6fdc8c.cjs");require("react");require("react-dom");const i=".sc-star-icon-h{display:flex}",c=i,e=class{constructor(s){t.registerInstance(this,s),this.width="15",this.height="15"}render(){return t.h("svg",{key:"acc7e88e0901acac79fd0bf4a3a355ea82b46934",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"a3a8ed61cce35a1f67c5aa22cb0aee42c965474e",d:"M9.15316 5.40838C10.4198 3.13613 11.0531 2 12 2C12.9469 2 13.5802 3.13612 14.8468 5.40837L15.1745 5.99623C15.5345 6.64193 15.7144 6.96479 15.9951 7.17781C16.2757 7.39083 16.6251 7.4699 17.3241 7.62805L17.9605 7.77203C20.4201 8.32856 21.65 8.60682 21.9426 9.54773C22.2352 10.4886 21.3968 11.4691 19.7199 13.4299L19.2861 13.9372C18.8096 14.4944 18.5713 14.773 18.4641 15.1177C18.357 15.4624 18.393 15.8341 18.465 16.5776L18.5306 17.2544C18.7841 19.8706 18.9109 21.1787 18.1449 21.7602C17.3788 22.3417 16.2273 21.8115 13.9243 20.7512L13.3285 20.4768C12.6741 20.1755 12.3469 20.0248 12 20.0248C11.6531 20.0248 11.3259 20.1755 10.6715 20.4768L10.0757 20.7512C7.77268 21.8115 6.62118 22.3417 5.85515 21.7602C5.08912 21.1787 5.21588 19.8706 5.4694 17.2544L5.53498 16.5776C5.60703 15.8341 5.64305 15.4624 5.53586 15.1177C5.42868 14.773 5.19043 14.4944 4.71392 13.9372L4.2801 13.4299C2.60325 11.4691 1.76482 10.4886 2.05742 9.54773C2.35002 8.60682 3.57986 8.32856 6.03954 7.77203L6.67589 7.62805C7.37485 7.4699 7.72433 7.39083 8.00494 7.17781C8.28555 6.96479 8.46553 6.64194 8.82547 5.99623L9.15316 5.40838Z",stroke:"auto","stroke-width":"1.5"}))}};e.style=c;exports.star_icon=e;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r as s, h as t } from "./index-3fd31877.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const e = ".sc-stop-icon-h{display:flex}", i = e, c = class {
|
|
5
|
+
constructor(o) {
|
|
6
|
+
s(this, o), this.width = "15", this.height = "15";
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return t("svg", { key: "f70cc744dde889a32cc0339cf4be41ae38237d0b", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "f7bd4f78d4e2efc797932d91aac355e0f9d4f309", d: "M4 4H20V20H4V4Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
c.style = i;
|
|
13
|
+
export {
|
|
14
|
+
c as stop_icon
|
|
15
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-bd6fdc8c.cjs");require("react");require("react-dom");const s=".sc-stop-icon-h{display:flex}",i=s,e=class{constructor(o){t.registerInstance(this,o),this.width="15",this.height="15"}render(){return t.h("svg",{key:"f70cc744dde889a32cc0339cf4be41ae38237d0b",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"f7bd4f78d4e2efc797932d91aac355e0f9d4f309",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};e.style=i;exports.stop_icon=e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as s, c as l,
|
|
1
|
+
import { r as s, c as l, t as r, h as a } from "./index-3fd31877.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
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 {
|
|
@@ -28,7 +28,7 @@ const i = ':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--n
|
|
|
28
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
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
return a("label", { key: "
|
|
31
|
+
return a("label", { key: "503a9e472a4dea351f13d8e430a0ee9ecc20e3fb", part: "tc__label", class: { error: !!this.error } }, a("p", { key: "7ce9a57c8e2dc9d0c3a88edf93ba09a3b49cf149" }, a("span", { key: "8feedbb7300d0eb20192b17a0482f9c981bba120", 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: "79dd6889c5da4797b26504731583db5887c21bcb", 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
32
|
}
|
|
33
33
|
};
|
|
34
34
|
o.style = n;
|
package/dist/{textarea-component.entry-683c2959.cjs → textarea-component.entry-f330a755.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-bd6fdc8c.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:"503a9e472a4dea351f13d8e430a0ee9ecc20e3fb",part:"tc__label",class:{error:!!this.error}},e.h("p",{key:"7ce9a57c8e2dc9d0c3a88edf93ba09a3b49cf149"},e.h("span",{key:"8feedbb7300d0eb20192b17a0482f9c981bba120",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:"79dd6889c5da4797b26504731583db5887c21bcb",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;
|