@nylas/react 1.1.0-canary.17 → 1.1.0-canary.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-circle-icon_2.entry-3091976b.cjs +1 -0
- package/dist/add-circle-icon_2.entry-3b13ee64.js +25 -0
- package/dist/{archive-icon_7.entry-60e900b6.js → archive-icon_7.entry-8932618a.js} +14 -14
- package/dist/{archive-icon_7.entry-8c8317e9.cjs → archive-icon_7.entry-c2b6d860.cjs} +1 -1
- package/dist/{arrow-icon.entry-057db95a.js → arrow-icon.entry-1f54c377.js} +4 -4
- package/dist/{arrow-icon.entry-2d4e9572.cjs → arrow-icon.entry-a159bee8.cjs} +1 -1
- package/dist/{bold-icon_3.entry-557c6007.js → bold-icon_3.entry-447d0537.js} +6 -6
- package/dist/{bold-icon_3.entry-ba732761.cjs → bold-icon_3.entry-c51e1af3.cjs} +1 -1
- package/dist/{button-component.entry-22d0ac2e.js → button-component.entry-52ccb6d9.js} +2 -2
- package/dist/{button-component.entry-385f9581.cjs → button-component.entry-e79b2d08.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-b2657caf.cjs → calendar-cancel-icon.entry-805febcc.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-820cf967.js → calendar-cancel-icon.entry-a78f27bc.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-b13e7cbb.cjs → calendar-check-icon_2.entry-4a0fd7bd.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-128a5d67.js → calendar-check-icon_2.entry-7c8b6c92.js} +9 -9
- package/dist/{calendar-icon.entry-d17d7cfb.cjs → calendar-icon.entry-1fc018b4.cjs} +1 -1
- package/dist/{calendar-icon.entry-a43e6011.js → calendar-icon.entry-96f9727f.js} +2 -2
- package/dist/{calendar-info-icon_28.entry-b4f09bfe.cjs → calendar-info-icon_28.entry-2054703c.cjs} +1 -1
- package/dist/{calendar-info-icon_28.entry-b71c23c5.js → calendar-info-icon_28.entry-e7bebd13.js} +34 -34
- package/dist/{chevron-icon_3.entry-e0796c69.js → chevron-icon_3.entry-25d90239.js} +6 -6
- package/dist/chevron-icon_3.entry-7bd4a4b5.cjs +1 -0
- package/dist/{clock-icon_2.entry-267614c2.cjs → clock-icon_2.entry-2406c3d0.cjs} +1 -1
- package/dist/{clock-icon_2.entry-e959ae50.js → clock-icon_2.entry-c1b22ed4.js} +9 -9
- package/dist/{constants-f34b9c6e-ebc2e19c.cjs → constants-f34b9c6e-b774916c.cjs} +1 -1
- package/dist/{constants-f34b9c6e-efe2836b.js → constants-f34b9c6e-f1c4dd0d.js} +1 -1
- package/dist/document-refresh-icon.entry-570f9c9d.js +15 -0
- package/dist/document-refresh-icon.entry-a0293858.cjs +1 -0
- package/dist/{elements-dc5b338e-a33785e3.cjs → elements-dc5b338e-550a6cb1.cjs} +1 -1
- package/dist/{elements-dc5b338e-b0a290ae.js → elements-dc5b338e-cafa7a55.js} +1 -1
- package/dist/{focus-visible-e8093c16-5f1ae916.js → focus-visible-e8093c16-022799ce.js} +1 -1
- package/dist/{focus-visible-e8093c16-d2afb13d.cjs → focus-visible-e8093c16-c14162e8.cjs} +1 -1
- package/dist/{forward-icon_6.entry-0009e4f0.cjs → forward-icon_6.entry-55752b23.cjs} +3 -3
- package/dist/{forward-icon_6.entry-53683e82.js → forward-icon_6.entry-9b832146.js} +9 -9
- package/dist/{globe-icon.entry-dbb47687.js → globe-icon.entry-2b61820e.js} +2 -2
- package/dist/{globe-icon.entry-df67eab8.cjs → globe-icon.entry-dabe7b8b.cjs} +1 -1
- package/dist/google-logo-icon_4.entry-60c0d39a.cjs +1 -0
- package/dist/{google-logo-icon_4.entry-77f3b86e.js → google-logo-icon_4.entry-a0dc33da.js} +127 -114
- package/dist/index-53420959-67beefed.js +5 -0
- package/dist/index-53420959-d3254a34.cjs +1 -0
- package/dist/{index-6d9eeb53-ded66877.cjs → index-6d9eeb53-3049fc04.cjs} +1 -1
- package/dist/{index-6d9eeb53-2f37342f.js → index-6d9eeb53-3edef246.js} +2 -2
- package/dist/{index-5851f0a2.js → index-812162da.js} +42 -42
- package/dist/{index-769f0fdd.cjs → index-e3e9b594.cjs} +2 -2
- package/dist/{index.es-9cc0eb3c-e8de46e6.cjs → index.es-9cc0eb3c-0c99c055.cjs} +1 -1
- package/dist/{index.es-9cc0eb3c-2cf4632f.js → index.es-9cc0eb3c-52226859.js} +1 -1
- package/dist/{info-icon_2.entry-c27ac645.js → info-icon_2.entry-2fe6c16c.js} +8 -8
- package/dist/{info-icon_2.entry-e355fb7d.cjs → info-icon_2.entry-5f6b9af8.cjs} +1 -1
- package/dist/{input-component.entry-a38a65da.js → input-component.entry-1195d579.js} +6 -6
- package/dist/{input-component.entry-ef2b397d.cjs → input-component.entry-2b6e44c4.cjs} +1 -1
- package/dist/{input-dropdown_2.entry-ce1da1b3.js → input-dropdown_2.entry-dbd0d6f4.js} +3 -3
- package/dist/{input-dropdown_2.entry-9e50060e.cjs → input-dropdown_2.entry-dbdb5aa3.cjs} +1 -1
- package/dist/loading-icon.entry-027a2ad1.js +15 -0
- package/dist/loading-icon.entry-e179f122.cjs +1 -0
- package/dist/{mailbox-store-64b4ef7c-ebe84c96.cjs → mailbox-store-64b4ef7c-0eac526c.cjs} +1 -1
- package/dist/{mailbox-store-64b4ef7c-47dac9aa.js → mailbox-store-64b4ef7c-22a6c565.js} +2 -2
- package/dist/nylas-booked-event-card_10.entry-84f64ba5.cjs +1 -0
- package/dist/{nylas-booked-event-card_10.entry-ef9c2d62.js → nylas-booked-event-card_10.entry-e0990f5b.js} +170 -170
- package/dist/{nylas-custom-booking-flow.entry-c59c1306.cjs → nylas-custom-booking-flow.entry-898c8cc9.cjs} +1 -1
- package/dist/{nylas-custom-booking-flow.entry-f31400e2.js → nylas-custom-booking-flow.entry-bc64af5f.js} +3 -3
- package/dist/{nylas-form-card.entry-bc048703.cjs → nylas-form-card.entry-0c71f4fc.cjs} +1 -1
- package/dist/{nylas-form-card.entry-b189e066.js → nylas-form-card.entry-c564b52e.js} +14 -14
- package/dist/{nylas-if-state.entry-5bdf8669.js → nylas-if-state.entry-e9486e12.js} +3 -3
- package/dist/{nylas-if-state.entry-933c79e0.cjs → nylas-if-state.entry-ff6a2046.cjs} +1 -1
- package/dist/{nylas-list-folders.entry-f0e7ae4e.js → nylas-list-folders.entry-0258af1e.js} +7 -7
- package/dist/{nylas-list-folders.entry-5d1bef7f.cjs → nylas-list-folders.entry-90716d2b.cjs} +1 -1
- package/dist/{nylas-list-threads.entry-3f7451ad.js → nylas-list-threads.entry-1abcdd30.js} +3 -3
- package/dist/{nylas-list-threads.entry-3e300e7e.cjs → nylas-list-threads.entry-21edf012.cjs} +1 -1
- package/dist/{nylas-login.entry-dbf9e11f.cjs → nylas-login.entry-2e0ce95e.cjs} +1 -1
- package/dist/{nylas-login.entry-e3b757a0.js → nylas-login.entry-ba7383ac.js} +7 -7
- package/dist/{nylas-mailbox-pagination.entry-0db12a01.cjs → nylas-mailbox-pagination.entry-ba6beb08.cjs} +1 -1
- package/dist/{nylas-mailbox-pagination.entry-6c845a2a.js → nylas-mailbox-pagination.entry-f6186560.js} +2 -2
- package/dist/{nylas-mailbox-toolbar-button.entry-553f041a.cjs → nylas-mailbox-toolbar-button.entry-0875aadb.cjs} +1 -1
- package/dist/{nylas-mailbox-toolbar-button.entry-ec196947.js → nylas-mailbox-toolbar-button.entry-e18059b0.js} +10 -10
- package/dist/{nylas-mailbox.entry-1552ad11.js → nylas-mailbox.entry-2e3815ed.js} +7 -7
- package/dist/{nylas-mailbox.entry-c0bbca56.cjs → nylas-mailbox.entry-bb2905bf.cjs} +1 -1
- package/dist/{nylas-provider.entry-d4bf23c2.cjs → nylas-provider.entry-51c5cdbf.cjs} +1 -1
- package/dist/{nylas-provider.entry-6d286e92.js → nylas-provider.entry-69ee5061.js} +37 -37
- package/dist/{nylas-scheduler-editor.entry-00a71304.cjs → nylas-scheduler-editor.entry-923b8566.cjs} +2 -2
- package/dist/{nylas-scheduler-editor.entry-caa1026b.js → nylas-scheduler-editor.entry-d4a9afb1.js} +5 -5
- package/dist/{nylas-scheduling.entry-f1fb67d2.cjs → nylas-scheduling.entry-54f1a5e9.cjs} +1 -1
- package/dist/{nylas-scheduling.entry-19ff3d50.js → nylas-scheduling.entry-f82a2822.js} +3 -3
- package/dist/{nylas-threads-refresh.entry-6acf3c2b.js → nylas-threads-refresh.entry-72482d2f.js} +10 -10
- package/dist/{nylas-threads-refresh.entry-bc4c10ea.cjs → nylas-threads-refresh.entry-99001756.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-ee28712c.cjs → nylas-threads-search.entry-462527fd.cjs} +1 -1
- package/dist/{nylas-threads-search.entry-82fa1504.js → nylas-threads-search.entry-c5fe50e5.js} +16 -16
- package/dist/{nylas-time-window-picker.entry-3c45d82e.js → nylas-time-window-picker.entry-0d93e7cc.js} +2 -2
- package/dist/{nylas-time-window-picker.entry-131f84b4.cjs → nylas-time-window-picker.entry-ccffcf2b.cjs} +1 -1
- package/dist/{nylas-view-thread.entry-695a7b0b.js → nylas-view-thread.entry-2d34b41c.js} +3 -3
- package/dist/{nylas-view-thread.entry-0d9a4aa9.cjs → nylas-view-thread.entry-58432a52.cjs} +1 -1
- package/dist/play-icon_2.entry-1ea3fd6b.cjs +1 -0
- package/dist/{play-icon_2.entry-ab47588e.js → play-icon_2.entry-d08adf17.js} +7 -7
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{refresh-icon.entry-28e3ade7.cjs → refresh-icon.entry-1e670732.cjs} +1 -1
- package/dist/{refresh-icon.entry-43267155.js → refresh-icon.entry-a041136d.js} +4 -4
- package/dist/{register-component-a5a9ca5d-538c35c3.js → register-component-a5a9ca5d-a5c01c35.js} +1 -1
- package/dist/{register-component-a5a9ca5d-8b06415c.cjs → register-component-a5a9ca5d-b68b6039.cjs} +1 -1
- package/dist/{scheduler-config-store-4a50a03d-40e87f35.cjs → scheduler-config-store-4a50a03d-884e6df8.cjs} +1 -1
- package/dist/{scheduler-config-store-4a50a03d-4a2e2abf.js → scheduler-config-store-4a50a03d-ee42ff96.js} +1 -1
- package/dist/{scheduler-store-f02ce045-121c1e09.js → scheduler-store-f02ce045-23a14e3f.js} +1 -1
- package/dist/{scheduler-store-f02ce045-f11cfad9.cjs → scheduler-store-f02ce045-42e3647c.cjs} +1 -1
- package/dist/{textarea-component.entry-1ec19adb.js → textarea-component.entry-1b4c771b.js} +4 -4
- package/dist/{textarea-component.entry-402a369b.cjs → textarea-component.entry-24a830c1.cjs} +1 -1
- package/dist/{translate-icon.entry-59f4e190.cjs → translate-icon.entry-0c0add25.cjs} +1 -1
- package/dist/{translate-icon.entry-d412697e.js → translate-icon.entry-44bde57b.js} +6 -6
- package/dist/{warning-icon.entry-3ee1f451.js → warning-icon.entry-8956cba2.js} +4 -4
- package/dist/{warning-icon.entry-aa6b2c2c.cjs → warning-icon.entry-9a77ab01.cjs} +1 -1
- package/package.json +2 -2
- package/dist/add-circle-icon_2.entry-936fd73b.cjs +0 -1
- package/dist/add-circle-icon_2.entry-ce6aaa1d.js +0 -25
- package/dist/chevron-icon_3.entry-4807a0b1.cjs +0 -1
- package/dist/document-refresh-icon.entry-b4c217df.js +0 -15
- package/dist/document-refresh-icon.entry-b8850675.cjs +0 -1
- package/dist/google-logo-icon_4.entry-c5db1be3.cjs +0 -1
- package/dist/index-53420959-16700a42.cjs +0 -1
- package/dist/index-53420959-f0c4f9af.js +0 -5
- package/dist/loading-icon.entry-175aca19.cjs +0 -1
- package/dist/loading-icon.entry-4ab88ed8.js +0 -15
- package/dist/nylas-booked-event-card_10.entry-6de99d57.cjs +0 -1
- package/dist/play-icon_2.entry-b1167d3a.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const T=require("./index-769f0fdd.cjs");class nr{constructor(e,n,r=!0,s){this.automaticComponentRegistration=!0,this.registeredComponents={},this.propStateRegistrations=new Map,this.eventListenerRegistrations=new Map,this.host=e,this.stores=n,this.automaticComponentRegistration=r,this.eventOverrides=s,T.debug(`[${this.hostTagName}] Initializing (abstract) provider.`,{eventOverrides:s}),this.registerComponent=this.registerComponent.bind(this),this.getStore=this.getStore.bind(this),Object.keys(this.stores).forEach(i=>{this.propStateRegistrations.set(i,new Map)})}async componentWillLoad(e){T.debug(`[${this.hostTagName}] Will load`),this.setupStoreListeners(),this.nylasConnector=e;const n=Array.from(this.host.querySelectorAll("*")).filter(r=>r.tagName.toLowerCase().startsWith("nylas-"));T.debug(`[${this.hostTagName}] Found ${n.length} child component(s).`,{childComponents:n}),n.forEach(r=>{const s=r;if(!s){T.debug(`[~${this.hostTagName}] Component ${s.tagName} does not have a name. Skipping.`);return}if(!s.registerNylasComponent){T.debug(`[~${this.hostTagName}] Component ${s.tagName} is not a component that can be registered. Skipping.`,{component:s});return}const i={element:s,name:s.tagName.toLowerCase(),getStoresToProp:s.getStoresToProp,storeToProps:s.storeToProps,stateToProps:s.stateToProps,authToProp:s.authToProp,eventToProps:s.eventToProps,connectorToProp:s.connectorToProp,localPropsToProp:s.localPropsToProp};this.registerComponent(i)})}async componentDidLoad(){T.debug(`[${this.hostTagName}] Did load`)}async componentDisconnected(){Object.values(this.stores).forEach(e=>{e.dispose()})}async registerComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping registration of ${e.detail.name}.`);return}this.registerComponent(e.detail)}async unregisterComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping unregistration of ${e.detail.name}.`);return}this.unregisterComponent(e.detail)}registerComponent(e){T.debug(`[${this.hostTagName}] Registering component ${e.name}.`);const n=e.element.dataset.nylasId;if(n&&this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} already registered. Skipping.`);return}const{stateToProps:r,getStoresToProp:s,eventToProps:i,storeToProps:o,connectorToProp:u,localPropsToProp:a,element:c}=e;c.dataset.nylasId=T.uniqueID(),this.registeredComponents[c.dataset.nylasId]=e;const d=this.eventOverrides;i==null||i.forEach((l,h)=>{var y;const f=this.nylasConnector,m=async g=>{T.debug(`[${this.hostTagName}] Handling "${e.name}" prop "${String(h)}" event.`,{event:g}),h in d&&(T.debug(`[${this.hostTagName}] Found event override for "${String(h)}" event. Calling override.`),await d[h](g,f)),g.defaultPrevented||await l(g,f)},p=e.element.dataset.nylasId;p&&!this.eventListenerRegistrations.has(p)&&this.eventListenerRegistrations.set(p,[]),p&&((y=this.eventListenerRegistrations.get(p))==null||y.push([c,h,m])),T.debug(`[${this.hostTagName}] Setting "${e.name}" event "${String(h)}" to automcially call NylasConnector method.`);const v=T.formatEventName(h.toString());T.debug(`[${this.hostTagName}] Adding event listener for "${v}" on "${c.tagName}"`),c.addEventListener(v,m)}),r==null||r.forEach((l,h)=>{var y,g,b,k;const[f,m]=h.split("."),v=this.getStore(f).state[m];if(!c.dataset.nylasId){T.debug(`[${this.hostTagName}] Component "${e.name}" not registered. Skipping.`,{component:e});return}this.propStateRegistrations.has(f)||this.propStateRegistrations.set(f,new Map),(y=this.propStateRegistrations.get(f))!=null&&y.has(m)?(k=(b=this.propStateRegistrations.get(f))==null?void 0:b.get(m))==null||k.push({elementId:c.dataset.nylasId,propKey:l}):(g=this.propStateRegistrations.get(f))==null||g.set(m,[{elementId:c.dataset.nylasId,propKey:l}]),c[l.toString()]=v,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" value.`,{stateValue:v})}),a==null||a.forEach((l,h)=>{const f=this.host[h];c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to the value of "${h}" value.`,{value:h,mappedPropValue:f})}),s&&(c[s==null?void 0:s.toString()]=this.getStore,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${s.toString()}" to "getStore" method.`)),o==null||o.forEach((l,h)=>{const f=this.getStore(h);c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" store.`,{store:f})}),u&&(c[u==null?void 0:u.toString()]=this.nylasConnector,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "nylasConnector" value.`,{connectorToProp:u})),T.debug(`[${this.hostTagName}] Component ${e.name} registered.`)}unregisterComponent(e){T.debug(`[${this.hostTagName}] Unregistering component ${e.name}.`);const n=e.element.dataset.nylasId;if(!n){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}if(this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}this.propStateRegistrations.forEach((s,i)=>{s.forEach((o,u)=>{var d,l;const a=(d=this.propStateRegistrations.get(i))==null?void 0:d.get(u),c=a==null?void 0:a.filter(h=>h.elementId!==n);c&&((l=this.propStateRegistrations.get(i))==null||l.set(u,c))})});const r=this.eventListenerRegistrations.get(n);r==null||r.forEach(([s,i,o])=>{const u=T.formatEventName(i.toString());T.debug(`[${this.hostTagName}] Removing event listener for "${u}" on "${s.tagName}"`),s.removeEventListener(u,o)}),delete this.registeredComponents[n]}getStore(e){const n=this.stores[e];if(!n)throw new Error(`[${this.hostTagName}] Store "${e.toString()}" not found.`);return n}async setupStoreListeners(){const e=this;Object.entries(this.stores).forEach(([n,r])=>{T.debug(`[${e.hostTagName}] Listening for changes in "${n}" store.`),r.use({set(s,i,o){var c;if(T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" changed`,{newValue:i,oldValue:o}),i===o){T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" unchanged. Skipping.`);return}const u=e.registeredComponents;if(!u){T.debug(`[${e.hostTagName}] No registered components found. Skipping.`);return}const a=((c=e.propStateRegistrations.get(n))==null?void 0:c.get(s.toString()))||[];T.debug(`[${e.hostTagName}] Found ${a.length} prop(s) registered for "${s.toString()}" store.`,{props:a,propStateRegistrations:e.propStateRegistrations}),a.forEach(({elementId:d,propKey:l})=>{const h=u[d];if(!h){T.debug(`[${e.hostTagName}] Component "${d}" not found. Skipping.`,{component:h});return}const m=e.getStore(n).state[s];h.element[l.toString()]=m,T.debug(`[${e.hostTagName}] Setting "${h.name}" prop "${l.toString()}" to "${s.toString()}" value.`,{stateValue:m})})}})})}get hostTagName(){var e,n;return((n=(e=this.host)==null?void 0:e.tagName)==null?void 0:n.toLowerCase())??"nylas-provider"}}class rr extends nr{}var sr=Object.defineProperty,ir=(t,e,n)=>e in t?sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ut=(t,e,n)=>(ir(t,typeof e!="symbol"?e+"":e,n),n),Sn=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(Sn||{});const or=t=>t!==null&&typeof t=="object"&&"error"in t;class ar extends Error{constructor(e){super(e==null?void 0:e.message),ut(this,"apiError"),this.name="NylasAPIError",this.stack=new Error().stack,this.apiError=e}}async function hn(t){const e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e),r=Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:T.global$1,$=Object.keys,M=Array.isArray;function U(t,e){return typeof e!="object"||$(e).forEach(function(n){t[n]=e[n]}),t}typeof Promise>"u"||K.Promise||(K.Promise=Promise);const Be=Object.getPrototypeOf,ur={}.hasOwnProperty;function z(t,e){return ur.call(t,e)}function Pe(t,e){typeof e=="function"&&(e=e(Be(t))),(typeof Reflect>"u"?$:Reflect.ownKeys)(e).forEach(n=>{ee(t,n,e[n])})}const Pn=Object.defineProperty;function ee(t,e,n,r){Pn(t,e,U(n&&z(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function ke(t){return{from:function(e){return t.prototype=Object.create(e.prototype),ee(t.prototype,"constructor",t),{extend:Pe.bind(null,t.prototype)}}}}const lr=Object.getOwnPropertyDescriptor;function Jt(t,e){let n;return lr(t,e)||(n=Be(t))&&Jt(n,e)}const cr=[].slice;function lt(t,e,n){return cr.call(t,e,n)}function En(t,e){return e(t)}function Ie(t){if(!t)throw new Error("Assertion Failed")}function Cn(t){K.setImmediate?setImmediate(t):setTimeout(t,0)}function Tn(t,e){return t.reduce((n,r,s)=>{var i=e(r,s);return i&&(n[i[0]]=i[1]),n},{})}function te(t,e){if(z(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,s=e.length;r<s;++r){var i=te(t,e[r]);n.push(i)}return n}var o=e.indexOf(".");if(o!==-1){var u=t[e.substr(0,o)];return u===void 0?void 0:te(u,e.substr(o+1))}}function H(t,e,n){if(t&&e!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Ie(typeof n!="string"&&"length"in n);for(var r=0,s=e.length;r<s;++r)H(t,e[r],n[r])}else{var i=e.indexOf(".");if(i!==-1){var o=e.substr(0,i),u=e.substr(i+1);if(u==="")n===void 0?M(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=n;else{var a=t[o];a&&z(t,o)||(a=t[o]={}),H(a,u,n)}}else n===void 0?M(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=n}}function An(t){var e={};for(var n in t)z(t,n)&&(e[n]=t[n]);return e}const hr=[].concat;function On(t){return hr.apply([],t)}const In="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(On([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>K[t]),dr=In.map(t=>K[t]);Tn(In,t=>[t,!0]);let se=null;function We(t){se=typeof WeakMap<"u"&&new WeakMap;const e=Ct(t);return se=null,e}function Ct(t){if(!t||typeof t!="object")return t;let e=se&&se.get(t);if(e)return e;if(M(t)){e=[],se&&se.set(t,e);for(var n=0,r=t.length;n<r;++n)e.push(Ct(t[n]))}else if(dr.indexOf(t.constructor)>=0)e=t;else{const i=Be(t);for(var s in e=i===Object.prototype?{}:Object.create(i),se&&se.set(t,e),t)z(t,s)&&(e[s]=Ct(t[s]))}return e}const{toString:fr}={};function Tt(t){return fr.call(t).slice(8,-1)}const At=typeof Symbol<"u"?Symbol.iterator:"@@iterator",pr=typeof At=="symbol"?function(t){var e;return t!=null&&(e=t[At])&&e.apply(t)}:function(){return null},_e={};function J(t){var e,n,r,s;if(arguments.length===1){if(M(t))return t.slice();if(this===_e&&typeof t=="string")return[t];if(s=pr(t)){for(n=[];!(r=s.next()).done;)n.push(r.value);return n}if(t==null)return[t];if(typeof(e=t.length)=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}const Zt=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var G=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Kn(t,e){G=t,jn=e}var jn=()=>!0;const mr=!new Error("").stack;function Ee(){if(mr)try{throw new Error}catch(t){return t}return new Error}function Ot(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(`
|
|
1
|
+
"use strict";const T=require("./index-e3e9b594.cjs");class nr{constructor(e,n,r=!0,s){this.automaticComponentRegistration=!0,this.registeredComponents={},this.propStateRegistrations=new Map,this.eventListenerRegistrations=new Map,this.host=e,this.stores=n,this.automaticComponentRegistration=r,this.eventOverrides=s,T.debug(`[${this.hostTagName}] Initializing (abstract) provider.`,{eventOverrides:s}),this.registerComponent=this.registerComponent.bind(this),this.getStore=this.getStore.bind(this),Object.keys(this.stores).forEach(i=>{this.propStateRegistrations.set(i,new Map)})}async componentWillLoad(e){T.debug(`[${this.hostTagName}] Will load`),this.setupStoreListeners(),this.nylasConnector=e;const n=Array.from(this.host.querySelectorAll("*")).filter(r=>r.tagName.toLowerCase().startsWith("nylas-"));T.debug(`[${this.hostTagName}] Found ${n.length} child component(s).`,{childComponents:n}),n.forEach(r=>{const s=r;if(!s){T.debug(`[~${this.hostTagName}] Component ${s.tagName} does not have a name. Skipping.`);return}if(!s.registerNylasComponent){T.debug(`[~${this.hostTagName}] Component ${s.tagName} is not a component that can be registered. Skipping.`,{component:s});return}const i={element:s,name:s.tagName.toLowerCase(),getStoresToProp:s.getStoresToProp,storeToProps:s.storeToProps,stateToProps:s.stateToProps,authToProp:s.authToProp,eventToProps:s.eventToProps,connectorToProp:s.connectorToProp,localPropsToProp:s.localPropsToProp};this.registerComponent(i)})}async componentDidLoad(){T.debug(`[${this.hostTagName}] Did load`)}async componentDisconnected(){Object.values(this.stores).forEach(e=>{e.dispose()})}async registerComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping registration of ${e.detail.name}.`);return}this.registerComponent(e.detail)}async unregisterComponentHandler(e){if(e.stopPropagation(),!this.automaticComponentRegistration){T.debug(`[${this.hostTagName}] Automatic component registration disabled. Skipping unregistration of ${e.detail.name}.`);return}this.unregisterComponent(e.detail)}registerComponent(e){T.debug(`[${this.hostTagName}] Registering component ${e.name}.`);const n=e.element.dataset.nylasId;if(n&&this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} already registered. Skipping.`);return}const{stateToProps:r,getStoresToProp:s,eventToProps:i,storeToProps:o,connectorToProp:u,localPropsToProp:a,element:c}=e;c.dataset.nylasId=T.uniqueID(),this.registeredComponents[c.dataset.nylasId]=e;const d=this.eventOverrides;i==null||i.forEach((l,h)=>{var y;const f=this.nylasConnector,m=async g=>{T.debug(`[${this.hostTagName}] Handling "${e.name}" prop "${String(h)}" event.`,{event:g}),h in d&&(T.debug(`[${this.hostTagName}] Found event override for "${String(h)}" event. Calling override.`),await d[h](g,f)),g.defaultPrevented||await l(g,f)},p=e.element.dataset.nylasId;p&&!this.eventListenerRegistrations.has(p)&&this.eventListenerRegistrations.set(p,[]),p&&((y=this.eventListenerRegistrations.get(p))==null||y.push([c,h,m])),T.debug(`[${this.hostTagName}] Setting "${e.name}" event "${String(h)}" to automcially call NylasConnector method.`);const v=T.formatEventName(h.toString());T.debug(`[${this.hostTagName}] Adding event listener for "${v}" on "${c.tagName}"`),c.addEventListener(v,m)}),r==null||r.forEach((l,h)=>{var y,g,b,k;const[f,m]=h.split("."),v=this.getStore(f).state[m];if(!c.dataset.nylasId){T.debug(`[${this.hostTagName}] Component "${e.name}" not registered. Skipping.`,{component:e});return}this.propStateRegistrations.has(f)||this.propStateRegistrations.set(f,new Map),(y=this.propStateRegistrations.get(f))!=null&&y.has(m)?(k=(b=this.propStateRegistrations.get(f))==null?void 0:b.get(m))==null||k.push({elementId:c.dataset.nylasId,propKey:l}):(g=this.propStateRegistrations.get(f))==null||g.set(m,[{elementId:c.dataset.nylasId,propKey:l}]),c[l.toString()]=v,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" value.`,{stateValue:v})}),a==null||a.forEach((l,h)=>{const f=this.host[h];c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to the value of "${h}" value.`,{value:h,mappedPropValue:f})}),s&&(c[s==null?void 0:s.toString()]=this.getStore,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${s.toString()}" to "getStore" method.`)),o==null||o.forEach((l,h)=>{const f=this.getStore(h);c[l.toString()]=f,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" store.`,{store:f})}),u&&(c[u==null?void 0:u.toString()]=this.nylasConnector,T.debug(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "nylasConnector" value.`,{connectorToProp:u})),T.debug(`[${this.hostTagName}] Component ${e.name} registered.`)}unregisterComponent(e){T.debug(`[${this.hostTagName}] Unregistering component ${e.name}.`);const n=e.element.dataset.nylasId;if(!n){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}if(this.registeredComponents[n]){T.debug(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);return}this.propStateRegistrations.forEach((s,i)=>{s.forEach((o,u)=>{var d,l;const a=(d=this.propStateRegistrations.get(i))==null?void 0:d.get(u),c=a==null?void 0:a.filter(h=>h.elementId!==n);c&&((l=this.propStateRegistrations.get(i))==null||l.set(u,c))})});const r=this.eventListenerRegistrations.get(n);r==null||r.forEach(([s,i,o])=>{const u=T.formatEventName(i.toString());T.debug(`[${this.hostTagName}] Removing event listener for "${u}" on "${s.tagName}"`),s.removeEventListener(u,o)}),delete this.registeredComponents[n]}getStore(e){const n=this.stores[e];if(!n)throw new Error(`[${this.hostTagName}] Store "${e.toString()}" not found.`);return n}async setupStoreListeners(){const e=this;Object.entries(this.stores).forEach(([n,r])=>{T.debug(`[${e.hostTagName}] Listening for changes in "${n}" store.`),r.use({set(s,i,o){var c;if(T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" changed`,{newValue:i,oldValue:o}),i===o){T.debug(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" unchanged. Skipping.`);return}const u=e.registeredComponents;if(!u){T.debug(`[${e.hostTagName}] No registered components found. Skipping.`);return}const a=((c=e.propStateRegistrations.get(n))==null?void 0:c.get(s.toString()))||[];T.debug(`[${e.hostTagName}] Found ${a.length} prop(s) registered for "${s.toString()}" store.`,{props:a,propStateRegistrations:e.propStateRegistrations}),a.forEach(({elementId:d,propKey:l})=>{const h=u[d];if(!h){T.debug(`[${e.hostTagName}] Component "${d}" not found. Skipping.`,{component:h});return}const m=e.getStore(n).state[s];h.element[l.toString()]=m,T.debug(`[${e.hostTagName}] Setting "${h.name}" prop "${l.toString()}" to "${s.toString()}" value.`,{stateValue:m})})}})})}get hostTagName(){var e,n;return((n=(e=this.host)==null?void 0:e.tagName)==null?void 0:n.toLowerCase())??"nylas-provider"}}class rr extends nr{}var sr=Object.defineProperty,ir=(t,e,n)=>e in t?sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ut=(t,e,n)=>(ir(t,typeof e!="symbol"?e+"":e,n),n),Sn=(t=>(t.Error="error",t.Warning="warning",t.Info="info",t.Success="success",t))(Sn||{});const or=t=>t!==null&&typeof t=="object"&&"error"in t;class ar extends Error{constructor(e){super(e==null?void 0:e.message),ut(this,"apiError"),this.name="NylasAPIError",this.stack=new Error().stack,this.apiError=e}}async function hn(t){const e=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",e),r=Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("");return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:T.global$1,$=Object.keys,M=Array.isArray;function U(t,e){return typeof e!="object"||$(e).forEach(function(n){t[n]=e[n]}),t}typeof Promise>"u"||K.Promise||(K.Promise=Promise);const Be=Object.getPrototypeOf,ur={}.hasOwnProperty;function z(t,e){return ur.call(t,e)}function Pe(t,e){typeof e=="function"&&(e=e(Be(t))),(typeof Reflect>"u"?$:Reflect.ownKeys)(e).forEach(n=>{ee(t,n,e[n])})}const Pn=Object.defineProperty;function ee(t,e,n,r){Pn(t,e,U(n&&z(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function ke(t){return{from:function(e){return t.prototype=Object.create(e.prototype),ee(t.prototype,"constructor",t),{extend:Pe.bind(null,t.prototype)}}}}const lr=Object.getOwnPropertyDescriptor;function Jt(t,e){let n;return lr(t,e)||(n=Be(t))&&Jt(n,e)}const cr=[].slice;function lt(t,e,n){return cr.call(t,e,n)}function En(t,e){return e(t)}function Ie(t){if(!t)throw new Error("Assertion Failed")}function Cn(t){K.setImmediate?setImmediate(t):setTimeout(t,0)}function Tn(t,e){return t.reduce((n,r,s)=>{var i=e(r,s);return i&&(n[i[0]]=i[1]),n},{})}function te(t,e){if(z(t,e))return t[e];if(!e)return t;if(typeof e!="string"){for(var n=[],r=0,s=e.length;r<s;++r){var i=te(t,e[r]);n.push(i)}return n}var o=e.indexOf(".");if(o!==-1){var u=t[e.substr(0,o)];return u===void 0?void 0:te(u,e.substr(o+1))}}function H(t,e,n){if(t&&e!==void 0&&(!("isFrozen"in Object)||!Object.isFrozen(t)))if(typeof e!="string"&&"length"in e){Ie(typeof n!="string"&&"length"in n);for(var r=0,s=e.length;r<s;++r)H(t,e[r],n[r])}else{var i=e.indexOf(".");if(i!==-1){var o=e.substr(0,i),u=e.substr(i+1);if(u==="")n===void 0?M(t)&&!isNaN(parseInt(o))?t.splice(o,1):delete t[o]:t[o]=n;else{var a=t[o];a&&z(t,o)||(a=t[o]={}),H(a,u,n)}}else n===void 0?M(t)&&!isNaN(parseInt(e))?t.splice(e,1):delete t[e]:t[e]=n}}function An(t){var e={};for(var n in t)z(t,n)&&(e[n]=t[n]);return e}const hr=[].concat;function On(t){return hr.apply([],t)}const In="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(On([8,16,32,64].map(t=>["Int","Uint","Float"].map(e=>e+t+"Array")))).filter(t=>K[t]),dr=In.map(t=>K[t]);Tn(In,t=>[t,!0]);let se=null;function We(t){se=typeof WeakMap<"u"&&new WeakMap;const e=Ct(t);return se=null,e}function Ct(t){if(!t||typeof t!="object")return t;let e=se&&se.get(t);if(e)return e;if(M(t)){e=[],se&&se.set(t,e);for(var n=0,r=t.length;n<r;++n)e.push(Ct(t[n]))}else if(dr.indexOf(t.constructor)>=0)e=t;else{const i=Be(t);for(var s in e=i===Object.prototype?{}:Object.create(i),se&&se.set(t,e),t)z(t,s)&&(e[s]=Ct(t[s]))}return e}const{toString:fr}={};function Tt(t){return fr.call(t).slice(8,-1)}const At=typeof Symbol<"u"?Symbol.iterator:"@@iterator",pr=typeof At=="symbol"?function(t){var e;return t!=null&&(e=t[At])&&e.apply(t)}:function(){return null},_e={};function J(t){var e,n,r,s;if(arguments.length===1){if(M(t))return t.slice();if(this===_e&&typeof t=="string")return[t];if(s=pr(t)){for(n=[];!(r=s.next()).done;)n.push(r.value);return n}if(t==null)return[t];if(typeof(e=t.length)=="number"){for(n=new Array(e);e--;)n[e]=t[e];return n}return[t]}for(e=arguments.length,n=new Array(e);e--;)n[e]=arguments[e];return n}const Zt=typeof Symbol<"u"?t=>t[Symbol.toStringTag]==="AsyncFunction":()=>!1;var G=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Kn(t,e){G=t,jn=e}var jn=()=>!0;const mr=!new Error("").stack;function Ee(){if(mr)try{throw new Error}catch(t){return t}return new Error}function Ot(t,e){var n=t.stack;return n?(e=e||0,n.indexOf(t.name)===0&&(e+=(t.name+t.message).split(`
|
|
2
2
|
`).length),n.split(`
|
|
3
3
|
`).slice(e).filter(jn).map(r=>`
|
|
4
4
|
`+r).join("")):""}var Rn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],en=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Rn),gr={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function xe(t,e){this._e=Ee(),this.name=t,this.message=e}function Nn(t,e){return t+". Errors: "+Object.keys(e).map(n=>e[n].toString()).filter((n,r,s)=>s.indexOf(n)===r).join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as nr, d as T, u as rr, n as hn } from "./index-
|
|
1
|
+
import { m as nr, d as T, u as rr, n as hn } from "./index-812162da.js";
|
|
2
2
|
class sr {
|
|
3
3
|
constructor(e, n, r = !0, s) {
|
|
4
4
|
this.automaticComponentRegistration = !0, this.registeredComponents = {}, this.propStateRegistrations = /* @__PURE__ */ new Map(), this.eventListenerRegistrations = /* @__PURE__ */ new Map(), this.host = e, this.stores = n, this.automaticComponentRegistration = r, this.eventOverrides = s, T(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides: s }), this.registerComponent = this.registerComponent.bind(this), this.getStore = this.getStore.bind(this), Object.keys(this.stores).forEach((i) => {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { r as
|
|
1
|
+
import { r as o, h as e, g as n } from "./index-812162da.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
const
|
|
4
|
+
const i = ".sc-info-icon-h{display:flex}", s = i, a = class {
|
|
5
5
|
constructor(t) {
|
|
6
|
-
|
|
6
|
+
o(this, t), this.width = "14", this.height = "14";
|
|
7
7
|
}
|
|
8
8
|
render() {
|
|
9
|
-
return
|
|
9
|
+
return e("svg", { key: "3b39e75ccc51ecef3016e2efacde52c32ebd3d7f", width: this.width, height: this.height, fill: "none", xmlns: "http://www.w3.org/2000/svg" }, e("path", { key: "27399ed4f40a68e7c6cace9ccb098289e524e501", fill: "currentColor", d: "M6.5 5.5C6.77614 5.5 7 5.72386 7 6V9C7 9.27614 6.77614 9.5 6.5 9.5C6.22386 9.5 6 9.27614 6 9V6C6 5.72386 6.22386 5.5 6.5 5.5ZM6.50001 4.74907C6.91369 4.74907 7.24905 4.41371 7.24905 4.00003C7.24905 3.58635 6.91369 3.251 6.50001 3.251C6.08633 3.251 5.75098 3.58635 5.75098 4.00003C5.75098 4.41371 6.08633 4.74907 6.50001 4.74907ZM0.5 6.5C0.5 3.18629 3.18629 0.5 6.5 0.5C9.81371 0.5 12.5 3.18629 12.5 6.5C12.5 9.81371 9.81371 12.5 6.5 12.5C3.18629 12.5 0.5 9.81371 0.5 6.5ZM6.5 1.5C3.73858 1.5 1.5 3.73858 1.5 6.5C1.5 9.26142 3.73858 11.5 6.5 11.5C9.26142 11.5 11.5 9.26142 11.5 6.5C11.5 3.73858 9.26142 1.5 6.5 1.5Z" }));
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
a.style = s;
|
|
13
13
|
const r = '.tooltip-container{position:relative;display:flex;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.tooltip-content{visibility:hidden;background-color:var(--nylas-base-800);color:var(--nylas-base-0);text-align:left;border-radius:6px;padding:5px 0;position:absolute;z-index:1;opacity:0;transition:opacity 0.3s;padding:0.5rem 1rem;max-width:200px;width:max-content}.tooltip-content.top{bottom:0;left:0;margin-bottom:1.25rem;transform:translateX(-50%)}.tooltip-content.right{top:50%;left:0%;margin-left:1.25rem;transform:translateY(-50%)}.tooltip-content.bottom{top:0;left:0;margin-top:1.25rem;transform:translateX(-50%)}.tooltip-content.left{top:50%;right:0%;margin-right:1.25rem;transform:translateY(-50%)}.tooltip-container:hover .tooltip-content,.tooltip-container:focus-within .tooltip-content{visibility:visible;opacity:1}.tooltip-content::after{content:"";position:absolute;top:-0.75rem;left:50%;transform:rotate(180deg);border-width:6px;border-style:solid;border-color:black transparent transparent transparent}.tooltip-content.top::after{top:100%;left:50%;transform:rotate(0deg)}.tooltip-content.bottom::after{top:-0.75rem;left:50%;transform:rotate(180deg)}.tooltip-content.left::after{top:47.5%;left:100%;transform:rotate(270deg)}.tooltip-content.right::after{top:47.5%;left:-0.75rem;transform:rotate(90deg)}', l = r, c = class {
|
|
14
14
|
constructor(t) {
|
|
15
|
-
|
|
15
|
+
o(this, t), this.position = "bottom";
|
|
16
16
|
}
|
|
17
17
|
showTooltip(t) {
|
|
18
18
|
t.target.nextElementSibling.style.visibility = "visible", t.target.nextElementSibling.style.opacity = "1";
|
|
@@ -21,7 +21,7 @@ const r = '.tooltip-container{position:relative;display:flex;--nylas-primary:#25
|
|
|
21
21
|
t.target.nextElementSibling.style.visibility = "hidden", t.target.nextElementSibling.style.opacity = "0";
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return
|
|
24
|
+
return e("div", { key: "18b608bb808e958a45cf72aeb8b1e25c0227ea62", class: "tooltip-container", part: "tc__container" }, e("span", { key: "4e7a423a9de7f26914169d3b4b72507de459a782", class: "info-icon", tabindex: "0", onFocus: this.showTooltip.bind(this), onBlur: this.hideTooltip.bind(this) }, e("slot", { key: "6820cbb0852277eb96fb9f4b6ad88576f41d602f", name: "tooltip-icon" }, "i")), e("span", { key: "99c67c01fcadf2de5890498fb7422b26807e1562", class: `tooltip-content ${this.position}`, part: "tc__content" }, e("slot", { key: "416736464010dee66cc5f5fbb03114d6c6bc32f8", name: "tooltip-content" }, "This is a help text.")));
|
|
25
25
|
}
|
|
26
26
|
get el() {
|
|
27
27
|
return n(this);
|
|
@@ -29,6 +29,6 @@ const r = '.tooltip-container{position:relative;display:flex;--nylas-primary:#25
|
|
|
29
29
|
};
|
|
30
30
|
c.style = l;
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
a as info_icon,
|
|
33
33
|
c as tooltip_component
|
|
34
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-e3e9b594.cjs");require("react");require("react-dom");const i=".sc-info-icon-h{display:flex}",s=i,o=class{constructor(e){t.registerInstance(this,e),this.width="14",this.height="14"}render(){return t.h("svg",{key:"3b39e75ccc51ecef3016e2efacde52c32ebd3d7f",width:this.width,height:this.height,fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.h("path",{key:"27399ed4f40a68e7c6cace9ccb098289e524e501",fill:"currentColor",d:"M6.5 5.5C6.77614 5.5 7 5.72386 7 6V9C7 9.27614 6.77614 9.5 6.5 9.5C6.22386 9.5 6 9.27614 6 9V6C6 5.72386 6.22386 5.5 6.5 5.5ZM6.50001 4.74907C6.91369 4.74907 7.24905 4.41371 7.24905 4.00003C7.24905 3.58635 6.91369 3.251 6.50001 3.251C6.08633 3.251 5.75098 3.58635 5.75098 4.00003C5.75098 4.41371 6.08633 4.74907 6.50001 4.74907ZM0.5 6.5C0.5 3.18629 3.18629 0.5 6.5 0.5C9.81371 0.5 12.5 3.18629 12.5 6.5C12.5 9.81371 9.81371 12.5 6.5 12.5C3.18629 12.5 0.5 9.81371 0.5 6.5ZM6.5 1.5C3.73858 1.5 1.5 3.73858 1.5 6.5C1.5 9.26142 3.73858 11.5 6.5 11.5C9.26142 11.5 11.5 9.26142 11.5 6.5C11.5 3.73858 9.26142 1.5 6.5 1.5Z"}))}};o.style=s;const a='.tooltip-container{position:relative;display:flex;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}.tooltip-content{visibility:hidden;background-color:var(--nylas-base-800);color:var(--nylas-base-0);text-align:left;border-radius:6px;padding:5px 0;position:absolute;z-index:1;opacity:0;transition:opacity 0.3s;padding:0.5rem 1rem;max-width:200px;width:max-content}.tooltip-content.top{bottom:0;left:0;margin-bottom:1.25rem;transform:translateX(-50%)}.tooltip-content.right{top:50%;left:0%;margin-left:1.25rem;transform:translateY(-50%)}.tooltip-content.bottom{top:0;left:0;margin-top:1.25rem;transform:translateX(-50%)}.tooltip-content.left{top:50%;right:0%;margin-right:1.25rem;transform:translateY(-50%)}.tooltip-container:hover .tooltip-content,.tooltip-container:focus-within .tooltip-content{visibility:visible;opacity:1}.tooltip-content::after{content:"";position:absolute;top:-0.75rem;left:50%;transform:rotate(180deg);border-width:6px;border-style:solid;border-color:black transparent transparent transparent}.tooltip-content.top::after{top:100%;left:50%;transform:rotate(0deg)}.tooltip-content.bottom::after{top:-0.75rem;left:50%;transform:rotate(180deg)}.tooltip-content.left::after{top:47.5%;left:100%;transform:rotate(270deg)}.tooltip-content.right::after{top:47.5%;left:-0.75rem;transform:rotate(90deg)}',r=a,n=class{constructor(e){t.registerInstance(this,e),this.position="bottom"}showTooltip(e){e.target.nextElementSibling.style.visibility="visible",e.target.nextElementSibling.style.opacity="1"}hideTooltip(e){e.target.nextElementSibling.style.visibility="hidden",e.target.nextElementSibling.style.opacity="0"}render(){return t.h("div",{key:"18b608bb808e958a45cf72aeb8b1e25c0227ea62",class:"tooltip-container",part:"tc__container"},t.h("span",{key:"4e7a423a9de7f26914169d3b4b72507de459a782",class:"info-icon",tabindex:"0",onFocus:this.showTooltip.bind(this),onBlur:this.hideTooltip.bind(this)},t.h("slot",{key:"6820cbb0852277eb96fb9f4b6ad88576f41d602f",name:"tooltip-icon"},"i")),t.h("span",{key:"99c67c01fcadf2de5890498fb7422b26807e1562",class:`tooltip-content ${this.position}`,part:"tc__content"},t.h("slot",{key:"416736464010dee66cc5f5fbb03114d6c6bc32f8",name:"tooltip-content"},"This is a help text.")))}get el(){return t.getElement(this)}};n.style=r;exports.info_icon=o;exports.tooltip_component=n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r, c as s, h as
|
|
2
|
-
import { s as
|
|
3
|
-
import "./index-53420959-
|
|
1
|
+
import { r, c as s, h as t } from "./index-812162da.js";
|
|
2
|
+
import { s as a } from "./index-6d9eeb53-3edef246.js";
|
|
3
|
+
import "./index-53420959-67beefed.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "react-dom";
|
|
6
6
|
const l = ':host{display:block;height:100%;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0}label .error{color:var(--nylas-error)}input[type=text],input[type=email]{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%}input[type=text]:focus,input[type=email]:focus{outline-color:var(--nylas-primary)}input[type=text].error,input[type=email].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=email].error::placeholder{font-weight:400}input[type=text]::placeholder,input[type=email]::placeholder{color:var(--nylas-base-300)}', i = l, n = {
|
|
@@ -14,13 +14,13 @@ const l = ':host{display:block;height:100%;--nylas-primary:#2563eb;--nylas-error
|
|
|
14
14
|
r(this, e), this.nylasFormInputChanged = s(this, "nylasFormInputChanged", 7), this.name = "input", this.defaultValue = "", this.label = "", this.type = "text", this.placeholder = o[this.type], this.required = !1, this.readOnly = !1, this.autoFocus = !1, this.pattern = void 0, this.maxLength = 255, this.patternError = "", this.value = "", this.error = "";
|
|
15
15
|
}
|
|
16
16
|
componentWillLoad() {
|
|
17
|
-
this.value =
|
|
17
|
+
this.value = a(this.defaultValue), this.type !== "text" && !this.pattern && (this.pattern = n[this.type]), this.value && this.validatePattern(this.value);
|
|
18
18
|
}
|
|
19
19
|
handleBookingFormSubmitted(e) {
|
|
20
20
|
this.validatePattern(this.value), this.error && e.preventDefault();
|
|
21
21
|
}
|
|
22
22
|
handleInput(e) {
|
|
23
|
-
this.error = "", this.value =
|
|
23
|
+
this.error = "", this.value = a(e.target.value), this.nylasFormInputChanged.emit({
|
|
24
24
|
value: this.value,
|
|
25
25
|
name: this.name,
|
|
26
26
|
label: this.label,
|
|
@@ -36,7 +36,7 @@ const l = ':host{display:block;height:100%;--nylas-primary:#2563eb;--nylas-error
|
|
|
36
36
|
this.pattern && (this.pattern.test(e) ? this.error = "" : this.error = `Invalid ${this.label.toLowerCase()} format.`);
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
|
-
return
|
|
39
|
+
return t("label", { key: "a28361a1be7a5afe38dfdc3eb375d51029af16d2", part: "ic__label", class: { error: !!this.error } }, t("p", { key: "950007f568b6c12231f40bedb1db8f62937e978a" }, t("span", { key: "106299e5bea57a16eec9734db501517d50549262", class: "label" }, this.label), this.required && t("span", { class: "required" }, "*")), t("input", { key: "5c00d0abff394b38de75d24af47610ff4e246e69", type: "text", name: this.name, part: "ic__input", readOnly: this.readOnly, autoFocus: this.autoFocus, value: this.value, maxLength: this.maxLength, placeholder: this.placeholder, class: { error: !!this.error }, onInput: (e) => this.handleInput(e) }), this.error && t("span", { class: "error help-text" }, this.error, " ", this.value && this.patternError !== "" ? ` ${this.patternError}` : ""));
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
h.style = i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-e3e9b594.cjs"),r=require("./index-6d9eeb53-3049fc04.cjs");require("./index-53420959-d3254a34.cjs");require("react");require("react-dom");const s=':host{display:block;height:100%;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;width:100%}label{display:flex;color:var(--nylas-base-800, #293056);font-size:14px;font-style:normal;font-weight:400;line-height:150%;flex-direction:column;gap:4px;font-family:var(--nylas-font-family);font-size:16px;color:var(--nylas-base-800)}label.error{color:var(--nylas-error)}label span.required{color:var(--nylas-error);padding:0 0.25rem}label p{margin:0}label .error{color:var(--nylas-error)}input[type=text],input[type=email]{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%}input[type=text]:focus,input[type=email]:focus{outline-color:var(--nylas-primary)}input[type=text].error,input[type=email].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=email].error::placeholder{font-weight:400}input[type=text]::placeholder,input[type=email]::placeholder{color:var(--nylas-base-300)}',l=s,i={email:/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,tel:/^[0-9]{10}$/},n={email:"name@example.com",tel:"1234567890"},a=class{constructor(e){t.registerInstance(this,e),this.nylasFormInputChanged=t.createEvent(this,"nylasFormInputChanged",7),this.name="input",this.defaultValue="",this.label="",this.type="text",this.placeholder=n[this.type],this.required=!1,this.readOnly=!1,this.autoFocus=!1,this.pattern=void 0,this.maxLength=255,this.patternError="",this.value="",this.error=""}componentWillLoad(){this.value=r.sanitizeHtml$1(this.defaultValue),this.type!=="text"&&!this.pattern&&(this.pattern=i[this.type]),this.value&&this.validatePattern(this.value)}handleBookingFormSubmitted(e){this.validatePattern(this.value),this.error&&e.preventDefault()}handleInput(e){this.error="",this.value=r.sanitizeHtml$1(e.target.value),this.nylasFormInputChanged.emit({value:this.value,name:this.name,label:this.label,error:this.error,type:this.type})}validatePattern(e){if(this.error="",this.required&&!e){this.error=`${this.label} is required.`;return}this.pattern&&(this.pattern.test(e)?this.error="":this.error=`Invalid ${this.label.toLowerCase()} format.`)}render(){return t.h("label",{key:"a28361a1be7a5afe38dfdc3eb375d51029af16d2",part:"ic__label",class:{error:!!this.error}},t.h("p",{key:"950007f568b6c12231f40bedb1db8f62937e978a"},t.h("span",{key:"106299e5bea57a16eec9734db501517d50549262",class:"label"},this.label),this.required&&t.h("span",{class:"required"},"*")),t.h("input",{key:"5c00d0abff394b38de75d24af47610ff4e246e69",type:"text",name:this.name,part:"ic__input",readOnly:this.readOnly,autoFocus:this.autoFocus,value:this.value,maxLength:this.maxLength,placeholder:this.placeholder,class:{error:!!this.error},onInput:e=>this.handleInput(e)}),this.error&&t.h("span",{class:"error help-text"},this.error," ",this.value&&this.patternError!==""?` ${this.patternError}`:""))}};a.style=l;exports.input_component=a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as l, c as p, h as r, g as c, d as a } from "./index-
|
|
1
|
+
import { r as l, c as p, h as r, g as c, d as a } from "./index-812162da.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
const h = ':host{display:block;position:relative;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{position:unset}}.dropdown{display:inline-block}.dropbtn{color:var(--nylas-base-800);padding:10px;font-size:1rem;font-family:var(--nylas-font-family);cursor:pointer;display:flex;gap:0.5rem;background:transparent;border:none;border-radius:var(--nylas-border-radius-2x);width:50px;padding:14px 16px;border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn:hover,.dropbtn:active{outline:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.chevron{display:flex;align-self:center}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropbtn span.selected-option{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:144px;font-size:14px;line-height:20px}@media screen and (max-width: 768px){.dropbtn span.selected-option{max-width:124px;font-size:16px}}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);max-width:306px;width:max-content;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1)}@media screen and (max-width: 768px){.dropdown-content{right:0;width:325px;max-width:unset}}.search-box{border-bottom:1px solid var(--nylas-base-200);padding:10px;position:sticky;top:0;background:var(--nylas-base-0)}.search-box .icon{position:absolute;top:1.25rem;left:1.25rem;color:var(--nylas-base-300)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content .selected{background-color:#e7e7e7}input[type=text]{width:-webkit-fill-available;padding:inherit;border:1px solid #ccc;border-radius:4px;position:sticky;background:no-repeat scroll 7px 7px;padding-left:30px;background-size:16px 16px}', u = h, m = class {
|
|
@@ -109,7 +109,7 @@ const h = ':host{display:block;position:relative;--nylas-primary:#2563eb;--nylas
|
|
|
109
109
|
!e.composedPath().includes(this.el) && this.isOpen && (this.isOpen = !1);
|
|
110
110
|
}
|
|
111
111
|
render() {
|
|
112
|
-
return r("div", { key: "
|
|
112
|
+
return r("div", { key: "271eb5442c9d5358ba755a4f4117c7cf74e6fcff", class: "dropdown", part: "id_dropdown" }, r("input", { key: "bb95067c1c69691912193b04f76daf1603456722", type: "text", name: this.name, id: this.name, part: "id_dropdown-input", class: { dropbtn: !0, open: this.isOpen }, value: this.inputValue, onClick: (e) => {
|
|
113
113
|
this.toggleDropdown(), this.shouldAutoScroll = !0, this.handleClick(e);
|
|
114
114
|
}, "aria-haspopup": "listbox", "aria-label": this.name, "aria-expanded": this.isOpen ? "true" : "false", onKeyDown: (e) => this.handleComboboxKeyDown(e), onInput: (e) => this.handleOnInput(e) }), this.isOpen ? r("div", { class: "dropdown-content", part: "id_dropdown-content", ref: (e) => this.optionsRef = e }, r("ul", { tabindex: "-1", role: "listbox", "aria-label": this.name, "aria-activedescendant": this.ariaActivedescendant, onKeyDown: (e) => this.handleListboxKeydown(e) }, this.filteredOptions.map((e) => r("li", { tabindex: "0", key: e.value, id: e.value, onClick: () => this.selectOption(e), role: "option", class: {
|
|
115
115
|
focused: this.ariaActivedescendant === e.value.toString()
|
|
@@ -200,7 +200,7 @@ const b = ".time-period-selector.sc-time-period-selector{display:grid;gap:0.5rem
|
|
|
200
200
|
})), this.selectedNumber = parseInt(this.numberOptions[0].value);
|
|
201
201
|
}
|
|
202
202
|
render() {
|
|
203
|
-
return r("div", { key: "
|
|
203
|
+
return r("div", { key: "a4b421b31d77e41c8ef3c2a7533699a6cfaeb60c", class: "time-period-selector" }, r("input-dropdown", { key: "b5f99b1d27195ad8fdc3617cf04e3fba3cfd49dd", id: "time-number", name: "time-number", inputValue: this.selectedNumber.toString(), exportparts: "sd_dropdown: tps__number-dropdown, sd_dropdown-button: tps__number-dropdown-button, sd_dropdown-content: tps__number-dropdown-content", options: this.numberOptions, defaultInputOption: this.numberOptions.find((e) => e.value == this.selectedNumber.toString()) ?? this.numberOptions[0] }), r("select-dropdown", { key: "c06e213131979c07431ed1a6964bd0e0e2338b97", id: "time-period", name: "time-period", options: this.timePeriodOptions, exportparts: "sd_dropdown: tps__period-dropdown, sd_dropdown-button: tps__period-dropdown-button, sd_dropdown-content: tps__period-dropdown-content", pluralizedLabel: this.selectedNumber > 1 ? "s" : "", defaultSelectedOption: this.timePeriodOptions.find((e) => e.value == this.selectedPeriod) ?? this.timePeriodOptions[0], withSearch: !1 }));
|
|
204
204
|
}
|
|
205
205
|
get host() {
|
|
206
206
|
return c(this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-769f0fdd.cjs");require("react");require("react-dom");const p=':host{display:block;position:relative;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{position:unset}}.dropdown{display:inline-block}.dropbtn{color:var(--nylas-base-800);padding:10px;font-size:1rem;font-family:var(--nylas-font-family);cursor:pointer;display:flex;gap:0.5rem;background:transparent;border:none;border-radius:var(--nylas-border-radius-2x);width:50px;padding:14px 16px;border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn:hover,.dropbtn:active{outline:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.chevron{display:flex;align-self:center}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropbtn span.selected-option{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:144px;font-size:14px;line-height:20px}@media screen and (max-width: 768px){.dropbtn span.selected-option{max-width:124px;font-size:16px}}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);max-width:306px;width:max-content;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1)}@media screen and (max-width: 768px){.dropdown-content{right:0;width:325px;max-width:unset}}.search-box{border-bottom:1px solid var(--nylas-base-200);padding:10px;position:sticky;top:0;background:var(--nylas-base-0)}.search-box .icon{position:absolute;top:1.25rem;left:1.25rem;color:var(--nylas-base-300)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content .selected{background-color:#e7e7e7}input[type=text]{width:-webkit-fill-available;padding:inherit;border:1px solid #ccc;border-radius:4px;position:sticky;background:no-repeat scroll 7px 7px;padding-left:30px;background-size:16px 16px}',c=p,a=class{constructor(e){s.registerInstance(this,e),this.inputOptionChanged=s.createEvent(this,"inputOptionChanged",7),this.name=void 0,this.options=[],this.defaultInputOption=void 0,this.inputValue=void 0,this.pluralizedLabel="",this.filterable=!1,this.selectedOption=this.defaultInputOption||null,this.isOpen=!1,this.filteredOptions=[...this.options],this.ariaActivedescendant="",this.shouldAutoScroll=!1}optionsChangedHandler(e,t){e!==t&&(this.filteredOptions=this.getFilteredOptions(e))}defaultSelectedOptionChangedHandler(e,t){e.label!==t.label&&(this.selectedOption=e)}inputValueChangedHandler(e,t){e!==t&&(this.inputValue=e,this.filteredOptions=this.getFilteredOptions(this.options))}componentWillLoad(){this.filteredOptions=this.getFilteredOptions(this.options),!this.selectedOption&&this.defaultInputOption&&(this.selectedOption=this.defaultInputOption),!this.selectedOption&&this.options.length>0&&(this.selectedOption=this.options[0])}getFilteredOptions(e){return this.filterable?e.filter(t=>{var i,o,r,n;return((o=t==null?void 0:t.value)==null?void 0:o.toString().toLowerCase().includes((i=this.inputValue)==null?void 0:i.toLowerCase()))||((n=t==null?void 0:t.label)==null?void 0:n.toLowerCase().includes((r=this.inputValue)==null?void 0:r.toLowerCase()))}):e}toggleDropdown(){this.isOpen=!this.isOpen}selectOption(e){this.selectedOption=e,this.toggleDropdown(),this.inputOptionChanged.emit({value:e.value,name:this.name})}handleOnInput(e){const t=e.target.value,i=this.options.findIndex(o=>o.label.toLowerCase().includes(t.toLowerCase()));i>-1&&this.scrollToViewWithinParent(i),this.inputOptionChanged.emit({value:t,name:this.name})}scrollToViewWithinParent(e){var d;const t=this.options[e],i=(d=this.el.shadowRoot)==null?void 0:d.getElementById(t.value.toString()),o=this.optionsRef;if(this.ariaActivedescendant=t.value.toString(),!i||!o)return;const r=i.getBoundingClientRect(),n=o.getBoundingClientRect();r.top<n.top?o.scrollTop-=n.top-r.top:r.bottom>n.bottom&&(o.scrollTop+=r.bottom-n.bottom)}handleSelectButtonKeyDown(e){var t;switch(e.key){case"ArrowDown":case"Enter":e.preventDefault(),this.isOpen||this.toggleDropdown(),(t=this.inputRef)==null||t.focus();break;case"Escape":this.isOpen=!1;break}}handleClick(e){if(this.isOpen){const t=e.target.value,i=this.options.findIndex(o=>o.label.toLowerCase().includes(t.toLowerCase()));i>-1&&setTimeout(()=>{this.scrollToViewWithinParent(i)},10)}}handleListboxKeydown(e){var o,r;const t=this.filteredOptions,i=t.findIndex(n=>n.value===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){if(e.preventDefault(),i===t.length-1){this.ariaActivedescendant="",(o=this.inputRef)==null||o.focus();return}const n=i+1<t.length?i+1:0;this.ariaActivedescendant=t[n].value,this.focusOption(n)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){if(e.preventDefault(),i===0){this.ariaActivedescendant="",(r=this.inputRef)==null||r.focus();return}const n=i-1>=0?i-1:t.length-1;this.ariaActivedescendant=t[n].value,this.focusOption(n)}else e.key==="Enter"?(e.preventDefault(),this.ariaActivedescendant&&this.selectOption(t[i])):e.key==="Escape"&&(this.isOpen=!1)}focusOption(e){var r;const t=this.filteredOptions[e];if(!t)return;const i=t.value,o=(r=this.el.shadowRoot)==null?void 0:r.getElementById(i);o&&(o.focus(),o.scrollIntoView({behavior:"smooth",block:"nearest"}))}handleComboboxKeyDown(e){if(e.key==="ArrowDown"||e.key=="Tab"&&!e.shiftKey){if(e.preventDefault(),!this.isOpen){this.isOpen=!0,this.shouldAutoScroll=!0;return}this.ariaActivedescendant=this.filteredOptions[0].value,this.focusOption(0)}else e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey?(e.preventDefault(),this.ariaActivedescendant=this.filteredOptions[this.filteredOptions.length-1].value,this.focusOption(this.filteredOptions.length-1)):e.key==="Escape"&&(this.isOpen=!1)}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.isOpen&&(this.isOpen=!1)}render(){return s.h("div",{key:"46501632a9bcea1b4af6d5b4b073904e14d0cf50",class:"dropdown",part:"id_dropdown"},s.h("input",{key:"67e4a24466b39b39161066bb9915ca67467043f3",type:"text",name:this.name,id:this.name,part:"id_dropdown-input",class:{dropbtn:!0,open:this.isOpen},value:this.inputValue,onClick:e=>{this.toggleDropdown(),this.shouldAutoScroll=!0,this.handleClick(e)},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.isOpen?"true":"false",onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e)}),this.isOpen?s.h("div",{class:"dropdown-content",part:"id_dropdown-content",ref:e=>this.optionsRef=e},s.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.filteredOptions.map(e=>s.h("li",{tabindex:"0",key:e.value,id:e.value,onClick:()=>this.selectOption(e),role:"option",class:{focused:this.ariaActivedescendant===e.value.toString()}},e.labelHTML?e.labelHTML:e.label)))):null)}get el(){return s.getElement(this)}static get watchers(){return{options:["optionsChangedHandler"],defaultInputOption:["defaultSelectedOptionChangedHandler"],inputValue:["inputValueChangedHandler"]}}};a.style=c;const h=".time-period-selector.sc-time-period-selector{display:grid;gap:0.5rem;grid-template-columns:auto 1fr}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector,.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector{width:116px}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{width:84px;display:flex;align-items:center}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){width:100%}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown){width:inherit;height:100%}.time-period-selector.sc-time-period-selector input-dropdown#time-number.sc-time-period-selector::part(id_dropdown-input){border:none;border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-input){padding:17px;gap:1rem}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-content){width:100%;max-height:200px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown){width:inherit}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem;justify-content:space-between}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}",u=h,m={hours:"hour",days:"day",weeks:"week",months:"month"},l=class{constructor(e){s.registerInstance(this,e),this.timePeriodChanged=s.createEvent(this,"timePeriodChanged",7),this.timePeriods=["hour","day","week","month"],this.defaultSelectedPeriod="hour",this.defaultSelectedNumber=1,this.selectedPeriod=this.defaultSelectedPeriod,this.selectedNumber=this.defaultSelectedNumber,this.numberOptions=this.calculateOptions(this.defaultSelectedPeriod||"hour").map(t=>({label:t.toString(),value:t.toString()})),this.timePeriodOptions=this.timePeriods.map(t=>({label:t,value:t}))}defaultSelectedPeriodChangedHandler(e){this.selectedPeriod=e;const t=m[e]??e;this.updateNumberOptionsAndSelectedNumber(t)}defaultSelectedNumberChangedHandler(e){this.selectedNumber=e}timePeriodsChangedHandler(e){this.timePeriodOptions=e.map(t=>({label:t,value:t}))}calculateOptions(e){switch(e){case"hour":return Array.from({length:23},(t,i)=>i+1);case"minute":return Array.from({length:13},(t,i)=>i*5);case"day":return Array.from({length:30},(t,i)=>i+1);case"week":return Array.from({length:4},(t,i)=>i+1);case"month":return Array.from({length:12},(t,i)=>i+1);default:return[]}}inputOptionChangedHandler(e){s.debug("time-period-selector","inputOptionChangedHandler",e.detail);const{value:t,name:i}=e.detail;i==="time-number"&&(this.selectedNumber=parseInt(t));const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}nylasFormDropdownChangedHandler(e){s.debug("time-period-selector","nylasFormDropdownChangedHandler",e.detail);const{value:t,name:i}=e.detail;i==="time-period"?(this.selectedPeriod=t,this.updateNumberOptionsAndSelectedNumber(t)):i==="time-number"&&(this.selectedNumber=parseInt(t));const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}updateNumberOptionsAndSelectedNumber(e){const t=this.calculateOptions(e);this.numberOptions=t.map(i=>({label:i.toString(),value:i.toString()})),this.selectedNumber=parseInt(this.numberOptions[0].value)}render(){return s.h("div",{key:"0bd8e5ec168ca34bfd0540c6b1423954a716bbde",class:"time-period-selector"},s.h("input-dropdown",{key:"8d481cca0e6693367e9c64004cd5596e90aaaa03",id:"time-number",name:"time-number",inputValue:this.selectedNumber.toString(),exportparts:"sd_dropdown: tps__number-dropdown, sd_dropdown-button: tps__number-dropdown-button, sd_dropdown-content: tps__number-dropdown-content",options:this.numberOptions,defaultInputOption:this.numberOptions.find(e=>e.value==this.selectedNumber.toString())??this.numberOptions[0]}),s.h("select-dropdown",{key:"e173825b80107361a1d5323fcd3a5503b1d59de5",id:"time-period",name:"time-period",options:this.timePeriodOptions,exportparts:"sd_dropdown: tps__period-dropdown, sd_dropdown-button: tps__period-dropdown-button, sd_dropdown-content: tps__period-dropdown-content",pluralizedLabel:this.selectedNumber>1?"s":"",defaultSelectedOption:this.timePeriodOptions.find(e=>e.value==this.selectedPeriod)??this.timePeriodOptions[0],withSearch:!1}))}get host(){return s.getElement(this)}static get watchers(){return{defaultSelectedPeriod:["defaultSelectedPeriodChangedHandler"],defaultSelectedNumber:["defaultSelectedNumberChangedHandler"],timePeriods:["timePeriodsChangedHandler"]}}};l.style=u;exports.input_dropdown=a;exports.time_period_selector=l;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-e3e9b594.cjs");require("react");require("react-dom");const p=':host{display:block;position:relative;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif}@media screen and (max-width: 768px){:host{position:unset}}.dropdown{display:inline-block}.dropbtn{color:var(--nylas-base-800);padding:10px;font-size:1rem;font-family:var(--nylas-font-family);cursor:pointer;display:flex;gap:0.5rem;background:transparent;border:none;border-radius:var(--nylas-border-radius-2x);width:50px;padding:14px 16px;border-radius:var(--nylas-border-radius-2x)}.dropbtn.focus{background:transparent}.dropbtn:hover,.dropbtn:active{outline:1px solid var(--nylas-primary)}.dropbtn:active{outline:2px solid var(--nylas-primary)}.dropbtn span.chevron{display:flex;align-self:center}.dropbtn span.open{transform:rotate(90deg)}.dropbtn span.closed{transform:rotate(270deg)}.dropbtn span.selected-option{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:144px;font-size:14px;line-height:20px}@media screen and (max-width: 768px){.dropbtn span.selected-option{max-width:124px;font-size:16px}}.dropdown-content{display:block;margin-top:0.5rem;background-color:var(--nylas-base-0);max-width:306px;width:max-content;max-height:336px;overflow:auto;z-index:1;border-radius:4px;position:absolute;box-shadow:0px 4px 6px -2px rgba(0, 0, 0, 0.05);box-shadow:0px 10px 15px -3px rgba(0, 0, 0, 0.1)}@media screen and (max-width: 768px){.dropdown-content{right:0;width:325px;max-width:unset}}.search-box{border-bottom:1px solid var(--nylas-base-200);padding:10px;position:sticky;top:0;background:var(--nylas-base-0)}.search-box .icon{position:absolute;top:1.25rem;left:1.25rem;color:var(--nylas-base-300)}.dropdown-content ul{padding:0;list-style-type:none;color:var(--nylas-base-900);max-height:336px}.dropdown-content ul li{padding:16px, 12px, 16px, 12px;color:black;padding:12px 16px;text-decoration:none;display:block;font-family:inherit;font-size:14px;font-weight:400;line-height:20px;letter-spacing:0px;text-align:left;cursor:pointer}.dropdown-content ul li:hover,.dropdown-content ul li:focus{background-color:var(--nylas-base-100)}.dropdown-content .selected{background-color:#e7e7e7}input[type=text]{width:-webkit-fill-available;padding:inherit;border:1px solid #ccc;border-radius:4px;position:sticky;background:no-repeat scroll 7px 7px;padding-left:30px;background-size:16px 16px}',c=p,a=class{constructor(e){s.registerInstance(this,e),this.inputOptionChanged=s.createEvent(this,"inputOptionChanged",7),this.name=void 0,this.options=[],this.defaultInputOption=void 0,this.inputValue=void 0,this.pluralizedLabel="",this.filterable=!1,this.selectedOption=this.defaultInputOption||null,this.isOpen=!1,this.filteredOptions=[...this.options],this.ariaActivedescendant="",this.shouldAutoScroll=!1}optionsChangedHandler(e,t){e!==t&&(this.filteredOptions=this.getFilteredOptions(e))}defaultSelectedOptionChangedHandler(e,t){e.label!==t.label&&(this.selectedOption=e)}inputValueChangedHandler(e,t){e!==t&&(this.inputValue=e,this.filteredOptions=this.getFilteredOptions(this.options))}componentWillLoad(){this.filteredOptions=this.getFilteredOptions(this.options),!this.selectedOption&&this.defaultInputOption&&(this.selectedOption=this.defaultInputOption),!this.selectedOption&&this.options.length>0&&(this.selectedOption=this.options[0])}getFilteredOptions(e){return this.filterable?e.filter(t=>{var i,o,r,n;return((o=t==null?void 0:t.value)==null?void 0:o.toString().toLowerCase().includes((i=this.inputValue)==null?void 0:i.toLowerCase()))||((n=t==null?void 0:t.label)==null?void 0:n.toLowerCase().includes((r=this.inputValue)==null?void 0:r.toLowerCase()))}):e}toggleDropdown(){this.isOpen=!this.isOpen}selectOption(e){this.selectedOption=e,this.toggleDropdown(),this.inputOptionChanged.emit({value:e.value,name:this.name})}handleOnInput(e){const t=e.target.value,i=this.options.findIndex(o=>o.label.toLowerCase().includes(t.toLowerCase()));i>-1&&this.scrollToViewWithinParent(i),this.inputOptionChanged.emit({value:t,name:this.name})}scrollToViewWithinParent(e){var d;const t=this.options[e],i=(d=this.el.shadowRoot)==null?void 0:d.getElementById(t.value.toString()),o=this.optionsRef;if(this.ariaActivedescendant=t.value.toString(),!i||!o)return;const r=i.getBoundingClientRect(),n=o.getBoundingClientRect();r.top<n.top?o.scrollTop-=n.top-r.top:r.bottom>n.bottom&&(o.scrollTop+=r.bottom-n.bottom)}handleSelectButtonKeyDown(e){var t;switch(e.key){case"ArrowDown":case"Enter":e.preventDefault(),this.isOpen||this.toggleDropdown(),(t=this.inputRef)==null||t.focus();break;case"Escape":this.isOpen=!1;break}}handleClick(e){if(this.isOpen){const t=e.target.value,i=this.options.findIndex(o=>o.label.toLowerCase().includes(t.toLowerCase()));i>-1&&setTimeout(()=>{this.scrollToViewWithinParent(i)},10)}}handleListboxKeydown(e){var o,r;const t=this.filteredOptions,i=t.findIndex(n=>n.value===this.ariaActivedescendant);if(e.key==="ArrowDown"||e.key==="Tab"&&!e.shiftKey){if(e.preventDefault(),i===t.length-1){this.ariaActivedescendant="",(o=this.inputRef)==null||o.focus();return}const n=i+1<t.length?i+1:0;this.ariaActivedescendant=t[n].value,this.focusOption(n)}else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey){if(e.preventDefault(),i===0){this.ariaActivedescendant="",(r=this.inputRef)==null||r.focus();return}const n=i-1>=0?i-1:t.length-1;this.ariaActivedescendant=t[n].value,this.focusOption(n)}else e.key==="Enter"?(e.preventDefault(),this.ariaActivedescendant&&this.selectOption(t[i])):e.key==="Escape"&&(this.isOpen=!1)}focusOption(e){var r;const t=this.filteredOptions[e];if(!t)return;const i=t.value,o=(r=this.el.shadowRoot)==null?void 0:r.getElementById(i);o&&(o.focus(),o.scrollIntoView({behavior:"smooth",block:"nearest"}))}handleComboboxKeyDown(e){if(e.key==="ArrowDown"||e.key=="Tab"&&!e.shiftKey){if(e.preventDefault(),!this.isOpen){this.isOpen=!0,this.shouldAutoScroll=!0;return}this.ariaActivedescendant=this.filteredOptions[0].value,this.focusOption(0)}else e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey?(e.preventDefault(),this.ariaActivedescendant=this.filteredOptions[this.filteredOptions.length-1].value,this.focusOption(this.filteredOptions.length-1)):e.key==="Escape"&&(this.isOpen=!1)}handleOutsideClick(e){!e.composedPath().includes(this.el)&&this.isOpen&&(this.isOpen=!1)}render(){return s.h("div",{key:"271eb5442c9d5358ba755a4f4117c7cf74e6fcff",class:"dropdown",part:"id_dropdown"},s.h("input",{key:"bb95067c1c69691912193b04f76daf1603456722",type:"text",name:this.name,id:this.name,part:"id_dropdown-input",class:{dropbtn:!0,open:this.isOpen},value:this.inputValue,onClick:e=>{this.toggleDropdown(),this.shouldAutoScroll=!0,this.handleClick(e)},"aria-haspopup":"listbox","aria-label":this.name,"aria-expanded":this.isOpen?"true":"false",onKeyDown:e=>this.handleComboboxKeyDown(e),onInput:e=>this.handleOnInput(e)}),this.isOpen?s.h("div",{class:"dropdown-content",part:"id_dropdown-content",ref:e=>this.optionsRef=e},s.h("ul",{tabindex:"-1",role:"listbox","aria-label":this.name,"aria-activedescendant":this.ariaActivedescendant,onKeyDown:e=>this.handleListboxKeydown(e)},this.filteredOptions.map(e=>s.h("li",{tabindex:"0",key:e.value,id:e.value,onClick:()=>this.selectOption(e),role:"option",class:{focused:this.ariaActivedescendant===e.value.toString()}},e.labelHTML?e.labelHTML:e.label)))):null)}get el(){return s.getElement(this)}static get watchers(){return{options:["optionsChangedHandler"],defaultInputOption:["defaultSelectedOptionChangedHandler"],inputValue:["inputValueChangedHandler"]}}};a.style=c;const h=".time-period-selector.sc-time-period-selector{display:grid;gap:0.5rem;grid-template-columns:auto 1fr}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector,.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector{width:116px}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector{width:84px;display:flex;align-items:center}.time-period-selector.sc-time-period-selector select-dropdown#time-period.sc-time-period-selector::part(sd_dropdown-button){width:100%}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown){width:inherit;height:100%}.time-period-selector.sc-time-period-selector input-dropdown#time-number.sc-time-period-selector::part(id_dropdown-input){border:none;border-radius:var(--nylas-border-radius-2x)}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-input){padding:17px;gap:1rem}.time-period-selector.sc-time-period-selector input-dropdown.sc-time-period-selector::part(id_dropdown-content){width:100%;max-height:200px}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown){width:inherit}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-button){padding:1rem;gap:1rem;justify-content:space-between}.time-period-selector.sc-time-period-selector select-dropdown.sc-time-period-selector::part(sd_dropdown-content){width:100%;max-height:200px}",u=h,m={hours:"hour",days:"day",weeks:"week",months:"month"},l=class{constructor(e){s.registerInstance(this,e),this.timePeriodChanged=s.createEvent(this,"timePeriodChanged",7),this.timePeriods=["hour","day","week","month"],this.defaultSelectedPeriod="hour",this.defaultSelectedNumber=1,this.selectedPeriod=this.defaultSelectedPeriod,this.selectedNumber=this.defaultSelectedNumber,this.numberOptions=this.calculateOptions(this.defaultSelectedPeriod||"hour").map(t=>({label:t.toString(),value:t.toString()})),this.timePeriodOptions=this.timePeriods.map(t=>({label:t,value:t}))}defaultSelectedPeriodChangedHandler(e){this.selectedPeriod=e;const t=m[e]??e;this.updateNumberOptionsAndSelectedNumber(t)}defaultSelectedNumberChangedHandler(e){this.selectedNumber=e}timePeriodsChangedHandler(e){this.timePeriodOptions=e.map(t=>({label:t,value:t}))}calculateOptions(e){switch(e){case"hour":return Array.from({length:23},(t,i)=>i+1);case"minute":return Array.from({length:13},(t,i)=>i*5);case"day":return Array.from({length:30},(t,i)=>i+1);case"week":return Array.from({length:4},(t,i)=>i+1);case"month":return Array.from({length:12},(t,i)=>i+1);default:return[]}}inputOptionChangedHandler(e){s.debug("time-period-selector","inputOptionChangedHandler",e.detail);const{value:t,name:i}=e.detail;i==="time-number"&&(this.selectedNumber=parseInt(t));const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}nylasFormDropdownChangedHandler(e){s.debug("time-period-selector","nylasFormDropdownChangedHandler",e.detail);const{value:t,name:i}=e.detail;i==="time-period"?(this.selectedPeriod=t,this.updateNumberOptionsAndSelectedNumber(t)):i==="time-number"&&(this.selectedNumber=parseInt(t));const o={number:this.selectedNumber,period:this.selectedPeriod};this.timePeriodChanged.emit(o)}updateNumberOptionsAndSelectedNumber(e){const t=this.calculateOptions(e);this.numberOptions=t.map(i=>({label:i.toString(),value:i.toString()})),this.selectedNumber=parseInt(this.numberOptions[0].value)}render(){return s.h("div",{key:"a4b421b31d77e41c8ef3c2a7533699a6cfaeb60c",class:"time-period-selector"},s.h("input-dropdown",{key:"b5f99b1d27195ad8fdc3617cf04e3fba3cfd49dd",id:"time-number",name:"time-number",inputValue:this.selectedNumber.toString(),exportparts:"sd_dropdown: tps__number-dropdown, sd_dropdown-button: tps__number-dropdown-button, sd_dropdown-content: tps__number-dropdown-content",options:this.numberOptions,defaultInputOption:this.numberOptions.find(e=>e.value==this.selectedNumber.toString())??this.numberOptions[0]}),s.h("select-dropdown",{key:"c06e213131979c07431ed1a6964bd0e0e2338b97",id:"time-period",name:"time-period",options:this.timePeriodOptions,exportparts:"sd_dropdown: tps__period-dropdown, sd_dropdown-button: tps__period-dropdown-button, sd_dropdown-content: tps__period-dropdown-content",pluralizedLabel:this.selectedNumber>1?"s":"",defaultSelectedOption:this.timePeriodOptions.find(e=>e.value==this.selectedPeriod)??this.timePeriodOptions[0],withSearch:!1}))}get host(){return s.getElement(this)}static get watchers(){return{defaultSelectedPeriod:["defaultSelectedPeriodChangedHandler"],defaultSelectedNumber:["defaultSelectedNumberChangedHandler"],timePeriods:["timePeriodsChangedHandler"]}}};l.style=u;exports.input_dropdown=a;exports.time_period_selector=l;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r as t, h as a } from "./index-812162da.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const i = ".wave{display:flex;align-items:center;justify-content:center}.dot{width:4px;height:4px;background-color:var(--dot-color, white);border-radius:50%;margin:0 2px;animation:wave 1.5s infinite ease-in-out}.dot:nth-child(2){animation-delay:0.2s}.dot:nth-child(3){animation-delay:0.4s}@keyframes wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-4px)}}", d = i, n = class {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
t(this, e), this.width = "15", this.height = "15";
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return a("div", { key: "5a2e1d7f211e17dba936c594398751951d2276e9", class: "wave" }, a("div", { key: "96caaecdcb309348f961ed43774eb89a2a87e635", class: "dot" }), a("div", { key: "f1f707f4a133dd12fa71a5ae13d864ce26b125d8", class: "dot" }), a("div", { key: "34df820811090a46234faf4b8b5ee1e033554d11", class: "dot" }));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
n.style = d;
|
|
13
|
+
export {
|
|
14
|
+
n as loading_icon
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-e3e9b594.cjs");require("react");require("react-dom");const i=".wave{display:flex;align-items:center;justify-content:center}.dot{width:4px;height:4px;background-color:var(--dot-color, white);border-radius:50%;margin:0 2px;animation:wave 1.5s infinite ease-in-out}.dot:nth-child(2){animation-delay:0.2s}.dot:nth-child(3){animation-delay:0.4s}@keyframes wave{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-4px)}}",n=i,t=class{constructor(a){e.registerInstance(this,a),this.width="15",this.height="15"}render(){return e.h("div",{key:"5a2e1d7f211e17dba936c594398751951d2276e9",class:"wave"},e.h("div",{key:"96caaecdcb309348f961ed43774eb89a2a87e635",class:"dot"}),e.h("div",{key:"f1f707f4a133dd12fa71a5ae13d864ce26b125d8",class:"dot"}),e.h("div",{key:"34df820811090a46234faf4b8b5ee1e033554d11",class:"dot"}))}};t.style=n;exports.loading_icon=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./index-769f0fdd.cjs"),i=require("./index.es-9cc0eb3c-e8de46e6.cjs");class g{constructor(t,e){this.nylasAuth=t,this.nylasAuthStore=e}async validateSession(){const t=await this.isAccessTokenValid();if(!t)this.logout();else{let e=await this.nylasAuth.getTokenInfo();if(e){const a=Math.floor(Date.now()/1e3);if(e.expires_in&&e.expires_in-a<3e5&&(n.debug("[NylasAuthConnectorMixin] Refreshing access token"),e=await this.nylasAuth.refreshAccessToken(),!e)){n.debug("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out."),this.logout();return}this.nylasAuthStore.state.tokenInfo=e}}this.nylasAuthStore.state.isAuthenticated=t}async isAuthenticated(){return this.nylasAuth.isAuthenticated()}async getTokenInfo(){return this.nylasAuth.getTokenInfo()}async isAccessTokenValid(){return this.nylasAuth.isAccessTokenValid()}async logout(){await this.nylasAuth.logout()}async getHostedAuthRedirectURL(t,e,s){return this.nylasAuth.getHostedAuthRedirectURL(t,e,s)}async manageHostedAuthCodeExchange(t){const s=new URL(t).searchParams.get("code");if(s){const a=await this.nylasAuth.exchangeAuthCodeForTokenInfo(s);if(a)return this.nylasAuthStore.state.tokenInfo=a,this.nylasAuthStore.state.isAuthenticated=!0,a}return null}}class f{constructor(t,e,s){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s}async getMessages(){var o;if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");this.nylasMailboxStore.state.state="loading";const t=this.nylasMailboxStore.state.messgeQueryParams,e=new URLSearchParams;for(const h in t){const u=(o=t[h])==null?void 0:o.toString();u&&e.append(h,u)}const s=`/v3/grants/me/messages?${e.toString()}`,a=await this.nylasAuth.nylasAPIRequest(s);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.messages=r,this.nylasMailboxStore.state.state="ready",r}async getThreadMessages(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=await this.nylasAuth.nylasAPIRequest(`/v3/grants/me/messages?thread_id=${t}&fields=include_headers`);if(i.Xr(e))throw new i.Zr(e.error);const s=e.data;return this.nylasMailboxStore.state.messages=s,s}downloadMessageAttachments(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=[],s=t.attachments||[];for(const a of s){const r=this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${a.id}?message_id=${t.id}`);e.push(r)}return e}async summarizeText(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=await this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/summarize","POST",{message:{body:t}},!0,this.nylasAuth.config.elementsApiUri);if(i.Xr(e))throw new i.Zr(e.error);return e.data.summary}async textToSpeech(t,e){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");return this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/tts","POST",{text:t},!1,this.nylasAuth.config.elementsApiUri,{...e?{signal:e==null?void 0:e.signal}:{}})}}class w{constructor(t,e,s,a){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s,this.router=a}async getThreads(t,e="overwrite",s=!0){var c;if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");s&&(this.nylasMailboxStore.state.state="loading");const a=t||this.nylasMailboxStore.state.threadsQueryParams,r=new URLSearchParams;for(const y in a){const d=(c=a[y])==null?void 0:c.toString();typeof d<"u"&&d!==null&&r.append(y,d)}a.search_query_native?this.router.navigate(`/?query=${a.search_query_native}`,!0):this.nylasMailboxStore.state.threadsQueryParams.search_query_native&&!a.search_query_native&&this.router.navigate("/",!0),a.page_token||(this.nylasMailboxStore.state.previousThreadPageTokens=[]),this.nylasMailboxStore.state.threadsQueryParams=a;const o=`/v3/grants/me/threads?${r.toString()}`,h=await this.nylasAuth.nylasAPIRequest(o);if(i.Xr(h))throw new i.Zr(h.error);const u=h.data;switch(e){case"prepend":this.nylasMailboxStore.state.threads=[...u,...this.nylasMailboxStore.state.threads];break;case"append":this.nylasMailboxStore.state.threads=[...this.nylasMailboxStore.state.threads,...u];break;case"overwrite":default:this.nylasMailboxStore.state.threads=u;break}return h.next_cursor?this.nylasMailboxStore.state.nextThreadPageToken=h.next_cursor:this.nylasMailboxStore.state.nextThreadPageToken=null,s&&(this.nylasMailboxStore.state.state="ready"),u}async getThread(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");const e=this.nylasMailboxStore.state.threads.find(o=>o.id===t);if(e)return e;this.nylasMailboxStore.state.state="loading";const s=`/v3/grants/me/threads/${t}`,a=await this.nylasAuth.nylasAPIRequest(s);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.threads=this.nylasMailboxStore.state.threads.map(o=>o.id===r.id?r:o),this.nylasMailboxStore.state.state="ready",r}async nextThreadPage(t="overwrite",e=!0){if(!this.nylasMailboxStore.state.nextThreadPageToken)throw new Error("No next page token");this.nylasMailboxStore.state.previousThreadPageTokens=Array.from(new Set([...this.nylasMailboxStore.state.previousThreadPageTokens,this.nylasMailboxStore.state.threadsQueryParams.page_token??null]));const s=this.nylasMailboxStore.state.nextThreadPageToken;return this.getThreads({...this.nylasMailboxStore.state.threadsQueryParams,page_token:s},t,e)}async previousThreadPage(t="overwrite",e=!0){if(!this.nylasMailboxStore.state.previousThreadPageTokens.length)throw new Error("No previous page token");const s=[...this.nylasMailboxStore.state.previousThreadPageTokens],a=s.pop();return this.nylasMailboxStore.state.previousThreadPageTokens=s,this.getThreads({...this.nylasMailboxStore.state.threadsQueryParams,page_token:a??void 0},t,e)}updateThreadQueryParams(t){this.nylasMailboxStore.state.threadsQueryParams={...this.nylasMailboxStore.state.threadsQueryParams,...t}}back(){this.router.navigate("/",!0),this.nylasMailboxStore.state.selectedThread=null}unSelectThread(){this.nylasMailboxStore.state.selectedThread=null}async selectThread(t){this.router.navigate(`/thread/${t.id}`,!0),this.nylasMailboxStore.state.selectedThread=t,t.unread&&this.markThreadAsRead(t).catch(e=>{n.debug("Error marking thread as read",e)})}async markThreadAsRead(t){return this.updateThread(t,{unread:!1})}async updateThread(t,e){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email","modify"))throw new Error("Missing thread:modify scope");const s=`/v3/grants/me/threads/${t.id}`,a=await this.nylasAuth.nylasAPIRequest(s,"PUT",e);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.threads=this.nylasMailboxStore.state.threads.map(o=>o.id===r.id?r:o),this.nylasMailboxStore.state.selectedThread=r,r}}class m{constructor(t,e,s){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s}async getFolders(){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");this.nylasMailboxStore.state.state="loading";const t="/v3/grants/me/folders",e=await this.nylasAuth.nylasAPIRequest(t);if(i.Xr(e))throw new i.Zr(e.error);const s=e.data;return this.nylasMailboxStore.state.folders=s,this.nylasMailboxStore.state.state="ready",s}async selectFolder(t){this.nylasMailboxStore.state.threadsQueryParams={in:t.id,...this.nylasMailboxStore.state.threadsQueryParams||{}}}}class p extends Event{constructor(t,e){super(t,e),this.oldURL=e.oldURL,this.newURL=e.newURL}}class S{constructor(){this.routeChangeListeners=[],n.debug("HashRouter constructor")}destroy(){n.debug("HashRouter destroy"),window.removeEventListener("hashchange",this.onRouteChange.bind(this))}init(){if(n.debug("HashRouter init"),window.addEventListener("hashchange",this.onRouteChange.bind(this)),typeof HashChangeEvent<"u"){const t=new HashChangeEvent("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}else{const t=new p("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}}addRouteChangeListener(t,e){n.debug("HashRouter addRouteChangeListener"),this.routeChangeListeners.push([t,e])}navigate(t,e){if(n.debug("HashRouter navigate"),e)return window.history.pushState(null,"",`#${t}`);window.location.hash=t}setRoute(t){n.debug("HashRouter setRoute"),window.location.hash=t}matchRoute(t,e){const s=t.split("/"),a=e.split("/");if(n.debug(`HashRouter matchRoute route=${t} path=${e}`,{routeParts:s,pathParts:a}),s[1]===""&&a[0]==="")return!0;if(s.length!==a.length)return!1;for(let r=0;r<s.length;r++){const o=s[r],h=a[r];if(!o.startsWith(":")&&o!==h)return!1}return!0}getRouteParams(t){n.debug("HashRouter getRouteParams");const e={},s=t.split("/"),a=window.location.hash.split("/");return s.forEach((r,o)=>{if(r.startsWith(":")){const h=r.substring(1);e[h]=a[o]}}),e}getRouteWithParams(t,e){n.debug("HashRouter getRouteWithParams");let s=t;return Object.keys(e).forEach(a=>{s=s.replace(`:${a}`,e[a])}),s}getRoute(){return n.debug("HashRouter getRoute"),window.location.hash}onRouteChange(t){this.routeChangeListeners.forEach(async([e,s])=>{const a=t.newURL.indexOf("#")===-1?"":t.newURL.substring(t.newURL.indexOf("#")+1);if(n.debug(`HashRouter onRouteChange route=${e} path=${a}`,{event:t}),!this.matchRoute(e,a)){n.debug(`HashRouter onRouteChange route=${e} path=${a} does not match`);return}const r=this.getRouteParams(e);await s(e,a,r)})}getBasePath(){return n.debug("HashRouter getBasePath"),""}}function A(l={}){const t={isAuthenticated:!1,tokenInfo:null,state:"ready",...l},e=n.createStore(t);return e.reset=()=>{for(const s in t){const a=t[s];e.set(s,a)}},e}function x(l={}){const t={state:"ready",messages:[],threads:[],folders:[],selectedThread:null,nextThreadPageToken:null,previousThreadPageTokens:[],searchQuery:"",hasNextThreadPage:!1,hasPreviousThreadPage:!1,selectedFolder:"inbox",threadsQueryParams:{in:"inbox"},messgeQueryParams:{fields:"include_headers"},...l},e=n.createStore({...t});return e.onChange("nextThreadPageToken",s=>{e.set("hasNextThreadPage",s!==null)}),e.onChange("previousThreadPageTokens",s=>{e.set("hasPreviousThreadPage",s.length>0)}),e.onChange("threadsQueryParams",s=>{e.set("selectedFolder",s.in||"inbox"),e.set("searchQuery",s.search_query_native||"")}),e.reset=()=>{for(const s in t){const a=t[s];e.set(s,a)}},e}exports.CreateNylasAuthStore=A;exports.CreateNylasMailboxStore=x;exports.HashRouter=S;exports.NylasAuthConnector=g;exports.NylasFoldersConnector=m;exports.NylasMessagesConnector=f;exports.NylasThreadsConnector=w;
|
|
1
|
+
"use strict";const n=require("./index-e3e9b594.cjs"),i=require("./index.es-9cc0eb3c-0c99c055.cjs");class g{constructor(t,e){this.nylasAuth=t,this.nylasAuthStore=e}async validateSession(){const t=await this.isAccessTokenValid();if(!t)this.logout();else{let e=await this.nylasAuth.getTokenInfo();if(e){const a=Math.floor(Date.now()/1e3);if(e.expires_in&&e.expires_in-a<3e5&&(n.debug("[NylasAuthConnectorMixin] Refreshing access token"),e=await this.nylasAuth.refreshAccessToken(),!e)){n.debug("[NylasAuthConnectorMixin] Token is expired and could not be refreshed. Logging out."),this.logout();return}this.nylasAuthStore.state.tokenInfo=e}}this.nylasAuthStore.state.isAuthenticated=t}async isAuthenticated(){return this.nylasAuth.isAuthenticated()}async getTokenInfo(){return this.nylasAuth.getTokenInfo()}async isAccessTokenValid(){return this.nylasAuth.isAccessTokenValid()}async logout(){await this.nylasAuth.logout()}async getHostedAuthRedirectURL(t,e,s){return this.nylasAuth.getHostedAuthRedirectURL(t,e,s)}async manageHostedAuthCodeExchange(t){const s=new URL(t).searchParams.get("code");if(s){const a=await this.nylasAuth.exchangeAuthCodeForTokenInfo(s);if(a)return this.nylasAuthStore.state.tokenInfo=a,this.nylasAuthStore.state.isAuthenticated=!0,a}return null}}class f{constructor(t,e,s){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s}async getMessages(){var o;if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");this.nylasMailboxStore.state.state="loading";const t=this.nylasMailboxStore.state.messgeQueryParams,e=new URLSearchParams;for(const h in t){const u=(o=t[h])==null?void 0:o.toString();u&&e.append(h,u)}const s=`/v3/grants/me/messages?${e.toString()}`,a=await this.nylasAuth.nylasAPIRequest(s);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.messages=r,this.nylasMailboxStore.state.state="ready",r}async getThreadMessages(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=await this.nylasAuth.nylasAPIRequest(`/v3/grants/me/messages?thread_id=${t}&fields=include_headers`);if(i.Xr(e))throw new i.Zr(e.error);const s=e.data;return this.nylasMailboxStore.state.messages=s,s}downloadMessageAttachments(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=[],s=t.attachments||[];for(const a of s){const r=this.nylasAuth.nylasDownloadFileRequest(`/v3/grants/me/attachments/${a.id}?message_id=${t.id}`);e.push(r)}return e}async summarizeText(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");const e=await this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/summarize","POST",{message:{body:t}},!0,this.nylasAuth.config.elementsApiUri);if(i.Xr(e))throw new i.Zr(e.error);return e.data.summary}async textToSpeech(t,e){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing message:read-only scope");return this.nylasAuth.nylasAPIRequest("/v3/grants/me/mailbox/tts","POST",{text:t},!1,this.nylasAuth.config.elementsApiUri,{...e?{signal:e==null?void 0:e.signal}:{}})}}class w{constructor(t,e,s,a){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s,this.router=a}async getThreads(t,e="overwrite",s=!0){var c;if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");s&&(this.nylasMailboxStore.state.state="loading");const a=t||this.nylasMailboxStore.state.threadsQueryParams,r=new URLSearchParams;for(const y in a){const d=(c=a[y])==null?void 0:c.toString();typeof d<"u"&&d!==null&&r.append(y,d)}a.search_query_native?this.router.navigate(`/?query=${a.search_query_native}`,!0):this.nylasMailboxStore.state.threadsQueryParams.search_query_native&&!a.search_query_native&&this.router.navigate("/",!0),a.page_token||(this.nylasMailboxStore.state.previousThreadPageTokens=[]),this.nylasMailboxStore.state.threadsQueryParams=a;const o=`/v3/grants/me/threads?${r.toString()}`,h=await this.nylasAuth.nylasAPIRequest(o);if(i.Xr(h))throw new i.Zr(h.error);const u=h.data;switch(e){case"prepend":this.nylasMailboxStore.state.threads=[...u,...this.nylasMailboxStore.state.threads];break;case"append":this.nylasMailboxStore.state.threads=[...this.nylasMailboxStore.state.threads,...u];break;case"overwrite":default:this.nylasMailboxStore.state.threads=u;break}return h.next_cursor?this.nylasMailboxStore.state.nextThreadPageToken=h.next_cursor:this.nylasMailboxStore.state.nextThreadPageToken=null,s&&(this.nylasMailboxStore.state.state="ready"),u}async getThread(t){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");const e=this.nylasMailboxStore.state.threads.find(o=>o.id===t);if(e)return e;this.nylasMailboxStore.state.state="loading";const s=`/v3/grants/me/threads/${t}`,a=await this.nylasAuth.nylasAPIRequest(s);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.threads=this.nylasMailboxStore.state.threads.map(o=>o.id===r.id?r:o),this.nylasMailboxStore.state.state="ready",r}async nextThreadPage(t="overwrite",e=!0){if(!this.nylasMailboxStore.state.nextThreadPageToken)throw new Error("No next page token");this.nylasMailboxStore.state.previousThreadPageTokens=Array.from(new Set([...this.nylasMailboxStore.state.previousThreadPageTokens,this.nylasMailboxStore.state.threadsQueryParams.page_token??null]));const s=this.nylasMailboxStore.state.nextThreadPageToken;return this.getThreads({...this.nylasMailboxStore.state.threadsQueryParams,page_token:s},t,e)}async previousThreadPage(t="overwrite",e=!0){if(!this.nylasMailboxStore.state.previousThreadPageTokens.length)throw new Error("No previous page token");const s=[...this.nylasMailboxStore.state.previousThreadPageTokens],a=s.pop();return this.nylasMailboxStore.state.previousThreadPageTokens=s,this.getThreads({...this.nylasMailboxStore.state.threadsQueryParams,page_token:a??void 0},t,e)}updateThreadQueryParams(t){this.nylasMailboxStore.state.threadsQueryParams={...this.nylasMailboxStore.state.threadsQueryParams,...t}}back(){this.router.navigate("/",!0),this.nylasMailboxStore.state.selectedThread=null}unSelectThread(){this.nylasMailboxStore.state.selectedThread=null}async selectThread(t){this.router.navigate(`/thread/${t.id}`,!0),this.nylasMailboxStore.state.selectedThread=t,t.unread&&this.markThreadAsRead(t).catch(e=>{n.debug("Error marking thread as read",e)})}async markThreadAsRead(t){return this.updateThread(t,{unread:!1})}async updateThread(t,e){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email","modify"))throw new Error("Missing thread:modify scope");const s=`/v3/grants/me/threads/${t.id}`,a=await this.nylasAuth.nylasAPIRequest(s,"PUT",e);if(i.Xr(a))throw new i.Zr(a.error);const r=a.data;return this.nylasMailboxStore.state.threads=this.nylasMailboxStore.state.threads.map(o=>o.id===r.id?r:o),this.nylasMailboxStore.state.selectedThread=r,r}}class m{constructor(t,e,s){this.nylasAuth=t,this.nylasAuthStore=e,this.nylasMailboxStore=s}async getFolders(){if(!this.nylasAuthStore.state.isAuthenticated)throw new Error("Not authenticated");if(!this.nylasAuth.hasScopeByType("email",["read-only","modify"]))throw new Error("Missing thread:read-only scope");this.nylasMailboxStore.state.state="loading";const t="/v3/grants/me/folders",e=await this.nylasAuth.nylasAPIRequest(t);if(i.Xr(e))throw new i.Zr(e.error);const s=e.data;return this.nylasMailboxStore.state.folders=s,this.nylasMailboxStore.state.state="ready",s}async selectFolder(t){this.nylasMailboxStore.state.threadsQueryParams={in:t.id,...this.nylasMailboxStore.state.threadsQueryParams||{}}}}class p extends Event{constructor(t,e){super(t,e),this.oldURL=e.oldURL,this.newURL=e.newURL}}class S{constructor(){this.routeChangeListeners=[],n.debug("HashRouter constructor")}destroy(){n.debug("HashRouter destroy"),window.removeEventListener("hashchange",this.onRouteChange.bind(this))}init(){if(n.debug("HashRouter init"),window.addEventListener("hashchange",this.onRouteChange.bind(this)),typeof HashChangeEvent<"u"){const t=new HashChangeEvent("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}else{const t=new p("hashchange",{oldURL:"",newURL:window.location.href});this.onRouteChange(t)}}addRouteChangeListener(t,e){n.debug("HashRouter addRouteChangeListener"),this.routeChangeListeners.push([t,e])}navigate(t,e){if(n.debug("HashRouter navigate"),e)return window.history.pushState(null,"",`#${t}`);window.location.hash=t}setRoute(t){n.debug("HashRouter setRoute"),window.location.hash=t}matchRoute(t,e){const s=t.split("/"),a=e.split("/");if(n.debug(`HashRouter matchRoute route=${t} path=${e}`,{routeParts:s,pathParts:a}),s[1]===""&&a[0]==="")return!0;if(s.length!==a.length)return!1;for(let r=0;r<s.length;r++){const o=s[r],h=a[r];if(!o.startsWith(":")&&o!==h)return!1}return!0}getRouteParams(t){n.debug("HashRouter getRouteParams");const e={},s=t.split("/"),a=window.location.hash.split("/");return s.forEach((r,o)=>{if(r.startsWith(":")){const h=r.substring(1);e[h]=a[o]}}),e}getRouteWithParams(t,e){n.debug("HashRouter getRouteWithParams");let s=t;return Object.keys(e).forEach(a=>{s=s.replace(`:${a}`,e[a])}),s}getRoute(){return n.debug("HashRouter getRoute"),window.location.hash}onRouteChange(t){this.routeChangeListeners.forEach(async([e,s])=>{const a=t.newURL.indexOf("#")===-1?"":t.newURL.substring(t.newURL.indexOf("#")+1);if(n.debug(`HashRouter onRouteChange route=${e} path=${a}`,{event:t}),!this.matchRoute(e,a)){n.debug(`HashRouter onRouteChange route=${e} path=${a} does not match`);return}const r=this.getRouteParams(e);await s(e,a,r)})}getBasePath(){return n.debug("HashRouter getBasePath"),""}}function A(l={}){const t={isAuthenticated:!1,tokenInfo:null,state:"ready",...l},e=n.createStore(t);return e.reset=()=>{for(const s in t){const a=t[s];e.set(s,a)}},e}function x(l={}){const t={state:"ready",messages:[],threads:[],folders:[],selectedThread:null,nextThreadPageToken:null,previousThreadPageTokens:[],searchQuery:"",hasNextThreadPage:!1,hasPreviousThreadPage:!1,selectedFolder:"inbox",threadsQueryParams:{in:"inbox"},messgeQueryParams:{fields:"include_headers"},...l},e=n.createStore({...t});return e.onChange("nextThreadPageToken",s=>{e.set("hasNextThreadPage",s!==null)}),e.onChange("previousThreadPageTokens",s=>{e.set("hasPreviousThreadPage",s.length>0)}),e.onChange("threadsQueryParams",s=>{e.set("selectedFolder",s.in||"inbox"),e.set("searchQuery",s.search_query_native||"")}),e.reset=()=>{for(const s in t){const a=t[s];e.set(s,a)}},e}exports.CreateNylasAuthStore=A;exports.CreateNylasMailboxStore=x;exports.HashRouter=S;exports.NylasAuthConnector=g;exports.NylasFoldersConnector=m;exports.NylasMessagesConnector=f;exports.NylasThreadsConnector=w;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as o, e as f } from "./index-
|
|
2
|
-
import { X as u, Z as d } from "./index.es-9cc0eb3c-
|
|
1
|
+
import { d as o, e as f } from "./index-812162da.js";
|
|
2
|
+
import { X as u, Z as d } from "./index.es-9cc0eb3c-52226859.js";
|
|
3
3
|
class S {
|
|
4
4
|
constructor(t, e) {
|
|
5
5
|
this.nylasAuth = t, this.nylasAuthStore = e;
|