@nylas/react 1.1.0-canary.3 → 1.1.0-canary.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-circle-icon_22.entry-da31fa71.js → add-circle-icon_22.entry-9f634efd.js} +90 -92
- package/dist/add-circle-icon_22.entry-e7ec6c34.cjs +1 -0
- package/dist/{archive-icon_7.entry-bc2418f7.js → archive-icon_7.entry-24bac466.js} +21 -21
- package/dist/{archive-icon_7.entry-7aad8104.cjs → archive-icon_7.entry-6649ed76.cjs} +1 -1
- package/dist/{arrow-icon.entry-6eba68a9.cjs → arrow-icon.entry-1fffd526.cjs} +1 -1
- package/dist/{arrow-icon.entry-9a932082.js → arrow-icon.entry-82e59ce4.js} +4 -4
- package/dist/{bold-icon_3.entry-db17d481.cjs → bold-icon_3.entry-5a01fecf.cjs} +1 -1
- package/dist/{bold-icon_3.entry-5f7e3755.js → bold-icon_3.entry-72e585da.js} +4 -4
- package/dist/{calendar-cancel-icon.entry-a5141f82.cjs → calendar-cancel-icon.entry-0b52bdc9.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-1ff7845a.js → calendar-cancel-icon.entry-247b530c.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-c3add652.cjs → calendar-check-icon_2.entry-d7bb76c7.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-d7421059.js → calendar-check-icon_2.entry-dbb2df49.js} +7 -7
- package/dist/{calendar-icon.entry-445d624a.cjs → calendar-icon.entry-911773c4.cjs} +1 -1
- package/dist/{calendar-icon.entry-4458997f.js → calendar-icon.entry-d64cb3d3.js} +2 -2
- package/dist/{chevron-icon_3.entry-8961e6bb.cjs → chevron-icon_3.entry-b72f4cdb.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-f7f3d487.js → chevron-icon_3.entry-db9f8217.js} +11 -11
- package/dist/close-icon.entry-9d141bb4.js +15 -0
- package/dist/close-icon.entry-da590fa2.cjs +1 -0
- package/dist/{constants-6ee60d6d-6c0540db.cjs → constants-6ee60d6d-09ee73d9.cjs} +1 -1
- package/dist/{constants-6ee60d6d-4cd16450.js → constants-6ee60d6d-d5928e79.js} +1 -1
- package/dist/document-refresh-icon.entry-5e8cc2f0.cjs +1 -0
- package/dist/{document-refresh-icon.entry-bdc323b5.js → document-refresh-icon.entry-ee9632d7.js} +5 -5
- package/dist/elements/index.d.ts +1 -0
- package/dist/{elements-dc5b338e-81a0319c.cjs → elements-dc5b338e-29ef67ec.cjs} +1 -1
- package/dist/{elements-dc5b338e-fb5dbfb5.js → elements-dc5b338e-e87f79b6.js} +1 -1
- package/dist/focus-visible-e8093c16-61d506d2.cjs +1 -0
- package/dist/{focus-visible-e8093c16-28fc08a0.js → focus-visible-e8093c16-e7357f74.js} +5 -3
- package/dist/forward-icon_6.entry-cac8473a.cjs +3 -0
- package/dist/{forward-icon_6.entry-62759373.js → forward-icon_6.entry-f054ad9d.js} +65 -67
- package/dist/{globe-icon.entry-9e082178.js → globe-icon.entry-2fde6ac4.js} +4 -4
- package/dist/{globe-icon.entry-c8302bf5.cjs → globe-icon.entry-bc484551.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-a9848399.cjs +1 -0
- package/dist/google-logo-icon_4.entry-dca87e45.js +349 -0
- package/dist/index-22f7e49c.cjs +37 -0
- package/dist/index-f9ba9aa8.js +3971 -0
- package/dist/{index.es-2578c6a5-71441142.js → index.es-f57e612a-1d17c676.js} +516 -512
- package/dist/{index.es-2578c6a5-098d48d0.cjs → index.es-f57e612a-95ca3e17.cjs} +5 -5
- package/dist/{info-icon_2.entry-73106882.js → info-icon_2.entry-dbf3931a.js} +7 -7
- package/dist/{info-icon_2.entry-ca224a3b.cjs → info-icon_2.entry-e67844eb.cjs} +1 -1
- package/dist/loading-icon.entry-4566cba8.cjs +1 -0
- package/dist/loading-icon.entry-ae4c2d7e.js +15 -0
- package/dist/{mailbox-store-bb21512c-615660ef.js → mailbox-store-47fc8a1a-2365f20f.js} +16 -17
- package/dist/mailbox-store-47fc8a1a-cd3516a7.cjs +1 -0
- package/dist/nylas-additional-participants.entry-7c568149.cjs +1 -0
- package/dist/{nylas-additional-participants.entry-db85836a.js → nylas-additional-participants.entry-e8426256.js} +12 -14
- package/dist/nylas-booked-event-card_10.entry-6a664889.cjs +1 -0
- package/dist/{nylas-booked-event-card_10.entry-b49b2369.js → nylas-booked-event-card_10.entry-ef767733.js} +8 -10
- package/dist/{nylas-form-card.entry-090a4d3b.js → nylas-form-card.entry-d8506b1f.js} +4 -6
- package/dist/nylas-form-card.entry-e44169b6.cjs +1 -0
- package/dist/nylas-if-state.entry-044c49d2.cjs +1 -0
- package/dist/{nylas-if-state.entry-7924dde0.js → nylas-if-state.entry-98a336df.js} +2 -4
- package/dist/nylas-list-folders.entry-509f9be4.cjs +1 -0
- package/dist/{nylas-list-folders.entry-9dd96530.js → nylas-list-folders.entry-55ce3403.js} +6 -8
- package/dist/{nylas-list-threads.entry-b435eaae.js → nylas-list-threads.entry-1f57382a.js} +5 -7
- package/dist/nylas-list-threads.entry-c36e2cf3.cjs +1 -0
- package/dist/nylas-login.entry-66f542b8.cjs +1 -0
- package/dist/{nylas-login.entry-97350c76.js → nylas-login.entry-76358c2f.js} +3 -5
- package/dist/{nylas-mailbox-pagination.entry-ceef8be2.js → nylas-mailbox-pagination.entry-5562257a.js} +7 -9
- package/dist/nylas-mailbox-pagination.entry-89b0dd99.cjs +1 -0
- package/dist/nylas-mailbox-toolbar-button.entry-573e0429.cjs +1 -0
- package/dist/{nylas-mailbox-toolbar-button.entry-e6b3d3a4.js → nylas-mailbox-toolbar-button.entry-6b1b5b15.js} +16 -18
- package/dist/{nylas-mailbox.entry-06d8014a.js → nylas-mailbox.entry-97c503f2.js} +7 -9
- package/dist/nylas-mailbox.entry-e21a2f50.cjs +1 -0
- package/dist/{nylas-provider.entry-8b9c2b69.js → nylas-provider.entry-07e1e26a.js} +10 -12
- package/dist/nylas-provider.entry-61899957.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-60fe38ce.cjs +7 -0
- package/dist/{nylas-scheduler-editor.entry-c3791787.js → nylas-scheduler-editor.entry-e326c9de.js} +333 -239
- package/dist/{nylas-scheduling.entry-6380509a.js → nylas-scheduling.entry-be0cc090.js} +6 -8
- package/dist/nylas-scheduling.entry-d88289db.cjs +1 -0
- package/dist/{nylas-threads-refresh.entry-eaee86fb.js → nylas-threads-refresh.entry-8201f8dd.js} +11 -13
- package/dist/nylas-threads-refresh.entry-c71ee775.cjs +1 -0
- package/dist/nylas-threads-search.entry-912a90a4.cjs +1 -0
- package/dist/{nylas-threads-search.entry-7e12758e.js → nylas-threads-search.entry-fc477e01.js} +18 -20
- package/dist/nylas-view-thread.entry-af418ddb.cjs +1 -0
- package/dist/{nylas-view-thread.entry-b936e76a.js → nylas-view-thread.entry-d2953ea8.js} +7 -9
- package/dist/{people-icon.entry-5c8ee696.js → people-icon.entry-4b598fde.js} +7 -7
- package/dist/{people-icon.entry-bcf848c0.cjs → people-icon.entry-73cfa6f5.cjs} +1 -1
- package/dist/play-icon_2.entry-1a487abb.cjs +1 -0
- package/dist/{play-icon_2.entry-356e63cc.js → play-icon_2.entry-d1c2f823.js} +5 -5
- package/dist/react.cjs +1 -1
- package/dist/react.js +68 -67
- package/dist/{refresh-icon.entry-bec053b6.cjs → refresh-icon.entry-42d543d0.cjs} +1 -1
- package/dist/{refresh-icon.entry-77f0c377.js → refresh-icon.entry-6aedfce6.js} +4 -4
- package/dist/register-component-cf5c8420-d3fb6bf9.cjs +1 -0
- package/dist/{register-component-dc659dc3-0fdb18dc.js → register-component-cf5c8420-dc1bc0a4.js} +37 -33
- package/dist/scheduler-config-store-6222c0ed-000f1a4f.js +18 -0
- package/dist/scheduler-config-store-6222c0ed-758621fb.cjs +1 -0
- package/dist/{scheduler-store-72116723-3ba2480c.js → scheduler-store-39d37291-4e8e9ff9.js} +5 -6
- package/dist/scheduler-store-39d37291-b66c052c.cjs +1 -0
- package/dist/{time-period-selector.entry-decd251b.js → time-period-selector.entry-f1e27a00.js} +6 -8
- package/dist/time-period-selector.entry-fb3d0178.cjs +1 -0
- package/dist/{translate-icon.entry-dd5b707c.cjs → translate-icon.entry-0d44b6cb.cjs} +1 -1
- package/dist/{translate-icon.entry-cac02c46.js → translate-icon.entry-3db947f5.js} +5 -5
- package/dist/{warning-icon.entry-8af8a742.cjs → warning-icon.entry-a20657e4.cjs} +1 -1
- package/dist/{warning-icon.entry-370b9cf0.js → warning-icon.entry-a8ea0fe0.js} +5 -5
- package/package.json +2 -2
- package/dist/_commonjsHelpers-57e89916-4a3ae7d8.cjs +0 -1
- package/dist/_commonjsHelpers-57e89916-af061c86.js +0 -19
- package/dist/add-circle-icon_22.entry-8d0ac489.cjs +0 -1
- package/dist/close-icon.entry-6dd5ff0a.js +0 -15
- package/dist/close-icon.entry-ebc527c5.cjs +0 -1
- package/dist/document-refresh-icon.entry-298b2133.cjs +0 -1
- package/dist/focus-visible-e8093c16-f380b705.cjs +0 -1
- package/dist/forward-icon_6.entry-15208ea9.cjs +0 -3
- package/dist/google-logo-icon_3.entry-0c095209.js +0 -258
- package/dist/google-logo-icon_3.entry-f8433ff9.cjs +0 -1
- package/dist/index-0f3bd8df.js +0 -1824
- package/dist/index-7a55dc33.cjs +0 -30
- package/dist/loading-icon.entry-012644b7.js +0 -15
- package/dist/loading-icon.entry-f9f5e66f.cjs +0 -1
- package/dist/mailbox-store-bb21512c-045c3ea0.cjs +0 -1
- package/dist/nylas-additional-participants.entry-a50ef8e2.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-fccb783c.cjs +0 -1
- package/dist/nylas-form-card.entry-f5230005.cjs +0 -1
- package/dist/nylas-if-state.entry-ff9c9a85.cjs +0 -1
- package/dist/nylas-list-folders.entry-dbfc2cf8.cjs +0 -1
- package/dist/nylas-list-threads.entry-6bcc0328.cjs +0 -1
- package/dist/nylas-login.entry-1623d309.cjs +0 -1
- package/dist/nylas-mailbox-pagination.entry-1776eb16.cjs +0 -1
- package/dist/nylas-mailbox-toolbar-button.entry-7d3f79b9.cjs +0 -1
- package/dist/nylas-mailbox.entry-ae8da6ff.cjs +0 -1
- package/dist/nylas-provider.entry-97c9e272.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-f6cf1cd9.cjs +0 -7
- package/dist/nylas-scheduling.entry-08ae840a.cjs +0 -1
- package/dist/nylas-threads-refresh.entry-246e6d77.cjs +0 -1
- package/dist/nylas-threads-search.entry-42a2acb1.cjs +0 -1
- package/dist/nylas-view-thread.entry-78e6927a.cjs +0 -1
- package/dist/play-icon_2.entry-92e78f1b.cjs +0 -1
- package/dist/register-component-dc659dc3-f58bf25b.cjs +0 -1
- package/dist/scheduler-config-store-51ee4f42-ce3a9b0e.cjs +0 -1
- package/dist/scheduler-config-store-51ee4f42-e02895da.js +0 -14
- package/dist/scheduler-store-72116723-db9d91f6.cjs +0 -1
- package/dist/time-period-selector.entry-f25fad77.cjs +0 -1
- package/dist/utils-c00bdc3c-89ab163d.js +0 -2111
- package/dist/utils-c00bdc3c-94b9c3b6.cjs +0 -8
package/dist/{nylas-scheduler-editor.entry-c3791787.js → nylas-scheduler-editor.entry-e326c9de.js}
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
var P = Object.defineProperty;
|
|
2
2
|
var O = (n, t, r) => t in n ? P(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r;
|
|
3
3
|
var m = (n, t, r) => (O(n, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
-
import { r as registerInstance, c as createEvent, N as NylasIdentityRequestWrapper, h, H as Host, g as getElement } from "./index-
|
|
5
|
-
import { N as NylasBaseProvider, X as Xr, g as global$1 } from "./index.es-
|
|
6
|
-
import {
|
|
7
|
-
import { C as CreateNylasSchedulerConfigStore } from "./scheduler-config-store-51ee4f42-e02895da.js";
|
|
8
|
-
import { c as commonjsGlobal } from "./_commonjsHelpers-57e89916-af061c86.js";
|
|
4
|
+
import { i as commonjsGlobal, r as registerInstance, c as createEvent, d as debug, N as NylasIdentityRequestWrapper, h, H as Host, g as getElement, j as dataResponse } from "./index-f9ba9aa8.js";
|
|
5
|
+
import { N as NylasBaseProvider, X as Xr, g as global$1 } from "./index.es-f57e612a-1d17c676.js";
|
|
6
|
+
import { C as CreateNylasSchedulerConfigStore } from "./scheduler-config-store-6222c0ed-000f1a4f.js";
|
|
9
7
|
import "react";
|
|
10
8
|
import "react-dom";
|
|
11
9
|
class NylasSchedulerConfigAPIConnector {
|
|
@@ -13,64 +11,111 @@ class NylasSchedulerConfigAPIConnector {
|
|
|
13
11
|
this.nylasApiRequest = t, this.nylasSchedulerConfigStore = r;
|
|
14
12
|
}
|
|
15
13
|
async currentUser() {
|
|
16
|
-
return this.nylasApiRequest.currentUser();
|
|
14
|
+
return this.nylasApiRequest ? this.nylasApiRequest.currentUser() : (console.warn("Nylas API Request is not initialized"), null);
|
|
17
15
|
}
|
|
18
16
|
async getCalendars() {
|
|
19
|
-
var
|
|
20
|
-
|
|
17
|
+
var s;
|
|
18
|
+
if (!this.nylasApiRequest)
|
|
19
|
+
return console.warn("Nylas API Request is not initialized"), dataResponse(null, {
|
|
20
|
+
message: "Error fetching calendars: Nylas API Request is not initialized"
|
|
21
|
+
});
|
|
22
|
+
const [t, r] = await this.nylasApiRequest.request({
|
|
21
23
|
method: "GET",
|
|
22
24
|
path: "calendars"
|
|
23
25
|
});
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
} : (
|
|
26
|
+
return r ? dataResponse(null, {
|
|
27
|
+
message: "Error fetching calendars: " + r.message
|
|
28
|
+
}) : Xr(t) ? dataResponse(null, {
|
|
29
|
+
message: "Error fetching calendars: " + ((s = t.error) == null ? void 0 : s.message)
|
|
30
|
+
}) : (this.nylasSchedulerConfigStore.state.calendars = t.data, dataResponse(t.data));
|
|
27
31
|
}
|
|
28
32
|
async getConfigurationById(t, r = !1) {
|
|
29
|
-
var
|
|
33
|
+
var c;
|
|
34
|
+
if (!this.nylasApiRequest)
|
|
35
|
+
return console.warn("Nylas API Request is not initialized"), dataResponse(null, {
|
|
36
|
+
message: "Error fetching configuration: Nylas API Request is not initialized"
|
|
37
|
+
});
|
|
30
38
|
if (!r) {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return this.nylasSchedulerConfigStore.state.config =
|
|
39
|
+
const u = this.nylasSchedulerConfigStore.state.configurations.find((l) => l.id === t);
|
|
40
|
+
if (u)
|
|
41
|
+
return this.nylasSchedulerConfigStore.state.config = u, dataResponse(u);
|
|
34
42
|
}
|
|
35
|
-
const s = await this.nylasApiRequest.request({
|
|
43
|
+
const [s, a] = await this.nylasApiRequest.request({
|
|
36
44
|
method: "GET",
|
|
37
45
|
path: `scheduling/configurations/${t}`
|
|
38
46
|
});
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
} : (
|
|
47
|
+
return a ? dataResponse(null, {
|
|
48
|
+
message: "Error fetching configuration: " + a.message
|
|
49
|
+
}) : Xr(s) ? dataResponse(null, {
|
|
50
|
+
message: "Error fetching configuration: " + ((c = s.error) == null ? void 0 : c.message)
|
|
51
|
+
}) : (this.nylasSchedulerConfigStore.state.config = s.data, this.nylasSchedulerConfigStore.state.configurations.find((u) => u.id === t) ? this.nylasSchedulerConfigStore.state.configurations = this.nylasSchedulerConfigStore.state.configurations.map((u) => u.id === t ? s.data : u) : this.nylasSchedulerConfigStore.state.configurations = [...this.nylasSchedulerConfigStore.state.configurations, s.data], dataResponse(s.data));
|
|
42
52
|
}
|
|
43
53
|
async getConfigurations() {
|
|
44
|
-
var
|
|
45
|
-
|
|
54
|
+
var s;
|
|
55
|
+
if (!this.nylasApiRequest)
|
|
56
|
+
return console.warn("Nylas API Request is not initialized"), dataResponse(null, {
|
|
57
|
+
message: "Error fetching configurations: Nylas API Request is not initialized"
|
|
58
|
+
});
|
|
59
|
+
const [t, r] = await this.nylasApiRequest.request({
|
|
46
60
|
method: "GET",
|
|
47
61
|
path: "scheduling/configurations"
|
|
48
62
|
});
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
} : (
|
|
63
|
+
return r ? dataResponse(null, {
|
|
64
|
+
message: "Error fetching configurations: " + r.message
|
|
65
|
+
}) : Xr(t) ? dataResponse(null, {
|
|
66
|
+
message: "Error fetching configurations: " + ((s = t.error) == null ? void 0 : s.message)
|
|
67
|
+
}) : (this.nylasSchedulerConfigStore.state.configurations = t.data, dataResponse(t.data));
|
|
52
68
|
}
|
|
53
69
|
async createConfiguration(t) {
|
|
54
|
-
var
|
|
55
|
-
|
|
70
|
+
var a;
|
|
71
|
+
if (!this.nylasApiRequest)
|
|
72
|
+
return console.warn("Nylas API Request is not initialized"), dataResponse(null, {
|
|
73
|
+
message: "Error creating configuration: Nylas API Request is not initialized"
|
|
74
|
+
});
|
|
75
|
+
t.requires_session_auth = this.nylasSchedulerConfigStore.state.defaultRequiresSessionAuth;
|
|
76
|
+
const [r, s] = await this.nylasApiRequest.request({
|
|
56
77
|
method: "POST",
|
|
57
78
|
path: "scheduling/configurations",
|
|
58
79
|
body: t
|
|
59
80
|
});
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
} : (
|
|
81
|
+
return s ? dataResponse(null, {
|
|
82
|
+
message: "Error creating configuration: " + s.message
|
|
83
|
+
}) : Xr(r) ? dataResponse(null, {
|
|
84
|
+
message: "Error creating configuration: " + ((a = r.error) == null ? void 0 : a.message)
|
|
85
|
+
}) : (this.nylasSchedulerConfigStore.state.config = r.data, this.nylasSchedulerConfigStore.state.configurations = [...this.nylasSchedulerConfigStore.state.configurations, r.data], dataResponse(r.data));
|
|
63
86
|
}
|
|
64
87
|
async updateConfiguration(t) {
|
|
65
|
-
var
|
|
66
|
-
|
|
88
|
+
var a;
|
|
89
|
+
if (!this.nylasApiRequest)
|
|
90
|
+
return console.warn("Nylas API Request is not initialized"), dataResponse(null, {
|
|
91
|
+
message: "Error updating configuration: Nylas API Request is not initialized"
|
|
92
|
+
});
|
|
93
|
+
const [r, s] = await this.nylasApiRequest.request({
|
|
67
94
|
method: "PUT",
|
|
68
95
|
path: `scheduling/configurations/${t.id}`,
|
|
69
96
|
body: t
|
|
70
97
|
});
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
} : (
|
|
98
|
+
return s ? dataResponse(null, {
|
|
99
|
+
message: "Error updating configuration: " + s.message
|
|
100
|
+
}) : Xr(r) ? dataResponse(null, {
|
|
101
|
+
message: "Error updating configuration: " + ((a = r.error) == null ? void 0 : a.message)
|
|
102
|
+
}) : (this.nylasSchedulerConfigStore.state.config = r.data, this.nylasSchedulerConfigStore.state.configurations.find((c) => c.id === t.id) ? this.nylasSchedulerConfigStore.state.configurations = this.nylasSchedulerConfigStore.state.configurations.map((c) => c.id === t.id ? r.data : c) : this.nylasSchedulerConfigStore.state.configurations = [...this.nylasSchedulerConfigStore.state.configurations, r.data], dataResponse(r.data));
|
|
103
|
+
}
|
|
104
|
+
async deleteConfiguration(t) {
|
|
105
|
+
var a, c;
|
|
106
|
+
if (!this.nylasApiRequest)
|
|
107
|
+
return console.warn("Nylas API Request is not initialized"), dataResponse(null, {
|
|
108
|
+
message: "Error deleting configuration: Nylas API Request is not initialized"
|
|
109
|
+
});
|
|
110
|
+
const [r, s] = await this.nylasApiRequest.request({
|
|
111
|
+
method: "DELETE",
|
|
112
|
+
path: `scheduling/configurations/${t}`
|
|
113
|
+
});
|
|
114
|
+
return s ? dataResponse(null, {
|
|
115
|
+
message: "Error deleting configuration: " + s.message
|
|
116
|
+
}) : Xr(r) ? dataResponse(null, {
|
|
117
|
+
message: "Error deleting configuration: " + ((a = r.error) == null ? void 0 : a.message)
|
|
118
|
+
}) : (this.nylasSchedulerConfigStore.state.configurations = this.nylasSchedulerConfigStore.state.configurations.filter((u) => u.id !== t), ((c = this.nylasSchedulerConfigStore.state.config) == null ? void 0 : c.id) === t && (this.nylasSchedulerConfigStore.state.config = {}), dataResponse(r.data));
|
|
74
119
|
}
|
|
75
120
|
}
|
|
76
121
|
class NylasSchedulerConfigConnector {
|
|
@@ -105,14 +150,14 @@ function init() {
|
|
|
105
150
|
}
|
|
106
151
|
function toByteArray(n) {
|
|
107
152
|
inited || init();
|
|
108
|
-
var t, r, s, a, c, u,
|
|
109
|
-
if (
|
|
153
|
+
var t, r, s, a, c, u, l = n.length;
|
|
154
|
+
if (l % 4 > 0)
|
|
110
155
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
111
|
-
c = n[
|
|
112
|
-
var
|
|
156
|
+
c = n[l - 2] === "=" ? 2 : n[l - 1] === "=" ? 1 : 0, u = new Arr(l * 3 / 4 - c), s = c > 0 ? l - 4 : l;
|
|
157
|
+
var f = 0;
|
|
113
158
|
for (t = 0, r = 0; t < s; t += 4, r += 3)
|
|
114
|
-
a = revLookup[n.charCodeAt(t)] << 18 | revLookup[n.charCodeAt(t + 1)] << 12 | revLookup[n.charCodeAt(t + 2)] << 6 | revLookup[n.charCodeAt(t + 3)], u[
|
|
115
|
-
return c === 2 ? (a = revLookup[n.charCodeAt(t)] << 2 | revLookup[n.charCodeAt(t + 1)] >> 4, u[
|
|
159
|
+
a = revLookup[n.charCodeAt(t)] << 18 | revLookup[n.charCodeAt(t + 1)] << 12 | revLookup[n.charCodeAt(t + 2)] << 6 | revLookup[n.charCodeAt(t + 3)], u[f++] = a >> 16 & 255, u[f++] = a >> 8 & 255, u[f++] = a & 255;
|
|
160
|
+
return c === 2 ? (a = revLookup[n.charCodeAt(t)] << 2 | revLookup[n.charCodeAt(t + 1)] >> 4, u[f++] = a & 255) : c === 1 && (a = revLookup[n.charCodeAt(t)] << 10 | revLookup[n.charCodeAt(t + 1)] << 4 | revLookup[n.charCodeAt(t + 2)] >> 2, u[f++] = a >> 8 & 255, u[f++] = a & 255), u;
|
|
116
161
|
}
|
|
117
162
|
function tripletToBase64(n) {
|
|
118
163
|
return lookup[n >> 18 & 63] + lookup[n >> 12 & 63] + lookup[n >> 6 & 63] + lookup[n & 63];
|
|
@@ -124,30 +169,30 @@ function encodeChunk(n, t, r) {
|
|
|
124
169
|
}
|
|
125
170
|
function fromByteArray(n) {
|
|
126
171
|
inited || init();
|
|
127
|
-
for (var t, r = n.length, s = r % 3, a = "", c = [], u = 16383,
|
|
128
|
-
c.push(encodeChunk(n,
|
|
172
|
+
for (var t, r = n.length, s = r % 3, a = "", c = [], u = 16383, l = 0, f = r - s; l < f; l += u)
|
|
173
|
+
c.push(encodeChunk(n, l, l + u > f ? f : l + u));
|
|
129
174
|
return s === 1 ? (t = n[r - 1], a += lookup[t >> 2], a += lookup[t << 4 & 63], a += "==") : s === 2 && (t = (n[r - 2] << 8) + n[r - 1], a += lookup[t >> 10], a += lookup[t >> 4 & 63], a += lookup[t << 2 & 63], a += "="), c.push(a), c.join("");
|
|
130
175
|
}
|
|
131
176
|
function read(n, t, r, s, a) {
|
|
132
|
-
var c, u,
|
|
133
|
-
for (
|
|
177
|
+
var c, u, l = a * 8 - s - 1, f = (1 << l) - 1, d = f >> 1, g = -7, p = r ? a - 1 : 0, y = r ? -1 : 1, w = n[t + p];
|
|
178
|
+
for (p += y, c = w & (1 << -g) - 1, w >>= -g, g += l; g > 0; c = c * 256 + n[t + p], p += y, g -= 8)
|
|
134
179
|
;
|
|
135
|
-
for (u = c & (1 << -
|
|
180
|
+
for (u = c & (1 << -g) - 1, c >>= -g, g += s; g > 0; u = u * 256 + n[t + p], p += y, g -= 8)
|
|
136
181
|
;
|
|
137
182
|
if (c === 0)
|
|
138
183
|
c = 1 - d;
|
|
139
184
|
else {
|
|
140
|
-
if (c ===
|
|
185
|
+
if (c === f)
|
|
141
186
|
return u ? NaN : (w ? -1 : 1) * (1 / 0);
|
|
142
187
|
u = u + Math.pow(2, s), c = c - d;
|
|
143
188
|
}
|
|
144
189
|
return (w ? -1 : 1) * u * Math.pow(2, c - s);
|
|
145
190
|
}
|
|
146
191
|
function write(n, t, r, s, a, c) {
|
|
147
|
-
var u,
|
|
148
|
-
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (
|
|
192
|
+
var u, l, f, d = c * 8 - a - 1, g = (1 << d) - 1, p = g >> 1, y = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, w = s ? 0 : c - 1, x = s ? 1 : -1, S = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
|
|
193
|
+
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (l = isNaN(t) ? 1 : 0, u = g) : (u = Math.floor(Math.log(t) / Math.LN2), t * (f = Math.pow(2, -u)) < 1 && (u--, f *= 2), u + p >= 1 ? t += y / f : t += y * Math.pow(2, 1 - p), t * f >= 2 && (u++, f /= 2), u + p >= g ? (l = 0, u = g) : u + p >= 1 ? (l = (t * f - 1) * Math.pow(2, a), u = u + p) : (l = t * Math.pow(2, p - 1) * Math.pow(2, a), u = 0)); a >= 8; n[r + w] = l & 255, w += x, l /= 256, a -= 8)
|
|
149
194
|
;
|
|
150
|
-
for (u = u << a |
|
|
195
|
+
for (u = u << a | l, d += a; d > 0; n[r + w] = u & 255, w += x, u /= 256, d -= 8)
|
|
151
196
|
;
|
|
152
197
|
n[r + w - x] |= S * 128;
|
|
153
198
|
}
|
|
@@ -430,12 +475,12 @@ Buffer.prototype.compare = function(t, r, s, a, c) {
|
|
|
430
475
|
return 1;
|
|
431
476
|
if (r >>>= 0, s >>>= 0, a >>>= 0, c >>>= 0, this === t)
|
|
432
477
|
return 0;
|
|
433
|
-
for (var u = c - a,
|
|
434
|
-
if (d[
|
|
435
|
-
u = d[
|
|
478
|
+
for (var u = c - a, l = s - r, f = Math.min(u, l), d = this.slice(a, c), g = t.slice(r, s), p = 0; p < f; ++p)
|
|
479
|
+
if (d[p] !== g[p]) {
|
|
480
|
+
u = d[p], l = g[p];
|
|
436
481
|
break;
|
|
437
482
|
}
|
|
438
|
-
return u <
|
|
483
|
+
return u < l ? -1 : l < u ? 1 : 0;
|
|
439
484
|
};
|
|
440
485
|
function bidirectionalIndexOf(n, t, r, s, a) {
|
|
441
486
|
if (n.length === 0)
|
|
@@ -456,32 +501,32 @@ function bidirectionalIndexOf(n, t, r, s, a) {
|
|
|
456
501
|
throw new TypeError("val must be string, number or Buffer");
|
|
457
502
|
}
|
|
458
503
|
function arrayIndexOf(n, t, r, s, a) {
|
|
459
|
-
var c = 1, u = n.length,
|
|
504
|
+
var c = 1, u = n.length, l = t.length;
|
|
460
505
|
if (s !== void 0 && (s = String(s).toLowerCase(), s === "ucs2" || s === "ucs-2" || s === "utf16le" || s === "utf-16le")) {
|
|
461
506
|
if (n.length < 2 || t.length < 2)
|
|
462
507
|
return -1;
|
|
463
|
-
c = 2, u /= 2,
|
|
508
|
+
c = 2, u /= 2, l /= 2, r /= 2;
|
|
464
509
|
}
|
|
465
|
-
function
|
|
510
|
+
function f(w, x) {
|
|
466
511
|
return c === 1 ? w[x] : w.readUInt16BE(x * c);
|
|
467
512
|
}
|
|
468
513
|
var d;
|
|
469
514
|
if (a) {
|
|
470
|
-
var
|
|
515
|
+
var g = -1;
|
|
471
516
|
for (d = r; d < u; d++)
|
|
472
|
-
if (
|
|
473
|
-
if (
|
|
474
|
-
return
|
|
517
|
+
if (f(n, d) === f(t, g === -1 ? 0 : d - g)) {
|
|
518
|
+
if (g === -1 && (g = d), d - g + 1 === l)
|
|
519
|
+
return g * c;
|
|
475
520
|
} else
|
|
476
|
-
|
|
521
|
+
g !== -1 && (d -= d - g), g = -1;
|
|
477
522
|
} else
|
|
478
|
-
for (r +
|
|
479
|
-
for (var
|
|
480
|
-
if (
|
|
481
|
-
|
|
523
|
+
for (r + l > u && (r = u - l), d = r; d >= 0; d--) {
|
|
524
|
+
for (var p = !0, y = 0; y < l; y++)
|
|
525
|
+
if (f(n, d + y) !== f(t, y)) {
|
|
526
|
+
p = !1;
|
|
482
527
|
break;
|
|
483
528
|
}
|
|
484
|
-
if (
|
|
529
|
+
if (p)
|
|
485
530
|
return d;
|
|
486
531
|
}
|
|
487
532
|
return -1;
|
|
@@ -504,10 +549,10 @@ function hexWrite(n, t, r, s) {
|
|
|
504
549
|
throw new TypeError("Invalid hex string");
|
|
505
550
|
s > c / 2 && (s = c / 2);
|
|
506
551
|
for (var u = 0; u < s; ++u) {
|
|
507
|
-
var
|
|
508
|
-
if (isNaN(
|
|
552
|
+
var l = parseInt(t.substr(u * 2, 2), 16);
|
|
553
|
+
if (isNaN(l))
|
|
509
554
|
return u;
|
|
510
|
-
n[r + u] =
|
|
555
|
+
n[r + u] = l;
|
|
511
556
|
}
|
|
512
557
|
return u;
|
|
513
558
|
}
|
|
@@ -578,24 +623,24 @@ function base64Slice(n, t, r) {
|
|
|
578
623
|
function utf8Slice(n, t, r) {
|
|
579
624
|
r = Math.min(n.length, r);
|
|
580
625
|
for (var s = [], a = t; a < r; ) {
|
|
581
|
-
var c = n[a], u = null,
|
|
582
|
-
if (a +
|
|
583
|
-
var
|
|
584
|
-
switch (
|
|
626
|
+
var c = n[a], u = null, l = c > 239 ? 4 : c > 223 ? 3 : c > 191 ? 2 : 1;
|
|
627
|
+
if (a + l <= r) {
|
|
628
|
+
var f, d, g, p;
|
|
629
|
+
switch (l) {
|
|
585
630
|
case 1:
|
|
586
631
|
c < 128 && (u = c);
|
|
587
632
|
break;
|
|
588
633
|
case 2:
|
|
589
|
-
|
|
634
|
+
f = n[a + 1], (f & 192) === 128 && (p = (c & 31) << 6 | f & 63, p > 127 && (u = p));
|
|
590
635
|
break;
|
|
591
636
|
case 3:
|
|
592
|
-
|
|
637
|
+
f = n[a + 1], d = n[a + 2], (f & 192) === 128 && (d & 192) === 128 && (p = (c & 15) << 12 | (f & 63) << 6 | d & 63, p > 2047 && (p < 55296 || p > 57343) && (u = p));
|
|
593
638
|
break;
|
|
594
639
|
case 4:
|
|
595
|
-
|
|
640
|
+
f = n[a + 1], d = n[a + 2], g = n[a + 3], (f & 192) === 128 && (d & 192) === 128 && (g & 192) === 128 && (p = (c & 15) << 18 | (f & 63) << 12 | (d & 63) << 6 | g & 63, p > 65535 && p < 1114112 && (u = p));
|
|
596
641
|
}
|
|
597
642
|
}
|
|
598
|
-
u === null ? (u = 65533,
|
|
643
|
+
u === null ? (u = 65533, l = 1) : u > 65535 && (u -= 65536, s.push(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), s.push(u), a += l;
|
|
599
644
|
}
|
|
600
645
|
return decodeCodePointsArray(s);
|
|
601
646
|
}
|
|
@@ -740,9 +785,9 @@ Buffer.prototype.writeUIntLE = function(t, r, s, a) {
|
|
|
740
785
|
var c = Math.pow(2, 8 * s) - 1;
|
|
741
786
|
checkInt(this, t, r, s, c, 0);
|
|
742
787
|
}
|
|
743
|
-
var u = 1,
|
|
744
|
-
for (this[r] = t & 255; ++
|
|
745
|
-
this[r +
|
|
788
|
+
var u = 1, l = 0;
|
|
789
|
+
for (this[r] = t & 255; ++l < s && (u *= 256); )
|
|
790
|
+
this[r + l] = t / u & 255;
|
|
746
791
|
return r + s;
|
|
747
792
|
};
|
|
748
793
|
Buffer.prototype.writeUIntBE = function(t, r, s, a) {
|
|
@@ -750,9 +795,9 @@ Buffer.prototype.writeUIntBE = function(t, r, s, a) {
|
|
|
750
795
|
var c = Math.pow(2, 8 * s) - 1;
|
|
751
796
|
checkInt(this, t, r, s, c, 0);
|
|
752
797
|
}
|
|
753
|
-
var u = s - 1,
|
|
754
|
-
for (this[r + u] = t & 255; --u >= 0 && (
|
|
755
|
-
this[r + u] = t /
|
|
798
|
+
var u = s - 1, l = 1;
|
|
799
|
+
for (this[r + u] = t & 255; --u >= 0 && (l *= 256); )
|
|
800
|
+
this[r + u] = t / l & 255;
|
|
756
801
|
return r + s;
|
|
757
802
|
};
|
|
758
803
|
Buffer.prototype.writeUInt8 = function(t, r, s) {
|
|
@@ -785,9 +830,9 @@ Buffer.prototype.writeIntLE = function(t, r, s, a) {
|
|
|
785
830
|
var c = Math.pow(2, 8 * s - 1);
|
|
786
831
|
checkInt(this, t, r, s, c - 1, -c);
|
|
787
832
|
}
|
|
788
|
-
var u = 0,
|
|
789
|
-
for (this[r] = t & 255; ++u < s && (
|
|
790
|
-
t < 0 &&
|
|
833
|
+
var u = 0, l = 1, f = 0;
|
|
834
|
+
for (this[r] = t & 255; ++u < s && (l *= 256); )
|
|
835
|
+
t < 0 && f === 0 && this[r + u - 1] !== 0 && (f = 1), this[r + u] = (t / l >> 0) - f & 255;
|
|
791
836
|
return r + s;
|
|
792
837
|
};
|
|
793
838
|
Buffer.prototype.writeIntBE = function(t, r, s, a) {
|
|
@@ -795,9 +840,9 @@ Buffer.prototype.writeIntBE = function(t, r, s, a) {
|
|
|
795
840
|
var c = Math.pow(2, 8 * s - 1);
|
|
796
841
|
checkInt(this, t, r, s, c - 1, -c);
|
|
797
842
|
}
|
|
798
|
-
var u = s - 1,
|
|
799
|
-
for (this[r + u] = t & 255; --u >= 0 && (
|
|
800
|
-
t < 0 &&
|
|
843
|
+
var u = s - 1, l = 1, f = 0;
|
|
844
|
+
for (this[r + u] = t & 255; --u >= 0 && (l *= 256); )
|
|
845
|
+
t < 0 && f === 0 && this[r + u + 1] !== 0 && (f = 1), this[r + u] = (t / l >> 0) - f & 255;
|
|
801
846
|
return r + s;
|
|
802
847
|
};
|
|
803
848
|
Buffer.prototype.writeInt8 = function(t, r, s) {
|
|
@@ -886,9 +931,9 @@ Buffer.prototype.fill = function(t, r, s, a) {
|
|
|
886
931
|
for (u = r; u < s; ++u)
|
|
887
932
|
this[u] = t;
|
|
888
933
|
else {
|
|
889
|
-
var
|
|
934
|
+
var l = internalIsBuffer(t) ? t : utf8ToBytes(new Buffer(t, a).toString()), f = l.length;
|
|
890
935
|
for (u = 0; u < s - r; ++u)
|
|
891
|
-
this[u + r] =
|
|
936
|
+
this[u + r] = l[u % f];
|
|
892
937
|
}
|
|
893
938
|
return this;
|
|
894
939
|
};
|
|
@@ -1095,11 +1140,11 @@ class IndexedDBStorage {
|
|
|
1095
1140
|
const r = this;
|
|
1096
1141
|
return new Promise((s, a) => {
|
|
1097
1142
|
r.openDatabase().then(function(c) {
|
|
1098
|
-
const u = c.transaction(r.storeName, "readwrite"),
|
|
1099
|
-
|
|
1100
|
-
s(
|
|
1101
|
-
},
|
|
1102
|
-
a(
|
|
1143
|
+
const u = c.transaction(r.storeName, "readwrite"), f = u.objectStore(r.storeName).get(t);
|
|
1144
|
+
f.onsuccess = () => {
|
|
1145
|
+
s(f.result);
|
|
1146
|
+
}, f.onerror = () => {
|
|
1147
|
+
a(f.error);
|
|
1103
1148
|
}, u.oncomplete = () => {
|
|
1104
1149
|
c.close();
|
|
1105
1150
|
};
|
|
@@ -1115,13 +1160,13 @@ class IndexedDBStorage {
|
|
|
1115
1160
|
}, c.onerror = () => {
|
|
1116
1161
|
a(c.error);
|
|
1117
1162
|
}, c.onsuccess = (u) => {
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1163
|
+
const l = u.target.result, f = l.transaction(this.storeName, "readwrite"), g = f.objectStore(this.storeName).delete(t);
|
|
1164
|
+
g.onsuccess = () => {
|
|
1120
1165
|
s(null);
|
|
1121
|
-
},
|
|
1122
|
-
a(
|
|
1123
|
-
},
|
|
1124
|
-
|
|
1166
|
+
}, g.onerror = () => {
|
|
1167
|
+
a(g.error);
|
|
1168
|
+
}, f.oncomplete = () => {
|
|
1169
|
+
l.close();
|
|
1125
1170
|
};
|
|
1126
1171
|
};
|
|
1127
1172
|
});
|
|
@@ -1134,13 +1179,13 @@ class IndexedDBStorage {
|
|
|
1134
1179
|
}, c.onupgradeneeded = (u) => {
|
|
1135
1180
|
u.target.result.createObjectStore(this.storeName);
|
|
1136
1181
|
}, c.onsuccess = (u) => {
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1182
|
+
const l = u.target.result, f = l.transaction(this.storeName, "readwrite"), g = f.objectStore(this.storeName).put(r, t);
|
|
1183
|
+
g.onsuccess = () => {
|
|
1139
1184
|
s(r);
|
|
1140
|
-
},
|
|
1141
|
-
a(
|
|
1142
|
-
},
|
|
1143
|
-
|
|
1185
|
+
}, g.onerror = () => {
|
|
1186
|
+
a(g.error);
|
|
1187
|
+
}, f.oncomplete = () => {
|
|
1188
|
+
l.close();
|
|
1144
1189
|
};
|
|
1145
1190
|
};
|
|
1146
1191
|
});
|
|
@@ -1297,14 +1342,14 @@ var process = commonjsGlobal.process, sha256 = { exports: {} };
|
|
|
1297
1342
|
throw new Error(ERROR);
|
|
1298
1343
|
t = !0;
|
|
1299
1344
|
}
|
|
1300
|
-
for (var s, a = 0, c, u = n.length,
|
|
1301
|
-
if (this.hashed && (this.hashed = !1,
|
|
1345
|
+
for (var s, a = 0, c, u = n.length, l = this.blocks; a < u; ) {
|
|
1346
|
+
if (this.hashed && (this.hashed = !1, l[0] = this.block, l[16] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = l[9] = l[10] = l[11] = l[12] = l[13] = l[14] = l[15] = 0), t)
|
|
1302
1347
|
for (c = this.start; a < u && c < 64; ++a)
|
|
1303
|
-
|
|
1348
|
+
l[c >> 2] |= n[a] << SHIFT[c++ & 3];
|
|
1304
1349
|
else
|
|
1305
1350
|
for (c = this.start; a < u && c < 64; ++a)
|
|
1306
|
-
s = n.charCodeAt(a), s < 128 ?
|
|
1307
|
-
this.lastByteIndex = c, this.bytes += c - this.start, c >= 64 ? (this.block =
|
|
1351
|
+
s = n.charCodeAt(a), s < 128 ? l[c >> 2] |= s << SHIFT[c++ & 3] : s < 2048 ? (l[c >> 2] |= (192 | s >> 6) << SHIFT[c++ & 3], l[c >> 2] |= (128 | s & 63) << SHIFT[c++ & 3]) : s < 55296 || s >= 57344 ? (l[c >> 2] |= (224 | s >> 12) << SHIFT[c++ & 3], l[c >> 2] |= (128 | s >> 6 & 63) << SHIFT[c++ & 3], l[c >> 2] |= (128 | s & 63) << SHIFT[c++ & 3]) : (s = 65536 + ((s & 1023) << 10 | n.charCodeAt(++a) & 1023), l[c >> 2] |= (240 | s >> 18) << SHIFT[c++ & 3], l[c >> 2] |= (128 | s >> 12 & 63) << SHIFT[c++ & 3], l[c >> 2] |= (128 | s >> 6 & 63) << SHIFT[c++ & 3], l[c >> 2] |= (128 | s & 63) << SHIFT[c++ & 3]);
|
|
1352
|
+
this.lastByteIndex = c, this.bytes += c - this.start, c >= 64 ? (this.block = l[16], this.start = c - 64, this.hash(), this.hashed = !0) : this.start = c;
|
|
1308
1353
|
}
|
|
1309
1354
|
return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 << 0, this.bytes = this.bytes % 4294967296), this;
|
|
1310
1355
|
}
|
|
@@ -1315,19 +1360,19 @@ var process = commonjsGlobal.process, sha256 = { exports: {} };
|
|
|
1315
1360
|
n[16] = this.block, n[t >> 2] |= EXTRA[t & 3], this.block = n[16], t >= 56 && (this.hashed || this.hash(), n[0] = this.block, n[16] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = n[7] = n[8] = n[9] = n[10] = n[11] = n[12] = n[13] = n[14] = n[15] = 0), n[14] = this.hBytes << 3 | this.bytes >>> 29, n[15] = this.bytes << 3, this.hash();
|
|
1316
1361
|
}
|
|
1317
1362
|
}, Sha256.prototype.hash = function() {
|
|
1318
|
-
var n = this.h0, t = this.h1, r = this.h2, s = this.h3, a = this.h4, c = this.h5, u = this.h6,
|
|
1363
|
+
var n = this.h0, t = this.h1, r = this.h2, s = this.h3, a = this.h4, c = this.h5, u = this.h6, l = this.h7, f = this.blocks, d, g, p, y, w, x, S, R, v, b, _;
|
|
1319
1364
|
for (d = 16; d < 64; ++d)
|
|
1320
|
-
w =
|
|
1321
|
-
for (
|
|
1322
|
-
this.first ? (this.is224 ? (
|
|
1323
|
-
this.h0 = this.h0 + n << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + r << 0, this.h3 = this.h3 + s << 0, this.h4 = this.h4 + a << 0, this.h5 = this.h5 + c << 0, this.h6 = this.h6 + u << 0, this.h7 = this.h7 +
|
|
1365
|
+
w = f[d - 15], g = (w >>> 7 | w << 25) ^ (w >>> 18 | w << 14) ^ w >>> 3, w = f[d - 2], p = (w >>> 17 | w << 15) ^ (w >>> 19 | w << 13) ^ w >>> 10, f[d] = f[d - 16] + g + f[d - 7] + p << 0;
|
|
1366
|
+
for (_ = t & r, d = 0; d < 64; d += 4)
|
|
1367
|
+
this.first ? (this.is224 ? (R = 300032, w = f[0] - 1413257819, l = w - 150054599 << 0, s = w + 24177077 << 0) : (R = 704751109, w = f[0] - 210244248, l = w - 1521486534 << 0, s = w + 143694565 << 0), this.first = !1) : (g = (n >>> 2 | n << 30) ^ (n >>> 13 | n << 19) ^ (n >>> 22 | n << 10), p = (a >>> 6 | a << 26) ^ (a >>> 11 | a << 21) ^ (a >>> 25 | a << 7), R = n & t, y = R ^ n & r ^ _, S = a & c ^ ~a & u, w = l + p + S + K[d] + f[d], x = g + y, l = s + w << 0, s = w + x << 0), g = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), p = (l >>> 6 | l << 26) ^ (l >>> 11 | l << 21) ^ (l >>> 25 | l << 7), v = s & n, y = v ^ s & t ^ R, S = l & a ^ ~l & c, w = u + p + S + K[d + 1] + f[d + 1], x = g + y, u = r + w << 0, r = w + x << 0, g = (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10), p = (u >>> 6 | u << 26) ^ (u >>> 11 | u << 21) ^ (u >>> 25 | u << 7), b = r & s, y = b ^ r & n ^ v, S = u & l ^ ~u & a, w = c + p + S + K[d + 2] + f[d + 2], x = g + y, c = t + w << 0, t = w + x << 0, g = (t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10), p = (c >>> 6 | c << 26) ^ (c >>> 11 | c << 21) ^ (c >>> 25 | c << 7), _ = t & r, y = _ ^ t & s ^ b, S = c & u ^ ~c & l, w = a + p + S + K[d + 3] + f[d + 3], x = g + y, a = n + w << 0, n = w + x << 0;
|
|
1368
|
+
this.h0 = this.h0 + n << 0, this.h1 = this.h1 + t << 0, this.h2 = this.h2 + r << 0, this.h3 = this.h3 + s << 0, this.h4 = this.h4 + a << 0, this.h5 = this.h5 + c << 0, this.h6 = this.h6 + u << 0, this.h7 = this.h7 + l << 0;
|
|
1324
1369
|
}, Sha256.prototype.hex = function() {
|
|
1325
1370
|
this.finalize();
|
|
1326
|
-
var n = this.h0, t = this.h1, r = this.h2, s = this.h3, a = this.h4, c = this.h5, u = this.h6,
|
|
1327
|
-
return this.is224 || (
|
|
1371
|
+
var n = this.h0, t = this.h1, r = this.h2, s = this.h3, a = this.h4, c = this.h5, u = this.h6, l = this.h7, f = HEX_CHARS[n >> 28 & 15] + HEX_CHARS[n >> 24 & 15] + HEX_CHARS[n >> 20 & 15] + HEX_CHARS[n >> 16 & 15] + HEX_CHARS[n >> 12 & 15] + HEX_CHARS[n >> 8 & 15] + HEX_CHARS[n >> 4 & 15] + HEX_CHARS[n & 15] + HEX_CHARS[t >> 28 & 15] + HEX_CHARS[t >> 24 & 15] + HEX_CHARS[t >> 20 & 15] + HEX_CHARS[t >> 16 & 15] + HEX_CHARS[t >> 12 & 15] + HEX_CHARS[t >> 8 & 15] + HEX_CHARS[t >> 4 & 15] + HEX_CHARS[t & 15] + HEX_CHARS[r >> 28 & 15] + HEX_CHARS[r >> 24 & 15] + HEX_CHARS[r >> 20 & 15] + HEX_CHARS[r >> 16 & 15] + HEX_CHARS[r >> 12 & 15] + HEX_CHARS[r >> 8 & 15] + HEX_CHARS[r >> 4 & 15] + HEX_CHARS[r & 15] + HEX_CHARS[s >> 28 & 15] + HEX_CHARS[s >> 24 & 15] + HEX_CHARS[s >> 20 & 15] + HEX_CHARS[s >> 16 & 15] + HEX_CHARS[s >> 12 & 15] + HEX_CHARS[s >> 8 & 15] + HEX_CHARS[s >> 4 & 15] + HEX_CHARS[s & 15] + HEX_CHARS[a >> 28 & 15] + HEX_CHARS[a >> 24 & 15] + HEX_CHARS[a >> 20 & 15] + HEX_CHARS[a >> 16 & 15] + HEX_CHARS[a >> 12 & 15] + HEX_CHARS[a >> 8 & 15] + HEX_CHARS[a >> 4 & 15] + HEX_CHARS[a & 15] + HEX_CHARS[c >> 28 & 15] + HEX_CHARS[c >> 24 & 15] + HEX_CHARS[c >> 20 & 15] + HEX_CHARS[c >> 16 & 15] + HEX_CHARS[c >> 12 & 15] + HEX_CHARS[c >> 8 & 15] + HEX_CHARS[c >> 4 & 15] + HEX_CHARS[c & 15] + HEX_CHARS[u >> 28 & 15] + HEX_CHARS[u >> 24 & 15] + HEX_CHARS[u >> 20 & 15] + HEX_CHARS[u >> 16 & 15] + HEX_CHARS[u >> 12 & 15] + HEX_CHARS[u >> 8 & 15] + HEX_CHARS[u >> 4 & 15] + HEX_CHARS[u & 15];
|
|
1372
|
+
return this.is224 || (f += HEX_CHARS[l >> 28 & 15] + HEX_CHARS[l >> 24 & 15] + HEX_CHARS[l >> 20 & 15] + HEX_CHARS[l >> 16 & 15] + HEX_CHARS[l >> 12 & 15] + HEX_CHARS[l >> 8 & 15] + HEX_CHARS[l >> 4 & 15] + HEX_CHARS[l & 15]), f;
|
|
1328
1373
|
}, Sha256.prototype.toString = Sha256.prototype.hex, Sha256.prototype.digest = function() {
|
|
1329
1374
|
this.finalize();
|
|
1330
|
-
var n = this.h0, t = this.h1, r = this.h2, s = this.h3, a = this.h4, c = this.h5, u = this.h6,
|
|
1375
|
+
var n = this.h0, t = this.h1, r = this.h2, s = this.h3, a = this.h4, c = this.h5, u = this.h6, l = this.h7, f = [
|
|
1331
1376
|
n >> 24 & 255,
|
|
1332
1377
|
n >> 16 & 255,
|
|
1333
1378
|
n >> 8 & 255,
|
|
@@ -1357,7 +1402,7 @@ var process = commonjsGlobal.process, sha256 = { exports: {} };
|
|
|
1357
1402
|
u >> 8 & 255,
|
|
1358
1403
|
u & 255
|
|
1359
1404
|
];
|
|
1360
|
-
return this.is224 ||
|
|
1405
|
+
return this.is224 || f.push(l >> 24 & 255, l >> 16 & 255, l >> 8 & 255, l & 255), f;
|
|
1361
1406
|
}, Sha256.prototype.array = Sha256.prototype.digest, Sha256.prototype.arrayBuffer = function() {
|
|
1362
1407
|
this.finalize();
|
|
1363
1408
|
var n = new ArrayBuffer(this.is224 ? 28 : 32), t = new DataView(n);
|
|
@@ -1366,9 +1411,9 @@ var process = commonjsGlobal.process, sha256 = { exports: {} };
|
|
|
1366
1411
|
function HmacSha256(n, t, r) {
|
|
1367
1412
|
var s, a = typeof n;
|
|
1368
1413
|
if (a === "string") {
|
|
1369
|
-
var c = [], u = n.length,
|
|
1414
|
+
var c = [], u = n.length, l = 0, f;
|
|
1370
1415
|
for (s = 0; s < u; ++s)
|
|
1371
|
-
|
|
1416
|
+
f = n.charCodeAt(s), f < 128 ? c[l++] = f : f < 2048 ? (c[l++] = 192 | f >> 6, c[l++] = 128 | f & 63) : f < 55296 || f >= 57344 ? (c[l++] = 224 | f >> 12, c[l++] = 128 | f >> 6 & 63, c[l++] = 128 | f & 63) : (f = 65536 + ((f & 1023) << 10 | n.charCodeAt(++s) & 1023), c[l++] = 240 | f >> 18, c[l++] = 128 | f >> 12 & 63, c[l++] = 128 | f >> 6 & 63, c[l++] = 128 | f & 63);
|
|
1372
1417
|
n = c;
|
|
1373
1418
|
} else if (a === "object") {
|
|
1374
1419
|
if (n === null)
|
|
@@ -1380,12 +1425,12 @@ var process = commonjsGlobal.process, sha256 = { exports: {} };
|
|
|
1380
1425
|
} else
|
|
1381
1426
|
throw new Error(ERROR);
|
|
1382
1427
|
n.length > 64 && (n = new Sha256(t, !0).update(n).array());
|
|
1383
|
-
var d = [],
|
|
1428
|
+
var d = [], g = [];
|
|
1384
1429
|
for (s = 0; s < 64; ++s) {
|
|
1385
|
-
var
|
|
1386
|
-
d[s] = 92 ^
|
|
1430
|
+
var p = n[s] || 0;
|
|
1431
|
+
d[s] = 92 ^ p, g[s] = 54 ^ p;
|
|
1387
1432
|
}
|
|
1388
|
-
Sha256.call(this, t, r), this.update(
|
|
1433
|
+
Sha256.call(this, t, r), this.update(g), this.oKeyPad = d, this.inner = !0, this.sharedMemory = r;
|
|
1389
1434
|
}
|
|
1390
1435
|
HmacSha256.prototype = new Sha256(), HmacSha256.prototype.finalize = function() {
|
|
1391
1436
|
if (Sha256.prototype.finalize.call(this), this.inner) {
|
|
@@ -1438,15 +1483,15 @@ function getLines(n) {
|
|
|
1438
1483
|
let t, r, s, a = !1;
|
|
1439
1484
|
return function(u) {
|
|
1440
1485
|
t === void 0 ? (t = u, r = 0, s = -1) : t = concat(t, u);
|
|
1441
|
-
const
|
|
1442
|
-
let
|
|
1443
|
-
for (; r <
|
|
1444
|
-
a && (t[r] === 10 && (
|
|
1486
|
+
const l = t.length;
|
|
1487
|
+
let f = 0;
|
|
1488
|
+
for (; r < l; ) {
|
|
1489
|
+
a && (t[r] === 10 && (f = ++r), a = !1);
|
|
1445
1490
|
let d = -1;
|
|
1446
|
-
for (; r <
|
|
1491
|
+
for (; r < l && d === -1; ++r)
|
|
1447
1492
|
switch (t[r]) {
|
|
1448
1493
|
case 58:
|
|
1449
|
-
s === -1 && (s = r -
|
|
1494
|
+
s === -1 && (s = r - f);
|
|
1450
1495
|
break;
|
|
1451
1496
|
case 13:
|
|
1452
1497
|
a = !0;
|
|
@@ -1456,33 +1501,33 @@ function getLines(n) {
|
|
|
1456
1501
|
}
|
|
1457
1502
|
if (d === -1)
|
|
1458
1503
|
break;
|
|
1459
|
-
n(t.subarray(
|
|
1504
|
+
n(t.subarray(f, d), s), f = r, s = -1;
|
|
1460
1505
|
}
|
|
1461
|
-
|
|
1506
|
+
f === l ? t = void 0 : f !== 0 && (t = t.subarray(f), r -= f);
|
|
1462
1507
|
};
|
|
1463
1508
|
}
|
|
1464
1509
|
function getMessages(n, t, r) {
|
|
1465
1510
|
let s = newMessage();
|
|
1466
1511
|
const a = new TextDecoder();
|
|
1467
|
-
return function(u,
|
|
1512
|
+
return function(u, l) {
|
|
1468
1513
|
if (u.length === 0)
|
|
1469
1514
|
r == null || r(s), s = newMessage();
|
|
1470
|
-
else if (
|
|
1471
|
-
const
|
|
1472
|
-
switch (
|
|
1515
|
+
else if (l > 0) {
|
|
1516
|
+
const f = a.decode(u.subarray(0, l)), d = l + (u[l + 1] === 32 ? 2 : 1), g = a.decode(u.subarray(d));
|
|
1517
|
+
switch (f) {
|
|
1473
1518
|
case "data":
|
|
1474
1519
|
s.data = s.data ? s.data + `
|
|
1475
|
-
` +
|
|
1520
|
+
` + g : g;
|
|
1476
1521
|
break;
|
|
1477
1522
|
case "event":
|
|
1478
|
-
s.event =
|
|
1523
|
+
s.event = g;
|
|
1479
1524
|
break;
|
|
1480
1525
|
case "id":
|
|
1481
|
-
n(s.id =
|
|
1526
|
+
n(s.id = g);
|
|
1482
1527
|
break;
|
|
1483
1528
|
case "retry":
|
|
1484
|
-
const
|
|
1485
|
-
isNaN(
|
|
1529
|
+
const p = parseInt(g, 10);
|
|
1530
|
+
isNaN(p) || t(s.retry = p);
|
|
1486
1531
|
break;
|
|
1487
1532
|
}
|
|
1488
1533
|
}
|
|
@@ -1511,44 +1556,44 @@ var __rest = function(n, t) {
|
|
|
1511
1556
|
};
|
|
1512
1557
|
const EventStreamContentType = "text/event-stream", DefaultRetryInterval = 1e3, LastEventId = "last-event-id";
|
|
1513
1558
|
function fetchEventSource(n, t) {
|
|
1514
|
-
var { signal: r, headers: s, onopen: a, onmessage: c, onclose: u, onerror:
|
|
1515
|
-
return new Promise((
|
|
1559
|
+
var { signal: r, headers: s, onopen: a, onmessage: c, onclose: u, onerror: l, openWhenHidden: f, fetch: d } = t, g = __rest(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
1560
|
+
return new Promise((p, y) => {
|
|
1516
1561
|
const w = Object.assign({}, s);
|
|
1517
1562
|
w.accept || (w.accept = EventStreamContentType);
|
|
1518
1563
|
let x;
|
|
1519
1564
|
function S() {
|
|
1520
|
-
x.abort(), document.hidden ||
|
|
1565
|
+
x.abort(), document.hidden || T();
|
|
1521
1566
|
}
|
|
1522
|
-
|
|
1523
|
-
let
|
|
1567
|
+
f || document.addEventListener("visibilitychange", S);
|
|
1568
|
+
let R = DefaultRetryInterval, v = 0;
|
|
1524
1569
|
function b() {
|
|
1525
|
-
document.removeEventListener("visibilitychange", S), window.clearTimeout(
|
|
1570
|
+
document.removeEventListener("visibilitychange", S), window.clearTimeout(v), x.abort();
|
|
1526
1571
|
}
|
|
1527
1572
|
r == null || r.addEventListener("abort", () => {
|
|
1528
|
-
b(),
|
|
1573
|
+
b(), p();
|
|
1529
1574
|
});
|
|
1530
|
-
const
|
|
1531
|
-
async function
|
|
1532
|
-
var
|
|
1575
|
+
const _ = d ?? window.fetch, U = a ?? defaultOnOpen;
|
|
1576
|
+
async function T() {
|
|
1577
|
+
var k;
|
|
1533
1578
|
x = new AbortController();
|
|
1534
1579
|
try {
|
|
1535
|
-
const
|
|
1536
|
-
await U(
|
|
1580
|
+
const I = await _(n, Object.assign(Object.assign({}, g), { headers: w, signal: x.signal }));
|
|
1581
|
+
await U(I), await getBytes(I.body, getLines(getMessages((A) => {
|
|
1537
1582
|
A ? w[LastEventId] = A : delete w[LastEventId];
|
|
1538
1583
|
}, (A) => {
|
|
1539
|
-
|
|
1540
|
-
}, c))), u == null || u(), b(),
|
|
1541
|
-
} catch (
|
|
1584
|
+
R = A;
|
|
1585
|
+
}, c))), u == null || u(), b(), p();
|
|
1586
|
+
} catch (I) {
|
|
1542
1587
|
if (!x.signal.aborted)
|
|
1543
1588
|
try {
|
|
1544
|
-
const A = (
|
|
1545
|
-
window.clearTimeout(
|
|
1589
|
+
const A = (k = l == null ? void 0 : l(I)) !== null && k !== void 0 ? k : R;
|
|
1590
|
+
window.clearTimeout(v), v = window.setTimeout(T, A);
|
|
1546
1591
|
} catch (A) {
|
|
1547
1592
|
b(), y(A);
|
|
1548
1593
|
}
|
|
1549
1594
|
}
|
|
1550
1595
|
}
|
|
1551
|
-
|
|
1596
|
+
T();
|
|
1552
1597
|
});
|
|
1553
1598
|
}
|
|
1554
1599
|
function defaultOnOpen(n) {
|
|
@@ -1829,10 +1874,10 @@ class NylasSessions {
|
|
|
1829
1874
|
async codeExchange(t) {
|
|
1830
1875
|
let r = new URLSearchParams(window.location.search);
|
|
1831
1876
|
t && (r = new URLSearchParams(t));
|
|
1832
|
-
const s = r.get("code"), a = r.get("state"), c = r.get("error"), u = r.get("error_description"),
|
|
1833
|
-
if (c && u &&
|
|
1877
|
+
const s = r.get("code"), a = r.get("state"), c = r.get("error"), u = r.get("error_description"), l = r.get("error_code");
|
|
1878
|
+
if (c && u && l) {
|
|
1834
1879
|
const d = {
|
|
1835
|
-
detail: { error: c, error_description: u, error_code:
|
|
1880
|
+
detail: { error: c, error_description: u, error_code: l }
|
|
1836
1881
|
};
|
|
1837
1882
|
return window.dispatchEvent(new CustomEvent("onLoginFail", d)), window.history.pushState({}, document.title, window.location.pathname), !1;
|
|
1838
1883
|
}
|
|
@@ -1840,8 +1885,8 @@ class NylasSessions {
|
|
|
1840
1885
|
return console.warn("No code found"), !1;
|
|
1841
1886
|
if (window.opener && window.name === "uas-popup")
|
|
1842
1887
|
return console.warn("Popup window detected"), !1;
|
|
1843
|
-
const
|
|
1844
|
-
if (!
|
|
1888
|
+
const f = await this.Storage.getPKCE();
|
|
1889
|
+
if (!f)
|
|
1845
1890
|
return console.warn("No code verifier found"), !1;
|
|
1846
1891
|
try {
|
|
1847
1892
|
const d = {
|
|
@@ -1849,18 +1894,18 @@ class NylasSessions {
|
|
|
1849
1894
|
redirect_uri: this.redirectUri,
|
|
1850
1895
|
code: s,
|
|
1851
1896
|
grant_type: "authorization_code",
|
|
1852
|
-
code_verifier:
|
|
1853
|
-
},
|
|
1897
|
+
code_verifier: f
|
|
1898
|
+
}, p = await (await fetch(`${this.domain}/connect/token`, {
|
|
1854
1899
|
method: "POST",
|
|
1855
1900
|
headers: new Headers({ "content-type": "application/json" }),
|
|
1856
1901
|
body: JSON.stringify(d)
|
|
1857
1902
|
})).json();
|
|
1858
|
-
if (
|
|
1859
|
-
if (
|
|
1860
|
-
const w = { detail:
|
|
1903
|
+
if (p) {
|
|
1904
|
+
if (p.error) {
|
|
1905
|
+
const w = { detail: p };
|
|
1861
1906
|
return window.dispatchEvent(new CustomEvent("onLoginFail", w)), !0;
|
|
1862
1907
|
}
|
|
1863
|
-
const y = await this.handleCodeExchangeResponse(
|
|
1908
|
+
const y = await this.handleCodeExchangeResponse(p);
|
|
1864
1909
|
if (y.valid) {
|
|
1865
1910
|
a && (y.data.state = a);
|
|
1866
1911
|
const w = { detail: y.data };
|
|
@@ -1872,8 +1917,8 @@ class NylasSessions {
|
|
|
1872
1917
|
}
|
|
1873
1918
|
return this.Storage.removePKCE(), !0;
|
|
1874
1919
|
} catch (d) {
|
|
1875
|
-
const
|
|
1876
|
-
return window.dispatchEvent(new CustomEvent("onLoginFail",
|
|
1920
|
+
const g = { detail: d };
|
|
1921
|
+
return window.dispatchEvent(new CustomEvent("onLoginFail", g)), window.history.pushState({}, document.title, window.location.pathname), !1;
|
|
1877
1922
|
}
|
|
1878
1923
|
}
|
|
1879
1924
|
// Token Exchange for session maintenece
|
|
@@ -1900,8 +1945,8 @@ class NylasSessions {
|
|
|
1900
1945
|
const d = { detail: c };
|
|
1901
1946
|
return window.dispatchEvent(new CustomEvent("onTokenRefreshFail", d)), !0;
|
|
1902
1947
|
}
|
|
1903
|
-
const
|
|
1904
|
-
return window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",
|
|
1948
|
+
const f = { detail: c };
|
|
1949
|
+
return window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess", f)), !0;
|
|
1905
1950
|
}
|
|
1906
1951
|
this.Storage.removePKCE();
|
|
1907
1952
|
} catch (s) {
|
|
@@ -1929,25 +1974,25 @@ class NylasSessions {
|
|
|
1929
1974
|
}
|
|
1930
1975
|
// Regulates POPUP behaivior
|
|
1931
1976
|
async popUp(t) {
|
|
1932
|
-
const a = window.screenX + (window.outerWidth - 500) / 2, c = window.screenY + (window.outerHeight - 600) / 2.5, u = "uas-popup",
|
|
1933
|
-
if (!
|
|
1977
|
+
const a = window.screenX + (window.outerWidth - 500) / 2, c = window.screenY + (window.outerHeight - 600) / 2.5, u = "uas-popup", l = t, f = window.open(l, u, `width=500,height=600,left=${a},top=${c}`);
|
|
1978
|
+
if (!f)
|
|
1934
1979
|
return;
|
|
1935
1980
|
const d = setInterval(async () => {
|
|
1936
|
-
if (
|
|
1937
|
-
const
|
|
1981
|
+
if (f.closed) {
|
|
1982
|
+
const g = {
|
|
1938
1983
|
detail: { error_description: "OAuth provider window closed" }
|
|
1939
1984
|
};
|
|
1940
|
-
window.dispatchEvent(new CustomEvent("onLoginFail",
|
|
1985
|
+
window.dispatchEvent(new CustomEvent("onLoginFail", g)), d && clearInterval(d);
|
|
1941
1986
|
return;
|
|
1942
1987
|
}
|
|
1943
1988
|
try {
|
|
1944
|
-
const
|
|
1945
|
-
if (!
|
|
1989
|
+
const g = f.location.href.split("?");
|
|
1990
|
+
if (!g[0])
|
|
1946
1991
|
return;
|
|
1947
|
-
const
|
|
1948
|
-
if (
|
|
1949
|
-
const y = await this.codeExchange(
|
|
1950
|
-
|
|
1992
|
+
const p = f.location.search;
|
|
1993
|
+
if (f.history.pushState({}, document.title, window.location.pathname), g[0] === this.redirectUri && g.length > 1) {
|
|
1994
|
+
const y = await this.codeExchange(p);
|
|
1995
|
+
f.close(), y && location.reload(), d && clearInterval(d);
|
|
1951
1996
|
return;
|
|
1952
1997
|
}
|
|
1953
1998
|
} catch {
|
|
@@ -1980,31 +2025,31 @@ class NylasSessions {
|
|
|
1980
2025
|
if (this.multiAccount) {
|
|
1981
2026
|
if (!r.grant_id)
|
|
1982
2027
|
throw new Error("Grant ID is required for multi account calls");
|
|
1983
|
-
const
|
|
1984
|
-
u =
|
|
2028
|
+
const f = await this.getProfiles();
|
|
2029
|
+
u = f ? f.length : 1, c = await this.getAccessToken(r.grant_id);
|
|
1985
2030
|
} else
|
|
1986
2031
|
c = await this.getAccessToken();
|
|
1987
|
-
let
|
|
1988
|
-
Headers.prototype.isPrototypeOf(
|
|
2032
|
+
let l = r.headers;
|
|
2033
|
+
Headers.prototype.isPrototypeOf(l) ? (l.append("Authorization", `Bearer ${c}`), l.has("content-type") || l.append("content-type", "application/json")) : l = new Headers({
|
|
1989
2034
|
Authorization: `Bearer ${c}`,
|
|
1990
2035
|
"content-type": "application/json"
|
|
1991
2036
|
});
|
|
1992
2037
|
try {
|
|
1993
2038
|
r != null && r.body && (r.body = JSON.stringify(r == null ? void 0 : r.body));
|
|
1994
|
-
const
|
|
2039
|
+
const f = await fetch(`${a || this.domain}/${t}`, {
|
|
1995
2040
|
...r,
|
|
1996
|
-
headers:
|
|
2041
|
+
headers: l
|
|
1997
2042
|
});
|
|
1998
2043
|
if (!s)
|
|
1999
|
-
return
|
|
2000
|
-
const d = await (
|
|
2001
|
-
if (!await this.isAuthenticatedResponse(
|
|
2044
|
+
return f;
|
|
2045
|
+
const d = await (f == null ? void 0 : f.json());
|
|
2046
|
+
if (!await this.isAuthenticatedResponse(f.status, d)) {
|
|
2002
2047
|
if (u > 1) {
|
|
2003
|
-
const
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
2048
|
+
const p = await this.getProfile(r.grant_id);
|
|
2049
|
+
if (p) {
|
|
2050
|
+
p.status = "unauthorized", await this.Storage.setUserToken(p);
|
|
2006
2051
|
const y = {
|
|
2007
|
-
detail: { user:
|
|
2052
|
+
detail: { user: p }
|
|
2008
2053
|
};
|
|
2009
2054
|
window.dispatchEvent(new CustomEvent("onSessionExpired", y));
|
|
2010
2055
|
}
|
|
@@ -2017,17 +2062,17 @@ class NylasSessions {
|
|
|
2017
2062
|
return;
|
|
2018
2063
|
}
|
|
2019
2064
|
return d;
|
|
2020
|
-
} catch (
|
|
2021
|
-
throw
|
|
2065
|
+
} catch (f) {
|
|
2066
|
+
throw f;
|
|
2022
2067
|
}
|
|
2023
2068
|
}
|
|
2024
2069
|
async fetchRequest(t, r, s, a = !0, c, u) {
|
|
2025
|
-
const
|
|
2026
|
-
if (d.append("Accept", "application/json"), d.append("Content-Type", "application/json"), d.append("User-Agent", "nylas-identity"),
|
|
2070
|
+
const l = await this.isLoggedIn(), f = new URL(t, c ?? this.domain), d = new Headers();
|
|
2071
|
+
if (d.append("Accept", "application/json"), d.append("Content-Type", "application/json"), d.append("User-Agent", "nylas-identity"), l) {
|
|
2027
2072
|
const y = await this.getAccessToken();
|
|
2028
2073
|
d.append("Authorization", `Bearer ${y}`);
|
|
2029
2074
|
}
|
|
2030
|
-
const
|
|
2075
|
+
const g = await fetch(f.toString(), {
|
|
2031
2076
|
method: r || "GET",
|
|
2032
2077
|
headers: d,
|
|
2033
2078
|
mode: "cors",
|
|
@@ -2035,7 +2080,7 @@ class NylasSessions {
|
|
|
2035
2080
|
body: s ? JSON.stringify(s) : void 0,
|
|
2036
2081
|
...u || {}
|
|
2037
2082
|
});
|
|
2038
|
-
return a ? await
|
|
2083
|
+
return a ? await g.json() : g.body;
|
|
2039
2084
|
}
|
|
2040
2085
|
// Checks if the response is not 401
|
|
2041
2086
|
async isAuthenticatedResponse(t, r) {
|
|
@@ -2089,28 +2134,78 @@ var H = G.prototype = new F();
|
|
|
2089
2134
|
H.constructor = G;
|
|
2090
2135
|
C(H, E.prototype);
|
|
2091
2136
|
H.isPureReactComponent = !0;
|
|
2092
|
-
const
|
|
2137
|
+
const LoginRequired = ({ authenticationUrl: n }) => h(
|
|
2138
|
+
"div",
|
|
2139
|
+
{ class: "login-required" },
|
|
2140
|
+
h(
|
|
2141
|
+
"div",
|
|
2142
|
+
{ class: "card" },
|
|
2143
|
+
h("p", null, "Log into your account to use the Scheduler Editor."),
|
|
2144
|
+
h(
|
|
2145
|
+
"button",
|
|
2146
|
+
{ class: "google-button", onClick: async (t) => {
|
|
2147
|
+
t.preventDefault();
|
|
2148
|
+
const r = await n("google");
|
|
2149
|
+
r ? window.location.href = r : console.error("[nylas-scheduler-editor] Unable to get authentication URL.");
|
|
2150
|
+
} },
|
|
2151
|
+
h(
|
|
2152
|
+
"span",
|
|
2153
|
+
{ class: "icon" },
|
|
2154
|
+
h("google-logo-icon", { width: "15", height: "15" })
|
|
2155
|
+
),
|
|
2156
|
+
"Continue with Google"
|
|
2157
|
+
),
|
|
2158
|
+
h(
|
|
2159
|
+
"button",
|
|
2160
|
+
{ class: "microsoft-button", onClick: async (t) => {
|
|
2161
|
+
t.preventDefault();
|
|
2162
|
+
const r = await n("microsoft");
|
|
2163
|
+
r ? window.location.href = r : console.error("[nylas-scheduler-editor] Unable to get authentication URL.");
|
|
2164
|
+
} },
|
|
2165
|
+
h(
|
|
2166
|
+
"span",
|
|
2167
|
+
{ class: "icon" },
|
|
2168
|
+
h("microsoft-logo-icon", { width: "15", height: "15" })
|
|
2169
|
+
),
|
|
2170
|
+
"Continue with Microsoft"
|
|
2171
|
+
),
|
|
2172
|
+
h(
|
|
2173
|
+
"button",
|
|
2174
|
+
{ class: "other-provider-button", onClick: async (t) => {
|
|
2175
|
+
t.preventDefault();
|
|
2176
|
+
const r = await n();
|
|
2177
|
+
r ? window.location.href = r : console.error("[nylas-scheduler-editor] Unable to get authentication URL.");
|
|
2178
|
+
} },
|
|
2179
|
+
"View all providers ",
|
|
2180
|
+
h("chevron-icon", { width: "17", height: "17" })
|
|
2181
|
+
),
|
|
2182
|
+
h("small", { class: "disclaimer-text" }, "* You will be redirected to authenticate your account.")
|
|
2183
|
+
)
|
|
2184
|
+
), nylasSchedulerEditorCss = ':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 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px 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}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}div.scheduler-editor-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900)}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;width:858px;margin:0;font-size:18px;line-height:24px;font-weight:600}@media screen and (max-width: 768px){div.scheduler-editor-header h1.scheduler-editor-title{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary)}div.scheduler-editor-header button:disabled{cursor:not-allowed}nylas-editor-tabs{width:auto}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;max-width:fit-content;align-self:center}.login-required{display:flex;flex-direction:column;padding:2rem 1rem;background-color:var(--nylas-base-25)}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:1rem;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}.list-configurations{padding:2rem}', NylasSchedulerEditorStyle0 = nylasSchedulerEditorCss, NylasSchedulerEditor = class {
|
|
2093
2185
|
constructor(n) {
|
|
2094
2186
|
registerInstance(this, n), this.init = createEvent(this, "init", 7), this.loggedIn = createEvent(this, "loggedIn", 7), this.loggedOut = createEvent(this, "loggedOut", 7), this.schedulerConfigCloseClicked = createEvent(this, "schedulerConfigCloseClicked", 7), this.handleSchedulerConfigCloseClicked = (t) => {
|
|
2095
2187
|
this.schedulerConfigCloseClicked.emit(this.host);
|
|
2096
|
-
}, this.configurationId = void 0, this.nylasApiRequest = void 0, this.nylasSessionsConfig = void 0, this.eventOverrides = {}, this.defaultSchedulerConfigStoreState = void 0, this.mode = "app", this.automaticComponentRegistration = !0;
|
|
2188
|
+
}, this.authenticationUrl = async (t) => this.nylasApiRequest ? await this.nylasApiRequest.authenticationUrl({ provider: t }) || "" : (console.error("[nylas-scheduler-editor] Nylas API Request is not initialized."), ""), this.defaultRequiresSessionAuth = !0, this.configurationId = void 0, this.nylasApiRequest = void 0, this.nylasSessionsConfig = void 0, this.eventOverrides = {}, this.schedulerPreviewLink = "", this.defaultSchedulerConfigStoreState = void 0, this.mode = "app", this.automaticComponentRegistration = !0;
|
|
2097
2189
|
}
|
|
2098
2190
|
connectedCallback() {
|
|
2099
2191
|
debug("[nylas-scheduler-editor] connectedCallback");
|
|
2100
2192
|
}
|
|
2101
2193
|
async componentWillLoad() {
|
|
2102
|
-
var r, s, a, c, u,
|
|
2194
|
+
var r, s, a, c, u, l, f, d, g;
|
|
2103
2195
|
if (debug("[nylas-scheduler-editor] componentWillLoad"), this.stores = {
|
|
2104
2196
|
schedulerConfig: CreateNylasSchedulerConfigStore({
|
|
2105
2197
|
...this.defaultSchedulerConfigStoreState
|
|
2106
2198
|
})
|
|
2107
|
-
}, !this.nylasApiRequest && this.nylasSessionsConfig) {
|
|
2108
|
-
const
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2199
|
+
}, (s = (r = this.stores) == null ? void 0 : r.schedulerConfig) == null || s.set("defaultRequiresSessionAuth", this.defaultRequiresSessionAuth), !this.nylasApiRequest && this.nylasSessionsConfig) {
|
|
2200
|
+
const p = new NylasSessions(this.nylasSessionsConfig);
|
|
2201
|
+
await p.isLoggedIn(), p.onLoginSuccess(async () => {
|
|
2202
|
+
var w, x;
|
|
2203
|
+
const y = await ((x = (w = this.nylasSchedulerConfigConnector) == null ? void 0 : w.schedulerConfig) == null ? void 0 : x.currentUser());
|
|
2204
|
+
y && (this.loggedIn.emit(this.host), this.loggedInHandler(y));
|
|
2205
|
+
}), p.onLoginFail(async () => {
|
|
2206
|
+
var y, w;
|
|
2207
|
+
(w = (y = this.stores) == null ? void 0 : y.schedulerConfig) == null || w.set("currentUser", null), this.loggedOut.emit(this.host);
|
|
2208
|
+
}), this.nylasApiRequest = new NylasIdentityRequestWrapper(p);
|
|
2114
2209
|
}
|
|
2115
2210
|
this.baseProvider = new NylasBaseProvider(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
|
|
2116
2211
|
const n = this.baseProvider.getStore("schedulerConfig");
|
|
@@ -2118,22 +2213,28 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
2118
2213
|
nylasApiRequest: this.nylasApiRequest,
|
|
2119
2214
|
nylasSchedulerConfigStore: n
|
|
2120
2215
|
}), !this.init.emit(this.host).defaultPrevented) {
|
|
2121
|
-
const
|
|
2122
|
-
|
|
2216
|
+
const p = await ((c = (a = this.nylasSchedulerConfigConnector) == null ? void 0 : a.schedulerConfig) == null ? void 0 : c.currentUser());
|
|
2217
|
+
p ? (this.loggedIn.emit(this.host), await this.loggedInHandler(p)) : ((l = (u = this.stores) == null ? void 0 : u.schedulerConfig) == null || l.set("currentUser", null), this.loggedOut.emit(this.host));
|
|
2123
2218
|
}
|
|
2124
|
-
(
|
|
2219
|
+
(d = (f = this.stores) == null ? void 0 : f.schedulerConfig) == null || d.onChange("config", async (p) => {
|
|
2220
|
+
p && p.id && (this.configurationId = p.id);
|
|
2221
|
+
}), (g = this.baseProvider) == null || g.componentWillLoad(this.nylasSchedulerConfigConnector);
|
|
2125
2222
|
}
|
|
2126
2223
|
async componentDidLoad() {
|
|
2127
|
-
var n
|
|
2128
|
-
debug("[nylas-scheduler-editor] componentDidLoad"), (n = this.baseProvider) == null || n.componentDidLoad()
|
|
2224
|
+
var n;
|
|
2225
|
+
debug("[nylas-scheduler-editor] componentDidLoad"), (n = this.baseProvider) == null || n.componentDidLoad();
|
|
2129
2226
|
}
|
|
2130
2227
|
componentDisconnected() {
|
|
2131
2228
|
var n;
|
|
2132
2229
|
(n = this.baseProvider) == null || n.componentDisconnected();
|
|
2133
2230
|
}
|
|
2231
|
+
defaultRequiresSessionAuthChanged(n) {
|
|
2232
|
+
var t, r;
|
|
2233
|
+
(r = (t = this.stores) == null ? void 0 : t.schedulerConfig) == null || r.set("defaultRequiresSessionAuth", n);
|
|
2234
|
+
}
|
|
2134
2235
|
async configurationIdChanged(n) {
|
|
2135
|
-
var t, r, s, a;
|
|
2136
|
-
n ? await ((r = (t = this.nylasSchedulerConfigConnector) == null ? void 0 : t.schedulerConfig) == null ? void 0 : r.getConfigurationById(n))
|
|
2236
|
+
var t, r, s, a, c, u, l, f;
|
|
2237
|
+
n ? (await ((r = (t = this.nylasSchedulerConfigConnector) == null ? void 0 : t.schedulerConfig) == null ? void 0 : r.getConfigurationById(n)), (a = (s = this.stores) == null ? void 0 : s.schedulerConfig) == null || a.set("action", "edit")) : ((u = (c = this.stores) == null ? void 0 : c.schedulerConfig) == null || u.set("config", {}), (f = (l = this.stores) == null ? void 0 : l.schedulerConfig) == null || f.set("action", null));
|
|
2137
2238
|
}
|
|
2138
2239
|
async store() {
|
|
2139
2240
|
var n;
|
|
@@ -2150,27 +2251,20 @@ const nylasSchedulerEditorCss = ':host{display:flex;flex-direction:column;overfl
|
|
|
2150
2251
|
var t;
|
|
2151
2252
|
(t = this.baseProvider) == null || t.unregisterComponent(n.detail);
|
|
2152
2253
|
}
|
|
2153
|
-
|
|
2254
|
+
async loggedInHandler(n) {
|
|
2154
2255
|
var t, r, s, a;
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
var u;
|
|
2161
|
-
const c = await ((u = this.nylasApiRequest) == null ? void 0 : u.authenticationUrl({ provider: "microsoft" }));
|
|
2162
|
-
c ? window.location.href = c : console.error("[nylas-scheduler-editor] Unable to get authentication URL.");
|
|
2163
|
-
} }, h("span", { class: "icon" }, h("microsoft-logo-icon", { width: "15", height: "15" })), "Continue with Microsoft"), h("button", { class: "other-provider-button", onClick: async () => {
|
|
2164
|
-
var u;
|
|
2165
|
-
const c = await ((u = this.nylasApiRequest) == null ? void 0 : u.authenticationUrl());
|
|
2166
|
-
c ? window.location.href = c : console.error("[nylas-scheduler-editor] Unable to get authentication URL.");
|
|
2167
|
-
} }, "View all providers ", h("chevron-icon", { width: "17", height: "17" })), h("small", { class: "disclaimer-text" }, "* You will be redirected to authenticate your account."))))) : h(Host, null, h("slot", null));
|
|
2256
|
+
(r = (t = this.stores) == null ? void 0 : t.schedulerConfig) == null || r.set("currentUser", n), this.nylasSchedulerConfigConnector && (this.configurationId && await ((s = this.nylasSchedulerConfigConnector.schedulerConfig) == null ? void 0 : s.getConfigurationById(this.configurationId)), await ((a = this.nylasSchedulerConfigConnector.schedulerConfig) == null ? void 0 : a.getCalendars()));
|
|
2257
|
+
}
|
|
2258
|
+
render() {
|
|
2259
|
+
var t, r, s, a, c, u;
|
|
2260
|
+
return this.mode === "app" ? h(Host, null, h("div", { class: "scheduler-editor-header", part: "nse__header" }, h("h1", { class: "scheduler-editor-title", part: "nse__title" }, h("calendar-icon", { width: "18", height: "18" }), "Scheduler editor"), h("button", { class: "scheduler-editor-close", onClick: (l) => this.handleSchedulerConfigCloseClicked(l), part: "nse__close-button" }, h("close-icon", { width: "18", height: "18" }))), ((r = (t = this.stores) == null ? void 0 : t.schedulerConfig) == null ? void 0 : r.state.currentUser) && this.stores.schedulerConfig.state.action === null && h("div", { class: "list-configurations" }, h("nylas-list-configurations", null)), ((a = (s = this.stores) == null ? void 0 : s.schedulerConfig) == null ? void 0 : a.state.currentUser) && (this.stores.schedulerConfig.state.action === "create" || this.stores.schedulerConfig.state.action === "edit") && h("nylas-editor-tabs", null), !((u = (c = this.stores) == null ? void 0 : c.schedulerConfig) != null && u.state.currentUser) && h("slot", { name: "login-required" }, h(LoginRequired, { authenticationUrl: this.authenticationUrl }))) : h(Host, null, h("slot", null));
|
|
2168
2261
|
}
|
|
2169
2262
|
get host() {
|
|
2170
2263
|
return getElement(this);
|
|
2171
2264
|
}
|
|
2172
2265
|
static get watchers() {
|
|
2173
2266
|
return {
|
|
2267
|
+
defaultRequiresSessionAuth: ["defaultRequiresSessionAuthChanged"],
|
|
2174
2268
|
configurationId: ["configurationIdChanged"]
|
|
2175
2269
|
};
|
|
2176
2270
|
}
|