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