@nylas/react 1.1.0-canary.22 → 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.
- package/dist/add-circle-icon_2.entry-4a6b44be.js +25 -0
- package/dist/add-circle-icon_2.entry-b0e8cb94.cjs +1 -0
- package/dist/{archive-icon_7.entry-d14abebc.js → archive-icon_7.entry-0d379e81.js} +14 -14
- package/dist/{archive-icon_7.entry-1c2e5b68.cjs → archive-icon_7.entry-464293d2.cjs} +1 -1
- package/dist/{arrow-icon.entry-8dd5bfb5.js → arrow-icon.entry-3c2e4e0d.js} +2 -2
- package/dist/{arrow-icon.entry-61290104.cjs → arrow-icon.entry-4e6fe7be.cjs} +1 -1
- package/dist/{bold-icon_3.entry-cc7319da.js → bold-icon_3.entry-5f0eedfe.js} +4 -4
- package/dist/{bold-icon_3.entry-c5502b92.cjs → bold-icon_3.entry-ba65ceeb.cjs} +1 -1
- package/dist/button-component_2.entry-1290a222.js +26 -0
- package/dist/button-component_2.entry-ae5e68ec.cjs +1 -0
- package/dist/{calendar-agenda-fill-icon_40.entry-b33080d8.js → calendar-agenda-fill-icon_48.entry-4ae8cc76.js} +2163 -1625
- package/dist/calendar-agenda-fill-icon_48.entry-eaa36515.cjs +7 -0
- package/dist/{calendar-cancel-icon.entry-bbf56125.cjs → calendar-cancel-icon.entry-6506440a.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-fcc89777.js → calendar-cancel-icon.entry-d2f0c9e0.js} +4 -4
- package/dist/{calendar-check-icon_2.entry-64d553de.cjs → calendar-check-icon_2.entry-0f70758f.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-e7691b84.js → calendar-check-icon_2.entry-5212c5b3.js} +9 -9
- package/dist/{calendar-icon.entry-6375e3ed.js → calendar-icon.entry-b7626be4.js} +7 -7
- package/dist/{calendar-icon.entry-9cea89bc.cjs → calendar-icon.entry-f10bd734.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-751f4638.js → checkbox-component_2.entry-7ce6d945.js} +3 -3
- package/dist/{checkbox-component_2.entry-9a89cf14.cjs → checkbox-component_2.entry-879250a5.cjs} +1 -1
- package/dist/{chevron-icon_3.entry-b4995425.js → chevron-icon_3.entry-8c9ca484.js} +14 -14
- package/dist/{chevron-icon_3.entry-97c91007.cjs → chevron-icon_3.entry-a2f9e9ba.cjs} +1 -1
- package/dist/{clock-icon_4.entry-d2e007e5.js → clock-icon_4.entry-3d9d8690.js} +16 -16
- package/dist/{clock-icon_4.entry-cd6ac47d.cjs → clock-icon_4.entry-7ecb071a.cjs} +1 -1
- package/dist/{constants-67de2eec-31cbc722.js → constants-50c3e067-8cc8e601.js} +619 -606
- package/dist/{constants-67de2eec-8286f29c.cjs → constants-50c3e067-da2d4786.cjs} +5 -5
- package/dist/copy-icon.entry-0a80a55e.cjs +1 -0
- package/dist/copy-icon.entry-38cfea6b.js +15 -0
- package/dist/delete-icon_2.entry-9e7cf99e.cjs +1 -0
- package/dist/delete-icon_2.entry-f9a43051.js +25 -0
- package/dist/{document-refresh-icon.entry-12833775.cjs → document-refresh-icon.entry-5d6c4a99.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-817322ba.js → document-refresh-icon.entry-827975fd.js} +5 -5
- package/dist/elements/index.d.ts +11 -0
- package/dist/{elements-dc5b338e-d885666f.js → elements-dc5b338e-0f8b5d33.js} +1 -1
- package/dist/{elements-dc5b338e-3a8522b8.cjs → elements-dc5b338e-3a7e1134.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-17bb48f2.cjs → focus-visible-e8093c16-088a527d.cjs} +1 -1
- package/dist/{focus-visible-e8093c16-78717e30.js → focus-visible-e8093c16-40f0c20e.js} +1 -1
- package/dist/{forward-icon_6.entry-074fd345.cjs → forward-icon_6.entry-a8f80871.cjs} +3 -3
- package/dist/{forward-icon_6.entry-39b55b30.js → forward-icon_6.entry-f984a68b.js} +9 -9
- package/dist/{globe-icon.entry-a1875d7e.js → globe-icon.entry-a78c8ea8.js} +5 -5
- package/dist/{globe-icon.entry-dee4c2b0.cjs → globe-icon.entry-c50fc96c.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-14d75c66.cjs +1 -0
- package/dist/google-logo-icon_4.entry-710632b6.js +680 -0
- package/dist/index-53420959-78cc8138.cjs +1 -0
- package/dist/index-53420959-da9158f8.js +5 -0
- package/dist/{index-6d9eeb53-f37ff819.js → index-6d9eeb53-407c797a.js} +2 -2
- package/dist/{index-6d9eeb53-b71b16c5.cjs → index-6d9eeb53-cac6eaea.cjs} +1 -1
- package/dist/index-a3051853.cjs +42 -0
- package/dist/index-eca7f3e2.js +7859 -0
- package/dist/{index.es-b16d0cf5-b1cecbdd.js → index.es-17b386f4-856af8bb.js} +1 -1
- package/dist/{index.es-b16d0cf5-4ce1fb63.cjs → index.es-17b386f4-c6a8cc2a.cjs} +1 -1
- package/dist/{info-icon_2.entry-67a3e2c3.cjs → info-icon_2.entry-c08c459c.cjs} +1 -1
- package/dist/{info-icon_2.entry-6fd10047.js → info-icon_2.entry-ffd39ba3.js} +5 -5
- package/dist/input-component.entry-35e6e399.cjs +1 -0
- package/dist/{add-circle-icon_2.entry-404b178a.js → input-component.entry-c09124d3.js} +19 -23
- package/dist/{input-dropdown.entry-e677224a.js → input-dropdown.entry-83f2c378.js} +8 -6
- package/dist/input-dropdown.entry-9ac3e157.cjs +1 -0
- package/dist/{mailbox-store-f11de360-8f269e26.cjs → mailbox-store-2e401c7f-66a87143.cjs} +1 -1
- package/dist/{mailbox-store-f11de360-79ba75b1.js → mailbox-store-2e401c7f-9d607fd1.js} +2 -2
- package/dist/{multi-select-dropdown.entry-e46f5cfb.js → multi-select-dropdown.entry-2c2125e3.js} +2 -2
- package/dist/{multi-select-dropdown.entry-d053b2fb.cjs → multi-select-dropdown.entry-8710acb4.cjs} +1 -1
- package/dist/nylas-booked-event-card_12.entry-009a11e3.cjs +1 -0
- package/dist/nylas-booked-event-card_12.entry-5821b0c4.js +1134 -0
- package/dist/{nylas-form-card.entry-7d69820f.js → nylas-form-card.entry-0ce9dd7d.js} +19 -19
- package/dist/{nylas-form-card.entry-a063402d.cjs → nylas-form-card.entry-951163a1.cjs} +1 -1
- package/dist/{nylas-if-state.entry-54a6948f.cjs → nylas-if-state.entry-16aabbff.cjs} +1 -1
- package/dist/{nylas-if-state.entry-9e7df799.js → nylas-if-state.entry-474cfdcd.js} +3 -3
- package/dist/{nylas-list-folders.entry-013ffceb.js → nylas-list-folders.entry-a9e53520.js} +7 -7
- package/dist/{nylas-list-folders.entry-d08423d4.cjs → nylas-list-folders.entry-f0a4d566.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-d3f575a5.js → nylas-list-threads.entry-5af74949.js} +3 -3
- package/dist/{nylas-list-threads.entry-be9bc422.cjs → nylas-list-threads.entry-7fc8b71d.cjs} +1 -1
- package/dist/{nylas-login.entry-d82e8ee0.js → nylas-login.entry-acbdf23c.js} +7 -7
- package/dist/{nylas-login.entry-e7015d8f.cjs → nylas-login.entry-d0fcf7c4.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-99339476.js → nylas-mailbox-pagination.entry-01f32d0c.js} +2 -2
- package/dist/{nylas-mailbox-pagination.entry-22866764.cjs → nylas-mailbox-pagination.entry-a70e4777.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-09faed21.cjs → nylas-mailbox-toolbar-button.entry-208b2667.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-b8929b00.js → nylas-mailbox-toolbar-button.entry-a8166cf0.js} +3 -3
- package/dist/{nylas-mailbox.entry-91ca6af1.cjs → nylas-mailbox.entry-7a3562b6.cjs} +1 -1
- package/dist/{nylas-mailbox.entry-6e8d4f9c.js → nylas-mailbox.entry-bbd33bb0.js} +6 -6
- package/dist/{nylas-provider.entry-cc32369c.js → nylas-provider.entry-7e8aedea.js} +39 -39
- package/dist/{nylas-provider.entry-b80d5e74.cjs → nylas-provider.entry-9cce7730.cjs} +1 -1
- package/dist/nylas-reminder-emails.entry-287316b6.cjs +4 -0
- package/dist/nylas-reminder-emails.entry-a1b49b18.js +129 -0
- package/dist/nylas-reminder-time_2.entry-0a480ab7.cjs +1 -0
- package/dist/nylas-reminder-time_2.entry-6f6067f9.js +105 -0
- package/dist/{nylas-scheduler-editor.entry-5e0475d8.js → nylas-scheduler-editor.entry-625d597e.js} +68 -49
- package/dist/{nylas-scheduler-editor.entry-c7f7bf6c.cjs → nylas-scheduler-editor.entry-6be8e9c6.cjs} +2 -2
- package/dist/nylas-scheduling.entry-1678be21.cjs +1 -0
- package/dist/nylas-scheduling.entry-fa471c9e.js +340 -0
- package/dist/{nylas-threads-refresh.entry-ef2ad409.cjs → nylas-threads-refresh.entry-77015d63.cjs} +1 -1
- package/dist/{nylas-threads-refresh.entry-e200efb9.js → nylas-threads-refresh.entry-da68039b.js} +11 -11
- package/dist/{nylas-threads-search.entry-85a0bc7d.js → nylas-threads-search.entry-27472aef.js} +4 -4
- package/dist/{nylas-threads-search.entry-a260ce6f.cjs → nylas-threads-search.entry-8f765c67.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-cb33b696.cjs → nylas-time-window-picker.entry-a59d7be6.cjs} +1 -1
- package/dist/{nylas-time-window-picker.entry-c9b2a7ca.js → nylas-time-window-picker.entry-e8842700.js} +12 -12
- package/dist/{nylas-view-thread.entry-219511ac.cjs → nylas-view-thread.entry-16cc4066.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-f302c441.js → nylas-view-thread.entry-322a9890.js} +3 -3
- package/dist/{person-icon.entry-8f8b928f.js → person-icon.entry-b62da62d.js} +4 -4
- package/dist/{person-icon.entry-6b20ac42.cjs → person-icon.entry-fd56c344.cjs} +1 -1
- package/dist/{play-icon_2.entry-3aa92414.js → play-icon_2.entry-d0a67f7b.js} +7 -7
- package/dist/play-icon_2.entry-d17c9937.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.js +111 -100
- package/dist/{refresh-icon.entry-de5001c7.cjs → refresh-icon.entry-5427ec8d.cjs} +1 -1
- package/dist/{refresh-icon.entry-0d80c9c5.js → refresh-icon.entry-99d7fbcb.js} +4 -4
- package/dist/{register-component-b2a51b20-ea46761a.js → register-component-4487ac6f-4b0c1c53.js} +1 -1
- package/dist/{register-component-b2a51b20-09664950.cjs → register-component-4487ac6f-b29bf135.cjs} +1 -1
- package/dist/scheduler-config-store-2a3b403d-51c51cff.cjs +1 -0
- package/dist/{scheduler-config-store-9ccfba4d-92cb99d1.js → scheduler-config-store-2a3b403d-810ef774.js} +5 -4
- package/dist/scheduler-store-55107657-25845a8b.cjs +1 -0
- package/dist/{scheduler-store-db06b30a-cee61c58.js → scheduler-store-55107657-6c0c5de4.js} +179 -132
- package/dist/{textarea-component.entry-670f72a7.cjs → textarea-component.entry-8bdfbcc9.cjs} +1 -1
- package/dist/{textarea-component.entry-c2d1900c.js → textarea-component.entry-9803d3c3.js} +4 -4
- package/dist/{time-period-selector.entry-a03b1ce1.js → time-period-selector.entry-a6c6aefd.js} +41 -41
- package/dist/time-period-selector.entry-d7792301.cjs +1 -0
- package/dist/{translate-icon.entry-b483f6b3.cjs → translate-icon.entry-4970d886.cjs} +1 -1
- package/dist/{translate-icon.entry-8a2878ba.js → translate-icon.entry-d65cfcea.js} +6 -6
- package/dist/{warning-icon.entry-784f7818.cjs → warning-icon.entry-870059cb.cjs} +1 -1
- package/dist/{warning-icon.entry-68b3f25e.js → warning-icon.entry-eb7da408.js} +5 -5
- package/package.json +3 -3
- package/dist/add-circle-icon_2.entry-d44a0d4b.cjs +0 -1
- package/dist/button-component.entry-71de5b6b.js +0 -16
- package/dist/button-component.entry-92c46833.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_40.entry-242956c2.cjs +0 -10
- package/dist/checkmark-icon.entry-136b682c.js +0 -15
- package/dist/checkmark-icon.entry-6bca8604.cjs +0 -1
- package/dist/close-icon.entry-d1348fa8.cjs +0 -1
- package/dist/close-icon.entry-d4d4da48.js +0 -15
- package/dist/copy-icon_3.entry-e41eb1a0.js +0 -35
- package/dist/copy-icon_3.entry-f614fc20.cjs +0 -1
- package/dist/google-logo-icon_4.entry-3c3101ea.js +0 -637
- package/dist/google-logo-icon_4.entry-44c3f539.cjs +0 -1
- package/dist/index-26f8bbeb.cjs +0 -42
- package/dist/index-53420959-a444c1cf.cjs +0 -1
- package/dist/index-53420959-b26d1293.js +0 -5
- package/dist/index-5da0aff3.js +0 -7638
- package/dist/input-dropdown.entry-701ab8b7.cjs +0 -1
- package/dist/loading-icon.entry-3f54b204.js +0 -15
- package/dist/loading-icon.entry-558c2382.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-32911b16.cjs +0 -1
- package/dist/nylas-booked-event-card_10.entry-545261f6.js +0 -953
- package/dist/nylas-custom-booking-flow.entry-49b82a11.cjs +0 -1
- package/dist/nylas-custom-booking-flow.entry-6639c5fb.js +0 -106
- package/dist/nylas-scheduling.entry-047cd53a.cjs +0 -1
- package/dist/nylas-scheduling.entry-c79596db.js +0 -282
- package/dist/play-icon_2.entry-c8114634.cjs +0 -1
- package/dist/scheduler-config-store-9ccfba4d-a677e77b.cjs +0 -1
- package/dist/scheduler-store-db06b30a-08429fc9.cjs +0 -1
- package/dist/time-period-selector.entry-3ccfc000.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-26f8bbeb.cjs"),b=require("./register-component-b2a51b20-09664950.cjs");require("react");require("react-dom");const g=':host{display:block;--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;width:inherit}.nylas-custom-booking-flow{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-custom-booking-flow .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading{padding-bottom:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .label{display:flex;align-items:center;gap:0.5rem;margin:1rem 1rem 0;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button{margin:0 1rem;padding:0;width:inherit;height:48px;color:black;font-size:1rem;cursor:not-allowed;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button span{padding:0 1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown{padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label{display:flex;align-items:center;gap:4px;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label tooltip-component{display:flex}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown){width:100%}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button){width:100%;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-content){width:100%;max-width:unset}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}',f=g;var m=function(o,n,t,a){var l=arguments.length,s=l<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,t):a,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,n,t,a);else for(var r=o.length-1;r>=0;r--)(i=o[r])&&(s=(l<3?i(s):l>3?i(n,t,s):i(n,t))||s);return l>3&&s&&Object.defineProperty(n,t,s),s},d=function(o,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,n)};const c=class{constructor(o){e.registerInstance(this,o),this.valueChanged=e.createEvent(this,"valueChanged",7),o.$hostElement$["s-ei"]?this.internals=o.$hostElement$["s-ei"]:(this.internals=o.$hostElement$.attachInternals(),o.$hostElement$["s-ei"]=this.internals),this.selectedConfiguration=void 0,this.name="booking-type",this.bookingType="",this.selectedBookingType=""}elementNameChangedHandler(o){e.debug("nylas-custom-booking-flow","elementNameChangedHandler",o),this.host.setAttribute("name",o)}selectedConfigurationChangedHandler(o,n){var t,a;e.debug("nylas-custom-booking-flow","selectedConfigurationChangedHandler",o,n),(t=o==null?void 0:o.event_booking)!=null&&t.booking_type&&(this.bookingType=(a=o==null?void 0:o.event_booking)==null?void 0:a.booking_type),typeof this.internals.setFormValue=="function"&&this.internals.setFormValue(this.bookingType.toString(),this.name),this.selectedBookingType=this.bookingType}connectedCallback(){e.debug("nylas-custom-booking-flow","connectedCallback")}disconnectedCallback(){e.debug("nylas-custom-booking-flow","disconnectedCallback")}componentWillLoad(){e.debug("nylas-custom-booking-flow","componentWillLoad"),this.host.setAttribute("name",this.name)}componentDidLoad(){e.debug("nylas-custom-booking-flow","componentDidLoad")}componentWillUpdate(){e.debug("nylas-custom-booking-flow","componentWillUpdate")}componentDidUpdate(){e.debug("nylas-custom-booking-flow","componentDidUpdate")}componentWillRender(){e.debug("nylas-custom-booking-flow","componentWillRender")}componentDidRender(){e.debug("nylas-custom-booking-flow","componentDidRender")}nylasFormDropdownChangedHandler(o){e.debug("nylas-custom-booking-flow","nylasFormDropdownChangedHandler",o.detail);const n=t=>{const{value:a}=t.detail;this.selectedBookingType=a,this.internals.setFormValue(a.toString(),this.name)};this.valueChanged.emit({...o.detail,valueChanged:n})}render(){const o=[{label:"Automatically accept bookings",value:"booking"},{label:"Manually confirm/decline bookings",value:"pre-booking"}];return e.h(e.Host,{key:"79853eb2437caf39c59f82c936165234331b1348"},e.h("div",{key:"81abe8d086f8889f8d5450562a6a2bbb07308857",class:"nylas-custom-booking-flow",part:"ncbf"},e.h("div",{key:"9cbe5505ba1ab47170f2016e8949bc0a626332bc",class:"header",part:"ncbf__header"},e.h("h3",{key:"bc7c5a49d01b5edd4a162cbc980234ffa67146ea"},"Customize booking flow"),e.h("p",{key:"42e7fe230baca52029fc3f240fd5d54368000a2f"},"Customize how new bookings are handled when a booking is completed.")),o.length>0&&e.h("div",{class:"nylas-custom-booking-flow__dropdown"},e.h("span",{class:"label"},"After a booking is confirmed",e.h("tooltip-component",null,e.h("info-icon",{slot:"tooltip-icon"}),e.h("span",{slot:"tooltip-content"},"Choose how you’d like to handle new bookings. If you choose to manually confirm/decline bookings, you will be able to review and accept or decline each booking request."))),e.h("select-dropdown",{name:"booking-type",options:o,withSearch:!1,exportparts:"sd_dropdown: ncbf__dropdown, sd_dropdown-button: ncbf__dropdown-button, sd_dropdown-content: ncbf__dropdown-content",defaultSelectedOption:o.find(n=>n.value==this.bookingType)??o[0]}))))}static get formAssociated(){return!0}get host(){return e.getElement(this)}static get watchers(){return{name:["elementNameChangedHandler"],selectedConfiguration:["selectedConfigurationChangedHandler"]}}};m([b.RegisterComponent({name:"nylas-custom-booking-flow",stateToProps:new Map([["schedulerConfig.selectedConfiguration","selectedConfiguration"]]),eventToProps:{valueChanged:async(o,n)=>{const{valueChanged:t}=o.detail;t&&t(o)}},fireRegisterEvent:!0}),d("design:type",Function),d("design:paramtypes",[]),d("design:returntype",void 0)],c.prototype,"render",null);c.style=f;exports.nylas_custom_booking_flow=c;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { r as f, c as m, d as t, h as a, H as g, g as p } from "./index-5da0aff3.js";
|
|
2
|
-
import { R as y } from "./register-component-b2a51b20-ea46761a.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import "react-dom";
|
|
5
|
-
const u = ':host{display:block;--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;width:inherit}.nylas-custom-booking-flow{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-custom-booking-flow .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-custom-booking-flow .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading{padding-bottom:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .label{display:flex;align-items:center;gap:0.5rem;margin:1rem 1rem 0;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button{margin:0 1rem;padding:0;width:inherit;height:48px;color:black;font-size:1rem;cursor:not-allowed;display:flex;gap:0.5rem;justify-content:space-between;align-items:center;background:transparent;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.nylas-custom-booking-flow .nylas-custom-booking-flow__loading .loading-button span{padding:0 1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown{padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label{display:flex;align-items:center;gap:4px;color:var(--nylas-base-800)}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown span.label tooltip-component{display:flex}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown){width:100%}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button){width:100%;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-content){width:100%;max-width:unset}.nylas-custom-booking-flow .nylas-custom-booking-flow__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}', h = u;
|
|
6
|
-
var w = function(o, n, e, s) {
|
|
7
|
-
var i = arguments.length, l = i < 3 ? n : s === null ? s = Object.getOwnPropertyDescriptor(n, e) : s, r;
|
|
8
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
9
|
-
l = Reflect.decorate(o, n, e, s);
|
|
10
|
-
else
|
|
11
|
-
for (var d = o.length - 1; d >= 0; d--)
|
|
12
|
-
(r = o[d]) && (l = (i < 3 ? r(l) : i > 3 ? r(n, e, l) : r(n, e)) || l);
|
|
13
|
-
return i > 3 && l && Object.defineProperty(n, e, l), l;
|
|
14
|
-
}, c = function(o, n) {
|
|
15
|
-
if (typeof Reflect == "object" && typeof Reflect.metadata == "function")
|
|
16
|
-
return Reflect.metadata(o, n);
|
|
17
|
-
};
|
|
18
|
-
const b = class {
|
|
19
|
-
constructor(o) {
|
|
20
|
-
f(this, o), this.valueChanged = m(this, "valueChanged", 7), o.$hostElement$["s-ei"] ? this.internals = o.$hostElement$["s-ei"] : (this.internals = o.$hostElement$.attachInternals(), o.$hostElement$["s-ei"] = this.internals), this.selectedConfiguration = void 0, this.name = "booking-type", this.bookingType = "", this.selectedBookingType = "";
|
|
21
|
-
}
|
|
22
|
-
elementNameChangedHandler(o) {
|
|
23
|
-
t("nylas-custom-booking-flow", "elementNameChangedHandler", o), this.host.setAttribute("name", o);
|
|
24
|
-
}
|
|
25
|
-
selectedConfigurationChangedHandler(o, n) {
|
|
26
|
-
var e, s;
|
|
27
|
-
t("nylas-custom-booking-flow", "selectedConfigurationChangedHandler", o, n), (e = o == null ? void 0 : o.event_booking) != null && e.booking_type && (this.bookingType = (s = o == null ? void 0 : o.event_booking) == null ? void 0 : s.booking_type), typeof this.internals.setFormValue == "function" && this.internals.setFormValue(this.bookingType.toString(), this.name), this.selectedBookingType = this.bookingType;
|
|
28
|
-
}
|
|
29
|
-
connectedCallback() {
|
|
30
|
-
t("nylas-custom-booking-flow", "connectedCallback");
|
|
31
|
-
}
|
|
32
|
-
disconnectedCallback() {
|
|
33
|
-
t("nylas-custom-booking-flow", "disconnectedCallback");
|
|
34
|
-
}
|
|
35
|
-
componentWillLoad() {
|
|
36
|
-
t("nylas-custom-booking-flow", "componentWillLoad"), this.host.setAttribute("name", this.name);
|
|
37
|
-
}
|
|
38
|
-
componentDidLoad() {
|
|
39
|
-
t("nylas-custom-booking-flow", "componentDidLoad");
|
|
40
|
-
}
|
|
41
|
-
componentWillUpdate() {
|
|
42
|
-
t("nylas-custom-booking-flow", "componentWillUpdate");
|
|
43
|
-
}
|
|
44
|
-
componentDidUpdate() {
|
|
45
|
-
t("nylas-custom-booking-flow", "componentDidUpdate");
|
|
46
|
-
}
|
|
47
|
-
componentWillRender() {
|
|
48
|
-
t("nylas-custom-booking-flow", "componentWillRender");
|
|
49
|
-
}
|
|
50
|
-
componentDidRender() {
|
|
51
|
-
t("nylas-custom-booking-flow", "componentDidRender");
|
|
52
|
-
}
|
|
53
|
-
nylasFormDropdownChangedHandler(o) {
|
|
54
|
-
t("nylas-custom-booking-flow", "nylasFormDropdownChangedHandler", o.detail);
|
|
55
|
-
const n = (e) => {
|
|
56
|
-
const { value: s } = e.detail;
|
|
57
|
-
this.selectedBookingType = s, this.internals.setFormValue(s.toString(), this.name);
|
|
58
|
-
};
|
|
59
|
-
this.valueChanged.emit({ ...o.detail, valueChanged: n });
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
const o = [
|
|
63
|
-
{
|
|
64
|
-
label: "Automatically accept bookings",
|
|
65
|
-
value: "booking"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: "Manually confirm/decline bookings",
|
|
69
|
-
value: "pre-booking"
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
return a(g, { key: "79853eb2437caf39c59f82c936165234331b1348" }, a("div", { key: "81abe8d086f8889f8d5450562a6a2bbb07308857", class: "nylas-custom-booking-flow", part: "ncbf" }, a("div", { key: "9cbe5505ba1ab47170f2016e8949bc0a626332bc", class: "header", part: "ncbf__header" }, a("h3", { key: "bc7c5a49d01b5edd4a162cbc980234ffa67146ea" }, "Customize booking flow"), a("p", { key: "42e7fe230baca52029fc3f240fd5d54368000a2f" }, "Customize how new bookings are handled when a booking is completed.")), o.length > 0 && a("div", { class: "nylas-custom-booking-flow__dropdown" }, a("span", { class: "label" }, "After a booking is confirmed", a("tooltip-component", null, a("info-icon", { slot: "tooltip-icon" }), a("span", { slot: "tooltip-content" }, "Choose how you’d like to handle new bookings. If you choose to manually confirm/decline bookings, you will be able to review and accept or decline each booking request."))), a("select-dropdown", { name: "booking-type", options: o, withSearch: !1, exportparts: "sd_dropdown: ncbf__dropdown, sd_dropdown-button: ncbf__dropdown-button, sd_dropdown-content: ncbf__dropdown-content", defaultSelectedOption: o.find((n) => n.value == this.bookingType) ?? o[0] }))));
|
|
73
|
-
}
|
|
74
|
-
static get formAssociated() {
|
|
75
|
-
return !0;
|
|
76
|
-
}
|
|
77
|
-
get host() {
|
|
78
|
-
return p(this);
|
|
79
|
-
}
|
|
80
|
-
static get watchers() {
|
|
81
|
-
return {
|
|
82
|
-
name: ["elementNameChangedHandler"],
|
|
83
|
-
selectedConfiguration: ["selectedConfigurationChangedHandler"]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
w([
|
|
88
|
-
y({
|
|
89
|
-
name: "nylas-custom-booking-flow",
|
|
90
|
-
stateToProps: /* @__PURE__ */ new Map([["schedulerConfig.selectedConfiguration", "selectedConfiguration"]]),
|
|
91
|
-
eventToProps: {
|
|
92
|
-
valueChanged: async (o, n) => {
|
|
93
|
-
const { valueChanged: e } = o.detail;
|
|
94
|
-
e && e(o);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
fireRegisterEvent: !0
|
|
98
|
-
}),
|
|
99
|
-
c("design:type", Function),
|
|
100
|
-
c("design:paramtypes", []),
|
|
101
|
-
c("design:returntype", void 0)
|
|
102
|
-
], b.prototype, "render", null);
|
|
103
|
-
b.style = h;
|
|
104
|
-
export {
|
|
105
|
-
b as nylas_custom_booking_flow
|
|
106
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-26f8bbeb.cjs"),v=require("./index.es-b16d0cf5-4ce1fb63.cjs"),k=require("./scheduler-store-db06b30a-08429fc9.cjs"),C=require("./constants-67de2eec-8286f29c.cjs");require("react");require("react-dom");class E{constructor({schedulerAPIURL:e,nylasSchedulerStore:a,sessionId:i,configId:s}){if(!e)throw new Error("schedulerAPIURL is required");if(!a)throw new Error("nylasSchedulerStore is required");if(!i&&!s)throw new Error("sessionId is required for private configs, if not config id is required for public configs");e==="/"&&(e=new URL(window.location.href).origin),this.configId=s,this.sessionId=i,this.schedulerAPIURL=e,this.nylasSchedulerStore=a}init(){t.debug("NylasConnector init")}get schedulerStore(){return this.nylasSchedulerStore}get scheduler(){return this._schedulerAPIConnector?this._schedulerAPIConnector:(this._schedulerAPIConnector=new k.NylaSchedulerAPIConnector({schedulerAPIURL:this.schedulerAPIURL,schedulerStore:this.schedulerStore,sessionId:this.sessionId,configId:this.configId}),this._schedulerAPIConnector)}resetStores(){this.nylasSchedulerStore.reset()}}const y=(n,e)=>{const a=n.isLoading,i=n.showNotification,s=n.nylasBranding;return t.h(t.Fragment,null,i&&t.h("nylas-notification",null),a&&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"}))),!a&&e,t.h("div",{class:"footer"},s&&t.h(t.Fragment,null,"Powered by ",t.h("nylas-logo",null))))},x=(n,e)=>t.h("div",{class:"message-banner"},e),D=':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}',B=D,w={title:t.instance.t("genericErrorTitle"),type:v.nr.Error,category:k.ErrorCategory.Component},I=class{constructor(n){t.registerInstance(this,n),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.bookingRefExtracted=t.createEvent(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=new Date().toLocaleDateString(void 0,{dateStyle:"full"})||`${t.instance.t("noDateSelected")}`,this.refConfigId=void 0,this.language=navigator.language}connectedCallback(){t.debug("[nylas-scheduler] connectedCallback")}async componentWillLoad(){var a,i;if(t.debug("[nylas-scheduler] Component will load"),this.schedulerWillLoad.emit(this.host).defaultPrevented)return;if(this.stores={scheduler:k.CreateNylasSchedulerStore({bookingInfo:this.bookingInfo,nylasBranding:this.nylasBranding,...this.defaultSchedulerState})},this.baseProvider=new v.NylasBaseProvider(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides),this.refConfigId=this.configurationId,this.rescheduleBookingRef){const[s,o]=t.compactStringToUUIDs(this.rescheduleBookingRef);this.refConfigId=s,this.stores.scheduler.set("rescheduleBookingId",o),this.bookingRefExtracted.emit({configurationId:s,bookingId:o})}else if(this.cancelBookingRef){const[s,o]=t.compactStringToUUIDs(this.cancelBookingRef);this.refConfigId=s,this.stores.scheduler.set("cancelBookingId",o),this.bookingRefExtracted.emit({configurationId:s,bookingId:o})}if(!this.checkIfSessionIdOrConfigIdExists())return;const e=(a=this.baseProvider)==null?void 0:a.getStore("scheduler");if(this.nylasSchedulerConnector=new E({schedulerAPIURL:this.schedulerApiUrl,sessionId:this.sessionId,configId:this.refConfigId,nylasSchedulerStore:e}),this.init.emit(this.host),(i=this.baseProvider)==null||i.componentWillLoad(this.nylasSchedulerConnector),this.themeConfig)for(const[s,o]of Object.entries(this.themeConfig))this.host.style.setProperty(`${s}`,o)}async componentDidLoad(){var d,l,h,g,f,b,u;if((d=this.baseProvider)==null||d.componentDidLoad(),!this.checkIfSessionIdOrConfigIdExists())return;const n=await((l=this.nylasSchedulerConnector)==null?void 0:l.scheduler.getUISettings());(!n||"error"in n)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n==null?void 0:n.error)},host:this.host});const e=(h=this.baseProvider)==null?void 0:h.getStore("scheduler"),a=(f=(g=e==null?void 0:e.get("configSettings"))==null?void 0:g.scheduler)==null?void 0:f.available_days_in_future,i=e==null?void 0:e.get("selectedTimeslot");if(i&&(i!=null&&i.start_time)){if(!this.isTimeslotValid(i))return;if(e!=null&&e.get("showBookingForm")){e==null||e.set("selectedDate",i.start_time);return}}const s=e==null?void 0:e.get("selectedDate"),o=e==null?void 0:e.get("availability");let r;if(!(o&&o.length>0)){if(s){const{startTime:c,endTime:p,endTimeForAvailableDaysInFuture:m}=this.validateAvailableDaysInFuture(s,a||30);s.getTime()<m*1e3&&(r=await((u=this.nylasSchedulerConnector)==null?void 0:u.scheduler.getAvailability(c,p)))}else{const c=new Date,{startTime:p,endTime:m,endTimeForAvailableDaysInFuture:_}=this.validateAvailableDaysInFuture(c,a||30);c.getTime()<_*1e3&&(r=await((b=this.nylasSchedulerConnector)==null?void 0:b.scheduler.getAvailability(p,m)))}if((!r||"error"in r)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(r==null?void 0:r.error)},host:this.host}),!s){let c=new Date;const p=e==null?void 0:e.get("availability").find(m=>new Date(m.start_time)>new Date);p&&(c=p.start_time),e==null||e.set("selectedDate",c)}}}componentDisconnected(){var n;(n=this.baseProvider)==null||n.componentDisconnected()}bookingInfoChanged(n){var e;(e=this.stores)==null||e.scheduler.set("bookingInfo",n)}rescheduleBookingRefChanged(n){var e,a;if(n){const[i,s]=t.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("rescheduleBookingId",s),this.refConfigId=i,(a=this.nylasSchedulerConnector)==null||a.scheduler.setConfigId(i)}}cancelBookingRefChanged(n){var e,a;if(n){const[i,s]=t.compactStringToUUIDs(n);(e=this.stores)==null||e.scheduler.set("cancelBookingId",s),this.refConfigId=i,(a=this.nylasSchedulerConnector)==null||a.scheduler.setConfigId(i)}}languageChanged(n){const e=n.detail;this.language=e,t.instance.changeLanguage(e)}async registerComponentHandler(n){var e;(e=this.baseProvider)==null||e.registerComponent(n.detail)}async unregisterComponentHandler(n){var e;(e=this.baseProvider)==null||e.unregisterComponent(n.detail)}async monthChangedHandler(n){var r,d,l,h,g,f,b;const e=n.detail,a=(h=(l=(d=(r=this.nylasSchedulerConnector)==null?void 0:r.schedulerStore)==null?void 0:d.get("configSettings"))==null?void 0:l.scheduler)==null?void 0:h.available_days_in_future,{startTime:i,endTime:s,endTimeForAvailableDaysInFuture:o}=this.validateAvailableDaysInFuture(e,a||30);if(i<o&&e.getTime()<o*1e3){const u=await((g=this.nylasSchedulerConnector)==null?void 0:g.scheduler.getAvailability(i,s));(!u||"error"in u)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(u==null?void 0:u.error)},host:this.host});const c=(f=this.stores)==null?void 0:f.scheduler.get("selectableDates");c&&c.length>0&&((b=this.stores)==null||b.scheduler.set("selectedDate",c[0]))}}async bookButtonClickedHandler(n){var s,o,r,d;const a=(o=(s=this.nylasSchedulerConnector)==null?void 0:s.schedulerStore)==null?void 0:o.get("rescheduleBookingId");if(a){const l=await((r=this.nylasSchedulerConnector)==null?void 0:r.scheduler.rescheduleBooking(a,n.detail));(!l||"error"in l)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(l==null?void 0:l.error)},host:this.host});return}const i=await((d=this.nylasSchedulerConnector)==null?void 0:d.scheduler.bookTimeslot(n.detail));(!i||"error"in i)&&this.nylasSchedulerError.emit({notification:{...this.getErrorObject(i==null?void 0:i.error)},host:this.host})}dateSelectedHandler(n){const e=n.detail;this.selectedDateLabel=e?e.toLocaleDateString(void 0,{dateStyle:"full"}):`${t.instance.t("noDateSelected")}`}cancelBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}cancelBookedEventValidationErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}rescheduleBookedEventErrorHandler(n){this.nylasSchedulerError.emit({notification:{...this.getErrorObject(n.detail.error)},host:this.host})}async getNylasSchedulerStore(){var n;return(n=this.baseProvider)==null?void 0:n.getStore("scheduler")}async getNylasSchedulerConnector(){return this.nylasSchedulerConnector}async getRef(){return this.host}getErrorObject(n){return{title:(n==null?void 0:n.title)||w.title,category:(n==null?void 0:n.category)||w.category,type:v.nr.Error,description:(n==null?void 0:n.message)||"",id:new Date().getTime().toString(),ttl:"none"}}checkIfSessionIdOrConfigIdExists(){return!this.sessionId&&!this.refConfigId?(this.nylasSchedulerError.emit({notification:{title:t.instance.t("noSessionIdErrorTitle"),category:k.ErrorCategory.Component,type:v.nr.Error,description:t.instance.t("noSessionIdErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}isTimeslotValid(n){return new Date(n.start_time)<new Date?(this.nylasSchedulerError.emit({notification:{title:t.instance.t("invalidTimeslotErrorTitle"),category:k.ErrorCategory.Component,type:v.nr.Error,description:t.instance.t("invalidTimeslotErrorMessage"),id:new Date().getTime().toString(),ttl:"none"},host:this.host}),!1):!0}validateAvailableDaysInFuture(n,e){const a=new Date,i=new Date(n.getFullYear(),n.getMonth(),1).getTime()/1e3,s=new Date(n.getFullYear(),n.getMonth()+1,1).getTime()/1e3,o=Math.floor(t.addDaysToCurrentDate(a,e).getTime()/1e3),r=Math.min(o,s);return{startTime:i<a.getTime()/1e3?Math.floor(a.getTime()/1e3):i,endTime:r,endTimeForAvailableDaysInFuture:o}}render(){var g;const n=this.mode==="app",e=(g=this.baseProvider)==null?void 0:g.getStore("scheduler"),a=e==null?void 0:e.get("eventInfo"),i=e==null?void 0:e.get("showBookingForm"),s=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,h=e==null?void 0:e.get("selectedDate");if(this.selectedDateLabel=h&&this.language?t.capitalizeFirstLetter(h.toLocaleDateString(C.LANGUAGE_CODE_MAP[this.language],{dateStyle:"full"})):`${t.instance.t("noDateSelected")}`,n&&o&&!s)return t.h(t.Host,null,t.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancel-flow-page",part:"cancel-flow-page"},t.h("nylas-cancel-booking-form",{selectedTimeslot:r,cancelBookingId:o,exportparts:"ncbf, ncbf__input-textfield, ncbf__button-cta, ncbf__button-outline, ncbf__input-label"}))));if(n&&s)return t.h(t.Host,null,t.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"cancelled-event-page",part:"cancelled-event-page"},t.h("nylas-cancelled-event-card",{cancelledEventInfo:s,exportparts:"ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card"}))));if(n&&a)return t.h(t.Host,null,t.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},t.h("div",{class:"booked-event-page",part:"booked-event-page"},t.h("nylas-booked-event-card",{selectedTimeslot:r,eventInfo:a,exportparts:"nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta"}))));if(n&&(!a||d)&&!i){const f=this.host.querySelector('[slot="timeslot-picker-cta-label"]');return t.h(t.Host,null,t.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&t.h(x,null,`${t.instance.t("rescheduleTitle")}`),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("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"},f&&t.h("span",{slot:"timeslot-picker-cta-label"},t.h("slot",{name:"timeslot-picker-cta-label"})))))))}return n&&!a&&i?t.h(t.Host,null,t.h(y,{nylasBranding:l,isLoading:this.isLoading,showNotification:this.showNotification},d&&t.h(x,null,`${t.instance.t("rescheduleTitle")}`),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"}))))):t.h(t.Host,null,t.h("slot",null))}get host(){return t.getElement(this)}static get watchers(){return{bookingInfo:["bookingInfoChanged"],rescheduleBookingRef:["rescheduleBookingRefChanged"],cancelBookingRef:["cancelBookingRefChanged"]}}};I.style=B;exports.nylas_scheduling=I;
|
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
import { k as h, r as L, c as k, d as _, l as x, m as A, n as N, h as i, H as m, g as R, F as E } from "./index-5da0aff3.js";
|
|
2
|
-
import { n as I, N as F } from "./index.es-b16d0cf5-b1cecbdd.js";
|
|
3
|
-
import { E as C, C as P, N as S } from "./scheduler-store-db06b30a-cee61c58.js";
|
|
4
|
-
import { L as O } from "./constants-67de2eec-31cbc722.js";
|
|
5
|
-
import "react";
|
|
6
|
-
import "react-dom";
|
|
7
|
-
class j {
|
|
8
|
-
constructor({ schedulerAPIURL: e, nylasSchedulerStore: a, sessionId: n, configId: s }) {
|
|
9
|
-
if (!e)
|
|
10
|
-
throw new Error("schedulerAPIURL is required");
|
|
11
|
-
if (!a)
|
|
12
|
-
throw new Error("nylasSchedulerStore is required");
|
|
13
|
-
if (!n && !s)
|
|
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 = s, this.sessionId = n, this.schedulerAPIURL = e, this.nylasSchedulerStore = a;
|
|
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 a = t.isLoading, n = t.showNotification, s = t.nylasBranding;
|
|
37
|
-
return i(
|
|
38
|
-
E,
|
|
39
|
-
null,
|
|
40
|
-
n && i("nylas-notification", null),
|
|
41
|
-
a && 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
|
-
!a && e,
|
|
60
|
-
i("div", { class: "footer" }, s && 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: h.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" }) || `${h.t("noDateSelected")}`, this.refConfigId = void 0, this.language = navigator.language;
|
|
70
|
-
}
|
|
71
|
-
connectedCallback() {
|
|
72
|
-
_("[nylas-scheduler] connectedCallback");
|
|
73
|
-
}
|
|
74
|
-
async componentWillLoad() {
|
|
75
|
-
var a, 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 [s, o] = x(this.rescheduleBookingRef);
|
|
86
|
-
this.refConfigId = s, this.stores.scheduler.set("rescheduleBookingId", o), this.bookingRefExtracted.emit({ configurationId: s, bookingId: o });
|
|
87
|
-
} else if (this.cancelBookingRef) {
|
|
88
|
-
const [s, o] = x(this.cancelBookingRef);
|
|
89
|
-
this.refConfigId = s, this.stores.scheduler.set("cancelBookingId", o), this.bookingRefExtracted.emit({ configurationId: s, bookingId: o });
|
|
90
|
-
}
|
|
91
|
-
if (!this.checkIfSessionIdOrConfigIdExists())
|
|
92
|
-
return;
|
|
93
|
-
const e = (a = this.baseProvider) == null ? void 0 : a.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 [s, o] of Object.entries(this.themeConfig))
|
|
101
|
-
this.host.style.setProperty(`${s}`, o);
|
|
102
|
-
}
|
|
103
|
-
async componentDidLoad() {
|
|
104
|
-
var d, l, g, u, p, y, f;
|
|
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 = (g = this.baseProvider) == null ? void 0 : g.getStore("scheduler"), a = (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 s = 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 (s) {
|
|
122
|
-
const { startTime: c, endTime: b, endTimeForAvailableDaysInFuture: v } = this.validateAvailableDaysInFuture(s, a || 30);
|
|
123
|
-
s.getTime() < v * 1e3 && (r = await ((f = this.nylasSchedulerConnector) == null ? void 0 : f.scheduler.getAvailability(c, b)));
|
|
124
|
-
} else {
|
|
125
|
-
const c = /* @__PURE__ */ new Date(), { startTime: b, endTime: v, endTimeForAvailableDaysInFuture: T } = this.validateAvailableDaysInFuture(c, a || 30);
|
|
126
|
-
c.getTime() < T * 1e3 && (r = await ((y = this.nylasSchedulerConnector) == null ? void 0 : y.scheduler.getAvailability(b, v)));
|
|
127
|
-
}
|
|
128
|
-
if ((!r || "error" in r) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(r == null ? void 0 : r.error) }, host: this.host }), !s) {
|
|
129
|
-
let c = /* @__PURE__ */ new Date();
|
|
130
|
-
const b = e == null ? void 0 : e.get("availability").find((v) => new Date(v.start_time) > /* @__PURE__ */ new Date());
|
|
131
|
-
b && (c = b.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, a;
|
|
145
|
-
if (t) {
|
|
146
|
-
const [n, s] = x(t);
|
|
147
|
-
(e = this.stores) == null || e.scheduler.set("rescheduleBookingId", s), this.refConfigId = n, (a = this.nylasSchedulerConnector) == null || a.scheduler.setConfigId(n);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
cancelBookingRefChanged(t) {
|
|
151
|
-
var e, a;
|
|
152
|
-
if (t) {
|
|
153
|
-
const [n, s] = x(t);
|
|
154
|
-
(e = this.stores) == null || e.scheduler.set("cancelBookingId", s), this.refConfigId = n, (a = this.nylasSchedulerConnector) == null || a.scheduler.setConfigId(n);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
languageChanged(t) {
|
|
158
|
-
const e = t.detail;
|
|
159
|
-
this.language = e, h.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, g, u, p, y;
|
|
171
|
-
const e = t.detail, a = (g = (l = (d = (r = this.nylasSchedulerConnector) == null ? void 0 : r.schedulerStore) == null ? void 0 : d.get("configSettings")) == null ? void 0 : l.scheduler) == null ? void 0 : g.available_days_in_future, { startTime: n, endTime: s, endTimeForAvailableDaysInFuture: o } = this.validateAvailableDaysInFuture(e, a || 30);
|
|
172
|
-
if (n < o && e.getTime() < o * 1e3) {
|
|
173
|
-
const f = await ((u = this.nylasSchedulerConnector) == null ? void 0 : u.scheduler.getAvailability(n, s));
|
|
174
|
-
(!f || "error" in f) && this.nylasSchedulerError.emit({ notification: { ...this.getErrorObject(f == null ? void 0 : f.error) }, host: this.host });
|
|
175
|
-
const c = (p = this.stores) == null ? void 0 : p.scheduler.get("selectableDates");
|
|
176
|
-
c && c.length > 0 && ((y = this.stores) == null || y.scheduler.set("selectedDate", c[0]));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
async bookButtonClickedHandler(t) {
|
|
180
|
-
var s, o, r, d;
|
|
181
|
-
const a = (o = (s = this.nylasSchedulerConnector) == null ? void 0 : s.schedulerStore) == null ? void 0 : o.get("rescheduleBookingId");
|
|
182
|
-
if (a) {
|
|
183
|
-
const l = await ((r = this.nylasSchedulerConnector) == null ? void 0 : r.scheduler.rescheduleBooking(a, 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" }) : `${h.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: h.t("noSessionIdErrorTitle"),
|
|
227
|
-
category: C.Component,
|
|
228
|
-
type: I.Error,
|
|
229
|
-
description: h.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: h.t("invalidTimeslotErrorTitle"),
|
|
240
|
-
category: C.Component,
|
|
241
|
-
type: I.Error,
|
|
242
|
-
description: h.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 a = /* @__PURE__ */ new Date(), n = new Date(t.getFullYear(), t.getMonth(), 1).getTime() / 1e3, s = new Date(t.getFullYear(), t.getMonth() + 1, 1).getTime() / 1e3, o = Math.floor(A(a, e).getTime() / 1e3), r = Math.min(o, s);
|
|
251
|
-
return { startTime: n < a.getTime() / 1e3 ? Math.floor(a.getTime() / 1e3) : n, endTime: r, endTimeForAvailableDaysInFuture: o };
|
|
252
|
-
}
|
|
253
|
-
render() {
|
|
254
|
-
var u;
|
|
255
|
-
const t = this.mode === "app", e = (u = this.baseProvider) == null ? void 0 : u.getStore("scheduler"), a = e == null ? void 0 : e.get("eventInfo"), n = e == null ? void 0 : e.get("showBookingForm"), s = 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, g = e == null ? void 0 : e.get("selectedDate");
|
|
256
|
-
if (this.selectedDateLabel = g && this.language ? N(g.toLocaleDateString(O[this.language], { dateStyle: "full" })) : `${h.t("noDateSelected")}`, t && o && !s)
|
|
257
|
-
return i(m, 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 && s)
|
|
259
|
-
return i(m, 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: s, exportparts: "ncec, ncec__icon, ncec__title, ncec__description, ncec__button-outline, ncec__card" }))));
|
|
260
|
-
if (t && a)
|
|
261
|
-
return i(m, 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: a, exportparts: "nbec, nbec__title, nbec__card, nbec__description, nbec__button-outline, nbec__cancel-cta, nbec__reschedule-cta" }))));
|
|
262
|
-
if (t && (!a || d) && !n) {
|
|
263
|
-
const p = this.host.querySelector('[slot="timeslot-picker-cta-label"]');
|
|
264
|
-
return i(m, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(D, null, `${h.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" }, p && i("span", { slot: "timeslot-picker-cta-label" }, i("slot", { name: "timeslot-picker-cta-label" })))))));
|
|
265
|
-
}
|
|
266
|
-
return t && !a && n ? i(m, null, i(w, { nylasBranding: l, isLoading: this.isLoading, showNotification: this.showNotification }, d && i(D, null, `${h.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(m, null, i("slot", null));
|
|
267
|
-
}
|
|
268
|
-
get host() {
|
|
269
|
-
return R(this);
|
|
270
|
-
}
|
|
271
|
-
static get watchers() {
|
|
272
|
-
return {
|
|
273
|
-
bookingInfo: ["bookingInfoChanged"],
|
|
274
|
-
rescheduleBookingRef: ["rescheduleBookingRefChanged"],
|
|
275
|
-
cancelBookingRef: ["cancelBookingRefChanged"]
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
U.style = M;
|
|
280
|
-
export {
|
|
281
|
-
U as nylas_scheduling
|
|
282
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-26f8bbeb.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-26f8bbeb.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-26f8bbeb.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-26f8bbeb.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;
|