@nylas/react 1.1.2 → 1.1.4
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-6753bd65.js +25 -0
- package/dist/add-circle-icon_2.entry-cd9a7f37.cjs +1 -0
- package/dist/archive-icon.entry-434d1696.js +15 -0
- package/dist/archive-icon.entry-7cb1c265.cjs +1 -0
- package/dist/arrow-icon.entry-20b50784.js +15 -0
- package/dist/{arrow-icon.entry-a924df13.cjs → arrow-icon.entry-83c3105b.cjs} +1 -1
- package/dist/bold-icon.entry-0e3d84e1.cjs +1 -0
- package/dist/bold-icon.entry-34b18d0d.js +15 -0
- package/dist/{button-component_2.entry-b9d3f6a2.cjs → button-component_2.entry-54101987.cjs} +1 -1
- package/dist/{button-component_2.entry-93aa59a2.js → button-component_2.entry-8a5e99da.js} +7 -7
- package/dist/calendar-agenda-fill-icon_51.entry-1920adc2.cjs +7 -0
- package/dist/{calendar-agenda-fill-icon_48.entry-476bc4ef.js → calendar-agenda-fill-icon_51.entry-a351dca5.js} +997 -917
- package/dist/{calendar-cancel-icon.entry-11bb8656.cjs → calendar-cancel-icon.entry-00756264.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-ee0acc54.js → calendar-cancel-icon.entry-f83e9b41.js} +2 -2
- package/dist/{calendar-check-icon_2.entry-54a82e1e.js → calendar-check-icon_2.entry-1817540c.js} +7 -7
- package/dist/{calendar-check-icon_2.entry-14548656.cjs → calendar-check-icon_2.entry-6ac948fc.cjs} +1 -1
- package/dist/{calendar-icon.entry-29f7003b.js → calendar-icon.entry-362428bf.js} +4 -4
- package/dist/{calendar-icon.entry-1a17f887.cjs → calendar-icon.entry-68e53f52.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-dfec10cb.js → checkbox-component_2.entry-0d7c1916.js} +3 -3
- package/dist/{checkbox-component_2.entry-84a17232.cjs → checkbox-component_2.entry-5ce9807d.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-826e81d4.js → chevron-icon_3.entry-37c087a7.js} +8 -8
- package/dist/{chevron-icon_3.entry-5da08d02.cjs → chevron-icon_3.entry-89c52603.cjs} +1 -1
- package/dist/{clock-icon_4.entry-36d97f00.js → clock-icon_4.entry-2e78febe.js} +11 -11
- package/dist/{clock-icon_4.entry-dafdd895.cjs → clock-icon_4.entry-496058ef.cjs} +1 -1
- package/dist/{constants-50c3e067-fed7fb48.js → constants-c31dccfe-04b9cd8a.js} +2 -2
- package/dist/{constants-50c3e067-1fe54cf3.cjs → constants-c31dccfe-1a739653.cjs} +2 -2
- package/dist/{copy-icon.entry-6d1a649d.js → copy-icon.entry-6d4e05b0.js} +7 -7
- package/dist/{copy-icon.entry-eec265da.cjs → copy-icon.entry-a1baee33.cjs} +1 -1
- package/dist/delete-icon.entry-e98b336e.cjs +1 -0
- package/dist/delete-icon.entry-ea06b42a.js +15 -0
- package/dist/document-refresh-icon.entry-09750b52.cjs +1 -0
- package/dist/document-refresh-icon.entry-afae6621.js +15 -0
- package/dist/elements/index.d.ts +2 -11
- package/dist/feedbackSync-ab657d65-e650e46d.cjs +448 -0
- package/dist/feedbackSync-ab657d65-e8b7c001.js +6035 -0
- package/dist/folder-icon.entry-5c3f4e8f.cjs +1 -0
- package/dist/folder-icon.entry-6096fbf4.js +15 -0
- package/dist/forward-icon.entry-4089e3bb.cjs +1 -0
- package/dist/forward-icon.entry-da319c05.js +15 -0
- package/dist/{globe-icon.entry-154ccdb5.js → globe-icon.entry-59f4c2f9.js} +4 -4
- package/dist/{globe-icon.entry-95fc0408.cjs → globe-icon.entry-e8ca972e.cjs} +1 -1
- package/dist/{google-logo-icon_4.entry-68cfa3fe.js → google-logo-icon_4.entry-d4b8926f.js} +331 -289
- package/dist/google-logo-icon_4.entry-e2001f83.cjs +1 -0
- package/dist/inbox-icon.entry-70dae5ec.js +15 -0
- package/dist/inbox-icon.entry-80ee9082.cjs +1 -0
- package/dist/index-6b9d4b01.cjs +81 -0
- package/dist/{index-1322d804.js → index-e475e0c0.js} +3126 -3103
- package/dist/index.d.ts +1 -1
- package/dist/{index.es-79f5b771-08cc349d.cjs → index.es-b475d61f-68a74a28.cjs} +5 -5
- package/dist/{index.es-79f5b771-04cd3414.js → index.es-b475d61f-bfa2cba2.js} +125 -131
- package/dist/{info-icon_2.entry-49261a0a.js → info-icon_2.entry-2bb60213.js} +3 -3
- package/dist/{info-icon_2.entry-2af880b8.cjs → info-icon_2.entry-f1b1dfba.cjs} +1 -1
- package/dist/{input-color-picker.entry-aefe0e26.js → input-color-picker.entry-5ae45a9e.js} +3 -3
- package/dist/{input-color-picker.entry-57adff77.cjs → input-color-picker.entry-b669f7fb.cjs} +1 -1
- package/dist/{input-component.entry-d7c2724b.js → input-component.entry-cb958501.js} +2 -2
- package/dist/{input-component.entry-09c3c9b6.cjs → input-component.entry-eeb95361.cjs} +1 -1
- package/dist/{input-dropdown.entry-e7d26273.cjs → input-dropdown.entry-0b458f68.cjs} +1 -1
- package/dist/{input-dropdown.entry-e573ade0.js → input-dropdown.entry-962605f8.js} +4 -4
- package/dist/italic-icon.entry-4a89e289.cjs +1 -0
- package/dist/italic-icon.entry-5be07509.js +15 -0
- package/dist/{multi-select-dropdown.entry-15cacb87.js → multi-select-dropdown.entry-3084e1fc.js} +5 -5
- package/dist/{multi-select-dropdown.entry-46b2b1c9.cjs → multi-select-dropdown.entry-a66408a2.cjs} +1 -1
- package/dist/nylas-booked-event-card_12.entry-227ccf31.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-3921071a.js → nylas-booked-event-card_12.entry-29e2a4b1.js} +84 -81
- package/dist/{nylas-form-card.entry-ca835017.js → nylas-form-card.entry-33b4c295.js} +15 -15
- package/dist/{nylas-form-card.entry-db3f0e3b.cjs → nylas-form-card.entry-8465eccf.cjs} +1 -1
- package/dist/{nylas-if-state.entry-4159d41d.js → nylas-if-state.entry-9d96fc87.js} +2 -2
- package/dist/{nylas-if-state.entry-5410607c.cjs → nylas-if-state.entry-adb6103a.cjs} +1 -1
- package/dist/{nylas-login.entry-590e7fba.js → nylas-login.entry-3f7c195e.js} +7 -7
- package/dist/{nylas-login.entry-f1d7bc7d.cjs → nylas-login.entry-78b968d1.cjs} +1 -1
- package/dist/nylas-provider.entry-19635620.js +264 -0
- package/dist/nylas-provider.entry-b918d0f6.cjs +1 -0
- package/dist/nylas-reminder-emails.entry-ec79b757.js +168 -0
- package/dist/nylas-reminder-emails.entry-ee76db24.cjs +4 -0
- package/dist/{nylas-reminder-time_2.entry-0357f280.js → nylas-reminder-time_2.entry-105de2d0.js} +42 -39
- package/dist/nylas-reminder-time_2.entry-83ecc1d4.cjs +1 -0
- package/dist/{nylas-scheduler-editor.entry-d2c3bddc.cjs → nylas-scheduler-editor.entry-cfed7ae2.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-6bb290ed.js → nylas-scheduler-editor.entry-e848771f.js} +7 -7
- package/dist/nylas-scheduling.entry-da987c02.js +400 -0
- package/dist/nylas-scheduling.entry-e989cf9e.cjs +1 -0
- package/dist/{nylas-time-window-picker.entry-1b449403.cjs → nylas-time-window-picker.entry-1f76b577.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-260f52a6.js → nylas-time-window-picker.entry-3c6b29d9.js} +20 -20
- package/dist/{person-icon.entry-ed6786db.js → person-icon.entry-79fcd9fb.js} +4 -4
- package/dist/{person-icon.entry-b4ce06b7.cjs → person-icon.entry-82bbb87c.cjs} +1 -1
- package/dist/play-icon.entry-3f357ea4.cjs +1 -0
- package/dist/play-icon.entry-97b40470.js +15 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +109 -118
- package/dist/{refresh-icon.entry-87af05b0.js → refresh-icon.entry-1427a5e6.js} +5 -5
- package/dist/{refresh-icon.entry-21ac359d.cjs → refresh-icon.entry-7ce5ec90.cjs} +1 -1
- package/dist/{register-component-ea95564d-a64ee107.cjs → register-component-679c1308-b5a96acf.cjs} +1 -1
- package/dist/{register-component-ea95564d-843da1da.js → register-component-679c1308-de697ecb.js} +1 -1
- package/dist/reply-all-icon.entry-cf8114db.cjs +1 -0
- package/dist/reply-all-icon.entry-f1165660.js +15 -0
- package/dist/reply-icon.entry-3a601cff.js +15 -0
- package/dist/reply-icon.entry-3db337c9.cjs +1 -0
- package/dist/{scheduler-config-store-2a3b403d-8553b685.js → scheduler-config-store-2a3b403d-e5210f72.js} +1 -1
- package/dist/{scheduler-config-store-2a3b403d-88840eb1.cjs → scheduler-config-store-2a3b403d-e6f5bcab.cjs} +1 -1
- package/dist/scheduler-store-908886c8-62d14677.cjs +1 -0
- package/dist/{scheduler-store-9ff4914b-d1a624f8.js → scheduler-store-908886c8-b0f43cb9.js} +2 -2
- package/dist/sent-icon.entry-2c7bd48e.js +15 -0
- package/dist/sent-icon.entry-708b9a2b.cjs +1 -0
- package/dist/spam-icon.entry-3106ed3d.js +15 -0
- package/dist/spam-icon.entry-fa8b80c6.cjs +1 -0
- package/dist/star-icon.entry-88501c8b.cjs +1 -0
- package/dist/star-icon.entry-b15601ca.js +15 -0
- package/dist/stop-icon.entry-3475e257.cjs +1 -0
- package/dist/stop-icon.entry-f926a8db.js +15 -0
- package/dist/{textarea-component.entry-cbffb0b0.cjs → textarea-component.entry-683c2959.cjs} +1 -1
- package/dist/{textarea-component.entry-dad42f20.js → textarea-component.entry-d1f4dd9a.js} +2 -2
- package/dist/{time-period-selector.entry-e54d0989.cjs → time-period-selector.entry-8cfdf750.cjs} +1 -1
- package/dist/{time-period-selector.entry-79c94da3.js → time-period-selector.entry-e97f86fd.js} +2 -2
- package/dist/{translate-icon.entry-ef6266c4.js → translate-icon.entry-09c5574f.js} +2 -2
- package/dist/{translate-icon.entry-8e9eeeba.cjs → translate-icon.entry-5757c37c.cjs} +1 -1
- package/dist/trash-fill-icon.entry-470ec1ff.js +15 -0
- package/dist/trash-fill-icon.entry-4bbfabcc.cjs +1 -0
- package/dist/underline-icon.entry-6d729068.cjs +1 -0
- package/dist/underline-icon.entry-9fe74ba7.js +15 -0
- package/dist/{warning-icon.entry-34c85de2.cjs → warning-icon.entry-c1d48318.cjs} +1 -1
- package/dist/{warning-icon.entry-adf18211.js → warning-icon.entry-d924f8f9.js} +5 -5
- package/package.json +2 -2
- package/dist/add-circle-icon_2.entry-611be49d.js +0 -25
- package/dist/add-circle-icon_2.entry-f1383568.cjs +0 -1
- package/dist/archive-icon_7.entry-59cc6868.cjs +0 -1
- package/dist/archive-icon_7.entry-5e6ba9e7.js +0 -75
- package/dist/arrow-icon.entry-9c19a803.js +0 -15
- package/dist/bold-icon_3.entry-2935a3df.js +0 -35
- package/dist/bold-icon_3.entry-ffe02f93.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_48.entry-c4ea84b3.cjs +0 -7
- package/dist/delete-icon_2.entry-160ba41e.cjs +0 -1
- package/dist/delete-icon_2.entry-528a3879.js +0 -25
- package/dist/document-refresh-icon.entry-276704dc.cjs +0 -1
- package/dist/document-refresh-icon.entry-6565f3b5.js +0 -15
- package/dist/elements-dc5b338e-2d3857dc.js +0 -28031
- package/dist/elements-dc5b338e-b06b2857.cjs +0 -16516
- package/dist/flow-40ff9cea-6f8c30e2.cjs +0 -9
- package/dist/flow-40ff9cea-ee70fdf5.js +0 -505
- package/dist/focus-visible-e8093c16-47e61336.cjs +0 -1
- package/dist/focus-visible-e8093c16-6f68eb89.js +0 -84
- package/dist/forward-icon_6.entry-ed6ab66a.js +0 -953
- package/dist/forward-icon_6.entry-fed8994d.cjs +0 -3
- package/dist/google-logo-icon_4.entry-afffb209.cjs +0 -1
- package/dist/index-c4e817ef.cjs +0 -82
- package/dist/mailbox-store-9c52a3fa-27f8f7e6.js +0 -380
- package/dist/mailbox-store-9c52a3fa-6b39645f.cjs +0 -1
- package/dist/nylas-booked-event-card_12.entry-47c5381d.cjs +0 -1
- package/dist/nylas-list-folders.entry-0f143930.cjs +0 -1
- package/dist/nylas-list-folders.entry-6b4a3d96.js +0 -120
- package/dist/nylas-list-threads.entry-62108562.js +0 -70
- package/dist/nylas-list-threads.entry-68b6f32b.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-8377fdee.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-ba1af8fb.js +0 -101
- package/dist/nylas-mailbox-toolbar-button.entry-4497acd0.js +0 -82
- package/dist/nylas-mailbox-toolbar-button.entry-6a5d8387.cjs +0 -1
- package/dist/nylas-mailbox.entry-917c22f5.js +0 -134
- package/dist/nylas-mailbox.entry-a07652b4.cjs +0 -1
- package/dist/nylas-provider.entry-0e520ac3.cjs +0 -1
- package/dist/nylas-provider.entry-20c47b14.js +0 -145
- package/dist/nylas-reminder-emails.entry-088ee120.js +0 -129
- package/dist/nylas-reminder-emails.entry-69626e7f.cjs +0 -4
- package/dist/nylas-reminder-time_2.entry-b5c181db.cjs +0 -1
- package/dist/nylas-scheduling.entry-bc9c25c5.js +0 -359
- package/dist/nylas-scheduling.entry-dc92d5e7.cjs +0 -1
- package/dist/nylas-threads-refresh.entry-45d7d171.js +0 -74
- package/dist/nylas-threads-refresh.entry-6636e7b1.cjs +0 -1
- package/dist/nylas-threads-search.entry-4460aa9b.js +0 -69
- package/dist/nylas-threads-search.entry-ae87695a.cjs +0 -1
- package/dist/nylas-view-thread.entry-5821630b.js +0 -203
- package/dist/nylas-view-thread.entry-5a9b353a.cjs +0 -1
- package/dist/play-icon_2.entry-261ea828.js +0 -25
- package/dist/play-icon_2.entry-87fe39a9.cjs +0 -1
- package/dist/scheduler-store-9ff4914b-63dc472a.cjs +0 -1
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { i as u, r as G, c as x, d as F, f as D, j as Y, k as J, h as n, H as C, g as K, F as H } from "./index-e475e0c0.js";
|
|
2
|
+
import { n as L, N as Q } from "./index.es-b475d61f-bfa2cba2.js";
|
|
3
|
+
import { E as z, C as X, N as Z } from "./scheduler-store-908886c8-b0f43cb9.js";
|
|
4
|
+
import { L as V, a as ee } from "./constants-c31dccfe-04b9cd8a.js";
|
|
5
|
+
import { i as te, a as ne, c as ie, b as oe, f as se } from "./feedbackSync-ab657d65-e8b7c001.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
class ae {
|
|
9
|
+
constructor({ schedulerAPIURL: e, nylasSchedulerStore: i, sessionId: a, configId: s, slug: d, clientId: r }) {
|
|
10
|
+
if (!e)
|
|
11
|
+
throw new Error("schedulerAPIURL is required");
|
|
12
|
+
if (!i)
|
|
13
|
+
throw new Error("nylasSchedulerStore is required");
|
|
14
|
+
if (!a && !s && !(d || r))
|
|
15
|
+
throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
|
|
16
|
+
e === "/" && (e = new URL(window.location.href).origin), this.configId = s, this.sessionId = a, this.schedulerAPIURL = e, this.nylasSchedulerStore = i, this.slug = d, this.clientId = r;
|
|
17
|
+
}
|
|
18
|
+
init() {
|
|
19
|
+
F("NylasConnector init");
|
|
20
|
+
}
|
|
21
|
+
get schedulerStore() {
|
|
22
|
+
return this.nylasSchedulerStore;
|
|
23
|
+
}
|
|
24
|
+
get scheduler() {
|
|
25
|
+
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new Z({
|
|
26
|
+
schedulerAPIURL: this.schedulerAPIURL,
|
|
27
|
+
schedulerStore: this.schedulerStore,
|
|
28
|
+
sessionId: this.sessionId,
|
|
29
|
+
configId: this.configId,
|
|
30
|
+
slug: this.slug,
|
|
31
|
+
clientId: this.clientId
|
|
32
|
+
}), this._schedulerAPIConnector);
|
|
33
|
+
}
|
|
34
|
+
resetStores() {
|
|
35
|
+
this.nylasSchedulerStore.reset();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const E = (t, e) => {
|
|
39
|
+
const i = t.isLoading, a = t.showNotification, s = t.nylasBranding;
|
|
40
|
+
return n(
|
|
41
|
+
H,
|
|
42
|
+
null,
|
|
43
|
+
a && n("nylas-notification", null),
|
|
44
|
+
i && n(
|
|
45
|
+
"div",
|
|
46
|
+
{ class: "loading" },
|
|
47
|
+
n(
|
|
48
|
+
"div",
|
|
49
|
+
{ class: "left" },
|
|
50
|
+
n("div", { class: "skeleton" })
|
|
51
|
+
),
|
|
52
|
+
n(
|
|
53
|
+
"div",
|
|
54
|
+
{ class: "right" },
|
|
55
|
+
n("div", { class: "skeleton" }),
|
|
56
|
+
n("div", { class: "skeleton" }),
|
|
57
|
+
n("div", { class: "skeleton" }),
|
|
58
|
+
n("div", { class: "skeleton" }),
|
|
59
|
+
n("div", { class: "skeleton" })
|
|
60
|
+
)
|
|
61
|
+
),
|
|
62
|
+
!i && e,
|
|
63
|
+
n("div", { class: "footer" }, s && n(
|
|
64
|
+
H,
|
|
65
|
+
null,
|
|
66
|
+
"Powered by ",
|
|
67
|
+
n("nylas-logo", null)
|
|
68
|
+
))
|
|
69
|
+
);
|
|
70
|
+
}, W = (t, e) => n("div", { class: "message-banner" }, e), re = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}', de = re, $ = { title: u.t("genericErrorTitle"), type: L.Error, category: z.Component }, le = class {
|
|
71
|
+
constructor(t) {
|
|
72
|
+
G(this, t), this.init = x(this, "init", 7), this.schedulerWillLoad = x(this, "schedulerWillLoad", 7), this.schedulerDidLoad = x(this, "schedulerDidLoad", 7), this.nylasSchedulerError = x(this, "nylasSchedulerError", 7), this.configSettingsLoaded = x(this, "configSettingsLoaded", 7), this.bookingRefExtracted = x(this, "bookingRefExtracted", 7), this.bookedEventInfo = x(this, "bookedEventInfo", 7), this.mode = "app", this.defaultSchedulerState = void 0, this.sessionId = void 0, this.schedulerApiUrl = "https://api.us.nylas.com", this.bookingInfo = void 0, this.rescheduleBookingRef = void 0, this.cancelBookingRef = void 0, this.organizerConfirmationBookingRef = void 0, this.configurationId = void 0, this.slug = void 0, this.clientId = void 0, this.nylasBranding = !0, this.eventOverrides = {}, this.isLoading = void 0, this.themeConfig = void 0, this.localization = void 0, this.showNotification = !0, this.enableUserFeedback = !0, this.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || `${u.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language, this.showFeedbackModal = !1;
|
|
73
|
+
}
|
|
74
|
+
connectedCallback() {
|
|
75
|
+
F("[nylas-scheduler] connectedCallback");
|
|
76
|
+
}
|
|
77
|
+
async componentWillLoad() {
|
|
78
|
+
var s, d;
|
|
79
|
+
F("[nylas-scheduler] Component will load"), this.enableUserFeedback && !te() && ne({
|
|
80
|
+
dsn: "https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",
|
|
81
|
+
release: "1.1.4",
|
|
82
|
+
integrations: (r) => [
|
|
83
|
+
...r.filter((o) => !1),
|
|
84
|
+
se({
|
|
85
|
+
colorScheme: "system",
|
|
86
|
+
autoInject: !1
|
|
87
|
+
})
|
|
88
|
+
],
|
|
89
|
+
autoSessionTracking: !1,
|
|
90
|
+
beforeSend: () => null
|
|
91
|
+
});
|
|
92
|
+
const t = this.schedulerWillLoad.emit(this.host);
|
|
93
|
+
if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(t, this.nylasSchedulerConnector), t.defaultPrevented))
|
|
94
|
+
return;
|
|
95
|
+
this.stores = {
|
|
96
|
+
scheduler: X({
|
|
97
|
+
bookingInfo: this.bookingInfo,
|
|
98
|
+
nylasBranding: this.nylasBranding,
|
|
99
|
+
...this.defaultSchedulerState
|
|
100
|
+
})
|
|
101
|
+
}, this.baseProvider = new Q(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
|
|
102
|
+
let e;
|
|
103
|
+
if (this.rescheduleBookingRef) {
|
|
104
|
+
const [r, o, c] = D(this.rescheduleBookingRef);
|
|
105
|
+
this.refConfigId = r, this.stores.scheduler.set("rescheduleBookingId", o), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: o });
|
|
106
|
+
} else if (this.cancelBookingRef) {
|
|
107
|
+
const [r, o, c] = D(this.cancelBookingRef);
|
|
108
|
+
this.refConfigId = r, this.stores.scheduler.set("cancelBookingId", o), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: o });
|
|
109
|
+
} else if (this.organizerConfirmationBookingRef) {
|
|
110
|
+
const [r, o, c] = D(this.organizerConfirmationBookingRef);
|
|
111
|
+
this.refConfigId = r, this.stores.scheduler.set("organizerConfirmationBookingId", o), this.stores.scheduler.set("organizerConfirmationSalt", c), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: o, salt: c });
|
|
112
|
+
}
|
|
113
|
+
if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(e, this.nylasSchedulerConnector), e.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
114
|
+
return;
|
|
115
|
+
const i = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
|
|
116
|
+
this.nylasSchedulerConnector = new ae({
|
|
117
|
+
schedulerAPIURL: this.schedulerApiUrl,
|
|
118
|
+
sessionId: this.sessionId,
|
|
119
|
+
configId: this.refConfigId,
|
|
120
|
+
slug: this.slug,
|
|
121
|
+
clientId: this.clientId,
|
|
122
|
+
nylasSchedulerStore: i
|
|
123
|
+
});
|
|
124
|
+
const a = this.init.emit(this.host);
|
|
125
|
+
"init" in this.eventOverrides && (await this.eventOverrides.init(a, this.nylasSchedulerConnector), a.defaultPrevented) || ((d = this.baseProvider) == null || d.componentWillLoad(this.nylasSchedulerConnector), this.applyThemeConfig(this.themeConfig));
|
|
126
|
+
}
|
|
127
|
+
async componentDidLoad() {
|
|
128
|
+
var c, y, m, g, p, f, b, I;
|
|
129
|
+
(c = this.baseProvider) == null || c.componentDidLoad();
|
|
130
|
+
const t = this.schedulerDidLoad.emit(this.host);
|
|
131
|
+
if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(t, this.nylasSchedulerConnector), t.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
132
|
+
return;
|
|
133
|
+
this.localizationChanged(this.localization);
|
|
134
|
+
const e = await ((y = this.nylasSchedulerConnector) == null ? void 0 : y.scheduler.getUISettings());
|
|
135
|
+
if (!e || "error" in e) {
|
|
136
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
|
|
137
|
+
return;
|
|
138
|
+
} else {
|
|
139
|
+
"data" in e && ((m = e.data) != null && m.appearance) && console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");
|
|
140
|
+
const h = this.configSettingsLoaded.emit({ settings: e });
|
|
141
|
+
if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(h, this.nylasSchedulerConnector), h.defaultPrevented))
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const i = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), a = (f = (p = i == null ? void 0 : i.get("configSettings")) == null ? void 0 : p.scheduler) == null ? void 0 : f.available_days_in_future, s = i == null ? void 0 : i.get("selectedTimeslot");
|
|
145
|
+
if (s && (s != null && s.start_time)) {
|
|
146
|
+
if (!this.isTimeslotValid(s))
|
|
147
|
+
return;
|
|
148
|
+
if (i != null && i.get("showBookingForm")) {
|
|
149
|
+
i == null || i.set("selectedDate", s.start_time);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const d = i == null ? void 0 : i.get("selectedDate"), r = i == null ? void 0 : i.get("availability");
|
|
154
|
+
let o;
|
|
155
|
+
if (!(r && r.length > 0)) {
|
|
156
|
+
if (d) {
|
|
157
|
+
const { startTime: h, endTime: l, endTimeForAvailableDaysInFuture: v } = this.validateAvailableDaysInFuture(d, a || 30);
|
|
158
|
+
d.getTime() < v * 1e3 && (o = await ((I = this.nylasSchedulerConnector) == null ? void 0 : I.scheduler.getAvailability(h, l)));
|
|
159
|
+
} else {
|
|
160
|
+
const h = /* @__PURE__ */ new Date(), { startTime: l, endTime: v, endTimeForAvailableDaysInFuture: B } = this.validateAvailableDaysInFuture(h, a || 30);
|
|
161
|
+
h.getTime() < B * 1e3 && (o = await ((b = this.nylasSchedulerConnector) == null ? void 0 : b.scheduler.getAvailability(l, v)));
|
|
162
|
+
}
|
|
163
|
+
if ((!o || "error" in o) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(o == null ? void 0 : o.error) }, host: this.host }), !d) {
|
|
164
|
+
let h = /* @__PURE__ */ new Date();
|
|
165
|
+
const l = i == null ? void 0 : i.get("availability").find((v) => new Date(v.start_time) > /* @__PURE__ */ new Date());
|
|
166
|
+
l && (h = l.start_time), i == null || i.set("selectedDate", h);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
componentDisconnected() {
|
|
171
|
+
var t;
|
|
172
|
+
(t = this.baseProvider) == null || t.componentDisconnected();
|
|
173
|
+
}
|
|
174
|
+
bookingInfoChanged(t) {
|
|
175
|
+
var e;
|
|
176
|
+
(e = this.stores) == null || e.scheduler.set("bookingInfo", t);
|
|
177
|
+
}
|
|
178
|
+
rescheduleBookingRefChanged(t) {
|
|
179
|
+
var e, i;
|
|
180
|
+
if (t) {
|
|
181
|
+
const [a, s] = D(t);
|
|
182
|
+
(e = this.stores) == null || e.scheduler.set("rescheduleBookingId", s), this.refConfigId = a, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(a);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
cancelBookingRefChanged(t) {
|
|
186
|
+
var e, i;
|
|
187
|
+
if (t) {
|
|
188
|
+
const [a, s] = D(t);
|
|
189
|
+
(e = this.stores) == null || e.scheduler.set("cancelBookingId", s), this.refConfigId = a, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(a);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
organizerConfirmationBookingRefChanged(t) {
|
|
193
|
+
var e, i;
|
|
194
|
+
if (t) {
|
|
195
|
+
const [a, s] = D(t);
|
|
196
|
+
(e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", s), this.refConfigId = a, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(a);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
localizationChanged(t) {
|
|
200
|
+
t && Object.keys(t).forEach((e) => {
|
|
201
|
+
e in V && (u.addResourceBundle(e, "translation", t[e], !1, !0), this.language = this.language);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
themeConfigChanged(t) {
|
|
205
|
+
this.applyThemeConfig(t);
|
|
206
|
+
}
|
|
207
|
+
languageChanged(t) {
|
|
208
|
+
const e = t.detail;
|
|
209
|
+
this.language = e, u.changeLanguage(e);
|
|
210
|
+
}
|
|
211
|
+
async registerComponentHandler(t) {
|
|
212
|
+
var e;
|
|
213
|
+
(e = this.baseProvider) == null || e.registerComponent(t.detail);
|
|
214
|
+
}
|
|
215
|
+
async unregisterComponentHandler(t) {
|
|
216
|
+
var e;
|
|
217
|
+
(e = this.baseProvider) == null || e.unregisterComponent(t.detail);
|
|
218
|
+
}
|
|
219
|
+
async monthChangedHandler(t) {
|
|
220
|
+
var r, o, c, y, m, g, p;
|
|
221
|
+
const e = t.detail, i = (y = (c = (o = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : o.get("configSettings")) == null ? void 0 : c.scheduler) == null ? void 0 : y.available_days_in_future, { startTime: a, endTime: s, endTimeForAvailableDaysInFuture: d } = this.validateAvailableDaysInFuture(e, i || 30);
|
|
222
|
+
if (a < d && e.getTime() < d * 1e3) {
|
|
223
|
+
const f = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.getAvailability(a, s));
|
|
224
|
+
(!f || "error" in f) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(f == null ? void 0 : f.error) }, host: this.host });
|
|
225
|
+
const b = (g = this.stores) == null ? void 0 : g.scheduler.get("selectableDates");
|
|
226
|
+
b && b.length > 0 && ((p = this.stores) == null || p.scheduler.set("selectedDate", b[0]));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
mapToBookingData(t) {
|
|
230
|
+
var r, o, c;
|
|
231
|
+
const e = (r = this.stores) == null ? void 0 : r.scheduler.get("selectedTimeslot"), i = (o = this.stores) == null ? void 0 : o.scheduler.get("selectedLanguage"), a = (c = this.stores) == null ? void 0 : c.scheduler.get("selectedTimezone"), s = e != null && e.start_time ? new Date(e == null ? void 0 : e.start_time).getTime() / 1e3 : "", d = e != null && e.end_time ? new Date(e == null ? void 0 : e.end_time).getTime() / 1e3 : "";
|
|
232
|
+
return {
|
|
233
|
+
additional_guests: t.guests,
|
|
234
|
+
guest: t.primaryParticipant,
|
|
235
|
+
additional_fields: t.additionalFields,
|
|
236
|
+
start_time: s,
|
|
237
|
+
end_time: d,
|
|
238
|
+
email_language: i,
|
|
239
|
+
timezone: a
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
async bookButtonClickedHandler(t) {
|
|
243
|
+
var m, g, p, f, b, I, h;
|
|
244
|
+
const e = t.detail, i = this.mapToBookingData(e), s = { ...(g = (m = this.nylasSchedulerConnector) == null ? void 0 : m.schedulerStore) == null ? void 0 : g.get("bookingInfo"), ...e };
|
|
245
|
+
(p = this.stores) == null || p.scheduler.set("bookingInfo", s);
|
|
246
|
+
const r = (b = (f = this.nylasSchedulerConnector) == null ? void 0 : f.schedulerStore) == null ? void 0 : b.get("rescheduleBookingId");
|
|
247
|
+
if (r) {
|
|
248
|
+
const l = await ((I = this.nylasSchedulerConnector) == null ? void 0 : I.scheduler.rescheduleBooking(r, e));
|
|
249
|
+
(!l || "error" in l) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(l == null ? void 0 : l.error) }, host: this.host });
|
|
250
|
+
const v = l == null ? void 0 : l.data, B = this.bookedEventInfo.emit({ ...l, data: { ...v, ...i } });
|
|
251
|
+
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(B, this.nylasSchedulerConnector);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const o = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.bookTimeslot(e));
|
|
255
|
+
(!o || "error" in o) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(o == null ? void 0 : o.error) }, host: this.host });
|
|
256
|
+
const c = o == null ? void 0 : o.data, y = this.bookedEventInfo.emit({ ...o, data: { ...c, ...i } });
|
|
257
|
+
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(y, this.nylasSchedulerConnector);
|
|
258
|
+
}
|
|
259
|
+
dateSelectedHandler(t) {
|
|
260
|
+
const e = t.detail;
|
|
261
|
+
this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${u.t("noDateSelected")}`;
|
|
262
|
+
}
|
|
263
|
+
cancelBookedEventErrorHandler(t) {
|
|
264
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
265
|
+
}
|
|
266
|
+
cancelBookedEventValidationErrorHandler(t) {
|
|
267
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
268
|
+
}
|
|
269
|
+
rescheduleBookedEventErrorHandler(t) {
|
|
270
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
271
|
+
}
|
|
272
|
+
confirmBookingErrorHandler(t) {
|
|
273
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
274
|
+
}
|
|
275
|
+
feedbackModalClosedHandler() {
|
|
276
|
+
this.showFeedbackModal = !1;
|
|
277
|
+
}
|
|
278
|
+
feedbackSubmittedHandler(t) {
|
|
279
|
+
const i = {
|
|
280
|
+
eventId: ie("Scheduling Page User Feedback"),
|
|
281
|
+
message: t.detail.feedback
|
|
282
|
+
};
|
|
283
|
+
oe(i, {
|
|
284
|
+
includeReplay: !0,
|
|
285
|
+
captureContext: {
|
|
286
|
+
tags: {
|
|
287
|
+
"nylas-web-element": "nylas-schduling",
|
|
288
|
+
"nylas-web-element-version": "1.1.4"
|
|
289
|
+
},
|
|
290
|
+
extra: {
|
|
291
|
+
configId: this.configurationId,
|
|
292
|
+
slug: this.slug
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}), this.showFeedbackModal = !1;
|
|
296
|
+
}
|
|
297
|
+
async getNylasSchedulerStore() {
|
|
298
|
+
var t;
|
|
299
|
+
return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
|
|
300
|
+
}
|
|
301
|
+
async getNylasSchedulerConnector() {
|
|
302
|
+
return this.nylasSchedulerConnector;
|
|
303
|
+
}
|
|
304
|
+
async getRef() {
|
|
305
|
+
return this.host;
|
|
306
|
+
}
|
|
307
|
+
getErrorObject(t) {
|
|
308
|
+
return {
|
|
309
|
+
title: (t == null ? void 0 : t.title) || $.title,
|
|
310
|
+
category: (t == null ? void 0 : t.category) || $.category,
|
|
311
|
+
type: L.Error,
|
|
312
|
+
description: (t == null ? void 0 : t.message) || "",
|
|
313
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
314
|
+
ttl: "none"
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
checkIfSessionIdOrConfigIdExists() {
|
|
318
|
+
if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {
|
|
319
|
+
let t = "";
|
|
320
|
+
return this.sessionId || (t += u.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (t = u.t("sessionIdRequiredErrorMessage") + " " + u.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
|
|
321
|
+
notification: {
|
|
322
|
+
title: u.t("schedulingComponentErrorTitle"),
|
|
323
|
+
category: z.Component,
|
|
324
|
+
type: L.Error,
|
|
325
|
+
description: t,
|
|
326
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
327
|
+
ttl: "none"
|
|
328
|
+
},
|
|
329
|
+
host: this.host
|
|
330
|
+
}), !1;
|
|
331
|
+
}
|
|
332
|
+
return !0;
|
|
333
|
+
}
|
|
334
|
+
isTimeslotValid(t) {
|
|
335
|
+
return new Date(t.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
|
|
336
|
+
notification: {
|
|
337
|
+
title: u.t("invalidTimeslotErrorTitle"),
|
|
338
|
+
category: z.Component,
|
|
339
|
+
type: L.Error,
|
|
340
|
+
description: u.t("invalidTimeslotErrorMessage"),
|
|
341
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
342
|
+
ttl: "none"
|
|
343
|
+
},
|
|
344
|
+
host: this.host
|
|
345
|
+
}), !1) : !0;
|
|
346
|
+
}
|
|
347
|
+
validateAvailableDaysInFuture(t, e) {
|
|
348
|
+
const i = /* @__PURE__ */ new Date(), a = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, s = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, d = Math.floor(Y(i, e).getTime() / 1e3), r = Math.min(d, s);
|
|
349
|
+
return { startTime: a < i.getTime() / 1e3 ? Math.floor(i.getTime() / 1e3) : a, endTime: r, endTimeForAvailableDaysInFuture: d };
|
|
350
|
+
}
|
|
351
|
+
applyThemeConfig(t) {
|
|
352
|
+
if (t)
|
|
353
|
+
for (const [e, i] of Object.entries(t))
|
|
354
|
+
this.host.style.setProperty(`${e}`, i);
|
|
355
|
+
}
|
|
356
|
+
onFeedbackClick() {
|
|
357
|
+
this.showFeedbackModal = !0;
|
|
358
|
+
}
|
|
359
|
+
render() {
|
|
360
|
+
var b, I, h, l, v, B, R, S, O, P, A;
|
|
361
|
+
const t = this.mode === "app", e = (b = this.baseProvider) == null ? void 0 : b.getStore("scheduler"), i = e == null ? void 0 : e.get("eventInfo"), a = e == null ? void 0 : e.get("showBookingForm"), s = e == null ? void 0 : e.get("cancelledEventInfo"), d = e == null ? void 0 : e.get("cancelBookingId"), r = e == null ? void 0 : e.get("selectedTimeslot"), o = e == null ? void 0 : e.get("rescheduleBookingId"), c = e == null ? void 0 : e.get("organizerConfirmationBookingId"), y = e == null ? void 0 : e.get("rejectBookingId"), m = e == null ? void 0 : e.get("confirmedEventInfo"), g = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, p = e == null ? void 0 : e.get("selectedDate"), f = (h = (I = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : I.scheduler) == null ? void 0 : h.confirmation_redirect_url;
|
|
362
|
+
if (this.selectedDateLabel = p && this.language ? J(p.toLocaleDateString(ee[this.language], { dateStyle: "full" })) : `${u.t("noDateSelected")}`, t && (d || y) && !s)
|
|
363
|
+
return n(C, null, n(E, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, n("nylas-cancel-booking-form", { selectedTimeslot: r, cancelBookingId: d, rejectBookingId: y, exportparts: "ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
364
|
+
if (t && c)
|
|
365
|
+
return n(C, null, n(E, null, n("div", { class: "manual-confirmation-page", part: "manual-confirmation-page" }, n("nylas-organizer-confirmation-card", { organizerConfirmationBookingId: c, exportparts: "nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
366
|
+
if (t && s)
|
|
367
|
+
return n(C, null, n(E, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, n("nylas-cancelled-event-card", { cancelledEventInfo: s, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
368
|
+
if (t && m)
|
|
369
|
+
return n(C, null, n(E, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "confirmed-event-page" }, n("nylas-confirmed-event-card", { confirmedEventInfo: m, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
370
|
+
if (t && i && f) {
|
|
371
|
+
const _ = (v = (l = this.stores) == null ? void 0 : l.scheduler.get("bookingInfo")) == null ? void 0 : v.primaryParticipant, N = (R = (B = this.stores) == null ? void 0 : B.scheduler.get("bookingInfo")) == null ? void 0 : R.additionalFields, w = (S = this.stores) == null ? void 0 : S.scheduler.get("selectedTimeslot"), M = (O = this.stores) == null ? void 0 : O.scheduler.get("selectedTimezone"), U = (P = this.stores) == null ? void 0 : P.scheduler.get("selectedLanguage"), T = (A = this.stores) == null ? void 0 : A.scheduler.get("configSettings"), j = this.configurationId ? this.configurationId : T == null ? void 0 : T.configuration_id, q = window.location.search, k = new URLSearchParams(q);
|
|
372
|
+
k.set("booking_id", i.booking_id), _ != null && _.name && k.set("name", _.name), _ != null && _.email && k.set("email", _.email), w != null && w.start_time && k.set("start_time", (new Date(w.start_time).getTime() / 1e3).toString()), w != null && w.end_time && k.set("end_time", (new Date(w.end_time).getTime() / 1e3).toString()), M && k.set("tz", M), U && k.set("language", U), N && k.set("additional_values", JSON.stringify(N)), this.slug && k.set("page_slug", this.slug), j && k.set("config_id", j), window.location.assign(`${f}?${k.toString()}`);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (t && i)
|
|
376
|
+
return n(C, null, n(E, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "booked-event-page", part: "booked-event-page" }, n("nylas-booked-event-card", { selectedTimeslot: r, eventInfo: i, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
377
|
+
if (t && (!i || o) && !a) {
|
|
378
|
+
const _ = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
379
|
+
return n(C, null, n(E, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, o && n(W, null, `${u.t("rescheduleTitle")}`), n("div", { class: "select-date-page", part: "select-date-page" }, n("div", { class: "left-panel" }, n("nylas-date-picker", { exportparts: "ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month" }), n("nylas-locale-switch", { exportparts: "nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label" })), n("div", { class: `right-panel ${o ? "reschedule" : ""}` }, n("h2", null, n("calendar-icon", null), n("span", { id: "selectedDate" }, this.selectedDateLabel)), n("nylas-timeslot-picker", { exportparts: "ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, _ && n("span", { slot: "timeslot-picker-cta-label" }, n("slot", { name: "timeslot-picker-cta-label" })))))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null));
|
|
380
|
+
}
|
|
381
|
+
return t && !i && a ? n(C, null, n(E, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, o && n(W, null, `${u.t("rescheduleTitle")}`), n("div", { class: "additional-data-page", part: "additional-data-page" }, n("div", { class: "left-panel" }, n("div", { class: "wrapper" }, n("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone" }))), n("div", { class: `right-panel ${o ? "reschedule" : ""}` }, n("nylas-booking-form", { exportparts: "nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content" })))), this.enableUserFeedback && n("button-component", { id: "report-issue", variant: "basic", onClick: () => this.onFeedbackClick() }, n("feedback-icon", null)), this.showFeedbackModal && n("nylas-feedback-form", null)) : n(C, null, n("slot", null));
|
|
382
|
+
}
|
|
383
|
+
get host() {
|
|
384
|
+
return K(this);
|
|
385
|
+
}
|
|
386
|
+
static get watchers() {
|
|
387
|
+
return {
|
|
388
|
+
bookingInfo: ["bookingInfoChanged"],
|
|
389
|
+
rescheduleBookingRef: ["rescheduleBookingRefChanged"],
|
|
390
|
+
cancelBookingRef: ["cancelBookingRefChanged"],
|
|
391
|
+
organizerConfirmationBookingRef: ["organizerConfirmationBookingRefChanged"],
|
|
392
|
+
localization: ["localizationChanged"],
|
|
393
|
+
themeConfig: ["themeConfigChanged"]
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
le.style = de;
|
|
398
|
+
export {
|
|
399
|
+
le as nylas_scheduling
|
|
400
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-6b9d4b01.cjs"),E=require("./index.es-b475d61f-68a74a28.cjs"),D=require("./scheduler-store-908886c8-62d14677.cjs"),A=require("./constants-c31dccfe-1a739653.cjs"),x=require("./feedbackSync-ab657d65-e650e46d.cjs");require("react");require("react-dom");class q{constructor({schedulerAPIURL:t,nylasSchedulerStore:i,sessionId:a,configId:s,slug:d,clientId:r}){if(!t)throw new Error("schedulerAPIURL is required");if(!i)throw new Error("nylasSchedulerStore is required");if(!a&&!s&&!(d||r))throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");t==="/"&&(t=new URL(window.location.href).origin),this.configId=s,this.sessionId=a,this.schedulerAPIURL=t,this.nylasSchedulerStore=i,this.slug=d,this.clientId=r}init(){e.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new D.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId,slug:this.slug,clientId:this.clientId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const w=(n,t)=>{const i=n.isLoading,a=n.showNotification,s=n.nylasBranding;return e.h(e.Fragment,null,a&&e.h("nylas-notification",null),i&&e.h("div",{class:"loading"},e.h("div",{class:"left"},e.h("div",{class:"skeleton"})),e.h("div",{class:"right"},e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}),e.h("div",{class:"skeleton"}))),!i&&t,e.h("div",{class:"footer"},s&&e.h(e.Fragment,null,"Powered by ",e.h("nylas-logo",null))))},N=(n,t)=>e.h("div",{class:"message-banner"},t),W=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 8px 2px rgba(0, 0, 0, 0.05), 0px 8px 16px -2px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin:0}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page,.manual-confirmation-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.manual-confirmation-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:784px;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.manual-confirmation-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}.right-panel.reschedule{border-top-right-radius:0px}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}button-component#report-issue{width:auto;position:absolute;bottom:4px;left:16px}nylas-feedback-form{position:absolute;top:0;height:100%;width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:rgba(0, 0, 0, 0.6);z-index:2;border-radius:inherit}',$=W,M={title:e.instance.t("genericErrorTitle"),type:E.nr.Error,category:D.ErrorCategory.Component},j=class{constructor(n){e.registerInstance(this,n),this.init=e.createEvent(this,"init",7),this.schedulerWillLoad=e.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=e.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=e.createEvent(this,"nylasSchedulerError",7),this.configSettingsLoaded=e.createEvent(this,"configSettingsLoaded",7),this.bookingRefExtracted=e.createEvent(this,"bookingRefExtracted",7),this.bookedEventInfo=e.createEvent(this,"bookedEventInfo",7),this.mode="app",this.defaultSchedulerState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://api.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingRef=void 0,this.cancelBookingRef=void 0,this.organizerConfirmationBookingRef=void 0,this.configurationId=void 0,this.slug=void 0,this.clientId=void 0,this.nylasBranding=!0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.localization=void 0,this.showNotification=!0,this.enableUserFeedback=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||`${e.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language,this.showFeedbackModal=!1}connectedCallback(){e.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var s,d;e.debug("[nylas-scheduler] Component will load"),this.enableUserFeedback&&!x.isInitialized()&&x.init({dsn:"https://9d5731f1c77ca84c9ed3fb9b3ccf7ee1@o74852.ingest.us.sentry.io/4507889638178816",release:"1.1.4",integrations:r=>[...r.filter(o=>!1),x.feedbackSyncIntegration({colorScheme:"system",autoInject:!1})],autoSessionTracking:!1,beforeSend:()=>null});const n=this.schedulerWillLoad.emit(this.host);if("schedulerWillLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerWillLoad(n,this.nylasSchedulerConnector),n.defaultPrevented))return;this.stores={scheduler:D.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})},this.baseProvider=new E.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId;let t;if(this.rescheduleBookingRef){const[r,o,c]=e.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=r,this.stores.scheduler.set("rescheduleBookingId",o),t=this.bookingRefExtracted.emit({configurationId:r,bookingId:o})}else if(this.cancelBookingRef){const[r,o,c]=e.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=r,this.stores.scheduler.set("cancelBookingId",o),t=this.bookingRefExtracted.emit({configurationId:r,bookingId:o})}else if(this.organizerConfirmationBookingRef){const[r,o,c]=e.compactStringToUUIDs(this.organizerConfirmationBookingRef);this.refConfigId=r,this.stores.scheduler.set("organizerConfirmationBookingId",o),this.stores.scheduler.set("organizerConfirmationSalt",c),t=this.bookingRefExtracted.emit({configurationId:r,bookingId:o,salt:c})}if("bookingRefExtracted"in this.eventOverrides&&(await this.eventOverrides.bookingRefExtracted(t,this.nylasSchedulerConnector),t.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;const i=(s=this.baseProvider)==null?void 0:s.getStore("scheduler");this.nylasSchedulerConnector=new q({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,slug:this.slug,clientId:this.clientId,nylasSchedulerStore:i});const a=this.init.emit(this.host);"init"in this.eventOverrides&&(await this.eventOverrides.init(a,this.nylasSchedulerConnector),a.defaultPrevented)||((d=this.baseProvider)==null||d.componentWillLoad(this.nylasSchedulerConnector),this.applyThemeConfig(this.themeConfig))}async componentDidLoad(){var c,k,b,g,m,f,u,_;(c=this.baseProvider)==null||c.componentDidLoad();const n=this.schedulerDidLoad.emit(this.host);if("schedulerDidLoad"in this.eventOverrides&&(await this.eventOverrides.schedulerDidLoad(n,this.nylasSchedulerConnector),n.defaultPrevented)||!this.checkIfSessionIdOrConfigIdExists())return;this.localizationChanged(this.localization);const t=await((k=this.nylasSchedulerConnector)==null?void 0:k.scheduler.getUISettings());if(!t||"error"in t){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(t==null?void 0:t.error)},host:this.host});return}else{"data"in t&&((b=t.data)!=null&&b.appearance)&&console.info("Appearance settings have been returned from the configuration used byt his scheduling page; please remember to grab them from the configSettingsLoaded event and apply them as desired.");const h=this.configSettingsLoaded.emit({settings:t});if("configSettingsLoaded"in this.eventOverrides&&(await this.eventOverrides.configSettingsLoaded(h,this.nylasSchedulerConnector),h.defaultPrevented))return}const i=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),a=(f=(m=i==null?void 0:i.get("configSettings"))==null?void 0:m.scheduler)==null?void 0:f.available_days_in_future,s=i==null?void 0:i.get("selectedTimeslot");if(s&&(s!=null&&s.start_time)){if(!this.isTimeslotValid(s))return;if(i!=null&&i.get("showBookingForm")){i==null||i.set("selectedDate",s.start_time);return}}const d=i==null?void 0:i.get("selectedDate"),r=i==null?void 0:i.get("availability");let o;if(!(r&&r.length>0)){if(d){const{startTime:h,endTime:l,endTimeForAvailableDaysInFuture:v}=this.validateAvailableDaysInFuture(d,a||30);d.getTime()<v*1e3&&(o=await((_=this.nylasSchedulerConnector)==null?void 0:_.scheduler.getAvailability(h,l)))}else{const h=new Date,{startTime:l,endTime:v,endTimeForAvailableDaysInFuture:C}=this.validateAvailableDaysInFuture(h,a||30);h.getTime()<C*1e3&&(o=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getAvailability(l,v)))}if((!o||"error"in o)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o==null?void 0:o.error)},host:this.host}),!d){let h=new Date;const l=i==null?void 0:i.get("availability").find(v=>new Date(v.start_time)>new Date);l&&(h=l.start_time),i==null||i.set("selectedDate",h)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var t;(t=this.stores)==null||t.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var t,i;if(n){const[a,s]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("rescheduleBookingId",s),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}cancelBookingRefChanged(n){var t,i;if(n){const[a,s]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("cancelBookingId",s),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}organizerConfirmationBookingRefChanged(n){var t,i;if(n){const[a,s]=e.compactStringToUUIDs(n);(t=this.stores)==null||t.scheduler.set("organizerConfirmationBookingId",s),this.refConfigId=a,(i=this.nylasSchedulerConnector)==null||i.scheduler.setConfigId(a)}}localizationChanged(n){n&&Object.keys(n).forEach(t=>{t in A.LANGUAGE_CODE&&(e.instance.addResourceBundle(t,"translation",n[t],!1,!0),this.language=this.language)})}themeConfigChanged(n){this.applyThemeConfig(n)}languageChanged(n){const t=n.detail;this.language=t,e.instance.changeLanguage(t)}async registerComponentHandler(n){var t;(t=this.baseProvider)==null||t.registerComponent(n.detail)}async unregisterComponentHandler(n){var t;(t=this.baseProvider)==null||t.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,o,c,k,b,g,m;const t=n.detail,i=(k=(c=(o=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:o.get("configSettings"))==null?void 0:c.scheduler)==null?void 0:k.available_days_in_future,{startTime:a,endTime:s,endTimeForAvailableDaysInFuture:d}=this.validateAvailableDaysInFuture(t,i||30);if(a<d&&t.getTime()<d*1e3){const f=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.getAvailability(a,s));(!f||"error"in f)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(f==null?void 0:f.error)},host:this.host});const u=(g=this.stores)==null?void 0:g.scheduler.get("selectableDates");u&&u.length>0&&((m=this.stores)==null||m.scheduler.set("selectedDate",u[0]))}}mapToBookingData(n){var r,o,c;const t=(r=this.stores)==null?void 0:r.scheduler.get("selectedTimeslot"),i=(o=this.stores)==null?void 0:o.scheduler.get("selectedLanguage"),a=(c=this.stores)==null?void 0:c.scheduler.get("selectedTimezone"),s=t!=null&&t.start_time?new Date(t==null?void 0:t.start_time).getTime()/1e3:"",d=t!=null&&t.end_time?new Date(t==null?void 0:t.end_time).getTime()/1e3:"";return{additional_guests:n.guests,guest:n.primaryParticipant,additional_fields:n.additionalFields,start_time:s,end_time:d,email_language:i,timezone:a}}async bookButtonClickedHandler(n){var b,g,m,f,u,_,h;const t=n.detail,i=this.mapToBookingData(t),s={...(g=(b=this.nylasSchedulerConnector)==null?void 0:b.schedulerStore)==null?void 0:g.get("bookingInfo"),...t};(m=this.stores)==null||m.scheduler.set("bookingInfo",s);const r=(u=(f=this.nylasSchedulerConnector)==null?void 0:f.schedulerStore)==null?void 0:u.get("rescheduleBookingId");if(r){const l=await((_=this.nylasSchedulerConnector)==null?void 0:_.scheduler.rescheduleBooking(r,t));(!l||"error"in l)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(l==null?void 0:l.error)},host:this.host});const v=l==null?void 0:l.data,C=this.bookedEventInfo.emit({...l,data:{...v,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(C,this.nylasSchedulerConnector);return}const o=await((h=this.nylasSchedulerConnector)==null?void 0:h.scheduler.bookTimeslot(t));(!o||"error"in o)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(o==null?void 0:o.error)},host:this.host});const c=o==null?void 0:o.data,k=this.bookedEventInfo.emit({...o,data:{...c,...i}});"bookedEventInfo"in this.eventOverrides&&await this.eventOverrides.bookedEventInfo(k,this.nylasSchedulerConnector)}dateSelectedHandler(n){const t=n.detail;this.selectedDateLabel=t?t.toLocaleDateString(void 0,{dateStyle:"full"}):`${e.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}confirmBookingErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}feedbackModalClosedHandler(){this.showFeedbackModal=!1}feedbackSubmittedHandler(n){const i={eventId:x.captureMessage("Scheduling Page User Feedback"),message:n.detail.feedback};x.captureFeedback(i,{includeReplay:!0,captureContext:{tags:{"nylas-web-element":"nylas-schduling","nylas-web-element-version":"1.1.4"},extra:{configId:this.configurationId,slug:this.slug}}}),this.showFeedbackModal=!1}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||M.title,category:(n==null?void 0:n.category)||M.category,type:E.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){if(!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)){let n="";return this.sessionId||(n+=e.instance.t("sessionIdRequiredErrorMessage")),!this.sessionId&&!this.refConfigId&&!(this.slug&&this.clientId)&&(n=e.instance.t("sessionIdRequiredErrorMessage")+" "+e.instance.t("publicConfigErrorMessage")),this.nylasSchedulerError.emit({notification:{title:e.instance.t("schedulingComponentErrorTitle"),category:D.ErrorCategory.Component,type:E.nr.Error,description:n,id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1}return!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:e.instance.t("invalidTimeslotErrorTitle"),category:D.ErrorCategory.Component,type:E.nr.Error,description:e.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,t){const i=new Date,a=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,d=Math.floor(e.addDaysToCurrentDate(i,t).getTime()/1e3),r=Math.min(d,s);return{startTime:a<i.getTime()/1e3?Math.floor(i.getTime()/1e3):a,endTime:r,endTimeForAvailableDaysInFuture:d}}applyThemeConfig(n){if(n)for(const[t,i]of Object.entries(n))this.host.style.setProperty(`${t}`,i)}onFeedbackClick(){this.showFeedbackModal=!0}render(){var u,_,h,l,v,C,T,L,F,S,z;const n=this.mode==="app",t=(u=this.baseProvider)==null?void 0:u.getStore("scheduler"),i=t==null?void 0:t.get("eventInfo"),a=t==null?void 0:t.get("showBookingForm"),s=t==null?void 0:t.get("cancelledEventInfo"),d=t==null?void 0:t.get("cancelBookingId"),r=t==null?void 0:t.get("selectedTimeslot"),o=t==null?void 0:t.get("rescheduleBookingId"),c=t==null?void 0:t.get("organizerConfirmationBookingId"),k=t==null?void 0:t.get("rejectBookingId"),b=t==null?void 0:t.get("confirmedEventInfo"),g=(t==null?void 0:t.get("nylasBranding"))||this.nylasBranding,m=t==null?void 0:t.get("selectedDate"),f=(h=(_=t==null?void 0:t.get("configSettings"))==null?void 0:_.scheduler)==null?void 0:h.confirmation_redirect_url;if(this.selectedDateLabel=m&&this.language?e.capitalizeFirstLetter(m.toLocaleDateString(A.LANGUAGE_CODE_MAP[this.language],{dateStyle:"full"})):`${e.instance.t("noDateSelected")}`,n&&(d||k)&&!s)return e.h(e.Host,null,e.h(w,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},e.h("nylas-cancel-booking-form",{selectedTimeslot:r,cancelBookingId:d,rejectBookingId:k,exportparts:"ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&c)return e.h(e.Host,null,e.h(w,null,e.h("div",{class:"manual-confirmation-page",part:"manual-confirmation-page"},e.h("nylas-organizer-confirmation-card",{organizerConfirmationBookingId:c,exportparts:"nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&s)return e.h(e.Host,null,e.h(w,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},e.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&b)return e.h(e.Host,null,e.h(w,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"cancelled-event-page",part:"confirmed-event-page"},e.h("nylas-confirmed-event-card",{confirmedEventInfo:b,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&i&&f){const y=(v=(l=this.stores)==null?void 0:l.scheduler.get("bookingInfo"))==null?void 0:v.primaryParticipant,R=(T=(C=this.stores)==null?void 0:C.scheduler.get("bookingInfo"))==null?void 0:T.additionalFields,I=(L=this.stores)==null?void 0:L.scheduler.get("selectedTimeslot"),O=(F=this.stores)==null?void 0:F.scheduler.get("selectedTimezone"),P=(S=this.stores)==null?void 0:S.scheduler.get("selectedLanguage"),B=(z=this.stores)==null?void 0:z.scheduler.get("configSettings"),U=this.configurationId?this.configurationId:B==null?void 0:B.configuration_id,H=window.location.search,p=new URLSearchParams(H);p.set("booking_id",i.booking_id),y!=null&&y.name&&p.set("name",y.name),y!=null&&y.email&&p.set("email",y.email),I!=null&&I.start_time&&p.set("start_time",(new Date(I.start_time).getTime()/1e3).toString()),I!=null&&I.end_time&&p.set("end_time",(new Date(I.end_time).getTime()/1e3).toString()),O&&p.set("tz",O),P&&p.set("language",P),R&&p.set("additional_values",JSON.stringify(R)),this.slug&&p.set("page_slug",this.slug),U&&p.set("config_id",U),window.location.assign(`${f}?${p.toString()}`);return}if(n&&i)return e.h(e.Host,null,e.h(w,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},e.h("div",{class:"booked-event-page",part:"booked-event-page"},e.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:i,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null));if(n&&(!i||o)&&!a){const y=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return e.h(e.Host,null,e.h(w,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},o&&e.h(N,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"select-date-page",part:"select-date-page"},e.h("div",{class:"left-panel"},e.h("nylas-date-picker",{exportparts:"ndp, ndp__title, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--disabled, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),e.h("nylas-locale-switch",{exportparts:"nls, nls__timezone, nls__timezone-dropdown, nls__timezone-drop-button, nls__timezone-drop-button-selected-label, nls__timezone-drop-content, nls__timezone-drop-label, nls__language, nls__language-dropdown, nls__language-drop-button, nls__language-drop-content, nls__language-drop-label"})),e.h("div",{class:`right-panel ${o?"reschedule":""}`},e.h("h2",null,e.h("calendar-icon",null),e.h("span",{id:"selectedDate"},this.selectedDateLabel)),e.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},y&&e.h("span",{slot:"timeslot-picker-cta-label"},e.h("slot",{name:"timeslot-picker-cta-label"})))))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null))}return n&&!i&&a?e.h(e.Host,null,e.h(w,{nylasBranding:g,isLoading:this.isLoading,showNotification:this.showNotification},o&&e.h(N,null,`${e.instance.t("rescheduleTitle")}`),e.h("div",{class:"additional-data-page",part:"additional-data-page"},e.h("div",{class:"left-panel"},e.h("div",{class:"wrapper"},e.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time, nsec__timezone"}))),e.h("div",{class:`right-panel ${o?"reschedule":""}`},e.h("nylas-booking-form",{exportparts:"nbf, nbf__input-textfield, nbf__button-ghost, nbf__button-outline, nbf__button-primary, nbf__input-wrapper, nbf__checkbox-component, nbf__radio-button-group, nbf__textarea-component, nbf__dropdown, nbf__dropdown-button, nbf__dropdown-content"})))),this.enableUserFeedback&&e.h("button-component",{id:"report-issue",variant:"basic",onClick:()=>this.onFeedbackClick()},e.h("feedback-icon",null)),this.showFeedbackModal&&e.h("nylas-feedback-form",null)):e.h(e.Host,null,e.h("slot",null))}get host(){return e.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"],organizerConfirmationBookingRef:["organizerConfirmationBookingRefChanged"],localization:["localizationChanged"],themeConfig:["themeConfigChanged"]}}};j.style=$;exports.nylas_scheduling=j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-c4e817ef.cjs");require("react");require("react-dom");var _={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(r.commonjsGlobal,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,h=/\d\d?/,x=/\d*[^-_:/,()\s\d]+/,b={},Z=function(s){return(s=+s)+(s>68?1900:2e3)},d=function(s){return function(o){this[s]=+o}},B=[/[+-]\d\d:?(\d\d)?|Z/,function(s){(this.zone||(this.zone={})).offset=function(o){if(!o||o==="Z")return 0;var m=o.match(/([+-]|\d\d)/g),l=60*m[1]+(+m[2]||0);return l===0?0:m[0]==="+"?-l:l}(s)}],F=function(s){var o=b[s];return o&&(o.indexOf?o:o.s.concat(o.f))},V=function(s,o){var m,l=b.meridiem;if(l){for(var p=1;p<=24;p+=1)if(s.indexOf(l(p,0,o))>-1){m=p>12;break}}else m=s===(o?"pm":"PM");return m},q={A:[x,function(s){this.afternoon=V(s,!1)}],a:[x,function(s){this.afternoon=V(s,!0)}],S:[/\d/,function(s){this.milliseconds=100*+s}],SS:[a,function(s){this.milliseconds=10*+s}],SSS:[/\d{3}/,function(s){this.milliseconds=+s}],s:[h,d("seconds")],ss:[h,d("seconds")],m:[h,d("minutes")],mm:[h,d("minutes")],H:[h,d("hours")],h:[h,d("hours")],HH:[h,d("hours")],hh:[h,d("hours")],D:[h,d("day")],DD:[a,d("day")],Do:[x,function(s){var o=b.ordinal,m=s.match(/\d+/);if(this.day=m[0],o)for(var l=1;l<=31;l+=1)o(l).replace(/\[|\]/g,"")===s&&(this.day=l)}],M:[h,d("month")],MM:[a,d("month")],MMM:[x,function(s){var o=F("months"),m=(F("monthsShort")||o.map(function(l){return l.slice(0,3)})).indexOf(s)+1;if(m<1)throw new Error;this.month=m%12||m}],MMMM:[x,function(s){var o=F("months").indexOf(s)+1;if(o<1)throw new Error;this.month=o%12||o}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(s){this.year=Z(s)}],YYYY:[/\d{4}/,d("year")],Z:B,ZZ:B};function N(s){var o,m;o=s,m=b&&b.formats;for(var l=(s=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,T,f){var c=f&&f.toUpperCase();return T||m[f]||n[f]||m[c].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,k,M){return k||M.slice(1)})})).match(i),p=l.length,y=0;y<p;y+=1){var C=l[y],I=q[C],v=I&&I[0],g=I&&I[1];l[y]=g?{regex:v,parser:g}:C.replace(/^\[|\]$/g,"")}return function(S){for(var T={},f=0,c=0;f<p;f+=1){var w=l[f];if(typeof w=="string")c+=w.length;else{var k=w.regex,M=w.parser,L=S.slice(c),A=k.exec(L)[0];M.call(T,A),S=S.replace(A,"")}}return function(D){var u=D.afternoon;if(u!==void 0){var Y=D.hours;u?Y<12&&(D.hours+=12):Y===12&&(D.hours=0),delete D.afternoon}}(T),T}}return function(s,o,m){m.p.customParseFormat=!0,s&&s.parseTwoDigitYear&&(Z=s.parseTwoDigitYear);var l=o.prototype,p=l.parse;l.parse=function(y){var C=y.date,I=y.utc,v=y.args;this.$u=I;var g=v[1];if(typeof g=="string"){var S=v[2]===!0,T=v[3]===!0,f=S||T,c=v[2];T&&(c=v[2]),b=this.$locale(),!S&&c&&(b=m.Ls[c]),this.$d=function(L,A,D){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*L);var u=N(A)(L),Y=u.year,E=u.month,X=u.day,G=u.hours,J=u.minutes,Q=u.seconds,ee=u.milliseconds,W=u.zone,$=new Date,P=X||(Y||E?1:$.getDate()),z=Y||$.getFullYear(),O=0;Y&&!E||(O=E>0?E-1:$.getMonth());var j=G||0,H=J||0,K=Q||0,R=ee||0;return W?new Date(Date.UTC(z,O,P,j,H,K,R+60*W.offset*1e3)):D?new Date(Date.UTC(z,O,P,j,H,K,R)):new Date(z,O,P,j,H,K,R)}catch{return new Date("")}}(C,g,I),this.init(),c&&c!==!0&&(this.$L=this.locale(c).$L),f&&C!=this.format(g)&&(this.$d=new Date("")),b={}}else if(g instanceof Array)for(var w=g.length,k=1;k<=w;k+=1){v[1]=g[k-1];var M=m.apply(this,v);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}k===w&&(this.$d=new Date(""))}else p.call(this,y)}}})})(_);const te=_.exports,ie=':host{display:block;position:relative;--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}.time-picker{display:inline-block;width:150px;font-family:var(--nylas-font-family);position:relative}@media screen and (max-width: 768px){.time-picker{width:auto}}.time-picker input{width:150px;height:48px;text-align:center;font-size:16px;font-family:inherit;cursor:pointer;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.time-picker input{width:88px}}@media screen and (max-width: 504px){.time-picker input{width:68px;font-size:15px}}.time-picker input.focus{background:transparent}.time-picker input:hover,.time-picker input:active{border:1px solid var(--nylas-primary)}.time-picker input:active{outline:2px solid var(--nylas-primary)}.time-picker input span.open{transform:rotate(90deg)}.time-picker input span.closed{transform:rotate(270deg)}.time-picker input.error{border:1px solid var(--nylas-error)}.time-picker p.error{color:var(--nylas-error);font-size:0.875rem;margin:0}.times{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;border:1px solid #ddd;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.times ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.times ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:center;cursor:pointer}.times ul li.focused{background-color:var(--nylas-base-100)}.times ul li:hover,.times ul li:focus{background-color:var(--nylas-base-100)}.times ul li label{display:flex;align-items:center;gap:0.5rem}.times ul li label input{margin:0}',se=ie;r.dayjs.extend(te);const U=class{constructor(e){r.registerInstance(this,e),this.timeChange=r.createEvent(this,"timeChange",7),this.formError=r.createEvent(this,"formError",7),this.time=void 0,this.minimumStartTime=null,this.placeholder="hh:mmam/pm",this.name=void 0,this.hasError=!1,this.err="",this.showTimes=!1,this.ariaActivedescendant="",this.times=this.generateTimes(),this.shouldAutoScroll=!1}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.showTimes&&(this.showTimes=!1)}minimumStartTimeChangedHandler(){if(this.minimumStartTime){let e=r.dayjs().hour(parseInt(this.minimumStartTime)).minute(parseInt(this.minimumStartTime.slice(-4,-2)));this.minimumStartTime.slice(-2).toLowerCase()==="pm"&&parseInt(this.minimumStartTime)!==12?e=e.add(12,"hour"):this.minimumStartTime.slice(-2).toLowerCase()==="am"&&parseInt(this.minimumStartTime)===12&&(e=e.subtract(12,"hour")),this.times=this.generateTimes();const t=r.dayjs(this.times[0].value,"hh:mma");r.dayjs(this.time,"hh:mma").isBefore(t)&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"}))}}componentDidRender(){if(this.showTimes&&this.shouldAutoScroll){const e=r.autocompleteTimeFormat(this.time),t=this.times.findIndex(n=>n.value===e);t>-1&&(this.shouldAutoScroll=!1,this.scrollToViewWithinParent(t));return}}handleTimeChange(e,t){const n=t.split(":");n[0]==="00"&&n[1].slice(-2)=="pm"&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),r.validateTimeFormatInput(t)?(this.err="",this.formError.emit({key:this.el.id,message:""})):(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),this.timeChange.emit({key:this.el.id,value:t})}handleTimeAutocomplete(e){var n;const t=(n=e.target)==null?void 0:n.value;if(!r.validateTimeFormatInput(t)){this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"});return}if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma");this.timeChange.emit({key:this.el.id,value:i});return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t);this.timeChange.emit({key:this.el.id,value:i});return}this.timeChange.emit({key:this.el.id,value:t})}handleOnInput(e){var n;const t=(n=e.target)==null?void 0:n.value;if(r.validateTimeFormatInput(t)){if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma"),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}}}generateTimes(){const e=[];let t=r.dayjs().set("hour",0).set("minute",0).set("second",0);this.minimumStartTime&&(t=r.dayjs(this.minimumStartTime,"hh:mma"));const n=t.endOf("day").diff(t,"minutes"),i=Math.round(n/15);for(let a=0;a<i+1;a++){const h=t.add(a*15,"minute");if(a==i&&h.format("hh:mma").includes("am"))break;e.push({id:a,value:h.format("hh:mma")})}return e}handleComboboxKeyDown(e){if(e.key==="ArrowDown"){if(e.preventDefault(),!this.showTimes){this.showTimes=!0,this.shouldAutoScroll=!0;return}if(this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[0].id.toString(),this.focusOption(0);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t+1<this.times.length?t+1:0;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}}else if(e.key==="ArrowUp")if(e.preventDefault(),this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[this.times.length-1].id.toString(),this.focusOption(this.times.length-1);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t-1>=0?t-1:this.times.length-1;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}handleListboxKeydown(e){const t=this.times,n=t.findIndex(i=>i.id.toString()===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){e.preventDefault();const i=n+1<t.length?n+1:0;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){e.preventDefault();const i=n-1>=0?n-1:t.length-1;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="Enter"){if(e.preventDefault(),this.ariaActivedescendant){const i=t[n];this.handleTimeChange(e,i.value),this.showTimes=!1,this.ariaActivedescendant="",this.timeInput.focus()}}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}scrollToViewWithinParent(e){var x;const t=this.times[e],n=(x=this.el.shadowRoot)==null?void 0:x.getElementById(t.id.toString()),i=this.timeMenu;this.ariaActivedescendant=t.id.toString();const a=n.getBoundingClientRect(),h=i.getBoundingClientRect();a.top<h.top?i.scrollTop-=h.top-a.top:a.bottom>h.bottom&&(i.scrollTop+=a.bottom-h.bottom),a.left<h.left?i.scrollLeft-=h.left-a.left:a.right>h.right&&(i.scrollLeft+=a.right-h.right)}focusOption(e){var a;const t=this.times[e];if(!t)return;const n=t.id.toString(),i=(a=this.el.shadowRoot)==null?void 0:a.getElementById(n);i&&(i.focus(),i.scrollIntoView({behavior:"smooth",block:"nearest"}))}render(){return r.h(r.Host,{key:"efbf43a69aaa2bb323ca70eba72dec4245b8e103"},r.h("div",{key:"0a366760ae64c61e4b61f973f8fe1150f2c4ec33",class:"time-picker",part:"time-picker"},r.h("input",{key:"21c71cd1390364c13c9e7c72c5cd975df42b9c52",type:"text",name:this.name,id:this.name,part:"time-input",class:{"time-input":!0,error:!!this.err||this.hasError},ref:e=>this.timeInput=e,value:this.time,onClick:()=>{this.showTimes=!this.showTimes,this.shouldAutoScroll=!0},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.showTimes?"true":"false",placeholder:this.placeholder,onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e),onBlur:e=>this.handleTimeAutocomplete(e)}),this.err&&r.h("div",{class:"invalid-time-icon"}),this.showTimes&&r.h("div",{class:"times",part:"times",ref:e=>this.timeMenu=e},r.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.times.map(e=>r.h("li",{tabindex:"0",key:e.id,id:e.id.toString(),class:{focused:this.ariaActivedescendant===e.id.toString()},onClick:t=>{this.handleTimeChange(t,e.value),this.showTimes=!1,this.timeInput.focus()},role:"option"},`${e.value}`)))),!this.showTimes&&this.err&&r.h("p",{class:"error",id:"email-error"},this.err)))}get el(){return r.getElement(this)}static get watchers(){return{minimumStartTime:["minimumStartTimeChangedHandler"]}}};U.style=se;exports.nylas_time_window_picker=U;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-6b9d4b01.cjs");require("react");require("react-dom");var _={exports:{}};(function(e,t){(function(n,i){e.exports=i()})(r.commonjsGlobal,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,h=/\d\d?/,x=/\d*[^-_:/,()\s\d]+/,b={},Z=function(s){return(s=+s)+(s>68?1900:2e3)},d=function(s){return function(o){this[s]=+o}},B=[/[+-]\d\d:?(\d\d)?|Z/,function(s){(this.zone||(this.zone={})).offset=function(o){if(!o||o==="Z")return 0;var m=o.match(/([+-]|\d\d)/g),l=60*m[1]+(+m[2]||0);return l===0?0:m[0]==="+"?-l:l}(s)}],F=function(s){var o=b[s];return o&&(o.indexOf?o:o.s.concat(o.f))},V=function(s,o){var m,l=b.meridiem;if(l){for(var p=1;p<=24;p+=1)if(s.indexOf(l(p,0,o))>-1){m=p>12;break}}else m=s===(o?"pm":"PM");return m},q={A:[x,function(s){this.afternoon=V(s,!1)}],a:[x,function(s){this.afternoon=V(s,!0)}],S:[/\d/,function(s){this.milliseconds=100*+s}],SS:[a,function(s){this.milliseconds=10*+s}],SSS:[/\d{3}/,function(s){this.milliseconds=+s}],s:[h,d("seconds")],ss:[h,d("seconds")],m:[h,d("minutes")],mm:[h,d("minutes")],H:[h,d("hours")],h:[h,d("hours")],HH:[h,d("hours")],hh:[h,d("hours")],D:[h,d("day")],DD:[a,d("day")],Do:[x,function(s){var o=b.ordinal,m=s.match(/\d+/);if(this.day=m[0],o)for(var l=1;l<=31;l+=1)o(l).replace(/\[|\]/g,"")===s&&(this.day=l)}],M:[h,d("month")],MM:[a,d("month")],MMM:[x,function(s){var o=F("months"),m=(F("monthsShort")||o.map(function(l){return l.slice(0,3)})).indexOf(s)+1;if(m<1)throw new Error;this.month=m%12||m}],MMMM:[x,function(s){var o=F("months").indexOf(s)+1;if(o<1)throw new Error;this.month=o%12||o}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(s){this.year=Z(s)}],YYYY:[/\d{4}/,d("year")],Z:B,ZZ:B};function N(s){var o,m;o=s,m=b&&b.formats;for(var l=(s=o.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,T,f){var c=f&&f.toUpperCase();return T||m[f]||n[f]||m[c].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,k,M){return k||M.slice(1)})})).match(i),p=l.length,y=0;y<p;y+=1){var C=l[y],I=q[C],v=I&&I[0],g=I&&I[1];l[y]=g?{regex:v,parser:g}:C.replace(/^\[|\]$/g,"")}return function(S){for(var T={},f=0,c=0;f<p;f+=1){var w=l[f];if(typeof w=="string")c+=w.length;else{var k=w.regex,M=w.parser,L=S.slice(c),A=k.exec(L)[0];M.call(T,A),S=S.replace(A,"")}}return function(D){var u=D.afternoon;if(u!==void 0){var Y=D.hours;u?Y<12&&(D.hours+=12):Y===12&&(D.hours=0),delete D.afternoon}}(T),T}}return function(s,o,m){m.p.customParseFormat=!0,s&&s.parseTwoDigitYear&&(Z=s.parseTwoDigitYear);var l=o.prototype,p=l.parse;l.parse=function(y){var C=y.date,I=y.utc,v=y.args;this.$u=I;var g=v[1];if(typeof g=="string"){var S=v[2]===!0,T=v[3]===!0,f=S||T,c=v[2];T&&(c=v[2]),b=this.$locale(),!S&&c&&(b=m.Ls[c]),this.$d=function(L,A,D){try{if(["x","X"].indexOf(A)>-1)return new Date((A==="X"?1e3:1)*L);var u=N(A)(L),Y=u.year,E=u.month,X=u.day,G=u.hours,J=u.minutes,Q=u.seconds,ee=u.milliseconds,W=u.zone,$=new Date,P=X||(Y||E?1:$.getDate()),z=Y||$.getFullYear(),O=0;Y&&!E||(O=E>0?E-1:$.getMonth());var j=G||0,H=J||0,K=Q||0,R=ee||0;return W?new Date(Date.UTC(z,O,P,j,H,K,R+60*W.offset*1e3)):D?new Date(Date.UTC(z,O,P,j,H,K,R)):new Date(z,O,P,j,H,K,R)}catch{return new Date("")}}(C,g,I),this.init(),c&&c!==!0&&(this.$L=this.locale(c).$L),f&&C!=this.format(g)&&(this.$d=new Date("")),b={}}else if(g instanceof Array)for(var w=g.length,k=1;k<=w;k+=1){v[1]=g[k-1];var M=m.apply(this,v);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}k===w&&(this.$d=new Date(""))}else p.call(this,y)}}})})(_);const te=_.exports,ie=':host{display:block;position:relative;--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}.time-picker{display:inline-block;width:150px;font-family:var(--nylas-font-family);position:relative}@media screen and (max-width: 768px){.time-picker{width:auto}}.time-picker input{width:150px;height:48px;text-align:center;font-size:16px;font-family:inherit;cursor:pointer;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.time-picker input{width:88px}}@media screen and (max-width: 504px){.time-picker input{width:68px;font-size:15px}}.time-picker input.focus{background:transparent}.time-picker input:hover,.time-picker input:active{border:1px solid var(--nylas-primary)}.time-picker input:active{outline:2px solid var(--nylas-primary)}.time-picker input span.open{transform:rotate(90deg)}.time-picker input span.closed{transform:rotate(270deg)}.time-picker input.error{border:1px solid var(--nylas-error)}.time-picker p.error{color:var(--nylas-error);font-size:0.875rem;margin:0}.times{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);width:100%;max-height:336px;overflow:auto;border:1px solid #ddd;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.0509803922);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1019607843)}.times ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.times ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:center;cursor:pointer}.times ul li.focused{background-color:var(--nylas-base-100)}.times ul li:hover,.times ul li:focus{background-color:var(--nylas-base-100)}.times ul li label{display:flex;align-items:center;gap:0.5rem}.times ul li label input{margin:0}',se=ie;r.dayjs.extend(te);const U=class{constructor(e){r.registerInstance(this,e),this.timeChange=r.createEvent(this,"timeChange",7),this.formError=r.createEvent(this,"formError",7),this.time=void 0,this.minimumStartTime=null,this.placeholder="hh:mmam/pm",this.name=void 0,this.hasError=!1,this.err="",this.showTimes=!1,this.ariaActivedescendant="",this.times=this.generateTimes(),this.shouldAutoScroll=!1}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.showTimes&&(this.showTimes=!1)}minimumStartTimeChangedHandler(){if(this.minimumStartTime){let e=r.dayjs().hour(parseInt(this.minimumStartTime)).minute(parseInt(this.minimumStartTime.slice(-4,-2)));this.minimumStartTime.slice(-2).toLowerCase()==="pm"&&parseInt(this.minimumStartTime)!==12?e=e.add(12,"hour"):this.minimumStartTime.slice(-2).toLowerCase()==="am"&&parseInt(this.minimumStartTime)===12&&(e=e.subtract(12,"hour")),this.times=this.generateTimes();const t=r.dayjs(this.times[0].value,"hh:mma");r.dayjs(this.time,"hh:mma").isBefore(t)&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"}))}}componentDidRender(){if(this.showTimes&&this.shouldAutoScroll){const e=r.autocompleteTimeFormat(this.time),t=this.times.findIndex(n=>n.value===e);t>-1&&(this.shouldAutoScroll=!1,this.scrollToViewWithinParent(t));return}}handleTimeChange(e,t){const n=t.split(":");n[0]==="00"&&n[1].slice(-2)=="pm"&&(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),r.validateTimeFormatInput(t)?(this.err="",this.formError.emit({key:this.el.id,message:""})):(this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"})),this.timeChange.emit({key:this.el.id,value:t})}handleTimeAutocomplete(e){var n;const t=(n=e.target)==null?void 0:n.value;if(!r.validateTimeFormatInput(t)){this.err="Invalid",this.formError.emit({key:this.el.id,message:"Invalid"});return}if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma");this.timeChange.emit({key:this.el.id,value:i});return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t);this.timeChange.emit({key:this.el.id,value:i});return}this.timeChange.emit({key:this.el.id,value:t})}handleOnInput(e){var n;const t=(n=e.target)==null?void 0:n.value;if(r.validateTimeFormatInput(t)){if(t===""){const i=r.roundToNearest15Minutes().format("hh:mma"),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}if(!r.validateExactTimeFormat(t)){const i=r.autocompleteTimeFormat(t),a=this.times.findIndex(h=>h.value===i);a>-1&&this.scrollToViewWithinParent(a);return}}}generateTimes(){const e=[];let t=r.dayjs().set("hour",0).set("minute",0).set("second",0);this.minimumStartTime&&(t=r.dayjs(this.minimumStartTime,"hh:mma"));const n=t.endOf("day").diff(t,"minutes"),i=Math.round(n/15);for(let a=0;a<i+1;a++){const h=t.add(a*15,"minute");if(a==i&&h.format("hh:mma").includes("am"))break;e.push({id:a,value:h.format("hh:mma")})}return e}handleComboboxKeyDown(e){if(e.key==="ArrowDown"){if(e.preventDefault(),!this.showTimes){this.showTimes=!0,this.shouldAutoScroll=!0;return}if(this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[0].id.toString(),this.focusOption(0);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t+1<this.times.length?t+1:0;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}}else if(e.key==="ArrowUp")if(e.preventDefault(),this.ariaActivedescendant==="")this.ariaActivedescendant=this.times[this.times.length-1].id.toString(),this.focusOption(this.times.length-1);else{const t=this.times.findIndex(i=>i.id.toString()===this.ariaActivedescendant),n=t-1>=0?t-1:this.times.length-1;this.ariaActivedescendant=this.times[n].id.toString(),this.focusOption(n)}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}handleListboxKeydown(e){const t=this.times,n=t.findIndex(i=>i.id.toString()===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){e.preventDefault();const i=n+1<t.length?n+1:0;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){e.preventDefault();const i=n-1>=0?n-1:t.length-1;this.ariaActivedescendant=t[i].id.toString(),this.focusOption(i)}else if(e.key==="Enter"){if(e.preventDefault(),this.ariaActivedescendant){const i=t[n];this.handleTimeChange(e,i.value),this.showTimes=!1,this.ariaActivedescendant="",this.timeInput.focus()}}else e.key==="Escape"&&(this.showTimes=!1,this.timeInput.focus())}scrollToViewWithinParent(e){var x;const t=this.times[e],n=(x=this.el.shadowRoot)==null?void 0:x.getElementById(t.id.toString()),i=this.timeMenu;this.ariaActivedescendant=t.id.toString();const a=n.getBoundingClientRect(),h=i.getBoundingClientRect();a.top<h.top?i.scrollTop-=h.top-a.top:a.bottom>h.bottom&&(i.scrollTop+=a.bottom-h.bottom),a.left<h.left?i.scrollLeft-=h.left-a.left:a.right>h.right&&(i.scrollLeft+=a.right-h.right)}focusOption(e){var a;const t=this.times[e];if(!t)return;const n=t.id.toString(),i=(a=this.el.shadowRoot)==null?void 0:a.getElementById(n);i&&(i.focus(),i.scrollIntoView({behavior:"smooth",block:"nearest"}))}render(){return r.h(r.Host,{key:"da122e12f7a101e73a49fc19189722f8aa2a5802"},r.h("div",{key:"f922740d77d8bda81491d28215dc0a9f2fa0fc18",class:"time-picker",part:"time-picker"},r.h("input",{key:"eaae1354a88421a510036693c72b9dffbc68cd06",type:"text",name:this.name,id:this.name,part:"time-input",class:{"time-input":!0,error:!!this.err||this.hasError},ref:e=>this.timeInput=e,value:this.time,onClick:()=>{this.showTimes=!this.showTimes,this.shouldAutoScroll=!0},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.showTimes?"true":"false",placeholder:this.placeholder,onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e),onBlur:e=>this.handleTimeAutocomplete(e)}),this.err&&r.h("div",{class:"invalid-time-icon"}),this.showTimes&&r.h("div",{class:"times",part:"times",ref:e=>this.timeMenu=e},r.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.times.map(e=>r.h("li",{tabindex:"0",key:e.id,id:e.id.toString(),class:{focused:this.ariaActivedescendant===e.id.toString()},onClick:t=>{this.handleTimeChange(t,e.value),this.showTimes=!1,this.timeInput.focus()},role:"option"},`${e.value}`)))),!this.showTimes&&this.err&&r.h("p",{class:"error",id:"email-error"},this.err)))}get el(){return r.getElement(this)}static get watchers(){return{minimumStartTime:["minimumStartTimeChangedHandler"]}}};U.style=se;exports.nylas_time_window_picker=U;
|