@ebarooni/capacitor-calendar 7.2.0 → 7.3.0

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.
Files changed (264) hide show
  1. package/EbarooniCapacitorCalendar.podspec +1 -1
  2. package/Package.swift +2 -2
  3. package/README.md +901 -466
  4. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +57 -7
  5. package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +35 -19
  6. package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +312 -85
  7. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/CalendarEvent.kt +4 -0
  8. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventDeleteInfo.kt +8 -0
  9. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventRecurrenceRule.kt +135 -0
  10. package/android/src/main/java/dev/barooni/capacitor/calendar/models/enums/EventSpan.kt +13 -0
  11. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CheckPermissionInput.kt +0 -4
  12. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateCalendarInput.kt +3 -1
  13. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventInput.kt +1 -0
  14. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventWithPromptInput.kt +5 -0
  15. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteCalendarInput.kt +4 -1
  16. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventInput.kt +4 -1
  17. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventWithPromptInput.kt +4 -1
  18. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/DeleteEventsByIdInput.kt +2 -0
  19. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/GetDefaultCalendarInput.kt +9 -0
  20. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyCalendarInput.kt +10 -1
  21. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEvent.kt +3 -1
  22. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEventWithPromptInput.kt +3 -0
  23. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/RequestPermissionInput.kt +3 -5
  24. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CheckAllPermissionsResult.kt +3 -2
  25. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CreateEventResult.kt +1 -0
  26. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/CreateEventWithPromptResult.kt +1 -0
  27. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/GetDefaultCalendarResult.kt +1 -0
  28. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ListCalendarsResult.kt +1 -0
  29. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/ListEventsInRangeResult.kt +4 -0
  30. package/android/src/main/java/dev/barooni/capacitor/calendar/models/results/RequestAllPermissionsResult.kt +1 -1
  31. package/android/src/main/java/dev/barooni/capacitor/calendar/models/templates/PluginCompletion.kt +8 -0
  32. package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +468 -39
  33. package/dist/docs.json +3046 -1048
  34. package/dist/esm/definitions.d.ts +5 -5
  35. package/dist/esm/definitions.js.map +1 -1
  36. package/dist/esm/index.d.ts +71 -48
  37. package/dist/esm/index.js +17 -17
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/schemas/enums/attendee-role.js.map +1 -1
  40. package/dist/esm/schemas/enums/attendee-status.js.map +1 -1
  41. package/dist/esm/schemas/enums/attendee-type.js.map +1 -1
  42. package/dist/esm/schemas/enums/calendar-permission-scope.d.ts +9 -1
  43. package/dist/esm/schemas/enums/calendar-permission-scope.js +9 -1
  44. package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -1
  45. package/dist/esm/schemas/enums/event-span.d.ts +4 -0
  46. package/dist/esm/schemas/enums/event-span.js +4 -0
  47. package/dist/esm/schemas/enums/event-span.js.map +1 -1
  48. package/dist/esm/schemas/enums/event-status.js.map +1 -1
  49. package/dist/esm/schemas/enums/reminder-recurrence-frequency.d.ts +5 -5
  50. package/dist/esm/schemas/enums/reminder-recurrence-frequency.js +5 -5
  51. package/dist/esm/schemas/enums/reminder-recurrence-frequency.js.map +1 -1
  52. package/dist/esm/schemas/interfaces/calendar-event.d.ts +145 -70
  53. package/dist/esm/schemas/interfaces/calendar-event.js.map +1 -1
  54. package/dist/esm/schemas/interfaces/calendar-source.d.ts +4 -1
  55. package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -1
  56. package/dist/esm/schemas/interfaces/calendar.d.ts +22 -4
  57. package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
  58. package/dist/esm/schemas/interfaces/check-permission-options.d.ts +19 -0
  59. package/dist/esm/schemas/interfaces/check-permission-options.js +2 -0
  60. package/dist/esm/schemas/interfaces/check-permission-options.js.map +1 -0
  61. package/dist/esm/schemas/interfaces/create-calendar-options.d.ts +19 -6
  62. package/dist/esm/schemas/interfaces/create-calendar-options.js.map +1 -1
  63. package/dist/esm/schemas/interfaces/create-calendar-result.d.ts +12 -0
  64. package/dist/esm/schemas/interfaces/create-calendar-result.js +2 -0
  65. package/dist/esm/schemas/interfaces/create-calendar-result.js.map +1 -0
  66. package/dist/esm/schemas/interfaces/create-event-options.d.ts +86 -51
  67. package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
  68. package/dist/esm/schemas/interfaces/create-event-result.d.ts +22 -0
  69. package/dist/esm/schemas/interfaces/create-event-result.js +2 -0
  70. package/dist/esm/schemas/interfaces/create-event-result.js.map +1 -0
  71. package/dist/esm/schemas/interfaces/create-event-with-prompt-options.d.ts +73 -36
  72. package/dist/esm/schemas/interfaces/create-event-with-prompt-options.js.map +1 -1
  73. package/dist/esm/schemas/interfaces/create-event-with-prompt-result.d.ts +23 -0
  74. package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js +2 -0
  75. package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js.map +1 -0
  76. package/dist/esm/schemas/interfaces/create-reminder-options.d.ts +42 -12
  77. package/dist/esm/schemas/interfaces/create-reminder-options.js.map +1 -1
  78. package/dist/esm/schemas/interfaces/create-reminder-result.d.ts +12 -0
  79. package/dist/esm/schemas/interfaces/create-reminder-result.js +2 -0
  80. package/dist/esm/schemas/interfaces/create-reminder-result.js.map +1 -0
  81. package/dist/esm/schemas/interfaces/create-reminders-list-options.d.ts +46 -0
  82. package/dist/esm/schemas/interfaces/create-reminders-list-options.js +2 -0
  83. package/dist/esm/schemas/interfaces/create-reminders-list-options.js.map +1 -0
  84. package/dist/esm/schemas/interfaces/create-reminders-list-result.d.ts +12 -0
  85. package/dist/esm/schemas/interfaces/create-reminders-list-result.js +2 -0
  86. package/dist/esm/schemas/interfaces/create-reminders-list-result.js.map +1 -0
  87. package/dist/esm/schemas/interfaces/delete-calendar-options.d.ts +1 -0
  88. package/dist/esm/schemas/interfaces/delete-calendar-options.js.map +1 -1
  89. package/dist/esm/schemas/interfaces/delete-event-options.d.ts +29 -4
  90. package/dist/esm/schemas/interfaces/delete-event-options.js.map +1 -1
  91. package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.d.ts +39 -14
  92. package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.js.map +1 -1
  93. package/dist/esm/schemas/interfaces/delete-events-by-id-options.d.ts +16 -4
  94. package/dist/esm/schemas/interfaces/delete-events-by-id-options.js.map +1 -1
  95. package/dist/esm/schemas/interfaces/delete-reminder-options.d.ts +10 -0
  96. package/dist/esm/schemas/interfaces/delete-reminder-options.js.map +1 -1
  97. package/dist/esm/schemas/interfaces/delete-reminder-with-prompt-result.d.ts +12 -0
  98. package/dist/esm/schemas/interfaces/delete-reminder-with-prompt-result.js +2 -0
  99. package/dist/esm/schemas/interfaces/delete-reminder-with-prompt-result.js.map +1 -0
  100. package/dist/esm/schemas/interfaces/delete-reminders-by-id-result.d.ts +13 -0
  101. package/dist/esm/schemas/interfaces/delete-reminders-by-id-result.js +2 -0
  102. package/dist/esm/schemas/interfaces/delete-reminders-by-id-result.js.map +1 -0
  103. package/dist/esm/schemas/interfaces/delete-reminders-list-options.d.ts +23 -0
  104. package/dist/esm/schemas/interfaces/delete-reminders-list-options.js +2 -0
  105. package/dist/esm/schemas/interfaces/delete-reminders-list-options.js.map +1 -0
  106. package/dist/esm/schemas/interfaces/event-recurrence-rule.d.ts +96 -0
  107. package/dist/esm/schemas/interfaces/event-recurrence-rule.js +2 -0
  108. package/dist/esm/schemas/interfaces/event-recurrence-rule.js.map +1 -0
  109. package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.d.ts +13 -0
  110. package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.js +2 -0
  111. package/dist/esm/schemas/interfaces/fetch-all-calendar-sources-result.js.map +1 -0
  112. package/dist/esm/schemas/interfaces/get-default-calendar-options.d.ts +13 -0
  113. package/dist/esm/schemas/interfaces/get-default-calendar-options.js +2 -0
  114. package/dist/esm/schemas/interfaces/get-default-calendar-options.js.map +1 -0
  115. package/dist/esm/schemas/interfaces/get-default-reminders-list-result.d.ts +13 -0
  116. package/dist/esm/schemas/interfaces/get-default-reminders-list-result.js +2 -0
  117. package/dist/esm/schemas/interfaces/get-default-reminders-list-result.js.map +1 -0
  118. package/dist/esm/schemas/interfaces/get-reminder-by-id-result.d.ts +13 -0
  119. package/dist/esm/schemas/interfaces/get-reminder-by-id-result.js +2 -0
  120. package/dist/esm/schemas/interfaces/get-reminder-by-id-result.js.map +1 -0
  121. package/dist/esm/schemas/interfaces/get-reminders-from-lists-result.d.ts +13 -0
  122. package/dist/esm/schemas/interfaces/get-reminders-from-lists-result.js +2 -0
  123. package/dist/esm/schemas/interfaces/get-reminders-from-lists-result.js.map +1 -0
  124. package/dist/esm/schemas/interfaces/get-reminders-lists-result.d.ts +13 -0
  125. package/dist/esm/schemas/interfaces/get-reminders-lists-result.js +2 -0
  126. package/dist/esm/schemas/interfaces/get-reminders-lists-result.js.map +1 -0
  127. package/dist/esm/schemas/interfaces/list-calendars-result.d.ts +13 -0
  128. package/dist/esm/schemas/interfaces/list-calendars-result.js +2 -0
  129. package/dist/esm/schemas/interfaces/list-calendars-result.js.map +1 -0
  130. package/dist/esm/schemas/interfaces/list-events-in-range-options.d.ts +7 -2
  131. package/dist/esm/schemas/interfaces/list-events-in-range-options.js.map +1 -1
  132. package/dist/esm/schemas/interfaces/list-events-in-range-result.d.ts +13 -0
  133. package/dist/esm/schemas/interfaces/list-events-in-range-result.js +2 -0
  134. package/dist/esm/schemas/interfaces/list-events-in-range-result.js.map +1 -0
  135. package/dist/esm/schemas/interfaces/modify-calendar-options.d.ts +13 -2
  136. package/dist/esm/schemas/interfaces/modify-calendar-options.js.map +1 -1
  137. package/dist/esm/schemas/interfaces/modify-event-options.d.ts +61 -44
  138. package/dist/esm/schemas/interfaces/modify-event-options.js.map +1 -1
  139. package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.d.ts +77 -2
  140. package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.js.map +1 -1
  141. package/dist/esm/schemas/interfaces/modify-reminder-options.d.ts +77 -13
  142. package/dist/esm/schemas/interfaces/modify-reminder-options.js.map +1 -1
  143. package/dist/esm/schemas/interfaces/open-calendar-options.d.ts +5 -1
  144. package/dist/esm/schemas/interfaces/open-calendar-options.js.map +1 -1
  145. package/dist/esm/schemas/interfaces/recurrence-rule.d.ts +8 -2
  146. package/dist/esm/schemas/interfaces/recurrence-rule.js.map +1 -1
  147. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +1 -1
  148. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -1
  149. package/dist/esm/schemas/interfaces/reminder.d.ts +4 -1
  150. package/dist/esm/schemas/interfaces/reminder.js.map +1 -1
  151. package/dist/esm/schemas/interfaces/reminders-list.d.ts +8 -2
  152. package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
  153. package/dist/esm/schemas/interfaces/request-permission-options.d.ts +16 -0
  154. package/dist/esm/schemas/interfaces/request-permission-options.js +2 -0
  155. package/dist/esm/schemas/interfaces/request-permission-options.js.map +1 -0
  156. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.d.ts +1 -1
  157. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.js.map +1 -1
  158. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.d.ts +14 -0
  159. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.js +2 -0
  160. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-result.js.map +1 -0
  161. package/dist/esm/schemas/interfaces/update-reminders-list-options.d.ts +43 -0
  162. package/dist/esm/schemas/interfaces/update-reminders-list-options.js +2 -0
  163. package/dist/esm/schemas/interfaces/update-reminders-list-options.js.map +1 -0
  164. package/dist/esm/schemas/interfaces/update-reminders-list-result.d.ts +12 -0
  165. package/dist/esm/schemas/interfaces/update-reminders-list-result.js +2 -0
  166. package/dist/esm/schemas/interfaces/update-reminders-list-result.js.map +1 -0
  167. package/dist/esm/schemas/types/event-edit-action.d.ts +1 -1
  168. package/dist/esm/schemas/types/event-edit-action.js.map +1 -1
  169. package/dist/esm/schemas/types/recurrence-frequency.d.ts +4 -0
  170. package/dist/esm/schemas/types/recurrence-frequency.js +2 -0
  171. package/dist/esm/schemas/types/recurrence-frequency.js.map +1 -0
  172. package/dist/esm/schemas/types/system-color-name.d.ts +6 -0
  173. package/dist/esm/schemas/types/system-color-name.js +2 -0
  174. package/dist/esm/schemas/types/system-color-name.js.map +1 -0
  175. package/dist/esm/sub-definitions/calendar-access.d.ts +26 -14
  176. package/dist/esm/sub-definitions/calendar-access.js.map +1 -1
  177. package/dist/esm/sub-definitions/calendar-operations.d.ts +68 -21
  178. package/dist/esm/sub-definitions/calendar-operations.js.map +1 -1
  179. package/dist/esm/sub-definitions/event-operations.d.ts +46 -25
  180. package/dist/esm/sub-definitions/event-operations.js.map +1 -1
  181. package/dist/esm/sub-definitions/reminders-access.d.ts +6 -2
  182. package/dist/esm/sub-definitions/reminders-access.js.map +1 -1
  183. package/dist/esm/sub-definitions/reminders-operations.d.ts +78 -43
  184. package/dist/esm/sub-definitions/reminders-operations.js.map +1 -1
  185. package/dist/esm/web/download-ics-file.d.ts +18 -0
  186. package/dist/esm/web/download-ics-file.js +33 -0
  187. package/dist/esm/web/download-ics-file.js.map +1 -0
  188. package/dist/esm/web/ics.d.ts +27 -0
  189. package/dist/esm/web/ics.js +294 -0
  190. package/dist/esm/web/ics.js.map +1 -0
  191. package/dist/esm/web.d.ts +70 -82
  192. package/dist/esm/web.js +121 -6
  193. package/dist/esm/web.js.map +1 -1
  194. package/dist/plugin.cjs.js +464 -35
  195. package/dist/plugin.cjs.js.map +1 -1
  196. package/dist/plugin.js +464 -35
  197. package/dist/plugin.js.map +1 -1
  198. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/CapacitorCalendarPlugin.swift +148 -81
  199. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Implementation/CapacitorCalendar.swift +203 -110
  200. package/ios/Plugin/Info.plist +24 -0
  201. package/ios/Plugin/Models/Enums/EventSpan.swift +8 -0
  202. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateCalendarInput.swift +6 -4
  203. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateEventInput.swift +25 -21
  204. package/ios/Plugin/Models/Inputs/CreateEventWithPromptInput.swift +171 -0
  205. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateReminderInput.swift +14 -4
  206. package/ios/Plugin/Models/Inputs/CreateRemindersListInput.swift +43 -0
  207. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteCalendarInput.swift +1 -1
  208. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventInput.swift +9 -4
  209. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventWithPromptInput.swift +9 -4
  210. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventsByIdInput.swift +9 -4
  211. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteReminderInput.swift +7 -1
  212. package/ios/Plugin/Models/Inputs/DeleteRemindersListInput.swift +22 -0
  213. package/ios/Plugin/Models/Inputs/GetDefaultCalendarInput.swift +13 -0
  214. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyCalendarInput.swift +6 -3
  215. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyEventInput.swift +63 -41
  216. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyReminderInput.swift +66 -5
  217. package/ios/Plugin/Models/Inputs/UpdateRemindersListInput.swift +41 -0
  218. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateEventResult.swift +1 -0
  219. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateEventWithPromptResult.swift +1 -0
  220. package/ios/Plugin/Models/Results/CreateRemindersListResult.swift +15 -0
  221. package/ios/Plugin/Models/Results/ListEventsInRangeResult.swift +29 -0
  222. package/ios/Plugin/Models/Results/UpdateRemindersListResult.swift +15 -0
  223. package/ios/Plugin/Models/Structs/RecurrenceInput.swift +41 -0
  224. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/PluginConfig.swift +30 -27
  225. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/PluginError.swift +74 -56
  226. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Utils/ImplementationHelper.swift +140 -24
  227. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Utils/UIColorFromHexExtension.swift +5 -0
  228. package/package.json +36 -43
  229. package/dist/esm/schemas/enums/recurrence-frequency.d.ts +0 -21
  230. package/dist/esm/schemas/enums/recurrence-frequency.js +0 -23
  231. package/dist/esm/schemas/enums/recurrence-frequency.js.map +0 -1
  232. package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateEventWithPromptInput.swift +0 -89
  233. package/ios/Sources/CapacitorCalendarPlugin/Models/Results/ListEventsInRangeResult.swift +0 -16
  234. package/ios/Tests/CapacitorCalendarPluginTests/CapacitorCalendarPluginTests.swift +0 -15
  235. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/CAPPermissionState.swift +0 -0
  236. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/CalendarPermissionScope.swift +0 -0
  237. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/EventEditAction.swift +0 -0
  238. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CheckPermissionInput.swift +0 -0
  239. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteReminderWithPromptInput.swift +0 -0
  240. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteRemindersByIdInput.swift +0 -0
  241. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/GetReminderByIdInput.swift +0 -0
  242. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/GetRemindersFromListsInput.swift +0 -0
  243. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ListEventsInRangeInput.swift +0 -0
  244. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyEventWithPromptInput.swift +0 -0
  245. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/OpenCalendarInput.swift +0 -0
  246. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/RequestPermissionInput.swift +0 -0
  247. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/SelectCalendarsWithPromptInput.swift +0 -0
  248. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CheckAllPermissionsResult.swift +0 -0
  249. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CheckPermissionResult.swift +0 -0
  250. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateCalendarResult.swift +0 -0
  251. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateReminderResult.swift +0 -0
  252. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteEventWithPromptResult.swift +0 -0
  253. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteEventsByIdResult.swift +0 -0
  254. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteRemindersByIdResult.swift +0 -0
  255. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/FetchAllCalendarSourcesResult.swift +0 -0
  256. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetDefaultCalendarResult.swift +0 -0
  257. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetReminderByIdResult.swift +0 -0
  258. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetRemindersFromListsResult.swift +0 -0
  259. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ListCalendarsResult.swift +0 -0
  260. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ModifyEventWithPromptResult.swift +0 -0
  261. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/RequestAllPermissionsResult.swift +0 -0
  262. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/RequestPermissionResult.swift +0 -0
  263. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/SelectCalendarsWithPromptResult.swift +0 -0
  264. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Templates/JSResult.swift +0 -0
