@nylas/react 0.0.0-canary-20240925163706
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/LICENSE.md +22 -0
- package/README.md +111 -0
- package/dist/add-circle-icon_2.entry-19a0fe6b.js +25 -0
- package/dist/add-circle-icon_2.entry-6f0ef50b.cjs +1 -0
- package/dist/archive-icon.entry-7caa062b.js +15 -0
- package/dist/archive-icon.entry-d9a39415.cjs +1 -0
- package/dist/arrow-icon.entry-29ce2105.cjs +1 -0
- package/dist/arrow-icon.entry-ab601786.js +15 -0
- package/dist/bold-icon.entry-6ff126e7.cjs +1 -0
- package/dist/bold-icon.entry-e389dd6a.js +15 -0
- package/dist/button-component_2.entry-06af034d.js +26 -0
- package/dist/button-component_2.entry-837792bd.cjs +1 -0
- package/dist/calendar-agenda-fill-icon_51.entry-6c5c6fd4.js +5336 -0
- package/dist/calendar-agenda-fill-icon_51.entry-aaa927bb.cjs +7 -0
- package/dist/calendar-cancel-icon.entry-bf97fa74.js +15 -0
- package/dist/calendar-cancel-icon.entry-da33711a.cjs +1 -0
- package/dist/calendar-check-icon_2.entry-0fcc2bd1.cjs +1 -0
- package/dist/calendar-check-icon_2.entry-e9709591.js +25 -0
- package/dist/calendar-icon.entry-056c8caf.cjs +1 -0
- package/dist/calendar-icon.entry-70cca97a.js +15 -0
- package/dist/checkbox-component_2.entry-88af9f01.js +79 -0
- package/dist/checkbox-component_2.entry-cf19cd62.cjs +1 -0
- package/dist/chevron-icon_3.entry-1c22f6d3.js +143 -0
- package/dist/chevron-icon_3.entry-85d098ed.cjs +1 -0
- package/dist/clock-icon_4.entry-5edf8fcd.js +45 -0
- package/dist/clock-icon_4.entry-7b892d79.cjs +1 -0
- package/dist/constants-c31dccfe-54f255f4.cjs +15 -0
- package/dist/constants-c31dccfe-93b0694c.js +3883 -0
- package/dist/copy-icon.entry-b3b8e543.js +15 -0
- package/dist/copy-icon.entry-fcd2c006.cjs +1 -0
- package/dist/core-js-38e53e34.cjs +4 -0
- package/dist/core-js-a9d3b6e1.js +3297 -0
- package/dist/delete-icon.entry-9745ae8b.cjs +1 -0
- package/dist/delete-icon.entry-f982c1a7.js +15 -0
- package/dist/document-refresh-icon.entry-5a30a275.cjs +1 -0
- package/dist/document-refresh-icon.entry-defaaba2.js +15 -0
- package/dist/dom-68f08be9.cjs +15 -0
- package/dist/dom-86e17616.js +664 -0
- package/dist/elements/index.d.ts +128 -0
- package/dist/elements/react-component-lib/createComponent.d.ts +10 -0
- package/dist/elements/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/dist/elements/react-component-lib/index.d.ts +2 -0
- package/dist/elements/react-component-lib/interfaces.d.ts +29 -0
- package/dist/elements/react-component-lib/utils/attachProps.d.ts +9 -0
- package/dist/elements/react-component-lib/utils/case.d.ts +2 -0
- package/dist/elements/react-component-lib/utils/dev.d.ts +2 -0
- package/dist/elements/react-component-lib/utils/index.d.ts +10 -0
- package/dist/feedbackSync-ab657d65-b98458dc.cjs +448 -0
- package/dist/feedbackSync-ab657d65-d6521095.js +6035 -0
- package/dist/folder-icon.entry-08cf370b.js +15 -0
- package/dist/folder-icon.entry-425f61ef.cjs +1 -0
- package/dist/forward-icon.entry-4acbada4.js +15 -0
- package/dist/forward-icon.entry-7062edbf.cjs +1 -0
- package/dist/globe-icon.entry-51e847a3.js +15 -0
- package/dist/globe-icon.entry-b779a059.cjs +1 -0
- package/dist/google-logo-icon_4.entry-96a8caee.cjs +1 -0
- package/dist/google-logo-icon_4.entry-c44f16cc.js +715 -0
- package/dist/inbox-icon.entry-04d81697.cjs +1 -0
- package/dist/inbox-icon.entry-6e3a9428.js +15 -0
- package/dist/index-87381561.cjs +81 -0
- package/dist/index-995dd3b3.js +12865 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es-b475d61f-f250d992.cjs +7 -0
- package/dist/index.es-b475d61f-f52875ad.js +3129 -0
- package/dist/info-icon_2.entry-c3f4b245.js +34 -0
- package/dist/info-icon_2.entry-d733f421.cjs +1 -0
- package/dist/input-color-picker.entry-02e48131.js +48 -0
- package/dist/input-color-picker.entry-516445b9.cjs +1 -0
- package/dist/input-component.entry-5bb8197a.cjs +1 -0
- package/dist/input-component.entry-dbff4e12.js +70 -0
- package/dist/input-dropdown.entry-7b40f8a7.cjs +1 -0
- package/dist/input-dropdown.entry-cc4182c4.js +134 -0
- package/dist/italic-icon.entry-494a04f1.js +15 -0
- package/dist/italic-icon.entry-bd268b46.cjs +1 -0
- package/dist/multi-select-dropdown.entry-55f7dd99.cjs +1 -0
- package/dist/multi-select-dropdown.entry-b9ac9a80.js +95 -0
- package/dist/nylas-booked-event-card_12.entry-a1048d4e.cjs +1 -0
- package/dist/nylas-booked-event-card_12.entry-ac8f1a11.js +1139 -0
- package/dist/nylas-form-card.entry-9957f25c.cjs +1 -0
- package/dist/nylas-form-card.entry-9ec44108.js +57 -0
- package/dist/nylas-if-state.entry-934980c1.js +94 -0
- package/dist/nylas-if-state.entry-f7087bb0.cjs +1 -0
- package/dist/nylas-login.entry-074778e6.cjs +1 -0
- package/dist/nylas-login.entry-17a6788a.js +73 -0
- package/dist/nylas-provider.entry-0edfffb0.cjs +1 -0
- package/dist/nylas-provider.entry-58e44ef6.js +264 -0
- package/dist/nylas-reminder-emails.entry-0129ea1f.cjs +4 -0
- package/dist/nylas-reminder-emails.entry-dec904fb.js +168 -0
- package/dist/nylas-reminder-time_2.entry-48b85638.js +108 -0
- package/dist/nylas-reminder-time_2.entry-6d8982d9.cjs +1 -0
- package/dist/nylas-scheduler-editor.entry-a913f2b3.js +1447 -0
- package/dist/nylas-scheduler-editor.entry-b293366d.cjs +2 -0
- package/dist/nylas-scheduling.entry-29b473ef.js +400 -0
- package/dist/nylas-scheduling.entry-5d751778.cjs +1 -0
- package/dist/nylas-time-window-picker.entry-aa613b4d.cjs +1 -0
- package/dist/nylas-time-window-picker.entry-d2e2210e.js +316 -0
- package/dist/person-icon.entry-11852b43.cjs +1 -0
- package/dist/person-icon.entry-767695db.js +15 -0
- package/dist/play-icon.entry-125d062f.cjs +1 -0
- package/dist/play-icon.entry-9e385af9.js +15 -0
- package/dist/react.cjs +1 -0
- package/dist/react.js +136 -0
- package/dist/refresh-icon.entry-13e06ddd.cjs +1 -0
- package/dist/refresh-icon.entry-339c1223.js +15 -0
- package/dist/register-component-679c1308-0b6682e1.cjs +1 -0
- package/dist/register-component-679c1308-3b561946.js +109 -0
- package/dist/reply-all-icon.entry-e56e8608.cjs +1 -0
- package/dist/reply-all-icon.entry-f82e7b24.js +15 -0
- package/dist/reply-icon.entry-319e75df.js +15 -0
- package/dist/reply-icon.entry-ebb08667.cjs +1 -0
- package/dist/scheduler-config-store-2a3b403d-aed2458a.cjs +1 -0
- package/dist/scheduler-config-store-2a3b403d-f5b7b06f.js +27 -0
- package/dist/scheduler-store-908886c8-75b1f2d8.js +474 -0
- package/dist/scheduler-store-908886c8-9c388312.cjs +1 -0
- package/dist/sent-icon.entry-2f7a8e18.js +15 -0
- package/dist/sent-icon.entry-393a90a3.cjs +1 -0
- package/dist/spam-icon.entry-d7853085.cjs +1 -0
- package/dist/spam-icon.entry-de7c7233.js +15 -0
- package/dist/star-icon.entry-c8fa29e1.cjs +1 -0
- package/dist/star-icon.entry-cfb5c8e5.js +15 -0
- package/dist/stop-icon.entry-c6e9fd7f.js +15 -0
- package/dist/stop-icon.entry-e5415d24.cjs +1 -0
- package/dist/textarea-component.entry-6f80f914.js +37 -0
- package/dist/textarea-component.entry-d46ad4ac.cjs +1 -0
- package/dist/time-period-selector.entry-2eaf3ddb.cjs +1 -0
- package/dist/time-period-selector.entry-f8be5854.js +80 -0
- package/dist/translate-icon.entry-dc151da3.cjs +1 -0
- package/dist/translate-icon.entry-ffb6d5bf.js +15 -0
- package/dist/trash-fill-icon.entry-063b2e26.cjs +1 -0
- package/dist/trash-fill-icon.entry-a9966957.js +15 -0
- package/dist/underline-icon.entry-b992a0fc.js +15 -0
- package/dist/underline-icon.entry-c77e97df.cjs +1 -0
- package/dist/warning-icon.entry-0cae2440.cjs +1 -0
- package/dist/warning-icon.entry-28c1b03b.js +15 -0
- package/package.json +50 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("./index-87381561.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;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { d, O as m, g as P } from "./index-995dd3b3.js";
|
|
2
|
+
function b(e, o, i = "registerComponent") {
|
|
3
|
+
return new CustomEvent(i, {
|
|
4
|
+
bubbles: !0,
|
|
5
|
+
composed: !0,
|
|
6
|
+
detail: o
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function T(e, o, i = "unregisterComponent") {
|
|
10
|
+
return new CustomEvent(i, {
|
|
11
|
+
bubbles: !0,
|
|
12
|
+
composed: !0,
|
|
13
|
+
detail: o
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function v(e) {
|
|
17
|
+
return (o, i) => {
|
|
18
|
+
const r = e.name;
|
|
19
|
+
d(`[${r}] Registering component ${r} being called on ${i}`);
|
|
20
|
+
const u = o.componentWillLoad;
|
|
21
|
+
if (!u) {
|
|
22
|
+
m(`[${r}] componentWillLoad lifecycle method in ${r} missing. Required for RegisterComponent decorator.`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const p = o.connectedCallback;
|
|
26
|
+
if (!p) {
|
|
27
|
+
m(`[${r}] connectedCallback lifecycle method in ${r} missing. Required for RegisterComponent decorator.`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const l = o.disconnectedCallback;
|
|
31
|
+
if (!l) {
|
|
32
|
+
m(`[${r}] disconnectedCallback lifecycle method in ${r} missing. Required for RegisterComponent decorator.`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (e.storeToProps && e.stateToProps) {
|
|
36
|
+
const n = Array.from(e.storeToProps.values()), t = Array.from(e.stateToProps.values()), s = n.filter((c) => t.includes(c));
|
|
37
|
+
if (s.length > 0) {
|
|
38
|
+
m(`[${r}] Overlapping prop keys detected in ${r} for storeToProps and stateToProps. Make sure to only define them once. Overlapping keys: ${s.join(", ")}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const a = /* @__PURE__ */ new Map();
|
|
43
|
+
e.eventToProps && Object.keys(e.eventToProps).forEach((n) => {
|
|
44
|
+
var t;
|
|
45
|
+
a.set(n, (t = e.eventToProps) == null ? void 0 : t[n]);
|
|
46
|
+
}), o.connectedCallback = function() {
|
|
47
|
+
d(`[~${r}] connectedCallback called`);
|
|
48
|
+
const n = p == null ? void 0 : p.call(this), t = P(this);
|
|
49
|
+
return t.dataset.nylasId || (Object.defineProperty(t, "registerNylasComponent", {
|
|
50
|
+
get() {
|
|
51
|
+
return !0;
|
|
52
|
+
},
|
|
53
|
+
enumerable: !0
|
|
54
|
+
}), Object.defineProperty(t, "stateToProps", {
|
|
55
|
+
get() {
|
|
56
|
+
return e.stateToProps;
|
|
57
|
+
},
|
|
58
|
+
enumerable: !0
|
|
59
|
+
}), Object.defineProperty(t, "getStoresToProp", {
|
|
60
|
+
get() {
|
|
61
|
+
return e.getStoresToProp;
|
|
62
|
+
},
|
|
63
|
+
enumerable: !0
|
|
64
|
+
}), Object.defineProperty(t, "storeToProps", {
|
|
65
|
+
get() {
|
|
66
|
+
return e.storeToProps;
|
|
67
|
+
},
|
|
68
|
+
enumerable: !0
|
|
69
|
+
}), Object.defineProperty(t, "eventToProps", {
|
|
70
|
+
get() {
|
|
71
|
+
return a;
|
|
72
|
+
},
|
|
73
|
+
enumerable: !0
|
|
74
|
+
}), Object.defineProperty(t, "authToProp", {
|
|
75
|
+
get() {
|
|
76
|
+
return e.authToProp;
|
|
77
|
+
},
|
|
78
|
+
enumerable: !0
|
|
79
|
+
}), Object.defineProperty(t, "connectorToProp", {
|
|
80
|
+
get() {
|
|
81
|
+
return e.connectorToProp;
|
|
82
|
+
},
|
|
83
|
+
enumerable: !0
|
|
84
|
+
}), Object.defineProperty(t, "localPropsToProp", {
|
|
85
|
+
get() {
|
|
86
|
+
return e.localPropsToProp;
|
|
87
|
+
},
|
|
88
|
+
enumerable: !0
|
|
89
|
+
})), n;
|
|
90
|
+
}, e.fireRegisterEvent && (o.componentWillLoad = function() {
|
|
91
|
+
const n = u == null ? void 0 : u.call(this), t = P(this), s = {
|
|
92
|
+
element: t,
|
|
93
|
+
...e,
|
|
94
|
+
eventToProps: a
|
|
95
|
+
}, c = b(o, s, e.registrationEventName);
|
|
96
|
+
return t.dispatchEvent(c) && d(`[${r}] Component ${r} successfully fired registration event`), n;
|
|
97
|
+
}, o.disconnectedCallback = function() {
|
|
98
|
+
const n = l == null ? void 0 : l.call(this), t = P(this), s = {
|
|
99
|
+
element: t,
|
|
100
|
+
...e,
|
|
101
|
+
eventToProps: a
|
|
102
|
+
}, c = T(o, s, e.unregistrationEventName);
|
|
103
|
+
return t.dispatchEvent(c) && d(`[${r}] Component ${r} successfully fired unregistration event`), n;
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
v as R
|
|
109
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-87381561.cjs");require("react");require("react-dom");const i=".sc-reply-all-icon-h{display:flex}",s=i,t=class{constructor(l){e.registerInstance(this,l),this.width="15",this.height="15"}render(){return e.h("svg",{key:"9749cbb476cd24fa7749f74c84451915b0bbd389",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},e.h("path",{key:"8abb22a5118d9b46ae17cdf0f158eea3286844d7",d:"m1030.975 188 81.249 81.249-429.228 429.228h300.747c516.223 0 936.257 420.034 936.257 936.257v98.028h-114.92v-98.028c0-452.901-368.436-821.337-821.337-821.337H682.996l429.228 429.229-81.25 81.248-567.936-567.937L1030.975 188Zm-463.038.011 81.249 81.25-486.688 486.688 486.688 486.688-81.249 81.249L0 755.949 567.937 188.01Z","fill-rule":"evenodd"}))}};t.style=s;exports.reply_all_icon=t;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r as l, h as t } from "./index-995dd3b3.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const s = ".sc-reply-all-icon-h{display:flex}", i = s, h = class {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
l(this, e), this.width = "15", this.height = "15";
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return t("svg", { key: "9749cbb476cd24fa7749f74c84451915b0bbd389", fill: "auto", width: this.width, height: this.height, viewBox: "0 0 1920 1920", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "8abb22a5118d9b46ae17cdf0f158eea3286844d7", d: "m1030.975 188 81.249 81.249-429.228 429.228h300.747c516.223 0 936.257 420.034 936.257 936.257v98.028h-114.92v-98.028c0-452.901-368.436-821.337-821.337-821.337H682.996l429.228 429.229-81.25 81.248-567.936-567.937L1030.975 188Zm-463.038.011 81.249 81.25-486.688 486.688 486.688 486.688-81.249 81.249L0 755.949 567.937 188.01Z", "fill-rule": "evenodd" }));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
h.style = i;
|
|
13
|
+
export {
|
|
14
|
+
h as reply_all_icon
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r as s, h as e } from "./index-995dd3b3.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const c = ".sc-reply-icon-h{display:flex}", i = c, h = class {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
s(this, t), this.width = "15", this.height = "15";
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return e("svg", { key: "ff9ce6eae8940b2b906b6447b9cca4041bbce563", fill: "auto", width: this.width, height: this.height, viewBox: "0 0 1920 1920", xmlns: "http://www.w3.org/2000/svg" }, e("path", { key: "e1d7626352bb59a4d86272c3aadfbc1bc5245ed1", d: "M835.942 632.563H244.966l478.08-478.08-90.496-90.496L-.026 696.563 632.55 1329.14l90.496-90.496-478.08-478.08h590.976c504.448 0 914.816 410.368 914.816 914.816v109.184h128V1675.38c0-574.976-467.84-1042.816-1042.816-1042.816", "fill-rule": "evenodd" }));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
h.style = i;
|
|
13
|
+
export {
|
|
14
|
+
h as reply_icon
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-87381561.cjs");require("react");require("react-dom");const c=".sc-reply-icon-h{display:flex}",s=c,t=class{constructor(i){e.registerInstance(this,i),this.width="15",this.height="15"}render(){return e.h("svg",{key:"ff9ce6eae8940b2b906b6447b9cca4041bbce563",fill:"auto",width:this.width,height:this.height,viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg"},e.h("path",{key:"e1d7626352bb59a4d86272c3aadfbc1bc5245ed1",d:"M835.942 632.563H244.966l478.08-478.08-90.496-90.496L-.026 696.563 632.55 1329.14l90.496-90.496-478.08-478.08h590.976c504.448 0 914.816 410.368 914.816 914.816v109.184h128V1675.38c0-574.976-467.84-1042.816-1042.816-1042.816","fill-rule":"evenodd"}))}};t.style=s;exports.reply_icon=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("./index-87381561.cjs");function s(n={}){const r={selectedConfiguration:{},configurations:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],hideEditorTabs:[],requiresSlug:!1,...n},e=o.createStore(r);function t(){e.set("selectedConfiguration",{...n.selectedConfiguration})}return e.onChange("action",async i=>{i||t()}),{...e,resetSelectedConfiguration:t}}exports.CreateNylasSchedulerConfigStore=s;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { a as i } from "./index-995dd3b3.js";
|
|
2
|
+
function s(n = {}) {
|
|
3
|
+
const o = {
|
|
4
|
+
selectedConfiguration: {},
|
|
5
|
+
configurations: [],
|
|
6
|
+
listConfigurationsNextCursor: null,
|
|
7
|
+
calendars: [],
|
|
8
|
+
currentUser: null,
|
|
9
|
+
action: null,
|
|
10
|
+
additionalParticipants: [],
|
|
11
|
+
hideEditorTabs: [],
|
|
12
|
+
requiresSlug: !1,
|
|
13
|
+
...n
|
|
14
|
+
}, e = i(o);
|
|
15
|
+
function t() {
|
|
16
|
+
e.set("selectedConfiguration", { ...n.selectedConfiguration });
|
|
17
|
+
}
|
|
18
|
+
return e.onChange("action", async (r) => {
|
|
19
|
+
r || t();
|
|
20
|
+
}), {
|
|
21
|
+
...e,
|
|
22
|
+
resetSelectedConfiguration: t
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
s as C
|
|
27
|
+
};
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { d as b, a as $, i as d, j as R } from "./index-995dd3b3.js";
|
|
2
|
+
var w;
|
|
3
|
+
(function(a) {
|
|
4
|
+
a.Component = "component", a.Api = "api", a.Auth = "auth";
|
|
5
|
+
})(w || (w = {}));
|
|
6
|
+
var D;
|
|
7
|
+
(function(a) {
|
|
8
|
+
a.endtime_not_in_future = "endtime_not_in_future", a.no_booking_info = "no_booking_info", a.no_timeslot_selected = "no_timeslot_selected", a.no_timezone_selected = "no_timezone_selected", a.no_booking_id = "no_booking_id", a.no_salt = "no_salt", a.invalid_start_time = "invalid_start_time", a.invalid_end_time = "invalid_end_time", a.invalid_timezone = "invalid_timezone";
|
|
9
|
+
})(D || (D = {}));
|
|
10
|
+
var A;
|
|
11
|
+
(function(a) {
|
|
12
|
+
a.invalid_session = "invalid_session", a.general_error = "general_error", a.internal_error = "internal_error", a.invalid_request_error = "invalid_request_error", a.timeslot_not_available = "timeslot_not_available", a.provider_error = "provider_error", a.not_found_error = "not_found_error";
|
|
13
|
+
})(A || (A = {}));
|
|
14
|
+
class C {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.component = (e) => {
|
|
17
|
+
const t = w.Component, s = `${e} Error`;
|
|
18
|
+
return {
|
|
19
|
+
endtime_not_in_future: (i = '"endtime" can not be in the future') => ({
|
|
20
|
+
title: s,
|
|
21
|
+
message: i,
|
|
22
|
+
category: t
|
|
23
|
+
}),
|
|
24
|
+
no_booking_info: (i = "No booking info provided") => ({
|
|
25
|
+
title: s,
|
|
26
|
+
message: i,
|
|
27
|
+
category: t
|
|
28
|
+
}),
|
|
29
|
+
no_timeslot_selected: (i = "No timeslot selected") => ({
|
|
30
|
+
title: s,
|
|
31
|
+
message: i,
|
|
32
|
+
category: t
|
|
33
|
+
}),
|
|
34
|
+
no_timezone_selected: (i = "No timezone selected") => ({
|
|
35
|
+
title: s,
|
|
36
|
+
message: i,
|
|
37
|
+
category: t
|
|
38
|
+
}),
|
|
39
|
+
no_booking_id: (i = "No booking id provided") => ({
|
|
40
|
+
title: s,
|
|
41
|
+
message: i,
|
|
42
|
+
category: t
|
|
43
|
+
}),
|
|
44
|
+
no_salt: (i = "No salt provided") => ({
|
|
45
|
+
title: s,
|
|
46
|
+
message: i,
|
|
47
|
+
category: t
|
|
48
|
+
}),
|
|
49
|
+
invalid_start_time: (i = "Invalid start time") => ({
|
|
50
|
+
title: s,
|
|
51
|
+
message: i,
|
|
52
|
+
category: t
|
|
53
|
+
}),
|
|
54
|
+
invalid_end_time: (i = "Invalid end time") => ({
|
|
55
|
+
title: s,
|
|
56
|
+
message: i,
|
|
57
|
+
category: t
|
|
58
|
+
}),
|
|
59
|
+
invalid_timezone: (i = "Invalid timezone") => ({
|
|
60
|
+
title: s,
|
|
61
|
+
message: i,
|
|
62
|
+
category: t
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
}, this.api = (e) => {
|
|
66
|
+
const t = w.Api, s = `${e} Error`;
|
|
67
|
+
return {
|
|
68
|
+
invalid_session: (i) => ({
|
|
69
|
+
title: s,
|
|
70
|
+
message: i,
|
|
71
|
+
category: t
|
|
72
|
+
}),
|
|
73
|
+
general_error: (i) => ({
|
|
74
|
+
title: s,
|
|
75
|
+
message: i,
|
|
76
|
+
category: t
|
|
77
|
+
}),
|
|
78
|
+
internal_error: (i) => ({
|
|
79
|
+
title: s,
|
|
80
|
+
message: i,
|
|
81
|
+
category: t
|
|
82
|
+
}),
|
|
83
|
+
invalid_request_error: (i) => ({
|
|
84
|
+
title: s,
|
|
85
|
+
message: i,
|
|
86
|
+
category: t
|
|
87
|
+
}),
|
|
88
|
+
timeslot_not_available: (i) => ({
|
|
89
|
+
title: s,
|
|
90
|
+
message: i,
|
|
91
|
+
category: t
|
|
92
|
+
}),
|
|
93
|
+
provider_error: (i) => ({
|
|
94
|
+
title: s,
|
|
95
|
+
message: i,
|
|
96
|
+
category: t
|
|
97
|
+
}),
|
|
98
|
+
not_found_error: (i) => ({
|
|
99
|
+
title: s,
|
|
100
|
+
message: i,
|
|
101
|
+
category: t
|
|
102
|
+
})
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class U {
|
|
108
|
+
constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug: n, clientId: r }) {
|
|
109
|
+
this.errors = new C(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug = n, this.clientId = r;
|
|
110
|
+
}
|
|
111
|
+
getHeaders() {
|
|
112
|
+
return this.sessionId ? {
|
|
113
|
+
Authorization: `Bearer ${this.sessionId}`
|
|
114
|
+
} : {};
|
|
115
|
+
}
|
|
116
|
+
async makeAPIRequest(e, t, s, i = {}) {
|
|
117
|
+
try {
|
|
118
|
+
const n = new URL(this.schedulerAPIURL);
|
|
119
|
+
return n.pathname = e, await (await fetch(decodeURIComponent(n.toString()), {
|
|
120
|
+
method: t,
|
|
121
|
+
headers: {
|
|
122
|
+
"Content-Type": "application/json",
|
|
123
|
+
Origin: window.location.origin,
|
|
124
|
+
...i
|
|
125
|
+
},
|
|
126
|
+
body: s
|
|
127
|
+
})).json();
|
|
128
|
+
} catch (n) {
|
|
129
|
+
return {
|
|
130
|
+
error: {
|
|
131
|
+
message: n.message,
|
|
132
|
+
title: "API request failed",
|
|
133
|
+
type: "api"
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
getErrorMessage(e) {
|
|
139
|
+
var s, i, n, r;
|
|
140
|
+
let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
|
|
141
|
+
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) || ((r = (n = e == null ? void 0 : e.provider_error) == null ? void 0 : n.error) == null ? void 0 : r.title) || "Something went wrong"), t;
|
|
142
|
+
}
|
|
143
|
+
setConfigId(e) {
|
|
144
|
+
this.configId = e;
|
|
145
|
+
}
|
|
146
|
+
selectDate(e) {
|
|
147
|
+
this.schedulerStore.set("selectedDate", e), this.schedulerStore.set("selectedTimeslot", null);
|
|
148
|
+
}
|
|
149
|
+
selectTime(e) {
|
|
150
|
+
this.schedulerStore.set("selectedTimeslot", e);
|
|
151
|
+
}
|
|
152
|
+
selectTimezone(e) {
|
|
153
|
+
this.schedulerStore.set("selectedTimezone", e);
|
|
154
|
+
}
|
|
155
|
+
selectLanguage(e) {
|
|
156
|
+
this.schedulerStore.set("selectedLanguage", e), d.changeLanguage(e);
|
|
157
|
+
}
|
|
158
|
+
async toggleAdditionalData(e) {
|
|
159
|
+
e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
|
|
160
|
+
}
|
|
161
|
+
setParticipantName(e) {
|
|
162
|
+
const { bookingInfo: t } = this.schedulerStore.state;
|
|
163
|
+
this.schedulerStore.set("bookingInfo", {
|
|
164
|
+
...t,
|
|
165
|
+
primaryParticipant: {
|
|
166
|
+
...t == null ? void 0 : t.primaryParticipant,
|
|
167
|
+
name: e
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
setParticipantEmail(e) {
|
|
172
|
+
const { bookingInfo: t } = this.schedulerStore.state;
|
|
173
|
+
this.schedulerStore.set("bookingInfo", {
|
|
174
|
+
...t,
|
|
175
|
+
primaryParticipant: {
|
|
176
|
+
...t == null ? void 0 : t.primaryParticipant,
|
|
177
|
+
email: e
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
async refetchAvailability() {
|
|
182
|
+
const e = /* @__PURE__ */ 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;
|
|
183
|
+
return await this.getAvailability(s, i);
|
|
184
|
+
}
|
|
185
|
+
async resetStoreStateAndFetchAvailability() {
|
|
186
|
+
const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((n) => new Date(n.start_time) > /* @__PURE__ */ new Date());
|
|
187
|
+
let i = e;
|
|
188
|
+
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;
|
|
189
|
+
}
|
|
190
|
+
async setReschedule(e) {
|
|
191
|
+
this.schedulerStore.set("isLoading", !0);
|
|
192
|
+
const t = this.schedulerStore.state.eventInfo;
|
|
193
|
+
return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.resetStoreStateAndFetchAvailability().finally(() => {
|
|
194
|
+
this.schedulerStore.set("isLoading", !1);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
async setCancel(e) {
|
|
198
|
+
this.schedulerStore.set("cancelBookingId", e);
|
|
199
|
+
}
|
|
200
|
+
async setReject(e) {
|
|
201
|
+
this.schedulerStore.set("rejectBookingId", e);
|
|
202
|
+
}
|
|
203
|
+
async resetCancel() {
|
|
204
|
+
const e = await this.resetStoreStateAndFetchAvailability();
|
|
205
|
+
return this.schedulerStore.set("cancelBookingId", ""), this.schedulerStore.set("rejectBookingId", ""), this.schedulerStore.set("cancelledEventInfo", null), e;
|
|
206
|
+
}
|
|
207
|
+
async goBack() {
|
|
208
|
+
this.schedulerStore.set("cancelBookingId", "");
|
|
209
|
+
}
|
|
210
|
+
async resetConfirm() {
|
|
211
|
+
const e = await this.resetStoreStateAndFetchAvailability();
|
|
212
|
+
return this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("confirmedEventInfo", void 0), e;
|
|
213
|
+
}
|
|
214
|
+
async bookTimeslot(e) {
|
|
215
|
+
var v;
|
|
216
|
+
this.schedulerStore.set("isLoading", !0);
|
|
217
|
+
const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: n } = this.schedulerStore.state;
|
|
218
|
+
if (!e && !i)
|
|
219
|
+
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
|
|
220
|
+
const r = (e == null ? void 0 : e.timeslot) || t;
|
|
221
|
+
if (!r)
|
|
222
|
+
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
|
|
223
|
+
const o = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s;
|
|
224
|
+
if (!o)
|
|
225
|
+
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
|
|
226
|
+
const u = this.schedulerStore.get("availabilityOrderEmails");
|
|
227
|
+
let m = "";
|
|
228
|
+
if (u.length > 0) {
|
|
229
|
+
const S = (r == null ? void 0 : r.emails) || [];
|
|
230
|
+
for (let h = 0; h < u.length; h++)
|
|
231
|
+
if (S.includes(u[h])) {
|
|
232
|
+
m = u[h];
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const c = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, g = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.guests) || [], f = e ? e == null ? void 0 : e.additionalFields : i == null ? void 0 : i.additionalFields, _ = this.getHeaders(), I = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, l = await this.makeAPIRequest(decodeURIComponent(I), "POST", JSON.stringify({
|
|
237
|
+
participants: m ? [{ email: m }] : void 0,
|
|
238
|
+
additional_fields: f,
|
|
239
|
+
additional_guests: g,
|
|
240
|
+
guest: { ...c },
|
|
241
|
+
start_time: r.start_time.getTime() / 1e3,
|
|
242
|
+
end_time: r.end_time.getTime() / 1e3,
|
|
243
|
+
timezone: o,
|
|
244
|
+
email_language: this.getTwoLetterLanguageCode(n)
|
|
245
|
+
}), _);
|
|
246
|
+
if ("error" in l) {
|
|
247
|
+
this.schedulerStore.set("isLoading", !1);
|
|
248
|
+
const S = (v = l.error) == null ? void 0 : v.type;
|
|
249
|
+
let h = l.error;
|
|
250
|
+
if (S && S in this.errors.api("Create Booking")) {
|
|
251
|
+
const L = this.getErrorMessage(h);
|
|
252
|
+
h = this.errors.api("Create Booking")[S](L);
|
|
253
|
+
}
|
|
254
|
+
return { error: h };
|
|
255
|
+
}
|
|
256
|
+
return "data" in l && this.schedulerStore.set("eventInfo", l == null ? void 0 : l.data), this.schedulerStore.set("isLoading", !1), l;
|
|
257
|
+
}
|
|
258
|
+
async getUISettings() {
|
|
259
|
+
var n;
|
|
260
|
+
this.schedulerStore.set("isLoading", !0);
|
|
261
|
+
const e = this.getHeaders(), s = `/v3/scheduling/ui-settings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, i = await this.makeAPIRequest(s, "GET", void 0, e);
|
|
262
|
+
if ("error" in i) {
|
|
263
|
+
this.schedulerStore.set("isLoading", !1);
|
|
264
|
+
const r = (n = i.error) == null ? void 0 : n.type;
|
|
265
|
+
let o = i.error;
|
|
266
|
+
return r && r in this.errors.api(d.t("getUISettingErrorTitle")) && (o = this.errors.api(d.t("getUISettingErrorTitle"))[r]((o == null ? void 0 : o.message) || (o == null ? void 0 : o.title) || "Something went wrong")), { error: o };
|
|
267
|
+
}
|
|
268
|
+
return "data" in i && this.schedulerStore.set("configSettings", i.data), this.schedulerStore.set("isLoading", !1), i;
|
|
269
|
+
}
|
|
270
|
+
getTwoLetterLanguageCode(e) {
|
|
271
|
+
return e.split("-")[0];
|
|
272
|
+
}
|
|
273
|
+
getStartTimeWithMinBookingNotice(e) {
|
|
274
|
+
var n;
|
|
275
|
+
const t = (n = this.schedulerStore.get("configSettings")) == null ? void 0 : n.scheduler, s = t == null ? void 0 : t.min_booking_notice;
|
|
276
|
+
if (!s)
|
|
277
|
+
return e;
|
|
278
|
+
const i = (/* @__PURE__ */ new Date()).getTime();
|
|
279
|
+
return e < (i + s * 60 * 1e3) / 1e3 ? Math.floor((i + s * 60 * 1e3) / 1e3) : e;
|
|
280
|
+
}
|
|
281
|
+
getEndTimeForAvailableDaysInFuture(e) {
|
|
282
|
+
var r, o;
|
|
283
|
+
const t = /* @__PURE__ */ new Date(), s = (o = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler) == null ? void 0 : o.available_days_in_future, i = Math.floor(R(t, s).getTime() / 1e3);
|
|
284
|
+
return Math.min(i, e);
|
|
285
|
+
}
|
|
286
|
+
async getAvailability(e = 0, t = 0) {
|
|
287
|
+
var f, _, p, I;
|
|
288
|
+
this.schedulerStore.set("isLoading", !0);
|
|
289
|
+
const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), n = i.getTime();
|
|
290
|
+
if (t && t < n / 1e3)
|
|
291
|
+
return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
|
|
292
|
+
if (!e) {
|
|
293
|
+
const l = new Date(i.getFullYear(), i.getMonth(), 1);
|
|
294
|
+
e = Math.floor(l.getTime() / 1e3);
|
|
295
|
+
}
|
|
296
|
+
if (!t) {
|
|
297
|
+
const l = new Date(i.getFullYear(), i.getMonth() + 1, 0);
|
|
298
|
+
t = Math.floor(l.getTime() / 1e3);
|
|
299
|
+
}
|
|
300
|
+
t = this.getEndTimeForAvailableDaysInFuture(t);
|
|
301
|
+
const r = this.getStartTimeWithMinBookingNotice(e);
|
|
302
|
+
e = r, t = r > t ? r + 1 : 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)) : this.slug && this.clientId && !this.sessionId && (s.append("slug", encodeURIComponent(this.slug)), s.append("client_id", encodeURIComponent(this.clientId)));
|
|
303
|
+
const o = this.schedulerStore.get("rescheduleBookingId");
|
|
304
|
+
o && s.append("booking_id", encodeURIComponent(o));
|
|
305
|
+
const u = s.toString(), m = `/v3/scheduling/availability${u ? `?${u}` : ""}`, c = this.getHeaders(), g = await this.makeAPIRequest(decodeURIComponent(m), "GET", void 0, c);
|
|
306
|
+
if ("error" in g) {
|
|
307
|
+
this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
|
|
308
|
+
const l = (f = g.error) == null ? void 0 : f.type;
|
|
309
|
+
let v = g.error;
|
|
310
|
+
if (l && l in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
|
|
311
|
+
const S = this.getErrorMessage(v);
|
|
312
|
+
v = this.errors.api(d.t("getAvailabilityErrorTitle"))[l](S);
|
|
313
|
+
}
|
|
314
|
+
return { error: v };
|
|
315
|
+
}
|
|
316
|
+
if ("data" in g) {
|
|
317
|
+
const v = (((p = (_ = g.data) == null ? void 0 : _.time_slots) == null ? void 0 : p.map((h) => ({
|
|
318
|
+
...h,
|
|
319
|
+
start_time: new Date(h.start_time * 1e3),
|
|
320
|
+
end_time: new Date(h.end_time * 1e3)
|
|
321
|
+
}))) || []).filter((h) => h.start_time.getTime() > n);
|
|
322
|
+
this.schedulerStore.set("availability", v);
|
|
323
|
+
const S = ((I = g.data) == null ? void 0 : I.order) || [];
|
|
324
|
+
this.schedulerStore.set("availabilityOrderEmails", S);
|
|
325
|
+
}
|
|
326
|
+
return this.schedulerStore.set("isLoading", !1), g;
|
|
327
|
+
}
|
|
328
|
+
async cancelBooking(e, t) {
|
|
329
|
+
var o;
|
|
330
|
+
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
331
|
+
return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
|
|
332
|
+
const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", i = `/v3/scheduling/bookings/${e}${s}`, n = this.getHeaders(), r = await this.makeAPIRequest(decodeURIComponent(i), "DELETE", JSON.stringify({
|
|
333
|
+
action: "cancel",
|
|
334
|
+
cancellation_reason: t
|
|
335
|
+
}), n);
|
|
336
|
+
if ("error" in r) {
|
|
337
|
+
this.schedulerStore.set("isLoading", !1);
|
|
338
|
+
const u = (o = r.error) == null ? void 0 : o.type;
|
|
339
|
+
let m = r.error;
|
|
340
|
+
if (u && u in this.errors.api(d.t("cancelBookingErrorTitle"))) {
|
|
341
|
+
const c = this.getErrorMessage(m);
|
|
342
|
+
m = this.errors.api(d.t("cancelBookingErrorTitle"))[u](c);
|
|
343
|
+
}
|
|
344
|
+
return { error: m };
|
|
345
|
+
}
|
|
346
|
+
return this.schedulerStore.set("cancelledEventInfo", {
|
|
347
|
+
booking_id: e
|
|
348
|
+
}), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), r;
|
|
349
|
+
}
|
|
350
|
+
async rescheduleBooking(e, t) {
|
|
351
|
+
var E;
|
|
352
|
+
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
353
|
+
return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
|
|
354
|
+
const s = this.errors.api(d.t("rescheduleBookingErrorTitle")), i = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo: n, selectedTimeslot: r, selectedTimezone: o, selectedLanguage: u } = this.schedulerStore.state, { startTime: m, endTime: c, timezone: g } = t, f = m || (r == null ? void 0 : r.start_time);
|
|
355
|
+
if (!f)
|
|
356
|
+
return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
357
|
+
const _ = c || (r == null ? void 0 : r.end_time);
|
|
358
|
+
if (!_)
|
|
359
|
+
return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
360
|
+
const p = this.schedulerStore.get("availabilityOrderEmails");
|
|
361
|
+
let I = "";
|
|
362
|
+
if (p.length > 0) {
|
|
363
|
+
const T = (r == null ? void 0 : r.emails) || [];
|
|
364
|
+
for (let k = 0; k < p.length; k++)
|
|
365
|
+
if (T.includes(p[k])) {
|
|
366
|
+
I = p[k];
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const l = g || o;
|
|
371
|
+
if (!l)
|
|
372
|
+
return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
|
|
373
|
+
const v = t ? t == null ? void 0 : t.primaryParticipant : n == null ? void 0 : n.primaryParticipant, S = t ? (t == null ? void 0 : t.guests) || [] : (n == null ? void 0 : n.guests) || [], h = t ? t == null ? void 0 : t.additionalFields : n == null ? void 0 : n.additionalFields, L = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", M = `/v3/scheduling/bookings/${e}${L}`, P = this.getHeaders(), y = await this.makeAPIRequest(decodeURIComponent(M), "PATCH", JSON.stringify({
|
|
374
|
+
start_time: f.getTime() / 1e3,
|
|
375
|
+
end_time: _.getTime() / 1e3,
|
|
376
|
+
timezone: l,
|
|
377
|
+
additional_fields: h,
|
|
378
|
+
guest: { ...v },
|
|
379
|
+
additional_guests: S,
|
|
380
|
+
participants: I ? [{ email: I }] : void 0,
|
|
381
|
+
email_language: this.getTwoLetterLanguageCode(u)
|
|
382
|
+
}), P);
|
|
383
|
+
if ("error" in y) {
|
|
384
|
+
this.schedulerStore.set("isLoading", !1);
|
|
385
|
+
const T = (E = y.error) == null ? void 0 : E.type;
|
|
386
|
+
let k = y.error;
|
|
387
|
+
if (T && T in s) {
|
|
388
|
+
const z = this.getErrorMessage(k);
|
|
389
|
+
k = s[T](z);
|
|
390
|
+
}
|
|
391
|
+
return { error: k };
|
|
392
|
+
}
|
|
393
|
+
const B = this.schedulerStore.get("reschedulingEventInfo");
|
|
394
|
+
if ("data" in y)
|
|
395
|
+
this.schedulerStore.set("eventInfo", y == null ? void 0 : y.data);
|
|
396
|
+
else if (B)
|
|
397
|
+
this.schedulerStore.set("eventInfo", B);
|
|
398
|
+
else {
|
|
399
|
+
const T = {
|
|
400
|
+
booking_id: e
|
|
401
|
+
};
|
|
402
|
+
this.schedulerStore.set("eventInfo", T);
|
|
403
|
+
}
|
|
404
|
+
return this.schedulerStore.set("isLoading", !1), y;
|
|
405
|
+
}
|
|
406
|
+
async updateBooking(e) {
|
|
407
|
+
var g;
|
|
408
|
+
this.schedulerStore.set("isLoading", !0);
|
|
409
|
+
const { bookingId: t, status: s, reason: i } = e, n = this.schedulerStore.get("organizerConfirmationSalt"), r = s === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
|
|
410
|
+
if (!t)
|
|
411
|
+
return { error: this.errors.component(r).no_booking_id() };
|
|
412
|
+
if (!n)
|
|
413
|
+
return { error: this.errors.component(r).no_salt() };
|
|
414
|
+
const o = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", u = `/v3/scheduling/bookings/${t}${o}`, m = this.getHeaders(), c = await this.makeAPIRequest(decodeURIComponent(u), "PUT", JSON.stringify({
|
|
415
|
+
status: s,
|
|
416
|
+
cancellation_reason: i,
|
|
417
|
+
salt: n
|
|
418
|
+
}), m);
|
|
419
|
+
if ("error" in c) {
|
|
420
|
+
this.schedulerStore.set("isLoading", !1);
|
|
421
|
+
const f = (g = c.error) == null ? void 0 : g.type;
|
|
422
|
+
let _ = c.error;
|
|
423
|
+
if (f && f in this.errors.api(r)) {
|
|
424
|
+
const p = this.getErrorMessage(_);
|
|
425
|
+
_ = this.errors.api(r)[f](p);
|
|
426
|
+
}
|
|
427
|
+
return { error: _ };
|
|
428
|
+
}
|
|
429
|
+
return "data" in c && s === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", c == null ? void 0 : c.data) : "request_id" in c && s === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
|
|
430
|
+
booking_id: t
|
|
431
|
+
}), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), c;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
function N(a = {}) {
|
|
435
|
+
const e = {
|
|
436
|
+
selectedDate: null,
|
|
437
|
+
selectedLanguage: navigator.language,
|
|
438
|
+
selectedTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
439
|
+
selectedTimeslot: null,
|
|
440
|
+
showBookingForm: !1,
|
|
441
|
+
availabilityOrderEmails: [],
|
|
442
|
+
selectableDates: null,
|
|
443
|
+
availability: [],
|
|
444
|
+
eventDuration: 0,
|
|
445
|
+
state: "ready",
|
|
446
|
+
eventInfo: null,
|
|
447
|
+
cancelledEventInfo: null,
|
|
448
|
+
isLoading: !1,
|
|
449
|
+
nylasBranding: !0,
|
|
450
|
+
...a
|
|
451
|
+
};
|
|
452
|
+
b("[defaultNylasStoreState]: ", e);
|
|
453
|
+
const t = $(e);
|
|
454
|
+
return t.onChange("availability", (s) => {
|
|
455
|
+
b("[availability]: ", s);
|
|
456
|
+
const i = s.map((o) => o.start_time);
|
|
457
|
+
b("[selectableDates]: ", i), t.set("selectableDates", i);
|
|
458
|
+
const n = s[0];
|
|
459
|
+
if (!n)
|
|
460
|
+
return;
|
|
461
|
+
const r = Math.floor((n.end_time.getTime() - n.start_time.getTime()) / 6e4);
|
|
462
|
+
b("[durationMinutes]: ", r), t.set("eventDuration", r);
|
|
463
|
+
}), t.reset = () => {
|
|
464
|
+
for (const s in e) {
|
|
465
|
+
const i = e[s];
|
|
466
|
+
t.set(s, i);
|
|
467
|
+
}
|
|
468
|
+
}, t;
|
|
469
|
+
}
|
|
470
|
+
export {
|
|
471
|
+
N as C,
|
|
472
|
+
w as E,
|
|
473
|
+
U as N
|
|
474
|
+
};
|