@nylas/react 1.1.0-canary.17 → 1.1.0-canary.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-circle-icon_2.entry-3091976b.cjs +1 -0
- package/dist/add-circle-icon_2.entry-3b13ee64.js +25 -0
- package/dist/{archive-icon_7.entry-60e900b6.js → archive-icon_7.entry-8932618a.js} +14 -14
- package/dist/{archive-icon_7.entry-8c8317e9.cjs → archive-icon_7.entry-c2b6d860.cjs} +1 -1
- package/dist/{arrow-icon.entry-057db95a.js → arrow-icon.entry-1f54c377.js} +4 -4
- package/dist/{arrow-icon.entry-2d4e9572.cjs → arrow-icon.entry-a159bee8.cjs} +1 -1
- package/dist/{bold-icon_3.entry-557c6007.js → bold-icon_3.entry-447d0537.js} +6 -6
- package/dist/{bold-icon_3.entry-ba732761.cjs → bold-icon_3.entry-c51e1af3.cjs} +1 -1
- package/dist/{button-component.entry-22d0ac2e.js → button-component.entry-52ccb6d9.js} +2 -2
- package/dist/{button-component.entry-385f9581.cjs → button-component.entry-e79b2d08.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-b2657caf.cjs → calendar-cancel-icon.entry-805febcc.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-820cf967.js → calendar-cancel-icon.entry-a78f27bc.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-b13e7cbb.cjs → calendar-check-icon_2.entry-4a0fd7bd.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-128a5d67.js → calendar-check-icon_2.entry-7c8b6c92.js} +9 -9
- package/dist/{calendar-icon.entry-d17d7cfb.cjs → calendar-icon.entry-1fc018b4.cjs} +1 -1
- package/dist/{calendar-icon.entry-a43e6011.js → calendar-icon.entry-96f9727f.js} +2 -2
- package/dist/{calendar-info-icon_28.entry-b4f09bfe.cjs → calendar-info-icon_28.entry-2054703c.cjs} +1 -1
- package/dist/{calendar-info-icon_28.entry-b71c23c5.js → calendar-info-icon_28.entry-e7bebd13.js} +34 -34
- package/dist/{chevron-icon_3.entry-e0796c69.js → chevron-icon_3.entry-25d90239.js} +6 -6
- package/dist/chevron-icon_3.entry-7bd4a4b5.cjs +1 -0
- package/dist/{clock-icon_2.entry-267614c2.cjs → clock-icon_2.entry-2406c3d0.cjs} +1 -1
- package/dist/{clock-icon_2.entry-e959ae50.js → clock-icon_2.entry-c1b22ed4.js} +9 -9
- package/dist/{constants-f34b9c6e-ebc2e19c.cjs → constants-f34b9c6e-b774916c.cjs} +1 -1
- package/dist/{constants-f34b9c6e-efe2836b.js → constants-f34b9c6e-f1c4dd0d.js} +1 -1
- package/dist/document-refresh-icon.entry-570f9c9d.js +15 -0
- package/dist/document-refresh-icon.entry-a0293858.cjs +1 -0
- package/dist/{elements-dc5b338e-a33785e3.cjs → elements-dc5b338e-550a6cb1.cjs} +1 -1
- package/dist/{elements-dc5b338e-b0a290ae.js → elements-dc5b338e-cafa7a55.js} +1 -1
- package/dist/{focus-visible-e8093c16-5f1ae916.js → focus-visible-e8093c16-022799ce.js} +1 -1
- package/dist/{focus-visible-e8093c16-d2afb13d.cjs → focus-visible-e8093c16-c14162e8.cjs} +1 -1
- package/dist/{forward-icon_6.entry-0009e4f0.cjs → forward-icon_6.entry-55752b23.cjs} +3 -3
- package/dist/{forward-icon_6.entry-53683e82.js → forward-icon_6.entry-9b832146.js} +9 -9
- package/dist/{globe-icon.entry-dbb47687.js → globe-icon.entry-2b61820e.js} +2 -2
- package/dist/{globe-icon.entry-df67eab8.cjs → globe-icon.entry-dabe7b8b.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-60c0d39a.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-77f3b86e.js → google-logo-icon_4.entry-a0dc33da.js} +127 -114
- package/dist/index-53420959-67beefed.js +5 -0
- package/dist/index-53420959-d3254a34.cjs +1 -0
- package/dist/{index-6d9eeb53-ded66877.cjs → index-6d9eeb53-3049fc04.cjs} +1 -1
- package/dist/{index-6d9eeb53-2f37342f.js → index-6d9eeb53-3edef246.js} +2 -2
- package/dist/{index-5851f0a2.js → index-812162da.js} +42 -42
- package/dist/{index-769f0fdd.cjs → index-e3e9b594.cjs} +2 -2
- package/dist/{index.es-9cc0eb3c-e8de46e6.cjs → index.es-9cc0eb3c-0c99c055.cjs} +1 -1
- package/dist/{index.es-9cc0eb3c-2cf4632f.js → index.es-9cc0eb3c-52226859.js} +1 -1
- package/dist/{info-icon_2.entry-c27ac645.js → info-icon_2.entry-2fe6c16c.js} +8 -8
- package/dist/{info-icon_2.entry-e355fb7d.cjs → info-icon_2.entry-5f6b9af8.cjs} +1 -1
- package/dist/{input-component.entry-a38a65da.js → input-component.entry-1195d579.js} +6 -6
- package/dist/{input-component.entry-ef2b397d.cjs → input-component.entry-2b6e44c4.cjs} +1 -1
- package/dist/{input-dropdown_2.entry-ce1da1b3.js → input-dropdown_2.entry-dbd0d6f4.js} +3 -3
- package/dist/{input-dropdown_2.entry-9e50060e.cjs → input-dropdown_2.entry-dbdb5aa3.cjs} +1 -1
- package/dist/loading-icon.entry-027a2ad1.js +15 -0
- package/dist/loading-icon.entry-e179f122.cjs +1 -0
- package/dist/{mailbox-store-64b4ef7c-ebe84c96.cjs → mailbox-store-64b4ef7c-0eac526c.cjs} +1 -1
- package/dist/{mailbox-store-64b4ef7c-47dac9aa.js → mailbox-store-64b4ef7c-22a6c565.js} +2 -2
- package/dist/nylas-booked-event-card_10.entry-84f64ba5.cjs +1 -0
- package/dist/{nylas-booked-event-card_10.entry-ef9c2d62.js → nylas-booked-event-card_10.entry-e0990f5b.js} +170 -170
- package/dist/{nylas-custom-booking-flow.entry-c59c1306.cjs → nylas-custom-booking-flow.entry-898c8cc9.cjs} +1 -1
- package/dist/{nylas-custom-booking-flow.entry-f31400e2.js → nylas-custom-booking-flow.entry-bc64af5f.js} +3 -3
- package/dist/{nylas-form-card.entry-bc048703.cjs → nylas-form-card.entry-0c71f4fc.cjs} +1 -1
- package/dist/{nylas-form-card.entry-b189e066.js → nylas-form-card.entry-c564b52e.js} +14 -14
- package/dist/{nylas-if-state.entry-5bdf8669.js → nylas-if-state.entry-e9486e12.js} +3 -3
- package/dist/{nylas-if-state.entry-933c79e0.cjs → nylas-if-state.entry-ff6a2046.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-f0e7ae4e.js → nylas-list-folders.entry-0258af1e.js} +7 -7
- package/dist/{nylas-list-folders.entry-5d1bef7f.cjs → nylas-list-folders.entry-90716d2b.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-3f7451ad.js → nylas-list-threads.entry-1abcdd30.js} +3 -3
- package/dist/{nylas-list-threads.entry-3e300e7e.cjs → nylas-list-threads.entry-21edf012.cjs} +1 -1
- package/dist/{nylas-login.entry-dbf9e11f.cjs → nylas-login.entry-2e0ce95e.cjs} +1 -1
- package/dist/{nylas-login.entry-e3b757a0.js → nylas-login.entry-ba7383ac.js} +7 -7
- package/dist/{nylas-mailbox-pagination.entry-0db12a01.cjs → nylas-mailbox-pagination.entry-ba6beb08.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-6c845a2a.js → nylas-mailbox-pagination.entry-f6186560.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-553f041a.cjs → nylas-mailbox-toolbar-button.entry-0875aadb.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-ec196947.js → nylas-mailbox-toolbar-button.entry-e18059b0.js} +10 -10
- package/dist/{nylas-mailbox.entry-1552ad11.js → nylas-mailbox.entry-2e3815ed.js} +7 -7
- package/dist/{nylas-mailbox.entry-c0bbca56.cjs → nylas-mailbox.entry-bb2905bf.cjs} +1 -1
- package/dist/{nylas-provider.entry-d4bf23c2.cjs → nylas-provider.entry-51c5cdbf.cjs} +1 -1
- package/dist/{nylas-provider.entry-6d286e92.js → nylas-provider.entry-69ee5061.js} +37 -37
- package/dist/{nylas-scheduler-editor.entry-00a71304.cjs → nylas-scheduler-editor.entry-923b8566.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-caa1026b.js → nylas-scheduler-editor.entry-d4a9afb1.js} +5 -5
- package/dist/{nylas-scheduling.entry-f1fb67d2.cjs → nylas-scheduling.entry-54f1a5e9.cjs} +1 -1
- package/dist/{nylas-scheduling.entry-19ff3d50.js → nylas-scheduling.entry-f82a2822.js} +3 -3
- package/dist/{nylas-threads-refresh.entry-6acf3c2b.js → nylas-threads-refresh.entry-72482d2f.js} +10 -10
- package/dist/{nylas-threads-refresh.entry-bc4c10ea.cjs → nylas-threads-refresh.entry-99001756.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-ee28712c.cjs → nylas-threads-search.entry-462527fd.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-82fa1504.js → nylas-threads-search.entry-c5fe50e5.js} +16 -16
- package/dist/{nylas-time-window-picker.entry-3c45d82e.js → nylas-time-window-picker.entry-0d93e7cc.js} +2 -2
- package/dist/{nylas-time-window-picker.entry-131f84b4.cjs → nylas-time-window-picker.entry-ccffcf2b.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-695a7b0b.js → nylas-view-thread.entry-2d34b41c.js} +3 -3
- package/dist/{nylas-view-thread.entry-0d9a4aa9.cjs → nylas-view-thread.entry-58432a52.cjs} +1 -1
- package/dist/play-icon_2.entry-1ea3fd6b.cjs +1 -0
- package/dist/{play-icon_2.entry-ab47588e.js → play-icon_2.entry-d08adf17.js} +7 -7
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{refresh-icon.entry-28e3ade7.cjs → refresh-icon.entry-1e670732.cjs} +1 -1
- package/dist/{refresh-icon.entry-43267155.js → refresh-icon.entry-a041136d.js} +4 -4
- package/dist/{register-component-a5a9ca5d-538c35c3.js → register-component-a5a9ca5d-a5c01c35.js} +1 -1
- package/dist/{register-component-a5a9ca5d-8b06415c.cjs → register-component-a5a9ca5d-b68b6039.cjs} +1 -1
- package/dist/{scheduler-config-store-4a50a03d-40e87f35.cjs → scheduler-config-store-4a50a03d-884e6df8.cjs} +1 -1
- package/dist/{scheduler-config-store-4a50a03d-4a2e2abf.js → scheduler-config-store-4a50a03d-ee42ff96.js} +1 -1
- package/dist/{scheduler-store-f02ce045-121c1e09.js → scheduler-store-f02ce045-23a14e3f.js} +1 -1
- package/dist/{scheduler-store-f02ce045-f11cfad9.cjs → scheduler-store-f02ce045-42e3647c.cjs} +1 -1
- package/dist/{textarea-component.entry-1ec19adb.js → textarea-component.entry-1b4c771b.js} +4 -4
- package/dist/{textarea-component.entry-402a369b.cjs → textarea-component.entry-24a830c1.cjs} +1 -1
- package/dist/{translate-icon.entry-59f4e190.cjs → translate-icon.entry-0c0add25.cjs} +1 -1
- package/dist/{translate-icon.entry-d412697e.js → translate-icon.entry-44bde57b.js} +6 -6
- package/dist/{warning-icon.entry-3ee1f451.js → warning-icon.entry-8956cba2.js} +4 -4
- package/dist/{warning-icon.entry-aa6b2c2c.cjs → warning-icon.entry-9a77ab01.cjs} +1 -1
- package/package.json +2 -2
- package/dist/add-circle-icon_2.entry-936fd73b.cjs +0 -1
- package/dist/add-circle-icon_2.entry-ce6aaa1d.js +0 -25
- package/dist/chevron-icon_3.entry-4807a0b1.cjs +0 -1
- package/dist/document-refresh-icon.entry-b4c217df.js +0 -15
- package/dist/document-refresh-icon.entry-b8850675.cjs +0 -1
- package/dist/google-logo-icon_4.entry-c5db1be3.cjs +0 -1
- package/dist/index-53420959-16700a42.cjs +0 -1
- package/dist/index-53420959-f0c4f9af.js +0 -5
- package/dist/loading-icon.entry-175aca19.cjs +0 -1
- package/dist/loading-icon.entry-4ab88ed8.js +0 -15
- package/dist/nylas-booked-event-card_10.entry-6de99d57.cjs +0 -1
- package/dist/play-icon_2.entry-b1167d3a.cjs +0 -1
package/dist/{nylas-threads-refresh.entry-6acf3c2b.js → nylas-threads-refresh.entry-72482d2f.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-a5a9ca5d-
|
|
1
|
+
import { r as f, c as p, d as i, h as o, H as u } from "./index-812162da.js";
|
|
2
|
+
import { R as m } from "./register-component-a5a9ca5d-a5c01c35.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;
|
|
@@ -8,10 +8,10 @@ var v = function(t, e, s, r) {
|
|
|
8
8
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
9
9
|
n = Reflect.decorate(t, e, s, r);
|
|
10
10
|
else
|
|
11
|
-
for (var
|
|
12
|
-
(h = t[
|
|
11
|
+
for (var c = t.length - 1; c >= 0; c--)
|
|
12
|
+
(h = t[c]) && (n = (a < 3 ? h(n) : a > 3 ? h(e, s, n) : h(e, s)) || n);
|
|
13
13
|
return a > 3 && n && Object.defineProperty(e, s, n), n;
|
|
14
|
-
},
|
|
14
|
+
}, l = function(t, e) {
|
|
15
15
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
16
16
|
return Reflect.metadata(t, e);
|
|
17
17
|
};
|
|
@@ -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: "fd0b82f21c069806d697d1997925fd01c2574594" }, o("div", { key: "653737af280d1a4a75433b47edc5455b1eaf61cd", class: "container", ref: (t) => this.containerElement = t }, o("button", { key: "835dbcdf5cfd24069258564b9e23cd3a7c03b8c6", 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: "b3e3db22c04e261b39c2ed53dd4bd4d33932ffe7", class: "content", ref: (t) => this.contentElement = t }, o("slot", { key: "01f37b6814fae9494dcd4c76c736034c6cc4f392" }))));
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
v([
|
|
@@ -64,9 +64,9 @@ v([
|
|
|
64
64
|
},
|
|
65
65
|
fireRegisterEvent: !0
|
|
66
66
|
}),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
l("design:type", Function),
|
|
68
|
+
l("design:paramtypes", []),
|
|
69
|
+
l("design:returntype", void 0)
|
|
70
70
|
], d.prototype, "render", null);
|
|
71
71
|
d.style = y;
|
|
72
72
|
export {
|
package/dist/{nylas-threads-refresh.entry-bc4c10ea.cjs → nylas-threads-refresh.entry-99001756.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-e3e9b594.cjs"),d=require("./register-component-a5a9ca5d-b68b6039.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},c=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const l=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:"fd0b82f21c069806d697d1997925fd01c2574594"},s.h("div",{key:"653737af280d1a4a75433b47edc5455b1eaf61cd",class:"container",ref:t=>this.containerElement=t},s.h("button",{key:"835dbcdf5cfd24069258564b9e23cd3a7c03b8c6",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:"b3e3db22c04e261b39c2ed53dd4bd4d33932ffe7",class:"content",ref:t=>this.contentElement=t},s.h("slot",{key:"01f37b6814fae9494dcd4c76c736034c6cc4f392"}))))}};p([d.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{s.debug("[nylas-threads-refresh] Refreshing threads");const{updateState:n}=t.detail;await n("loading"),await e.threads.getThreads(void 0,"overwrite",!1),await n("ready")}},fireRegisterEvent:!0}),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],l.prototype,"render",null);l.style=u;exports.nylas_threads_refresh=l;
|
package/dist/{nylas-threads-search.entry-ee28712c.cjs → nylas-threads-search.entry-462527fd.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-e3e9b594.cjs"),h=require("./register-component-a5a9ca5d-b68b6039.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},d=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const l=class{constructor(t){a.registerInstance(this,t),this.search=a.createEvent(this,"search",7),this.onSearch=async e=>{e.preventDefault(),e.stopPropagation();const n=e.target.value;n!==this.internalQuery&&(this.internalQuery=n,this.search.emit(this.internalQuery))},this.query="",this.internalQuery=""}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){a.debug("[nylas-threads-search] Component will load")}async componentDidLoad(){a.debug("[nylas-threads-search] Component did load")}onQueryChange(){this.internalQuery=this.query}render(){return a.h(a.Host,{key:"b8f5ab7d60d06cb54da56d0362f8590d71646dca"},a.h("sp-theme",{key:"3d90db95bcbfee7eed4187caa97c76fb7727f58b",scale:"medium",color:"dark"},a.h("sp-search",{key:"d47bd5ee54845a0889f742b8ab76bb56b74fb147",quiet:!0,onSubmit:this.onSearch,onBlur:this.onSearch,value:this.internalQuery})))}static get watchers(){return{query:["onQueryChange"]}}};f([h.RegisterComponent({name:"nylas-pagination",stateToProps:new Map([["mailbox.searchQuery","query"]]),eventToProps:{search:async(t,e)=>{await e.threads.getThreads({search_query_native:t.detail||void 0,page_token:void 0})}},fireRegisterEvent:!0}),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],l.prototype,"render",null);l.style=y;exports.nylas_threads_search=l;
|
package/dist/{nylas-threads-search.entry-82fa1504.js → nylas-threads-search.entry-c5fe50e5.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as u, c as
|
|
2
|
-
import { R as
|
|
1
|
+
import { r as u, c as y, d as l, h as i, H as p } from "./index-812162da.js";
|
|
2
|
+
import { R as f } from "./register-component-a5a9ca5d-a5c01c35.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
const
|
|
5
|
+
const b = ":host{display:block}sp-search{width:100%;border:0}", m = b;
|
|
6
6
|
var g = 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")
|
|
@@ -11,13 +11,13 @@ var g = function(t, e, n, r) {
|
|
|
11
11
|
for (var c = t.length - 1; c >= 0; c--)
|
|
12
12
|
(o = t[c]) && (a = (s < 3 ? o(a) : s > 3 ? o(e, n, a) : o(e, n)) || a);
|
|
13
13
|
return s > 3 && a && Object.defineProperty(e, n, a), a;
|
|
14
|
-
},
|
|
14
|
+
}, d = function(t, e) {
|
|
15
15
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
16
16
|
return Reflect.metadata(t, e);
|
|
17
17
|
};
|
|
18
|
-
const
|
|
18
|
+
const h = class {
|
|
19
19
|
constructor(t) {
|
|
20
|
-
u(this, t), this.search =
|
|
20
|
+
u(this, t), this.search = y(this, "search", 7), this.onSearch = async (e) => {
|
|
21
21
|
e.preventDefault(), e.stopPropagation();
|
|
22
22
|
const r = e.target.value;
|
|
23
23
|
r !== this.internalQuery && (this.internalQuery = r, this.search.emit(this.internalQuery));
|
|
@@ -28,16 +28,16 @@ const d = class {
|
|
|
28
28
|
disconnectedCallback() {
|
|
29
29
|
}
|
|
30
30
|
async componentWillLoad() {
|
|
31
|
-
|
|
31
|
+
l("[nylas-threads-search] Component will load");
|
|
32
32
|
}
|
|
33
33
|
async componentDidLoad() {
|
|
34
|
-
|
|
34
|
+
l("[nylas-threads-search] Component did load");
|
|
35
35
|
}
|
|
36
36
|
onQueryChange() {
|
|
37
37
|
this.internalQuery = this.query;
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
|
-
return i(
|
|
40
|
+
return i(p, { key: "b8f5ab7d60d06cb54da56d0362f8590d71646dca" }, i("sp-theme", { key: "3d90db95bcbfee7eed4187caa97c76fb7727f58b", scale: "medium", color: "dark" }, i("sp-search", { key: "d47bd5ee54845a0889f742b8ab76bb56b74fb147", quiet: !0, onSubmit: this.onSearch, onBlur: this.onSearch, value: this.internalQuery })));
|
|
41
41
|
}
|
|
42
42
|
static get watchers() {
|
|
43
43
|
return {
|
|
@@ -46,7 +46,7 @@ const d = class {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
g([
|
|
49
|
-
|
|
49
|
+
f({
|
|
50
50
|
name: "nylas-pagination",
|
|
51
51
|
stateToProps: /* @__PURE__ */ new Map([["mailbox.searchQuery", "query"]]),
|
|
52
52
|
eventToProps: {
|
|
@@ -59,11 +59,11 @@ g([
|
|
|
59
59
|
},
|
|
60
60
|
fireRegisterEvent: !0
|
|
61
61
|
}),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
],
|
|
66
|
-
|
|
62
|
+
d("design:type", Function),
|
|
63
|
+
d("design:paramtypes", []),
|
|
64
|
+
d("design:returntype", void 0)
|
|
65
|
+
], h.prototype, "render", null);
|
|
66
|
+
h.style = m;
|
|
67
67
|
export {
|
|
68
|
-
|
|
68
|
+
h as nylas_threads_search
|
|
69
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as ae, R as C, r as oe, c as X, S as B, T as U, U as G, V as q, h as k, H as he, g as me } from "./index-
|
|
1
|
+
import { i as ae, R as C, r as oe, c as X, S as B, T as U, U as G, V as q, h as k, H as he, g as me } from "./index-812162da.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
var J = { exports: {} };
|
|
@@ -290,7 +290,7 @@ const ue = class {
|
|
|
290
290
|
i && (i.focus(), i.scrollIntoView({ behavior: "smooth", block: "nearest" }));
|
|
291
291
|
}
|
|
292
292
|
render() {
|
|
293
|
-
return k(he, { key: "
|
|
293
|
+
return k(he, { key: "e6e899509659691432e600fb64b1f4964d737e8f" }, k("div", { key: "6f177a2b2963e2462b842c26553f0059518dd713", class: "time-picker", part: "time-picker" }, k("input", { key: "4d290b135afdb54edcadb2279b5c18f9b1ed6ee1", 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-769f0fdd.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:"51ee1081a47b86693eb0fcd034a53333728f0a8a"},r.h("div",{key:"29616cbfd3978f2fb38d2583214e2cb67e86ecd2",class:"time-picker",part:"time-picker"},r.h("input",{key:"0eedc68542c5dd6c2d051f89b806016e31ae21d4",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-e3e9b594.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:"e6e899509659691432e600fb64b1f4964d737e8f"},r.h("div",{key:"6f177a2b2963e2462b842c26553f0059518dd713",class:"time-picker",part:"time-picker"},r.h("input",{key:"4d290b135afdb54edcadb2279b5c18f9b1ed6ee1",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,5 +1,5 @@
|
|
|
1
|
-
import { r as k, c as p, d, h as a, t as M, F as m, H as x, g as E, o as D, a as S, p as g } from "./index-
|
|
2
|
-
import { R as T } from "./register-component-a5a9ca5d-
|
|
1
|
+
import { r as k, c as p, d, h as a, t as M, F as m, H as x, g as E, o as D, a as S, p as g } from "./index-812162da.js";
|
|
2
|
+
import { R as T } from "./register-component-a5a9ca5d-a5c01c35.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
function R(t, e, s, o, r) {
|
|
@@ -162,7 +162,7 @@ const C = class {
|
|
|
162
162
|
render() {
|
|
163
163
|
var r, n, l;
|
|
164
164
|
const t = this.internalMessages.length > 2 ? this.internalMessages[0] : null, e = this.internalMessages.slice(this.internalMessages.length - 2, this.internalMessages.length), s = this.internalMessages.slice(1, this.internalMessages.length - 2), o = this.internalMessages[this.internalMessages.length - 1];
|
|
165
|
-
return a(x, { key: "
|
|
165
|
+
return a(x, { key: "b9bcde80e7ee15061bfc217d99bb9422dfbe1d04" }, a("sp-theme", { key: "965e53796323e3e13983447abb4ac1b3a8651daa", scale: "medium", color: "dark" }, a("div", { key: "9efc644121efd09a2e837c23f9f8da80589f870b", class: "view-thread" }, a("div", { key: "c1479929b6679a1b47f03dfe6d5cc1128484b703", class: "header" }, a("div", { key: "00c6788a461f9f6ca4532fb2acb2bf08e0f0c118", class: "subject" }, (r = this.thread) == null ? void 0 : r.subject), a("div", { key: "2e114754a9dd830e4a124cd9079ad4cf725908bd", class: "folders" }, (l = (n = this.thread) == null ? void 0 : n.folders) == null ? void 0 : l.map((i) => a("sp-tag", { size: "s" }, M(i.replace("CATEGORY_", "").replace("_", " ")))))), a("div", { key: "136d6a314c647991218dfe4090fa97c8d98b210d", class: "messages" }, t && a(u, { message: t, attachments: this.attachments.filter((i) => i.messageId === t.id), onMessageClick: this.onMessageClick, onShowContactDataClick: this.onShowContactDataClick, parent: this.host, viewEmailElement: this.nylasViewEmailElement, composerElement: this.nylasComposerElement }), s.length > 0 && this.messages.length > 1 && !this.showAllEmails && e.length > 0 && a(m, null, a("div", { class: "show-more" }, a("button", { type: "button", onClick: this.onShowAllEmailsClick }, a("span", { class: "avatar" }, s.length), " ", a("span", { class: "sr-only" }, "Show ", s.length, " more emails"))), a("hr", null)), s.length > 0 && this.showAllEmails && this.messages.length > 2 && s.map((i) => a(u, { message: i, attachments: this.attachments.filter((c) => c.messageId === (t == null ? void 0 : t.id)), onMessageClick: this.onMessageClick, onShowContactDataClick: this.onShowContactDataClick, parent: this.host, viewEmailElement: this.nylasViewEmailElement, composerElement: this.nylasComposerElement })), e.length > 0 && e.map((i) => a(u, { message: i, attachments: this.attachments.filter((c) => c.messageId === (t == null ? void 0 : t.id)), onMessageClick: this.onMessageClick, onShowContactDataClick: this.onShowContactDataClick, parent: this.host, viewEmailElement: this.nylasViewEmailElement, composerElement: this.nylasComposerElement }))), !(this.showComposer && o) && a("div", { class: "reply-buttons" }, a("sp-button", { variant: "cta", type: "button", onClick: this.showComposerClick }, a("span", { slot: "icon" }, a("reply-icon", null)), a("span", null, "Reply")), a("sp-button", { variant: "cta", type: "button" }, a("span", { slot: "icon" }, a("reply-all-icon", null)), a("span", null, "Reply All")), a("sp-button", { variant: "cta", type: "button" }, a("span", { slot: "icon" }, a("forward-icon", null)), a("span", null, "Forward"))), this.showComposer && o && a("div", { class: "composer" }, a("nylas-composer", { message: o.data, onClose: this.showComposerClick, onSend: (i) => {
|
|
166
166
|
d("[nylas-view-thread] Send event", { message: i.detail.message, replyBody: i.detail.replyBody });
|
|
167
167
|
} })))));
|
|
168
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-769f0fdd.cjs"),b=require("./register-component-a5a9ca5d-8b06415c.cjs");require("react");require("react-dom");function w(t,a,s,o,r){if(!o||!s||s.children.length>0)return;e.debug("[nylas-view-thread] Rendering email",{message:t,attachments:a,viewEmailElement:o});const n=o.cloneNode(!0);n.message=t.data,n.parent=r,s.appendChild(n)}const c=({viewEmailElement:t,message:a,attachments:s,onMessageClick:o,onShowContactDataClick:r,parent:n})=>{var l,i,d,g,u,v,y;return e.h(e.Fragment,null,e.h("div",{key:a.id,class:"message"},e.h("div",{class:"sub-header","data-id":a.data.id,onClick:o},e.h("div",{class:"avatar"},a.data.from&&((l=a.data.from[0])==null?void 0:l.name)&&((d=(i=a.data.from[0])==null?void 0:i.name[0])==null?void 0:d.toUpperCase())),e.h("div",{class:"from"},e.h("span",{class:"name"},a.data.from&&((g=a.data.from[0])==null?void 0:g.name))," ",e.h("span",{class:"email"},a.data.from&&((u=a.data.from[0])==null?void 0:u.email))),e.h("div",{class:"date"},new Date(a.data.date*1e3).toLocaleTimeString(void 0,{timeStyle:"short"})," ","(",e.formatTimeAgo(new Date(a.data.date*1e3)),")"),e.h("sp-button-group",{class:"buttons"},e.h("nylas-summarize-message-button",{message:a.data})),a.collapse&&e.h("div",{class:"snippet"},a.data.snippet),!a.collapse&&a.data.to&&e.h("div",{class:"to"},e.h("span",null,"to")," ",e.formatParticipants(a.data.to)," ",e.h("button",{type:"button",value:a.data.id,onClick:r,class:{expand:!0,"expand--showContactData":a.showContactData}},e.h("chevron-icon",null)))),a.showContactData&&e.h("div",{class:"address-info"},e.h("div",{class:"label"},"From"),e.h("div",{class:"value"},e.formatRecipient((v=a.data)!=null&&v.from?(y=a==null?void 0:a.data)==null?void 0:y.from[0]:{name:"",email:""})),a.data.to&&e.h(e.Fragment,null,e.h("div",{class:"label"},"To"),e.h("div",{class:"value"},a.data.to.map(h=>e.h("div",null,e.formatRecipient(h))))),typeof a.data.cc<"u"&&a.data.cc.length>0&&e.h(e.Fragment,null,e.h("div",{class:"label"},"CC"),e.h("div",{class:"value"},a.data.cc.map(h=>e.h("div",null,e.formatRecipient(h)))))),!a.collapse&&t&&e.h("div",{key:a.id,ref:h=>w(a,s,h,t,n)}),!a.collapse&&!t&&e.h("nylas-view-email",{key:a.id,message:a.data,parent:n})),e.h("hr",null))},f=':host{display:block;font-size:inherit}.avatar{z-index:1;border-radius:100%;background-color:var(--nylas-color-primary-200);height:40px;width:40px;align-items:center;display:flex;justify-content:center;border:1px solid var(--nylas-color-primary-200)}.view-thread{display:grid;grid-auto-flow:row;width:100%}.view-thread .header{display:grid;grid-gap:1rem;align-items:center;margin-bottom:1rem}.view-thread .header .subject{font-size:1.25rem;font-weight:600;line-height:1.5rem}.view-thread .header .folders{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;overflow-x:auto;gap:1rem}.view-thread .header .folders .folder{padding:0 0.5rem;font-size:0.9rem;color:var(--nylas-color-primary-900);background-color:var(--nylas-color-primary-300)}.view-thread .messages{display:grid;gap:1rem}.view-thread .messages hr{margin:0;width:100%;border:1px solid var(--nylas-color-primary-200)}.view-thread .messages hr:last-of-type{display:none}.view-thread .messages .message{display:grid;grid-auto-flow:row;gap:1rem}.view-thread .messages .message:last-of-type .sub-header{cursor:default}.view-thread .messages .message .sub-header{display:grid;grid-template:"avatar from date buttons" "avatar to to buttons";grid-column-gap:1rem;grid-template-columns:auto 1fr auto auto;cursor:pointer}.view-thread .messages .message .sub-header>*{pointer-events:none}.view-thread .messages .message .sub-header .avatar{grid-area:avatar}.view-thread .messages .message .sub-header .from{grid-area:from}.view-thread .messages .message .sub-header .from span.email{display:none;color:var(--nylas-color-primary-400);font-weight:600}.view-thread .messages .message .sub-header .buttons{grid-area:buttons;align-self:center}.view-thread .messages .message .sub-header .buttons *{pointer-events:all}.view-thread .messages .message .sub-header .date{grid-area:date;align-self:center;color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .snippet{width:90%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--nylas-color-primary-600)}.view-thread .messages .message .sub-header .to{grid-area:to;color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .to>span{color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .to button{border:0;background-color:transparent;cursor:pointer;pointer-events:all;padding:0;margin:0}.view-thread .messages .message .sub-header .to button>*{pointer-events:none}.view-thread .messages .message .sub-header .to button chevron-icon{display:inline-table;fill:var(--nylas-color-primary-400);width:15px;height:15px;vertical-align:middle}.view-thread .messages .message .sub-header .to button chevron-icon svg{width:15px;height:15px;transform:rotate(90deg)}.view-thread .messages .message .sub-header .to button.expand--showContactData chevron-icon svg{transform:rotate(270deg)}.view-thread .messages .message .address-info{display:grid;column-gap:1rem;row-gap:0.5rem;grid-template-columns:auto 1fr;grid-template-rows:1fr;padding:1rem 2rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-color-primary-200);align-items:flex-start;color:var(--nylas-color-primary-600)}.view-thread .messages .message .address-info .label{color:var(--nylas-color-primary-400);font-weight:600}.show-more{position:relative;display:flex;width:100%}.show-more .sr-only{display:none}.show-more button{position:relative;display:inline-flex;width:100%;padding:0;border:0;background-color:transparent;cursor:pointer;text-align:left;overflow:hidden}.show-more button span{border:1px solid var(--nylas-color-primary-400)}.show-more button:hover span{background-color:var(--nylas-color-primary-700)}.show-more button::after{border-top:1px solid rgba(100, 121, 143, 0.122);border-bottom:1px solid rgba(100, 121, 143, 0.122);content:"";height:4px;width:100%;position:absolute;top:50%}.loading{position:absolute;width:100%;height:100%;background-color:var(--loading__background-color);top:0;bottom:0;left:0;z-index:1;display:grid;justify-content:center;align-items:center;font-weight:600;overflow:hidden}.reply-buttons{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;gap:1rem;margin-top:1rem}.reply-buttons sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}.reply-buttons sp-button:hover{background-color:var(--nylas-color-primary-500)}.reply-buttons sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}.reply-buttons sp-button chevron-icon{display:inline-block}@media only screen and (min-width: 768px){.view-thread .messages .message .sub-header .from span.email{display:inline}}',C=f;var k=function(t,a,s,o){var r=arguments.length,n=r<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,s):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,a,s,o);else for(var i=t.length-1;i>=0;i--)(l=t[i])&&(n=(r<3?l(n):r>3?l(a,s,n):l(a,s))||n);return r>3&&n&&Object.defineProperty(a,s,n),n},m=function(t,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,a)};const p=class{constructor(t){e.registerInstance(this,t),this.threadSelected=e.createEvent(this,"threadSelected",7),this.showContactDataClicked=e.createEvent(this,"showContactDataClicked",7),this.messageClicked=e.createEvent(this,"messageClicked",7),this.nylasViewEmailElement=null,this.nylasComposerElement=null,this.onShowContactDataClick=a=>{a.stopPropagation();const o=a.target.value,r=this.internalMessages.find(l=>l.data.id===o);if(!r){e.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.showContactDataClicked.emit(r.data).defaultPrevented||(r.showContactData=!r.showContactData,this.internalMessages=[...this.internalMessages]),e.debug(`[nylas-view-thread] show contact data clicked ${o} ${r.showContactData?"collapsed":"expanded"}`)},this.onMessageClick=a=>{var l;const o=a.target.dataset.id,r=this.internalMessages.find(i=>i.data.id===o);if(!r){e.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.messageClicked.emit(r.data).defaultPrevented||(r.id!==((l=this.internalMessages[this.internalMessages.length-1])==null?void 0:l.id)&&(r.collapse=!r.collapse,r.collapse&&(r.showContactData=!1)),this.internalMessages=[...this.internalMessages]),e.debug(`[nylas-view-thread] message clicked ${o} ${r.collapse?"collapsed":"expanded"}`)},this.onShowAllEmailsClick=()=>{this.showAllEmails=!this.showAllEmails},this.showComposerClick=()=>{this.showComposer=!this.showComposer},this.draft=void 0,this.thread=void 0,this.messages=[],this.attachments=[],this.state="loading",this.internalMessages=[],this.showAllEmails=!1,this.showComposer=!1}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){e.debug("[nylas-view-thread] Component will load"),this.updateInternalMessages(this.messages);const t=this.host.querySelector("template.nylas-view-email");if(!t){e.debug("[nylas-view-thread] Could not find template");return}const a=document.importNode(t.content,!0);this.nylasViewEmailElement=a.querySelector("nylas-view-email");const s=this.host.querySelector("template.nylas-composer");if(!s){e.debug("[nylas-view-thread] Could not find composer template");return}const o=document.importNode(s.content,!0);this.nylasComposerElement=o.querySelector("nylas-composer")}async componentDidLoad(){e.debug("[nylas-view-thread] Component did load")}async threadChanged(t){e.debug("[nylas-view-thread] Thread changed",{thread:t}),this.internalMessages=[],this.threadSelected.emit(t).defaultPrevented||e.debug("[nylas-view-thread] Default event not prevented, initializing")}updateInternalMessages(t){e.debug("[nylas-view-thread] Updating internal messages",{messages:t});const a=t.sort((s,o)=>s.date>o.date?1:-1).map((s,o)=>({id:s.id,data:s,collapse:o!==t.length-1,showContactData:!1}));this.internalMessages=a}render(){var r,n,l;const t=this.internalMessages.length>2?this.internalMessages[0]:null,a=this.internalMessages.slice(this.internalMessages.length-2,this.internalMessages.length),s=this.internalMessages.slice(1,this.internalMessages.length-2),o=this.internalMessages[this.internalMessages.length-1];return e.h(e.Host,{key:"a886c18c380e985cfb63a6a4ab523a93b2160ced"},e.h("sp-theme",{key:"dba4495bbb475f8825f5ade124f84f8bbe2c7c45",scale:"medium",color:"dark"},e.h("div",{key:"05c602d7c43e31402c433cdaaaccb26c8d88fc7e",class:"view-thread"},e.h("div",{key:"0b2900754126998aa4495a916b03ad2ea4157f34",class:"header"},e.h("div",{key:"38db0766a5bc2dfc37b5269cf1e63ad25531ee8d",class:"subject"},(r=this.thread)==null?void 0:r.subject),e.h("div",{key:"bb73a5220497288f51b7c9d31e54cb685cfe54d5",class:"folders"},(l=(n=this.thread)==null?void 0:n.folders)==null?void 0:l.map(i=>e.h("sp-tag",{size:"s"},e.toTitleCase(i.replace("CATEGORY_","").replace("_"," ")))))),e.h("div",{key:"7d774b36fbfc216c05ed8cabbab79ad6b80e0e87",class:"messages"},t&&e.h(c,{message:t,attachments:this.attachments.filter(i=>i.messageId===t.id),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement}),s.length>0&&this.messages.length>1&&!this.showAllEmails&&a.length>0&&e.h(e.Fragment,null,e.h("div",{class:"show-more"},e.h("button",{type:"button",onClick:this.onShowAllEmailsClick},e.h("span",{class:"avatar"},s.length)," ",e.h("span",{class:"sr-only"},"Show ",s.length," more emails"))),e.h("hr",null)),s.length>0&&this.showAllEmails&&this.messages.length>2&&s.map(i=>e.h(c,{message:i,attachments:this.attachments.filter(d=>d.messageId===(t==null?void 0:t.id)),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement})),a.length>0&&a.map(i=>e.h(c,{message:i,attachments:this.attachments.filter(d=>d.messageId===(t==null?void 0:t.id)),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement}))),!(this.showComposer&&o)&&e.h("div",{class:"reply-buttons"},e.h("sp-button",{variant:"cta",type:"button",onClick:this.showComposerClick},e.h("span",{slot:"icon"},e.h("reply-icon",null)),e.h("span",null,"Reply")),e.h("sp-button",{variant:"cta",type:"button"},e.h("span",{slot:"icon"},e.h("reply-all-icon",null)),e.h("span",null,"Reply All")),e.h("sp-button",{variant:"cta",type:"button"},e.h("span",{slot:"icon"},e.h("forward-icon",null)),e.h("span",null,"Forward"))),this.showComposer&&o&&e.h("div",{class:"composer"},e.h("nylas-composer",{message:o.data,onClose:this.showComposerClick,onSend:i=>{e.debug("[nylas-view-thread] Send event",{message:i.detail.message,replyBody:i.detail.replyBody})}})))))}get host(){return e.getElement(this)}static get watchers(){return{thread:["threadChanged"],messages:["updateInternalMessages"]}}};k([b.RegisterComponent({name:"nylas-view-thread",stateToProps:new Map([["mailbox.selectedThread","thread"],["mailbox.messages","messages"],["mailbox.state","state"]]),eventToProps:{threadSelected:async(t,a)=>{e.debug("[nylas-view-thread] Nylas init event. Fetching thread messages.",{event:t});const s=t.detail;s&&s.id&&await a.messages.getThreadMessages(s.id)}},fireRegisterEvent:!0}),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],p.prototype,"render",null);p.style=C;exports.nylas_view_thread=p;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-e3e9b594.cjs"),w=require("./register-component-a5a9ca5d-b68b6039.cjs");require("react");require("react-dom");function b(t,a,s,o,r){if(!o||!s||s.children.length>0)return;e.debug("[nylas-view-thread] Rendering email",{message:t,attachments:a,viewEmailElement:o});const n=o.cloneNode(!0);n.message=t.data,n.parent=r,s.appendChild(n)}const c=({viewEmailElement:t,message:a,attachments:s,onMessageClick:o,onShowContactDataClick:r,parent:n})=>{var l,i,d,g,u,v,y;return e.h(e.Fragment,null,e.h("div",{key:a.id,class:"message"},e.h("div",{class:"sub-header","data-id":a.data.id,onClick:o},e.h("div",{class:"avatar"},a.data.from&&((l=a.data.from[0])==null?void 0:l.name)&&((d=(i=a.data.from[0])==null?void 0:i.name[0])==null?void 0:d.toUpperCase())),e.h("div",{class:"from"},e.h("span",{class:"name"},a.data.from&&((g=a.data.from[0])==null?void 0:g.name))," ",e.h("span",{class:"email"},a.data.from&&((u=a.data.from[0])==null?void 0:u.email))),e.h("div",{class:"date"},new Date(a.data.date*1e3).toLocaleTimeString(void 0,{timeStyle:"short"})," ","(",e.formatTimeAgo(new Date(a.data.date*1e3)),")"),e.h("sp-button-group",{class:"buttons"},e.h("nylas-summarize-message-button",{message:a.data})),a.collapse&&e.h("div",{class:"snippet"},a.data.snippet),!a.collapse&&a.data.to&&e.h("div",{class:"to"},e.h("span",null,"to")," ",e.formatParticipants(a.data.to)," ",e.h("button",{type:"button",value:a.data.id,onClick:r,class:{expand:!0,"expand--showContactData":a.showContactData}},e.h("chevron-icon",null)))),a.showContactData&&e.h("div",{class:"address-info"},e.h("div",{class:"label"},"From"),e.h("div",{class:"value"},e.formatRecipient((v=a.data)!=null&&v.from?(y=a==null?void 0:a.data)==null?void 0:y.from[0]:{name:"",email:""})),a.data.to&&e.h(e.Fragment,null,e.h("div",{class:"label"},"To"),e.h("div",{class:"value"},a.data.to.map(h=>e.h("div",null,e.formatRecipient(h))))),typeof a.data.cc<"u"&&a.data.cc.length>0&&e.h(e.Fragment,null,e.h("div",{class:"label"},"CC"),e.h("div",{class:"value"},a.data.cc.map(h=>e.h("div",null,e.formatRecipient(h)))))),!a.collapse&&t&&e.h("div",{key:a.id,ref:h=>b(a,s,h,t,n)}),!a.collapse&&!t&&e.h("nylas-view-email",{key:a.id,message:a.data,parent:n})),e.h("hr",null))},f=':host{display:block;font-size:inherit}.avatar{z-index:1;border-radius:100%;background-color:var(--nylas-color-primary-200);height:40px;width:40px;align-items:center;display:flex;justify-content:center;border:1px solid var(--nylas-color-primary-200)}.view-thread{display:grid;grid-auto-flow:row;width:100%}.view-thread .header{display:grid;grid-gap:1rem;align-items:center;margin-bottom:1rem}.view-thread .header .subject{font-size:1.25rem;font-weight:600;line-height:1.5rem}.view-thread .header .folders{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;overflow-x:auto;gap:1rem}.view-thread .header .folders .folder{padding:0 0.5rem;font-size:0.9rem;color:var(--nylas-color-primary-900);background-color:var(--nylas-color-primary-300)}.view-thread .messages{display:grid;gap:1rem}.view-thread .messages hr{margin:0;width:100%;border:1px solid var(--nylas-color-primary-200)}.view-thread .messages hr:last-of-type{display:none}.view-thread .messages .message{display:grid;grid-auto-flow:row;gap:1rem}.view-thread .messages .message:last-of-type .sub-header{cursor:default}.view-thread .messages .message .sub-header{display:grid;grid-template:"avatar from date buttons" "avatar to to buttons";grid-column-gap:1rem;grid-template-columns:auto 1fr auto auto;cursor:pointer}.view-thread .messages .message .sub-header>*{pointer-events:none}.view-thread .messages .message .sub-header .avatar{grid-area:avatar}.view-thread .messages .message .sub-header .from{grid-area:from}.view-thread .messages .message .sub-header .from span.email{display:none;color:var(--nylas-color-primary-400);font-weight:600}.view-thread .messages .message .sub-header .buttons{grid-area:buttons;align-self:center}.view-thread .messages .message .sub-header .buttons *{pointer-events:all}.view-thread .messages .message .sub-header .date{grid-area:date;align-self:center;color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .snippet{width:90%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--nylas-color-primary-600)}.view-thread .messages .message .sub-header .to{grid-area:to;color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .to>span{color:var(--nylas-color-primary-400)}.view-thread .messages .message .sub-header .to button{border:0;background-color:transparent;cursor:pointer;pointer-events:all;padding:0;margin:0}.view-thread .messages .message .sub-header .to button>*{pointer-events:none}.view-thread .messages .message .sub-header .to button chevron-icon{display:inline-table;fill:var(--nylas-color-primary-400);width:15px;height:15px;vertical-align:middle}.view-thread .messages .message .sub-header .to button chevron-icon svg{width:15px;height:15px;transform:rotate(90deg)}.view-thread .messages .message .sub-header .to button.expand--showContactData chevron-icon svg{transform:rotate(270deg)}.view-thread .messages .message .address-info{display:grid;column-gap:1rem;row-gap:0.5rem;grid-template-columns:auto 1fr;grid-template-rows:1fr;padding:1rem 2rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-color-primary-200);align-items:flex-start;color:var(--nylas-color-primary-600)}.view-thread .messages .message .address-info .label{color:var(--nylas-color-primary-400);font-weight:600}.show-more{position:relative;display:flex;width:100%}.show-more .sr-only{display:none}.show-more button{position:relative;display:inline-flex;width:100%;padding:0;border:0;background-color:transparent;cursor:pointer;text-align:left;overflow:hidden}.show-more button span{border:1px solid var(--nylas-color-primary-400)}.show-more button:hover span{background-color:var(--nylas-color-primary-700)}.show-more button::after{border-top:1px solid rgba(100, 121, 143, 0.122);border-bottom:1px solid rgba(100, 121, 143, 0.122);content:"";height:4px;width:100%;position:absolute;top:50%}.loading{position:absolute;width:100%;height:100%;background-color:var(--loading__background-color);top:0;bottom:0;left:0;z-index:1;display:grid;justify-content:center;align-items:center;font-weight:600;overflow:hidden}.reply-buttons{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;gap:1rem;margin-top:1rem}.reply-buttons sp-button{border-radius:var(--nylas-border-radius);background-color:var(--nylas-color-primary-400);color:var(--nylas-color-primary-900);fill:var(--nylas-color-primary-900)}.reply-buttons sp-button:hover{background-color:var(--nylas-color-primary-500)}.reply-buttons sp-button:disabled{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);cursor:not-allowed}.reply-buttons sp-button chevron-icon{display:inline-block}@media only screen and (min-width: 768px){.view-thread .messages .message .sub-header .from span.email{display:inline}}',C=f;var k=function(t,a,s,o){var r=arguments.length,n=r<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,s):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,a,s,o);else for(var i=t.length-1;i>=0;i--)(l=t[i])&&(n=(r<3?l(n):r>3?l(a,s,n):l(a,s))||n);return r>3&&n&&Object.defineProperty(a,s,n),n},m=function(t,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,a)};const p=class{constructor(t){e.registerInstance(this,t),this.threadSelected=e.createEvent(this,"threadSelected",7),this.showContactDataClicked=e.createEvent(this,"showContactDataClicked",7),this.messageClicked=e.createEvent(this,"messageClicked",7),this.nylasViewEmailElement=null,this.nylasComposerElement=null,this.onShowContactDataClick=a=>{a.stopPropagation();const o=a.target.value,r=this.internalMessages.find(l=>l.data.id===o);if(!r){e.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.showContactDataClicked.emit(r.data).defaultPrevented||(r.showContactData=!r.showContactData,this.internalMessages=[...this.internalMessages]),e.debug(`[nylas-view-thread] show contact data clicked ${o} ${r.showContactData?"collapsed":"expanded"}`)},this.onMessageClick=a=>{var l;const o=a.target.dataset.id,r=this.internalMessages.find(i=>i.data.id===o);if(!r){e.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.messageClicked.emit(r.data).defaultPrevented||(r.id!==((l=this.internalMessages[this.internalMessages.length-1])==null?void 0:l.id)&&(r.collapse=!r.collapse,r.collapse&&(r.showContactData=!1)),this.internalMessages=[...this.internalMessages]),e.debug(`[nylas-view-thread] message clicked ${o} ${r.collapse?"collapsed":"expanded"}`)},this.onShowAllEmailsClick=()=>{this.showAllEmails=!this.showAllEmails},this.showComposerClick=()=>{this.showComposer=!this.showComposer},this.draft=void 0,this.thread=void 0,this.messages=[],this.attachments=[],this.state="loading",this.internalMessages=[],this.showAllEmails=!1,this.showComposer=!1}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){e.debug("[nylas-view-thread] Component will load"),this.updateInternalMessages(this.messages);const t=this.host.querySelector("template.nylas-view-email");if(!t){e.debug("[nylas-view-thread] Could not find template");return}const a=document.importNode(t.content,!0);this.nylasViewEmailElement=a.querySelector("nylas-view-email");const s=this.host.querySelector("template.nylas-composer");if(!s){e.debug("[nylas-view-thread] Could not find composer template");return}const o=document.importNode(s.content,!0);this.nylasComposerElement=o.querySelector("nylas-composer")}async componentDidLoad(){e.debug("[nylas-view-thread] Component did load")}async threadChanged(t){e.debug("[nylas-view-thread] Thread changed",{thread:t}),this.internalMessages=[],this.threadSelected.emit(t).defaultPrevented||e.debug("[nylas-view-thread] Default event not prevented, initializing")}updateInternalMessages(t){e.debug("[nylas-view-thread] Updating internal messages",{messages:t});const a=t.sort((s,o)=>s.date>o.date?1:-1).map((s,o)=>({id:s.id,data:s,collapse:o!==t.length-1,showContactData:!1}));this.internalMessages=a}render(){var r,n,l;const t=this.internalMessages.length>2?this.internalMessages[0]:null,a=this.internalMessages.slice(this.internalMessages.length-2,this.internalMessages.length),s=this.internalMessages.slice(1,this.internalMessages.length-2),o=this.internalMessages[this.internalMessages.length-1];return e.h(e.Host,{key:"b9bcde80e7ee15061bfc217d99bb9422dfbe1d04"},e.h("sp-theme",{key:"965e53796323e3e13983447abb4ac1b3a8651daa",scale:"medium",color:"dark"},e.h("div",{key:"9efc644121efd09a2e837c23f9f8da80589f870b",class:"view-thread"},e.h("div",{key:"c1479929b6679a1b47f03dfe6d5cc1128484b703",class:"header"},e.h("div",{key:"00c6788a461f9f6ca4532fb2acb2bf08e0f0c118",class:"subject"},(r=this.thread)==null?void 0:r.subject),e.h("div",{key:"2e114754a9dd830e4a124cd9079ad4cf725908bd",class:"folders"},(l=(n=this.thread)==null?void 0:n.folders)==null?void 0:l.map(i=>e.h("sp-tag",{size:"s"},e.toTitleCase(i.replace("CATEGORY_","").replace("_"," ")))))),e.h("div",{key:"136d6a314c647991218dfe4090fa97c8d98b210d",class:"messages"},t&&e.h(c,{message:t,attachments:this.attachments.filter(i=>i.messageId===t.id),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement}),s.length>0&&this.messages.length>1&&!this.showAllEmails&&a.length>0&&e.h(e.Fragment,null,e.h("div",{class:"show-more"},e.h("button",{type:"button",onClick:this.onShowAllEmailsClick},e.h("span",{class:"avatar"},s.length)," ",e.h("span",{class:"sr-only"},"Show ",s.length," more emails"))),e.h("hr",null)),s.length>0&&this.showAllEmails&&this.messages.length>2&&s.map(i=>e.h(c,{message:i,attachments:this.attachments.filter(d=>d.messageId===(t==null?void 0:t.id)),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement})),a.length>0&&a.map(i=>e.h(c,{message:i,attachments:this.attachments.filter(d=>d.messageId===(t==null?void 0:t.id)),onMessageClick:this.onMessageClick,onShowContactDataClick:this.onShowContactDataClick,parent:this.host,viewEmailElement:this.nylasViewEmailElement,composerElement:this.nylasComposerElement}))),!(this.showComposer&&o)&&e.h("div",{class:"reply-buttons"},e.h("sp-button",{variant:"cta",type:"button",onClick:this.showComposerClick},e.h("span",{slot:"icon"},e.h("reply-icon",null)),e.h("span",null,"Reply")),e.h("sp-button",{variant:"cta",type:"button"},e.h("span",{slot:"icon"},e.h("reply-all-icon",null)),e.h("span",null,"Reply All")),e.h("sp-button",{variant:"cta",type:"button"},e.h("span",{slot:"icon"},e.h("forward-icon",null)),e.h("span",null,"Forward"))),this.showComposer&&o&&e.h("div",{class:"composer"},e.h("nylas-composer",{message:o.data,onClose:this.showComposerClick,onSend:i=>{e.debug("[nylas-view-thread] Send event",{message:i.detail.message,replyBody:i.detail.replyBody})}})))))}get host(){return e.getElement(this)}static get watchers(){return{thread:["threadChanged"],messages:["updateInternalMessages"]}}};k([w.RegisterComponent({name:"nylas-view-thread",stateToProps:new Map([["mailbox.selectedThread","thread"],["mailbox.messages","messages"],["mailbox.state","state"]]),eventToProps:{threadSelected:async(t,a)=>{e.debug("[nylas-view-thread] Nylas init event. Fetching thread messages.",{event:t});const s=t.detail;s&&s.id&&await a.messages.getThreadMessages(s.id)}},fireRegisterEvent:!0}),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",void 0)],p.prototype,"render",null);p.style=C;exports.nylas_view_thread=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-e3e9b594.cjs");require("react");require("react-dom");const o=".sc-play-icon-h{display:flex}",c=o,s=class{constructor(e){t.registerInstance(this,e),this.width="15",this.height="15"}render(){return t.h("svg",{key:"1b5bba2078843e9faf11f53d9bc851c66d1f7532",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"9729442ffb92522f0c035cf51ed4a0db56650e49",d:"M21 12L3 21V3L21 12Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};s.style=c;const n=".sc-stop-icon-h{display:flex}",h=n,i=class{constructor(e){t.registerInstance(this,e),this.width="15",this.height="15"}render(){return t.h("svg",{key:"8b5933c45a744cde84b5f7e8d11f9ed7a0beafc1",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"a7c58dc851d448fffc8b152c97900b22bbff8910",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};i.style=h;exports.play_icon=s;exports.stop_icon=i;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { r as o, h as t } from "./index-
|
|
1
|
+
import { r as o, h as t } from "./index-812162da.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
const e = ".sc-play-icon-h{display:flex}", i = e,
|
|
4
|
+
const e = ".sc-play-icon-h{display:flex}", i = e, c = class {
|
|
5
5
|
constructor(s) {
|
|
6
6
|
o(this, s), this.width = "15", this.height = "15";
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return t("svg", { key: "
|
|
9
|
+
return t("svg", { key: "1b5bba2078843e9faf11f53d9bc851c66d1f7532", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "9729442ffb92522f0c035cf51ed4a0db56650e49", d: "M21 12L3 21V3L21 12Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
const
|
|
12
|
+
c.style = i;
|
|
13
|
+
const h = ".sc-stop-icon-h{display:flex}", n = h, r = class {
|
|
14
14
|
constructor(s) {
|
|
15
15
|
o(this, s), this.width = "15", this.height = "15";
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
|
-
return t("svg", { key: "
|
|
18
|
+
return t("svg", { key: "8b5933c45a744cde84b5f7e8d11f9ed7a0beafc1", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "a7c58dc851d448fffc8b152c97900b22bbff8910", d: "M4 4H20V20H4V4Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
r.style = n;
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
c as play_icon,
|
|
24
24
|
r as stop_icon
|
|
25
25
|
};
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-e3e9b594.cjs");require("react");require("react-dom");exports.AddCircleIcon=o.AddCircleIcon;exports.ArchiveIcon=o.ArchiveIcon;exports.ArrowIcon=o.ArrowIcon;exports.BoldIcon=o.BoldIcon;exports.ButtonComponent=o.ButtonComponent;exports.CalendarCancelIcon=o.CalendarCancelIcon;exports.CalendarCheckIcon=o.CalendarCheckIcon;exports.CalendarIcon=o.CalendarIcon;exports.CalendarInfoIcon=o.CalendarInfoIcon;exports.CalendarPatternsIcon=o.CalendarPatternsIcon;exports.CheckboxComponent=o.CheckboxComponent;exports.CheckmarkCircleIcon=o.CheckmarkCircleIcon;exports.ChevronIcon=o.ChevronIcon;exports.ClockIcon=o.ClockIcon;exports.CloseIcon=o.CloseIcon;exports.DocumentRefreshIcon=o.DocumentRefreshIcon;exports.FlowIcon=o.FlowIcon;exports.FolderIcon=o.FolderIcon;exports.ForwardIcon=o.ForwardIcon;exports.GlobeIcon=o.GlobeIcon;exports.GoogleLogoIcon=o.GoogleLogoIcon;exports.InboxIcon=o.InboxIcon;exports.InfoIcon=o.InfoIcon;exports.InputComponent=o.InputComponent;exports.InputDropdown=o.InputDropdown;exports.ItalicIcon=o.ItalicIcon;exports.LoadingIcon=o.LoadingIcon;exports.LocationIcon=o.LocationIcon;exports.LocationOffIcon=o.LocationOffIcon;exports.MicrosoftLogoIcon=o.MicrosoftLogoIcon;exports.MultiSelectDropdown=o.MultiSelectDropdown;exports.NylasAdditionalParticipants=o.NylasAdditionalParticipants;exports.NylasAvailabilityPicker=o.NylasAvailabilityPicker;exports.NylasBookedEventCard=o.NylasBookedEventCard;exports.NylasBookingCalendarPicker=o.NylasBookingCalendarPicker;exports.NylasBookingForm=o.NylasBookingForm;exports.NylasBufferTime=o.NylasBufferTime;exports.NylasCalendarPicker=o.NylasCalendarPicker;exports.NylasCancelBookingForm=o.NylasCancelBookingForm;exports.NylasCancellationPolicy=o.NylasCancellationPolicy;exports.NylasCancelledEventCard=o.NylasCancelledEventCard;exports.NylasComposer=o.NylasComposer;exports.NylasCustomBookingFlow=o.NylasCustomBookingFlow;exports.NylasCustomizeBookingSettings=o.NylasCustomizeBookingSettings;exports.NylasDatePicker=o.NylasDatePicker;exports.NylasEditorTabs=o.NylasEditorTabs;exports.NylasEventDescription=o.NylasEventDescription;exports.NylasEventDuration=o.NylasEventDuration;exports.NylasEventInfo=o.NylasEventInfo;exports.NylasEventLimits=o.NylasEventLimits;exports.NylasEventLocation=o.NylasEventLocation;exports.NylasEventTitle=o.NylasEventTitle;exports.NylasFormCard=o.NylasFormCard;exports.NylasIdentityRequestWrapper=o.NylasIdentityRequestWrapper;exports.NylasIfState=o.NylasIfState;exports.NylasLimitFutureBookings=o.NylasLimitFutureBookings;exports.NylasListConfigurations=o.NylasListConfigurations;exports.NylasListFolders=o.NylasListFolders;exports.NylasListThreads=o.NylasListThreads;exports.NylasLocaleSwitch=o.NylasLocaleSwitch;exports.NylasLogin=o.NylasLogin;exports.NylasLogo=o.NylasLogo;exports.NylasMailbox=o.NylasMailbox;exports.NylasMailboxPagination=o.NylasMailboxPagination;exports.NylasMailboxToolbarButton=o.NylasMailboxToolbarButton;exports.NylasMinBookingNotice=o.NylasMinBookingNotice;exports.NylasMinCancellationNotice=o.NylasMinCancellationNotice;exports.NylasNotification=o.NylasNotification;exports.NylasParticipantsCustomAvailability=o.NylasParticipantsCustomAvailability;exports.NylasProvider=o.NylasProvider;exports.NylasSchedulerEditor=o.NylasSchedulerEditor;exports.NylasScheduling=o.NylasScheduling;exports.NylasSelectedEventCard=o.NylasSelectedEventCard;exports.NylasSummarizeMessageButton=o.NylasSummarizeMessageButton;exports.NylasThreadsRefresh=o.NylasThreadsRefresh;exports.NylasThreadsSearch=o.NylasThreadsSearch;exports.NylasTimeWindowPicker=o.NylasTimeWindowPicker;exports.NylasTimeslotInterval=o.NylasTimeslotInterval;exports.NylasTimeslotPicker=o.NylasTimeslotPicker;exports.NylasViewEmail=o.NylasViewEmail;exports.NylasViewThread=o.NylasViewThread;exports.PeopleIcon=o.PeopleIcon;exports.PersonIcon=o.PersonIcon;exports.PlayIcon=o.PlayIcon;exports.RadioButtonGroup=o.RadioButtonGroup;exports.RefreshIcon=o.RefreshIcon;exports.ReplyAllIcon=o.ReplyAllIcon;exports.ReplyIcon=o.ReplyIcon;exports.SearchIcon=o.SearchIcon;exports.SelectDropdown=o.SelectDropdown;exports.SentIcon=o.SentIcon;exports.SpamIcon=o.SpamIcon;exports.StarIcon=o.StarIcon;exports.StopIcon=o.StopIcon;exports.TextareaComponent=o.TextareaComponent;exports.TimePeriodSelector=o.TimePeriodSelector;exports.ToggleSwitch=o.ToggleSwitch;exports.TooltipComponent=o.TooltipComponent;exports.TranslateIcon=o.TranslateIcon;exports.TrashIcon=o.TrashIcon;exports.UnderlineIcon=o.UnderlineIcon;exports.WarningIcon=o.WarningIcon;exports.applyPolyfills=o.applyPolyfills;exports.defineCustomElements=o.defineCustomElements;exports.setNonce=o.setNonce;exports.useNylasMailboxElement=o.useNylasMailboxElement;
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e, $ as l, a0 as i, a1 as t, a2 as c, a3 as r, a4 as y, a5 as N, a6 as I, a7 as b, a8 as d, a9 as C, aa as m, ab as p, ac as u, ad as g, ae as h, af as k, ag as f, ah as P, ai as S, aj as T, ak as v, al as B, am as E, an as L, ao as w, ap as x, aq as F, ar as M, as as A, at as D, au as R, av as W, aw as G, ax as q, ay as z, az as V, aA as j, aB as O, aC as U, aD as X, aE as Y, aF as Z, aG as _, aH as $, aI as H, aJ as J, aK as K, aL as Q, aM as aa, aN as sa, aO as oa, N as na, aP as ea, aQ as la, aR as ia, aS as ta, aT as ca, aU as ra, aV as ya, aW as Na, aX as Ia, aY as ba, aZ as da, a_ as Ca, a$ as ma, b0 as pa, b1 as ua, b2 as ga, b3 as ha, b4 as ka, b5 as fa, b6 as Pa, b7 as Sa, b8 as Ta, b9 as va, ba as Ba, bb as Ea, bc as La, bd as wa, be as xa, bf as Fa, bg as Ma, bh as Aa, bi as Da, bj as Ra, bk as Wa, bl as Ga, bm as qa, bn as za, bo as Va, bp as ja, bq as Oa, br as Ua, bs as Xa, bt as Ya, bu as Za, bv as _a, bw as $a, bx as Ha, by as Ja, X as Ka, Y as Qa, Z as as, W as ss } from "./index-
|
|
1
|
+
import { _ as e, $ as l, a0 as i, a1 as t, a2 as c, a3 as r, a4 as y, a5 as N, a6 as I, a7 as b, a8 as d, a9 as C, aa as m, ab as p, ac as u, ad as g, ae as h, af as k, ag as f, ah as P, ai as S, aj as T, ak as v, al as B, am as E, an as L, ao as w, ap as x, aq as F, ar as M, as as A, at as D, au as R, av as W, aw as G, ax as q, ay as z, az as V, aA as j, aB as O, aC as U, aD as X, aE as Y, aF as Z, aG as _, aH as $, aI as H, aJ as J, aK as K, aL as Q, aM as aa, aN as sa, aO as oa, N as na, aP as ea, aQ as la, aR as ia, aS as ta, aT as ca, aU as ra, aV as ya, aW as Na, aX as Ia, aY as ba, aZ as da, a_ as Ca, a$ as ma, b0 as pa, b1 as ua, b2 as ga, b3 as ha, b4 as ka, b5 as fa, b6 as Pa, b7 as Sa, b8 as Ta, b9 as va, ba as Ba, bb as Ea, bc as La, bd as wa, be as xa, bf as Fa, bg as Ma, bh as Aa, bi as Da, bj as Ra, bk as Wa, bl as Ga, bm as qa, bn as za, bo as Va, bp as ja, bq as Oa, br as Ua, bs as Xa, bt as Ya, bu as Za, bv as _a, bw as $a, bx as Ha, by as Ja, X as Ka, Y as Qa, Z as as, W as ss } from "./index-812162da.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-e3e9b594.cjs");require("react");require("react-dom");const t=".sc-refresh-icon-h{display:flex}",i=t,c=class{constructor(s){e.registerInstance(this,s),this.width="15",this.height="15"}render(){return e.h("svg",{key:"e3570d2edebf65b741e348cfbbc51060485e787f",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 32 32",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},e.h("path",{key:"9084837664b3a5b5269fc0bb936732b785620f6c",d:"M15.544 28.080c-0.002-0.006-0.008-0.010-0.012-0.015l-2.873-4.489c-0.204-0.335-0.646-0.454-0.992-0.266l-0.256 0.157c-0.344 0.188-0.337 0.673-0.133 1.008l1.841 2.857c-0.157-0.035-0.316-0.063-0.471-0.103-3.224-0.843-5.953-3.026-7.485-5.988-1.448-2.797-1.72-5.99-0.766-8.992s3.118-5.452 5.915-6.899c0.476-0.247 0.662-0.832 0.416-1.308-0.246-0.477-0.832-0.663-1.308-0.416-3.258 1.686-5.763 4.54-6.874 8.036s-0.794 7.215 0.892 10.473c1.786 3.448 4.963 5.989 8.72 6.973 0.043 0.011 0.087 0.017 0.13 0.028l-2.541 1.288c-0.344 0.189-0.458 0.613-0.254 0.948l0.098 0.256c0.205 0.335 0.557 0.454 0.9 0.266l4.651-2.381c0.006-0.004 0.012-0.003 0.018-0.007l0.312-0.171c0.172-0.095 0.287-0.249 0.332-0.422 0.047-0.172 0.025-0.364-0.076-0.531zM28.559 10.025c-1.783-3.447-4.862-5.988-8.618-6.972-0.267-0.070-0.541-0.124-0.814-0.179l2.494-1.265c0.344-0.189 0.549-0.614 0.345-0.949l-0.099-0.255c-0.205-0.336-0.648-0.454-0.991-0.267l-4.651 2.381c-0.006 0.003-0.012 0.002-0.018 0.006l-0.312 0.171c-0.173 0.095-0.287 0.249-0.332 0.422-0.047 0.172-0.025 0.364 0.077 0.53l0.185 0.304c0.003 0.006 0.008 0.010 0.012 0.016l2.873 4.489c0.203 0.335 0.646 0.454 0.991 0.266l0.226-0.157c0.344-0.188 0.366-0.673 0.163-1.008l-1.85-2.87c0.407 0.063 0.811 0.138 1.207 0.242 3.226 0.845 5.856 3.027 7.387 5.986 1.448 2.797 1.72 5.99 0.765 8.991s-3.020 5.451-5.818 6.901c-0.476 0.247-0.662 0.831-0.415 1.308 0.172 0.332 0.511 0.524 0.863 0.524 0.15 0 0.302-0.035 0.446-0.109 3.259-1.686 5.664-4.54 6.776-8.035 1.111-3.497 0.794-7.217-0.893-10.473z"}))}};c.style=i;exports.refresh_icon=c;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as
|
|
1
|
+
import { r as e, h as c } from "./index-812162da.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
const t = ".sc-refresh-icon-h{display:flex}", l = t, h = class {
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
5
|
+
constructor(s) {
|
|
6
|
+
e(this, s), this.width = "15", this.height = "15";
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return c("svg", { key: "
|
|
9
|
+
return c("svg", { key: "e3570d2edebf65b741e348cfbbc51060485e787f", fill: "auto", width: this.width, height: this.height, viewBox: "0 0 32 32", version: "1.1", xmlns: "http://www.w3.org/2000/svg" }, c("path", { key: "9084837664b3a5b5269fc0bb936732b785620f6c", d: "M15.544 28.080c-0.002-0.006-0.008-0.010-0.012-0.015l-2.873-4.489c-0.204-0.335-0.646-0.454-0.992-0.266l-0.256 0.157c-0.344 0.188-0.337 0.673-0.133 1.008l1.841 2.857c-0.157-0.035-0.316-0.063-0.471-0.103-3.224-0.843-5.953-3.026-7.485-5.988-1.448-2.797-1.72-5.99-0.766-8.992s3.118-5.452 5.915-6.899c0.476-0.247 0.662-0.832 0.416-1.308-0.246-0.477-0.832-0.663-1.308-0.416-3.258 1.686-5.763 4.54-6.874 8.036s-0.794 7.215 0.892 10.473c1.786 3.448 4.963 5.989 8.72 6.973 0.043 0.011 0.087 0.017 0.13 0.028l-2.541 1.288c-0.344 0.189-0.458 0.613-0.254 0.948l0.098 0.256c0.205 0.335 0.557 0.454 0.9 0.266l4.651-2.381c0.006-0.004 0.012-0.003 0.018-0.007l0.312-0.171c0.172-0.095 0.287-0.249 0.332-0.422 0.047-0.172 0.025-0.364-0.076-0.531zM28.559 10.025c-1.783-3.447-4.862-5.988-8.618-6.972-0.267-0.070-0.541-0.124-0.814-0.179l2.494-1.265c0.344-0.189 0.549-0.614 0.345-0.949l-0.099-0.255c-0.205-0.336-0.648-0.454-0.991-0.267l-4.651 2.381c-0.006 0.003-0.012 0.002-0.018 0.006l-0.312 0.171c-0.173 0.095-0.287 0.249-0.332 0.422-0.047 0.172-0.025 0.364 0.077 0.53l0.185 0.304c0.003 0.006 0.008 0.010 0.012 0.016l2.873 4.489c0.203 0.335 0.646 0.454 0.991 0.266l0.226-0.157c0.344-0.188 0.366-0.673 0.163-1.008l-1.85-2.87c0.407 0.063 0.811 0.138 1.207 0.242 3.226 0.845 5.856 3.027 7.387 5.986 1.448 2.797 1.72 5.99 0.765 8.991s-3.020 5.451-5.818 6.901c-0.476 0.247-0.662 0.831-0.415 1.308 0.172 0.332 0.511 0.524 0.863 0.524 0.15 0 0.302-0.035 0.446-0.109 3.259-1.686 5.664-4.54 6.776-8.035 1.111-3.497 0.794-7.217-0.893-10.473z" }));
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
h.style = l;
|
package/dist/{register-component-a5a9ca5d-8b06415c.cjs → register-component-a5a9ca5d-b68b6039.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./index-
|
|
1
|
+
"use strict";const s=require("./index-e3e9b594.cjs");function m(e,o,u="registerComponent"){return new CustomEvent(u,{bubbles:!0,composed:!0,detail:o})}function P(e,o,u="unregisterComponent"){return new CustomEvent(u,{bubbles:!0,composed:!0,detail:o})}function b(e){return(o,u)=>{const r=e.name;s.debug(`[${r}] Registering component ${r} being called on ${u}`);const l=o.componentWillLoad;if(!l){s.error(`[${r}] componentWillLoad lifecycle method in ${r} missing. Required for RegisterComponent decorator.`);return}const p=o.connectedCallback;if(!p){s.error(`[${r}] connectedCallback lifecycle method in ${r} missing. Required for RegisterComponent decorator.`);return}const a=o.disconnectedCallback;if(!a){s.error(`[${r}] disconnectedCallback lifecycle method in ${r} missing. Required for RegisterComponent decorator.`);return}if(e.storeToProps&&e.stateToProps){const n=Array.from(e.storeToProps.values()),t=Array.from(e.stateToProps.values()),i=n.filter(c=>t.includes(c));if(i.length>0){s.error(`[${r}] Overlapping prop keys detected in ${r} for storeToProps and stateToProps. Make sure to only define them once. Overlapping keys: ${i.join(", ")}`);return}}const d=new Map;e.eventToProps&&Object.keys(e.eventToProps).forEach(n=>{var t;d.set(n,(t=e.eventToProps)==null?void 0:t[n])}),o.connectedCallback=function(){s.debug(`[~${r}] connectedCallback called`);const n=p==null?void 0:p.call(this),t=s.getElement(this);return t.dataset.nylasId||(Object.defineProperty(t,"registerNylasComponent",{get(){return!0},enumerable:!0}),Object.defineProperty(t,"stateToProps",{get(){return e.stateToProps},enumerable:!0}),Object.defineProperty(t,"getStoresToProp",{get(){return e.getStoresToProp},enumerable:!0}),Object.defineProperty(t,"storeToProps",{get(){return e.storeToProps},enumerable:!0}),Object.defineProperty(t,"eventToProps",{get(){return d},enumerable:!0}),Object.defineProperty(t,"authToProp",{get(){return e.authToProp},enumerable:!0}),Object.defineProperty(t,"connectorToProp",{get(){return e.connectorToProp},enumerable:!0}),Object.defineProperty(t,"localPropsToProp",{get(){return e.localPropsToProp},enumerable:!0})),n},e.fireRegisterEvent&&(o.componentWillLoad=function(){const n=l==null?void 0:l.call(this),t=s.getElement(this),i={element:t,...e,eventToProps:d},c=m(o,i,e.registrationEventName);return t.dispatchEvent(c)&&s.debug(`[${r}] Component ${r} successfully fired registration event`),n},o.disconnectedCallback=function(){const n=a==null?void 0:a.call(this),t=s.getElement(this),i={element:t,...e,eventToProps:d},c=P(o,i,e.unregistrationEventName);return t.dispatchEvent(c)&&s.debug(`[${r}] Component ${r} successfully fired unregistration event`),n})}}exports.RegisterComponent=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./index-
|
|
1
|
+
"use strict";const i=require("./index-e3e9b594.cjs");function c(n={}){const o={selectedConfiguration:{},configurations:[],calendars:[],currentUser:null,action:null,additionalParticipants:[],...n},e=i.createStore(o);function t(){e.set("selectedConfiguration",{...n.selectedConfiguration})}return e.onChange("action",async r=>{r||t()}),{...e,resetSelectedConfiguration:t}}exports.CreateNylasSchedulerConfigStore=c;
|
package/dist/{scheduler-store-f02ce045-f11cfad9.cjs → scheduler-store-f02ce045-42e3647c.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const S=require("./index-769f0fdd.cjs");exports.ErrorCategory=void 0;(function(o){o.Component="component",o.Api="api",o.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var T;(function(o){o.endtime_not_in_future="endtime_not_in_future",o.no_booking_info="no_booking_info",o.no_timeslot_selected="no_timeslot_selected",o.no_timezone_selected="no_timezone_selected",o.no_booking_id="no_booking_id",o.invalid_start_time="invalid_start_time",o.invalid_end_time="invalid_end_time",o.invalid_timezone="invalid_timezone"})(T||(T={}));var k;(function(o){o.invalid_session="invalid_session",o.general_error="general_error",o.internal_error="internal_error",o.invalid_request_error="invalid_request_error",o.timeslot_not_available="timeslot_not_available",o.provider_error="provider_error",o.not_found_error="not_found_error"})(k||(k={}));class M{constructor(){this.component=e=>{const t=exports.ErrorCategory.Component,s=`${e} Error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:t}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:t}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:t}),no_timezone_selected:(i="No timezone selected")=>({title:s,message:i,category:t}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:t}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:t}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:t}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:t})}},this.api=e=>{const t=exports.ErrorCategory.Api,s=`${e} Error`;return{invalid_session:i=>({title:s,message:i,category:t}),general_error:i=>({title:s,message:i,category:t}),internal_error:i=>({title:s,message:i,category:t}),invalid_request_error:i=>({title:s,message:i,category:t}),timeslot_not_available:i=>({title:s,message:i,category:t}),provider_error:i=>({title:s,message:i,category:t}),not_found_error:i=>({title:s,message:i,category:t})}}}}class C{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i}){this.errors=new M,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const r=new URL(this.schedulerAPIURL);return r.pathname=e,await(await fetch(decodeURIComponent(r.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var s,i,r,n;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((i=(s=e==null?void 0:e.provider_error)==null?void 0:s.error)==null?void 0:i.message)||((n=(r=e==null?void 0:e.provider_error)==null?void 0:r.error)==null?void 0:n.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,s=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(s,i)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),s=this.schedulerStore.get("availability").find(r=>new Date(r.start_time)>new Date);let i=e;return s&&(i=s.start_time),this.schedulerStore.set("selectedDate",i),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){const t=this.schedulerStore.state.eventInfo;t&&this.schedulerStore.set("reschedulingEventInfo",t);const s=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("rescheduleBookingId",e),s}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async bookTimeslot(e){var h;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component("Booking").no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component("Create Booking").no_timeslot_selected()};const n=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s;if(!n)return{error:this.errors.component("Create Booking").no_timezone_selected()};const a=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,u=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],c=e?e==null?void 0:e.additionalFields:i==null?void 0:i.additionalFields,g=this.getHeaders(),_=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:""}`,l=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:c,additional_guests:u,guest:{...a},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:n}),g);if("error"in l){this.schedulerStore.set("isLoading",!1);const d=(h=l.error)==null?void 0:h.type;let v=l.error;if(d&&d in this.errors.api("Create Booking")){const y=this.getErrorMessage(v);v=this.errors.api("Create Booking")[d](y)}return{error:v}}return"data"in l&&this.schedulerStore.set("eventInfo",l==null?void 0:l.data),this.schedulerStore.set("isLoading",!1),l}async getUISettings(){var r;this.schedulerStore.set("isLoading",!0);const e=this.getHeaders(),s=`/v3/scheduling/ui-settings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:""}`,i=await this.makeAPIRequest(s,"GET",void 0,e);if("error"in i){this.schedulerStore.set("isLoading",!1);const n=(r=i.error)==null?void 0:r.type;let a=i.error;return n&&n in this.errors.api("Get UI Settings")&&(a=this.errors.api("Get UI Settings")[n]((a==null?void 0:a.message)||(a==null?void 0:a.title)||"Something went wrong")),{error:a}}return"data"in i&&this.schedulerStore.set("configSettings",i.data),this.schedulerStore.set("isLoading",!1),i}getStartTimeWithMinBookingNotice(e){var i;const t=(i=this.schedulerStore.get("configSettings"))==null?void 0:i.scheduler,s=t==null?void 0:t.min_booking_notice;return s?e+s*60:e}getEndTimeForAvailableDaysInFuture(e){var n,a;const t=new Date,s=(a=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler)==null?void 0:a.available_days_in_future,i=Math.floor(S.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var g,f,_;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,r=i.getTime();if(t&&t<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component("Get Availability").endtime_not_in_future()};if(!e){const l=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(l.getTime()/1e3)}if(e=this.getStartTimeWithMinBookingNotice(e),!t){const l=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(l.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t),s.append("start_time",encodeURIComponent(e.toString())),s.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId&&s.append("configuration_id",encodeURIComponent(this.configId));const n=s.toString(),a=`/v3/scheduling/availability${n?`?${n}`:""}`,u=this.getHeaders(),c=await this.makeAPIRequest(decodeURIComponent(a),"GET",void 0,u);if("error"in c){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const l=(g=c.error)==null?void 0:g.type;let h=c.error;if(l&&l in this.errors.api("Get Availability")){const d=this.getErrorMessage(h);h=this.errors.api("Get Availability")[l](d)}return{error:h}}if("data"in c){const h=(((_=(f=c.data)==null?void 0:f.time_slots)==null?void 0:_.map(d=>({...d,start_time:new Date(d.start_time*1e3),end_time:new Date(d.end_time*1e3)})))||[]).filter(d=>d.start_time.getTime()>r);this.schedulerStore.set("availability",h)}return this.schedulerStore.set("isLoading",!1),c}async cancelBooking(e,t){var a;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component("Cancel Booking").no_booking_id()};const s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:"",i=`/v3/scheduling/bookings/${e}${s}`,r=this.getHeaders(),n=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),r);if("error"in n){this.schedulerStore.set("isLoading",!1);const u=(a=n.error)==null?void 0:a.type;let c=n.error;if(u&&u in this.errors.api("Cancel Booking")){const g=this.getErrorMessage(c);c=this.errors.api("Cancel Booking")[u](g)}return{error:c}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("isLoading",!1),n}async rescheduleBooking(e,t){var w;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component("Reschedule Booking").no_booking_id()};const s=this.errors.api("Reschedule Booking"),i=this.errors.component("Reschedule Booking"),{bookingInfo:r,selectedTimeslot:n,selectedTimezone:a}=this.schedulerStore.state,{startTime:u,endTime:c,timezone:g}=t,f=u||(n==null?void 0:n.start_time);if(!f)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const _=c||(n==null?void 0:n.end_time);if(!_)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const l=g||a;if(!l)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const h=t?t==null?void 0:t.primaryParticipant:r==null?void 0:r.primaryParticipant,d=t?(t==null?void 0:t.guests)||[]:(r==null?void 0:r.guests)||[],v=t?{...t==null?void 0:t.additionalFields,guests:d}:{...r==null?void 0:r.additionalFields,guests:d},y=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:"",D=`/v3/scheduling/bookings/${e}${y}`,A=this.getHeaders(),m=await this.makeAPIRequest(decodeURIComponent(D),"PATCH",JSON.stringify({start_time:f.getTime()/1e3,end_time:_.getTime()/1e3,time_zone:l,additional_fields:v,guest:{...h}}),A);if("error"in m){this.schedulerStore.set("isLoading",!1);const p=(w=m.error)==null?void 0:w.type;let I=m.error;if(p&&p in s){const P=this.getErrorMessage(I);I=s[p](P)}return{error:I}}const b=this.schedulerStore.get("reschedulingEventInfo");if("data"in m)this.schedulerStore.set("eventInfo",m==null?void 0:m.data);else if(b)this.schedulerStore.set("eventInfo",b);else{const p={booking_id:e};this.schedulerStore.set("eventInfo",p)}return this.schedulerStore.set("isLoading",!1),m}}function z(o={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...o};S.debug("[defaultNylasStoreState]: ",e);const t=S.createStore(e);return t.onChange("availability",s=>{S.debug("[availability]: ",s);const i=s.map(a=>a.start_time);S.debug("[selectableDates]: ",i),t.set("selectableDates",i);const r=s[0];if(!r)return;const n=Math.floor((r.end_time.getTime()-r.start_time.getTime())/6e4);S.debug("[durationMinutes]: ",n),t.set("eventDuration",n)}),t.reset=()=>{for(const s in e){const i=e[s];t.set(s,i)}},t}exports.CreateNylasSchedulerStore=z;exports.NylaSchedulerAPIConnector=C;
|
|
1
|
+
"use strict";const S=require("./index-e3e9b594.cjs");exports.ErrorCategory=void 0;(function(o){o.Component="component",o.Api="api",o.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var T;(function(o){o.endtime_not_in_future="endtime_not_in_future",o.no_booking_info="no_booking_info",o.no_timeslot_selected="no_timeslot_selected",o.no_timezone_selected="no_timezone_selected",o.no_booking_id="no_booking_id",o.invalid_start_time="invalid_start_time",o.invalid_end_time="invalid_end_time",o.invalid_timezone="invalid_timezone"})(T||(T={}));var k;(function(o){o.invalid_session="invalid_session",o.general_error="general_error",o.internal_error="internal_error",o.invalid_request_error="invalid_request_error",o.timeslot_not_available="timeslot_not_available",o.provider_error="provider_error",o.not_found_error="not_found_error"})(k||(k={}));class M{constructor(){this.component=e=>{const t=exports.ErrorCategory.Component,s=`${e} Error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:t}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:t}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:t}),no_timezone_selected:(i="No timezone selected")=>({title:s,message:i,category:t}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:t}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:t}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:t}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:t})}},this.api=e=>{const t=exports.ErrorCategory.Api,s=`${e} Error`;return{invalid_session:i=>({title:s,message:i,category:t}),general_error:i=>({title:s,message:i,category:t}),internal_error:i=>({title:s,message:i,category:t}),invalid_request_error:i=>({title:s,message:i,category:t}),timeslot_not_available:i=>({title:s,message:i,category:t}),provider_error:i=>({title:s,message:i,category:t}),not_found_error:i=>({title:s,message:i,category:t})}}}}class C{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i}){this.errors=new M,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const r=new URL(this.schedulerAPIURL);return r.pathname=e,await(await fetch(decodeURIComponent(r.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var s,i,r,n;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((i=(s=e==null?void 0:e.provider_error)==null?void 0:s.error)==null?void 0:i.message)||((n=(r=e==null?void 0:e.provider_error)==null?void 0:r.error)==null?void 0:n.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,s=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(s,i)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),s=this.schedulerStore.get("availability").find(r=>new Date(r.start_time)>new Date);let i=e;return s&&(i=s.start_time),this.schedulerStore.set("selectedDate",i),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){const t=this.schedulerStore.state.eventInfo;t&&this.schedulerStore.set("reschedulingEventInfo",t);const s=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("rescheduleBookingId",e),s}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async bookTimeslot(e){var h;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component("Booking").no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component("Create Booking").no_timeslot_selected()};const n=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s;if(!n)return{error:this.errors.component("Create Booking").no_timezone_selected()};const a=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,u=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],c=e?e==null?void 0:e.additionalFields:i==null?void 0:i.additionalFields,g=this.getHeaders(),_=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:""}`,l=await this.makeAPIRequest(decodeURIComponent(_),"POST",JSON.stringify({additional_fields:c,additional_guests:u,guest:{...a},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:n}),g);if("error"in l){this.schedulerStore.set("isLoading",!1);const d=(h=l.error)==null?void 0:h.type;let v=l.error;if(d&&d in this.errors.api("Create Booking")){const y=this.getErrorMessage(v);v=this.errors.api("Create Booking")[d](y)}return{error:v}}return"data"in l&&this.schedulerStore.set("eventInfo",l==null?void 0:l.data),this.schedulerStore.set("isLoading",!1),l}async getUISettings(){var r;this.schedulerStore.set("isLoading",!0);const e=this.getHeaders(),s=`/v3/scheduling/ui-settings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:""}`,i=await this.makeAPIRequest(s,"GET",void 0,e);if("error"in i){this.schedulerStore.set("isLoading",!1);const n=(r=i.error)==null?void 0:r.type;let a=i.error;return n&&n in this.errors.api("Get UI Settings")&&(a=this.errors.api("Get UI Settings")[n]((a==null?void 0:a.message)||(a==null?void 0:a.title)||"Something went wrong")),{error:a}}return"data"in i&&this.schedulerStore.set("configSettings",i.data),this.schedulerStore.set("isLoading",!1),i}getStartTimeWithMinBookingNotice(e){var i;const t=(i=this.schedulerStore.get("configSettings"))==null?void 0:i.scheduler,s=t==null?void 0:t.min_booking_notice;return s?e+s*60:e}getEndTimeForAvailableDaysInFuture(e){var n,a;const t=new Date,s=(a=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler)==null?void 0:a.available_days_in_future,i=Math.floor(S.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var g,f,_;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,r=i.getTime();if(t&&t<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component("Get Availability").endtime_not_in_future()};if(!e){const l=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(l.getTime()/1e3)}if(e=this.getStartTimeWithMinBookingNotice(e),!t){const l=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(l.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t),s.append("start_time",encodeURIComponent(e.toString())),s.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId&&s.append("configuration_id",encodeURIComponent(this.configId));const n=s.toString(),a=`/v3/scheduling/availability${n?`?${n}`:""}`,u=this.getHeaders(),c=await this.makeAPIRequest(decodeURIComponent(a),"GET",void 0,u);if("error"in c){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const l=(g=c.error)==null?void 0:g.type;let h=c.error;if(l&&l in this.errors.api("Get Availability")){const d=this.getErrorMessage(h);h=this.errors.api("Get Availability")[l](d)}return{error:h}}if("data"in c){const h=(((_=(f=c.data)==null?void 0:f.time_slots)==null?void 0:_.map(d=>({...d,start_time:new Date(d.start_time*1e3),end_time:new Date(d.end_time*1e3)})))||[]).filter(d=>d.start_time.getTime()>r);this.schedulerStore.set("availability",h)}return this.schedulerStore.set("isLoading",!1),c}async cancelBooking(e,t){var a;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component("Cancel Booking").no_booking_id()};const s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:"",i=`/v3/scheduling/bookings/${e}${s}`,r=this.getHeaders(),n=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),r);if("error"in n){this.schedulerStore.set("isLoading",!1);const u=(a=n.error)==null?void 0:a.type;let c=n.error;if(u&&u in this.errors.api("Cancel Booking")){const g=this.getErrorMessage(c);c=this.errors.api("Cancel Booking")[u](g)}return{error:c}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("isLoading",!1),n}async rescheduleBooking(e,t){var w;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component("Reschedule Booking").no_booking_id()};const s=this.errors.api("Reschedule Booking"),i=this.errors.component("Reschedule Booking"),{bookingInfo:r,selectedTimeslot:n,selectedTimezone:a}=this.schedulerStore.state,{startTime:u,endTime:c,timezone:g}=t,f=u||(n==null?void 0:n.start_time);if(!f)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const _=c||(n==null?void 0:n.end_time);if(!_)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const l=g||a;if(!l)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const h=t?t==null?void 0:t.primaryParticipant:r==null?void 0:r.primaryParticipant,d=t?(t==null?void 0:t.guests)||[]:(r==null?void 0:r.guests)||[],v=t?{...t==null?void 0:t.additionalFields,guests:d}:{...r==null?void 0:r.additionalFields,guests:d},y=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:"",D=`/v3/scheduling/bookings/${e}${y}`,A=this.getHeaders(),m=await this.makeAPIRequest(decodeURIComponent(D),"PATCH",JSON.stringify({start_time:f.getTime()/1e3,end_time:_.getTime()/1e3,time_zone:l,additional_fields:v,guest:{...h}}),A);if("error"in m){this.schedulerStore.set("isLoading",!1);const p=(w=m.error)==null?void 0:w.type;let I=m.error;if(p&&p in s){const P=this.getErrorMessage(I);I=s[p](P)}return{error:I}}const b=this.schedulerStore.get("reschedulingEventInfo");if("data"in m)this.schedulerStore.set("eventInfo",m==null?void 0:m.data);else if(b)this.schedulerStore.set("eventInfo",b);else{const p={booking_id:e};this.schedulerStore.set("eventInfo",p)}return this.schedulerStore.set("isLoading",!1),m}}function z(o={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...o};S.debug("[defaultNylasStoreState]: ",e);const t=S.createStore(e);return t.onChange("availability",s=>{S.debug("[availability]: ",s);const i=s.map(a=>a.start_time);S.debug("[selectableDates]: ",i),t.set("selectableDates",i);const r=s[0];if(!r)return;const n=Math.floor((r.end_time.getTime()-r.start_time.getTime())/6e4);S.debug("[durationMinutes]: ",n),t.set("eventDuration",n)}),t.reset=()=>{for(const s in e){const i=e[s];t.set(s,i)}},t}exports.CreateNylasSchedulerStore=z;exports.NylaSchedulerAPIConnector=C;
|