@nylas/react 1.1.0-canary.23 → 1.1.0-canary.25
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/README.md +110 -2
- package/dist/add-circle-icon_2.entry-7165bd0e.js +25 -0
- package/dist/add-circle-icon_2.entry-f1ddca18.cjs +1 -0
- package/dist/{archive-icon_7.entry-3dcc4a66.js → archive-icon_7.entry-7411c224.js} +18 -18
- package/dist/{archive-icon_7.entry-2ec9b077.cjs → archive-icon_7.entry-e3df60ed.cjs} +1 -1
- package/dist/{arrow-icon.entry-175e8181.cjs → arrow-icon.entry-280e18b0.cjs} +1 -1
- package/dist/arrow-icon.entry-38949317.js +15 -0
- package/dist/{bold-icon_3.entry-9fc74a39.js → bold-icon_3.entry-5963945c.js} +4 -4
- package/dist/{bold-icon_3.entry-a3e61ad8.cjs → bold-icon_3.entry-5dffbedd.cjs} +1 -1
- package/dist/button-component_2.entry-237733b4.js +26 -0
- package/dist/button-component_2.entry-b29d2873.cjs +1 -0
- package/dist/{calendar-agenda-fill-icon_39.entry-493e91f6.js → calendar-agenda-fill-icon_48.entry-9afba869.js} +1982 -1420
- package/dist/calendar-agenda-fill-icon_48.entry-d3830dbb.cjs +7 -0
- package/dist/{calendar-cancel-icon.entry-c9c7e3b3.cjs → calendar-cancel-icon.entry-77ccf227.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-3ca731f9.js → calendar-cancel-icon.entry-780723a6.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-7c409a91.js → calendar-check-icon_2.entry-2c89c230.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-5b8f8a75.cjs → calendar-check-icon_2.entry-b37ac7f0.cjs} +1 -1
- package/dist/{calendar-icon.entry-0589697f.js → calendar-icon.entry-02dd3990.js} +5 -5
- package/dist/{calendar-icon.entry-acd00f6f.cjs → calendar-icon.entry-ffc93569.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-0aa252b9.cjs → checkbox-component_2.entry-00b6a1e9.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-538fd8ec.js → checkbox-component_2.entry-ee9d0e6c.js} +3 -3
- package/dist/{chevron-icon_3.entry-7076e105.cjs → chevron-icon_3.entry-468abc26.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-80e03257.js → chevron-icon_3.entry-f62e9ef1.js} +8 -8
- package/dist/{clock-icon_4.entry-db3fbda1.js → clock-icon_4.entry-766a1b23.js} +17 -17
- package/dist/{clock-icon_4.entry-d6901afd.cjs → clock-icon_4.entry-7dc2cc4a.cjs} +1 -1
- package/dist/{constants-12bd3c98-26c75011.js → constants-50c3e067-8a40a5fe.js} +618 -605
- package/dist/{constants-12bd3c98-22fd56f2.cjs → constants-50c3e067-9f2a6372.cjs} +5 -5
- package/dist/copy-icon.entry-2a841508.js +15 -0
- package/dist/copy-icon.entry-e5251410.cjs +1 -0
- package/dist/delete-icon_2.entry-1a5c39dc.cjs +1 -0
- package/dist/delete-icon_2.entry-64555a2f.js +25 -0
- package/dist/document-refresh-icon.entry-4bf6398b.js +15 -0
- package/dist/document-refresh-icon.entry-fdc7ddda.cjs +1 -0
- package/dist/elements/index.d.ts +9 -1
- package/dist/{elements-dc5b338e-e07600d4.js → elements-dc5b338e-2da1fe61.js} +1 -1
- package/dist/{elements-dc5b338e-211879a3.cjs → elements-dc5b338e-c8016c3d.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-cb97634f.cjs → focus-visible-e8093c16-0a38a184.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-284cefe0.js → focus-visible-e8093c16-9d0c98c0.js} +1 -1
- package/dist/{forward-icon_6.entry-554b0722.js → forward-icon_6.entry-390ef70a.js} +9 -9
- package/dist/{forward-icon_6.entry-751fdd4e.cjs → forward-icon_6.entry-7238ef38.cjs} +3 -3
- package/dist/{globe-icon.entry-63eb510d.cjs → globe-icon.entry-81f42f89.cjs} +1 -1
- package/dist/{globe-icon.entry-e3dd58bc.js → globe-icon.entry-8d106260.js} +5 -5
- package/dist/google-logo-icon_4.entry-aabd3886.js +680 -0
- package/dist/google-logo-icon_4.entry-fa2b8999.cjs +1 -0
- package/dist/index-53420959-5fc8ad2b.js +5 -0
- package/dist/index-53420959-fcf45780.cjs +1 -0
- package/dist/index-5ccfd9df.js +7859 -0
- package/dist/{index-6d9eeb53-cc42c6f1.js → index-6d9eeb53-58c8980a.js} +2 -2
- package/dist/{index-6d9eeb53-81e5b798.cjs → index-6d9eeb53-b2a6d09f.cjs} +1 -1
- package/dist/index-eb33703c.cjs +42 -0
- package/dist/{index.es-5355a265-f8853ce4.js → index.es-c9454237-00ccd1e6.js} +1 -1
- package/dist/{index.es-5355a265-e701a627.cjs → index.es-c9454237-b64161d1.cjs} +1 -1
- package/dist/{info-icon_2.entry-9559cf3b.cjs → info-icon_2.entry-b2e11336.cjs} +1 -1
- package/dist/{info-icon_2.entry-3b349f01.js → info-icon_2.entry-bb8ed71c.js} +7 -7
- package/dist/input-component.entry-378b1ccc.cjs +1 -0
- package/dist/{add-circle-icon_3.entry-37a88ff3.js → input-component.entry-cb86170f.js} +19 -33
- package/dist/input-dropdown.entry-98954c93.cjs +1 -0
- package/dist/{input-dropdown.entry-9bc68630.js → input-dropdown.entry-a76c339e.js} +8 -6
- package/dist/{mailbox-store-31d55036-c8618c0b.cjs → mailbox-store-edc386fc-156b7236.cjs} +1 -1
- package/dist/{mailbox-store-31d55036-1106efe2.js → mailbox-store-edc386fc-8bc7558b.js} +2 -2
- package/dist/{multi-select-dropdown.entry-e5ed9285.cjs → multi-select-dropdown.entry-40b855e1.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-36074a81.js → multi-select-dropdown.entry-6b686695.js} +2 -2
- package/dist/nylas-booked-event-card_12.entry-9d693125.cjs +1 -0
- package/dist/nylas-booked-event-card_12.entry-e861bb16.js +1134 -0
- package/dist/{nylas-form-card.entry-6e45c873.js → nylas-form-card.entry-b158d789.js} +19 -19
- package/dist/{nylas-form-card.entry-03a31218.cjs → nylas-form-card.entry-ca4a8746.cjs} +1 -1
- package/dist/{nylas-if-state.entry-092f4e1a.js → nylas-if-state.entry-8e4d922c.js} +8 -8
- package/dist/{nylas-if-state.entry-61d7ebc5.cjs → nylas-if-state.entry-95fac42d.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-ab9e1c2c.js → nylas-list-folders.entry-83c39684.js} +3 -3
- package/dist/{nylas-list-folders.entry-1abbb401.cjs → nylas-list-folders.entry-8a22e0c8.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-dfc87aca.cjs → nylas-list-threads.entry-54c582af.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-2faaa2bb.js → nylas-list-threads.entry-7ea370e1.js} +3 -3
- package/dist/{nylas-login.entry-243ae09e.js → nylas-login.entry-9115fd81.js} +3 -3
- package/dist/{nylas-login.entry-d1cac0a1.cjs → nylas-login.entry-fb627e40.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-c27af71c.cjs → nylas-mailbox-pagination.entry-04626d27.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-b8225a3e.js → nylas-mailbox-pagination.entry-3ff02cf9.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-b66d597d.cjs → nylas-mailbox-toolbar-button.entry-8d00c789.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-22347d22.js → nylas-mailbox-toolbar-button.entry-f752e925.js} +7 -7
- package/dist/{nylas-mailbox.entry-9e6e1b4d.js → nylas-mailbox.entry-99c27b6c.js} +4 -4
- package/dist/{nylas-mailbox.entry-cb80f58c.cjs → nylas-mailbox.entry-b3974f4e.cjs} +1 -1
- package/dist/{nylas-provider.entry-28c12448.cjs → nylas-provider.entry-a3ad02a5.cjs} +1 -1
- package/dist/{nylas-provider.entry-196dd5da.js → nylas-provider.entry-c206aa32.js} +39 -39
- package/dist/{nylas-reminder-emails.entry-b655d888.js → nylas-reminder-emails.entry-414ce6fe.js} +6 -6
- package/dist/nylas-reminder-emails.entry-59c07bfe.cjs +4 -0
- package/dist/{nylas-reminder-time_2.entry-9d8f7436.js → nylas-reminder-time_2.entry-197d83a0.js} +5 -5
- package/dist/{nylas-reminder-time_2.entry-0f3747fb.cjs → nylas-reminder-time_2.entry-d79dcd85.cjs} +1 -1
- package/dist/{nylas-scheduler-editor.entry-feb7a7db.js → nylas-scheduler-editor.entry-7f389982.js} +49 -31
- package/dist/{nylas-scheduler-editor.entry-504e8ed3.cjs → nylas-scheduler-editor.entry-f1c6964a.cjs} +2 -2
- package/dist/nylas-scheduling.entry-1a8bd6fc.cjs +1 -0
- package/dist/nylas-scheduling.entry-4fa5381d.js +345 -0
- package/dist/{nylas-threads-refresh.entry-91af9af3.js → nylas-threads-refresh.entry-20602e7b.js} +4 -4
- package/dist/{nylas-threads-refresh.entry-e637161b.cjs → nylas-threads-refresh.entry-56b53449.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-5457dcec.js → nylas-threads-search.entry-8872473c.js} +8 -8
- package/dist/{nylas-threads-search.entry-b944f95a.cjs → nylas-threads-search.entry-8e0ec3ae.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-a6fd216b.js → nylas-time-window-picker.entry-9ac542b7.js} +10 -10
- package/dist/{nylas-time-window-picker.entry-134ef726.cjs → nylas-time-window-picker.entry-ca47f721.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-9296a505.cjs → nylas-view-thread.entry-1f758e43.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-6fdd6cb1.js → nylas-view-thread.entry-dcd3d5be.js} +3 -3
- package/dist/{person-icon.entry-1cdb4dc2.cjs → person-icon.entry-63b28ace.cjs} +1 -1
- package/dist/{person-icon.entry-4a695727.js → person-icon.entry-93130c05.js} +2 -2
- package/dist/play-icon_2.entry-6a99c32d.js +25 -0
- package/dist/play-icon_2.entry-b67fb649.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +108 -100
- package/dist/{refresh-icon.entry-46c92605.js → refresh-icon.entry-84783c91.js} +4 -4
- package/dist/{refresh-icon.entry-9dbb04ba.cjs → refresh-icon.entry-b49792fc.cjs} +1 -1
- package/dist/{register-component-592986c5-5edf5835.cjs → register-component-887199a9-003f96c5.cjs} +1 -1
- package/dist/{register-component-592986c5-d5d210a8.js → register-component-887199a9-b41dfa7a.js} +1 -1
- package/dist/{scheduler-config-store-9ccfba4d-b08031b5.js → scheduler-config-store-2a3b403d-73610089.js} +5 -4
- package/dist/scheduler-config-store-2a3b403d-a5e3433a.cjs +1 -0
- package/dist/{scheduler-store-fd0d11a5-313e8592.js → scheduler-store-fe281404-bddb1b6a.js} +179 -132
- package/dist/scheduler-store-fe281404-c3e477f6.cjs +1 -0
- package/dist/textarea-component.entry-28c4bc05.cjs +1 -0
- package/dist/textarea-component.entry-40e959e5.js +36 -0
- package/dist/time-period-selector.entry-af71523a.cjs +1 -0
- package/dist/{time-period-selector.entry-112c0b64.js → time-period-selector.entry-da5d8652.js} +41 -41
- package/dist/{translate-icon.entry-a4df3c16.js → translate-icon.entry-92b83635.js} +4 -4
- package/dist/{translate-icon.entry-c701b391.cjs → translate-icon.entry-a2ed4f76.cjs} +1 -1
- package/dist/{warning-icon.entry-d1703715.js → warning-icon.entry-19f721c3.js} +5 -5
- package/dist/{warning-icon.entry-bda0aafa.cjs → warning-icon.entry-3ab9a59e.cjs} +1 -1
- package/package.json +3 -3
- package/dist/add-circle-icon_3.entry-4f8f1cbf.cjs +0 -1
- package/dist/arrow-icon.entry-2cf3e94d.js +0 -15
- package/dist/button-component.entry-7fdb3bca.cjs +0 -1
- package/dist/button-component.entry-861637f2.js +0 -16
- package/dist/calendar-agenda-fill-icon_39.entry-3c21a3ec.cjs +0 -7
- package/dist/checkmark-icon.entry-0a184b31.cjs +0 -1
- package/dist/checkmark-icon.entry-56302db0.js +0 -15
- package/dist/copy-icon_3.entry-33e89a37.cjs +0 -1
- package/dist/copy-icon_3.entry-9670b9f9.js +0 -35
- package/dist/document-refresh-icon.entry-149f2a3b.js +0 -15
- package/dist/document-refresh-icon.entry-a3326831.cjs +0 -1
- package/dist/google-logo-icon_5.entry-bccce7f4.cjs +0 -1
- package/dist/google-logo-icon_5.entry-e462e091.js +0 -748
- package/dist/index-53420959-02fe58ef.js +0 -5
- package/dist/index-53420959-0b9c205e.cjs +0 -1
- package/dist/index-8a536089.cjs +0 -42
- package/dist/index-a15916e5.js +0 -7653
- package/dist/input-dropdown.entry-d454f6bc.cjs +0 -1
- package/dist/loading-icon.entry-1d49e471.js +0 -15
- package/dist/loading-icon.entry-a68da48b.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-38d2fd2e.js +0 -954
- package/dist/nylas-booked-event-card_10.entry-e530a8db.cjs +0 -1
- package/dist/nylas-booking-confirmation-type.entry-2fea82f9.js +0 -106
- package/dist/nylas-booking-confirmation-type.entry-5857a863.cjs +0 -1
- package/dist/nylas-reminder-emails.entry-47ef5a9d.cjs +0 -4
- package/dist/nylas-scheduling.entry-8c8f8e35.cjs +0 -1
- package/dist/nylas-scheduling.entry-d35efa9a.js +0 -286
- package/dist/play-icon_2.entry-10fd617e.cjs +0 -1
- package/dist/play-icon_2.entry-fb013b17.js +0 -25
- package/dist/scheduler-config-store-9ccfba4d-3ec35859.cjs +0 -1
- package/dist/scheduler-store-fd0d11a5-b180b3b7.cjs +0 -1
- package/dist/textarea-component.entry-0cd3b57f.js +0 -36
- package/dist/textarea-component.entry-788eb37a.cjs +0 -1
- package/dist/time-period-selector.entry-1e0b720b.cjs +0 -1
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { k as h, r as z, c as _, d as E, l as I, m as O, n as N, h as n, H as y, g as A, F as D } from "./index-5ccfd9df.js";
|
|
2
|
+
import { n as x, N as P } from "./index.es-c9454237-00ccd1e6.js";
|
|
3
|
+
import { E as B, C as F, N as S } from "./scheduler-store-fe281404-bddb1b6a.js";
|
|
4
|
+
import { L as j, a as M } from "./constants-50c3e067-8a40a5fe.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "react-dom";
|
|
7
|
+
class H {
|
|
8
|
+
constructor({ schedulerAPIURL: e, nylasSchedulerStore: i, sessionId: o, configId: s, slug: d, clientId: r }) {
|
|
9
|
+
if (!e)
|
|
10
|
+
throw new Error("schedulerAPIURL is required");
|
|
11
|
+
if (!i)
|
|
12
|
+
throw new Error("nylasSchedulerStore is required");
|
|
13
|
+
if (!o && !s && !(d || r))
|
|
14
|
+
throw new Error("sessionId is required for private configs. If using public config either pass a configurationId or a combination of slug and clientId.");
|
|
15
|
+
e === "/" && (e = new URL(window.location.href).origin), this.configId = s, this.sessionId = o, this.schedulerAPIURL = e, this.nylasSchedulerStore = i, this.slug = d, this.clientId = r;
|
|
16
|
+
}
|
|
17
|
+
init() {
|
|
18
|
+
E("NylasConnector init");
|
|
19
|
+
}
|
|
20
|
+
get schedulerStore() {
|
|
21
|
+
return this.nylasSchedulerStore;
|
|
22
|
+
}
|
|
23
|
+
get scheduler() {
|
|
24
|
+
return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new S({
|
|
25
|
+
schedulerAPIURL: this.schedulerAPIURL,
|
|
26
|
+
schedulerStore: this.schedulerStore,
|
|
27
|
+
sessionId: this.sessionId,
|
|
28
|
+
configId: this.configId,
|
|
29
|
+
slug: this.slug,
|
|
30
|
+
clientId: this.clientId
|
|
31
|
+
}), this._schedulerAPIConnector);
|
|
32
|
+
}
|
|
33
|
+
resetStores() {
|
|
34
|
+
this.nylasSchedulerStore.reset();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const k = (t, e) => {
|
|
38
|
+
const i = t.isLoading, o = t.showNotification, s = t.nylasBranding;
|
|
39
|
+
return n(
|
|
40
|
+
D,
|
|
41
|
+
null,
|
|
42
|
+
o && n("nylas-notification", null),
|
|
43
|
+
i && n(
|
|
44
|
+
"div",
|
|
45
|
+
{ class: "loading" },
|
|
46
|
+
n(
|
|
47
|
+
"div",
|
|
48
|
+
{ class: "left" },
|
|
49
|
+
n("div", { class: "skeleton" })
|
|
50
|
+
),
|
|
51
|
+
n(
|
|
52
|
+
"div",
|
|
53
|
+
{ class: "right" },
|
|
54
|
+
n("div", { class: "skeleton" }),
|
|
55
|
+
n("div", { class: "skeleton" }),
|
|
56
|
+
n("div", { class: "skeleton" }),
|
|
57
|
+
n("div", { class: "skeleton" }),
|
|
58
|
+
n("div", { class: "skeleton" })
|
|
59
|
+
)
|
|
60
|
+
),
|
|
61
|
+
!i && e,
|
|
62
|
+
n("div", { class: "footer" }, s && n(
|
|
63
|
+
D,
|
|
64
|
+
null,
|
|
65
|
+
"Powered by ",
|
|
66
|
+
n("nylas-logo", null)
|
|
67
|
+
))
|
|
68
|
+
);
|
|
69
|
+
}, L = (t, e) => n("div", { class: "message-banner" }, e), U = ':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}', W = U, T = { title: h.t("genericErrorTitle"), type: x.Error, category: B.Component }, $ = class {
|
|
70
|
+
constructor(t) {
|
|
71
|
+
z(this, t), this.init = _(this, "init", 7), this.schedulerWillLoad = _(this, "schedulerWillLoad", 7), this.schedulerDidLoad = _(this, "schedulerDidLoad", 7), this.nylasSchedulerError = _(this, "nylasSchedulerError", 7), this.configSettingsLoaded = _(this, "configSettingsLoaded", 7), this.bookingRefExtracted = _(this, "bookingRefExtracted", 7), this.bookedEventInfo = _(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.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || `${h.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language;
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
E("[nylas-scheduler] connectedCallback");
|
|
75
|
+
}
|
|
76
|
+
async componentWillLoad() {
|
|
77
|
+
var s, d;
|
|
78
|
+
E("[nylas-scheduler] Component will load");
|
|
79
|
+
const t = this.schedulerWillLoad.emit(this.host);
|
|
80
|
+
if ("schedulerWillLoad" in this.eventOverrides && (await this.eventOverrides.schedulerWillLoad(t, this.nylasSchedulerConnector), t.defaultPrevented))
|
|
81
|
+
return;
|
|
82
|
+
this.stores = {
|
|
83
|
+
scheduler: F({
|
|
84
|
+
bookingInfo: this.bookingInfo,
|
|
85
|
+
nylasBranding: this.nylasBranding,
|
|
86
|
+
...this.defaultSchedulerState
|
|
87
|
+
})
|
|
88
|
+
}, this.baseProvider = new P(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId;
|
|
89
|
+
let e;
|
|
90
|
+
if (this.rescheduleBookingRef) {
|
|
91
|
+
const [r, a, l] = I(this.rescheduleBookingRef);
|
|
92
|
+
this.refConfigId = r, this.stores.scheduler.set("rescheduleBookingId", a), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: a });
|
|
93
|
+
} else if (this.cancelBookingRef) {
|
|
94
|
+
const [r, a, l] = I(this.cancelBookingRef);
|
|
95
|
+
this.refConfigId = r, this.stores.scheduler.set("cancelBookingId", a), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: a });
|
|
96
|
+
} else if (this.organizerConfirmationBookingRef) {
|
|
97
|
+
const [r, a, l] = I(this.organizerConfirmationBookingRef);
|
|
98
|
+
this.refConfigId = r, this.stores.scheduler.set("organizerConfirmationBookingId", a), this.stores.scheduler.set("organizerConfirmationSalt", l), e = this.bookingRefExtracted.emit({ configurationId: r, bookingId: a, salt: l });
|
|
99
|
+
}
|
|
100
|
+
if ("bookingRefExtracted" in this.eventOverrides && (await this.eventOverrides.bookingRefExtracted(e, this.nylasSchedulerConnector), e.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
101
|
+
return;
|
|
102
|
+
const i = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
|
|
103
|
+
this.nylasSchedulerConnector = new H({
|
|
104
|
+
schedulerAPIURL: this.schedulerApiUrl,
|
|
105
|
+
sessionId: this.sessionId,
|
|
106
|
+
configId: this.refConfigId,
|
|
107
|
+
slug: this.slug,
|
|
108
|
+
clientId: this.clientId,
|
|
109
|
+
nylasSchedulerStore: i
|
|
110
|
+
});
|
|
111
|
+
const o = this.init.emit(this.host);
|
|
112
|
+
"init" in this.eventOverrides && (await this.eventOverrides.init(o, this.nylasSchedulerConnector), o.defaultPrevented) || ((d = this.baseProvider) == null || d.componentWillLoad(this.nylasSchedulerConnector), this.applyThemeConfig(this.themeConfig));
|
|
113
|
+
}
|
|
114
|
+
async componentDidLoad() {
|
|
115
|
+
var l, c, p, g, b, u, m, w;
|
|
116
|
+
(l = this.baseProvider) == null || l.componentDidLoad();
|
|
117
|
+
const t = this.schedulerDidLoad.emit(this.host);
|
|
118
|
+
if ("schedulerDidLoad" in this.eventOverrides && (await this.eventOverrides.schedulerDidLoad(t, this.nylasSchedulerConnector), t.defaultPrevented) || !this.checkIfSessionIdOrConfigIdExists())
|
|
119
|
+
return;
|
|
120
|
+
this.localizationChanged(this.localization);
|
|
121
|
+
const e = await ((c = this.nylasSchedulerConnector) == null ? void 0 : c.scheduler.getUISettings());
|
|
122
|
+
if (!e || "error" in e)
|
|
123
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(e == null ? void 0 : e.error) }, host: this.host });
|
|
124
|
+
else {
|
|
125
|
+
"data" in e && ((p = e.data) != null && p.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.");
|
|
126
|
+
const f = this.configSettingsLoaded.emit({ settings: e });
|
|
127
|
+
if ("configSettingsLoaded" in this.eventOverrides && (await this.eventOverrides.configSettingsLoaded(f, this.nylasSchedulerConnector), f.defaultPrevented))
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const i = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), o = (u = (b = i == null ? void 0 : i.get("configSettings")) == null ? void 0 : b.scheduler) == null ? void 0 : u.available_days_in_future, s = i == null ? void 0 : i.get("selectedTimeslot");
|
|
131
|
+
if (s && (s != null && s.start_time)) {
|
|
132
|
+
if (!this.isTimeslotValid(s))
|
|
133
|
+
return;
|
|
134
|
+
if (i != null && i.get("showBookingForm")) {
|
|
135
|
+
i == null || i.set("selectedDate", s.start_time);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const d = i == null ? void 0 : i.get("selectedDate"), r = i == null ? void 0 : i.get("availability");
|
|
140
|
+
let a;
|
|
141
|
+
if (!(r && r.length > 0)) {
|
|
142
|
+
if (d) {
|
|
143
|
+
const { startTime: f, endTime: v, endTimeForAvailableDaysInFuture: C } = this.validateAvailableDaysInFuture(d, o || 30);
|
|
144
|
+
d.getTime() < C * 1e3 && (a = await ((w = this.nylasSchedulerConnector) == null ? void 0 : w.scheduler.getAvailability(f, v)));
|
|
145
|
+
} else {
|
|
146
|
+
const f = /* @__PURE__ */ new Date(), { startTime: v, endTime: C, endTimeForAvailableDaysInFuture: R } = this.validateAvailableDaysInFuture(f, o || 30);
|
|
147
|
+
f.getTime() < R * 1e3 && (a = await ((m = this.nylasSchedulerConnector) == null ? void 0 : m.scheduler.getAvailability(v, C)));
|
|
148
|
+
}
|
|
149
|
+
if ((!a || "error" in a) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(a == null ? void 0 : a.error) }, host: this.host }), !d) {
|
|
150
|
+
let f = /* @__PURE__ */ new Date();
|
|
151
|
+
const v = i == null ? void 0 : i.get("availability").find((C) => new Date(C.start_time) > /* @__PURE__ */ new Date());
|
|
152
|
+
v && (f = v.start_time), i == null || i.set("selectedDate", f);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
componentDisconnected() {
|
|
157
|
+
var t;
|
|
158
|
+
(t = this.baseProvider) == null || t.componentDisconnected();
|
|
159
|
+
}
|
|
160
|
+
bookingInfoChanged(t) {
|
|
161
|
+
var e;
|
|
162
|
+
(e = this.stores) == null || e.scheduler.set("bookingInfo", t);
|
|
163
|
+
}
|
|
164
|
+
rescheduleBookingRefChanged(t) {
|
|
165
|
+
var e, i;
|
|
166
|
+
if (t) {
|
|
167
|
+
const [o, s] = I(t);
|
|
168
|
+
(e = this.stores) == null || e.scheduler.set("rescheduleBookingId", s), this.refConfigId = o, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(o);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
cancelBookingRefChanged(t) {
|
|
172
|
+
var e, i;
|
|
173
|
+
if (t) {
|
|
174
|
+
const [o, s] = I(t);
|
|
175
|
+
(e = this.stores) == null || e.scheduler.set("cancelBookingId", s), this.refConfigId = o, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(o);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
organizerConfirmationBookingRefChanged(t) {
|
|
179
|
+
var e, i;
|
|
180
|
+
if (t) {
|
|
181
|
+
const [o, s] = I(t);
|
|
182
|
+
(e = this.stores) == null || e.scheduler.set("organizerConfirmationBookingId", s), this.refConfigId = o, (i = this.nylasSchedulerConnector) == null || i.scheduler.setConfigId(o);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
localizationChanged(t) {
|
|
186
|
+
t && Object.keys(t).forEach((e) => {
|
|
187
|
+
e in j && (h.addResourceBundle(e, "translation", t[e], !1, !0), this.language = this.language);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
themeConfigChanged(t) {
|
|
191
|
+
this.applyThemeConfig(t);
|
|
192
|
+
}
|
|
193
|
+
languageChanged(t) {
|
|
194
|
+
const e = t.detail;
|
|
195
|
+
this.language = e, h.changeLanguage(e);
|
|
196
|
+
}
|
|
197
|
+
async registerComponentHandler(t) {
|
|
198
|
+
var e;
|
|
199
|
+
(e = this.baseProvider) == null || e.registerComponent(t.detail);
|
|
200
|
+
}
|
|
201
|
+
async unregisterComponentHandler(t) {
|
|
202
|
+
var e;
|
|
203
|
+
(e = this.baseProvider) == null || e.unregisterComponent(t.detail);
|
|
204
|
+
}
|
|
205
|
+
async monthChangedHandler(t) {
|
|
206
|
+
var r, a, l, c, p, g, b;
|
|
207
|
+
const e = t.detail, i = (c = (l = (a = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : a.get("configSettings")) == null ? void 0 : l.scheduler) == null ? void 0 : c.available_days_in_future, { startTime: o, endTime: s, endTimeForAvailableDaysInFuture: d } = this.validateAvailableDaysInFuture(e, i || 30);
|
|
208
|
+
if (o < d && e.getTime() < d * 1e3) {
|
|
209
|
+
const u = await ((p = this.nylasSchedulerConnector) == null ? void 0 : p.scheduler.getAvailability(o, s));
|
|
210
|
+
(!u || "error" in u) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(u == null ? void 0 : u.error) }, host: this.host });
|
|
211
|
+
const m = (g = this.stores) == null ? void 0 : g.scheduler.get("selectableDates");
|
|
212
|
+
m && m.length > 0 && ((b = this.stores) == null || b.scheduler.set("selectedDate", m[0]));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async bookButtonClickedHandler(t) {
|
|
216
|
+
var d, r, a, l;
|
|
217
|
+
const i = (r = (d = this.nylasSchedulerConnector) == null ? void 0 : d.schedulerStore) == null ? void 0 : r.get("rescheduleBookingId");
|
|
218
|
+
if (i) {
|
|
219
|
+
const c = await ((a = this.nylasSchedulerConnector) == null ? void 0 : a.scheduler.rescheduleBooking(i, t.detail));
|
|
220
|
+
(!c || "error" in c) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(c == null ? void 0 : c.error) }, host: this.host });
|
|
221
|
+
const p = this.bookedEventInfo.emit({ ...c });
|
|
222
|
+
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(p, this.nylasSchedulerConnector);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const o = await ((l = this.nylasSchedulerConnector) == null ? void 0 : l.scheduler.bookTimeslot(t.detail));
|
|
226
|
+
(!o || "error" in o) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(o == null ? void 0 : o.error) }, host: this.host });
|
|
227
|
+
const s = this.bookedEventInfo.emit({ ...o });
|
|
228
|
+
"bookedEventInfo" in this.eventOverrides && await this.eventOverrides.bookedEventInfo(s, this.nylasSchedulerConnector);
|
|
229
|
+
}
|
|
230
|
+
dateSelectedHandler(t) {
|
|
231
|
+
const e = t.detail;
|
|
232
|
+
this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${h.t("noDateSelected")}`;
|
|
233
|
+
}
|
|
234
|
+
cancelBookedEventErrorHandler(t) {
|
|
235
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
236
|
+
}
|
|
237
|
+
cancelBookedEventValidationErrorHandler(t) {
|
|
238
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
239
|
+
}
|
|
240
|
+
rescheduleBookedEventErrorHandler(t) {
|
|
241
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
242
|
+
}
|
|
243
|
+
confirmBookingErrorHandler(t) {
|
|
244
|
+
this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
|
|
245
|
+
}
|
|
246
|
+
async getNylasSchedulerStore() {
|
|
247
|
+
var t;
|
|
248
|
+
return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
|
|
249
|
+
}
|
|
250
|
+
async getNylasSchedulerConnector() {
|
|
251
|
+
return this.nylasSchedulerConnector;
|
|
252
|
+
}
|
|
253
|
+
async getRef() {
|
|
254
|
+
return this.host;
|
|
255
|
+
}
|
|
256
|
+
getErrorObject(t) {
|
|
257
|
+
return {
|
|
258
|
+
title: (t == null ? void 0 : t.title) || T.title,
|
|
259
|
+
category: (t == null ? void 0 : t.category) || T.category,
|
|
260
|
+
type: x.Error,
|
|
261
|
+
description: (t == null ? void 0 : t.message) || "",
|
|
262
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
263
|
+
ttl: "none"
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
checkIfSessionIdOrConfigIdExists() {
|
|
267
|
+
if (!this.sessionId && !this.refConfigId && !(this.slug && this.clientId)) {
|
|
268
|
+
let t = "";
|
|
269
|
+
return this.sessionId || (t += h.t("sessionIdRequiredErrorMessage")), !this.sessionId && !this.refConfigId && !(this.slug && this.clientId) && (t = h.t("sessionIdRequiredErrorMessage") + " " + h.t("publicConfigErrorMessage")), this.nylasSchedulerError.emit({
|
|
270
|
+
notification: {
|
|
271
|
+
title: h.t("schedulingComponentErrorTitle"),
|
|
272
|
+
category: B.Component,
|
|
273
|
+
type: x.Error,
|
|
274
|
+
description: t,
|
|
275
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
276
|
+
ttl: "none"
|
|
277
|
+
},
|
|
278
|
+
host: this.host
|
|
279
|
+
}), !1;
|
|
280
|
+
}
|
|
281
|
+
return !0;
|
|
282
|
+
}
|
|
283
|
+
isTimeslotValid(t) {
|
|
284
|
+
return new Date(t.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
|
|
285
|
+
notification: {
|
|
286
|
+
title: h.t("invalidTimeslotErrorTitle"),
|
|
287
|
+
category: B.Component,
|
|
288
|
+
type: x.Error,
|
|
289
|
+
description: h.t("invalidTimeslotErrorMessage"),
|
|
290
|
+
id: (/* @__PURE__ */ new Date()).getTime().toString(),
|
|
291
|
+
ttl: "none"
|
|
292
|
+
},
|
|
293
|
+
host: this.host
|
|
294
|
+
}), !1) : !0;
|
|
295
|
+
}
|
|
296
|
+
validateAvailableDaysInFuture(t, e) {
|
|
297
|
+
const i = /* @__PURE__ */ new Date(), o = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, s = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, d = Math.floor(O(i, e).getTime() / 1e3), r = Math.min(d, s);
|
|
298
|
+
return { startTime: o < i.getTime() / 1e3 ? Math.floor(i.getTime() / 1e3) : o, endTime: r, endTimeForAvailableDaysInFuture: d };
|
|
299
|
+
}
|
|
300
|
+
applyThemeConfig(t) {
|
|
301
|
+
if (t)
|
|
302
|
+
for (const [e, i] of Object.entries(t))
|
|
303
|
+
this.host.style.setProperty(`${e}`, i);
|
|
304
|
+
}
|
|
305
|
+
render() {
|
|
306
|
+
var m, w, f;
|
|
307
|
+
const t = this.mode === "app", e = (m = this.baseProvider) == null ? void 0 : m.getStore("scheduler"), i = e == null ? void 0 : e.get("eventInfo"), o = 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"), a = e == null ? void 0 : e.get("rescheduleBookingId"), l = e == null ? void 0 : e.get("organizerConfirmationBookingId"), c = e == null ? void 0 : e.get("rejectBookingId"), p = e == null ? void 0 : e.get("confirmedEventInfo"), g = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, b = e == null ? void 0 : e.get("selectedDate"), u = (f = (w = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : w.scheduler) == null ? void 0 : f.confirmation_redirect_url;
|
|
308
|
+
if (this.selectedDateLabel = b && this.language ? N(b.toLocaleDateString(M[this.language], { dateStyle: "full" })) : `${h.t("noDateSelected")}`, t && (d || c) && !s)
|
|
309
|
+
return n(y, null, n(k, { 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: c, exportparts: "ncbf, ncbf__icon, ncbf__title, ncbf__description, ncbf__reason-textarea, ncbf__button-cta, ncbf__button-outline, ncbf__card" }))));
|
|
310
|
+
if (t && l)
|
|
311
|
+
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "manual-confirmation-page", part: "manual-confirmation-page" }, n("nylas-organizer-confirmation-card", { organizerConfirmationBookingId: l, exportparts: "nmcc, nmcc__title, nmcc__description, nmcc__button-cta, nmcc__button-outline" }))));
|
|
312
|
+
if (t && s)
|
|
313
|
+
return n(y, null, n(k, { 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" }))));
|
|
314
|
+
if (t && p)
|
|
315
|
+
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "confirmed-event-page" }, n("nylas-confirmed-event-card", { confirmedEventInfo: p, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
|
|
316
|
+
if (t && i && u) {
|
|
317
|
+
window.location.assign(u);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (t && i)
|
|
321
|
+
return n(y, null, n(k, { 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" }))));
|
|
322
|
+
if (t && (!i || a) && !o) {
|
|
323
|
+
const v = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
324
|
+
return n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, a && n(L, null, `${h.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 ${a ? "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" }, v && n("span", { slot: "timeslot-picker-cta-label" }, n("slot", { name: "timeslot-picker-cta-label" })))))));
|
|
325
|
+
}
|
|
326
|
+
return t && !i && o ? n(y, null, n(k, { nylasBranding: g, isLoading: this.isLoading, showNotification: this.showNotification }, a && n(L, null, `${h.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 ${a ? "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" }))))) : n(y, null, n("slot", null));
|
|
327
|
+
}
|
|
328
|
+
get host() {
|
|
329
|
+
return A(this);
|
|
330
|
+
}
|
|
331
|
+
static get watchers() {
|
|
332
|
+
return {
|
|
333
|
+
bookingInfo: ["bookingInfoChanged"],
|
|
334
|
+
rescheduleBookingRef: ["rescheduleBookingRefChanged"],
|
|
335
|
+
cancelBookingRef: ["cancelBookingRefChanged"],
|
|
336
|
+
organizerConfirmationBookingRef: ["organizerConfirmationBookingRefChanged"],
|
|
337
|
+
localization: ["localizationChanged"],
|
|
338
|
+
themeConfig: ["themeConfigChanged"]
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
$.style = W;
|
|
343
|
+
export {
|
|
344
|
+
$ as nylas_scheduling
|
|
345
|
+
};
|
package/dist/{nylas-threads-refresh.entry-91af9af3.js → nylas-threads-refresh.entry-20602e7b.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-5ccfd9df.js";
|
|
2
|
+
import { R as m } from "./register-component-887199a9-b41dfa7a.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;
|
|
@@ -45,11 +45,11 @@ const d = class {
|
|
|
45
45
|
this.state = t;
|
|
46
46
|
}
|
|
47
47
|
render() {
|
|
48
|
-
return o(u, { key: "
|
|
48
|
+
return o(u, { key: "a3cbbe605d8d26999432651d0d60312647da8f86" }, o("div", { key: "1a59758a0cb17a919b7160fa260d1be527d62376", class: "container", ref: (t) => this.containerElement = t }, o("button", { key: "ed5e199459b3e4810143905c4983d5b1cfd1d755", class: {
|
|
49
49
|
"pull-to-refresh": !0,
|
|
50
50
|
pulling: this.pulling,
|
|
51
51
|
refreshing: this.state === "loading"
|
|
52
|
-
}, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "
|
|
52
|
+
}, "aria-label": "Refreshing..." }, this.state === "loading" && o("refresh-icon", { slot: "icon" }), this.state !== "loading" && o("arrow-icon", { slot: "icon" })), o("div", { key: "044db42a017e65e10920661b8f83d7f98ac0fe35", class: "content", ref: (t) => this.contentElement = t }, o("slot", { key: "359a095179a1ef2e5733f843dc140171bc0bddfe" }))));
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
v([
|
package/dist/{nylas-threads-refresh.entry-e637161b.cjs → nylas-threads-refresh.entry-56b53449.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-eb33703c.cjs"),c=require("./register-component-887199a9-003f96c5.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 d=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:"a3cbbe605d8d26999432651d0d60312647da8f86"},s.h("div",{key:"1a59758a0cb17a919b7160fa260d1be527d62376",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"ed5e199459b3e4810143905c4983d5b1cfd1d755",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:"044db42a017e65e10920661b8f83d7f98ac0fe35",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"359a095179a1ef2e5733f843dc140171bc0bddfe"}))))}};p([c.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)],d.prototype,"render",null);d.style=u;exports.nylas_threads_refresh=d;
|
package/dist/{nylas-threads-search.entry-5457dcec.js → nylas-threads-search.entry-8872473c.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as u, c as y, d as h, h as i, H as
|
|
2
|
-
import { R as
|
|
1
|
+
import { r as u, c as y, d as h, h as i, H as f } from "./index-5ccfd9df.js";
|
|
2
|
+
import { R as p } from "./register-component-887199a9-b41dfa7a.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
const m = ":host{display:block}sp-search{width:100%;border:0}",
|
|
6
|
-
var
|
|
5
|
+
const m = ":host{display:block}sp-search{width:100%;border:0}", g = m;
|
|
6
|
+
var b = function(t, e, n, r) {
|
|
7
7
|
var s = arguments.length, a = s < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, n) : r, o;
|
|
8
8
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
9
9
|
a = Reflect.decorate(t, e, n, r);
|
|
@@ -37,7 +37,7 @@ const d = class {
|
|
|
37
37
|
this.internalQuery = this.query;
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
|
-
return i(
|
|
40
|
+
return i(f, { key: "b61eeaa00c7e01d06d5b867958ac4979169f20b6" }, i("sp-theme", { key: "52d3212dc5223063e1f3f26cd8a29d555eaa3fac", scale: "medium", color: "dark" }, i("sp-search", { key: "2a15f291ae4a2e118398a01c2ddf68f1912f13fb", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
|
|
41
41
|
}
|
|
42
42
|
static get watchers() {
|
|
43
43
|
return {
|
|
@@ -45,8 +45,8 @@ const d = class {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
b([
|
|
49
|
+
p({
|
|
50
50
|
name: "nylas-pagination",
|
|
51
51
|
stateToProps: /* @__PURE__ */ new Map([["mailbox.searchQuery", "query"]]),
|
|
52
52
|
eventToProps: {
|
|
@@ -63,7 +63,7 @@ g([
|
|
|
63
63
|
l("design:paramtypes", []),
|
|
64
64
|
l("design:returntype", void 0)
|
|
65
65
|
], d.prototype, "render", null);
|
|
66
|
-
d.style =
|
|
66
|
+
d.style = g;
|
|
67
67
|
export {
|
|
68
68
|
d as nylas_threads_search
|
|
69
69
|
};
|
package/dist/{nylas-threads-search.entry-b944f95a.cjs → nylas-threads-search.entry-8e0ec3ae.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-eb33703c.cjs"),d=require("./register-component-887199a9-003f96c5.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 o=arguments.length,r=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,s):n,c;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--)(c=t[i])&&(r=(o<3?c(r):o>3?c(e,s,r):c(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const h=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:"b61eeaa00c7e01d06d5b867958ac4979169f20b6"},a.h("sp-theme",{key:"52d3212dc5223063e1f3f26cd8a29d555eaa3fac",scale:"medium",color:"dark"},a.h("sp-search",{key:"2a15f291ae4a2e118398a01c2ddf68f1912f13fb",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};f([d.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}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],h.prototype,"render",null);h.style=y;exports.nylas_threads_search=h;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ae,
|
|
1
|
+
import { i as ae, W as C, r as oe, c as N, X as _, Y as B, Z as G, _ as q, h as k, H as he, g as me } from "./index-5ccfd9df.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
var J = { exports: {} };
|
|
@@ -6,7 +6,7 @@ var J = { exports: {} };
|
|
|
6
6
|
(function(n, i) {
|
|
7
7
|
e.exports = i();
|
|
8
8
|
})(ae, function() {
|
|
9
|
-
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, r = /\d\d/, o = /\d\d?/, v = /\d*[^-_:/,()\s\d]+/, x = {},
|
|
9
|
+
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, r = /\d\d/, o = /\d\d?/, v = /\d*[^-_:/,()\s\d]+/, x = {}, V = function(s) {
|
|
10
10
|
return (s = +s) + (s > 68 ? 1900 : 2e3);
|
|
11
11
|
}, l = function(s) {
|
|
12
12
|
return function(a) {
|
|
@@ -61,7 +61,7 @@ var J = { exports: {} };
|
|
|
61
61
|
throw new Error();
|
|
62
62
|
this.month = a % 12 || a;
|
|
63
63
|
}], Y: [/[+-]?\d+/, l("year")], YY: [r, function(s) {
|
|
64
|
-
this.year =
|
|
64
|
+
this.year = V(s);
|
|
65
65
|
}], YYYY: [/\d{4}/, l("year")], Z: U, ZZ: U };
|
|
66
66
|
function ee(s) {
|
|
67
67
|
var a, h;
|
|
@@ -95,7 +95,7 @@ var J = { exports: {} };
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
return function(s, a, h) {
|
|
98
|
-
h.p.customParseFormat = !0, s && s.parseTwoDigitYear && (
|
|
98
|
+
h.p.customParseFormat = !0, s && s.parseTwoDigitYear && (V = s.parseTwoDigitYear);
|
|
99
99
|
var m = a.prototype, f = m.parse;
|
|
100
100
|
m.parse = function(p) {
|
|
101
101
|
var L = p.date, I = p.utc, y = p.args;
|
|
@@ -109,8 +109,8 @@ var J = { exports: {} };
|
|
|
109
109
|
return new Date((A === "X" ? 1e3 : 1) * E);
|
|
110
110
|
var c = ee(A)(E), Y = c.year, O = c.month, te = c.day, ie = c.hours, se = c.minutes, ne = c.seconds, re = c.milliseconds, j = c.zone, z = /* @__PURE__ */ new Date(), F = te || (Y || O ? 1 : z.getDate()), H = Y || z.getFullYear(), $ = 0;
|
|
111
111
|
Y && !O || ($ = O > 0 ? O - 1 : z.getMonth());
|
|
112
|
-
var K = ie || 0, Z = se || 0, R = ne || 0,
|
|
113
|
-
return j ? new Date(Date.UTC(H, $, F, K, Z, R,
|
|
112
|
+
var K = ie || 0, Z = se || 0, R = ne || 0, W = re || 0;
|
|
113
|
+
return j ? new Date(Date.UTC(H, $, F, K, Z, R, W + 60 * j.offset * 1e3)) : M ? new Date(Date.UTC(H, $, F, K, Z, R, W)) : new Date(H, $, F, K, Z, R, W);
|
|
114
114
|
} catch {
|
|
115
115
|
return /* @__PURE__ */ new Date("");
|
|
116
116
|
}
|
|
@@ -153,7 +153,7 @@ const ue = class {
|
|
|
153
153
|
}
|
|
154
154
|
componentDidRender() {
|
|
155
155
|
if (this.showTimes && this.shouldAutoScroll) {
|
|
156
|
-
const e =
|
|
156
|
+
const e = _(this.time), t = this.times.findIndex((n) => n.value === e);
|
|
157
157
|
t > -1 && (this.shouldAutoScroll = !1, this.scrollToViewWithinParent(t));
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
@@ -193,7 +193,7 @@ const ue = class {
|
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
if (!q(t)) {
|
|
196
|
-
const i =
|
|
196
|
+
const i = _(t);
|
|
197
197
|
this.timeChange.emit({
|
|
198
198
|
key: this.el.id,
|
|
199
199
|
value: i
|
|
@@ -215,7 +215,7 @@ const ue = class {
|
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
217
|
if (!q(t)) {
|
|
218
|
-
const i =
|
|
218
|
+
const i = _(t), r = this.times.findIndex((o) => o.value === i);
|
|
219
219
|
r > -1 && this.scrollToViewWithinParent(r);
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
@@ -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: "f9e043d1053de00843aab2ba2fc790fa03710a6c" }, k("div", { key: "c94d6067be1848d766075088fc8b7b7b9f894302", class: "time-picker", part: "time-picker" }, k("input", { key: "4f9826a61fc6a5c39c9af5c17489be9d1b177c22", 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: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-8a536089.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:"637409030b6d1ea098f8127c7d5630f3482b69ce"},r.h("div",{key:"fb6e5babfcc5cf82d98b57b7df0c7f4899e79cc7",class:"time-picker",part:"time-picker"},r.h("input",{key:"e0c6f13b0986fead684d222c2c194e605c1c72ab",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-eb33703c.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:"f9e043d1053de00843aab2ba2fc790fa03710a6c"},r.h("div",{key:"c94d6067be1848d766075088fc8b7b7b9f894302",class:"time-picker",part:"time-picker"},r.h("input",{key:"4f9826a61fc6a5c39c9af5c17489be9d1b177c22",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;
|