@nylas/react 1.1.0-canary.23 → 1.1.0-canary.24

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 (148) hide show
  1. package/dist/add-circle-icon_2.entry-4a6b44be.js +25 -0
  2. package/dist/add-circle-icon_2.entry-b0e8cb94.cjs +1 -0
  3. package/dist/{archive-icon_7.entry-3dcc4a66.js → archive-icon_7.entry-0d379e81.js} +14 -14
  4. package/dist/{archive-icon_7.entry-2ec9b077.cjs → archive-icon_7.entry-464293d2.cjs} +1 -1
  5. package/dist/{arrow-icon.entry-2cf3e94d.js → arrow-icon.entry-3c2e4e0d.js} +2 -2
  6. package/dist/{arrow-icon.entry-175e8181.cjs → arrow-icon.entry-4e6fe7be.cjs} +1 -1
  7. package/dist/{bold-icon_3.entry-9fc74a39.js → bold-icon_3.entry-5f0eedfe.js} +4 -4
  8. package/dist/{bold-icon_3.entry-a3e61ad8.cjs → bold-icon_3.entry-ba65ceeb.cjs} +1 -1
  9. package/dist/button-component_2.entry-1290a222.js +26 -0
  10. package/dist/button-component_2.entry-ae5e68ec.cjs +1 -0
  11. package/dist/{calendar-agenda-fill-icon_39.entry-493e91f6.js → calendar-agenda-fill-icon_48.entry-4ae8cc76.js} +1966 -1396
  12. package/dist/calendar-agenda-fill-icon_48.entry-eaa36515.cjs +7 -0
  13. package/dist/{calendar-cancel-icon.entry-c9c7e3b3.cjs → calendar-cancel-icon.entry-6506440a.cjs} +1 -1
  14. package/dist/{calendar-cancel-icon.entry-3ca731f9.js → calendar-cancel-icon.entry-d2f0c9e0.js} +4 -4
  15. package/dist/{calendar-check-icon_2.entry-5b8f8a75.cjs → calendar-check-icon_2.entry-0f70758f.cjs} +1 -1
  16. package/dist/{calendar-check-icon_2.entry-7c409a91.js → calendar-check-icon_2.entry-5212c5b3.js} +9 -9
  17. package/dist/{calendar-icon.entry-0589697f.js → calendar-icon.entry-b7626be4.js} +7 -7
  18. package/dist/{calendar-icon.entry-acd00f6f.cjs → calendar-icon.entry-f10bd734.cjs} +1 -1
  19. package/dist/{checkbox-component_2.entry-538fd8ec.js → checkbox-component_2.entry-7ce6d945.js} +3 -3
  20. package/dist/{checkbox-component_2.entry-0aa252b9.cjs → checkbox-component_2.entry-879250a5.cjs} +1 -1
  21. package/dist/{chevron-icon_3.entry-80e03257.js → chevron-icon_3.entry-8c9ca484.js} +14 -14
  22. package/dist/{chevron-icon_3.entry-7076e105.cjs → chevron-icon_3.entry-a2f9e9ba.cjs} +1 -1
  23. package/dist/{clock-icon_4.entry-db3fbda1.js → clock-icon_4.entry-3d9d8690.js} +16 -16
  24. package/dist/{clock-icon_4.entry-d6901afd.cjs → clock-icon_4.entry-7ecb071a.cjs} +1 -1
  25. package/dist/{constants-12bd3c98-26c75011.js → constants-50c3e067-8cc8e601.js} +618 -605
  26. package/dist/{constants-12bd3c98-22fd56f2.cjs → constants-50c3e067-da2d4786.cjs} +5 -5
  27. package/dist/copy-icon.entry-0a80a55e.cjs +1 -0
  28. package/dist/copy-icon.entry-38cfea6b.js +15 -0
  29. package/dist/delete-icon_2.entry-9e7cf99e.cjs +1 -0
  30. package/dist/delete-icon_2.entry-f9a43051.js +25 -0
  31. package/dist/{document-refresh-icon.entry-a3326831.cjs → document-refresh-icon.entry-5d6c4a99.cjs} +1 -1
  32. package/dist/{document-refresh-icon.entry-149f2a3b.js → document-refresh-icon.entry-827975fd.js} +5 -5
  33. package/dist/elements/index.d.ts +9 -1
  34. package/dist/{elements-dc5b338e-e07600d4.js → elements-dc5b338e-0f8b5d33.js} +1 -1
  35. package/dist/{elements-dc5b338e-211879a3.cjs → elements-dc5b338e-3a7e1134.cjs} +1 -1
  36. package/dist/{focus-visible-e8093c16-cb97634f.cjs → focus-visible-e8093c16-088a527d.cjs} +1 -1
  37. package/dist/{focus-visible-e8093c16-284cefe0.js → focus-visible-e8093c16-40f0c20e.js} +1 -1
  38. package/dist/{forward-icon_6.entry-751fdd4e.cjs → forward-icon_6.entry-a8f80871.cjs} +3 -3
  39. package/dist/{forward-icon_6.entry-554b0722.js → forward-icon_6.entry-f984a68b.js} +9 -9
  40. package/dist/{globe-icon.entry-e3dd58bc.js → globe-icon.entry-a78c8ea8.js} +5 -5
  41. package/dist/{globe-icon.entry-63eb510d.cjs → globe-icon.entry-c50fc96c.cjs} +1 -1
  42. package/dist/google-logo-icon_4.entry-14d75c66.cjs +1 -0
  43. package/dist/google-logo-icon_4.entry-710632b6.js +680 -0
  44. package/dist/index-53420959-78cc8138.cjs +1 -0
  45. package/dist/index-53420959-da9158f8.js +5 -0
  46. package/dist/{index-6d9eeb53-cc42c6f1.js → index-6d9eeb53-407c797a.js} +2 -2
  47. package/dist/{index-6d9eeb53-81e5b798.cjs → index-6d9eeb53-cac6eaea.cjs} +1 -1
  48. package/dist/index-a3051853.cjs +42 -0
  49. package/dist/index-eca7f3e2.js +7859 -0
  50. package/dist/{index.es-5355a265-f8853ce4.js → index.es-17b386f4-856af8bb.js} +1 -1
  51. package/dist/{index.es-5355a265-e701a627.cjs → index.es-17b386f4-c6a8cc2a.cjs} +1 -1
  52. package/dist/{info-icon_2.entry-9559cf3b.cjs → info-icon_2.entry-c08c459c.cjs} +1 -1
  53. package/dist/{info-icon_2.entry-3b349f01.js → info-icon_2.entry-ffd39ba3.js} +5 -5
  54. package/dist/input-component.entry-35e6e399.cjs +1 -0
  55. package/dist/input-component.entry-c09124d3.js +65 -0
  56. package/dist/{input-dropdown.entry-9bc68630.js → input-dropdown.entry-83f2c378.js} +8 -6
  57. package/dist/input-dropdown.entry-9ac3e157.cjs +1 -0
  58. package/dist/{mailbox-store-31d55036-c8618c0b.cjs → mailbox-store-2e401c7f-66a87143.cjs} +1 -1
  59. package/dist/{mailbox-store-31d55036-1106efe2.js → mailbox-store-2e401c7f-9d607fd1.js} +2 -2
  60. package/dist/{multi-select-dropdown.entry-36074a81.js → multi-select-dropdown.entry-2c2125e3.js} +2 -2
  61. package/dist/{multi-select-dropdown.entry-e5ed9285.cjs → multi-select-dropdown.entry-8710acb4.cjs} +1 -1
  62. package/dist/nylas-booked-event-card_12.entry-009a11e3.cjs +1 -0
  63. package/dist/nylas-booked-event-card_12.entry-5821b0c4.js +1134 -0
  64. package/dist/{nylas-form-card.entry-6e45c873.js → nylas-form-card.entry-0ce9dd7d.js} +18 -18
  65. package/dist/{nylas-form-card.entry-03a31218.cjs → nylas-form-card.entry-951163a1.cjs} +1 -1
  66. package/dist/{nylas-if-state.entry-61d7ebc5.cjs → nylas-if-state.entry-16aabbff.cjs} +1 -1
  67. package/dist/{nylas-if-state.entry-092f4e1a.js → nylas-if-state.entry-474cfdcd.js} +3 -3
  68. package/dist/{nylas-list-folders.entry-ab9e1c2c.js → nylas-list-folders.entry-a9e53520.js} +7 -7
  69. package/dist/{nylas-list-folders.entry-1abbb401.cjs → nylas-list-folders.entry-f0a4d566.cjs} +1 -1
  70. package/dist/{nylas-list-threads.entry-2faaa2bb.js → nylas-list-threads.entry-5af74949.js} +3 -3
  71. package/dist/{nylas-list-threads.entry-dfc87aca.cjs → nylas-list-threads.entry-7fc8b71d.cjs} +1 -1
  72. package/dist/{nylas-login.entry-243ae09e.js → nylas-login.entry-acbdf23c.js} +7 -7
  73. package/dist/{nylas-login.entry-d1cac0a1.cjs → nylas-login.entry-d0fcf7c4.cjs} +1 -1
  74. package/dist/{nylas-mailbox-pagination.entry-b8225a3e.js → nylas-mailbox-pagination.entry-01f32d0c.js} +2 -2
  75. package/dist/{nylas-mailbox-pagination.entry-c27af71c.cjs → nylas-mailbox-pagination.entry-a70e4777.cjs} +1 -1
  76. package/dist/{nylas-mailbox-toolbar-button.entry-b66d597d.cjs → nylas-mailbox-toolbar-button.entry-208b2667.cjs} +1 -1
  77. package/dist/{nylas-mailbox-toolbar-button.entry-22347d22.js → nylas-mailbox-toolbar-button.entry-a8166cf0.js} +3 -3
  78. package/dist/{nylas-mailbox.entry-cb80f58c.cjs → nylas-mailbox.entry-7a3562b6.cjs} +1 -1
  79. package/dist/{nylas-mailbox.entry-9e6e1b4d.js → nylas-mailbox.entry-bbd33bb0.js} +6 -6
  80. package/dist/{nylas-provider.entry-196dd5da.js → nylas-provider.entry-7e8aedea.js} +39 -39
  81. package/dist/{nylas-provider.entry-28c12448.cjs → nylas-provider.entry-9cce7730.cjs} +1 -1
  82. package/dist/{nylas-reminder-emails.entry-47ef5a9d.cjs → nylas-reminder-emails.entry-287316b6.cjs} +2 -2
  83. package/dist/{nylas-reminder-emails.entry-b655d888.js → nylas-reminder-emails.entry-a1b49b18.js} +9 -9
  84. package/dist/{nylas-reminder-time_2.entry-0f3747fb.cjs → nylas-reminder-time_2.entry-0a480ab7.cjs} +1 -1
  85. package/dist/{nylas-reminder-time_2.entry-9d8f7436.js → nylas-reminder-time_2.entry-6f6067f9.js} +6 -6
  86. package/dist/{nylas-scheduler-editor.entry-feb7a7db.js → nylas-scheduler-editor.entry-625d597e.js} +63 -45
  87. package/dist/{nylas-scheduler-editor.entry-504e8ed3.cjs → nylas-scheduler-editor.entry-6be8e9c6.cjs} +2 -2
  88. package/dist/nylas-scheduling.entry-1678be21.cjs +1 -0
  89. package/dist/nylas-scheduling.entry-fa471c9e.js +340 -0
  90. package/dist/{nylas-threads-refresh.entry-e637161b.cjs → nylas-threads-refresh.entry-77015d63.cjs} +1 -1
  91. package/dist/{nylas-threads-refresh.entry-91af9af3.js → nylas-threads-refresh.entry-da68039b.js} +11 -11
  92. package/dist/{nylas-threads-search.entry-5457dcec.js → nylas-threads-search.entry-27472aef.js} +4 -4
  93. package/dist/{nylas-threads-search.entry-b944f95a.cjs → nylas-threads-search.entry-8f765c67.cjs} +1 -1
  94. package/dist/{nylas-time-window-picker.entry-134ef726.cjs → nylas-time-window-picker.entry-a59d7be6.cjs} +1 -1
  95. package/dist/{nylas-time-window-picker.entry-a6fd216b.js → nylas-time-window-picker.entry-e8842700.js} +10 -10
  96. package/dist/{nylas-view-thread.entry-9296a505.cjs → nylas-view-thread.entry-16cc4066.cjs} +1 -1
  97. package/dist/{nylas-view-thread.entry-6fdd6cb1.js → nylas-view-thread.entry-322a9890.js} +3 -3
  98. package/dist/{person-icon.entry-4a695727.js → person-icon.entry-b62da62d.js} +4 -4
  99. package/dist/{person-icon.entry-1cdb4dc2.cjs → person-icon.entry-fd56c344.cjs} +1 -1
  100. package/dist/{play-icon_2.entry-fb013b17.js → play-icon_2.entry-d0a67f7b.js} +7 -7
  101. package/dist/play-icon_2.entry-d17c9937.cjs +1 -0
  102. package/dist/react.cjs +1 -1
  103. package/dist/react.js +108 -100
  104. package/dist/{refresh-icon.entry-9dbb04ba.cjs → refresh-icon.entry-5427ec8d.cjs} +1 -1
  105. package/dist/{refresh-icon.entry-46c92605.js → refresh-icon.entry-99d7fbcb.js} +4 -4
  106. package/dist/{register-component-592986c5-d5d210a8.js → register-component-4487ac6f-4b0c1c53.js} +1 -1
  107. package/dist/{register-component-592986c5-5edf5835.cjs → register-component-4487ac6f-b29bf135.cjs} +1 -1
  108. package/dist/scheduler-config-store-2a3b403d-51c51cff.cjs +1 -0
  109. package/dist/{scheduler-config-store-9ccfba4d-b08031b5.js → scheduler-config-store-2a3b403d-810ef774.js} +5 -4
  110. package/dist/scheduler-store-55107657-25845a8b.cjs +1 -0
  111. package/dist/{scheduler-store-fd0d11a5-313e8592.js → scheduler-store-55107657-6c0c5de4.js} +179 -132
  112. package/dist/{textarea-component.entry-788eb37a.cjs → textarea-component.entry-8bdfbcc9.cjs} +1 -1
  113. package/dist/{textarea-component.entry-0cd3b57f.js → textarea-component.entry-9803d3c3.js} +4 -4
  114. package/dist/{time-period-selector.entry-112c0b64.js → time-period-selector.entry-a6c6aefd.js} +41 -41
  115. package/dist/time-period-selector.entry-d7792301.cjs +1 -0
  116. package/dist/{translate-icon.entry-c701b391.cjs → translate-icon.entry-4970d886.cjs} +1 -1
  117. package/dist/{translate-icon.entry-a4df3c16.js → translate-icon.entry-d65cfcea.js} +6 -6
  118. package/dist/{warning-icon.entry-bda0aafa.cjs → warning-icon.entry-870059cb.cjs} +1 -1
  119. package/dist/{warning-icon.entry-d1703715.js → warning-icon.entry-eb7da408.js} +5 -5
  120. package/package.json +3 -3
  121. package/dist/add-circle-icon_3.entry-37a88ff3.js +0 -79
  122. package/dist/add-circle-icon_3.entry-4f8f1cbf.cjs +0 -1
  123. package/dist/button-component.entry-7fdb3bca.cjs +0 -1
  124. package/dist/button-component.entry-861637f2.js +0 -16
  125. package/dist/calendar-agenda-fill-icon_39.entry-3c21a3ec.cjs +0 -7
  126. package/dist/checkmark-icon.entry-0a184b31.cjs +0 -1
  127. package/dist/checkmark-icon.entry-56302db0.js +0 -15
  128. package/dist/copy-icon_3.entry-33e89a37.cjs +0 -1
  129. package/dist/copy-icon_3.entry-9670b9f9.js +0 -35
  130. package/dist/google-logo-icon_5.entry-bccce7f4.cjs +0 -1
  131. package/dist/google-logo-icon_5.entry-e462e091.js +0 -748
  132. package/dist/index-53420959-02fe58ef.js +0 -5
  133. package/dist/index-53420959-0b9c205e.cjs +0 -1
  134. package/dist/index-8a536089.cjs +0 -42
  135. package/dist/index-a15916e5.js +0 -7653
  136. package/dist/input-dropdown.entry-d454f6bc.cjs +0 -1
  137. package/dist/loading-icon.entry-1d49e471.js +0 -15
  138. package/dist/loading-icon.entry-a68da48b.cjs +0 -1
  139. package/dist/nylas-booked-event-card_10.entry-38d2fd2e.js +0 -954
  140. package/dist/nylas-booked-event-card_10.entry-e530a8db.cjs +0 -1
  141. package/dist/nylas-booking-confirmation-type.entry-2fea82f9.js +0 -106
  142. package/dist/nylas-booking-confirmation-type.entry-5857a863.cjs +0 -1
  143. package/dist/nylas-scheduling.entry-8c8f8e35.cjs +0 -1
  144. package/dist/nylas-scheduling.entry-d35efa9a.js +0 -286
  145. package/dist/play-icon_2.entry-10fd617e.cjs +0 -1
  146. package/dist/scheduler-config-store-9ccfba4d-3ec35859.cjs +0 -1
  147. package/dist/scheduler-store-fd0d11a5-b180b3b7.cjs +0 -1
  148. package/dist/time-period-selector.entry-1e0b720b.cjs +0 -1
