@ebarooni/capacitor-calendar 8.7.1 → 8.9.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/README.md +202 -137
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +72 -25
- package/android/src/main/java/dev/barooni/capacitor/calendar/PluginError.kt +8 -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/utils/DeclarationCheck.kt +59 -0
- package/dist/docs.json +463 -81
- package/dist/esm/index.d.ts +7 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-permission-scope.d.ts +1 -1
- package/dist/esm/schemas/enums/calendar-permission-scope.js +1 -1
- package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -1
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.d.ts +13 -0
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.js +15 -0
- package/dist/esm/schemas/enums/capacitor-calendar-error-code.js.map +1 -0
- package/dist/esm/schemas/interfaces/calendar.d.ts +10 -2
- package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-calendar-options.d.ts +6 -4
- package/dist/esm/schemas/interfaces/create-calendar-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-options.d.ts +10 -1
- package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-result.d.ts +0 -2
- package/dist/esm/schemas/interfaces/create-event-result.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-event-with-prompt-options.d.ts +36 -10
- 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 +10 -1
- package/dist/esm/schemas/interfaces/create-event-with-prompt-result.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-reminder-options.d.ts +2 -0
- package/dist/esm/schemas/interfaces/create-reminder-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/create-reminders-list-options.d.ts +12 -7
- package/dist/esm/schemas/interfaces/create-reminders-list-options.js.map +1 -1
- 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/event-recurrence-rule.d.ts +9 -9
- package/dist/esm/schemas/interfaces/event-recurrence-rule.js.map +1 -1
- 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-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/modify-calendar-options.d.ts +6 -2
- package/dist/esm/schemas/interfaces/modify-calendar-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 +3 -0
- package/dist/esm/schemas/interfaces/modify-reminder-options.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminder.d.ts +2 -0
- package/dist/esm/schemas/interfaces/reminder.js.map +1 -1
- package/dist/esm/schemas/interfaces/reminders-list.d.ts +6 -0
- package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
- package/dist/esm/schemas/interfaces/update-reminders-list-options.d.ts +8 -5
- package/dist/esm/schemas/interfaces/update-reminders-list-options.js.map +1 -1
- 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/event-operations.d.ts +7 -10
- package/dist/esm/sub-definitions/event-operations.js.map +1 -1
- package/dist/esm/sub-definitions/reminders-access.d.ts +1 -1
- package/dist/esm/sub-definitions/reminders-access.js.map +1 -1
- package/dist/esm/sub-definitions/reminders-operations.d.ts +41 -16
- package/dist/esm/sub-definitions/reminders-operations.js.map +1 -1
- package/dist/esm/web/ics.d.ts +8 -2
- package/dist/esm/web/ics.js +64 -22
- package/dist/esm/web/ics.js.map +1 -1
- package/dist/esm/web.d.ts +8 -15
- package/dist/esm/web.js +100 -5
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +180 -29
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +180 -29
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorCalendarPlugin.swift +68 -22
- package/ios/Plugin/Models/Inputs/CreateCalendarInput.swift +5 -2
- package/ios/Plugin/Models/Inputs/CreateRemindersListInput.swift +4 -18
- package/ios/Plugin/Models/Inputs/ModifyCalendarInput.swift +2 -2
- package/ios/Plugin/Models/Inputs/UpdateRemindersListInput.swift +4 -18
- package/ios/Plugin/Models/Results/CreateEventWithPromptResult.swift +1 -0
- package/ios/Plugin/PluginError.swift +13 -0
- package/ios/Plugin/Utils/DeclarationCheck.swift +63 -0
- package/ios/Plugin/Utils/ImplementationHelper.swift +44 -0
- package/ios/Plugin/Utils/UIColorFromHexExtension.swift +5 -0
- package/package.json +1 -1
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AACA,OAAO,E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AAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAEM,wBAAwB,CAAC,QAAyC;QACvE,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IAEM,mBAAmB,CAAC,QAAoC;QAC7D,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAEO,kBAAkB,CAAI,UAAkB;QAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,UAAU,iCAAiC,CAAC,CAAC,CAAC;IAC5F,CAAC;CACF","sourcesContent":["import type { PermissionState } from '@capacitor/core';\nimport { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorCalendarPlugin } from './definitions';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { CalendarSource } from './schemas/interfaces/calendar-source';\nimport type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';\nimport type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';\nimport type { CreateEventOptions } from './schemas/interfaces/create-event-options';\nimport type { CreateEventResult } from './schemas/interfaces/create-event-result';\nimport type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\nimport type { CreateReminderResult } from './schemas/interfaces/create-reminder-result';\nimport type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';\nimport type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';\nimport type { DeleteCalendarOptions } from './schemas/interfaces/delete-calendar-options';\nimport type { DeleteEventOptions } from './schemas/interfaces/delete-event-options';\nimport type { DeleteEventWithPromptOptions } from './schemas/interfaces/delete-event-with-prompt-options';\nimport type { DeleteEventsByIdOptions } from './schemas/interfaces/delete-events-by-id-options';\nimport type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder-options';\nimport type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';\nimport type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';\nimport type { DeleteRemindersByIdResult } from './schemas/interfaces/delete-reminders-by-id-result';\nimport type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';\nimport type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';\nimport type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';\nimport type { GetReminderByIdResult } from './schemas/interfaces/get-reminder-by-id-result';\nimport type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { GetRemindersFromListsResult } from './schemas/interfaces/get-reminders-from-lists-result';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\nimport type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';\nimport type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';\nimport type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';\nimport type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder-options';\nimport type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';\nimport type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';\nimport type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';\nimport type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';\nimport type { EventEditAction } from './schemas/types/event-edit-action';\nimport type { CheckAllPermissionsResult, RequestAllPermissionsResult } from './sub-definitions/calendar-access';\nimport type { DeleteEventsByIdResult } from './sub-definitions/event-operations';\nimport { buildEventIcs, resolveIcsFileName } from './web/ics';\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: CheckPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.checkPermission.name);\n }\n\n public checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }> {\n return this.throwUnimplemented(this.checkAllPermissions.name);\n }\n\n public requestPermission(_options: RequestPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestPermission.name);\n }\n\n public createRemindersList(_options: CreateRemindersListOptions): Promise<CreateRemindersListResult> {\n return this.throwUnimplemented(this.createRemindersList.name);\n }\n\n public deleteRemindersList(_options: DeleteRemindersListOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteRemindersList.name);\n }\n\n public requestAllPermissions(): Promise<{\n result: RequestAllPermissionsResult;\n }> {\n return this.throwUnimplemented(this.requestAllPermissions.name);\n }\n\n public requestWriteOnlyCalendarAccess(): Promise<{\n result: PermissionState;\n }> {\n return this.throwUnimplemented(this.requestWriteOnlyCalendarAccess.name);\n }\n\n public requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestReadOnlyCalendarAccess.name);\n }\n\n public requestFullCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullCalendarAccess.name);\n }\n\n public requestFullRemindersAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullRemindersAccess.name);\n }\n\n public createEventWithPrompt(_options: CreateEventWithPromptOptions): Promise<CreateEventWithPromptResult> {\n return this.throwUnimplemented(this.createEventWithPrompt.name);\n }\n\n public modifyEventWithPrompt(_options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }> {\n return this.throwUnimplemented(this.modifyEventWithPrompt.name);\n }\n\n public createEvent(options: CreateEventOptions): Promise<CreateEventResult> {\n try {\n const content = buildEventIcs(options);\n const ics = new File([content], resolveIcsFileName(options), {\n type: 'text/calendar;charset=utf-8',\n });\n return Promise.resolve({ id: null, ics });\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public commit(): Promise<void> {\n return this.throwUnimplemented(this.commit.name);\n }\n\n public modifyEvent(_options: ModifyEventOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyEvent.name);\n }\n\n public selectCalendarsWithPrompt(\n _options?: SelectCalendarsWithPromptOptions,\n ): Promise<SelectCalendarsWithPromptResult> {\n return this.throwUnimplemented(this.selectCalendarsWithPrompt.name);\n }\n\n public fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllCalendarSources.name);\n }\n\n public listCalendars(): Promise<ListCalendarsResult> {\n return this.throwUnimplemented(this.listCalendars.name);\n }\n\n public fetchAllRemindersSources(): Promise<{ result: CalendarSource[] }> {\n return this.throwUnimplemented(this.fetchAllRemindersSources.name);\n }\n\n public getDefaultCalendar(_options?: GetDefaultCalendarOptions): Promise<{ result: Calendar | null }> {\n return this.throwUnimplemented(this.getDefaultCalendar.name);\n }\n\n public getDefaultRemindersList(): Promise<{ result: RemindersList | null }> {\n return this.throwUnimplemented(this.getDefaultRemindersList.name);\n }\n\n public openReminders(): Promise<void> {\n return this.throwUnimplemented(this.openReminders.name);\n }\n\n public getRemindersLists(): Promise<{ result: RemindersList[] }> {\n return this.throwUnimplemented(this.getRemindersLists.name);\n }\n\n public openCalendar(_options?: OpenCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.openCalendar.name);\n }\n\n public createCalendar(_options: CreateCalendarOptions): Promise<CreateCalendarResult> {\n return this.throwUnimplemented(this.createCalendar.name);\n }\n\n public deleteCalendar(_options: DeleteCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteCalendar.name);\n }\n\n public createReminder(_options: CreateReminderOptions): Promise<CreateReminderResult> {\n return this.throwUnimplemented(this.createReminder.name);\n }\n\n public deleteRemindersById(_options: DeleteRemindersByIdOptions): Promise<{ result: DeleteRemindersByIdResult }> {\n return this.throwUnimplemented(this.deleteRemindersById.name);\n }\n\n public deleteReminder(_options: DeleteReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteReminder.name);\n }\n\n public modifyReminder(_options: ModifyReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyReminder.name);\n }\n\n public getReminderById(_options: GetReminderByIdOptions): Promise<GetReminderByIdResult> {\n return this.throwUnimplemented(this.getReminderById.name);\n }\n\n public getRemindersFromLists(_options: GetRemindersFromListsOptions): Promise<GetRemindersFromListsResult> {\n return this.throwUnimplemented(this.getRemindersFromLists.name);\n }\n\n public deleteEventsById(_options: DeleteEventsByIdOptions): Promise<{\n result: DeleteEventsByIdResult;\n }> {\n return this.throwUnimplemented(this.deleteEventsById.name);\n }\n\n public deleteEvent(_options: DeleteEventOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteEvent.name);\n }\n\n public deleteEventWithPrompt(_options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }> {\n return this.throwUnimplemented(this.deleteEventWithPrompt.name);\n }\n\n public listEventsInRange(_options: ListEventsInRangeOptions): Promise<ListEventsInRangeResult> {\n return this.throwUnimplemented(this.listEventsInRange.name);\n }\n\n public modifyCalendar(_options: ModifyCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyCalendar.name);\n }\n\n public deleteReminderWithPrompt(_options: DeleteReminderWithPromptOptions): Promise<{ deleted: boolean }> {\n return this.throwUnimplemented(this.deleteReminderWithPrompt.name);\n }\n\n public updateRemindersList(_options: UpdateRemindersListOptions): Promise<UpdateRemindersListResult> {\n return this.throwUnimplemented(this.updateRemindersList.name);\n }\n\n private throwUnimplemented<T>(methodName: string): Promise<T> {\n return Promise.reject(this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AAM,IAAI,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,OAAO,GAAG,QAAQ,IAAI,KAAK,IAAI,UAAU,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,iBAAiB,CAAC,EAAU;IACnC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE;QAChD,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,EAAU;IACvC,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;QAC5C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { PermissionState } from '@capacitor/core';\nimport { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorCalendarPlugin } from './definitions';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { CheckPermissionOptions } from './schemas/interfaces/check-permission-options';\nimport type { CreateCalendarOptions } from './schemas/interfaces/create-calendar-options';\nimport type { CreateCalendarResult } from './schemas/interfaces/create-calendar-result';\nimport type { CreateEventOptions } from './schemas/interfaces/create-event-options';\nimport type { CreateEventResult } from './schemas/interfaces/create-event-result';\nimport type { CreateEventWithPromptOptions } from './schemas/interfaces/create-event-with-prompt-options';\nimport type { CreateEventWithPromptResult } from './schemas/interfaces/create-event-with-prompt-result';\nimport type { CreateReminderOptions } from './schemas/interfaces/create-reminder-options';\nimport type { CreateReminderResult } from './schemas/interfaces/create-reminder-result';\nimport type { CreateRemindersListOptions } from './schemas/interfaces/create-reminders-list-options';\nimport type { CreateRemindersListResult } from './schemas/interfaces/create-reminders-list-result';\nimport type { DeleteCalendarOptions } from './schemas/interfaces/delete-calendar-options';\nimport type { DeleteEventOptions } from './schemas/interfaces/delete-event-options';\nimport type { DeleteEventWithPromptOptions } from './schemas/interfaces/delete-event-with-prompt-options';\nimport type { DeleteEventsByIdOptions } from './schemas/interfaces/delete-events-by-id-options';\nimport type { DeleteReminderOptions } from './schemas/interfaces/delete-reminder-options';\nimport type { DeleteReminderWithPromptOptions } from './schemas/interfaces/delete-reminder-with-prompt-options';\nimport type { DeleteReminderWithPromptResult } from './schemas/interfaces/delete-reminder-with-prompt-result';\nimport type { DeleteRemindersByIdOptions } from './schemas/interfaces/delete-reminders-by-id-options';\nimport type { DeleteRemindersByIdResult } from './schemas/interfaces/delete-reminders-by-id-result';\nimport type { DeleteRemindersListOptions } from './schemas/interfaces/delete-reminders-list-options';\nimport type { FetchAllCalendarSourcesResult } from './schemas/interfaces/fetch-all-calendar-sources-result';\nimport type { GetDefaultCalendarOptions } from './schemas/interfaces/get-default-calendar-options';\nimport type { GetDefaultRemindersListResult } from './schemas/interfaces/get-default-reminders-list-result';\nimport type { GetReminderByIdOptions } from './schemas/interfaces/get-reminder-by-id-options';\nimport type { GetReminderByIdResult } from './schemas/interfaces/get-reminder-by-id-result';\nimport type { GetRemindersFromListsOptions } from './schemas/interfaces/get-reminders-from-lists-options';\nimport type { GetRemindersFromListsResult } from './schemas/interfaces/get-reminders-from-lists-result';\nimport type { GetRemindersListsResult } from './schemas/interfaces/get-reminders-lists-result';\nimport type { ListCalendarsResult } from './schemas/interfaces/list-calendars-result';\nimport type { ListEventsInRangeOptions } from './schemas/interfaces/list-events-in-range-options';\nimport type { ListEventsInRangeResult } from './schemas/interfaces/list-events-in-range-result';\nimport type { ModifyCalendarOptions } from './schemas/interfaces/modify-calendar-options';\nimport type { ModifyEventOptions } from './schemas/interfaces/modify-event-options';\nimport type { ModifyEventWithPromptOptions } from './schemas/interfaces/modify-event-with-prompt-options';\nimport type { ModifyReminderOptions } from './schemas/interfaces/modify-reminder-options';\nimport type { OpenCalendarOptions } from './schemas/interfaces/open-calendar-options';\nimport type { RequestPermissionOptions } from './schemas/interfaces/request-permission-options';\nimport type { SelectCalendarsWithPromptOptions } from './schemas/interfaces/select-calendars-with-prompt-options';\nimport type { SelectCalendarsWithPromptResult } from './schemas/interfaces/select-calendars-with-prompt-result';\nimport type { UpdateRemindersListOptions } from './schemas/interfaces/update-reminders-list-options';\nimport type { UpdateRemindersListResult } from './schemas/interfaces/update-reminders-list-result';\nimport type { EventEditAction } from './schemas/types/event-edit-action';\nimport type { CheckAllPermissionsResult, RequestAllPermissionsResult } from './sub-definitions/calendar-access';\nimport type { DeleteEventsByIdResult } from './sub-definitions/event-operations';\nimport { downloadIcsFile } from './web/download-ics-file';\nimport { buildEventIcs, resolveEndDate, resolveIcsFileName } from './web/ics';\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\nexport class CapacitorCalendarWeb extends WebPlugin implements CapacitorCalendarPlugin {\n public checkPermission(_options: CheckPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.checkPermission.name);\n }\n\n public checkAllPermissions(): Promise<{ result: CheckAllPermissionsResult }> {\n return this.throwUnimplemented(this.checkAllPermissions.name);\n }\n\n public requestPermission(_options: RequestPermissionOptions): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestPermission.name);\n }\n\n public createRemindersList(_options: CreateRemindersListOptions): Promise<CreateRemindersListResult> {\n return this.throwUnimplemented(this.createRemindersList.name);\n }\n\n public deleteRemindersList(_options: DeleteRemindersListOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteRemindersList.name);\n }\n\n public requestAllPermissions(): Promise<{\n result: RequestAllPermissionsResult;\n }> {\n return this.throwUnimplemented(this.requestAllPermissions.name);\n }\n\n public requestWriteOnlyCalendarAccess(): Promise<{\n result: PermissionState;\n }> {\n return this.throwUnimplemented(this.requestWriteOnlyCalendarAccess.name);\n }\n\n public requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestReadOnlyCalendarAccess.name);\n }\n\n public requestFullCalendarAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullCalendarAccess.name);\n }\n\n public requestFullRemindersAccess(): Promise<{ result: PermissionState }> {\n return this.throwUnimplemented(this.requestFullRemindersAccess.name);\n }\n\n public async createEventWithPrompt(options: CreateEventWithPromptOptions = {}): Promise<CreateEventWithPromptResult> {\n try {\n const confirmed = window.confirm(buildCreateEventConfirmMessage(options));\n if (!confirmed) {\n return { id: null, ics: null };\n }\n\n const createOptions = mapPromptOptionsToCreateEvent(options);\n const content = buildEventIcs(createOptions);\n const ics = new File([content], resolveIcsFileName(createOptions), {\n type: 'text/calendar;charset=utf-8',\n });\n\n if (options.autoDownloadIcsFile !== false) {\n await downloadIcsFile(ics);\n }\n\n return { id: null, ics };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public modifyEventWithPrompt(_options: ModifyEventWithPromptOptions): Promise<{ result: EventEditAction | null }> {\n return this.throwUnimplemented(this.modifyEventWithPrompt.name);\n }\n\n public async createEvent(options: CreateEventOptions): Promise<CreateEventResult> {\n try {\n const content = buildEventIcs(options);\n const ics = new File([content], resolveIcsFileName(options), {\n type: 'text/calendar;charset=utf-8',\n });\n if (options.autoDownloadIcsFile === true) {\n await downloadIcsFile(ics);\n }\n return { id: null, ics };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return Promise.reject(new Error(message));\n }\n }\n\n public commit(): Promise<void> {\n return this.throwUnimplemented(this.commit.name);\n }\n\n public modifyEvent(_options: ModifyEventOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyEvent.name);\n }\n\n public selectCalendarsWithPrompt(\n _options?: SelectCalendarsWithPromptOptions,\n ): Promise<SelectCalendarsWithPromptResult> {\n return this.throwUnimplemented(this.selectCalendarsWithPrompt.name);\n }\n\n public fetchAllCalendarSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllCalendarSources.name);\n }\n\n public listCalendars(): Promise<ListCalendarsResult> {\n return this.throwUnimplemented(this.listCalendars.name);\n }\n\n public fetchAllRemindersSources(): Promise<FetchAllCalendarSourcesResult> {\n return this.throwUnimplemented(this.fetchAllRemindersSources.name);\n }\n\n public getDefaultCalendar(_options?: GetDefaultCalendarOptions): Promise<{ result: Calendar | null }> {\n return this.throwUnimplemented(this.getDefaultCalendar.name);\n }\n\n public getDefaultRemindersList(): Promise<GetDefaultRemindersListResult> {\n return this.throwUnimplemented(this.getDefaultRemindersList.name);\n }\n\n public openReminders(): Promise<void> {\n return this.throwUnimplemented(this.openReminders.name);\n }\n\n public getRemindersLists(): Promise<GetRemindersListsResult> {\n return this.throwUnimplemented(this.getRemindersLists.name);\n }\n\n public openCalendar(_options?: OpenCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.openCalendar.name);\n }\n\n public createCalendar(_options: CreateCalendarOptions): Promise<CreateCalendarResult> {\n return this.throwUnimplemented(this.createCalendar.name);\n }\n\n public deleteCalendar(_options: DeleteCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteCalendar.name);\n }\n\n public createReminder(_options: CreateReminderOptions): Promise<CreateReminderResult> {\n return this.throwUnimplemented(this.createReminder.name);\n }\n\n public deleteRemindersById(_options: DeleteRemindersByIdOptions): Promise<{ result: DeleteRemindersByIdResult }> {\n return this.throwUnimplemented(this.deleteRemindersById.name);\n }\n\n public deleteReminder(_options: DeleteReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteReminder.name);\n }\n\n public modifyReminder(_options: ModifyReminderOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyReminder.name);\n }\n\n public getReminderById(_options: GetReminderByIdOptions): Promise<GetReminderByIdResult> {\n return this.throwUnimplemented(this.getReminderById.name);\n }\n\n public getRemindersFromLists(_options: GetRemindersFromListsOptions): Promise<GetRemindersFromListsResult> {\n return this.throwUnimplemented(this.getRemindersFromLists.name);\n }\n\n public deleteEventsById(_options: DeleteEventsByIdOptions): Promise<{\n result: DeleteEventsByIdResult;\n }> {\n return this.throwUnimplemented(this.deleteEventsById.name);\n }\n\n public deleteEvent(_options: DeleteEventOptions): Promise<void> {\n return this.throwUnimplemented(this.deleteEvent.name);\n }\n\n public deleteEventWithPrompt(_options: DeleteEventWithPromptOptions): Promise<{ deleted: boolean }> {\n return this.throwUnimplemented(this.deleteEventWithPrompt.name);\n }\n\n public listEventsInRange(_options: ListEventsInRangeOptions): Promise<ListEventsInRangeResult> {\n return this.throwUnimplemented(this.listEventsInRange.name);\n }\n\n public modifyCalendar(_options: ModifyCalendarOptions): Promise<void> {\n return this.throwUnimplemented(this.modifyCalendar.name);\n }\n\n public deleteReminderWithPrompt(_options: DeleteReminderWithPromptOptions): Promise<DeleteReminderWithPromptResult> {\n return this.throwUnimplemented(this.deleteReminderWithPrompt.name);\n }\n\n public updateRemindersList(_options: UpdateRemindersListOptions): Promise<UpdateRemindersListResult> {\n return this.throwUnimplemented(this.updateRemindersList.name);\n }\n\n private throwUnimplemented<T>(methodName: string): Promise<T> {\n return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web.`));\n }\n}\n\nfunction mapPromptOptionsToCreateEvent(options: CreateEventWithPromptOptions): CreateEventOptions {\n return {\n alerts: options.alerts,\n availability: options.availability,\n description: options.description,\n endDate: options.endDate,\n icsFileName: options.icsFileName,\n isAllDay: options.isAllDay,\n location: options.location,\n recurrence: options.recurrence,\n startDate: options.startDate,\n title: options.title ?? '',\n url: options.url,\n };\n}\n\nfunction buildCreateEventConfirmMessage(options: CreateEventWithPromptOptions): string {\n const custom = options.promptMessage?.trim();\n if (custom != null && custom.length > 0) {\n return custom;\n }\n\n const title = normalizeConfirmTitle(options.title);\n const timeSummary = formatEventTimeSummary(options);\n return `Create event?\\n\\n${title}\\n${timeSummary}`;\n}\n\nfunction normalizeConfirmTitle(title?: string): string {\n const collapsed = (title ?? '')\n .replace(/[\\r\\n]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n return collapsed.length > 0 ? collapsed : 'Untitled event';\n}\n\nfunction formatEventTimeSummary(options: CreateEventWithPromptOptions): string {\n const startDate = options.startDate ?? Date.now();\n const isAllDay = options.isAllDay === true;\n const endDate = resolveEndDate(startDate, options.endDate, undefined, isAllDay);\n\n if (isAllDay) {\n const startDay = formatLocalDate(startDate);\n const lastInclusiveMs = endDate - DAY_MS;\n const lastDay = formatLocalDate(lastInclusiveMs);\n if (lastDay <= startDay) {\n return `All day · ${formatDisplayDate(startDate)}`;\n }\n return `All day · ${formatDisplayDate(startDate)} – ${formatDisplayDate(lastInclusiveMs)}`;\n }\n\n return `${formatDisplayDateTime(startDate)} – ${formatDisplayDateTime(endDate)}`;\n}\n\nfunction formatLocalDate(ms: number): string {\n const date = new Date(ms);\n const fullYear = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const dayOfMonth = String(date.getDate()).padStart(2, '0');\n return `${fullYear}-${month}-${dayOfMonth}`;\n}\n\nfunction formatDisplayDate(ms: number): string {\n return new Date(ms).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n}\n\nfunction formatDisplayDateTime(ms: number): string {\n return new Date(ms).toLocaleString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n });\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -205,7 +205,7 @@ exports.CalendarPermissionScope = void 0;
|
|
|
205
205
|
* | Platform | Required |
|
|
206
206
|
* |-----------|---------------------|
|
|
207
207
|
* | iOS 17+ | `NSRemindersFullAccessUsageDescription` |
|
|
208
|
-
* | iOS
|
|
208
|
+
* | iOS 13-16 | `NSRemindersUsageDescription` |
|
|
209
209
|
* @platform iOS
|
|
210
210
|
* @since 7.1.0
|
|
211
211
|
*/
|
|
@@ -301,6 +301,21 @@ exports.CalendarType = void 0;
|
|
|
301
301
|
CalendarType[CalendarType["BIRTHDAY"] = 4] = "BIRTHDAY";
|
|
302
302
|
})(exports.CalendarType || (exports.CalendarType = {}));
|
|
303
303
|
|
|
304
|
+
/**
|
|
305
|
+
* Stable reject codes for CapacitorCalendar. Compare with `error.code`.
|
|
306
|
+
*
|
|
307
|
+
* @since 8.9.0
|
|
308
|
+
*/
|
|
309
|
+
exports.CapacitorCalendarErrorCode = void 0;
|
|
310
|
+
(function (CapacitorCalendarErrorCode) {
|
|
311
|
+
/**
|
|
312
|
+
* Missing Info.plist usage description or AndroidManifest permission declaration.
|
|
313
|
+
*
|
|
314
|
+
* @since 8.9.0
|
|
315
|
+
*/
|
|
316
|
+
CapacitorCalendarErrorCode["MissingDeclaration"] = "EB-CLDR-0100";
|
|
317
|
+
})(exports.CapacitorCalendarErrorCode || (exports.CapacitorCalendarErrorCode = {}));
|
|
318
|
+
|
|
304
319
|
/**
|
|
305
320
|
* @since 7.1.0
|
|
306
321
|
*/
|
|
@@ -441,18 +456,18 @@ const CapacitorCalendar = core.registerPlugin('CapacitorCalendar', {
|
|
|
441
456
|
});
|
|
442
457
|
|
|
443
458
|
const HOUR_MS = 60 * 60 * 1000;
|
|
444
|
-
const DAY_MS = 24 * HOUR_MS;
|
|
459
|
+
const DAY_MS$1 = 24 * HOUR_MS;
|
|
445
460
|
const CRLF = '\r\n';
|
|
446
461
|
/**
|
|
447
462
|
* Builds an RFC 5545 `VCALENDAR` document with one `VEVENT` from CreateEventOptions.
|
|
448
|
-
*
|
|
449
|
-
*
|
|
463
|
+
* End comes from `endDate`, else `duration` (RFC 2445), else one hour (or next day if all-day).
|
|
464
|
+
* All-day ends that fall on the start's local day bump to the next day (exclusive `DTEND`).
|
|
450
465
|
*/
|
|
451
466
|
function buildEventIcs(options) {
|
|
452
467
|
var _a;
|
|
453
468
|
const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
|
|
454
469
|
const isAllDay = options.isAllDay === true;
|
|
455
|
-
const endDate = resolveEndDate(startDate, options.endDate, isAllDay);
|
|
470
|
+
const endDate = resolveEndDate(startDate, options.endDate, options.duration, isAllDay);
|
|
456
471
|
const lines = [
|
|
457
472
|
'BEGIN:VCALENDAR',
|
|
458
473
|
'VERSION:2.0',
|
|
@@ -531,18 +546,60 @@ function fileNameFromTitle(title) {
|
|
|
531
546
|
.slice(0, 64);
|
|
532
547
|
return `${base.length > 0 ? base : 'event'}.ics`;
|
|
533
548
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
549
|
+
/**
|
|
550
|
+
* Resolves event end milliseconds the same way ICS export does.
|
|
551
|
+
* Prefers `endDate`, else `duration` (RFC 2445), else one hour (or next day if all-day).
|
|
552
|
+
* All-day ends that fall on the start's local day bump to the next day (exclusive `DTEND`).
|
|
553
|
+
*/
|
|
554
|
+
function resolveEndDate(startDate, endDate, duration, isAllDay) {
|
|
555
|
+
let resolved;
|
|
556
|
+
if (endDate != null) {
|
|
557
|
+
resolved = endDate;
|
|
558
|
+
}
|
|
559
|
+
else if (duration != null && duration.trim().length > 0) {
|
|
560
|
+
resolved = startDate + parseRfc2445DurationMs(duration.trim());
|
|
537
561
|
}
|
|
538
|
-
|
|
539
|
-
|
|
562
|
+
else {
|
|
563
|
+
resolved = isAllDay ? startDate + DAY_MS$1 : startDate + HOUR_MS;
|
|
564
|
+
}
|
|
565
|
+
if (!isAllDay) {
|
|
566
|
+
return resolved;
|
|
540
567
|
}
|
|
541
568
|
// ICS all-day DTEND is exclusive; same local date as DTSTART is zero-length.
|
|
542
|
-
|
|
543
|
-
|
|
569
|
+
// Also covers short durations (e.g. PT1H) on all-day events — treat as one whole day.
|
|
570
|
+
if (formatDateOnlyLocal(resolved) <= formatDateOnlyLocal(startDate)) {
|
|
571
|
+
return startDate + DAY_MS$1;
|
|
544
572
|
}
|
|
545
|
-
return
|
|
573
|
+
return resolved;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Parses an RFC 2445 / RFC 5545 duration string into milliseconds.
|
|
577
|
+
* Supports forms such as `PT1H`, `P1D`, `P3W`, `P2DT4H30M`.
|
|
578
|
+
*
|
|
579
|
+
* @throws If the string is empty, negative, zero-length, or not a valid duration.
|
|
580
|
+
*/
|
|
581
|
+
function parseRfc2445DurationMs(value) {
|
|
582
|
+
var _a, _b, _c, _d, _e;
|
|
583
|
+
const match = /^([+-])?P(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(value);
|
|
584
|
+
if (match == null) {
|
|
585
|
+
throw new Error(`Invalid duration: ${value}`);
|
|
586
|
+
}
|
|
587
|
+
const sign = match[1] === '-' ? -1 : 1;
|
|
588
|
+
const weeks = Number((_a = match[2]) !== null && _a !== void 0 ? _a : 0);
|
|
589
|
+
const days = Number((_b = match[3]) !== null && _b !== void 0 ? _b : 0);
|
|
590
|
+
const hours = Number((_c = match[4]) !== null && _c !== void 0 ? _c : 0);
|
|
591
|
+
const minutes = Number((_d = match[5]) !== null && _d !== void 0 ? _d : 0);
|
|
592
|
+
const seconds = Number((_e = match[6]) !== null && _e !== void 0 ? _e : 0);
|
|
593
|
+
// Require at least one unit so bare "P" / "PT" are rejected.
|
|
594
|
+
if (weeks === 0 && days === 0 && hours === 0 && minutes === 0 && seconds === 0) {
|
|
595
|
+
throw new Error(`Invalid duration: ${value}`);
|
|
596
|
+
}
|
|
597
|
+
const ms = weeks * 7 * DAY_MS$1 + days * DAY_MS$1 + hours * HOUR_MS + minutes * 60 * 1000 + seconds * 1000;
|
|
598
|
+
const signed = sign * ms;
|
|
599
|
+
if (signed <= 0) {
|
|
600
|
+
throw new Error(`Invalid duration: ${value}`);
|
|
601
|
+
}
|
|
602
|
+
return signed;
|
|
546
603
|
}
|
|
547
604
|
function mapTransparency(availability) {
|
|
548
605
|
if (availability == null) {
|
|
@@ -617,21 +674,21 @@ function generateUid() {
|
|
|
617
674
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}@capacitor-calendar`;
|
|
618
675
|
}
|
|
619
676
|
function formatDateTimeUtc(ms) {
|
|
620
|
-
const
|
|
621
|
-
const
|
|
622
|
-
const
|
|
623
|
-
const
|
|
624
|
-
const
|
|
625
|
-
const
|
|
626
|
-
const
|
|
627
|
-
return `${
|
|
677
|
+
const date = new Date(ms);
|
|
678
|
+
const fullYear = date.getUTCFullYear();
|
|
679
|
+
const month = padTwoDigits(date.getUTCMonth() + 1);
|
|
680
|
+
const dayOfMonth = padTwoDigits(date.getUTCDate());
|
|
681
|
+
const hours = padTwoDigits(date.getUTCHours());
|
|
682
|
+
const minutes = padTwoDigits(date.getUTCMinutes());
|
|
683
|
+
const seconds = padTwoDigits(date.getUTCSeconds());
|
|
684
|
+
return `${fullYear}${month}${dayOfMonth}T${hours}${minutes}${seconds}Z`;
|
|
628
685
|
}
|
|
629
686
|
function formatDateOnlyLocal(ms) {
|
|
630
|
-
const
|
|
631
|
-
return `${
|
|
687
|
+
const date = new Date(ms);
|
|
688
|
+
return `${date.getFullYear()}${padTwoDigits(date.getMonth() + 1)}${padTwoDigits(date.getDate())}`;
|
|
632
689
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
690
|
+
function padTwoDigits(value) {
|
|
691
|
+
return value < 10 ? `0${value}` : String(value);
|
|
635
692
|
}
|
|
636
693
|
/**
|
|
637
694
|
* Escapes TEXT values per RFC 5545 §3.3.11.
|
|
@@ -691,6 +748,7 @@ function byteLength(s) {
|
|
|
691
748
|
return new TextEncoder().encode(s).length;
|
|
692
749
|
}
|
|
693
750
|
|
|
751
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
694
752
|
class CapacitorCalendarWeb extends core.WebPlugin {
|
|
695
753
|
checkPermission(_options) {
|
|
696
754
|
return this.throwUnimplemented(this.checkPermission.name);
|
|
@@ -722,19 +780,40 @@ class CapacitorCalendarWeb extends core.WebPlugin {
|
|
|
722
780
|
requestFullRemindersAccess() {
|
|
723
781
|
return this.throwUnimplemented(this.requestFullRemindersAccess.name);
|
|
724
782
|
}
|
|
725
|
-
createEventWithPrompt(
|
|
726
|
-
|
|
783
|
+
async createEventWithPrompt(options = {}) {
|
|
784
|
+
try {
|
|
785
|
+
const confirmed = window.confirm(buildCreateEventConfirmMessage(options));
|
|
786
|
+
if (!confirmed) {
|
|
787
|
+
return { id: null, ics: null };
|
|
788
|
+
}
|
|
789
|
+
const createOptions = mapPromptOptionsToCreateEvent(options);
|
|
790
|
+
const content = buildEventIcs(createOptions);
|
|
791
|
+
const ics = new File([content], resolveIcsFileName(createOptions), {
|
|
792
|
+
type: 'text/calendar;charset=utf-8',
|
|
793
|
+
});
|
|
794
|
+
if (options.autoDownloadIcsFile !== false) {
|
|
795
|
+
await downloadIcsFile(ics);
|
|
796
|
+
}
|
|
797
|
+
return { id: null, ics };
|
|
798
|
+
}
|
|
799
|
+
catch (error) {
|
|
800
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
801
|
+
return Promise.reject(new Error(message));
|
|
802
|
+
}
|
|
727
803
|
}
|
|
728
804
|
modifyEventWithPrompt(_options) {
|
|
729
805
|
return this.throwUnimplemented(this.modifyEventWithPrompt.name);
|
|
730
806
|
}
|
|
731
|
-
createEvent(options) {
|
|
807
|
+
async createEvent(options) {
|
|
732
808
|
try {
|
|
733
809
|
const content = buildEventIcs(options);
|
|
734
810
|
const ics = new File([content], resolveIcsFileName(options), {
|
|
735
811
|
type: 'text/calendar;charset=utf-8',
|
|
736
812
|
});
|
|
737
|
-
|
|
813
|
+
if (options.autoDownloadIcsFile === true) {
|
|
814
|
+
await downloadIcsFile(ics);
|
|
815
|
+
}
|
|
816
|
+
return { id: null, ics };
|
|
738
817
|
}
|
|
739
818
|
catch (error) {
|
|
740
819
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -823,6 +902,78 @@ class CapacitorCalendarWeb extends core.WebPlugin {
|
|
|
823
902
|
return Promise.reject(this.unimplemented(`${methodName} is not implemented on the web.`));
|
|
824
903
|
}
|
|
825
904
|
}
|
|
905
|
+
function mapPromptOptionsToCreateEvent(options) {
|
|
906
|
+
var _a;
|
|
907
|
+
return {
|
|
908
|
+
alerts: options.alerts,
|
|
909
|
+
availability: options.availability,
|
|
910
|
+
description: options.description,
|
|
911
|
+
endDate: options.endDate,
|
|
912
|
+
icsFileName: options.icsFileName,
|
|
913
|
+
isAllDay: options.isAllDay,
|
|
914
|
+
location: options.location,
|
|
915
|
+
recurrence: options.recurrence,
|
|
916
|
+
startDate: options.startDate,
|
|
917
|
+
title: (_a = options.title) !== null && _a !== void 0 ? _a : '',
|
|
918
|
+
url: options.url,
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
function buildCreateEventConfirmMessage(options) {
|
|
922
|
+
var _a;
|
|
923
|
+
const custom = (_a = options.promptMessage) === null || _a === void 0 ? void 0 : _a.trim();
|
|
924
|
+
if (custom != null && custom.length > 0) {
|
|
925
|
+
return custom;
|
|
926
|
+
}
|
|
927
|
+
const title = normalizeConfirmTitle(options.title);
|
|
928
|
+
const timeSummary = formatEventTimeSummary(options);
|
|
929
|
+
return `Create event?\n\n${title}\n${timeSummary}`;
|
|
930
|
+
}
|
|
931
|
+
function normalizeConfirmTitle(title) {
|
|
932
|
+
const collapsed = (title !== null && title !== void 0 ? title : '')
|
|
933
|
+
.replace(/[\r\n]+/g, ' ')
|
|
934
|
+
.replace(/\s+/g, ' ')
|
|
935
|
+
.trim();
|
|
936
|
+
return collapsed.length > 0 ? collapsed : 'Untitled event';
|
|
937
|
+
}
|
|
938
|
+
function formatEventTimeSummary(options) {
|
|
939
|
+
var _a;
|
|
940
|
+
const startDate = (_a = options.startDate) !== null && _a !== void 0 ? _a : Date.now();
|
|
941
|
+
const isAllDay = options.isAllDay === true;
|
|
942
|
+
const endDate = resolveEndDate(startDate, options.endDate, undefined, isAllDay);
|
|
943
|
+
if (isAllDay) {
|
|
944
|
+
const startDay = formatLocalDate(startDate);
|
|
945
|
+
const lastInclusiveMs = endDate - DAY_MS;
|
|
946
|
+
const lastDay = formatLocalDate(lastInclusiveMs);
|
|
947
|
+
if (lastDay <= startDay) {
|
|
948
|
+
return `All day · ${formatDisplayDate(startDate)}`;
|
|
949
|
+
}
|
|
950
|
+
return `All day · ${formatDisplayDate(startDate)} – ${formatDisplayDate(lastInclusiveMs)}`;
|
|
951
|
+
}
|
|
952
|
+
return `${formatDisplayDateTime(startDate)} – ${formatDisplayDateTime(endDate)}`;
|
|
953
|
+
}
|
|
954
|
+
function formatLocalDate(ms) {
|
|
955
|
+
const date = new Date(ms);
|
|
956
|
+
const fullYear = date.getFullYear();
|
|
957
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
958
|
+
const dayOfMonth = String(date.getDate()).padStart(2, '0');
|
|
959
|
+
return `${fullYear}-${month}-${dayOfMonth}`;
|
|
960
|
+
}
|
|
961
|
+
function formatDisplayDate(ms) {
|
|
962
|
+
return new Date(ms).toLocaleDateString(undefined, {
|
|
963
|
+
year: 'numeric',
|
|
964
|
+
month: 'short',
|
|
965
|
+
day: 'numeric',
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
function formatDisplayDateTime(ms) {
|
|
969
|
+
return new Date(ms).toLocaleString(undefined, {
|
|
970
|
+
year: 'numeric',
|
|
971
|
+
month: 'short',
|
|
972
|
+
day: 'numeric',
|
|
973
|
+
hour: 'numeric',
|
|
974
|
+
minute: '2-digit',
|
|
975
|
+
});
|
|
976
|
+
}
|
|
826
977
|
|
|
827
978
|
var web = /*#__PURE__*/Object.freeze({
|
|
828
979
|
__proto__: null,
|