@nylas/react 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-circle-icon_2.entry-f1383568.cjs → add-circle-icon_2.entry-b77120e5.cjs} +1 -1
- package/dist/{add-circle-icon_2.entry-611be49d.js → add-circle-icon_2.entry-fbc1e82b.js} +1 -1
- package/dist/{archive-icon_7.entry-5e6ba9e7.js → archive-icon_7.entry-30962e70.js} +13 -13
- package/dist/{archive-icon_7.entry-59cc6868.cjs → archive-icon_7.entry-dd8c7642.cjs} +1 -1
- package/dist/{arrow-icon.entry-a924df13.cjs → arrow-icon.entry-2dfd8319.cjs} +1 -1
- package/dist/{arrow-icon.entry-9c19a803.js → arrow-icon.entry-5b436054.js} +1 -1
- package/dist/{bold-icon_3.entry-2935a3df.js → bold-icon_3.entry-5120a9c8.js} +3 -3
- package/dist/{bold-icon_3.entry-ffe02f93.cjs → bold-icon_3.entry-da2d1270.cjs} +1 -1
- package/dist/{button-component_2.entry-b9d3f6a2.cjs → button-component_2.entry-27a504d9.cjs} +1 -1
- package/dist/{button-component_2.entry-93aa59a2.js → button-component_2.entry-697bf5ac.js} +7 -7
- package/dist/{calendar-agenda-fill-icon_48.entry-476bc4ef.js → calendar-agenda-fill-icon_51.entry-52b5bf31.js} +990 -910
- package/dist/calendar-agenda-fill-icon_51.entry-a25262b3.cjs +7 -0
- package/dist/{calendar-cancel-icon.entry-11bb8656.cjs → calendar-cancel-icon.entry-c6e2eed6.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-ee0acc54.js → calendar-cancel-icon.entry-e6a433a2.js} +1 -1
- package/dist/{calendar-check-icon_2.entry-14548656.cjs → calendar-check-icon_2.entry-45cad6f1.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-54a82e1e.js → calendar-check-icon_2.entry-d88307d6.js} +1 -1
- package/dist/{calendar-icon.entry-29f7003b.js → calendar-icon.entry-2badc962.js} +1 -1
- package/dist/{calendar-icon.entry-1a17f887.cjs → calendar-icon.entry-b2fffd21.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-84a17232.cjs → checkbox-component_2.entry-3926b644.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-dfec10cb.js → checkbox-component_2.entry-5ab55050.js} +3 -3
- package/dist/{chevron-icon_3.entry-5da08d02.cjs → chevron-icon_3.entry-1fe5d097.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-826e81d4.js → chevron-icon_3.entry-664fae5d.js} +5 -5
- package/dist/{clock-icon_4.entry-dafdd895.cjs → clock-icon_4.entry-efec2c08.cjs} +1 -1
- package/dist/{clock-icon_4.entry-36d97f00.js → clock-icon_4.entry-f11f9dad.js} +13 -13
- package/dist/{constants-50c3e067-fed7fb48.js → constants-50c3e067-33cf0ffe.js} +1 -1
- package/dist/{constants-50c3e067-1fe54cf3.cjs → constants-50c3e067-5ec3f879.cjs} +1 -1
- package/dist/{copy-icon.entry-eec265da.cjs → copy-icon.entry-3965f206.cjs} +1 -1
- package/dist/{copy-icon.entry-6d1a649d.js → copy-icon.entry-70131e8e.js} +1 -1
- package/dist/{delete-icon_2.entry-160ba41e.cjs → delete-icon.entry-5d067fef.cjs} +1 -1
- package/dist/{delete-icon_2.entry-528a3879.js → delete-icon.entry-e003695d.js} +4 -14
- package/dist/{document-refresh-icon.entry-276704dc.cjs → document-refresh-icon.entry-30c974df.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-6565f3b5.js → document-refresh-icon.entry-b4e01cd4.js} +1 -1
- package/dist/elements/index.d.ts +2 -0
- package/dist/{elements-dc5b338e-2d3857dc.js → elements-dc5b338e-55823d00.js} +1 -1
- package/dist/{elements-dc5b338e-b06b2857.cjs → elements-dc5b338e-6883a39e.cjs} +1 -1
- package/dist/feedbackSync-81d4c4d8-dd4d2e32.js +11735 -0
- package/dist/feedbackSync-81d4c4d8-f4e78902.cjs +455 -0
- package/dist/{focus-visible-e8093c16-47e61336.cjs → focus-visible-e8093c16-431bbe59.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-6f68eb89.js → focus-visible-e8093c16-f403fee8.js} +1 -1
- package/dist/{forward-icon_6.entry-ed6ab66a.js → forward-icon_6.entry-3bb91d58.js} +7 -7
- package/dist/{forward-icon_6.entry-fed8994d.cjs → forward-icon_6.entry-ceec2371.cjs} +3 -3
- package/dist/{globe-icon.entry-154ccdb5.js → globe-icon.entry-6fc456c7.js} +5 -5
- package/dist/{globe-icon.entry-95fc0408.cjs → globe-icon.entry-8c3c9e48.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-4eb16cd2.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-68cfa3fe.js → google-logo-icon_4.entry-d6e0c4c0.js} +331 -289
- package/dist/index-11f33e47.cjs +82 -0
- package/dist/{index-1322d804.js → index-a282e817.js} +2890 -2792
- package/dist/{index.es-79f5b771-08cc349d.cjs → index.es-ab9affcc-18263b66.cjs} +1 -1
- package/dist/{index.es-79f5b771-04cd3414.js → index.es-ab9affcc-30461b18.js} +1 -1
- package/dist/{info-icon_2.entry-49261a0a.js → info-icon_2.entry-d20b975c.js} +5 -5
- package/dist/{info-icon_2.entry-2af880b8.cjs → info-icon_2.entry-e582ac10.cjs} +1 -1
- package/dist/{input-color-picker.entry-aefe0e26.js → input-color-picker.entry-27f4288f.js} +3 -3
- package/dist/{input-color-picker.entry-57adff77.cjs → input-color-picker.entry-c6a28671.cjs} +1 -1
- package/dist/{input-component.entry-09c3c9b6.cjs → input-component.entry-744fcec1.cjs} +1 -1
- package/dist/{input-component.entry-d7c2724b.js → input-component.entry-b6f1c417.js} +2 -2
- package/dist/{input-dropdown.entry-e573ade0.js → input-dropdown.entry-18744def.js} +2 -2
- package/dist/{input-dropdown.entry-e7d26273.cjs → input-dropdown.entry-f13234d7.cjs} +1 -1
- package/dist/{mailbox-store-9c52a3fa-6b39645f.cjs → mailbox-store-affca6de-9451094e.cjs} +1 -1
- package/dist/{mailbox-store-9c52a3fa-27f8f7e6.js → mailbox-store-affca6de-d601dc6b.js} +2 -2
- package/dist/{multi-select-dropdown.entry-15cacb87.js → multi-select-dropdown.entry-924809e1.js} +5 -5
- package/dist/{multi-select-dropdown.entry-46b2b1c9.cjs → multi-select-dropdown.entry-dde671d7.cjs} +1 -1
- package/dist/{nylas-booked-event-card_12.entry-3921071a.js → nylas-booked-event-card_12.entry-52c3111d.js} +62 -60
- package/dist/nylas-booked-event-card_12.entry-d89c1f9d.cjs +1 -0
- package/dist/{nylas-form-card.entry-db3f0e3b.cjs → nylas-form-card.entry-ab61fdc5.cjs} +1 -1
- package/dist/{nylas-form-card.entry-ca835017.js → nylas-form-card.entry-b0a2403f.js} +8 -8
- package/dist/{nylas-if-state.entry-4159d41d.js → nylas-if-state.entry-523fdc6b.js} +2 -2
- package/dist/{nylas-if-state.entry-5410607c.cjs → nylas-if-state.entry-53883c36.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-0f143930.cjs → nylas-list-folders.entry-4ef6cb3d.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-6b4a3d96.js → nylas-list-folders.entry-e37d069f.js} +8 -8
- package/dist/{nylas-list-threads.entry-68b6f32b.cjs → nylas-list-threads.entry-3be623e9.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-62108562.js → nylas-list-threads.entry-8ba62db8.js} +3 -3
- package/dist/{nylas-login.entry-f1d7bc7d.cjs → nylas-login.entry-05e1df3e.cjs} +1 -1
- package/dist/{nylas-login.entry-590e7fba.js → nylas-login.entry-d9bf3974.js} +5 -5
- package/dist/{nylas-mailbox-pagination.entry-8377fdee.cjs → nylas-mailbox-pagination.entry-3dd05cf4.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-ba1af8fb.js → nylas-mailbox-pagination.entry-50d9d9e3.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-4497acd0.js → nylas-mailbox-toolbar-button.entry-9a77d137.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-6a5d8387.cjs → nylas-mailbox-toolbar-button.entry-d87b55de.cjs} +1 -1
- package/dist/{nylas-mailbox.entry-917c22f5.js → nylas-mailbox.entry-cb7d1031.js} +3 -3
- package/dist/{nylas-mailbox.entry-a07652b4.cjs → nylas-mailbox.entry-f7db9aa8.cjs} +1 -1
- package/dist/{nylas-provider.entry-0e520ac3.cjs → nylas-provider.entry-1716bf48.cjs} +1 -1
- package/dist/{nylas-provider.entry-20c47b14.js → nylas-provider.entry-7aa46ea2.js} +37 -37
- package/dist/{nylas-reminder-emails.entry-69626e7f.cjs → nylas-reminder-emails.entry-88a862cd.cjs} +2 -2
- package/dist/{nylas-reminder-emails.entry-088ee120.js → nylas-reminder-emails.entry-a86231b7.js} +5 -5
- package/dist/{nylas-reminder-time_2.entry-0357f280.js → nylas-reminder-time_2.entry-9589d5f2.js} +4 -4
- package/dist/{nylas-reminder-time_2.entry-b5c181db.cjs → nylas-reminder-time_2.entry-bc76d4ab.cjs} +1 -1
- package/dist/{nylas-scheduler-editor.entry-d2c3bddc.cjs → nylas-scheduler-editor.entry-1a2f3ee0.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-6bb290ed.js → nylas-scheduler-editor.entry-b434b526.js} +7 -7
- package/dist/nylas-scheduling.entry-59e5e8c1.cjs +1 -0
- package/dist/nylas-scheduling.entry-b71080c8.js +400 -0
- package/dist/{nylas-threads-refresh.entry-45d7d171.js → nylas-threads-refresh.entry-544ca90a.js} +2 -2
- package/dist/{nylas-threads-refresh.entry-6636e7b1.cjs → nylas-threads-refresh.entry-7ada7b2d.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-4460aa9b.js → nylas-threads-search.entry-181ba46a.js} +17 -17
- package/dist/{nylas-threads-search.entry-ae87695a.cjs → nylas-threads-search.entry-f1cb19e4.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-1b449403.cjs → nylas-time-window-picker.entry-a6d1c648.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-260f52a6.js → nylas-time-window-picker.entry-c1ee860a.js} +2 -2
- package/dist/{nylas-view-thread.entry-5a9b353a.cjs → nylas-view-thread.entry-6ae8dd64.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-5821630b.js → nylas-view-thread.entry-c066f522.js} +6 -6
- package/dist/{person-icon.entry-b4ce06b7.cjs → person-icon.entry-80c9022e.cjs} +1 -1
- package/dist/{person-icon.entry-ed6786db.js → person-icon.entry-8833e3cc.js} +4 -4
- package/dist/{play-icon_2.entry-87fe39a9.cjs → play-icon_2.entry-801c85bc.cjs} +1 -1
- package/dist/{play-icon_2.entry-261ea828.js → play-icon_2.entry-efca8f00.js} +3 -3
- package/dist/react.cjs +1 -1
- package/dist/react.js +118 -116
- package/dist/{refresh-icon.entry-87af05b0.js → refresh-icon.entry-4d6791bd.js} +4 -4
- package/dist/{refresh-icon.entry-21ac359d.cjs → refresh-icon.entry-d4cc16b7.cjs} +1 -1
- package/dist/{register-component-ea95564d-a64ee107.cjs → register-component-a7ea27ad-2343f3df.cjs} +1 -1
- package/dist/{register-component-ea95564d-843da1da.js → register-component-a7ea27ad-fa2c4b17.js} +1 -1
- package/dist/{scheduler-config-store-2a3b403d-88840eb1.cjs → scheduler-config-store-2a3b403d-2263f999.cjs} +1 -1
- package/dist/{scheduler-config-store-2a3b403d-8553b685.js → scheduler-config-store-2a3b403d-5176cd45.js} +1 -1
- package/dist/{scheduler-store-9ff4914b-d1a624f8.js → scheduler-store-33ab8dea-9801357a.js} +2 -2
- package/dist/scheduler-store-33ab8dea-a0b39d36.cjs +1 -0
- package/dist/{textarea-component.entry-cbffb0b0.cjs → textarea-component.entry-019e75d0.cjs} +1 -1
- package/dist/{textarea-component.entry-dad42f20.js → textarea-component.entry-174089bc.js} +2 -2
- package/dist/{time-period-selector.entry-79c94da3.js → time-period-selector.entry-62c854d1.js} +4 -4
- package/dist/{time-period-selector.entry-e54d0989.cjs → time-period-selector.entry-8466d0f2.cjs} +1 -1
- package/dist/{translate-icon.entry-ef6266c4.js → translate-icon.entry-73f7127b.js} +4 -4
- package/dist/{translate-icon.entry-8e9eeeba.cjs → translate-icon.entry-7d5cf4b8.cjs} +1 -1
- package/dist/{warning-icon.entry-34c85de2.cjs → warning-icon.entry-92638eeb.cjs} +1 -1
- package/dist/{warning-icon.entry-adf18211.js → warning-icon.entry-abf896c3.js} +5 -5
- package/package.json +2 -2
- package/dist/calendar-agenda-fill-icon_48.entry-c4ea84b3.cjs +0 -7
- package/dist/google-logo-icon_4.entry-afffb209.cjs +0 -1
- package/dist/index-c4e817ef.cjs +0 -82
- package/dist/nylas-booked-event-card_12.entry-47c5381d.cjs +0 -1
- package/dist/nylas-scheduling.entry-bc9c25c5.js +0 -359
- package/dist/nylas-scheduling.entry-dc92d5e7.cjs +0 -1
- package/dist/scheduler-store-9ff4914b-63dc472a.cjs +0 -1
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { k as u, r as G, c as x, d as F, l as D, m as Y, n as J, h as n, H as C, g as K, F as H } from "./index-a282e817.js";
|
|
2
|
+
import { n as L, N as Q } from "./index.es-ab9affcc-30461b18.js";
|
|
3
|
+
import { E as z, C as X, N as Z } from "./scheduler-store-33ab8dea-9801357a.js";
|
|
4
|
+
import { L as V, a as ee } from "./constants-50c3e067-33cf0ffe.js";
|
|
5
|
+
import { i as te, a as ne, r as ie, f as oe, c as se, b as ae } from "./feedbackSync-81d4c4d8-dd4d2e32.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
class re {
|
|
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), de = ':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}', le = de, $ = { title: u.t("genericErrorTitle"), type: L.Error, category: z.Component }, ce = 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.3",
|
|
82
|
+
integrations: [
|
|
83
|
+
ie(),
|
|
84
|
+
oe({
|
|
85
|
+
colorScheme: "system",
|
|
86
|
+
autoInject: !1
|
|
87
|
+
})
|
|
88
|
+
],
|
|
89
|
+
replaysSessionSampleRate: 0.1,
|
|
90
|
+
replaysOnErrorSampleRate: 0.1
|
|
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 re({
|
|
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: se("Scheduling Page User Feedback"),
|
|
281
|
+
message: t.detail.feedback
|
|
282
|
+
};
|
|
283
|
+
ae(i, {
|
|
284
|
+
includeReplay: !0,
|
|
285
|
+
captureContext: {
|
|
286
|
+
tags: {
|
|
287
|
+
"nylas-web-element": "nylas-schduling",
|
|
288
|
+
"nylas-web-element-version": "1.1.3"
|
|
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
|
+
ce.style = le;
|
|
398
|
+
export {
|
|
399
|
+
ce as nylas_scheduling
|
|
400
|
+
};
|
package/dist/{nylas-threads-refresh.entry-45d7d171.js → nylas-threads-refresh.entry-544ca90a.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as f, c as p, d as i, h as o, H as u } from "./index-
|
|
2
|
-
import { R as m } from "./register-component-
|
|
1
|
+
import { r as f, c as p, d as i, h as o, H as u } from "./index-a282e817.js";
|
|
2
|
+
import { R as m } from "./register-component-a7ea27ad-fa2c4b17.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
const g = ":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}", y = g;
|
package/dist/{nylas-threads-refresh.entry-6636e7b1.cjs → nylas-threads-refresh.entry-7ada7b2d.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-11f33e47.cjs"),d=require("./register-component-a7ea27ad-2343f3df.cjs");require("react");require("react-dom");const f=":host{display:contents}.container{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pull-to-refresh{display:none;border:0;background-color:transparent;text-align:center;width:100%;justify-content:center}.pulling{position:relative;display:flex;margin:0 auto;padding:1rem}.pulling svg{width:24px;height:24px;color:var(--nylas-color-primary-500);transform:rotate(90deg)}.refreshing{position:relative;display:flex;margin:0 auto;padding:1rem}.refreshing svg{width:24px;height:24px;fill:var(--nylas-color-primary-500);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}",u=f;var p=function(t,e,n,a){var i=arguments.length,r=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,a);else for(var h=t.length-1;h>=0;h--)(o=t[h])&&(r=(i<3?o(r):i>3?o(e,n,r):o(e,n))||r);return i>3&&r&&Object.defineProperty(e,n,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const c=class{constructor(t){s.registerInstance(this,t),this.refresh=s.createEvent(this,"refresh",7),this.threshold=100,this.onTouchStart=e=>{var n,a,i,r;s.debug("[nylas-threads-refresh] Touch start",e.touches[0].pageY,(n=this.containerElement)==null?void 0:n.scrollTop,(a=this.containerElement)==null?void 0:a.offsetHeight,(i=this.contentElement)==null?void 0:i.scrollTop),((r=this.containerElement)==null?void 0:r.scrollTop)===0?this.start=e.touches[0].pageY:this.start=0},this.onTouchMove=e=>{this.start&&(e.touches[0].pageY-this.start>this.threshold?this.pulling=!0:this.pulling=!1)},this.onTouchEnd=e=>{this.start&&(e.changedTouches[0].pageY-this.start>this.threshold&&(this.pulling=!1,this.refresh.emit({updateState:this.updateState})),this.start=0)},this.start=0,this.state="ready",this.pulling=!1,s.debug("[nylas-threads-refresh] Constructor"),this.updateState=this.updateState.bind(this)}connectedCallback(){}async componentWillLoad(){s.debug("[nylas-threads-refresh] Component will load")}componentDidLoad(){var t,e,n;s.debug("[nylas-threads-refresh] Component did load"),(t=this.containerElement)==null||t.addEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.addEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.addEventListener("touchend",this.onTouchEnd)}disconnectedCallback(){var t,e,n;s.debug("[nylas-threads-refresh] Component disconnected"),(t=this.containerElement)==null||t.removeEventListener("touchstart",this.onTouchStart),(e=this.containerElement)==null||e.removeEventListener("touchmove",this.onTouchMove),(n=this.containerElement)==null||n.removeEventListener("touchend",this.onTouchEnd)}async updateState(t){this.state=t}render(){return s.h(s.Host,{key:"0e7150c1fd50e5422e124ac007132ae2ecc0006b"},s.h("div",{key:"730765ce38847fdbe691f2b9cfeda44e1a46259b",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"55427e329f0405960f22f736f10722e620931516",class:{"pull-to-refresh":!0,pulling:this.pulling,refreshing:this.state==="loading"},"aria-label":"Refreshing..."},this.state==="loading"&&s.h("refresh-icon",{slot:"icon"}),this.state!=="loading"&&s.h("arrow-icon",{slot:"icon"})),s.h("div",{key:"585886ff635733f5e0398ca9cfe11944860f5a61",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"f61cab9fae1aae81ecb0e7a6544ddb4b845c91b4"}))))}};p([d.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{s.debug("[nylas-threads-refresh] Refreshing threads");const{updateState:n}=t.detail;await n("loading"),await e.threads.getThreads(void 0,"overwrite",!1),await n("ready")}},fireRegisterEvent:!0}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],c.prototype,"render",null);c.style=u;exports.nylas_threads_refresh=c;
|
package/dist/{nylas-threads-search.entry-4460aa9b.js → nylas-threads-search.entry-181ba46a.js}
RENAMED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { r as u, c as
|
|
2
|
-
import { R as p } from "./register-component-
|
|
1
|
+
import { r as u, c as f, d, h as i, H as y } from "./index-a282e817.js";
|
|
2
|
+
import { R as p } from "./register-component-a7ea27ad-fa2c4b17.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
const m = ":host{display:block}sp-search{width:100%;border:0}",
|
|
6
|
-
var
|
|
7
|
-
var s = arguments.length, a = s < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r,
|
|
5
|
+
const m = ":host{display:block}sp-search{width:100%;border:0}", g = m;
|
|
6
|
+
var b = function(t, e, n, r) {
|
|
7
|
+
var s = arguments.length, a = s < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, c;
|
|
8
8
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
9
9
|
a = Reflect.decorate(t, e, n, r);
|
|
10
10
|
else
|
|
11
|
-
for (var
|
|
12
|
-
(
|
|
11
|
+
for (var o = t.length - 1; o >= 0; o--)
|
|
12
|
+
(c = t[o]) && (a = (s < 3 ? c(a) : s > 3 ? c(e, n, a) : c(e, n)) || a);
|
|
13
13
|
return s > 3 && a && Object.defineProperty(e, n, a), a;
|
|
14
|
-
},
|
|
14
|
+
}, l = function(t, e) {
|
|
15
15
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
16
16
|
return Reflect.metadata(t, e);
|
|
17
17
|
};
|
|
18
18
|
const h = class {
|
|
19
19
|
constructor(t) {
|
|
20
|
-
u(this, t), this.search =
|
|
20
|
+
u(this, t), this.search = f(this, "search", 7), this.onSearch = async (e) => {
|
|
21
21
|
e.preventDefault(), e.stopPropagation();
|
|
22
22
|
const r = e.target.value;
|
|
23
23
|
r !== this.internalQuery && (this.internalQuery = r, this.search.emit(this.internalQuery));
|
|
@@ -28,16 +28,16 @@ const h = class {
|
|
|
28
28
|
disconnectedCallback() {
|
|
29
29
|
}
|
|
30
30
|
async componentWillLoad() {
|
|
31
|
-
|
|
31
|
+
d("[nylas-threads-search] Component will load");
|
|
32
32
|
}
|
|
33
33
|
async componentDidLoad() {
|
|
34
|
-
|
|
34
|
+
d("[nylas-threads-search] Component did load");
|
|
35
35
|
}
|
|
36
36
|
onQueryChange() {
|
|
37
37
|
this.internalQuery = this.query;
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
|
-
return i(
|
|
40
|
+
return i(y, { key: "4dcde242d462f487fc890d3759e88909a008de2a" }, i("sp-theme", { key: "713bd18cb67ee2a7accc44c03439c06a5f787214", scale: "medium", color: "dark" }, i("sp-search", { key: "29f18fddeff1bfc8424ce9afdc6a238ef2dfbc7a", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
|
|
41
41
|
}
|
|
42
42
|
static get watchers() {
|
|
43
43
|
return {
|
|
@@ -45,7 +45,7 @@ const h = class {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
b([
|
|
49
49
|
p({
|
|
50
50
|
name: "nylas-pagination",
|
|
51
51
|
stateToProps: /* @__PURE__ */ new Map([["mailbox.searchQuery", "query"]]),
|
|
@@ -59,11 +59,11 @@ g([
|
|
|
59
59
|
},
|
|
60
60
|
fireRegisterEvent: !0
|
|
61
61
|
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
l("design:type", Function),
|
|
63
|
+
l("design:paramtypes", []),
|
|
64
|
+
l("design:returntype", void 0)
|
|
65
65
|
], h.prototype, "render", null);
|
|
66
|
-
h.style =
|
|
66
|
+
h.style = g;
|
|
67
67
|
export {
|
|
68
68
|
h as nylas_threads_search
|
|
69
69
|
};
|
package/dist/{nylas-threads-search.entry-ae87695a.cjs → nylas-threads-search.entry-f1cb19e4.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-11f33e47.cjs"),h=require("./register-component-a7ea27ad-2343f3df.cjs");require("react");require("react-dom");const u=":host{display:block}sp-search{width:100%;border:0}",y=u;var f=function(t,e,s,n){var c=arguments.length,r=c<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,s,n);else for(var i=t.length-1;i>=0;i--)(o=t[i])&&(r=(c<3?o(r):c>3?o(e,s,r):o(e,s))||r);return c>3&&r&&Object.defineProperty(e,s,r),r},d=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const l=class{constructor(t){a.registerInstance(this,t),this.search=a.createEvent(this,"search",7),this.onSearch=async e=>{e.preventDefault(),e.stopPropagation();const n=e.target.value;n!==this.internalQuery&&(this.internalQuery=n,this.search.emit(this.internalQuery))},this.query="",this.internalQuery=""}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){a.debug("[nylas-threads-search] Component will load")}async componentDidLoad(){a.debug("[nylas-threads-search] Component did load")}onQueryChange(){this.internalQuery=this.query}render(){return a.h(a.Host,{key:"4dcde242d462f487fc890d3759e88909a008de2a"},a.h("sp-theme",{key:"713bd18cb67ee2a7accc44c03439c06a5f787214",scale:"medium",color:"dark"},a.h("sp-search",{key:"29f18fddeff1bfc8424ce9afdc6a238ef2dfbc7a",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};f([h.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.searchQuery","query"]]),eventToProps:{search:async(t,e)=>{await e.threads.getThreads({search_query_native:t.detail||void 0,page_token:void 0})}},fireRegisterEvent:!0}),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],l.prototype,"render",null);l.style=y;exports.nylas_threads_search=l;
|
|
@@ -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-11f33e47.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:"e1c5707b5e5a4d23b5364fea84fc0efd9ab07e1b"},r.h("div",{key:"94bda14e4f86578357094c83c0aeb23bbc3e8181",class:"time-picker",part:"time-picker"},r.h("input",{key:"16a4f6a085a751aa864f555a8d86dc83cebdcc03",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,4 +1,4 @@
|
|
|
1
|
-
import { i as ae, Z as C, r as oe, c as X, _ as B, $ as V, a0 as G, a1 as q, h as k, H as he, g as me } from "./index-
|
|
1
|
+
import { i as ae, Z as C, r as oe, c as X, _ as B, $ as V, a0 as G, a1 as q, h as k, H as he, g as me } from "./index-a282e817.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
var J = { exports: {} };
|
|
@@ -290,7 +290,7 @@ const ue = class {
|
|
|
290
290
|
i && (i.focus(), i.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
291
291
|
}
|
|
292
292
|
render() {
|
|
293
|
-
return k(he, { key: "
|
|
293
|
+
return k(he, { key: "e1c5707b5e5a4d23b5364fea84fc0efd9ab07e1b" }, k("div", { key: "94bda14e4f86578357094c83c0aeb23bbc3e8181", class: "time-picker", part: "time-picker" }, k("input", { key: "16a4f6a085a751aa864f555a8d86dc83cebdcc03", type: "text", name: this.name, id: this.name, part: "time-input", class: {
|
|
294
294
|
"time-input": !0,
|
|
295
295
|
error: !!this.err || this.hasError
|
|
296
296
|
}, ref: (e) => this.timeInput = e, value: this.time, onClick: () => {
|