@@ -1,286 +0,0 @@
1
- import { k as g, r as L, c as k, d as _, l as x, m as A, n as N, h as i, H as y, g as R, F as E } from "./index-a15916e5.js";
2
- import { n as I, N as F } from "./index.es-5355a265-f8853ce4.js";
3
- import { E as C, C as P, N as S } from "./scheduler-store-fd0d11a5-313e8592.js";
4
- import { L as O } from "./constants-12bd3c98-26c75011.js";
5
- import "react";
6
- import "react-dom";
7
- class j {
8
- constructor({ schedulerAPIURL: e, nylasSchedulerStore: s, sessionId: n, configId: a }) {
9
- if (!e)
10
- throw new Error("schedulerAPIURL is required");
11
- if (!s)
12
- throw new Error("nylasSchedulerStore is required");
13
- if (!n && !a)
14
- throw new Error("sessionId is required for private configs, if not config id is required for public configs");
15
- e === "/" && (e = new URL(window.location.href).origin), this.configId = a, this.sessionId = n, this.schedulerAPIURL = e, this.nylasSchedulerStore = s;
16
- }
17
- init() {
18
- _("NylasConnector init");
19
- }
20
- get schedulerStore() {
21
- return this.nylasSchedulerStore;
22
- }
23
- get scheduler() {
24
- return this._schedulerAPIConnector ? this._schedulerAPIConnector : (this._schedulerAPIConnector = new S({
25
- schedulerAPIURL: this.schedulerAPIURL,
26
- schedulerStore: this.schedulerStore,
27
- sessionId: this.sessionId,
28
- configId: this.configId
29
- }), this._schedulerAPIConnector);
30
- }
31
- resetStores() {
32
- this.nylasSchedulerStore.reset();
33
- }
34
- }
35
- const w = (t, e) => {
36
- const s = t.isLoading, n = t.showNotification, a = t.nylasBranding;
37
- return i(
38
- E,
39
- null,
40
- n && i("nylas-notification", null),
41
- s && i(
42
- "div",
43
- { class: "loading" },
44
- i(
45
- "div",
46
- { class: "left" },
47
- i("div", { class: "skeleton" })
48
- ),
49
- i(
50
- "div",
51
- { class: "right" },
52
- i("div", { class: "skeleton" }),
53
- i("div", { class: "skeleton" }),
54
- i("div", { class: "skeleton" }),
55
- i("div", { class: "skeleton" }),
56
- i("div", { class: "skeleton" })
57
- )
58
- ),
59
- !s && e,
60
- i("div", { class: "footer" }, a && i(
61
- E,
62
- null,
63
- "Powered by ",
64
- i("nylas-logo", null)
65
- ))
66
- );
67
- }, D = (t, e) => i("div", { class: "message-banner" }, e), H = ':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05), 0px 10px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;font-family:var(--nylas-font-family);font-optical-sizing:auto;font-style:normal;font-variation-settings:"slnt" 0}@media screen and (max-width: 768px){:host{width:auto;min-width:325px}}:root{font-family:inherit}.error{padding:8rem 12rem;color:var(--nylas-base-0);background-color:var(--nylas-error);margin:1.5rem;border-radius:var(--nylas-border-radius-2x)}.message-banner{text-align:right;color:var(--nylas-base-800);padding:1rem;border-bottom:1px solid var(--nylas-color-primary-200);margin-top:1rem}.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;background:var(--nylas-base-50)}@media screen and (max-width: 768px){.booked-event-page,.cancelled-event-page,.cancel-flow-page{min-width:90%}}.left-panel{display:flex;flex-direction:column;min-width:424px;border-top-left-radius:inherit;background:var(--nylas-base-0);position:relative;padding:1rem 0 0 0;height:624px}@media screen and (max-width: 768px){.left-panel{border-top-right-radius:inherit;min-width:unset;height:auto}}@media screen and (max-width: 768px){.select-date-page .left-panel{padding:0.5rem 4px 0;height:624px}}.border{margin-left:-20px;margin-right:-20px;border-top-width:1px;height:0.5px;background-color:var(--nylas-base-200)}@media screen and (max-width: 768px){.border{display:none}}.right-panel{min-width:360px;width:360px;background-color:var(--nylas-base-50);height:624px;padding-top:16px;border-left:1px solid var(--nylas-base-200);border-top-right-radius:inherit}@media screen and (max-width: 768px){.right-panel{border-top-right-radius:0px;width:inherit;min-width:unset;height:auto}}.right-panel h2{display:flex;margin:0;height:48px;gap:0.5rem;justify-content:center;align-items:center;width:auto;font-size:1.125rem;line-height:1.5rem;font-weight:500;text-align:center;color:var(--nylas-base-800)}.additional-data-page .left-panel{background-color:var(--nylas-base-50)}.additional-data-page .right-panel{background-color:var(--nylas-base-0)}nylas-selected-event-card{height:604px;padding:0 1rem}@media screen and (max-width: 768px){nylas-selected-event-card{height:250px}}.footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;font-size:14px;font-weight:300;color:var(--nylas-base-500);border-top:1px solid var(--nylas-base-200);min-height:24px}.footer svg{fill:var(--nylas-base-500)}.footer svg{margin-top:1px}nylas-selected-event-card::part(nsec__timezone){position:absolute;bottom:0}nylas-notification{margin:1.5rem;width:-webkit-fill-available;width:-moz-available;position:absolute}nylas-locale-switch{position:absolute;padding:18px 20px;bottom:0;width:-webkit-fill-available;width:-moz-available;border-top:1px solid var(--nylas-base-200)}@media screen and (max-width: 768px){nylas-locale-switch{height:auto}}nylas-date-picker{padding:0 20px}', M = H, B = { title: g.t("genericErrorTitle"), type: I.Error, category: C.Component }, U = class {
68
- constructor(t) {
69
- L(this, t), this.init = k(this, "init", 7), this.schedulerWillLoad = k(this, "schedulerWillLoad", 7), this.schedulerDidLoad = k(this, "schedulerDidLoad", 7), this.nylasSchedulerError = k(this, "nylasSchedulerError", 7), this.bookingRefExtracted = k(this, "bookingRefExtracted", 7), this.mode = "app", this.defaultSchedulerState = void 0, this.sessionId = void 0, this.schedulerApiUrl = "https://api.us.nylas.com", this.bookingInfo = void 0, this.rescheduleBookingRef = void 0, this.cancelBookingRef = void 0, this.configurationId = void 0, this.nylasBranding = !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" }) || `${g.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language;
70
- }
71
- connectedCallback() {
72
- _("[nylas-scheduler] connectedCallback");
73
- }
74
- async componentWillLoad() {
75
- var s, n;
76
- if (_("[nylas-scheduler] Component will load"), this.schedulerWillLoad.emit(this.host).defaultPrevented)
77
- return;
78
- if (this.stores = {
79
- scheduler: P({
80
- bookingInfo: this.bookingInfo,
81
- nylasBranding: this.nylasBranding,
82
- ...this.defaultSchedulerState
83
- })
84
- }, this.baseProvider = new F(this.host, this.stores, this.automaticComponentRegistration, this.eventOverrides), this.refConfigId = this.configurationId, this.rescheduleBookingRef) {
85
- const [a, o] = x(this.rescheduleBookingRef);
86
- this.refConfigId = a, this.stores.scheduler.set("rescheduleBookingId", o), this.bookingRefExtracted.emit({ configurationId: a, bookingId: o });
87
- } else if (this.cancelBookingRef) {
88
- const [a, o] = x(this.cancelBookingRef);
89
- this.refConfigId = a, this.stores.scheduler.set("cancelBookingId", o), this.bookingRefExtracted.emit({ configurationId: a, bookingId: o });
90
- }
91
- if (!this.checkIfSessionIdOrConfigIdExists())
92
- return;
93
- const e = (s = this.baseProvider) == null ? void 0 : s.getStore("scheduler");
94
- if (this.nylasSchedulerConnector = new j({
95
- schedulerAPIURL: this.schedulerApiUrl,
96
- sessionId: this.sessionId,
97
- configId: this.refConfigId,
98
- nylasSchedulerStore: e
99
- }), this.init.emit(this.host), (n = this.baseProvider) == null || n.componentWillLoad(this.nylasSchedulerConnector), this.themeConfig)
100
- for (const [a, o] of Object.entries(this.themeConfig))
101
- this.host.style.setProperty(`${a}`, o);
102
- }
103
- async componentDidLoad() {
104
- var d, l, f, u, p, b, h;
105
- if ((d = this.baseProvider) == null || d.componentDidLoad(), !this.checkIfSessionIdOrConfigIdExists())
106
- return;
107
- const t = await ((l = this.nylasSchedulerConnector) == null ? void 0 : l.scheduler.getUISettings());
108
- (!t || "error" in t) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t == null ? void 0 : t.error) }, host: this.host });
109
- const e = (f = this.baseProvider) == null ? void 0 : f.getStore("scheduler"), s = (p = (u = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : u.scheduler) == null ? void 0 : p.available_days_in_future, n = e == null ? void 0 : e.get("selectedTimeslot");
110
- if (n && (n != null && n.start_time)) {
111
- if (!this.isTimeslotValid(n))
112
- return;
113
- if (e != null && e.get("showBookingForm")) {
114
- e == null || e.set("selectedDate", n.start_time);
115
- return;
116
- }
117
- }
118
- const a = e == null ? void 0 : e.get("selectedDate"), o = e == null ? void 0 : e.get("availability");
119
- let r;
120
- if (!(o && o.length > 0)) {
121
- if (a) {
122
- const { startTime: c, endTime: m, endTimeForAvailableDaysInFuture: v } = this.validateAvailableDaysInFuture(a, s || 30);
123
- a.getTime() < v * 1e3 && (r = await ((h = this.nylasSchedulerConnector) == null ? void 0 : h.scheduler.getAvailability(c, m)));
124
- } else {
125
- const c = /* @__PURE__ */ new Date(), { startTime: m, endTime: v, endTimeForAvailableDaysInFuture: T } = this.validateAvailableDaysInFuture(c, s || 30);
126
- c.getTime() < T * 1e3 && (r = await ((b = this.nylasSchedulerConnector) == null ? void 0 : b.scheduler.getAvailability(m, v)));
127
- }
128
- if ((!r || "error" in r) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(r == null ? void 0 : r.error) }, host: this.host }), !a) {
129
- let c = /* @__PURE__ */ new Date();
130
- const m = e == null ? void 0 : e.get("availability").find((v) => new Date(v.start_time) > /* @__PURE__ */ new Date());
131
- m && (c = m.start_time), e == null || e.set("selectedDate", c);
132
- }
133
- }
134
- }
135
- componentDisconnected() {
136
- var t;
137
- (t = this.baseProvider) == null || t.componentDisconnected();
138
- }
139
- bookingInfoChanged(t) {
140
- var e;
141
- (e = this.stores) == null || e.scheduler.set("bookingInfo", t);
142
- }
143
- rescheduleBookingRefChanged(t) {
144
- var e, s;
145
- if (t) {
146
- const [n, a] = x(t);
147
- (e = this.stores) == null || e.scheduler.set("rescheduleBookingId", a), this.refConfigId = n, (s = this.nylasSchedulerConnector) == null || s.scheduler.setConfigId(n);
148
- }
149
- }
150
- cancelBookingRefChanged(t) {
151
- var e, s;
152
- if (t) {
153
- const [n, a] = x(t);
154
- (e = this.stores) == null || e.scheduler.set("cancelBookingId", a), this.refConfigId = n, (s = this.nylasSchedulerConnector) == null || s.scheduler.setConfigId(n);
155
- }
156
- }
157
- languageChanged(t) {
158
- const e = t.detail;
159
- this.language = e, g.changeLanguage(e);
160
- }
161
- async registerComponentHandler(t) {
162
- var e;
163
- (e = this.baseProvider) == null || e.registerComponent(t.detail);
164
- }
165
- async unregisterComponentHandler(t) {
166
- var e;
167
- (e = this.baseProvider) == null || e.unregisterComponent(t.detail);
168
- }
169
- async monthChangedHandler(t) {
170
- var r, d, l, f, u, p, b;
171
- const e = t.detail, s = (f = (l = (d = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : d.get("configSettings")) == null ? void 0 : l.scheduler) == null ? void 0 : f.available_days_in_future, { startTime: n, endTime: a, endTimeForAvailableDaysInFuture: o } = this.validateAvailableDaysInFuture(e, s || 30);
172
- if (n < o && e.getTime() < o * 1e3) {
173
- const h = await ((u = this.nylasSchedulerConnector) == null ? void 0 : u.scheduler.getAvailability(n, a));
174
- (!h || "error" in h) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(h == null ? void 0 : h.error) }, host: this.host });
175
- const c = (p = this.stores) == null ? void 0 : p.scheduler.get("selectableDates");
176
- c && c.length > 0 && ((b = this.stores) == null || b.scheduler.set("selectedDate", c[0]));
177
- }
178
- }
179
- async bookButtonClickedHandler(t) {
180
- var a, o, r, d;
181
- const s = (o = (a = this.nylasSchedulerConnector) == null ? void 0 : a.schedulerStore) == null ? void 0 : o.get("rescheduleBookingId");
182
- if (s) {
183
- const l = await ((r = this.nylasSchedulerConnector) == null ? void 0 : r.scheduler.rescheduleBooking(s, t.detail));
184
- (!l || "error" in l) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(l == null ? void 0 : l.error) }, host: this.host });
185
- return;
186
- }
187
- const n = await ((d = this.nylasSchedulerConnector) == null ? void 0 : d.scheduler.bookTimeslot(t.detail));
188
- (!n || "error" in n) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(n == null ? void 0 : n.error) }, host: this.host });
189
- }
190
- dateSelectedHandler(t) {
191
- const e = t.detail;
192
- this.selectedDateLabel = e ? e.toLocaleDateString(void 0, { dateStyle: "full" }) : `${g.t("noDateSelected")}`;
193
- }
194
- cancelBookedEventErrorHandler(t) {
195
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
196
- }
197
- cancelBookedEventValidationErrorHandler(t) {
198
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
199
- }
200
- rescheduleBookedEventErrorHandler(t) {
201
- this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(t.detail.error) }, host: this.host });
202
- }
203
- async getNylasSchedulerStore() {
204
- var t;
205
- return (t = this.baseProvider) == null ? void 0 : t.getStore("scheduler");
206
- }
207
- async getNylasSchedulerConnector() {
208
- return this.nylasSchedulerConnector;
209
- }
210
- async getRef() {
211
- return this.host;
212
- }
213
- getErrorObject(t) {
214
- return {
215
- title: (t == null ? void 0 : t.title) || B.title,
216
- category: (t == null ? void 0 : t.category) || B.category,
217
- type: I.Error,
218
- description: (t == null ? void 0 : t.message) || "",
219
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
220
- ttl: "none"
221
- };
222
- }
223
- checkIfSessionIdOrConfigIdExists() {
224
- return !this.sessionId && !this.refConfigId ? (this.nylasSchedulerError.emit({
225
- notification: {
226
- title: g.t("noSessionIdErrorTitle"),
227
- category: C.Component,
228
- type: I.Error,
229
- description: g.t("noSessionIdErrorMessage"),
230
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
231
- ttl: "none"
232
- },
233
- host: this.host
234
- }), !1) : !0;
235
- }
236
- isTimeslotValid(t) {
237
- return new Date(t.start_time) < /* @__PURE__ */ new Date() ? (this.nylasSchedulerError.emit({
238
- notification: {
239
- title: g.t("invalidTimeslotErrorTitle"),
240
- category: C.Component,
241
- type: I.Error,
242
- description: g.t("invalidTimeslotErrorMessage"),
243
- id: (/* @__PURE__ */ new Date()).getTime().toString(),
244
- ttl: "none"
245
- },
246
- host: this.host
247
- }), !1) : !0;
248
- }
249
- validateAvailableDaysInFuture(t, e) {
250
- const s = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, a = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, o = Math.floor(A(s, e).getTime() / 1e3), r = Math.min(o, a);
251
- return { startTime: n < s.getTime() / 1e3 ? Math.floor(s.getTime() / 1e3) : n, endTime: r, endTimeForAvailableDaysInFuture: o };
252
- }
253
- render() {
254
- var p, b, h;
255
- const t = this.mode === "app", e = (p = this.baseProvider) == null ? void 0 : p.getStore("scheduler"), s = e == null ? void 0 : e.get("eventInfo"), n = e == null ? void 0 : e.get("showBookingForm"), a = e == null ? void 0 : e.get("cancelledEventInfo"), o = e == null ? void 0 : e.get("cancelBookingId"), r = e == null ? void 0 : e.get("selectedTimeslot"), d = e == null ? void 0 : e.get("rescheduleBookingId"), l = (e == null ? void 0 : e.get("nylasBranding")) || this.nylasBranding, f = e == null ? void 0 : e.get("selectedDate"), u = (h = (b = e == null ? void 0 : e.get("configSettings")) == null ? void 0 : b.scheduler) == null ? void 0 : h.confirmation_redirect_url;
256
- if (this.selectedDateLabel = f && this.language ? N(f.toLocaleDateString(O[this.language], { dateStyle: "full" })) : `${g.t("noDateSelected")}`, t && o && !a)
257
- return i(y, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "cancel-flow-page", part: "cancel-flow-page" }, i("nylas-cancel-booking-form", { selectedTimeslot: r, cancelBookingId: o, exportparts: "ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label" }))));
258
- if (t && a)
259
- return i(y, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "cancelled-event-page", part: "cancelled-event-page" }, i("nylas-cancelled-event-card", { cancelledEventInfo: a, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
260
- if (t && s && u) {
261
- window.location.assign(u);
262
- return;
263
- }
264
- if (t && s)
265
- return i(y, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, i("div", { class: "booked-event-page", part: "booked-event-page" }, i("nylas-booked-event-card", { selectedTimeslot: r, eventInfo: s, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
266
- if (t && (!s || d) && !n) {
267
- const c = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
268
- return i(y, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(D, null, `${g.t("rescheduleTitle")}`), i("div", { class: "select-date-page", part: "select-date-page" }, i("div", { class: "left-panel" }, i("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" }), i("nylas-locale-switch", null)), i("div", { class: "right-panel" }, i("h2", null, i("calendar-icon", null), i("span", { id: "selectedDate" }, this.selectedDateLabel)), i("nylas-timeslot-picker", { exportparts: "ntp, ntp__timeslot, ntp__timeslot--selected, ntp__button-primary" }, c && i("span", { slot: "timeslot-picker-cta-label" }, i("slot", { name: "timeslot-picker-cta-label" })))))));
269
- }
270
- return t && !s && n ? i(y, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(D, null, `${g.t("rescheduleTitle")}`), i("div", { class: "additional-data-page", part: "additional-data-page" }, i("div", { class: "left-panel" }, i("div", { class: "wrapper" }, i("nylas-selected-event-card", { exportparts: "nsec, nsec__card, nsec__icon, nsec__date, nsec__time" }))), i("div", { class: "right-panel" }, i("nylas-booking-form", { exportparts: "nbf, nbf__input-label, nbf__input-textfield, nbf__button-ghost, nbf__button-primary, nbf__button-outline" }))))) : i(y, null, i("slot", null));
271
- }
272
- get host() {
273
- return R(this);
274
- }
275
- static get watchers() {
276
- return {
277
- bookingInfo: ["bookingInfoChanged"],
278
- rescheduleBookingRef: ["rescheduleBookingRefChanged"],
279
- cancelBookingRef: ["cancelBookingRefChanged"]
280
- };
281
- }
282
- };
283
- U.style = M;
284
- export {
285
- U as nylas_scheduling
286
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-8a536089.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:"5a9ce615105ea3f8c35bc612c7eac3d2d4237ff1",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"4d0c2aec1fb3c5a03e73681ac5aa20522562e369",d:"M21 12L3 21V3L21 12Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};s.style=c;const n=".sc-stop-icon-h{display:flex}",h=n,i=class{constructor(e){t.registerInstance(this,e),this.width="15",this.height="15"}render(){return t.h("svg",{key:"6bc52dd5897d50d9919f61ce68373b0e3ecca94c",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"34813760da3c3dffe9f7046b006c5be50fa7c9b0",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};i.style=h;exports.play_icon=s;exports.stop_icon=i;
@@ -1 +0,0 @@
1
- "use strict";const r=require("./index-8a536089.cjs");function a(n={}){const i={selectedConfiguration:{},configurations:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],hideEditorTabs:[],...n},e=r.createStore(i);function t(){e.set("selectedConfiguration",{...n.selectedConfiguration})}return e.onChange("action",async o=>{o||t()}),{...e,resetSelectedConfiguration:t}}exports.CreateNylasSchedulerConfigStore=a;
@@ -1 +0,0 @@
1
- "use strict";const c=require("./index-8a536089.cjs");exports.ErrorCategory=void 0;(function(a){a.Component="component",a.Api="api",a.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var D;(function(a){a.endtime_not_in_future="endtime_not_in_future",a.no_booking_info="no_booking_info",a.no_timeslot_selected="no_timeslot_selected",a.no_timezone_selected="no_timezone_selected",a.no_booking_id="no_booking_id",a.invalid_start_time="invalid_start_time",a.invalid_end_time="invalid_end_time",a.invalid_timezone="invalid_timezone"})(D||(D={}));var E;(function(a){a.invalid_session="invalid_session",a.general_error="general_error",a.internal_error="internal_error",a.invalid_request_error="invalid_request_error",a.timeslot_not_available="timeslot_not_available",a.provider_error="provider_error",a.not_found_error="not_found_error"})(E||(E={}));class P{constructor(){this.component=e=>{const t=exports.ErrorCategory.Component,s=`${e} Error`;return{endtime_not_in_future:(i='"endtime" can not be in the future')=>({title:s,message:i,category:t}),no_booking_info:(i="No booking info provided")=>({title:s,message:i,category:t}),no_timeslot_selected:(i="No timeslot selected")=>({title:s,message:i,category:t}),no_timezone_selected:(i="No timezone selected")=>({title:s,message:i,category:t}),no_booking_id:(i="No booking id provided")=>({title:s,message:i,category:t}),invalid_start_time:(i="Invalid start time")=>({title:s,message:i,category:t}),invalid_end_time:(i="Invalid end time")=>({title:s,message:i,category:t}),invalid_timezone:(i="Invalid timezone")=>({title:s,message:i,category:t})}},this.api=e=>{const t=exports.ErrorCategory.Api,s=`${e} Error`;return{invalid_session:i=>({title:s,message:i,category:t}),general_error:i=>({title:s,message:i,category:t}),internal_error:i=>({title:s,message:i,category:t}),invalid_request_error:i=>({title:s,message:i,category:t}),timeslot_not_available:i=>({title:s,message:i,category:t}),provider_error:i=>({title:s,message:i,category:t}),not_found_error:i=>({title:s,message:i,category:t})}}}}class M{constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i}){this.errors=new P,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const r=new URL(this.schedulerAPIURL);return r.pathname=e,await(await fetch(decodeURIComponent(r.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,...i},body:s})).json()}catch(r){return{error:{message:r.message,title:"API request failed",type:"api"}}}}getErrorMessage(e){var s,i,r,n;let t=(e==null?void 0:e.message)||(e==null?void 0:e.title)||"Something went wrong";return(e==null?void 0:e.type)==="provider_error"&&(t=((i=(s=e==null?void 0:e.provider_error)==null?void 0:s.error)==null?void 0:i.message)||((n=(r=e==null?void 0:e.provider_error)==null?void 0:r.error)==null?void 0:n.title)||"Something went wrong"),t}setConfigId(e){this.configId=e}selectDate(e){this.schedulerStore.set("selectedDate",e),this.schedulerStore.set("selectedTimeslot",null)}selectTime(e){this.schedulerStore.set("selectedTimeslot",e)}selectTimezone(e){this.schedulerStore.set("selectedTimezone",e)}selectLanguage(e){this.schedulerStore.set("selectedLanguage",e),c.instance.changeLanguage(e)}async toggleAdditionalData(e){e||await this.refetchAvailability(),this.schedulerStore.set("showBookingForm",e)}setParticipantName(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,name:e}})}setParticipantEmail(e){const{bookingInfo:t}=this.schedulerStore.state;this.schedulerStore.set("bookingInfo",{...t,primaryParticipant:{...t==null?void 0:t.primaryParticipant,email:e}})}async refetchAvailability(){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),1).getTime()/1e3,s=t<e.getTime()/1e3?Math.floor(e.getTime()/1e3):t,i=new Date(e.getFullYear(),e.getMonth()+1,1).getTime()/1e3;return await this.getAvailability(s,i)}async resetStoreStateAndFetchAvailability(){const e=new Date,t=await this.refetchAvailability(),s=this.schedulerStore.get("availability").find(r=>new Date(r.start_time)>new Date);let i=e;return s&&(i=s.start_time),this.schedulerStore.set("selectedDate",i),this.schedulerStore.set("eventInfo",null),this.schedulerStore.set("showBookingForm",!1),this.schedulerStore.set("selectedTimeslot",null),t}async setReschedule(e){this.schedulerStore.set("isLoading",!0);const t=this.schedulerStore.state.eventInfo;return t&&this.schedulerStore.set("reschedulingEventInfo",t),this.schedulerStore.set("rescheduleBookingId",e),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async bookTimeslot(e){var m;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component(c.instance.t("createBookingErrorTitle")).no_booking_info()};const r=(e==null?void 0:e.timeslot)||t;if(!r)return{error:this.errors.component(c.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const n=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s;if(!n)return{error:this.errors.component(c.instance.t("createBookingErrorTitle")).no_timezone_selected()};const o=this.schedulerStore.get("availabilityOrderEmails");let u="";if(o.length>0){const g=r.emails;for(let d=0;d<o.length;d++)if(g.includes(o[d])){u=o[d];break}}const _=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,h=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],y=e?e==null?void 0:e.additionalFields:i==null?void 0:i.additionalFields,I=this.getHeaders(),S=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:""}`,l=await this.makeAPIRequest(decodeURIComponent(S),"POST",JSON.stringify({participants:u?[{email:u}]:void 0,additional_fields:y,additional_guests:h,guest:{..._},start_time:r.start_time.getTime()/1e3,end_time:r.end_time.getTime()/1e3,timezone:n}),I);if("error"in l){this.schedulerStore.set("isLoading",!1);const g=(m=l.error)==null?void 0:m.type;let d=l.error;if(g&&g in this.errors.api("Create Booking")){const T=this.getErrorMessage(d);d=this.errors.api("Create Booking")[g](T)}return{error:d}}return"data"in l&&this.schedulerStore.set("eventInfo",l==null?void 0:l.data),this.schedulerStore.set("isLoading",!1),l}async getUISettings(){var r;this.schedulerStore.set("isLoading",!0);const e=this.getHeaders(),s=`/v3/scheduling/ui-settings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:""}`,i=await this.makeAPIRequest(s,"GET",void 0,e);if("error"in i){this.schedulerStore.set("isLoading",!1);const n=(r=i.error)==null?void 0:r.type;let o=i.error;return n&&n in this.errors.api(c.instance.t("getUISettingErrorTitle"))&&(o=this.errors.api(c.instance.t("getUISettingErrorTitle"))[n]((o==null?void 0:o.message)||(o==null?void 0:o.title)||"Something went wrong")),{error:o}}return"data"in i&&this.schedulerStore.set("configSettings",i.data),this.schedulerStore.set("isLoading",!1),i}getStartTimeWithMinBookingNotice(e){var i;const t=(i=this.schedulerStore.get("configSettings"))==null?void 0:i.scheduler,s=t==null?void 0:t.min_booking_notice;return s?e+s*60:e}getEndTimeForAvailableDaysInFuture(e){var n,o;const t=new Date,s=(o=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler)==null?void 0:o.available_days_in_future,i=Math.floor(c.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var y,I,f,S;this.schedulerStore.set("isLoading",!0);const s=new URLSearchParams,i=new Date,r=i.getTime();if(t&&t<r/1e3)return this.schedulerStore.set("isLoading",!1),{error:this.errors.component(c.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const l=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(l.getTime()/1e3)}if(e=this.getStartTimeWithMinBookingNotice(e),!t){const l=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(l.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t),s.append("start_time",encodeURIComponent(e.toString())),s.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId&&s.append("configuration_id",encodeURIComponent(this.configId));const n=this.schedulerStore.get("rescheduleBookingId");n&&s.append("booking_id",encodeURIComponent(n));const o=s.toString(),u=`/v3/scheduling/availability${o?`?${o}`:""}`,_=this.getHeaders(),h=await this.makeAPIRequest(decodeURIComponent(u),"GET",void 0,_);if("error"in h){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const l=(y=h.error)==null?void 0:y.type;let m=h.error;if(l&&l in this.errors.api(c.instance.t("getAvailabilityErrorTitle"))){const g=this.getErrorMessage(m);m=this.errors.api(c.instance.t("getAvailabilityErrorTitle"))[l](g)}return{error:m}}if("data"in h){const m=(((f=(I=h.data)==null?void 0:I.time_slots)==null?void 0:f.map(d=>({...d,start_time:new Date(d.start_time*1e3),end_time:new Date(d.end_time*1e3)})))||[]).filter(d=>d.start_time.getTime()>r);this.schedulerStore.set("availability",m);const g=((S=h.data)==null?void 0:S.order)||[];this.schedulerStore.set("availabilityOrderEmails",g)}return this.schedulerStore.set("isLoading",!1),h}async cancelBooking(e,t){var o;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(c.instance.t("cancelBookingErrorTitle")).no_booking_id()};const s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:"",i=`/v3/scheduling/bookings/${e}${s}`,r=this.getHeaders(),n=await this.makeAPIRequest(decodeURIComponent(i),"DELETE",JSON.stringify({action:"cancel",cancellation_reason:t}),r);if("error"in n){this.schedulerStore.set("isLoading",!1);const u=(o=n.error)==null?void 0:o.type;let _=n.error;if(u&&u in this.errors.api(c.instance.t("cancelBookingErrorTitle"))){const h=this.getErrorMessage(_);_=this.errors.api(c.instance.t("cancelBookingErrorTitle"))[u](h)}return{error:_}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),n}async rescheduleBooking(e,t){var w;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(c.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const s=this.errors.api(c.instance.t("rescheduleBookingErrorTitle")),i=this.errors.component(c.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:r,selectedTimeslot:n,selectedTimezone:o}=this.schedulerStore.state,{startTime:u,endTime:_,timezone:h}=t,y=u||(n==null?void 0:n.start_time);if(!y)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const I=_||(n==null?void 0:n.end_time);if(!I)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const f=this.schedulerStore.get("availabilityOrderEmails");let S="";if(f.length>0){const b=(n==null?void 0:n.emails)||[];for(let v=0;v<f.length;v++)if(b.includes(f[v])){S=f[v];break}}const l=h||o;if(!l)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const m=t?t==null?void 0:t.primaryParticipant:r==null?void 0:r.primaryParticipant,g=t?(t==null?void 0:t.guests)||[]:(r==null?void 0:r.guests)||[],d=t?t==null?void 0:t.additionalFields:r==null?void 0:r.additionalFields,T=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:"",A=`/v3/scheduling/bookings/${e}${T}`,L=this.getHeaders(),p=await this.makeAPIRequest(decodeURIComponent(A),"PATCH",JSON.stringify({start_time:y.getTime()/1e3,end_time:I.getTime()/1e3,time_zone:l,additional_fields:d,guest:{...m},additional_guests:g,participants:S?[{email:S}]:void 0}),L);if("error"in p){this.schedulerStore.set("isLoading",!1);const b=(w=p.error)==null?void 0:w.type;let v=p.error;if(b&&b in s){const B=this.getErrorMessage(v);v=s[b](B)}return{error:v}}const k=this.schedulerStore.get("reschedulingEventInfo");if("data"in p)this.schedulerStore.set("eventInfo",p==null?void 0:p.data);else if(k)this.schedulerStore.set("eventInfo",k);else{const b={booking_id:e};this.schedulerStore.set("eventInfo",b)}return this.schedulerStore.set("isLoading",!1),p}}function z(a={}){const e={selectedDate:null,selectedLanguage:navigator.language,selectedTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,selectedTimeslot:null,showBookingForm:!1,availabilityOrderEmails:[],selectableDates:null,availability:[],eventDuration:0,state:"ready",eventInfo:null,cancelledEventInfo:null,isLoading:!1,nylasBranding:!0,...a};c.debug("[defaultNylasStoreState]: ",e);const t=c.createStore(e);return t.onChange("availability",s=>{c.debug("[availability]: ",s);const i=s.map(o=>o.start_time);c.debug("[selectableDates]: ",i),t.set("selectableDates",i);const r=s[0];if(!r)return;const n=Math.floor((r.end_time.getTime()-r.start_time.getTime())/6e4);c.debug("[durationMinutes]: ",n),t.set("eventDuration",n)}),t.reset=()=>{for(const s in e){const i=e[s];t.set(s,i)}},t}exports.CreateNylasSchedulerStore=z;exports.NylaSchedulerAPIConnector=M;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-8a536089.cjs");require("react");require("react-dom");const s=".time-period-selector.sc-time-period-selector{display:grid;gap:0.5rem;grid-template-columns:auto 1fr}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector,.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector{width:116px}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{width:84px;display:flex;align-items:center}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){width:100%}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown){width:inherit;height:100%}.time-period-selector.sc-time-period-selector input-dropdown#time-number.sc-time-period-selector::part(id_dropdown-input){border:none;border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-input){padding:17px;gap:1rem}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-content){width:100%;max-height:200px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown){width:inherit}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem;justify-content:space-between}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}",n=s,p={hours:"hour",days:"day",weeks:"week",months:"month"},o=class{constructor(e){d.registerInstance(this,e),this.timePeriodChanged=d.createEvent(this,"timePeriodChanged",7),this.timePeriods=["hour","day","week","month"],this.defaultSelectedPeriod="hour",this.defaultSelectedNumber=1,this.selectedPeriod=this.defaultSelectedPeriod,this.selectedNumber=this.defaultSelectedNumber,this.numberOptions=this.calculateOptions(this.defaultSelectedPeriod||"hour").map(t=>({label:t.toString(),value:t.toString()})),this.timePeriodOptions=this.timePeriods.map(t=>({label:t,value:t}))}defaultSelectedPeriodChangedHandler(e){this.selectedPeriod=e;const t=p[e]??e;this.updateNumberOptionsAndSelectedNumber(t)}defaultSelectedNumberChangedHandler(e){this.selectedNumber=e}timePeriodsChangedHandler(e){this.timePeriodOptions=e.map(t=>({label:t,value:t}))}calculateOptions(e){switch(e){case"hour":return Array.from({length:23},(t,r)=>r+1);case"minute":return Array.from({length:13},(t,r)=>r*5);case"day":return Array.from({length:30},(t,r)=>r+1);case"week":return Array.from({length:4},(t,r)=>r+1);case"month":return Array.from({length:12},(t,r)=>r+1);default:return[]}}inputOptionChangedHandler(e){d.debug("time-period-selector","inputOptionChangedHandler",e.detail);const{value:t,name:r}=e.detail;r==="time-number"&&(this.selectedNumber=parseInt(t));const i={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(i)}nylasFormDropdownChangedHandler(e){d.debug("time-period-selector","nylasFormDropdownChangedHandler",e.detail);const{value:t,name:r}=e.detail;r==="time-period"?(this.selectedPeriod=t,this.updateNumberOptionsAndSelectedNumber(t)):r==="time-number"&&(this.selectedNumber=parseInt(t));const i={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(i)}updateNumberOptionsAndSelectedNumber(e){const t=this.calculateOptions(e);this.numberOptions=t.map(r=>({label:r.toString(),value:r.toString()})),this.selectedNumber=parseInt(this.numberOptions[0].value)}render(){return d.h("div",{key:"216eccd8453c89f66463c99bfc18018f98732671",class:"time-period-selector"},d.h("input-dropdown",{key:"985debdbe86850c13f26450b9e1a5e29b3b04594",id:"time-number",name:"time-number",inputValue:this.selectedNumber.toString(),exportparts:"sd_dropdown: tps__number-dropdown, sd_dropdown-button: tps__number-dropdown-button, sd_dropdown-content: tps__number-dropdown-content",options:this.numberOptions,defaultInputOption:this.numberOptions.find(e=>e.value==this.selectedNumber.toString())??this.numberOptions[0]}),d.h("select-dropdown",{key:"5039a6dcad6b8e426875a20f690dc5898536a8ba",id:"time-period",name:"time-period",options:this.timePeriodOptions,exportparts:"sd_dropdown: tps__period-dropdown, sd_dropdown-button: tps__period-dropdown-button, sd_dropdown-content: tps__period-dropdown-content",pluralizedLabel:this.selectedNumber>1?"s":"",defaultSelectedOption:this.timePeriodOptions.find(e=>e.value==this.selectedPeriod)??this.timePeriodOptions[0],withSearch:!1}))}get host(){return d.getElement(this)}static get watchers(){return{defaultSelectedPeriod:["defaultSelectedPeriodChangedHandler"],defaultSelectedNumber:["defaultSelectedNumberChangedHandler"],timePeriods:["timePeriodsChangedHandler"]}}};o.style=n;exports.time_period_selector=o;