@@ -197,11 +197,15 @@ exports.CalendarPermissionScope = void 0;
197
197
  /**
198
198
  * Permission required for reading reminders.
199
199
  *
200
+ * On Android, reminders are not supported. `checkPermission` and
201
+ * `checkAllPermissions` return `"prompt"` for this scope.
202
+ * `requestPermission` rejects with `Invalid scope.`.
203
+ *
200
204
  * @permissions
201
205
  * | Platform | Required |
202
206
  * |-----------|---------------------|
203
207
  * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |
204
- * | iOS 10-16 | `NSRemindersUsageDescription` |
208
+ * | iOS 13-16 | `NSRemindersUsageDescription` |
205
209
  * @platform iOS
206
210
  * @since 7.1.0
207
211
  */
@@ -223,6 +227,10 @@ exports.CalendarPermissionScope = void 0;
223
227
  /**
224
228
  * Permission required for adding or modifying reminders.
225
229
  *
230
+ * On Android, reminders are not supported. `checkPermission` and
231
+ * `checkAllPermissions` return `"prompt"` for this scope.
232
+ * `requestPermission` rejects with `Invalid scope.`.
233
+ *
226
234
  * @permissions
227
235
  * | Platform | Required |
228
236
  * |-----------|---------------------|
@@ -331,10 +339,14 @@ exports.EventAvailability = void 0;
331
339
  exports.EventSpan = void 0;
332
340
  (function (EventSpan) {
333
341
  /**
342
+ * Only the identified event or occurrence.
343
+ *
334
344
  * @since 7.1.0
335
345
  */
