@nylas/web-elements 2.3.2 → 2.3.3-canary-20260206145315
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/cdn/input-color-picker/input-color-picker.es.js +1 -1
- package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +11 -11
- package/dist/cdn/nylas-scheduling/nylas-scheduling.es.js +8 -8
- package/dist/cjs/calendar-agenda-fill-icon_39.cjs.entry.js +1 -1
- package/dist/cjs/calendar-agenda-fill-icon_39.cjs.entry.js.map +1 -1
- package/dist/cjs/checkbox-component.cjs.entry.js +1 -1
- package/dist/cjs/checkbox-component.cjs.entry.js.map +1 -1
- package/dist/cjs/checkbox-component.entry.cjs.js.map +1 -1
- package/dist/cjs/checkmark-icon_15.cjs.entry.js +3 -3
- package/dist/cjs/checkmark-icon_15.cjs.entry.js.map +1 -1
- package/dist/cjs/chevron-icon.search-icon.select-dropdown.entry.cjs.js.map +1 -1
- package/dist/cjs/chevron-icon_3.cjs.entry.js +1 -1
- package/dist/cjs/chevron-icon_3.cjs.entry.js.map +1 -1
- package/dist/cjs/globe-icon.nylas-date-component.nylas-time-window-picker.entry.cjs.js.map +1 -1
- package/dist/cjs/globe-icon_3.cjs.entry.js +1 -1
- package/dist/cjs/globe-icon_3.cjs.entry.js.map +1 -1
- package/dist/cjs/google-logo-icon_6.cjs.entry.js +1 -1
- package/dist/cjs/input-component.cjs.entry.js +1 -1
- package/dist/cjs/input-component.cjs.entry.js.map +1 -1
- package/dist/cjs/input-component.entry.cjs.js.map +1 -1
- package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js +1 -1
- package/dist/cjs/nylas-booked-event-card_11.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
- package/dist/cjs/nylas-scheduling.cjs.entry.js +1 -1
- package/dist/cjs/radio-button-group.cjs.entry.js +1 -1
- package/dist/cjs/radio-button-group.cjs.entry.js.map +1 -1
- package/dist/cjs/radio-button-group.entry.cjs.js.map +1 -1
- package/dist/cjs/textarea-component.cjs.entry.js +1 -1
- package/dist/cjs/textarea-component.cjs.entry.js.map +1 -1
- package/dist/cjs/textarea-component.entry.cjs.js.map +1 -1
- package/dist/cjs/{version-DUyFnawM.js → version-CwWnMgnL.js} +3 -3
- package/dist/cjs/{version-DUyFnawM.js.map → version-CwWnMgnL.js.map} +1 -1
- package/dist/collection/components/design-system/checkbox-component/checkbox-component.css +2 -0
- package/dist/collection/components/design-system/input-color-picker/input-color-picker.css +2 -0
- package/dist/collection/components/design-system/input-component/input-component.css +2 -0
- package/dist/collection/components/design-system/nylas-date-component/nylas-date-component.css +2 -0
- package/dist/collection/components/design-system/radio-button-group/radio-button-group.css +4 -0
- package/dist/collection/components/design-system/select-dropdown/select-dropdown.css +2 -0
- package/dist/collection/components/design-system/textarea-component/textarea-component.css +2 -0
- package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.css +2 -0
- package/dist/collection/components/scheduler-editor/nylas-booking-form-config/nylas-booking-form-config.css +2 -0
- package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.css +2 -0
- package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.css +2 -0
- package/dist/collection/version.js +1 -1
- package/dist/collection/version.js.map +1 -1
- package/dist/components/checkbox-component.js +1 -1
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/input-color-picker.js +1 -1
- package/dist/components/input-component.js +1 -1
- package/dist/components/input-image-url.js +1 -1
- package/dist/components/nylas-additional-participants.js +1 -1
- package/dist/components/nylas-availability-picker.js +1 -1
- package/dist/components/nylas-booking-calendar-picker.js +1 -1
- package/dist/components/nylas-booking-confirmation-redirect.js +1 -1
- package/dist/components/nylas-booking-confirmation-type.js +1 -1
- package/dist/components/nylas-booking-form-config.js +1 -1
- package/dist/components/nylas-booking-form.js +1 -1
- package/dist/components/nylas-buffer-time.js +1 -1
- package/dist/components/nylas-cancel-booking-form.js +1 -1
- package/dist/components/nylas-confirmation-email.js +1 -1
- package/dist/components/nylas-custom-event-slug.js +1 -1
- package/dist/components/nylas-customize-booking-settings.js +1 -1
- package/dist/components/nylas-date-component.js +1 -1
- package/dist/components/nylas-disable-emails.js +1 -1
- package/dist/components/nylas-editor-tabs-group.js +1 -1
- package/dist/components/nylas-editor-tabs.js +1 -1
- package/dist/components/nylas-event-calendar.js +1 -1
- package/dist/components/nylas-event-capacity.js +1 -1
- package/dist/components/nylas-event-description.js +1 -1
- package/dist/components/nylas-event-duration.js +1 -1
- package/dist/components/nylas-event-location.js +1 -1
- package/dist/components/nylas-event-timeslot.js +1 -1
- package/dist/components/nylas-event-title.js +1 -1
- package/dist/components/nylas-feedback-form.js +1 -1
- package/dist/components/nylas-limit-future-bookings.js +1 -1
- package/dist/components/nylas-list-configurations.js +1 -1
- package/dist/components/nylas-locale-switch.js +1 -1
- package/dist/components/nylas-min-booking-notice.js +1 -1
- package/dist/components/nylas-min-cancellation-notice.js +1 -1
- package/dist/components/nylas-notetaker-config.js +1 -1
- package/dist/components/nylas-page-name.js +1 -1
- package/dist/components/nylas-page-styling.js +1 -1
- package/dist/components/nylas-participant-booking-calendars.js +1 -1
- package/dist/components/nylas-participants-custom-availability.js +1 -1
- package/dist/components/nylas-reminder-emails.js +1 -1
- package/dist/components/nylas-reminder-time.js +1 -1
- package/dist/components/nylas-scheduler-editor.js +46 -46
- package/dist/components/nylas-scheduling-method.js +1 -1
- package/dist/components/nylas-scheduling.js +11 -11
- package/dist/components/nylas-specific-time-availability-picker.js +1 -1
- package/dist/components/nylas-timeslot-interval.js +1 -1
- package/dist/components/{p-CdjkLYNh.js → p-1FY06fQD.js} +34 -34
- package/dist/components/{p-CdjkLYNh.js.map → p-1FY06fQD.js.map} +1 -1
- package/dist/components/{p-C1X9fzID.js → p-9PlaXlCB.js} +3 -3
- package/dist/components/{p-C1X9fzID.js.map → p-9PlaXlCB.js.map} +1 -1
- package/dist/components/{p-p2By8R7Z.js → p-B-xvNL5X.js} +3 -3
- package/dist/components/{p-p2By8R7Z.js.map → p-B-xvNL5X.js.map} +1 -1
- package/dist/components/{p-DZJAqRR0.js → p-B4C1SvsK.js} +3 -3
- package/dist/components/{p-DZJAqRR0.js.map → p-B4C1SvsK.js.map} +1 -1
- package/dist/components/{p-FyWR7wsG.js → p-B4WU6Ddk.js} +3 -3
- package/dist/components/{p-FyWR7wsG.js.map → p-B4WU6Ddk.js.map} +1 -1
- package/dist/components/{p-a4aWyy2J.js → p-BCNq-vH8.js} +4 -4
- package/dist/components/{p-a4aWyy2J.js.map → p-BCNq-vH8.js.map} +1 -1
- package/dist/components/{p-ClRazYdc.js → p-BGel3qwa.js} +4 -4
- package/dist/components/{p-ClRazYdc.js.map → p-BGel3qwa.js.map} +1 -1
- package/dist/components/{p-BMS02R_Z.js → p-BJ6nYqW1.js} +3 -3
- package/dist/components/{p-BMS02R_Z.js.map → p-BJ6nYqW1.js.map} +1 -1
- package/dist/components/{p-BA8j6G8I.js → p-BJHGQK2p.js} +3 -3
- package/dist/components/{p-BA8j6G8I.js.map → p-BJHGQK2p.js.map} +1 -1
- package/dist/components/{p-Di7xtAN8.js → p-BWgGjFXi.js} +3 -3
- package/dist/components/{p-Di7xtAN8.js.map → p-BWgGjFXi.js.map} +1 -1
- package/dist/components/{p-B4ta0tDN.js → p-BZ_muELE.js} +3 -3
- package/dist/components/{p-B4ta0tDN.js.map → p-BZ_muELE.js.map} +1 -1
- package/dist/components/{p-DDBe0PRD.js → p-B_ZbZ5lK.js} +3 -3
- package/dist/components/{p-DDBe0PRD.js.map → p-B_ZbZ5lK.js.map} +1 -1
- package/dist/components/{p-BBkyE1MS.js → p-BdQ9iWW4.js} +6 -6
- package/dist/components/{p-BBkyE1MS.js.map → p-BdQ9iWW4.js.map} +1 -1
- package/dist/components/{p-DDM3ZlW1.js → p-BdQA_uHk.js} +3 -3
- package/dist/components/{p-DDM3ZlW1.js.map → p-BdQA_uHk.js.map} +1 -1
- package/dist/components/{p-44_g1hcc.js → p-BeGM4wbq.js} +3 -3
- package/dist/components/{p-44_g1hcc.js.map → p-BeGM4wbq.js.map} +1 -1
- package/dist/components/{p-DM_4oTsI.js → p-BjynTcY9.js} +4 -4
- package/dist/components/{p-DM_4oTsI.js.map → p-BjynTcY9.js.map} +1 -1
- package/dist/components/{p-Bz1eTXD6.js → p-BsMclINV.js} +4 -4
- package/dist/components/{p-Bz1eTXD6.js.map → p-BsMclINV.js.map} +1 -1
- package/dist/components/{p-BdG2pZat.js → p-BvCTseDu.js} +5 -5
- package/dist/components/{p-BdG2pZat.js.map → p-BvCTseDu.js.map} +1 -1
- package/dist/components/{p-lLGrGYYy.js → p-C4s3qYGu.js} +3 -3
- package/dist/components/{p-lLGrGYYy.js.map → p-C4s3qYGu.js.map} +1 -1
- package/dist/components/{p-Dkp7GkzI.js → p-CEvUNENN.js} +3 -3
- package/dist/components/{p-Dkp7GkzI.js.map → p-CEvUNENN.js.map} +1 -1
- package/dist/components/{p-BJACsIxp.js → p-CHQ9sLls.js} +6 -6
- package/dist/components/{p-BJACsIxp.js.map → p-CHQ9sLls.js.map} +1 -1
- package/dist/components/{p-CXvH8gEB.js → p-CIm8sd7h.js} +4 -4
- package/dist/components/{p-CXvH8gEB.js.map → p-CIm8sd7h.js.map} +1 -1
- package/dist/components/{p-eMdkzfgI.js → p-CVnhRnUq.js} +6 -6
- package/dist/components/{p-eMdkzfgI.js.map → p-CVnhRnUq.js.map} +1 -1
- package/dist/components/{p-DzNdcHoB.js → p-CZllU8ii.js} +3 -3
- package/dist/components/{p-DzNdcHoB.js.map → p-CZllU8ii.js.map} +1 -1
- package/dist/components/{p-FGJR3D9_.js → p-Ci9dxGLY.js} +5 -5
- package/dist/components/{p-FGJR3D9_.js.map → p-Ci9dxGLY.js.map} +1 -1
- package/dist/components/{p-CfqEi00L.js → p-D13lTN27.js} +4 -4
- package/dist/components/{p-CfqEi00L.js.map → p-D13lTN27.js.map} +1 -1
- package/dist/components/{p-DsJUpcxE.js → p-DAr02cfd.js} +3 -3
- package/dist/components/{p-DsJUpcxE.js.map → p-DAr02cfd.js.map} +1 -1
- package/dist/components/{p-D0JQ_-Qx.js → p-DDceIF1-.js} +3 -3
- package/dist/components/{p-D0JQ_-Qx.js.map → p-DDceIF1-.js.map} +1 -1
- package/dist/components/{p-CowteGon.js → p-DICXD6Cy.js} +3 -3
- package/dist/components/{p-CowteGon.js.map → p-DICXD6Cy.js.map} +1 -1
- package/dist/components/{p-Dy7hoKyo.js → p-DMltEU-a.js} +4 -4
- package/dist/components/{p-Dy7hoKyo.js.map → p-DMltEU-a.js.map} +1 -1
- package/dist/components/{p-OADv0FUZ.js → p-DNm8Z4AY.js} +3 -3
- package/dist/components/{p-OADv0FUZ.js.map → p-DNm8Z4AY.js.map} +1 -1
- package/dist/components/{p-Dd9ZfJbD.js → p-DTF0fIhr.js} +3 -3
- package/dist/components/p-DTF0fIhr.js.map +1 -0
- package/dist/components/{p-6i8K_2Bl.js → p-DVTv2Hp1.js} +3 -3
- package/dist/components/{p-6i8K_2Bl.js.map → p-DVTv2Hp1.js.map} +1 -1
- package/dist/components/{p-DdroMDi7.js → p-DWCPI1lK.js} +3 -3
- package/dist/components/{p-DdroMDi7.js.map → p-DWCPI1lK.js.map} +1 -1
- package/dist/components/{p-P01mLKOx.js → p-Dary9zXr.js} +3 -3
- package/dist/components/{p-P01mLKOx.js.map → p-Dary9zXr.js.map} +1 -1
- package/dist/components/{p-BmXUSpFE.js → p-DgfDGATC.js} +3 -3
- package/dist/components/{p-BmXUSpFE.js.map → p-DgfDGATC.js.map} +1 -1
- package/dist/components/{p-pgYRW1Gn.js → p-Ey-jPikW.js} +3 -3
- package/dist/components/{p-pgYRW1Gn.js.map → p-Ey-jPikW.js.map} +1 -1
- package/dist/components/{p-BYAaHapV.js → p-FFI2InLT.js} +3 -3
- package/dist/components/{p-BYAaHapV.js.map → p-FFI2InLT.js.map} +1 -1
- package/dist/components/{p-C9c9Tc-Q.js → p-FrLX9pVa.js} +6 -6
- package/dist/components/{p-C9c9Tc-Q.js.map → p-FrLX9pVa.js.map} +1 -1
- package/dist/components/{p-EBvHC_aS.js → p-Gyins0o7.js} +9 -9
- package/dist/components/{p-EBvHC_aS.js.map → p-Gyins0o7.js.map} +1 -1
- package/dist/components/{p-Et75ok2y.js → p-MMkYQKuh.js} +3 -3
- package/dist/components/{p-Et75ok2y.js.map → p-MMkYQKuh.js.map} +1 -1
- package/dist/components/{p-ybLp3dGv.js → p-QKc1T_NS.js} +3 -3
- package/dist/components/{p-ybLp3dGv.js.map → p-QKc1T_NS.js.map} +1 -1
- package/dist/components/{p-D2DM2um3.js → p-UahFYa1w.js} +3 -3
- package/dist/components/{p-D2DM2um3.js.map → p-UahFYa1w.js.map} +1 -1
- package/dist/components/{p-Cqcd_0tY.js → p-cylqcpvp.js} +41 -41
- package/dist/components/{p-Cqcd_0tY.js.map → p-cylqcpvp.js.map} +1 -1
- package/dist/components/{p-kRlkh0g-.js → p-idvnK5Rl.js} +3 -3
- package/dist/components/{p-kRlkh0g-.js.map → p-idvnK5Rl.js.map} +1 -1
- package/dist/components/{p-Bho2Hb_A.js → p-keUQQIah.js} +4 -4
- package/dist/components/{p-Bho2Hb_A.js.map → p-keUQQIah.js.map} +1 -1
- package/dist/components/{p-DAAGx7-h.js → p-pLqfEMSB.js} +3 -3
- package/dist/components/{p-DAAGx7-h.js.map → p-pLqfEMSB.js.map} +1 -1
- package/dist/components/{p-BAZ-jMiz.js → p-pRwtuoW0.js} +4 -4
- package/dist/components/{p-BAZ-jMiz.js.map → p-pRwtuoW0.js.map} +1 -1
- package/dist/components/{p-CJ3feL4K.js → p-whoa2mmo.js} +14 -14
- package/dist/components/{p-CJ3feL4K.js.map → p-whoa2mmo.js.map} +1 -1
- package/dist/components/radio-button-group.js +1 -1
- package/dist/components/select-dropdown.js +1 -1
- package/dist/components/textarea-component.js +1 -1
- package/dist/components/time-period-selector.js +1 -1
- package/dist/esm/calendar-agenda-fill-icon_39.entry.js +1 -1
- package/dist/esm/calendar-agenda-fill-icon_39.entry.js.map +1 -1
- package/dist/esm/checkbox-component.entry.js +1 -1
- package/dist/esm/checkbox-component.entry.js.map +1 -1
- package/dist/esm/checkmark-icon_15.entry.js +3 -3
- package/dist/esm/checkmark-icon_15.entry.js.map +1 -1
- package/dist/esm/chevron-icon.search-icon.select-dropdown.entry.js.map +1 -1
- package/dist/esm/chevron-icon_3.entry.js +1 -1
- package/dist/esm/chevron-icon_3.entry.js.map +1 -1
- package/dist/esm/globe-icon.nylas-date-component.nylas-time-window-picker.entry.js.map +1 -1
- package/dist/esm/globe-icon_3.entry.js +1 -1
- package/dist/esm/globe-icon_3.entry.js.map +1 -1
- package/dist/esm/google-logo-icon_6.entry.js +1 -1
- package/dist/esm/input-component.entry.js +1 -1
- package/dist/esm/input-component.entry.js.map +1 -1
- package/dist/esm/nylas-booked-event-card_11.entry.js +1 -1
- package/dist/esm/nylas-booked-event-card_11.entry.js.map +1 -1
- package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
- package/dist/esm/nylas-scheduling.entry.js +1 -1
- package/dist/esm/radio-button-group.entry.js +1 -1
- package/dist/esm/radio-button-group.entry.js.map +1 -1
- package/dist/esm/textarea-component.entry.js +1 -1
- package/dist/esm/textarea-component.entry.js.map +1 -1
- package/dist/esm/{version-BxqBxG4o.js → version-DM0y_1NQ.js} +3 -3
- package/dist/esm/{version-BxqBxG4o.js.map → version-DM0y_1NQ.js.map} +1 -1
- package/dist/nylas-web-elements/checkbox-component.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/chevron-icon.search-icon.select-dropdown.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/globe-icon.nylas-date-component.nylas-time-window-picker.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/input-component.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/p-23df6f78.entry.js +8 -0
- package/dist/nylas-web-elements/p-23df6f78.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-34c4bf5b.entry.js +2 -0
- package/dist/nylas-web-elements/{p-2bff143d.entry.js.map → p-34c4bf5b.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-52a66db6.entry.js +2 -0
- package/dist/nylas-web-elements/{p-1ba901b1.entry.js.map → p-52a66db6.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-5b01e519.entry.js +2 -0
- package/dist/nylas-web-elements/p-5b01e519.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-9a5b1cfb.entry.js +2 -0
- package/dist/nylas-web-elements/{p-ab80b127.entry.js.map → p-9a5b1cfb.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-9c264d62.entry.js +2 -0
- package/dist/nylas-web-elements/{p-7655eeb0.entry.js.map → p-9c264d62.entry.js.map} +1 -1
- package/dist/nylas-web-elements/p-DM0y_1NQ.js +2 -0
- package/dist/nylas-web-elements/{p-BxqBxG4o.js.map → p-DM0y_1NQ.js.map} +1 -1
- package/dist/nylas-web-elements/p-b0306d35.entry.js +2 -0
- package/dist/nylas-web-elements/{p-70762abf.entry.js.map → p-b0306d35.entry.js.map} +1 -1
- package/dist/nylas-web-elements/{p-9c78baa7.entry.js → p-b2c497eb.entry.js} +2 -2
- package/dist/nylas-web-elements/p-b2c497eb.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-70614faf.entry.js → p-b90acc64.entry.js} +2 -2
- package/dist/nylas-web-elements/p-c91eb1ba.entry.js +2 -0
- package/dist/nylas-web-elements/{p-e042747e.entry.js.map → p-c91eb1ba.entry.js.map} +1 -1
- package/dist/nylas-web-elements/{p-2d23ef5e.entry.js → p-daf5083c.entry.js} +2 -2
- package/dist/nylas-web-elements/{p-428a7363.entry.js → p-dbad0a98.entry.js} +2 -2
- package/dist/nylas-web-elements/radio-button-group.entry.esm.js.map +1 -1
- package/dist/nylas-web-elements/textarea-component.entry.esm.js.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/p-Dd9ZfJbD.js.map +0 -1
- package/dist/nylas-web-elements/p-1ba901b1.entry.js +0 -2
- package/dist/nylas-web-elements/p-2bff143d.entry.js +0 -2
- package/dist/nylas-web-elements/p-70762abf.entry.js +0 -2
- package/dist/nylas-web-elements/p-7655eeb0.entry.js +0 -2
- package/dist/nylas-web-elements/p-88112606.entry.js +0 -8
- package/dist/nylas-web-elements/p-88112606.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-9c78baa7.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-BxqBxG4o.js +0 -2
- package/dist/nylas-web-elements/p-ab80b127.entry.js +0 -2
- package/dist/nylas-web-elements/p-e042747e.entry.js +0 -2
- package/dist/nylas-web-elements/p-e82826b8.entry.js +0 -2
- package/dist/nylas-web-elements/p-e82826b8.entry.js.map +0 -1
- /package/dist/nylas-web-elements/{p-70614faf.entry.js.map → p-b90acc64.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-2d23ef5e.entry.js.map → p-daf5083c.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-428a7363.entry.js.map → p-dbad0a98.entry.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as a,h as s,a as l}from"./p-0EQQA0nE.js";import{o as r}from"./p-D7AODx4L.js";const t=':host{display:block;height:auto;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;word-break:break-word;overflow-wrap:break-word;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}label .error{color:var(--nylas-error)}.input_wrapper{display:flex;align-items:center;gap:1rem}input[type=text],input[type=number],input[type=email],input[type=phone_number]{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%;width:-moz-available;width:-webkit-fill-available}input[type=text]:focus,input[type=number]:focus,input[type=email]:focus,input[type=phone_number]:focus{outline-color:var(--nylas-primary)}input[type=text].error,input[type=number].error,input[type=email].error,input[type=phone_number].error{border-radius:var(--nylas-border-radius-2x);font-weight:600;border-color:var(--nylas-error);border-width:2px}input[type=text].error::placeholder,input[type=number].error::placeholder,input[type=email].error::placeholder,input[type=phone_number].error::placeholder{font-weight:400}input[type=text]::placeholder,input[type=number]::placeholder,input[type=email]::placeholder,input[type=phone_number]::placeholder{color:var(--nylas-base-300)}input:read-only{background-color:var(--nylas-base-100);cursor:not-allowed}';const n={email:/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,phone_number:/^\+?\d{1,15}$/};const i={email:"name@example.com",phone_number:"1234567890"};const o=class{constructor(s){e(this,s);this.nylasFormInputChanged=a(this,"nylasFormInputChanged",7);this.nylasFormInputFocused=a(this,"nylasFormInputFocused",7);this.nylasFormInputBlurred=a(this,"nylasFormInputBlurred",7);this.name="input";this.label="";this.type="text";this.placeholder=i[this.type];this.required=false;this.readOnly=false;this.autoFocus=false;this.maxLength=255;this.patternError="";this.requiredError="";this.error=""}handleDefaultValueChange(e){this.value=r(e);if(this.value){this.validatePattern(this.value)}}themeConfigChangedHandler(e,a){if(e===a)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[a,s]of Object.entries(e)){this.el.style.setProperty(`${a}`,s)}}}connectedCallback(){queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.el.setAttribute("data-themed","")}}))}componentWillLoad(){}componentDidLoad(){this.value=r(this.defaultValue||"");if(this.type!=="text"&&!this.pattern){this.pattern=n[this.type]}if(this.value){this.validatePattern(this.value)}}handleBookingFormSubmitted(e){this.validatePattern(this.value);if(this.error){e.preventDefault()}}async handleFormSubmitted(e){if(this.el?.getAttribute("data-page-styling")){this.validatePattern(this.value);if(this.error){e.preventDefault()}}}handleInput(e){this.error="";const a=e.target.value;if(this.type==="number"){const e=parseFloat(a);if(this.maxValue!==undefined&&e>this.maxValue||this.minValue!==undefined&&e<this.minValue){if(this.minValue===undefined){this.error=`Value must be less than ${this.maxValue}`}else if(this.maxValue===undefined){this.error=`Value must be greater than ${this.minValue}`}else{this.error=`Value must be between ${this.minValue} and ${this.maxValue}`}}else if(isNaN(e)){this.error=this.patternError||"Invalid format."}}this.value=r(a);this.nylasFormInputChanged.emit({value:this.value,name:this.name,label:this.label,error:this.error,type:this.type})}handleBlur(){this.nylasFormInputBlurred.emit({value:this.value,name:this.name})}handleFocus(){this.nylasFormInputFocused.emit({value:this.value,name:this.name})}validatePattern(e){this.error="";if(this.required&&!e){this.error=this.requiredError||"This field is required.";return}if(this.type==="number"&&e){const a=parseFloat(e);if(this.maxValue!==undefined&&a>this.maxValue||this.minValue!==undefined&&a<this.minValue){this.error=`Value must be between ${this.minValue} and ${this.maxValue}`;return}}if(this.pattern&&e&&!this.pattern.test(e)){this.error=this.patternError||"Invalid format."}}render(){return s("label",{key:"a42cf1c62df9da49e94105ad445bac228da4c71f",part:this.error?"ic__label ic__label--error":"ic__label",class:{error:!!this.error}},this.label&&s("p",{key:"4323a02744309c5cfed355ec57f9efda98743d5e"},s("span",{key:"9186ea21fb968ffdbc42fb634c250a705e241062",class:"label"},this.label),this.required&&s("span",{key:"a27c132a43ce5c1d66589935758d7a97c405bb05",class:"required"},"*")),s("div",{key:"5a5d23687f23aad3ae064d40373b911d46dd9238",part:"ic__input_wrapper",class:"input_wrapper"},s("input",{key:"c7120081aaf188536e73b7900e255ffeb5102d8b",type:this.type,name:this.name,part:this.error?"ic__input ic__input--error":"ic__input",title:this.readOnly?"read-only field":undefined,readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,max:this.type==="number"?this.maxValue:undefined,min:this.type==="number"?this.minValue:undefined,placeholder:this.placeholder,class:{error:!!this.error},onInput:e=>this.handleInput(e),onFocus:()=>this.handleFocus(),onBlur:()=>this.handleBlur()}),s("slot",{key:"07bf4e931fc872171aa8d5e31ea52a5e031e2bed",name:"additional-input"})),this.error&&s("span",{key:"cda24302b383b17b346ff32261a8f5345eddc6c2",class:"error help-text",part:"ic__error_message"},this.error))}get el(){return l(this)}static get watchers(){return{defaultValue:["handleDefaultValueChange"],themeConfig:["themeConfigChangedHandler"]}}};o.style=t;export{o as input_component};
|
|
2
|
+
//# sourceMappingURL=p-9c264d62.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["inputComponentCss","DefaultPattern","email","phone_number","DefaultPlaceholder","InputComponent","constructor","hostRef","this","name","label","type","placeholder","required","readOnly","autoFocus","maxLength","patternError","requiredError","error","handleDefaultValueChange","newValue","value","sanitize","validatePattern","themeConfigChangedHandler","newVal","oldVal","applyThemeConfig","themeConfig","key","Object","entries","el","style","setProperty","connectedCallback","queueMicrotask","setAttribute","componentWillLoad","componentDidLoad","defaultValue","pattern","handleBookingFormSubmitted","event","preventDefault","handleFormSubmitted","getAttribute","handleInput","e","inputValue","target","numericValue","parseFloat","maxValue","undefined","minValue","isNaN","nylasFormInputChanged","emit","handleBlur","nylasFormInputBlurred","handleFocus","nylasFormInputFocused","test","render","h","part","class","title","max","min","onInput","onFocus","onBlur"],"sources":["src/components/design-system/input-component/input-component.scss?tag=input-component&encapsulation=shadow","src/components/design-system/input-component/input-component.tsx"],"sourcesContent":["@use '../../../common/styles/variables' as *;\n@use '../../../common/mixins/inputs' as *;\n\n:host {\n display: block;\n height: auto;\n @include default-css-variables;\n width: 100%;\n}\n\nlabel {\n @include input-label;\n flex-direction: column;\n gap: 4px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n color: var(--nylas-base-800);\n\n p {\n margin: 0;\n }\n\n .error {\n color: var(--nylas-error);\n }\n}\n\n.input_wrapper {\n display: flex;\n align-items: center;\n gap: 1rem;\n}\n\ninput[type='text'],\ninput[type='number'],\ninput[type='email'],\ninput[type='phone_number'] {\n @include textfield;\n width: -moz-available;\n width: -webkit-fill-available;\n}\n\ninput:read-only {\n background-color: var(--nylas-base-100);\n cursor: not-allowed;\n}","import { Component, h, Prop, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\nimport { sanitize } from '@/utils/utils';\nimport { ThemeConfig } from '@nylas/core';\n\nconst DefaultPattern = {\n email: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,\n phone_number: /^\\+?\\d{1,15}$/,\n};\n\nconst DefaultPlaceholder = {\n email: 'name@example.com',\n phone_number: '1234567890',\n};\n\n/**\n * The `input-component` component is a UI component that allows users to input text, email, or phone number values.\n * This component is used in the scheduling form to input text, email and phone number type inputs.\n */\n\n@Component({\n tag: 'input-component',\n styleUrl: 'input-component.scss',\n shadow: true,\n})\nexport class InputComponent {\n /**\n * The host element\n */\n @Element() el!: HTMLElement;\n /**\n * The name of the input. This is used to identify the input when submitting a form.\n */\n @Prop() name: string = 'input';\n /**\n * The default value of the input. This is the value that is displayed when the input is rendered.\n */\n @Prop() defaultValue?: string;\n /**\n * The label of the input. This is displayed above the input.\n */\n @Prop() label: string = '';\n /**\n * The type of the input. This is used to determine the input's behavior.\n * Supported types are 'text', 'email', and 'phone_number'.\n */\n @Prop() type: 'text' | 'email' | 'phone_number' | 'number' = 'text';\n /**\n * The placeholder of the input. This is displayed when the input is empty.\n */\n @Prop() placeholder: string = DefaultPlaceholder[this.type];\n /**\n * Whether the input is required. If true, the input must have a value when submitting a form.\n * Default is false. If the input is required and the value is empty, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * Whether the input is read-only. If true, the input cannot be edited.\n * Default is false.\n */\n @Prop() readOnly: boolean = false;\n /**\n * Whether the input should be focused when rendered.\n * Default is false. If true, the input is focused when rendered.\n * Use this to set the focus on the first input in a form.\n */\n @Prop() autoFocus: boolean = false;\n /**\n * The pattern to validate the input value. If the value does not match the pattern, an error message is displayed.\n * Default is null. If the pattern is not set, the pattern is determined by the input type for 'email' and 'phone_number'.\n */\n @Prop() pattern?: RegExp;\n /**\n * The maximum length of the input value. If the value is longer than the maximum length, an error message is displayed.\n * Default is 255.\n */\n @Prop() maxLength: number = 255;\n /**\n * The error message to display when the value does not match the pattern.\n * Default is 'Invalid <field> format.' where <field> is the input label.\n */\n @Prop() patternError: string = '';\n\n /**\n * This error message is displayed when the input value is empty and the input is required.\n */\n @Prop() requiredError: string = '';\n @Prop() maxValue?: number; // Optional max value for 'number'\n @Prop() minValue?: number; // Optional min value for 'number'\n\n /**\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: ThemeConfig;\n\n /**\n * The input value state.\n */\n @State() value!: string;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * This event is fired when the input value is changed.\n * The scheduling form listens for this event to validate the input value and submit the form.\n * If using outside of the scheduling form, listen for this event to validate the input value\n * and handle the input value change.\n */\n @Event() nylasFormInputChanged!: EventEmitter<{\n value: string;\n name: string;\n label: string;\n type: string;\n error: string;\n }>;\n\n @Event() nylasFormInputFocused!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n @Event() nylasFormInputBlurred!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n // Lifecycle methods\n @Watch('defaultValue')\n handleDefaultValueChange(newValue: string) {\n this.value = sanitize(newValue);\n if (this.value) {\n this.validatePattern(this.value);\n }\n }\n\n @Watch('themeConfig')\n themeConfigChangedHandler(newVal: ThemeConfig, oldVal: ThemeConfig) {\n if (newVal === oldVal) return;\n this.applyThemeConfig(newVal);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.el.style.setProperty(`${key}`, value);\n }\n }\n }\n\n connectedCallback() {\n // Use queueMicrotask to defer theme application until after React has set props.\n // This fixes the timing issue where connectedCallback fires before React sets themeConfig.\n queueMicrotask(() => {\n if (this.themeConfig) {\n this.applyThemeConfig(this.themeConfig);\n this.el.setAttribute('data-themed', '');\n }\n });\n }\n\n componentWillLoad() {\n // Theme already applied in connectedCallback\n }\n\n componentDidLoad() {\n this.value = sanitize(this.defaultValue || '');\n if (this.type !== 'text' && !this.pattern) {\n this.pattern = DefaultPattern[this.type];\n }\n\n if (this.value) {\n this.validatePattern(this.value);\n }\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n this.validatePattern(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n @Listen('formSubmitted', { target: 'document' })\n async handleFormSubmitted(event: CustomEvent) {\n if (this.el?.getAttribute('data-page-styling')) {\n this.validatePattern(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n }\n\n // Methods\n handleInput(e: Event) {\n this.error = '';\n const inputValue = (e.target as HTMLInputElement).value;\n\n // For 'number', ensure the value is valid\n if (this.type === 'number') {\n const numericValue = parseFloat(inputValue);\n if ((this.maxValue !== undefined && numericValue > this.maxValue) || (this.minValue !== undefined && numericValue < this.minValue)) {\n if (this.minValue === undefined) {\n this.error = `Value must be less than ${this.maxValue}`;\n } else if (this.maxValue === undefined) {\n this.error = `Value must be greater than ${this.minValue}`;\n } else {\n this.error = `Value must be between ${this.minValue} and ${this.maxValue}`;\n }\n } else if (isNaN(numericValue)) {\n this.error = this.patternError || 'Invalid format.';\n }\n }\n\n this.value = sanitize(inputValue);\n this.nylasFormInputChanged.emit({\n value: this.value,\n name: this.name,\n label: this.label,\n error: this.error,\n type: this.type,\n });\n }\n\n handleBlur() {\n this.nylasFormInputBlurred.emit({\n value: this.value,\n name: this.name,\n });\n }\n\n handleFocus() {\n this.nylasFormInputFocused.emit({\n value: this.value,\n name: this.name,\n });\n }\n\n validatePattern(value: string) {\n // Reset error\n this.error = '';\n\n if (this.required && !value) {\n this.error = this.requiredError || 'This field is required.';\n return;\n }\n\n if (this.type === 'number' && value) {\n const numericValue = parseFloat(value);\n if ((this.maxValue !== undefined && numericValue > this.maxValue) || (this.minValue !== undefined && numericValue < this.minValue)) {\n this.error = `Value must be between ${this.minValue} and ${this.maxValue}`;\n return;\n }\n }\n\n if (this.pattern && value && !this.pattern.test(value)) {\n this.error = this.patternError || 'Invalid format.';\n }\n }\n\n render() {\n return (\n <label part={this.error ? 'ic__label ic__label--error' : 'ic__label'} class={{ error: !!this.error }}>\n {this.label && (\n <p>\n <span class=\"label\">{this.label}</span>\n {this.required && <span class=\"required\">*</span>}\n </p>\n )}\n <div part=\"ic__input_wrapper\" class=\"input_wrapper\">\n <input\n type={this.type}\n name={this.name}\n part={this.error ? 'ic__input ic__input--error' : 'ic__input'}\n title={this.readOnly ? 'read-only field' : undefined}\n readOnly={this.readOnly}\n autoFocus={this.autoFocus}\n value={this.value}\n maxLength={this.maxLength}\n max={this.type === 'number' ? this.maxValue : undefined}\n min={this.type === 'number' ? this.minValue : undefined}\n placeholder={this.placeholder}\n class={{ error: !!this.error }}\n onInput={e => this.handleInput(e)}\n onFocus={() => this.handleFocus()}\n onBlur={() => this.handleBlur()}\n />\n <slot name=\"additional-input\"></slot>\n </div>\n {this.error && (\n <span class=\"error help-text\" part=\"ic__error_message\">\n {this.error}\n </span>\n )}\n </label>\n );\n }\n}\n"],"mappings":"6FAAA,MAAMA,EAAoB,4zHCI1B,MAAMC,EAAiB,CACrBC,MAAO,uIACPC,aAAc,iBAGhB,MAAMC,EAAqB,CACzBF,MAAO,mBACPC,aAAc,c,MAaHE,EAAc,MAL3B,WAAAC,CAAAC,G,iMAaUC,KAAIC,KAAW,QAQfD,KAAKE,MAAW,GAKhBF,KAAIG,KAAiD,OAIrDH,KAAAI,YAAsBR,EAAmBI,KAAKG,MAK9CH,KAAQK,SAAY,MAKpBL,KAAQM,SAAY,MAMpBN,KAASO,UAAY,MAUrBP,KAASQ,UAAW,IAKpBR,KAAYS,aAAW,GAKvBT,KAAaU,cAAW,GAgBvBV,KAAKW,MAAW,EAyM1B,CA7KC,wBAAAC,CAAyBC,GACvBb,KAAKc,MAAQC,EAASF,GACtB,GAAIb,KAAKc,MAAO,CACdd,KAAKgB,gBAAgBhB,KAAKc,M,EAK9B,yBAAAG,CAA0BC,EAAqBC,GAC7C,GAAID,IAAWC,EAAQ,OACvBnB,KAAKoB,iBAAiBF,E,CAGxB,gBAAAE,CAAiBC,GACf,GAAIA,EAAa,CACf,IAAK,MAAOC,EAAKR,KAAUS,OAAOC,QAAQH,GAAc,CACtDrB,KAAKyB,GAAGC,MAAMC,YAAY,GAAGL,IAAOR,E,GAK1C,iBAAAc,GAGEC,gBAAe,KACb,GAAI7B,KAAKqB,YAAa,CACpBrB,KAAKoB,iBAAiBpB,KAAKqB,aAC3BrB,KAAKyB,GAAGK,aAAa,cAAe,G,KAK1C,iBAAAC,G,CAIA,gBAAAC,GACEhC,KAAKc,MAAQC,EAASf,KAAKiC,cAAgB,IAC3C,GAAIjC,KAAKG,OAAS,SAAWH,KAAKkC,QAAS,CACzClC,KAAKkC,QAAUzC,EAAeO,KAAKG,K,CAGrC,GAAIH,KAAKc,MAAO,CACdd,KAAKgB,gBAAgBhB,KAAKc,M,EAS9B,0BAAAqB,CAA2BC,GACzBpC,KAAKgB,gBAAgBhB,KAAKc,OAC1B,GAAId,KAAKW,MAAO,CACdyB,EAAMC,gB,EAKV,yBAAMC,CAAoBF,GACxB,GAAIpC,KAAKyB,IAAIc,aAAa,qBAAsB,CAC9CvC,KAAKgB,gBAAgBhB,KAAKc,OAC1B,GAAId,KAAKW,MAAO,CACdyB,EAAMC,gB,GAMZ,WAAAG,CAAYC,GACVzC,KAAKW,MAAQ,GACb,MAAM+B,EAAcD,EAAEE,OAA4B7B,MAGlD,GAAId,KAAKG,OAAS,SAAU,CAC1B,MAAMyC,EAAeC,WAAWH,GAChC,GAAK1C,KAAK8C,WAAaC,WAAaH,EAAe5C,KAAK8C,UAAc9C,KAAKgD,WAAaD,WAAaH,EAAe5C,KAAKgD,SAAW,CAClI,GAAIhD,KAAKgD,WAAaD,UAAW,CAC/B/C,KAAKW,MAAQ,2BAA2BX,KAAK8C,U,MACxC,GAAI9C,KAAK8C,WAAaC,UAAW,CACtC/C,KAAKW,MAAQ,8BAA8BX,KAAKgD,U,KAC3C,CACLhD,KAAKW,MAAQ,yBAAyBX,KAAKgD,gBAAgBhD,KAAK8C,U,OAE7D,GAAIG,MAAML,GAAe,CAC9B5C,KAAKW,MAAQX,KAAKS,cAAgB,iB,EAItCT,KAAKc,MAAQC,EAAS2B,GACtB1C,KAAKkD,sBAAsBC,KAAK,CAC9BrC,MAAOd,KAAKc,MACZb,KAAMD,KAAKC,KACXC,MAAOF,KAAKE,MACZS,MAAOX,KAAKW,MACZR,KAAMH,KAAKG,M,CAIf,UAAAiD,GACEpD,KAAKqD,sBAAsBF,KAAK,CAC9BrC,MAAOd,KAAKc,MACZb,KAAMD,KAAKC,M,CAIf,WAAAqD,GACEtD,KAAKuD,sBAAsBJ,KAAK,CAC9BrC,MAAOd,KAAKc,MACZb,KAAMD,KAAKC,M,CAIf,eAAAe,CAAgBF,GAEdd,KAAKW,MAAQ,GAEb,GAAIX,KAAKK,WAAaS,EAAO,CAC3Bd,KAAKW,MAAQX,KAAKU,eAAiB,0BACnC,M,CAGF,GAAIV,KAAKG,OAAS,UAAYW,EAAO,CACnC,MAAM8B,EAAeC,WAAW/B,GAChC,GAAKd,KAAK8C,WAAaC,WAAaH,EAAe5C,KAAK8C,UAAc9C,KAAKgD,WAAaD,WAAaH,EAAe5C,KAAKgD,SAAW,CAClIhD,KAAKW,MAAQ,yBAAyBX,KAAKgD,gBAAgBhD,KAAK8C,WAChE,M,EAIJ,GAAI9C,KAAKkC,SAAWpB,IAAUd,KAAKkC,QAAQsB,KAAK1C,GAAQ,CACtDd,KAAKW,MAAQX,KAAKS,cAAgB,iB,EAItC,MAAAgD,GACE,OACEC,EAAO,SAAApC,IAAA,2CAAAqC,KAAM3D,KAAKW,MAAQ,6BAA+B,YAAaiD,MAAO,CAAEjD,QAASX,KAAKW,QAC1FX,KAAKE,OACJwD,EAAA,KAAApC,IAAA,4CACEoC,EAAA,QAAApC,IAAA,2CAAMsC,MAAM,SAAS5D,KAAKE,OACzBF,KAAKK,UAAYqD,EAAA,QAAApC,IAAA,2CAAMsC,MAAM,YAAmB,MAGrDF,EAAA,OAAApC,IAAA,2CAAKqC,KAAK,oBAAoBC,MAAM,iBAClCF,EAAA,SAAApC,IAAA,2CACEnB,KAAMH,KAAKG,KACXF,KAAMD,KAAKC,KACX0D,KAAM3D,KAAKW,MAAQ,6BAA+B,YAClDkD,MAAO7D,KAAKM,SAAW,kBAAoByC,UAC3CzC,SAAUN,KAAKM,SACfC,UAAWP,KAAKO,UAChBO,MAAOd,KAAKc,MACZN,UAAWR,KAAKQ,UAChBsD,IAAK9D,KAAKG,OAAS,SAAWH,KAAK8C,SAAWC,UAC9CgB,IAAK/D,KAAKG,OAAS,SAAWH,KAAKgD,SAAWD,UAC9C3C,YAAaJ,KAAKI,YAClBwD,MAAO,CAAEjD,QAASX,KAAKW,OACvBqD,QAASvB,GAAKzC,KAAKwC,YAAYC,GAC/BwB,QAAS,IAAMjE,KAAKsD,cACpBY,OAAQ,IAAMlE,KAAKoD,eAErBM,EAAA,QAAApC,IAAA,2CAAMrB,KAAK,sBAEZD,KAAKW,OACJ+C,EAAA,QAAApC,IAAA,2CAAMsC,MAAM,kBAAkBD,KAAK,qBAChC3D,KAAKW,O","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["inputComponentCss","DefaultPattern","email","phone_number","DefaultPlaceholder","InputComponent","constructor","hostRef","this","name","label","type","placeholder","required","readOnly","autoFocus","maxLength","patternError","requiredError","error","handleDefaultValueChange","newValue","value","sanitize","validatePattern","themeConfigChangedHandler","newVal","oldVal","applyThemeConfig","themeConfig","key","Object","entries","el","style","setProperty","connectedCallback","queueMicrotask","setAttribute","componentWillLoad","componentDidLoad","defaultValue","pattern","handleBookingFormSubmitted","event","preventDefault","handleFormSubmitted","getAttribute","handleInput","e","inputValue","target","numericValue","parseFloat","maxValue","undefined","minValue","isNaN","nylasFormInputChanged","emit","handleBlur","nylasFormInputBlurred","handleFocus","nylasFormInputFocused","test","render","h","part","class","title","max","min","onInput","onFocus","onBlur"],"sources":["src/components/design-system/input-component/input-component.scss?tag=input-component&encapsulation=shadow","src/components/design-system/input-component/input-component.tsx"],"sourcesContent":["@use '../../../common/styles/variables' as *;\n@use '../../../common/mixins/inputs' as *;\n\n:host {\n display: block;\n height: auto;\n @include default-css-variables;\n width: 100%;\n}\n\nlabel {\n @include input-label;\n flex-direction: column;\n gap: 4px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n color: var(--nylas-base-800);\n\n p {\n margin: 0;\n }\n\n .error {\n color: var(--nylas-error);\n }\n}\n\n.input_wrapper {\n display: flex;\n align-items: center;\n gap: 1rem;\n}\n\ninput[type='text'],\ninput[type='number'],\ninput[type='email'],\ninput[type='phone_number'] {\n @include textfield;\n width: -moz-available;\n width: -webkit-fill-available;\n}\n\ninput:read-only {\n background-color: var(--nylas-base-100);\n cursor: not-allowed;\n}","import { Component, h, Prop, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\nimport { sanitize } from '@/utils/utils';\nimport { ThemeConfig } from '@nylas/core';\n\nconst DefaultPattern = {\n email: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,\n phone_number: /^\\+?\\d{1,15}$/,\n};\n\nconst DefaultPlaceholder = {\n email: 'name@example.com',\n phone_number: '1234567890',\n};\n\n/**\n * The `input-component` component is a UI component that allows users to input text, email, or phone number values.\n * This component is used in the scheduling form to input text, email and phone number type inputs.\n */\n\n@Component({\n tag: 'input-component',\n styleUrl: 'input-component.scss',\n shadow: true,\n})\nexport class InputComponent {\n /**\n * The host element\n */\n @Element() el!: HTMLElement;\n /**\n * The name of the input. This is used to identify the input when submitting a form.\n */\n @Prop() name: string = 'input';\n /**\n * The default value of the input. This is the value that is displayed when the input is rendered.\n */\n @Prop() defaultValue?: string;\n /**\n * The label of the input. This is displayed above the input.\n */\n @Prop() label: string = '';\n /**\n * The type of the input. This is used to determine the input's behavior.\n * Supported types are 'text', 'email', and 'phone_number'.\n */\n @Prop() type: 'text' | 'email' | 'phone_number' | 'number' = 'text';\n /**\n * The placeholder of the input. This is displayed when the input is empty.\n */\n @Prop() placeholder: string = DefaultPlaceholder[this.type];\n /**\n * Whether the input is required. If true, the input must have a value when submitting a form.\n * Default is false. If the input is required and the value is empty, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * Whether the input is read-only. If true, the input cannot be edited.\n * Default is false.\n */\n @Prop() readOnly: boolean = false;\n /**\n * Whether the input should be focused when rendered.\n * Default is false. If true, the input is focused when rendered.\n * Use this to set the focus on the first input in a form.\n */\n @Prop() autoFocus: boolean = false;\n /**\n * The pattern to validate the input value. If the value does not match the pattern, an error message is displayed.\n * Default is null. If the pattern is not set, the pattern is determined by the input type for 'email' and 'phone_number'.\n */\n @Prop() pattern?: RegExp;\n /**\n * The maximum length of the input value. If the value is longer than the maximum length, an error message is displayed.\n * Default is 255.\n */\n @Prop() maxLength: number = 255;\n /**\n * The error message to display when the value does not match the pattern.\n * Default is 'Invalid <field> format.' where <field> is the input label.\n */\n @Prop() patternError: string = '';\n\n /**\n * This error message is displayed when the input value is empty and the input is required.\n */\n @Prop() requiredError: string = '';\n @Prop() maxValue?: number; // Optional max value for 'number'\n @Prop() minValue?: number; // Optional min value for 'number'\n\n /**\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: ThemeConfig;\n\n /**\n * The input value state.\n */\n @State() value!: string;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * This event is fired when the input value is changed.\n * The scheduling form listens for this event to validate the input value and submit the form.\n * If using outside of the scheduling form, listen for this event to validate the input value\n * and handle the input value change.\n */\n @Event() nylasFormInputChanged!: EventEmitter<{\n value: string;\n name: string;\n label: string;\n type: string;\n error: string;\n }>;\n\n @Event() nylasFormInputFocused!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n @Event() nylasFormInputBlurred!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n // Lifecycle methods\n @Watch('defaultValue')\n handleDefaultValueChange(newValue: string) {\n this.value = sanitize(newValue);\n if (this.value) {\n this.validatePattern(this.value);\n }\n }\n\n @Watch('themeConfig')\n themeConfigChangedHandler(newVal: ThemeConfig, oldVal: ThemeConfig) {\n if (newVal === oldVal) return;\n this.applyThemeConfig(newVal);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.el.style.setProperty(`${key}`, value);\n }\n }\n }\n\n connectedCallback() {\n // Use queueMicrotask to defer theme application until after React has set props.\n // This fixes the timing issue where connectedCallback fires before React sets themeConfig.\n queueMicrotask(() => {\n if (this.themeConfig) {\n this.applyThemeConfig(this.themeConfig);\n this.el.setAttribute('data-themed', '');\n }\n });\n }\n\n componentWillLoad() {\n // Theme already applied in connectedCallback\n }\n\n componentDidLoad() {\n this.value = sanitize(this.defaultValue || '');\n if (this.type !== 'text' && !this.pattern) {\n this.pattern = DefaultPattern[this.type];\n }\n\n if (this.value) {\n this.validatePattern(this.value);\n }\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n this.validatePattern(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n @Listen('formSubmitted', { target: 'document' })\n async handleFormSubmitted(event: CustomEvent) {\n if (this.el?.getAttribute('data-page-styling')) {\n this.validatePattern(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n }\n\n // Methods\n handleInput(e: Event) {\n this.error = '';\n const inputValue = (e.target as HTMLInputElement).value;\n\n // For 'number', ensure the value is valid\n if (this.type === 'number') {\n const numericValue = parseFloat(inputValue);\n if ((this.maxValue !== undefined && numericValue > this.maxValue) || (this.minValue !== undefined && numericValue < this.minValue)) {\n if (this.minValue === undefined) {\n this.error = `Value must be less than ${this.maxValue}`;\n } else if (this.maxValue === undefined) {\n this.error = `Value must be greater than ${this.minValue}`;\n } else {\n this.error = `Value must be between ${this.minValue} and ${this.maxValue}`;\n }\n } else if (isNaN(numericValue)) {\n this.error = this.patternError || 'Invalid format.';\n }\n }\n\n this.value = sanitize(inputValue);\n this.nylasFormInputChanged.emit({\n value: this.value,\n name: this.name,\n label: this.label,\n error: this.error,\n type: this.type,\n });\n }\n\n handleBlur() {\n this.nylasFormInputBlurred.emit({\n value: this.value,\n name: this.name,\n });\n }\n\n handleFocus() {\n this.nylasFormInputFocused.emit({\n value: this.value,\n name: this.name,\n });\n }\n\n validatePattern(value: string) {\n // Reset error\n this.error = '';\n\n if (this.required && !value) {\n this.error = this.requiredError || 'This field is required.';\n return;\n }\n\n if (this.type === 'number' && value) {\n const numericValue = parseFloat(value);\n if ((this.maxValue !== undefined && numericValue > this.maxValue) || (this.minValue !== undefined && numericValue < this.minValue)) {\n this.error = `Value must be between ${this.minValue} and ${this.maxValue}`;\n return;\n }\n }\n\n if (this.pattern && value && !this.pattern.test(value)) {\n this.error = this.patternError || 'Invalid format.';\n }\n }\n\n render() {\n return (\n <label part={this.error ? 'ic__label ic__label--error' : 'ic__label'} class={{ error: !!this.error }}>\n {this.label && (\n <p>\n <span class=\"label\">{this.label}</span>\n {this.required && <span class=\"required\">*</span>}\n </p>\n )}\n <div part=\"ic__input_wrapper\" class=\"input_wrapper\">\n <input\n type={this.type}\n name={this.name}\n part={this.error ? 'ic__input ic__input--error' : 'ic__input'}\n title={this.readOnly ? 'read-only field' : undefined}\n readOnly={this.readOnly}\n autoFocus={this.autoFocus}\n value={this.value}\n maxLength={this.maxLength}\n max={this.type === 'number' ? this.maxValue : undefined}\n min={this.type === 'number' ? this.minValue : undefined}\n placeholder={this.placeholder}\n class={{ error: !!this.error }}\n onInput={e => this.handleInput(e)}\n onFocus={() => this.handleFocus()}\n onBlur={() => this.handleBlur()}\n />\n <slot name=\"additional-input\"></slot>\n </div>\n {this.error && (\n <span class=\"error help-text\" part=\"ic__error_message\">\n {this.error}\n </span>\n )}\n </label>\n );\n }\n}\n"],"mappings":"6FAAA,MAAMA,EAAoB,22HCI1B,MAAMC,EAAiB,CACrBC,MAAO,uIACPC,aAAc,iBAGhB,MAAMC,EAAqB,CACzBF,MAAO,mBACPC,aAAc,c,MAaHE,EAAc,MAL3B,WAAAC,CAAAC,G,iMAaUC,KAAIC,KAAW,QAQfD,KAAKE,MAAW,GAKhBF,KAAIG,KAAiD,OAIrDH,KAAAI,YAAsBR,EAAmBI,KAAKG,MAK9CH,KAAQK,SAAY,MAKpBL,KAAQM,SAAY,MAMpBN,KAASO,UAAY,MAUrBP,KAASQ,UAAW,IAKpBR,KAAYS,aAAW,GAKvBT,KAAaU,cAAW,GAgBvBV,KAAKW,MAAW,EAyM1B,CA7KC,wBAAAC,CAAyBC,GACvBb,KAAKc,MAAQC,EAASF,GACtB,GAAIb,KAAKc,MAAO,CACdd,KAAKgB,gBAAgBhB,KAAKc,M,EAK9B,yBAAAG,CAA0BC,EAAqBC,GAC7C,GAAID,IAAWC,EAAQ,OACvBnB,KAAKoB,iBAAiBF,E,CAGxB,gBAAAE,CAAiBC,GACf,GAAIA,EAAa,CACf,IAAK,MAAOC,EAAKR,KAAUS,OAAOC,QAAQH,GAAc,CACtDrB,KAAKyB,GAAGC,MAAMC,YAAY,GAAGL,IAAOR,E,GAK1C,iBAAAc,GAGEC,gBAAe,KACb,GAAI7B,KAAKqB,YAAa,CACpBrB,KAAKoB,iBAAiBpB,KAAKqB,aAC3BrB,KAAKyB,GAAGK,aAAa,cAAe,G,KAK1C,iBAAAC,G,CAIA,gBAAAC,GACEhC,KAAKc,MAAQC,EAASf,KAAKiC,cAAgB,IAC3C,GAAIjC,KAAKG,OAAS,SAAWH,KAAKkC,QAAS,CACzClC,KAAKkC,QAAUzC,EAAeO,KAAKG,K,CAGrC,GAAIH,KAAKc,MAAO,CACdd,KAAKgB,gBAAgBhB,KAAKc,M,EAS9B,0BAAAqB,CAA2BC,GACzBpC,KAAKgB,gBAAgBhB,KAAKc,OAC1B,GAAId,KAAKW,MAAO,CACdyB,EAAMC,gB,EAKV,yBAAMC,CAAoBF,GACxB,GAAIpC,KAAKyB,IAAIc,aAAa,qBAAsB,CAC9CvC,KAAKgB,gBAAgBhB,KAAKc,OAC1B,GAAId,KAAKW,MAAO,CACdyB,EAAMC,gB,GAMZ,WAAAG,CAAYC,GACVzC,KAAKW,MAAQ,GACb,MAAM+B,EAAcD,EAAEE,OAA4B7B,MAGlD,GAAId,KAAKG,OAAS,SAAU,CAC1B,MAAMyC,EAAeC,WAAWH,GAChC,GAAK1C,KAAK8C,WAAaC,WAAaH,EAAe5C,KAAK8C,UAAc9C,KAAKgD,WAAaD,WAAaH,EAAe5C,KAAKgD,SAAW,CAClI,GAAIhD,KAAKgD,WAAaD,UAAW,CAC/B/C,KAAKW,MAAQ,2BAA2BX,KAAK8C,U,MACxC,GAAI9C,KAAK8C,WAAaC,UAAW,CACtC/C,KAAKW,MAAQ,8BAA8BX,KAAKgD,U,KAC3C,CACLhD,KAAKW,MAAQ,yBAAyBX,KAAKgD,gBAAgBhD,KAAK8C,U,OAE7D,GAAIG,MAAML,GAAe,CAC9B5C,KAAKW,MAAQX,KAAKS,cAAgB,iB,EAItCT,KAAKc,MAAQC,EAAS2B,GACtB1C,KAAKkD,sBAAsBC,KAAK,CAC9BrC,MAAOd,KAAKc,MACZb,KAAMD,KAAKC,KACXC,MAAOF,KAAKE,MACZS,MAAOX,KAAKW,MACZR,KAAMH,KAAKG,M,CAIf,UAAAiD,GACEpD,KAAKqD,sBAAsBF,KAAK,CAC9BrC,MAAOd,KAAKc,MACZb,KAAMD,KAAKC,M,CAIf,WAAAqD,GACEtD,KAAKuD,sBAAsBJ,KAAK,CAC9BrC,MAAOd,KAAKc,MACZb,KAAMD,KAAKC,M,CAIf,eAAAe,CAAgBF,GAEdd,KAAKW,MAAQ,GAEb,GAAIX,KAAKK,WAAaS,EAAO,CAC3Bd,KAAKW,MAAQX,KAAKU,eAAiB,0BACnC,M,CAGF,GAAIV,KAAKG,OAAS,UAAYW,EAAO,CACnC,MAAM8B,EAAeC,WAAW/B,GAChC,GAAKd,KAAK8C,WAAaC,WAAaH,EAAe5C,KAAK8C,UAAc9C,KAAKgD,WAAaD,WAAaH,EAAe5C,KAAKgD,SAAW,CAClIhD,KAAKW,MAAQ,yBAAyBX,KAAKgD,gBAAgBhD,KAAK8C,WAChE,M,EAIJ,GAAI9C,KAAKkC,SAAWpB,IAAUd,KAAKkC,QAAQsB,KAAK1C,GAAQ,CACtDd,KAAKW,MAAQX,KAAKS,cAAgB,iB,EAItC,MAAAgD,GACE,OACEC,EAAO,SAAApC,IAAA,2CAAAqC,KAAM3D,KAAKW,MAAQ,6BAA+B,YAAaiD,MAAO,CAAEjD,QAASX,KAAKW,QAC1FX,KAAKE,OACJwD,EAAA,KAAApC,IAAA,4CACEoC,EAAA,QAAApC,IAAA,2CAAMsC,MAAM,SAAS5D,KAAKE,OACzBF,KAAKK,UAAYqD,EAAA,QAAApC,IAAA,2CAAMsC,MAAM,YAAmB,MAGrDF,EAAA,OAAApC,IAAA,2CAAKqC,KAAK,oBAAoBC,MAAM,iBAClCF,EAAA,SAAApC,IAAA,2CACEnB,KAAMH,KAAKG,KACXF,KAAMD,KAAKC,KACX0D,KAAM3D,KAAKW,MAAQ,6BAA+B,YAClDkD,MAAO7D,KAAKM,SAAW,kBAAoByC,UAC3CzC,SAAUN,KAAKM,SACfC,UAAWP,KAAKO,UAChBO,MAAOd,KAAKc,MACZN,UAAWR,KAAKQ,UAChBsD,IAAK9D,KAAKG,OAAS,SAAWH,KAAK8C,SAAWC,UAC9CgB,IAAK/D,KAAKG,OAAS,SAAWH,KAAKgD,SAAWD,UAC9C3C,YAAaJ,KAAKI,YAClBwD,MAAO,CAAEjD,QAASX,KAAKW,OACvBqD,QAASvB,GAAKzC,KAAKwC,YAAYC,GAC/BwB,QAAS,IAAMjE,KAAKsD,cACpBY,OAAQ,IAAMlE,KAAKoD,eAErBM,EAAA,QAAApC,IAAA,2CAAMrB,KAAK,sBAEZD,KAAKW,OACJ+C,EAAA,QAAApC,IAAA,2CAAMsC,MAAM,kBAAkBD,KAAK,qBAChC3D,KAAKW,O","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p-
|
|
1
|
+
{"version":3,"file":"p-DM0y_1NQ.js","sources":["../nylas-js-core/dist/index.es.js","src/version.ts"],"sourcesContent":["var t = Object.defineProperty;\nvar c = (r, n, s) => n in r ? t(r, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[n] = s;\nvar a = (r, n, s) => (c(r, typeof n != \"symbol\" ? n + \"\" : n, s), s);\nvar u = /* @__PURE__ */ ((r) => (r.Error = \"error\", r.Warning = \"warning\", r.Info = \"info\", r.Success = \"success\", r))(u || {});\nconst e = (r) => r !== null && typeof r == \"object\" && \"data\" in r, o = (r) => r !== null && typeof r == \"object\" && \"error\" in r;\nclass E extends Error {\n constructor(s) {\n super(s == null ? void 0 : s.message);\n a(this, \"apiError\");\n this.name = \"NylasAPIError\", this.stack = new Error().stack, this.apiError = s;\n }\n}\nexport {\n u as NotificationType,\n E as NylasAPIError,\n o as isNylasErrorResponse,\n e as isNylasSuccessResponse\n};\n","export const version = '2.3.3-canary-20260206145315';\n"],"names":[],"mappings":"AAGG,IAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,OAAO,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,EAAE,CAAC,CAAC,IAAI,GAAG,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE;AACzH,MAA+D,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,QAAQ,IAAI,OAAO,IAAI;;ACJzH,MAAM,OAAO,GAAG;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as a,h as l,a as r}from"./p-0EQQA0nE.js";import{o as s}from"./p-D7AODx4L.js";const o=':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;word-break:break-word;overflow-wrap:break-word;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}textarea:read-only{background-color:var(--nylas-base-100);cursor:not-allowed}';const n=class{constructor(l){e(this,l);this.nylasFormInputChanged=a(this,"nylasFormInputChanged",7);this.name="textarea";this.label="";this.placeholder="";this.required=false;this.readOnly=false;this.autoFocus=false;this.maxLength=255;this.type="multi_line_text";this.tooltip="";this.errorMessage="";this.value="";this.error=""}connectedCallback(){queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.el.setAttribute("data-themed","")}}))}componentDidLoad(){this.value=s(this.defaultValue||"")}themeConfigChangedHandler(e,a){if(e===a)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[a,l]of Object.entries(e)){this.el.style.setProperty(`${a}`,l)}}}handleBookingFormSubmitted(e){this.validate(this.value);if(this.error){e.preventDefault()}}handletriggerValidation(e){this.validate(this.value);if(this.error){e.preventDefault()}}handleInput(e){this.error="";const a=e.target;this.value=s(a.value);this.nylasFormInputChanged.emit({value:this.value,name:this.name,error:this.error,label:this.label,type:this.type})}validate(e){if(this.required&&!e){this.error=this.errorMessage||`${this.label} is required.`}else if(e.length>this.maxLength){this.error=`${this.label} cannot exceed ${this.maxLength} characters.`}else{this.error=""}}render(){return l("label",{key:"58f9f02cc38215f110491371babf2b95d5866721",part:"tc__label",class:{error:!!this.error}},l("p",{key:"cc06bf464fd9b96a9bc3092682ce3bdf7e79bdcc"},l("span",{key:"9fb43cbc9ebc0d3fcfd0e7df8a8879850e9feb8f",class:"label"},this.label),this.required&&l("span",{key:"ab60d5aa035688add974dc56e632025964727f07",class:"required"},"*"),this.tooltip&&l("tooltip-component",{key:"5d6c07f774f1a5c54d65f6daa919534435bcd5d0"},l("info-icon",{key:"b8ab0802db6137e330e0e9ddba0bff36196f82fb",slot:"tooltip-icon"}),l("span",{key:"973c47a049105a8a44de86ae19b18a99306c0077",slot:"tooltip-content"},this.tooltip))),l("textarea",{key:"8b0c18830cfc09b6c59b0c10859297762c97bcdb",name:this.name,title:this.readOnly?"read-only field":undefined,placeholder:this.placeholder,readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,onInput:e=>this.handleInput(e),class:{error:!!this.error},part:"tc__textarea"}),this.error&&l("span",{key:"7c157600c92196ed333c82b12315d2528346204f",class:"error help-text"},this.error))}get el(){return r(this)}static get watchers(){return{themeConfig:["themeConfigChangedHandler"]}}};n.style=o;export{n as textarea_component};
|
|
2
|
+
//# sourceMappingURL=p-b0306d35.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["textareaComponentCss","TextareaComponent","constructor","hostRef","this","name","label","placeholder","required","readOnly","autoFocus","maxLength","type","tooltip","errorMessage","value","error","connectedCallback","queueMicrotask","themeConfig","applyThemeConfig","el","setAttribute","componentDidLoad","sanitize","defaultValue","themeConfigChangedHandler","newVal","oldVal","key","Object","entries","style","setProperty","handleBookingFormSubmitted","event","validate","preventDefault","handletriggerValidation","handleInput","e","inputElement","target","nylasFormInputChanged","emit","length","render","h","part","class","slot","title","undefined","onInput"],"sources":["src/components/design-system/textarea-component/textarea-component.scss?tag=textarea-component&encapsulation=shadow","src/components/design-system/textarea-component/textarea-component.tsx"],"sourcesContent":["@use '../../../common/styles/variables' as *;\n@use '../../../common/mixins/inputs' as *;\n\n:host {\n display: block;\n @include default-css-variables;\n width: 100%;\n}\n\nlabel {\n @include input-label;\n flex-direction: column;\n gap: 4px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n color: var(--nylas-base-800);\n\n p {\n margin: 0;\n display: flex;\n gap: 4px;\n align-items: center;\n }\n\n .error {\n color: var(--nylas-error);\n }\n}\n\ntextarea {\n @include textfield;\n padding: 12px 16px;\n border-width: 1;\n resize: vertical;\n border-radius: 8px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n\n &::-webkit-resizer {\n display: none;\n }\n}\n\ntextarea:read-only {\n background-color: var(--nylas-base-100);\n cursor: not-allowed;\n}\n","import { sanitize } from '@/utils/utils';\nimport { ThemeConfig } from '@nylas/core';\nimport { Component, h, Prop, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\n\n/**\n * `textarea-component` allows users to enter multiline text.\n * It is ideal for larger inputs like comments or messages in a form.\n * This component is used in the scheduling form to input multiline text.\n *\n * @part tc__label - The label for the textarea.\n * @part tc__textarea - The textarea element.\n */\n@Component({\n tag: 'textarea-component',\n styleUrl: 'textarea-component.scss',\n shadow: true,\n})\nexport class TextareaComponent {\n @Element() el!: HTMLElement;\n\n /**\n * The name of the textarea, important for form submissions.\n */\n @Prop() name: string = 'textarea';\n\n /**\n * The default value of the textarea, appearing when the component first renders.\n */\n @Prop() defaultValue?: string;\n\n /**\n * The label for the textarea, displayed above it.\n */\n @Prop() label: string = '';\n\n /**\n * Placeholder text shown in the textarea when it is empty.\n */\n @Prop() placeholder: string = '';\n\n /**\n * Specifies if the textarea is required for form submission.\n * If true, an error message shows if left empty.\n */\n @Prop() required: boolean = false;\n\n /**\n * If true, the textarea cannot be edited by the user.\n */\n @Prop() readOnly: boolean = false;\n\n /**\n * Automatically focus the textarea when the component loads.\n */\n @Prop() autoFocus: boolean = false;\n\n /**\n * The maximum number of characters allowed in the textarea.\n */\n @Prop() maxLength: number = 255;\n\n /**\n * The type\n */\n @Prop() type: string = 'multi_line_text';\n\n /**\n * The content of the label's tooltip\n */\n @Prop() tooltip: string = '';\n\n /**\n * Error message to display when the textarea is required and empty.\n */\n @Prop() errorMessage: string = '';\n\n /**\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: ThemeConfig;\n\n /**\n * State for the current value of the textarea.\n */\n @State() value: string = '';\n\n /**\n * State for managing the display of any error messages.\n */\n @State() error: string = '';\n\n /**\n * Event emitted when the value of the textarea changes.\n * Useful for parent components to capture user input.\n */\n @Event() nylasFormInputChanged!: EventEmitter<{ value: string; name: string; error: string; label: string; type: string }>;\n\n connectedCallback() {\n // Use queueMicrotask to defer theme application until after React has set props.\n // This fixes the timing issue where connectedCallback fires before React sets themeConfig.\n queueMicrotask(() => {\n if (this.themeConfig) {\n this.applyThemeConfig(this.themeConfig);\n this.el.setAttribute('data-themed', '');\n }\n });\n }\n\n /**\n * Lifecycle method that runs before the component loads.\n * It sets the initial value and cleans it using sanitize-html.\n */\n componentDidLoad() {\n this.value = sanitize(this.defaultValue || '');\n }\n\n @Watch('themeConfig')\n themeConfigChangedHandler(newVal: ThemeConfig, oldVal: ThemeConfig) {\n if (newVal === oldVal) return;\n this.applyThemeConfig(newVal);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.el.style.setProperty(`${key}`, value);\n }\n }\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n this.validate(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n @Listen('triggerValidation', { target: 'document' })\n handletriggerValidation(event: CustomEvent) {\n this.validate(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n /**\n * Handles user input in the textarea, updating the value and emitting an event.\n */\n handleInput(e: Event) {\n this.error = '';\n const inputElement = e.target as HTMLTextAreaElement;\n this.value = sanitize(inputElement.value);\n this.nylasFormInputChanged.emit({\n value: this.value,\n name: this.name,\n error: this.error,\n label: this.label,\n type: this.type,\n });\n }\n\n /**\n * Validates the textarea value based on the required prop and maxLength.\n * If the value is invalid, an error message is displayed.\n */\n validate(value: string) {\n if (this.required && !value) {\n this.error = this.errorMessage || `${this.label} is required.`;\n } else if (value.length > this.maxLength) {\n this.error = `${this.label} cannot exceed ${this.maxLength} characters.`;\n } else {\n this.error = '';\n }\n }\n\n /**\n * Renders the component UI including the label, textarea, and any error messages.\n */\n render() {\n return (\n <label part=\"tc__label\" class={{ error: !!this.error }}>\n <p>\n <span class=\"label\">{this.label}</span>\n {this.required && <span class=\"required\">*</span>}\n {this.tooltip && (\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">{this.tooltip}</span>\n </tooltip-component>\n )}\n </p>\n <textarea\n name={this.name}\n title={this.readOnly ? 'read-only field' : undefined}\n placeholder={this.placeholder}\n readOnly={this.readOnly}\n autoFocus={this.autoFocus}\n value={this.value}\n maxLength={this.maxLength}\n onInput={e => this.handleInput(e)}\n class={{ error: !!this.error }}\n part=\"tc__textarea\"\n />\n {this.error && <span class=\"error help-text\">{this.error}</span>}\n </label>\n );\n }\n}\n"],"mappings":"6FAAA,MAAMA,EAAuB,
|
|
1
|
+
{"version":3,"names":["textareaComponentCss","TextareaComponent","constructor","hostRef","this","name","label","placeholder","required","readOnly","autoFocus","maxLength","type","tooltip","errorMessage","value","error","connectedCallback","queueMicrotask","themeConfig","applyThemeConfig","el","setAttribute","componentDidLoad","sanitize","defaultValue","themeConfigChangedHandler","newVal","oldVal","key","Object","entries","style","setProperty","handleBookingFormSubmitted","event","validate","preventDefault","handletriggerValidation","handleInput","e","inputElement","target","nylasFormInputChanged","emit","length","render","h","part","class","slot","title","undefined","onInput"],"sources":["src/components/design-system/textarea-component/textarea-component.scss?tag=textarea-component&encapsulation=shadow","src/components/design-system/textarea-component/textarea-component.tsx"],"sourcesContent":["@use '../../../common/styles/variables' as *;\n@use '../../../common/mixins/inputs' as *;\n\n:host {\n display: block;\n @include default-css-variables;\n width: 100%;\n}\n\nlabel {\n @include input-label;\n flex-direction: column;\n gap: 4px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n color: var(--nylas-base-800);\n\n p {\n margin: 0;\n display: flex;\n gap: 4px;\n align-items: center;\n }\n\n .error {\n color: var(--nylas-error);\n }\n}\n\ntextarea {\n @include textfield;\n padding: 12px 16px;\n border-width: 1;\n resize: vertical;\n border-radius: 8px;\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n\n &::-webkit-resizer {\n display: none;\n }\n}\n\ntextarea:read-only {\n background-color: var(--nylas-base-100);\n cursor: not-allowed;\n}\n","import { sanitize } from '@/utils/utils';\nimport { ThemeConfig } from '@nylas/core';\nimport { Component, h, Prop, State, Event, EventEmitter, Listen, Watch, Element } from '@stencil/core';\n\n/**\n * `textarea-component` allows users to enter multiline text.\n * It is ideal for larger inputs like comments or messages in a form.\n * This component is used in the scheduling form to input multiline text.\n *\n * @part tc__label - The label for the textarea.\n * @part tc__textarea - The textarea element.\n */\n@Component({\n tag: 'textarea-component',\n styleUrl: 'textarea-component.scss',\n shadow: true,\n})\nexport class TextareaComponent {\n @Element() el!: HTMLElement;\n\n /**\n * The name of the textarea, important for form submissions.\n */\n @Prop() name: string = 'textarea';\n\n /**\n * The default value of the textarea, appearing when the component first renders.\n */\n @Prop() defaultValue?: string;\n\n /**\n * The label for the textarea, displayed above it.\n */\n @Prop() label: string = '';\n\n /**\n * Placeholder text shown in the textarea when it is empty.\n */\n @Prop() placeholder: string = '';\n\n /**\n * Specifies if the textarea is required for form submission.\n * If true, an error message shows if left empty.\n */\n @Prop() required: boolean = false;\n\n /**\n * If true, the textarea cannot be edited by the user.\n */\n @Prop() readOnly: boolean = false;\n\n /**\n * Automatically focus the textarea when the component loads.\n */\n @Prop() autoFocus: boolean = false;\n\n /**\n * The maximum number of characters allowed in the textarea.\n */\n @Prop() maxLength: number = 255;\n\n /**\n * The type\n */\n @Prop() type: string = 'multi_line_text';\n\n /**\n * The content of the label's tooltip\n */\n @Prop() tooltip: string = '';\n\n /**\n * Error message to display when the textarea is required and empty.\n */\n @Prop() errorMessage: string = '';\n\n /**\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: ThemeConfig;\n\n /**\n * State for the current value of the textarea.\n */\n @State() value: string = '';\n\n /**\n * State for managing the display of any error messages.\n */\n @State() error: string = '';\n\n /**\n * Event emitted when the value of the textarea changes.\n * Useful for parent components to capture user input.\n */\n @Event() nylasFormInputChanged!: EventEmitter<{ value: string; name: string; error: string; label: string; type: string }>;\n\n connectedCallback() {\n // Use queueMicrotask to defer theme application until after React has set props.\n // This fixes the timing issue where connectedCallback fires before React sets themeConfig.\n queueMicrotask(() => {\n if (this.themeConfig) {\n this.applyThemeConfig(this.themeConfig);\n this.el.setAttribute('data-themed', '');\n }\n });\n }\n\n /**\n * Lifecycle method that runs before the component loads.\n * It sets the initial value and cleans it using sanitize-html.\n */\n componentDidLoad() {\n this.value = sanitize(this.defaultValue || '');\n }\n\n @Watch('themeConfig')\n themeConfigChangedHandler(newVal: ThemeConfig, oldVal: ThemeConfig) {\n if (newVal === oldVal) return;\n this.applyThemeConfig(newVal);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.el.style.setProperty(`${key}`, value);\n }\n }\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n this.validate(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n @Listen('triggerValidation', { target: 'document' })\n handletriggerValidation(event: CustomEvent) {\n this.validate(this.value);\n if (this.error) {\n event.preventDefault();\n }\n }\n\n /**\n * Handles user input in the textarea, updating the value and emitting an event.\n */\n handleInput(e: Event) {\n this.error = '';\n const inputElement = e.target as HTMLTextAreaElement;\n this.value = sanitize(inputElement.value);\n this.nylasFormInputChanged.emit({\n value: this.value,\n name: this.name,\n error: this.error,\n label: this.label,\n type: this.type,\n });\n }\n\n /**\n * Validates the textarea value based on the required prop and maxLength.\n * If the value is invalid, an error message is displayed.\n */\n validate(value: string) {\n if (this.required && !value) {\n this.error = this.errorMessage || `${this.label} is required.`;\n } else if (value.length > this.maxLength) {\n this.error = `${this.label} cannot exceed ${this.maxLength} characters.`;\n } else {\n this.error = '';\n }\n }\n\n /**\n * Renders the component UI including the label, textarea, and any error messages.\n */\n render() {\n return (\n <label part=\"tc__label\" class={{ error: !!this.error }}>\n <p>\n <span class=\"label\">{this.label}</span>\n {this.required && <span class=\"required\">*</span>}\n {this.tooltip && (\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">{this.tooltip}</span>\n </tooltip-component>\n )}\n </p>\n <textarea\n name={this.name}\n title={this.readOnly ? 'read-only field' : undefined}\n placeholder={this.placeholder}\n readOnly={this.readOnly}\n autoFocus={this.autoFocus}\n value={this.value}\n maxLength={this.maxLength}\n onInput={e => this.handleInput(e)}\n class={{ error: !!this.error }}\n part=\"tc__textarea\"\n />\n {this.error && <span class=\"error help-text\">{this.error}</span>}\n </label>\n );\n }\n}\n"],"mappings":"6FAAA,MAAMA,EAAuB,6+G,MCiBhBC,EAAiB,MAL9B,WAAAC,CAAAC,G,uEAWUC,KAAIC,KAAW,WAUfD,KAAKE,MAAW,GAKhBF,KAAWG,YAAW,GAMtBH,KAAQI,SAAY,MAKpBJ,KAAQK,SAAY,MAKpBL,KAASM,UAAY,MAKrBN,KAASO,UAAW,IAKpBP,KAAIQ,KAAW,kBAKfR,KAAOS,QAAW,GAKlBT,KAAYU,aAAW,GAUtBV,KAAKW,MAAW,GAKhBX,KAAKY,MAAW,EA2H1B,CAnHC,iBAAAC,GAGEC,gBAAe,KACb,GAAId,KAAKe,YAAa,CACpBf,KAAKgB,iBAAiBhB,KAAKe,aAC3Bf,KAAKiB,GAAGC,aAAa,cAAe,G,KAS1C,gBAAAC,GACEnB,KAAKW,MAAQS,EAASpB,KAAKqB,cAAgB,G,CAI7C,yBAAAC,CAA0BC,EAAqBC,GAC7C,GAAID,IAAWC,EAAQ,OACvBxB,KAAKgB,iBAAiBO,E,CAGxB,gBAAAP,CAAiBD,GACf,GAAIA,EAAa,CACf,IAAK,MAAOU,EAAKd,KAAUe,OAAOC,QAAQZ,GAAc,CACtDf,KAAKiB,GAAGW,MAAMC,YAAY,GAAGJ,IAAOd,E,GAU1C,0BAAAmB,CAA2BC,GACzB/B,KAAKgC,SAAShC,KAAKW,OACnB,GAAIX,KAAKY,MAAO,CACdmB,EAAME,gB,EAKV,uBAAAC,CAAwBH,GACtB/B,KAAKgC,SAAShC,KAAKW,OACnB,GAAIX,KAAKY,MAAO,CACdmB,EAAME,gB,EAOV,WAAAE,CAAYC,GACVpC,KAAKY,MAAQ,GACb,MAAMyB,EAAeD,EAAEE,OACvBtC,KAAKW,MAAQS,EAASiB,EAAa1B,OACnCX,KAAKuC,sBAAsBC,KAAK,CAC9B7B,MAAOX,KAAKW,MACZV,KAAMD,KAAKC,KACXW,MAAOZ,KAAKY,MACZV,MAAOF,KAAKE,MACZM,KAAMR,KAAKQ,M,CAQf,QAAAwB,CAASrB,GACP,GAAIX,KAAKI,WAAaO,EAAO,CAC3BX,KAAKY,MAAQZ,KAAKU,cAAgB,GAAGV,KAAKE,oB,MACrC,GAAIS,EAAM8B,OAASzC,KAAKO,UAAW,CACxCP,KAAKY,MAAQ,GAAGZ,KAAKE,uBAAuBF,KAAKO,uB,KAC5C,CACLP,KAAKY,MAAQ,E,EAOjB,MAAA8B,GACE,OACEC,EAAO,SAAAlB,IAAA,2CAAAmB,KAAK,YAAYC,MAAO,CAAEjC,QAASZ,KAAKY,QAC7C+B,EAAA,KAAAlB,IAAA,4CACEkB,EAAA,QAAAlB,IAAA,2CAAMoB,MAAM,SAAS7C,KAAKE,OACzBF,KAAKI,UAAYuC,EAAA,QAAAlB,IAAA,2CAAMoB,MAAM,YAAmB,KAChD7C,KAAKS,SACJkC,EAAA,qBAAAlB,IAAA,4CACEkB,EAAW,aAAAlB,IAAA,2CAAAqB,KAAK,iBAChBH,EAAM,QAAAlB,IAAA,2CAAAqB,KAAK,mBAAmB9C,KAAKS,WAIzCkC,EAAA,YAAAlB,IAAA,2CACExB,KAAMD,KAAKC,KACX8C,MAAO/C,KAAKK,SAAW,kBAAoB2C,UAC3C7C,YAAaH,KAAKG,YAClBE,SAAUL,KAAKK,SACfC,UAAWN,KAAKM,UAChBK,MAAOX,KAAKW,MACZJ,UAAWP,KAAKO,UAChB0C,QAASb,GAAKpC,KAAKmC,YAAYC,GAC/BS,MAAO,CAAEjC,QAASZ,KAAKY,OACvBgC,KAAK,iBAEN5C,KAAKY,OAAS+B,EAAA,QAAAlB,IAAA,2CAAMoB,MAAM,mBAAmB7C,KAAKY,O","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,c as a,h as l,a as
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,c as a,h as l,a as o}from"./p-0EQQA0nE.js";const s=':host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff;width:100%}.checkbox-container{display:flex;flex-direction:column;gap:0.5rem}.checkbox-container p.error{color:var(--nylas-error);font-size:16px;font-weight:400;line-height:20px;font-family:var(--nylas-font-family);margin:0}label{display:flex;align-items:center;font-family:var(--nylas-font-family);cursor:pointer;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;color:var(--nylas-base-800)}label.readonly{cursor:not-allowed}label span.required{color:var(--nylas-error);padding:0 0.25rem}label input[type=checkbox]{position:absolute;opacity:0;cursor:pointer;border:1px solid var(--nylas-base-300)}label input[type=checkbox]:focus~.checkmark,label input[type=checkbox]:hover~.checkmark{border-color:var(--nylas-primary)}label input[type=checkbox]:checked~.checkmark{color:var(--nylas-base-0);background:var(--nylas-primary) url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTIgOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPHBhdGggZD0iTTQuNTc1IDguOTc3cy0uNDA0LS4wMDctLjUzNi0uMTY1TC4wNTcgNS42NGwuODI5LTEuMjI3TDQuNDcgNy4yNjggMTAuOTIxLjA4NmwuOTIzIDEuMTAzLTYuODYzIDcuNjRjLS4xMzQtLjAwMy0uNDA2LjE0OC0uNDA2LjE0OHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+) 50% 40% no-repeat;border:1px solid var(--nylas-primary)}label input[type=checkbox]:disabled{cursor:not-allowed;background:var(--nylas-base-100);border:1px solid var(--nylas-base-300)}label .checkmark{border-radius:var(--nylas-border-radius);border:1px solid var(--nylas-base-300);position:absolute;left:0;top:2px;width:18px;height:18px;cursor:pointer;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}label .label{margin-left:32px;font-size:16px;font-weight:400;color:var(--nylas-base-800);line-height:24px;word-break:break-word;overflow-wrap:break-word}';const r=class{constructor(l){e(this,l);this.nylasFormCheckboxToggled=a(this,"nylasFormCheckboxToggled",7);this.componentType="checkbox";this.name="checkbox";this.label="";this.readOnly=false;this.required=false;this.errorMessage="";this.error=""}checkedPropChangedHandler(e){if(typeof e==="boolean"){this.isChecked=e}}themeConfigChangedHandler(e,a){if(e===a)return;this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[a,l]of Object.entries(e)){this.el.style.setProperty(`${a}`,l)}}}connectedCallback(){queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.el.setAttribute("data-themed","")}}))}componentWillLoad(){this.el.setAttribute("component-type",this.componentType)}componentDidLoad(){this.isChecked=this.checked||false}handleBookingFormSubmitted(e){if(this.required&&!this.isChecked){this.error=this.errorMessage||`${this.label} is required.`}if(this.error){e.preventDefault()}}toggleCheck(){this.error="";this.isChecked=!this.isChecked;this.nylasFormCheckboxToggled.emit({checked:this.isChecked,name:this.name,label:this.label})}render(){return l("div",{key:"f091beec880a479c7c8efaaea7cceeaa85310287",class:"checkbox-container"},l("label",{key:"0e3d17473288b0ca2eb0c6c427135669b60dd84d",title:this.readOnly?"read-only field":undefined,class:{readonly:this.readOnly}},l("input",{key:"84ce7dda3f8fb2f4ee7e0011b78bafa75bf0ddce",type:"checkbox",disabled:this.readOnly,readOnly:this.readOnly,name:this.name,title:this.readOnly?"read-only field":undefined,checked:this.isChecked,onChange:()=>this.toggleCheck()}),l("span",{key:"aa5c5b301f2a590beb7589c2db650cac43aac474",class:"checkmark"}),l("slot",{key:"3af1bc6a19e16fd6ac990b406043af65484f5b25",name:"label"},l("span",{key:"7d7901c7af3fd128fc4b174d687795dce63a539d",class:"label",part:"checkbox-label-span"},this.label,this.required&&l("span",{key:"7fad12e303b0293f7ddeb8847fe4541d75085e9c",class:"required"},"*")))),this.error&&l("p",{key:"88b43e02a2465e5d81ececa7114930e99dbc7653",class:"error"},this.error))}get el(){return o(this)}static get watchers(){return{checked:["checkedPropChangedHandler"],themeConfig:["themeConfigChangedHandler"]}}};r.style=s;export{r as checkbox_component};
|
|
2
|
+
//# sourceMappingURL=p-b2c497eb.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["checkboxComponentCss","CheckboxComponent","constructor","hostRef","this","componentType","name","label","readOnly","required","errorMessage","error","checkedPropChangedHandler","newValue","isChecked","themeConfigChangedHandler","newVal","oldVal","applyThemeConfig","themeConfig","key","value","Object","entries","el","style","setProperty","connectedCallback","queueMicrotask","setAttribute","componentWillLoad","componentDidLoad","checked","handleBookingFormSubmitted","event","preventDefault","toggleCheck","nylasFormCheckboxToggled","emit","render","h","class","title","undefined","readonly","type","disabled","onChange","part"],"sources":["src/components/design-system/checkbox-component/checkbox-component.scss?tag=checkbox-component&encapsulation=shadow","src/components/design-system/checkbox-component/checkbox-component.tsx"],"sourcesContent":["@use '../../../common/styles/variables' as *;\n\n:host {\n display: block;\n @include default-css-variables;\n width: 100%;\n}\n\n.checkbox-container {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n p.error {\n color: var(--nylas-error);\n font-size: 16px;\n font-weight: 400;\n line-height: 20px;\n font-family: var(--nylas-font-family);\n margin: 0;\n }\n}\n\nlabel {\n display: flex;\n align-items: center;\n font-family: var(--nylas-font-family);\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: var(--nylas-base-800);\n\n &.readonly {\n cursor: not-allowed;\n }\n\n span.required {\n color: var(--nylas-error);\n padding: 0 0.25rem;\n }\n\n input[type='checkbox'] {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n border: 1px solid var(--nylas-base-300);\n\n &:focus ~ .checkmark,\n &:hover ~ .checkmark {\n border-color: var(--nylas-primary);\n }\n\n &:checked ~ .checkmark {\n color: var(--nylas-base-0);\n background: var(--nylas-primary)\n url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnIHdpZHRoPSIxMiIgaGVpZ2h0PSI5IiB2aWV3Qm94PSIwIDAgMTIgOSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPHBhdGggZD0iTTQuNTc1IDguOTc3cy0uNDA0LS4wMDctLjUzNi0uMTY1TC4wNTcgNS42NGwuODI5LTEuMjI3TDQuNDcgNy4yNjggMTAuOTIxLjA4NmwuOTIzIDEuMTAzLTYuODYzIDcuNjRjLS4xMzQtLjAwMy0uNDA2LjE0OC0uNDA2LjE0OHoiIGZpbGw9IiNGRkYiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPg0KPC9zdmc+)\n 50% 40% no-repeat;\n border: 1px solid var(--nylas-primary);\n }\n\n &:disabled {\n cursor: not-allowed;\n background: var(--nylas-base-100);\n border: 1px solid var(--nylas-base-300);\n }\n }\n\n .checkmark {\n border-radius: var(--nylas-border-radius);\n border: 1px solid var(--nylas-base-300);\n position: absolute;\n left: 0;\n top: 2px;\n width: 18px;\n height: 18px;\n cursor: pointer;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n\n .label {\n margin-left: 32px;\n font-size: 16px;\n font-weight: 400;\n color: var(--nylas-base-800);\n line-height: 24px;\n word-break: break-word;\n overflow-wrap: break-word;\n }\n}\n","import { ThemeConfig } from '@nylas/core';\nimport { Component, h, Prop, State, Event, EventEmitter, Listen, Element, Watch } from '@stencil/core';\n\n/**\n * The `checkbox-component` component is a UI component that allows users to select a checkbox.\n * This component is used in the scheduling form to input checkbox type inputs.\n */\n@Component({\n tag: 'checkbox-component',\n styleUrl: 'checkbox-component.scss',\n shadow: true,\n})\nexport class CheckboxComponent {\n @Element() el!: HTMLElement;\n private readonly componentType: string = 'checkbox';\n\n /**\n * The name of the checkbox. This is used to identify the checkbox when submitting a form.\n */\n @Prop() name: string = 'checkbox';\n /**\n * The default value of the checkbox. This is the value that is displayed when the checkbox is rendered.\n */\n @Prop() checked?: boolean;\n /**\n * The label of the checkbox. This is displayed next to the checkbox.\n */\n @Prop() label: string = '';\n /**\n * The property to make the checkbox read-only. If true, the checkbox cannot be edited.\n */\n @Prop() readOnly: boolean = false;\n /**\n * Whether the checkbox is required. If true, the checkbox must be checked when submitting a form.\n * Default is false. If the checkbox is required and not checked, an error message is displayed.\n */\n @Prop() required: boolean = false;\n /**\n * The theme configuration.\n */\n @Prop({ attribute: 'theme-config' }) readonly themeConfig?: ThemeConfig;\n /**\n * Error message to display when the checkbox is required and not checked.\n */\n @Prop() errorMessage: string = '';\n /**\n * The checked state of the checkbox.\n */\n @State() isChecked!: boolean;\n /**\n * The error message state.\n */\n @State() error: string = '';\n\n /**\n * This event is fired when the checkbox is toggled.\n */\n @Event() nylasFormCheckboxToggled!: EventEmitter<{\n checked: boolean;\n name: string;\n label: string;\n }>;\n\n @Watch('checked')\n checkedPropChangedHandler(newValue: boolean) {\n if (typeof newValue === 'boolean') {\n this.isChecked = newValue;\n }\n }\n\n @Watch('themeConfig')\n themeConfigChangedHandler(newVal: ThemeConfig, oldVal: ThemeConfig) {\n if (newVal === oldVal) return;\n this.applyThemeConfig(newVal);\n }\n\n applyThemeConfig(themeConfig?: ThemeConfig) {\n if (themeConfig) {\n for (const [key, value] of Object.entries(themeConfig)) {\n this.el.style.setProperty(`${key}`, value);\n }\n }\n }\n\n // Lifecycle events\n connectedCallback() {\n // Use queueMicrotask to defer theme application until after React has set props.\n // This fixes the timing issue where connectedCallback fires before React sets themeConfig.\n queueMicrotask(() => {\n if (this.themeConfig) {\n this.applyThemeConfig(this.themeConfig);\n this.el.setAttribute('data-themed', '');\n }\n });\n }\n\n componentWillLoad() {\n this.el.setAttribute('component-type', this.componentType);\n }\n\n componentDidLoad() {\n this.isChecked = this.checked || false;\n }\n\n // Event listeners\n /**\n * Listen for the bookingFormSubmitted event to validate the input value when the form is submitted.\n */\n @Listen('bookingFormSubmitted', { target: 'document' })\n handleBookingFormSubmitted(event: CustomEvent) {\n if (this.required && !this.isChecked) {\n this.error = this.errorMessage || `${this.label} is required.`;\n }\n if (this.error) {\n event.preventDefault();\n }\n }\n\n // Methods\n toggleCheck() {\n this.error = '';\n this.isChecked = !this.isChecked;\n this.nylasFormCheckboxToggled.emit({\n checked: this.isChecked,\n name: this.name,\n label: this.label,\n });\n }\n\n render() {\n return (\n <div class=\"checkbox-container\">\n <label title={this.readOnly ? 'read-only field' : undefined} class={{ readonly: this.readOnly }}>\n <input\n type=\"checkbox\"\n disabled={this.readOnly}\n readOnly={this.readOnly}\n name={this.name}\n title={this.readOnly ? 'read-only field' : undefined}\n checked={this.isChecked}\n onChange={() => this.toggleCheck()}\n />\n <span class=\"checkmark\"></span>\n <slot name=\"label\">\n <span class=\"label\" part=\"checkbox-label-span\">\n {this.label}\n {this.required && <span class=\"required\">*</span>}\n </span>\n </slot>\n </label>\n {this.error && <p class=\"error\">{this.error}</p>}\n </div>\n );\n }\n}\n"],"mappings":"yDAAA,MAAMA,EAAuB,2kI,MCYhBC,EAAiB,MAL9B,WAAAC,CAAAC,G,6EAOmBC,KAAaC,cAAW,WAKjCD,KAAIE,KAAW,WAQfF,KAAKG,MAAW,GAIhBH,KAAQI,SAAY,MAKpBJ,KAAQK,SAAY,MAQpBL,KAAYM,aAAW,GAQtBN,KAAKO,MAAW,EAsG1B,CA1FC,yBAAAC,CAA0BC,GACxB,UAAWA,IAAa,UAAW,CACjCT,KAAKU,UAAYD,C,EAKrB,yBAAAE,CAA0BC,EAAqBC,GAC7C,GAAID,IAAWC,EAAQ,OACvBb,KAAKc,iBAAiBF,E,CAGxB,gBAAAE,CAAiBC,GACf,GAAIA,EAAa,CACf,IAAK,MAAOC,EAAKC,KAAUC,OAAOC,QAAQJ,GAAc,CACtDf,KAAKoB,GAAGC,MAAMC,YAAY,GAAGN,IAAOC,E,GAM1C,iBAAAM,GAGEC,gBAAe,KACb,GAAIxB,KAAKe,YAAa,CACpBf,KAAKc,iBAAiBd,KAAKe,aAC3Bf,KAAKoB,GAAGK,aAAa,cAAe,G,KAK1C,iBAAAC,GACE1B,KAAKoB,GAAGK,aAAa,iBAAkBzB,KAAKC,c,CAG9C,gBAAA0B,GACE3B,KAAKU,UAAYV,KAAK4B,SAAW,K,CAQnC,0BAAAC,CAA2BC,GACzB,GAAI9B,KAAKK,WAAaL,KAAKU,UAAW,CACpCV,KAAKO,MAAQP,KAAKM,cAAgB,GAAGN,KAAKG,oB,CAE5C,GAAIH,KAAKO,MAAO,CACduB,EAAMC,gB,EAKV,WAAAC,GACEhC,KAAKO,MAAQ,GACbP,KAAKU,WAAaV,KAAKU,UACvBV,KAAKiC,yBAAyBC,KAAK,CACjCN,QAAS5B,KAAKU,UACdR,KAAMF,KAAKE,KACXC,MAAOH,KAAKG,O,CAIhB,MAAAgC,GACE,OACEC,EAAA,OAAApB,IAAA,2CAAKqB,MAAM,sBACTD,EAAO,SAAApB,IAAA,2CAAAsB,MAAOtC,KAAKI,SAAW,kBAAoBmC,UAAWF,MAAO,CAAEG,SAAUxC,KAAKI,WACnFgC,EACE,SAAApB,IAAA,2CAAAyB,KAAK,WACLC,SAAU1C,KAAKI,SACfA,SAAUJ,KAAKI,SACfF,KAAMF,KAAKE,KACXoC,MAAOtC,KAAKI,SAAW,kBAAoBmC,UAC3CX,QAAS5B,KAAKU,UACdiC,SAAU,IAAM3C,KAAKgC,gBAEvBI,EAAM,QAAApB,IAAA,2CAAAqB,MAAM,cACZD,EAAM,QAAApB,IAAA,2CAAAd,KAAK,SACTkC,EAAA,QAAApB,IAAA,2CAAMqB,MAAM,QAAQO,KAAK,uBACtB5C,KAAKG,MACLH,KAAKK,UAAY+B,EAAM,QAAApB,IAAA,2CAAAqB,MAAM,YAAU,QAI7CrC,KAAKO,OAAS6B,EAAA,KAAApB,IAAA,2CAAGqB,MAAM,SAASrC,KAAKO,O","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as e,F as t,r as n,c as i,H as s,a as r}from"./p-0EQQA0nE.js";import{N as o}from"./p-BS9pAWHt.js";import{N as a}from"./p-Cb2blKKQ.js";import{d as c,u as l,t as u,a as d,b as h,g as f,e as p,i as g}from"./p-D7AODx4L.js";import{o as y,v as w}from"./p-BxqBxG4o.js";import{c as b}from"./p-_i6H-yQH.js";import{C as m,L as v,a as _}from"./p-COJy29df.js";c.extend(l);c.extend(u);class E{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.groupEventsCache=new Map;this.CACHE_DURATION=1*60*1e3;this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}async currentUser(){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return null}return this.nylasApiRequest.currentUser()}async getCalendars(){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching calendars: Nylas API Request is not initialized"})}const e=[];let t=null;const n=50;do{const[i,s]=await this.nylasApiRequest.request({method:"GET",path:`calendars?limit=${n}${t?`&page_token=${t}`:""}`});if(s){return h(null,{message:"Error fetching calendars: "+s.message})}if(y(i)){return h(null,{message:"Error fetching calendars: "+i.error?.message})}e.push(...i.data);t=i.next_cursor||null}while(t);this.nylasSchedulerConfigStore.state.calendars=e;return h(e)}async getConfigurationById(e,t=false){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching configuration: Nylas API Request is not initialized"})}if(!t){const t=this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e));if(t){this.nylasSchedulerConfigStore.state.selectedConfiguration=t;return h(t)}}const[n,i]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}`});if(i){return h(null,{message:"Error fetching configuration: "+i.message})}if(y(n)){return h(null,{message:"Error fetching configuration: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((t=>t.id===e?n.data:t))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data]}return h(n.data)}async getConfigurations(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching configurations: Nylas API Request is not initialized"})}const t=50;const[n,i]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations?limit=${t}${e?`&page_token=${e}`:""}`});if(i){return h(null,{message:"Error fetching configurations: "+i.message})}if(y(n)){return h(null,{message:"Error fetching configurations: "+n.error?.message})}this.nylasSchedulerConfigStore.state.configurations=n.data;this.nylasSchedulerConfigStore.state.listConfigurationsNextCursor=n.next_cursor||null;return h(n.data)}async getMasterEventById(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching master event: Nylas API Request is not initialized"})}const t=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const n=t?.event?.calendar_id;if(!n){d("Calendar ID is not present");return h(null,{message:"Error fetching master event: Calendar ID is not present"})}const i=new URLSearchParams;i.append("calendar_id",n);const[s,r]=await this.nylasApiRequest.request({method:"GET",path:`events/${e}?${i.toString()}`});if(r){return h(null,{message:"Error fetching master event: "+r.message})}if(y(s)){return h(null,{message:"Error fetching master event: "+s.error?.message})}const o=this.nylasSchedulerConfigStore.state.masterGroupEvents;if(o[e]){this.nylasSchedulerConfigStore.state.masterGroupEvents[e]=s.data}else{this.nylasSchedulerConfigStore.state.masterGroupEvents={...o,[e]:s.data}}return h(s.data)}async createConfiguration(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:e});if(n){return h(null,{message:"Error creating configuration: "+n.message})}if(y(t)){return h(null,{message:"Error creating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data];return h(t.data)}async updateConfiguration(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error updating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${e.id}`,body:e});if(n){return h(null,{message:"Error updating configuration: "+n.message})}if(y(t)){return h(null,{message:"Error updating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((n=>n.id===e.id?t.data:n))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data]}return h(t.data)}async deleteConfiguration(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error deleting configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${e}`});if(n){return h(null,{message:"Error deleting configuration: "+n.message})}if(y(t)){return h(null,{message:"Error deleting configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((t=>t.id!==e));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===e){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return h(t.data)}async createGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error creating group event: Nylas API Request is not initialized"})}const[n,i]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/group-events`,body:e});if(i){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error creating group event: "+i.message})}if(y(n)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error creating group event: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=n.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return h(n.data)}async getGroupEvents(e,t){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching group events: Nylas API Request is not initialized"})}const n=new URLSearchParams;n.append("show_all","true");const i=this.nylasSchedulerConfigStore.state.calendarViewDateRange;let s;let r;if(i){s=i.start_time;r=i.end_time}else{const e=f((new Date).toISOString(),"week");s=e.startTime.toString();r=e.endTime.toString()}const o=`${e}-${s}-${r}`;const a=this.groupEventsCache.get(o);if(a&&Date.now()-a.timestamp<this.CACHE_DURATION){this.nylasSchedulerConfigStore.state.groupEvents=a.data;return h(a.data)}n.append("start_time",s);n.append("end_time",r);const c=t?.group_booking?.calendar_id;if(c){n.append("calendar_id",c)}const[l,u]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}/group-events?${n.toString()}`});if(u){return h(null,{message:"Error fetching group events: "+u.message})}if(y(l)){return h(null,{message:"Error fetching group events: "+l.error?.message})}this.groupEventsCache.set(o,{data:l.data,timestamp:Date.now()});this.cleanupExpiredCache();this.nylasSchedulerConfigStore.state.groupEvents=l.data;return h(l.data)}cleanupExpiredCache(){const e=Date.now();for(const[t,n]of this.groupEventsCache.entries()){if(e-n.timestamp>this.CACHE_DURATION){this.groupEventsCache.delete(t)}}}async updateGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error updating group event: Nylas API Request is not initialized"})}const n=e.id;delete e.id;const[i,s]=await this.nylasApiRequest.request({method:"PATCH",path:`scheduling/configurations/${t}/group-events/${n}`,body:e});if(s){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error updating group event: "+s.message})}if(y(i)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error updating group event: "+i.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=i.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return h(i.data)}async updateGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const i=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const s=i?.event?.master_event_id;const r=i?.event?.id;const o=i?.event?.when?.start_time;const a=i?.group_event_info?.rrule?.[0];const l=a?a.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=o?c(o*1e3).subtract(1,"minute").format("YYYYMMDDTHHmmss[Z]"):"";if(t==="this"){return this.updateGroupEventById({...e,id:r,recurrence:s?undefined:e.recurrence},n)}else if(t==="future"&&s){const t=await this.createGroupEvent(e,n);const r={location:i?.event?.location,conferencing:i?.event?.conferencing,title:i?.event?.title,description:i?.event?.description,capacity:i?.group_event_info?.capacity,calendar_id:i?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:FREQ=DAILY;UNTIL=${u}`]};await this.updateGroupEventById({...r,id:s},n);return[r,t]}else if(t==="all"){const t=e?.when;const r=i?.event?.when;const o=this.nylasSchedulerConfigStore.state.masterGroupEvents?.[s];let a=o?.when;if(t?.start_time!==r?.start_time){a={...a,start_time:t?.start_time||a?.start_time}}if(t?.end_time!==r?.end_time){a={...a,end_time:t?.end_time||a?.end_time}}if(t?.start_timezone!==r?.start_timezone){a={...a,start_timezone:t?.start_timezone||a?.start_timezone}}if(t?.end_timezone!==r?.end_timezone){a={...a,end_timezone:t?.end_timezone||a?.end_timezone}}return this.updateGroupEventById({...e,when:a,id:s},n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const i=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const s=i?.event?.master_event_id;const r=i?.event?.id;const o=i?.event?.when?.start_time;const a=i?.group_event_info?.rrule?.[0];const l=a?a.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=o?c(o*1e3).format("YYYYMMDDTHHmmss[Z]"):"";const d={location:i?.event?.location,conferencing:i?.event?.conferencing,title:i?.event?.title,description:i?.event?.description,capacity:i?.group_event_info?.capacity,calendar_id:i?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:UNTIL=${u}`]};if(t==="this"&&r){return this.deleteGroupEventById(r,n)}else if(t==="future"&&s&&r){await this.deleteGroupEventById(r,n);return await this.updateGroupEventById({...d,id:s},n)}else if(t==="all"&&s){return this.deleteGroupEventById(s,n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error deleting group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const i=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(i){n.append("calendar_id",i)}const[s,r]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}/group-events/${e}?calendar_id=${i}`});if(r){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error deleting group event: "+r.message})}if(y(s)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error deleting group event: "+s.error?.message})}await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return h(s.data)}async importGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error importing group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const i=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(i){n.append("calendar_id",i)}const[s,r]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/import-group-events?${n.toString()}`,body:e});if(r){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error importing group event: "+r.message})}if(y(s)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error importing group event: "+s.error?.message})}if(s.data?.imported_events?.length>0){await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration)}this.nylasSchedulerConfigStore.state.isLoading=false;return h(s.data)}}class k{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}init(){d("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){if(this._schedulerConfigConnector){return this._schedulerConfigConnector}this._schedulerConfigConnector=new E({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore});return this._schedulerConfigConnector}resetStores(){d("NylasSchedulerConfigConnector resetStores");this.nylasSchedulerConfigStore.reset()}async logout(){d("NylasSchedulerConfigConnector logout");this.resetStores()}}function x(e={}){const t={selectedConfiguration:{},configurations:[],groupEvents:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],requiresSlug:false,masterGroupEvents:{},isLoading:false,...e};const n=b(t);function i(){n.set("selectedConfiguration",{...e["selectedConfiguration"]})}n.onChange("action",(async e=>{if(!e){i()}}));return{...n,resetSelectedConfiguration:i}}class C{get(e){return new Promise((t=>{const n=globalThis.window?.localStorage.getItem(e);if(!n){t(null)}else{t(JSON.parse(n))}}))}async remove(e){globalThis.window?.localStorage.removeItem(e);return new Promise((e=>{e(null)}))}set(e,t){globalThis.window?.localStorage.setItem(e,JSON.stringify(t));return new Promise((e=>{e(null)}))}}const $="pkce";const S="grant";const T="user";const P=e=>{if(typeof globalThis.btoa==="function"&&typeof TextEncoder!=="undefined"){const t=(new TextEncoder).encode(e);let n="";for(let e=0;e<t.length;e++){n+=String.fromCharCode(t[e])}return globalThis.btoa(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"utf8").toString("base64")}throw new Error("Base64 encoding is not supported in this environment")};const R=e=>{if(typeof globalThis.atob==="function"&&typeof TextDecoder!=="undefined"){const t=globalThis.atob(e);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){n[e]=t.charCodeAt(e)}return(new TextDecoder).decode(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"base64").toString("utf8")}throw new Error("Base64 decoding is not supported in this environment")};class I{Storage=new C;constructor(e){if(e){this.Storage=e;return}}setPKCE(e){const t=P(e);this.Storage.set($,t)}async getPKCE(){try{const e=await this.Storage.get($);if(e){return R(e)}}catch(e){return null}return null}removePKCE(){this.Storage.remove($)}setGrant(e,t=false){const{grant_id:n}=e;this.Storage.set(`${S}${t?"-"+n:""}`,e)}removeGrant(e,t=false){this.Storage.remove(`${S}${t?"-"+e:""}`)}async getGrant(e,t=false){const n=await this.Storage.get(`${S}${t?"-"+e:""}`);if(n){return n}return null}async setUserToken(e){const t=await this.getUserTokens();if(t){const n=t.find((t=>t.sub===e.sub));if(!n){const n=[...t,e];this.Storage.set(T,n)}else{const n=t.map((t=>{if(t.sub===e.sub){t=e}return t}));this.Storage.set(T,n)}}else{this.Storage.set(T,[e])}}async getUserToken(e=""){const t=await this.Storage.get(T);if(t){if(e===""){return t[0]}const n=t.find((t=>t.sub===e));return n}return null}async getUserTokens(){const e=await this.Storage.get(T);if(e){return e}return null}removeUserTokens(){this.Storage.remove(T)}async removeUserToken(e){const t=await this.getUserTokens();const n=t?.filter((t=>t.sub!==e));this.Storage.set(T,n)}async clearSession(){const e=await this.getUserTokens();e?.forEach((e=>{this.removeGrant(e.sub)}));this.removePKCE();this.removeUserTokens()}}class q{databaseName="identity-db";storeName="identity";get(e){const t=this;return new Promise(((n,i)=>{t.openDatabase().then((function(s){const r=s.transaction(t.storeName,"readwrite");const o=r.objectStore(t.storeName);const a=o.get(e);a.onsuccess=()=>{n(a.result)};a.onerror=()=>{i(a.error)};r.oncomplete=()=>{s.close()}}))}))}async remove(e){const t=this;return new Promise(((n,i)=>{const s=indexedDB.open(this.databaseName);s.onupgradeneeded=function(e){const n=e.target.result;n.createObjectStore(t.storeName)};s.onerror=()=>{i(s.error)};s.onsuccess=t=>{const s=t.target.result;const r=s.transaction(this.storeName,"readwrite");const o=r.objectStore(this.storeName);const a=o.delete(e);a.onsuccess=()=>{n(null)};a.onerror=()=>{i(a.error)};r.oncomplete=()=>{s.close()}}}))}set(e,t){return new Promise(((n,i)=>{const s=indexedDB.open(this.databaseName);s.onerror=()=>{i(s.error)};s.onupgradeneeded=e=>{const t=e.target.result;t.createObjectStore(this.storeName)};s.onsuccess=s=>{const r=s.target.result;const o=r.transaction(this.storeName,"readwrite");const a=o.objectStore(this.storeName);const c=a.put(t,e);c.onsuccess=()=>{n(t)};c.onerror=()=>{i(c.error)};o.oncomplete=()=>{r.close()}}}))}openDatabase(){const e=this;return new Promise((function(t,n){const i=indexedDB.open(e.databaseName,2);i.onupgradeneeded=function(t){const n=t.target.result;n.createObjectStore(e.storeName)};i.onsuccess=function(e){t(e.target.result)};i.onerror=function(e){n(e.error)}}))}}var A;var N=new Uint8Array(16);function U(){if(!A){A=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!=="undefined"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto);if(!A){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return A(N)}var L=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function j(e){return typeof e==="string"&&L.test(e)}var z=[];for(var O=0;O<256;++O){z.push((O+256).toString(16).substr(1))}function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=(z[e[t+0]]+z[e[t+1]]+z[e[t+2]]+z[e[t+3]]+"-"+z[e[t+4]]+z[e[t+5]]+"-"+z[e[t+6]]+z[e[t+7]]+"-"+z[e[t+8]]+z[e[t+9]]+"-"+z[e[t+10]]+z[e[t+11]]+z[e[t+12]]+z[e[t+13]]+z[e[t+14]]+z[e[t+15]]).toLowerCase();if(!j(n)){throw TypeError("Stringified UUID is invalid")}return n}function G(e,t,n){e=e||{};var i=e.random||(e.rng||U)();i[6]=i[6]&15|64;i[8]=i[8]&63|128;return D(i)}async function B(e,t){const n=e.getReader();let i;while(!(i=await n.read()).done){t(i.value)}}function H(e){let t;let n;let i;let s=false;return function r(o){if(t===undefined){t=o;n=0;i=-1}else{t=M(t,o)}const a=t.length;let c=0;while(n<a){if(s){if(t[n]===10){c=++n}s=false}let r=-1;for(;n<a&&r===-1;++n){switch(t[n]){case 58:if(i===-1){i=n-c}break;case 13:s=true;case 10:r=n;break}}if(r===-1){break}e(t.subarray(c,r),i);c=n;i=-1}if(c===a){t=undefined}else if(c!==0){t=t.subarray(c);n-=c}}}function F(e,t,n){let i=J();const s=new TextDecoder;return function r(o,a){if(o.length===0){n===null||n===void 0?void 0:n(i);i=J()}else if(a>0){const n=s.decode(o.subarray(0,a));const r=a+(o[a+1]===32?2:1);const c=s.decode(o.subarray(r));switch(n){case"data":i.data=i.data?i.data+"\n"+c:c;break;case"event":i.event=c;break;case"id":e(i.id=c);break;case"retry":const n=parseInt(c,10);if(!isNaN(n)){t(i.retry=n)}break}}}}function M(e,t){const n=new Uint8Array(e.length+t.length);n.set(e);n.set(t,e.length);return n}function J(){return{data:"",event:"",id:"",retry:undefined}}var Y=undefined&&undefined.__rest||function(e,t){var n={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0)n[i]=e[i];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++){if(t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s]))n[i[s]]=e[i[s]]}return n};const K="text/event-stream";const W=1e3;const Q="last-event-id";function V(e,t){var{signal:n,headers:i,onopen:s,onmessage:r,onclose:o,onerror:a,openWhenHidden:c,fetch:l}=t,u=Y(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(((t,d)=>{const h=Object.assign({},i);if(!h.accept){h.accept=K}let f;function p(){f.abort();if(!document.hidden){v()}}if(!c){document.addEventListener("visibilitychange",p)}let g=W;let y=0;function w(){document.removeEventListener("visibilitychange",p);window.clearTimeout(y);f.abort()}n===null||n===void 0?void 0:n.addEventListener("abort",(()=>{w();t()}));const b=l!==null&&l!==void 0?l:window.fetch;const m=s!==null&&s!==void 0?s:Z;async function v(){var n;f=new AbortController;try{const n=await b(e,Object.assign(Object.assign({},u),{headers:h,signal:f.signal}));await m(n);await B(n.body,H(F((e=>{if(e){h[Q]=e}else{delete h[Q]}}),(e=>{g=e}),r)));o===null||o===void 0?void 0:o();w();t()}catch(e){if(!f.signal.aborted){try{const t=(n=a===null||a===void 0?void 0:a(e))!==null&&n!==void 0?n:g;window.clearTimeout(y);y=window.setTimeout(v,t)}catch(e){w();d(e)}}}}v()}))}function Z(e){const t=e.headers.get("content-type");if(!(t===null||t===void 0?void 0:t.startsWith(K))){throw new Error(`Expected content-type to be ${K}, Actual: ${t}`)}}function X(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ee(){return Math.floor(Date.now()/1e3)}async function te(e){const t=(new TextEncoder).encode(e);const n=await crypto.subtle.digest("SHA-256",t);const i=Array.from(new Uint8Array(n));const s=i.map((e=>e.toString(16).padStart(2,"0"))).join("");return s}function ne(e){this.message=e}ne.prototype=new Error,ne.prototype.name="InvalidCharacterError";var ie="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new ne("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,s=0,r=0,o="";i=t.charAt(r++);~i&&(n=s%4?64*n+i:i,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function se(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(ie(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return ie(t)}}function re(e){this.message=e}function oe(e,t){if("string"!=typeof e)throw new re("Invalid token specified");var n=true===(t=t||{}).header?0:1;try{return JSON.parse(se(e.split(".")[n]))}catch(e){throw new re("Invalid token specified: "+e.message)}}re.prototype=new Error,re.prototype.name="InvalidTokenError";class ae{clientId;redirectUri;accessType="online";domain="http://api.nylas.com";versioned=false;Storage;hosted=false;multiAccount=false;loginId="";constructor(e){this.clientId=e.clientId;this.redirectUri=e.redirectUri;if(e.domain){this.domain=e.domain;const t=this.domain.substring(this.domain.length-3);if(t.includes("/v")){this.versioned=true}}if(e.multiAccount){this.multiAccount=e.multiAccount}if(e.sw){const e=new q;this.Storage=new I(e)}else{this.Storage=new I}if(e.accessType){this.accessType=e.accessType}if(e.loginId){this.loginId=e.loginId}if(e.hosted){this.hosted=e.hosted}if(e.disableInitCodeExchange!==true){this.codeExchange(null)}}async validateAccessToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{access_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?access_token=${n}`,{method:"GET"});const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}async validateIDToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{id_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?id_token=${n}`,{method:"GET"});if(e.status!==200){return false}const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}getDomain(){return this.domain}async auth(e){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){await this.hostedSetCodeChallenge()}const t=await this.generateAuthURL(e);if(e.popup){this.popUp(t);return}return t}async generateAuthURL(e){const t=await this.getCodeChallege();let n=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(t){n+=`&code_challenge=${t}&code_challenge_method=S256&options=rotate_refresh_token`}if(e.provider){n+=`&provider=${e.provider}`}if(e.loginHint){n+=`&login_hint=${e.loginHint}`;if(e.includeGrantScopes){n+=`&include_grant_scopes=${e.includeGrantScopes}`}}if(e.scope){n+=`&scope=${e.scope.join(" ")}`}if(e.prompt){n+=`&prompt=${e.prompt}`}if(e.metadata){n+=`&metadata=${e.metadata}`}if(e.state||this.loginId){n+=`&state=${this.loginId?this.loginId:e.state}`}return n}async generateReauthURL(e,t){if(!e){throw new Error("Grant ID is required")}const n=await this.Storage.getUserToken(e);const i=await this.getCodeChallege();let s=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(i){s+=`&code_challenge=${i}&code_challenge_method=S256&options=rotate_refresh_token`}if(n?.provider){s+=`&provider=${n.provider}`}if(n?.email){s+=`&login_hint=${n.email}`}if(t){s+=`&scope=${t.join(" ")}`}return s}async generateCodeChallenge(){const e=await this.Storage.getPKCE();if(e){return}const t=G();this.Storage.setPKCE(t);return}async hostedSetCodeChallenge(){if(!this.hosted){throw console.error("Method only used with hosted flag enabled")}const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){const e=await this.Storage.getPKCE();if(e){return}console.warn("Code challenge is recomended");return}this.Storage.setPKCE(t)}async getCodeChallege(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){console.warn("Code challenge is recomended");return""}return t}const e=await this.Storage.getPKCE();if(e){const t=await te(e);let n=btoa(unescape(encodeURIComponent(t)));n=X(n);return n}return""}async isLoggedIn(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){return false}const e=await this.Storage.getUserTokens();if(e&&e.length>0){if(this.multiAccount){await this.generateCodeChallenge()}return true}await this.generateCodeChallenge();return false}isMultiAccount(){return this.multiAccount}async logout(){const e=await this.getProfile();await this.Storage.clearSession();const t={detail:e};window.dispatchEvent(new CustomEvent("onLogoutSuccess",t))}async getProfile(e=""){let t;if(e){t=await this.Storage.getUserToken(e)}else{t=await this.Storage.getUserToken()}if(t){return t}return null}async getProfiles(){const e=await this.Storage.getUserTokens();if(e){return e}return null}async removeProfile(e){await this.Storage.removeUserToken(e);await this.Storage.removeGrant(e);return null}async authIMAP(e){const t=await this.getCodeChallege();const n={imap_username:e.imap_username,imap_password:e.imap_password,imap_host:e.imap_host,imap_port:e.imap_port,type:e.type,smtp_host:e.smtp_host,smtp_port:e.smtp_port,provider:e.provider,redirect_uri:this.redirectUri,state:e.state,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e.smtp_username&&e.smtp_password){n.smtp_username=e.smtp_username;n.smtp_password=e.smtp_password}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const s=await i.json();return s}async authEWS(e){const t=await this.getCodeChallege();const n={...e,provider:"ews",redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const s=await i.json();return s}async detectEmail(e){const t=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${e}`,{method:"POST",headers:new Headers({"content-type":"application/json"})});const n=await t.json();return n}async applicationInfo(){const e=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});const t=await e.json();return t.data}async getAvailableProviders(){const e=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});if(e){const t=await e.json();const n=t.data;return n}return null}onLoginSuccess(e){window.addEventListener("onLoginSuccess",(t=>e(t)))}onLogoutSuccess(e){window.addEventListener("onLogoutSuccess",(t=>e(t)))}onLoginFail(e){window.addEventListener("onLoginFail",(t=>e(t)))}onTokenRefreshSuccess(e){window.addEventListener("onTokenRefreshSuccess",(t=>e(t)))}onTokenRefreshFail(e){window.addEventListener("onTokenRefreshFail",(t=>e(t)))}onSessionExpired(e){window.addEventListener("onSessionExpired",(t=>e(t)))}async codeExchange(e){let t=new URLSearchParams(globalThis.window?.location.search);if(e){t=new URLSearchParams(e)}const n=t.get("code");const i=t.get("state");const s=t.get("error");const r=t.get("error_description");const o=t.get("error_code");if(s&&r&&o){const e={detail:{error:s,error_description:r,error_code:o}};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}if(!n){console.warn("No code found");return false}if(window.opener&&window.name==="uas-popup"){console.warn("Popup window detected");return false}const a=await this.Storage.getPKCE();if(!a){console.warn("No code verifier found");return false}try{const e={client_id:this.clientId,redirect_uri:this.redirectUri,code:n,grant_type:"authorization_code",code_verifier:a};const t=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(e)});const s=await t.json();if(s){if(s.error){const e={detail:s};window.dispatchEvent(new CustomEvent("onLoginFail",e));return true}const e=await this.handleCodeExchangeResponse(s);if(!e.valid){const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginFail",t));return true}else{if(i){e.data.state=i}const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",t));window.history.pushState({},document.title,window.location.pathname)}}this.Storage.removePKCE();return true}catch(s){const e={detail:s};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}}async tokenExchange(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const n=t.refresh_token;try{const t={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:n,grant_type:"refresh_token"};const i=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(t)});const s=await i.json();if(s){if(s.error){const e={detail:s};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const t=ee();s.expires_in=t+s.expires_in;this.Storage.setGrant(s,this.multiAccount);const n=await this.validateIDToken(e);if(!n){const e={detail:s};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const i={detail:s};window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",i));return true}this.Storage.removePKCE()}catch(e){const t={detail:e};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return false}}async handleCodeExchangeResponse(e){const t=true;if(e.error){return{data:e,valid:false}}const n=ee();e.expires_in=n+e.expires_in;this.Storage.setGrant(e,this.multiAccount);const i=oe(e.id_token);i.status="authenticated";this.Storage.setUserToken(i);const s=await this.validateIDToken(i.sub);if(!s){return{data:e,valid:false}}return{data:e,valid:t}}async popUp(e){const t=500;const n=600;const i=window.screenX+(window.outerWidth-t)/2;const s=window.screenY+(window.outerHeight-n)/2.5;const r=`uas-popup`;const o=e;const a=window.open(o,r,`width=${t},height=${n},left=${i},top=${s}`);if(!a){return}const c=setInterval((async()=>{if(a.closed){const e={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",e));c&&clearInterval(c);return}try{const e=a.location.href.split("?");if(!e[0]){return}const t=a.location.search;a.history.pushState({},document.title,window.location.pathname);if(e[0]===this.redirectUri&&e.length>1){const e=await this.codeExchange(t);a.close();if(e){location.reload()}c&&clearInterval(c);return}}catch(e){return}}),1e3)}async getAccessToken(e=""){const t=ee();const n=await this.Storage.getGrant(e,this.multiAccount);if(!n){return null}const{access_token:i,expires_in:s}=n;const r=i;if(r){if(s&&s>ee()){const e=s-t;if(e>30){return r}}}await this.tokenExchange(e);const o=await this.Storage.getGrant(e,this.multiAccount);return o.access_token}async sse(e,t){const n=t.headers||{};const i=n["Grant-ID"];let s="";if(this.multiAccount){if(!i){this.logout();throw new Error("Grant ID is required for multi account calls")}s=await this.getAccessToken(i)}else{s=await this.getAccessToken()}delete n["Grant-ID"];n["Authorization"]=`Bearer ${s}`;if(!n["content-type"]){n["content-type"]="application/json"}return V(`${this.domain}/${e}`,{...t,headers:n})}async fetch(e,t,n=true,i){let s="";let r=1;if(this.multiAccount){if(!t.grant_id){this.logout();throw new Error("Grant ID is required for multi account calls")}const e=await this.getProfiles();r=e?e.length:1;s=await this.getAccessToken(t.grant_id)}else{s=await this.getAccessToken()}if(!s){throw new Error("Access token not found")}let o=t.headers;if(!Headers.prototype.isPrototypeOf(o)){o=new Headers({Authorization:`Bearer ${s}`,"content-type":"application/json"})}else{o.append("Authorization",`Bearer ${s}`);if(!o.has("content-type")){o.append("content-type","application/json")}}try{if(t?.body){t.body=JSON.stringify(t?.body)}const s=await fetch(`${i||this.domain}/${e}`,{...t,headers:o});if(!n){return s}const a=await(s?.json());const c=await this.isAuthenticatedResponse(s.status,a);if(!c){if(r>1){const e=await this.getProfile(t.grant_id);if(e){e.status="unauthorized";await this.Storage.setUserToken(e);const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}}else{const e=await this.Storage.getUserToken();const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}this.logout();return}return a}catch(e){throw e}}async fetchRequest(e,t,n,i=true,s,r){const o=await this.isLoggedIn();const a=new URL(e,s??this.domain);const c=new Headers;c.append("Accept","application/json");c.append("Content-Type","application/json");c.append("User-Agent","nylas-identity");if(o){const e=await this.getAccessToken();c.append("Authorization",`Bearer ${e}`)}const l=await fetch(a.toString(),{method:t||"GET",headers:c,mode:"cors",referrer:globalThis.window?.location.origin,body:n?JSON.stringify(n):undefined,...r||{}});if(!i){return l.body}const u=await l.json();return u}async isAuthenticatedResponse(e,t){if(e==401&&t?.error?.type=="token.unauthorized_access"){return false}return true}addAPIKey(e,t,n){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:true,iat:ee(),iss:"",email:t,provider:"virtual-calendar",status:"authenticated",name:t,sub:e});this.Storage.setGrant({grant_id:e,access_token:n,expires_in:2e9},this.multiAccount)}}var ce={exports:{}};var le={};
|
|
1
|
+
import{h as e,F as t,r as n,c as i,H as s,a as r}from"./p-0EQQA0nE.js";import{N as o}from"./p-BS9pAWHt.js";import{N as a}from"./p-Cb2blKKQ.js";import{d as c,u as l,t as u,a as d,b as h,g as f,e as p,i as g}from"./p-D7AODx4L.js";import{o as y,v as w}from"./p-DM0y_1NQ.js";import{c as b}from"./p-_i6H-yQH.js";import{C as m,L as v,a as _}from"./p-COJy29df.js";c.extend(l);c.extend(u);class E{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.groupEventsCache=new Map;this.CACHE_DURATION=1*60*1e3;this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}async currentUser(){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return null}return this.nylasApiRequest.currentUser()}async getCalendars(){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching calendars: Nylas API Request is not initialized"})}const e=[];let t=null;const n=50;do{const[i,s]=await this.nylasApiRequest.request({method:"GET",path:`calendars?limit=${n}${t?`&page_token=${t}`:""}`});if(s){return h(null,{message:"Error fetching calendars: "+s.message})}if(y(i)){return h(null,{message:"Error fetching calendars: "+i.error?.message})}e.push(...i.data);t=i.next_cursor||null}while(t);this.nylasSchedulerConfigStore.state.calendars=e;return h(e)}async getConfigurationById(e,t=false){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching configuration: Nylas API Request is not initialized"})}if(!t){const t=this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e));if(t){this.nylasSchedulerConfigStore.state.selectedConfiguration=t;return h(t)}}const[n,i]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}`});if(i){return h(null,{message:"Error fetching configuration: "+i.message})}if(y(n)){return h(null,{message:"Error fetching configuration: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((t=>t.id===e?n.data:t))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data]}return h(n.data)}async getConfigurations(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching configurations: Nylas API Request is not initialized"})}const t=50;const[n,i]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations?limit=${t}${e?`&page_token=${e}`:""}`});if(i){return h(null,{message:"Error fetching configurations: "+i.message})}if(y(n)){return h(null,{message:"Error fetching configurations: "+n.error?.message})}this.nylasSchedulerConfigStore.state.configurations=n.data;this.nylasSchedulerConfigStore.state.listConfigurationsNextCursor=n.next_cursor||null;return h(n.data)}async getMasterEventById(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching master event: Nylas API Request is not initialized"})}const t=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const n=t?.event?.calendar_id;if(!n){d("Calendar ID is not present");return h(null,{message:"Error fetching master event: Calendar ID is not present"})}const i=new URLSearchParams;i.append("calendar_id",n);const[s,r]=await this.nylasApiRequest.request({method:"GET",path:`events/${e}?${i.toString()}`});if(r){return h(null,{message:"Error fetching master event: "+r.message})}if(y(s)){return h(null,{message:"Error fetching master event: "+s.error?.message})}const o=this.nylasSchedulerConfigStore.state.masterGroupEvents;if(o[e]){this.nylasSchedulerConfigStore.state.masterGroupEvents[e]=s.data}else{this.nylasSchedulerConfigStore.state.masterGroupEvents={...o,[e]:s.data}}return h(s.data)}async createConfiguration(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:e});if(n){return h(null,{message:"Error creating configuration: "+n.message})}if(y(t)){return h(null,{message:"Error creating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data];return h(t.data)}async updateConfiguration(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error updating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${e.id}`,body:e});if(n){return h(null,{message:"Error updating configuration: "+n.message})}if(y(t)){return h(null,{message:"Error updating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((n=>n.id===e.id?t.data:n))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data]}return h(t.data)}async deleteConfiguration(e){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error deleting configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${e}`});if(n){return h(null,{message:"Error deleting configuration: "+n.message})}if(y(t)){return h(null,{message:"Error deleting configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((t=>t.id!==e));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===e){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return h(t.data)}async createGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error creating group event: Nylas API Request is not initialized"})}const[n,i]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/group-events`,body:e});if(i){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error creating group event: "+i.message})}if(y(n)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error creating group event: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=n.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return h(n.data)}async getGroupEvents(e,t){if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error fetching group events: Nylas API Request is not initialized"})}const n=new URLSearchParams;n.append("show_all","true");const i=this.nylasSchedulerConfigStore.state.calendarViewDateRange;let s;let r;if(i){s=i.start_time;r=i.end_time}else{const e=f((new Date).toISOString(),"week");s=e.startTime.toString();r=e.endTime.toString()}const o=`${e}-${s}-${r}`;const a=this.groupEventsCache.get(o);if(a&&Date.now()-a.timestamp<this.CACHE_DURATION){this.nylasSchedulerConfigStore.state.groupEvents=a.data;return h(a.data)}n.append("start_time",s);n.append("end_time",r);const c=t?.group_booking?.calendar_id;if(c){n.append("calendar_id",c)}const[l,u]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}/group-events?${n.toString()}`});if(u){return h(null,{message:"Error fetching group events: "+u.message})}if(y(l)){return h(null,{message:"Error fetching group events: "+l.error?.message})}this.groupEventsCache.set(o,{data:l.data,timestamp:Date.now()});this.cleanupExpiredCache();this.nylasSchedulerConfigStore.state.groupEvents=l.data;return h(l.data)}cleanupExpiredCache(){const e=Date.now();for(const[t,n]of this.groupEventsCache.entries()){if(e-n.timestamp>this.CACHE_DURATION){this.groupEventsCache.delete(t)}}}async updateGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error updating group event: Nylas API Request is not initialized"})}const n=e.id;delete e.id;const[i,s]=await this.nylasApiRequest.request({method:"PATCH",path:`scheduling/configurations/${t}/group-events/${n}`,body:e});if(s){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error updating group event: "+s.message})}if(y(i)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error updating group event: "+i.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=i.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return h(i.data)}async updateGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const i=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const s=i?.event?.master_event_id;const r=i?.event?.id;const o=i?.event?.when?.start_time;const a=i?.group_event_info?.rrule?.[0];const l=a?a.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=o?c(o*1e3).subtract(1,"minute").format("YYYYMMDDTHHmmss[Z]"):"";if(t==="this"){return this.updateGroupEventById({...e,id:r,recurrence:s?undefined:e.recurrence},n)}else if(t==="future"&&s){const t=await this.createGroupEvent(e,n);const r={location:i?.event?.location,conferencing:i?.event?.conferencing,title:i?.event?.title,description:i?.event?.description,capacity:i?.group_event_info?.capacity,calendar_id:i?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:FREQ=DAILY;UNTIL=${u}`]};await this.updateGroupEventById({...r,id:s},n);return[r,t]}else if(t==="all"){const t=e?.when;const r=i?.event?.when;const o=this.nylasSchedulerConfigStore.state.masterGroupEvents?.[s];let a=o?.when;if(t?.start_time!==r?.start_time){a={...a,start_time:t?.start_time||a?.start_time}}if(t?.end_time!==r?.end_time){a={...a,end_time:t?.end_time||a?.end_time}}if(t?.start_timezone!==r?.start_timezone){a={...a,start_timezone:t?.start_timezone||a?.start_timezone}}if(t?.end_timezone!==r?.end_timezone){a={...a,end_timezone:t?.end_timezone||a?.end_timezone}}return this.updateGroupEventById({...e,when:a,id:s},n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const i=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const s=i?.event?.master_event_id;const r=i?.event?.id;const o=i?.event?.when?.start_time;const a=i?.group_event_info?.rrule?.[0];const l=a?a.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=o?c(o*1e3).format("YYYYMMDDTHHmmss[Z]"):"";const d={location:i?.event?.location,conferencing:i?.event?.conferencing,title:i?.event?.title,description:i?.event?.description,capacity:i?.group_event_info?.capacity,calendar_id:i?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:UNTIL=${u}`]};if(t==="this"&&r){return this.deleteGroupEventById(r,n)}else if(t==="future"&&s&&r){await this.deleteGroupEventById(r,n);return await this.updateGroupEventById({...d,id:s},n)}else if(t==="all"&&s){return this.deleteGroupEventById(s,n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error deleting group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const i=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(i){n.append("calendar_id",i)}const[s,r]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}/group-events/${e}?calendar_id=${i}`});if(r){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error deleting group event: "+r.message})}if(y(s)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error deleting group event: "+s.error?.message})}await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return h(s.data)}async importGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){d("Nylas API Request is not initialized");return h(null,{message:"Error importing group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const i=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(i){n.append("calendar_id",i)}const[s,r]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/import-group-events?${n.toString()}`,body:e});if(r){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error importing group event: "+r.message})}if(y(s)){this.nylasSchedulerConfigStore.state.isLoading=false;return h(null,{message:"Error importing group event: "+s.error?.message})}if(s.data?.imported_events?.length>0){await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration)}this.nylasSchedulerConfigStore.state.isLoading=false;return h(s.data)}}class k{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}init(){d("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){if(this._schedulerConfigConnector){return this._schedulerConfigConnector}this._schedulerConfigConnector=new E({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore});return this._schedulerConfigConnector}resetStores(){d("NylasSchedulerConfigConnector resetStores");this.nylasSchedulerConfigStore.reset()}async logout(){d("NylasSchedulerConfigConnector logout");this.resetStores()}}function x(e={}){const t={selectedConfiguration:{},configurations:[],groupEvents:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],requiresSlug:false,masterGroupEvents:{},isLoading:false,...e};const n=b(t);function i(){n.set("selectedConfiguration",{...e["selectedConfiguration"]})}n.onChange("action",(async e=>{if(!e){i()}}));return{...n,resetSelectedConfiguration:i}}class C{get(e){return new Promise((t=>{const n=globalThis.window?.localStorage.getItem(e);if(!n){t(null)}else{t(JSON.parse(n))}}))}async remove(e){globalThis.window?.localStorage.removeItem(e);return new Promise((e=>{e(null)}))}set(e,t){globalThis.window?.localStorage.setItem(e,JSON.stringify(t));return new Promise((e=>{e(null)}))}}const $="pkce";const S="grant";const T="user";const P=e=>{if(typeof globalThis.btoa==="function"&&typeof TextEncoder!=="undefined"){const t=(new TextEncoder).encode(e);let n="";for(let e=0;e<t.length;e++){n+=String.fromCharCode(t[e])}return globalThis.btoa(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"utf8").toString("base64")}throw new Error("Base64 encoding is not supported in this environment")};const R=e=>{if(typeof globalThis.atob==="function"&&typeof TextDecoder!=="undefined"){const t=globalThis.atob(e);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){n[e]=t.charCodeAt(e)}return(new TextDecoder).decode(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"base64").toString("utf8")}throw new Error("Base64 decoding is not supported in this environment")};class I{Storage=new C;constructor(e){if(e){this.Storage=e;return}}setPKCE(e){const t=P(e);this.Storage.set($,t)}async getPKCE(){try{const e=await this.Storage.get($);if(e){return R(e)}}catch(e){return null}return null}removePKCE(){this.Storage.remove($)}setGrant(e,t=false){const{grant_id:n}=e;this.Storage.set(`${S}${t?"-"+n:""}`,e)}removeGrant(e,t=false){this.Storage.remove(`${S}${t?"-"+e:""}`)}async getGrant(e,t=false){const n=await this.Storage.get(`${S}${t?"-"+e:""}`);if(n){return n}return null}async setUserToken(e){const t=await this.getUserTokens();if(t){const n=t.find((t=>t.sub===e.sub));if(!n){const n=[...t,e];this.Storage.set(T,n)}else{const n=t.map((t=>{if(t.sub===e.sub){t=e}return t}));this.Storage.set(T,n)}}else{this.Storage.set(T,[e])}}async getUserToken(e=""){const t=await this.Storage.get(T);if(t){if(e===""){return t[0]}const n=t.find((t=>t.sub===e));return n}return null}async getUserTokens(){const e=await this.Storage.get(T);if(e){return e}return null}removeUserTokens(){this.Storage.remove(T)}async removeUserToken(e){const t=await this.getUserTokens();const n=t?.filter((t=>t.sub!==e));this.Storage.set(T,n)}async clearSession(){const e=await this.getUserTokens();e?.forEach((e=>{this.removeGrant(e.sub)}));this.removePKCE();this.removeUserTokens()}}class q{databaseName="identity-db";storeName="identity";get(e){const t=this;return new Promise(((n,i)=>{t.openDatabase().then((function(s){const r=s.transaction(t.storeName,"readwrite");const o=r.objectStore(t.storeName);const a=o.get(e);a.onsuccess=()=>{n(a.result)};a.onerror=()=>{i(a.error)};r.oncomplete=()=>{s.close()}}))}))}async remove(e){const t=this;return new Promise(((n,i)=>{const s=indexedDB.open(this.databaseName);s.onupgradeneeded=function(e){const n=e.target.result;n.createObjectStore(t.storeName)};s.onerror=()=>{i(s.error)};s.onsuccess=t=>{const s=t.target.result;const r=s.transaction(this.storeName,"readwrite");const o=r.objectStore(this.storeName);const a=o.delete(e);a.onsuccess=()=>{n(null)};a.onerror=()=>{i(a.error)};r.oncomplete=()=>{s.close()}}}))}set(e,t){return new Promise(((n,i)=>{const s=indexedDB.open(this.databaseName);s.onerror=()=>{i(s.error)};s.onupgradeneeded=e=>{const t=e.target.result;t.createObjectStore(this.storeName)};s.onsuccess=s=>{const r=s.target.result;const o=r.transaction(this.storeName,"readwrite");const a=o.objectStore(this.storeName);const c=a.put(t,e);c.onsuccess=()=>{n(t)};c.onerror=()=>{i(c.error)};o.oncomplete=()=>{r.close()}}}))}openDatabase(){const e=this;return new Promise((function(t,n){const i=indexedDB.open(e.databaseName,2);i.onupgradeneeded=function(t){const n=t.target.result;n.createObjectStore(e.storeName)};i.onsuccess=function(e){t(e.target.result)};i.onerror=function(e){n(e.error)}}))}}var A;var N=new Uint8Array(16);function U(){if(!A){A=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!=="undefined"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto);if(!A){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return A(N)}var L=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function j(e){return typeof e==="string"&&L.test(e)}var z=[];for(var O=0;O<256;++O){z.push((O+256).toString(16).substr(1))}function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=(z[e[t+0]]+z[e[t+1]]+z[e[t+2]]+z[e[t+3]]+"-"+z[e[t+4]]+z[e[t+5]]+"-"+z[e[t+6]]+z[e[t+7]]+"-"+z[e[t+8]]+z[e[t+9]]+"-"+z[e[t+10]]+z[e[t+11]]+z[e[t+12]]+z[e[t+13]]+z[e[t+14]]+z[e[t+15]]).toLowerCase();if(!j(n)){throw TypeError("Stringified UUID is invalid")}return n}function G(e,t,n){e=e||{};var i=e.random||(e.rng||U)();i[6]=i[6]&15|64;i[8]=i[8]&63|128;return D(i)}async function H(e,t){const n=e.getReader();let i;while(!(i=await n.read()).done){t(i.value)}}function B(e){let t;let n;let i;let s=false;return function r(o){if(t===undefined){t=o;n=0;i=-1}else{t=M(t,o)}const a=t.length;let c=0;while(n<a){if(s){if(t[n]===10){c=++n}s=false}let r=-1;for(;n<a&&r===-1;++n){switch(t[n]){case 58:if(i===-1){i=n-c}break;case 13:s=true;case 10:r=n;break}}if(r===-1){break}e(t.subarray(c,r),i);c=n;i=-1}if(c===a){t=undefined}else if(c!==0){t=t.subarray(c);n-=c}}}function F(e,t,n){let i=J();const s=new TextDecoder;return function r(o,a){if(o.length===0){n===null||n===void 0?void 0:n(i);i=J()}else if(a>0){const n=s.decode(o.subarray(0,a));const r=a+(o[a+1]===32?2:1);const c=s.decode(o.subarray(r));switch(n){case"data":i.data=i.data?i.data+"\n"+c:c;break;case"event":i.event=c;break;case"id":e(i.id=c);break;case"retry":const n=parseInt(c,10);if(!isNaN(n)){t(i.retry=n)}break}}}}function M(e,t){const n=new Uint8Array(e.length+t.length);n.set(e);n.set(t,e.length);return n}function J(){return{data:"",event:"",id:"",retry:undefined}}var Y=undefined&&undefined.__rest||function(e,t){var n={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0)n[i]=e[i];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++){if(t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s]))n[i[s]]=e[i[s]]}return n};const K="text/event-stream";const Q=1e3;const W="last-event-id";function V(e,t){var{signal:n,headers:i,onopen:s,onmessage:r,onclose:o,onerror:a,openWhenHidden:c,fetch:l}=t,u=Y(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(((t,d)=>{const h=Object.assign({},i);if(!h.accept){h.accept=K}let f;function p(){f.abort();if(!document.hidden){v()}}if(!c){document.addEventListener("visibilitychange",p)}let g=Q;let y=0;function w(){document.removeEventListener("visibilitychange",p);window.clearTimeout(y);f.abort()}n===null||n===void 0?void 0:n.addEventListener("abort",(()=>{w();t()}));const b=l!==null&&l!==void 0?l:window.fetch;const m=s!==null&&s!==void 0?s:Z;async function v(){var n;f=new AbortController;try{const n=await b(e,Object.assign(Object.assign({},u),{headers:h,signal:f.signal}));await m(n);await H(n.body,B(F((e=>{if(e){h[W]=e}else{delete h[W]}}),(e=>{g=e}),r)));o===null||o===void 0?void 0:o();w();t()}catch(e){if(!f.signal.aborted){try{const t=(n=a===null||a===void 0?void 0:a(e))!==null&&n!==void 0?n:g;window.clearTimeout(y);y=window.setTimeout(v,t)}catch(e){w();d(e)}}}}v()}))}function Z(e){const t=e.headers.get("content-type");if(!(t===null||t===void 0?void 0:t.startsWith(K))){throw new Error(`Expected content-type to be ${K}, Actual: ${t}`)}}function X(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ee(){return Math.floor(Date.now()/1e3)}async function te(e){const t=(new TextEncoder).encode(e);const n=await crypto.subtle.digest("SHA-256",t);const i=Array.from(new Uint8Array(n));const s=i.map((e=>e.toString(16).padStart(2,"0"))).join("");return s}function ne(e){this.message=e}ne.prototype=new Error,ne.prototype.name="InvalidCharacterError";var ie="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new ne("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,s=0,r=0,o="";i=t.charAt(r++);~i&&(n=s%4?64*n+i:i,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function se(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(ie(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return ie(t)}}function re(e){this.message=e}function oe(e,t){if("string"!=typeof e)throw new re("Invalid token specified");var n=true===(t=t||{}).header?0:1;try{return JSON.parse(se(e.split(".")[n]))}catch(e){throw new re("Invalid token specified: "+e.message)}}re.prototype=new Error,re.prototype.name="InvalidTokenError";class ae{clientId;redirectUri;accessType="online";domain="http://api.nylas.com";versioned=false;Storage;hosted=false;multiAccount=false;loginId="";constructor(e){this.clientId=e.clientId;this.redirectUri=e.redirectUri;if(e.domain){this.domain=e.domain;const t=this.domain.substring(this.domain.length-3);if(t.includes("/v")){this.versioned=true}}if(e.multiAccount){this.multiAccount=e.multiAccount}if(e.sw){const e=new q;this.Storage=new I(e)}else{this.Storage=new I}if(e.accessType){this.accessType=e.accessType}if(e.loginId){this.loginId=e.loginId}if(e.hosted){this.hosted=e.hosted}if(e.disableInitCodeExchange!==true){this.codeExchange(null)}}async validateAccessToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{access_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?access_token=${n}`,{method:"GET"});const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}async validateIDToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{id_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?id_token=${n}`,{method:"GET"});if(e.status!==200){return false}const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}getDomain(){return this.domain}async auth(e){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){await this.hostedSetCodeChallenge()}const t=await this.generateAuthURL(e);if(e.popup){this.popUp(t);return}return t}async generateAuthURL(e){const t=await this.getCodeChallege();let n=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(t){n+=`&code_challenge=${t}&code_challenge_method=S256&options=rotate_refresh_token`}if(e.provider){n+=`&provider=${e.provider}`}if(e.loginHint){n+=`&login_hint=${e.loginHint}`;if(e.includeGrantScopes){n+=`&include_grant_scopes=${e.includeGrantScopes}`}}if(e.scope){n+=`&scope=${e.scope.join(" ")}`}if(e.prompt){n+=`&prompt=${e.prompt}`}if(e.metadata){n+=`&metadata=${e.metadata}`}if(e.state||this.loginId){n+=`&state=${this.loginId?this.loginId:e.state}`}return n}async generateReauthURL(e,t){if(!e){throw new Error("Grant ID is required")}const n=await this.Storage.getUserToken(e);const i=await this.getCodeChallege();let s=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(i){s+=`&code_challenge=${i}&code_challenge_method=S256&options=rotate_refresh_token`}if(n?.provider){s+=`&provider=${n.provider}`}if(n?.email){s+=`&login_hint=${n.email}`}if(t){s+=`&scope=${t.join(" ")}`}return s}async generateCodeChallenge(){const e=await this.Storage.getPKCE();if(e){return}const t=G();this.Storage.setPKCE(t);return}async hostedSetCodeChallenge(){if(!this.hosted){throw console.error("Method only used with hosted flag enabled")}const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){const e=await this.Storage.getPKCE();if(e){return}console.warn("Code challenge is recomended");return}this.Storage.setPKCE(t)}async getCodeChallege(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){console.warn("Code challenge is recomended");return""}return t}const e=await this.Storage.getPKCE();if(e){const t=await te(e);let n=btoa(unescape(encodeURIComponent(t)));n=X(n);return n}return""}async isLoggedIn(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){return false}const e=await this.Storage.getUserTokens();if(e&&e.length>0){if(this.multiAccount){await this.generateCodeChallenge()}return true}await this.generateCodeChallenge();return false}isMultiAccount(){return this.multiAccount}async logout(){const e=await this.getProfile();await this.Storage.clearSession();const t={detail:e};window.dispatchEvent(new CustomEvent("onLogoutSuccess",t))}async getProfile(e=""){let t;if(e){t=await this.Storage.getUserToken(e)}else{t=await this.Storage.getUserToken()}if(t){return t}return null}async getProfiles(){const e=await this.Storage.getUserTokens();if(e){return e}return null}async removeProfile(e){await this.Storage.removeUserToken(e);await this.Storage.removeGrant(e);return null}async authIMAP(e){const t=await this.getCodeChallege();const n={imap_username:e.imap_username,imap_password:e.imap_password,imap_host:e.imap_host,imap_port:e.imap_port,type:e.type,smtp_host:e.smtp_host,smtp_port:e.smtp_port,provider:e.provider,redirect_uri:this.redirectUri,state:e.state,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e.smtp_username&&e.smtp_password){n.smtp_username=e.smtp_username;n.smtp_password=e.smtp_password}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const s=await i.json();return s}async authEWS(e){const t=await this.getCodeChallege();const n={...e,provider:"ews",redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const i=await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const s=await i.json();return s}async detectEmail(e){const t=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${e}`,{method:"POST",headers:new Headers({"content-type":"application/json"})});const n=await t.json();return n}async applicationInfo(){const e=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});const t=await e.json();return t.data}async getAvailableProviders(){const e=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});if(e){const t=await e.json();const n=t.data;return n}return null}onLoginSuccess(e){window.addEventListener("onLoginSuccess",(t=>e(t)))}onLogoutSuccess(e){window.addEventListener("onLogoutSuccess",(t=>e(t)))}onLoginFail(e){window.addEventListener("onLoginFail",(t=>e(t)))}onTokenRefreshSuccess(e){window.addEventListener("onTokenRefreshSuccess",(t=>e(t)))}onTokenRefreshFail(e){window.addEventListener("onTokenRefreshFail",(t=>e(t)))}onSessionExpired(e){window.addEventListener("onSessionExpired",(t=>e(t)))}async codeExchange(e){let t=new URLSearchParams(globalThis.window?.location.search);if(e){t=new URLSearchParams(e)}const n=t.get("code");const i=t.get("state");const s=t.get("error");const r=t.get("error_description");const o=t.get("error_code");if(s&&r&&o){const e={detail:{error:s,error_description:r,error_code:o}};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}if(!n){console.warn("No code found");return false}if(window.opener&&window.name==="uas-popup"){console.warn("Popup window detected");return false}const a=await this.Storage.getPKCE();if(!a){console.warn("No code verifier found");return false}try{const e={client_id:this.clientId,redirect_uri:this.redirectUri,code:n,grant_type:"authorization_code",code_verifier:a};const t=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(e)});const s=await t.json();if(s){if(s.error){const e={detail:s};window.dispatchEvent(new CustomEvent("onLoginFail",e));return true}const e=await this.handleCodeExchangeResponse(s);if(!e.valid){const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginFail",t));return true}else{if(i){e.data.state=i}const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",t));window.history.pushState({},document.title,window.location.pathname)}}this.Storage.removePKCE();return true}catch(s){const e={detail:s};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}}async tokenExchange(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const n=t.refresh_token;try{const t={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:n,grant_type:"refresh_token"};const i=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(t)});const s=await i.json();if(s){if(s.error){const e={detail:s};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const t=ee();s.expires_in=t+s.expires_in;this.Storage.setGrant(s,this.multiAccount);const n=await this.validateIDToken(e);if(!n){const e={detail:s};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const i={detail:s};window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",i));return true}this.Storage.removePKCE()}catch(e){const t={detail:e};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return false}}async handleCodeExchangeResponse(e){const t=true;if(e.error){return{data:e,valid:false}}const n=ee();e.expires_in=n+e.expires_in;this.Storage.setGrant(e,this.multiAccount);const i=oe(e.id_token);i.status="authenticated";this.Storage.setUserToken(i);const s=await this.validateIDToken(i.sub);if(!s){return{data:e,valid:false}}return{data:e,valid:t}}async popUp(e){const t=500;const n=600;const i=window.screenX+(window.outerWidth-t)/2;const s=window.screenY+(window.outerHeight-n)/2.5;const r=`uas-popup`;const o=e;const a=window.open(o,r,`width=${t},height=${n},left=${i},top=${s}`);if(!a){return}const c=setInterval((async()=>{if(a.closed){const e={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",e));c&&clearInterval(c);return}try{const e=a.location.href.split("?");if(!e[0]){return}const t=a.location.search;a.history.pushState({},document.title,window.location.pathname);if(e[0]===this.redirectUri&&e.length>1){const e=await this.codeExchange(t);a.close();if(e){location.reload()}c&&clearInterval(c);return}}catch(e){return}}),1e3)}async getAccessToken(e=""){const t=ee();const n=await this.Storage.getGrant(e,this.multiAccount);if(!n){return null}const{access_token:i,expires_in:s}=n;const r=i;if(r){if(s&&s>ee()){const e=s-t;if(e>30){return r}}}await this.tokenExchange(e);const o=await this.Storage.getGrant(e,this.multiAccount);return o.access_token}async sse(e,t){const n=t.headers||{};const i=n["Grant-ID"];let s="";if(this.multiAccount){if(!i){this.logout();throw new Error("Grant ID is required for multi account calls")}s=await this.getAccessToken(i)}else{s=await this.getAccessToken()}delete n["Grant-ID"];n["Authorization"]=`Bearer ${s}`;if(!n["content-type"]){n["content-type"]="application/json"}return V(`${this.domain}/${e}`,{...t,headers:n})}async fetch(e,t,n=true,i){let s="";let r=1;if(this.multiAccount){if(!t.grant_id){this.logout();throw new Error("Grant ID is required for multi account calls")}const e=await this.getProfiles();r=e?e.length:1;s=await this.getAccessToken(t.grant_id)}else{s=await this.getAccessToken()}if(!s){throw new Error("Access token not found")}let o=t.headers;if(!Headers.prototype.isPrototypeOf(o)){o=new Headers({Authorization:`Bearer ${s}`,"content-type":"application/json"})}else{o.append("Authorization",`Bearer ${s}`);if(!o.has("content-type")){o.append("content-type","application/json")}}try{if(t?.body){t.body=JSON.stringify(t?.body)}const s=await fetch(`${i||this.domain}/${e}`,{...t,headers:o});if(!n){return s}const a=await(s?.json());const c=await this.isAuthenticatedResponse(s.status,a);if(!c){if(r>1){const e=await this.getProfile(t.grant_id);if(e){e.status="unauthorized";await this.Storage.setUserToken(e);const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}}else{const e=await this.Storage.getUserToken();const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}this.logout();return}return a}catch(e){throw e}}async fetchRequest(e,t,n,i=true,s,r){const o=await this.isLoggedIn();const a=new URL(e,s??this.domain);const c=new Headers;c.append("Accept","application/json");c.append("Content-Type","application/json");c.append("User-Agent","nylas-identity");if(o){const e=await this.getAccessToken();c.append("Authorization",`Bearer ${e}`)}const l=await fetch(a.toString(),{method:t||"GET",headers:c,mode:"cors",referrer:globalThis.window?.location.origin,body:n?JSON.stringify(n):undefined,...r||{}});if(!i){return l.body}const u=await l.json();return u}async isAuthenticatedResponse(e,t){if(e==401&&t?.error?.type=="token.unauthorized_access"){return false}return true}addAPIKey(e,t,n){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:true,iat:ee(),iss:"",email:t,provider:"virtual-calendar",status:"authenticated",name:t,sub:e});this.Storage.setGrant({grant_id:e,access_token:n,expires_in:2e9},this.multiAccount)}}var ce={exports:{}};var le={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -8,4 +8,4 @@ import{h as e,F as t,r as n,c as i,H as s,a as r}from"./p-0EQQA0nE.js";import{N
|
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/var ue;function de(){if(ue)return le;ue=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),d=Symbol.iterator;function h(e){if(null===e||"object"!==typeof e)return null;e=d&&e[d]||e["@@iterator"];return"function"===typeof e?e:null}var f={isMounted:function(){return false},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p=Object.assign,g={};function y(e,t,n){this.props=e;this.context=t;this.refs=g;this.updater=n||f}y.prototype.isReactComponent={};y.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function w(){}w.prototype=y.prototype;function b(e,t,n){this.props=e;this.context=t;this.refs=g;this.updater=n||f}var m=b.prototype=new w;m.constructor=b;p(m,y.prototype);m.isPureReactComponent=true;var v=Array.isArray,_=Object.prototype.hasOwnProperty,E={current:null},k={key:true,ref:true,__self:true,__source:true};function x(t,n,i){var s,r={},o=null,a=null;if(null!=n)for(s in void 0!==n.ref&&(a=n.ref),void 0!==n.key&&(o=""+n.key),n)_.call(n,s)&&!k.hasOwnProperty(s)&&(r[s]=n[s]);var c=arguments.length-2;if(1===c)r.children=i;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}if(t&&t.defaultProps)for(s in c=t.defaultProps,c)void 0===r[s]&&(r[s]=c[s]);return{$$typeof:e,type:t,key:o,ref:a,props:r,_owner:E.current}}function C(t,n){return{$$typeof:e,type:t.type,key:n,ref:t.ref,props:t.props,_owner:t._owner}}function $(t){return"object"===typeof t&&null!==t&&t.$$typeof===e}function S(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}var T=/\/+/g;function P(e,t){return"object"===typeof e&&null!==e&&null!=e.key?S(""+e.key):t.toString(36)}function R(n,i,s,r,o){var a=typeof n;if("undefined"===a||"boolean"===a)n=null;var c=false;if(null===n)c=true;else switch(a){case"string":case"number":c=true;break;case"object":switch(n.$$typeof){case e:case t:c=true}}if(c)return c=n,o=o(c),n=""===r?"."+P(c,0):r,v(o)?(s="",null!=n&&(s=n.replace(T,"$&/")+"/"),R(o,i,s,"",(function(e){return e}))):null!=o&&($(o)&&(o=C(o,s+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(T,"$&/")+"/")+n)),i.push(o)),1;c=0;r=""===r?".":r+":";if(v(n))for(var l=0;l<n.length;l++){a=n[l];var u=r+P(a,l);c+=R(a,i,s,u,o)}else if(u=h(n),"function"===typeof u)for(n=u.call(n),l=0;!(a=n.next()).done;)a=a.value,u=r+P(a,l++),c+=R(a,i,s,u,o);else if("object"===a)throw i=String(n),Error("Objects are not valid as a React child (found: "+("[object Object]"===i?"object with keys {"+Object.keys(n).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.");return c}function I(e,t,n){if(null==e)return e;var i=[],s=0;R(e,i,"","",(function(e){return t.call(n,e,s++)}));return i}function q(e){if(-1===e._status){var t=e._result;t=t();t.then((function(t){if(0===e._status||-1===e._status)e._status=1,e._result=t}),(function(t){if(0===e._status||-1===e._status)e._status=2,e._result=t}));-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var A={current:null},N={transition:null},U={ReactCurrentDispatcher:A,ReactCurrentBatchConfig:N,ReactCurrentOwner:E};le.Children={map:I,forEach:function(e,t,n){I(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;I(e,(function(){t++}));return t},toArray:function(e){return I(e,(function(e){return e}))||[]},only:function(e){if(!$(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};le.Component=y;le.Fragment=n;le.Profiler=s;le.PureComponent=b;le.StrictMode=i;le.Suspense=c;le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U;le.cloneElement=function(t,n,i){if(null===t||void 0===t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var s=p({},t.props),r=t.key,o=t.ref,a=t._owner;if(null!=n){void 0!==n.ref&&(o=n.ref,a=E.current);void 0!==n.key&&(r=""+n.key);if(t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(l in n)_.call(n,l)&&!k.hasOwnProperty(l)&&(s[l]=void 0===n[l]&&void 0!==c?c[l]:n[l])}var l=arguments.length-2;if(1===l)s.children=i;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}return{$$typeof:e,type:t.type,key:r,ref:o,props:s,_owner:a}};le.createContext=function(e){e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};e.Provider={$$typeof:r,_context:e};return e.Consumer=e};le.createElement=x;le.createFactory=function(e){var t=x.bind(null,e);t.type=e;return t};le.createRef=function(){return{current:null}};le.forwardRef=function(e){return{$$typeof:a,render:e}};le.isValidElement=$;le.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:q}};le.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}};le.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}};le.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};le.useCallback=function(e,t){return A.current.useCallback(e,t)};le.useContext=function(e){return A.current.useContext(e)};le.useDebugValue=function(){};le.useDeferredValue=function(e){return A.current.useDeferredValue(e)};le.useEffect=function(e,t){return A.current.useEffect(e,t)};le.useId=function(){return A.current.useId()};le.useImperativeHandle=function(e,t,n){return A.current.useImperativeHandle(e,t,n)};le.useInsertionEffect=function(e,t){return A.current.useInsertionEffect(e,t)};le.useLayoutEffect=function(e,t){return A.current.useLayoutEffect(e,t)};le.useMemo=function(e,t){return A.current.useMemo(e,t)};le.useReducer=function(e,t,n){return A.current.useReducer(e,t,n)};le.useRef=function(e){return A.current.useRef(e)};le.useState=function(e){return A.current.useState(e)};le.useSyncExternalStore=function(e,t,n){return A.current.useSyncExternalStore(e,t,n)};le.useTransition=function(){return A.current.useTransition()};le.version="18.2.0";return le}var he;function fe(){if(he)return ce.exports;he=1;{ce.exports=de()}return ce.exports}fe();const pe=({authenticationUrl:t})=>e("div",{class:"login-required",part:"nse__login-required login-component"},e("div",{class:"card",part:"nse__login-required-card"},e("p",{part:"nse__login-required-text"},"Log into your account to use the Scheduler Editor."),e("button",{class:"google-button",part:"nse__login-required-google-button",onClick:async e=>{e.preventDefault();const n=await t("google");if(n){window.location.href=n}else{p(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},e("span",{class:"icon"},e("google-logo-icon",{width:"15",height:"15"})),"Continue with Google"),e("button",{class:"microsoft-button",part:"nse__login-required-microsoft-button",onClick:async e=>{e.preventDefault();const n=await t("microsoft");if(n){window.location.href=n}else{p(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},e("span",{class:"icon"},e("microsoft-logo-icon",{width:"15",height:"15"})),"Continue with Microsoft"),e("button",{class:"other-provider-button",part:"nse__login-required-other-provider-button",onClick:async e=>{e.preventDefault();const n=await t();if(n){window.location.href=n}else{p(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},"View all providers ",e("chevron-icon",{width:"17",height:"17"})),e("small",{class:"disclaimer-text",part:"nse__login-required-disclaimer-text"},"* You will be redirected to authenticate your account.")));function ge({currentUser:n,calendars:i,selectedEventType:s}){const r=i?.find((e=>e.is_primary))||i?.[0];switch(s){case m.one_on_one:case m.max_availability:case m.max_fairness:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",null),e("nylas-event-duration",null),e("nylas-event-location",{userProvider:n.provider}))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:i,currentUser:n,defaultBookingCalendar:r?.id}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}case m.collective:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",null),e("nylas-event-duration",null),e("nylas-event-location",{userProvider:n.provider}))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:i,currentUser:n,defaultBookingCalendar:r?.id}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),e("nylas-additional-participants",{name:"participants",eventParticipants:[{name:n?.name||n?.email,email:n?.email||"",is_organizer:true}],exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}))}case m.group:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",{noTemplates:true}),e("nylas-event-description",{noTemplates:true,hideAutoPopulateButton:true}),e("nylas-event-location",{userProvider:n.provider}),e("nylas-event-timeslot",{name:"event-timeslot"}),e("nylas-event-capacity",null))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:i,currentUser:n,defaultBookingCalendar:r?.id}),e("nylas-additional-participants",{name:"participants",eventParticipants:[{name:n?.name||n?.email,email:n?.email||"",is_organizer:true}],exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}),e("nylas-page-name",{requirePageName:true,pageName:"Group events page"}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}}}const ye=':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 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--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-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}:host nylas-notification{position:absolute;top:0;right:0}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-content slot[name=login-required]{height:inherit}div.scheduler-editor-content--group{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content--group{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);min-width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer;color:var(--nylas-base-900)}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary);background-color:transparent}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){min-width:132px}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-select-event-type{height:inherit;width:calc(924px + 2rem)}@media screen and (max-width: 768px){nylas-select-event-type{width:auto}}nylas-editor-tabs,nylas-editor-tabs-group{width:auto;height:inherit}nylas-editor-tabs .row,nylas-editor-tabs-group .row{display:flex;gap:1rem}nylas-editor-tabs .composable,nylas-editor-tabs-group .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs],nylas-editor-tabs-group nylas-event-info div[slot=inputs],nylas-editor-tabs-group nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;color:var(--nylas-base-900);max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center;color:var(--nylas-base-900)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}@media screen and (max-width: 768px){.login-required{height:auto}}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}';const we=class{constructor(e){n(this,e);this.init=i(this,"init",7);this.loggedIn=i(this,"loggedIn",7);this.loggedOut=i(this,"loggedOut",7);this.schedulerConfigCloseClicked=i(this,"schedulerConfigCloseClicked",7);this.eventOverrides={};this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.requiresSlug=false;this.enableUserFeedback=true;this.nylasBranding=true;this.enableNotetaker=false;this.enableEventTypes={one_on_one:true,collective:true,max_fairness:true,max_availability:true,group:true};this.automaticComponentRegistration=true;this.selectedLanguage=this.defaultLanguage||v.en;this.langVersion=0;this.version=w;this.handleSchedulerConfigCloseClicked=e=>{const t=this.schedulerConfigCloseClicked.emit(this.host);if("schedulerConfigCloseClicked"in this.eventOverrides){this.eventOverrides.schedulerConfigCloseClicked(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){localStorage.removeItem("grant");localStorage.removeItem("user");window.location.reload()}};this.authenticationUrl=async e=>{if(!this.nylasApiRequest){p(`[nylas-scheduler-editor] Nylas API Request is not initialized.`);return""}const t=await this.nylasApiRequest.authenticationUrl({provider:e});return t||""}}connectedCallback(){d(`[nylas-scheduler-editor] connectedCallback`);queueMicrotask((()=>{if(this.themeConfig){this.applyThemeConfig(this.themeConfig);this.host.setAttribute("data-themed","")}}))}async componentWillLoad(){d(`[nylas-scheduler-editor] componentWillLoad`);const e=this.additionalParticipants?.filter((e=>{const t=e.calendars?.length>0?e.calendars.filter((e=>e.id&&e.name)):[];if(e.name&&e.email&&t.length>0){return{name:e.name,email:e.email,calendars:t}}}));this.stores={schedulerConfig:x({...this.defaultSchedulerConfigState,additionalParticipants:e,conferenceProviders:this.conferenceProviders,requiresSlug:this.requiresSlug,selectedLanguage:this.defaultLanguage||v.en,nylasBranding:this.nylasBranding,experimentalFeatures:this.experimentalFeatures,enableEventTypes:this.enableEventTypes,themeConfig:this.themeConfig})};if(!this.nylasApiRequest&&this.nylasSessionsConfig){const e=new ae(this.nylasSessionsConfig);await e.isLoggedIn();e.onLoginSuccess((async()=>{const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){const t=this.loggedIn.emit(this.host);if("loggedIn"in this.eventOverrides){await this.eventOverrides.loggedIn(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){await this.loggedInHandler(e)}}}));e.onLoginFail((async()=>{this.stores?.schedulerConfig?.set("currentUser",null);const e=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides){await this.eventOverrides.loggedOut(e,this.nylasSchedulerConfigConnector);if(e.defaultPrevented){return}}}));this.nylasApiRequest=new a(e)}if(this.nylasApiRequest&&this.defaultAuthArgs){this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs)}this.baseProvider=new o(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new k({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const n=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(n,this.nylasSchedulerConfigConnector)}if(!n.defaultPrevented){const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){const t=this.loggedIn.emit(this.host);if("loggedIn"in this.eventOverrides){await this.eventOverrides.loggedIn(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){await this.loggedInHandler(e)}}else{this.stores?.schedulerConfig?.set("currentUser",null);const e=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides){await this.eventOverrides.loggedOut(e,this.nylasSchedulerConfigConnector);if(e.defaultPrevented){return}}}}this.stores?.schedulerConfig?.onChange("selectedConfiguration",(async e=>{if(e&&e.id){this.configurationId=e.id}}));this.baseProvider?.componentWillLoad(this.nylasSchedulerConfigConnector);this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){d(`[nylas-scheduler-editor] componentDidLoad`);await(this.baseProvider?.componentDidLoad());this.updateLocalization(this.localization);this.version=w}async componentDisconnected(){await(this.baseProvider?.componentDisconnected())}async configurationIdChanged(e){if(e){await(this.nylasSchedulerConfigConnector?.schedulerConfig?.getConfigurationById(e));this.stores?.schedulerConfig?.set("action","edit")}else{this.stores?.schedulerConfig?.set("selectedConfiguration",{});this.stores?.schedulerConfig?.set("action",null)}}updateLocalization(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in v)){return}g.addResourceBundle(t,"translation",e[t],false,true)}));this.langVersion++}updateNylasBranding(e){this.stores?.schedulerConfig?.set("nylasBranding",e)}updateExperimentalFeatures(e){this.stores?.schedulerConfig?.set("experimentalFeatures",e)}updateEnableEventTypes(e){this.stores?.schedulerConfig?.set("enableEventTypes",e)}themeConfigChanged(e){this.baseProvider?.getStore("schedulerConfig")?.set("themeConfig",e);this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}async store(){return this.stores?.schedulerConfig}async schedulerConnector(){return this.nylasSchedulerConfigConnector}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){this.selectedLanguage=v[n];g.changeLanguage(this.selectedLanguage);this.stores?.schedulerConfig?.set("selectedLanguage",this.selectedLanguage)}}async loggedInHandler(e){this.stores?.schedulerConfig?.set("currentUser",e);if(!this.nylasSchedulerConfigConnector){return}await(this.nylasSchedulerConfigConnector.schedulerConfig?.getCalendars());if(this.configurationId){const e=await(this.nylasSchedulerConfigConnector.schedulerConfig?.getConfigurationById(this.configurationId));if(e&&e[0]?.id){this.stores?.schedulerConfig?.set("action","edit")}}}render(){const t=this.host.querySelector('[slot="custom-page-style-inputs"]');const n=this.stores?.schedulerConfig?.state.selectedConfiguration?.id;const i=Object.keys(_).map((e=>({label:_[e],value:e})));const r=this.stores?.schedulerConfig?.state.selectedEventType===m.group||this.stores?.schedulerConfig?.state.selectedConfiguration?.type===m.group;d(`[nylas-scheduler-editor] render mode: ${this.mode}`);return e(s,{key:"e37a7571ffe7059afb5e93f1cca2c024921af54b"},e("div",{key:"db5aeb93fe047834ca08c081e8b60d795a2c8f58",class:"scheduler-editor-header",part:"nse__header"},e("h1",{key:"791b19e3332afe4c9115fcab4bf015075b75fc15",class:"scheduler-editor-title",part:"nse__title"},e("calendar-icon",{key:"c3d2d9a0425636707e11bd0292404454b19d4044",width:"18",height:"18"}),g.t("schedulerEditorTitle"),e("tooltip-component",{key:"32d9bfdd5bd963beaee18ed0c48d148601cad216"},e("info-icon",{key:"0a0a30a5338c8f921012c9b8ac88a2189d5a36d6",slot:"tooltip-icon"}),e("span",{key:"1911350bbae0f9f0882ccb345c71781574d6c712",slot:"tooltip-content"},this.version))),e("div",{key:"58f5c778f07a8ff850fb07d2710b94e3a774ae32",class:{language:true},part:"nse__language"},e("select-dropdown",{key:"dbdab8e8f804aed103cf35729d9b658b17ebf3b2",name:"language",searchPlaceholder:g.t("search"),options:i,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:i.find((e=>e.value==this.selectedLanguage)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{key:"3fb225a7f41b29ef9cce3b358a5aa608066979af",slot:"select-icon"},e("translate-icon",{key:"f7b625277108767d6522180f4107cc1d7399c0e6",width:"20",height:"20"})))),e("button",{key:"376cbc21a8821ac38eb73043dbf9ae8474158371",class:"scheduler-editor-close",title:"logout",onClick:e=>this.handleSchedulerConfigCloseClicked(e),part:"nse__close-button"},e("close-icon",{key:"637eb1d8e03cd45172c7c113800cce0c7cf70cf3",width:"18",height:"18"}))),e("div",{key:"83239494ea1d4efcdb246abd4e9fb14672f78708",class:{"scheduler-editor-content":true,"scheduler-editor-content--group":r},part:"nse__content"},this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action===null&&e("div",{key:"643485cb3f09c40519259e9b0e4064484854edec",class:"list-configurations",part:"nse__list-configurations"},e("nylas-list-configurations",{key:"e0ad49a6e3c61faf5daefcf0a5dc0025056f7d0c",themeConfig:this.themeConfig,exportparts:"nlc__create-new-cta, actions__dropdown, actions__dropdown-button, actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete"})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create-select"&&e("nylas-select-event-type",{key:"f28c8ed3d230491b1e0046df33574034bcd857b9",themeConfig:this.themeConfig}),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&r&&e("nylas-editor-tabs-group",{key:"fcf0896b06e51d28ccd1dba4fbffae98725d3f24",mode:"composable",themeConfig:this.themeConfig},e(ge,{key:"df9c1a25f521d373a80de410066beff0911cffe3",selectedEventType:this.stores?.schedulerConfig?.state?.selectedEventType||m.one_on_one,currentUser:this.stores?.schedulerConfig?.state.currentUser,calendars:this.stores?.schedulerConfig?.state?.calendars,selectedConfiguration:this.stores?.schedulerConfig?.state?.selectedConfiguration})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&!r&&e("nylas-editor-tabs",{key:"a9ec4ff97b427a4362b014a478aaf28e7d04b69e",mode:"composable",enableNotetaker:this.enableNotetaker,themeConfig:this.themeConfig},e(ge,{key:"404caffc73cc2ebd5dda111f80fd0648224a372f",selectedEventType:this.stores?.schedulerConfig?.state?.selectedEventType||m.one_on_one,currentUser:this.stores?.schedulerConfig?.state.currentUser,calendars:this.stores?.schedulerConfig?.state?.calendars,selectedConfiguration:this.stores?.schedulerConfig?.state?.selectedConfiguration})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&r&&e("nylas-editor-tabs-group",{key:n,mode:this.mode,themeConfig:this.themeConfig},this.mode==="composable"&&e("slot",{key:"05baa8d7dbe663e237ae2579a12a4ac4bd466626"}),this.mode==="app"&&t&&e("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:n},e("slot",{key:"1235b21d00db6d268f4f5767b4de288ecc891094",name:"custom-page-style-inputs"}))),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&!r&&e("nylas-editor-tabs",{key:n,mode:this.mode,enableNotetaker:this.enableNotetaker,themeConfig:this.themeConfig},this.mode==="composable"&&e("slot",{key:"f58a18cb12fb723ef52199a5566d4cae06810c5e"}),this.mode==="app"&&t&&e("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:n},e("slot",{key:"2e19ad87225bcbae1dc70079e8511a35607fe60d",name:"custom-page-style-inputs"}))),!this.stores?.schedulerConfig?.state.currentUser&&e("slot",{key:"c7f1283c363e365f7570dd5c84ec8abc3c974b48",name:"login-required"},e(pe,{key:"f16d4489fc8fbf9d452e117e85bc88ec3ecce321",authenticationUrl:this.authenticationUrl}))))}get host(){return r(this)}static get watchers(){return{configurationId:["configurationIdChanged"],localization:["updateLocalization"],nylasBranding:["updateNylasBranding"],experimentalFeatures:["updateExperimentalFeatures"],enableEventTypes:["updateEnableEventTypes"],themeConfig:["themeConfigChanged"]}}};we.style=ye;export{we as nylas_scheduler_editor};
|
|
11
|
-
//# sourceMappingURL=p-
|
|
11
|
+
//# sourceMappingURL=p-b90acc64.entry.js.map
|