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