336
346
  EventSpan[EventSpan["THIS_EVENT"] = 0] = "THIS_EVENT";
337
347
  /**
348
+ * The identified occurrence and future occurrences in the series.
349
+ *
338
350
  * @since 7.1.0
339
351
  */
340
352
  EventSpan[EventSpan["THIS_AND_FUTURE_EVENTS"] = 1] = "THIS_AND_FUTURE_EVENTS";
@@ -369,55 +381,359 @@ exports.EventStatus = void 0;
369
381
  })(exports.EventStatus || (exports.EventStatus = {}));
370
382
 
371
383
  /**
372
- * @since 7.1.0
373
- */
374
- exports.RecurrenceFrequency = void 0;
375
- (function (RecurrenceFrequency) {
376
- /**
377
- * @since 7.1.0
378
- */
379
- RecurrenceFrequency[RecurrenceFrequency["DAILY"] = 0] = "DAILY";
380
- /**
381
- * @since 7.1.0
382
- */
383
- RecurrenceFrequency[RecurrenceFrequency["WEEKLY"] = 1] = "WEEKLY";
384
- /**
385
- * @since 7.1.0
386
- */
387
- RecurrenceFrequency[RecurrenceFrequency["MONTHLY"] = 2] = "MONTHLY";
388
- /**
389
- * @since 7.1.0
390
- */
391
- RecurrenceFrequency[RecurrenceFrequency["YEARLY"] = 3] = "YEARLY";
392
- })(exports.RecurrenceFrequency || (exports.RecurrenceFrequency = {}));
393
-
394
- /**
395
- * @deprecated Use `RecurrenceFrequency`.
384
+ * @deprecated Use `'daily'`, `'weekly'`, `'monthly'`, or `'yearly'` (`RecurrenceFrequency`).
396
385
  */
