@nylas/react 1.0.1-prealpha1 → 1.0.2-canary.1

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.
Files changed (129) hide show
  1. package/dist/add-circle-icon_18.entry-b66b6343.cjs +1 -0
  2. package/dist/add-circle-icon_18.entry-f86ae88d.js +1527 -0
  3. package/dist/{archive-icon_7.entry-baecb43c.cjs → archive-icon_7.entry-052ac074.cjs} +1 -1
  4. package/dist/{archive-icon_7.entry-9f3eca2c.js → archive-icon_7.entry-0e34d6e7.js} +15 -15
  5. package/dist/{arrow-icon.entry-a3b36218.js → arrow-icon.entry-2afd9ea9.js} +2 -2
  6. package/dist/{arrow-icon.entry-9ab0c414.cjs → arrow-icon.entry-93f21385.cjs} +1 -1
  7. package/dist/auth-store-69ac49c7-5a0bbb90.cjs +1 -0
  8. package/dist/auth-store-69ac49c7-cbfda055.js +66 -0
  9. package/dist/{bold-icon_3.entry-b0d81839.js → bold-icon_3.entry-88ce1d25.js} +8 -8
  10. package/dist/bold-icon_3.entry-8f55a9e7.cjs +1 -0
  11. package/dist/{calendar-cancel-icon.entry-8f498984.cjs → calendar-cancel-icon.entry-574c8aa4.cjs} +1 -1
  12. package/dist/{calendar-cancel-icon.entry-0d07e33c.js → calendar-cancel-icon.entry-e9c692fa.js} +5 -5
  13. package/dist/calendar-check-icon_2.entry-b0476bca.cjs +1 -0
  14. package/dist/calendar-check-icon_2.entry-d461c713.js +25 -0
  15. package/dist/{calendar-icon.entry-e5f20598.js → calendar-icon.entry-1ca202a4.js} +5 -5
  16. package/dist/{calendar-icon.entry-219efd7a.cjs → calendar-icon.entry-98936e6d.cjs} +1 -1
  17. package/dist/chevron-icon_3.entry-830f52c2.js +105 -0
  18. package/dist/chevron-icon_3.entry-f7801467.cjs +1 -0
  19. package/dist/close-icon.entry-37e8361f.js +15 -0
  20. package/dist/close-icon.entry-8d6e9816.cjs +1 -0
  21. package/dist/{nylas-booked-event-card_10.entry-27efa654.cjs → constants-b6bf6671-27e2557d.cjs} +6 -6
  22. package/dist/{nylas-booked-event-card_10.entry-f2481a57.js → constants-b6bf6671-49a0f1f2.js} +1656 -2374
  23. package/dist/{document-refresh-icon.entry-89ad42fa.js → document-refresh-icon.entry-faea08ce.js} +5 -5
  24. package/dist/document-refresh-icon.entry-fcb33921.cjs +1 -0
  25. package/dist/elements/index.d.ts +24 -2
  26. package/dist/{forward-icon_6.entry-0a6dff18.js → forward-icon_6.entry-8da1f65d.js} +82 -82
  27. package/dist/{forward-icon_6.entry-ce725f05.cjs → forward-icon_6.entry-c4b37cb1.cjs} +3 -3
  28. package/dist/{globe-icon.entry-71414bc6.js → globe-icon.entry-4720304b.js} +4 -4
  29. package/dist/{globe-icon.entry-a0c9599a.cjs → globe-icon.entry-90a0b9c9.cjs} +1 -1
  30. package/dist/{index-b30d446a-e0eaccad.js → index-10914bc1-346f04fa.js} +3 -3
  31. package/dist/{index-b30d446a-3d69a3cc.cjs → index-10914bc1-c8c3a2f3.cjs} +1 -1
  32. package/dist/index-457dcf0b.cjs +30 -0
  33. package/dist/index-ce40ad47.js +1570 -0
  34. package/dist/index.d.ts +1 -1
  35. package/dist/info-icon_2.entry-81e95048.cjs +1 -0
  36. package/dist/info-icon_2.entry-9307db18.js +34 -0
  37. package/dist/loading-icon.entry-06d37ef0.cjs +1 -0
  38. package/dist/loading-icon.entry-dc518df4.js +15 -0
  39. package/dist/mailbox-store-e721b17c-4e97e07d.cjs +1 -0
  40. package/dist/{mailbox-store-19f0c6c9-23a4e72f.js → mailbox-store-e721b17c-cf9a43dd.js} +59 -121
  41. package/dist/nylas-additional-participants.entry-1653dec7.js +83 -0
  42. package/dist/nylas-additional-participants.entry-ff8bf378.cjs +1 -0
  43. package/dist/nylas-booked-event-card_10.entry-06bc3c51.cjs +1 -0
  44. package/dist/nylas-booked-event-card_10.entry-aa971e8a.js +784 -0
  45. package/dist/nylas-editor-tabs.entry-49b5a3ab.cjs +1 -0
  46. package/dist/nylas-editor-tabs.entry-9d0959bf.js +181 -0
  47. package/dist/nylas-form-card.entry-69d2095b.cjs +1 -0
  48. package/dist/nylas-form-card.entry-c4e78f88.js +56 -0
  49. package/dist/{nylas-if-state_3.entry-d805d4c6.js → nylas-if-state_3.entry-2eb3f385.js} +12 -10
  50. package/dist/nylas-if-state_3.entry-5baf6d6f.cjs +1 -0
  51. package/dist/nylas-list-folders.entry-3b24d92d.cjs +1 -0
  52. package/dist/{nylas-list-folders.entry-472bd255.js → nylas-list-folders.entry-995fa819.js} +9 -8
  53. package/dist/{nylas-list-threads.entry-f3266bf7.js → nylas-list-threads.entry-21466eb3.js} +7 -6
  54. package/dist/nylas-list-threads.entry-fda42ded.cjs +1 -0
  55. package/dist/{nylas-mailbox-pagination.entry-bd0d3bda.js → nylas-mailbox-pagination.entry-02d40186.js} +4 -3
  56. package/dist/nylas-mailbox-pagination.entry-9dcd4901.cjs +1 -0
  57. package/dist/nylas-mailbox-toolbar-button.entry-d1099fab.cjs +1 -0
  58. package/dist/{nylas-mailbox-toolbar-button.entry-9641b5cd.js → nylas-mailbox-toolbar-button.entry-dbad44b4.js} +10 -9
  59. package/dist/nylas-provider.entry-78e2fa30.cjs +1 -0
  60. package/dist/nylas-provider.entry-bbee8c99.js +155 -0
  61. package/dist/nylas-scheduler-editor.entry-550d3c59.cjs +1 -0
  62. package/dist/nylas-scheduler-editor.entry-8f7ecf3b.js +111 -0
  63. package/dist/nylas-scheduling.entry-22b5ad07.js +236 -0
  64. package/dist/nylas-scheduling.entry-30a63738.cjs +1 -0
  65. package/dist/nylas-threads-refresh.entry-05258b36.cjs +1 -0
  66. package/dist/{nylas-threads-refresh.entry-7d567ed1.js → nylas-threads-refresh.entry-414d8740.js} +6 -5
  67. package/dist/{nylas-threads-search.entry-c881d54b.js → nylas-threads-search.entry-a19dc90f.js} +14 -13
  68. package/dist/nylas-threads-search.entry-ff21fc65.cjs +1 -0
  69. package/dist/{nylas-view-thread.entry-d8de6c83.js → nylas-view-thread.entry-38149162.js} +5 -4
  70. package/dist/nylas-view-thread.entry-5da81e99.cjs +1 -0
  71. package/dist/people-icon.entry-4b682757.cjs +1 -0
  72. package/dist/people-icon.entry-5c244c8d.js +15 -0
  73. package/dist/play-icon_2.entry-ccdc6b9c.cjs +1 -0
  74. package/dist/play-icon_2.entry-f36d6d55.js +25 -0
  75. package/dist/react.cjs +1 -1
  76. package/dist/react.js +79 -57
  77. package/dist/{refresh-icon.entry-3e0aef26.cjs → refresh-icon.entry-59fff3d4.cjs} +1 -1
  78. package/dist/{refresh-icon.entry-9563850b.js → refresh-icon.entry-63456c9a.js} +2 -2
  79. package/dist/{register-component-152c6ad2-b0d34c36.cjs → register-component-d056a880-2be11c56.cjs} +1 -1
  80. package/dist/{register-component-152c6ad2-418db864.js → register-component-d056a880-f3003d6c.js} +2 -2
  81. package/dist/scheduler-config-store-4d035001-0256b40c.cjs +1 -0
  82. package/dist/scheduler-config-store-4d035001-db9dc78a.js +33 -0
  83. package/dist/{scheduler-store-7d48e682-39104219.js → scheduler-store-0fbe642c-14466305.js} +99 -95
  84. package/dist/scheduler-store-0fbe642c-410fdbf4.cjs +1 -0
  85. package/dist/translate-icon.entry-1784c18e.cjs +1 -0
  86. package/dist/translate-icon.entry-35999e70.js +15 -0
  87. package/dist/utils-0cd66d04-89ab163d.js +2111 -0
  88. package/dist/utils-0cd66d04-94b9c3b6.cjs +8 -0
  89. package/dist/warning-icon.entry-3a702d1d.cjs +1 -0
  90. package/dist/warning-icon.entry-73de08c3.js +15 -0
  91. package/package.json +7 -4
  92. package/dist/add-circle-icon.entry-4b8debfa.js +0 -15
  93. package/dist/add-circle-icon.entry-c5fdaa6f.cjs +0 -1
  94. package/dist/bold-icon_3.entry-50406bc7.cjs +0 -1
  95. package/dist/calendar-check-icon_3.entry-5415e916.cjs +0 -1
  96. package/dist/calendar-check-icon_3.entry-cfb612c6.js +0 -35
  97. package/dist/chevron-icon.entry-3c709061.cjs +0 -1
  98. package/dist/chevron-icon.entry-f5d5d1b1.js +0 -15
  99. package/dist/close-icon_2.entry-eca351c4.js +0 -25
  100. package/dist/close-icon_2.entry-fa4f6d3e.cjs +0 -1
  101. package/dist/document-refresh-icon.entry-3a29a6e6.cjs +0 -1
  102. package/dist/duration-bddc4a13-05d3e3e2.cjs +0 -1
  103. package/dist/duration-bddc4a13-179ce826.js +0 -41
  104. package/dist/index-586a4206.cjs +0 -30
  105. package/dist/index-98d3a4da.js +0 -1498
  106. package/dist/loading-icon.entry-15debb7d.js +0 -15
  107. package/dist/loading-icon.entry-d2680046.cjs +0 -1
  108. package/dist/mailbox-store-19f0c6c9-9a3ef58a.cjs +0 -1
  109. package/dist/nylas-if-state_3.entry-6c0bf8eb.cjs +0 -1
  110. package/dist/nylas-list-folders.entry-cc04a07e.cjs +0 -1
  111. package/dist/nylas-list-threads.entry-795c5a2b.cjs +0 -1
  112. package/dist/nylas-mailbox-pagination.entry-f701fd83.cjs +0 -1
  113. package/dist/nylas-mailbox-toolbar-button.entry-b9d6a3c8.cjs +0 -1
  114. package/dist/nylas-open-hours-picker.entry-42942946.js +0 -186
  115. package/dist/nylas-open-hours-picker.entry-aa103daf.cjs +0 -1
  116. package/dist/nylas-provider.entry-5bb55b2d.cjs +0 -1
  117. package/dist/nylas-provider.entry-b94198a1.js +0 -134
  118. package/dist/nylas-scheduler.entry-3b7cb841.js +0 -230
  119. package/dist/nylas-scheduler.entry-ea6fb146.cjs +0 -1
  120. package/dist/nylas-threads-refresh.entry-4002608b.cjs +0 -1
  121. package/dist/nylas-threads-search.entry-556f1219.cjs +0 -1
  122. package/dist/nylas-view-thread.entry-6faf1b51.cjs +0 -1
  123. package/dist/play-icon_2.entry-2e21b8b9.cjs +0 -1
  124. package/dist/play-icon_2.entry-cae94826.js +0 -25
  125. package/dist/scheduler-store-7d48e682-449277d4.cjs +0 -1
  126. package/dist/search-icon_3.entry-9b027cfc.cjs +0 -1
  127. package/dist/search-icon_3.entry-e36548ec.js +0 -101
  128. package/dist/utils-5074a070-ce33ee6b.js +0 -119
  129. package/dist/utils-5074a070-d5ba6add.cjs +0 -2
