@nylas/react 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-circle-icon.entry-606d3096.cjs +1 -0
- package/dist/add-circle-icon.entry-d8358e3f.js +15 -0
- package/dist/{archive-icon.entry-50c4b134.js → archive-icon.entry-8c6d31f2.js} +1 -1
- package/dist/{archive-icon.entry-718a1225.cjs → archive-icon.entry-e8ce8c7d.cjs} +1 -1
- package/dist/{arrow-icon.entry-ca9625d3.cjs → arrow-icon.entry-13d23d01.cjs} +1 -1
- package/dist/{arrow-icon.entry-53337688.js → arrow-icon.entry-d950ddce.js} +1 -1
- package/dist/{bold-icon.entry-36e679f1.cjs → bold-icon.entry-12072568.cjs} +1 -1
- package/dist/{bold-icon.entry-c6109b88.js → bold-icon.entry-5382fea2.js} +1 -1
- package/dist/{button-component_2.entry-0a06b0c4.js → button-component_2.entry-4aa63891.js} +1 -1
- package/dist/{button-component_2.entry-a1b8cd03.cjs → button-component_2.entry-d34ed360.cjs} +1 -1
- package/dist/calendar-agenda-fill-icon_54.entry-33d08f1a.cjs +9 -0
- package/dist/{calendar-agenda-fill-icon_54.entry-e4d8ab10.js → calendar-agenda-fill-icon_54.entry-50c9ed7b.js} +115 -106
- package/dist/{calendar-cancel-icon.entry-813a8330.js → calendar-cancel-icon.entry-64ea7038.js} +1 -1
- package/dist/{calendar-cancel-icon.entry-22862d8c.cjs → calendar-cancel-icon.entry-b13aa245.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-79d381ce.js → calendar-check-icon_2.entry-935310fc.js} +1 -1
- package/dist/{calendar-check-icon_2.entry-2ca25094.cjs → calendar-check-icon_2.entry-9cbe60a8.cjs} +1 -1
- package/dist/{calendar-icon.entry-78bb4f9b.cjs → calendar-icon.entry-0c560a35.cjs} +1 -1
- package/dist/{calendar-icon.entry-d52951b0.js → calendar-icon.entry-2448eea2.js} +1 -1
- package/dist/{checkbox-component_2.entry-a6114846.cjs → checkbox-component_2.entry-1e3afb3a.cjs} +1 -1
- package/dist/{checkbox-component_2.entry-1219f0cf.js → checkbox-component_2.entry-ec5e75fb.js} +1 -1
- package/dist/{chevron-icon_3.entry-82878ccf.js → chevron-icon_3.entry-1f72ef71.js} +1 -1
- package/dist/{chevron-icon_3.entry-d8f195dc.cjs → chevron-icon_3.entry-da1751d2.cjs} +1 -1
- package/dist/{clock-icon_4.entry-9ab4bc41.js → clock-icon_4.entry-4502c9f0.js} +1 -1
- package/dist/{clock-icon_4.entry-e081ccca.cjs → clock-icon_4.entry-b87aaaa9.cjs} +1 -1
- package/dist/close-icon.entry-92e93293.cjs +1 -0
- package/dist/close-icon.entry-e96749ed.js +15 -0
- package/dist/{constants-35df11e7-b37e3406.js → constants-24eca8c9-922dc05c.js} +16 -4
- package/dist/{constants-35df11e7-d87ad6d9.cjs → constants-24eca8c9-d0d9f3ec.cjs} +1 -1
- package/dist/{copy-icon.entry-9c6f38c2.cjs → copy-icon.entry-19bb7d2f.cjs} +1 -1
- package/dist/{copy-icon.entry-9d6e0f48.js → copy-icon.entry-7c958d7c.js} +1 -1
- package/dist/{delete-icon.entry-6ec9c80d.cjs → delete-icon.entry-41c7d463.cjs} +1 -1
- package/dist/{delete-icon.entry-fd8dc119.js → delete-icon.entry-59c9ca04.js} +1 -1
- package/dist/{document-refresh-icon.entry-bea78baf.cjs → document-refresh-icon.entry-afc75ddb.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-2b531e97.js → document-refresh-icon.entry-c32cda4f.js} +1 -1
- package/dist/{feedbackSync-b56b29ed-a7e9f258.js → feedbackSync-b4015b72-0785986b.js} +1 -1
- package/dist/{feedbackSync-b56b29ed-cdcec5be.cjs → feedbackSync-b4015b72-d343d411.cjs} +1 -1
- package/dist/{folder-icon.entry-6a43630e.js → folder-icon.entry-5dcf707b.js} +1 -1
- package/dist/{folder-icon.entry-485465be.cjs → folder-icon.entry-61ccaddd.cjs} +1 -1
- package/dist/{forward-icon.entry-a1af9122.cjs → forward-icon.entry-3d598cb4.cjs} +1 -1
- package/dist/{forward-icon.entry-514ea4a8.js → forward-icon.entry-5a156d37.js} +1 -1
- package/dist/{globe-icon.entry-adcff451.js → globe-icon.entry-99e8bebf.js} +1 -1
- package/dist/{globe-icon.entry-970082a4.cjs → globe-icon.entry-a88502ce.cjs} +1 -1
- package/dist/{google-logo-icon_4.entry-2b68fe81.js → google-logo-icon_4.entry-531021bd.js} +142 -128
- package/dist/{google-logo-icon_4.entry-21cb4b95.cjs → google-logo-icon_4.entry-9a7790d2.cjs} +1 -1
- package/dist/{inbox-icon.entry-94507d27.cjs → inbox-icon.entry-6eadce9b.cjs} +1 -1
- package/dist/{inbox-icon.entry-d3e42f82.js → inbox-icon.entry-b2a2f48e.js} +1 -1
- package/dist/{index-9dc1bd32.js → index-13a43508.js} +2624 -2554
- package/dist/{index-bec58f1d.cjs → index-7dbf0ae7.cjs} +28 -28
- package/dist/{index.es-c7ca1bad-38475209.js → index.es-aa323594-17c2a3f6.js} +1 -1
- package/dist/{index.es-c7ca1bad-5652d50c.cjs → index.es-aa323594-84331fa3.cjs} +1 -1
- package/dist/{info-icon_2.entry-3b5a2c7f.js → info-icon_2.entry-c6e650c4.js} +1 -1
- package/dist/{info-icon_2.entry-e23f3ffd.cjs → info-icon_2.entry-f53d81e5.cjs} +1 -1
- package/dist/{input-color-picker.entry-b4ea90c5.cjs → input-color-picker.entry-16fa8456.cjs} +1 -1
- package/dist/{input-color-picker.entry-9bc48bd3.js → input-color-picker.entry-cd398537.js} +1 -1
- package/dist/{input-component.entry-e567ec08.cjs → input-component.entry-74b63249.cjs} +1 -1
- package/dist/{input-component.entry-ebae3a8a.js → input-component.entry-b471f023.js} +1 -1
- package/dist/{input-dropdown.entry-1f704009.js → input-dropdown.entry-14e1f6cb.js} +1 -1
- package/dist/{input-dropdown.entry-597cd5a8.cjs → input-dropdown.entry-32b4b8be.cjs} +1 -1
- package/dist/{italic-icon.entry-08593dd0.js → italic-icon.entry-8a1a7568.js} +1 -1
- package/dist/{italic-icon.entry-8f614353.cjs → italic-icon.entry-c9ae0186.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-eb978e22.cjs → multi-select-dropdown.entry-58b860a0.cjs} +1 -1
- package/dist/{multi-select-dropdown.entry-5f1c73f3.js → multi-select-dropdown.entry-bc4901aa.js} +1 -1
- package/dist/nylas-booked-event-card_12.entry-f64eecaa.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-c4043d8f.js → nylas-booked-event-card_12.entry-fbdb2f3d.js} +378 -378
- package/dist/{nylas-form-card.entry-1540207c.cjs → nylas-form-card.entry-7e9a0cf1.cjs} +1 -1
- package/dist/{nylas-form-card.entry-80688e35.js → nylas-form-card.entry-aa1d5aca.js} +2 -2
- package/dist/{nylas-if-state.entry-037d0454.js → nylas-if-state.entry-5e30f6b3.js} +2 -2
- package/dist/{nylas-if-state.entry-e5155b5b.cjs → nylas-if-state.entry-96914d61.cjs} +1 -1
- package/dist/{nylas-login.entry-b3d73ab9.cjs → nylas-login.entry-e26689b0.cjs} +1 -1
- package/dist/{nylas-login.entry-d157a6ed.js → nylas-login.entry-e52648da.js} +2 -2
- package/dist/{nylas-provider.entry-884ba204.cjs → nylas-provider.entry-9d43f4f0.cjs} +1 -1
- package/dist/{nylas-provider.entry-cf4b8b57.js → nylas-provider.entry-ac669351.js} +4 -4
- package/dist/nylas-scheduler-editor.entry-0f1370d9.cjs +2 -0
- package/dist/{nylas-scheduler-editor.entry-e731ca4a.js → nylas-scheduler-editor.entry-9655ce2e.js} +12 -12
- package/dist/{nylas-scheduling.entry-86b18d85.js → nylas-scheduling.entry-14d4cd69.js} +43 -42
- package/dist/nylas-scheduling.entry-ab10f8a4.cjs +1 -0
- package/dist/{nylas-time-window-picker.entry-393e855b.js → nylas-time-window-picker.entry-a2f71121.js} +1 -1
- package/dist/{nylas-time-window-picker.entry-f9687046.cjs → nylas-time-window-picker.entry-dfbd975e.cjs} +1 -1
- package/dist/{person-icon.entry-b5ccb1f4.js → person-icon.entry-40b5a8c5.js} +1 -1
- package/dist/{person-icon.entry-1b5dcd2e.cjs → person-icon.entry-a45918af.cjs} +1 -1
- package/dist/{play-icon.entry-5e51d961.js → play-icon.entry-b2315f8c.js} +1 -1
- package/dist/{play-icon.entry-3f2e7e31.cjs → play-icon.entry-c5757946.cjs} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{refresh-icon.entry-9beaa8e1.js → refresh-icon.entry-37d038f8.js} +1 -1
- package/dist/{refresh-icon.entry-3d241ffd.cjs → refresh-icon.entry-b9afd192.cjs} +1 -1
- package/dist/{register-component-3444af44-94783766.js → register-component-555477e7-42247763.js} +1 -1
- package/dist/{register-component-3444af44-890ac950.cjs → register-component-555477e7-ecafba1c.cjs} +1 -1
- package/dist/{reply-all-icon.entry-a0fcbf30.cjs → reply-all-icon.entry-07a6783a.cjs} +1 -1
- package/dist/{reply-all-icon.entry-6b55d3b3.js → reply-all-icon.entry-89fd0e10.js} +1 -1
- package/dist/{reply-icon.entry-c7d0d967.cjs → reply-icon.entry-8cddb112.cjs} +1 -1
- package/dist/{reply-icon.entry-c709b46f.js → reply-icon.entry-a53a6fc4.js} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-13c1c187.js → scheduler-config-store-ed4a8dfd-656579e3.js} +1 -1
- package/dist/{scheduler-config-store-ed4a8dfd-ba68cc09.cjs → scheduler-config-store-ed4a8dfd-733c6442.cjs} +1 -1
- package/dist/scheduler-store-c37aa5ca-0484b074.cjs +1 -0
- package/dist/{scheduler-store-ecd15be2-d2ef4ac2.js → scheduler-store-c37aa5ca-c9752707.js} +127 -124
- package/dist/{sent-icon.entry-b65083f4.js → sent-icon.entry-6ac749b3.js} +1 -1
- package/dist/{sent-icon.entry-9083bca9.cjs → sent-icon.entry-b740a32d.cjs} +1 -1
- package/dist/{spam-icon.entry-e6c1a82a.cjs → spam-icon.entry-78cec025.cjs} +1 -1
- package/dist/{spam-icon.entry-120eca46.js → spam-icon.entry-872ff1e4.js} +1 -1
- package/dist/{star-icon.entry-e3563c0b.js → star-icon.entry-57246dc1.js} +1 -1
- package/dist/{star-icon.entry-efbc2679.cjs → star-icon.entry-ab9ad7df.cjs} +1 -1
- package/dist/{stop-icon.entry-ab5cf663.js → stop-icon.entry-5054fa33.js} +1 -1
- package/dist/{stop-icon.entry-8d07d719.cjs → stop-icon.entry-f79dce49.cjs} +1 -1
- package/dist/{textarea-component.entry-a0ef9f03.js → textarea-component.entry-15c9a676.js} +1 -1
- package/dist/{textarea-component.entry-93be4a65.cjs → textarea-component.entry-2967dd82.cjs} +1 -1
- package/dist/{time-period-selector.entry-2a86f48f.js → time-period-selector.entry-9226fd08.js} +1 -1
- package/dist/{time-period-selector.entry-16f96af9.cjs → time-period-selector.entry-a53c94c2.cjs} +1 -1
- package/dist/{translate-icon.entry-d632b37b.js → translate-icon.entry-52939fa4.js} +1 -1
- package/dist/{translate-icon.entry-868948d3.cjs → translate-icon.entry-f4dcc479.cjs} +1 -1
- package/dist/{trash-fill-icon.entry-88dfffbc.cjs → trash-fill-icon.entry-7f4ddaf5.cjs} +1 -1
- package/dist/{trash-fill-icon.entry-eeab235e.js → trash-fill-icon.entry-b9ab3cfc.js} +1 -1
- package/dist/{underline-icon.entry-65e42dcf.js → underline-icon.entry-c8142970.js} +1 -1
- package/dist/{underline-icon.entry-35430c19.cjs → underline-icon.entry-e9959c5c.cjs} +1 -1
- package/dist/{warning-icon.entry-bab6d190.js → warning-icon.entry-00426457.js} +1 -1
- package/dist/{warning-icon.entry-e7714a43.cjs → warning-icon.entry-98c0d003.cjs} +1 -1
- package/package.json +3 -3
- package/dist/add-circle-icon_2.entry-52cc3933.cjs +0 -1
- package/dist/add-circle-icon_2.entry-5ea903bf.js +0 -25
- package/dist/calendar-agenda-fill-icon_54.entry-5b185e75.cjs +0 -9
- package/dist/nylas-booked-event-card_12.entry-73785c5c.cjs +0 -1
- package/dist/nylas-scheduler-editor.entry-6f76d0d5.cjs +0 -2
- package/dist/nylas-scheduling.entry-c8ee9a2a.cjs +0 -1
- package/dist/scheduler-store-ecd15be2-8f7d171f.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("./index-7dbf0ae7.cjs");exports.ErrorCategory=void 0;(function(o){o.Component="component",o.Api="api",o.Auth="auth"})(exports.ErrorCategory||(exports.ErrorCategory={}));var D;(function(o){o.endtime_not_in_future="endtime_not_in_future",o.no_booking_info="no_booking_info",o.no_timeslot_selected="no_timeslot_selected",o.no_timezone_selected="no_timezone_selected",o.no_booking_id="no_booking_id",o.no_salt="no_salt",o.invalid_start_time="invalid_start_time",o.invalid_end_time="invalid_end_time",o.invalid_timezone="invalid_timezone"})(D||(D={}));var A;(function(o){o.invalid_session="invalid_session",o.general_error="general_error",o.internal_error="internal_error",o.invalid_request_error="invalid_request_error",o.timeslot_not_available="timeslot_not_available",o.provider_error="provider_error",o.not_found_error="not_found_error"})(A||(A={}));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}),no_salt:(i="No salt 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 ${constructor({schedulerAPIURL:e,schedulerStore:t,sessionId:s,configId:i,slug:r,clientId:n}){this.errors=new P,this.schedulerStore=t,this.schedulerAPIURL=e,this.sessionId=s,this.configId=i,this.slug=r,this.clientId=n}getHeaders(){return this.sessionId?{Authorization:`Bearer ${this.sessionId}`}:{}}async makeAPIRequest(e,t,s,i={}){try{const r=new URL(this.schedulerAPIURL),n="1.3.1";return r.pathname=e,await(await fetch(decodeURIComponent(r.toString()),{method:t,headers:{"Content-Type":"application/json",Origin:window.location.origin,"X-Source":"nylas-scheduling","X-Nylas-Web-Elements-Version":n,...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),a.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.getUISettings(),await this.resetStoreStateAndFetchAvailability().finally(()=>{this.schedulerStore.set("isLoading",!1)})}async setCancel(e){this.schedulerStore.set("cancelBookingId",e)}async setReject(e){this.schedulerStore.set("rejectBookingId",e)}async resetCancel(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("cancelBookingId",""),this.schedulerStore.set("rejectBookingId",""),this.schedulerStore.set("cancelledEventInfo",null),e}async goBack(){this.schedulerStore.set("cancelBookingId","")}async resetConfirm(){const e=await this.resetStoreStateAndFetchAvailability();return this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("confirmedEventInfo",void 0),e}async bookTimeslot(e){var I;this.schedulerStore.set("isLoading",!0);const{selectedTimeslot:t,selectedTimezone:s,bookingInfo:i,selectedLanguage:r}=this.schedulerStore.state;if(!e&&!i)return{error:this.errors.component(a.instance.t("createBookingErrorTitle")).no_booking_info()};const n=(e==null?void 0:e.timeslot)||t;if(!n)return{error:this.errors.component(a.instance.t("createBookingErrorTitle")).no_timeslot_selected()};const l=e&&(e!=null&&e.timezone)?e==null?void 0:e.timezone:s,c=r||"en-US";if(!l)return{error:this.errors.component(a.instance.t("createBookingErrorTitle")).no_timezone_selected()};const u=this.schedulerStore.get("availabilityOrderEmails");let d="";if(u.length>0){const b=(n==null?void 0:n.emails)||[];for(let f=0;f<u.length;f++)if(b.includes(u[f])){d=u[f];break}}const h={};Object.entries((i==null?void 0:i.additionalFields)||{}).forEach(([b,f])=>{h[b]=f.value});const _=e?e==null?void 0:e.primaryParticipant:i==null?void 0:i.primaryParticipant,S=e?(e==null?void 0:e.guests)||[]:(i==null?void 0:i.guests)||[],p=e?e==null?void 0:e.additionalFields:h,T=this.getHeaders(),v=`/v3/scheduling/bookings${!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:""}`,g=await this.makeAPIRequest(decodeURIComponent(v),"POST",JSON.stringify({participants:d?[{email:d}]:void 0,additional_fields:p,additional_guests:S,guest:{..._},start_time:n.start_time.getTime()/1e3,end_time:n.end_time.getTime()/1e3,timezone:l,email_language:this.getTwoLetterLanguageCode(c)}),T);if("error"in g){this.schedulerStore.set("isLoading",!1);const b=(I=g.error)==null?void 0:I.type;let f=g.error;if(b&&b in this.errors.api("Create Booking")){const E=this.getErrorMessage(f);f=this.errors.api("Create Booking")[b](E)}return{error:f}}return"data"in g&&this.schedulerStore.set("eventInfo",g==null?void 0:g.data),this.schedulerStore.set("isLoading",!1),g}async getUISettings(){var n;this.schedulerStore.set("isLoading",!0);const e=this.schedulerStore.get("rescheduleBookingId"),t=this.getHeaders();let s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"";e&&s?s+=`&booking_id=${e}`:e&&(s+=`?booking_id=${e}`);const i=`/v3/scheduling/ui-settings${s}`,r=await this.makeAPIRequest(i,"GET",void 0,t);if("error"in r){this.schedulerStore.set("isLoading",!1);const l=(n=r.error)==null?void 0:n.type;let c=r.error;return l&&l in this.errors.api(a.instance.t("getUISettingErrorTitle"))&&(c=this.errors.api(a.instance.t("getUISettingErrorTitle"))[l]((c==null?void 0:c.message)||(c==null?void 0:c.title)||"Something went wrong")),{error:c}}return"data"in r&&this.schedulerStore.set("configSettings",r.data),this.schedulerStore.set("isLoading",!1),r}getTwoLetterLanguageCode(e){return e.split("-")[0]}getStartTimeWithMinBookingNotice(e){var r;const t=(r=this.schedulerStore.get("configSettings"))==null?void 0:r.scheduler,s=t==null?void 0:t.min_booking_notice;if(!s)return e;const i=new Date().getTime();return e<(i+s*60*1e3)/1e3?Math.floor((i+s*60*1e3)/1e3):e}getEndTimeForAvailableDaysInFuture(e){var n,l;const t=new Date,s=(l=(n=this.schedulerStore.get("configSettings"))==null?void 0:n.scheduler)==null?void 0:l.available_days_in_future,i=Math.floor(a.addDaysToCurrentDate(t,s).getTime()/1e3);return Math.min(i,e)}async getAvailability(e=0,t=0){var _,S,p,T;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(a.instance.t("getAvailabilityErrorTitle")).endtime_not_in_future()};if(!e){const m=new Date(i.getFullYear(),i.getMonth(),1);e=Math.floor(m.getTime()/1e3)}if(!t){const m=new Date(i.getFullYear(),i.getMonth()+1,0);t=Math.floor(m.getTime()/1e3)}t=this.getEndTimeForAvailableDaysInFuture(t);const n=this.getStartTimeWithMinBookingNotice(e);e=n,t=n>t?n+1:t,s.append("start_time",encodeURIComponent(e.toString())),s.append("end_time",encodeURIComponent(t.toString())),this.configId&&!this.sessionId?s.append("configuration_id",encodeURIComponent(this.configId)):this.slug&&this.clientId&&!this.sessionId&&(s.append("slug",encodeURIComponent(this.slug)),s.append("client_id",encodeURIComponent(this.clientId)));const l=this.schedulerStore.get("rescheduleBookingId");l&&s.append("booking_id",encodeURIComponent(l));const c=s.toString(),u=`/v3/scheduling/availability${c?`?${c}`:""}`,d=this.getHeaders(),h=await this.makeAPIRequest(decodeURIComponent(u),"GET",void 0,d);if("error"in h){this.schedulerStore.set("availability",[]),this.schedulerStore.set("isLoading",!1);const m=(_=h.error)==null?void 0:_.type;let v=h.error;if(m&&m in this.errors.api(a.instance.t("getAvailabilityErrorTitle"))){const g=this.getErrorMessage(v);v=this.errors.api(a.instance.t("getAvailabilityErrorTitle"))[m](g)}return{error:v}}if("data"in h){const v=(((p=(S=h.data)==null?void 0:S.time_slots)==null?void 0:p.map(I=>({...I,start_time:new Date(I.start_time*1e3),end_time:new Date(I.end_time*1e3)})))||[]).filter(I=>I.start_time.getTime()>r);this.schedulerStore.set("availability",v);const g=((T=h.data)==null?void 0:T.order)||[];this.schedulerStore.set("availabilityOrderEmails",g)}return this.schedulerStore.set("isLoading",!1),h}async cancelBooking(e,t){var l;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(a.instance.t("cancelBookingErrorTitle")).no_booking_id()};const s=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",i=`/v3/scheduling/bookings/${e}${s}`,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 c=(l=n.error)==null?void 0:l.type;let u=n.error;if(c&&c in this.errors.api(a.instance.t("cancelBookingErrorTitle"))){const d=this.getErrorMessage(u);u=this.errors.api(a.instance.t("cancelBookingErrorTitle"))[c](d)}return{error:u}}return this.schedulerStore.set("cancelledEventInfo",{booking_id:e}),this.schedulerStore.set("rescheduleBookingId",""),this.schedulerStore.set("isLoading",!1),n}async rescheduleBooking(e,t){var B;if(this.schedulerStore.set("isLoading",!0),!e)return{error:this.errors.component(a.instance.t("rescheduleBookingErrorTitle")).no_booking_id()};const s=this.errors.api(a.instance.t("rescheduleBookingErrorTitle")),i=this.errors.component(a.instance.t("rescheduleBookingErrorTitle")),{bookingInfo:r,selectedTimeslot:n,selectedTimezone:l,selectedLanguage:c}=this.schedulerStore.state,{startTime:u,endTime:d,timezone:h}=t,_=u||(n==null?void 0:n.start_time);if(!_)return{error:i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const S=d||(n==null?void 0:n.end_time);if(!S)return{error:i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.')};const p=this.schedulerStore.get("availabilityOrderEmails");let T="";if(p.length>0){const k=(n==null?void 0:n.emails)||[];for(let y=0;y<p.length;y++)if(k.includes(p[y])){T=p[y];break}}const m=h||l;if(!m)return{error:i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.')};const v={};Object.entries((r==null?void 0:r.additionalFields)||{}).forEach(([k,y])=>{v[k]=y.value});const g=t?t==null?void 0:t.primaryParticipant:r==null?void 0:r.primaryParticipant,I=t?(t==null?void 0:t.guests)||[]:(r==null?void 0:r.guests)||[],b=t?t==null?void 0:t.additionalFields:v,f=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",E=`/v3/scheduling/bookings/${e}${f}`,C=this.getHeaders(),w=await this.makeAPIRequest(decodeURIComponent(E),"PATCH",JSON.stringify({start_time:_.getTime()/1e3,end_time:S.getTime()/1e3,timezone:m,additional_fields:b,guest:{...g},additional_guests:I,participants:T?[{email:T}]:void 0,email_language:this.getTwoLetterLanguageCode(c)}),C);if("error"in w){this.schedulerStore.set("isLoading",!1);const k=(B=w.error)==null?void 0:B.type;let y=w.error;if(k&&k in s){const M=this.getErrorMessage(y);y=s[k](M)}return{error:y}}const L=this.schedulerStore.get("reschedulingEventInfo");if("data"in w)this.schedulerStore.set("eventInfo",w==null?void 0:w.data);else if(L)this.schedulerStore.set("eventInfo",L);else{const k={booking_id:e};this.schedulerStore.set("eventInfo",k)}return this.schedulerStore.set("isLoading",!1),w}async updateBooking(e){var h;this.schedulerStore.set("isLoading",!0);const{bookingId:t,status:s,reason:i}=e,r=this.schedulerStore.get("organizerConfirmationSalt"),n=s==="confirmed"?a.instance.t("confirmBookingErrorTitle"):a.instance.t("rejectBookingErrorTitle");if(!t)return{error:this.errors.component(n).no_booking_id()};if(!r)return{error:this.errors.component(n).no_salt()};const l=!this.sessionId&&this.configId?`?configuration_id=${this.configId}`:!this.sessionId&&this.slug&&this.clientId?`?slug=${this.slug}&client_id=${this.clientId}`:"",c=`/v3/scheduling/bookings/${t}${l}`,u=this.getHeaders(),d=await this.makeAPIRequest(decodeURIComponent(c),"PUT",JSON.stringify({status:s,cancellation_reason:i,salt:r}),u);if("error"in d){this.schedulerStore.set("isLoading",!1);const _=(h=d.error)==null?void 0:h.type;let S=d.error;if(_&&_ in this.errors.api(n)){const p=this.getErrorMessage(S);S=this.errors.api(n)[_](p)}return{error:S}}return"data"in d&&s==="confirmed"?this.schedulerStore.set("confirmedEventInfo",d==null?void 0:d.data):"request_id"in d&&s==="cancelled"&&this.schedulerStore.set("cancelledEventInfo",{booking_id:t}),this.schedulerStore.set("organizerConfirmationBookingId",""),this.schedulerStore.set("isLoading",!1),d}}function z(o={}){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,...o};a.debug("[defaultNylasStoreState]: ",e);const t=a.createStore(e);return t.onChange("availability",s=>{a.debug("[availability]: ",s);const i=s.map(l=>l.start_time);a.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);a.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=$;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { d as L, a as F, i as
|
|
1
|
+
import { d as L, a as F, i as d, j as R } from "./index-13a43508.js";
|
|
2
2
|
var B;
|
|
3
|
-
(function(
|
|
4
|
-
|
|
3
|
+
(function(o) {
|
|
4
|
+
o.Component = "component", o.Api = "api", o.Auth = "auth";
|
|
5
5
|
})(B || (B = {}));
|
|
6
6
|
var M;
|
|
7
|
-
(function(
|
|
8
|
-
|
|
7
|
+
(function(o) {
|
|
8
|
+
o.endtime_not_in_future = "endtime_not_in_future", o.no_booking_info = "no_booking_info", o.no_timeslot_selected = "no_timeslot_selected", o.no_timezone_selected = "no_timezone_selected", o.no_booking_id = "no_booking_id", o.no_salt = "no_salt", o.invalid_start_time = "invalid_start_time", o.invalid_end_time = "invalid_end_time", o.invalid_timezone = "invalid_timezone";
|
|
9
9
|
})(M || (M = {}));
|
|
10
|
-
var
|
|
11
|
-
(function(
|
|
12
|
-
|
|
13
|
-
})(
|
|
10
|
+
var $;
|
|
11
|
+
(function(o) {
|
|
12
|
+
o.invalid_session = "invalid_session", o.general_error = "general_error", o.internal_error = "internal_error", o.invalid_request_error = "invalid_request_error", o.timeslot_not_available = "timeslot_not_available", o.provider_error = "provider_error", o.not_found_error = "not_found_error";
|
|
13
|
+
})($ || ($ = {}));
|
|
14
14
|
class C {
|
|
15
15
|
constructor() {
|
|
16
16
|
this.component = (e) => {
|
|
@@ -105,8 +105,8 @@ class C {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
class N {
|
|
108
|
-
constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug:
|
|
109
|
-
this.errors = new C(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug =
|
|
108
|
+
constructor({ schedulerAPIURL: e, schedulerStore: t, sessionId: s, configId: i, slug: r, clientId: n }) {
|
|
109
|
+
this.errors = new C(), this.schedulerStore = t, this.schedulerAPIURL = e, this.sessionId = s, this.configId = i, this.slug = r, this.clientId = n;
|
|
110
110
|
}
|
|
111
111
|
getHeaders() {
|
|
112
112
|
return this.sessionId ? {
|
|
@@ -115,22 +115,22 @@ class N {
|
|
|
115
115
|
}
|
|
116
116
|
async makeAPIRequest(e, t, s, i = {}) {
|
|
117
117
|
try {
|
|
118
|
-
const
|
|
119
|
-
return
|
|
118
|
+
const r = new URL(this.schedulerAPIURL), n = "1.3.1";
|
|
119
|
+
return r.pathname = e, await (await fetch(decodeURIComponent(r.toString()), {
|
|
120
120
|
method: t,
|
|
121
121
|
headers: {
|
|
122
122
|
"Content-Type": "application/json",
|
|
123
123
|
Origin: window.location.origin,
|
|
124
124
|
"X-Source": "nylas-scheduling",
|
|
125
|
-
"X-Nylas-Web-Elements-Version":
|
|
125
|
+
"X-Nylas-Web-Elements-Version": n,
|
|
126
126
|
...i
|
|
127
127
|
},
|
|
128
128
|
body: s
|
|
129
129
|
})).json();
|
|
130
|
-
} catch (
|
|
130
|
+
} catch (r) {
|
|
131
131
|
return {
|
|
132
132
|
error: {
|
|
133
|
-
message:
|
|
133
|
+
message: r.message,
|
|
134
134
|
title: "API request failed",
|
|
135
135
|
type: "api"
|
|
136
136
|
}
|
|
@@ -138,9 +138,9 @@ class N {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
getErrorMessage(e) {
|
|
141
|
-
var s, i,
|
|
141
|
+
var s, i, r, n;
|
|
142
142
|
let t = (e == null ? void 0 : e.message) || (e == null ? void 0 : e.title) || "Something went wrong";
|
|
143
|
-
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) || ((
|
|
143
|
+
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;
|
|
144
144
|
}
|
|
145
145
|
setConfigId(e) {
|
|
146
146
|
this.configId = e;
|
|
@@ -155,7 +155,7 @@ class N {
|
|
|
155
155
|
this.schedulerStore.set("selectedTimezone", e);
|
|
156
156
|
}
|
|
157
157
|
selectLanguage(e) {
|
|
158
|
-
this.schedulerStore.set("selectedLanguage", e),
|
|
158
|
+
this.schedulerStore.set("selectedLanguage", e), d.changeLanguage(e);
|
|
159
159
|
}
|
|
160
160
|
async toggleAdditionalData(e) {
|
|
161
161
|
e || await this.refetchAvailability(), this.schedulerStore.set("showBookingForm", e);
|
|
@@ -185,14 +185,14 @@ class N {
|
|
|
185
185
|
return await this.getAvailability(s, i);
|
|
186
186
|
}
|
|
187
187
|
async resetStoreStateAndFetchAvailability() {
|
|
188
|
-
const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((
|
|
188
|
+
const e = /* @__PURE__ */ new Date(), t = await this.refetchAvailability(), s = this.schedulerStore.get("availability").find((r) => new Date(r.start_time) > /* @__PURE__ */ new Date());
|
|
189
189
|
let i = e;
|
|
190
190
|
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;
|
|
191
191
|
}
|
|
192
192
|
async setReschedule(e) {
|
|
193
193
|
this.schedulerStore.set("isLoading", !0);
|
|
194
194
|
const t = this.schedulerStore.state.eventInfo;
|
|
195
|
-
return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.resetStoreStateAndFetchAvailability().finally(() => {
|
|
195
|
+
return t && this.schedulerStore.set("reschedulingEventInfo", t), this.schedulerStore.set("rescheduleBookingId", e), await this.getUISettings(), await this.resetStoreStateAndFetchAvailability().finally(() => {
|
|
196
196
|
this.schedulerStore.set("isLoading", !1);
|
|
197
197
|
});
|
|
198
198
|
}
|
|
@@ -216,85 +216,88 @@ class N {
|
|
|
216
216
|
async bookTimeslot(e) {
|
|
217
217
|
var I;
|
|
218
218
|
this.schedulerStore.set("isLoading", !0);
|
|
219
|
-
const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage:
|
|
219
|
+
const { selectedTimeslot: t, selectedTimezone: s, bookingInfo: i, selectedLanguage: r } = this.schedulerStore.state;
|
|
220
220
|
if (!e && !i)
|
|
221
|
-
return { error: this.errors.component(
|
|
222
|
-
const
|
|
223
|
-
if (!
|
|
224
|
-
return { error: this.errors.component(
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
return { error: this.errors.component(
|
|
228
|
-
const
|
|
229
|
-
let
|
|
230
|
-
if (
|
|
231
|
-
const k = (
|
|
232
|
-
for (let f = 0; f <
|
|
233
|
-
if (k.includes(
|
|
234
|
-
|
|
221
|
+
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_booking_info() };
|
|
222
|
+
const n = (e == null ? void 0 : e.timeslot) || t;
|
|
223
|
+
if (!n)
|
|
224
|
+
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timeslot_selected() };
|
|
225
|
+
const a = e && (e != null && e.timezone) ? e == null ? void 0 : e.timezone : s, l = r || "en-US";
|
|
226
|
+
if (!a)
|
|
227
|
+
return { error: this.errors.component(d.t("createBookingErrorTitle")).no_timezone_selected() };
|
|
228
|
+
const u = this.schedulerStore.get("availabilityOrderEmails");
|
|
229
|
+
let c = "";
|
|
230
|
+
if (u.length > 0) {
|
|
231
|
+
const k = (n == null ? void 0 : n.emails) || [];
|
|
232
|
+
for (let f = 0; f < u.length; f++)
|
|
233
|
+
if (k.includes(u[f])) {
|
|
234
|
+
c = u[f];
|
|
235
235
|
break;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const h = {};
|
|
239
239
|
Object.entries((i == null ? void 0 : i.additionalFields) || {}).forEach(([k, f]) => {
|
|
240
|
-
|
|
240
|
+
h[k] = f.value;
|
|
241
241
|
});
|
|
242
|
-
const _ = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, S = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.guests) || [], p = e ? e == null ? void 0 : e.additionalFields :
|
|
243
|
-
participants:
|
|
242
|
+
const _ = e ? e == null ? void 0 : e.primaryParticipant : i == null ? void 0 : i.primaryParticipant, S = e ? (e == null ? void 0 : e.guests) || [] : (i == null ? void 0 : i.guests) || [], p = e ? e == null ? void 0 : e.additionalFields : h, T = this.getHeaders(), v = `/v3/scheduling/bookings${!this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : ""}`, g = await this.makeAPIRequest(decodeURIComponent(v), "POST", JSON.stringify({
|
|
243
|
+
participants: c ? [{ email: c }] : void 0,
|
|
244
244
|
additional_fields: p,
|
|
245
245
|
additional_guests: S,
|
|
246
246
|
guest: { ..._ },
|
|
247
|
-
start_time:
|
|
248
|
-
end_time:
|
|
249
|
-
timezone:
|
|
250
|
-
email_language: this.getTwoLetterLanguageCode(
|
|
247
|
+
start_time: n.start_time.getTime() / 1e3,
|
|
248
|
+
end_time: n.end_time.getTime() / 1e3,
|
|
249
|
+
timezone: a,
|
|
250
|
+
email_language: this.getTwoLetterLanguageCode(l)
|
|
251
251
|
}), T);
|
|
252
|
-
if ("error" in
|
|
252
|
+
if ("error" in g) {
|
|
253
253
|
this.schedulerStore.set("isLoading", !1);
|
|
254
|
-
const k = (I =
|
|
255
|
-
let f =
|
|
254
|
+
const k = (I = g.error) == null ? void 0 : I.type;
|
|
255
|
+
let f = g.error;
|
|
256
256
|
if (k && k in this.errors.api("Create Booking")) {
|
|
257
257
|
const E = this.getErrorMessage(f);
|
|
258
258
|
f = this.errors.api("Create Booking")[k](E);
|
|
259
259
|
}
|
|
260
260
|
return { error: f };
|
|
261
261
|
}
|
|
262
|
-
return "data" in
|
|
262
|
+
return "data" in g && this.schedulerStore.set("eventInfo", g == null ? void 0 : g.data), this.schedulerStore.set("isLoading", !1), g;
|
|
263
263
|
}
|
|
264
264
|
async getUISettings() {
|
|
265
265
|
var n;
|
|
266
266
|
this.schedulerStore.set("isLoading", !0);
|
|
267
|
-
const e = this.
|
|
268
|
-
|
|
267
|
+
const e = this.schedulerStore.get("rescheduleBookingId"), t = this.getHeaders();
|
|
268
|
+
let s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "";
|
|
269
|
+
e && s ? s += `&booking_id=${e}` : e && (s += `?booking_id=${e}`);
|
|
270
|
+
const i = `/v3/scheduling/ui-settings${s}`, r = await this.makeAPIRequest(i, "GET", void 0, t);
|
|
271
|
+
if ("error" in r) {
|
|
269
272
|
this.schedulerStore.set("isLoading", !1);
|
|
270
|
-
const
|
|
271
|
-
let
|
|
272
|
-
return
|
|
273
|
+
const a = (n = r.error) == null ? void 0 : n.type;
|
|
274
|
+
let l = r.error;
|
|
275
|
+
return a && a in this.errors.api(d.t("getUISettingErrorTitle")) && (l = this.errors.api(d.t("getUISettingErrorTitle"))[a]((l == null ? void 0 : l.message) || (l == null ? void 0 : l.title) || "Something went wrong")), { error: l };
|
|
273
276
|
}
|
|
274
|
-
return "data" in
|
|
277
|
+
return "data" in r && this.schedulerStore.set("configSettings", r.data), this.schedulerStore.set("isLoading", !1), r;
|
|
275
278
|
}
|
|
276
279
|
getTwoLetterLanguageCode(e) {
|
|
277
280
|
return e.split("-")[0];
|
|
278
281
|
}
|
|
279
282
|
getStartTimeWithMinBookingNotice(e) {
|
|
280
|
-
var
|
|
281
|
-
const t = (
|
|
283
|
+
var r;
|
|
284
|
+
const t = (r = this.schedulerStore.get("configSettings")) == null ? void 0 : r.scheduler, s = t == null ? void 0 : t.min_booking_notice;
|
|
282
285
|
if (!s)
|
|
283
286
|
return e;
|
|
284
287
|
const i = (/* @__PURE__ */ new Date()).getTime();
|
|
285
288
|
return e < (i + s * 60 * 1e3) / 1e3 ? Math.floor((i + s * 60 * 1e3) / 1e3) : e;
|
|
286
289
|
}
|
|
287
290
|
getEndTimeForAvailableDaysInFuture(e) {
|
|
288
|
-
var
|
|
289
|
-
const t = /* @__PURE__ */ new Date(), s = (
|
|
291
|
+
var n, a;
|
|
292
|
+
const t = /* @__PURE__ */ new Date(), s = (a = (n = this.schedulerStore.get("configSettings")) == null ? void 0 : n.scheduler) == null ? void 0 : a.available_days_in_future, i = Math.floor(R(t, s).getTime() / 1e3);
|
|
290
293
|
return Math.min(i, e);
|
|
291
294
|
}
|
|
292
295
|
async getAvailability(e = 0, t = 0) {
|
|
293
296
|
var _, S, p, T;
|
|
294
297
|
this.schedulerStore.set("isLoading", !0);
|
|
295
|
-
const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(),
|
|
296
|
-
if (t && t <
|
|
297
|
-
return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(
|
|
298
|
+
const s = new URLSearchParams(), i = /* @__PURE__ */ new Date(), r = i.getTime();
|
|
299
|
+
if (t && t < r / 1e3)
|
|
300
|
+
return this.schedulerStore.set("isLoading", !1), { error: this.errors.component(d.t("getAvailabilityErrorTitle")).endtime_not_in_future() };
|
|
298
301
|
if (!e) {
|
|
299
302
|
const m = new Date(i.getFullYear(), i.getMonth(), 1);
|
|
300
303
|
e = Math.floor(m.getTime() / 1e3);
|
|
@@ -304,99 +307,99 @@ class N {
|
|
|
304
307
|
t = Math.floor(m.getTime() / 1e3);
|
|
305
308
|
}
|
|
306
309
|
t = this.getEndTimeForAvailableDaysInFuture(t);
|
|
307
|
-
const
|
|
308
|
-
e =
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
if ("error" in
|
|
310
|
+
const n = this.getStartTimeWithMinBookingNotice(e);
|
|
311
|
+
e = n, t = n > t ? n + 1 : t, s.append("start_time", encodeURIComponent(e.toString())), s.append("end_time", encodeURIComponent(t.toString())), this.configId && !this.sessionId ? s.append("configuration_id", encodeURIComponent(this.configId)) : this.slug && this.clientId && !this.sessionId && (s.append("slug", encodeURIComponent(this.slug)), s.append("client_id", encodeURIComponent(this.clientId)));
|
|
312
|
+
const a = this.schedulerStore.get("rescheduleBookingId");
|
|
313
|
+
a && s.append("booking_id", encodeURIComponent(a));
|
|
314
|
+
const l = s.toString(), u = `/v3/scheduling/availability${l ? `?${l}` : ""}`, c = this.getHeaders(), h = await this.makeAPIRequest(decodeURIComponent(u), "GET", void 0, c);
|
|
315
|
+
if ("error" in h) {
|
|
313
316
|
this.schedulerStore.set("availability", []), this.schedulerStore.set("isLoading", !1);
|
|
314
|
-
const m = (_ =
|
|
315
|
-
let v =
|
|
316
|
-
if (m && m in this.errors.api(
|
|
317
|
-
const
|
|
318
|
-
v = this.errors.api(
|
|
317
|
+
const m = (_ = h.error) == null ? void 0 : _.type;
|
|
318
|
+
let v = h.error;
|
|
319
|
+
if (m && m in this.errors.api(d.t("getAvailabilityErrorTitle"))) {
|
|
320
|
+
const g = this.getErrorMessage(v);
|
|
321
|
+
v = this.errors.api(d.t("getAvailabilityErrorTitle"))[m](g);
|
|
319
322
|
}
|
|
320
323
|
return { error: v };
|
|
321
324
|
}
|
|
322
|
-
if ("data" in
|
|
323
|
-
const v = (((p = (S =
|
|
325
|
+
if ("data" in h) {
|
|
326
|
+
const v = (((p = (S = h.data) == null ? void 0 : S.time_slots) == null ? void 0 : p.map((I) => ({
|
|
324
327
|
...I,
|
|
325
328
|
start_time: new Date(I.start_time * 1e3),
|
|
326
329
|
end_time: new Date(I.end_time * 1e3)
|
|
327
|
-
}))) || []).filter((I) => I.start_time.getTime() >
|
|
330
|
+
}))) || []).filter((I) => I.start_time.getTime() > r);
|
|
328
331
|
this.schedulerStore.set("availability", v);
|
|
329
|
-
const
|
|
330
|
-
this.schedulerStore.set("availabilityOrderEmails",
|
|
332
|
+
const g = ((T = h.data) == null ? void 0 : T.order) || [];
|
|
333
|
+
this.schedulerStore.set("availabilityOrderEmails", g);
|
|
331
334
|
}
|
|
332
|
-
return this.schedulerStore.set("isLoading", !1),
|
|
335
|
+
return this.schedulerStore.set("isLoading", !1), h;
|
|
333
336
|
}
|
|
334
337
|
async cancelBooking(e, t) {
|
|
335
|
-
var
|
|
338
|
+
var a;
|
|
336
339
|
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
337
|
-
return { error: this.errors.component(
|
|
338
|
-
const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", i = `/v3/scheduling/bookings/${e}${s}`,
|
|
340
|
+
return { error: this.errors.component(d.t("cancelBookingErrorTitle")).no_booking_id() };
|
|
341
|
+
const s = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", i = `/v3/scheduling/bookings/${e}${s}`, r = this.getHeaders(), n = await this.makeAPIRequest(decodeURIComponent(i), "DELETE", JSON.stringify({
|
|
339
342
|
action: "cancel",
|
|
340
343
|
cancellation_reason: t
|
|
341
|
-
}),
|
|
342
|
-
if ("error" in
|
|
344
|
+
}), r);
|
|
345
|
+
if ("error" in n) {
|
|
343
346
|
this.schedulerStore.set("isLoading", !1);
|
|
344
|
-
const
|
|
345
|
-
let
|
|
346
|
-
if (
|
|
347
|
-
const
|
|
348
|
-
|
|
347
|
+
const l = (a = n.error) == null ? void 0 : a.type;
|
|
348
|
+
let u = n.error;
|
|
349
|
+
if (l && l in this.errors.api(d.t("cancelBookingErrorTitle"))) {
|
|
350
|
+
const c = this.getErrorMessage(u);
|
|
351
|
+
u = this.errors.api(d.t("cancelBookingErrorTitle"))[l](c);
|
|
349
352
|
}
|
|
350
|
-
return { error:
|
|
353
|
+
return { error: u };
|
|
351
354
|
}
|
|
352
355
|
return this.schedulerStore.set("cancelledEventInfo", {
|
|
353
356
|
booking_id: e
|
|
354
|
-
}), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1),
|
|
357
|
+
}), this.schedulerStore.set("rescheduleBookingId", ""), this.schedulerStore.set("isLoading", !1), n;
|
|
355
358
|
}
|
|
356
359
|
async rescheduleBooking(e, t) {
|
|
357
360
|
var A;
|
|
358
361
|
if (this.schedulerStore.set("isLoading", !0), !e)
|
|
359
|
-
return { error: this.errors.component(
|
|
360
|
-
const s = this.errors.api(
|
|
362
|
+
return { error: this.errors.component(d.t("rescheduleBookingErrorTitle")).no_booking_id() };
|
|
363
|
+
const s = this.errors.api(d.t("rescheduleBookingErrorTitle")), i = this.errors.component(d.t("rescheduleBookingErrorTitle")), { bookingInfo: r, selectedTimeslot: n, selectedTimezone: a, selectedLanguage: l } = this.schedulerStore.state, { startTime: u, endTime: c, timezone: h } = t, _ = u || (n == null ? void 0 : n.start_time);
|
|
361
364
|
if (!_)
|
|
362
365
|
return { error: i.invalid_start_time('Please pass "startTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
363
|
-
const S =
|
|
366
|
+
const S = c || (n == null ? void 0 : n.end_time);
|
|
364
367
|
if (!S)
|
|
365
368
|
return { error: i.invalid_end_time('Please pass "endTime" in data or set "selectedTimeslot" in the defaultSchedulerState.') };
|
|
366
369
|
const p = this.schedulerStore.get("availabilityOrderEmails");
|
|
367
370
|
let T = "";
|
|
368
371
|
if (p.length > 0) {
|
|
369
|
-
const b = (
|
|
372
|
+
const b = (n == null ? void 0 : n.emails) || [];
|
|
370
373
|
for (let y = 0; y < p.length; y++)
|
|
371
374
|
if (b.includes(p[y])) {
|
|
372
375
|
T = p[y];
|
|
373
376
|
break;
|
|
374
377
|
}
|
|
375
378
|
}
|
|
376
|
-
const m =
|
|
379
|
+
const m = h || a;
|
|
377
380
|
if (!m)
|
|
378
381
|
return { error: i.invalid_timezone('Please pass "timezone" in data or set "selectedTimezone" in the defaultSchedulerState.') };
|
|
379
382
|
const v = {};
|
|
380
|
-
Object.entries((
|
|
383
|
+
Object.entries((r == null ? void 0 : r.additionalFields) || {}).forEach(([b, y]) => {
|
|
381
384
|
v[b] = y.value;
|
|
382
385
|
});
|
|
383
|
-
const
|
|
386
|
+
const g = t ? t == null ? void 0 : t.primaryParticipant : r == null ? void 0 : r.primaryParticipant, I = t ? (t == null ? void 0 : t.guests) || [] : (r == null ? void 0 : r.guests) || [], k = t ? t == null ? void 0 : t.additionalFields : v, f = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", E = `/v3/scheduling/bookings/${e}${f}`, P = this.getHeaders(), w = await this.makeAPIRequest(decodeURIComponent(E), "PATCH", JSON.stringify({
|
|
384
387
|
start_time: _.getTime() / 1e3,
|
|
385
388
|
end_time: S.getTime() / 1e3,
|
|
386
389
|
timezone: m,
|
|
387
390
|
additional_fields: k,
|
|
388
|
-
guest: { ...
|
|
391
|
+
guest: { ...g },
|
|
389
392
|
additional_guests: I,
|
|
390
393
|
participants: T ? [{ email: T }] : void 0,
|
|
391
|
-
email_language: this.getTwoLetterLanguageCode(
|
|
392
|
-
}),
|
|
394
|
+
email_language: this.getTwoLetterLanguageCode(l)
|
|
395
|
+
}), P);
|
|
393
396
|
if ("error" in w) {
|
|
394
397
|
this.schedulerStore.set("isLoading", !1);
|
|
395
398
|
const b = (A = w.error) == null ? void 0 : A.type;
|
|
396
399
|
let y = w.error;
|
|
397
400
|
if (b && b in s) {
|
|
398
|
-
const
|
|
399
|
-
y = s[b](
|
|
401
|
+
const z = this.getErrorMessage(y);
|
|
402
|
+
y = s[b](z);
|
|
400
403
|
}
|
|
401
404
|
return { error: y };
|
|
402
405
|
}
|
|
@@ -414,34 +417,34 @@ class N {
|
|
|
414
417
|
return this.schedulerStore.set("isLoading", !1), w;
|
|
415
418
|
}
|
|
416
419
|
async updateBooking(e) {
|
|
417
|
-
var
|
|
420
|
+
var h;
|
|
418
421
|
this.schedulerStore.set("isLoading", !0);
|
|
419
|
-
const { bookingId: t, status: s, reason: i } = e,
|
|
422
|
+
const { bookingId: t, status: s, reason: i } = e, r = this.schedulerStore.get("organizerConfirmationSalt"), n = s === "confirmed" ? d.t("confirmBookingErrorTitle") : d.t("rejectBookingErrorTitle");
|
|
420
423
|
if (!t)
|
|
421
|
-
return { error: this.errors.component(
|
|
422
|
-
if (!
|
|
423
|
-
return { error: this.errors.component(
|
|
424
|
-
const
|
|
424
|
+
return { error: this.errors.component(n).no_booking_id() };
|
|
425
|
+
if (!r)
|
|
426
|
+
return { error: this.errors.component(n).no_salt() };
|
|
427
|
+
const a = !this.sessionId && this.configId ? `?configuration_id=${this.configId}` : !this.sessionId && this.slug && this.clientId ? `?slug=${this.slug}&client_id=${this.clientId}` : "", l = `/v3/scheduling/bookings/${t}${a}`, u = this.getHeaders(), c = await this.makeAPIRequest(decodeURIComponent(l), "PUT", JSON.stringify({
|
|
425
428
|
status: s,
|
|
426
429
|
cancellation_reason: i,
|
|
427
|
-
salt:
|
|
428
|
-
}),
|
|
429
|
-
if ("error" in
|
|
430
|
+
salt: r
|
|
431
|
+
}), u);
|
|
432
|
+
if ("error" in c) {
|
|
430
433
|
this.schedulerStore.set("isLoading", !1);
|
|
431
|
-
const _ = (
|
|
432
|
-
let S =
|
|
433
|
-
if (_ && _ in this.errors.api(
|
|
434
|
+
const _ = (h = c.error) == null ? void 0 : h.type;
|
|
435
|
+
let S = c.error;
|
|
436
|
+
if (_ && _ in this.errors.api(n)) {
|
|
434
437
|
const p = this.getErrorMessage(S);
|
|
435
|
-
S = this.errors.api(
|
|
438
|
+
S = this.errors.api(n)[_](p);
|
|
436
439
|
}
|
|
437
440
|
return { error: S };
|
|
438
441
|
}
|
|
439
|
-
return "data" in
|
|
442
|
+
return "data" in c && s === "confirmed" ? this.schedulerStore.set("confirmedEventInfo", c == null ? void 0 : c.data) : "request_id" in c && s === "cancelled" && this.schedulerStore.set("cancelledEventInfo", {
|
|
440
443
|
booking_id: t
|
|
441
|
-
}), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1),
|
|
444
|
+
}), this.schedulerStore.set("organizerConfirmationBookingId", ""), this.schedulerStore.set("isLoading", !1), c;
|
|
442
445
|
}
|
|
443
446
|
}
|
|
444
|
-
function O(
|
|
447
|
+
function O(o = {}) {
|
|
445
448
|
const e = {
|
|
446
449
|
selectedDate: null,
|
|
447
450
|
selectedLanguage: navigator.language,
|
|
@@ -457,19 +460,19 @@ function O(a = {}) {
|
|
|
457
460
|
cancelledEventInfo: null,
|
|
458
461
|
isLoading: !1,
|
|
459
462
|
nylasBranding: !0,
|
|
460
|
-
...
|
|
463
|
+
...o
|
|
461
464
|
};
|
|
462
465
|
L("[defaultNylasStoreState]: ", e);
|
|
463
466
|
const t = F(e);
|
|
464
467
|
return t.onChange("availability", (s) => {
|
|
465
468
|
L("[availability]: ", s);
|
|
466
|
-
const i = s.map((
|
|
469
|
+
const i = s.map((a) => a.start_time);
|
|
467
470
|
L("[selectableDates]: ", i), t.set("selectableDates", i);
|
|
468
|
-
const
|
|
469
|
-
if (!
|
|
471
|
+
const r = s[0];
|
|
472
|
+
if (!r)
|
|
470
473
|
return;
|
|
471
|
-
const
|
|
472
|
-
L("[durationMinutes]: ",
|
|
474
|
+
const n = Math.floor((r.end_time.getTime() - r.start_time.getTime()) / 6e4);
|
|
475
|
+
L("[durationMinutes]: ", n), t.set("eventDuration", n);
|
|
473
476
|
}), t.reset = () => {
|
|
474
477
|
for (const s in e) {
|
|
475
478
|
const i = e[s];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-7dbf0ae7.cjs");require("react");require("react-dom");const i=".sc-sent-icon-h{display:flex}",o=i,e=class{constructor(s){t.registerInstance(this,s),this.width="15",this.height="15"}render(){return t.h("svg",{key:"ca3a664814e986f46006171c0fb63441478ef5b8",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"e4d9309797e02ca60918d49c55854d51f93c1a2b",d:"M21.5 12L3.5 3.5L3.5 20.5L21.5 12Z",stroke:"auto","stroke-width":"1.5"}),t.h("path",{key:"082bf637872a00ba8abe224cc7c8092dc371ea75",d:"M3.5 3.5L12 10.5",stroke:"auto","stroke-width":"1.5"}),t.h("path",{key:"dd3f5647d7cdb9dfbdb480ab332917564969f546",d:"M3.5 20.5L12 13.5",stroke:"auto","stroke-width":"1.5"}))}};e.style=o;exports.sent_icon=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-7dbf0ae7.cjs");require("react");require("react-dom");const c=".sc-spam-icon-h{display:flex}",i=c,t=class{constructor(s){e.registerInstance(this,s),this.width="15",this.height="15"}render(){return e.h("svg",{key:"a8e87346312ed75a47b88790585e07d8c518c3e9",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},e.h("path",{key:"5cb3444afa08fc37a8cf2e268c62faf5c97379f5",d:"M20 3H4C2.89543 3 2 3.89543 2 5V19C2 20.1046 2.89543 21 4 21H20C21.1046 21 22 20.1046 22 19V5C22 3.89543 21.1046 3 20 3Z",stroke:"auto","stroke-width":"1.5"}),e.h("path",{key:"b695c0e7aa34cf44da99cce51c17ff98b3ad8906",d:"M2 5L12 12.5L22 5",stroke:"auto","stroke-width":"1.5"}))}};t.style=i;exports.spam_icon=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-7dbf0ae7.cjs");require("react");require("react-dom");const i=".sc-star-icon-h{display:flex}",c=i,e=class{constructor(s){t.registerInstance(this,s),this.width="15",this.height="15"}render(){return t.h("svg",{key:"acc7e88e0901acac79fd0bf4a3a355ea82b46934",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"a3a8ed61cce35a1f67c5aa22cb0aee42c965474e",d:"M9.15316 5.40838C10.4198 3.13613 11.0531 2 12 2C12.9469 2 13.5802 3.13612 14.8468 5.40837L15.1745 5.99623C15.5345 6.64193 15.7144 6.96479 15.9951 7.17781C16.2757 7.39083 16.6251 7.4699 17.3241 7.62805L17.9605 7.77203C20.4201 8.32856 21.65 8.60682 21.9426 9.54773C22.2352 10.4886 21.3968 11.4691 19.7199 13.4299L19.2861 13.9372C18.8096 14.4944 18.5713 14.773 18.4641 15.1177C18.357 15.4624 18.393 15.8341 18.465 16.5776L18.5306 17.2544C18.7841 19.8706 18.9109 21.1787 18.1449 21.7602C17.3788 22.3417 16.2273 21.8115 13.9243 20.7512L13.3285 20.4768C12.6741 20.1755 12.3469 20.0248 12 20.0248C11.6531 20.0248 11.3259 20.1755 10.6715 20.4768L10.0757 20.7512C7.77268 21.8115 6.62118 22.3417 5.85515 21.7602C5.08912 21.1787 5.21588 19.8706 5.4694 17.2544L5.53498 16.5776C5.60703 15.8341 5.64305 15.4624 5.53586 15.1177C5.42868 14.773 5.19043 14.4944 4.71392 13.9372L4.2801 13.4299C2.60325 11.4691 1.76482 10.4886 2.05742 9.54773C2.35002 8.60682 3.57986 8.32856 6.03954 7.77203L6.67589 7.62805C7.37485 7.4699 7.72433 7.39083 8.00494 7.17781C8.28555 6.96479 8.46553 6.64194 8.82547 5.99623L9.15316 5.40838Z",stroke:"auto","stroke-width":"1.5"}))}};e.style=c;exports.star_icon=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-7dbf0ae7.cjs");require("react");require("react-dom");const s=".sc-stop-icon-h{display:flex}",i=s,e=class{constructor(o){t.registerInstance(this,o),this.width="15",this.height="15"}render(){return t.h("svg",{key:"f70cc744dde889a32cc0339cf4be41ae38237d0b",width:this.width,height:this.height,viewBox:"0 0 24 24",fill:"auto",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"f7bd4f78d4e2efc797932d91aac355e0f9d4f309",d:"M4 4H20V20H4V4Z",stroke:"auto","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}))}};e.style=i;exports.stop_icon=e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as s, c as l, t as r, h as a } from "./index-
|
|
1
|
+
import { r as s, c as l, t as r, h as a } from "./index-13a43508.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
const i = ':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:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0;display:flex;gap:4px;align-items:center}label .error{color:var(--nylas-error)}textarea{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;padding:12px 16px;border-width:1;resize:vertical;border-radius:8px;font-family:var(--nylas-font-family);font-size:16px;line-height:24px}textarea:focus{outline-color:var(--nylas-primary)}textarea.error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}textarea.error::placeholder{font-weight:400}textarea::placeholder{color:var(--nylas-base-300)}textarea::-webkit-resizer{display:none}', n = i, o = class {
|
package/dist/{textarea-component.entry-93be4a65.cjs → textarea-component.entry-2967dd82.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-7dbf0ae7.cjs");require("react");require("react-dom");const s=':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:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0;display:flex;gap:4px;align-items:center}label .error{color:var(--nylas-error)}textarea{display:flex;height:48px;padding-left:16px;align-items:center;gap:8px;align-self:stretch;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-300);background:var(--nylas-base-0);width:-webkit-fill-available;color:var(--nylas-base-900);font-size:16px;font-style:normal;font-weight:400;line-height:150%;padding:12px 16px;border-width:1;resize:vertical;border-radius:8px;font-family:var(--nylas-font-family);font-size:16px;line-height:24px}textarea:focus{outline-color:var(--nylas-primary)}textarea.error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}textarea.error::placeholder{font-weight:400}textarea::placeholder{color:var(--nylas-base-300)}textarea::-webkit-resizer{display:none}',l=s,r=class{constructor(a){e.registerInstance(this,a),this.nylasFormInputChanged=e.createEvent(this,"nylasFormInputChanged",7),this.name="textarea",this.defaultValue=void 0,this.label="",this.placeholder="",this.required=!1,this.readOnly=!1,this.autoFocus=!1,this.maxLength=255,this.type="multi_line_text",this.tooltip="",this.value="",this.error=""}componentDidLoad(){this.value=e.sanitize(this.defaultValue||"")}handleBookingFormSubmitted(a){this.validate(this.value),this.error&&a.preventDefault()}handletriggerValidation(a){this.validate(this.value),this.error&&a.preventDefault()}handleInput(a){const t=a.target;this.value=e.sanitize(t.value),this.nylasFormInputChanged.emit({value:this.value,name:this.name,error:this.error,label:this.label,type:this.type})}validate(a){this.required&&!a?this.error=`${this.label} is required.`:a.length>this.maxLength?this.error=`${this.label} cannot exceed ${this.maxLength} characters.`:this.error=""}render(){return e.h("label",{key:"503a9e472a4dea351f13d8e430a0ee9ecc20e3fb",part:"tc__label",class:{error:!!this.error}},e.h("p",{key:"7ce9a57c8e2dc9d0c3a88edf93ba09a3b49cf149"},e.h("span",{key:"8feedbb7300d0eb20192b17a0482f9c981bba120",class:"label"},this.label),this.required&&e.h("span",{class:"required"},"*"),this.tooltip&&e.h("tooltip-component",null,e.h("info-icon",{slot:"tooltip-icon"}),e.h("span",{slot:"tooltip-content"},this.tooltip))),e.h("textarea",{key:"79dd6889c5da4797b26504731583db5887c21bcb",name:this.name,placeholder:this.placeholder,readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,onInput:a=>this.handleInput(a),class:{error:!!this.error},part:"tc__textarea"}),this.error&&e.h("span",{class:"error help-text"},this.error))}};r.style=l;exports.textarea_component=r;
|
package/dist/{time-period-selector.entry-2a86f48f.js → time-period-selector.entry-9226fd08.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as s, c as n, d, h as o, g as p } from "./index-
|
|
1
|
+
import { r as s, c as n, d, h as o, g as p } from "./index-13a43508.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
const l = ".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}", c = l, m = {
|