{"version":3,"file":"AddToCalendar.nf9vPybd.mjs","names":["calendarLinks","startDate","title"],"sources":["https:/framerusercontent.com/modules/LWc8oFskVVWy3Hp6Jb55/F1kZvrtkgLAOZha9ltAi/AddToCalendar.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";const containerStyle={height:\"100%\",display:\"inline-flex\",flexWrap:\"wrap\",justifyContent:\"center\",overflow:\"hidden\",gap:8};const actionStyle={border:\"1px solid rgb(231, 233, 232)\",borderRadius:\"8px\",padding:\"8px\",backgroundColor:\"white\",width:\"36px\",height:\"36px\"};const imageStyle={width:\"100%\",height:\"100%\",objectFit:\"contain\"};export default function AddToCalendar(props){const{text,service,title,description,startDate,startTime,end,timezone,backgroundColor,color,style}=props;const combineDateTime=(date,time)=>{return new Date(`${date}T${time}:00`);};const generateCalendarLinks=()=>{const formattedStartDate=combineDateTime(props.startDate,props.startTime);const formattedEndDate=combineDateTime(props.endDate,props.endTime);const eventData={title:props.title,date_raw:{start:formattedStartDate.toISOString(),end:props.endDate&&props.endTime?formattedEndDate.toISOString():new Date(formattedStartDate.getTime()+2*60*60*1e3).toISOString()},location:props.isOnline&&props.zoomUrl?props.zoomUrl:props.location,isOnline:props.isOnline,zoomUrl:props.ZoomURL||\"\"};let calendarLinks={google:\"#\",outlook:\"#\",office:\"#\",yahoo:\"#\",aol:\"#\",ics:\"#\"};// Parse dates from Notion date object\nconst startDate=new Date(eventData.date_raw.start);const endDate=eventData.date_raw.end?new Date(eventData.date_raw.end):new Date(startDate.getTime()+2*60*60*1e3)// Default 2 hours duration if no end time\n;// Format dates for calendar URLs (YYYYMMDDTHHMMSSZ format)\nconst formatDateForCalendar=date=>{return date.toISOString().replace(/-|:|\\.\\d+/g,\"\");};// Format dates for Outlook (ISO format with specific formatting)\nconst formatDateForOutlook=date=>{return date.toISOString().replace(/\\.\\d+Z$/,\"+00:00\");};const startFormatted=formatDateForCalendar(startDate);const endFormatted=formatDateForCalendar(endDate);const startOutlook=formatDateForOutlook(startDate);const endOutlook=formatDateForOutlook(endDate);// Prepare event details\nconst title=encodeURIComponent(eventData.title);// Set location to Zoom URL for online events if available\nlet location;if(eventData.isOnline&&eventData.zoomUrl){location=encodeURIComponent(eventData.zoomUrl);}else{location=encodeURIComponent(eventData.location);}// Create event details including Zoom link when available\nlet detailsText=`Event: ${eventData.title}\nLocation: ${eventData.isOnline?\"Online\":eventData.location}`;// Add Zoom link to details if it exists\nif(eventData.isOnline&&eventData.zoomUrl){detailsText+=`\nZoom Link: ${eventData.zoomUrl}`;}const details=encodeURIComponent(detailsText);// Google Calendar URL\ncalendarLinks.google=`https://calendar.google.com/calendar/render?action=TEMPLATE&dates=${startFormatted}%2F${endFormatted}&details=${details}&location=${location}&text=${title}`;// Outlook.com Calendar URL\ncalendarLinks.outlook=`https://outlook.live.com/calendar/0/deeplink/compose?body=${details}&enddt=${endOutlook}&location=${location}&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=${startOutlook}&subject=${title}`;// Office 365 Outlook Calendar URL\ncalendarLinks.office=`https://outlook.office.com/calendar/0/deeplink/compose?body=${details}&enddt=${endOutlook}&location=${location}&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=${startOutlook}&subject=${title}`;// Yahoo Calendar URL\ncalendarLinks.yahoo=`https://calendar.yahoo.com/?desc=${details}&dur=&et=${endFormatted}&in_loc=${location}&st=${startFormatted}&title=${title}&v=60`;// AOL Calendar URL\ncalendarLinks.aol=`https://calendar.aol.com/?desc=${details}&dur=&et=${endFormatted}&in_loc=${location}&st=${startFormatted}&title=${title}&v=60`;// ICS file URL (can be implemented with a separate endpoint that generates ICS files)\n// For now, using Google Calendar as fallback\n// ICS file URL - create URL with query parameters for ICS generator worker\nconst icsParams=new URLSearchParams({title:eventData.title,start:eventData.date_raw.start,end:eventData.date_raw.end||new Date(startDate.getTime()+2*60*60*1e3).toISOString(),location:eventData.isOnline&&eventData.zoomUrl?eventData.zoomUrl:eventData.location,description:detailsText,isOnline:eventData.isOnline?\"true\":\"false\",zoomUrl:eventData.zoomUrl||\"\"});// Replace with your actual ICS generator worker URL\ncalendarLinks.ics=`https://event-ics-generator.leitmotiv.work/?${icsParams.toString()}`;return calendarLinks;};const calendarLinks=generateCalendarLinks();return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"a\",{style:actionStyle,href:calendarLinks.google,target:\"_blank\",children:/*#__PURE__*/_jsx(\"img\",{style:imageStyle,src:\"https://cdn.worldvectorlogo.com/logos/google-calendar-icon-2020-.svg\"})}),/*#__PURE__*/_jsx(\"a\",{style:actionStyle,href:calendarLinks.outlook,target:\"_blank\",children:/*#__PURE__*/_jsx(\"img\",{style:imageStyle,src:\"https://cdn.worldvectorlogo.com/logos/outlook-icon.svg\"})}),/*#__PURE__*/_jsx(\"a\",{style:actionStyle,href:calendarLinks.office,target:\"_blank\",children:/*#__PURE__*/_jsx(\"img\",{style:imageStyle,src:\"https://cdn.worldvectorlogo.com/logos/office-1.svg\"})}),/*#__PURE__*/_jsx(\"a\",{style:actionStyle,href:calendarLinks.yahoo,target:\"_blank\",children:/*#__PURE__*/_jsx(\"img\",{style:imageStyle,src:\"https://framerusercontent.com/images/bJMTRh1JzWtS5LUBybjg0TvqI.png\"})}),/*#__PURE__*/_jsx(\"a\",{style:actionStyle,href:calendarLinks.aol,target:\"_blank\",children:/*#__PURE__*/_jsx(\"img\",{style:imageStyle,src:\"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTxbgqw5a2_TQWdR5pKtXd_oxu4YJr5P6AzZQ&s\"})}),/*#__PURE__*/_jsx(\"a\",{style:actionStyle,href:calendarLinks.ics,target:\"_blank\",children:/*#__PURE__*/_jsx(\"img\",{style:imageStyle,src:\"https://cdn-icons-png.flaticon.com/512/28/28835.png\"})})]});}AddToCalendar.defaultProps={title:\"My Event\",startDate:\"2025-02-08\",startTime:\"10:00\",endDate:null,endTime:null,location:null,isOnline:false,zoomUrl:\"\"};addPropertyControls(AddToCalendar,{title:{type:ControlType.String,title:\"Title\"},startDate:{type:ControlType.String,title:\"Start Date (YYYY-MM-DD)\"},startTime:{type:ControlType.String,title:\"Start Time (HH:MM)\"},endDate:{type:ControlType.String,title:\"End Date (YYYY-MM-DD)\"},endTime:{type:ControlType.String,title:\"End Time (HH:MM)\"},location:{type:ControlType.String,title:\"Location\"},isOnline:{type:ControlType.Boolean,title:\"Online\"},zoomUrl:{type:ControlType.String,title:\"Zoom URL\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AddToCalendar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AddToCalendar.map"],"mappings":"wOAAwb,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,OAAK,UAAQ,QAAM,cAAY,YAAU,YAAU,MAAI,WAAS,kBAAgB,QAAM,SAAO,EAAY,GAAiB,EAAK,IAAe,IAAI,KAAK,GAAG,EAAK,GAAG,EAAK,KAAK,CAmBliB,OAnBqkB,CAAC,IAAM,EAAmB,EAAgB,EAAM,UAAU,EAAM,UAAU,CAAO,EAAiB,EAAgB,EAAM,QAAQ,EAAM,QAAQ,CAAO,EAAU,CAAC,MAAM,EAAM,MAAM,SAAS,CAAC,MAAM,EAAmB,aAAa,CAAC,IAAI,EAAM,SAAS,EAAM,QAAQ,EAAiB,aAAa,CAAC,IAAI,KAAK,EAAmB,SAAS,CAAC,KAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,EAAM,UAAU,EAAM,QAAQ,EAAM,QAAQ,EAAM,SAAS,SAAS,EAAM,SAAS,QAAQ,EAAM,SAAS,GAAG,CAAKA,EAAc,CAAC,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,CAC/tCC,EAAU,IAAI,KAAK,EAA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