397
386
  exports.ReminderRecurrenceFrequency = void 0;
398
387
  (function (ReminderRecurrenceFrequency) {
399
388
  /**
400
- * @deprecated Use `RecurrenceFrequency.DAILY`.
389
+ * @deprecated Use `'daily'`.
401
390
  */
402
391
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["DAILY"] = 0] = "DAILY";
403
392
  /**
404
- * @deprecated Use `RecurrenceFrequency.WEEKLY`.
393
+ * @deprecated Use `'weekly'`.
405
394
  */
406
395
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["WEEKLY"] = 1] = "WEEKLY";
407
396
  /**
408
- * @deprecated Use `RecurrenceFrequency.MONTHLY`.
397
+ * @deprecated Use `'monthly'`.
409
398
  */
410
399
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["MONTHLY"] = 2] = "MONTHLY";
411
400
  /**
412
- * @deprecated Use `RecurrenceFrequency.YEARLY`.
401
+ * @deprecated Use `'yearly'`.
413
402
  */
414
403
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["YEARLY"] = 3] = "YEARLY";
415
404
  })(exports.ReminderRecurrenceFrequency || (exports.ReminderRecurrenceFrequency = {}));
416
405
 
417
- const CapacitorCalendar = core.registerPlugin("CapacitorCalendar", {
406
+ /**
407
+ * Triggers a browser download for an `.ics` `File`.
408
+ * Resolves after the object URL is revoked.
409
+ *
410
+ * @throws If `document` or `URL` is not available.
411
+ *
412
+ * @example
413
+ * const { ics } = await CapacitorCalendar.createEvent({
414
+ * title: 'Team standup',
415
+ * icsFileName: 'team-standup.ics',
416
+ * });
417
+ * if (ics) {
418
+ * await downloadIcsFile(ics);
419
+ * }
420
+ *
421
+ * @since 7.3.0
422
+ */
423
+ async function downloadIcsFile(file) {
424
+ if (typeof document === 'undefined' || typeof URL === 'undefined') {
425
+ throw new Error('downloadIcsFile requires a browser document environment.');
426
+ }
427
+ const url = URL.createObjectURL(file);
428
+ const link = document.createElement('a');
429
+ link.href = url;
430
+ link.download = file.name.length > 0 ? file.name : 'event.ics';
431
+ document.body.appendChild(link);
432
+ link.click();
433
+ link.remove();
434
+ // Delay revoke so the browser can start the download
435
+ await new Promise((resolve) => setTimeout(resolve, 1000));
436
+ URL.revokeObjectURL(url);
437
+ }
438
+
439
+ const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {
418
440
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorCalendarWeb()),
419
441
  });
