@nylas/react 1.1.0-canary.23 → 1.1.0-canary.24
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-4a6b44be.js +25 -0
- package/dist/add-circle-icon_2.entry-b0e8cb94.cjs +1 -0
- package/dist/{archive-icon_7.entry-3dcc4a66.js → archive-icon_7.entry-0d379e81.js} +14 -14
- package/dist/{archive-icon_7.entry-2ec9b077.cjs → archive-icon_7.entry-464293d2.cjs} +1 -1
- package/dist/{arrow-icon.entry-2cf3e94d.js → arrow-icon.entry-3c2e4e0d.js} +2 -2
- package/dist/{arrow-icon.entry-175e8181.cjs → arrow-icon.entry-4e6fe7be.cjs} +1 -1
- package/dist/{bold-icon_3.entry-9fc74a39.js → bold-icon_3.entry-5f0eedfe.js} +4 -4
- package/dist/{bold-icon_3.entry-a3e61ad8.cjs → bold-icon_3.entry-ba65ceeb.cjs} +1 -1
- package/dist/button-component_2.entry-1290a222.js +26 -0
- package/dist/button-component_2.entry-ae5e68ec.cjs +1 -0
- package/dist/{calendar-agenda-fill-icon_39.entry-493e91f6.js → calendar-agenda-fill-icon_48.entry-4ae8cc76.js} +1966 -1396
- package/dist/calendar-agenda-fill-icon_48.entry-eaa36515.cjs +7 -0
- package/dist/{calendar-cancel-icon.entry-c9c7e3b3.cjs → calendar-cancel-icon.entry-6506440a.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-3ca731f9.js → calendar-cancel-icon.entry-d2f0c9e0.js} +4 -4
- package/dist/{calendar-check-icon_2.entry-5b8f8a75.cjs → calendar-check-icon_2.entry-0f70758f.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-7c409a91.js → calendar-check-icon_2.entry-5212c5b3.js} +9 -9
- package/dist/{calendar-icon.entry-0589697f.js → calendar-icon.entry-b7626be4.js} +7 -7
- package/dist/{calendar-icon.entry-acd00f6f.cjs → calendar-icon.entry-f10bd734.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-538fd8ec.js → checkbox-component_2.entry-7ce6d945.js} +3 -3
- package/dist/{checkbox-component_2.entry-0aa252b9.cjs → checkbox-component_2.entry-879250a5.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-80e03257.js → chevron-icon_3.entry-8c9ca484.js} +14 -14
- package/dist/{chevron-icon_3.entry-7076e105.cjs → chevron-icon_3.entry-a2f9e9ba.cjs} +1 -1
- package/dist/{clock-icon_4.entry-db3fbda1.js → clock-icon_4.entry-3d9d8690.js} +16 -16
- package/dist/{clock-icon_4.entry-d6901afd.cjs → clock-icon_4.entry-7ecb071a.cjs} +1 -1
- package/dist/{constants-12bd3c98-26c75011.js → constants-50c3e067-8cc8e601.js} +618 -605
- package/dist/{constants-12bd3c98-22fd56f2.cjs → constants-50c3e067-da2d4786.cjs} +5 -5
- package/dist/copy-icon.entry-0a80a55e.cjs +1 -0
- package/dist/copy-icon.entry-38cfea6b.js +15 -0
- package/dist/delete-icon_2.entry-9e7cf99e.cjs +1 -0
- package/dist/delete-icon_2.entry-f9a43051.js +25 -0
- package/dist/{document-refresh-icon.entry-a3326831.cjs → document-refresh-icon.entry-5d6c4a99.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-149f2a3b.js → document-refresh-icon.entry-827975fd.js} +5 -5
- package/dist/elements/index.d.ts +9 -1
- package/dist/{elements-dc5b338e-e07600d4.js → elements-dc5b338e-0f8b5d33.js} +1 -1
- package/dist/{elements-dc5b338e-211879a3.cjs → elements-dc5b338e-3a7e1134.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-cb97634f.cjs → focus-visible-e8093c16-088a527d.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-284cefe0.js → focus-visible-e8093c16-40f0c20e.js} +1 -1
- package/dist/{forward-icon_6.entry-751fdd4e.cjs → forward-icon_6.entry-a8f80871.cjs} +3 -3
- package/dist/{forward-icon_6.entry-554b0722.js → forward-icon_6.entry-f984a68b.js} +9 -9
- package/dist/{globe-icon.entry-e3dd58bc.js → globe-icon.entry-a78c8ea8.js} +5 -5
- package/dist/{globe-icon.entry-63eb510d.cjs → globe-icon.entry-c50fc96c.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-14d75c66.cjs +1 -0
- package/dist/google-logo-icon_4.entry-710632b6.js +680 -0
- package/dist/index-53420959-78cc8138.cjs +1 -0
- package/dist/index-53420959-da9158f8.js +5 -0
- package/dist/{index-6d9eeb53-cc42c6f1.js → index-6d9eeb53-407c797a.js} +2 -2
- package/dist/{index-6d9eeb53-81e5b798.cjs → index-6d9eeb53-cac6eaea.cjs} +1 -1
- package/dist/index-a3051853.cjs +42 -0
- package/dist/index-eca7f3e2.js +7859 -0
- package/dist/{index.es-5355a265-f8853ce4.js → index.es-17b386f4-856af8bb.js} +1 -1
- package/dist/{index.es-5355a265-e701a627.cjs → index.es-17b386f4-c6a8cc2a.cjs} +1 -1
- package/dist/{info-icon_2.entry-9559cf3b.cjs → info-icon_2.entry-c08c459c.cjs} +1 -1
- package/dist/{info-icon_2.entry-3b349f01.js → info-icon_2.entry-ffd39ba3.js} +5 -5
- package/dist/input-component.entry-35e6e399.cjs +1 -0
- package/dist/input-component.entry-c09124d3.js +65 -0
- package/dist/{input-dropdown.entry-9bc68630.js → input-dropdown.entry-83f2c378.js} +8 -6
- package/dist/input-dropdown.entry-9ac3e157.cjs +1 -0
- package/dist/{mailbox-store-31d55036-c8618c0b.cjs → mailbox-store-2e401c7f-66a87143.cjs} +1 -1
- package/dist/{mailbox-store-31d55036-1106efe2.js → mailbox-store-2e401c7f-9d607fd1.js} +2 -2
- package/dist/{multi-select-dropdown.entry-36074a81.js → multi-select-dropdown.entry-2c2125e3.js} +2 -2
- package/dist/{multi-select-dropdown.entry-e5ed9285.cjs → multi-select-dropdown.entry-8710acb4.cjs} +1 -1
- package/dist/nylas-booked-event-card_12.entry-009a11e3.cjs +1 -0
- package/dist/nylas-booked-event-card_12.entry-5821b0c4.js +1134 -0
- package/dist/{nylas-form-card.entry-6e45c873.js → nylas-form-card.entry-0ce9dd7d.js} +18 -18
- package/dist/{nylas-form-card.entry-03a31218.cjs → nylas-form-card.entry-951163a1.cjs} +1 -1
- package/dist/{nylas-if-state.entry-61d7ebc5.cjs → nylas-if-state.entry-16aabbff.cjs} +1 -1
- package/dist/{nylas-if-state.entry-092f4e1a.js → nylas-if-state.entry-474cfdcd.js} +3 -3
- package/dist/{nylas-list-folders.entry-ab9e1c2c.js → nylas-list-folders.entry-a9e53520.js} +7 -7
- package/dist/{nylas-list-folders.entry-1abbb401.cjs → nylas-list-folders.entry-f0a4d566.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-2faaa2bb.js → nylas-list-threads.entry-5af74949.js} +3 -3
- package/dist/{nylas-list-threads.entry-dfc87aca.cjs → nylas-list-threads.entry-7fc8b71d.cjs} +1 -1
- package/dist/{nylas-login.entry-243ae09e.js → nylas-login.entry-acbdf23c.js} +7 -7
- package/dist/{nylas-login.entry-d1cac0a1.cjs → nylas-login.entry-d0fcf7c4.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-b8225a3e.js → nylas-mailbox-pagination.entry-01f32d0c.js} +2 -2
- package/dist/{nylas-mailbox-pagination.entry-c27af71c.cjs → nylas-mailbox-pagination.entry-a70e4777.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-b66d597d.cjs → nylas-mailbox-toolbar-button.entry-208b2667.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-22347d22.js → nylas-mailbox-toolbar-button.entry-a8166cf0.js} +3 -3
- package/dist/{nylas-mailbox.entry-cb80f58c.cjs → nylas-mailbox.entry-7a3562b6.cjs} +1 -1
- package/dist/{nylas-mailbox.entry-9e6e1b4d.js → nylas-mailbox.entry-bbd33bb0.js} +6 -6
- package/dist/{nylas-provider.entry-196dd5da.js → nylas-provider.entry-7e8aedea.js} +39 -39
- package/dist/{nylas-provider.entry-28c12448.cjs → nylas-provider.entry-9cce7730.cjs} +1 -1
- package/dist/{nylas-reminder-emails.entry-47ef5a9d.cjs → nylas-reminder-emails.entry-287316b6.cjs} +2 -2
- package/dist/{nylas-reminder-emails.entry-b655d888.js → nylas-reminder-emails.entry-a1b49b18.js} +9 -9
- package/dist/{nylas-reminder-time_2.entry-0f3747fb.cjs → nylas-reminder-time_2.entry-0a480ab7.cjs} +1 -1
- package/dist/{nylas-reminder-time_2.entry-9d8f7436.js → nylas-reminder-time_2.entry-6f6067f9.js} +6 -6
- package/dist/{nylas-scheduler-editor.entry-feb7a7db.js → nylas-scheduler-editor.entry-625d597e.js} +63 -45
- package/dist/{nylas-scheduler-editor.entry-504e8ed3.cjs → nylas-scheduler-editor.entry-6be8e9c6.cjs} +2 -2
- package/dist/nylas-scheduling.entry-1678be21.cjs +1 -0
- package/dist/nylas-scheduling.entry-fa471c9e.js +340 -0
- package/dist/{nylas-threads-refresh.entry-e637161b.cjs → nylas-threads-refresh.entry-77015d63.cjs} +1 -1
- package/dist/{nylas-threads-refresh.entry-91af9af3.js → nylas-threads-refresh.entry-da68039b.js} +11 -11
- package/dist/{nylas-threads-search.entry-5457dcec.js → nylas-threads-search.entry-27472aef.js} +4 -4
- package/dist/{nylas-threads-search.entry-b944f95a.cjs → nylas-threads-search.entry-8f765c67.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-134ef726.cjs → nylas-time-window-picker.entry-a59d7be6.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-a6fd216b.js → nylas-time-window-picker.entry-e8842700.js} +10 -10
- package/dist/{nylas-view-thread.entry-9296a505.cjs → nylas-view-thread.entry-16cc4066.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-6fdd6cb1.js → nylas-view-thread.entry-322a9890.js} +3 -3
- package/dist/{person-icon.entry-4a695727.js → person-icon.entry-b62da62d.js} +4 -4
- package/dist/{person-icon.entry-1cdb4dc2.cjs → person-icon.entry-fd56c344.cjs} +1 -1
- package/dist/{play-icon_2.entry-fb013b17.js → play-icon_2.entry-d0a67f7b.js} +7 -7
- package/dist/play-icon_2.entry-d17c9937.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +108 -100
- package/dist/{refresh-icon.entry-9dbb04ba.cjs → refresh-icon.entry-5427ec8d.cjs} +1 -1
- package/dist/{refresh-icon.entry-46c92605.js → refresh-icon.entry-99d7fbcb.js} +4 -4
- package/dist/{register-component-592986c5-d5d210a8.js → register-component-4487ac6f-4b0c1c53.js} +1 -1
- package/dist/{register-component-592986c5-5edf5835.cjs → register-component-4487ac6f-b29bf135.cjs} +1 -1
- package/dist/scheduler-config-store-2a3b403d-51c51cff.cjs +1 -0
- package/dist/{scheduler-config-store-9ccfba4d-b08031b5.js → scheduler-config-store-2a3b403d-810ef774.js} +5 -4
- package/dist/scheduler-store-55107657-25845a8b.cjs +1 -0
- package/dist/{scheduler-store-fd0d11a5-313e8592.js → scheduler-store-55107657-6c0c5de4.js} +179 -132
- package/dist/{textarea-component.entry-788eb37a.cjs → textarea-component.entry-8bdfbcc9.cjs} +1 -1
- package/dist/{textarea-component.entry-0cd3b57f.js → textarea-component.entry-9803d3c3.js} +4 -4
- package/dist/{time-period-selector.entry-112c0b64.js → time-period-selector.entry-a6c6aefd.js} +41 -41
- package/dist/time-period-selector.entry-d7792301.cjs +1 -0
- package/dist/{translate-icon.entry-c701b391.cjs → translate-icon.entry-4970d886.cjs} +1 -1
- package/dist/{translate-icon.entry-a4df3c16.js → translate-icon.entry-d65cfcea.js} +6 -6
- package/dist/{warning-icon.entry-bda0aafa.cjs → warning-icon.entry-870059cb.cjs} +1 -1
- package/dist/{warning-icon.entry-d1703715.js → warning-icon.entry-eb7da408.js} +5 -5
- package/package.json +3 -3
- package/dist/add-circle-icon_3.entry-37a88ff3.js +0 -79
- package/dist/add-circle-icon_3.entry-4f8f1cbf.cjs +0 -1
- package/dist/button-component.entry-7fdb3bca.cjs +0 -1
- package/dist/button-component.entry-861637f2.js +0 -16
- package/dist/calendar-agenda-fill-icon_39.entry-3c21a3ec.cjs +0 -7
- package/dist/checkmark-icon.entry-0a184b31.cjs +0 -1
- package/dist/checkmark-icon.entry-56302db0.js +0 -15
- package/dist/copy-icon_3.entry-33e89a37.cjs +0 -1
- package/dist/copy-icon_3.entry-9670b9f9.js +0 -35
- package/dist/google-logo-icon_5.entry-bccce7f4.cjs +0 -1
- package/dist/google-logo-icon_5.entry-e462e091.js +0 -748
- package/dist/index-53420959-02fe58ef.js +0 -5
- package/dist/index-53420959-0b9c205e.cjs +0 -1
- package/dist/index-8a536089.cjs +0 -42
- package/dist/index-a15916e5.js +0 -7653
- package/dist/input-dropdown.entry-d454f6bc.cjs +0 -1
- package/dist/loading-icon.entry-1d49e471.js +0 -15
- package/dist/loading-icon.entry-a68da48b.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-38d2fd2e.js +0 -954
- package/dist/nylas-booked-event-card_10.entry-e530a8db.cjs +0 -1
- package/dist/nylas-booking-confirmation-type.entry-2fea82f9.js +0 -106
- package/dist/nylas-booking-confirmation-type.entry-5857a863.cjs +0 -1
- package/dist/nylas-scheduling.entry-8c8f8e35.cjs +0 -1
- package/dist/nylas-scheduling.entry-d35efa9a.js +0 -286
- package/dist/play-icon_2.entry-10fd617e.cjs +0 -1
- package/dist/scheduler-config-store-9ccfba4d-3ec35859.cjs +0 -1
- package/dist/scheduler-store-fd0d11a5-b180b3b7.cjs +0 -1
- package/dist/time-period-selector.entry-1e0b720b.cjs +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { d as b, e as
|
|
2
|
-
var
|
|
1
|
+
import { d as b, e as $, k as d, m as R } from "./index-eca7f3e2.js";
|
|
2
|
+
var w;
|
|
3
3
|
(function(a) {
|
|
4
4
|
a.Component = "component", a.Api = "api", a.Auth = "auth";
|
|
5
|
-
})(
|
|
6
|
-
var
|
|
5
|
+
})(w || (w = {}));
|
|
6
|
+
var D;
|
|
7
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.invalid_start_time = "invalid_start_time", a.invalid_end_time = "invalid_end_time", a.invalid_timezone = "invalid_timezone";
|
|
9
|
-
})(
|
|
10
|
-
var
|
|
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
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
|
-
})(
|
|
14
|
-
class
|
|
13
|
+
})(A || (A = {}));
|
|
14
|
+
class C {
|
|
15
15
|
constructor() {
|
|
16
16
|
this.component = (e) => {
|
|
17
|
-
const t =
|
|
17
|
+
const t = w.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,
|
|
@@ -41,6 +41,11 @@ class R {
|
|
|
41
41
|
message: i,
|
|
42
42
|
category: t
|
|
43
43
|
}),
|
|
44
|
+
no_salt: (i = "No salt provided") => ({
|
|
45
|
+
title: s,
|
|
46
|
+
message: i,
|
|
47
|
+
category: t
|
|
48
|
+
}),
|
|
44
49
|
invalid_start_time: (i = "Invalid start time") => ({
|
|
45
50
|
title: s,
|
|
46
51
|
message: i,
|
|
@@ -58,7 +63,7 @@ class R {
|
|
|
58
63
|
})
|
|
59
64
|
};
|
|
60
65
|
}, this.api = (e) => {
|
|
61
|
-
const t =
|
|
66
|
+
const t = w.Api, s = `${e} Error`;
|
|
62
67
|
return {
|
|
63
68
|
invalid_session: (i) => ({
|
|
64
69
|
title: s,
|
|
@@ -99,9 +104,9 @@ class R {
|
|
|
99
104
|
};
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
class
|
|
103
|
-
constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i }) {
|
|
104
|
-
this.errors = new
|
|
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;
|
|
105
110
|
}
|
|
106
111
|
getHeaders() {
|
|
107
112
|
return this.sessionId ? {
|
|
@@ -110,8 +115,8 @@ class C {
|
|
|
110
115
|
}
|
|
111
116
|
async makeAPIRequest(e, t, s, i = {}) {
|
|
112
117
|
try {
|
|
113
|
-
const
|
|
114
|
-
return
|
|
118
|
+
const n = new URL(this.schedulerAPIURL);
|
|
119
|
+
return n.pathname = e, await (await fetch(decodeURIComponent(n.toString()), {
|
|
115
120
|
method: t,
|
|
116
121
|
headers: {
|
|
117
122
|
"Content-Type": "application/json",
|
|
@@ -120,10 +125,10 @@ class C {
|
|
|
120
125
|
},
|
|
121
126
|
body: s
|
|
122
127
|
})).json();
|
|
123
|
-
} catch (
|
|
128
|
+
} catch (n) {
|
|
124
129
|
return {
|
|
125
130
|
error: {
|
|
126
|
-
message:
|
|
131
|
+
message: n.message,
|
|
127
132
|
title: "API request failed",
|
|
128
133
|
type: "api"
|
|
129
134
|
}
|
|
@@ -131,9 +136,9 @@ class C {
|
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
getErrorMessage(e) {
|
|
134
|
-
var s, i,
|
|
139
|
+
var s, i, n, r;
|
|
135
140
|
let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
|
|
136
|
-
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) || ((
|
|
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;
|
|
137
142
|
}
|
|
138
143
|
setConfigId(e) {
|
|
139
144
|
this.configId = e;
|
|
@@ -178,7 +183,7 @@ class C {
|
|
|
178
183
|
return await this.getAvailability(s, i);
|
|
179
184
|
}
|
|
180
185
|
async resetStoreStateAndFetchAvailability() {
|
|
181
|
-
const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((
|
|
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());
|
|
182
187
|
let i = e;
|
|
183
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;
|
|
184
189
|
}
|
|
@@ -192,191 +197,233 @@ class C {
|
|
|
192
197
|
async setCancel(e) {
|
|
193
198
|
this.schedulerStore.set("cancelBookingId", e);
|
|
194
199
|
}
|
|
200
|
+
async setReject(e) {
|
|
201
|
+
this.schedulerStore.set("rejectBookingId", e);
|
|
202
|
+
}
|
|
195
203
|
async resetCancel() {
|
|
196
204
|
const e = await this.resetStoreStateAndFetchAvailability();
|
|
197
|
-
return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
|
|
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;
|
|
198
213
|
}
|
|
199
214
|
async bookTimeslot(e) {
|
|
200
|
-
var
|
|
215
|
+
var I;
|
|
201
216
|
this.schedulerStore.set("isLoading", !0);
|
|
202
|
-
const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i } = this.schedulerStore.state;
|
|
217
|
+
const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: n } = this.schedulerStore.state;
|
|
203
218
|
if (!e && !i)
|
|
204
219
|
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
|
|
205
220
|
const r = (e == null ? void 0 : e.timeslot) || t;
|
|
206
221
|
if (!r)
|
|
207
222
|
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
223
|
+
const o = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s;
|
|
224
|
+
if (!o)
|
|
210
225
|
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
|
|
211
|
-
const
|
|
212
|
-
let
|
|
213
|
-
if (
|
|
214
|
-
const
|
|
215
|
-
for (let
|
|
216
|
-
if (
|
|
217
|
-
|
|
226
|
+
const u = this.schedulerStore.get("availabilityOrderEmails");
|
|
227
|
+
let g = "";
|
|
228
|
+
if (u.length > 0) {
|
|
229
|
+
const m = r.emails;
|
|
230
|
+
for (let p = 0; p < u.length; p++)
|
|
231
|
+
if (m.includes(u[p])) {
|
|
232
|
+
g = u[p];
|
|
218
233
|
break;
|
|
219
234
|
}
|
|
220
235
|
}
|
|
221
|
-
const
|
|
222
|
-
participants:
|
|
223
|
-
additional_fields:
|
|
224
|
-
additional_guests:
|
|
225
|
-
guest: { ...
|
|
236
|
+
const l = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, v = 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(), h = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, c = await this.makeAPIRequest(decodeURIComponent(h), "POST", JSON.stringify({
|
|
237
|
+
participants: g ? [{ email: g }] : void 0,
|
|
238
|
+
additional_fields: f,
|
|
239
|
+
additional_guests: v,
|
|
240
|
+
guest: { ...l },
|
|
226
241
|
start_time: r.start_time.getTime() / 1e3,
|
|
227
242
|
end_time: r.end_time.getTime() / 1e3,
|
|
228
|
-
timezone:
|
|
229
|
-
|
|
230
|
-
|
|
243
|
+
timezone: o,
|
|
244
|
+
email_language: this.getTwoLetterLanguageCode(n)
|
|
245
|
+
}), _);
|
|
246
|
+
if ("error" in c) {
|
|
231
247
|
this.schedulerStore.set("isLoading", !1);
|
|
232
|
-
const
|
|
233
|
-
let
|
|
234
|
-
if (
|
|
235
|
-
const
|
|
236
|
-
|
|
248
|
+
const m = (I = c.error) == null ? void 0 : I.type;
|
|
249
|
+
let p = c.error;
|
|
250
|
+
if (m && m in this.errors.api("Create Booking")) {
|
|
251
|
+
const L = this.getErrorMessage(p);
|
|
252
|
+
p = this.errors.api("Create Booking")[m](L);
|
|
237
253
|
}
|
|
238
|
-
return { error:
|
|
254
|
+
return { error: p };
|
|
239
255
|
}
|
|
240
|
-
return "data" in
|
|
256
|
+
return "data" in c && this.schedulerStore.set("eventInfo", c == null ? void 0 : c.data), this.schedulerStore.set("isLoading", !1), c;
|
|
241
257
|
}
|
|
242
258
|
async getUISettings() {
|
|
243
|
-
var
|
|
259
|
+
var n;
|
|
244
260
|
this.schedulerStore.set("isLoading", !0);
|
|
245
|
-
const e = this.getHeaders(), s = `/v3/scheduling/ui-settings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : ""}`, i = await this.makeAPIRequest(s, "GET", void 0, e);
|
|
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);
|
|
246
262
|
if ("error" in i) {
|
|
247
263
|
this.schedulerStore.set("isLoading", !1);
|
|
248
|
-
const
|
|
264
|
+
const r = (n = i.error) == null ? void 0 : n.type;
|
|
249
265
|
let o = i.error;
|
|
250
|
-
return
|
|
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 };
|
|
251
267
|
}
|
|
252
268
|
return "data" in i && this.schedulerStore.set("configSettings", i.data), this.schedulerStore.set("isLoading", !1), i;
|
|
253
269
|
}
|
|
270
|
+
getTwoLetterLanguageCode(e) {
|
|
271
|
+
return e.split("-")[0];
|
|
272
|
+
}
|
|
254
273
|
getStartTimeWithMinBookingNotice(e) {
|
|
255
274
|
var i;
|
|
256
275
|
const t = (i = this.schedulerStore.get("configSettings")) == null ? void 0 : i.scheduler, s = t == null ? void 0 : t.min_booking_notice;
|
|
257
276
|
return s ? e + s * 60 : e;
|
|
258
277
|
}
|
|
259
278
|
getEndTimeForAvailableDaysInFuture(e) {
|
|
260
|
-
var
|
|
261
|
-
const t = /* @__PURE__ */ new Date(), s = (o = (
|
|
279
|
+
var r, o;
|
|
280
|
+
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);
|
|
262
281
|
return Math.min(i, e);
|
|
263
282
|
}
|
|
264
283
|
async getAvailability(e = 0, t = 0) {
|
|
265
|
-
var
|
|
284
|
+
var v, f, _, S;
|
|
266
285
|
this.schedulerStore.set("isLoading", !0);
|
|
267
|
-
const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(),
|
|
268
|
-
if (t && t <
|
|
286
|
+
const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), n = i.getTime();
|
|
287
|
+
if (t && t < n / 1e3)
|
|
269
288
|
return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
|
|
270
289
|
if (!e) {
|
|
271
|
-
const
|
|
272
|
-
e = Math.floor(
|
|
290
|
+
const h = new Date(i.getFullYear(), i.getMonth(), 1);
|
|
291
|
+
e = Math.floor(h.getTime() / 1e3);
|
|
273
292
|
}
|
|
274
293
|
if (e = this.getStartTimeWithMinBookingNotice(e), !t) {
|
|
275
|
-
const
|
|
276
|
-
t = Math.floor(
|
|
294
|
+
const h = new Date(i.getFullYear(), i.getMonth() + 1, 0);
|
|
295
|
+
t = Math.floor(h.getTime() / 1e3);
|
|
277
296
|
}
|
|
278
|
-
t = this.getEndTimeForAvailableDaysInFuture(t), s.append("start_time", encodeURIComponent(e.toString())), s.append("end_time", encodeURIComponent(t.toString())), this.configId && !this.sessionId
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
const o = s.toString(), u = `/v3/scheduling/availability${o ? `?${o}` : ""}`,
|
|
282
|
-
if ("error" in
|
|
297
|
+
t = this.getEndTimeForAvailableDaysInFuture(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)));
|
|
298
|
+
const r = this.schedulerStore.get("rescheduleBookingId");
|
|
299
|
+
r && s.append("booking_id", encodeURIComponent(r));
|
|
300
|
+
const o = s.toString(), u = `/v3/scheduling/availability${o ? `?${o}` : ""}`, g = this.getHeaders(), l = await this.makeAPIRequest(decodeURIComponent(u), "GET", void 0, g);
|
|
301
|
+
if ("error" in l) {
|
|
283
302
|
this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
|
|
284
|
-
const
|
|
285
|
-
let
|
|
286
|
-
if (
|
|
287
|
-
const
|
|
288
|
-
|
|
303
|
+
const h = (v = l.error) == null ? void 0 : v.type;
|
|
304
|
+
let c = l.error;
|
|
305
|
+
if (h && h in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
|
|
306
|
+
const I = this.getErrorMessage(c);
|
|
307
|
+
c = this.errors.api(d.t("getAvailabilityErrorTitle"))[h](I);
|
|
289
308
|
}
|
|
290
|
-
return { error:
|
|
309
|
+
return { error: c };
|
|
291
310
|
}
|
|
292
|
-
if ("data" in
|
|
293
|
-
const
|
|
294
|
-
...
|
|
295
|
-
start_time: new Date(
|
|
296
|
-
end_time: new Date(
|
|
297
|
-
}))) || []).filter((
|
|
298
|
-
this.schedulerStore.set("availability",
|
|
299
|
-
const
|
|
300
|
-
this.schedulerStore.set("availabilityOrderEmails",
|
|
311
|
+
if ("data" in l) {
|
|
312
|
+
const c = (((_ = (f = l.data) == null ? void 0 : f.time_slots) == null ? void 0 : _.map((m) => ({
|
|
313
|
+
...m,
|
|
314
|
+
start_time: new Date(m.start_time * 1e3),
|
|
315
|
+
end_time: new Date(m.end_time * 1e3)
|
|
316
|
+
}))) || []).filter((m) => m.start_time.getTime() > n);
|
|
317
|
+
this.schedulerStore.set("availability", c);
|
|
318
|
+
const I = ((S = l.data) == null ? void 0 : S.order) || [];
|
|
319
|
+
this.schedulerStore.set("availabilityOrderEmails", I);
|
|
301
320
|
}
|
|
302
|
-
return this.schedulerStore.set("isLoading", !1),
|
|
321
|
+
return this.schedulerStore.set("isLoading", !1), l;
|
|
303
322
|
}
|
|
304
323
|
async cancelBooking(e, t) {
|
|
305
324
|
var o;
|
|
306
325
|
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
307
326
|
return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
|
|
308
|
-
const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : "", i = `/v3/scheduling/bookings/${e}${s}`,
|
|
327
|
+
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({
|
|
309
328
|
action: "cancel",
|
|
310
329
|
cancellation_reason: t
|
|
311
|
-
}),
|
|
312
|
-
if ("error" in
|
|
330
|
+
}), n);
|
|
331
|
+
if ("error" in r) {
|
|
313
332
|
this.schedulerStore.set("isLoading", !1);
|
|
314
|
-
const u = (o =
|
|
315
|
-
let
|
|
333
|
+
const u = (o = r.error) == null ? void 0 : o.type;
|
|
334
|
+
let g = r.error;
|
|
316
335
|
if (u && u in this.errors.api(d.t("cancelBookingErrorTitle"))) {
|
|
317
|
-
const
|
|
318
|
-
|
|
336
|
+
const l = this.getErrorMessage(g);
|
|
337
|
+
g = this.errors.api(d.t("cancelBookingErrorTitle"))[u](l);
|
|
319
338
|
}
|
|
320
|
-
return { error:
|
|
339
|
+
return { error: g };
|
|
321
340
|
}
|
|
322
341
|
return this.schedulerStore.set("cancelledEventInfo", {
|
|
323
342
|
booking_id: e
|
|
324
|
-
}), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1),
|
|
343
|
+
}), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), r;
|
|
325
344
|
}
|
|
326
345
|
async rescheduleBooking(e, t) {
|
|
327
346
|
var E;
|
|
328
347
|
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
329
348
|
return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
|
|
330
|
-
const s = this.errors.api(d.t("rescheduleBookingErrorTitle")), i = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo:
|
|
331
|
-
if (!
|
|
349
|
+
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: g, endTime: l, timezone: v } = t, f = g || (r == null ? void 0 : r.start_time);
|
|
350
|
+
if (!f)
|
|
332
351
|
return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
352
|
+
const _ = l || (r == null ? void 0 : r.end_time);
|
|
353
|
+
if (!_)
|
|
335
354
|
return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
336
|
-
const
|
|
337
|
-
let
|
|
338
|
-
if (
|
|
339
|
-
const T = (
|
|
340
|
-
for (let
|
|
341
|
-
if (T.includes(
|
|
342
|
-
|
|
355
|
+
const S = this.schedulerStore.get("availabilityOrderEmails");
|
|
356
|
+
let h = "";
|
|
357
|
+
if (S.length > 0) {
|
|
358
|
+
const T = (r == null ? void 0 : r.emails) || [];
|
|
359
|
+
for (let k = 0; k < S.length; k++)
|
|
360
|
+
if (T.includes(S[k])) {
|
|
361
|
+
h = S[k];
|
|
343
362
|
break;
|
|
344
363
|
}
|
|
345
364
|
}
|
|
346
|
-
const
|
|
347
|
-
if (!
|
|
365
|
+
const c = v || o;
|
|
366
|
+
if (!c)
|
|
348
367
|
return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
|
|
349
|
-
const
|
|
350
|
-
start_time:
|
|
351
|
-
end_time:
|
|
352
|
-
|
|
353
|
-
additional_fields:
|
|
354
|
-
guest: { ...
|
|
355
|
-
additional_guests:
|
|
356
|
-
participants:
|
|
357
|
-
|
|
358
|
-
|
|
368
|
+
const I = t ? t == null ? void 0 : t.primaryParticipant : n == null ? void 0 : n.primaryParticipant, m = t ? (t == null ? void 0 : t.guests) || [] : (n == null ? void 0 : n.guests) || [], p = 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}` : "", P = `/v3/scheduling/bookings/${e}${L}`, z = this.getHeaders(), y = await this.makeAPIRequest(decodeURIComponent(P), "PATCH", JSON.stringify({
|
|
369
|
+
start_time: f.getTime() / 1e3,
|
|
370
|
+
end_time: _.getTime() / 1e3,
|
|
371
|
+
timezone: c,
|
|
372
|
+
additional_fields: p,
|
|
373
|
+
guest: { ...I },
|
|
374
|
+
additional_guests: m,
|
|
375
|
+
participants: h ? [{ email: h }] : void 0,
|
|
376
|
+
email_language: this.getTwoLetterLanguageCode(u)
|
|
377
|
+
}), z);
|
|
378
|
+
if ("error" in y) {
|
|
359
379
|
this.schedulerStore.set("isLoading", !1);
|
|
360
|
-
const T = (E =
|
|
361
|
-
let
|
|
380
|
+
const T = (E = y.error) == null ? void 0 : E.type;
|
|
381
|
+
let k = y.error;
|
|
362
382
|
if (T && T in s) {
|
|
363
|
-
const M = this.getErrorMessage(
|
|
364
|
-
|
|
383
|
+
const M = this.getErrorMessage(k);
|
|
384
|
+
k = s[T](M);
|
|
365
385
|
}
|
|
366
|
-
return { error:
|
|
386
|
+
return { error: k };
|
|
367
387
|
}
|
|
368
|
-
const
|
|
369
|
-
if ("data" in
|
|
370
|
-
this.schedulerStore.set("eventInfo",
|
|
371
|
-
else if (
|
|
372
|
-
this.schedulerStore.set("eventInfo",
|
|
388
|
+
const B = this.schedulerStore.get("reschedulingEventInfo");
|
|
389
|
+
if ("data" in y)
|
|
390
|
+
this.schedulerStore.set("eventInfo", y == null ? void 0 : y.data);
|
|
391
|
+
else if (B)
|
|
392
|
+
this.schedulerStore.set("eventInfo", B);
|
|
373
393
|
else {
|
|
374
394
|
const T = {
|
|
375
395
|
booking_id: e
|
|
376
396
|
};
|
|
377
397
|
this.schedulerStore.set("eventInfo", T);
|
|
378
398
|
}
|
|
379
|
-
return this.schedulerStore.set("isLoading", !1),
|
|
399
|
+
return this.schedulerStore.set("isLoading", !1), y;
|
|
400
|
+
}
|
|
401
|
+
async updateBooking(e) {
|
|
402
|
+
var v;
|
|
403
|
+
this.schedulerStore.set("isLoading", !0);
|
|
404
|
+
const { bookingId: t, status: s, reason: i } = e, n = this.schedulerStore.get("organizerConfirmationSalt"), r = s === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
|
|
405
|
+
if (!t)
|
|
406
|
+
return { error: this.errors.component(r).no_booking_id() };
|
|
407
|
+
if (!n)
|
|
408
|
+
return { error: this.errors.component(r).no_salt() };
|
|
409
|
+
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}`, g = this.getHeaders(), l = await this.makeAPIRequest(decodeURIComponent(u), "PUT", JSON.stringify({
|
|
410
|
+
status: s,
|
|
411
|
+
cancellation_reason: i,
|
|
412
|
+
salt: n
|
|
413
|
+
}), g);
|
|
414
|
+
if ("error" in l) {
|
|
415
|
+
this.schedulerStore.set("isLoading", !1);
|
|
416
|
+
const f = (v = l.error) == null ? void 0 : v.type;
|
|
417
|
+
let _ = l.error;
|
|
418
|
+
if (f && f in this.errors.api(r)) {
|
|
419
|
+
const S = this.getErrorMessage(_);
|
|
420
|
+
_ = this.errors.api(r)[f](S);
|
|
421
|
+
}
|
|
422
|
+
return { error: _ };
|
|
423
|
+
}
|
|
424
|
+
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", {
|
|
425
|
+
booking_id: t
|
|
426
|
+
}), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), l;
|
|
380
427
|
}
|
|
381
428
|
}
|
|
382
429
|
function N(a = {}) {
|
|
@@ -398,16 +445,16 @@ function N(a = {}) {
|
|
|
398
445
|
...a
|
|
399
446
|
};
|
|
400
447
|
b("[defaultNylasStoreState]: ", e);
|
|
401
|
-
const t =
|
|
448
|
+
const t = $(e);
|
|
402
449
|
return t.onChange("availability", (s) => {
|
|
403
450
|
b("[availability]: ", s);
|
|
404
451
|
const i = s.map((o) => o.start_time);
|
|
405
452
|
b("[selectableDates]: ", i), t.set("selectableDates", i);
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
453
|
+
const n = s[0];
|
|
454
|
+
if (!n)
|
|
408
455
|
return;
|
|
409
|
-
const
|
|
410
|
-
b("[durationMinutes]: ",
|
|
456
|
+
const r = Math.floor((n.end_time.getTime() - n.start_time.getTime()) / 6e4);
|
|
457
|
+
b("[durationMinutes]: ", r), t.set("eventDuration", r);
|
|
411
458
|
}), t.reset = () => {
|
|
412
459
|
for (const s in e) {
|
|
413
460
|
const i = e[s];
|
|
@@ -417,6 +464,6 @@ function N(a = {}) {
|
|
|
417
464
|
}
|
|
418
465
|
export {
|
|
419
466
|
N as C,
|
|
420
|
-
|
|
421
|
-
|
|
467
|
+
w as E,
|
|
468
|
+
U as N
|
|
422
469
|
};
|
package/dist/{textarea-component.entry-788eb37a.cjs → textarea-component.entry-8bdfbcc9.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-a3051853.cjs"),r=require("./index-6d9eeb53-cac6eaea.cjs");require("./index-53420959-78cc8138.cjs");require("react");require("react-dom");const l=':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}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=l,t=class{constructor(e){a.registerInstance(this,e),this.nylasFormInputChanged=a.createEvent(this,"nylasFormInputChanged",7),this.name="textarea",this.defaultValue="",this.label="",this.placeholder="",this.required=!1,this.readOnly=!1,this.autoFocus=!1,this.maxLength=255,this.type="multi_line_text",this.value="",this.error=""}componentWillLoad(){this.value=r.sanitizeHtml$1(this.defaultValue)}handleBookingFormSubmitted(e){this.validate(this.value),this.error&&e.preventDefault()}handleInput(e){const s=e.target;this.value=r.sanitizeHtml$1(s.value),this.nylasFormInputChanged.emit({value:this.value,name:this.name,error:this.error,label:this.label,type:this.type})}validate(e){this.required&&!e?this.error=`${this.label} is required.`:e.length>this.maxLength?this.error=`${this.label} cannot exceed ${this.maxLength} characters.`:this.error=""}render(){return a.h("label",{key:"fe4040d95428005b4d9cf6d3addeb50e60d2a28d",part:"tc__label",class:{error:!!this.error}},a.h("p",{key:"a93a555a602c45f351a2ebe0a37e5b538570014a"},a.h("span",{key:"5966b8abd773eca6b6d1005a68e75d76e446e6ca",class:"label"},this.label),this.required&&a.h("span",{class:"required"},"*")),a.h("textarea",{key:"5d8d2aa5a3fc5afd34b6dbfb2cfbe4805c44b6dd",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.h("span",{class:"error help-text"},this.error))}};t.style=n;exports.textarea_component=t;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as t, c as l, h as a } from "./index-
|
|
2
|
-
import { s as r } from "./index-6d9eeb53-
|
|
3
|
-
import "./index-53420959-
|
|
1
|
+
import { r as t, c as l, h as a } from "./index-eca7f3e2.js";
|
|
2
|
+
import { s as r } from "./index-6d9eeb53-407c797a.js";
|
|
3
|
+
import "./index-53420959-da9158f8.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-dom";
|
|
6
6
|
const n = ':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}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}', i = n, o = class {
|
|
@@ -27,7 +27,7 @@ const n = ':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--n
|
|
|
27
27
|
this.required && !e ? this.error = `${this.label} is required.` : e.length > this.maxLength ? this.error = `${this.label} cannot exceed ${this.maxLength} characters.` : this.error = "";
|
|
28
28
|
}
|
|
29
29
|
render() {
|
|
30
|
-
return a("label", { key: "
|
|
30
|
+
return a("label", { key: "fe4040d95428005b4d9cf6d3addeb50e60d2a28d", part: "tc__label", class: { error: !!this.error } }, a("p", { key: "a93a555a602c45f351a2ebe0a37e5b538570014a" }, a("span", { key: "5966b8abd773eca6b6d1005a68e75d76e446e6ca", class: "label" }, this.label), this.required && a("span", { class: "required" }, "*")), a("textarea", { key: "5d8d2aa5a3fc5afd34b6dbfb2cfbe4805c44b6dd", 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));
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
o.style = i;
|