@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
package/dist/plugin.js CHANGED
@@ -196,11 +196,15 @@ var capacitorCapacitorCalendar = (function (exports, core) {
196
196
  /**
197
197
  * Permission required for reading reminders.
198
198
  *
199
+ * On Android, reminders are not supported. `checkPermission` and
200
+ * `checkAllPermissions` return `"prompt"` for this scope.
201
+ * `requestPermission` rejects with `Invalid scope.`.
202
+ *
199
203
  * @permissions
200
204
  * | Platform | Required |
201
205
  * |-----------|---------------------|
202
206
  * | iOS 17+ | `NSRemindersFullAccessUsageDescription` |
203
- * | iOS 10-16 | `NSRemindersUsageDescription` |
207
+ * | iOS 13-16 | `NSRemindersUsageDescription` |
204
208
  * @platform iOS
205
209
  * @since 7.1.0
206
210
  */
@@ -222,6 +226,10 @@ var capacitorCapacitorCalendar = (function (exports, core) {
222
226
  /**
223
227
  * Permission required for adding or modifying reminders.
224
228
  *
229
+ * On Android, reminders are not supported. `checkPermission` and
230
+ * `checkAllPermissions` return `"prompt"` for this scope.
231
+ * `requestPermission` rejects with `Invalid scope.`.
232
+ *
225
233
  * @permissions
226
234
  * | Platform | Required |
227
235
  * |-----------|---------------------|
@@ -292,6 +300,21 @@ var capacitorCapacitorCalendar = (function (exports, core) {
292
300
  CalendarType[CalendarType["BIRTHDAY"] = 4] = "BIRTHDAY";
293
301
  })(exports.CalendarType || (exports.CalendarType = {}));
294
302
 
303
+ /**
304
+ * Stable reject codes for CapacitorCalendar. Compare with `error.code`.
305
+ *
306
+ * @since 7.4.0
307
+ */
308
+ exports.CapacitorCalendarErrorCode = void 0;
309
+ (function (CapacitorCalendarErrorCode) {
310
+ /**
311
+ * Missing Info.plist usage description or AndroidManifest permission declaration.
312
+ *
313
+ * @since 7.4.0
314
+ */
315
+ CapacitorCalendarErrorCode["MissingDeclaration"] = "EB-CLDR-0100";
316
+ })(exports.CapacitorCalendarErrorCode || (exports.CapacitorCalendarErrorCode = {}));
317
+
295
318
  /**
296
319
  * @since 7.1.0
297
320
  */
@@ -330,10 +353,14 @@ var capacitorCapacitorCalendar = (function (exports, core) {
330
353
  exports.EventSpan = void 0;
331
354
  (function (EventSpan) {
332
355
  /**
356
+ * Only the identified event or occurrence.
357
+ *
333
358
  * @since 7.1.0
334
359
  */
335
360
  EventSpan[EventSpan["THIS_EVENT"] = 0] = "THIS_EVENT";
336
361
  /**
362
+ * The identified occurrence and future occurrences in the series.
363
+ *
337
364
  * @since 7.1.0
338
365
  */
339
366
  EventSpan[EventSpan["THIS_AND_FUTURE_EVENTS"] = 1] = "THIS_AND_FUTURE_EVENTS";
@@ -368,55 +395,359 @@ var capacitorCapacitorCalendar = (function (exports, core) {
368
395
  })(exports.EventStatus || (exports.EventStatus = {}));
369
396
 
370
397
  /**
371
- * @since 7.1.0
372
- */
373
- exports.RecurrenceFrequency = void 0;
374
- (function (RecurrenceFrequency) {
375
- /**
376
- * @since 7.1.0
377
- */
378
- RecurrenceFrequency[RecurrenceFrequency["DAILY"] = 0] = "DAILY";
379
- /**
380
- * @since 7.1.0
381
- */
382
- RecurrenceFrequency[RecurrenceFrequency["WEEKLY"] = 1] = "WEEKLY";
383
- /**
384
- * @since 7.1.0
385
- */
386
- RecurrenceFrequency[RecurrenceFrequency["MONTHLY"] = 2] = "MONTHLY";
387
- /**
388
- * @since 7.1.0
389
- */
390
- RecurrenceFrequency[RecurrenceFrequency["YEARLY"] = 3] = "YEARLY";
391
- })(exports.RecurrenceFrequency || (exports.RecurrenceFrequency = {}));
392
-
393
- /**
394
- * @deprecated Use `RecurrenceFrequency`.
398
+ * @deprecated Use `'daily'`, `'weekly'`, `'monthly'`, or `'yearly'` (`RecurrenceFrequency`).
395
399
  */
396
400
  exports.ReminderRecurrenceFrequency = void 0;
397
401
  (function (ReminderRecurrenceFrequency) {
398
402
  /**
399
- * @deprecated Use `RecurrenceFrequency.DAILY`.
403
+ * @deprecated Use `'daily'`.
400
404
  */
401
405
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["DAILY"] = 0] = "DAILY";
402
406
  /**
403
- * @deprecated Use `RecurrenceFrequency.WEEKLY`.
407
+ * @deprecated Use `'weekly'`.
404
408
  */
405
409
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["WEEKLY"] = 1] = "WEEKLY";
406
410
  /**
407
- * @deprecated Use `RecurrenceFrequency.MONTHLY`.
411
+ * @deprecated Use `'monthly'`.
408
412
  */
409
413
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["MONTHLY"] = 2] = "MONTHLY";
410
414
  /**
411
- * @deprecated Use `RecurrenceFrequency.YEARLY`.
415
+ * @deprecated Use `'yearly'`.
412
416
  */
413
417
  ReminderRecurrenceFrequency[ReminderRecurrenceFrequency["YEARLY"] = 3] = "YEARLY";
414
418
  })(exports.ReminderRecurrenceFrequency || (exports.ReminderRecurrenceFrequency = {}));
415
419
 
416
- const CapacitorCalendar = core.registerPlugin("CapacitorCalendar", {
420
+ /**
421
+ * Triggers a browser download for an `.ics` `File`.
422
+ * Resolves after the object URL is revoked.
423
+ *
424
+ * @throws If `document` or `URL` is not available.
425
+ *
426
+ * @example
427
+ * const { ics } = await CapacitorCalendar.createEvent({
428
+ * title: 'Team standup',
429
+ * icsFileName: 'team-standup.ics',
430
+ * });
431
+ * if (ics) {
432
+ * await downloadIcsFile(ics);
433
+ * }
434
+ *
435
+ * @since 7.3.0
436
+ */
437
+ async function downloadIcsFile(file) {
438
+ if (typeof document === 'undefined' || typeof URL === 'undefined') {
439
+ throw new Error('downloadIcsFile requires a browser document environment.');
440
+ }
441
+ const url = URL.createObjectURL(file);
442
+ const link = document.createElement('a');
443
+ link.href = url;
444
+ link.download = file.name.length > 0 ? file.name : 'event.ics';
445
+ document.body.appendChild(link);
446
+ link.click();
447
+ link.remove();
448
+ // Delay revoke so the browser can start the download
449
+ await new Promise((resolve) => setTimeout(resolve, 1000));
450
+ URL.revokeObjectURL(url);
451
+ }
452
+
453
+ const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {
417
454
  web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorCalendarWeb()),
418
455
  });
419
456
 
457
+ const HOUR_MS = 60 * 60 * 1000;
458
+ const DAY_MS$1 = 24 * HOUR_MS;
459
+ const CRLF = '\r\n';
460
+ /**
461
+ * Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.
462
+ * End comes from `endDate`, else `duration` (RFC 2445), else one hour (or next day if all-day).
463
+ * All-day ends that fall on the start's local day bump to the next day (exclusive `DTEND`).
464
+ */
465
+ function buildEventIcs(options) {
466
+ var _a;
467
+ const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
468
+ const isAllDay = options.isAllDay === true;
469
+ const endDate = resolveEndDate(startDate, options.endDate, options.duration, isAllDay);
470
+ const lines = [
471
+ 'BEGIN:VCALENDAR',
472
+ 'VERSION:2.0',
473
+ 'PRODID:-//ebarooni/capacitor-calendar//EN',
474
+ 'CALSCALE:GREGORIAN',
475
+ 'METHOD:PUBLISH',
476
+ 'BEGIN:VEVENT',
477
+ `UID:${generateUid()}`,
478
+ `DTSTAMP:${formatDateTimeUtc(Date.now())}`,
479
+ ];
480
+ if (isAllDay) {
481
+ lines.push(`DTSTART;VALUE=DATE:${formatDateOnlyLocal(startDate)}`);
482
+ lines.push(`DTEND;VALUE=DATE:${formatDateOnlyLocal(endDate)}`);
483
+ }
484
+ else {
485
+ lines.push(`DTSTART:${formatDateTimeUtc(startDate)}`);
486
+ lines.push(`DTEND:${formatDateTimeUtc(endDate)}`);
487
+ }
488
+ lines.push(`SUMMARY:${escapeText(options.title)}`);
489
+ if (options.description != null && options.description.length > 0) {
490
+ lines.push(`DESCRIPTION:${escapeText(options.description)}`);
491
+ }
492
+ if (options.location != null && options.location.length > 0) {
493
+ lines.push(`LOCATION:${escapeText(options.location)}`);
494
+ }
495
+ if (options.url != null && options.url.length > 0) {
496
+ lines.push(`URL:${escapeText(options.url)}`);
497
+ }
498
+ if (options.organizer != null && options.organizer.length > 0) {
499
+ lines.push(`ORGANIZER:mailto:${escapeText(options.organizer)}`);
500
+ }
501
+ const transp = mapTransparency(options.availability);
502
+ if (transp != null) {
503
+ lines.push(`TRANSP:${transp}`);
504
+ }
505
+ if (options.recurrence != null) {
506
+ lines.push(`RRULE:${toRRule(options.recurrence, isAllDay)}`);
507
+ }
508
+ if (options.attendees != null) {
509
+ for (const guest of options.attendees) {
510
+ if (guest.email.length === 0) {
511
+ continue;
512
+ }
513
+ const cn = guest.name != null && guest.name.length > 0 ? `;CN=${formatParamValue(guest.name)}` : '';
514
+ lines.push(`ATTENDEE${cn}:mailto:${escapeText(guest.email)}`);
515
+ }
516
+ }
517
+ if (options.alerts != null) {
518
+ for (const minutes of options.alerts) {
519
+ lines.push(...buildAlarm(minutes));
520
+ }
521
+ }
522
+ lines.push('END:VEVENT', 'END:VCALENDAR');
523
+ return lines.map(foldLine).join(CRLF) + CRLF;
524
+ }
525
+ /**
526
+ * Resolves the `.ics` download filename.
527
+ * Uses `icsFileName` when set; otherwise derives a name from `title` (fallback `event.ics`).
528
+ * Appends `.ics` when the chosen name has no such extension.
529
+ */
530
+ function resolveIcsFileName(options) {
531
+ var _a;
532
+ const custom = (_a = options.icsFileName) === null || _a === void 0 ? void 0 : _a.trim();
533
+ if (custom != null && custom.length > 0) {
534
+ return /\.ics$/i.test(custom) ? custom : `${custom}.ics`;
535
+ }
536
+ return fileNameFromTitle(options.title);
537
+ }
538
+ function fileNameFromTitle(title) {
539
+ const base = (title !== null && title !== void 0 ? title : 'event')
540
+ .trim()
541
+ .replace(/[^\w\s-]+/g, '')
542
+ .replace(/\s+/g, '-')
543
+ .replace(/-+/g, '-')
544
+ .replace(/^-|-$/g, '')
545
+ .slice(0, 64);
546
+ return `${base.length > 0 ? base : 'event'}.ics`;
547
+ }
548
+ /**
549
+ * Resolves event end milliseconds the same way ICS export does.
550
+ * Prefers `endDate`, else `duration` (RFC 2445), else one hour (or next day if all-day).
551
+ * All-day ends that fall on the start's local day bump to the next day (exclusive `DTEND`).
552
+ */
553
+ function resolveEndDate(startDate, endDate, duration, isAllDay) {
554
+ let resolved;
555
+ if (endDate != null) {
556
+ resolved = endDate;
557
+ }
558
+ else if (duration != null && duration.trim().length > 0) {
559
+ resolved = startDate + parseRfc2445DurationMs(duration.trim());
560
+ }
561
+ else {
562
+ resolved = isAllDay ? startDate + DAY_MS$1 : startDate + HOUR_MS;
563
+ }
564
+ if (!isAllDay) {
565
+ return resolved;
566
+ }
567
+ // ICS all-day DTEND is exclusive; same local date as DTSTART is zero-length.
568
+ // Also covers short durations (e.g. PT1H) on all-day events — treat as one whole day.
569
+ if (formatDateOnlyLocal(resolved) <= formatDateOnlyLocal(startDate)) {
570
+ return startDate + DAY_MS$1;
571
+ }
572
+ return resolved;
573
+ }
574
+ /**
575
+ * Parses an RFC 2445 / RFC 5545 duration string into milliseconds.
576
+ * Supports forms such as `PT1H`, `P1D`, `P3W`, `P2DT4H30M`.
577
+ *
578
+ * @throws If the string is empty, negative, zero-length, or not a valid duration.
579
+ */
580
+ function parseRfc2445DurationMs(value) {
581
+ var _a, _b, _c, _d, _e;
582
+ const match = /^([+-])?P(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(value);
583
+ if (match == null) {
584
+ throw new Error(`Invalid duration: ${value}`);
585
+ }
586
+ const sign = match[1] === '-' ? -1 : 1;
587
+ const weeks = Number((_a = match[2]) !== null && _a !== void 0 ? _a : 0);
588
+ const days = Number((_b = match[3]) !== null && _b !== void 0 ? _b : 0);
589
+ const hours = Number((_c = match[4]) !== null && _c !== void 0 ? _c : 0);
590
+ const minutes = Number((_d = match[5]) !== null && _d !== void 0 ? _d : 0);
591
+ const seconds = Number((_e = match[6]) !== null && _e !== void 0 ? _e : 0);
592
+ // Require at least one unit so bare "P" / "PT" are rejected.
593
+ if (weeks === 0 && days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
594
+ throw new Error(`Invalid duration: ${value}`);
595
+ }
596
+ const ms = weeks * 7 * DAY_MS$1 + days * DAY_MS$1 + hours * HOUR_MS + minutes * 60 * 1000 + seconds * 1000;
597
+ const signed = sign * ms;
598
+ if (signed <= 0) {
599
+ throw new Error(`Invalid duration: ${value}`);
600
+ }
601
+ return signed;
602
+ }
603
+ function mapTransparency(availability) {
604
+ if (availability == null) {
605
+ return null;
606
+ }
607
+ if (availability === exports.EventAvailability.FREE) {
608
+ return 'TRANSPARENT';
609
+ }
610
+ if (availability === exports.EventAvailability.BUSY) {
611
+ return 'OPAQUE';
612
+ }
613
+ return 'OPAQUE';
614
+ }
615
+ function toRRule(rule, isAllDay) {
616
+ var _a;
617
+ const parts = [`FREQ=${rule.frequency.toUpperCase()}`, `INTERVAL=${Math.max(1, (_a = rule.interval) !== null && _a !== void 0 ? _a : 1)}`];
618
+ if (rule.count != null) {
619
+ parts.push(`COUNT=${rule.count}`);
620
+ }
621
+ else if (rule.end != null) {
622
+ // RFC 5545: UNTIL must match DTSTART value type (DATE vs DATE-TIME).
623
+ parts.push(`UNTIL=${isAllDay ? formatDateOnlyLocal(rule.end) : formatDateTimeUtc(rule.end)}`);
624
+ }
625
+ if (rule.byWeekDay != null && rule.byWeekDay.length > 0) {
626
+ const mapped = rule.byWeekDay.map(mapWeekday).filter((d) => d != null);
627
+ if (mapped.length > 0) {
628
+ parts.push(`BYDAY=${[...new Set(mapped)].join(',')}`);
629
+ }
630
+ }
631
+ if (rule.byMonthDay != null && rule.byMonthDay.length > 0) {
632
+ parts.push(`BYMONTHDAY=${rule.byMonthDay.join(',')}`);
633
+ }
634
+ if (rule.byMonth != null && rule.byMonth.length > 0) {
635
+ parts.push(`BYMONTH=${rule.byMonth.join(',')}`);
636
+ }
637
+ if (rule.weeksOfTheYear != null && rule.weeksOfTheYear.length > 0) {
638
+ parts.push(`BYWEEKNO=${rule.weeksOfTheYear.join(',')}`);
639
+ }
640
+ if (rule.daysOfTheYear != null && rule.daysOfTheYear.length > 0) {
641
+ parts.push(`BYYEARDAY=${rule.daysOfTheYear.join(',')}`);
642
+ }
643
+ return parts.join(';');
644
+ }
645
+ function mapWeekday(day) {
646
+ switch (day) {
647
+ case 1:
648
+ return 'MO';
649
+ case 2:
650
+ return 'TU';
651
+ case 3:
652
+ return 'WE';
653
+ case 4:
654
+ return 'TH';
655
+ case 5:
656
+ return 'FR';
657
+ case 6:
658
+ return 'SA';
659
+ case 7:
660
+ return 'SU';
661
+ default:
662
+ return null;
663
+ }
664
+ }
665
+ function buildAlarm(minutes) {
666
+ const trigger = minutes < 0 ? `-PT${Math.abs(minutes)}M` : `PT${minutes}M`;
667
+ return ['BEGIN:VALARM', 'ACTION:DISPLAY', 'DESCRIPTION:Reminder', `TRIGGER:${trigger}`, 'END:VALARM'];
668
+ }
669
+ function generateUid() {
670
+ if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
671
+ return `${crypto.randomUUID()}@capacitor-calendar`;
672
+ }
673
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}@capacitor-calendar`;
674
+ }
675
+ function formatDateTimeUtc(ms) {
676
+ const date = new Date(ms);
677
+ const fullYear = date.getUTCFullYear();
678
+ const month = padTwoDigits(date.getUTCMonth() + 1);
679
+ const dayOfMonth = padTwoDigits(date.getUTCDate());
680
+ const hours = padTwoDigits(date.getUTCHours());
681
+ const minutes = padTwoDigits(date.getUTCMinutes());
682
+ const seconds = padTwoDigits(date.getUTCSeconds());
683
+ return `${fullYear}${month}${dayOfMonth}T${hours}${minutes}${seconds}Z`;
684
+ }
685
+ function formatDateOnlyLocal(ms) {
686
+ const date = new Date(ms);
687
+ return `${date.getFullYear()}${padTwoDigits(date.getMonth() + 1)}${padTwoDigits(date.getDate())}`;
688
+ }
689
+ function padTwoDigits(value) {
690
+ return value < 10 ? `0${value}` : String(value);
691
+ }
692
+ /**
693
+ * Escapes TEXT values per RFC 5545 §3.3.11.
694
+ */
695
+ function escapeText(value) {
696
+ return value
697
+ .replace(/\\/g, '\\\\')
698
+ .replace(/;/g, '\\;')
699
+ .replace(/,/g, '\\,')
700
+ .replace(/\r\n|\n|\r/g, '\\n');
701
+ }
702
+ /**
703
+ * Formats a property parameter value per RFC 5545 §3.2.
704
+ * Values with COMMA, SEMICOLON, or COLON are quoted; DQUOTE and line breaks are sanitized.
705
+ */
706
+ function formatParamValue(value) {
707
+ const sanitized = value.replace(/[\r\n]+/g, ' ').replace(/"/g, "'");
708
+ if (/[;:,]/.test(sanitized)) {
709
+ return `"${sanitized}"`;
710
+ }
711
+ return sanitized;
712
+ }
713
+ /**
714
+ * Folds a content line so each physical line is at most 75 octets (RFC 5545 §3.1).
715
+ */
716
+ function foldLine(line) {
717
+ const max = 75;
718
+ if (byteLength(line) <= max) {
719
+ return line;
720
+ }
721
+ const chars = [...line];
722
+ let result = '';
723
+ let current = '';
724
+ for (const ch of chars) {
725
+ const next = current + ch;
726
+ if (byteLength(next) > max) {
727
+ result += result.length === 0 ? current : `${CRLF} ${current}`;
728
+ current = ch;
729
+ // Continuations are limited to 74 octets of content + leading space = 75
730
+ while (byteLength(current) > max - 1) {
731
+ // Extremely rare for a single code point; split by taking first unit as-is
732
+ result += `${CRLF} ${current}`;
733
+ current = '';
734
+ break;
735
+ }
736
+ }
737
+ else {
738
+ current = next;
739
+ }
740
+ }
741
+ if (current.length > 0) {
742
+ result += result.length === 0 ? current : `${CRLF} ${current}`;
743
+ }
744
+ return result;
745
+ }
746
+ function byteLength(s) {
747
+ return new TextEncoder().encode(s).length;
748
+ }
749
+
750
+ const DAY_MS = 24 * 60 * 60 * 1000;
420
751
  class CapacitorCalendarWeb extends core.WebPlugin {
421
752
  checkPermission(_options) {
422
753
  return this.throwUnimplemented(this.checkPermission.name);
@@ -427,6 +758,12 @@ var capacitorCapacitorCalendar = (function (exports, core) {
427
758
  requestPermission(_options) {
428
759
  return this.throwUnimplemented(this.requestPermission.name);
429
760
  }
761
+ createRemindersList(_options) {
762
+ return this.throwUnimplemented(this.createRemindersList.name);
763
+ }
764
+ deleteRemindersList(_options) {
765
+ return this.throwUnimplemented(this.deleteRemindersList.name);
766
+ }
430
767
  requestAllPermissions() {
431
768
  return this.throwUnimplemented(this.requestAllPermissions.name);
432
769
  }
@@ -442,14 +779,45 @@ var capacitorCapacitorCalendar = (function (exports, core) {
442
779
  requestFullRemindersAccess() {
443
780
  return this.throwUnimplemented(this.requestFullRemindersAccess.name);
444
781
  }
445
- createEventWithPrompt(_options) {
446
- return this.throwUnimplemented(this.createEventWithPrompt.name);
782
+ async createEventWithPrompt(options = {}) {
783
+ try {
784
+ const confirmed = window.confirm(buildCreateEventConfirmMessage(options));
785
+ if (!confirmed) {
786
+ return { id: null, ics: null };
787
+ }
788
+ const createOptions = mapPromptOptionsToCreateEvent(options);
789
+ const content = buildEventIcs(createOptions);
790
+ const ics = new File([content], resolveIcsFileName(createOptions), {
791
+ type: 'text/calendar;charset=utf-8',
792
+ });
793
+ if (options.autoDownloadIcsFile !== false) {
794
+ await downloadIcsFile(ics);
795
+ }
796
+ return { id: null, ics };
797
+ }
798
+ catch (error) {
799
+ const message = error instanceof Error ? error.message : String(error);
800
+ return Promise.reject(new Error(message));
801
+ }
447
802
  }
448
803
  modifyEventWithPrompt(_options) {
449
804
  return this.throwUnimplemented(this.modifyEventWithPrompt.name);
450
805
  }
451
- createEvent(_options) {
452
- return this.throwUnimplemented(this.createEvent.name);
806
+ async createEvent(options) {
807
+ try {
808
+ const content = buildEventIcs(options);
809
+ const ics = new File([content], resolveIcsFileName(options), {
810
+ type: 'text/calendar;charset=utf-8',
811
+ });
812
+ if (options.autoDownloadIcsFile === true) {
813
+ await downloadIcsFile(ics);
814
+ }
815
+ return { id: null, ics };
816
+ }
817
+ catch (error) {
818
+ const message = error instanceof Error ? error.message : String(error);
819
+ return Promise.reject(new Error(message));
820
+ }
453
821
  }
454
822
  commit() {
455
823
  return this.throwUnimplemented(this.commit.name);
@@ -469,7 +837,7 @@ var capacitorCapacitorCalendar = (function (exports, core) {
469
837
  fetchAllRemindersSources() {
470
838
  return this.throwUnimplemented(this.fetchAllRemindersSources.name);
471
839
  }
472
- getDefaultCalendar() {
840
+ getDefaultCalendar(_options) {
473
841
  return this.throwUnimplemented(this.getDefaultCalendar.name);
474
842
  }
475
843
  getDefaultRemindersList() {
@@ -526,10 +894,85 @@ var capacitorCapacitorCalendar = (function (exports, core) {
526
894
  deleteReminderWithPrompt(_options) {
527
895
  return this.throwUnimplemented(this.deleteReminderWithPrompt.name);
528
896
  }
897
+ updateRemindersList(_options) {
898
+ return this.throwUnimplemented(this.updateRemindersList.name);
899
+ }
529
900
  throwUnimplemented(methodName) {
530
901
  return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web.`));
531
902
  }
532
903
  }
904
+ function mapPromptOptionsToCreateEvent(options) {
905
+ var _a;
906
+ return {
907
+ alerts: options.alerts,
908
+ availability: options.availability,
909
+ description: options.description,
910
+ endDate: options.endDate,
911
+ icsFileName: options.icsFileName,
912
+ isAllDay: options.isAllDay,
913
+ location: options.location,
914
+ recurrence: options.recurrence,
915
+ startDate: options.startDate,
916
+ title: (_a = options.title) !== null && _a !== void 0 ? _a : '',
917
+ url: options.url,
918
+ };
919
+ }
920
+ function buildCreateEventConfirmMessage(options) {
921
+ var _a;
922
+ const custom = (_a = options.promptMessage) === null || _a === void 0 ? void 0 : _a.trim();
923
+ if (custom != null && custom.length > 0) {
924
+ return custom;
925
+ }
926
+ const title = normalizeConfirmTitle(options.title);
927
+ const timeSummary = formatEventTimeSummary(options);
928
+ return `Create event?\n\n${title}\n${timeSummary}`;
929
+ }
930
+ function normalizeConfirmTitle(title) {
931
+ const collapsed = (title !== null && title !== void 0 ? title : '')
932
+ .replace(/[\r\n]+/g, ' ')
933
+ .replace(/\s+/g, ' ')
934
+ .trim();
935
+ return collapsed.length > 0 ? collapsed : 'Untitled event';
936
+ }
937
+ function formatEventTimeSummary(options) {
938
+ var _a;
939
+ const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
940
+ const isAllDay = options.isAllDay === true;
941
+ const endDate = resolveEndDate(startDate, options.endDate, undefined, isAllDay);
942
+ if (isAllDay) {
943
+ const startDay = formatLocalDate(startDate);
944
+ const lastInclusiveMs = endDate - DAY_MS;
945
+ const lastDay = formatLocalDate(lastInclusiveMs);
946
+ if (lastDay <= startDay) {
947
+ return `All day · ${formatDisplayDate(startDate)}`;
948
+ }
949
+ return `All day · ${formatDisplayDate(startDate)} – ${formatDisplayDate(lastInclusiveMs)}`;
950
+ }
951
+ return `${formatDisplayDateTime(startDate)} – ${formatDisplayDateTime(endDate)}`;
952
+ }
953
+ function formatLocalDate(ms) {
954
+ const date = new Date(ms);
955
+ const fullYear = date.getFullYear();
956
+ const month = String(date.getMonth() + 1).padStart(2, '0');
957
+ const dayOfMonth = String(date.getDate()).padStart(2, '0');
958
+ return `${fullYear}-${month}-${dayOfMonth}`;
959
+ }
960
+ function formatDisplayDate(ms) {
961
+ return new Date(ms).toLocaleDateString(undefined, {
962
+ year: 'numeric',
963
+ month: 'short',
964
+ day: 'numeric',
965
+ });
966
+ }
967
+ function formatDisplayDateTime(ms) {
968
+ return new Date(ms).toLocaleString(undefined, {
969
+ year: 'numeric',
970
+ month: 'short',
971
+ day: 'numeric',
972
+ hour: 'numeric',
973
+ minute: '2-digit',
974
+ });
975
+ }
533
976
 
534
977
  var web = /*#__PURE__*/Object.freeze({
535
978
  __proto__: null,
@@ -537,6 +980,7 @@ var capacitorCapacitorCalendar = (function (exports, core) {
537
980
  });
538
981
 
539
982
  exports.CapacitorCalendar = CapacitorCalendar;
983
+ exports.downloadIcsFile = downloadIcsFile;
540
984
 
541
985
  return exports;
542
986