420
442
 
443
+ const HOUR_MS = 60 * 60 * 1000;
444
+ const DAY_MS$1 = 24 * HOUR_MS;
445
+ const CRLF = '\r\n';
446
+ /**
447
+ * Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.
448
+ * End comes from `endDate`, else `duration` (RFC 2445), else one hour (or next day if all-day).
449
+ * All-day ends that fall on the start's local day bump to the next day (exclusive `DTEND`).
450
+ */
451
+ function buildEventIcs(options) {
452
+ var _a;
453
+ const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
454
+ const isAllDay = options.isAllDay === true;
455
+ const endDate = resolveEndDate(startDate, options.endDate, options.duration, isAllDay);
456
+ const lines = [
457
+ 'BEGIN:VCALENDAR',
458
+ 'VERSION:2.0',
459
+ 'PRODID:-//ebarooni/capacitor-calendar//EN',
460
+ 'CALSCALE:GREGORIAN',
461
+ 'METHOD:PUBLISH',
462
+ 'BEGIN:VEVENT',
463
+ `UID:${generateUid()}`,
464
+ `DTSTAMP:${formatDateTimeUtc(Date.now())}`,
465
+ ];
466
+ if (isAllDay) {
467
+ lines.push(`DTSTART;VALUE=DATE:${formatDateOnlyLocal(startDate)}`);
468
+ lines.push(`DTEND;VALUE=DATE:${formatDateOnlyLocal(endDate)}`);
469
+ }
470
+ else {
471
+ lines.push(`DTSTART:${formatDateTimeUtc(startDate)}`);
472
+ lines.push(`DTEND:${formatDateTimeUtc(endDate)}`);
473
+ }
474
+ lines.push(`SUMMARY:${escapeText(options.title)}`);
475
+ if (options.description != null && options.description.length > 0) {
476
+ lines.push(`DESCRIPTION:${escapeText(options.description)}`);
477
+ }
478
+ if (options.location != null && options.location.length > 0) {
479
+ lines.push(`LOCATION:${escapeText(options.location)}`);
480
+ }
481
+ if (options.url != null && options.url.length > 0) {
482
+ lines.push(`URL:${escapeText(options.url)}`);
483
+ }
484
+ if (options.organizer != null && options.organizer.length > 0) {
485
+ lines.push(`ORGANIZER:mailto:${escapeText(options.organizer)}`);
486
+ }
487
+ const transp = mapTransparency(options.availability);
488
+ if (transp != null) {
489
+ lines.push(`TRANSP:${transp}`);
490
+ }
491
+ if (options.recurrence != null) {
492
+ lines.push(`RRULE:${toRRule(options.recurrence, isAllDay)}`);
493
+ }
494
+ if (options.attendees != null) {
495
+ for (const guest of options.attendees) {
496
+ if (guest.email.length === 0) {
497
+ continue;
498
+ }
499
+ const cn = guest.name != null && guest.name.length > 0 ? `;CN=${formatParamValue(guest.name)}` : '';
500
+ lines.push(`ATTENDEE${cn}:mailto:${escapeText(guest.email)}`);
501
+ }
502
+ }
503
+ if (options.alerts != null) {
504
+ for (const minutes of options.alerts) {
505
+ lines.push(...buildAlarm(minutes));
506
+ }
507
+ }
508
+ lines.push('END:VEVENT', 'END:VCALENDAR');
509
+ return lines.map(foldLine).join(CRLF) + CRLF;
510
+ }
511
+ /**
512
+ * Resolves the `.ics` download filename.
513
+ * Uses `icsFileName` when set; otherwise derives a name from `title` (fallback `event.ics`).
514
+ * Appends `.ics` when the chosen name has no such extension.
515
+ */
516
+ function resolveIcsFileName(options) {
517
+ var _a;
518
+ const custom = (_a = options.icsFileName) === null || _a === void 0 ? void 0 : _a.trim();
519
+ if (custom != null && custom.length > 0) {
520
+ return /\.ics$/i.test(custom) ? custom : `${custom}.ics`;
521
+ }
522
+ return fileNameFromTitle(options.title);
523
+ }
524
+ function fileNameFromTitle(title) {
525
+ const base = (title !== null && title !== void 0 ? title : 'event')
526
+ .trim()
527
+ .replace(/[^\w\s-]+/g, '')
528
+ .replace(/\s+/g, '-')
529
+ .replace(/-+/g, '-')
530
+ .replace(/^-|-$/g, '')
531
+ .slice(0, 64);
532
+ return `${base.length > 0 ? base : 'event'}.ics`;
533
+ }
534
+ /**
535
+ * Resolves event end milliseconds the same way ICS export does.
536
+ * Prefers `endDate`, else `duration` (RFC 2445), else one hour (or next day if all-day).
537
+ * All-day ends that fall on the start's local day bump to the next day (exclusive `DTEND`).
538
+ */
539
+ function resolveEndDate(startDate, endDate, duration, isAllDay) {
540
+ let resolved;
541
+ if (endDate != null) {
542
+ resolved = endDate;
543
+ }
544
+ else if (duration != null && duration.trim().length > 0) {
545
+ resolved = startDate + parseRfc2445DurationMs(duration.trim());
546
+ }
547
+ else {
548
+ resolved = isAllDay ? startDate + DAY_MS$1 : startDate + HOUR_MS;
549
+ }
550
+ if (!isAllDay) {
551
+ return resolved;
552
+ }
553
+ // ICS all-day DTEND is exclusive; same local date as DTSTART is zero-length.
554
+ // Also covers short durations (e.g. PT1H) on all-day events — treat as one whole day.
555
+ if (formatDateOnlyLocal(resolved) <= formatDateOnlyLocal(startDate)) {
556
+ return startDate + DAY_MS$1;
557
+ }
558
+ return resolved;
559
+ }
560
+ /**
561
+ * Parses an RFC 2445 / RFC 5545 duration string into milliseconds.
562
+ * Supports forms such as `PT1H`, `P1D`, `P3W`, `P2DT4H30M`.
563
+ *
564
+ * @throws If the string is empty, negative, zero-length, or not a valid duration.
565
+ */
566
+ function parseRfc2445DurationMs(value) {
567
+ var _a, _b, _c, _d, _e;
568
+ const match = /^([+-])?P(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(value);
569
+ if (match == null) {
570
+ throw new Error(`Invalid duration: ${value}`);
571
+ }
572
+ const sign = match[1] === '-' ? -1 : 1;
573
+ const weeks = Number((_a = match[2]) !== null && _a !== void 0 ? _a : 0);
574
+ const days = Number((_b = match[3]) !== null && _b !== void 0 ? _b : 0);
575
+ const hours = Number((_c = match[4]) !== null && _c !== void 0 ? _c : 0);
576
+ const minutes = Number((_d = match[5]) !== null && _d !== void 0 ? _d : 0);
577
+ const seconds = Number((_e = match[6]) !== null && _e !== void 0 ? _e : 0);
578
+ // Require at least one unit so bare "P" / "PT" are rejected.
579
+ if (weeks === 0 && days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
580
+ throw new Error(`Invalid duration: ${value}`);
581
+ }
582
+ const ms = weeks * 7 * DAY_MS$1 + days * DAY_MS$1 + hours * HOUR_MS + minutes * 60 * 1000 + seconds * 1000;
583
+ const signed = sign * ms;
584
+ if (signed <= 0) {
585
+ throw new Error(`Invalid duration: ${value}`);
586
+ }
587
+ return signed;
588
+ }
589
+ function mapTransparency(availability) {
590
+ if (availability == null) {
591
+ return null;
592
+ }
593
+ if (availability === exports.EventAvailability.FREE) {
594
+ return 'TRANSPARENT';
595
+ }
596
+ if (availability === exports.EventAvailability.BUSY) {
597
+ return 'OPAQUE';
598
+ }
599
+ return 'OPAQUE';
600
+ }
601
+ function toRRule(rule, isAllDay) {
602
+ var _a;
603
+ const parts = [`FREQ=${rule.frequency.toUpperCase()}`, `INTERVAL=${Math.max(1, (_a = rule.interval) !== null && _a !== void 0 ? _a : 1)}`];
604
+ if (rule.count != null) {
605
+ parts.push(`COUNT=${rule.count}`);
606
+ }
607
+ else if (rule.end != null) {
608
+ // RFC 5545: UNTIL must match DTSTART value type (DATE vs DATE-TIME).
609
+ parts.push(`UNTIL=${isAllDay ? formatDateOnlyLocal(rule.end) : formatDateTimeUtc(rule.end)}`);
610
+ }
611
+ if (rule.byWeekDay != null && rule.byWeekDay.length > 0) {
612
+ const mapped = rule.byWeekDay.map(mapWeekday).filter((d) => d != null);
613
+ if (mapped.length > 0) {
614
+ parts.push(`BYDAY=${[...new Set(mapped)].join(',')}`);
615
+ }
616
+ }
617
+ if (rule.byMonthDay != null && rule.byMonthDay.length > 0) {
618
+ parts.push(`BYMONTHDAY=${rule.byMonthDay.join(',')}`);
619
+ }
620
+ if (rule.byMonth != null && rule.byMonth.length > 0) {
621
+ parts.push(`BYMONTH=${rule.byMonth.join(',')}`);
622
+ }
623
+ if (rule.weeksOfTheYear != null && rule.weeksOfTheYear.length > 0) {
624
+ parts.push(`BYWEEKNO=${rule.weeksOfTheYear.join(',')}`);
625
+ }
626
+ if (rule.daysOfTheYear != null && rule.daysOfTheYear.length > 0) {
627
+ parts.push(`BYYEARDAY=${rule.daysOfTheYear.join(',')}`);
628
+ }
629
+ return parts.join(';');
630
+ }
631
+ function mapWeekday(day) {
632
+ switch (day) {
633
+ case 1:
634
+ return 'MO';
635
+ case 2:
636
+ return 'TU';
637
+ case 3:
638
+ return 'WE';
639
+ case 4:
640
+ return 'TH';
641
+ case 5:
642
+ return 'FR';
643
+ case 6:
644
+ return 'SA';
645
+ case 7:
646
+ return 'SU';
647
+ default:
648
+ return null;
649
+ }
650
+ }
651
+ function buildAlarm(minutes) {
652
+ const trigger = minutes < 0 ? `-PT${Math.abs(minutes)}M` : `PT${minutes}M`;
653
+ return ['BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Reminder', `TRIGGER:${trigger}`, 'END:VALARM'];
654
+ }
655
+ function generateUid() {
656
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
657
+ return `${crypto.randomUUID()}@capacitor-calendar`;
658
+ }
659
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}@capacitor-calendar`;
660
+ }
661
+ function formatDateTimeUtc(ms) {
662
+ const date = new Date(ms);
663
+ const fullYear = date.getUTCFullYear();
664
+ const month = padTwoDigits(date.getUTCMonth() + 1);
665
+ const dayOfMonth = padTwoDigits(date.getUTCDate());
666
+ const hours = padTwoDigits(date.getUTCHours());
667
+ const minutes = padTwoDigits(date.getUTCMinutes());
668
+ const seconds = padTwoDigits(date.getUTCSeconds());
669
+ return `${fullYear}${month}${dayOfMonth}T${hours}${minutes}${seconds}Z`;
670
+ }
671
+ function formatDateOnlyLocal(ms) {
672
+ const date = new Date(ms);
673
+ return `${date.getFullYear()}${padTwoDigits(date.getMonth() + 1)}${padTwoDigits(date.getDate())}`;
674
+ }
675
+ function padTwoDigits(value) {
676
+ return value < 10 ? `0${value}` : String(value);
677
+ }
678
+ /**
679
+ * Escapes TEXT values per RFC 5545 §3.3.11.
680
+ */
681
+ function escapeText(value) {
682
+ return value
683
+ .replace(/\\/g, '\\\\')
684
+ .replace(/;/g, '\\;')
685
+ .replace(/,/g, '\\,')
686
+ .replace(/\r\n|\n|\r/g, '\\n');
687
+ }
688
+ /**
689
+ * Formats a property parameter value per RFC 5545 §3.2.
690
+ * Values with COMMA, SEMICOLON, or COLON are quoted; DQUOTE and line breaks are sanitized.
691
+ */
692
+ function formatParamValue(value) {
693
+ const sanitized = value.replace(/[\r\n]+/g, ' ').replace(/"/g, "'");
694
+ if (/[;:,]/.test(sanitized)) {
695
+ return `"${sanitized}"`;
696
+ }
697
+ return sanitized;
698
+ }
699
+ /**
700
+ * Folds a content line so each physical line is at most 75 octets (RFC 5545 §3.1).
701
+ */
702
+ function foldLine(line) {
703
+ const max = 75;
704
+ if (byteLength(line) <= max) {
705
+ return line;
706
+ }
707
+ const chars = [...line];
708
+ let result = '';
709
+ let current = '';
710
+ for (const ch of chars) {
711
+ const next = current + ch;
712
+ if (byteLength(next) > max) {
713
+ result += result.length === 0 ? current : `${CRLF} ${current}`;
714
+ current = ch;
715
+ // Continuations are limited to 74 octets of content + leading space = 75
716
+ while (byteLength(current) > max - 1) {
717
+ // Extremely rare for a single code point; split by taking first unit as-is
718
+ result += `${CRLF} ${current}`;
719
+ current = '';
720
+ break;
721
+ }
722
+ }
723
+ else {
724
+ current = next;
725
+ }
726
+ }
727
+ if (current.length > 0) {
728
+ result += result.length === 0 ? current : `${CRLF} ${current}`;
729
+ }
730
+ return result;
731
+ }
732
+ function byteLength(s) {
733
+ return new TextEncoder().encode(s).length;
734
+ }
735
+
736
+ const DAY_MS = 24 * 60 * 60 * 1000;
421
737
  class CapacitorCalendarWeb extends core.WebPlugin {
422
738
  checkPermission(_options) {
423
739
  return this.throwUnimplemented(this.checkPermission.name);
@@ -428,6 +744,12 @@ class CapacitorCalendarWeb extends core.WebPlugin {
428
744
  requestPermission(_options) {
429
745
  return this.throwUnimplemented(this.requestPermission.name);
430
746
  }
747
+ createRemindersList(_options) {
748
+ return this.throwUnimplemented(this.createRemindersList.name);
749
+ }
750
+ deleteRemindersList(_options) {
751
+ return this.throwUnimplemented(this.deleteRemindersList.name);
752
+ }
431
753
  requestAllPermissions() {
432
754
  return this.throwUnimplemented(this.requestAllPermissions.name);
433
755
  }
@@ -443,14 +765,45 @@ class CapacitorCalendarWeb extends core.WebPlugin {
443
765
  requestFullRemindersAccess() {
444
766
  return this.throwUnimplemented(this.requestFullRemindersAccess.name);
445
767
  }
446
- createEventWithPrompt(_options) {
447
- return this.throwUnimplemented(this.createEventWithPrompt.name);
768
+ async createEventWithPrompt(options = {}) {
769
+ try {
770
+ const confirmed = window.confirm(buildCreateEventConfirmMessage(options));
771
+ if (!confirmed) {
772
+ return { id: null, ics: null };
773
+ }
774
+ const createOptions = mapPromptOptionsToCreateEvent(options);
775
+ const content = buildEventIcs(createOptions);
776
+ const ics = new File([content], resolveIcsFileName(createOptions), {
777
+ type: 'text/calendar;charset=utf-8',
778
+ });
779
+ if (options.autoDownloadIcsFile !== false) {
780
+ await downloadIcsFile(ics);
781
+ }
782
+ return { id: null, ics };
783
+ }
784
+ catch (error) {
785
+ const message = error instanceof Error ? error.message : String(error);
786
+ return Promise.reject(new Error(message));
787
+ }
448
788
  }
449
789
  modifyEventWithPrompt(_options) {
450
790
  return this.throwUnimplemented(this.modifyEventWithPrompt.name);
451
791
  }
452
- createEvent(_options) {
453
- return this.throwUnimplemented(this.createEvent.name);
792
+ async createEvent(options) {
793
+ try {
794
+ const content = buildEventIcs(options);
795
+ const ics = new File([content], resolveIcsFileName(options), {
796
+ type: 'text/calendar;charset=utf-8',
797
+ });
798
+ if (options.autoDownloadIcsFile === true) {
799
+ await downloadIcsFile(ics);
800
+ }
801
+ return { id: null, ics };
802
+ }
803
+ catch (error) {
804
+ const message = error instanceof Error ? error.message : String(error);
805
+ return Promise.reject(new Error(message));
806
+ }
454
807
  }
455
808
  commit() {
456
809
  return this.throwUnimplemented(this.commit.name);
@@ -470,7 +823,7 @@ class CapacitorCalendarWeb extends core.WebPlugin {
470
823
  fetchAllRemindersSources() {
471
824
  return this.throwUnimplemented(this.fetchAllRemindersSources.name);
472
825
  }
473
- getDefaultCalendar() {
826
+ getDefaultCalendar(_options) {
474
827
  return this.throwUnimplemented(this.getDefaultCalendar.name);
475
828
  }
476
829
  getDefaultRemindersList() {
@@ -527,10 +880,85 @@ class CapacitorCalendarWeb extends core.WebPlugin {
527
880
  deleteReminderWithPrompt(_options) {
528
881
  return this.throwUnimplemented(this.deleteReminderWithPrompt.name);
529
882
  }
883
+ updateRemindersList(_options) {
884
+ return this.throwUnimplemented(this.updateRemindersList.name);
885
+ }
530
886
  throwUnimplemented(methodName) {
531
887
  return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web.`));