@@ -1,230 +0,0 @@
1
- import { r as v, c as p, h as n, H as d, g as w, F as x } from "./index-98d3a4da.js";
2
- import { n as u, N as _ } from "./index-b30d446a-e0eaccad.js";
3
- import { d as m } from "./utils-5074a070-ce33ee6b.js";
4
- import { E as b, C as k, N as I } from "./scheduler-store-7d48e682-39104219.js";
5
- import "react";
6
- import "react-dom";
7
- class E {
8
- constructor({ schedulerAPIURL: t, nylasSchedulerStore: s, sessionId: i }) {
9
- if (!t)
10
- throw new Error("schedulerAPIURL is required");
11
- if (!s)
12
- throw new Error("nylasSchedulerStore is required");
13
- if (!i)
14
- throw new Error("sessionId is required");
15
- t === "/" && (t = new URL(window.location.href).origin), this.sessionId = i, this.schedulerAPIURL = t, this.nylasSchedulerStore = s;
16
- }
17
- init() {
18
- m("NylasConnector init");
19
- }
20
- get schedulerStore() {
21
- return this.nylasSchedulerStore;
22
- }
23
- get scheduler() {
24
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new I({
25
- schedulerAPIURL: this.schedulerAPIURL,
26
- schedulerStore: this.schedulerStore,
27
- sessionId: this.sessionId
28
- }), this._schedulerAPIConnector);
29
- }
30
- resetStores() {
31
- this.nylasSchedulerStore.reset();
32
- }
33
- }
34
- const h = (e, t) => {
35
- const s = e.isLoading, i = e.showNotification;
36
- return n(
37
- x,
38
- null,
39
- s && n(
40
- "div",
41
- { class: "loading" },
42
- n(
43
- "div",
44
- { class: "left" },
45
- n("div", { class: "skeleton" })
46
- ),
47
- n(
48
- "div",
49
- { class: "right" },
50
- n("div", { class: "skeleton" }),
51
- n("div", { class: "skeleton" }),
52
- n("div", { class: "skeleton" }),
53
- n("div", { class: "skeleton" }),
54
- n("div", { class: "skeleton" })
55
- )
56
- ),
57
- !s && t,
58
- i && n("nylas-notification", null),
59
- n(
60
- "div",
61
- { class: "footer" },
62
- "Powered by  ",
63
- n("nylas-logo", null)
64
- )
65
- );
66
- }, C = ":host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{padding:1rem 20px 0;gap:1rem;height:512px;min-width:384px;border:1px solid var(--nylas-base-200);border-top-left-radius:inherit}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset}}@media screen and (max-width: 768px){.additional-data-page .left-panel{height:325px}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0}}.border{margin-left:-1.25rem;margin-right:-1.25rem;border-top-width:1px;height:1px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:512px;padding-top:1rem;border:1px solid var(--nylas-base-200);border-top-right-radius:inherit}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset}}.right-panel h2{display:flex;margin:1.5rem 1rem 1rem;gap:0.25rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.75rem;font-weight:600;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:325px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-100)}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}", D = C, f = { title: "Something went wrong...", type: u.Error, category: b.Component }, L = class {
67
- constructor(e) {
68
- v(this, e), this.init = p(this, "init", 7), this.schedulerWillLoad = p(this, "schedulerWillLoad", 7), this.schedulerDidLoad = p(this, "schedulerDidLoad", 7), this.nylasSchedulerError = p(this, "nylasSchedulerError", 7), this.mode = "app", this.defaultSchedulerStoreState = void 0, this.sessionId = void 0, this.schedulerApiUrl = "https://elements-staging.us.nylas.com", this.bookingInfo = void 0, this.rescheduleBookingId = void 0, this.cancelBookingId = void 0, this.eventOverrides = {}, this.isLoading = void 0, this.themeConfig = void 0, this.showNotification = !0, this.automaticComponentRegistration = !0, this.selectedDateLabel = (/* @__PURE__ */ new Date()).toLocaleDateString(void 0, { dateStyle: "full" }) || "No date selected";
69
- }
70
- connectedCallback() {
71
- m("[nylas-scheduler] connectedCallback");
72
- }
73
- async componentWillLoad() {
74
- var s, i;
75
- if (m("[nylas-scheduler] Component will load"), this.schedulerWillLoad.emit(this.host).defaultPrevented || !this.checkIfSessionIdExists())
76
- return;
77
- this.stores = {
78
- scheduler: k({
79
- bookingInfo: this.bookingInfo,
80
- ...this.defaultSchedulerStoreState
81
- })
82
- }, this.baseProvider = new _(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides);
83
- const t = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
84
- if (this.nylasSchedulerConnector = new E({
85
- schedulerAPIURL: this.schedulerApiUrl,
86
- sessionId: this.sessionId,
87
- nylasSchedulerStore: t
88
- }), this.init.emit(this.host), (i = this.baseProvider) == null || i.componentWillLoad(this.nylasSchedulerConnector), this.themeConfig)
89
- for (const [a, o] of Object.entries(this.themeConfig))
90
- this.host.style.setProperty(`${a}`, o);
91
- }
92
- async componentDidLoad() {
93
- var a, o, r, c;
94
- if ((a = this.baseProvider) == null || a.componentDidLoad(), !this.checkIfSessionIdExists())
95
- return;
96
- const e = (o = this.baseProvider) == null ? void 0 : o.getStore("scheduler"), t = e == null ? void 0 : e.get("selectedTimeslot");
97
- if (t && (t != null && t.start_time)) {
98
- if (!this.isTimeslotValid(t))
99
- return;
100
- if (e != null && e.get("showBookingForm")) {
101
- e == null || e.set("selectedDate", t.start_time);
102
- return;
103
- }
104
- }
105
- const s = e == null ? void 0 : e.get("selectedDate");
106
- let i;
107
- if (!s)
108
- i = await ((r = this.nylasSchedulerConnector) == null ? void 0 : r.scheduler.getAvailability());
109
- else {
110
- const l = new Date(s.getFullYear(), s.getMonth(), 1).getTime() / 1e3, g = new Date(s.getFullYear(), s.getMonth() + 1, 1).getTime() / 1e3;
111
- i = await ((c = this.nylasSchedulerConnector) == null ? void 0 : c.scheduler.getAvailability(l, g));
112
- }
113
- if ((!i || "error" in i) && this.nylasSchedulerError.emit({ ...this.getErrorObject(i == null ? void 0 : i.error) }), !s) {
114
- let l = /* @__PURE__ */ new Date();
115
- const g = e == null ? void 0 : e.get("availability").find((y) => new Date(y.start_time) > /* @__PURE__ */ new Date());
116
- g && (l = g.start_time), e == null || e.set("selectedDate", l);
117
- }
118
- }
119
- componentDisconnected() {
120
- var e;
121
- (e = this.baseProvider) == null || e.componentDisconnected();
122
- }
123
- bookingInfoChanged(e) {
124
- var t;
125
- (t = this.stores) == null || t.scheduler.set("bookingInfo", e);
126
- }
127
- async registerComponentHandler(e) {
128
- var t;
129
- (t = this.baseProvider) == null || t.registerComponent(e.detail);
130
- }
131
- async unregisterComponentHandler(e) {
132
- var t;
133
- (t = this.baseProvider) == null || t.unregisterComponent(e.detail);
134
- }
135
- async monthChangedHandler(e) {
136
- var o;
137
- const t = e.detail, s = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, i = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, a = await ((o = this.nylasSchedulerConnector) == null ? void 0 : o.scheduler.getAvailability(s, i));
138
- (!a || "error" in a) && this.nylasSchedulerError.emit({ ...this.getErrorObject(a == null ? void 0 : a.error) });
139
- }
140
- async bookButtonClickedHandler(e) {
141
- var s, i, a, o;
142
- if (this.rescheduleBookingId) {
143
- const r = await ((s = this.nylasSchedulerConnector) == null ? void 0 : s.scheduler.rescheduleBooking(this.rescheduleBookingId, e.detail));
144
- !r || "error" in r ? this.nylasSchedulerError.emit({ ...this.getErrorObject(r == null ? void 0 : r.error) }) : (i = this.baseProvider) == null || i.getStore("scheduler").set("showThankYouMessage", !0);
145
- return;
146
- }
147
- const t = await ((a = this.nylasSchedulerConnector) == null ? void 0 : a.scheduler.bookTimeslot(e.detail));
148
- !t || "error" in t ? this.nylasSchedulerError.emit({ ...this.getErrorObject(t == null ? void 0 : t.error) }) : (o = this.baseProvider) == null || o.getStore("scheduler").set("showThankYouMessage", !0);
149
- }
150
- dateSelectedHandler(e) {
151
- const t = e.detail;
152
- this.selectedDateLabel = t ? t.toLocaleDateString(void 0, { dateStyle: "full" }) : "No date selected";
153
- }
154
- cancelBookedEventErrorHandler(e) {
155
- this.nylasSchedulerError.emit({ ...this.getErrorObject(e.detail.error) });
156
- }
157
- rescheduleBookedEventErrorHandler(e) {
158
- this.nylasSchedulerError.emit({ ...this.getErrorObject(e.detail.error) });
159
- }
160
- async getNylasSchedulerStore() {
161
- var e;
162
- return (e = this.baseProvider) == null ? void 0 : e.getStore("scheduler");
163
- }
164
- async getNylasSchedulerConnector() {
165
- return this.nylasSchedulerConnector;
166
- }
167
- async getRef() {
168
- return this.host;
169
- }
170
- getErrorObject(e) {
171
- return {
172
- title: (e == null ? void 0 : e.title) || f.title,
173
- category: (e == null ? void 0 : e.category) || f.category,
174
- type: u.Error,
175
- description: (e == null ? void 0 : e.message) || "",
176
- id: (/* @__PURE__ */ new Date()).getTime().toString()
177
- };
178
- }
179
- checkIfSessionIdExists() {
180
- return this.sessionId ? !0 : (this.nylasSchedulerError.emit({
181
- title: "No sessionId!",
182
- category: b.Component,
183
- type: u.Error,
184
- description: "Session ID is required",
185
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
186
- ttl: "none"
187
- }), !1);
188
- }
189
- isTimeslotValid(e) {
190
- return new Date(e.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
191
- title: "Invalid tiemslot!",
192
- category: b.Component,
193
- type: u.Error,
194
- description: "The selected timeslot is invalid.",
195
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
196
- ttl: "none"
197
- }), !1) : !0;
198
- }
199
- render() {
200
- var c;
201
- const e = this.mode === "app", t = (c = this.baseProvider) == null ? void 0 : c.getStore("scheduler"), s = t == null ? void 0 : t.get("eventInfo"), i = t == null ? void 0 : t.get("showThankYouMessage"), a = t == null ? void 0 : t.get("showBookingForm"), o = t == null ? void 0 : t.get("cancelledEvent"), r = (t == null ? void 0 : t.get("cancelBookingId")) || this.cancelBookingId;
202
- if (e && r && !o)
203
- return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, n("nylas-cancel-booking-form", { cancelBookingId: r, exportparts: "ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label" }))));
204
- if (e && o)
205
- return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, n("nylas-cancelled-event-card", { cancelledEvent: o, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
206
- if (e && i && s)
207
- return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "booked-event-page", part: "booked-event-page" }, n("nylas-booked-event-card", { eventInfo: s, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
208
- if (e && !i && !a) {
209
- const l = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
210
- return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "select-date-page", part: "select-date-page" }, n("div", { class: "left-panel" }, n("nylas-date-picker", { exportparts: "ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month" }), n("div", { class: "border" }), n("nylas-locale-switch", null)), n("div", { class: "right-panel" }, n("h2", null, n("calendar-icon", null), n("span", { id: "selectedDate" }, this.selectedDateLabel)), n("nylas-timeslot-picker", { exportparts: "ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, l && n("span", { slot: "timeslot-picker-cta-label" }, n("slot", { name: "timeslot-picker-cta-label" })))))));
211
- }
212
- if (e && !i && a) {
213
- const l = this.host.querySelector('[slot="custom-booking-form"]');
214
- return n(d, null, n(h, { isLoading: this.isLoading, showNotification: this.showNotification }, n("div", { class: "additional-data-page", part: "additional-data-page" }, n("div", { class: "left-panel" }, n("div", { class: "wrapper" }, n("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time" }))), n("div", { class: "right-panel" }, n("nylas-booking-form", { exportparts: "nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline" }, l && n("div", { slot: "custom-booking-form" }, n("slot", { name: "custom-booking-form" })))))));
215
- }
216
- return n(d, null, n("slot", null));
217
- }
218
- get host() {
219
- return w(this);
220
- }
221
- static get watchers() {
222
- return {
223
- bookingInfo: ["bookingInfoChanged"]
224
- };
225
- }
226
- };
227
- L.style = D;
228
- export {
229
- L as nylas_scheduler
230
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-586a4206.cjs"),h=require("./index-b30d446a-3d69a3cc.cjs"),p=require("./utils-5074a070-d5ba6add.cjs"),g=require("./scheduler-store-7d48e682-449277d4.cjs");require("react");require("react-dom");class y{constructor({schedulerAPIURL:n,nylasSchedulerStore:s,sessionId:i}){if(!n)throw new Error("schedulerAPIURL is required");if(!s)throw new Error("nylasSchedulerStore is required");if(!i)throw new Error("sessionId is required");n==="/"&&(n=new URL(window.location.href).origin),this.sessionId=i,this.schedulerAPIURL=n,this.nylasSchedulerStore=s}init(){p.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new g.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const c=(e,n)=>{const s=e.isLoading,i=e.showNotification;return t.h(t.Fragment,null,s&&t.h("div",{class:"loading"},t.h("div",{class:"left"},t.h("div",{class:"skeleton"})),t.h("div",{class:"right"},t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}),t.h("div",{class:"skeleton"}))),!s&&n,i&&t.h("nylas-notification",null),t.h("div",{class:"footer"},"Powered by  ",t.h("nylas-logo",null)))},v=":host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.loading{margin:1.5rem;display:flex;gap:1rem}.loading .skeleton{border-radius:var(--nylas-border-radius-2x);animation:pulsate 1.5s infinite}.loading .skeleton:nth-child(2){animation-delay:-100ms}.loading .skeleton:nth-child(3){animation-delay:-200ms}.loading .skeleton:nth-child(4){animation-delay:-300ms}.loading .skeleton:nth-child(5){animation-delay:-400ms}.loading .left .skeleton{height:100%;width:400px}.loading .right .skeleton{height:5rem;width:300px;margin-bottom:1rem}.loading .right .skeleton:last-child{margin-bottom:0}@keyframes pulsate{0%{background-color:var(--nylas-base-50)}50%{background-color:var(--nylas-base-100)}100%{background-color:var(--nylas-base-50)}}.select-date-page,.additional-data-page,.booked-event-page,.cancelled-event-page,.cancel-flow-page{border-top-left-radius:var(--nylas-border-radius-2x);border-top-right-radius:var(--nylas-border-radius-2x)}.select-date-page,.additional-data-page{display:flex}@media screen and (max-width: 768px){.select-date-page,.additional-data-page{flex-direction:column}}.booked-event-page{background-color:var(--nylas-base-50)}.cancelled-event-page,.cancel-flow-page{padding:1rem;height:496px;display:flex;justify-content:center;align-items:center}.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:784px}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{padding:1rem 20px 0;gap:1rem;height:512px;min-width:384px;border:1px solid var(--nylas-base-200);border-top-left-radius:inherit}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset}}@media screen and (max-width: 768px){.additional-data-page .left-panel{height:325px}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0}}.border{margin-left:-1.25rem;margin-right:-1.25rem;border-top-width:1px;height:1px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:512px;padding-top:1rem;border:1px solid var(--nylas-base-200);border-top-right-radius:inherit}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset}}.right-panel h2{display:flex;margin:1.5rem 1rem 1rem;gap:0.25rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.75rem;font-weight:600;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:496px}@media screen and (max-width: 768px){nylas-selected-event-card{height:325px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-100)}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}",w=v,b={title:"Something went wrong...",type:h.nr.Error,category:g.ErrorCategory.Component},m=class{constructor(e){t.registerInstance(this,e),this.init=t.createEvent(this,"init",7),this.schedulerWillLoad=t.createEvent(this,"schedulerWillLoad",7),this.schedulerDidLoad=t.createEvent(this,"schedulerDidLoad",7),this.nylasSchedulerError=t.createEvent(this,"nylasSchedulerError",7),this.mode="app",this.defaultSchedulerStoreState=void 0,this.sessionId=void 0,this.schedulerApiUrl="https://elements-staging.us.nylas.com",this.bookingInfo=void 0,this.rescheduleBookingId=void 0,this.cancelBookingId=void 0,this.eventOverrides={},this.isLoading=void 0,this.themeConfig=void 0,this.showNotification=!0,this.automaticComponentRegistration=!0,this.selectedDateLabel=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||"No date selected"}connectedCallback(){p.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var s,i;if(p.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented||!this.checkIfSessionIdExists())return;this.stores={scheduler:g.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,...this.defaultSchedulerStoreState})},this.baseProvider=new h.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const n=(s=this.baseProvider)==null?void 0:s.getStore("scheduler");if(this.nylasSchedulerConnector=new y({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,nylasSchedulerStore:n}),this.init.emit(this.host),(i=this.baseProvider)==null||i.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[a,o]of Object.entries(this.themeConfig))this.host.style.setProperty(`${a}`,o)}async componentDidLoad(){var a,o,r,d;if((a=this.baseProvider)==null||a.componentDidLoad(),!this.checkIfSessionIdExists())return;const e=(o=this.baseProvider)==null?void 0:o.getStore("scheduler"),n=e==null?void 0:e.get("selectedTimeslot");if(n&&(n!=null&&n.start_time)){if(!this.isTimeslotValid(n))return;if(e!=null&&e.get("showBookingForm")){e==null||e.set("selectedDate",n.start_time);return}}const s=e==null?void 0:e.get("selectedDate");let i;if(!s)i=await((r=this.nylasSchedulerConnector)==null?void 0:r.scheduler.getAvailability());else{const l=new Date(s.getFullYear(),s.getMonth(),1).getTime()/1e3,u=new Date(s.getFullYear(),s.getMonth()+1,1).getTime()/1e3;i=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.getAvailability(l,u))}if((!i||"error"in i)&&this.nylasSchedulerError.emit({...this.getErrorObject(i==null?void 0:i.error)}),!s){let l=new Date;const u=e==null?void 0:e.get("availability").find(f=>new Date(f.start_time)>new Date);u&&(l=u.start_time),e==null||e.set("selectedDate",l)}}componentDisconnected(){var e;(e=this.baseProvider)==null||e.componentDisconnected()}bookingInfoChanged(e){var n;(n=this.stores)==null||n.scheduler.set("bookingInfo",e)}async registerComponentHandler(e){var n;(n=this.baseProvider)==null||n.registerComponent(e.detail)}async unregisterComponentHandler(e){var n;(n=this.baseProvider)==null||n.unregisterComponent(e.detail)}async monthChangedHandler(e){var o;const n=e.detail,s=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,i=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,a=await((o=this.nylasSchedulerConnector)==null?void 0:o.scheduler.getAvailability(s,i));(!a||"error"in a)&&this.nylasSchedulerError.emit({...this.getErrorObject(a==null?void 0:a.error)})}async bookButtonClickedHandler(e){var s,i,a,o;if(this.rescheduleBookingId){const r=await((s=this.nylasSchedulerConnector)==null?void 0:s.scheduler.rescheduleBooking(this.rescheduleBookingId,e.detail));!r||"error"in r?this.nylasSchedulerError.emit({...this.getErrorObject(r==null?void 0:r.error)}):(i=this.baseProvider)==null||i.getStore("scheduler").set("showThankYouMessage",!0);return}const n=await((a=this.nylasSchedulerConnector)==null?void 0:a.scheduler.bookTimeslot(e.detail));!n||"error"in n?this.nylasSchedulerError.emit({...this.getErrorObject(n==null?void 0:n.error)}):(o=this.baseProvider)==null||o.getStore("scheduler").set("showThankYouMessage",!0)}dateSelectedHandler(e){const n=e.detail;this.selectedDateLabel=n?n.toLocaleDateString(void 0,{dateStyle:"full"}):"No date selected"}cancelBookedEventErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}rescheduleBookedEventErrorHandler(e){this.nylasSchedulerError.emit({...this.getErrorObject(e.detail.error)})}async getNylasSchedulerStore(){var e;return(e=this.baseProvider)==null?void 0:e.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(e){return{title:(e==null?void 0:e.title)||b.title,category:(e==null?void 0:e.category)||b.category,type:h.nr.Error,description:(e==null?void 0:e.message)||"",id:new Date().getTime().toString()}}checkIfSessionIdExists(){return this.sessionId?!0:(this.nylasSchedulerError.emit({title:"No sessionId!",category:g.ErrorCategory.Component,type:h.nr.Error,description:"Session ID is required",id:new Date().getTime().toString(),ttl:"none"}),!1)}isTimeslotValid(e){return new Date(e.start_time)<new Date?(this.nylasSchedulerError.emit({title:"Invalid tiemslot!",category:g.ErrorCategory.Component,type:h.nr.Error,description:"The selected timeslot is invalid.",id:new Date().getTime().toString(),ttl:"none"}),!1):!0}render(){var d;const e=this.mode==="app",n=(d=this.baseProvider)==null?void 0:d.getStore("scheduler"),s=n==null?void 0:n.get("eventInfo"),i=n==null?void 0:n.get("showThankYouMessage"),a=n==null?void 0:n.get("showBookingForm"),o=n==null?void 0:n.get("cancelledEvent"),r=(n==null?void 0:n.get("cancelBookingId"))||this.cancelBookingId;if(e&&r&&!o)return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},t.h("nylas-cancel-booking-form",{cancelBookingId:r,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(e&&o)return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},t.h("nylas-cancelled-event-card",{cancelledEvent:o,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(e&&i&&s)return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"booked-event-page",part:"booked-event-page"},t.h("nylas-booked-event-card",{eventInfo:s,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))));if(e&&!i&&!a){const l=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"select-date-page",part:"select-date-page"},t.h("div",{class:"left-panel"},t.h("nylas-date-picker",{exportparts:"ndp, ndp__month-header, ndp__month-button, ndp__day, ndp__date, ndp__date--selected, ndp__date--current-day, ndp__date--current-month"}),t.h("div",{class:"border"}),t.h("nylas-locale-switch",null)),t.h("div",{class:"right-panel"},t.h("h2",null,t.h("calendar-icon",null),t.h("span",{id:"selectedDate"},this.selectedDateLabel)),t.h("nylas-timeslot-picker",{exportparts:"ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary"},l&&t.h("span",{slot:"timeslot-picker-cta-label"},t.h("slot",{name:"timeslot-picker-cta-label"})))))))}if(e&&!i&&a){const l=this.host.querySelector('[slot="custom-booking-form"]');return t.h(t.Host,null,t.h(c,{isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"additional-data-page",part:"additional-data-page"},t.h("div",{class:"left-panel"},t.h("div",{class:"wrapper"},t.h("nylas-selected-event-card",{exportparts:"nsec, nsec__card, nsec__icon, nsec__date, nsec__time"}))),t.h("div",{class:"right-panel"},t.h("nylas-booking-form",{exportparts:"nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline"},l&&t.h("div",{slot:"custom-booking-form"},t.h("slot",{name:"custom-booking-form"})))))))}return t.h(t.Host,null,t.h("slot",null))}get host(){return t.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"]}}};m.style=w;exports.nylas_scheduler=m;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-586a4206.cjs"),f=require("./register-component-152c6ad2-b0d34c36.cjs"),o=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");const u=":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)}}",p=u;var g=function(t,e,n,a){var i=arguments.length,s=i<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,n,a);else for(var l=t.length-1;l>=0;l--)(h=t[l])&&(s=(i<3?h(s):i>3?h(e,n,s):h(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},c=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const d=class{constructor(t){r.registerInstance(this,t),this.refresh=r.createEvent(this,"refresh",7),this.threshold=100,this.onTouchStart=e=>{var n,a,i,s;o.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),((s=this.containerElement)==null?void 0:s.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,o.debug("[nylas-threads-refresh] Constructor"),this.updateState=this.updateState.bind(this)}connectedCallback(){}async componentWillLoad(){o.debug("[nylas-threads-refresh] Component will load")}componentDidLoad(){var t,e,n;o.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;o.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 r.h(r.Host,{key:"8fcb207468340169fd22f41ffcb224ef2bd8c516"},r.h("div",{key:"f239948e3160c7925ee754812a23c246adc50bfd",class:"container",ref:t=>this.containerElement=t},r.h("button",{key:"5dae9634879e56779cf73d74a645fcbbf5016d7f",class:{"pull-to-refresh":!0,pulling:this.pulling,refreshing:this.state==="loading"},"aria-label":"Refreshing..."},this.state==="loading"&&r.h("refresh-icon",{slot:"icon"}),this.state!=="loading"&&r.h("arrow-icon",{slot:"icon"})),r.h("div",{key:"ba4888a84d3c9d557a119c972ec438f1f36d52ea",class:"content",ref:t=>this.contentElement=t},r.h("slot",{key:"6deb2ad38560d82714b94da7cc2f340265b77fc3"}))))}};g([f.RegisterComponent({name:"nylas-threads-refresh",eventToProps:{refresh:async(t,e)=>{o.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)],d.prototype,"render",null);d.style=p;exports.nylas_threads_refresh=d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-586a4206.cjs"),h=require("./register-component-152c6ad2-b0d34c36.cjs"),u=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");const y=":host{display:block}sp-search{width:100%;border:0}",p=y;var f=function(t,e,n,a){var o=arguments.length,r=o<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,n):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(t,e,n,a);else for(var i=t.length-1;i>=0;i--)(c=t[i])&&(r=(o<3?c(r):o>3?c(e,n,r):c(e,n))||r);return o>3&&r&&Object.defineProperty(e,n,r),r},l=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)};const d=class{constructor(t){s.registerInstance(this,t),this.search=s.createEvent(this,"search",7),this.onSearch=async e=>{e.preventDefault(),e.stopPropagation();const a=e.target.value;a!==this.internalQuery&&(this.internalQuery=a,this.search.emit(this.internalQuery))},this.query="",this.internalQuery=""}connectedCallback(){}disconnectedCallback(){}async componentWillLoad(){u.debug("[nylas-threads-search] Component will load")}async componentDidLoad(){u.debug("[nylas-threads-search] Component did load")}onQueryChange(){this.internalQuery=this.query}render(){return s.h(s.Host,{key:"d777659666abd1205d8010c8f2468f1cfab4995e"},s.h("sp-theme",{key:"37f266bb3bb9ac490526d30a6c9fed104515fabb",scale:"medium",color:"dark"},s.h("sp-search",{key:"7b6db41e97baa3124d078ec1226dd884d73a251c",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}),l("design:type",Function),l("design:paramtypes",[]),l("design:returntype",void 0)],d.prototype,"render",null);d.style=p;exports.nylas_threads_search=d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-586a4206.cjs"),w=require("./register-component-152c6ad2-b0d34c36.cjs"),i=require("./utils-5074a070-d5ba6add.cjs");require("react");require("react-dom");function f(t,a,s,o,r){if(!o||!s||s.children.length>0)return;i.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 m=({viewEmailElement:t,message:a,attachments:s,onMessageClick:o,onShowContactDataClick:r,parent:n})=>{var d,l,h,u,v,y,b;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&&((d=a.data.from[0])==null?void 0:d.name)&&((h=(l=a.data.from[0])==null?void 0:l.name[0])==null?void 0:h.toUpperCase())),e.h("div",{class:"from"},e.h("span",{class:"name"},a.data.from&&((u=a.data.from[0])==null?void 0:u.name))," ",e.h("span",{class:"email"},a.data.from&&((v=a.data.from[0])==null?void 0:v.email))),e.h("div",{class:"date"},new Date(a.data.date*1e3).toLocaleTimeString(void 0,{timeStyle:"short"})," ","(",i.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")," ",i.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"},i.formatRecipient((y=a.data)!=null&&y.from?(b=a==null?void 0:a.data)==null?void 0:b.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(c=>e.h("div",null,i.formatRecipient(c))))),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(c=>e.h("div",null,i.formatRecipient(c)))))),!a.collapse&&t&&e.h("div",{key:a.id,ref:c=>f(a,s,c,t,n)}),!a.collapse&&!t&&e.h("nylas-view-email",{key:a.id,message:a.data,parent:n})),e.h("hr",null))},C=':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}}',k=C;var M=function(t,a,s,o){var r=arguments.length,n=r<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,s):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,a,s,o);else for(var l=t.length-1;l>=0;l--)(d=t[l])&&(n=(r<3?d(n):r>3?d(a,s,n):d(a,s))||n);return r>3&&n&&Object.defineProperty(a,s,n),n},p=function(t,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,a)};const g=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(d=>d.data.id===o);if(!r){i.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.showContactDataClicked.emit(r.data).defaultPrevented||(r.showContactData=!r.showContactData,this.internalMessages=[...this.internalMessages]),i.debug(`[nylas-view-thread] show contact data clicked ${o} ${r.showContactData?"collapsed":"expanded"}`)},this.onMessageClick=a=>{var d;const o=a.target.dataset.id,r=this.internalMessages.find(l=>l.data.id===o);if(!r){i.debug(`[nylas-view-thread] Could not find message ${o}`);return}this.messageClicked.emit(r.data).defaultPrevented||(r.id!==((d=this.internalMessages[this.internalMessages.length-1])==null?void 0:d.id)&&(r.collapse=!r.collapse,r.collapse&&(r.showContactData=!1)),this.internalMessages=[...this.internalMessages]),i.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(){i.debug("[nylas-view-thread] Component will load"),this.updateInternalMessages(this.messages);const t=this.host.querySelector("template.nylas-view-email");if(!t){i.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){i.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(){i.debug("[nylas-view-thread] Component did load")}async threadChanged(t){i.debug("[nylas-view-thread] Thread changed",{thread:t}),this.internalMessages=[],this.threadSelected.emit(t).defaultPrevented||i.debug("[nylas-view-thread] Default event not prevented, initializing")}updateInternalMessages(t){i.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,d;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:"0bb124ce159dd13b929574d159b15c07ab1d6ac2"},e.h("sp-theme",{key:"ad8bbcceb405fc841ee0a5743bfbd025c1097725",scale:"medium",color:"dark"},e.h("div",{key:"e4ddbcdffd5a5cd6a3b1630779e3aadcecdfb437",class:"view-thread"},e.h("div",{key:"b9e6607a0ede36ee3b571461ec35dd01438ec6f1",class:"header"},e.h("div",{key:"d34f199c2585fb5aec3b3f53c3f94e9282b89a76",class:"subject"},(r=this.thread)==null?void 0:r.subject),e.h("div",{key:"9feca4265e39206945d0b208f2c48d9d3ab3972e",class:"folders"},(d=(n=this.thread)==null?void 0:n.folders)==null?void 0:d.map(l=>e.h("sp-tag",{size:"s"},i.toTitleCase(l.replace("CATEGORY_","").replace("_"," ")))))),e.h("div",{key:"6b6d657df61e2e1e1a2a6cbb86735828a71bd436",class:"messages"},t&&e.h(m,{message:t,attachments:this.attachments.filter(l=>l.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(l=>e.h(m,{message:l,attachments:this.attachments.filter(h=>h.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(l=>e.h(m,{message:l,attachments:this.attachments.filter(h=>h.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:l=>{i.debug("[nylas-view-thread] Send event",{message:l.detail.message,replyBody:l.detail.replyBody})}})))))}get host(){return e.getElement(this)}static get watchers(){return{thread:["threadChanged"],messages:["updateInternalMessages"]}}};M([w.RegisterComponent({name:"nylas-view-thread",stateToProps:new Map([["mailbox.selectedThread","thread"],["mailbox.messages","messages"],["mailbox.state","state"]]),eventToProps:{threadSelected:async(t,a)=>{i.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}),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",void 0)],g.prototype,"render",null);g.style=k;exports.nylas_view_thread=g;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-586a4206.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:"ddd1c059df32472970ae6f38f0ecb66b257dad2e",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"ebf2e3ca0f1d6449dfdd2b8a8c0be5e2d074190b",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}",d=n,i=class{constructor(e){t.registerInstance(this,e),this.width="15",this.height="15"}render(){return t.h("svg",{key:"0c25a04a4cceb1c492b25c4704daaec73fdd2bbb",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"623e7e5b9604a9d617f058a68d86d1bdc0da76f9",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};i.style=d;exports.play_icon=s;exports.stop_icon=i;
@@ -1,25 +0,0 @@
1
- import { r as e, h as t } from "./index-98d3a4da.js";
2
- import "react";
3
- import "react-dom";
4
- const o = ".sc-play-icon-h{display:flex}", i = o, c = class {
5
- constructor(s) {
6
- e(this, s), this.width = "15", this.height = "15";
7
- }
8
- render() {
9
- return t("svg", { key: "ddd1c059df32472970ae6f38f0ecb66b257dad2e", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "ebf2e3ca0f1d6449dfdd2b8a8c0be5e2d074190b", d: "M21 12L3 21V3L21 12Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
10
- }
11
- };
12
- c.style = i;
13
- const d = ".sc-stop-icon-h{display:flex}", h = d, n = class {
14
- constructor(s) {
15
- e(this, s), this.width = "15", this.height = "15";
16
- }
17
- render() {
18
- return t("svg", { key: "0c25a04a4cceb1c492b25c4704daaec73fdd2bbb", width: this.width, height: this.height, viewBox: "0 0 24 24", fill: "auto", xmlns: "http://www.w3.org/2000/svg" }, t("path", { key: "623e7e5b9604a9d617f058a68d86d1bdc0da76f9", d: "M4 4H20V20H4V4Z", stroke: "auto", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }));
19
- }
20
- };
21
- n.style = h;
22
- export {
23
- c as play_icon,
24
- n as stop_icon
25
- };
@@ -1 +0,0 @@
1
- "use strict";const v=require("./utils-5074a070-d5ba6add.cjs"),B=require("./index-b30d446a-3d69a3cc.cjs");exports.ErrorCategory=void 0;(function(n){n.Component="component",n.Api="api",n.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var w;(function(n){n.endtime_not_in_future="endtime_not_in_future",n.no_booking_info="no_booking_info",n.no_timeslot_selected="no_timeslot_selected",n.no_booking_id="no_booking_id",n.invalid_start_time="invalid_start_time",n.invalid_end_time="invalid_end_time",n.invalid_timezone="invalid_timezone"})(w||(w={}));var b;(function(n){n.invalid_session="invalid_session",n.general_error="general_error",n.internal_error="internal_error",n.invalid_request_error="invalid_request_error",n.timeslot_not_available="timeslot_not_available"})(b||(b={}));class A{constructor(){this.component=t=>{const e=exports.ErrorCategory.Component,s=`${t} error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:e}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:e}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:e}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:e}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:e}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:e}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:e})}},this.api=t=>{const e=exports.ErrorCategory.Api,s=`${t} error`;return{invalid_session:i=>({title:s,message:i,category:e}),general_error:i=>({title:s,message:i,category:e}),internal_error:i=>({title:s,message:i,category:e}),invalid_request_error:i=>({title:s,message:i,category:e}),timeslot_not_available:i=>({title:s,message:i,category:e})}}}}class C{constructor({schedulerAPIURL:t,schedulerStore:e,sessionId:s}){this.errors=new A,this.schedulerStore=e,this.schedulerAPIURL=t,this.sessionId=s}async makeAPIRequest(t,e,s,i={}){try{const r=new URL(this.schedulerAPIURL);return r.pathname=t,await(await fetch(decodeURIComponent(r.toString()),{method:e,headers:{"Content-Type":"application/json",...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}selectDate(t){this.schedulerStore.set("selectedDate",t),this.schedulerStore.set("selectedTimeslot",null)}selectTime(t){this.schedulerStore.set("selectedTimeslot",t)}selectTimezone(t){this.schedulerStore.set("selectedTimezone",t)}toggleAdditionalData(t){this.schedulerStore.set("showBookingForm",t)}setParticipantName(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e==null?void 0:e.primaryParticipant,name:t}})}setParticipantEmail(t){const{bookingInfo:e}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...e,primaryParticipant:{...e==null?void 0:e.primaryParticipant,email:t}})}async setReschedule(t){const e=new Date;this.schedulerStore.set("rescheduleBookingId",t),this.schedulerStore.set("selectedTimeslot",null),this.schedulerStore.set("showThankYouMessage",!1),this.schedulerStore.set("showBookingForm",!1);const s=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3,r=await this.getAvailability(s,i),o=this.schedulerStore.get("availability").find(g=>new Date(g.start_time)>new Date);let a=e;return o&&(a=o.start_time),this.schedulerStore.set("selectedDate",a),r}async setCancel(t){this.schedulerStore.set("cancelBookingId",t)}async bookTimeslot(t){var m;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:e,bookingInfo:s}=this.schedulerStore.state;if(!t&&!s)return{error:this.errors.component("Booking").no_booking_info()};const i=(t==null?void 0:t.timeslot)||e;if(!i)return{error:this.errors.component("Create Booking").no_timeslot_selected()};const r=t?t==null?void 0:t.primaryParticipant:s==null?void 0:s.primaryParticipant,o=t?(t==null?void 0:t.guests)||[]:(s==null?void 0:s.guests)||[],a=t?{...t==null?void 0:t.additionalFields}:{...s==null?void 0:s.additionalFields},g={Authorization:`Bearer ${this.sessionId}`},u="/schedule/bookings",c=await this.makeAPIRequest(decodeURIComponent(u),"POST",JSON.stringify({participants:[r,...o],additional_fields:a,start_time:i.start_time.getTime()/1e3,end_time:i.end_time.getTime()/1e3}),g);if("error"in c){this.schedulerStore.set("isLoading",!1);const h=(m=c.error)==null?void 0:m.type;let l=c.error;return h&&h in this.errors.api("Create Booking")&&(l=this.errors.api("Create Booking")[h]((l==null?void 0:l.message)||(l==null?void 0:l.title)||"Something went wrong")),{error:l}}return"data"in c&&this.schedulerStore.set("eventInfo",c==null?void 0:c.data),this.schedulerStore.set("isLoading",!1),c}async getAvailability(t=0,e=0){var c,m,h;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,r=new Date().getTime();if(e&&e<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component("Get Availability").endtime_not_in_future()};t&&s.append("start_time",encodeURIComponent(t)),e&&s.append("end_time",encodeURIComponent(e));const o=s.toString(),a=`/schedule/availability${o?`?${o}`:""}`,g={Authorization:`Bearer ${this.sessionId}`},u=await this.makeAPIRequest(decodeURIComponent(a),"GET",void 0,g);if("error"in u){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const l=(c=u.error)==null?void 0:c.type;let d=u.error;return l&&l in this.errors.api("Get Availability")&&(d=this.errors.api("Get Availability")[l]((d==null?void 0:d.message)||(d==null?void 0:d.title)||"Something went wrong")),{error:d}}if("data"in u){const d=(((h=(m=u.data)==null?void 0:m.time_slots)==null?void 0:h.map(p=>({...p,start_time:new Date(p.start_time*1e3),end_time:new Date(p.end_time*1e3)})))||[]).filter(p=>p.start_time.getTime()>r);this.schedulerStore.set("availability",d)}return this.schedulerStore.set("isLoading",!1),u}async cancelBooking(t){var r;if(this.schedulerStore.set("isLoading",!0),!t)return{error:this.errors.component("Cancel Booking").no_booking_id()};const e=`/schedule/bookings/${t}`,s={Authorization:`Bearer ${this.sessionId}`},i=await this.makeAPIRequest(decodeURIComponent(e),"PUT",JSON.stringify({action:"cancel"}),s);if("error"in i){this.schedulerStore.set("isLoading",!1);const o=(r=i.error)==null?void 0:r.type;let a=i.error;return o&&o in this.errors.api("Cancel Booking")&&(a=this.errors.api("Cancel Booking")[o]((a==null?void 0:a.message)||(a==null?void 0:a.title)||"Something went wrong")),{error:a}}return"data"in i&&this.schedulerStore.set("cancelledEvent",i==null?void 0:i.data),this.schedulerStore.set("isLoading",!1),i}async rescheduleBooking(t,e){var y;if(this.schedulerStore.set("isLoading",!0),!t)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:o,selectedTimezone:a}=this.schedulerStore.state,{startTime:g,endTime:u,timezone:c}=e,m=g||(o==null?void 0:o.start_time);if(!m)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerStoreState.')};const h=u||(o==null?void 0:o.end_time);if(!h)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerStoreState.')};const l=c||a;if(!l)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerStoreState.')};const d=e?e==null?void 0:e.primaryParticipant:r==null?void 0:r.primaryParticipant,p=e?(e==null?void 0:e.guests)||[]:(r==null?void 0:r.guests)||[],k=e?{...e==null?void 0:e.additionalFields}:{...r==null?void 0:r.additionalFields},T=`/schedule/bookings/${t}`,P={Authorization:`Bearer ${this.sessionId}`},_=await this.makeAPIRequest(decodeURIComponent(T),"PATCH",JSON.stringify({start_time:m.getTime()/1e3,end_time:h.getTime()/1e3,time_zone:l,participants:[d,...p],additional_fields:k}),P);if("error"in _){this.schedulerStore.set("isLoading",!1);const f=(y=_.error)==null?void 0:y.type;let S=_.error;f&&f in s&&(S=s[f]((S==null?void 0:S.message)||(S==null?void 0:S.title)||"Something went wrong"))}return"data"in _&&this.schedulerStore.set("eventInfo",_==null?void 0:_.data),this.schedulerStore.set("isLoading",!1),_}}function R(n={}){const t={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,showThankYouMessage:!1,selectableDates:null,availability:[],state:"ready",eventInfo:null,cancelledEvent:null,isLoading:!1,...n};v.debug("[defaultNylasStoreState]: ",t);const e=B.createStore(t);return e.onChange("availability",s=>{v.debug("[availability]: ",s);const i=s.map(r=>r.start_time);v.debug("[selectableDates]: ",i),e.set("selectableDates",i)}),e.onChange("rescheduleBookingId",s=>{s?e.set("bookingFlow","rescheduling"):e.set("bookingFlow","booking")}),e.reset=()=>{for(const s in t){const i=t[s];e.set(s,i)}},e}exports.CreateNylasSchedulerStore=R;exports.NylaSchedulerAPIConnector=C;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-586a4206.cjs");require("react");require("react-dom");const c=".sc-search-icon-h{display:flex}",h=c,r=class{constructor(e){i.registerInstance(this,e),this.width="15",this.height="15"}render(){return i.h("svg",{key:"baa6b304adc90eb600c71064ab8ec07b371b1584",width:this.width,height:this.height,fill:"none",xmlns:"http://www.w3.org/2000/svg"},i.h("path",{key:"f5fb2b0da29891bc7bec40a3d7537924a2e277f0",fill:"currentColor",d:"M5.5 0C8.53757 0 11 2.46243 11 5.5C11 6.83879 10.5217 8.06586 9.72656 9.01962L13.8536 13.1464C14.0488 13.3417 14.0488 13.6583 13.8536 13.8536C13.68 14.0271 13.4106 14.0464 13.2157 13.9114L13.1464 13.8536L9.01962 9.72656C8.06586 10.5217 6.83879 11 5.5 11C2.46243 11 0 8.53757 0 5.5C0 2.46243 2.46243 0 5.5 0ZM5.5 1C3.01472 1 1 3.01472 1 5.5C1 7.98528 3.01472 10 5.5 10C7.98528 10 10 7.98528 10 5.5C10 3.01472 7.98528 1 5.5 1Z"}))}};r.style=h;const p=":host{display:block;position:relative}.dropdown{display:inline-block}.dropbtn{color:black;padding:0.5rem;font-size:1rem;cursor:pointer;display:flex;gap:0.5rem;background:transparent;border:none;border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn:hover,.dropbtn:active{background-color:var(--nylas-base-50);border:1px solid var(--nylas-primary)}.dropbtn:active{border-width:2px}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropbtn span.selected-option{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:144px}@media screen and (max-width: 768px){.dropbtn span.selected-option{max-width:124px}}.dropbtn:hover,.dropbtn:focus{background-color:#f1f1f1}.dropdown-content{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)}.search-box{border-bottom:1px solid var(--nylas-base-200);padding:10px;position:sticky;top:0;background:var(--nylas-base-0)}.search-box .icon{position:absolute;top:1.25rem;left:1.25rem;color:var(--nylas-base-300)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content 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:left}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content a:hover,.dropdown-content a:focus{background-color:var(--nylas-base-100)}.dropdown-content .selected{background-color:#e7e7e7}input[type=text]{width:-webkit-fill-available;padding:inherit;border:1px solid #ccc;border-radius:4px;position:sticky;background:no-repeat scroll 7px 7px;padding-left:30px;background-size:16px 16px}",b=p,l=class{constructor(e){i.registerInstance(this,e),this.selectedOptionChanged=i.createEvent(this,"selectedOptionChanged",7),this.name=void 0,this.options=[],this.defaultSelectedOption=void 0,this.selectedOption=this.defaultSelectedOption||null,this.isOpen=!1,this.searchValue="",this.filteredOptions=[...this.options],this.ariaActivedescendant=""}componentWillLoad(){this.filteredOptions=this.options,!this.selectedOption&&this.options.length>0&&(this.selectedOption=this.options[0])}toggleDropdown(){this.isOpen=!this.isOpen}filterOptions(e){const t=e.target.value;this.searchValue=t,this.filteredOptions=this.options.filter(s=>s.label.toLowerCase().includes(t.toLowerCase()))}selectOption(e){this.selectedOption=e,this.toggleDropdown(),this.selectedOptionChanged.emit({value:e.value,name:this.name})}handleSelectButtonKeyDown(e){var t;switch(e.key){case"ArrowDown":case"Enter":e.preventDefault(),this.isOpen||this.toggleDropdown(),(t=this.inputRef)==null||t.focus();break;case"Escape":this.isOpen=!1;break}}handleListboxKeydown(e){var n,a;const t=this.filteredOptions,s=t.findIndex(o=>o.value===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){if(e.preventDefault(),s===t.length-1){this.ariaActivedescendant="",(n=this.inputRef)==null||n.focus();return}const o=s+1<t.length?s+1:0;this.ariaActivedescendant=t[o].value,this.focusOption(o)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){if(e.preventDefault(),s===0){this.ariaActivedescendant="",(a=this.inputRef)==null||a.focus();return}const o=s-1>=0?s-1:t.length-1;this.ariaActivedescendant=t[o].value,this.focusOption(o)}else e.key==="Enter"?(e.preventDefault(),this.ariaActivedescendant&&this.selectOption(t[s])):e.key==="Escape"&&(this.isOpen=!1)}focusOption(e){var a;const t=this.filteredOptions[e];if(!t)return;const s=t.value,n=(a=this.el.shadowRoot)==null?void 0:a.getElementById(s);n&&(n.focus(),n.scrollIntoView({behavior:"smooth",block:"nearest"}))}handleComboboxKeyDown(e){e.key==="ArrowDown"||e.key=="Tab"&&!e.shiftKey?(e.preventDefault(),this.ariaActivedescendant=this.filteredOptions[0].value,this.focusOption(0)):e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey?(e.preventDefault(),this.ariaActivedescendant=this.filteredOptions[this.filteredOptions.length-1].value,this.focusOption(this.filteredOptions.length-1)):e.key==="Escape"&&(this.isOpen=!1)}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.isOpen&&(this.isOpen=!1)}render(){var e;return i.h("div",{key:"7ebf4768db42ef9d5a220fe2a3c0fbe8f8c604d3",class:"dropdown"},i.h("button",{key:"61a3b0bbae22051a086b0731a5665ab4406e0fb6",class:{dropbtn:!0,open:this.isOpen},onClick:()=>this.toggleDropdown(),"aria-haspopup":"listbox","aria-expanded":this.isOpen?"true":"false","aria-label":this.name,onKeyDown:t=>this.handleSelectButtonKeyDown(t)},i.h("slot",{key:"524524003a5b1befd04d84a550e8779ba432e6a6",name:"select-icon","aria-hidden":"true"}),i.h("span",{key:"55c27a218ae3668c0bc6787fdc43f75b4aa4f421",class:"selected-option"},(e=this.selectedOption)==null?void 0:e.label),i.h("span",{key:"64e34fc4ce09240416f37653b35a5dc1a4752222",class:this.isOpen?"open":"closed","aria-hidden":"true"},i.h("chevron-icon",{key:"9e602e625986844d519a9c6c9bb8ae62f1cdf84d",width:"16",height:"16"}))),this.isOpen?i.h("div",{class:"dropdown-content"},i.h("div",{class:{"search-box":!0,open:this.isOpen}},i.h("search-icon",{width:"15",height:"15",class:"icon"}),i.h("input",{type:"text",role:"combobox",placeholder:"Search",value:this.searchValue,ref:t=>this.inputRef=t,onInput:t=>this.filterOptions(t),onKeyDown:t=>this.handleComboboxKeyDown(t)})),i.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:t=>this.handleListboxKeydown(t)},this.filteredOptions.map(t=>i.h("li",{tabindex:"0",key:t.value,id:t.value,onClick:()=>this.selectOption(t),role:"option"},`${t.label}`)))):null)}get el(){return i.getElement(this)}};l.style=b;const f=".sc-translate-icon-h{display:flex}",u=f,d=class{constructor(e){i.registerInstance(this,e),this.width="16",this.height="16"}render(){return i.h("svg",{key:"482a971e7045aba7372284ea28e2cac899909663",xmlns:"http://www.w3.org/2000/svg",width:this.width,height:this.height,viewBox:"0 0 20 20",fill:"none"},i.h("path",{key:"9bac1f8dd4c2317376847fe100875fa50ddeaf03",fill:"currentColor",d:"M14.1663 4.02867C14.4267 4.12081 14.563 4.40654 14.4709 4.66685C14.3501 5.00788 14.2182 5.4771 14.1178 5.86047C14.6877 5.77587 15.2665 5.65653 15.8867 5.51288C16.1557 5.45058 16.4243 5.61815 16.4866 5.88717C16.5489 6.15619 16.3814 6.42479 16.1123 6.4871C15.339 6.66621 14.6101 6.81289 13.8717 6.90283C13.7759 7.35654 13.7014 7.77084 13.6451 8.15021C14.1202 8.04599 14.5738 8.00553 14.9996 8.02075L14.9996 8C14.9996 7.72386 15.2235 7.5 15.4996 7.5C15.7758 7.5 15.9996 7.72386 15.9996 8C15.9996 8.05657 15.9991 8.11281 15.9979 8.16871C17.1392 8.47838 17.9781 9.23987 18.3435 10.2263C18.9579 11.8853 18.1287 13.8787 15.7027 14.9569C15.4504 15.069 15.1549 14.9554 15.0427 14.7031C14.9306 14.4507 15.0442 14.1552 15.2966 14.0431C17.3705 13.1213 17.7913 11.6147 17.4057 10.5737C17.1874 9.984 16.6776 9.44916 15.9129 9.18633C15.6829 10.7237 15.021 11.9466 14.229 12.7925C14.3126 12.9656 14.3958 13.1436 14.4641 13.3151C14.5662 13.5717 14.441 13.8625 14.1844 13.9646C13.9278 14.0667 13.637 13.9415 13.5349 13.6849C13.5066 13.6137 13.4777 13.5463 13.448 13.4802C13.028 13.7794 12.5905 13.9869 12.1705 14.0835C11.5942 14.2161 10.963 14.1517 10.534 13.6942C9.88917 13.0053 9.84361 11.8611 10.2855 10.8412C10.6652 9.96479 11.4186 9.11781 12.5848 8.54034C12.6387 8.07338 12.7199 7.55894 12.8332 6.98891C12.3926 7.00755 11.9403 7.00326 11.4659 6.97127C11.1904 6.95269 10.9821 6.71428 11.0007 6.43876C11.0192 6.16325 11.2577 5.95496 11.5332 5.97353C12.0633 6.00928 12.5641 6.00772 13.0566 5.97553C13.1605 5.55444 13.3512 4.8331 13.5282 4.33317C13.6203 4.07286 13.906 3.93653 14.1663 4.02867ZM12.501 9.74109C11.8436 10.1821 11.427 10.7219 11.2031 11.2387C10.8542 12.0439 10.9881 12.716 11.2638 13.0105C11.2637 13.0104 11.2639 13.0106 11.2638 13.0105C11.3573 13.11 11.5624 13.1973 11.9463 13.109C12.2578 13.0373 12.6311 12.8571 13.0121 12.5576C12.8658 12.22 12.7272 11.8324 12.6313 11.353C12.5405 10.8996 12.4899 10.3743 12.501 9.74109ZM13.7808 11.7797C14.316 11.0956 14.759 10.1665 14.9271 9.01632C14.539 9.00681 14.1111 9.05601 13.6457 9.17854C13.605 9.19274 13.5647 9.20726 13.525 9.22209C13.4663 10.0545 13.5146 10.671 13.6118 11.1568C13.6578 11.3868 13.7156 11.5913 13.7808 11.7797ZM6.92028 5.2159C5.77942 4.88398 4.78409 5.00841 4.07616 5.21575C3.72264 5.3193 3.439 5.44393 3.24121 5.5443C3.14215 5.59457 3.0641 5.63901 3.00903 5.67212C2.98147 5.68868 2.95962 5.70244 2.9437 5.71271L2.92429 5.72542L2.91797 5.72966L2.91566 5.73123L2.91393 5.73241C2.91384 5.73249 2.91436 5.73325 2.94925 5.78397C3.23698 6.20225 3.1703 6.10548 2.91393 5.73241C2.68634 5.88881 2.62863 6.20009 2.78502 6.42767C2.94134 6.65514 3.25207 6.71313 3.47963 6.55703L3.4788 6.5576L3.48576 6.55305C3.49318 6.54826 3.50608 6.5401 3.52423 6.52919C3.56057 6.50735 3.6177 6.47463 3.69373 6.43605C3.84612 6.35872 4.07228 6.2589 4.35724 6.17544C4.92619 6.0088 5.72242 5.90898 6.64043 6.17595C7.35305 6.38517 7.66747 6.76919 7.82692 7.16112C7.98173 7.54163 8.0026 7.95751 8.00531 8.33243C7.46199 8.18407 6.79336 8.03682 6.08385 8.00744C5.04808 7.96456 3.8874 8.17096 2.87738 9.01102C1.98877 9.75011 1.78345 10.8818 2.07014 11.853C2.35713 12.8252 3.14925 13.692 4.31803 13.9348C5.22351 14.123 6.18016 13.8639 6.9599 13.5212C7.3403 13.354 7.69572 13.1594 8.0057 12.9665V13.5C8.0057 13.7761 8.22956 14 8.5057 14C8.78184 14 9.0057 13.7754 9.0057 13.4993L9.0057 8.44586C9.0058 8.05404 9.00595 7.40554 8.7532 6.78428C8.48142 6.11625 7.93342 5.51313 6.92136 5.21622L6.92028 5.2159ZM6.04249 9.00659C6.76366 9.03645 7.44769 9.209 8.0057 9.37205V11.757C7.65814 12.0182 7.13927 12.35 6.55757 12.6057C5.85264 12.9155 5.12729 13.0816 4.52148 12.9557C3.75127 12.7957 3.22322 12.2271 3.02922 11.5699C2.83491 10.9116 2.98777 10.2199 3.51683 9.77985C4.27958 9.14545 5.16917 8.97043 6.04249 9.00659Z"}))}};d.style=u;exports.search_icon=r;exports.select_dropdown=l;exports.translate_icon=d;
@@ -1,101 +0,0 @@
1
- import { r, h as s, c as l, g as d } from "./index-98d3a4da.js";
2
- import "react";
3
- import "react-dom";
4
- const c = ".sc-search-icon-h{display:flex}", p = c, h = class {
5
- constructor(e) {
6
- r(this, e), this.width = "15", this.height = "15";
7
- }
8
- render() {
9
- return s("svg", { key: "baa6b304adc90eb600c71064ab8ec07b371b1584", width: this.width, height: this.height, fill: "none", xmlns: "http://www.w3.org/2000/svg" }, s("path", { key: "f5fb2b0da29891bc7bec40a3d7537924a2e277f0", fill: "currentColor", d: "M5.5 0C8.53757 0 11 2.46243 11 5.5C11 6.83879 10.5217 8.06586 9.72656 9.01962L13.8536 13.1464C14.0488 13.3417 14.0488 13.6583 13.8536 13.8536C13.68 14.0271 13.4106 14.0464 13.2157 13.9114L13.1464 13.8536L9.01962 9.72656C8.06586 10.5217 6.83879 11 5.5 11C2.46243 11 0 8.53757 0 5.5C0 2.46243 2.46243 0 5.5 0ZM5.5 1C3.01472 1 1 3.01472 1 5.5C1 7.98528 3.01472 10 5.5 10C7.98528 10 10 7.98528 10 5.5C10 3.01472 7.98528 1 5.5 1Z" }));
10
- }
11
- };
12
- h.style = p;
13
- const b = ":host{display:block;position:relative}.dropdown{display:inline-block}.dropbtn{color:black;padding:0.5rem;font-size:1rem;cursor:pointer;display:flex;gap:0.5rem;background:transparent;border:none;border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn:hover,.dropbtn:active{background-color:var(--nylas-base-50);border:1px solid var(--nylas-primary)}.dropbtn:active{border-width:2px}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropbtn span.selected-option{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:144px}@media screen and (max-width: 768px){.dropbtn span.selected-option{max-width:124px}}.dropbtn:hover,.dropbtn:focus{background-color:#f1f1f1}.dropdown-content{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)}.search-box{border-bottom:1px solid var(--nylas-base-200);padding:10px;position:sticky;top:0;background:var(--nylas-base-0)}.search-box .icon{position:absolute;top:1.25rem;left:1.25rem;color:var(--nylas-base-300)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content 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:left}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content a:hover,.dropdown-content a:focus{background-color:var(--nylas-base-100)}.dropdown-content .selected{background-color:#e7e7e7}input[type=text]{width:-webkit-fill-available;padding:inherit;border:1px solid #ccc;border-radius:4px;position:sticky;background:no-repeat scroll 7px 7px;padding-left:30px;background-size:16px 16px}", f = b, C = class {
14
- constructor(e) {
15
- r(this, e), this.selectedOptionChanged = l(this, "selectedOptionChanged", 7), this.name = void 0, this.options = [], this.defaultSelectedOption = void 0, this.selectedOption = this.defaultSelectedOption || null, this.isOpen = !1, this.searchValue = "", this.filteredOptions = [...this.options], this.ariaActivedescendant = "";
16
- }
17
- componentWillLoad() {
18
- this.filteredOptions = this.options, !this.selectedOption && this.options.length > 0 && (this.selectedOption = this.options[0]);
19
- }
20
- toggleDropdown() {
21
- this.isOpen = !this.isOpen;
22
- }
23
- filterOptions(e) {
24
- const t = e.target.value;
25
- this.searchValue = t, this.filteredOptions = this.options.filter((i) => i.label.toLowerCase().includes(t.toLowerCase()));
26
- }
27
- selectOption(e) {
28
- this.selectedOption = e, this.toggleDropdown(), this.selectedOptionChanged.emit({
29
- value: e.value,
30
- name: this.name
31
- });
32
- }
33
- handleSelectButtonKeyDown(e) {
34
- var t;
35
- switch (e.key) {
36
- case "ArrowDown":
37
- case "Enter":
38
- e.preventDefault(), this.isOpen || this.toggleDropdown(), (t = this.inputRef) == null || t.focus();
39
- break;
40
- case "Escape":
41
- this.isOpen = !1;
42
- break;
43
- }
44
- }
45
- handleListboxKeydown(e) {
46
- var n, a;
47
- const t = this.filteredOptions, i = t.findIndex((o) => o.value === this.ariaActivedescendant);
48
- if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
49
- if (e.preventDefault(), i === t.length - 1) {
50
- this.ariaActivedescendant = "", (n = this.inputRef) == null || n.focus();
51
- return;
52
- }
53
- const o = i + 1 < t.length ? i + 1 : 0;
54
- this.ariaActivedescendant = t[o].value, this.focusOption(o);
55
- } else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
56
- if (e.preventDefault(), i === 0) {
57
- this.ariaActivedescendant = "", (a = this.inputRef) == null || a.focus();
58
- return;
59
- }
60
- const o = i - 1 >= 0 ? i - 1 : t.length - 1;
61
- this.ariaActivedescendant = t[o].value, this.focusOption(o);
62
- } else
63
- e.key === "Enter" ? (e.preventDefault(), this.ariaActivedescendant && this.selectOption(t[i])) : e.key === "Escape" && (this.isOpen = !1);
64
- }
65
- focusOption(e) {
66
- var a;
67
- const t = this.filteredOptions[e];
68
- if (!t)
69
- return;
70
- const i = t.value, n = (a = this.el.shadowRoot) == null ? void 0 : a.getElementById(i);
71
- n && (n.focus(), n.scrollIntoView({ behavior: "smooth", block: "nearest" }));
72
- }
73
- handleComboboxKeyDown(e) {
74
- e.key === "ArrowDown" || e.key == "Tab" && !e.shiftKey ? (e.preventDefault(), this.ariaActivedescendant = this.filteredOptions[0].value, this.focusOption(0)) : e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey ? (e.preventDefault(), this.ariaActivedescendant = this.filteredOptions[this.filteredOptions.length - 1].value, this.focusOption(this.filteredOptions.length - 1)) : e.key === "Escape" && (this.isOpen = !1);
75
- }
76
- handleOutsideClick(e) {
77
- !e.composedPath().includes(this.el) && this.isOpen && (this.isOpen = !1);
78
- }
79
- render() {
80
- var e;
81
- return s("div", { key: "7ebf4768db42ef9d5a220fe2a3c0fbe8f8c604d3", class: "dropdown" }, s("button", { key: "61a3b0bbae22051a086b0731a5665ab4406e0fb6", class: { dropbtn: !0, open: this.isOpen }, onClick: () => this.toggleDropdown(), "aria-haspopup": "listbox", "aria-expanded": this.isOpen ? "true" : "false", "aria-label": this.name, onKeyDown: (t) => this.handleSelectButtonKeyDown(t) }, s("slot", { key: "524524003a5b1befd04d84a550e8779ba432e6a6", name: "select-icon", "aria-hidden": "true" }), s("span", { key: "55c27a218ae3668c0bc6787fdc43f75b4aa4f421", class: "selected-option" }, (e = this.selectedOption) == null ? void 0 : e.label), s("span", { key: "64e34fc4ce09240416f37653b35a5dc1a4752222", class: this.isOpen ? "open" : "closed", "aria-hidden": "true" }, s("chevron-icon", { key: "9e602e625986844d519a9c6c9bb8ae62f1cdf84d", width: "16", height: "16" }))), this.isOpen ? s("div", { class: "dropdown-content" }, s("div", { class: { "search-box": !0, open: this.isOpen } }, s("search-icon", { width: "15", height: "15", class: "icon" }), s("input", { type: "text", role: "combobox", placeholder: "Search", value: this.searchValue, ref: (t) => this.inputRef = t, onInput: (t) => this.filterOptions(t), onKeyDown: (t) => this.handleComboboxKeyDown(t) })), s("ul", { tabindex: "-1", role: "listbox", "aria-label": this.name, "aria-activedescendant": this.ariaActivedescendant, onKeyDown: (t) => this.handleListboxKeydown(t) }, this.filteredOptions.map((t) => s("li", { tabindex: "0", key: t.value, id: t.value, onClick: () => this.selectOption(t), role: "option" }, `${t.label}`)))) : null);
82
- }
83
- get el() {
84
- return d(this);
85
- }
86
- };
87
- C.style = f;
88
- const u = ".sc-translate-icon-h{display:flex}", x = u, w = class {
89
- constructor(e) {
90
- r(this, e), this.width = "16", this.height = "16";
91
- }
92
- render() {
93
- return s("svg", { key: "482a971e7045aba7372284ea28e2cac899909663", xmlns: "http://www.w3.org/2000/svg", width: this.width, height: this.height, viewBox: "0 0 20 20", fill: "none" }, s("path", { key: "9bac1f8dd4c2317376847fe100875fa50ddeaf03", fill: "currentColor", d: "M14.1663 4.02867C14.4267 4.12081 14.563 4.40654 14.4709 4.66685C14.3501 5.00788 14.2182 5.4771 14.1178 5.86047C14.6877 5.77587 15.2665 5.65653 15.8867 5.51288C16.1557 5.45058 16.4243 5.61815 16.4866 5.88717C16.5489 6.15619 16.3814 6.42479 16.1123 6.4871C15.339 6.66621 14.6101 6.81289 13.8717 6.90283C13.7759 7.35654 13.7014 7.77084 13.6451 8.15021C14.1202 8.04599 14.5738 8.00553 14.9996 8.02075L14.9996 8C14.9996 7.72386 15.2235 7.5 15.4996 7.5C15.7758 7.5 15.9996 7.72386 15.9996 8C15.9996 8.05657 15.9991 8.11281 15.9979 8.16871C17.1392 8.47838 17.9781 9.23987 18.3435 10.2263C18.9579 11.8853 18.1287 13.8787 15.7027 14.9569C15.4504 15.069 15.1549 14.9554 15.0427 14.7031C14.9306 14.4507 15.0442 14.1552 15.2966 14.0431C17.3705 13.1213 17.7913 11.6147 17.4057 10.5737C17.1874 9.984 16.6776 9.44916 15.9129 9.18633C15.6829 10.7237 15.021 11.9466 14.229 12.7925C14.3126 12.9656 14.3958 13.1436 14.4641 13.3151C14.5662 13.5717 14.441 13.8625 14.1844 13.9646C13.9278 14.0667 13.637 13.9415 13.5349 13.6849C13.5066 13.6137 13.4777 13.5463 13.448 13.4802C13.028 13.7794 12.5905 13.9869 12.1705 14.0835C11.5942 14.2161 10.963 14.1517 10.534 13.6942C9.88917 13.0053 9.84361 11.8611 10.2855 10.8412C10.6652 9.96479 11.4186 9.11781 12.5848 8.54034C12.6387 8.07338 12.7199 7.55894 12.8332 6.98891C12.3926 7.00755 11.9403 7.00326 11.4659 6.97127C11.1904 6.95269 10.9821 6.71428 11.0007 6.43876C11.0192 6.16325 11.2577 5.95496 11.5332 5.97353C12.0633 6.00928 12.5641 6.00772 13.0566 5.97553C13.1605 5.55444 13.3512 4.8331 13.5282 4.33317C13.6203 4.07286 13.906 3.93653 14.1663 4.02867ZM12.501 9.74109C11.8436 10.1821 11.427 10.7219 11.2031 11.2387C10.8542 12.0439 10.9881 12.716 11.2638 13.0105C11.2637 13.0104 11.2639 13.0106 11.2638 13.0105C11.3573 13.11 11.5624 13.1973 11.9463 13.109C12.2578 13.0373 12.6311 12.8571 13.0121 12.5576C12.8658 12.22 12.7272 11.8324 12.6313 11.353C12.5405 10.8996 12.4899 10.3743 12.501 9.74109ZM13.7808 11.7797C14.316 11.0956 14.759 10.1665 14.9271 9.01632C14.539 9.00681 14.1111 9.05601 13.6457 9.17854C13.605 9.19274 13.5647 9.20726 13.525 9.22209C13.4663 10.0545 13.5146 10.671 13.6118 11.1568C13.6578 11.3868 13.7156 11.5913 13.7808 11.7797ZM6.92028 5.2159C5.77942 4.88398 4.78409 5.00841 4.07616 5.21575C3.72264 5.3193 3.439 5.44393 3.24121 5.5443C3.14215 5.59457 3.0641 5.63901 3.00903 5.67212C2.98147 5.68868 2.95962 5.70244 2.9437 5.71271L2.92429 5.72542L2.91797 5.72966L2.91566 5.73123L2.91393 5.73241C2.91384 5.73249 2.91436 5.73325 2.94925 5.78397C3.23698 6.20225 3.1703 6.10548 2.91393 5.73241C2.68634 5.88881 2.62863 6.20009 2.78502 6.42767C2.94134 6.65514 3.25207 6.71313 3.47963 6.55703L3.4788 6.5576L3.48576 6.55305C3.49318 6.54826 3.50608 6.5401 3.52423 6.52919C3.56057 6.50735 3.6177 6.47463 3.69373 6.43605C3.84612 6.35872 4.07228 6.2589 4.35724 6.17544C4.92619 6.0088 5.72242 5.90898 6.64043 6.17595C7.35305 6.38517 7.66747 6.76919 7.82692 7.16112C7.98173 7.54163 8.0026 7.95751 8.00531 8.33243C7.46199 8.18407 6.79336 8.03682 6.08385 8.00744C5.04808 7.96456 3.8874 8.17096 2.87738 9.01102C1.98877 9.75011 1.78345 10.8818 2.07014 11.853C2.35713 12.8252 3.14925 13.692 4.31803 13.9348C5.22351 14.123 6.18016 13.8639 6.9599 13.5212C7.3403 13.354 7.69572 13.1594 8.0057 12.9665V13.5C8.0057 13.7761 8.22956 14 8.5057 14C8.78184 14 9.0057 13.7754 9.0057 13.4993L9.0057 8.44586C9.0058 8.05404 9.00595 7.40554 8.7532 6.78428C8.48142 6.11625 7.93342 5.51313 6.92136 5.21622L6.92028 5.2159ZM6.04249 9.00659C6.76366 9.03645 7.44769 9.209 8.0057 9.37205V11.757C7.65814 12.0182 7.13927 12.35 6.55757 12.6057C5.85264 12.9155 5.12729 13.0816 4.52148 12.9557C3.75127 12.7957 3.22322 12.2271 3.02922 11.5699C2.83491 10.9116 2.98777 10.2199 3.51683 9.77985C4.27958 9.14545 5.16917 8.97043 6.04249 9.00659Z" }));
94
- }
95
- };
96
- w.style = x;
97
- export {
98
- h as search_icon,
99
- C as select_dropdown,
100
- w as translate_icon
101
- };