532
888
  }
533
889
  }
890
+ function mapPromptOptionsToCreateEvent(options) {
891
+ var _a;
892
+ return {
893
+ alerts: options.alerts,
894
+ availability: options.availability,
895
+ description: options.description,
896
+ endDate: options.endDate,
897
+ icsFileName: options.icsFileName,
898
+ isAllDay: options.isAllDay,
899
+ location: options.location,
900
+ recurrence: options.recurrence,
901
+ startDate: options.startDate,
902
+ title: (_a = options.title) !== null && _a !== void 0 ? _a : '',
903
+ url: options.url,
904
+ };
905
+ }
906
+ function buildCreateEventConfirmMessage(options) {
907
+ var _a;
908
+ const custom = (_a = options.promptMessage) === null || _a === void 0 ? void 0 : _a.trim();
909
+ if (custom != null && custom.length > 0) {
910
+ return custom;
911
+ }
912
+ const title = normalizeConfirmTitle(options.title);
913
+ const timeSummary = formatEventTimeSummary(options);
914
+ return `Create event?\n\n${title}\n${timeSummary}`;
915
+ }
916
+ function normalizeConfirmTitle(title) {
917
+ const collapsed = (title !== null && title !== void 0 ? title : '')
918
+ .replace(/[\r\n]+/g, ' ')
919
+ .replace(/\s+/g, ' ')
920
+ .trim();
921
+ return collapsed.length > 0 ? collapsed : 'Untitled event';
922
+ }
923
+ function formatEventTimeSummary(options) {
924
+ var _a;
925
+ const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
926
+ const isAllDay = options.isAllDay === true;
927
+ const endDate = resolveEndDate(startDate, options.endDate, undefined, isAllDay);
928
+ if (isAllDay) {
929
+ const startDay = formatLocalDate(startDate);
930
+ const lastInclusiveMs = endDate - DAY_MS;
931
+ const lastDay = formatLocalDate(lastInclusiveMs);
932
+ if (lastDay <= startDay) {
933
+ return `All day · ${formatDisplayDate(startDate)}`;
934
+ }
935
+ return `All day · ${formatDisplayDate(startDate)} – ${formatDisplayDate(lastInclusiveMs)}`;
936
+ }
937
+ return `${formatDisplayDateTime(startDate)} – ${formatDisplayDateTime(endDate)}`;
938
+ }
939
+ function formatLocalDate(ms) {
940
+ const date = new Date(ms);
941
+ const fullYear = date.getFullYear();
942
+ const month = String(date.getMonth() + 1).padStart(2, '0');
943
+ const dayOfMonth = String(date.getDate()).padStart(2, '0');
944
+ return `${fullYear}-${month}-${dayOfMonth}`;
945
+ }
946
+ function formatDisplayDate(ms) {
947
+ return new Date(ms).toLocaleDateString(undefined, {
948
+ year: 'numeric',
949
+ month: 'short',
950
+ day: 'numeric',
951
+ });
952
+ }
953
+ function formatDisplayDateTime(ms) {
954
+ return new Date(ms).toLocaleString(undefined, {
955
+ year: 'numeric',
956
+ month: 'short',
957
+ day: 'numeric',
958
+ hour: 'numeric',
959
+ minute: '2-digit',
960
+ });
961
+ }
534
962
 
535
963
  var web = /*#__PURE__*/Object.freeze({
536
964
  __proto__: null,
@@ -538,4 +966,5 @@ var web = /*#__PURE__*/Object.freeze({
538
966
  });
539
967
 
540
968
  exports.CapacitorCalendar = CapacitorCalendar;
969
+ exports.downloadIcsFile = downloadIcsFile;
541
970
  //# sourceMappingURL=plugin.cjs.js.map